@keystrokehq/zendesk 0.0.1 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/dist/_official/index.d.mts +1 -1
  3. package/dist/_official/index.mjs +1 -1
  4. package/dist/_runtime/index.d.mts +58 -61
  5. package/dist/_runtime/index.mjs +2 -5
  6. package/dist/client.d.mts +1 -1
  7. package/dist/client.mjs +1 -1
  8. package/dist/custom/connection.d.mts +1 -1
  9. package/dist/custom/connection.mjs +1 -1
  10. package/dist/custom/jobs.d.mts +1 -1
  11. package/dist/custom/jobs.mjs +1 -1
  12. package/dist/custom/organizations.d.mts +1 -1
  13. package/dist/custom/organizations.mjs +1 -1
  14. package/dist/custom/search.d.mts +1 -1
  15. package/dist/custom/search.mjs +1 -1
  16. package/dist/custom/tickets.d.mts +1 -1
  17. package/dist/custom/tickets.mjs +1 -1
  18. package/dist/custom/triggers.d.mts +1 -1
  19. package/dist/custom/triggers.mjs +1 -1
  20. package/dist/custom/users.d.mts +1 -1
  21. package/dist/custom/users.mjs +1 -1
  22. package/dist/custom.d.mts +1 -1
  23. package/dist/custom.mjs +1 -1
  24. package/dist/{factory-BOeuadDj.mjs → factory-WTOw2H-8.mjs} +1 -1
  25. package/dist/{integration-BYDT8ccc.d.mts → integration-D1C2E4Le.d.mts} +3 -3
  26. package/dist/{integration-BGHdDCMn.mjs → integration-D4AfP9bV.mjs} +2 -2
  27. package/dist/{jobs-9tdPkCE1.d.mts → jobs-b1iHVfk8.d.mts} +2 -2
  28. package/dist/{jobs-BjDRvbsd.mjs → jobs-l78KJLUt.mjs} +1 -1
  29. package/dist/{organizations-Ct_354Ea.d.mts → organizations-BhzeGbyt.d.mts} +16 -16
  30. package/dist/{organizations-BHCFYHgM.mjs → organizations-BlZQExWH.mjs} +1 -1
  31. package/dist/platform/connection.d.mts +1 -1
  32. package/dist/platform/connection.mjs +1 -1
  33. package/dist/platform/jobs.d.mts +1 -1
  34. package/dist/platform/jobs.mjs +1 -1
  35. package/dist/platform/organizations.d.mts +1 -1
  36. package/dist/platform/organizations.mjs +1 -1
  37. package/dist/platform/search.d.mts +1 -1
  38. package/dist/platform/search.mjs +1 -1
  39. package/dist/platform/tickets.d.mts +1 -1
  40. package/dist/platform/tickets.mjs +1 -1
  41. package/dist/platform/triggers.d.mts +2 -2
  42. package/dist/platform/triggers.mjs +2 -2
  43. package/dist/platform/users.d.mts +1 -1
  44. package/dist/platform/users.mjs +1 -1
  45. package/dist/platform.d.mts +2 -2
  46. package/dist/platform.mjs +2 -2
  47. package/dist/{search-BpPJ9ccR.mjs → search-BNNAbuXu.mjs} +1 -1
  48. package/dist/{search-CpISWBay.d.mts → search-BhDCvZbH.d.mts} +4 -4
  49. package/dist/{tickets-BnTr_JO7.mjs → tickets-BYUexHsH.mjs} +1 -1
  50. package/dist/{tickets-DWxLBQOd.d.mts → tickets-PVnTF9mU.d.mts} +18 -18
  51. package/dist/triggers-ByPfOIUz.mjs +64 -0
  52. package/dist/{triggers-BIrYDGYF.d.mts → triggers-CtCKFMeu.d.mts} +6 -17
  53. package/dist/{users-BDj0GBC8.mjs → users-Cb1b4hze.mjs} +1 -1
  54. package/dist/{users-4ecCBdGw.d.mts → users-wFde5fME.d.mts} +18 -18
  55. package/package.json +21 -19
  56. package/dist/triggers-ELU-gyey.mjs +0 -107
@@ -29,7 +29,7 @@ declare const platformGetTicket: _keystrokehq_core0.Operation<z.ZodObject<{
29
29
  author_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
30
30
  created_at: z.ZodOptional<z.ZodString>;
31
31
  }, z.core.$strip>>;
32
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
32
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
33
33
  ZENDESK_ACCESS_TOKEN: z.ZodString;
34
34
  ZENDESK_SUBDOMAIN: z.ZodString;
35
35
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -62,7 +62,7 @@ declare const customGetTicket: _keystrokehq_core0.Operation<z.ZodObject<{
62
62
  author_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
63
63
  created_at: z.ZodOptional<z.ZodString>;
64
64
  }, z.core.$strip>>;
