@elevasis/core 0.26.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 +5 -5
- package/dist/index.js +209 -173
- package/dist/knowledge/index.d.ts +21 -21
- package/dist/organization-model/index.d.ts +5 -5
- package/dist/organization-model/index.js +209 -173
- package/dist/test-utils/index.d.ts +2 -2
- package/dist/test-utils/index.js +182 -126
- package/package.json +1 -1
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +976 -1063
- package/src/business/acquisition/api-schemas.test.ts +1962 -1841
- package/src/business/acquisition/api-schemas.ts +1461 -1464
- 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 +90 -13
- package/src/business/acquisition/derive-actions.ts +8 -139
- package/src/business/acquisition/ontology-validation.ts +72 -158
- 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/organization-model/__tests__/cross-ref.test.ts +167 -0
- package/src/organization-model/__tests__/published-zero-leak.test.ts +60 -1
- package/src/organization-model/__tests__/resolve.test.ts +1 -1
- package/src/organization-model/__tests__/schema-refinements.test.ts +72 -0
- package/src/organization-model/cross-ref.ts +175 -0
- package/src/organization-model/domains/branding.ts +6 -6
- package/src/organization-model/domains/sales.test.ts +104 -218
- package/src/organization-model/domains/sales.ts +212 -375
- package/src/organization-model/index.ts +1 -0
- package/src/organization-model/schema-refinements.ts +667 -0
- package/src/organization-model/schema.ts +8 -715
- package/src/reference/_generated/contracts.md +976 -1063
|
@@ -505,8 +505,8 @@ var OrganizationModelBrandingSchema = z.object({
|
|
|
505
505
|
});
|
|
506
506
|
var DEFAULT_ORGANIZATION_MODEL_BRANDING = {
|
|
507
507
|
organizationName: "Default Organization",
|
|
508
|
-
productName: "
|
|
509
|
-
shortName: "
|
|
508
|
+
productName: "Organization OS",
|
|
509
|
+
shortName: "Org OS",
|
|
510
510
|
logos: {}
|
|
511
511
|
};
|
|
512
512
|
var SurfaceTypeSchema = z.enum(["page", "dashboard", "graph", "detail", "list", "settings"]).meta({ label: "Surface type", color: "blue" });
|
|
@@ -1639,79 +1639,133 @@ var PoliciesDomainSchema = z.record(z.string(), PolicySchema).refine((record) =>
|
|
|
1639
1639
|
}).default({});
|
|
1640
1640
|
var DEFAULT_ORGANIZATION_MODEL_POLICIES = {};
|
|
1641
1641
|
|
|
1642
|
-
// src/organization-model/
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
"
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
]
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
});
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1642
|
+
// src/organization-model/helpers.ts
|
|
1643
|
+
function childSystemsOf2(system) {
|
|
1644
|
+
return system.systems ?? system.subsystems ?? {};
|
|
1645
|
+
}
|
|
1646
|
+
function getSystem(model, path) {
|
|
1647
|
+
const segments = path.split(".");
|
|
1648
|
+
let current = model.systems;
|
|
1649
|
+
let node;
|
|
1650
|
+
for (const seg of segments) {
|
|
1651
|
+
node = current[seg];
|
|
1652
|
+
if (node === void 0) return void 0;
|
|
1653
|
+
current = childSystemsOf2(node);
|
|
1654
|
+
}
|
|
1655
|
+
return node;
|
|
1656
|
+
}
|
|
1657
|
+
function listAllSystems(model) {
|
|
1658
|
+
const results = [];
|
|
1659
|
+
function walk(map, prefix) {
|
|
1660
|
+
for (const [localId, system] of Object.entries(map)) {
|
|
1661
|
+
const fullPath = prefix ? `${prefix}.${localId}` : localId;
|
|
1662
|
+
results.push({ path: fullPath, system });
|
|
1663
|
+
const childSystems = childSystemsOf2(system);
|
|
1664
|
+
if (Object.keys(childSystems).length > 0) {
|
|
1665
|
+
walk(childSystems, fullPath);
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
walk(model.systems, "");
|
|
1670
|
+
return results;
|
|
1671
|
+
}
|
|
1672
|
+
function isPlainJsonObject(value) {
|
|
1673
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1674
|
+
}
|
|
1675
|
+
function mergeJsonConfig(base, override) {
|
|
1676
|
+
const result = { ...base };
|
|
1677
|
+
for (const [key, value] of Object.entries(override)) {
|
|
1678
|
+
const existing = result[key];
|
|
1679
|
+
result[key] = isPlainJsonObject(existing) && isPlainJsonObject(value) ? mergeJsonConfig(existing, value) : value;
|
|
1680
|
+
}
|
|
1681
|
+
return result;
|
|
1682
|
+
}
|
|
1683
|
+
function resolveSystemConfig(model, path) {
|
|
1684
|
+
const system = getSystem(model, path);
|
|
1685
|
+
if (system === void 0) return {};
|
|
1686
|
+
return mergeJsonConfig({}, system.config ?? {});
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
// src/organization-model/cross-ref.ts
|
|
1690
|
+
var ONTOLOGY_REFERENCE_KEY_KINDS = {
|
|
1691
|
+
valueType: "value-type",
|
|
1692
|
+
catalogType: "catalog",
|
|
1693
|
+
objectType: "object",
|
|
1694
|
+
eventType: "event",
|
|
1695
|
+
actionType: "action",
|
|
1696
|
+
linkType: "link",
|
|
1697
|
+
interfaceType: "interface",
|
|
1698
|
+
propertyType: "property",
|
|
1699
|
+
groupType: "group",
|
|
1700
|
+
surfaceType: "surface",
|
|
1701
|
+
stepCatalog: "catalog"
|
|
1678
1702
|
};
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
}
|
|
1703
|
+
function buildOmCrossRefIndex(model) {
|
|
1704
|
+
const systemsById = /* @__PURE__ */ new Map();
|
|
1705
|
+
for (const { path, system } of listAllSystems(model)) {
|
|
1706
|
+
systemsById.set(path, system);
|
|
1707
|
+
systemsById.set(system.id, system);
|
|
1708
|
+
}
|
|
1709
|
+
const resourceIds = new Set(Object.keys(model.resources ?? {}));
|
|
1710
|
+
const knowledgeIds = new Set(Object.keys(model.knowledge ?? {}));
|
|
1711
|
+
const roleIds = new Set(Object.keys(model.roles ?? {}));
|
|
1712
|
+
const goalIds = new Set(Object.keys(model.goals ?? {}));
|
|
1713
|
+
const actionIds = new Set(Object.keys(model.actions ?? {}));
|
|
1714
|
+
const customerSegmentIds = new Set(Object.keys(model.customers ?? {}));
|
|
1715
|
+
const offeringIds = new Set(Object.keys(model.offerings ?? {}));
|
|
1716
|
+
const ontologyCompilation = compileOrganizationOntology(model);
|
|
1717
|
+
const ontologyIndexByKind = {
|
|
1718
|
+
object: ontologyCompilation.ontology.objectTypes,
|
|
1719
|
+
link: ontologyCompilation.ontology.linkTypes,
|
|
1720
|
+
action: ontologyCompilation.ontology.actionTypes,
|
|
1721
|
+
catalog: ontologyCompilation.ontology.catalogTypes,
|
|
1722
|
+
event: ontologyCompilation.ontology.eventTypes,
|
|
1723
|
+
interface: ontologyCompilation.ontology.interfaceTypes,
|
|
1724
|
+
"value-type": ontologyCompilation.ontology.valueTypes,
|
|
1725
|
+
property: ontologyCompilation.ontology.sharedProperties,
|
|
1726
|
+
group: ontologyCompilation.ontology.groups,
|
|
1727
|
+
surface: ontologyCompilation.ontology.surfaces
|
|
1728
|
+
};
|
|
1729
|
+
const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
|
|
1730
|
+
const stageIds = /* @__PURE__ */ new Set();
|
|
1731
|
+
for (const catalog of Object.values(ontologyCompilation.ontology.catalogTypes)) {
|
|
1732
|
+
if (catalog.kind !== "stage") continue;
|
|
1733
|
+
const entries = catalog.entries;
|
|
1734
|
+
if (entries !== void 0) {
|
|
1735
|
+
for (const stageId of Object.keys(entries)) {
|
|
1736
|
+
stageIds.add(stageId);
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
return {
|
|
1741
|
+
systemsById,
|
|
1742
|
+
resourceIds,
|
|
1743
|
+
knowledgeIds,
|
|
1744
|
+
roleIds,
|
|
1745
|
+
goalIds,
|
|
1746
|
+
actionIds,
|
|
1747
|
+
customerSegmentIds,
|
|
1748
|
+
offeringIds,
|
|
1749
|
+
ontologyIds,
|
|
1750
|
+
ontologyIndexByKind,
|
|
1751
|
+
stageIds
|
|
1752
|
+
};
|
|
1753
|
+
}
|
|
1754
|
+
function knowledgeTargetExists(index, kind, id) {
|
|
1755
|
+
if (kind === "system") return index.systemsById.has(id);
|
|
1756
|
+
if (kind === "resource") return index.resourceIds.has(id);
|
|
1757
|
+
if (kind === "knowledge") return index.knowledgeIds.has(id);
|
|
1758
|
+
if (kind === "stage") return index.stageIds.has(id);
|
|
1759
|
+
if (kind === "action") return index.actionIds.has(id);
|
|
1760
|
+
if (kind === "role") return index.roleIds.has(id);
|
|
1761
|
+
if (kind === "goal") return index.goalIds.has(id);
|
|
1762
|
+
if (kind === "customer-segment") return index.customerSegmentIds.has(id);
|
|
1763
|
+
if (kind === "offering") return index.offeringIds.has(id);
|
|
1764
|
+
if (kind === "ontology") return index.ontologyIds.has(id);
|
|
1765
|
+
return false;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
// src/organization-model/schema-refinements.ts
|
|
1715
1769
|
function addIssue(ctx, path, message) {
|
|
1716
1770
|
ctx.addIssue({
|
|
1717
1771
|
code: z.ZodIssueCode.custom,
|
|
@@ -1742,7 +1796,7 @@ function isKnowledgeKindCompatibleWithTarget(knowledgeKind, targetKind) {
|
|
|
1742
1796
|
function isRecord(value) {
|
|
1743
1797
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1744
1798
|
}
|
|
1745
|
-
|
|
1799
|
+
function refineOrganizationModel(model, ctx) {
|
|
1746
1800
|
function collectAllSystems(systems, prefix = "", schemaPath = ["systems"]) {
|
|
1747
1801
|
const result = [];
|
|
1748
1802
|
for (const [key, system] of Object.entries(systems)) {
|
|
@@ -1914,7 +1968,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
1914
1968
|
});
|
|
1915
1969
|
});
|
|
1916
1970
|
Object.values(model.entities).forEach((entity) => {
|
|
1917
|
-
if (!systemsById.has(entity.ownedBySystemId)) {
|
|
1971
|
+
if (systemsById.size > 0 && !systemsById.has(entity.ownedBySystemId)) {
|
|
1918
1972
|
addIssue(
|
|
1919
1973
|
ctx,
|
|
1920
1974
|
["entities", entity.id, "ownedBySystemId"],
|
|
@@ -2032,29 +2086,9 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2032
2086
|
}
|
|
2033
2087
|
});
|
|
2034
2088
|
});
|
|
2035
|
-
const
|
|
2036
|
-
const
|
|
2089
|
+
const idx = buildOmCrossRefIndex(model);
|
|
2090
|
+
const { ontologyIndexByKind, ontologyIds } = idx;
|
|
2037
2091
|
const ontologyCompilation = compileOrganizationOntology(model);
|
|
2038
|
-
const stageIds = /* @__PURE__ */ new Set();
|
|
2039
|
-
for (const catalog of Object.values(ontologyCompilation.ontology.catalogTypes)) {
|
|
2040
|
-
if (catalog.kind !== "stage") continue;
|
|
2041
|
-
for (const stageId of Object.keys(catalog.entries ?? {})) {
|
|
2042
|
-
stageIds.add(stageId);
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
const ontologyIndexByKind = {
|
|
2046
|
-
object: ontologyCompilation.ontology.objectTypes,
|
|
2047
|
-
link: ontologyCompilation.ontology.linkTypes,
|
|
2048
|
-
action: ontologyCompilation.ontology.actionTypes,
|
|
2049
|
-
catalog: ontologyCompilation.ontology.catalogTypes,
|
|
2050
|
-
event: ontologyCompilation.ontology.eventTypes,
|
|
2051
|
-
interface: ontologyCompilation.ontology.interfaceTypes,
|
|
2052
|
-
"value-type": ontologyCompilation.ontology.valueTypes,
|
|
2053
|
-
property: ontologyCompilation.ontology.sharedProperties,
|
|
2054
|
-
group: ontologyCompilation.ontology.groups,
|
|
2055
|
-
surface: ontologyCompilation.ontology.surfaces
|
|
2056
|
-
};
|
|
2057
|
-
const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
|
|
2058
2092
|
function topologyTargetExists(ref) {
|
|
2059
2093
|
if (ref.kind === "system") return systemsById.has(ref.id);
|
|
2060
2094
|
if (ref.kind === "resource") return resourcesById.has(ref.id);
|
|
@@ -2074,19 +2108,6 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2074
2108
|
);
|
|
2075
2109
|
});
|
|
2076
2110
|
});
|
|
2077
|
-
const ontologyReferenceKeyKinds = {
|
|
2078
|
-
valueType: "value-type",
|
|
2079
|
-
catalogType: "catalog",
|
|
2080
|
-
objectType: "object",
|
|
2081
|
-
eventType: "event",
|
|
2082
|
-
actionType: "action",
|
|
2083
|
-
linkType: "link",
|
|
2084
|
-
interfaceType: "interface",
|
|
2085
|
-
propertyType: "property",
|
|
2086
|
-
groupType: "group",
|
|
2087
|
-
surfaceType: "surface",
|
|
2088
|
-
stepCatalog: "catalog"
|
|
2089
|
-
};
|
|
2090
2111
|
function validateKnownOntologyReferences(ownerId, value, path, seen = /* @__PURE__ */ new WeakSet()) {
|
|
2091
2112
|
if (Array.isArray(value)) {
|
|
2092
2113
|
value.forEach((entry, index) => validateKnownOntologyReferences(ownerId, entry, [...path, index], seen));
|
|
@@ -2096,7 +2117,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2096
2117
|
if (seen.has(value)) return;
|
|
2097
2118
|
seen.add(value);
|
|
2098
2119
|
Object.entries(value).forEach(([key, entry]) => {
|
|
2099
|
-
const expectedKind =
|
|
2120
|
+
const expectedKind = ONTOLOGY_REFERENCE_KEY_KINDS[key];
|
|
2100
2121
|
if (expectedKind !== void 0) {
|
|
2101
2122
|
if (typeof entry !== "string") {
|
|
2102
2123
|
addIssue(ctx, [...path, key], `Ontology record "${ownerId}" ${key} must be an ontology ID string`);
|
|
@@ -2157,22 +2178,9 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2157
2178
|
);
|
|
2158
2179
|
}
|
|
2159
2180
|
});
|
|
2160
|
-
function knowledgeTargetExists(kind, id) {
|
|
2161
|
-
if (kind === "system") return systemsById.has(id);
|
|
2162
|
-
if (kind === "resource") return resourcesById.has(id);
|
|
2163
|
-
if (kind === "knowledge") return knowledgeById.has(id);
|
|
2164
|
-
if (kind === "stage") return stageIds.has(id);
|
|
2165
|
-
if (kind === "action") return actionIds.has(id);
|
|
2166
|
-
if (kind === "role") return rolesById.has(id);
|
|
2167
|
-
if (kind === "goal") return goalsById.has(id);
|
|
2168
|
-
if (kind === "customer-segment") return segmentsById.has(id);
|
|
2169
|
-
if (kind === "offering") return offeringsById.has(id);
|
|
2170
|
-
if (kind === "ontology") return ontologyIds.has(id);
|
|
2171
|
-
return false;
|
|
2172
|
-
}
|
|
2173
2181
|
Object.entries(model.knowledge).forEach(([nodeId, node]) => {
|
|
2174
2182
|
node.links.forEach((link, linkIndex) => {
|
|
2175
|
-
if (!knowledgeTargetExists(link.target.kind, link.target.id)) {
|
|
2183
|
+
if (!knowledgeTargetExists(idx, link.target.kind, link.target.id)) {
|
|
2176
2184
|
addIssue(
|
|
2177
2185
|
ctx,
|
|
2178
2186
|
["knowledge", nodeId, "links", linkIndex, "target"],
|
|
@@ -2286,7 +2294,82 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2286
2294
|
for (const diagnostic of ontologyCompilation.diagnostics) {
|
|
2287
2295
|
addIssue(ctx, diagnostic.path, diagnostic.message);
|
|
2288
2296
|
}
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
// src/organization-model/schema.ts
|
|
2300
|
+
var OrganizationModelDomainKeySchema = z.enum([
|
|
2301
|
+
"branding",
|
|
2302
|
+
"identity",
|
|
2303
|
+
"customers",
|
|
2304
|
+
"offerings",
|
|
2305
|
+
"roles",
|
|
2306
|
+
"goals",
|
|
2307
|
+
"systems",
|
|
2308
|
+
"ontology",
|
|
2309
|
+
"resources",
|
|
2310
|
+
"topology",
|
|
2311
|
+
"actions",
|
|
2312
|
+
"entities",
|
|
2313
|
+
"policies",
|
|
2314
|
+
"knowledge"
|
|
2315
|
+
]);
|
|
2316
|
+
var OrganizationModelDomainMetadataSchema = z.object({
|
|
2317
|
+
version: z.literal(1).default(1),
|
|
2318
|
+
lastModified: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastModified must be an ISO date string (YYYY-MM-DD)")
|
|
2289
2319
|
});
|
|
2320
|
+
var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
2321
|
+
branding: { version: 1, lastModified: "2026-05-10" },
|
|
2322
|
+
identity: { version: 1, lastModified: "2026-05-10" },
|
|
2323
|
+
customers: { version: 1, lastModified: "2026-05-10" },
|
|
2324
|
+
offerings: { version: 1, lastModified: "2026-05-10" },
|
|
2325
|
+
roles: { version: 1, lastModified: "2026-05-10" },
|
|
2326
|
+
goals: { version: 1, lastModified: "2026-05-10" },
|
|
2327
|
+
systems: { version: 1, lastModified: "2026-05-10" },
|
|
2328
|
+
ontology: { version: 1, lastModified: "2026-05-14" },
|
|
2329
|
+
resources: { version: 1, lastModified: "2026-05-10" },
|
|
2330
|
+
topology: { version: 1, lastModified: "2026-05-14" },
|
|
2331
|
+
actions: { version: 1, lastModified: "2026-05-10" },
|
|
2332
|
+
entities: { version: 1, lastModified: "2026-05-10" },
|
|
2333
|
+
policies: { version: 1, lastModified: "2026-05-10" },
|
|
2334
|
+
knowledge: { version: 1, lastModified: "2026-05-10" }
|
|
2335
|
+
};
|
|
2336
|
+
var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
2337
|
+
branding: OrganizationModelDomainMetadataSchema,
|
|
2338
|
+
identity: OrganizationModelDomainMetadataSchema,
|
|
2339
|
+
customers: OrganizationModelDomainMetadataSchema,
|
|
2340
|
+
offerings: OrganizationModelDomainMetadataSchema,
|
|
2341
|
+
roles: OrganizationModelDomainMetadataSchema,
|
|
2342
|
+
goals: OrganizationModelDomainMetadataSchema,
|
|
2343
|
+
systems: OrganizationModelDomainMetadataSchema,
|
|
2344
|
+
ontology: OrganizationModelDomainMetadataSchema,
|
|
2345
|
+
resources: OrganizationModelDomainMetadataSchema,
|
|
2346
|
+
topology: OrganizationModelDomainMetadataSchema,
|
|
2347
|
+
actions: OrganizationModelDomainMetadataSchema,
|
|
2348
|
+
entities: OrganizationModelDomainMetadataSchema,
|
|
2349
|
+
policies: OrganizationModelDomainMetadataSchema,
|
|
2350
|
+
knowledge: OrganizationModelDomainMetadataSchema
|
|
2351
|
+
}).partial().default(DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA).transform((metadata) => ({ ...DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, ...metadata }));
|
|
2352
|
+
var OrganizationModelSchemaBase = z.object({
|
|
2353
|
+
version: z.literal(1).default(1),
|
|
2354
|
+
domainMetadata: OrganizationModelDomainMetadataByDomainSchema,
|
|
2355
|
+
branding: OrganizationModelBrandingSchema.default(DEFAULT_ORGANIZATION_MODEL_BRANDING),
|
|
2356
|
+
navigation: OrganizationModelNavigationSchema,
|
|
2357
|
+
identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
|
|
2358
|
+
customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
|
|
2359
|
+
offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
|
|
2360
|
+
roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
|
|
2361
|
+
goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
|
|
2362
|
+
systems: SystemsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_SYSTEMS),
|
|
2363
|
+
ontology: OntologyScopeSchema.default(DEFAULT_ONTOLOGY_SCOPE),
|
|
2364
|
+
resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
|
|
2365
|
+
topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
|
|
2366
|
+
actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
|
|
2367
|
+
entities: EntitiesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ENTITIES),
|
|
2368
|
+
policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
|
|
2369
|
+
// D3: flat Record<id, OrgKnowledgeNode> — no wrapper object
|
|
2370
|
+
knowledge: KnowledgeDomainSchema.default({})
|
|
2371
|
+
});
|
|
2372
|
+
var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine(refineOrganizationModel);
|
|
2290
2373
|
var OrganizationGraphNodeKindSchema = z.enum([
|
|
2291
2374
|
"organization",
|
|
2292
2375
|
"system",
|
|
@@ -2721,53 +2804,6 @@ var DEFAULT_ORGANIZATION_MODEL_STATUSES = {
|
|
|
2721
2804
|
}
|
|
2722
2805
|
};
|
|
2723
2806
|
|
|
2724
|
-
// src/organization-model/helpers.ts
|
|
2725
|
-
function childSystemsOf2(system) {
|
|
2726
|
-
return system.systems ?? system.subsystems ?? {};
|
|
2727
|
-
}
|
|
2728
|
-
function getSystem(model, path) {
|
|
2729
|
-
const segments = path.split(".");
|
|
2730
|
-
let current = model.systems;
|
|
2731
|
-
let node;
|
|
2732
|
-
for (const seg of segments) {
|
|
2733
|
-
node = current[seg];
|
|
2734
|
-
if (node === void 0) return void 0;
|
|
2735
|
-
current = childSystemsOf2(node);
|
|
2736
|
-
}
|
|
2737
|
-
return node;
|
|
2738
|
-
}
|
|
2739
|
-
function listAllSystems(model) {
|
|
2740
|
-
const results = [];
|
|
2741
|
-
function walk(map, prefix) {
|
|
2742
|
-
for (const [localId, system] of Object.entries(map)) {
|
|
2743
|
-
const fullPath = prefix ? `${prefix}.${localId}` : localId;
|
|
2744
|
-
results.push({ path: fullPath, system });
|
|
2745
|
-
const childSystems = childSystemsOf2(system);
|
|
2746
|
-
if (Object.keys(childSystems).length > 0) {
|
|
2747
|
-
walk(childSystems, fullPath);
|
|
2748
|
-
}
|
|
2749
|
-
}
|
|
2750
|
-
}
|
|
2751
|
-
walk(model.systems, "");
|
|
2752
|
-
return results;
|
|
2753
|
-
}
|
|
2754
|
-
function isPlainJsonObject(value) {
|
|
2755
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2756
|
-
}
|
|
2757
|
-
function mergeJsonConfig(base, override) {
|
|
2758
|
-
const result = { ...base };
|
|
2759
|
-
for (const [key, value] of Object.entries(override)) {
|
|
2760
|
-
const existing = result[key];
|
|
2761
|
-
result[key] = isPlainJsonObject(existing) && isPlainJsonObject(value) ? mergeJsonConfig(existing, value) : value;
|
|
2762
|
-
}
|
|
2763
|
-
return result;
|
|
2764
|
-
}
|
|
2765
|
-
function resolveSystemConfig(model, path) {
|
|
2766
|
-
const system = getSystem(model, path);
|
|
2767
|
-
if (system === void 0) return {};
|
|
2768
|
-
return mergeJsonConfig({}, system.config ?? {});
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
2807
|
// src/organization-model/resolve.ts
|
|
2772
2808
|
function isPlainObject(value) {
|
|
2773
2809
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -3929,7 +3929,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
3929
3929
|
lastModified: string;
|
|
3930
3930
|
} | undefined;
|
|
3931
3931
|
}>>;
|
|
3932
|
-
branding: z.ZodObject<{
|
|
3932
|
+
branding: z.ZodDefault<z.ZodObject<{
|
|
3933
3933
|
organizationName: z.ZodString;
|
|
3934
3934
|
productName: z.ZodString;
|
|
3935
3935
|
shortName: z.ZodString;
|
|
@@ -3938,7 +3938,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
3938
3938
|
light: z.ZodOptional<z.ZodString>;
|
|
3939
3939
|
dark: z.ZodOptional<z.ZodString>;
|
|
3940
3940
|
}, z.core.$strip>>;
|
|
3941
|
-
}, z.core.$strip
|
|
3941
|
+
}, z.core.$strip>>;
|
|
3942
3942
|
navigation: z.ZodDefault<z.ZodObject<{
|
|
3943
3943
|
sidebar: z.ZodDefault<z.ZodObject<{
|
|
3944
3944
|
primary: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<SidebarNode, unknown, z.core.$ZodTypeInternals<SidebarNode, unknown>>>>;
|