@elevasis/ui 2.34.0 → 2.35.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/api/index.js +3 -3
- package/dist/app/index.d.ts +12 -12
- package/dist/app/index.js +25 -23
- package/dist/charts/index.js +3 -5
- package/dist/chunk-26HFM4MH.js +41449 -0
- package/dist/{chunk-DTFKWZ7A.js → chunk-4U3XAWCN.js} +502 -484
- package/dist/{chunk-ND5TDV2J.js → chunk-57OZ3AEG.js} +1 -1
- package/dist/{chunk-E4WQGJNS.js → chunk-7FPLLSHN.js} +14 -1
- package/dist/{chunk-RQA2EVN3.js → chunk-AKW7KISS.js} +39 -3
- package/dist/chunk-AUDNF2Q7.js +2050 -0
- package/dist/{chunk-TYRUKGGD.js → chunk-GX6XBRRF.js} +1 -2
- package/dist/{chunk-V6SZ4ECN.js → chunk-LUYVRATI.js} +257 -6
- package/dist/{chunk-X4WBGKJQ.js → chunk-R3VCBZDC.js} +50 -3
- package/dist/chunk-SIQ3P4OR.js +1764 -0
- package/dist/{chunk-RIAXZ6AH.js → chunk-VDOOGGBA.js} +1 -1
- package/dist/{chunk-3FV6HBXS.js → chunk-WF7CONXF.js} +23 -23
- package/dist/{chunk-3QXJK5IY.js → chunk-YYX7OPZQ.js} +1 -1
- package/dist/components/index.d.ts +69 -69
- package/dist/components/index.js +20 -2795
- package/dist/components/navigation/index.js +25 -5
- package/dist/execution/index.d.ts +9 -9
- package/dist/execution/index.js +1 -2
- package/dist/features/auth/index.js +23 -2
- package/dist/features/clients/index.js +20 -26
- package/dist/features/crm/index.js +20 -30
- package/dist/features/dashboard/index.d.ts +68 -68
- package/dist/features/dashboard/index.js +20 -28
- package/dist/features/delivery/index.js +20 -30
- package/dist/features/knowledge/index.js +25 -9
- package/dist/features/lead-gen/index.d.ts +9 -9
- package/dist/features/lead-gen/index.js +20 -31
- package/dist/features/monitoring/index.js +20 -30
- package/dist/features/monitoring/requests/index.js +20 -25
- package/dist/features/operations/index.d.ts +153 -153
- package/dist/features/operations/index.js +18 -37
- package/dist/features/seo/index.js +3 -4
- package/dist/features/settings/index.js +20 -27
- package/dist/graph/index.js +1 -1
- package/dist/hooks/delivery/index.js +30 -2
- package/dist/hooks/index.d.ts +85 -85
- package/dist/hooks/index.js +20 -21
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +35 -35
- package/dist/hooks/published.d.ts +85 -85
- package/dist/hooks/published.js +20 -20
- package/dist/index.css +532 -532
- package/dist/index.d.ts +9256 -5803
- package/dist/index.js +22 -26
- package/dist/knowledge/index.d.ts +21 -21
- package/dist/knowledge/index.js +8 -15
- package/dist/layout/index.js +4 -10
- package/dist/organization/index.js +27 -1
- package/dist/provider/index.d.ts +47 -21
- package/dist/provider/index.js +20 -15
- package/dist/provider/published.d.ts +15 -16
- package/dist/provider/published.js +20 -11
- package/dist/test-utils/index.js +3 -3
- package/dist/theme/index.js +2 -3
- package/dist/theme/presets/index.d.ts +28 -3
- package/dist/theme/presets/index.js +1 -1
- package/dist/typeform/index.js +1 -2049
- package/dist/types/index.d.ts +68 -68
- package/dist/utils/index.d.ts +46 -46
- package/dist/utils/index.js +1 -1
- package/dist/zustand/index.d.ts +6 -6
- package/dist/zustand/index.js +0 -3
- package/package.json +5 -5
- package/dist/chunk-3AJVNMY5.js +0 -4769
- package/dist/chunk-3MEXPLWT.js +0 -265
- package/dist/chunk-3ZMAGTWF.js +0 -18
- package/dist/chunk-4O4MII5S.js +0 -4716
- package/dist/chunk-5EYJ2GIN.js +0 -122
- package/dist/chunk-7M2VOCYN.js +0 -1
- package/dist/chunk-BPQVTIUP.js +0 -105
- package/dist/chunk-BZZCNLT6.js +0 -12
- package/dist/chunk-CLDCYJQT.js +0 -1
- package/dist/chunk-E565XMTQ.js +0 -17
- package/dist/chunk-HRWLKKWM.js +0 -758
- package/dist/chunk-IGDYWFNE.js +0 -5198
- package/dist/chunk-IIMU5YAJ.js +0 -53
- package/dist/chunk-IVGI4GDL.js +0 -1593
- package/dist/chunk-JFL3GRD4.js +0 -39
- package/dist/chunk-LAWLB6CT.js +0 -951
- package/dist/chunk-LGKLC5MG.js +0 -44
- package/dist/chunk-LRWTWOGP.js +0 -1778
- package/dist/chunk-MP3GPBPX.js +0 -1874
- package/dist/chunk-N55DVMAG.js +0 -14
- package/dist/chunk-NLBQTDOW.js +0 -12051
- package/dist/chunk-O6JXQ6UQ.js +0 -468
- package/dist/chunk-OBBQ2JCM.js +0 -68
- package/dist/chunk-PDHTXPSF.js +0 -12
- package/dist/chunk-PLP3NYPL.js +0 -356
- package/dist/chunk-R2XR4FCV.js +0 -48
- package/dist/chunk-R66W5UDG.js +0 -26
- package/dist/chunk-RYTEQBAO.js +0 -37
- package/dist/chunk-SDXSB3HN.js +0 -425
- package/dist/chunk-TKAYX2SP.js +0 -204
- package/dist/chunk-TUMSNGTX.js +0 -35
- package/dist/chunk-VNAZTCHA.js +0 -65
- package/dist/chunk-VNFR57DF.js +0 -87
- package/dist/chunk-VTXTZXAU.js +0 -539
- package/dist/chunk-W73ZABT6.js +0 -85
- package/dist/chunk-WU4FNWCW.js +0 -2281
- package/dist/chunk-XZGSCABI.js +0 -383
- package/dist/chunk-YNWZIWJL.js +0 -1863
- /package/dist/{chunk-2RJMVWFJ.js → chunk-GEFWMU26.js} +0 -0
- /package/dist/{chunk-22UVE3RA.js → chunk-HENXLGVD.js} +0 -0
|
@@ -1371,76 +1371,10 @@ var OrganizationModelBrandingSchema = z.object({
|
|
|
1371
1371
|
});
|
|
1372
1372
|
var DEFAULT_ORGANIZATION_MODEL_BRANDING = {
|
|
1373
1373
|
organizationName: "Default Organization",
|
|
1374
|
-
productName: "
|
|
1375
|
-
shortName: "
|
|
1374
|
+
productName: "Organization OS",
|
|
1375
|
+
shortName: "Org OS",
|
|
1376
1376
|
logos: {}
|
|
1377
1377
|
};
|
|
1378
|
-
var SurfaceTypeSchema = z.enum(["page", "dashboard", "graph", "detail", "list", "settings"]).meta({ label: "Surface type", color: "blue" });
|
|
1379
|
-
var SurfaceDefinitionSchema = z.object({
|
|
1380
|
-
id: ModelIdSchema,
|
|
1381
|
-
label: LabelSchema,
|
|
1382
|
-
path: PathSchema,
|
|
1383
|
-
surfaceType: SurfaceTypeSchema,
|
|
1384
|
-
description: DescriptionSchema.optional(),
|
|
1385
|
-
enabled: z.boolean().default(true),
|
|
1386
|
-
devOnly: z.boolean().optional(),
|
|
1387
|
-
icon: IconNameSchema.optional(),
|
|
1388
|
-
systemIds: z.array(ModelIdSchema.meta({ ref: "system" })).default([]),
|
|
1389
|
-
entityIds: z.array(ModelIdSchema.meta({ ref: "entity" })).default([]),
|
|
1390
|
-
resourceIds: z.array(ModelIdSchema.meta({ ref: "resource" })).default([]),
|
|
1391
|
-
actionIds: z.array(ModelIdSchema.meta({ ref: "action" })).default([]),
|
|
1392
|
-
parentId: ModelIdSchema.meta({ ref: "surface" }).optional()
|
|
1393
|
-
});
|
|
1394
|
-
var SidebarSurfaceTargetsSchema = z.object({
|
|
1395
|
-
systems: z.array(ModelIdSchema.meta({ ref: "system" })).default([]).optional(),
|
|
1396
|
-
entities: z.array(ModelIdSchema.meta({ ref: "entity" })).default([]).optional(),
|
|
1397
|
-
resources: z.array(ModelIdSchema.meta({ ref: "resource" })).default([]).optional(),
|
|
1398
|
-
actions: z.array(ModelIdSchema.meta({ ref: "action" })).default([]).optional()
|
|
1399
|
-
}).default({});
|
|
1400
|
-
var SidebarNodeSchema = z.lazy(
|
|
1401
|
-
() => z.discriminatedUnion("type", [
|
|
1402
|
-
z.object({
|
|
1403
|
-
type: z.literal("group"),
|
|
1404
|
-
label: LabelSchema,
|
|
1405
|
-
description: DescriptionSchema.optional(),
|
|
1406
|
-
icon: IconNameSchema.optional(),
|
|
1407
|
-
order: z.number().int().optional(),
|
|
1408
|
-
children: z.record(z.string(), SidebarNodeSchema).default({})
|
|
1409
|
-
}),
|
|
1410
|
-
z.object({
|
|
1411
|
-
type: z.literal("surface"),
|
|
1412
|
-
label: LabelSchema,
|
|
1413
|
-
path: PathSchema,
|
|
1414
|
-
surfaceType: SurfaceTypeSchema,
|
|
1415
|
-
description: DescriptionSchema.optional(),
|
|
1416
|
-
icon: IconNameSchema.optional(),
|
|
1417
|
-
order: z.number().int().optional(),
|
|
1418
|
-
targets: SidebarSurfaceTargetsSchema.optional(),
|
|
1419
|
-
devOnly: z.boolean().optional(),
|
|
1420
|
-
requiresAdmin: z.boolean().optional()
|
|
1421
|
-
})
|
|
1422
|
-
])
|
|
1423
|
-
);
|
|
1424
|
-
var SidebarSectionSchema = z.record(z.string(), SidebarNodeSchema).default({});
|
|
1425
|
-
var SidebarNavigationSchema = z.object({
|
|
1426
|
-
primary: SidebarSectionSchema,
|
|
1427
|
-
bottom: SidebarSectionSchema
|
|
1428
|
-
}).default({ primary: {}, bottom: {} });
|
|
1429
|
-
var OrganizationModelNavigationSchema = z.object({
|
|
1430
|
-
sidebar: SidebarNavigationSchema
|
|
1431
|
-
}).default({ sidebar: { primary: {}, bottom: {} } });
|
|
1432
|
-
function getSortedSidebarEntries(nodes) {
|
|
1433
|
-
return Object.entries(nodes).sort(([leftId, left], [rightId, right]) => {
|
|
1434
|
-
const orderDelta = (left.order ?? Number.MAX_SAFE_INTEGER) - (right.order ?? Number.MAX_SAFE_INTEGER);
|
|
1435
|
-
return orderDelta === 0 ? leftId.localeCompare(rightId) : orderDelta;
|
|
1436
|
-
});
|
|
1437
|
-
}
|
|
1438
|
-
z.object({
|
|
1439
|
-
id: ModelIdSchema,
|
|
1440
|
-
label: LabelSchema,
|
|
1441
|
-
placement: z.string().trim().min(1).max(50),
|
|
1442
|
-
surfaceIds: z.array(ModelIdSchema.meta({ ref: "surface" })).default([])
|
|
1443
|
-
});
|
|
1444
1378
|
var FirmographicsSchema = z.object({
|
|
1445
1379
|
/** Industry vertical (e.g. "Marketing Agency", "Legal", "Real Estate"). */
|
|
1446
1380
|
industry: z.string().trim().max(200).optional(),
|
|
@@ -1633,90 +1567,6 @@ var GoalsDomainSchema = z.record(z.string(), ObjectiveSchema).refine((record) =>
|
|
|
1633
1567
|
message: "Each objective entry id must match its map key"
|
|
1634
1568
|
}).default({});
|
|
1635
1569
|
var DEFAULT_ORGANIZATION_MODEL_GOALS = {};
|
|
1636
|
-
var KnowledgeTargetKindSchema = z.enum([
|
|
1637
|
-
"system",
|
|
1638
|
-
"resource",
|
|
1639
|
-
"knowledge",
|
|
1640
|
-
"stage",
|
|
1641
|
-
"action",
|
|
1642
|
-
"role",
|
|
1643
|
-
"goal",
|
|
1644
|
-
"customer-segment",
|
|
1645
|
-
"offering",
|
|
1646
|
-
"ontology"
|
|
1647
|
-
]).meta({ label: "Target kind" });
|
|
1648
|
-
var KnowledgeTargetRefSchema = z.object({
|
|
1649
|
-
kind: KnowledgeTargetKindSchema,
|
|
1650
|
-
// Ontology targets use the canonical '<scope>:<kind>/<local-id>' ontology id format.
|
|
1651
|
-
// Business-logic validation of target existence is done in OrganizationModelSchema.superRefine.
|
|
1652
|
-
id: z.string().trim().min(1).max(300)
|
|
1653
|
-
}).superRefine((target, ctx) => {
|
|
1654
|
-
if (target.kind !== "ontology") return;
|
|
1655
|
-
const result = OntologyIdSchema.safeParse(target.id);
|
|
1656
|
-
if (!result.success) {
|
|
1657
|
-
ctx.addIssue({
|
|
1658
|
-
code: z.ZodIssueCode.custom,
|
|
1659
|
-
path: ["id"],
|
|
1660
|
-
message: "Ontology knowledge targets must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>"
|
|
1661
|
-
});
|
|
1662
|
-
}
|
|
1663
|
-
});
|
|
1664
|
-
var LegacyKnowledgeLinkSchema = z.object({
|
|
1665
|
-
nodeId: z.union([NodeIdStringSchema, z.templateLiteral(["ontology:", OntologyIdSchema])])
|
|
1666
|
-
}).superRefine((link, ctx) => {
|
|
1667
|
-
const [kind] = link.nodeId.split(":");
|
|
1668
|
-
if (!KnowledgeTargetKindSchema.safeParse(kind).success) {
|
|
1669
|
-
ctx.addIssue({
|
|
1670
|
-
code: z.ZodIssueCode.custom,
|
|
1671
|
-
path: ["nodeId"],
|
|
1672
|
-
message: `Unknown knowledge target kind "${kind}"`
|
|
1673
|
-
});
|
|
1674
|
-
}
|
|
1675
|
-
});
|
|
1676
|
-
var CanonicalKnowledgeLinkSchema = z.object({
|
|
1677
|
-
target: KnowledgeTargetRefSchema
|
|
1678
|
-
});
|
|
1679
|
-
function nodeIdFromTarget(target) {
|
|
1680
|
-
return `${target.kind}:${target.id}`;
|
|
1681
|
-
}
|
|
1682
|
-
function targetFromNodeId(nodeId2) {
|
|
1683
|
-
const [kind, ...idParts] = nodeId2.split(":");
|
|
1684
|
-
return {
|
|
1685
|
-
kind: KnowledgeTargetKindSchema.parse(kind),
|
|
1686
|
-
id: idParts.join(":")
|
|
1687
|
-
};
|
|
1688
|
-
}
|
|
1689
|
-
var KnowledgeLinkSchema = z.union([CanonicalKnowledgeLinkSchema, LegacyKnowledgeLinkSchema]).transform((link) => {
|
|
1690
|
-
const target = "target" in link ? link.target : targetFromNodeId(link.nodeId);
|
|
1691
|
-
return {
|
|
1692
|
-
target,
|
|
1693
|
-
nodeId: nodeIdFromTarget(target)
|
|
1694
|
-
};
|
|
1695
|
-
});
|
|
1696
|
-
var OrgKnowledgeKindSchema = z.enum(["playbook", "strategy", "reference"]).meta({ label: "Knowledge kind", color: "grape" });
|
|
1697
|
-
var OrgKnowledgeNodeSchema = z.object({
|
|
1698
|
-
id: ModelIdSchema,
|
|
1699
|
-
kind: OrgKnowledgeKindSchema,
|
|
1700
|
-
title: z.string().trim().min(1).max(200),
|
|
1701
|
-
summary: z.string().trim().min(1).max(1e3),
|
|
1702
|
-
icon: IconNameSchema.optional(),
|
|
1703
|
-
/** Canonical documentation URL when body content is a local summary. */
|
|
1704
|
-
externalUrl: z.string().trim().url().max(500).optional(),
|
|
1705
|
-
/** Optional generated source file path for local MDX-backed knowledge nodes. */
|
|
1706
|
-
sourceFilePath: z.string().trim().min(1).max(500).optional(),
|
|
1707
|
-
/** Raw MDX string. Phase 2 will introduce a structured block format. */
|
|
1708
|
-
body: z.string().trim().min(1),
|
|
1709
|
-
/**
|
|
1710
|
-
* Graph links to other OM nodes this knowledge node governs.
|
|
1711
|
-
* Each link emits a `governs` edge: knowledge-node -> target node.
|
|
1712
|
-
*/
|
|
1713
|
-
links: z.array(KnowledgeLinkSchema).default([]),
|
|
1714
|
-
/** Role identifiers that own this knowledge node. */
|
|
1715
|
-
ownerIds: z.array(RoleIdSchema.meta({ ref: "role" })).default([]),
|
|
1716
|
-
/** ISO date string (YYYY-MM-DD or full ISO 8601) of last meaningful update. */
|
|
1717
|
-
updatedAt: z.string().trim().min(1).max(50)
|
|
1718
|
-
});
|
|
1719
|
-
var KnowledgeDomainSchema = z.record(ModelIdSchema, OrgKnowledgeNodeSchema).default({});
|
|
1720
1570
|
var SecretLikeMetadataKeySchema = /(?:secret|password|passwd|token|api[-_]?key|credential|private[-_]?key)/i;
|
|
1721
1571
|
var SecretLikeMetadataValueSchema = /(?:sk-[A-Za-z0-9_-]{12,}|pk_live_[A-Za-z0-9_-]{12,}|eyJ[A-Za-z0-9_-]{20,}|-----BEGIN (?:RSA |OPENSSH |EC )?PRIVATE KEY-----)/;
|
|
1722
1572
|
z.enum([
|
|
@@ -1945,80 +1795,237 @@ var PoliciesDomainSchema = z.record(z.string(), PolicySchema).refine((record) =>
|
|
|
1945
1795
|
message: "Each policy entry id must match its map key"
|
|
1946
1796
|
}).default({});
|
|
1947
1797
|
var DEFAULT_ORGANIZATION_MODEL_POLICIES = {};
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
"
|
|
1959
|
-
"
|
|
1960
|
-
"
|
|
1961
|
-
"
|
|
1962
|
-
"
|
|
1963
|
-
"policies",
|
|
1964
|
-
"knowledge"
|
|
1965
|
-
]);
|
|
1966
|
-
var OrganizationModelDomainMetadataSchema = z.object({
|
|
1967
|
-
version: z.literal(1).default(1),
|
|
1968
|
-
lastModified: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastModified must be an ISO date string (YYYY-MM-DD)")
|
|
1798
|
+
var SurfaceTypeSchema = z.enum(["page", "dashboard", "graph", "detail", "list", "settings"]).meta({ label: "Surface type", color: "blue" });
|
|
1799
|
+
var SurfaceDefinitionSchema = z.object({
|
|
1800
|
+
id: ModelIdSchema,
|
|
1801
|
+
label: LabelSchema,
|
|
1802
|
+
path: PathSchema,
|
|
1803
|
+
surfaceType: SurfaceTypeSchema,
|
|
1804
|
+
description: DescriptionSchema.optional(),
|
|
1805
|
+
enabled: z.boolean().default(true),
|
|
1806
|
+
devOnly: z.boolean().optional(),
|
|
1807
|
+
icon: IconNameSchema.optional(),
|
|
1808
|
+
systemIds: z.array(ModelIdSchema.meta({ ref: "system" })).default([]),
|
|
1809
|
+
entityIds: z.array(ModelIdSchema.meta({ ref: "entity" })).default([]),
|
|
1810
|
+
resourceIds: z.array(ModelIdSchema.meta({ ref: "resource" })).default([]),
|
|
1811
|
+
actionIds: z.array(ModelIdSchema.meta({ ref: "action" })).default([]),
|
|
1812
|
+
parentId: ModelIdSchema.meta({ ref: "surface" }).optional()
|
|
1969
1813
|
});
|
|
1970
|
-
var
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
1814
|
+
var SidebarSurfaceTargetsSchema = z.object({
|
|
1815
|
+
systems: z.array(ModelIdSchema.meta({ ref: "system" })).default([]).optional(),
|
|
1816
|
+
entities: z.array(ModelIdSchema.meta({ ref: "entity" })).default([]).optional(),
|
|
1817
|
+
resources: z.array(ModelIdSchema.meta({ ref: "resource" })).default([]).optional(),
|
|
1818
|
+
actions: z.array(ModelIdSchema.meta({ ref: "action" })).default([]).optional()
|
|
1819
|
+
}).default({});
|
|
1820
|
+
var SidebarNodeSchema = z.lazy(
|
|
1821
|
+
() => z.discriminatedUnion("type", [
|
|
1822
|
+
z.object({
|
|
1823
|
+
type: z.literal("group"),
|
|
1824
|
+
label: LabelSchema,
|
|
1825
|
+
description: DescriptionSchema.optional(),
|
|
1826
|
+
icon: IconNameSchema.optional(),
|
|
1827
|
+
order: z.number().int().optional(),
|
|
1828
|
+
children: z.record(z.string(), SidebarNodeSchema).default({})
|
|
1829
|
+
}),
|
|
1830
|
+
z.object({
|
|
1831
|
+
type: z.literal("surface"),
|
|
1832
|
+
label: LabelSchema,
|
|
1833
|
+
path: PathSchema,
|
|
1834
|
+
surfaceType: SurfaceTypeSchema,
|
|
1835
|
+
description: DescriptionSchema.optional(),
|
|
1836
|
+
icon: IconNameSchema.optional(),
|
|
1837
|
+
order: z.number().int().optional(),
|
|
1838
|
+
targets: SidebarSurfaceTargetsSchema.optional(),
|
|
1839
|
+
devOnly: z.boolean().optional(),
|
|
1840
|
+
requiresAdmin: z.boolean().optional()
|
|
1841
|
+
})
|
|
1842
|
+
])
|
|
1843
|
+
);
|
|
1844
|
+
var SidebarSectionSchema = z.record(z.string(), SidebarNodeSchema).default({});
|
|
1845
|
+
var SidebarNavigationSchema = z.object({
|
|
1846
|
+
primary: SidebarSectionSchema,
|
|
1847
|
+
bottom: SidebarSectionSchema
|
|
1848
|
+
}).default({ primary: {}, bottom: {} });
|
|
1849
|
+
var OrganizationModelNavigationSchema = z.object({
|
|
1850
|
+
sidebar: SidebarNavigationSchema
|
|
1851
|
+
}).default({ sidebar: { primary: {}, bottom: {} } });
|
|
1852
|
+
function getSortedSidebarEntries(nodes) {
|
|
1853
|
+
return Object.entries(nodes).sort(([leftId, left], [rightId, right]) => {
|
|
1854
|
+
const orderDelta = (left.order ?? Number.MAX_SAFE_INTEGER) - (right.order ?? Number.MAX_SAFE_INTEGER);
|
|
1855
|
+
return orderDelta === 0 ? leftId.localeCompare(rightId) : orderDelta;
|
|
1856
|
+
});
|
|
1857
|
+
}
|
|
1858
|
+
z.object({
|
|
1859
|
+
id: ModelIdSchema,
|
|
1860
|
+
label: LabelSchema,
|
|
1861
|
+
placement: z.string().trim().min(1).max(50),
|
|
1862
|
+
surfaceIds: z.array(ModelIdSchema.meta({ ref: "surface" })).default([])
|
|
1863
|
+
});
|
|
1864
|
+
var KnowledgeTargetKindSchema = z.enum([
|
|
1865
|
+
"system",
|
|
1866
|
+
"resource",
|
|
1867
|
+
"knowledge",
|
|
1868
|
+
"stage",
|
|
1869
|
+
"action",
|
|
1870
|
+
"role",
|
|
1871
|
+
"goal",
|
|
1872
|
+
"customer-segment",
|
|
1873
|
+
"offering",
|
|
1874
|
+
"ontology"
|
|
1875
|
+
]).meta({ label: "Target kind" });
|
|
1876
|
+
var KnowledgeTargetRefSchema = z.object({
|
|
1877
|
+
kind: KnowledgeTargetKindSchema,
|
|
1878
|
+
// Ontology targets use the canonical '<scope>:<kind>/<local-id>' ontology id format.
|
|
1879
|
+
// Business-logic validation of target existence is done in OrganizationModelSchema.superRefine.
|
|
1880
|
+
id: z.string().trim().min(1).max(300)
|
|
1881
|
+
}).superRefine((target, ctx) => {
|
|
1882
|
+
if (target.kind !== "ontology") return;
|
|
1883
|
+
const result = OntologyIdSchema.safeParse(target.id);
|
|
1884
|
+
if (!result.success) {
|
|
1885
|
+
ctx.addIssue({
|
|
1886
|
+
code: z.ZodIssueCode.custom,
|
|
1887
|
+
path: ["id"],
|
|
1888
|
+
message: "Ontology knowledge targets must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>"
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1892
|
+
var LegacyKnowledgeLinkSchema = z.object({
|
|
1893
|
+
nodeId: z.union([NodeIdStringSchema, z.templateLiteral(["ontology:", OntologyIdSchema])])
|
|
1894
|
+
}).superRefine((link, ctx) => {
|
|
1895
|
+
const [kind] = link.nodeId.split(":");
|
|
1896
|
+
if (!KnowledgeTargetKindSchema.safeParse(kind).success) {
|
|
1897
|
+
ctx.addIssue({
|
|
1898
|
+
code: z.ZodIssueCode.custom,
|
|
1899
|
+
path: ["nodeId"],
|
|
1900
|
+
message: `Unknown knowledge target kind "${kind}"`
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
});
|
|
1904
|
+
var CanonicalKnowledgeLinkSchema = z.object({
|
|
1905
|
+
target: KnowledgeTargetRefSchema
|
|
1906
|
+
});
|
|
1907
|
+
function nodeIdFromTarget(target) {
|
|
1908
|
+
return `${target.kind}:${target.id}`;
|
|
1909
|
+
}
|
|
1910
|
+
function targetFromNodeId(nodeId2) {
|
|
1911
|
+
const [kind, ...idParts] = nodeId2.split(":");
|
|
1912
|
+
return {
|
|
1913
|
+
kind: KnowledgeTargetKindSchema.parse(kind),
|
|
1914
|
+
id: idParts.join(":")
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
var KnowledgeLinkSchema = z.union([CanonicalKnowledgeLinkSchema, LegacyKnowledgeLinkSchema]).transform((link) => {
|
|
1918
|
+
const target = "target" in link ? link.target : targetFromNodeId(link.nodeId);
|
|
1919
|
+
return {
|
|
1920
|
+
target,
|
|
1921
|
+
nodeId: nodeIdFromTarget(target)
|
|
1922
|
+
};
|
|
1923
|
+
});
|
|
1924
|
+
var OrgKnowledgeKindSchema = z.enum(["playbook", "strategy", "reference"]).meta({ label: "Knowledge kind", color: "grape" });
|
|
1925
|
+
var OrgKnowledgeNodeSchema = z.object({
|
|
1926
|
+
id: ModelIdSchema,
|
|
1927
|
+
kind: OrgKnowledgeKindSchema,
|
|
1928
|
+
title: z.string().trim().min(1).max(200),
|
|
1929
|
+
summary: z.string().trim().min(1).max(1e3),
|
|
1930
|
+
icon: IconNameSchema.optional(),
|
|
1931
|
+
/** Canonical documentation URL when body content is a local summary. */
|
|
1932
|
+
externalUrl: z.string().trim().url().max(500).optional(),
|
|
1933
|
+
/** Optional generated source file path for local MDX-backed knowledge nodes. */
|
|
1934
|
+
sourceFilePath: z.string().trim().min(1).max(500).optional(),
|
|
1935
|
+
/** Raw MDX string. Phase 2 will introduce a structured block format. */
|
|
1936
|
+
body: z.string().trim().min(1),
|
|
1937
|
+
/**
|
|
1938
|
+
* Graph links to other OM nodes this knowledge node governs.
|
|
1939
|
+
* Each link emits a `governs` edge: knowledge-node -> target node.
|
|
1940
|
+
*/
|
|
1941
|
+
links: z.array(KnowledgeLinkSchema).default([]),
|
|
1942
|
+
/** Role identifiers that own this knowledge node. */
|
|
1943
|
+
ownerIds: z.array(RoleIdSchema.meta({ ref: "role" })).default([]),
|
|
1944
|
+
/** ISO date string (YYYY-MM-DD or full ISO 8601) of last meaningful update. */
|
|
1945
|
+
updatedAt: z.string().trim().min(1).max(50)
|
|
2021
1946
|
});
|
|
1947
|
+
var KnowledgeDomainSchema = z.record(ModelIdSchema, OrgKnowledgeNodeSchema).default({});
|
|
1948
|
+
|
|
1949
|
+
// ../core/src/organization-model/cross-ref.ts
|
|
1950
|
+
var ONTOLOGY_REFERENCE_KEY_KINDS = {
|
|
1951
|
+
valueType: "value-type",
|
|
1952
|
+
catalogType: "catalog",
|
|
1953
|
+
objectType: "object",
|
|
1954
|
+
eventType: "event",
|
|
1955
|
+
actionType: "action",
|
|
1956
|
+
linkType: "link",
|
|
1957
|
+
interfaceType: "interface",
|
|
1958
|
+
propertyType: "property",
|
|
1959
|
+
groupType: "group",
|
|
1960
|
+
surfaceType: "surface",
|
|
1961
|
+
stepCatalog: "catalog"
|
|
1962
|
+
};
|
|
1963
|
+
function buildOmCrossRefIndex(model) {
|
|
1964
|
+
const systemsById = /* @__PURE__ */ new Map();
|
|
1965
|
+
for (const { path, system } of listAllSystems(model)) {
|
|
1966
|
+
systemsById.set(path, system);
|
|
1967
|
+
systemsById.set(system.id, system);
|
|
1968
|
+
}
|
|
1969
|
+
const resourceIds = new Set(Object.keys(model.resources ?? {}));
|
|
1970
|
+
const knowledgeIds = new Set(Object.keys(model.knowledge ?? {}));
|
|
1971
|
+
const roleIds = new Set(Object.keys(model.roles ?? {}));
|
|
1972
|
+
const goalIds = new Set(Object.keys(model.goals ?? {}));
|
|
1973
|
+
const actionIds = new Set(Object.keys(model.actions ?? {}));
|
|
1974
|
+
const customerSegmentIds = new Set(Object.keys(model.customers ?? {}));
|
|
1975
|
+
const offeringIds = new Set(Object.keys(model.offerings ?? {}));
|
|
1976
|
+
const ontologyCompilation = compileOrganizationOntology(model);
|
|
1977
|
+
const ontologyIndexByKind = {
|
|
1978
|
+
object: ontologyCompilation.ontology.objectTypes,
|
|
1979
|
+
link: ontologyCompilation.ontology.linkTypes,
|
|
1980
|
+
action: ontologyCompilation.ontology.actionTypes,
|
|
1981
|
+
catalog: ontologyCompilation.ontology.catalogTypes,
|
|
1982
|
+
event: ontologyCompilation.ontology.eventTypes,
|
|
1983
|
+
interface: ontologyCompilation.ontology.interfaceTypes,
|
|
1984
|
+
"value-type": ontologyCompilation.ontology.valueTypes,
|
|
1985
|
+
property: ontologyCompilation.ontology.sharedProperties,
|
|
1986
|
+
group: ontologyCompilation.ontology.groups,
|
|
1987
|
+
surface: ontologyCompilation.ontology.surfaces
|
|
1988
|
+
};
|
|
1989
|
+
const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
|
|
1990
|
+
const stageIds = /* @__PURE__ */ new Set();
|
|
1991
|
+
for (const catalog of Object.values(ontologyCompilation.ontology.catalogTypes)) {
|
|
1992
|
+
if (catalog.kind !== "stage") continue;
|
|
1993
|
+
const entries = catalog.entries;
|
|
1994
|
+
if (entries !== void 0) {
|
|
1995
|
+
for (const stageId of Object.keys(entries)) {
|
|
1996
|
+
stageIds.add(stageId);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
return {
|
|
2001
|
+
systemsById,
|
|
2002
|
+
resourceIds,
|
|
2003
|
+
knowledgeIds,
|
|
2004
|
+
roleIds,
|
|
2005
|
+
goalIds,
|
|
2006
|
+
actionIds,
|
|
2007
|
+
customerSegmentIds,
|
|
2008
|
+
offeringIds,
|
|
2009
|
+
ontologyIds,
|
|
2010
|
+
ontologyIndexByKind,
|
|
2011
|
+
stageIds
|
|
2012
|
+
};
|
|
2013
|
+
}
|
|
2014
|
+
function knowledgeTargetExists(index, kind, id) {
|
|
2015
|
+
if (kind === "system") return index.systemsById.has(id);
|
|
2016
|
+
if (kind === "resource") return index.resourceIds.has(id);
|
|
2017
|
+
if (kind === "knowledge") return index.knowledgeIds.has(id);
|
|
2018
|
+
if (kind === "stage") return index.stageIds.has(id);
|
|
2019
|
+
if (kind === "action") return index.actionIds.has(id);
|
|
2020
|
+
if (kind === "role") return index.roleIds.has(id);
|
|
2021
|
+
if (kind === "goal") return index.goalIds.has(id);
|
|
2022
|
+
if (kind === "customer-segment") return index.customerSegmentIds.has(id);
|
|
2023
|
+
if (kind === "offering") return index.offeringIds.has(id);
|
|
2024
|
+
if (kind === "ontology") return index.ontologyIds.has(id);
|
|
2025
|
+
return false;
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
// ../core/src/organization-model/schema-refinements.ts
|
|
2022
2029
|
function addIssue(ctx, path, message) {
|
|
2023
2030
|
ctx.addIssue({
|
|
2024
2031
|
code: z.ZodIssueCode.custom,
|
|
@@ -2049,7 +2056,7 @@ function isKnowledgeKindCompatibleWithTarget(knowledgeKind, targetKind) {
|
|
|
2049
2056
|
function isRecord(value) {
|
|
2050
2057
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2051
2058
|
}
|
|
2052
|
-
|
|
2059
|
+
function refineOrganizationModel(model, ctx) {
|
|
2053
2060
|
function collectAllSystems(systems, prefix = "", schemaPath = ["systems"]) {
|
|
2054
2061
|
const result = [];
|
|
2055
2062
|
for (const [key, system] of Object.entries(systems)) {
|
|
@@ -2221,7 +2228,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2221
2228
|
});
|
|
2222
2229
|
});
|
|
2223
2230
|
Object.values(model.entities).forEach((entity) => {
|
|
2224
|
-
if (!systemsById.has(entity.ownedBySystemId)) {
|
|
2231
|
+
if (systemsById.size > 0 && !systemsById.has(entity.ownedBySystemId)) {
|
|
2225
2232
|
addIssue(
|
|
2226
2233
|
ctx,
|
|
2227
2234
|
["entities", entity.id, "ownedBySystemId"],
|
|
@@ -2339,29 +2346,9 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2339
2346
|
}
|
|
2340
2347
|
});
|
|
2341
2348
|
});
|
|
2342
|
-
const
|
|
2343
|
-
const
|
|
2349
|
+
const idx = buildOmCrossRefIndex(model);
|
|
2350
|
+
const { ontologyIndexByKind, ontologyIds } = idx;
|
|
2344
2351
|
const ontologyCompilation = compileOrganizationOntology(model);
|
|
2345
|
-
const stageIds = /* @__PURE__ */ new Set();
|
|
2346
|
-
for (const catalog of Object.values(ontologyCompilation.ontology.catalogTypes)) {
|
|
2347
|
-
if (catalog.kind !== "stage") continue;
|
|
2348
|
-
for (const stageId of Object.keys(catalog.entries ?? {})) {
|
|
2349
|
-
stageIds.add(stageId);
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
const ontologyIndexByKind = {
|
|
2353
|
-
object: ontologyCompilation.ontology.objectTypes,
|
|
2354
|
-
link: ontologyCompilation.ontology.linkTypes,
|
|
2355
|
-
action: ontologyCompilation.ontology.actionTypes,
|
|
2356
|
-
catalog: ontologyCompilation.ontology.catalogTypes,
|
|
2357
|
-
event: ontologyCompilation.ontology.eventTypes,
|
|
2358
|
-
interface: ontologyCompilation.ontology.interfaceTypes,
|
|
2359
|
-
"value-type": ontologyCompilation.ontology.valueTypes,
|
|
2360
|
-
property: ontologyCompilation.ontology.sharedProperties,
|
|
2361
|
-
group: ontologyCompilation.ontology.groups,
|
|
2362
|
-
surface: ontologyCompilation.ontology.surfaces
|
|
2363
|
-
};
|
|
2364
|
-
const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
|
|
2365
2352
|
function topologyTargetExists(ref) {
|
|
2366
2353
|
if (ref.kind === "system") return systemsById.has(ref.id);
|
|
2367
2354
|
if (ref.kind === "resource") return resourcesById.has(ref.id);
|
|
@@ -2381,19 +2368,6 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2381
2368
|
);
|
|
2382
2369
|
});
|
|
2383
2370
|
});
|
|
2384
|
-
const ontologyReferenceKeyKinds = {
|
|
2385
|
-
valueType: "value-type",
|
|
2386
|
-
catalogType: "catalog",
|
|
2387
|
-
objectType: "object",
|
|
2388
|
-
eventType: "event",
|
|
2389
|
-
actionType: "action",
|
|
2390
|
-
linkType: "link",
|
|
2391
|
-
interfaceType: "interface",
|
|
2392
|
-
propertyType: "property",
|
|
2393
|
-
groupType: "group",
|
|
2394
|
-
surfaceType: "surface",
|
|
2395
|
-
stepCatalog: "catalog"
|
|
2396
|
-
};
|
|
2397
2371
|
function validateKnownOntologyReferences(ownerId, value, path, seen = /* @__PURE__ */ new WeakSet()) {
|
|
2398
2372
|
if (Array.isArray(value)) {
|
|
2399
2373
|
value.forEach((entry, index) => validateKnownOntologyReferences(ownerId, entry, [...path, index], seen));
|
|
@@ -2403,7 +2377,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2403
2377
|
if (seen.has(value)) return;
|
|
2404
2378
|
seen.add(value);
|
|
2405
2379
|
Object.entries(value).forEach(([key, entry]) => {
|
|
2406
|
-
const expectedKind =
|
|
2380
|
+
const expectedKind = ONTOLOGY_REFERENCE_KEY_KINDS[key];
|
|
2407
2381
|
if (expectedKind !== void 0) {
|
|
2408
2382
|
if (typeof entry !== "string") {
|
|
2409
2383
|
addIssue(ctx, [...path, key], `Ontology record "${ownerId}" ${key} must be an ontology ID string`);
|
|
@@ -2464,22 +2438,9 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2464
2438
|
);
|
|
2465
2439
|
}
|
|
2466
2440
|
});
|
|
2467
|
-
function knowledgeTargetExists(kind, id) {
|
|
2468
|
-
if (kind === "system") return systemsById.has(id);
|
|
2469
|
-
if (kind === "resource") return resourcesById.has(id);
|
|
2470
|
-
if (kind === "knowledge") return knowledgeById.has(id);
|
|
2471
|
-
if (kind === "stage") return stageIds.has(id);
|
|
2472
|
-
if (kind === "action") return actionIds.has(id);
|
|
2473
|
-
if (kind === "role") return rolesById.has(id);
|
|
2474
|
-
if (kind === "goal") return goalsById.has(id);
|
|
2475
|
-
if (kind === "customer-segment") return segmentsById.has(id);
|
|
2476
|
-
if (kind === "offering") return offeringsById.has(id);
|
|
2477
|
-
if (kind === "ontology") return ontologyIds.has(id);
|
|
2478
|
-
return false;
|
|
2479
|
-
}
|
|
2480
2441
|
Object.entries(model.knowledge).forEach(([nodeId2, node]) => {
|
|
2481
2442
|
node.links.forEach((link, linkIndex) => {
|
|
2482
|
-
if (!knowledgeTargetExists(link.target.kind, link.target.id)) {
|
|
2443
|
+
if (!knowledgeTargetExists(idx, link.target.kind, link.target.id)) {
|
|
2483
2444
|
addIssue(
|
|
2484
2445
|
ctx,
|
|
2485
2446
|
["knowledge", nodeId2, "links", linkIndex, "target"],
|
|
@@ -2493,109 +2454,275 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2493
2454
|
`Knowledge node "${node.id}" kind "${node.kind}" cannot govern ${link.target.kind} targets`
|
|
2494
2455
|
);
|
|
2495
2456
|
}
|
|
2496
|
-
});
|
|
2497
|
-
});
|
|
2498
|
-
Object.values(model.resources).forEach((resource) => {
|
|
2499
|
-
if (!systemsById.has(resource.systemPath)) {
|
|
2500
|
-
addIssue(
|
|
2501
|
-
ctx,
|
|
2502
|
-
["resources", resource.id, "systemPath"],
|
|
2503
|
-
`Resource "${resource.id}" references unknown system path "${resource.systemPath}"`
|
|
2504
|
-
);
|
|
2505
|
-
}
|
|
2506
|
-
if (resource.ownerRoleId !== void 0 && !rolesById.has(resource.ownerRoleId)) {
|
|
2507
|
-
addIssue(
|
|
2508
|
-
ctx,
|
|
2509
|
-
["resources", resource.id, "ownerRoleId"],
|
|
2510
|
-
`Resource "${resource.id}" references unknown ownerRoleId "${resource.ownerRoleId}"`
|
|
2511
|
-
);
|
|
2457
|
+
});
|
|
2458
|
+
});
|
|
2459
|
+
Object.values(model.resources).forEach((resource) => {
|
|
2460
|
+
if (!systemsById.has(resource.systemPath)) {
|
|
2461
|
+
addIssue(
|
|
2462
|
+
ctx,
|
|
2463
|
+
["resources", resource.id, "systemPath"],
|
|
2464
|
+
`Resource "${resource.id}" references unknown system path "${resource.systemPath}"`
|
|
2465
|
+
);
|
|
2466
|
+
}
|
|
2467
|
+
if (resource.ownerRoleId !== void 0 && !rolesById.has(resource.ownerRoleId)) {
|
|
2468
|
+
addIssue(
|
|
2469
|
+
ctx,
|
|
2470
|
+
["resources", resource.id, "ownerRoleId"],
|
|
2471
|
+
`Resource "${resource.id}" references unknown ownerRoleId "${resource.ownerRoleId}"`
|
|
2472
|
+
);
|
|
2473
|
+
}
|
|
2474
|
+
if (resource.kind === "agent" && resource.actsAsRoleId !== void 0 && !rolesById.has(resource.actsAsRoleId)) {
|
|
2475
|
+
addIssue(
|
|
2476
|
+
ctx,
|
|
2477
|
+
["resources", resource.id, "actsAsRoleId"],
|
|
2478
|
+
`Agent resource "${resource.id}" references unknown actsAsRoleId "${resource.actsAsRoleId}"`
|
|
2479
|
+
);
|
|
2480
|
+
}
|
|
2481
|
+
});
|
|
2482
|
+
function validateResourceOntologyBinding(resourceId, bindingKey, expectedKind, ids) {
|
|
2483
|
+
const ontologyIds2 = ids === void 0 ? [] : Array.isArray(ids) ? ids : [ids];
|
|
2484
|
+
ontologyIds2.forEach((ontologyId, ontologyIndex) => {
|
|
2485
|
+
if (ontologyIndexByKind[expectedKind][ontologyId] === void 0) {
|
|
2486
|
+
addIssue(
|
|
2487
|
+
ctx,
|
|
2488
|
+
["resources", resourceId, "ontology", bindingKey, ...Array.isArray(ids) ? [ontologyIndex] : []],
|
|
2489
|
+
`Resource "${resourceId}" ontology binding "${bindingKey}" references unknown ${expectedKind} ontology ID "${ontologyId}"`
|
|
2490
|
+
);
|
|
2491
|
+
}
|
|
2492
|
+
});
|
|
2493
|
+
}
|
|
2494
|
+
Object.values(model.resources).forEach((resource) => {
|
|
2495
|
+
const binding = resource.ontology;
|
|
2496
|
+
if (binding === void 0) return;
|
|
2497
|
+
validateResourceOntologyBinding(resource.id, "actions", "action", binding.actions);
|
|
2498
|
+
validateResourceOntologyBinding(resource.id, "primaryAction", "action", binding.primaryAction);
|
|
2499
|
+
validateResourceOntologyBinding(resource.id, "reads", "object", binding.reads);
|
|
2500
|
+
validateResourceOntologyBinding(resource.id, "writes", "object", binding.writes);
|
|
2501
|
+
validateResourceOntologyBinding(resource.id, "usesCatalogs", "catalog", binding.usesCatalogs);
|
|
2502
|
+
validateResourceOntologyBinding(resource.id, "emits", "event", binding.emits);
|
|
2503
|
+
if (binding.contract !== void 0) {
|
|
2504
|
+
const contractEntries = [
|
|
2505
|
+
["input", binding.contract.input],
|
|
2506
|
+
["output", binding.contract.output]
|
|
2507
|
+
];
|
|
2508
|
+
for (const [side, ref] of contractEntries) {
|
|
2509
|
+
if (ref === void 0) continue;
|
|
2510
|
+
const result = ContractRefSchema.safeParse(ref);
|
|
2511
|
+
if (!result.success) {
|
|
2512
|
+
addIssue(
|
|
2513
|
+
ctx,
|
|
2514
|
+
["resources", resource.id, "ontology", "contract", side],
|
|
2515
|
+
`Resource "${resource.id}" contract.${side} "${ref}" is not a valid ContractRef (expected "package/subpath#ExportName")`
|
|
2516
|
+
);
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
});
|
|
2521
|
+
Object.values(model.roles).forEach((role) => {
|
|
2522
|
+
if (role.heldBy === void 0) return;
|
|
2523
|
+
asRoleHolderArray(role.heldBy).forEach((holder, holderIndex) => {
|
|
2524
|
+
if (holder.kind !== "agent") return;
|
|
2525
|
+
const resource = resourcesById.get(holder.agentId);
|
|
2526
|
+
if (resource === void 0) {
|
|
2527
|
+
addIssue(
|
|
2528
|
+
ctx,
|
|
2529
|
+
["roles", role.id, "heldBy", Array.isArray(role.heldBy) ? holderIndex : "agentId"],
|
|
2530
|
+
`Role "${role.id}" references unknown agent holder resource "${holder.agentId}"`
|
|
2531
|
+
);
|
|
2532
|
+
return;
|
|
2533
|
+
}
|
|
2534
|
+
if (resource.kind !== "agent") {
|
|
2535
|
+
addIssue(
|
|
2536
|
+
ctx,
|
|
2537
|
+
["roles", role.id, "heldBy", Array.isArray(role.heldBy) ? holderIndex : "agentId"],
|
|
2538
|
+
`Role "${role.id}" agent holder "${holder.agentId}" must reference an agent resource`
|
|
2539
|
+
);
|
|
2540
|
+
}
|
|
2541
|
+
});
|
|
2542
|
+
});
|
|
2543
|
+
Object.entries(model.knowledge).forEach(([nodeId2, node]) => {
|
|
2544
|
+
node.ownerIds.forEach((roleId, ownerIndex) => {
|
|
2545
|
+
if (!rolesById.has(roleId)) {
|
|
2546
|
+
addIssue(
|
|
2547
|
+
ctx,
|
|
2548
|
+
["knowledge", nodeId2, "ownerIds", ownerIndex],
|
|
2549
|
+
`Knowledge node "${node.id}" references unknown owner role "${roleId}"`
|
|
2550
|
+
);
|
|
2551
|
+
}
|
|
2552
|
+
});
|
|
2553
|
+
});
|
|
2554
|
+
for (const diagnostic of ontologyCompilation.diagnostics) {
|
|
2555
|
+
addIssue(ctx, diagnostic.path, diagnostic.message);
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
// ../core/src/organization-model/schema.ts
|
|
2560
|
+
z.enum([
|
|
2561
|
+
"branding",
|
|
2562
|
+
"identity",
|
|
2563
|
+
"customers",
|
|
2564
|
+
"offerings",
|
|
2565
|
+
"roles",
|
|
2566
|
+
"goals",
|
|
2567
|
+
"systems",
|
|
2568
|
+
"ontology",
|
|
2569
|
+
"resources",
|
|
2570
|
+
"topology",
|
|
2571
|
+
"actions",
|
|
2572
|
+
"entities",
|
|
2573
|
+
"policies",
|
|
2574
|
+
"knowledge"
|
|
2575
|
+
]);
|
|
2576
|
+
var OrganizationModelDomainMetadataSchema = z.object({
|
|
2577
|
+
version: z.literal(1).default(1),
|
|
2578
|
+
lastModified: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastModified must be an ISO date string (YYYY-MM-DD)")
|
|
2579
|
+
});
|
|
2580
|
+
var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
2581
|
+
branding: { version: 1, lastModified: "2026-05-10" },
|
|
2582
|
+
identity: { version: 1, lastModified: "2026-05-10" },
|
|
2583
|
+
customers: { version: 1, lastModified: "2026-05-10" },
|
|
2584
|
+
offerings: { version: 1, lastModified: "2026-05-10" },
|
|
2585
|
+
roles: { version: 1, lastModified: "2026-05-10" },
|
|
2586
|
+
goals: { version: 1, lastModified: "2026-05-10" },
|
|
2587
|
+
systems: { version: 1, lastModified: "2026-05-10" },
|
|
2588
|
+
ontology: { version: 1, lastModified: "2026-05-14" },
|
|
2589
|
+
resources: { version: 1, lastModified: "2026-05-10" },
|
|
2590
|
+
topology: { version: 1, lastModified: "2026-05-14" },
|
|
2591
|
+
actions: { version: 1, lastModified: "2026-05-10" },
|
|
2592
|
+
entities: { version: 1, lastModified: "2026-05-10" },
|
|
2593
|
+
policies: { version: 1, lastModified: "2026-05-10" },
|
|
2594
|
+
knowledge: { version: 1, lastModified: "2026-05-10" }
|
|
2595
|
+
};
|
|
2596
|
+
var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
2597
|
+
branding: OrganizationModelDomainMetadataSchema,
|
|
2598
|
+
identity: OrganizationModelDomainMetadataSchema,
|
|
2599
|
+
customers: OrganizationModelDomainMetadataSchema,
|
|
2600
|
+
offerings: OrganizationModelDomainMetadataSchema,
|
|
2601
|
+
roles: OrganizationModelDomainMetadataSchema,
|
|
2602
|
+
goals: OrganizationModelDomainMetadataSchema,
|
|
2603
|
+
systems: OrganizationModelDomainMetadataSchema,
|
|
2604
|
+
ontology: OrganizationModelDomainMetadataSchema,
|
|
2605
|
+
resources: OrganizationModelDomainMetadataSchema,
|
|
2606
|
+
topology: OrganizationModelDomainMetadataSchema,
|
|
2607
|
+
actions: OrganizationModelDomainMetadataSchema,
|
|
2608
|
+
entities: OrganizationModelDomainMetadataSchema,
|
|
2609
|
+
policies: OrganizationModelDomainMetadataSchema,
|
|
2610
|
+
knowledge: OrganizationModelDomainMetadataSchema
|
|
2611
|
+
}).partial().default(DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA).transform((metadata) => ({ ...DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, ...metadata }));
|
|
2612
|
+
var OrganizationModelSchemaBase = z.object({
|
|
2613
|
+
version: z.literal(1).default(1),
|
|
2614
|
+
domainMetadata: OrganizationModelDomainMetadataByDomainSchema,
|
|
2615
|
+
branding: OrganizationModelBrandingSchema.default(DEFAULT_ORGANIZATION_MODEL_BRANDING),
|
|
2616
|
+
navigation: OrganizationModelNavigationSchema,
|
|
2617
|
+
identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
|
|
2618
|
+
customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
|
|
2619
|
+
offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
|
|
2620
|
+
roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
|
|
2621
|
+
goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
|
|
2622
|
+
systems: SystemsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_SYSTEMS),
|
|
2623
|
+
ontology: OntologyScopeSchema.default(DEFAULT_ONTOLOGY_SCOPE),
|
|
2624
|
+
resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
|
|
2625
|
+
topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
|
|
2626
|
+
actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
|
|
2627
|
+
entities: EntitiesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ENTITIES),
|
|
2628
|
+
policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
|
|
2629
|
+
// D3: flat Record<id, OrgKnowledgeNode> — no wrapper object
|
|
2630
|
+
knowledge: KnowledgeDomainSchema.default({})
|
|
2631
|
+
});
|
|
2632
|
+
var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine(refineOrganizationModel);
|
|
2633
|
+
|
|
2634
|
+
// ../core/src/organization-model/defaults.ts
|
|
2635
|
+
var DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE = {};
|
|
2636
|
+
var DEFAULT_ORGANIZATION_MODEL_ENTITIES2 = {};
|
|
2637
|
+
var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
2638
|
+
sidebar: {
|
|
2639
|
+
primary: {},
|
|
2640
|
+
bottom: {}
|
|
2641
|
+
}
|
|
2642
|
+
};
|
|
2643
|
+
var DEFAULT_ORGANIZATION_MODEL = {
|
|
2644
|
+
version: 1,
|
|
2645
|
+
domainMetadata: DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA,
|
|
2646
|
+
branding: DEFAULT_ORGANIZATION_MODEL_BRANDING,
|
|
2647
|
+
navigation: DEFAULT_ORGANIZATION_MODEL_NAVIGATION,
|
|
2648
|
+
identity: DEFAULT_ORGANIZATION_MODEL_IDENTITY,
|
|
2649
|
+
customers: DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
|
|
2650
|
+
offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
|
|
2651
|
+
roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
|
|
2652
|
+
goals: DEFAULT_ORGANIZATION_MODEL_GOALS,
|
|
2653
|
+
// Generic empty systems map. Elevasis-specific systems (platform, sales, sales.crm,
|
|
2654
|
+
// sales.lead-gen, monitoring, settings, admin, etc.) have been relocated to
|
|
2655
|
+
// `@repo/elevasis-core/src/organization-model/systems.ts` via `canonicalOrganizationModel`.
|
|
2656
|
+
// Tenant OM configs supply their own systems via `resolveOrganizationModel`.
|
|
2657
|
+
systems: {},
|
|
2658
|
+
ontology: DEFAULT_ONTOLOGY_SCOPE,
|
|
2659
|
+
resources: DEFAULT_ORGANIZATION_MODEL_RESOURCES,
|
|
2660
|
+
topology: DEFAULT_ORGANIZATION_MODEL_TOPOLOGY,
|
|
2661
|
+
// Generic empty actions map. Elevasis-specific action entries have been relocated to
|
|
2662
|
+
// `@repo/elevasis-core/src/organization-model/actions.ts`.
|
|
2663
|
+
actions: {},
|
|
2664
|
+
entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES2,
|
|
2665
|
+
policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
|
|
2666
|
+
knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
|
|
2667
|
+
};
|
|
2668
|
+
|
|
2669
|
+
// ../core/src/organization-model/resolve.ts
|
|
2670
|
+
function isPlainObject(value) {
|
|
2671
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2672
|
+
}
|
|
2673
|
+
function collectNestedSystemPaths(systems, prefix = "") {
|
|
2674
|
+
const paths = /* @__PURE__ */ new Set();
|
|
2675
|
+
for (const [key, value] of Object.entries(systems)) {
|
|
2676
|
+
if (!isPlainObject(value)) continue;
|
|
2677
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
2678
|
+
for (const childKey of ["systems", "subsystems"]) {
|
|
2679
|
+
const childSystems = value[childKey];
|
|
2680
|
+
if (!isPlainObject(childSystems)) continue;
|
|
2681
|
+
for (const childPath of collectNestedSystemPaths(childSystems, path)) {
|
|
2682
|
+
paths.add(childPath);
|
|
2683
|
+
}
|
|
2512
2684
|
}
|
|
2513
|
-
if (
|
|
2514
|
-
|
|
2515
|
-
ctx,
|
|
2516
|
-
["resources", resource.id, "actsAsRoleId"],
|
|
2517
|
-
`Agent resource "${resource.id}" references unknown actsAsRoleId "${resource.actsAsRoleId}"`
|
|
2518
|
-
);
|
|
2685
|
+
if (prefix !== "") {
|
|
2686
|
+
paths.add(path);
|
|
2519
2687
|
}
|
|
2520
|
-
});
|
|
2521
|
-
function validateResourceOntologyBinding(resourceId, bindingKey, expectedKind, ids) {
|
|
2522
|
-
const ontologyIds2 = ids === void 0 ? [] : Array.isArray(ids) ? ids : [ids];
|
|
2523
|
-
ontologyIds2.forEach((ontologyId, ontologyIndex) => {
|
|
2524
|
-
if (ontologyIndexByKind[expectedKind][ontologyId] === void 0) {
|
|
2525
|
-
addIssue(
|
|
2526
|
-
ctx,
|
|
2527
|
-
["resources", resourceId, "ontology", bindingKey, ...Array.isArray(ids) ? [ontologyIndex] : []],
|
|
2528
|
-
`Resource "${resourceId}" ontology binding "${bindingKey}" references unknown ${expectedKind} ontology ID "${ontologyId}"`
|
|
2529
|
-
);
|
|
2530
|
-
}
|
|
2531
|
-
});
|
|
2532
2688
|
}
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2689
|
+
return paths;
|
|
2690
|
+
}
|
|
2691
|
+
function pruneFlatSystemDescendantCollisions(base, override) {
|
|
2692
|
+
const result = { ...base };
|
|
2693
|
+
for (const nestedPath of collectNestedSystemPaths(override)) {
|
|
2694
|
+
delete result[nestedPath];
|
|
2695
|
+
}
|
|
2696
|
+
return result;
|
|
2697
|
+
}
|
|
2698
|
+
function deepMerge(base, override) {
|
|
2699
|
+
if (override === void 0) {
|
|
2700
|
+
return base;
|
|
2701
|
+
}
|
|
2702
|
+
if (Array.isArray(base)) {
|
|
2703
|
+
return override ?? base;
|
|
2704
|
+
}
|
|
2705
|
+
if (!isPlainObject(base) || !isPlainObject(override)) {
|
|
2706
|
+
return override ?? base;
|
|
2707
|
+
}
|
|
2708
|
+
const result = { ...base };
|
|
2709
|
+
for (const [key, value] of Object.entries(override)) {
|
|
2710
|
+
if (value === void 0) continue;
|
|
2711
|
+
const existing = result[key];
|
|
2712
|
+
if (key === "systems" && isPlainObject(existing) && isPlainObject(value)) {
|
|
2713
|
+
result[key] = deepMerge(pruneFlatSystemDescendantCollisions(existing, value), value);
|
|
2714
|
+
continue;
|
|
2558
2715
|
}
|
|
2559
|
-
|
|
2560
|
-
Object.values(model.roles).forEach((role) => {
|
|
2561
|
-
if (role.heldBy === void 0) return;
|
|
2562
|
-
asRoleHolderArray(role.heldBy).forEach((holder, holderIndex) => {
|
|
2563
|
-
if (holder.kind !== "agent") return;
|
|
2564
|
-
const resource = resourcesById.get(holder.agentId);
|
|
2565
|
-
if (resource === void 0) {
|
|
2566
|
-
addIssue(
|
|
2567
|
-
ctx,
|
|
2568
|
-
["roles", role.id, "heldBy", Array.isArray(role.heldBy) ? holderIndex : "agentId"],
|
|
2569
|
-
`Role "${role.id}" references unknown agent holder resource "${holder.agentId}"`
|
|
2570
|
-
);
|
|
2571
|
-
return;
|
|
2572
|
-
}
|
|
2573
|
-
if (resource.kind !== "agent") {
|
|
2574
|
-
addIssue(
|
|
2575
|
-
ctx,
|
|
2576
|
-
["roles", role.id, "heldBy", Array.isArray(role.heldBy) ? holderIndex : "agentId"],
|
|
2577
|
-
`Role "${role.id}" agent holder "${holder.agentId}" must reference an agent resource`
|
|
2578
|
-
);
|
|
2579
|
-
}
|
|
2580
|
-
});
|
|
2581
|
-
});
|
|
2582
|
-
Object.entries(model.knowledge).forEach(([nodeId2, node]) => {
|
|
2583
|
-
node.ownerIds.forEach((roleId, ownerIndex) => {
|
|
2584
|
-
if (!rolesById.has(roleId)) {
|
|
2585
|
-
addIssue(
|
|
2586
|
-
ctx,
|
|
2587
|
-
["knowledge", nodeId2, "ownerIds", ownerIndex],
|
|
2588
|
-
`Knowledge node "${node.id}" references unknown owner role "${roleId}"`
|
|
2589
|
-
);
|
|
2590
|
-
}
|
|
2591
|
-
});
|
|
2592
|
-
});
|
|
2593
|
-
for (const diagnostic of ontologyCompilation.diagnostics) {
|
|
2594
|
-
addIssue(ctx, diagnostic.path, diagnostic.message);
|
|
2716
|
+
result[key] = isPlainObject(existing) && isPlainObject(value) ? deepMerge(existing, value) : value;
|
|
2595
2717
|
}
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2718
|
+
return result;
|
|
2719
|
+
}
|
|
2720
|
+
function resolveOrganizationModel(override, organizationIdOrOptions, options) {
|
|
2721
|
+
const resolvedOptions = typeof organizationIdOrOptions === "object" ? organizationIdOrOptions : options;
|
|
2722
|
+
const mergeDefaults = resolvedOptions?.mergeDefaults ?? true;
|
|
2723
|
+
const merged = mergeDefaults ? deepMerge(DEFAULT_ORGANIZATION_MODEL, override) : override ?? {};
|
|
2724
|
+
return OrganizationModelSchema.parse(merged);
|
|
2725
|
+
}
|
|
2599
2726
|
var OrganizationGraphNodeKindSchema = z.enum([
|
|
2600
2727
|
"organization",
|
|
2601
2728
|
"system",
|
|
@@ -3523,99 +3650,6 @@ function buildOrganizationGraph(input) {
|
|
|
3523
3650
|
return OrganizationGraphSchema.parse(graph);
|
|
3524
3651
|
}
|
|
3525
3652
|
|
|
3526
|
-
// ../core/src/organization-model/defaults.ts
|
|
3527
|
-
var DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE = {};
|
|
3528
|
-
var DEFAULT_ORGANIZATION_MODEL_ENTITIES2 = {};
|
|
3529
|
-
var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
3530
|
-
sidebar: {
|
|
3531
|
-
primary: {},
|
|
3532
|
-
bottom: {}
|
|
3533
|
-
}
|
|
3534
|
-
};
|
|
3535
|
-
var DEFAULT_ORGANIZATION_MODEL = {
|
|
3536
|
-
version: 1,
|
|
3537
|
-
domainMetadata: DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA,
|
|
3538
|
-
branding: DEFAULT_ORGANIZATION_MODEL_BRANDING,
|
|
3539
|
-
navigation: DEFAULT_ORGANIZATION_MODEL_NAVIGATION,
|
|
3540
|
-
identity: DEFAULT_ORGANIZATION_MODEL_IDENTITY,
|
|
3541
|
-
customers: DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
|
|
3542
|
-
offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
|
|
3543
|
-
roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
|
|
3544
|
-
goals: DEFAULT_ORGANIZATION_MODEL_GOALS,
|
|
3545
|
-
// Generic empty systems map. Elevasis-specific systems (platform, sales, sales.crm,
|
|
3546
|
-
// sales.lead-gen, monitoring, settings, admin, etc.) have been relocated to
|
|
3547
|
-
// `@repo/elevasis-core/src/organization-model/systems.ts` via `canonicalOrganizationModel`.
|
|
3548
|
-
// Tenant OM configs supply their own systems via `resolveOrganizationModel`.
|
|
3549
|
-
systems: {},
|
|
3550
|
-
ontology: DEFAULT_ONTOLOGY_SCOPE,
|
|
3551
|
-
resources: DEFAULT_ORGANIZATION_MODEL_RESOURCES,
|
|
3552
|
-
topology: DEFAULT_ORGANIZATION_MODEL_TOPOLOGY,
|
|
3553
|
-
// Generic empty actions map. Elevasis-specific action entries have been relocated to
|
|
3554
|
-
// `@repo/elevasis-core/src/organization-model/actions.ts`.
|
|
3555
|
-
actions: {},
|
|
3556
|
-
entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES2,
|
|
3557
|
-
policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
|
|
3558
|
-
knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
|
|
3559
|
-
};
|
|
3560
|
-
|
|
3561
|
-
// ../core/src/organization-model/resolve.ts
|
|
3562
|
-
function isPlainObject(value) {
|
|
3563
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3564
|
-
}
|
|
3565
|
-
function collectNestedSystemPaths(systems, prefix = "") {
|
|
3566
|
-
const paths = /* @__PURE__ */ new Set();
|
|
3567
|
-
for (const [key, value] of Object.entries(systems)) {
|
|
3568
|
-
if (!isPlainObject(value)) continue;
|
|
3569
|
-
const path = prefix ? `${prefix}.${key}` : key;
|
|
3570
|
-
for (const childKey of ["systems", "subsystems"]) {
|
|
3571
|
-
const childSystems = value[childKey];
|
|
3572
|
-
if (!isPlainObject(childSystems)) continue;
|
|
3573
|
-
for (const childPath of collectNestedSystemPaths(childSystems, path)) {
|
|
3574
|
-
paths.add(childPath);
|
|
3575
|
-
}
|
|
3576
|
-
}
|
|
3577
|
-
if (prefix !== "") {
|
|
3578
|
-
paths.add(path);
|
|
3579
|
-
}
|
|
3580
|
-
}
|
|
3581
|
-
return paths;
|
|
3582
|
-
}
|
|
3583
|
-
function pruneFlatSystemDescendantCollisions(base, override) {
|
|
3584
|
-
const result = { ...base };
|
|
3585
|
-
for (const nestedPath of collectNestedSystemPaths(override)) {
|
|
3586
|
-
delete result[nestedPath];
|
|
3587
|
-
}
|
|
3588
|
-
return result;
|
|
3589
|
-
}
|
|
3590
|
-
function deepMerge(base, override) {
|
|
3591
|
-
if (override === void 0) {
|
|
3592
|
-
return base;
|
|
3593
|
-
}
|
|
3594
|
-
if (Array.isArray(base)) {
|
|
3595
|
-
return override ?? base;
|
|
3596
|
-
}
|
|
3597
|
-
if (!isPlainObject(base) || !isPlainObject(override)) {
|
|
3598
|
-
return override ?? base;
|
|
3599
|
-
}
|
|
3600
|
-
const result = { ...base };
|
|
3601
|
-
for (const [key, value] of Object.entries(override)) {
|
|
3602
|
-
if (value === void 0) continue;
|
|
3603
|
-
const existing = result[key];
|
|
3604
|
-
if (key === "systems" && isPlainObject(existing) && isPlainObject(value)) {
|
|
3605
|
-
result[key] = deepMerge(pruneFlatSystemDescendantCollisions(existing, value), value);
|
|
3606
|
-
continue;
|
|
3607
|
-
}
|
|
3608
|
-
result[key] = isPlainObject(existing) && isPlainObject(value) ? deepMerge(existing, value) : value;
|
|
3609
|
-
}
|
|
3610
|
-
return result;
|
|
3611
|
-
}
|
|
3612
|
-
function resolveOrganizationModel(override, organizationIdOrOptions, options) {
|
|
3613
|
-
const resolvedOptions = typeof organizationIdOrOptions === "object" ? organizationIdOrOptions : options;
|
|
3614
|
-
const mergeDefaults = resolvedOptions?.mergeDefaults ?? true;
|
|
3615
|
-
const merged = mergeDefaults ? deepMerge(DEFAULT_ORGANIZATION_MODEL, override) : override ?? {};
|
|
3616
|
-
return OrganizationModelSchema.parse(merged);
|
|
3617
|
-
}
|
|
3618
|
-
|
|
3619
3653
|
// ../core/src/organization-model/surface-projection.ts
|
|
3620
3654
|
function collectSystemsById(model) {
|
|
3621
3655
|
const systemsById = /* @__PURE__ */ new Map();
|
|
@@ -3714,22 +3748,6 @@ z.object({
|
|
|
3714
3748
|
function findPipeline(definitions, pipelineKey) {
|
|
3715
3749
|
return definitions.find((def) => def.pipelineKey === pipelineKey);
|
|
3716
3750
|
}
|
|
3717
|
-
var CRM_DISCOVERY_REPLIED_STATE = {
|
|
3718
|
-
stateKey: "discovery_replied",
|
|
3719
|
-
label: "Discovery Replied"
|
|
3720
|
-
};
|
|
3721
|
-
var CRM_DISCOVERY_LINK_SENT_STATE = {
|
|
3722
|
-
stateKey: "discovery_link_sent",
|
|
3723
|
-
label: "Discovery Link Sent"
|
|
3724
|
-
};
|
|
3725
|
-
var CRM_DISCOVERY_NUDGING_STATE = {
|
|
3726
|
-
stateKey: "discovery_nudging",
|
|
3727
|
-
label: "Discovery Nudging"
|
|
3728
|
-
};
|
|
3729
|
-
var CRM_DISCOVERY_BOOKING_CANCELLED_STATE = {
|
|
3730
|
-
stateKey: "discovery_booking_cancelled",
|
|
3731
|
-
label: "Discovery Booking Cancelled"
|
|
3732
|
-
};
|
|
3733
3751
|
DisplayMetadataSchema.extend({
|
|
3734
3752
|
id: ModelIdSchema,
|
|
3735
3753
|
order: z.number().min(0)
|
|
@@ -4088,4 +4106,4 @@ var PROSPECTING_STEPS = {
|
|
|
4088
4106
|
}
|
|
4089
4107
|
};
|
|
4090
4108
|
|
|
4091
|
-
export { ActionSchema, AgentResourceEntrySchema,
|
|
4109
|
+
export { ActionSchema, AgentResourceEntrySchema, DEFAULT_SEMANTIC_ICON_REGISTRY, EntitySchema, IdentityDomainSchema, IntegrationResourceEntrySchema, OntologyIdSchema, OrgKnowledgeNodeSchema, PROJECTS_VIEW_ACTION_ID, PROSPECTING_STEPS, PolicySchema, RoleSchema, ScriptResourceEntrySchema, SemanticIcon, SurfaceDefinitionSchema, SystemEntrySchema, WorkflowResourceEntrySchema, ancestorsOf, buildOrganizationGraph, childrenOf, compileOrganizationOntology, defaultPathFor, defineResources, defineTopology, devOnlyFor, extendSemanticIconRegistry, findById, findByPath, findPipeline, getLeadGenStageCatalog, getResourcesForSystem, getSemanticIconComponent, getSortedSidebarEntries, getSystem, getSystemAncestors, listAllSystems, ontologyGraphNodeId, parentOf, parseOntologyId, projectOrganizationSurfaces, requiresAdminFor, resolveOrganizationModel, resolveSemanticIconComponent, resolveSystemConfig, topLevel, topologyRef, topologyRelationship };
|