business-as-code 2.1.3 → 2.3.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.
Files changed (260) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +2 -0
  3. package/package.json +16 -13
  4. package/src/dollar.ts +5 -2
  5. package/src/entities/organization.ts +31 -18
  6. package/src/goals.ts +78 -12
  7. package/src/index.ts +48 -18
  8. package/src/kpis.ts +62 -8
  9. package/src/metrics.ts +92 -79
  10. package/src/okrs.ts +120 -20
  11. package/src/organization.ts +12 -15
  12. package/src/process.ts +11 -12
  13. package/src/product.ts +8 -9
  14. package/src/queries.ts +238 -75
  15. package/src/roles.ts +62 -61
  16. package/src/workflow.ts +22 -15
  17. package/test/business.test.ts +282 -0
  18. package/test/dollar.test.ts +270 -0
  19. package/test/entities.test.ts +628 -0
  20. package/test/financials.test.ts +539 -0
  21. package/test/goals.test.ts +451 -0
  22. package/{src → test}/index.test.ts +1 -1
  23. package/test/kpis.test.ts +440 -0
  24. package/test/metrics.test.ts +744 -0
  25. package/test/okrs.test.ts +741 -0
  26. package/test/organization.test.ts +548 -0
  27. package/test/process.test.ts +503 -0
  28. package/test/product.test.ts +430 -0
  29. package/test/queries.test.ts +556 -0
  30. package/test/roles.test.ts +546 -0
  31. package/test/service.test.ts +450 -0
  32. package/test/types.test.ts +1141 -0
  33. package/test/vision.test.ts +214 -0
  34. package/test/workflow.test.ts +501 -0
  35. package/vitest.config.ts +47 -0
  36. package/.turbo/turbo-build.log +0 -5
  37. package/LICENSE +0 -21
  38. package/dist/business.d.ts +0 -62
  39. package/dist/business.d.ts.map +0 -1
  40. package/dist/business.js +0 -109
  41. package/dist/business.js.map +0 -1
  42. package/dist/canvas/activities.d.ts +0 -19
  43. package/dist/canvas/activities.d.ts.map +0 -1
  44. package/dist/canvas/activities.js +0 -20
  45. package/dist/canvas/activities.js.map +0 -1
  46. package/dist/canvas/channels.d.ts +0 -20
  47. package/dist/canvas/channels.d.ts.map +0 -1
  48. package/dist/canvas/channels.js +0 -21
  49. package/dist/canvas/channels.js.map +0 -1
  50. package/dist/canvas/relationships.d.ts +0 -20
  51. package/dist/canvas/relationships.d.ts.map +0 -1
  52. package/dist/canvas/relationships.js +0 -21
  53. package/dist/canvas/relationships.js.map +0 -1
  54. package/dist/canvas/resources.d.ts +0 -20
  55. package/dist/canvas/resources.d.ts.map +0 -1
  56. package/dist/canvas/resources.js +0 -30
  57. package/dist/canvas/resources.js.map +0 -1
  58. package/dist/canvas/revenue.d.ts +0 -22
  59. package/dist/canvas/revenue.d.ts.map +0 -1
  60. package/dist/canvas/revenue.js +0 -30
  61. package/dist/canvas/revenue.js.map +0 -1
  62. package/dist/canvas/segments.d.ts +0 -20
  63. package/dist/canvas/segments.d.ts.map +0 -1
  64. package/dist/canvas/segments.js +0 -28
  65. package/dist/canvas/segments.js.map +0 -1
  66. package/dist/canvas/types.d.ts +0 -232
  67. package/dist/canvas/types.d.ts.map +0 -1
  68. package/dist/canvas/types.js +0 -8
  69. package/dist/canvas/types.js.map +0 -1
  70. package/dist/canvas/value.d.ts +0 -20
  71. package/dist/canvas/value.d.ts.map +0 -1
  72. package/dist/canvas/value.js +0 -21
  73. package/dist/canvas/value.js.map +0 -1
  74. package/dist/dollar.d.ts +0 -60
  75. package/dist/dollar.d.ts.map +0 -1
  76. package/dist/dollar.js +0 -107
  77. package/dist/dollar.js.map +0 -1
  78. package/dist/entities/assets.d.ts +0 -21
  79. package/dist/entities/assets.d.ts.map +0 -1
  80. package/dist/entities/assets.js +0 -323
  81. package/dist/entities/assets.js.map +0 -1
  82. package/dist/entities/business.d.ts +0 -36
  83. package/dist/entities/business.d.ts.map +0 -1
  84. package/dist/entities/business.js +0 -370
  85. package/dist/entities/business.js.map +0 -1
  86. package/dist/entities/communication.d.ts +0 -21
  87. package/dist/entities/communication.d.ts.map +0 -1
  88. package/dist/entities/communication.js +0 -255
  89. package/dist/entities/communication.js.map +0 -1
  90. package/dist/entities/customers.d.ts +0 -58
  91. package/dist/entities/customers.d.ts.map +0 -1
  92. package/dist/entities/customers.js +0 -989
  93. package/dist/entities/customers.js.map +0 -1
  94. package/dist/entities/financials.d.ts +0 -59
  95. package/dist/entities/financials.d.ts.map +0 -1
  96. package/dist/entities/financials.js +0 -932
  97. package/dist/entities/financials.js.map +0 -1
  98. package/dist/entities/goals.d.ts +0 -58
  99. package/dist/entities/goals.d.ts.map +0 -1
  100. package/dist/entities/goals.js +0 -800
  101. package/dist/entities/goals.js.map +0 -1
  102. package/dist/entities/index.d.ts +0 -299
  103. package/dist/entities/index.d.ts.map +0 -1
  104. package/dist/entities/index.js +0 -198
  105. package/dist/entities/index.js.map +0 -1
  106. package/dist/entities/legal.d.ts +0 -21
  107. package/dist/entities/legal.d.ts.map +0 -1
  108. package/dist/entities/legal.js +0 -301
  109. package/dist/entities/legal.js.map +0 -1
  110. package/dist/entities/market.d.ts +0 -21
  111. package/dist/entities/market.d.ts.map +0 -1
  112. package/dist/entities/market.js +0 -301
  113. package/dist/entities/market.js.map +0 -1
  114. package/dist/entities/marketing.d.ts +0 -67
  115. package/dist/entities/marketing.d.ts.map +0 -1
  116. package/dist/entities/marketing.js +0 -1157
  117. package/dist/entities/marketing.js.map +0 -1
  118. package/dist/entities/offerings.d.ts +0 -51
  119. package/dist/entities/offerings.d.ts.map +0 -1
  120. package/dist/entities/offerings.js +0 -727
  121. package/dist/entities/offerings.js.map +0 -1
  122. package/dist/entities/operations.d.ts +0 -58
  123. package/dist/entities/operations.d.ts.map +0 -1
  124. package/dist/entities/operations.js +0 -787
  125. package/dist/entities/operations.js.map +0 -1
  126. package/dist/entities/organization.d.ts +0 -57
  127. package/dist/entities/organization.d.ts.map +0 -1
  128. package/dist/entities/organization.js +0 -807
  129. package/dist/entities/organization.js.map +0 -1
  130. package/dist/entities/partnerships.d.ts +0 -21
  131. package/dist/entities/partnerships.d.ts.map +0 -1
  132. package/dist/entities/partnerships.js +0 -300
  133. package/dist/entities/partnerships.js.map +0 -1
  134. package/dist/entities/planning.d.ts +0 -0
  135. package/dist/entities/planning.d.ts.map +0 -1
  136. package/dist/entities/planning.js +0 -271
  137. package/dist/entities/planning.js.map +0 -1
  138. package/dist/entities/projects.d.ts +0 -25
  139. package/dist/entities/projects.d.ts.map +0 -1
  140. package/dist/entities/projects.js +0 -349
  141. package/dist/entities/projects.js.map +0 -1
  142. package/dist/entities/risk.d.ts +0 -21
  143. package/dist/entities/risk.d.ts.map +0 -1
  144. package/dist/entities/risk.js +0 -293
  145. package/dist/entities/risk.js.map +0 -1
  146. package/dist/entities/sales.d.ts +0 -72
  147. package/dist/entities/sales.d.ts.map +0 -1
  148. package/dist/entities/sales.js +0 -1248
  149. package/dist/entities/sales.js.map +0 -1
  150. package/dist/financials.d.ts +0 -130
  151. package/dist/financials.d.ts.map +0 -1
  152. package/dist/financials.js +0 -297
  153. package/dist/financials.js.map +0 -1
  154. package/dist/goals.d.ts +0 -87
  155. package/dist/goals.d.ts.map +0 -1
  156. package/dist/goals.js +0 -215
  157. package/dist/goals.js.map +0 -1
  158. package/dist/index.d.ts +0 -97
  159. package/dist/index.d.ts.map +0 -1
  160. package/dist/index.js +0 -132
  161. package/dist/index.js.map +0 -1
  162. package/dist/kpis.d.ts +0 -118
  163. package/dist/kpis.d.ts.map +0 -1
  164. package/dist/kpis.js +0 -232
  165. package/dist/kpis.js.map +0 -1
  166. package/dist/metrics.d.ts +0 -448
  167. package/dist/metrics.d.ts.map +0 -1
  168. package/dist/metrics.js +0 -325
  169. package/dist/metrics.js.map +0 -1
  170. package/dist/okrs.d.ts +0 -123
  171. package/dist/okrs.d.ts.map +0 -1
  172. package/dist/okrs.js +0 -269
  173. package/dist/okrs.js.map +0 -1
  174. package/dist/organization.d.ts +0 -585
  175. package/dist/organization.d.ts.map +0 -1
  176. package/dist/organization.js +0 -173
  177. package/dist/organization.js.map +0 -1
  178. package/dist/process.d.ts +0 -112
  179. package/dist/process.d.ts.map +0 -1
  180. package/dist/process.js +0 -241
  181. package/dist/process.js.map +0 -1
  182. package/dist/product.d.ts +0 -85
  183. package/dist/product.d.ts.map +0 -1
  184. package/dist/product.js +0 -145
  185. package/dist/product.js.map +0 -1
  186. package/dist/queries.d.ts +0 -304
  187. package/dist/queries.d.ts.map +0 -1
  188. package/dist/queries.js +0 -415
  189. package/dist/queries.js.map +0 -1
  190. package/dist/roles.d.ts +0 -340
  191. package/dist/roles.d.ts.map +0 -1
  192. package/dist/roles.js +0 -255
  193. package/dist/roles.js.map +0 -1
  194. package/dist/service.d.ts +0 -61
  195. package/dist/service.d.ts.map +0 -1
  196. package/dist/service.js +0 -140
  197. package/dist/service.js.map +0 -1
  198. package/dist/types.d.ts +0 -459
  199. package/dist/types.d.ts.map +0 -1
  200. package/dist/types.js +0 -5
  201. package/dist/types.js.map +0 -1
  202. package/dist/vision.d.ts +0 -38
  203. package/dist/vision.d.ts.map +0 -1
  204. package/dist/vision.js +0 -68
  205. package/dist/vision.js.map +0 -1
  206. package/dist/workflow.d.ts +0 -115
  207. package/dist/workflow.d.ts.map +0 -1
  208. package/dist/workflow.js +0 -247
  209. package/dist/workflow.js.map +0 -1
  210. package/src/business.js +0 -108
  211. package/src/canvas/activities.ts +0 -32
  212. package/src/canvas/canvas.ts +0 -482
  213. package/src/canvas/channels.ts +0 -34
  214. package/src/canvas/costs.ts +0 -43
  215. package/src/canvas/economics.ts +0 -99
  216. package/src/canvas/index.ts +0 -206
  217. package/src/canvas/partnerships.ts +0 -34
  218. package/src/canvas/projections.ts +0 -141
  219. package/src/canvas/relationships.ts +0 -34
  220. package/src/canvas/resources.ts +0 -43
  221. package/src/canvas/revenue.ts +0 -56
  222. package/src/canvas/segments.ts +0 -42
  223. package/src/canvas/types.ts +0 -363
  224. package/src/canvas/value.ts +0 -34
  225. package/src/dollar.js +0 -106
  226. package/src/entities/assets.js +0 -322
  227. package/src/entities/business.js +0 -369
  228. package/src/entities/communication.js +0 -254
  229. package/src/entities/customers.js +0 -988
  230. package/src/entities/financials.js +0 -931
  231. package/src/entities/goals.js +0 -799
  232. package/src/entities/index.js +0 -197
  233. package/src/entities/legal.js +0 -300
  234. package/src/entities/market.js +0 -300
  235. package/src/entities/marketing.js +0 -1156
  236. package/src/entities/offerings.js +0 -726
  237. package/src/entities/operations.js +0 -786
  238. package/src/entities/organization.js +0 -806
  239. package/src/entities/partnerships.js +0 -299
  240. package/src/entities/planning.js +0 -270
  241. package/src/entities/projects.js +0 -348
  242. package/src/entities/risk.js +0 -292
  243. package/src/entities/sales.js +0 -1247
  244. package/src/financials.js +0 -296
  245. package/src/goals.js +0 -214
  246. package/src/index.js +0 -131
  247. package/src/index.test.js +0 -274
  248. package/src/kpis.js +0 -231
  249. package/src/metrics.js +0 -324
  250. package/src/okrs.js +0 -268
  251. package/src/organization.js +0 -172
  252. package/src/process.js +0 -240
  253. package/src/product.js +0 -144
  254. package/src/queries.js +0 -414
  255. package/src/roles.js +0 -254
  256. package/src/service.js +0 -139
  257. package/src/types.js +0 -4
  258. package/src/vision.js +0 -67
  259. package/src/workflow.js +0 -246
  260. package/tests/canvas.test.ts +0 -842