65
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
65
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
66
66
  ZENDESK_SUBDOMAIN: z.ZodString;
67
67
  ZENDESK_EMAIL: z.ZodEmail;
68
68
  ZENDESK_API_TOKEN: z.ZodString;
@@ -109,7 +109,7 @@ declare const platformListTickets: _keystrokehq_core0.Operation<z.ZodObject<{
109
109
  created_at: z.ZodOptional<z.ZodString>;
110
110
  }, z.core.$strip>>;
111
111
  }, z.core.$strip>>;
112
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
112
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
113
113
  ZENDESK_ACCESS_TOKEN: z.ZodString;
114
114
  ZENDESK_SUBDOMAIN: z.ZodString;
115
115
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -154,7 +154,7 @@ declare const customListTickets: _keystrokehq_core0.Operation<z.ZodObject<{
154
154
  created_at: z.ZodOptional<z.ZodString>;
155
155
  }, z.core.$strip>>;
156
156
  }, z.core.$strip>>;
157
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
157
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
158
158
  ZENDESK_SUBDOMAIN: z.ZodString;
159
159
  ZENDESK_EMAIL: z.ZodEmail;
160
160
  ZENDESK_API_TOKEN: z.ZodString;
@@ -200,7 +200,7 @@ declare const platformCreateTicket: _keystrokehq_core0.Operation<z.ZodObject<{
200
200
  author_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
201
201
  created_at: z.ZodOptional<z.ZodString>;
202
202
  }, z.core.$strip>>;
203
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
203
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
204
204
  ZENDESK_ACCESS_TOKEN: z.ZodString;
205
205
  ZENDESK_SUBDOMAIN: z.ZodString;
206
206
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -244,7 +244,7 @@ declare const customCreateTicket: _keystrokehq_core0.Operation<z.ZodObject<{
244
244
  author_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
245
245
  created_at: z.ZodOptional<z.ZodString>;
246
246
  }, z.core.$strip>>;
247
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
247
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
248
248
  ZENDESK_SUBDOMAIN: z.ZodString;
249
249
  ZENDESK_EMAIL: z.ZodEmail;
250
250
  ZENDESK_API_TOKEN: z.ZodString;
@@ -291,7 +291,7 @@ declare const platformUpdateTicket: _keystrokehq_core0.Operation<z.ZodObject<{
291
291
  author_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
292
292
  created_at: z.ZodOptional<z.ZodString>;
293
293
  }, z.core.$strip>>;
294
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
294
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
295
295
  ZENDESK_ACCESS_TOKEN: z.ZodString;
296
296
  ZENDESK_SUBDOMAIN: z.ZodString;
297
297
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -336,7 +336,7 @@ declare const customUpdateTicket: _keystrokehq_core0.Operation<z.ZodObject<{
336
336
  author_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
337
337
  created_at: z.ZodOptional<z.ZodString>;
338
338
  }, z.core.$strip>>;
339
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
339
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
340
340
  ZENDESK_SUBDOMAIN: z.ZodString;
341
341
  ZENDESK_EMAIL: z.ZodEmail;
342
342
  ZENDESK_API_TOKEN: z.ZodString;
@@ -349,7 +349,7 @@ declare const platformDeleteTicket: _keystrokehq_core0.Operation<z.ZodObject<{
349
349
  id: z.ZodNumber;
350
350
  }, z.core.$strip>, z.ZodObject<{
351
351
  success: z.ZodBoolean;
352
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
352
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
353
353
  ZENDESK_ACCESS_TOKEN: z.ZodString;
354
354
  ZENDESK_SUBDOMAIN: z.ZodString;
355
355
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -360,7 +360,7 @@ declare const customDeleteTicket: _keystrokehq_core0.Operation<z.ZodObject<{
360
360
  id: z.ZodNumber;
361
361
  }, z.core.$strip>, z.ZodObject<{
362
362
  success: z.ZodBoolean;
363
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
363
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
364
364
  ZENDESK_SUBDOMAIN: z.ZodString;
365
365
  ZENDESK_EMAIL: z.ZodEmail;
366
366
  ZENDESK_API_TOKEN: z.ZodString;
@@ -397,7 +397,7 @@ declare const platformReplyToTicket: _keystrokehq_core0.Operation<z.ZodObject<{
397
397
  author_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
398
398
  created_at: z.ZodOptional<z.ZodString>;
399
399
  }, z.core.$strip>>;
400
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
400
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
401
401
  ZENDESK_ACCESS_TOKEN: z.ZodString;
402
402
  ZENDESK_SUBDOMAIN: z.ZodString;
403
403
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -432,7 +432,7 @@ declare const customReplyToTicket: _keystrokehq_core0.Operation<z.ZodObject<{
432
432
  author_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
433
433
  created_at: z.ZodOptional<z.ZodString>;
434
434
  }, z.core.$strip>>;
435
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
435
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
436
436
  ZENDESK_SUBDOMAIN: z.ZodString;
437
437
  ZENDESK_EMAIL: z.ZodEmail;
438
438
  ZENDESK_API_TOKEN: z.ZodString;
@@ -466,7 +466,7 @@ declare const platformCreateManyTickets: _keystrokehq_core0.Operation<z.ZodObjec
466
466
  url: z.ZodOptional<z.ZodString>;
467
467
  results: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
468
468
  }, z.core.$strip>;
469
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
469
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
470
470
  ZENDESK_ACCESS_TOKEN: z.ZodString;
471
471
  ZENDESK_SUBDOMAIN: z.ZodString;
472
472
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -498,7 +498,7 @@ declare const customCreateManyTickets: _keystrokehq_core0.Operation<z.ZodObject<
498
498
  url: z.ZodOptional<z.ZodString>;
499
499
  results: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
500
500
  }, z.core.$strip>;
