@contractspec/example.workflow-system 3.8.9 → 3.8.11

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.
Files changed (95) hide show
  1. package/dist/approval/approval.enum.js +1 -22
  2. package/dist/approval/approval.event.js +1 -112
  3. package/dist/approval/approval.operations.js +1 -369
  4. package/dist/approval/approval.schema.js +1 -73
  5. package/dist/approval/index.js +1 -484
  6. package/dist/browser/approval/approval.enum.js +1 -22
  7. package/dist/browser/approval/approval.event.js +1 -112
  8. package/dist/browser/approval/approval.operations.js +1 -369
  9. package/dist/browser/approval/approval.schema.js +1 -73
  10. package/dist/browser/approval/index.js +1 -484
  11. package/dist/browser/docs/index.js +5 -49
  12. package/dist/browser/docs/workflow-system.docblock.js +5 -49
  13. package/dist/browser/entities/approval.js +1 -119
  14. package/dist/browser/entities/index.js +1 -508
  15. package/dist/browser/entities/instance.js +1 -161
  16. package/dist/browser/entities/step.js +1 -124
  17. package/dist/browser/entities/workflow.js +1 -82
  18. package/dist/browser/example.js +1 -42
  19. package/dist/browser/handlers/index.js +8 -253
  20. package/dist/browser/handlers/workflow.handlers.js +8 -253
  21. package/dist/browser/index.js +13 -3524
  22. package/dist/browser/instance/index.js +1 -677
  23. package/dist/browser/instance/instance.enum.js +1 -15
  24. package/dist/browser/instance/instance.event.js +1 -164
  25. package/dist/browser/instance/instance.handler.js +1 -356
  26. package/dist/browser/instance/instance.operations.js +1 -9
  27. package/dist/browser/instance/instance.schema.js +1 -101
  28. package/dist/browser/presentations/index.js +1 -109
  29. package/dist/browser/seeders/index.js +1 -3
  30. package/dist/browser/shared/demo-scenario.js +1 -213
  31. package/dist/browser/shared/index.js +1 -3
  32. package/dist/browser/shared/mock-data.js +1 -11
  33. package/dist/browser/state-machine/index.js +1 -6
  34. package/dist/browser/tests/operations.test-spec.js +1 -6
  35. package/dist/browser/ui/WorkflowDashboard.js +1 -3
  36. package/dist/browser/ui/WorkflowDashboard.visualizations.js +1 -239
  37. package/dist/browser/ui/hooks/index.js +1 -3
  38. package/dist/browser/ui/hooks/useWorkflowList.js +1 -52
  39. package/dist/browser/ui/index.js +1 -56
  40. package/dist/browser/ui/renderers/index.js +5 -562
  41. package/dist/browser/ui/renderers/workflow.markdown.js +5 -562
  42. package/dist/browser/visualizations/catalog.js +1 -132
  43. package/dist/browser/visualizations/index.js +1 -133
  44. package/dist/browser/visualizations/selectors.js +1 -195
  45. package/dist/browser/workflow/index.js +1 -21
  46. package/dist/browser/workflow/workflow.enum.js +1 -36
  47. package/dist/browser/workflow/workflow.event.js +1 -6
  48. package/dist/browser/workflow/workflow.handler.js +1 -5
  49. package/dist/browser/workflow/workflow.operations.js +1 -8
  50. package/dist/browser/workflow/workflow.schema.js +1 -151
  51. package/dist/browser/workflow-system.capability.js +1 -5
  52. package/dist/browser/workflow-system.feature.js +1 -3
  53. package/dist/docs/index.js +5 -49
  54. package/dist/docs/workflow-system.docblock.js +5 -49
  55. package/dist/entities/approval.js +1 -119
  56. package/dist/entities/index.js +1 -508
  57. package/dist/entities/instance.js +1 -161
  58. package/dist/entities/step.js +1 -124
  59. package/dist/entities/workflow.js +1 -82
  60. package/dist/example.js +1 -42
  61. package/dist/handlers/index.js +8 -253
  62. package/dist/handlers/workflow.handlers.js +8 -253
  63. package/dist/index.js +13 -3524
  64. package/dist/instance/index.js +1 -677
  65. package/dist/instance/instance.enum.js +1 -15
  66. package/dist/instance/instance.event.js +1 -164
  67. package/dist/instance/instance.handler.js +1 -356
  68. package/dist/instance/instance.operations.js +1 -9
  69. package/dist/instance/instance.schema.js +1 -101
  70. package/dist/presentations/index.js +1 -109
  71. package/dist/seeders/index.js +1 -3
  72. package/dist/shared/demo-scenario.js +1 -213
  73. package/dist/shared/index.js +1 -3
  74. package/dist/shared/mock-data.js +1 -11
  75. package/dist/state-machine/index.js +1 -6
  76. package/dist/tests/operations.test-spec.js +1 -6
  77. package/dist/ui/WorkflowDashboard.js +1 -3
  78. package/dist/ui/WorkflowDashboard.visualizations.js +1 -239
  79. package/dist/ui/hooks/index.js +1 -3
  80. package/dist/ui/hooks/useWorkflowList.js +1 -52
  81. package/dist/ui/index.js +1 -56
  82. package/dist/ui/renderers/index.js +5 -562
  83. package/dist/ui/renderers/workflow.markdown.js +5 -562
  84. package/dist/visualizations/catalog.js +1 -132
  85. package/dist/visualizations/index.js +1 -133
  86. package/dist/visualizations/selectors.js +1 -195
  87. package/dist/workflow/index.js +1 -21
  88. package/dist/workflow/workflow.enum.js +1 -36
  89. package/dist/workflow/workflow.event.js +1 -6
  90. package/dist/workflow/workflow.handler.js +1 -5
  91. package/dist/workflow/workflow.operations.js +1 -8
  92. package/dist/workflow/workflow.schema.js +1 -151
  93. package/dist/workflow-system.capability.js +1 -5
  94. package/dist/workflow-system.feature.js +1 -3
  95. package/package.json +8 -8
