@elevasis/core 0.27.0 → 0.29.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 +146 -89
- package/dist/index.js +116 -46
- package/dist/knowledge/index.d.ts +21 -21
- package/dist/organization-model/index.d.ts +146 -89
- package/dist/organization-model/index.js +116 -46
- package/dist/test-utils/index.d.ts +20 -17
- package/dist/test-utils/index.js +22 -20
- package/package.json +1 -1
- package/src/business/acquisition/api-schemas.test.ts +59 -8
- package/src/business/acquisition/api-schemas.ts +10 -5
- package/src/business/acquisition/build-templates.test.ts +187 -240
- package/src/business/acquisition/build-templates.ts +87 -98
- package/src/business/acquisition/types.ts +390 -389
- package/src/execution/engine/index.ts +6 -4
- package/src/execution/engine/tools/lead-service-types.ts +63 -34
- package/src/execution/engine/tools/platform/acquisition/types.ts +7 -8
- package/src/execution/engine/tools/registry.ts +6 -4
- package/src/execution/engine/tools/tool-maps.ts +23 -1
- package/src/organization-model/__tests__/define-domain-record.test.ts +289 -0
- package/src/organization-model/__tests__/om-spine-doc-contract.test.ts +56 -0
- package/src/organization-model/domains/actions.ts +13 -0
- package/src/organization-model/domains/customers.ts +95 -78
- package/src/organization-model/domains/entities.ts +157 -144
- package/src/organization-model/domains/goals.ts +100 -83
- package/src/organization-model/domains/knowledge.ts +106 -93
- package/src/organization-model/domains/offerings.ts +88 -71
- package/src/organization-model/domains/policies.ts +115 -102
- package/src/organization-model/domains/prospecting.ts +2 -327
- package/src/organization-model/domains/roles.ts +109 -96
- package/src/organization-model/domains/statuses.ts +351 -339
- package/src/organization-model/domains/systems.ts +176 -164
- package/src/organization-model/helpers.ts +331 -306
- package/src/organization-model/index.ts +42 -0
- package/src/organization-model/migration-helpers.ts +16 -12
- package/src/organization-model/published.ts +27 -2
- package/src/platform/constants/versions.ts +1 -1
- package/src/reference/_generated/contracts.md +376 -352
- package/src/supabase/database.types.ts +3 -0
|
@@ -647,6 +647,63 @@ var DEFAULT_ORGANIZATION_MODEL_IDENTITY = {
|
|
|
647
647
|
businessHours: {},
|
|
648
648
|
clientBrief: ""
|
|
649
649
|
};
|
|
650
|
+
|
|
651
|
+
// src/organization-model/helpers.ts
|
|
652
|
+
function defineDomainRecord(schema, entries) {
|
|
653
|
+
return Object.fromEntries(
|
|
654
|
+
entries.map((entry) => {
|
|
655
|
+
const parsed = schema.parse(entry);
|
|
656
|
+
return [parsed.id, parsed];
|
|
657
|
+
})
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
function childSystemsOf2(system) {
|
|
661
|
+
return system.systems ?? system.subsystems ?? {};
|
|
662
|
+
}
|
|
663
|
+
function getSystem(model, path) {
|
|
664
|
+
const segments = path.split(".");
|
|
665
|
+
let current = model.systems;
|
|
666
|
+
let node;
|
|
667
|
+
for (const seg of segments) {
|
|
668
|
+
node = current[seg];
|
|
669
|
+
if (node === void 0) return void 0;
|
|
670
|
+
current = childSystemsOf2(node);
|
|
671
|
+
}
|
|
672
|
+
return node;
|
|
673
|
+
}
|
|
674
|
+
function listAllSystems(model) {
|
|
675
|
+
const results = [];
|
|
676
|
+
function walk(map, prefix) {
|
|
677
|
+
for (const [localId, system] of Object.entries(map)) {
|
|
678
|
+
const fullPath = prefix ? `${prefix}.${localId}` : localId;
|
|
679
|
+
results.push({ path: fullPath, system });
|
|
680
|
+
const childSystems = childSystemsOf2(system);
|
|
681
|
+
if (Object.keys(childSystems).length > 0) {
|
|
682
|
+
walk(childSystems, fullPath);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
walk(model.systems, "");
|
|
687
|
+
return results;
|
|
688
|
+
}
|
|
689
|
+
function isPlainJsonObject(value) {
|
|
690
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
691
|
+
}
|
|
692
|
+
function mergeJsonConfig(base, override) {
|
|
693
|
+
const result = { ...base };
|
|
694
|
+
for (const [key, value] of Object.entries(override)) {
|
|
695
|
+
const existing = result[key];
|
|
696
|
+
result[key] = isPlainJsonObject(existing) && isPlainJsonObject(value) ? mergeJsonConfig(existing, value) : value;
|
|
697
|
+
}
|
|
698
|
+
return result;
|
|
699
|
+
}
|
|
700
|
+
function resolveSystemConfig(model, path) {
|
|
701
|
+
const system = getSystem(model, path);
|
|
702
|
+
if (system === void 0) return {};
|
|
703
|
+
return mergeJsonConfig({}, system.config ?? {});
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
// src/organization-model/domains/customers.ts
|
|
650
707
|
var FirmographicsSchema = z.object({
|
|
651
708
|
/** Industry vertical (e.g. "Marketing Agency", "Legal", "Real Estate"). */
|
|
652
709
|
industry: z.string().trim().max(200).optional(),
|
|
@@ -697,6 +754,12 @@ var CustomersDomainSchema = z.record(z.string(), CustomerSegmentSchema).refine((
|
|
|
697
754
|
message: "Each segment entry id must match its map key"
|
|
698
755
|
}).default({});
|
|
699
756
|
var DEFAULT_ORGANIZATION_MODEL_CUSTOMERS = {};
|
|
757
|
+
function defineCustomer(entry) {
|
|
758
|
+
return CustomerSegmentSchema.parse(entry);
|
|
759
|
+
}
|
|
760
|
+
function defineCustomers(entries) {
|
|
761
|
+
return defineDomainRecord(CustomerSegmentSchema, entries);
|
|
762
|
+
}
|
|
700
763
|
var PricingModelSchema = z.enum(["one-time", "subscription", "usage-based", "custom"]).meta({ label: "Pricing model", color: "green" });
|
|
701
764
|
var ProductSchema = z.object({
|
|
702
765
|
/** Stable unique identifier for the product (e.g. "product-starter-plan"). */
|
|
@@ -739,6 +802,12 @@ var OfferingsDomainSchema = z.record(z.string(), ProductSchema).refine((record)
|
|
|
739
802
|
message: "Each product entry id must match its map key"
|
|
740
803
|
}).default({});
|
|
741
804
|
var DEFAULT_ORGANIZATION_MODEL_OFFERINGS = {};
|
|
805
|
+
function defineOffering(entry) {
|
|
806
|
+
return ProductSchema.parse(entry);
|
|
807
|
+
}
|
|
808
|
+
function defineOfferings(entries) {
|
|
809
|
+
return defineDomainRecord(ProductSchema, entries);
|
|
810
|
+
}
|
|
742
811
|
var EntityIdSchema = ModelIdSchema;
|
|
743
812
|
var EntityLinkKindSchema = z.enum(["belongs-to", "has-many", "has-one", "many-to-many"]).meta({ label: "Link kind" });
|
|
744
813
|
var EntityLinkSchema = z.object({
|
|
@@ -863,6 +932,12 @@ var DEFAULT_ORGANIZATION_MODEL_ENTITIES = Object.fromEntries(
|
|
|
863
932
|
return [parsed.id, parsed];
|
|
864
933
|
})
|
|
865
934
|
);
|
|
935
|
+
function defineEntity(entry) {
|
|
936
|
+
return EntitySchema.parse(entry);
|
|
937
|
+
}
|
|
938
|
+
function defineEntities(entries) {
|
|
939
|
+
return defineDomainRecord(EntitySchema, entries);
|
|
940
|
+
}
|
|
866
941
|
|
|
867
942
|
// src/organization-model/domains/actions.ts
|
|
868
943
|
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");
|
|
@@ -925,6 +1000,12 @@ var DEFAULT_ORGANIZATION_MODEL_ACTIONS = {};
|
|
|
925
1000
|
function findOrganizationActionById(id, actions = DEFAULT_ORGANIZATION_MODEL_ACTIONS) {
|
|
926
1001
|
return actions[id];
|
|
927
1002
|
}
|
|
1003
|
+
function defineAction(entry) {
|
|
1004
|
+
return ActionSchema.parse(entry);
|
|
1005
|
+
}
|
|
1006
|
+
function defineActions(entries) {
|
|
1007
|
+
return defineDomainRecord(ActionSchema, entries);
|
|
1008
|
+
}
|
|
928
1009
|
|
|
929
1010
|
// src/organization-model/domains/systems.ts
|
|
930
1011
|
var SystemKindSchema = z.enum(["product", "operational", "platform", "diagnostic"]).meta({ label: "System kind", color: "blue" });
|
|
@@ -1036,6 +1117,12 @@ var SystemsDomainSchema = z.record(z.string(), SystemEntrySchema).refine((record
|
|
|
1036
1117
|
message: "Each system entry id must match its map key"
|
|
1037
1118
|
}).default({});
|
|
1038
1119
|
var DEFAULT_ORGANIZATION_MODEL_SYSTEMS = {};
|
|
1120
|
+
function defineSystem(entry) {
|
|
1121
|
+
return SystemEntrySchema.parse(entry);
|
|
1122
|
+
}
|
|
1123
|
+
function defineSystems(entries) {
|
|
1124
|
+
return defineDomainRecord(SystemEntrySchema, entries);
|
|
1125
|
+
}
|
|
1039
1126
|
|
|
1040
1127
|
// src/organization-model/domains/resources.ts
|
|
1041
1128
|
var ContractRefSchema = z.string().trim().min(1).max(500).regex(
|
|
@@ -1256,6 +1343,12 @@ var RolesDomainSchema = z.record(z.string(), RoleSchema).refine((record) => Obje
|
|
|
1256
1343
|
message: "Each role entry id must match its map key"
|
|
1257
1344
|
}).default({});
|
|
1258
1345
|
var DEFAULT_ORGANIZATION_MODEL_ROLES = {};
|
|
1346
|
+
function defineRole(entry) {
|
|
1347
|
+
return RoleSchema.parse(entry);
|
|
1348
|
+
}
|
|
1349
|
+
function defineRoles(entries) {
|
|
1350
|
+
return defineDomainRecord(RoleSchema, entries);
|
|
1351
|
+
}
|
|
1259
1352
|
var KeyResultSchema = z.object({
|
|
1260
1353
|
/** Stable unique identifier for the measurable outcome (e.g. "kr-revenue-q1"). */
|
|
1261
1354
|
id: z.string().trim().min(1).max(100),
|
|
@@ -1304,6 +1397,12 @@ var GoalsDomainSchema = z.record(z.string(), ObjectiveSchema).refine((record) =>
|
|
|
1304
1397
|
message: "Each objective entry id must match its map key"
|
|
1305
1398
|
}).default({});
|
|
1306
1399
|
var DEFAULT_ORGANIZATION_MODEL_GOALS = {};
|
|
1400
|
+
function defineGoal(entry) {
|
|
1401
|
+
return ObjectiveSchema.parse(entry);
|
|
1402
|
+
}
|
|
1403
|
+
function defineGoals(entries) {
|
|
1404
|
+
return defineDomainRecord(ObjectiveSchema, entries);
|
|
1405
|
+
}
|
|
1307
1406
|
var KnowledgeTargetKindSchema = z.enum([
|
|
1308
1407
|
"system",
|
|
1309
1408
|
"resource",
|
|
@@ -1388,6 +1487,12 @@ var OrgKnowledgeNodeSchema = z.object({
|
|
|
1388
1487
|
updatedAt: z.string().trim().min(1).max(50)
|
|
1389
1488
|
});
|
|
1390
1489
|
var KnowledgeDomainSchema = z.record(ModelIdSchema, OrgKnowledgeNodeSchema).default({});
|
|
1490
|
+
function defineKnowledgeNode(entry) {
|
|
1491
|
+
return OrgKnowledgeNodeSchema.parse(entry);
|
|
1492
|
+
}
|
|
1493
|
+
function defineKnowledgeNodes(entries) {
|
|
1494
|
+
return defineDomainRecord(OrgKnowledgeNodeSchema, entries);
|
|
1495
|
+
}
|
|
1391
1496
|
var SecretLikeMetadataKeySchema = /(?:secret|password|passwd|token|api[-_]?key|credential|private[-_]?key)/i;
|
|
1392
1497
|
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-----)/;
|
|
1393
1498
|
var OmTopologyNodeKindSchema = z.enum([
|
|
@@ -1638,52 +1743,11 @@ var PoliciesDomainSchema = z.record(z.string(), PolicySchema).refine((record) =>
|
|
|
1638
1743
|
message: "Each policy entry id must match its map key"
|
|
1639
1744
|
}).default({});
|
|
1640
1745
|
var DEFAULT_ORGANIZATION_MODEL_POLICIES = {};
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
function childSystemsOf2(system) {
|
|
1644
|
-
return system.systems ?? system.subsystems ?? {};
|
|
1746
|
+
function definePolicy(entry) {
|
|
1747
|
+
return PolicySchema.parse(entry);
|
|
1645
1748
|
}
|
|
1646
|
-
function
|
|
1647
|
-
|
|
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 ?? {});
|
|
1749
|
+
function definePolicies(entries) {
|
|
1750
|
+
return defineDomainRecord(PolicySchema, entries);
|
|
1687
1751
|
}
|
|
1688
1752
|
|
|
1689
1753
|
// src/organization-model/cross-ref.ts
|
|
@@ -2523,6 +2587,12 @@ var StatusEntrySchema = z.object({
|
|
|
2523
2587
|
var StatusesDomainSchema = z.record(z.string(), StatusEntrySchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
2524
2588
|
message: "Each status entry id must match its map key"
|
|
2525
2589
|
}).default({});
|
|
2590
|
+
function defineStatus(entry) {
|
|
2591
|
+
return StatusEntrySchema.parse(entry);
|
|
2592
|
+
}
|
|
2593
|
+
function defineStatuses(entries) {
|
|
2594
|
+
return defineDomainRecord(StatusEntrySchema, entries);
|
|
2595
|
+
}
|
|
2526
2596
|
var DEFAULT_ORGANIZATION_MODEL_STATUSES = {
|
|
2527
2597
|
// --- delivery.task (TaskStatus — 9 values) ---
|
|
2528
2598
|
"delivery.task.planned": {
|
|
@@ -3372,4 +3442,4 @@ function scaffoldOrganizationModel(model, spec) {
|
|
|
3372
3442
|
return scaffoldKnowledgeNode(model, spec);
|
|
3373
3443
|
}
|
|
3374
3444
|
|
|
3375
|
-
export { ActionIdSchema, ActionInvocationKindSchema, ActionInvocationSchema, ActionRefSchema, ActionSchema, ActionScopeSchema, ActionsDomainSchema, AgentKindSchema, AgentResourceEntrySchema, AgentRoleHolderSchema, ApiEndpointInvocationSchema, CodeReferenceRoleSchema, CodeReferenceSchema, ContractRefSchema, 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, 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, listAllSystems, listResolvedOntologyRecords, ontologyGraphNodeId, ontologyIdFromGraphNodeId, parseContractRef, parseOntologyId, parseTopologyNodeRef, projectOrganizationSurfaces, resolveOrganizationModel, resolveOrganizationModelWithResources, scaffoldOrganizationModel, topologyRef, topologyRelationship, validateOrganizationSurfaceProjection };
|
|
3445
|
+
export { ActionIdSchema, ActionInvocationKindSchema, ActionInvocationSchema, ActionRefSchema, ActionSchema, ActionScopeSchema, ActionsDomainSchema, AgentKindSchema, AgentResourceEntrySchema, AgentRoleHolderSchema, ApiEndpointInvocationSchema, CodeReferenceRoleSchema, CodeReferenceSchema, ContractRefSchema, 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, 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, defineAction, defineActions, defineCustomer, defineCustomers, defineDomainRecord, defineEntities, defineEntity, defineGoal, defineGoals, defineKnowledgeNode, defineKnowledgeNodes, defineOffering, defineOfferings, defineOrganizationModel, definePolicies, definePolicy, defineResource, defineResourceOntology, defineResources, defineRole, defineRoles, defineStatus, defineStatuses, defineSystem, defineSystems, defineTopology, defineTopologyRelationship, findOrganizationActionById, formatOntologyId, getOntologyDiagnostics, getSortedSidebarEntries, isOntologyGraphNodeId, isOntologyTopologyRef, listAllSystems, listResolvedOntologyRecords, ontologyGraphNodeId, ontologyIdFromGraphNodeId, parseContractRef, parseOntologyId, parseTopologyNodeRef, projectOrganizationSurfaces, resolveOrganizationModel, resolveOrganizationModelWithResources, scaffoldOrganizationModel, topologyRef, topologyRelationship, validateOrganizationSurfaceProjection };
|
|
@@ -2786,6 +2786,7 @@ type Database = {
|
|
|
2786
2786
|
title: string | null;
|
|
2787
2787
|
updated_at: string;
|
|
2788
2788
|
user_id: string;
|
|
2789
|
+
visibility: string;
|
|
2789
2790
|
};
|
|
2790
2791
|
Insert: {
|
|
2791
2792
|
content: string;
|
|
@@ -2800,6 +2801,7 @@ type Database = {
|
|
|
2800
2801
|
title?: string | null;
|
|
2801
2802
|
updated_at?: string;
|
|
2802
2803
|
user_id: string;
|
|
2804
|
+
visibility?: string;
|
|
2803
2805
|
};
|
|
2804
2806
|
Update: {
|
|
2805
2807
|
content?: string;
|
|
@@ -2814,6 +2816,7 @@ type Database = {
|
|
|
2814
2816
|
title?: string | null;
|
|
2815
2817
|
updated_at?: string;
|
|
2816
2818
|
user_id?: string;
|
|
2819
|
+
visibility?: string;
|
|
2817
2820
|
};
|
|
2818
2821
|
Relationships: [
|
|
2819
2822
|
{
|
|
@@ -3719,9 +3722,9 @@ declare const SurfaceTypeSchema: z.ZodEnum<{
|
|
|
3719
3722
|
dashboard: "dashboard";
|
|
3720
3723
|
settings: "settings";
|
|
3721
3724
|
graph: "graph";
|
|
3722
|
-
list: "list";
|
|
3723
3725
|
page: "page";
|
|
3724
3726
|
detail: "detail";
|
|
3727
|
+
list: "list";
|
|
3725
3728
|
}>;
|
|
3726
3729
|
interface SidebarSurfaceNode {
|
|
3727
3730
|
type: 'surface';
|
|
@@ -4159,8 +4162,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4159
4162
|
description: z.ZodOptional<z.ZodString>;
|
|
4160
4163
|
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
4161
4164
|
status: z.ZodEnum<{
|
|
4162
|
-
deprecated: "deprecated";
|
|
4163
4165
|
active: "active";
|
|
4166
|
+
deprecated: "deprecated";
|
|
4164
4167
|
archived: "archived";
|
|
4165
4168
|
}>;
|
|
4166
4169
|
ontology: z.ZodOptional<z.ZodObject<{
|
|
@@ -4178,12 +4181,12 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4178
4181
|
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
4179
4182
|
path: z.ZodString;
|
|
4180
4183
|
role: z.ZodEnum<{
|
|
4181
|
-
config: "config";
|
|
4182
4184
|
entrypoint: "entrypoint";
|
|
4183
4185
|
handler: "handler";
|
|
4184
4186
|
schema: "schema";
|
|
4185
4187
|
test: "test";
|
|
4186
4188
|
docs: "docs";
|
|
4189
|
+
config: "config";
|
|
4187
4190
|
}>;
|
|
4188
4191
|
symbol: z.ZodOptional<z.ZodString>;
|
|
4189
4192
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -4194,10 +4197,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4194
4197
|
label: z.ZodString;
|
|
4195
4198
|
payloadSchema: z.ZodOptional<z.ZodString>;
|
|
4196
4199
|
lifecycle: z.ZodOptional<z.ZodEnum<{
|
|
4200
|
+
active: "active";
|
|
4197
4201
|
deprecated: "deprecated";
|
|
4198
4202
|
draft: "draft";
|
|
4199
4203
|
beta: "beta";
|
|
4200
|
-
active: "active";
|
|
4201
4204
|
archived: "archived";
|
|
4202
4205
|
}>>;
|
|
4203
4206
|
}, z.core.$strip>>>;
|
|
@@ -4209,8 +4212,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4209
4212
|
description: z.ZodOptional<z.ZodString>;
|
|
4210
4213
|
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
4211
4214
|
status: z.ZodEnum<{
|
|
4212
|
-
deprecated: "deprecated";
|
|
4213
4215
|
active: "active";
|
|
4216
|
+
deprecated: "deprecated";
|
|
4214
4217
|
archived: "archived";
|
|
4215
4218
|
}>;
|
|
4216
4219
|
ontology: z.ZodOptional<z.ZodObject<{
|
|
@@ -4228,12 +4231,12 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4228
4231
|
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
4229
4232
|
path: z.ZodString;
|
|
4230
4233
|
role: z.ZodEnum<{
|
|
4231
|
-
config: "config";
|
|
4232
4234
|
entrypoint: "entrypoint";
|
|
4233
4235
|
handler: "handler";
|
|
4234
4236
|
schema: "schema";
|
|
4235
4237
|
test: "test";
|
|
4236
4238
|
docs: "docs";
|
|
4239
|
+
config: "config";
|
|
4237
4240
|
}>;
|
|
4238
4241
|
symbol: z.ZodOptional<z.ZodString>;
|
|
4239
4242
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -4275,10 +4278,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4275
4278
|
label: z.ZodString;
|
|
4276
4279
|
payloadSchema: z.ZodOptional<z.ZodString>;
|
|
4277
4280
|
lifecycle: z.ZodOptional<z.ZodEnum<{
|
|
4281
|
+
active: "active";
|
|
4278
4282
|
deprecated: "deprecated";
|
|
4279
4283
|
draft: "draft";
|
|
4280
4284
|
beta: "beta";
|
|
4281
|
-
active: "active";
|
|
4282
4285
|
archived: "archived";
|
|
4283
4286
|
}>>;
|
|
4284
4287
|
}, z.core.$strip>>>;
|
|
@@ -4290,8 +4293,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4290
4293
|
description: z.ZodOptional<z.ZodString>;
|
|
4291
4294
|
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
4292
4295
|
status: z.ZodEnum<{
|
|
4293
|
-
deprecated: "deprecated";
|
|
4294
4296
|
active: "active";
|
|
4297
|
+
deprecated: "deprecated";
|
|
4295
4298
|
archived: "archived";
|
|
4296
4299
|
}>;
|
|
4297
4300
|
ontology: z.ZodOptional<z.ZodObject<{
|
|
@@ -4309,12 +4312,12 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4309
4312
|
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
4310
4313
|
path: z.ZodString;
|
|
4311
4314
|
role: z.ZodEnum<{
|
|
4312
|
-
config: "config";
|
|
4313
4315
|
entrypoint: "entrypoint";
|
|
4314
4316
|
handler: "handler";
|
|
4315
4317
|
schema: "schema";
|
|
4316
4318
|
test: "test";
|
|
4317
4319
|
docs: "docs";
|
|
4320
|
+
config: "config";
|
|
4318
4321
|
}>;
|
|
4319
4322
|
symbol: z.ZodOptional<z.ZodString>;
|
|
4320
4323
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -4329,8 +4332,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4329
4332
|
description: z.ZodOptional<z.ZodString>;
|
|
4330
4333
|
ownerRoleId: z.ZodOptional<z.ZodString>;
|
|
4331
4334
|
status: z.ZodEnum<{
|
|
4332
|
-
deprecated: "deprecated";
|
|
4333
4335
|
active: "active";
|
|
4336
|
+
deprecated: "deprecated";
|
|
4334
4337
|
archived: "archived";
|
|
4335
4338
|
}>;
|
|
4336
4339
|
ontology: z.ZodOptional<z.ZodObject<{
|
|
@@ -4348,12 +4351,12 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4348
4351
|
codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
4349
4352
|
path: z.ZodString;
|
|
4350
4353
|
role: z.ZodEnum<{
|
|
4351
|
-
config: "config";
|
|
4352
4354
|
entrypoint: "entrypoint";
|
|
4353
4355
|
handler: "handler";
|
|
4354
4356
|
schema: "schema";
|
|
4355
4357
|
test: "test";
|
|
4356
4358
|
docs: "docs";
|
|
4359
|
+
config: "config";
|
|
4357
4360
|
}>;
|
|
4358
4361
|
symbol: z.ZodOptional<z.ZodString>;
|
|
4359
4362
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -4467,10 +4470,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4467
4470
|
}, z.core.$strip>], "kind">>>;
|
|
4468
4471
|
knowledge: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
4469
4472
|
lifecycle: z.ZodDefault<z.ZodEnum<{
|
|
4473
|
+
active: "active";
|
|
4470
4474
|
deprecated: "deprecated";
|
|
4471
4475
|
draft: "draft";
|
|
4472
4476
|
beta: "beta";
|
|
4473
|
-
active: "active";
|
|
4474
4477
|
archived: "archived";
|
|
4475
4478
|
}>>;
|
|
4476
4479
|
}, z.core.$strip>>>>;
|
|
@@ -4548,10 +4551,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4548
4551
|
roleIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
4549
4552
|
}, z.core.$strip>>;
|
|
4550
4553
|
lifecycle: z.ZodDefault<z.ZodEnum<{
|
|
4554
|
+
active: "active";
|
|
4551
4555
|
deprecated: "deprecated";
|
|
4552
4556
|
draft: "draft";
|
|
4553
4557
|
beta: "beta";
|
|
4554
|
-
active: "active";
|
|
4555
4558
|
archived: "archived";
|
|
4556
4559
|
}>>;
|
|
4557
4560
|
}, z.core.$strip>>>>;
|
|
@@ -4634,12 +4637,12 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4634
4637
|
kind: z.ZodEnum<{
|
|
4635
4638
|
knowledge: "knowledge";
|
|
4636
4639
|
system: "system";
|
|
4640
|
+
resource: "resource";
|
|
4637
4641
|
action: "action";
|
|
4638
4642
|
ontology: "ontology";
|
|
4639
4643
|
role: "role";
|
|
4640
|
-
goal: "goal";
|
|
4641
|
-
resource: "resource";
|
|
4642
4644
|
stage: "stage";
|
|
4645
|
+
goal: "goal";
|
|
4643
4646
|
"customer-segment": "customer-segment";
|
|
4644
4647
|
offering: "offering";
|
|
4645
4648
|
}>;
|
|
@@ -4649,7 +4652,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4649
4652
|
nodeId: z.ZodUnion<readonly [z.ZodString, z.ZodTemplateLiteral<`ontology:${string}`>]>;
|
|
4650
4653
|
}, z.core.$strip>]>, z.ZodTransform<{
|
|
4651
4654
|
target: {
|
|
4652
|
-
kind: "knowledge" | "system" | "
|
|
4655
|
+
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "stage" | "goal" | "customer-segment" | "offering";
|
|
4653
4656
|
id: string;
|
|
4654
4657
|
};
|
|
4655
4658
|
nodeId: string;
|
|
@@ -4657,7 +4660,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4657
4660
|
nodeId: string;
|
|
4658
4661
|
} | {
|
|
4659
4662
|
target: {
|
|
4660
|
-
kind: "knowledge" | "system" | "
|
|
4663
|
+
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "stage" | "goal" | "customer-segment" | "offering";
|
|
4661
4664
|
id: string;
|
|
4662
4665
|
};
|
|
4663
4666
|
}>>>>;
|
package/dist/test-utils/index.js
CHANGED
|
@@ -20036,6 +20036,28 @@ var DEFAULT_ORGANIZATION_MODEL_IDENTITY = {
|
|
|
20036
20036
|
businessHours: {},
|
|
20037
20037
|
clientBrief: ""
|
|
20038
20038
|
};
|
|
20039
|
+
|
|
20040
|
+
// src/organization-model/helpers.ts
|
|
20041
|
+
function childSystemsOf2(system) {
|
|
20042
|
+
return system.systems ?? system.subsystems ?? {};
|
|
20043
|
+
}
|
|
20044
|
+
function listAllSystems(model) {
|
|
20045
|
+
const results = [];
|
|
20046
|
+
function walk(map2, prefix) {
|
|
20047
|
+
for (const [localId, system] of Object.entries(map2)) {
|
|
20048
|
+
const fullPath = prefix ? `${prefix}.${localId}` : localId;
|
|
20049
|
+
results.push({ path: fullPath, system });
|
|
20050
|
+
const childSystems = childSystemsOf2(system);
|
|
20051
|
+
if (Object.keys(childSystems).length > 0) {
|
|
20052
|
+
walk(childSystems, fullPath);
|
|
20053
|
+
}
|
|
20054
|
+
}
|
|
20055
|
+
}
|
|
20056
|
+
walk(model.systems, "");
|
|
20057
|
+
return results;
|
|
20058
|
+
}
|
|
20059
|
+
|
|
20060
|
+
// src/organization-model/domains/customers.ts
|
|
20039
20061
|
var FirmographicsSchema = z.object({
|
|
20040
20062
|
/** Industry vertical (e.g. "Marketing Agency", "Legal", "Real Estate"). */
|
|
20041
20063
|
industry: z.string().trim().max(200).optional(),
|
|
@@ -20879,26 +20901,6 @@ var PoliciesDomainSchema = z.record(z.string(), PolicySchema).refine((record) =>
|
|
|
20879
20901
|
}).default({});
|
|
20880
20902
|
var DEFAULT_ORGANIZATION_MODEL_POLICIES = {};
|
|
20881
20903
|
|
|
20882
|
-
// src/organization-model/helpers.ts
|
|
20883
|
-
function childSystemsOf2(system) {
|
|
20884
|
-
return system.systems ?? system.subsystems ?? {};
|
|
20885
|
-
}
|
|
20886
|
-
function listAllSystems(model) {
|
|
20887
|
-
const results = [];
|
|
20888
|
-
function walk(map2, prefix) {
|
|
20889
|
-
for (const [localId, system] of Object.entries(map2)) {
|
|
20890
|
-
const fullPath = prefix ? `${prefix}.${localId}` : localId;
|
|
20891
|
-
results.push({ path: fullPath, system });
|
|
20892
|
-
const childSystems = childSystemsOf2(system);
|
|
20893
|
-
if (Object.keys(childSystems).length > 0) {
|
|
20894
|
-
walk(childSystems, fullPath);
|
|
20895
|
-
}
|
|
20896
|
-
}
|
|
20897
|
-
}
|
|
20898
|
-
walk(model.systems, "");
|
|
20899
|
-
return results;
|
|
20900
|
-
}
|
|
20901
|
-
|
|
20902
20904
|
// src/organization-model/cross-ref.ts
|
|
20903
20905
|
var ONTOLOGY_REFERENCE_KEY_KINDS = {
|
|
20904
20906
|
valueType: "value-type",
|
package/package.json
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
ListReadQuerySchema,
|
|
45
45
|
ListRecordsQuerySchema,
|
|
46
46
|
ListStatusSchema,
|
|
47
|
+
PipelineConfigSchema,
|
|
47
48
|
PipelineStageSchema,
|
|
48
49
|
ScrapingConfigSchema,
|
|
49
50
|
TransitionDealStateRequestSchema,
|
|
@@ -54,7 +55,7 @@ import {
|
|
|
54
55
|
UpdateListRequestSchema,
|
|
55
56
|
UpdateListStatusRequestSchema
|
|
56
57
|
} from './api-schemas'
|
|
57
|
-
import {
|
|
58
|
+
import { createBuildPlanSnapshotFromTemplate } from './build-templates'
|
|
58
59
|
import {
|
|
59
60
|
compileBusinessOntologyValidationIndex,
|
|
60
61
|
CRM_PIPELINE_CATALOG_ONTOLOGY_ID,
|
|
@@ -1168,17 +1169,32 @@ describe('PipelineStageSchema', () => {
|
|
|
1168
1169
|
// ---------------------------------------------------------------------------
|
|
1169
1170
|
|
|
1170
1171
|
describe('BuildPlanSnapshotSchema', () => {
|
|
1171
|
-
const validSnapshot =
|
|
1172
|
+
const validSnapshot = createBuildPlanSnapshotFromTemplate({
|
|
1173
|
+
id: 'tenant-template',
|
|
1174
|
+
label: 'Tenant Template',
|
|
1175
|
+
steps: [
|
|
1176
|
+
{
|
|
1177
|
+
id: 'source-companies',
|
|
1178
|
+
label: 'Companies found',
|
|
1179
|
+
primaryEntity: 'company',
|
|
1180
|
+
outputs: ['company'],
|
|
1181
|
+
stageKey: 'populated',
|
|
1182
|
+
dependencyMode: 'per-record-eligibility',
|
|
1183
|
+
actionKey: 'lead-gen.company.source',
|
|
1184
|
+
defaultBatchSize: 100,
|
|
1185
|
+
maxBatchSize: 250
|
|
1186
|
+
}
|
|
1187
|
+
]
|
|
1188
|
+
})
|
|
1172
1189
|
|
|
1173
1190
|
it('accepts a snapshot generated from a prospecting build template', () => {
|
|
1174
|
-
expect(validSnapshot).not.toBeNull()
|
|
1175
1191
|
expect(BuildPlanSnapshotSchema.safeParse(validSnapshot).success).toBe(true)
|
|
1176
1192
|
})
|
|
1177
1193
|
|
|
1178
1194
|
it('accepts custom non-empty step stage keys at the transport boundary', () => {
|
|
1179
1195
|
const result = BuildPlanSnapshotSchema.safeParse({
|
|
1180
1196
|
...validSnapshot,
|
|
1181
|
-
steps: [{ ...validSnapshot
|
|
1197
|
+
steps: [{ ...validSnapshot.steps[0], stageKey: 'made-up-stage' }]
|
|
1182
1198
|
})
|
|
1183
1199
|
|
|
1184
1200
|
expect(result.success).toBe(true)
|
|
@@ -1187,7 +1203,7 @@ describe('BuildPlanSnapshotSchema', () => {
|
|
|
1187
1203
|
it('accepts custom non-empty action keys at the transport boundary', () => {
|
|
1188
1204
|
const result = BuildPlanSnapshotSchema.safeParse({
|
|
1189
1205
|
...validSnapshot,
|
|
1190
|
-
steps: [{ ...validSnapshot
|
|
1206
|
+
steps: [{ ...validSnapshot.steps[0], actionKey: 'lead-gen.missing.action' }]
|
|
1191
1207
|
})
|
|
1192
1208
|
|
|
1193
1209
|
expect(result.success).toBe(true)
|
|
@@ -1293,8 +1309,8 @@ describe('CreateListRequestSchema', () => {
|
|
|
1293
1309
|
expect(result.success).toBe(true)
|
|
1294
1310
|
})
|
|
1295
1311
|
|
|
1296
|
-
it('
|
|
1297
|
-
expect(CreateListRequestSchema.safeParse({ name: 'X', buildTemplateId: 'not-a-template' }).success).toBe(
|
|
1312
|
+
it('accepts tenant-owned build template ids for API-layer membership validation', () => {
|
|
1313
|
+
expect(CreateListRequestSchema.safeParse({ name: 'X', buildTemplateId: 'not-a-template' }).success).toBe(true)
|
|
1298
1314
|
})
|
|
1299
1315
|
|
|
1300
1316
|
it('rejects an invalid status', () => {
|
|
@@ -1311,10 +1327,20 @@ describe('CreateListRequestSchema', () => {
|
|
|
1311
1327
|
name: 'SaaS List',
|
|
1312
1328
|
scrapingConfig: { vertical: 'SaaS' },
|
|
1313
1329
|
icp: { minReviewCount: 5 },
|
|
1314
|
-
pipelineConfig: { stages: [] }
|
|
1330
|
+
pipelineConfig: { stages: [], dataMode: 'mock' }
|
|
1315
1331
|
}).success
|
|
1316
1332
|
).toBe(true)
|
|
1317
1333
|
})
|
|
1334
|
+
|
|
1335
|
+
it('accepts create-time list-wide pipeline dataMode', () => {
|
|
1336
|
+
const result = CreateListRequestSchema.safeParse({
|
|
1337
|
+
name: 'DTC Demo',
|
|
1338
|
+
pipelineConfig: { dataMode: 'mock' }
|
|
1339
|
+
})
|
|
1340
|
+
|
|
1341
|
+
expect(result.success).toBe(true)
|
|
1342
|
+
if (result.success) expect(result.data.pipelineConfig?.dataMode).toBe('mock')
|
|
1343
|
+
})
|
|
1318
1344
|
})
|
|
1319
1345
|
|
|
1320
1346
|
// ---------------------------------------------------------------------------
|
|
@@ -1404,11 +1430,36 @@ describe('UpdateListConfigRequestSchema', () => {
|
|
|
1404
1430
|
expect(UpdateListConfigRequestSchema.safeParse({ pipelineConfig: { stages: [] } }).success).toBe(true)
|
|
1405
1431
|
})
|
|
1406
1432
|
|
|
1433
|
+
it('accepts a data-mode-only pipelineConfig patch', () => {
|
|
1434
|
+
const result = UpdateListConfigRequestSchema.safeParse({ pipelineConfig: { dataMode: 'live' } })
|
|
1435
|
+
|
|
1436
|
+
expect(result.success).toBe(true)
|
|
1437
|
+
if (result.success) expect(result.data.pipelineConfig?.dataMode).toBe('live')
|
|
1438
|
+
})
|
|
1439
|
+
|
|
1440
|
+
it('rejects invalid pipelineConfig dataMode values', () => {
|
|
1441
|
+
expect(UpdateListConfigRequestSchema.safeParse({ pipelineConfig: { dataMode: 'demo' } }).success).toBe(false)
|
|
1442
|
+
})
|
|
1443
|
+
|
|
1407
1444
|
it('rejects unknown fields (strict mode)', () => {
|
|
1408
1445
|
expect(UpdateListConfigRequestSchema.safeParse({ scrapingConfig: {}, bogus: true }).success).toBe(false)
|
|
1409
1446
|
})
|
|
1410
1447
|
})
|
|
1411
1448
|
|
|
1449
|
+
// ---------------------------------------------------------------------------
|
|
1450
|
+
// PipelineConfigSchema
|
|
1451
|
+
// ---------------------------------------------------------------------------
|
|
1452
|
+
|
|
1453
|
+
describe('PipelineConfigSchema', () => {
|
|
1454
|
+
it.each(['mock', 'live'])('accepts list-wide dataMode "%s"', (dataMode) => {
|
|
1455
|
+
expect(PipelineConfigSchema.safeParse({ dataMode }).success).toBe(true)
|
|
1456
|
+
})
|
|
1457
|
+
|
|
1458
|
+
it('keeps dataMode optional for legacy stored configs', () => {
|
|
1459
|
+
expect(PipelineConfigSchema.safeParse({ stages: [{ key: 'populated' }] }).success).toBe(true)
|
|
1460
|
+
})
|
|
1461
|
+
})
|
|
1462
|
+
|
|
1412
1463
|
// ---------------------------------------------------------------------------
|
|
1413
1464
|
// AddCompaniesToListRequestSchema / AddContactsToListRequestSchema
|
|
1414
1465
|
// ---------------------------------------------------------------------------
|