501
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
501
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
502
502
  ZENDESK_SUBDOMAIN: z.ZodString;
503
503
  ZENDESK_EMAIL: z.ZodEmail;
504
504
  ZENDESK_API_TOKEN: z.ZodString;
@@ -535,7 +535,7 @@ declare const platformUpdateManyTickets: _keystrokehq_core0.Operation<z.ZodObjec
535
535
  url: z.ZodOptional<z.ZodString>;
536
536
  results: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
537
537
  }, z.core.$strip>;
538
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
538
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
539
539
  ZENDESK_ACCESS_TOKEN: z.ZodString;
540
540
  ZENDESK_SUBDOMAIN: z.ZodString;
541
541
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -570,7 +570,7 @@ declare const customUpdateManyTickets: _keystrokehq_core0.Operation<z.ZodObject<
570
570
  url: z.ZodOptional<z.ZodString>;
571
571
  results: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
572
572
  }, z.core.$strip>;
573
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
573
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
574
574
  ZENDESK_SUBDOMAIN: z.ZodString;
575
575
  ZENDESK_EMAIL: z.ZodEmail;
576
576
  ZENDESK_API_TOKEN: z.ZodString;
@@ -596,7 +596,7 @@ declare const platformMergeTickets: _keystrokehq_core0.Operation<z.ZodObject<{
596
596
  url: z.ZodOptional<z.ZodString>;
597
597
  results: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
598
598
  }, z.core.$strip>;
599
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
599
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
600
600
  ZENDESK_ACCESS_TOKEN: z.ZodString;
601
601
  ZENDESK_SUBDOMAIN: z.ZodString;
602
602
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -620,7 +620,7 @@ declare const customMergeTickets: _keystrokehq_core0.Operation<z.ZodObject<{
620
620
  url: z.ZodOptional<z.ZodString>;
621
621
  results: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
622
622
  }, z.core.$strip>;
623
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
623
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
624
624
  ZENDESK_SUBDOMAIN: z.ZodString;
625
625
  ZENDESK_EMAIL: z.ZodEmail;
626
626
  ZENDESK_API_TOKEN: z.ZodString;
