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