business-as-code 0.2.1 → 2.0.2

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 (190) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +17 -0
  3. package/IMPLEMENTATION.md +226 -0
  4. package/README.md +1133 -193
  5. package/dist/business.d.ts +62 -0
  6. package/dist/business.d.ts.map +1 -0
  7. package/dist/business.js +109 -0
  8. package/dist/business.js.map +1 -0
  9. package/dist/dollar.d.ts +60 -0
  10. package/dist/dollar.d.ts.map +1 -0
  11. package/dist/dollar.js +107 -0
  12. package/dist/dollar.js.map +1 -0
  13. package/dist/entities/assets.d.ts +21 -0
  14. package/dist/entities/assets.d.ts.map +1 -0
  15. package/dist/entities/assets.js +323 -0
  16. package/dist/entities/assets.js.map +1 -0
  17. package/dist/entities/business.d.ts +36 -0
  18. package/dist/entities/business.d.ts.map +1 -0
  19. package/dist/entities/business.js +370 -0
  20. package/dist/entities/business.js.map +1 -0
  21. package/dist/entities/communication.d.ts +21 -0
  22. package/dist/entities/communication.d.ts.map +1 -0
  23. package/dist/entities/communication.js +255 -0
  24. package/dist/entities/communication.js.map +1 -0
  25. package/dist/entities/customers.d.ts +58 -0
  26. package/dist/entities/customers.d.ts.map +1 -0
  27. package/dist/entities/customers.js +989 -0
  28. package/dist/entities/customers.js.map +1 -0
  29. package/dist/entities/financials.d.ts +59 -0
  30. package/dist/entities/financials.d.ts.map +1 -0
  31. package/dist/entities/financials.js +932 -0
  32. package/dist/entities/financials.js.map +1 -0
  33. package/dist/entities/goals.d.ts +58 -0
  34. package/dist/entities/goals.d.ts.map +1 -0
  35. package/dist/entities/goals.js +800 -0
  36. package/dist/entities/goals.js.map +1 -0
  37. package/dist/entities/index.d.ts +299 -0
  38. package/dist/entities/index.d.ts.map +1 -0
  39. package/dist/entities/index.js +198 -0
  40. package/dist/entities/index.js.map +1 -0
  41. package/dist/entities/legal.d.ts +21 -0
  42. package/dist/entities/legal.d.ts.map +1 -0
  43. package/dist/entities/legal.js +301 -0
  44. package/dist/entities/legal.js.map +1 -0
  45. package/dist/entities/market.d.ts +21 -0
  46. package/dist/entities/market.d.ts.map +1 -0
  47. package/dist/entities/market.js +301 -0
  48. package/dist/entities/market.js.map +1 -0
  49. package/dist/entities/marketing.d.ts +67 -0
  50. package/dist/entities/marketing.d.ts.map +1 -0
  51. package/dist/entities/marketing.js +1157 -0
  52. package/dist/entities/marketing.js.map +1 -0
  53. package/dist/entities/offerings.d.ts +51 -0
  54. package/dist/entities/offerings.d.ts.map +1 -0
  55. package/dist/entities/offerings.js +727 -0
  56. package/dist/entities/offerings.js.map +1 -0
  57. package/dist/entities/operations.d.ts +58 -0
  58. package/dist/entities/operations.d.ts.map +1 -0
  59. package/dist/entities/operations.js +787 -0
  60. package/dist/entities/operations.js.map +1 -0
  61. package/dist/entities/organization.d.ts +57 -0
  62. package/dist/entities/organization.d.ts.map +1 -0
  63. package/dist/entities/organization.js +807 -0
  64. package/dist/entities/organization.js.map +1 -0
  65. package/dist/entities/partnerships.d.ts +21 -0
  66. package/dist/entities/partnerships.d.ts.map +1 -0
  67. package/dist/entities/partnerships.js +300 -0
  68. package/dist/entities/partnerships.js.map +1 -0
  69. package/dist/entities/planning.d.ts +87 -0
  70. package/dist/entities/planning.d.ts.map +1 -0
  71. package/dist/entities/planning.js +271 -0
  72. package/dist/entities/planning.js.map +1 -0
  73. package/dist/entities/projects.d.ts +25 -0
  74. package/dist/entities/projects.d.ts.map +1 -0
  75. package/dist/entities/projects.js +349 -0
  76. package/dist/entities/projects.js.map +1 -0
  77. package/dist/entities/risk.d.ts +21 -0
  78. package/dist/entities/risk.d.ts.map +1 -0
  79. package/dist/entities/risk.js +293 -0
  80. package/dist/entities/risk.js.map +1 -0
  81. package/dist/entities/sales.d.ts +72 -0
  82. package/dist/entities/sales.d.ts.map +1 -0
  83. package/dist/entities/sales.js +1248 -0
  84. package/dist/entities/sales.js.map +1 -0
  85. package/dist/financials.d.ts +130 -0
  86. package/dist/financials.d.ts.map +1 -0
  87. package/dist/financials.js +297 -0
  88. package/dist/financials.js.map +1 -0
  89. package/dist/goals.d.ts +87 -0
  90. package/dist/goals.d.ts.map +1 -0
  91. package/dist/goals.js +215 -0
  92. package/dist/goals.js.map +1 -0
  93. package/dist/index.d.ts +97 -4
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +131 -1079
  96. package/dist/index.js.map +1 -1
  97. package/dist/kpis.d.ts +118 -0
  98. package/dist/kpis.d.ts.map +1 -0
  99. package/dist/kpis.js +232 -0
  100. package/dist/kpis.js.map +1 -0
  101. package/dist/metrics.d.ts +448 -0
  102. package/dist/metrics.d.ts.map +1 -0
  103. package/dist/metrics.js +325 -0
  104. package/dist/metrics.js.map +1 -0
  105. package/dist/okrs.d.ts +123 -0
  106. package/dist/okrs.d.ts.map +1 -0
  107. package/dist/okrs.js +269 -0
  108. package/dist/okrs.js.map +1 -0
  109. package/dist/organization.d.ts +585 -0
  110. package/dist/organization.d.ts.map +1 -0
  111. package/dist/organization.js +173 -0
  112. package/dist/organization.js.map +1 -0
  113. package/dist/process.d.ts +112 -0
  114. package/dist/process.d.ts.map +1 -0
  115. package/dist/process.js +241 -0
  116. package/dist/process.js.map +1 -0
  117. package/dist/product.d.ts +85 -0
  118. package/dist/product.d.ts.map +1 -0
  119. package/dist/product.js +145 -0
  120. package/dist/product.js.map +1 -0
  121. package/dist/queries.d.ts +304 -0
  122. package/dist/queries.d.ts.map +1 -0
  123. package/dist/queries.js +415 -0
  124. package/dist/queries.js.map +1 -0
  125. package/dist/roles.d.ts +340 -0
  126. package/dist/roles.d.ts.map +1 -0
  127. package/dist/roles.js +255 -0
  128. package/dist/roles.js.map +1 -0
  129. package/dist/service.d.ts +61 -0
  130. package/dist/service.d.ts.map +1 -0
  131. package/dist/service.js +140 -0
  132. package/dist/service.js.map +1 -0
  133. package/dist/types.d.ts +459 -0
  134. package/dist/types.d.ts.map +1 -0
  135. package/dist/types.js +5 -0
  136. package/dist/types.js.map +1 -0
  137. package/dist/vision.d.ts +38 -0
  138. package/dist/vision.d.ts.map +1 -0
  139. package/dist/vision.js +68 -0
  140. package/dist/vision.js.map +1 -0
  141. package/dist/workflow.d.ts +115 -0
  142. package/dist/workflow.d.ts.map +1 -0
  143. package/dist/workflow.js +247 -0
  144. package/dist/workflow.js.map +1 -0
  145. package/examples/basic-usage.ts +307 -0
  146. package/package.json +19 -60
  147. package/src/business.ts +121 -0
  148. package/src/dollar.ts +132 -0
  149. package/src/entities/assets.ts +332 -0
  150. package/src/entities/business.ts +406 -0
  151. package/src/entities/communication.ts +264 -0
  152. package/src/entities/customers.ts +1072 -0
  153. package/src/entities/financials.ts +1011 -0
  154. package/src/entities/goals.ts +871 -0
  155. package/src/entities/index.ts +383 -0
  156. package/src/entities/legal.ts +310 -0
  157. package/src/entities/market.ts +310 -0
  158. package/src/entities/marketing.ts +1249 -0
  159. package/src/entities/offerings.ts +789 -0
  160. package/src/entities/operations.ts +861 -0
  161. package/src/entities/organization.ts +876 -0
  162. package/src/entities/partnerships.ts +309 -0
  163. package/src/entities/planning.ts +307 -0
  164. package/src/entities/projects.ts +360 -0
  165. package/src/entities/risk.ts +302 -0
  166. package/src/entities/sales.ts +1352 -0
  167. package/src/financials.ts +352 -0
  168. package/src/goals.ts +250 -0
  169. package/src/index.test.ts +336 -0
  170. package/src/index.ts +530 -0
  171. package/src/kpis.ts +275 -0
  172. package/src/metrics.ts +825 -0
  173. package/src/okrs.ts +325 -0
  174. package/src/organization.ts +909 -0
  175. package/src/process.ts +272 -0
  176. package/src/product.ts +178 -0
  177. package/src/queries.ts +767 -0
  178. package/src/roles.ts +686 -0
  179. package/src/service.ts +164 -0
  180. package/src/types.ts +493 -0
  181. package/src/vision.ts +88 -0
  182. package/src/workflow.ts +280 -0
  183. package/tsconfig.json +9 -0
  184. package/dist/loaders/index.d.ts +0 -174
  185. package/dist/loaders/index.js +0 -366
  186. package/dist/loaders/index.js.map +0 -1
  187. package/dist/schema/index.d.ts +0 -146
  188. package/dist/schema/index.js +0 -716
  189. package/dist/schema/index.js.map +0 -1
  190. package/dist/types-CJ9eGS_C.d.ts +0 -86
@@ -0,0 +1,787 @@
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
+ };
787
+ //# sourceMappingURL=operations.js.map