@zapier/zapier-sdk 0.15.3 → 0.15.8

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 (66) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/api/auth.d.ts +10 -0
  3. package/dist/api/auth.d.ts.map +1 -1
  4. package/dist/api/auth.js +45 -0
  5. package/dist/api/auth.test.d.ts +2 -0
  6. package/dist/api/auth.test.d.ts.map +1 -0
  7. package/dist/api/auth.test.js +220 -0
  8. package/dist/api/client.d.ts.map +1 -1
  9. package/dist/api/client.js +18 -32
  10. package/dist/api/client.methods.test.d.ts +2 -0
  11. package/dist/api/client.methods.test.d.ts.map +1 -0
  12. package/dist/api/client.methods.test.js +158 -0
  13. package/dist/api/client.test.js +27 -11
  14. package/dist/api/router.d.ts +16 -0
  15. package/dist/api/router.d.ts.map +1 -0
  16. package/dist/api/router.js +37 -0
  17. package/dist/api/router.test.d.ts +2 -0
  18. package/dist/api/router.test.d.ts.map +1 -0
  19. package/dist/api/router.test.js +109 -0
  20. package/dist/api/schemas.d.ts +38 -38
  21. package/dist/auth.d.ts +15 -0
  22. package/dist/auth.d.ts.map +1 -1
  23. package/dist/auth.js +25 -0
  24. package/dist/index.cjs +350 -87
  25. package/dist/index.d.mts +430 -269
  26. package/dist/index.mjs +350 -88
  27. package/dist/plugins/eventEmission/index.d.ts +1 -1
  28. package/dist/plugins/eventEmission/index.d.ts.map +1 -1
  29. package/dist/plugins/eventEmission/index.js +94 -22
  30. package/dist/plugins/eventEmission/index.test.js +340 -2
  31. package/dist/plugins/getAuthentication/index.d.ts +2 -5
  32. package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
  33. package/dist/plugins/getAuthentication/index.js +3 -24
  34. package/dist/plugins/getAuthentication/index.test.js +32 -144
  35. package/dist/plugins/getAuthentication/schemas.d.ts +4 -13
  36. package/dist/plugins/getAuthentication/schemas.d.ts.map +1 -1
  37. package/dist/plugins/getAuthentication/schemas.js +1 -11
  38. package/dist/schemas/Action.d.ts +1 -1
  39. package/dist/schemas/Auth.d.ts +6 -6
  40. package/dist/sdk.d.ts +1 -1
  41. package/dist/temporary-internal-core/handlers/getAuthentication.d.ts +94 -0
  42. package/dist/temporary-internal-core/handlers/getAuthentication.d.ts.map +1 -0
  43. package/dist/temporary-internal-core/handlers/getAuthentication.js +68 -0
  44. package/dist/temporary-internal-core/handlers/getAuthentication.test.d.ts +2 -0
  45. package/dist/temporary-internal-core/handlers/getAuthentication.test.d.ts.map +1 -0
  46. package/dist/temporary-internal-core/handlers/getAuthentication.test.js +248 -0
  47. package/dist/temporary-internal-core/handlers/listApps.js +1 -1
  48. package/dist/temporary-internal-core/index.d.ts +2 -0
  49. package/dist/temporary-internal-core/index.d.ts.map +1 -1
  50. package/dist/temporary-internal-core/index.js +2 -0
  51. package/dist/temporary-internal-core/schemas/authentications/index.d.ts +454 -0
  52. package/dist/temporary-internal-core/schemas/authentications/index.d.ts.map +1 -0
  53. package/dist/temporary-internal-core/schemas/authentications/index.js +96 -0
  54. package/dist/temporary-internal-core/schemas/errors/index.d.ts +139 -0
  55. package/dist/temporary-internal-core/schemas/errors/index.d.ts.map +1 -0
  56. package/dist/temporary-internal-core/schemas/errors/index.js +129 -0
  57. package/dist/temporary-internal-core/utils/app-locators.d.ts +0 -20
  58. package/dist/temporary-internal-core/utils/app-locators.d.ts.map +1 -1
  59. package/dist/temporary-internal-core/utils/app-locators.js +1 -45
  60. package/dist/temporary-internal-core/utils/string-utils.d.ts +28 -0
  61. package/dist/temporary-internal-core/utils/string-utils.d.ts.map +1 -0
  62. package/dist/temporary-internal-core/utils/string-utils.js +52 -0
  63. package/dist/temporary-internal-core/utils/transformations.d.ts +14 -0
  64. package/dist/temporary-internal-core/utils/transformations.d.ts.map +1 -1
  65. package/dist/temporary-internal-core/utils/transformations.js +37 -1
  66. package/package.json +1 -1
