@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.
Files changed (38) hide show
  1. package/dist/index.d.ts +146 -89
  2. package/dist/index.js +116 -46
  3. package/dist/knowledge/index.d.ts +21 -21
  4. package/dist/organization-model/index.d.ts +146 -89
  5. package/dist/organization-model/index.js +116 -46
  6. package/dist/test-utils/index.d.ts +20 -17
  7. package/dist/test-utils/index.js +22 -20
  8. package/package.json +1 -1
  9. package/src/business/acquisition/api-schemas.test.ts +59 -8
  10. package/src/business/acquisition/api-schemas.ts +10 -5
  11. package/src/business/acquisition/build-templates.test.ts +187 -240
  12. package/src/business/acquisition/build-templates.ts +87 -98
  13. package/src/business/acquisition/types.ts +390 -389
  14. package/src/execution/engine/index.ts +6 -4
  15. package/src/execution/engine/tools/lead-service-types.ts +63 -34
  16. package/src/execution/engine/tools/platform/acquisition/types.ts +7 -8
  17. package/src/execution/engine/tools/registry.ts +6 -4
  18. package/src/execution/engine/tools/tool-maps.ts +23 -1
  19. package/src/organization-model/__tests__/define-domain-record.test.ts +289 -0
  20. package/src/organization-model/__tests__/om-spine-doc-contract.test.ts +56 -0
  21. package/src/organization-model/domains/actions.ts +13 -0
  22. package/src/organization-model/domains/customers.ts +95 -78
  23. package/src/organization-model/domains/entities.ts +157 -144
  24. package/src/organization-model/domains/goals.ts +100 -83
  25. package/src/organization-model/domains/knowledge.ts +106 -93
  26. package/src/organization-model/domains/offerings.ts +88 -71
  27. package/src/organization-model/domains/policies.ts +115 -102
  28. package/src/organization-model/domains/prospecting.ts +2 -327
  29. package/src/organization-model/domains/roles.ts +109 -96
  30. package/src/organization-model/domains/statuses.ts +351 -339
  31. package/src/organization-model/domains/systems.ts +176 -164
  32. package/src/organization-model/helpers.ts +331 -306
  33. package/src/organization-model/index.ts +42 -0
  34. package/src/organization-model/migration-helpers.ts +16 -12
  35. package/src/organization-model/published.ts +27 -2
  36. package/src/platform/constants/versions.ts +1 -1
  37. package/src/reference/_generated/contracts.md +376 -352
  38. package/src/supabase/database.types.ts +3 -0
