Skip to content

Commit 8549c07

Browse files
committed
Squashed commit of the following:
commit 17fad27 Merge: 6d4dfb5 0cf8067 Author: Tihomir Surdilovic <[email protected]> Date: Tue Feb 1 20:52:32 2022 -0500 Merge pull request #164 from antmendoza/fix-diagram-generation fix diagram generation serverlessworkflow/specification#587 commit 0cf8067 Author: Antonio Mendoza Pérez <[email protected]> Date: Tue Feb 1 22:54:21 2022 +0100 fix diagram generation serverlessworkflow/specification#587 Signed-off-by: Antonio Mendoza Pérez <[email protected]> commit 6d4dfb5 Author: Antonio Mendoza Pérez <[email protected]> Date: Tue Jan 11 08:18:08 2022 +0100 Fix workflow validator (#163) fix WorkflowValidator commit 2636805 Author: Antonio Mendoza Pérez <[email protected]> Date: Mon Jan 10 21:46:11 2022 +0100 ignore js files in test phase (#162) commit b335771 Author: Antonio Mendoza Pérez <[email protected]> Date: Mon Jan 10 21:39:13 2022 +0100 Handle compensatedBy in diagram generation (#161) handle compensatedBy diagram generation commit a89acd0 Author: Antonio Mendoza Pérez <[email protected]> Date: Tue Dec 28 14:41:38 2021 +0100 Code formatting (#160) * order-properties-on-serialization Signed-off-by: Antonio Mendoza Pérez <[email protected]> * code-formating Signed-off-by: Antonio Mendoza Pérez <[email protected]> commit 219768d Author: Antonio Mendoza Pérez <[email protected]> Date: Tue Dec 28 09:16:38 2021 +0100 order-properties-on-serialization (#159) commit 96763b9 Author: Antonio Mendoza Pérez <[email protected]> Date: Sat Dec 25 20:16:46 2021 +0100 Fix default values are removed on serialization (#156) * fix-remove-default-values Signed-off-by: Antonio Mendoza Pérez <[email protected]> * removed-ifObject Signed-off-by: Antonio Mendoza Pérez <[email protected]> commit d6fd5d8 Author: Antonio Mendoza Pérez <[email protected]> Date: Sat Dec 25 16:04:44 2021 +0100 update-package-version-4.0.0 (#157) * update-package-version-4.0.0 Signed-off-by: Antonio Mendoza Pérez <[email protected]> * update-package-version-4.0.0 Signed-off-by: Antonio Mendoza Pérez <[email protected]> commit 955dab0 Merge: 255c834 5424a3d Author: Antonio Mendoza Pérez <[email protected]> Date: Thu Dec 9 01:24:04 2021 +0100 Merge pull request #154 from serverlessworkflow/3.0.x changed-package-version
1 parent 5424a3d commit 8549c07

File tree

124 files changed

+13436
-12909
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+13436
-12909
lines changed

README.md

+22-21
Original file line numberDiff line numberDiff line change
@@ -139,30 +139,31 @@ The sdk provides a way to validate if a workflow object is compliant with the se
139139
- `validate(): boolean`
140140

141141
```typescript
142-
import { WorkflowValidator, Specification } from '@severlessworkflow/sdk-typescript';
143-
144-
const workflow: Specification.Workflow = {
145-
id: 'helloworld',
146-
version: '1.0',
147-
specVersion: '0.8',
148-
name: 'Hello World Workflow',
149-
description: 'Inject Hello World',
150-
start: 'Hello State',
151-
states: [
152-
{
153-
type: 'inject',
154-
name: 'Hello State',
155-
end: true,
156-
data: {
157-
result: "Hello World!"
158-
}
159-
} as Specification.Injectstate
160-
]
142+
import {WorkflowValidator, Specification} from '@severlessworkflow/sdk-typescript';
143+
import {Workflow} from "./workflow";
144+
145+
const workflow = {
146+
id: 'helloworld',
147+
version: '1.0',
148+
specVersion: '0.3',
149+
name: 'Hello World Workflow',
150+
description: 'Inject Hello World',
151+
start: 'Hello State',
152+
states: [
153+
{
154+
type: 'inject',
155+
name: 'Hello State',
156+
end: true,
157+
data: {
158+
result: "Hello World!"
159+
}
160+
}
161+
]
161162
};
162163

163-
const workflowValidator: WorkflowValidator = new WorkflowValidator(workflow);
164+
const workflowValidator: WorkflowValidator = new WorkflowValidator(Workflow.fromSource(JSON.stringify(workflow)));
164165
if (!workflowValidator.isValid) {
165-
workflowValidator.errors.forEach(error => console.error((error as ValidationError).message));
166+
workflowValidator.errors.forEach(error => console.error((error as ValidationError).message));
166167
}
167168
```
168169

