Skip to content

Commit c35dd77

Browse files
authored
update spec main branch (#147)
* update spec main branch
1 parent 84606e3 commit c35dd77

Some content is hidden

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

57 files changed

+857
-544
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import { workflowBuilder, injectstateBuilder, Specification } from '@severlesswo
4949

5050
const workflow: Specification.Workflow = workflowBuilder()
5151
.id("helloworld")
52-
.specVersion("0.7")
52+
.specVersion("0.8")
5353
.version("1.0")
5454
.name("Hello World Workflow")
5555
.description("Inject Hello World")
@@ -72,7 +72,7 @@ import { Specification, Workflow } from '@severlessworkflow/sdk-typescript';
7272

7373
const source = `id: helloworld
7474
version: '1.0'
75-
specVerion: '0.7'
75+
specVerion: '0.8'
7676
name: Hello World Workflow
7777
description: Inject Hello World
7878
start: Hello State
@@ -97,7 +97,7 @@ import { workflowBuilder, injectstateBuilder, Specification } from '@severlesswo
9797
const workflow: Specification.Workflow = workflowBuilder()
9898
.id("helloworld")
9999
.version("1.0")
100-
.specVersion("0.7")
100+
.specVersion("0.8")
101101
.name("Hello World Workflow")
102102
.description("Inject Hello World")
103103
.start("Hello State")
@@ -143,6 +143,7 @@ import { WorkflowValidator, Specification } from '@severlessworkflow/sdk-typescr
143143
const workflow: Specification.Workflow = {
144144
id: 'helloworld',
145145
version: '1.0',
146+
specVersion: '0.8',
146147
name: 'Hello World Workflow',
147148
description: 'Inject Hello World',
148149
start: 'Hello State',

examples/browser/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
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
-->
1313
<div id="output"></div>
1414
<script src="../../dist/umd/index.umd.js"></script>
@@ -19,7 +19,7 @@
1919
const workflow = workflowBuilder()
2020
.id("helloworld")
2121
.version("1.0")
22-
.specVersion("0.7")
22+
.specVersion("0.8")
2323
.name("Hello World Workflow")
2424
.description("Inject Hello World")
2525
.start("Hello State")

examples/browser/mermaid.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
const workflow = workflowBuilder()
2222
.id("helloworld")
2323
.version("1.0")
24-
.specVersion("0.7")
24+
.specVersion("0.8")
2525
.name("Hello World Workflow")
2626
.description("Inject Hello World")
2727
.start("Hello State")

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@severlessworkflow/sdk-typescript",
33
"version": "3.0.0",
4-
"schemaVersion": "0.7",
4+
"schemaVersion": "0.8",
55
"description": "Typescript SDK for Serverless Workflow Specification",
66
"main": "umd/index.umd.min.js",
77
"browser": "umd/index.umd.min.js",

src/lib/builders/databasedswitch-builder.ts renamed to src/lib/builders/databasedswitchstate-builder.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,24 @@ import { validate } from '../utils';
2020

2121
/**
2222
* The internal function used by the builder proxy to validate and return its underlying object
23-
* @param {Specification.Databasedswitch} data The underlying object
24-
* @returns {Specification.Databasedswitch} The validated underlying object
23+
* @param {Specification.Databasedswitchstate} data The underlying object
24+
* @returns {Specification.Databasedswitchstate} The validated underlying object
2525
*/
26-
function databasedswitchBuildingFn(data: Specification.Databasedswitch): () => Specification.Databasedswitch {
26+
function databasedswitchstateBuildingFn(
27+
data: Specification.Databasedswitchstate
28+
): () => Specification.Databasedswitchstate {
2729
return () => {
28-
const model = new Specification.Databasedswitch(data);
30+
const model = new Specification.Databasedswitchstate(data);
2931

30-
validate('Databasedswitch', model);
32+
validate('Databasedswitchstate', model);
3133
return model;
3234
};
3335
}
3436

3537
/**
36-
* A factory to create a builder proxy for the type `Specification.Databasedswitch`
37-
* @returns {Specification.Databasedswitch} A builder for `Specification.Databasedswitch`
38+
* A factory to create a builder proxy for the type `Specification.Databasedswitchstate`
39+
* @returns {Specification.Databasedswitchstate} A builder for `Specification.Databasedswitchstate`
3840
*/
39-
export function databasedswitchBuilder(): Builder<Specification.Databasedswitch> {
40-
return builder<Specification.Databasedswitch>(databasedswitchBuildingFn);
41+
export function databasedswitchstateBuilder(): Builder<Specification.Databasedswitchstate> {
42+
return builder<Specification.Databasedswitchstate>(databasedswitchstateBuildingFn);
4143
}

src/lib/builders/eventbasedswitch-builder.ts renamed to src/lib/builders/eventbasedswitchstate-builder.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,24 @@ import { validate } from '../utils';
2020

2121
/**
2222
* The internal function used by the builder proxy to validate and return its underlying object
23-
* @param {Specification.Eventbasedswitch} data The underlying object
24-
* @returns {Specification.Eventbasedswitch} The validated underlying object
23+
* @param {Specification.Eventbasedswitchstate} data The underlying object
24+
* @returns {Specification.Eventbasedswitchstate} The validated underlying object
2525
*/
26-
function eventbasedswitchBuildingFn(data: Specification.Eventbasedswitch): () => Specification.Eventbasedswitch {
26+
function eventbasedswitchstateBuildingFn(
27+
data: Specification.Eventbasedswitchstate
28+
): () => Specification.Eventbasedswitchstate {
2729
return () => {
28-
const model = new Specification.Eventbasedswitch(data);
30+
const model = new Specification.Eventbasedswitchstate(data);
2931

30-
validate('Eventbasedswitch', model);
32+
validate('Eventbasedswitchstate', model);
3133
return model;
3234
};
3335
}
3436

3537
/**
36-
* A factory to create a builder proxy for the type `Specification.Eventbasedswitch`
37-
* @returns {Specification.Eventbasedswitch} A builder for `Specification.Eventbasedswitch`
38+
* A factory to create a builder proxy for the type `Specification.Eventbasedswitchstate`
39+
* @returns {Specification.Eventbasedswitchstate} A builder for `Specification.Eventbasedswitchstate`
3840
*/
39-
export function eventbasedswitchBuilder(): Builder<Specification.Eventbasedswitch> {
40-
return builder<Specification.Eventbasedswitch>(eventbasedswitchBuildingFn);
41+
export function eventbasedswitchstateBuilder(): Builder<Specification.Eventbasedswitchstate> {
42+
return builder<Specification.Eventbasedswitchstate>(eventbasedswitchstateBuildingFn);
4143
}

src/lib/builders/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ export * from './callbackstate-builder';
2525
export * from './continueasdef-builder';
2626
export * from './correlation-def-builder';
2727
export * from './crondef-builder';
28-
export * from './databasedswitch-builder';
28+
export * from './databasedswitchstate-builder';
2929
export * from './defaultconditiondef-builder';
3030
export * from './end-builder';
3131
export * from './enddatacondition-builder';
3232
export * from './enddeventcondition-builder';
3333
export * from './error-builder';
3434
export * from './errordef-builder';
35-
export * from './eventbasedswitch-builder';
35+
export * from './eventbasedswitchstate-builder';
3636
export * from './eventdatafilter-builder';
3737
export * from './eventdef-builder';
3838
export * from './eventref-builder';

src/lib/definitions/action.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import { Actiondatafilter } from './actiondatafilter';
1717
import { Eventref } from './eventref';
1818
import { Functionref } from './functionref';
1919
import {
20+
normalizeEventRef,
21+
normalizeFunctionRef,
2022
normalizeSubFlowRefIfObject,
2123
overwriteActionDataFilter,
2224
overwriteEventRef,
@@ -38,6 +40,10 @@ export class Action {
3840
overwriteActionDataFilter(this);
3941
}
4042

43+
/**
44+
* Unique action identifier
45+
*/
46+
id?: string;
4147
/**
4248
* Unique action definition name
4349
*/
@@ -59,14 +65,21 @@ export class Action {
5965
*/
6066
retryableErrors?: [string, ...string[]];
6167
actionDataFilter?: Actiondatafilter;
68+
/**
69+
* Expression, if defined, must evaluate to true for this action to be performed. If false, action is disregarded
70+
*/
71+
condition?: string;
6272

6373
/**
6474
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
6575
* @returns {Specification.Action} without deleted properties.
6676
*/
6777
normalize = (): Action => {
6878
const clone = new Action(this);
79+
6980
normalizeSubFlowRefIfObject(clone);
81+
normalizeEventRef(clone);
82+
normalizeFunctionRef(clone);
7083

7184
return clone;
7285
};

src/lib/definitions/actiondatafilter.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export class Actiondatafilter {
2323
* Workflow expression that selects state data that the state action can use
2424
*/
2525
fromStateData?: string;
26+
/**
27+
* If set to false, action data results are not added/merged to state data. In this case 'results' and 'toStateData' should be ignored. Default is true.
28+
*/
29+
useResults?: boolean;
2630
/**
2731
* Workflow expression that filters the actions data results
2832
*/

src/lib/definitions/databasedswitch.ts renamed to src/lib/definitions/databasedswitchstate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
import { Datacondition } from './types';
3434
import { StateExecTimeout } from './stateExecTimeout';
3535

36-
export class Databasedswitch {
36+
export class Databasedswitchstate {
3737
constructor(model: any) {
3838
const defaultModel = { type: 'switch', usedForCompensation: false };
3939
Object.assign(this, defaultModel, model);
@@ -79,7 +79,7 @@ export class Databasedswitch {
7979
/**
8080
* Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition
8181
*/
82-
defaultCondition?: /* DefaultCondition definition. Can be either a transition or end definition */ Defaultconditiondef;
82+
defaultCondition: /* DefaultCondition definition. Can be either a transition or end definition */ Defaultconditiondef;
8383
/**
8484
* Unique Name of a workflow state which is responsible for compensation of this state
8585
*/
@@ -94,8 +94,8 @@ export class Databasedswitch {
9494
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
9595
* @returns {Specification.Databasedswitch} without deleted properties.
9696
*/
97-
normalize = (): Databasedswitch => {
98-
const clone = new Databasedswitch(this);
97+
normalize = (): Databasedswitchstate => {
98+
const clone = new Databasedswitchstate(this);
9999

100100
normalizeDataConditions(clone);
101101
normalizeOnErrors(clone);

0 commit comments

Comments
 (0)