@elevasis/core 0.25.0 → 0.27.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 +171 -90
- package/dist/index.js +377 -1541
- package/dist/knowledge/index.d.ts +48 -59
- package/dist/knowledge/index.js +1 -1
- package/dist/organization-model/index.d.ts +171 -90
- package/dist/organization-model/index.js +377 -1541
- package/dist/test-utils/index.d.ts +25 -33
- package/dist/test-utils/index.js +250 -1357
- package/package.json +1 -1
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +990 -1065
- package/src/business/acquisition/api-schemas.test.ts +1996 -1882
- package/src/business/acquisition/api-schemas.ts +1478 -1502
- package/src/business/acquisition/crm-next-action.test.ts +45 -25
- package/src/business/acquisition/crm-next-action.ts +227 -220
- package/src/business/acquisition/crm-priority.test.ts +41 -8
- package/src/business/acquisition/crm-priority.ts +365 -349
- package/src/business/acquisition/crm-state-actions.test.ts +208 -153
- package/src/business/acquisition/derive-actions.test.ts +101 -34
- package/src/business/acquisition/derive-actions.ts +8 -92
- package/src/business/acquisition/ontology-validation.ts +76 -162
- package/src/business/acquisition/types.ts +7 -8
- package/src/business/pdf/sections/investment.ts +1 -1
- package/src/business/pdf/sections/summary-investment.ts +1 -1
- package/src/execution/engine/tools/tool-maps.ts +872 -831
- package/src/knowledge/queries.ts +0 -1
- package/src/organization-model/__tests__/content-kinds-registry.test.ts +35 -210
- package/src/organization-model/__tests__/cross-ref.test.ts +167 -0
- package/src/organization-model/__tests__/defaults.test.ts +4 -4
- package/src/organization-model/__tests__/domains/actions.test.ts +12 -36
- package/src/organization-model/__tests__/domains/offerings.test.ts +13 -6
- package/src/organization-model/__tests__/domains/resources.test.ts +497 -350
- package/src/organization-model/__tests__/domains/systems.test.ts +6 -7
- package/src/organization-model/__tests__/flatten-additive-merge.test.ts +68 -80
- package/src/organization-model/__tests__/foundation.test.ts +81 -14
- package/src/organization-model/__tests__/graph.test.ts +662 -694
- package/src/organization-model/__tests__/knowledge.test.ts +31 -17
- package/src/organization-model/__tests__/lookup-helpers.test.ts +128 -438
- package/src/organization-model/__tests__/migration-helpers.test.ts +362 -591
- package/src/organization-model/__tests__/prospecting-ssot.test.ts +68 -103
- package/src/organization-model/__tests__/published-zero-leak.test.ts +76 -0
- package/src/organization-model/__tests__/recursive-system-schema.test.ts +159 -532
- package/src/organization-model/__tests__/resolve.test.ts +79 -42
- package/src/organization-model/__tests__/schema-refinements.test.ts +72 -0
- package/src/organization-model/__tests__/schema.test.ts +65 -56
- package/src/organization-model/catalogs/lead-gen.ts +0 -103
- package/src/organization-model/cross-ref.ts +175 -0
- package/src/organization-model/defaults.ts +17 -702
- package/src/organization-model/domains/actions.ts +116 -333
- package/src/organization-model/domains/branding.ts +6 -6
- package/src/organization-model/domains/knowledge.ts +15 -7
- package/src/organization-model/domains/projects.ts +4 -4
- package/src/organization-model/domains/prospecting.ts +405 -395
- package/src/organization-model/domains/resources.ts +206 -135
- package/src/organization-model/domains/sales.test.ts +104 -218
- package/src/organization-model/domains/sales.ts +217 -380
- package/src/organization-model/domains/systems.ts +8 -23
- package/src/organization-model/graph/build.ts +223 -294
- package/src/organization-model/graph/schema.ts +2 -3
- package/src/organization-model/graph/types.ts +12 -14
- package/src/organization-model/helpers.ts +130 -218
- package/src/organization-model/index.ts +105 -124
- package/src/organization-model/migration-helpers.ts +211 -249
- package/src/organization-model/ontology.ts +0 -60
- package/src/organization-model/organization-graph.mdx +4 -5
- package/src/organization-model/organization-model.mdx +1 -1
- package/src/organization-model/published.ts +236 -226
- package/src/organization-model/resolve.ts +4 -5
- package/src/organization-model/schema-refinements.ts +667 -0
- package/src/organization-model/schema.ts +88 -889
- package/src/organization-model/types.ts +167 -161
- package/src/platform/registry/__tests__/validation.test.ts +23 -0
- package/src/platform/registry/validation.ts +13 -2
- package/src/reference/_generated/contracts.md +990 -1065
- package/src/organization-model/content-kinds/config.ts +0 -36
- package/src/organization-model/content-kinds/index.ts +0 -78
- package/src/organization-model/content-kinds/pipeline.ts +0 -68
- package/src/organization-model/content-kinds/registry.ts +0 -44
- package/src/organization-model/content-kinds/status.ts +0 -71
- package/src/organization-model/content-kinds/template.ts +0 -83
- package/src/organization-model/content-kinds/types.ts +0 -117
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
import type { OrganizationModel, OrganizationModelSystemEntry } from './types'
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// W1A has landed: ContentNode and SystemEntry (with content + subsystems) are now
|
|
8
|
-
// defined in their canonical locations.
|
|
1
|
+
import type { OrganizationModel, OrganizationModelSystemEntry } from './types'
|
|
2
|
+
import type { JsonValue } from './domains/systems'
|
|
3
|
+
import type { ResourceEntry } from './domains/resources'
|
|
4
|
+
import type { OmTopologyRelationship } from './domains/topology'
|
|
5
|
+
|
|
9
6
|
// Phase 4: removed locally-scoped inferred types for deleted compound-domain schemas
|
|
10
7
|
// (SalesPipeline, ProspectingBuildTemplate, etc.). migration-helpers.ts imports them directly.
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
|
-
* SystemEntry extended with the recursive tree slots (`
|
|
10
|
+
* SystemEntry extended with the recursive tree slots (`systems`, `subsystems`).
|
|
14
11
|
* `OrganizationModelSystemEntry` is inferred from `SystemEntrySchema: ZodType<SystemEntry>`
|
|
15
12
|
* so it already carries these fields; this alias re-exports it under the tree-walker name
|
|
16
13
|
* for clarity at call sites.
|
|
17
14
|
*/
|
|
18
|
-
export type
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
15
|
+
export type SystemEntryWithTree = OrganizationModelSystemEntry
|
|
16
|
+
|
|
17
|
+
function childSystemsOf(system: SystemEntryWithTree): Record<string, SystemEntryWithTree> {
|
|
18
|
+
return system.systems ?? system.subsystems ?? {}
|
|
19
|
+
}
|
|
24
20
|
|
|
25
21
|
export function defaultPathFor(id: string): string {
|
|
26
22
|
return `/${id.replaceAll('.', '/')}`
|
|
@@ -131,11 +127,11 @@ export function getSystem(model: OrganizationModel, path: string): SystemEntryWi
|
|
|
131
127
|
// to SystemEntryWithTree (which extends it with optional content + subsystems).
|
|
132
128
|
let current: Record<string, SystemEntryWithTree> = model.systems as Record<string, SystemEntryWithTree>
|
|
133
129
|
let node: SystemEntryWithTree | undefined
|
|
134
|
-
for (const seg of segments) {
|
|
135
|
-
node = current[seg]
|
|
136
|
-
if (node === undefined) return undefined
|
|
137
|
-
current = childSystemsOf(node)
|
|
138
|
-
}
|
|
130
|
+
for (const seg of segments) {
|
|
131
|
+
node = current[seg]
|
|
132
|
+
if (node === undefined) return undefined
|
|
133
|
+
current = childSystemsOf(node)
|
|
134
|
+
}
|
|
139
135
|
return node
|
|
140
136
|
}
|
|
141
137
|
|
|
@@ -152,11 +148,11 @@ export function getSystemAncestors(model: OrganizationModel, path: string): Syst
|
|
|
152
148
|
const result: SystemEntryWithTree[] = []
|
|
153
149
|
let current: Record<string, SystemEntryWithTree> = model.systems as Record<string, SystemEntryWithTree>
|
|
154
150
|
for (const seg of segments) {
|
|
155
|
-
const node = current[seg]
|
|
156
|
-
if (node === undefined) return []
|
|
157
|
-
result.push(node)
|
|
158
|
-
current = childSystemsOf(node)
|
|
159
|
-
}
|
|
151
|
+
const node = current[seg]
|
|
152
|
+
if (node === undefined) return []
|
|
153
|
+
result.push(node)
|
|
154
|
+
current = childSystemsOf(node)
|
|
155
|
+
}
|
|
160
156
|
return result
|
|
161
157
|
}
|
|
162
158
|
|
|
@@ -172,133 +168,49 @@ export function listAllSystems(model: OrganizationModel): Array<{ path: string;
|
|
|
172
168
|
|
|
173
169
|
function walk(map: Record<string, SystemEntryWithTree>, prefix: string): void {
|
|
174
170
|
for (const [localId, system] of Object.entries(map)) {
|
|
175
|
-
const fullPath = prefix ? `${prefix}.${localId}` : localId
|
|
176
|
-
results.push({ path: fullPath, system })
|
|
177
|
-
const childSystems = childSystemsOf(system)
|
|
178
|
-
if (Object.keys(childSystems).length > 0) {
|
|
179
|
-
walk(childSystems, fullPath)
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
171
|
+
const fullPath = prefix ? `${prefix}.${localId}` : localId
|
|
172
|
+
results.push({ path: fullPath, system })
|
|
173
|
+
const childSystems = childSystemsOf(system)
|
|
174
|
+
if (Object.keys(childSystems).length > 0) {
|
|
175
|
+
walk(childSystems, fullPath)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
183
179
|
|
|
184
180
|
walk(model.systems as Record<string, SystemEntryWithTree>, '')
|
|
185
181
|
return results
|
|
186
182
|
}
|
|
187
183
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
* `getContent(model, 'sales.crm:default-pipeline')` resolves the `sales.crm`
|
|
192
|
-
* system and then looks up `system.content['default-pipeline']`.
|
|
193
|
-
*
|
|
194
|
-
* Returns `undefined` if the system or local id is not found, or if the
|
|
195
|
-
* qualified id does not contain exactly one `:` separator.
|
|
196
|
-
*/
|
|
197
|
-
export function getContent(model: OrganizationModel, qualifiedId: string): ContentNode | undefined {
|
|
198
|
-
const colonIndex = qualifiedId.indexOf(':')
|
|
199
|
-
if (colonIndex === -1) return undefined
|
|
200
|
-
const systemPath = qualifiedId.slice(0, colonIndex)
|
|
201
|
-
const localId = qualifiedId.slice(colonIndex + 1)
|
|
202
|
-
if (!systemPath || !localId) return undefined
|
|
203
|
-
const system = getSystem(model, systemPath)
|
|
204
|
-
return system?.content?.[localId]
|
|
184
|
+
|
|
185
|
+
function isPlainJsonObject(value: JsonValue | undefined): value is Record<string, JsonValue> {
|
|
186
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
205
187
|
}
|
|
206
188
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
* for `'x'` appears in `inherited`.
|
|
218
|
-
*
|
|
219
|
-
* `resolveSystemContent(model, 'sales.crm')` with both `sales.content['x']`
|
|
220
|
-
* and `sales.crm.content['x']` defined → `own` contains `'x'`, `inherited`
|
|
221
|
-
* contains NO entry for `'x'` from `sales`.
|
|
222
|
-
*/
|
|
223
|
-
export function resolveSystemContent(
|
|
224
|
-
model: OrganizationModel,
|
|
225
|
-
path: string
|
|
226
|
-
): { own: Record<string, ContentNode>; inherited: Array<{ fromPath: string; node: ContentNode; localId: string }> } {
|
|
227
|
-
const ancestors = getSystemAncestors(model, path)
|
|
228
|
-
if (ancestors.length === 0) return { own: {}, inherited: [] }
|
|
229
|
-
|
|
230
|
-
const system = ancestors[ancestors.length - 1]
|
|
231
|
-
const own: Record<string, ContentNode> = { ...(system.content ?? {}) }
|
|
232
|
-
|
|
233
|
-
// Collect ancestor entries depth-first (deepest ancestor first, excluding self).
|
|
234
|
-
// We reconstruct paths for each ancestor by slicing the path segments.
|
|
235
|
-
const segments = path.split('.')
|
|
236
|
-
const shadowedIds = new Set(Object.keys(own))
|
|
237
|
-
const inherited: Array<{ fromPath: string; node: ContentNode; localId: string }> = []
|
|
238
|
-
|
|
239
|
-
// Iterate ancestors from deepest-parent to root so deeper wins.
|
|
240
|
-
for (let i = ancestors.length - 2; i >= 0; i--) {
|
|
241
|
-
const ancestor = ancestors[i]
|
|
242
|
-
const ancestorPath = segments.slice(0, i + 1).join('.')
|
|
243
|
-
const contentMap = ancestor.content ?? {}
|
|
244
|
-
for (const [localId, node] of Object.entries(contentMap)) {
|
|
245
|
-
if (!shadowedIds.has(localId)) {
|
|
246
|
-
shadowedIds.add(localId)
|
|
247
|
-
inherited.push({ fromPath: ancestorPath, node, localId })
|
|
248
|
-
}
|
|
249
|
-
}
|
|
189
|
+
function mergeJsonConfig(
|
|
190
|
+
base: Record<string, JsonValue>,
|
|
191
|
+
override: Record<string, JsonValue>
|
|
192
|
+
): Record<string, JsonValue> {
|
|
193
|
+
const result: Record<string, JsonValue> = { ...base }
|
|
194
|
+
|
|
195
|
+
for (const [key, value] of Object.entries(override)) {
|
|
196
|
+
const existing = result[key]
|
|
197
|
+
result[key] =
|
|
198
|
+
isPlainJsonObject(existing) && isPlainJsonObject(value) ? mergeJsonConfig(existing, value) : value
|
|
250
199
|
}
|
|
251
200
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
): Record<string, JsonValue> {
|
|
266
|
-
const result: Record<string, JsonValue> = { ...base }
|
|
267
|
-
|
|
268
|
-
for (const [key, value] of Object.entries(override)) {
|
|
269
|
-
const existing = result[key]
|
|
270
|
-
result[key] =
|
|
271
|
-
isPlainJsonObject(existing) && isPlainJsonObject(value) ? mergeJsonConfig(existing, value) : value
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return result
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Resolve a system's effective local config.
|
|
279
|
-
*
|
|
280
|
-
* Bridge-era `content` entries with `(kind, type) === ('config', 'kv')` are
|
|
281
|
-
* projected first, then first-class `system.config` overlays them. This keeps
|
|
282
|
-
* direct config authoring authoritative while continuing to read old content.
|
|
283
|
-
*/
|
|
284
|
-
export function resolveSystemConfig(model: OrganizationModel, path: string): Record<string, JsonValue> {
|
|
285
|
-
const system = getSystem(model, path)
|
|
286
|
-
if (system === undefined) return {}
|
|
287
|
-
|
|
288
|
-
let resolved: Record<string, JsonValue> = {}
|
|
289
|
-
for (const node of Object.values(system.content ?? {})) {
|
|
290
|
-
if (node.kind !== 'config' || node.type !== 'kv') continue
|
|
291
|
-
const entries = node.data?.entries
|
|
292
|
-
if (isPlainJsonObject(entries as JsonValue)) {
|
|
293
|
-
resolved = mergeJsonConfig(resolved, entries as Record<string, JsonValue>)
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return mergeJsonConfig(resolved, system.config ?? {})
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Return all resources whose `systemPath` belongs to the given system.
|
|
201
|
+
return result
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Resolve a system's effective local config from first-class `System.config`. */
|
|
205
|
+
export function resolveSystemConfig(model: OrganizationModel, path: string): Record<string, JsonValue> {
|
|
206
|
+
const system = getSystem(model, path)
|
|
207
|
+
if (system === undefined) return {}
|
|
208
|
+
|
|
209
|
+
return mergeJsonConfig({}, system.config ?? {})
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Return all resources whose `systemPath` belongs to the given system.
|
|
302
214
|
*
|
|
303
215
|
* When `includeDescendants` is false (default), only resources whose
|
|
304
216
|
* `systemPath` exactly matches `systemPath` are returned.
|
|
@@ -315,80 +227,80 @@ export function resolveSystemConfig(model: OrganizationModel, path: string): Rec
|
|
|
315
227
|
* getResourcesForSystem(model, 'sales', { includeDescendants: true })
|
|
316
228
|
* // → resources where systemPath === 'sales' OR systemPath starts with 'sales.'
|
|
317
229
|
*/
|
|
318
|
-
export function getResourcesForSystem(
|
|
319
|
-
model: OrganizationModel,
|
|
320
|
-
systemPath: string,
|
|
321
|
-
options: { includeDescendants?: boolean } = {}
|
|
322
|
-
): ResourceEntry[] {
|
|
230
|
+
export function getResourcesForSystem(
|
|
231
|
+
model: OrganizationModel,
|
|
232
|
+
systemPath: string,
|
|
233
|
+
options: { includeDescendants?: boolean } = {}
|
|
234
|
+
): ResourceEntry[] {
|
|
323
235
|
const { includeDescendants = false } = options
|
|
324
236
|
const prefix = systemPath + '.'
|
|
325
|
-
return Object.values(model.resources ?? {}).filter(
|
|
326
|
-
(r) => r.systemPath === systemPath || (includeDescendants && r.systemPath.startsWith(prefix))
|
|
327
|
-
)
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
export interface SystemTopologyEdge {
|
|
331
|
-
id: string
|
|
332
|
-
relationship: OmTopologyRelationship
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
export interface SystemDeprecationDependents {
|
|
336
|
-
resources: ResourceEntry[]
|
|
337
|
-
topologyEdges: SystemTopologyEdge[]
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
function systemPathIsInScope(candidate: string, systemPath: string, includeDescendants: boolean): boolean {
|
|
341
|
-
return candidate === systemPath || (includeDescendants && candidate.startsWith(`${systemPath}.`))
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
function topologyRelationshipTouchesSystem(
|
|
345
|
-
relationship: OmTopologyRelationship,
|
|
346
|
-
systemPath: string,
|
|
347
|
-
resourceIds: Set<string>,
|
|
348
|
-
includeDescendants: boolean
|
|
349
|
-
): boolean {
|
|
350
|
-
if (
|
|
351
|
-
relationship.systemPath !== undefined &&
|
|
352
|
-
systemPathIsInScope(relationship.systemPath, systemPath, includeDescendants)
|
|
353
|
-
) {
|
|
354
|
-
return true
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
for (const ref of [relationship.from, relationship.to]) {
|
|
358
|
-
if (ref.kind === 'system' && systemPathIsInScope(ref.id, systemPath, includeDescendants)) return true
|
|
359
|
-
if (ref.kind === 'resource' && resourceIds.has(ref.id)) return true
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
return false
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
export function getTopologyEdgesForSystem(
|
|
366
|
-
model: OrganizationModel,
|
|
367
|
-
systemPath: string,
|
|
368
|
-
options: { includeDescendants?: boolean; resourceIds?: Iterable<string> } = {}
|
|
369
|
-
): SystemTopologyEdge[] {
|
|
370
|
-
const { includeDescendants = false } = options
|
|
371
|
-
const resourceIds = new Set(
|
|
372
|
-
options.resourceIds ?? getResourcesForSystem(model, systemPath, { includeDescendants }).map((r) => r.id)
|
|
373
|
-
)
|
|
374
|
-
|
|
375
|
-
return Object.entries(model.topology?.relationships ?? {})
|
|
376
|
-
.filter(([, relationship]) =>
|
|
377
|
-
topologyRelationshipTouchesSystem(relationship, systemPath, resourceIds, includeDescendants)
|
|
378
|
-
)
|
|
379
|
-
.map(([id, relationship]) => ({ id, relationship }))
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
export function getSystemDeprecationDependents(
|
|
383
|
-
model: OrganizationModel,
|
|
384
|
-
systemPath: string,
|
|
385
|
-
options: { includeDescendants?: boolean } = {}
|
|
386
|
-
): SystemDeprecationDependents {
|
|
387
|
-
const resources = getResourcesForSystem(model, systemPath, options).filter((resource) => resource.status === 'active')
|
|
388
|
-
const resourceIds = new Set(resources.map((resource) => resource.id))
|
|
389
|
-
|
|
390
|
-
return {
|
|
391
|
-
resources,
|
|
392
|
-
topologyEdges: getTopologyEdgesForSystem(model, systemPath, { ...options, resourceIds })
|
|
393
|
-
}
|
|
394
|
-
}
|
|
237
|
+
return Object.values(model.resources ?? {}).filter(
|
|
238
|
+
(r) => r.systemPath === systemPath || (includeDescendants && r.systemPath.startsWith(prefix))
|
|
239
|
+
)
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface SystemTopologyEdge {
|
|
243
|
+
id: string
|
|
244
|
+
relationship: OmTopologyRelationship
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface SystemDeprecationDependents {
|
|
248
|
+
resources: ResourceEntry[]
|
|
249
|
+
topologyEdges: SystemTopologyEdge[]
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function systemPathIsInScope(candidate: string, systemPath: string, includeDescendants: boolean): boolean {
|
|
253
|
+
return candidate === systemPath || (includeDescendants && candidate.startsWith(`${systemPath}.`))
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function topologyRelationshipTouchesSystem(
|
|
257
|
+
relationship: OmTopologyRelationship,
|
|
258
|
+
systemPath: string,
|
|
259
|
+
resourceIds: Set<string>,
|
|
260
|
+
includeDescendants: boolean
|
|
261
|
+
): boolean {
|
|
262
|
+
if (
|
|
263
|
+
relationship.systemPath !== undefined &&
|
|
264
|
+
systemPathIsInScope(relationship.systemPath, systemPath, includeDescendants)
|
|
265
|
+
) {
|
|
266
|
+
return true
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
for (const ref of [relationship.from, relationship.to]) {
|
|
270
|
+
if (ref.kind === 'system' && systemPathIsInScope(ref.id, systemPath, includeDescendants)) return true
|
|
271
|
+
if (ref.kind === 'resource' && resourceIds.has(ref.id)) return true
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return false
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export function getTopologyEdgesForSystem(
|
|
278
|
+
model: OrganizationModel,
|
|
279
|
+
systemPath: string,
|
|
280
|
+
options: { includeDescendants?: boolean; resourceIds?: Iterable<string> } = {}
|
|
281
|
+
): SystemTopologyEdge[] {
|
|
282
|
+
const { includeDescendants = false } = options
|
|
283
|
+
const resourceIds = new Set(
|
|
284
|
+
options.resourceIds ?? getResourcesForSystem(model, systemPath, { includeDescendants }).map((r) => r.id)
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
return Object.entries(model.topology?.relationships ?? {})
|
|
288
|
+
.filter(([, relationship]) =>
|
|
289
|
+
topologyRelationshipTouchesSystem(relationship, systemPath, resourceIds, includeDescendants)
|
|
290
|
+
)
|
|
291
|
+
.map(([id, relationship]) => ({ id, relationship }))
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function getSystemDeprecationDependents(
|
|
295
|
+
model: OrganizationModel,
|
|
296
|
+
systemPath: string,
|
|
297
|
+
options: { includeDescendants?: boolean } = {}
|
|
298
|
+
): SystemDeprecationDependents {
|
|
299
|
+
const resources = getResourcesForSystem(model, systemPath, options).filter((resource) => resource.status === 'active')
|
|
300
|
+
const resourceIds = new Set(resources.map((resource) => resource.id))
|
|
301
|
+
|
|
302
|
+
return {
|
|
303
|
+
resources,
|
|
304
|
+
topologyEdges: getTopologyEdgesForSystem(model, systemPath, { ...options, resourceIds })
|
|
305
|
+
}
|
|
306
|
+
}
|
|
@@ -1,135 +1,116 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './cross-ref'
|
|
2
2
|
export * from './schema'
|
|
3
3
|
export * from './types'
|
|
4
4
|
export * from './ontology'
|
|
5
5
|
export * from './contracts'
|
|
6
|
-
export {
|
|
7
|
-
ORGANIZATION_MODEL_ICON_TOKENS,
|
|
8
|
-
OrganizationModelBuiltinIconTokenSchema,
|
|
9
|
-
OrganizationModelIconTokenSchema
|
|
10
|
-
} from './icons'
|
|
11
|
-
export * from './defaults'
|
|
12
|
-
export * from './resolve'
|
|
13
|
-
export * from './foundation'
|
|
14
|
-
export * from './surface-projection'
|
|
15
|
-
export * from './helpers'
|
|
6
|
+
export {
|
|
7
|
+
ORGANIZATION_MODEL_ICON_TOKENS,
|
|
8
|
+
OrganizationModelBuiltinIconTokenSchema,
|
|
9
|
+
OrganizationModelIconTokenSchema
|
|
10
|
+
} from './icons'
|
|
11
|
+
export * from './defaults'
|
|
12
|
+
export * from './resolve'
|
|
13
|
+
export * from './foundation'
|
|
14
|
+
export * from './surface-projection'
|
|
15
|
+
export * from './helpers'
|
|
16
16
|
export * from './migration-helpers'
|
|
17
17
|
export * from './scaffolders'
|
|
18
18
|
export * from './graph'
|
|
19
|
-
export * from './catalogs/lead-gen'
|
|
20
|
-
export * from './domains/branding'
|
|
21
|
-
// Phase 4: OrganizationModelSalesSchema, OrganizationModelProspectingSchema,
|
|
22
|
-
// OrganizationModelProjectsSchema removed. Business-logic exports (StatefulPipelineDefinition,
|
|
23
|
-
//
|
|
24
|
-
export {
|
|
25
|
-
SalesStageSemanticClassSchema,
|
|
26
|
-
SalesStageSchema,
|
|
27
|
-
SalesPipelineSchema,
|
|
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
|
-
RecordColumnsConfigSchema,
|
|
61
|
-
CredentialRequirementSchema,
|
|
62
|
-
ProspectingBuildTemplateStepSchema,
|
|
63
|
-
ProspectingBuildTemplateSchema,
|
|
64
|
-
PROSPECTING_STEPS,
|
|
65
|
-
ACTION_REGISTRY,
|
|
66
|
-
findActionById
|
|
67
|
-
} from './domains/prospecting'
|
|
68
|
-
export type {
|
|
69
|
-
ListBuilderStep,
|
|
70
|
-
RecordColumnConfig,
|
|
71
|
-
CredentialRequirement,
|
|
72
|
-
TemplateName,
|
|
73
|
-
StepName,
|
|
74
|
-
ActionRegistry
|
|
75
|
-
} from './domains/prospecting'
|
|
76
|
-
export { ProjectsDomainStateSchema } from './domains/projects'
|
|
19
|
+
export * from './catalogs/lead-gen'
|
|
20
|
+
export * from './domains/branding'
|
|
21
|
+
// Phase 4: OrganizationModelSalesSchema, OrganizationModelProspectingSchema,
|
|
22
|
+
// OrganizationModelProjectsSchema removed. Business-logic exports (StatefulPipelineDefinition,
|
|
23
|
+
// ProspectingBuildTemplateSchema, StatefulPipelineDefinition, etc.) still re-exported below.
|
|
24
|
+
export {
|
|
25
|
+
SalesStageSemanticClassSchema,
|
|
26
|
+
SalesStageSchema,
|
|
27
|
+
SalesPipelineSchema,
|
|
28
|
+
findPipeline,
|
|
29
|
+
getValidStatesForStage
|
|
30
|
+
} from './domains/sales'
|
|
31
|
+
export type {
|
|
32
|
+
StatefulStateDefinition,
|
|
33
|
+
StatefulStageDefinition,
|
|
34
|
+
StatefulPipelineDefinition,
|
|
35
|
+
CrmPriorityBucketKey,
|
|
36
|
+
CrmPriorityBucketDefinition,
|
|
37
|
+
CrmPriorityRuleConfig,
|
|
38
|
+
CrmNextActionMapping,
|
|
39
|
+
CrmNextActionRuleConfig
|
|
40
|
+
} from './domains/sales'
|
|
41
|
+
export {
|
|
42
|
+
ProspectingLifecycleStageSchema,
|
|
43
|
+
RecordColumnConfigSchema,
|
|
44
|
+
RecordColumnsConfigSchema,
|
|
45
|
+
CredentialRequirementSchema,
|
|
46
|
+
ProspectingBuildTemplateStepSchema,
|
|
47
|
+
ProspectingBuildTemplateSchema,
|
|
48
|
+
ACTION_REGISTRY,
|
|
49
|
+
findActionById
|
|
50
|
+
} from './domains/prospecting'
|
|
51
|
+
export type {
|
|
52
|
+
ListBuilderStep,
|
|
53
|
+
RecordColumnConfig,
|
|
54
|
+
CredentialRequirement,
|
|
55
|
+
TemplateName,
|
|
56
|
+
StepName,
|
|
57
|
+
ActionRegistry
|
|
58
|
+
} from './domains/prospecting'
|
|
59
|
+
export { ProjectsDomainStateSchema } from './domains/projects'
|
|
77
60
|
export * from './domains/systems'
|
|
78
61
|
export * from './domains/resources'
|
|
79
62
|
export * from './domains/topology'
|
|
80
63
|
export {
|
|
81
|
-
DEFAULT_ORGANIZATION_MODEL_NAVIGATION,
|
|
82
|
-
getSortedSidebarEntries,
|
|
83
|
-
NavigationGroupSchema,
|
|
84
|
-
OrganizationModelNavigationSchema,
|
|
85
|
-
SidebarNavigationSchema,
|
|
86
|
-
SidebarNodeSchema,
|
|
87
|
-
SidebarSectionSchema,
|
|
88
|
-
SidebarSurfaceTargetsSchema,
|
|
89
|
-
SurfaceDefinitionSchema,
|
|
90
|
-
SurfaceTypeSchema
|
|
91
|
-
} from './domains/navigation'
|
|
92
|
-
export {
|
|
93
|
-
EntitiesDomainSchema,
|
|
94
|
-
EntityIdSchema,
|
|
95
|
-
EntityLinkKindSchema,
|
|
96
|
-
EntityLinkSchema,
|
|
97
|
-
EntitySchema
|
|
98
|
-
} from './domains/entities'
|
|
99
|
-
export {
|
|
100
|
-
KnowledgeDomainSchema,
|
|
101
|
-
KnowledgeLinkSchema,
|
|
102
|
-
KnowledgeTargetKindSchema,
|
|
103
|
-
KnowledgeTargetRefSchema,
|
|
104
|
-
OrgKnowledgeKindSchema,
|
|
105
|
-
OrgKnowledgeNodeSchema
|
|
106
|
-
} from './domains/knowledge'
|
|
107
|
-
export * from './domains/roles'
|
|
108
|
-
export * from './domains/identity'
|
|
109
|
-
export * from './domains/policies'
|
|
110
|
-
export {
|
|
111
|
-
ActionsDomainSchema,
|
|
112
|
-
ActionIdSchema,
|
|
113
|
-
ActionInvocationKindSchema,
|
|
114
|
-
ActionInvocationSchema,
|
|
115
|
-
ActionRefSchema,
|
|
116
|
-
ActionSchema,
|
|
117
|
-
ActionScopeSchema,
|
|
118
|
-
ApiEndpointInvocationSchema,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
ActionScope
|
|
135
|
-
} from './domains/actions'
|
|
64
|
+
DEFAULT_ORGANIZATION_MODEL_NAVIGATION,
|
|
65
|
+
getSortedSidebarEntries,
|
|
66
|
+
NavigationGroupSchema,
|
|
67
|
+
OrganizationModelNavigationSchema,
|
|
68
|
+
SidebarNavigationSchema,
|
|
69
|
+
SidebarNodeSchema,
|
|
70
|
+
SidebarSectionSchema,
|
|
71
|
+
SidebarSurfaceTargetsSchema,
|
|
72
|
+
SurfaceDefinitionSchema,
|
|
73
|
+
SurfaceTypeSchema
|
|
74
|
+
} from './domains/navigation'
|
|
75
|
+
export {
|
|
76
|
+
EntitiesDomainSchema,
|
|
77
|
+
EntityIdSchema,
|
|
78
|
+
EntityLinkKindSchema,
|
|
79
|
+
EntityLinkSchema,
|
|
80
|
+
EntitySchema
|
|
81
|
+
} from './domains/entities'
|
|
82
|
+
export {
|
|
83
|
+
KnowledgeDomainSchema,
|
|
84
|
+
KnowledgeLinkSchema,
|
|
85
|
+
KnowledgeTargetKindSchema,
|
|
86
|
+
KnowledgeTargetRefSchema,
|
|
87
|
+
OrgKnowledgeKindSchema,
|
|
88
|
+
OrgKnowledgeNodeSchema
|
|
89
|
+
} from './domains/knowledge'
|
|
90
|
+
export * from './domains/roles'
|
|
91
|
+
export * from './domains/identity'
|
|
92
|
+
export * from './domains/policies'
|
|
93
|
+
export {
|
|
94
|
+
ActionsDomainSchema,
|
|
95
|
+
ActionIdSchema,
|
|
96
|
+
ActionInvocationKindSchema,
|
|
97
|
+
ActionInvocationSchema,
|
|
98
|
+
ActionRefSchema,
|
|
99
|
+
ActionSchema,
|
|
100
|
+
ActionScopeSchema,
|
|
101
|
+
ApiEndpointInvocationSchema,
|
|
102
|
+
DEFAULT_ORGANIZATION_MODEL_ACTIONS,
|
|
103
|
+
findOrganizationActionById,
|
|
104
|
+
McpToolInvocationSchema,
|
|
105
|
+
ScriptExecutionInvocationSchema,
|
|
106
|
+
SlashCommandInvocationSchema
|
|
107
|
+
} from './domains/actions'
|
|
108
|
+
export type {
|
|
109
|
+
ActionsDomain,
|
|
110
|
+
Action as OrganizationAction,
|
|
111
|
+
ActionId,
|
|
112
|
+
ActionInvocation,
|
|
113
|
+
ActionInvocationKind,
|
|
114
|
+
ActionRef,
|
|
115
|
+
ActionScope
|
|
116
|
+
} from './domains/actions'
|