@corsair-dev/hubspot 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.test.d.ts.map +1 -1
- package/dist/endpoints/contacts.d.ts +2 -1
- package/dist/endpoints/contacts.d.ts.map +1 -1
- package/dist/endpoints/index.d.ts +46 -3
- package/dist/endpoints/index.d.ts.map +1 -1
- package/dist/endpoints/types.d.ts +55 -5
- package/dist/endpoints/types.d.ts.map +1 -1
- package/dist/index.d.ts +59 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/api.test.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.test.d.ts","sourceRoot":"","sources":["../api.test.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"api.test.d.ts","sourceRoot":"","sources":["../api.test.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAwBvB,OAAO,eAAe,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { HubSpotEndpoints } from '../index';
|
|
2
2
|
export declare const get: HubSpotEndpoints['contactsGet'];
|
|
3
3
|
export declare const getMany: HubSpotEndpoints['contactsGetMany'];
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const create: HubSpotEndpoints['contactsCreate'];
|
|
5
|
+
export declare const update: HubSpotEndpoints['contactsUpdate'];
|
|
5
6
|
export declare const deleteContact: HubSpotEndpoints['contactsDelete'];
|
|
6
7
|
export declare const getRecentlyCreated: HubSpotEndpoints['contactsGetRecentlyCreated'];
|
|
7
8
|
export declare const getRecentlyUpdated: HubSpotEndpoints['contactsGetRecentlyUpdated'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../endpoints/contacts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../endpoints/contacts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQjD,eAAO,MAAM,GAAG,EAAE,gBAAgB,CAAC,aAAa,CA+B/C,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,CAoCvD,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,gBAAgB,CAAC,gBAAgB,CAwBrD,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,gBAAgB,CAAC,gBAAgB,CA2BrD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,gBAAgB,CAAC,gBAAgB,CAwB5D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,CAAC,4BAA4B,CAiB5E,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,CAAC,4BAA4B,CAiB5E,CAAC;AAEH,eAAO,MAAM,MAAM,EAAE,gBAAgB,CAAC,gBAAgB,CA6BrD,CAAC"}
|
|
@@ -29,6 +29,7 @@ export declare const ContactsEndpoints: {
|
|
|
29
29
|
archived?: boolean | undefined;
|
|
30
30
|
}) => Promise<{
|
|
31
31
|
[x: string]: unknown;
|
|
32
|
+
total?: number | undefined;
|
|
32
33
|
results?: {
|
|
33
34
|
[x: string]: unknown;
|
|
34
35
|
id: string;
|
|
@@ -52,7 +53,7 @@ export declare const ContactsEndpoints: {
|
|
|
52
53
|
} | undefined;
|
|
53
54
|
} | undefined;
|
|
54
55
|
}>;
|
|
55
|
-
|
|
56
|
+
create: (ctx: import("..").HubSpotContext, args: {
|
|
56
57
|
properties?: Record<string, string> | undefined;
|
|
57
58
|
associations?: {
|
|
58
59
|
to: {
|
|
@@ -77,6 +78,23 @@ export declare const ContactsEndpoints: {
|
|
|
77
78
|
}[];
|
|
78
79
|
}> | undefined;
|
|
79
80
|
}>;
|
|
81
|
+
update: (ctx: import("..").HubSpotContext, args: {
|
|
82
|
+
contactId: string;
|
|
83
|
+
properties?: Record<string, string> | undefined;
|
|
84
|
+
}) => Promise<{
|
|
85
|
+
[x: string]: unknown;
|
|
86
|
+
id: string;
|
|
87
|
+
properties?: Record<string, string> | undefined;
|
|
88
|
+
createdAt?: Date | null | undefined;
|
|
89
|
+
updatedAt?: Date | null | undefined;
|
|
90
|
+
archived?: boolean | undefined;
|
|
91
|
+
associations?: Record<string, string[] | {
|
|
92
|
+
results: {
|
|
93
|
+
id: string;
|
|
94
|
+
type?: string | undefined;
|
|
95
|
+
}[];
|
|
96
|
+
}> | undefined;
|
|
97
|
+
}>;
|
|
80
98
|
delete: (ctx: import("..").HubSpotContext, args: {
|
|
81
99
|
contactId: string;
|
|
82
100
|
}) => Promise<void>;
|
|
@@ -86,6 +104,7 @@ export declare const ContactsEndpoints: {
|
|
|
86
104
|
since?: string | undefined;
|
|
87
105
|
}) => Promise<{
|
|
88
106
|
[x: string]: unknown;
|
|
107
|
+
total?: number | undefined;
|
|
89
108
|
results?: {
|
|
90
109
|
[x: string]: unknown;
|
|
91
110
|
id: string;
|
|
@@ -115,6 +134,7 @@ export declare const ContactsEndpoints: {
|
|
|
115
134
|
since?: string | undefined;
|
|
116
135
|
}) => Promise<{
|
|
117
136
|
[x: string]: unknown;
|
|
137
|
+
total?: number | undefined;
|
|
118
138
|
results?: {
|
|
119
139
|
[x: string]: unknown;
|
|
120
140
|
id: string;
|
|
@@ -142,7 +162,10 @@ export declare const ContactsEndpoints: {
|
|
|
142
162
|
query?: string | undefined;
|
|
143
163
|
limit?: number | undefined;
|
|
144
164
|
after?: string | undefined;
|
|
145
|
-
sorts?:
|
|
165
|
+
sorts?: {
|
|
166
|
+
propertyName: string;
|
|
167
|
+
direction: "ASCENDING" | "DESCENDING";
|
|
168
|
+
}[] | undefined;
|
|
146
169
|
properties?: string[] | undefined;
|
|
147
170
|
filterGroups?: {
|
|
148
171
|
filters: {
|
|
@@ -155,6 +178,7 @@ export declare const ContactsEndpoints: {
|
|
|
155
178
|
}[] | undefined;
|
|
156
179
|
}) => Promise<{
|
|
157
180
|
[x: string]: unknown;
|
|
181
|
+
total?: number | undefined;
|
|
158
182
|
results?: {
|
|
159
183
|
[x: string]: unknown;
|
|
160
184
|
id: string;
|
|
@@ -210,6 +234,7 @@ export declare const CompaniesEndpoints: {
|
|
|
210
234
|
archived?: boolean | undefined;
|
|
211
235
|
}) => Promise<{
|
|
212
236
|
[x: string]: unknown;
|
|
237
|
+
total?: number | undefined;
|
|
213
238
|
results?: {
|
|
214
239
|
[x: string]: unknown;
|
|
215
240
|
id: string;
|
|
@@ -284,6 +309,7 @@ export declare const CompaniesEndpoints: {
|
|
|
284
309
|
since?: string | undefined;
|
|
285
310
|
}) => Promise<{
|
|
286
311
|
[x: string]: unknown;
|
|
312
|
+
total?: number | undefined;
|
|
287
313
|
results?: {
|
|
288
314
|
[x: string]: unknown;
|
|
289
315
|
id: string;
|
|
@@ -313,6 +339,7 @@ export declare const CompaniesEndpoints: {
|
|
|
313
339
|
since?: string | undefined;
|
|
314
340
|
}) => Promise<{
|
|
315
341
|
[x: string]: unknown;
|
|
342
|
+
total?: number | undefined;
|
|
316
343
|
results?: {
|
|
317
344
|
[x: string]: unknown;
|
|
318
345
|
id: string;
|
|
@@ -341,6 +368,7 @@ export declare const CompaniesEndpoints: {
|
|
|
341
368
|
properties?: string[] | undefined;
|
|
342
369
|
}) => Promise<{
|
|
343
370
|
[x: string]: unknown;
|
|
371
|
+
total?: number | undefined;
|
|
344
372
|
results?: {
|
|
345
373
|
[x: string]: unknown;
|
|
346
374
|
id: string;
|
|
@@ -355,6 +383,14 @@ export declare const CompaniesEndpoints: {
|
|
|
355
383
|
}[];
|
|
356
384
|
}> | undefined;
|
|
357
385
|
}[] | undefined;
|
|
386
|
+
paging?: {
|
|
387
|
+
next?: {
|
|
388
|
+
after: string;
|
|
389
|
+
} | undefined;
|
|
390
|
+
prev?: {
|
|
391
|
+
before: string;
|
|
392
|
+
} | undefined;
|
|
393
|
+
} | undefined;
|
|
358
394
|
}>;
|
|
359
395
|
};
|
|
360
396
|
export declare const DealsEndpoints: {
|
|
@@ -388,6 +424,7 @@ export declare const DealsEndpoints: {
|
|
|
388
424
|
archived?: boolean | undefined;
|
|
389
425
|
}) => Promise<{
|
|
390
426
|
[x: string]: unknown;
|
|
427
|
+
total?: number | undefined;
|
|
391
428
|
results?: {
|
|
392
429
|
[x: string]: unknown;
|
|
393
430
|
id: string;
|
|
@@ -462,6 +499,7 @@ export declare const DealsEndpoints: {
|
|
|
462
499
|
since?: string | undefined;
|
|
463
500
|
}) => Promise<{
|
|
464
501
|
[x: string]: unknown;
|
|
502
|
+
total?: number | undefined;
|
|
465
503
|
results?: {
|
|
466
504
|
[x: string]: unknown;
|
|
467
505
|
id: string;
|
|
@@ -491,6 +529,7 @@ export declare const DealsEndpoints: {
|
|
|
491
529
|
since?: string | undefined;
|
|
492
530
|
}) => Promise<{
|
|
493
531
|
[x: string]: unknown;
|
|
532
|
+
total?: number | undefined;
|
|
494
533
|
results?: {
|
|
495
534
|
[x: string]: unknown;
|
|
496
535
|
id: string;
|
|
@@ -518,7 +557,10 @@ export declare const DealsEndpoints: {
|
|
|
518
557
|
query?: string | undefined;
|
|
519
558
|
limit?: number | undefined;
|
|
520
559
|
after?: string | undefined;
|
|
521
|
-
sorts?:
|
|
560
|
+
sorts?: {
|
|
561
|
+
propertyName: string;
|
|
562
|
+
direction: "ASCENDING" | "DESCENDING";
|
|
563
|
+
}[] | undefined;
|
|
522
564
|
properties?: string[] | undefined;
|
|
523
565
|
filterGroups?: {
|
|
524
566
|
filters: {
|
|
@@ -531,6 +573,7 @@ export declare const DealsEndpoints: {
|
|
|
531
573
|
}[] | undefined;
|
|
532
574
|
}) => Promise<{
|
|
533
575
|
[x: string]: unknown;
|
|
576
|
+
total?: number | undefined;
|
|
534
577
|
results?: {
|
|
535
578
|
[x: string]: unknown;
|
|
536
579
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../endpoints/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../endpoints/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS7B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS9B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS1B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAM5B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKhC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;CAGjC,CAAC;AAEF,cAAc,SAAS,CAAC"}
|
|
@@ -16,7 +16,7 @@ export declare const HubSpotEndpointInputSchemas: {
|
|
|
16
16
|
associations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17
17
|
archived: z.ZodOptional<z.ZodBoolean>;
|
|
18
18
|
}, z.core.$strip>;
|
|
19
|
-
readonly
|
|
19
|
+
readonly contactsCreate: z.ZodObject<{
|
|
20
20
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
21
21
|
associations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
22
22
|
to: z.ZodObject<{
|
|
@@ -28,6 +28,10 @@ export declare const HubSpotEndpointInputSchemas: {
|
|
|
28
28
|
}, z.core.$strip>>;
|
|
29
29
|
}, z.core.$strip>>>;
|
|
30
30
|
}, z.core.$strip>;
|
|
31
|
+
readonly contactsUpdate: z.ZodObject<{
|
|
32
|
+
contactId: z.ZodString;
|
|
33
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
31
35
|
readonly contactsDelete: z.ZodObject<{
|
|
32
36
|
contactId: z.ZodString;
|
|
33
37
|
}, z.core.$strip>;
|
|
@@ -45,7 +49,13 @@ export declare const HubSpotEndpointInputSchemas: {
|
|
|
45
49
|
query: z.ZodOptional<z.ZodString>;
|
|
46
50
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
47
51
|
after: z.ZodOptional<z.ZodString>;
|
|
48
|
-
sorts: z.ZodOptional<z.ZodArray<z.
|
|
52
|
+
sorts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
53
|
+
propertyName: z.ZodString;
|
|
54
|
+
direction: z.ZodEnum<{
|
|
55
|
+
ASCENDING: "ASCENDING";
|
|
56
|
+
DESCENDING: "DESCENDING";
|
|
57
|
+
}>;
|
|
58
|
+
}, z.core.$strip>>>;
|
|
49
59
|
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
60
|
filterGroups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
51
61
|
filters: z.ZodArray<z.ZodObject<{
|
|
@@ -169,7 +179,13 @@ export declare const HubSpotEndpointInputSchemas: {
|
|
|
169
179
|
query: z.ZodOptional<z.ZodString>;
|
|
170
180
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
171
181
|
after: z.ZodOptional<z.ZodString>;
|
|
172
|
-
sorts: z.ZodOptional<z.ZodArray<z.
|
|
182
|
+
sorts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
183
|
+
propertyName: z.ZodString;
|
|
184
|
+
direction: z.ZodEnum<{
|
|
185
|
+
ASCENDING: "ASCENDING";
|
|
186
|
+
DESCENDING: "DESCENDING";
|
|
187
|
+
}>;
|
|
188
|
+
}, z.core.$strip>>>;
|
|
173
189
|
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
174
190
|
filterGroups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
175
191
|
filters: z.ZodArray<z.ZodObject<{
|
|
@@ -283,6 +299,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
283
299
|
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
284
300
|
}, z.core.$loose>;
|
|
285
301
|
readonly contactsGetMany: z.ZodObject<{
|
|
302
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
286
303
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
287
304
|
id: z.ZodString;
|
|
288
305
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -305,7 +322,20 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
305
322
|
}, z.core.$strip>>;
|
|
306
323
|
}, z.core.$strip>>;
|
|
307
324
|
}, z.core.$loose>;
|
|
308
|
-
readonly
|
|
325
|
+
readonly contactsCreate: z.ZodObject<{
|
|
326
|
+
id: z.ZodString;
|
|
327
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
328
|
+
createdAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
329
|
+
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
330
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
331
|
+
associations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
332
|
+
results: z.ZodArray<z.ZodObject<{
|
|
333
|
+
id: z.ZodString;
|
|
334
|
+
type: z.ZodOptional<z.ZodString>;
|
|
335
|
+
}, z.core.$strip>>;
|
|
336
|
+
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
337
|
+
}, z.core.$loose>;
|
|
338
|
+
readonly contactsUpdate: z.ZodObject<{
|
|
309
339
|
id: z.ZodString;
|
|
310
340
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
311
341
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
@@ -320,6 +350,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
320
350
|
}, z.core.$loose>;
|
|
321
351
|
readonly contactsDelete: z.ZodVoid;
|
|
322
352
|
readonly contactsGetRecentlyCreated: z.ZodObject<{
|
|
353
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
323
354
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
324
355
|
id: z.ZodString;
|
|
325
356
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -343,6 +374,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
343
374
|
}, z.core.$strip>>;
|
|
344
375
|
}, z.core.$loose>;
|
|
345
376
|
readonly contactsGetRecentlyUpdated: z.ZodObject<{
|
|
377
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
346
378
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
347
379
|
id: z.ZodString;
|
|
348
380
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -366,6 +398,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
366
398
|
}, z.core.$strip>>;
|
|
367
399
|
}, z.core.$loose>;
|
|
368
400
|
readonly contactsSearch: z.ZodObject<{
|
|
401
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
369
402
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
370
403
|
id: z.ZodString;
|
|
371
404
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -402,6 +435,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
402
435
|
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
403
436
|
}, z.core.$loose>;
|
|
404
437
|
readonly companiesGetMany: z.ZodObject<{
|
|
438
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
405
439
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
406
440
|
id: z.ZodString;
|
|
407
441
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -452,6 +486,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
452
486
|
}, z.core.$loose>;
|
|
453
487
|
readonly companiesDelete: z.ZodVoid;
|
|
454
488
|
readonly companiesGetRecentlyCreated: z.ZodObject<{
|
|
489
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
455
490
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
456
491
|
id: z.ZodString;
|
|
457
492
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -475,6 +510,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
475
510
|
}, z.core.$strip>>;
|
|
476
511
|
}, z.core.$loose>;
|
|
477
512
|
readonly companiesGetRecentlyUpdated: z.ZodObject<{
|
|
513
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
478
514
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
479
515
|
id: z.ZodString;
|
|
480
516
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -498,6 +534,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
498
534
|
}, z.core.$strip>>;
|
|
499
535
|
}, z.core.$loose>;
|
|
500
536
|
readonly companiesSearchByDomain: z.ZodObject<{
|
|
537
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
501
538
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
502
539
|
id: z.ZodString;
|
|
503
540
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -511,6 +548,14 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
511
548
|
}, z.core.$strip>>;
|
|
512
549
|
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
513
550
|
}, z.core.$loose>>>;
|
|
551
|
+
paging: z.ZodOptional<z.ZodObject<{
|
|
552
|
+
next: z.ZodOptional<z.ZodObject<{
|
|
553
|
+
after: z.ZodString;
|
|
554
|
+
}, z.core.$strip>>;
|
|
555
|
+
prev: z.ZodOptional<z.ZodObject<{
|
|
556
|
+
before: z.ZodString;
|
|
557
|
+
}, z.core.$strip>>;
|
|
558
|
+
}, z.core.$strip>>;
|
|
514
559
|
}, z.core.$loose>;
|
|
515
560
|
readonly dealsGet: z.ZodObject<{
|
|
516
561
|
id: z.ZodString;
|
|
@@ -526,6 +571,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
526
571
|
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
527
572
|
}, z.core.$loose>;
|
|
528
573
|
readonly dealsGetMany: z.ZodObject<{
|
|
574
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
529
575
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
530
576
|
id: z.ZodString;
|
|
531
577
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -576,6 +622,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
576
622
|
}, z.core.$loose>;
|
|
577
623
|
readonly dealsDelete: z.ZodVoid;
|
|
578
624
|
readonly dealsGetRecentlyCreated: z.ZodObject<{
|
|
625
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
579
626
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
580
627
|
id: z.ZodString;
|
|
581
628
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -599,6 +646,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
599
646
|
}, z.core.$strip>>;
|
|
600
647
|
}, z.core.$loose>;
|
|
601
648
|
readonly dealsGetRecentlyUpdated: z.ZodObject<{
|
|
649
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
602
650
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
603
651
|
id: z.ZodString;
|
|
604
652
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -622,6 +670,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
622
670
|
}, z.core.$strip>>;
|
|
623
671
|
}, z.core.$loose>;
|
|
624
672
|
readonly dealsSearch: z.ZodObject<{
|
|
673
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
625
674
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
626
675
|
id: z.ZodString;
|
|
627
676
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -802,7 +851,8 @@ export type HubSpotEndpointOutputs = {
|
|
|
802
851
|
};
|
|
803
852
|
export type GetContactResponse = z.infer<typeof HubSpotEndpointOutputSchemas.contactsGet>;
|
|
804
853
|
export type GetManyContactsResponse = z.infer<typeof HubSpotEndpointOutputSchemas.contactsGetMany>;
|
|
805
|
-
export type
|
|
854
|
+
export type CreateContactResponse = z.infer<typeof HubSpotEndpointOutputSchemas.contactsCreate>;
|
|
855
|
+
export type UpdateContactResponse = z.infer<typeof HubSpotEndpointOutputSchemas.contactsUpdate>;
|
|
806
856
|
export type GetCompanyResponse = z.infer<typeof HubSpotEndpointOutputSchemas.companiesGet>;
|
|
807
857
|
export type GetManyCompaniesResponse = z.infer<typeof HubSpotEndpointOutputSchemas.companiesGetMany>;
|
|
808
858
|
export type CreateCompanyResponse = z.infer<typeof HubSpotEndpointOutputSchemas.companiesCreate>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../endpoints/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../endpoints/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyUxB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC9B,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG;KAClC,CAAC,IAAI,MAAM,OAAO,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AO,4BAA4B,CAAC,aAAa,CACjD,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CACzC,OAAO,4BAA4B,CAAC,aAAa,CACjD,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CAAC,cAAc,CAClD,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,4BAA4B,CAAC,kBAAkB,CACtD,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,4BAA4B,CAAC,iBAAiB,CACrD,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,4BAA4B,CAAC,sBAAsB,CAC1D,CAAC;AACF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,4BAA4B,CAAC,yBAAyB,CAC7D,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ type HubSpotEndpoint<K extends keyof HubSpotEndpointOutputs> = CorsairEndpoint<H
|
|
|
10
10
|
export type HubSpotEndpoints = {
|
|
11
11
|
contactsGet: HubSpotEndpoint<'contactsGet'>;
|
|
12
12
|
contactsGetMany: HubSpotEndpoint<'contactsGetMany'>;
|
|
13
|
-
|
|
13
|
+
contactsCreate: HubSpotEndpoint<'contactsCreate'>;
|
|
14
|
+
contactsUpdate: HubSpotEndpoint<'contactsUpdate'>;
|
|
14
15
|
contactsDelete: HubSpotEndpoint<'contactsDelete'>;
|
|
15
16
|
contactsGetRecentlyCreated: HubSpotEndpoint<'contactsGetRecentlyCreated'>;
|
|
16
17
|
contactsGetRecentlyUpdated: HubSpotEndpoint<'contactsGetRecentlyUpdated'>;
|
|
@@ -64,7 +65,8 @@ declare const hubspotEndpointsNested: {
|
|
|
64
65
|
readonly contacts: {
|
|
65
66
|
readonly get: HubSpotEndpoint<"contactsGet">;
|
|
66
67
|
readonly getMany: HubSpotEndpoint<"contactsGetMany">;
|
|
67
|
-
readonly
|
|
68
|
+
readonly create: HubSpotEndpoint<"contactsCreate">;
|
|
69
|
+
readonly update: HubSpotEndpoint<"contactsUpdate">;
|
|
68
70
|
readonly delete: HubSpotEndpoint<"contactsDelete">;
|
|
69
71
|
readonly getRecentlyCreated: HubSpotEndpoint<"contactsGetRecentlyCreated">;
|
|
70
72
|
readonly getRecentlyUpdated: HubSpotEndpoint<"contactsGetRecentlyUpdated">;
|
|
@@ -142,6 +144,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
142
144
|
archived: z.ZodOptional<z.ZodBoolean>;
|
|
143
145
|
}, z.core.$strip>;
|
|
144
146
|
readonly output: z.ZodObject<{
|
|
147
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
145
148
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
146
149
|
id: z.ZodString;
|
|
147
150
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -165,7 +168,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
165
168
|
}, z.core.$strip>>;
|
|
166
169
|
}, z.core.$loose>;
|
|
167
170
|
};
|
|
168
|
-
readonly 'contacts.
|
|
171
|
+
readonly 'contacts.create': {
|
|
169
172
|
readonly input: z.ZodObject<{
|
|
170
173
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
171
174
|
associations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -192,6 +195,25 @@ export declare const hubspotEndpointSchemas: {
|
|
|
192
195
|
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
193
196
|
}, z.core.$loose>;
|
|
194
197
|
};
|
|
198
|
+
readonly 'contacts.update': {
|
|
199
|
+
readonly input: z.ZodObject<{
|
|
200
|
+
contactId: z.ZodString;
|
|
201
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
202
|
+
}, z.core.$strip>;
|
|
203
|
+
readonly output: z.ZodObject<{
|
|
204
|
+
id: z.ZodString;
|
|
205
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
206
|
+
createdAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
207
|
+
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
208
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
209
|
+
associations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
210
|
+
results: z.ZodArray<z.ZodObject<{
|
|
211
|
+
id: z.ZodString;
|
|
212
|
+
type: z.ZodOptional<z.ZodString>;
|
|
213
|
+
}, z.core.$strip>>;
|
|
214
|
+
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
215
|
+
}, z.core.$loose>;
|
|
216
|
+
};
|
|
195
217
|
readonly 'contacts.delete': {
|
|
196
218
|
readonly input: z.ZodObject<{
|
|
197
219
|
contactId: z.ZodString;
|
|
@@ -205,6 +227,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
205
227
|
since: z.ZodOptional<z.ZodString>;
|
|
206
228
|
}, z.core.$strip>;
|
|
207
229
|
readonly output: z.ZodObject<{
|
|
230
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
208
231
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
209
232
|
id: z.ZodString;
|
|
210
233
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -235,6 +258,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
235
258
|
since: z.ZodOptional<z.ZodString>;
|
|
236
259
|
}, z.core.$strip>;
|
|
237
260
|
readonly output: z.ZodObject<{
|
|
261
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
238
262
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
239
263
|
id: z.ZodString;
|
|
240
264
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -263,7 +287,13 @@ export declare const hubspotEndpointSchemas: {
|
|
|
263
287
|
query: z.ZodOptional<z.ZodString>;
|
|
264
288
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
265
289
|
after: z.ZodOptional<z.ZodString>;
|
|
266
|
-
sorts: z.ZodOptional<z.ZodArray<z.
|
|
290
|
+
sorts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
291
|
+
propertyName: z.ZodString;
|
|
292
|
+
direction: z.ZodEnum<{
|
|
293
|
+
ASCENDING: "ASCENDING";
|
|
294
|
+
DESCENDING: "DESCENDING";
|
|
295
|
+
}>;
|
|
296
|
+
}, z.core.$strip>>>;
|
|
267
297
|
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
268
298
|
filterGroups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
269
299
|
filters: z.ZodArray<z.ZodObject<{
|
|
@@ -290,6 +320,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
290
320
|
}, z.core.$strip>>>;
|
|
291
321
|
}, z.core.$strip>;
|
|
292
322
|
readonly output: z.ZodObject<{
|
|
323
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
293
324
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
294
325
|
id: z.ZodString;
|
|
295
326
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -346,6 +377,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
346
377
|
archived: z.ZodOptional<z.ZodBoolean>;
|
|
347
378
|
}, z.core.$strip>;
|
|
348
379
|
readonly output: z.ZodObject<{
|
|
380
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
349
381
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
350
382
|
id: z.ZodString;
|
|
351
383
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -428,6 +460,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
428
460
|
since: z.ZodOptional<z.ZodString>;
|
|
429
461
|
}, z.core.$strip>;
|
|
430
462
|
readonly output: z.ZodObject<{
|
|
463
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
431
464
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
432
465
|
id: z.ZodString;
|
|
433
466
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -458,6 +491,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
458
491
|
since: z.ZodOptional<z.ZodString>;
|
|
459
492
|
}, z.core.$strip>;
|
|
460
493
|
readonly output: z.ZodObject<{
|
|
494
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
461
495
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
462
496
|
id: z.ZodString;
|
|
463
497
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -487,6 +521,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
487
521
|
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
488
522
|
}, z.core.$strip>;
|
|
489
523
|
readonly output: z.ZodObject<{
|
|
524
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
490
525
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
491
526
|
id: z.ZodString;
|
|
492
527
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -500,6 +535,14 @@ export declare const hubspotEndpointSchemas: {
|
|
|
500
535
|
}, z.core.$strip>>;
|
|
501
536
|
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
502
537
|
}, z.core.$loose>>>;
|
|
538
|
+
paging: z.ZodOptional<z.ZodObject<{
|
|
539
|
+
next: z.ZodOptional<z.ZodObject<{
|
|
540
|
+
after: z.ZodString;
|
|
541
|
+
}, z.core.$strip>>;
|
|
542
|
+
prev: z.ZodOptional<z.ZodObject<{
|
|
543
|
+
before: z.ZodString;
|
|
544
|
+
}, z.core.$strip>>;
|
|
545
|
+
}, z.core.$strip>>;
|
|
503
546
|
}, z.core.$loose>;
|
|
504
547
|
};
|
|
505
548
|
readonly 'deals.get': {
|
|
@@ -535,6 +578,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
535
578
|
archived: z.ZodOptional<z.ZodBoolean>;
|
|
536
579
|
}, z.core.$strip>;
|
|
537
580
|
readonly output: z.ZodObject<{
|
|
581
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
538
582
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
539
583
|
id: z.ZodString;
|
|
540
584
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -617,6 +661,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
617
661
|
since: z.ZodOptional<z.ZodString>;
|
|
618
662
|
}, z.core.$strip>;
|
|
619
663
|
readonly output: z.ZodObject<{
|
|
664
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
620
665
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
621
666
|
id: z.ZodString;
|
|
622
667
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -647,6 +692,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
647
692
|
since: z.ZodOptional<z.ZodString>;
|
|
648
693
|
}, z.core.$strip>;
|
|
649
694
|
readonly output: z.ZodObject<{
|
|
695
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
650
696
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
651
697
|
id: z.ZodString;
|
|
652
698
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -675,7 +721,13 @@ export declare const hubspotEndpointSchemas: {
|
|
|
675
721
|
query: z.ZodOptional<z.ZodString>;
|
|
676
722
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
677
723
|
after: z.ZodOptional<z.ZodString>;
|
|
678
|
-
sorts: z.ZodOptional<z.ZodArray<z.
|
|
724
|
+
sorts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
725
|
+
propertyName: z.ZodString;
|
|
726
|
+
direction: z.ZodEnum<{
|
|
727
|
+
ASCENDING: "ASCENDING";
|
|
728
|
+
DESCENDING: "DESCENDING";
|
|
729
|
+
}>;
|
|
730
|
+
}, z.core.$strip>>>;
|
|
679
731
|
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
680
732
|
filterGroups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
681
733
|
filters: z.ZodArray<z.ZodObject<{
|
|
@@ -702,6 +754,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
702
754
|
}, z.core.$strip>>>;
|
|
703
755
|
}, z.core.$strip>;
|
|
704
756
|
readonly output: z.ZodObject<{
|
|
757
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
705
758
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
706
759
|
id: z.ZodString;
|
|
707
760
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -1141,6 +1194,6 @@ export type ExternalHubSpotPlugin<PluginOptions extends HubSpotPluginOptions> =
|
|
|
1141
1194
|
export declare function hubspot<const PluginOptions extends HubSpotPluginOptions>(incomingOptions?: HubSpotPluginOptions & PluginOptions): ExternalHubSpotPlugin<PluginOptions>;
|
|
1142
1195
|
export { createHubSpotEventMatch, verifyHubSpotWebhookSignature, } from './webhooks/types';
|
|
1143
1196
|
export type { CompanyCreatedEvent, CompanyCreatedEventType, CompanyDeletedEvent, CompanyDeletedEventType, CompanyUpdatedEvent, CompanyUpdatedEventType, ContactCreatedEvent, ContactCreatedEventType, ContactDeletedEvent, ContactDeletedEventType, ContactUpdatedEvent, ContactUpdatedEventType, DealCreatedEvent, DealCreatedEventType, DealDeletedEvent, DealDeletedEventType, DealUpdatedEvent, DealUpdatedEventType, HubSpotWebhookEventType, HubSpotWebhookOutputs, HubSpotWebhookPayload, HubSpotWebhookPayloadType, TicketCreatedEvent, TicketCreatedEventType, TicketDeletedEvent, TicketDeletedEventType, TicketUpdatedEvent, TicketUpdatedEventType, } from './webhooks/types';
|
|
1144
|
-
export type { AddContactToListResponse, CreateCompanyResponse, CreateDealResponse, CreateEngagementResponse,
|
|
1197
|
+
export type { AddContactToListResponse, CreateCompanyResponse, CreateContactResponse, CreateDealResponse, CreateEngagementResponse, CreateTicketResponse, GetCompanyResponse, GetContactResponse, GetDealResponse, GetEngagementResponse, GetManyCompaniesResponse, GetManyContactsResponse, GetManyDealsResponse, GetManyEngagementsResponse, GetManyTicketsResponse, GetTicketResponse, HubSpotEndpointInputs, HubSpotEndpointOutputs, RemoveContactFromListResponse, SearchCompanyByDomainResponse, UpdateCompanyResponse, UpdateContactResponse, UpdateDealResponse, UpdateTicketResponse, } from './endpoints/types';
|
|
1145
1198
|
export type { HubSpotCredentials } from './schema';
|
|
1146
1199
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,uBAAuB,EAGvB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACX,qBAAqB,EACrB,sBAAsB,EACtB,MAAM,aAAa,CAAC;AAcrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EACX,uBAAuB,EACvB,uBAAuB,EACvB,u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B,EACzB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EACX,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,6BAA6B,EAC7B,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,GACpB,MAAM,mBAAmB,CAAC;AAM3B,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as u}from"zod";import{logEventFromContext as E}from"corsair/core";import{request as pt}from"corsair/http";var v=class extends Error{constructor(s,r){super(s);this.code=r;this.name="HubSpotAPIError"}},it="https://api.hubapi.com";async function d(t,a,s={}){let{method:r="GET",body:n,query:o}=s,p={BASE:it,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",TOKEN:a,HEADERS:{"Content-Type":"application/json"}},B={method:r,url:t,body:r==="POST"||r==="PUT"||r==="PATCH"?n:void 0,mediaType:"application/json",query:r==="GET"?o:void 0};try{return await pt(p,B)}catch(g){throw g&&typeof g=="object"&&"status"in g&&typeof g.status=="number"?new v(g instanceof Error?g.message:"HubSpot API error",g.status):new v(g instanceof Error?g.message:"Unknown error")}}var ae=async(t,a)=>{let{companyId:s,...r}=a,n=`/crm/v3/objects/companies/${s}`,o=await d(n,t.key,{query:{...r,properties:r.properties?.join(","),propertiesWithHistory:r.propertiesWithHistory?.join(","),associations:r.associations?.join(",")}});if(o&&t.db.companies)try{await t.db.companies.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to save company to database:",p)}return await E(t,"hubspot.companies.get",{...a},"completed"),o},ne=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/companies",t.key,{query:{...s,properties:s.properties?.join(","),propertiesWithHistory:s.propertiesWithHistory?.join(","),associations:s.associations?.join(",")}});if(n.results&&t.db.companies)try{for(let o of n.results)await t.db.companies.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save companies to database:",o)}return await E(t,"hubspot.companies.getMany",{...a},"completed"),n},se=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/companies",t.key,{method:"POST",body:s});if(n&&t.db.companies)try{await t.db.companies.upsertByEntityId(n.id,n)}catch(o){console.warn("Failed to save company to database:",o)}return await E(t,"hubspot.companies.create",{...a},"completed"),n},re=async(t,a)=>{let{companyId:s,...r}=a,n=`/crm/v3/objects/companies/${s}`,o=await d(n,t.key,{method:"PATCH",body:r});if(o&&t.db.companies)try{await t.db.companies.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to save company to database:",p)}return await E(t,"hubspot.companies.update",{...a},"completed"),o},pe=async(t,a)=>{let{companyId:s}=a,r=`/crm/v3/objects/companies/${s}`;if(await d(r,t.key,{method:"DELETE"}),t.db.companies)try{await t.db.companies.deleteByEntityId(s)}catch(n){console.warn("Failed to delete company from database:",n)}await E(t,"hubspot.companies.delete",{...a},"completed")},ie=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/companies",t.key,{query:s});if(n.results&&t.db.companies)try{for(let o of n.results)await t.db.companies.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save companies to database:",o)}return await E(t,"hubspot.companies.getRecentlyCreated",{...a},"completed"),n},ce=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/companies",t.key,{query:s});if(n.results&&t.db.companies)try{for(let o of n.results)await t.db.companies.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save companies to database:",o)}return await E(t,"hubspot.companies.getRecentlyUpdated",{...a},"completed"),n},de=async(t,a)=>{let{domain:s,...r}=a,o=await d("/crm/v3/objects/companies/search",t.key,{query:{...r,domain:s,properties:r.properties?.join(",")}});return await E(t,"hubspot.companies.searchByDomain",{...a},"completed"),o};import{logEventFromContext as le}from"corsair/core";var ye=async(t,a)=>{let{listId:s,...r}=a,n=`/contacts/v1/lists/${s}/add`,o=await d(n,t.key,{method:"POST",body:r});return await le(t,"hubspot.contactLists.addContact",{...a},"completed"),o},ue=async(t,a)=>{let{listId:s,...r}=a,n=`/contacts/v1/lists/${s}/remove`,o=await d(n,t.key,{method:"POST",body:r});return await le(t,"hubspot.contactLists.removeContact",{...a},"completed"),o};import{logEventFromContext as H}from"corsair/core";var me=async(t,a)=>{let{contactId:s,...r}=a,n=`/crm/v3/objects/contacts/${s}`,o=await d(n,t.key,{query:{...r,properties:r.properties?.join(","),propertiesWithHistory:r.propertiesWithHistory?.join(","),associations:r.associations?.join(",")}});if(o&&t.db.contacts)try{await t.db.contacts.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to save contact to database:",p)}return await H(t,"hubspot.contacts.get",{...a},"completed"),o},be=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/contacts",t.key,{query:{...s,properties:s.properties?.join(","),propertiesWithHistory:s.propertiesWithHistory?.join(","),associations:s.associations?.join(",")}});if(n.results&&t.db.contacts)try{for(let o of n.results)await t.db.contacts.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save contacts to database:",o)}return await H(t,"hubspot.contacts.getMany",{...a},"completed"),n},ge=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/contacts",t.key,{method:"POST",body:s});if(n&&t.db.contacts)try{await t.db.contacts.upsertByEntityId(n.id,n)}catch(o){console.warn("Failed to save contact to database:",o)}return await H(t,"hubspot.contacts.createOrUpdate",{...a},"completed"),n},he=async(t,a)=>{let{contactId:s}=a,r=`/crm/v3/objects/contacts/${s}`;if(await d(r,t.key,{method:"DELETE"}),t.db.contacts)try{await t.db.contacts.deleteByEntityId(s)}catch(n){console.warn("Failed to delete contact from database:",n)}await H(t,"hubspot.contacts.delete",{...a},"completed")},Se=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/contacts",t.key,{query:s});return await H(t,"hubspot.contacts.getRecentlyCreated",{...a},"completed"),n},Ce=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/contacts",t.key,{query:s});return await H(t,"hubspot.contacts.getRecentlyUpdated",{...a},"completed"),n},Ee=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/contacts/search",t.key,{method:"POST",body:s});return await H(t,"hubspot.contacts.search",{...a},"completed"),n};import{logEventFromContext as k}from"corsair/core";var ke=async(t,a)=>{let{dealId:s,...r}=a,n=`/crm/v3/objects/deals/${s}`,o=await d(n,t.key,{query:{...r,properties:r.properties?.join(","),propertiesWithHistory:r.propertiesWithHistory?.join(","),associations:r.associations?.join(",")}});if(o&&t.db.deals)try{await t.db.deals.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to save deal to database:",p)}return await k(t,"hubspot.deals.get",{...a},"completed"),o},fe=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/deals",t.key,{query:{...s,properties:s.properties?.join(","),propertiesWithHistory:s.propertiesWithHistory?.join(","),associations:s.associations?.join(",")}});if(n.results&&t.db.deals)try{for(let o of n.results)await t.db.deals.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save deals to database:",o)}return await k(t,"hubspot.deals.getMany",{...a},"completed"),n},ve=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/deals",t.key,{method:"POST",body:s});if(n&&t.db.deals)try{await t.db.deals.upsertByEntityId(n.id,n)}catch(o){console.warn("Failed to save deal to database:",o)}return await k(t,"hubspot.deals.create",{...a},"completed"),n},He=async(t,a)=>{let{dealId:s,...r}=a,n=`/crm/v3/objects/deals/${s}`,o=await d(n,t.key,{method:"PATCH",body:r});if(o&&t.db.deals)try{await t.db.deals.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to update deal in database:",p)}return await k(t,"hubspot.deals.update",{...a},"completed"),o},Re=async(t,a)=>{let{dealId:s}=a,r=`/crm/v3/objects/deals/${s}`;if(await d(r,t.key,{method:"DELETE"}),t.db.deals)try{await t.db.deals.deleteByEntityId(s)}catch(n){console.warn("Failed to delete deal from database:",n)}await k(t,"hubspot.deals.delete",{...a},"completed")},we=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/deals",t.key,{query:s});return await k(t,"hubspot.deals.getRecentlyCreated",{...a},"completed"),n},Ie=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/deals",t.key,{query:s});return await k(t,"hubspot.deals.getRecentlyUpdated",{...a},"completed"),n},De=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/deals/search",t.key,{method:"POST",body:s});return await k(t,"hubspot.deals.search",{...a},"completed"),n};import{logEventFromContext as G}from"corsair/core";var Te=async(t,a)=>{let{engagementId:s}=a,r=`/crm/v3/objects/engagements/${s}`,n=await d(r,t.key);if(n&&t.db.engagements)try{await t.db.engagements.upsertByEntityId(n.id,{...n})}catch(o){console.warn("Failed to save engagement to database:",o)}return await G(t,"hubspot.engagements.get",{...a},"completed"),n},je=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/engagements",t.key,{query:s});if(n.results&&t.db.engagements)try{for(let o of n.results)await t.db.engagements.upsertByEntityId(o.id,{...o})}catch(o){console.warn("Failed to save engagements to database:",o)}return await G(t,"hubspot.engagements.getMany",{...a},"completed"),n},Ge=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/engagements",t.key,{method:"POST",body:s});if(n&&t.db.engagements)try{await t.db.engagements.upsertByEntityId(n.id,{...n})}catch(o){console.warn("Failed to save engagement to database:",o)}return await G(t,"hubspot.engagements.create",{...a},"completed"),n},Ue=async(t,a)=>{let{engagementId:s}=a,r=`/crm/v3/objects/engagements/${s}`;if(await d(r,t.key,{method:"DELETE"}),t.db.engagements)try{await t.db.engagements.deleteByEntityId(s)}catch(n){console.warn("Failed to delete engagement from database:",n)}await G(t,"hubspot.engagements.delete",{...a},"completed")};import{logEventFromContext as w}from"corsair/core";var Ae=async(t,a)=>{let{ticketId:s,...r}=a,n=`/crm/v3/objects/tickets/${s}`,o=await d(n,t.key,{query:{...r,properties:r.properties?.join(","),propertiesWithHistory:r.propertiesWithHistory?.join(","),associations:r.associations?.join(",")}});if(o&&t.db.tickets)try{await t.db.tickets.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to save ticket to database:",p)}return await w(t,"hubspot.tickets.get",{...a},"completed"),o},Me=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/tickets",t.key,{query:{...s,properties:s.properties?.join(","),propertiesWithHistory:s.propertiesWithHistory?.join(","),associations:s.associations?.join(",")}});if(n.results&&t.db.tickets)try{for(let o of n.results)await t.db.tickets.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save tickets to database:",o)}return await w(t,"hubspot.tickets.getMany",{...a},"completed"),n},We=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/tickets",t.key,{method:"POST",body:s});if(n&&t.db.tickets)try{await t.db.tickets.upsertByEntityId(n.id,n)}catch(o){console.warn("Failed to save ticket to database:",o)}return await w(t,"hubspot.tickets.create",{...a},"completed"),n},xe=async(t,a)=>{let{ticketId:s,...r}=a,n=`/crm/v3/objects/tickets/${s}`,o=await d(n,t.key,{method:"PATCH",body:r});if(o&&t.db.tickets)try{await t.db.tickets.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to update ticket in database:",p)}return await w(t,"hubspot.tickets.update",{...a},"completed"),o},Oe=async(t,a)=>{let{ticketId:s}=a,r=`/crm/v3/objects/tickets/${s}`;if(await d(r,t.key,{method:"DELETE"}),t.db.tickets)try{await t.db.tickets.deleteByEntityId(s)}catch(n){console.warn("Failed to delete ticket from database:",n)}await w(t,"hubspot.tickets.delete",{...a},"completed")};import{z as e}from"zod";var bt=e.object({contactId:e.string(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional(),idProperty:e.string().optional()}),gt=e.object({limit:e.number().optional(),after:e.string().optional(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional()}),ht=e.object({properties:e.record(e.string(),e.string()).optional(),associations:e.array(e.object({to:e.object({id:e.string()}),types:e.array(e.object({associationCategory:e.string(),associationTypeId:e.number()}))})).optional()}),St=e.object({contactId:e.string()}),Ct=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),Et=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),kt=e.enum(["BETWEEN","CONTAINS_TOKEN","EQ","GT","GTE","HAS_PROPERTY","IN","LT","LTE","NEQ","NOT_CONTAINS_TOKEN","NOT_HAS_PROPERTY","NOT_IN"]),ft=e.object({operator:kt,propertyName:e.string(),highValue:e.string().optional(),value:e.string().optional(),values:e.array(e.string()).optional()}),Le=e.object({filters:e.array(ft)}),vt=e.object({id:e.string(),type:e.string().optional()}),Ht=e.object({results:e.array(vt)}),D=e.record(e.string(),e.union([Ht,e.array(e.string())])),Rt=e.object({query:e.string().optional(),limit:e.number().optional(),after:e.string().optional(),sorts:e.array(e.string()).optional(),properties:e.array(e.string()).optional(),filterGroups:e.array(Le).optional()}),wt=e.object({companyId:e.string(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional(),idProperty:e.string().optional()}),It=e.object({limit:e.number().optional(),after:e.string().optional(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional()}),Dt=e.object({properties:e.record(e.string(),e.string()).optional(),associations:e.array(e.object({to:e.object({id:e.string()}),types:e.array(e.object({associationCategory:e.string(),associationTypeId:e.number()}))})).optional()}),Tt=e.object({companyId:e.string(),properties:e.record(e.string(),e.string()).optional()}),jt=e.object({companyId:e.string()}),Gt=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),Ut=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),At=e.object({domain:e.string(),properties:e.array(e.string()).optional()}),Mt=e.object({dealId:e.string(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional(),idProperty:e.string().optional()}),Wt=e.object({limit:e.number().optional(),after:e.string().optional(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional()}),xt=e.object({properties:e.record(e.string(),e.string()).optional(),associations:e.array(e.object({to:e.object({id:e.string()}),types:e.array(e.object({associationCategory:e.string(),associationTypeId:e.number()}))})).optional()}),Ot=e.object({dealId:e.string(),properties:e.record(e.string(),e.string()).optional()}),Pt=e.object({dealId:e.string()}),Lt=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),Bt=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),Ft=e.object({query:e.string().optional(),limit:e.number().optional(),after:e.string().optional(),sorts:e.array(e.string()).optional(),properties:e.array(e.string()).optional(),filterGroups:e.array(Le).optional()}),zt=e.object({ticketId:e.string(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional(),idProperty:e.string().optional()}),Nt=e.object({limit:e.number().optional(),after:e.string().optional(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional()}),Vt=e.object({properties:e.record(e.string(),e.string()).optional(),associations:e.array(e.object({to:e.object({id:e.string()}),types:e.array(e.object({associationCategory:e.string(),associationTypeId:e.number()}))})).optional()}),_t=e.object({ticketId:e.string(),properties:e.record(e.string(),e.string()).optional()}),qt=e.object({ticketId:e.string()}),$t=e.object({engagementId:e.string()}),Kt=e.object({limit:e.number().optional(),after:e.string().optional()}),Qt=e.object({engagement:e.object({active:e.boolean().optional(),type:e.string(),timestamp:e.number().optional()}),associations:e.object({contactIds:e.array(e.number()).optional(),companyIds:e.array(e.number()).optional(),dealIds:e.array(e.number()).optional(),ownerIds:e.array(e.number()).optional()}).optional(),metadata:e.record(e.string(),e.any()).optional()}),Yt=e.object({engagementId:e.string()}),Jt=e.object({listId:e.string(),emails:e.array(e.string()).optional(),vids:e.array(e.number()).optional()}),Xt=e.object({listId:e.string(),emails:e.array(e.string()).optional(),vids:e.array(e.number()).optional()}),l={contactsGet:bt,contactsGetMany:gt,contactsCreateOrUpdate:ht,contactsDelete:St,contactsGetRecentlyCreated:Ct,contactsGetRecentlyUpdated:Et,contactsSearch:Rt,companiesGet:wt,companiesGetMany:It,companiesCreate:Dt,companiesUpdate:Tt,companiesDelete:jt,companiesGetRecentlyCreated:Gt,companiesGetRecentlyUpdated:Ut,companiesSearchByDomain:At,dealsGet:Mt,dealsGetMany:Wt,dealsCreate:xt,dealsUpdate:Ot,dealsDelete:Pt,dealsGetRecentlyCreated:Lt,dealsGetRecentlyUpdated:Bt,dealsSearch:Ft,ticketsGet:zt,ticketsGetMany:Nt,ticketsCreate:Vt,ticketsUpdate:_t,ticketsDelete:qt,engagementsGet:$t,engagementsGetMany:Kt,engagementsCreate:Qt,engagementsDelete:Yt,contactListsAddContact:Jt,contactListsRemoveContact:Xt},z=e.object({id:e.string(),properties:e.record(e.string(),e.string()).optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archived:e.boolean().optional(),associations:D.optional()}).loose(),I=e.object({id:e.string(),properties:e.record(e.string(),e.string()).optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archived:e.boolean().optional(),associations:D.optional()}).loose(),M=e.object({id:e.string(),properties:e.record(e.string(),e.string()).optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archived:e.boolean().optional(),associations:D.optional()}).loose(),W=e.object({id:e.string(),properties:e.record(e.string(),e.string()).optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archived:e.boolean().optional(),associations:D.optional()}).loose(),N=e.object({id:e.string(),engagement:e.object({id:e.number().optional(),portalId:e.number().optional(),active:e.boolean().optional(),createdAt:e.number().optional(),lastUpdated:e.number().optional(),createdBy:e.number().optional(),modifiedBy:e.number().optional(),ownerId:e.number().optional(),type:e.string().optional(),timestamp:e.number().optional()}).optional(),associations:D.optional(),metadata:e.record(e.string(),e.any()).optional()}).loose(),T=e.object({next:e.object({after:e.string()}).optional(),prev:e.object({before:e.string()}).optional()}),U=e.object({results:e.array(z).optional(),paging:T.optional()}).loose(),F=e.object({results:e.array(I).optional(),paging:T.optional()}).loose(),A=e.object({results:e.array(M).optional(),paging:T.optional()}).loose(),Zt=e.object({results:e.array(W).optional(),paging:T.optional()}).loose(),eo=e.object({results:e.array(N).optional(),paging:T.optional()}).loose(),to=e.object({results:e.array(I).optional()}).loose(),Pe=e.object({updated:e.array(e.number()).optional(),discarded:e.array(e.number()).optional(),invalidVids:e.array(e.number()).optional(),invalidEmails:e.array(e.string()).optional()}),y={contactsGet:z,contactsGetMany:U,contactsCreateOrUpdate:z,contactsDelete:e.void(),contactsGetRecentlyCreated:U,contactsGetRecentlyUpdated:U,contactsSearch:U,companiesGet:I,companiesGetMany:F,companiesCreate:I,companiesUpdate:I,companiesDelete:e.void(),companiesGetRecentlyCreated:F,companiesGetRecentlyUpdated:F,companiesSearchByDomain:to,dealsGet:M,dealsGetMany:A,dealsCreate:M,dealsUpdate:M,dealsDelete:e.void(),dealsGetRecentlyCreated:A,dealsGetRecentlyUpdated:A,dealsSearch:A,ticketsGet:W,ticketsGetMany:Zt,ticketsCreate:W,ticketsUpdate:W,ticketsDelete:e.void(),engagementsGet:N,engagementsGetMany:eo,engagementsCreate:N,engagementsDelete:e.void(),contactListsAddContact:Pe,contactListsRemoveContact:Pe};var f={get:me,getMany:be,createOrUpdate:ge,delete:he,getRecentlyCreated:Se,getRecentlyUpdated:Ce,search:Ee},S={get:ae,getMany:ne,create:se,update:re,delete:pe,getRecentlyCreated:ie,getRecentlyUpdated:ce,searchByDomain:de},C={get:ke,getMany:fe,create:ve,update:He,delete:Re,getRecentlyCreated:we,getRecentlyUpdated:Ie,search:De},R={get:Ae,getMany:Me,create:We,update:xe,delete:Oe},j={get:Te,getMany:je,create:Ge,delete:Ue},V={addContact:ye,removeContact:ue};import{ApiError as Be}from"corsair/http";var Fe={PERMISSION_ERROR:{match:(t,a)=>{if((t instanceof Be&&t.status===403||t instanceof v&&t.code===403)&&a.operation.toLowerCase().includes("tickets"))return!0;let s=t.message.toLowerCase();return s.includes("forbidden")||s.includes("permission denied")||s.includes("access denied")},handler:async(t,a)=>({maxRetries:0})},VALIDATION_ERROR:{match:(t,a)=>!!((t instanceof Be&&t.status===400||t instanceof v&&t.code===400)&&a.operation.toLowerCase().includes("engagements.create")),handler:async(t,a)=>({maxRetries:0})},DEFAULT:{match:(t,a)=>!0,handler:async(t,a)=>(console.error(`[corsair:${a.pluginId}:${a.operation}]`,{error:t.message,input:a.input}),{maxRetries:0})}};import{z as $e}from"zod";import{z as i}from"zod";var ze=i.object({id:i.string(),properties:i.record(i.string(),i.any()).optional(),createdAt:i.coerce.date().nullable().optional(),updatedAt:i.coerce.date().nullable().optional(),archived:i.boolean().optional()}),Ne=i.object({id:i.string(),properties:i.record(i.string(),i.any()).optional(),createdAt:i.coerce.date().nullable().optional(),updatedAt:i.coerce.date().nullable().optional(),archived:i.boolean().optional()}),Ve=i.object({id:i.string(),properties:i.record(i.string(),i.any()).optional(),createdAt:i.coerce.date().nullable().optional(),updatedAt:i.coerce.date().nullable().optional(),archived:i.boolean().optional()}),_e=i.object({id:i.string(),properties:i.record(i.string(),i.any()).optional(),createdAt:i.coerce.date().nullable().optional(),updatedAt:i.coerce.date().nullable().optional(),archived:i.boolean().optional()}),qe=i.object({id:i.string(),engagement:i.object({id:i.number().optional(),portalId:i.number().optional(),active:i.boolean().optional(),createdAt:i.number().optional(),lastUpdated:i.number().optional(),createdBy:i.number().optional(),modifiedBy:i.number().optional(),ownerId:i.number().optional(),type:i.string().optional(),timestamp:i.number().optional()}).optional(),associations:i.record(i.string(),i.any()).optional(),metadata:i.record(i.string(),i.any()).optional()});var xo=$e.object({token:$e.string()}),Ke={version:"1.0.0",entities:{contacts:ze,companies:Ne,deals:Ve,tickets:_e,engagements:qe}};import{verifyHmacSignature as oo}from"corsair/http";import{z as c}from"zod";var h=c.object({subscriptionId:c.number(),portalId:c.number(),occurredAt:c.number(),subscriptionType:c.string(),attemptNumber:c.number(),objectId:c.number().optional(),propertyName:c.string().optional(),propertyValue:c.string().optional(),changeSource:c.string().optional(),eventId:c.string().optional()}),_=h.extend({subscriptionType:c.literal("contact.creation"),objectId:c.number()}),q=h.extend({subscriptionType:c.literal("contact.propertyChange"),objectId:c.number(),propertyName:c.string(),propertyValue:c.string()}),$=h.extend({subscriptionType:c.literal("contact.deletion"),objectId:c.number()}),K=h.extend({subscriptionType:c.literal("company.creation"),objectId:c.number()}),Q=h.extend({subscriptionType:c.literal("company.propertyChange"),objectId:c.number(),propertyName:c.string(),propertyValue:c.string()}),Y=h.extend({subscriptionType:c.literal("company.deletion"),objectId:c.number()}),J=h.extend({subscriptionType:c.literal("deal.creation"),objectId:c.number()}),X=h.extend({subscriptionType:c.literal("deal.propertyChange"),objectId:c.number(),propertyName:c.string(),propertyValue:c.string()}),Z=h.extend({subscriptionType:c.literal("deal.deletion"),objectId:c.number()}),ee=h.extend({subscriptionType:c.literal("ticket.creation"),objectId:c.number()}),te=h.extend({subscriptionType:c.literal("ticket.propertyChange"),objectId:c.number(),propertyName:c.string(),propertyValue:c.string()}),oe=h.extend({subscriptionType:c.literal("ticket.deletion"),objectId:c.number()}),Bo=c.union([_,q,$,K,Q,Y,J,X,Z,ee,te,oe]);function ao(t){return typeof t=="string"?JSON.parse(t):t}function m(t,a){if(!a)return{valid:!1};let s=t.rawBody;if(!s)return{valid:!1,error:"Missing raw body for signature verification"};let r=t.headers,n=Array.isArray(r["x-hubspot-signature-v3"])?r["x-hubspot-signature-v3"][0]:r["x-hubspot-signature-v3"];return n?oo(s,a,n)?{valid:!0}:{valid:!1,error:"Invalid signature"}:{valid:!1,error:"Missing x-hubspot-signature-v3 header"}}function b(t){return a=>{let s=ao(a.body);return(Array.isArray(s)?s:[s]).some(n=>typeof n=="object"&&n!==null&&"subscriptionType"in n&&typeof n.subscriptionType=="string"&&n.subscriptionType===t)}}var Qe={match:b("company.creation"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="company.creation"&&(console.log("\u{1F3E2} HubSpot Company Created:",{objectId:o.objectId,portalId:o.portalId}),t.db.companies&&o.objectId))try{await t.db.companies.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{},createdAt:new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to save company to database:",p)}return{success:!0,data:{success:!0}}}},Ye={match:b("company.propertyChange"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="company.propertyChange"&&(console.log("\u{1F4DD} HubSpot Company Updated:",{objectId:o.objectId,propertyName:o.propertyName,propertyValue:o.propertyValue}),t.db.companies&&o.objectId))try{let p=await t.db.companies.findByEntityId(o.objectId.toString());await t.db.companies.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{...p?.data?.properties||{},[o.propertyName||""]:o.propertyValue},createdAt:p?.data?.createdAt||new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to update company in database:",p)}return{success:!0,data:{success:!0}}}},Je={match:b("company.deletion"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="company.deletion"&&(console.log("\u{1F5D1}\uFE0F HubSpot Company Deleted:",{objectId:o.objectId,portalId:o.portalId}),t.db.companies&&o.objectId))try{await t.db.companies.deleteByEntityId(o.objectId.toString())}catch(p){console.warn("Failed to delete company from database:",p)}return{success:!0,data:{success:!0}}}};var Xe={match:b("contact.creation"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="contact.creation"&&(console.log("\u{1F464} HubSpot Contact Created:",{objectId:o.objectId,portalId:o.portalId}),t.db.contacts&&o.objectId))try{await t.db.contacts.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{},createdAt:new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to save contact to database:",p)}return{success:!0,data:{success:!0}}}},Ze={match:b("contact.propertyChange"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="contact.propertyChange"&&(console.log("\u{1F4DD} HubSpot Contact Updated:",{objectId:o.objectId,propertyName:o.propertyName,propertyValue:o.propertyValue}),t.db.contacts&&o.objectId))try{let p=await t.db.contacts.findByEntityId(o.objectId.toString());await t.db.contacts.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{...p?.data?.properties||{},[o.propertyName||""]:o.propertyValue},createdAt:p?.data?.createdAt||new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to update contact in database:",p)}return{success:!0,data:{success:!0}}}},et={match:b("contact.deletion"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="contact.deletion"&&(console.log("\u{1F5D1}\uFE0F HubSpot Contact Deleted:",{objectId:o.objectId,portalId:o.portalId}),t.db.contacts&&o.objectId))try{await t.db.contacts.deleteByEntityId(o.objectId.toString())}catch(p){console.warn("Failed to delete contact from database:",p)}return{success:!0,data:{success:!0}}}};var tt={match:b("deal.creation"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="deal.creation"&&(console.log("\u{1F4BC} HubSpot Deal Created:",{objectId:o.objectId,portalId:o.portalId}),t.db.deals&&o.objectId))try{await t.db.deals.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{},createdAt:new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to save deal to database:",p)}return{success:!0,data:{success:!0}}}},ot={match:b("deal.propertyChange"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="deal.propertyChange"&&(console.log("\u{1F4DD} HubSpot Deal Updated:",{objectId:o.objectId,propertyName:o.propertyName,propertyValue:o.propertyValue}),t.db.deals&&o.objectId))try{let p=await t.db.deals.findByEntityId(o.objectId.toString());await t.db.deals.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{...p?.data?.properties||{},[o.propertyName||""]:o.propertyValue},createdAt:p?.data?.createdAt||new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to update deal in database:",p)}return{success:!0,data:{success:!0}}}},at={match:b("deal.deletion"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="deal.deletion"&&(console.log("\u{1F5D1}\uFE0F HubSpot Deal Deleted:",{objectId:o.objectId,portalId:o.portalId}),t.db.deals&&o.objectId))try{await t.db.deals.deleteByEntityId(o.objectId.toString())}catch(p){console.warn("Failed to delete deal from database:",p)}return{success:!0,data:{success:!0}}}};var nt={match:b("ticket.creation"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="ticket.creation"&&(console.log("\u{1F3AB} HubSpot Ticket Created:",{objectId:o.objectId,portalId:o.portalId}),t.db.tickets&&o.objectId))try{await t.db.tickets.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{},createdAt:new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to save ticket to database:",p)}return{success:!0,data:{success:!0}}}},st={match:b("ticket.propertyChange"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="ticket.propertyChange"&&(console.log("\u{1F4DD} HubSpot Ticket Updated:",{objectId:o.objectId,propertyName:o.propertyName,propertyValue:o.propertyValue}),t.db.tickets&&o.objectId))try{let p=await t.db.tickets.findByEntityId(o.objectId.toString());await t.db.tickets.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{...p?.data?.properties||{},[o.propertyName||""]:o.propertyValue},createdAt:p?.data?.createdAt||new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to update ticket in database:",p)}return{success:!0,data:{success:!0}}}},rt={match:b("ticket.deletion"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="ticket.deletion"&&(console.log("\u{1F5D1}\uFE0F HubSpot Ticket Deleted:",{objectId:o.objectId,portalId:o.portalId}),t.db.tickets&&o.objectId))try{await t.db.tickets.deleteByEntityId(o.objectId.toString())}catch(p){console.warn("Failed to delete ticket from database:",p)}return{success:!0,data:{success:!0}}}};var x={created:Xe,updated:Ze,deleted:et},O={created:Qe,updated:Ye,deleted:Je},P={created:tt,updated:ot,deleted:at},L={created:nt,updated:st,deleted:rt};var no={contacts:{get:f.get,getMany:f.getMany,createOrUpdate:f.createOrUpdate,delete:f.delete,getRecentlyCreated:f.getRecentlyCreated,getRecentlyUpdated:f.getRecentlyUpdated,search:f.search},companies:{get:S.get,getMany:S.getMany,create:S.create,update:S.update,delete:S.delete,getRecentlyCreated:S.getRecentlyCreated,getRecentlyUpdated:S.getRecentlyUpdated,searchByDomain:S.searchByDomain},deals:{get:C.get,getMany:C.getMany,create:C.create,update:C.update,delete:C.delete,getRecentlyCreated:C.getRecentlyCreated,getRecentlyUpdated:C.getRecentlyUpdated,search:C.search},tickets:{get:R.get,getMany:R.getMany,create:R.create,update:R.update,delete:R.delete},engagements:{get:j.get,getMany:j.getMany,create:j.create,delete:j.delete},contactLists:{addContact:V.addContact,removeContact:V.removeContact}},so={"contacts.get":{input:l.contactsGet,output:y.contactsGet},"contacts.getMany":{input:l.contactsGetMany,output:y.contactsGetMany},"contacts.createOrUpdate":{input:l.contactsCreateOrUpdate,output:y.contactsCreateOrUpdate},"contacts.delete":{input:l.contactsDelete,output:y.contactsDelete},"contacts.getRecentlyCreated":{input:l.contactsGetRecentlyCreated,output:y.contactsGetRecentlyCreated},"contacts.getRecentlyUpdated":{input:l.contactsGetRecentlyUpdated,output:y.contactsGetRecentlyUpdated},"contacts.search":{input:l.contactsSearch,output:y.contactsSearch},"companies.get":{input:l.companiesGet,output:y.companiesGet},"companies.getMany":{input:l.companiesGetMany,output:y.companiesGetMany},"companies.create":{input:l.companiesCreate,output:y.companiesCreate},"companies.update":{input:l.companiesUpdate,output:y.companiesUpdate},"companies.delete":{input:l.companiesDelete,output:y.companiesDelete},"companies.getRecentlyCreated":{input:l.companiesGetRecentlyCreated,output:y.companiesGetRecentlyCreated},"companies.getRecentlyUpdated":{input:l.companiesGetRecentlyUpdated,output:y.companiesGetRecentlyUpdated},"companies.searchByDomain":{input:l.companiesSearchByDomain,output:y.companiesSearchByDomain},"deals.get":{input:l.dealsGet,output:y.dealsGet},"deals.getMany":{input:l.dealsGetMany,output:y.dealsGetMany},"deals.create":{input:l.dealsCreate,output:y.dealsCreate},"deals.update":{input:l.dealsUpdate,output:y.dealsUpdate},"deals.delete":{input:l.dealsDelete,output:y.dealsDelete},"deals.getRecentlyCreated":{input:l.dealsGetRecentlyCreated,output:y.dealsGetRecentlyCreated},"deals.getRecentlyUpdated":{input:l.dealsGetRecentlyUpdated,output:y.dealsGetRecentlyUpdated},"deals.search":{input:l.dealsSearch,output:y.dealsSearch},"tickets.get":{input:l.ticketsGet,output:y.ticketsGet},"tickets.getMany":{input:l.ticketsGetMany,output:y.ticketsGetMany},"tickets.create":{input:l.ticketsCreate,output:y.ticketsCreate},"tickets.update":{input:l.ticketsUpdate,output:y.ticketsUpdate},"tickets.delete":{input:l.ticketsDelete,output:y.ticketsDelete},"engagements.get":{input:l.engagementsGet,output:y.engagementsGet},"engagements.getMany":{input:l.engagementsGetMany,output:y.engagementsGetMany},"engagements.create":{input:l.engagementsCreate,output:y.engagementsCreate},"engagements.delete":{input:l.engagementsDelete,output:y.engagementsDelete},"contactLists.addContact":{input:l.contactListsAddContact,output:y.contactListsAddContact},"contactLists.removeContact":{input:l.contactListsRemoveContact,output:y.contactListsRemoveContact}},ro={contactCreated:x.created,contactUpdated:x.updated,contactDeleted:x.deleted,companyCreated:O.created,companyUpdated:O.updated,companyDeleted:O.deleted,dealCreated:P.created,dealUpdated:P.updated,dealDeleted:P.deleted,ticketCreated:L.created,ticketUpdated:L.updated,ticketDeleted:L.deleted},po={contactCreated:{description:"A new contact was created",payload:_,response:u.object({success:u.boolean()})},contactUpdated:{description:"A contact property was updated",payload:q,response:u.object({success:u.boolean()})},contactDeleted:{description:"A contact was deleted",payload:$,response:u.object({success:u.boolean()})},companyCreated:{description:"A new company was created",payload:K,response:u.object({success:u.boolean()})},companyUpdated:{description:"A company property was updated",payload:Q,response:u.object({success:u.boolean()})},companyDeleted:{description:"A company was deleted",payload:Y,response:u.object({success:u.boolean()})},dealCreated:{description:"A new deal was created",payload:J,response:u.object({success:u.boolean()})},dealUpdated:{description:"A deal property was updated",payload:X,response:u.object({success:u.boolean()})},dealDeleted:{description:"A deal was deleted",payload:Z,response:u.object({success:u.boolean()})},ticketCreated:{description:"A new support ticket was created",payload:ee,response:u.object({success:u.boolean()})},ticketUpdated:{description:"A support ticket property was updated",payload:te,response:u.object({success:u.boolean()})},ticketDeleted:{description:"A support ticket was deleted",payload:oe,response:u.object({success:u.boolean()})}},io="api_key",co={"contacts.get":{riskLevel:"read",description:"Get a specific contact"},"contacts.getMany":{riskLevel:"read",description:"Get multiple contacts"},"contacts.createOrUpdate":{riskLevel:"write",description:"Create a new contact or update an existing one"},"contacts.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a contact [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"contacts.getRecentlyCreated":{riskLevel:"read",description:"List recently created contacts"},"contacts.getRecentlyUpdated":{riskLevel:"read",description:"List recently updated contacts"},"contacts.search":{riskLevel:"read",description:"Search contacts"},"companies.get":{riskLevel:"read",description:"Get a specific company"},"companies.getMany":{riskLevel:"read",description:"Get multiple companies"},"companies.create":{riskLevel:"write",description:"Create a new company"},"companies.update":{riskLevel:"write",description:"Update an existing company"},"companies.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a company [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"companies.getRecentlyCreated":{riskLevel:"read",description:"List recently created companies"},"companies.getRecentlyUpdated":{riskLevel:"read",description:"List recently updated companies"},"companies.searchByDomain":{riskLevel:"read",description:"Search companies by domain name"},"deals.get":{riskLevel:"read",description:"Get a specific deal"},"deals.getMany":{riskLevel:"read",description:"Get multiple deals"},"deals.create":{riskLevel:"write",description:"Create a new deal"},"deals.update":{riskLevel:"write",description:"Update an existing deal"},"deals.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a deal [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"deals.getRecentlyCreated":{riskLevel:"read",description:"List recently created deals"},"deals.getRecentlyUpdated":{riskLevel:"read",description:"List recently updated deals"},"deals.search":{riskLevel:"read",description:"Search deals"},"tickets.get":{riskLevel:"read",description:"Get a specific ticket"},"tickets.getMany":{riskLevel:"read",description:"Get multiple tickets"},"tickets.create":{riskLevel:"write",description:"Create a new support ticket"},"tickets.update":{riskLevel:"write",description:"Update an existing ticket"},"tickets.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a ticket [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"engagements.get":{riskLevel:"read",description:"Get a specific engagement"},"engagements.getMany":{riskLevel:"read",description:"Get multiple engagements"},"engagements.create":{riskLevel:"write",description:"Create a new engagement"},"engagements.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete an engagement [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"contactLists.addContact":{riskLevel:"write",description:"Add a contact to a static contact list"},"contactLists.removeContact":{riskLevel:"write",description:"Remove a contact from a static contact list"}};function ca(t={}){let a={...t,authType:t.authType??io};return{id:"hubspot",oauthConfig:{providerName:"HubSpot",authUrl:"https://app.hubspot.com/oauth/authorize",tokenUrl:"https://api.hubapi.com/oauth/v1/token",scopes:["crm.objects.contacts.read","crm.objects.contacts.write","crm.objects.companies.read","crm.objects.companies.write","crm.objects.deals.read","crm.objects.deals.write"]},schema:Ke,options:a,hooks:a.hooks,webhookHooks:a.webhookHooks,endpoints:no,webhooks:ro,endpointMeta:co,endpointSchemas:so,webhookSchemas:po,pluginWebhookMatcher:s=>{let n="x-hubspot-signature-v3"in s.headers,o=s.body,B=(Array.isArray(o)?o:[o]).some(g=>typeof g.subscriptionType=="string"&&g.subscriptionType!==void 0);return n||B},errorHandlers:a.errorHandlers||Fe,keyBuilder:async(s,r)=>{let n=s.authType;if(r==="webhook"&&a.webhookSecret)return a.webhookSecret;if(r==="webhook"){let o=await s.keys.get_webhook_signature();if(!o)throw new Error("[auth-missing:hubspot:webhook_signature]: HubSpot webhook signature is missing");return o}if(r==="endpoint"){if(s.authType==="api_key"){let o=await s.keys.get_api_key();if(!o)throw new Error("[auth-missing:hubspot:api_key]: HubSpot API Key is missing");return o}else if(s.authType==="oauth_2"){let o=await s.keys.get_access_token();if(!o)throw new Error("[auth-missing:hubspot:oauth_2]: HubSpot access token is missing");return o}}throw new Error(`[auth-missing:hubspot:${n}]: HubSpot key is missing`)}}}export{b as createHubSpotEventMatch,ca as hubspot,so as hubspotEndpointSchemas,m as verifyHubSpotWebhookSignature};
|
|
1
|
+
import{z as u}from"zod";import{logEventFromContext as k}from"corsair/core";import{request as it}from"corsair/http";var H=class extends Error{constructor(s,r){super(s);this.code=r;this.name="HubSpotAPIError"}},dt="https://api.hubapi.com";async function d(t,a,s={}){let{method:r="GET",body:n,query:o}=s,p={BASE:dt,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",TOKEN:a,HEADERS:{"Content-Type":"application/json"}},F={method:r,url:t,body:r==="POST"||r==="PUT"||r==="PATCH"?n:void 0,mediaType:"application/json",query:r==="GET"?o:void 0};try{return await it(p,F)}catch(g){throw g&&typeof g=="object"&&"status"in g&&typeof g.status=="number"?new H(g instanceof Error?g.message:"HubSpot API error",g.status):new H(g instanceof Error?g.message:"Unknown error")}}var ae=async(t,a)=>{let{companyId:s,...r}=a,n=`/crm/v3/objects/companies/${s}`,o=await d(n,t.key,{query:{...r,properties:r.properties?.join(","),propertiesWithHistory:r.propertiesWithHistory?.join(","),associations:r.associations?.join(",")}});if(o&&t.db.companies)try{await t.db.companies.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to save company to database:",p)}return await k(t,"hubspot.companies.get",{...a},"completed"),o},ne=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/companies",t.key,{query:{...s,properties:s.properties?.join(","),propertiesWithHistory:s.propertiesWithHistory?.join(","),associations:s.associations?.join(",")}});if(n.results&&t.db.companies)try{for(let o of n.results)await t.db.companies.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save companies to database:",o)}return await k(t,"hubspot.companies.getMany",{...a},"completed"),n},se=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/companies",t.key,{method:"POST",body:s});if(n&&t.db.companies)try{await t.db.companies.upsertByEntityId(n.id,n)}catch(o){console.warn("Failed to save company to database:",o)}return await k(t,"hubspot.companies.create",{...a},"completed"),n},re=async(t,a)=>{let{companyId:s,...r}=a,n=`/crm/v3/objects/companies/${s}`,o=await d(n,t.key,{method:"PATCH",body:r});if(o&&t.db.companies)try{await t.db.companies.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to save company to database:",p)}return await k(t,"hubspot.companies.update",{...a},"completed"),o},pe=async(t,a)=>{let{companyId:s}=a,r=`/crm/v3/objects/companies/${s}`;if(await d(r,t.key,{method:"DELETE"}),t.db.companies)try{await t.db.companies.deleteByEntityId(s)}catch(n){console.warn("Failed to delete company from database:",n)}await k(t,"hubspot.companies.delete",{...a},"completed")},ce=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/companies",t.key,{query:s});if(n.results&&t.db.companies)try{for(let o of n.results)await t.db.companies.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save companies to database:",o)}return await k(t,"hubspot.companies.getRecentlyCreated",{...a},"completed"),n},ie=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/companies",t.key,{query:s});if(n.results&&t.db.companies)try{for(let o of n.results)await t.db.companies.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save companies to database:",o)}return await k(t,"hubspot.companies.getRecentlyUpdated",{...a},"completed"),n},de=async(t,a)=>{let{domain:s,...r}=a,o=await d("/crm/v3/objects/companies/search",t.key,{query:{...r,domain:s,properties:r.properties?.join(",")}});return await k(t,"hubspot.companies.searchByDomain",{...a},"completed"),o};import{logEventFromContext as le}from"corsair/core";var ye=async(t,a)=>{let{listId:s,...r}=a,n=`/contacts/v1/lists/${s}/add`,o=await d(n,t.key,{method:"POST",body:r});return await le(t,"hubspot.contactLists.addContact",{...a},"completed"),o},ue=async(t,a)=>{let{listId:s,...r}=a,n=`/contacts/v1/lists/${s}/remove`,o=await d(n,t.key,{method:"POST",body:r});return await le(t,"hubspot.contactLists.removeContact",{...a},"completed"),o};import{logEventFromContext as f}from"corsair/core";var me=async(t,a)=>{let{contactId:s,...r}=a,n=`/crm/v3/objects/contacts/${s}`,o=await d(n,t.key,{query:{...r,properties:r.properties?.join(","),propertiesWithHistory:r.propertiesWithHistory?.join(","),associations:r.associations?.join(",")}});if(o&&t.db.contacts)try{await t.db.contacts.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to save contact to database:",p)}return await f(t,"hubspot.contacts.get",{...a},"completed"),o},be=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/contacts",t.key,{query:{...s,properties:s.properties?.join(","),propertiesWithHistory:s.propertiesWithHistory?.join(","),associations:s.associations?.join(",")}});if(n.results&&t.db.contacts)try{for(let o of n.results)await t.db.contacts.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save contacts to database:",o)}return await f(t,"hubspot.contacts.getMany",{...a},"completed"),n},ge=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/contacts",t.key,{method:"POST",body:s});if(n&&t.db.contacts)try{await t.db.contacts.upsertByEntityId(n.id,n)}catch(o){console.warn("Failed to save contact to database:",o)}return await f(t,"hubspot.contacts.create",{...a},"completed"),n},he=async(t,a)=>{let{contactId:s,...r}=a,n=`/crm/v3/objects/contacts/${s}`,o=await d(n,t.key,{method:"PATCH",body:r});if(o&&t.db.contacts)try{await t.db.contacts.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to save contact to database:",p)}return await f(t,"hubspot.contacts.update",{...a},"completed"),o},Se=async(t,a)=>{let{contactId:s}=a,r=`/crm/v3/objects/contacts/${s}`;if(await d(r,t.key,{method:"DELETE"}),t.db.contacts)try{await t.db.contacts.deleteByEntityId(s)}catch(n){console.warn("Failed to delete contact from database:",n)}await f(t,"hubspot.contacts.delete",{...a},"completed")},Ce=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/contacts",t.key,{query:s});return await f(t,"hubspot.contacts.getRecentlyCreated",{...a},"completed"),n},Ee=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/contacts",t.key,{query:s});return await f(t,"hubspot.contacts.getRecentlyUpdated",{...a},"completed"),n},ke=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/contacts/search",t.key,{method:"POST",body:s});if(n.results&&t.db.contacts)try{for(let o of n.results)await t.db.contacts.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save contacts to database:",o)}return await f(t,"hubspot.contacts.search",{...a},"completed"),n};import{logEventFromContext as v}from"corsair/core";var fe=async(t,a)=>{let{dealId:s,...r}=a,n=`/crm/v3/objects/deals/${s}`,o=await d(n,t.key,{query:{...r,properties:r.properties?.join(","),propertiesWithHistory:r.propertiesWithHistory?.join(","),associations:r.associations?.join(",")}});if(o&&t.db.deals)try{await t.db.deals.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to save deal to database:",p)}return await v(t,"hubspot.deals.get",{...a},"completed"),o},ve=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/deals",t.key,{query:{...s,properties:s.properties?.join(","),propertiesWithHistory:s.propertiesWithHistory?.join(","),associations:s.associations?.join(",")}});if(n.results&&t.db.deals)try{for(let o of n.results)await t.db.deals.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save deals to database:",o)}return await v(t,"hubspot.deals.getMany",{...a},"completed"),n},He=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/deals",t.key,{method:"POST",body:s});if(n&&t.db.deals)try{await t.db.deals.upsertByEntityId(n.id,n)}catch(o){console.warn("Failed to save deal to database:",o)}return await v(t,"hubspot.deals.create",{...a},"completed"),n},Re=async(t,a)=>{let{dealId:s,...r}=a,n=`/crm/v3/objects/deals/${s}`,o=await d(n,t.key,{method:"PATCH",body:r});if(o&&t.db.deals)try{await t.db.deals.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to update deal in database:",p)}return await v(t,"hubspot.deals.update",{...a},"completed"),o},we=async(t,a)=>{let{dealId:s}=a,r=`/crm/v3/objects/deals/${s}`;if(await d(r,t.key,{method:"DELETE"}),t.db.deals)try{await t.db.deals.deleteByEntityId(s)}catch(n){console.warn("Failed to delete deal from database:",n)}await v(t,"hubspot.deals.delete",{...a},"completed")},Ie=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/deals",t.key,{query:s});return await v(t,"hubspot.deals.getRecentlyCreated",{...a},"completed"),n},De=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/deals",t.key,{query:s});return await v(t,"hubspot.deals.getRecentlyUpdated",{...a},"completed"),n},Te=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/deals/search",t.key,{method:"POST",body:s});return await v(t,"hubspot.deals.search",{...a},"completed"),n};import{logEventFromContext as G}from"corsair/core";var je=async(t,a)=>{let{engagementId:s}=a,r=`/crm/v3/objects/engagements/${s}`,n=await d(r,t.key);if(n&&t.db.engagements)try{await t.db.engagements.upsertByEntityId(n.id,{...n})}catch(o){console.warn("Failed to save engagement to database:",o)}return await G(t,"hubspot.engagements.get",{...a},"completed"),n},Ge=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/engagements",t.key,{query:s});if(n.results&&t.db.engagements)try{for(let o of n.results)await t.db.engagements.upsertByEntityId(o.id,{...o})}catch(o){console.warn("Failed to save engagements to database:",o)}return await G(t,"hubspot.engagements.getMany",{...a},"completed"),n},Ue=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/engagements",t.key,{method:"POST",body:s});if(n&&t.db.engagements)try{await t.db.engagements.upsertByEntityId(n.id,{...n})}catch(o){console.warn("Failed to save engagement to database:",o)}return await G(t,"hubspot.engagements.create",{...a},"completed"),n},Ae=async(t,a)=>{let{engagementId:s}=a,r=`/crm/v3/objects/engagements/${s}`;if(await d(r,t.key,{method:"DELETE"}),t.db.engagements)try{await t.db.engagements.deleteByEntityId(s)}catch(n){console.warn("Failed to delete engagement from database:",n)}await G(t,"hubspot.engagements.delete",{...a},"completed")};import{logEventFromContext as I}from"corsair/core";var Me=async(t,a)=>{let{ticketId:s,...r}=a,n=`/crm/v3/objects/tickets/${s}`,o=await d(n,t.key,{query:{...r,properties:r.properties?.join(","),propertiesWithHistory:r.propertiesWithHistory?.join(","),associations:r.associations?.join(",")}});if(o&&t.db.tickets)try{await t.db.tickets.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to save ticket to database:",p)}return await I(t,"hubspot.tickets.get",{...a},"completed"),o},Pe=async(t,a)=>{let{...s}=a||{},n=await d("/crm/v3/objects/tickets",t.key,{query:{...s,properties:s.properties?.join(","),propertiesWithHistory:s.propertiesWithHistory?.join(","),associations:s.associations?.join(",")}});if(n.results&&t.db.tickets)try{for(let o of n.results)await t.db.tickets.upsertByEntityId(o.id,o)}catch(o){console.warn("Failed to save tickets to database:",o)}return await I(t,"hubspot.tickets.getMany",{...a},"completed"),n},We=async(t,a)=>{let{...s}=a,n=await d("/crm/v3/objects/tickets",t.key,{method:"POST",body:s});if(n&&t.db.tickets)try{await t.db.tickets.upsertByEntityId(n.id,n)}catch(o){console.warn("Failed to save ticket to database:",o)}return await I(t,"hubspot.tickets.create",{...a},"completed"),n},xe=async(t,a)=>{let{ticketId:s,...r}=a,n=`/crm/v3/objects/tickets/${s}`,o=await d(n,t.key,{method:"PATCH",body:r});if(o&&t.db.tickets)try{await t.db.tickets.upsertByEntityId(o.id,o)}catch(p){console.warn("Failed to update ticket in database:",p)}return await I(t,"hubspot.tickets.update",{...a},"completed"),o},Le=async(t,a)=>{let{ticketId:s}=a,r=`/crm/v3/objects/tickets/${s}`;if(await d(r,t.key,{method:"DELETE"}),t.db.tickets)try{await t.db.tickets.deleteByEntityId(s)}catch(n){console.warn("Failed to delete ticket from database:",n)}await I(t,"hubspot.tickets.delete",{...a},"completed")};import{z as e}from"zod";var ht=e.object({contactId:e.string(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional(),idProperty:e.string().optional()}),St=e.object({limit:e.number().optional(),after:e.string().optional(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional()}),Ct=e.object({properties:e.record(e.string(),e.string()).optional(),associations:e.array(e.object({to:e.object({id:e.string()}),types:e.array(e.object({associationCategory:e.string(),associationTypeId:e.number()}))})).optional()}),Et=e.object({contactId:e.string(),properties:e.record(e.string(),e.string()).optional()}),kt=e.object({contactId:e.string()}),ft=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),vt=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),Ht=e.enum(["BETWEEN","CONTAINS_TOKEN","EQ","GT","GTE","HAS_PROPERTY","IN","LT","LTE","NEQ","NOT_CONTAINS_TOKEN","NOT_HAS_PROPERTY","NOT_IN"]),Rt=e.object({operator:Ht,propertyName:e.string(),highValue:e.string().optional(),value:e.string().optional(),values:e.array(e.string()).optional()}),Oe=e.object({filters:e.array(Rt)}),wt=e.enum(["ASCENDING","DESCENDING"]),Fe=e.object({propertyName:e.string(),direction:wt}),It=e.object({id:e.string(),type:e.string().optional()}),Dt=e.object({results:e.array(It)}),T=e.record(e.string(),e.union([Dt,e.array(e.string())])),Tt=e.object({query:e.string().optional(),limit:e.number().optional(),after:e.string().optional(),sorts:e.array(Fe).optional(),properties:e.array(e.string()).optional(),filterGroups:e.array(Oe).optional()}),jt=e.object({companyId:e.string(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional(),idProperty:e.string().optional()}),Gt=e.object({limit:e.number().optional(),after:e.string().optional(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional()}),Ut=e.object({properties:e.record(e.string(),e.string()).optional(),associations:e.array(e.object({to:e.object({id:e.string()}),types:e.array(e.object({associationCategory:e.string(),associationTypeId:e.number()}))})).optional()}),At=e.object({companyId:e.string(),properties:e.record(e.string(),e.string()).optional()}),Mt=e.object({companyId:e.string()}),Pt=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),Wt=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),xt=e.object({domain:e.string(),properties:e.array(e.string()).optional()}),Lt=e.object({dealId:e.string(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional(),idProperty:e.string().optional()}),Bt=e.object({limit:e.number().optional(),after:e.string().optional(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional()}),Ot=e.object({properties:e.record(e.string(),e.string()).optional(),associations:e.array(e.object({to:e.object({id:e.string()}),types:e.array(e.object({associationCategory:e.string(),associationTypeId:e.number()}))})).optional()}),Ft=e.object({dealId:e.string(),properties:e.record(e.string(),e.string()).optional()}),Nt=e.object({dealId:e.string()}),zt=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),Vt=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),_t=e.object({query:e.string().optional(),limit:e.number().optional(),after:e.string().optional(),sorts:e.array(Fe).optional(),properties:e.array(e.string()).optional(),filterGroups:e.array(Oe).optional()}),$t=e.object({ticketId:e.string(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional(),idProperty:e.string().optional()}),qt=e.object({limit:e.number().optional(),after:e.string().optional(),properties:e.array(e.string()).optional(),propertiesWithHistory:e.array(e.string()).optional(),associations:e.array(e.string()).optional(),archived:e.boolean().optional()}),Kt=e.object({properties:e.record(e.string(),e.string()).optional(),associations:e.array(e.object({to:e.object({id:e.string()}),types:e.array(e.object({associationCategory:e.string(),associationTypeId:e.number()}))})).optional()}),Qt=e.object({ticketId:e.string(),properties:e.record(e.string(),e.string()).optional()}),Yt=e.object({ticketId:e.string()}),Jt=e.object({engagementId:e.string()}),Xt=e.object({limit:e.number().optional(),after:e.string().optional()}),Zt=e.object({engagement:e.object({active:e.boolean().optional(),type:e.string(),timestamp:e.number().optional()}),associations:e.object({contactIds:e.array(e.number()).optional(),companyIds:e.array(e.number()).optional(),dealIds:e.array(e.number()).optional(),ownerIds:e.array(e.number()).optional()}).optional(),metadata:e.record(e.string(),e.any()).optional()}),eo=e.object({engagementId:e.string()}),to=e.object({listId:e.string(),emails:e.array(e.string()).optional(),vids:e.array(e.number()).optional()}),oo=e.object({listId:e.string(),emails:e.array(e.string()).optional(),vids:e.array(e.number()).optional()}),l={contactsGet:ht,contactsGetMany:St,contactsCreate:Ct,contactsUpdate:Et,contactsDelete:kt,contactsGetRecentlyCreated:ft,contactsGetRecentlyUpdated:vt,contactsSearch:Tt,companiesGet:jt,companiesGetMany:Gt,companiesCreate:Ut,companiesUpdate:At,companiesDelete:Mt,companiesGetRecentlyCreated:Pt,companiesGetRecentlyUpdated:Wt,companiesSearchByDomain:xt,dealsGet:Lt,dealsGetMany:Bt,dealsCreate:Ot,dealsUpdate:Ft,dealsDelete:Nt,dealsGetRecentlyCreated:zt,dealsGetRecentlyUpdated:Vt,dealsSearch:_t,ticketsGet:$t,ticketsGetMany:qt,ticketsCreate:Kt,ticketsUpdate:Qt,ticketsDelete:Yt,engagementsGet:Jt,engagementsGetMany:Xt,engagementsCreate:Zt,engagementsDelete:eo,contactListsAddContact:to,contactListsRemoveContact:oo},M=e.object({id:e.string(),properties:e.record(e.string(),e.string()).optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archived:e.boolean().optional(),associations:T.optional()}).loose(),D=e.object({id:e.string(),properties:e.record(e.string(),e.string()).optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archived:e.boolean().optional(),associations:T.optional()}).loose(),P=e.object({id:e.string(),properties:e.record(e.string(),e.string()).optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archived:e.boolean().optional(),associations:T.optional()}).loose(),W=e.object({id:e.string(),properties:e.record(e.string(),e.string()).optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archived:e.boolean().optional(),associations:T.optional()}).loose(),z=e.object({id:e.string(),engagement:e.object({id:e.number().optional(),portalId:e.number().optional(),active:e.boolean().optional(),createdAt:e.number().optional(),lastUpdated:e.number().optional(),createdBy:e.number().optional(),modifiedBy:e.number().optional(),ownerId:e.number().optional(),type:e.string().optional(),timestamp:e.number().optional()}).optional(),associations:T.optional(),metadata:e.record(e.string(),e.any()).optional()}).loose(),R=e.object({next:e.object({after:e.string()}).optional(),prev:e.object({before:e.string()}).optional()}),U=e.object({total:e.number().optional(),results:e.array(M).optional(),paging:R.optional()}).loose(),N=e.object({total:e.number().optional(),results:e.array(D).optional(),paging:R.optional()}).loose(),A=e.object({total:e.number().optional(),results:e.array(P).optional(),paging:R.optional()}).loose(),ao=e.object({results:e.array(W).optional(),paging:R.optional()}).loose(),no=e.object({results:e.array(z).optional(),paging:R.optional()}).loose(),so=e.object({total:e.number().optional(),results:e.array(D).optional(),paging:R.optional()}).loose(),Be=e.object({updated:e.array(e.number()).optional(),discarded:e.array(e.number()).optional(),invalidVids:e.array(e.number()).optional(),invalidEmails:e.array(e.string()).optional()}),y={contactsGet:M,contactsGetMany:U,contactsCreate:M,contactsUpdate:M,contactsDelete:e.void(),contactsGetRecentlyCreated:U,contactsGetRecentlyUpdated:U,contactsSearch:U,companiesGet:D,companiesGetMany:N,companiesCreate:D,companiesUpdate:D,companiesDelete:e.void(),companiesGetRecentlyCreated:N,companiesGetRecentlyUpdated:N,companiesSearchByDomain:so,dealsGet:P,dealsGetMany:A,dealsCreate:P,dealsUpdate:P,dealsDelete:e.void(),dealsGetRecentlyCreated:A,dealsGetRecentlyUpdated:A,dealsSearch:A,ticketsGet:W,ticketsGetMany:ao,ticketsCreate:W,ticketsUpdate:W,ticketsDelete:e.void(),engagementsGet:z,engagementsGetMany:no,engagementsCreate:z,engagementsDelete:e.void(),contactListsAddContact:Be,contactListsRemoveContact:Be};var S={get:me,getMany:be,create:ge,update:he,delete:Se,getRecentlyCreated:Ce,getRecentlyUpdated:Ee,search:ke},C={get:ae,getMany:ne,create:se,update:re,delete:pe,getRecentlyCreated:ce,getRecentlyUpdated:ie,searchByDomain:de},E={get:fe,getMany:ve,create:He,update:Re,delete:we,getRecentlyCreated:Ie,getRecentlyUpdated:De,search:Te},w={get:Me,getMany:Pe,create:We,update:xe,delete:Le},j={get:je,getMany:Ge,create:Ue,delete:Ae},V={addContact:ye,removeContact:ue};import{ApiError as Ne}from"corsair/http";var ze={PERMISSION_ERROR:{match:(t,a)=>{if((t instanceof Ne&&t.status===403||t instanceof H&&t.code===403)&&a.operation.toLowerCase().includes("tickets"))return!0;let s=t.message.toLowerCase();return s.includes("forbidden")||s.includes("permission denied")||s.includes("access denied")},handler:async(t,a)=>({maxRetries:0})},VALIDATION_ERROR:{match:(t,a)=>!!((t instanceof Ne&&t.status===400||t instanceof H&&t.code===400)&&a.operation.toLowerCase().includes("engagements.create")),handler:async(t,a)=>({maxRetries:0})},DEFAULT:{match:(t,a)=>!0,handler:async(t,a)=>(console.error(`[corsair:${a.pluginId}:${a.operation}]`,{error:t.message,input:a.input}),{maxRetries:0})}};import{z as Qe}from"zod";import{z as c}from"zod";var Ve=c.object({id:c.string(),properties:c.record(c.string(),c.any()).optional(),createdAt:c.coerce.date().nullable().optional(),updatedAt:c.coerce.date().nullable().optional(),archived:c.boolean().optional()}),_e=c.object({id:c.string(),properties:c.record(c.string(),c.any()).optional(),createdAt:c.coerce.date().nullable().optional(),updatedAt:c.coerce.date().nullable().optional(),archived:c.boolean().optional()}),$e=c.object({id:c.string(),properties:c.record(c.string(),c.any()).optional(),createdAt:c.coerce.date().nullable().optional(),updatedAt:c.coerce.date().nullable().optional(),archived:c.boolean().optional()}),qe=c.object({id:c.string(),properties:c.record(c.string(),c.any()).optional(),createdAt:c.coerce.date().nullable().optional(),updatedAt:c.coerce.date().nullable().optional(),archived:c.boolean().optional()}),Ke=c.object({id:c.string(),engagement:c.object({id:c.number().optional(),portalId:c.number().optional(),active:c.boolean().optional(),createdAt:c.number().optional(),lastUpdated:c.number().optional(),createdBy:c.number().optional(),modifiedBy:c.number().optional(),ownerId:c.number().optional(),type:c.string().optional(),timestamp:c.number().optional()}).optional(),associations:c.record(c.string(),c.any()).optional(),metadata:c.record(c.string(),c.any()).optional()});var Oo=Qe.object({token:Qe.string()}),Ye={version:"1.0.0",entities:{contacts:Ve,companies:_e,deals:$e,tickets:qe,engagements:Ke}};import{verifyHmacSignature as ro}from"corsair/http";import{z as i}from"zod";var h=i.object({subscriptionId:i.number(),portalId:i.number(),occurredAt:i.number(),subscriptionType:i.string(),attemptNumber:i.number(),objectId:i.number().optional(),propertyName:i.string().optional(),propertyValue:i.string().optional(),changeSource:i.string().optional(),eventId:i.string().optional()}),_=h.extend({subscriptionType:i.literal("contact.creation"),objectId:i.number()}),$=h.extend({subscriptionType:i.literal("contact.propertyChange"),objectId:i.number(),propertyName:i.string(),propertyValue:i.string()}),q=h.extend({subscriptionType:i.literal("contact.deletion"),objectId:i.number()}),K=h.extend({subscriptionType:i.literal("company.creation"),objectId:i.number()}),Q=h.extend({subscriptionType:i.literal("company.propertyChange"),objectId:i.number(),propertyName:i.string(),propertyValue:i.string()}),Y=h.extend({subscriptionType:i.literal("company.deletion"),objectId:i.number()}),J=h.extend({subscriptionType:i.literal("deal.creation"),objectId:i.number()}),X=h.extend({subscriptionType:i.literal("deal.propertyChange"),objectId:i.number(),propertyName:i.string(),propertyValue:i.string()}),Z=h.extend({subscriptionType:i.literal("deal.deletion"),objectId:i.number()}),ee=h.extend({subscriptionType:i.literal("ticket.creation"),objectId:i.number()}),te=h.extend({subscriptionType:i.literal("ticket.propertyChange"),objectId:i.number(),propertyName:i.string(),propertyValue:i.string()}),oe=h.extend({subscriptionType:i.literal("ticket.deletion"),objectId:i.number()}),Vo=i.union([_,$,q,K,Q,Y,J,X,Z,ee,te,oe]);function po(t){return typeof t=="string"?JSON.parse(t):t}function m(t,a){if(!a)return{valid:!1};let s=t.rawBody;if(!s)return{valid:!1,error:"Missing raw body for signature verification"};let r=t.headers,n=Array.isArray(r["x-hubspot-signature-v3"])?r["x-hubspot-signature-v3"][0]:r["x-hubspot-signature-v3"];return n?ro(s,a,n)?{valid:!0}:{valid:!1,error:"Invalid signature"}:{valid:!1,error:"Missing x-hubspot-signature-v3 header"}}function b(t){return a=>{let s=po(a.body);return(Array.isArray(s)?s:[s]).some(n=>typeof n=="object"&&n!==null&&"subscriptionType"in n&&typeof n.subscriptionType=="string"&&n.subscriptionType===t)}}var Je={match:b("company.creation"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="company.creation"&&(console.log("\u{1F3E2} HubSpot Company Created:",{objectId:o.objectId,portalId:o.portalId}),t.db.companies&&o.objectId))try{await t.db.companies.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{},createdAt:new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to save company to database:",p)}return{success:!0,data:{success:!0}}}},Xe={match:b("company.propertyChange"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="company.propertyChange"&&(console.log("\u{1F4DD} HubSpot Company Updated:",{objectId:o.objectId,propertyName:o.propertyName,propertyValue:o.propertyValue}),t.db.companies&&o.objectId))try{let p=await t.db.companies.findByEntityId(o.objectId.toString());await t.db.companies.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{...p?.data?.properties||{},[o.propertyName||""]:o.propertyValue},createdAt:p?.data?.createdAt||new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to update company in database:",p)}return{success:!0,data:{success:!0}}}},Ze={match:b("company.deletion"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="company.deletion"&&(console.log("\u{1F5D1}\uFE0F HubSpot Company Deleted:",{objectId:o.objectId,portalId:o.portalId}),t.db.companies&&o.objectId))try{await t.db.companies.deleteByEntityId(o.objectId.toString())}catch(p){console.warn("Failed to delete company from database:",p)}return{success:!0,data:{success:!0}}}};var et={match:b("contact.creation"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="contact.creation"&&(console.log("\u{1F464} HubSpot Contact Created:",{objectId:o.objectId,portalId:o.portalId}),t.db.contacts&&o.objectId))try{await t.db.contacts.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{},createdAt:new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to save contact to database:",p)}return{success:!0,data:{success:!0}}}},tt={match:b("contact.propertyChange"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="contact.propertyChange"&&(console.log("\u{1F4DD} HubSpot Contact Updated:",{objectId:o.objectId,propertyName:o.propertyName,propertyValue:o.propertyValue}),t.db.contacts&&o.objectId))try{let p=await t.db.contacts.findByEntityId(o.objectId.toString());await t.db.contacts.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{...p?.data?.properties||{},[o.propertyName||""]:o.propertyValue},createdAt:p?.data?.createdAt||new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to update contact in database:",p)}return{success:!0,data:{success:!0}}}},ot={match:b("contact.deletion"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="contact.deletion"&&(console.log("\u{1F5D1}\uFE0F HubSpot Contact Deleted:",{objectId:o.objectId,portalId:o.portalId}),t.db.contacts&&o.objectId))try{await t.db.contacts.deleteByEntityId(o.objectId.toString())}catch(p){console.warn("Failed to delete contact from database:",p)}return{success:!0,data:{success:!0}}}};var at={match:b("deal.creation"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="deal.creation"&&(console.log("\u{1F4BC} HubSpot Deal Created:",{objectId:o.objectId,portalId:o.portalId}),t.db.deals&&o.objectId))try{await t.db.deals.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{},createdAt:new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to save deal to database:",p)}return{success:!0,data:{success:!0}}}},nt={match:b("deal.propertyChange"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="deal.propertyChange"&&(console.log("\u{1F4DD} HubSpot Deal Updated:",{objectId:o.objectId,propertyName:o.propertyName,propertyValue:o.propertyValue}),t.db.deals&&o.objectId))try{let p=await t.db.deals.findByEntityId(o.objectId.toString());await t.db.deals.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{...p?.data?.properties||{},[o.propertyName||""]:o.propertyValue},createdAt:p?.data?.createdAt||new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to update deal in database:",p)}return{success:!0,data:{success:!0}}}},st={match:b("deal.deletion"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="deal.deletion"&&(console.log("\u{1F5D1}\uFE0F HubSpot Deal Deleted:",{objectId:o.objectId,portalId:o.portalId}),t.db.deals&&o.objectId))try{await t.db.deals.deleteByEntityId(o.objectId.toString())}catch(p){console.warn("Failed to delete deal from database:",p)}return{success:!0,data:{success:!0}}}};var rt={match:b("ticket.creation"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="ticket.creation"&&(console.log("\u{1F3AB} HubSpot Ticket Created:",{objectId:o.objectId,portalId:o.portalId}),t.db.tickets&&o.objectId))try{await t.db.tickets.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{},createdAt:new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to save ticket to database:",p)}return{success:!0,data:{success:!0}}}},pt={match:b("ticket.propertyChange"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="ticket.propertyChange"&&(console.log("\u{1F4DD} HubSpot Ticket Updated:",{objectId:o.objectId,propertyName:o.propertyName,propertyValue:o.propertyValue}),t.db.tickets&&o.objectId))try{let p=await t.db.tickets.findByEntityId(o.objectId.toString());await t.db.tickets.upsertByEntityId(o.objectId.toString(),{id:o.objectId.toString(),properties:{...p?.data?.properties||{},[o.propertyName||""]:o.propertyValue},createdAt:p?.data?.createdAt||new Date(o.occurredAt),updatedAt:new Date(o.occurredAt)})}catch(p){console.warn("Failed to update ticket in database:",p)}return{success:!0,data:{success:!0}}}},ct={match:b("ticket.deletion"),handler:async(t,a)=>{let s=t.key,r=m(a,s);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let n=Array.isArray(a.payload)?a.payload:[a.payload];for(let o of n)if(o.subscriptionType==="ticket.deletion"&&(console.log("\u{1F5D1}\uFE0F HubSpot Ticket Deleted:",{objectId:o.objectId,portalId:o.portalId}),t.db.tickets&&o.objectId))try{await t.db.tickets.deleteByEntityId(o.objectId.toString())}catch(p){console.warn("Failed to delete ticket from database:",p)}return{success:!0,data:{success:!0}}}};var x={created:et,updated:tt,deleted:ot},L={created:Je,updated:Xe,deleted:Ze},B={created:at,updated:nt,deleted:st},O={created:rt,updated:pt,deleted:ct};var co={contacts:{get:S.get,getMany:S.getMany,create:S.create,update:S.update,delete:S.delete,getRecentlyCreated:S.getRecentlyCreated,getRecentlyUpdated:S.getRecentlyUpdated,search:S.search},companies:{get:C.get,getMany:C.getMany,create:C.create,update:C.update,delete:C.delete,getRecentlyCreated:C.getRecentlyCreated,getRecentlyUpdated:C.getRecentlyUpdated,searchByDomain:C.searchByDomain},deals:{get:E.get,getMany:E.getMany,create:E.create,update:E.update,delete:E.delete,getRecentlyCreated:E.getRecentlyCreated,getRecentlyUpdated:E.getRecentlyUpdated,search:E.search},tickets:{get:w.get,getMany:w.getMany,create:w.create,update:w.update,delete:w.delete},engagements:{get:j.get,getMany:j.getMany,create:j.create,delete:j.delete},contactLists:{addContact:V.addContact,removeContact:V.removeContact}},io={"contacts.get":{input:l.contactsGet,output:y.contactsGet},"contacts.getMany":{input:l.contactsGetMany,output:y.contactsGetMany},"contacts.create":{input:l.contactsCreate,output:y.contactsCreate},"contacts.update":{input:l.contactsUpdate,output:y.contactsUpdate},"contacts.delete":{input:l.contactsDelete,output:y.contactsDelete},"contacts.getRecentlyCreated":{input:l.contactsGetRecentlyCreated,output:y.contactsGetRecentlyCreated},"contacts.getRecentlyUpdated":{input:l.contactsGetRecentlyUpdated,output:y.contactsGetRecentlyUpdated},"contacts.search":{input:l.contactsSearch,output:y.contactsSearch},"companies.get":{input:l.companiesGet,output:y.companiesGet},"companies.getMany":{input:l.companiesGetMany,output:y.companiesGetMany},"companies.create":{input:l.companiesCreate,output:y.companiesCreate},"companies.update":{input:l.companiesUpdate,output:y.companiesUpdate},"companies.delete":{input:l.companiesDelete,output:y.companiesDelete},"companies.getRecentlyCreated":{input:l.companiesGetRecentlyCreated,output:y.companiesGetRecentlyCreated},"companies.getRecentlyUpdated":{input:l.companiesGetRecentlyUpdated,output:y.companiesGetRecentlyUpdated},"companies.searchByDomain":{input:l.companiesSearchByDomain,output:y.companiesSearchByDomain},"deals.get":{input:l.dealsGet,output:y.dealsGet},"deals.getMany":{input:l.dealsGetMany,output:y.dealsGetMany},"deals.create":{input:l.dealsCreate,output:y.dealsCreate},"deals.update":{input:l.dealsUpdate,output:y.dealsUpdate},"deals.delete":{input:l.dealsDelete,output:y.dealsDelete},"deals.getRecentlyCreated":{input:l.dealsGetRecentlyCreated,output:y.dealsGetRecentlyCreated},"deals.getRecentlyUpdated":{input:l.dealsGetRecentlyUpdated,output:y.dealsGetRecentlyUpdated},"deals.search":{input:l.dealsSearch,output:y.dealsSearch},"tickets.get":{input:l.ticketsGet,output:y.ticketsGet},"tickets.getMany":{input:l.ticketsGetMany,output:y.ticketsGetMany},"tickets.create":{input:l.ticketsCreate,output:y.ticketsCreate},"tickets.update":{input:l.ticketsUpdate,output:y.ticketsUpdate},"tickets.delete":{input:l.ticketsDelete,output:y.ticketsDelete},"engagements.get":{input:l.engagementsGet,output:y.engagementsGet},"engagements.getMany":{input:l.engagementsGetMany,output:y.engagementsGetMany},"engagements.create":{input:l.engagementsCreate,output:y.engagementsCreate},"engagements.delete":{input:l.engagementsDelete,output:y.engagementsDelete},"contactLists.addContact":{input:l.contactListsAddContact,output:y.contactListsAddContact},"contactLists.removeContact":{input:l.contactListsRemoveContact,output:y.contactListsRemoveContact}},lo={contactCreated:x.created,contactUpdated:x.updated,contactDeleted:x.deleted,companyCreated:L.created,companyUpdated:L.updated,companyDeleted:L.deleted,dealCreated:B.created,dealUpdated:B.updated,dealDeleted:B.deleted,ticketCreated:O.created,ticketUpdated:O.updated,ticketDeleted:O.deleted},yo={contactCreated:{description:"A new contact was created",payload:_,response:u.object({success:u.boolean()})},contactUpdated:{description:"A contact property was updated",payload:$,response:u.object({success:u.boolean()})},contactDeleted:{description:"A contact was deleted",payload:q,response:u.object({success:u.boolean()})},companyCreated:{description:"A new company was created",payload:K,response:u.object({success:u.boolean()})},companyUpdated:{description:"A company property was updated",payload:Q,response:u.object({success:u.boolean()})},companyDeleted:{description:"A company was deleted",payload:Y,response:u.object({success:u.boolean()})},dealCreated:{description:"A new deal was created",payload:J,response:u.object({success:u.boolean()})},dealUpdated:{description:"A deal property was updated",payload:X,response:u.object({success:u.boolean()})},dealDeleted:{description:"A deal was deleted",payload:Z,response:u.object({success:u.boolean()})},ticketCreated:{description:"A new support ticket was created",payload:ee,response:u.object({success:u.boolean()})},ticketUpdated:{description:"A support ticket property was updated",payload:te,response:u.object({success:u.boolean()})},ticketDeleted:{description:"A support ticket was deleted",payload:oe,response:u.object({success:u.boolean()})}},uo="api_key",mo={"contacts.get":{riskLevel:"read",description:"Get a specific contact"},"contacts.getMany":{riskLevel:"read",description:"Get multiple contacts"},"contacts.create":{riskLevel:"write",description:"Create a new contact"},"contacts.update":{riskLevel:"write",description:"Update an existing contact"},"contacts.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a contact [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"contacts.getRecentlyCreated":{riskLevel:"read",description:"List recently created contacts"},"contacts.getRecentlyUpdated":{riskLevel:"read",description:"List recently updated contacts"},"contacts.search":{riskLevel:"read",description:"Search contacts"},"companies.get":{riskLevel:"read",description:"Get a specific company"},"companies.getMany":{riskLevel:"read",description:"Get multiple companies"},"companies.create":{riskLevel:"write",description:"Create a new company"},"companies.update":{riskLevel:"write",description:"Update an existing company"},"companies.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a company [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"companies.getRecentlyCreated":{riskLevel:"read",description:"List recently created companies"},"companies.getRecentlyUpdated":{riskLevel:"read",description:"List recently updated companies"},"companies.searchByDomain":{riskLevel:"read",description:"Search companies by domain name"},"deals.get":{riskLevel:"read",description:"Get a specific deal"},"deals.getMany":{riskLevel:"read",description:"Get multiple deals"},"deals.create":{riskLevel:"write",description:"Create a new deal"},"deals.update":{riskLevel:"write",description:"Update an existing deal"},"deals.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a deal [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"deals.getRecentlyCreated":{riskLevel:"read",description:"List recently created deals"},"deals.getRecentlyUpdated":{riskLevel:"read",description:"List recently updated deals"},"deals.search":{riskLevel:"read",description:"Search deals"},"tickets.get":{riskLevel:"read",description:"Get a specific ticket"},"tickets.getMany":{riskLevel:"read",description:"Get multiple tickets"},"tickets.create":{riskLevel:"write",description:"Create a new support ticket"},"tickets.update":{riskLevel:"write",description:"Update an existing ticket"},"tickets.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a ticket [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"engagements.get":{riskLevel:"read",description:"Get a specific engagement"},"engagements.getMany":{riskLevel:"read",description:"Get multiple engagements"},"engagements.create":{riskLevel:"write",description:"Create a new engagement"},"engagements.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete an engagement [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"contactLists.addContact":{riskLevel:"write",description:"Add a contact to a static contact list"},"contactLists.removeContact":{riskLevel:"write",description:"Remove a contact from a static contact list"}};function ua(t={}){let a={...t,authType:t.authType??uo};return{id:"hubspot",oauthConfig:{providerName:"HubSpot",authUrl:"https://app.hubspot.com/oauth/authorize",tokenUrl:"https://api.hubapi.com/oauth/v1/token",scopes:["crm.objects.contacts.read","crm.objects.contacts.write","crm.objects.companies.read","crm.objects.companies.write","crm.objects.deals.read","crm.objects.deals.write"]},schema:Ye,options:a,hooks:a.hooks,webhookHooks:a.webhookHooks,endpoints:co,webhooks:lo,endpointMeta:mo,endpointSchemas:io,webhookSchemas:yo,pluginWebhookMatcher:s=>{let n="x-hubspot-signature-v3"in s.headers,o=s.body,F=(Array.isArray(o)?o:[o]).some(g=>typeof g.subscriptionType=="string"&&g.subscriptionType!==void 0);return n||F},errorHandlers:a.errorHandlers||ze,keyBuilder:async(s,r)=>{let n=s.authType;if(r==="webhook"&&a.webhookSecret)return a.webhookSecret;if(r==="webhook"){let o=await s.keys.get_webhook_signature();if(!o)throw new Error("[auth-missing:hubspot:webhook_signature]: HubSpot webhook signature is missing");return o}if(r==="endpoint"){if(s.authType==="api_key"){let o=await s.keys.get_api_key();if(!o)throw new Error("[auth-missing:hubspot:api_key]: HubSpot API Key is missing");return o}else if(s.authType==="oauth_2"){let o=await s.keys.get_access_token();if(!o)throw new Error("[auth-missing:hubspot:oauth_2]: HubSpot access token is missing");return o}}throw new Error(`[auth-missing:hubspot:${n}]: HubSpot key is missing`)}}}export{b as createHubSpotEventMatch,ua as hubspot,io as hubspotEndpointSchemas,m as verifyHubSpotWebhookSignature};
|