@elevasis/sdk 1.14.1 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1001,218 +1001,218 @@ export const AcqDealTaskKindSchema = z.enum(['call', 'email', 'meeting', 'other'
1001
1001
  ### `DealIdParamsSchema`
1002
1002
 
1003
1003
  ```typescript
1004
- export const DealIdParamsSchema = z.object({
1005
- dealId: UuidSchema
1004
+ export const DealIdParamsSchema = z.object({
1005
+ dealId: UuidSchema
1006
1006
  })
1007
1007
  ```
1008
1008
 
1009
1009
  ### `DealTaskIdParamsSchema`
1010
1010
 
1011
1011
  ```typescript
1012
- export const DealTaskIdParamsSchema = z.object({
1013
- dealId: UuidSchema,
1014
- taskId: UuidSchema
1012
+ export const DealTaskIdParamsSchema = z.object({
1013
+ dealId: UuidSchema,
1014
+ taskId: UuidSchema
1015
1015
  })
1016
1016
  ```
1017
1017
 
1018
1018
  ### `ListDealsQuerySchema`
1019
1019
 
1020
1020
  ```typescript
1021
- export const ListDealsQuerySchema = z
1022
- .object({
1023
- stage: DealStageSchema.optional(),
1024
- search: z.string().optional(),
1025
- limit: z.coerce.number().int().positive().default(50),
1026
- offset: z.coerce.number().int().min(0).default(0)
1027
- })
1021
+ export const ListDealsQuerySchema = z
1022
+ .object({
1023
+ stage: DealStageSchema.optional(),
1024
+ search: z.string().optional(),
1025
+ limit: z.coerce.number().int().positive().default(50),
1026
+ offset: z.coerce.number().int().min(0).default(0)
1027
+ })
1028
1028
  .strict()
1029
1029
  ```
1030
1030
 
1031
1031
  ### `DealLookupQuerySchema`
1032
1032
 
1033
1033
  ```typescript
1034
- export const DealLookupQuerySchema = z
1035
- .object({
1036
- search: z.string().trim().min(1).max(200).optional(),
1037
- limit: z.coerce.number().int().min(1).max(25).default(10)
1038
- })
1034
+ export const DealLookupQuerySchema = z
1035
+ .object({
1036
+ search: z.string().trim().min(1).max(200).optional(),
1037
+ limit: z.coerce.number().int().min(1).max(25).default(10)
1038
+ })
1039
1039
  .strict()
1040
1040
  ```
1041
1041
 
1042
1042
  ### `ListDealTasksDueQuerySchema`
1043
1043
 
1044
1044
  ```typescript
1045
- export const ListDealTasksDueQuerySchema = z
1046
- .object({
1047
- window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1048
- assigneeUserId: UuidSchema.optional()
1049
- })
1045
+ export const ListDealTasksDueQuerySchema = z
1046
+ .object({
1047
+ window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1048
+ assigneeUserId: UuidSchema.optional()
1049
+ })
1050
1050
  .strict()
1051
1051
  ```
1052
1052
 
1053
1053
  ### `CreateDealNoteRequestSchema`
1054
1054
 
1055
1055
  ```typescript
1056
- export const CreateDealNoteRequestSchema = z
1057
- .object({
1058
- body: z.string().trim().min(1).max(10000)
1059
- })
1056
+ export const CreateDealNoteRequestSchema = z
1057
+ .object({
1058
+ body: z.string().trim().min(1).max(10000)
1059
+ })
1060
1060
  .strict()
1061
1061
  ```
1062
1062
 
1063
1063
  ### `CreateDealTaskRequestSchema`
1064
1064
 
1065
1065
  ```typescript
1066
- export const CreateDealTaskRequestSchema = z
1067
- .object({
1068
- title: z.string().trim().min(1).max(255),
1069
- description: z.string().nullable().optional(),
1070
- kind: AcqDealTaskKindSchema.optional(),
1071
- dueAt: z.string().datetime().nullable().optional(),
1072
- assigneeUserId: UuidSchema.nullable().optional()
1073
- })
1066
+ export const CreateDealTaskRequestSchema = z
1067
+ .object({
1068
+ title: z.string().trim().min(1).max(255),
1069
+ description: z.string().nullable().optional(),
1070
+ kind: AcqDealTaskKindSchema.optional(),
1071
+ dueAt: z.string().datetime().nullable().optional(),
1072
+ assigneeUserId: UuidSchema.nullable().optional()
1073
+ })
1074
1074
  .strict()
1075
1075
  ```
1076
1076
 
1077
1077
  ### `TransitionItemRequestSchema`
1078
1078
 
1079
1079
  ```typescript
1080
- export const TransitionItemRequestSchema = z
1081
- .object({
1082
- pipelineKey: z.string().min(1),
1083
- stageKey: z.string().min(1),
1084
- stateKey: z.string().nullable().optional(),
1085
- reason: z.string().optional(),
1086
- expectedUpdatedAt: z.string().datetime().optional()
1087
- })
1080
+ export const TransitionItemRequestSchema = z
1081
+ .object({
1082
+ pipelineKey: z.string().min(1),
1083
+ stageKey: z.string().min(1),
1084
+ stateKey: z.string().nullable().optional(),
1085
+ reason: z.string().optional(),
1086
+ expectedUpdatedAt: z.string().datetime().optional()
1087
+ })
1088
1088
  .strict()
1089
1089
  ```
1090
1090
 
1091
1091
  ### `ExecuteActionParamsSchema`
1092
1092
 
1093
1093
  ```typescript
1094
- export const ExecuteActionParamsSchema = z
1095
- .object({
1096
- dealId: UuidSchema,
1097
- actionKey: NonEmptyStringSchema
1098
- })
1094
+ export const ExecuteActionParamsSchema = z
1095
+ .object({
1096
+ dealId: UuidSchema,
1097
+ actionKey: NonEmptyStringSchema
1098
+ })
1099
1099
  .strict()
1100
1100
  ```
1101
1101
 
1102
1102
  ### `ExecuteActionRequestSchema`
1103
1103
 
1104
1104
  ```typescript
1105
- export const ExecuteActionRequestSchema = z
1106
- .object({
1107
- payload: z.record(z.string(), z.unknown()).optional()
1108
- })
1105
+ export const ExecuteActionRequestSchema = z
1106
+ .object({
1107
+ payload: z.record(z.string(), z.unknown()).optional()
1108
+ })
1109
1109
  .strict()
1110
1110
  ```
1111
1111
 
1112
1112
  ### `DealContactSummarySchema`
1113
1113
 
1114
1114
  ```typescript
1115
- /**
1116
- * Contact summary nested inside DealListItem / DealDetailResponse.
1117
- * Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
1118
- */
1119
- export const DealContactSummarySchema = z.object({
1120
- id: z.string(),
1121
- first_name: z.string().nullable(),
1122
- last_name: z.string().nullable(),
1123
- email: z.string(),
1124
- title: z.string().nullable(),
1125
- headline: z.string().nullable(),
1126
- linkedin_url: z.string().nullable(),
1127
- pipeline_status: z.record(z.string(), z.unknown()).nullable(),
1128
- enrichment_data: z.record(z.string(), z.unknown()).nullable(),
1129
- company: z
1130
- .object({
1131
- id: z.string(),
1132
- name: z.string(),
1133
- domain: z.string().nullable(),
1134
- website: z.string().nullable(),
1135
- linkedin_url: z.string().nullable(),
1136
- segment: z.string().nullable(),
1137
- category: z.string().nullable(),
1138
- num_employees: z.number().nullable()
1139
- })
1140
- .nullable()
1115
+ /**
1116
+ * Contact summary nested inside DealListItem / DealDetailResponse.
1117
+ * Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
1118
+ */
1119
+ export const DealContactSummarySchema = z.object({
1120
+ id: z.string(),
1121
+ first_name: z.string().nullable(),
1122
+ last_name: z.string().nullable(),
1123
+ email: z.string(),
1124
+ title: z.string().nullable(),
1125
+ headline: z.string().nullable(),
1126
+ linkedin_url: z.string().nullable(),
1127
+ pipeline_status: z.record(z.string(), z.unknown()).nullable(),
1128
+ enrichment_data: z.record(z.string(), z.unknown()).nullable(),
1129
+ company: z
1130
+ .object({
1131
+ id: z.string(),
1132
+ name: z.string(),
1133
+ domain: z.string().nullable(),
1134
+ website: z.string().nullable(),
1135
+ linkedin_url: z.string().nullable(),
1136
+ segment: z.string().nullable(),
1137
+ category: z.string().nullable(),
1138
+ num_employees: z.number().nullable()
1139
+ })
1140
+ .nullable()
1141
1141
  })
1142
1142
  ```
1143
1143
 
1144
1144
  ### `DealListItemSchema`
1145
1145
 
1146
1146
  ```typescript
1147
- /**
1148
- * Deal list item with joined contact (and company via contact).
1149
- * Matches DealListItem from @repo/core types.
1150
- */
1151
- export const DealListItemSchema = z.object({
1152
- // acq_deals columns
1153
- id: z.string(),
1154
- organization_id: z.string(),
1155
- contact_id: z.string().nullable(),
1156
- contact_email: z.string(),
1157
- pipeline_key: z.string(),
1158
- stage_key: z.string().nullable(),
1159
- state_key: z.string().nullable(),
1160
- activity_log: z.unknown(),
1161
- discovery_data: z.unknown().nullable(),
1162
- discovery_submitted_at: z.string().nullable(),
1163
- discovery_submitted_by: z.string().nullable(),
1164
- proposal_data: z.unknown().nullable(),
1165
- proposal_sent_at: z.string().nullable(),
1166
- proposal_pdf_url: z.string().nullable(),
1167
- signature_envelope_id: z.string().nullable(),
1168
- source_list_id: z.string().nullable(),
1169
- source_type: z.string().nullable(),
1170
- initial_fee: z.number().nullable(),
1171
- monthly_fee: z.number().nullable(),
1172
- closed_lost_at: z.string().nullable(),
1173
- closed_lost_reason: z.string().nullable(),
1174
- created_at: z.string(),
1175
- updated_at: z.string(),
1176
- // joined relation
1177
- contact: DealContactSummarySchema.nullable()
1147
+ /**
1148
+ * Deal list item with joined contact (and company via contact).
1149
+ * Matches DealListItem from @repo/core types.
1150
+ */
1151
+ export const DealListItemSchema = z.object({
1152
+ // acq_deals columns
1153
+ id: z.string(),
1154
+ organization_id: z.string(),
1155
+ contact_id: z.string().nullable(),
1156
+ contact_email: z.string(),
1157
+ pipeline_key: z.string(),
1158
+ stage_key: z.string().nullable(),
1159
+ state_key: z.string().nullable(),
1160
+ activity_log: z.unknown(),
1161
+ discovery_data: z.unknown().nullable(),
1162
+ discovery_submitted_at: z.string().nullable(),
1163
+ discovery_submitted_by: z.string().nullable(),
1164
+ proposal_data: z.unknown().nullable(),
1165
+ proposal_sent_at: z.string().nullable(),
1166
+ proposal_pdf_url: z.string().nullable(),
1167
+ signature_envelope_id: z.string().nullable(),
1168
+ source_list_id: z.string().nullable(),
1169
+ source_type: z.string().nullable(),
1170
+ initial_fee: z.number().nullable(),
1171
+ monthly_fee: z.number().nullable(),
1172
+ closed_lost_at: z.string().nullable(),
1173
+ closed_lost_reason: z.string().nullable(),
1174
+ created_at: z.string(),
1175
+ updated_at: z.string(),
1176
+ // joined relation
1177
+ contact: DealContactSummarySchema.nullable()
1178
1178
  })
1179
1179
  ```
1180
1180
 
1181
1181
  ### `DealListResponseSchema`
1182
1182
 
1183
1183
  ```typescript
1184
- export const DealListResponseSchema = z.object({
1185
- data: z.array(DealListItemSchema),
1186
- total: z.number().int(),
1187
- limit: z.number().int(),
1188
- offset: z.number().int()
1184
+ export const DealListResponseSchema = z.object({
1185
+ data: z.array(DealListItemSchema),
1186
+ total: z.number().int(),
1187
+ limit: z.number().int(),
1188
+ offset: z.number().int()
1189
1189
  })
1190
1190
  ```
1191
1191
 
1192
1192
  ### `DealDetailResponseSchema`
1193
1193
 
1194
1194
  ```typescript
1195
- /**
1196
- * Deal detail shape — currently the same as a list item (full joined record).
1197
- * useDealDetail returns DealDetail which is typed as DealListItem.
1198
- */
1195
+ /**
1196
+ * Deal detail shape — currently the same as a list item (full joined record).
1197
+ * useDealDetail returns DealDetail which is typed as DealListItem.
1198
+ */
1199
1199
  export const DealDetailResponseSchema = DealListItemSchema
1200
1200
  ```
1201
1201
 
1202
1202
  ### `DealNoteResponseSchema`
1203
1203
 
1204
1204
  ```typescript
1205
- /**
1206
- * Single acq_deal_notes row (camelCase API representation).
1207
- */
1208
- export const DealNoteResponseSchema = z.object({
1209
- id: z.string(),
1210
- dealId: z.string(),
1211
- organizationId: z.string(),
1212
- authorUserId: z.string().nullable(),
1213
- body: z.string(),
1214
- createdAt: z.string(),
1215
- updatedAt: z.string()
1205
+ /**
1206
+ * Single acq_deal_notes row (camelCase API representation).
1207
+ */
1208
+ export const DealNoteResponseSchema = z.object({
1209
+ id: z.string(),
1210
+ dealId: z.string(),
1211
+ organizationId: z.string(),
1212
+ authorUserId: z.string().nullable(),
1213
+ body: z.string(),
1214
+ createdAt: z.string(),
1215
+ updatedAt: z.string()
1216
1216
  })
1217
1217
  ```
1218
1218
 
@@ -1225,24 +1225,24 @@ export const DealNoteListResponseSchema = z.array(DealNoteResponseSchema)
1225
1225
  ### `DealTaskResponseSchema`
1226
1226
 
1227
1227
  ```typescript
1228
- /**
1229
- * Single acq_deal_tasks row (camelCase API representation).
1230
- * Matches AcqDealTask domain type from types.ts.
1231
- */
1232
- export const DealTaskResponseSchema = z.object({
1233
- id: z.string(),
1234
- organizationId: z.string(),
1235
- dealId: z.string(),
1236
- title: z.string(),
1237
- description: z.string().nullable(),
1238
- kind: AcqDealTaskKindSchema,
1239
- dueAt: z.string().nullable(),
1240
- assigneeUserId: z.string().nullable(),
1241
- completedAt: z.string().nullable(),
1242
- completedByUserId: z.string().nullable(),
1243
- createdAt: z.string(),
1244
- updatedAt: z.string(),
1245
- createdByUserId: z.string().nullable()
1228
+ /**
1229
+ * Single acq_deal_tasks row (camelCase API representation).
1230
+ * Matches AcqDealTask domain type from types.ts.
1231
+ */
1232
+ export const DealTaskResponseSchema = z.object({
1233
+ id: z.string(),
1234
+ organizationId: z.string(),
1235
+ dealId: z.string(),
1236
+ title: z.string(),
1237
+ description: z.string().nullable(),
1238
+ kind: AcqDealTaskKindSchema,
1239
+ dueAt: z.string().nullable(),
1240
+ assigneeUserId: z.string().nullable(),
1241
+ completedAt: z.string().nullable(),
1242
+ completedByUserId: z.string().nullable(),
1243
+ createdAt: z.string(),
1244
+ updatedAt: z.string(),
1245
+ createdByUserId: z.string().nullable()
1246
1246
  })
1247
1247
  ```
1248
1248
 
@@ -1255,152 +1255,157 @@ export const DealTaskListResponseSchema = z.array(DealTaskResponseSchema)
1255
1255
  ### `DealSchemas`
1256
1256
 
1257
1257
  ```typescript
1258
- export const DealSchemas = {
1259
- // Params
1260
- DealIdParams: DealIdParamsSchema,
1261
- DealTaskIdParams: DealTaskIdParamsSchema,
1262
-
1263
- // Queries
1264
- ListDealsQuery: ListDealsQuerySchema,
1265
- DealLookupQuery: DealLookupQuerySchema,
1266
- ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
1267
-
1268
- // Request bodies
1269
- CreateDealNoteRequest: CreateDealNoteRequestSchema,
1270
- CreateDealTaskRequest: CreateDealTaskRequestSchema,
1271
- TransitionItemRequest: TransitionItemRequestSchema,
1272
- ExecuteActionParams: ExecuteActionParamsSchema,
1273
- ExecuteActionRequest: ExecuteActionRequestSchema,
1274
-
1275
- // Responses
1276
- DealListResponse: DealListResponseSchema,
1277
- DealSummaryResponse: DealSummaryResponseSchema,
1278
- DealLookupResponse: DealLookupResponseSchema,
1279
- DealDetailResponse: DealDetailResponseSchema,
1280
- DealNoteResponse: DealNoteResponseSchema,
1281
- DealNoteListResponse: DealNoteListResponseSchema,
1282
- DealTaskResponse: DealTaskResponseSchema,
1283
- DealTaskListResponse: DealTaskListResponseSchema
1258
+ export const DealSchemas = {
1259
+ // Params
1260
+ DealIdParams: DealIdParamsSchema,
1261
+ DealTaskIdParams: DealTaskIdParamsSchema,
1262
+
1263
+ // Queries
1264
+ ListDealsQuery: ListDealsQuerySchema,
1265
+ DealLookupQuery: DealLookupQuerySchema,
1266
+ ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
1267
+
1268
+ // Request bodies
1269
+ CreateDealNoteRequest: CreateDealNoteRequestSchema,
1270
+ CreateDealTaskRequest: CreateDealTaskRequestSchema,
1271
+ TransitionItemRequest: TransitionItemRequestSchema,
1272
+ TransitionDealStateRequest: TransitionDealStateRequestSchema,
1273
+ ExecuteActionParams: ExecuteActionParamsSchema,
1274
+ ExecuteActionRequest: ExecuteActionRequestSchema,
1275
+
1276
+ // Responses
1277
+ DealListResponse: DealListResponseSchema,
1278
+ DealSummaryResponse: DealSummaryResponseSchema,
1279
+ DealLookupResponse: DealLookupResponseSchema,
1280
+ DealDetailResponse: DealDetailResponseSchema,
1281
+ DealNoteResponse: DealNoteResponseSchema,
1282
+ DealNoteListResponse: DealNoteListResponseSchema,
1283
+ DealTaskResponse: DealTaskResponseSchema,
1284
+ DealTaskListResponse: DealTaskListResponseSchema
1284
1285
  }
1285
1286
  ```
1286
1287
 
1287
1288
  ### `Action`
1288
1289
 
1289
1290
  ```typescript
1290
- export interface Action {
1291
- key: string
1292
- label: string
1293
- payloadSchema?: z.ZodTypeAny
1291
+ export interface Action {
1292
+ key: string
1293
+ label: string
1294
+ payloadSchema?: z.ZodTypeAny
1294
1295
  }
1295
1296
  ```
1296
1297
 
1297
1298
  ### `ActionDef`
1298
1299
 
1299
1300
  ```typescript
1300
- export interface ActionDef {
1301
- key: string
1302
- label: string
1303
- isAvailableFor: (deal: AcqDealRow) => boolean
1304
- workflowId: string
1305
- payloadSchema?: z.ZodTypeAny
1301
+ export interface ActionDef {
1302
+ key: string
1303
+ label: string
1304
+ isAvailableFor: (deal: AcqDealRow) => boolean
1305
+ workflowId: string
1306
+ payloadSchema?: z.ZodTypeAny
1306
1307
  }
1307
1308
  ```
1308
1309
 
1309
1310
  ### `DEFAULT_CRM_ACTIONS`
1310
1311
 
1311
1312
  ```typescript
1312
- export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1313
- {
1314
- key: 'move_to_proposal',
1315
- label: 'Move to Proposal',
1316
- isAvailableFor: (deal) => deal.stage_key === 'interested',
1317
- workflowId: 'move_to_proposal-workflow'
1318
- },
1319
- {
1320
- key: 'move_to_closing',
1321
- label: 'Move to Closing',
1322
- isAvailableFor: (deal) => deal.stage_key === 'proposal',
1323
- workflowId: 'move_to_closing-workflow'
1324
- },
1325
- {
1326
- key: 'move_to_closed_won',
1327
- label: 'Close Won',
1328
- isAvailableFor: (deal) => deal.stage_key === 'closing',
1329
- workflowId: 'move_to_closed_won-workflow'
1330
- },
1331
- {
1332
- key: 'move_to_closed_lost',
1333
- label: 'Close Lost',
1334
- isAvailableFor: (deal) =>
1335
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1336
- workflowId: 'move_to_closed_lost-workflow'
1337
- },
1338
- {
1339
- key: 'move_to_nurturing',
1340
- label: 'Move to Nurturing',
1341
- isAvailableFor: (deal) =>
1342
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1343
- workflowId: 'move_to_nurturing-workflow'
1344
- },
1345
- {
1346
- key: 'send_reply',
1347
- label: 'Send Reply',
1348
- isAvailableFor: (deal) =>
1349
- deal.stage_key === 'interested' &&
1350
- (deal.state_key === 'discovery_replied' ||
1351
- deal.state_key === 'discovery_link_sent' ||
1352
- deal.state_key === 'discovery_nudging'),
1353
- workflowId: 'crm-send-reply-workflow',
1354
- payloadSchema: SendReplyActionPayloadSchema
1355
- },
1356
- {
1357
- key: 'send_link',
1358
- label: 'Send Booking Link',
1359
- isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_replied',
1360
- workflowId: 'crm-send-booking-link-workflow'
1361
- },
1362
- {
1363
- key: 'send_nudge',
1364
- label: 'Send Nudge',
1365
- isAvailableFor: (deal) =>
1366
- deal.stage_key === 'interested' &&
1367
- (deal.state_key === 'discovery_link_sent' || deal.state_key === 'discovery_nudging'),
1368
- workflowId: 'crm-send-nudge-workflow'
1369
- },
1370
- {
1371
- key: 'mark_no_show',
1372
- label: 'Mark No-Show',
1373
- isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_nudging',
1374
- // Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
1375
- // both manual-click and timeout move the deal to closed_lost. The action_taken activity
1376
- // event captures operator intent and distinguishes the manual variant from the timed one.
1377
- workflowId: 'mark_no_show-workflow'
1378
- },
1379
- {
1380
- key: 'rebook',
1381
- label: 'Rebook',
1382
- isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_booking_cancelled',
1383
- workflowId: 'crm-rebook-workflow'
1384
- }
1313
+ export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1314
+ {
1315
+ key: 'move_to_proposal',
1316
+ label: 'Move to Proposal',
1317
+ isAvailableFor: (deal) => deal.stage_key === 'interested',
1318
+ workflowId: 'move_to_proposal-workflow'
1319
+ },
1320
+ {
1321
+ key: 'move_to_closing',
1322
+ label: 'Move to Closing',
1323
+ isAvailableFor: (deal) => deal.stage_key === 'proposal',
1324
+ workflowId: 'move_to_closing-workflow'
1325
+ },
1326
+ {
1327
+ key: 'move_to_closed_won',
1328
+ label: 'Close Won',
1329
+ isAvailableFor: (deal) => deal.stage_key === 'closing',
1330
+ workflowId: 'move_to_closed_won-workflow'
1331
+ },
1332
+ {
1333
+ key: 'move_to_closed_lost',
1334
+ label: 'Close Lost',
1335
+ isAvailableFor: (deal) =>
1336
+ deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1337
+ workflowId: 'move_to_closed_lost-workflow'
1338
+ },
1339
+ {
1340
+ key: 'move_to_nurturing',
1341
+ label: 'Move to Nurturing',
1342
+ isAvailableFor: (deal) =>
1343
+ deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1344
+ workflowId: 'move_to_nurturing-workflow'
1345
+ },
1346
+ {
1347
+ key: 'send_reply',
1348
+ label: 'Send Reply',
1349
+ isAvailableFor: (deal) =>
1350
+ deal.stage_key === 'interested' &&
1351
+ (deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
1352
+ deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
1353
+ deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
1354
+ workflowId: 'crm-send-reply-workflow',
1355
+ payloadSchema: SendReplyActionPayloadSchema
1356
+ },
1357
+ {
1358
+ key: 'send_link',
1359
+ label: 'Send Booking Link',
1360
+ isAvailableFor: (deal) =>
1361
+ deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
1362
+ workflowId: 'crm-send-booking-link-workflow'
1363
+ },
1364
+ {
1365
+ key: 'send_nudge',
1366
+ label: 'Send Nudge',
1367
+ isAvailableFor: (deal) =>
1368
+ deal.stage_key === 'interested' &&
1369
+ (deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
1370
+ deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
1371
+ workflowId: 'crm-send-nudge-workflow'
1372
+ },
1373
+ {
1374
+ key: 'mark_no_show',
1375
+ label: 'Mark No-Show',
1376
+ isAvailableFor: (deal) =>
1377
+ deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
1378
+ // Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
1379
+ // both manual-click and timeout move the deal to closed_lost. The action_taken activity
1380
+ // event captures operator intent and distinguishes the manual variant from the timed one.
1381
+ workflowId: 'mark_no_show-workflow'
1382
+ },
1383
+ {
1384
+ key: 'rebook',
1385
+ label: 'Rebook',
1386
+ isAvailableFor: (deal) =>
1387
+ deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
1388
+ workflowId: 'crm-rebook-workflow'
1389
+ }
1385
1390
  ]
1386
1391
  ```
1387
1392
 
1388
1393
  ### `CrmToolMap`
1389
1394
 
1390
1395
  ```typescript
1391
- export type CrmToolMap = {
1392
- getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
1393
- listDeals: { params: CrmListDealsParams; result: DealListItem[] }
1394
- getDeal: { params: CrmGetDealParams; result: DealDetail | null }
1395
- getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
1396
- createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
1397
- listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
1398
- createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
1399
- listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
1400
- listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
1401
- completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
1402
- recordActivity: { params: CrmRecordActivityParams; result: void }
1403
- deleteDeal: { params: CrmDeleteDealParams; result: void }
1396
+ export type CrmToolMap = {
1397
+ getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
1398
+ listDeals: { params: CrmListDealsParams; result: DealListItem[] }
1399
+ getDeal: { params: CrmGetDealParams; result: DealDetail | null }
1400
+ getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
1401
+ createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
1402
+ listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
1403
+ createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
1404
+ listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
1405
+ listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
1406
+ completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
1407
+ recordActivity: { params: CrmRecordActivityParams; result: void }
1408
+ deleteDeal: { params: CrmDeleteDealParams; result: void }
1404
1409
  }
1405
1410
  ```
1406
1411
 
@@ -1640,9 +1645,10 @@ export interface AcqContact {
1640
1645
 
1641
1646
  ```typescript
1642
1647
  /**
1643
- * Live-scan aggregate telemetry for a single list, computed on demand from
1644
- * the list junction tables and current contact deliverability state.
1645
- */
1648
+ * Live-scan aggregate telemetry for a single list, computed on demand from
1649
+ * the list junction tables and current contact deliverability state.
1650
+ * `stageCounts` are attempted counts from list-row processing_state.
1651
+ */
1646
1652
  export interface ListTelemetry {
1647
1653
  listId: string
1648
1654
  totalCompanies: number
@@ -1671,165 +1677,167 @@ export interface ListTelemetry {
1671
1677
  ### `ListStageCountsSchema`
1672
1678
 
1673
1679
  ```typescript
1674
- export const ListStageCountsSchema = z.object({
1675
- stageCounts: z.object({
1676
- populated: z.number().int(),
1677
- extracted: z.number().int(),
1678
- qualified: z.number().int(),
1679
- discovered: z.number().int(),
1680
- verified: z.number().int(),
1681
- personalized: z.number().int(),
1682
- uploaded: z.number().int()
1683
- }),
1684
- deliverability: z.object({
1685
- valid: z.number().int(),
1686
- risky: z.number().int(),
1687
- invalid: z.number().int(),
1688
- unknown: z.number().int(),
1689
- bounced: z.number().int()
1690
- })
1680
+ export const ListStageCountsSchema = z.object({
1681
+ // Attempted counts by canonical lead-gen stage. The detailed status
1682
+ // distribution lives on ListProgress; telemetry keeps the overview payload small.
1683
+ stageCounts: z.object({
1684
+ populated: z.number().int(),
1685
+ extracted: z.number().int(),
1686
+ qualified: z.number().int(),
1687
+ discovered: z.number().int(),
1688
+ verified: z.number().int(),
1689
+ personalized: z.number().int(),
1690
+ uploaded: z.number().int()
1691
+ }),
1692
+ deliverability: z.object({
1693
+ valid: z.number().int(),
1694
+ risky: z.number().int(),
1695
+ invalid: z.number().int(),
1696
+ unknown: z.number().int(),
1697
+ bounced: z.number().int()
1698
+ })
1691
1699
  })
1692
1700
  ```
1693
1701
 
1694
1702
  ### `ListTelemetrySchema`
1695
1703
 
1696
1704
  ```typescript
1697
- export const ListTelemetrySchema = z.object({
1698
- listId: UuidSchema,
1699
- totalCompanies: z.number().int(),
1700
- totalContacts: z.number().int(),
1701
- stageCounts: ListStageCountsSchema.shape.stageCounts,
1702
- deliverability: ListStageCountsSchema.shape.deliverability,
1703
- activeWorkflows: z.array(z.string()).optional()
1705
+ export const ListTelemetrySchema = z.object({
1706
+ listId: UuidSchema,
1707
+ totalCompanies: z.number().int(),
1708
+ totalContacts: z.number().int(),
1709
+ stageCounts: ListStageCountsSchema.shape.stageCounts,
1710
+ deliverability: ListStageCountsSchema.shape.deliverability,
1711
+ activeWorkflows: z.array(z.string()).optional()
1704
1712
  })
1705
1713
  ```
1706
1714
 
1707
1715
  ### `ListIdParamsSchema`
1708
1716
 
1709
1717
  ```typescript
1710
- export const ListIdParamsSchema = z.object({
1711
- listId: UuidSchema
1718
+ export const ListIdParamsSchema = z.object({
1719
+ listId: UuidSchema
1712
1720
  })
1713
1721
  ```
1714
1722
 
1715
1723
  ### `CreateListRequestSchema`
1716
1724
 
1717
1725
  ```typescript
1718
- export const CreateListRequestSchema = z
1719
- .object({
1720
- name: z.string().trim().min(1).max(255),
1721
- description: z.string().trim().nullable().optional(),
1722
- status: ListStatusSchema.optional(),
1723
- scrapingConfig: ScrapingConfigSchema.optional(),
1724
- icp: IcpRubricSchema.optional(),
1725
- pipelineConfig: PipelineConfigSchema.optional()
1726
- })
1726
+ export const CreateListRequestSchema = z
1727
+ .object({
1728
+ name: z.string().trim().min(1).max(255),
1729
+ description: z.string().trim().nullable().optional(),
1730
+ status: ListStatusSchema.optional(),
1731
+ scrapingConfig: ScrapingConfigSchema.optional(),
1732
+ icp: IcpRubricSchema.optional(),
1733
+ pipelineConfig: PipelineConfigSchema.optional()
1734
+ })
1727
1735
  .strict()
1728
1736
  ```
1729
1737
 
1730
1738
  ### `UpdateListRequestSchema`
1731
1739
 
1732
1740
  ```typescript
1733
- export const UpdateListRequestSchema = z
1734
- .object({
1735
- name: z.string().trim().min(1).max(255).optional(),
1736
- description: z.string().trim().nullable().optional(),
1737
- batchIds: z.array(z.string()).optional()
1738
- })
1739
- .strict()
1740
- .refine((data) => data.name !== undefined || data.description !== undefined || data.batchIds !== undefined, {
1741
- message: 'At least one field (name, description, or batchIds) must be provided'
1741
+ export const UpdateListRequestSchema = z
1742
+ .object({
1743
+ name: z.string().trim().min(1).max(255).optional(),
1744
+ description: z.string().trim().nullable().optional(),
1745
+ batchIds: z.array(z.string()).optional()
1746
+ })
1747
+ .strict()
1748
+ .refine((data) => data.name !== undefined || data.description !== undefined || data.batchIds !== undefined, {
1749
+ message: 'At least one field (name, description, or batchIds) must be provided'
1742
1750
  })
1743
1751
  ```
1744
1752
 
1745
1753
  ### `UpdateListConfigRequestSchema`
1746
1754
 
1747
1755
  ```typescript
1748
- /**
1749
- * Partial patch for the three jsonb config columns. UI sends only the edited
1750
- * subtree; server writes the field as-is (no deep merge — each column is
1751
- * replaced atomically when present in the patch).
1752
- */
1753
- export const UpdateListConfigRequestSchema = z
1754
- .object({
1755
- scrapingConfig: ScrapingConfigSchema.partial().optional(),
1756
- icp: IcpRubricSchema.partial().optional(),
1757
- pipelineConfig: PipelineConfigSchema.partial().optional()
1758
- })
1759
- .strict()
1760
- .refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
1761
- message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
1756
+ /**
1757
+ * Partial patch for the three jsonb config columns. UI sends only the edited
1758
+ * subtree; server writes the field as-is (no deep merge — each column is
1759
+ * replaced atomically when present in the patch).
1760
+ */
1761
+ export const UpdateListConfigRequestSchema = z
1762
+ .object({
1763
+ scrapingConfig: ScrapingConfigSchema.partial().optional(),
1764
+ icp: IcpRubricSchema.partial().optional(),
1765
+ pipelineConfig: PipelineConfigSchema.partial().optional()
1766
+ })
1767
+ .strict()
1768
+ .refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
1769
+ message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
1762
1770
  })
1763
1771
  ```
1764
1772
 
1765
1773
  ### `AddCompaniesToListRequestSchema`
1766
1774
 
1767
1775
  ```typescript
1768
- export const AddCompaniesToListRequestSchema = z
1769
- .object({
1770
- companyIds: z.array(UuidSchema).min(1).max(1000)
1771
- })
1776
+ export const AddCompaniesToListRequestSchema = z
1777
+ .object({
1778
+ companyIds: z.array(UuidSchema).min(1).max(1000)
1779
+ })
1772
1780
  .strict()
1773
1781
  ```
1774
1782
 
1775
1783
  ### `RemoveCompaniesFromListRequestSchema`
1776
1784
 
1777
1785
  ```typescript
1778
- export const RemoveCompaniesFromListRequestSchema = z
1779
- .object({
1780
- companyIds: z.array(UuidSchema).min(1).max(1000)
1781
- })
1786
+ export const RemoveCompaniesFromListRequestSchema = z
1787
+ .object({
1788
+ companyIds: z.array(UuidSchema).min(1).max(1000)
1789
+ })
1782
1790
  .strict()
1783
1791
  ```
1784
1792
 
1785
1793
  ### `AddContactsToListRequestSchema`
1786
1794
 
1787
1795
  ```typescript
1788
- export const AddContactsToListRequestSchema = z
1789
- .object({
1790
- contactIds: z.array(UuidSchema).min(1).max(1000)
1791
- })
1796
+ export const AddContactsToListRequestSchema = z
1797
+ .object({
1798
+ contactIds: z.array(UuidSchema).min(1).max(1000)
1799
+ })
1792
1800
  .strict()
1793
1801
  ```
1794
1802
 
1795
1803
  ### `RecordListExecutionRequestSchema`
1796
1804
 
1797
1805
  ```typescript
1798
- export const RecordListExecutionRequestSchema = z
1799
- .object({
1800
- executionId: UuidSchema,
1801
- configSnapshot: z.record(z.string(), z.unknown()).optional()
1802
- })
1806
+ export const RecordListExecutionRequestSchema = z
1807
+ .object({
1808
+ executionId: UuidSchema,
1809
+ configSnapshot: z.record(z.string(), z.unknown()).optional()
1810
+ })
1803
1811
  .strict()
1804
1812
  ```
1805
1813
 
1806
1814
  ### `AcqListResponseSchema`
1807
1815
 
1808
1816
  ```typescript
1809
- /**
1810
- * Single list as returned by /api/acquisition/lists/:id etc.
1811
- * Camel-cased domain shape matching AcqList in types.ts.
1812
- */
1813
- export const AcqListResponseSchema = z.object({
1814
- id: z.string(),
1815
- organizationId: z.string(),
1816
- name: z.string(),
1817
- description: z.string().nullable(),
1818
- type: z.string(),
1819
- batchIds: z.array(z.string()),
1820
- instantlyCampaignId: z.string().nullable(),
1821
- /** Lifecycle status (draft | enriching | launched | closing | archived). */
1822
- status: ListStatusSchema,
1823
- metadata: z.record(z.string(), z.unknown()),
1824
- launchedAt: z.string().nullable(),
1825
- completedAt: z.string().nullable(),
1826
- createdAt: z.string(),
1827
- /** Scraping criteria stored as jsonb on the row. */
1828
- scrapingConfig: ScrapingConfigSchema,
1829
- /** ICP / qualification rubric stored as jsonb on the row. */
1830
- icp: IcpRubricSchema,
1831
- /** Pipeline presentation contract stored as jsonb on the row. */
1832
- pipelineConfig: PipelineConfigSchema
1817
+ /**
1818
+ * Single list as returned by /api/acquisition/lists/:id etc.
1819
+ * Camel-cased domain shape matching AcqList in types.ts.
1820
+ */
1821
+ export const AcqListResponseSchema = z.object({
1822
+ id: z.string(),
1823
+ organizationId: z.string(),
1824
+ name: z.string(),
1825
+ description: z.string().nullable(),
1826
+ type: z.string(),
1827
+ batchIds: z.array(z.string()),
1828
+ instantlyCampaignId: z.string().nullable(),
1829
+ /** Lifecycle status (draft | enriching | launched | closing | archived). */
1830
+ status: ListStatusSchema,
1831
+ metadata: z.record(z.string(), z.unknown()),
1832
+ launchedAt: z.string().nullable(),
1833
+ completedAt: z.string().nullable(),
1834
+ createdAt: z.string(),
1835
+ /** Scraping criteria stored as jsonb on the row. */
1836
+ scrapingConfig: ScrapingConfigSchema,
1837
+ /** ICP / qualification rubric stored as jsonb on the row. */
1838
+ icp: IcpRubricSchema,
1839
+ /** Pipeline presentation contract stored as jsonb on the row. */
1840
+ pipelineConfig: PipelineConfigSchema
1833
1841
  })
1834
1842
  ```
1835
1843
 
@@ -1854,17 +1862,17 @@ export const ListTelemetryListResponseSchema = z.array(ListTelemetrySchema)
1854
1862
  ### `ListExecutionSummarySchema`
1855
1863
 
1856
1864
  ```typescript
1857
- /**
1858
- * Row from acq_list_executions joined with the execution summary,
1859
- * shaped for the /lists/:id/executions response.
1860
- */
1861
- export const ListExecutionSummarySchema = z.object({
1862
- executionId: z.string(),
1863
- resourceId: z.string(),
1864
- status: z.string(),
1865
- createdAt: z.string(),
1866
- completedAt: z.string().nullable(),
1867
- durationMs: z.number().int().nullable()
1865
+ /**
1866
+ * Row from acq_list_executions joined with the execution summary,
1867
+ * shaped for the /lists/:id/executions response.
1868
+ */
1869
+ export const ListExecutionSummarySchema = z.object({
1870
+ executionId: z.string(),
1871
+ resourceId: z.string(),
1872
+ status: z.string(),
1873
+ createdAt: z.string(),
1874
+ completedAt: z.string().nullable(),
1875
+ durationMs: z.number().int().nullable()
1868
1876
  })
1869
1877
  ```
1870
1878
 
@@ -1895,282 +1903,282 @@ export const AcqEmailValidSchema = z.enum(['VALID', 'INVALID', 'RISKY', 'UNKNOWN
1895
1903
  ### `CompanyIdParamsSchema`
1896
1904
 
1897
1905
  ```typescript
1898
- export const CompanyIdParamsSchema = z.object({
1899
- companyId: UuidSchema
1906
+ export const CompanyIdParamsSchema = z.object({
1907
+ companyId: UuidSchema
1900
1908
  })
1901
1909
  ```
1902
1910
 
1903
1911
  ### `ContactIdParamsSchema`
1904
1912
 
1905
1913
  ```typescript
1906
- export const ContactIdParamsSchema = z.object({
1907
- contactId: UuidSchema
1914
+ export const ContactIdParamsSchema = z.object({
1915
+ contactId: UuidSchema
1908
1916
  })
1909
1917
  ```
1910
1918
 
1911
1919
  ### `ListCompaniesQuerySchema`
1912
1920
 
1913
1921
  ```typescript
1914
- export const ListCompaniesQuerySchema = z
1915
- .object({
1916
- search: z.string().trim().min(1).max(200).optional(),
1917
- listId: UuidSchema.optional(),
1918
- domain: z.string().trim().min(1).max(255).optional(),
1919
- website: z.string().trim().min(1).max(2048).optional(),
1920
- segment: z.string().trim().min(1).max(255).optional(),
1921
- category: z.string().trim().min(1).max(255).optional(),
1922
- batchId: z.string().trim().min(1).max(255).optional(),
1923
- status: AcqCompanyStatusSchema.optional(),
1924
- includeAll: QueryBooleanSchema.optional(),
1925
- limit: z.coerce.number().int().min(1).max(5000).default(50),
1926
- offset: z.coerce.number().int().min(0).default(0)
1927
- })
1922
+ export const ListCompaniesQuerySchema = z
1923
+ .object({
1924
+ search: z.string().trim().min(1).max(200).optional(),
1925
+ listId: UuidSchema.optional(),
1926
+ domain: z.string().trim().min(1).max(255).optional(),
1927
+ website: z.string().trim().min(1).max(2048).optional(),
1928
+ segment: z.string().trim().min(1).max(255).optional(),
1929
+ category: z.string().trim().min(1).max(255).optional(),
1930
+ batchId: z.string().trim().min(1).max(255).optional(),
1931
+ status: AcqCompanyStatusSchema.optional(),
1932
+ includeAll: QueryBooleanSchema.optional(),
1933
+ limit: z.coerce.number().int().min(1).max(5000).default(50),
1934
+ offset: z.coerce.number().int().min(0).default(0)
1935
+ })
1928
1936
  .strict()
1929
1937
  ```
1930
1938
 
1931
1939
  ### `ListContactsQuerySchema`
1932
1940
 
1933
1941
  ```typescript
1934
- export const ListContactsQuerySchema = z
1935
- .object({
1936
- search: z.string().trim().min(1).max(200).optional(),
1937
- listId: UuidSchema.optional(),
1938
- openingLineIsNull: QueryBooleanSchema.optional(),
1939
- batchId: z.string().trim().min(1).max(255).optional(),
1940
- contactStatus: AcqContactStatusSchema.optional(),
1941
- limit: z.coerce.number().int().min(1).max(5000).default(5000),
1942
- offset: z.coerce.number().int().min(0).default(0)
1943
- })
1942
+ export const ListContactsQuerySchema = z
1943
+ .object({
1944
+ search: z.string().trim().min(1).max(200).optional(),
1945
+ listId: UuidSchema.optional(),
1946
+ openingLineIsNull: QueryBooleanSchema.optional(),
1947
+ batchId: z.string().trim().min(1).max(255).optional(),
1948
+ contactStatus: AcqContactStatusSchema.optional(),
1949
+ limit: z.coerce.number().int().min(1).max(5000).default(5000),
1950
+ offset: z.coerce.number().int().min(0).default(0)
1951
+ })
1944
1952
  .strict()
1945
1953
  ```
1946
1954
 
1947
1955
  ### `CreateCompanyRequestSchema`
1948
1956
 
1949
1957
  ```typescript
1950
- export const CreateCompanyRequestSchema = z
1951
- .object({
1952
- name: z.string().trim().min(1).max(255),
1953
- domain: z.string().trim().min(1).max(255).optional(),
1954
- linkedinUrl: z.string().trim().url().optional(),
1955
- website: z.string().trim().url().optional(),
1956
- numEmployees: z.number().int().min(0).optional(),
1957
- foundedYear: z.number().int().optional(),
1958
- locationCity: z.string().trim().min(1).max(255).optional(),
1959
- locationState: z.string().trim().min(1).max(255).optional(),
1960
- category: z.string().trim().min(1).max(255).optional(),
1961
- source: z.string().trim().min(1).max(255).optional(),
1962
- batchId: z.string().trim().min(1).max(255).optional(),
1963
- verticalResearch: z.string().trim().min(1).max(5000).optional()
1964
- })
1958
+ export const CreateCompanyRequestSchema = z
1959
+ .object({
1960
+ name: z.string().trim().min(1).max(255),
1961
+ domain: z.string().trim().min(1).max(255).optional(),
1962
+ linkedinUrl: z.string().trim().url().optional(),
1963
+ website: z.string().trim().url().optional(),
1964
+ numEmployees: z.number().int().min(0).optional(),
1965
+ foundedYear: z.number().int().optional(),
1966
+ locationCity: z.string().trim().min(1).max(255).optional(),
1967
+ locationState: z.string().trim().min(1).max(255).optional(),
1968
+ category: z.string().trim().min(1).max(255).optional(),
1969
+ source: z.string().trim().min(1).max(255).optional(),
1970
+ batchId: z.string().trim().min(1).max(255).optional(),
1971
+ verticalResearch: z.string().trim().min(1).max(5000).optional()
1972
+ })
1965
1973
  .strict()
1966
1974
  ```
1967
1975
 
1968
1976
  ### `UpdateCompanyRequestSchema`
1969
1977
 
1970
1978
  ```typescript
1971
- export const UpdateCompanyRequestSchema = z
1972
- .object({
1973
- name: z.string().trim().min(1).max(255).optional(),
1974
- domain: z.string().trim().min(1).max(255).optional(),
1975
- linkedinUrl: z.string().trim().url().optional(),
1976
- website: z.string().trim().url().optional(),
1977
- numEmployees: z.number().int().min(0).optional(),
1978
- foundedYear: z.number().int().optional(),
1979
- locationCity: z.string().trim().min(1).max(255).optional(),
1980
- locationState: z.string().trim().min(1).max(255).optional(),
1981
- category: z.string().trim().min(1).max(255).optional(),
1982
- segment: z.string().trim().min(1).max(255).optional(),
1983
- pipelineStatus: z.record(z.string(), z.unknown()).optional(),
1984
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
1985
- source: z.string().trim().min(1).max(255).optional(),
1986
- batchId: z.string().trim().min(1).max(255).optional(),
1987
- status: AcqCompanyStatusSchema.optional(),
1988
- verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
1989
- })
1990
- .strict()
1991
- .refine(
1992
- (data) =>
1993
- data.name !== undefined ||
1994
- data.domain !== undefined ||
1995
- data.linkedinUrl !== undefined ||
1996
- data.website !== undefined ||
1997
- data.numEmployees !== undefined ||
1998
- data.foundedYear !== undefined ||
1999
- data.locationCity !== undefined ||
2000
- data.locationState !== undefined ||
2001
- data.category !== undefined ||
2002
- data.segment !== undefined ||
2003
- data.pipelineStatus !== undefined ||
2004
- data.enrichmentData !== undefined ||
2005
- data.source !== undefined ||
2006
- data.batchId !== undefined ||
2007
- data.status !== undefined ||
2008
- data.verticalResearch !== undefined,
2009
- {
2010
- message: 'At least one field must be provided'
2011
- }
1979
+ export const UpdateCompanyRequestSchema = z
1980
+ .object({
1981
+ name: z.string().trim().min(1).max(255).optional(),
1982
+ domain: z.string().trim().min(1).max(255).optional(),
1983
+ linkedinUrl: z.string().trim().url().optional(),
1984
+ website: z.string().trim().url().optional(),
1985
+ numEmployees: z.number().int().min(0).optional(),
1986
+ foundedYear: z.number().int().optional(),
1987
+ locationCity: z.string().trim().min(1).max(255).optional(),
1988
+ locationState: z.string().trim().min(1).max(255).optional(),
1989
+ category: z.string().trim().min(1).max(255).optional(),
1990
+ segment: z.string().trim().min(1).max(255).optional(),
1991
+ pipelineStatus: z.record(z.string(), z.unknown()).optional(),
1992
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
1993
+ source: z.string().trim().min(1).max(255).optional(),
1994
+ batchId: z.string().trim().min(1).max(255).optional(),
1995
+ status: AcqCompanyStatusSchema.optional(),
1996
+ verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
1997
+ })
1998
+ .strict()
1999
+ .refine(
2000
+ (data) =>
2001
+ data.name !== undefined ||
2002
+ data.domain !== undefined ||
2003
+ data.linkedinUrl !== undefined ||
2004
+ data.website !== undefined ||
2005
+ data.numEmployees !== undefined ||
2006
+ data.foundedYear !== undefined ||
2007
+ data.locationCity !== undefined ||
2008
+ data.locationState !== undefined ||
2009
+ data.category !== undefined ||
2010
+ data.segment !== undefined ||
2011
+ data.pipelineStatus !== undefined ||
2012
+ data.enrichmentData !== undefined ||
2013
+ data.source !== undefined ||
2014
+ data.batchId !== undefined ||
2015
+ data.status !== undefined ||
2016
+ data.verticalResearch !== undefined,
2017
+ {
2018
+ message: 'At least one field must be provided'
2019
+ }
2012
2020
  )
2013
2021
  ```
2014
2022
 
2015
2023
  ### `CreateContactRequestSchema`
2016
2024
 
2017
2025
  ```typescript
2018
- export const CreateContactRequestSchema = z
2019
- .object({
2020
- email: z.string().trim().email(),
2021
- companyId: UuidSchema.optional(),
2022
- firstName: z.string().trim().min(1).max(255).optional(),
2023
- lastName: z.string().trim().min(1).max(255).optional(),
2024
- linkedinUrl: z.string().trim().url().optional(),
2025
- title: z.string().trim().min(1).max(255).optional(),
2026
- source: z.string().trim().min(1).max(255).optional(),
2027
- sourceId: z.string().trim().min(1).max(255).optional(),
2028
- batchId: z.string().trim().min(1).max(255).optional()
2029
- })
2026
+ export const CreateContactRequestSchema = z
2027
+ .object({
2028
+ email: z.string().trim().email(),
2029
+ companyId: UuidSchema.optional(),
2030
+ firstName: z.string().trim().min(1).max(255).optional(),
2031
+ lastName: z.string().trim().min(1).max(255).optional(),
2032
+ linkedinUrl: z.string().trim().url().optional(),
2033
+ title: z.string().trim().min(1).max(255).optional(),
2034
+ source: z.string().trim().min(1).max(255).optional(),
2035
+ sourceId: z.string().trim().min(1).max(255).optional(),
2036
+ batchId: z.string().trim().min(1).max(255).optional()
2037
+ })
2030
2038
  .strict()
2031
2039
  ```
2032
2040
 
2033
2041
  ### `UpdateContactRequestSchema`
2034
2042
 
2035
2043
  ```typescript
2036
- export const UpdateContactRequestSchema = z
2037
- .object({
2038
- companyId: UuidSchema.optional(),
2039
- emailValid: AcqEmailValidSchema.optional(),
2040
- firstName: z.string().trim().min(1).max(255).optional(),
2041
- lastName: z.string().trim().min(1).max(255).optional(),
2042
- linkedinUrl: z.string().trim().url().optional(),
2043
- title: z.string().trim().min(1).max(255).optional(),
2044
- headline: z.string().trim().min(1).max(5000).optional(),
2045
- filterReason: z.string().trim().min(1).max(5000).optional(),
2046
- openingLine: z.string().trim().min(1).max(5000).optional(),
2047
- pipelineStatus: z.record(z.string(), z.unknown()).optional(),
2048
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
2049
- status: AcqContactStatusSchema.optional()
2050
- })
2051
- .strict()
2052
- .refine(
2053
- (data) =>
2054
- data.companyId !== undefined ||
2055
- data.emailValid !== undefined ||
2056
- data.firstName !== undefined ||
2057
- data.lastName !== undefined ||
2058
- data.linkedinUrl !== undefined ||
2059
- data.title !== undefined ||
2060
- data.headline !== undefined ||
2061
- data.filterReason !== undefined ||
2062
- data.openingLine !== undefined ||
2063
- data.pipelineStatus !== undefined ||
2064
- data.enrichmentData !== undefined ||
2065
- data.status !== undefined,
2066
- {
2067
- message: 'At least one field must be provided'
2068
- }
2044
+ export const UpdateContactRequestSchema = z
2045
+ .object({
2046
+ companyId: UuidSchema.optional(),
2047
+ emailValid: AcqEmailValidSchema.optional(),
2048
+ firstName: z.string().trim().min(1).max(255).optional(),
2049
+ lastName: z.string().trim().min(1).max(255).optional(),
2050
+ linkedinUrl: z.string().trim().url().optional(),
2051
+ title: z.string().trim().min(1).max(255).optional(),
2052
+ headline: z.string().trim().min(1).max(5000).optional(),
2053
+ filterReason: z.string().trim().min(1).max(5000).optional(),
2054
+ openingLine: z.string().trim().min(1).max(5000).optional(),
2055
+ pipelineStatus: z.record(z.string(), z.unknown()).optional(),
2056
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
2057
+ status: AcqContactStatusSchema.optional()
2058
+ })
2059
+ .strict()
2060
+ .refine(
2061
+ (data) =>
2062
+ data.companyId !== undefined ||
2063
+ data.emailValid !== undefined ||
2064
+ data.firstName !== undefined ||
2065
+ data.lastName !== undefined ||
2066
+ data.linkedinUrl !== undefined ||
2067
+ data.title !== undefined ||
2068
+ data.headline !== undefined ||
2069
+ data.filterReason !== undefined ||
2070
+ data.openingLine !== undefined ||
2071
+ data.pipelineStatus !== undefined ||
2072
+ data.enrichmentData !== undefined ||
2073
+ data.status !== undefined,
2074
+ {
2075
+ message: 'At least one field must be provided'
2076
+ }
2069
2077
  )
2070
2078
  ```
2071
2079
 
2072
2080
  ### `AcqCompanyResponseSchema`
2073
2081
 
2074
2082
  ```typescript
2075
- export const AcqCompanyResponseSchema = z.object({
2076
- id: z.string(),
2077
- organizationId: z.string(),
2078
- name: z.string(),
2079
- domain: z.string().nullable(),
2080
- linkedinUrl: z.string().nullable(),
2081
- website: z.string().nullable(),
2082
- numEmployees: z.number().nullable(),
2083
- foundedYear: z.number().nullable(),
2084
- locationCity: z.string().nullable(),
2085
- locationState: z.string().nullable(),
2086
- category: z.string().nullable(),
2087
- categoryPain: z.string().nullable(),
2088
- segment: z.string().nullable(),
2089
- pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2090
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2091
- source: z.string().nullable(),
2092
- batchId: z.string().nullable(),
2093
- status: AcqCompanyStatusSchema,
2094
- contactCount: z.number().int().min(0),
2095
- verticalResearch: z.string().nullable(),
2096
- createdAt: z.string(),
2097
- updatedAt: z.string()
2083
+ export const AcqCompanyResponseSchema = z.object({
2084
+ id: z.string(),
2085
+ organizationId: z.string(),
2086
+ name: z.string(),
2087
+ domain: z.string().nullable(),
2088
+ linkedinUrl: z.string().nullable(),
2089
+ website: z.string().nullable(),
2090
+ numEmployees: z.number().nullable(),
2091
+ foundedYear: z.number().nullable(),
2092
+ locationCity: z.string().nullable(),
2093
+ locationState: z.string().nullable(),
2094
+ category: z.string().nullable(),
2095
+ categoryPain: z.string().nullable(),
2096
+ segment: z.string().nullable(),
2097
+ pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2098
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2099
+ source: z.string().nullable(),
2100
+ batchId: z.string().nullable(),
2101
+ status: AcqCompanyStatusSchema,
2102
+ contactCount: z.number().int().min(0),
2103
+ verticalResearch: z.string().nullable(),
2104
+ createdAt: z.string(),
2105
+ updatedAt: z.string()
2098
2106
  })
2099
2107
  ```
2100
2108
 
2101
2109
  ### `AcqCompanyListResponseSchema`
2102
2110
 
2103
2111
  ```typescript
2104
- export const AcqCompanyListResponseSchema = z.object({
2105
- data: z.array(AcqCompanyResponseSchema),
2106
- total: z.number().int(),
2107
- limit: z.number().int(),
2108
- offset: z.number().int()
2112
+ export const AcqCompanyListResponseSchema = z.object({
2113
+ data: z.array(AcqCompanyResponseSchema),
2114
+ total: z.number().int(),
2115
+ limit: z.number().int(),
2116
+ offset: z.number().int()
2109
2117
  })
2110
2118
  ```
2111
2119
 
2112
2120
  ### `AcqCompanyFacetsResponseSchema`
2113
2121
 
2114
2122
  ```typescript
2115
- export const AcqCompanyFacetsResponseSchema = z.object({
2116
- segments: z.array(z.string()),
2117
- categories: z.array(z.string()),
2118
- statuses: z.array(AcqCompanyStatusSchema)
2123
+ export const AcqCompanyFacetsResponseSchema = z.object({
2124
+ segments: z.array(z.string()),
2125
+ categories: z.array(z.string()),
2126
+ statuses: z.array(AcqCompanyStatusSchema)
2119
2127
  })
2120
2128
  ```
2121
2129
 
2122
2130
  ### `AcqContactCompanySummarySchema`
2123
2131
 
2124
2132
  ```typescript
2125
- export const AcqContactCompanySummarySchema = z.object({
2126
- id: z.string(),
2127
- name: z.string(),
2128
- domain: z.string().nullable(),
2129
- website: z.string().nullable(),
2130
- linkedinUrl: z.string().nullable(),
2131
- segment: z.string().nullable(),
2132
- category: z.string().nullable(),
2133
- status: AcqCompanyStatusSchema
2133
+ export const AcqContactCompanySummarySchema = z.object({
2134
+ id: z.string(),
2135
+ name: z.string(),
2136
+ domain: z.string().nullable(),
2137
+ website: z.string().nullable(),
2138
+ linkedinUrl: z.string().nullable(),
2139
+ segment: z.string().nullable(),
2140
+ category: z.string().nullable(),
2141
+ status: AcqCompanyStatusSchema
2134
2142
  })
2135
2143
  ```
2136
2144
 
2137
2145
  ### `AcqContactResponseSchema`
2138
2146
 
2139
2147
  ```typescript
2140
- export const AcqContactResponseSchema = z.object({
2141
- id: z.string(),
2142
- organizationId: z.string(),
2143
- companyId: z.string().nullable(),
2144
- email: z.string(),
2145
- emailValid: AcqEmailValidSchema.nullable(),
2146
- firstName: z.string().nullable(),
2147
- lastName: z.string().nullable(),
2148
- linkedinUrl: z.string().nullable(),
2149
- title: z.string().nullable(),
2150
- headline: z.string().nullable(),
2151
- filterReason: z.string().nullable(),
2152
- openingLine: z.string().nullable(),
2153
- source: z.string().nullable(),
2154
- sourceId: z.string().nullable(),
2155
- pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2156
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2157
- attioPersonId: z.string().nullable(),
2158
- batchId: z.string().nullable(),
2159
- status: AcqContactStatusSchema,
2160
- company: AcqContactCompanySummarySchema.nullable().optional(),
2161
- createdAt: z.string(),
2162
- updatedAt: z.string()
2148
+ export const AcqContactResponseSchema = z.object({
2149
+ id: z.string(),
2150
+ organizationId: z.string(),
2151
+ companyId: z.string().nullable(),
2152
+ email: z.string(),
2153
+ emailValid: AcqEmailValidSchema.nullable(),
2154
+ firstName: z.string().nullable(),
2155
+ lastName: z.string().nullable(),
2156
+ linkedinUrl: z.string().nullable(),
2157
+ title: z.string().nullable(),
2158
+ headline: z.string().nullable(),
2159
+ filterReason: z.string().nullable(),
2160
+ openingLine: z.string().nullable(),
2161
+ source: z.string().nullable(),
2162
+ sourceId: z.string().nullable(),
2163
+ pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2164
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2165
+ attioPersonId: z.string().nullable(),
2166
+ batchId: z.string().nullable(),
2167
+ status: AcqContactStatusSchema,
2168
+ company: AcqContactCompanySummarySchema.nullable().optional(),
2169
+ createdAt: z.string(),
2170
+ updatedAt: z.string()
2163
2171
  })
2164
2172
  ```
2165
2173
 
2166
2174
  ### `AcqContactListResponseSchema`
2167
2175
 
2168
2176
  ```typescript
2169
- export const AcqContactListResponseSchema = z.object({
2170
- data: z.array(AcqContactResponseSchema),
2171
- total: z.number().int(),
2172
- limit: z.number().int(),
2173
- offset: z.number().int()
2177
+ export const AcqContactListResponseSchema = z.object({
2178
+ data: z.array(AcqContactResponseSchema),
2179
+ total: z.number().int(),
2180
+ limit: z.number().int(),
2181
+ offset: z.number().int()
2174
2182
  })
2175
2183
  ```
2176
2184
 
@@ -2183,222 +2191,223 @@ export const AcqArtifactOwnerKindSchema = z.enum(['company', 'contact', 'deal',
2183
2191
  ### `ListArtifactsQuerySchema`
2184
2192
 
2185
2193
  ```typescript
2186
- export const ListArtifactsQuerySchema = z
2187
- .object({
2188
- ownerKind: AcqArtifactOwnerKindSchema,
2189
- ownerId: UuidSchema
2190
- })
2194
+ export const ListArtifactsQuerySchema = z
2195
+ .object({
2196
+ ownerKind: AcqArtifactOwnerKindSchema,
2197
+ ownerId: UuidSchema
2198
+ })
2191
2199
  .strict()
2192
2200
  ```
2193
2201
 
2194
2202
  ### `CreateArtifactRequestSchema`
2195
2203
 
2196
2204
  ```typescript
2197
- export const CreateArtifactRequestSchema = z
2198
- .object({
2199
- ownerKind: AcqArtifactOwnerKindSchema,
2200
- ownerId: UuidSchema,
2201
- kind: z.string().trim().min(1).max(255),
2202
- content: z.record(z.string(), z.unknown()),
2203
- sourceExecutionId: UuidSchema.optional()
2204
- })
2205
+ export const CreateArtifactRequestSchema = z
2206
+ .object({
2207
+ ownerKind: AcqArtifactOwnerKindSchema,
2208
+ ownerId: UuidSchema,
2209
+ kind: z.string().trim().min(1).max(255),
2210
+ content: z.record(z.string(), z.unknown()),
2211
+ sourceExecutionId: UuidSchema.optional()
2212
+ })
2205
2213
  .strict()
2206
2214
  ```
2207
2215
 
2208
2216
  ### `AcqArtifactResponseSchema`
2209
2217
 
2210
2218
  ```typescript
2211
- export const AcqArtifactResponseSchema = z.object({
2212
- id: z.string(),
2213
- organizationId: z.string(),
2214
- ownerKind: z.string(),
2215
- ownerId: z.string(),
2216
- kind: z.string(),
2217
- content: z.record(z.string(), z.unknown()),
2218
- sourceExecutionId: z.string().nullable(),
2219
- createdBy: z.string().nullable(),
2220
- createdAt: z.string(),
2221
- version: z.number().int()
2219
+ export const AcqArtifactResponseSchema = z.object({
2220
+ id: z.string(),
2221
+ organizationId: z.string(),
2222
+ ownerKind: z.string(),
2223
+ ownerId: z.string(),
2224
+ kind: z.string(),
2225
+ content: z.record(z.string(), z.unknown()),
2226
+ sourceExecutionId: z.string().nullable(),
2227
+ createdBy: z.string().nullable(),
2228
+ createdAt: z.string(),
2229
+ version: z.number().int()
2222
2230
  })
2223
2231
  ```
2224
2232
 
2225
2233
  ### `AcqArtifactListResponseSchema`
2226
2234
 
2227
2235
  ```typescript
2228
- export const AcqArtifactListResponseSchema = z.object({
2229
- artifacts: z.array(AcqArtifactResponseSchema)
2236
+ export const AcqArtifactListResponseSchema = z.object({
2237
+ artifacts: z.array(AcqArtifactResponseSchema)
2230
2238
  })
2231
2239
  ```
2232
2240
 
2233
2241
  ### `ListMembersQuerySchema`
2234
2242
 
2235
2243
  ```typescript
2236
- export const ListMembersQuerySchema = z
2237
- .object({
2238
- limit: z.coerce.number().int().min(1).max(500).default(50),
2239
- offset: z.coerce.number().int().min(0).default(0)
2240
- })
2244
+ export const ListMembersQuerySchema = z
2245
+ .object({
2246
+ limit: z.coerce.number().int().min(1).max(500).default(50),
2247
+ offset: z.coerce.number().int().min(0).default(0)
2248
+ })
2241
2249
  .strict()
2242
2250
  ```
2243
2251
 
2244
2252
  ### `MemberIdParamsSchema`
2245
2253
 
2246
2254
  ```typescript
2247
- export const MemberIdParamsSchema = z.object({
2248
- memberId: UuidSchema
2255
+ export const MemberIdParamsSchema = z.object({
2256
+ memberId: UuidSchema
2249
2257
  })
2250
2258
  ```
2251
2259
 
2252
2260
  ### `AcqListMemberContactSummarySchema`
2253
2261
 
2254
2262
  ```typescript
2255
- export const AcqListMemberContactSummarySchema = z.object({
2256
- id: z.string(),
2257
- email: z.string(),
2258
- firstName: z.string().nullable(),
2259
- lastName: z.string().nullable(),
2260
- title: z.string().nullable(),
2261
- linkedinUrl: z.string().nullable(),
2262
- companyId: z.string().nullable()
2263
+ export const AcqListMemberContactSummarySchema = z.object({
2264
+ id: z.string(),
2265
+ email: z.string(),
2266
+ firstName: z.string().nullable(),
2267
+ lastName: z.string().nullable(),
2268
+ title: z.string().nullable(),
2269
+ linkedinUrl: z.string().nullable(),
2270
+ companyId: z.string().nullable()
2263
2271
  })
2264
2272
  ```
2265
2273
 
2266
2274
  ### `AcqListMemberResponseSchema`
2267
2275
 
2268
2276
  ```typescript
2269
- export const AcqListMemberResponseSchema = z.object({
2270
- id: z.string(),
2271
- listId: z.string(),
2272
- contactId: z.string(),
2273
- pipelineKey: z.string(),
2274
- stageKey: z.string(),
2275
- stateKey: z.string(),
2276
- activityLog: z.unknown(),
2277
- addedAt: z.string(),
2278
- addedBy: z.string().nullable(),
2279
- sourceExecutionId: z.string().nullable(),
2280
- contact: AcqListMemberContactSummarySchema.nullable()
2277
+ export const AcqListMemberResponseSchema = z.object({
2278
+ id: z.string(),
2279
+ listId: z.string(),
2280
+ contactId: z.string(),
2281
+ pipelineKey: z.string(),
2282
+ stageKey: z.string(),
2283
+ stateKey: z.string(),
2284
+ activityLog: z.unknown(),
2285
+ addedAt: z.string(),
2286
+ addedBy: z.string().nullable(),
2287
+ sourceExecutionId: z.string().nullable(),
2288
+ contact: AcqListMemberContactSummarySchema.nullable()
2281
2289
  })
2282
2290
  ```
2283
2291
 
2284
2292
  ### `AcqListMembersResponseSchema`
2285
2293
 
2286
2294
  ```typescript
2287
- export const AcqListMembersResponseSchema = z.object({
2288
- members: z.array(AcqListMemberResponseSchema)
2295
+ export const AcqListMembersResponseSchema = z.object({
2296
+ members: z.array(AcqListMemberResponseSchema)
2289
2297
  })
2290
2298
  ```
2291
2299
 
2292
2300
  ### `ListCompanyIdParamsSchema`
2293
2301
 
2294
2302
  ```typescript
2295
- export const ListCompanyIdParamsSchema = z.object({
2296
- listCompanyId: UuidSchema
2303
+ export const ListCompanyIdParamsSchema = z.object({
2304
+ listCompanyId: UuidSchema
2297
2305
  })
2298
2306
  ```
2299
2307
 
2300
2308
  ### `AcqListCompanyResponseSchema`
2301
2309
 
2302
2310
  ```typescript
2303
- export const AcqListCompanyResponseSchema = z.object({
2304
- id: z.string(),
2305
- listId: z.string(),
2306
- companyId: z.string(),
2307
- pipelineKey: z.string(),
2308
- stageKey: z.string(),
2309
- stateKey: z.string(),
2310
- activityLog: z.unknown(),
2311
- addedAt: z.string(),
2312
- addedBy: z.string().nullable(),
2313
- sourceExecutionId: z.string().nullable()
2311
+ export const AcqListCompanyResponseSchema = z.object({
2312
+ id: z.string(),
2313
+ listId: z.string(),
2314
+ companyId: z.string(),
2315
+ pipelineKey: z.string(),
2316
+ stageKey: z.string(),
2317
+ stateKey: z.string(),
2318
+ activityLog: z.unknown(),
2319
+ addedAt: z.string(),
2320
+ addedBy: z.string().nullable(),
2321
+ sourceExecutionId: z.string().nullable()
2314
2322
  })
2315
2323
  ```
2316
2324
 
2317
2325
  ### `AcqCompanySchemas`
2318
2326
 
2319
2327
  ```typescript
2320
- export const AcqCompanySchemas = {
2321
- CompanyIdParams: CompanyIdParamsSchema,
2322
- ListCompaniesQuery: ListCompaniesQuerySchema,
2323
- CreateCompanyRequest: CreateCompanyRequestSchema,
2324
- UpdateCompanyRequest: UpdateCompanyRequestSchema,
2325
- AcqCompanyResponse: AcqCompanyResponseSchema,
2326
- AcqCompanyListResponse: AcqCompanyListResponseSchema,
2327
- AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
2328
+ export const AcqCompanySchemas = {
2329
+ CompanyIdParams: CompanyIdParamsSchema,
2330
+ ListCompaniesQuery: ListCompaniesQuerySchema,
2331
+ CreateCompanyRequest: CreateCompanyRequestSchema,
2332
+ UpdateCompanyRequest: UpdateCompanyRequestSchema,
2333
+ AcqCompanyResponse: AcqCompanyResponseSchema,
2334
+ AcqCompanyListResponse: AcqCompanyListResponseSchema,
2335
+ AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
2328
2336
  }
2329
2337
  ```
2330
2338
 
2331
2339
  ### `AcqContactSchemas`
2332
2340
 
2333
2341
  ```typescript
2334
- export const AcqContactSchemas = {
2335
- ContactIdParams: ContactIdParamsSchema,
2336
- ListContactsQuery: ListContactsQuerySchema,
2337
- CreateContactRequest: CreateContactRequestSchema,
2338
- UpdateContactRequest: UpdateContactRequestSchema,
2339
- AcqContactResponse: AcqContactResponseSchema,
2340
- AcqContactListResponse: AcqContactListResponseSchema
2342
+ export const AcqContactSchemas = {
2343
+ ContactIdParams: ContactIdParamsSchema,
2344
+ ListContactsQuery: ListContactsQuerySchema,
2345
+ CreateContactRequest: CreateContactRequestSchema,
2346
+ UpdateContactRequest: UpdateContactRequestSchema,
2347
+ AcqContactResponse: AcqContactResponseSchema,
2348
+ AcqContactListResponse: AcqContactListResponseSchema
2341
2349
  }
2342
2350
  ```
2343
2351
 
2344
2352
  ### `AcqListSchemas`
2345
2353
 
2346
2354
  ```typescript
2347
- export const AcqListSchemas = {
2348
- // Params
2349
- ListIdParams: ListIdParamsSchema,
2350
-
2351
- // Primitives (for UI / tests)
2352
- ListStatus: ListStatusSchema,
2353
- ScrapingConfig: ScrapingConfigSchema,
2354
- IcpRubric: IcpRubricSchema,
2355
- PipelineConfig: PipelineConfigSchema,
2356
- PipelineStage: PipelineStageSchema,
2357
- ListStageCounts: ListStageCountsSchema,
2358
- ListTelemetry: ListTelemetrySchema,
2359
-
2360
- // Requests
2361
- CreateListRequest: CreateListRequestSchema,
2362
- UpdateListRequest: UpdateListRequestSchema,
2363
- UpdateListStatusRequest: UpdateListStatusRequestSchema,
2364
- UpdateListConfigRequest: UpdateListConfigRequestSchema,
2365
- AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2366
- RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
2367
- AddContactsToListRequest: AddContactsToListRequestSchema,
2368
- RecordListExecutionRequest: RecordListExecutionRequestSchema,
2369
-
2370
- // Responses
2371
- AcqListResponse: AcqListResponseSchema,
2372
- AcqListListResponse: AcqListListResponseSchema,
2373
- ListTelemetryResponse: ListTelemetryResponseSchema,
2374
- ListTelemetryListResponse: ListTelemetryListResponseSchema,
2375
- ListExecutionsResponse: ListExecutionsResponseSchema,
2376
- ListProgressResponse: ListProgressResponseSchema
2355
+ export const AcqListSchemas = {
2356
+ // Params
2357
+ ListIdParams: ListIdParamsSchema,
2358
+
2359
+ // Primitives (for UI / tests)
2360
+ ListStatus: ListStatusSchema,
2361
+ ScrapingConfig: ScrapingConfigSchema,
2362
+ IcpRubric: IcpRubricSchema,
2363
+ PipelineConfig: PipelineConfigSchema,
2364
+ PipelineStage: PipelineStageSchema,
2365
+ ProcessingStageStatus: ProcessingStageStatusSchema,
2366
+ ListStageCounts: ListStageCountsSchema,
2367
+ ListTelemetry: ListTelemetrySchema,
2368
+
2369
+ // Requests
2370
+ CreateListRequest: CreateListRequestSchema,
2371
+ UpdateListRequest: UpdateListRequestSchema,
2372
+ UpdateListStatusRequest: UpdateListStatusRequestSchema,
2373
+ UpdateListConfigRequest: UpdateListConfigRequestSchema,
2374
+ AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2375
+ RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
2376
+ AddContactsToListRequest: AddContactsToListRequestSchema,
2377
+ RecordListExecutionRequest: RecordListExecutionRequestSchema,
2378
+
2379
+ // Responses
2380
+ AcqListResponse: AcqListResponseSchema,
2381
+ AcqListListResponse: AcqListListResponseSchema,
2382
+ ListTelemetryResponse: ListTelemetryResponseSchema,
2383
+ ListTelemetryListResponse: ListTelemetryListResponseSchema,
2384
+ ListExecutionsResponse: ListExecutionsResponseSchema,
2385
+ ListProgressResponse: ListProgressResponseSchema
2377
2386
  }
2378
2387
  ```
2379
2388
 
2380
2389
  ### `AcqSubstrateSchemas`
2381
2390
 
2382
2391
  ```typescript
2383
- export const AcqSubstrateSchemas = {
2384
- // Artifacts
2385
- ListArtifactsQuery: ListArtifactsQuerySchema,
2386
- CreateArtifactRequest: CreateArtifactRequestSchema,
2387
- AcqArtifactResponse: AcqArtifactResponseSchema,
2388
- AcqArtifactListResponse: AcqArtifactListResponseSchema,
2389
-
2390
- // List members
2391
- ListMembersQuery: ListMembersQuerySchema,
2392
- MemberIdParams: MemberIdParamsSchema,
2393
- AcqListMemberResponse: AcqListMemberResponseSchema,
2394
- AcqListMembersResponse: AcqListMembersResponseSchema,
2395
-
2396
- // List companies
2397
- ListCompanyIdParams: ListCompanyIdParamsSchema,
2398
- AcqListCompanyResponse: AcqListCompanyResponseSchema,
2399
-
2400
- // Transition (shared with deals — TransitionItemRequestSchema)
2401
- TransitionItemRequest: TransitionItemRequestSchema
2392
+ export const AcqSubstrateSchemas = {
2393
+ // Artifacts
2394
+ ListArtifactsQuery: ListArtifactsQuerySchema,
2395
+ CreateArtifactRequest: CreateArtifactRequestSchema,
2396
+ AcqArtifactResponse: AcqArtifactResponseSchema,
2397
+ AcqArtifactListResponse: AcqArtifactListResponseSchema,
2398
+
2399
+ // List members
2400
+ ListMembersQuery: ListMembersQuerySchema,
2401
+ MemberIdParams: MemberIdParamsSchema,
2402
+ AcqListMemberResponse: AcqListMemberResponseSchema,
2403
+ AcqListMembersResponse: AcqListMembersResponseSchema,
2404
+
2405
+ // List companies
2406
+ ListCompanyIdParams: ListCompanyIdParamsSchema,
2407
+ AcqListCompanyResponse: AcqListCompanyResponseSchema,
2408
+
2409
+ // Transition (shared with deals — TransitionItemRequestSchema)
2410
+ TransitionItemRequest: TransitionItemRequestSchema
2402
2411
  }
2403
2412
  ```
2404
2413
 
@@ -2449,134 +2458,134 @@ export const StatefulSchema = z.object({
2449
2458
  ### `StatefulStateDefinition`
2450
2459
 
2451
2460
  ```typescript
2452
- /** One state within a stage — minimal shape: key + display label. */
2453
- export interface StatefulStateDefinition {
2454
- /** Matches state_key values written by workflow steps. */
2455
- stateKey: string
2456
- label: string
2461
+ /** One state within a stage — minimal shape: key + display label. */
2462
+ export interface StatefulStateDefinition {
2463
+ /** Matches state_key values written by workflow steps. */
2464
+ stateKey: string
2465
+ label: string
2457
2466
  }
2458
2467
  ```
2459
2468
 
2460
2469
  ### `StatefulStageDefinition`
2461
2470
 
2462
2471
  ```typescript
2463
- /** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
2464
- export interface StatefulStageDefinition {
2465
- /** Matches stage_key values written by workflow steps. */
2466
- stageKey: string
2467
- label: string
2468
- states: StatefulStateDefinition[]
2472
+ /** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
2473
+ export interface StatefulStageDefinition {
2474
+ /** Matches stage_key values written by workflow steps. */
2475
+ stageKey: string
2476
+ label: string
2477
+ states: StatefulStateDefinition[]
2469
2478
  }
2470
2479
  ```
2471
2480
 
2472
2481
  ### `StatefulPipelineDefinition`
2473
2482
 
2474
2483
  ```typescript
2475
- /**
2476
- * Pipeline definition for a single entity participating in the Stateful trait.
2477
- * Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
2478
- */
2479
- export interface StatefulPipelineDefinition {
2480
- /** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
2481
- pipelineKey: string
2482
- label: string
2483
- /** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
2484
- entityKey: string
2485
- stages: StatefulStageDefinition[]
2484
+ /**
2485
+ * Pipeline definition for a single entity participating in the Stateful trait.
2486
+ * Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
2487
+ */
2488
+ export interface StatefulPipelineDefinition {
2489
+ /** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
2490
+ pipelineKey: string
2491
+ label: string
2492
+ /** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
2493
+ entityKey: string
2494
+ stages: StatefulStageDefinition[]
2486
2495
  }
2487
2496
  ```
2488
2497
 
2489
2498
  ### `ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE`
2490
2499
 
2491
2500
  ```typescript
2492
- /**
2493
- * Lead-gen pipeline definition for acq_list_members (contacts).
2494
- * Three stages matching the post-restructure sales subdomain tree.
2495
- *
2496
- * Note: members visit outreach and prospecting states depending on which
2497
- * workflow last processed them. stage_key is set per-transition by the workflow.
2498
- */
2499
- export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2500
- pipelineKey: 'lead-gen',
2501
- label: 'Lead Generation',
2502
- entityKey: 'acq.list-member',
2503
- stages: [
2504
- {
2505
- stageKey: 'outreach',
2506
- label: 'Outreach',
2507
- states: [
2508
- PENDING_STATE,
2509
- { stateKey: 'personalized', label: 'Personalized' },
2510
- { stateKey: 'uploaded', label: 'Uploaded' },
2511
- { stateKey: 'interested', label: 'Interested' }
2512
- ]
2513
- },
2514
- {
2515
- stageKey: 'prospecting',
2516
- label: 'Prospecting',
2517
- states: [
2518
- PENDING_STATE,
2519
- { stateKey: 'discovered', label: 'Discovered' },
2520
- { stateKey: 'verified', label: 'Verified' }
2521
- ]
2522
- },
2523
- {
2524
- stageKey: 'qualification',
2525
- label: 'Qualification',
2526
- states: [PENDING_STATE]
2527
- }
2528
- ]
2501
+ /**
2502
+ * Lead-gen pipeline definition for acq_list_members (contacts).
2503
+ * Three stages matching the post-restructure sales subdomain tree.
2504
+ *
2505
+ * Note: members visit outreach and prospecting states depending on which
2506
+ * workflow last processed them. stage_key is set per-transition by the workflow.
2507
+ */
2508
+ export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2509
+ pipelineKey: 'lead-gen',
2510
+ label: 'Lead Generation',
2511
+ entityKey: 'acq.list-member',
2512
+ stages: [
2513
+ {
2514
+ stageKey: 'outreach',
2515
+ label: 'Outreach',
2516
+ states: [
2517
+ PENDING_STATE,
2518
+ { stateKey: 'personalized', label: 'Personalized' },
2519
+ { stateKey: 'uploaded', label: 'Uploaded' },
2520
+ { stateKey: 'interested', label: 'Interested' }
2521
+ ]
2522
+ },
2523
+ {
2524
+ stageKey: 'prospecting',
2525
+ label: 'Prospecting',
2526
+ states: [
2527
+ PENDING_STATE,
2528
+ { stateKey: 'discovered', label: 'Discovered' },
2529
+ { stateKey: 'verified', label: 'Verified' }
2530
+ ]
2531
+ },
2532
+ {
2533
+ stageKey: 'qualification',
2534
+ label: 'Qualification',
2535
+ states: [PENDING_STATE]
2536
+ }
2537
+ ]
2529
2538
  }
2530
2539
  ```
2531
2540
 
2532
2541
  ### `ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE`
2533
2542
 
2534
2543
  ```typescript
2535
- /**
2536
- * Lead-gen pipeline definition for acq_list_companies.
2537
- * Three stages matching the post-restructure sales subdomain tree.
2538
- *
2539
- * Note: companies visit prospecting and qualification states depending on which
2540
- * workflow last processed them. stage_key is set per-transition by the workflow.
2541
- */
2542
- export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2543
- pipelineKey: 'lead-gen',
2544
- label: 'Lead Generation',
2545
- entityKey: 'acq.list-company',
2546
- stages: [
2547
- {
2548
- stageKey: 'outreach',
2549
- label: 'Outreach',
2550
- states: [PENDING_STATE]
2551
- },
2552
- {
2553
- stageKey: 'prospecting',
2554
- label: 'Prospecting',
2555
- states: [
2556
- PENDING_STATE,
2557
- { stateKey: 'populated', label: 'Populated' },
2558
- { stateKey: 'extracted', label: 'Extracted' }
2559
- ]
2560
- },
2561
- {
2562
- stageKey: 'qualification',
2563
- label: 'Qualification',
2564
- states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
2565
- }
2566
- ]
2544
+ /**
2545
+ * Lead-gen pipeline definition for acq_list_companies.
2546
+ * Three stages matching the post-restructure sales subdomain tree.
2547
+ *
2548
+ * Note: companies visit prospecting and qualification states depending on which
2549
+ * workflow last processed them. stage_key is set per-transition by the workflow.
2550
+ */
2551
+ export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2552
+ pipelineKey: 'lead-gen',
2553
+ label: 'Lead Generation',
2554
+ entityKey: 'acq.list-company',
2555
+ stages: [
2556
+ {
2557
+ stageKey: 'outreach',
2558
+ label: 'Outreach',
2559
+ states: [PENDING_STATE]
2560
+ },
2561
+ {
2562
+ stageKey: 'prospecting',
2563
+ label: 'Prospecting',
2564
+ states: [
2565
+ PENDING_STATE,
2566
+ { stateKey: 'populated', label: 'Populated' },
2567
+ { stateKey: 'extracted', label: 'Extracted' }
2568
+ ]
2569
+ },
2570
+ {
2571
+ stageKey: 'qualification',
2572
+ label: 'Qualification',
2573
+ states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
2574
+ }
2575
+ ]
2567
2576
  }
2568
2577
  ```
2569
2578
 
2570
2579
  ### `LEAD_GEN_PIPELINE_DEFINITIONS`
2571
2580
 
2572
2581
  ```typescript
2573
- /**
2574
- * All lead-gen pipeline definitions indexed by entity key.
2575
- * Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
2576
- */
2577
- export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
2578
- 'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
2579
- 'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
2582
+ /**
2583
+ * All lead-gen pipeline definitions indexed by entity key.
2584
+ * Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
2585
+ */
2586
+ export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
2587
+ 'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
2588
+ 'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
2580
2589
  }
2581
2590
  ```
2582
2591
 
@@ -2835,24 +2844,26 @@ export interface UpdateListConfigParams {
2835
2844
  ### `UpdateCompanyStageParams`
2836
2845
 
2837
2846
  ```typescript
2838
- export interface UpdateCompanyStageParams {
2839
- organizationId: string
2840
- listId: string
2841
- companyId: string
2842
- stage: string
2843
- executionId?: string
2847
+ export interface UpdateCompanyStageParams {
2848
+ organizationId: string
2849
+ listId: string
2850
+ companyId: string
2851
+ stage: string
2852
+ status?: ProcessingStageStatus
2853
+ executionId?: string
2844
2854
  }
2845
2855
  ```
2846
2856
 
2847
2857
  ### `UpdateContactStageParams`
2848
2858
 
2849
2859
  ```typescript
2850
- export interface UpdateContactStageParams {
2851
- organizationId: string
2852
- listId: string
2853
- contactId: string
2854
- stage: string
2855
- executionId?: string
2860
+ export interface UpdateContactStageParams {
2861
+ organizationId: string
2862
+ listId: string
2863
+ contactId: string
2864
+ stage: string
2865
+ status?: ProcessingStageStatus
2866
+ executionId?: string
2856
2867
  }
2857
2868
  ```
2858
2869
 
@@ -2976,157 +2987,158 @@ export interface BulkImportCompaniesResult {
2976
2987
  ### `LeadToolMap`
2977
2988
 
2978
2989
  ```typescript
2979
- export type LeadToolMap = {
2980
- // List operations
2981
- listLists: { params: Record<string, never>; result: AcqList[] }
2982
- createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
2983
- updateList: { params: { id: string } & UpdateListParams; result: AcqList }
2984
- deleteList: { params: { id: string }; result: void }
2985
- addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
2986
- updateCompanyStage: {
2987
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
2988
- result: void
2989
- }
2990
- updateContactStage: {
2991
- params: Omit<UpdateContactStageParams, 'organizationId'>
2992
- result: void
2993
- }
2994
- // Company operations
2995
- createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
2996
- upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
2997
- updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
2998
- getCompany: { params: { id: string }; result: AcqCompany | null }
2999
- listCompanies: { params: CompanyFilters; result: AcqCompany[] }
3000
- deleteCompany: { params: { id: string }; result: void }
3001
- // Contact operations
3002
- createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
3003
- upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
3004
- updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
3005
- getContact: { params: { id: string }; result: AcqContact | null }
3006
- getContactByEmail: { params: { email: string }; result: AcqContact | null }
3007
- listContacts: {
3008
- params: ContactFilters & { limit?: number; offset?: number }
3009
- result: PaginatedResult<AcqContact>
3010
- }
3011
- deleteContact: { params: { id: string }; result: void }
3012
- bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
3013
- bulkImportCompanies: {
3014
- params: Omit<BulkImportCompaniesParams, 'organizationId'>
3015
- result: BulkImportCompaniesResult
3016
- }
3017
- deactivateContactsByCompany: {
3018
- params: { companyId: string }
3019
- result: { deactivated: number }
3020
- }
3021
- // Deal operations
3022
- upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
3023
- getDealByEmail: { params: { email: string }; result: AcqDeal | null }
3024
- getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
3025
- updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
3026
- getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
3027
- getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
3028
- getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
3029
- // Deal-sync operations
3030
- updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
3031
- updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
3032
- markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
3033
- markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3034
- updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3035
- updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3036
- transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3037
- setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3038
- cancelSchedulesAndHitlByEmail: {
3039
- params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
3040
- result: { schedulesCancelled: number; hitlDeleted: number }
3041
- }
3042
- cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
3043
- clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
3044
- deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
3045
- recordDealActivity: {
3046
- params: Omit<RecordDealActivityParams, 'organizationId'>
3047
- result: void
3048
- }
3049
- // Deal note operations
3050
- createDealNote: {
3051
- params: Omit<CreateDealNoteParams, 'organizationId'>
3052
- result: AcqDealNote
3053
- }
3054
- listDealNotes: {
3055
- params: Omit<ListDealNotesParams, 'organizationId'>
3056
- result: AcqDealNote[]
3057
- }
3058
- // Deal task operations
3059
- createDealTask: {
3060
- params: Omit<CreateDealTaskParams, 'organizationId'>
3061
- result: AcqDealTask
3062
- }
3063
- listDealTasks: {
3064
- params: Omit<ListDealTasksParams, 'organizationId'>
3065
- result: AcqDealTask[]
3066
- }
3067
- listDealTasksDue: {
3068
- params: Omit<ListDealTasksDueParams, 'organizationId'>
3069
- result: AcqDealTask[]
3070
- }
3071
- completeDealTask: {
3072
- params: Omit<CompleteDealTaskParams, 'organizationId'>
3073
- result: AcqDealTask
3074
- }
3075
- // Deal query & analytics operations
3076
- listDeals: { params: DealFilters; result: AcqDeal[] }
3077
- getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
3078
- // Enrichment data operations
3079
- mergeEnrichmentData: {
3080
- params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
3081
- result: void
3082
- }
3083
- // Social monitoring operations
3084
- upsertSocialPosts: {
3085
- params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
3086
- result: UpsertSocialPostsResult
3087
- }
3088
- setDealStateKey: {
3089
- params: {
3090
- dealId: string
3091
- stateKey: string
3092
- }
3093
- result: { ok: true }
3094
- }
3095
- // CRM workflow helpers
3096
- transitionDeal: {
3097
- params: {
3098
- dealId: string
3099
- toStage: string
3100
- toState?: string
3101
- }
3102
- result: { deal: AcqDeal }
3103
- }
3104
- loadDeal: {
3105
- params: { dealId: string }
3106
- result: DealDetail | null
3107
- }
2990
+ export type LeadToolMap = {
2991
+ // List operations
2992
+ listLists: { params: Record<string, never>; result: AcqList[] }
2993
+ createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
2994
+ updateList: { params: { id: string } & UpdateListParams; result: AcqList }
2995
+ deleteList: { params: { id: string }; result: void }
2996
+ addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
2997
+ addCompaniesToList: { params: Omit<AddCompaniesToListParams, 'organizationId'>; result: AddCompaniesToListResult }
2998
+ updateCompanyStage: {
2999
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
3000
+ result: void
3001
+ }
3002
+ updateContactStage: {
3003
+ params: Omit<UpdateContactStageParams, 'organizationId'>
3004
+ result: void
3005
+ }
3006
+ // Company operations
3007
+ createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
3008
+ upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
3009
+ updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
3010
+ getCompany: { params: { id: string }; result: AcqCompany | null }
3011
+ listCompanies: { params: CompanyFilters; result: AcqCompany[] }
3012
+ deleteCompany: { params: { id: string }; result: void }
3013
+ // Contact operations
3014
+ createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
3015
+ upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
3016
+ updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
3017
+ getContact: { params: { id: string }; result: AcqContact | null }
3018
+ getContactByEmail: { params: { email: string }; result: AcqContact | null }
3019
+ listContacts: {
3020
+ params: ContactFilters & { limit?: number; offset?: number }
3021
+ result: PaginatedResult<AcqContact>
3022
+ }
3023
+ deleteContact: { params: { id: string }; result: void }
3024
+ bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
3025
+ bulkImportCompanies: {
3026
+ params: Omit<BulkImportCompaniesParams, 'organizationId'>
3027
+ result: BulkImportCompaniesResult
3028
+ }
3029
+ deactivateContactsByCompany: {
3030
+ params: { companyId: string }
3031
+ result: { deactivated: number }
3032
+ }
3033
+ // Deal operations
3034
+ upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
3035
+ getDealByEmail: { params: { email: string }; result: AcqDeal | null }
3036
+ getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
3037
+ updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
3038
+ getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
3039
+ getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
3040
+ getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
3041
+ // Deal-sync operations
3042
+ updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
3043
+ updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
3044
+ markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
3045
+ markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3046
+ updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3047
+ updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3048
+ transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3049
+ setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3050
+ cancelSchedulesAndHitlByEmail: {
3051
+ params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
3052
+ result: { schedulesCancelled: number; hitlDeleted: number }
3053
+ }
3054
+ cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
3055
+ clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
3056
+ deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
3057
+ recordDealActivity: {
3058
+ params: Omit<RecordDealActivityParams, 'organizationId'>
3059
+ result: void
3060
+ }
3061
+ // Deal note operations
3062
+ createDealNote: {
3063
+ params: Omit<CreateDealNoteParams, 'organizationId'>
3064
+ result: AcqDealNote
3065
+ }
3066
+ listDealNotes: {
3067
+ params: Omit<ListDealNotesParams, 'organizationId'>
3068
+ result: AcqDealNote[]
3069
+ }
3070
+ // Deal task operations
3071
+ createDealTask: {
3072
+ params: Omit<CreateDealTaskParams, 'organizationId'>
3073
+ result: AcqDealTask
3074
+ }
3075
+ listDealTasks: {
3076
+ params: Omit<ListDealTasksParams, 'organizationId'>
3077
+ result: AcqDealTask[]
3078
+ }
3079
+ listDealTasksDue: {
3080
+ params: Omit<ListDealTasksDueParams, 'organizationId'>
3081
+ result: AcqDealTask[]
3082
+ }
3083
+ completeDealTask: {
3084
+ params: Omit<CompleteDealTaskParams, 'organizationId'>
3085
+ result: AcqDealTask
3086
+ }
3087
+ // Deal query & analytics operations
3088
+ listDeals: { params: DealFilters; result: AcqDeal[] }
3089
+ getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
3090
+ // Enrichment data operations
3091
+ mergeEnrichmentData: {
3092
+ params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
3093
+ result: void
3094
+ }
3095
+ // Social monitoring operations
3096
+ upsertSocialPosts: {
3097
+ params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
3098
+ result: UpsertSocialPostsResult
3099
+ }
3100
+ setDealStateKey: {
3101
+ params: {
3102
+ dealId: string
3103
+ stateKey: string
3104
+ }
3105
+ result: { ok: true }
3106
+ }
3107
+ // CRM workflow helpers
3108
+ transitionDeal: {
3109
+ params: {
3110
+ dealId: string
3111
+ toStage: string
3112
+ toState?: string
3113
+ }
3114
+ result: { deal: AcqDeal }
3115
+ }
3116
+ loadDeal: {
3117
+ params: { dealId: string }
3118
+ result: DealDetail | null
3119
+ }
3108
3120
  }
3109
3121
  ```
3110
3122
 
3111
3123
  ### `ListToolMap`
3112
3124
 
3113
3125
  ```typescript
3114
- export type ListToolMap = {
3115
- getConfig: {
3116
- params: { listId: string }
3117
- result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
3118
- }
3119
- recordExecution: {
3120
- params: Omit<RecordListExecutionParams, 'organizationId'>
3121
- result: void
3122
- }
3123
- updateCompanyStage: {
3124
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
3125
- result: void
3126
- }
3127
- updateContactStage: {
3128
- params: Omit<UpdateContactStageParams, 'organizationId'>
3129
- result: void
3130
- }
3126
+ export type ListToolMap = {
3127
+ getConfig: {
3128
+ params: { listId: string }
3129
+ result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
3130
+ }
3131
+ recordExecution: {
3132
+ params: Omit<RecordListExecutionParams, 'organizationId'>
3133
+ result: void
3134
+ }
3135
+ updateCompanyStage: {
3136
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
3137
+ result: void
3138
+ }
3139
+ updateContactStage: {
3140
+ params: Omit<UpdateContactStageParams, 'organizationId'>
3141
+ result: void
3142
+ }
3131
3143
  }
3132
3144
  ```