@keystrokehq/zendesk 0.0.1

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 (68) hide show
  1. package/README.md +188 -0
  2. package/dist/_official/index.d.mts +2 -0
  3. package/dist/_official/index.mjs +3 -0
  4. package/dist/_runtime/index.d.mts +1531 -0
  5. package/dist/_runtime/index.mjs +39 -0
  6. package/dist/chunk-DQk6qfdC.mjs +18 -0
  7. package/dist/client.d.mts +41 -0
  8. package/dist/client.mjs +137 -0
  9. package/dist/custom/connection.d.mts +2 -0
  10. package/dist/custom/connection.mjs +3 -0
  11. package/dist/custom/jobs.d.mts +8 -0
  12. package/dist/custom/jobs.mjs +8 -0
  13. package/dist/custom/organizations.d.mts +8 -0
  14. package/dist/custom/organizations.mjs +17 -0
  15. package/dist/custom/search.d.mts +8 -0
  16. package/dist/custom/search.mjs +11 -0
  17. package/dist/custom/tickets.d.mts +8 -0
  18. package/dist/custom/tickets.mjs +18 -0
  19. package/dist/custom/triggers.d.mts +2 -0
  20. package/dist/custom/triggers.mjs +3 -0
  21. package/dist/custom/users.d.mts +8 -0
  22. package/dist/custom/users.mjs +18 -0
  23. package/dist/custom.d.mts +7 -0
  24. package/dist/custom.mjs +8 -0
  25. package/dist/errors-BPAyL8gM.mjs +38 -0
  26. package/dist/events.d.mts +47 -0
  27. package/dist/events.mjs +58 -0
  28. package/dist/factory-BOeuadDj.mjs +9 -0
  29. package/dist/index.d.mts +1 -0
  30. package/dist/index.mjs +1 -0
  31. package/dist/integration-BGHdDCMn.mjs +83 -0
  32. package/dist/integration-BYDT8ccc.d.mts +98 -0
  33. package/dist/jobs-9tdPkCE1.d.mts +43 -0
  34. package/dist/jobs-BjDRvbsd.mjs +36 -0
  35. package/dist/messaging.d.mts +1 -0
  36. package/dist/messaging.mjs +1 -0
  37. package/dist/organizations-BHCFYHgM.mjs +277 -0
  38. package/dist/organizations-Ct_354Ea.d.mts +355 -0
  39. package/dist/platform/connection.d.mts +2 -0
  40. package/dist/platform/connection.mjs +3 -0
  41. package/dist/platform/jobs.d.mts +8 -0
  42. package/dist/platform/jobs.mjs +8 -0
  43. package/dist/platform/organizations.d.mts +8 -0
  44. package/dist/platform/organizations.mjs +17 -0
  45. package/dist/platform/search.d.mts +8 -0
  46. package/dist/platform/search.mjs +11 -0
  47. package/dist/platform/tickets.d.mts +8 -0
  48. package/dist/platform/tickets.mjs +18 -0
  49. package/dist/platform/triggers.d.mts +2 -0
  50. package/dist/platform/triggers.mjs +3 -0
  51. package/dist/platform/users.d.mts +8 -0
  52. package/dist/platform/users.mjs +18 -0
  53. package/dist/platform.d.mts +7 -0
  54. package/dist/platform.mjs +8 -0
  55. package/dist/schemas.d.mts +287 -0
  56. package/dist/schemas.mjs +101 -0
  57. package/dist/search-BpPJ9ccR.mjs +85 -0
  58. package/dist/search-CpISWBay.d.mts +83 -0
  59. package/dist/shared-BmxcJmfq.mjs +12 -0
  60. package/dist/tickets-BnTr_JO7.mjs +387 -0
  61. package/dist/tickets-DWxLBQOd.d.mts +633 -0
  62. package/dist/triggers-BIrYDGYF.d.mts +37 -0
  63. package/dist/triggers-ELU-gyey.mjs +107 -0
  64. package/dist/users-4ecCBdGw.d.mts +423 -0
  65. package/dist/users-BDj0GBC8.mjs +323 -0
  66. package/dist/verification.d.mts +9 -0
  67. package/dist/verification.mjs +41 -0
  68. package/package.json +172 -0
