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.
- package/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +17 -0
- package/IMPLEMENTATION.md +226 -0
- package/README.md +1133 -193
- package/dist/business.d.ts +62 -0
- package/dist/business.d.ts.map +1 -0
- package/dist/business.js +109 -0
- package/dist/business.js.map +1 -0
- package/dist/dollar.d.ts +60 -0
- package/dist/dollar.d.ts.map +1 -0
- package/dist/dollar.js +107 -0
- package/dist/dollar.js.map +1 -0
- package/dist/entities/assets.d.ts +21 -0
- package/dist/entities/assets.d.ts.map +1 -0
- package/dist/entities/assets.js +323 -0
- package/dist/entities/assets.js.map +1 -0
- package/dist/entities/business.d.ts +36 -0
- package/dist/entities/business.d.ts.map +1 -0
- package/dist/entities/business.js +370 -0
- package/dist/entities/business.js.map +1 -0
- package/dist/entities/communication.d.ts +21 -0
- package/dist/entities/communication.d.ts.map +1 -0
- package/dist/entities/communication.js +255 -0
- package/dist/entities/communication.js.map +1 -0
- package/dist/entities/customers.d.ts +58 -0
- package/dist/entities/customers.d.ts.map +1 -0
- package/dist/entities/customers.js +989 -0
- package/dist/entities/customers.js.map +1 -0
- package/dist/entities/financials.d.ts +59 -0
- package/dist/entities/financials.d.ts.map +1 -0
- package/dist/entities/financials.js +932 -0
- package/dist/entities/financials.js.map +1 -0
- package/dist/entities/goals.d.ts +58 -0
- package/dist/entities/goals.d.ts.map +1 -0
- package/dist/entities/goals.js +800 -0
- package/dist/entities/goals.js.map +1 -0
- package/dist/entities/index.d.ts +299 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +198 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/legal.d.ts +21 -0
- package/dist/entities/legal.d.ts.map +1 -0
- package/dist/entities/legal.js +301 -0
- package/dist/entities/legal.js.map +1 -0
- package/dist/entities/market.d.ts +21 -0
- package/dist/entities/market.d.ts.map +1 -0
- package/dist/entities/market.js +301 -0
- package/dist/entities/market.js.map +1 -0
- package/dist/entities/marketing.d.ts +67 -0
- package/dist/entities/marketing.d.ts.map +1 -0
- package/dist/entities/marketing.js +1157 -0
- package/dist/entities/marketing.js.map +1 -0
- package/dist/entities/offerings.d.ts +51 -0
- package/dist/entities/offerings.d.ts.map +1 -0
- package/dist/entities/offerings.js +727 -0
- package/dist/entities/offerings.js.map +1 -0
- package/dist/entities/operations.d.ts +58 -0
- package/dist/entities/operations.d.ts.map +1 -0
- package/dist/entities/operations.js +787 -0
- package/dist/entities/operations.js.map +1 -0
- package/dist/entities/organization.d.ts +57 -0
- package/dist/entities/organization.d.ts.map +1 -0
- package/dist/entities/organization.js +807 -0
- package/dist/entities/organization.js.map +1 -0
- package/dist/entities/partnerships.d.ts +21 -0
- package/dist/entities/partnerships.d.ts.map +1 -0
- package/dist/entities/partnerships.js +300 -0
- package/dist/entities/partnerships.js.map +1 -0
- package/dist/entities/planning.d.ts +87 -0
- package/dist/entities/planning.d.ts.map +1 -0
- package/dist/entities/planning.js +271 -0
- package/dist/entities/planning.js.map +1 -0
- package/dist/entities/projects.d.ts +25 -0
- package/dist/entities/projects.d.ts.map +1 -0
- package/dist/entities/projects.js +349 -0
- package/dist/entities/projects.js.map +1 -0
- package/dist/entities/risk.d.ts +21 -0
- package/dist/entities/risk.d.ts.map +1 -0
- package/dist/entities/risk.js +293 -0
- package/dist/entities/risk.js.map +1 -0
- package/dist/entities/sales.d.ts +72 -0
- package/dist/entities/sales.d.ts.map +1 -0
- package/dist/entities/sales.js +1248 -0
- package/dist/entities/sales.js.map +1 -0
- package/dist/financials.d.ts +130 -0
- package/dist/financials.d.ts.map +1 -0
- package/dist/financials.js +297 -0
- package/dist/financials.js.map +1 -0
- package/dist/goals.d.ts +87 -0
- package/dist/goals.d.ts.map +1 -0
- package/dist/goals.js +215 -0
- package/dist/goals.js.map +1 -0
- package/dist/index.d.ts +97 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +131 -1079
- package/dist/index.js.map +1 -1
- package/dist/kpis.d.ts +118 -0
- package/dist/kpis.d.ts.map +1 -0
- package/dist/kpis.js +232 -0
- package/dist/kpis.js.map +1 -0
- package/dist/metrics.d.ts +448 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +325 -0
- package/dist/metrics.js.map +1 -0
- package/dist/okrs.d.ts +123 -0
- package/dist/okrs.d.ts.map +1 -0
- package/dist/okrs.js +269 -0
- package/dist/okrs.js.map +1 -0
- package/dist/organization.d.ts +585 -0
- package/dist/organization.d.ts.map +1 -0
- package/dist/organization.js +173 -0
- package/dist/organization.js.map +1 -0
- package/dist/process.d.ts +112 -0
- package/dist/process.d.ts.map +1 -0
- package/dist/process.js +241 -0
- package/dist/process.js.map +1 -0
- package/dist/product.d.ts +85 -0
- package/dist/product.d.ts.map +1 -0
- package/dist/product.js +145 -0
- package/dist/product.js.map +1 -0
- package/dist/queries.d.ts +304 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +415 -0
- package/dist/queries.js.map +1 -0
- package/dist/roles.d.ts +340 -0
- package/dist/roles.d.ts.map +1 -0
- package/dist/roles.js +255 -0
- package/dist/roles.js.map +1 -0
- package/dist/service.d.ts +61 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +140 -0
- package/dist/service.js.map +1 -0
- package/dist/types.d.ts +459 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/vision.d.ts +38 -0
- package/dist/vision.d.ts.map +1 -0
- package/dist/vision.js +68 -0
- package/dist/vision.js.map +1 -0
- package/dist/workflow.d.ts +115 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +247 -0
- package/dist/workflow.js.map +1 -0
- package/examples/basic-usage.ts +307 -0
- package/package.json +19 -60
- package/src/business.ts +121 -0
- package/src/dollar.ts +132 -0
- package/src/entities/assets.ts +332 -0
- package/src/entities/business.ts +406 -0
- package/src/entities/communication.ts +264 -0
- package/src/entities/customers.ts +1072 -0
- package/src/entities/financials.ts +1011 -0
- package/src/entities/goals.ts +871 -0
- package/src/entities/index.ts +383 -0
- package/src/entities/legal.ts +310 -0
- package/src/entities/market.ts +310 -0
- package/src/entities/marketing.ts +1249 -0
- package/src/entities/offerings.ts +789 -0
- package/src/entities/operations.ts +861 -0
- package/src/entities/organization.ts +876 -0
- package/src/entities/partnerships.ts +309 -0
- package/src/entities/planning.ts +307 -0
- package/src/entities/projects.ts +360 -0
- package/src/entities/risk.ts +302 -0
- package/src/entities/sales.ts +1352 -0
- package/src/financials.ts +352 -0
- package/src/goals.ts +250 -0
- package/src/index.test.ts +336 -0
- package/src/index.ts +530 -0
- package/src/kpis.ts +275 -0
- package/src/metrics.ts +825 -0
- package/src/okrs.ts +325 -0
- package/src/organization.ts +909 -0
- package/src/process.ts +272 -0
- package/src/product.ts +178 -0
- package/src/queries.ts +767 -0
- package/src/roles.ts +686 -0
- package/src/service.ts +164 -0
- package/src/types.ts +493 -0
- package/src/vision.ts +88 -0
- package/src/workflow.ts +280 -0
- package/tsconfig.json +9 -0
- package/dist/loaders/index.d.ts +0 -174
- package/dist/loaders/index.js +0 -366
- package/dist/loaders/index.js.map +0 -1
- package/dist/schema/index.d.ts +0 -146
- package/dist/schema/index.js +0 -716
- package/dist/schema/index.js.map +0 -1
- package/dist/types-CJ9eGS_C.d.ts +0 -86
package/src/index.ts
ADDED
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* business-as-code - Primitives for expressing business logic and processes as code
|
|
3
|
+
*
|
|
4
|
+
* This package provides primitives for defining business entities, goals, products,
|
|
5
|
+
* services, processes, workflows, KPIs, OKRs, and financial metrics.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { Business, Product, Goals, kpis, okrs, financials, $ } from 'business-as-code'
|
|
10
|
+
*
|
|
11
|
+
* // Define your business
|
|
12
|
+
* const company = Business({
|
|
13
|
+
* name: 'Acme Corp',
|
|
14
|
+
* mission: 'To make widgets accessible to everyone',
|
|
15
|
+
* values: ['Innovation', 'Customer Focus', 'Integrity'],
|
|
16
|
+
* })
|
|
17
|
+
*
|
|
18
|
+
* // Define products
|
|
19
|
+
* const product = Product({
|
|
20
|
+
* name: 'Widget Pro',
|
|
21
|
+
* pricingModel: 'subscription',
|
|
22
|
+
* price: 99,
|
|
23
|
+
* cogs: 20,
|
|
24
|
+
* })
|
|
25
|
+
*
|
|
26
|
+
* // Define goals
|
|
27
|
+
* const goals = Goals([
|
|
28
|
+
* {
|
|
29
|
+
* name: 'Launch MVP',
|
|
30
|
+
* category: 'strategic',
|
|
31
|
+
* status: 'in-progress',
|
|
32
|
+
* progress: 65,
|
|
33
|
+
* },
|
|
34
|
+
* ])
|
|
35
|
+
*
|
|
36
|
+
* // Track KPIs
|
|
37
|
+
* const kpiList = kpis([
|
|
38
|
+
* {
|
|
39
|
+
* name: 'Monthly Recurring Revenue',
|
|
40
|
+
* category: 'financial',
|
|
41
|
+
* target: 100000,
|
|
42
|
+
* current: 85000,
|
|
43
|
+
* },
|
|
44
|
+
* ])
|
|
45
|
+
*
|
|
46
|
+
* // Define OKRs
|
|
47
|
+
* const okrList = okrs([
|
|
48
|
+
* {
|
|
49
|
+
* objective: 'Achieve Product-Market Fit',
|
|
50
|
+
* keyResults: [
|
|
51
|
+
* {
|
|
52
|
+
* description: 'Increase NPS',
|
|
53
|
+
* metric: 'NPS',
|
|
54
|
+
* targetValue: 60,
|
|
55
|
+
* currentValue: 52,
|
|
56
|
+
* },
|
|
57
|
+
* ],
|
|
58
|
+
* },
|
|
59
|
+
* ])
|
|
60
|
+
*
|
|
61
|
+
* // Calculate financials
|
|
62
|
+
* const metrics = financials({
|
|
63
|
+
* revenue: 1000000,
|
|
64
|
+
* cogs: 300000,
|
|
65
|
+
* operatingExpenses: 500000,
|
|
66
|
+
* })
|
|
67
|
+
*
|
|
68
|
+
* // Use $ helper for calculations
|
|
69
|
+
* console.log($.format(1234.56)) // "$1,234.56"
|
|
70
|
+
* console.log($.growth(120, 100)) // 20
|
|
71
|
+
* console.log($.margin(100, 60)) // 40
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @packageDocumentation
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
// Export all types
|
|
78
|
+
export type {
|
|
79
|
+
Currency,
|
|
80
|
+
TimePeriod,
|
|
81
|
+
BusinessDefinition,
|
|
82
|
+
OrganizationalStructure,
|
|
83
|
+
Department,
|
|
84
|
+
Team,
|
|
85
|
+
VisionDefinition,
|
|
86
|
+
GoalDefinition,
|
|
87
|
+
ProductDefinition,
|
|
88
|
+
ServiceDefinition,
|
|
89
|
+
RoadmapItem,
|
|
90
|
+
ServiceLevelAgreement,
|
|
91
|
+
ProcessDefinition,
|
|
92
|
+
ProcessStep,
|
|
93
|
+
ProcessMetric,
|
|
94
|
+
WorkflowDefinition,
|
|
95
|
+
WorkflowAction,
|
|
96
|
+
WorkflowTrigger,
|
|
97
|
+
KPIDefinition,
|
|
98
|
+
OKRDefinition,
|
|
99
|
+
KeyResult,
|
|
100
|
+
FinancialMetrics,
|
|
101
|
+
FinancialStatement,
|
|
102
|
+
BusinessContext,
|
|
103
|
+
BusinessOperations,
|
|
104
|
+
} from './types.js'
|
|
105
|
+
|
|
106
|
+
// Export business entity functions
|
|
107
|
+
export {
|
|
108
|
+
Business,
|
|
109
|
+
getTotalBudget,
|
|
110
|
+
getTotalTeamSize,
|
|
111
|
+
getDepartment,
|
|
112
|
+
getTeam,
|
|
113
|
+
validateBusiness,
|
|
114
|
+
} from './business.js'
|
|
115
|
+
|
|
116
|
+
// Export vision functions
|
|
117
|
+
export {
|
|
118
|
+
Vision,
|
|
119
|
+
checkIndicator,
|
|
120
|
+
calculateProgress,
|
|
121
|
+
validateVision,
|
|
122
|
+
} from './vision.js'
|
|
123
|
+
|
|
124
|
+
// Export goal functions
|
|
125
|
+
export {
|
|
126
|
+
Goals,
|
|
127
|
+
Goal,
|
|
128
|
+
updateProgress,
|
|
129
|
+
markAtRisk,
|
|
130
|
+
complete,
|
|
131
|
+
isOverdue,
|
|
132
|
+
getGoalsByCategory,
|
|
133
|
+
getGoalsByStatus,
|
|
134
|
+
getGoalsByOwner,
|
|
135
|
+
calculateOverallProgress,
|
|
136
|
+
hasCircularDependencies,
|
|
137
|
+
sortByDependencies,
|
|
138
|
+
validateGoals,
|
|
139
|
+
} from './goals.js'
|
|
140
|
+
|
|
141
|
+
// Export product functions
|
|
142
|
+
export {
|
|
143
|
+
Product,
|
|
144
|
+
calculateGrossMargin,
|
|
145
|
+
calculateGrossProfit,
|
|
146
|
+
getRoadmapByStatus,
|
|
147
|
+
getRoadmapByPriority,
|
|
148
|
+
getOverdueRoadmapItems,
|
|
149
|
+
updateRoadmapItem,
|
|
150
|
+
addFeature,
|
|
151
|
+
removeFeature,
|
|
152
|
+
validateProduct,
|
|
153
|
+
} from './product.js'
|
|
154
|
+
|
|
155
|
+
// Export service functions
|
|
156
|
+
export {
|
|
157
|
+
Service,
|
|
158
|
+
calculateHourlyPrice,
|
|
159
|
+
calculateMonthlyRetainer,
|
|
160
|
+
checkSLAUptime,
|
|
161
|
+
parseDeliveryTimeToDays,
|
|
162
|
+
estimateCompletionDate,
|
|
163
|
+
calculateValueBasedPrice,
|
|
164
|
+
validateService,
|
|
165
|
+
} from './service.js'
|
|
166
|
+
|
|
167
|
+
// Export process functions
|
|
168
|
+
export {
|
|
169
|
+
Process,
|
|
170
|
+
getStepsInOrder,
|
|
171
|
+
getStepsByAutomationLevel,
|
|
172
|
+
calculateTotalDuration,
|
|
173
|
+
formatDuration,
|
|
174
|
+
calculateAutomationPercentage,
|
|
175
|
+
getMetric,
|
|
176
|
+
meetsTarget,
|
|
177
|
+
calculateMetricAchievement,
|
|
178
|
+
updateMetric,
|
|
179
|
+
addStep,
|
|
180
|
+
removeStep,
|
|
181
|
+
validateProcess,
|
|
182
|
+
} from './process.js'
|
|
183
|
+
|
|
184
|
+
// Export workflow functions
|
|
185
|
+
export {
|
|
186
|
+
Workflow,
|
|
187
|
+
getActionsInOrder,
|
|
188
|
+
getActionsByType,
|
|
189
|
+
getConditionalActions,
|
|
190
|
+
addAction,
|
|
191
|
+
removeAction,
|
|
192
|
+
updateAction,
|
|
193
|
+
isEventTrigger,
|
|
194
|
+
isScheduleTrigger,
|
|
195
|
+
isWebhookTrigger,
|
|
196
|
+
parseWaitDuration,
|
|
197
|
+
evaluateCondition,
|
|
198
|
+
fillTemplate,
|
|
199
|
+
validateWorkflow,
|
|
200
|
+
} from './workflow.js'
|
|
201
|
+
|
|
202
|
+
// Export KPI functions
|
|
203
|
+
export {
|
|
204
|
+
kpis,
|
|
205
|
+
kpi,
|
|
206
|
+
calculateAchievement,
|
|
207
|
+
meetsTarget as kpiMeetsTarget,
|
|
208
|
+
updateCurrent,
|
|
209
|
+
updateTarget,
|
|
210
|
+
getKPIsByCategory,
|
|
211
|
+
getKPIsByFrequency,
|
|
212
|
+
getKPIsOnTarget,
|
|
213
|
+
getKPIsOffTarget,
|
|
214
|
+
calculateHealthScore,
|
|
215
|
+
groupByCategory,
|
|
216
|
+
calculateVariance,
|
|
217
|
+
calculateVariancePercentage,
|
|
218
|
+
formatValue,
|
|
219
|
+
comparePerformance,
|
|
220
|
+
validateKPIs,
|
|
221
|
+
} from './kpis.js'
|
|
222
|
+
|
|
223
|
+
// Export OKR functions
|
|
224
|
+
export {
|
|
225
|
+
okrs,
|
|
226
|
+
okr,
|
|
227
|
+
calculateKeyResultProgress,
|
|
228
|
+
calculateOKRProgress,
|
|
229
|
+
calculateConfidence,
|
|
230
|
+
updateKeyResult,
|
|
231
|
+
isKeyResultOnTrack,
|
|
232
|
+
isOKROnTrack,
|
|
233
|
+
getKeyResultsOnTrack,
|
|
234
|
+
getKeyResultsAtRisk,
|
|
235
|
+
getOKRsByOwner,
|
|
236
|
+
getOKRsByPeriod,
|
|
237
|
+
getOKRsByStatus,
|
|
238
|
+
calculateSuccessRate,
|
|
239
|
+
formatKeyResult,
|
|
240
|
+
compareOKRPerformance,
|
|
241
|
+
validateOKRs,
|
|
242
|
+
} from './okrs.js'
|
|
243
|
+
|
|
244
|
+
// Export financial functions
|
|
245
|
+
export {
|
|
246
|
+
financials,
|
|
247
|
+
calculateGrossMargin as calculateFinancialGrossMargin,
|
|
248
|
+
calculateOperatingMargin,
|
|
249
|
+
calculateNetMargin,
|
|
250
|
+
calculateEBITDAMargin,
|
|
251
|
+
calculateBurnRate,
|
|
252
|
+
calculateRunway,
|
|
253
|
+
calculateCAC,
|
|
254
|
+
calculateLTV,
|
|
255
|
+
calculateLTVtoCAC,
|
|
256
|
+
calculatePaybackPeriod,
|
|
257
|
+
calculateARR,
|
|
258
|
+
calculateMRR,
|
|
259
|
+
calculateGrowthRate,
|
|
260
|
+
calculateCAGR,
|
|
261
|
+
calculateROI,
|
|
262
|
+
calculateROE,
|
|
263
|
+
calculateROA,
|
|
264
|
+
calculateQuickRatio,
|
|
265
|
+
calculateCurrentRatio,
|
|
266
|
+
calculateDebtToEquity,
|
|
267
|
+
formatCurrency,
|
|
268
|
+
createStatement,
|
|
269
|
+
getLineItem,
|
|
270
|
+
compareMetrics,
|
|
271
|
+
validateFinancials,
|
|
272
|
+
} from './financials.js'
|
|
273
|
+
|
|
274
|
+
// Export $ helper and context management
|
|
275
|
+
export {
|
|
276
|
+
$,
|
|
277
|
+
createBusinessOperations,
|
|
278
|
+
updateContext,
|
|
279
|
+
getContext,
|
|
280
|
+
resetContext,
|
|
281
|
+
} from './dollar.js'
|
|
282
|
+
|
|
283
|
+
// Export SaaS metrics
|
|
284
|
+
export type {
|
|
285
|
+
// Time types
|
|
286
|
+
DateRange,
|
|
287
|
+
MetricPeriod,
|
|
288
|
+
DataPoint,
|
|
289
|
+
TimeSeries,
|
|
290
|
+
|
|
291
|
+
// Revenue metrics
|
|
292
|
+
MRR,
|
|
293
|
+
ARR,
|
|
294
|
+
NRR,
|
|
295
|
+
GRR,
|
|
296
|
+
ARPU,
|
|
297
|
+
RevenueSegment,
|
|
298
|
+
|
|
299
|
+
// Customer metrics
|
|
300
|
+
CAC,
|
|
301
|
+
LTV,
|
|
302
|
+
LTVtoCAC,
|
|
303
|
+
Churn,
|
|
304
|
+
RetentionCohort,
|
|
305
|
+
|
|
306
|
+
// Growth metrics
|
|
307
|
+
GrowthRate,
|
|
308
|
+
QuickRatio,
|
|
309
|
+
|
|
310
|
+
// Efficiency metrics
|
|
311
|
+
MagicNumber,
|
|
312
|
+
BurnMultiple,
|
|
313
|
+
RuleOf40,
|
|
314
|
+
EfficiencyScore,
|
|
315
|
+
|
|
316
|
+
// Pipeline & Sales
|
|
317
|
+
Pipeline,
|
|
318
|
+
PipelineStage,
|
|
319
|
+
SalesVelocity,
|
|
320
|
+
|
|
321
|
+
// Operational
|
|
322
|
+
NPS,
|
|
323
|
+
CustomerHealth,
|
|
324
|
+
HealthFactor,
|
|
325
|
+
|
|
326
|
+
// Comprehensive
|
|
327
|
+
SaaSMetrics,
|
|
328
|
+
} from './metrics.js'
|
|
329
|
+
|
|
330
|
+
export {
|
|
331
|
+
// SaaS Metric Calculation functions (produce structured SaaS metric objects)
|
|
332
|
+
calculateMRR as calculateMRRMetric,
|
|
333
|
+
calculateARRFromMRR as calculateARRMetric,
|
|
334
|
+
calculateNRR as calculateNRRMetric,
|
|
335
|
+
calculateGRR as calculateGRRMetric,
|
|
336
|
+
calculateCACMetric,
|
|
337
|
+
calculateLTVMetric,
|
|
338
|
+
calculateLTVtoCACRatio,
|
|
339
|
+
calculateQuickRatioMetric,
|
|
340
|
+
calculateMagicNumberMetric,
|
|
341
|
+
calculateBurnMultipleMetric,
|
|
342
|
+
calculateRuleOf40Metric,
|
|
343
|
+
calculateGrowthRates,
|
|
344
|
+
calculateChurnMetrics,
|
|
345
|
+
|
|
346
|
+
// Time-series aggregation
|
|
347
|
+
aggregateTimeSeries,
|
|
348
|
+
createMetricPeriod,
|
|
349
|
+
} from './metrics.js'
|
|
350
|
+
|
|
351
|
+
// Export live queries & views (ai-database / ClickHouse integration)
|
|
352
|
+
export type {
|
|
353
|
+
// Core types
|
|
354
|
+
Granularity,
|
|
355
|
+
AggregateFunction,
|
|
356
|
+
Operator,
|
|
357
|
+
SortDirection,
|
|
358
|
+
|
|
359
|
+
// OLAP primitives
|
|
360
|
+
Dimension,
|
|
361
|
+
Measure,
|
|
362
|
+
CalculatedMeasure,
|
|
363
|
+
|
|
364
|
+
// Query building
|
|
365
|
+
Filter,
|
|
366
|
+
Sort,
|
|
367
|
+
TimeRange,
|
|
368
|
+
Query,
|
|
369
|
+
ResolvedQuery,
|
|
370
|
+
|
|
371
|
+
// Views & Dashboards
|
|
372
|
+
View,
|
|
373
|
+
Dashboard,
|
|
374
|
+
DashboardLayout,
|
|
375
|
+
DashboardItem,
|
|
376
|
+
Visualization,
|
|
377
|
+
|
|
378
|
+
// Execution
|
|
379
|
+
QueryRow,
|
|
380
|
+
QueryResult,
|
|
381
|
+
QueryExecutor,
|
|
382
|
+
StreamingQueryResult,
|
|
383
|
+
StreamingQueryExecutor,
|
|
384
|
+
} from './queries.js'
|
|
385
|
+
|
|
386
|
+
export {
|
|
387
|
+
// Standard definitions
|
|
388
|
+
StandardDimensions,
|
|
389
|
+
StandardMeasures,
|
|
390
|
+
CalculatedMetrics,
|
|
391
|
+
|
|
392
|
+
// Builders
|
|
393
|
+
query,
|
|
394
|
+
QueryBuilder,
|
|
395
|
+
view,
|
|
396
|
+
ViewBuilder,
|
|
397
|
+
dashboard,
|
|
398
|
+
DashboardBuilder,
|
|
399
|
+
|
|
400
|
+
// Pre-built queries
|
|
401
|
+
MrrOverview,
|
|
402
|
+
ArrBySegment,
|
|
403
|
+
CohortRetention,
|
|
404
|
+
UnitEconomics,
|
|
405
|
+
RevenueByChannel,
|
|
406
|
+
GrowthMetrics,
|
|
407
|
+
|
|
408
|
+
// Pre-built dashboards
|
|
409
|
+
ExecutiveDashboard,
|
|
410
|
+
} from './queries.js'
|
|
411
|
+
|
|
412
|
+
// Export roles (bridges digital-workers and ai-database authorization)
|
|
413
|
+
export type {
|
|
414
|
+
BusinessRoleType,
|
|
415
|
+
BusinessRole,
|
|
416
|
+
TaskStatus,
|
|
417
|
+
TaskPriority,
|
|
418
|
+
TaskAssignment,
|
|
419
|
+
AssigneeRef,
|
|
420
|
+
TaskRoutingRule,
|
|
421
|
+
WorkflowRole,
|
|
422
|
+
} from './roles.js'
|
|
423
|
+
|
|
424
|
+
export {
|
|
425
|
+
StandardBusinessRoles,
|
|
426
|
+
createBusinessRole,
|
|
427
|
+
hasPermission,
|
|
428
|
+
canHandleTask,
|
|
429
|
+
canApproveRequest,
|
|
430
|
+
canDelegateTask,
|
|
431
|
+
findRoleForTask,
|
|
432
|
+
createTaskAssignment,
|
|
433
|
+
transitionTaskStatus,
|
|
434
|
+
} from './roles.js'
|
|
435
|
+
|
|
436
|
+
// Export organization (full hierarchy to FGA/RBAC)
|
|
437
|
+
export type {
|
|
438
|
+
Organization,
|
|
439
|
+
OrganizationSettings,
|
|
440
|
+
Address,
|
|
441
|
+
Department as OrgDepartment,
|
|
442
|
+
Team as OrgTeam,
|
|
443
|
+
TeamResources,
|
|
444
|
+
TeamChannels,
|
|
445
|
+
Position,
|
|
446
|
+
PositionRef,
|
|
447
|
+
Compensation,
|
|
448
|
+
Budget,
|
|
449
|
+
ResourceHierarchy,
|
|
450
|
+
ResourceHierarchyNode,
|
|
451
|
+
ApprovalChain,
|
|
452
|
+
ApprovalLevel,
|
|
453
|
+
ApproverSpec,
|
|
454
|
+
EscalationRule,
|
|
455
|
+
ResolvedPermissions,
|
|
456
|
+
} from './organization.js'
|
|
457
|
+
|
|
458
|
+
export {
|
|
459
|
+
resolvePermissions,
|
|
460
|
+
getApprovalChainForRequest,
|
|
461
|
+
findManager,
|
|
462
|
+
} from './organization.js'
|
|
463
|
+
|
|
464
|
+
// =============================================================================
|
|
465
|
+
// Entity Definitions (Noun pattern with Properties, Actions, Events)
|
|
466
|
+
// =============================================================================
|
|
467
|
+
|
|
468
|
+
export {
|
|
469
|
+
// Business
|
|
470
|
+
Business as BusinessEntity,
|
|
471
|
+
Vision as VisionEntity,
|
|
472
|
+
Value as ValueEntity,
|
|
473
|
+
BusinessEntities,
|
|
474
|
+
BusinessCategories,
|
|
475
|
+
|
|
476
|
+
// Organization
|
|
477
|
+
Organization as OrganizationEntity,
|
|
478
|
+
Department as DepartmentEntity,
|
|
479
|
+
Team as TeamEntity,
|
|
480
|
+
Position as PositionEntity,
|
|
481
|
+
Role as RoleEntity,
|
|
482
|
+
Worker as WorkerEntity,
|
|
483
|
+
OrganizationEntities,
|
|
484
|
+
OrganizationCategories,
|
|
485
|
+
|
|
486
|
+
// Goals
|
|
487
|
+
Goal as GoalEntity,
|
|
488
|
+
OKR as OKREntity,
|
|
489
|
+
KeyResult as KeyResultEntity,
|
|
490
|
+
KPI as KPIEntity,
|
|
491
|
+
Metric as MetricEntity,
|
|
492
|
+
Initiative as InitiativeEntity,
|
|
493
|
+
GoalEntities,
|
|
494
|
+
GoalCategories,
|
|
495
|
+
|
|
496
|
+
// Offerings
|
|
497
|
+
Product as ProductEntity,
|
|
498
|
+
Service as ServiceEntity,
|
|
499
|
+
Feature as FeatureEntity,
|
|
500
|
+
PricingPlan as PricingPlanEntity,
|
|
501
|
+
RoadmapItem as RoadmapItemEntity,
|
|
502
|
+
OfferingEntities,
|
|
503
|
+
OfferingCategories,
|
|
504
|
+
|
|
505
|
+
// Operations
|
|
506
|
+
Process as ProcessEntity,
|
|
507
|
+
ProcessStep as ProcessStepEntity,
|
|
508
|
+
Workflow as WorkflowEntity,
|
|
509
|
+
WorkflowAction as WorkflowActionEntity,
|
|
510
|
+
WorkflowRun as WorkflowRunEntity,
|
|
511
|
+
Policy as PolicyEntity,
|
|
512
|
+
OperationsEntities,
|
|
513
|
+
OperationsCategories,
|
|
514
|
+
|
|
515
|
+
// Financials
|
|
516
|
+
Budget as BudgetEntity,
|
|
517
|
+
Revenue as RevenueEntity,
|
|
518
|
+
Expense as ExpenseEntity,
|
|
519
|
+
Investment as InvestmentEntity,
|
|
520
|
+
FinancialPeriod as FinancialPeriodEntity,
|
|
521
|
+
Forecast as ForecastEntity,
|
|
522
|
+
FinancialEntities,
|
|
523
|
+
FinancialCategories,
|
|
524
|
+
|
|
525
|
+
// All
|
|
526
|
+
AllBusinessEntities,
|
|
527
|
+
BusinessEntityCategories,
|
|
528
|
+
Entities,
|
|
529
|
+
type BusinessEntityCategory,
|
|
530
|
+
} from './entities/index.js'
|