@elevasis/core 0.24.1 → 0.26.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 (82) hide show
  1. package/dist/index.d.ts +239 -86
  2. package/dist/index.js +474 -1346
  3. package/dist/knowledge/index.d.ts +57 -39
  4. package/dist/knowledge/index.js +1 -1
  5. package/dist/organization-model/index.d.ts +239 -86
  6. package/dist/organization-model/index.js +474 -1346
  7. package/dist/test-utils/index.d.ts +24 -31
  8. package/dist/test-utils/index.js +76 -1238
  9. package/package.json +1 -1
  10. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +108 -96
  11. package/src/business/acquisition/api-schemas.test.ts +70 -77
  12. package/src/business/acquisition/api-schemas.ts +21 -42
  13. package/src/business/acquisition/derive-actions.test.ts +11 -21
  14. package/src/business/acquisition/derive-actions.ts +61 -14
  15. package/src/business/acquisition/ontology-validation.ts +4 -4
  16. package/src/business/acquisition/types.ts +7 -8
  17. package/src/execution/engine/llm/adapters/__tests__/openrouter.integration.test.ts +10 -10
  18. package/src/knowledge/__tests__/queries.test.ts +960 -546
  19. package/src/knowledge/format.ts +322 -100
  20. package/src/knowledge/index.ts +18 -5
  21. package/src/knowledge/queries.ts +1004 -240
  22. package/src/organization-model/__tests__/content-kinds-registry.test.ts +35 -210
  23. package/src/organization-model/__tests__/defaults.test.ts +4 -4
  24. package/src/organization-model/__tests__/deprecate-helpers.test.ts +71 -0
  25. package/src/organization-model/__tests__/domains/actions.test.ts +12 -36
  26. package/src/organization-model/__tests__/domains/offerings.test.ts +13 -6
  27. package/src/organization-model/__tests__/domains/resources.test.ts +497 -350
  28. package/src/organization-model/__tests__/domains/systems.test.ts +6 -7
  29. package/src/organization-model/__tests__/flatten-additive-merge.test.ts +68 -80
  30. package/src/organization-model/__tests__/foundation.test.ts +81 -14
  31. package/src/organization-model/__tests__/graph.test.ts +662 -694
  32. package/src/organization-model/__tests__/knowledge.test.ts +31 -17
  33. package/src/organization-model/__tests__/lookup-helpers.test.ts +128 -438
  34. package/src/organization-model/__tests__/migration-helpers.test.ts +362 -591
  35. package/src/organization-model/__tests__/prospecting-ssot.test.ts +68 -103
  36. package/src/organization-model/__tests__/published-zero-leak.test.ts +17 -0
  37. package/src/organization-model/__tests__/recursive-system-schema.test.ts +159 -532
  38. package/src/organization-model/__tests__/resolve.test.ts +88 -49
  39. package/src/organization-model/__tests__/scaffolders.test.ts +93 -0
  40. package/src/organization-model/__tests__/schema.test.ts +65 -56
  41. package/src/organization-model/catalogs/lead-gen.ts +0 -103
  42. package/src/organization-model/defaults.ts +17 -702
  43. package/src/organization-model/domains/actions.ts +116 -333
  44. package/src/organization-model/domains/knowledge.ts +15 -7
  45. package/src/organization-model/domains/projects.ts +4 -4
  46. package/src/organization-model/domains/prospecting.ts +405 -395
  47. package/src/organization-model/domains/resources.ts +206 -135
  48. package/src/organization-model/domains/sales.ts +5 -5
  49. package/src/organization-model/domains/systems.ts +8 -23
  50. package/src/organization-model/graph/build.ts +223 -294
  51. package/src/organization-model/graph/schema.ts +2 -3
  52. package/src/organization-model/graph/types.ts +12 -14
  53. package/src/organization-model/helpers.ts +120 -141
  54. package/src/organization-model/icons.ts +1 -0
  55. package/src/organization-model/index.ts +107 -126
  56. package/src/organization-model/migration-helpers.ts +211 -249
  57. package/src/organization-model/ontology.ts +0 -60
  58. package/src/organization-model/organization-graph.mdx +4 -5
  59. package/src/organization-model/organization-model.mdx +1 -1
  60. package/src/organization-model/published.ts +251 -228
  61. package/src/organization-model/resolve.ts +4 -5
  62. package/src/organization-model/scaffolders/helpers.ts +84 -0
  63. package/src/organization-model/scaffolders/index.ts +19 -0
  64. package/src/organization-model/scaffolders/scaffoldKnowledgeNode.ts +48 -0
  65. package/src/organization-model/scaffolders/scaffoldOntologyRecord.ts +38 -0
  66. package/src/organization-model/scaffolders/scaffoldResource.ts +59 -0
  67. package/src/organization-model/scaffolders/scaffoldSystem.ts +110 -0
  68. package/src/organization-model/scaffolders/types.ts +81 -0
  69. package/src/organization-model/schema.ts +610 -704
  70. package/src/organization-model/types.ts +167 -161
  71. package/src/platform/constants/versions.ts +1 -1
  72. package/src/platform/registry/__tests__/validation.test.ts +23 -0
  73. package/src/platform/registry/validation.ts +13 -2
  74. package/src/reference/_generated/contracts.md +108 -96
  75. package/src/reference/glossary.md +71 -69
  76. package/src/organization-model/content-kinds/config.ts +0 -36
  77. package/src/organization-model/content-kinds/index.ts +0 -78
  78. package/src/organization-model/content-kinds/pipeline.ts +0 -68
  79. package/src/organization-model/content-kinds/registry.ts +0 -44
  80. package/src/organization-model/content-kinds/status.ts +0 -71
  81. package/src/organization-model/content-kinds/template.ts +0 -83
  82. package/src/organization-model/content-kinds/types.ts +0 -117