examples/browser/index.html

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
<!doctype html>
22
<html lang="en">
3-
<head>
3+
<head>
44
<meta charset="utf-8">
55
<title>Serveless Workflow JS SDK</title>
66
<base href="/">
7-
<meta name="viewport" content="width=device-width, initial-scale=1">
8-
</head>
9-
<body>
10-
<!--
11-
Run http-server from the project root then navigate to http://localhost:8080/examples/browser/mermaid.html
12-
-->
13-
<div id="output"></div>
14-
<script src="../../dist/umd/index.umd.js"></script>
15-
<script type="text/javascript">
16-
(() => {
17-
const { workflowBuilder, injectstateBuilder } = serverWorkflowSdk;
7+
<meta content="width=device-width, initial-scale=1" name="viewport">
8+
</head>
9+
<body>
10+
<!--
11+
Run http-server from the project root then navigate to http://localhost:8080/examples/browser/index.html
12+
-->
13+
<div id="output"></div>
14+
<script src="../../dist/umd/index.umd.js"></script>
15+
<script type="text/javascript">
16+
(() => {
17+
const {workflowBuilder, injectstateBuilder} = serverWorkflowSdk;
1818
const outputDiv = document.getElementById('output');
1919
const workflow = workflowBuilder()
20-
.id("helloworld")
21-
.version("1.0")
22-
.specVersion("0.8")
23-
.name("Hello World Workflow")
24-
.description("Inject Hello World")
25-
.start("Hello State")
26-
.states([
27-
injectstateBuilder()
28-
.name("Hello State")
29-
.data({
30-
"result": "Hello World!"
31-
})
32-
.end(true)
33-
.build()
34-
])
35-
.build();
20+
.id("helloworld")
21+
.version("1.0")
22+
.specVersion("0.8")
23+
.name("Hello World Workflow")
24+
.description("Inject Hello World")
25+
.start("Hello State")
26+
.states([
27+
injectstateBuilder()
28+
.name("Hello State")
29+
.data({
30+
"result": "Hello World!"
31+
})
32+
.end(true)
33+
.build()
34+
])
35+
.build();
3636
outputDiv.innerHTML = workflow.id;
37-
})();
38-
</script>
39-
</body>
37+
})();
38+
</script>
39+
</body>
4040
</html>

examples/browser/mermaid.html

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
<meta charset="utf-8">
55
<title>Serveless Workflow JS SDK</title>
66
<base href="/">
7-
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<meta content="width=device-width, initial-scale=1" name="viewport">
88
</head>
99
<body>
1010
<!--
11-
Run http-server from the project root then navigate to http://localhost:8080/examples/browser/index.html
11+
Run http-server from the project root then navigate to http://localhost:8080/examples/browser/mermaid.html
1212
-->
13-
<div id="mermaid" class="mermaid"></div>
13+
<div class="mermaid" id="mermaid"></div>
1414
<script src="../../dist/umd/index.umd.js"></script>
1515
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
16-
<script>mermaid.initialize({startOnLoad:true});</script>
16+
<script>mermaid.initialize({startOnLoad: true});</script>
1717
<script type="text/javascript">
1818
(() => {
19-
const { workflowBuilder, injectstateBuilder, MermaidDiagram } = serverWorkflowSdk;
19+
const {workflowBuilder, injectstateBuilder, MermaidDiagram} = serverWorkflowSdk;
2020
const mermaidDiv = document.getElementById('mermaid');
2121
const workflow = workflowBuilder()
2222
.id("helloworld")
@@ -42,6 +42,5 @@
4242
</script>
4343

4444

45-
4645
</body>
4746
</html>

examples/node/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import { workflowBuilder, injectstateBuilder, Specification } from '../../dist';
16+
import { injectstateBuilder, Specification, workflowBuilder } from '../../dist';
17+
1718
const workflow: Specification.Workflow = workflowBuilder()
1819
.id('helloworld')
1920
.version('1.0')

jest.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
22
module.exports = {
33
preset: 'ts-jest',
4-
testEnvironment: 'node'
4+
testEnvironment: 'node',
5+
testPathIgnorePatterns: [".d.ts", ".js"]
56
};

0 commit comments

Comments
 (0)