business-as-code 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/examples/basic-usage.js +282 -0
- package/package.json +3 -4
- package/src/business.js +108 -0
- package/src/dollar.js +106 -0
- package/src/entities/assets.js +322 -0
- package/src/entities/business.js +369 -0
- package/src/entities/communication.js +254 -0
- package/src/entities/customers.js +988 -0
- package/src/entities/financials.js +931 -0
- package/src/entities/goals.js +799 -0
- package/src/entities/index.js +197 -0
- package/src/entities/legal.js +300 -0
- package/src/entities/market.js +300 -0
- package/src/entities/marketing.js +1156 -0
- package/src/entities/offerings.js +726 -0
- package/src/entities/operations.js +786 -0
- package/src/entities/organization.js +806 -0
- package/src/entities/partnerships.js +299 -0
- package/src/entities/planning.js +270 -0
- package/src/entities/projects.js +348 -0
- package/src/entities/risk.js +292 -0
- package/src/entities/sales.js +1247 -0
- package/src/financials.js +296 -0
- package/src/goals.js +214 -0
- package/src/index.js +131 -0
- package/src/index.test.js +274 -0
- package/src/kpis.js +231 -0
- package/src/metrics.js +324 -0
- package/src/okrs.js +268 -0
- package/src/organization.js +172 -0
- package/src/process.js +240 -0
- package/src/product.js +144 -0
- package/src/queries.js +414 -0
- package/src/roles.js +254 -0
- package/src/service.js +139 -0
- package/src/types.js +4 -0
- package/src/vision.js +67 -0
- package/src/workflow.js +246 -0
|
@@ -0,0 +1,786 @@
|
|
|
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
|
+
};
|