@elevasis/core 0.2.1 → 0.4.0
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/dist/index.d.ts +63 -103
- package/dist/index.js +431 -111
- package/dist/organization-model/index.d.ts +63 -103
- package/dist/organization-model/index.js +431 -111
- package/package.json +1 -1
- package/src/README.md +1 -1
- package/src/__tests__/template-foundations-compatibility.test.ts +28 -36
- package/src/auth/multi-tenancy/types.ts +4 -11
- package/src/auth/multi-tenancy/users/api-schemas.ts +1 -1
- package/src/business/base-entities.test.ts +481 -0
- package/src/business/base-entities.ts +241 -0
- package/src/business/delivery/types.ts +1 -1
- package/src/business/index.ts +3 -0
- package/src/execution/index.ts +3 -6
- package/src/index.ts +1 -1
- package/src/organization-model/README.md +25 -26
- package/src/organization-model/__tests__/graph.test.ts +103 -71
- package/src/organization-model/__tests__/resolve.test.ts +22 -31
- package/src/organization-model/contracts.ts +3 -0
- package/src/organization-model/defaults.ts +59 -7
- package/src/organization-model/domains/features.ts +19 -54
- package/src/organization-model/domains/navigation.ts +266 -17
- package/src/organization-model/domains/shared.ts +1 -10
- package/src/organization-model/foundation.ts +97 -0
- package/src/organization-model/graph/build.ts +34 -67
- package/src/organization-model/graph/schema.ts +2 -4
- package/src/organization-model/graph/types.ts +3 -15
- package/src/organization-model/index.ts +2 -0
- package/src/organization-model/organization-graph.mdx +37 -28
- package/src/organization-model/organization-model.mdx +34 -36
- package/src/organization-model/published.ts +12 -3
- package/src/organization-model/schema.ts +38 -34
- package/src/organization-model/types.ts +5 -10
- package/src/platform/constants/versions.ts +1 -1
- package/src/platform/sse/events.ts +1 -34
- package/src/projects/api-schemas.ts +2 -1
- package/src/reference/_generated/contracts.md +10 -31
- package/src/reference/glossary.md +14 -18
- package/src/supabase/database.types.ts +0 -107
- package/src/test-utils/rls/RLSTestContext.ts +1 -31
- package/src/execution/calibration/__tests__/schemas.test.ts +0 -320
- package/src/execution/calibration/index.ts +0 -3
- package/src/execution/calibration/schemas.ts +0 -121
- package/src/execution/calibration/sse-events.ts +0 -125
- package/src/execution/calibration/types.ts +0 -190
|
@@ -14,18 +14,11 @@ var DisplayMetadataSchema = z.object({
|
|
|
14
14
|
color: ColorTokenSchema.optional(),
|
|
15
15
|
icon: IconNameSchema.optional()
|
|
16
16
|
});
|
|
17
|
-
var SemanticDomainSchema = DisplayMetadataSchema.extend({
|
|
18
|
-
id: ModelIdSchema,
|
|
19
|
-
entityIds: ReferenceIdsSchema,
|
|
20
|
-
surfaceIds: ReferenceIdsSchema,
|
|
21
|
-
resourceIds: ReferenceIdsSchema,
|
|
22
|
-
capabilityIds: ReferenceIdsSchema
|
|
23
|
-
});
|
|
24
17
|
var ResourceMappingSchema = DisplayMetadataSchema.extend({
|
|
25
18
|
id: ModelIdSchema,
|
|
26
19
|
resourceId: z.string().trim().min(1).max(255),
|
|
27
20
|
resourceType: z.enum(["workflow", "agent", "trigger", "integration", "external", "human_checkpoint"]),
|
|
28
|
-
|
|
21
|
+
featureIds: ReferenceIdsSchema,
|
|
29
22
|
entityIds: ReferenceIdsSchema,
|
|
30
23
|
surfaceIds: ReferenceIdsSchema,
|
|
31
24
|
capabilityIds: ReferenceIdsSchema
|
|
@@ -130,55 +123,18 @@ var DEFAULT_ORGANIZATION_MODEL_DELIVERY = {
|
|
|
130
123
|
{ id: "completed", label: "Completed", order: 9 }
|
|
131
124
|
]
|
|
132
125
|
};
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
acquisition: z.boolean().default(true),
|
|
145
|
-
delivery: z.boolean().default(true),
|
|
146
|
-
operations: z.boolean().default(true),
|
|
147
|
-
monitoring: z.boolean().default(true),
|
|
148
|
-
settings: z.boolean().default(true),
|
|
149
|
-
seo: z.boolean().default(false),
|
|
150
|
-
calibration: z.boolean().default(false)
|
|
151
|
-
}).default({
|
|
152
|
-
acquisition: true,
|
|
153
|
-
delivery: true,
|
|
154
|
-
operations: true,
|
|
155
|
-
monitoring: true,
|
|
156
|
-
settings: true,
|
|
157
|
-
seo: false,
|
|
158
|
-
calibration: false
|
|
159
|
-
}),
|
|
160
|
-
labels: z.object({
|
|
161
|
-
acquisition: z.string().trim().min(1).max(80).optional(),
|
|
162
|
-
delivery: z.string().trim().min(1).max(80).optional(),
|
|
163
|
-
operations: z.string().trim().min(1).max(80).optional(),
|
|
164
|
-
monitoring: z.string().trim().min(1).max(80).optional(),
|
|
165
|
-
settings: z.string().trim().min(1).max(80).optional(),
|
|
166
|
-
seo: z.string().trim().min(1).max(80).optional(),
|
|
167
|
-
calibration: z.string().trim().min(1).max(80).optional()
|
|
168
|
-
}).default({})
|
|
126
|
+
var FeatureSchema = z.object({
|
|
127
|
+
id: ModelIdSchema,
|
|
128
|
+
label: LabelSchema,
|
|
129
|
+
description: DescriptionSchema.optional(),
|
|
130
|
+
enabled: z.boolean().default(true),
|
|
131
|
+
color: ColorTokenSchema.optional(),
|
|
132
|
+
icon: IconNameSchema.optional(),
|
|
133
|
+
entityIds: ReferenceIdsSchema,
|
|
134
|
+
surfaceIds: ReferenceIdsSchema,
|
|
135
|
+
resourceIds: ReferenceIdsSchema,
|
|
136
|
+
capabilityIds: ReferenceIdsSchema
|
|
169
137
|
});
|
|
170
|
-
var DEFAULT_ORGANIZATION_MODEL_FEATURES = {
|
|
171
|
-
enabled: {
|
|
172
|
-
acquisition: true,
|
|
173
|
-
delivery: true,
|
|
174
|
-
operations: true,
|
|
175
|
-
monitoring: true,
|
|
176
|
-
settings: true,
|
|
177
|
-
seo: false,
|
|
178
|
-
calibration: false
|
|
179
|
-
},
|
|
180
|
-
labels: {}
|
|
181
|
-
};
|
|
182
138
|
var LeadGenLifecycleStageSchema = DisplayMetadataSchema.extend({
|
|
183
139
|
id: ModelIdSchema,
|
|
184
140
|
order: z.number().int().min(0)
|
|
@@ -207,6 +163,13 @@ var DEFAULT_ORGANIZATION_MODEL_LEAD_GEN = {
|
|
|
207
163
|
{ id: "uploaded", label: "Uploaded", order: 4 }
|
|
208
164
|
]
|
|
209
165
|
};
|
|
166
|
+
|
|
167
|
+
// src/organization-model/contracts.ts
|
|
168
|
+
var PROJECTS_FEATURE_ID = "projects";
|
|
169
|
+
var PROJECTS_INDEX_SURFACE_ID = "projects.index";
|
|
170
|
+
var DELIVERY_PROJECTS_VIEW_CAPABILITY_ID = "delivery.projects.view";
|
|
171
|
+
|
|
172
|
+
// src/organization-model/domains/navigation.ts
|
|
210
173
|
var SurfaceTypeSchema = z.enum(["page", "dashboard", "graph", "detail", "list", "settings"]);
|
|
211
174
|
var SurfaceDefinitionSchema = z.object({
|
|
212
175
|
id: ModelIdSchema,
|
|
@@ -214,9 +177,10 @@ var SurfaceDefinitionSchema = z.object({
|
|
|
214
177
|
path: PathSchema,
|
|
215
178
|
surfaceType: SurfaceTypeSchema,
|
|
216
179
|
description: DescriptionSchema.optional(),
|
|
180
|
+
enabled: z.boolean().default(true),
|
|
217
181
|
icon: IconNameSchema.optional(),
|
|
218
|
-
|
|
219
|
-
|
|
182
|
+
featureId: ModelIdSchema.optional(),
|
|
183
|
+
featureIds: ReferenceIdsSchema,
|
|
220
184
|
entityIds: ReferenceIdsSchema,
|
|
221
185
|
resourceIds: ReferenceIdsSchema,
|
|
222
186
|
capabilityIds: ReferenceIdsSchema,
|
|
@@ -241,8 +205,9 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
241
205
|
label: "Pipeline",
|
|
242
206
|
path: "/crm/pipeline",
|
|
243
207
|
surfaceType: "graph",
|
|
244
|
-
|
|
245
|
-
|
|
208
|
+
enabled: true,
|
|
209
|
+
featureId: "crm",
|
|
210
|
+
featureIds: ["crm"],
|
|
246
211
|
entityIds: ["crm.deal"],
|
|
247
212
|
resourceIds: [],
|
|
248
213
|
capabilityIds: ["crm.pipeline.manage"]
|
|
@@ -252,30 +217,33 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
252
217
|
label: "Lists",
|
|
253
218
|
path: "/lead-gen/lists",
|
|
254
219
|
surfaceType: "list",
|
|
255
|
-
|
|
256
|
-
|
|
220
|
+
enabled: true,
|
|
221
|
+
featureId: "lead-gen",
|
|
222
|
+
featureIds: ["lead-gen"],
|
|
257
223
|
entityIds: ["leadgen.list"],
|
|
258
224
|
resourceIds: [],
|
|
259
225
|
capabilityIds: ["leadgen.lists.manage"]
|
|
260
226
|
},
|
|
261
227
|
{
|
|
262
|
-
id:
|
|
228
|
+
id: PROJECTS_INDEX_SURFACE_ID,
|
|
263
229
|
label: "Projects",
|
|
264
230
|
path: "/projects",
|
|
265
231
|
surfaceType: "list",
|
|
266
|
-
|
|
267
|
-
|
|
232
|
+
enabled: true,
|
|
233
|
+
featureId: PROJECTS_FEATURE_ID,
|
|
234
|
+
featureIds: [PROJECTS_FEATURE_ID],
|
|
268
235
|
entityIds: ["delivery.project"],
|
|
269
236
|
resourceIds: [],
|
|
270
|
-
capabilityIds: [
|
|
237
|
+
capabilityIds: [DELIVERY_PROJECTS_VIEW_CAPABILITY_ID]
|
|
271
238
|
},
|
|
272
239
|
{
|
|
273
240
|
id: "operations.organization-graph",
|
|
274
241
|
label: "Organization Graph",
|
|
275
242
|
path: "/operations/organization-graph",
|
|
276
243
|
surfaceType: "graph",
|
|
277
|
-
|
|
278
|
-
|
|
244
|
+
enabled: true,
|
|
245
|
+
featureId: "operations",
|
|
246
|
+
featureIds: ["operations"],
|
|
279
247
|
entityIds: [],
|
|
280
248
|
resourceIds: [],
|
|
281
249
|
capabilityIds: ["operations.organization-graph"]
|
|
@@ -285,20 +253,264 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
285
253
|
label: "Command View",
|
|
286
254
|
path: "/operations/command-view",
|
|
287
255
|
surfaceType: "graph",
|
|
288
|
-
|
|
289
|
-
|
|
256
|
+
enabled: false,
|
|
257
|
+
featureId: "operations",
|
|
258
|
+
featureIds: ["operations"],
|
|
290
259
|
entityIds: [],
|
|
291
260
|
resourceIds: [],
|
|
292
261
|
capabilityIds: ["operations.command-view"]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
id: "operations.overview",
|
|
265
|
+
label: "Overview",
|
|
266
|
+
path: "/operations",
|
|
267
|
+
surfaceType: "dashboard",
|
|
268
|
+
enabled: true,
|
|
269
|
+
featureId: "operations",
|
|
270
|
+
featureIds: ["operations"],
|
|
271
|
+
entityIds: [],
|
|
272
|
+
resourceIds: [],
|
|
273
|
+
capabilityIds: []
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
id: "operations.resources",
|
|
277
|
+
label: "Resources",
|
|
278
|
+
path: "/operations/resources",
|
|
279
|
+
surfaceType: "list",
|
|
280
|
+
enabled: true,
|
|
281
|
+
featureId: "operations",
|
|
282
|
+
featureIds: ["operations"],
|
|
283
|
+
entityIds: [],
|
|
284
|
+
resourceIds: [],
|
|
285
|
+
capabilityIds: []
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
id: "operations.command-queue",
|
|
289
|
+
label: "Command Queue",
|
|
290
|
+
path: "/operations/command-queue",
|
|
291
|
+
surfaceType: "list",
|
|
292
|
+
enabled: true,
|
|
293
|
+
featureId: "operations",
|
|
294
|
+
featureIds: ["operations"],
|
|
295
|
+
entityIds: [],
|
|
296
|
+
resourceIds: [],
|
|
297
|
+
capabilityIds: []
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
id: "operations.sessions",
|
|
301
|
+
label: "Sessions",
|
|
302
|
+
path: "/operations/sessions",
|
|
303
|
+
surfaceType: "page",
|
|
304
|
+
enabled: false,
|
|
305
|
+
featureId: "operations",
|
|
306
|
+
featureIds: ["operations"],
|
|
307
|
+
entityIds: [],
|
|
308
|
+
resourceIds: [],
|
|
309
|
+
capabilityIds: []
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
id: "operations.task-scheduler",
|
|
313
|
+
label: "Task Scheduler",
|
|
314
|
+
path: "/operations/task-scheduler",
|
|
315
|
+
surfaceType: "page",
|
|
316
|
+
enabled: true,
|
|
317
|
+
featureId: "operations",
|
|
318
|
+
featureIds: ["operations"],
|
|
319
|
+
entityIds: [],
|
|
320
|
+
resourceIds: [],
|
|
321
|
+
capabilityIds: []
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: "monitoring.activity-log",
|
|
325
|
+
label: "Activity Log",
|
|
326
|
+
path: "/monitoring/activity-log",
|
|
327
|
+
surfaceType: "list",
|
|
328
|
+
enabled: true,
|
|
329
|
+
featureId: "monitoring",
|
|
330
|
+
featureIds: ["monitoring"],
|
|
331
|
+
entityIds: [],
|
|
332
|
+
resourceIds: [],
|
|
333
|
+
capabilityIds: []
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
id: "monitoring.execution-logs",
|
|
337
|
+
label: "Execution Logs",
|
|
338
|
+
path: "/monitoring/execution-logs",
|
|
339
|
+
surfaceType: "list",
|
|
340
|
+
enabled: true,
|
|
341
|
+
featureId: "monitoring",
|
|
342
|
+
featureIds: ["monitoring"],
|
|
343
|
+
entityIds: [],
|
|
344
|
+
resourceIds: [],
|
|
345
|
+
capabilityIds: []
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
id: "monitoring.execution-health",
|
|
349
|
+
label: "Execution Health",
|
|
350
|
+
path: "/monitoring/execution-health",
|
|
351
|
+
surfaceType: "dashboard",
|
|
352
|
+
enabled: true,
|
|
353
|
+
featureId: "monitoring",
|
|
354
|
+
featureIds: ["monitoring"],
|
|
355
|
+
entityIds: [],
|
|
356
|
+
resourceIds: [],
|
|
357
|
+
capabilityIds: []
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
id: "monitoring.cost-analytics",
|
|
361
|
+
label: "Cost Analytics",
|
|
362
|
+
path: "/monitoring/cost-analytics",
|
|
363
|
+
surfaceType: "dashboard",
|
|
364
|
+
enabled: false,
|
|
365
|
+
featureId: "monitoring",
|
|
366
|
+
featureIds: ["monitoring"],
|
|
367
|
+
entityIds: [],
|
|
368
|
+
resourceIds: [],
|
|
369
|
+
capabilityIds: []
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
id: "monitoring.notifications",
|
|
373
|
+
label: "Notifications",
|
|
374
|
+
path: "/monitoring/notifications",
|
|
375
|
+
surfaceType: "page",
|
|
376
|
+
enabled: true,
|
|
377
|
+
featureId: "monitoring",
|
|
378
|
+
featureIds: ["monitoring"],
|
|
379
|
+
entityIds: [],
|
|
380
|
+
resourceIds: [],
|
|
381
|
+
capabilityIds: []
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
id: "settings.account",
|
|
385
|
+
label: "Account",
|
|
386
|
+
path: "/settings/account",
|
|
387
|
+
surfaceType: "settings",
|
|
388
|
+
enabled: true,
|
|
389
|
+
featureId: "settings",
|
|
390
|
+
featureIds: ["settings"],
|
|
391
|
+
entityIds: [],
|
|
392
|
+
resourceIds: [],
|
|
393
|
+
capabilityIds: []
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
id: "settings.appearance",
|
|
397
|
+
label: "Appearance",
|
|
398
|
+
path: "/settings/appearance",
|
|
399
|
+
surfaceType: "settings",
|
|
400
|
+
enabled: true,
|
|
401
|
+
featureId: "settings",
|
|
402
|
+
featureIds: ["settings"],
|
|
403
|
+
entityIds: [],
|
|
404
|
+
resourceIds: [],
|
|
405
|
+
capabilityIds: []
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
id: "settings.organization",
|
|
409
|
+
label: "Organization",
|
|
410
|
+
path: "/settings/organization",
|
|
411
|
+
surfaceType: "settings",
|
|
412
|
+
enabled: true,
|
|
413
|
+
featureId: "settings",
|
|
414
|
+
featureIds: ["settings"],
|
|
415
|
+
entityIds: [],
|
|
416
|
+
resourceIds: [],
|
|
417
|
+
capabilityIds: []
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
id: "settings.credentials",
|
|
421
|
+
label: "Credentials",
|
|
422
|
+
path: "/settings/credentials",
|
|
423
|
+
surfaceType: "settings",
|
|
424
|
+
enabled: true,
|
|
425
|
+
featureId: "settings",
|
|
426
|
+
featureIds: ["settings"],
|
|
427
|
+
entityIds: [],
|
|
428
|
+
resourceIds: [],
|
|
429
|
+
capabilityIds: []
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
id: "settings.api-keys",
|
|
433
|
+
label: "API Keys",
|
|
434
|
+
path: "/settings/api-keys",
|
|
435
|
+
surfaceType: "settings",
|
|
436
|
+
enabled: true,
|
|
437
|
+
featureId: "settings",
|
|
438
|
+
featureIds: ["settings"],
|
|
439
|
+
entityIds: [],
|
|
440
|
+
resourceIds: [],
|
|
441
|
+
capabilityIds: []
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
id: "settings.webhooks",
|
|
445
|
+
label: "Webhooks",
|
|
446
|
+
path: "/settings/webhooks",
|
|
447
|
+
surfaceType: "settings",
|
|
448
|
+
enabled: true,
|
|
449
|
+
featureId: "settings",
|
|
450
|
+
featureIds: ["settings"],
|
|
451
|
+
entityIds: [],
|
|
452
|
+
resourceIds: [],
|
|
453
|
+
capabilityIds: []
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
id: "settings.deployments",
|
|
457
|
+
label: "Deployments",
|
|
458
|
+
path: "/settings/deployments",
|
|
459
|
+
surfaceType: "settings",
|
|
460
|
+
enabled: true,
|
|
461
|
+
featureId: "settings",
|
|
462
|
+
featureIds: ["settings"],
|
|
463
|
+
entityIds: [],
|
|
464
|
+
resourceIds: [],
|
|
465
|
+
capabilityIds: []
|
|
293
466
|
}
|
|
294
467
|
],
|
|
295
468
|
groups: [
|
|
296
|
-
{
|
|
469
|
+
{
|
|
470
|
+
id: "primary-workspace",
|
|
471
|
+
label: "Workspace",
|
|
472
|
+
placement: "primary",
|
|
473
|
+
surfaceIds: ["crm.pipeline", "lead-gen.lists", PROJECTS_INDEX_SURFACE_ID]
|
|
474
|
+
},
|
|
297
475
|
{
|
|
298
476
|
id: "primary-operations",
|
|
299
477
|
label: "Operations",
|
|
300
478
|
placement: "primary",
|
|
301
|
-
surfaceIds: [
|
|
479
|
+
surfaceIds: [
|
|
480
|
+
"operations.organization-graph",
|
|
481
|
+
"operations.command-view",
|
|
482
|
+
"operations.overview",
|
|
483
|
+
"operations.resources",
|
|
484
|
+
"operations.command-queue",
|
|
485
|
+
"operations.sessions",
|
|
486
|
+
"operations.task-scheduler"
|
|
487
|
+
]
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
id: "primary-monitoring",
|
|
491
|
+
label: "Monitoring",
|
|
492
|
+
placement: "primary",
|
|
493
|
+
surfaceIds: [
|
|
494
|
+
"monitoring.activity-log",
|
|
495
|
+
"monitoring.execution-logs",
|
|
496
|
+
"monitoring.execution-health",
|
|
497
|
+
"monitoring.cost-analytics",
|
|
498
|
+
"monitoring.notifications"
|
|
499
|
+
]
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
id: "primary-settings",
|
|
503
|
+
label: "Settings",
|
|
504
|
+
placement: "bottom",
|
|
505
|
+
surfaceIds: [
|
|
506
|
+
"settings.account",
|
|
507
|
+
"settings.appearance",
|
|
508
|
+
"settings.organization",
|
|
509
|
+
"settings.credentials",
|
|
510
|
+
"settings.api-keys",
|
|
511
|
+
"settings.webhooks",
|
|
512
|
+
"settings.deployments"
|
|
513
|
+
]
|
|
302
514
|
}
|
|
303
515
|
]
|
|
304
516
|
};
|
|
@@ -306,9 +518,8 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
306
518
|
// src/organization-model/schema.ts
|
|
307
519
|
var OrganizationModelSchemaBase = z.object({
|
|
308
520
|
version: z.literal(1).default(1),
|
|
309
|
-
|
|
521
|
+
features: z.array(FeatureSchema).default([]),
|
|
310
522
|
branding: OrganizationModelBrandingSchema,
|
|
311
|
-
features: OrganizationModelFeaturesSchema,
|
|
312
523
|
navigation: OrganizationModelNavigationSchema,
|
|
313
524
|
crm: OrganizationModelCrmSchema,
|
|
314
525
|
leadGen: OrganizationModelLeadGenSchema,
|
|
@@ -334,7 +545,7 @@ function collectIds(items, ctx, collectionPath, label) {
|
|
|
334
545
|
return itemsById;
|
|
335
546
|
}
|
|
336
547
|
var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ctx) => {
|
|
337
|
-
const
|
|
548
|
+
const featuresById = collectIds(model.features, ctx, ["features"], "Feature");
|
|
338
549
|
const surfacesById = collectIds(model.navigation.surfaces, ctx, ["navigation", "surfaces"], "Surface");
|
|
339
550
|
collectIds(model.navigation.groups, ctx, ["navigation", "groups"], "Navigation group");
|
|
340
551
|
collectIds(model.resourceMappings, ctx, ["resourceMappings"], "Resource mapping");
|
|
@@ -368,40 +579,40 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
368
579
|
}
|
|
369
580
|
});
|
|
370
581
|
});
|
|
371
|
-
model.
|
|
372
|
-
|
|
582
|
+
model.features.forEach((feature, featureIndex) => {
|
|
583
|
+
feature.surfaceIds.forEach((surfaceId, surfaceIndex) => {
|
|
373
584
|
const surface = surfacesById.get(surfaceId);
|
|
374
585
|
if (!surface) {
|
|
375
586
|
addIssue(
|
|
376
587
|
ctx,
|
|
377
|
-
["
|
|
378
|
-
`
|
|
588
|
+
["features", featureIndex, "surfaceIds", surfaceIndex],
|
|
589
|
+
`Feature "${feature.id}" references unknown surface "${surfaceId}"`
|
|
379
590
|
);
|
|
380
591
|
return;
|
|
381
592
|
}
|
|
382
|
-
if (!surface.
|
|
593
|
+
if (!surface.featureIds.includes(feature.id)) {
|
|
383
594
|
addIssue(
|
|
384
595
|
ctx,
|
|
385
|
-
["
|
|
386
|
-
`
|
|
596
|
+
["features", featureIndex, "surfaceIds", surfaceIndex],
|
|
597
|
+
`Feature "${feature.id}" references surface "${surfaceId}" but that surface does not include feature "${feature.id}"`
|
|
387
598
|
);
|
|
388
599
|
}
|
|
389
600
|
});
|
|
390
|
-
|
|
601
|
+
feature.resourceIds.forEach((resourceId, resourceIndex) => {
|
|
391
602
|
const resourceMapping = resourceMappingsByResourceId.get(resourceId);
|
|
392
603
|
if (!resourceMapping) {
|
|
393
604
|
addIssue(
|
|
394
605
|
ctx,
|
|
395
|
-
["
|
|
396
|
-
`
|
|
606
|
+
["features", featureIndex, "resourceIds", resourceIndex],
|
|
607
|
+
`Feature "${feature.id}" references unknown resource "${resourceId}"`
|
|
397
608
|
);
|
|
398
609
|
return;
|
|
399
610
|
}
|
|
400
|
-
if (!resourceMapping.
|
|
611
|
+
if (!resourceMapping.featureIds.includes(feature.id)) {
|
|
401
612
|
addIssue(
|
|
402
613
|
ctx,
|
|
403
|
-
["
|
|
404
|
-
`
|
|
614
|
+
["features", featureIndex, "resourceIds", resourceIndex],
|
|
615
|
+
`Feature "${feature.id}" references resource "${resourceId}" but that resource mapping does not include feature "${feature.id}"`
|
|
405
616
|
);
|
|
406
617
|
}
|
|
407
618
|
});
|
|
@@ -414,21 +625,21 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
414
625
|
`Surface "${surface.id}" references unknown parent surface "${surface.parentId}"`
|
|
415
626
|
);
|
|
416
627
|
}
|
|
417
|
-
surface.
|
|
418
|
-
const
|
|
419
|
-
if (!
|
|
628
|
+
surface.featureIds.forEach((featureId, featureIndex) => {
|
|
629
|
+
const feature = featuresById.get(featureId);
|
|
630
|
+
if (!feature) {
|
|
420
631
|
addIssue(
|
|
421
632
|
ctx,
|
|
422
|
-
["navigation", "surfaces", surfaceIndex, "
|
|
423
|
-
`Surface "${surface.id}" references unknown
|
|
633
|
+
["navigation", "surfaces", surfaceIndex, "featureIds", featureIndex],
|
|
634
|
+
`Surface "${surface.id}" references unknown feature "${featureId}"`
|
|
424
635
|
);
|
|
425
636
|
return;
|
|
426
637
|
}
|
|
427
|
-
if (!
|
|
638
|
+
if (!feature.surfaceIds.includes(surface.id)) {
|
|
428
639
|
addIssue(
|
|
429
640
|
ctx,
|
|
430
|
-
["navigation", "surfaces", surfaceIndex, "
|
|
431
|
-
`Surface "${surface.id}" references
|
|
641
|
+
["navigation", "surfaces", surfaceIndex, "featureIds", featureIndex],
|
|
642
|
+
`Surface "${surface.id}" references feature "${featureId}" but that feature does not include surface "${surface.id}"`
|
|
432
643
|
);
|
|
433
644
|
}
|
|
434
645
|
});
|
|
@@ -452,21 +663,21 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
452
663
|
});
|
|
453
664
|
});
|
|
454
665
|
model.resourceMappings.forEach((resourceMapping, resourceIndex) => {
|
|
455
|
-
resourceMapping.
|
|
456
|
-
const
|
|
457
|
-
if (!
|
|
666
|
+
resourceMapping.featureIds.forEach((featureId, featureIndex) => {
|
|
667
|
+
const feature = featuresById.get(featureId);
|
|
668
|
+
if (!feature) {
|
|
458
669
|
addIssue(
|
|
459
670
|
ctx,
|
|
460
|
-
["resourceMappings", resourceIndex, "
|
|
461
|
-
`Resource mapping "${resourceMapping.id}" references unknown
|
|
671
|
+
["resourceMappings", resourceIndex, "featureIds", featureIndex],
|
|
672
|
+
`Resource mapping "${resourceMapping.id}" references unknown feature "${featureId}"`
|
|
462
673
|
);
|
|
463
674
|
return;
|
|
464
675
|
}
|
|
465
|
-
if (!
|
|
676
|
+
if (!feature.resourceIds.includes(resourceMapping.resourceId)) {
|
|
466
677
|
addIssue(
|
|
467
678
|
ctx,
|
|
468
|
-
["resourceMappings", resourceIndex, "
|
|
469
|
-
`Resource mapping "${resourceMapping.id}" references
|
|
679
|
+
["resourceMappings", resourceIndex, "featureIds", featureIndex],
|
|
680
|
+
`Resource mapping "${resourceMapping.id}" references feature "${featureId}" but that feature does not include resource "${resourceMapping.resourceId}"`
|
|
470
681
|
);
|
|
471
682
|
}
|
|
472
683
|
});
|
|
@@ -494,11 +705,12 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
494
705
|
// src/organization-model/defaults.ts
|
|
495
706
|
var DEFAULT_ORGANIZATION_MODEL = {
|
|
496
707
|
version: 1,
|
|
497
|
-
|
|
708
|
+
features: [
|
|
498
709
|
{
|
|
499
710
|
id: "crm",
|
|
500
711
|
label: "CRM",
|
|
501
712
|
description: "Relationship pipeline and deal management",
|
|
713
|
+
enabled: true,
|
|
502
714
|
color: "blue",
|
|
503
715
|
entityIds: ["crm.deal"],
|
|
504
716
|
surfaceIds: ["crm.pipeline"],
|
|
@@ -509,6 +721,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
509
721
|
id: "lead-gen",
|
|
510
722
|
label: "Lead Gen",
|
|
511
723
|
description: "Prospecting, qualification, and outreach preparation",
|
|
724
|
+
enabled: true,
|
|
512
725
|
color: "cyan",
|
|
513
726
|
entityIds: ["leadgen.list", "leadgen.company", "leadgen.contact"],
|
|
514
727
|
surfaceIds: ["lead-gen.lists"],
|
|
@@ -516,28 +729,78 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
516
729
|
capabilityIds: ["leadgen.lists.manage"]
|
|
517
730
|
},
|
|
518
731
|
{
|
|
519
|
-
id:
|
|
732
|
+
id: PROJECTS_FEATURE_ID,
|
|
520
733
|
label: "Projects",
|
|
521
734
|
description: "Projects, milestones, and client work execution",
|
|
735
|
+
enabled: true,
|
|
522
736
|
color: "orange",
|
|
523
737
|
entityIds: ["delivery.project", "delivery.milestone", "delivery.task"],
|
|
524
|
-
surfaceIds: [
|
|
738
|
+
surfaceIds: [PROJECTS_INDEX_SURFACE_ID],
|
|
525
739
|
resourceIds: [],
|
|
526
|
-
capabilityIds: [
|
|
740
|
+
capabilityIds: [DELIVERY_PROJECTS_VIEW_CAPABILITY_ID]
|
|
527
741
|
},
|
|
528
742
|
{
|
|
529
743
|
id: "operations",
|
|
530
744
|
label: "Operations",
|
|
531
745
|
description: "Operational resources, topology, and orchestration visibility",
|
|
746
|
+
enabled: true,
|
|
532
747
|
color: "violet",
|
|
533
748
|
entityIds: [],
|
|
534
|
-
surfaceIds: [
|
|
749
|
+
surfaceIds: [
|
|
750
|
+
"operations.organization-graph",
|
|
751
|
+
"operations.command-view",
|
|
752
|
+
"operations.overview",
|
|
753
|
+
"operations.resources",
|
|
754
|
+
"operations.command-queue",
|
|
755
|
+
"operations.sessions",
|
|
756
|
+
"operations.task-scheduler"
|
|
757
|
+
],
|
|
535
758
|
resourceIds: [],
|
|
536
759
|
capabilityIds: ["operations.organization-graph", "operations.command-view"]
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
id: "monitoring",
|
|
763
|
+
label: "Monitoring",
|
|
764
|
+
enabled: true,
|
|
765
|
+
entityIds: [],
|
|
766
|
+
surfaceIds: [
|
|
767
|
+
"monitoring.activity-log",
|
|
768
|
+
"monitoring.execution-logs",
|
|
769
|
+
"monitoring.execution-health",
|
|
770
|
+
"monitoring.cost-analytics",
|
|
771
|
+
"monitoring.notifications"
|
|
772
|
+
],
|
|
773
|
+
resourceIds: [],
|
|
774
|
+
capabilityIds: []
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
id: "settings",
|
|
778
|
+
label: "Settings",
|
|
779
|
+
enabled: true,
|
|
780
|
+
entityIds: [],
|
|
781
|
+
surfaceIds: [
|
|
782
|
+
"settings.account",
|
|
783
|
+
"settings.appearance",
|
|
784
|
+
"settings.organization",
|
|
785
|
+
"settings.credentials",
|
|
786
|
+
"settings.api-keys",
|
|
787
|
+
"settings.webhooks",
|
|
788
|
+
"settings.deployments"
|
|
789
|
+
],
|
|
790
|
+
resourceIds: [],
|
|
791
|
+
capabilityIds: []
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
id: "seo",
|
|
795
|
+
label: "SEO",
|
|
796
|
+
enabled: false,
|
|
797
|
+
entityIds: [],
|
|
798
|
+
surfaceIds: [],
|
|
799
|
+
resourceIds: [],
|
|
800
|
+
capabilityIds: []
|
|
537
801
|
}
|
|
538
802
|
],
|
|
539
803
|
branding: DEFAULT_ORGANIZATION_MODEL_BRANDING,
|
|
540
|
-
features: DEFAULT_ORGANIZATION_MODEL_FEATURES,
|
|
541
804
|
navigation: DEFAULT_ORGANIZATION_MODEL_NAVIGATION,
|
|
542
805
|
crm: DEFAULT_ORGANIZATION_MODEL_CRM,
|
|
543
806
|
leadGen: DEFAULT_ORGANIZATION_MODEL_LEAD_GEN,
|
|
@@ -592,4 +855,61 @@ function resolveOrganizationModel(override) {
|
|
|
592
855
|
return OrganizationModelSchema.parse(merged);
|
|
593
856
|
}
|
|
594
857
|
|
|
595
|
-
|
|
858
|
+
// src/organization-model/foundation.ts
|
|
859
|
+
function createFoundationOrganizationModel(branding) {
|
|
860
|
+
const canonical = resolveOrganizationModel({ branding });
|
|
861
|
+
function requireCoreSurface(surfaceId) {
|
|
862
|
+
const surface = canonical.navigation.surfaces.find((candidate) => candidate.id === surfaceId);
|
|
863
|
+
if (!surface) {
|
|
864
|
+
throw new Error(`Missing organization surface: ${surfaceId}`);
|
|
865
|
+
}
|
|
866
|
+
return surface;
|
|
867
|
+
}
|
|
868
|
+
const operationsGraphSurface = requireCoreSurface("operations.organization-graph");
|
|
869
|
+
const projectsSurface = requireCoreSurface(PROJECTS_INDEX_SURFACE_ID);
|
|
870
|
+
const leadGenSurface = requireCoreSurface("lead-gen.lists");
|
|
871
|
+
const crmSurface = requireCoreSurface("crm.pipeline");
|
|
872
|
+
const navigationSurfaces = [
|
|
873
|
+
{ ...operationsGraphSurface, id: "operations", path: "/operations", icon: "operations" },
|
|
874
|
+
{ ...operationsGraphSurface, path: "/operations", icon: "operations" },
|
|
875
|
+
{ ...projectsSurface, id: PROJECTS_FEATURE_ID, icon: "projects" },
|
|
876
|
+
{ ...leadGenSurface, id: "lead-gen", icon: "lead-gen" },
|
|
877
|
+
{ ...crmSurface, id: "crm", icon: "crm" },
|
|
878
|
+
{
|
|
879
|
+
id: "settings",
|
|
880
|
+
label: "Settings",
|
|
881
|
+
path: "/settings/account",
|
|
882
|
+
surfaceType: "settings",
|
|
883
|
+
enabled: true,
|
|
884
|
+
icon: "settings",
|
|
885
|
+
featureId: "settings",
|
|
886
|
+
featureIds: ["settings"],
|
|
887
|
+
entityIds: [],
|
|
888
|
+
resourceIds: [],
|
|
889
|
+
capabilityIds: []
|
|
890
|
+
}
|
|
891
|
+
];
|
|
892
|
+
const homeLabel = "Dashboard";
|
|
893
|
+
const quickAccessSurfaceIds = ["operations", PROJECTS_FEATURE_ID, "lead-gen", "crm"];
|
|
894
|
+
const model = {
|
|
895
|
+
...canonical,
|
|
896
|
+
navigation: {
|
|
897
|
+
defaultSurfaceId: "operations",
|
|
898
|
+
homeLabel,
|
|
899
|
+
quickAccessSurfaceIds: [...quickAccessSurfaceIds],
|
|
900
|
+
surfaces: navigationSurfaces
|
|
901
|
+
}
|
|
902
|
+
};
|
|
903
|
+
function getOrganizationSurface(surfaceId) {
|
|
904
|
+
return model.navigation.surfaces.find((candidate) => candidate.id === surfaceId);
|
|
905
|
+
}
|
|
906
|
+
return {
|
|
907
|
+
canonical,
|
|
908
|
+
model,
|
|
909
|
+
homeLabel,
|
|
910
|
+
quickAccessSurfaceIds,
|
|
911
|
+
getOrganizationSurface
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
export { DEFAULT_ORGANIZATION_MODEL, DELIVERY_PROJECTS_VIEW_CAPABILITY_ID, FeatureSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
|