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