-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathusing-plain-object.html
More file actions
43 lines (41 loc) · 1.15 KB
/
using-plain-object.html
File metadata and controls
43 lines (41 loc) · 1.15 KB
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Serverless Workflow ESM Example</title>
<base href="/" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
</head>
<body>
<pre id="output"></pre>
<script type="module">
import { Classes, validate } from '../../dist/index.mjs';
(() => {
const workflowDefinition = {
document: {
dsl: '1.0.3',
name: 'using-plain-object',
version: '1.0.0',
namespace: 'default',
},
do: [
{
step1: {
set: {
variable: 'my first workflow',
},
},
},
],
};
try {
validate('Workflow', workflowDefinition);
document.getElementById('output').innerHTML =
`--- YAML ---\n${Classes.Workflow.serialize(workflowDefinition)}\n\n--- JSON ---\n${Classes.Workflow.serialize(workflowDefinition, 'json')}`;
} catch (ex) {
console.error('Invalid workflow', ex);
}
})();
</script>
</body>
</html>