@corsair-dev/hubspot 0.1.3 → 0.1.4
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/endpoints/contacts.d.ts.map +1 -1
- package/dist/endpoints/index.d.ts +28 -2
- package/dist/endpoints/index.d.ts.map +1 -1
- package/dist/endpoints/types.d.ts +34 -2
- package/dist/endpoints/types.d.ts.map +1 -1
- package/dist/index.d.ts +34 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -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;AAOjD,eAAO,MAAM,GAAG,EAAE,gBAAgB,CAAC,aAAa,CA+B/C,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,CAoCvD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,gBAAgB,CAAC,wBAAwB,CAyBpE,CAAC;AAEH,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,
|
|
1
|
+
{"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../endpoints/contacts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAOjD,eAAO,MAAM,GAAG,EAAE,gBAAgB,CAAC,aAAa,CA+B/C,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,CAoCvD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,gBAAgB,CAAC,wBAAwB,CAyBpE,CAAC;AAEH,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;
|
|
@@ -86,6 +87,7 @@ export declare const ContactsEndpoints: {
|
|
|
86
87
|
since?: string | undefined;
|
|
87
88
|
}) => Promise<{
|
|
88
89
|
[x: string]: unknown;
|
|
90
|
+
total?: number | undefined;
|
|
89
91
|
results?: {
|
|
90
92
|
[x: string]: unknown;
|
|
91
93
|
id: string;
|
|
@@ -115,6 +117,7 @@ export declare const ContactsEndpoints: {
|
|
|
115
117
|
since?: string | undefined;
|
|
116
118
|
}) => Promise<{
|
|
117
119
|
[x: string]: unknown;
|
|
120
|
+
total?: number | undefined;
|
|
118
121
|
results?: {
|
|
119
122
|
[x: string]: unknown;
|
|
120
123
|
id: string;
|
|
@@ -142,7 +145,10 @@ export declare const ContactsEndpoints: {
|
|
|
142
145
|
query?: string | undefined;
|
|
143
146
|
limit?: number | undefined;
|
|
144
147
|
after?: string | undefined;
|
|
145
|
-
sorts?:
|
|
148
|
+
sorts?: {
|
|
149
|
+
propertyName: string;
|
|
150
|
+
direction: "ASCENDING" | "DESCENDING";
|
|
151
|
+
}[] | undefined;
|
|
146
152
|
properties?: string[] | undefined;
|
|
147
153
|
filterGroups?: {
|
|
148
154
|
filters: {
|
|
@@ -155,6 +161,7 @@ export declare const ContactsEndpoints: {
|
|
|
155
161
|
}[] | undefined;
|
|
156
162
|
}) => Promise<{
|
|
157
163
|
[x: string]: unknown;
|
|
164
|
+
total?: number | undefined;
|
|
158
165
|
results?: {
|
|
159
166
|
[x: string]: unknown;
|
|
160
167
|
id: string;
|
|
@@ -210,6 +217,7 @@ export declare const CompaniesEndpoints: {
|
|
|
210
217
|
archived?: boolean | undefined;
|
|
211
218
|
}) => Promise<{
|
|
212
219
|
[x: string]: unknown;
|
|
220
|
+
total?: number | undefined;
|
|
213
221
|
results?: {
|
|
214
222
|
[x: string]: unknown;
|
|
215
223
|
id: string;
|
|
@@ -284,6 +292,7 @@ export declare const CompaniesEndpoints: {
|
|
|
284
292
|
since?: string | undefined;
|
|
285
293
|
}) => Promise<{
|
|
286
294
|
[x: string]: unknown;
|
|
295
|
+
total?: number | undefined;
|
|
287
296
|
results?: {
|
|
288
297
|
[x: string]: unknown;
|
|
289
298
|
id: string;
|
|
@@ -313,6 +322,7 @@ export declare const CompaniesEndpoints: {
|
|
|
313
322
|
since?: string | undefined;
|
|
314
323
|
}) => Promise<{
|
|
315
324
|
[x: string]: unknown;
|
|
325
|
+
total?: number | undefined;
|
|
316
326
|
results?: {
|
|
317
327
|
[x: string]: unknown;
|
|
318
328
|
id: string;
|
|
@@ -341,6 +351,7 @@ export declare const CompaniesEndpoints: {
|
|
|
341
351
|
properties?: string[] | undefined;
|
|
342
352
|
}) => Promise<{
|
|
343
353
|
[x: string]: unknown;
|
|
354
|
+
total?: number | undefined;
|
|
344
355
|
results?: {
|
|
345
356
|
[x: string]: unknown;
|
|
346
357
|
id: string;
|
|
@@ -355,6 +366,14 @@ export declare const CompaniesEndpoints: {
|
|
|
355
366
|
}[];
|
|
356
367
|
}> | undefined;
|
|
357
368
|
}[] | undefined;
|
|
369
|
+
paging?: {
|
|
370
|
+
next?: {
|
|
371
|
+
after: string;
|
|
372
|
+
} | undefined;
|
|
373
|
+
prev?: {
|
|
374
|
+
before: string;
|
|
375
|
+
} | undefined;
|
|
376
|
+
} | undefined;
|
|
358
377
|
}>;
|
|
359
378
|
};
|
|
360
379
|
export declare const DealsEndpoints: {
|
|
@@ -388,6 +407,7 @@ export declare const DealsEndpoints: {
|
|
|
388
407
|
archived?: boolean | undefined;
|
|
389
408
|
}) => Promise<{
|
|
390
409
|
[x: string]: unknown;
|
|
410
|
+
total?: number | undefined;
|
|
391
411
|
results?: {
|
|
392
412
|
[x: string]: unknown;
|
|
393
413
|
id: string;
|
|
@@ -462,6 +482,7 @@ export declare const DealsEndpoints: {
|
|
|
462
482
|
since?: string | undefined;
|
|
463
483
|
}) => Promise<{
|
|
464
484
|
[x: string]: unknown;
|
|
485
|
+
total?: number | undefined;
|
|
465
486
|
results?: {
|
|
466
487
|
[x: string]: unknown;
|
|
467
488
|
id: string;
|
|
@@ -491,6 +512,7 @@ export declare const DealsEndpoints: {
|
|
|
491
512
|
since?: string | undefined;
|
|
492
513
|
}) => Promise<{
|
|
493
514
|
[x: string]: unknown;
|
|
515
|
+
total?: number | undefined;
|
|
494
516
|
results?: {
|
|
495
517
|
[x: string]: unknown;
|
|
496
518
|
id: string;
|
|
@@ -518,7 +540,10 @@ export declare const DealsEndpoints: {
|
|
|
518
540
|
query?: string | undefined;
|
|
519
541
|
limit?: number | undefined;
|
|
520
542
|
after?: string | undefined;
|
|
521
|
-
sorts?:
|
|
543
|
+
sorts?: {
|
|
544
|
+
propertyName: string;
|
|
545
|
+
direction: "ASCENDING" | "DESCENDING";
|
|
546
|
+
}[] | undefined;
|
|
522
547
|
properties?: string[] | undefined;
|
|
523
548
|
filterGroups?: {
|
|
524
549
|
filters: {
|
|
@@ -531,6 +556,7 @@ export declare const DealsEndpoints: {
|
|
|
531
556
|
}[] | undefined;
|
|
532
557
|
}) => Promise<{
|
|
533
558
|
[x: string]: unknown;
|
|
559
|
+
total?: number | undefined;
|
|
534
560
|
results?: {
|
|
535
561
|
[x: string]: unknown;
|
|
536
562
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ7B,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"}
|
|
@@ -45,7 +45,13 @@ export declare const HubSpotEndpointInputSchemas: {
|
|
|
45
45
|
query: z.ZodOptional<z.ZodString>;
|
|
46
46
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
47
47
|
after: z.ZodOptional<z.ZodString>;
|
|
48
|
-
sorts: z.ZodOptional<z.ZodArray<z.
|
|
48
|
+
sorts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
49
|
+
propertyName: z.ZodString;
|
|
50
|
+
direction: z.ZodEnum<{
|
|
51
|
+
ASCENDING: "ASCENDING";
|
|
52
|
+
DESCENDING: "DESCENDING";
|
|
53
|
+
}>;
|
|
54
|
+
}, z.core.$strip>>>;
|
|
49
55
|
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
56
|
filterGroups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
51
57
|
filters: z.ZodArray<z.ZodObject<{
|
|
@@ -169,7 +175,13 @@ export declare const HubSpotEndpointInputSchemas: {
|
|
|
169
175
|
query: z.ZodOptional<z.ZodString>;
|
|
170
176
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
171
177
|
after: z.ZodOptional<z.ZodString>;
|
|
172
|
-
sorts: z.ZodOptional<z.ZodArray<z.
|
|
178
|
+
sorts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
179
|
+
propertyName: z.ZodString;
|
|
180
|
+
direction: z.ZodEnum<{
|
|
181
|
+
ASCENDING: "ASCENDING";
|
|
182
|
+
DESCENDING: "DESCENDING";
|
|
183
|
+
}>;
|
|
184
|
+
}, z.core.$strip>>>;
|
|
173
185
|
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
174
186
|
filterGroups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
175
187
|
filters: z.ZodArray<z.ZodObject<{
|
|
@@ -283,6 +295,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
283
295
|
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
284
296
|
}, z.core.$loose>;
|
|
285
297
|
readonly contactsGetMany: z.ZodObject<{
|
|
298
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
286
299
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
287
300
|
id: z.ZodString;
|
|
288
301
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -320,6 +333,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
320
333
|
}, z.core.$loose>;
|
|
321
334
|
readonly contactsDelete: z.ZodVoid;
|
|
322
335
|
readonly contactsGetRecentlyCreated: z.ZodObject<{
|
|
336
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
323
337
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
324
338
|
id: z.ZodString;
|
|
325
339
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -343,6 +357,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
343
357
|
}, z.core.$strip>>;
|
|
344
358
|
}, z.core.$loose>;
|
|
345
359
|
readonly contactsGetRecentlyUpdated: z.ZodObject<{
|
|
360
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
346
361
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
347
362
|
id: z.ZodString;
|
|
348
363
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -366,6 +381,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
366
381
|
}, z.core.$strip>>;
|
|
367
382
|
}, z.core.$loose>;
|
|
368
383
|
readonly contactsSearch: z.ZodObject<{
|
|
384
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
369
385
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
370
386
|
id: z.ZodString;
|
|
371
387
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -402,6 +418,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
402
418
|
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
403
419
|
}, z.core.$loose>;
|
|
404
420
|
readonly companiesGetMany: z.ZodObject<{
|
|
421
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
405
422
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
406
423
|
id: z.ZodString;
|
|
407
424
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -452,6 +469,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
452
469
|
}, z.core.$loose>;
|
|
453
470
|
readonly companiesDelete: z.ZodVoid;
|
|
454
471
|
readonly companiesGetRecentlyCreated: z.ZodObject<{
|
|
472
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
455
473
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
456
474
|
id: z.ZodString;
|
|
457
475
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -475,6 +493,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
475
493
|
}, z.core.$strip>>;
|
|
476
494
|
}, z.core.$loose>;
|
|
477
495
|
readonly companiesGetRecentlyUpdated: z.ZodObject<{
|
|
496
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
478
497
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
479
498
|
id: z.ZodString;
|
|
480
499
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -498,6 +517,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
498
517
|
}, z.core.$strip>>;
|
|
499
518
|
}, z.core.$loose>;
|
|
500
519
|
readonly companiesSearchByDomain: z.ZodObject<{
|
|
520
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
501
521
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
502
522
|
id: z.ZodString;
|
|
503
523
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -511,6 +531,14 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
511
531
|
}, z.core.$strip>>;
|
|
512
532
|
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
513
533
|
}, z.core.$loose>>>;
|
|
534
|
+
paging: z.ZodOptional<z.ZodObject<{
|
|
535
|
+
next: z.ZodOptional<z.ZodObject<{
|
|
536
|
+
after: z.ZodString;
|
|
537
|
+
}, z.core.$strip>>;
|
|
538
|
+
prev: z.ZodOptional<z.ZodObject<{
|
|
539
|
+
before: z.ZodString;
|
|
540
|
+
}, z.core.$strip>>;
|
|
541
|
+
}, z.core.$strip>>;
|
|
514
542
|
}, z.core.$loose>;
|
|
515
543
|
readonly dealsGet: z.ZodObject<{
|
|
516
544
|
id: z.ZodString;
|
|
@@ -526,6 +554,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
526
554
|
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
527
555
|
}, z.core.$loose>;
|
|
528
556
|
readonly dealsGetMany: z.ZodObject<{
|
|
557
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
529
558
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
530
559
|
id: z.ZodString;
|
|
531
560
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -576,6 +605,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
576
605
|
}, z.core.$loose>;
|
|
577
606
|
readonly dealsDelete: z.ZodVoid;
|
|
578
607
|
readonly dealsGetRecentlyCreated: z.ZodObject<{
|
|
608
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
579
609
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
580
610
|
id: z.ZodString;
|
|
581
611
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -599,6 +629,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
599
629
|
}, z.core.$strip>>;
|
|
600
630
|
}, z.core.$loose>;
|
|
601
631
|
readonly dealsGetRecentlyUpdated: z.ZodObject<{
|
|
632
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
602
633
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
603
634
|
id: z.ZodString;
|
|
604
635
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -622,6 +653,7 @@ export declare const HubSpotEndpointOutputSchemas: {
|
|
|
622
653
|
}, z.core.$strip>>;
|
|
623
654
|
}, z.core.$loose>;
|
|
624
655
|
readonly dealsSearch: z.ZodObject<{
|
|
656
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
625
657
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
626
658
|
id: z.ZodString;
|
|
627
659
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -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;AAoUxB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAC,UAAU,CAC9C,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,4BAA4B,CAAC,cAAc,CAClD,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CACzC,OAAO,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
|
@@ -142,6 +142,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
142
142
|
archived: z.ZodOptional<z.ZodBoolean>;
|
|
143
143
|
}, z.core.$strip>;
|
|
144
144
|
readonly output: z.ZodObject<{
|
|
145
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
145
146
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
146
147
|
id: z.ZodString;
|
|
147
148
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -205,6 +206,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
205
206
|
since: z.ZodOptional<z.ZodString>;
|
|
206
207
|
}, z.core.$strip>;
|
|
207
208
|
readonly output: z.ZodObject<{
|
|
209
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
208
210
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
209
211
|
id: z.ZodString;
|
|
210
212
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -235,6 +237,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
235
237
|
since: z.ZodOptional<z.ZodString>;
|
|
236
238
|
}, z.core.$strip>;
|
|
237
239
|
readonly output: z.ZodObject<{
|
|
240
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
238
241
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
239
242
|
id: z.ZodString;
|
|
240
243
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -263,7 +266,13 @@ export declare const hubspotEndpointSchemas: {
|
|
|
263
266
|
query: z.ZodOptional<z.ZodString>;
|
|
264
267
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
265
268
|
after: z.ZodOptional<z.ZodString>;
|
|
266
|
-
sorts: z.ZodOptional<z.ZodArray<z.
|
|
269
|
+
sorts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
270
|
+
propertyName: z.ZodString;
|
|
271
|
+
direction: z.ZodEnum<{
|
|
272
|
+
ASCENDING: "ASCENDING";
|
|
273
|
+
DESCENDING: "DESCENDING";
|
|
274
|
+
}>;
|
|
275
|
+
}, z.core.$strip>>>;
|
|
267
276
|
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
268
277
|
filterGroups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
269
278
|
filters: z.ZodArray<z.ZodObject<{
|
|
@@ -290,6 +299,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
290
299
|
}, z.core.$strip>>>;
|
|
291
300
|
}, z.core.$strip>;
|
|
292
301
|
readonly output: z.ZodObject<{
|
|
302
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
293
303
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
294
304
|
id: z.ZodString;
|
|
295
305
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -346,6 +356,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
346
356
|
archived: z.ZodOptional<z.ZodBoolean>;
|
|
347
357
|
}, z.core.$strip>;
|
|
348
358
|
readonly output: z.ZodObject<{
|
|
359
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
349
360
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
350
361
|
id: z.ZodString;
|
|
351
362
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -428,6 +439,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
428
439
|
since: z.ZodOptional<z.ZodString>;
|
|
429
440
|
}, z.core.$strip>;
|
|
430
441
|
readonly output: z.ZodObject<{
|
|
442
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
431
443
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
432
444
|
id: z.ZodString;
|
|
433
445
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -458,6 +470,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
458
470
|
since: z.ZodOptional<z.ZodString>;
|
|
459
471
|
}, z.core.$strip>;
|
|
460
472
|
readonly output: z.ZodObject<{
|
|
473
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
461
474
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
462
475
|
id: z.ZodString;
|
|
463
476
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -487,6 +500,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
487
500
|
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
488
501
|
}, z.core.$strip>;
|
|
489
502
|
readonly output: z.ZodObject<{
|
|
503
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
490
504
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
491
505
|
id: z.ZodString;
|
|
492
506
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -500,6 +514,14 @@ export declare const hubspotEndpointSchemas: {
|
|
|
500
514
|
}, z.core.$strip>>;
|
|
501
515
|
}, z.core.$strip>, z.ZodArray<z.ZodString>]>>>;
|
|
502
516
|
}, z.core.$loose>>>;
|
|
517
|
+
paging: z.ZodOptional<z.ZodObject<{
|
|
518
|
+
next: z.ZodOptional<z.ZodObject<{
|
|
519
|
+
after: z.ZodString;
|
|
520
|
+
}, z.core.$strip>>;
|
|
521
|
+
prev: z.ZodOptional<z.ZodObject<{
|
|
522
|
+
before: z.ZodString;
|
|
523
|
+
}, z.core.$strip>>;
|
|
524
|
+
}, z.core.$strip>>;
|
|
503
525
|
}, z.core.$loose>;
|
|
504
526
|
};
|
|
505
527
|
readonly 'deals.get': {
|
|
@@ -535,6 +557,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
535
557
|
archived: z.ZodOptional<z.ZodBoolean>;
|
|
536
558
|
}, z.core.$strip>;
|
|
537
559
|
readonly output: z.ZodObject<{
|
|
560
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
538
561
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
539
562
|
id: z.ZodString;
|
|
540
563
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -617,6 +640,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
617
640
|
since: z.ZodOptional<z.ZodString>;
|
|
618
641
|
}, z.core.$strip>;
|
|
619
642
|
readonly output: z.ZodObject<{
|
|
643
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
620
644
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
621
645
|
id: z.ZodString;
|
|
622
646
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -647,6 +671,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
647
671
|
since: z.ZodOptional<z.ZodString>;
|
|
648
672
|
}, z.core.$strip>;
|
|
649
673
|
readonly output: z.ZodObject<{
|
|
674
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
650
675
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
651
676
|
id: z.ZodString;
|
|
652
677
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -675,7 +700,13 @@ export declare const hubspotEndpointSchemas: {
|
|
|
675
700
|
query: z.ZodOptional<z.ZodString>;
|
|
676
701
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
677
702
|
after: z.ZodOptional<z.ZodString>;
|
|
678
|
-
sorts: z.ZodOptional<z.ZodArray<z.
|
|
703
|
+
sorts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
704
|
+
propertyName: z.ZodString;
|
|
705
|
+
direction: z.ZodEnum<{
|
|
706
|
+
ASCENDING: "ASCENDING";
|
|
707
|
+
DESCENDING: "DESCENDING";
|
|
708
|
+
}>;
|
|
709
|
+
}, z.core.$strip>>>;
|
|
679
710
|
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
680
711
|
filterGroups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
681
712
|
filters: z.ZodArray<z.ZodObject<{
|
|
@@ -702,6 +733,7 @@ export declare const hubspotEndpointSchemas: {
|
|
|
702
733
|
}, z.core.$strip>>>;
|
|
703
734
|
}, z.core.$strip>;
|
|
704
735
|
readonly output: z.ZodObject<{
|
|
736
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
705
737
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
706
738
|
id: z.ZodString;
|
|
707
739
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
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,EACrB,sBAAsB,EACtB,6BAA6B,EAC7B,6BAA6B,EAC7B,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 E}from"corsair/core";import{request as it}from"corsair/http";var v=class extends Error{constructor(s,r){super(s);this.code=r;this.name="HubSpotAPIError"}},ct="https://api.hubapi.com";async function d(t,a,s={}){let{method:r="GET",body:n,query:o}=s,p={BASE:ct,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 it(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});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.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 I}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 I(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 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},Oe=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},Pe=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 gt=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()}),ht=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()}),St=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()}),Ct=e.object({contactId:e.string()}),Et=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),kt=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),ft=e.enum(["BETWEEN","CONTAINS_TOKEN","EQ","GT","GTE","HAS_PROPERTY","IN","LT","LTE","NEQ","NOT_CONTAINS_TOKEN","NOT_HAS_PROPERTY","NOT_IN"]),vt=e.object({operator:ft,propertyName:e.string(),highValue:e.string().optional(),value:e.string().optional(),values:e.array(e.string()).optional()}),Le=e.object({filters:e.array(vt)}),Ht=e.enum(["ASCENDING","DESCENDING"]),Be=e.object({propertyName:e.string(),direction:Ht}),Rt=e.object({id:e.string(),type:e.string().optional()}),wt=e.object({results:e.array(Rt)}),T=e.record(e.string(),e.union([wt,e.array(e.string())])),It=e.object({query:e.string().optional(),limit:e.number().optional(),after:e.string().optional(),sorts:e.array(Be).optional(),properties:e.array(e.string()).optional(),filterGroups:e.array(Le).optional()}),Dt=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()}),Tt=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()}),jt=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()}),Gt=e.object({companyId:e.string(),properties:e.record(e.string(),e.string()).optional()}),Ut=e.object({companyId:e.string()}),At=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),Mt=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),Wt=e.object({domain:e.string(),properties:e.array(e.string()).optional()}),Ot=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()}),Pt=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()}),Lt=e.object({dealId:e.string(),properties:e.record(e.string(),e.string()).optional()}),Bt=e.object({dealId:e.string()}),Ft=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),Nt=e.object({count:e.number().optional(),after:e.string().optional(),since:e.string().optional()}),zt=e.object({query:e.string().optional(),limit:e.number().optional(),after:e.string().optional(),sorts:e.array(Be).optional(),properties:e.array(e.string()).optional(),filterGroups:e.array(Le).optional()}),Vt=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()}),_t=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()}),qt=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()}),Kt=e.object({ticketId:e.string()}),Qt=e.object({engagementId:e.string()}),Yt=e.object({limit:e.number().optional(),after:e.string().optional()}),Jt=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()}),Xt=e.object({engagementId:e.string()}),Zt=e.object({listId:e.string(),emails:e.array(e.string()).optional(),vids:e.array(e.number()).optional()}),eo=e.object({listId:e.string(),emails:e.array(e.string()).optional(),vids:e.array(e.number()).optional()}),l={contactsGet:gt,contactsGetMany:ht,contactsCreateOrUpdate:St,contactsDelete:Ct,contactsGetRecentlyCreated:Et,contactsGetRecentlyUpdated:kt,contactsSearch:It,companiesGet:Dt,companiesGetMany:Tt,companiesCreate:jt,companiesUpdate:Gt,companiesDelete:Ut,companiesGetRecentlyCreated:At,companiesGetRecentlyUpdated:Mt,companiesSearchByDomain:Wt,dealsGet:Ot,dealsGetMany:Pt,dealsCreate:xt,dealsUpdate:Lt,dealsDelete:Bt,dealsGetRecentlyCreated:Ft,dealsGetRecentlyUpdated:Nt,dealsSearch:zt,ticketsGet:Vt,ticketsGetMany:_t,ticketsCreate:qt,ticketsUpdate:$t,ticketsDelete:Kt,engagementsGet:Qt,engagementsGetMany:Yt,engagementsCreate:Jt,engagementsDelete:Xt,contactListsAddContact:Zt,contactListsRemoveContact:eo},N=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(),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(),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(N).optional(),paging:R.optional()}).loose(),F=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(M).optional(),paging:R.optional()}).loose(),to=e.object({results:e.array(W).optional(),paging:R.optional()}).loose(),oo=e.object({results:e.array(z).optional(),paging:R.optional()}).loose(),ao=e.object({total:e.number().optional(),results:e.array(D).optional(),paging:R.optional()}).loose(),xe=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:N,contactsGetMany:U,contactsCreateOrUpdate:N,contactsDelete:e.void(),contactsGetRecentlyCreated:U,contactsGetRecentlyUpdated:U,contactsSearch:U,companiesGet:D,companiesGetMany:F,companiesCreate:D,companiesUpdate:D,companiesDelete:e.void(),companiesGetRecentlyCreated:F,companiesGetRecentlyUpdated:F,companiesSearchByDomain:ao,dealsGet:M,dealsGetMany:A,dealsCreate:M,dealsUpdate:M,dealsDelete:e.void(),dealsGetRecentlyCreated:A,dealsGetRecentlyUpdated:A,dealsSearch:A,ticketsGet:W,ticketsGetMany:to,ticketsCreate:W,ticketsUpdate:W,ticketsDelete:e.void(),engagementsGet:z,engagementsGetMany:oo,engagementsCreate:z,engagementsDelete:e.void(),contactListsAddContact:xe,contactListsRemoveContact:xe};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},w={get:Ae,getMany:Me,create:We,update:Oe,delete:Pe},j={get:Te,getMany:je,create:Ge,delete:Ue},V={addContact:ye,removeContact:ue};import{ApiError as Fe}from"corsair/http";var Ne={PERMISSION_ERROR:{match:(t,a)=>{if((t instanceof Fe&&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 Fe&&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 Ke}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()}),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(),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(),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=Ke.object({token:Ke.string()}),Qe={version:"1.0.0",entities:{contacts:ze,companies:Ve,deals:_e,tickets:qe,engagements:$e}};import{verifyHmacSignature as no}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()}),No=c.union([_,q,$,K,Q,Y,J,X,Z,ee,te,oe]);function so(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?no(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=so(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 Ye={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}}}},Je={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}}}},Xe={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 Ze={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}}}},et={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}}}},tt={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 ot={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}}}},at={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}}}},nt={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 st={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}}}},rt={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}}}},pt={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 O={created:Ze,updated:et,deleted:tt},P={created:Ye,updated:Je,deleted:Xe},x={created:ot,updated:at,deleted:nt},L={created:st,updated:rt,deleted:pt};var ro={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: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}},po={"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}},io={contactCreated:O.created,contactUpdated:O.updated,contactDeleted:O.deleted,companyCreated:P.created,companyUpdated:P.updated,companyDeleted:P.deleted,dealCreated:x.created,dealUpdated:x.updated,dealDeleted:x.deleted,ticketCreated:L.created,ticketUpdated:L.updated,ticketDeleted:L.deleted},co={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()})}},lo="api_key",yo={"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 la(t={}){let a={...t,authType:t.authType??lo};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:Qe,options:a,hooks:a.hooks,webhookHooks:a.webhookHooks,endpoints:ro,webhooks:io,endpointMeta:yo,endpointSchemas:po,webhookSchemas:co,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||Ne,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,la as hubspot,po as hubspotEndpointSchemas,m as verifyHubSpotWebhookSignature};
|