@elevasis/core 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +108 -0
- package/dist/index.js +177 -27
- package/dist/knowledge/index.d.ts +54 -0
- package/dist/organization-model/index.d.ts +108 -0
- package/dist/organization-model/index.js +177 -27
- package/dist/test-utils/index.d.ts +54 -0
- package/dist/test-utils/index.js +177 -27
- package/package.json +3 -3
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +6 -1
- package/src/business/acquisition/api-schemas.test.ts +25 -0
- package/src/business/acquisition/api-schemas.ts +125 -2
- package/src/business/acquisition/build-templates.test.ts +28 -0
- package/src/business/acquisition/build-templates.ts +20 -8
- package/src/business/acquisition/types.ts +6 -1
- package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.test.ts +55 -0
- package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.ts +107 -41
- package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.test.ts +48 -0
- package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.ts +99 -0
- package/src/execution/engine/tools/integration/server/adapters/apollo/index.ts +1 -0
- package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.test.ts +18 -0
- package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.ts +194 -0
- package/src/execution/engine/tools/integration/server/adapters/clickup/index.ts +7 -0
- package/src/integrations/credentials/api-schemas.ts +21 -2
- package/src/integrations/credentials/schemas.ts +200 -164
- package/src/organization-model/__tests__/prospecting-ssot.test.ts +7 -4
- package/src/organization-model/domains/prospecting.ts +182 -25
- package/src/organization-model/domains/sales.ts +24 -3
- package/src/platform/constants/versions.ts +1 -1
- package/src/reference/_generated/contracts.md +6 -1
- package/src/server.ts +2 -0
|
@@ -1,164 +1,200 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Credential field definition
|
|
5
|
-
*/
|
|
6
|
-
export interface CredentialField {
|
|
7
|
-
key: string
|
|
8
|
-
label: string
|
|
9
|
-
type: 'password' | 'text'
|
|
10
|
-
required: boolean
|
|
11
|
-
placeholder?: string
|
|
12
|
-
description?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Credential schema definition
|
|
17
|
-
*/
|
|
18
|
-
export interface CredentialSchema {
|
|
19
|
-
type: string
|
|
20
|
-
label: string
|
|
21
|
-
description: string
|
|
22
|
-
fields?: CredentialField[]
|
|
23
|
-
docsUrl?: string
|
|
24
|
-
nameSuggestions: string[]
|
|
25
|
-
oauthProvider?: string // For OAuth types
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Zod schemas for runtime validation
|
|
30
|
-
*/
|
|
31
|
-
const CredentialFieldSchema = z.object({
|
|
32
|
-
key: z.string(),
|
|
33
|
-
label: z.string(),
|
|
34
|
-
type: z.enum(['password', 'text']),
|
|
35
|
-
required: z.boolean(),
|
|
36
|
-
placeholder: z.string().optional(),
|
|
37
|
-
description: z.string().optional()
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
const CredentialSchemaZod = z.object({
|
|
41
|
-
type: z.string(),
|
|
42
|
-
label: z.string(),
|
|
43
|
-
description: z.string(),
|
|
44
|
-
fields: z.array(CredentialFieldSchema).optional(),
|
|
45
|
-
docsUrl: z.string().url().optional(),
|
|
46
|
-
nameSuggestions: z.array(z.string()),
|
|
47
|
-
oauthProvider: z.string().optional()
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Credential Schema Registry
|
|
52
|
-
*
|
|
53
|
-
* Add new integration = add schema object here (no modal changes needed)
|
|
54
|
-
*
|
|
55
|
-
* Schema types:
|
|
56
|
-
* - oauth: OAuth-based authentication (handled via OAuth flow)
|
|
57
|
-
* - single_field: Single API key field (generic)
|
|
58
|
-
*/
|
|
59
|
-
export const CREDENTIAL_SCHEMAS: Record<string, CredentialSchema> = {
|
|
60
|
-
'google-sheets': {
|
|
61
|
-
type: 'oauth',
|
|
62
|
-
label: 'Google Sheets',
|
|
63
|
-
description: 'Google Sheets OAuth integration',
|
|
64
|
-
oauthProvider: 'google-sheets',
|
|
65
|
-
nameSuggestions: ['google-sheets-prod', 'google-sheets-dev', 'sheets-workspace']
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
dropbox: {
|
|
69
|
-
type: 'oauth',
|
|
70
|
-
label: 'Dropbox',
|
|
71
|
-
description: 'Dropbox OAuth integration',
|
|
72
|
-
oauthProvider: 'dropbox',
|
|
73
|
-
nameSuggestions: ['dropbox-prod', 'dropbox-dev', 'elevasis-dropbox']
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
oauth: {
|
|
77
|
-
type: 'oauth',
|
|
78
|
-
label: 'OAuth',
|
|
79
|
-
description: 'Generic OAuth credential',
|
|
80
|
-
nameSuggestions: []
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
'api-key': {
|
|
84
|
-
type: 'single_field',
|
|
85
|
-
label: 'API Key',
|
|
86
|
-
description: 'Single-field API key credential',
|
|
87
|
-
fields: [
|
|
88
|
-
{
|
|
89
|
-
key: 'apiKey',
|
|
90
|
-
label: 'API Key',
|
|
91
|
-
type: 'password',
|
|
92
|
-
required: true,
|
|
93
|
-
placeholder: 'Enter your API key',
|
|
94
|
-
description: 'API key for the service'
|
|
95
|
-
}
|
|
96
|
-
],
|
|
97
|
-
nameSuggestions: ['service-prod', 'service-dev', 'api-key']
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
'webhook-secret': {
|
|
101
|
-
type: 'single_field',
|
|
102
|
-
label: 'Webhook Secret',
|
|
103
|
-
description: 'Webhook signing secret for signature validation',
|
|
104
|
-
fields: [
|
|
105
|
-
{
|
|
106
|
-
key: 'signingSecret',
|
|
107
|
-
label: 'Signing Secret',
|
|
108
|
-
type: 'password',
|
|
109
|
-
required: true,
|
|
110
|
-
placeholder: 'whsec_...',
|
|
111
|
-
description: 'Webhook signing secret from provider dashboard'
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
nameSuggestions: ['my-org-cal-com-webhook', 'my-org-stripe-webhook', 'my-org-signature-api-webhook']
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
'api-key-secret': {
|
|
118
|
-
type: 'api-key-secret',
|
|
119
|
-
label: 'API Key + Secret',
|
|
120
|
-
description: 'API key and secret pair authentication',
|
|
121
|
-
fields: [
|
|
122
|
-
{
|
|
123
|
-
key: 'apiKey',
|
|
124
|
-
label: 'API Key',
|
|
125
|
-
type: 'password',
|
|
126
|
-
required: true
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
key: 'apiSecret',
|
|
130
|
-
label: 'API Secret',
|
|
131
|
-
type: 'password',
|
|
132
|
-
required: true
|
|
133
|
-
}
|
|
134
|
-
],
|
|
135
|
-
nameSuggestions: []
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Credential field definition
|
|
5
|
+
*/
|
|
6
|
+
export interface CredentialField {
|
|
7
|
+
key: string
|
|
8
|
+
label: string
|
|
9
|
+
type: 'password' | 'text'
|
|
10
|
+
required: boolean
|
|
11
|
+
placeholder?: string
|
|
12
|
+
description?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Credential schema definition
|
|
17
|
+
*/
|
|
18
|
+
export interface CredentialSchema {
|
|
19
|
+
type: string
|
|
20
|
+
label: string
|
|
21
|
+
description: string
|
|
22
|
+
fields?: CredentialField[]
|
|
23
|
+
docsUrl?: string
|
|
24
|
+
nameSuggestions: string[]
|
|
25
|
+
oauthProvider?: string // For OAuth types
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Zod schemas for runtime validation
|
|
30
|
+
*/
|
|
31
|
+
const CredentialFieldSchema = z.object({
|
|
32
|
+
key: z.string(),
|
|
33
|
+
label: z.string(),
|
|
34
|
+
type: z.enum(['password', 'text']),
|
|
35
|
+
required: z.boolean(),
|
|
36
|
+
placeholder: z.string().optional(),
|
|
37
|
+
description: z.string().optional()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const CredentialSchemaZod = z.object({
|
|
41
|
+
type: z.string(),
|
|
42
|
+
label: z.string(),
|
|
43
|
+
description: z.string(),
|
|
44
|
+
fields: z.array(CredentialFieldSchema).optional(),
|
|
45
|
+
docsUrl: z.string().url().optional(),
|
|
46
|
+
nameSuggestions: z.array(z.string()),
|
|
47
|
+
oauthProvider: z.string().optional()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Credential Schema Registry
|
|
52
|
+
*
|
|
53
|
+
* Add new integration = add schema object here (no modal changes needed)
|
|
54
|
+
*
|
|
55
|
+
* Schema types:
|
|
56
|
+
* - oauth: OAuth-based authentication (handled via OAuth flow)
|
|
57
|
+
* - single_field: Single API key field (generic)
|
|
58
|
+
*/
|
|
59
|
+
export const CREDENTIAL_SCHEMAS: Record<string, CredentialSchema> = {
|
|
60
|
+
'google-sheets': {
|
|
61
|
+
type: 'oauth',
|
|
62
|
+
label: 'Google Sheets',
|
|
63
|
+
description: 'Google Sheets OAuth integration',
|
|
64
|
+
oauthProvider: 'google-sheets',
|
|
65
|
+
nameSuggestions: ['google-sheets-prod', 'google-sheets-dev', 'sheets-workspace']
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
dropbox: {
|
|
69
|
+
type: 'oauth',
|
|
70
|
+
label: 'Dropbox',
|
|
71
|
+
description: 'Dropbox OAuth integration',
|
|
72
|
+
oauthProvider: 'dropbox',
|
|
73
|
+
nameSuggestions: ['dropbox-prod', 'dropbox-dev', 'elevasis-dropbox']
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
oauth: {
|
|
77
|
+
type: 'oauth',
|
|
78
|
+
label: 'OAuth',
|
|
79
|
+
description: 'Generic OAuth credential',
|
|
80
|
+
nameSuggestions: []
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
'api-key': {
|
|
84
|
+
type: 'single_field',
|
|
85
|
+
label: 'API Key',
|
|
86
|
+
description: 'Single-field API key credential',
|
|
87
|
+
fields: [
|
|
88
|
+
{
|
|
89
|
+
key: 'apiKey',
|
|
90
|
+
label: 'API Key',
|
|
91
|
+
type: 'password',
|
|
92
|
+
required: true,
|
|
93
|
+
placeholder: 'Enter your API key',
|
|
94
|
+
description: 'API key for the service'
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
nameSuggestions: ['service-prod', 'service-dev', 'api-key']
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
'webhook-secret': {
|
|
101
|
+
type: 'single_field',
|
|
102
|
+
label: 'Webhook Secret',
|
|
103
|
+
description: 'Webhook signing secret for signature validation',
|
|
104
|
+
fields: [
|
|
105
|
+
{
|
|
106
|
+
key: 'signingSecret',
|
|
107
|
+
label: 'Signing Secret',
|
|
108
|
+
type: 'password',
|
|
109
|
+
required: true,
|
|
110
|
+
placeholder: 'whsec_...',
|
|
111
|
+
description: 'Webhook signing secret from provider dashboard'
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
nameSuggestions: ['my-org-cal-com-webhook', 'my-org-stripe-webhook', 'my-org-signature-api-webhook']
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
'api-key-secret': {
|
|
118
|
+
type: 'api-key-secret',
|
|
119
|
+
label: 'API Key + Secret',
|
|
120
|
+
description: 'API key and secret pair authentication',
|
|
121
|
+
fields: [
|
|
122
|
+
{
|
|
123
|
+
key: 'apiKey',
|
|
124
|
+
label: 'API Key',
|
|
125
|
+
type: 'password',
|
|
126
|
+
required: true
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
key: 'apiSecret',
|
|
130
|
+
label: 'API Secret',
|
|
131
|
+
type: 'password',
|
|
132
|
+
required: true
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
nameSuggestions: []
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
apify: {
|
|
139
|
+
type: 'single_field',
|
|
140
|
+
label: 'Apify',
|
|
141
|
+
description: 'Apify API token for running web-scraping actors (e.g. website crawl, Google Places scrape).',
|
|
142
|
+
fields: [
|
|
143
|
+
{
|
|
144
|
+
key: 'apiKey',
|
|
145
|
+
label: 'API Token',
|
|
146
|
+
type: 'password',
|
|
147
|
+
required: true,
|
|
148
|
+
placeholder: 'apify_api_...',
|
|
149
|
+
description: 'Personal API token from https://console.apify.com/account/integrations'
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
docsUrl: 'https://docs.apify.com/platform/integrations/api',
|
|
153
|
+
nameSuggestions: ['elevasis-apify', 'apify-prod', 'apify-dev']
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
clickup: {
|
|
157
|
+
type: 'single_field',
|
|
158
|
+
label: 'ClickUp',
|
|
159
|
+
description: 'ClickUp personal API token for creating tasks in tenant-managed ClickUp workspaces.',
|
|
160
|
+
fields: [
|
|
161
|
+
{
|
|
162
|
+
key: 'apiToken',
|
|
163
|
+
label: 'API Token',
|
|
164
|
+
type: 'password',
|
|
165
|
+
required: true,
|
|
166
|
+
placeholder: 'pk_...',
|
|
167
|
+
description: 'Personal API token from ClickUp settings. Personal tokens start with pk_.'
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
docsUrl: 'https://developer.clickup.com/docs/authentication',
|
|
171
|
+
nameSuggestions: ['clickup-demo', 'clickup-prod', 'clickup-dev']
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Get credential schema by type
|
|
177
|
+
* @param type - Credential type identifier
|
|
178
|
+
* @returns Validated credential schema
|
|
179
|
+
* @throws ZodError if schema is malformed
|
|
180
|
+
*/
|
|
181
|
+
export function getCredentialSchema(type: string): CredentialSchema {
|
|
182
|
+
const schema = CREDENTIAL_SCHEMAS[type] || CREDENTIAL_SCHEMAS['api-key']
|
|
183
|
+
return CredentialSchemaZod.parse(schema)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* List all available credential types (for frontend dropdown)
|
|
188
|
+
* @returns Array of credential schemas
|
|
189
|
+
*/
|
|
190
|
+
export function listCredentialSchemas(): CredentialSchema[] {
|
|
191
|
+
return Object.values(CREDENTIAL_SCHEMAS)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Get all credential type identifiers
|
|
196
|
+
* @returns Array of type strings
|
|
197
|
+
*/
|
|
198
|
+
export function getCredentialTypes(): string[] {
|
|
199
|
+
return Object.keys(CREDENTIAL_SCHEMAS)
|
|
200
|
+
}
|
|
@@ -5,6 +5,7 @@ import { CAPABILITY_REGISTRY, DEFAULT_ORGANIZATION_MODEL_PROSPECTING, PROSPECTIN
|
|
|
5
5
|
const EXPECTED_CAPABILITY_RESOURCE_BY_ID: Record<string, string> = {
|
|
6
6
|
'lead-gen.company.source': 'lgn-import-workflow',
|
|
7
7
|
'lead-gen.company.apollo-import': 'lgn-01c-apollo-import-workflow',
|
|
8
|
+
'lead-gen.company.apify-crawl': 'lgn-02a-apify-website-crawl-workflow',
|
|
8
9
|
'lead-gen.contact.discover': 'lgn-04-email-discovery-workflow',
|
|
9
10
|
'lead-gen.contact.verify-email': 'lgn-05-email-verification-workflow',
|
|
10
11
|
'lead-gen.company.website-extract': 'lgn-02-website-extract-workflow',
|
|
@@ -24,7 +25,9 @@ describe('prospecting organization-model SSOT', () => {
|
|
|
24
25
|
label: 'Decision-makers found',
|
|
25
26
|
description: 'Decision-maker contacts discovered and attached to a qualified company.',
|
|
26
27
|
order: 6,
|
|
27
|
-
entity: 'company'
|
|
28
|
+
entity: 'company',
|
|
29
|
+
recordEntity: 'contact',
|
|
30
|
+
recordStageKey: 'discovered'
|
|
28
31
|
})
|
|
29
32
|
})
|
|
30
33
|
|
|
@@ -63,12 +66,12 @@ describe('prospecting organization-model SSOT', () => {
|
|
|
63
66
|
|
|
64
67
|
it('derives prospecting lifecycle stages from the stage catalog by entity', () => {
|
|
65
68
|
const expectedCompanyStages = Object.values(LEAD_GEN_STAGE_CATALOG)
|
|
66
|
-
.filter((stage) => stage.entity === 'company')
|
|
69
|
+
.filter((stage) => stage.entity === 'company' || stage.additionalEntities?.includes('company'))
|
|
67
70
|
.sort((a, b) => a.order - b.order)
|
|
68
71
|
.map(({ key, label, order }) => ({ id: key, label, order }))
|
|
69
72
|
|
|
70
73
|
const expectedContactStages = Object.values(LEAD_GEN_STAGE_CATALOG)
|
|
71
|
-
.filter((stage) => stage.entity === 'contact')
|
|
74
|
+
.filter((stage) => stage.entity === 'contact' || stage.additionalEntities?.includes('contact'))
|
|
72
75
|
.sort((a, b) => a.order - b.order)
|
|
73
76
|
.map(({ key, label, order }) => ({ id: key, label, order }))
|
|
74
77
|
|
|
@@ -84,7 +87,7 @@ describe('prospecting organization-model SSOT', () => {
|
|
|
84
87
|
})
|
|
85
88
|
|
|
86
89
|
it('covers all known lead-gen capability registry entries', () => {
|
|
87
|
-
expect(CAPABILITY_REGISTRY).toHaveLength(
|
|
90
|
+
expect(CAPABILITY_REGISTRY).toHaveLength(13)
|
|
88
91
|
const actualResourceById = Object.fromEntries(CAPABILITY_REGISTRY.map((c) => [c.id, c.resourceId]))
|
|
89
92
|
expect(actualResourceById).toEqual(EXPECTED_CAPABILITY_RESOURCE_BY_ID)
|
|
90
93
|
})
|