diff --git a/README.md b/README.md
index 60eb89e2..f45f15a0 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ import { workflowBuilder, injectstateBuilder, Specification } from '@severlesswo
const workflow: Specification.Workflow = workflowBuilder()
.id("helloworld")
- .specVersion("0.7")
+ .specVersion("0.8")
.version("1.0")
.name("Hello World Workflow")
.description("Inject Hello World")
@@ -72,7 +72,7 @@ import { Specification, Workflow } from '@severlessworkflow/sdk-typescript';
const source = `id: helloworld
version: '1.0'
-specVerion: '0.7'
+specVerion: '0.8'
name: Hello World Workflow
description: Inject Hello World
start: Hello State
@@ -97,7 +97,7 @@ import { workflowBuilder, injectstateBuilder, Specification } from '@severlesswo
const workflow: Specification.Workflow = workflowBuilder()
.id("helloworld")
.version("1.0")
- .specVersion("0.7")
+ .specVersion("0.8")
.name("Hello World Workflow")
.description("Inject Hello World")
.start("Hello State")
@@ -143,6 +143,7 @@ import { WorkflowValidator, Specification } from '@severlessworkflow/sdk-typescr
const workflow: Specification.Workflow = {
id: 'helloworld',
version: '1.0',
+ specVersion: '0.8',
name: 'Hello World Workflow',
description: 'Inject Hello World',
start: 'Hello State',
diff --git a/examples/browser/index.html b/examples/browser/index.html
index 3aea1101..77710f47 100644
--- a/examples/browser/index.html
+++ b/examples/browser/index.html
@@ -8,7 +8,7 @@
@@ -19,7 +19,7 @@
const workflow = workflowBuilder()
.id("helloworld")
.version("1.0")
- .specVersion("0.7")
+ .specVersion("0.8")
.name("Hello World Workflow")
.description("Inject Hello World")
.start("Hello State")
diff --git a/examples/browser/mermaid.html b/examples/browser/mermaid.html
index 9e12f6bb..684ca5ce 100644
--- a/examples/browser/mermaid.html
+++ b/examples/browser/mermaid.html
@@ -21,7 +21,7 @@
const workflow = workflowBuilder()
.id("helloworld")
.version("1.0")
- .specVersion("0.7")
+ .specVersion("0.8")
.name("Hello World Workflow")
.description("Inject Hello World")
.start("Hello State")
diff --git a/package.json b/package.json
index 20d97d4a..69866c7f 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@severlessworkflow/sdk-typescript",
"version": "3.0.0",
- "schemaVersion": "0.7",
+ "schemaVersion": "0.8",
"description": "Typescript SDK for Serverless Workflow Specification",
"main": "umd/index.umd.min.js",
"browser": "umd/index.umd.min.js",
diff --git a/src/lib/builders/databasedswitch-builder.ts b/src/lib/builders/databasedswitchstate-builder.ts
similarity index 58%
rename from src/lib/builders/databasedswitch-builder.ts
rename to src/lib/builders/databasedswitchstate-builder.ts
index d883f20a..674058ff 100644
--- a/src/lib/builders/databasedswitch-builder.ts
+++ b/src/lib/builders/databasedswitchstate-builder.ts
@@ -20,22 +20,24 @@ import { validate } from '../utils';
/**
* The internal function used by the builder proxy to validate and return its underlying object
- * @param {Specification.Databasedswitch} data The underlying object
- * @returns {Specification.Databasedswitch} The validated underlying object
+ * @param {Specification.Databasedswitchstate} data The underlying object
+ * @returns {Specification.Databasedswitchstate} The validated underlying object
*/
-function databasedswitchBuildingFn(data: Specification.Databasedswitch): () => Specification.Databasedswitch {
+function databasedswitchstateBuildingFn(
+ data: Specification.Databasedswitchstate
+): () => Specification.Databasedswitchstate {
return () => {
- const model = new Specification.Databasedswitch(data);
+ const model = new Specification.Databasedswitchstate(data);
- validate('Databasedswitch', model);
+ validate('Databasedswitchstate', model);
return model;
};
}
/**
- * A factory to create a builder proxy for the type `Specification.Databasedswitch`
- * @returns {Specification.Databasedswitch} A builder for `Specification.Databasedswitch`
+ * A factory to create a builder proxy for the type `Specification.Databasedswitchstate`
+ * @returns {Specification.Databasedswitchstate} A builder for `Specification.Databasedswitchstate`
*/
-export function databasedswitchBuilder(): Builder {
- return builder(databasedswitchBuildingFn);
+export function databasedswitchstateBuilder(): Builder {
+ return builder(databasedswitchstateBuildingFn);
}
diff --git a/src/lib/builders/eventbasedswitch-builder.ts b/src/lib/builders/eventbasedswitchstate-builder.ts
similarity index 58%
rename from src/lib/builders/eventbasedswitch-builder.ts
rename to src/lib/builders/eventbasedswitchstate-builder.ts
index d95741dd..7743473e 100644
--- a/src/lib/builders/eventbasedswitch-builder.ts
+++ b/src/lib/builders/eventbasedswitchstate-builder.ts
@@ -20,22 +20,24 @@ import { validate } from '../utils';
/**
* The internal function used by the builder proxy to validate and return its underlying object
- * @param {Specification.Eventbasedswitch} data The underlying object
- * @returns {Specification.Eventbasedswitch} The validated underlying object
+ * @param {Specification.Eventbasedswitchstate} data The underlying object
+ * @returns {Specification.Eventbasedswitchstate} The validated underlying object
*/
-function eventbasedswitchBuildingFn(data: Specification.Eventbasedswitch): () => Specification.Eventbasedswitch {
+function eventbasedswitchstateBuildingFn(
+ data: Specification.Eventbasedswitchstate
+): () => Specification.Eventbasedswitchstate {
return () => {
- const model = new Specification.Eventbasedswitch(data);
+ const model = new Specification.Eventbasedswitchstate(data);
- validate('Eventbasedswitch', model);
+ validate('Eventbasedswitchstate', model);
return model;
};
}
/**
- * A factory to create a builder proxy for the type `Specification.Eventbasedswitch`
- * @returns {Specification.Eventbasedswitch} A builder for `Specification.Eventbasedswitch`
+ * A factory to create a builder proxy for the type `Specification.Eventbasedswitchstate`
+ * @returns {Specification.Eventbasedswitchstate} A builder for `Specification.Eventbasedswitchstate`
*/
-export function eventbasedswitchBuilder(): Builder {
- return builder(eventbasedswitchBuildingFn);
+export function eventbasedswitchstateBuilder(): Builder {
+ return builder(eventbasedswitchstateBuildingFn);
}
diff --git a/src/lib/builders/index.ts b/src/lib/builders/index.ts
index df214ba2..cd7065f0 100644
--- a/src/lib/builders/index.ts
+++ b/src/lib/builders/index.ts
@@ -25,14 +25,14 @@ export * from './callbackstate-builder';
export * from './continueasdef-builder';
export * from './correlation-def-builder';
export * from './crondef-builder';
-export * from './databasedswitch-builder';
+export * from './databasedswitchstate-builder';
export * from './defaultconditiondef-builder';
export * from './end-builder';
export * from './enddatacondition-builder';
export * from './enddeventcondition-builder';
export * from './error-builder';
export * from './errordef-builder';
-export * from './eventbasedswitch-builder';
+export * from './eventbasedswitchstate-builder';
export * from './eventdatafilter-builder';
export * from './eventdef-builder';
export * from './eventref-builder';
diff --git a/src/lib/definitions/action.ts b/src/lib/definitions/action.ts
index e5b12411..2f6ff1e2 100644
--- a/src/lib/definitions/action.ts
+++ b/src/lib/definitions/action.ts
@@ -17,6 +17,8 @@ import { Actiondatafilter } from './actiondatafilter';
import { Eventref } from './eventref';
import { Functionref } from './functionref';
import {
+ normalizeEventRef,
+ normalizeFunctionRef,
normalizeSubFlowRefIfObject,
overwriteActionDataFilter,
overwriteEventRef,
@@ -38,6 +40,10 @@ export class Action {
overwriteActionDataFilter(this);
}
+ /**
+ * Unique action identifier
+ */
+ id?: string;
/**
* Unique action definition name
*/
@@ -59,6 +65,10 @@ export class Action {
*/
retryableErrors?: [string, ...string[]];
actionDataFilter?: Actiondatafilter;
+ /**
+ * Expression, if defined, must evaluate to true for this action to be performed. If false, action is disregarded
+ */
+ condition?: string;
/**
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
@@ -66,7 +76,10 @@ export class Action {
*/
normalize = (): Action => {
const clone = new Action(this);
+
normalizeSubFlowRefIfObject(clone);
+ normalizeEventRef(clone);
+ normalizeFunctionRef(clone);
return clone;
};
diff --git a/src/lib/definitions/actiondatafilter.ts b/src/lib/definitions/actiondatafilter.ts
index 298c7ae6..fda52a51 100644
--- a/src/lib/definitions/actiondatafilter.ts
+++ b/src/lib/definitions/actiondatafilter.ts
@@ -23,6 +23,10 @@ export class Actiondatafilter {
* Workflow expression that selects state data that the state action can use
*/
fromStateData?: string;
+ /**
+ * 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.
+ */
+ useResults?: boolean;
/**
* Workflow expression that filters the actions data results
*/
diff --git a/src/lib/definitions/databasedswitch.ts b/src/lib/definitions/databasedswitchstate.ts
similarity index 92%
rename from src/lib/definitions/databasedswitch.ts
rename to src/lib/definitions/databasedswitchstate.ts
index 2356568b..42f3f44e 100644
--- a/src/lib/definitions/databasedswitch.ts
+++ b/src/lib/definitions/databasedswitchstate.ts
@@ -33,7 +33,7 @@ import {
import { Datacondition } from './types';
import { StateExecTimeout } from './stateExecTimeout';
-export class Databasedswitch {
+export class Databasedswitchstate {
constructor(model: any) {
const defaultModel = { type: 'switch', usedForCompensation: false };
Object.assign(this, defaultModel, model);
@@ -79,7 +79,7 @@ export class Databasedswitch {
/**
* Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition
*/
- defaultCondition?: /* DefaultCondition definition. Can be either a transition or end definition */ Defaultconditiondef;
+ defaultCondition: /* DefaultCondition definition. Can be either a transition or end definition */ Defaultconditiondef;
/**
* Unique Name of a workflow state which is responsible for compensation of this state
*/
@@ -94,8 +94,8 @@ export class Databasedswitch {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Databasedswitch} without deleted properties.
*/
- normalize = (): Databasedswitch => {
- const clone = new Databasedswitch(this);
+ normalize = (): Databasedswitchstate => {
+ const clone = new Databasedswitchstate(this);
normalizeDataConditions(clone);
normalizeOnErrors(clone);
diff --git a/src/lib/definitions/eventbasedswitch.ts b/src/lib/definitions/eventbasedswitchstate.ts
similarity index 92%
rename from src/lib/definitions/eventbasedswitch.ts
rename to src/lib/definitions/eventbasedswitchstate.ts
index 616375b6..28b778de 100644
--- a/src/lib/definitions/eventbasedswitch.ts
+++ b/src/lib/definitions/eventbasedswitchstate.ts
@@ -33,7 +33,7 @@ import {
import { Eventcondition, EventTimeout } from './types';
import { StateExecTimeout } from './stateExecTimeout';
-export class Eventbasedswitch {
+export class Eventbasedswitchstate {
constructor(model: any) {
const defaultModel = {
type: 'switch',
@@ -83,7 +83,7 @@ export class Eventbasedswitch {
/**
* Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition
*/
- defaultCondition?: /* DefaultCondition definition. Can be either a transition or end definition */ Defaultconditiondef;
+ defaultCondition: /* DefaultCondition definition. Can be either a transition or end definition */ Defaultconditiondef;
/**
* Unique Name of a workflow state which is responsible for compensation of this state
*/
@@ -98,8 +98,8 @@ export class Eventbasedswitch {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Eventbasedswitch} without deleted properties.
*/
- normalize = (): Eventbasedswitch => {
- const clone = new Eventbasedswitch(this);
+ normalize = (): Eventbasedswitchstate => {
+ const clone = new Eventbasedswitchstate(this);
normalizeEventConditions(clone);
normalizeOnErrors(clone);
diff --git a/src/lib/definitions/eventdatafilter.ts b/src/lib/definitions/eventdatafilter.ts
index 0c346367..1926ec66 100644
--- a/src/lib/definitions/eventdatafilter.ts
+++ b/src/lib/definitions/eventdatafilter.ts
@@ -20,7 +20,11 @@ export class Eventdatafilter {
}
/**
- * Workflow expression that filters the received event/payload (default: '${ . }')
+ * If set to false, event payload is not added/merged to state data. In this case 'data' and 'toStateData' should be ignored. Default is true.
+ */
+ useData?: boolean;
+ /**
+ * Workflow expression that filters the received event payload (default: '${ . }')
*/
data?: string;
/**
diff --git a/src/lib/definitions/eventref.ts b/src/lib/definitions/eventref.ts
index 2d7133d9..4cc3c926 100644
--- a/src/lib/definitions/eventref.ts
+++ b/src/lib/definitions/eventref.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { overwritePropertyAsPlainType } from './utils';
+import { normalizeInvoke, overwritePropertyAsPlainType } from './utils';
export class Eventref {
constructor(model: any) {
@@ -31,6 +31,10 @@ export class Eventref {
* Reference to the unique name of a 'consumed' event definition
*/
resultEventRef: string;
+ /**
+ * Maximum amount of time (ISO 8601 format) to wait for the result event. If not defined it should default to the actionExecutionTimeout
+ */
+ resultEventTimeout?: string;
/**
* If string type, an expression which selects parts of the states data output to become the data (payload) of the event referenced by 'triggerEventRef'. If object type, a custom object to become the data (payload) of the event referenced by 'triggerEventRef'.
*/
@@ -45,4 +49,20 @@ export class Eventref {
contextAttributes?: {
[name: string]: string;
};
+ /**
+ * Specifies if the function should be invoked sync or async. Default is sync.
+ */
+ invoke?: 'sync' | 'async';
+
+ /**
+ * Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
+ * @returns {Specification.Eventref} without deleted properties.
+ */
+ normalize = (): Eventref => {
+ const clone = new Eventref(this);
+
+ normalizeInvoke(clone);
+
+ return clone;
+ };
}
diff --git a/src/lib/definitions/functionref.ts b/src/lib/definitions/functionref.ts
index 3053000e..917ff3fd 100644
--- a/src/lib/definitions/functionref.ts
+++ b/src/lib/definitions/functionref.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { overwritePropertyAsPlainType } from './utils';
+import { normalizeInvoke, overwritePropertyAsPlainType } from './utils';
export class Functionref {
constructor(model: any) {
@@ -36,4 +36,20 @@ export class Functionref {
* Only used if function type is 'graphql'. A string containing a valid GraphQL selection set
*/
selectionSet?: string;
+ /**
+ * Specifies if the function should be invoked sync or async
+ */
+ invoke?: 'sync' | 'async';
+
+ /**
+ * Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
+ * @returns {Specification.Functionref} without deleted properties.
+ */
+ normalize = (): Functionref => {
+ const clone = new Functionref(this);
+
+ normalizeInvoke(clone);
+
+ return clone;
+ };
}
diff --git a/src/lib/definitions/specification.ts b/src/lib/definitions/specification.ts
index 1e60d0a4..c163f755 100644
--- a/src/lib/definitions/specification.ts
+++ b/src/lib/definitions/specification.ts
@@ -25,14 +25,14 @@ export * from './callbackstate';
export * from './continueasdef';
export * from './correlationDef';
export * from './crondef';
-export * from './databasedswitch';
+export * from './databasedswitchstate';
export * from './defaultconditiondef';
export * from './end';
export * from './enddatacondition';
export * from './enddeventcondition';
export * from './error';
export * from './errordef';
-export * from './eventbasedswitch';
+export * from './eventbasedswitchstate';
export * from './eventdatafilter';
export * from './eventdef';
export * from './eventref';
diff --git a/src/lib/definitions/subflowref.ts b/src/lib/definitions/subflowref.ts
index 8b19baa0..13e58737 100644
--- a/src/lib/definitions/subflowref.ts
+++ b/src/lib/definitions/subflowref.ts
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import { normalizeInvoke, normalizeOnParentComplete } from './utils';
+
export class Subflowref {
constructor(model: any) {
Object.assign(this, model);
@@ -27,7 +29,14 @@ export class Subflowref {
* Version of the sub-workflow to be invoked
*/
version?: string;
-
+ /**
+ * If invoke is 'async', specifies how subflow execution should behave when parent workflow completes. Default is 'terminate'
+ */
+ onParentComplete?: 'continue' | 'terminate';
+ /**
+ * Specifies if the subflow should be invoked sync or async
+ */
+ invoke?: 'sync' | 'async';
/**
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Subflowref} without deleted properties.
@@ -35,6 +44,9 @@ export class Subflowref {
normalize = (): Subflowref => {
const clone = new Subflowref(this);
+ normalizeInvoke(clone);
+ normalizeOnParentComplete(clone);
+
return clone;
};
}
diff --git a/src/lib/definitions/types.ts b/src/lib/definitions/types.ts
index b9343fe1..b6055c16 100644
--- a/src/lib/definitions/types.ts
+++ b/src/lib/definitions/types.ts
@@ -18,8 +18,8 @@ import { Transitiondatacondition } from './transitiondatacondition';
import { Enddatacondition } from './enddatacondition';
import { Retrydef } from './retrydef';
import { Function } from './function';
-import { Databasedswitch } from './databasedswitch';
-import { Eventbasedswitch } from './eventbasedswitch';
+import { Databasedswitchstate } from './databasedswitchstate';
+import { Eventbasedswitchstate } from './eventbasedswitchstate';
import { Transitioneventcondition } from './transitioneventcondition';
import { Enddeventcondition } from './enddeventcondition';
import { Eventstate } from './eventstate';
@@ -48,8 +48,8 @@ export type Retries = string /* uri */ | [Retrydef, ...Retrydef[]];
export type Functions = string /* uri */ | [Function, ...Function[]];
export type Switchstate /* Permits transitions to other states based on data conditions */ =
- | Databasedswitch
- | /* Permits transitions to other states based on events */ Eventbasedswitch;
+ | Databasedswitchstate
+ | /* Permits transitions to other states based on events */ Eventbasedswitchstate;
export type Eventcondition /* Switch state data event condition */ =
| Transitioneventcondition
diff --git a/src/lib/definitions/utils.ts b/src/lib/definitions/utils.ts
index b4807e4b..17fb9fb8 100644
--- a/src/lib/definitions/utils.ts
+++ b/src/lib/definitions/utils.ts
@@ -15,7 +15,6 @@
*/
import { Specification } from './index';
import { isObject } from '../utils';
-import { StateExecTimeout } from './stateExecTimeout';
/**
* Modify the provided object, set the value to 'schedule' property as an instance of Specification.Schedule class, if the provided value is an object
@@ -236,10 +235,10 @@ export function overwriteStates(object: { states: Specification.States }) {
case 'switch':
const switchState: any = v;
if (switchState.dataConditions) {
- return new Specification.Databasedswitch(v);
+ return new Specification.Databasedswitchstate(v);
}
if (switchState.eventConditions) {
- return new Specification.Eventbasedswitch(v);
+ return new Specification.Eventbasedswitchstate(v);
}
throw new Error(`Unexpected switch type; \n state value= ${JSON.stringify(v, null, 4)}`);
case 'inject':
@@ -449,7 +448,7 @@ export function overwritePropertyAsPlainType(property: string, object: any): voi
*/
export function overwriteTimeoutWithStateExecTimeout(object: {
timeouts?: {
- stateExecTimeout?: StateExecTimeout;
+ stateExecTimeout?: Specification.StateExecTimeout;
};
}): void {
overwritePropertyAsPlainType('timeouts', object);
@@ -702,6 +701,26 @@ export function normalizeType(object: { type?: string }) {
}
}
+/**
+ * Modify the provided object by normalizing the 'invoke' property, where the default value is 'rest'.
+ * @param object to be modified
+ */
+export function normalizeInvoke(object: { invoke?: string }) {
+ if (object.invoke === 'sync') {
+ delete object.invoke;
+ }
+}
+
+/**
+ * Modify the provided object by normalizing the 'onParentComplete' property, where the default value is 'terminate'.
+ * @param object to be modified
+ */
+export function normalizeOnParentComplete(object: { onParentComplete?: 'continue' | 'terminate' }) {
+ if (object.onParentComplete === 'terminate') {
+ delete object.onParentComplete;
+ }
+}
+
/**
* Modify the provided object by normalizing the 'kind' property, where the default value is 'consumed'.
* @param object to be modified
@@ -772,8 +791,28 @@ export function normalizeEvents(object: { events?: Specification.Events }) {
* Modify the provided object by normalizing the 'timeouts' property.
* @param object to be modified
*/
-export function normalizeTimeoutsIfObject(object: { timeouts?: string /* uri */ | Specification.Timeouts }) {
+export function normalizeTimeoutsIfObject(object: { timeouts?: string | Specification.Timeouts }) {
if (isObject(object.timeouts)) {
object.timeouts = object.timeouts && object.timeouts.normalize();
}
}
+
+/**
+ * Modify the provided object by normalizing the 'eventRef' property.
+ * @param object to be modified
+ */
+export function normalizeEventRef(object: { eventRef?: Specification.Eventref }) {
+ if (isObject(object.eventRef)) {
+ object.eventRef = object.eventRef && object.eventRef.normalize();
+ }
+}
+
+/**
+ * Modify the provided object by normalizing the 'functionRef' property.
+ * @param object to be modified
+ */
+export function normalizeFunctionRef(object: { functionRef?: string | Specification.Functionref }) {
+ if (isObject(object.functionRef)) {
+ object.functionRef = object.functionRef && object.functionRef.normalize();
+ }
+}
diff --git a/src/lib/diagram/mermaidState.ts b/src/lib/diagram/mermaidState.ts
index b863bd4b..65d91e5a 100644
--- a/src/lib/diagram/mermaidState.ts
+++ b/src/lib/diagram/mermaidState.ts
@@ -72,7 +72,7 @@ export class MermaidState {
private dataConditionsTransitions() {
const transitions: string[] = [];
- const dataBasedSwitchState = this.state as Specification.Databasedswitch;
+ const dataBasedSwitchState = this.state as Specification.Databasedswitchstate;
if (dataBasedSwitchState.dataConditions) {
const stateName = this.state.name;
dataBasedSwitchState.dataConditions.forEach((dataCondition) => {
@@ -96,7 +96,7 @@ export class MermaidState {
private eventConditionsTransition() {
const transitions: string[] = [];
- const eventBasedSwitchState = this.state as Specification.Eventbasedswitch;
+ const eventBasedSwitchState = this.state as Specification.Eventbasedswitchstate;
if (eventBasedSwitchState.eventConditions) {
const stateName = this.state.name;
eventBasedSwitchState.eventConditions.forEach((eventCondition) => {
@@ -170,7 +170,9 @@ export class MermaidState {
if (this.state.onErrors) {
this.state.onErrors.forEach((error) => {
- transitions.push(...this.naturalTransition(this.stateKeyDiagram(this.state.name), error.transition, error.errorRef));
+ transitions.push(
+ ...this.naturalTransition(this.stateKeyDiagram(this.state.name), error.transition, error.errorRef)
+ );
});
}
return transitions;
@@ -208,7 +210,11 @@ export class MermaidState {
private definitionType() {
const type = this.state.type;
- return this.stateDescription(this.stateKeyDiagram(this.state.name), 'type', type!.charAt(0).toUpperCase() + type!.slice(1) + ' State');
+ return this.stateDescription(
+ this.stateKeyDiagram(this.state.name),
+ 'type',
+ type!.charAt(0).toUpperCase() + type!.slice(1) + ' State'
+ );
}
private parallelStateDetails(): string | undefined {
@@ -217,12 +223,18 @@ export class MermaidState {
const descriptions: string[] = [];
if (parallelState.completionType) {
- descriptions.push(this.stateDescription(this.stateKeyDiagram(this.state.name), 'Completion type', parallelState.completionType));
+ descriptions.push(
+ this.stateDescription(this.stateKeyDiagram(this.state.name), 'Completion type', parallelState.completionType)
+ );
}
if (parallelState.branches) {
descriptions.push(
- this.stateDescription(this.stateKeyDiagram(this.state.name), 'Num. of branches', parallelState.branches?.length + '')
+ this.stateDescription(
+ this.stateKeyDiagram(this.state.name),
+ 'Num. of branches',
+ parallelState.branches?.length + ''
+ )
);
}
@@ -251,7 +263,9 @@ export class MermaidState {
}
if (state.actions) {
- descriptions.push(this.stateDescription(this.stateKeyDiagram(this.state.name), 'Num. of actions', state.actions?.length + ''));
+ descriptions.push(
+ this.stateDescription(this.stateKeyDiagram(this.state.name), 'Num. of actions', state.actions?.length + '')
+ );
}
return descriptions.length > 0
@@ -276,11 +290,15 @@ export class MermaidState {
const descriptions: string[] = [];
if (state.inputCollection) {
- descriptions.push(this.stateDescription(this.stateKeyDiagram(this.state.name), 'Input collection', state.inputCollection));
+ descriptions.push(
+ this.stateDescription(this.stateKeyDiagram(this.state.name), 'Input collection', state.inputCollection)
+ );
}
if (state.actions) {
- descriptions.push(this.stateDescription(this.stateKeyDiagram(this.state.name), 'Num. of actions', state.actions?.length + ''));
+ descriptions.push(
+ this.stateDescription(this.stateKeyDiagram(this.state.name), 'Num. of actions', state.actions?.length + '')
+ );
}
return descriptions.length > 0
@@ -303,7 +321,9 @@ export class MermaidState {
} else if (typeof functionRef === 'string') {
functionRefDescription = functionRef as string;
}
- descriptions.push(this.stateDescription(this.stateKeyDiagram(this.state.name), 'Callback function', functionRefDescription));
+ descriptions.push(
+ this.stateDescription(this.stateKeyDiagram(this.state.name), 'Callback function', functionRefDescription)
+ );
}
if (state.eventRef) {
diff --git a/src/lib/schema/__merged.json b/src/lib/schema/__merged.json
index 79a813c0..eaf79d82 100644
--- a/src/lib/schema/__merged.json
+++ b/src/lib/schema/__merged.json
@@ -1,5 +1,5 @@
{
- "$id": "https://serverlessworkflow.io/schemas/0.7/workflow.json",
+ "$id": "https://serverlessworkflow.io/schemas/0.8/workflow.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - workflow schema",
"type": "object",
@@ -385,6 +385,7 @@
"items": {
"type": "string"
},
+ "uniqueItems": true,
"additionalItems": false
},
"actionMode": {
@@ -418,6 +419,10 @@
"action": {
"type": "object",
"properties": {
+ "id": {
+ "type": "string",
+ "description": "Unique action identifier"
+ },
"name": {
"type": "string",
"description": "Unique action definition name"
@@ -463,6 +468,11 @@
"actionDataFilter": {
"description": "Action data filter",
"$ref": "#/definitions/actiondatafilter"
+ },
+ "condition": {
+ "description": "Expression, if defined, must evaluate to true for this action to be performed. If false, action is disregarded",
+ "type": "string",
+ "minLength": 1
}
},
"additionalProperties": false,
@@ -506,6 +516,15 @@
"selectionSet": {
"type": "string",
"description": "Only used if function type is 'graphql'. A string containing a valid GraphQL selection set"
+ },
+ "invoke": {
+ "type": "string",
+ "enum": [
+ "sync",
+ "async"
+ ],
+ "description": "Specifies if the function should be invoked sync or async",
+ "default": "sync"
}
},
"additionalProperties": false,
@@ -527,6 +546,10 @@
"type": "string",
"description": "Reference to the unique name of a 'consumed' event definition"
},
+ "resultEventTimeout": {
+ "type": "string",
+ "description": "Maximum amount of time (ISO 8601 format) to wait for the result event. If not defined it should default to the actionExecutionTimeout"
+ },
"data": {
"type": [
"string",
@@ -540,6 +563,15 @@
"additionalProperties": {
"type": "string"
}
+ },
+ "invoke": {
+ "type": "string",
+ "enum": [
+ "sync",
+ "async"
+ ],
+ "description": "Specifies if the function should be invoked sync or async. Default is sync.",
+ "default": "sync"
}
},
"additionalProperties": false,
@@ -567,6 +599,24 @@
"type": "string",
"description": "Version of the sub-workflow to be invoked",
"minLength": 1
+ },
+ "onParentComplete": {
+ "type": "string",
+ "enum": [
+ "continue",
+ "terminate"
+ ],
+ "description": "If invoke is 'async', specifies how subflow execution should behave when parent workflow completes. Default is 'terminate'",
+ "default": "terminate"
+ },
+ "invoke": {
+ "type": "string",
+ "enum": [
+ "sync",
+ "async"
+ ],
+ "description": "Specifies if the subflow should be invoked sync or async",
+ "default": "sync"
}
},
"required": [
@@ -1073,14 +1123,14 @@
"switchstate": {
"oneOf": [
{
- "$ref": "#/definitions/databasedswitch"
+ "$ref": "#/definitions/databasedswitchstate"
},
{
- "$ref": "#/definitions/eventbasedswitch"
+ "$ref": "#/definitions/eventbasedswitchstate"
}
]
},
- "eventbasedswitch": {
+ "eventbasedswitchstate": {
"type": "object",
"description": "Permits transitions to other states based on events",
"properties": {
@@ -1155,10 +1205,11 @@
"required": [
"name",
"type",
- "eventConditions"
+ "eventConditions",
+ "defaultCondition"
]
},
- "databasedswitch": {
+ "databasedswitchstate": {
"type": "object",
"description": "Permits transitions to other states based on data conditions",
"properties": {
@@ -1230,7 +1281,8 @@
"required": [
"name",
"type",
- "dataConditions"
+ "dataConditions",
+ "defaultCondition"
]
},
"defaultconditiondef": {
@@ -1911,9 +1963,14 @@
"eventdatafilter": {
"type": "object",
"properties": {
+ "useData": {
+ "type": "boolean",
+ "description": "If set to false, event payload is not added/merged to state data. In this case 'data' and 'toStateData' should be ignored. Default is true.",
+ "default": true
+ },
"data": {
"type": "string",
- "description": "Workflow expression that filters the received event/payload (default: '${ . }')"
+ "description": "Workflow expression that filters the received event payload (default: '${ . }')"
},
"toStateData": {
"type": "string",
@@ -1930,6 +1987,11 @@
"type": "string",
"description": "Workflow expression that selects state data that the state action can use"
},
+ "useResults": {
+ "type": "boolean",
+ "description": "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.",
+ "default": true
+ },
"results": {
"type": "string",
"description": "Workflow expression that filters the actions data results"
@@ -1942,29 +2004,6 @@
"additionalProperties": false,
"required": []
},
- "errordef": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string",
- "description": "Domain-specific error name",
- "minLength": 1
- },
- "code": {
- "type": "string",
- "description": "Error code. Can be used in addition to the name to help runtimes resolve to technical errors/exceptions. Should not be defined if error is set to '*'",
- "minLength": 1
- },
- "description": {
- "type": "string",
- "description": "Error description"
- }
- },
- "additionalProperties": false,
- "required": [
- "name"
- ]
- },
"retrydef": {
"type": "object",
"properties": {
@@ -2020,177 +2059,6 @@
"maxAttempts"
]
},
- "workflowExecTimeout": {
- "oneOf": [
- {
- "type": "string",
- "description": "Workflow execution timeout duration (ISO 8601 duration format). If not specified should be 'unlimited'",
- "minLength": 1
- },
- {
- "type": "object",
- "properties": {
- "duration": {
- "type": "string",
- "description": "Workflow execution timeout duration (ISO 8601 duration format). If not specified should be 'unlimited'",
- "minLength": 1
- },
- "interrupt": {
- "type": "boolean",
- "description": "If `false`, workflow instance is allowed to finish current execution. If `true`, current workflow execution is abrupted.",
- "default": true
- },
- "runBefore": {
- "type": "string",
- "description": "Name of a workflow state to be executed before workflow instance is terminated",
- "minLength": 1
- }
- },
- "additionalProperties": false,
- "required": [
- "duration"
- ]
- }
- ]
- },
- "stateExecTimeout": {
- "oneOf": [
- {
- "type": "string",
- "description": "Total state execution timeout (including retries) (ISO 8601 duration format)",
- "minLength": 1
- },
- {
- "type": "object",
- "description": "Workflow default timeouts",
- "properties": {
- "single": {
- "type": "string",
- "description": "Single state execution timeout, not including retries (ISO 8601 duration format)",
- "minLength": 1
- },
- "total": {
- "type": "string",
- "description": "Total state execution timeout, including retries (ISO 8601 duration format)",
- "minLength": 1
- }
- },
- "additionalProperties": false,
- "required": [
- "total"
- ]
- }
- ]
- },
- "actionExecTimeout": {
- "type": "string",
- "description": "Single actions definition execution timeout duration (ISO 8601 duration format)",
- "minLength": 1
- },
- "branchExecTimeout": {
- "type": "string",
- "description": "Single branch execution timeout duration (ISO 8601 duration format)",
- "minLength": 1
- },
- "eventTimeout": {
- "type": "string",
- "description": "Timeout duration to wait for consuming defined events (ISO 8601 duration format)",
- "minLength": 1
- },
- "eventdef": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string",
- "description": "Unique event name",
- "minLength": 1
- },
- "source": {
- "type": "string",
- "description": "CloudEvent source"
- },
- "type": {
- "type": "string",
- "description": "CloudEvent type"
- },
- "kind": {
- "type": "string",
- "enum": [
- "consumed",
- "produced"
- ],
- "description": "Defines the CloudEvent as either 'consumed' or 'produced' by the workflow. Default is 'consumed'",
- "default": "consumed"
- },
- "correlation": {
- "type": "array",
- "description": "CloudEvent correlation definitions",
- "minItems": 1,
- "items": {
- "type": "object",
- "$ref": "#/definitions/correlationDef"
- },
- "additionalItems": false
- },
- "dataOnly": {
- "type": "boolean",
- "default": true,
- "description": "If `true`, only the Event payload is accessible to consuming Workflow states. If `false`, both event payload and context attributes should be accessible "
- },
- "metadata": {
- "$ref": "#/definitions/metadata",
- "description": "Metadata information"
- }
- },
- "additionalProperties": false,
- "if": {
- "properties": {
- "kind": {
- "const": "consumed"
- }
- }
- },
- "then": {
- "required": [
- "name",
- "source",
- "type"
- ]
- },
- "else": {
- "required": [
- "name",
- "type"
- ]
- }
- },
- "correlationDef": {
- "type": "object",
- "description": "CloudEvent correlation definition",
- "properties": {
- "contextAttributeName": {
- "type": "string",
- "description": "CloudEvent Extension Context Attribute name",
- "minLength": 1
- },
- "contextAttributeValue": {
- "type": "string",
- "description": "CloudEvent Extension Context Attribute value",
- "minLength": 1
- }
- },
- "additionalProperties": false,
- "required": [
- "contextAttributeName"
- ]
- },
- "metadata": {
- "type": "object",
- "description": "Metadata information",
- "additionalProperties": {
- "type": "string"
- }
- },
"function": {
"type": "object",
"properties": {
@@ -2233,6 +2101,13 @@
"operation"
]
},
+ "metadata": {
+ "type": "object",
+ "description": "Metadata information",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
"authdef": {
"type": "object",
"properties": {
@@ -2424,6 +2299,193 @@
}
]
},
+ "workflowExecTimeout": {
+ "oneOf": [
+ {
+ "type": "string",
+ "description": "Workflow execution timeout duration (ISO 8601 duration format). If not specified should be 'unlimited'",
+ "minLength": 1
+ },
+ {
+ "type": "object",
+ "properties": {
+ "duration": {
+ "type": "string",
+ "description": "Workflow execution timeout duration (ISO 8601 duration format). If not specified should be 'unlimited'",
+ "minLength": 1
+ },
+ "interrupt": {
+ "type": "boolean",
+ "description": "If `false`, workflow instance is allowed to finish current execution. If `true`, current workflow execution is abrupted.",
+ "default": true
+ },
+ "runBefore": {
+ "type": "string",
+ "description": "Name of a workflow state to be executed before workflow instance is terminated",
+ "minLength": 1
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "duration"
+ ]
+ }
+ ]
+ },
+ "stateExecTimeout": {
+ "oneOf": [
+ {
+ "type": "string",
+ "description": "Total state execution timeout (including retries) (ISO 8601 duration format)",
+ "minLength": 1
+ },
+ {
+ "type": "object",
+ "description": "Workflow default timeouts",
+ "properties": {
+ "single": {
+ "type": "string",
+ "description": "Single state execution timeout, not including retries (ISO 8601 duration format)",
+ "minLength": 1
+ },
+ "total": {
+ "type": "string",
+ "description": "Total state execution timeout, including retries (ISO 8601 duration format)",
+ "minLength": 1
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "total"
+ ]
+ }
+ ]
+ },
+ "actionExecTimeout": {
+ "type": "string",
+ "description": "Single actions definition execution timeout duration (ISO 8601 duration format)",
+ "minLength": 1
+ },
+ "branchExecTimeout": {
+ "type": "string",
+ "description": "Single branch execution timeout duration (ISO 8601 duration format)",
+ "minLength": 1
+ },
+ "eventTimeout": {
+ "type": "string",
+ "description": "Timeout duration to wait for consuming defined events (ISO 8601 duration format)",
+ "minLength": 1
+ },
+ "eventdef": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Unique event name",
+ "minLength": 1
+ },
+ "source": {
+ "type": "string",
+ "description": "CloudEvent source"
+ },
+ "type": {
+ "type": "string",
+ "description": "CloudEvent type"
+ },
+ "kind": {
+ "type": "string",
+ "enum": [
+ "consumed",
+ "produced"
+ ],
+ "description": "Defines the CloudEvent as either 'consumed' or 'produced' by the workflow. Default is 'consumed'",
+ "default": "consumed"
+ },
+ "correlation": {
+ "type": "array",
+ "description": "CloudEvent correlation definitions",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "$ref": "#/definitions/correlationDef"
+ },
+ "additionalItems": false
+ },
+ "dataOnly": {
+ "type": "boolean",
+ "default": true,
+ "description": "If `true`, only the Event payload is accessible to consuming Workflow states. If `false`, both event payload and context attributes should be accessible "
+ },
+ "metadata": {
+ "$ref": "#/definitions/metadata",
+ "description": "Metadata information"
+ }
+ },
+ "additionalProperties": false,
+ "if": {
+ "properties": {
+ "kind": {
+ "const": "consumed"
+ }
+ }
+ },
+ "then": {
+ "required": [
+ "name",
+ "source",
+ "type"
+ ]
+ },
+ "else": {
+ "required": [
+ "name",
+ "type"
+ ]
+ }
+ },
+ "correlationDef": {
+ "type": "object",
+ "description": "CloudEvent correlation definition",
+ "properties": {
+ "contextAttributeName": {
+ "type": "string",
+ "description": "CloudEvent Extension Context Attribute name",
+ "minLength": 1
+ },
+ "contextAttributeValue": {
+ "type": "string",
+ "description": "CloudEvent Extension Context Attribute value",
+ "minLength": 1
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "contextAttributeName"
+ ]
+ },
+ "errordef": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Domain-specific error name",
+ "minLength": 1
+ },
+ "code": {
+ "type": "string",
+ "description": "Error code. Can be used in addition to the name to help runtimes resolve to technical errors/exceptions. Should not be defined if error is set to '*'",
+ "minLength": 1
+ },
+ "description": {
+ "type": "string",
+ "description": "Error description"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "name"
+ ]
+ },
"secrets": {
"oneOf": [
{
diff --git a/src/lib/schema/auth.json b/src/lib/schema/auth.json
index 770b3daa..8be26b4e 100644
--- a/src/lib/schema/auth.json
+++ b/src/lib/schema/auth.json
@@ -1,5 +1,5 @@
{
- "$id": "https://serverlessworkflow.io/schemas/0.7/auth.json",
+ "$id": "https://serverlessworkflow.io/schemas/0.8/auth.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - auth schema",
"type": "object",
diff --git a/src/lib/schema/common.json b/src/lib/schema/common.json
index 60224c55..5a3593e1 100644
--- a/src/lib/schema/common.json
+++ b/src/lib/schema/common.json
@@ -1,5 +1,5 @@
{
- "$id": "https://serverlessworkflow.io/schemas/0.7/common.json",
+ "$id": "https://serverlessworkflow.io/schemas/0.8/common.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - common schema",
"type": "object",
diff --git a/src/lib/schema/errors.json b/src/lib/schema/errors.json
index b455efff..c855548f 100644
--- a/src/lib/schema/errors.json
+++ b/src/lib/schema/errors.json
@@ -1,5 +1,5 @@
{
- "$id": "https://serverlessworkflow.io/schemas/0.7/errors.json",
+ "$id": "https://serverlessworkflow.io/schemas/0.8/errors.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - errors schema",
"type": "object",
diff --git a/src/lib/schema/events.json b/src/lib/schema/events.json
index c5c72aee..61d16e1c 100644
--- a/src/lib/schema/events.json
+++ b/src/lib/schema/events.json
@@ -1,5 +1,5 @@
{
- "$id": "https://serverlessworkflow.io/schemas/0.7/events.json",
+ "$id": "https://serverlessworkflow.io/schemas/0.8/events.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - events schema",
"type": "object",
diff --git a/src/lib/schema/functions.json b/src/lib/schema/functions.json
index 85d70b5a..08f3b345 100644
--- a/src/lib/schema/functions.json
+++ b/src/lib/schema/functions.json
@@ -1,5 +1,5 @@
{
- "$id": "https://serverlessworkflow.io/schemas/0.7/functions.json",
+ "$id": "https://serverlessworkflow.io/schemas/0.8/functions.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - functions schema",
"type": "object",
diff --git a/src/lib/schema/retries.json b/src/lib/schema/retries.json
index 23df5e3e..743b758c 100644
--- a/src/lib/schema/retries.json
+++ b/src/lib/schema/retries.json
@@ -1,5 +1,5 @@
{
- "$id": "https://serverlessworkflow.io/schemas/0.7/retries.json",
+ "$id": "https://serverlessworkflow.io/schemas/0.8/retries.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - retries schema",
"type": "object",
diff --git a/src/lib/schema/secrets.json b/src/lib/schema/secrets.json
index 427d68ed..dc553cc1 100644
--- a/src/lib/schema/secrets.json
+++ b/src/lib/schema/secrets.json
@@ -1,5 +1,5 @@
{
- "$id": "https://serverlessworkflow.io/schemas/0.7/secrets.json",
+ "$id": "https://serverlessworkflow.io/schemas/0.8/secrets.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - secrets schema",
"type": "object",
diff --git a/src/lib/schema/timeouts.json b/src/lib/schema/timeouts.json
index 5e6ec52c..3bd565af 100644
--- a/src/lib/schema/timeouts.json
+++ b/src/lib/schema/timeouts.json
@@ -1,5 +1,5 @@
{
- "$id": "https://serverlessworkflow.io/schemas/0.7/timeouts.json",
+ "$id": "https://serverlessworkflow.io/schemas/0.8/timeouts.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - functions schema",
"type": "object",
diff --git a/src/lib/schema/types/workflow.ts b/src/lib/schema/types/workflow.ts
index 246a84f6..bf4ca24a 100644
--- a/src/lib/schema/types/workflow.ts
+++ b/src/lib/schema/types/workflow.ts
@@ -17,7 +17,7 @@
/**
* Serverless Workflow specification - workflow schema
*/
-export type Workflow = /* Serverless Workflow specification - workflow schema */
+export type Workflow /* Serverless Workflow specification - workflow schema */ =
| {
/**
* Workflow unique identifier
@@ -206,6 +206,10 @@ export type Workflow = /* Serverless Workflow specification - workflow schema */
};
export type Action =
| {
+ /**
+ * Unique action identifier
+ */
+ id?: string;
/**
* Unique action definition name
*/
@@ -227,8 +231,16 @@ export type Action =
*/
retryableErrors?: [string, ...string[]];
actionDataFilter?: Actiondatafilter;
+ /**
+ * Expression, if defined, must evaluate to true for this action to be performed. If false, action is disregarded
+ */
+ condition?: string;
}
| {
+ /**
+ * Unique action identifier
+ */
+ id?: string;
/**
* Unique action definition name
*/
@@ -250,8 +262,16 @@ export type Action =
*/
retryableErrors?: [string, ...string[]];
actionDataFilter?: Actiondatafilter;
+ /**
+ * Expression, if defined, must evaluate to true for this action to be performed. If false, action is disregarded
+ */
+ condition?: string;
}
| {
+ /**
+ * Unique action identifier
+ */
+ id?: string;
/**
* Unique action definition name
*/
@@ -273,6 +293,10 @@ export type Action =
*/
retryableErrors?: [string, ...string[]];
actionDataFilter?: Actiondatafilter;
+ /**
+ * Expression, if defined, must evaluate to true for this action to be performed. If false, action is disregarded
+ */
+ condition?: string;
};
/**
* Single actions definition execution timeout duration (ISO 8601 duration format)
@@ -283,6 +307,10 @@ export interface Actiondatafilter {
* Workflow expression that selects state data that the state action can use
*/
fromStateData?: string;
+ /**
+ * 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.
+ */
+ useResults?: boolean;
/**
* Workflow expression that filters the actions data results
*/
@@ -464,7 +492,7 @@ export type Crondef =
/**
* Permits transitions to other states based on data conditions
*/
-export interface Databasedswitch {
+export interface Databasedswitchstate {
/**
* Unique State id
*/
@@ -498,7 +526,7 @@ export interface Databasedswitch {
/**
* Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition
*/
- defaultCondition?: /* DefaultCondition definition. Can be either a transition or end definition */ Defaultconditiondef;
+ defaultCondition: /* DefaultCondition definition. Can be either a transition or end definition */ Defaultconditiondef;
/**
* Unique Name of a workflow state which is responsible for compensation of this state
*/
@@ -509,13 +537,13 @@ export interface Databasedswitch {
usedForCompensation?: boolean;
metadata?: /* Metadata information */ Metadata;
}
-export type Datacondition = /* Switch state data based condition */
+export type Datacondition /* Switch state data based condition */ =
| Transitiondatacondition
| /* Switch state data based condition */ Enddatacondition;
/**
* DefaultCondition definition. Can be either a transition or end definition
*/
-export type Defaultconditiondef = /* DefaultCondition definition. Can be either a transition or end definition */
+export type Defaultconditiondef /* DefaultCondition definition. Can be either a transition or end definition */ =
| {
transition: Transition;
end?: End;
@@ -652,7 +680,7 @@ export type EventTimeout = string;
/**
* Permits transitions to other states based on events
*/
-export interface Eventbasedswitch {
+export interface Eventbasedswitchstate {
/**
* Unique State id
*/
@@ -687,7 +715,7 @@ export interface Eventbasedswitch {
/**
* Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition
*/
- defaultCondition?: /* DefaultCondition definition. Can be either a transition or end definition */ Defaultconditiondef;
+ defaultCondition: /* DefaultCondition definition. Can be either a transition or end definition */ Defaultconditiondef;
/**
* Unique Name of a workflow state which is responsible for compensation of this state
*/
@@ -698,12 +726,16 @@ export interface Eventbasedswitch {
usedForCompensation?: boolean;
metadata?: /* Metadata information */ Metadata;
}
-export type Eventcondition = /* Switch state data event condition */
+export type Eventcondition /* Switch state data event condition */ =
| Transitioneventcondition
| /* Switch state data event condition */ Enddeventcondition;
export interface Eventdatafilter {
/**
- * Workflow expression that filters the received event/payload (default: '${ . }')
+ * If set to false, event payload is not added/merged to state data. In this case 'data' and 'toStateData' should be ignored. Default is true.
+ */
+ useData?: boolean;
+ /**
+ * Workflow expression that filters the received event payload (default: '${ . }')
*/
data?: string;
/**
@@ -756,6 +788,10 @@ export interface Eventref {
* Reference to the unique name of a 'consumed' event definition
*/
resultEventRef: string;
+ /**
+ * Maximum amount of time (ISO 8601 format) to wait for the result event. If not defined it should default to the actionExecutionTimeout
+ */
+ resultEventTimeout?: string;
/**
* If string type, an expression which selects parts of the states data output to become the data (payload) of the event referenced by 'triggerEventRef'. If object type, a custom object to become the data (payload) of the event referenced by 'triggerEventRef'.
*/
@@ -770,6 +806,10 @@ export interface Eventref {
contextAttributes?: {
[name: string]: string;
};
+ /**
+ * Specifies if the function should be invoked sync or async. Default is sync.
+ */
+ invoke?: 'sync' | 'async';
}
export type Events = string /* uri */ | [Eventdef, ...Eventdef[]];
/**
@@ -777,90 +817,90 @@ export type Events = string /* uri */ | [Eventdef, ...Eventdef[]];
*/
export type Eventstate =
/* This state is used to wait for events from event sources, then consumes them and invoke one or more actions to run in sequence or parallel */
- | {
- /**
- * Unique State id
- */
- id?: string;
- /**
- * State name
- */
- name: string;
- /**
- * State type
- */
- type: 'event';
- /**
- * If true consuming one of the defined events causes its associated actions to be performed. If false all of the defined events must be consumed in order for actions to be performed
- */
- exclusive?: boolean;
- /**
- * Define the events to be consumed and optional actions to be performed
- */
- onEvents: Onevents[];
- /**
- * State specific timeouts
- */
- timeouts?: {
- stateExecTimeout?: StateExecTimeout;
- actionExecTimeout?: /* Single actions definition execution timeout duration (ISO 8601 duration format) */ ActionExecTimeout;
- eventTimeout?: /* Timeout duration to wait for consuming defined events (ISO 8601 duration format) */ EventTimeout;
- };
- stateDataFilter?: Statedatafilter;
- /**
- * States error handling definitions
- */
- onErrors?: Error[];
- transition?: Transition;
- end: End;
- /**
- * Unique Name of a workflow state which is responsible for compensation of this state
- */
- compensatedBy?: string;
- metadata?: /* Metadata information */ Metadata;
- }
- | {
- /**
- * Unique State id
- */
- id?: string;
- /**
- * State name
- */
- name: string;
- /**
- * State type
- */
- type: 'event';
- /**
- * If true consuming one of the defined events causes its associated actions to be performed. If false all of the defined events must be consumed in order for actions to be performed
- */
- exclusive?: boolean;
- /**
- * Define the events to be consumed and optional actions to be performed
- */
- onEvents: Onevents[];
- /**
- * State specific timeouts
- */
- timeouts?: {
- stateExecTimeout?: StateExecTimeout;
- actionExecTimeout?: /* Single actions definition execution timeout duration (ISO 8601 duration format) */ ActionExecTimeout;
- eventTimeout?: /* Timeout duration to wait for consuming defined events (ISO 8601 duration format) */ EventTimeout;
- };
- stateDataFilter?: Statedatafilter;
- /**
- * States error handling definitions
- */
- onErrors?: Error[];
- transition: Transition;
- end?: End;
- /**
- * Unique Name of a workflow state which is responsible for compensation of this state
- */
- compensatedBy?: string;
- metadata?: /* Metadata information */ Metadata;
+ | {
+ /**
+ * Unique State id
+ */
+ id?: string;
+ /**
+ * State name
+ */
+ name: string;
+ /**
+ * State type
+ */
+ type: 'event';
+ /**
+ * If true consuming one of the defined events causes its associated actions to be performed. If false all of the defined events must be consumed in order for actions to be performed
+ */
+ exclusive?: boolean;
+ /**
+ * Define the events to be consumed and optional actions to be performed
+ */
+ onEvents: Onevents[];
+ /**
+ * State specific timeouts
+ */
+ timeouts?: {
+ stateExecTimeout?: StateExecTimeout;
+ actionExecTimeout?: /* Single actions definition execution timeout duration (ISO 8601 duration format) */ ActionExecTimeout;
+ eventTimeout?: /* Timeout duration to wait for consuming defined events (ISO 8601 duration format) */ EventTimeout;
+ };
+ stateDataFilter?: Statedatafilter;
+ /**
+ * States error handling definitions
+ */
+ onErrors?: Error[];
+ transition?: Transition;
+ end: End;
+ /**
+ * Unique Name of a workflow state which is responsible for compensation of this state
+ */
+ compensatedBy?: string;
+ metadata?: /* Metadata information */ Metadata;
+ }
+ | {
+ /**
+ * Unique State id
+ */
+ id?: string;
+ /**
+ * State name
+ */
+ name: string;
+ /**
+ * State type
+ */
+ type: 'event';
+ /**
+ * If true consuming one of the defined events causes its associated actions to be performed. If false all of the defined events must be consumed in order for actions to be performed
+ */
+ exclusive?: boolean;
+ /**
+ * Define the events to be consumed and optional actions to be performed
+ */
+ onEvents: Onevents[];
+ /**
+ * State specific timeouts
+ */
+ timeouts?: {
+ stateExecTimeout?: StateExecTimeout;
+ actionExecTimeout?: /* Single actions definition execution timeout duration (ISO 8601 duration format) */ ActionExecTimeout;
+ eventTimeout?: /* Timeout duration to wait for consuming defined events (ISO 8601 duration format) */ EventTimeout;
};
+ stateDataFilter?: Statedatafilter;
+ /**
+ * States error handling definitions
+ */
+ onErrors?: Error[];
+ transition: Transition;
+ end?: End;
+ /**
+ * Unique Name of a workflow state which is responsible for compensation of this state
+ */
+ compensatedBy?: string;
+ metadata?: /* Metadata information */ Metadata;
+ };
/**
* Execute a set of defined actions or workflows for each element of a data array
*/
@@ -970,6 +1010,10 @@ export type Functionref =
* Only used if function type is 'graphql'. A string containing a valid GraphQL selection set
*/
selectionSet?: string;
+ /**
+ * Specifies if the function should be invoked sync or async
+ */
+ invoke?: 'sync' | 'async';
};
export type Functions = string /* uri */ | [Function, ...Function[]];
/**
@@ -1422,10 +1466,18 @@ export type Subflowref =
* Version of the sub-workflow to be invoked
*/
version?: string;
+ /**
+ * If invoke is 'async', specifies how subflow execution should behave when parent workflow completes. Default is 'terminate'
+ */
+ onParentComplete?: 'continue' | 'terminate';
+ /**
+ * Specifies if the subflow should be invoked sync or async
+ */
+ invoke?: 'sync' | 'async';
};
-export type Switchstate = /* Permits transitions to other states based on data conditions */
- | Databasedswitch
- | /* Permits transitions to other states based on events */ Eventbasedswitch;
+export type Switchstate /* Permits transitions to other states based on data conditions */ =
+ | Databasedswitchstate
+ | /* Permits transitions to other states based on events */ Eventbasedswitchstate;
export type Timeouts =
| string /* uri */
| {
diff --git a/src/lib/schema/validation/validators-paths.ts b/src/lib/schema/validation/validators-paths.ts
index e3b0cf4e..50161dd3 100644
--- a/src/lib/schema/validation/validators-paths.ts
+++ b/src/lib/schema/validation/validators-paths.ts
@@ -18,68 +18,71 @@
* A map of type names and their corresponding schema
*/
export const validatorsPaths: [string, string][] = [
- ['Workflow', 'https://serverlessworkflow.io/schemas/0.7/workflow.json'],
- ['Sleep', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/sleep'],
- ['Crondef', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/crondef'],
- ['Continueasdef', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/continueasdef'],
- ['Transition', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/transition'],
- ['Error', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/error'],
- ['Onevents', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/onevents'],
- ['Action', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/action'],
- ['Functionref', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/functionref'],
- ['Eventref', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/eventref'],
- ['Subflowref', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/subflowref'],
- ['Branch', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/branch'],
- ['Sleepstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/sleepstate'],
- ['Eventstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/eventstate'],
- ['Operationstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/operationstate'],
- ['Parallelstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/parallelstate'],
- ['Switchstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/switchstate'],
- ['Eventbasedswitch', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/eventbasedswitch'],
- ['Databasedswitch', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/databasedswitch'],
- ['Defaultconditiondef', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/defaultconditiondef'],
- ['Eventcondition', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/eventcondition'],
+ ['Workflow', 'https://serverlessworkflow.io/schemas/0.8/workflow.json'],
+ ['Sleep', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/sleep'],
+ ['Crondef', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/crondef'],
+ ['Continueasdef', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/continueasdef'],
+ ['Transition', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/transition'],
+ ['Error', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/error'],
+ ['Onevents', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/onevents'],
+ ['Action', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/action'],
+ ['Functionref', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/functionref'],
+ ['Eventref', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/eventref'],
+ ['Subflowref', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/subflowref'],
+ ['Branch', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/branch'],
+ ['Sleepstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/sleepstate'],
+ ['Eventstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/eventstate'],
+ ['Operationstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/operationstate'],
+ ['Parallelstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/parallelstate'],
+ ['Switchstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/switchstate'],
+ [
+ 'Eventbasedswitchstate',
+ 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/eventbasedswitchstate',
+ ],
+ ['Databasedswitchstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/databasedswitchstate'],
+ ['Defaultconditiondef', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/defaultconditiondef'],
+ ['Eventcondition', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/eventcondition'],
[
'Transitioneventcondition',
- 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/transitioneventcondition',
+ 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/transitioneventcondition',
],
- ['Enddeventcondition', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/enddeventcondition'],
- ['Datacondition', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/datacondition'],
+ ['Enddeventcondition', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/enddeventcondition'],
+ ['Datacondition', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/datacondition'],
[
'Transitiondatacondition',
- 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/transitiondatacondition',
+ 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/transitiondatacondition',
],
- ['Enddatacondition', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/enddatacondition'],
- ['Injectstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/injectstate'],
- ['Foreachstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/foreachstate'],
- ['Callbackstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/callbackstate'],
- ['Startdef', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/startdef'],
- ['Schedule', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/schedule'],
- ['End', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/end'],
- ['Produceeventdef', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/produceeventdef'],
- ['Statedatafilter', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/statedatafilter'],
- ['Eventdatafilter', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/eventdatafilter'],
- ['Actiondatafilter', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/actiondatafilter'],
- ['Metadata', 'https://serverlessworkflow.io/schemas/0.7/common.json#/definitions/metadata'],
- ['WorkflowExecTimeout', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/definitions/workflowExecTimeout'],
- ['StateExecTimeout', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/definitions/stateExecTimeout'],
- ['ActionExecTimeout', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/definitions/actionExecTimeout'],
- ['BranchExecTimeout', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/definitions/branchExecTimeout'],
- ['EventTimeout', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/definitions/eventTimeout'],
- ['Retrydef', 'https://serverlessworkflow.io/schemas/0.7/retries.json#/definitions/retrydef'],
- ['Function', 'https://serverlessworkflow.io/schemas/0.7/functions.json#/definitions/function'],
- ['Errordef', 'https://serverlessworkflow.io/schemas/0.7/errors.json#/definitions/errordef'],
- ['Eventdef', 'https://serverlessworkflow.io/schemas/0.7/events.json#/definitions/eventdef'],
- ['CorrelationDef', 'https://serverlessworkflow.io/schemas/0.7/events.json#/definitions/correlationDef'],
- ['Authdef', 'https://serverlessworkflow.io/schemas/0.7/auth.json#/definitions/authdef'],
- ['Basicpropsdef', 'https://serverlessworkflow.io/schemas/0.7/auth.json#/definitions/basicpropsdef'],
- ['Bearerpropsdef', 'https://serverlessworkflow.io/schemas/0.7/auth.json#/definitions/bearerpropsdef'],
- ['Oauth2propsdef', 'https://serverlessworkflow.io/schemas/0.7/auth.json#/definitions/oauth2propsdef'],
- ['Secrets', 'https://serverlessworkflow.io/schemas/0.7/secrets.json#/secrets'],
- ['Timeouts', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/timeouts'],
- ['Errors', 'https://serverlessworkflow.io/schemas/0.7/errors.json#/errors'],
- ['Events', 'https://serverlessworkflow.io/schemas/0.7/events.json#/events'],
- ['Functions', 'https://serverlessworkflow.io/schemas/0.7/functions.json#/functions'],
- ['Retries', 'https://serverlessworkflow.io/schemas/0.7/retries.json#/retries'],
- ['Auth', 'https://serverlessworkflow.io/schemas/0.7/auth.json#/auth'],
+ ['Enddatacondition', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/enddatacondition'],
+ ['Injectstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/injectstate'],
+ ['Foreachstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/foreachstate'],
+ ['Callbackstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/callbackstate'],
+ ['Startdef', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/startdef'],
+ ['Schedule', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/schedule'],
+ ['End', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/end'],
+ ['Produceeventdef', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/produceeventdef'],
+ ['Statedatafilter', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/statedatafilter'],
+ ['Eventdatafilter', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/eventdatafilter'],
+ ['Actiondatafilter', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/actiondatafilter'],
+ ['WorkflowExecTimeout', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/definitions/workflowExecTimeout'],
+ ['StateExecTimeout', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/definitions/stateExecTimeout'],
+ ['ActionExecTimeout', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/definitions/actionExecTimeout'],
+ ['BranchExecTimeout', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/definitions/branchExecTimeout'],
+ ['EventTimeout', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/definitions/eventTimeout'],
+ ['Errordef', 'https://serverlessworkflow.io/schemas/0.8/errors.json#/definitions/errordef'],
+ ['Metadata', 'https://serverlessworkflow.io/schemas/0.8/common.json#/definitions/metadata'],
+ ['Eventdef', 'https://serverlessworkflow.io/schemas/0.8/events.json#/definitions/eventdef'],
+ ['CorrelationDef', 'https://serverlessworkflow.io/schemas/0.8/events.json#/definitions/correlationDef'],
+ ['Function', 'https://serverlessworkflow.io/schemas/0.8/functions.json#/definitions/function'],
+ ['Retrydef', 'https://serverlessworkflow.io/schemas/0.8/retries.json#/definitions/retrydef'],
+ ['Authdef', 'https://serverlessworkflow.io/schemas/0.8/auth.json#/definitions/authdef'],
+ ['Basicpropsdef', 'https://serverlessworkflow.io/schemas/0.8/auth.json#/definitions/basicpropsdef'],
+ ['Bearerpropsdef', 'https://serverlessworkflow.io/schemas/0.8/auth.json#/definitions/bearerpropsdef'],
+ ['Oauth2propsdef', 'https://serverlessworkflow.io/schemas/0.8/auth.json#/definitions/oauth2propsdef'],
+ ['Secrets', 'https://serverlessworkflow.io/schemas/0.8/secrets.json#/secrets'],
+ ['Timeouts', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/timeouts'],
+ ['Errors', 'https://serverlessworkflow.io/schemas/0.8/errors.json#/errors'],
+ ['Events', 'https://serverlessworkflow.io/schemas/0.8/events.json#/events'],
+ ['Functions', 'https://serverlessworkflow.io/schemas/0.8/functions.json#/functions'],
+ ['Retries', 'https://serverlessworkflow.io/schemas/0.8/retries.json#/retries'],
+ ['Auth', 'https://serverlessworkflow.io/schemas/0.8/auth.json#/auth'],
];
diff --git a/src/lib/schema/workflow.json b/src/lib/schema/workflow.json
index 4094c7e2..2d11730a 100644
--- a/src/lib/schema/workflow.json
+++ b/src/lib/schema/workflow.json
@@ -1,5 +1,5 @@
{
- "$id": "https://serverlessworkflow.io/schemas/0.7/workflow.json",
+ "$id": "https://serverlessworkflow.io/schemas/0.8/workflow.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - workflow schema",
"type": "object",
@@ -385,6 +385,7 @@
"items": {
"type": "string"
},
+ "uniqueItems": true,
"additionalItems": false
},
"actionMode": {
@@ -418,6 +419,10 @@
"action": {
"type": "object",
"properties": {
+ "id": {
+ "type": "string",
+ "description": "Unique action identifier"
+ },
"name": {
"type": "string",
"description": "Unique action definition name"
@@ -463,6 +468,11 @@
"actionDataFilter": {
"description": "Action data filter",
"$ref": "#/definitions/actiondatafilter"
+ },
+ "condition": {
+ "description": "Expression, if defined, must evaluate to true for this action to be performed. If false, action is disregarded",
+ "type": "string",
+ "minLength": 1
}
},
"additionalProperties": false,
@@ -506,6 +516,15 @@
"selectionSet": {
"type": "string",
"description": "Only used if function type is 'graphql'. A string containing a valid GraphQL selection set"
+ },
+ "invoke": {
+ "type": "string",
+ "enum": [
+ "sync",
+ "async"
+ ],
+ "description": "Specifies if the function should be invoked sync or async",
+ "default": "sync"
}
},
"additionalProperties": false,
@@ -527,6 +546,10 @@
"type": "string",
"description": "Reference to the unique name of a 'consumed' event definition"
},
+ "resultEventTimeout": {
+ "type": "string",
+ "description": "Maximum amount of time (ISO 8601 format) to wait for the result event. If not defined it should default to the actionExecutionTimeout"
+ },
"data": {
"type": [
"string",
@@ -540,6 +563,15 @@
"additionalProperties": {
"type": "string"
}
+ },
+ "invoke": {
+ "type": "string",
+ "enum": [
+ "sync",
+ "async"
+ ],
+ "description": "Specifies if the function should be invoked sync or async. Default is sync.",
+ "default": "sync"
}
},
"additionalProperties": false,
@@ -567,6 +599,24 @@
"type": "string",
"description": "Version of the sub-workflow to be invoked",
"minLength": 1
+ },
+ "onParentComplete": {
+ "type": "string",
+ "enum": [
+ "continue",
+ "terminate"
+ ],
+ "description": "If invoke is 'async', specifies how subflow execution should behave when parent workflow completes. Default is 'terminate'",
+ "default": "terminate"
+ },
+ "invoke": {
+ "type": "string",
+ "enum": [
+ "sync",
+ "async"
+ ],
+ "description": "Specifies if the subflow should be invoked sync or async",
+ "default": "sync"
}
},
"required": [
@@ -1073,14 +1123,14 @@
"switchstate": {
"oneOf": [
{
- "$ref": "#/definitions/databasedswitch"
+ "$ref": "#/definitions/databasedswitchstate"
},
{
- "$ref": "#/definitions/eventbasedswitch"
+ "$ref": "#/definitions/eventbasedswitchstate"
}
]
},
- "eventbasedswitch": {
+ "eventbasedswitchstate": {
"type": "object",
"description": "Permits transitions to other states based on events",
"properties": {
@@ -1155,10 +1205,11 @@
"required": [
"name",
"type",
- "eventConditions"
+ "eventConditions",
+ "defaultCondition"
]
},
- "databasedswitch": {
+ "databasedswitchstate": {
"type": "object",
"description": "Permits transitions to other states based on data conditions",
"properties": {
@@ -1230,7 +1281,8 @@
"required": [
"name",
"type",
- "dataConditions"
+ "dataConditions",
+ "defaultCondition"
]
},
"defaultconditiondef": {
@@ -1911,9 +1963,14 @@
"eventdatafilter": {
"type": "object",
"properties": {
+ "useData": {
+ "type": "boolean",
+ "description": "If set to false, event payload is not added/merged to state data. In this case 'data' and 'toStateData' should be ignored. Default is true.",
+ "default": true
+ },
"data": {
"type": "string",
- "description": "Workflow expression that filters the received event/payload (default: '${ . }')"
+ "description": "Workflow expression that filters the received event payload (default: '${ . }')"
},
"toStateData": {
"type": "string",
@@ -1930,6 +1987,11 @@
"type": "string",
"description": "Workflow expression that selects state data that the state action can use"
},
+ "useResults": {
+ "type": "boolean",
+ "description": "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.",
+ "default": true
+ },
"results": {
"type": "string",
"description": "Workflow expression that filters the actions data results"
diff --git a/src/lib/validation/validators-paths.ts b/src/lib/validation/validators-paths.ts
index e3b0cf4e..50161dd3 100644
--- a/src/lib/validation/validators-paths.ts
+++ b/src/lib/validation/validators-paths.ts
@@ -18,68 +18,71 @@
* A map of type names and their corresponding schema
*/
export const validatorsPaths: [string, string][] = [
- ['Workflow', 'https://serverlessworkflow.io/schemas/0.7/workflow.json'],
- ['Sleep', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/sleep'],
- ['Crondef', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/crondef'],
- ['Continueasdef', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/continueasdef'],
- ['Transition', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/transition'],
- ['Error', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/error'],
- ['Onevents', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/onevents'],
- ['Action', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/action'],
- ['Functionref', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/functionref'],
- ['Eventref', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/eventref'],
- ['Subflowref', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/subflowref'],
- ['Branch', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/branch'],
- ['Sleepstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/sleepstate'],
- ['Eventstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/eventstate'],
- ['Operationstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/operationstate'],
- ['Parallelstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/parallelstate'],
- ['Switchstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/switchstate'],
- ['Eventbasedswitch', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/eventbasedswitch'],
- ['Databasedswitch', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/databasedswitch'],
- ['Defaultconditiondef', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/defaultconditiondef'],
- ['Eventcondition', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/eventcondition'],
+ ['Workflow', 'https://serverlessworkflow.io/schemas/0.8/workflow.json'],
+ ['Sleep', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/sleep'],
+ ['Crondef', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/crondef'],
+ ['Continueasdef', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/continueasdef'],
+ ['Transition', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/transition'],
+ ['Error', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/error'],
+ ['Onevents', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/onevents'],
+ ['Action', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/action'],
+ ['Functionref', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/functionref'],
+ ['Eventref', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/eventref'],
+ ['Subflowref', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/subflowref'],
+ ['Branch', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/branch'],
+ ['Sleepstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/sleepstate'],
+ ['Eventstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/eventstate'],
+ ['Operationstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/operationstate'],
+ ['Parallelstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/parallelstate'],
+ ['Switchstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/switchstate'],
+ [
+ 'Eventbasedswitchstate',
+ 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/eventbasedswitchstate',
+ ],
+ ['Databasedswitchstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/databasedswitchstate'],
+ ['Defaultconditiondef', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/defaultconditiondef'],
+ ['Eventcondition', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/eventcondition'],
[
'Transitioneventcondition',
- 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/transitioneventcondition',
+ 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/transitioneventcondition',
],
- ['Enddeventcondition', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/enddeventcondition'],
- ['Datacondition', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/datacondition'],
+ ['Enddeventcondition', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/enddeventcondition'],
+ ['Datacondition', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/datacondition'],
[
'Transitiondatacondition',
- 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/transitiondatacondition',
+ 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/transitiondatacondition',
],
- ['Enddatacondition', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/enddatacondition'],
- ['Injectstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/injectstate'],
- ['Foreachstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/foreachstate'],
- ['Callbackstate', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/callbackstate'],
- ['Startdef', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/startdef'],
- ['Schedule', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/schedule'],
- ['End', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/end'],
- ['Produceeventdef', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/produceeventdef'],
- ['Statedatafilter', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/statedatafilter'],
- ['Eventdatafilter', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/eventdatafilter'],
- ['Actiondatafilter', 'https://serverlessworkflow.io/schemas/0.7/workflow.json#/definitions/actiondatafilter'],
- ['Metadata', 'https://serverlessworkflow.io/schemas/0.7/common.json#/definitions/metadata'],
- ['WorkflowExecTimeout', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/definitions/workflowExecTimeout'],
- ['StateExecTimeout', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/definitions/stateExecTimeout'],
- ['ActionExecTimeout', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/definitions/actionExecTimeout'],
- ['BranchExecTimeout', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/definitions/branchExecTimeout'],
- ['EventTimeout', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/definitions/eventTimeout'],
- ['Retrydef', 'https://serverlessworkflow.io/schemas/0.7/retries.json#/definitions/retrydef'],
- ['Function', 'https://serverlessworkflow.io/schemas/0.7/functions.json#/definitions/function'],
- ['Errordef', 'https://serverlessworkflow.io/schemas/0.7/errors.json#/definitions/errordef'],
- ['Eventdef', 'https://serverlessworkflow.io/schemas/0.7/events.json#/definitions/eventdef'],
- ['CorrelationDef', 'https://serverlessworkflow.io/schemas/0.7/events.json#/definitions/correlationDef'],
- ['Authdef', 'https://serverlessworkflow.io/schemas/0.7/auth.json#/definitions/authdef'],
- ['Basicpropsdef', 'https://serverlessworkflow.io/schemas/0.7/auth.json#/definitions/basicpropsdef'],
- ['Bearerpropsdef', 'https://serverlessworkflow.io/schemas/0.7/auth.json#/definitions/bearerpropsdef'],
- ['Oauth2propsdef', 'https://serverlessworkflow.io/schemas/0.7/auth.json#/definitions/oauth2propsdef'],
- ['Secrets', 'https://serverlessworkflow.io/schemas/0.7/secrets.json#/secrets'],
- ['Timeouts', 'https://serverlessworkflow.io/schemas/0.7/timeouts.json#/timeouts'],
- ['Errors', 'https://serverlessworkflow.io/schemas/0.7/errors.json#/errors'],
- ['Events', 'https://serverlessworkflow.io/schemas/0.7/events.json#/events'],
- ['Functions', 'https://serverlessworkflow.io/schemas/0.7/functions.json#/functions'],
- ['Retries', 'https://serverlessworkflow.io/schemas/0.7/retries.json#/retries'],
- ['Auth', 'https://serverlessworkflow.io/schemas/0.7/auth.json#/auth'],
+ ['Enddatacondition', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/enddatacondition'],
+ ['Injectstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/injectstate'],
+ ['Foreachstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/foreachstate'],
+ ['Callbackstate', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/callbackstate'],
+ ['Startdef', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/startdef'],
+ ['Schedule', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/schedule'],
+ ['End', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/end'],
+ ['Produceeventdef', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/produceeventdef'],
+ ['Statedatafilter', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/statedatafilter'],
+ ['Eventdatafilter', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/eventdatafilter'],
+ ['Actiondatafilter', 'https://serverlessworkflow.io/schemas/0.8/workflow.json#/definitions/actiondatafilter'],
+ ['WorkflowExecTimeout', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/definitions/workflowExecTimeout'],
+ ['StateExecTimeout', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/definitions/stateExecTimeout'],
+ ['ActionExecTimeout', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/definitions/actionExecTimeout'],
+ ['BranchExecTimeout', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/definitions/branchExecTimeout'],
+ ['EventTimeout', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/definitions/eventTimeout'],
+ ['Errordef', 'https://serverlessworkflow.io/schemas/0.8/errors.json#/definitions/errordef'],
+ ['Metadata', 'https://serverlessworkflow.io/schemas/0.8/common.json#/definitions/metadata'],
+ ['Eventdef', 'https://serverlessworkflow.io/schemas/0.8/events.json#/definitions/eventdef'],
+ ['CorrelationDef', 'https://serverlessworkflow.io/schemas/0.8/events.json#/definitions/correlationDef'],
+ ['Function', 'https://serverlessworkflow.io/schemas/0.8/functions.json#/definitions/function'],
+ ['Retrydef', 'https://serverlessworkflow.io/schemas/0.8/retries.json#/definitions/retrydef'],
+ ['Authdef', 'https://serverlessworkflow.io/schemas/0.8/auth.json#/definitions/authdef'],
+ ['Basicpropsdef', 'https://serverlessworkflow.io/schemas/0.8/auth.json#/definitions/basicpropsdef'],
+ ['Bearerpropsdef', 'https://serverlessworkflow.io/schemas/0.8/auth.json#/definitions/bearerpropsdef'],
+ ['Oauth2propsdef', 'https://serverlessworkflow.io/schemas/0.8/auth.json#/definitions/oauth2propsdef'],
+ ['Secrets', 'https://serverlessworkflow.io/schemas/0.8/secrets.json#/secrets'],
+ ['Timeouts', 'https://serverlessworkflow.io/schemas/0.8/timeouts.json#/timeouts'],
+ ['Errors', 'https://serverlessworkflow.io/schemas/0.8/errors.json#/errors'],
+ ['Events', 'https://serverlessworkflow.io/schemas/0.8/events.json#/events'],
+ ['Functions', 'https://serverlessworkflow.io/schemas/0.8/functions.json#/functions'],
+ ['Retries', 'https://serverlessworkflow.io/schemas/0.8/retries.json#/retries'],
+ ['Auth', 'https://serverlessworkflow.io/schemas/0.8/auth.json#/auth'],
];
diff --git a/tests/examples/applicantrequest.json b/tests/examples/applicantrequest.json
index 9125e105..e8fff30f 100644
--- a/tests/examples/applicantrequest.json
+++ b/tests/examples/applicantrequest.json
@@ -1,7 +1,7 @@
{
"id": "applicantrequest",
"version": "1.0",
- "specVersion": "0.7",
+ "specVersion": "0.8",
"name": "Applicant Request Decision Workflow",
"description": "Determine if applicant request is valid",
"start": "CheckApplication",
diff --git a/tests/examples/applicantrequest.spec.ts b/tests/examples/applicantrequest.spec.ts
index 106fed6c..59dae9ac 100644
--- a/tests/examples/applicantrequest.spec.ts
+++ b/tests/examples/applicantrequest.spec.ts
@@ -17,7 +17,7 @@
import * as fs from 'fs';
import {
actionBuilder,
- databasedswitchBuilder,
+ databasedswitchstateBuilder,
functionBuilder,
functionrefBuilder,
operationstateBuilder,
@@ -31,7 +31,7 @@ describe('applicationrequest workflow example', () => {
const workflow = workflowBuilder()
.id('applicantrequest')
.version('1.0')
- .specVersion('0.7')
+ .specVersion('0.8')
.name('Applicant Request Decision Workflow')
.description('Determine if applicant request is valid')
.start('CheckApplication')
@@ -42,7 +42,7 @@ describe('applicationrequest workflow example', () => {
.build(),
])
.states([
- databasedswitchBuilder()
+ databasedswitchstateBuilder()
.name('CheckApplication')
.dataConditions([
transitiondataconditionBuilder()
diff --git a/tests/examples/booklending.json b/tests/examples/booklending.json
index 1c59cc0d..c32d3dad 100644
--- a/tests/examples/booklending.json
+++ b/tests/examples/booklending.json
@@ -2,7 +2,7 @@
"id": "booklending",
"name": "Book Lending Workflow",
"version": "1.0",
- "specVersion": "0.7",
+ "specVersion": "0.8",
"start": "Book Lending Request",
"states": [
{
@@ -44,7 +44,10 @@
"condition": "${ .book.status == \"available\" }",
"transition": "Check Out Book"
}
- ]
+ ],
+ "defaultCondition": {
+ "end": true
+ }
},
{
"type": "operation",
@@ -76,7 +79,10 @@
"eventRef": "Decline Hold Event",
"transition": "Cancel Request"
}
- ]
+ ],
+ "defaultCondition": {
+ "end": true
+ }
},
{
"type": "operation",
diff --git a/tests/examples/booklending.spec.ts b/tests/examples/booklending.spec.ts
index 92af9904..874fbb3c 100644
--- a/tests/examples/booklending.spec.ts
+++ b/tests/examples/booklending.spec.ts
@@ -17,8 +17,8 @@
import * as fs from 'fs';
import {
actionBuilder,
- databasedswitchBuilder,
- eventbasedswitchBuilder,
+ databasedswitchstateBuilder,
+ eventbasedswitchstateBuilder,
eventstateBuilder,
oneventsBuilder,
operationstateBuilder,
@@ -27,6 +27,7 @@ import {
workflowBuilder,
functionrefBuilder,
sleepstateBuilder,
+ defaultconditiondefBuilder,
} from '../../src';
describe('booklending workflow example', () => {
@@ -35,7 +36,7 @@ describe('booklending workflow example', () => {
.id('booklending')
.name('Book Lending Workflow')
.version('1.0')
- .specVersion('0.7')
+ .specVersion('0.8')
.start('Book Lending Request')
.states([
eventstateBuilder()
@@ -59,7 +60,7 @@ describe('booklending workflow example', () => {
])
.transition('Book Status Decision')
.build(),
- databasedswitchBuilder()
+ databasedswitchstateBuilder()
.name('Book Status Decision')
.dataConditions([
transitiondataconditionBuilder()
@@ -73,6 +74,7 @@ describe('booklending workflow example', () => {
.transition('Check Out Book')
.build(),
])
+ .defaultCondition(defaultconditiondefBuilder().end(true).build())
.build(),
operationstateBuilder()
.name('Report Status To Lender')
@@ -91,7 +93,7 @@ describe('booklending workflow example', () => {
])
.transition('Wait for Lender response')
.build(),
- eventbasedswitchBuilder()
+ eventbasedswitchstateBuilder()
.name('Wait for Lender response')
.eventConditions([
transitioneventconditionBuilder()
@@ -105,6 +107,7 @@ describe('booklending workflow example', () => {
.transition('Cancel Request')
.build(),
])
+ .defaultCondition(defaultconditiondefBuilder().end(true).build())
.build(),
operationstateBuilder()
.name('Request Hold')
diff --git a/tests/examples/carauctionbids.json b/tests/examples/carauctionbids.json
index 66a435cf..451be389 100644
--- a/tests/examples/carauctionbids.json
+++ b/tests/examples/carauctionbids.json
@@ -1,7 +1,7 @@
{
"id": "handleCarAuctionBid",
"version": "1.0",
- "specVersion": "0.7",
+ "specVersion": "0.8",
"name": "Car Auction Bidding Workflow",
"description": "Store a single bid whole the car auction is active",
"start": {
diff --git a/tests/examples/carauctionbids.spec.ts b/tests/examples/carauctionbids.spec.ts
index 4d28cee5..a14514c0 100644
--- a/tests/examples/carauctionbids.spec.ts
+++ b/tests/examples/carauctionbids.spec.ts
@@ -29,7 +29,7 @@ describe('carauctionbids workflow example', () => {
const workflow = workflowBuilder()
.id('handleCarAuctionBid')
.version('1.0')
- .specVersion('0.7')
+ .specVersion('0.8')
.name('Car Auction Bidding Workflow')
.description('Store a single bid whole the car auction is active')
.start({
diff --git a/tests/examples/checkcarvitals.json b/tests/examples/checkcarvitals.json
index b050325d..051ff46b 100644
--- a/tests/examples/checkcarvitals.json
+++ b/tests/examples/checkcarvitals.json
@@ -2,7 +2,7 @@
"id": "checkcarvitals",
"name": "Check Car Vitals Workflow",
"version": "1.0",
- "specVersion": "0.7",
+ "specVersion": "0.8",
"start": "WhenCarIsOn",
"states": [
{
diff --git a/tests/examples/checkcarvitals.spec.ts b/tests/examples/checkcarvitals.spec.ts
index 111c65a8..ed77e51d 100644
--- a/tests/examples/checkcarvitals.spec.ts
+++ b/tests/examples/checkcarvitals.spec.ts
@@ -23,7 +23,7 @@ import {
oneventsBuilder,
workflowBuilder,
sleepBuilder,
- eventbasedswitchBuilder,
+ eventbasedswitchstateBuilder,
enddeventconditionBuilder,
defaultconditiondefBuilder,
} from '../../src';
@@ -34,7 +34,7 @@ describe('checkcarvitals workflow example', () => {
.id('checkcarvitals')
.name('Check Car Vitals Workflow')
.version('1.0')
- .specVersion('0.7')
+ .specVersion('0.8')
.start('WhenCarIsOn')
.states([
eventstateBuilder()
@@ -49,7 +49,7 @@ describe('checkcarvitals workflow example', () => {
.transition('CheckContinueVitalChecks')
.build(),
- eventbasedswitchBuilder()
+ eventbasedswitchstateBuilder()
.name('CheckContinueVitalChecks')
.eventConditions([
enddeventconditionBuilder()
diff --git a/tests/examples/jobmonitoring.json b/tests/examples/jobmonitoring.json
index d230eea8..c9f06b97 100644
--- a/tests/examples/jobmonitoring.json
+++ b/tests/examples/jobmonitoring.json
@@ -1,7 +1,7 @@
{
"id": "jobmonitoring",
"version": "1.0",
- "specVersion": "0.7",
+ "specVersion": "0.8",
"name": "Job Monitoring",
"description": "Monitor finished execution of a submitted job",
"start": "SubmitJob",
diff --git a/tests/examples/jobmonitoring.spec.ts b/tests/examples/jobmonitoring.spec.ts
index eb3f9524..5b8b6965 100644
--- a/tests/examples/jobmonitoring.spec.ts
+++ b/tests/examples/jobmonitoring.spec.ts
@@ -18,7 +18,7 @@ import * as fs from 'fs';
import {
actionBuilder,
actiondatafilterBuilder,
- databasedswitchBuilder,
+ databasedswitchstateBuilder,
functionBuilder,
functionrefBuilder,
operationstateBuilder,
@@ -34,7 +34,7 @@ describe('jobmonitoring workflow example', () => {
const workflow = workflowBuilder()
.id('jobmonitoring')
.version('1.0')
- .specVersion('0.7')
+ .specVersion('0.8')
.name('Job Monitoring')
.description('Monitor finished execution of a submitted job')
.start('SubmitJob')
@@ -87,7 +87,7 @@ describe('jobmonitoring workflow example', () => {
.stateDataFilter(statedatafilterBuilder().output('${ .jobstatus }').build())
.transition('DetermineCompletion')
.build(),
- databasedswitchBuilder()
+ databasedswitchstateBuilder()
.name('DetermineCompletion')
.dataConditions([
transitiondataconditionBuilder()
diff --git a/tests/examples/parallel.json b/tests/examples/parallel.json
index 8a7d80b5..98436122 100644
--- a/tests/examples/parallel.json
+++ b/tests/examples/parallel.json
@@ -1,7 +1,7 @@
{
"id": "parallelexec",
"version": "1.0",
- "specVersion": "0.7",
+ "specVersion": "0.8",
"name": "Parallel Execution Workflow",
"description": "Executes two branches in parallel",
"start": "ParallelExec",
diff --git a/tests/examples/parallel.spec.ts b/tests/examples/parallel.spec.ts
index 16ca4ad2..25f6a353 100644
--- a/tests/examples/parallel.spec.ts
+++ b/tests/examples/parallel.spec.ts
@@ -22,7 +22,7 @@ describe('parallel workflow example', () => {
const workflow = workflowBuilder()
.id('parallelexec')
.version('1.0')
- .specVersion('0.7')
+ .specVersion('0.8')
.name('Parallel Execution Workflow')
.description('Executes two branches in parallel')
.start('ParallelExec')
diff --git a/tests/examples/provisionorder.json b/tests/examples/provisionorder.json
index 192d482c..57d14a80 100644
--- a/tests/examples/provisionorder.json
+++ b/tests/examples/provisionorder.json
@@ -1,7 +1,7 @@
{
"id": "provisionorders",
"version": "1.0",
- "specVersion": "0.7",
+ "specVersion": "0.8",
"name": "Provision Orders",
"description": "Provision Orders and handle errors thrown",
"start": "ProvisionOrder",
diff --git a/tests/examples/provisionorder.spec.ts b/tests/examples/provisionorder.spec.ts
index 044ec682..3b20bb2b 100644
--- a/tests/examples/provisionorder.spec.ts
+++ b/tests/examples/provisionorder.spec.ts
@@ -31,7 +31,7 @@ describe('provisionorder workflow example', () => {
const workflow = workflowBuilder()
.id('provisionorders')
.version('1.0')
- .specVersion('0.7')
+ .specVersion('0.8')
.name('Provision Orders')
.description('Provision Orders and handle errors thrown')
.start('ProvisionOrder')
diff --git a/tests/examples/sendcloudevent.json b/tests/examples/sendcloudevent.json
index 7ab9429f..6e50dcd6 100644
--- a/tests/examples/sendcloudevent.json
+++ b/tests/examples/sendcloudevent.json
@@ -1,7 +1,7 @@
{
"id": "sendcloudeventonprovision",
"version": "1.0",
- "specVersion": "0.7",
+ "specVersion": "0.8",
"name": "Send CloudEvent on provision completion",
"start": "ProvisionOrdersState",
"events": [
diff --git a/tests/examples/sendcloudevent.spec.ts b/tests/examples/sendcloudevent.spec.ts
index b747eeed..a7664208 100644
--- a/tests/examples/sendcloudevent.spec.ts
+++ b/tests/examples/sendcloudevent.spec.ts
@@ -30,7 +30,7 @@ describe('sendcloudevent workflow example', () => {
const workflow = workflowBuilder()
.id('sendcloudeventonprovision')
.version('1.0')
- .specVersion('0.7')
+ .specVersion('0.8')
.name('Send CloudEvent on provision completion')
.start('ProvisionOrdersState')
.events([
diff --git a/tests/examples/solvemathproblems.json b/tests/examples/solvemathproblems.json
index 2b560181..a2994e9e 100644
--- a/tests/examples/solvemathproblems.json
+++ b/tests/examples/solvemathproblems.json
@@ -1,7 +1,7 @@
{
"id": "solvemathproblems",
"version": "1.0",
- "specVersion": "0.7",
+ "specVersion": "0.8",
"name": "Solve Math Problems Workflow",
"description": "Solve math problems",
"start": "Solve",
diff --git a/tests/examples/solvemathproblems.spec.ts b/tests/examples/solvemathproblems.spec.ts
index 42adab1f..6a093c2f 100644
--- a/tests/examples/solvemathproblems.spec.ts
+++ b/tests/examples/solvemathproblems.spec.ts
@@ -28,7 +28,7 @@ describe('solvemathproblems workflow example', () => {
const workflow = workflowBuilder()
.id('solvemathproblems')
.version('1.0')
- .specVersion('0.7')
+ .specVersion('0.8')
.name('Solve Math Problems Workflow')
.description('Solve math problems')
.start('Solve')
diff --git a/tests/lib/definitions/workflow-converter-hello-world.json b/tests/lib/definitions/workflow-converter-hello-world.json
index 5d763aff..9296d76e 100644
--- a/tests/lib/definitions/workflow-converter-hello-world.json
+++ b/tests/lib/definitions/workflow-converter-hello-world.json
@@ -1,7 +1,7 @@
{
"id": "helloworld",
"version": "1.0",
- "specVersion": "0.7",
+ "specVersion": "0.8",
"name": "Hello World Workflow",
"description": "Inject Hello World",
"start": "Hello State",
diff --git a/tests/lib/definitions/workflow-converter-hello-world.yaml b/tests/lib/definitions/workflow-converter-hello-world.yaml
index 854b4a4b..e6060038 100644
--- a/tests/lib/definitions/workflow-converter-hello-world.yaml
+++ b/tests/lib/definitions/workflow-converter-hello-world.yaml
@@ -1,6 +1,6 @@
id: helloworld
version: '1.0'
-specVersion": '0.7'
+specVersion": '0.8'
name: Hello World Workflow
description: Inject Hello World
start: Hello State
diff --git a/tests/lib/definitions/workflow-converter-hello-world.yml b/tests/lib/definitions/workflow-converter-hello-world.yml
index 854b4a4b..e6060038 100644
--- a/tests/lib/definitions/workflow-converter-hello-world.yml
+++ b/tests/lib/definitions/workflow-converter-hello-world.yml
@@ -1,6 +1,6 @@
id: helloworld
version: '1.0'
-specVersion": '0.7'
+specVersion": '0.8'
name: Hello World Workflow
description: Inject Hello World
start: Hello State
diff --git a/tests/lib/definitions/workflow.spec.ts b/tests/lib/definitions/workflow.spec.ts
index 57cb800f..c5b02efb 100644
--- a/tests/lib/definitions/workflow.spec.ts
+++ b/tests/lib/definitions/workflow.spec.ts
@@ -95,7 +95,7 @@ describe('workflow ', () => {
workflowBuilder()
.id('helloworld')
.version('1.0')
- .specVersion('0.7')
+ .specVersion('0.8')
.name('Hello World Workflow')
.description('Inject Hello World')
.start('Hello State')
@@ -114,7 +114,7 @@ describe('workflow ', () => {
'{' +
'"id":"helloworld",' +
'"version":"1.0",' +
- '"specVersion":"0.7",' +
+ '"specVersion":"0.8",' +
'"name":"Hello World Workflow",' +
'"description":"Inject Hello World",' +
'"start":"Hello State",' +
@@ -137,7 +137,7 @@ describe('workflow ', () => {
workflowBuilder()
.id('helloworld')
.version('1.0')
- .specVersion('0.7')
+ .specVersion('0.8')
.name('Hello World Workflow')
.description('Inject Hello World')
.start('Hello State')
@@ -155,7 +155,7 @@ describe('workflow ', () => {
expect(yamlWorkflow).toBe(
'id: helloworld\n' +
"version: '1.0'\n" +
- "specVersion: '0.7'\n" +
+ "specVersion: '0.8'\n" +
'name: Hello World Workflow\n' +
'description: Inject Hello World\n' +
'start: Hello State\n' +
diff --git a/tests/lib/diagram/mermaidState.spec.ts b/tests/lib/diagram/mermaidState.spec.ts
index 5cfeed4f..0cec8d28 100644
--- a/tests/lib/diagram/mermaidState.spec.ts
+++ b/tests/lib/diagram/mermaidState.spec.ts
@@ -51,7 +51,7 @@ ParallelExec --> [*]`);
});
it('should create source code for event-based state', () => {
- const eventbasedswitch = new Specification.Eventbasedswitch(
+ const eventbasedswitch = new Specification.Eventbasedswitchstate(
JSON.parse(`{
"name": "CheckVisaStatus",
"type": "switch",
@@ -81,7 +81,7 @@ CheckVisaStatus --> HandleNoVisaDecision : default`);
});
it('should create source code for data-based state', () => {
- const databasedswitch = new Specification.Databasedswitch(
+ const databasedswitch = new Specification.Databasedswitchstate(
JSON.parse(`{
"type":"switch",
"name":"CheckApplication",
@@ -110,7 +110,7 @@ CheckApplication --> RejectApplication : default`);
});
it('should create source code for data-based state with end condition', () => {
- const databasedswitch = new Specification.Databasedswitch(
+ const databasedswitch = new Specification.Databasedswitchstate(
JSON.parse(`{
"type":"switch",
"name":"CheckApplication",
@@ -252,7 +252,7 @@ CheckCredit --> EvaluateDecision`);
it('should create source code for any state with transition as object', () => {
const states = new Specification.Callbackstate(
- JSON.parse(`{
+ JSON.parse(`{
"name": "CheckCredit",
"type": "callback",
"transition": {"nextState": "EvaluateDecision"}
@@ -264,10 +264,9 @@ CheckCredit : type = Callback State
CheckCredit --> EvaluateDecision`);
});
-
it(`should convert white spaces with underscore to create the state key`, () => {
- const databasedswitch = new Specification.Databasedswitch(
- JSON.parse(`{
+ const databasedswitch = new Specification.Databasedswitchstate(
+ JSON.parse(`{
"type":"switch",
"name":"Check Application",
"dataConditions": [
diff --git a/tests/lib/workflow-validator.spec.ts b/tests/lib/workflow-validator.spec.ts
index 98a21262..c9e46975 100644
--- a/tests/lib/workflow-validator.spec.ts
+++ b/tests/lib/workflow-validator.spec.ts
@@ -20,7 +20,7 @@ import { Workflow } from '../../src/lib/definitions/workflow';
const validWorkflow = {
id: 'helloworld',
version: '1.0',
- specVersion: '0.7',
+ specVersion: '0.8',
name: 'Hello World Workflow',
description: 'Inject Hello World',
start: 'Hello State',
diff --git a/tools/generate-builders.ts b/tools/generate-builders.ts
index b958c8b2..b361f9d6 100644
--- a/tools/generate-builders.ts
+++ b/tools/generate-builders.ts
@@ -25,16 +25,6 @@ declare global {
matchAll(re: RegExp): RegExpExecArray[];
}
}
-if (!String.prototype.matchAll) {
- String.prototype.matchAll = function (re) {
- const results: RegExpExecArray[] = [];
- let matches: RegExpExecArray | null;
- while ((matches = re.exec(this))) {
- results.push(matches);
- }
- return results;
- };
-}
const types = ['Datacondition', 'Eventcondition', 'Events', 'Functions', 'Retries', 'Switchstate'];