@@ -1,98 +1,87 @@
1
- // Phase 4: DEFAULT_ORGANIZATION_MODEL_PROSPECTING was deleted (compound domain removed per D8).
2
- // Build-template definitions are now sourced inline from PROSPECTING_STEPS, which retains
3
- // the step catalog. The template catalog (id, label, description, steps[]) is declared here
4
- // as a local constant — Wave 2 will author these as system.content entries on the canonical OM.
5
- import {
6
- PROSPECTING_STEPS,
7
- type CredentialRequirement,
8
- type ListBuilderStep,
9
- type RecordColumnConfig
10
- } from '../../organization-model/domains/prospecting'
11
- import type { BuildPlanSnapshot, BuildPlanSnapshotStep } from './types'
12
-
13
- interface BuildTemplateCatalogEntry {
14
- id: string
15
- label: string
16
- description?: string
17
- steps: ListBuilderStep[]
18
- }
19
-
20
- // Template catalog — mirrors the data that lived in DEFAULT_ORGANIZATION_MODEL_PROSPECTING.buildTemplates.
21
- // Wave 2 canonical OM will author these as (kind:'schema', type:'template') content nodes.
22
- const BUILD_TEMPLATE_CATALOG: BuildTemplateCatalogEntry[] = [
23
- {
24
- id: 'local-services',
25
- label: 'Local Services',
26
- description: 'Source, analyze, qualify, and personalize local service businesses for outreach.',
27
- steps: Object.values(PROSPECTING_STEPS.localServices)
28
- },
29
- {
30
- id: 'dtc-subscription-apollo-clickup',
31
- label: 'DTC Subscription (Apollo + ClickUp)',
32
- description:
33
- 'Import DTC brand leads from Apollo, crawl their websites, score fit, enrich contacts, and export via ClickUp.',
34
- steps: Object.values(PROSPECTING_STEPS.dtcApolloClickup)
35
- }
36
- ]
37
-
38
- export const DEFAULT_PROSPECTING_BUILD_TEMPLATE_ID = 'local-services'
39
-
40
- export const PROSPECTING_BUILD_TEMPLATE_OPTIONS = BUILD_TEMPLATE_CATALOG.map(({ id, label, description }) => ({
41
- id,
42
- label,
43
- description
44
- }))
45
-
46
- export function isProspectingBuildTemplateId(value: string): boolean {
47
- return PROSPECTING_BUILD_TEMPLATE_OPTIONS.some((template) => template.id === value)
48
- }
49
-
50
- export function createBuildPlanSnapshotFromTemplateId(templateId: string): BuildPlanSnapshot | null {
51
- const template = BUILD_TEMPLATE_CATALOG.find((item: BuildTemplateCatalogEntry) => item.id === templateId)
52
- if (!template) return null
53
-
54
- return {
55
- templateId: template.id,
56
- templateLabel: template.label,
57
- steps: template.steps.map((step: ListBuilderStep): BuildPlanSnapshotStep => {
58
- const snapshotStep: BuildPlanSnapshotStep = {
59
- id: step.id,
60
- label: step.label,
61
- primaryEntity: step.primaryEntity,
62
- outputs: [...step.outputs],
63
- stageKey: step.stageKey,
64
- recordsStageKey: step.recordsStageKey ?? step.stageKey,
65
- recordSourceStageKey: step.recordSourceStageKey ?? step.recordsStageKey ?? step.stageKey,
66
- dependencyMode: step.dependencyMode,
67
- actionKey: step.actionKey,
68
- defaultBatchSize: step.defaultBatchSize,
69
- maxBatchSize: step.maxBatchSize
70
- }
71
-
72
- if (step.description) snapshotStep.description = step.description
73
- if (step.recordEntity) snapshotStep.recordEntity = step.recordEntity
74
- if (step.dependsOn?.length) snapshotStep.dependsOn = [...step.dependsOn]
75
- if (step.credentialRequirements?.length) {
76
- snapshotStep.credentialRequirements = step.credentialRequirements.map((requirement: CredentialRequirement) => ({
77
- ...requirement
78
- }))
79
- }
80
- if (step.recordColumns) {
81
- snapshotStep.recordColumns = {
82
- ...(step.recordColumns.company
83
- ? {
84
- company: step.recordColumns.company.map((column: RecordColumnConfig) => ({ ...column }))
85
- }
86
- : {}),
87
- ...(step.recordColumns.contact
88
- ? {
89
- contact: step.recordColumns.contact.map((column: RecordColumnConfig) => ({ ...column }))
90
- }
91
- : {})
92
- }
93
- }
94
-
95
- return snapshotStep
96
- })
97
- }
98
- }
1
+ import type {
2
+ CredentialRequirement,
3
+ ListBuilderStep,
4
+ ProspectingBuildTemplate,
5
+ RecordColumnConfig
6
+ } from '../../organization-model/domains/prospecting'
7
+ import type { BuildPlanSnapshot, BuildPlanSnapshotStep } from './types'
8
+
9
+ export interface ProspectingBuildTemplateOption {
10
+ id: string
11
+ label: string
12
+ description?: string | undefined
13
+ }
14
+
15
+ export function getProspectingBuildTemplateOptions(
16
+ templates: readonly ProspectingBuildTemplate[]
17
+ ): ProspectingBuildTemplateOption[] {
18
+ return templates.map(({ id, label, description }) => ({
19
+ id,
20
+ label,
21
+ description
22
+ }))
23
+ }
24
+
25
+ export function isProspectingBuildTemplateId(
26
+ value: string,
27
+ templates: readonly ProspectingBuildTemplate[] = []
28
+ ): boolean {
29
+ return templates.some((template) => template.id === value)
30
+ }
31
+
32
+ export function createBuildPlanSnapshotFromTemplate(template: ProspectingBuildTemplate): BuildPlanSnapshot {
33
+ return {
34
+ templateId: template.id,
35
+ templateLabel: template.label,
36
+ steps: template.steps.map((step: ListBuilderStep): BuildPlanSnapshotStep => {
37
+ const snapshotStep: BuildPlanSnapshotStep = {
38
+ id: step.id,
39
+ label: step.label,
40
+ primaryEntity: step.primaryEntity,
41
+ outputs: [...step.outputs],
42
+ stageKey: step.stageKey,
43
+ recordsStageKey: step.recordsStageKey ?? step.stageKey,
44
+ recordSourceStageKey: step.recordSourceStageKey ?? step.recordsStageKey ?? step.stageKey,
45
+ dependencyMode: step.dependencyMode,
46
+ actionKey: step.actionKey,
47
+ defaultBatchSize: step.defaultBatchSize,
48
+ maxBatchSize: step.maxBatchSize
49
+ }
50
+
51
+ if (step.description) snapshotStep.description = step.description
52
+ if (step.recordEntity) snapshotStep.recordEntity = step.recordEntity
53
+ if (step.dependsOn?.length) snapshotStep.dependsOn = [...step.dependsOn]
54
+ if (step.credentialRequirements?.length) {
55
+ snapshotStep.credentialRequirements = step.credentialRequirements.map((requirement: CredentialRequirement) => ({
56
+ ...requirement
57
+ }))
58
+ }
59
+ if (step.recordColumns) {
60
+ snapshotStep.recordColumns = {
61
+ ...(step.recordColumns.company
62
+ ? {
63
+ company: step.recordColumns.company.map((column: RecordColumnConfig) => ({ ...column }))
64
+ }
65
+ : {}),
66
+ ...(step.recordColumns.contact
67
+ ? {
68
+ contact: step.recordColumns.contact.map((column: RecordColumnConfig) => ({ ...column }))
69
+ }
70
+ : {})
71
+ }
72
+ }
73
+
74
+ return snapshotStep
75
+ })
76
+ }
77
+ }
78
+
79
+ export function createBuildPlanSnapshotFromTemplateId(
80
+ templateId: string,
81
+ templates: readonly ProspectingBuildTemplate[] = []
82
+ ): BuildPlanSnapshot | null {
83
+ const template = templates.find((item) => item.id === templateId)
84
+ if (!template) return null
85
+
86
+ return createBuildPlanSnapshotFromTemplate(template)
87
+ }