@elevasis/core 0.24.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3192 -2313
- package/dist/index.js +243 -13
- package/dist/knowledge/index.d.ts +92 -6
- package/dist/organization-model/index.d.ts +3192 -2313
- package/dist/organization-model/index.js +243 -13
- package/dist/test-utils/index.d.ts +134 -45
- package/dist/test-utils/index.js +118 -11
- package/package.json +3 -3
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +45 -7
- package/src/execution/engine/workflow/types.ts +5 -7
- package/src/organization-model/__tests__/domains/resources.test.ts +19 -8
- package/src/organization-model/__tests__/domains/topology.test.ts +188 -0
- package/src/organization-model/__tests__/graph.test.ts +98 -7
- package/src/organization-model/__tests__/schema.test.ts +14 -4
- package/src/organization-model/defaults.ts +2 -0
- package/src/organization-model/domains/resources.ts +63 -20
- package/src/organization-model/domains/topology.ts +261 -0
- package/src/organization-model/graph/build.ts +63 -15
- package/src/organization-model/graph/schema.ts +4 -3
- package/src/organization-model/graph/types.ts +5 -4
- package/src/organization-model/index.ts +4 -3
- package/src/organization-model/ontology.ts +2 -5
- package/src/organization-model/organization-model.mdx +16 -11
- package/src/organization-model/published.ts +36 -13
- package/src/organization-model/schema.ts +51 -11
- package/src/organization-model/types.ts +25 -11
- package/src/platform/registry/__tests__/validation.test.ts +199 -14
- package/src/platform/registry/resource-registry.ts +11 -11
- package/src/platform/registry/validation.ts +226 -34
- package/src/reference/_generated/contracts.md +45 -7
- package/src/reference/glossary.md +3 -3
- package/src/supabase/database.types.ts +3156 -3153
|
@@ -281,7 +281,6 @@ function addLegacyEntityProjections(index, diagnostics, sourcesById, entities) {
|
|
|
281
281
|
table: entity.table
|
|
282
282
|
}
|
|
283
283
|
} : {},
|
|
284
|
-
legacyEntityId: entity.id,
|
|
285
284
|
...entity.rowSchema !== void 0 ? { rowSchema: entity.rowSchema } : {},
|
|
286
285
|
...entity.stateCatalogId !== void 0 ? { stateCatalogId: entity.stateCatalogId } : {}
|
|
287
286
|
};
|
|
@@ -306,8 +305,7 @@ function addLegacyEntityProjections(index, diagnostics, sourcesById, entities) {
|
|
|
306
305
|
from: legacyObjectId(entity),
|
|
307
306
|
to: legacyObjectId(targetEntity),
|
|
308
307
|
cardinality: link.kind,
|
|
309
|
-
...link.via !== void 0 ? { via: link.via } : {}
|
|
310
|
-
legacyEntityId: entity.id
|
|
308
|
+
...link.via !== void 0 ? { via: link.via } : {}
|
|
311
309
|
};
|
|
312
310
|
addRecord(index, diagnostics, sourcesById, "linkTypes", linkType, {
|
|
313
311
|
source: "legacy.entities.links",
|
|
@@ -365,8 +363,7 @@ function addSystemContentProjections(index, diagnostics, sourcesById, systemPath
|
|
|
365
363
|
kind: node.type,
|
|
366
364
|
...typeof node.data?.["entityId"] === "string" ? { appliesTo: formatOntologyId({ scope: systemPath, kind: "object", localId: node.data["entityId"] }) } : {},
|
|
367
365
|
...Object.keys(entries).length > 0 ? { entries } : {},
|
|
368
|
-
...node.data !== void 0 ? { data: node.data } : {}
|
|
369
|
-
legacyContentId: `${systemPath}:${localId}`
|
|
366
|
+
...node.data !== void 0 ? { data: node.data } : {}
|
|
370
367
|
};
|
|
371
368
|
addRecord(index, diagnostics, sourcesById, "catalogTypes", catalogType, {
|
|
372
369
|
source: "legacy.system.content",
|
|
@@ -1508,11 +1505,20 @@ var EventDescriptorSchema = EventEmissionDescriptorSchema.extend({
|
|
|
1508
1505
|
ownerKind: z.enum(["resource", "entity"]).meta({ label: "Owner kind" })
|
|
1509
1506
|
});
|
|
1510
1507
|
var ResourceOntologyBindingSchema = z.object({
|
|
1511
|
-
|
|
1508
|
+
actions: z.array(OntologyIdSchema).optional(),
|
|
1509
|
+
primaryAction: OntologyIdSchema.optional(),
|
|
1512
1510
|
reads: z.array(OntologyIdSchema).optional(),
|
|
1513
1511
|
writes: z.array(OntologyIdSchema).optional(),
|
|
1514
1512
|
usesCatalogs: z.array(OntologyIdSchema).optional(),
|
|
1515
1513
|
emits: z.array(OntologyIdSchema).optional()
|
|
1514
|
+
}).superRefine((binding, ctx) => {
|
|
1515
|
+
if (binding.primaryAction === void 0) return;
|
|
1516
|
+
if (binding.actions?.includes(binding.primaryAction)) return;
|
|
1517
|
+
ctx.addIssue({
|
|
1518
|
+
code: z.ZodIssueCode.custom,
|
|
1519
|
+
path: ["primaryAction"],
|
|
1520
|
+
message: "Resource ontology primaryAction must be included in actions"
|
|
1521
|
+
});
|
|
1516
1522
|
});
|
|
1517
1523
|
var CodeReferenceSchema = z.object({
|
|
1518
1524
|
path: z.string().trim().min(1).max(500).regex(/^[A-Za-z0-9_./$@()[\] -]+$/, "Code reference paths must be repo-relative paths"),
|
|
@@ -1527,6 +1533,10 @@ var ResourceEntryBaseSchema = z.object({
|
|
|
1527
1533
|
order: z.number().default(0),
|
|
1528
1534
|
/** Required single System membership — value is a dot-separated system path (e.g. "sales.lead-gen"). */
|
|
1529
1535
|
systemPath: SystemPathSchema.meta({ ref: "system" }),
|
|
1536
|
+
/** Executable display title owned by the OM Resource descriptor. */
|
|
1537
|
+
title: LabelSchema.optional(),
|
|
1538
|
+
/** Executable display description owned by the OM Resource descriptor. */
|
|
1539
|
+
description: DescriptionSchema.optional(),
|
|
1530
1540
|
/** Optional role responsible for maintaining this resource. */
|
|
1531
1541
|
ownerRoleId: ModelIdSchema.meta({ ref: "role" }).optional(),
|
|
1532
1542
|
status: ResourceGovernanceStatusSchema,
|
|
@@ -1541,8 +1551,6 @@ var ResourceEntryBaseSchema = z.object({
|
|
|
1541
1551
|
});
|
|
1542
1552
|
var WorkflowResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
1543
1553
|
kind: z.literal("workflow"),
|
|
1544
|
-
/** Mirrors WorkflowConfig.actionKey when the runtime workflow has one. */
|
|
1545
|
-
actionKey: z.string().trim().min(1).max(255).optional(),
|
|
1546
1554
|
emits: z.array(EventEmissionDescriptorSchema).optional()
|
|
1547
1555
|
});
|
|
1548
1556
|
var AgentResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
@@ -1590,6 +1598,22 @@ function defineResources(resources) {
|
|
|
1590
1598
|
Object.entries(resources).map(([key, resource]) => [key, ResourceEntrySchema.parse(resource)])
|
|
1591
1599
|
);
|
|
1592
1600
|
}
|
|
1601
|
+
function ontologyIdFrom(input) {
|
|
1602
|
+
return typeof input === "string" ? input : input.id;
|
|
1603
|
+
}
|
|
1604
|
+
function ontologyIdArrayFrom(input) {
|
|
1605
|
+
return input?.map(ontologyIdFrom);
|
|
1606
|
+
}
|
|
1607
|
+
function defineResourceOntology(input) {
|
|
1608
|
+
return ResourceOntologyBindingSchema.parse({
|
|
1609
|
+
actions: ontologyIdArrayFrom(input.actions),
|
|
1610
|
+
primaryAction: input.primaryAction === void 0 ? void 0 : ontologyIdFrom(input.primaryAction),
|
|
1611
|
+
reads: ontologyIdArrayFrom(input.reads),
|
|
1612
|
+
writes: ontologyIdArrayFrom(input.writes),
|
|
1613
|
+
usesCatalogs: ontologyIdArrayFrom(input.usesCatalogs),
|
|
1614
|
+
emits: ontologyIdArrayFrom(input.emits)
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1593
1617
|
|
|
1594
1618
|
// src/organization-model/domains/roles.ts
|
|
1595
1619
|
var RoleIdSchema = ModelIdSchema;
|
|
@@ -1770,6 +1794,179 @@ var OrgKnowledgeNodeSchema = z.object({
|
|
|
1770
1794
|
updatedAt: z.string().trim().min(1).max(50)
|
|
1771
1795
|
});
|
|
1772
1796
|
var KnowledgeDomainSchema = z.record(ModelIdSchema, OrgKnowledgeNodeSchema).default({});
|
|
1797
|
+
var SecretLikeMetadataKeySchema = /(?:secret|password|passwd|token|api[-_]?key|credential|private[-_]?key)/i;
|
|
1798
|
+
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-----)/;
|
|
1799
|
+
var OmTopologyNodeKindSchema = z.enum([
|
|
1800
|
+
"system",
|
|
1801
|
+
"resource",
|
|
1802
|
+
"ontology",
|
|
1803
|
+
"policy",
|
|
1804
|
+
"role",
|
|
1805
|
+
"trigger",
|
|
1806
|
+
"humanCheckpoint",
|
|
1807
|
+
"externalResource"
|
|
1808
|
+
]);
|
|
1809
|
+
var OmTopologyRelationshipKindSchema = z.enum(["triggers", "uses", "approval"]);
|
|
1810
|
+
var OmTopologyNodeRefSchema = z.discriminatedUnion("kind", [
|
|
1811
|
+
z.object({ kind: z.literal("system"), id: ModelIdSchema }),
|
|
1812
|
+
z.object({ kind: z.literal("resource"), id: ResourceIdSchema }),
|
|
1813
|
+
z.object({ kind: z.literal("ontology"), id: OntologyIdSchema }),
|
|
1814
|
+
z.object({ kind: z.literal("policy"), id: ModelIdSchema }),
|
|
1815
|
+
z.object({ kind: z.literal("role"), id: ModelIdSchema }),
|
|
1816
|
+
z.object({ kind: z.literal("trigger"), id: ResourceIdSchema }),
|
|
1817
|
+
z.object({ kind: z.literal("humanCheckpoint"), id: ResourceIdSchema }),
|
|
1818
|
+
z.object({ kind: z.literal("externalResource"), id: ResourceIdSchema })
|
|
1819
|
+
]);
|
|
1820
|
+
var OmTopologyMetadataSchema = z.record(z.string().trim().min(1).max(120), JsonValueSchema).superRefine((metadata, ctx) => {
|
|
1821
|
+
function visit(value, path) {
|
|
1822
|
+
if (typeof value === "string" && SecretLikeMetadataValueSchema.test(value)) {
|
|
1823
|
+
ctx.addIssue({
|
|
1824
|
+
code: z.ZodIssueCode.custom,
|
|
1825
|
+
path,
|
|
1826
|
+
message: "Topology metadata must not contain secret-like values"
|
|
1827
|
+
});
|
|
1828
|
+
return;
|
|
1829
|
+
}
|
|
1830
|
+
if (Array.isArray(value)) {
|
|
1831
|
+
value.forEach((entry, index) => visit(entry, [...path, index]));
|
|
1832
|
+
return;
|
|
1833
|
+
}
|
|
1834
|
+
if (typeof value !== "object" || value === null) return;
|
|
1835
|
+
Object.entries(value).forEach(([key, entry]) => {
|
|
1836
|
+
if (SecretLikeMetadataKeySchema.test(key)) {
|
|
1837
|
+
ctx.addIssue({
|
|
1838
|
+
code: z.ZodIssueCode.custom,
|
|
1839
|
+
path: [...path, key],
|
|
1840
|
+
message: `Topology metadata key "${key}" looks secret-like`
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
visit(entry, [...path, key]);
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
visit(metadata, []);
|
|
1847
|
+
});
|
|
1848
|
+
var OmTopologyRelationshipSchema = z.object({
|
|
1849
|
+
from: OmTopologyNodeRefSchema,
|
|
1850
|
+
kind: OmTopologyRelationshipKindSchema,
|
|
1851
|
+
to: OmTopologyNodeRefSchema,
|
|
1852
|
+
systemPath: SystemPathSchema.optional(),
|
|
1853
|
+
required: z.boolean().optional(),
|
|
1854
|
+
metadata: OmTopologyMetadataSchema.optional()
|
|
1855
|
+
});
|
|
1856
|
+
var OmTopologyDomainSchema = z.object({
|
|
1857
|
+
version: z.literal(1).default(1),
|
|
1858
|
+
relationships: z.record(z.string().trim().min(1).max(255), OmTopologyRelationshipSchema).default({})
|
|
1859
|
+
}).default({ version: 1, relationships: {} });
|
|
1860
|
+
var DEFAULT_ORGANIZATION_MODEL_TOPOLOGY = {
|
|
1861
|
+
version: 1,
|
|
1862
|
+
relationships: {}
|
|
1863
|
+
};
|
|
1864
|
+
function idFrom(input) {
|
|
1865
|
+
return typeof input === "string" ? input : input.id;
|
|
1866
|
+
}
|
|
1867
|
+
function parseRef(kind, id) {
|
|
1868
|
+
return OmTopologyNodeRefSchema.parse({ kind, id });
|
|
1869
|
+
}
|
|
1870
|
+
function isNodeRef(input) {
|
|
1871
|
+
return OmTopologyNodeRefSchema.safeParse(input).success;
|
|
1872
|
+
}
|
|
1873
|
+
function isResourceEntry(input) {
|
|
1874
|
+
if (typeof input !== "object" || input === null) return false;
|
|
1875
|
+
const candidate = input;
|
|
1876
|
+
return typeof candidate.id === "string" && typeof candidate.systemPath === "string" && typeof candidate.status === "string" && ["workflow", "agent", "integration", "script"].includes(String(candidate.kind));
|
|
1877
|
+
}
|
|
1878
|
+
var topologyRef = {
|
|
1879
|
+
system: (system) => parseRef("system", idFrom(system)),
|
|
1880
|
+
resource: (resource) => parseRef("resource", idFrom(resource)),
|
|
1881
|
+
ontology: (record) => parseRef("ontology", idFrom(record)),
|
|
1882
|
+
policy: (policy) => parseRef("policy", idFrom(policy)),
|
|
1883
|
+
role: (role) => parseRef("role", idFrom(role)),
|
|
1884
|
+
trigger: (trigger) => parseRef("trigger", idFrom(trigger)),
|
|
1885
|
+
humanCheckpoint: (checkpoint) => parseRef("humanCheckpoint", idFrom(checkpoint)),
|
|
1886
|
+
externalResource: (externalResource) => parseRef("externalResource", idFrom(externalResource))
|
|
1887
|
+
};
|
|
1888
|
+
var topologyRelationship = {
|
|
1889
|
+
triggers: (from, to, options = {}) => defineTopologyRelationship({
|
|
1890
|
+
...options,
|
|
1891
|
+
from,
|
|
1892
|
+
kind: "triggers",
|
|
1893
|
+
to
|
|
1894
|
+
}),
|
|
1895
|
+
uses: (from, to, options = {}) => defineTopologyRelationship({
|
|
1896
|
+
...options,
|
|
1897
|
+
from,
|
|
1898
|
+
kind: "uses",
|
|
1899
|
+
to
|
|
1900
|
+
}),
|
|
1901
|
+
approval: (from, to, options = {}) => defineTopologyRelationship({
|
|
1902
|
+
...options,
|
|
1903
|
+
from,
|
|
1904
|
+
kind: "approval",
|
|
1905
|
+
to
|
|
1906
|
+
}),
|
|
1907
|
+
usesIntegration: (from, integration, options = {}) => defineTopologyRelationship({
|
|
1908
|
+
required: true,
|
|
1909
|
+
...options,
|
|
1910
|
+
from,
|
|
1911
|
+
kind: "uses",
|
|
1912
|
+
to: integration
|
|
1913
|
+
}),
|
|
1914
|
+
requestsApproval: (from, checkpoint, options = {}) => defineTopologyRelationship({
|
|
1915
|
+
required: true,
|
|
1916
|
+
...options,
|
|
1917
|
+
from,
|
|
1918
|
+
kind: "approval",
|
|
1919
|
+
to: topologyRef.humanCheckpoint(checkpoint)
|
|
1920
|
+
}),
|
|
1921
|
+
checkpointRoutesTo: (checkpoint, to, options = {}) => defineTopologyRelationship({
|
|
1922
|
+
required: true,
|
|
1923
|
+
...options,
|
|
1924
|
+
from: topologyRef.humanCheckpoint(checkpoint),
|
|
1925
|
+
kind: "triggers",
|
|
1926
|
+
to
|
|
1927
|
+
})
|
|
1928
|
+
};
|
|
1929
|
+
function compileTopologyNodeRef(input) {
|
|
1930
|
+
if (isNodeRef(input)) return input;
|
|
1931
|
+
if (isResourceEntry(input)) return topologyRef.resource(input);
|
|
1932
|
+
throw new Error("Topology node refs must be typed node objects or serializable { kind, id } refs");
|
|
1933
|
+
}
|
|
1934
|
+
function parseTopologyNodeRef(input) {
|
|
1935
|
+
if (typeof input !== "string") return OmTopologyNodeRefSchema.parse(input);
|
|
1936
|
+
const separatorIndex = input.indexOf(":");
|
|
1937
|
+
if (separatorIndex === -1) {
|
|
1938
|
+
throw new Error(`Topology node ref "${input}" must use <kind>:<id>`);
|
|
1939
|
+
}
|
|
1940
|
+
const kind = input.slice(0, separatorIndex);
|
|
1941
|
+
const id = input.slice(separatorIndex + 1);
|
|
1942
|
+
if (!OmTopologyNodeKindSchema.safeParse(kind).success) {
|
|
1943
|
+
throw new Error(`Topology node ref "${input}" has unsupported kind "${kind}"`);
|
|
1944
|
+
}
|
|
1945
|
+
return OmTopologyNodeRefSchema.parse({ kind, id });
|
|
1946
|
+
}
|
|
1947
|
+
function defineTopologyRelationship(input) {
|
|
1948
|
+
return OmTopologyRelationshipSchema.parse({
|
|
1949
|
+
...input,
|
|
1950
|
+
from: compileTopologyNodeRef(input.from),
|
|
1951
|
+
to: compileTopologyNodeRef(input.to)
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
function defineTopology(relationships) {
|
|
1955
|
+
const entries = Array.isArray(relationships) ? relationships.map((relationship, index) => [`relationship-${index + 1}`, relationship]) : Object.entries(relationships);
|
|
1956
|
+
return OmTopologyDomainSchema.parse({
|
|
1957
|
+
version: 1,
|
|
1958
|
+
relationships: Object.fromEntries(entries.map(([key, relationship]) => [key, defineTopologyRelationship(relationship)]))
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1961
|
+
function isOntologyTopologyRef(value) {
|
|
1962
|
+
if (!isNodeRef(value) || value.kind !== "ontology") return false;
|
|
1963
|
+
try {
|
|
1964
|
+
parseOntologyId(value.id);
|
|
1965
|
+
return true;
|
|
1966
|
+
} catch {
|
|
1967
|
+
return false;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1773
1970
|
var PolicyIdSchema = ModelIdSchema;
|
|
1774
1971
|
var PolicyApplicabilitySchema = z.object({
|
|
1775
1972
|
systemIds: z.array(ModelIdSchema.meta({ ref: "system" })).default([]),
|
|
@@ -1859,6 +2056,7 @@ var OrganizationModelDomainKeySchema = z.enum([
|
|
|
1859
2056
|
"systems",
|
|
1860
2057
|
"ontology",
|
|
1861
2058
|
"resources",
|
|
2059
|
+
"topology",
|
|
1862
2060
|
"actions",
|
|
1863
2061
|
"entities",
|
|
1864
2062
|
"policies",
|
|
@@ -1878,6 +2076,7 @@ var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
|
1878
2076
|
systems: { version: 1, lastModified: "2026-05-10" },
|
|
1879
2077
|
ontology: { version: 1, lastModified: "2026-05-14" },
|
|
1880
2078
|
resources: { version: 1, lastModified: "2026-05-10" },
|
|
2079
|
+
topology: { version: 1, lastModified: "2026-05-14" },
|
|
1881
2080
|
actions: { version: 1, lastModified: "2026-05-10" },
|
|
1882
2081
|
entities: { version: 1, lastModified: "2026-05-10" },
|
|
1883
2082
|
policies: { version: 1, lastModified: "2026-05-10" },
|
|
@@ -1893,6 +2092,7 @@ var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
|
1893
2092
|
systems: OrganizationModelDomainMetadataSchema,
|
|
1894
2093
|
ontology: OrganizationModelDomainMetadataSchema,
|
|
1895
2094
|
resources: OrganizationModelDomainMetadataSchema,
|
|
2095
|
+
topology: OrganizationModelDomainMetadataSchema,
|
|
1896
2096
|
actions: OrganizationModelDomainMetadataSchema,
|
|
1897
2097
|
entities: OrganizationModelDomainMetadataSchema,
|
|
1898
2098
|
policies: OrganizationModelDomainMetadataSchema,
|
|
@@ -1911,6 +2111,7 @@ var OrganizationModelSchemaBase = z.object({
|
|
|
1911
2111
|
systems: SystemsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_SYSTEMS),
|
|
1912
2112
|
ontology: OntologyScopeSchema.default(DEFAULT_ONTOLOGY_SCOPE),
|
|
1913
2113
|
resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
|
|
2114
|
+
topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
|
|
1914
2115
|
actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
|
|
1915
2116
|
entities: EntitiesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ENTITIES),
|
|
1916
2117
|
policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
|
|
@@ -2253,6 +2454,25 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2253
2454
|
surface: ontologyCompilation.ontology.surfaces
|
|
2254
2455
|
};
|
|
2255
2456
|
const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
|
|
2457
|
+
function topologyTargetExists(ref) {
|
|
2458
|
+
if (ref.kind === "system") return systemsById.has(ref.id);
|
|
2459
|
+
if (ref.kind === "resource") return resourcesById.has(ref.id);
|
|
2460
|
+
if (ref.kind === "ontology") return ontologyIds.has(ref.id);
|
|
2461
|
+
if (ref.kind === "policy") return policiesById.has(ref.id);
|
|
2462
|
+
if (ref.kind === "role") return rolesById.has(ref.id);
|
|
2463
|
+
return true;
|
|
2464
|
+
}
|
|
2465
|
+
Object.entries(model.topology.relationships).forEach(([relationshipId, relationship]) => {
|
|
2466
|
+
["from", "to"].forEach((side) => {
|
|
2467
|
+
const ref = relationship[side];
|
|
2468
|
+
if (topologyTargetExists(ref)) return;
|
|
2469
|
+
addIssue(
|
|
2470
|
+
ctx,
|
|
2471
|
+
["topology", "relationships", relationshipId, side],
|
|
2472
|
+
`Topology relationship "${relationshipId}" ${side} references unknown ${ref.kind} "${ref.id}"`
|
|
2473
|
+
);
|
|
2474
|
+
});
|
|
2475
|
+
});
|
|
2256
2476
|
const ontologyReferenceKeyKinds = {
|
|
2257
2477
|
valueType: "value-type",
|
|
2258
2478
|
catalogType: "catalog",
|
|
@@ -2391,11 +2611,18 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2391
2611
|
}
|
|
2392
2612
|
});
|
|
2393
2613
|
function validateResourceOntologyBinding(resourceId, bindingKey, expectedKind, ids) {
|
|
2394
|
-
ids
|
|
2614
|
+
const ontologyIds2 = ids === void 0 ? [] : Array.isArray(ids) ? ids : [ids];
|
|
2615
|
+
ontologyIds2.forEach((ontologyId, ontologyIndex) => {
|
|
2395
2616
|
if (ontologyIndexByKind[expectedKind][ontologyId] === void 0) {
|
|
2396
2617
|
addIssue(
|
|
2397
2618
|
ctx,
|
|
2398
|
-
[
|
|
2619
|
+
[
|
|
2620
|
+
"resources",
|
|
2621
|
+
resourceId,
|
|
2622
|
+
"ontology",
|
|
2623
|
+
bindingKey,
|
|
2624
|
+
...Array.isArray(ids) ? [ontologyIndex] : []
|
|
2625
|
+
],
|
|
2399
2626
|
`Resource "${resourceId}" ontology binding "${bindingKey}" references unknown ${expectedKind} ontology ID "${ontologyId}"`
|
|
2400
2627
|
);
|
|
2401
2628
|
}
|
|
@@ -2404,7 +2631,8 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ct
|
|
|
2404
2631
|
Object.values(model.resources).forEach((resource) => {
|
|
2405
2632
|
const binding = resource.ontology;
|
|
2406
2633
|
if (binding === void 0) return;
|
|
2407
|
-
validateResourceOntologyBinding(resource.id, "
|
|
2634
|
+
validateResourceOntologyBinding(resource.id, "actions", "action", binding.actions);
|
|
2635
|
+
validateResourceOntologyBinding(resource.id, "primaryAction", "action", binding.primaryAction);
|
|
2408
2636
|
validateResourceOntologyBinding(resource.id, "reads", "object", binding.reads);
|
|
2409
2637
|
validateResourceOntologyBinding(resource.id, "writes", "object", binding.writes);
|
|
2410
2638
|
validateResourceOntologyBinding(resource.id, "usesCatalogs", "catalog", binding.usesCatalogs);
|
|
@@ -2550,9 +2778,10 @@ var OrganizationGraphEdgeKindSchema = z.enum([
|
|
|
2550
2778
|
"emits",
|
|
2551
2779
|
"originates_from",
|
|
2552
2780
|
"triggers",
|
|
2781
|
+
"approval",
|
|
2553
2782
|
"applies_to",
|
|
2554
2783
|
"effects",
|
|
2555
|
-
"
|
|
2784
|
+
"actions",
|
|
2556
2785
|
"reads",
|
|
2557
2786
|
"writes",
|
|
2558
2787
|
"uses_catalog"
|
|
@@ -3330,6 +3559,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
3330
3559
|
},
|
|
3331
3560
|
ontology: DEFAULT_ONTOLOGY_SCOPE,
|
|
3332
3561
|
resources: DEFAULT_ORGANIZATION_MODEL_RESOURCES,
|
|
3562
|
+
topology: DEFAULT_ORGANIZATION_MODEL_TOPOLOGY,
|
|
3333
3563
|
actions: DEFAULT_ORGANIZATION_MODEL_ACTIONS,
|
|
3334
3564
|
entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES2,
|
|
3335
3565
|
policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
|
|
@@ -3978,4 +4208,4 @@ function createFoundationOrganizationModel(override) {
|
|
|
3978
4208
|
};
|
|
3979
4209
|
}
|
|
3980
4210
|
|
|
3981
|
-
export { ActionIdSchema, ActionInvocationKindSchema, ActionInvocationSchema, ActionRefSchema, ActionSchema, ActionScopeSchema, ActionsDomainSchema, AgentKindSchema, AgentResourceEntrySchema, AgentRoleHolderSchema, ApiEndpointInvocationSchema, CRM_ACTION_ENTRIES, CodeReferenceRoleSchema, CodeReferenceSchema, CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ONTOLOGY_SCOPE, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_ACTIONS, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, DEFAULT_ORGANIZATION_MODEL_ENTITIES, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_NAVIGATION, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_POLICIES, DEFAULT_ORGANIZATION_MODEL_RESOURCES, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, DEFAULT_ORGANIZATION_MODEL_SYSTEMS, EntitiesDomainSchema, EntityIdSchema, EntityLinkKindSchema, EntityLinkSchema, EntitySchema, EventDescriptorSchema, EventEmissionDescriptorSchema, EventIdSchema, FirmographicsSchema, GoalsDomainSchema, HumanRoleHolderSchema, IconNameSchema, IntegrationResourceEntrySchema, KNOWLEDGE_FEATURE_ID, KNOWLEDGE_SYSTEM_ID, KeyResultSchema, KnowledgeDomainSchema, KnowledgeLinkSchema, KnowledgeTargetKindSchema, KnowledgeTargetRefSchema, LEAD_GEN_ACTION_ENTRIES, LEAD_GEN_STAGE_CATALOG, LinkSchema, MONITORING_FEATURE_ID, MONITORING_SYSTEM_ID, McpToolInvocationSchema, NavigationGroupSchema, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_COMMAND_VIEW_SURFACE_ID, OPERATIONS_FEATURE_ID, OPERATIONS_SYSTEM_ID, ORGANIZATION_MODEL_ICON_TOKENS, ObjectiveSchema, OfferingsDomainSchema, OntologyActionTypeSchema, OntologyCatalogTypeSchema, OntologyEventTypeSchema, OntologyGroupSchema, OntologyIdSchema, OntologyInterfaceTypeSchema, OntologyKindSchema, OntologyLinkTypeSchema, OntologyObjectTypeSchema, OntologyScopeSchema, OntologySharedPropertySchema, OntologySurfaceTypeSchema, OntologyValueTypeSchema, OrgKnowledgeKindSchema, OrgKnowledgeNodeSchema, OrganizationModelBuiltinIconTokenSchema, OrganizationModelDomainKeySchema, OrganizationModelDomainMetadataByDomainSchema, OrganizationModelDomainMetadataSchema, OrganizationModelIconTokenSchema, OrganizationModelNavigationSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_SYSTEM_ID, PROJECTS_VIEW_ACTION_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PROSPECTING_SYSTEM_ID, PoliciesDomainSchema, PolicyApplicabilitySchema, PolicyEffectSchema, PolicyIdSchema, PolicyPredicateSchema, PolicySchema, PolicyTriggerSchema, PricingModelSchema, ProductSchema, ResourceEntrySchema, ResourceGovernanceStatusSchema, ResourceIdSchema, ResourceKindSchema, ResourceOntologyBindingSchema, ResourcesDomainSchema, RoleHolderSchema, RoleHoldersSchema, RoleIdSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SALES_SYSTEM_ID, SEO_FEATURE_ID, SEO_SYSTEM_ID, SETTINGS_FEATURE_ID, SETTINGS_ROLES_SURFACE_ID, SETTINGS_SYSTEM_ID, ScriptExecutionInvocationSchema, ScriptResourceEntrySchema, ScriptResourceLanguageSchema, ScriptResourceSourceSchema, SidebarNavigationSchema, SidebarNodeSchema, SidebarSectionSchema, SidebarSurfaceTargetsSchema, SlashCommandInvocationSchema, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, SurfaceDefinitionSchema, SurfaceTypeSchema, SystemEntrySchema, SystemIdSchema, SystemKindSchema, SystemLifecycleSchema, SystemPathSchema, SystemStatusSchema, SystemUiSchema, SystemsDomainSchema, TeamRoleHolderSchema, TechStackEntrySchema, UiPositionSchema, WorkflowResourceEntrySchema, compileOrganizationOntology, createFoundationOrganizationModel, defineOrganizationModel, defineResource, defineResources, findOrganizationActionById, formatOntologyId, getOntologyDiagnostics, getSortedSidebarEntries, isOntologyGraphNodeId, listResolvedOntologyRecords, ontologyGraphNodeId, ontologyIdFromGraphNodeId, parseOntologyId, resolveOrganizationModel, resolveOrganizationModelWithResources };
|
|
4211
|
+
export { ActionIdSchema, ActionInvocationKindSchema, ActionInvocationSchema, ActionRefSchema, ActionSchema, ActionScopeSchema, ActionsDomainSchema, AgentKindSchema, AgentResourceEntrySchema, AgentRoleHolderSchema, ApiEndpointInvocationSchema, CRM_ACTION_ENTRIES, CodeReferenceRoleSchema, CodeReferenceSchema, CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ONTOLOGY_SCOPE, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_ACTIONS, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, DEFAULT_ORGANIZATION_MODEL_ENTITIES, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_NAVIGATION, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_POLICIES, DEFAULT_ORGANIZATION_MODEL_RESOURCES, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, DEFAULT_ORGANIZATION_MODEL_SYSTEMS, DEFAULT_ORGANIZATION_MODEL_TOPOLOGY, EntitiesDomainSchema, EntityIdSchema, EntityLinkKindSchema, EntityLinkSchema, EntitySchema, EventDescriptorSchema, EventEmissionDescriptorSchema, EventIdSchema, FirmographicsSchema, GoalsDomainSchema, HumanRoleHolderSchema, IconNameSchema, IntegrationResourceEntrySchema, KNOWLEDGE_FEATURE_ID, KNOWLEDGE_SYSTEM_ID, KeyResultSchema, KnowledgeDomainSchema, KnowledgeLinkSchema, KnowledgeTargetKindSchema, KnowledgeTargetRefSchema, LEAD_GEN_ACTION_ENTRIES, LEAD_GEN_STAGE_CATALOG, LinkSchema, MONITORING_FEATURE_ID, MONITORING_SYSTEM_ID, McpToolInvocationSchema, NavigationGroupSchema, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_COMMAND_VIEW_SURFACE_ID, OPERATIONS_FEATURE_ID, OPERATIONS_SYSTEM_ID, ORGANIZATION_MODEL_ICON_TOKENS, ObjectiveSchema, OfferingsDomainSchema, OmTopologyDomainSchema, OmTopologyMetadataSchema, OmTopologyNodeKindSchema, OmTopologyNodeRefSchema, OmTopologyRelationshipKindSchema, OmTopologyRelationshipSchema, OntologyActionTypeSchema, OntologyCatalogTypeSchema, OntologyEventTypeSchema, OntologyGroupSchema, OntologyIdSchema, OntologyInterfaceTypeSchema, OntologyKindSchema, OntologyLinkTypeSchema, OntologyObjectTypeSchema, OntologyScopeSchema, OntologySharedPropertySchema, OntologySurfaceTypeSchema, OntologyValueTypeSchema, OrgKnowledgeKindSchema, OrgKnowledgeNodeSchema, OrganizationModelBuiltinIconTokenSchema, OrganizationModelDomainKeySchema, OrganizationModelDomainMetadataByDomainSchema, OrganizationModelDomainMetadataSchema, OrganizationModelIconTokenSchema, OrganizationModelNavigationSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_SYSTEM_ID, PROJECTS_VIEW_ACTION_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PROSPECTING_SYSTEM_ID, PoliciesDomainSchema, PolicyApplicabilitySchema, PolicyEffectSchema, PolicyIdSchema, PolicyPredicateSchema, PolicySchema, PolicyTriggerSchema, PricingModelSchema, ProductSchema, ResourceEntrySchema, ResourceGovernanceStatusSchema, ResourceIdSchema, ResourceKindSchema, ResourceOntologyBindingSchema, ResourcesDomainSchema, RoleHolderSchema, RoleHoldersSchema, RoleIdSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SALES_SYSTEM_ID, SEO_FEATURE_ID, SEO_SYSTEM_ID, SETTINGS_FEATURE_ID, SETTINGS_ROLES_SURFACE_ID, SETTINGS_SYSTEM_ID, ScriptExecutionInvocationSchema, ScriptResourceEntrySchema, ScriptResourceLanguageSchema, ScriptResourceSourceSchema, SidebarNavigationSchema, SidebarNodeSchema, SidebarSectionSchema, SidebarSurfaceTargetsSchema, SlashCommandInvocationSchema, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, SurfaceDefinitionSchema, SurfaceTypeSchema, SystemEntrySchema, SystemIdSchema, SystemKindSchema, SystemLifecycleSchema, SystemPathSchema, SystemStatusSchema, SystemUiSchema, SystemsDomainSchema, TeamRoleHolderSchema, TechStackEntrySchema, UiPositionSchema, WorkflowResourceEntrySchema, compileOrganizationOntology, compileTopologyNodeRef, createFoundationOrganizationModel, defineOrganizationModel, defineResource, defineResourceOntology, defineResources, defineTopology, defineTopologyRelationship, findOrganizationActionById, formatOntologyId, getOntologyDiagnostics, getSortedSidebarEntries, isOntologyGraphNodeId, isOntologyTopologyRef, listResolvedOntologyRecords, ontologyGraphNodeId, ontologyIdFromGraphNodeId, parseOntologyId, parseTopologyNodeRef, resolveOrganizationModel, resolveOrganizationModelWithResources, topologyRef, topologyRelationship };
|