Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 17fad27
Merge: 6d4dfb5 0cf8067
Author: Tihomir Surdilovic <tihomir@temporal.io>
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 <antonio.mendoza@ikusi.com>
Date:   Tue Feb 1 22:54:21 2022 +0100

    fix diagram generation serverlessworkflow/specification#587

    Signed-off-by: Antonio Mendoza Pérez <antonio.mendoza@ikusi.com>

commit 6d4dfb5
Author: Antonio Mendoza Pérez <antmendoza@gmail.com>
Date:   Tue Jan 11 08:18:08 2022 +0100

    Fix workflow validator (#163)

    fix WorkflowValidator

commit 2636805
Author: Antonio Mendoza Pérez <antmendoza@gmail.com>
Date:   Mon Jan 10 21:46:11 2022 +0100

    ignore js files in test phase (#162)

commit b335771
Author: Antonio Mendoza Pérez <antmendoza@gmail.com>
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 <antmendoza@gmail.com>
Date:   Tue Dec 28 14:41:38 2021 +0100

    Code formatting (#160)

    * order-properties-on-serialization

    Signed-off-by: Antonio Mendoza Pérez <antmendoza@gmail.com>

    * code-formating

    Signed-off-by: Antonio Mendoza Pérez <antmendoza@gmail.com>

commit 219768d
Author: Antonio Mendoza Pérez <antmendoza@gmail.com>
Date:   Tue Dec 28 09:16:38 2021 +0100

    order-properties-on-serialization (#159)

commit 96763b9
Author: Antonio Mendoza Pérez <antmendoza@gmail.com>
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 <antmendoza@gmail.com>

    * removed-ifObject

    Signed-off-by: Antonio Mendoza Pérez <antmendoza@gmail.com>

commit d6fd5d8
Author: Antonio Mendoza Pérez <antmendoza@gmail.com>
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 <antmendoza@gmail.com>

    * update-package-version-4.0.0

    Signed-off-by: Antonio Mendoza Pérez <antmendoza@gmail.com>

commit 955dab0
Merge: 255c834 5424a3d
Author: Antonio Mendoza Pérez <antmendoza@gmail.com>
Date:   Thu Dec 9 01:24:04 2021 +0100

    Merge pull request #154 from serverlessworkflow/3.0.x

    changed-package-version
  • Loading branch information
antmendoza committed Apr 18, 2022
1 parent 5424a3d commit 8549c07
Show file tree
Hide file tree
Showing 124 changed files with 13,436 additions and 12,909 deletions.
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,30 +139,31 @@ The sdk provides a way to validate if a workflow object is compliant with the se
- `validate(): boolean`

```typescript
import { WorkflowValidator, Specification } from '@severlessworkflow/sdk-typescript';

const workflow: Specification.Workflow = {
id: 'helloworld',
version: '1.0',
specVersion: '0.8',
name: 'Hello World Workflow',
description: 'Inject Hello World',
start: 'Hello State',
states: [
{
type: 'inject',
name: 'Hello State',
end: true,
data: {
result: "Hello World!"
}
} as Specification.Injectstate
]
import {WorkflowValidator, Specification} from '@severlessworkflow/sdk-typescript';
import {Workflow} from "./workflow";

const workflow = {
id: 'helloworld',
version: '1.0',
specVersion: '0.3',
name: 'Hello World Workflow',
description: 'Inject Hello World',
start: 'Hello State',
states: [
{
type: 'inject',
name: 'Hello State',
end: true,
data: {
result: "Hello World!"
}
}
]
};

const workflowValidator: WorkflowValidator = new WorkflowValidator(workflow);
const workflowValidator: WorkflowValidator = new WorkflowValidator(Workflow.fromSource(JSON.stringify(workflow)));
if (!workflowValidator.isValid) {
workflowValidator.errors.forEach(error => console.error((error as ValidationError).message));
workflowValidator.errors.forEach(error => console.error((error as ValidationError).message));
}
```

Expand Down
62 changes: 31 additions & 31 deletions examples/browser/index.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
<!doctype html>
<html lang="en">
<head>
<head>
<meta charset="utf-8">
<title>Serveless Workflow JS SDK</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!--
Run http-server from the project root then navigate to http://localhost:8080/examples/browser/mermaid.html
-->
<div id="output"></div>
<script src="../../dist/umd/index.umd.js"></script>
<script type="text/javascript">
(() => {
const { workflowBuilder, injectstateBuilder } = serverWorkflowSdk;
<meta content="width=device-width, initial-scale=1" name="viewport">
</head>
<body>
<!--
Run http-server from the project root then navigate to http://localhost:8080/examples/browser/index.html
-->
<div id="output"></div>
<script src="../../dist/umd/index.umd.js"></script>
<script type="text/javascript">
(() => {
const {workflowBuilder, injectstateBuilder} = serverWorkflowSdk;
const outputDiv = document.getElementById('output');
const workflow = workflowBuilder()
.id("helloworld")
.version("1.0")
.specVersion("0.8")
.name("Hello World Workflow")
.description("Inject Hello World")
.start("Hello State")
.states([
injectstateBuilder()
.name("Hello State")
.data({
"result": "Hello World!"
})
.end(true)
.build()
])
.build();
.id("helloworld")
.version("1.0")
.specVersion("0.8")
.name("Hello World Workflow")
.description("Inject Hello World")
.start("Hello State")
.states([
injectstateBuilder()
.name("Hello State")
.data({
"result": "Hello World!"
})
.end(true)
.build()
])
.build();
outputDiv.innerHTML = workflow.id;
})();
</script>
</body>
})();
</script>
</body>
</html>
11 changes: 5 additions & 6 deletions examples/browser/mermaid.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
<meta charset="utf-8">
<title>Serveless Workflow JS SDK</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta content="width=device-width, initial-scale=1" name="viewport">
</head>
<body>
<!--
Run http-server from the project root then navigate to http://localhost:8080/examples/browser/index.html
Run http-server from the project root then navigate to http://localhost:8080/examples/browser/mermaid.html
-->
<div id="mermaid" class="mermaid"></div>
<div class="mermaid" id="mermaid"></div>
<script src="../../dist/umd/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:true});</script>
<script>mermaid.initialize({startOnLoad: true});</script>
<script type="text/javascript">
(() => {
const { workflowBuilder, injectstateBuilder, MermaidDiagram } = serverWorkflowSdk;
const {workflowBuilder, injectstateBuilder, MermaidDiagram} = serverWorkflowSdk;
const mermaidDiv = document.getElementById('mermaid');
const workflow = workflowBuilder()
.id("helloworld")
Expand All @@ -42,6 +42,5 @@
</script>



</body>
</html>
3 changes: 2 additions & 1 deletion examples/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { workflowBuilder, injectstateBuilder, Specification } from '../../dist';
import { injectstateBuilder, Specification, workflowBuilder } from '../../dist';

const workflow: Specification.Workflow = workflowBuilder()
.id('helloworld')
.version('1.0')
Expand Down
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node'
testEnvironment: 'node',
testPathIgnorePatterns: [".d.ts", ".js"]
};
Loading

0 comments on commit 8549c07

Please sign in to comment.