@lssm/example.workflow-system 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217072406
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/dist/approval/approval.contracts.d.ts +134 -134
- package/dist/approval/approval.contracts.js +250 -1
- package/dist/approval/approval.enum.d.ts +3 -3
- package/dist/approval/approval.enum.js +29 -1
- package/dist/approval/approval.event.d.ts +32 -32
- package/dist/approval/approval.event.js +186 -1
- package/dist/approval/approval.handler.js +71 -1
- package/dist/approval/approval.schema.d.ts +24 -24
- package/dist/approval/approval.schema.js +111 -1
- package/dist/approval/index.js +6 -1
- package/dist/docs/index.js +1 -1
- package/dist/docs/workflow-system.docblock.js +61 -5
- package/dist/entities/approval.d.ts +36 -36
- package/dist/entities/approval.js +128 -1
- package/dist/entities/index.d.ts +127 -127
- package/dist/entities/index.js +31 -1
- package/dist/entities/instance.d.ts +47 -47
- package/dist/entities/instance.js +168 -1
- package/dist/entities/step.d.ts +32 -32
- package/dist/entities/step.js +135 -1
- package/dist/entities/workflow.d.ts +23 -23
- package/dist/entities/workflow.js +102 -1
- package/dist/example.js +50 -1
- package/dist/index.js +19 -1
- package/dist/instance/index.js +6 -1
- package/dist/instance/instance.contracts.d.ts +256 -256
- package/dist/instance/instance.contracts.js +334 -1
- package/dist/instance/instance.enum.d.ts +2 -2
- package/dist/instance/instance.enum.js +20 -1
- package/dist/instance/instance.event.d.ts +87 -87
- package/dist/instance/instance.event.js +214 -1
- package/dist/instance/instance.handler.js +93 -1
- package/dist/instance/instance.schema.d.ts +54 -54
- package/dist/instance/instance.schema.js +173 -1
- package/dist/libs/contracts/dist/capabilities/openbanking.js +88 -1
- package/dist/libs/contracts/dist/client/index.js +5 -1
- package/dist/libs/contracts/dist/client/react/feature-render.js +2 -1
- package/dist/libs/contracts/dist/client/react/form-render.js +4 -1
- package/dist/libs/contracts/dist/client/react/index.js +4 -1
- package/dist/libs/contracts/dist/contract-registry/index.js +1 -1
- package/dist/libs/contracts/dist/contract-registry/schemas.js +60 -1
- package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
- package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
- package/dist/libs/contracts/dist/docs/index.js +29 -1
- package/dist/libs/contracts/dist/docs/presentations.js +71 -1
- package/dist/libs/contracts/dist/docs/registry.js +44 -1
- package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
- package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
- package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
- package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
- package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
- package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
- package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
- package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
- package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
- package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
- package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
- package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
- package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
- package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
- package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
- package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
- package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
- package/dist/libs/contracts/dist/events.js +10 -1
- package/dist/libs/contracts/dist/experiments/evaluator.js +1 -1
- package/dist/libs/contracts/dist/index.js +71 -1
- package/dist/libs/contracts/dist/install.js +2 -1
- package/dist/libs/contracts/dist/integrations/contracts.js +377 -1
- package/dist/libs/contracts/dist/integrations/index.js +18 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +242 -1
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +13 -1
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +52 -1
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +75 -1
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +87 -1
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +66 -1
- package/dist/libs/contracts/dist/integrations/providers/index.js +11 -1
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/powens.js +116 -1
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +73 -1
- package/dist/libs/contracts/dist/integrations/providers/registry.js +10 -1
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +83 -1
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +61 -1
- package/dist/libs/contracts/dist/jsonschema.js +1 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js +306 -1
- package/dist/libs/contracts/dist/knowledge/index.js +7 -1
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +6 -1
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +37 -1
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
- package/dist/libs/contracts/dist/llm/exporters.js +19 -1
- package/dist/libs/contracts/dist/llm/index.js +2 -1
- package/dist/libs/contracts/dist/llm/prompts.js +1 -1
- package/dist/libs/contracts/dist/onboarding-base.js +196 -1
- package/dist/libs/contracts/dist/openapi.js +1 -1
- package/dist/libs/contracts/dist/ownership.js +21 -1
- package/dist/libs/contracts/dist/presentations.js +1 -1
- package/dist/libs/contracts/dist/presentations.v2.js +11 -1
- package/dist/libs/contracts/dist/prompt.js +1 -1
- package/dist/libs/contracts/dist/promptRegistry.js +1 -1
- package/dist/libs/contracts/dist/regenerator/index.js +1 -1
- package/dist/libs/contracts/dist/regenerator/service.js +6 -1
- package/dist/libs/contracts/dist/registry.js +2 -1
- package/dist/libs/contracts/dist/resources.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +49 -1
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +39 -1
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/index.js +6 -1
- package/dist/libs/contracts/dist/server/graphql-pothos.js +6 -1
- package/dist/libs/contracts/dist/server/index.js +8 -1
- package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +4 -1
- package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +1 -1
- package/dist/libs/contracts/dist/server/mcp/registerResources.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerTools.js +1 -1
- package/dist/libs/contracts/dist/server/provider-mcp.js +1 -1
- package/dist/libs/contracts/dist/server/rest-elysia.js +1 -1
- package/dist/libs/contracts/dist/server/rest-express.js +1 -1
- package/dist/libs/contracts/dist/server/rest-generic.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-app.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-pages.js +1 -1
- package/dist/libs/contracts/dist/spec.js +34 -1
- package/dist/libs/contracts/dist/telemetry/index.js +1 -1
- package/dist/libs/contracts/dist/telemetry/tracker.js +1 -1
- package/dist/libs/contracts/dist/tests/index.js +1 -1
- package/dist/libs/contracts/dist/tests/runner.js +2 -1
- package/dist/libs/contracts/dist/workflow/index.js +1 -1
- package/dist/libs/contracts/dist/workflow/runner.js +1 -1
- package/dist/libs/schema/dist/EnumType.js +56 -1
- package/dist/libs/schema/dist/FieldType.js +49 -1
- package/dist/libs/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/libs/schema/dist/SchemaModel.js +39 -1
- package/dist/libs/schema/dist/entity/defineEntity.js +236 -1
- package/dist/libs/schema/dist/entity/index.js +2 -1
- package/dist/libs/schema/dist/entity/types.js +1 -1
- package/dist/libs/schema/dist/index.js +6 -1
- package/dist/presentations/index.js +291 -1
- package/dist/shared/index.js +3 -1
- package/dist/shared/mock-data.js +11 -1
- package/dist/state-machine/index.js +157 -1
- package/dist/workflow/index.js +6 -1
- package/dist/workflow/workflow.contracts.d.ts +246 -246
- package/dist/workflow/workflow.contracts.js +239 -1
- package/dist/workflow/workflow.enum.d.ts +5 -5
- package/dist/workflow/workflow.enum.js +47 -1
- package/dist/workflow/workflow.event.d.ts +32 -32
- package/dist/workflow/workflow.event.js +116 -1
- package/dist/workflow/workflow.handler.js +65 -1
- package/dist/workflow/workflow.schema.d.ts +63 -63
- package/dist/workflow/workflow.schema.js +250 -1
- package/dist/workflow-system.feature.js +337 -1
- package/package.json +11 -11
|
@@ -1 +1,239 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { ScalarTypeEnum } from "../libs/schema/dist/ScalarTypeEnum.js";
|
|
2
|
+
import { defineSchemaModel } from "../libs/schema/dist/SchemaModel.js";
|
|
3
|
+
import "../libs/schema/dist/index.js";
|
|
4
|
+
import { WorkflowStatusEnum } from "./workflow.enum.js";
|
|
5
|
+
import { AddStepInputModel, CreateWorkflowInputModel, UpdateWorkflowInputModel, WorkflowDefinitionModel, WorkflowStepModel } from "./workflow.schema.js";
|
|
6
|
+
import { defineCommand, defineQuery } from "../libs/contracts/dist/spec.js";
|
|
7
|
+
|
|
8
|
+
//#region src/workflow/workflow.contracts.ts
|
|
9
|
+
const OWNERS = ["@example.workflow-system"];
|
|
10
|
+
/**
|
|
11
|
+
* Create a new workflow definition.
|
|
12
|
+
*/
|
|
13
|
+
const CreateWorkflowContract = defineCommand({
|
|
14
|
+
meta: {
|
|
15
|
+
name: "workflow.definition.create",
|
|
16
|
+
version: 1,
|
|
17
|
+
stability: "stable",
|
|
18
|
+
owners: [...OWNERS],
|
|
19
|
+
tags: [
|
|
20
|
+
"workflow",
|
|
21
|
+
"definition",
|
|
22
|
+
"create"
|
|
23
|
+
],
|
|
24
|
+
description: "Create a new workflow definition.",
|
|
25
|
+
goal: "Allow users to define new workflow blueprints.",
|
|
26
|
+
context: "Workflow designer, admin panel."
|
|
27
|
+
},
|
|
28
|
+
io: {
|
|
29
|
+
input: CreateWorkflowInputModel,
|
|
30
|
+
output: WorkflowDefinitionModel
|
|
31
|
+
},
|
|
32
|
+
policy: { auth: "user" },
|
|
33
|
+
sideEffects: {
|
|
34
|
+
emits: [{
|
|
35
|
+
name: "workflow.definition.created",
|
|
36
|
+
version: 1,
|
|
37
|
+
when: "Workflow is created",
|
|
38
|
+
payload: WorkflowDefinitionModel
|
|
39
|
+
}],
|
|
40
|
+
audit: ["workflow.definition.created"]
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Update an existing workflow definition.
|
|
45
|
+
*/
|
|
46
|
+
const UpdateWorkflowContract = defineCommand({
|
|
47
|
+
meta: {
|
|
48
|
+
name: "workflow.definition.update",
|
|
49
|
+
version: 1,
|
|
50
|
+
stability: "stable",
|
|
51
|
+
owners: [...OWNERS],
|
|
52
|
+
tags: [
|
|
53
|
+
"workflow",
|
|
54
|
+
"definition",
|
|
55
|
+
"update"
|
|
56
|
+
],
|
|
57
|
+
description: "Update an existing workflow definition.",
|
|
58
|
+
goal: "Allow users to modify workflow blueprints.",
|
|
59
|
+
context: "Workflow designer."
|
|
60
|
+
},
|
|
61
|
+
io: {
|
|
62
|
+
input: UpdateWorkflowInputModel,
|
|
63
|
+
output: WorkflowDefinitionModel
|
|
64
|
+
},
|
|
65
|
+
policy: { auth: "user" },
|
|
66
|
+
sideEffects: {
|
|
67
|
+
emits: [{
|
|
68
|
+
name: "workflow.definition.updated",
|
|
69
|
+
version: 1,
|
|
70
|
+
when: "Workflow is updated",
|
|
71
|
+
payload: WorkflowDefinitionModel
|
|
72
|
+
}],
|
|
73
|
+
audit: ["workflow.definition.updated"]
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* Add a step to a workflow definition.
|
|
78
|
+
*/
|
|
79
|
+
const AddStepContract = defineCommand({
|
|
80
|
+
meta: {
|
|
81
|
+
name: "workflow.step.add",
|
|
82
|
+
version: 1,
|
|
83
|
+
stability: "stable",
|
|
84
|
+
owners: [...OWNERS],
|
|
85
|
+
tags: [
|
|
86
|
+
"workflow",
|
|
87
|
+
"step",
|
|
88
|
+
"add"
|
|
89
|
+
],
|
|
90
|
+
description: "Add a step to a workflow definition.",
|
|
91
|
+
goal: "Build workflow structure step by step.",
|
|
92
|
+
context: "Workflow designer."
|
|
93
|
+
},
|
|
94
|
+
io: {
|
|
95
|
+
input: AddStepInputModel,
|
|
96
|
+
output: WorkflowStepModel
|
|
97
|
+
},
|
|
98
|
+
policy: { auth: "user" },
|
|
99
|
+
sideEffects: {
|
|
100
|
+
emits: [{
|
|
101
|
+
name: "workflow.step.added",
|
|
102
|
+
version: 1,
|
|
103
|
+
when: "Step is added",
|
|
104
|
+
payload: WorkflowStepModel
|
|
105
|
+
}],
|
|
106
|
+
audit: ["workflow.step.added"]
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
/**
|
|
110
|
+
* Publish a workflow definition (make it active).
|
|
111
|
+
*/
|
|
112
|
+
const PublishWorkflowContract = defineCommand({
|
|
113
|
+
meta: {
|
|
114
|
+
name: "workflow.definition.publish",
|
|
115
|
+
version: 1,
|
|
116
|
+
stability: "stable",
|
|
117
|
+
owners: [...OWNERS],
|
|
118
|
+
tags: [
|
|
119
|
+
"workflow",
|
|
120
|
+
"definition",
|
|
121
|
+
"publish"
|
|
122
|
+
],
|
|
123
|
+
description: "Publish a workflow definition to make it available for use.",
|
|
124
|
+
goal: "Activate workflow for production use.",
|
|
125
|
+
context: "Workflow designer, deployment."
|
|
126
|
+
},
|
|
127
|
+
io: {
|
|
128
|
+
input: defineSchemaModel({
|
|
129
|
+
name: "PublishWorkflowInput",
|
|
130
|
+
fields: { workflowId: {
|
|
131
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
132
|
+
isOptional: false
|
|
133
|
+
} }
|
|
134
|
+
}),
|
|
135
|
+
output: WorkflowDefinitionModel
|
|
136
|
+
},
|
|
137
|
+
policy: { auth: "user" },
|
|
138
|
+
sideEffects: {
|
|
139
|
+
emits: [{
|
|
140
|
+
name: "workflow.definition.published",
|
|
141
|
+
version: 1,
|
|
142
|
+
when: "Workflow is published",
|
|
143
|
+
payload: WorkflowDefinitionModel
|
|
144
|
+
}],
|
|
145
|
+
audit: ["workflow.definition.published"]
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
/**
|
|
149
|
+
* List workflow definitions.
|
|
150
|
+
*/
|
|
151
|
+
const ListWorkflowsContract = defineQuery({
|
|
152
|
+
meta: {
|
|
153
|
+
name: "workflow.definition.list",
|
|
154
|
+
version: 1,
|
|
155
|
+
stability: "stable",
|
|
156
|
+
owners: [...OWNERS],
|
|
157
|
+
tags: [
|
|
158
|
+
"workflow",
|
|
159
|
+
"definition",
|
|
160
|
+
"list"
|
|
161
|
+
],
|
|
162
|
+
description: "List workflow definitions with filtering.",
|
|
163
|
+
goal: "Browse and search available workflows.",
|
|
164
|
+
context: "Workflow list, search."
|
|
165
|
+
},
|
|
166
|
+
io: {
|
|
167
|
+
input: defineSchemaModel({
|
|
168
|
+
name: "ListWorkflowsInput",
|
|
169
|
+
fields: {
|
|
170
|
+
status: {
|
|
171
|
+
type: WorkflowStatusEnum,
|
|
172
|
+
isOptional: true
|
|
173
|
+
},
|
|
174
|
+
search: {
|
|
175
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
176
|
+
isOptional: true
|
|
177
|
+
},
|
|
178
|
+
limit: {
|
|
179
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
180
|
+
isOptional: true,
|
|
181
|
+
defaultValue: 20
|
|
182
|
+
},
|
|
183
|
+
offset: {
|
|
184
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
185
|
+
isOptional: true,
|
|
186
|
+
defaultValue: 0
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}),
|
|
190
|
+
output: defineSchemaModel({
|
|
191
|
+
name: "ListWorkflowsOutput",
|
|
192
|
+
fields: {
|
|
193
|
+
workflows: {
|
|
194
|
+
type: WorkflowDefinitionModel,
|
|
195
|
+
isArray: true,
|
|
196
|
+
isOptional: false
|
|
197
|
+
},
|
|
198
|
+
total: {
|
|
199
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
200
|
+
isOptional: false
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
},
|
|
205
|
+
policy: { auth: "user" }
|
|
206
|
+
});
|
|
207
|
+
/**
|
|
208
|
+
* Get a single workflow definition with steps.
|
|
209
|
+
*/
|
|
210
|
+
const GetWorkflowContract = defineQuery({
|
|
211
|
+
meta: {
|
|
212
|
+
name: "workflow.definition.get",
|
|
213
|
+
version: 1,
|
|
214
|
+
stability: "stable",
|
|
215
|
+
owners: [...OWNERS],
|
|
216
|
+
tags: [
|
|
217
|
+
"workflow",
|
|
218
|
+
"definition",
|
|
219
|
+
"get"
|
|
220
|
+
],
|
|
221
|
+
description: "Get a workflow definition with all steps.",
|
|
222
|
+
goal: "View workflow details.",
|
|
223
|
+
context: "Workflow designer, detail view."
|
|
224
|
+
},
|
|
225
|
+
io: {
|
|
226
|
+
input: defineSchemaModel({
|
|
227
|
+
name: "GetWorkflowInput",
|
|
228
|
+
fields: { workflowId: {
|
|
229
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
230
|
+
isOptional: false
|
|
231
|
+
} }
|
|
232
|
+
}),
|
|
233
|
+
output: WorkflowDefinitionModel
|
|
234
|
+
},
|
|
235
|
+
policy: { auth: "user" }
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
//#endregion
|
|
239
|
+
export { AddStepContract, CreateWorkflowContract, GetWorkflowContract, ListWorkflowsContract, PublishWorkflowContract, UpdateWorkflowContract };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _lssm_lib_schema1092 from "@lssm/lib.schema";
|
|
2
2
|
|
|
3
3
|
//#region src/workflow/workflow.enum.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Workflow status enum.
|
|
6
6
|
*/
|
|
7
|
-
declare const WorkflowStatusEnum:
|
|
7
|
+
declare const WorkflowStatusEnum: _lssm_lib_schema1092.EnumType<[string, string, string, string]>;
|
|
8
8
|
/**
|
|
9
9
|
* Trigger type enum.
|
|
10
10
|
*/
|
|
11
|
-
declare const TriggerTypeEnum:
|
|
11
|
+
declare const TriggerTypeEnum: _lssm_lib_schema1092.EnumType<[string, string, string, string]>;
|
|
12
12
|
/**
|
|
13
13
|
* Step type enum.
|
|
14
14
|
*/
|
|
15
|
-
declare const StepTypeEnum:
|
|
15
|
+
declare const StepTypeEnum: _lssm_lib_schema1092.EnumType<[string, string, string, string, string, string, string, string]>;
|
|
16
16
|
/**
|
|
17
17
|
* Approval mode enum.
|
|
18
18
|
*/
|
|
19
|
-
declare const ApprovalModeEnum:
|
|
19
|
+
declare const ApprovalModeEnum: _lssm_lib_schema1092.EnumType<[string, string, string, string]>;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { ApprovalModeEnum, StepTypeEnum, TriggerTypeEnum, WorkflowStatusEnum };
|
|
@@ -1 +1,47 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { defineEnum } from "../libs/schema/dist/EnumType.js";
|
|
2
|
+
import "../libs/schema/dist/index.js";
|
|
3
|
+
|
|
4
|
+
//#region src/workflow/workflow.enum.ts
|
|
5
|
+
/**
|
|
6
|
+
* Workflow status enum.
|
|
7
|
+
*/
|
|
8
|
+
const WorkflowStatusEnum = defineEnum("WorkflowStatus", [
|
|
9
|
+
"DRAFT",
|
|
10
|
+
"ACTIVE",
|
|
11
|
+
"DEPRECATED",
|
|
12
|
+
"ARCHIVED"
|
|
13
|
+
]);
|
|
14
|
+
/**
|
|
15
|
+
* Trigger type enum.
|
|
16
|
+
*/
|
|
17
|
+
const TriggerTypeEnum = defineEnum("WorkflowTriggerType", [
|
|
18
|
+
"MANUAL",
|
|
19
|
+
"EVENT",
|
|
20
|
+
"SCHEDULED",
|
|
21
|
+
"API"
|
|
22
|
+
]);
|
|
23
|
+
/**
|
|
24
|
+
* Step type enum.
|
|
25
|
+
*/
|
|
26
|
+
const StepTypeEnum = defineEnum("StepType", [
|
|
27
|
+
"START",
|
|
28
|
+
"APPROVAL",
|
|
29
|
+
"TASK",
|
|
30
|
+
"CONDITION",
|
|
31
|
+
"PARALLEL",
|
|
32
|
+
"WAIT",
|
|
33
|
+
"ACTION",
|
|
34
|
+
"END"
|
|
35
|
+
]);
|
|
36
|
+
/**
|
|
37
|
+
* Approval mode enum.
|
|
38
|
+
*/
|
|
39
|
+
const ApprovalModeEnum = defineEnum("ApprovalMode", [
|
|
40
|
+
"ANY",
|
|
41
|
+
"ALL",
|
|
42
|
+
"MAJORITY",
|
|
43
|
+
"SEQUENTIAL"
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { ApprovalModeEnum, StepTypeEnum, TriggerTypeEnum, WorkflowStatusEnum };
|
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _lssm_lib_schema1096 from "@lssm/lib.schema";
|
|
2
2
|
import * as _lssm_lib_contracts30 from "@lssm/lib.contracts";
|
|
3
3
|
|
|
4
4
|
//#region src/workflow/workflow.event.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* WorkflowCreatedEvent - A new workflow definition has been created.
|
|
7
7
|
*/
|
|
8
|
-
declare const WorkflowCreatedEvent: _lssm_lib_contracts30.EventSpec<
|
|
8
|
+
declare const WorkflowCreatedEvent: _lssm_lib_contracts30.EventSpec<_lssm_lib_schema1096.SchemaModel<{
|
|
9
9
|
workflowId: {
|
|
10
|
-
type:
|
|
10
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
11
11
|
isOptional: false;
|
|
12
12
|
};
|
|
13
13
|
key: {
|
|
14
|
-
type:
|
|
14
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
15
15
|
isOptional: false;
|
|
16
16
|
};
|
|
17
17
|
name: {
|
|
18
|
-
type:
|
|
18
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
19
19
|
isOptional: false;
|
|
20
20
|
};
|
|
21
21
|
version: {
|
|
22
|
-
type:
|
|
22
|
+
type: _lssm_lib_schema1096.FieldType<number, number>;
|
|
23
23
|
isOptional: false;
|
|
24
24
|
};
|
|
25
25
|
organizationId: {
|
|
26
|
-
type:
|
|
26
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
27
27
|
isOptional: false;
|
|
28
28
|
};
|
|
29
29
|
createdBy: {
|
|
30
|
-
type:
|
|
30
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
31
31
|
isOptional: false;
|
|
32
32
|
};
|
|
33
33
|
timestamp: {
|
|
34
|
-
type:
|
|
34
|
+
type: _lssm_lib_schema1096.FieldType<Date, string>;
|
|
35
35
|
isOptional: false;
|
|
36
36
|
};
|
|
37
37
|
}>>;
|
|
38
38
|
/**
|
|
39
39
|
* WorkflowUpdatedEvent - A workflow definition has been updated.
|
|
40
40
|
*/
|
|
41
|
-
declare const WorkflowUpdatedEvent: _lssm_lib_contracts30.EventSpec<
|
|
41
|
+
declare const WorkflowUpdatedEvent: _lssm_lib_contracts30.EventSpec<_lssm_lib_schema1096.SchemaModel<{
|
|
42
42
|
workflowId: {
|
|
43
|
-
type:
|
|
43
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
44
44
|
isOptional: false;
|
|
45
45
|
};
|
|
46
46
|
key: {
|
|
47
|
-
type:
|
|
47
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
48
48
|
isOptional: false;
|
|
49
49
|
};
|
|
50
50
|
name: {
|
|
51
|
-
type:
|
|
51
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
52
52
|
isOptional: false;
|
|
53
53
|
};
|
|
54
54
|
version: {
|
|
55
|
-
type:
|
|
55
|
+
type: _lssm_lib_schema1096.FieldType<number, number>;
|
|
56
56
|
isOptional: false;
|
|
57
57
|
};
|
|
58
58
|
organizationId: {
|
|
59
|
-
type:
|
|
59
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
60
60
|
isOptional: false;
|
|
61
61
|
};
|
|
62
62
|
createdBy: {
|
|
63
|
-
type:
|
|
63
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
64
64
|
isOptional: false;
|
|
65
65
|
};
|
|
66
66
|
timestamp: {
|
|
67
|
-
type:
|
|
67
|
+
type: _lssm_lib_schema1096.FieldType<Date, string>;
|
|
68
68
|
isOptional: false;
|
|
69
69
|
};
|
|
70
70
|
}>>;
|
|
71
71
|
/**
|
|
72
72
|
* WorkflowPublishedEvent - A workflow definition has been published.
|
|
73
73
|
*/
|
|
74
|
-
declare const WorkflowPublishedEvent: _lssm_lib_contracts30.EventSpec<
|
|
74
|
+
declare const WorkflowPublishedEvent: _lssm_lib_contracts30.EventSpec<_lssm_lib_schema1096.SchemaModel<{
|
|
75
75
|
workflowId: {
|
|
76
|
-
type:
|
|
76
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
77
77
|
isOptional: false;
|
|
78
78
|
};
|
|
79
79
|
key: {
|
|
80
|
-
type:
|
|
80
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
81
81
|
isOptional: false;
|
|
82
82
|
};
|
|
83
83
|
name: {
|
|
84
|
-
type:
|
|
84
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
85
85
|
isOptional: false;
|
|
86
86
|
};
|
|
87
87
|
version: {
|
|
88
|
-
type:
|
|
88
|
+
type: _lssm_lib_schema1096.FieldType<number, number>;
|
|
89
89
|
isOptional: false;
|
|
90
90
|
};
|
|
91
91
|
organizationId: {
|
|
92
|
-
type:
|
|
92
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
93
93
|
isOptional: false;
|
|
94
94
|
};
|
|
95
95
|
createdBy: {
|
|
96
|
-
type:
|
|
96
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
97
97
|
isOptional: false;
|
|
98
98
|
};
|
|
99
99
|
timestamp: {
|
|
100
|
-
type:
|
|
100
|
+
type: _lssm_lib_schema1096.FieldType<Date, string>;
|
|
101
101
|
isOptional: false;
|
|
102
102
|
};
|
|
103
103
|
}>>;
|
|
104
104
|
/**
|
|
105
105
|
* StepAddedEvent - A step has been added to a workflow definition.
|
|
106
106
|
*/
|
|
107
|
-
declare const StepAddedEvent: _lssm_lib_contracts30.EventSpec<
|
|
107
|
+
declare const StepAddedEvent: _lssm_lib_contracts30.EventSpec<_lssm_lib_schema1096.SchemaModel<{
|
|
108
108
|
stepId: {
|
|
109
|
-
type:
|
|
109
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
110
110
|
isOptional: false;
|
|
111
111
|
};
|
|
112
112
|
workflowId: {
|
|
113
|
-
type:
|
|
113
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
114
114
|
isOptional: false;
|
|
115
115
|
};
|
|
116
116
|
stepKey: {
|
|
117
|
-
type:
|
|
117
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
118
118
|
isOptional: false;
|
|
119
119
|
};
|
|
120
120
|
stepType: {
|
|
121
|
-
type:
|
|
121
|
+
type: _lssm_lib_schema1096.FieldType<string, string>;
|
|
122
122
|
isOptional: false;
|
|
123
123
|
};
|
|
124
124
|
position: {
|
|
125
|
-
type:
|
|
125
|
+
type: _lssm_lib_schema1096.FieldType<number, number>;
|
|
126
126
|
isOptional: false;
|
|
127
127
|
};
|
|
128
128
|
timestamp: {
|
|
129
|
-
type:
|
|
129
|
+
type: _lssm_lib_schema1096.FieldType<Date, string>;
|
|
130
130
|
isOptional: false;
|
|
131
131
|
};
|
|
132
132
|
}>>;
|
|
@@ -1 +1,116 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { ScalarTypeEnum } from "../libs/schema/dist/ScalarTypeEnum.js";
|
|
2
|
+
import "../libs/schema/dist/index.js";
|
|
3
|
+
import { defineSchemaModel } from "../libs/contracts/dist/schema/dist/SchemaModel.js";
|
|
4
|
+
import { defineEvent } from "../libs/contracts/dist/events.js";
|
|
5
|
+
import "../libs/contracts/dist/index.js";
|
|
6
|
+
|
|
7
|
+
//#region src/workflow/workflow.event.ts
|
|
8
|
+
/**
|
|
9
|
+
* Payload for workflow definition events.
|
|
10
|
+
*/
|
|
11
|
+
const WorkflowDefinitionPayload = defineSchemaModel({
|
|
12
|
+
name: "WorkflowDefinitionEventPayload",
|
|
13
|
+
description: "Payload for workflow definition events",
|
|
14
|
+
fields: {
|
|
15
|
+
workflowId: {
|
|
16
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
17
|
+
isOptional: false
|
|
18
|
+
},
|
|
19
|
+
key: {
|
|
20
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
21
|
+
isOptional: false
|
|
22
|
+
},
|
|
23
|
+
name: {
|
|
24
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
25
|
+
isOptional: false
|
|
26
|
+
},
|
|
27
|
+
version: {
|
|
28
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
29
|
+
isOptional: false
|
|
30
|
+
},
|
|
31
|
+
organizationId: {
|
|
32
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
33
|
+
isOptional: false
|
|
34
|
+
},
|
|
35
|
+
createdBy: {
|
|
36
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
37
|
+
isOptional: false
|
|
38
|
+
},
|
|
39
|
+
timestamp: {
|
|
40
|
+
type: ScalarTypeEnum.DateTime(),
|
|
41
|
+
isOptional: false
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Payload when a step is added.
|
|
47
|
+
*/
|
|
48
|
+
const StepAddedPayload = defineSchemaModel({
|
|
49
|
+
name: "StepAddedEventPayload",
|
|
50
|
+
description: "Payload when a step is added",
|
|
51
|
+
fields: {
|
|
52
|
+
stepId: {
|
|
53
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
54
|
+
isOptional: false
|
|
55
|
+
},
|
|
56
|
+
workflowId: {
|
|
57
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
58
|
+
isOptional: false
|
|
59
|
+
},
|
|
60
|
+
stepKey: {
|
|
61
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
62
|
+
isOptional: false
|
|
63
|
+
},
|
|
64
|
+
stepType: {
|
|
65
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
66
|
+
isOptional: false
|
|
67
|
+
},
|
|
68
|
+
position: {
|
|
69
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
70
|
+
isOptional: false
|
|
71
|
+
},
|
|
72
|
+
timestamp: {
|
|
73
|
+
type: ScalarTypeEnum.DateTime(),
|
|
74
|
+
isOptional: false
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* WorkflowCreatedEvent - A new workflow definition has been created.
|
|
80
|
+
*/
|
|
81
|
+
const WorkflowCreatedEvent = defineEvent({
|
|
82
|
+
name: "workflow.definition.created",
|
|
83
|
+
version: 1,
|
|
84
|
+
description: "A new workflow definition has been created.",
|
|
85
|
+
payload: WorkflowDefinitionPayload
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* WorkflowUpdatedEvent - A workflow definition has been updated.
|
|
89
|
+
*/
|
|
90
|
+
const WorkflowUpdatedEvent = defineEvent({
|
|
91
|
+
name: "workflow.definition.updated",
|
|
92
|
+
version: 1,
|
|
93
|
+
description: "A workflow definition has been updated.",
|
|
94
|
+
payload: WorkflowDefinitionPayload
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* WorkflowPublishedEvent - A workflow definition has been published.
|
|
98
|
+
*/
|
|
99
|
+
const WorkflowPublishedEvent = defineEvent({
|
|
100
|
+
name: "workflow.definition.published",
|
|
101
|
+
version: 1,
|
|
102
|
+
description: "A workflow definition has been published and is now active.",
|
|
103
|
+
payload: WorkflowDefinitionPayload
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* StepAddedEvent - A step has been added to a workflow definition.
|
|
107
|
+
*/
|
|
108
|
+
const StepAddedEvent = defineEvent({
|
|
109
|
+
name: "workflow.step.added",
|
|
110
|
+
version: 1,
|
|
111
|
+
description: "A step has been added to a workflow definition.",
|
|
112
|
+
payload: StepAddedPayload
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
export { StepAddedEvent, WorkflowCreatedEvent, WorkflowPublishedEvent, WorkflowUpdatedEvent };
|
|
@@ -1 +1,65 @@
|
|
|
1
|
-
import{mockDataStore
|
|
1
|
+
import { mockDataStore } from "../shared/mock-data.js";
|
|
2
|
+
|
|
3
|
+
//#region src/workflow/workflow.handler.ts
|
|
4
|
+
async function handleCreateWorkflow(input, context) {
|
|
5
|
+
const id = `wf_${Date.now()}`;
|
|
6
|
+
const now = /* @__PURE__ */ new Date();
|
|
7
|
+
const workflow = {
|
|
8
|
+
id,
|
|
9
|
+
key: input.key,
|
|
10
|
+
name: input.name,
|
|
11
|
+
description: input.description,
|
|
12
|
+
version: 1,
|
|
13
|
+
status: "DRAFT",
|
|
14
|
+
triggerType: input.triggerType ?? "MANUAL",
|
|
15
|
+
featureFlagKey: input.featureFlagKey,
|
|
16
|
+
organizationId: context.organizationId,
|
|
17
|
+
createdBy: context.userId,
|
|
18
|
+
createdAt: now,
|
|
19
|
+
updatedAt: now
|
|
20
|
+
};
|
|
21
|
+
mockDataStore.workflows.set(id, workflow);
|
|
22
|
+
return workflow;
|
|
23
|
+
}
|
|
24
|
+
async function handleAddStep(input, _context) {
|
|
25
|
+
const id = `step_${Date.now()}`;
|
|
26
|
+
const now = /* @__PURE__ */ new Date();
|
|
27
|
+
const existingSteps = Array.from(mockDataStore.steps.values()).filter((s) => s.workflowDefinitionId === input.workflowId);
|
|
28
|
+
const position = input.position ?? existingSteps.length;
|
|
29
|
+
const step = {
|
|
30
|
+
id,
|
|
31
|
+
workflowDefinitionId: input.workflowId,
|
|
32
|
+
key: input.key,
|
|
33
|
+
name: input.name,
|
|
34
|
+
description: input.description,
|
|
35
|
+
type: input.type,
|
|
36
|
+
position,
|
|
37
|
+
transitions: input.transitions,
|
|
38
|
+
approvalMode: input.approvalMode,
|
|
39
|
+
approverRoles: input.approverRoles ?? [],
|
|
40
|
+
timeoutSeconds: input.timeoutSeconds,
|
|
41
|
+
createdAt: now,
|
|
42
|
+
updatedAt: now
|
|
43
|
+
};
|
|
44
|
+
mockDataStore.steps.set(id, step);
|
|
45
|
+
if (existingSteps.length === 0 || input.type === "START") {
|
|
46
|
+
const workflow = mockDataStore.workflows.get(input.workflowId);
|
|
47
|
+
if (workflow) {
|
|
48
|
+
workflow.initialStepId = id;
|
|
49
|
+
workflow.updatedAt = now;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return step;
|
|
53
|
+
}
|
|
54
|
+
async function handlePublishWorkflow(input, _context) {
|
|
55
|
+
const workflow = mockDataStore.workflows.get(input.workflowId);
|
|
56
|
+
if (!workflow) throw new Error(`Workflow ${input.workflowId} not found`);
|
|
57
|
+
const now = /* @__PURE__ */ new Date();
|
|
58
|
+
workflow.status = "ACTIVE";
|
|
59
|
+
workflow.publishedAt = now;
|
|
60
|
+
workflow.updatedAt = now;
|
|
61
|
+
return workflow;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { handleAddStep, handleCreateWorkflow, handlePublishWorkflow };
|