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