@kui-shell/plugin-tutorials
Version:
IBM Cloud shell plugin for tutorials
182 lines (177 loc) • 6.39 kB
JSON
{
"fullscreen": true,
"profile": "Combinators Reference Guide",
"level": "Reference",
"skills": ["Combinators"],
"steps": [
{
"heading": "Reference Guide",
"content": "Compositions are crafted by writing code. To help with crafting, you have access to a library of **combinators**. Using this library, you can combine existing services and Cloud Functions into new APIs, **using normal programming constructs**. This is a reference guide to those operations.",
"renderingHints": "full-width-table",
"sidecar": "fullscreen",
"extras": {
"nextSteps-nope": [
{
"command": "tutorial list",
"doc": "Choose from a list of **tutorials**."
},
{
"command": "composer help",
"doc": "Explore the Composition Service **commands**."
}
],
"table": [
{
"title": "Basic Operations",
"columns": ["Combinator", "Description"],
"rows": [
[
{
"value": "if(cond,then,else)",
"command": "preview -c @demos/if.js"
},
"A standard if-then-else construct."
],
[
{
"value": "finally(body,finalizer)",
"command": "preview -c @demos/combinators/finally.js"
},
"Always execute `finalizer` after `body`."
],
[
{
"value": "seq(a,b,c)",
"command": "preview -c @demos/seq.js"
},
"Execute tasks serially, as with a UNIX pipe."
],
[
{
"value": "try(task,catch)",
"command": "preview -c @demos/try.js"
},
"A try-catch: if `task` fails, pass error to `catch`."
],
[
{
"value": "while(cond,body)",
"command": "preview -c @demos/combinators/while.js"
},
"A standard while-do construct."
]
]
},
{
"title": "Data Management",
"columns": ["Combinator", "Description"],
"rows": [
[
{
"value": "let({k:v},a,b,c)",
"command": "preview -c @demos/combinators/let.js"
},
"Inject a set of parameter bindings into a sequence."
],
[
{
"value": "merge(a,b,c)",
"command": "preview -c @demos/combinators/merge.js"
},
"As with `retain`, except combine the input and the output into a single object."
],
[
{
"value": "retain(a,b,c)",
"command": "preview -c @demos/retain.js"
},
"Data forwarding: invoke a sequence, and yield both the original input and the result of the sequence."
]
]
},
{
"title": "Parallel Operations",
"columns": ["Combinator", "Description"],
"rows": [
[
{
"value": "map(a,b,c)",
"command": "preview -c @demos/combinators/map.js"
},
"Map, in parallel, the given sequence of operations to every element of the input array."
],
[
{
"value": "par(t1,t2,t3)",
"command": "preview -c @demos/par.js"
},
"Do two or more tasks in parallel, where the input is fed to each of the tasks, and the output is an array of task results."
]
]
},
{
"title": "Advanced Scenarios",
"columns": ["Combinator", "Description"],
"rows": [
[
{
"value": "async(a,b,c)",
"command": "preview -c @demos/combinators/async.js"
},
"Fire and forget the given sequence."
],
[
{
"value": "literal({k:v})",
"command": "preview -c @demos/combinators/literal.js"
},
"Similar to `let`, except return the bindings rather than injecting them."
],
[
{
"value": "mask(a,b,c)",
"command": "preview -c @demos/combinators/mask.js"
},
"Invoke a sequence, redacting the parameter bindings of the nearest enclosing `let`."
]
]
},
{
"title": "Infrequently Used Operations",
"columns": ["Combinator", "Description"],
"rows": [
[
{
"value": "action(\"myAction\")",
"command": "preview -c @demos/combinators/action.js"
},
"Invoke a previously deployed Cloud Function, or deploy an inline function as a Cloud Function."
],
[
{
"value": "composition(\"myComp\")",
"command": "preview -c @demos/combinators/composition.js"
},
"Invoke a previously deployed Composition. You probably only need this when faced with separately developed, and separately deployed, compositions."
],
[
{
"value": "empty()",
"command": "preview -c @demos/combinators/empty.js"
},
"Represents the no-op composition. This combinator is sometimes useful for clarity."
],
[
{
"value": "function(x => ...)",
"command": "preview -c @demos/combinators/function.js"
},
"Execute an inline function. This is rarely needed; in most cases, the function code itself is sufficient."
]
]
}
]
}
}
]
}