forked from serverlessworkflow/sdk-typescript
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathusing-class.html
44 lines (41 loc) · 1.03 KB
/
using-class.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
37
38
39
40
41
42
43
44
<!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 { Classes: { Workflow } } = serverWorkflowSdk;
const workflow = new Workflow({
document: {
dsl: '1.0.0',
name: 'using-class',
version: '1.0.0',
namespace: 'default',
},
do: [
{
step1: {
set: {
variable: 'my first workflow',
},
},
},
],
});
try {
workflow.validate();
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>