@@ -1,110 +1,2 @@
1
1
  // @bun
2
- // src/instance/instance.enum.ts
3
- import { defineEnum } from "@contractspec/lib.schema";
4
- var InstanceStatusEnum = defineEnum("InstanceStatus", [
5
- "PENDING",
6
- "RUNNING",
7
- "WAITING",
8
- "PAUSED",
9
- "COMPLETED",
10
- "CANCELLED",
11
- "FAILED",
12
- "TIMEOUT"
13
- ]);
14
-
15
- // src/instance/instance.schema.ts
16
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
17
- var WorkflowInstanceModel = defineSchemaModel({
18
- name: "WorkflowInstanceModel",
19
- description: "A running workflow instance",
20
- fields: {
21
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
22
- workflowDefinitionId: {
23
- type: ScalarTypeEnum.String_unsecure(),
24
- isOptional: false
25
- },
26
- referenceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
27
- referenceType: {
28
- type: ScalarTypeEnum.String_unsecure(),
29
- isOptional: true
30
- },
31
- status: { type: InstanceStatusEnum, isOptional: false },
32
- currentStepId: {
33
- type: ScalarTypeEnum.String_unsecure(),
34
- isOptional: true
35
- },
36
- contextData: { type: ScalarTypeEnum.JSON(), isOptional: true },
37
- triggeredBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
38
- organizationId: {
39
- type: ScalarTypeEnum.String_unsecure(),
40
- isOptional: false
41
- },
42
- priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
43
- dueAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
44
- outcome: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
45
- resultData: { type: ScalarTypeEnum.JSON(), isOptional: true },
46
- errorMessage: {
47
- type: ScalarTypeEnum.String_unsecure(),
48
- isOptional: true
49
- },
50
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
51
- startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
52
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
53
- }
54
- });
55
- var StartWorkflowInputModel = defineSchemaModel({
56
- name: "StartWorkflowInput",
57
- description: "Input for starting a workflow",
58
- fields: {
59
- workflowKey: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
60
- contextData: { type: ScalarTypeEnum.JSON(), isOptional: true },
61
- referenceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
62
- referenceType: {
63
- type: ScalarTypeEnum.String_unsecure(),
64
- isOptional: true
65
- },
66
- priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
67
- dueAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
68
- }
69
- });
70
- var TransitionInputModel = defineSchemaModel({
71
- name: "TransitionInput",
72
- description: "Input for transitioning a workflow",
73
- fields: {
74
- instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
75
- action: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
76
- data: { type: ScalarTypeEnum.JSON(), isOptional: true },
77
- comment: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
78
- }
79
- });
80
- var TransitionResultModel = defineSchemaModel({
81
- name: "TransitionResult",
82
- description: "Result of a workflow transition",
83
- fields: {
84
- success: { type: ScalarTypeEnum.Boolean(), isOptional: false },
85
- instance: { type: WorkflowInstanceModel, isOptional: false },
86
- previousStepKey: {
87
- type: ScalarTypeEnum.String_unsecure(),
88
- isOptional: true
89
- },
90
- currentStepKey: {
91
- type: ScalarTypeEnum.String_unsecure(),
92
- isOptional: true
93
- },
94
- message: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
95
- }
96
- });
97
- export {
98
- WorkflowSystemPresentations,
99
- WorkflowMetricsPresentation,
100
- WorkflowListPresentation,
101
- WorkflowDetailPresentation,
102
- WorkflowDesignerPresentation,
103
- ProgressTrackerPresentation,
104
- PendingApprovalsBadgePresentation,
105
- InstanceListPresentation,
106
- InstanceDetailPresentation,
107
- ApprovalInboxPresentation,
108
- ApprovalFormPresentation,
109
- ApprovalDetailPresentation
110
- };
2
+ import{defineEnum as v}from"@contractspec/lib.schema";var q=v("InstanceStatus",["PENDING","RUNNING","WAITING","PAUSED","COMPLETED","CANCELLED","FAILED","TIMEOUT"]);import{defineSchemaModel as j,ScalarTypeEnum as g}from"@contractspec/lib.schema";var x=j({name:"WorkflowInstanceModel",description:"A running workflow instance",fields:{id:{type:g.String_unsecure(),isOptional:!1},workflowDefinitionId:{type:g.String_unsecure(),isOptional:!1},referenceId:{type:g.String_unsecure(),isOptional:!0},referenceType:{type:g.String_unsecure(),isOptional:!0},status:{type:q,isOptional:!1},currentStepId:{type:g.String_unsecure(),isOptional:!0},contextData:{type:g.JSON(),isOptional:!0},triggeredBy:{type:g.String_unsecure(),isOptional:!1},organizationId:{type:g.String_unsecure(),isOptional:!1},priority:{type:g.Int_unsecure(),isOptional:!1},dueAt:{type:g.DateTime(),isOptional:!0},outcome:{type:g.String_unsecure(),isOptional:!0},resultData:{type:g.JSON(),isOptional:!0},errorMessage:{type:g.String_unsecure(),isOptional:!0},createdAt:{type:g.DateTime(),isOptional:!1},startedAt:{type:g.DateTime(),isOptional:!0},completedAt:{type:g.DateTime(),isOptional:!0}}}),D=j({name:"StartWorkflowInput",description:"Input for starting a workflow",fields:{workflowKey:{type:g.NonEmptyString(),isOptional:!1},contextData:{type:g.JSON(),isOptional:!0},referenceId:{type:g.String_unsecure(),isOptional:!0},referenceType:{type:g.String_unsecure(),isOptional:!0},priority:{type:g.Int_unsecure(),isOptional:!0},dueAt:{type:g.DateTime(),isOptional:!0}}}),F=j({name:"TransitionInput",description:"Input for transitioning a workflow",fields:{instanceId:{type:g.String_unsecure(),isOptional:!1},action:{type:g.NonEmptyString(),isOptional:!1},data:{type:g.JSON(),isOptional:!0},comment:{type:g.String_unsecure(),isOptional:!0}}}),G=j({name:"TransitionResult",description:"Result of a workflow transition",fields:{success:{type:g.Boolean(),isOptional:!1},instance:{type:x,isOptional:!1},previousStepKey:{type:g.String_unsecure(),isOptional:!0},currentStepKey:{type:g.String_unsecure(),isOptional:!0},message:{type:g.String_unsecure(),isOptional:!0}}});export{WorkflowSystemPresentations,WorkflowMetricsPresentation,WorkflowListPresentation,WorkflowDetailPresentation,WorkflowDesignerPresentation,ProgressTrackerPresentation,PendingApprovalsBadgePresentation,InstanceListPresentation,InstanceDetailPresentation,ApprovalInboxPresentation,ApprovalFormPresentation,ApprovalDetailPresentation};
@@ -1,4 +1,2 @@
1
1
  // @bun
