Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 250ffcf

Browse files
Kerry Changstarpit
authored andcommitted
update wskflow to work with composer v4
update tests to work with composer v4 update helper functions in composer to work with v4 fixes wskflow to allow custom objects generated by composer v4 edited rules for hiding inline functinos to work wtih composer v4 changes for composer 0.4.0-test.2 update package.json to point to the latest composer on npm removed console logs
1 parent 9bc3d8f commit 250ffcf

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

lib/composer.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ exports.create = ({name, fsm, type, annotations=[], parameters=[], wsk, commandT
464464
])
465465
.then(([currentAction]) => {
466466
// now we merge together the parameters and annotations
467-
const fsmAction = fsm.encode(fqnAppName).actions[0].action
467+
const fsmAction = openwhiskComposer.encode(openwhiskComposer.composition(fqnAppName, fsm), "0.4.0").actions[0].action
468468
fsmAction.parameters = currentAction.parameters.concat(parameters).concat(fsmAction.parameters || []),
469469
fsmAction.annotations = mergeAnnotations(currentAction.annotations,
470470
mergeAnnotations(annotations||[], fsmAction.annotations||[]),
@@ -757,25 +757,28 @@ exports.decorateAsApp = ({action, viewName='app', commandPrefix='app get', doVis
757757
* Extract the Action Tasks from a given FSM
758758
*
759759
*/
760-
exports.extractActionsFromFSM = ({composition=[]}={}) => {
760+
exports.extractActionsFromFSM = (composition) => {
761761
const actions = []
762762

763763
/** recursively add actions from the given root sequence */
764-
const iter = root => root.forEach(node => {
765-
if (node.type === 'action') {
766-
actions.push(node.name)
767-
} else {
768-
for (let key in node) {
769-
if (util.isArray(node[key])) {
770-
iter(node[key])
771-
}
772-
}
764+
const iter = root => {
765+
if(root.type === 'action'){
766+
actions.push(root.name);
773767
}
774-
})
768+
else{
769+
Object.keys(root).forEach(key => {
770+
if(Array.isArray(root[key])){
771+
root[key].forEach(obj => iter(obj));
772+
}
773+
else if(typeof root[key] === 'object' && root[key] !== null){
774+
iter(root[key])
775+
}
776+
})
777+
}
778+
}
775779

776-
// start from the root
780+
// start from the root
777781
iter(composition)
778-
779782
return actions
780783
}
781784

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"license": "Apache-2.0",
1414
"dependencies": {
15-
"@ibm-functions/composer": "^0.3.0",
15+
"@ibm-functions/composer": "^0.4.0",
1616
"chokidar": "^2.0.3"
1717
}
1818
}

0 commit comments

Comments
 (0)