@@ -0,0 +1,64 @@
1
+ import { i as zendeskPlatform, t as zendeskCustom } from "./integration-D4AfP9bV.mjs";
2
+ import { zendeskTicketListResponseSchema } from "./schemas.mjs";
3
+ import { mapZendeskRecentTicketsEvent } from "./events.mjs";
4
+ import { n as createPlatformZendeskClient, t as createCustomZendeskClient } from "./shared-BmxcJmfq.mjs";
5
+ import { createPollingTriggerBindingFactory } from "@keystrokehq/integration-authoring";
6
+
7
+ //#region src/triggers.ts
8
+ function buildPlatformRecentTicketsBind(options) {
9
+ return createPollingTriggerBindingFactory({
10
+ defaultId: "zendesk.platform.recent_tickets",
11
+ defaultDescription: "Poll recent Zendesk tickets from the connected workspace",
12
+ schedule: options?.schedule ?? "5m",
13
+ credentialSets: [zendeskPlatform],
14
+ response: zendeskTicketListResponseSchema,
15
+ poll: async (ctx) => {
16
+ const platformCredentials = ctx.credentials[zendeskPlatform.id];
17
+ return createPlatformZendeskClient(platformCredentials).get({
18
+ path: "/tickets.json",
19
+ query: {
20
+ per_page: options?.perPage ?? 10,
21
+ sort_by: "created_at",
22
+ sort_order: "desc"
23
+ },
24
+ schema: zendeskTicketListResponseSchema
25
+ });
26
+ },
27
+ mapPayload: mapZendeskRecentTicketsEvent
28
+ })({
29
+ ...options?.id ? { id: options.id } : {},
30
+ ...options?.description ? { description: options.description } : {},
31
+ ...options?.transform ? { transform: options.transform } : {}
32
+ });
33
+ }
34
+ function buildCustomRecentTicketsBind(options) {
35
+ return createPollingTriggerBindingFactory({
36
+ defaultId: "zendesk.custom.recent_tickets",
37
+ defaultDescription: "Poll recent Zendesk tickets from the configured workspace",
38
+ schedule: options?.schedule ?? "5m",
39
+ credentialSets: [zendeskCustom],
40
+ response: zendeskTicketListResponseSchema,
41
+ poll: async (ctx) => {
42
+ const customCredentials = ctx.credentials[zendeskCustom.id];
43
+ return createCustomZendeskClient(customCredentials).get({
44
+ path: "/tickets.json",
45
+ query: {
46
+ per_page: options?.perPage ?? 10,
47
+ sort_by: "created_at",
48
+ sort_order: "desc"
49
+ },
50
+ schema: zendeskTicketListResponseSchema
51
+ });
52
+ },
53
+ mapPayload: mapZendeskRecentTicketsEvent
54
+ })({
55
+ ...options?.id ? { id: options.id } : {},
56
+ ...options?.description ? { description: options.description } : {},
57
+ ...options?.transform ? { transform: options.transform } : {}
58
+ });
59
+ }
60
+ const platformPolling = Object.freeze({ recentTickets: buildPlatformRecentTicketsBind });
61
+ const customPolling = Object.freeze({ recentTickets: buildCustomRecentTicketsBind });
62
+
63
+ //#endregion
64
+ export { platformPolling as n, customPolling as t };
@@ -1,32 +1,21 @@
1
- import { l as zendeskPlatformAppCredentialSet, o as zendeskPlatform, r as zendeskCustom } from "./integration-BYDT8ccc.mjs";
2
- import { zendeskTicketListResponseSchema, zendeskWebhookEventSchema } from "./schemas.mjs";
3
- import { ZendeskRecentTicketsEvent, ZendeskUserCreatedEvent } from "./events.mjs";
1
+ import { o as zendeskPlatform, r as zendeskCustom } from "./integration-D1C2E4Le.mjs";
2
+ import { zendeskTicketListResponseSchema } from "./schemas.mjs";
3
+ import { ZendeskRecentTicketsEvent } from "./events.mjs";
4
4
  import { z } from "zod";
5
- import { BoundTrigger, WebhookRequest } from "@keystrokehq/core";
5
+ import { BoundTrigger } from "@keystrokehq/core";
6
6
  import { IntegrationTriggerBindingOptions } from "@keystrokehq/integration-authoring";
7
7
  import { AnyCredentialSet } from "@keystrokehq/core/credential-set";
8
- import { PollingTriggerManifest, WebhookTriggerManifest } from "@keystrokehq/core/trigger";
8
+ import { PollingTriggerManifest } from "@keystrokehq/core/trigger";
9
9
 
10
10
  //#region src/triggers.d.ts
11
11
  type ZendeskPollingSchedule = number | `${number}s` | `${number}m` | `${number}h` | `${number}d` | `${number}w` | `${number}y`;
12
- interface ZendeskWebhookBindingOptions<TEvent, TOutput = TEvent> {
13
- readonly name?: string;
14
- readonly description?: string;
15
- readonly filter?: (payload: TEvent) => boolean | Promise<boolean>;
16
- readonly transform?: (payload: TEvent, request?: WebhookRequest) => TOutput | Promise<TOutput>;
17
- }
18
12
  interface ZendeskRecentTicketsBindingOptions<TOutput = ZendeskRecentTicketsEvent> extends IntegrationTriggerBindingOptions<ZendeskRecentTicketsEvent, TOutput> {
19
13
  readonly perPage?: number;
20
14
  readonly schedule?: ZendeskPollingSchedule;
21
15
  }
22
- type ZendeskPlatformWebhookBoundTrigger<TOutput> = BoundTrigger<z.output<typeof zendeskWebhookEventSchema>, readonly [typeof zendeskPlatform, typeof zendeskPlatformAppCredentialSet], WebhookTriggerManifest, TOutput, WebhookRequest>;
23
16
  type ZendeskRecentTicketsBoundTrigger<TCredentialSets extends readonly AnyCredentialSet[], TOutput> = BoundTrigger<z.output<typeof zendeskTicketListResponseSchema>, TCredentialSets, PollingTriggerManifest, TOutput>;