2
- export {
3
- seedWorkflowSystem
4
- };
2
+ export{seedWorkflowSystem};
@@ -1,214 +1,2 @@
1
1
  // @bun
2
- // src/shared/demo-scenario.ts
3
- var WORKFLOW_SYSTEM_DEMO_PROJECT_ID = "workflow-system-demo";
4
- var WORKFLOW_SYSTEM_DEMO_ORGANIZATION_ID = "org_demo";
5
- var WORKFLOW_SYSTEM_DEMO_DEFINITIONS = [
6
- {
7
- id: "wf_expense",
8
- name: "Expense Approval",
9
- description: "Approve non-trivial spend before finance releases budget.",
10
- type: "APPROVAL",
11
- status: "ACTIVE",
12
- createdAt: "2026-03-10T09:00:00.000Z",
13
- updatedAt: "2026-03-20T08:15:00.000Z",
14
- steps: [
15
- {
16
- id: "wfstep_expense_manager",
17
- name: "Manager Review",
18
- description: "Validate business value and team budget.",
19
- stepOrder: 1,
20
- type: "APPROVAL",
21
- requiredRoles: ["manager"],
22
- createdAt: "2026-03-10T09:00:00.000Z"
23
- },
24
- {
25
- id: "wfstep_expense_finance",
26
- name: "Finance Review",
27
- description: "Confirm ledger coding and spending threshold.",
28
- stepOrder: 2,
29
- type: "APPROVAL",
30
- requiredRoles: ["finance"],
31
- createdAt: "2026-03-10T09:10:00.000Z"
32
- }
33
- ]
34
- },
35
- {
36
- id: "wf_vendor",
37
- name: "Vendor Onboarding",
38
- description: "Sequence security, procurement, and legal before activation.",
39
- type: "SEQUENTIAL",
40
- status: "ACTIVE",
41
- createdAt: "2026-03-08T11:00:00.000Z",
42
- updatedAt: "2026-03-19T13:10:00.000Z",
43
- steps: [
44
- {
45
- id: "wfstep_vendor_security",
46
- name: "Security Check",
47
- description: "Review data access and integration scope.",
48
- stepOrder: 1,
49
- type: "APPROVAL",
50
- requiredRoles: ["security"],
51
- createdAt: "2026-03-08T11:00:00.000Z"
52
- },
53
- {
54
- id: "wfstep_vendor_procurement",
55
- name: "Procurement Check",
56
- description: "Validate pricing, procurement policy, and owner.",
57
- stepOrder: 2,
58
- type: "APPROVAL",
59
- requiredRoles: ["procurement"],
60
- createdAt: "2026-03-08T11:05:00.000Z"
61
- },
62
- {
63
- id: "wfstep_vendor_legal",
64
- name: "Legal Sign-off",
65
- description: "Approve terms before the vendor goes live.",
66
- stepOrder: 3,
67
- type: "APPROVAL",
68
- requiredRoles: ["legal"],
69
- createdAt: "2026-03-08T11:10:00.000Z"
70
- }
71
- ]
72
- },
73
- {
74
- id: "wf_policy_exception",
75
- name: "Policy Exception",
76
- description: "Escalate a temporary exception through team lead and compliance.",
77
- type: "APPROVAL",
78
- status: "DRAFT",
79
- createdAt: "2026-03-15T07:30:00.000Z",
80
- updatedAt: "2026-03-18T11:20:00.000Z",
81
- steps: [
82
- {
83
- id: "wfstep_policy_lead",
84
- name: "Team Lead Review",
85
- description: "Check urgency and expected blast radius.",
86
- stepOrder: 1,
87
- type: "APPROVAL",
88
- requiredRoles: ["team-lead"],
89
- createdAt: "2026-03-15T07:30:00.000Z"
90
- },
91
- {
92
- id: "wfstep_policy_compliance",
93
- name: "Compliance Review",
94
- description: "Accept or reject the exception request.",
95
- stepOrder: 2,
96
- type: "APPROVAL",
97
- requiredRoles: ["compliance"],
98
- createdAt: "2026-03-15T07:40:00.000Z"
99
- }
100
- ]
101
- }
102
- ];
103
- var WORKFLOW_SYSTEM_DEMO_INSTANCES = [
104
- {
105
- id: "wfinst_expense_open",
106
- definitionId: "wf_expense",
107
- status: "IN_PROGRESS",
108
- currentStepId: "wfstep_expense_finance",
109
- data: {
110
- amount: 4200,
111
- currency: "EUR",
112
- vendor: "Nimbus AI"
113
- },
114
- requestedBy: "sarah@contractspec.io",
115
- startedAt: "2026-03-20T08:00:00.000Z",
116
- approvals: [
117
- {
118
- id: "wfappr_expense_manager",
119
- stepId: "wfstep_expense_manager",
120
- status: "APPROVED",
121
- actorId: "manager.demo",
122
- comment: "Approved for the Q2 automation budget.",
123
- decidedAt: "2026-03-20T08:15:00.000Z",
124
- createdAt: "2026-03-20T08:05:00.000Z"
125
- },
126
- {
127
- id: "wfappr_expense_finance",
128
- stepId: "wfstep_expense_finance",
129
- status: "PENDING",
130
- createdAt: "2026-03-20T08:15:00.000Z"
131
- }
132
- ]
133
- },
134
- {
135
- id: "wfinst_vendor_done",
136
- definitionId: "wf_vendor",
137
- status: "COMPLETED",
138
- data: {
139
- vendor: "Acme Cloud",
140
- riskTier: "medium"
141
- },
142
- requestedBy: "leo@contractspec.io",
143
- startedAt: "2026-03-19T09:30:00.000Z",
144
- completedAt: "2026-03-19T13:10:00.000Z",
145
- approvals: [
146
- {
147
- id: "wfappr_vendor_security",
148
- stepId: "wfstep_vendor_security",
149
- status: "APPROVED",
150
- actorId: "security.demo",
151
- comment: "SOC2 scope is acceptable.",
152
- decidedAt: "2026-03-19T10:10:00.000Z",
153
- createdAt: "2026-03-19T09:35:00.000Z"
154
- },
155
- {
156
- id: "wfappr_vendor_procurement",
157
- stepId: "wfstep_vendor_procurement",
158
- status: "APPROVED",
159
- actorId: "procurement.demo",
160
- comment: "Commercial terms match the preferred vendor tier.",
161
- decidedAt: "2026-03-19T11:25:00.000Z",
162
- createdAt: "2026-03-19T10:15:00.000Z"
163
- },
164
- {
165
- id: "wfappr_vendor_legal",
166
- stepId: "wfstep_vendor_legal",
167
- status: "APPROVED",
168
- actorId: "legal.demo",
169
- comment: "MSA redlines are complete.",
170
- decidedAt: "2026-03-19T13:05:00.000Z",
171
- createdAt: "2026-03-19T11:30:00.000Z"
172
- }
173
- ]
174
- },
175
- {
176
- id: "wfinst_policy_rejected",
177
- definitionId: "wf_policy_exception",
178
- status: "REJECTED",
179
- currentStepId: "wfstep_policy_compliance",
180
- data: {
181
- policy: "Model rollout freeze",
182
- durationDays: 14
183
- },
184
- requestedBy: "maya@contractspec.io",
185
- startedAt: "2026-03-18T10:00:00.000Z",
186
- completedAt: "2026-03-18T11:20:00.000Z",
187
- approvals: [
188
- {
189
- id: "wfappr_policy_lead",
190
- stepId: "wfstep_policy_lead",
191
- status: "APPROVED",
192
- actorId: "lead.demo",
193
- comment: "Escalation justified for the release train.",
194
- decidedAt: "2026-03-18T10:30:00.000Z",
195
- createdAt: "2026-03-18T10:05:00.000Z"
196
- },
197
- {
198
- id: "wfappr_policy_compliance",
199
- stepId: "wfstep_policy_compliance",
200
- status: "REJECTED",
201
- actorId: "compliance.demo",
202
- comment: "Exception exceeds the allowed blast radius.",
203
- decidedAt: "2026-03-18T11:15:00.000Z",
204
- createdAt: "2026-03-18T10:35:00.000Z"
205
- }
206
- ]
207
- }
208
- ];
209
- export {
210
- WORKFLOW_SYSTEM_DEMO_PROJECT_ID,
211
- WORKFLOW_SYSTEM_DEMO_ORGANIZATION_ID,
212
- WORKFLOW_SYSTEM_DEMO_INSTANCES,
213
- WORKFLOW_SYSTEM_DEMO_DEFINITIONS
214
- };
2
+ var e="workflow-system-demo",t="org_demo",r=[{id:"wf_expense",name:"Expense Approval",description:"Approve non-trivial spend before finance releases budget.",type:"APPROVAL",status:"ACTIVE",createdAt:"2026-03-10T09:00:00.000Z",updatedAt:"2026-03-20T08:15:00.000Z",steps:[{id:"wfstep_expense_manager",name:"Manager Review",description:"Validate business value and team budget.",stepOrder:1,type:"APPROVAL",requiredRoles:["manager"],createdAt:"2026-03-10T09:00:00.000Z"},{id:"wfstep_expense_finance",name:"Finance Review",description:"Confirm ledger coding and spending threshold.",stepOrder:2,type:"APPROVAL",requiredRoles:["finance"],createdAt:"2026-03-10T09:10:00.000Z"}]},{id:"wf_vendor",name:"Vendor Onboarding",description:"Sequence security, procurement, and legal before activation.",type:"SEQUENTIAL",status:"ACTIVE",createdAt:"2026-03-08T11:00:00.000Z",updatedAt:"2026-03-19T13:10:00.000Z",steps:[{id:"wfstep_vendor_security",name:"Security Check",description:"Review data access and integration scope.",stepOrder:1,type:"APPROVAL",requiredRoles:["security"],createdAt:"2026-03-08T11:00:00.000Z"},{id:"wfstep_vendor_procurement",name:"Procurement Check",description:"Validate pricing, procurement policy, and owner.",stepOrder:2,type:"APPROVAL",requiredRoles:["procurement"],createdAt:"2026-03-08T11:05:00.000Z"},{id:"wfstep_vendor_legal",name:"Legal Sign-off",description:"Approve terms before the vendor goes live.",stepOrder:3,type:"APPROVAL",requiredRoles:["legal"],createdAt:"2026-03-08T11:10:00.000Z"}]},{id:"wf_policy_exception",name:"Policy Exception",description:"Escalate a temporary exception through team lead and compliance.",type:"APPROVAL",status:"DRAFT",createdAt:"2026-03-15T07:30:00.000Z",updatedAt:"2026-03-18T11:20:00.000Z",steps:[{id:"wfstep_policy_lead",name:"Team Lead Review",description:"Check urgency and expected blast radius.",stepOrder:1,type:"APPROVAL",requiredRoles:["team-lead"],createdAt:"2026-03-15T07:30:00.000Z"},{id:"wfstep_policy_compliance",name:"Compliance Review",description:"Accept or reject the exception request.",stepOrder:2,type:"APPROVAL",requiredRoles:["compliance"],createdAt:"2026-03-15T07:40:00.000Z"}]}],d=[{id:"wfinst_expense_open",definitionId:"wf_expense",status:"IN_PROGRESS",currentStepId:"wfstep_expense_finance",data:{amount:4200,currency:"EUR",vendor:"Nimbus AI"},requestedBy:"sarah@contractspec.io",startedAt:"2026-03-20T08:00:00.000Z",approvals:[{id:"wfappr_expense_manager",stepId:"wfstep_expense_manager",status:"APPROVED",actorId:"manager.demo",comment:"Approved for the Q2 automation budget.",decidedAt:"2026-03-20T08:15:00.000Z",createdAt:"2026-03-20T08:05:00.000Z"},{id:"wfappr_expense_finance",stepId:"wfstep_expense_finance",status:"PENDING",createdAt:"2026-03-20T08:15:00.000Z"}]},{id:"wfinst_vendor_done",definitionId:"wf_vendor",status:"COMPLETED",data:{vendor:"Acme Cloud",riskTier:"medium"},requestedBy:"leo@contractspec.io",startedAt:"2026-03-19T09:30:00.000Z",completedAt:"2026-03-19T13:10:00.000Z",approvals:[{id:"wfappr_vendor_security",stepId:"wfstep_vendor_security",status:"APPROVED",actorId:"security.demo",comment:"SOC2 scope is acceptable.",decidedAt:"2026-03-19T10:10:00.000Z",createdAt:"2026-03-19T09:35:00.000Z"},{id:"wfappr_vendor_procurement",stepId:"wfstep_vendor_procurement",status:"APPROVED",actorId:"procurement.demo",comment:"Commercial terms match the preferred vendor tier.",decidedAt:"2026-03-19T11:25:00.000Z",createdAt:"2026-03-19T10:15:00.000Z"},{id:"wfappr_vendor_legal",stepId:"wfstep_vendor_legal",status:"APPROVED",actorId:"legal.demo",comment:"MSA redlines are complete.",decidedAt:"2026-03-19T13:05:00.000Z",createdAt:"2026-03-19T11:30:00.000Z"}]},{id:"wfinst_policy_rejected",definitionId:"wf_policy_exception",status:"REJECTED",currentStepId:"wfstep_policy_compliance",data:{policy:"Model rollout freeze",durationDays:14},requestedBy:"maya@contractspec.io",startedAt:"2026-03-18T10:00:00.000Z",completedAt:"2026-03-18T11:20:00.000Z",approvals:[{id:"wfappr_policy_lead",stepId:"wfstep_policy_lead",status:"APPROVED",actorId:"lead.demo",comment:"Escalation justified for the release train.",decidedAt:"2026-03-18T10:30:00.000Z",createdAt:"2026-03-18T10:05:00.000Z"},{id:"wfappr_policy_compliance",stepId:"wfstep_policy_compliance",status:"REJECTED",actorId:"compliance.demo",comment:"Exception exceeds the allowed blast radius.",decidedAt:"2026-03-18T11:15:00.000Z",createdAt:"2026-03-18T10:35:00.000Z"}]}];export{e as WORKFLOW_SYSTEM_DEMO_PROJECT_ID,t as WORKFLOW_SYSTEM_DEMO_ORGANIZATION_ID,d as WORKFLOW_SYSTEM_DEMO_INSTANCES,r as WORKFLOW_SYSTEM_DEMO_DEFINITIONS};
@@ -1,4 +1,2 @@
1
1
  // @bun
