@contractspec/example.workflow-system 1.44.1 → 1.45.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/dist/approval/approval.enum.d.ts +3 -3
- package/dist/approval/approval.enum.d.ts.map +1 -1
- package/dist/approval/approval.event.d.ts +31 -31
- package/dist/approval/approval.event.js +4 -4
- package/dist/approval/approval.event.js.map +1 -1
- package/dist/approval/approval.operations.d.ts +136 -136
- package/dist/approval/approval.operations.js +8 -8
- package/dist/approval/approval.operations.js.map +1 -1
- package/dist/approval/approval.schema.d.ts +24 -24
- package/dist/entities/approval.d.ts +36 -36
- package/dist/entities/approval.d.ts.map +1 -1
- package/dist/entities/index.d.ts +127 -127
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/instance.d.ts +47 -47
- package/dist/entities/step.d.ts +32 -32
- package/dist/entities/workflow.d.ts +23 -23
- package/dist/entities/workflow.d.ts.map +1 -1
- package/dist/example.d.ts +3 -36
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +16 -11
- package/dist/example.js.map +1 -1
- package/dist/instance/instance.enum.d.ts +2 -2
- package/dist/instance/instance.event.d.ts +87 -87
- package/dist/instance/instance.event.d.ts.map +1 -1
- package/dist/instance/instance.event.js +9 -9
- package/dist/instance/instance.event.js.map +1 -1
- package/dist/instance/instance.operations.d.ts +261 -261
- package/dist/instance/instance.operations.d.ts.map +1 -1
- package/dist/instance/instance.operations.js +15 -15
- package/dist/instance/instance.operations.js.map +1 -1
- package/dist/instance/instance.schema.d.ts +54 -54
- package/dist/presentations/index.js +11 -11
- package/dist/presentations/index.js.map +1 -1
- package/dist/shared/types.d.ts +1 -1
- package/dist/state-machine/index.d.ts +2 -2
- package/dist/state-machine/index.js.map +1 -1
- package/dist/workflow/workflow.enum.d.ts +5 -5
- package/dist/workflow/workflow.event.d.ts +33 -33
- package/dist/workflow/workflow.event.d.ts.map +1 -1
- package/dist/workflow/workflow.event.js +5 -5
- package/dist/workflow/workflow.event.js.map +1 -1
- package/dist/workflow/workflow.handler.js +1 -1
- package/dist/workflow/workflow.handler.js.map +1 -1
- package/dist/workflow/workflow.operations.d.ts +250 -250
- package/dist/workflow/workflow.operations.js +10 -10
- package/dist/workflow/workflow.operations.js.map +1 -1
- package/dist/workflow/workflow.schema.d.ts +63 -63
- package/dist/workflow/workflow.schema.d.ts.map +1 -1
- package/dist/workflow/workflow.schema.js +1 -1
- package/dist/workflow/workflow.schema.js.map +1 -1
- package/dist/workflow-system.feature.js +71 -71
- package/dist/workflow-system.feature.js.map +1 -1
- package/package.json +11 -11
|
@@ -11,7 +11,7 @@ const OWNERS = ["@example.workflow-system"];
|
|
|
11
11
|
const CreateWorkflowContract = defineCommand({
|
|
12
12
|
meta: {
|
|
13
13
|
key: "workflow.definition.create",
|
|
14
|
-
version: 1,
|
|
14
|
+
version: "1.0.0",
|
|
15
15
|
stability: "stable",
|
|
16
16
|
owners: [...OWNERS],
|
|
17
17
|
tags: [
|
|
@@ -31,7 +31,7 @@ const CreateWorkflowContract = defineCommand({
|
|
|
31
31
|
sideEffects: {
|
|
32
32
|
emits: [{
|
|
33
33
|
key: "workflow.definition.created",
|
|
34
|
-
version: 1,
|
|
34
|
+
version: "1.0.0",
|
|
35
35
|
when: "Workflow is created",
|
|
36
36
|
payload: WorkflowDefinitionModel
|
|
37
37
|
}],
|
|
@@ -64,7 +64,7 @@ const CreateWorkflowContract = defineCommand({
|
|
|
64
64
|
const UpdateWorkflowContract = defineCommand({
|
|
65
65
|
meta: {
|
|
66
66
|
key: "workflow.definition.update",
|
|
67
|
-
version: 1,
|
|
67
|
+
version: "1.0.0",
|
|
68
68
|
stability: "stable",
|
|
69
69
|
owners: [...OWNERS],
|
|
70
70
|
tags: [
|
|
@@ -84,7 +84,7 @@ const UpdateWorkflowContract = defineCommand({
|
|
|
84
84
|
sideEffects: {
|
|
85
85
|
emits: [{
|
|
86
86
|
key: "workflow.definition.updated",
|
|
87
|
-
version: 1,
|
|
87
|
+
version: "1.0.0",
|
|
88
88
|
when: "Workflow is updated",
|
|
89
89
|
payload: WorkflowDefinitionModel
|
|
90
90
|
}],
|
|
@@ -116,7 +116,7 @@ const UpdateWorkflowContract = defineCommand({
|
|
|
116
116
|
const AddStepContract = defineCommand({
|
|
117
117
|
meta: {
|
|
118
118
|
key: "workflow.step.add",
|
|
119
|
-
version: 1,
|
|
119
|
+
version: "1.0.0",
|
|
120
120
|
stability: "stable",
|
|
121
121
|
owners: [...OWNERS],
|
|
122
122
|
tags: [
|
|
@@ -136,7 +136,7 @@ const AddStepContract = defineCommand({
|
|
|
136
136
|
sideEffects: {
|
|
137
137
|
emits: [{
|
|
138
138
|
key: "workflow.step.added",
|
|
139
|
-
version: 1,
|
|
139
|
+
version: "1.0.0",
|
|
140
140
|
when: "Step is added",
|
|
141
141
|
payload: WorkflowStepModel
|
|
142
142
|
}],
|
|
@@ -169,7 +169,7 @@ const AddStepContract = defineCommand({
|
|
|
169
169
|
const PublishWorkflowContract = defineCommand({
|
|
170
170
|
meta: {
|
|
171
171
|
key: "workflow.definition.publish",
|
|
172
|
-
version: 1,
|
|
172
|
+
version: "1.0.0",
|
|
173
173
|
stability: "stable",
|
|
174
174
|
owners: [...OWNERS],
|
|
175
175
|
tags: [
|
|
@@ -195,7 +195,7 @@ const PublishWorkflowContract = defineCommand({
|
|
|
195
195
|
sideEffects: {
|
|
196
196
|
emits: [{
|
|
197
197
|
key: "workflow.definition.published",
|
|
198
|
-
version: 1,
|
|
198
|
+
version: "1.0.0",
|
|
199
199
|
when: "Workflow is published",
|
|
200
200
|
payload: WorkflowDefinitionModel
|
|
201
201
|
}],
|
|
@@ -224,7 +224,7 @@ const PublishWorkflowContract = defineCommand({
|
|
|
224
224
|
const ListWorkflowsContract = defineQuery({
|
|
225
225
|
meta: {
|
|
226
226
|
key: "workflow.definition.list",
|
|
227
|
-
version: 1,
|
|
227
|
+
version: "1.0.0",
|
|
228
228
|
stability: "stable",
|
|
229
229
|
owners: [...OWNERS],
|
|
230
230
|
tags: [
|
|
@@ -299,7 +299,7 @@ const ListWorkflowsContract = defineQuery({
|
|
|
299
299
|
const GetWorkflowContract = defineQuery({
|
|
300
300
|
meta: {
|
|
301
301
|
key: "workflow.definition.get",
|
|
302
|
-
version: 1,
|
|
302
|
+
version: "1.0.0",
|
|
303
303
|
stability: "stable",
|
|
304
304
|
owners: [...OWNERS],
|
|
305
305
|
tags: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.operations.js","names":[],"sources":["../../src/workflow/workflow.operations.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { WorkflowStatusEnum } from './workflow.enum';\nimport {\n AddStepInputModel,\n CreateWorkflowInputModel,\n UpdateWorkflowInputModel,\n WorkflowDefinitionModel,\n WorkflowStepModel,\n} from './workflow.schema';\n\nconst OWNERS = ['@example.workflow-system'] as const;\n\n/**\n * Create a new workflow definition.\n */\nexport const CreateWorkflowContract = defineCommand({\n meta: {\n key: 'workflow.definition.create',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'definition', 'create'],\n description: 'Create a new workflow definition.',\n goal: 'Allow users to define new workflow blueprints.',\n context: 'Workflow designer, admin panel.',\n },\n io: {\n input: CreateWorkflowInputModel,\n output: WorkflowDefinitionModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.definition.created',\n version: 1,\n when: 'Workflow is created',\n payload: WorkflowDefinitionModel,\n },\n ],\n audit: ['workflow.definition.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-workflow-happy-path',\n given: ['User is admin'],\n when: ['User creates new workflow definition'],\n then: [\n 'Definition is created',\n 'WorkflowDefinitionCreated event is emitted',\n ],\n },\n ],\n examples: [\n {\n key: 'create-onboarding',\n input: {\n key: 'onboarding-v1',\n name: 'Employee Onboarding',\n version: '1.0.0',\n },\n output: { id: 'def-123', status: 'draft' },\n },\n ],\n },\n});\n\n/**\n * Update an existing workflow definition.\n */\nexport const UpdateWorkflowContract = defineCommand({\n meta: {\n key: 'workflow.definition.update',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'definition', 'update'],\n description: 'Update an existing workflow definition.',\n goal: 'Allow users to modify workflow blueprints.',\n context: 'Workflow designer.',\n },\n io: {\n input: UpdateWorkflowInputModel,\n output: WorkflowDefinitionModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.definition.updated',\n version: 1,\n when: 'Workflow is updated',\n payload: WorkflowDefinitionModel,\n },\n ],\n audit: ['workflow.definition.updated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'update-workflow-happy-path',\n given: ['Workflow definition exists'],\n when: ['User updates definition'],\n then: [\n 'Definition is updated',\n 'WorkflowDefinitionUpdated event is emitted',\n ],\n },\n ],\n examples: [\n {\n key: 'update-name',\n input: { workflowId: 'def-123', name: 'New Employee Onboarding' },\n output: { id: 'def-123', name: 'New Employee Onboarding' },\n },\n ],\n },\n});\n\n/**\n * Add a step to a workflow definition.\n */\nexport const AddStepContract = defineCommand({\n meta: {\n key: 'workflow.step.add',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'step', 'add'],\n description: 'Add a step to a workflow definition.',\n goal: 'Build workflow structure step by step.',\n context: 'Workflow designer.',\n },\n io: {\n input: AddStepInputModel,\n output: WorkflowStepModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.step.added',\n version: 1,\n when: 'Step is added',\n payload: WorkflowStepModel,\n },\n ],\n audit: ['workflow.step.added'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'add-step-happy-path',\n given: ['Workflow definition exists'],\n when: ['User adds a step'],\n then: ['Step is added', 'StepAdded event is emitted'],\n },\n ],\n examples: [\n {\n key: 'add-approval-step',\n input: {\n workflowId: 'def-123',\n stepKey: 'approve-contract',\n type: 'approval',\n },\n output: { id: 'step-456', key: 'approve-contract' },\n },\n ],\n },\n});\n\n/**\n * Publish a workflow definition (make it active).\n */\nexport const PublishWorkflowContract = defineCommand({\n meta: {\n key: 'workflow.definition.publish',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'definition', 'publish'],\n description: 'Publish a workflow definition to make it available for use.',\n goal: 'Activate workflow for production use.',\n context: 'Workflow designer, deployment.',\n },\n io: {\n input: defineSchemaModel({\n name: 'PublishWorkflowInput',\n fields: {\n workflowId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n },\n }),\n output: WorkflowDefinitionModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.definition.published',\n version: 1,\n when: 'Workflow is published',\n payload: WorkflowDefinitionModel,\n },\n ],\n audit: ['workflow.definition.published'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'publish-workflow-happy-path',\n given: ['Workflow definition is valid'],\n when: ['User publishes workflow'],\n then: ['Workflow becomes active', 'WorkflowPublished event is emitted'],\n },\n ],\n examples: [\n {\n key: 'publish-onboarding',\n input: { workflowId: 'def-123' },\n output: { id: 'def-123', status: 'published' },\n },\n ],\n },\n});\n\n/**\n * List workflow definitions.\n */\nexport const ListWorkflowsContract = defineQuery({\n meta: {\n key: 'workflow.definition.list',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'definition', 'list'],\n description: 'List workflow definitions with filtering.',\n goal: 'Browse and search available workflows.',\n context: 'Workflow list, search.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ListWorkflowsInput',\n fields: {\n status: { type: WorkflowStatusEnum, isOptional: true },\n search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n }),\n output: defineSchemaModel({\n name: 'ListWorkflowsOutput',\n fields: {\n workflows: {\n type: WorkflowDefinitionModel,\n isArray: true,\n isOptional: false,\n },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'list-workflows-happy-path',\n given: ['Workflow definitions exist'],\n when: ['User lists workflows'],\n then: ['List of workflows is returned'],\n },\n ],\n examples: [\n {\n key: 'list-all',\n input: { limit: 10 },\n output: { workflows: [], total: 5 },\n },\n ],\n },\n});\n\n/**\n * Get a single workflow definition with steps.\n */\nexport const GetWorkflowContract = defineQuery({\n meta: {\n key: 'workflow.definition.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'definition', 'get'],\n description: 'Get a workflow definition with all steps.',\n goal: 'View workflow details.',\n context: 'Workflow designer, detail view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetWorkflowInput',\n fields: {\n workflowId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n },\n }),\n output: WorkflowDefinitionModel,\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-workflow-happy-path',\n given: ['Workflow definition exists'],\n when: ['User requests workflow details'],\n then: ['Workflow details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-details',\n input: { workflowId: 'def-123' },\n output: { id: 'def-123', name: 'Employee Onboarding' },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAcA,MAAM,SAAS,CAAC,2BAA2B;;;;AAK3C,MAAa,yBAAyB,cAAc;CAClD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAY;GAAc;GAAS;EAC1C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAA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W,CACT;GACE,KAAK;GACL,OAAO,CAAC,6BAA6B;GACrC,MAAM,CAAC,iCAAiC;GACxC,MAAM,CAAC,gCAAgC;GACxC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO,EAAE,YAAY,WAAW;GAChC,QAAQ;IAAE,IAAI;IAAW,MAAM;IAAuB;GACvD,CACF;EACF;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"workflow.operations.js","names":[],"sources":["../../src/workflow/workflow.operations.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { WorkflowStatusEnum } from './workflow.enum';\nimport {\n AddStepInputModel,\n CreateWorkflowInputModel,\n UpdateWorkflowInputModel,\n WorkflowDefinitionModel,\n WorkflowStepModel,\n} from './workflow.schema';\n\nconst OWNERS = ['@example.workflow-system'] as const;\n\n/**\n * Create a new workflow definition.\n */\nexport const CreateWorkflowContract = defineCommand({\n meta: {\n key: 'workflow.definition.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'definition', 'create'],\n description: 'Create a new workflow definition.',\n goal: 'Allow users to define new workflow blueprints.',\n context: 'Workflow designer, admin panel.',\n },\n io: {\n input: CreateWorkflowInputModel,\n output: WorkflowDefinitionModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.definition.created',\n version: '1.0.0',\n when: 'Workflow is created',\n payload: WorkflowDefinitionModel,\n },\n ],\n audit: ['workflow.definition.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-workflow-happy-path',\n given: ['User is admin'],\n when: ['User creates new workflow definition'],\n then: [\n 'Definition is created',\n 'WorkflowDefinitionCreated event is emitted',\n ],\n },\n ],\n examples: [\n {\n key: 'create-onboarding',\n input: {\n key: 'onboarding-v1',\n name: 'Employee Onboarding',\n version: '1.0.0',\n },\n output: { id: 'def-123', status: 'draft' },\n },\n ],\n },\n});\n\n/**\n * Update an existing workflow definition.\n */\nexport const UpdateWorkflowContract = defineCommand({\n meta: {\n key: 'workflow.definition.update',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'definition', 'update'],\n description: 'Update an existing workflow definition.',\n goal: 'Allow users to modify workflow blueprints.',\n context: 'Workflow designer.',\n },\n io: {\n input: UpdateWorkflowInputModel,\n output: WorkflowDefinitionModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.definition.updated',\n version: '1.0.0',\n when: 'Workflow is updated',\n payload: WorkflowDefinitionModel,\n },\n ],\n audit: ['workflow.definition.updated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'update-workflow-happy-path',\n given: ['Workflow definition exists'],\n when: ['User updates definition'],\n then: [\n 'Definition is updated',\n 'WorkflowDefinitionUpdated event is emitted',\n ],\n },\n ],\n examples: [\n {\n key: 'update-name',\n input: { workflowId: 'def-123', name: 'New Employee Onboarding' },\n output: { id: 'def-123', name: 'New Employee Onboarding' },\n },\n ],\n },\n});\n\n/**\n * Add a step to a workflow definition.\n */\nexport const AddStepContract = defineCommand({\n meta: {\n key: 'workflow.step.add',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'step', 'add'],\n description: 'Add a step to a workflow definition.',\n goal: 'Build workflow structure step by step.',\n context: 'Workflow designer.',\n },\n io: {\n input: AddStepInputModel,\n output: WorkflowStepModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.step.added',\n version: '1.0.0',\n when: 'Step is added',\n payload: WorkflowStepModel,\n },\n ],\n audit: ['workflow.step.added'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'add-step-happy-path',\n given: ['Workflow definition exists'],\n when: ['User adds a step'],\n then: ['Step is added', 'StepAdded event is emitted'],\n },\n ],\n examples: [\n {\n key: 'add-approval-step',\n input: {\n workflowId: 'def-123',\n stepKey: 'approve-contract',\n type: 'approval',\n },\n output: { id: 'step-456', key: 'approve-contract' },\n },\n ],\n },\n});\n\n/**\n * Publish a workflow definition (make it active).\n */\nexport const PublishWorkflowContract = defineCommand({\n meta: {\n key: 'workflow.definition.publish',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'definition', 'publish'],\n description: 'Publish a workflow definition to make it available for use.',\n goal: 'Activate workflow for production use.',\n context: 'Workflow designer, deployment.',\n },\n io: {\n input: defineSchemaModel({\n name: 'PublishWorkflowInput',\n fields: {\n workflowId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n },\n }),\n output: WorkflowDefinitionModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.definition.published',\n version: '1.0.0',\n when: 'Workflow is published',\n payload: WorkflowDefinitionModel,\n },\n ],\n audit: ['workflow.definition.published'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'publish-workflow-happy-path',\n given: ['Workflow definition is valid'],\n when: ['User publishes workflow'],\n then: ['Workflow becomes active', 'WorkflowPublished event is emitted'],\n },\n ],\n examples: [\n {\n key: 'publish-onboarding',\n input: { workflowId: 'def-123' },\n output: { id: 'def-123', status: 'published' },\n },\n ],\n },\n});\n\n/**\n * List workflow definitions.\n */\nexport const ListWorkflowsContract = defineQuery({\n meta: {\n key: 'workflow.definition.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'definition', 'list'],\n description: 'List workflow definitions with filtering.',\n goal: 'Browse and search available workflows.',\n context: 'Workflow list, search.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ListWorkflowsInput',\n fields: {\n status: { type: WorkflowStatusEnum, isOptional: true },\n search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n }),\n output: defineSchemaModel({\n name: 'ListWorkflowsOutput',\n fields: {\n workflows: {\n type: WorkflowDefinitionModel,\n isArray: true,\n isOptional: false,\n },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'list-workflows-happy-path',\n given: ['Workflow definitions exist'],\n when: ['User lists workflows'],\n then: ['List of workflows is returned'],\n },\n ],\n examples: [\n {\n key: 'list-all',\n input: { limit: 10 },\n output: { workflows: [], total: 5 },\n },\n ],\n },\n});\n\n/**\n * Get a single workflow definition with steps.\n */\nexport const GetWorkflowContract = defineQuery({\n meta: {\n key: 'workflow.definition.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'definition', 'get'],\n description: 'Get a workflow definition with all steps.',\n goal: 'View workflow details.',\n context: 'Workflow designer, detail view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetWorkflowInput',\n fields: {\n workflowId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n },\n }),\n output: WorkflowDefinitionModel,\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-workflow-happy-path',\n given: ['Workflow definition exists'],\n when: ['User requests workflow details'],\n then: ['Workflow details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-details',\n input: { workflowId: 'def-123' },\n output: { id: 'def-123', name: 'Employee Onboarding' },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAcA,MAAM,SAAS,CAAC,2BAA2B;;;;AAK3C,MAAa,yBAAyB,cAAc;CAClD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAY;GAAc;GAAS;EAC1C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EAAE,MAAM,QAAQ;CACxB,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WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,6BAA6B;GACrC,MAAM,CAAC,iCAAiC;GACxC,MAAM,CAAC,gCAAgC;GACxC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO,EAAE,YAAY,WAAW;GAChC,QAAQ;IAAE,IAAI;IAAW,MAAM;IAAuB;GACvD,CACF;EACF;CACF,CAAC"}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _contractspec_lib_schema0 from "@contractspec/lib.schema";
|
|
2
2
|
|
|
3
3
|
//#region src/workflow/workflow.schema.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* A step in a workflow definition.
|
|
6
6
|
*/
|
|
7
|
-
declare const WorkflowStepModel:
|
|
7
|
+
declare const WorkflowStepModel: _contractspec_lib_schema0.SchemaModel<{
|
|
8
8
|
id: {
|
|
9
|
-
type:
|
|
9
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
10
10
|
isOptional: false;
|
|
11
11
|
};
|
|
12
12
|
key: {
|
|
13
|
-
type:
|
|
13
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
14
14
|
isOptional: false;
|
|
15
15
|
};
|
|
16
16
|
name: {
|
|
17
|
-
type:
|
|
17
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
18
18
|
isOptional: false;
|
|
19
19
|
};
|
|
20
20
|
description: {
|
|
21
|
-
type:
|
|
21
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
22
22
|
isOptional: true;
|
|
23
23
|
};
|
|
24
24
|
type: {
|
|
25
|
-
type:
|
|
25
|
+
type: _contractspec_lib_schema0.EnumType<[string, string, string, string, string, string, string, string]>;
|
|
26
26
|
isOptional: false;
|
|
27
27
|
};
|
|
28
28
|
position: {
|
|
29
|
-
type:
|
|
29
|
+
type: _contractspec_lib_schema0.FieldType<number, number>;
|
|
30
30
|
isOptional: false;
|
|
31
31
|
};
|
|
32
32
|
transitions: {
|
|
33
|
-
type:
|
|
33
|
+
type: _contractspec_lib_schema0.FieldType<unknown, unknown>;
|
|
34
34
|
isOptional: false;
|
|
35
35
|
};
|
|
36
36
|
approvalMode: {
|
|
37
|
-
type:
|
|
37
|
+
type: _contractspec_lib_schema0.EnumType<[string, string, string, string]>;
|
|
38
38
|
isOptional: true;
|
|
39
39
|
};
|
|
40
40
|
approverRoles: {
|
|
41
|
-
type:
|
|
41
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
42
42
|
isArray: true;
|
|
43
43
|
isOptional: true;
|
|
44
44
|
};
|
|
@@ -46,91 +46,91 @@ declare const WorkflowStepModel: _contractspec_lib_schema843.SchemaModel<{
|
|
|
46
46
|
/**
|
|
47
47
|
* A workflow definition.
|
|
48
48
|
*/
|
|
49
|
-
declare const WorkflowDefinitionModel:
|
|
49
|
+
declare const WorkflowDefinitionModel: _contractspec_lib_schema0.SchemaModel<{
|
|
50
50
|
id: {
|
|
51
|
-
type:
|
|
51
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
52
52
|
isOptional: false;
|
|
53
53
|
};
|
|
54
54
|
name: {
|
|
55
|
-
type:
|
|
55
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
56
56
|
isOptional: false;
|
|
57
57
|
};
|
|
58
58
|
key: {
|
|
59
|
-
type:
|
|
59
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
60
60
|
isOptional: false;
|
|
61
61
|
};
|
|
62
62
|
description: {
|
|
63
|
-
type:
|
|
63
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
64
64
|
isOptional: true;
|
|
65
65
|
};
|
|
66
66
|
version: {
|
|
67
|
-
type:
|
|
67
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
68
68
|
isOptional: false;
|
|
69
69
|
};
|
|
70
70
|
status: {
|
|
71
|
-
type:
|
|
71
|
+
type: _contractspec_lib_schema0.EnumType<[string, string, string, string]>;
|
|
72
72
|
isOptional: false;
|
|
73
73
|
};
|
|
74
74
|
triggerType: {
|
|
75
|
-
type:
|
|
75
|
+
type: _contractspec_lib_schema0.EnumType<[string, string, string, string]>;
|
|
76
76
|
isOptional: false;
|
|
77
77
|
};
|
|
78
78
|
initialStepId: {
|
|
79
|
-
type:
|
|
79
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
80
80
|
isOptional: true;
|
|
81
81
|
};
|
|
82
82
|
featureFlagKey: {
|
|
83
|
-
type:
|
|
83
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
84
84
|
isOptional: true;
|
|
85
85
|
};
|
|
86
86
|
organizationId: {
|
|
87
|
-
type:
|
|
87
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
88
88
|
isOptional: false;
|
|
89
89
|
};
|
|
90
90
|
createdAt: {
|
|
91
|
-
type:
|
|
91
|
+
type: _contractspec_lib_schema0.FieldType<Date, string>;
|
|
92
92
|
isOptional: false;
|
|
93
93
|
};
|
|
94
94
|
updatedAt: {
|
|
95
|
-
type:
|
|
95
|
+
type: _contractspec_lib_schema0.FieldType<Date, string>;
|
|
96
96
|
isOptional: false;
|
|
97
97
|
};
|
|
98
98
|
steps: {
|
|
99
|
-
type:
|
|
99
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
100
100
|
id: {
|
|
101
|
-
type:
|
|
101
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
102
102
|
isOptional: false;
|
|
103
103
|
};
|
|
104
104
|
key: {
|
|
105
|
-
type:
|
|
105
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
106
106
|
isOptional: false;
|
|
107
107
|
};
|
|
108
108
|
name: {
|
|
109
|
-
type:
|
|
109
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
110
110
|
isOptional: false;
|
|
111
111
|
};
|
|
112
112
|
description: {
|
|
113
|
-
type:
|
|
113
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
114
114
|
isOptional: true;
|
|
115
115
|
};
|
|
116
116
|
type: {
|
|
117
|
-
type:
|
|
117
|
+
type: _contractspec_lib_schema0.EnumType<[string, string, string, string, string, string, string, string]>;
|
|
118
118
|
isOptional: false;
|
|
119
119
|
};
|
|
120
120
|
position: {
|
|
121
|
-
type:
|
|
121
|
+
type: _contractspec_lib_schema0.FieldType<number, number>;
|
|
122
122
|
isOptional: false;
|
|
123
123
|
};
|
|
124
124
|
transitions: {
|
|
125
|
-
type:
|
|
125
|
+
type: _contractspec_lib_schema0.FieldType<unknown, unknown>;
|
|
126
126
|
isOptional: false;
|
|
127
127
|
};
|
|
128
128
|
approvalMode: {
|
|
129
|
-
type:
|
|
129
|
+
type: _contractspec_lib_schema0.EnumType<[string, string, string, string]>;
|
|
130
130
|
isOptional: true;
|
|
131
131
|
};
|
|
132
132
|
approverRoles: {
|
|
133
|
-
type:
|
|
133
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
134
134
|
isArray: true;
|
|
135
135
|
isOptional: true;
|
|
136
136
|
};
|
|
@@ -142,121 +142,121 @@ declare const WorkflowDefinitionModel: _contractspec_lib_schema843.SchemaModel<{
|
|
|
142
142
|
/**
|
|
143
143
|
* Input for creating a workflow definition.
|
|
144
144
|
*/
|
|
145
|
-
declare const CreateWorkflowInputModel:
|
|
145
|
+
declare const CreateWorkflowInputModel: _contractspec_lib_schema0.SchemaModel<{
|
|
146
146
|
name: {
|
|
147
|
-
type:
|
|
147
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
148
148
|
isOptional: false;
|
|
149
149
|
};
|
|
150
150
|
key: {
|
|
151
|
-
type:
|
|
151
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
152
152
|
isOptional: false;
|
|
153
153
|
};
|
|
154
154
|
description: {
|
|
155
|
-
type:
|
|
155
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
156
156
|
isOptional: true;
|
|
157
157
|
};
|
|
158
158
|
triggerType: {
|
|
159
|
-
type:
|
|
159
|
+
type: _contractspec_lib_schema0.EnumType<[string, string, string, string]>;
|
|
160
160
|
isOptional: true;
|
|
161
161
|
};
|
|
162
162
|
triggerConfig: {
|
|
163
|
-
type:
|
|
163
|
+
type: _contractspec_lib_schema0.FieldType<unknown, unknown>;
|
|
164
164
|
isOptional: true;
|
|
165
165
|
};
|
|
166
166
|
featureFlagKey: {
|
|
167
|
-
type:
|
|
167
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
168
168
|
isOptional: true;
|
|
169
169
|
};
|
|
170
170
|
settings: {
|
|
171
|
-
type:
|
|
171
|
+
type: _contractspec_lib_schema0.FieldType<unknown, unknown>;
|
|
172
172
|
isOptional: true;
|
|
173
173
|
};
|
|
174
174
|
}>;
|
|
175
175
|
/**
|
|
176
176
|
* Input for updating a workflow definition.
|
|
177
177
|
*/
|
|
178
|
-
declare const UpdateWorkflowInputModel:
|
|
178
|
+
declare const UpdateWorkflowInputModel: _contractspec_lib_schema0.SchemaModel<{
|
|
179
179
|
workflowId: {
|
|
180
|
-
type:
|
|
180
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
181
181
|
isOptional: false;
|
|
182
182
|
};
|
|
183
183
|
name: {
|
|
184
|
-
type:
|
|
184
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
185
185
|
isOptional: true;
|
|
186
186
|
};
|
|
187
187
|
description: {
|
|
188
|
-
type:
|
|
188
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
189
189
|
isOptional: true;
|
|
190
190
|
};
|
|
191
191
|
triggerType: {
|
|
192
|
-
type:
|
|
192
|
+
type: _contractspec_lib_schema0.EnumType<[string, string, string, string]>;
|
|
193
193
|
isOptional: true;
|
|
194
194
|
};
|
|
195
195
|
triggerConfig: {
|
|
196
|
-
type:
|
|
196
|
+
type: _contractspec_lib_schema0.FieldType<unknown, unknown>;
|
|
197
197
|
isOptional: true;
|
|
198
198
|
};
|
|
199
199
|
featureFlagKey: {
|
|
200
|
-
type:
|
|
200
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
201
201
|
isOptional: true;
|
|
202
202
|
};
|
|
203
203
|
settings: {
|
|
204
|
-
type:
|
|
204
|
+
type: _contractspec_lib_schema0.FieldType<unknown, unknown>;
|
|
205
205
|
isOptional: true;
|
|
206
206
|
};
|
|
207
207
|
}>;
|
|
208
208
|
/**
|
|
209
209
|
* Input for adding a step to a workflow.
|
|
210
210
|
*/
|
|
211
|
-
declare const AddStepInputModel:
|
|
211
|
+
declare const AddStepInputModel: _contractspec_lib_schema0.SchemaModel<{
|
|
212
212
|
workflowId: {
|
|
213
|
-
type:
|
|
213
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
214
214
|
isOptional: false;
|
|
215
215
|
};
|
|
216
216
|
key: {
|
|
217
|
-
type:
|
|
217
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
218
218
|
isOptional: false;
|
|
219
219
|
};
|
|
220
220
|
name: {
|
|
221
|
-
type:
|
|
221
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
222
222
|
isOptional: false;
|
|
223
223
|
};
|
|
224
224
|
description: {
|
|
225
|
-
type:
|
|
225
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
226
226
|
isOptional: true;
|
|
227
227
|
};
|
|
228
228
|
type: {
|
|
229
|
-
type:
|
|
229
|
+
type: _contractspec_lib_schema0.EnumType<[string, string, string, string, string, string, string, string]>;
|
|
230
230
|
isOptional: false;
|
|
231
231
|
};
|
|
232
232
|
position: {
|
|
233
|
-
type:
|
|
233
|
+
type: _contractspec_lib_schema0.FieldType<number, number>;
|
|
234
234
|
isOptional: true;
|
|
235
235
|
};
|
|
236
236
|
transitions: {
|
|
237
|
-
type:
|
|
237
|
+
type: _contractspec_lib_schema0.FieldType<unknown, unknown>;
|
|
238
238
|
isOptional: false;
|
|
239
239
|
};
|
|
240
240
|
approvalMode: {
|
|
241
|
-
type:
|
|
241
|
+
type: _contractspec_lib_schema0.EnumType<[string, string, string, string]>;
|
|
242
242
|
isOptional: true;
|
|
243
243
|
};
|
|
244
244
|
approverRoles: {
|
|
245
|
-
type:
|
|
245
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
246
246
|
isArray: true;
|
|
247
247
|
isOptional: true;
|
|
248
248
|
};
|
|
249
249
|
approverUserIds: {
|
|
250
|
-
type:
|
|
250
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
251
251
|
isArray: true;
|
|
252
252
|
isOptional: true;
|
|
253
253
|
};
|
|
254
254
|
timeoutSeconds: {
|
|
255
|
-
type:
|
|
255
|
+
type: _contractspec_lib_schema0.FieldType<number, number>;
|
|
256
256
|
isOptional: true;
|
|
257
257
|
};
|
|
258
258
|
slaSeconds: {
|
|
259
|
-
type:
|
|
259
|
+
type: _contractspec_lib_schema0.FieldType<number, number>;
|
|
260
260
|
isOptional: true;
|
|
261
261
|
};
|
|
262
262
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.schema.d.ts","names":[],"sources":["../../src/workflow/workflow.schema.ts"],"sourcesContent":[],"mappings":";;;;;;AAWa,cAAA,iBAkBX,
|
|
1
|
+
{"version":3,"file":"workflow.schema.d.ts","names":[],"sources":["../../src/workflow/workflow.schema.ts"],"sourcesContent":[],"mappings":";;;;;;AAWa,cAAA,iBAkBX,4BAlB4B,WAkB5B,CAAA;EAAA,EAAA,EAAA;UAAA,yBAAA,CAAA;;;;;;;;6CAlB4B,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAuBjB,CAAA;EA2BX,WAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;CA3BkC,CAAA;AAgCpC;;;cAhCa,mDAAuB;;UA2BlC,yBAAA,CAAA;;;;IAKmC,IAAA,qCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAoBxB,UAAA,EAAA,KAAA;EAkBX,CAAA;;;;;;;;EAlBmC,CAAA;EAuBxB,OAAA,EAAA;IA4BX,IAAA,qCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;;;;;6CA5B4B,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA3CjB,oDAAwB;;UAenC,yBAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,oDAAwB;;UAkBnC,yBAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,6CAAiB;;UA4B5B,yBAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.schema.js","names":[],"sources":["../../src/workflow/workflow.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport {\n WorkflowStatusEnum,\n TriggerTypeEnum,\n StepTypeEnum,\n ApprovalModeEnum,\n} from './workflow.enum';\n\n/**\n * A step in a workflow definition.\n */\nexport const WorkflowStepModel = defineSchemaModel({\n name: 'WorkflowStepModel',\n description: 'A step in a workflow definition',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n type: { type: StepTypeEnum, isOptional: false },\n position: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n transitions: { type: ScalarTypeEnum.JSON(), isOptional: false },\n approvalMode: { type: ApprovalModeEnum, isOptional: true },\n approverRoles: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n },\n});\n\n/**\n * A workflow definition.\n */\nexport const WorkflowDefinitionModel = defineSchemaModel({\n name: 'WorkflowDefinitionModel',\n description: 'A workflow definition',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n version: { type: ScalarTypeEnum.
|
|
1
|
+
{"version":3,"file":"workflow.schema.js","names":[],"sources":["../../src/workflow/workflow.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport {\n WorkflowStatusEnum,\n TriggerTypeEnum,\n StepTypeEnum,\n ApprovalModeEnum,\n} from './workflow.enum';\n\n/**\n * A step in a workflow definition.\n */\nexport const WorkflowStepModel = defineSchemaModel({\n name: 'WorkflowStepModel',\n description: 'A step in a workflow definition',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n type: { type: StepTypeEnum, isOptional: false },\n position: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n transitions: { type: ScalarTypeEnum.JSON(), isOptional: false },\n approvalMode: { type: ApprovalModeEnum, isOptional: true },\n approverRoles: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n },\n});\n\n/**\n * A workflow definition.\n */\nexport const WorkflowDefinitionModel = defineSchemaModel({\n name: 'WorkflowDefinitionModel',\n description: 'A workflow definition',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n version: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: WorkflowStatusEnum, isOptional: false },\n triggerType: { type: TriggerTypeEnum, isOptional: false },\n initialStepId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n featureFlagKey: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n steps: { type: WorkflowStepModel, isArray: true, isOptional: true },\n },\n});\n\n/**\n * Input for creating a workflow definition.\n */\nexport const CreateWorkflowInputModel = defineSchemaModel({\n name: 'CreateWorkflowInput',\n description: 'Input for creating a workflow definition',\n fields: {\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n key: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n triggerType: { type: TriggerTypeEnum, isOptional: true },\n triggerConfig: { type: ScalarTypeEnum.JSON(), isOptional: true },\n featureFlagKey: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n settings: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\n/**\n * Input for updating a workflow definition.\n */\nexport const UpdateWorkflowInputModel = defineSchemaModel({\n name: 'UpdateWorkflowInput',\n description: 'Input for updating a workflow definition',\n fields: {\n workflowId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n triggerType: { type: TriggerTypeEnum, isOptional: true },\n triggerConfig: { type: ScalarTypeEnum.JSON(), isOptional: true },\n featureFlagKey: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n settings: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\n/**\n * Input for adding a step to a workflow.\n */\nexport const AddStepInputModel = defineSchemaModel({\n name: 'AddStepInput',\n description: 'Input for adding a step to a workflow',\n fields: {\n workflowId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n key: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n type: { type: StepTypeEnum, isOptional: false },\n position: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n transitions: { type: ScalarTypeEnum.JSON(), isOptional: false },\n approvalMode: { type: ApprovalModeEnum, isOptional: true },\n approverRoles: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n approverUserIds: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n timeoutSeconds: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n slaSeconds: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n});\n"],"mappings":";;;;;;;AAWA,MAAa,oBAAoB,kBAAkB;CACjD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAClE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE,MAAM;GAAE,MAAM;GAAc,YAAY;GAAO;EAC/C,UAAU;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACpE,aAAa;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAO;EAC/D,cAAc;GAAE,MAAM;GAAkB,YAAY;GAAM;EAC1D,eAAe;GACb,MAAM,eAAe,iBAAiB;GACtC,SAAS;GACT,YAAY;GACb;EACF;CACF,CAAC;;;;AAKF,MAAa,0BAA0B,kBAAkB;CACvD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,MAAM;GAAE,MAA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