@elevasis/core 0.39.0 → 0.41.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/auth/index.d.ts +69 -2
- package/dist/index.d.ts +650 -413
- package/dist/index.js +92 -3
- package/dist/knowledge/index.d.ts +90 -19
- package/dist/knowledge/index.js +10 -1
- package/dist/organization-model/index.d.ts +650 -413
- package/dist/organization-model/index.js +92 -3
- package/dist/test-utils/index.d.ts +104 -37
- package/dist/test-utils/index.js +81 -2
- package/package.json +1 -1
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +54 -0
- package/src/business/acquisition/ontology-validation.ts +31 -9
- package/src/business/clients/api-schemas.test.ts +63 -29
- package/src/business/clients/api-schemas.ts +41 -29
- package/src/knowledge/index.ts +14 -1
- package/src/knowledge/queries.ts +74 -15
- package/src/organization-model/__tests__/clients.test.ts +146 -0
- package/src/organization-model/__tests__/snapshot-hash.test.ts +82 -0
- package/src/organization-model/cross-ref.ts +4 -0
- package/src/organization-model/defaults.ts +2 -2
- package/src/organization-model/domains/knowledge.ts +1 -0
- package/src/organization-model/graph/build.ts +23 -6
- package/src/organization-model/graph/schema.ts +4 -3
- package/src/organization-model/graph/types.ts +4 -3
- package/src/organization-model/helpers.ts +15 -0
- package/src/organization-model/index.ts +1 -0
- package/src/organization-model/published.ts +19 -1
- package/src/organization-model/schema-refinements.ts +2 -2
- package/src/organization-model/schema.ts +109 -0
- package/src/organization-model/server/snapshot-hash-server.ts +23 -0
- package/src/organization-model/snapshot-hash.ts +62 -0
- package/src/organization-model/types.ts +19 -1
- package/src/platform/constants/versions.ts +1 -1
- package/src/reference/_generated/contracts.md +54 -0
- package/src/server.ts +292 -289
- package/src/supabase/database.types.ts +3 -0
|
@@ -740,6 +740,15 @@ function defineDomainRecord(schema, entries) {
|
|
|
740
740
|
function childSystemsOf2(system) {
|
|
741
741
|
return system.systems ?? system.subsystems ?? {};
|
|
742
742
|
}
|
|
743
|
+
function listClientProfiles(model) {
|
|
744
|
+
return Object.values(model.clients ?? {}).sort((a, b) => a.slug.localeCompare(b.slug));
|
|
745
|
+
}
|
|
746
|
+
function getClientProfile(model, id) {
|
|
747
|
+
return model.clients?.[id];
|
|
748
|
+
}
|
|
749
|
+
function getClientProfileBySlug(model, slug) {
|
|
750
|
+
return Object.values(model.clients ?? {}).find((client) => client.slug === slug);
|
|
751
|
+
}
|
|
743
752
|
function getSystem(model, path) {
|
|
744
753
|
const flatMatch = model.systems[path];
|
|
745
754
|
if (flatMatch !== void 0) return flatMatch;
|
|
@@ -1425,6 +1434,7 @@ function defineGoals(entries) {
|
|
|
1425
1434
|
}
|
|
1426
1435
|
var KnowledgeTargetKindSchema = z.enum([
|
|
1427
1436
|
"system",
|
|
1437
|
+
"client",
|
|
1428
1438
|
"resource",
|
|
1429
1439
|
"knowledge",
|
|
1430
1440
|
"stage",
|
|
@@ -1800,6 +1810,7 @@ function buildOmCrossRefIndex(model) {
|
|
|
1800
1810
|
systemsById.set(system.id, system);
|
|
1801
1811
|
}
|
|
1802
1812
|
const resourceIds = new Set(Object.keys(model.resources ?? {}));
|
|
1813
|
+
const clientIds = new Set(Object.keys(model.clients ?? {}));
|
|
1803
1814
|
const knowledgeIds = new Set(Object.keys(model.knowledge ?? {}));
|
|
1804
1815
|
const roleIds = new Set(Object.keys(model.roles ?? {}));
|
|
1805
1816
|
const goalIds = new Set(Object.keys(model.goals ?? {}));
|
|
@@ -1833,6 +1844,7 @@ function buildOmCrossRefIndex(model) {
|
|
|
1833
1844
|
return {
|
|
1834
1845
|
systemsById,
|
|
1835
1846
|
resourceIds,
|
|
1847
|
+
clientIds,
|
|
1836
1848
|
knowledgeIds,
|
|
1837
1849
|
roleIds,
|
|
1838
1850
|
goalIds,
|
|
@@ -1846,6 +1858,7 @@ function buildOmCrossRefIndex(model) {
|
|
|
1846
1858
|
}
|
|
1847
1859
|
function knowledgeTargetExists(index, kind, id) {
|
|
1848
1860
|
if (kind === "system") return index.systemsById.has(id);
|
|
1861
|
+
if (kind === "client") return index.clientIds.has(id);
|
|
1849
1862
|
if (kind === "resource") return index.resourceIds.has(id);
|
|
1850
1863
|
if (kind === "knowledge") return index.knowledgeIds.has(id);
|
|
1851
1864
|
if (kind === "stage") return index.stageIds.has(id);
|
|
@@ -1879,10 +1892,10 @@ function asRoleHolderArray(heldBy) {
|
|
|
1879
1892
|
function isKnowledgeKindCompatibleWithTarget(knowledgeKind, targetKind) {
|
|
1880
1893
|
if (knowledgeKind === "reference") return true;
|
|
1881
1894
|
if (knowledgeKind === "playbook") {
|
|
1882
|
-
return ["system", "resource", "stage", "action", "ontology"].includes(targetKind);
|
|
1895
|
+
return ["system", "client", "resource", "stage", "action", "ontology"].includes(targetKind);
|
|
1883
1896
|
}
|
|
1884
1897
|
if (knowledgeKind === "strategy") {
|
|
1885
|
-
return ["system", "goal", "offering", "customer-segment", "ontology"].includes(targetKind);
|
|
1898
|
+
return ["system", "client", "goal", "offering", "customer-segment", "ontology"].includes(targetKind);
|
|
1886
1899
|
}
|
|
1887
1900
|
return false;
|
|
1888
1901
|
}
|
|
@@ -2410,9 +2423,68 @@ function refineOrganizationModel(model, ctx) {
|
|
|
2410
2423
|
}
|
|
2411
2424
|
|
|
2412
2425
|
// src/organization-model/schema.ts
|
|
2426
|
+
var ClientProfileIdSchema = z.string().uuid();
|
|
2427
|
+
var ClientProfileStatusSchema = z.enum(["active", "onboarding", "paused", "completed", "churned"]);
|
|
2428
|
+
var ClientProfileSourceSchema = z.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/, "Source must use lowercase letters, numbers, and underscores");
|
|
2429
|
+
var ClientProfileIdentitySchema = z.object({
|
|
2430
|
+
organizationName: LabelSchema.optional(),
|
|
2431
|
+
shortName: z.string().trim().min(1).max(40).optional(),
|
|
2432
|
+
clientBrief: z.string().trim().max(4e3).default(""),
|
|
2433
|
+
geographicFocus: z.array(z.string().trim().min(1).max(200)).default([]),
|
|
2434
|
+
timeZone: z.string().trim().min(1).max(100).default("UTC")
|
|
2435
|
+
}).passthrough().default({
|
|
2436
|
+
clientBrief: "",
|
|
2437
|
+
geographicFocus: [],
|
|
2438
|
+
timeZone: "UTC"
|
|
2439
|
+
});
|
|
2440
|
+
var ClientProfileBrandingSchema = z.object({
|
|
2441
|
+
voice: z.string().trim().max(280).optional(),
|
|
2442
|
+
tagline: z.string().trim().max(200).optional(),
|
|
2443
|
+
values: z.array(z.string().trim().min(1).max(100)).default([])
|
|
2444
|
+
}).passthrough().default({
|
|
2445
|
+
values: []
|
|
2446
|
+
});
|
|
2447
|
+
var ClientProfileWorkspaceSchema = z.object({
|
|
2448
|
+
kind: z.enum(["external-project", "internal-project", "none"]).optional(),
|
|
2449
|
+
owner: z.enum(["developer", "client", "platform"]).optional(),
|
|
2450
|
+
projectId: z.string().trim().min(1).max(200).optional(),
|
|
2451
|
+
workspacePath: z.string().trim().min(1).max(500).optional()
|
|
2452
|
+
}).passthrough().default({});
|
|
2453
|
+
var ClientProfileLinksSchema = z.object({
|
|
2454
|
+
projectIds: z.array(z.string().uuid()).default([]),
|
|
2455
|
+
primaryCompanyId: z.string().uuid().optional(),
|
|
2456
|
+
primaryContactId: z.string().uuid().optional(),
|
|
2457
|
+
sourceDealId: z.string().uuid().optional()
|
|
2458
|
+
}).default({
|
|
2459
|
+
projectIds: []
|
|
2460
|
+
});
|
|
2461
|
+
var ClientProfilePromptsSchema = z.object({
|
|
2462
|
+
defaultContext: z.string().trim().max(8e3).default("")
|
|
2463
|
+
}).passthrough().default({
|
|
2464
|
+
defaultContext: ""
|
|
2465
|
+
});
|
|
2466
|
+
var ClientProfileSchema = z.object({
|
|
2467
|
+
id: ClientProfileIdSchema,
|
|
2468
|
+
slug: ModelIdSchema,
|
|
2469
|
+
name: LabelSchema,
|
|
2470
|
+
status: ClientProfileStatusSchema.default("onboarding"),
|
|
2471
|
+
source: ClientProfileSourceSchema.optional(),
|
|
2472
|
+
identity: ClientProfileIdentitySchema,
|
|
2473
|
+
branding: ClientProfileBrandingSchema,
|
|
2474
|
+
workspace: ClientProfileWorkspaceSchema,
|
|
2475
|
+
links: ClientProfileLinksSchema,
|
|
2476
|
+
prompts: ClientProfilePromptsSchema,
|
|
2477
|
+
config: z.record(z.string().trim().min(1).max(200), JsonValueSchema).default({}),
|
|
2478
|
+
customValues: z.record(z.string().trim().min(1).max(200), JsonValueSchema).default({})
|
|
2479
|
+
}).strict();
|
|
2480
|
+
var ClientProfilesDomainSchema = z.record(ClientProfileIdSchema, ClientProfileSchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
2481
|
+
message: "Each client profile id must match its map key"
|
|
2482
|
+
}).default({});
|
|
2483
|
+
var DEFAULT_ORGANIZATION_MODEL_CLIENTS = {};
|
|
2413
2484
|
var OrganizationModelDomainKeySchema = z.enum([
|
|
2414
2485
|
"branding",
|
|
2415
2486
|
"identity",
|
|
2487
|
+
"clients",
|
|
2416
2488
|
"customers",
|
|
2417
2489
|
"offerings",
|
|
2418
2490
|
"roles",
|
|
@@ -2433,6 +2505,7 @@ var OrganizationModelDomainMetadataSchema = z.object({
|
|
|
2433
2505
|
var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
2434
2506
|
branding: { version: 1, lastModified: "2026-05-10" },
|
|
2435
2507
|
identity: { version: 1, lastModified: "2026-05-10" },
|
|
2508
|
+
clients: { version: 1, lastModified: "2026-05-30" },
|
|
2436
2509
|
customers: { version: 1, lastModified: "2026-05-10" },
|
|
2437
2510
|
offerings: { version: 1, lastModified: "2026-05-10" },
|
|
2438
2511
|
roles: { version: 1, lastModified: "2026-05-10" },
|
|
@@ -2449,6 +2522,7 @@ var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
|
2449
2522
|
var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
2450
2523
|
branding: OrganizationModelDomainMetadataSchema,
|
|
2451
2524
|
identity: OrganizationModelDomainMetadataSchema,
|
|
2525
|
+
clients: OrganizationModelDomainMetadataSchema,
|
|
2452
2526
|
customers: OrganizationModelDomainMetadataSchema,
|
|
2453
2527
|
offerings: OrganizationModelDomainMetadataSchema,
|
|
2454
2528
|
roles: OrganizationModelDomainMetadataSchema,
|
|
@@ -2464,10 +2538,23 @@ var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
|
2464
2538
|
}).partial().default(DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA).transform((metadata) => ({ ...DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, ...metadata }));
|
|
2465
2539
|
var OrganizationModelSchemaBase = z.object({
|
|
2466
2540
|
version: z.literal(1).default(1),
|
|
2541
|
+
/**
|
|
2542
|
+
* Deterministic SHA-256 hex hash of the full resolved model, excluding this
|
|
2543
|
+
* field itself and volatile domainMetadata.lastModified values.
|
|
2544
|
+
*
|
|
2545
|
+
* Stamped at deploy time by the platform OM assembly and persisted alongside
|
|
2546
|
+
* the snapshot in the DB. Compared at API boot to detect stale deployed
|
|
2547
|
+
* snapshots (primary gate: deploy; secondary backstop: boot).
|
|
2548
|
+
*
|
|
2549
|
+
* Optional — absent on models that predate Step 2 versioning or that have
|
|
2550
|
+
* not been stamped (e.g. tenant partial overrides before re-deploy).
|
|
2551
|
+
*/
|
|
2552
|
+
snapshotHash: z.string().optional(),
|
|
2467
2553
|
domainMetadata: OrganizationModelDomainMetadataByDomainSchema,
|
|
2468
2554
|
branding: OrganizationModelBrandingSchema.default(DEFAULT_ORGANIZATION_MODEL_BRANDING),
|
|
2469
2555
|
navigation: OrganizationModelNavigationSchema,
|
|
2470
2556
|
identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
|
|
2557
|
+
clients: ClientProfilesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CLIENTS),
|
|
2471
2558
|
customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
|
|
2472
2559
|
offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
|
|
2473
2560
|
roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
|
|
@@ -2486,6 +2573,7 @@ var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine(refineOrga
|
|
|
2486
2573
|
var OrganizationGraphNodeKindSchema = z.enum([
|
|
2487
2574
|
"organization",
|
|
2488
2575
|
"system",
|
|
2576
|
+
"client",
|
|
2489
2577
|
"role",
|
|
2490
2578
|
"action",
|
|
2491
2579
|
"entity",
|
|
@@ -2597,6 +2685,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
2597
2685
|
branding: DEFAULT_ORGANIZATION_MODEL_BRANDING,
|
|
2598
2686
|
navigation: DEFAULT_ORGANIZATION_MODEL_NAVIGATION2,
|
|
2599
2687
|
identity: DEFAULT_ORGANIZATION_MODEL_IDENTITY,
|
|
2688
|
+
clients: DEFAULT_ORGANIZATION_MODEL_CLIENTS,
|
|
2600
2689
|
customers: DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
|
|
2601
2690
|
offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
|
|
2602
2691
|
roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
|
|
@@ -3492,4 +3581,4 @@ function scaffoldOrganizationModel(model, spec) {
|
|
|
3492
3581
|
return scaffoldKnowledgeNode(model, spec);
|
|
3493
3582
|
}
|
|
3494
3583
|
|
|
3495
|
-
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_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, OmTopologySystemInterfaceGrantMetadataSchema, OmTopologySystemInterfaceGrantSchema, 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, SYSTEM_INTERFACE_PROFILES, SYSTEM_INTERFACE_READINESS_PROFILES, ScriptExecutionInvocationSchema, ScriptResourceEntrySchema, ScriptResourceLanguageSchema, ScriptResourceSourceSchema, SidebarNavigationSchema, SidebarNodeSchema, SidebarSectionSchema, SidebarSurfaceTargetsSchema, SlashCommandInvocationSchema, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, SurfaceDefinitionSchema, SurfaceTypeSchema, SystemApiInterfaceSchema, SystemEntrySchema, SystemIdSchema, SystemInterfaceKeySchema, SystemInterfaceLifecycleSchema, SystemInterfaceReadinessProfileSchema, SystemInterfaceRefSchema, SystemKindSchema, SystemLifecycleSchema, SystemPathSchema, SystemStatusSchema, SystemUiSchema, SystemsDomainSchema, TeamRoleHolderSchema, TechStackEntrySchema, TopbarActionNodeSchema, TopbarSectionSchema, 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 };
|
|
3584
|
+
export { ActionIdSchema, ActionInvocationKindSchema, ActionInvocationSchema, ActionRefSchema, ActionSchema, ActionScopeSchema, ActionsDomainSchema, AgentKindSchema, AgentResourceEntrySchema, AgentRoleHolderSchema, ApiEndpointInvocationSchema, ClientProfileBrandingSchema, ClientProfileIdentitySchema, ClientProfileLinksSchema, ClientProfilePromptsSchema, ClientProfileSchema, ClientProfileSourceSchema, ClientProfileStatusSchema, ClientProfileWorkspaceSchema, ClientProfilesDomainSchema, 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_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, OmTopologySystemInterfaceGrantMetadataSchema, OmTopologySystemInterfaceGrantSchema, 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, SYSTEM_INTERFACE_PROFILES, SYSTEM_INTERFACE_READINESS_PROFILES, ScriptExecutionInvocationSchema, ScriptResourceEntrySchema, ScriptResourceLanguageSchema, ScriptResourceSourceSchema, SidebarNavigationSchema, SidebarNodeSchema, SidebarSectionSchema, SidebarSurfaceTargetsSchema, SlashCommandInvocationSchema, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, SurfaceDefinitionSchema, SurfaceTypeSchema, SystemApiInterfaceSchema, SystemEntrySchema, SystemIdSchema, SystemInterfaceKeySchema, SystemInterfaceLifecycleSchema, SystemInterfaceReadinessProfileSchema, SystemInterfaceRefSchema, SystemKindSchema, SystemLifecycleSchema, SystemPathSchema, SystemStatusSchema, SystemUiSchema, SystemsDomainSchema, TeamRoleHolderSchema, TechStackEntrySchema, TopbarActionNodeSchema, TopbarSectionSchema, 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, getClientProfile, getClientProfileBySlug, getOntologyDiagnostics, getSortedSidebarEntries, isOntologyGraphNodeId, isOntologyTopologyRef, listAllSystems, listClientProfiles, listResolvedOntologyRecords, ontologyGraphNodeId, ontologyIdFromGraphNodeId, parseContractRef, parseOntologyId, parseTopologyNodeRef, projectOrganizationSurfaces, resolveOrganizationModel, resolveOrganizationModelWithResources, scaffoldOrganizationModel, topologyRef, topologyRelationship, validateOrganizationSurfaceProjection };
|
|
@@ -1255,6 +1255,7 @@ type Database = {
|
|
|
1255
1255
|
organization_id: string;
|
|
1256
1256
|
primary_company_id: string | null;
|
|
1257
1257
|
primary_contact_id: string | null;
|
|
1258
|
+
source: string;
|
|
1258
1259
|
source_deal_id: string | null;
|
|
1259
1260
|
status: string;
|
|
1260
1261
|
updated_at: string;
|
|
@@ -1268,6 +1269,7 @@ type Database = {
|
|
|
1268
1269
|
organization_id: string;
|
|
1269
1270
|
primary_company_id?: string | null;
|
|
1270
1271
|
primary_contact_id?: string | null;
|
|
1272
|
+
source?: string;
|
|
1271
1273
|
source_deal_id?: string | null;
|
|
1272
1274
|
status?: string;
|
|
1273
1275
|
updated_at?: string;
|
|
@@ -1281,6 +1283,7 @@ type Database = {
|
|
|
1281
1283
|
organization_id?: string;
|
|
1282
1284
|
primary_company_id?: string | null;
|
|
1283
1285
|
primary_contact_id?: string | null;
|
|
1286
|
+
source?: string;
|
|
1284
1287
|
source_deal_id?: string | null;
|
|
1285
1288
|
status?: string;
|
|
1286
1289
|
updated_at?: string;
|
|
@@ -3757,6 +3760,41 @@ declare const OntologyScopeSchema: z.ZodDefault<z.ZodObject<{
|
|
|
3757
3760
|
}, z.core.$strip>>;
|
|
3758
3761
|
type OntologyScope = z.infer<typeof OntologyScopeSchema>;
|
|
3759
3762
|
|
|
3763
|
+
declare const SurfaceTypeSchema: z.ZodEnum<{
|
|
3764
|
+
dashboard: "dashboard";
|
|
3765
|
+
settings: "settings";
|
|
3766
|
+
graph: "graph";
|
|
3767
|
+
page: "page";
|
|
3768
|
+
detail: "detail";
|
|
3769
|
+
list: "list";
|
|
3770
|
+
}>;
|
|
3771
|
+
interface SidebarSurfaceNode {
|
|
3772
|
+
type: 'surface';
|
|
3773
|
+
label: string;
|
|
3774
|
+
path: string;
|
|
3775
|
+
surfaceType: z.infer<typeof SurfaceTypeSchema>;
|
|
3776
|
+
description?: string;
|
|
3777
|
+
icon?: string;
|
|
3778
|
+
order?: number;
|
|
3779
|
+
targets?: {
|
|
3780
|
+
systems?: string[];
|
|
3781
|
+
entities?: string[];
|
|
3782
|
+
resources?: string[];
|
|
3783
|
+
actions?: string[];
|
|
3784
|
+
};
|
|
3785
|
+
devOnly?: boolean;
|
|
3786
|
+
requiresAdmin?: boolean;
|
|
3787
|
+
}
|
|
3788
|
+
interface SidebarGroupNode {
|
|
3789
|
+
type: 'group';
|
|
3790
|
+
label: string;
|
|
3791
|
+
description?: string;
|
|
3792
|
+
icon?: string;
|
|
3793
|
+
order?: number;
|
|
3794
|
+
children: Record<string, SidebarNode>;
|
|
3795
|
+
}
|
|
3796
|
+
type SidebarNode = SidebarSurfaceNode | SidebarGroupNode;
|
|
3797
|
+
|
|
3760
3798
|
declare const SystemApiInterfaceSchema: z.ZodObject<{
|
|
3761
3799
|
lifecycle: z.ZodDefault<z.ZodEnum<{
|
|
3762
3800
|
active: "active";
|
|
@@ -3817,41 +3855,6 @@ interface SystemEntry {
|
|
|
3817
3855
|
subsystems?: Record<string, SystemEntry>;
|
|
3818
3856
|
}
|
|
3819
3857
|
|
|
3820
|
-
declare const SurfaceTypeSchema: z.ZodEnum<{
|
|
3821
|
-
dashboard: "dashboard";
|
|
3822
|
-
settings: "settings";
|
|
3823
|
-
graph: "graph";
|
|
3824
|
-
page: "page";
|
|
3825
|
-
detail: "detail";
|
|
3826
|
-
list: "list";
|
|
3827
|
-
}>;
|
|
3828
|
-
interface SidebarSurfaceNode {
|
|
3829
|
-
type: 'surface';
|
|
3830
|
-
label: string;
|
|
3831
|
-
path: string;
|
|
3832
|
-
surfaceType: z.infer<typeof SurfaceTypeSchema>;
|
|
3833
|
-
description?: string;
|
|
3834
|
-
icon?: string;
|
|
3835
|
-
order?: number;
|
|
3836
|
-
targets?: {
|
|
3837
|
-
systems?: string[];
|
|
3838
|
-
entities?: string[];
|
|
3839
|
-
resources?: string[];
|
|
3840
|
-
actions?: string[];
|
|
3841
|
-
};
|
|
3842
|
-
devOnly?: boolean;
|
|
3843
|
-
requiresAdmin?: boolean;
|
|
3844
|
-
}
|
|
3845
|
-
interface SidebarGroupNode {
|
|
3846
|
-
type: 'group';
|
|
3847
|
-
label: string;
|
|
3848
|
-
description?: string;
|
|
3849
|
-
icon?: string;
|
|
3850
|
-
order?: number;
|
|
3851
|
-
children: Record<string, SidebarNode>;
|
|
3852
|
-
}
|
|
3853
|
-
type SidebarNode = SidebarSurfaceNode | SidebarGroupNode;
|
|
3854
|
-
|
|
3855
3858
|
type OrganizationModel = z.infer<typeof OrganizationModelSchema>;
|
|
3856
3859
|
type DeepPartial<T> = T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? {
|
|
3857
3860
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
@@ -3859,6 +3862,7 @@ type DeepPartial<T> = T extends Array<infer U> ? Array<DeepPartial<U>> : T exten
|
|
|
3859
3862
|
|
|
3860
3863
|
declare const OrganizationModelSchema: z.ZodObject<{
|
|
3861
3864
|
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
3865
|
+
snapshotHash: z.ZodOptional<z.ZodString>;
|
|
3862
3866
|
domainMetadata: z.ZodPipe<z.ZodDefault<z.ZodObject<{
|
|
3863
3867
|
branding: z.ZodOptional<z.ZodObject<{
|
|
3864
3868
|
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
@@ -3868,6 +3872,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
3868
3872
|
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
3869
3873
|
lastModified: z.ZodString;
|
|
3870
3874
|
}, z.core.$strip>>;
|
|
3875
|
+
clients: z.ZodOptional<z.ZodObject<{
|
|
3876
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
3877
|
+
lastModified: z.ZodString;
|
|
3878
|
+
}, z.core.$strip>>;
|
|
3871
3879
|
customers: z.ZodOptional<z.ZodObject<{
|
|
3872
3880
|
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
3873
3881
|
lastModified: z.ZodString;
|
|
@@ -3925,6 +3933,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
3925
3933
|
version: 1;
|
|
3926
3934
|
lastModified: string;
|
|
3927
3935
|
};
|
|
3936
|
+
clients: {
|
|
3937
|
+
version: 1;
|
|
3938
|
+
lastModified: string;
|
|
3939
|
+
};
|
|
3928
3940
|
customers: {
|
|
3929
3941
|
version: 1;
|
|
3930
3942
|
lastModified: string;
|
|
@@ -3982,6 +3994,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
3982
3994
|
version: 1;
|
|
3983
3995
|
lastModified: string;
|
|
3984
3996
|
} | undefined;
|
|
3997
|
+
clients?: {
|
|
3998
|
+
version: 1;
|
|
3999
|
+
lastModified: string;
|
|
4000
|
+
} | undefined;
|
|
3985
4001
|
customers?: {
|
|
3986
4002
|
version: 1;
|
|
3987
4003
|
lastModified: string;
|
|
@@ -4174,6 +4190,56 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4174
4190
|
shortName: z.ZodOptional<z.ZodString>;
|
|
4175
4191
|
description: z.ZodOptional<z.ZodString>;
|
|
4176
4192
|
}, z.core.$loose>>;
|
|
4193
|
+
clients: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
4194
|
+
id: z.ZodString;
|
|
4195
|
+
slug: z.ZodString;
|
|
4196
|
+
name: z.ZodString;
|
|
4197
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
4198
|
+
active: "active";
|
|
4199
|
+
onboarding: "onboarding";
|
|
4200
|
+
paused: "paused";
|
|
4201
|
+
completed: "completed";
|
|
4202
|
+
churned: "churned";
|
|
4203
|
+
}>>;
|
|
4204
|
+
source: z.ZodOptional<z.ZodString>;
|
|
4205
|
+
identity: z.ZodDefault<z.ZodObject<{
|
|
4206
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
4207
|
+
shortName: z.ZodOptional<z.ZodString>;
|
|
4208
|
+
clientBrief: z.ZodDefault<z.ZodString>;
|
|
4209
|
+
geographicFocus: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
4210
|
+
timeZone: z.ZodDefault<z.ZodString>;
|
|
4211
|
+
}, z.core.$loose>>;
|
|
4212
|
+
branding: z.ZodDefault<z.ZodObject<{
|
|
4213
|
+
voice: z.ZodOptional<z.ZodString>;
|
|
4214
|
+
tagline: z.ZodOptional<z.ZodString>;
|
|
4215
|
+
values: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
4216
|
+
}, z.core.$loose>>;
|
|
4217
|
+
workspace: z.ZodDefault<z.ZodObject<{
|
|
4218
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
4219
|
+
"external-project": "external-project";
|
|
4220
|
+
"internal-project": "internal-project";
|
|
4221
|
+
none: "none";
|
|
4222
|
+
}>>;
|
|
4223
|
+
owner: z.ZodOptional<z.ZodEnum<{
|
|
4224
|
+
platform: "platform";
|
|
4225
|
+
client: "client";
|
|
4226
|
+
developer: "developer";
|
|
4227
|
+
}>>;
|
|
4228
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
4229
|
+
workspacePath: z.ZodOptional<z.ZodString>;
|
|
4230
|
+
}, z.core.$loose>>;
|
|
4231
|
+
links: z.ZodDefault<z.ZodObject<{
|
|
4232
|
+
projectIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
4233
|
+
primaryCompanyId: z.ZodOptional<z.ZodString>;
|
|
4234
|
+
primaryContactId: z.ZodOptional<z.ZodString>;
|
|
4235
|
+
sourceDealId: z.ZodOptional<z.ZodString>;
|
|
4236
|
+
}, z.core.$strip>>;
|
|
4237
|
+
prompts: z.ZodDefault<z.ZodObject<{
|
|
4238
|
+
defaultContext: z.ZodDefault<z.ZodString>;
|
|
4239
|
+
}, z.core.$loose>>;
|
|
4240
|
+
config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
4241
|
+
customValues: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
4242
|
+
}, z.core.$strict>>>>;
|
|
4177
4243
|
customers: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
4178
4244
|
id: z.ZodString;
|
|
4179
4245
|
order: z.ZodNumber;
|
|
@@ -4827,6 +4893,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4827
4893
|
action: "action";
|
|
4828
4894
|
ontology: "ontology";
|
|
4829
4895
|
role: "role";
|
|
4896
|
+
client: "client";
|
|
4830
4897
|
stage: "stage";
|
|
4831
4898
|
goal: "goal";
|
|
4832
4899
|
"customer-segment": "customer-segment";
|
|
@@ -4838,7 +4905,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4838
4905
|
nodeId: z.ZodUnion<readonly [z.ZodString, z.ZodTemplateLiteral<`ontology:${string}`>]>;
|
|
4839
4906
|
}, z.core.$strip>]>, z.ZodTransform<{
|
|
4840
4907
|
target: {
|
|
4841
|
-
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "stage" | "goal" | "customer-segment" | "offering";
|
|
4908
|
+
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "client" | "stage" | "goal" | "customer-segment" | "offering";
|
|
4842
4909
|
id: string;
|
|
4843
4910
|
};
|
|
4844
4911
|
nodeId: string;
|
|
@@ -4846,7 +4913,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
4846
4913
|
nodeId: string;
|
|
4847
4914
|
} | {
|
|
4848
4915
|
target: {
|
|
4849
|
-
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "stage" | "goal" | "customer-segment" | "offering";
|
|
4916
|
+
kind: "knowledge" | "system" | "resource" | "action" | "ontology" | "role" | "client" | "stage" | "goal" | "customer-segment" | "offering";
|
|
4850
4917
|
id: string;
|
|
4851
4918
|
};
|
|
4852
4919
|
}>>>>;
|
package/dist/test-utils/index.js
CHANGED
|
@@ -20691,6 +20691,7 @@ var GoalsDomainSchema = z.record(z.string(), ObjectiveSchema).refine((record) =>
|
|
|
20691
20691
|
var DEFAULT_ORGANIZATION_MODEL_GOALS = {};
|
|
20692
20692
|
var KnowledgeTargetKindSchema = z.enum([
|
|
20693
20693
|
"system",
|
|
20694
|
+
"client",
|
|
20694
20695
|
"resource",
|
|
20695
20696
|
"knowledge",
|
|
20696
20697
|
"stage",
|
|
@@ -20948,6 +20949,7 @@ function buildOmCrossRefIndex(model) {
|
|
|
20948
20949
|
systemsById.set(system.id, system);
|
|
20949
20950
|
}
|
|
20950
20951
|
const resourceIds = new Set(Object.keys(model.resources ?? {}));
|
|
20952
|
+
const clientIds = new Set(Object.keys(model.clients ?? {}));
|
|
20951
20953
|
const knowledgeIds = new Set(Object.keys(model.knowledge ?? {}));
|
|
20952
20954
|
const roleIds = new Set(Object.keys(model.roles ?? {}));
|
|
20953
20955
|
const goalIds = new Set(Object.keys(model.goals ?? {}));
|
|
@@ -20981,6 +20983,7 @@ function buildOmCrossRefIndex(model) {
|
|
|
20981
20983
|
return {
|
|
20982
20984
|
systemsById,
|
|
20983
20985
|
resourceIds,
|
|
20986
|
+
clientIds,
|
|
20984
20987
|
knowledgeIds,
|
|
20985
20988
|
roleIds,
|
|
20986
20989
|
goalIds,
|
|
@@ -20994,6 +20997,7 @@ function buildOmCrossRefIndex(model) {
|
|
|
20994
20997
|
}
|
|
20995
20998
|
function knowledgeTargetExists(index2, kind, id) {
|
|
20996
20999
|
if (kind === "system") return index2.systemsById.has(id);
|
|
21000
|
+
if (kind === "client") return index2.clientIds.has(id);
|
|
20997
21001
|
if (kind === "resource") return index2.resourceIds.has(id);
|
|
20998
21002
|
if (kind === "knowledge") return index2.knowledgeIds.has(id);
|
|
20999
21003
|
if (kind === "stage") return index2.stageIds.has(id);
|
|
@@ -21027,10 +21031,10 @@ function asRoleHolderArray(heldBy) {
|
|
|
21027
21031
|
function isKnowledgeKindCompatibleWithTarget(knowledgeKind, targetKind) {
|
|
21028
21032
|
if (knowledgeKind === "reference") return true;
|
|
21029
21033
|
if (knowledgeKind === "playbook") {
|
|
21030
|
-
return ["system", "resource", "stage", "action", "ontology"].includes(targetKind);
|
|
21034
|
+
return ["system", "client", "resource", "stage", "action", "ontology"].includes(targetKind);
|
|
21031
21035
|
}
|
|
21032
21036
|
if (knowledgeKind === "strategy") {
|
|
21033
|
-
return ["system", "goal", "offering", "customer-segment", "ontology"].includes(targetKind);
|
|
21037
|
+
return ["system", "client", "goal", "offering", "customer-segment", "ontology"].includes(targetKind);
|
|
21034
21038
|
}
|
|
21035
21039
|
return false;
|
|
21036
21040
|
}
|
|
@@ -21558,9 +21562,68 @@ function refineOrganizationModel(model, ctx) {
|
|
|
21558
21562
|
}
|
|
21559
21563
|
|
|
21560
21564
|
// src/organization-model/schema.ts
|
|
21565
|
+
var ClientProfileIdSchema = z.string().uuid();
|
|
21566
|
+
var ClientProfileStatusSchema = z.enum(["active", "onboarding", "paused", "completed", "churned"]);
|
|
21567
|
+
var ClientProfileSourceSchema = z.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/, "Source must use lowercase letters, numbers, and underscores");
|
|
21568
|
+
var ClientProfileIdentitySchema = z.object({
|
|
21569
|
+
organizationName: LabelSchema.optional(),
|
|
21570
|
+
shortName: z.string().trim().min(1).max(40).optional(),
|
|
21571
|
+
clientBrief: z.string().trim().max(4e3).default(""),
|
|
21572
|
+
geographicFocus: z.array(z.string().trim().min(1).max(200)).default([]),
|
|
21573
|
+
timeZone: z.string().trim().min(1).max(100).default("UTC")
|
|
21574
|
+
}).passthrough().default({
|
|
21575
|
+
clientBrief: "",
|
|
21576
|
+
geographicFocus: [],
|
|
21577
|
+
timeZone: "UTC"
|
|
21578
|
+
});
|
|
21579
|
+
var ClientProfileBrandingSchema = z.object({
|
|
21580
|
+
voice: z.string().trim().max(280).optional(),
|
|
21581
|
+
tagline: z.string().trim().max(200).optional(),
|
|
21582
|
+
values: z.array(z.string().trim().min(1).max(100)).default([])
|
|
21583
|
+
}).passthrough().default({
|
|
21584
|
+
values: []
|
|
21585
|
+
});
|
|
21586
|
+
var ClientProfileWorkspaceSchema = z.object({
|
|
21587
|
+
kind: z.enum(["external-project", "internal-project", "none"]).optional(),
|
|
21588
|
+
owner: z.enum(["developer", "client", "platform"]).optional(),
|
|
21589
|
+
projectId: z.string().trim().min(1).max(200).optional(),
|
|
21590
|
+
workspacePath: z.string().trim().min(1).max(500).optional()
|
|
21591
|
+
}).passthrough().default({});
|
|
21592
|
+
var ClientProfileLinksSchema = z.object({
|
|
21593
|
+
projectIds: z.array(z.string().uuid()).default([]),
|
|
21594
|
+
primaryCompanyId: z.string().uuid().optional(),
|
|
21595
|
+
primaryContactId: z.string().uuid().optional(),
|
|
21596
|
+
sourceDealId: z.string().uuid().optional()
|
|
21597
|
+
}).default({
|
|
21598
|
+
projectIds: []
|
|
21599
|
+
});
|
|
21600
|
+
var ClientProfilePromptsSchema = z.object({
|
|
21601
|
+
defaultContext: z.string().trim().max(8e3).default("")
|
|
21602
|
+
}).passthrough().default({
|
|
21603
|
+
defaultContext: ""
|
|
21604
|
+
});
|
|
21605
|
+
var ClientProfileSchema = z.object({
|
|
21606
|
+
id: ClientProfileIdSchema,
|
|
21607
|
+
slug: ModelIdSchema,
|
|
21608
|
+
name: LabelSchema,
|
|
21609
|
+
status: ClientProfileStatusSchema.default("onboarding"),
|
|
21610
|
+
source: ClientProfileSourceSchema.optional(),
|
|
21611
|
+
identity: ClientProfileIdentitySchema,
|
|
21612
|
+
branding: ClientProfileBrandingSchema,
|
|
21613
|
+
workspace: ClientProfileWorkspaceSchema,
|
|
21614
|
+
links: ClientProfileLinksSchema,
|
|
21615
|
+
prompts: ClientProfilePromptsSchema,
|
|
21616
|
+
config: z.record(z.string().trim().min(1).max(200), JsonValueSchema).default({}),
|
|
21617
|
+
customValues: z.record(z.string().trim().min(1).max(200), JsonValueSchema).default({})
|
|
21618
|
+
}).strict();
|
|
21619
|
+
var ClientProfilesDomainSchema = z.record(ClientProfileIdSchema, ClientProfileSchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
21620
|
+
message: "Each client profile id must match its map key"
|
|
21621
|
+
}).default({});
|
|
21622
|
+
var DEFAULT_ORGANIZATION_MODEL_CLIENTS = {};
|
|
21561
21623
|
z.enum([
|
|
21562
21624
|
"branding",
|
|
21563
21625
|
"identity",
|
|
21626
|
+
"clients",
|
|
21564
21627
|
"customers",
|
|
21565
21628
|
"offerings",
|
|
21566
21629
|
"roles",
|
|
@@ -21581,6 +21644,7 @@ var OrganizationModelDomainMetadataSchema = z.object({
|
|
|
21581
21644
|
var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
21582
21645
|
branding: { version: 1, lastModified: "2026-05-10" },
|
|
21583
21646
|
identity: { version: 1, lastModified: "2026-05-10" },
|
|
21647
|
+
clients: { version: 1, lastModified: "2026-05-30" },
|
|
21584
21648
|
customers: { version: 1, lastModified: "2026-05-10" },
|
|
21585
21649
|
offerings: { version: 1, lastModified: "2026-05-10" },
|
|
21586
21650
|
roles: { version: 1, lastModified: "2026-05-10" },
|
|
@@ -21597,6 +21661,7 @@ var DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA = {
|
|
|
21597
21661
|
var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
21598
21662
|
branding: OrganizationModelDomainMetadataSchema,
|
|
21599
21663
|
identity: OrganizationModelDomainMetadataSchema,
|
|
21664
|
+
clients: OrganizationModelDomainMetadataSchema,
|
|
21600
21665
|
customers: OrganizationModelDomainMetadataSchema,
|
|
21601
21666
|
offerings: OrganizationModelDomainMetadataSchema,
|
|
21602
21667
|
roles: OrganizationModelDomainMetadataSchema,
|
|
@@ -21612,10 +21677,23 @@ var OrganizationModelDomainMetadataByDomainSchema = z.object({
|
|
|
21612
21677
|
}).partial().default(DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA).transform((metadata) => ({ ...DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA, ...metadata }));
|
|
21613
21678
|
var OrganizationModelSchemaBase = z.object({
|
|
21614
21679
|
version: z.literal(1).default(1),
|
|
21680
|
+
/**
|
|
21681
|
+
* Deterministic SHA-256 hex hash of the full resolved model, excluding this
|
|
21682
|
+
* field itself and volatile domainMetadata.lastModified values.
|
|
21683
|
+
*
|
|
21684
|
+
* Stamped at deploy time by the platform OM assembly and persisted alongside
|
|
21685
|
+
* the snapshot in the DB. Compared at API boot to detect stale deployed
|
|
21686
|
+
* snapshots (primary gate: deploy; secondary backstop: boot).
|
|
21687
|
+
*
|
|
21688
|
+
* Optional — absent on models that predate Step 2 versioning or that have
|
|
21689
|
+
* not been stamped (e.g. tenant partial overrides before re-deploy).
|
|
21690
|
+
*/
|
|
21691
|
+
snapshotHash: z.string().optional(),
|
|
21615
21692
|
domainMetadata: OrganizationModelDomainMetadataByDomainSchema,
|
|
21616
21693
|
branding: OrganizationModelBrandingSchema.default(DEFAULT_ORGANIZATION_MODEL_BRANDING),
|
|
21617
21694
|
navigation: OrganizationModelNavigationSchema,
|
|
21618
21695
|
identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
|
|
21696
|
+
clients: ClientProfilesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CLIENTS),
|
|
21619
21697
|
customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
|
|
21620
21698
|
offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
|
|
21621
21699
|
roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
|
|
@@ -21648,6 +21726,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
21648
21726
|
branding: DEFAULT_ORGANIZATION_MODEL_BRANDING,
|
|
21649
21727
|
navigation: DEFAULT_ORGANIZATION_MODEL_NAVIGATION,
|
|
21650
21728
|
identity: DEFAULT_ORGANIZATION_MODEL_IDENTITY,
|
|
21729
|
+
clients: DEFAULT_ORGANIZATION_MODEL_CLIENTS,
|
|
21651
21730
|
customers: DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
|
|
21652
21731
|
offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
|
|
21653
21732
|
roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
|
package/package.json
CHANGED
|
@@ -39,6 +39,60 @@ export type OrganizationModelDomainMetadataByDomain = z.infer<typeof Organizatio
|
|
|
39
39
|
export type OrganizationModelBranding = z.infer<typeof OrganizationModelBrandingSchema>
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
### `ClientProfile`
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
export type ClientProfile = z.infer<typeof ClientProfileSchema>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### `ClientProfileBranding`
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
export type ClientProfileBranding = z.infer<typeof ClientProfileBrandingSchema>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### `ClientProfileIdentity`
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
export type ClientProfileIdentity = z.infer<typeof ClientProfileIdentitySchema>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### `ClientProfileLinks`
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
export type ClientProfileLinks = z.infer<typeof ClientProfileLinksSchema>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### `ClientProfilePrompts`
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
export type ClientProfilePrompts = z.infer<typeof ClientProfilePromptsSchema>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### `ClientProfileSource`
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
export type ClientProfileSource = z.infer<typeof ClientProfileSourceSchema>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### `ClientProfileStatus`
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
export type ClientProfileStatus = z.infer<typeof ClientProfileStatusSchema>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### `ClientProfileWorkspace`
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
export type ClientProfileWorkspace = z.infer<typeof ClientProfileWorkspaceSchema>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### `OrganizationModelClients`
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
export type OrganizationModelClients = z.infer<typeof ClientProfilesDomainSchema>
|
|
94
|
+
```
|
|
95
|
+
|
|
42
96
|
### `SalesPipeline`
|
|
43
97
|
|
|
44
98
|
```typescript
|