@contractspec/example.workflow-system 1.44.0 → 1.45.0
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.event.js +4 -4
- package/dist/approval/approval.event.js.map +1 -1
- package/dist/approval/approval.operations.d.ts +3 -3
- package/dist/approval/approval.operations.js +8 -8
- package/dist/approval/approval.operations.js.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.event.d.ts +86 -86
- package/dist/instance/instance.event.js +9 -9
- package/dist/instance/instance.event.js.map +1 -1
- package/dist/instance/instance.operations.d.ts +260 -260
- 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.event.d.ts +3 -3
- 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 +12 -12
- package/dist/workflow/workflow.operations.js +10 -10
- package/dist/workflow/workflow.operations.js.map +1 -1
- package/dist/workflow/workflow.schema.d.ts +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
|
@@ -148,7 +148,7 @@ const ApprovalEscalatedPayload = defineSchemaModel$1({
|
|
|
148
148
|
const ApprovalRequestedEvent = defineEvent({
|
|
149
149
|
meta: {
|
|
150
150
|
key: "workflow.approval.requested",
|
|
151
|
-
version: 1,
|
|
151
|
+
version: "1.0.0",
|
|
152
152
|
description: "An approval has been requested.",
|
|
153
153
|
stability: "stable",
|
|
154
154
|
owners: ["@workflow-team"],
|
|
@@ -166,7 +166,7 @@ const ApprovalRequestedEvent = defineEvent({
|
|
|
166
166
|
const ApprovalDecidedEvent = defineEvent({
|
|
167
167
|
meta: {
|
|
168
168
|
key: "workflow.approval.decided",
|
|
169
|
-
version: 1,
|
|
169
|
+
version: "1.0.0",
|
|
170
170
|
description: "An approval decision has been made.",
|
|
171
171
|
stability: "stable",
|
|
172
172
|
owners: ["@workflow-team"],
|
|
@@ -184,7 +184,7 @@ const ApprovalDecidedEvent = defineEvent({
|
|
|
184
184
|
const ApprovalDelegatedEvent = defineEvent({
|
|
185
185
|
meta: {
|
|
186
186
|
key: "workflow.approval.delegated",
|
|
187
|
-
version: 1,
|
|
187
|
+
version: "1.0.0",
|
|
188
188
|
description: "An approval has been delegated.",
|
|
189
189
|
stability: "stable",
|
|
190
190
|
owners: ["@workflow-team"],
|
|
@@ -202,7 +202,7 @@ const ApprovalDelegatedEvent = defineEvent({
|
|
|
202
202
|
const ApprovalEscalatedEvent = defineEvent({
|
|
203
203
|
meta: {
|
|
204
204
|
key: "workflow.approval.escalated",
|
|
205
|
-
version: 1,
|
|
205
|
+
version: "1.0.0",
|
|
206
206
|
description: "An approval has been escalated.",
|
|
207
207
|
stability: "stable",
|
|
208
208
|
owners: ["@workflow-team"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval.event.js","names":["defineSchemaModel"],"sources":["../../src/approval/approval.event.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum } from '@contractspec/lib.schema';\n\n/**\n * Payload when approval is requested.\n */\nconst ApprovalRequestedPayload = defineSchemaModel({\n name: 'ApprovalRequestedEventPayload',\n description: 'Payload when approval is requested',\n fields: {\n requestId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n workflowKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n approverId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n approverRole: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n dueAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Payload when approval decision is made.\n */\nconst ApprovalDecidedPayload = defineSchemaModel({\n name: 'ApprovalDecidedEventPayload',\n description: 'Payload when approval decision is made',\n fields: {\n requestId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n decision: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n decidedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n comment: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Payload when approval is delegated.\n */\nconst ApprovalDelegatedPayload = defineSchemaModel({\n name: 'ApprovalDelegatedEventPayload',\n description: 'Payload when approval is delegated',\n fields: {\n requestId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fromUserId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toUserId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Payload when approval is escalated.\n */\nconst ApprovalEscalatedPayload = defineSchemaModel({\n name: 'ApprovalEscalatedEventPayload',\n description: 'Payload when approval is escalated',\n fields: {\n requestId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n escalationLevel: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n escalatedTo: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ApprovalRequestedEvent - An approval has been requested.\n */\nexport const ApprovalRequestedEvent = defineEvent({\n meta: {\n key: 'workflow.approval.requested',\n version: 1,\n description: 'An approval has been requested.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'requested'],\n },\n payload: ApprovalRequestedPayload,\n});\n\n/**\n * ApprovalDecidedEvent - An approval decision has been made.\n */\nexport const ApprovalDecidedEvent = defineEvent({\n meta: {\n key: 'workflow.approval.decided',\n version: 1,\n description: 'An approval decision has been made.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'decided'],\n },\n payload: ApprovalDecidedPayload,\n});\n\n/**\n * ApprovalDelegatedEvent - An approval has been delegated.\n */\nexport const ApprovalDelegatedEvent = defineEvent({\n meta: {\n key: 'workflow.approval.delegated',\n version: 1,\n description: 'An approval has been delegated.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'delegated'],\n },\n payload: ApprovalDelegatedPayload,\n});\n\n/**\n * ApprovalEscalatedEvent - An approval has been escalated.\n */\nexport const ApprovalEscalatedEvent = defineEvent({\n meta: {\n key: 'workflow.approval.escalated',\n version: 1,\n description: 'An approval has been escalated.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'escalated'],\n },\n payload: ApprovalEscalatedPayload,\n});\n"],"mappings":";;;;;;;AAMA,MAAM,2BAA2BA,oBAAkB;CACjD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,YAAY;GAAE,MAAM,eAAe,iBAAiB;G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A2BA,oBAAkB;CACjD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE,iBAAiB;GACf,MAAM,eAAe,cAAc;GACnC,YAAY;GACb;EACD,aAAa;GACX,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAY;GAAY;EAC5C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAY;GAAU;EAC1C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAY;GAAY;EAC5C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAY;GAAY;EAC5C;CACD,SAAS;CACV,CAAC"}
|
|
1
|
+
{"version":3,"file":"approval.event.js","names":["defineSchemaModel"],"sources":["../../src/approval/approval.event.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum } from '@contractspec/lib.schema';\n\n/**\n * Payload when approval is requested.\n */\nconst ApprovalRequestedPayload = defineSchemaModel({\n name: 'ApprovalRequestedEventPayload',\n description: 'Payload when approval is requested',\n fields: {\n requestId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n workflowKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n approverId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n approverRole: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n dueAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Payload when approval decision is made.\n */\nconst ApprovalDecidedPayload = defineSchemaModel({\n name: 'ApprovalDecidedEventPayload',\n description: 'Payload when approval decision is made',\n fields: {\n requestId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n decision: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n decidedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n comment: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Payload when approval is delegated.\n */\nconst ApprovalDelegatedPayload = defineSchemaModel({\n name: 'ApprovalDelegatedEventPayload',\n description: 'Payload when approval is delegated',\n fields: {\n requestId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fromUserId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toUserId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Payload when approval is escalated.\n */\nconst ApprovalEscalatedPayload = defineSchemaModel({\n name: 'ApprovalEscalatedEventPayload',\n description: 'Payload when approval is escalated',\n fields: {\n requestId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n escalationLevel: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n escalatedTo: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ApprovalRequestedEvent - An approval has been requested.\n */\nexport const ApprovalRequestedEvent = defineEvent({\n meta: {\n key: 'workflow.approval.requested',\n version: '1.0.0',\n description: 'An approval has been requested.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'requested'],\n },\n payload: ApprovalRequestedPayload,\n});\n\n/**\n * ApprovalDecidedEvent - An approval decision has been made.\n */\nexport const ApprovalDecidedEvent = defineEvent({\n meta: {\n key: 'workflow.approval.decided',\n version: '1.0.0',\n description: 'An approval decision has been made.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'decided'],\n },\n payload: ApprovalDecidedPayload,\n});\n\n/**\n * ApprovalDelegatedEvent - An approval has been delegated.\n */\nexport const ApprovalDelegatedEvent = defineEvent({\n meta: {\n key: 'workflow.approval.delegated',\n version: '1.0.0',\n description: 'An approval has been delegated.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'delegated'],\n },\n payload: ApprovalDelegatedPayload,\n});\n\n/**\n * ApprovalEscalatedEvent - An approval has been escalated.\n */\nexport const ApprovalEscalatedEvent = defineEvent({\n meta: {\n key: 'workflow.approval.escalated',\n version: '1.0.0',\n description: 'An approval has been escalated.',\n stability: 'stable',\n owners: ['@workflow-team'],\n t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;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAY;GAAY;EAC5C;CACD,SAAS;CACV,CAAC"}
|
|
@@ -85,7 +85,7 @@ declare const SubmitDecisionContract: _contractspec_lib_contracts3.OperationSpec
|
|
|
85
85
|
};
|
|
86
86
|
}>, {
|
|
87
87
|
key: string;
|
|
88
|
-
version:
|
|
88
|
+
version: string;
|
|
89
89
|
when: string;
|
|
90
90
|
payload: _contractspec_lib_schema331.SchemaModel<{
|
|
91
91
|
id: {
|
|
@@ -229,7 +229,7 @@ declare const DelegateApprovalContract: _contractspec_lib_contracts3.OperationSp
|
|
|
229
229
|
};
|
|
230
230
|
}>, {
|
|
231
231
|
key: string;
|
|
232
|
-
version:
|
|
232
|
+
version: string;
|
|
233
233
|
when: string;
|
|
234
234
|
payload: _contractspec_lib_schema331.SchemaModel<{
|
|
235
235
|
id: {
|
|
@@ -337,7 +337,7 @@ declare const AddApprovalCommentContract: _contractspec_lib_contracts3.Operation
|
|
|
337
337
|
};
|
|
338
338
|
}>, {
|
|
339
339
|
key: string;
|
|
340
|
-
version:
|
|
340
|
+
version: string;
|
|
341
341
|
when: string;
|
|
342
342
|
payload: _contractspec_lib_schema331.SchemaModel<{
|
|
343
343
|
id: {
|
|
@@ -11,7 +11,7 @@ const OWNERS = ["@example.workflow-system"];
|
|
|
11
11
|
const SubmitDecisionContract = defineCommand({
|
|
12
12
|
meta: {
|
|
13
13
|
key: "workflow.approval.decide",
|
|
14
|
-
version: 1,
|
|
14
|
+
version: "1.0.0",
|
|
15
15
|
stability: "stable",
|
|
16
16
|
owners: [...OWNERS],
|
|
17
17
|
tags: [
|
|
@@ -51,7 +51,7 @@ const SubmitDecisionContract = defineCommand({
|
|
|
51
51
|
sideEffects: {
|
|
52
52
|
emits: [{
|
|
53
53
|
key: "workflow.approval.decided",
|
|
54
|
-
version: 1,
|
|
54
|
+
version: "1.0.0",
|
|
55
55
|
when: "Decision is made",
|
|
56
56
|
payload: ApprovalRequestModel
|
|
57
57
|
}],
|
|
@@ -84,7 +84,7 @@ const SubmitDecisionContract = defineCommand({
|
|
|
84
84
|
const DelegateApprovalContract = defineCommand({
|
|
85
85
|
meta: {
|
|
86
86
|
key: "workflow.approval.delegate",
|
|
87
|
-
version: 1,
|
|
87
|
+
version: "1.0.0",
|
|
88
88
|
stability: "stable",
|
|
89
89
|
owners: [...OWNERS],
|
|
90
90
|
tags: [
|
|
@@ -120,7 +120,7 @@ const DelegateApprovalContract = defineCommand({
|
|
|
120
120
|
sideEffects: {
|
|
121
121
|
emits: [{
|
|
122
122
|
key: "workflow.approval.delegated",
|
|
123
|
-
version: 1,
|
|
123
|
+
version: "1.0.0",
|
|
124
124
|
when: "Approval is delegated",
|
|
125
125
|
payload: ApprovalRequestModel
|
|
126
126
|
}],
|
|
@@ -153,7 +153,7 @@ const DelegateApprovalContract = defineCommand({
|
|
|
153
153
|
const AddApprovalCommentContract = defineCommand({
|
|
154
154
|
meta: {
|
|
155
155
|
key: "workflow.approval.comment.add",
|
|
156
|
-
version: 1,
|
|
156
|
+
version: "1.0.0",
|
|
157
157
|
stability: "stable",
|
|
158
158
|
owners: [...OWNERS],
|
|
159
159
|
tags: [
|
|
@@ -188,7 +188,7 @@ const AddApprovalCommentContract = defineCommand({
|
|
|
188
188
|
policy: { auth: "user" },
|
|
189
189
|
sideEffects: { emits: [{
|
|
190
190
|
key: "workflow.approval.comment.added",
|
|
191
|
-
version: 1,
|
|
191
|
+
version: "1.0.0",
|
|
192
192
|
when: "Comment is added",
|
|
193
193
|
payload: ApprovalCommentModel
|
|
194
194
|
}] },
|
|
@@ -219,7 +219,7 @@ const AddApprovalCommentContract = defineCommand({
|
|
|
219
219
|
const ListMyApprovalsContract = defineQuery({
|
|
220
220
|
meta: {
|
|
221
221
|
key: "workflow.approval.list.mine",
|
|
222
|
-
version: 1,
|
|
222
|
+
version: "1.0.0",
|
|
223
223
|
stability: "stable",
|
|
224
224
|
owners: [...OWNERS],
|
|
225
225
|
tags: [
|
|
@@ -299,7 +299,7 @@ const ListMyApprovalsContract = defineQuery({
|
|
|
299
299
|
const GetApprovalContract = defineQuery({
|
|
300
300
|
meta: {
|
|
301
301
|
key: "workflow.approval.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":"approval.operations.js","names":[],"sources":["../../src/approval/approval.operations.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { ApprovalDecisionEnum, ApprovalStatusEnum } from './approval.enum';\nimport { ApprovalCommentModel, ApprovalRequestModel } from './approval.schema';\n\nconst OWNERS = ['@example.workflow-system'] as const;\n\n/**\n * Approve or reject an approval request.\n */\nexport const SubmitDecisionContract = defineCommand({\n meta: {\n key: 'workflow.approval.decide',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'approval', 'decision'],\n description: 'Submit an approval decision (approve/reject).',\n goal: 'Allow approvers to make decisions on requests.',\n context: 'Approval inbox, workflow detail.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ApproveRejectInput',\n fields: {\n requestId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n decision: { type: ApprovalDecisionEnum, isOptional: false },\n comment: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n data: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n }),\n output: ApprovalRequestModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.approval.decided',\n version: 1,\n when: 'Decision is made',\n payload: ApprovalRequestModel,\n },\n ],\n audit: ['workflow.approval.decided'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'approve-request-happy-path',\n given: ['Approval request is pending', 'User is assignee'],\n when: ['User approves request'],\n then: ['Request is approved', 'ApprovalDecided event is emitted'],\n },\n ],\n examples: [\n {\n key: 'approve-basic',\n input: {\n requestId: 'req-123',\n decision: 'approve',\n comment: 'Looks good',\n },\n output: { id: 'req-123', status: 'approved' },\n },\n ],\n },\n});\n\n/**\n * Delegate an approval to another user.\n */\nexport const DelegateApprovalContract = defineCommand({\n meta: {\n key: 'workflow.approval.delegate',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'approval', 'delegate'],\n description: 'Delegate an approval request to another user.',\n goal: 'Allow approvers to pass approval to others.',\n context: 'Approval inbox.',\n },\n io: {\n input: defineSchemaModel({\n name: 'DelegateInput',\n fields: {\n requestId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n delegateTo: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n }),\n output: ApprovalRequestModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.approval.delegated',\n version: 1,\n when: 'Approval is delegated',\n payload: ApprovalRequestModel,\n },\n ],\n audit: ['workflow.approval.delegated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'delegate-approval-happy-path',\n given: ['Approval request is pending', 'User is assignee'],\n when: ['User delegates to another user'],\n then: ['Assignee is updated', 'ApprovalDelegated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'delegate-to-manager',\n input: {\n requestId: 'req-123',\n delegateTo: 'user-456',\n reason: 'Out of office',\n },\n output: { id: 'req-123', assigneeId: 'user-456' },\n },\n ],\n },\n});\n\n/**\n * Add a comment to an approval request.\n */\nexport const AddApprovalCommentContract = defineCommand({\n meta: {\n key: 'workflow.approval.comment.add',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'approval', 'comment'],\n description: 'Add a comment to an approval request.',\n goal: 'Allow discussion on approval requests.',\n context: 'Approval detail view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'AddCommentInput',\n fields: {\n requestId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n content: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n isInternal: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n }),\n output: ApprovalCommentModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.approval.comment.added',\n version: 1,\n when: 'Comment is added',\n payload: ApprovalCommentModel,\n },\n ],\n },\n acceptance: {\n scenarios: [\n {\n key: 'add-comment-happy-path',\n given: ['Approval request exists'],\n when: ['User adds a comment'],\n then: ['Comment is added', 'CommentAdded event is emitted'],\n },\n ],\n examples: [\n {\n key: 'add-question',\n input: {\n requestId: 'req-123',\n content: 'Can you clarify budget?',\n isInternal: false,\n },\n output: { id: 'com-789', content: 'Can you clarify budget?' },\n },\n ],\n },\n});\n\n/**\n * List approvals assigned to the current user.\n */\nexport const ListMyApprovalsContract = defineQuery({\n meta: {\n key: 'workflow.approval.list.mine',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'approval', 'list', 'inbox'],\n description: 'List approval requests assigned to current user.',\n goal: 'Show pending approvals in user inbox.',\n context: 'Approval inbox, dashboard widget.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ListMyApprovalsInput',\n fields: {\n status: { type: ApprovalStatusEnum, 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: 'ListMyApprovalsOutput',\n fields: {\n requests: {\n type: ApprovalRequestModel,\n isArray: true,\n isOptional: false,\n },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n pendingCount: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'list-approvals-happy-path',\n given: ['User has assigned approvals'],\n when: ['User lists approvals'],\n then: ['List of requests is returned'],\n },\n ],\n examples: [\n {\n key: 'list-pending',\n input: { status: 'pending', limit: 10 },\n output: { requests: [], total: 2, pendingCount: 2 },\n },\n ],\n },\n});\n\n/**\n * Get a single approval request.\n */\nexport const GetApprovalContract = defineQuery({\n meta: {\n key: 'workflow.approval.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'approval', 'get'],\n description: 'Get an approval request with details.',\n goal: 'View approval request details.',\n context: 'Approval detail view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetApprovalInput',\n fields: {\n requestId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n },\n }),\n output: ApprovalRequestModel,\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-approval-happy-path',\n given: ['Approval request exists'],\n when: ['User requests approval details'],\n then: ['Approval details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-basic',\n input: { requestId: 'req-123' },\n output: { id: 'req-123', status: 'pending' },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAQA,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;GAAY;GAAW;EAC1C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO,kBAAkB;GACvB,MAAM;GACN,QAAQ;IACN,WAAW;KACT,MAAM,eAAe,iBAAiB;KACtC,YAAY;KACb;IACD,UAAU;KAAE,MAAM;KAAsB,YAAY;KAAO;IAC3D,SAAS;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAM;IACrE,MAAM;KAAE,MAAM,eAAe,MAAM;KAAE,YAAY;KAAM;IACxD;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;IAAW;GAC7C,CACF;EACF;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"approval.operations.js","names":[],"sources":["../../src/approval/approval.operations.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { ApprovalDecisionEnum, ApprovalStatusEnum } from './approval.enum';\nimport { ApprovalCommentModel, ApprovalRequestModel } from './approval.schema';\n\nconst OWNERS = ['@example.workflow-system'] as const;\n\n/**\n * Approve or reject an approval request.\n */\nexport const SubmitDecisionContract = defineCommand({\n meta: {\n key: 'workflow.approval.decide',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'approval', 'decision'],\n description: 'Submit an approval decision (approve/reject).',\n goal: 'Allow approvers to make decisions on requests.',\n context: 'Approval inbox, workflow detail.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ApproveRejectInput',\n fields: {\n requestId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n decision: { type: ApprovalDecisionEnum, isOptional: false },\n comment: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n data: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n }),\n output: ApprovalRequestModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.approval.decided',\n version: '1.0.0',\n when: 'Decision is made',\n payload: ApprovalRequestModel,\n },\n ],\n audit: ['workflow.approval.decided'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'approve-request-happy-path',\n given: ['Approval request is pending', 'User is assignee'],\n when: ['User approves request'],\n then: ['Request is approved', 'ApprovalDecided event is emitted'],\n },\n ],\n examples: [\n {\n key: 'approve-basic',\n input: {\n requestId: 'req-123',\n decision: 'approve',\n comment: 'Looks good',\n },\n output: { id: 'req-123', status: 'approved' },\n },\n ],\n },\n});\n\n/**\n * Delegate an approval to another user.\n */\nexport const DelegateApprovalContract = defineCommand({\n meta: {\n key: 'workflow.approval.delegate',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'approval', 'delegate'],\n description: 'Delegate an approval request to another user.',\n goal: 'Allow approvers to pass approval to others.',\n context: 'Approval inbox.',\n },\n io: {\n input: defineSchemaModel({\n name: 'DelegateInput',\n fields: {\n requestId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n delegateTo: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n }),\n output: ApprovalRequestModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.approval.delegated',\n version: '1.0.0',\n when: 'Approval is delegated',\n payload: ApprovalRequestModel,\n },\n ],\n audit: ['workflow.approval.delegated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'delegate-approval-happy-path',\n given: ['Approval request is pending', 'User is assignee'],\n when: ['User delegates to another user'],\n then: ['Assignee is updated', 'ApprovalDelegated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'delegate-to-manager',\n input: {\n requestId: 'req-123',\n delegateTo: 'user-456',\n reason: 'Out of office',\n },\n output: { id: 'req-123', assigneeId: 'user-456' },\n },\n ],\n },\n});\n\n/**\n * Add a comment to an approval request.\n */\nexport const AddApprovalCommentContract = defineCommand({\n meta: {\n key: 'workflow.approval.comment.add',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'approval', 'comment'],\n description: 'Add a comment to an approval request.',\n goal: 'Allow discussion on approval requests.',\n context: 'Approval detail view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'AddCommentInput',\n fields: {\n requestId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n content: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n isInternal: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n }),\n output: ApprovalCommentModel,\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'workflow.approval.comment.added',\n version: '1.0.0',\n when: 'Comment is added',\n payload: ApprovalCommentModel,\n },\n ],\n },\n acceptance: {\n scenarios: [\n {\n key: 'add-comment-happy-path',\n given: ['Approval request exists'],\n when: ['User adds a comment'],\n then: ['Comment is added', 'CommentAdded event is emitted'],\n },\n ],\n examples: [\n {\n key: 'add-question',\n input: {\n requestId: 'req-123',\n content: 'Can you clarify budget?',\n isInternal: false,\n },\n output: { id: 'com-789', content: 'Can you clarify budget?' },\n },\n ],\n },\n});\n\n/**\n * List approvals assigned to the current user.\n */\nexport const ListMyApprovalsContract = defineQuery({\n meta: {\n key: 'workflow.approval.list.mine',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'approval', 'list', 'inbox'],\n description: 'List approval requests assigned to current user.',\n goal: 'Show pending approvals in user inbox.',\n context: 'Approval inbox, dashboard widget.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ListMyApprovalsInput',\n fields: {\n status: { type: ApprovalStatusEnum, 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: 'ListMyApprovalsOutput',\n fields: {\n requests: {\n type: ApprovalRequestModel,\n isArray: true,\n isOptional: false,\n },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n pendingCount: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'list-approvals-happy-path',\n given: ['User has assigned approvals'],\n when: ['User lists approvals'],\n then: ['List of requests is returned'],\n },\n ],\n examples: [\n {\n key: 'list-pending',\n input: { status: 'pending', limit: 10 },\n output: { requests: [], total: 2, pendingCount: 2 },\n },\n ],\n },\n});\n\n/**\n * Get a single approval request.\n */\nexport const GetApprovalContract = defineQuery({\n meta: {\n key: 'workflow.approval.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['workflow', 'approval', 'get'],\n description: 'Get an approval request with details.',\n goal: 'View approval request details.',\n context: 'Approval detail view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetApprovalInput',\n fields: {\n requestId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n },\n }),\n output: ApprovalRequestModel,\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-approval-happy-path',\n given: ['Approval request exists'],\n when: ['User requests approval details'],\n then: ['Approval details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-basic',\n input: { requestId: 'req-123' },\n output: { id: 'req-123', status: 'pending' },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAQA,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;GAAY;GAAW;EAC1C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO,kBAAkB;GACvB,MAAM;GACN,QAAQ;IACN,WAAW;KACT,MAAM,eAAe,iBAAiB;KACtC,YAAY;KACb;IACD,UAAU;KAAE,MAAM;KAAsB,YAAY;KAAO;IAC3D,SAAS;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAM;IACrE,MAAM;KAAE,MAAM,eAAe,MAAM;KAAE,YAAY;KAAM;IACxD;GACF,CAAC;EACF,QAAQ;EACT;CACD,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,4BAA4B;EACrC;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GAC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;KACb;IACD,OAAO;KAAE,MAAM,eAAe,cAAc;KAAE,YAAY;KAAO;IACjE,cAAc;KACZ,MAAM,eAAe,cAAc;KACnC,YAAY;KACb;IACF;GACF,CAAC;EACH;CACD,QAAQ,EAAE,MAAM,QAAQ;CACxB,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,8BAA8B;GACtC,MAAM,CAAC,uBAAuB;GAC9B,MAAM,CAAC,+BAA+B;GACvC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,QAAQ;IAAW,OAAO;IAAI;GACvC,QAAQ;IAAE,UAAU,EAAE;IAAE,OAAO;IAAG,cAAc;IAAG;GACpD,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,sBAAsB,YAAY;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAY;GAAY;GAAM;EACrC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO,kBAAkB;GACvB,MAAM;GACN,QAAQ,EACN,WAAW;IACT,MAAM,eAAe,iBAAiB;IACtC,YAAY;IACb,EACF;GACF,CAAC;EACF,QAAQ;EACT;CACD,QAAQ,EAAE,MAAM,QAAQ;CACxB,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,0BAA0B;GAClC,MAAM,CAAC,iCAAiC;GACxC,MAAM,CAAC,gCAAgC;GACxC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO,EAAE,WAAW,WAAW;GAC/B,QAAQ;IAAE,IAAI;IAAW,QAAQ;IAAW;GAC7C,CACF;EACF;CACF,CAAC"}
|
package/dist/example.d.ts
CHANGED
|
@@ -1,40 +1,7 @@
|
|
|
1
|
+
import { ExampleSpec } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
1
3
|
//#region src/example.d.ts
|
|
2
|
-
declare const example:
|
|
3
|
-
readonly id: "workflow-system";
|
|
4
|
-
readonly title: "Workflow / Approval System";
|
|
5
|
-
readonly summary: "State-machine driven approvals with RBAC, audit trail, notifications, and jobs.";
|
|
6
|
-
readonly tags: readonly ["workflow", "approval", "state-machine", "rbac"];
|
|
7
|
-
readonly kind: "template";
|
|
8
|
-
readonly visibility: "public";
|
|
9
|
-
readonly docs: {
|
|
10
|
-
readonly rootDocId: "docs.examples.workflow-system";
|
|
11
|
-
readonly goalDocId: "docs.examples.workflow-system.goal";
|
|
12
|
-
readonly usageDocId: "docs.examples.workflow-system.usage";
|
|
13
|
-
readonly constraintsDocId: "docs.examples.workflow-system.constraints";
|
|
14
|
-
};
|
|
15
|
-
readonly entrypoints: {
|
|
16
|
-
readonly packageName: "@contractspec/example.workflow-system";
|
|
17
|
-
readonly feature: "./feature";
|
|
18
|
-
readonly contracts: "./contracts";
|
|
19
|
-
readonly presentations: "./presentations";
|
|
20
|
-
readonly handlers: "./handlers";
|
|
21
|
-
readonly docs: "./docs";
|
|
22
|
-
};
|
|
23
|
-
readonly surfaces: {
|
|
24
|
-
readonly templates: true;
|
|
25
|
-
readonly sandbox: {
|
|
26
|
-
readonly enabled: true;
|
|
27
|
-
readonly modes: readonly ["playground", "specs", "builder", "markdown", "evolution"];
|
|
28
|
-
};
|
|
29
|
-
readonly studio: {
|
|
30
|
-
readonly enabled: true;
|
|
31
|
-
readonly installable: true;
|
|
32
|
-
};
|
|
33
|
-
readonly mcp: {
|
|
34
|
-
readonly enabled: true;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
};
|
|
4
|
+
declare const example: ExampleSpec;
|
|
38
5
|
//#endregion
|
|
39
6
|
export { example as default };
|
|
40
7
|
//# sourceMappingURL=example.d.ts.map
|
package/dist/example.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,SAAS"}
|
package/dist/example.js
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
//#region src/example.ts
|
|
2
2
|
const example = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
meta: {
|
|
4
|
+
key: "workflow-system",
|
|
5
|
+
version: "1.0.0",
|
|
6
|
+
title: "Workflow / Approval System",
|
|
7
|
+
description: "State-machine driven approvals with RBAC, audit trail, notifications, and jobs.",
|
|
8
|
+
kind: "template",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
stability: "experimental",
|
|
11
|
+
owners: ["@platform.core"],
|
|
12
|
+
tags: [
|
|
13
|
+
"workflow",
|
|
14
|
+
"approval",
|
|
15
|
+
"state-machine",
|
|
16
|
+
"rbac"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
14
19
|
docs: {
|
|
15
20
|
rootDocId: "docs.examples.workflow-system",
|
|
16
21
|
goalDocId: "docs.examples.workflow-system.goal",
|
package/dist/example.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"example.js","names":["example: ExampleSpec"],"sources":["../src/example.ts"],"sourcesContent":["import type { ExampleSpec } from '@contractspec/lib.contracts';\n\nconst example: ExampleSpec = {\n meta: {\n key: 'workflow-system',\n version: '1.0.0',\n title: 'Workflow / Approval System',\n description:\n 'State-machine driven approvals with RBAC, audit trail, notifications, and jobs.',\n kind: 'template',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['workflow', 'approval', 'state-machine', 'rbac'],\n },\n docs: {\n rootDocId: 'docs.examples.workflow-system',\n goalDocId: 'docs.examples.workflow-system.goal',\n usageDocId: 'docs.examples.workflow-system.usage',\n constraintsDocId: 'docs.examples.workflow-system.constraints',\n },\n entrypoints: {\n packageName: '@contractspec/example.workflow-system',\n feature: './feature',\n contracts: './contracts',\n presentations: './presentations',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: {\n enabled: true,\n modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],\n },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n};\n\nexport default example;\n"],"mappings":";AAEA,MAAMA,UAAuB;CAC3B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAY;GAAiB;GAAO;EACxD;CACD,MAAM;EACJ,WAAW;EACX,WAAW;EACX,YAAY;EACZ,kBAAkB;EACnB;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,eAAe;EACf,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GACP,SAAS;GACT,OAAO;IAAC;IAAc;IAAS;IAAW;IAAY;IAAY;GACnE;EACD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF;AAED,sBAAe"}
|