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,799 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Goal Entity Types (Nouns)
|
|
3
|
+
*
|
|
4
|
+
* Goal tracking entities: Goal, OKR, KPI, Metric.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Goal
|
|
10
|
+
// =============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Goal entity
|
|
13
|
+
*
|
|
14
|
+
* Represents a strategic or operational goal.
|
|
15
|
+
*/
|
|
16
|
+
export const Goal = {
|
|
17
|
+
singular: 'goal',
|
|
18
|
+
plural: 'goals',
|
|
19
|
+
description: 'A strategic or operational goal',
|
|
20
|
+
properties: {
|
|
21
|
+
// Identity
|
|
22
|
+
name: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'Goal name/title',
|
|
25
|
+
},
|
|
26
|
+
description: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
optional: true,
|
|
29
|
+
description: 'Goal description',
|
|
30
|
+
},
|
|
31
|
+
// Classification
|
|
32
|
+
type: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
optional: true,
|
|
35
|
+
description: 'Goal type',
|
|
36
|
+
examples: ['strategic', 'operational', 'tactical'],
|
|
37
|
+
},
|
|
38
|
+
category: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
optional: true,
|
|
41
|
+
description: 'Goal category',
|
|
42
|
+
examples: ['growth', 'revenue', 'customer', 'product', 'operations', 'people', 'financial'],
|
|
43
|
+
},
|
|
44
|
+
priority: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
optional: true,
|
|
47
|
+
description: 'Priority level',
|
|
48
|
+
examples: ['critical', 'high', 'medium', 'low'],
|
|
49
|
+
},
|
|
50
|
+
// Timeline
|
|
51
|
+
startDate: {
|
|
52
|
+
type: 'date',
|
|
53
|
+
optional: true,
|
|
54
|
+
description: 'Start date',
|
|
55
|
+
},
|
|
56
|
+
targetDate: {
|
|
57
|
+
type: 'date',
|
|
58
|
+
optional: true,
|
|
59
|
+
description: 'Target completion date',
|
|
60
|
+
},
|
|
61
|
+
completedAt: {
|
|
62
|
+
type: 'datetime',
|
|
63
|
+
optional: true,
|
|
64
|
+
description: 'Actual completion time',
|
|
65
|
+
},
|
|
66
|
+
// Progress
|
|
67
|
+
progress: {
|
|
68
|
+
type: 'number',
|
|
69
|
+
optional: true,
|
|
70
|
+
description: 'Progress percentage (0-100)',
|
|
71
|
+
},
|
|
72
|
+
confidence: {
|
|
73
|
+
type: 'number',
|
|
74
|
+
optional: true,
|
|
75
|
+
description: 'Confidence level (0-100)',
|
|
76
|
+
},
|
|
77
|
+
// Success Criteria
|
|
78
|
+
successMetrics: {
|
|
79
|
+
type: 'string',
|
|
80
|
+
array: true,
|
|
81
|
+
optional: true,
|
|
82
|
+
description: 'Success metrics',
|
|
83
|
+
},
|
|
84
|
+
targetValue: {
|
|
85
|
+
type: 'number',
|
|
86
|
+
optional: true,
|
|
87
|
+
description: 'Target value for primary metric',
|
|
88
|
+
},
|
|
89
|
+
currentValue: {
|
|
90
|
+
type: 'number',
|
|
91
|
+
optional: true,
|
|
92
|
+
description: 'Current value for primary metric',
|
|
93
|
+
},
|
|
94
|
+
unit: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
optional: true,
|
|
97
|
+
description: 'Metric unit',
|
|
98
|
+
},
|
|
99
|
+
// Status
|
|
100
|
+
status: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
description: 'Goal status',
|
|
103
|
+
examples: ['draft', 'active', 'on-track', 'at-risk', 'behind', 'completed', 'cancelled'],
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
relationships: {
|
|
107
|
+
owner: {
|
|
108
|
+
type: 'Worker',
|
|
109
|
+
required: false,
|
|
110
|
+
description: 'Goal owner',
|
|
111
|
+
},
|
|
112
|
+
team: {
|
|
113
|
+
type: 'Team',
|
|
114
|
+
required: false,
|
|
115
|
+
description: 'Responsible team',
|
|
116
|
+
},
|
|
117
|
+
department: {
|
|
118
|
+
type: 'Department',
|
|
119
|
+
required: false,
|
|
120
|
+
description: 'Responsible department',
|
|
121
|
+
},
|
|
122
|
+
parent: {
|
|
123
|
+
type: 'Goal',
|
|
124
|
+
required: false,
|
|
125
|
+
description: 'Parent goal',
|
|
126
|
+
},
|
|
127
|
+
children: {
|
|
128
|
+
type: 'Goal[]',
|
|
129
|
+
description: 'Sub-goals',
|
|
130
|
+
},
|
|
131
|
+
dependencies: {
|
|
132
|
+
type: 'Goal[]',
|
|
133
|
+
description: 'Goals this depends on',
|
|
134
|
+
},
|
|
135
|
+
kpis: {
|
|
136
|
+
type: 'KPI[]',
|
|
137
|
+
description: 'Related KPIs',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
actions: [
|
|
141
|
+
'create',
|
|
142
|
+
'update',
|
|
143
|
+
'activate',
|
|
144
|
+
'updateProgress',
|
|
145
|
+
'markAtRisk',
|
|
146
|
+
'complete',
|
|
147
|
+
'cancel',
|
|
148
|
+
'extend',
|
|
149
|
+
'archive',
|
|
150
|
+
],
|
|
151
|
+
events: [
|
|
152
|
+
'created',
|
|
153
|
+
'updated',
|
|
154
|
+
'activated',
|
|
155
|
+
'progressUpdated',
|
|
156
|
+
'markedAtRisk',
|
|
157
|
+
'completed',
|
|
158
|
+
'cancelled',
|
|
159
|
+
'extended',
|
|
160
|
+
'overdue',
|
|
161
|
+
'archived',
|
|
162
|
+
],
|
|
163
|
+
};
|
|
164
|
+
// =============================================================================
|
|
165
|
+
// OKR (Objective and Key Results)
|
|
166
|
+
// =============================================================================
|
|
167
|
+
/**
|
|
168
|
+
* OKR entity
|
|
169
|
+
*
|
|
170
|
+
* Represents an objective with measurable key results.
|
|
171
|
+
*/
|
|
172
|
+
export const OKR = {
|
|
173
|
+
singular: 'okr',
|
|
174
|
+
plural: 'okrs',
|
|
175
|
+
description: 'An objective with measurable key results',
|
|
176
|
+
properties: {
|
|
177
|
+
// Objective
|
|
178
|
+
objective: {
|
|
179
|
+
type: 'string',
|
|
180
|
+
description: 'Objective statement',
|
|
181
|
+
},
|
|
182
|
+
description: {
|
|
183
|
+
type: 'string',
|
|
184
|
+
optional: true,
|
|
185
|
+
description: 'Objective description',
|
|
186
|
+
},
|
|
187
|
+
// Classification
|
|
188
|
+
type: {
|
|
189
|
+
type: 'string',
|
|
190
|
+
optional: true,
|
|
191
|
+
description: 'OKR type',
|
|
192
|
+
examples: ['company', 'department', 'team', 'individual'],
|
|
193
|
+
},
|
|
194
|
+
category: {
|
|
195
|
+
type: 'string',
|
|
196
|
+
optional: true,
|
|
197
|
+
description: 'OKR category',
|
|
198
|
+
examples: ['growth', 'product', 'customer', 'operations', 'people'],
|
|
199
|
+
},
|
|
200
|
+
// Period
|
|
201
|
+
period: {
|
|
202
|
+
type: 'string',
|
|
203
|
+
optional: true,
|
|
204
|
+
description: 'OKR period (e.g., "Q1 2025", "H1 2025")',
|
|
205
|
+
},
|
|
206
|
+
startDate: {
|
|
207
|
+
type: 'date',
|
|
208
|
+
optional: true,
|
|
209
|
+
description: 'Period start date',
|
|
210
|
+
},
|
|
211
|
+
endDate: {
|
|
212
|
+
type: 'date',
|
|
213
|
+
optional: true,
|
|
214
|
+
description: 'Period end date',
|
|
215
|
+
},
|
|
216
|
+
// Progress
|
|
217
|
+
progress: {
|
|
218
|
+
type: 'number',
|
|
219
|
+
optional: true,
|
|
220
|
+
description: 'Overall progress (0-100)',
|
|
221
|
+
},
|
|
222
|
+
confidence: {
|
|
223
|
+
type: 'number',
|
|
224
|
+
optional: true,
|
|
225
|
+
description: 'Confidence level (0-1)',
|
|
226
|
+
},
|
|
227
|
+
grade: {
|
|
228
|
+
type: 'number',
|
|
229
|
+
optional: true,
|
|
230
|
+
description: 'Final grade (0-1)',
|
|
231
|
+
},
|
|
232
|
+
// Key Results count
|
|
233
|
+
keyResultCount: {
|
|
234
|
+
type: 'number',
|
|
235
|
+
optional: true,
|
|
236
|
+
description: 'Number of key results',
|
|
237
|
+
},
|
|
238
|
+
completedKeyResultCount: {
|
|
239
|
+
type: 'number',
|
|
240
|
+
optional: true,
|
|
241
|
+
description: 'Completed key results',
|
|
242
|
+
},
|
|
243
|
+
// Status
|
|
244
|
+
status: {
|
|
245
|
+
type: 'string',
|
|
246
|
+
description: 'OKR status',
|
|
247
|
+
examples: ['draft', 'active', 'on-track', 'at-risk', 'behind', 'completed', 'cancelled'],
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
relationships: {
|
|
251
|
+
owner: {
|
|
252
|
+
type: 'Worker',
|
|
253
|
+
required: false,
|
|
254
|
+
description: 'OKR owner',
|
|
255
|
+
},
|
|
256
|
+
team: {
|
|
257
|
+
type: 'Team',
|
|
258
|
+
required: false,
|
|
259
|
+
description: 'Responsible team',
|
|
260
|
+
},
|
|
261
|
+
department: {
|
|
262
|
+
type: 'Department',
|
|
263
|
+
required: false,
|
|
264
|
+
description: 'Responsible department',
|
|
265
|
+
},
|
|
266
|
+
parent: {
|
|
267
|
+
type: 'OKR',
|
|
268
|
+
required: false,
|
|
269
|
+
description: 'Parent OKR (alignment)',
|
|
270
|
+
},
|
|
271
|
+
children: {
|
|
272
|
+
type: 'OKR[]',
|
|
273
|
+
description: 'Aligned child OKRs',
|
|
274
|
+
},
|
|
275
|
+
keyResults: {
|
|
276
|
+
type: 'KeyResult[]',
|
|
277
|
+
description: 'Key results',
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
actions: [
|
|
281
|
+
'create',
|
|
282
|
+
'update',
|
|
283
|
+
'activate',
|
|
284
|
+
'addKeyResult',
|
|
285
|
+
'removeKeyResult',
|
|
286
|
+
'updateProgress',
|
|
287
|
+
'updateConfidence',
|
|
288
|
+
'grade',
|
|
289
|
+
'complete',
|
|
290
|
+
'cancel',
|
|
291
|
+
'archive',
|
|
292
|
+
],
|
|
293
|
+
events: [
|
|
294
|
+
'created',
|
|
295
|
+
'updated',
|
|
296
|
+
'activated',
|
|
297
|
+
'keyResultAdded',
|
|
298
|
+
'keyResultRemoved',
|
|
299
|
+
'progressUpdated',
|
|
300
|
+
'confidenceUpdated',
|
|
301
|
+
'graded',
|
|
302
|
+
'completed',
|
|
303
|
+
'cancelled',
|
|
304
|
+
'archived',
|
|
305
|
+
],
|
|
306
|
+
};
|
|
307
|
+
// =============================================================================
|
|
308
|
+
// KeyResult
|
|
309
|
+
// =============================================================================
|
|
310
|
+
/**
|
|
311
|
+
* KeyResult entity
|
|
312
|
+
*
|
|
313
|
+
* Represents a measurable key result within an OKR.
|
|
314
|
+
*/
|
|
315
|
+
export const KeyResult = {
|
|
316
|
+
singular: 'key-result',
|
|
317
|
+
plural: 'key-results',
|
|
318
|
+
description: 'A measurable key result within an OKR',
|
|
319
|
+
properties: {
|
|
320
|
+
// Description
|
|
321
|
+
description: {
|
|
322
|
+
type: 'string',
|
|
323
|
+
description: 'Key result description',
|
|
324
|
+
},
|
|
325
|
+
// Metric
|
|
326
|
+
metric: {
|
|
327
|
+
type: 'string',
|
|
328
|
+
description: 'Metric being measured',
|
|
329
|
+
},
|
|
330
|
+
unit: {
|
|
331
|
+
type: 'string',
|
|
332
|
+
optional: true,
|
|
333
|
+
description: 'Unit of measurement',
|
|
334
|
+
},
|
|
335
|
+
// Values
|
|
336
|
+
startValue: {
|
|
337
|
+
type: 'number',
|
|
338
|
+
optional: true,
|
|
339
|
+
description: 'Starting value',
|
|
340
|
+
},
|
|
341
|
+
targetValue: {
|
|
342
|
+
type: 'number',
|
|
343
|
+
description: 'Target value',
|
|
344
|
+
},
|
|
345
|
+
currentValue: {
|
|
346
|
+
type: 'number',
|
|
347
|
+
optional: true,
|
|
348
|
+
description: 'Current value',
|
|
349
|
+
},
|
|
350
|
+
// Progress
|
|
351
|
+
progress: {
|
|
352
|
+
type: 'number',
|
|
353
|
+
optional: true,
|
|
354
|
+
description: 'Progress percentage (0-100)',
|
|
355
|
+
},
|
|
356
|
+
confidence: {
|
|
357
|
+
type: 'number',
|
|
358
|
+
optional: true,
|
|
359
|
+
description: 'Confidence level (0-1)',
|
|
360
|
+
},
|
|
361
|
+
// Type
|
|
362
|
+
direction: {
|
|
363
|
+
type: 'string',
|
|
364
|
+
optional: true,
|
|
365
|
+
description: 'Direction of improvement',
|
|
366
|
+
examples: ['increase', 'decrease', 'maintain'],
|
|
367
|
+
},
|
|
368
|
+
measurementType: {
|
|
369
|
+
type: 'string',
|
|
370
|
+
optional: true,
|
|
371
|
+
description: 'How progress is measured',
|
|
372
|
+
examples: ['percentage', 'absolute', 'binary', 'milestone'],
|
|
373
|
+
},
|
|
374
|
+
// Status
|
|
375
|
+
status: {
|
|
376
|
+
type: 'string',
|
|
377
|
+
description: 'Key result status',
|
|
378
|
+
examples: ['not-started', 'on-track', 'at-risk', 'behind', 'completed'],
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
relationships: {
|
|
382
|
+
okr: {
|
|
383
|
+
type: 'OKR',
|
|
384
|
+
description: 'Parent OKR',
|
|
385
|
+
},
|
|
386
|
+
owner: {
|
|
387
|
+
type: 'Worker',
|
|
388
|
+
required: false,
|
|
389
|
+
description: 'Key result owner',
|
|
390
|
+
},
|
|
391
|
+
initiatives: {
|
|
392
|
+
type: 'Initiative[]',
|
|
393
|
+
description: 'Supporting initiatives',
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
actions: [
|
|
397
|
+
'create',
|
|
398
|
+
'update',
|
|
399
|
+
'updateValue',
|
|
400
|
+
'updateConfidence',
|
|
401
|
+
'complete',
|
|
402
|
+
'delete',
|
|
403
|
+
],
|
|
404
|
+
events: [
|
|
405
|
+
'created',
|
|
406
|
+
'updated',
|
|
407
|
+
'valueUpdated',
|
|
408
|
+
'confidenceUpdated',
|
|
409
|
+
'completed',
|
|
410
|
+
'deleted',
|
|
411
|
+
],
|
|
412
|
+
};
|
|
413
|
+
// =============================================================================
|
|
414
|
+
// KPI (Key Performance Indicator)
|
|
415
|
+
// =============================================================================
|
|
416
|
+
/**
|
|
417
|
+
* KPI entity
|
|
418
|
+
*
|
|
419
|
+
* Represents a key performance indicator.
|
|
420
|
+
*/
|
|
421
|
+
export const KPI = {
|
|
422
|
+
singular: 'kpi',
|
|
423
|
+
plural: 'kpis',
|
|
424
|
+
description: 'A key performance indicator',
|
|
425
|
+
properties: {
|
|
426
|
+
// Identity
|
|
427
|
+
name: {
|
|
428
|
+
type: 'string',
|
|
429
|
+
description: 'KPI name',
|
|
430
|
+
},
|
|
431
|
+
description: {
|
|
432
|
+
type: 'string',
|
|
433
|
+
optional: true,
|
|
434
|
+
description: 'KPI description',
|
|
435
|
+
},
|
|
436
|
+
code: {
|
|
437
|
+
type: 'string',
|
|
438
|
+
optional: true,
|
|
439
|
+
description: 'KPI code (e.g., "MRR", "NPS")',
|
|
440
|
+
},
|
|
441
|
+
// Classification
|
|
442
|
+
category: {
|
|
443
|
+
type: 'string',
|
|
444
|
+
optional: true,
|
|
445
|
+
description: 'KPI category',
|
|
446
|
+
examples: ['financial', 'customer', 'operations', 'people', 'product', 'growth'],
|
|
447
|
+
},
|
|
448
|
+
type: {
|
|
449
|
+
type: 'string',
|
|
450
|
+
optional: true,
|
|
451
|
+
description: 'KPI type',
|
|
452
|
+
examples: ['leading', 'lagging'],
|
|
453
|
+
},
|
|
454
|
+
// Measurement
|
|
455
|
+
unit: {
|
|
456
|
+
type: 'string',
|
|
457
|
+
optional: true,
|
|
458
|
+
description: 'Unit of measurement',
|
|
459
|
+
},
|
|
460
|
+
format: {
|
|
461
|
+
type: 'string',
|
|
462
|
+
optional: true,
|
|
463
|
+
description: 'Display format',
|
|
464
|
+
examples: ['number', 'currency', 'percentage', 'duration'],
|
|
465
|
+
},
|
|
466
|
+
precision: {
|
|
467
|
+
type: 'number',
|
|
468
|
+
optional: true,
|
|
469
|
+
description: 'Decimal precision',
|
|
470
|
+
},
|
|
471
|
+
// Values
|
|
472
|
+
targetValue: {
|
|
473
|
+
type: 'number',
|
|
474
|
+
optional: true,
|
|
475
|
+
description: 'Target value',
|
|
476
|
+
},
|
|
477
|
+
currentValue: {
|
|
478
|
+
type: 'number',
|
|
479
|
+
optional: true,
|
|
480
|
+
description: 'Current value',
|
|
481
|
+
},
|
|
482
|
+
previousValue: {
|
|
483
|
+
type: 'number',
|
|
484
|
+
optional: true,
|
|
485
|
+
description: 'Previous period value',
|
|
486
|
+
},
|
|
487
|
+
baselineValue: {
|
|
488
|
+
type: 'number',
|
|
489
|
+
optional: true,
|
|
490
|
+
description: 'Baseline value',
|
|
491
|
+
},
|
|
492
|
+
// Thresholds
|
|
493
|
+
warningThreshold: {
|
|
494
|
+
type: 'number',
|
|
495
|
+
optional: true,
|
|
496
|
+
description: 'Warning threshold',
|
|
497
|
+
},
|
|
498
|
+
criticalThreshold: {
|
|
499
|
+
type: 'number',
|
|
500
|
+
optional: true,
|
|
501
|
+
description: 'Critical threshold',
|
|
502
|
+
},
|
|
503
|
+
direction: {
|
|
504
|
+
type: 'string',
|
|
505
|
+
optional: true,
|
|
506
|
+
description: 'Good direction',
|
|
507
|
+
examples: ['higher-is-better', 'lower-is-better', 'target'],
|
|
508
|
+
},
|
|
509
|
+
// Tracking
|
|
510
|
+
frequency: {
|
|
511
|
+
type: 'string',
|
|
512
|
+
optional: true,
|
|
513
|
+
description: 'Measurement frequency',
|
|
514
|
+
examples: ['realtime', 'hourly', 'daily', 'weekly', 'monthly', 'quarterly'],
|
|
515
|
+
},
|
|
516
|
+
lastMeasuredAt: {
|
|
517
|
+
type: 'datetime',
|
|
518
|
+
optional: true,
|
|
519
|
+
description: 'Last measurement time',
|
|
520
|
+
},
|
|
521
|
+
// Calculation
|
|
522
|
+
formula: {
|
|
523
|
+
type: 'string',
|
|
524
|
+
optional: true,
|
|
525
|
+
description: 'Calculation formula',
|
|
526
|
+
},
|
|
527
|
+
dataSource: {
|
|
528
|
+
type: 'string',
|
|
529
|
+
optional: true,
|
|
530
|
+
description: 'Data source',
|
|
531
|
+
},
|
|
532
|
+
// Status
|
|
533
|
+
status: {
|
|
534
|
+
type: 'string',
|
|
535
|
+
optional: true,
|
|
536
|
+
description: 'KPI status',
|
|
537
|
+
examples: ['on-target', 'warning', 'critical', 'no-data'],
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
relationships: {
|
|
541
|
+
owner: {
|
|
542
|
+
type: 'Worker',
|
|
543
|
+
required: false,
|
|
544
|
+
description: 'KPI owner',
|
|
545
|
+
},
|
|
546
|
+
department: {
|
|
547
|
+
type: 'Department',
|
|
548
|
+
required: false,
|
|
549
|
+
description: 'Responsible department',
|
|
550
|
+
},
|
|
551
|
+
goals: {
|
|
552
|
+
type: 'Goal[]',
|
|
553
|
+
description: 'Related goals',
|
|
554
|
+
},
|
|
555
|
+
dashboard: {
|
|
556
|
+
type: 'Dashboard',
|
|
557
|
+
required: false,
|
|
558
|
+
description: 'Display dashboard',
|
|
559
|
+
},
|
|
560
|
+
history: {
|
|
561
|
+
type: 'KPIValue[]',
|
|
562
|
+
description: 'Historical values',
|
|
563
|
+
},
|
|
564
|
+
},
|
|
565
|
+
actions: [
|
|
566
|
+
'create',
|
|
567
|
+
'update',
|
|
568
|
+
'measure',
|
|
569
|
+
'setTarget',
|
|
570
|
+
'setThresholds',
|
|
571
|
+
'alert',
|
|
572
|
+
'archive',
|
|
573
|
+
],
|
|
574
|
+
events: [
|
|
575
|
+
'created',
|
|
576
|
+
'updated',
|
|
577
|
+
'measured',
|
|
578
|
+
'targetSet',
|
|
579
|
+
'thresholdBreached',
|
|
580
|
+
'targetMet',
|
|
581
|
+
'alerted',
|
|
582
|
+
'archived',
|
|
583
|
+
],
|
|
584
|
+
};
|
|
585
|
+
// =============================================================================
|
|
586
|
+
// Metric
|
|
587
|
+
// =============================================================================
|
|
588
|
+
/**
|
|
589
|
+
* Metric entity
|
|
590
|
+
*
|
|
591
|
+
* Represents a general business metric or measurement.
|
|
592
|
+
*/
|
|
593
|
+
export const Metric = {
|
|
594
|
+
singular: 'metric',
|
|
595
|
+
plural: 'metrics',
|
|
596
|
+
description: 'A general business metric or measurement',
|
|
597
|
+
properties: {
|
|
598
|
+
// Identity
|
|
599
|
+
name: {
|
|
600
|
+
type: 'string',
|
|
601
|
+
description: 'Metric name',
|
|
602
|
+
},
|
|
603
|
+
description: {
|
|
604
|
+
type: 'string',
|
|
605
|
+
optional: true,
|
|
606
|
+
description: 'Metric description',
|
|
607
|
+
},
|
|
608
|
+
// Classification
|
|
609
|
+
category: {
|
|
610
|
+
type: 'string',
|
|
611
|
+
optional: true,
|
|
612
|
+
description: 'Metric category',
|
|
613
|
+
},
|
|
614
|
+
tags: {
|
|
615
|
+
type: 'string',
|
|
616
|
+
array: true,
|
|
617
|
+
optional: true,
|
|
618
|
+
description: 'Tags',
|
|
619
|
+
},
|
|
620
|
+
// Value
|
|
621
|
+
value: {
|
|
622
|
+
type: 'number',
|
|
623
|
+
description: 'Current value',
|
|
624
|
+
},
|
|
625
|
+
unit: {
|
|
626
|
+
type: 'string',
|
|
627
|
+
optional: true,
|
|
628
|
+
description: 'Unit of measurement',
|
|
629
|
+
},
|
|
630
|
+
// Timestamp
|
|
631
|
+
timestamp: {
|
|
632
|
+
type: 'datetime',
|
|
633
|
+
description: 'Measurement timestamp',
|
|
634
|
+
},
|
|
635
|
+
period: {
|
|
636
|
+
type: 'string',
|
|
637
|
+
optional: true,
|
|
638
|
+
description: 'Measurement period',
|
|
639
|
+
},
|
|
640
|
+
// Source
|
|
641
|
+
source: {
|
|
642
|
+
type: 'string',
|
|
643
|
+
optional: true,
|
|
644
|
+
description: 'Data source',
|
|
645
|
+
},
|
|
646
|
+
},
|
|
647
|
+
relationships: {
|
|
648
|
+
kpi: {
|
|
649
|
+
type: 'KPI',
|
|
650
|
+
required: false,
|
|
651
|
+
description: 'Related KPI',
|
|
652
|
+
},
|
|
653
|
+
},
|
|
654
|
+
actions: [
|
|
655
|
+
'record',
|
|
656
|
+
'update',
|
|
657
|
+
'delete',
|
|
658
|
+
],
|
|
659
|
+
events: [
|
|
660
|
+
'recorded',
|
|
661
|
+
'updated',
|
|
662
|
+
'deleted',
|
|
663
|
+
],
|
|
664
|
+
};
|
|
665
|
+
// =============================================================================
|
|
666
|
+
// Initiative
|
|
667
|
+
// =============================================================================
|
|
668
|
+
/**
|
|
669
|
+
* Initiative entity
|
|
670
|
+
*
|
|
671
|
+
* Represents a strategic initiative or project supporting goals.
|
|
672
|
+
*/
|
|
673
|
+
export const Initiative = {
|
|
674
|
+
singular: 'initiative',
|
|
675
|
+
plural: 'initiatives',
|
|
676
|
+
description: 'A strategic initiative or project supporting goals',
|
|
677
|
+
properties: {
|
|
678
|
+
// Identity
|
|
679
|
+
name: {
|
|
680
|
+
type: 'string',
|
|
681
|
+
description: 'Initiative name',
|
|
682
|
+
},
|
|
683
|
+
description: {
|
|
684
|
+
type: 'string',
|
|
685
|
+
optional: true,
|
|
686
|
+
description: 'Initiative description',
|
|
687
|
+
},
|
|
688
|
+
// Classification
|
|
689
|
+
type: {
|
|
690
|
+
type: 'string',
|
|
691
|
+
optional: true,
|
|
692
|
+
description: 'Initiative type',
|
|
693
|
+
examples: ['project', 'program', 'experiment', 'improvement'],
|
|
694
|
+
},
|
|
695
|
+
priority: {
|
|
696
|
+
type: 'string',
|
|
697
|
+
optional: true,
|
|
698
|
+
description: 'Priority level',
|
|
699
|
+
examples: ['critical', 'high', 'medium', 'low'],
|
|
700
|
+
},
|
|
701
|
+
// Timeline
|
|
702
|
+
startDate: {
|
|
703
|
+
type: 'date',
|
|
704
|
+
optional: true,
|
|
705
|
+
description: 'Start date',
|
|
706
|
+
},
|
|
707
|
+
endDate: {
|
|
708
|
+
type: 'date',
|
|
709
|
+
optional: true,
|
|
710
|
+
description: 'End date',
|
|
711
|
+
},
|
|
712
|
+
// Progress
|
|
713
|
+
progress: {
|
|
714
|
+
type: 'number',
|
|
715
|
+
optional: true,
|
|
716
|
+
description: 'Progress percentage (0-100)',
|
|
717
|
+
},
|
|
718
|
+
// Resources
|
|
719
|
+
budget: {
|
|
720
|
+
type: 'number',
|
|
721
|
+
optional: true,
|
|
722
|
+
description: 'Allocated budget',
|
|
723
|
+
},
|
|
724
|
+
budgetCurrency: {
|
|
725
|
+
type: 'string',
|
|
726
|
+
optional: true,
|
|
727
|
+
description: 'Budget currency',
|
|
728
|
+
},
|
|
729
|
+
spent: {
|
|
730
|
+
type: 'number',
|
|
731
|
+
optional: true,
|
|
732
|
+
description: 'Amount spent',
|
|
733
|
+
},
|
|
734
|
+
// Status
|
|
735
|
+
status: {
|
|
736
|
+
type: 'string',
|
|
737
|
+
description: 'Initiative status',
|
|
738
|
+
examples: ['proposed', 'approved', 'in-progress', 'on-hold', 'completed', 'cancelled'],
|
|
739
|
+
},
|
|
740
|
+
},
|
|
741
|
+
relationships: {
|
|
742
|
+
owner: {
|
|
743
|
+
type: 'Worker',
|
|
744
|
+
required: false,
|
|
745
|
+
description: 'Initiative owner',
|
|
746
|
+
},
|
|
747
|
+
team: {
|
|
748
|
+
type: 'Team',
|
|
749
|
+
required: false,
|
|
750
|
+
description: 'Responsible team',
|
|
751
|
+
},
|
|
752
|
+
goals: {
|
|
753
|
+
type: 'Goal[]',
|
|
754
|
+
description: 'Supported goals',
|
|
755
|
+
},
|
|
756
|
+
keyResults: {
|
|
757
|
+
type: 'KeyResult[]',
|
|
758
|
+
description: 'Supported key results',
|
|
759
|
+
},
|
|
760
|
+
},
|
|
761
|
+
actions: [
|
|
762
|
+
'create',
|
|
763
|
+
'update',
|
|
764
|
+
'approve',
|
|
765
|
+
'start',
|
|
766
|
+
'pause',
|
|
767
|
+
'resume',
|
|
768
|
+
'complete',
|
|
769
|
+
'cancel',
|
|
770
|
+
'archive',
|
|
771
|
+
],
|
|
772
|
+
events: [
|
|
773
|
+
'created',
|
|
774
|
+
'updated',
|
|
775
|
+
'approved',
|
|
776
|
+
'started',
|
|
777
|
+
'paused',
|
|
778
|
+
'resumed',
|
|
779
|
+
'completed',
|
|
780
|
+
'cancelled',
|
|
781
|
+
'archived',
|
|
782
|
+
],
|
|
783
|
+
};
|
|
784
|
+
// =============================================================================
|
|
785
|
+
// Exports
|
|
786
|
+
// =============================================================================
|
|
787
|
+
export const GoalEntities = {
|
|
788
|
+
Goal,
|
|
789
|
+
OKR,
|
|
790
|
+
KeyResult,
|
|
791
|
+
KPI,
|
|
792
|
+
Metric,
|
|
793
|
+
Initiative,
|
|
794
|
+
};
|
|
795
|
+
export const GoalCategories = {
|
|
796
|
+
objectives: ['Goal', 'OKR', 'KeyResult'],
|
|
797
|
+
measurement: ['KPI', 'Metric'],
|
|
798
|
+
execution: ['Initiative'],
|
|
799
|
+
};
|