2
- export {
3
- mockDataStore
4
- };
2
+ export{mockDataStore};
@@ -1,12 +1,2 @@
1
1
  // @bun
2
- // src/shared/mock-data.ts
3
- var mockDataStore = {
4
- workflows: new Map,
5
- steps: new Map,
6
- instances: new Map,
7
- approvals: new Map,
8
- stepExecutions: new Map
9
- };
10
- export {
11
- mockDataStore
12
- };
2
+ var o={workflows:new Map,steps:new Map,instances:new Map,approvals:new Map,stepExecutions:new Map};export{o as mockDataStore};
@@ -1,7 +1,2 @@
1
1
  // @bun
2
- export {
3
- createStateMachineEngine,
4
- createInitialState,
5
- buildStateMachineDefinition,
6
- BasicStateMachineEngine
7
- };
2
+ export{createStateMachineEngine,createInitialState,buildStateMachineDefinition,BasicStateMachineEngine};
@@ -1,7 +1,2 @@
1
1
  // @bun
2
- export {
3
- InstanceListTest,
4
- DefinitionListTest,
5
- ApprovalListMineTest,
6
- ApprovalDecideTest
7
- };
2
+ export{InstanceListTest,DefinitionListTest,ApprovalListMineTest,ApprovalDecideTest};
@@ -1,4 +1,2 @@
1
1
  // @bun