@@ -0,0 +1,454 @@
1
+ /**
2
+ * Authentication schemas
3
+ */
4
+ import { z } from "zod";
5
+ export declare const AuthenticationSchema: z.ZodObject<{
6
+ id: z.ZodNumber;
7
+ date: z.ZodString;
8
+ lastchanged: z.ZodOptional<z.ZodString>;
9
+ account_id: z.ZodNumber;
10
+ customuser_id: z.ZodOptional<z.ZodNumber>;
11
+ selected_api: z.ZodString;
12
+ destination_selected_api: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ is_invite_only: z.ZodBoolean;
14
+ is_private: z.ZodBoolean;
15
+ shared_with_all: z.ZodBoolean;
16
+ is_stale: z.ZodOptional<z.ZodString>;
17
+ is_shared: z.ZodOptional<z.ZodString>;
18
+ marked_stale_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ identifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
+ url: z.ZodOptional<z.ZodString>;
23
+ groups: z.ZodOptional<z.ZodString>;
24
+ members: z.ZodOptional<z.ZodString>;
25
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ account_id: number;
28
+ selected_api: string;
29
+ id: number;
30
+ date: string;
31
+ is_invite_only: boolean;
32
+ is_private: boolean;
33
+ shared_with_all: boolean;
34
+ url?: string | undefined;
35
+ members?: string | undefined;
36
+ customuser_id?: number | undefined;
37
+ label?: string | null | undefined;
38
+ lastchanged?: string | undefined;
39
+ destination_selected_api?: string | null | undefined;
40
+ is_stale?: string | undefined;
41
+ is_shared?: string | undefined;
42
+ marked_stale_at?: string | null | undefined;
43
+ identifier?: string | null | undefined;
44
+ title?: string | null | undefined;
45
+ groups?: string | undefined;
46
+ permissions?: Record<string, boolean> | undefined;
47
+ }, {
48
+ account_id: number;
49
+ selected_api: string;
50
+ id: number;
51
+ date: string;
52
+ is_invite_only: boolean;
53
+ is_private: boolean;
54
+ shared_with_all: boolean;
55
+ url?: string | undefined;
56
+ members?: string | undefined;
57
+ customuser_id?: number | undefined;
58
+ label?: string | null | undefined;
59
+ lastchanged?: string | undefined;
60
+ destination_selected_api?: string | null | undefined;
61
+ is_stale?: string | undefined;
62
+ is_shared?: string | undefined;
63
+ marked_stale_at?: string | null | undefined;
64
+ identifier?: string | null | undefined;
65
+ title?: string | null | undefined;
66
+ groups?: string | undefined;
67
+ permissions?: Record<string, boolean> | undefined;
68
+ }>;
69
+ export declare const AuthenticationsResponseSchema: z.ZodObject<{
70
+ count: z.ZodNumber;
71
+ next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ previous: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
+ results: z.ZodArray<z.ZodObject<{
74
+ id: z.ZodNumber;
75
+ date: z.ZodString;
76
+ lastchanged: z.ZodOptional<z.ZodString>;
77
+ account_id: z.ZodNumber;
78
+ customuser_id: z.ZodOptional<z.ZodNumber>;
79
+ selected_api: z.ZodString;
80
+ destination_selected_api: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
+ is_invite_only: z.ZodBoolean;
82
+ is_private: z.ZodBoolean;
83
+ shared_with_all: z.ZodBoolean;
84
+ is_stale: z.ZodOptional<z.ZodString>;
85
+ is_shared: z.ZodOptional<z.ZodString>;
86
+ marked_stale_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
+ identifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
90
+ url: z.ZodOptional<z.ZodString>;
91
+ groups: z.ZodOptional<z.ZodString>;
92
+ members: z.ZodOptional<z.ZodString>;
93
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ account_id: number;
96
+ selected_api: string;
97
+ id: number;
98
+ date: string;
99
+ is_invite_only: boolean;
100
+ is_private: boolean;
101
+ shared_with_all: boolean;
102
+ url?: string | undefined;
103
+ members?: string | undefined;
104
+ customuser_id?: number | undefined;
105
+ label?: string | null | undefined;
106
+ lastchanged?: string | undefined;
107
+ destination_selected_api?: string | null | undefined;
108
+ is_stale?: string | undefined;
109
+ is_shared?: string | undefined;
110
+ marked_stale_at?: string | null | undefined;
111
+ identifier?: string | null | undefined;
112
+ title?: string | null | undefined;
113
+ groups?: string | undefined;
114
+ permissions?: Record<string, boolean> | undefined;
115
+ }, {
116
+ account_id: number;
117
+ selected_api: string;
118
+ id: number;
119
+ date: string;
120
+ is_invite_only: boolean;
121
+ is_private: boolean;
122
+ shared_with_all: boolean;
123
+ url?: string | undefined;
124
+ members?: string | undefined;
125
+ customuser_id?: number | undefined;
126
+ label?: string | null | undefined;
127
+ lastchanged?: string | undefined;
128
+ destination_selected_api?: string | null | undefined;
129
+ is_stale?: string | undefined;
130
+ is_shared?: string | undefined;
131
+ marked_stale_at?: string | null | undefined;
132
+ identifier?: string | null | undefined;
133
+ title?: string | null | undefined;
134
+ groups?: string | undefined;
135
+ permissions?: Record<string, boolean> | undefined;
136
+ }>, "many">;
137
+ }, "strip", z.ZodTypeAny, {
138
+ count: number;
139
+ results: {
140
+ account_id: number;
141
+ selected_api: string;
142
+ id: number;
143
+ date: string;
144
+ is_invite_only: boolean;
145
+ is_private: boolean;
146
+ shared_with_all: boolean;
147
+ url?: string | undefined;
148
+ members?: string | undefined;
149
+ customuser_id?: number | undefined;
150
+ label?: string | null | undefined;
151
+ lastchanged?: string | undefined;
152
+ destination_selected_api?: string | null | undefined;
153
+ is_stale?: string | undefined;
154
+ is_shared?: string | undefined;
155
+ marked_stale_at?: string | null | undefined;
156
+ identifier?: string | null | undefined;
157
+ title?: string | null | undefined;
158
+ groups?: string | undefined;
159
+ permissions?: Record<string, boolean> | undefined;
160
+ }[];
161
+ next?: string | null | undefined;
162
+ previous?: string | null | undefined;
163
+ }, {
164
+ count: number;
165
+ results: {
166
+ account_id: number;
167
+ selected_api: string;
168
+ id: number;
169
+ date: string;
170
+ is_invite_only: boolean;
171
+ is_private: boolean;
172
+ shared_with_all: boolean;
173
+ url?: string | undefined;
174
+ members?: string | undefined;
175
+ customuser_id?: number | undefined;
176
+ label?: string | null | undefined;
177
+ lastchanged?: string | undefined;
178
+ destination_selected_api?: string | null | undefined;
179
+ is_stale?: string | undefined;
180
+ is_shared?: string | undefined;
181
+ marked_stale_at?: string | null | undefined;
182
+ identifier?: string | null | undefined;
183
+ title?: string | null | undefined;
184
+ groups?: string | undefined;
185
+ permissions?: Record<string, boolean> | undefined;
186
+ }[];
187
+ next?: string | null | undefined;
188
+ previous?: string | null | undefined;
189
+ }>;
190
+ export type Authentication = z.infer<typeof AuthenticationSchema>;
191
+ /**
192
+ * Normalized authentication item returned by getAuthentication handler
193
+ *
194
+ * Transforms API response fields:
195
+ * - selected_api → implementation_id
196
+ * - customuser_id → user_id
197
+ * - is_stale → is_expired (preserved as is_stale too)
198
+ * - marked_stale_at → expired_at (preserved as marked_stale_at too)
199
+ *
200
+ * Adds computed fields:
201
+ * - app_key: Extracted from selected_api (e.g., "SlackCLIAPI@1.0.0" → "SlackCLIAPI")
202
+ * - app_version: Extracted from selected_api (e.g., "SlackCLIAPI@1.0.0" → "1.0.0")
203
+ */
204
+ export declare const AuthenticationItemSchema: z.ZodObject<Omit<{
205
+ id: z.ZodNumber;
206
+ date: z.ZodString;
207
+ lastchanged: z.ZodOptional<z.ZodString>;
208
+ account_id: z.ZodNumber;
209
+ customuser_id: z.ZodOptional<z.ZodNumber>;
210
+ selected_api: z.ZodString;
211
+ destination_selected_api: z.ZodOptional<z.ZodNullable<z.ZodString>>;
212
+ is_invite_only: z.ZodBoolean;
213
+ is_private: z.ZodBoolean;
214
+ shared_with_all: z.ZodBoolean;
215
+ is_stale: z.ZodOptional<z.ZodString>;
216
+ is_shared: z.ZodOptional<z.ZodString>;
217
+ marked_stale_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
218
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
219
+ identifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
220
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
221
+ url: z.ZodOptional<z.ZodString>;
222
+ groups: z.ZodOptional<z.ZodString>;
223
+ members: z.ZodOptional<z.ZodString>;
224
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
225
+ }, "customuser_id" | "selected_api"> & {
226
+ implementation_id: z.ZodOptional<z.ZodString>;
227
+ user_id: z.ZodOptional<z.ZodNumber>;
228
+ is_expired: z.ZodOptional<z.ZodString>;
229
+ expired_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
230
+ app_key: z.ZodOptional<z.ZodString>;
231
+ app_version: z.ZodOptional<z.ZodString>;
232
+ }, "strip", z.ZodTypeAny, {
233
+ account_id: number;
234
+ id: number;
235
+ date: string;
236
+ is_invite_only: boolean;
237
+ is_private: boolean;
238
+ shared_with_all: boolean;
239
+ url?: string | undefined;
240
+ members?: string | undefined;
241
+ label?: string | null | undefined;
242
+ lastchanged?: string | undefined;
243
+ destination_selected_api?: string | null | undefined;
244
+ is_stale?: string | undefined;
245
+ is_shared?: string | undefined;
246
+ marked_stale_at?: string | null | undefined;
247
+ identifier?: string | null | undefined;
248
+ title?: string | null | undefined;
249
+ groups?: string | undefined;
250
+ permissions?: Record<string, boolean> | undefined;
251
+ user_id?: number | undefined;
252
+ implementation_id?: string | undefined;
253
+ is_expired?: string | undefined;
254
+ expired_at?: string | null | undefined;
255
+ app_key?: string | undefined;
256
+ app_version?: string | undefined;
257
+ }, {
258
+ account_id: number;
259
+ id: number;
260
+ date: string;
261
+ is_invite_only: boolean;
262
+ is_private: boolean;
263
+ shared_with_all: boolean;
264
+ url?: string | undefined;
265
+ members?: string | undefined;
266
+ label?: string | null | undefined;
267
+ lastchanged?: string | undefined;
268
+ destination_selected_api?: string | null | undefined;
269
+ is_stale?: string | undefined;
270
+ is_shared?: string | undefined;
271
+ marked_stale_at?: string | null | undefined;
272
+ identifier?: string | null | undefined;
273
+ title?: string | null | undefined;
274
+ groups?: string | undefined;
275
+ permissions?: Record<string, boolean> | undefined;
276
+ user_id?: number | undefined;
277
+ implementation_id?: string | undefined;
278
+ is_expired?: string | undefined;
279
+ expired_at?: string | null | undefined;
280
+ app_key?: string | undefined;
281
+ app_version?: string | undefined;
282
+ }>;
283
+ export type AuthenticationItem = z.infer<typeof AuthenticationItemSchema>;
284
+ /**
285
+ * Public API schema for getAuthentication operation
286
+ *
287
+ * This is the user-facing schema that the SDK plugin accepts.
288
+ */
289
+ export declare const GetAuthenticationOptionsSchema: z.ZodObject<{
290
+ authenticationId: z.ZodNumber;
291
+ }, "strip", z.ZodTypeAny, {
292
+ authenticationId: number;
293
+ }, {
294
+ authenticationId: number;
295
+ }>;
296
+ export type GetAuthenticationOptions = z.infer<typeof GetAuthenticationOptionsSchema>;
297
+ /**
298
+ * Handler request schema for getAuthentication operation
299
+ *
300
+ * Accepts authenticationId as either string (from searchParams) or number,
301
+ * and normalizes to number for internal use.
302
+ */
303
+ export declare const GetAuthenticationHandlerRequestSchema: z.ZodEffects<z.ZodObject<{
304
+ authenticationId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
305
+ }, "strip", z.ZodTypeAny, {
306
+ authenticationId: string | number;
307
+ }, {
308
+ authenticationId: string | number;
309
+ }>, {
310
+ authenticationId: number;
311
+ }, {
312
+ authenticationId: string | number;
313
+ }>;
314
+ export type GetAuthenticationHandlerRequest = z.infer<typeof GetAuthenticationHandlerRequestSchema>;
315
+ /**
316
+ * Response schema for getAuthentication (single item)
317
+ */
318
+ export declare const GetAuthenticationResponseSchema: z.ZodObject<{
319
+ data: z.ZodLazy<z.ZodObject<Omit<{
320
+ id: z.ZodNumber;
321
+ date: z.ZodString;
322
+ lastchanged: z.ZodOptional<z.ZodString>;
323
+ account_id: z.ZodNumber;
324
+ customuser_id: z.ZodOptional<z.ZodNumber>;
325
+ selected_api: z.ZodString;
326
+ destination_selected_api: z.ZodOptional<z.ZodNullable<z.ZodString>>;
327
+ is_invite_only: z.ZodBoolean;
328
+ is_private: z.ZodBoolean;
329
+ shared_with_all: z.ZodBoolean;
330
+ is_stale: z.ZodOptional<z.ZodString>;
331
+ is_shared: z.ZodOptional<z.ZodString>;
332
+ marked_stale_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
333
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
334
+ identifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
335
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
336
+ url: z.ZodOptional<z.ZodString>;
337
+ groups: z.ZodOptional<z.ZodString>;
338
+ members: z.ZodOptional<z.ZodString>;
339
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
340
+ }, "customuser_id" | "selected_api"> & {
341
+ implementation_id: z.ZodOptional<z.ZodString>;
342
+ user_id: z.ZodOptional<z.ZodNumber>;
343
+ is_expired: z.ZodOptional<z.ZodString>;
344
+ expired_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
345
+ app_key: z.ZodOptional<z.ZodString>;
346
+ app_version: z.ZodOptional<z.ZodString>;
347
+ }, "strip", z.ZodTypeAny, {
348
+ account_id: number;
349
+ id: number;
350
+ date: string;
351
+ is_invite_only: boolean;
352
+ is_private: boolean;
353
+ shared_with_all: boolean;
354
+ url?: string | undefined;
355
+ members?: string | undefined;
356
+ label?: string | null | undefined;
357
+ lastchanged?: string | undefined;
358
+ destination_selected_api?: string | null | undefined;
359
+ is_stale?: string | undefined;
360
+ is_shared?: string | undefined;
361
+ marked_stale_at?: string | null | undefined;
362
+ identifier?: string | null | undefined;
363
+ title?: string | null | undefined;
364
+ groups?: string | undefined;
365
+ permissions?: Record<string, boolean> | undefined;
366
+ user_id?: number | undefined;
367
+ implementation_id?: string | undefined;
368
+ is_expired?: string | undefined;
369
+ expired_at?: string | null | undefined;
370
+ app_key?: string | undefined;
371
+ app_version?: string | undefined;
372
+ }, {
373
+ account_id: number;
374
+ id: number;
375
+ date: string;
376
+ is_invite_only: boolean;
377
+ is_private: boolean;
378
+ shared_with_all: boolean;
379
+ url?: string | undefined;
380
+ members?: string | undefined;
381
+ label?: string | null | undefined;
382
+ lastchanged?: string | undefined;
383
+ destination_selected_api?: string | null | undefined;
384
+ is_stale?: string | undefined;
385
+ is_shared?: string | undefined;
386
+ marked_stale_at?: string | null | undefined;
387
+ identifier?: string | null | undefined;
388
+ title?: string | null | undefined;
389
+ groups?: string | undefined;
390
+ permissions?: Record<string, boolean> | undefined;
391
+ user_id?: number | undefined;
392
+ implementation_id?: string | undefined;
393
+ is_expired?: string | undefined;
394
+ expired_at?: string | null | undefined;
395
+ app_key?: string | undefined;
396
+ app_version?: string | undefined;
397
+ }>>;
398
+ }, "strip", z.ZodTypeAny, {
399
+ data: {
400
+ account_id: number;
401
+ id: number;
402
+ date: string;
403
+ is_invite_only: boolean;
404
+ is_private: boolean;
405
+ shared_with_all: boolean;
406
+ url?: string | undefined;
407
+ members?: string | undefined;
408
+ label?: string | null | undefined;
409
+ lastchanged?: string | undefined;
410
+ destination_selected_api?: string | null | undefined;
411
+ is_stale?: string | undefined;
412
+ is_shared?: string | undefined;
413
+ marked_stale_at?: string | null | undefined;
414
+ identifier?: string | null | undefined;
415
+ title?: string | null | undefined;
416
+ groups?: string | undefined;
417
+ permissions?: Record<string, boolean> | undefined;
418
+ user_id?: number | undefined;
419
+ implementation_id?: string | undefined;
420
+ is_expired?: string | undefined;
421
+ expired_at?: string | null | undefined;
422
+ app_key?: string | undefined;
423
+ app_version?: string | undefined;
424
+ };
425
+ }, {
426
+ data: {
427
+ account_id: number;
428
+ id: number;
429
+ date: string;
430
+ is_invite_only: boolean;
431
+ is_private: boolean;
432
+ shared_with_all: boolean;
433
+ url?: string | undefined;
434
+ members?: string | undefined;
435
+ label?: string | null | undefined;
436
+ lastchanged?: string | undefined;
437
+ destination_selected_api?: string | null | undefined;
438
+ is_stale?: string | undefined;
439
+ is_shared?: string | undefined;
440
+ marked_stale_at?: string | null | undefined;
441
+ identifier?: string | null | undefined;
442
+ title?: string | null | undefined;
443
+ groups?: string | undefined;
444
+ permissions?: Record<string, boolean> | undefined;
445
+ user_id?: number | undefined;
446
+ implementation_id?: string | undefined;
447
+ is_expired?: string | undefined;
448
+ expired_at?: string | null | undefined;
449
+ app_key?: string | undefined;
450
+ app_version?: string | undefined;
451
+ };
452
+ }>;
453
+ export type GetAuthenticationResponse = z.infer<typeof GetAuthenticationResponseSchema>;
454
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/temporary-internal-core/schemas/authentications/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqB/B,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKxC,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAenC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;;;;EAQO,CAAC;AAEnD,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qCAAqC;;;;;;;;;;EAW7C,CAAC;AAEN,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,qCAAqC,CAC7C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE1C,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Authentication schemas
3
+ */
4
+ import { z } from "zod";
5
+ export const AuthenticationSchema = z.object({
6
+ id: z.number(),
7
+ date: z.string(),
8
+ lastchanged: z.string().optional(),
9
+ account_id: z.number(),
10
+ customuser_id: z.number().optional(),
11
+ selected_api: z.string(),
12
+ destination_selected_api: z.string().nullable().optional(),
13
+ is_invite_only: z.boolean(),
14
+ is_private: z.boolean(),
15
+ shared_with_all: z.boolean(),
16
+ is_stale: z.string().optional(),
17
+ is_shared: z.string().optional(),
18
+ marked_stale_at: z.string().nullable().optional(),
19
+ label: z.string().nullable().optional(),
20
+ identifier: z.string().nullable().optional(),
21
+ title: z.string().nullable().optional(),
22
+ url: z.string().optional(),
23
+ groups: z.string().optional(),
24
+ members: z.string().optional(),
25
+ permissions: z.record(z.boolean()).optional(),
26
+ });
27
+ export const AuthenticationsResponseSchema = z.object({
28
+ count: z.number(),
29
+ next: z.string().nullable().optional(),
30
+ previous: z.string().nullable().optional(),
31
+ results: z.array(AuthenticationSchema),
32
+ });
33
+ /**
34
+ * Normalized authentication item returned by getAuthentication handler
35
+ *
36
+ * Transforms API response fields:
37
+ * - selected_api → implementation_id
38
+ * - customuser_id → user_id
39
+ * - is_stale → is_expired (preserved as is_stale too)
40
+ * - marked_stale_at → expired_at (preserved as marked_stale_at too)
41
+ *
42
+ * Adds computed fields:
43
+ * - app_key: Extracted from selected_api (e.g., "SlackCLIAPI@1.0.0" → "SlackCLIAPI")
44
+ * - app_version: Extracted from selected_api (e.g., "SlackCLIAPI@1.0.0" → "1.0.0")
45
+ */
46
+ export const AuthenticationItemSchema = AuthenticationSchema.omit({
47
+ selected_api: true,
48
+ customuser_id: true,
49
+ }).extend({
50
+ // Renamed fields
51
+ implementation_id: z.string().optional(),
52
+ user_id: z.number().optional(),
53
+ // Mapped fields (originals preserved in ...restOfAuth)
54
+ is_expired: z.string().optional(),
55
+ expired_at: z.string().nullable().optional(),
56
+ // Computed fields
57
+ app_key: z.string().optional(),
58
+ app_version: z.string().optional(),
59
+ });
60
+ /**
61
+ * Public API schema for getAuthentication operation
62
+ *
63
+ * This is the user-facing schema that the SDK plugin accepts.
64
+ */
65
+ export const GetAuthenticationOptionsSchema = z
66
+ .object({
67
+ authenticationId: z
68
+ .number()
69
+ .int()
70
+ .positive()
71
+ .describe("Authentication ID to retrieve"),
72
+ })
73
+ .describe("Get a specific authentication by ID");
74
+ /**
75
+ * Handler request schema for getAuthentication operation
76
+ *
77
+ * Accepts authenticationId as either string (from searchParams) or number,
78
+ * and normalizes to number for internal use.
79
+ */
80
+ export const GetAuthenticationHandlerRequestSchema = z
81
+ .object({
82
+ authenticationId: z
83
+ .union([z.string(), z.number()])
84
+ .describe("Authentication ID - string from searchParams or number"),
85
+ })
86
+ .transform((data) => ({
87
+ authenticationId: typeof data.authenticationId === "string"
88
+ ? parseInt(data.authenticationId, 10)
89
+ : data.authenticationId,
90
+ }));
91
+ /**
92
+ * Response schema for getAuthentication (single item)
93
+ */
94
+ export const GetAuthenticationResponseSchema = z.object({
95
+ data: z.lazy(() => AuthenticationItemSchema),
96
+ });
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Standard error format returned by the Zapier API
3
+ */
4
+ export interface ApiError {
5
+ status: number;
6
+ code: string;
7
+ title: string;
8
+ detail: string;
9
+ source?: unknown;
10
+ meta?: unknown;
11
+ }
12
+ /**
13
+ * Base options for all error constructors
14
+ */
15
+ export interface ErrorOptions {
16
+ statusCode?: number;
17
+ errors?: ApiError[];
18
+ cause?: unknown;
19
+ response?: unknown;
20
+ }
21
+ /**
22
+ * Base class for all Zapier SDK errors
23
+ * Use instanceof ZapierError to check if an error is from the SDK
24
+ */
25
+ export declare abstract class ZapierError extends Error {
26
+ abstract readonly name: string;
27
+ statusCode?: number;
28
+ errors?: ApiError[];
29
+ cause?: unknown;
30
+ response?: unknown;
31
+ constructor(message: string, options?: ErrorOptions);
32
+ }
33
+ /**
34
+ * Error thrown when API requests fail
35
+ */
36
+ export declare class ZapierApiError extends ZapierError {
37
+ readonly name = "ZapierApiError";
38
+ constructor(message: string, options?: ErrorOptions);
39
+ }
40
+ /**
41
+ * Error thrown when an app is not found
42
+ */
43
+ export declare class ZapierAppNotFoundError extends ZapierError {
44
+ readonly name = "ZapierAppNotFoundError";
45
+ appKey?: string;
46
+ constructor(message: string, options?: ErrorOptions & {
47
+ appKey?: string;
48
+ });
49
+ }
50
+ /**
51
+ * Error thrown when validation fails (e.g., invalid parameters)
52
+ */
53
+ export declare class ZapierValidationError extends ZapierError {
54
+ readonly name = "ZapierValidationError";
55
+ details?: unknown;
56
+ constructor(message: string, options?: ErrorOptions & {
57
+ details?: unknown;
58
+ });
59
+ }
60
+ /**
61
+ * Error for unrecognized/unknown errors that get wrapped by safe functions
62
+ */
63
+ export declare class ZapierUnknownError extends ZapierError {
64
+ readonly name = "ZapierUnknownError";
65
+ constructor(message: string, options?: ErrorOptions);
66
+ }
67
+ /**
68
+ * Error thrown for authentication and authorization failures (401/403)
69
+ */
70
+ export declare class ZapierAuthenticationError extends ZapierError {
71
+ readonly name = "ZapierAuthenticationError";
72
+ constructor(message: string, options?: ErrorOptions);
73
+ }
74
+ /**
75
+ * Error thrown when a requested resource is not found
76
+ */
77
+ export declare class ZapierResourceNotFoundError extends ZapierError {
78
+ readonly name = "ZapierResourceNotFoundError";
79
+ resourceType?: string;
80
+ resourceId?: string;
81
+ constructor(message: string, options?: ErrorOptions & {
82
+ resourceType?: string;
83
+ resourceId?: string;
84
+ });
85
+ }
86
+ /**
87
+ * Error thrown when required app or implementation configuration is missing
88
+ */
89
+ export declare class ZapierConfigurationError extends ZapierError {
90
+ readonly name = "ZapierConfigurationError";
91
+ configType?: string;
92
+ constructor(message: string, options?: ErrorOptions & {
93
+ configType?: string;
94
+ });
95
+ }
96
+ /**
97
+ * Error thrown when code bundling or compilation fails
98
+ */
99
+ export declare class ZapierBundleError extends ZapierError {
100
+ readonly name = "ZapierBundleError";
101
+ buildErrors?: string[];
102
+ constructor(message: string, options?: ErrorOptions & {
103
+ buildErrors?: string[];
104
+ });
105
+ }
106
+ /**
107
+ * Error thrown when operations timeout or exceed retry limits
108
+ */
109
+ export declare class ZapierTimeoutError extends ZapierError {
110
+ readonly name = "ZapierTimeoutError";
111
+ attempts?: number;
112
+ maxAttempts?: number;
113
+ constructor(message: string, options?: ErrorOptions & {
114
+ attempts?: number;
115
+ maxAttempts?: number;
116
+ });
117
+ }
118
+ /**
119
+ * Error thrown when action execution fails due to errors returned from the third-party service
120
+ * This happens when the Actions API returns a 200 status but includes errors in the response
121
+ */
122
+ export declare class ZapierActionError extends ZapierError {
123
+ readonly name = "ZapierActionError";
124
+ appKey?: string;
125
+ actionKey?: string;
126
+ constructor(message: string, options?: ErrorOptions & {
127
+ appKey?: string;
128
+ actionKey?: string;
129
+ });
130
+ get actionErrors(): ApiError[] | undefined;
131
+ }
132
+ /**
133
+ * Error thrown when a resource is not found (404)
134
+ */
135
+ export declare class ZapierNotFoundError extends ZapierError {
136
+ readonly name = "ZapierNotFoundError";
137
+ constructor(message: string, options?: ErrorOptions);
138
+ }
139
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["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