@elevasis/core 0.30.0 → 0.32.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 +58 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +73 -109
- package/dist/knowledge/index.d.ts +10 -2
- package/dist/organization-model/index.d.ts +16 -5
- package/dist/organization-model/index.js +73 -109
- package/dist/test-utils/index.d.ts +55 -2
- package/dist/test-utils/index.js +72 -108
- package/package.json +1 -1
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +376 -446
- package/src/business/acquisition/api-schemas.test.ts +69 -5
- package/src/business/acquisition/crm-state-actions.test.ts +24 -6
- package/src/business/pdf/sections/__tests__/proposal-document.test.ts +146 -0
- package/src/business/pdf/sections/acceptance.ts +114 -112
- package/src/business/pdf/sections/proposal-document.ts +206 -200
- package/src/execution/engine/index.ts +440 -439
- package/src/execution/engine/tools/integration/types/clickup.ts +57 -0
- package/src/execution/engine/tools/integration/types/index.ts +20 -19
- package/src/execution/engine/tools/tool-maps.ts +16 -0
- package/src/organization-model/__tests__/domains/entities.test.ts +35 -56
- package/src/organization-model/__tests__/domains/passthrough-extensibility.test.ts +199 -0
- package/src/organization-model/domains/branding.ts +58 -16
- package/src/organization-model/domains/entities.ts +0 -103
- package/src/organization-model/domains/identity.ts +122 -94
- package/src/organization-model/domains/sales.test.ts +35 -28
- package/src/organization-model/domains/sales.ts +0 -85
- package/src/organization-model/published.ts +0 -1
- package/src/organization-model/schema.ts +2 -2
- package/src/reference/_generated/contracts.md +0 -94
- package/src/supabase/database.types.ts +45 -0
|
@@ -1,94 +1,122 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
.
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { DescriptionSchema, LabelSchema } from './shared'
|
|
3
|
+
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Business hours — simplest shape that captures weekday ranges.
|
|
6
|
+
// Each day of the week is optional; when present it holds open/close times
|
|
7
|
+
// in "HH:MM" 24-hour format. An empty object (default) means "not configured".
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
export const BusinessHoursDaySchema = z.object({
|
|
11
|
+
open: z
|
|
12
|
+
.string()
|
|
13
|
+
.trim()
|
|
14
|
+
.regex(/^\d{2}:\d{2}$/, 'Expected HH:MM format'),
|
|
15
|
+
close: z
|
|
16
|
+
.string()
|
|
17
|
+
.trim()
|
|
18
|
+
.regex(/^\d{2}:\d{2}$/, 'Expected HH:MM format')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export const BusinessHoursSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
monday: BusinessHoursDaySchema.optional(),
|
|
24
|
+
tuesday: BusinessHoursDaySchema.optional(),
|
|
25
|
+
wednesday: BusinessHoursDaySchema.optional(),
|
|
26
|
+
thursday: BusinessHoursDaySchema.optional(),
|
|
27
|
+
friday: BusinessHoursDaySchema.optional(),
|
|
28
|
+
saturday: BusinessHoursDaySchema.optional(),
|
|
29
|
+
sunday: BusinessHoursDaySchema.optional()
|
|
30
|
+
})
|
|
31
|
+
.default({})
|
|
32
|
+
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Identity domain schema — legal identity, mission/vision, industry anchors,
|
|
35
|
+
// and temporal/geographic context. Distinct from branding (display identity).
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
export const IdentityDomainSchema = z
|
|
39
|
+
.object({
|
|
40
|
+
/** Why the organization exists — one or two plain-language sentences. */
|
|
41
|
+
mission: z.string().trim().max(1000).default(''),
|
|
42
|
+
/** Long-term direction the organization is moving toward. */
|
|
43
|
+
vision: z.string().trim().max(1000).default(''),
|
|
44
|
+
/** Legal registered name of the entity. */
|
|
45
|
+
legalName: z.string().trim().max(200).default(''),
|
|
46
|
+
/**
|
|
47
|
+
* Type of legal entity (e.g. "LLC", "Corporation", "Sole Proprietor",
|
|
48
|
+
* "Non-profit"). Free-form string so it covers any jurisdiction.
|
|
49
|
+
*/
|
|
50
|
+
entityType: z.string().trim().max(100).default(''),
|
|
51
|
+
/**
|
|
52
|
+
* Primary jurisdiction of registration or operation
|
|
53
|
+
* (e.g. "United States – Delaware", "Canada – Ontario").
|
|
54
|
+
*/
|
|
55
|
+
jurisdiction: z.string().trim().max(200).default(''),
|
|
56
|
+
/**
|
|
57
|
+
* Industry category — broad classification (e.g. "Marketing Agency",
|
|
58
|
+
* "Software / SaaS", "Professional Services").
|
|
59
|
+
*/
|
|
60
|
+
industryCategory: z.string().trim().max(200).default(''),
|
|
61
|
+
/**
|
|
62
|
+
* Geographic focus — where the organization primarily operates or serves
|
|
63
|
+
* (e.g. "North America", "Global", "Southeast Asia").
|
|
64
|
+
*/
|
|
65
|
+
geographicFocus: z.string().trim().max(200).default(''),
|
|
66
|
+
/**
|
|
67
|
+
* IANA timezone identifier for the organization's primary operating timezone
|
|
68
|
+
* (e.g. "America/Los_Angeles", "Europe/London", "UTC").
|
|
69
|
+
*/
|
|
70
|
+
timeZone: z.string().trim().max(100).default('UTC'),
|
|
71
|
+
/** Typical operating hours per day of week. Empty object means not configured. */
|
|
72
|
+
businessHours: BusinessHoursSchema,
|
|
73
|
+
/**
|
|
74
|
+
* Long-form markdown capturing client context, problem narrative, and domain
|
|
75
|
+
* background. Populated by /setup; surfaced to agents as organizational context.
|
|
76
|
+
* Optional — many projects have no external client.
|
|
77
|
+
*/
|
|
78
|
+
clientBrief: z.string().trim().default(''),
|
|
79
|
+
/**
|
|
80
|
+
* Display name of the organization as shown to end users.
|
|
81
|
+
* Recommended placement for display naming — prefer this over the deprecated
|
|
82
|
+
* `branding.organizationName`. Falls back to `branding.organizationName` for
|
|
83
|
+
* legacy tenants that have not yet migrated.
|
|
84
|
+
*/
|
|
85
|
+
organizationName: LabelSchema.optional(),
|
|
86
|
+
/**
|
|
87
|
+
* Display name of the primary product or platform.
|
|
88
|
+
* Recommended placement for display naming — prefer this over the deprecated
|
|
89
|
+
* `branding.productName`. Falls back to `branding.productName` for legacy tenants.
|
|
90
|
+
*/
|
|
91
|
+
productName: LabelSchema.optional(),
|
|
92
|
+
/**
|
|
93
|
+
* Short abbreviated name used in space-constrained UI surfaces (max 40 chars).
|
|
94
|
+
* Recommended placement for display naming — prefer this over the deprecated
|
|
95
|
+
* `branding.shortName`. Falls back to `branding.shortName` for legacy tenants.
|
|
96
|
+
*/
|
|
97
|
+
shortName: z.string().trim().min(1).max(40).optional(),
|
|
98
|
+
/**
|
|
99
|
+
* Plain-language description of the organization for display and discovery.
|
|
100
|
+
* Recommended placement for display naming — prefer this over the deprecated
|
|
101
|
+
* `branding.description`. Falls back to `branding.description` for legacy tenants.
|
|
102
|
+
*/
|
|
103
|
+
description: DescriptionSchema.optional()
|
|
104
|
+
})
|
|
105
|
+
.passthrough()
|
|
106
|
+
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
// Seed — placeholder defaults; external adapters override per organization.
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
|
|
111
|
+
export const DEFAULT_ORGANIZATION_MODEL_IDENTITY: z.infer<typeof IdentityDomainSchema> = {
|
|
112
|
+
mission: '',
|
|
113
|
+
vision: '',
|
|
114
|
+
legalName: '',
|
|
115
|
+
entityType: '',
|
|
116
|
+
jurisdiction: '',
|
|
117
|
+
industryCategory: '',
|
|
118
|
+
geographicFocus: '',
|
|
119
|
+
timeZone: 'UTC',
|
|
120
|
+
businessHours: {},
|
|
121
|
+
clientBrief: ''
|
|
122
|
+
}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
|
-
import {
|
|
3
|
-
ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE,
|
|
4
|
-
ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE,
|
|
5
|
-
LEAD_GEN_PIPELINE_DEFINITIONS,
|
|
6
|
-
findPipeline,
|
|
7
|
-
getValidStatesForStage,
|
|
8
|
-
type StatefulPipelineDefinition
|
|
9
|
-
} from './sales'
|
|
2
|
+
import { findPipeline, getValidStatesForStage, type StatefulPipelineDefinition } from './sales'
|
|
10
3
|
|
|
11
4
|
const TEST_CRM_PIPELINE: StatefulPipelineDefinition = {
|
|
12
5
|
pipelineKey: 'crm',
|
|
@@ -26,6 +19,23 @@ const TEST_CRM_PIPELINE: StatefulPipelineDefinition = {
|
|
|
26
19
|
]
|
|
27
20
|
}
|
|
28
21
|
|
|
22
|
+
const TEST_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
23
|
+
pipelineKey: 'lead-gen',
|
|
24
|
+
label: 'Lead Gen',
|
|
25
|
+
entityKey: 'leadgen.contact',
|
|
26
|
+
stages: [
|
|
27
|
+
{
|
|
28
|
+
stageKey: 'outreach',
|
|
29
|
+
label: 'Outreach',
|
|
30
|
+
color: 'blue',
|
|
31
|
+
states: [
|
|
32
|
+
{ stateKey: 'personalized', label: 'Personalized' },
|
|
33
|
+
{ stateKey: 'contacted', label: 'Contacted' }
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
|
|
29
39
|
describe('sales domain published surface', () => {
|
|
30
40
|
it('does not export Elevasis CRM runtime constants from the generic core sales domain', async () => {
|
|
31
41
|
const sales = await import('./sales')
|
|
@@ -40,6 +50,18 @@ describe('sales domain published surface', () => {
|
|
|
40
50
|
])
|
|
41
51
|
)
|
|
42
52
|
})
|
|
53
|
+
|
|
54
|
+
it('does not export Elevasis lead-gen pipeline constants from the generic core sales domain', async () => {
|
|
55
|
+
const sales = await import('./sales')
|
|
56
|
+
|
|
57
|
+
expect(Object.keys(sales)).not.toEqual(
|
|
58
|
+
expect.arrayContaining([
|
|
59
|
+
'ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE',
|
|
60
|
+
'ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE',
|
|
61
|
+
'LEAD_GEN_PIPELINE_DEFINITIONS'
|
|
62
|
+
])
|
|
63
|
+
)
|
|
64
|
+
})
|
|
43
65
|
})
|
|
44
66
|
|
|
45
67
|
describe('getValidStatesForStage', () => {
|
|
@@ -64,8 +86,8 @@ describe('getValidStatesForStage', () => {
|
|
|
64
86
|
expect(getValidStatesForStage(TEST_CRM_PIPELINE, 'Interested')).toEqual([])
|
|
65
87
|
})
|
|
66
88
|
|
|
67
|
-
it('works with
|
|
68
|
-
const states = getValidStatesForStage(
|
|
89
|
+
it('works with a caller-supplied lead-gen pipeline for a known stage', () => {
|
|
90
|
+
const states = getValidStatesForStage(TEST_LEAD_GEN_PIPELINE, 'outreach')
|
|
69
91
|
expect(states.length).toBeGreaterThan(0)
|
|
70
92
|
expect(states.map((s) => s.stateKey)).toContain('personalized')
|
|
71
93
|
})
|
|
@@ -73,12 +95,12 @@ describe('getValidStatesForStage', () => {
|
|
|
73
95
|
|
|
74
96
|
describe('findPipeline', () => {
|
|
75
97
|
it('finds a pipeline by pipelineKey when present', () => {
|
|
76
|
-
const found = findPipeline(
|
|
77
|
-
expect(found).toBe(
|
|
98
|
+
const found = findPipeline([TEST_LEAD_GEN_PIPELINE], 'lead-gen')
|
|
99
|
+
expect(found).toBe(TEST_LEAD_GEN_PIPELINE)
|
|
78
100
|
})
|
|
79
101
|
|
|
80
102
|
it('returns undefined for an unknown pipelineKey', () => {
|
|
81
|
-
const found = findPipeline(
|
|
103
|
+
const found = findPipeline([TEST_LEAD_GEN_PIPELINE], 'crm')
|
|
82
104
|
expect(found).toBeUndefined()
|
|
83
105
|
})
|
|
84
106
|
|
|
@@ -87,18 +109,3 @@ describe('findPipeline', () => {
|
|
|
87
109
|
expect(found).toBeUndefined()
|
|
88
110
|
})
|
|
89
111
|
})
|
|
90
|
-
|
|
91
|
-
describe('LEAD_GEN_PIPELINE_DEFINITIONS', () => {
|
|
92
|
-
it('has entries for acq.list-member and acq.list-company', () => {
|
|
93
|
-
expect(LEAD_GEN_PIPELINE_DEFINITIONS).toHaveProperty('acq.list-member')
|
|
94
|
-
expect(LEAD_GEN_PIPELINE_DEFINITIONS).toHaveProperty('acq.list-company')
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
it('acq.list-member entry contains the ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE', () => {
|
|
98
|
-
expect(LEAD_GEN_PIPELINE_DEFINITIONS['acq.list-member']).toContain(ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE)
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
it('acq.list-company entry contains the ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE', () => {
|
|
102
|
-
expect(LEAD_GEN_PIPELINE_DEFINITIONS['acq.list-company']).toContain(ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE)
|
|
103
|
-
})
|
|
104
|
-
})
|
|
@@ -130,88 +130,3 @@ export interface CrmNextActionRuleConfig {
|
|
|
130
130
|
/** Fallback action key when ownership === 'us' and no explicit mapping matches. */
|
|
131
131
|
ownershipUsFallback?: string | null
|
|
132
132
|
}
|
|
133
|
-
|
|
134
|
-
/** Common states that appear across multiple stages. */
|
|
135
|
-
const PENDING_STATE: StatefulStateDefinition = { stateKey: 'pending', label: 'Pending' }
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Lead-gen pipeline definition for acq_list_members (contacts).
|
|
139
|
-
* Three stages matching the post-restructure sales subdomain tree.
|
|
140
|
-
*
|
|
141
|
-
* Note: members visit outreach and prospecting states depending on which
|
|
142
|
-
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
143
|
-
*/
|
|
144
|
-
export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
145
|
-
pipelineKey: 'lead-gen',
|
|
146
|
-
label: 'Lead Generation',
|
|
147
|
-
entityKey: 'acq.list-member',
|
|
148
|
-
stages: [
|
|
149
|
-
{
|
|
150
|
-
stageKey: 'outreach',
|
|
151
|
-
label: 'Outreach',
|
|
152
|
-
states: [
|
|
153
|
-
PENDING_STATE,
|
|
154
|
-
{ stateKey: 'personalized', label: 'Personalized' },
|
|
155
|
-
{ stateKey: 'uploaded', label: 'Uploaded' },
|
|
156
|
-
{ stateKey: 'interested', label: 'Interested' }
|
|
157
|
-
]
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
stageKey: 'prospecting',
|
|
161
|
-
label: 'Prospecting',
|
|
162
|
-
states: [
|
|
163
|
-
PENDING_STATE,
|
|
164
|
-
{ stateKey: 'discovered', label: 'Discovered' },
|
|
165
|
-
{ stateKey: 'verified', label: 'Verified' }
|
|
166
|
-
]
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
stageKey: 'qualification',
|
|
170
|
-
label: 'Qualification',
|
|
171
|
-
states: [PENDING_STATE]
|
|
172
|
-
}
|
|
173
|
-
]
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Lead-gen pipeline definition for acq_list_companies.
|
|
178
|
-
* Three stages matching the post-restructure sales subdomain tree.
|
|
179
|
-
*
|
|
180
|
-
* Note: companies visit prospecting and qualification states depending on which
|
|
181
|
-
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
182
|
-
*/
|
|
183
|
-
export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
184
|
-
pipelineKey: 'lead-gen',
|
|
185
|
-
label: 'Lead Generation',
|
|
186
|
-
entityKey: 'acq.list-company',
|
|
187
|
-
stages: [
|
|
188
|
-
{
|
|
189
|
-
stageKey: 'outreach',
|
|
190
|
-
label: 'Outreach',
|
|
191
|
-
states: [PENDING_STATE, { stateKey: 'uploaded', label: 'Uploaded' }]
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
stageKey: 'prospecting',
|
|
195
|
-
label: 'Prospecting',
|
|
196
|
-
states: [
|
|
197
|
-
PENDING_STATE,
|
|
198
|
-
{ stateKey: 'populated', label: 'Populated' },
|
|
199
|
-
{ stateKey: 'extracted', label: 'Extracted' }
|
|
200
|
-
]
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
stageKey: 'qualification',
|
|
204
|
-
label: 'Qualification',
|
|
205
|
-
states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
|
|
206
|
-
}
|
|
207
|
-
]
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* All lead-gen pipeline definitions indexed by entity key.
|
|
212
|
-
* Use findPipeline() to locate a definition by pipeline_key within any array.
|
|
213
|
-
*/
|
|
214
|
-
export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
|
|
215
|
-
'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
|
|
216
|
-
'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
|
|
217
|
-
}
|
|
@@ -11,7 +11,7 @@ import { SystemsDomainSchema, DEFAULT_ORGANIZATION_MODEL_SYSTEMS } from './domai
|
|
|
11
11
|
import { ResourcesDomainSchema, DEFAULT_ORGANIZATION_MODEL_RESOURCES } from './domains/resources'
|
|
12
12
|
import { OmTopologyDomainSchema, DEFAULT_ORGANIZATION_MODEL_TOPOLOGY } from './domains/topology'
|
|
13
13
|
import { ActionsDomainSchema, DEFAULT_ORGANIZATION_MODEL_ACTIONS } from './domains/actions'
|
|
14
|
-
import { EntitiesDomainSchema
|
|
14
|
+
import { EntitiesDomainSchema } from './domains/entities'
|
|
15
15
|
import { PoliciesDomainSchema, DEFAULT_ORGANIZATION_MODEL_POLICIES } from './domains/policies'
|
|
16
16
|
import { DEFAULT_ONTOLOGY_SCOPE, OntologyScopeSchema } from './ontology'
|
|
17
17
|
import { refineOrganizationModel } from './schema-refinements'
|
|
@@ -104,7 +104,7 @@ const OrganizationModelSchemaBase = z.object({
|
|
|
104
104
|
resources: ResourcesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_RESOURCES),
|
|
105
105
|
topology: OmTopologyDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_TOPOLOGY),
|
|
106
106
|
actions: ActionsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ACTIONS),
|
|
107
|
-
entities: EntitiesDomainSchema.default(
|
|
107
|
+
entities: EntitiesDomainSchema.default({}),
|
|
108
108
|
policies: PoliciesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_POLICIES),
|
|
109
109
|
// D3: flat Record<id, OrgKnowledgeNode> — no wrapper object
|
|
110
110
|
knowledge: KnowledgeDomainSchema.default({})
|
|
@@ -3072,100 +3072,6 @@ export interface StatefulPipelineDefinition {
|
|
|
3072
3072
|
}
|
|
3073
3073
|
```
|
|
3074
3074
|
|
|
3075
|
-
### `ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE`
|
|
3076
|
-
|
|
3077
|
-
```typescript
|
|
3078
|
-
/**
|
|
3079
|
-
* Lead-gen pipeline definition for acq_list_members (contacts).
|
|
3080
|
-
* Three stages matching the post-restructure sales subdomain tree.
|
|
3081
|
-
*
|
|
3082
|
-
* Note: members visit outreach and prospecting states depending on which
|
|
3083
|
-
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
3084
|
-
*/
|
|
3085
|
-
export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
3086
|
-
pipelineKey: 'lead-gen',
|
|
3087
|
-
label: 'Lead Generation',
|
|
3088
|
-
entityKey: 'acq.list-member',
|
|
3089
|
-
stages: [
|
|
3090
|
-
{
|
|
3091
|
-
stageKey: 'outreach',
|
|
3092
|
-
label: 'Outreach',
|
|
3093
|
-
states: [
|
|
3094
|
-
PENDING_STATE,
|
|
3095
|
-
{ stateKey: 'personalized', label: 'Personalized' },
|
|
3096
|
-
{ stateKey: 'uploaded', label: 'Uploaded' },
|
|
3097
|
-
{ stateKey: 'interested', label: 'Interested' }
|
|
3098
|
-
]
|
|
3099
|
-
},
|
|
3100
|
-
{
|
|
3101
|
-
stageKey: 'prospecting',
|
|
3102
|
-
label: 'Prospecting',
|
|
3103
|
-
states: [
|
|
3104
|
-
PENDING_STATE,
|
|
3105
|
-
{ stateKey: 'discovered', label: 'Discovered' },
|
|
3106
|
-
{ stateKey: 'verified', label: 'Verified' }
|
|
3107
|
-
]
|
|
3108
|
-
},
|
|
3109
|
-
{
|
|
3110
|
-
stageKey: 'qualification',
|
|
3111
|
-
label: 'Qualification',
|
|
3112
|
-
states: [PENDING_STATE]
|
|
3113
|
-
}
|
|
3114
|
-
]
|
|
3115
|
-
}
|
|
3116
|
-
```
|
|
3117
|
-
|
|
3118
|
-
### `ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE`
|
|
3119
|
-
|
|
3120
|
-
```typescript
|
|
3121
|
-
/**
|
|
3122
|
-
* Lead-gen pipeline definition for acq_list_companies.
|
|
3123
|
-
* Three stages matching the post-restructure sales subdomain tree.
|
|
3124
|
-
*
|
|
3125
|
-
* Note: companies visit prospecting and qualification states depending on which
|
|
3126
|
-
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
3127
|
-
*/
|
|
3128
|
-
export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
3129
|
-
pipelineKey: 'lead-gen',
|
|
3130
|
-
label: 'Lead Generation',
|
|
3131
|
-
entityKey: 'acq.list-company',
|
|
3132
|
-
stages: [
|
|
3133
|
-
{
|
|
3134
|
-
stageKey: 'outreach',
|
|
3135
|
-
label: 'Outreach',
|
|
3136
|
-
states: [PENDING_STATE, { stateKey: 'uploaded', label: 'Uploaded' }]
|
|
3137
|
-
},
|
|
3138
|
-
{
|
|
3139
|
-
stageKey: 'prospecting',
|
|
3140
|
-
label: 'Prospecting',
|
|
3141
|
-
states: [
|
|
3142
|
-
PENDING_STATE,
|
|
3143
|
-
{ stateKey: 'populated', label: 'Populated' },
|
|
3144
|
-
{ stateKey: 'extracted', label: 'Extracted' }
|
|
3145
|
-
]
|
|
3146
|
-
},
|
|
3147
|
-
{
|
|
3148
|
-
stageKey: 'qualification',
|
|
3149
|
-
label: 'Qualification',
|
|
3150
|
-
states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
|
|
3151
|
-
}
|
|
3152
|
-
]
|
|
3153
|
-
}
|
|
3154
|
-
```
|
|
3155
|
-
|
|
3156
|
-
### `LEAD_GEN_PIPELINE_DEFINITIONS`
|
|
3157
|
-
|
|
3158
|
-
```typescript
|
|
3159
|
-
/**
|
|
3160
|
-
* All lead-gen pipeline definitions indexed by entity key.
|
|
3161
|
-
* Use findPipeline() to locate a definition by pipeline_key within any array.
|
|
3162
|
-
*/
|
|
3163
|
-
export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
|
|
3164
|
-
'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
|
|
3165
|
-
'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
|
|
3166
|
-
}
|
|
3167
|
-
```
|
|
3168
|
-
|
|
3169
3075
|
### `PaginationParams`
|
|
3170
3076
|
|
|
3171
3077
|
```typescript
|
|
@@ -1465,6 +1465,51 @@ export type Database = {
|
|
|
1465
1465
|
},
|
|
1466
1466
|
]
|
|
1467
1467
|
}
|
|
1468
|
+
deployment_organization_models: {
|
|
1469
|
+
Row: {
|
|
1470
|
+
created_at: string
|
|
1471
|
+
deployment_id: string
|
|
1472
|
+
model_hash: string | null
|
|
1473
|
+
organization_id: string
|
|
1474
|
+
organization_model: Json
|
|
1475
|
+
schema_version: string
|
|
1476
|
+
updated_at: string
|
|
1477
|
+
}
|
|
1478
|
+
Insert: {
|
|
1479
|
+
created_at?: string
|
|
1480
|
+
deployment_id: string
|
|
1481
|
+
model_hash?: string | null
|
|
1482
|
+
organization_id: string
|
|
1483
|
+
organization_model: Json
|
|
1484
|
+
schema_version?: string
|
|
1485
|
+
updated_at?: string
|
|
1486
|
+
}
|
|
1487
|
+
Update: {
|
|
1488
|
+
created_at?: string
|
|
1489
|
+
deployment_id?: string
|
|
1490
|
+
model_hash?: string | null
|
|
1491
|
+
organization_id?: string
|
|
1492
|
+
organization_model?: Json
|
|
1493
|
+
schema_version?: string
|
|
1494
|
+
updated_at?: string
|
|
1495
|
+
}
|
|
1496
|
+
Relationships: [
|
|
1497
|
+
{
|
|
1498
|
+
foreignKeyName: "deployment_organization_models_deployment_id_fkey"
|
|
1499
|
+
columns: ["deployment_id"]
|
|
1500
|
+
isOneToOne: true
|
|
1501
|
+
referencedRelation: "deployments"
|
|
1502
|
+
referencedColumns: ["id"]
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
foreignKeyName: "deployment_organization_models_organization_id_fkey"
|
|
1506
|
+
columns: ["organization_id"]
|
|
1507
|
+
isOneToOne: false
|
|
1508
|
+
referencedRelation: "organizations"
|
|
1509
|
+
referencedColumns: ["id"]
|
|
1510
|
+
},
|
|
1511
|
+
]
|
|
1512
|
+
}
|
|
1468
1513
|
deployments: {
|
|
1469
1514
|
Row: {
|
|
1470
1515
|
created_at: string
|