@@ -0,0 +1,387 @@
1
+ import { zendeskBulkJobResponseSchema, zendeskTicketEnvelopeSchema, zendeskTicketListResponseSchema, zendeskTicketSchema } from "./schemas.mjs";
2
+ import { n as zendeskPlatformOperation, t as zendeskCustomOperation } from "./factory-BOeuadDj.mjs";
3
+ import { n as createPlatformZendeskClient, t as createCustomZendeskClient } from "./shared-BmxcJmfq.mjs";
4
+ import { z } from "zod";
5
+
6
+ //#region src/tickets.ts
7
+ const listTicketsInputSchema = z.object({
8
+ page: z.number().int().positive().optional(),
9
+ perPage: z.number().int().positive().max(100).optional(),
10
+ sortBy: z.string().optional(),
11
+ sortOrder: z.enum(["asc", "desc"]).optional(),
12
+ externalId: z.string().optional()
13
+ });
14
+ const getTicketInputSchema = z.object({ id: z.number().int().positive() });
15
+ const ticketCreateInputSchema = z.object({
16
+ subject: z.string().min(1),
17
+ commentBody: z.string().min(1),
18
+ commentPublic: z.boolean().optional(),
19
+ description: z.string().optional(),
20
+ priority: z.string().optional(),
21
+ status: z.string().optional(),
22
+ type: z.string().optional(),
23
+ requesterId: z.number().int().positive().optional(),
24
+ submitterId: z.number().int().positive().optional(),
25
+ assigneeId: z.number().int().positive().optional(),
26
+ organizationId: z.number().int().positive().optional(),
27
+ tags: z.array(z.string()).optional()
28
+ });
29
+ const ticketUpdateInputSchema = z.object({
30
+ id: z.number().int().positive(),
31
+ subject: z.string().min(1).optional(),
32
+ commentBody: z.string().min(1).optional(),
33
+ commentPublic: z.boolean().optional(),
34
+ description: z.string().optional(),
35
+ priority: z.string().optional(),
36
+ status: z.string().optional(),
37
+ type: z.string().optional(),
38
+ requesterId: z.number().int().positive().optional(),
39
+ submitterId: z.number().int().positive().optional(),
40
+ assigneeId: z.number().int().positive().optional(),
41
+ organizationId: z.number().int().positive().optional(),
42
+ tags: z.array(z.string()).optional()
43
+ });
44
+ const ticketReplyInputSchema = z.object({
45
+ id: z.number().int().positive(),
46
+ body: z.string().min(1),
47
+ public: z.boolean().optional()
48
+ });
49
+ const createManyTicketsInputSchema = z.object({ tickets: z.array(ticketCreateInputSchema).min(1).max(100) });
50
+ const updateManyTicketItemSchema = ticketUpdateInputSchema.extend({
51
+ safeUpdate: z.boolean().optional(),
52
+ updatedStamp: z.string().optional()
53
+ });
54
+ const updateManyTicketsInputSchema = z.object({ tickets: z.array(updateManyTicketItemSchema).min(1).max(100) });
55
+ const mergeTicketsInputSchema = z.object({
56
+ targetTicketId: z.number().int().positive(),
57
+ sourceTicketIds: z.array(z.number().int().positive()).min(1),
58
+ targetComment: z.string().optional(),
59
+ sourceComment: z.string().optional(),
60
+ targetCommentIsPublic: z.boolean().optional(),
61
+ sourceCommentIsPublic: z.boolean().optional()
62
+ });
63
+ function mapTicketWriteInput(input) {
64
+ return {
65
+ ...input.subject ? { subject: input.subject } : {},
66
+ ...input.description ? { description: input.description } : {},
67
+ ...input.priority ? { priority: input.priority } : {},
68
+ ...input.status ? { status: input.status } : {},
69
+ ...input.type ? { type: input.type } : {},
70
+ ...input.requesterId ? { requester_id: input.requesterId } : {},
71
+ ...input.submitterId ? { submitter_id: input.submitterId } : {},
72
+ ...input.assigneeId ? { assignee_id: input.assigneeId } : {},
73
+ ...input.organizationId ? { organization_id: input.organizationId } : {},
74
+ ...input.tags ? { tags: input.tags } : {},
75
+ ...input.commentBody ? { comment: {
76
+ body: input.commentBody,
77
+ ...input.commentPublic !== void 0 ? { public: input.commentPublic } : {}
78
+ } } : {}
79
+ };
80
+ }
81
+ const platformGetTicket = zendeskPlatformOperation({
82
+ id: "get_ticket",
83
+ name: "Get Zendesk Ticket",
84
+ description: "Get a single Zendesk ticket by ID",
85
+ input: getTicketInputSchema,
86
+ output: zendeskTicketSchema,
87
+ run: async (input, credentials) => {
88
+ return (await createPlatformZendeskClient(credentials).get({
89
+ path: `/tickets/${input.id}.json`,
90
+ schema: zendeskTicketEnvelopeSchema
91
+ })).ticket;
92
+ }
93
+ });
94
+ const customGetTicket = zendeskCustomOperation({
95
+ id: "get_ticket",
96
+ name: "Get Zendesk Ticket",
97
+ description: "Get a single Zendesk ticket by ID",
98
+ input: getTicketInputSchema,
99
+ output: zendeskTicketSchema,
100
+ run: async (input, credentials) => {
101
+ return (await createCustomZendeskClient(credentials).get({
102
+ path: `/tickets/${input.id}.json`,
103
+ schema: zendeskTicketEnvelopeSchema
104
+ })).ticket;
105
+ }
106
+ });
107
+ const platformListTickets = zendeskPlatformOperation({
108
+ id: "list_tickets",
109
+ name: "List Zendesk Tickets",
110
+ description: "List Zendesk tickets with pagination controls",
111
+ input: listTicketsInputSchema,
112
+ output: zendeskTicketListResponseSchema,
113
+ run: async (input, credentials) => {
114
+ return createPlatformZendeskClient(credentials).get({
115
+ path: "/tickets.json",
116
+ query: {
117
+ page: input.page,
118
+ per_page: input.perPage,
119
+ sort_by: input.sortBy,
120
+ sort_order: input.sortOrder,
121
+ external_id: input.externalId
122
+ },
123
+ schema: zendeskTicketListResponseSchema
124
+ });
125
+ }
126
+ });
127
+ const customListTickets = zendeskCustomOperation({
128
+ id: "list_tickets",
129
+ name: "List Zendesk Tickets",
130
+ description: "List Zendesk tickets with pagination controls",
131
+ input: listTicketsInputSchema,
132
+ output: zendeskTicketListResponseSchema,
133
+ run: async (input, credentials) => {
134
+ return createCustomZendeskClient(credentials).get({
135
+ path: "/tickets.json",
136
+ query: {
137
+ page: input.page,
138
+ per_page: input.perPage,
139
+ sort_by: input.sortBy,
140
+ sort_order: input.sortOrder,
141
+ external_id: input.externalId
142
+ },
143
+ schema: zendeskTicketListResponseSchema
144
+ });
145
+ }
146
+ });
147
+ const platformCreateTicket = zendeskPlatformOperation({
148
+ id: "create_ticket",
149
+ name: "Create Zendesk Ticket",
150
+ description: "Create a new Zendesk ticket",
151
+ input: ticketCreateInputSchema,
152
+ output: zendeskTicketSchema,
153
+ needsApproval: true,
154
+ run: async (input, credentials) => {
155
+ return (await createPlatformZendeskClient(credentials).post({
156
+ path: "/tickets.json",
157
+ body: { ticket: mapTicketWriteInput(input) },
158
+ schema: zendeskTicketEnvelopeSchema
159
+ })).ticket;
160
+ }
161
+ });
162
+ const customCreateTicket = zendeskCustomOperation({
163
+ id: "create_ticket",
164
+ name: "Create Zendesk Ticket",
165
+ description: "Create a new Zendesk ticket",
166
+ input: ticketCreateInputSchema,
167
+ output: zendeskTicketSchema,
168
+ needsApproval: true,
169
+ run: async (input, credentials) => {
170
+ return (await createCustomZendeskClient(credentials).post({
171
+ path: "/tickets.json",
172
+ body: { ticket: mapTicketWriteInput(input) },
173
+ schema: zendeskTicketEnvelopeSchema
174
+ })).ticket;
175
+ }
176
+ });
177
+ const platformUpdateTicket = zendeskPlatformOperation({
178
+ id: "update_ticket",
179
+ name: "Update Zendesk Ticket",
180
+ description: "Update an existing Zendesk ticket",
181
+ input: ticketUpdateInputSchema,
182
+ output: zendeskTicketSchema,
183
+ needsApproval: true,
184
+ run: async (input, credentials) => {
185
+ return (await createPlatformZendeskClient(credentials).put({
186
+ path: `/tickets/${input.id}.json`,
187
+ body: { ticket: mapTicketWriteInput(input) },
188
+ schema: zendeskTicketEnvelopeSchema
189
+ })).ticket;
190
+ }
191
+ });
192
+ const customUpdateTicket = zendeskCustomOperation({
193
+ id: "update_ticket",
194
+ name: "Update Zendesk Ticket",
195
+ description: "Update an existing Zendesk ticket",
196
+ input: ticketUpdateInputSchema,
197
+ output: zendeskTicketSchema,
198
+ needsApproval: true,
199
+ run: async (input, credentials) => {
200
+ return (await createCustomZendeskClient(credentials).put({
201
+ path: `/tickets/${input.id}.json`,
202
+ body: { ticket: mapTicketWriteInput(input) },
203
+ schema: zendeskTicketEnvelopeSchema
204
+ })).ticket;
205
+ }
206
+ });
207
+ const platformDeleteTicket = zendeskPlatformOperation({
208
+ id: "delete_ticket",
209
+ name: "Delete Zendesk Ticket",
210
+ description: "Delete a Zendesk ticket",
211
+ input: getTicketInputSchema,
212
+ output: z.object({ success: z.boolean() }),
213
+ needsApproval: true,
214
+ run: async (input, credentials) => {
215
+ await createPlatformZendeskClient(credentials).delete({
216
+ path: `/tickets/${input.id}.json`,
217
+ schema: z.object({})
218
+ });
219
+ return { success: true };
220
+ }
221
+ });
222
+ const customDeleteTicket = zendeskCustomOperation({
223
+ id: "delete_ticket",
224
+ name: "Delete Zendesk Ticket",
225
+ description: "Delete a Zendesk ticket",
226
+ input: getTicketInputSchema,
227
+ output: z.object({ success: z.boolean() }),
228
+ needsApproval: true,
229
+ run: async (input, credentials) => {
230
+ await createCustomZendeskClient(credentials).delete({
231
+ path: `/tickets/${input.id}.json`,
232
+ schema: z.object({})
233
+ });
234
+ return { success: true };
235
+ }
236
+ });
237
+ const platformReplyToTicket = zendeskPlatformOperation({
238
+ id: "reply_to_ticket",
239
+ name: "Reply To Zendesk Ticket",
240
+ description: "Add a public or private reply to an existing Zendesk ticket",
241
+ input: ticketReplyInputSchema,
242
+ output: zendeskTicketSchema,
243
+ needsApproval: true,
244
+ run: async (input, credentials) => {
245
+ return (await createPlatformZendeskClient(credentials).put({
246
+ path: `/tickets/${input.id}.json`,
247
+ body: { ticket: { comment: {
248
+ body: input.body,
249
+ ...input.public !== void 0 ? { public: input.public } : {}
250
+ } } },
251
+ schema: zendeskTicketEnvelopeSchema
252
+ })).ticket;
253
+ }
254
+ });
255
+ const customReplyToTicket = zendeskCustomOperation({
256
+ id: "reply_to_ticket",
257
+ name: "Reply To Zendesk Ticket",
258
+ description: "Add a public or private reply to an existing Zendesk ticket",
259
+ input: ticketReplyInputSchema,
260
+ output: zendeskTicketSchema,
261
+ needsApproval: true,
262
+ run: async (input, credentials) => {
263
+ return (await createCustomZendeskClient(credentials).put({
264
+ path: `/tickets/${input.id}.json`,
265
+ body: { ticket: { comment: {
266
+ body: input.body,
267
+ ...input.public !== void 0 ? { public: input.public } : {}
268
+ } } },
269
+ schema: zendeskTicketEnvelopeSchema
270
+ })).ticket;
271
+ }
272
+ });
273
+ const platformCreateManyTickets = zendeskPlatformOperation({
274
+ id: "create_many_tickets",
275
+ name: "Create Many Zendesk Tickets",
276
+ description: "Create multiple Zendesk tickets asynchronously",
277
+ input: createManyTicketsInputSchema,
278
+ output: zendeskBulkJobResponseSchema,
279
+ needsApproval: true,
280
+ run: async (input, credentials) => {
281
+ return createPlatformZendeskClient(credentials).post({
282
+ path: "/tickets/create_many.json",
283
+ body: { tickets: input.tickets.map(mapTicketWriteInput) },
284
+ schema: zendeskBulkJobResponseSchema
285
+ });
286
+ }
287
+ });
288
+ const customCreateManyTickets = zendeskCustomOperation({
289
+ id: "create_many_tickets",
290
+ name: "Create Many Zendesk Tickets",
291
+ description: "Create multiple Zendesk tickets asynchronously",
292
+ input: createManyTicketsInputSchema,
293
+ output: zendeskBulkJobResponseSchema,
294
+ needsApproval: true,
295
+ run: async (input, credentials) => {
296
+ return createCustomZendeskClient(credentials).post({
297
+ path: "/tickets/create_many.json",
298
+ body: { tickets: input.tickets.map(mapTicketWriteInput) },
299
+ schema: zendeskBulkJobResponseSchema
300
+ });
301
+ }
302
+ });
303
+ const platformUpdateManyTickets = zendeskPlatformOperation({
304
+ id: "update_many_tickets",
305
+ name: "Update Many Zendesk Tickets",
306
+ description: "Update multiple Zendesk tickets asynchronously",
307
+ input: updateManyTicketsInputSchema,
308
+ output: zendeskBulkJobResponseSchema,
309
+ needsApproval: true,
310
+ run: async (input, credentials) => {
311
+ return createPlatformZendeskClient(credentials).put({
312
+ path: "/tickets/update_many.json",
313
+ body: { tickets: input.tickets.map((ticket) => ({
314
+ id: ticket.id,
315
+ ...mapTicketWriteInput(ticket),
316
+ ...ticket.safeUpdate !== void 0 ? { safe_update: ticket.safeUpdate } : {},
317
+ ...ticket.updatedStamp ? { updated_stamp: ticket.updatedStamp } : {}
318
+ })) },
319
+ schema: zendeskBulkJobResponseSchema
320
+ });
321
+ }
322
+ });
323
+ const customUpdateManyTickets = zendeskCustomOperation({
324
+ id: "update_many_tickets",
325
+ name: "Update Many Zendesk Tickets",
326
+ description: "Update multiple Zendesk tickets asynchronously",
327
+ input: updateManyTicketsInputSchema,
328
+ output: zendeskBulkJobResponseSchema,
329
+ needsApproval: true,
330
+ run: async (input, credentials) => {
331
+ return createCustomZendeskClient(credentials).put({
332
+ path: "/tickets/update_many.json",
333
+ body: { tickets: input.tickets.map((ticket) => ({
334
+ id: ticket.id,
335
+ ...mapTicketWriteInput(ticket),
336
+ ...ticket.safeUpdate !== void 0 ? { safe_update: ticket.safeUpdate } : {},
337
+ ...ticket.updatedStamp ? { updated_stamp: ticket.updatedStamp } : {}
338
+ })) },
339
+ schema: zendeskBulkJobResponseSchema
340
+ });
341
+ }
342
+ });
343
+ const platformMergeTickets = zendeskPlatformOperation({
344
+ id: "merge_tickets",
345
+ name: "Merge Zendesk Tickets",
346
+ description: "Merge one or more source tickets into a target Zendesk ticket",
347
+ input: mergeTicketsInputSchema,
348
+ output: zendeskBulkJobResponseSchema,
349
+ needsApproval: true,
350
+ run: async (input, credentials) => {
351
+ return createPlatformZendeskClient(credentials).post({
352
+ path: `/tickets/${input.targetTicketId}/merge.json`,
353
+ body: {
354
+ ids: input.sourceTicketIds,
355
+ ...input.targetComment ? { target_comment: input.targetComment } : {},
356
+ ...input.sourceComment ? { source_comment: input.sourceComment } : {},
357
+ ...input.targetCommentIsPublic !== void 0 ? { target_comment_is_public: input.targetCommentIsPublic } : {},
358
+ ...input.sourceCommentIsPublic !== void 0 ? { source_comment_is_public: input.sourceCommentIsPublic } : {}
359
+ },
360
+ schema: zendeskBulkJobResponseSchema
361
+ });
362
+ }
363
+ });
364
+ const customMergeTickets = zendeskCustomOperation({
365
+ id: "merge_tickets",
366
+ name: "Merge Zendesk Tickets",
367
+ description: "Merge one or more source tickets into a target Zendesk ticket",
368
+ input: mergeTicketsInputSchema,
369
+ output: zendeskBulkJobResponseSchema,
370
+ needsApproval: true,
371
+ run: async (input, credentials) => {
372
+ return createCustomZendeskClient(credentials).post({
373
+ path: `/tickets/${input.targetTicketId}/merge.json`,
374
+ body: {
375
+ ids: input.sourceTicketIds,
376
+ ...input.targetComment ? { target_comment: input.targetComment } : {},
377
+ ...input.sourceComment ? { source_comment: input.sourceComment } : {},
378
+ ...input.targetCommentIsPublic !== void 0 ? { target_comment_is_public: input.targetCommentIsPublic } : {},
379
+ ...input.sourceCommentIsPublic !== void 0 ? { source_comment_is_public: input.sourceCommentIsPublic } : {}
380
+ },
381
+ schema: zendeskBulkJobResponseSchema
382
+ });
383
+ }
384
+ });
385
+
386
+ //#endregion
387
+ export { platformUpdateManyTickets as _, customListTickets as a, customUpdateManyTickets as c, platformCreateTicket as d, platformDeleteTicket as f, platformReplyToTicket as g, platformMergeTickets as h, customGetTicket as i, customUpdateTicket as l, platformListTickets as m, customCreateTicket as n, customMergeTickets as o, platformGetTicket as p, customDeleteTicket as r, customReplyToTicket as s, customCreateManyTickets as t, platformCreateManyTickets as u, platformUpdateTicket as v };