24
- declare function bindPlatformUserCreatedWebhook<TOutput = ZendeskUserCreatedEvent>(options?: ZendeskWebhookBindingOptions<ZendeskUserCreatedEvent, TOutput>): ZendeskPlatformWebhookBoundTrigger<TOutput>;
25
17
  declare function buildPlatformRecentTicketsBind<TOutput = ZendeskRecentTicketsEvent>(options?: ZendeskRecentTicketsBindingOptions<TOutput>): ZendeskRecentTicketsBoundTrigger<readonly [typeof zendeskPlatform], TOutput>;
26
18
  declare function buildCustomRecentTicketsBind<TOutput = ZendeskRecentTicketsEvent>(options?: ZendeskRecentTicketsBindingOptions<TOutput>): ZendeskRecentTicketsBoundTrigger<readonly [typeof zendeskCustom], TOutput>;
27
- declare const platformWebhooks: Readonly<{
28
- userCreated: typeof bindPlatformUserCreatedWebhook;
29
- }>;
30
19
  declare const platformPolling: Readonly<{
31
20
  recentTickets: typeof buildPlatformRecentTicketsBind;
32
21
  }>;
@@ -34,4 +23,4 @@ declare const customPolling: Readonly<{
34
23
  recentTickets: typeof buildCustomRecentTicketsBind;
35
24
  }>;
36
25
  //#endregion
37
- export { platformPolling as n, platformWebhooks as r, customPolling as t };
26
+ export { platformPolling as n, customPolling as t };
@@ -1,5 +1,5 @@
1
1
  import { zendeskBulkJobResponseSchema, zendeskUserEnvelopeSchema, zendeskUserListResponseSchema, zendeskUserSchema } from "./schemas.mjs";
2
- import { n as zendeskPlatformOperation, t as zendeskCustomOperation } from "./factory-BOeuadDj.mjs";
2
+ import { n as zendeskPlatformOperation, t as zendeskCustomOperation } from "./factory-WTOw2H-8.mjs";
3
3
  import { n as createPlatformZendeskClient, t as createCustomZendeskClient } from "./shared-BmxcJmfq.mjs";
4
4
  import { z } from "zod";
5
5
 
@@ -21,7 +21,7 @@ declare const platformListUsers: _keystrokehq_core0.Operation<z.ZodObject<{
21
21
  created_at: z.ZodOptional<z.ZodString>;
22
22
  updated_at: z.ZodOptional<z.ZodString>;
23
23
  }, z.core.$strip>>;
24
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
24
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
25
25
  ZENDESK_ACCESS_TOKEN: z.ZodString;
26
26
  ZENDESK_SUBDOMAIN: z.ZodString;
27
27
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -46,7 +46,7 @@ declare const customListUsers: _keystrokehq_core0.Operation<z.ZodObject<{
46
46
  created_at: z.ZodOptional<z.ZodString>;
47
47
  updated_at: z.ZodOptional<z.ZodString>;
48
48
  }, z.core.$strip>>;
49
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
49
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
50
50
  ZENDESK_SUBDOMAIN: z.ZodString;
51
51
  ZENDESK_EMAIL: z.ZodEmail;
52
52
  ZENDESK_API_TOKEN: z.ZodString;