@@ -1,103 +1,68 @@
1
- import { describe, expect, it } from 'vitest'
2
- import { LEAD_GEN_STAGE_CATALOG } from '../catalogs/lead-gen'
3
- import { LEAD_GEN_ACTION_ENTRIES } from '../domains/actions'
4
- import { ACTION_REGISTRY, PROSPECTING_STEPS } from '../domains/prospecting'
5
-
6
- // Phase 4 cut: DEFAULT_ORGANIZATION_MODEL_PROSPECTING was removed — prospecting
7
- // lifecycle stages and build templates now live in system.content as (schema:stage)
8
- // and (schema:template) / (schema:template-step) content nodes on sales.lead-gen.
9
- // Tests that depended on DEFAULT_ORGANIZATION_MODEL_PROSPECTING.companyStages,
10
- // .contactStages, and .buildTemplates are skipped below with a clear reason.
11
- // They should be re-enabled in Wave 5 once content-node graph projection is active
12
- // and the helpers return the expected shapes from system.content.
13
-
14
- const EXPECTED_ACTION_RESOURCE_BY_ID: Record<string, string> = {
15
- 'lead-gen.company.source': 'lgn-import-workflow',
16
- 'lead-gen.company.apollo-import': 'lgn-01c-apollo-import-workflow',
17
- 'lead-gen.company.apify-crawl': 'lgn-02a-apify-website-crawl-workflow',
18
- 'lead-gen.contact.discover': 'lgn-04-email-discovery-workflow',
19
- 'lead-gen.contact.verify-email': 'lgn-05-email-verification-workflow',
20
- 'lead-gen.company.website-extract': 'lgn-02-website-extract-workflow',
21
- 'lead-gen.company.qualify': 'lgn-03-company-qualification-workflow',
22
- 'lead-gen.company.dtc-subscription-qualify': 'lgn-03b-dtc-subscription-score-workflow',
23
- 'lead-gen.contact.apollo-decision-maker-enrich': 'lgn-04b-apollo-decision-maker-enrich-workflow',
24
- 'lead-gen.contact.personalize': 'ist-personalization-workflow',
25
- 'lead-gen.review.outreach-ready': 'ist-upload-contacts-workflow',
26
- 'lead-gen.export.list': 'lgn-06-export-list-workflow',
27
- 'lead-gen.company.cleanup': 'lgn-company-cleanup-workflow'
28
- }
29
-
30
- describe('prospecting organization-model SSOT', () => {
31
- it('catalogs the DTC decision-maker enrichment stage', () => {
32
- expect(LEAD_GEN_STAGE_CATALOG['decision-makers-enriched']).toEqual({
33
- key: 'decision-makers-enriched',
34
- label: 'Decision-makers found',
35
- description: 'Decision-maker contacts discovered and attached to a qualified company.',
36
- order: 6,
37
- entity: 'company',
38
- recordEntity: 'contact',
39
- recordStageKey: 'discovered'
40
- })
41
- })
42
-
43
- it('scopes prospecting steps per build template', () => {
44
- expect(PROSPECTING_STEPS.localServices.findContacts).toMatchObject({
45
- id: 'find-contacts',
46
- primaryEntity: 'contact',
47
- stageKey: 'discovered'
48
- })
49
- expect(PROSPECTING_STEPS.dtcApolloClickup.enrichDecisionMakers).toMatchObject({
50
- id: 'enrich-decision-makers',
51
- primaryEntity: 'company',
52
- stageKey: 'decision-makers-enriched'
53
- })
54
- })
55
-
56
- it('uses catalog stage keys for every prospecting step', () => {
57
- const catalogKeys = new Set(Object.keys(LEAD_GEN_STAGE_CATALOG))
58
-
59
- for (const templateSteps of Object.values(PROSPECTING_STEPS)) {
60
- for (const step of Object.values(templateSteps)) {
61
- expect(catalogKeys.has(step.stageKey), step.id).toBe(true)
62
- }
63
- }
64
- })
65
-
66
- it('uses registered actions for every prospecting step', () => {
67
- const actionKeys = new Set(ACTION_REGISTRY.map((c) => c.id))
68
-
69
- for (const templateSteps of Object.values(PROSPECTING_STEPS)) {
70
- for (const step of Object.values(templateSteps)) {
71
- expect(actionKeys.has(step.actionKey), step.id).toBe(true)
72
- }
73
- }
74
- })
75
-
76
- // Phase 4 (D3): DEFAULT_ORGANIZATION_MODEL_PROSPECTING.companyStages and
77
- // .contactStages were removed — lifecycle stages now live in system.content.
78
- // Use getAllProspectingStages(model, 'company' | 'contact') from migration-helpers.
79
- it.skip('derives prospecting lifecycle stages from the stage catalog by entity (deferred — Phase 4: use getAllProspectingStages())', () => {
80
- // Previously: expect(DEFAULT_ORGANIZATION_MODEL_PROSPECTING.companyStages).toEqual(...)
81
- // Re-enable when the canonical OM authors stage content nodes and the test
82
- // verifies getAllProspectingStages() returns the expected catalog-derived set.
83
- })
84
-
85
- // Phase 4 (D8): DEFAULT_ORGANIZATION_MODEL_PROSPECTING.buildTemplates removed.
86
- // Build templates now live in system.content as (schema:template) + (schema:template-step).
87
- // Use getAllBuildTemplates(model) from migration-helpers.
88
- it.skip('build templates reference PROSPECTING_STEPS entries (deferred — Phase 4: use getAllBuildTemplates())', () => {
89
- // Previously: expect(DEFAULT_ORGANIZATION_MODEL_PROSPECTING.buildTemplates).toEqual(...)
90
- // Re-enable when the canonical OM authors template content nodes and the test
91
- // verifies getAllBuildTemplates() returns the expected template/step shapes.
92
- })
93
-
94
- it('covers all known lead-gen action registry entries', () => {
95
- expect(ACTION_REGISTRY).toHaveLength(13)
96
- const actualResourceById = Object.fromEntries(ACTION_REGISTRY.map((c) => [c.id, c.resourceId]))
97
- expect(actualResourceById).toEqual(EXPECTED_ACTION_RESOURCE_BY_ID)
98
- })
99
-
100
- it('bridges the legacy prospecting action registry from the top-level actions domain', () => {
101
- expect(ACTION_REGISTRY).toEqual(Object.values(LEAD_GEN_ACTION_ENTRIES))
102
- })
103
- })
1
+ import { describe, expect, it } from 'vitest'
2
+ import { ACTION_REGISTRY } from '../domains/prospecting'
3
+ import { getLeadGenStageCatalog } from '../migration-helpers'
4
+ import { resolveOrganizationModel } from '../resolve'
5
+
6
+ describe('prospecting organization-model SSOT', () => {
7
+ it('reads lead-gen processing stages from model-owned ontology catalogs', () => {
8
+ const model = resolveOrganizationModel({
9
+ systems: {
10
+ sales: {
11
+ id: 'sales',
12
+ order: 10,
13
+ label: 'Sales',
14
+ lifecycle: 'active',
15
+ systems: {
16
+ 'lead-gen': {
17
+ id: 'sales.lead-gen',
18
+ order: 20,
19
+ label: 'Lead Gen',
20
+ lifecycle: 'active',
21
+ ontology: {
22
+ objectTypes: {
23
+ 'sales.lead-gen:object/company': {
24
+ id: 'sales.lead-gen:object/company',
25
+ label: 'Lead Company',
26
+ ownerSystemId: 'sales.lead-gen'
27
+ }
28
+ },
29
+ catalogTypes: {
30
+ 'sales.lead-gen:catalog/company-stage': {
31
+ id: 'sales.lead-gen:catalog/company-stage',
32
+ label: 'Company Stages',
33
+ kind: 'stage',
34
+ appliesTo: 'sales.lead-gen:object/company',
35
+ entries: {
36
+ 'decision-makers-enriched': {
37
+ label: 'Decision-makers found',
38
+ description: 'Decision-maker contacts discovered and attached to a qualified company.',
39
+ order: 6,
40
+ entity: 'company',
41
+ recordEntity: 'contact',
42
+ recordStageKey: 'discovered'
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ })
53
+
54
+ expect(getLeadGenStageCatalog(model)['decision-makers-enriched']).toEqual({
55
+ key: 'decision-makers-enriched',
56
+ label: 'Decision-makers found',
57
+ description: 'Decision-maker contacts discovered and attached to a qualified company.',
58
+ order: 6,
59
+ entity: 'company',
60
+ recordEntity: 'contact',
61
+ recordStageKey: 'discovered'
62
+ })
63
+ })
64
+
65
+ it('keeps the generic core prospecting action registry empty', () => {
66
+ expect(ACTION_REGISTRY).toEqual([])
67
+ })
68
+ })
@@ -0,0 +1,17 @@
1
+ import { describe, expect, it } from 'vitest'
2
+ import * as publishedOrganizationModel from '../published'
3
+
4
+ describe('published organization-model barrel zero-leak guard', () => {
5
+ it('does not export Elevasis instance data through @repo/core/organization-model', () => {
6
+ expect(Object.keys(publishedOrganizationModel)).not.toEqual(
7
+ expect.arrayContaining(['LEAD_GEN_STAGE_CATALOG', 'CRM_ACTION_ENTRIES', 'LEAD_GEN_ACTION_ENTRIES'])
8
+ )
9
+
10
+ const serializedExports = JSON.stringify(publishedOrganizationModel)
11
+
12
+ expect(serializedExports).not.toContain('lgn-01c-apollo-import-workflow')
13
+ expect(serializedExports).not.toContain('lgn-05-email-verification-workflow')
14
+ expect(serializedExports).not.toContain('localServices')
15
+ expect(serializedExports).not.toContain('dtcApolloClickup')
16
+ })
17
+ })