business-as-code 0.2.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +17 -0
  3. package/IMPLEMENTATION.md +226 -0
  4. package/README.md +1133 -193
  5. package/dist/business.d.ts +62 -0
  6. package/dist/business.d.ts.map +1 -0
  7. package/dist/business.js +109 -0
  8. package/dist/business.js.map +1 -0
  9. package/dist/dollar.d.ts +60 -0
  10. package/dist/dollar.d.ts.map +1 -0
  11. package/dist/dollar.js +107 -0
  12. package/dist/dollar.js.map +1 -0
  13. package/dist/entities/assets.d.ts +21 -0
  14. package/dist/entities/assets.d.ts.map +1 -0
  15. package/dist/entities/assets.js +323 -0
  16. package/dist/entities/assets.js.map +1 -0
  17. package/dist/entities/business.d.ts +36 -0
  18. package/dist/entities/business.d.ts.map +1 -0
  19. package/dist/entities/business.js +370 -0
  20. package/dist/entities/business.js.map +1 -0
  21. package/dist/entities/communication.d.ts +21 -0
  22. package/dist/entities/communication.d.ts.map +1 -0
  23. package/dist/entities/communication.js +255 -0
  24. package/dist/entities/communication.js.map +1 -0
  25. package/dist/entities/customers.d.ts +58 -0
  26. package/dist/entities/customers.d.ts.map +1 -0
  27. package/dist/entities/customers.js +989 -0
  28. package/dist/entities/customers.js.map +1 -0
  29. package/dist/entities/financials.d.ts +59 -0
  30. package/dist/entities/financials.d.ts.map +1 -0
  31. package/dist/entities/financials.js +932 -0
  32. package/dist/entities/financials.js.map +1 -0
  33. package/dist/entities/goals.d.ts +58 -0
  34. package/dist/entities/goals.d.ts.map +1 -0
  35. package/dist/entities/goals.js +800 -0
  36. package/dist/entities/goals.js.map +1 -0
  37. package/dist/entities/index.d.ts +299 -0
  38. package/dist/entities/index.d.ts.map +1 -0
  39. package/dist/entities/index.js +198 -0
  40. package/dist/entities/index.js.map +1 -0
  41. package/dist/entities/legal.d.ts +21 -0
  42. package/dist/entities/legal.d.ts.map +1 -0
  43. package/dist/entities/legal.js +301 -0
  44. package/dist/entities/legal.js.map +1 -0
  45. package/dist/entities/market.d.ts +21 -0
  46. package/dist/entities/market.d.ts.map +1 -0
  47. package/dist/entities/market.js +301 -0
  48. package/dist/entities/market.js.map +1 -0
  49. package/dist/entities/marketing.d.ts +67 -0
  50. package/dist/entities/marketing.d.ts.map +1 -0
  51. package/dist/entities/marketing.js +1157 -0
  52. package/dist/entities/marketing.js.map +1 -0
  53. package/dist/entities/offerings.d.ts +51 -0
  54. package/dist/entities/offerings.d.ts.map +1 -0
  55. package/dist/entities/offerings.js +727 -0
  56. package/dist/entities/offerings.js.map +1 -0
  57. package/dist/entities/operations.d.ts +58 -0
  58. package/dist/entities/operations.d.ts.map +1 -0
  59. package/dist/entities/operations.js +787 -0
  60. package/dist/entities/operations.js.map +1 -0
  61. package/dist/entities/organization.d.ts +57 -0
  62. package/dist/entities/organization.d.ts.map +1 -0
  63. package/dist/entities/organization.js +807 -0
  64. package/dist/entities/organization.js.map +1 -0
  65. package/dist/entities/partnerships.d.ts +21 -0
  66. package/dist/entities/partnerships.d.ts.map +1 -0
  67. package/dist/entities/partnerships.js +300 -0
  68. package/dist/entities/partnerships.js.map +1 -0
  69. package/dist/entities/planning.d.ts +87 -0
  70. package/dist/entities/planning.d.ts.map +1 -0
  71. package/dist/entities/planning.js +271 -0
  72. package/dist/entities/planning.js.map +1 -0
  73. package/dist/entities/projects.d.ts +25 -0
  74. package/dist/entities/projects.d.ts.map +1 -0
  75. package/dist/entities/projects.js +349 -0
  76. package/dist/entities/projects.js.map +1 -0
  77. package/dist/entities/risk.d.ts +21 -0
  78. package/dist/entities/risk.d.ts.map +1 -0
  79. package/dist/entities/risk.js +293 -0
  80. package/dist/entities/risk.js.map +1 -0
  81. package/dist/entities/sales.d.ts +72 -0
  82. package/dist/entities/sales.d.ts.map +1 -0
  83. package/dist/entities/sales.js +1248 -0
  84. package/dist/entities/sales.js.map +1 -0
  85. package/dist/financials.d.ts +130 -0
  86. package/dist/financials.d.ts.map +1 -0
  87. package/dist/financials.js +297 -0
  88. package/dist/financials.js.map +1 -0
  89. package/dist/goals.d.ts +87 -0
  90. package/dist/goals.d.ts.map +1 -0
  91. package/dist/goals.js +215 -0
  92. package/dist/goals.js.map +1 -0
  93. package/dist/index.d.ts +97 -4
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +131 -1079
  96. package/dist/index.js.map +1 -1
  97. package/dist/kpis.d.ts +118 -0
  98. package/dist/kpis.d.ts.map +1 -0
  99. package/dist/kpis.js +232 -0
  100. package/dist/kpis.js.map +1 -0
  101. package/dist/metrics.d.ts +448 -0
  102. package/dist/metrics.d.ts.map +1 -0
  103. package/dist/metrics.js +325 -0
  104. package/dist/metrics.js.map +1 -0
  105. package/dist/okrs.d.ts +123 -0
  106. package/dist/okrs.d.ts.map +1 -0
  107. package/dist/okrs.js +269 -0
  108. package/dist/okrs.js.map +1 -0
  109. package/dist/organization.d.ts +585 -0
  110. package/dist/organization.d.ts.map +1 -0
  111. package/dist/organization.js +173 -0
  112. package/dist/organization.js.map +1 -0
  113. package/dist/process.d.ts +112 -0
  114. package/dist/process.d.ts.map +1 -0
  115. package/dist/process.js +241 -0
  116. package/dist/process.js.map +1 -0
  117. package/dist/product.d.ts +85 -0
  118. package/dist/product.d.ts.map +1 -0
  119. package/dist/product.js +145 -0
  120. package/dist/product.js.map +1 -0
  121. package/dist/queries.d.ts +304 -0
  122. package/dist/queries.d.ts.map +1 -0
  123. package/dist/queries.js +415 -0
  124. package/dist/queries.js.map +1 -0
  125. package/dist/roles.d.ts +340 -0
  126. package/dist/roles.d.ts.map +1 -0
  127. package/dist/roles.js +255 -0
  128. package/dist/roles.js.map +1 -0
  129. package/dist/service.d.ts +61 -0
  130. package/dist/service.d.ts.map +1 -0
  131. package/dist/service.js +140 -0
  132. package/dist/service.js.map +1 -0
  133. package/dist/types.d.ts +459 -0
  134. package/dist/types.d.ts.map +1 -0
  135. package/dist/types.js +5 -0
  136. package/dist/types.js.map +1 -0
  137. package/dist/vision.d.ts +38 -0
  138. package/dist/vision.d.ts.map +1 -0
  139. package/dist/vision.js +68 -0
  140. package/dist/vision.js.map +1 -0
  141. package/dist/workflow.d.ts +115 -0
  142. package/dist/workflow.d.ts.map +1 -0
  143. package/dist/workflow.js +247 -0
  144. package/dist/workflow.js.map +1 -0
  145. package/examples/basic-usage.ts +307 -0
  146. package/package.json +19 -60
  147. package/src/business.ts +121 -0
  148. package/src/dollar.ts +132 -0
  149. package/src/entities/assets.ts +332 -0
  150. package/src/entities/business.ts +406 -0
  151. package/src/entities/communication.ts +264 -0
  152. package/src/entities/customers.ts +1072 -0
  153. package/src/entities/financials.ts +1011 -0
  154. package/src/entities/goals.ts +871 -0
  155. package/src/entities/index.ts +383 -0
  156. package/src/entities/legal.ts +310 -0
  157. package/src/entities/market.ts +310 -0
  158. package/src/entities/marketing.ts +1249 -0
  159. package/src/entities/offerings.ts +789 -0
  160. package/src/entities/operations.ts +861 -0
  161. package/src/entities/organization.ts +876 -0
  162. package/src/entities/partnerships.ts +309 -0
  163. package/src/entities/planning.ts +307 -0
  164. package/src/entities/projects.ts +360 -0
  165. package/src/entities/risk.ts +302 -0
  166. package/src/entities/sales.ts +1352 -0
  167. package/src/financials.ts +352 -0
  168. package/src/goals.ts +250 -0
  169. package/src/index.test.ts +336 -0
  170. package/src/index.ts +530 -0
  171. package/src/kpis.ts +275 -0
  172. package/src/metrics.ts +825 -0
  173. package/src/okrs.ts +325 -0
  174. package/src/organization.ts +909 -0
  175. package/src/process.ts +272 -0
  176. package/src/product.ts +178 -0
  177. package/src/queries.ts +767 -0
  178. package/src/roles.ts +686 -0
  179. package/src/service.ts +164 -0
  180. package/src/types.ts +493 -0
  181. package/src/vision.ts +88 -0
  182. package/src/workflow.ts +280 -0
  183. package/tsconfig.json +9 -0
  184. package/dist/loaders/index.d.ts +0 -174
  185. package/dist/loaders/index.js +0 -366
  186. package/dist/loaders/index.js.map +0 -1
  187. package/dist/schema/index.d.ts +0 -146
  188. package/dist/schema/index.js +0 -716
  189. package/dist/schema/index.js.map +0 -1
  190. package/dist/types-CJ9eGS_C.d.ts +0 -86
