-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed the builders output type - Added more samples Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
- Loading branch information
Showing
177 changed files
with
1,912 additions
and
1,090 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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-alpha5').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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!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 myJsonWorkflow = `{ | ||
"document": { | ||
"dsl": "1.0.0-alpha5", | ||
"name": "using-json", | ||
"version": "1.0.0", | ||
"namespace": "default" | ||
}, | ||
"do": [ | ||
{ | ||
"step1": { | ||
"set": { | ||
"variable": "my first workflow" | ||
} | ||
} | ||
} | ||
] | ||
}`; | ||
const workflow = Workflow.deserialize(myJsonWorkflow); | ||
document.getElementById('output').innerHTML = `--- YAML ---\n${workflow.serialize()}\n\n--- JSON ---\n${workflow.serialize('json')}`; | ||
})(); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!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, Specification, validate } = serverWorkflowSdk; | ||
const workflowDefinition = { | ||
document: { | ||
dsl: '1.0.0-alpha5', | ||
name: 'using-plain-object', | ||
version: '1.0.0', | ||
namespace: 'default', | ||
}, | ||
do: [ | ||
{ | ||
step1: { | ||
set: { | ||
variable: 'my first workflow', | ||
}, | ||
}, | ||
}, | ||
], | ||
}/* as Specification.Workflow // <-- If you're using TypeScript*/; | ||
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2021-Present The Serverless Workflow Specification Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { | ||
documentBuilder, | ||
setTaskBuilder, | ||
taskListBuilder, | ||
workflowBuilder, | ||
} from /*'@serverlessworkflow/sdk';*/ '../../dist'; | ||
|
||
try { | ||
const workflow = workflowBuilder() | ||
.document( | ||
documentBuilder().dsl('1.0.0-alpha5').name('using-fluent-api').version('1.0.0').namespace('default').build(), | ||
) | ||
.do( | ||
taskListBuilder() | ||
.push({ | ||
step1: setTaskBuilder().set({ foo: 'bar' }).build(), | ||
}) | ||
.build(), | ||
) | ||
.build(); | ||
console.log(`--- YAML ---\n${workflow.serialize()}\n\n--- JSON ---\n${workflow.serialize('json')}`); | ||
} catch (ex) { | ||
console.error('Invalid workflow', ex); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Classes } from /*'@serverlessworkflow/sdk';*/ '../../dist'; | ||
|
||
const myJsonWorkflow = ` | ||
{ | ||
"document": { | ||
"dsl": "1.0.0-alpha5", | ||
"name": "using-json", | ||
"version": "1.0.0", | ||
"namespace": "default" | ||
}, | ||
"do": [ | ||
{ | ||
"step1": { | ||
"set": { | ||
"variable": "my first workflow" | ||
} | ||
} | ||
} | ||
] | ||
}`; | ||
const workflow = Classes.Workflow.deserialize(myJsonWorkflow); | ||
console.log(`--- YAML ---\n${workflow.serialize()}\n\n--- JSON ---\n${workflow.serialize('json')}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Classes, Specification, validate } from /*'@serverlessworkflow/sdk';*/ '../../dist'; | ||
|
||
const workflowDefinition = { | ||
document: { | ||
dsl: '1.0.0-alpha5', | ||
name: 'using-plain-object', | ||
version: '1.0.0', | ||
namespace: 'default', | ||
}, | ||
do: [ | ||
{ | ||
step1: { | ||
set: { | ||
variable: 'my first workflow', | ||
}, | ||
}, | ||
}, | ||
], | ||
} as Specification.Workflow; | ||
try { | ||
validate('Workflow', workflowDefinition); | ||
console.log( | ||
`--- YAML ---\n${Classes.Workflow.serialize(workflowDefinition)}\n\n--- JSON ---\n${Classes.Workflow.serialize(workflowDefinition, 'json')}`, | ||
); | ||
} catch (ex) { | ||
console.error('Invalid workflow', ex); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.