@elevasis/core 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +69 -159
- package/dist/index.js +324 -613
- package/dist/organization-model/index.d.ts +69 -159
- package/dist/organization-model/index.js +324 -613
- package/dist/test-utils/index.d.ts +192 -45
- package/dist/test-utils/index.js +260 -600
- package/package.json +1 -1
- package/src/__tests__/template-core-compatibility.test.ts +73 -91
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +94 -182
- package/src/auth/multi-tenancy/index.ts +20 -17
- package/src/auth/multi-tenancy/memberships/api-schemas.ts +142 -126
- package/src/auth/multi-tenancy/memberships/index.ts +26 -22
- package/src/auth/multi-tenancy/permissions.test.ts +42 -0
- package/src/auth/multi-tenancy/permissions.ts +104 -0
- package/src/organization-model/README.md +102 -97
- package/src/organization-model/__tests__/defaults.test.ts +19 -6
- package/src/organization-model/__tests__/domains/resource-mappings.test.ts +24 -93
- package/src/organization-model/__tests__/graph.test.ts +82 -894
- package/src/organization-model/__tests__/resolve.test.ts +59 -690
- package/src/organization-model/__tests__/schema.test.ts +83 -407
- package/src/organization-model/contracts.ts +4 -3
- package/src/organization-model/defaults.ts +277 -141
- package/src/organization-model/domains/features.ts +31 -22
- package/src/organization-model/domains/navigation.ts +27 -20
- package/src/organization-model/foundation.ts +42 -54
- package/src/organization-model/graph/build.ts +42 -217
- package/src/organization-model/graph/index.ts +4 -4
- package/src/organization-model/graph/link.ts +10 -0
- package/src/organization-model/graph/schema.ts +21 -16
- package/src/organization-model/graph/types.ts +10 -10
- package/src/organization-model/helpers.ts +74 -0
- package/src/organization-model/index.ts +7 -7
- package/src/organization-model/organization-graph.mdx +89 -272
- package/src/organization-model/organization-model.mdx +152 -320
- package/src/organization-model/published.ts +20 -19
- package/src/organization-model/resolve.ts +8 -33
- package/src/organization-model/schema.ts +63 -205
- package/src/organization-model/types.ts +12 -11
- package/src/platform/constants/versions.ts +3 -3
- package/src/platform/registry/__tests__/command-view.test.ts +6 -5
- package/src/platform/registry/__tests__/resource-link.test.ts +30 -0
- package/src/platform/registry/__tests__/resource-registry.integration.test.ts +15 -15
- package/src/platform/registry/command-view.ts +10 -12
- package/src/platform/registry/index.ts +93 -93
- package/src/platform/registry/resource-link.ts +32 -0
- package/src/platform/registry/resource-registry.ts +917 -876
- package/src/platform/registry/serialization.ts +56 -73
- package/src/platform/registry/serialized-types.ts +17 -12
- package/src/platform/registry/types.ts +14 -43
- package/src/reference/_generated/contracts.md +94 -182
- package/src/reference/glossary.md +71 -105
- package/src/scaffold-registry/__tests__/index.test.ts +125 -1
- package/src/scaffold-registry/__tests__/schema.test.ts +48 -20
- package/src/scaffold-registry/index.ts +236 -188
- package/src/scaffold-registry/schema.ts +47 -22
- package/src/supabase/database.types.ts +2880 -2719
- package/src/test-utils/fixtures/memberships.ts +82 -80
- package/src/platform/registry/domains.ts +0 -165
|
@@ -1,272 +1,89 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Organization Graph
|
|
3
|
-
description: Organization OS
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Graph contracts live in `@repo/core
|
|
11
|
-
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- `packages/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- `
|
|
27
|
-
- `
|
|
28
|
-
- `
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
`OrganizationGraphNode` also includes optional `sourceId`, `description`, `enabled`, `featureId`, `surfaceType`, and `resourceType`. `OrganizationGraphEdge` includes optional `label` and `relationshipType`.
|
|
91
|
-
|
|
92
|
-
### Build pipeline
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
interface BuildOrganizationGraphInput {
|
|
96
|
-
organizationModel: OrganizationModel
|
|
97
|
-
commandViewData?: CommandViewData
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
`buildOrganizationGraph` accepts optional topology input so the semantic graph still renders when operational bridging is sparse. The derivation flow is additive and upsert-oriented:
|
|
102
|
-
|
|
103
|
-
1. Resolve the active organization model.
|
|
104
|
-
2. Derive semantic nodes and edges from features, surfaces, entities, capabilities, and resource mappings.
|
|
105
|
-
3. Upsert bridged runtime resources from Command View data into shared `resource` nodes.
|
|
106
|
-
4. Bridge Command View runtime topology onto the same DTO as `references` edges between `resource` nodes, using `relationshipType` for runtime relationship labels.
|
|
107
|
-
5. Hand the resulting graph to UI-level lensing, filtering, and Cytoscape projection.
|
|
108
|
-
|
|
109
|
-
Keeping assembly outside the renderer keeps graph semantics testable without UI and prevents Cytoscape concepts from leaking into business logic.
|
|
110
|
-
|
|
111
|
-
### Ownership split
|
|
112
|
-
|
|
113
|
-
- `@repo/core` owns normalized node/edge types, schemas, and build/derivation helpers.
|
|
114
|
-
- `@repo/ui` owns Cytoscape element conversion, layout presets, selection state, path tracing, viewport mechanics, detail panels, and presentation helpers.
|
|
115
|
-
- `apps/command-center` owns route wiring and page-level integration.
|
|
116
|
-
|
|
117
|
-
## Interaction Model
|
|
118
|
-
|
|
119
|
-
### Lenses
|
|
120
|
-
|
|
121
|
-
The graph ships with two lens presets in UI code:
|
|
122
|
-
|
|
123
|
-
- `default` -- title "Organization Graph", initial mode `map`, no preset filters
|
|
124
|
-
- `command-view` -- title "Command View", initial mode `trace`, filters preset to `nodeKinds: ['resource']` and `topologyPresence: 'topology-only'`
|
|
125
|
-
|
|
126
|
-
Lenses do not change the core DTO. They configure how the shared graph is initially presented.
|
|
127
|
-
|
|
128
|
-
The command-view preset is intentionally narrow. It starts from topology-focused `resource` nodes so runtime traces stay readable, even though the underlying graph still contains semantic nodes and bridge edges.
|
|
129
|
-
|
|
130
|
-
### Modes
|
|
131
|
-
|
|
132
|
-
- **Map mode** -- clustered for broad graph orientation
|
|
133
|
-
- **Trace mode** -- directed layout that privileges path readability
|
|
134
|
-
- **Impact mode** -- centered radial/concentric layout around the current focus
|
|
135
|
-
|
|
136
|
-
Layouts are deterministic presets, not unconstrained force simulation:
|
|
137
|
-
|
|
138
|
-
- `map` uses Cytoscape `cose`
|
|
139
|
-
- `trace` uses directed `breadthfirst`
|
|
140
|
-
- `impact` uses degree-based `concentric`
|
|
141
|
-
|
|
142
|
-
### Interactions
|
|
143
|
-
|
|
144
|
-
Primary set in the current shared page:
|
|
145
|
-
|
|
146
|
-
- click node for detail panel
|
|
147
|
-
- click edge for relationship meaning
|
|
148
|
-
- switch mode
|
|
149
|
-
- highlight shortest directed paths between two visible nodes in trace mode
|
|
150
|
-
- filter by node kind, topology presence, and free-text search
|
|
151
|
-
|
|
152
|
-
Deferred: freeform node placement, collaborative annotations, graph editing/authoring, arbitrary canvas drawing.
|
|
153
|
-
|
|
154
|
-
### Filtering
|
|
155
|
-
|
|
156
|
-
The filter state lives in `useOrganizationGraphFilters()` and the toolbar UI in `OrganizationGraphFilterToolbar`.
|
|
157
|
-
|
|
158
|
-
Filter inputs:
|
|
159
|
-
|
|
160
|
-
- `search`
|
|
161
|
-
- `nodeKinds`
|
|
162
|
-
- `topologyPresence: 'all' | 'semantic-only' | 'topology-only'`
|
|
163
|
-
|
|
164
|
-
Presence is derived per node in UI helpers:
|
|
165
|
-
|
|
166
|
-
- `resource` nodes are `topology-only`
|
|
167
|
-
- non-resource nodes with only semantic edges are `semantic-only`
|
|
168
|
-
- non-resource nodes with `maps_to` edges or runtime relationship edges alongside semantic edges are treated as `bridge` nodes internally
|
|
169
|
-
|
|
170
|
-
`bridge` is an internal classification used by the filtering helpers. The public filter control only exposes `all`, `semantic-only`, and `topology-only`, so bridge nodes appear when presence is `all`.
|
|
171
|
-
|
|
172
|
-
Search matches node IDs, labels, descriptions, source IDs, feature IDs, surface/resource types, edge labels, edge kinds, and `relationshipType`.
|
|
173
|
-
|
|
174
|
-
The page applies `useDeferredValue()` to the active filters so graph search stays responsive while typing.
|
|
175
|
-
|
|
176
|
-
### Path tracing
|
|
177
|
-
|
|
178
|
-
The visible Cytoscape surface projects a **filtered** shared graph DTO rather than rendering the full graph unconditionally. Path tracing resolves and highlights directed paths inside the current visible projection, so filtering and tracing stay coherent.
|
|
179
|
-
|
|
180
|
-
Renderer-agnostic helpers under `packages/ui/src/features/operations/organization-graph/path-tracing/` implement shortest-path logic independent of Cytoscape.
|
|
181
|
-
|
|
182
|
-
## Provider Integration
|
|
183
|
-
|
|
184
|
-
The graph is exposed through `ElevasisFeaturesProvider` rather than as app-local glue:
|
|
185
|
-
|
|
186
|
-
- `FeatureModule.organizationGraph.surfaceId` declares a manifest's bridge point.
|
|
187
|
-
- `operationsManifest` declares `organizationGraph.surfaceId = 'operations.organization-graph'`.
|
|
188
|
-
- The provider resolves that against `organizationModel.navigation.surfaces` and exposes the result as `organizationGraph` in context.
|
|
189
|
-
- Shared UI/operations code stays manifest-driven while remaining aware of semantic organization topology.
|
|
190
|
-
|
|
191
|
-
This provider bridge resolves the canonical shared graph surface, not a Command View-specific surface. Command View still has its own navigation surface (`operations.command-view`), but the live page delegates into the shared graph renderer.
|
|
192
|
-
|
|
193
|
-
## Command View Integration
|
|
194
|
-
|
|
195
|
-
`CommandViewPage` now delegates to `OrganizationGraphPage` through a command-view lens preset. The shared page adds command-view operational context through:
|
|
196
|
-
|
|
197
|
-
- command-view summary cards rendered in `OrganizationGraphPage`
|
|
198
|
-
- selection-aware resource and human-checkpoint summaries inside the shared graph detail panel
|
|
199
|
-
- follow-up actions for recent executions and pending tasks inside the detail panel
|
|
200
|
-
- dedicated command-view sidebar content alongside the shared graph controls
|
|
201
|
-
|
|
202
|
-
Operational summary and drill-down derivation is covered by tests under `packages/ui/src/features/operations/organization-graph/__tests__/`.
|
|
203
|
-
|
|
204
|
-
The detail experience is shared through `OrganizationGraphDetailPanel`, which can render both semantic context and command-view-specific follow-up sections.
|
|
205
|
-
|
|
206
|
-
Keep the current seam explicit:
|
|
207
|
-
|
|
208
|
-
- The graph canvas, selection model, path tracing, shared filters, and detail panel all live in `OrganizationGraphPage`.
|
|
209
|
-
- `OperationsSidebarMiddle` still renders `CommandViewSidebarContent` for `/operations/command-view`.
|
|
210
|
-
- That sidebar remains a companion operational panel with some legacy store/filter assumptions and is not the source of truth for the shared graph's filter state.
|
|
211
|
-
- Older React Flow Command View code still exists in the repo, but it is no longer the live renderer for the current Command View route.
|
|
212
|
-
|
|
213
|
-
## Cytoscape Responsibility Split
|
|
214
|
-
|
|
215
|
-
Cytoscape owns:
|
|
216
|
-
|
|
217
|
-
- element rendering
|
|
218
|
-
- compound/group visualization
|
|
219
|
-
- neighborhood traversal and selection state
|
|
220
|
-
- path highlighting
|
|
221
|
-
- collapsed/expanded cluster behavior
|
|
222
|
-
- layout execution
|
|
223
|
-
- viewport mechanics (pan, zoom, fit, focus)
|
|
224
|
-
|
|
225
|
-
React owns:
|
|
226
|
-
|
|
227
|
-
- mode switching
|
|
228
|
-
- side panels and inspectors
|
|
229
|
-
- filter toolbar search and trace controls
|
|
230
|
-
- route state and deep-linking
|
|
231
|
-
- server data fetching
|
|
232
|
-
|
|
233
|
-
## Package Boundary
|
|
234
|
-
|
|
235
|
-
- `packages/ui/package.json` declares Cytoscape on the published UI surface.
|
|
236
|
-
- `packages/ui/tsup.config.ts` and `packages/ui/rollup.dts.config.mjs` keep Cytoscape **externalized** for publish output.
|
|
237
|
-
- Graph DTO types, schemas, and builders live in monorepo `@repo/core` organization-model modules.
|
|
238
|
-
- Cytoscape rendering, lens presets, filtering helpers, and detail/runtime presentation live in `@repo/ui`.
|
|
239
|
-
- The published `@elevasis/core` wrapper still exposes only the narrow organization-model API; this graph contract should be treated as monorepo-internal for now.
|
|
240
|
-
|
|
241
|
-
## Theming
|
|
242
|
-
|
|
243
|
-
The shared Cytoscape page reads CSS custom properties at runtime via `window.getComputedStyle(document.documentElement)`. Nodes, edges, overlays, and glass panels stay aligned with the active UI theme instead of relying on a fixed graph-only palette.
|
|
244
|
-
|
|
245
|
-
## Cytoscape States
|
|
246
|
-
|
|
247
|
-
The renderer applies CSS-class-style state markers to highlight context and traces:
|
|
248
|
-
|
|
249
|
-
- `.is-faded`
|
|
250
|
-
- `.is-context`
|
|
251
|
-
- `.is-selected`
|
|
252
|
-
- `.is-connected`
|
|
253
|
-
- `.is-trace-node`
|
|
254
|
-
- `.is-trace-endpoint`
|
|
255
|
-
- `.is-trace-edge`
|
|
256
|
-
|
|
257
|
-
These classes drive neighborhood focus, selection emphasis, and trace-path highlighting without changing the underlying DTO.
|
|
258
|
-
|
|
259
|
-
## Migration Guardrails
|
|
260
|
-
|
|
261
|
-
- Do not move canonical graph interfaces into `packages/ui`.
|
|
262
|
-
- Do not redefine organization-model semantics in app-local graph config.
|
|
263
|
-
- Do not make the graph contract depend on Cytoscape-specific types.
|
|
264
|
-
- Existing Command View relationships bridge into `relationshipType = triggers | uses | approval` -- do not overload those operational labels with new semantic meaning.
|
|
265
|
-
|
|
266
|
-
## Verification
|
|
267
|
-
|
|
268
|
-
- `pnpm --filter @repo/core test -- organization-model graph`
|
|
269
|
-
- `pnpm --filter @repo/ui test -- commandViewDrillDown commandViewOperationalSummary organizationGraphDetail`
|
|
270
|
-
- `pnpm --filter @repo/ui build`
|
|
271
|
-
- `pnpm --filter @repo/ui build:publish`
|
|
272
|
-
- `pnpm --filter command-center build`
|
|
1
|
+
---
|
|
2
|
+
title: Organization Graph
|
|
3
|
+
description: Organization OS graph layer documentation for the organization graph derived from flat Organization Model features and resource metadata links.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
The organization graph treats the organization model as the top-level ontology and bridges in Command View runtime topology. Command View is a lens over the shared graph, not a separate semantic model.
|
|
9
|
+
|
|
10
|
+
Graph contracts live in `@repo/core`; rendering lives in `@repo/ui`.
|
|
11
|
+
|
|
12
|
+
## Source of Truth
|
|
13
|
+
|
|
14
|
+
- `packages/core/src/organization-model/graph/types.ts`
|
|
15
|
+
- `packages/core/src/organization-model/graph/schema.ts`
|
|
16
|
+
- `packages/core/src/organization-model/graph/build.ts`
|
|
17
|
+
- `packages/core/src/organization-model/graph/link.ts`
|
|
18
|
+
- `packages/core/src/organization-model/__tests__/graph.test.ts`
|
|
19
|
+
- `packages/ui/src/features/operations/OrganizationGraphPage.tsx`
|
|
20
|
+
- `packages/ui/src/features/operations/organization-graph/`
|
|
21
|
+
|
|
22
|
+
## Model
|
|
23
|
+
|
|
24
|
+
Node kinds:
|
|
25
|
+
|
|
26
|
+
- `organization`
|
|
27
|
+
- `feature`
|
|
28
|
+
- `entity`
|
|
29
|
+
- `capability`
|
|
30
|
+
- `resource`
|
|
31
|
+
- `integration`
|
|
32
|
+
|
|
33
|
+
Edge kinds:
|
|
34
|
+
|
|
35
|
+
- `contains`
|
|
36
|
+
- `references`
|
|
37
|
+
- `exposes`
|
|
38
|
+
- `maps_to`
|
|
39
|
+
- `operates-on`
|
|
40
|
+
- `uses`
|
|
41
|
+
|
|
42
|
+
Feature nodes come from the flat `OrganizationModel.features` array. Their graph IDs use `feature:<id>`, such as `feature:sales.crm`.
|
|
43
|
+
|
|
44
|
+
Resource edges come from resource metadata:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
links: [
|
|
48
|
+
{ nodeId: 'feature:sales.lead-gen', kind: 'operates-on' },
|
|
49
|
+
{ nodeId: 'integration:instantly', kind: 'uses' }
|
|
50
|
+
]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Build Pipeline
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
interface BuildOrganizationGraphInput {
|
|
57
|
+
organizationModel: OrganizationModel
|
|
58
|
+
commandViewData?: CommandViewData
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`buildOrganizationGraph`:
|
|
63
|
+
|
|
64
|
+
1. Reads flat Organization Model features and derives `feature:*` nodes.
|
|
65
|
+
2. Reads entities, capabilities, integrations, and resources.
|
|
66
|
+
3. Emits authored graph links from resource/entity/capability metadata.
|
|
67
|
+
4. Bridges Command View runtime topology into resource nodes and relationship edges.
|
|
68
|
+
5. Returns a renderer-agnostic DTO.
|
|
69
|
+
|
|
70
|
+
## Lenses
|
|
71
|
+
|
|
72
|
+
UI lenses change presentation, not data:
|
|
73
|
+
|
|
74
|
+
- `default` -- broad map view.
|
|
75
|
+
- `command-view` -- operations-focused trace view.
|
|
76
|
+
|
|
77
|
+
## Package Boundary
|
|
78
|
+
|
|
79
|
+
- `@repo/core` owns graph DTOs, schemas, and build helpers.
|
|
80
|
+
- `@repo/ui` owns Cytoscape conversion, filtering, path tracing, panels, and presentation.
|
|
81
|
+
- `apps/command-center` owns route wiring.
|
|
82
|
+
|
|
83
|
+
## Verification
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pnpm --filter @repo/core test -- organization-model graph
|
|
87
|
+
pnpm --filter @repo/ui test -- organizationGraph
|
|
88
|
+
pnpm --filter command-center build
|
|
89
|
+
```
|