@elevasis/ui 2.67.0 → 2.69.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.d.ts +1 -1
- package/dist/api/index.js +3 -3
- package/dist/app/index.d.ts +575 -370
- package/dist/app/index.js +17 -23
- package/dist/auth/index.css +149 -149
- package/dist/auth/index.d.ts +5 -0
- package/dist/auth/index.js +11 -13
- package/dist/charts/index.css +208 -208
- package/dist/charts/index.js +11 -13
- package/dist/{chunk-M535KHLW.js → chunk-26BTE3Z4.js} +1 -1
- package/dist/chunk-3KMDHCAR.js +52 -0
- package/dist/chunk-3MEXPLWT.js +265 -0
- package/dist/chunk-4JHLS234.js +39 -0
- package/dist/chunk-6PZFOHJK.js +1764 -0
- package/dist/chunk-7WJEPTE7.js +194 -0
- package/dist/chunk-AH52XQB7.js +1 -0
- package/dist/{chunk-UFTM5SZZ.js → chunk-AKANHRQ5.js} +9 -3
- package/dist/chunk-BZZCNLT6.js +12 -0
- package/dist/chunk-C75XWBYZ.js +383 -0
- package/dist/chunk-DLR4SDZW.js +51 -0
- package/dist/{chunk-4OEVLV66.js → chunk-FLECOYUS.js} +113 -148
- package/dist/chunk-IRV6KJPV.js +425 -0
- package/dist/chunk-IT7GTJCB.js +10 -0
- package/dist/chunk-LGKLC5MG.js +44 -0
- package/dist/chunk-MFLM7BVC.js +85 -0
- package/dist/chunk-MRVGQLWN.js +1595 -0
- package/dist/{chunk-4DV4ECMG.js → chunk-N7U24M2J.js} +4 -0
- package/dist/{chunk-I7BZVVVU.js → chunk-NM4A63KJ.js} +104 -415
- package/dist/chunk-NU3NBXHP.js +1194 -0
- package/dist/chunk-PDHTXPSF.js +12 -0
- package/dist/chunk-RW64UJWT.js +1934 -0
- package/dist/{chunk-JFBZ6XDW.js → chunk-SNZDFCOQ.js} +3 -49
- package/dist/chunk-TUMSNGTX.js +35 -0
- package/dist/chunk-UD657ICS.js +589 -0
- package/dist/{chunk-XNW3O6QW.js → chunk-VDX6DL7Z.js} +1 -1
- package/dist/chunk-WXHAHKKI.js +16411 -0
- package/dist/chunk-XAZR3T6Y.js +2162 -0
- package/dist/chunk-XQ3ILKYN.js +37 -0
- package/dist/chunk-YCRINA2D.js +67 -0
- package/dist/chunk-YGCMMOY4.js +1484 -0
- package/dist/chunk-YNRYIXUT.js +10945 -0
- package/dist/chunk-ZD6LM53O.js +4528 -0
- package/dist/chunk-ZPTEGGKU.js +631 -0
- package/dist/components/chat/index.js +2 -1
- package/dist/components/index.css +208 -208
- package/dist/components/index.d.ts +1634 -264
- package/dist/components/index.js +2774 -14
- package/dist/components/navigation/index.css +149 -149
- package/dist/components/navigation/index.js +12 -13
- package/dist/features/auth/index.css +149 -149
- package/dist/features/auth/index.d.ts +457 -167
- package/dist/features/auth/index.js +13 -14
- package/dist/features/clients/index.css +208 -208
- package/dist/features/clients/index.d.ts +39 -1
- package/dist/features/clients/index.js +16 -13
- package/dist/features/content/index.d.ts +1788 -0
- package/dist/features/content/index.js +2180 -0
- package/dist/features/crm/index.d.ts +1802 -231
- package/dist/features/crm/index.js +16 -13
- package/dist/features/dashboard/index.d.ts +1 -8
- package/dist/features/dashboard/index.js +17 -13
- package/dist/features/delivery/index.d.ts +457 -167
- package/dist/features/delivery/index.js +16 -13
- package/dist/features/knowledge/index.css +149 -149
- package/dist/features/knowledge/index.js +11 -13
- package/dist/features/lead-gen/index.d.ts +53 -104
- package/dist/features/lead-gen/index.js +17 -13
- package/dist/features/monitoring/index.js +16 -13
- package/dist/features/monitoring/requests/index.js +15 -20
- package/dist/features/operations/index.d.ts +1 -86
- package/dist/features/operations/index.js +22 -12
- package/dist/features/public-agent-chat/index.js +2 -1
- package/dist/features/seo/index.js +2 -1
- package/dist/features/settings/index.d.ts +457 -167
- package/dist/features/settings/index.js +15 -13
- package/dist/hooks/access/index.css +149 -149
- package/dist/hooks/access/index.d.ts +5 -0
- package/dist/hooks/access/index.js +11 -13
- package/dist/hooks/delivery/index.d.ts +457 -167
- package/dist/hooks/delivery/index.js +2 -23
- package/dist/hooks/index.d.ts +2203 -244
- package/dist/hooks/index.js +11 -13
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +1 -8
- package/dist/hooks/published.d.ts +2203 -244
- package/dist/hooks/published.js +11 -13
- package/dist/initialization/index.d.ts +465 -169
- package/dist/knowledge/index.css +149 -149
- package/dist/knowledge/index.d.ts +5 -90
- package/dist/knowledge/index.js +3215 -3203
- package/dist/{knowledge-search-index-6EZNBNSR.js → knowledge-search-index-LP2WVSQX.js} +689 -695
- package/dist/layout/index.css +149 -149
- package/dist/layout/index.js +15 -13
- package/dist/organization/index.d.ts +10 -4
- package/dist/organization/index.js +1 -21
- package/dist/profile/index.d.ts +457 -167
- package/dist/provider/index.d.ts +576 -372
- package/dist/provider/index.js +11 -13
- package/dist/provider/published.css +149 -149
- package/dist/provider/published.d.ts +576 -372
- package/dist/provider/published.js +11 -13
- package/dist/supabase/index.d.ts +906 -347
- package/dist/test-utils/index.d.ts +15 -2
- package/dist/test-utils/index.js +41 -12
- package/dist/test-utils/setup-integration.js +1 -1
- package/dist/test-utils/setup.js +1 -1
- package/dist/theme/index.js +3 -2
- package/dist/theme/presets/index.js +1 -1
- package/dist/typeform/index.js +2049 -1
- package/dist/types/index.d.ts +477 -177
- package/dist/utils/index.d.ts +1 -8
- package/dist/utils/index.js +1 -1
- package/dist/vite/index.js +2 -2
- package/dist/vite-plugin-knowledge/index.js +1 -1
- package/package.json +7 -3
- package/src/features/README.md +28 -28
- package/dist/chunk-5TERYXOO.js +0 -51390
- package/dist/chunk-AUDNF2Q7.js +0 -2050
- package/dist/index.d.ts +0 -17888
- package/dist/index.js +0 -30
- package/dist/{chunk-GMXGDO3I.js → chunk-MISHPEJX.js} +1 -1
- package/dist/{chunk-RBGVNPA6.js → chunk-XQBURFKM.js} +0 -0
- package/dist/{index.css → features/content/index.css} +149 -149
|
@@ -273,14 +273,6 @@ DisplayMetadataSchema.extend({
|
|
|
273
273
|
});
|
|
274
274
|
|
|
275
275
|
// ../core/src/organization-model/helpers.ts
|
|
276
|
-
function defineDomainRecord(schema, entries) {
|
|
277
|
-
return Object.fromEntries(
|
|
278
|
-
entries.map((entry) => {
|
|
279
|
-
const parsed = schema.parse(entry);
|
|
280
|
-
return [parsed.id, parsed];
|
|
281
|
-
})
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
276
|
function childSystemsOf(system) {
|
|
285
277
|
return system.systems ?? system.subsystems ?? {};
|
|
286
278
|
}
|
|
@@ -318,11 +310,8 @@ function parentOf(systems, id) {
|
|
|
318
310
|
function inheritedValue(systems, id, getValue) {
|
|
319
311
|
return ancestorsOf(systems, id).slice().reverse().map(getValue).find((value) => value !== void 0);
|
|
320
312
|
}
|
|
321
|
-
function requiresAdminFor(systems, id) {
|
|
322
|
-
return inheritedValue(systems, id, (system) => system.requiresAdmin) ?? false;
|
|
323
|
-
}
|
|
324
313
|
function devOnlyFor(systems, id) {
|
|
325
|
-
return inheritedValue(systems, id, (system) => system.
|
|
314
|
+
return inheritedValue(systems, id, (system) => system.lifecycle === "beta" || void 0) ?? false;
|
|
326
315
|
}
|
|
327
316
|
function getSystem(model, path) {
|
|
328
317
|
const flatMatch = model.systems[path];
|
|
@@ -360,8 +349,8 @@ function getSystemAncestors(model, path) {
|
|
|
360
349
|
function listAllSystems(model) {
|
|
361
350
|
const results = [];
|
|
362
351
|
function walk(map, prefix) {
|
|
363
|
-
for (const [
|
|
364
|
-
const fullPath = prefix ? `${prefix}.${
|
|
352
|
+
for (const [localId, system] of Object.entries(map)) {
|
|
353
|
+
const fullPath = prefix ? `${prefix}.${localId}` : localId;
|
|
365
354
|
results.push({ path: fullPath, system });
|
|
366
355
|
const childSystems = childSystemsOf(system);
|
|
367
356
|
if (Object.keys(childSystems).length > 0) {
|
|
@@ -420,9 +409,6 @@ var EntitySchema = z.object({
|
|
|
420
409
|
var EntitiesDomainSchema = z.record(z.string(), EntitySchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
421
410
|
message: "Each entity entry id must match its map key"
|
|
422
411
|
}).default({});
|
|
423
|
-
function defineEntities(entries) {
|
|
424
|
-
return defineDomainRecord(EntitySchema, entries);
|
|
425
|
-
}
|
|
426
412
|
|
|
427
413
|
// ../core/src/organization-model/domains/actions.ts
|
|
428
414
|
var ActionResourceIdSchema = z.string().trim().min(1).max(255).regex(/^[A-Za-z0-9]+(?:[-._][A-Za-z0-9]+)*$/, "Resource IDs must use letters, numbers, -, _, or . separators");
|
|
@@ -482,9 +468,6 @@ var ActionsDomainSchema = z.record(z.string(), ActionSchema).refine((record) =>
|
|
|
482
468
|
message: "Each action entry id must match its map key"
|
|
483
469
|
}).default({});
|
|
484
470
|
var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {};
|
|
485
|
-
function defineActions(entries) {
|
|
486
|
-
return defineDomainRecord(ActionSchema, entries);
|
|
487
|
-
}
|
|
488
471
|
var OntologyKindSchema = z.enum([
|
|
489
472
|
"object",
|
|
490
473
|
"link",
|
|
@@ -838,10 +821,28 @@ function compileOrganizationOntology(model) {
|
|
|
838
821
|
return { ontology: sortResolvedOntologyIndex(ontology), diagnostics };
|
|
839
822
|
}
|
|
840
823
|
|
|
824
|
+
// ../core/src/organization-model/readiness/profile-registry.ts
|
|
825
|
+
var _builtInProfileValidators = /* @__PURE__ */ new Map();
|
|
826
|
+
function registerBuiltInReadinessProfile(profileId, registration) {
|
|
827
|
+
_builtInProfileValidators.set(profileId, registration);
|
|
828
|
+
}
|
|
829
|
+
function getBuiltInReadinessProfile(profileId) {
|
|
830
|
+
return _builtInProfileValidators.get(profileId);
|
|
831
|
+
}
|
|
832
|
+
var _interfaceMarkerResolvers = /* @__PURE__ */ new Map();
|
|
833
|
+
function interfaceMarkerKey(systemPath, interfaceKey) {
|
|
834
|
+
return `${systemPath}::${interfaceKey}`;
|
|
835
|
+
}
|
|
836
|
+
function registerReadinessInterfaceMarker(systemPath, interfaceKey, resolver) {
|
|
837
|
+
_interfaceMarkerResolvers.set(interfaceMarkerKey(systemPath, interfaceKey), resolver);
|
|
838
|
+
}
|
|
839
|
+
function resolveReadinessInterfaceMarker(model, systemPath, interfaceKey) {
|
|
840
|
+
return _interfaceMarkerResolvers.get(interfaceMarkerKey(systemPath, interfaceKey))?.(model);
|
|
841
|
+
}
|
|
842
|
+
|
|
841
843
|
// ../core/src/organization-model/domains/systems.ts
|
|
842
844
|
var SystemKindSchema = z.enum(["product", "operational", "platform", "diagnostic"]).meta({ label: "System kind", color: "blue" });
|
|
843
845
|
var SystemLifecycleSchema = z.enum(["draft", "beta", "active", "deprecated", "archived"]).meta({ label: "Lifecycle", color: "teal" });
|
|
844
|
-
var SystemStatusSchema = z.enum(["active", "deprecated", "archived"]).meta({ label: "Status", color: "teal" });
|
|
845
846
|
var SystemIdSchema = ModelIdSchema;
|
|
846
847
|
var SystemPathSchema = z.string().trim().min(1).regex(
|
|
847
848
|
/^[a-z0-9][a-z0-9-]*(?:\.[a-z0-9][a-z0-9-]*)*$/,
|
|
@@ -855,8 +856,7 @@ var NodeIdStringSchema = z.string().trim().min(1).max(200).regex(
|
|
|
855
856
|
var SystemUiSchema = z.object({
|
|
856
857
|
path: PathSchema,
|
|
857
858
|
surfaces: ReferenceIdsSchema,
|
|
858
|
-
icon: IconNameSchema.optional()
|
|
859
|
-
order: z.number().int().optional()
|
|
859
|
+
icon: IconNameSchema.optional()
|
|
860
860
|
});
|
|
861
861
|
var SystemInterfaceKeySchema = ModelIdSchema;
|
|
862
862
|
var SystemInterfaceLifecycleSchema = z.enum(["draft", "active", "disabled", "deprecated", "archived"]).meta({ label: "System interface lifecycle", color: "teal" });
|
|
@@ -885,17 +885,23 @@ var SystemInterfaceResourceScopeSchema = z.array(ModelIdSchema).default([]);
|
|
|
885
885
|
var SystemApiInterfaceReadinessContractSchema = z.object({
|
|
886
886
|
/** Ontology IDs of object types the interface depends on. */
|
|
887
887
|
requiredObjects: z.array(z.string().trim().min(1)).default([]),
|
|
888
|
-
/**
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
888
|
+
/**
|
|
889
|
+
* Ontology IDs of catalog types the interface requires. Must declare at least one
|
|
890
|
+
* entry — a `readinessContract` with no `requiredCatalogs` asserts nothing at all,
|
|
891
|
+
* so it has no `.default([])`; omitting the field is rejected the same as an
|
|
892
|
+
* explicit empty array.
|
|
893
|
+
*/
|
|
894
|
+
requiredCatalogs: z.array(z.string().trim().min(1)).min(1)
|
|
892
895
|
}).strict();
|
|
893
896
|
var SystemApiInterfaceSchema = z.object({
|
|
894
897
|
lifecycle: SystemInterfaceLifecycleSchema.default("active"),
|
|
895
898
|
/**
|
|
896
899
|
* Open-string profile id. Built-in platform presets are looked up through
|
|
897
900
|
* the profile registry; custom ids are validated structurally via
|
|
898
|
-
* `readinessContract`. Optional
|
|
901
|
+
* `readinessContract`. Optional at the schema layer, but readiness
|
|
902
|
+
* computation rejects an interface that omits it with a
|
|
903
|
+
* `missing-readiness-profile` diagnostic — there is no positional
|
|
904
|
+
* fallback to `${systemPath}.${interfaceKey}`.
|
|
899
905
|
*/
|
|
900
906
|
readinessProfile: SystemInterfaceReadinessProfileSchema.optional(),
|
|
901
907
|
/**
|
|
@@ -910,17 +916,11 @@ var SystemApiInterfaceSchema = z.object({
|
|
|
910
916
|
*/
|
|
911
917
|
readinessContract: SystemApiInterfaceReadinessContractSchema.optional()
|
|
912
918
|
}).strict();
|
|
913
|
-
|
|
914
|
-
SYSTEM_INTERFACE_READINESS_PROFILES.
|
|
915
|
-
profileId,
|
|
916
|
-
{ profileId, kind: "built-in" }
|
|
917
|
-
])
|
|
918
|
-
);
|
|
919
|
-
function profileForInterface(systemPath, interfaceKey, readinessProfile) {
|
|
920
|
-
return readinessProfile ?? `${systemPath}.${interfaceKey}`;
|
|
919
|
+
function isReservedPlatformProfileId(profileId) {
|
|
920
|
+
return SYSTEM_INTERFACE_READINESS_PROFILES.includes(profileId);
|
|
921
921
|
}
|
|
922
922
|
function isBuiltInReadinessProfile(profileId) {
|
|
923
|
-
return
|
|
923
|
+
return isReservedPlatformProfileId(profileId) || getBuiltInReadinessProfile(profileId) !== void 0;
|
|
924
924
|
}
|
|
925
925
|
var SystemInterfaceRefSchema = z.object({
|
|
926
926
|
systemPath: SystemPathSchema,
|
|
@@ -952,7 +952,7 @@ var SystemEntrySchema = z.object({
|
|
|
952
952
|
parentSystemId: SystemIdSchema.optional(),
|
|
953
953
|
/** Optional UI presence. Systems without UI omit this. */
|
|
954
954
|
ui: SystemUiSchema.optional(),
|
|
955
|
-
/** Canonical lifecycle state.
|
|
955
|
+
/** Canonical lifecycle state. `beta` is what gates a System to dev-mode viewers. */
|
|
956
956
|
lifecycle: SystemLifecycleSchema.optional(),
|
|
957
957
|
/** Optional role responsible for this system. */
|
|
958
958
|
responsibleRoleId: ModelIdSchema.meta({ ref: "role" }).optional(),
|
|
@@ -960,14 +960,10 @@ var SystemEntrySchema = z.object({
|
|
|
960
960
|
governedByKnowledge: z.array(ModelIdSchema.meta({ ref: "knowledge" })).default([]).optional(),
|
|
961
961
|
/** Optional actions this system exposes or consumes. */
|
|
962
962
|
actions: z.array(ActionRefSchema).optional(),
|
|
963
|
-
/** Optional operational policies that apply to this system. */
|
|
964
|
-
policies: z.array(ModelIdSchema.meta({ ref: "policy" })).default([]).optional(),
|
|
965
963
|
/** Optional goals this system contributes to. */
|
|
966
964
|
drivesGoals: z.array(ModelIdSchema.meta({ ref: "goal" })).default([]).optional(),
|
|
967
965
|
/** Thin API runtime-boundary marker. Readiness is derived from scoped resources and topology. */
|
|
968
966
|
apiInterface: SystemApiInterfaceSchema.optional(),
|
|
969
|
-
/** @deprecated Use lifecycle. Accepted for one publish cycle. */
|
|
970
|
-
status: SystemStatusSchema.optional(),
|
|
971
967
|
/** @deprecated Use ui.path. Kept for one-cycle Feature compatibility. */
|
|
972
968
|
path: PathSchema.optional(),
|
|
973
969
|
/** @deprecated Use ui.icon. Kept for one-cycle Feature compatibility. */
|
|
@@ -976,9 +972,6 @@ var SystemEntrySchema = z.object({
|
|
|
976
972
|
uiPosition: UiPositionSchema.optional(),
|
|
977
973
|
/** @deprecated Use lifecycle. */
|
|
978
974
|
enabled: z.boolean().optional(),
|
|
979
|
-
/** @deprecated Use lifecycle: "beta". */
|
|
980
|
-
devOnly: z.boolean().optional(),
|
|
981
|
-
requiresAdmin: z.boolean().optional(),
|
|
982
975
|
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
983
976
|
order: z.number(),
|
|
984
977
|
/**
|
|
@@ -1005,228 +998,15 @@ var SystemEntrySchema = z.object({
|
|
|
1005
998
|
}).strict().refine((system) => system.label !== void 0 || system.title !== void 0, {
|
|
1006
999
|
path: ["label"],
|
|
1007
1000
|
message: "System must provide label or title"
|
|
1008
|
-
}).transform(
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
console.warn("[organization-model] System.status is deprecated; use System.lifecycle instead.");
|
|
1012
|
-
return normalizedSystem.lifecycle === void 0 ? { ...normalizedSystem, lifecycle: normalizedSystem.status } : normalizedSystem;
|
|
1013
|
-
});
|
|
1001
|
+
}).transform(
|
|
1002
|
+
(system) => system.systems !== void 0 && system.subsystems === void 0 ? { ...system, subsystems: system.systems } : system
|
|
1003
|
+
);
|
|
1014
1004
|
var SystemsDomainSchema = z.record(z.string(), SystemEntrySchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
1015
1005
|
message: "Each system entry id must match its map key"
|
|
1016
1006
|
}).default({});
|
|
1017
1007
|
var DEFAULT_ORGANIZATION_MODEL_SYSTEMS = {};
|
|
1018
1008
|
|
|
1019
|
-
// ../core/src/organization-model/
|
|
1020
|
-
function catalogRecords(model) {
|
|
1021
|
-
return Object.values(compileOrganizationOntology(model).ontology.catalogTypes);
|
|
1022
|
-
}
|
|
1023
|
-
function localId(id) {
|
|
1024
|
-
return parseOntologyId(id).localId;
|
|
1025
|
-
}
|
|
1026
|
-
function systemScope(id, fallback) {
|
|
1027
|
-
return parseOntologyId(id).scope || fallback || "";
|
|
1028
|
-
}
|
|
1029
|
-
function entriesOf(catalog) {
|
|
1030
|
-
return Object.entries(catalog.entries ?? {}).map(([id, value]) => [
|
|
1031
|
-
id,
|
|
1032
|
-
value && typeof value === "object" && !Array.isArray(value) ? value : {}
|
|
1033
|
-
]);
|
|
1034
|
-
}
|
|
1035
|
-
function stringValue(value) {
|
|
1036
|
-
return typeof value === "string" ? value : void 0;
|
|
1037
|
-
}
|
|
1038
|
-
function stringArray(value) {
|
|
1039
|
-
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
1040
|
-
}
|
|
1041
|
-
function numberValue(value, fallback = 0) {
|
|
1042
|
-
return typeof value === "number" ? value : fallback;
|
|
1043
|
-
}
|
|
1044
|
-
function stageFromEntry(entryId, entry) {
|
|
1045
|
-
return {
|
|
1046
|
-
id: entryId,
|
|
1047
|
-
label: stringValue(entry.label) ?? entryId,
|
|
1048
|
-
order: numberValue(entry.order),
|
|
1049
|
-
semanticClass: stringValue(entry.semanticClass) ?? "open",
|
|
1050
|
-
surfaceIds: stringArray(entry.surfaceIds),
|
|
1051
|
-
resourceIds: stringArray(entry.resourceIds),
|
|
1052
|
-
color: stringValue(entry.color)
|
|
1053
|
-
};
|
|
1054
|
-
}
|
|
1055
|
-
function appliesToLocalId(catalog) {
|
|
1056
|
-
const appliesTo = catalog.appliesTo;
|
|
1057
|
-
if (appliesTo === void 0) return void 0;
|
|
1058
|
-
return parseOntologyId(appliesTo).localId;
|
|
1059
|
-
}
|
|
1060
|
-
function appliesToEntityKind(catalog) {
|
|
1061
|
-
const id = appliesToLocalId(catalog);
|
|
1062
|
-
if (id === "company" || id === "contact" || id === "project" || id === "milestone" || id === "task") return id;
|
|
1063
|
-
if (id === "deal") return void 0;
|
|
1064
|
-
return void 0;
|
|
1065
|
-
}
|
|
1066
|
-
function getAllPipelines(model) {
|
|
1067
|
-
return catalogRecords(model).filter((catalog) => catalog.kind === "pipeline").map((catalog) => {
|
|
1068
|
-
const pipeline = {
|
|
1069
|
-
id: localId(catalog.id),
|
|
1070
|
-
label: catalog.label ?? localId(catalog.id),
|
|
1071
|
-
...catalog.description ? { description: catalog.description } : {},
|
|
1072
|
-
entityId: appliesToLocalId(catalog) ?? "",
|
|
1073
|
-
stages: entriesOf(catalog).map(([entryId, entry]) => stageFromEntry(entryId, entry)).sort((a, b) => a.order - b.order || a.id.localeCompare(b.id))
|
|
1074
|
-
};
|
|
1075
|
-
return { systemPath: catalog.ownerSystemId ?? systemScope(catalog.id), pipeline };
|
|
1076
|
-
}).sort((a, b) => a.systemPath.localeCompare(b.systemPath) || a.pipeline.id.localeCompare(b.pipeline.id));
|
|
1077
|
-
}
|
|
1078
|
-
function getAllBuildTemplates(model) {
|
|
1079
|
-
const catalogs = catalogRecords(model);
|
|
1080
|
-
const stepCatalogs = new Map(
|
|
1081
|
-
catalogs.filter((catalog) => catalog.kind === "template-step").map((catalog) => [catalog.id, catalog])
|
|
1082
|
-
);
|
|
1083
|
-
return catalogs.filter((catalog) => catalog.kind === "template").flatMap(
|
|
1084
|
-
(catalog) => entriesOf(catalog).map(([templateId, templateEntry]) => {
|
|
1085
|
-
const stepCatalogId = stringValue(templateEntry.stepCatalog);
|
|
1086
|
-
const stepCatalog = stepCatalogId !== void 0 ? stepCatalogs.get(stepCatalogId) : void 0;
|
|
1087
|
-
const steps = stepCatalog === void 0 ? [] : entriesOf(stepCatalog).sort(
|
|
1088
|
-
([leftId, left], [rightId, right]) => numberValue(left.order, Number.MAX_SAFE_INTEGER) - numberValue(right.order, Number.MAX_SAFE_INTEGER) || leftId.localeCompare(rightId)
|
|
1089
|
-
);
|
|
1090
|
-
return {
|
|
1091
|
-
order: numberValue(templateEntry.order, Number.MAX_SAFE_INTEGER),
|
|
1092
|
-
template: {
|
|
1093
|
-
id: templateId,
|
|
1094
|
-
label: stringValue(templateEntry.label) ?? templateId,
|
|
1095
|
-
...stringValue(templateEntry.description) ? { description: stringValue(templateEntry.description) } : {},
|
|
1096
|
-
...stringValue(templateEntry.color) ? { color: stringValue(templateEntry.color) } : {},
|
|
1097
|
-
steps: steps.map(([stepId, step]) => ({
|
|
1098
|
-
id: stepId,
|
|
1099
|
-
label: stringValue(step.label) ?? stepId,
|
|
1100
|
-
...stringValue(step.description) ? { description: stringValue(step.description) } : {},
|
|
1101
|
-
...step
|
|
1102
|
-
}))
|
|
1103
|
-
}
|
|
1104
|
-
};
|
|
1105
|
-
})
|
|
1106
|
-
).sort((a, b) => a.order - b.order || a.template.id.localeCompare(b.template.id)).map(({ template }) => template);
|
|
1107
|
-
}
|
|
1108
|
-
function getAllProspectingStages(model, kind) {
|
|
1109
|
-
return catalogRecords(model).filter((catalog) => catalog.kind === "stage" && appliesToEntityKind(catalog) === kind).flatMap(
|
|
1110
|
-
(catalog) => entriesOf(catalog).map(([entryId, entry]) => ({
|
|
1111
|
-
id: entryId,
|
|
1112
|
-
label: stringValue(entry.label) ?? entryId,
|
|
1113
|
-
order: numberValue(entry.order),
|
|
1114
|
-
...stringValue(entry.color) ? { color: stringValue(entry.color) } : {},
|
|
1115
|
-
...stringValue(entry.description) ? { description: stringValue(entry.description) } : {}
|
|
1116
|
-
}))
|
|
1117
|
-
).sort((a, b) => a.order - b.order || a.id.localeCompare(b.id));
|
|
1118
|
-
}
|
|
1119
|
-
function getLeadGenStageCatalog(model) {
|
|
1120
|
-
const results = {};
|
|
1121
|
-
for (const catalog of catalogRecords(model).filter(
|
|
1122
|
-
(record) => record.kind === "stage" && (record.ownerSystemId ?? systemScope(record.id)) === "sales.lead-gen"
|
|
1123
|
-
)) {
|
|
1124
|
-
const catalogEntity = appliesToEntityKind(catalog);
|
|
1125
|
-
if (catalogEntity !== "company" && catalogEntity !== "contact") continue;
|
|
1126
|
-
for (const [entryId, entry] of entriesOf(catalog)) {
|
|
1127
|
-
const entity = entry.entity === "contact" ? "contact" : entry.entity === "company" ? "company" : catalogEntity;
|
|
1128
|
-
const additionalEntities = stringArray(entry.additionalEntities).filter(
|
|
1129
|
-
(item) => item === "company" || item === "contact"
|
|
1130
|
-
);
|
|
1131
|
-
const recordEntity = entry.recordEntity === "company" || entry.recordEntity === "contact" ? entry.recordEntity : void 0;
|
|
1132
|
-
const recordStageKey = stringValue(entry.recordStageKey);
|
|
1133
|
-
const readinessTarget = entry.readinessTarget === true ? true : void 0;
|
|
1134
|
-
results[entryId] = {
|
|
1135
|
-
key: entryId,
|
|
1136
|
-
label: stringValue(entry.label) ?? entryId,
|
|
1137
|
-
description: stringValue(entry.description) ?? "",
|
|
1138
|
-
order: numberValue(entry.order),
|
|
1139
|
-
entity,
|
|
1140
|
-
...additionalEntities.length > 0 ? { additionalEntities } : {},
|
|
1141
|
-
...recordEntity ? { recordEntity } : {},
|
|
1142
|
-
...recordStageKey ? { recordStageKey } : {},
|
|
1143
|
-
...readinessTarget ? { readinessTarget } : {}
|
|
1144
|
-
};
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
return Object.fromEntries(
|
|
1148
|
-
Object.entries(results).sort(([, a], [, b]) => a.order - b.order || a.key.localeCompare(b.key))
|
|
1149
|
-
);
|
|
1150
|
-
}
|
|
1151
|
-
function getAllProjectStatuses(model, appliesTo) {
|
|
1152
|
-
return catalogRecords(model).filter((catalog) => catalog.kind === "status-flow" && appliesToEntityKind(catalog) === appliesTo).flatMap(
|
|
1153
|
-
(catalog) => entriesOf(catalog).map(([entryId, entry]) => ({
|
|
1154
|
-
id: entryId,
|
|
1155
|
-
label: stringValue(entry.label) ?? entryId,
|
|
1156
|
-
order: numberValue(entry.order),
|
|
1157
|
-
...stringValue(entry.color) ? { color: stringValue(entry.color) } : {},
|
|
1158
|
-
...stringValue(entry.description) ? { description: stringValue(entry.description) } : {}
|
|
1159
|
-
}))
|
|
1160
|
-
).sort((a, b) => a.order - b.order || a.id.localeCompare(b.id));
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
// ../core/src/business/acquisition/ontology-validation.ts
|
|
1164
|
-
var LEAD_GEN_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[0];
|
|
1165
|
-
var CRM_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[1];
|
|
1166
|
-
var LEAD_GEN_CRM_HANDOFF_INTERFACE = SYSTEM_INTERFACE_PROFILES[2];
|
|
1167
|
-
LEAD_GEN_API_INTERFACE.readinessProfile;
|
|
1168
|
-
CRM_API_INTERFACE.readinessProfile;
|
|
1169
|
-
LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile;
|
|
1170
|
-
var LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID = formatOntologyId({
|
|
1171
|
-
scope: "sales.lead-gen",
|
|
1172
|
-
kind: "object",
|
|
1173
|
-
localId: "list"
|
|
1174
|
-
});
|
|
1175
|
-
var LEAD_GEN_COMPANY_OBJECT_ONTOLOGY_ID = formatOntologyId({
|
|
1176
|
-
scope: "sales.lead-gen",
|
|
1177
|
-
kind: "object",
|
|
1178
|
-
localId: "company"
|
|
1179
|
-
});
|
|
1180
|
-
var LEAD_GEN_CONTACT_OBJECT_ONTOLOGY_ID = formatOntologyId({
|
|
1181
|
-
scope: "sales.lead-gen",
|
|
1182
|
-
kind: "object",
|
|
1183
|
-
localId: "contact"
|
|
1184
|
-
});
|
|
1185
|
-
var LEAD_GEN_BUILD_TEMPLATE_CATALOG_ONTOLOGY_ID = formatOntologyId({
|
|
1186
|
-
scope: "sales.lead-gen",
|
|
1187
|
-
kind: "catalog",
|
|
1188
|
-
localId: "build-template"
|
|
1189
|
-
});
|
|
1190
|
-
var LEAD_GEN_COMPANY_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
|
|
1191
|
-
scope: "sales.lead-gen",
|
|
1192
|
-
kind: "catalog",
|
|
1193
|
-
localId: "company-stage"
|
|
1194
|
-
});
|
|
1195
|
-
var LEAD_GEN_CONTACT_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
|
|
1196
|
-
scope: "sales.lead-gen",
|
|
1197
|
-
kind: "catalog",
|
|
1198
|
-
localId: "contact-stage"
|
|
1199
|
-
});
|
|
1200
|
-
var CRM_PIPELINE_CATALOG_ONTOLOGY_ID = formatOntologyId({
|
|
1201
|
-
scope: "sales.crm",
|
|
1202
|
-
kind: "catalog",
|
|
1203
|
-
localId: "crm.pipeline"
|
|
1204
|
-
});
|
|
1205
|
-
var LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
|
|
1206
|
-
scope: "sales.lead-gen",
|
|
1207
|
-
kind: "catalog",
|
|
1208
|
-
localId: "lead-gen.stage-catalog"
|
|
1209
|
-
});
|
|
1210
|
-
function createLeadGenStageCatalog(model) {
|
|
1211
|
-
return {
|
|
1212
|
-
id: LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID,
|
|
1213
|
-
label: "Lead Gen Processing Stages",
|
|
1214
|
-
ownerSystemId: "sales.lead-gen",
|
|
1215
|
-
kind: "processing-stage-catalog",
|
|
1216
|
-
entries: Object.fromEntries(
|
|
1217
|
-
Object.entries(getLeadGenStageCatalog(model)).map(([key, entry]) => [
|
|
1218
|
-
key,
|
|
1219
|
-
{
|
|
1220
|
-
...entry
|
|
1221
|
-
}
|
|
1222
|
-
])
|
|
1223
|
-
),
|
|
1224
|
-
legacyCatalogKey: "LEAD_GEN_STAGE_CATALOG"
|
|
1225
|
-
};
|
|
1226
|
-
}
|
|
1227
|
-
function isPlainRecord(value) {
|
|
1228
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1229
|
-
}
|
|
1009
|
+
// ../core/src/organization-model/readiness/engine.ts
|
|
1230
1010
|
function addReadinessIssue(issues, family, code, message, details = {}) {
|
|
1231
1011
|
issues.push({
|
|
1232
1012
|
family,
|
|
@@ -1239,16 +1019,26 @@ function formatInterfaceIdentity(systemPath, interfaceKey) {
|
|
|
1239
1019
|
return `${systemPath}/${interfaceKey}`;
|
|
1240
1020
|
}
|
|
1241
1021
|
function readinessMarkerPath(context) {
|
|
1242
|
-
return context.interfaceKey === "api" ? `systems.${context.systemPath}.apiInterface` :
|
|
1022
|
+
return context.interfaceKey === "api" ? `systems.${context.systemPath}.apiInterface` : void 0;
|
|
1023
|
+
}
|
|
1024
|
+
function readinessMarkerFieldPath(context, suffix) {
|
|
1025
|
+
const base = readinessMarkerPath(context);
|
|
1026
|
+
return base === void 0 ? void 0 : `${base}${suffix}`;
|
|
1243
1027
|
}
|
|
1244
1028
|
function formatSupportedReadinessProfiles() {
|
|
1245
1029
|
return SYSTEM_INTERFACE_PROFILES.map((p) => `"${p.readinessProfile}"`).join(", ");
|
|
1246
1030
|
}
|
|
1031
|
+
function isPlainRecord(value) {
|
|
1032
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1033
|
+
}
|
|
1034
|
+
function getCatalogEntries(catalog) {
|
|
1035
|
+
return isPlainRecord(catalog.entries) ? catalog.entries : {};
|
|
1036
|
+
}
|
|
1247
1037
|
function getActiveScopedResources(model, resourceIds, issues, context) {
|
|
1248
1038
|
const resources = [];
|
|
1249
1039
|
for (const [index, resourceId] of resourceIds.entries()) {
|
|
1250
1040
|
const resource = model.resources?.[resourceId];
|
|
1251
|
-
const path =
|
|
1041
|
+
const path = readinessMarkerFieldPath(context, `.resourceIds.${index}`);
|
|
1252
1042
|
if (resource === void 0) {
|
|
1253
1043
|
addReadinessIssue(
|
|
1254
1044
|
issues,
|
|
@@ -1293,7 +1083,7 @@ function requireScopedBinding(issues, boundIds, bindingKey, ontologyId, context)
|
|
|
1293
1083
|
"SYSTEM_INTERFACE_NOT_READY",
|
|
1294
1084
|
"missing-resource-binding",
|
|
1295
1085
|
`System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" has no active scoped resource with ontology.${bindingKey} binding "${ontologyId}".`,
|
|
1296
|
-
{ path:
|
|
1086
|
+
{ path: readinessMarkerFieldPath(context, ".resourceIds"), ref: ontologyId }
|
|
1297
1087
|
);
|
|
1298
1088
|
}
|
|
1299
1089
|
function ontologyOwnerMatches(ontologyId, expectedSystemPath, catalog) {
|
|
@@ -1355,129 +1145,40 @@ function requireCatalogReadiness(issues, index, catalogId, context) {
|
|
|
1355
1145
|
}
|
|
1356
1146
|
return catalog;
|
|
1357
1147
|
}
|
|
1358
|
-
function
|
|
1148
|
+
function requireContractReadiness(issues, index, resources, contract, context) {
|
|
1359
1149
|
const reads = resourceBindingIds(resources, "reads");
|
|
1360
1150
|
const catalogs = resourceBindingIds(resources, "usesCatalogs");
|
|
1361
|
-
for (const objectId of
|
|
1362
|
-
LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID,
|
|
1363
|
-
LEAD_GEN_COMPANY_OBJECT_ONTOLOGY_ID,
|
|
1364
|
-
LEAD_GEN_CONTACT_OBJECT_ONTOLOGY_ID
|
|
1365
|
-
]) {
|
|
1151
|
+
for (const objectId of contract.requiredObjects) {
|
|
1366
1152
|
requireObjectReadiness(issues, index, objectId, context);
|
|
1367
1153
|
requireScopedBinding(issues, reads, "reads", objectId, context);
|
|
1368
1154
|
}
|
|
1369
|
-
for (const catalogId of
|
|
1370
|
-
LEAD_GEN_BUILD_TEMPLATE_CATALOG_ONTOLOGY_ID,
|
|
1371
|
-
LEAD_GEN_COMPANY_STAGE_CATALOG_ONTOLOGY_ID,
|
|
1372
|
-
LEAD_GEN_CONTACT_STAGE_CATALOG_ONTOLOGY_ID
|
|
1373
|
-
]) {
|
|
1155
|
+
for (const catalogId of contract.requiredCatalogs) {
|
|
1374
1156
|
requireCatalogReadiness(issues, index, catalogId, context);
|
|
1375
1157
|
requireScopedBinding(issues, catalogs, "usesCatalogs", catalogId, context);
|
|
1376
1158
|
}
|
|
1377
|
-
const templateStepCatalog = findLeadGenTemplateStepCatalog(index);
|
|
1378
|
-
if (templateStepCatalog === void 0) {
|
|
1379
|
-
addReadinessIssue(
|
|
1380
|
-
issues,
|
|
1381
|
-
"SYSTEM_INTERFACE_NOT_READY",
|
|
1382
|
-
"missing-template-step-catalog",
|
|
1383
|
-
`System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" is missing a lead-gen template-step catalog.`
|
|
1384
|
-
);
|
|
1385
|
-
} else {
|
|
1386
|
-
requireCatalogReadiness(issues, index, templateStepCatalog.id, context);
|
|
1387
|
-
requireScopedBinding(issues, catalogs, "usesCatalogs", templateStepCatalog.id, context);
|
|
1388
|
-
}
|
|
1389
|
-
const leadGenStageCatalog = requireCatalogReadiness(issues, index, LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID, context);
|
|
1390
|
-
return leadGenStageCatalog;
|
|
1391
|
-
}
|
|
1392
|
-
function requireCrmInterfaceReadiness(issues, index, resources, context) {
|
|
1393
|
-
const catalogs = resourceBindingIds(resources, "usesCatalogs");
|
|
1394
|
-
const crmPipelineCatalog = requireCatalogReadiness(issues, index, CRM_PIPELINE_CATALOG_ONTOLOGY_ID, context);
|
|
1395
|
-
requireScopedBinding(issues, catalogs, "usesCatalogs", CRM_PIPELINE_CATALOG_ONTOLOGY_ID, context);
|
|
1396
|
-
return crmPipelineCatalog;
|
|
1397
|
-
}
|
|
1398
|
-
function findSystemInterfaceGrant(model, consumer, provider) {
|
|
1399
|
-
return Object.values(model.topology?.relationships ?? {}).find((relationship) => {
|
|
1400
|
-
const grant = relationship.metadata?.["systemInterfaceGrant"];
|
|
1401
|
-
if (!isPlainRecord(grant) || !isPlainRecord(grant.consumer) || !isPlainRecord(grant.provider)) return false;
|
|
1402
|
-
return grant.consumer.systemPath === consumer.systemPath && grant.consumer.interfaceKey === consumer.interfaceKey && grant.provider.systemPath === provider.systemPath && grant.provider.interfaceKey === provider.interfaceKey;
|
|
1403
|
-
});
|
|
1404
|
-
}
|
|
1405
|
-
function requireHandoffBridgeReadiness(issues, model, context) {
|
|
1406
|
-
const crmResult = computeInterfaceReadiness(model, CRM_API_INTERFACE);
|
|
1407
|
-
if (!crmResult.ready) {
|
|
1408
|
-
for (const issue of crmResult.issues) {
|
|
1409
|
-
addReadinessIssue(
|
|
1410
|
-
issues,
|
|
1411
|
-
"SYSTEM_BRIDGE_NOT_READY",
|
|
1412
|
-
issue.code,
|
|
1413
|
-
`Provider interface ${formatInterfaceIdentity(CRM_API_INTERFACE.systemPath, CRM_API_INTERFACE.interfaceKey)} is not ready: ${issue.message}`,
|
|
1414
|
-
{ path: issue.path, ref: issue.ref }
|
|
1415
|
-
);
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
const bridgeGrant = findSystemInterfaceGrant(model, context, CRM_API_INTERFACE);
|
|
1419
|
-
if (bridgeGrant === void 0) {
|
|
1420
|
-
addReadinessIssue(
|
|
1421
|
-
issues,
|
|
1422
|
-
"SYSTEM_BRIDGE_NOT_READY",
|
|
1423
|
-
"missing-topology-grant",
|
|
1424
|
-
`System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" requires a scoped topology grant to "${formatInterfaceIdentity(CRM_API_INTERFACE.systemPath, CRM_API_INTERFACE.interfaceKey)}".`
|
|
1425
|
-
);
|
|
1426
|
-
}
|
|
1427
|
-
return bridgeGrant;
|
|
1428
|
-
}
|
|
1429
|
-
function getLeadGenCrmHandoffResourceIds(model) {
|
|
1430
|
-
return Object.values(model.resources ?? {}).filter(
|
|
1431
|
-
(resource) => resource.systemPath === LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath && resource.ontology?.usesCatalogs?.includes(CRM_PIPELINE_CATALOG_ONTOLOGY_ID) === true
|
|
1432
|
-
).map((resource) => resource.id);
|
|
1433
1159
|
}
|
|
1434
1160
|
function getSystemInterfaceReadinessMarker(model, request) {
|
|
1435
1161
|
const system = getSystem(model, request.systemPath);
|
|
1436
1162
|
if (system === void 0) return void 0;
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
lifecycle: "active",
|
|
1440
|
-
readinessProfile: LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile,
|
|
1441
|
-
resourceIds: getLeadGenCrmHandoffResourceIds(model)
|
|
1442
|
-
};
|
|
1443
|
-
}
|
|
1163
|
+
const registeredMarker = resolveReadinessInterfaceMarker(model, request.systemPath, request.interfaceKey);
|
|
1164
|
+
if (registeredMarker !== void 0) return registeredMarker;
|
|
1444
1165
|
if (request.interfaceKey === "api" && system.apiInterface !== void 0) {
|
|
1445
1166
|
return system.apiInterface;
|
|
1446
1167
|
}
|
|
1447
1168
|
return void 0;
|
|
1448
1169
|
}
|
|
1449
|
-
function
|
|
1450
|
-
const
|
|
1451
|
-
const
|
|
1452
|
-
if (baseCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] === void 0) {
|
|
1453
|
-
derivedCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] = createLeadGenStageCatalog(model);
|
|
1454
|
-
}
|
|
1455
|
-
if (Object.keys(derivedCatalogTypes).length === 0) return model;
|
|
1456
|
-
return {
|
|
1457
|
-
...model,
|
|
1458
|
-
ontology: {
|
|
1459
|
-
...model.ontology ?? {},
|
|
1460
|
-
catalogTypes: {
|
|
1461
|
-
...baseCatalogTypes,
|
|
1462
|
-
...derivedCatalogTypes
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
};
|
|
1466
|
-
}
|
|
1467
|
-
function compileBusinessOntology(model, contractId) {
|
|
1468
|
-
const compilation = compileOrganizationOntology(mergeLeadGenDerivedCatalogs(model));
|
|
1170
|
+
function compileReadinessOntology(model, readinessProfile, prepareModel) {
|
|
1171
|
+
const preparedModel = prepareModel !== void 0 ? prepareModel(model) : model;
|
|
1172
|
+
const compilation = compileOrganizationOntology(preparedModel);
|
|
1469
1173
|
if (compilation.diagnostics.length > 0) {
|
|
1470
1174
|
const summary = compilation.diagnostics.map((diagnostic) => diagnostic.message).join("; ");
|
|
1471
|
-
throw new Error(`${
|
|
1175
|
+
throw new Error(`${readinessProfile} ontology validation index failed to compile: ${summary}`);
|
|
1472
1176
|
}
|
|
1473
|
-
return {
|
|
1474
|
-
ontology: compilation.ontology,
|
|
1475
|
-
actionTypesByLegacyId: indexActionTypesByLegacyId(compilation.ontology.actionTypes)
|
|
1476
|
-
};
|
|
1177
|
+
return { ontology: compilation.ontology };
|
|
1477
1178
|
}
|
|
1478
|
-
function
|
|
1179
|
+
function tryCompileReadinessOntology(model, readinessProfile, prepareModel, issues) {
|
|
1479
1180
|
try {
|
|
1480
|
-
return
|
|
1181
|
+
return compileReadinessOntology(model, readinessProfile, prepareModel);
|
|
1481
1182
|
} catch (error) {
|
|
1482
1183
|
addReadinessIssue(
|
|
1483
1184
|
issues,
|
|
@@ -1488,23 +1189,11 @@ function tryCompileBusinessOntology(model, readinessProfile, issues) {
|
|
|
1488
1189
|
return void 0;
|
|
1489
1190
|
}
|
|
1490
1191
|
}
|
|
1491
|
-
function requireContractReadiness(issues, index, resources, contract, context) {
|
|
1492
|
-
const reads = resourceBindingIds(resources, "reads");
|
|
1493
|
-
const catalogs = resourceBindingIds(resources, "usesCatalogs");
|
|
1494
|
-
for (const objectId of contract.requiredObjects) {
|
|
1495
|
-
requireObjectReadiness(issues, index, objectId, context);
|
|
1496
|
-
requireScopedBinding(issues, reads, "reads", objectId, context);
|
|
1497
|
-
}
|
|
1498
|
-
for (const catalogId of contract.requiredCatalogs) {
|
|
1499
|
-
requireCatalogReadiness(issues, index, catalogId, context);
|
|
1500
|
-
requireScopedBinding(issues, catalogs, "usesCatalogs", catalogId, context);
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
1192
|
function computeInterfaceReadiness(model, request) {
|
|
1504
1193
|
const issues = [];
|
|
1505
1194
|
const system = getSystem(model, request.systemPath);
|
|
1506
1195
|
const systemInterface = getSystemInterfaceReadinessMarker(model, request);
|
|
1507
|
-
const readinessProfile = systemInterface
|
|
1196
|
+
const readinessProfile = systemInterface?.readinessProfile;
|
|
1508
1197
|
const scopedResourceIds = systemInterface?.resourceIds ?? [];
|
|
1509
1198
|
if (system === void 0) {
|
|
1510
1199
|
addReadinessIssue(
|
|
@@ -1544,25 +1233,48 @@ function computeInterfaceReadiness(model, request) {
|
|
|
1544
1233
|
"SYSTEM_INTERFACE_DISABLED",
|
|
1545
1234
|
"inactive-interface",
|
|
1546
1235
|
`System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" lifecycle is "${systemInterface.lifecycle}".`,
|
|
1547
|
-
{ path:
|
|
1236
|
+
{ path: readinessMarkerFieldPath(request, ".lifecycle") }
|
|
1548
1237
|
);
|
|
1238
|
+
return {
|
|
1239
|
+
ready: false,
|
|
1240
|
+
systemPath: request.systemPath,
|
|
1241
|
+
interfaceKey: request.interfaceKey,
|
|
1242
|
+
readinessProfile,
|
|
1243
|
+
scopedResourceIds,
|
|
1244
|
+
issues
|
|
1245
|
+
};
|
|
1549
1246
|
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1247
|
+
if (readinessProfile === void 0) {
|
|
1248
|
+
addReadinessIssue(
|
|
1249
|
+
issues,
|
|
1250
|
+
"SYSTEM_INTERFACE_INVALID",
|
|
1251
|
+
"missing-readiness-profile",
|
|
1252
|
+
`System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" declares an apiInterface but no readinessProfile. Declare a built-in profile (${formatSupportedReadinessProfiles()}) or a custom id paired with a readinessContract.`,
|
|
1253
|
+
{ path: readinessMarkerFieldPath(request, ".readinessProfile") }
|
|
1254
|
+
);
|
|
1255
|
+
return {
|
|
1256
|
+
ready: false,
|
|
1257
|
+
systemPath: request.systemPath,
|
|
1258
|
+
interfaceKey: request.interfaceKey,
|
|
1259
|
+
scopedResourceIds,
|
|
1260
|
+
issues
|
|
1261
|
+
};
|
|
1262
|
+
}
|
|
1263
|
+
const isBuiltIn = isBuiltInReadinessProfile(readinessProfile);
|
|
1552
1264
|
const readinessContract = systemInterface.readinessContract;
|
|
1553
1265
|
if (!isBuiltIn && readinessContract === void 0) {
|
|
1554
1266
|
addReadinessIssue(
|
|
1555
1267
|
issues,
|
|
1556
1268
|
"SYSTEM_INTERFACE_INVALID",
|
|
1557
1269
|
"missing-readiness-contract",
|
|
1558
|
-
`System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" uses custom readiness profile "${
|
|
1559
|
-
{ path:
|
|
1270
|
+
`System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" uses custom readiness profile "${readinessProfile}" but declares no readinessContract. Built-in profiles: ${formatSupportedReadinessProfiles()}.`,
|
|
1271
|
+
{ path: readinessMarkerFieldPath(request, ".readinessContract"), ref: readinessProfile }
|
|
1560
1272
|
);
|
|
1561
1273
|
return {
|
|
1562
1274
|
ready: false,
|
|
1563
1275
|
systemPath: request.systemPath,
|
|
1564
1276
|
interfaceKey: request.interfaceKey,
|
|
1565
|
-
readinessProfile
|
|
1277
|
+
readinessProfile,
|
|
1566
1278
|
scopedResourceIds,
|
|
1567
1279
|
issues
|
|
1568
1280
|
};
|
|
@@ -1573,20 +1285,15 @@ function computeInterfaceReadiness(model, request) {
|
|
|
1573
1285
|
"SYSTEM_INTERFACE_NOT_READY",
|
|
1574
1286
|
"missing-scoped-resources",
|
|
1575
1287
|
`System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" must scope at least one active resource.`,
|
|
1576
|
-
{ path:
|
|
1288
|
+
{ path: readinessMarkerFieldPath(request, ".resourceIds") }
|
|
1577
1289
|
);
|
|
1578
1290
|
}
|
|
1579
1291
|
const resources = getActiveScopedResources(model, scopedResourceIds, issues, request);
|
|
1580
|
-
const
|
|
1292
|
+
const registration = getBuiltInReadinessProfile(readinessProfile);
|
|
1293
|
+
const index = tryCompileReadinessOntology(model, readinessProfile, registration?.prepareModel, issues);
|
|
1581
1294
|
if (index !== void 0) {
|
|
1582
|
-
if (
|
|
1583
|
-
|
|
1584
|
-
} else if (checkedReadinessProfile === CRM_API_INTERFACE.readinessProfile) {
|
|
1585
|
-
requireCrmInterfaceReadiness(issues, index, resources, request);
|
|
1586
|
-
} else if (checkedReadinessProfile === LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile) {
|
|
1587
|
-
requireLeadGenInterfaceReadiness(issues, index, resources, request);
|
|
1588
|
-
requireCrmInterfaceReadiness(issues, index, resources, { ...request, allowForeignOwner: true });
|
|
1589
|
-
requireHandoffBridgeReadiness(issues, model, request);
|
|
1295
|
+
if (registration !== void 0) {
|
|
1296
|
+
registration.validate(issues, index, resources, model, request);
|
|
1590
1297
|
} else if (readinessContract !== void 0) {
|
|
1591
1298
|
requireContractReadiness(issues, index, resources, readinessContract, request);
|
|
1592
1299
|
}
|
|
@@ -1595,29 +1302,11 @@ function computeInterfaceReadiness(model, request) {
|
|
|
1595
1302
|
ready: issues.length === 0,
|
|
1596
1303
|
systemPath: request.systemPath,
|
|
1597
1304
|
interfaceKey: request.interfaceKey,
|
|
1598
|
-
readinessProfile
|
|
1305
|
+
readinessProfile,
|
|
1599
1306
|
scopedResourceIds,
|
|
1600
1307
|
issues
|
|
1601
1308
|
};
|
|
1602
1309
|
}
|
|
1603
|
-
function findLeadGenTemplateStepCatalog(index) {
|
|
1604
|
-
return Object.values(index.ontology.catalogTypes).find(
|
|
1605
|
-
(catalog) => catalog.ownerSystemId === "sales.lead-gen" && catalog.kind === "template-step" && catalog.appliesTo === LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID
|
|
1606
|
-
);
|
|
1607
|
-
}
|
|
1608
|
-
function indexActionTypesByLegacyId(actionTypes) {
|
|
1609
|
-
const byLegacyId = {};
|
|
1610
|
-
for (const actionType of Object.values(actionTypes)) {
|
|
1611
|
-
const legacyActionId = actionType["legacyActionId"];
|
|
1612
|
-
if (typeof legacyActionId === "string") {
|
|
1613
|
-
byLegacyId[legacyActionId] = actionType;
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
return byLegacyId;
|
|
1617
|
-
}
|
|
1618
|
-
function getCatalogEntries(catalog) {
|
|
1619
|
-
return isPlainRecord(catalog.entries) ? catalog.entries : {};
|
|
1620
|
-
}
|
|
1621
1310
|
|
|
1622
1311
|
// ../core/src/platform/registry/resource-metadata.ts
|
|
1623
1312
|
var resourceTypeIconNames = {
|
|
@@ -1743,4 +1432,4 @@ function setupBrowserMocks() {
|
|
|
1743
1432
|
setupResizeObserver();
|
|
1744
1433
|
}
|
|
1745
1434
|
|
|
1746
|
-
export { APIClientError, API_URL, ActionInvocationSchema, ActionSchema, ActionsDomainSchema, DEBOUNCE_FILTER, DEBOUNCE_SLIDER, DEFAULT_ONTOLOGY_SCOPE, DEFAULT_ORGANIZATION_MODEL_ACTIONS, DEFAULT_ORGANIZATION_MODEL_SYSTEMS, DescriptionSchema, EntitiesDomainSchema, EntitySchema, GC_TIME_LONG, GC_TIME_MEDIUM, GC_TIME_SHORT, IconNameSchema, JsonValueSchema,
|
|
1435
|
+
export { APIClientError, API_URL, ActionInvocationSchema, ActionSchema, ActionsDomainSchema, DEBOUNCE_FILTER, DEBOUNCE_SLIDER, DEFAULT_ONTOLOGY_SCOPE, DEFAULT_ORGANIZATION_MODEL_ACTIONS, DEFAULT_ORGANIZATION_MODEL_SYSTEMS, DescriptionSchema, EntitiesDomainSchema, EntitySchema, GC_TIME_LONG, GC_TIME_MEDIUM, GC_TIME_SHORT, IconNameSchema, JsonValueSchema, LIMIT_ACTIVITY_FEED, LabelSchema, ModelIdSchema, NodeIdStringSchema, OAUTH_FLOW_TIMEOUT, OntologyIdSchema, OntologyScopeSchema, PAGE_SIZE_DEFAULT, PathSchema, STALE_TIME_ADMIN, STALE_TIME_DEFAULT, STALE_TIME_MONITORING, SYSTEM_INTERFACE_PROFILES, SystemEntrySchema, SystemIdSchema, SystemInterfaceRefSchema, SystemLifecycleSchema, SystemPathSchema, SystemsDomainSchema, addReadinessIssue, ancestorsOf, childrenOf, compileOrganizationOntology, computeInterfaceReadiness, defaultPathFor, devOnlyFor, findById, findByPath, formatChartAxisDate, formatDate, formatDateTime, formatErrorMessage, formatInterfaceIdentity, formatOntologyId, formatRelativeTime, formatTimeAgo, getErrorInfo, getErrorTitle, getResourceColor, getResourceIcon, getResourcesForSystem, getSystem, getSystemAncestors, isAPIClientError, listAllSystems, listResolvedOntologyRecords, ontologyGraphNodeId, parentOf, parseOntologyId, registerBuiltInReadinessProfile, registerReadinessInterfaceMarker, requireCatalogReadiness, requireContractReadiness, requireScopedBinding, resolveSystemConfig, resourceBindingIds, restoreConsole, setupBrowserMocks, suppressKnownWarnings, topLevel, validateEmail };
|