@lssm/lib.workflow-composer 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/composer.d.ts +1 -2
- package/dist/composer.js +1 -2
- package/dist/injector.d.ts +1 -2
- package/dist/injector.js +1 -2
- package/dist/merger.d.ts +1 -2
- package/dist/merger.js +1 -2
- package/dist/templates.d.ts +1 -2
- package/dist/templates.js +1 -2
- package/dist/types.d.ts +1 -2
- package/dist/validator.d.ts +1 -2
- package/dist/validator.js +1 -2
- package/package.json +10 -7
- package/dist/composer.d.ts.map +0 -1
- package/dist/composer.js.map +0 -1
- package/dist/injector.d.ts.map +0 -1
- package/dist/injector.js.map +0 -1
- package/dist/merger.d.ts.map +0 -1
- package/dist/merger.js.map +0 -1
- package/dist/templates.d.ts.map +0 -1
- package/dist/templates.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/validator.d.ts.map +0 -1
- package/dist/validator.js.map +0 -1
package/README.md
CHANGED
package/dist/composer.d.ts
CHANGED
package/dist/composer.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{applyWorkflowExtension as e}from"./injector.js";var t=class{extensions=[];register(e){return this.extensions.push(e),this}registerMany(e){return e.forEach(e=>this.register(e)),this}compose(t){return this.extensions.filter(e=>n(t,e)).sort((e,t)=>(e.priority??0)-(t.priority??0)).reduce((t,n)=>e(t,n),t.base)}};function n(e,t){return!(t.workflow!==e.base.meta.name||t.baseVersion&&t.baseVersion!==e.base.meta.version||t.tenantId&&t.tenantId!==e.tenantId||t.role&&t.role!==e.role||t.device&&t.device!==e.device)}export{t as WorkflowComposer};
|
|
2
|
-
//# sourceMappingURL=composer.js.map
|
|
1
|
+
import{applyWorkflowExtension as e}from"./injector.js";var t=class{extensions=[];register(e){return this.extensions.push(e),this}registerMany(e){return e.forEach(e=>this.register(e)),this}compose(t){return this.extensions.filter(e=>n(t,e)).sort((e,t)=>(e.priority??0)-(t.priority??0)).reduce((t,n)=>e(t,n),t.base)}};function n(e,t){return!(t.workflow!==e.base.meta.name||t.baseVersion&&t.baseVersion!==e.base.meta.version||t.tenantId&&t.tenantId!==e.tenantId||t.role&&t.role!==e.role||t.device&&t.device!==e.device)}export{t as WorkflowComposer};
|
package/dist/injector.d.ts
CHANGED
|
@@ -4,5 +4,4 @@ import { WorkflowSpec } from "@lssm/lib.contracts/workflow/spec";
|
|
|
4
4
|
//#region src/injector.d.ts
|
|
5
5
|
declare function applyWorkflowExtension(base: WorkflowSpec, extension: WorkflowExtension): WorkflowSpec;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { applyWorkflowExtension };
|
|
8
|
-
//# sourceMappingURL=injector.d.ts.map
|
|
7
|
+
export { applyWorkflowExtension };
|
package/dist/injector.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{validateExtension as e}from"./validator.js";function t(t,r){e(r,t);let s=o(t),c=[...s.definition.steps],l=[...s.definition.transitions],u=new Set(r.hiddenSteps??[]);return u.forEach(e=>{let t=c.findIndex(t=>t.id===e);t!==-1&&c.splice(t,1)}),u.size&&(l=l.filter(e=>!u.has(e.from)&&!u.has(e.to))),r.customSteps?.forEach(e=>{n(c,e),i(l,e)}),s.definition.steps=c,s.definition.transitions=a(l),s.meta={...s.meta,version:s.meta.version},s}function n(e,t){let n=r(e,t);if(n===-1)throw Error(`Unable to place injected step "${t.inject.id}"`);e.splice(n,0,{...t.inject})}function r(e,t){if(t.after){let n=e.findIndex(e=>e.id===t.after);return n===-1?-1:n+1}if(t.before){let n=e.findIndex(e=>e.id===t.before);return n===-1?-1:n}return e.length}function i(e,t){t.inject.id&&(t.transitionFrom&&e.push({from:t.transitionFrom,to:t.inject.id,condition:t.when}),t.transitionTo&&e.push({from:t.inject.id,to:t.transitionTo,condition:t.when}))}function a(e){let t=new Set,n=[];return e.forEach(e=>{let r=`${e.from}->${e.to}:${e.condition??``}`;t.has(r)||(t.add(r),n.push(e))}),n}function o(e){return JSON.parse(JSON.stringify(e))}export{t as applyWorkflowExtension};
|
|
2
|
-
//# sourceMappingURL=injector.js.map
|
|
1
|
+
import{validateExtension as e}from"./validator.js";function t(t,r){e(r,t);let s=o(t),c=[...s.definition.steps],l=[...s.definition.transitions],u=new Set(r.hiddenSteps??[]);return u.forEach(e=>{let t=c.findIndex(t=>t.id===e);t!==-1&&c.splice(t,1)}),u.size&&(l=l.filter(e=>!u.has(e.from)&&!u.has(e.to))),r.customSteps?.forEach(e=>{n(c,e),i(l,e)}),s.definition.steps=c,s.definition.transitions=a(l),s.meta={...s.meta,version:s.meta.version},s}function n(e,t){let n=r(e,t);if(n===-1)throw Error(`Unable to place injected step "${t.inject.id}"`);e.splice(n,0,{...t.inject})}function r(e,t){if(t.after){let n=e.findIndex(e=>e.id===t.after);return n===-1?-1:n+1}if(t.before){let n=e.findIndex(e=>e.id===t.before);return n===-1?-1:n}return e.length}function i(e,t){t.inject.id&&(t.transitionFrom&&e.push({from:t.transitionFrom,to:t.inject.id,condition:t.when}),t.transitionTo&&e.push({from:t.inject.id,to:t.transitionTo,condition:t.when}))}function a(e){let t=new Set,n=[];return e.forEach(e=>{let r=`${e.from}->${e.to}:${e.condition??``}`;t.has(r)||(t.add(r),n.push(e))}),n}function o(e){return JSON.parse(JSON.stringify(e))}export{t as applyWorkflowExtension};
|
package/dist/merger.d.ts
CHANGED
|
@@ -3,5 +3,4 @@ import { WorkflowExtension } from "./types.js";
|
|
|
3
3
|
//#region src/merger.d.ts
|
|
4
4
|
declare function mergeExtensions(extensions: WorkflowExtension[]): WorkflowExtension[];
|
|
5
5
|
//#endregion
|
|
6
|
-
export { mergeExtensions };
|
|
7
|
-
//# sourceMappingURL=merger.d.ts.map
|
|
6
|
+
export { mergeExtensions };
|
package/dist/merger.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
function e(e){return e.sort((e,t)=>(e.priority??0)-(t.priority??0))}export{e as mergeExtensions};
|
|
2
|
-
//# sourceMappingURL=merger.js.map
|
|
1
|
+
function e(e){return e.sort((e,t)=>(e.priority??0)-(t.priority??0))}export{e as mergeExtensions};
|
package/dist/templates.d.ts
CHANGED
|
@@ -11,5 +11,4 @@ interface StepTemplateOptions {
|
|
|
11
11
|
}
|
|
12
12
|
declare function approvalStepTemplate(options: StepTemplateOptions): Step;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { StepTemplateOptions, approvalStepTemplate };
|
|
15
|
-
//# sourceMappingURL=templates.d.ts.map
|
|
14
|
+
export { StepTemplateOptions, approvalStepTemplate };
|
package/dist/templates.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
function e(e){return{id:e.id,label:e.label,type:e.type??`human`,description:e.description??`Tenant-specific approval`,action:e.action,guard:e.guardExpression?{type:`expression`,value:e.guardExpression}:void 0}}export{e as approvalStepTemplate};
|
|
2
|
-
//# sourceMappingURL=templates.js.map
|
|
1
|
+
function e(e){return{id:e.id,label:e.label,type:e.type??`human`,description:e.description??`Tenant-specific approval`,action:e.action,guard:e.guardExpression?{type:`expression`,value:e.guardExpression}:void 0}}export{e as approvalStepTemplate};
|
package/dist/types.d.ts
CHANGED
|
@@ -28,5 +28,4 @@ interface ComposeParams extends WorkflowExtensionScope {
|
|
|
28
28
|
base: WorkflowSpec;
|
|
29
29
|
}
|
|
30
30
|
//#endregion
|
|
31
|
-
export { ComposeParams, StepInjection, WorkflowExtension, WorkflowExtensionScope };
|
|
32
|
-
//# sourceMappingURL=types.d.ts.map
|
|
31
|
+
export { ComposeParams, StepInjection, WorkflowExtension, WorkflowExtensionScope };
|
package/dist/validator.d.ts
CHANGED
|
@@ -8,5 +8,4 @@ interface WorkflowExtensionValidationIssue {
|
|
|
8
8
|
}
|
|
9
9
|
declare function validateExtension(extension: WorkflowExtension, base: WorkflowSpec): void;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { WorkflowExtensionValidationIssue, validateExtension };
|
|
12
|
-
//# sourceMappingURL=validator.d.ts.map
|
|
11
|
+
export { WorkflowExtensionValidationIssue, validateExtension };
|
package/dist/validator.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
function e(e,t){let n=[],r=new Set(t.definition.steps.map(e=>e.id));if(e.customSteps?.forEach((e,t)=>{e.inject.id||n.push({code:`workflow.extension.step.id`,message:`customSteps[${t}] is missing an id`}),!e.after&&!e.before&&n.push({code:`workflow.extension.step.anchor`,message:`customSteps[${t}] must set after or before`}),e.after&&!r.has(e.after)&&n.push({code:`workflow.extension.step.after`,message:`customSteps[${t}] references unknown step "${e.after}"`}),e.before&&!r.has(e.before)&&n.push({code:`workflow.extension.step.before`,message:`customSteps[${t}] references unknown step "${e.before}"`})}),e.hiddenSteps?.forEach(e=>{r.has(e)||n.push({code:`workflow.extension.hidden-step`,message:`hidden step "${e}" does not exist`})}),n.length){let t=n.map(e=>`${e.code}: ${e.message}`).join(`; `);throw Error(`Invalid workflow extension for ${e.workflow}: ${t}`)}}export{e as validateExtension};
|
|
2
|
-
//# sourceMappingURL=validator.js.map
|
|
1
|
+
function e(e,t){let n=[],r=new Set(t.definition.steps.map(e=>e.id));if(e.customSteps?.forEach((e,t)=>{e.inject.id||n.push({code:`workflow.extension.step.id`,message:`customSteps[${t}] is missing an id`}),!e.after&&!e.before&&n.push({code:`workflow.extension.step.anchor`,message:`customSteps[${t}] must set after or before`}),e.after&&!r.has(e.after)&&n.push({code:`workflow.extension.step.after`,message:`customSteps[${t}] references unknown step "${e.after}"`}),e.before&&!r.has(e.before)&&n.push({code:`workflow.extension.step.before`,message:`customSteps[${t}] references unknown step "${e.before}"`})}),e.hiddenSteps?.forEach(e=>{r.has(e)||n.push({code:`workflow.extension.hidden-step`,message:`hidden step "${e}" does not exist`})}),n.length){let t=n.map(e=>`${e.code}: ${e.message}`).join(`; `);throw Error(`Invalid workflow extension for ${e.workflow}: ${t}`)}}export{e as validateExtension};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/lib.workflow-composer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Tenant-aware workflow composition helpers for ContractSpec.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
+
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
14
15
|
"build": "bun build:bundle && bun build:types",
|
|
15
16
|
"build:bundle": "tsdown",
|
|
16
17
|
"build:types": "tsc --noEmit",
|
|
@@ -19,20 +20,22 @@
|
|
|
19
20
|
"lint": "bun lint:fix",
|
|
20
21
|
"lint:fix": "eslint src --fix",
|
|
21
22
|
"lint:check": "eslint src",
|
|
22
|
-
"test": "
|
|
23
|
+
"test": "bun run"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@lssm/lib.contracts": "
|
|
26
|
+
"@lssm/lib.contracts": "1.11.1"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@lssm/tool.tsdown": "
|
|
29
|
-
"@lssm/tool.typescript": "
|
|
29
|
+
"@lssm/tool.tsdown": "0.12.1",
|
|
30
|
+
"@lssm/tool.typescript": "0.11.1",
|
|
30
31
|
"tsdown": "^0.16.6",
|
|
31
|
-
"typescript": "^5.9.3"
|
|
32
|
-
"vitest": "^1.6.0"
|
|
32
|
+
"typescript": "^5.9.3"
|
|
33
33
|
},
|
|
34
34
|
"exports": {
|
|
35
35
|
".": "./dist/index.js",
|
|
36
36
|
"./*": "./*"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
37
40
|
}
|
|
38
41
|
}
|
package/dist/composer.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composer.d.ts","names":[],"sources":["../src/composer.ts"],"sourcesContent":[],"mappings":";;;;cAIa,gBAAA;;EAAA,QAAA,CAAA,SAAA,EAGS,iBAHO,CAAA,EAAA,IAAA;EAGP,YAAA,CAAA,UAAA,EAKK,iBALL,EAAA,CAAA,EAAA,IAAA;EAKK,OAAA,CAAA,MAAA,EAKT,aALS,CAAA,EAKO,YALP"}
|
package/dist/composer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composer.js","names":[],"sources":["../src/composer.ts"],"sourcesContent":["import type { WorkflowSpec } from '@lssm/lib.contracts/workflow/spec';\nimport { applyWorkflowExtension } from './injector';\nimport type { ComposeParams, WorkflowExtension } from './types';\n\nexport class WorkflowComposer {\n private readonly extensions: WorkflowExtension[] = [];\n\n register(extension: WorkflowExtension): this {\n this.extensions.push(extension);\n return this;\n }\n\n registerMany(extensions: WorkflowExtension[]): this {\n extensions.forEach((extension) => this.register(extension));\n return this;\n }\n\n compose(params: ComposeParams): WorkflowSpec {\n const applicable = this.extensions\n .filter((extension) => matches(params, extension))\n .sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));\n\n return applicable.reduce(\n (acc, extension) => applyWorkflowExtension(acc, extension),\n params.base\n );\n }\n}\n\nfunction matches(params: ComposeParams, extension: WorkflowExtension) {\n if (extension.workflow !== params.base.meta.name) return false;\n if (\n extension.baseVersion &&\n extension.baseVersion !== params.base.meta.version\n ) {\n return false;\n }\n if (extension.tenantId && extension.tenantId !== params.tenantId) {\n return false;\n }\n if (extension.role && extension.role !== params.role) {\n return false;\n }\n if (extension.device && extension.device !== params.device) {\n return false;\n }\n return true;\n}\n"],"mappings":"uDAIA,IAAa,EAAb,KAA8B,CAC5B,WAAmD,EAAE,CAErD,SAAS,EAAoC,CAE3C,OADA,KAAK,WAAW,KAAK,EAAU,CACxB,KAGT,aAAa,EAAuC,CAElD,OADA,EAAW,QAAS,GAAc,KAAK,SAAS,EAAU,CAAC,CACpD,KAGT,QAAQ,EAAqC,CAK3C,OAJmB,KAAK,WACrB,OAAQ,GAAc,EAAQ,EAAQ,EAAU,CAAC,CACjD,MAAM,EAAG,KAAO,EAAE,UAAY,IAAM,EAAE,UAAY,GAAG,CAEtC,QACf,EAAK,IAAc,EAAuB,EAAK,EAAU,CAC1D,EAAO,KACR,GAIL,SAAS,EAAQ,EAAuB,EAA8B,CAiBpE,MAHA,EAbI,EAAU,WAAa,EAAO,KAAK,KAAK,MAE1C,EAAU,aACV,EAAU,cAAgB,EAAO,KAAK,KAAK,SAIzC,EAAU,UAAY,EAAU,WAAa,EAAO,UAGpD,EAAU,MAAQ,EAAU,OAAS,EAAO,MAG5C,EAAU,QAAU,EAAU,SAAW,EAAO"}
|
package/dist/injector.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"injector.d.ts","names":[],"sources":["../src/injector.ts"],"sourcesContent":[],"mappings":";;;;iBAIgB,sBAAA,OACR,yBACK,oBACV"}
|
package/dist/injector.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"injector.js","names":["result: typeof transitions"],"sources":["../src/injector.ts"],"sourcesContent":["import type { WorkflowSpec } from '@lssm/lib.contracts/workflow/spec';\nimport type { WorkflowExtension, StepInjection } from './types';\nimport { validateExtension } from './validator';\n\nexport function applyWorkflowExtension(\n base: WorkflowSpec,\n extension: WorkflowExtension\n): WorkflowSpec {\n validateExtension(extension, base);\n const spec = cloneWorkflowSpec(base);\n\n const steps = [...spec.definition.steps];\n let transitions = [...spec.definition.transitions];\n\n const hiddenSet = new Set(extension.hiddenSteps ?? []);\n\n hiddenSet.forEach((stepId) => {\n const idx = steps.findIndex((step) => step.id === stepId);\n if (idx !== -1) {\n steps.splice(idx, 1);\n }\n });\n\n if (hiddenSet.size) {\n transitions = transitions.filter(\n (transition) =>\n !hiddenSet.has(transition.from) && !hiddenSet.has(transition.to)\n );\n }\n\n extension.customSteps?.forEach((injection) => {\n insertStep(steps, injection);\n wireTransitions(transitions, injection);\n });\n\n spec.definition.steps = steps;\n spec.definition.transitions = dedupeTransitions(transitions);\n spec.meta = {\n ...spec.meta,\n version: spec.meta.version,\n };\n return spec;\n}\n\nfunction insertStep(\n steps: WorkflowSpec['definition']['steps'],\n injection: StepInjection\n) {\n const anchorIndex = resolveAnchorIndex(steps, injection);\n if (anchorIndex === -1) {\n throw new Error(`Unable to place injected step \"${injection.inject.id}\"`);\n }\n steps.splice(anchorIndex, 0, { ...injection.inject });\n}\n\nfunction resolveAnchorIndex(\n steps: WorkflowSpec['definition']['steps'],\n injection: StepInjection\n) {\n if (injection.after) {\n const idx = steps.findIndex((step) => step.id === injection.after);\n return idx === -1 ? -1 : idx + 1;\n }\n if (injection.before) {\n const idx = steps.findIndex((step) => step.id === injection.before);\n return idx === -1 ? -1 : idx;\n }\n return steps.length;\n}\n\nfunction wireTransitions(\n transitions: WorkflowSpec['definition']['transitions'],\n injection: StepInjection\n) {\n if (!injection.inject.id) return;\n\n if (injection.transitionFrom) {\n transitions.push({\n from: injection.transitionFrom,\n to: injection.inject.id,\n condition: injection.when,\n });\n }\n\n if (injection.transitionTo) {\n transitions.push({\n from: injection.inject.id,\n to: injection.transitionTo,\n condition: injection.when,\n });\n }\n}\n\nfunction dedupeTransitions(\n transitions: WorkflowSpec['definition']['transitions']\n): WorkflowSpec['definition']['transitions'] {\n const seen = new Set<string>();\n const result: typeof transitions = [];\n transitions.forEach((transition) => {\n const key = `${transition.from}->${transition.to}:${transition.condition ?? ''}`;\n if (seen.has(key)) return;\n seen.add(key);\n result.push(transition);\n });\n return result;\n}\n\nfunction cloneWorkflowSpec(spec: WorkflowSpec): WorkflowSpec {\n return JSON.parse(JSON.stringify(spec));\n}\n"],"mappings":"mDAIA,SAAgB,EACd,EACA,EACc,CACd,EAAkB,EAAW,EAAK,CAClC,IAAM,EAAO,EAAkB,EAAK,CAE9B,EAAQ,CAAC,GAAG,EAAK,WAAW,MAAM,CACpC,EAAc,CAAC,GAAG,EAAK,WAAW,YAAY,CAE5C,EAAY,IAAI,IAAI,EAAU,aAAe,EAAE,CAAC,CA2BtD,OAzBA,EAAU,QAAS,GAAW,CAC5B,IAAM,EAAM,EAAM,UAAW,GAAS,EAAK,KAAO,EAAO,CACrD,IAAQ,IACV,EAAM,OAAO,EAAK,EAAE,EAEtB,CAEE,EAAU,OACZ,EAAc,EAAY,OACvB,GACC,CAAC,EAAU,IAAI,EAAW,KAAK,EAAI,CAAC,EAAU,IAAI,EAAW,GAAG,CACnE,EAGH,EAAU,aAAa,QAAS,GAAc,CAC5C,EAAW,EAAO,EAAU,CAC5B,EAAgB,EAAa,EAAU,EACvC,CAEF,EAAK,WAAW,MAAQ,EACxB,EAAK,WAAW,YAAc,EAAkB,EAAY,CAC5D,EAAK,KAAO,CACV,GAAG,EAAK,KACR,QAAS,EAAK,KAAK,QACpB,CACM,EAGT,SAAS,EACP,EACA,EACA,CACA,IAAM,EAAc,EAAmB,EAAO,EAAU,CACxD,GAAI,IAAgB,GAClB,MAAU,MAAM,kCAAkC,EAAU,OAAO,GAAG,GAAG,CAE3E,EAAM,OAAO,EAAa,EAAG,CAAE,GAAG,EAAU,OAAQ,CAAC,CAGvD,SAAS,EACP,EACA,EACA,CACA,GAAI,EAAU,MAAO,CACnB,IAAM,EAAM,EAAM,UAAW,GAAS,EAAK,KAAO,EAAU,MAAM,CAClE,OAAO,IAAQ,GAAK,GAAK,EAAM,EAEjC,GAAI,EAAU,OAAQ,CACpB,IAAM,EAAM,EAAM,UAAW,GAAS,EAAK,KAAO,EAAU,OAAO,CACnE,OAAO,IAAQ,GAAK,GAAK,EAE3B,OAAO,EAAM,OAGf,SAAS,EACP,EACA,EACA,CACK,EAAU,OAAO,KAElB,EAAU,gBACZ,EAAY,KAAK,CACf,KAAM,EAAU,eAChB,GAAI,EAAU,OAAO,GACrB,UAAW,EAAU,KACtB,CAAC,CAGA,EAAU,cACZ,EAAY,KAAK,CACf,KAAM,EAAU,OAAO,GACvB,GAAI,EAAU,aACd,UAAW,EAAU,KACtB,CAAC,EAIN,SAAS,EACP,EAC2C,CAC3C,IAAM,EAAO,IAAI,IACXA,EAA6B,EAAE,CAOrC,OANA,EAAY,QAAS,GAAe,CAClC,IAAM,EAAM,GAAG,EAAW,KAAK,IAAI,EAAW,GAAG,GAAG,EAAW,WAAa,KACxE,EAAK,IAAI,EAAI,GACjB,EAAK,IAAI,EAAI,CACb,EAAO,KAAK,EAAW,GACvB,CACK,EAGT,SAAS,EAAkB,EAAkC,CAC3D,OAAO,KAAK,MAAM,KAAK,UAAU,EAAK,CAAC"}
|
package/dist/merger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merger.d.ts","names":[],"sources":["../src/merger.ts"],"sourcesContent":[],"mappings":";;;iBAEgB,eAAA,aACF,sBACX"}
|
package/dist/merger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merger.js","names":[],"sources":["../src/merger.ts"],"sourcesContent":["import type { WorkflowExtension } from './types';\n\nexport function mergeExtensions(\n extensions: WorkflowExtension[]\n): WorkflowExtension[] {\n return extensions.sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));\n}\n"],"mappings":"AAEA,SAAgB,EACd,EACqB,CACrB,OAAO,EAAW,MAAM,EAAG,KAAO,EAAE,UAAY,IAAM,EAAE,UAAY,GAAG"}
|
package/dist/templates.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","names":[],"sources":["../src/templates.ts"],"sourcesContent":[],"mappings":";;;UAMiB,mBAAA;;EAAA,KAAA,EAAA,MAAA;EASD,IAAA,CAAA,EANP,QAMO;;WAJL;;;iBAIK,oBAAA,UAA8B,sBAAsB"}
|
package/dist/templates.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","names":[],"sources":["../src/templates.ts"],"sourcesContent":["import type {\n Step,\n StepAction,\n StepType,\n} from '@lssm/lib.contracts/workflow/spec';\n\nexport interface StepTemplateOptions {\n id: string;\n label: string;\n type?: StepType;\n description?: string;\n action?: StepAction;\n guardExpression?: string;\n}\n\nexport function approvalStepTemplate(options: StepTemplateOptions): Step {\n return {\n id: options.id,\n label: options.label,\n type: options.type ?? 'human',\n description: options.description ?? 'Tenant-specific approval',\n action: options.action,\n guard: options.guardExpression\n ? {\n type: 'expression',\n value: options.guardExpression,\n }\n : undefined,\n };\n}\n"],"mappings":"AAeA,SAAgB,EAAqB,EAAoC,CACvE,MAAO,CACL,GAAI,EAAQ,GACZ,MAAO,EAAQ,MACf,KAAM,EAAQ,MAAQ,QACtB,YAAa,EAAQ,aAAe,2BACpC,OAAQ,EAAQ,OAChB,MAAO,EAAQ,gBACX,CACE,KAAM,aACN,MAAO,EAAQ,gBAChB,CACD,IAAA,GACL"}
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;UAEiB,sBAAA;;EAAA,IAAA,CAAA,EAAA,MAAA;EAMA,MAAA,CAAA,EAAA,MAAA;AAUjB;AAIgB,UAdC,aAAA,CAcD;EAEH,EAAA,CAAA,EAAA,MAAA;EACG,KAAA,CAAA,EAAA,MAAA;EAP2B,MAAA,CAAA,EAAA,MAAA;EAAsB,MAAA,EANvD,IAMuD;EAUhD,IAAA,CAAA,EAAA,MAAA;;;;UAVA,iBAAA,SAA0B;;;;gBAI3B;;aAEH;gBACG;;UAGC,aAAA,SAAsB;QAC/B"}
|
package/dist/validator.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","names":[],"sources":["../src/validator.ts"],"sourcesContent":[],"mappings":";;;;UAGiB,gCAAA;;EAAA,OAAA,EAAA,MAAA;AAKjB;iBAAgB,iBAAA,YACH,yBACL"}
|
package/dist/validator.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","names":["issues: WorkflowExtensionValidationIssue[]"],"sources":["../src/validator.ts"],"sourcesContent":["import type { WorkflowSpec } from '@lssm/lib.contracts/workflow/spec';\nimport type { WorkflowExtension } from './types';\n\nexport interface WorkflowExtensionValidationIssue {\n code: string;\n message: string;\n}\n\nexport function validateExtension(\n extension: WorkflowExtension,\n base: WorkflowSpec\n) {\n const issues: WorkflowExtensionValidationIssue[] = [];\n const stepIds = new Set(base.definition.steps.map((step) => step.id));\n\n extension.customSteps?.forEach((injection, idx) => {\n if (!injection.inject.id) {\n issues.push({\n code: 'workflow.extension.step.id',\n message: `customSteps[${idx}] is missing an id`,\n });\n }\n\n if (!injection.after && !injection.before) {\n issues.push({\n code: 'workflow.extension.step.anchor',\n message: `customSteps[${idx}] must set after or before`,\n });\n }\n\n if (injection.after && !stepIds.has(injection.after)) {\n issues.push({\n code: 'workflow.extension.step.after',\n message: `customSteps[${idx}] references unknown step \"${injection.after}\"`,\n });\n }\n\n if (injection.before && !stepIds.has(injection.before)) {\n issues.push({\n code: 'workflow.extension.step.before',\n message: `customSteps[${idx}] references unknown step \"${injection.before}\"`,\n });\n }\n });\n\n extension.hiddenSteps?.forEach((stepId) => {\n if (!stepIds.has(stepId)) {\n issues.push({\n code: 'workflow.extension.hidden-step',\n message: `hidden step \"${stepId}\" does not exist`,\n });\n }\n });\n\n if (issues.length) {\n const reason = issues\n .map((issue) => `${issue.code}: ${issue.message}`)\n .join('; ');\n throw new Error(\n `Invalid workflow extension for ${extension.workflow}: ${reason}`\n );\n }\n}\n"],"mappings":"AAQA,SAAgB,EACd,EACA,EACA,CACA,IAAMA,EAA6C,EAAE,CAC/C,EAAU,IAAI,IAAI,EAAK,WAAW,MAAM,IAAK,GAAS,EAAK,GAAG,CAAC,CAyCrE,GAvCA,EAAU,aAAa,SAAS,EAAW,IAAQ,CAC5C,EAAU,OAAO,IACpB,EAAO,KAAK,CACV,KAAM,6BACN,QAAS,eAAe,EAAI,oBAC7B,CAAC,CAGA,CAAC,EAAU,OAAS,CAAC,EAAU,QACjC,EAAO,KAAK,CACV,KAAM,iCACN,QAAS,eAAe,EAAI,4BAC7B,CAAC,CAGA,EAAU,OAAS,CAAC,EAAQ,IAAI,EAAU,MAAM,EAClD,EAAO,KAAK,CACV,KAAM,gCACN,QAAS,eAAe,EAAI,6BAA6B,EAAU,MAAM,GAC1E,CAAC,CAGA,EAAU,QAAU,CAAC,EAAQ,IAAI,EAAU,OAAO,EACpD,EAAO,KAAK,CACV,KAAM,iCACN,QAAS,eAAe,EAAI,6BAA6B,EAAU,OAAO,GAC3E,CAAC,EAEJ,CAEF,EAAU,aAAa,QAAS,GAAW,CACpC,EAAQ,IAAI,EAAO,EACtB,EAAO,KAAK,CACV,KAAM,iCACN,QAAS,gBAAgB,EAAO,kBACjC,CAAC,EAEJ,CAEE,EAAO,OAAQ,CACjB,IAAM,EAAS,EACZ,IAAK,GAAU,GAAG,EAAM,KAAK,IAAI,EAAM,UAAU,CACjD,KAAK,KAAK,CACb,MAAU,MACR,kCAAkC,EAAU,SAAS,IAAI,IAC1D"}
|