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.
Files changed (190) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +9 -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,807 @@
1
+ /**
2
+ * Organization Entity Types (Nouns)
3
+ *
4
+ * Organizational hierarchy: Organization, Department, Team, Position, Role.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ // =============================================================================
9
+ // Organization
10
+ // =============================================================================
11
+ /**
12
+ * Organization entity
13
+ *
14
+ * Represents the top-level organizational structure.
15
+ */
16
+ export const Organization = {
17
+ singular: 'organization',
18
+ plural: 'organizations',
19
+ description: 'The top-level organizational structure',
20
+ properties: {
21
+ // Identity
22
+ name: {
23
+ type: 'string',
24
+ description: 'Organization name',
25
+ },
26
+ description: {
27
+ type: 'string',
28
+ optional: true,
29
+ description: 'Organization description',
30
+ },
31
+ // Type
32
+ type: {
33
+ type: 'string',
34
+ optional: true,
35
+ description: 'Organization type',
36
+ examples: ['functional', 'divisional', 'matrix', 'flat', 'holacracy'],
37
+ },
38
+ // Settings
39
+ fiscalYearStart: {
40
+ type: 'string',
41
+ optional: true,
42
+ description: 'Fiscal year start month (e.g., "January", "April")',
43
+ },
44
+ defaultCurrency: {
45
+ type: 'string',
46
+ optional: true,
47
+ description: 'Default currency code',
48
+ examples: ['USD', 'EUR', 'GBP'],
49
+ },
50
+ defaultTimezone: {
51
+ type: 'string',
52
+ optional: true,
53
+ description: 'Default timezone',
54
+ },
55
+ // Size
56
+ departmentCount: {
57
+ type: 'number',
58
+ optional: true,
59
+ description: 'Number of departments',
60
+ },
61
+ teamCount: {
62
+ type: 'number',
63
+ optional: true,
64
+ description: 'Number of teams',
65
+ },
66
+ positionCount: {
67
+ type: 'number',
68
+ optional: true,
69
+ description: 'Number of positions',
70
+ },
71
+ // Status
72
+ status: {
73
+ type: 'string',
74
+ optional: true,
75
+ description: 'Organization status',
76
+ examples: ['active', 'restructuring', 'archived'],
77
+ },
78
+ },
79
+ relationships: {
80
+ business: {
81
+ type: 'Business',
82
+ description: 'Parent business',
83
+ },
84
+ departments: {
85
+ type: 'Department[]',
86
+ description: 'Departments',
87
+ },
88
+ teams: {
89
+ type: 'Team[]',
90
+ description: 'All teams',
91
+ },
92
+ positions: {
93
+ type: 'Position[]',
94
+ description: 'All positions',
95
+ },
96
+ roles: {
97
+ type: 'Role[]',
98
+ description: 'Defined roles',
99
+ },
100
+ },
101
+ actions: [
102
+ 'create',
103
+ 'update',
104
+ 'restructure',
105
+ 'merge',
106
+ 'split',
107
+ 'archive',
108
+ ],
109
+ events: [
110
+ 'created',
111
+ 'updated',
112
+ 'restructured',
113
+ 'merged',
114
+ 'split',
115
+ 'archived',
116
+ ],
117
+ };
118
+ // =============================================================================
119
+ // Department
120
+ // =============================================================================
121
+ /**
122
+ * Department entity
123
+ *
124
+ * Represents a functional department or division.
125
+ */
126
+ export const Department = {
127
+ singular: 'department',
128
+ plural: 'departments',
129
+ description: 'A functional department or division',
130
+ properties: {
131
+ // Identity
132
+ name: {
133
+ type: 'string',
134
+ description: 'Department name',
135
+ },
136
+ code: {
137
+ type: 'string',
138
+ optional: true,
139
+ description: 'Department code (e.g., "ENG", "MKT")',
140
+ },
141
+ description: {
142
+ type: 'string',
143
+ optional: true,
144
+ description: 'Department description',
145
+ },
146
+ // Type
147
+ type: {
148
+ type: 'string',
149
+ optional: true,
150
+ description: 'Department type',
151
+ examples: ['engineering', 'product', 'design', 'marketing', 'sales', 'operations', 'finance', 'hr', 'legal', 'support'],
152
+ },
153
+ // Budget
154
+ budget: {
155
+ type: 'number',
156
+ optional: true,
157
+ description: 'Annual budget',
158
+ },
159
+ budgetCurrency: {
160
+ type: 'string',
161
+ optional: true,
162
+ description: 'Budget currency',
163
+ },
164
+ budgetPeriod: {
165
+ type: 'string',
166
+ optional: true,
167
+ description: 'Budget period',
168
+ examples: ['monthly', 'quarterly', 'yearly'],
169
+ },
170
+ // Size
171
+ headcount: {
172
+ type: 'number',
173
+ optional: true,
174
+ description: 'Number of employees',
175
+ },
176
+ teamCount: {
177
+ type: 'number',
178
+ optional: true,
179
+ description: 'Number of teams',
180
+ },
181
+ // Hierarchy
182
+ level: {
183
+ type: 'number',
184
+ optional: true,
185
+ description: 'Organizational level (1 = top)',
186
+ },
187
+ // Status
188
+ status: {
189
+ type: 'string',
190
+ optional: true,
191
+ description: 'Department status',
192
+ examples: ['active', 'forming', 'restructuring', 'dissolved'],
193
+ },
194
+ },
195
+ relationships: {
196
+ organization: {
197
+ type: 'Organization',
198
+ description: 'Parent organization',
199
+ },
200
+ parent: {
201
+ type: 'Department',
202
+ required: false,
203
+ description: 'Parent department (for sub-departments)',
204
+ },
205
+ children: {
206
+ type: 'Department[]',
207
+ description: 'Sub-departments',
208
+ },
209
+ head: {
210
+ type: 'Position',
211
+ required: false,
212
+ description: 'Department head position',
213
+ },
214
+ teams: {
215
+ type: 'Team[]',
216
+ description: 'Teams in this department',
217
+ },
218
+ goals: {
219
+ type: 'Goal[]',
220
+ description: 'Department goals',
221
+ },
222
+ budgets: {
223
+ type: 'Budget[]',
224
+ description: 'Budget allocations',
225
+ },
226
+ },
227
+ actions: [
228
+ 'create',
229
+ 'update',
230
+ 'rename',
231
+ 'setBudget',
232
+ 'addTeam',
233
+ 'removeTeam',
234
+ 'setHead',
235
+ 'merge',
236
+ 'split',
237
+ 'dissolve',
238
+ 'archive',
239
+ ],
240
+ events: [
241
+ 'created',
242
+ 'updated',
243
+ 'renamed',
244
+ 'budgetSet',
245
+ 'teamAdded',
246
+ 'teamRemoved',
247
+ 'headChanged',
248
+ 'merged',
249
+ 'split',
250
+ 'dissolved',
251
+ 'archived',
252
+ ],
253
+ };
254
+ // =============================================================================
255
+ // Team
256
+ // =============================================================================
257
+ /**
258
+ * Team entity
259
+ *
260
+ * Represents a working team within a department.
261
+ */
262
+ export const Team = {
263
+ singular: 'team',
264
+ plural: 'teams',
265
+ description: 'A working team within a department',
266
+ properties: {
267
+ // Identity
268
+ name: {
269
+ type: 'string',
270
+ description: 'Team name',
271
+ },
272
+ code: {
273
+ type: 'string',
274
+ optional: true,
275
+ description: 'Team code',
276
+ },
277
+ description: {
278
+ type: 'string',
279
+ optional: true,
280
+ description: 'Team description',
281
+ },
282
+ // Type
283
+ type: {
284
+ type: 'string',
285
+ optional: true,
286
+ description: 'Team type',
287
+ examples: ['product', 'platform', 'growth', 'infrastructure', 'support', 'project', 'tiger'],
288
+ },
289
+ methodology: {
290
+ type: 'string',
291
+ optional: true,
292
+ description: 'Working methodology',
293
+ examples: ['scrum', 'kanban', 'scrumban', 'waterfall', 'hybrid'],
294
+ },
295
+ // Size
296
+ capacity: {
297
+ type: 'number',
298
+ optional: true,
299
+ description: 'Team capacity (FTE)',
300
+ },
301
+ headcount: {
302
+ type: 'number',
303
+ optional: true,
304
+ description: 'Number of members',
305
+ },
306
+ // Communication
307
+ slackChannel: {
308
+ type: 'string',
309
+ optional: true,
310
+ description: 'Slack channel',
311
+ },
312
+ email: {
313
+ type: 'string',
314
+ optional: true,
315
+ description: 'Team email',
316
+ },
317
+ // Status
318
+ status: {
319
+ type: 'string',
320
+ optional: true,
321
+ description: 'Team status',
322
+ examples: ['active', 'forming', 'storming', 'norming', 'performing', 'adjourning'],
323
+ },
324
+ },
325
+ relationships: {
326
+ department: {
327
+ type: 'Department',
328
+ description: 'Parent department',
329
+ },
330
+ lead: {
331
+ type: 'Position',
332
+ required: false,
333
+ description: 'Team lead position',
334
+ },
335
+ positions: {
336
+ type: 'Position[]',
337
+ description: 'Team positions',
338
+ },
339
+ projects: {
340
+ type: 'Project[]',
341
+ description: 'Active projects',
342
+ },
343
+ workflows: {
344
+ type: 'Workflow[]',
345
+ description: 'Team workflows',
346
+ },
347
+ },
348
+ actions: [
349
+ 'create',
350
+ 'update',
351
+ 'rename',
352
+ 'setLead',
353
+ 'addMember',
354
+ 'removeMember',
355
+ 'setCapacity',
356
+ 'assignProject',
357
+ 'unassignProject',
358
+ 'archive',
359
+ ],
360
+ events: [
361
+ 'created',
362
+ 'updated',
363
+ 'renamed',
364
+ 'leadChanged',
365
+ 'memberAdded',
366
+ 'memberRemoved',
367
+ 'capacityChanged',
368
+ 'projectAssigned',
369
+ 'projectUnassigned',
370
+ 'archived',
371
+ ],
372
+ };
373
+ // =============================================================================
374
+ // Position
375
+ // =============================================================================
376
+ /**
377
+ * Position entity
378
+ *
379
+ * Represents a position/job within the organization.
380
+ */
381
+ export const Position = {
382
+ singular: 'position',
383
+ plural: 'positions',
384
+ description: 'A position or job within the organization',
385
+ properties: {
386
+ // Identity
387
+ title: {
388
+ type: 'string',
389
+ description: 'Position title',
390
+ },
391
+ code: {
392
+ type: 'string',
393
+ optional: true,
394
+ description: 'Position code',
395
+ },
396
+ description: {
397
+ type: 'string',
398
+ optional: true,
399
+ description: 'Position description',
400
+ },
401
+ // Classification
402
+ level: {
403
+ type: 'string',
404
+ optional: true,
405
+ description: 'Job level',
406
+ examples: ['intern', 'junior', 'mid', 'senior', 'staff', 'principal', 'director', 'vp', 'c-level'],
407
+ },
408
+ track: {
409
+ type: 'string',
410
+ optional: true,
411
+ description: 'Career track',
412
+ examples: ['individual-contributor', 'management', 'executive'],
413
+ },
414
+ grade: {
415
+ type: 'string',
416
+ optional: true,
417
+ description: 'Pay grade',
418
+ },
419
+ // Type
420
+ employmentType: {
421
+ type: 'string',
422
+ optional: true,
423
+ description: 'Employment type',
424
+ examples: ['full-time', 'part-time', 'contract', 'intern', 'advisor'],
425
+ },
426
+ workLocation: {
427
+ type: 'string',
428
+ optional: true,
429
+ description: 'Work location type',
430
+ examples: ['remote', 'office', 'hybrid'],
431
+ },
432
+ // Compensation
433
+ salaryMin: {
434
+ type: 'number',
435
+ optional: true,
436
+ description: 'Minimum salary',
437
+ },
438
+ salaryMax: {
439
+ type: 'number',
440
+ optional: true,
441
+ description: 'Maximum salary',
442
+ },
443
+ salaryCurrency: {
444
+ type: 'string',
445
+ optional: true,
446
+ description: 'Salary currency',
447
+ },
448
+ equityMin: {
449
+ type: 'number',
450
+ optional: true,
451
+ description: 'Minimum equity percentage',
452
+ },
453
+ equityMax: {
454
+ type: 'number',
455
+ optional: true,
456
+ description: 'Maximum equity percentage',
457
+ },
458
+ // Capacity
459
+ fte: {
460
+ type: 'number',
461
+ optional: true,
462
+ description: 'Full-time equivalent (0-1)',
463
+ },
464
+ // Requirements
465
+ requirements: {
466
+ type: 'string',
467
+ array: true,
468
+ optional: true,
469
+ description: 'Position requirements',
470
+ },
471
+ skills: {
472
+ type: 'string',
473
+ array: true,
474
+ optional: true,
475
+ description: 'Required skills',
476
+ },
477
+ // Status
478
+ status: {
479
+ type: 'string',
480
+ optional: true,
481
+ description: 'Position status',
482
+ examples: ['open', 'filled', 'frozen', 'eliminated'],
483
+ },
484
+ },
485
+ relationships: {
486
+ team: {
487
+ type: 'Team',
488
+ description: 'Parent team',
489
+ },
490
+ role: {
491
+ type: 'Role',
492
+ description: 'Assigned role',
493
+ },
494
+ reportsTo: {
495
+ type: 'Position',
496
+ required: false,
497
+ description: 'Reports to position',
498
+ },
499
+ directReports: {
500
+ type: 'Position[]',
501
+ description: 'Direct reports',
502
+ },
503
+ holder: {
504
+ type: 'Worker',
505
+ required: false,
506
+ description: 'Current position holder',
507
+ },
508
+ },
509
+ actions: [
510
+ 'create',
511
+ 'update',
512
+ 'open',
513
+ 'fill',
514
+ 'freeze',
515
+ 'eliminate',
516
+ 'transfer',
517
+ 'promote',
518
+ 'setCompensation',
519
+ 'archive',
520
+ ],
521
+ events: [
522
+ 'created',
523
+ 'updated',
524
+ 'opened',
525
+ 'filled',
526
+ 'frozen',
527
+ 'eliminated',
528
+ 'transferred',
529
+ 'promoted',
530
+ 'compensationChanged',
531
+ 'archived',
532
+ ],
533
+ };
534
+ // =============================================================================
535
+ // Role
536
+ // =============================================================================
537
+ /**
538
+ * Role entity
539
+ *
540
+ * Represents a role with permissions and capabilities.
541
+ */
542
+ export const Role = {
543
+ singular: 'role',
544
+ plural: 'roles',
545
+ description: 'A role with permissions and capabilities',
546
+ properties: {
547
+ // Identity
548
+ name: {
549
+ type: 'string',
550
+ description: 'Role name',
551
+ },
552
+ code: {
553
+ type: 'string',
554
+ optional: true,
555
+ description: 'Role code',
556
+ },
557
+ description: {
558
+ type: 'string',
559
+ optional: true,
560
+ description: 'Role description',
561
+ },
562
+ // Type
563
+ type: {
564
+ type: 'string',
565
+ optional: true,
566
+ description: 'Role type',
567
+ examples: ['executive', 'manager', 'lead', 'contributor', 'specialist', 'support'],
568
+ },
569
+ // Permissions
570
+ permissions: {
571
+ type: 'string',
572
+ array: true,
573
+ optional: true,
574
+ description: 'Granted permissions',
575
+ },
576
+ capabilities: {
577
+ type: 'string',
578
+ array: true,
579
+ optional: true,
580
+ description: 'Role capabilities',
581
+ },
582
+ // Approval
583
+ approvalLevel: {
584
+ type: 'number',
585
+ optional: true,
586
+ description: 'Approval authority level',
587
+ },
588
+ approvalLimit: {
589
+ type: 'number',
590
+ optional: true,
591
+ description: 'Approval spending limit',
592
+ },
593
+ // Hierarchy
594
+ level: {
595
+ type: 'number',
596
+ optional: true,
597
+ description: 'Role hierarchy level',
598
+ },
599
+ // Status
600
+ status: {
601
+ type: 'string',
602
+ optional: true,
603
+ description: 'Role status',
604
+ examples: ['active', 'deprecated'],
605
+ },
606
+ },
607
+ relationships: {
608
+ organization: {
609
+ type: 'Organization',
610
+ description: 'Parent organization',
611
+ },
612
+ parent: {
613
+ type: 'Role',
614
+ required: false,
615
+ description: 'Parent role (inherits permissions)',
616
+ },
617
+ children: {
618
+ type: 'Role[]',
619
+ description: 'Child roles',
620
+ },
621
+ positions: {
622
+ type: 'Position[]',
623
+ description: 'Positions with this role',
624
+ },
625
+ },
626
+ actions: [
627
+ 'create',
628
+ 'update',
629
+ 'grantPermission',
630
+ 'revokePermission',
631
+ 'setApprovalLimit',
632
+ 'deprecate',
633
+ 'archive',
634
+ ],
635
+ events: [
636
+ 'created',
637
+ 'updated',
638
+ 'permissionGranted',
639
+ 'permissionRevoked',
640
+ 'approvalLimitChanged',
641
+ 'deprecated',
642
+ 'archived',
643
+ ],
644
+ };
645
+ // =============================================================================
646
+ // Worker
647
+ // =============================================================================
648
+ /**
649
+ * Worker entity
650
+ *
651
+ * Represents a human employee or AI agent that fills a position.
652
+ */
653
+ export const Worker = {
654
+ singular: 'worker',
655
+ plural: 'workers',
656
+ description: 'A human employee or AI agent that fills a position',
657
+ properties: {
658
+ // Identity
659
+ name: {
660
+ type: 'string',
661
+ description: 'Worker name',
662
+ },
663
+ email: {
664
+ type: 'string',
665
+ optional: true,
666
+ description: 'Email address',
667
+ },
668
+ avatarUrl: {
669
+ type: 'url',
670
+ optional: true,
671
+ description: 'Avatar URL',
672
+ },
673
+ // Type
674
+ type: {
675
+ type: 'string',
676
+ description: 'Worker type',
677
+ examples: ['human', 'agent'],
678
+ },
679
+ // Human-specific
680
+ firstName: {
681
+ type: 'string',
682
+ optional: true,
683
+ description: 'First name',
684
+ },
685
+ lastName: {
686
+ type: 'string',
687
+ optional: true,
688
+ description: 'Last name',
689
+ },
690
+ phone: {
691
+ type: 'string',
692
+ optional: true,
693
+ description: 'Phone number',
694
+ },
695
+ location: {
696
+ type: 'string',
697
+ optional: true,
698
+ description: 'Work location',
699
+ },
700
+ timezone: {
701
+ type: 'string',
702
+ optional: true,
703
+ description: 'Timezone',
704
+ },
705
+ startDate: {
706
+ type: 'date',
707
+ optional: true,
708
+ description: 'Start date',
709
+ },
710
+ // Agent-specific
711
+ agentId: {
712
+ type: 'string',
713
+ optional: true,
714
+ description: 'AI agent identifier',
715
+ },
716
+ modelId: {
717
+ type: 'string',
718
+ optional: true,
719
+ description: 'AI model identifier',
720
+ },
721
+ capabilities: {
722
+ type: 'string',
723
+ array: true,
724
+ optional: true,
725
+ description: 'Agent capabilities',
726
+ },
727
+ // Availability
728
+ availability: {
729
+ type: 'string',
730
+ optional: true,
731
+ description: 'Availability status',
732
+ examples: ['available', 'busy', 'away', 'offline'],
733
+ },
734
+ capacity: {
735
+ type: 'number',
736
+ optional: true,
737
+ description: 'Available capacity (0-1)',
738
+ },
739
+ // Status
740
+ status: {
741
+ type: 'string',
742
+ optional: true,
743
+ description: 'Worker status',
744
+ examples: ['active', 'onboarding', 'on-leave', 'offboarding', 'inactive'],
745
+ },
746
+ },
747
+ relationships: {
748
+ position: {
749
+ type: 'Position',
750
+ required: false,
751
+ description: 'Current position',
752
+ },
753
+ manager: {
754
+ type: 'Worker',
755
+ required: false,
756
+ description: 'Direct manager',
757
+ },
758
+ directReports: {
759
+ type: 'Worker[]',
760
+ description: 'Direct reports',
761
+ },
762
+ tasks: {
763
+ type: 'Task[]',
764
+ description: 'Assigned tasks',
765
+ },
766
+ },
767
+ actions: [
768
+ 'create',
769
+ 'update',
770
+ 'onboard',
771
+ 'assign',
772
+ 'reassign',
773
+ 'setAvailability',
774
+ 'promote',
775
+ 'transfer',
776
+ 'offboard',
777
+ 'archive',
778
+ ],
779
+ events: [
780
+ 'created',
781
+ 'updated',
782
+ 'onboarded',
783
+ 'assigned',
784
+ 'reassigned',
785
+ 'availabilityChanged',
786
+ 'promoted',
787
+ 'transferred',
788
+ 'offboarded',
789
+ 'archived',
790
+ ],
791
+ };
792
+ // =============================================================================
793
+ // Exports
794
+ // =============================================================================
795
+ export const OrganizationEntities = {
796
+ Organization,
797
+ Department,
798
+ Team,
799
+ Position,
800
+ Role,
801
+ Worker,
802
+ };
803
+ export const OrganizationCategories = {
804
+ structure: ['Organization', 'Department', 'Team'],
805
+ people: ['Position', 'Role', 'Worker'],
806
+ };
807
+ //# sourceMappingURL=organization.js.map