@elevasis/core 0.36.0 → 0.38.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/auth/index.d.ts +84 -1
- package/dist/index.d.ts +359 -5
- package/dist/index.js +41 -8
- package/dist/knowledge/index.d.ts +86 -1
- package/dist/organization-model/index.d.ts +359 -5
- package/dist/organization-model/index.js +41 -8
- package/dist/test-utils/index.d.ts +84 -1
- package/dist/test-utils/index.js +38 -6
- package/package.json +1 -1
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +423 -338
- package/src/_gen/__tests__/__snapshots__/system-interface-capabilities.md.snap +47 -0
- package/src/_gen/__tests__/scaffold-contracts.test.ts +47 -8
- package/src/business/acquisition/api-schemas.test.ts +13 -1
- package/src/business/acquisition/ontology-validation.ts +13 -22
- package/src/organization-model/__tests__/domains/navigation-topbar.test.ts +282 -0
- package/src/organization-model/__tests__/domains/systems.test.ts +34 -1
- package/src/organization-model/__tests__/schema.test.ts +47 -0
- package/src/organization-model/defaults.ts +2 -1
- package/src/organization-model/domains/navigation.ts +176 -139
- package/src/organization-model/domains/systems.ts +22 -9
- package/src/organization-model/icons.ts +1 -0
- package/src/organization-model/published.ts +8 -6
- package/src/organization-model/types.ts +5 -1
- package/src/platform/constants/versions.ts +1 -1
- package/src/platform/registry/__tests__/validation.test.ts +1404 -1318
- package/src/platform/registry/index.ts +90 -88
- package/src/platform/registry/types.ts +443 -425
- package/src/platform/registry/validation.ts +60 -1
- package/src/reference/_generated/contracts.md +423 -338
- package/src/reference/_generated/system-interface-capabilities.md +47 -0
- package/src/reference/glossary.md +14 -2
|
@@ -1,139 +1,176 @@
|
|
|
1
|
-
import { z, type ZodType } from 'zod'
|
|
2
|
-
import { DescriptionSchema, IconNameSchema, LabelSchema, ModelIdSchema, PathSchema } from './shared'
|
|
3
|
-
|
|
4
|
-
export const SurfaceTypeSchema = z
|
|
5
|
-
.enum(['page', 'dashboard', 'graph', 'detail', 'list', 'settings'])
|
|
6
|
-
.meta({ label: 'Surface type', color: 'blue' })
|
|
7
|
-
|
|
8
|
-
export const SurfaceDefinitionSchema = z.object({
|
|
9
|
-
id: ModelIdSchema,
|
|
10
|
-
label: LabelSchema,
|
|
11
|
-
path: PathSchema,
|
|
12
|
-
surfaceType: SurfaceTypeSchema,
|
|
13
|
-
description: DescriptionSchema.optional(),
|
|
14
|
-
enabled: z.boolean().default(true),
|
|
15
|
-
devOnly: z.boolean().optional(),
|
|
16
|
-
icon: IconNameSchema.optional(),
|
|
17
|
-
systemIds: z.array(ModelIdSchema.meta({ ref: 'system' })).default([]),
|
|
18
|
-
entityIds: z.array(ModelIdSchema.meta({ ref: 'entity' })).default([]),
|
|
19
|
-
resourceIds: z.array(ModelIdSchema.meta({ ref: 'resource' })).default([]),
|
|
20
|
-
actionIds: z.array(ModelIdSchema.meta({ ref: 'action' })).default([]),
|
|
21
|
-
parentId: ModelIdSchema.meta({ ref: 'surface' }).optional()
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
export const SidebarSurfaceTargetsSchema = z
|
|
25
|
-
.object({
|
|
26
|
-
systems: z
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
export
|
|
130
|
-
|
|
131
|
-
export const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
1
|
+
import { z, type ZodType } from 'zod'
|
|
2
|
+
import { DescriptionSchema, IconNameSchema, LabelSchema, ModelIdSchema, PathSchema } from './shared'
|
|
3
|
+
|
|
4
|
+
export const SurfaceTypeSchema = z
|
|
5
|
+
.enum(['page', 'dashboard', 'graph', 'detail', 'list', 'settings'])
|
|
6
|
+
.meta({ label: 'Surface type', color: 'blue' })
|
|
7
|
+
|
|
8
|
+
export const SurfaceDefinitionSchema = z.object({
|
|
9
|
+
id: ModelIdSchema,
|
|
10
|
+
label: LabelSchema,
|
|
11
|
+
path: PathSchema,
|
|
12
|
+
surfaceType: SurfaceTypeSchema,
|
|
13
|
+
description: DescriptionSchema.optional(),
|
|
14
|
+
enabled: z.boolean().default(true),
|
|
15
|
+
devOnly: z.boolean().optional(),
|
|
16
|
+
icon: IconNameSchema.optional(),
|
|
17
|
+
systemIds: z.array(ModelIdSchema.meta({ ref: 'system' })).default([]),
|
|
18
|
+
entityIds: z.array(ModelIdSchema.meta({ ref: 'entity' })).default([]),
|
|
19
|
+
resourceIds: z.array(ModelIdSchema.meta({ ref: 'resource' })).default([]),
|
|
20
|
+
actionIds: z.array(ModelIdSchema.meta({ ref: 'action' })).default([]),
|
|
21
|
+
parentId: ModelIdSchema.meta({ ref: 'surface' }).optional()
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export const SidebarSurfaceTargetsSchema = z
|
|
25
|
+
.object({
|
|
26
|
+
systems: z
|
|
27
|
+
.array(ModelIdSchema.meta({ ref: 'system' }))
|
|
28
|
+
.default([])
|
|
29
|
+
.optional(),
|
|
30
|
+
entities: z
|
|
31
|
+
.array(ModelIdSchema.meta({ ref: 'entity' }))
|
|
32
|
+
.default([])
|
|
33
|
+
.optional(),
|
|
34
|
+
resources: z
|
|
35
|
+
.array(ModelIdSchema.meta({ ref: 'resource' }))
|
|
36
|
+
.default([])
|
|
37
|
+
.optional(),
|
|
38
|
+
actions: z
|
|
39
|
+
.array(ModelIdSchema.meta({ ref: 'action' }))
|
|
40
|
+
.default([])
|
|
41
|
+
.optional()
|
|
42
|
+
})
|
|
43
|
+
.default({})
|
|
44
|
+
|
|
45
|
+
export interface SidebarSurfaceNode {
|
|
46
|
+
type: 'surface'
|
|
47
|
+
label: string
|
|
48
|
+
path: string
|
|
49
|
+
surfaceType: z.infer<typeof SurfaceTypeSchema>
|
|
50
|
+
description?: string
|
|
51
|
+
icon?: string
|
|
52
|
+
order?: number
|
|
53
|
+
targets?: {
|
|
54
|
+
systems?: string[]
|
|
55
|
+
entities?: string[]
|
|
56
|
+
resources?: string[]
|
|
57
|
+
actions?: string[]
|
|
58
|
+
}
|
|
59
|
+
devOnly?: boolean
|
|
60
|
+
requiresAdmin?: boolean
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface SidebarGroupNode {
|
|
64
|
+
type: 'group'
|
|
65
|
+
label: string
|
|
66
|
+
description?: string
|
|
67
|
+
icon?: string
|
|
68
|
+
order?: number
|
|
69
|
+
children: Record<string, SidebarNode>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type SidebarNode = SidebarSurfaceNode | SidebarGroupNode
|
|
73
|
+
|
|
74
|
+
export const SidebarNodeSchema: ZodType<SidebarNode> = z.lazy(() =>
|
|
75
|
+
z.discriminatedUnion('type', [
|
|
76
|
+
z.object({
|
|
77
|
+
type: z.literal('group'),
|
|
78
|
+
label: LabelSchema,
|
|
79
|
+
description: DescriptionSchema.optional(),
|
|
80
|
+
icon: IconNameSchema.optional(),
|
|
81
|
+
order: z.number().int().optional(),
|
|
82
|
+
children: z.record(z.string(), SidebarNodeSchema).default({})
|
|
83
|
+
}),
|
|
84
|
+
z.object({
|
|
85
|
+
type: z.literal('surface'),
|
|
86
|
+
label: LabelSchema,
|
|
87
|
+
path: PathSchema,
|
|
88
|
+
surfaceType: SurfaceTypeSchema,
|
|
89
|
+
description: DescriptionSchema.optional(),
|
|
90
|
+
icon: IconNameSchema.optional(),
|
|
91
|
+
order: z.number().int().optional(),
|
|
92
|
+
targets: SidebarSurfaceTargetsSchema.optional(),
|
|
93
|
+
devOnly: z.boolean().optional(),
|
|
94
|
+
requiresAdmin: z.boolean().optional()
|
|
95
|
+
})
|
|
96
|
+
])
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
export const SidebarSectionSchema = z.record(z.string(), SidebarNodeSchema).default({})
|
|
100
|
+
|
|
101
|
+
export const SidebarNavigationSchema = z
|
|
102
|
+
.object({
|
|
103
|
+
primary: SidebarSectionSchema,
|
|
104
|
+
bottom: SidebarSectionSchema
|
|
105
|
+
})
|
|
106
|
+
.default({ primary: {}, bottom: {} })
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* A leaf node in `navigation.topbar`. Has no `path`, `surfaceType`, or nesting —
|
|
110
|
+
* topbar actions trigger behavior (open a modal, open docs, etc.) rather than navigate to a route.
|
|
111
|
+
* Behavior is bound by a UI registry (`TopbarActionModule`) that matches on `id`.
|
|
112
|
+
*/
|
|
113
|
+
export const TopbarActionNodeSchema = z.object({
|
|
114
|
+
id: ModelIdSchema,
|
|
115
|
+
label: LabelSchema,
|
|
116
|
+
tooltip: DescriptionSchema.optional(),
|
|
117
|
+
icon: IconNameSchema.optional(),
|
|
118
|
+
order: z.number().int().optional(),
|
|
119
|
+
enabled: z.boolean().default(true),
|
|
120
|
+
devOnly: z.boolean().optional(),
|
|
121
|
+
requiresAdmin: z.boolean().optional(),
|
|
122
|
+
targets: SidebarSurfaceTargetsSchema.optional()
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* A flat map of topbar action nodes, keyed by action id.
|
|
127
|
+
* Defaults to an empty record (no topbar actions declared).
|
|
128
|
+
*/
|
|
129
|
+
export const TopbarSectionSchema = z.record(z.string(), TopbarActionNodeSchema).default({})
|
|
130
|
+
|
|
131
|
+
export const OrganizationModelNavigationSchema = z
|
|
132
|
+
.object({
|
|
133
|
+
sidebar: SidebarNavigationSchema,
|
|
134
|
+
topbar: TopbarSectionSchema
|
|
135
|
+
})
|
|
136
|
+
.default({ sidebar: { primary: {}, bottom: {} }, topbar: {} })
|
|
137
|
+
|
|
138
|
+
export const DEFAULT_ORGANIZATION_MODEL_NAVIGATION: z.infer<typeof OrganizationModelNavigationSchema> = {
|
|
139
|
+
sidebar: {
|
|
140
|
+
primary: {},
|
|
141
|
+
bottom: {}
|
|
142
|
+
},
|
|
143
|
+
topbar: {}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function getSortedSidebarEntries<TNode extends SidebarNode>(
|
|
147
|
+
nodes: Record<string, TNode>
|
|
148
|
+
): Array<[string, TNode]> {
|
|
149
|
+
return Object.entries(nodes).sort(([leftId, left], [rightId, right]) => {
|
|
150
|
+
const orderDelta = (left.order ?? Number.MAX_SAFE_INTEGER) - (right.order ?? Number.MAX_SAFE_INTEGER)
|
|
151
|
+
return orderDelta === 0 ? leftId.localeCompare(rightId) : orderDelta
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Core placement values: 'primary' | 'secondary' | 'bottom'.
|
|
157
|
+
*
|
|
158
|
+
* `placement` is intentionally open (`z.string()`) so that per-project adapters can
|
|
159
|
+
* introduce additional placement IDs (e.g. 'pinned', 'spotlight', 'contextual') without
|
|
160
|
+
* forking core. Extension pattern: add the new string literal to the project's
|
|
161
|
+
* `foundations/config/organization-model.ts` adapter — no changes to this file required.
|
|
162
|
+
*
|
|
163
|
+
* `surfaceType` and `resourceType` remain closed enums (UI/runtime invariants).
|
|
164
|
+
*/
|
|
165
|
+
export const CORE_PLACEMENT_VALUES = ['primary', 'secondary', 'bottom'] as const
|
|
166
|
+
export type CorePlacement = (typeof CORE_PLACEMENT_VALUES)[number]
|
|
167
|
+
|
|
168
|
+
export const NavigationGroupSchema = z.object({
|
|
169
|
+
id: ModelIdSchema,
|
|
170
|
+
label: LabelSchema,
|
|
171
|
+
placement: z.string().trim().min(1).max(50),
|
|
172
|
+
surfaceIds: z.array(ModelIdSchema.meta({ ref: 'surface' })).default([])
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
// SurfaceDefinitionSchema and NavigationGroupSchema remain for derived DTOs and
|
|
176
|
+
// transitional call sites. They are not authored top-level OrganizationModel fields.
|
|
@@ -65,15 +65,28 @@ export const SystemInterfaceKeySchema = ModelIdSchema
|
|
|
65
65
|
export const SystemInterfaceLifecycleSchema = z
|
|
66
66
|
.enum(['draft', 'active', 'disabled', 'deprecated', 'archived'])
|
|
67
67
|
.meta({ label: 'System interface lifecycle', color: 'teal' })
|
|
68
|
-
export const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
'
|
|
76
|
-
|
|
68
|
+
export const SYSTEM_INTERFACE_PROFILES = [
|
|
69
|
+
{
|
|
70
|
+
systemPath: 'sales.lead-gen',
|
|
71
|
+
interfaceKey: 'api',
|
|
72
|
+
readinessProfile: 'sales.lead-gen.api'
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
systemPath: 'sales.crm',
|
|
76
|
+
interfaceKey: 'api',
|
|
77
|
+
readinessProfile: 'sales.crm.api'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
systemPath: 'sales.lead-gen',
|
|
81
|
+
interfaceKey: 'crm-handoff',
|
|
82
|
+
readinessProfile: 'sales.lead-gen.crm-handoff'
|
|
83
|
+
}
|
|
84
|
+
] as const
|
|
85
|
+
type SystemInterfaceReadinessProfileValue = (typeof SYSTEM_INTERFACE_PROFILES)[number]['readinessProfile']
|
|
86
|
+
export const SYSTEM_INTERFACE_READINESS_PROFILES = SYSTEM_INTERFACE_PROFILES.map(
|
|
87
|
+
(profile) => profile.readinessProfile
|
|
88
|
+
) as [SystemInterfaceReadinessProfileValue, ...SystemInterfaceReadinessProfileValue[]]
|
|
89
|
+
export const SystemInterfaceReadinessProfileSchema = z.enum(SYSTEM_INTERFACE_READINESS_PROFILES)
|
|
77
90
|
export const SystemInterfaceResourceScopeSchema = z
|
|
78
91
|
.array(ModelIdSchema)
|
|
79
92
|
.default([])
|
|
@@ -29,11 +29,7 @@ export {
|
|
|
29
29
|
OrganizationModelDomainMetadataSchema,
|
|
30
30
|
OrganizationModelSchema
|
|
31
31
|
} from './schema'
|
|
32
|
-
export {
|
|
33
|
-
NodeIdPathSchema,
|
|
34
|
-
NodeIdStringSchema,
|
|
35
|
-
UiPositionSchema
|
|
36
|
-
} from './domains/systems'
|
|
32
|
+
export { NodeIdPathSchema, NodeIdStringSchema, UiPositionSchema } from './domains/systems'
|
|
37
33
|
export { LinkSchema } from './graph/link'
|
|
38
34
|
export { IconNameSchema, TechStackEntrySchema } from './domains/shared'
|
|
39
35
|
export {
|
|
@@ -113,6 +109,8 @@ export {
|
|
|
113
109
|
} from './domains/goals'
|
|
114
110
|
export {
|
|
115
111
|
DEFAULT_ORGANIZATION_MODEL_SYSTEMS,
|
|
112
|
+
SYSTEM_INTERFACE_PROFILES,
|
|
113
|
+
SYSTEM_INTERFACE_READINESS_PROFILES,
|
|
116
114
|
defineSystem,
|
|
117
115
|
defineSystems,
|
|
118
116
|
SystemEntrySchema,
|
|
@@ -221,7 +219,9 @@ export {
|
|
|
221
219
|
SidebarSectionSchema,
|
|
222
220
|
SidebarSurfaceTargetsSchema,
|
|
223
221
|
SurfaceDefinitionSchema,
|
|
224
|
-
SurfaceTypeSchema
|
|
222
|
+
SurfaceTypeSchema,
|
|
223
|
+
TopbarActionNodeSchema,
|
|
224
|
+
TopbarSectionSchema
|
|
225
225
|
} from './domains/navigation'
|
|
226
226
|
export {
|
|
227
227
|
defineKnowledgeNode,
|
|
@@ -299,6 +299,8 @@ export type {
|
|
|
299
299
|
OrganizationModelSidebarSection,
|
|
300
300
|
OrganizationModelSidebarSurfaceNode,
|
|
301
301
|
OrganizationModelSidebarSurfaceTargets,
|
|
302
|
+
OrganizationModelTopbarActionNode,
|
|
303
|
+
OrganizationModelTopbarSection,
|
|
302
304
|
OrganizationModelKeyResult,
|
|
303
305
|
OrganizationModelObjective,
|
|
304
306
|
OrganizationModelSystemEntry,
|
|
@@ -11,7 +11,9 @@ import {
|
|
|
11
11
|
SidebarNodeSchema,
|
|
12
12
|
SidebarSectionSchema,
|
|
13
13
|
SidebarSurfaceTargetsSchema,
|
|
14
|
-
SurfaceDefinitionSchema
|
|
14
|
+
SurfaceDefinitionSchema,
|
|
15
|
+
TopbarActionNodeSchema,
|
|
16
|
+
TopbarSectionSchema
|
|
15
17
|
} from './domains/navigation'
|
|
16
18
|
import { TechStackEntrySchema } from './domains/shared'
|
|
17
19
|
import { StatusesDomainSchema, StatusEntrySchema, StatusSemanticClassSchema } from './domains/statuses'
|
|
@@ -135,6 +137,8 @@ export type OrganizationModelSidebarNode = z.infer<typeof SidebarNodeSchema>
|
|
|
135
137
|
export type OrganizationModelSidebarSurfaceTargets = z.infer<typeof SidebarSurfaceTargetsSchema>
|
|
136
138
|
export type OrganizationModelSidebarSurfaceNode = Extract<OrganizationModelSidebarNode, { type: 'surface' }>
|
|
137
139
|
export type OrganizationModelSidebarGroupNode = Extract<OrganizationModelSidebarNode, { type: 'group' }>
|
|
140
|
+
export type OrganizationModelTopbarActionNode = z.infer<typeof TopbarActionNodeSchema>
|
|
141
|
+
export type OrganizationModelTopbarSection = z.infer<typeof TopbarSectionSchema>
|
|
138
142
|
export type OrganizationModelTechStackEntry = z.infer<typeof TechStackEntrySchema>
|
|
139
143
|
export type OrganizationModelStatuses = z.infer<typeof StatusesDomainSchema>
|
|
140
144
|
export type OrganizationModelStatusEntry = z.infer<typeof StatusEntrySchema>
|