2
- export {
3
- WorkflowDashboard
4
- };
2
+ export{WorkflowDashboard};
@@ -1,240 +1,2 @@
1
1
  // @bun
2
- // src/visualizations/catalog.ts
3
- import {
4
- defineVisualization,
5
- VisualizationRegistry
6
- } from "@contractspec/lib.contracts-spec/visualizations";
7
- var INSTANCE_LIST_REF = {
8
- key: "workflow.instance.list",
9
- version: "1.0.0"
10
- };
11
- var META = {
12
- version: "1.0.0",
13
- domain: "workflow",
14
- stability: "experimental",
15
- owners: ["@example.workflow-system"],
16
- tags: ["workflow", "visualization", "operations"]
17
- };
18
- var WorkflowInstanceStatusVisualization = defineVisualization({
19
- meta: {
20
- ...META,
21
- key: "workflow-system.visualization.instance-status",
22
- title: "Instance Status Breakdown",
23
- description: "Distribution of workflow instance states.",
24
- goal: "Surface the current workload mix.",
25
- context: "Workflow operations overview."
26
- },
27
- source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
28
- visualization: {
29
- kind: "pie",
30
- nameDimension: "status",
31
- valueMeasure: "instances",
32
- dimensions: [
33
- { key: "status", label: "Status", dataPath: "status", type: "category" }
34
- ],
35
- measures: [
36
- {
37
- key: "instances",
38
- label: "Instances",
39
- dataPath: "instances",
40
- format: "number"
41
- }
42
- ],
43
- table: { caption: "Workflow instance counts by status." }
44
- }
45
- });
46
- var WorkflowThroughputVisualization = defineVisualization({
47
- meta: {
48
- ...META,
49
- key: "workflow-system.visualization.throughput",
50
- title: "Run Throughput",
51
- description: "Daily workflow instance starts.",
52
- goal: "Show operational throughput over time.",
53
- context: "Workflow trend monitoring."
54
- },
55
- source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
56
- visualization: {
57
- kind: "cartesian",
58
- variant: "line",
59
- xDimension: "day",
60
- yMeasures: ["instances"],
61
- dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
62
- measures: [
63
- {
64
- key: "instances",
65
- label: "Instances",
66
- dataPath: "instances",
67
- format: "number",
68
- color: "#0f766e"
69
- }
70
- ],
71
- table: { caption: "Daily workflow instance starts." }
72
- }
73
- });
74
- var WorkflowActiveMetricVisualization = defineVisualization({
75
- meta: {
76
- ...META,
77
- key: "workflow-system.visualization.active-work",
78
- title: "Active Work",
79
- description: "Current in-flight or pending workflow instances.",
80
- goal: "Expose active operational workload.",
81
- context: "Workflow workload comparison."
82
- },
83
- source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
84
- visualization: {
85
- kind: "metric",
86
- measure: "value",
87
- measures: [
88
- { key: "value", label: "Instances", dataPath: "value", format: "number" }
89
- ],
90
- table: { caption: "Active workflow count." }
91
- }
92
- });
93
- var WorkflowCompletedMetricVisualization = defineVisualization({
94
- meta: {
95
- ...META,
96
- key: "workflow-system.visualization.completed-work",
97
- title: "Completed Work",
98
- description: "Completed workflow instances in the current sample.",
99
- goal: "Show output against active workload.",
100
- context: "Workflow workload comparison."
101
- },
102
- source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
103
- visualization: {
104
- kind: "metric",
105
- measure: "value",
106
- measures: [
107
- { key: "value", label: "Instances", dataPath: "value", format: "number" }
108
- ],
109
- table: { caption: "Completed workflow count." }
110
- }
111
- });
112
- var WorkflowVisualizationSpecs = [
113
- WorkflowInstanceStatusVisualization,
114
- WorkflowThroughputVisualization,
115
- WorkflowActiveMetricVisualization,
116
- WorkflowCompletedMetricVisualization
117
- ];
118
- var WorkflowVisualizationRegistry = new VisualizationRegistry([
119
- ...WorkflowVisualizationSpecs
120
- ]);
121
- var WorkflowVisualizationRefs = WorkflowVisualizationSpecs.map((spec) => ({
122
- key: spec.meta.key,
123
- version: spec.meta.version
124
- }));
125
-
126
- // src/visualizations/selectors.ts
127
- function toDayKey(value) {
128
- const date = value instanceof Date ? value : new Date(value);
129
- return date.toISOString().slice(0, 10);
130
- }
131
- function createWorkflowVisualizationSections(instances) {
132
- const statusCounts = new Map;
133
- const throughput = new Map;
134
- let activeCount = 0;
135
- let completedCount = 0;
136
- for (const instance of instances) {
137
- statusCounts.set(instance.status, (statusCounts.get(instance.status) ?? 0) + 1);
138
- const day = toDayKey(instance.startedAt);
139
- throughput.set(day, (throughput.get(day) ?? 0) + 1);
140
- if (instance.status === "PENDING" || instance.status === "IN_PROGRESS") {
141
- activeCount += 1;
142
- }
143
- if (instance.status === "COMPLETED") {
144
- completedCount += 1;
145
- }
146
- }
147
- const primaryItems = [
148
- {
149
- key: "workflow-status",
150
- spec: WorkflowInstanceStatusVisualization,
151
- data: {
152
- data: Array.from(statusCounts.entries()).map(([status, count]) => ({
153
- status,
154
- instances: count
155
- }))
156
- },
157
- title: "Instance Status Breakdown",
158
- description: "Status mix across workflow instances.",
159
- height: 260
160
- },
161
- {
162
- key: "workflow-throughput",
163
- spec: WorkflowThroughputVisualization,
164
- data: {
165
- data: Array.from(throughput.entries()).sort(([left], [right]) => left.localeCompare(right)).map(([day, count]) => ({ day, instances: count }))
166
- },
167
- title: "Run Throughput",
168
- description: "Daily workflow starts from current instances."
169
- }
170
- ];
171
- const comparisonItems = [
172
- {
173
- key: "workflow-active",
174
- spec: WorkflowActiveMetricVisualization,
175
- data: { data: [{ value: activeCount }] },
176
- title: "Active Work",
177
- description: "Pending and in-progress workflows.",
178
- height: 200
179
- },
180
- {
181
- key: "workflow-completed",
182
- spec: WorkflowCompletedMetricVisualization,
183
- data: { data: [{ value: completedCount }] },
184
- title: "Completed Work",
185
- description: "Completed workflows in the current sample.",
186
- height: 200
187
- }
188
- ];
189
- return {
190
- primaryItems,
191
- comparisonItems
192
- };
193
- }
194
- // src/ui/WorkflowDashboard.visualizations.tsx
195
- import {
196
- ComparisonView,
197
- VisualizationCard,
198
- VisualizationGrid
199
- } from "@contractspec/lib.design-system";
200
- import { jsxDEV } from "react/jsx-dev-runtime";
201
- "use client";
202
- function WorkflowVisualizationOverview({
203
- instances
204
- }) {
205
- const { primaryItems, comparisonItems } = createWorkflowVisualizationSections(instances);
206
- return /* @__PURE__ */ jsxDEV("section", {
207
- className: "space-y-4",
208
- children: [
209
- /* @__PURE__ */ jsxDEV("div", {
210
- children: [
211
- /* @__PURE__ */ jsxDEV("h3", {
212
- className: "font-semibold text-lg",
213
- children: "Workflow Visualizations"
214
- }, undefined, false, undefined, this),
215
- /* @__PURE__ */ jsxDEV("p", {
216
- className: "text-muted-foreground text-sm",
217
- children: "Contract-backed charts for workflow health and throughput."
218
- }, undefined, false, undefined, this)
219
- ]
220
- }, undefined, true, undefined, this),
221
- /* @__PURE__ */ jsxDEV(VisualizationGrid, {
222
- children: primaryItems.map((item) => /* @__PURE__ */ jsxDEV(VisualizationCard, {
223
- data: item.data,
224
- description: item.description,
225
- height: item.height,
226
- spec: item.spec,
227
- title: item.title
228
- }, item.key, false, undefined, this))
229
- }, undefined, false, undefined, this),
230
- /* @__PURE__ */ jsxDEV(ComparisonView, {
231
- description: "Shared comparison surface for active versus completed work.",
232
- items: comparisonItems,
233
- title: "Workload Comparison"
234
- }, undefined, false, undefined, this)
235
- ]
236
- }, undefined, true, undefined, this);
237
- }
238
- export {
239
- WorkflowVisualizationOverview
240
- };
2
+ import{defineVisualization as J,VisualizationRegistry as Y}from"@contractspec/lib.contracts-spec/visualizations";var K={key:"workflow.instance.list",version:"1.0.0"},L={version:"1.0.0",domain:"workflow",stability:"experimental",owners:["@example.workflow-system"],tags:["workflow","visualization","operations"]},N=J({meta:{...L,key:"workflow-system.visualization.instance-status",title:"Instance Status Breakdown",description:"Distribution of workflow instance states.",goal:"Surface the current workload mix.",context:"Workflow operations overview."},source:{primary:K,resultPath:"data"},visualization:{kind:"pie",nameDimension:"status",valueMeasure:"instances",dimensions:[{key:"status",label:"Status",dataPath:"status",type:"category"}],measures:[{key:"instances",label:"Instances",dataPath:"instances",format:"number"}],table:{caption:"Workflow instance counts by status."}}}),O=J({meta:{...L,key:"workflow-system.visualization.throughput",title:"Run Throughput",description:"Daily workflow instance starts.",goal:"Show operational throughput over time.",context:"Workflow trend monitoring."},source:{primary:K,resultPath:"data"},visualization:{kind:"cartesian",variant:"line",xDimension:"day",yMeasures:["instances"],dimensions:[{key:"day",label:"Day",dataPath:"day",type:"time"}],measures:[{key:"instances",label:"Instances",dataPath:"instances",format:"number",color:"#0f766e"}],table:{caption:"Daily workflow instance starts."}}}),P=J({meta:{...L,key:"workflow-system.visualization.active-work",title:"Active Work",description:"Current in-flight or pending workflow instances.",goal:"Expose active operational workload.",context:"Workflow workload comparison."},source:{primary:K,resultPath:"data"},visualization:{kind:"metric",measure:"value",measures:[{key:"value",label:"Instances",dataPath:"value",format:"number"}],table:{caption:"Active workflow count."}}}),Q=J({meta:{...L,key:"workflow-system.visualization.completed-work",title:"Completed Work",description:"Completed workflow instances in the current sample.",goal:"Show output against active workload.",context:"Workflow workload comparison."},source:{primary:K,resultPath:"data"},visualization:{kind:"metric",measure:"value",measures:[{key:"value",label:"Instances",dataPath:"value",format:"number"}],table:{caption:"Completed workflow count."}}}),T=[N,O,P,Q],S=new Y([...T]),f=T.map((q)=>({key:q.meta.key,version:q.meta.version}));function Z(q){return(q instanceof Date?q:new Date(q)).toISOString().slice(0,10)}function U(q){let E=new Map,F=new Map,B=0,R=0;for(let b of q){E.set(b.status,(E.get(b.status)??0)+1);let D=Z(b.startedAt);if(F.set(D,(F.get(D)??0)+1),b.status==="PENDING"||b.status==="IN_PROGRESS")B+=1;if(b.status==="COMPLETED")R+=1}return{primaryItems:[{key:"workflow-status",spec:N,data:{data:Array.from(E.entries()).map(([b,D])=>({status:b,instances:D}))},title:"Instance Status Breakdown",description:"Status mix across workflow instances.",height:260},{key:"workflow-throughput",spec:O,data:{data:Array.from(F.entries()).sort(([b],[D])=>b.localeCompare(D)).map(([b,D])=>({day:b,instances:D}))},title:"Run Throughput",description:"Daily workflow starts from current instances."}],comparisonItems:[{key:"workflow-active",spec:P,data:{data:[{value:B}]},title:"Active Work",description:"Pending and in-progress workflows.",height:200},{key:"workflow-completed",spec:Q,data:{data:[{value:R}]},title:"Completed Work",description:"Completed workflows in the current sample.",height:200}]}}import{ComparisonView as _,VisualizationCard as $,VisualizationGrid as A}from"@contractspec/lib.design-system";import{jsx as H,jsxs as X}from"react/jsx-runtime";function d({instances:q}){let{primaryItems:E,comparisonItems:F}=U(q);return X("section",{className:"space-y-4",children:[X("div",{children:[H("h3",{className:"font-semibold text-lg",children:"Workflow Visualizations"}),H("p",{className:"text-muted-foreground text-sm",children:"Contract-backed charts for workflow health and throughput."})]}),H(A,{children:E.map((B)=>H($,{data:B.data,description:B.description,height:B.height,spec:B.spec,title:B.title},B.key))}),H(_,{description:"Shared comparison surface for active versus completed work.",items:F,title:"Workload Comparison"})]})}export{d as WorkflowVisualizationOverview};
@@ -1,4 +1,2 @@
1
1
  // @bun
2
- export {
3
- useWorkflowList
4
- };
2
+ export{useWorkflowList};