forked from serverlessworkflow/sdk-typescript
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathusing-fluent-api.html
36 lines (33 loc) · 1.05 KB
/
using-fluent-api.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Serveless Workflow</title>
<base href="/">
<meta content="width=device-width, initial-scale=1" name="viewport">
</head>
<body>
<pre id="output"></pre>
<script src="../../dist/umd/index.umd.js"></script>
<script type="text/javascript">
(() => {
const { workflowBuilder, documentBuilder, taskListBuilder, setTaskBuilder } = serverWorkflowSdk;
try {
const workflow = workflowBuilder()
.document(documentBuilder().dsl('1.0.0').name('using-fluent-api').version('1.0.0').namespace('default').build())
.do(
taskListBuilder()
.push({
step1: setTaskBuilder().set({ foo: 'bar' }).build(),
})
.build(),
)
.build();
document.getElementById('output').innerHTML = `--- YAML ---\n${workflow.serialize()}\n\n--- JSON ---\n${workflow.serialize('json')}`;
} catch (ex) {
console.error('Invalid workflow', ex);
}
})();
</script>
</body>
</html>