@elevasis/core 0.23.0 → 0.24.1
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 +4343 -2690
- package/dist/index.js +1101 -156
- package/dist/knowledge/index.d.ts +574 -210
- package/dist/knowledge/index.js +104 -1
- package/dist/organization-model/index.d.ts +4343 -2690
- package/dist/organization-model/index.js +1101 -156
- package/dist/test-utils/index.d.ts +483 -109
- package/dist/test-utils/index.js +904 -144
- package/package.json +3 -3
- package/src/README.md +14 -14
- package/src/__tests__/publish.test.ts +24 -24
- package/src/__tests__/template-core-compatibility.test.ts +9 -12
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +2137 -2093
- package/src/_gen/__tests__/scaffold-contracts.test.ts +30 -30
- package/src/auth/multi-tenancy/credentials/__tests__/encryption.test.ts +217 -217
- package/src/auth/multi-tenancy/credentials/server/encryption.ts +69 -69
- package/src/auth/multi-tenancy/credentials/server/kek-loader.ts +37 -37
- package/src/auth/multi-tenancy/index.ts +26 -26
- package/src/auth/multi-tenancy/invitations/api-schemas.ts +104 -104
- package/src/auth/multi-tenancy/memberships/api-schemas.ts +143 -143
- package/src/auth/multi-tenancy/memberships/index.ts +26 -26
- package/src/auth/multi-tenancy/memberships/membership.ts +130 -130
- package/src/auth/multi-tenancy/organizations/__tests__/api-schemas.test.ts +194 -194
- package/src/auth/multi-tenancy/organizations/api-schemas.ts +136 -136
- package/src/auth/multi-tenancy/permissions.test.ts +42 -42
- package/src/auth/multi-tenancy/permissions.ts +123 -123
- package/src/auth/multi-tenancy/role-management/api-schemas.ts +78 -78
- package/src/auth/multi-tenancy/role-management/index.ts +16 -16
- package/src/auth/multi-tenancy/theme-presets.ts +45 -45
- package/src/auth/multi-tenancy/types.ts +57 -57
- package/src/auth/multi-tenancy/users/api-schemas.ts +165 -165
- package/src/business/README.md +2 -2
- package/src/business/acquisition/activity-events.test.ts +250 -250
- package/src/business/acquisition/activity-events.ts +93 -93
- package/src/business/acquisition/api-schemas.test.ts +1883 -1843
- package/src/business/acquisition/api-schemas.ts +1492 -1497
- package/src/business/acquisition/build-templates.test.ts +240 -240
- package/src/business/acquisition/build-templates.ts +98 -98
- package/src/business/acquisition/crm-next-action.test.ts +262 -262
- package/src/business/acquisition/crm-next-action.ts +220 -220
- package/src/business/acquisition/crm-priority.test.ts +216 -216
- package/src/business/acquisition/crm-priority.ts +349 -349
- package/src/business/acquisition/crm-state-actions.test.ts +153 -153
- package/src/business/acquisition/deal-ownership.test.ts +351 -351
- package/src/business/acquisition/deal-ownership.ts +120 -120
- package/src/business/acquisition/derive-actions.test.ts +129 -104
- package/src/business/acquisition/derive-actions.ts +74 -84
- package/src/business/acquisition/index.ts +171 -170
- package/src/business/acquisition/ontology-validation.ts +309 -0
- package/src/business/acquisition/stateful.ts +30 -30
- package/src/business/acquisition/types.ts +396 -396
- package/src/business/clients/api-schemas.test.ts +115 -115
- package/src/business/clients/api-schemas.ts +158 -158
- package/src/business/clients/index.ts +1 -1
- package/src/business/crm/api-schemas.ts +40 -40
- package/src/business/crm/index.ts +1 -1
- package/src/business/deals/api-schemas.ts +87 -87
- package/src/business/deals/index.ts +1 -1
- package/src/business/index.ts +5 -5
- package/src/business/projects/types.ts +144 -144
- package/src/commands/queue/types/task.ts +15 -15
- package/src/execution/core/runner-types.ts +61 -61
- package/src/execution/core/sse-executions.ts +7 -7
- package/src/execution/engine/__tests__/fixtures/test-agents.ts +10 -10
- package/src/execution/engine/agent/core/__tests__/agent.test.ts +16 -16
- package/src/execution/engine/agent/core/__tests__/error-passthrough.test.ts +4 -4
- package/src/execution/engine/agent/core/types.ts +25 -25
- package/src/execution/engine/agent/index.ts +6 -6
- package/src/execution/engine/agent/reasoning/__tests__/request-builder.test.ts +24 -24
- package/src/execution/engine/index.ts +443 -443
- package/src/execution/engine/tools/integration/server/adapters/apify/__tests__/apify-run-actor.integration.test.ts +298 -298
- package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.test.ts +55 -55
- package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.ts +107 -107
- package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.test.ts +48 -48
- package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.ts +99 -99
- package/src/execution/engine/tools/integration/server/adapters/apollo/index.ts +1 -1
- package/src/execution/engine/tools/integration/server/adapters/attio/__tests__/attio-crud.integration.test.ts +363 -363
- package/src/execution/engine/tools/integration/server/adapters/attio/fetch/get-record/index.test.ts +162 -162
- package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-records/index.test.ts +316 -316
- package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.test.ts +18 -18
- package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.ts +194 -194
- package/src/execution/engine/tools/integration/server/adapters/clickup/index.ts +7 -7
- package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-adapter.ts +204 -204
- package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +105 -105
- package/src/execution/engine/tools/integration/server/adapters/google-calendar/google-calendar-adapter.ts +428 -428
- package/src/execution/engine/tools/integration/server/adapters/google-calendar/index.ts +2 -2
- package/src/execution/engine/tools/integration/server/adapters/google-sheets/__tests__/google-sheets.integration.test.ts +261 -261
- package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1474 -1474
- package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +103 -103
- package/src/execution/engine/tools/integration/server/adapters/resend/fetch/send-email/index.test.ts +88 -88
- package/src/execution/engine/tools/integration/server/adapters/resend/fetch/send-email/index.ts +141 -141
- package/src/execution/engine/tools/integration/server/adapters/resend/fetch/utils/types.ts +76 -76
- package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts +182 -182
- package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +310 -310
- package/src/execution/engine/tools/integration/service.test.ts +239 -239
- package/src/execution/engine/tools/integration/service.ts +172 -172
- package/src/execution/engine/tools/integration/tool.ts +255 -255
- package/src/execution/engine/tools/lead-service-types.ts +1005 -1005
- package/src/execution/engine/tools/messages.ts +43 -43
- package/src/execution/engine/tools/platform/acquisition/company-tools.ts +7 -7
- package/src/execution/engine/tools/platform/acquisition/contact-tools.ts +6 -6
- package/src/execution/engine/tools/platform/acquisition/list-tools.ts +6 -6
- package/src/execution/engine/tools/platform/acquisition/types.ts +280 -280
- package/src/execution/engine/tools/platform/email/types.ts +97 -97
- package/src/execution/engine/tools/registry.ts +704 -704
- package/src/execution/engine/tools/tool-maps.ts +831 -831
- package/src/execution/engine/tools/types.ts +234 -234
- package/src/execution/engine/workflow/types.ts +195 -197
- package/src/execution/external/__tests__/api-schemas.test.ts +127 -127
- package/src/execution/external/api-schemas.ts +40 -40
- package/src/execution/external/index.ts +1 -1
- package/src/index.ts +18 -18
- package/src/integrations/credentials/__tests__/api-schemas.test.ts +420 -420
- package/src/integrations/credentials/api-schemas.ts +146 -146
- package/src/integrations/credentials/schemas.ts +200 -200
- package/src/integrations/oauth/__tests__/provider-registry.test.ts +7 -7
- package/src/integrations/oauth/provider-registry.ts +74 -74
- package/src/integrations/oauth/server/credentials.ts +43 -43
- package/src/integrations/webhook-endpoints/__tests__/api-schemas.test.ts +327 -327
- package/src/integrations/webhook-endpoints/api-schemas.ts +103 -103
- package/src/integrations/webhook-endpoints/types.ts +58 -58
- package/src/knowledge/README.md +32 -32
- package/src/knowledge/__tests__/queries.test.ts +626 -535
- package/src/knowledge/format.ts +99 -99
- package/src/knowledge/index.ts +5 -5
- package/src/knowledge/published.ts +5 -5
- package/src/knowledge/queries.ts +269 -218
- package/src/operations/activities/api-schemas.ts +80 -80
- package/src/operations/activities/types.ts +64 -64
- package/src/organization-model/README.md +149 -149
- package/src/organization-model/__tests__/content-kinds-registry.test.ts +210 -210
- package/src/organization-model/__tests__/defaults.test.ts +168 -168
- package/src/organization-model/__tests__/domains/actions.test.ts +78 -56
- package/src/organization-model/__tests__/domains/customers.test.ts +299 -299
- package/src/organization-model/__tests__/domains/entities.test.ts +56 -56
- package/src/organization-model/__tests__/domains/goals.test.ts +493 -493
- package/src/organization-model/__tests__/domains/identity.test.ts +280 -280
- package/src/organization-model/__tests__/domains/navigation.test.ts +268 -268
- package/src/organization-model/__tests__/domains/offerings.test.ts +414 -414
- package/src/organization-model/__tests__/domains/policies.test.ts +323 -323
- package/src/organization-model/__tests__/domains/resource-mappings.test.ts +293 -293
- package/src/organization-model/__tests__/domains/resources.test.ts +387 -277
- package/src/organization-model/__tests__/domains/roles.test.ts +463 -463
- package/src/organization-model/__tests__/domains/statuses.test.ts +246 -246
- package/src/organization-model/__tests__/domains/systems.test.ts +209 -209
- package/src/organization-model/__tests__/domains/topology.test.ts +188 -0
- package/src/organization-model/__tests__/flatten-additive-merge.test.ts +362 -361
- package/src/organization-model/__tests__/foundation.test.ts +77 -77
- package/src/organization-model/__tests__/get-resources-for-system.test.ts +144 -144
- package/src/organization-model/__tests__/graph.test.ts +1312 -862
- package/src/organization-model/__tests__/icons.test.ts +10 -1
- package/src/organization-model/__tests__/knowledge.test.ts +251 -15
- package/src/organization-model/__tests__/lookup-helpers.test.ts +438 -438
- package/src/organization-model/__tests__/migration-helpers.test.ts +591 -591
- package/src/organization-model/__tests__/prospecting-ssot.test.ts +103 -103
- package/src/organization-model/__tests__/recursive-system-schema.test.ts +535 -506
- package/src/organization-model/__tests__/resolve.test.ts +274 -164
- package/src/organization-model/__tests__/schema.test.ts +844 -301
- package/src/organization-model/__tests__/surface-projection.test.ts +284 -284
- package/src/organization-model/catalogs/lead-gen.ts +144 -144
- package/src/organization-model/content-kinds/config.ts +36 -36
- package/src/organization-model/content-kinds/index.ts +76 -72
- package/src/organization-model/content-kinds/pipeline.ts +68 -68
- package/src/organization-model/content-kinds/registry.ts +44 -44
- package/src/organization-model/content-kinds/status.ts +71 -71
- package/src/organization-model/content-kinds/template.ts +83 -83
- package/src/organization-model/content-kinds/types.ts +117 -117
- package/src/organization-model/contracts.ts +27 -27
- package/src/organization-model/defaults.ts +42 -50
- package/src/organization-model/domains/actions.ts +333 -239
- package/src/organization-model/domains/customers.ts +78 -78
- package/src/organization-model/domains/entities.ts +144 -144
- package/src/organization-model/domains/goals.ts +83 -83
- package/src/organization-model/domains/knowledge.ts +117 -101
- package/src/organization-model/domains/navigation.ts +139 -139
- package/src/organization-model/domains/offerings.ts +71 -71
- package/src/organization-model/domains/policies.ts +102 -102
- package/src/organization-model/domains/projects.ts +14 -14
- package/src/organization-model/domains/prospecting.ts +395 -395
- package/src/organization-model/domains/resources.ts +202 -124
- package/src/organization-model/domains/roles.ts +96 -96
- package/src/organization-model/domains/sales.test.ts +218 -218
- package/src/organization-model/domains/sales.ts +380 -380
- package/src/organization-model/domains/shared.ts +63 -63
- package/src/organization-model/domains/statuses.ts +339 -339
- package/src/organization-model/domains/systems.ts +217 -172
- package/src/organization-model/domains/topology.ts +261 -0
- package/src/organization-model/foundation.ts +75 -75
- package/src/organization-model/graph/build.ts +1043 -867
- package/src/organization-model/graph/index.ts +4 -4
- package/src/organization-model/graph/link.ts +10 -10
- package/src/organization-model/graph/schema.ts +75 -68
- package/src/organization-model/graph/types.ts +71 -64
- package/src/organization-model/helpers.ts +289 -241
- package/src/organization-model/icons.ts +78 -66
- package/src/organization-model/index.ts +128 -125
- package/src/organization-model/migration-helpers.ts +247 -244
- package/src/organization-model/ontology.ts +658 -0
- package/src/organization-model/organization-graph.mdx +110 -90
- package/src/organization-model/organization-model.mdx +225 -213
- package/src/organization-model/published.ts +299 -222
- package/src/organization-model/resolve.ts +146 -91
- package/src/organization-model/schema.ts +818 -659
- package/src/organization-model/surface-projection.ts +212 -212
- package/src/organization-model/types.ts +179 -155
- package/src/platform/api/types.ts +38 -38
- package/src/platform/constants/versions.ts +3 -3
- package/src/platform/index.ts +23 -23
- package/src/platform/registry/__tests__/command-view.test.ts +10 -10
- package/src/platform/registry/__tests__/resource-link.test.ts +35 -35
- package/src/platform/registry/__tests__/resource-registry.integration.test.ts +20 -20
- package/src/platform/registry/__tests__/resource-registry.nested-systems.test.ts +245 -245
- package/src/platform/registry/__tests__/resource-registry.test.ts +2053 -2053
- package/src/platform/registry/__tests__/validation.test.ts +1444 -1259
- package/src/platform/registry/command-view.ts +10 -10
- package/src/platform/registry/index.ts +103 -103
- package/src/platform/registry/resource-link.ts +32 -32
- package/src/platform/registry/resource-registry.ts +886 -886
- package/src/platform/registry/serialization.ts +295 -295
- package/src/platform/registry/serialized-types.ts +166 -166
- package/src/platform/registry/stats-types.ts +68 -68
- package/src/platform/registry/types.ts +425 -425
- package/src/platform/registry/validation.ts +876 -684
- package/src/platform/utils/__tests__/validation.test.ts +1084 -1084
- package/src/platform/utils/validation.ts +425 -425
- package/src/projects/api-schemas.test.ts +39 -39
- package/src/projects/api-schemas.ts +291 -291
- package/src/reference/_generated/contracts.md +2136 -2093
- package/src/reference/glossary.md +76 -76
- package/src/scaffold-registry/__tests__/index.test.ts +206 -206
- package/src/scaffold-registry/__tests__/schema.test.ts +166 -166
- package/src/scaffold-registry/index.ts +392 -392
- package/src/scaffold-registry/schema.ts +243 -243
- package/src/server.ts +289 -289
- package/src/supabase/database.types.ts +3 -0
- package/src/test-utils/README.md +37 -37
- package/src/test-utils/entities.ts +108 -108
- package/src/test-utils/fixtures/memberships.ts +82 -82
- package/src/test-utils/index.ts +12 -12
- package/src/test-utils/organization-model.ts +65 -65
- package/src/test-utils/published.ts +6 -6
- package/src/test-utils/rls/RLSTestContext.ts +588 -588
- package/src/test-utils/test-utils.test.ts +44 -44
|
@@ -255,6 +255,12 @@ export type OrganizationModelObjective = z.infer<typeof ObjectiveSchema>
|
|
|
255
255
|
export type OrganizationModelKeyResult = z.infer<typeof KeyResultSchema>
|
|
256
256
|
```
|
|
257
257
|
|
|
258
|
+
### `OrganizationModelOntology`
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
export type OrganizationModelOntology = z.infer<typeof OntologyScopeSchema>
|
|
262
|
+
```
|
|
263
|
+
|
|
258
264
|
### `OrganizationModelSystems`
|
|
259
265
|
|
|
260
266
|
```typescript
|
|
@@ -267,6 +273,12 @@ export type OrganizationModelSystems = z.infer<typeof SystemsDomainSchema>
|
|
|
267
273
|
export type OrganizationModelSystemEntry = z.infer<typeof SystemEntrySchema>
|
|
268
274
|
```
|
|
269
275
|
|
|
276
|
+
### `OrganizationModelSystemConfig`
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
export type OrganizationModelSystemConfig = z.infer<typeof SystemConfigSchema>
|
|
280
|
+
```
|
|
281
|
+
|
|
270
282
|
### `OrganizationModelSystemId`
|
|
271
283
|
|
|
272
284
|
```typescript
|
|
@@ -294,7 +306,7 @@ export type OrganizationModelSystemLifecycle = z.infer<typeof SystemLifecycleSch
|
|
|
294
306
|
### `OrganizationModelSystemStatus`
|
|
295
307
|
|
|
296
308
|
```typescript
|
|
297
|
-
/** @deprecated Use OrganizationModelSystemLifecycle. Accepted for one publish cycle. */
|
|
309
|
+
/** @deprecated Use OrganizationModelSystemLifecycle. Accepted for one publish cycle. */
|
|
298
310
|
export type OrganizationModelSystemStatus = z.infer<typeof SystemStatusSchema>
|
|
299
311
|
```
|
|
300
312
|
|
|
@@ -316,6 +328,18 @@ export type OrganizationModelResourceEntry = z.infer<typeof ResourceEntrySchema>
|
|
|
316
328
|
export type OrganizationModelResourceId = z.infer<typeof ResourceIdSchema>
|
|
317
329
|
```
|
|
318
330
|
|
|
331
|
+
### `OrganizationModelCodeReference`
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
export type OrganizationModelCodeReference = z.infer<typeof CodeReferenceSchema>
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### `OrganizationModelCodeReferenceRole`
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
export type OrganizationModelCodeReferenceRole = z.infer<typeof CodeReferenceRoleSchema>
|
|
341
|
+
```
|
|
342
|
+
|
|
319
343
|
### `EventId`
|
|
320
344
|
|
|
321
345
|
```typescript
|
|
@@ -346,6 +370,12 @@ export type OrganizationModelResourceKind = z.infer<typeof ResourceKindSchema>
|
|
|
346
370
|
export type OrganizationModelResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>
|
|
347
371
|
```
|
|
348
372
|
|
|
373
|
+
### `OrganizationModelResourceOntologyBinding`
|
|
374
|
+
|
|
375
|
+
```typescript
|
|
376
|
+
export type OrganizationModelResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>
|
|
377
|
+
```
|
|
378
|
+
|
|
349
379
|
### `OrganizationModelAgentKind`
|
|
350
380
|
|
|
351
381
|
```typescript
|
|
@@ -388,6 +418,42 @@ export type OrganizationModelIntegrationResourceEntry = z.infer<typeof Integrati
|
|
|
388
418
|
export type OrganizationModelScriptResourceEntry = z.infer<typeof ScriptResourceEntrySchema>
|
|
389
419
|
```
|
|
390
420
|
|
|
421
|
+
### `OrganizationModelTopology`
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
export type OrganizationModelTopology = z.infer<typeof OmTopologyDomainSchema>
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### `OrganizationModelTopologyNodeKind`
|
|
428
|
+
|
|
429
|
+
```typescript
|
|
430
|
+
export type OrganizationModelTopologyNodeKind = z.infer<typeof OmTopologyNodeKindSchema>
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### `OrganizationModelTopologyNodeRef`
|
|
434
|
+
|
|
435
|
+
```typescript
|
|
436
|
+
export type OrganizationModelTopologyNodeRef = z.infer<typeof OmTopologyNodeRefSchema>
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### `OrganizationModelTopologyRelationshipKind`
|
|
440
|
+
|
|
441
|
+
```typescript
|
|
442
|
+
export type OrganizationModelTopologyRelationshipKind = z.infer<typeof OmTopologyRelationshipKindSchema>
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### `OrganizationModelTopologyRelationship`
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
export type OrganizationModelTopologyRelationship = z.infer<typeof OmTopologyRelationshipSchema>
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### `OrganizationModelTopologyMetadata`
|
|
452
|
+
|
|
453
|
+
```typescript
|
|
454
|
+
export type OrganizationModelTopologyMetadata = z.infer<typeof OmTopologyMetadataSchema>
|
|
455
|
+
```
|
|
456
|
+
|
|
391
457
|
### `OrganizationModelActions`
|
|
392
458
|
|
|
393
459
|
```typescript
|
|
@@ -559,7 +625,7 @@ export type OrganizationModelBuiltinIconToken = z.infer<typeof OrganizationModel
|
|
|
559
625
|
### `DeepPartial`
|
|
560
626
|
|
|
561
627
|
```typescript
|
|
562
|
-
export type DeepPartial<T> =
|
|
628
|
+
export type DeepPartial<T> =
|
|
563
629
|
T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T
|
|
564
630
|
```
|
|
565
631
|
|
|
@@ -568,8 +634,8 @@ export type DeepPartial<T> =
|
|
|
568
634
|
### `ElevasisOrganizationModel`
|
|
569
635
|
|
|
570
636
|
```typescript
|
|
571
|
-
export type ElevasisOrganizationModel = Omit<OrganizationModel, 'knowledge'> & {
|
|
572
|
-
knowledge?: OrganizationModel['knowledge']
|
|
637
|
+
export type ElevasisOrganizationModel = Omit<OrganizationModel, 'knowledge'> & {
|
|
638
|
+
knowledge?: OrganizationModel['knowledge']
|
|
573
639
|
}
|
|
574
640
|
```
|
|
575
641
|
|
|
@@ -594,107 +660,107 @@ export type SystemSidebarWidthResolver = number | ((context: { currentPath: stri
|
|
|
594
660
|
### `SystemModule`
|
|
595
661
|
|
|
596
662
|
```typescript
|
|
597
|
-
export interface SystemModule {
|
|
598
|
-
/** Unique stable identifier for this UI system module. */
|
|
599
|
-
key: string
|
|
600
|
-
/** Organization Model system id this module presents. Omit for navigation-only app surfaces. */
|
|
601
|
-
systemId?: string
|
|
602
|
-
/** Route prefixes owned by navigation-only app surfaces. */
|
|
603
|
-
routePrefixes?: string[]
|
|
604
|
-
/** Capability identifiers contributed by this system module. */
|
|
605
|
-
capabilityIds?: string[]
|
|
606
|
-
/** Icon used when this system node appears in shell navigation. */
|
|
607
|
-
icon?: SystemIconComponent
|
|
608
|
-
/** Sidebar component rendered when this system's subtree route is active. */
|
|
609
|
-
sidebar?: SystemSidebarComponent
|
|
610
|
-
/** Optional shell sidebar width override. Defaults to 250px. */
|
|
611
|
-
sidebarWidth?: SystemSidebarWidthResolver
|
|
612
|
-
/** Operations-only bridge connecting this system to the organization graph node. */
|
|
613
|
-
organizationGraph?: OrganizationGraphSystemBridge
|
|
663
|
+
export interface SystemModule {
|
|
664
|
+
/** Unique stable identifier for this UI system module. */
|
|
665
|
+
key: string
|
|
666
|
+
/** Organization Model system id this module presents. Omit for navigation-only app surfaces. */
|
|
667
|
+
systemId?: string
|
|
668
|
+
/** Route prefixes owned by navigation-only app surfaces. */
|
|
669
|
+
routePrefixes?: string[]
|
|
670
|
+
/** Capability identifiers contributed by this system module. */
|
|
671
|
+
capabilityIds?: string[]
|
|
672
|
+
/** Icon used when this system node appears in shell navigation. */
|
|
673
|
+
icon?: SystemIconComponent
|
|
674
|
+
/** Sidebar component rendered when this system's subtree route is active. */
|
|
675
|
+
sidebar?: SystemSidebarComponent
|
|
676
|
+
/** Optional shell sidebar width override. Defaults to 250px. */
|
|
677
|
+
sidebarWidth?: SystemSidebarWidthResolver
|
|
678
|
+
/** Operations-only bridge connecting this system to the organization graph node. */
|
|
679
|
+
organizationGraph?: OrganizationGraphSystemBridge
|
|
614
680
|
}
|
|
615
681
|
```
|
|
616
682
|
|
|
617
683
|
### `ResolvedSystemAccess`
|
|
618
684
|
|
|
619
685
|
```typescript
|
|
620
|
-
export interface ResolvedSystemAccess {
|
|
621
|
-
featureKey: string
|
|
622
|
-
systemId?: string
|
|
623
|
-
enabled: boolean
|
|
686
|
+
export interface ResolvedSystemAccess {
|
|
687
|
+
featureKey: string
|
|
688
|
+
systemId?: string
|
|
689
|
+
enabled: boolean
|
|
624
690
|
}
|
|
625
691
|
```
|
|
626
692
|
|
|
627
693
|
### `ResolvedSystemSemantics`
|
|
628
694
|
|
|
629
695
|
```typescript
|
|
630
|
-
export interface ResolvedSystemSemantics {
|
|
631
|
-
capabilityIds: string[]
|
|
696
|
+
export interface ResolvedSystemSemantics {
|
|
697
|
+
capabilityIds: string[]
|
|
632
698
|
}
|
|
633
699
|
```
|
|
634
700
|
|
|
635
701
|
### `ResolvedSystemModule`
|
|
636
702
|
|
|
637
703
|
```typescript
|
|
638
|
-
export interface ResolvedSystemModule extends SystemModule {
|
|
639
|
-
access: ResolvedSystemAccess
|
|
640
|
-
semantics: ResolvedSystemSemantics
|
|
704
|
+
export interface ResolvedSystemModule extends SystemModule {
|
|
705
|
+
access: ResolvedSystemAccess
|
|
706
|
+
semantics: ResolvedSystemSemantics
|
|
641
707
|
}
|
|
642
708
|
```
|
|
643
709
|
|
|
644
710
|
### `ResolvedShellSystem`
|
|
645
711
|
|
|
646
712
|
```typescript
|
|
647
|
-
export type ResolvedShellSystem = OrganizationModelSystemEntry & {
|
|
648
|
-
label: string
|
|
649
|
-
iconComponent?: SystemIconComponent
|
|
713
|
+
export type ResolvedShellSystem = OrganizationModelSystemEntry & {
|
|
714
|
+
label: string
|
|
715
|
+
iconComponent?: SystemIconComponent
|
|
650
716
|
}
|
|
651
717
|
```
|
|
652
718
|
|
|
653
719
|
### `ResolvedShellModel`
|
|
654
720
|
|
|
655
721
|
```typescript
|
|
656
|
-
export interface ResolvedShellModel {
|
|
657
|
-
systems: readonly ResolvedShellSystem[]
|
|
658
|
-
findByPath: (path: string) => ResolvedShellSystem | undefined
|
|
659
|
-
findById: (id: string) => ResolvedShellSystem | undefined
|
|
660
|
-
childrenOf: (id: string) => ResolvedShellSystem[]
|
|
661
|
-
ancestorsOf: (id: string) => ResolvedShellSystem[]
|
|
662
|
-
parentOf: (id: string) => ResolvedShellSystem | undefined
|
|
663
|
-
topLevel: () => ResolvedShellSystem[]
|
|
664
|
-
requiresAdminFor: (id: string) => boolean
|
|
665
|
-
devOnlyFor: (id: string) => boolean
|
|
722
|
+
export interface ResolvedShellModel {
|
|
723
|
+
systems: readonly ResolvedShellSystem[]
|
|
724
|
+
findByPath: (path: string) => ResolvedShellSystem | undefined
|
|
725
|
+
findById: (id: string) => ResolvedShellSystem | undefined
|
|
726
|
+
childrenOf: (id: string) => ResolvedShellSystem[]
|
|
727
|
+
ancestorsOf: (id: string) => ResolvedShellSystem[]
|
|
728
|
+
parentOf: (id: string) => ResolvedShellSystem | undefined
|
|
729
|
+
topLevel: () => ResolvedShellSystem[]
|
|
730
|
+
requiresAdminFor: (id: string) => boolean
|
|
731
|
+
devOnlyFor: (id: string) => boolean
|
|
666
732
|
}
|
|
667
733
|
```
|
|
668
734
|
|
|
669
735
|
### `ShellSidebarLinkItem`
|
|
670
736
|
|
|
671
737
|
```typescript
|
|
672
|
-
export interface ShellSidebarLinkItem {
|
|
673
|
-
label: string
|
|
674
|
-
link: string
|
|
675
|
-
exact?: boolean
|
|
676
|
-
activeMatchPaths?: string[]
|
|
738
|
+
export interface ShellSidebarLinkItem {
|
|
739
|
+
label: string
|
|
740
|
+
link: string
|
|
741
|
+
exact?: boolean
|
|
742
|
+
activeMatchPaths?: string[]
|
|
677
743
|
}
|
|
678
744
|
```
|
|
679
745
|
|
|
680
746
|
### `ShellSidebarLinkGroup`
|
|
681
747
|
|
|
682
748
|
```typescript
|
|
683
|
-
export interface ShellSidebarLinkGroup {
|
|
684
|
-
icon: SystemIconComponent
|
|
685
|
-
label: string
|
|
686
|
-
links?: ShellSidebarLinkItem[]
|
|
687
|
-
link?: string
|
|
749
|
+
export interface ShellSidebarLinkGroup {
|
|
750
|
+
icon: SystemIconComponent
|
|
751
|
+
label: string
|
|
752
|
+
links?: ShellSidebarLinkItem[]
|
|
753
|
+
link?: string
|
|
688
754
|
}
|
|
689
755
|
```
|
|
690
756
|
|
|
691
757
|
### `ShellSidebarProjectionOptions`
|
|
692
758
|
|
|
693
759
|
```typescript
|
|
694
|
-
export interface ShellSidebarProjectionOptions {
|
|
695
|
-
isPlatformAdmin?: boolean
|
|
696
|
-
isDev?: boolean
|
|
697
|
-
section?: 'primary' | 'bottom'
|
|
760
|
+
export interface ShellSidebarProjectionOptions {
|
|
761
|
+
isPlatformAdmin?: boolean
|
|
762
|
+
isDev?: boolean
|
|
763
|
+
section?: 'primary' | 'bottom'
|
|
698
764
|
}
|
|
699
765
|
```
|
|
700
766
|
|
|
@@ -707,75 +773,75 @@ export type ShellRouteMatchStatus = 'matched' | 'hidden' | 'unmatched'
|
|
|
707
773
|
### `ResolvedShellRouteMatch`
|
|
708
774
|
|
|
709
775
|
```typescript
|
|
710
|
-
export interface ResolvedShellRouteMatch {
|
|
711
|
-
status: ShellRouteMatchStatus
|
|
712
|
-
path: string
|
|
713
|
-
system?: ResolvedSystemModule
|
|
714
|
-
node?: ResolvedShellSystem
|
|
776
|
+
export interface ResolvedShellRouteMatch {
|
|
777
|
+
status: ShellRouteMatchStatus
|
|
778
|
+
path: string
|
|
779
|
+
system?: ResolvedSystemModule
|
|
780
|
+
node?: ResolvedShellSystem
|
|
715
781
|
}
|
|
716
782
|
```
|
|
717
783
|
|
|
718
784
|
### `ShellRuntime`
|
|
719
785
|
|
|
720
786
|
```typescript
|
|
721
|
-
export interface ShellRuntime {
|
|
722
|
-
resolveRoute: (path: string) => ResolvedShellRouteMatch
|
|
787
|
+
export interface ShellRuntime {
|
|
788
|
+
resolveRoute: (path: string) => ResolvedShellRouteMatch
|
|
723
789
|
}
|
|
724
790
|
```
|
|
725
791
|
|
|
726
792
|
### `OrganizationGraphSystemBridge`
|
|
727
793
|
|
|
728
794
|
```typescript
|
|
729
|
-
export interface OrganizationGraphSystemBridge {
|
|
730
|
-
systemId?: string
|
|
795
|
+
export interface OrganizationGraphSystemBridge {
|
|
796
|
+
systemId?: string
|
|
731
797
|
}
|
|
732
798
|
```
|
|
733
799
|
|
|
734
800
|
### `OrganizationGraphContextValue`
|
|
735
801
|
|
|
736
802
|
```typescript
|
|
737
|
-
export interface OrganizationGraphContextValue {
|
|
738
|
-
available: boolean
|
|
739
|
-
systemId?: string
|
|
740
|
-
systemPath?: string
|
|
803
|
+
export interface OrganizationGraphContextValue {
|
|
804
|
+
available: boolean
|
|
805
|
+
systemId?: string
|
|
806
|
+
systemPath?: string
|
|
741
807
|
}
|
|
742
808
|
```
|
|
743
809
|
|
|
744
810
|
### `ElevasisSystemsProviderProps`
|
|
745
811
|
|
|
746
812
|
```typescript
|
|
747
|
-
export interface ElevasisSystemsProviderProps {
|
|
748
|
-
systems?: SystemModule[]
|
|
749
|
-
organizationModel?: ElevasisOrganizationModel
|
|
750
|
-
timeRange?: TimeRange
|
|
751
|
-
operationsApiUrl?: string
|
|
752
|
-
operationsSSEManager?: SSEConnectionManagerLike
|
|
753
|
-
deliveryApiUrl?: string
|
|
754
|
-
deliverySSEManager?: SSEConnectionManagerLike
|
|
755
|
-
disabledSubsectionPaths?: string[]
|
|
756
|
-
children: ReactNode
|
|
813
|
+
export interface ElevasisSystemsProviderProps {
|
|
814
|
+
systems?: SystemModule[]
|
|
815
|
+
organizationModel?: ElevasisOrganizationModel
|
|
816
|
+
timeRange?: TimeRange
|
|
817
|
+
operationsApiUrl?: string
|
|
818
|
+
operationsSSEManager?: SSEConnectionManagerLike
|
|
819
|
+
deliveryApiUrl?: string
|
|
820
|
+
deliverySSEManager?: SSEConnectionManagerLike
|
|
821
|
+
disabledSubsectionPaths?: string[]
|
|
822
|
+
children: ReactNode
|
|
757
823
|
}
|
|
758
824
|
```
|
|
759
825
|
|
|
760
826
|
### `ElevasisSystemsContextValue`
|
|
761
827
|
|
|
762
828
|
```typescript
|
|
763
|
-
export interface ElevasisSystemsContextValue {
|
|
764
|
-
shellModel: ResolvedShellModel
|
|
765
|
-
shellRuntime: ShellRuntime
|
|
766
|
-
getSidebarLinks: (options?: ShellSidebarProjectionOptions) => ShellSidebarLinkGroup[]
|
|
767
|
-
enabledResolvedSystems: ResolvedSystemModule[]
|
|
768
|
-
resolvedSystems: ResolvedSystemModule[]
|
|
769
|
-
organizationGraph: OrganizationGraphContextValue
|
|
770
|
-
organizationModel?: OrganizationModel
|
|
771
|
-
timeRange?: TimeRange
|
|
772
|
-
operationsApiUrl?: string
|
|
773
|
-
operationsSSEManager?: SSEConnectionManagerLike
|
|
774
|
-
deliveryApiUrl?: string
|
|
775
|
-
deliverySSEManager?: SSEConnectionManagerLike
|
|
776
|
-
disabledSubsectionPaths: string[]
|
|
777
|
-
isSystemEnabled: (key: string) => boolean
|
|
778
|
-
getResolvedSystem: (key: string) => ResolvedSystemModule | undefined
|
|
829
|
+
export interface ElevasisSystemsContextValue {
|
|
830
|
+
shellModel: ResolvedShellModel
|
|
831
|
+
shellRuntime: ShellRuntime
|
|
832
|
+
getSidebarLinks: (options?: ShellSidebarProjectionOptions) => ShellSidebarLinkGroup[]
|
|
833
|
+
enabledResolvedSystems: ResolvedSystemModule[]
|
|
834
|
+
resolvedSystems: ResolvedSystemModule[]
|
|
835
|
+
organizationGraph: OrganizationGraphContextValue
|
|
836
|
+
organizationModel?: OrganizationModel
|
|
837
|
+
timeRange?: TimeRange
|
|
838
|
+
operationsApiUrl?: string
|
|
839
|
+
operationsSSEManager?: SSEConnectionManagerLike
|
|
840
|
+
deliveryApiUrl?: string
|
|
841
|
+
deliverySSEManager?: SSEConnectionManagerLike
|
|
842
|
+
disabledSubsectionPaths: string[]
|
|
843
|
+
isSystemEnabled: (key: string) => boolean
|
|
844
|
+
getResolvedSystem: (key: string) => ResolvedSystemModule | undefined
|
|
779
845
|
}
|
|
780
846
|
```
|
|
781
847
|
|
|
@@ -784,29 +850,29 @@ export interface ElevasisSystemsContextValue {
|
|
|
784
850
|
### `ResourceStatus`
|
|
785
851
|
|
|
786
852
|
```typescript
|
|
787
|
-
/**
|
|
788
|
-
* Environment/deployment status for resources
|
|
789
|
-
*/
|
|
853
|
+
/**
|
|
854
|
+
* Environment/deployment status for resources
|
|
855
|
+
*/
|
|
790
856
|
export type ResourceStatus = 'dev' | 'prod'
|
|
791
857
|
```
|
|
792
858
|
|
|
793
859
|
### `ResourceType`
|
|
794
860
|
|
|
795
861
|
```typescript
|
|
796
|
-
/**
|
|
797
|
-
* All resource types in the platform
|
|
798
|
-
* Used as the discriminator field in ResourceDefinition
|
|
799
|
-
*/
|
|
862
|
+
/**
|
|
863
|
+
* All resource types in the platform
|
|
864
|
+
* Used as the discriminator field in ResourceDefinition
|
|
865
|
+
*/
|
|
800
866
|
export type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
|
|
801
867
|
```
|
|
802
868
|
|
|
803
869
|
### `ExecutableResourceType`
|
|
804
870
|
|
|
805
871
|
```typescript
|
|
806
|
-
/**
|
|
807
|
-
* Executable resource types (subset of ResourceType)
|
|
808
|
-
* These resources can be directly executed by the execution engine
|
|
809
|
-
*/
|
|
872
|
+
/**
|
|
873
|
+
* Executable resource types (subset of ResourceType)
|
|
874
|
+
* These resources can be directly executed by the execution engine
|
|
875
|
+
*/
|
|
810
876
|
export type ExecutableResourceType = 'workflow' | 'agent'
|
|
811
877
|
```
|
|
812
878
|
|
|
@@ -819,52 +885,52 @@ export type ResourceSystemSummary = Pick<SystemEntry, 'id' | 'title' | 'descript
|
|
|
819
885
|
### `ResourceDefinition`
|
|
820
886
|
|
|
821
887
|
```typescript
|
|
822
|
-
/**
|
|
823
|
-
* Base interface for ALL platform resources
|
|
824
|
-
* Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
|
|
825
|
-
*/
|
|
826
|
-
export interface ResourceDefinition {
|
|
827
|
-
/** Unique resource identifier */
|
|
828
|
-
resourceId: string
|
|
829
|
-
|
|
830
|
-
/** Display name */
|
|
831
|
-
name: string
|
|
832
|
-
|
|
833
|
-
/** Purpose and functionality description */
|
|
834
|
-
description: string
|
|
835
|
-
|
|
836
|
-
/** Version for change tracking and evolution */
|
|
837
|
-
version: string
|
|
838
|
-
|
|
839
|
-
/** Resource type discriminator */
|
|
840
|
-
type: ResourceType
|
|
841
|
-
|
|
842
|
-
/** Environment/deployment status */
|
|
843
|
-
status: ResourceStatus
|
|
844
|
-
|
|
845
|
-
/** Graph links to Organization Model nodes */
|
|
846
|
-
links?: ResourceLink[]
|
|
847
|
-
|
|
848
|
-
/** Infrastructure category for filtering */
|
|
849
|
-
category?: ResourceCategory
|
|
850
|
-
|
|
851
|
-
/** Whether the agent supports multi-turn sessions (agents only) */
|
|
852
|
-
sessionCapable?: boolean
|
|
853
|
-
|
|
854
|
-
/** Whether the resource is local (monorepo) or remote (externally deployed) */
|
|
855
|
-
origin?: 'local' | 'remote'
|
|
856
|
-
|
|
857
|
-
/** OM System membership — dot-separated system path (e.g. "sys.lead-gen"), when backed by a Resource descriptor */
|
|
858
|
-
systemPath?: string
|
|
859
|
-
|
|
860
|
-
/** Display metadata for the owning OM System */
|
|
861
|
-
system?: ResourceSystemSummary
|
|
862
|
-
|
|
863
|
-
/** Governance lifecycle status from the OM Resource descriptor */
|
|
864
|
-
governanceStatus?: ResourceGovernanceStatus
|
|
865
|
-
|
|
866
|
-
/** Whether this resource is archived and should be excluded from registration and deployment */
|
|
867
|
-
archived?: boolean
|
|
888
|
+
/**
|
|
889
|
+
* Base interface for ALL platform resources
|
|
890
|
+
* Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
|
|
891
|
+
*/
|
|
892
|
+
export interface ResourceDefinition {
|
|
893
|
+
/** Unique resource identifier */
|
|
894
|
+
resourceId: string
|
|
895
|
+
|
|
896
|
+
/** Display name */
|
|
897
|
+
name: string
|
|
898
|
+
|
|
899
|
+
/** Purpose and functionality description */
|
|
900
|
+
description: string
|
|
901
|
+
|
|
902
|
+
/** Version for change tracking and evolution */
|
|
903
|
+
version: string
|
|
904
|
+
|
|
905
|
+
/** Resource type discriminator */
|
|
906
|
+
type: ResourceType
|
|
907
|
+
|
|
908
|
+
/** Environment/deployment status */
|
|
909
|
+
status: ResourceStatus
|
|
910
|
+
|
|
911
|
+
/** Graph links to Organization Model nodes */
|
|
912
|
+
links?: ResourceLink[]
|
|
913
|
+
|
|
914
|
+
/** Infrastructure category for filtering */
|
|
915
|
+
category?: ResourceCategory
|
|
916
|
+
|
|
917
|
+
/** Whether the agent supports multi-turn sessions (agents only) */
|
|
918
|
+
sessionCapable?: boolean
|
|
919
|
+
|
|
920
|
+
/** Whether the resource is local (monorepo) or remote (externally deployed) */
|
|
921
|
+
origin?: 'local' | 'remote'
|
|
922
|
+
|
|
923
|
+
/** OM System membership — dot-separated system path (e.g. "sys.lead-gen"), when backed by a Resource descriptor */
|
|
924
|
+
systemPath?: string
|
|
925
|
+
|
|
926
|
+
/** Display metadata for the owning OM System */
|
|
927
|
+
system?: ResourceSystemSummary
|
|
928
|
+
|
|
929
|
+
/** Governance lifecycle status from the OM Resource descriptor */
|
|
930
|
+
governanceStatus?: ResourceGovernanceStatus
|
|
931
|
+
|
|
932
|
+
/** Whether this resource is archived and should be excluded from registration and deployment */
|
|
933
|
+
archived?: boolean
|
|
868
934
|
}
|
|
869
935
|
```
|
|
870
936
|
|
|
@@ -877,371 +943,371 @@ export type RuntimeResourceDescriptor = Extract<ResourceEntry, { kind: 'workflow
|
|
|
877
943
|
### `DescriptorBackedResourceDefinition`
|
|
878
944
|
|
|
879
945
|
```typescript
|
|
880
|
-
export type DescriptorBackedResourceDefinition<
|
|
881
|
-
TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor
|
|
882
|
-
> = Omit<ResourceDefinition, 'resourceId' | 'type'> & {
|
|
883
|
-
/** OM descriptor that owns canonical identity and governance metadata. */
|
|
884
|
-
resource: TResource
|
|
885
|
-
resourceId?: never
|
|
886
|
-
type?: never
|
|
946
|
+
export type DescriptorBackedResourceDefinition<
|
|
947
|
+
TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor
|
|
948
|
+
> = Omit<ResourceDefinition, 'resourceId' | 'type'> & {
|
|
949
|
+
/** OM descriptor that owns canonical identity and governance metadata. */
|
|
950
|
+
resource: TResource
|
|
951
|
+
resourceId?: never
|
|
952
|
+
type?: never
|
|
887
953
|
}
|
|
888
954
|
```
|
|
889
955
|
|
|
890
956
|
### `BoundResourceDefinition`
|
|
891
957
|
|
|
892
958
|
```typescript
|
|
893
|
-
export type BoundResourceDefinition<TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor> = Omit<
|
|
894
|
-
DescriptorBackedResourceDefinition<TResource>,
|
|
895
|
-
'resource'
|
|
896
|
-
> &
|
|
897
|
-
ResourceDefinition & {
|
|
898
|
-
resource: TResource
|
|
899
|
-
resourceId: TResource['id']
|
|
900
|
-
type: TResource['kind']
|
|
959
|
+
export type BoundResourceDefinition<TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor> = Omit<
|
|
960
|
+
DescriptorBackedResourceDefinition<TResource>,
|
|
961
|
+
'resource'
|
|
962
|
+
> &
|
|
963
|
+
ResourceDefinition & {
|
|
964
|
+
resource: TResource
|
|
965
|
+
resourceId: TResource['id']
|
|
966
|
+
type: TResource['kind']
|
|
901
967
|
}
|
|
902
968
|
```
|
|
903
969
|
|
|
904
970
|
### `ResourceList`
|
|
905
971
|
|
|
906
972
|
```typescript
|
|
907
|
-
/**
|
|
908
|
-
* Resource list for organization
|
|
909
|
-
* Returns ResourceDefinition metadata (not full definitions)
|
|
910
|
-
*/
|
|
911
|
-
export interface ResourceList {
|
|
912
|
-
workflows: ResourceDefinition[]
|
|
913
|
-
agents: ResourceDefinition[]
|
|
914
|
-
total: number
|
|
915
|
-
organizationName: string
|
|
916
|
-
environment?: 'dev' | 'prod'
|
|
973
|
+
/**
|
|
974
|
+
* Resource list for organization
|
|
975
|
+
* Returns ResourceDefinition metadata (not full definitions)
|
|
976
|
+
*/
|
|
977
|
+
export interface ResourceList {
|
|
978
|
+
workflows: ResourceDefinition[]
|
|
979
|
+
agents: ResourceDefinition[]
|
|
980
|
+
total: number
|
|
981
|
+
organizationName: string
|
|
982
|
+
environment?: 'dev' | 'prod'
|
|
917
983
|
}
|
|
918
984
|
```
|
|
919
985
|
|
|
920
986
|
### `WebhookProviderType`
|
|
921
987
|
|
|
922
988
|
```typescript
|
|
923
|
-
/** Webhook provider identifiers */
|
|
989
|
+
/** Webhook provider identifiers */
|
|
924
990
|
export type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test'
|
|
925
991
|
```
|
|
926
992
|
|
|
927
993
|
### `WebhookTriggerConfig`
|
|
928
994
|
|
|
929
995
|
```typescript
|
|
930
|
-
/** Webhook trigger configuration */
|
|
931
|
-
export interface WebhookTriggerConfig {
|
|
932
|
-
/** Provider identifier */
|
|
933
|
-
provider: WebhookProviderType
|
|
934
|
-
/** Event type for documentation (not used for matching - workflow handles routing) */
|
|
935
|
-
event?: string
|
|
936
|
-
/** Optional filtering (e.g., specific form ID for Fillout) */
|
|
937
|
-
filter?: Record<string, string>
|
|
938
|
-
/** References credential in credentials table for per-org webhook secrets */
|
|
939
|
-
credentialName?: string
|
|
996
|
+
/** Webhook trigger configuration */
|
|
997
|
+
export interface WebhookTriggerConfig {
|
|
998
|
+
/** Provider identifier */
|
|
999
|
+
provider: WebhookProviderType
|
|
1000
|
+
/** Event type for documentation (not used for matching - workflow handles routing) */
|
|
1001
|
+
event?: string
|
|
1002
|
+
/** Optional filtering (e.g., specific form ID for Fillout) */
|
|
1003
|
+
filter?: Record<string, string>
|
|
1004
|
+
/** References credential in credentials table for per-org webhook secrets */
|
|
1005
|
+
credentialName?: string
|
|
940
1006
|
}
|
|
941
1007
|
```
|
|
942
1008
|
|
|
943
1009
|
### `ScheduleTriggerConfig`
|
|
944
1010
|
|
|
945
1011
|
```typescript
|
|
946
|
-
/** Schedule trigger configuration */
|
|
947
|
-
export interface ScheduleTriggerConfig {
|
|
948
|
-
/** Cron expression (e.g., '0 6 * * *') */
|
|
949
|
-
cron: string
|
|
950
|
-
/** Optional timezone (default: UTC) */
|
|
951
|
-
timezone?: string
|
|
1012
|
+
/** Schedule trigger configuration */
|
|
1013
|
+
export interface ScheduleTriggerConfig {
|
|
1014
|
+
/** Cron expression (e.g., '0 6 * * *') */
|
|
1015
|
+
cron: string
|
|
1016
|
+
/** Optional timezone (default: UTC) */
|
|
1017
|
+
timezone?: string
|
|
952
1018
|
}
|
|
953
1019
|
```
|
|
954
1020
|
|
|
955
1021
|
### `EventTriggerConfig`
|
|
956
1022
|
|
|
957
1023
|
```typescript
|
|
958
|
-
/** Event trigger configuration */
|
|
959
|
-
export interface EventTriggerConfig {
|
|
960
|
-
/** Internal event type */
|
|
961
|
-
eventType: string
|
|
962
|
-
/** Event source */
|
|
963
|
-
source?: string
|
|
1024
|
+
/** Event trigger configuration */
|
|
1025
|
+
export interface EventTriggerConfig {
|
|
1026
|
+
/** Internal event type */
|
|
1027
|
+
eventType: string
|
|
1028
|
+
/** Event source */
|
|
1029
|
+
source?: string
|
|
964
1030
|
}
|
|
965
1031
|
```
|
|
966
1032
|
|
|
967
1033
|
### `TriggerConfig`
|
|
968
1034
|
|
|
969
1035
|
```typescript
|
|
970
|
-
/** Union of all trigger configs */
|
|
1036
|
+
/** Union of all trigger configs */
|
|
971
1037
|
export type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig
|
|
972
1038
|
```
|
|
973
1039
|
|
|
974
1040
|
### `TriggerDefinition`
|
|
975
1041
|
|
|
976
1042
|
```typescript
|
|
977
|
-
/**
|
|
978
|
-
* Trigger metadata - entry points that initiate resource execution
|
|
979
|
-
*
|
|
980
|
-
* Triggers represent how executions start: webhooks from external services,
|
|
981
|
-
* scheduled cron jobs, platform events, or manual user actions.
|
|
982
|
-
*
|
|
983
|
-
* BREAKING CHANGES (2025-11-30):
|
|
984
|
-
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
985
|
-
* - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
|
|
986
|
-
* - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
|
|
987
|
-
* - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
|
|
988
|
-
* - triggers object now includes `externalResources` option
|
|
989
|
-
*
|
|
990
|
-
* @example
|
|
991
|
-
* // TriggerDefinition - metadata only
|
|
992
|
-
* {
|
|
993
|
-
* resourceId: 'trigger-new-order',
|
|
994
|
-
* type: 'trigger',
|
|
995
|
-
* triggerType: 'webhook',
|
|
996
|
-
* name: 'New Order',
|
|
997
|
-
* description: 'Webhook from Shopify on new orders',
|
|
998
|
-
* version: '1.0.0',
|
|
999
|
-
* status: 'prod',
|
|
1000
|
-
* webhookPath: '/webhooks/shopify/orders'
|
|
1001
|
-
* }
|
|
1002
|
-
*
|
|
1003
|
-
* // Relationships declared in ResourceRelationships (not on TriggerDefinition):
|
|
1004
|
-
* // relationships: {
|
|
1005
|
-
* // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
|
|
1006
|
-
* // }
|
|
1007
|
-
*/
|
|
1008
|
-
export interface TriggerDefinition extends ResourceDefinition {
|
|
1009
|
-
/** Resource type discriminator (narrowed from base union) */
|
|
1010
|
-
type: 'trigger'
|
|
1011
|
-
|
|
1012
|
-
/** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
|
|
1013
|
-
triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
|
|
1014
|
-
|
|
1015
|
-
/** Type-specific configuration */
|
|
1016
|
-
config?: TriggerConfig
|
|
1017
|
-
|
|
1018
|
-
// Legacy fields (deprecated, use config instead)
|
|
1019
|
-
/** For webhook triggers: path like '/webhooks/shopify/orders' */
|
|
1020
|
-
webhookPath?: string
|
|
1021
|
-
/** For schedule triggers: cron expression like '0 6 * * *' */
|
|
1022
|
-
schedule?: string
|
|
1023
|
-
/** For event triggers: event type like 'low-stock-alert' */
|
|
1024
|
-
eventType?: string
|
|
1025
|
-
|
|
1026
|
-
// NOTE: What this trigger starts is declared in ResourceRelationships, not here
|
|
1027
|
-
// This prevents duplication - triggers are forward-declared in relationships
|
|
1043
|
+
/**
|
|
1044
|
+
* Trigger metadata - entry points that initiate resource execution
|
|
1045
|
+
*
|
|
1046
|
+
* Triggers represent how executions start: webhooks from external services,
|
|
1047
|
+
* scheduled cron jobs, platform events, or manual user actions.
|
|
1048
|
+
*
|
|
1049
|
+
* BREAKING CHANGES (2025-11-30):
|
|
1050
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
1051
|
+
* - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
|
|
1052
|
+
* - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
|
|
1053
|
+
* - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
|
|
1054
|
+
* - triggers object now includes `externalResources` option
|
|
1055
|
+
*
|
|
1056
|
+
* @example
|
|
1057
|
+
* // TriggerDefinition - metadata only
|
|
1058
|
+
* {
|
|
1059
|
+
* resourceId: 'trigger-new-order',
|
|
1060
|
+
* type: 'trigger',
|
|
1061
|
+
* triggerType: 'webhook',
|
|
1062
|
+
* name: 'New Order',
|
|
1063
|
+
* description: 'Webhook from Shopify on new orders',
|
|
1064
|
+
* version: '1.0.0',
|
|
1065
|
+
* status: 'prod',
|
|
1066
|
+
* webhookPath: '/webhooks/shopify/orders'
|
|
1067
|
+
* }
|
|
1068
|
+
*
|
|
1069
|
+
* // Relationships declared in ResourceRelationships (not on TriggerDefinition):
|
|
1070
|
+
* // relationships: {
|
|
1071
|
+
* // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
|
|
1072
|
+
* // }
|
|
1073
|
+
*/
|
|
1074
|
+
export interface TriggerDefinition extends ResourceDefinition {
|
|
1075
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
1076
|
+
type: 'trigger'
|
|
1077
|
+
|
|
1078
|
+
/** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
|
|
1079
|
+
triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
|
|
1080
|
+
|
|
1081
|
+
/** Type-specific configuration */
|
|
1082
|
+
config?: TriggerConfig
|
|
1083
|
+
|
|
1084
|
+
// Legacy fields (deprecated, use config instead)
|
|
1085
|
+
/** For webhook triggers: path like '/webhooks/shopify/orders' */
|
|
1086
|
+
webhookPath?: string
|
|
1087
|
+
/** For schedule triggers: cron expression like '0 6 * * *' */
|
|
1088
|
+
schedule?: string
|
|
1089
|
+
/** For event triggers: event type like 'low-stock-alert' */
|
|
1090
|
+
eventType?: string
|
|
1091
|
+
|
|
1092
|
+
// NOTE: What this trigger starts is declared in ResourceRelationships, not here
|
|
1093
|
+
// This prevents duplication - triggers are forward-declared in relationships
|
|
1028
1094
|
}
|
|
1029
1095
|
```
|
|
1030
1096
|
|
|
1031
1097
|
### `IntegrationDefinition`
|
|
1032
1098
|
|
|
1033
1099
|
```typescript
|
|
1034
|
-
/**
|
|
1035
|
-
* Integration metadata - external service connections
|
|
1036
|
-
*
|
|
1037
|
-
* References credentials table for actual connection. No connection status
|
|
1038
|
-
* stored here (queried at runtime from credentials table).
|
|
1039
|
-
*
|
|
1040
|
-
* BREAKING CHANGES (2025-11-30):
|
|
1041
|
-
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
1042
|
-
* - Field renames: `id` -> `resourceId` (inherited)
|
|
1043
|
-
* - New required field: `status` (inherited) - organizations must add status to all integrations
|
|
1044
|
-
* - New required field: `version` (inherited) - organizations must add version to all integrations
|
|
1045
|
-
* - New required field: `type: 'integration'` (inherited) - resource type discriminator
|
|
1046
|
-
*
|
|
1047
|
-
* @example
|
|
1048
|
-
* {
|
|
1049
|
-
* resourceId: 'integration-shopify-prod',
|
|
1050
|
-
* type: 'integration',
|
|
1051
|
-
* provider: 'shopify',
|
|
1052
|
-
* credentialName: 'shopify-prod',
|
|
1053
|
-
* name: 'Shopify Production',
|
|
1054
|
-
* description: 'E-commerce platform',
|
|
1055
|
-
* version: '1.0.0',
|
|
1056
|
-
* status: 'prod'
|
|
1057
|
-
* }
|
|
1058
|
-
*/
|
|
1059
|
-
export interface IntegrationDefinition extends ResourceDefinition {
|
|
1060
|
-
/** Resource type discriminator (narrowed from base union) */
|
|
1061
|
-
type: 'integration'
|
|
1062
|
-
|
|
1063
|
-
/** OM descriptor that owns canonical identity and governance metadata. */
|
|
1064
|
-
resource?: Extract<ResourceEntry, { kind: 'integration' }>
|
|
1065
|
-
|
|
1066
|
-
/** Integration provider type */
|
|
1067
|
-
provider: IntegrationType
|
|
1068
|
-
/** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
|
|
1069
|
-
credentialName: string
|
|
1100
|
+
/**
|
|
1101
|
+
* Integration metadata - external service connections
|
|
1102
|
+
*
|
|
1103
|
+
* References credentials table for actual connection. No connection status
|
|
1104
|
+
* stored here (queried at runtime from credentials table).
|
|
1105
|
+
*
|
|
1106
|
+
* BREAKING CHANGES (2025-11-30):
|
|
1107
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
1108
|
+
* - Field renames: `id` -> `resourceId` (inherited)
|
|
1109
|
+
* - New required field: `status` (inherited) - organizations must add status to all integrations
|
|
1110
|
+
* - New required field: `version` (inherited) - organizations must add version to all integrations
|
|
1111
|
+
* - New required field: `type: 'integration'` (inherited) - resource type discriminator
|
|
1112
|
+
*
|
|
1113
|
+
* @example
|
|
1114
|
+
* {
|
|
1115
|
+
* resourceId: 'integration-shopify-prod',
|
|
1116
|
+
* type: 'integration',
|
|
1117
|
+
* provider: 'shopify',
|
|
1118
|
+
* credentialName: 'shopify-prod',
|
|
1119
|
+
* name: 'Shopify Production',
|
|
1120
|
+
* description: 'E-commerce platform',
|
|
1121
|
+
* version: '1.0.0',
|
|
1122
|
+
* status: 'prod'
|
|
1123
|
+
* }
|
|
1124
|
+
*/
|
|
1125
|
+
export interface IntegrationDefinition extends ResourceDefinition {
|
|
1126
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
1127
|
+
type: 'integration'
|
|
1128
|
+
|
|
1129
|
+
/** OM descriptor that owns canonical identity and governance metadata. */
|
|
1130
|
+
resource?: Extract<ResourceEntry, { kind: 'integration' }>
|
|
1131
|
+
|
|
1132
|
+
/** Integration provider type */
|
|
1133
|
+
provider: IntegrationType
|
|
1134
|
+
/** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
|
|
1135
|
+
credentialName: string
|
|
1070
1136
|
}
|
|
1071
1137
|
```
|
|
1072
1138
|
|
|
1073
1139
|
### `RelationshipDeclaration`
|
|
1074
1140
|
|
|
1075
1141
|
```typescript
|
|
1076
|
-
/**
|
|
1077
|
-
* Explicit resource relationship declaration
|
|
1078
|
-
*
|
|
1079
|
-
* Single-direction only - Command View derives reverse relationships.
|
|
1080
|
-
* Agents/workflows declare what they trigger and use.
|
|
1081
|
-
*
|
|
1082
|
-
* @example
|
|
1083
|
-
* {
|
|
1084
|
-
* triggers: { workflows: ['order-fulfillment-workflow'] },
|
|
1085
|
-
* uses: { integrations: ['integration-shopify-prod', 'integration-postgres'] }
|
|
1086
|
-
* }
|
|
1087
|
-
*/
|
|
1088
|
-
export interface RelationshipDeclaration {
|
|
1089
|
-
/** Resources this resource triggers */
|
|
1090
|
-
triggers?: {
|
|
1091
|
-
/** Agent resourceIds this resource triggers */
|
|
1092
|
-
agents?: string[]
|
|
1093
|
-
/** Workflow resourceIds this resource triggers */
|
|
1094
|
-
workflows?: string[]
|
|
1095
|
-
}
|
|
1096
|
-
/** Integrations this resource uses */
|
|
1097
|
-
uses?: {
|
|
1098
|
-
/** Integration IDs this resource uses */
|
|
1099
|
-
integrations?: string[]
|
|
1100
|
-
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Explicit resource relationship declaration
|
|
1144
|
+
*
|
|
1145
|
+
* Single-direction only - Command View derives reverse relationships.
|
|
1146
|
+
* Agents/workflows declare what they trigger and use.
|
|
1147
|
+
*
|
|
1148
|
+
* @example
|
|
1149
|
+
* {
|
|
1150
|
+
* triggers: { workflows: ['order-fulfillment-workflow'] },
|
|
1151
|
+
* uses: { integrations: ['integration-shopify-prod', 'integration-postgres'] }
|
|
1152
|
+
* }
|
|
1153
|
+
*/
|
|
1154
|
+
export interface RelationshipDeclaration {
|
|
1155
|
+
/** Resources this resource triggers */
|
|
1156
|
+
triggers?: {
|
|
1157
|
+
/** Agent resourceIds this resource triggers */
|
|
1158
|
+
agents?: string[]
|
|
1159
|
+
/** Workflow resourceIds this resource triggers */
|
|
1160
|
+
workflows?: string[]
|
|
1161
|
+
}
|
|
1162
|
+
/** Integrations this resource uses */
|
|
1163
|
+
uses?: {
|
|
1164
|
+
/** Integration IDs this resource uses */
|
|
1165
|
+
integrations?: string[]
|
|
1166
|
+
}
|
|
1101
1167
|
}
|
|
1102
1168
|
```
|
|
1103
1169
|
|
|
1104
1170
|
### `ResourceRelationships`
|
|
1105
1171
|
|
|
1106
1172
|
```typescript
|
|
1107
|
-
/**
|
|
1108
|
-
* Resource relationships map
|
|
1109
|
-
* Maps resourceId to its relationship declarations
|
|
1110
|
-
*
|
|
1111
|
-
* @example
|
|
1112
|
-
* {
|
|
1113
|
-
* 'order-processor-agent': {
|
|
1114
|
-
* triggers: { workflows: ['order-fulfillment-workflow'] },
|
|
1115
|
-
* uses: { integrations: ['integration-shopify-prod'] }
|
|
1116
|
-
* }
|
|
1117
|
-
* }
|
|
1118
|
-
*/
|
|
1173
|
+
/**
|
|
1174
|
+
* Resource relationships map
|
|
1175
|
+
* Maps resourceId to its relationship declarations
|
|
1176
|
+
*
|
|
1177
|
+
* @example
|
|
1178
|
+
* {
|
|
1179
|
+
* 'order-processor-agent': {
|
|
1180
|
+
* triggers: { workflows: ['order-fulfillment-workflow'] },
|
|
1181
|
+
* uses: { integrations: ['integration-shopify-prod'] }
|
|
1182
|
+
* }
|
|
1183
|
+
* }
|
|
1184
|
+
*/
|
|
1119
1185
|
export type ResourceRelationships = Record<string, RelationshipDeclaration>
|
|
1120
1186
|
```
|
|
1121
1187
|
|
|
1122
1188
|
### `ExternalPlatform`
|
|
1123
1189
|
|
|
1124
1190
|
```typescript
|
|
1125
|
-
/**
|
|
1126
|
-
* External platform type
|
|
1127
|
-
* Supported third-party automation platforms
|
|
1128
|
-
*/
|
|
1191
|
+
/**
|
|
1192
|
+
* External platform type
|
|
1193
|
+
* Supported third-party automation platforms
|
|
1194
|
+
*/
|
|
1129
1195
|
export type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other'
|
|
1130
1196
|
```
|
|
1131
1197
|
|
|
1132
1198
|
### `ExternalResourceDefinition`
|
|
1133
1199
|
|
|
1134
1200
|
```typescript
|
|
1135
|
-
/**
|
|
1136
|
-
* External automation resource metadata
|
|
1137
|
-
*
|
|
1138
|
-
* Represents workflows/automations running on third-party platforms
|
|
1139
|
-
* (n8n, Make, Zapier, etc.) for visualization in Command View.
|
|
1140
|
-
*
|
|
1141
|
-
* NOTE: This is metadata ONLY for visualization. No execution logic,
|
|
1142
|
-
* no API integration with external platforms, no status syncing.
|
|
1143
|
-
*
|
|
1144
|
-
* BREAKING CHANGES (2025-11-30):
|
|
1145
|
-
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
1146
|
-
* - Field renames: `id` -> `resourceId` (inherited)
|
|
1147
|
-
* - New required field: `version` (inherited) - organizations must add version to all external resources
|
|
1148
|
-
* - New required field: `type: 'external'` (inherited) - resource type discriminator
|
|
1149
|
-
* - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
|
|
1150
|
-
*
|
|
1151
|
-
* @example
|
|
1152
|
-
* {
|
|
1153
|
-
* resourceId: 'external-n8n-order-sync',
|
|
1154
|
-
* type: 'external',
|
|
1155
|
-
* version: '1.0.0',
|
|
1156
|
-
* platform: 'n8n',
|
|
1157
|
-
* name: 'Shopify Order Sync',
|
|
1158
|
-
* description: 'Legacy n8n workflow for syncing Shopify orders',
|
|
1159
|
-
* status: 'prod',
|
|
1160
|
-
* platformUrl: 'https://n8n.client.com/workflow/123',
|
|
1161
|
-
* triggers: { workflows: ['order-fulfillment-workflow'] },
|
|
1162
|
-
* uses: { integrations: ['integration-shopify-prod'] }
|
|
1163
|
-
* }
|
|
1164
|
-
*/
|
|
1165
|
-
export interface ExternalResourceDefinition extends ResourceDefinition {
|
|
1166
|
-
/** Resource type discriminator (narrowed from base union) */
|
|
1167
|
-
type: 'external'
|
|
1168
|
-
|
|
1169
|
-
/** Platform type */
|
|
1170
|
-
platform: ExternalPlatform
|
|
1171
|
-
|
|
1172
|
-
// Optional platform-specific metadata
|
|
1173
|
-
/** Link to external platform (e.g., n8n workflow editor URL) */
|
|
1174
|
-
platformUrl?: string
|
|
1175
|
-
/** Platform's internal ID/reference */
|
|
1176
|
-
externalId?: string
|
|
1177
|
-
|
|
1178
|
-
/** What this external resource triggers (external -> internal) */
|
|
1179
|
-
triggers?: {
|
|
1180
|
-
/** Elevasis workflow resourceIds this external automation triggers */
|
|
1181
|
-
workflows?: string[]
|
|
1182
|
-
/** Elevasis agent resourceIds this external automation triggers */
|
|
1183
|
-
agents?: string[]
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
/** Integrations this external resource uses (shared credentials) */
|
|
1187
|
-
uses?: {
|
|
1188
|
-
/** Integration IDs this external automation uses */
|
|
1189
|
-
integrations?: string[]
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
// NOTE: triggeredBy field removed - per relationship-consolidation design,
|
|
1193
|
-
// all relationships are forward-only declarations. Graph edges are built
|
|
1194
|
-
// from forward declarations only.
|
|
1201
|
+
/**
|
|
1202
|
+
* External automation resource metadata
|
|
1203
|
+
*
|
|
1204
|
+
* Represents workflows/automations running on third-party platforms
|
|
1205
|
+
* (n8n, Make, Zapier, etc.) for visualization in Command View.
|
|
1206
|
+
*
|
|
1207
|
+
* NOTE: This is metadata ONLY for visualization. No execution logic,
|
|
1208
|
+
* no API integration with external platforms, no status syncing.
|
|
1209
|
+
*
|
|
1210
|
+
* BREAKING CHANGES (2025-11-30):
|
|
1211
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
1212
|
+
* - Field renames: `id` -> `resourceId` (inherited)
|
|
1213
|
+
* - New required field: `version` (inherited) - organizations must add version to all external resources
|
|
1214
|
+
* - New required field: `type: 'external'` (inherited) - resource type discriminator
|
|
1215
|
+
* - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
|
|
1216
|
+
*
|
|
1217
|
+
* @example
|
|
1218
|
+
* {
|
|
1219
|
+
* resourceId: 'external-n8n-order-sync',
|
|
1220
|
+
* type: 'external',
|
|
1221
|
+
* version: '1.0.0',
|
|
1222
|
+
* platform: 'n8n',
|
|
1223
|
+
* name: 'Shopify Order Sync',
|
|
1224
|
+
* description: 'Legacy n8n workflow for syncing Shopify orders',
|
|
1225
|
+
* status: 'prod',
|
|
1226
|
+
* platformUrl: 'https://n8n.client.com/workflow/123',
|
|
1227
|
+
* triggers: { workflows: ['order-fulfillment-workflow'] },
|
|
1228
|
+
* uses: { integrations: ['integration-shopify-prod'] }
|
|
1229
|
+
* }
|
|
1230
|
+
*/
|
|
1231
|
+
export interface ExternalResourceDefinition extends ResourceDefinition {
|
|
1232
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
1233
|
+
type: 'external'
|
|
1234
|
+
|
|
1235
|
+
/** Platform type */
|
|
1236
|
+
platform: ExternalPlatform
|
|
1237
|
+
|
|
1238
|
+
// Optional platform-specific metadata
|
|
1239
|
+
/** Link to external platform (e.g., n8n workflow editor URL) */
|
|
1240
|
+
platformUrl?: string
|
|
1241
|
+
/** Platform's internal ID/reference */
|
|
1242
|
+
externalId?: string
|
|
1243
|
+
|
|
1244
|
+
/** What this external resource triggers (external -> internal) */
|
|
1245
|
+
triggers?: {
|
|
1246
|
+
/** Elevasis workflow resourceIds this external automation triggers */
|
|
1247
|
+
workflows?: string[]
|
|
1248
|
+
/** Elevasis agent resourceIds this external automation triggers */
|
|
1249
|
+
agents?: string[]
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
/** Integrations this external resource uses (shared credentials) */
|
|
1253
|
+
uses?: {
|
|
1254
|
+
/** Integration IDs this external automation uses */
|
|
1255
|
+
integrations?: string[]
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
// NOTE: triggeredBy field removed - per relationship-consolidation design,
|
|
1259
|
+
// all relationships are forward-only declarations. Graph edges are built
|
|
1260
|
+
// from forward declarations only.
|
|
1195
1261
|
}
|
|
1196
1262
|
```
|
|
1197
1263
|
|
|
1198
1264
|
### `HumanCheckpointDefinition`
|
|
1199
1265
|
|
|
1200
1266
|
```typescript
|
|
1201
|
-
/**
|
|
1202
|
-
* Human Checkpoint definition - human decision points in automation
|
|
1203
|
-
*
|
|
1204
|
-
* Represents where human judgment is deployed in the automation landscape.
|
|
1205
|
-
* Tasks with matching command_queue_group are routed to this checkpoint.
|
|
1206
|
-
*
|
|
1207
|
-
* BREAKING CHANGES (2025-11-30):
|
|
1208
|
-
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
1209
|
-
* - Field renames: `id` -> `resourceId` (inherited)
|
|
1210
|
-
* - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
|
|
1211
|
-
* - New required field: `version` (inherited) - organizations must add version to all human checkpoints
|
|
1212
|
-
* - New required field: `type: 'human'` (inherited) - resource type discriminator
|
|
1213
|
-
*
|
|
1214
|
-
* @example
|
|
1215
|
-
* {
|
|
1216
|
-
* resourceId: 'sales-approval',
|
|
1217
|
-
* type: 'human',
|
|
1218
|
-
* name: 'Sales Approval Queue',
|
|
1219
|
-
* description: 'High-value order approvals for sales team',
|
|
1220
|
-
* version: '1.0.0',
|
|
1221
|
-
* status: 'prod',
|
|
1222
|
-
* requestedBy: { agents: ['order-processor-agent'] },
|
|
1223
|
-
* routesTo: { agents: ['order-fulfillment-agent'] }
|
|
1224
|
-
* }
|
|
1225
|
-
*/
|
|
1226
|
-
export interface HumanCheckpointDefinition extends ResourceDefinition {
|
|
1227
|
-
/** Resource type discriminator (narrowed from base union) */
|
|
1228
|
-
type: 'human'
|
|
1229
|
-
|
|
1230
|
-
/** Resources that create tasks for this checkpoint */
|
|
1231
|
-
requestedBy?: {
|
|
1232
|
-
/** Agent resourceIds that request approval here */
|
|
1233
|
-
agents?: string[]
|
|
1234
|
-
/** Workflow resourceIds that request approval here */
|
|
1235
|
-
workflows?: string[]
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
/** Resources that receive approved decisions */
|
|
1239
|
-
routesTo?: {
|
|
1240
|
-
/** Agent resourceIds that handle approved tasks */
|
|
1241
|
-
agents?: string[]
|
|
1242
|
-
/** Workflow resourceIds that handle approved tasks */
|
|
1243
|
-
workflows?: string[]
|
|
1244
|
-
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Human Checkpoint definition - human decision points in automation
|
|
1269
|
+
*
|
|
1270
|
+
* Represents where human judgment is deployed in the automation landscape.
|
|
1271
|
+
* Tasks with matching command_queue_group are routed to this checkpoint.
|
|
1272
|
+
*
|
|
1273
|
+
* BREAKING CHANGES (2025-11-30):
|
|
1274
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
|
|
1275
|
+
* - Field renames: `id` -> `resourceId` (inherited)
|
|
1276
|
+
* - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
|
|
1277
|
+
* - New required field: `version` (inherited) - organizations must add version to all human checkpoints
|
|
1278
|
+
* - New required field: `type: 'human'` (inherited) - resource type discriminator
|
|
1279
|
+
*
|
|
1280
|
+
* @example
|
|
1281
|
+
* {
|
|
1282
|
+
* resourceId: 'sales-approval',
|
|
1283
|
+
* type: 'human',
|
|
1284
|
+
* name: 'Sales Approval Queue',
|
|
1285
|
+
* description: 'High-value order approvals for sales team',
|
|
1286
|
+
* version: '1.0.0',
|
|
1287
|
+
* status: 'prod',
|
|
1288
|
+
* requestedBy: { agents: ['order-processor-agent'] },
|
|
1289
|
+
* routesTo: { agents: ['order-fulfillment-agent'] }
|
|
1290
|
+
* }
|
|
1291
|
+
*/
|
|
1292
|
+
export interface HumanCheckpointDefinition extends ResourceDefinition {
|
|
1293
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
1294
|
+
type: 'human'
|
|
1295
|
+
|
|
1296
|
+
/** Resources that create tasks for this checkpoint */
|
|
1297
|
+
requestedBy?: {
|
|
1298
|
+
/** Agent resourceIds that request approval here */
|
|
1299
|
+
agents?: string[]
|
|
1300
|
+
/** Workflow resourceIds that request approval here */
|
|
1301
|
+
workflows?: string[]
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
/** Resources that receive approved decisions */
|
|
1305
|
+
routesTo?: {
|
|
1306
|
+
/** Agent resourceIds that handle approved tasks */
|
|
1307
|
+
agents?: string[]
|
|
1308
|
+
/** Workflow resourceIds that handle approved tasks */
|
|
1309
|
+
workflows?: string[]
|
|
1310
|
+
}
|
|
1245
1311
|
}
|
|
1246
1312
|
```
|
|
1247
1313
|
|
|
@@ -1250,36 +1316,38 @@ export interface HumanCheckpointDefinition extends ResourceDefinition {
|
|
|
1250
1316
|
### `DeploymentSpec`
|
|
1251
1317
|
|
|
1252
1318
|
```typescript
|
|
1253
|
-
/**
|
|
1254
|
-
* Organization-specific resource collection
|
|
1255
|
-
*
|
|
1256
|
-
* Complete manifest of all automation resources for an organization.
|
|
1257
|
-
* Used by ResourceRegistry for discovery and Command View for visualization.
|
|
1258
|
-
*/
|
|
1259
|
-
export interface DeploymentSpec {
|
|
1319
|
+
/**
|
|
1320
|
+
* Organization-specific resource collection
|
|
1321
|
+
*
|
|
1322
|
+
* Complete manifest of all automation resources for an organization.
|
|
1323
|
+
* Used by ResourceRegistry for discovery and Command View for visualization.
|
|
1324
|
+
*/
|
|
1325
|
+
export interface DeploymentSpec {
|
|
1260
1326
|
/** Deployment version (semver) */
|
|
1261
1327
|
version: string
|
|
1262
1328
|
/** Optional Organization Model governance catalog used for OM-code validation */
|
|
1263
|
-
organizationModel?:
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
/**
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
/**
|
|
1276
|
-
|
|
1277
|
-
/**
|
|
1278
|
-
|
|
1279
|
-
/**
|
|
1280
|
-
|
|
1281
|
-
/**
|
|
1282
|
-
|
|
1329
|
+
organizationModel?: Partial<
|
|
1330
|
+
Pick<
|
|
1331
|
+
OrganizationModel,
|
|
1332
|
+
'systems' | 'resources' | 'ontology' | 'topology' | 'roles' | 'policies' | 'entities' | 'actions'
|
|
1333
|
+
>
|
|
1334
|
+
>
|
|
1335
|
+
/** Workflow definitions */
|
|
1336
|
+
workflows?: WorkflowDefinition[]
|
|
1337
|
+
/** Agent definitions */
|
|
1338
|
+
agents?: AgentDefinition[]
|
|
1339
|
+
|
|
1340
|
+
// Resource Manifest fields (optional for backwards compatibility)
|
|
1341
|
+
/** Trigger definitions - entry points that initiate executions */
|
|
1342
|
+
triggers?: TriggerDefinition[]
|
|
1343
|
+
/** Integration definitions - external service connections */
|
|
1344
|
+
integrations?: IntegrationDefinition[]
|
|
1345
|
+
/** Explicit relationship declarations between resources */
|
|
1346
|
+
relationships?: ResourceRelationships
|
|
1347
|
+
/** External automation resources (n8n, Make, Zapier, etc.) */
|
|
1348
|
+
externalResources?: ExternalResourceDefinition[]
|
|
1349
|
+
/** Human checkpoint definitions - human decision points in automation */
|
|
1350
|
+
humanCheckpoints?: HumanCheckpointDefinition[]
|
|
1283
1351
|
}
|
|
1284
1352
|
```
|
|
1285
1353
|
|
|
@@ -1288,77 +1356,77 @@ export interface DeploymentSpec {
|
|
|
1288
1356
|
### `AcqCompany`
|
|
1289
1357
|
|
|
1290
1358
|
```typescript
|
|
1291
|
-
/**
|
|
1292
|
-
* Company record in the acquisition database.
|
|
1293
|
-
* Contains enriched company data from various sources.
|
|
1294
|
-
* Transformed from AcqCompanyRow with camelCase properties.
|
|
1295
|
-
*/
|
|
1296
|
-
export interface AcqCompany {
|
|
1297
|
-
id: string
|
|
1298
|
-
organizationId: string
|
|
1299
|
-
name: string
|
|
1300
|
-
domain: string | null
|
|
1301
|
-
linkedinUrl: string | null
|
|
1302
|
-
website: string | null
|
|
1303
|
-
numEmployees: number | null
|
|
1304
|
-
foundedYear: number | null
|
|
1305
|
-
locationCity: string | null
|
|
1306
|
-
locationState: string | null
|
|
1307
|
-
category: string | null
|
|
1308
|
-
categoryPain: string | null
|
|
1309
|
-
segment: string | null
|
|
1310
|
-
processingState: CompanyProcessingState | null
|
|
1311
|
-
/** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
|
|
1312
|
-
pipelineStatus?: LegacyPipelineStatus | null
|
|
1313
|
-
enrichmentData: CompanyEnrichmentData | null
|
|
1314
|
-
source: string | null
|
|
1315
|
-
batchId: string | null
|
|
1316
|
-
status: 'active' | 'invalid'
|
|
1317
|
-
verticalResearch: string | null
|
|
1318
|
-
/** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
|
|
1319
|
-
qualificationScore: number | null
|
|
1320
|
-
/** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
|
|
1321
|
-
qualificationSignals: Record<string, unknown> | null
|
|
1322
|
-
/** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
|
|
1323
|
-
qualificationRubricKey: string | null
|
|
1324
|
-
createdAt: Date
|
|
1325
|
-
updatedAt: Date
|
|
1359
|
+
/**
|
|
1360
|
+
* Company record in the acquisition database.
|
|
1361
|
+
* Contains enriched company data from various sources.
|
|
1362
|
+
* Transformed from AcqCompanyRow with camelCase properties.
|
|
1363
|
+
*/
|
|
1364
|
+
export interface AcqCompany {
|
|
1365
|
+
id: string
|
|
1366
|
+
organizationId: string
|
|
1367
|
+
name: string
|
|
1368
|
+
domain: string | null
|
|
1369
|
+
linkedinUrl: string | null
|
|
1370
|
+
website: string | null
|
|
1371
|
+
numEmployees: number | null
|
|
1372
|
+
foundedYear: number | null
|
|
1373
|
+
locationCity: string | null
|
|
1374
|
+
locationState: string | null
|
|
1375
|
+
category: string | null
|
|
1376
|
+
categoryPain: string | null
|
|
1377
|
+
segment: string | null
|
|
1378
|
+
processingState: CompanyProcessingState | null
|
|
1379
|
+
/** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
|
|
1380
|
+
pipelineStatus?: LegacyPipelineStatus | null
|
|
1381
|
+
enrichmentData: CompanyEnrichmentData | null
|
|
1382
|
+
source: string | null
|
|
1383
|
+
batchId: string | null
|
|
1384
|
+
status: 'active' | 'invalid'
|
|
1385
|
+
verticalResearch: string | null
|
|
1386
|
+
/** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
|
|
1387
|
+
qualificationScore: number | null
|
|
1388
|
+
/** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
|
|
1389
|
+
qualificationSignals: Record<string, unknown> | null
|
|
1390
|
+
/** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
|
|
1391
|
+
qualificationRubricKey: string | null
|
|
1392
|
+
createdAt: Date
|
|
1393
|
+
updatedAt: Date
|
|
1326
1394
|
}
|
|
1327
1395
|
```
|
|
1328
1396
|
|
|
1329
1397
|
### `AcqContact`
|
|
1330
1398
|
|
|
1331
1399
|
```typescript
|
|
1332
|
-
/**
|
|
1333
|
-
* Contact record in the acquisition database.
|
|
1334
|
-
* Contains enriched contact data and personalization content.
|
|
1335
|
-
* Transformed from AcqContactRow with camelCase properties.
|
|
1336
|
-
*/
|
|
1337
|
-
export interface AcqContact {
|
|
1338
|
-
id: string
|
|
1339
|
-
organizationId: string
|
|
1340
|
-
companyId: string | null
|
|
1341
|
-
email: string
|
|
1342
|
-
emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
|
|
1343
|
-
firstName: string | null
|
|
1344
|
-
lastName: string | null
|
|
1345
|
-
linkedinUrl: string | null
|
|
1346
|
-
title: string | null
|
|
1347
|
-
headline: string | null
|
|
1348
|
-
filterReason: string | null
|
|
1349
|
-
openingLine: string | null
|
|
1350
|
-
source: string | null
|
|
1351
|
-
sourceId: string | null
|
|
1352
|
-
processingState: ContactProcessingState | null
|
|
1353
|
-
/** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
|
|
1354
|
-
pipelineStatus?: LegacyPipelineStatus | null
|
|
1355
|
-
enrichmentData: ContactEnrichmentData | null
|
|
1356
|
-
/** Attio Person record ID - set when contact responds and is added to CRM */
|
|
1357
|
-
attioPersonId: string | null
|
|
1358
|
-
batchId: string | null
|
|
1359
|
-
status: 'active' | 'invalid'
|
|
1360
|
-
createdAt: Date
|
|
1361
|
-
updatedAt: Date
|
|
1400
|
+
/**
|
|
1401
|
+
* Contact record in the acquisition database.
|
|
1402
|
+
* Contains enriched contact data and personalization content.
|
|
1403
|
+
* Transformed from AcqContactRow with camelCase properties.
|
|
1404
|
+
*/
|
|
1405
|
+
export interface AcqContact {
|
|
1406
|
+
id: string
|
|
1407
|
+
organizationId: string
|
|
1408
|
+
companyId: string | null
|
|
1409
|
+
email: string
|
|
1410
|
+
emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
|
|
1411
|
+
firstName: string | null
|
|
1412
|
+
lastName: string | null
|
|
1413
|
+
linkedinUrl: string | null
|
|
1414
|
+
title: string | null
|
|
1415
|
+
headline: string | null
|
|
1416
|
+
filterReason: string | null
|
|
1417
|
+
openingLine: string | null
|
|
1418
|
+
source: string | null
|
|
1419
|
+
sourceId: string | null
|
|
1420
|
+
processingState: ContactProcessingState | null
|
|
1421
|
+
/** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
|
|
1422
|
+
pipelineStatus?: LegacyPipelineStatus | null
|
|
1423
|
+
enrichmentData: ContactEnrichmentData | null
|
|
1424
|
+
/** Attio Person record ID - set when contact responds and is added to CRM */
|
|
1425
|
+
attioPersonId: string | null
|
|
1426
|
+
batchId: string | null
|
|
1427
|
+
status: 'active' | 'invalid'
|
|
1428
|
+
createdAt: Date
|
|
1429
|
+
updatedAt: Date
|
|
1362
1430
|
}
|
|
1363
1431
|
```
|
|
1364
1432
|
|
|
@@ -1377,23 +1445,23 @@ export type DealPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waitin
|
|
|
1377
1445
|
### `DealPriority`
|
|
1378
1446
|
|
|
1379
1447
|
```typescript
|
|
1380
|
-
export interface DealPriority {
|
|
1381
|
-
bucketKey: DealPriorityBucketKey
|
|
1382
|
-
rank: number
|
|
1383
|
-
label: string
|
|
1384
|
-
color: string
|
|
1385
|
-
reason: string
|
|
1386
|
-
latestActivityAt: string | null
|
|
1387
|
-
nextActionAt: string | null
|
|
1448
|
+
export interface DealPriority {
|
|
1449
|
+
bucketKey: DealPriorityBucketKey
|
|
1450
|
+
rank: number
|
|
1451
|
+
label: string
|
|
1452
|
+
color: string
|
|
1453
|
+
reason: string
|
|
1454
|
+
latestActivityAt: string | null
|
|
1455
|
+
nextActionAt: string | null
|
|
1388
1456
|
}
|
|
1389
1457
|
```
|
|
1390
1458
|
|
|
1391
1459
|
### `KanbanStageConfig`
|
|
1392
1460
|
|
|
1393
1461
|
```typescript
|
|
1394
|
-
export interface KanbanStageConfig {
|
|
1395
|
-
color: string // Mantine color token (e.g. 'blue', 'teal')
|
|
1396
|
-
label?: string // Optional display label override
|
|
1462
|
+
export interface KanbanStageConfig {
|
|
1463
|
+
color: string // Mantine color token (e.g. 'blue', 'teal')
|
|
1464
|
+
label?: string // Optional display label override
|
|
1397
1465
|
}
|
|
1398
1466
|
```
|
|
1399
1467
|
|
|
@@ -1406,49 +1474,49 @@ export type KanbanBoardConfig = Partial<Record<DealStage, KanbanStageConfig>>
|
|
|
1406
1474
|
### `DealContact`
|
|
1407
1475
|
|
|
1408
1476
|
```typescript
|
|
1409
|
-
export interface DealContact {
|
|
1410
|
-
id: string
|
|
1411
|
-
first_name: string | null
|
|
1412
|
-
last_name: string | null
|
|
1413
|
-
email: string
|
|
1414
|
-
title: string | null
|
|
1415
|
-
headline: string | null
|
|
1416
|
-
linkedin_url: string | null
|
|
1417
|
-
processing_state: Record<string, unknown> | null
|
|
1418
|
-
enrichment_data: Record<string, unknown> | null
|
|
1419
|
-
company: {
|
|
1420
|
-
id: string
|
|
1421
|
-
name: string
|
|
1422
|
-
domain: string | null
|
|
1423
|
-
website: string | null
|
|
1424
|
-
linkedin_url: string | null
|
|
1425
|
-
segment: string | null
|
|
1426
|
-
category: string | null
|
|
1427
|
-
num_employees: number | null
|
|
1428
|
-
} | null
|
|
1477
|
+
export interface DealContact {
|
|
1478
|
+
id: string
|
|
1479
|
+
first_name: string | null
|
|
1480
|
+
last_name: string | null
|
|
1481
|
+
email: string
|
|
1482
|
+
title: string | null
|
|
1483
|
+
headline: string | null
|
|
1484
|
+
linkedin_url: string | null
|
|
1485
|
+
processing_state: Record<string, unknown> | null
|
|
1486
|
+
enrichment_data: Record<string, unknown> | null
|
|
1487
|
+
company: {
|
|
1488
|
+
id: string
|
|
1489
|
+
name: string
|
|
1490
|
+
domain: string | null
|
|
1491
|
+
website: string | null
|
|
1492
|
+
linkedin_url: string | null
|
|
1493
|
+
segment: string | null
|
|
1494
|
+
category: string | null
|
|
1495
|
+
num_employees: number | null
|
|
1496
|
+
} | null
|
|
1429
1497
|
}
|
|
1430
1498
|
```
|
|
1431
1499
|
|
|
1432
1500
|
### `DealFilters`
|
|
1433
1501
|
|
|
1434
1502
|
```typescript
|
|
1435
|
-
export interface DealFilters {
|
|
1436
|
-
stage?: DealStage
|
|
1437
|
-
search?: string
|
|
1438
|
-
limit?: number
|
|
1439
|
-
offset?: number
|
|
1503
|
+
export interface DealFilters {
|
|
1504
|
+
stage?: DealStage
|
|
1505
|
+
search?: string
|
|
1506
|
+
limit?: number
|
|
1507
|
+
offset?: number
|
|
1440
1508
|
}
|
|
1441
1509
|
```
|
|
1442
1510
|
|
|
1443
1511
|
### `DealListItem`
|
|
1444
1512
|
|
|
1445
1513
|
```typescript
|
|
1446
|
-
/** Deal list item with joined contact and company data */
|
|
1447
|
-
export interface DealListItem extends AcqDealRow {
|
|
1448
|
-
priority: DealPriority
|
|
1449
|
-
ownership: 'us' | 'them' | null
|
|
1450
|
-
nextAction: string | null
|
|
1451
|
-
contact: DealContact | null
|
|
1514
|
+
/** Deal list item with joined contact and company data */
|
|
1515
|
+
export interface DealListItem extends AcqDealRow {
|
|
1516
|
+
priority: DealPriority
|
|
1517
|
+
ownership: 'us' | 'them' | null
|
|
1518
|
+
nextAction: string | null
|
|
1519
|
+
contact: DealContact | null
|
|
1452
1520
|
}
|
|
1453
1521
|
```
|
|
1454
1522
|
|
|
@@ -1461,31 +1529,31 @@ export type DealDetail = DealListItem
|
|
|
1461
1529
|
### `AcqDealTaskKind`
|
|
1462
1530
|
|
|
1463
1531
|
```typescript
|
|
1464
|
-
/** Task kind options for a deal task (human follow-up action type) */
|
|
1532
|
+
/** Task kind options for a deal task (human follow-up action type) */
|
|
1465
1533
|
export type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other'
|
|
1466
1534
|
```
|
|
1467
1535
|
|
|
1468
1536
|
### `AcqDealTask`
|
|
1469
1537
|
|
|
1470
1538
|
```typescript
|
|
1471
|
-
/**
|
|
1472
|
-
* A CRM to-do item attached to a deal representing a human follow-up action.
|
|
1473
|
-
* Transformed from AcqDealTaskRow with camelCase properties.
|
|
1474
|
-
*/
|
|
1475
|
-
export interface AcqDealTask {
|
|
1476
|
-
id: string
|
|
1477
|
-
organizationId: string
|
|
1478
|
-
dealId: string
|
|
1479
|
-
title: string
|
|
1480
|
-
description: string | null
|
|
1481
|
-
kind: AcqDealTaskKind
|
|
1482
|
-
dueAt: string | null
|
|
1483
|
-
assigneeUserId: string | null
|
|
1484
|
-
completedAt: string | null
|
|
1485
|
-
completedByUserId: string | null
|
|
1486
|
-
createdAt: string
|
|
1487
|
-
updatedAt: string
|
|
1488
|
-
createdByUserId: string | null
|
|
1539
|
+
/**
|
|
1540
|
+
* A CRM to-do item attached to a deal representing a human follow-up action.
|
|
1541
|
+
* Transformed from AcqDealTaskRow with camelCase properties.
|
|
1542
|
+
*/
|
|
1543
|
+
export interface AcqDealTask {
|
|
1544
|
+
id: string
|
|
1545
|
+
organizationId: string
|
|
1546
|
+
dealId: string
|
|
1547
|
+
title: string
|
|
1548
|
+
description: string | null
|
|
1549
|
+
kind: AcqDealTaskKind
|
|
1550
|
+
dueAt: string | null
|
|
1551
|
+
assigneeUserId: string | null
|
|
1552
|
+
completedAt: string | null
|
|
1553
|
+
completedByUserId: string | null
|
|
1554
|
+
createdAt: string
|
|
1555
|
+
updatedAt: string
|
|
1556
|
+
createdByUserId: string | null
|
|
1489
1557
|
}
|
|
1490
1558
|
```
|
|
1491
1559
|
|
|
@@ -1498,54 +1566,54 @@ export type CrmPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting
|
|
|
1498
1566
|
### `CrmPriorityBucketDefinition`
|
|
1499
1567
|
|
|
1500
1568
|
```typescript
|
|
1501
|
-
export interface CrmPriorityBucketDefinition {
|
|
1502
|
-
bucketKey: CrmPriorityBucketKey
|
|
1503
|
-
label: string
|
|
1504
|
-
/** Lower ranks sort first in deal lists and pipeline columns. */
|
|
1505
|
-
rank: number
|
|
1506
|
-
/** UI color token. Consumers may map this to their design system. */
|
|
1507
|
-
color: string
|
|
1569
|
+
export interface CrmPriorityBucketDefinition {
|
|
1570
|
+
bucketKey: CrmPriorityBucketKey
|
|
1571
|
+
label: string
|
|
1572
|
+
/** Lower ranks sort first in deal lists and pipeline columns. */
|
|
1573
|
+
rank: number
|
|
1574
|
+
/** UI color token. Consumers may map this to their design system. */
|
|
1575
|
+
color: string
|
|
1508
1576
|
}
|
|
1509
1577
|
```
|
|
1510
1578
|
|
|
1511
1579
|
### `CrmPriorityRuleConfig`
|
|
1512
1580
|
|
|
1513
1581
|
```typescript
|
|
1514
|
-
export interface CrmPriorityRuleConfig {
|
|
1515
|
-
buckets: CrmPriorityBucketDefinition[]
|
|
1516
|
-
closedStageKeys: string[]
|
|
1517
|
-
followUpAfterDaysByStateKey: Record<string, number>
|
|
1518
|
-
staleAfterDays: number
|
|
1582
|
+
export interface CrmPriorityRuleConfig {
|
|
1583
|
+
buckets: CrmPriorityBucketDefinition[]
|
|
1584
|
+
closedStageKeys: string[]
|
|
1585
|
+
followUpAfterDaysByStateKey: Record<string, number>
|
|
1586
|
+
staleAfterDays: number
|
|
1519
1587
|
}
|
|
1520
1588
|
```
|
|
1521
1589
|
|
|
1522
1590
|
### `CRM_PRIORITY_BUCKETS`
|
|
1523
1591
|
|
|
1524
1592
|
```typescript
|
|
1525
|
-
export const CRM_PRIORITY_BUCKETS: CrmPriorityBucketDefinition[] = [
|
|
1526
|
-
{ bucketKey: 'needs_response', label: 'Needs Response', rank: 10, color: 'red' },
|
|
1527
|
-
{ bucketKey: 'follow_up_due', label: 'Follow-up Due', rank: 20, color: 'orange' },
|
|
1528
|
-
{ bucketKey: 'waiting', label: 'Waiting', rank: 30, color: 'blue' },
|
|
1529
|
-
{ bucketKey: 'stale', label: 'Stale', rank: 40, color: 'gray' },
|
|
1530
|
-
{ bucketKey: 'closed_low', label: 'Closed', rank: 50, color: 'dark' }
|
|
1593
|
+
export const CRM_PRIORITY_BUCKETS: CrmPriorityBucketDefinition[] = [
|
|
1594
|
+
{ bucketKey: 'needs_response', label: 'Needs Response', rank: 10, color: 'red' },
|
|
1595
|
+
{ bucketKey: 'follow_up_due', label: 'Follow-up Due', rank: 20, color: 'orange' },
|
|
1596
|
+
{ bucketKey: 'waiting', label: 'Waiting', rank: 30, color: 'blue' },
|
|
1597
|
+
{ bucketKey: 'stale', label: 'Stale', rank: 40, color: 'gray' },
|
|
1598
|
+
{ bucketKey: 'closed_low', label: 'Closed', rank: 50, color: 'dark' }
|
|
1531
1599
|
]
|
|
1532
1600
|
```
|
|
1533
1601
|
|
|
1534
1602
|
### `DEFAULT_CRM_PRIORITY_RULE_CONFIG`
|
|
1535
1603
|
|
|
1536
1604
|
```typescript
|
|
1537
|
-
export const DEFAULT_CRM_PRIORITY_RULE_CONFIG: CrmPriorityRuleConfig = {
|
|
1538
|
-
buckets: CRM_PRIORITY_BUCKETS,
|
|
1539
|
-
closedStageKeys: ['closed_won', 'closed_lost'],
|
|
1540
|
-
followUpAfterDaysByStateKey: {
|
|
1541
|
-
discovery_link_sent: 3,
|
|
1542
|
-
discovery_nudging: 2,
|
|
1543
|
-
reply_sent: 3,
|
|
1544
|
-
followup_1_sent: 3,
|
|
1545
|
-
followup_2_sent: 5,
|
|
1546
|
-
followup_3_sent: 7
|
|
1547
|
-
},
|
|
1548
|
-
staleAfterDays: 14
|
|
1605
|
+
export const DEFAULT_CRM_PRIORITY_RULE_CONFIG: CrmPriorityRuleConfig = {
|
|
1606
|
+
buckets: CRM_PRIORITY_BUCKETS,
|
|
1607
|
+
closedStageKeys: ['closed_won', 'closed_lost'],
|
|
1608
|
+
followUpAfterDaysByStateKey: {
|
|
1609
|
+
discovery_link_sent: 3,
|
|
1610
|
+
discovery_nudging: 2,
|
|
1611
|
+
reply_sent: 3,
|
|
1612
|
+
followup_1_sent: 3,
|
|
1613
|
+
followup_2_sent: 5,
|
|
1614
|
+
followup_3_sent: 7
|
|
1615
|
+
},
|
|
1616
|
+
staleAfterDays: 14
|
|
1549
1617
|
}
|
|
1550
1618
|
```
|
|
1551
1619
|
|
|
@@ -1564,242 +1632,242 @@ export const AcqDealTaskKindSchema = z.enum(['call', 'email', 'meeting', 'other'
|
|
|
1564
1632
|
### `DealIdParamsSchema`
|
|
1565
1633
|
|
|
1566
1634
|
```typescript
|
|
1567
|
-
export const DealIdParamsSchema = z.object({
|
|
1568
|
-
dealId: UuidSchema
|
|
1635
|
+
export const DealIdParamsSchema = z.object({
|
|
1636
|
+
dealId: UuidSchema
|
|
1569
1637
|
})
|
|
1570
1638
|
```
|
|
1571
1639
|
|
|
1572
1640
|
### `DealTaskIdParamsSchema`
|
|
1573
1641
|
|
|
1574
1642
|
```typescript
|
|
1575
|
-
export const DealTaskIdParamsSchema = z.object({
|
|
1576
|
-
dealId: UuidSchema,
|
|
1577
|
-
taskId: UuidSchema
|
|
1643
|
+
export const DealTaskIdParamsSchema = z.object({
|
|
1644
|
+
dealId: UuidSchema,
|
|
1645
|
+
taskId: UuidSchema
|
|
1578
1646
|
})
|
|
1579
1647
|
```
|
|
1580
1648
|
|
|
1581
1649
|
### `ListDealsQuerySchema`
|
|
1582
1650
|
|
|
1583
1651
|
```typescript
|
|
1584
|
-
export const ListDealsQuerySchema = z
|
|
1585
|
-
.object({
|
|
1586
|
-
stage: DealStageSchema.optional(),
|
|
1587
|
-
list: UuidSchema.optional(),
|
|
1588
|
-
batch: z.string().trim().min(1).max(255).optional(),
|
|
1589
|
-
staleSince: z.string().datetime().optional(),
|
|
1590
|
-
search: z.string().optional(),
|
|
1591
|
-
limit: z.coerce.number().int().positive().default(50),
|
|
1592
|
-
offset: z.coerce.number().int().min(0).default(0)
|
|
1593
|
-
})
|
|
1652
|
+
export const ListDealsQuerySchema = z
|
|
1653
|
+
.object({
|
|
1654
|
+
stage: DealStageSchema.optional(),
|
|
1655
|
+
list: UuidSchema.optional(),
|
|
1656
|
+
batch: z.string().trim().min(1).max(255).optional(),
|
|
1657
|
+
staleSince: z.string().datetime().optional(),
|
|
1658
|
+
search: z.string().optional(),
|
|
1659
|
+
limit: z.coerce.number().int().positive().default(50),
|
|
1660
|
+
offset: z.coerce.number().int().min(0).default(0)
|
|
1661
|
+
})
|
|
1594
1662
|
.strict()
|
|
1595
1663
|
```
|
|
1596
1664
|
|
|
1597
1665
|
### `DealLookupQuerySchema`
|
|
1598
1666
|
|
|
1599
1667
|
```typescript
|
|
1600
|
-
export const DealLookupQuerySchema = z
|
|
1601
|
-
.object({
|
|
1602
|
-
search: z.string().trim().min(1).max(200).optional(),
|
|
1603
|
-
limit: z.coerce.number().int().min(1).max(25).default(10)
|
|
1604
|
-
})
|
|
1668
|
+
export const DealLookupQuerySchema = z
|
|
1669
|
+
.object({
|
|
1670
|
+
search: z.string().trim().min(1).max(200).optional(),
|
|
1671
|
+
limit: z.coerce.number().int().min(1).max(25).default(10)
|
|
1672
|
+
})
|
|
1605
1673
|
.strict()
|
|
1606
1674
|
```
|
|
1607
1675
|
|
|
1608
1676
|
### `ListDealTasksDueQuerySchema`
|
|
1609
1677
|
|
|
1610
1678
|
```typescript
|
|
1611
|
-
export const ListDealTasksDueQuerySchema = z
|
|
1612
|
-
.object({
|
|
1613
|
-
window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
|
|
1614
|
-
assigneeUserId: UuidSchema.optional()
|
|
1615
|
-
})
|
|
1679
|
+
export const ListDealTasksDueQuerySchema = z
|
|
1680
|
+
.object({
|
|
1681
|
+
window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
|
|
1682
|
+
assigneeUserId: UuidSchema.optional()
|
|
1683
|
+
})
|
|
1616
1684
|
.strict()
|
|
1617
1685
|
```
|
|
1618
1686
|
|
|
1619
1687
|
### `CreateDealNoteRequestSchema`
|
|
1620
1688
|
|
|
1621
1689
|
```typescript
|
|
1622
|
-
export const CreateDealNoteRequestSchema = z
|
|
1623
|
-
.object({
|
|
1624
|
-
body: z.string().trim().min(1).max(10000)
|
|
1625
|
-
})
|
|
1690
|
+
export const CreateDealNoteRequestSchema = z
|
|
1691
|
+
.object({
|
|
1692
|
+
body: z.string().trim().min(1).max(10000)
|
|
1693
|
+
})
|
|
1626
1694
|
.strict()
|
|
1627
1695
|
```
|
|
1628
1696
|
|
|
1629
1697
|
### `CreateDealTaskRequestSchema`
|
|
1630
1698
|
|
|
1631
1699
|
```typescript
|
|
1632
|
-
export const CreateDealTaskRequestSchema = z
|
|
1633
|
-
.object({
|
|
1634
|
-
title: z.string().trim().min(1).max(255),
|
|
1635
|
-
description: z.string().nullable().optional(),
|
|
1636
|
-
kind: AcqDealTaskKindSchema.optional(),
|
|
1637
|
-
dueAt: z.string().datetime().nullable().optional(),
|
|
1638
|
-
assigneeUserId: UuidSchema.nullable().optional()
|
|
1639
|
-
})
|
|
1700
|
+
export const CreateDealTaskRequestSchema = z
|
|
1701
|
+
.object({
|
|
1702
|
+
title: z.string().trim().min(1).max(255),
|
|
1703
|
+
description: z.string().nullable().optional(),
|
|
1704
|
+
kind: AcqDealTaskKindSchema.optional(),
|
|
1705
|
+
dueAt: z.string().datetime().nullable().optional(),
|
|
1706
|
+
assigneeUserId: UuidSchema.nullable().optional()
|
|
1707
|
+
})
|
|
1640
1708
|
.strict()
|
|
1641
1709
|
```
|
|
1642
1710
|
|
|
1643
1711
|
### `TransitionItemRequestSchema`
|
|
1644
1712
|
|
|
1645
1713
|
```typescript
|
|
1646
|
-
export const TransitionItemRequestSchema = z
|
|
1647
|
-
.object({
|
|
1648
|
-
pipelineKey: z.string().min(1),
|
|
1649
|
-
stageKey: z.string().min(1),
|
|
1650
|
-
stateKey: z.string().min(1).nullable().optional(),
|
|
1651
|
-
reason: z.string().optional(),
|
|
1652
|
-
expectedUpdatedAt: z.string().datetime().optional()
|
|
1653
|
-
})
|
|
1714
|
+
export const TransitionItemRequestSchema = z
|
|
1715
|
+
.object({
|
|
1716
|
+
pipelineKey: z.string().min(1),
|
|
1717
|
+
stageKey: z.string().min(1),
|
|
1718
|
+
stateKey: z.string().min(1).nullable().optional(),
|
|
1719
|
+
reason: z.string().optional(),
|
|
1720
|
+
expectedUpdatedAt: z.string().datetime().optional()
|
|
1721
|
+
})
|
|
1654
1722
|
.strict()
|
|
1655
1723
|
```
|
|
1656
1724
|
|
|
1657
1725
|
### `ExecuteActionParamsSchema`
|
|
1658
1726
|
|
|
1659
1727
|
```typescript
|
|
1660
|
-
export const ExecuteActionParamsSchema = z
|
|
1661
|
-
.object({
|
|
1662
|
-
dealId: UuidSchema,
|
|
1663
|
-
actionKey: NonEmptyStringSchema
|
|
1664
|
-
})
|
|
1728
|
+
export const ExecuteActionParamsSchema = z
|
|
1729
|
+
.object({
|
|
1730
|
+
dealId: UuidSchema,
|
|
1731
|
+
actionKey: NonEmptyStringSchema
|
|
1732
|
+
})
|
|
1665
1733
|
.strict()
|
|
1666
1734
|
```
|
|
1667
1735
|
|
|
1668
1736
|
### `ExecuteActionRequestSchema`
|
|
1669
1737
|
|
|
1670
1738
|
```typescript
|
|
1671
|
-
export const ExecuteActionRequestSchema = z
|
|
1672
|
-
.object({
|
|
1673
|
-
payload: z.record(z.string(), z.unknown()).optional()
|
|
1674
|
-
})
|
|
1739
|
+
export const ExecuteActionRequestSchema = z
|
|
1740
|
+
.object({
|
|
1741
|
+
payload: z.record(z.string(), z.unknown()).optional()
|
|
1742
|
+
})
|
|
1675
1743
|
.strict()
|
|
1676
1744
|
```
|
|
1677
1745
|
|
|
1678
1746
|
### `DealContactSummarySchema`
|
|
1679
1747
|
|
|
1680
1748
|
```typescript
|
|
1681
|
-
/**
|
|
1682
|
-
* Contact summary nested inside DealListItem / DealDetailResponse.
|
|
1683
|
-
* Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
|
|
1684
|
-
*/
|
|
1685
|
-
export const DealContactSummarySchema = z.object({
|
|
1686
|
-
id: z.string(),
|
|
1687
|
-
first_name: z.string().nullable(),
|
|
1688
|
-
last_name: z.string().nullable(),
|
|
1689
|
-
email: z.string(),
|
|
1690
|
-
title: z.string().nullable(),
|
|
1691
|
-
headline: z.string().nullable(),
|
|
1692
|
-
linkedin_url: z.string().nullable(),
|
|
1693
|
-
processing_state: ProcessingStateSchema.nullable(),
|
|
1694
|
-
enrichment_data: z.record(z.string(), z.unknown()).nullable(),
|
|
1695
|
-
company: z
|
|
1696
|
-
.object({
|
|
1697
|
-
id: z.string(),
|
|
1698
|
-
name: z.string(),
|
|
1699
|
-
domain: z.string().nullable(),
|
|
1700
|
-
website: z.string().nullable(),
|
|
1701
|
-
linkedin_url: z.string().nullable(),
|
|
1702
|
-
segment: z.string().nullable(),
|
|
1703
|
-
category: z.string().nullable(),
|
|
1704
|
-
num_employees: z.number().nullable()
|
|
1705
|
-
})
|
|
1706
|
-
.nullable()
|
|
1749
|
+
/**
|
|
1750
|
+
* Contact summary nested inside DealListItem / DealDetailResponse.
|
|
1751
|
+
* Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
|
|
1752
|
+
*/
|
|
1753
|
+
export const DealContactSummarySchema = z.object({
|
|
1754
|
+
id: z.string(),
|
|
1755
|
+
first_name: z.string().nullable(),
|
|
1756
|
+
last_name: z.string().nullable(),
|
|
1757
|
+
email: z.string(),
|
|
1758
|
+
title: z.string().nullable(),
|
|
1759
|
+
headline: z.string().nullable(),
|
|
1760
|
+
linkedin_url: z.string().nullable(),
|
|
1761
|
+
processing_state: ProcessingStateSchema.nullable(),
|
|
1762
|
+
enrichment_data: z.record(z.string(), z.unknown()).nullable(),
|
|
1763
|
+
company: z
|
|
1764
|
+
.object({
|
|
1765
|
+
id: z.string(),
|
|
1766
|
+
name: z.string(),
|
|
1767
|
+
domain: z.string().nullable(),
|
|
1768
|
+
website: z.string().nullable(),
|
|
1769
|
+
linkedin_url: z.string().nullable(),
|
|
1770
|
+
segment: z.string().nullable(),
|
|
1771
|
+
category: z.string().nullable(),
|
|
1772
|
+
num_employees: z.number().nullable()
|
|
1773
|
+
})
|
|
1774
|
+
.nullable()
|
|
1707
1775
|
})
|
|
1708
1776
|
```
|
|
1709
1777
|
|
|
1710
1778
|
### `DealPrioritySchema`
|
|
1711
1779
|
|
|
1712
1780
|
```typescript
|
|
1713
|
-
export const DealPrioritySchema = z.object({
|
|
1714
|
-
bucketKey: z.enum(['needs_response', 'follow_up_due', 'waiting', 'stale', 'closed_low']),
|
|
1715
|
-
rank: z.number().int(),
|
|
1716
|
-
label: z.string(),
|
|
1717
|
-
color: z.string(),
|
|
1718
|
-
reason: z.string(),
|
|
1719
|
-
latestActivityAt: z.string().nullable(),
|
|
1720
|
-
nextActionAt: z.string().nullable()
|
|
1781
|
+
export const DealPrioritySchema = z.object({
|
|
1782
|
+
bucketKey: z.enum(['needs_response', 'follow_up_due', 'waiting', 'stale', 'closed_low']),
|
|
1783
|
+
rank: z.number().int(),
|
|
1784
|
+
label: z.string(),
|
|
1785
|
+
color: z.string(),
|
|
1786
|
+
reason: z.string(),
|
|
1787
|
+
latestActivityAt: z.string().nullable(),
|
|
1788
|
+
nextActionAt: z.string().nullable()
|
|
1721
1789
|
})
|
|
1722
1790
|
```
|
|
1723
1791
|
|
|
1724
1792
|
### `DealListItemSchema`
|
|
1725
1793
|
|
|
1726
1794
|
```typescript
|
|
1727
|
-
/**
|
|
1728
|
-
* Deal list item with joined contact (and company via contact).
|
|
1729
|
-
* Matches DealListItem from @repo/core types.
|
|
1730
|
-
*/
|
|
1731
|
-
export const DealListItemSchema = z.object({
|
|
1732
|
-
// acq_deals columns
|
|
1733
|
-
id: z.string(),
|
|
1734
|
-
organization_id: z.string(),
|
|
1735
|
-
client_id: z.string().nullable().optional(),
|
|
1736
|
-
contact_id: z.string().nullable(),
|
|
1737
|
-
contact_email: z.string(),
|
|
1738
|
-
pipeline_key: z.string(),
|
|
1739
|
-
stage_key: z.string().nullable(),
|
|
1740
|
-
state_key: z.string().nullable(),
|
|
1741
|
-
activity_log: z.unknown(),
|
|
1742
|
-
discovery_data: z.unknown().nullable(),
|
|
1743
|
-
discovery_submitted_at: z.string().nullable(),
|
|
1744
|
-
discovery_submitted_by: z.string().nullable(),
|
|
1745
|
-
proposal_data: z.unknown().nullable(),
|
|
1746
|
-
proposal_sent_at: z.string().nullable(),
|
|
1747
|
-
proposal_pdf_url: z.string().nullable(),
|
|
1748
|
-
signature_envelope_id: z.string().nullable(),
|
|
1749
|
-
source_list_id: z.string().nullable(),
|
|
1750
|
-
source_type: z.string().nullable(),
|
|
1751
|
-
initial_fee: z.number().nullable(),
|
|
1752
|
-
monthly_fee: z.number().nullable(),
|
|
1753
|
-
closed_lost_at: z.string().nullable(),
|
|
1754
|
-
closed_lost_reason: z.string().nullable(),
|
|
1755
|
-
created_at: z.string(),
|
|
1756
|
-
updated_at: z.string(),
|
|
1757
|
-
priority: DealPrioritySchema,
|
|
1758
|
-
ownership: z.enum(['us', 'them']).nullable(),
|
|
1759
|
-
nextAction: z.string().nullable(),
|
|
1760
|
-
// joined relation
|
|
1761
|
-
contact: DealContactSummarySchema.nullable()
|
|
1795
|
+
/**
|
|
1796
|
+
* Deal list item with joined contact (and company via contact).
|
|
1797
|
+
* Matches DealListItem from @repo/core types.
|
|
1798
|
+
*/
|
|
1799
|
+
export const DealListItemSchema = z.object({
|
|
1800
|
+
// acq_deals columns
|
|
1801
|
+
id: z.string(),
|
|
1802
|
+
organization_id: z.string(),
|
|
1803
|
+
client_id: z.string().nullable().optional(),
|
|
1804
|
+
contact_id: z.string().nullable(),
|
|
1805
|
+
contact_email: z.string(),
|
|
1806
|
+
pipeline_key: z.string(),
|
|
1807
|
+
stage_key: z.string().nullable(),
|
|
1808
|
+
state_key: z.string().nullable(),
|
|
1809
|
+
activity_log: z.unknown(),
|
|
1810
|
+
discovery_data: z.unknown().nullable(),
|
|
1811
|
+
discovery_submitted_at: z.string().nullable(),
|
|
1812
|
+
discovery_submitted_by: z.string().nullable(),
|
|
1813
|
+
proposal_data: z.unknown().nullable(),
|
|
1814
|
+
proposal_sent_at: z.string().nullable(),
|
|
1815
|
+
proposal_pdf_url: z.string().nullable(),
|
|
1816
|
+
signature_envelope_id: z.string().nullable(),
|
|
1817
|
+
source_list_id: z.string().nullable(),
|
|
1818
|
+
source_type: z.string().nullable(),
|
|
1819
|
+
initial_fee: z.number().nullable(),
|
|
1820
|
+
monthly_fee: z.number().nullable(),
|
|
1821
|
+
closed_lost_at: z.string().nullable(),
|
|
1822
|
+
closed_lost_reason: z.string().nullable(),
|
|
1823
|
+
created_at: z.string(),
|
|
1824
|
+
updated_at: z.string(),
|
|
1825
|
+
priority: DealPrioritySchema,
|
|
1826
|
+
ownership: z.enum(['us', 'them']).nullable(),
|
|
1827
|
+
nextAction: z.string().nullable(),
|
|
1828
|
+
// joined relation
|
|
1829
|
+
contact: DealContactSummarySchema.nullable()
|
|
1762
1830
|
})
|
|
1763
1831
|
```
|
|
1764
1832
|
|
|
1765
1833
|
### `DealListResponseSchema`
|
|
1766
1834
|
|
|
1767
1835
|
```typescript
|
|
1768
|
-
export const DealListResponseSchema = z.object({
|
|
1769
|
-
data: z.array(DealListItemSchema),
|
|
1770
|
-
total: z.number().int(),
|
|
1771
|
-
limit: z.number().int(),
|
|
1772
|
-
offset: z.number().int()
|
|
1836
|
+
export const DealListResponseSchema = z.object({
|
|
1837
|
+
data: z.array(DealListItemSchema),
|
|
1838
|
+
total: z.number().int(),
|
|
1839
|
+
limit: z.number().int(),
|
|
1840
|
+
offset: z.number().int()
|
|
1773
1841
|
})
|
|
1774
1842
|
```
|
|
1775
1843
|
|
|
1776
1844
|
### `DealDetailResponseSchema`
|
|
1777
1845
|
|
|
1778
1846
|
```typescript
|
|
1779
|
-
/**
|
|
1780
|
-
* Deal detail shape — currently the same as a list item (full joined record).
|
|
1781
|
-
* Additive fields keep existing DealListItem callers compatible.
|
|
1782
|
-
*/
|
|
1783
|
-
export const DealDetailResponseSchema = DealListItemSchema.extend({
|
|
1784
|
-
conversation: DealConversationSchema,
|
|
1785
|
-
lineage: DealLineageSchema.optional()
|
|
1847
|
+
/**
|
|
1848
|
+
* Deal detail shape — currently the same as a list item (full joined record).
|
|
1849
|
+
* Additive fields keep existing DealListItem callers compatible.
|
|
1850
|
+
*/
|
|
1851
|
+
export const DealDetailResponseSchema = DealListItemSchema.extend({
|
|
1852
|
+
conversation: DealConversationSchema,
|
|
1853
|
+
lineage: DealLineageSchema.optional()
|
|
1786
1854
|
})
|
|
1787
1855
|
```
|
|
1788
1856
|
|
|
1789
1857
|
### `DealNoteResponseSchema`
|
|
1790
1858
|
|
|
1791
1859
|
```typescript
|
|
1792
|
-
/**
|
|
1793
|
-
* Single acq_deal_notes row (camelCase API representation).
|
|
1794
|
-
*/
|
|
1795
|
-
export const DealNoteResponseSchema = z.object({
|
|
1796
|
-
id: z.string(),
|
|
1797
|
-
dealId: z.string(),
|
|
1798
|
-
organizationId: z.string(),
|
|
1799
|
-
authorUserId: z.string().nullable(),
|
|
1800
|
-
body: z.string(),
|
|
1801
|
-
createdAt: z.string(),
|
|
1802
|
-
updatedAt: z.string()
|
|
1860
|
+
/**
|
|
1861
|
+
* Single acq_deal_notes row (camelCase API representation).
|
|
1862
|
+
*/
|
|
1863
|
+
export const DealNoteResponseSchema = z.object({
|
|
1864
|
+
id: z.string(),
|
|
1865
|
+
dealId: z.string(),
|
|
1866
|
+
organizationId: z.string(),
|
|
1867
|
+
authorUserId: z.string().nullable(),
|
|
1868
|
+
body: z.string(),
|
|
1869
|
+
createdAt: z.string(),
|
|
1870
|
+
updatedAt: z.string()
|
|
1803
1871
|
})
|
|
1804
1872
|
```
|
|
1805
1873
|
|
|
@@ -1812,24 +1880,24 @@ export const DealNoteListResponseSchema = z.array(DealNoteResponseSchema)
|
|
|
1812
1880
|
### `DealTaskResponseSchema`
|
|
1813
1881
|
|
|
1814
1882
|
```typescript
|
|
1815
|
-
/**
|
|
1816
|
-
* Single acq_deal_tasks row (camelCase API representation).
|
|
1817
|
-
* Matches AcqDealTask domain type from types.ts.
|
|
1818
|
-
*/
|
|
1819
|
-
export const DealTaskResponseSchema = z.object({
|
|
1820
|
-
id: z.string(),
|
|
1821
|
-
organizationId: z.string(),
|
|
1822
|
-
dealId: z.string(),
|
|
1823
|
-
title: z.string(),
|
|
1824
|
-
description: z.string().nullable(),
|
|
1825
|
-
kind: AcqDealTaskKindSchema,
|
|
1826
|
-
dueAt: z.string().nullable(),
|
|
1827
|
-
assigneeUserId: z.string().nullable(),
|
|
1828
|
-
completedAt: z.string().nullable(),
|
|
1829
|
-
completedByUserId: z.string().nullable(),
|
|
1830
|
-
createdAt: z.string(),
|
|
1831
|
-
updatedAt: z.string(),
|
|
1832
|
-
createdByUserId: z.string().nullable()
|
|
1883
|
+
/**
|
|
1884
|
+
* Single acq_deal_tasks row (camelCase API representation).
|
|
1885
|
+
* Matches AcqDealTask domain type from types.ts.
|
|
1886
|
+
*/
|
|
1887
|
+
export const DealTaskResponseSchema = z.object({
|
|
1888
|
+
id: z.string(),
|
|
1889
|
+
organizationId: z.string(),
|
|
1890
|
+
dealId: z.string(),
|
|
1891
|
+
title: z.string(),
|
|
1892
|
+
description: z.string().nullable(),
|
|
1893
|
+
kind: AcqDealTaskKindSchema,
|
|
1894
|
+
dueAt: z.string().nullable(),
|
|
1895
|
+
assigneeUserId: z.string().nullable(),
|
|
1896
|
+
completedAt: z.string().nullable(),
|
|
1897
|
+
completedByUserId: z.string().nullable(),
|
|
1898
|
+
createdAt: z.string(),
|
|
1899
|
+
updatedAt: z.string(),
|
|
1900
|
+
createdByUserId: z.string().nullable()
|
|
1833
1901
|
})
|
|
1834
1902
|
```
|
|
1835
1903
|
|
|
@@ -1842,44 +1910,44 @@ export const DealTaskListResponseSchema = z.array(DealTaskResponseSchema)
|
|
|
1842
1910
|
### `DealSchemas`
|
|
1843
1911
|
|
|
1844
1912
|
```typescript
|
|
1845
|
-
export const DealSchemas = {
|
|
1846
|
-
// Primitives
|
|
1847
|
-
CrmStageKey: CrmStageKeySchema,
|
|
1848
|
-
CrmStateKey: CrmStateKeySchema,
|
|
1849
|
-
DealStage: DealStageSchema,
|
|
1850
|
-
|
|
1851
|
-
// Params
|
|
1852
|
-
DealIdParams: DealIdParamsSchema,
|
|
1853
|
-
DealTaskIdParams: DealTaskIdParamsSchema,
|
|
1854
|
-
|
|
1855
|
-
// Queries
|
|
1856
|
-
ListDealsQuery: ListDealsQuerySchema,
|
|
1857
|
-
DealLookupQuery: DealLookupQuerySchema,
|
|
1858
|
-
ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
|
|
1859
|
-
|
|
1860
|
-
// Request bodies
|
|
1861
|
-
CreateDealNoteRequest: CreateDealNoteRequestSchema,
|
|
1862
|
-
CreateDealTaskRequest: CreateDealTaskRequestSchema,
|
|
1863
|
-
TransitionItemRequest: CrmTransitionItemRequestSchema,
|
|
1864
|
-
TransitionDealStateRequest: TransitionDealStateRequestSchema,
|
|
1865
|
-
ExecuteActionParams: ExecuteActionParamsSchema,
|
|
1866
|
-
ExecuteActionRequest: ExecuteActionRequestSchema,
|
|
1867
|
-
|
|
1868
|
-
// Responses
|
|
1869
|
-
DealPriority: DealPrioritySchema,
|
|
1870
|
-
DealListResponse: DealListResponseSchema,
|
|
1871
|
-
DealSummaryResponse: DealSummaryResponseSchema,
|
|
1872
|
-
DealLookupResponse: DealLookupResponseSchema,
|
|
1873
|
-
ConversationMessage: ConversationMessageSchema,
|
|
1874
|
-
DealLineageListRef: DealLineageListRefSchema,
|
|
1875
|
-
DealLineageProjectRef: DealLineageProjectRefSchema,
|
|
1876
|
-
DealLineageClientRef: DealLineageClientRefSchema,
|
|
1877
|
-
DealLineage: DealLineageSchema,
|
|
1878
|
-
DealDetailResponse: DealDetailResponseSchema,
|
|
1879
|
-
DealNoteResponse: DealNoteResponseSchema,
|
|
1880
|
-
DealNoteListResponse: DealNoteListResponseSchema,
|
|
1881
|
-
DealTaskResponse: DealTaskResponseSchema,
|
|
1882
|
-
DealTaskListResponse: DealTaskListResponseSchema
|
|
1913
|
+
export const DealSchemas = {
|
|
1914
|
+
// Primitives
|
|
1915
|
+
CrmStageKey: CrmStageKeySchema,
|
|
1916
|
+
CrmStateKey: CrmStateKeySchema,
|
|
1917
|
+
DealStage: DealStageSchema,
|
|
1918
|
+
|
|
1919
|
+
// Params
|
|
1920
|
+
DealIdParams: DealIdParamsSchema,
|
|
1921
|
+
DealTaskIdParams: DealTaskIdParamsSchema,
|
|
1922
|
+
|
|
1923
|
+
// Queries
|
|
1924
|
+
ListDealsQuery: ListDealsQuerySchema,
|
|
1925
|
+
DealLookupQuery: DealLookupQuerySchema,
|
|
1926
|
+
ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
|
|
1927
|
+
|
|
1928
|
+
// Request bodies
|
|
1929
|
+
CreateDealNoteRequest: CreateDealNoteRequestSchema,
|
|
1930
|
+
CreateDealTaskRequest: CreateDealTaskRequestSchema,
|
|
1931
|
+
TransitionItemRequest: CrmTransitionItemRequestSchema,
|
|
1932
|
+
TransitionDealStateRequest: TransitionDealStateRequestSchema,
|
|
1933
|
+
ExecuteActionParams: ExecuteActionParamsSchema,
|
|
1934
|
+
ExecuteActionRequest: ExecuteActionRequestSchema,
|
|
1935
|
+
|
|
1936
|
+
// Responses
|
|
1937
|
+
DealPriority: DealPrioritySchema,
|
|
1938
|
+
DealListResponse: DealListResponseSchema,
|
|
1939
|
+
DealSummaryResponse: DealSummaryResponseSchema,
|
|
1940
|
+
DealLookupResponse: DealLookupResponseSchema,
|
|
1941
|
+
ConversationMessage: ConversationMessageSchema,
|
|
1942
|
+
DealLineageListRef: DealLineageListRefSchema,
|
|
1943
|
+
DealLineageProjectRef: DealLineageProjectRefSchema,
|
|
1944
|
+
DealLineageClientRef: DealLineageClientRefSchema,
|
|
1945
|
+
DealLineage: DealLineageSchema,
|
|
1946
|
+
DealDetailResponse: DealDetailResponseSchema,
|
|
1947
|
+
DealNoteResponse: DealNoteResponseSchema,
|
|
1948
|
+
DealNoteListResponse: DealNoteListResponseSchema,
|
|
1949
|
+
DealTaskResponse: DealTaskResponseSchema,
|
|
1950
|
+
DealTaskListResponse: DealTaskListResponseSchema
|
|
1883
1951
|
}
|
|
1884
1952
|
```
|
|
1885
1953
|
|
|
@@ -1896,12 +1964,12 @@ export interface Action {
|
|
|
1896
1964
|
### `ActionDef`
|
|
1897
1965
|
|
|
1898
1966
|
```typescript
|
|
1899
|
-
export interface ActionDef {
|
|
1900
|
-
key: string
|
|
1901
|
-
label: string
|
|
1902
|
-
isAvailableFor: (deal: AcqDealRow) => boolean
|
|
1903
|
-
workflowId: string
|
|
1904
|
-
payloadSchema?: z.ZodTypeAny
|
|
1967
|
+
export interface ActionDef {
|
|
1968
|
+
key: string
|
|
1969
|
+
label: string
|
|
1970
|
+
isAvailableFor: (deal: AcqDealRow) => boolean
|
|
1971
|
+
workflowId: string
|
|
1972
|
+
payloadSchema?: z.ZodTypeAny
|
|
1905
1973
|
}
|
|
1906
1974
|
```
|
|
1907
1975
|
|
|
@@ -1909,66 +1977,42 @@ export interface ActionDef {
|
|
|
1909
1977
|
|
|
1910
1978
|
```typescript
|
|
1911
1979
|
export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
|
|
1912
|
-
{
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
},
|
|
1918
|
-
{
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
workflowId: 'move_to_closing-workflow'
|
|
1923
|
-
},
|
|
1924
|
-
{
|
|
1925
|
-
key: 'move_to_closed_won',
|
|
1926
|
-
label: 'Close Won',
|
|
1927
|
-
isAvailableFor: (deal) => deal.stage_key === 'closing',
|
|
1928
|
-
workflowId: 'move_to_closed_won-workflow'
|
|
1929
|
-
},
|
|
1930
|
-
{
|
|
1931
|
-
key: 'move_to_closed_lost',
|
|
1932
|
-
label: 'Close Lost',
|
|
1980
|
+
crmAction('move_to_proposal', {
|
|
1981
|
+
isAvailableFor: (deal) => deal.stage_key === 'interested'
|
|
1982
|
+
}),
|
|
1983
|
+
crmAction('move_to_closing', {
|
|
1984
|
+
isAvailableFor: (deal) => deal.stage_key === 'proposal'
|
|
1985
|
+
}),
|
|
1986
|
+
crmAction('move_to_closed_won', {
|
|
1987
|
+
isAvailableFor: (deal) => deal.stage_key === 'closing'
|
|
1988
|
+
}),
|
|
1989
|
+
crmAction('move_to_closed_lost', {
|
|
1933
1990
|
isAvailableFor: (deal) =>
|
|
1934
|
-
deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing'
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
{
|
|
1938
|
-
key: 'move_to_nurturing',
|
|
1939
|
-
label: 'Move to Nurturing',
|
|
1991
|
+
deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing'
|
|
1992
|
+
}),
|
|
1993
|
+
crmAction('move_to_nurturing', {
|
|
1940
1994
|
isAvailableFor: (deal) =>
|
|
1941
|
-
deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing'
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
(deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
|
|
1951
|
-
deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
|
|
1952
|
-
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
1953
|
-
workflowId: 'crm-send-reply-workflow',
|
|
1995
|
+
deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing'
|
|
1996
|
+
}),
|
|
1997
|
+
crmAction('send_reply', {
|
|
1998
|
+
isAvailableFor: (deal) =>
|
|
1999
|
+
deal.stage_key === 'interested' &&
|
|
2000
|
+
isOurReplyAction(deal) &&
|
|
2001
|
+
(deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
|
|
2002
|
+
deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
|
|
2003
|
+
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
1954
2004
|
payloadSchema: SendReplyActionPayloadSchema
|
|
1955
|
-
},
|
|
1956
|
-
{
|
|
1957
|
-
key: 'send_link',
|
|
1958
|
-
label: 'Send Booking Link',
|
|
2005
|
+
}),
|
|
2006
|
+
crmAction('send_link', {
|
|
1959
2007
|
isAvailableFor: (deal) =>
|
|
1960
|
-
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
{
|
|
1964
|
-
key: 'send_nudge',
|
|
1965
|
-
label: 'Send Nudge',
|
|
2008
|
+
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey
|
|
2009
|
+
}),
|
|
2010
|
+
crmAction('send_nudge', {
|
|
1966
2011
|
isAvailableFor: (deal) =>
|
|
1967
2012
|
deal.stage_key === 'interested' &&
|
|
1968
2013
|
(deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
|
|
1969
|
-
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey)
|
|
1970
|
-
|
|
1971
|
-
},
|
|
2014
|
+
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey)
|
|
2015
|
+
}),
|
|
1972
2016
|
{
|
|
1973
2017
|
key: 'mark_no_show',
|
|
1974
2018
|
label: 'Mark No-Show',
|
|
@@ -1979,32 +2023,29 @@ export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
|
|
|
1979
2023
|
// event captures operator intent and distinguishes the manual variant from the timed one.
|
|
1980
2024
|
workflowId: 'mark_no_show-workflow'
|
|
1981
2025
|
},
|
|
1982
|
-
{
|
|
1983
|
-
key: 'rebook',
|
|
1984
|
-
label: 'Rebook',
|
|
2026
|
+
crmAction('rebook', {
|
|
1985
2027
|
isAvailableFor: (deal) =>
|
|
1986
|
-
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey
|
|
1987
|
-
|
|
1988
|
-
}
|
|
2028
|
+
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey
|
|
2029
|
+
})
|
|
1989
2030
|
]
|
|
1990
2031
|
```
|
|
1991
2032
|
|
|
1992
2033
|
### `CrmToolMap`
|
|
1993
2034
|
|
|
1994
2035
|
```typescript
|
|
1995
|
-
export type CrmToolMap = {
|
|
1996
|
-
getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
|
|
1997
|
-
listDeals: { params: CrmListDealsParams; result: DealListItem[] }
|
|
1998
|
-
getDeal: { params: CrmGetDealParams; result: DealDetail | null }
|
|
1999
|
-
getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
|
|
2000
|
-
createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
|
|
2001
|
-
listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
|
|
2002
|
-
createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
|
|
2003
|
-
listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
|
|
2004
|
-
listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
|
|
2005
|
-
completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
|
|
2006
|
-
recordActivity: { params: CrmRecordActivityParams; result: void }
|
|
2007
|
-
deleteDeal: { params: CrmDeleteDealParams; result: void }
|
|
2036
|
+
export type CrmToolMap = {
|
|
2037
|
+
getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
|
|
2038
|
+
listDeals: { params: CrmListDealsParams; result: DealListItem[] }
|
|
2039
|
+
getDeal: { params: CrmGetDealParams; result: DealDetail | null }
|
|
2040
|
+
getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
|
|
2041
|
+
createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
|
|
2042
|
+
listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
|
|
2043
|
+
createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
|
|
2044
|
+
listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
|
|
2045
|
+
listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
|
|
2046
|
+
completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
|
|
2047
|
+
recordActivity: { params: CrmRecordActivityParams; result: void }
|
|
2048
|
+
deleteDeal: { params: CrmDeleteDealParams; result: void }
|
|
2008
2049
|
}
|
|
2009
2050
|
```
|
|
2010
2051
|
|
|
@@ -2013,402 +2054,402 @@ export type CrmToolMap = {
|
|
|
2013
2054
|
### `WebPost`
|
|
2014
2055
|
|
|
2015
2056
|
```typescript
|
|
2016
|
-
/**
|
|
2017
|
-
* Represents a web post from company website scraping.
|
|
2018
|
-
* Used for recent blog posts, news, or announcements.
|
|
2019
|
-
*/
|
|
2020
|
-
export interface WebPost {
|
|
2021
|
-
/** ISO date string of when the post was published */
|
|
2022
|
-
date: string
|
|
2023
|
-
/** Title of the web post */
|
|
2024
|
-
title: string
|
|
2025
|
-
/** Brief summary of the post content */
|
|
2026
|
-
summary: string
|
|
2027
|
-
/** AI-generated insight about the post's relevance */
|
|
2028
|
-
aiInsight?: string
|
|
2057
|
+
/**
|
|
2058
|
+
* Represents a web post from company website scraping.
|
|
2059
|
+
* Used for recent blog posts, news, or announcements.
|
|
2060
|
+
*/
|
|
2061
|
+
export interface WebPost {
|
|
2062
|
+
/** ISO date string of when the post was published */
|
|
2063
|
+
date: string
|
|
2064
|
+
/** Title of the web post */
|
|
2065
|
+
title: string
|
|
2066
|
+
/** Brief summary of the post content */
|
|
2067
|
+
summary: string
|
|
2068
|
+
/** AI-generated insight about the post's relevance */
|
|
2069
|
+
aiInsight?: string
|
|
2029
2070
|
}
|
|
2030
2071
|
```
|
|
2031
2072
|
|
|
2032
2073
|
### `CompanyEnrichmentData`
|
|
2033
2074
|
|
|
2034
2075
|
```typescript
|
|
2035
|
-
/**
|
|
2036
|
-
* Enrichment data collected for a company from various sources.
|
|
2037
|
-
*/
|
|
2038
|
-
export interface CompanyEnrichmentData {
|
|
2039
|
-
googleMaps?: {
|
|
2040
|
-
placeId?: string
|
|
2041
|
-
totalScore?: number
|
|
2042
|
-
reviewsCount?: number
|
|
2043
|
-
address?: string
|
|
2044
|
-
phone?: string
|
|
2045
|
-
categoryName?: string
|
|
2046
|
-
googleMapsUrl?: string
|
|
2047
|
-
scrapedAt?: string
|
|
2048
|
-
}
|
|
2049
|
-
websiteCrawl?: {
|
|
2050
|
-
companyDescription?: string
|
|
2051
|
-
services?: string[]
|
|
2052
|
-
specialties?: string[]
|
|
2053
|
-
staff?: Array<{ name: string; title?: string; email?: string }>
|
|
2054
|
-
automationGaps?: string[]
|
|
2055
|
-
targetAudience?: string
|
|
2056
|
-
category?: string
|
|
2057
|
-
segment?: string
|
|
2058
|
-
recentWin?: string
|
|
2059
|
-
emailCount?: number
|
|
2060
|
-
pageCount?: number
|
|
2061
|
-
totalChars?: number
|
|
2062
|
-
crawledAt?: string
|
|
2063
|
-
extractedAt?: string
|
|
2064
|
-
}
|
|
2065
|
-
website?: {
|
|
2066
|
-
missionVision?: string
|
|
2067
|
-
uniqueAttributes?: string
|
|
2068
|
-
coreOfferings?: string
|
|
2069
|
-
targetAudience?: string
|
|
2070
|
-
companyValues?: string
|
|
2071
|
-
businessDescription?: string
|
|
2072
|
-
recentPosts?: Array<{ date?: string; title?: string; summary?: string; aiInsight?: string }>
|
|
2073
|
-
}
|
|
2074
|
-
tomba?: {
|
|
2075
|
-
waterfallEmail?: {
|
|
2076
|
-
email: string
|
|
2077
|
-
name?: string
|
|
2078
|
-
title?: string
|
|
2079
|
-
department?: string
|
|
2080
|
-
} | null
|
|
2081
|
-
genericEmail?: string | null
|
|
2082
|
-
totalFound?: number
|
|
2083
|
-
searchedAt?: string
|
|
2084
|
-
}
|
|
2076
|
+
/**
|
|
2077
|
+
* Enrichment data collected for a company from various sources.
|
|
2078
|
+
*/
|
|
2079
|
+
export interface CompanyEnrichmentData {
|
|
2080
|
+
googleMaps?: {
|
|
2081
|
+
placeId?: string
|
|
2082
|
+
totalScore?: number
|
|
2083
|
+
reviewsCount?: number
|
|
2084
|
+
address?: string
|
|
2085
|
+
phone?: string
|
|
2086
|
+
categoryName?: string
|
|
2087
|
+
googleMapsUrl?: string
|
|
2088
|
+
scrapedAt?: string
|
|
2089
|
+
}
|
|
2090
|
+
websiteCrawl?: {
|
|
2091
|
+
companyDescription?: string
|
|
2092
|
+
services?: string[]
|
|
2093
|
+
specialties?: string[]
|
|
2094
|
+
staff?: Array<{ name: string; title?: string; email?: string }>
|
|
2095
|
+
automationGaps?: string[]
|
|
2096
|
+
targetAudience?: string
|
|
2097
|
+
category?: string
|
|
2098
|
+
segment?: string
|
|
2099
|
+
recentWin?: string
|
|
2100
|
+
emailCount?: number
|
|
2101
|
+
pageCount?: number
|
|
2102
|
+
totalChars?: number
|
|
2103
|
+
crawledAt?: string
|
|
2104
|
+
extractedAt?: string
|
|
2105
|
+
}
|
|
2106
|
+
website?: {
|
|
2107
|
+
missionVision?: string
|
|
2108
|
+
uniqueAttributes?: string
|
|
2109
|
+
coreOfferings?: string
|
|
2110
|
+
targetAudience?: string
|
|
2111
|
+
companyValues?: string
|
|
2112
|
+
businessDescription?: string
|
|
2113
|
+
recentPosts?: Array<{ date?: string; title?: string; summary?: string; aiInsight?: string }>
|
|
2114
|
+
}
|
|
2115
|
+
tomba?: {
|
|
2116
|
+
waterfallEmail?: {
|
|
2117
|
+
email: string
|
|
2118
|
+
name?: string
|
|
2119
|
+
title?: string
|
|
2120
|
+
department?: string
|
|
2121
|
+
} | null
|
|
2122
|
+
genericEmail?: string | null
|
|
2123
|
+
totalFound?: number
|
|
2124
|
+
searchedAt?: string
|
|
2125
|
+
}
|
|
2085
2126
|
}
|
|
2086
2127
|
```
|
|
2087
2128
|
|
|
2088
2129
|
### `ContactEnrichmentData`
|
|
2089
2130
|
|
|
2090
2131
|
```typescript
|
|
2091
|
-
/**
|
|
2092
|
-
* Enrichment data collected for a contact from various sources.
|
|
2093
|
-
*/
|
|
2094
|
-
export interface ContactEnrichmentData {
|
|
2095
|
-
linkedin?: {
|
|
2096
|
-
summary?: string
|
|
2097
|
-
pastExperience?: string
|
|
2098
|
-
education?: string
|
|
2099
|
-
activity?: Array<{ date?: string; content?: string }>
|
|
2100
|
-
}
|
|
2132
|
+
/**
|
|
2133
|
+
* Enrichment data collected for a contact from various sources.
|
|
2134
|
+
*/
|
|
2135
|
+
export interface ContactEnrichmentData {
|
|
2136
|
+
linkedin?: {
|
|
2137
|
+
summary?: string
|
|
2138
|
+
pastExperience?: string
|
|
2139
|
+
education?: string
|
|
2140
|
+
activity?: Array<{ date?: string; content?: string }>
|
|
2141
|
+
}
|
|
2101
2142
|
}
|
|
2102
2143
|
```
|
|
2103
2144
|
|
|
2104
2145
|
### `AcqList`
|
|
2105
2146
|
|
|
2106
2147
|
```typescript
|
|
2107
|
-
export interface AcqList {
|
|
2108
|
-
id: string
|
|
2109
|
-
organizationId: string
|
|
2110
|
-
name: string
|
|
2111
|
-
description: string | null
|
|
2112
|
-
batchIds: string[]
|
|
2113
|
-
instantlyCampaignId: string | null
|
|
2114
|
-
status: ListStatus
|
|
2115
|
-
scrapingConfig: ScrapingConfig
|
|
2116
|
-
icp: IcpRubric
|
|
2117
|
-
pipelineConfig: PipelineConfig
|
|
2118
|
-
metadata: AcqListMetadata
|
|
2119
|
-
launchedAt: Date | null
|
|
2120
|
-
completedAt: Date | null
|
|
2121
|
-
createdAt: Date
|
|
2148
|
+
export interface AcqList {
|
|
2149
|
+
id: string
|
|
2150
|
+
organizationId: string
|
|
2151
|
+
name: string
|
|
2152
|
+
description: string | null
|
|
2153
|
+
batchIds: string[]
|
|
2154
|
+
instantlyCampaignId: string | null
|
|
2155
|
+
status: ListStatus
|
|
2156
|
+
scrapingConfig: ScrapingConfig
|
|
2157
|
+
icp: IcpRubric
|
|
2158
|
+
pipelineConfig: PipelineConfig
|
|
2159
|
+
metadata: AcqListMetadata
|
|
2160
|
+
launchedAt: Date | null
|
|
2161
|
+
completedAt: Date | null
|
|
2162
|
+
createdAt: Date
|
|
2122
2163
|
}
|
|
2123
2164
|
```
|
|
2124
2165
|
|
|
2125
2166
|
### `AcqCompany`
|
|
2126
2167
|
|
|
2127
2168
|
```typescript
|
|
2128
|
-
/**
|
|
2129
|
-
* Company record in the acquisition database.
|
|
2130
|
-
* Contains enriched company data from various sources.
|
|
2131
|
-
* Transformed from AcqCompanyRow with camelCase properties.
|
|
2132
|
-
*/
|
|
2133
|
-
export interface AcqCompany {
|
|
2134
|
-
id: string
|
|
2135
|
-
organizationId: string
|
|
2136
|
-
name: string
|
|
2137
|
-
domain: string | null
|
|
2138
|
-
linkedinUrl: string | null
|
|
2139
|
-
website: string | null
|
|
2140
|
-
numEmployees: number | null
|
|
2141
|
-
foundedYear: number | null
|
|
2142
|
-
locationCity: string | null
|
|
2143
|
-
locationState: string | null
|
|
2144
|
-
category: string | null
|
|
2145
|
-
categoryPain: string | null
|
|
2146
|
-
segment: string | null
|
|
2147
|
-
processingState: CompanyProcessingState | null
|
|
2148
|
-
/** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
|
|
2149
|
-
pipelineStatus?: LegacyPipelineStatus | null
|
|
2150
|
-
enrichmentData: CompanyEnrichmentData | null
|
|
2151
|
-
source: string | null
|
|
2152
|
-
batchId: string | null
|
|
2153
|
-
status: 'active' | 'invalid'
|
|
2154
|
-
verticalResearch: string | null
|
|
2155
|
-
/** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
|
|
2156
|
-
qualificationScore: number | null
|
|
2157
|
-
/** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
|
|
2158
|
-
qualificationSignals: Record<string, unknown> | null
|
|
2159
|
-
/** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
|
|
2160
|
-
qualificationRubricKey: string | null
|
|
2161
|
-
createdAt: Date
|
|
2162
|
-
updatedAt: Date
|
|
2169
|
+
/**
|
|
2170
|
+
* Company record in the acquisition database.
|
|
2171
|
+
* Contains enriched company data from various sources.
|
|
2172
|
+
* Transformed from AcqCompanyRow with camelCase properties.
|
|
2173
|
+
*/
|
|
2174
|
+
export interface AcqCompany {
|
|
2175
|
+
id: string
|
|
2176
|
+
organizationId: string
|
|
2177
|
+
name: string
|
|
2178
|
+
domain: string | null
|
|
2179
|
+
linkedinUrl: string | null
|
|
2180
|
+
website: string | null
|
|
2181
|
+
numEmployees: number | null
|
|
2182
|
+
foundedYear: number | null
|
|
2183
|
+
locationCity: string | null
|
|
2184
|
+
locationState: string | null
|
|
2185
|
+
category: string | null
|
|
2186
|
+
categoryPain: string | null
|
|
2187
|
+
segment: string | null
|
|
2188
|
+
processingState: CompanyProcessingState | null
|
|
2189
|
+
/** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
|
|
2190
|
+
pipelineStatus?: LegacyPipelineStatus | null
|
|
2191
|
+
enrichmentData: CompanyEnrichmentData | null
|
|
2192
|
+
source: string | null
|
|
2193
|
+
batchId: string | null
|
|
2194
|
+
status: 'active' | 'invalid'
|
|
2195
|
+
verticalResearch: string | null
|
|
2196
|
+
/** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
|
|
2197
|
+
qualificationScore: number | null
|
|
2198
|
+
/** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
|
|
2199
|
+
qualificationSignals: Record<string, unknown> | null
|
|
2200
|
+
/** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
|
|
2201
|
+
qualificationRubricKey: string | null
|
|
2202
|
+
createdAt: Date
|
|
2203
|
+
updatedAt: Date
|
|
2163
2204
|
}
|
|
2164
2205
|
```
|
|
2165
2206
|
|
|
2166
2207
|
### `AcqContact`
|
|
2167
2208
|
|
|
2168
2209
|
```typescript
|
|
2169
|
-
/**
|
|
2170
|
-
* Contact record in the acquisition database.
|
|
2171
|
-
* Contains enriched contact data and personalization content.
|
|
2172
|
-
* Transformed from AcqContactRow with camelCase properties.
|
|
2173
|
-
*/
|
|
2174
|
-
export interface AcqContact {
|
|
2175
|
-
id: string
|
|
2176
|
-
organizationId: string
|
|
2177
|
-
companyId: string | null
|
|
2178
|
-
email: string
|
|
2179
|
-
emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
|
|
2180
|
-
firstName: string | null
|
|
2181
|
-
lastName: string | null
|
|
2182
|
-
linkedinUrl: string | null
|
|
2183
|
-
title: string | null
|
|
2184
|
-
headline: string | null
|
|
2185
|
-
filterReason: string | null
|
|
2186
|
-
openingLine: string | null
|
|
2187
|
-
source: string | null
|
|
2188
|
-
sourceId: string | null
|
|
2189
|
-
processingState: ContactProcessingState | null
|
|
2190
|
-
/** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
|
|
2191
|
-
pipelineStatus?: LegacyPipelineStatus | null
|
|
2192
|
-
enrichmentData: ContactEnrichmentData | null
|
|
2193
|
-
/** Attio Person record ID - set when contact responds and is added to CRM */
|
|
2194
|
-
attioPersonId: string | null
|
|
2195
|
-
batchId: string | null
|
|
2196
|
-
status: 'active' | 'invalid'
|
|
2197
|
-
createdAt: Date
|
|
2198
|
-
updatedAt: Date
|
|
2210
|
+
/**
|
|
2211
|
+
* Contact record in the acquisition database.
|
|
2212
|
+
* Contains enriched contact data and personalization content.
|
|
2213
|
+
* Transformed from AcqContactRow with camelCase properties.
|
|
2214
|
+
*/
|
|
2215
|
+
export interface AcqContact {
|
|
2216
|
+
id: string
|
|
2217
|
+
organizationId: string
|
|
2218
|
+
companyId: string | null
|
|
2219
|
+
email: string
|
|
2220
|
+
emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
|
|
2221
|
+
firstName: string | null
|
|
2222
|
+
lastName: string | null
|
|
2223
|
+
linkedinUrl: string | null
|
|
2224
|
+
title: string | null
|
|
2225
|
+
headline: string | null
|
|
2226
|
+
filterReason: string | null
|
|
2227
|
+
openingLine: string | null
|
|
2228
|
+
source: string | null
|
|
2229
|
+
sourceId: string | null
|
|
2230
|
+
processingState: ContactProcessingState | null
|
|
2231
|
+
/** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
|
|
2232
|
+
pipelineStatus?: LegacyPipelineStatus | null
|
|
2233
|
+
enrichmentData: ContactEnrichmentData | null
|
|
2234
|
+
/** Attio Person record ID - set when contact responds and is added to CRM */
|
|
2235
|
+
attioPersonId: string | null
|
|
2236
|
+
batchId: string | null
|
|
2237
|
+
status: 'active' | 'invalid'
|
|
2238
|
+
createdAt: Date
|
|
2239
|
+
updatedAt: Date
|
|
2199
2240
|
}
|
|
2200
2241
|
```
|
|
2201
2242
|
|
|
2202
2243
|
### `ListTelemetry`
|
|
2203
2244
|
|
|
2204
2245
|
```typescript
|
|
2205
|
-
/**
|
|
2206
|
-
* Live-scan aggregate telemetry for a single list, computed on demand from
|
|
2207
|
-
* the list junction tables and current contact deliverability state.
|
|
2208
|
-
* `stageCounts` are attempted counts from list-row processing_state.
|
|
2209
|
-
*/
|
|
2210
|
-
export interface ListTelemetry {
|
|
2211
|
-
listId: string
|
|
2212
|
-
totalCompanies: number
|
|
2213
|
-
totalContacts: number
|
|
2214
|
-
stageCounts: {
|
|
2215
|
-
populated: number
|
|
2216
|
-
extracted: number
|
|
2217
|
-
qualified: number
|
|
2218
|
-
discovered: number
|
|
2219
|
-
verified: number
|
|
2220
|
-
personalized: number
|
|
2221
|
-
uploaded: number
|
|
2222
|
-
}
|
|
2223
|
-
deliverability: {
|
|
2224
|
-
valid: number
|
|
2225
|
-
risky: number
|
|
2226
|
-
invalid: number
|
|
2227
|
-
unknown: number
|
|
2228
|
-
bounced: number
|
|
2229
|
-
}
|
|
2230
|
-
/** Reserved -- active workflow IDs associated with this list. */
|
|
2231
|
-
activeWorkflows?: string[]
|
|
2246
|
+
/**
|
|
2247
|
+
* Live-scan aggregate telemetry for a single list, computed on demand from
|
|
2248
|
+
* the list junction tables and current contact deliverability state.
|
|
2249
|
+
* `stageCounts` are attempted counts from list-row processing_state.
|
|
2250
|
+
*/
|
|
2251
|
+
export interface ListTelemetry {
|
|
2252
|
+
listId: string
|
|
2253
|
+
totalCompanies: number
|
|
2254
|
+
totalContacts: number
|
|
2255
|
+
stageCounts: {
|
|
2256
|
+
populated: number
|
|
2257
|
+
extracted: number
|
|
2258
|
+
qualified: number
|
|
2259
|
+
discovered: number
|
|
2260
|
+
verified: number
|
|
2261
|
+
personalized: number
|
|
2262
|
+
uploaded: number
|
|
2263
|
+
}
|
|
2264
|
+
deliverability: {
|
|
2265
|
+
valid: number
|
|
2266
|
+
risky: number
|
|
2267
|
+
invalid: number
|
|
2268
|
+
unknown: number
|
|
2269
|
+
bounced: number
|
|
2270
|
+
}
|
|
2271
|
+
/** Reserved -- active workflow IDs associated with this list. */
|
|
2272
|
+
activeWorkflows?: string[]
|
|
2232
2273
|
}
|
|
2233
2274
|
```
|
|
2234
2275
|
|
|
2235
2276
|
### `ListStageCountsSchema`
|
|
2236
2277
|
|
|
2237
2278
|
```typescript
|
|
2238
|
-
export const ListStageCountsSchema = z.object({
|
|
2239
|
-
// Attempted counts by canonical lead-gen stage. The detailed status
|
|
2240
|
-
// distribution lives on ListProgress; telemetry keeps the overview payload small.
|
|
2241
|
-
stageCounts: z.object({
|
|
2242
|
-
populated: z.number().int(),
|
|
2243
|
-
extracted: z.number().int(),
|
|
2244
|
-
qualified: z.number().int(),
|
|
2245
|
-
discovered: z.number().int(),
|
|
2246
|
-
verified: z.number().int(),
|
|
2247
|
-
personalized: z.number().int(),
|
|
2248
|
-
uploaded: z.number().int()
|
|
2249
|
-
}),
|
|
2250
|
-
deliverability: z.object({
|
|
2251
|
-
valid: z.number().int(),
|
|
2252
|
-
risky: z.number().int(),
|
|
2253
|
-
invalid: z.number().int(),
|
|
2254
|
-
unknown: z.number().int(),
|
|
2255
|
-
bounced: z.number().int()
|
|
2256
|
-
})
|
|
2279
|
+
export const ListStageCountsSchema = z.object({
|
|
2280
|
+
// Attempted counts by canonical lead-gen stage. The detailed status
|
|
2281
|
+
// distribution lives on ListProgress; telemetry keeps the overview payload small.
|
|
2282
|
+
stageCounts: z.object({
|
|
2283
|
+
populated: z.number().int(),
|
|
2284
|
+
extracted: z.number().int(),
|
|
2285
|
+
qualified: z.number().int(),
|
|
2286
|
+
discovered: z.number().int(),
|
|
2287
|
+
verified: z.number().int(),
|
|
2288
|
+
personalized: z.number().int(),
|
|
2289
|
+
uploaded: z.number().int()
|
|
2290
|
+
}),
|
|
2291
|
+
deliverability: z.object({
|
|
2292
|
+
valid: z.number().int(),
|
|
2293
|
+
risky: z.number().int(),
|
|
2294
|
+
invalid: z.number().int(),
|
|
2295
|
+
unknown: z.number().int(),
|
|
2296
|
+
bounced: z.number().int()
|
|
2297
|
+
})
|
|
2257
2298
|
})
|
|
2258
2299
|
```
|
|
2259
2300
|
|
|
2260
2301
|
### `ListTelemetrySchema`
|
|
2261
2302
|
|
|
2262
2303
|
```typescript
|
|
2263
|
-
export const ListTelemetrySchema = z.object({
|
|
2264
|
-
listId: UuidSchema,
|
|
2265
|
-
totalCompanies: z.number().int(),
|
|
2266
|
-
totalContacts: z.number().int(),
|
|
2267
|
-
stageCounts: ListStageCountsSchema.shape.stageCounts,
|
|
2268
|
-
deliverability: ListStageCountsSchema.shape.deliverability,
|
|
2269
|
-
activeWorkflows: z.array(z.string()).optional()
|
|
2304
|
+
export const ListTelemetrySchema = z.object({
|
|
2305
|
+
listId: UuidSchema,
|
|
2306
|
+
totalCompanies: z.number().int(),
|
|
2307
|
+
totalContacts: z.number().int(),
|
|
2308
|
+
stageCounts: ListStageCountsSchema.shape.stageCounts,
|
|
2309
|
+
deliverability: ListStageCountsSchema.shape.deliverability,
|
|
2310
|
+
activeWorkflows: z.array(z.string()).optional()
|
|
2270
2311
|
})
|
|
2271
2312
|
```
|
|
2272
2313
|
|
|
2273
2314
|
### `ListIdParamsSchema`
|
|
2274
2315
|
|
|
2275
2316
|
```typescript
|
|
2276
|
-
export const ListIdParamsSchema = z.object({
|
|
2277
|
-
listId: UuidSchema
|
|
2317
|
+
export const ListIdParamsSchema = z.object({
|
|
2318
|
+
listId: UuidSchema
|
|
2278
2319
|
})
|
|
2279
2320
|
```
|
|
2280
2321
|
|
|
2281
2322
|
### `CreateListRequestSchema`
|
|
2282
2323
|
|
|
2283
2324
|
```typescript
|
|
2284
|
-
export const CreateListRequestSchema = z
|
|
2285
|
-
.object({
|
|
2286
|
-
name: z.string().trim().min(1).max(255),
|
|
2287
|
-
description: z.string().trim().nullable().optional(),
|
|
2288
|
-
status: ListStatusSchema.optional(),
|
|
2289
|
-
buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
|
|
2290
|
-
scrapingConfig: ScrapingConfigSchema.optional(),
|
|
2291
|
-
icp: IcpRubricSchema.optional(),
|
|
2292
|
-
pipelineConfig: PipelineConfigSchema.optional()
|
|
2293
|
-
})
|
|
2325
|
+
export const CreateListRequestSchema = z
|
|
2326
|
+
.object({
|
|
2327
|
+
name: z.string().trim().min(1).max(255),
|
|
2328
|
+
description: z.string().trim().nullable().optional(),
|
|
2329
|
+
status: ListStatusSchema.optional(),
|
|
2330
|
+
buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
|
|
2331
|
+
scrapingConfig: ScrapingConfigSchema.optional(),
|
|
2332
|
+
icp: IcpRubricSchema.optional(),
|
|
2333
|
+
pipelineConfig: PipelineConfigSchema.optional()
|
|
2334
|
+
})
|
|
2294
2335
|
.strict()
|
|
2295
2336
|
```
|
|
2296
2337
|
|
|
2297
2338
|
### `UpdateListRequestSchema`
|
|
2298
2339
|
|
|
2299
2340
|
```typescript
|
|
2300
|
-
export const UpdateListRequestSchema = z
|
|
2301
|
-
.object({
|
|
2302
|
-
name: z.string().trim().min(1).max(255).optional(),
|
|
2303
|
-
description: z.string().trim().nullable().optional(),
|
|
2304
|
-
batchIds: z.array(z.string()).optional(),
|
|
2305
|
-
buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
|
|
2306
|
-
confirmBuildTemplateChange: z.literal(true).optional()
|
|
2307
|
-
})
|
|
2308
|
-
.strict()
|
|
2309
|
-
.refine(
|
|
2310
|
-
(data) =>
|
|
2311
|
-
data.name !== undefined ||
|
|
2312
|
-
data.description !== undefined ||
|
|
2313
|
-
data.batchIds !== undefined ||
|
|
2314
|
-
data.buildTemplateId !== undefined,
|
|
2315
|
-
{
|
|
2316
|
-
message: 'At least one field (name, description, batchIds, or buildTemplateId) must be provided'
|
|
2317
|
-
}
|
|
2318
|
-
)
|
|
2319
|
-
.refine((data) => data.buildTemplateId === undefined || data.confirmBuildTemplateChange === true, {
|
|
2320
|
-
message: 'confirmBuildTemplateChange must be true when changing buildTemplateId',
|
|
2321
|
-
path: ['confirmBuildTemplateChange']
|
|
2341
|
+
export const UpdateListRequestSchema = z
|
|
2342
|
+
.object({
|
|
2343
|
+
name: z.string().trim().min(1).max(255).optional(),
|
|
2344
|
+
description: z.string().trim().nullable().optional(),
|
|
2345
|
+
batchIds: z.array(z.string()).optional(),
|
|
2346
|
+
buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
|
|
2347
|
+
confirmBuildTemplateChange: z.literal(true).optional()
|
|
2348
|
+
})
|
|
2349
|
+
.strict()
|
|
2350
|
+
.refine(
|
|
2351
|
+
(data) =>
|
|
2352
|
+
data.name !== undefined ||
|
|
2353
|
+
data.description !== undefined ||
|
|
2354
|
+
data.batchIds !== undefined ||
|
|
2355
|
+
data.buildTemplateId !== undefined,
|
|
2356
|
+
{
|
|
2357
|
+
message: 'At least one field (name, description, batchIds, or buildTemplateId) must be provided'
|
|
2358
|
+
}
|
|
2359
|
+
)
|
|
2360
|
+
.refine((data) => data.buildTemplateId === undefined || data.confirmBuildTemplateChange === true, {
|
|
2361
|
+
message: 'confirmBuildTemplateChange must be true when changing buildTemplateId',
|
|
2362
|
+
path: ['confirmBuildTemplateChange']
|
|
2322
2363
|
})
|
|
2323
2364
|
```
|
|
2324
2365
|
|
|
2325
2366
|
### `UpdateListConfigRequestSchema`
|
|
2326
2367
|
|
|
2327
2368
|
```typescript
|
|
2328
|
-
/**
|
|
2329
|
-
* Partial patch for the three jsonb config columns. UI sends only the edited
|
|
2330
|
-
* subtree; server writes the field as-is (no deep merge — each column is
|
|
2331
|
-
* replaced atomically when present in the patch).
|
|
2332
|
-
*/
|
|
2333
|
-
export const UpdateListConfigRequestSchema = z
|
|
2334
|
-
.object({
|
|
2335
|
-
scrapingConfig: ScrapingConfigSchema.partial().optional(),
|
|
2336
|
-
icp: IcpRubricSchema.partial().optional(),
|
|
2337
|
-
pipelineConfig: PipelineConfigSchema.partial().optional()
|
|
2338
|
-
})
|
|
2339
|
-
.strict()
|
|
2340
|
-
.refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
|
|
2341
|
-
message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
|
|
2369
|
+
/**
|
|
2370
|
+
* Partial patch for the three jsonb config columns. UI sends only the edited
|
|
2371
|
+
* subtree; server writes the field as-is (no deep merge — each column is
|
|
2372
|
+
* replaced atomically when present in the patch).
|
|
2373
|
+
*/
|
|
2374
|
+
export const UpdateListConfigRequestSchema = z
|
|
2375
|
+
.object({
|
|
2376
|
+
scrapingConfig: ScrapingConfigSchema.partial().optional(),
|
|
2377
|
+
icp: IcpRubricSchema.partial().optional(),
|
|
2378
|
+
pipelineConfig: PipelineConfigSchema.partial().optional()
|
|
2379
|
+
})
|
|
2380
|
+
.strict()
|
|
2381
|
+
.refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
|
|
2382
|
+
message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
|
|
2342
2383
|
})
|
|
2343
2384
|
```
|
|
2344
2385
|
|
|
2345
2386
|
### `AddCompaniesToListRequestSchema`
|
|
2346
2387
|
|
|
2347
2388
|
```typescript
|
|
2348
|
-
export const AddCompaniesToListRequestSchema = z
|
|
2349
|
-
.object({
|
|
2350
|
-
companyIds: z.array(UuidSchema).min(1).max(1000)
|
|
2351
|
-
})
|
|
2389
|
+
export const AddCompaniesToListRequestSchema = z
|
|
2390
|
+
.object({
|
|
2391
|
+
companyIds: z.array(UuidSchema).min(1).max(1000)
|
|
2392
|
+
})
|
|
2352
2393
|
.strict()
|
|
2353
2394
|
```
|
|
2354
2395
|
|
|
2355
2396
|
### `RemoveCompaniesFromListRequestSchema`
|
|
2356
2397
|
|
|
2357
2398
|
```typescript
|
|
2358
|
-
export const RemoveCompaniesFromListRequestSchema = z
|
|
2359
|
-
.object({
|
|
2360
|
-
companyIds: z.array(UuidSchema).min(1).max(1000)
|
|
2361
|
-
})
|
|
2399
|
+
export const RemoveCompaniesFromListRequestSchema = z
|
|
2400
|
+
.object({
|
|
2401
|
+
companyIds: z.array(UuidSchema).min(1).max(1000)
|
|
2402
|
+
})
|
|
2362
2403
|
.strict()
|
|
2363
2404
|
```
|
|
2364
2405
|
|
|
2365
2406
|
### `AddContactsToListRequestSchema`
|
|
2366
2407
|
|
|
2367
2408
|
```typescript
|
|
2368
|
-
export const AddContactsToListRequestSchema = z
|
|
2369
|
-
.object({
|
|
2370
|
-
contactIds: z.array(UuidSchema).min(1).max(1000)
|
|
2371
|
-
})
|
|
2409
|
+
export const AddContactsToListRequestSchema = z
|
|
2410
|
+
.object({
|
|
2411
|
+
contactIds: z.array(UuidSchema).min(1).max(1000)
|
|
2412
|
+
})
|
|
2372
2413
|
.strict()
|
|
2373
2414
|
```
|
|
2374
2415
|
|
|
2375
2416
|
### `RecordListExecutionRequestSchema`
|
|
2376
2417
|
|
|
2377
2418
|
```typescript
|
|
2378
|
-
export const RecordListExecutionRequestSchema = z
|
|
2379
|
-
.object({
|
|
2380
|
-
executionId: UuidSchema,
|
|
2381
|
-
configSnapshot: z.record(z.string(), z.unknown()).optional()
|
|
2382
|
-
})
|
|
2419
|
+
export const RecordListExecutionRequestSchema = z
|
|
2420
|
+
.object({
|
|
2421
|
+
executionId: UuidSchema,
|
|
2422
|
+
configSnapshot: z.record(z.string(), z.unknown()).optional()
|
|
2423
|
+
})
|
|
2383
2424
|
.strict()
|
|
2384
2425
|
```
|
|
2385
2426
|
|
|
2386
2427
|
### `AcqListResponseSchema`
|
|
2387
2428
|
|
|
2388
2429
|
```typescript
|
|
2389
|
-
/**
|
|
2390
|
-
* Single list as returned by /api/acquisition/lists/:id etc.
|
|
2391
|
-
* Camel-cased domain shape matching AcqList in types.ts.
|
|
2392
|
-
*/
|
|
2393
|
-
export const AcqListResponseSchema = z.object({
|
|
2394
|
-
id: z.string(),
|
|
2395
|
-
organizationId: z.string(),
|
|
2396
|
-
name: z.string(),
|
|
2397
|
-
description: z.string().nullable(),
|
|
2398
|
-
batchIds: z.array(z.string()),
|
|
2399
|
-
instantlyCampaignId: z.string().nullable(),
|
|
2400
|
-
/** Lifecycle status (draft | enriching | launched | closing | archived). */
|
|
2401
|
-
status: ListStatusSchema,
|
|
2402
|
-
metadata: AcqListMetadataSchema,
|
|
2403
|
-
launchedAt: z.string().nullable(),
|
|
2404
|
-
completedAt: z.string().nullable(),
|
|
2405
|
-
createdAt: z.string(),
|
|
2406
|
-
/** Scraping criteria stored as jsonb on the row. */
|
|
2407
|
-
scrapingConfig: ScrapingConfigSchema,
|
|
2408
|
-
/** ICP / qualification rubric stored as jsonb on the row. */
|
|
2409
|
-
icp: IcpRubricSchema,
|
|
2410
|
-
/** Pipeline presentation contract stored as jsonb on the row. */
|
|
2411
|
-
pipelineConfig: PipelineConfigSchema
|
|
2430
|
+
/**
|
|
2431
|
+
* Single list as returned by /api/acquisition/lists/:id etc.
|
|
2432
|
+
* Camel-cased domain shape matching AcqList in types.ts.
|
|
2433
|
+
*/
|
|
2434
|
+
export const AcqListResponseSchema = z.object({
|
|
2435
|
+
id: z.string(),
|
|
2436
|
+
organizationId: z.string(),
|
|
2437
|
+
name: z.string(),
|
|
2438
|
+
description: z.string().nullable(),
|
|
2439
|
+
batchIds: z.array(z.string()),
|
|
2440
|
+
instantlyCampaignId: z.string().nullable(),
|
|
2441
|
+
/** Lifecycle status (draft | enriching | launched | closing | archived). */
|
|
2442
|
+
status: ListStatusSchema,
|
|
2443
|
+
metadata: AcqListMetadataSchema,
|
|
2444
|
+
launchedAt: z.string().nullable(),
|
|
2445
|
+
completedAt: z.string().nullable(),
|
|
2446
|
+
createdAt: z.string(),
|
|
2447
|
+
/** Scraping criteria stored as jsonb on the row. */
|
|
2448
|
+
scrapingConfig: ScrapingConfigSchema,
|
|
2449
|
+
/** ICP / qualification rubric stored as jsonb on the row. */
|
|
2450
|
+
icp: IcpRubricSchema,
|
|
2451
|
+
/** Pipeline presentation contract stored as jsonb on the row. */
|
|
2452
|
+
pipelineConfig: PipelineConfigSchema
|
|
2412
2453
|
})
|
|
2413
2454
|
```
|
|
2414
2455
|
|
|
@@ -2433,18 +2474,18 @@ export const ListTelemetryListResponseSchema = z.array(ListTelemetrySchema)
|
|
|
2433
2474
|
### `ListExecutionSummarySchema`
|
|
2434
2475
|
|
|
2435
2476
|
```typescript
|
|
2436
|
-
/**
|
|
2437
|
-
* Row from acq_list_executions joined with the execution summary,
|
|
2438
|
-
* shaped for the /lists/:id/executions response.
|
|
2439
|
-
*/
|
|
2440
|
-
export const ListExecutionSummarySchema = z.object({
|
|
2441
|
-
executionId: z.string(),
|
|
2442
|
-
resourceId: z.string(),
|
|
2443
|
-
status: z.string(),
|
|
2444
|
-
createdAt: z.string(),
|
|
2445
|
-
completedAt: z.string().nullable(),
|
|
2446
|
-
durationMs: z.number().int().nullable(),
|
|
2447
|
-
input: z.unknown().nullable().optional()
|
|
2477
|
+
/**
|
|
2478
|
+
* Row from acq_list_executions joined with the execution summary,
|
|
2479
|
+
* shaped for the /lists/:id/executions response.
|
|
2480
|
+
*/
|
|
2481
|
+
export const ListExecutionSummarySchema = z.object({
|
|
2482
|
+
executionId: z.string(),
|
|
2483
|
+
resourceId: z.string(),
|
|
2484
|
+
status: z.string(),
|
|
2485
|
+
createdAt: z.string(),
|
|
2486
|
+
completedAt: z.string().nullable(),
|
|
2487
|
+
durationMs: z.number().int().nullable(),
|
|
2488
|
+
input: z.unknown().nullable().optional()
|
|
2448
2489
|
})
|
|
2449
2490
|
```
|
|
2450
2491
|
|
|
@@ -2475,299 +2516,299 @@ export const AcqEmailValidSchema = z.enum(['VALID', 'INVALID', 'RISKY', 'UNKNOWN
|
|
|
2475
2516
|
### `CompanyIdParamsSchema`
|
|
2476
2517
|
|
|
2477
2518
|
```typescript
|
|
2478
|
-
export const CompanyIdParamsSchema = z.object({
|
|
2479
|
-
companyId: UuidSchema
|
|
2519
|
+
export const CompanyIdParamsSchema = z.object({
|
|
2520
|
+
companyId: UuidSchema
|
|
2480
2521
|
})
|
|
2481
2522
|
```
|
|
2482
2523
|
|
|
2483
2524
|
### `ContactIdParamsSchema`
|
|
2484
2525
|
|
|
2485
2526
|
```typescript
|
|
2486
|
-
export const ContactIdParamsSchema = z.object({
|
|
2487
|
-
contactId: UuidSchema
|
|
2527
|
+
export const ContactIdParamsSchema = z.object({
|
|
2528
|
+
contactId: UuidSchema
|
|
2488
2529
|
})
|
|
2489
2530
|
```
|
|
2490
2531
|
|
|
2491
2532
|
### `ListCompaniesQuerySchema`
|
|
2492
2533
|
|
|
2493
2534
|
```typescript
|
|
2494
|
-
export const ListCompaniesQuerySchema = z
|
|
2495
|
-
.object({
|
|
2496
|
-
search: z.string().trim().min(1).max(200).optional(),
|
|
2497
|
-
listId: UuidSchema.optional(),
|
|
2498
|
-
domain: z.string().trim().min(1).max(255).optional(),
|
|
2499
|
-
website: z.string().trim().min(1).max(2048).optional(),
|
|
2500
|
-
segment: z.string().trim().min(1).max(255).optional(),
|
|
2501
|
-
category: z.string().trim().min(1).max(255).optional(),
|
|
2502
|
-
pipelineStatus: z.unknown().optional(),
|
|
2503
|
-
batchId: z.string().trim().min(1).max(255).optional(),
|
|
2504
|
-
status: AcqCompanyStatusSchema.optional(),
|
|
2505
|
-
includeAll: QueryBooleanSchema.optional(),
|
|
2506
|
-
limit: z.coerce.number().int().min(1).max(5000).default(50),
|
|
2507
|
-
offset: z.coerce.number().int().min(0).default(0)
|
|
2508
|
-
})
|
|
2535
|
+
export const ListCompaniesQuerySchema = z
|
|
2536
|
+
.object({
|
|
2537
|
+
search: z.string().trim().min(1).max(200).optional(),
|
|
2538
|
+
listId: UuidSchema.optional(),
|
|
2539
|
+
domain: z.string().trim().min(1).max(255).optional(),
|
|
2540
|
+
website: z.string().trim().min(1).max(2048).optional(),
|
|
2541
|
+
segment: z.string().trim().min(1).max(255).optional(),
|
|
2542
|
+
category: z.string().trim().min(1).max(255).optional(),
|
|
2543
|
+
pipelineStatus: z.unknown().optional(),
|
|
2544
|
+
batchId: z.string().trim().min(1).max(255).optional(),
|
|
2545
|
+
status: AcqCompanyStatusSchema.optional(),
|
|
2546
|
+
includeAll: QueryBooleanSchema.optional(),
|
|
2547
|
+
limit: z.coerce.number().int().min(1).max(5000).default(50),
|
|
2548
|
+
offset: z.coerce.number().int().min(0).default(0)
|
|
2549
|
+
})
|
|
2509
2550
|
.strict()
|
|
2510
2551
|
```
|
|
2511
2552
|
|
|
2512
2553
|
### `ListContactsQuerySchema`
|
|
2513
2554
|
|
|
2514
2555
|
```typescript
|
|
2515
|
-
export const ListContactsQuerySchema = z
|
|
2516
|
-
.object({
|
|
2517
|
-
search: z.string().trim().min(1).max(200).optional(),
|
|
2518
|
-
listId: UuidSchema.optional(),
|
|
2519
|
-
openingLineIsNull: QueryBooleanSchema.optional(),
|
|
2520
|
-
batchId: z.string().trim().min(1).max(255).optional(),
|
|
2521
|
-
contactStatus: AcqContactStatusSchema.optional(),
|
|
2522
|
-
limit: z.coerce.number().int().min(1).max(5000).default(5000),
|
|
2523
|
-
offset: z.coerce.number().int().min(0).default(0)
|
|
2524
|
-
})
|
|
2556
|
+
export const ListContactsQuerySchema = z
|
|
2557
|
+
.object({
|
|
2558
|
+
search: z.string().trim().min(1).max(200).optional(),
|
|
2559
|
+
listId: UuidSchema.optional(),
|
|
2560
|
+
openingLineIsNull: QueryBooleanSchema.optional(),
|
|
2561
|
+
batchId: z.string().trim().min(1).max(255).optional(),
|
|
2562
|
+
contactStatus: AcqContactStatusSchema.optional(),
|
|
2563
|
+
limit: z.coerce.number().int().min(1).max(5000).default(5000),
|
|
2564
|
+
offset: z.coerce.number().int().min(0).default(0)
|
|
2565
|
+
})
|
|
2525
2566
|
.strict()
|
|
2526
2567
|
```
|
|
2527
2568
|
|
|
2528
2569
|
### `CreateCompanyRequestSchema`
|
|
2529
2570
|
|
|
2530
2571
|
```typescript
|
|
2531
|
-
export const CreateCompanyRequestSchema = z
|
|
2532
|
-
.object({
|
|
2533
|
-
name: z.string().trim().min(1).max(255),
|
|
2534
|
-
clientId: UuidSchema.nullable().optional(),
|
|
2535
|
-
domain: z.string().trim().min(1).max(255).optional(),
|
|
2536
|
-
linkedinUrl: z.string().trim().url().optional(),
|
|
2537
|
-
website: z.string().trim().url().optional(),
|
|
2538
|
-
numEmployees: z.number().int().min(0).optional(),
|
|
2539
|
-
foundedYear: z.number().int().optional(),
|
|
2540
|
-
locationCity: z.string().trim().min(1).max(255).optional(),
|
|
2541
|
-
locationState: z.string().trim().min(1).max(255).optional(),
|
|
2542
|
-
category: z.string().trim().min(1).max(255).optional(),
|
|
2543
|
-
source: z.string().trim().min(1).max(255).optional(),
|
|
2544
|
-
batchId: z.string().trim().min(1).max(255).optional(),
|
|
2545
|
-
pipelineStatus: z.unknown().optional(),
|
|
2546
|
-
verticalResearch: z.string().trim().min(1).max(5000).optional()
|
|
2547
|
-
})
|
|
2572
|
+
export const CreateCompanyRequestSchema = z
|
|
2573
|
+
.object({
|
|
2574
|
+
name: z.string().trim().min(1).max(255),
|
|
2575
|
+
clientId: UuidSchema.nullable().optional(),
|
|
2576
|
+
domain: z.string().trim().min(1).max(255).optional(),
|
|
2577
|
+
linkedinUrl: z.string().trim().url().optional(),
|
|
2578
|
+
website: z.string().trim().url().optional(),
|
|
2579
|
+
numEmployees: z.number().int().min(0).optional(),
|
|
2580
|
+
foundedYear: z.number().int().optional(),
|
|
2581
|
+
locationCity: z.string().trim().min(1).max(255).optional(),
|
|
2582
|
+
locationState: z.string().trim().min(1).max(255).optional(),
|
|
2583
|
+
category: z.string().trim().min(1).max(255).optional(),
|
|
2584
|
+
source: z.string().trim().min(1).max(255).optional(),
|
|
2585
|
+
batchId: z.string().trim().min(1).max(255).optional(),
|
|
2586
|
+
pipelineStatus: z.unknown().optional(),
|
|
2587
|
+
verticalResearch: z.string().trim().min(1).max(5000).optional()
|
|
2588
|
+
})
|
|
2548
2589
|
.strict()
|
|
2549
2590
|
```
|
|
2550
2591
|
|
|
2551
2592
|
### `UpdateCompanyRequestSchema`
|
|
2552
2593
|
|
|
2553
2594
|
```typescript
|
|
2554
|
-
export const UpdateCompanyRequestSchema = z
|
|
2555
|
-
.object({
|
|
2556
|
-
name: z.string().trim().min(1).max(255).optional(),
|
|
2557
|
-
clientId: UuidSchema.nullable().optional(),
|
|
2558
|
-
domain: z.string().trim().min(1).max(255).optional(),
|
|
2559
|
-
linkedinUrl: z.string().trim().url().optional(),
|
|
2560
|
-
website: z.string().trim().url().optional(),
|
|
2561
|
-
numEmployees: z.number().int().min(0).optional(),
|
|
2562
|
-
foundedYear: z.number().int().optional(),
|
|
2563
|
-
locationCity: z.string().trim().min(1).max(255).optional(),
|
|
2564
|
-
locationState: z.string().trim().min(1).max(255).optional(),
|
|
2565
|
-
category: z.string().trim().min(1).max(255).optional(),
|
|
2566
|
-
segment: z.string().trim().min(1).max(255).optional(),
|
|
2567
|
-
processingState: CompanyProcessingStateSchema.optional(),
|
|
2568
|
-
pipelineStatus: z.unknown().optional(),
|
|
2569
|
-
enrichmentData: z.record(z.string(), z.unknown()).optional(),
|
|
2570
|
-
source: z.string().trim().min(1).max(255).optional(),
|
|
2571
|
-
batchId: z.string().trim().min(1).max(255).optional(),
|
|
2572
|
-
status: AcqCompanyStatusSchema.optional(),
|
|
2573
|
-
verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
|
|
2574
|
-
})
|
|
2575
|
-
.strict()
|
|
2576
|
-
.refine(
|
|
2577
|
-
(data) =>
|
|
2578
|
-
data.name !== undefined ||
|
|
2579
|
-
data.clientId !== undefined ||
|
|
2580
|
-
data.domain !== undefined ||
|
|
2581
|
-
data.linkedinUrl !== undefined ||
|
|
2582
|
-
data.website !== undefined ||
|
|
2583
|
-
data.numEmployees !== undefined ||
|
|
2584
|
-
data.foundedYear !== undefined ||
|
|
2585
|
-
data.locationCity !== undefined ||
|
|
2586
|
-
data.locationState !== undefined ||
|
|
2587
|
-
data.category !== undefined ||
|
|
2588
|
-
data.segment !== undefined ||
|
|
2589
|
-
data.processingState !== undefined ||
|
|
2590
|
-
data.pipelineStatus !== undefined ||
|
|
2591
|
-
data.enrichmentData !== undefined ||
|
|
2592
|
-
data.source !== undefined ||
|
|
2593
|
-
data.batchId !== undefined ||
|
|
2594
|
-
data.status !== undefined ||
|
|
2595
|
-
data.verticalResearch !== undefined,
|
|
2596
|
-
{
|
|
2597
|
-
message: 'At least one field must be provided'
|
|
2598
|
-
}
|
|
2595
|
+
export const UpdateCompanyRequestSchema = z
|
|
2596
|
+
.object({
|
|
2597
|
+
name: z.string().trim().min(1).max(255).optional(),
|
|
2598
|
+
clientId: UuidSchema.nullable().optional(),
|
|
2599
|
+
domain: z.string().trim().min(1).max(255).optional(),
|
|
2600
|
+
linkedinUrl: z.string().trim().url().optional(),
|
|
2601
|
+
website: z.string().trim().url().optional(),
|
|
2602
|
+
numEmployees: z.number().int().min(0).optional(),
|
|
2603
|
+
foundedYear: z.number().int().optional(),
|
|
2604
|
+
locationCity: z.string().trim().min(1).max(255).optional(),
|
|
2605
|
+
locationState: z.string().trim().min(1).max(255).optional(),
|
|
2606
|
+
category: z.string().trim().min(1).max(255).optional(),
|
|
2607
|
+
segment: z.string().trim().min(1).max(255).optional(),
|
|
2608
|
+
processingState: CompanyProcessingStateSchema.optional(),
|
|
2609
|
+
pipelineStatus: z.unknown().optional(),
|
|
2610
|
+
enrichmentData: z.record(z.string(), z.unknown()).optional(),
|
|
2611
|
+
source: z.string().trim().min(1).max(255).optional(),
|
|
2612
|
+
batchId: z.string().trim().min(1).max(255).optional(),
|
|
2613
|
+
status: AcqCompanyStatusSchema.optional(),
|
|
2614
|
+
verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
|
|
2615
|
+
})
|
|
2616
|
+
.strict()
|
|
2617
|
+
.refine(
|
|
2618
|
+
(data) =>
|
|
2619
|
+
data.name !== undefined ||
|
|
2620
|
+
data.clientId !== undefined ||
|
|
2621
|
+
data.domain !== undefined ||
|
|
2622
|
+
data.linkedinUrl !== undefined ||
|
|
2623
|
+
data.website !== undefined ||
|
|
2624
|
+
data.numEmployees !== undefined ||
|
|
2625
|
+
data.foundedYear !== undefined ||
|
|
2626
|
+
data.locationCity !== undefined ||
|
|
2627
|
+
data.locationState !== undefined ||
|
|
2628
|
+
data.category !== undefined ||
|
|
2629
|
+
data.segment !== undefined ||
|
|
2630
|
+
data.processingState !== undefined ||
|
|
2631
|
+
data.pipelineStatus !== undefined ||
|
|
2632
|
+
data.enrichmentData !== undefined ||
|
|
2633
|
+
data.source !== undefined ||
|
|
2634
|
+
data.batchId !== undefined ||
|
|
2635
|
+
data.status !== undefined ||
|
|
2636
|
+
data.verticalResearch !== undefined,
|
|
2637
|
+
{
|
|
2638
|
+
message: 'At least one field must be provided'
|
|
2639
|
+
}
|
|
2599
2640
|
)
|
|
2600
2641
|
```
|
|
2601
2642
|
|
|
2602
2643
|
### `CreateContactRequestSchema`
|
|
2603
2644
|
|
|
2604
2645
|
```typescript
|
|
2605
|
-
export const CreateContactRequestSchema = z
|
|
2606
|
-
.object({
|
|
2607
|
-
email: z.string().trim().email(),
|
|
2608
|
-
clientId: UuidSchema.nullable().optional(),
|
|
2609
|
-
companyId: UuidSchema.optional(),
|
|
2610
|
-
firstName: z.string().trim().min(1).max(255).optional(),
|
|
2611
|
-
lastName: z.string().trim().min(1).max(255).optional(),
|
|
2612
|
-
linkedinUrl: z.string().trim().url().optional(),
|
|
2613
|
-
title: z.string().trim().min(1).max(255).optional(),
|
|
2614
|
-
source: z.string().trim().min(1).max(255).optional(),
|
|
2615
|
-
sourceId: z.string().trim().min(1).max(255).optional(),
|
|
2616
|
-
batchId: z.string().trim().min(1).max(255).optional(),
|
|
2617
|
-
pipelineStatus: z.unknown().optional()
|
|
2618
|
-
})
|
|
2646
|
+
export const CreateContactRequestSchema = z
|
|
2647
|
+
.object({
|
|
2648
|
+
email: z.string().trim().email(),
|
|
2649
|
+
clientId: UuidSchema.nullable().optional(),
|
|
2650
|
+
companyId: UuidSchema.optional(),
|
|
2651
|
+
firstName: z.string().trim().min(1).max(255).optional(),
|
|
2652
|
+
lastName: z.string().trim().min(1).max(255).optional(),
|
|
2653
|
+
linkedinUrl: z.string().trim().url().optional(),
|
|
2654
|
+
title: z.string().trim().min(1).max(255).optional(),
|
|
2655
|
+
source: z.string().trim().min(1).max(255).optional(),
|
|
2656
|
+
sourceId: z.string().trim().min(1).max(255).optional(),
|
|
2657
|
+
batchId: z.string().trim().min(1).max(255).optional(),
|
|
2658
|
+
pipelineStatus: z.unknown().optional()
|
|
2659
|
+
})
|
|
2619
2660
|
.strict()
|
|
2620
2661
|
```
|
|
2621
2662
|
|
|
2622
2663
|
### `UpdateContactRequestSchema`
|
|
2623
2664
|
|
|
2624
2665
|
```typescript
|
|
2625
|
-
export const UpdateContactRequestSchema = z
|
|
2626
|
-
.object({
|
|
2627
|
-
companyId: UuidSchema.optional(),
|
|
2628
|
-
clientId: UuidSchema.nullable().optional(),
|
|
2629
|
-
emailValid: AcqEmailValidSchema.optional(),
|
|
2630
|
-
firstName: z.string().trim().min(1).max(255).optional(),
|
|
2631
|
-
lastName: z.string().trim().min(1).max(255).optional(),
|
|
2632
|
-
linkedinUrl: z.string().trim().url().optional(),
|
|
2633
|
-
title: z.string().trim().min(1).max(255).optional(),
|
|
2634
|
-
headline: z.string().trim().min(1).max(5000).optional(),
|
|
2635
|
-
filterReason: z.string().trim().min(1).max(5000).optional(),
|
|
2636
|
-
openingLine: z.string().trim().min(1).max(5000).optional(),
|
|
2637
|
-
processingState: ContactProcessingStateSchema.optional(),
|
|
2638
|
-
pipelineStatus: z.unknown().optional(),
|
|
2639
|
-
enrichmentData: z.record(z.string(), z.unknown()).optional(),
|
|
2640
|
-
status: AcqContactStatusSchema.optional()
|
|
2641
|
-
})
|
|
2642
|
-
.strict()
|
|
2643
|
-
.refine(
|
|
2644
|
-
(data) =>
|
|
2645
|
-
data.companyId !== undefined ||
|
|
2646
|
-
data.clientId !== undefined ||
|
|
2647
|
-
data.emailValid !== undefined ||
|
|
2648
|
-
data.firstName !== undefined ||
|
|
2649
|
-
data.lastName !== undefined ||
|
|
2650
|
-
data.linkedinUrl !== undefined ||
|
|
2651
|
-
data.title !== undefined ||
|
|
2652
|
-
data.headline !== undefined ||
|
|
2653
|
-
data.filterReason !== undefined ||
|
|
2654
|
-
data.openingLine !== undefined ||
|
|
2655
|
-
data.processingState !== undefined ||
|
|
2656
|
-
data.pipelineStatus !== undefined ||
|
|
2657
|
-
data.enrichmentData !== undefined ||
|
|
2658
|
-
data.status !== undefined,
|
|
2659
|
-
{
|
|
2660
|
-
message: 'At least one field must be provided'
|
|
2661
|
-
}
|
|
2666
|
+
export const UpdateContactRequestSchema = z
|
|
2667
|
+
.object({
|
|
2668
|
+
companyId: UuidSchema.optional(),
|
|
2669
|
+
clientId: UuidSchema.nullable().optional(),
|
|
2670
|
+
emailValid: AcqEmailValidSchema.optional(),
|
|
2671
|
+
firstName: z.string().trim().min(1).max(255).optional(),
|
|
2672
|
+
lastName: z.string().trim().min(1).max(255).optional(),
|
|
2673
|
+
linkedinUrl: z.string().trim().url().optional(),
|
|
2674
|
+
title: z.string().trim().min(1).max(255).optional(),
|
|
2675
|
+
headline: z.string().trim().min(1).max(5000).optional(),
|
|
2676
|
+
filterReason: z.string().trim().min(1).max(5000).optional(),
|
|
2677
|
+
openingLine: z.string().trim().min(1).max(5000).optional(),
|
|
2678
|
+
processingState: ContactProcessingStateSchema.optional(),
|
|
2679
|
+
pipelineStatus: z.unknown().optional(),
|
|
2680
|
+
enrichmentData: z.record(z.string(), z.unknown()).optional(),
|
|
2681
|
+
status: AcqContactStatusSchema.optional()
|
|
2682
|
+
})
|
|
2683
|
+
.strict()
|
|
2684
|
+
.refine(
|
|
2685
|
+
(data) =>
|
|
2686
|
+
data.companyId !== undefined ||
|
|
2687
|
+
data.clientId !== undefined ||
|
|
2688
|
+
data.emailValid !== undefined ||
|
|
2689
|
+
data.firstName !== undefined ||
|
|
2690
|
+
data.lastName !== undefined ||
|
|
2691
|
+
data.linkedinUrl !== undefined ||
|
|
2692
|
+
data.title !== undefined ||
|
|
2693
|
+
data.headline !== undefined ||
|
|
2694
|
+
data.filterReason !== undefined ||
|
|
2695
|
+
data.openingLine !== undefined ||
|
|
2696
|
+
data.processingState !== undefined ||
|
|
2697
|
+
data.pipelineStatus !== undefined ||
|
|
2698
|
+
data.enrichmentData !== undefined ||
|
|
2699
|
+
data.status !== undefined,
|
|
2700
|
+
{
|
|
2701
|
+
message: 'At least one field must be provided'
|
|
2702
|
+
}
|
|
2662
2703
|
)
|
|
2663
2704
|
```
|
|
2664
2705
|
|
|
2665
2706
|
### `AcqCompanyResponseSchema`
|
|
2666
2707
|
|
|
2667
2708
|
```typescript
|
|
2668
|
-
export const AcqCompanyResponseSchema = z.object({
|
|
2669
|
-
id: z.string(),
|
|
2670
|
-
organizationId: z.string(),
|
|
2671
|
-
clientId: z.string().nullable().optional(),
|
|
2672
|
-
name: z.string(),
|
|
2673
|
-
domain: z.string().nullable(),
|
|
2674
|
-
linkedinUrl: z.string().nullable(),
|
|
2675
|
-
website: z.string().nullable(),
|
|
2676
|
-
numEmployees: z.number().nullable(),
|
|
2677
|
-
foundedYear: z.number().nullable(),
|
|
2678
|
-
locationCity: z.string().nullable(),
|
|
2679
|
-
locationState: z.string().nullable(),
|
|
2680
|
-
category: z.string().nullable(),
|
|
2681
|
-
categoryPain: z.string().nullable(),
|
|
2682
|
-
segment: z.string().nullable(),
|
|
2683
|
-
processingState: CompanyProcessingStateSchema.nullable(),
|
|
2684
|
-
pipelineStatus: z.unknown().nullable().optional(),
|
|
2685
|
-
enrichmentData: z.record(z.string(), z.unknown()).nullable(),
|
|
2686
|
-
source: z.string().nullable(),
|
|
2687
|
-
batchId: z.string().nullable(),
|
|
2688
|
-
status: AcqCompanyStatusSchema,
|
|
2689
|
-
contactCount: z.number().int().min(0),
|
|
2690
|
-
verticalResearch: z.string().nullable(),
|
|
2691
|
-
createdAt: z.string(),
|
|
2692
|
-
updatedAt: z.string()
|
|
2709
|
+
export const AcqCompanyResponseSchema = z.object({
|
|
2710
|
+
id: z.string(),
|
|
2711
|
+
organizationId: z.string(),
|
|
2712
|
+
clientId: z.string().nullable().optional(),
|
|
2713
|
+
name: z.string(),
|
|
2714
|
+
domain: z.string().nullable(),
|
|
2715
|
+
linkedinUrl: z.string().nullable(),
|
|
2716
|
+
website: z.string().nullable(),
|
|
2717
|
+
numEmployees: z.number().nullable(),
|
|
2718
|
+
foundedYear: z.number().nullable(),
|
|
2719
|
+
locationCity: z.string().nullable(),
|
|
2720
|
+
locationState: z.string().nullable(),
|
|
2721
|
+
category: z.string().nullable(),
|
|
2722
|
+
categoryPain: z.string().nullable(),
|
|
2723
|
+
segment: z.string().nullable(),
|
|
2724
|
+
processingState: CompanyProcessingStateSchema.nullable(),
|
|
2725
|
+
pipelineStatus: z.unknown().nullable().optional(),
|
|
2726
|
+
enrichmentData: z.record(z.string(), z.unknown()).nullable(),
|
|
2727
|
+
source: z.string().nullable(),
|
|
2728
|
+
batchId: z.string().nullable(),
|
|
2729
|
+
status: AcqCompanyStatusSchema,
|
|
2730
|
+
contactCount: z.number().int().min(0),
|
|
2731
|
+
verticalResearch: z.string().nullable(),
|
|
2732
|
+
createdAt: z.string(),
|
|
2733
|
+
updatedAt: z.string()
|
|
2693
2734
|
})
|
|
2694
2735
|
```
|
|
2695
2736
|
|
|
2696
2737
|
### `AcqCompanyListResponseSchema`
|
|
2697
2738
|
|
|
2698
2739
|
```typescript
|
|
2699
|
-
export const AcqCompanyListResponseSchema = z.object({
|
|
2700
|
-
data: z.array(AcqCompanyResponseSchema),
|
|
2701
|
-
total: z.number().int(),
|
|
2702
|
-
limit: z.number().int(),
|
|
2703
|
-
offset: z.number().int()
|
|
2740
|
+
export const AcqCompanyListResponseSchema = z.object({
|
|
2741
|
+
data: z.array(AcqCompanyResponseSchema),
|
|
2742
|
+
total: z.number().int(),
|
|
2743
|
+
limit: z.number().int(),
|
|
2744
|
+
offset: z.number().int()
|
|
2704
2745
|
})
|
|
2705
2746
|
```
|
|
2706
2747
|
|
|
2707
2748
|
### `AcqCompanyFacetsResponseSchema`
|
|
2708
2749
|
|
|
2709
2750
|
```typescript
|
|
2710
|
-
export const AcqCompanyFacetsResponseSchema = z.object({
|
|
2711
|
-
segments: z.array(z.string()),
|
|
2712
|
-
categories: z.array(z.string()),
|
|
2713
|
-
statuses: z.array(AcqCompanyStatusSchema)
|
|
2751
|
+
export const AcqCompanyFacetsResponseSchema = z.object({
|
|
2752
|
+
segments: z.array(z.string()),
|
|
2753
|
+
categories: z.array(z.string()),
|
|
2754
|
+
statuses: z.array(AcqCompanyStatusSchema)
|
|
2714
2755
|
})
|
|
2715
2756
|
```
|
|
2716
2757
|
|
|
2717
2758
|
### `AcqContactCompanySummarySchema`
|
|
2718
2759
|
|
|
2719
2760
|
```typescript
|
|
2720
|
-
export const AcqContactCompanySummarySchema = z.object({
|
|
2721
|
-
id: z.string(),
|
|
2722
|
-
name: z.string(),
|
|
2723
|
-
domain: z.string().nullable(),
|
|
2724
|
-
website: z.string().nullable(),
|
|
2725
|
-
linkedinUrl: z.string().nullable(),
|
|
2726
|
-
segment: z.string().nullable(),
|
|
2727
|
-
category: z.string().nullable(),
|
|
2728
|
-
status: AcqCompanyStatusSchema
|
|
2761
|
+
export const AcqContactCompanySummarySchema = z.object({
|
|
2762
|
+
id: z.string(),
|
|
2763
|
+
name: z.string(),
|
|
2764
|
+
domain: z.string().nullable(),
|
|
2765
|
+
website: z.string().nullable(),
|
|
2766
|
+
linkedinUrl: z.string().nullable(),
|
|
2767
|
+
segment: z.string().nullable(),
|
|
2768
|
+
category: z.string().nullable(),
|
|
2769
|
+
status: AcqCompanyStatusSchema
|
|
2729
2770
|
})
|
|
2730
2771
|
```
|
|
2731
2772
|
|
|
2732
2773
|
### `AcqContactResponseSchema`
|
|
2733
2774
|
|
|
2734
2775
|
```typescript
|
|
2735
|
-
export const AcqContactResponseSchema = z.object({
|
|
2736
|
-
id: z.string(),
|
|
2737
|
-
organizationId: z.string(),
|
|
2738
|
-
clientId: z.string().nullable().optional(),
|
|
2739
|
-
companyId: z.string().nullable(),
|
|
2740
|
-
email: z.string(),
|
|
2741
|
-
emailValid: AcqEmailValidSchema.nullable(),
|
|
2742
|
-
firstName: z.string().nullable(),
|
|
2743
|
-
lastName: z.string().nullable(),
|
|
2744
|
-
linkedinUrl: z.string().nullable(),
|
|
2745
|
-
title: z.string().nullable(),
|
|
2746
|
-
headline: z.string().nullable(),
|
|
2747
|
-
filterReason: z.string().nullable(),
|
|
2748
|
-
openingLine: z.string().nullable(),
|
|
2749
|
-
source: z.string().nullable(),
|
|
2750
|
-
sourceId: z.string().nullable(),
|
|
2751
|
-
processingState: ContactProcessingStateSchema.nullable(),
|
|
2752
|
-
pipelineStatus: z.unknown().nullable().optional(),
|
|
2753
|
-
enrichmentData: z.record(z.string(), z.unknown()).nullable(),
|
|
2754
|
-
attioPersonId: z.string().nullable(),
|
|
2755
|
-
batchId: z.string().nullable(),
|
|
2756
|
-
status: AcqContactStatusSchema,
|
|
2757
|
-
company: AcqContactCompanySummarySchema.nullable().optional(),
|
|
2758
|
-
createdAt: z.string(),
|
|
2759
|
-
updatedAt: z.string()
|
|
2776
|
+
export const AcqContactResponseSchema = z.object({
|
|
2777
|
+
id: z.string(),
|
|
2778
|
+
organizationId: z.string(),
|
|
2779
|
+
clientId: z.string().nullable().optional(),
|
|
2780
|
+
companyId: z.string().nullable(),
|
|
2781
|
+
email: z.string(),
|
|
2782
|
+
emailValid: AcqEmailValidSchema.nullable(),
|
|
2783
|
+
firstName: z.string().nullable(),
|
|
2784
|
+
lastName: z.string().nullable(),
|
|
2785
|
+
linkedinUrl: z.string().nullable(),
|
|
2786
|
+
title: z.string().nullable(),
|
|
2787
|
+
headline: z.string().nullable(),
|
|
2788
|
+
filterReason: z.string().nullable(),
|
|
2789
|
+
openingLine: z.string().nullable(),
|
|
2790
|
+
source: z.string().nullable(),
|
|
2791
|
+
sourceId: z.string().nullable(),
|
|
2792
|
+
processingState: ContactProcessingStateSchema.nullable(),
|
|
2793
|
+
pipelineStatus: z.unknown().nullable().optional(),
|
|
2794
|
+
enrichmentData: z.record(z.string(), z.unknown()).nullable(),
|
|
2795
|
+
attioPersonId: z.string().nullable(),
|
|
2796
|
+
batchId: z.string().nullable(),
|
|
2797
|
+
status: AcqContactStatusSchema,
|
|
2798
|
+
company: AcqContactCompanySummarySchema.nullable().optional(),
|
|
2799
|
+
createdAt: z.string(),
|
|
2800
|
+
updatedAt: z.string()
|
|
2760
2801
|
})
|
|
2761
2802
|
```
|
|
2762
2803
|
|
|
2763
2804
|
### `AcqContactListResponseSchema`
|
|
2764
2805
|
|
|
2765
2806
|
```typescript
|
|
2766
|
-
export const AcqContactListResponseSchema = z.object({
|
|
2767
|
-
data: z.array(AcqContactResponseSchema),
|
|
2768
|
-
total: z.number().int(),
|
|
2769
|
-
limit: z.number().int(),
|
|
2770
|
-
offset: z.number().int()
|
|
2807
|
+
export const AcqContactListResponseSchema = z.object({
|
|
2808
|
+
data: z.array(AcqContactResponseSchema),
|
|
2809
|
+
total: z.number().int(),
|
|
2810
|
+
limit: z.number().int(),
|
|
2811
|
+
offset: z.number().int()
|
|
2771
2812
|
})
|
|
2772
2813
|
```
|
|
2773
2814
|
|
|
@@ -2780,524 +2821,524 @@ export const AcqArtifactOwnerKindSchema = z.enum(['company', 'contact', 'deal',
|
|
|
2780
2821
|
### `ListArtifactsQuerySchema`
|
|
2781
2822
|
|
|
2782
2823
|
```typescript
|
|
2783
|
-
export const ListArtifactsQuerySchema = z
|
|
2784
|
-
.object({
|
|
2785
|
-
ownerKind: AcqArtifactOwnerKindSchema,
|
|
2786
|
-
ownerId: UuidSchema
|
|
2787
|
-
})
|
|
2824
|
+
export const ListArtifactsQuerySchema = z
|
|
2825
|
+
.object({
|
|
2826
|
+
ownerKind: AcqArtifactOwnerKindSchema,
|
|
2827
|
+
ownerId: UuidSchema
|
|
2828
|
+
})
|
|
2788
2829
|
.strict()
|
|
2789
2830
|
```
|
|
2790
2831
|
|
|
2791
2832
|
### `CreateArtifactRequestSchema`
|
|
2792
2833
|
|
|
2793
2834
|
```typescript
|
|
2794
|
-
export const CreateArtifactRequestSchema = z
|
|
2795
|
-
.object({
|
|
2796
|
-
ownerKind: AcqArtifactOwnerKindSchema,
|
|
2797
|
-
ownerId: UuidSchema,
|
|
2798
|
-
kind: z.string().trim().min(1).max(255),
|
|
2799
|
-
content: z.record(z.string(), z.unknown()),
|
|
2800
|
-
sourceExecutionId: UuidSchema.optional()
|
|
2801
|
-
})
|
|
2835
|
+
export const CreateArtifactRequestSchema = z
|
|
2836
|
+
.object({
|
|
2837
|
+
ownerKind: AcqArtifactOwnerKindSchema,
|
|
2838
|
+
ownerId: UuidSchema,
|
|
2839
|
+
kind: z.string().trim().min(1).max(255),
|
|
2840
|
+
content: z.record(z.string(), z.unknown()),
|
|
2841
|
+
sourceExecutionId: UuidSchema.optional()
|
|
2842
|
+
})
|
|
2802
2843
|
.strict()
|
|
2803
2844
|
```
|
|
2804
2845
|
|
|
2805
2846
|
### `AcqArtifactResponseSchema`
|
|
2806
2847
|
|
|
2807
2848
|
```typescript
|
|
2808
|
-
export const AcqArtifactResponseSchema = z.object({
|
|
2809
|
-
id: z.string(),
|
|
2810
|
-
organizationId: z.string(),
|
|
2811
|
-
ownerKind: z.string(),
|
|
2812
|
-
ownerId: z.string(),
|
|
2813
|
-
kind: z.string(),
|
|
2814
|
-
content: z.record(z.string(), z.unknown()),
|
|
2815
|
-
sourceExecutionId: z.string().nullable(),
|
|
2816
|
-
createdBy: z.string().nullable(),
|
|
2817
|
-
createdAt: z.string(),
|
|
2818
|
-
version: z.number().int()
|
|
2849
|
+
export const AcqArtifactResponseSchema = z.object({
|
|
2850
|
+
id: z.string(),
|
|
2851
|
+
organizationId: z.string(),
|
|
2852
|
+
ownerKind: z.string(),
|
|
2853
|
+
ownerId: z.string(),
|
|
2854
|
+
kind: z.string(),
|
|
2855
|
+
content: z.record(z.string(), z.unknown()),
|
|
2856
|
+
sourceExecutionId: z.string().nullable(),
|
|
2857
|
+
createdBy: z.string().nullable(),
|
|
2858
|
+
createdAt: z.string(),
|
|
2859
|
+
version: z.number().int()
|
|
2819
2860
|
})
|
|
2820
2861
|
```
|
|
2821
2862
|
|
|
2822
2863
|
### `AcqArtifactListResponseSchema`
|
|
2823
2864
|
|
|
2824
2865
|
```typescript
|
|
2825
|
-
export const AcqArtifactListResponseSchema = z.object({
|
|
2826
|
-
artifacts: z.array(AcqArtifactResponseSchema)
|
|
2866
|
+
export const AcqArtifactListResponseSchema = z.object({
|
|
2867
|
+
artifacts: z.array(AcqArtifactResponseSchema)
|
|
2827
2868
|
})
|
|
2828
2869
|
```
|
|
2829
2870
|
|
|
2830
2871
|
### `ListMembersQuerySchema`
|
|
2831
2872
|
|
|
2832
2873
|
```typescript
|
|
2833
|
-
export const ListMembersQuerySchema = z
|
|
2834
|
-
.object({
|
|
2835
|
-
limit: z.coerce.number().int().min(1).max(500).default(50),
|
|
2836
|
-
offset: z.coerce.number().int().min(0).default(0)
|
|
2837
|
-
})
|
|
2874
|
+
export const ListMembersQuerySchema = z
|
|
2875
|
+
.object({
|
|
2876
|
+
limit: z.coerce.number().int().min(1).max(500).default(50),
|
|
2877
|
+
offset: z.coerce.number().int().min(0).default(0)
|
|
2878
|
+
})
|
|
2838
2879
|
.strict()
|
|
2839
2880
|
```
|
|
2840
2881
|
|
|
2841
2882
|
### `MemberIdParamsSchema`
|
|
2842
2883
|
|
|
2843
2884
|
```typescript
|
|
2844
|
-
export const MemberIdParamsSchema = z.object({
|
|
2845
|
-
memberId: UuidSchema
|
|
2885
|
+
export const MemberIdParamsSchema = z.object({
|
|
2886
|
+
memberId: UuidSchema
|
|
2846
2887
|
})
|
|
2847
2888
|
```
|
|
2848
2889
|
|
|
2849
2890
|
### `AcqListMemberContactSummarySchema`
|
|
2850
2891
|
|
|
2851
2892
|
```typescript
|
|
2852
|
-
export const AcqListMemberContactSummarySchema = z.object({
|
|
2853
|
-
id: z.string(),
|
|
2854
|
-
email: z.string(),
|
|
2855
|
-
firstName: z.string().nullable(),
|
|
2856
|
-
lastName: z.string().nullable(),
|
|
2857
|
-
title: z.string().nullable(),
|
|
2858
|
-
linkedinUrl: z.string().nullable(),
|
|
2859
|
-
companyId: z.string().nullable()
|
|
2893
|
+
export const AcqListMemberContactSummarySchema = z.object({
|
|
2894
|
+
id: z.string(),
|
|
2895
|
+
email: z.string(),
|
|
2896
|
+
firstName: z.string().nullable(),
|
|
2897
|
+
lastName: z.string().nullable(),
|
|
2898
|
+
title: z.string().nullable(),
|
|
2899
|
+
linkedinUrl: z.string().nullable(),
|
|
2900
|
+
companyId: z.string().nullable()
|
|
2860
2901
|
})
|
|
2861
2902
|
```
|
|
2862
2903
|
|
|
2863
2904
|
### `AcqListMemberResponseSchema`
|
|
2864
2905
|
|
|
2865
2906
|
```typescript
|
|
2866
|
-
export const AcqListMemberResponseSchema = z.object({
|
|
2867
|
-
id: z.string(),
|
|
2868
|
-
listId: z.string(),
|
|
2869
|
-
contactId: z.string(),
|
|
2870
|
-
pipelineKey: z.string(),
|
|
2871
|
-
stageKey: z.string(),
|
|
2872
|
-
stateKey: z.string(),
|
|
2873
|
-
activityLog: z.unknown(),
|
|
2874
|
-
addedAt: z.string(),
|
|
2875
|
-
addedBy: z.string().nullable(),
|
|
2876
|
-
sourceExecutionId: z.string().nullable(),
|
|
2877
|
-
contact: AcqListMemberContactSummarySchema.nullable()
|
|
2907
|
+
export const AcqListMemberResponseSchema = z.object({
|
|
2908
|
+
id: z.string(),
|
|
2909
|
+
listId: z.string(),
|
|
2910
|
+
contactId: z.string(),
|
|
2911
|
+
pipelineKey: z.string(),
|
|
2912
|
+
stageKey: z.string(),
|
|
2913
|
+
stateKey: z.string(),
|
|
2914
|
+
activityLog: z.unknown(),
|
|
2915
|
+
addedAt: z.string(),
|
|
2916
|
+
addedBy: z.string().nullable(),
|
|
2917
|
+
sourceExecutionId: z.string().nullable(),
|
|
2918
|
+
contact: AcqListMemberContactSummarySchema.nullable()
|
|
2878
2919
|
})
|
|
2879
2920
|
```
|
|
2880
2921
|
|
|
2881
2922
|
### `AcqListMembersResponseSchema`
|
|
2882
2923
|
|
|
2883
2924
|
```typescript
|
|
2884
|
-
export const AcqListMembersResponseSchema = z.object({
|
|
2885
|
-
members: z.array(AcqListMemberResponseSchema)
|
|
2925
|
+
export const AcqListMembersResponseSchema = z.object({
|
|
2926
|
+
members: z.array(AcqListMemberResponseSchema)
|
|
2886
2927
|
})
|
|
2887
2928
|
```
|
|
2888
2929
|
|
|
2889
2930
|
### `ListCompanyIdParamsSchema`
|
|
2890
2931
|
|
|
2891
2932
|
```typescript
|
|
2892
|
-
export const ListCompanyIdParamsSchema = z.object({
|
|
2893
|
-
listCompanyId: UuidSchema
|
|
2933
|
+
export const ListCompanyIdParamsSchema = z.object({
|
|
2934
|
+
listCompanyId: UuidSchema
|
|
2894
2935
|
})
|
|
2895
2936
|
```
|
|
2896
2937
|
|
|
2897
2938
|
### `AcqListCompanyResponseSchema`
|
|
2898
2939
|
|
|
2899
2940
|
```typescript
|
|
2900
|
-
export const AcqListCompanyResponseSchema = z.object({
|
|
2901
|
-
id: z.string(),
|
|
2902
|
-
listId: z.string(),
|
|
2903
|
-
companyId: z.string(),
|
|
2904
|
-
pipelineKey: z.string(),
|
|
2905
|
-
stageKey: z.string(),
|
|
2906
|
-
stateKey: z.string(),
|
|
2907
|
-
activityLog: z.unknown(),
|
|
2908
|
-
addedAt: z.string(),
|
|
2909
|
-
addedBy: z.string().nullable(),
|
|
2910
|
-
sourceExecutionId: z.string().nullable()
|
|
2941
|
+
export const AcqListCompanyResponseSchema = z.object({
|
|
2942
|
+
id: z.string(),
|
|
2943
|
+
listId: z.string(),
|
|
2944
|
+
companyId: z.string(),
|
|
2945
|
+
pipelineKey: z.string(),
|
|
2946
|
+
stageKey: z.string(),
|
|
2947
|
+
stateKey: z.string(),
|
|
2948
|
+
activityLog: z.unknown(),
|
|
2949
|
+
addedAt: z.string(),
|
|
2950
|
+
addedBy: z.string().nullable(),
|
|
2951
|
+
sourceExecutionId: z.string().nullable()
|
|
2911
2952
|
})
|
|
2912
2953
|
```
|
|
2913
2954
|
|
|
2914
2955
|
### `AcqCompanySchemas`
|
|
2915
2956
|
|
|
2916
2957
|
```typescript
|
|
2917
|
-
export const AcqCompanySchemas = {
|
|
2918
|
-
CompanyProcessingState: CompanyProcessingStateSchema,
|
|
2919
|
-
CompanyIdParams: CompanyIdParamsSchema,
|
|
2920
|
-
ListCompaniesQuery: ListCompaniesQuerySchema,
|
|
2921
|
-
CreateCompanyRequest: CreateCompanyRequestSchema,
|
|
2922
|
-
UpdateCompanyRequest: UpdateCompanyRequestSchema,
|
|
2923
|
-
AcqCompanyResponse: AcqCompanyResponseSchema,
|
|
2924
|
-
AcqCompanyListResponse: AcqCompanyListResponseSchema,
|
|
2925
|
-
AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
|
|
2958
|
+
export const AcqCompanySchemas = {
|
|
2959
|
+
CompanyProcessingState: CompanyProcessingStateSchema,
|
|
2960
|
+
CompanyIdParams: CompanyIdParamsSchema,
|
|
2961
|
+
ListCompaniesQuery: ListCompaniesQuerySchema,
|
|
2962
|
+
CreateCompanyRequest: CreateCompanyRequestSchema,
|
|
2963
|
+
UpdateCompanyRequest: UpdateCompanyRequestSchema,
|
|
2964
|
+
AcqCompanyResponse: AcqCompanyResponseSchema,
|
|
2965
|
+
AcqCompanyListResponse: AcqCompanyListResponseSchema,
|
|
2966
|
+
AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
|
|
2926
2967
|
}
|
|
2927
2968
|
```
|
|
2928
2969
|
|
|
2929
2970
|
### `AcqContactSchemas`
|
|
2930
2971
|
|
|
2931
2972
|
```typescript
|
|
2932
|
-
export const AcqContactSchemas = {
|
|
2933
|
-
ContactProcessingState: ContactProcessingStateSchema,
|
|
2934
|
-
ContactIdParams: ContactIdParamsSchema,
|
|
2935
|
-
ListContactsQuery: ListContactsQuerySchema,
|
|
2936
|
-
CreateContactRequest: CreateContactRequestSchema,
|
|
2937
|
-
UpdateContactRequest: UpdateContactRequestSchema,
|
|
2938
|
-
AcqContactResponse: AcqContactResponseSchema,
|
|
2939
|
-
AcqContactListResponse: AcqContactListResponseSchema
|
|
2973
|
+
export const AcqContactSchemas = {
|
|
2974
|
+
ContactProcessingState: ContactProcessingStateSchema,
|
|
2975
|
+
ContactIdParams: ContactIdParamsSchema,
|
|
2976
|
+
ListContactsQuery: ListContactsQuerySchema,
|
|
2977
|
+
CreateContactRequest: CreateContactRequestSchema,
|
|
2978
|
+
UpdateContactRequest: UpdateContactRequestSchema,
|
|
2979
|
+
AcqContactResponse: AcqContactResponseSchema,
|
|
2980
|
+
AcqContactListResponse: AcqContactListResponseSchema
|
|
2940
2981
|
}
|
|
2941
2982
|
```
|
|
2942
2983
|
|
|
2943
2984
|
### `AcqListSchemas`
|
|
2944
2985
|
|
|
2945
2986
|
```typescript
|
|
2946
|
-
export const AcqListSchemas = {
|
|
2947
|
-
// Params
|
|
2948
|
-
ListIdParams: ListIdParamsSchema,
|
|
2949
|
-
|
|
2950
|
-
// Primitives (for UI / tests)
|
|
2951
|
-
ListStatus: ListStatusSchema,
|
|
2952
|
-
ScrapingConfig: ScrapingConfigSchema,
|
|
2953
|
-
IcpRubric: IcpRubricSchema,
|
|
2954
|
-
PipelineConfig: PipelineConfigSchema,
|
|
2955
|
-
PipelineStage: PipelineStageSchema,
|
|
2956
|
-
BuildPlanSnapshot: BuildPlanSnapshotSchema,
|
|
2957
|
-
BuildPlanSnapshotStep: BuildPlanSnapshotStepSchema,
|
|
2958
|
-
AcqListMetadata: AcqListMetadataSchema,
|
|
2959
|
-
LeadGenStageKey: LeadGenStageKeySchema,
|
|
2960
|
-
LeadGenActionKey: LeadGenActionKeySchema,
|
|
2961
|
-
ProcessingStageStatus: ProcessingStageStatusSchema,
|
|
2962
|
-
ProcessingState: ProcessingStateSchema,
|
|
2963
|
-
ListStageCounts: ListStageCountsSchema,
|
|
2964
|
-
ListTelemetry: ListTelemetrySchema,
|
|
2965
|
-
|
|
2966
|
-
// Requests
|
|
2967
|
-
ListReadQuery: ListReadQuerySchema,
|
|
2968
|
-
GetListQuery: GetListQuerySchema,
|
|
2969
|
-
CreateListRequest: CreateListRequestSchema,
|
|
2970
|
-
UpdateListRequest: UpdateListRequestSchema,
|
|
2971
|
-
UpdateListStatusRequest: UpdateListStatusRequestSchema,
|
|
2972
|
-
UpdateListConfigRequest: UpdateListConfigRequestSchema,
|
|
2973
|
-
AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
|
|
2974
|
-
RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
|
|
2975
|
-
AddContactsToListRequest: AddContactsToListRequestSchema,
|
|
2976
|
-
RecordListExecutionRequest: RecordListExecutionRequestSchema,
|
|
2977
|
-
|
|
2978
|
-
// Responses
|
|
2979
|
-
AcqListResponse: AcqListResponseSchema,
|
|
2980
|
-
AcqListDetailResponse: AcqListDetailResponseSchema,
|
|
2981
|
-
AcqListListResponse: AcqListListResponseSchema,
|
|
2982
|
-
AcqListDealRef: AcqListDealRefSchema,
|
|
2983
|
-
AcqListLineage: AcqListLineageSchema,
|
|
2984
|
-
AcqListStatusResponse: AcqListStatusResponseSchema,
|
|
2985
|
-
ListTelemetryResponse: ListTelemetryResponseSchema,
|
|
2986
|
-
ListTelemetryListResponse: ListTelemetryListResponseSchema,
|
|
2987
|
-
ListExecutionsResponse: ListExecutionsResponseSchema,
|
|
2988
|
-
ListProgressResponse: ListProgressResponseSchema
|
|
2987
|
+
export const AcqListSchemas = {
|
|
2988
|
+
// Params
|
|
2989
|
+
ListIdParams: ListIdParamsSchema,
|
|
2990
|
+
|
|
2991
|
+
// Primitives (for UI / tests)
|
|
2992
|
+
ListStatus: ListStatusSchema,
|
|
2993
|
+
ScrapingConfig: ScrapingConfigSchema,
|
|
2994
|
+
IcpRubric: IcpRubricSchema,
|
|
2995
|
+
PipelineConfig: PipelineConfigSchema,
|
|
2996
|
+
PipelineStage: PipelineStageSchema,
|
|
2997
|
+
BuildPlanSnapshot: BuildPlanSnapshotSchema,
|
|
2998
|
+
BuildPlanSnapshotStep: BuildPlanSnapshotStepSchema,
|
|
2999
|
+
AcqListMetadata: AcqListMetadataSchema,
|
|
3000
|
+
LeadGenStageKey: LeadGenStageKeySchema,
|
|
3001
|
+
LeadGenActionKey: LeadGenActionKeySchema,
|
|
3002
|
+
ProcessingStageStatus: ProcessingStageStatusSchema,
|
|
3003
|
+
ProcessingState: ProcessingStateSchema,
|
|
3004
|
+
ListStageCounts: ListStageCountsSchema,
|
|
3005
|
+
ListTelemetry: ListTelemetrySchema,
|
|
3006
|
+
|
|
3007
|
+
// Requests
|
|
3008
|
+
ListReadQuery: ListReadQuerySchema,
|
|
3009
|
+
GetListQuery: GetListQuerySchema,
|
|
3010
|
+
CreateListRequest: CreateListRequestSchema,
|
|
3011
|
+
UpdateListRequest: UpdateListRequestSchema,
|
|
3012
|
+
UpdateListStatusRequest: UpdateListStatusRequestSchema,
|
|
3013
|
+
UpdateListConfigRequest: UpdateListConfigRequestSchema,
|
|
3014
|
+
AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
|
|
3015
|
+
RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
|
|
3016
|
+
AddContactsToListRequest: AddContactsToListRequestSchema,
|
|
3017
|
+
RecordListExecutionRequest: RecordListExecutionRequestSchema,
|
|
3018
|
+
|
|
3019
|
+
// Responses
|
|
3020
|
+
AcqListResponse: AcqListResponseSchema,
|
|
3021
|
+
AcqListDetailResponse: AcqListDetailResponseSchema,
|
|
3022
|
+
AcqListListResponse: AcqListListResponseSchema,
|
|
3023
|
+
AcqListDealRef: AcqListDealRefSchema,
|
|
3024
|
+
AcqListLineage: AcqListLineageSchema,
|
|
3025
|
+
AcqListStatusResponse: AcqListStatusResponseSchema,
|
|
3026
|
+
ListTelemetryResponse: ListTelemetryResponseSchema,
|
|
3027
|
+
ListTelemetryListResponse: ListTelemetryListResponseSchema,
|
|
3028
|
+
ListExecutionsResponse: ListExecutionsResponseSchema,
|
|
3029
|
+
ListProgressResponse: ListProgressResponseSchema
|
|
2989
3030
|
}
|
|
2990
3031
|
```
|
|
2991
3032
|
|
|
2992
3033
|
### `AcqSubstrateSchemas`
|
|
2993
3034
|
|
|
2994
3035
|
```typescript
|
|
2995
|
-
export const AcqSubstrateSchemas = {
|
|
2996
|
-
// Artifacts
|
|
2997
|
-
ListArtifactsQuery: ListArtifactsQuerySchema,
|
|
2998
|
-
CreateArtifactRequest: CreateArtifactRequestSchema,
|
|
2999
|
-
AcqArtifactResponse: AcqArtifactResponseSchema,
|
|
3000
|
-
AcqArtifactListResponse: AcqArtifactListResponseSchema,
|
|
3001
|
-
|
|
3002
|
-
// List members
|
|
3003
|
-
ListMembersQuery: ListMembersQuerySchema,
|
|
3004
|
-
ListRecordsQuery: ListRecordsQuerySchema,
|
|
3005
|
-
MemberIdParams: MemberIdParamsSchema,
|
|
3006
|
-
AcqListMemberResponse: AcqListMemberResponseSchema,
|
|
3007
|
-
AcqListMembersResponse: AcqListMembersResponseSchema,
|
|
3008
|
-
AcqListCompanyRecordRow: AcqListCompanyRecordRowSchema,
|
|
3009
|
-
AcqListContactRecordRow: AcqListContactRecordRowSchema,
|
|
3010
|
-
ListRecordRow: ListRecordRowSchema,
|
|
3011
|
-
ListRecordsResponse: ListRecordsResponseSchema,
|
|
3012
|
-
|
|
3013
|
-
// List companies
|
|
3014
|
-
ListCompanyIdParams: ListCompanyIdParamsSchema,
|
|
3015
|
-
AcqListCompanyResponse: AcqListCompanyResponseSchema,
|
|
3016
|
-
|
|
3017
|
-
// Transition (generic stateful substrate)
|
|
3018
|
-
TransitionItemRequest: TransitionItemRequestSchema
|
|
3036
|
+
export const AcqSubstrateSchemas = {
|
|
3037
|
+
// Artifacts
|
|
3038
|
+
ListArtifactsQuery: ListArtifactsQuerySchema,
|
|
3039
|
+
CreateArtifactRequest: CreateArtifactRequestSchema,
|
|
3040
|
+
AcqArtifactResponse: AcqArtifactResponseSchema,
|
|
3041
|
+
AcqArtifactListResponse: AcqArtifactListResponseSchema,
|
|
3042
|
+
|
|
3043
|
+
// List members
|
|
3044
|
+
ListMembersQuery: ListMembersQuerySchema,
|
|
3045
|
+
ListRecordsQuery: ListRecordsQuerySchema,
|
|
3046
|
+
MemberIdParams: MemberIdParamsSchema,
|
|
3047
|
+
AcqListMemberResponse: AcqListMemberResponseSchema,
|
|
3048
|
+
AcqListMembersResponse: AcqListMembersResponseSchema,
|
|
3049
|
+
AcqListCompanyRecordRow: AcqListCompanyRecordRowSchema,
|
|
3050
|
+
AcqListContactRecordRow: AcqListContactRecordRowSchema,
|
|
3051
|
+
ListRecordRow: ListRecordRowSchema,
|
|
3052
|
+
ListRecordsResponse: ListRecordsResponseSchema,
|
|
3053
|
+
|
|
3054
|
+
// List companies
|
|
3055
|
+
ListCompanyIdParams: ListCompanyIdParamsSchema,
|
|
3056
|
+
AcqListCompanyResponse: AcqListCompanyResponseSchema,
|
|
3057
|
+
|
|
3058
|
+
// Transition (generic stateful substrate)
|
|
3059
|
+
TransitionItemRequest: TransitionItemRequestSchema
|
|
3019
3060
|
}
|
|
3020
3061
|
```
|
|
3021
3062
|
|
|
3022
3063
|
### `Stateful`
|
|
3023
3064
|
|
|
3024
3065
|
```typescript
|
|
3025
|
-
/**
|
|
3026
|
-
* Stateful trait — the (pipeline_key, stage_key, state_key, activity_log) quartet
|
|
3027
|
-
* applied to acq_deals (CRM HITL, shipped 2026-04-27) and being generalized to
|
|
3028
|
-
* acq_lists / acq_list_members / acq_list_companies via Track B.
|
|
3029
|
-
*/
|
|
3030
|
-
export interface Stateful {
|
|
3031
|
-
pipeline_key: string
|
|
3032
|
-
stage_key: string
|
|
3033
|
-
state_key: string
|
|
3034
|
-
activity_log: ActivityEvent[]
|
|
3066
|
+
/**
|
|
3067
|
+
* Stateful trait — the (pipeline_key, stage_key, state_key, activity_log) quartet
|
|
3068
|
+
* applied to acq_deals (CRM HITL, shipped 2026-04-27) and being generalized to
|
|
3069
|
+
* acq_lists / acq_list_members / acq_list_companies via Track B.
|
|
3070
|
+
*/
|
|
3071
|
+
export interface Stateful {
|
|
3072
|
+
pipeline_key: string
|
|
3073
|
+
stage_key: string
|
|
3074
|
+
state_key: string
|
|
3075
|
+
activity_log: ActivityEvent[]
|
|
3035
3076
|
}
|
|
3036
3077
|
```
|
|
3037
3078
|
|
|
3038
3079
|
### `TransitionItem`
|
|
3039
3080
|
|
|
3040
3081
|
```typescript
|
|
3041
|
-
/** Generic transition shape — concrete per-entity transitionItem implementations satisfy this. */
|
|
3042
|
-
export type TransitionItem<T extends Stateful, TEvent extends ActivityEvent> = (
|
|
3043
|
-
item: T,
|
|
3044
|
-
transition: { stage_key?: string; state_key?: string; event: TEvent }
|
|
3082
|
+
/** Generic transition shape — concrete per-entity transitionItem implementations satisfy this. */
|
|
3083
|
+
export type TransitionItem<T extends Stateful, TEvent extends ActivityEvent> = (
|
|
3084
|
+
item: T,
|
|
3085
|
+
transition: { stage_key?: string; state_key?: string; event: TEvent }
|
|
3045
3086
|
) => T
|
|
3046
3087
|
```
|
|
3047
3088
|
|
|
3048
3089
|
### `DeriveActions`
|
|
3049
3090
|
|
|
3050
3091
|
```typescript
|
|
3051
|
-
/** Generic action-derivation shape — concrete per-entity deriveActions implementations satisfy this. */
|
|
3092
|
+
/** Generic action-derivation shape — concrete per-entity deriveActions implementations satisfy this. */
|
|
3052
3093
|
export type DeriveActions<T extends Stateful, TAction> = (item: T) => TAction[]
|
|
3053
3094
|
```
|
|
3054
3095
|
|
|
3055
3096
|
### `StatefulSchema`
|
|
3056
3097
|
|
|
3057
3098
|
```typescript
|
|
3058
|
-
export const StatefulSchema = z.object({
|
|
3059
|
-
pipeline_key: z.string(),
|
|
3060
|
-
stage_key: z.string(),
|
|
3061
|
-
state_key: z.string(),
|
|
3062
|
-
activity_log: z.array(ActivityEventSchema)
|
|
3099
|
+
export const StatefulSchema = z.object({
|
|
3100
|
+
pipeline_key: z.string(),
|
|
3101
|
+
stage_key: z.string(),
|
|
3102
|
+
state_key: z.string(),
|
|
3103
|
+
activity_log: z.array(ActivityEventSchema)
|
|
3063
3104
|
})
|
|
3064
3105
|
```
|
|
3065
3106
|
|
|
3066
3107
|
### `StatefulStateDefinition`
|
|
3067
3108
|
|
|
3068
3109
|
```typescript
|
|
3069
|
-
/** One state within a stage — minimal shape: key + display label. */
|
|
3070
|
-
export interface StatefulStateDefinition {
|
|
3071
|
-
/** Matches state_key values written by workflow steps. */
|
|
3072
|
-
stateKey: string
|
|
3073
|
-
label: string
|
|
3110
|
+
/** One state within a stage — minimal shape: key + display label. */
|
|
3111
|
+
export interface StatefulStateDefinition {
|
|
3112
|
+
/** Matches state_key values written by workflow steps. */
|
|
3113
|
+
stateKey: string
|
|
3114
|
+
label: string
|
|
3074
3115
|
}
|
|
3075
3116
|
```
|
|
3076
3117
|
|
|
3077
3118
|
### `StatefulStageDefinition`
|
|
3078
3119
|
|
|
3079
3120
|
```typescript
|
|
3080
|
-
/** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
|
|
3081
|
-
export interface StatefulStageDefinition {
|
|
3082
|
-
/** Matches stage_key values written by workflow steps. */
|
|
3083
|
-
stageKey: string
|
|
3084
|
-
label: string
|
|
3085
|
-
/** UI color token. Consumers may map this to their design system. */
|
|
3086
|
-
color?: string
|
|
3087
|
-
states: StatefulStateDefinition[]
|
|
3121
|
+
/** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
|
|
3122
|
+
export interface StatefulStageDefinition {
|
|
3123
|
+
/** Matches stage_key values written by workflow steps. */
|
|
3124
|
+
stageKey: string
|
|
3125
|
+
label: string
|
|
3126
|
+
/** UI color token. Consumers may map this to their design system. */
|
|
3127
|
+
color?: string
|
|
3128
|
+
states: StatefulStateDefinition[]
|
|
3088
3129
|
}
|
|
3089
3130
|
```
|
|
3090
3131
|
|
|
3091
3132
|
### `StatefulPipelineDefinition`
|
|
3092
3133
|
|
|
3093
3134
|
```typescript
|
|
3094
|
-
/**
|
|
3095
|
-
* Pipeline definition for a single entity participating in the Stateful trait.
|
|
3096
|
-
* Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
|
|
3097
|
-
*/
|
|
3098
|
-
export interface StatefulPipelineDefinition {
|
|
3099
|
-
/** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
|
|
3100
|
-
pipelineKey: string
|
|
3101
|
-
label: string
|
|
3102
|
-
/** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
|
|
3103
|
-
entityKey: string
|
|
3104
|
-
stages: StatefulStageDefinition[]
|
|
3135
|
+
/**
|
|
3136
|
+
* Pipeline definition for a single entity participating in the Stateful trait.
|
|
3137
|
+
* Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
|
|
3138
|
+
*/
|
|
3139
|
+
export interface StatefulPipelineDefinition {
|
|
3140
|
+
/** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
|
|
3141
|
+
pipelineKey: string
|
|
3142
|
+
label: string
|
|
3143
|
+
/** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
|
|
3144
|
+
entityKey: string
|
|
3145
|
+
stages: StatefulStageDefinition[]
|
|
3105
3146
|
}
|
|
3106
3147
|
```
|
|
3107
3148
|
|
|
3108
3149
|
### `ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE`
|
|
3109
3150
|
|
|
3110
3151
|
```typescript
|
|
3111
|
-
/**
|
|
3112
|
-
* Lead-gen pipeline definition for acq_list_members (contacts).
|
|
3113
|
-
* Three stages matching the post-restructure sales subdomain tree.
|
|
3114
|
-
*
|
|
3115
|
-
* Note: members visit outreach and prospecting states depending on which
|
|
3116
|
-
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
3117
|
-
*/
|
|
3118
|
-
export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
3119
|
-
pipelineKey: 'lead-gen',
|
|
3120
|
-
label: 'Lead Generation',
|
|
3121
|
-
entityKey: 'acq.list-member',
|
|
3122
|
-
stages: [
|
|
3123
|
-
{
|
|
3124
|
-
stageKey: 'outreach',
|
|
3125
|
-
label: 'Outreach',
|
|
3126
|
-
states: [
|
|
3127
|
-
PENDING_STATE,
|
|
3128
|
-
{ stateKey: 'personalized', label: 'Personalized' },
|
|
3129
|
-
{ stateKey: 'uploaded', label: 'Uploaded' },
|
|
3130
|
-
{ stateKey: 'interested', label: 'Interested' }
|
|
3131
|
-
]
|
|
3132
|
-
},
|
|
3133
|
-
{
|
|
3134
|
-
stageKey: 'prospecting',
|
|
3135
|
-
label: 'Prospecting',
|
|
3136
|
-
states: [
|
|
3137
|
-
PENDING_STATE,
|
|
3138
|
-
{ stateKey: 'discovered', label: 'Discovered' },
|
|
3139
|
-
{ stateKey: 'verified', label: 'Verified' }
|
|
3140
|
-
]
|
|
3141
|
-
},
|
|
3142
|
-
{
|
|
3143
|
-
stageKey: 'qualification',
|
|
3144
|
-
label: 'Qualification',
|
|
3145
|
-
states: [PENDING_STATE]
|
|
3146
|
-
}
|
|
3147
|
-
]
|
|
3152
|
+
/**
|
|
3153
|
+
* Lead-gen pipeline definition for acq_list_members (contacts).
|
|
3154
|
+
* Three stages matching the post-restructure sales subdomain tree.
|
|
3155
|
+
*
|
|
3156
|
+
* Note: members visit outreach and prospecting states depending on which
|
|
3157
|
+
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
3158
|
+
*/
|
|
3159
|
+
export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
3160
|
+
pipelineKey: 'lead-gen',
|
|
3161
|
+
label: 'Lead Generation',
|
|
3162
|
+
entityKey: 'acq.list-member',
|
|
3163
|
+
stages: [
|
|
3164
|
+
{
|
|
3165
|
+
stageKey: 'outreach',
|
|
3166
|
+
label: 'Outreach',
|
|
3167
|
+
states: [
|
|
3168
|
+
PENDING_STATE,
|
|
3169
|
+
{ stateKey: 'personalized', label: 'Personalized' },
|
|
3170
|
+
{ stateKey: 'uploaded', label: 'Uploaded' },
|
|
3171
|
+
{ stateKey: 'interested', label: 'Interested' }
|
|
3172
|
+
]
|
|
3173
|
+
},
|
|
3174
|
+
{
|
|
3175
|
+
stageKey: 'prospecting',
|
|
3176
|
+
label: 'Prospecting',
|
|
3177
|
+
states: [
|
|
3178
|
+
PENDING_STATE,
|
|
3179
|
+
{ stateKey: 'discovered', label: 'Discovered' },
|
|
3180
|
+
{ stateKey: 'verified', label: 'Verified' }
|
|
3181
|
+
]
|
|
3182
|
+
},
|
|
3183
|
+
{
|
|
3184
|
+
stageKey: 'qualification',
|
|
3185
|
+
label: 'Qualification',
|
|
3186
|
+
states: [PENDING_STATE]
|
|
3187
|
+
}
|
|
3188
|
+
]
|
|
3148
3189
|
}
|
|
3149
3190
|
```
|
|
3150
3191
|
|
|
3151
3192
|
### `ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE`
|
|
3152
3193
|
|
|
3153
3194
|
```typescript
|
|
3154
|
-
/**
|
|
3155
|
-
* Lead-gen pipeline definition for acq_list_companies.
|
|
3156
|
-
* Three stages matching the post-restructure sales subdomain tree.
|
|
3157
|
-
*
|
|
3158
|
-
* Note: companies visit prospecting and qualification states depending on which
|
|
3159
|
-
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
3160
|
-
*/
|
|
3161
|
-
export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
3162
|
-
pipelineKey: 'lead-gen',
|
|
3163
|
-
label: 'Lead Generation',
|
|
3164
|
-
entityKey: 'acq.list-company',
|
|
3165
|
-
stages: [
|
|
3166
|
-
{
|
|
3167
|
-
stageKey: 'outreach',
|
|
3168
|
-
label: 'Outreach',
|
|
3169
|
-
states: [PENDING_STATE, { stateKey: 'uploaded', label: 'Uploaded' }]
|
|
3170
|
-
},
|
|
3171
|
-
{
|
|
3172
|
-
stageKey: 'prospecting',
|
|
3173
|
-
label: 'Prospecting',
|
|
3174
|
-
states: [
|
|
3175
|
-
PENDING_STATE,
|
|
3176
|
-
{ stateKey: 'populated', label: 'Populated' },
|
|
3177
|
-
{ stateKey: 'extracted', label: 'Extracted' }
|
|
3178
|
-
]
|
|
3179
|
-
},
|
|
3180
|
-
{
|
|
3181
|
-
stageKey: 'qualification',
|
|
3182
|
-
label: 'Qualification',
|
|
3183
|
-
states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
|
|
3184
|
-
}
|
|
3185
|
-
]
|
|
3195
|
+
/**
|
|
3196
|
+
* Lead-gen pipeline definition for acq_list_companies.
|
|
3197
|
+
* Three stages matching the post-restructure sales subdomain tree.
|
|
3198
|
+
*
|
|
3199
|
+
* Note: companies visit prospecting and qualification states depending on which
|
|
3200
|
+
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
3201
|
+
*/
|
|
3202
|
+
export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
3203
|
+
pipelineKey: 'lead-gen',
|
|
3204
|
+
label: 'Lead Generation',
|
|
3205
|
+
entityKey: 'acq.list-company',
|
|
3206
|
+
stages: [
|
|
3207
|
+
{
|
|
3208
|
+
stageKey: 'outreach',
|
|
3209
|
+
label: 'Outreach',
|
|
3210
|
+
states: [PENDING_STATE, { stateKey: 'uploaded', label: 'Uploaded' }]
|
|
3211
|
+
},
|
|
3212
|
+
{
|
|
3213
|
+
stageKey: 'prospecting',
|
|
3214
|
+
label: 'Prospecting',
|
|
3215
|
+
states: [
|
|
3216
|
+
PENDING_STATE,
|
|
3217
|
+
{ stateKey: 'populated', label: 'Populated' },
|
|
3218
|
+
{ stateKey: 'extracted', label: 'Extracted' }
|
|
3219
|
+
]
|
|
3220
|
+
},
|
|
3221
|
+
{
|
|
3222
|
+
stageKey: 'qualification',
|
|
3223
|
+
label: 'Qualification',
|
|
3224
|
+
states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
|
|
3225
|
+
}
|
|
3226
|
+
]
|
|
3186
3227
|
}
|
|
3187
3228
|
```
|
|
3188
3229
|
|
|
3189
3230
|
### `LEAD_GEN_PIPELINE_DEFINITIONS`
|
|
3190
3231
|
|
|
3191
3232
|
```typescript
|
|
3192
|
-
/**
|
|
3193
|
-
* All lead-gen pipeline definitions indexed by entity key.
|
|
3194
|
-
* Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
|
|
3195
|
-
*/
|
|
3196
|
-
export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
|
|
3197
|
-
'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
|
|
3198
|
-
'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
|
|
3233
|
+
/**
|
|
3234
|
+
* All lead-gen pipeline definitions indexed by entity key.
|
|
3235
|
+
* Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
|
|
3236
|
+
*/
|
|
3237
|
+
export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
|
|
3238
|
+
'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
|
|
3239
|
+
'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
|
|
3199
3240
|
}
|
|
3200
3241
|
```
|
|
3201
3242
|
|
|
3202
3243
|
### `PaginationParams`
|
|
3203
3244
|
|
|
3204
3245
|
```typescript
|
|
3205
|
-
export interface PaginationParams {
|
|
3206
|
-
limit: number
|
|
3207
|
-
offset: number
|
|
3246
|
+
export interface PaginationParams {
|
|
3247
|
+
limit: number
|
|
3248
|
+
offset: number
|
|
3208
3249
|
}
|
|
3209
3250
|
```
|
|
3210
3251
|
|
|
3211
3252
|
### `PaginatedResult`
|
|
3212
3253
|
|
|
3213
3254
|
```typescript
|
|
3214
|
-
export interface PaginatedResult<T> {
|
|
3215
|
-
data: T[]
|
|
3216
|
-
total: number
|
|
3217
|
-
limit: number
|
|
3218
|
-
offset: number
|
|
3255
|
+
export interface PaginatedResult<T> {
|
|
3256
|
+
data: T[]
|
|
3257
|
+
total: number
|
|
3258
|
+
limit: number
|
|
3259
|
+
offset: number
|
|
3219
3260
|
}
|
|
3220
3261
|
```
|
|
3221
3262
|
|
|
3222
3263
|
### `CreateListParams`
|
|
3223
3264
|
|
|
3224
3265
|
```typescript
|
|
3225
|
-
export interface CreateListParams {
|
|
3226
|
-
organizationId: string
|
|
3227
|
-
name: string
|
|
3228
|
-
description?: string
|
|
3229
|
-
type?: string
|
|
3230
|
-
batchIds?: string[]
|
|
3231
|
-
instantlyCampaignId?: string
|
|
3232
|
-
status?: ListStatus
|
|
3233
|
-
buildTemplateId?: string
|
|
3234
|
-
metadata?: Record<string, unknown>
|
|
3235
|
-
scrapingConfig?: ScrapingConfig
|
|
3236
|
-
icp?: IcpRubric
|
|
3237
|
-
pipelineConfig?: PipelineConfig
|
|
3266
|
+
export interface CreateListParams {
|
|
3267
|
+
organizationId: string
|
|
3268
|
+
name: string
|
|
3269
|
+
description?: string
|
|
3270
|
+
type?: string
|
|
3271
|
+
batchIds?: string[]
|
|
3272
|
+
instantlyCampaignId?: string
|
|
3273
|
+
status?: ListStatus
|
|
3274
|
+
buildTemplateId?: string
|
|
3275
|
+
metadata?: Record<string, unknown>
|
|
3276
|
+
scrapingConfig?: ScrapingConfig
|
|
3277
|
+
icp?: IcpRubric
|
|
3278
|
+
pipelineConfig?: PipelineConfig
|
|
3238
3279
|
}
|
|
3239
3280
|
```
|
|
3240
3281
|
|
|
3241
3282
|
### `UpdateListParams`
|
|
3242
3283
|
|
|
3243
3284
|
```typescript
|
|
3244
|
-
export interface UpdateListParams {
|
|
3245
|
-
name?: string
|
|
3246
|
-
description?: string
|
|
3247
|
-
batchIds?: string[]
|
|
3285
|
+
export interface UpdateListParams {
|
|
3286
|
+
name?: string
|
|
3287
|
+
description?: string
|
|
3288
|
+
batchIds?: string[]
|
|
3248
3289
|
}
|
|
3249
3290
|
```
|
|
3250
3291
|
|
|
3251
3292
|
### `CreateCompanyParams`
|
|
3252
3293
|
|
|
3253
3294
|
```typescript
|
|
3254
|
-
export interface CreateCompanyParams {
|
|
3255
|
-
organizationId: string
|
|
3256
|
-
name: string
|
|
3257
|
-
domain?: string
|
|
3258
|
-
linkedinUrl?: string
|
|
3259
|
-
website?: string
|
|
3260
|
-
numEmployees?: number
|
|
3261
|
-
foundedYear?: number
|
|
3262
|
-
locationCity?: string
|
|
3263
|
-
locationState?: string
|
|
3264
|
-
category?: string
|
|
3265
|
-
source?: string
|
|
3266
|
-
batchId?: string
|
|
3267
|
-
verticalResearch?: string
|
|
3268
|
-
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3269
|
-
pipelineStatus?: unknown
|
|
3295
|
+
export interface CreateCompanyParams {
|
|
3296
|
+
organizationId: string
|
|
3297
|
+
name: string
|
|
3298
|
+
domain?: string
|
|
3299
|
+
linkedinUrl?: string
|
|
3300
|
+
website?: string
|
|
3301
|
+
numEmployees?: number
|
|
3302
|
+
foundedYear?: number
|
|
3303
|
+
locationCity?: string
|
|
3304
|
+
locationState?: string
|
|
3305
|
+
category?: string
|
|
3306
|
+
source?: string
|
|
3307
|
+
batchId?: string
|
|
3308
|
+
verticalResearch?: string
|
|
3309
|
+
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3310
|
+
pipelineStatus?: unknown
|
|
3270
3311
|
}
|
|
3271
3312
|
```
|
|
3272
3313
|
|
|
3273
3314
|
### `UpdateCompanyParams`
|
|
3274
3315
|
|
|
3275
3316
|
```typescript
|
|
3276
|
-
export interface UpdateCompanyParams {
|
|
3277
|
-
name?: string
|
|
3278
|
-
domain?: string
|
|
3279
|
-
linkedinUrl?: string
|
|
3280
|
-
website?: string
|
|
3281
|
-
numEmployees?: number
|
|
3282
|
-
foundedYear?: number
|
|
3283
|
-
locationCity?: string
|
|
3284
|
-
locationState?: string
|
|
3285
|
-
category?: string
|
|
3286
|
-
segment?: string
|
|
3287
|
-
processingState?: ProcessingState
|
|
3288
|
-
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3289
|
-
pipelineStatus?: unknown
|
|
3290
|
-
enrichmentData?: Record<string, unknown>
|
|
3291
|
-
source?: string
|
|
3292
|
-
batchId?: string
|
|
3293
|
-
status?: 'active' | 'invalid'
|
|
3294
|
-
verticalResearch?: string | null
|
|
3295
|
-
/** Track A: flat qualification score column (null until a scoring rubric is defined) */
|
|
3296
|
-
qualificationScore?: number | null
|
|
3297
|
-
/** Track A: flat qualification signals jsonb */
|
|
3298
|
-
qualificationSignals?: Record<string, unknown> | null
|
|
3299
|
-
/** Track A: key identifying the rubric used for qualification */
|
|
3300
|
-
qualificationRubricKey?: string | null
|
|
3317
|
+
export interface UpdateCompanyParams {
|
|
3318
|
+
name?: string
|
|
3319
|
+
domain?: string
|
|
3320
|
+
linkedinUrl?: string
|
|
3321
|
+
website?: string
|
|
3322
|
+
numEmployees?: number
|
|
3323
|
+
foundedYear?: number
|
|
3324
|
+
locationCity?: string
|
|
3325
|
+
locationState?: string
|
|
3326
|
+
category?: string
|
|
3327
|
+
segment?: string
|
|
3328
|
+
processingState?: ProcessingState
|
|
3329
|
+
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3330
|
+
pipelineStatus?: unknown
|
|
3331
|
+
enrichmentData?: Record<string, unknown>
|
|
3332
|
+
source?: string
|
|
3333
|
+
batchId?: string
|
|
3334
|
+
status?: 'active' | 'invalid'
|
|
3335
|
+
verticalResearch?: string | null
|
|
3336
|
+
/** Track A: flat qualification score column (null until a scoring rubric is defined) */
|
|
3337
|
+
qualificationScore?: number | null
|
|
3338
|
+
/** Track A: flat qualification signals jsonb */
|
|
3339
|
+
qualificationSignals?: Record<string, unknown> | null
|
|
3340
|
+
/** Track A: key identifying the rubric used for qualification */
|
|
3341
|
+
qualificationRubricKey?: string | null
|
|
3301
3342
|
}
|
|
3302
3343
|
```
|
|
3303
3344
|
|
|
@@ -3310,63 +3351,63 @@ export type UpsertCompanyParams = CreateCompanyParams
|
|
|
3310
3351
|
### `CompanyFilters`
|
|
3311
3352
|
|
|
3312
3353
|
```typescript
|
|
3313
|
-
export interface CompanyFilters {
|
|
3314
|
-
listId?: string // Filter to companies in a specific list (via acq_list_companies)
|
|
3315
|
-
search?: string
|
|
3316
|
-
domain?: string
|
|
3317
|
-
website?: string
|
|
3318
|
-
segment?: string
|
|
3319
|
-
category?: string
|
|
3320
|
-
processingState?: ProcessingState
|
|
3321
|
-
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3322
|
-
pipelineStatus?: unknown
|
|
3323
|
-
/** Exclude companies whose processing state contains this value (PostgREST NOT contains) */
|
|
3324
|
-
processingStateNot?: ProcessingState
|
|
3325
|
-
batchId?: string
|
|
3326
|
-
status?: 'active' | 'invalid'
|
|
3327
|
-
includeAll?: boolean
|
|
3328
|
-
excludeColumns?: Array<'enrichmentData' | 'processingState'>
|
|
3329
|
-
limit?: number
|
|
3354
|
+
export interface CompanyFilters {
|
|
3355
|
+
listId?: string // Filter to companies in a specific list (via acq_list_companies)
|
|
3356
|
+
search?: string
|
|
3357
|
+
domain?: string
|
|
3358
|
+
website?: string
|
|
3359
|
+
segment?: string
|
|
3360
|
+
category?: string
|
|
3361
|
+
processingState?: ProcessingState
|
|
3362
|
+
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3363
|
+
pipelineStatus?: unknown
|
|
3364
|
+
/** Exclude companies whose processing state contains this value (PostgREST NOT contains) */
|
|
3365
|
+
processingStateNot?: ProcessingState
|
|
3366
|
+
batchId?: string
|
|
3367
|
+
status?: 'active' | 'invalid'
|
|
3368
|
+
includeAll?: boolean
|
|
3369
|
+
excludeColumns?: Array<'enrichmentData' | 'processingState'>
|
|
3370
|
+
limit?: number
|
|
3330
3371
|
}
|
|
3331
3372
|
```
|
|
3332
3373
|
|
|
3333
3374
|
### `CreateContactParams`
|
|
3334
3375
|
|
|
3335
3376
|
```typescript
|
|
3336
|
-
export interface CreateContactParams {
|
|
3337
|
-
organizationId: string
|
|
3338
|
-
email: string
|
|
3339
|
-
companyId?: string
|
|
3340
|
-
firstName?: string
|
|
3341
|
-
lastName?: string
|
|
3342
|
-
linkedinUrl?: string
|
|
3343
|
-
title?: string
|
|
3344
|
-
source?: string
|
|
3345
|
-
sourceId?: string
|
|
3346
|
-
batchId?: string
|
|
3347
|
-
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3348
|
-
pipelineStatus?: unknown
|
|
3377
|
+
export interface CreateContactParams {
|
|
3378
|
+
organizationId: string
|
|
3379
|
+
email: string
|
|
3380
|
+
companyId?: string
|
|
3381
|
+
firstName?: string
|
|
3382
|
+
lastName?: string
|
|
3383
|
+
linkedinUrl?: string
|
|
3384
|
+
title?: string
|
|
3385
|
+
source?: string
|
|
3386
|
+
sourceId?: string
|
|
3387
|
+
batchId?: string
|
|
3388
|
+
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3389
|
+
pipelineStatus?: unknown
|
|
3349
3390
|
}
|
|
3350
3391
|
```
|
|
3351
3392
|
|
|
3352
3393
|
### `UpdateContactParams`
|
|
3353
3394
|
|
|
3354
3395
|
```typescript
|
|
3355
|
-
export interface UpdateContactParams {
|
|
3356
|
-
companyId?: string
|
|
3357
|
-
emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN'
|
|
3358
|
-
firstName?: string
|
|
3359
|
-
lastName?: string
|
|
3360
|
-
linkedinUrl?: string
|
|
3361
|
-
title?: string
|
|
3362
|
-
headline?: string
|
|
3363
|
-
filterReason?: string
|
|
3364
|
-
openingLine?: string
|
|
3365
|
-
processingState?: ProcessingState
|
|
3366
|
-
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3367
|
-
pipelineStatus?: unknown
|
|
3368
|
-
enrichmentData?: Record<string, unknown>
|
|
3369
|
-
status?: 'active' | 'invalid'
|
|
3396
|
+
export interface UpdateContactParams {
|
|
3397
|
+
companyId?: string
|
|
3398
|
+
emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN'
|
|
3399
|
+
firstName?: string
|
|
3400
|
+
lastName?: string
|
|
3401
|
+
linkedinUrl?: string
|
|
3402
|
+
title?: string
|
|
3403
|
+
headline?: string
|
|
3404
|
+
filterReason?: string
|
|
3405
|
+
openingLine?: string
|
|
3406
|
+
processingState?: ProcessingState
|
|
3407
|
+
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3408
|
+
pipelineStatus?: unknown
|
|
3409
|
+
enrichmentData?: Record<string, unknown>
|
|
3410
|
+
status?: 'active' | 'invalid'
|
|
3370
3411
|
}
|
|
3371
3412
|
```
|
|
3372
3413
|
|
|
@@ -3379,400 +3420,400 @@ export type UpsertContactParams = CreateContactParams
|
|
|
3379
3420
|
### `ContactFilters`
|
|
3380
3421
|
|
|
3381
3422
|
```typescript
|
|
3382
|
-
export interface ContactFilters {
|
|
3383
|
-
listId?: string // Filter to contacts in a specific list (via acq_list_members)
|
|
3384
|
-
search?: string
|
|
3385
|
-
openingLineIsNull?: boolean // Filter to contacts without personalization
|
|
3386
|
-
processingState?: ProcessingState
|
|
3387
|
-
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3388
|
-
pipelineStatus?: unknown
|
|
3389
|
-
batchId?: string
|
|
3390
|
-
contactStatus?: 'active' | 'invalid' // Filter by contact status (soft-delete flag)
|
|
3423
|
+
export interface ContactFilters {
|
|
3424
|
+
listId?: string // Filter to contacts in a specific list (via acq_list_members)
|
|
3425
|
+
search?: string
|
|
3426
|
+
openingLineIsNull?: boolean // Filter to contacts without personalization
|
|
3427
|
+
processingState?: ProcessingState
|
|
3428
|
+
/** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
|
|
3429
|
+
pipelineStatus?: unknown
|
|
3430
|
+
batchId?: string
|
|
3431
|
+
contactStatus?: 'active' | 'invalid' // Filter by contact status (soft-delete flag)
|
|
3391
3432
|
}
|
|
3392
3433
|
```
|
|
3393
3434
|
|
|
3394
3435
|
### `UpsertSocialPostParams`
|
|
3395
3436
|
|
|
3396
3437
|
```typescript
|
|
3397
|
-
export interface UpsertSocialPostParams {
|
|
3398
|
-
organizationId: string
|
|
3399
|
-
platform: string
|
|
3400
|
-
platformPostId: string
|
|
3401
|
-
authorName: string
|
|
3402
|
-
authorUrl?: string | null
|
|
3403
|
-
postTitle: string
|
|
3404
|
-
postText: string
|
|
3405
|
-
postUrl: string
|
|
3406
|
-
engagementCount?: number
|
|
3407
|
-
commentsCount?: number
|
|
3408
|
-
postedAt: string
|
|
3409
|
-
metadata?: Record<string, unknown>
|
|
3410
|
-
relevanceScore?: number
|
|
3411
|
-
matchedKeywords?: string[]
|
|
3412
|
-
matchedQuery?: string | null
|
|
3413
|
-
initialDraft?: string | null
|
|
3414
|
-
finalResponse?: string | null
|
|
3415
|
-
sourceCategory?: string | null
|
|
3438
|
+
export interface UpsertSocialPostParams {
|
|
3439
|
+
organizationId: string
|
|
3440
|
+
platform: string
|
|
3441
|
+
platformPostId: string
|
|
3442
|
+
authorName: string
|
|
3443
|
+
authorUrl?: string | null
|
|
3444
|
+
postTitle: string
|
|
3445
|
+
postText: string
|
|
3446
|
+
postUrl: string
|
|
3447
|
+
engagementCount?: number
|
|
3448
|
+
commentsCount?: number
|
|
3449
|
+
postedAt: string
|
|
3450
|
+
metadata?: Record<string, unknown>
|
|
3451
|
+
relevanceScore?: number
|
|
3452
|
+
matchedKeywords?: string[]
|
|
3453
|
+
matchedQuery?: string | null
|
|
3454
|
+
initialDraft?: string | null
|
|
3455
|
+
finalResponse?: string | null
|
|
3456
|
+
sourceCategory?: string | null
|
|
3416
3457
|
}
|
|
3417
3458
|
```
|
|
3418
3459
|
|
|
3419
3460
|
### `UpsertSocialPostsParams`
|
|
3420
3461
|
|
|
3421
3462
|
```typescript
|
|
3422
|
-
export interface UpsertSocialPostsParams {
|
|
3423
|
-
organizationId: string
|
|
3424
|
-
posts: Omit<UpsertSocialPostParams, 'organizationId'>[]
|
|
3463
|
+
export interface UpsertSocialPostsParams {
|
|
3464
|
+
organizationId: string
|
|
3465
|
+
posts: Omit<UpsertSocialPostParams, 'organizationId'>[]
|
|
3425
3466
|
}
|
|
3426
3467
|
```
|
|
3427
3468
|
|
|
3428
3469
|
### `UpsertSocialPostsResult`
|
|
3429
3470
|
|
|
3430
3471
|
```typescript
|
|
3431
|
-
export interface UpsertSocialPostsResult {
|
|
3432
|
-
inserted: number
|
|
3433
|
-
duplicatesSkipped: number
|
|
3472
|
+
export interface UpsertSocialPostsResult {
|
|
3473
|
+
inserted: number
|
|
3474
|
+
duplicatesSkipped: number
|
|
3434
3475
|
}
|
|
3435
3476
|
```
|
|
3436
3477
|
|
|
3437
3478
|
### `AddContactsToListParams`
|
|
3438
3479
|
|
|
3439
3480
|
```typescript
|
|
3440
|
-
export interface AddContactsToListParams {
|
|
3441
|
-
organizationId: string
|
|
3442
|
-
listId: string
|
|
3443
|
-
contactIds: string[]
|
|
3481
|
+
export interface AddContactsToListParams {
|
|
3482
|
+
organizationId: string
|
|
3483
|
+
listId: string
|
|
3484
|
+
contactIds: string[]
|
|
3444
3485
|
}
|
|
3445
3486
|
```
|
|
3446
3487
|
|
|
3447
3488
|
### `AddContactsToListResult`
|
|
3448
3489
|
|
|
3449
3490
|
```typescript
|
|
3450
|
-
export interface AddContactsToListResult {
|
|
3451
|
-
added: number
|
|
3452
|
-
alreadyExisted: number
|
|
3491
|
+
export interface AddContactsToListResult {
|
|
3492
|
+
added: number
|
|
3493
|
+
alreadyExisted: number
|
|
3453
3494
|
}
|
|
3454
3495
|
```
|
|
3455
3496
|
|
|
3456
3497
|
### `UpdateListConfigParams`
|
|
3457
3498
|
|
|
3458
3499
|
```typescript
|
|
3459
|
-
export interface UpdateListConfigParams {
|
|
3460
|
-
organizationId: string
|
|
3461
|
-
listId: string
|
|
3462
|
-
scrapingConfig?: ScrapingConfig
|
|
3463
|
-
icp?: IcpRubric
|
|
3464
|
-
pipelineConfig?: PipelineConfig
|
|
3500
|
+
export interface UpdateListConfigParams {
|
|
3501
|
+
organizationId: string
|
|
3502
|
+
listId: string
|
|
3503
|
+
scrapingConfig?: ScrapingConfig
|
|
3504
|
+
icp?: IcpRubric
|
|
3505
|
+
pipelineConfig?: PipelineConfig
|
|
3465
3506
|
}
|
|
3466
3507
|
```
|
|
3467
3508
|
|
|
3468
3509
|
### `UpdateCompanyStageParams`
|
|
3469
3510
|
|
|
3470
3511
|
```typescript
|
|
3471
|
-
export interface UpdateCompanyStageParams {
|
|
3472
|
-
organizationId: string
|
|
3473
|
-
listId: string
|
|
3474
|
-
companyId: string
|
|
3475
|
-
stage: string
|
|
3476
|
-
status?: ProcessingStageStatus
|
|
3477
|
-
executionId?: string
|
|
3512
|
+
export interface UpdateCompanyStageParams {
|
|
3513
|
+
organizationId: string
|
|
3514
|
+
listId: string
|
|
3515
|
+
companyId: string
|
|
3516
|
+
stage: string
|
|
3517
|
+
status?: ProcessingStageStatus
|
|
3518
|
+
executionId?: string
|
|
3478
3519
|
}
|
|
3479
3520
|
```
|
|
3480
3521
|
|
|
3481
3522
|
### `UpdateContactStageParams`
|
|
3482
3523
|
|
|
3483
3524
|
```typescript
|
|
3484
|
-
export interface UpdateContactStageParams {
|
|
3485
|
-
organizationId: string
|
|
3486
|
-
listId: string
|
|
3487
|
-
contactId: string
|
|
3488
|
-
stage: string
|
|
3489
|
-
status?: ProcessingStageStatus
|
|
3490
|
-
executionId?: string
|
|
3525
|
+
export interface UpdateContactStageParams {
|
|
3526
|
+
organizationId: string
|
|
3527
|
+
listId: string
|
|
3528
|
+
contactId: string
|
|
3529
|
+
stage: string
|
|
3530
|
+
status?: ProcessingStageStatus
|
|
3531
|
+
executionId?: string
|
|
3491
3532
|
}
|
|
3492
3533
|
```
|
|
3493
3534
|
|
|
3494
3535
|
### `AddCompaniesToListParams`
|
|
3495
3536
|
|
|
3496
3537
|
```typescript
|
|
3497
|
-
export interface AddCompaniesToListParams {
|
|
3498
|
-
organizationId: string
|
|
3499
|
-
listId: string
|
|
3500
|
-
companyIds: string[]
|
|
3538
|
+
export interface AddCompaniesToListParams {
|
|
3539
|
+
organizationId: string
|
|
3540
|
+
listId: string
|
|
3541
|
+
companyIds: string[]
|
|
3501
3542
|
}
|
|
3502
3543
|
```
|
|
3503
3544
|
|
|
3504
3545
|
### `AddCompaniesToListResult`
|
|
3505
3546
|
|
|
3506
3547
|
```typescript
|
|
3507
|
-
export interface AddCompaniesToListResult {
|
|
3508
|
-
added: number
|
|
3509
|
-
alreadyExisted: number
|
|
3548
|
+
export interface AddCompaniesToListResult {
|
|
3549
|
+
added: number
|
|
3550
|
+
alreadyExisted: number
|
|
3510
3551
|
}
|
|
3511
3552
|
```
|
|
3512
3553
|
|
|
3513
3554
|
### `RemoveCompaniesFromListParams`
|
|
3514
3555
|
|
|
3515
3556
|
```typescript
|
|
3516
|
-
export interface RemoveCompaniesFromListParams {
|
|
3517
|
-
organizationId: string
|
|
3518
|
-
listId: string
|
|
3519
|
-
companyIds: string[]
|
|
3557
|
+
export interface RemoveCompaniesFromListParams {
|
|
3558
|
+
organizationId: string
|
|
3559
|
+
listId: string
|
|
3560
|
+
companyIds: string[]
|
|
3520
3561
|
}
|
|
3521
3562
|
```
|
|
3522
3563
|
|
|
3523
3564
|
### `RemoveCompaniesFromListResult`
|
|
3524
3565
|
|
|
3525
3566
|
```typescript
|
|
3526
|
-
export interface RemoveCompaniesFromListResult {
|
|
3527
|
-
removed: number
|
|
3567
|
+
export interface RemoveCompaniesFromListResult {
|
|
3568
|
+
removed: number
|
|
3528
3569
|
}
|
|
3529
3570
|
```
|
|
3530
3571
|
|
|
3531
3572
|
### `RecordListExecutionParams`
|
|
3532
3573
|
|
|
3533
3574
|
```typescript
|
|
3534
|
-
export interface RecordListExecutionParams {
|
|
3535
|
-
organizationId: string
|
|
3536
|
-
listId: string
|
|
3537
|
-
executionId: string
|
|
3538
|
-
configSnapshot?: Record<string, unknown>
|
|
3575
|
+
export interface RecordListExecutionParams {
|
|
3576
|
+
organizationId: string
|
|
3577
|
+
listId: string
|
|
3578
|
+
executionId: string
|
|
3579
|
+
configSnapshot?: Record<string, unknown>
|
|
3539
3580
|
}
|
|
3540
3581
|
```
|
|
3541
3582
|
|
|
3542
3583
|
### `ListExecutionSummary`
|
|
3543
3584
|
|
|
3544
3585
|
```typescript
|
|
3545
|
-
export interface ListExecutionSummary {
|
|
3546
|
-
executionId: string
|
|
3547
|
-
resourceId: string
|
|
3548
|
-
status: string
|
|
3549
|
-
createdAt: string
|
|
3550
|
-
completedAt: string | null
|
|
3551
|
-
durationMs: number | null
|
|
3586
|
+
export interface ListExecutionSummary {
|
|
3587
|
+
executionId: string
|
|
3588
|
+
resourceId: string
|
|
3589
|
+
status: string
|
|
3590
|
+
createdAt: string
|
|
3591
|
+
completedAt: string | null
|
|
3592
|
+
durationMs: number | null
|
|
3552
3593
|
}
|
|
3553
3594
|
```
|
|
3554
3595
|
|
|
3555
3596
|
### `BulkImportParams`
|
|
3556
3597
|
|
|
3557
3598
|
```typescript
|
|
3558
|
-
export interface BulkImportParams {
|
|
3559
|
-
organizationId: string
|
|
3560
|
-
contacts: CreateContactParams[]
|
|
3561
|
-
listId?: string
|
|
3599
|
+
export interface BulkImportParams {
|
|
3600
|
+
organizationId: string
|
|
3601
|
+
contacts: CreateContactParams[]
|
|
3602
|
+
listId?: string
|
|
3562
3603
|
}
|
|
3563
3604
|
```
|
|
3564
3605
|
|
|
3565
3606
|
### `BulkImportResult`
|
|
3566
3607
|
|
|
3567
3608
|
```typescript
|
|
3568
|
-
export interface BulkImportResult {
|
|
3569
|
-
created: number
|
|
3570
|
-
updated: number
|
|
3571
|
-
errors: Array<{ email: string; error: string }>
|
|
3609
|
+
export interface BulkImportResult {
|
|
3610
|
+
created: number
|
|
3611
|
+
updated: number
|
|
3612
|
+
errors: Array<{ email: string; error: string }>
|
|
3572
3613
|
}
|
|
3573
3614
|
```
|
|
3574
3615
|
|
|
3575
3616
|
### `BulkImportCompanyEntry`
|
|
3576
3617
|
|
|
3577
3618
|
```typescript
|
|
3578
|
-
export interface BulkImportCompanyEntry {
|
|
3579
|
-
name: string
|
|
3580
|
-
domain: string
|
|
3581
|
-
website?: string
|
|
3582
|
-
locationCity?: string
|
|
3583
|
-
locationState?: string
|
|
3584
|
-
category?: string
|
|
3585
|
-
source?: string
|
|
3586
|
-
enrichmentData?: Record<string, unknown>
|
|
3587
|
-
processingState?: ProcessingState
|
|
3619
|
+
export interface BulkImportCompanyEntry {
|
|
3620
|
+
name: string
|
|
3621
|
+
domain: string
|
|
3622
|
+
website?: string
|
|
3623
|
+
locationCity?: string
|
|
3624
|
+
locationState?: string
|
|
3625
|
+
category?: string
|
|
3626
|
+
source?: string
|
|
3627
|
+
enrichmentData?: Record<string, unknown>
|
|
3628
|
+
processingState?: ProcessingState
|
|
3588
3629
|
}
|
|
3589
3630
|
```
|
|
3590
3631
|
|
|
3591
3632
|
### `BulkImportCompaniesParams`
|
|
3592
3633
|
|
|
3593
3634
|
```typescript
|
|
3594
|
-
export interface BulkImportCompaniesParams {
|
|
3595
|
-
organizationId: string
|
|
3596
|
-
batchId: string
|
|
3597
|
-
companies: BulkImportCompanyEntry[]
|
|
3635
|
+
export interface BulkImportCompaniesParams {
|
|
3636
|
+
organizationId: string
|
|
3637
|
+
batchId: string
|
|
3638
|
+
companies: BulkImportCompanyEntry[]
|
|
3598
3639
|
}
|
|
3599
3640
|
```
|
|
3600
3641
|
|
|
3601
3642
|
### `BulkImportCompaniesResult`
|
|
3602
3643
|
|
|
3603
3644
|
```typescript
|
|
3604
|
-
export interface BulkImportCompaniesResult {
|
|
3605
|
-
created: number
|
|
3606
|
-
skipped: number
|
|
3607
|
-
errors: Array<{ companyName: string; error: string }>
|
|
3645
|
+
export interface BulkImportCompaniesResult {
|
|
3646
|
+
created: number
|
|
3647
|
+
skipped: number
|
|
3648
|
+
errors: Array<{ companyName: string; error: string }>
|
|
3608
3649
|
}
|
|
3609
3650
|
```
|
|
3610
3651
|
|
|
3611
3652
|
### `LeadToolMap`
|
|
3612
3653
|
|
|
3613
3654
|
```typescript
|
|
3614
|
-
export type LeadToolMap = {
|
|
3615
|
-
// List operations
|
|
3616
|
-
listLists: { params: Record<string, never>; result: AcqList[] }
|
|
3617
|
-
createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
|
|
3618
|
-
updateList: { params: { id: string } & UpdateListParams; result: AcqList }
|
|
3619
|
-
deleteList: { params: { id: string }; result: void }
|
|
3620
|
-
addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
|
|
3621
|
-
addCompaniesToList: { params: Omit<AddCompaniesToListParams, 'organizationId'>; result: AddCompaniesToListResult }
|
|
3622
|
-
updateCompanyStage: {
|
|
3623
|
-
params: Omit<UpdateCompanyStageParams, 'organizationId'>
|
|
3624
|
-
result: void
|
|
3625
|
-
}
|
|
3626
|
-
updateContactStage: {
|
|
3627
|
-
params: Omit<UpdateContactStageParams, 'organizationId'>
|
|
3628
|
-
result: void
|
|
3629
|
-
}
|
|
3630
|
-
// Company operations
|
|
3631
|
-
createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
|
|
3632
|
-
upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
|
|
3633
|
-
updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
|
|
3634
|
-
getCompany: { params: { id: string }; result: AcqCompany | null }
|
|
3635
|
-
listCompanies: { params: CompanyFilters; result: AcqCompany[] }
|
|
3636
|
-
deleteCompany: { params: { id: string }; result: void }
|
|
3637
|
-
// Contact operations
|
|
3638
|
-
createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
|
|
3639
|
-
upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
|
|
3640
|
-
updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
|
|
3641
|
-
getContact: { params: { id: string }; result: AcqContact | null }
|
|
3642
|
-
getContactByEmail: { params: { email: string }; result: AcqContact | null }
|
|
3643
|
-
listContacts: {
|
|
3644
|
-
params: ContactFilters & { limit?: number; offset?: number }
|
|
3645
|
-
result: PaginatedResult<AcqContact>
|
|
3646
|
-
}
|
|
3647
|
-
deleteContact: { params: { id: string }; result: void }
|
|
3648
|
-
bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
|
|
3649
|
-
bulkImportCompanies: {
|
|
3650
|
-
params: Omit<BulkImportCompaniesParams, 'organizationId'>
|
|
3651
|
-
result: BulkImportCompaniesResult
|
|
3652
|
-
}
|
|
3653
|
-
deactivateContactsByCompany: {
|
|
3654
|
-
params: { companyId: string }
|
|
3655
|
-
result: { deactivated: number }
|
|
3656
|
-
}
|
|
3657
|
-
// Deal operations
|
|
3658
|
-
upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
|
|
3659
|
-
getDealByEmail: { params: { email: string }; result: AcqDeal | null }
|
|
3660
|
-
getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
|
|
3661
|
-
updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
|
|
3662
|
-
getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
|
|
3663
|
-
getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
|
|
3664
|
-
getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
|
|
3665
|
-
// Deal-sync operations
|
|
3666
|
-
updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
|
|
3667
|
-
updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
|
|
3668
|
-
markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
|
|
3669
|
-
markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
|
|
3670
|
-
updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
|
|
3671
|
-
updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
|
|
3672
|
-
cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
|
|
3673
|
-
transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
|
|
3674
|
-
setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
|
|
3675
|
-
cancelSchedulesAndHitlByEmail: {
|
|
3676
|
-
params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
|
|
3677
|
-
result: { schedulesCancelled: number; hitlDeleted: number }
|
|
3678
|
-
}
|
|
3679
|
-
cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
|
|
3680
|
-
clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
|
|
3681
|
-
deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
|
|
3682
|
-
recordDealActivity: {
|
|
3683
|
-
params: Omit<RecordDealActivityParams, 'organizationId'>
|
|
3684
|
-
result: void
|
|
3685
|
-
}
|
|
3686
|
-
// Deal note operations
|
|
3687
|
-
createDealNote: {
|
|
3688
|
-
params: Omit<CreateDealNoteParams, 'organizationId'>
|
|
3689
|
-
result: AcqDealNote
|
|
3690
|
-
}
|
|
3691
|
-
listDealNotes: {
|
|
3692
|
-
params: Omit<ListDealNotesParams, 'organizationId'>
|
|
3693
|
-
result: AcqDealNote[]
|
|
3694
|
-
}
|
|
3695
|
-
// Deal task operations
|
|
3696
|
-
createDealTask: {
|
|
3697
|
-
params: Omit<CreateDealTaskParams, 'organizationId'>
|
|
3698
|
-
result: AcqDealTask
|
|
3699
|
-
}
|
|
3700
|
-
listDealTasks: {
|
|
3701
|
-
params: Omit<ListDealTasksParams, 'organizationId'>
|
|
3702
|
-
result: AcqDealTask[]
|
|
3703
|
-
}
|
|
3704
|
-
listDealTasksDue: {
|
|
3705
|
-
params: Omit<ListDealTasksDueParams, 'organizationId'>
|
|
3706
|
-
result: AcqDealTask[]
|
|
3707
|
-
}
|
|
3708
|
-
completeDealTask: {
|
|
3709
|
-
params: Omit<CompleteDealTaskParams, 'organizationId'>
|
|
3710
|
-
result: AcqDealTask
|
|
3711
|
-
}
|
|
3712
|
-
// Deal query & analytics operations
|
|
3713
|
-
listDeals: { params: DealFilters; result: AcqDeal[] }
|
|
3714
|
-
getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
|
|
3715
|
-
// Enrichment data operations
|
|
3716
|
-
mergeEnrichmentData: {
|
|
3717
|
-
params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
|
|
3718
|
-
result: void
|
|
3719
|
-
}
|
|
3720
|
-
// Social monitoring operations
|
|
3721
|
-
upsertSocialPosts: {
|
|
3722
|
-
params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
|
|
3723
|
-
result: UpsertSocialPostsResult
|
|
3724
|
-
}
|
|
3725
|
-
setDealStateKey: {
|
|
3726
|
-
params: {
|
|
3727
|
-
dealId: string
|
|
3728
|
-
stateKey: string
|
|
3729
|
-
}
|
|
3730
|
-
result: { ok: true }
|
|
3731
|
-
}
|
|
3732
|
-
// CRM workflow helpers
|
|
3733
|
-
transitionDeal: {
|
|
3734
|
-
params: {
|
|
3735
|
-
dealId: string
|
|
3736
|
-
toStage: string
|
|
3737
|
-
toState?: string
|
|
3738
|
-
}
|
|
3739
|
-
result: { deal: AcqDeal }
|
|
3740
|
-
}
|
|
3741
|
-
loadDeal: {
|
|
3742
|
-
params: { dealId: string }
|
|
3743
|
-
result: DealDetail | null
|
|
3744
|
-
}
|
|
3655
|
+
export type LeadToolMap = {
|
|
3656
|
+
// List operations
|
|
3657
|
+
listLists: { params: Record<string, never>; result: AcqList[] }
|
|
3658
|
+
createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
|
|
3659
|
+
updateList: { params: { id: string } & UpdateListParams; result: AcqList }
|
|
3660
|
+
deleteList: { params: { id: string }; result: void }
|
|
3661
|
+
addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
|
|
3662
|
+
addCompaniesToList: { params: Omit<AddCompaniesToListParams, 'organizationId'>; result: AddCompaniesToListResult }
|
|
3663
|
+
updateCompanyStage: {
|
|
3664
|
+
params: Omit<UpdateCompanyStageParams, 'organizationId'>
|
|
3665
|
+
result: void
|
|
3666
|
+
}
|
|
3667
|
+
updateContactStage: {
|
|
3668
|
+
params: Omit<UpdateContactStageParams, 'organizationId'>
|
|
3669
|
+
result: void
|
|
3670
|
+
}
|
|
3671
|
+
// Company operations
|
|
3672
|
+
createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
|
|
3673
|
+
upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
|
|
3674
|
+
updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
|
|
3675
|
+
getCompany: { params: { id: string }; result: AcqCompany | null }
|
|
3676
|
+
listCompanies: { params: CompanyFilters; result: AcqCompany[] }
|
|
3677
|
+
deleteCompany: { params: { id: string }; result: void }
|
|
3678
|
+
// Contact operations
|
|
3679
|
+
createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
|
|
3680
|
+
upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
|
|
3681
|
+
updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
|
|
3682
|
+
getContact: { params: { id: string }; result: AcqContact | null }
|
|
3683
|
+
getContactByEmail: { params: { email: string }; result: AcqContact | null }
|
|
3684
|
+
listContacts: {
|
|
3685
|
+
params: ContactFilters & { limit?: number; offset?: number }
|
|
3686
|
+
result: PaginatedResult<AcqContact>
|
|
3687
|
+
}
|
|
3688
|
+
deleteContact: { params: { id: string }; result: void }
|
|
3689
|
+
bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
|
|
3690
|
+
bulkImportCompanies: {
|
|
3691
|
+
params: Omit<BulkImportCompaniesParams, 'organizationId'>
|
|
3692
|
+
result: BulkImportCompaniesResult
|
|
3693
|
+
}
|
|
3694
|
+
deactivateContactsByCompany: {
|
|
3695
|
+
params: { companyId: string }
|
|
3696
|
+
result: { deactivated: number }
|
|
3697
|
+
}
|
|
3698
|
+
// Deal operations
|
|
3699
|
+
upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
|
|
3700
|
+
getDealByEmail: { params: { email: string }; result: AcqDeal | null }
|
|
3701
|
+
getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
|
|
3702
|
+
updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
|
|
3703
|
+
getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
|
|
3704
|
+
getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
|
|
3705
|
+
getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
|
|
3706
|
+
// Deal-sync operations
|
|
3707
|
+
updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
|
|
3708
|
+
updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
|
|
3709
|
+
markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
|
|
3710
|
+
markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
|
|
3711
|
+
updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
|
|
3712
|
+
updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
|
|
3713
|
+
cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
|
|
3714
|
+
transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
|
|
3715
|
+
setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
|
|
3716
|
+
cancelSchedulesAndHitlByEmail: {
|
|
3717
|
+
params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
|
|
3718
|
+
result: { schedulesCancelled: number; hitlDeleted: number }
|
|
3719
|
+
}
|
|
3720
|
+
cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
|
|
3721
|
+
clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
|
|
3722
|
+
deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
|
|
3723
|
+
recordDealActivity: {
|
|
3724
|
+
params: Omit<RecordDealActivityParams, 'organizationId'>
|
|
3725
|
+
result: void
|
|
3726
|
+
}
|
|
3727
|
+
// Deal note operations
|
|
3728
|
+
createDealNote: {
|
|
3729
|
+
params: Omit<CreateDealNoteParams, 'organizationId'>
|
|
3730
|
+
result: AcqDealNote
|
|
3731
|
+
}
|
|
3732
|
+
listDealNotes: {
|
|
3733
|
+
params: Omit<ListDealNotesParams, 'organizationId'>
|
|
3734
|
+
result: AcqDealNote[]
|
|
3735
|
+
}
|
|
3736
|
+
// Deal task operations
|
|
3737
|
+
createDealTask: {
|
|
3738
|
+
params: Omit<CreateDealTaskParams, 'organizationId'>
|
|
3739
|
+
result: AcqDealTask
|
|
3740
|
+
}
|
|
3741
|
+
listDealTasks: {
|
|
3742
|
+
params: Omit<ListDealTasksParams, 'organizationId'>
|
|
3743
|
+
result: AcqDealTask[]
|
|
3744
|
+
}
|
|
3745
|
+
listDealTasksDue: {
|
|
3746
|
+
params: Omit<ListDealTasksDueParams, 'organizationId'>
|
|
3747
|
+
result: AcqDealTask[]
|
|
3748
|
+
}
|
|
3749
|
+
completeDealTask: {
|
|
3750
|
+
params: Omit<CompleteDealTaskParams, 'organizationId'>
|
|
3751
|
+
result: AcqDealTask
|
|
3752
|
+
}
|
|
3753
|
+
// Deal query & analytics operations
|
|
3754
|
+
listDeals: { params: DealFilters; result: AcqDeal[] }
|
|
3755
|
+
getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
|
|
3756
|
+
// Enrichment data operations
|
|
3757
|
+
mergeEnrichmentData: {
|
|
3758
|
+
params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
|
|
3759
|
+
result: void
|
|
3760
|
+
}
|
|
3761
|
+
// Social monitoring operations
|
|
3762
|
+
upsertSocialPosts: {
|
|
3763
|
+
params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
|
|
3764
|
+
result: UpsertSocialPostsResult
|
|
3765
|
+
}
|
|
3766
|
+
setDealStateKey: {
|
|
3767
|
+
params: {
|
|
3768
|
+
dealId: string
|
|
3769
|
+
stateKey: string
|
|
3770
|
+
}
|
|
3771
|
+
result: { ok: true }
|
|
3772
|
+
}
|
|
3773
|
+
// CRM workflow helpers
|
|
3774
|
+
transitionDeal: {
|
|
3775
|
+
params: {
|
|
3776
|
+
dealId: string
|
|
3777
|
+
toStage: string
|
|
3778
|
+
toState?: string
|
|
3779
|
+
}
|
|
3780
|
+
result: { deal: AcqDeal }
|
|
3781
|
+
}
|
|
3782
|
+
loadDeal: {
|
|
3783
|
+
params: { dealId: string }
|
|
3784
|
+
result: DealDetail | null
|
|
3785
|
+
}
|
|
3745
3786
|
}
|
|
3746
3787
|
```
|
|
3747
3788
|
|
|
3748
3789
|
### `ListToolMap`
|
|
3749
3790
|
|
|
3750
3791
|
```typescript
|
|
3751
|
-
export type ListToolMap = {
|
|
3752
|
-
getConfig: {
|
|
3753
|
-
params: { listId: string }
|
|
3754
|
-
result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
|
|
3755
|
-
}
|
|
3756
|
-
recordExecution: {
|
|
3757
|
-
params: Omit<RecordListExecutionParams, 'organizationId'>
|
|
3758
|
-
result: void
|
|
3759
|
-
}
|
|
3760
|
-
updateCompanyStage: {
|
|
3761
|
-
params: Omit<UpdateCompanyStageParams, 'organizationId'>
|
|
3762
|
-
result: void
|
|
3763
|
-
}
|
|
3764
|
-
updateContactStage: {
|
|
3765
|
-
params: Omit<UpdateContactStageParams, 'organizationId'>
|
|
3766
|
-
result: void
|
|
3767
|
-
}
|
|
3768
|
-
listPendingCompanyIds: {
|
|
3769
|
-
params: Omit<ListPendingCompanyIdsParams, 'organizationId'>
|
|
3770
|
-
result: string[]
|
|
3771
|
-
}
|
|
3772
|
-
listPendingContactIds: {
|
|
3773
|
-
params: Omit<ListPendingContactIdsParams, 'organizationId'>
|
|
3774
|
-
result: string[]
|
|
3775
|
-
}
|
|
3792
|
+
export type ListToolMap = {
|
|
3793
|
+
getConfig: {
|
|
3794
|
+
params: { listId: string }
|
|
3795
|
+
result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
|
|
3796
|
+
}
|
|
3797
|
+
recordExecution: {
|
|
3798
|
+
params: Omit<RecordListExecutionParams, 'organizationId'>
|
|
3799
|
+
result: void
|
|
3800
|
+
}
|
|
3801
|
+
updateCompanyStage: {
|
|
3802
|
+
params: Omit<UpdateCompanyStageParams, 'organizationId'>
|
|
3803
|
+
result: void
|
|
3804
|
+
}
|
|
3805
|
+
updateContactStage: {
|
|
3806
|
+
params: Omit<UpdateContactStageParams, 'organizationId'>
|
|
3807
|
+
result: void
|
|
3808
|
+
}
|
|
3809
|
+
listPendingCompanyIds: {
|
|
3810
|
+
params: Omit<ListPendingCompanyIdsParams, 'organizationId'>
|
|
3811
|
+
result: string[]
|
|
3812
|
+
}
|
|
3813
|
+
listPendingContactIds: {
|
|
3814
|
+
params: Omit<ListPendingContactIdsParams, 'organizationId'>
|
|
3815
|
+
result: string[]
|
|
3816
|
+
}
|
|
3776
3817
|
}
|
|
3777
3818
|
```
|
|
3778
3819
|
|
|
@@ -3781,47 +3822,49 @@ export type ListToolMap = {
|
|
|
3781
3822
|
### `KnowledgeLinkSchema`
|
|
3782
3823
|
|
|
3783
3824
|
```typescript
|
|
3784
|
-
export const KnowledgeLinkSchema = z
|
|
3785
|
-
.union([CanonicalKnowledgeLinkSchema, LegacyKnowledgeLinkSchema])
|
|
3786
|
-
.transform((link) => {
|
|
3787
|
-
const target = 'target' in link ? link.target : targetFromNodeId(link.nodeId)
|
|
3788
|
-
return {
|
|
3789
|
-
target,
|
|
3790
|
-
nodeId: nodeIdFromTarget(target)
|
|
3791
|
-
}
|
|
3825
|
+
export const KnowledgeLinkSchema = z
|
|
3826
|
+
.union([CanonicalKnowledgeLinkSchema, LegacyKnowledgeLinkSchema])
|
|
3827
|
+
.transform((link) => {
|
|
3828
|
+
const target = 'target' in link ? link.target : targetFromNodeId(link.nodeId)
|
|
3829
|
+
return {
|
|
3830
|
+
target,
|
|
3831
|
+
nodeId: nodeIdFromTarget(target)
|
|
3832
|
+
}
|
|
3792
3833
|
})
|
|
3793
3834
|
```
|
|
3794
3835
|
|
|
3795
3836
|
### `OrgKnowledgeKindSchema`
|
|
3796
3837
|
|
|
3797
3838
|
```typescript
|
|
3798
|
-
export const OrgKnowledgeKindSchema = z
|
|
3799
|
-
.enum(['playbook', 'strategy', 'reference'])
|
|
3839
|
+
export const OrgKnowledgeKindSchema = z
|
|
3840
|
+
.enum(['playbook', 'strategy', 'reference'])
|
|
3800
3841
|
.meta({ label: 'Knowledge kind', color: 'grape' })
|
|
3801
3842
|
```
|
|
3802
3843
|
|
|
3803
3844
|
### `OrgKnowledgeNodeSchema`
|
|
3804
3845
|
|
|
3805
3846
|
```typescript
|
|
3806
|
-
export const OrgKnowledgeNodeSchema = z.object({
|
|
3807
|
-
id: ModelIdSchema,
|
|
3808
|
-
kind: OrgKnowledgeKindSchema,
|
|
3809
|
-
title: z.string().trim().min(1).max(200),
|
|
3810
|
-
summary: z.string().trim().min(1).max(1000),
|
|
3847
|
+
export const OrgKnowledgeNodeSchema = z.object({
|
|
3848
|
+
id: ModelIdSchema,
|
|
3849
|
+
kind: OrgKnowledgeKindSchema,
|
|
3850
|
+
title: z.string().trim().min(1).max(200),
|
|
3851
|
+
summary: z.string().trim().min(1).max(1000),
|
|
3811
3852
|
icon: IconNameSchema.optional(),
|
|
3812
3853
|
/** Canonical documentation URL when body content is a local summary. */
|
|
3813
3854
|
externalUrl: z.string().trim().url().max(500).optional(),
|
|
3855
|
+
/** Optional generated source file path for local MDX-backed knowledge nodes. */
|
|
3856
|
+
sourceFilePath: z.string().trim().min(1).max(500).optional(),
|
|
3814
3857
|
/** Raw MDX string. Phase 2 will introduce a structured block format. */
|
|
3815
3858
|
body: z.string().trim().min(1),
|
|
3816
|
-
/**
|
|
3817
|
-
* Graph links to other OM nodes this knowledge node governs.
|
|
3818
|
-
* Each link emits a `governs` edge: knowledge-node -> target node.
|
|
3819
|
-
*/
|
|
3820
|
-
links: z.array(KnowledgeLinkSchema).default([]),
|
|
3821
|
-
/** Role identifiers that own this knowledge node. */
|
|
3822
|
-
ownerIds: z.array(RoleIdSchema.meta({ ref: 'role' })).default([]),
|
|
3823
|
-
/** ISO date string (YYYY-MM-DD or full ISO 8601) of last meaningful update. */
|
|
3824
|
-
updatedAt: z.string().trim().min(1).max(50)
|
|
3859
|
+
/**
|
|
3860
|
+
* Graph links to other OM nodes this knowledge node governs.
|
|
3861
|
+
* Each link emits a `governs` edge: knowledge-node -> target node.
|
|
3862
|
+
*/
|
|
3863
|
+
links: z.array(KnowledgeLinkSchema).default([]),
|
|
3864
|
+
/** Role identifiers that own this knowledge node. */
|
|
3865
|
+
ownerIds: z.array(RoleIdSchema.meta({ ref: 'role' })).default([]),
|
|
3866
|
+
/** ISO date string (YYYY-MM-DD or full ISO 8601) of last meaningful update. */
|
|
3867
|
+
updatedAt: z.string().trim().min(1).max(50)
|
|
3825
3868
|
})
|
|
3826
3869
|
```
|
|
3827
3870
|
|