@@ -1,786 +0,0 @@
1
- /**
2
- * Operations Entity Types (Nouns)
3
- *
4
- * Business operations: Process, Workflow, Procedure, Policy.
5
- *
6
- * @packageDocumentation
7
- */
8
- // =============================================================================
9
- // Process
10
- // =============================================================================
11
- /**
12
- * Process entity
13
- *
14
- * Represents a business process with defined steps.
15
- */
16
- export const Process = {
17
- singular: 'process',
18
- plural: 'processes',
19
- description: 'A business process with defined steps',
20
- properties: {
21
- // Identity
22
- name: {
23
- type: 'string',
24
- description: 'Process name',
25
- },
26
- slug: {
27
- type: 'string',
28
- optional: true,
29
- description: 'URL-friendly identifier',
30
- },
31
- description: {
32
- type: 'string',
33
- optional: true,
34
- description: 'Process description',
35
- },
36
- // Classification
37
- type: {
38
- type: 'string',
39
- optional: true,
40
- description: 'Process type',
41
- examples: ['core', 'support', 'management'],
42
- },
43
- category: {
44
- type: 'string',
45
- optional: true,
46
- description: 'Process category',
47
- examples: ['sales', 'marketing', 'operations', 'finance', 'hr', 'engineering', 'support'],
48
- },
49
- // Flow
50
- triggerType: {
51
- type: 'string',
52
- optional: true,
53
- description: 'How process is triggered',
54
- examples: ['manual', 'event', 'schedule', 'condition'],
55
- },
56
- triggerDescription: {
57
- type: 'string',
58
- optional: true,
59
- description: 'Trigger description',
60
- },
61
- // IO
62
- inputs: {
63
- type: 'string',
64
- array: true,
65
- optional: true,
66
- description: 'Required inputs',
67
- },
68
- outputs: {
69
- type: 'string',
70
- array: true,
71
- optional: true,
72
- description: 'Expected outputs',
73
- },
74
- // Metrics
75
- averageDuration: {
76
- type: 'string',
77
- optional: true,
78
- description: 'Average completion time',
79
- },
80
- sla: {
81
- type: 'string',
82
- optional: true,
83
- description: 'SLA target',
84
- },
85
- // Automation
86
- automationLevel: {
87
- type: 'string',
88
- optional: true,
89
- description: 'Automation level',
90
- examples: ['manual', 'semi-automated', 'automated', 'autonomous'],
91
- },
92
- automationPercentage: {
93
- type: 'number',
94
- optional: true,
95
- description: 'Percentage automated (0-100)',
96
- },
97
- // Versioning
98
- version: {
99
- type: 'string',
100
- optional: true,
101
- description: 'Process version',
102
- },
103
- // Status
104
- status: {
105
- type: 'string',
106
- description: 'Process status',
107
- examples: ['draft', 'active', 'deprecated', 'archived'],
108
- },
109
- },
110
- relationships: {
111
- owner: {
112
- type: 'Worker',
113
- required: false,
114
- description: 'Process owner',
115
- },
116
- department: {
117
- type: 'Department',
118
- required: false,
119
- description: 'Owning department',
120
- },
121
- steps: {
122
- type: 'ProcessStep[]',
123
- description: 'Process steps',
124
- },
125
- workflows: {
126
- type: 'Workflow[]',
127
- description: 'Implementing workflows',
128
- },
129
- metrics: {
130
- type: 'KPI[]',
131
- description: 'Process metrics',
132
- },
133
- },
134
- actions: [
135
- 'create',
136
- 'update',
137
- 'publish',
138
- 'addStep',
139
- 'removeStep',
140
- 'reorderSteps',
141
- 'automate',
142
- 'deprecate',
143
- 'archive',
144
- ],
145
- events: [
146
- 'created',
147
- 'updated',
148
- 'published',
149
- 'stepAdded',
150
- 'stepRemoved',
151
- 'stepsReordered',
152
- 'automated',
153
- 'deprecated',
154
- 'archived',
155
- ],
156
- };
157
- // =============================================================================
158
- // ProcessStep
159
- // =============================================================================
160
- /**
161
- * ProcessStep entity
162
- *
163
- * Represents a step within a business process.
164
- */
165
- export const ProcessStep = {
166
- singular: 'process-step',
167
- plural: 'process-steps',
168
- description: 'A step within a business process',
169
- properties: {
170
- // Identity
171
- name: {
172
- type: 'string',
173
- description: 'Step name',
174
- },
175
- description: {
176
- type: 'string',
177
- optional: true,
178
- description: 'Step description',
179
- },
180
- // Order
181
- order: {
182
- type: 'number',
183
- description: 'Step order',
184
- },
185
- // Execution
186
- type: {
187
- type: 'string',
188
- optional: true,
189
- description: 'Step type',
190
- examples: ['task', 'decision', 'approval', 'notification', 'wait', 'parallel', 'subprocess'],
191
- },
192
- automationLevel: {
193
- type: 'string',
194
- optional: true,
195
- description: 'Automation level',
196
- examples: ['manual', 'semi-automated', 'automated'],
197
- },
198
- // Assignment
199
- responsible: {
200
- type: 'string',
201
- optional: true,
202
- description: 'Responsible role or person',
203
- },
204
- accountable: {
205
- type: 'string',
206
- optional: true,
207
- description: 'Accountable role or person',
208
- },
209
- // Time
210
- estimatedDuration: {
211
- type: 'string',
212
- optional: true,
213
- description: 'Estimated duration',
214
- },
215
- sla: {
216
- type: 'string',
217
- optional: true,
218
- description: 'SLA for this step',
219
- },
220
- // IO
221
- inputs: {
222
- type: 'string',
223
- array: true,
224
- optional: true,
225
- description: 'Required inputs',
226
- },
227
- outputs: {
228
- type: 'string',
229
- array: true,
230
- optional: true,
231
- description: 'Expected outputs',
232
- },
233
- // Instructions
234
- instructions: {
235
- type: 'markdown',
236
- optional: true,
237
- description: 'Step instructions',
238
- },
239
- // Conditions
240
- condition: {
241
- type: 'string',
242
- optional: true,
243
- description: 'Condition for step execution',
244
- },
245
- },
246
- relationships: {
247
- process: {
248
- type: 'Process',
249
- description: 'Parent process',
250
- },
251
- nextStep: {
252
- type: 'ProcessStep',
253
- required: false,
254
- description: 'Next step',
255
- },
256
- alternatives: {
257
- type: 'ProcessStep[]',
258
- description: 'Alternative next steps (for decisions)',
259
- },
260
- },
261
- actions: [
262
- 'create',
263
- 'update',
264
- 'move',
265
- 'duplicate',
266
- 'delete',
267
- ],
268
- events: [
269
- 'created',
270
- 'updated',
271
- 'moved',
272
- 'duplicated',
273
- 'deleted',
274
- ],
275
- };
276
- // =============================================================================
277
- // Workflow
278
- // =============================================================================
279
- /**
280
- * Workflow entity
281
- *
282
- * Represents an automated workflow.
283
- */
284
- export const Workflow = {
285
- singular: 'workflow',
286
- plural: 'workflows',
287
- description: 'An automated workflow',
288
- properties: {
289
- // Identity
290
- name: {
291
- type: 'string',
292
- description: 'Workflow name',
293
- },
294
- slug: {
295
- type: 'string',
296
- optional: true,
297
- description: 'URL-friendly identifier',
298
- },
299
- description: {
300
- type: 'string',
301
- optional: true,
302
- description: 'Workflow description',
303
- },
304
- // Trigger
305
- triggerType: {
306
- type: 'string',
307
- description: 'Trigger type',
308
- examples: ['event', 'schedule', 'webhook', 'manual', 'api'],
309
- },
310
- triggerEvent: {
311
- type: 'string',
312
- optional: true,
313
- description: 'Trigger event name',
314
- },
315
- triggerSchedule: {
316
- type: 'string',
317
- optional: true,
318
- description: 'Cron schedule',
319
- },
320
- triggerWebhook: {
321
- type: 'url',
322
- optional: true,
323
- description: 'Webhook URL',
324
- },
325
- triggerCondition: {
326
- type: 'string',
327
- optional: true,
328
- description: 'Trigger condition',
329
- },
330
- // Execution
331
- timeout: {
332
- type: 'number',
333
- optional: true,
334
- description: 'Timeout in seconds',
335
- },
336
- retryPolicy: {
337
- type: 'json',
338
- optional: true,
339
- description: 'Retry policy',
340
- },
341
- concurrency: {
342
- type: 'number',
343
- optional: true,
344
- description: 'Max concurrent executions',
345
- },
346
- // Stats
347
- runCount: {
348
- type: 'number',
349
- optional: true,
350
- description: 'Total run count',
351
- },
352
- successCount: {
353
- type: 'number',
354
- optional: true,
355
- description: 'Successful runs',
356
- },
357
- failureCount: {
358
- type: 'number',
359
- optional: true,
360
- description: 'Failed runs',
361
- },
362
- lastRunAt: {
363
- type: 'datetime',
364
- optional: true,
365
- description: 'Last run time',
366
- },
367
- lastRunStatus: {
368
- type: 'string',
369
- optional: true,
370
- description: 'Last run status',
371
- },
372
- // Status
373
- status: {
374
- type: 'string',
375
- description: 'Workflow status',
376
- examples: ['draft', 'active', 'paused', 'error', 'archived'],
377
- },
378
- enabled: {
379
- type: 'boolean',
380
- optional: true,
381
- description: 'Is enabled',
382
- },
383
- },
384
- relationships: {
385
- owner: {
386
- type: 'Worker',
387
- required: false,
388
- description: 'Workflow owner',
389
- },
390
- team: {
391
- type: 'Team',
392
- required: false,
393
- description: 'Owning team',
394
- },
395
- process: {
396
- type: 'Process',
397
- required: false,
398
- description: 'Parent process',
399
- },
400
- actions: {
401
- type: 'WorkflowAction[]',
402
- description: 'Workflow actions',
403
- },
404
- runs: {
405
- type: 'WorkflowRun[]',
406
- description: 'Execution history',
407
- },
408
- },
409
- actions: [
410
- 'create',
411
- 'update',
412
- 'enable',
413
- 'disable',
414
- 'trigger',
415
- 'test',
416
- 'addAction',
417
- 'removeAction',
418
- 'archive',
419
- ],
420
- events: [
421
- 'created',
422
- 'updated',
423
- 'enabled',
424
- 'disabled',
425
- 'triggered',
426
- 'completed',
427
- 'failed',
428
- 'archived',
429
- ],
430
- };
431
- // =============================================================================
432
- // WorkflowAction
433
- // =============================================================================
434
- /**
435
- * WorkflowAction entity
436
- *
437
- * Represents an action step within a workflow.
438
- */
439
- export const WorkflowAction = {
440
- singular: 'workflow-action',
441
- plural: 'workflow-actions',
442
- description: 'An action step within a workflow',
443
- properties: {
444
- // Identity
445
- name: {
446
- type: 'string',
447
- optional: true,
448
- description: 'Action name',
449
- },
450
- // Order
451
- order: {
452
- type: 'number',
453
- description: 'Action order',
454
- },
455
- // Type
456
- type: {
457
- type: 'string',
458
- description: 'Action type',
459
- examples: ['http', 'email', 'slack', 'database', 'transform', 'condition', 'loop', 'delay', 'approval', 'ai'],
460
- },
461
- operation: {
462
- type: 'string',
463
- optional: true,
464
- description: 'Operation to perform',
465
- },
466
- // Configuration
467
- config: {
468
- type: 'json',
469
- optional: true,
470
- description: 'Action configuration',
471
- },
472
- inputs: {
473
- type: 'json',
474
- optional: true,
475
- description: 'Input mappings',
476
- },
477
- // Conditions
478
- condition: {
479
- type: 'string',
480
- optional: true,
481
- description: 'Execution condition',
482
- },
483
- // Error handling
484
- continueOnError: {
485
- type: 'boolean',
486
- optional: true,
487
- description: 'Continue on error',
488
- },
489
- retryOnFailure: {
490
- type: 'boolean',
491
- optional: true,
492
- description: 'Retry on failure',
493
- },
494
- maxRetries: {
495
- type: 'number',
496
- optional: true,
497
- description: 'Max retry attempts',
498
- },
499
- },
500
- relationships: {
501
- workflow: {
502
- type: 'Workflow',
503
- description: 'Parent workflow',
504
- },
505
- nextAction: {
506
- type: 'WorkflowAction',
507
- required: false,
508
- description: 'Next action',
509
- },
510
- },
511
- actions: [
512
- 'create',
513
- 'update',
514
- 'move',
515
- 'duplicate',
516
- 'delete',
517
- 'test',
518
- ],
519
- events: [
520
- 'created',
521
- 'updated',
522
- 'moved',
523
- 'duplicated',
524
- 'deleted',
525
- 'executed',
526
- 'failed',
527
- ],
528
- };
529
- // =============================================================================
530
- // WorkflowRun
531
- // =============================================================================
532
- /**
533
- * WorkflowRun entity
534
- *
535
- * Represents a workflow execution instance.
536
- */
537
- export const WorkflowRun = {
538
- singular: 'workflow-run',
539
- plural: 'workflow-runs',
540
- description: 'A workflow execution instance',
541
- properties: {
542
- // Status
543
- status: {
544
- type: 'string',
545
- description: 'Run status',
546
- examples: ['pending', 'running', 'completed', 'failed', 'cancelled', 'waiting'],
547
- },
548
- // Timing
549
- startedAt: {
550
- type: 'datetime',
551
- optional: true,
552
- description: 'Start time',
553
- },
554
- completedAt: {
555
- type: 'datetime',
556
- optional: true,
557
- description: 'Completion time',
558
- },
559
- duration: {
560
- type: 'number',
561
- optional: true,
562
- description: 'Duration in milliseconds',
563
- },
564
- // Progress
565
- currentStep: {
566
- type: 'number',
567
- optional: true,
568
- description: 'Current step number',
569
- },
570
- totalSteps: {
571
- type: 'number',
572
- optional: true,
573
- description: 'Total steps',
574
- },
575
- // IO
576
- triggerData: {
577
- type: 'json',
578
- optional: true,
579
- description: 'Trigger input data',
580
- },
581
- output: {
582
- type: 'json',
583
- optional: true,
584
- description: 'Final output',
585
- },
586
- // Error
587
- error: {
588
- type: 'string',
589
- optional: true,
590
- description: 'Error message',
591
- },
592
- errorStep: {
593
- type: 'number',
594
- optional: true,
595
- description: 'Step that failed',
596
- },
597
- // Retry
598
- attempt: {
599
- type: 'number',
600
- optional: true,
601
- description: 'Attempt number',
602
- },
603
- },
604
- relationships: {
605
- workflow: {
606
- type: 'Workflow',
607
- description: 'Parent workflow',
608
- },
609
- triggeredBy: {
610
- type: 'Worker',
611
- required: false,
612
- description: 'Who triggered the run',
613
- },
614
- stepResults: {
615
- type: 'WorkflowStepResult[]',
616
- description: 'Step execution results',
617
- },
618
- },
619
- actions: [
620
- 'start',
621
- 'pause',
622
- 'resume',
623
- 'cancel',
624
- 'retry',
625
- ],
626
- events: [
627
- 'started',
628
- 'paused',
629
- 'resumed',
630
- 'completed',
631
- 'failed',
632
- 'cancelled',
633
- 'retried',
634
- ],
635
- };
636
- // =============================================================================
637
- // Policy
638
- // =============================================================================
639
- /**
640
- * Policy entity
641
- *
642
- * Represents a business policy or rule.
643
- */
644
- export const Policy = {
645
- singular: 'policy',
646
- plural: 'policies',
647
- description: 'A business policy or rule',
648
- properties: {
649
- // Identity
650
- name: {
651
- type: 'string',
652
- description: 'Policy name',
653
- },
654
- code: {
655
- type: 'string',
656
- optional: true,
657
- description: 'Policy code',
658
- },
659
- description: {
660
- type: 'string',
661
- optional: true,
662
- description: 'Policy description',
663
- },
664
- // Classification
665
- type: {
666
- type: 'string',
667
- optional: true,
668
- description: 'Policy type',
669
- examples: ['compliance', 'operational', 'security', 'hr', 'financial', 'data'],
670
- },
671
- category: {
672
- type: 'string',
673
- optional: true,
674
- description: 'Policy category',
675
- },
676
- // Content
677
- content: {
678
- type: 'markdown',
679
- optional: true,
680
- description: 'Policy content',
681
- },
682
- rules: {
683
- type: 'string',
684
- array: true,
685
- optional: true,
686
- description: 'Policy rules',
687
- },
688
- // Enforcement
689
- enforcementLevel: {
690
- type: 'string',
691
- optional: true,
692
- description: 'Enforcement level',
693
- examples: ['mandatory', 'recommended', 'optional'],
694
- },
695
- violations: {
696
- type: 'string',
697
- array: true,
698
- optional: true,
699
- description: 'Violation consequences',
700
- },
701
- // Dates
702
- effectiveDate: {
703
- type: 'date',
704
- optional: true,
705
- description: 'Effective date',
706
- },
707
- reviewDate: {
708
- type: 'date',
709
- optional: true,
710
- description: 'Next review date',
711
- },
712
- expirationDate: {
713
- type: 'date',
714
- optional: true,
715
- description: 'Expiration date',
716
- },
717
- // Versioning
718
- version: {
719
- type: 'string',
720
- optional: true,
721
- description: 'Policy version',
722
- },
723
- // Status
724
- status: {
725
- type: 'string',
726
- description: 'Policy status',
727
- examples: ['draft', 'review', 'active', 'superseded', 'archived'],
728
- },
729
- },
730
- relationships: {
731
- owner: {
732
- type: 'Worker',
733
- required: false,
734
- description: 'Policy owner',
735
- },
736
- department: {
737
- type: 'Department',
738
- required: false,
739
- description: 'Owning department',
740
- },
741
- supersedes: {
742
- type: 'Policy',
743
- required: false,
744
- description: 'Previous version superseded',
745
- },
746
- supersededBy: {
747
- type: 'Policy',
748
- required: false,
749
- description: 'New version that supersedes this',
750
- },
751
- },
752
- actions: [
753
- 'create',
754
- 'update',
755
- 'submit',
756
- 'approve',
757
- 'publish',
758
- 'supersede',
759
- 'archive',
760
- ],
761
- events: [
762
- 'created',
763
- 'updated',
764
- 'submitted',
765
- 'approved',
766
- 'published',
767
- 'superseded',
768
- 'archived',
769
- ],
770
- };
771
- // =============================================================================
772
- // Exports
773
- // =============================================================================
774
- export const OperationsEntities = {
775
- Process,
776
- ProcessStep,
777
- Workflow,
778
- WorkflowAction,
779
- WorkflowRun,
780
- Policy,
781
- };
782
- export const OperationsCategories = {
783
- processes: ['Process', 'ProcessStep'],
784
- automation: ['Workflow', 'WorkflowAction', 'WorkflowRun'],
785
- governance: ['Policy'],
786
- };