@@ -66,7 +66,7 @@ declare const platformGetUser: _keystrokehq_core0.Operation<z.ZodObject<{
66
66
  organization_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
67
67
  created_at: z.ZodOptional<z.ZodString>;
68
68
  updated_at: z.ZodOptional<z.ZodString>;
69
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
69
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
70
70
  ZENDESK_ACCESS_TOKEN: z.ZodString;
71
71
  ZENDESK_SUBDOMAIN: z.ZodString;
72
72
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -84,7 +84,7 @@ declare const customGetUser: _keystrokehq_core0.Operation<z.ZodObject<{
84
84
  organization_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
85
85
  created_at: z.ZodOptional<z.ZodString>;
86
86
  updated_at: z.ZodOptional<z.ZodString>;
87
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
87
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
88
88
  ZENDESK_SUBDOMAIN: z.ZodString;
89
89
  ZENDESK_EMAIL: z.ZodEmail;
90
90
  ZENDESK_API_TOKEN: z.ZodString;
@@ -102,7 +102,7 @@ declare const platformGetCurrentUser: _keystrokehq_core0.Operation<z.ZodObject<{
102
102
  organization_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
103
103
  created_at: z.ZodOptional<z.ZodString>;
104
104
  updated_at: z.ZodOptional<z.ZodString>;
105
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
105
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
106
106
  ZENDESK_ACCESS_TOKEN: z.ZodString;
107
107
  ZENDESK_SUBDOMAIN: z.ZodString;
108
108
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -118,7 +118,7 @@ declare const customGetCurrentUser: _keystrokehq_core0.Operation<z.ZodObject<{},
118
118
  organization_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
119
119
  created_at: z.ZodOptional<z.ZodString>;
120
120
  updated_at: z.ZodOptional<z.ZodString>;
121
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
121
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
122
122
  ZENDESK_SUBDOMAIN: z.ZodString;
123
123
  ZENDESK_EMAIL: z.ZodEmail;
124
124
  ZENDESK_API_TOKEN: z.ZodString;
@@ -143,7 +143,7 @@ declare const platformSearchUsers: _keystrokehq_core0.Operation<z.ZodObject<{
143
143
  created_at: z.ZodOptional<z.ZodString>;
144
144
  updated_at: z.ZodOptional<z.ZodString>;
145
145
  }, z.core.$strip>>;
146
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
146
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
147
147
  ZENDESK_ACCESS_TOKEN: z.ZodString;
148
148
  ZENDESK_SUBDOMAIN: z.ZodString;
149
149
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -166,7 +166,7 @@ declare const customSearchUsers: _keystrokehq_core0.Operation<z.ZodObject<{
166
166
  created_at: z.ZodOptional<z.ZodString>;
167
167
  updated_at: z.ZodOptional<z.ZodString>;
168
168
  }, z.core.$strip>>;
169
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
169
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
170
170
  ZENDESK_SUBDOMAIN: z.ZodString;
171
171
  ZENDESK_EMAIL: z.ZodEmail;
172
172
  ZENDESK_API_TOKEN: z.ZodString;
@@ -192,7 +192,7 @@ declare const platformCreateUser: _keystrokehq_core0.Operation<z.ZodObject<{
192
192
  organization_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
193
193
  created_at: z.ZodOptional<z.ZodString>;
194
194
  updated_at: z.ZodOptional<z.ZodString>;
195
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
195
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
196
196
  ZENDESK_ACCESS_TOKEN: z.ZodString;
197
197
  ZENDESK_SUBDOMAIN: z.ZodString;
198
198
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -216,7 +216,7 @@ declare const customCreateUser: _keystrokehq_core0.Operation<z.ZodObject<{
216
216
  organization_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
217
217
  created_at: z.ZodOptional<z.ZodString>;
218
218
  updated_at: z.ZodOptional<z.ZodString>;
219
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
219
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
220
220
  ZENDESK_SUBDOMAIN: z.ZodString;
221
221
  ZENDESK_EMAIL: z.ZodEmail;
222
222
  ZENDESK_API_TOKEN: z.ZodString;
@@ -244,7 +244,7 @@ declare const platformUpdateUser: _keystrokehq_core0.Operation<z.ZodObject<{
244
244
  organization_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
245
245
  created_at: z.ZodOptional<z.ZodString>;
246
246
  updated_at: z.ZodOptional<z.ZodString>;
247
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
247
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
248
248
  ZENDESK_ACCESS_TOKEN: z.ZodString;
249
249
  ZENDESK_SUBDOMAIN: z.ZodString;
250
250
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -270,7 +270,7 @@ declare const customUpdateUser: _keystrokehq_core0.Operation<z.ZodObject<{
270
270
  organization_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
271
271
  created_at: z.ZodOptional<z.ZodString>;
272
272
  updated_at: z.ZodOptional<z.ZodString>;
273
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
273
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
274
274
  ZENDESK_SUBDOMAIN: z.ZodString;
275
275
  ZENDESK_EMAIL: z.ZodEmail;
276
276
  ZENDESK_API_TOKEN: z.ZodString;
@@ -283,7 +283,7 @@ declare const platformDeleteUser: _keystrokehq_core0.Operation<z.ZodObject<{
283
283
  id: z.ZodNumber;
284
284
  }, z.core.$strip>, z.ZodObject<{
285
285
  success: z.ZodBoolean;
286
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
286
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
287
287
  ZENDESK_ACCESS_TOKEN: z.ZodString;
288
288
  ZENDESK_SUBDOMAIN: z.ZodString;
289
289
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -294,7 +294,7 @@ declare const customDeleteUser: _keystrokehq_core0.Operation<z.ZodObject<{
294
294
  id: z.ZodNumber;
295
295
  }, z.core.$strip>, z.ZodObject<{
296
296
  success: z.ZodBoolean;
297
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
297
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
298
298
  ZENDESK_SUBDOMAIN: z.ZodString;
299
299
  ZENDESK_EMAIL: z.ZodEmail;
300
300
  ZENDESK_API_TOKEN: z.ZodString;
@@ -323,7 +323,7 @@ declare const platformCreateManyUsers: _keystrokehq_core0.Operation<z.ZodObject<
323
323
  url: z.ZodOptional<z.ZodString>;
324
324
  results: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
325
325
  }, z.core.$strip>;
326
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
326
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
327
327
  ZENDESK_ACCESS_TOKEN: z.ZodString;
328
328
  ZENDESK_SUBDOMAIN: z.ZodString;
329
329
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -350,7 +350,7 @@ declare const customCreateManyUsers: _keystrokehq_core0.Operation<z.ZodObject<{
350
350
  url: z.ZodOptional<z.ZodString>;
351
351
  results: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
352
352
  }, z.core.$strip>;
353
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
353
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
354
354
  ZENDESK_SUBDOMAIN: z.ZodString;
355
355
  ZENDESK_EMAIL: z.ZodEmail;
356
356
  ZENDESK_API_TOKEN: z.ZodString;
@@ -381,7 +381,7 @@ declare const platformUpdateManyUsers: _keystrokehq_core0.Operation<z.ZodObject<
381
381
  url: z.ZodOptional<z.ZodString>;
382
382
  results: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
383
383
  }, z.core.$strip>;
384
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-platform", z.ZodObject<{
384
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-platform", z.ZodObject<{
385
385
  ZENDESK_ACCESS_TOKEN: z.ZodString;
386
386
  ZENDESK_SUBDOMAIN: z.ZodString;
387
387
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
@@ -410,7 +410,7 @@ declare const customUpdateManyUsers: _keystrokehq_core0.Operation<z.ZodObject<{
410
410
  url: z.ZodOptional<z.ZodString>;
411
411
  results: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
412
412
  }, z.core.$strip>;
413
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"zendesk-custom", z.ZodObject<{
413
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:zendesk-custom", z.ZodObject<{
414
414
  ZENDESK_SUBDOMAIN: z.ZodString;
415
415
  ZENDESK_EMAIL: z.ZodEmail;
416
416
  ZENDESK_API_TOKEN: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keystrokehq/zendesk",
3
- "version": "0.0.1",
3
+ "version": "0.0.5",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -131,27 +131,21 @@
131
131
  "README.md",
132
132
  "LICENSE"
133
133
  ],
134
- "scripts": {
135
- "typecheck": "tsgo --build",
136
- "build": "tsdown",
137
- "lint": "biome check .",
138
- "test:unit": "vitest run --passWithNoTests --project unit",
139
- "test:int": "vitest run --passWithNoTests --project int",
140
- "prepublishOnly": "pnpm build && pnpm test:unit",
141
- "lint:fix": "biome check --write ."
142
- },
143
134
  "dependencies": {
144
- "@keystrokehq/integration-authoring": "^0.0.1",
145
- "@keystrokehq/core": "^0.0.5",
135
+ "@keystrokehq/integration-authoring": "^0.0.5",
146
136
  "zod": "^4.3.6"
147
137
  },
138
+ "peerDependencies": {
139
+ "@keystrokehq/core": ">=0.0.7 <0.1.0"
140
+ },
148
141
  "devDependencies": {
149
- "@types/node": "catalog:",
150
- "@keystrokehq/test-utils": "workspace:*",
151
- "@keystrokehq/typescript-config": "workspace:*",
152
- "tsdown": "catalog:",
153
- "typescript": "catalog:",
154
- "vitest": "catalog:"
142
+ "@types/node": "^22.19.11",
143
+ "tsdown": "^0.20.3",
144
+ "typescript": "^5.9.3",
145
+ "vitest": "^4.0.18",
146
+ "@keystrokehq/core": "^0.0.7",
147
+ "@keystrokehq/test-utils": "0.0.0",
148
+ "@keystrokehq/typescript-config": "0.0.0"
155
149
  },
156
150
  "keywords": [
157
151
  "zendesk",
@@ -168,5 +162,13 @@
168
162
  "publishConfig": {
169
163
  "access": "public",
170
164
  "registry": "https://registry.npmjs.org/"
165
+ },
166
+ "scripts": {
167
+ "typecheck": "tsgo --build",
168
+ "build": "tsdown",
169
+ "lint": "biome check .",
170
+ "test:unit": "vitest run --passWithNoTests --project unit",
171
+ "test:int": "vitest run --passWithNoTests --project int",
172
+ "lint:fix": "biome check --write ."
171
173
  }
172
- }
174
+ }
@@ -1,107 +0,0 @@
1
- import { i as zendeskPlatform, s as zendeskPlatformAppCredentialSet, t as zendeskCustom } from "./integration-BGHdDCMn.mjs";
2
- import { zendeskTicketListResponseSchema, zendeskWebhookEventSchema } from "./schemas.mjs";
3
- import { mapZendeskRecentTicketsEvent, mapZendeskUserCreatedEvent } from "./events.mjs";
4
- import { extractZendeskWebhookInvocationId, verifyZendeskWebhookSignature } from "./verification.mjs";
5
- import { n as createPlatformZendeskClient, t as createCustomZendeskClient } from "./shared-BmxcJmfq.mjs";
6
- import { webhookTrigger } from "@keystrokehq/core";
7
- import { createPollingTriggerBindingFactory } from "@keystrokehq/integration-authoring";
8
-
9
- //#region src/triggers.ts
10
- const DEFAULT_PLATFORM_USER_CREATED_NAME = "Zendesk User Created";
11
- const DEFAULT_PLATFORM_USER_CREATED_DESCRIPTION = "Zendesk user creation webhook";
12
- function createPlatformUserCreatedTrigger(name, description) {
13
- return webhookTrigger({
14
- name,
15
- description,
16
- source: {
17
- type: "custom",
18
- method: "POST",
19
- path: "/zendesk-user-created",
20
- credentialSets: [zendeskPlatform, zendeskPlatformAppCredentialSet],
21
- verify: (request, ctx) => {
22
- const appCredentials = ctx.credentials[zendeskPlatformAppCredentialSet.id];
23
- verifyZendeskWebhookSignature(request, appCredentials.webhookSigningSecret);
24
- }
25
- },
26
- payload: zendeskWebhookEventSchema,
27
- filter: (payload) => mapZendeskUserCreatedEvent(payload) !== null,
28
- idempotencyKey: (payload, request) => (request ? extractZendeskWebhookInvocationId(request) : void 0) ?? payload.id
29
- });
30
- }
31
- function bindPlatformUserCreatedWebhook(options) {
32
- const userFilter = options?.filter;
33
- return createPlatformUserCreatedTrigger(options?.name ?? DEFAULT_PLATFORM_USER_CREATED_NAME, options?.description ?? DEFAULT_PLATFORM_USER_CREATED_DESCRIPTION)({
34
- filter: userFilter ? (payload) => {
35
- const mappedPayload = mapZendeskUserCreatedEvent(payload);
36
- return mappedPayload ? userFilter(mappedPayload) : false;
37
- } : void 0,
38
- transform: (payload, request) => {
39
- const mappedPayload = mapZendeskUserCreatedEvent(payload);
40
- if (!mappedPayload) throw new Error("Zendesk user-created webhook payload did not map to an author payload");
41
- if (!options?.transform) return mappedPayload;
42
- return options.transform(mappedPayload, request);
43
- }
44
- });
45
- }
46
- function buildPlatformRecentTicketsBind(options) {
47
- return createPollingTriggerBindingFactory({
48
- defaultName: "Zendesk Recent Tickets",
49
- defaultDescription: "Poll recent Zendesk tickets from the connected workspace",
50
- schedule: options?.schedule ?? "5m",
51
- credentialSets: [zendeskPlatform],
52
- response: zendeskTicketListResponseSchema,
53
- poll: async (ctx) => {
54
- const platformCredentials = ctx.credentials[zendeskPlatform.id];
55
- return createPlatformZendeskClient(platformCredentials).get({
56
- path: "/tickets.json",
57
- query: {
58
- per_page: options?.perPage ?? 10,
59
- sort_by: "created_at",
60
- sort_order: "desc"
61
- },
62
- schema: zendeskTicketListResponseSchema
63
- });
64
- },
65
- mapPayload: mapZendeskRecentTicketsEvent,
66
- idempotencyKey: (_response, mappedPayload) => mappedPayload?.eventId
67
- })({
68
- name: options?.name,
69
- description: options?.description,
70
- filter: options?.filter,
71
- transform: options?.transform
72
- });
73
- }
74
- function buildCustomRecentTicketsBind(options) {
75
- return createPollingTriggerBindingFactory({
76
- defaultName: "Zendesk Recent Tickets",
77
- defaultDescription: "Poll recent Zendesk tickets from the configured workspace",
78
- schedule: options?.schedule ?? "5m",
79
- credentialSets: [zendeskCustom],
80
- response: zendeskTicketListResponseSchema,
81
- poll: async (ctx) => {
82
- const customCredentials = ctx.credentials[zendeskCustom.id];
83
- return createCustomZendeskClient(customCredentials).get({
84
- path: "/tickets.json",
85
- query: {
86
- per_page: options?.perPage ?? 10,
87
- sort_by: "created_at",
88
- sort_order: "desc"
89
- },
90
- schema: zendeskTicketListResponseSchema
91
- });
92
- },
93
- mapPayload: mapZendeskRecentTicketsEvent,
94
- idempotencyKey: (_response, mappedPayload) => mappedPayload?.eventId
95
- })({
96
- name: options?.name,
97
- description: options?.description,
98
- filter: options?.filter,
99
- transform: options?.transform
100
- });
101
- }
102
- const platformWebhooks = Object.freeze({ userCreated: bindPlatformUserCreatedWebhook });
103
- const platformPolling = Object.freeze({ recentTickets: buildPlatformRecentTicketsBind });
104
- const customPolling = Object.freeze({ recentTickets: buildCustomRecentTicketsBind });
105
-
106
- //#endregion
107
- export { platformPolling as n, platformWebhooks as r, customPolling as t };