@@ -0,0 +1,1011 @@
1
+ /**
2
+ * Financial Entity Types (Nouns)
3
+ *
4
+ * Financial entities: Budget, Revenue, Expense, Investment, FinancialPeriod.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+
9
+ import type { Noun } from 'ai-database'
10
+
11
+ // =============================================================================
12
+ // Budget
13
+ // =============================================================================
14
+
15
+ /**
16
+ * Budget entity
17
+ *
18
+ * Represents a budget allocation.
19
+ */
20
+ export const Budget: Noun = {
21
+ singular: 'budget',
22
+ plural: 'budgets',
23
+ description: 'A budget allocation',
24
+
25
+ properties: {
26
+ // Identity
27
+ name: {
28
+ type: 'string',
29
+ description: 'Budget name',
30
+ },
31
+ description: {
32
+ type: 'string',
33
+ optional: true,
34
+ description: 'Budget description',
35
+ },
36
+
37
+ // Classification
38
+ type: {
39
+ type: 'string',
40
+ optional: true,
41
+ description: 'Budget type',
42
+ examples: ['operating', 'capital', 'project', 'marketing', 'hiring', 'r&d'],
43
+ },
44
+ category: {
45
+ type: 'string',
46
+ optional: true,
47
+ description: 'Budget category',
48
+ },
49
+
50
+ // Period
51
+ period: {
52
+ type: 'string',
53
+ optional: true,
54
+ description: 'Budget period (e.g., "Q1 2025", "FY2025")',
55
+ },
56
+ startDate: {
57
+ type: 'date',
58
+ optional: true,
59
+ description: 'Period start date',
60
+ },
61
+ endDate: {
62
+ type: 'date',
63
+ optional: true,
64
+ description: 'Period end date',
65
+ },
66
+
67
+ // Amounts
68
+ amount: {
69
+ type: 'number',
70
+ description: 'Budgeted amount',
71
+ },
72
+ currency: {
73
+ type: 'string',
74
+ optional: true,
75
+ description: 'Currency code',
76
+ },
77
+ spent: {
78
+ type: 'number',
79
+ optional: true,
80
+ description: 'Amount spent',
81
+ },
82
+ committed: {
83
+ type: 'number',
84
+ optional: true,
85
+ description: 'Amount committed',
86
+ },
87
+ available: {
88
+ type: 'number',
89
+ optional: true,
90
+ description: 'Available amount',
91
+ },
92
+
93
+ // Utilization
94
+ utilization: {
95
+ type: 'number',
96
+ optional: true,
97
+ description: 'Utilization percentage',
98
+ },
99
+
100
+ // Status
101
+ status: {
102
+ type: 'string',
103
+ description: 'Budget status',
104
+ examples: ['draft', 'approved', 'active', 'frozen', 'closed'],
105
+ },
106
+ },
107
+
108
+ relationships: {
109
+ owner: {
110
+ type: 'Worker',
111
+ required: false,
112
+ description: 'Budget owner',
113
+ },
114
+ department: {
115
+ type: 'Department',
116
+ required: false,
117
+ description: 'Owning department',
118
+ },
119
+ team: {
120
+ type: 'Team',
121
+ required: false,
122
+ description: 'Owning team',
123
+ },
124
+ expenses: {
125
+ type: 'Expense[]',
126
+ description: 'Budget expenses',
127
+ },
128
+ parent: {
129
+ type: 'Budget',
130
+ required: false,
131
+ description: 'Parent budget',
132
+ },
133
+ children: {
134
+ type: 'Budget[]',
135
+ description: 'Sub-budgets',
136
+ },
137
+ },
138
+
139
+ actions: [
140
+ 'create',
141
+ 'update',
142
+ 'submit',
143
+ 'approve',
144
+ 'allocate',
145
+ 'reallocate',
146
+ 'freeze',
147
+ 'unfreeze',
148
+ 'close',
149
+ 'archive',
150
+ ],
151
+
152
+ events: [
153
+ 'created',
154
+ 'updated',
155
+ 'submitted',
156
+ 'approved',
157
+ 'allocated',
158
+ 'reallocated',
159
+ 'frozen',
160
+ 'unfrozen',
161
+ 'thresholdWarning',
162
+ 'overBudget',
163
+ 'closed',
164
+ 'archived',
165
+ ],
166
+ }
167
+
168
+ // =============================================================================
169
+ // Revenue
170
+ // =============================================================================
171
+
172
+ /**
173
+ * Revenue entity
174
+ *
175
+ * Represents a revenue record.
176
+ */
177
+ export const Revenue: Noun = {
178
+ singular: 'revenue',
179
+ plural: 'revenues',
180
+ description: 'A revenue record',
181
+
182
+ properties: {
183
+ // Classification
184
+ type: {
185
+ type: 'string',
186
+ optional: true,
187
+ description: 'Revenue type',
188
+ examples: ['subscription', 'one-time', 'usage', 'professional-services', 'licensing', 'other'],
189
+ },
190
+ category: {
191
+ type: 'string',
192
+ optional: true,
193
+ description: 'Revenue category',
194
+ },
195
+ source: {
196
+ type: 'string',
197
+ optional: true,
198
+ description: 'Revenue source',
199
+ },
200
+
201
+ // Amount
202
+ amount: {
203
+ type: 'number',
204
+ description: 'Revenue amount',
205
+ },
206
+ currency: {
207
+ type: 'string',
208
+ optional: true,
209
+ description: 'Currency code',
210
+ },
211
+
212
+ // Period
213
+ period: {
214
+ type: 'string',
215
+ optional: true,
216
+ description: 'Revenue period',
217
+ },
218
+ date: {
219
+ type: 'date',
220
+ optional: true,
221
+ description: 'Revenue date',
222
+ },
223
+
224
+ // Recurring
225
+ isRecurring: {
226
+ type: 'boolean',
227
+ optional: true,
228
+ description: 'Is recurring revenue',
229
+ },
230
+ recurringPeriod: {
231
+ type: 'string',
232
+ optional: true,
233
+ description: 'Recurring period',
234
+ examples: ['monthly', 'quarterly', 'yearly'],
235
+ },
236
+
237
+ // Recognition
238
+ recognized: {
239
+ type: 'boolean',
240
+ optional: true,
241
+ description: 'Revenue recognized',
242
+ },
243
+ recognizedAt: {
244
+ type: 'date',
245
+ optional: true,
246
+ description: 'Recognition date',
247
+ },
248
+ deferredAmount: {
249
+ type: 'number',
250
+ optional: true,
251
+ description: 'Deferred revenue amount',
252
+ },
253
+
254
+ // Attribution
255
+ segment: {
256
+ type: 'string',
257
+ optional: true,
258
+ description: 'Business segment',
259
+ },
260
+ region: {
261
+ type: 'string',
262
+ optional: true,
263
+ description: 'Geographic region',
264
+ },
265
+ },
266
+
267
+ relationships: {
268
+ product: {
269
+ type: 'Product',
270
+ required: false,
271
+ description: 'Revenue product',
272
+ },
273
+ service: {
274
+ type: 'Service',
275
+ required: false,
276
+ description: 'Revenue service',
277
+ },
278
+ customer: {
279
+ type: 'Customer',
280
+ required: false,
281
+ description: 'Customer',
282
+ },
283
+ period: {
284
+ type: 'FinancialPeriod',
285
+ required: false,
286
+ description: 'Financial period',
287
+ },
288
+ },
289
+
290
+ actions: [
291
+ 'record',
292
+ 'update',
293
+ 'recognize',
294
+ 'defer',
295
+ 'void',
296
+ ],
297
+
298
+ events: [
299
+ 'recorded',
300
+ 'updated',
301
+ 'recognized',
302
+ 'deferred',
303
+ 'voided',
304
+ ],
305
+ }
306
+
307
+ // =============================================================================
308
+ // Expense
309
+ // =============================================================================
310
+
311
+ /**
312
+ * Expense entity
313
+ *
314
+ * Represents an expense record.
315
+ */
316
+ export const Expense: Noun = {
317
+ singular: 'expense',
318
+ plural: 'expenses',
319
+ description: 'An expense record',
320
+
321
+ properties: {
322
+ // Identity
323
+ description: {
324
+ type: 'string',
325
+ description: 'Expense description',
326
+ },
327
+
328
+ // Classification
329
+ type: {
330
+ type: 'string',
331
+ optional: true,
332
+ description: 'Expense type',
333
+ examples: ['payroll', 'cogs', 'marketing', 'sales', 'r&d', 'g&a', 'facilities', 'travel', 'software', 'services'],
334
+ },
335
+ category: {
336
+ type: 'string',
337
+ optional: true,
338
+ description: 'Expense category',
339
+ },
340
+ subcategory: {
341
+ type: 'string',
342
+ optional: true,
343
+ description: 'Expense subcategory',
344
+ },
345
+
346
+ // Amount
347
+ amount: {
348
+ type: 'number',
349
+ description: 'Expense amount',
350
+ },
351
+ currency: {
352
+ type: 'string',
353
+ optional: true,
354
+ description: 'Currency code',
355
+ },
356
+
357
+ // Date
358
+ date: {
359
+ type: 'date',
360
+ description: 'Expense date',
361
+ },
362
+ period: {
363
+ type: 'string',
364
+ optional: true,
365
+ description: 'Expense period',
366
+ },
367
+
368
+ // Recurring
369
+ isRecurring: {
370
+ type: 'boolean',
371
+ optional: true,
372
+ description: 'Is recurring expense',
373
+ },
374
+ recurringPeriod: {
375
+ type: 'string',
376
+ optional: true,
377
+ description: 'Recurring period',
378
+ },
379
+
380
+ // Classification
381
+ isCapex: {
382
+ type: 'boolean',
383
+ optional: true,
384
+ description: 'Is capital expenditure',
385
+ },
386
+ isDeductible: {
387
+ type: 'boolean',
388
+ optional: true,
389
+ description: 'Is tax deductible',
390
+ },
391
+
392
+ // Vendor
393
+ vendor: {
394
+ type: 'string',
395
+ optional: true,
396
+ description: 'Vendor name',
397
+ },
398
+ invoiceNumber: {
399
+ type: 'string',
400
+ optional: true,
401
+ description: 'Invoice number',
402
+ },
403
+
404
+ // Status
405
+ status: {
406
+ type: 'string',
407
+ description: 'Expense status',
408
+ examples: ['draft', 'submitted', 'approved', 'rejected', 'paid', 'voided'],
409
+ },
410
+ },
411
+
412
+ relationships: {
413
+ submitter: {
414
+ type: 'Worker',
415
+ required: false,
416
+ description: 'Who submitted',
417
+ },
418
+ approver: {
419
+ type: 'Worker',
420
+ required: false,
421
+ description: 'Who approved',
422
+ },
423
+ budget: {
424
+ type: 'Budget',
425
+ required: false,
426
+ description: 'Budget charged',
427
+ },
428
+ department: {
429
+ type: 'Department',
430
+ required: false,
431
+ description: 'Department',
432
+ },
433
+ period: {
434
+ type: 'FinancialPeriod',
435
+ required: false,
436
+ description: 'Financial period',
437
+ },
438
+ },
439
+
440
+ actions: [
441
+ 'create',
442
+ 'update',
443
+ 'submit',
444
+ 'approve',
445
+ 'reject',
446
+ 'pay',
447
+ 'void',
448
+ ],
449
+
450
+ events: [
451
+ 'created',
452
+ 'updated',
453
+ 'submitted',
454
+ 'approved',
455
+ 'rejected',
456
+ 'paid',
457
+ 'voided',
458
+ ],
459
+ }
460
+
461
+ // =============================================================================
462
+ // Investment
463
+ // =============================================================================
464
+
465
+ /**
466
+ * Investment entity
467
+ *
468
+ * Represents a funding or investment round.
469
+ */
470
+ export const Investment: Noun = {
471
+ singular: 'investment',
472
+ plural: 'investments',
473
+ description: 'A funding or investment round',
474
+
475
+ properties: {
476
+ // Identity
477
+ name: {
478
+ type: 'string',
479
+ description: 'Investment name/round',
480
+ },
481
+ description: {
482
+ type: 'string',
483
+ optional: true,
484
+ description: 'Investment description',
485
+ },
486
+
487
+ // Type
488
+ type: {
489
+ type: 'string',
490
+ optional: true,
491
+ description: 'Investment type',
492
+ examples: ['pre-seed', 'seed', 'series-a', 'series-b', 'series-c', 'series-d', 'growth', 'debt', 'grant'],
493
+ },
494
+ instrumentType: {
495
+ type: 'string',
496
+ optional: true,
497
+ description: 'Instrument type',
498
+ examples: ['equity', 'safe', 'convertible-note', 'debt', 'revenue-based'],
499
+ },
500
+
501
+ // Amount
502
+ amount: {
503
+ type: 'number',
504
+ description: 'Investment amount',
505
+ },
506
+ currency: {
507
+ type: 'string',
508
+ optional: true,
509
+ description: 'Currency code',
510
+ },
511
+
512
+ // Valuation
513
+ preMoneyValuation: {
514
+ type: 'number',
515
+ optional: true,
516
+ description: 'Pre-money valuation',
517
+ },
518
+ postMoneyValuation: {
519
+ type: 'number',
520
+ optional: true,
521
+ description: 'Post-money valuation',
522
+ },
523
+ valuationCap: {
524
+ type: 'number',
525
+ optional: true,
526
+ description: 'Valuation cap (for SAFEs/convertibles)',
527
+ },
528
+ discount: {
529
+ type: 'number',
530
+ optional: true,
531
+ description: 'Discount percentage',
532
+ },
533
+
534
+ // Equity
535
+ equityPercentage: {
536
+ type: 'number',
537
+ optional: true,
538
+ description: 'Equity percentage sold',
539
+ },
540
+ sharesIssued: {
541
+ type: 'number',
542
+ optional: true,
543
+ description: 'Shares issued',
544
+ },
545
+ pricePerShare: {
546
+ type: 'number',
547
+ optional: true,
548
+ description: 'Price per share',
549
+ },
550
+
551
+ // Timeline
552
+ announcedAt: {
553
+ type: 'date',
554
+ optional: true,
555
+ description: 'Announcement date',
556
+ },
557
+ closedAt: {
558
+ type: 'date',
559
+ optional: true,
560
+ description: 'Closing date',
561
+ },
562
+
563
+ // Terms
564
+ interestRate: {
565
+ type: 'number',
566
+ optional: true,
567
+ description: 'Interest rate (for debt)',
568
+ },
569
+ maturityDate: {
570
+ type: 'date',
571
+ optional: true,
572
+ description: 'Maturity date (for debt)',
573
+ },
574
+
575
+ // Lead
576
+ leadInvestor: {
577
+ type: 'string',
578
+ optional: true,
579
+ description: 'Lead investor',
580
+ },
581
+ investors: {
582
+ type: 'string',
583
+ array: true,
584
+ optional: true,
585
+ description: 'All investors',
586
+ },
587
+
588
+ // Status
589
+ status: {
590
+ type: 'string',
591
+ description: 'Investment status',
592
+ examples: ['prospecting', 'negotiating', 'term-sheet', 'due-diligence', 'closing', 'closed', 'cancelled'],
593
+ },
594
+ },
595
+
596
+ relationships: {
597
+ business: {
598
+ type: 'Business',
599
+ description: 'Business receiving investment',
600
+ },
601
+ },
602
+
603
+ actions: [
604
+ 'create',
605
+ 'update',
606
+ 'negotiate',
607
+ 'signTermSheet',
608
+ 'close',
609
+ 'announce',
610
+ 'cancel',
611
+ ],
612
+
613
+ events: [
614
+ 'created',
615
+ 'updated',
616
+ 'negotiated',
617
+ 'termSheetSigned',
618
+ 'closed',
619
+ 'announced',
620
+ 'cancelled',
621
+ ],
622
+ }
623
+
624
+ // =============================================================================
625
+ // FinancialPeriod
626
+ // =============================================================================
627
+
628
+ /**
629
+ * FinancialPeriod entity
630
+ *
631
+ * Represents a financial reporting period.
632
+ */
633
+ export const FinancialPeriod: Noun = {
634
+ singular: 'financial-period',
635
+ plural: 'financial-periods',
636
+ description: 'A financial reporting period',
637
+
638
+ properties: {
639
+ // Identity
640
+ name: {
641
+ type: 'string',
642
+ description: 'Period name (e.g., "Q1 2025", "FY2025")',
643
+ },
644
+
645
+ // Type
646
+ type: {
647
+ type: 'string',
648
+ description: 'Period type',
649
+ examples: ['month', 'quarter', 'half-year', 'year'],
650
+ },
651
+
652
+ // Dates
653
+ startDate: {
654
+ type: 'date',
655
+ description: 'Period start date',
656
+ },
657
+ endDate: {
658
+ type: 'date',
659
+ description: 'Period end date',
660
+ },
661
+
662
+ // Financials
663
+ revenue: {
664
+ type: 'number',
665
+ optional: true,
666
+ description: 'Total revenue',
667
+ },
668
+ cogs: {
669
+ type: 'number',
670
+ optional: true,
671
+ description: 'Cost of goods sold',
672
+ },
673
+ grossProfit: {
674
+ type: 'number',
675
+ optional: true,
676
+ description: 'Gross profit',
677
+ },
678
+ grossMargin: {
679
+ type: 'number',
680
+ optional: true,
681
+ description: 'Gross margin percentage',
682
+ },
683
+ operatingExpenses: {
684
+ type: 'number',
685
+ optional: true,
686
+ description: 'Operating expenses',
687
+ },
688
+ operatingIncome: {
689
+ type: 'number',
690
+ optional: true,
691
+ description: 'Operating income (EBIT)',
692
+ },
693
+ operatingMargin: {
694
+ type: 'number',
695
+ optional: true,
696
+ description: 'Operating margin percentage',
697
+ },
698
+ netIncome: {
699
+ type: 'number',
700
+ optional: true,
701
+ description: 'Net income',
702
+ },
703
+ netMargin: {
704
+ type: 'number',
705
+ optional: true,
706
+ description: 'Net margin percentage',
707
+ },
708
+ ebitda: {
709
+ type: 'number',
710
+ optional: true,
711
+ description: 'EBITDA',
712
+ },
713
+ ebitdaMargin: {
714
+ type: 'number',
715
+ optional: true,
716
+ description: 'EBITDA margin percentage',
717
+ },
718
+
719
+ // Cash
720
+ cashStart: {
721
+ type: 'number',
722
+ optional: true,
723
+ description: 'Cash at start',
724
+ },
725
+ cashEnd: {
726
+ type: 'number',
727
+ optional: true,
728
+ description: 'Cash at end',
729
+ },
730
+ cashFlow: {
731
+ type: 'number',
732
+ optional: true,
733
+ description: 'Net cash flow',
734
+ },
735
+ burnRate: {
736
+ type: 'number',
737
+ optional: true,
738
+ description: 'Monthly burn rate',
739
+ },
740
+ runway: {
741
+ type: 'number',
742
+ optional: true,
743
+ description: 'Runway in months',
744
+ },
745
+
746
+ // SaaS Metrics
747
+ mrr: {
748
+ type: 'number',
749
+ optional: true,
750
+ description: 'Monthly recurring revenue',
751
+ },
752
+ arr: {
753
+ type: 'number',
754
+ optional: true,
755
+ description: 'Annual recurring revenue',
756
+ },
757
+ nrr: {
758
+ type: 'number',
759
+ optional: true,
760
+ description: 'Net revenue retention',
761
+ },
762
+ grr: {
763
+ type: 'number',
764
+ optional: true,
765
+ description: 'Gross revenue retention',
766
+ },
767
+ customers: {
768
+ type: 'number',
769
+ optional: true,
770
+ description: 'Customer count',
771
+ },
772
+ arpu: {
773
+ type: 'number',
774
+ optional: true,
775
+ description: 'Average revenue per user',
776
+ },
777
+ cac: {
778
+ type: 'number',
779
+ optional: true,
780
+ description: 'Customer acquisition cost',
781
+ },
782
+ ltv: {
783
+ type: 'number',
784
+ optional: true,
785
+ description: 'Lifetime value',
786
+ },
787
+ ltvCacRatio: {
788
+ type: 'number',
789
+ optional: true,
790
+ description: 'LTV:CAC ratio',
791
+ },
792
+ churnRate: {
793
+ type: 'number',
794
+ optional: true,
795
+ description: 'Churn rate',
796
+ },
797
+
798
+ // Currency
799
+ currency: {
800
+ type: 'string',
801
+ optional: true,
802
+ description: 'Reporting currency',
803
+ },
804
+
805
+ // Status
806
+ status: {
807
+ type: 'string',
808
+ description: 'Period status',
809
+ examples: ['open', 'closed', 'audited'],
810
+ },
811
+ },
812
+
813
+ relationships: {
814
+ business: {
815
+ type: 'Business',
816
+ description: 'Business',
817
+ },
818
+ revenues: {
819
+ type: 'Revenue[]',
820
+ description: 'Period revenues',
821
+ },
822
+ expenses: {
823
+ type: 'Expense[]',
824
+ description: 'Period expenses',
825
+ },
826
+ budgets: {
827
+ type: 'Budget[]',
828
+ description: 'Period budgets',
829
+ },
830
+ previous: {
831
+ type: 'FinancialPeriod',
832
+ required: false,
833
+ description: 'Previous period',
834
+ },
835
+ },
836
+
837
+ actions: [
838
+ 'create',
839
+ 'update',
840
+ 'close',
841
+ 'reopen',
842
+ 'audit',
843
+ ],
844
+
845
+ events: [
846
+ 'created',
847
+ 'updated',
848
+ 'closed',
849
+ 'reopened',
850
+ 'audited',
851
+ ],
852
+ }
853
+
854
+ // =============================================================================
855
+ // Forecast
856
+ // =============================================================================
857
+
858
+ /**
859
+ * Forecast entity
860
+ *
861
+ * Represents a financial forecast.
862
+ */
863
+ export const Forecast: Noun = {
864
+ singular: 'forecast',
865
+ plural: 'forecasts',
866
+ description: 'A financial forecast',
867
+
868
+ properties: {
869
+ // Identity
870
+ name: {
871
+ type: 'string',
872
+ description: 'Forecast name',
873
+ },
874
+ description: {
875
+ type: 'string',
876
+ optional: true,
877
+ description: 'Forecast description',
878
+ },
879
+
880
+ // Type
881
+ type: {
882
+ type: 'string',
883
+ optional: true,
884
+ description: 'Forecast type',
885
+ examples: ['revenue', 'expense', 'cash', 'headcount', 'arr'],
886
+ },
887
+ scenario: {
888
+ type: 'string',
889
+ optional: true,
890
+ description: 'Scenario',
891
+ examples: ['base', 'optimistic', 'pessimistic', 'stretch'],
892
+ },
893
+
894
+ // Period
895
+ startDate: {
896
+ type: 'date',
897
+ description: 'Forecast start date',
898
+ },
899
+ endDate: {
900
+ type: 'date',
901
+ description: 'Forecast end date',
902
+ },
903
+ granularity: {
904
+ type: 'string',
905
+ optional: true,
906
+ description: 'Forecast granularity',
907
+ examples: ['monthly', 'quarterly', 'yearly'],
908
+ },
909
+
910
+ // Values
911
+ values: {
912
+ type: 'json',
913
+ optional: true,
914
+ description: 'Forecast values by period',
915
+ },
916
+ total: {
917
+ type: 'number',
918
+ optional: true,
919
+ description: 'Total forecasted amount',
920
+ },
921
+ currency: {
922
+ type: 'string',
923
+ optional: true,
924
+ description: 'Currency code',
925
+ },
926
+
927
+ // Assumptions
928
+ assumptions: {
929
+ type: 'string',
930
+ array: true,
931
+ optional: true,
932
+ description: 'Forecast assumptions',
933
+ },
934
+ growthRate: {
935
+ type: 'number',
936
+ optional: true,
937
+ description: 'Assumed growth rate',
938
+ },
939
+
940
+ // Accuracy
941
+ confidenceLevel: {
942
+ type: 'number',
943
+ optional: true,
944
+ description: 'Confidence level (0-100)',
945
+ },
946
+
947
+ // Versioning
948
+ version: {
949
+ type: 'number',
950
+ optional: true,
951
+ description: 'Forecast version',
952
+ },
953
+
954
+ // Status
955
+ status: {
956
+ type: 'string',
957
+ description: 'Forecast status',
958
+ examples: ['draft', 'review', 'approved', 'superseded'],
959
+ },
960
+ },
961
+
962
+ relationships: {
963
+ owner: {
964
+ type: 'Worker',
965
+ required: false,
966
+ description: 'Forecast owner',
967
+ },
968
+ basedOn: {
969
+ type: 'FinancialPeriod[]',
970
+ description: 'Historical periods used',
971
+ },
972
+ },
973
+
974
+ actions: [
975
+ 'create',
976
+ 'update',
977
+ 'submit',
978
+ 'approve',
979
+ 'supersede',
980
+ 'archive',
981
+ ],
982
+
983
+ events: [
984
+ 'created',
985
+ 'updated',
986
+ 'submitted',
987
+ 'approved',
988
+ 'superseded',
989
+ 'archived',
990
+ ],
991
+ }
992
+
993
+ // =============================================================================
994
+ // Exports
995
+ // =============================================================================
996
+
997
+ export const FinancialEntities = {
998
+ Budget,
999
+ Revenue,
1000
+ Expense,
1001
+ Investment,
1002
+ FinancialPeriod,
1003
+ Forecast,
1004
+ }
1005
+
1006
+ export const FinancialCategories = {
1007
+ planning: ['Budget', 'Forecast'],
1008
+ transactions: ['Revenue', 'Expense'],
1009
+ funding: ['Investment'],
1010
+ reporting: ['FinancialPeriod'],
1011
+ } as const