@elevasis/sdk 1.8.2 → 1.8.3
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/cli.cjs +1 -1
- package/dist/index.d.ts +88 -39
- package/dist/types/worker/adapters/lead.d.ts +1 -1
- package/dist/worker/index.js +2 -0
- package/package.json +2 -2
- package/reference/_navigation.md +7 -1
- package/reference/_reference-manifest.json +14 -0
- package/reference/claude-config/logs/scaffold-registry-reminder.log +3 -0
- package/reference/claude-config/rules/agent-start-here.md +254 -254
- package/reference/claude-config/rules/frontend.md +43 -43
- package/reference/claude-config/rules/operations.md +64 -64
- package/reference/claude-config/rules/organization-model.md +42 -43
- package/reference/claude-config/rules/organization-os.md +107 -107
- package/reference/claude-config/rules/shared-types.md +2 -2
- package/reference/claude-config/rules/task-tracking.md +1 -1
- package/reference/claude-config/rules/ui.md +202 -202
- package/reference/claude-config/rules/vibe.md +202 -202
- package/reference/claude-config/skills/configure/SKILL.md +98 -98
- package/reference/claude-config/skills/configure/operations/codify-level-a.md +100 -100
- package/reference/claude-config/skills/configure/operations/codify-level-b.md +158 -158
- package/reference/claude-config/skills/configure/operations/customers.md +150 -150
- package/reference/claude-config/skills/configure/operations/features.md +162 -162
- package/reference/claude-config/skills/configure/operations/goals.md +147 -147
- package/reference/claude-config/skills/configure/operations/identity.md +133 -133
- package/reference/claude-config/skills/configure/operations/labels.md +128 -128
- package/reference/claude-config/skills/configure/operations/offerings.md +159 -159
- package/reference/claude-config/skills/configure/operations/roles.md +153 -153
- package/reference/claude-config/skills/configure/operations/techStack.md +139 -139
- package/reference/claude-config/skills/explore/SKILL.md +78 -78
- package/reference/claude-config/skills/git-sync/SKILL.md +126 -0
- package/reference/claude-config/skills/save/SKILL.md +183 -183
- package/reference/claude-config/skills/setup/SKILL.md +275 -275
- package/reference/claude-config/skills/sync/SKILL.md +10 -44
- package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -0
- package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -0
- package/reference/claude-config/sync-notes/README.md +43 -0
- package/reference/packages/core/src/README.md +39 -36
- package/reference/packages/core/src/business/README.md +52 -52
- package/reference/packages/core/src/organization-model/README.md +97 -97
- package/reference/packages/core/src/test-utils/README.md +42 -0
- package/reference/scaffold/core/organization-graph.mdx +272 -272
- package/reference/scaffold/core/organization-model.mdx +320 -320
- package/reference/scaffold/index.mdx +64 -64
- package/reference/scaffold/operations/propagation-pipeline.md +125 -104
- package/reference/scaffold/operations/scaffold-maintenance.md +122 -122
- package/reference/scaffold/operations/workflow-recipes.md +436 -436
- package/reference/scaffold/recipes/add-a-feature.md +158 -158
- package/reference/scaffold/recipes/add-a-resource.md +158 -158
- package/reference/scaffold/recipes/customize-organization-model.md +400 -400
- package/reference/scaffold/recipes/extend-a-base-entity.md +140 -140
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +158 -158
- package/reference/scaffold/recipes/index.md +32 -32
- package/reference/scaffold/reference/contracts.md +608 -607
- package/reference/scaffold/reference/feature-registry.md +2 -0
- package/reference/scaffold/reference/glossary.md +105 -105
- package/reference/scaffold/ui/composition-extensibility.mdx +1 -1
- package/reference/scaffold/ui/feature-flags-and-gating.md +1 -1
|
@@ -1,400 +1,400 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Customize organization-model.ts
|
|
3
|
-
description: Annotated walkthrough for customizing the organization model in template-derived projects, covering the unified feature API, surfaces, domain config, and the resolve pipeline.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Customize organization-model.ts
|
|
7
|
-
|
|
8
|
-
`foundations/config/organization-model.ts` is the semantic contract between your UI runtime
|
|
9
|
-
and your platform operations. Every feature your users can access, every nav surface they can
|
|
10
|
-
navigate to, and every resource backed by a workflow is declared here. The provider reads this
|
|
11
|
-
contract at startup; everything downstream -- routing, gating, nav rendering -- derives from it.
|
|
12
|
-
|
|
13
|
-
This recipe walks through the file section by section. For adding a net-new feature from scratch
|
|
14
|
-
(manifest, routes, gating) see [add-a-feature.md](add-a-feature.md).
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Anatomy
|
|
19
|
-
|
|
20
|
-
### Import and setup
|
|
21
|
-
|
|
22
|
-
```ts
|
|
23
|
-
import {
|
|
24
|
-
defineOrganizationModel,
|
|
25
|
-
resolveOrganizationModel,
|
|
26
|
-
type OrganizationModel,
|
|
27
|
-
type OrganizationModelSurface
|
|
28
|
-
} from '@elevasis/core/organization-model'
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Two functions and two types are all you need:
|
|
32
|
-
|
|
33
|
-
- `defineOrganizationModel` -- identity helper that gives TypeScript a typed override shape.
|
|
34
|
-
Pass your override object through it; you get type-checking against `DeepPartial<OrganizationModel>`
|
|
35
|
-
without having to fill every field.
|
|
36
|
-
- `resolveOrganizationModel` -- merges your override with the platform defaults and validates the
|
|
37
|
-
result through `OrganizationModelSchema`. Call once at module init; export the result.
|
|
38
|
-
- `OrganizationModel` -- the fully-resolved model type (after defaults are merged in).
|
|
39
|
-
- `OrganizationModelSurface` -- the surface definition type; useful when building the foundation
|
|
40
|
-
navigation surface layer (see the export pattern below).
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
### Features array
|
|
45
|
-
|
|
46
|
-
The `features` array is the sole source of truth for which capabilities the organization has
|
|
47
|
-
and whether they are on or off. Each entry is an `OrganizationModelFeature` (inferred from
|
|
48
|
-
`FeatureSchema`).
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
const foundationOrganizationModelOverride = defineOrganizationModel({
|
|
52
|
-
features: [
|
|
53
|
-
{
|
|
54
|
-
id: 'crm', // stable kebab-case ID; FeatureModule.featureId must match
|
|
55
|
-
label: 'CRM', // display name for nav label resolution
|
|
56
|
-
description: 'Relationship pipeline and deal management', // optional; shown in settings UI
|
|
57
|
-
enabled: true, // org-wide default; false hides from nav and blocks routes
|
|
58
|
-
color: 'blue', // Mantine color token; optional
|
|
59
|
-
entityIds: ['crm.deal'], // logical entity types this feature owns
|
|
60
|
-
surfaceIds: ['crm.pipeline'], // navigation surfaces that belong to this feature
|
|
61
|
-
resourceIds: [], // workflow/agent resource IDs mapped through resourceMappings
|
|
62
|
-
capabilityIds: ['crm.pipeline.manage'] // fine-grained capability strings for gating
|
|
63
|
-
},
|
|
64
|
-
// ... other features
|
|
65
|
-
]
|
|
66
|
-
})
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Field reference:
|
|
70
|
-
|
|
71
|
-
- `id` -- lowercase, kebab-case, dot-separated segments allowed (`crm`, `lead-gen`, `operations`).
|
|
72
|
-
This value must exactly match the `featureId` on any `FeatureModule` manifest that gates against
|
|
73
|
-
this feature. The provider throws at startup if a manifest references an unknown feature ID.
|
|
74
|
-
- `label` -- shown in nav when no manifest override is provided. Keep short.
|
|
75
|
-
- `description` -- optional. Appears in membership/settings surfaces.
|
|
76
|
-
- `enabled` -- `false` suppresses the nav entry and triggers `FeatureGuard` redirects. Default is
|
|
77
|
-
`true` per the schema. To ship a feature but keep it off by default, set this to `false` here
|
|
78
|
-
and enable it per-org through membership config.
|
|
79
|
-
- `color` -- any Mantine color token string (`blue`, `cyan`, `violet`, `orange`). Optional.
|
|
80
|
-
- `icon` -- icon name string. Optional. The foundation layer re-maps this via `FoundationSurfaceIcon`.
|
|
81
|
-
- `entityIds` -- dot-namespaced entity type IDs (`crm.deal`, `leadgen.list`). Purely semantic; used
|
|
82
|
-
by the organization graph to classify nodes.
|
|
83
|
-
- `surfaceIds` -- must reference IDs declared in `navigation.surfaces`. Bidirectional: the schema
|
|
84
|
-
validates that every surface listed here also lists this feature in its own `featureIds`.
|
|
85
|
-
- `resourceIds` -- must reference `resourceId` values in `resourceMappings`. Bidirectional: the
|
|
86
|
-
schema validates the reverse link exists. Leave empty until you have actual resource mappings.
|
|
87
|
-
- `capabilityIds` -- dot-namespaced strings (`crm.pipeline.manage`). Used by `FeatureGuard` and
|
|
88
|
-
surface-level access checks. No central registry; name them descriptively.
|
|
89
|
-
|
|
90
|
-
The 7 platform defaults are: `crm`, `lead-gen`, `projects`, `operations`, `monitoring`, `settings`,
|
|
91
|
-
`seo`. The template's `features` array replaces the defaults wholesale (arrays are not merged field
|
|
92
|
-
by field -- see Resolve Behavior below).
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
### Navigation surfaces
|
|
97
|
-
|
|
98
|
-
Surfaces are the navigable pages of your application. Declare them under `navigation.surfaces`.
|
|
99
|
-
|
|
100
|
-
```ts
|
|
101
|
-
navigation: {
|
|
102
|
-
defaultSurfaceId: 'operations.organization-graph', // surface shown on first load
|
|
103
|
-
surfaces: [
|
|
104
|
-
{
|
|
105
|
-
id: 'crm.pipeline', // stable ID; referenced by feature.surfaceIds and group.surfaceIds
|
|
106
|
-
label: 'CRM', // nav label
|
|
107
|
-
path: '/crm', // TanStack Router path prefix
|
|
108
|
-
surfaceType: 'graph', // 'page' | 'dashboard' | 'graph' | 'detail' | 'list' | 'settings'
|
|
109
|
-
featureId: 'crm', // primary owning feature (optional but conventional)
|
|
110
|
-
featureIds: ['crm'], // all features this surface belongs to (bidirectional with feature.surfaceIds)
|
|
111
|
-
entityIds: ['crm.deal'], // entity types rendered on this surface
|
|
112
|
-
resourceIds: [], // resource IDs rendered on this surface (from resourceMappings)
|
|
113
|
-
capabilityIds: ['crm.pipeline.manage'] // capabilities required to access this surface
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Surface field notes:
|
|
120
|
-
|
|
121
|
-
- `surfaceType` -- drives how the organization graph classifies and renders the surface node.
|
|
122
|
-
Use `graph` for pipeline/topology views, `list` for index pages, `settings` for settings pages.
|
|
123
|
-
- `featureId` vs `featureIds` -- `featureId` is the single primary owner (optional). `featureIds`
|
|
124
|
-
is the bidirectional array that the schema validates against. In practice, set both to the same
|
|
125
|
-
single value for most surfaces.
|
|
126
|
-
- `parentId` -- optional. Lets you declare a surface as a child of another (for nested nav or
|
|
127
|
-
detail surfaces). Must reference a declared surface ID.
|
|
128
|
-
- Bidirectional constraint: if `crm.pipeline` is in `feature.surfaceIds`, then `crm.pipeline`'s
|
|
129
|
-
`featureIds` must include `crm`. The schema parse throws if either side is missing.
|
|
130
|
-
|
|
131
|
-
The template adds a `FoundationNavigationSurface` extension type that augments the core surface
|
|
132
|
-
with a typed `icon` field (`FoundationSurfaceIcon`). This is used by the foundation nav layer to
|
|
133
|
-
render icon components in the sidebar.
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
### Resources and resourceMappings
|
|
138
|
-
|
|
139
|
-
Resource mappings connect platform workflows and agents to features and surfaces. They are optional
|
|
140
|
-
until you have deployed resources to map.
|
|
141
|
-
|
|
142
|
-
```ts
|
|
143
|
-
resourceMappings: [
|
|
144
|
-
{
|
|
145
|
-
id: 'my-mapping', // unique within resourceMappings
|
|
146
|
-
resourceId: 'my-lead-scraper-workflow', // the deployed resource ID from operations/
|
|
147
|
-
resourceType: 'workflow', // 'workflow' | 'agent' | 'trigger' | 'integration' | 'external' | 'human_checkpoint'
|
|
148
|
-
label: 'Lead Scraper',
|
|
149
|
-
featureIds: ['lead-gen'], // bidirectional: feature.resourceIds must include resourceId
|
|
150
|
-
entityIds: ['leadgen.company'],
|
|
151
|
-
surfaceIds: ['lead-gen.lists'], // bidirectional: surface.resourceIds must include resourceId
|
|
152
|
-
capabilityIds: []
|
|
153
|
-
}
|
|
154
|
-
]
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
The schema enforces full bidirectionality. If you add a resource mapping with `featureIds: ['lead-gen']`
|
|
158
|
-
then the `lead-gen` feature entry must include the `resourceId` in its own `resourceIds`. Both sides
|
|
159
|
-
must be consistent or `resolveOrganizationModel` throws at startup. See [add-a-resource.md](add-a-resource.md)
|
|
160
|
-
for the full resource authoring workflow.
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
### Domain-specific config
|
|
165
|
-
|
|
166
|
-
The `sales`, `prospecting`, and `projects` top-level keys configure pipeline stages, entity ID bindings,
|
|
167
|
-
and status vocabularies for those domains. These are consumed by the platform adapters and UI
|
|
168
|
-
components -- they are not just labels.
|
|
169
|
-
|
|
170
|
-
```ts
|
|
171
|
-
sales: {
|
|
172
|
-
entityId: 'crm.deal',
|
|
173
|
-
defaultPipelineId: 'default',
|
|
174
|
-
pipelines: [
|
|
175
|
-
{
|
|
176
|
-
id: 'default',
|
|
177
|
-
label: 'Default Pipeline',
|
|
178
|
-
entityId: 'crm.deal',
|
|
179
|
-
stages: [
|
|
180
|
-
{ id: 'interested', label: 'Interested', color: 'blue', order: 1, semanticClass: 'open', surfaceIds: ['crm.pipeline'], resourceIds: [] },
|
|
181
|
-
{ id: 'closed_won', label: 'Closed Won', color: 'green', order: 4, semanticClass: 'closed_won', surfaceIds: ['crm.pipeline'], resourceIds: [] }
|
|
182
|
-
// ... additional stages
|
|
183
|
-
]
|
|
184
|
-
}
|
|
185
|
-
]
|
|
186
|
-
},
|
|
187
|
-
prospecting: {
|
|
188
|
-
listEntityId: 'leadgen.list',
|
|
189
|
-
companyEntityId: 'leadgen.company',
|
|
190
|
-
contactEntityId: 'leadgen.contact',
|
|
191
|
-
companyStages: [
|
|
192
|
-
{ id: 'populated', label: 'Populated', order: 1 },
|
|
193
|
-
{ id: 'qualified', label: 'Qualified', order: 3 }
|
|
194
|
-
],
|
|
195
|
-
contactStages: [
|
|
196
|
-
{ id: 'discovered', label: 'Discovered', order: 1 },
|
|
197
|
-
{ id: 'uploaded', label: 'Uploaded', order: 4 }
|
|
198
|
-
]
|
|
199
|
-
},
|
|
200
|
-
projects: {
|
|
201
|
-
projectEntityId: 'delivery.project',
|
|
202
|
-
milestoneEntityId: 'delivery.milestone',
|
|
203
|
-
taskEntityId: 'delivery.task',
|
|
204
|
-
projectStatuses: [ /* ... */ ],
|
|
205
|
-
milestoneStatuses: [ /* ... */ ],
|
|
206
|
-
taskStatuses: [ /* ... */ ]
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
`semanticClass` on sales pipeline stages is significant: the platform uses `closed_won`, `closed_lost`,
|
|
211
|
-
`nurturing`, `open`, and `active` for funnel analytics and workflow triggers. Do not rename these
|
|
212
|
-
to arbitrary strings.
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
### Export pattern
|
|
217
|
-
|
|
218
|
-
The template exports two models: `canonicalOrganizationModel` for the provider (machine-facing)
|
|
219
|
-
and `organizationModel` for the foundation nav layer (UI-facing with the icon-augmented surface type).
|
|
220
|
-
|
|
221
|
-
```ts
|
|
222
|
-
const resolvedOrganizationModel = resolveOrganizationModel(foundationOrganizationModelOverride)
|
|
223
|
-
|
|
224
|
-
// Passed to ElevasisFeaturesProvider in ui/src/routes/__root.tsx
|
|
225
|
-
export const canonicalOrganizationModel: OrganizationModel = resolvedOrganizationModel
|
|
226
|
-
|
|
227
|
-
// Used by foundation nav components that need the augmented FoundationNavigationSurface type
|
|
228
|
-
export const organizationModel: FoundationOrganizationModel = {
|
|
229
|
-
...canonicalOrganizationModel,
|
|
230
|
-
navigation: {
|
|
231
|
-
defaultSurfaceId: 'operations',
|
|
232
|
-
homeLabel,
|
|
233
|
-
quickAccessSurfaceIds: [...quickAccessSurfaceIds],
|
|
234
|
-
surfaces: navigationSurfaces // FoundationNavigationSurface[] with icon field
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
The `requireCoreSurface` helper (defined in the template file) throws at startup if a surface ID
|
|
240
|
-
declared in the foundations layer is not present in the resolved model. Use it to catch mismatches
|
|
241
|
-
early rather than seeing silent `undefined` in the nav at runtime.
|
|
242
|
-
|
|
243
|
-
---
|
|
244
|
-
|
|
245
|
-
## Common Customizations
|
|
246
|
-
|
|
247
|
-
### Adding a new feature
|
|
248
|
-
|
|
249
|
-
Add a new entry to the `features` array:
|
|
250
|
-
|
|
251
|
-
```ts
|
|
252
|
-
{
|
|
253
|
-
id: 'analytics',
|
|
254
|
-
label: 'Analytics',
|
|
255
|
-
enabled: false, // start disabled; enable per-org when ready
|
|
256
|
-
entityIds: [],
|
|
257
|
-
surfaceIds: [],
|
|
258
|
-
resourceIds: [],
|
|
259
|
-
capabilityIds: []
|
|
260
|
-
}
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
Then proceed with the full manifest, route, and gating steps in [add-a-feature.md](add-a-feature.md).
|
|
264
|
-
The org model change above is Step 2 of that recipe.
|
|
265
|
-
|
|
266
|
-
---
|
|
267
|
-
|
|
268
|
-
### Disabling a default feature
|
|
269
|
-
|
|
270
|
-
Set `enabled: false` on the feature entry. The nav item disappears and `FeatureGuard` blocks
|
|
271
|
-
direct URL access:
|
|
272
|
-
|
|
273
|
-
```ts
|
|
274
|
-
{
|
|
275
|
-
id: 'seo',
|
|
276
|
-
label: 'SEO',
|
|
277
|
-
enabled: false, // nav item hidden, routes redirect to home
|
|
278
|
-
entityIds: [],
|
|
279
|
-
surfaceIds: [],
|
|
280
|
-
resourceIds: [],
|
|
281
|
-
capabilityIds: []
|
|
282
|
-
}
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
The `seo` feature ships disabled by default. If your project does not use `monitoring` either,
|
|
286
|
-
set it to `enabled: false` as well.
|
|
287
|
-
|
|
288
|
-
---
|
|
289
|
-
|
|
290
|
-
### Adding entities to a feature
|
|
291
|
-
|
|
292
|
-
Entity IDs are dot-namespaced strings (`domain.type`). Add to both the feature and any surfaces
|
|
293
|
-
that display those entities:
|
|
294
|
-
|
|
295
|
-
```ts
|
|
296
|
-
// In features array:
|
|
297
|
-
{
|
|
298
|
-
id: 'crm',
|
|
299
|
-
entityIds: ['crm.deal', 'crm.contact'], // added crm.contact
|
|
300
|
-
// ...
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// In the surface that shows contacts:
|
|
304
|
-
{
|
|
305
|
-
id: 'crm.pipeline',
|
|
306
|
-
entityIds: ['crm.deal', 'crm.contact'], // mirror the addition
|
|
307
|
-
// ...
|
|
308
|
-
}
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
Entity IDs inform the organization graph node taxonomy. They do not require registration anywhere
|
|
312
|
-
else in the platform; just keep them consistent across feature and surface declarations.
|
|
313
|
-
|
|
314
|
-
---
|
|
315
|
-
|
|
316
|
-
### Customizing feature labels and descriptions
|
|
317
|
-
|
|
318
|
-
Edit `label` and `description` directly on the feature entry. These values propagate to nav
|
|
319
|
-
label resolution and the settings UI:
|
|
320
|
-
|
|
321
|
-
```ts
|
|
322
|
-
{
|
|
323
|
-
id: 'lead-gen',
|
|
324
|
-
label: 'Prospecting', // override the default 'Lead Gen' label
|
|
325
|
-
description: 'Find and qualify new opportunities',
|
|
326
|
-
// ...
|
|
327
|
-
}
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
If the `FeatureModule` manifest also declares a `navEntry.label`, the manifest label wins in the
|
|
331
|
-
nav sidebar. The feature `label` is the fallback when no manifest override exists.
|
|
332
|
-
|
|
333
|
-
---
|
|
334
|
-
|
|
335
|
-
### Adding surfaces
|
|
336
|
-
|
|
337
|
-
Declare the surface under `navigation.surfaces` and cross-reference it from the owning feature.
|
|
338
|
-
Both sides must be consistent (schema validates bidirectionality):
|
|
339
|
-
|
|
340
|
-
```ts
|
|
341
|
-
// In navigation.surfaces:
|
|
342
|
-
{
|
|
343
|
-
id: 'analytics.dashboard',
|
|
344
|
-
label: 'Analytics',
|
|
345
|
-
path: '/analytics',
|
|
346
|
-
surfaceType: 'dashboard',
|
|
347
|
-
featureId: 'analytics',
|
|
348
|
-
featureIds: ['analytics'],
|
|
349
|
-
entityIds: [],
|
|
350
|
-
resourceIds: [],
|
|
351
|
-
capabilityIds: ['analytics.view']
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// In the analytics feature entry:
|
|
355
|
-
{
|
|
356
|
-
id: 'analytics',
|
|
357
|
-
surfaceIds: ['analytics.dashboard'], // must reference the surface ID above
|
|
358
|
-
capabilityIds: ['analytics.view'],
|
|
359
|
-
// ...
|
|
360
|
-
}
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
---
|
|
364
|
-
|
|
365
|
-
## How It Connects
|
|
366
|
-
|
|
367
|
-
The organization model flows through the runtime in one direction:
|
|
368
|
-
|
|
369
|
-
1. `foundations/config/organization-model.ts` calls `resolveOrganizationModel` at module load.
|
|
370
|
-
The resolved `canonicalOrganizationModel` is exported.
|
|
371
|
-
2. `ui/src/routes/__root.tsx` imports `canonicalOrganizationModel` and passes it to
|
|
372
|
-
`ElevasisFeaturesProvider` along with the `FEATURE_MANIFESTS` array.
|
|
373
|
-
3. `ElevasisFeaturesProvider` validates each manifest's `featureId` against the model's `features`
|
|
374
|
-
array. Unknown `featureId` values throw at startup.
|
|
375
|
-
4. At runtime, the provider uses `features[n].enabled` to decide which nav entries to show.
|
|
376
|
-
`FeatureGuard` reads the same value to allow or block route access.
|
|
377
|
-
5. The organization graph reads `features`, `navigation.surfaces`, `entityIds`, and `resourceMappings`
|
|
378
|
-
to build the operational topology visualization.
|
|
379
|
-
|
|
380
|
-
The contract flows one way: model defines, runtime reads. No part of the UI runtime writes back
|
|
381
|
-
to the model.
|
|
382
|
-
|
|
383
|
-
---
|
|
384
|
-
|
|
385
|
-
## Resolve Behavior
|
|
386
|
-
|
|
387
|
-
`resolveOrganizationModel(override)` does the following:
|
|
388
|
-
|
|
389
|
-
1. Deep-merges the override onto `DEFAULT_ORGANIZATION_MODEL`. Plain objects are merged key by key.
|
|
390
|
-
**Arrays are replaced wholesale** -- if you supply `features: [...]`, your array replaces the
|
|
391
|
-
defaults entirely, not appends to them.
|
|
392
|
-
2. If you override `navigation.surfaces` without overriding `navigation.groups`, the resolver
|
|
393
|
-
automatically filters out any groups whose `surfaceIds` reference surfaces that no longer exist
|
|
394
|
-
in your override. This prevents dangling group references from causing a parse failure.
|
|
395
|
-
3. Parses the merged result through `OrganizationModelSchema`. Any bidirectional reference
|
|
396
|
-
inconsistency (feature \<-\> surface, surface \<-\> resource mapping) throws a Zod validation
|
|
397
|
-
error with a specific path and message pointing to the offending reference.
|
|
398
|
-
|
|
399
|
-
When you see a startup error from `resolveOrganizationModel`, read the Zod issue path carefully.
|
|
400
|
-
It will identify which specific field and array index contains the broken reference.
|
|
1
|
+
---
|
|
2
|
+
title: Customize organization-model.ts
|
|
3
|
+
description: Annotated walkthrough for customizing the organization model in template-derived projects, covering the unified feature API, surfaces, domain config, and the resolve pipeline.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Customize organization-model.ts
|
|
7
|
+
|
|
8
|
+
`foundations/config/organization-model.ts` is the semantic contract between your UI runtime
|
|
9
|
+
and your platform operations. Every feature your users can access, every nav surface they can
|
|
10
|
+
navigate to, and every resource backed by a workflow is declared here. The provider reads this
|
|
11
|
+
contract at startup; everything downstream -- routing, gating, nav rendering -- derives from it.
|
|
12
|
+
|
|
13
|
+
This recipe walks through the file section by section. For adding a net-new feature from scratch
|
|
14
|
+
(manifest, routes, gating) see [add-a-feature.md](add-a-feature.md).
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Anatomy
|
|
19
|
+
|
|
20
|
+
### Import and setup
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import {
|
|
24
|
+
defineOrganizationModel,
|
|
25
|
+
resolveOrganizationModel,
|
|
26
|
+
type OrganizationModel,
|
|
27
|
+
type OrganizationModelSurface
|
|
28
|
+
} from '@elevasis/core/organization-model'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Two functions and two types are all you need:
|
|
32
|
+
|
|
33
|
+
- `defineOrganizationModel` -- identity helper that gives TypeScript a typed override shape.
|
|
34
|
+
Pass your override object through it; you get type-checking against `DeepPartial<OrganizationModel>`
|
|
35
|
+
without having to fill every field.
|
|
36
|
+
- `resolveOrganizationModel` -- merges your override with the platform defaults and validates the
|
|
37
|
+
result through `OrganizationModelSchema`. Call once at module init; export the result.
|
|
38
|
+
- `OrganizationModel` -- the fully-resolved model type (after defaults are merged in).
|
|
39
|
+
- `OrganizationModelSurface` -- the surface definition type; useful when building the foundation
|
|
40
|
+
navigation surface layer (see the export pattern below).
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### Features array
|
|
45
|
+
|
|
46
|
+
The `features` array is the sole source of truth for which capabilities the organization has
|
|
47
|
+
and whether they are on or off. Each entry is an `OrganizationModelFeature` (inferred from
|
|
48
|
+
`FeatureSchema`).
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
const foundationOrganizationModelOverride = defineOrganizationModel({
|
|
52
|
+
features: [
|
|
53
|
+
{
|
|
54
|
+
id: 'crm', // stable kebab-case ID; FeatureModule.featureId must match
|
|
55
|
+
label: 'CRM', // display name for nav label resolution
|
|
56
|
+
description: 'Relationship pipeline and deal management', // optional; shown in settings UI
|
|
57
|
+
enabled: true, // org-wide default; false hides from nav and blocks routes
|
|
58
|
+
color: 'blue', // Mantine color token; optional
|
|
59
|
+
entityIds: ['crm.deal'], // logical entity types this feature owns
|
|
60
|
+
surfaceIds: ['crm.pipeline'], // navigation surfaces that belong to this feature
|
|
61
|
+
resourceIds: [], // workflow/agent resource IDs mapped through resourceMappings
|
|
62
|
+
capabilityIds: ['crm.pipeline.manage'] // fine-grained capability strings for gating
|
|
63
|
+
},
|
|
64
|
+
// ... other features
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Field reference:
|
|
70
|
+
|
|
71
|
+
- `id` -- lowercase, kebab-case, dot-separated segments allowed (`crm`, `lead-gen`, `operations`).
|
|
72
|
+
This value must exactly match the `featureId` on any `FeatureModule` manifest that gates against
|
|
73
|
+
this feature. The provider throws at startup if a manifest references an unknown feature ID.
|
|
74
|
+
- `label` -- shown in nav when no manifest override is provided. Keep short.
|
|
75
|
+
- `description` -- optional. Appears in membership/settings surfaces.
|
|
76
|
+
- `enabled` -- `false` suppresses the nav entry and triggers `FeatureGuard` redirects. Default is
|
|
77
|
+
`true` per the schema. To ship a feature but keep it off by default, set this to `false` here
|
|
78
|
+
and enable it per-org through membership config.
|
|
79
|
+
- `color` -- any Mantine color token string (`blue`, `cyan`, `violet`, `orange`). Optional.
|
|
80
|
+
- `icon` -- icon name string. Optional. The foundation layer re-maps this via `FoundationSurfaceIcon`.
|
|
81
|
+
- `entityIds` -- dot-namespaced entity type IDs (`crm.deal`, `leadgen.list`). Purely semantic; used
|
|
82
|
+
by the organization graph to classify nodes.
|
|
83
|
+
- `surfaceIds` -- must reference IDs declared in `navigation.surfaces`. Bidirectional: the schema
|
|
84
|
+
validates that every surface listed here also lists this feature in its own `featureIds`.
|
|
85
|
+
- `resourceIds` -- must reference `resourceId` values in `resourceMappings`. Bidirectional: the
|
|
86
|
+
schema validates the reverse link exists. Leave empty until you have actual resource mappings.
|
|
87
|
+
- `capabilityIds` -- dot-namespaced strings (`crm.pipeline.manage`). Used by `FeatureGuard` and
|
|
88
|
+
surface-level access checks. No central registry; name them descriptively.
|
|
89
|
+
|
|
90
|
+
The 7 platform defaults are: `crm`, `lead-gen`, `projects`, `operations`, `monitoring`, `settings`,
|
|
91
|
+
`seo`. The template's `features` array replaces the defaults wholesale (arrays are not merged field
|
|
92
|
+
by field -- see Resolve Behavior below).
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### Navigation surfaces
|
|
97
|
+
|
|
98
|
+
Surfaces are the navigable pages of your application. Declare them under `navigation.surfaces`.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
navigation: {
|
|
102
|
+
defaultSurfaceId: 'operations.organization-graph', // surface shown on first load
|
|
103
|
+
surfaces: [
|
|
104
|
+
{
|
|
105
|
+
id: 'crm.pipeline', // stable ID; referenced by feature.surfaceIds and group.surfaceIds
|
|
106
|
+
label: 'CRM', // nav label
|
|
107
|
+
path: '/crm', // TanStack Router path prefix
|
|
108
|
+
surfaceType: 'graph', // 'page' | 'dashboard' | 'graph' | 'detail' | 'list' | 'settings'
|
|
109
|
+
featureId: 'crm', // primary owning feature (optional but conventional)
|
|
110
|
+
featureIds: ['crm'], // all features this surface belongs to (bidirectional with feature.surfaceIds)
|
|
111
|
+
entityIds: ['crm.deal'], // entity types rendered on this surface
|
|
112
|
+
resourceIds: [], // resource IDs rendered on this surface (from resourceMappings)
|
|
113
|
+
capabilityIds: ['crm.pipeline.manage'] // capabilities required to access this surface
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Surface field notes:
|
|
120
|
+
|
|
121
|
+
- `surfaceType` -- drives how the organization graph classifies and renders the surface node.
|
|
122
|
+
Use `graph` for pipeline/topology views, `list` for index pages, `settings` for settings pages.
|
|
123
|
+
- `featureId` vs `featureIds` -- `featureId` is the single primary owner (optional). `featureIds`
|
|
124
|
+
is the bidirectional array that the schema validates against. In practice, set both to the same
|
|
125
|
+
single value for most surfaces.
|
|
126
|
+
- `parentId` -- optional. Lets you declare a surface as a child of another (for nested nav or
|
|
127
|
+
detail surfaces). Must reference a declared surface ID.
|
|
128
|
+
- Bidirectional constraint: if `crm.pipeline` is in `feature.surfaceIds`, then `crm.pipeline`'s
|
|
129
|
+
`featureIds` must include `crm`. The schema parse throws if either side is missing.
|
|
130
|
+
|
|
131
|
+
The template adds a `FoundationNavigationSurface` extension type that augments the core surface
|
|
132
|
+
with a typed `icon` field (`FoundationSurfaceIcon`). This is used by the foundation nav layer to
|
|
133
|
+
render icon components in the sidebar.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### Resources and resourceMappings
|
|
138
|
+
|
|
139
|
+
Resource mappings connect platform workflows and agents to features and surfaces. They are optional
|
|
140
|
+
until you have deployed resources to map.
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
resourceMappings: [
|
|
144
|
+
{
|
|
145
|
+
id: 'my-mapping', // unique within resourceMappings
|
|
146
|
+
resourceId: 'my-lead-scraper-workflow', // the deployed resource ID from operations/
|
|
147
|
+
resourceType: 'workflow', // 'workflow' | 'agent' | 'trigger' | 'integration' | 'external' | 'human_checkpoint'
|
|
148
|
+
label: 'Lead Scraper',
|
|
149
|
+
featureIds: ['lead-gen'], // bidirectional: feature.resourceIds must include resourceId
|
|
150
|
+
entityIds: ['leadgen.company'],
|
|
151
|
+
surfaceIds: ['lead-gen.lists'], // bidirectional: surface.resourceIds must include resourceId
|
|
152
|
+
capabilityIds: []
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The schema enforces full bidirectionality. If you add a resource mapping with `featureIds: ['lead-gen']`
|
|
158
|
+
then the `lead-gen` feature entry must include the `resourceId` in its own `resourceIds`. Both sides
|
|
159
|
+
must be consistent or `resolveOrganizationModel` throws at startup. See [add-a-resource.md](add-a-resource.md)
|
|
160
|
+
for the full resource authoring workflow.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### Domain-specific config
|
|
165
|
+
|
|
166
|
+
The `sales`, `prospecting`, and `projects` top-level keys configure pipeline stages, entity ID bindings,
|
|
167
|
+
and status vocabularies for those domains. These are consumed by the platform adapters and UI
|
|
168
|
+
components -- they are not just labels.
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
sales: {
|
|
172
|
+
entityId: 'crm.deal',
|
|
173
|
+
defaultPipelineId: 'default',
|
|
174
|
+
pipelines: [
|
|
175
|
+
{
|
|
176
|
+
id: 'default',
|
|
177
|
+
label: 'Default Pipeline',
|
|
178
|
+
entityId: 'crm.deal',
|
|
179
|
+
stages: [
|
|
180
|
+
{ id: 'interested', label: 'Interested', color: 'blue', order: 1, semanticClass: 'open', surfaceIds: ['crm.pipeline'], resourceIds: [] },
|
|
181
|
+
{ id: 'closed_won', label: 'Closed Won', color: 'green', order: 4, semanticClass: 'closed_won', surfaceIds: ['crm.pipeline'], resourceIds: [] }
|
|
182
|
+
// ... additional stages
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
prospecting: {
|
|
188
|
+
listEntityId: 'leadgen.list',
|
|
189
|
+
companyEntityId: 'leadgen.company',
|
|
190
|
+
contactEntityId: 'leadgen.contact',
|
|
191
|
+
companyStages: [
|
|
192
|
+
{ id: 'populated', label: 'Populated', order: 1 },
|
|
193
|
+
{ id: 'qualified', label: 'Qualified', order: 3 }
|
|
194
|
+
],
|
|
195
|
+
contactStages: [
|
|
196
|
+
{ id: 'discovered', label: 'Discovered', order: 1 },
|
|
197
|
+
{ id: 'uploaded', label: 'Uploaded', order: 4 }
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
projects: {
|
|
201
|
+
projectEntityId: 'delivery.project',
|
|
202
|
+
milestoneEntityId: 'delivery.milestone',
|
|
203
|
+
taskEntityId: 'delivery.task',
|
|
204
|
+
projectStatuses: [ /* ... */ ],
|
|
205
|
+
milestoneStatuses: [ /* ... */ ],
|
|
206
|
+
taskStatuses: [ /* ... */ ]
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
`semanticClass` on sales pipeline stages is significant: the platform uses `closed_won`, `closed_lost`,
|
|
211
|
+
`nurturing`, `open`, and `active` for funnel analytics and workflow triggers. Do not rename these
|
|
212
|
+
to arbitrary strings.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### Export pattern
|
|
217
|
+
|
|
218
|
+
The template exports two models: `canonicalOrganizationModel` for the provider (machine-facing)
|
|
219
|
+
and `organizationModel` for the foundation nav layer (UI-facing with the icon-augmented surface type).
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
const resolvedOrganizationModel = resolveOrganizationModel(foundationOrganizationModelOverride)
|
|
223
|
+
|
|
224
|
+
// Passed to ElevasisFeaturesProvider in ui/src/routes/__root.tsx
|
|
225
|
+
export const canonicalOrganizationModel: OrganizationModel = resolvedOrganizationModel
|
|
226
|
+
|
|
227
|
+
// Used by foundation nav components that need the augmented FoundationNavigationSurface type
|
|
228
|
+
export const organizationModel: FoundationOrganizationModel = {
|
|
229
|
+
...canonicalOrganizationModel,
|
|
230
|
+
navigation: {
|
|
231
|
+
defaultSurfaceId: 'operations',
|
|
232
|
+
homeLabel,
|
|
233
|
+
quickAccessSurfaceIds: [...quickAccessSurfaceIds],
|
|
234
|
+
surfaces: navigationSurfaces // FoundationNavigationSurface[] with icon field
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The `requireCoreSurface` helper (defined in the template file) throws at startup if a surface ID
|
|
240
|
+
declared in the foundations layer is not present in the resolved model. Use it to catch mismatches
|
|
241
|
+
early rather than seeing silent `undefined` in the nav at runtime.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Common Customizations
|
|
246
|
+
|
|
247
|
+
### Adding a new feature
|
|
248
|
+
|
|
249
|
+
Add a new entry to the `features` array:
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
{
|
|
253
|
+
id: 'analytics',
|
|
254
|
+
label: 'Analytics',
|
|
255
|
+
enabled: false, // start disabled; enable per-org when ready
|
|
256
|
+
entityIds: [],
|
|
257
|
+
surfaceIds: [],
|
|
258
|
+
resourceIds: [],
|
|
259
|
+
capabilityIds: []
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Then proceed with the full manifest, route, and gating steps in [add-a-feature.md](add-a-feature.md).
|
|
264
|
+
The org model change above is Step 2 of that recipe.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
### Disabling a default feature
|
|
269
|
+
|
|
270
|
+
Set `enabled: false` on the feature entry. The nav item disappears and `FeatureGuard` blocks
|
|
271
|
+
direct URL access:
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
{
|
|
275
|
+
id: 'seo',
|
|
276
|
+
label: 'SEO',
|
|
277
|
+
enabled: false, // nav item hidden, routes redirect to home
|
|
278
|
+
entityIds: [],
|
|
279
|
+
surfaceIds: [],
|
|
280
|
+
resourceIds: [],
|
|
281
|
+
capabilityIds: []
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
The `seo` feature ships disabled by default. If your project does not use `monitoring` either,
|
|
286
|
+
set it to `enabled: false` as well.
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
### Adding entities to a feature
|
|
291
|
+
|
|
292
|
+
Entity IDs are dot-namespaced strings (`domain.type`). Add to both the feature and any surfaces
|
|
293
|
+
that display those entities:
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
// In features array:
|
|
297
|
+
{
|
|
298
|
+
id: 'crm',
|
|
299
|
+
entityIds: ['crm.deal', 'crm.contact'], // added crm.contact
|
|
300
|
+
// ...
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// In the surface that shows contacts:
|
|
304
|
+
{
|
|
305
|
+
id: 'crm.pipeline',
|
|
306
|
+
entityIds: ['crm.deal', 'crm.contact'], // mirror the addition
|
|
307
|
+
// ...
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Entity IDs inform the organization graph node taxonomy. They do not require registration anywhere
|
|
312
|
+
else in the platform; just keep them consistent across feature and surface declarations.
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
### Customizing feature labels and descriptions
|
|
317
|
+
|
|
318
|
+
Edit `label` and `description` directly on the feature entry. These values propagate to nav
|
|
319
|
+
label resolution and the settings UI:
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
{
|
|
323
|
+
id: 'lead-gen',
|
|
324
|
+
label: 'Prospecting', // override the default 'Lead Gen' label
|
|
325
|
+
description: 'Find and qualify new opportunities',
|
|
326
|
+
// ...
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
If the `FeatureModule` manifest also declares a `navEntry.label`, the manifest label wins in the
|
|
331
|
+
nav sidebar. The feature `label` is the fallback when no manifest override exists.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
### Adding surfaces
|
|
336
|
+
|
|
337
|
+
Declare the surface under `navigation.surfaces` and cross-reference it from the owning feature.
|
|
338
|
+
Both sides must be consistent (schema validates bidirectionality):
|
|
339
|
+
|
|
340
|
+
```ts
|
|
341
|
+
// In navigation.surfaces:
|
|
342
|
+
{
|
|
343
|
+
id: 'analytics.dashboard',
|
|
344
|
+
label: 'Analytics',
|
|
345
|
+
path: '/analytics',
|
|
346
|
+
surfaceType: 'dashboard',
|
|
347
|
+
featureId: 'analytics',
|
|
348
|
+
featureIds: ['analytics'],
|
|
349
|
+
entityIds: [],
|
|
350
|
+
resourceIds: [],
|
|
351
|
+
capabilityIds: ['analytics.view']
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// In the analytics feature entry:
|
|
355
|
+
{
|
|
356
|
+
id: 'analytics',
|
|
357
|
+
surfaceIds: ['analytics.dashboard'], // must reference the surface ID above
|
|
358
|
+
capabilityIds: ['analytics.view'],
|
|
359
|
+
// ...
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## How It Connects
|
|
366
|
+
|
|
367
|
+
The organization model flows through the runtime in one direction:
|
|
368
|
+
|
|
369
|
+
1. `foundations/config/organization-model.ts` calls `resolveOrganizationModel` at module load.
|
|
370
|
+
The resolved `canonicalOrganizationModel` is exported.
|
|
371
|
+
2. `ui/src/routes/__root.tsx` imports `canonicalOrganizationModel` and passes it to
|
|
372
|
+
`ElevasisFeaturesProvider` along with the `FEATURE_MANIFESTS` array.
|
|
373
|
+
3. `ElevasisFeaturesProvider` validates each manifest's `featureId` against the model's `features`
|
|
374
|
+
array. Unknown `featureId` values throw at startup.
|
|
375
|
+
4. At runtime, the provider uses `features[n].enabled` to decide which nav entries to show.
|
|
376
|
+
`FeatureGuard` reads the same value to allow or block route access.
|
|
377
|
+
5. The organization graph reads `features`, `navigation.surfaces`, `entityIds`, and `resourceMappings`
|
|
378
|
+
to build the operational topology visualization.
|
|
379
|
+
|
|
380
|
+
The contract flows one way: model defines, runtime reads. No part of the UI runtime writes back
|
|
381
|
+
to the model.
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Resolve Behavior
|
|
386
|
+
|
|
387
|
+
`resolveOrganizationModel(override)` does the following:
|
|
388
|
+
|
|
389
|
+
1. Deep-merges the override onto `DEFAULT_ORGANIZATION_MODEL`. Plain objects are merged key by key.
|
|
390
|
+
**Arrays are replaced wholesale** -- if you supply `features: [...]`, your array replaces the
|
|
391
|
+
defaults entirely, not appends to them.
|
|
392
|
+
2. If you override `navigation.surfaces` without overriding `navigation.groups`, the resolver
|
|
393
|
+
automatically filters out any groups whose `surfaceIds` reference surfaces that no longer exist
|
|
394
|
+
in your override. This prevents dangling group references from causing a parse failure.
|
|
395
|
+
3. Parses the merged result through `OrganizationModelSchema`. Any bidirectional reference
|
|
396
|
+
inconsistency (feature \<-\> surface, surface \<-\> resource mapping) throws a Zod validation
|
|
397
|
+
error with a specific path and message pointing to the offending reference.
|
|
398
|
+
|
|
399
|
+
When you see a startup error from `resolveOrganizationModel`, read the Zod issue path carefully.
|
|
400
|
+
It will identify which specific field and array index contains the broken reference.
|