@elevasis/core 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +530 -529
- package/src/business/acquisition/api-schemas.ts +167 -72
- package/src/business/projects/types.ts +1 -1
- package/src/commands/queue/types/task.ts +15 -10
- package/src/execution/core/sse-executions.ts +7 -3
- package/src/execution/engine/tools/integration/server/adapters/google-sheets/__tests__/google-sheets.integration.test.ts +261 -261
- package/src/execution/engine/tools/lead-service-types.ts +6 -5
- package/src/execution/engine/tools/tool-maps.ts +14 -6
- package/src/platform/constants/versions.ts +1 -1
- package/src/platform/registry/stats-types.ts +8 -6
- package/src/projects/api-schemas.test.ts +39 -0
- package/src/projects/api-schemas.ts +1 -1
- package/src/reference/_generated/contracts.md +2 -1
|
@@ -38,14 +38,21 @@ export const DealTaskIdParamsSchema = z.object({
|
|
|
38
38
|
// Query schemas (coerce strings from query params)
|
|
39
39
|
// ---------------------------------------------------------------------------
|
|
40
40
|
|
|
41
|
-
export const ListDealsQuerySchema = z
|
|
42
|
-
.object({
|
|
43
|
-
stage: DealStageSchema.optional(),
|
|
44
|
-
search: z.string().optional(),
|
|
45
|
-
limit: z.coerce.number().int().positive().default(50),
|
|
46
|
-
offset: z.coerce.number().int().min(0).default(0)
|
|
47
|
-
})
|
|
48
|
-
.strict()
|
|
41
|
+
export const ListDealsQuerySchema = z
|
|
42
|
+
.object({
|
|
43
|
+
stage: DealStageSchema.optional(),
|
|
44
|
+
search: z.string().optional(),
|
|
45
|
+
limit: z.coerce.number().int().positive().default(50),
|
|
46
|
+
offset: z.coerce.number().int().min(0).default(0)
|
|
47
|
+
})
|
|
48
|
+
.strict()
|
|
49
|
+
|
|
50
|
+
export const DealLookupQuerySchema = z
|
|
51
|
+
.object({
|
|
52
|
+
search: z.string().trim().min(1).max(200).optional(),
|
|
53
|
+
limit: z.coerce.number().int().min(1).max(25).default(10)
|
|
54
|
+
})
|
|
55
|
+
.strict()
|
|
49
56
|
|
|
50
57
|
export const ListDealTasksDueQuerySchema = z
|
|
51
58
|
.object({
|
|
@@ -116,7 +123,7 @@ export const DealContactSummarySchema = z.object({
|
|
|
116
123
|
* Deal list item with joined contact (and company via contact).
|
|
117
124
|
* Matches DealListItem from @repo/core types.
|
|
118
125
|
*/
|
|
119
|
-
export const DealListItemSchema = z.object({
|
|
126
|
+
export const DealListItemSchema = z.object({
|
|
120
127
|
// acq_deals columns
|
|
121
128
|
id: z.string(),
|
|
122
129
|
organization_id: z.string(),
|
|
@@ -141,10 +148,54 @@ export const DealListItemSchema = z.object({
|
|
|
141
148
|
created_at: z.string(),
|
|
142
149
|
updated_at: z.string(),
|
|
143
150
|
// joined relation
|
|
144
|
-
contact: DealContactSummarySchema.nullable()
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
export const DealListResponseSchema = z.
|
|
151
|
+
contact: DealContactSummarySchema.nullable()
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
export const DealListResponseSchema = z.object({
|
|
155
|
+
data: z.array(DealListItemSchema),
|
|
156
|
+
total: z.number().int(),
|
|
157
|
+
limit: z.number().int(),
|
|
158
|
+
offset: z.number().int()
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
export const DealStageSummarySchema = z.object({
|
|
162
|
+
stage: z.string(),
|
|
163
|
+
count: z.number().int(),
|
|
164
|
+
oldestUpdatedAt: z.string().nullable(),
|
|
165
|
+
newestUpdatedAt: z.string().nullable()
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
export const StaleDealSummarySchema = z.object({
|
|
169
|
+
id: z.string(),
|
|
170
|
+
contactEmail: z.string(),
|
|
171
|
+
cachedStage: z.string(),
|
|
172
|
+
updatedAt: z.string(),
|
|
173
|
+
daysStale: z.number().int()
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
export const DealSummaryResponseSchema = z.object({
|
|
177
|
+
totalDeals: z.number().int(),
|
|
178
|
+
openDeals: z.number().int(),
|
|
179
|
+
wonDeals: z.number().int(),
|
|
180
|
+
lostDeals: z.number().int(),
|
|
181
|
+
winRate: z.number(),
|
|
182
|
+
avgDealSize: z.number(),
|
|
183
|
+
totalPipelineValue: z.number(),
|
|
184
|
+
stageSummary: z.array(DealStageSummarySchema),
|
|
185
|
+
staleDeals: z.array(StaleDealSummarySchema)
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
export const DealLookupItemSchema = z.object({
|
|
189
|
+
id: z.string(),
|
|
190
|
+
contactEmail: z.string(),
|
|
191
|
+
cachedStage: z.string().nullable(),
|
|
192
|
+
updatedAt: z.string(),
|
|
193
|
+
contactName: z.string().nullable(),
|
|
194
|
+
companyName: z.string().nullable(),
|
|
195
|
+
displayLabel: z.string()
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
export const DealLookupResponseSchema = z.array(DealLookupItemSchema)
|
|
148
199
|
|
|
149
200
|
/**
|
|
150
201
|
* Deal detail shape — currently the same as a list item (full joined record).
|
|
@@ -199,8 +250,9 @@ export const DealSchemas = {
|
|
|
199
250
|
DealTaskIdParams: DealTaskIdParamsSchema,
|
|
200
251
|
|
|
201
252
|
// Queries
|
|
202
|
-
ListDealsQuery: ListDealsQuerySchema,
|
|
203
|
-
|
|
253
|
+
ListDealsQuery: ListDealsQuerySchema,
|
|
254
|
+
DealLookupQuery: DealLookupQuerySchema,
|
|
255
|
+
ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
|
|
204
256
|
|
|
205
257
|
// Request bodies
|
|
206
258
|
CreateDealNoteRequest: CreateDealNoteRequestSchema,
|
|
@@ -208,8 +260,10 @@ export const DealSchemas = {
|
|
|
208
260
|
SyncDealStageRequest: SyncDealStageRequestSchema,
|
|
209
261
|
|
|
210
262
|
// Responses
|
|
211
|
-
DealListResponse: DealListResponseSchema,
|
|
212
|
-
|
|
263
|
+
DealListResponse: DealListResponseSchema,
|
|
264
|
+
DealSummaryResponse: DealSummaryResponseSchema,
|
|
265
|
+
DealLookupResponse: DealLookupResponseSchema,
|
|
266
|
+
DealDetailResponse: DealDetailResponseSchema,
|
|
213
267
|
DealNoteResponse: DealNoteResponseSchema,
|
|
214
268
|
DealNoteListResponse: DealNoteListResponseSchema,
|
|
215
269
|
DealTaskResponse: DealTaskResponseSchema,
|
|
@@ -224,13 +278,17 @@ export type DealStage = z.infer<typeof DealStageSchema>
|
|
|
224
278
|
export type AcqDealTaskKind = z.infer<typeof AcqDealTaskKindSchema>
|
|
225
279
|
export type DealIdParams = z.infer<typeof DealIdParamsSchema>
|
|
226
280
|
export type DealTaskIdParams = z.infer<typeof DealTaskIdParamsSchema>
|
|
227
|
-
export type ListDealsQuery = z.infer<typeof ListDealsQuerySchema>
|
|
228
|
-
export type
|
|
281
|
+
export type ListDealsQuery = z.infer<typeof ListDealsQuerySchema>
|
|
282
|
+
export type DealLookupQuery = z.infer<typeof DealLookupQuerySchema>
|
|
283
|
+
export type ListDealTasksDueQuery = z.infer<typeof ListDealTasksDueQuerySchema>
|
|
229
284
|
export type CreateDealNoteRequest = z.infer<typeof CreateDealNoteRequestSchema>
|
|
230
285
|
export type CreateDealTaskRequest = z.infer<typeof CreateDealTaskRequestSchema>
|
|
231
286
|
export type SyncDealStageRequest = z.infer<typeof SyncDealStageRequestSchema>
|
|
232
|
-
export type DealListResponse = z.infer<typeof DealListResponseSchema>
|
|
233
|
-
export type
|
|
287
|
+
export type DealListResponse = z.infer<typeof DealListResponseSchema>
|
|
288
|
+
export type DealSummaryResponse = z.infer<typeof DealSummaryResponseSchema>
|
|
289
|
+
export type DealLookupItem = z.infer<typeof DealLookupItemSchema>
|
|
290
|
+
export type DealLookupResponse = z.infer<typeof DealLookupResponseSchema>
|
|
291
|
+
export type DealDetailResponse = z.infer<typeof DealDetailResponseSchema>
|
|
234
292
|
export type DealNoteResponse = z.infer<typeof DealNoteResponseSchema>
|
|
235
293
|
export type DealNoteListResponse = z.infer<typeof DealNoteListResponseSchema>
|
|
236
294
|
export type DealTaskResponse = z.infer<typeof DealTaskResponseSchema>
|
|
@@ -360,16 +418,24 @@ export const CreateListRequestSchema = z
|
|
|
360
418
|
})
|
|
361
419
|
.strict()
|
|
362
420
|
|
|
363
|
-
export const UpdateListRequestSchema = z
|
|
364
|
-
.object({
|
|
365
|
-
name: z.string().trim().min(1).max(255).optional(),
|
|
366
|
-
description: z.string().trim().nullable().optional(),
|
|
367
|
-
status: z.string().optional()
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
.
|
|
371
|
-
|
|
372
|
-
|
|
421
|
+
export const UpdateListRequestSchema = z
|
|
422
|
+
.object({
|
|
423
|
+
name: z.string().trim().min(1).max(255).optional(),
|
|
424
|
+
description: z.string().trim().nullable().optional(),
|
|
425
|
+
status: z.string().optional(),
|
|
426
|
+
batchIds: z.array(z.string()).optional()
|
|
427
|
+
})
|
|
428
|
+
.strict()
|
|
429
|
+
.refine(
|
|
430
|
+
(data) =>
|
|
431
|
+
data.name !== undefined ||
|
|
432
|
+
data.description !== undefined ||
|
|
433
|
+
data.status !== undefined ||
|
|
434
|
+
data.batchIds !== undefined,
|
|
435
|
+
{
|
|
436
|
+
message: 'At least one field (name, description, status, or batchIds) must be provided'
|
|
437
|
+
}
|
|
438
|
+
)
|
|
373
439
|
|
|
374
440
|
/**
|
|
375
441
|
* Partial patch for list.config — UI sends only the edited tab's subtree.
|
|
@@ -478,19 +544,21 @@ export const ContactIdParamsSchema = z.object({
|
|
|
478
544
|
contactId: UuidSchema
|
|
479
545
|
})
|
|
480
546
|
|
|
481
|
-
export const ListCompaniesQuerySchema = z
|
|
482
|
-
.object({
|
|
483
|
-
search: z.string().trim().min(1).max(200).optional(),
|
|
484
|
-
listId: UuidSchema.optional(),
|
|
485
|
-
domain: z.string().trim().min(1).max(255).optional(),
|
|
547
|
+
export const ListCompaniesQuerySchema = z
|
|
548
|
+
.object({
|
|
549
|
+
search: z.string().trim().min(1).max(200).optional(),
|
|
550
|
+
listId: UuidSchema.optional(),
|
|
551
|
+
domain: z.string().trim().min(1).max(255).optional(),
|
|
486
552
|
website: z.string().trim().min(1).max(2048).optional(),
|
|
487
553
|
segment: z.string().trim().min(1).max(255).optional(),
|
|
488
|
-
category: z.string().trim().min(1).max(255).optional(),
|
|
489
|
-
batchId: z.string().trim().min(1).max(255).optional(),
|
|
490
|
-
status: AcqCompanyStatusSchema.optional(),
|
|
491
|
-
includeAll: QueryBooleanSchema.optional()
|
|
492
|
-
|
|
493
|
-
|
|
554
|
+
category: z.string().trim().min(1).max(255).optional(),
|
|
555
|
+
batchId: z.string().trim().min(1).max(255).optional(),
|
|
556
|
+
status: AcqCompanyStatusSchema.optional(),
|
|
557
|
+
includeAll: QueryBooleanSchema.optional(),
|
|
558
|
+
limit: z.coerce.number().int().min(1).max(5000).default(50),
|
|
559
|
+
offset: z.coerce.number().int().min(0).default(0)
|
|
560
|
+
})
|
|
561
|
+
.strict()
|
|
494
562
|
|
|
495
563
|
export const ListContactsQuerySchema = z
|
|
496
564
|
.object({
|
|
@@ -613,10 +681,10 @@ export const UpdateContactRequestSchema = z
|
|
|
613
681
|
}
|
|
614
682
|
)
|
|
615
683
|
|
|
616
|
-
export const AcqCompanyResponseSchema = z.object({
|
|
617
|
-
id: z.string(),
|
|
618
|
-
organizationId: z.string(),
|
|
619
|
-
name: z.string(),
|
|
684
|
+
export const AcqCompanyResponseSchema = z.object({
|
|
685
|
+
id: z.string(),
|
|
686
|
+
organizationId: z.string(),
|
|
687
|
+
name: z.string(),
|
|
620
688
|
domain: z.string().nullable(),
|
|
621
689
|
linkedinUrl: z.string().nullable(),
|
|
622
690
|
website: z.string().nullable(),
|
|
@@ -630,18 +698,41 @@ export const AcqCompanyResponseSchema = z.object({
|
|
|
630
698
|
pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
|
|
631
699
|
enrichmentData: z.record(z.string(), z.unknown()).nullable(),
|
|
632
700
|
source: z.string().nullable(),
|
|
633
|
-
batchId: z.string().nullable(),
|
|
634
|
-
status: AcqCompanyStatusSchema,
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
701
|
+
batchId: z.string().nullable(),
|
|
702
|
+
status: AcqCompanyStatusSchema,
|
|
703
|
+
contactCount: z.number().int().min(0),
|
|
704
|
+
verticalResearch: z.string().nullable(),
|
|
705
|
+
createdAt: z.string(),
|
|
706
|
+
updatedAt: z.string()
|
|
707
|
+
})
|
|
708
|
+
|
|
709
|
+
export const AcqCompanyListResponseSchema = z.object({
|
|
710
|
+
data: z.array(AcqCompanyResponseSchema),
|
|
711
|
+
total: z.number().int(),
|
|
712
|
+
limit: z.number().int(),
|
|
713
|
+
offset: z.number().int()
|
|
714
|
+
})
|
|
715
|
+
|
|
716
|
+
export const AcqCompanyFacetsResponseSchema = z.object({
|
|
717
|
+
segments: z.array(z.string()),
|
|
718
|
+
categories: z.array(z.string()),
|
|
719
|
+
statuses: z.array(AcqCompanyStatusSchema)
|
|
720
|
+
})
|
|
721
|
+
|
|
722
|
+
export const AcqContactCompanySummarySchema = z.object({
|
|
723
|
+
id: z.string(),
|
|
724
|
+
name: z.string(),
|
|
725
|
+
domain: z.string().nullable(),
|
|
726
|
+
website: z.string().nullable(),
|
|
727
|
+
linkedinUrl: z.string().nullable(),
|
|
728
|
+
segment: z.string().nullable(),
|
|
729
|
+
category: z.string().nullable(),
|
|
730
|
+
status: AcqCompanyStatusSchema
|
|
731
|
+
})
|
|
732
|
+
|
|
733
|
+
export const AcqContactResponseSchema = z.object({
|
|
734
|
+
id: z.string(),
|
|
735
|
+
organizationId: z.string(),
|
|
645
736
|
companyId: z.string().nullable(),
|
|
646
737
|
email: z.string(),
|
|
647
738
|
emailValid: AcqEmailValidSchema.nullable(),
|
|
@@ -656,12 +747,13 @@ export const AcqContactResponseSchema = z.object({
|
|
|
656
747
|
sourceId: z.string().nullable(),
|
|
657
748
|
pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
|
|
658
749
|
enrichmentData: z.record(z.string(), z.unknown()).nullable(),
|
|
659
|
-
attioPersonId: z.string().nullable(),
|
|
660
|
-
batchId: z.string().nullable(),
|
|
661
|
-
status: AcqContactStatusSchema,
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
750
|
+
attioPersonId: z.string().nullable(),
|
|
751
|
+
batchId: z.string().nullable(),
|
|
752
|
+
status: AcqContactStatusSchema,
|
|
753
|
+
company: AcqContactCompanySummarySchema.nullable().optional(),
|
|
754
|
+
createdAt: z.string(),
|
|
755
|
+
updatedAt: z.string()
|
|
756
|
+
})
|
|
665
757
|
|
|
666
758
|
export const AcqContactListResponseSchema = z.object({
|
|
667
759
|
data: z.array(AcqContactResponseSchema),
|
|
@@ -674,10 +766,11 @@ export const AcqCompanySchemas = {
|
|
|
674
766
|
CompanyIdParams: CompanyIdParamsSchema,
|
|
675
767
|
ListCompaniesQuery: ListCompaniesQuerySchema,
|
|
676
768
|
CreateCompanyRequest: CreateCompanyRequestSchema,
|
|
677
|
-
UpdateCompanyRequest: UpdateCompanyRequestSchema,
|
|
678
|
-
AcqCompanyResponse: AcqCompanyResponseSchema,
|
|
679
|
-
AcqCompanyListResponse: AcqCompanyListResponseSchema
|
|
680
|
-
|
|
769
|
+
UpdateCompanyRequest: UpdateCompanyRequestSchema,
|
|
770
|
+
AcqCompanyResponse: AcqCompanyResponseSchema,
|
|
771
|
+
AcqCompanyListResponse: AcqCompanyListResponseSchema,
|
|
772
|
+
AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
|
|
773
|
+
}
|
|
681
774
|
|
|
682
775
|
export const AcqContactSchemas = {
|
|
683
776
|
ContactIdParams: ContactIdParamsSchema,
|
|
@@ -699,10 +792,12 @@ export type CreateCompanyRequest = z.infer<typeof CreateCompanyRequestSchema>
|
|
|
699
792
|
export type UpdateCompanyRequest = z.infer<typeof UpdateCompanyRequestSchema>
|
|
700
793
|
export type CreateContactRequest = z.infer<typeof CreateContactRequestSchema>
|
|
701
794
|
export type UpdateContactRequest = z.infer<typeof UpdateContactRequestSchema>
|
|
702
|
-
export type AcqCompanyResponse = z.infer<typeof AcqCompanyResponseSchema>
|
|
703
|
-
export type AcqCompanyListResponse = z.infer<typeof AcqCompanyListResponseSchema>
|
|
704
|
-
export type
|
|
705
|
-
export type
|
|
795
|
+
export type AcqCompanyResponse = z.infer<typeof AcqCompanyResponseSchema>
|
|
796
|
+
export type AcqCompanyListResponse = z.infer<typeof AcqCompanyListResponseSchema>
|
|
797
|
+
export type AcqCompanyFacetsResponse = z.infer<typeof AcqCompanyFacetsResponseSchema>
|
|
798
|
+
export type AcqContactCompanySummary = z.infer<typeof AcqContactCompanySummarySchema>
|
|
799
|
+
export type AcqContactResponse = z.infer<typeof AcqContactResponseSchema>
|
|
800
|
+
export type AcqContactListResponse = z.infer<typeof AcqContactListResponseSchema>
|
|
706
801
|
|
|
707
802
|
// ---------------------------------------------------------------------------
|
|
708
803
|
// Bundled export
|
|
@@ -36,7 +36,7 @@ export type TaskStatus =
|
|
|
36
36
|
|
|
37
37
|
export type TaskType = 'documentation' | 'code' | 'report' | 'design' | 'other'
|
|
38
38
|
|
|
39
|
-
export type NoteType = 'call_note' | 'status_update' | 'issue' | 'blocker'
|
|
39
|
+
export type NoteType = 'call_note' | 'status_update' | 'issue' | 'blocker' | 'agent_learning'
|
|
40
40
|
|
|
41
41
|
// Filter types
|
|
42
42
|
export interface ProjectFilters {
|
|
@@ -104,13 +104,18 @@ export interface PatchTaskParams {
|
|
|
104
104
|
/**
|
|
105
105
|
* Filters for listing tasks
|
|
106
106
|
*/
|
|
107
|
-
export interface ListTasksFilters {
|
|
108
|
-
organizationId: string
|
|
109
|
-
status?: QueueTaskStatus
|
|
110
|
-
humanCheckpoint?: string
|
|
111
|
-
timeRange?: TimeRange
|
|
112
|
-
priorityMin?: number
|
|
113
|
-
priorityMax?: number
|
|
114
|
-
limit?: number
|
|
115
|
-
offset?: number
|
|
116
|
-
}
|
|
107
|
+
export interface ListTasksFilters {
|
|
108
|
+
organizationId: string
|
|
109
|
+
status?: QueueTaskStatus
|
|
110
|
+
humanCheckpoint?: string
|
|
111
|
+
timeRange?: TimeRange
|
|
112
|
+
priorityMin?: number
|
|
113
|
+
priorityMax?: number
|
|
114
|
+
limit?: number
|
|
115
|
+
offset?: number
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface CommandQueueListResponse {
|
|
119
|
+
tasks: Task[]
|
|
120
|
+
total: number
|
|
121
|
+
}
|
|
@@ -104,9 +104,13 @@ export function isArchivedLogs(logs: unknown): logs is ArchivedLogsPointer {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
// API request/response types
|
|
107
|
-
export interface APIExecutionListResponse {
|
|
108
|
-
executions: APIExecutionSummary[]
|
|
109
|
-
|
|
107
|
+
export interface APIExecutionListResponse {
|
|
108
|
+
executions: APIExecutionSummary[]
|
|
109
|
+
total?: number
|
|
110
|
+
limit?: number
|
|
111
|
+
offset?: number
|
|
112
|
+
hasMore?: boolean
|
|
113
|
+
}
|
|
110
114
|
|
|
111
115
|
// Organization -> Resource -> Execution structure
|
|
112
116
|
export type ExecutionMap = Map<string, APIExecutionDetail>
|