Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,407 changes: 2,123 additions & 2,284 deletions package-lock.json

Large diffs are not rendered by default.

54 changes: 28 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,45 @@
"prepublish": "husky install"
},
"dependencies": {
"ajv": "^8.1.0",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"js-yaml": "^4.1.0"
},
"devDependencies": {
"@apidevtools/json-schema-ref-parser": "^9.0.7",
"@apidevtools/json-schema-ref-parser": "^11.6.4",
"@dtsgenerator/replace-namespace": "^1.4.1",
"@rollup/plugin-commonjs": "^28.0.6",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@types/jest": "^30.0.0",
"@types/js-yaml": "^4.0.1",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/jest": "^29.5.12",
"@types/js-yaml": "^4.0.9",
"@types/lodash.toplainobject": "^4.2.9",
"@types/node-fetch": "^2.5.10",
"@types/yargs": "^16.0.1",
"@typescript-eslint/eslint-plugin": "^8.45.0",
"@typescript-eslint/parser": "^8.45.0",
"@types/node-fetch": "^2.6.11",
"@types/rimraf": "^4.0.5",
"@types/yargs": "^17.0.32",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"dtsgenerator": "^3.10.0",
"eslint": "^9.36.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"husky": "6.0.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.11",
"immer": "^10.0.3",
"jest": "^30.2.0",
"lint-staged": "11.0.0",
"jest": "^29.7.0",
"lint-staged": "^15.2.7",
"lodash.toplainobject": "^4.2.0",
"node-fetch": "^2.6.1",
"prettier": "^2.3.0",
"node-fetch": "^3.3.2",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"rollup": "^2.47.0",
"rollup": "^2.79.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.36.0",
"shx": "^0.4.0",
"ts-jest": "^29.4.4",
"ts-node": "^9.1.1",
"shx": "^0.3.4",
"ts-jest": "^29.2.2",
"ts-node": "^10.9.2",
"typescript": "^5.5.3",
"yargs": "^17.0.1"
"yargs": "^17.7.2"
},
"repository": {
"type": "git",
Expand All @@ -85,7 +87,7 @@
},
"homepage": "https://serverlessworkflow.io",
"engines": {
"node": ">=15.0",
"npm": ">=7.0.0"
"node": ">=20.0",
"npm": ">=10.0.0"
}
}
2 changes: 1 addition & 1 deletion src/lib/builders/databasedswitchstate-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { validate } from '../utils';
* @returns {Specification.IDatabasedswitchstate} The validated underlying object
*/
function databasedswitchstateBuildingFn(
data: Specification.IDatabasedswitchstate
data: Specification.IDatabasedswitchstate,
): () => Specification.IDatabasedswitchstate {
return () => {
const model = new Specification.Databasedswitchstate(data);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/builders/defaultconditiondef-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { validate } from '../utils';
* @returns {Specification.IDefaultconditiondef} The validated underlying object
*/
function defaultconditiondefBuildingFn(
data: Specification.IDefaultconditiondef
data: Specification.IDefaultconditiondef,
): () => Specification.IDefaultconditiondef {
return () => {
const model = new Specification.Defaultconditiondef(data);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/builders/enddeventcondition-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { validate } from '../utils';
* @returns {Specification.IEnddeventcondition} The validated underlying object
*/
function enddeventconditionBuildingFn(
data: Specification.IEnddeventcondition
data: Specification.IEnddeventcondition,
): () => Specification.IEnddeventcondition {
return () => {
const model = new Specification.Enddeventcondition(data);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/builders/eventbasedswitchstate-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { validate } from '../utils';
* @returns {Specification.IEventbasedswitchstate} The validated underlying object
*/
function eventbasedswitchstateBuildingFn(
data: Specification.IEventbasedswitchstate
data: Specification.IEventbasedswitchstate,
): () => Specification.IEventbasedswitchstate {
return () => {
const model = new Specification.Eventbasedswitchstate(data);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/builders/transitiondatacondition-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { validate } from '../utils';
* @returns {Specification.ITransitiondatacondition} The validated underlying object
*/
function transitiondataconditionBuildingFn(
data: Specification.ITransitiondatacondition
data: Specification.ITransitiondatacondition,
): () => Specification.ITransitiondatacondition {
return () => {
const model = new Specification.Transitiondatacondition(data);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/builders/transitioneventcondition-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { validate } from '../utils';
* @returns {Specification.ITransitioneventcondition} The validated underlying object
*/
function transitioneventconditionBuildingFn(
data: Specification.ITransitioneventcondition
data: Specification.ITransitioneventcondition,
): () => Specification.ITransitioneventcondition {
return () => {
const model = new Specification.Transitioneventcondition(data);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/builders/workflow-exec-timeout-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { validate } from '../utils';
* @returns {Specification.IWorkflowExecTimeout} The validated underlying object
*/
function workflowExecTimeoutBuildingFn(
data: Specification.IWorkflowExecTimeout
data: Specification.IWorkflowExecTimeout,
): () => Specification.IWorkflowExecTimeout {
return () => {
const model = new Specification.WorkflowExecTimeout(data);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/definitions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { Specification } from './index';

export type CorrelationDefs = [
/* CloudEvent correlation definition */ ICorrelationDef,
.../* CloudEvent correlation definition */ ICorrelationDef[]
.../* CloudEvent correlation definition */ ICorrelationDef[],
];

export type Datacondition /* Switch state data based condition */ =
Expand Down Expand Up @@ -75,7 +75,7 @@ export type States = [
| /* Inject static data into state data. Does not perform any actions */ IInjectstate
| /* Execute a set of defined actions or workflows for each element of a data array */ IForeachstate
| /* This state performs an action, then waits for the callback event that denotes completion of the action */ ICallbackstate
)[]
)[],
];

/**
Expand Down
24 changes: 12 additions & 12 deletions src/lib/definitions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function overwriteEventConditions(object: { eventConditions: Specificatio
}

throw new Error(
`Provided value is neither Transitioneventcondition nor Enddeventcondition \n data= ${eventCondition} `
`Provided value is neither Transitioneventcondition nor Enddeventcondition \n data= ${eventCondition} `,
);
});
}
Expand All @@ -115,7 +115,7 @@ export function overwriteDataConditions(object: { dataConditions: Specification.
}

throw new Error(
`Provided value is neither Transitiondatacondition nor Enddatacondition \n data= ${dataCondition} `
`Provided value is neither Transitiondatacondition nor Enddatacondition \n data= ${dataCondition} `,
);
});
}
Expand Down Expand Up @@ -162,7 +162,7 @@ export function overwriteMetadata(object: { metadata?: Specification.IMetadata }
export function overwriteRetries(object: { retries?: Specification.Retries }) {
if (Array.isArray(object.retries)) {
object.retries = (object.retries as Specification.Retrydef[]).map(
(f) => new Specification.Retrydef(f)
(f) => new Specification.Retrydef(f),
) as Specification.Retries;
}
}
Expand All @@ -174,7 +174,7 @@ export function overwriteRetries(object: { retries?: Specification.Retries }) {
export function overwriteEvents(object: { events?: Specification.Events }) {
if (Array.isArray(object.events)) {
object.events = (object.events as Specification.Eventdef[]).map(
(f) => new Specification.Eventdef(f)
(f) => new Specification.Eventdef(f),
) as Specification.Events;
}
}
Expand All @@ -186,7 +186,7 @@ export function overwriteEvents(object: { events?: Specification.Events }) {
export function overwriteErrors(object: { errors?: Specification.Errors }) {
if (Array.isArray(object.errors)) {
object.errors = (object.errors as Specification.Errordef[]).map(
(f) => new Specification.Errordef(f)
(f) => new Specification.Errordef(f),
) as Specification.Errors;
}
}
Expand All @@ -198,7 +198,7 @@ export function overwriteErrors(object: { errors?: Specification.Errors }) {
export function overwriteAuth(object: { auth?: Specification.Auth }) {
if (Array.isArray(object.auth)) {
object.auth = (object.auth as Specification.Authdef[]).map(
(f) => new Specification.Authdef(f)
(f) => new Specification.Authdef(f),
) as Specification.Auth;
}
}
Expand All @@ -210,7 +210,7 @@ export function overwriteAuth(object: { auth?: Specification.Auth }) {
export function overwriteFunctions(object: { functions?: Specification.Functions }) {
if (Array.isArray(object.functions)) {
object.functions = (object.functions as Specification.Function[]).map(
(f) => new Specification.Function(f)
(f) => new Specification.Function(f),
) as Specification.Functions;
}
}
Expand Down Expand Up @@ -284,7 +284,7 @@ export function overwriteProperties(object: { properties: string | Specification
export function overwriteCorrelation(object: { correlation?: Specification.CorrelationDefs }): void {
if (Array.isArray(object.correlation)) {
object.correlation = object.correlation.map(
(correlation) => new Specification.CorrelationDef(correlation)
(correlation) => new Specification.CorrelationDef(correlation),
) as Specification.CorrelationDefs;
}
}
Expand Down Expand Up @@ -634,7 +634,7 @@ export function normalizeAuth(object: { auth?: Specification.Auth }) {
export function normalizeFunctions(object: { functions?: Specification.Functions }) {
if (Array.isArray(object.functions)) {
object.functions = (object.functions as Specification.Function[]).map((f) =>
f.normalize()
f.normalize(),
) as Specification.Functions;
}
}
Expand All @@ -646,7 +646,7 @@ export function normalizeFunctions(object: { functions?: Specification.Functions
export function normalizeEvents(object: { events?: Specification.Events }) {
if (Array.isArray(object.events)) {
object.events = (object.events as Specification.Eventdef[]).map((event) =>
event.normalize()
event.normalize(),
) as Specification.Events;
}
}
Expand Down Expand Up @@ -707,7 +707,7 @@ export function normalizeCompletionType(object: { completionType?: string }, sou
*/
export function normalizeUsedForCompensation(
object: { usedForCompensation?: boolean },
source?: { usedForCompensation?: boolean }
source?: { usedForCompensation?: boolean },
) {
if (source?.usedForCompensation === undefined) {
delete object.usedForCompensation;
Expand Down Expand Up @@ -820,7 +820,7 @@ export function normalizeInvoke(object: { invoke?: string }, source?: { invoke?:
*/
export function normalizeOnParentComplete(
object: { onParentComplete?: 'continue' | 'terminate' },
source?: { onParentComplete?: 'continue' | 'terminate' }
source?: { onParentComplete?: 'continue' | 'terminate' },
) {
if (!source?.onParentComplete) {
delete object.onParentComplete;
Expand Down
28 changes: 14 additions & 14 deletions src/lib/diagram/mermaidState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class MermaidState {
onErrors?: Specification.Error[];
usedForCompensation?: boolean;
},
private isFirstState: boolean = false
private isFirstState: boolean = false,
) {}

sourceCode() {
Expand Down Expand Up @@ -87,7 +87,7 @@ export class MermaidState {
const transitionDataCondition = dataCondition as Specification.Transitiondatacondition;

transitions.push(
...this.naturalTransition(stateName, transitionDataCondition.transition, transitionDataCondition.condition)
...this.naturalTransition(stateName, transitionDataCondition.transition, transitionDataCondition.condition),
);

const endDataCondition = dataCondition as Specification.Enddatacondition;
Expand All @@ -111,7 +111,7 @@ export class MermaidState {
const transitionEventCondition = eventCondition as Specification.Transitioneventcondition;

transitions.push(
...this.naturalTransition(stateName, transitionEventCondition.transition, transitionEventCondition.eventRef)
...this.naturalTransition(stateName, transitionEventCondition.transition, transitionEventCondition.eventRef),
);

const endEventCondition = eventCondition as Specification.Enddeventcondition;
Expand Down Expand Up @@ -157,7 +157,7 @@ export class MermaidState {
private naturalTransition(
source?: string,
target?: string | Specification.Transition,
label: string | undefined = undefined
label: string | undefined = undefined,
) {
const transitions: string[] = [];

Expand All @@ -179,7 +179,7 @@ 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)
...this.naturalTransition(this.stateKeyDiagram(this.state.name), error.transition, error.errorRef),
);
});
}
Expand Down Expand Up @@ -248,7 +248,7 @@ export class MermaidState {
return this.stateDescription(
this.stateKeyDiagram(this.state.name),
'type',
type!.charAt(0).toUpperCase() + type!.slice(1) + ' State'
type!.charAt(0).toUpperCase() + type!.slice(1) + ' State',
);
}

Expand All @@ -259,7 +259,7 @@ export class MermaidState {

if (parallelState.completionType) {
descriptions.push(
this.stateDescription(this.stateKeyDiagram(this.state.name), 'Completion type', parallelState.completionType)
this.stateDescription(this.stateKeyDiagram(this.state.name), 'Completion type', parallelState.completionType),
);
}

Expand All @@ -268,8 +268,8 @@ export class MermaidState {
this.stateDescription(
this.stateKeyDiagram(this.state.name),
'Num. of branches',
parallelState.branches?.length + ''
)
parallelState.branches?.length + '',
),
);
}

Expand Down Expand Up @@ -299,7 +299,7 @@ export class MermaidState {

if (state.actions) {
descriptions.push(
this.stateDescription(this.stateKeyDiagram(this.state.name), 'Num. of actions', state.actions?.length + '')
this.stateDescription(this.stateKeyDiagram(this.state.name), 'Num. of actions', state.actions?.length + ''),
);
}

Expand All @@ -326,13 +326,13 @@ export class MermaidState {

if (state.inputCollection) {
descriptions.push(
this.stateDescription(this.stateKeyDiagram(this.state.name), 'Input collection', state.inputCollection)
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 + '')
this.stateDescription(this.stateKeyDiagram(this.state.name), 'Num. of actions', state.actions?.length + ''),
);
}

Expand All @@ -357,7 +357,7 @@ export class MermaidState {
functionRefDescription = functionRef as string;
}
descriptions.push(
this.stateDescription(this.stateKeyDiagram(this.state.name), 'Callback function', functionRefDescription)
this.stateDescription(this.stateKeyDiagram(this.state.name), 'Callback function', functionRefDescription),
);
}

Expand All @@ -379,7 +379,7 @@ export class MermaidState {
private transitionDescription(
source: string | undefined,
target: string | undefined,
label: string | undefined = undefined
label: string | undefined = undefined,
) {
return this.stateKeyDiagram(source) + ' --> ' + this.stateKeyDiagram(target) + (label ? ' : ' + label : '');
}
Expand Down
Loading