@zapier/zapier-sdk 0.8.3 → 0.10.0

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 (222) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +17 -40
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +14 -0
  5. package/dist/api/debug.d.ts +1 -0
  6. package/dist/api/debug.d.ts.map +1 -1
  7. package/dist/api/debug.js +42 -1
  8. package/dist/api/debug.test.d.ts +2 -0
  9. package/dist/api/debug.test.d.ts.map +1 -0
  10. package/dist/api/debug.test.js +59 -0
  11. package/dist/api/schemas.d.ts +451 -251
  12. package/dist/api/schemas.d.ts.map +1 -1
  13. package/dist/api/schemas.js +51 -29
  14. package/dist/index.cjs +1149 -751
  15. package/dist/index.d.mts +2359 -2161
  16. package/dist/index.d.ts +3 -5
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +2 -4
  19. package/dist/index.mjs +1143 -743
  20. package/dist/plugins/apps/index.d.ts +4 -0
  21. package/dist/plugins/apps/index.d.ts.map +1 -1
  22. package/dist/plugins/findFirstAuthentication/index.d.ts +1 -1
  23. package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -1
  24. package/dist/plugins/findFirstAuthentication/index.js +9 -1
  25. package/dist/plugins/findFirstAuthentication/index.test.js +3 -4
  26. package/dist/plugins/findFirstAuthentication/schemas.d.ts +5 -3
  27. package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +1 -1
  28. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -1
  29. package/dist/plugins/findUniqueAuthentication/index.js +4 -0
  30. package/dist/plugins/findUniqueAuthentication/schemas.d.ts +5 -3
  31. package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +1 -1
  32. package/dist/plugins/getAction/index.d.ts.map +1 -1
  33. package/dist/plugins/getAction/index.js +10 -0
  34. package/dist/plugins/getAction/schemas.d.ts +5 -3
  35. package/dist/plugins/getAction/schemas.d.ts.map +1 -1
  36. package/dist/plugins/getApp/index.d.ts +2 -7
  37. package/dist/plugins/getApp/index.d.ts.map +1 -1
  38. package/dist/plugins/getApp/index.js +17 -9
  39. package/dist/plugins/getApp/index.test.js +3 -3
  40. package/dist/plugins/getApp/schemas.d.ts +3 -1
  41. package/dist/plugins/getApp/schemas.d.ts.map +1 -1
  42. package/dist/plugins/getApp/schemas.js +2 -4
  43. package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
  44. package/dist/plugins/getAuthentication/index.js +8 -0
  45. package/dist/plugins/getAuthentication/index.test.js +1 -1
  46. package/dist/plugins/getProfile/index.d.ts.map +1 -1
  47. package/dist/plugins/getProfile/index.js +4 -0
  48. package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
  49. package/dist/plugins/getProfile/schemas.js +4 -3
  50. package/dist/plugins/listActions/index.d.ts +2 -4
  51. package/dist/plugins/listActions/index.d.ts.map +1 -1
  52. package/dist/plugins/listActions/index.js +10 -1
  53. package/dist/plugins/listActions/index.test.js +4 -4
  54. package/dist/plugins/listActions/schemas.d.ts +5 -3
  55. package/dist/plugins/listActions/schemas.d.ts.map +1 -1
  56. package/dist/plugins/listActions/schemas.js +2 -4
  57. package/dist/plugins/listApps/index.d.ts +4 -7
  58. package/dist/plugins/listApps/index.d.ts.map +1 -1
  59. package/dist/plugins/listApps/index.js +37 -17
  60. package/dist/plugins/listApps/index.test.js +23 -3
  61. package/dist/plugins/listApps/schemas.d.ts.map +1 -1
  62. package/dist/plugins/listApps/schemas.js +3 -9
  63. package/dist/plugins/listAuthentications/index.d.ts +2 -4
  64. package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
  65. package/dist/plugins/listAuthentications/index.js +12 -0
  66. package/dist/plugins/listAuthentications/index.test.js +39 -13
  67. package/dist/plugins/listAuthentications/schemas.d.ts +8 -3
  68. package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
  69. package/dist/plugins/listAuthentications/schemas.js +4 -0
  70. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  71. package/dist/plugins/listInputFieldChoices/index.js +14 -2
  72. package/dist/plugins/listInputFieldChoices/schemas.d.ts +5 -3
  73. package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
  74. package/dist/plugins/listInputFieldChoices/schemas.js +10 -19
  75. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  76. package/dist/plugins/listInputFields/index.js +14 -2
  77. package/dist/plugins/listInputFields/index.test.js +5 -9
  78. package/dist/plugins/listInputFields/schemas.d.ts +5 -3
  79. package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
  80. package/dist/plugins/manifest/index.d.ts +25 -9
  81. package/dist/plugins/manifest/index.d.ts.map +1 -1
  82. package/dist/plugins/manifest/index.js +239 -67
  83. package/dist/plugins/manifest/index.test.js +426 -171
  84. package/dist/plugins/manifest/schemas.d.ts +5 -1
  85. package/dist/plugins/manifest/schemas.d.ts.map +1 -1
  86. package/dist/plugins/manifest/schemas.js +1 -0
  87. package/dist/plugins/registry/index.d.ts.map +1 -1
  88. package/dist/plugins/registry/index.js +8 -2
  89. package/dist/plugins/request/index.d.ts.map +1 -1
  90. package/dist/plugins/request/index.js +1 -0
  91. package/dist/plugins/runAction/index.d.ts.map +1 -1
  92. package/dist/plugins/runAction/index.js +12 -0
  93. package/dist/plugins/runAction/schemas.d.ts +5 -3
  94. package/dist/plugins/runAction/schemas.d.ts.map +1 -1
  95. package/dist/resolvers/actionKey.d.ts +13 -7
  96. package/dist/resolvers/actionKey.d.ts.map +1 -1
  97. package/dist/resolvers/actionType.d.ts +8 -7
  98. package/dist/resolvers/actionType.d.ts.map +1 -1
  99. package/dist/resolvers/appKey.d.ts +2 -6
  100. package/dist/resolvers/appKey.d.ts.map +1 -1
  101. package/dist/resolvers/authenticationId.d.ts +7 -7
  102. package/dist/resolvers/authenticationId.d.ts.map +1 -1
  103. package/dist/resolvers/authenticationId.js +16 -7
  104. package/dist/resolvers/index.d.ts +3 -35
  105. package/dist/resolvers/index.d.ts.map +1 -1
  106. package/dist/resolvers/index.js +4 -87
  107. package/dist/resolvers/inputFieldKey.d.ts +11 -0
  108. package/dist/resolvers/inputFieldKey.d.ts.map +1 -0
  109. package/dist/resolvers/inputFieldKey.js +23 -0
  110. package/dist/resolvers/inputs.d.ts +11 -6
  111. package/dist/resolvers/inputs.d.ts.map +1 -1
  112. package/dist/resolvers/inputs.js +17 -0
  113. package/dist/schemas/Action.d.ts +8 -8
  114. package/dist/schemas/Action.d.ts.map +1 -1
  115. package/dist/schemas/Action.js +8 -3
  116. package/dist/schemas/App.d.ts +183 -11
  117. package/dist/schemas/App.d.ts.map +1 -1
  118. package/dist/schemas/App.js +7 -9
  119. package/dist/schemas/Auth.d.ts +12 -12
  120. package/dist/schemas/Auth.js +1 -1
  121. package/dist/schemas/Field.d.ts +5 -98
  122. package/dist/schemas/Field.d.ts.map +1 -1
  123. package/dist/schemas/Field.js +24 -52
  124. package/dist/schemas/Run.d.ts +3 -0
  125. package/dist/schemas/Run.d.ts.map +1 -0
  126. package/dist/schemas/Run.js +31 -0
  127. package/dist/schemas/UserProfile.d.ts +11 -11
  128. package/dist/schemas/UserProfile.d.ts.map +1 -1
  129. package/dist/schemas/UserProfile.js +21 -7
  130. package/dist/sdk.d.ts +15 -14
  131. package/dist/sdk.d.ts.map +1 -1
  132. package/dist/sdk.js +1 -4
  133. package/dist/types/plugin.d.ts +6 -0
  134. package/dist/types/plugin.d.ts.map +1 -1
  135. package/dist/types/properties.d.ts +3 -1
  136. package/dist/types/properties.d.ts.map +1 -1
  137. package/dist/types/sdk.d.ts +11 -3
  138. package/dist/types/sdk.d.ts.map +1 -1
  139. package/dist/utils/domain-utils.d.ts +17 -16
  140. package/dist/utils/domain-utils.d.ts.map +1 -1
  141. package/dist/utils/domain-utils.js +53 -78
  142. package/dist/utils/domain-utils.test.js +157 -3
  143. package/dist/utils/file-utils.d.ts +4 -0
  144. package/dist/utils/file-utils.d.ts.map +1 -0
  145. package/dist/utils/file-utils.js +74 -0
  146. package/dist/utils/file-utils.test.d.ts +2 -0
  147. package/dist/utils/file-utils.test.d.ts.map +1 -0
  148. package/dist/utils/file-utils.test.js +51 -0
  149. package/dist/utils/schema-utils.d.ts +44 -21
  150. package/dist/utils/schema-utils.d.ts.map +1 -1
  151. package/dist/utils/schema-utils.js +17 -11
  152. package/package.json +1 -1
  153. package/src/api/client.ts +12 -0
  154. package/src/api/debug.test.ts +76 -0
  155. package/src/api/debug.ts +46 -2
  156. package/src/api/schemas.ts +51 -29
  157. package/src/index.ts +5 -6
  158. package/src/plugins/apps/index.ts +9 -2
  159. package/src/plugins/findFirstAuthentication/index.test.ts +8 -5
  160. package/src/plugins/findFirstAuthentication/index.ts +14 -2
  161. package/src/plugins/findUniqueAuthentication/index.ts +4 -0
  162. package/src/plugins/getAction/index.ts +14 -0
  163. package/src/plugins/getApp/index.test.ts +3 -3
  164. package/src/plugins/getApp/index.ts +20 -14
  165. package/src/plugins/getApp/schemas.ts +7 -12
  166. package/src/plugins/getAuthentication/index.test.ts +1 -1
  167. package/src/plugins/getAuthentication/index.ts +8 -0
  168. package/src/plugins/getProfile/index.ts +4 -0
  169. package/src/plugins/getProfile/schemas.ts +4 -6
  170. package/src/plugins/listActions/index.test.ts +8 -7
  171. package/src/plugins/listActions/index.ts +12 -3
  172. package/src/plugins/listActions/schemas.ts +20 -25
  173. package/src/plugins/listApps/index.test.ts +24 -3
  174. package/src/plugins/listApps/index.ts +50 -25
  175. package/src/plugins/listApps/schemas.ts +17 -26
  176. package/src/plugins/listAuthentications/index.test.ts +52 -15
  177. package/src/plugins/listAuthentications/index.ts +15 -2
  178. package/src/plugins/listAuthentications/schemas.ts +4 -0
  179. package/src/plugins/listInputFieldChoices/index.ts +21 -1
  180. package/src/plugins/listInputFieldChoices/schemas.ts +61 -76
  181. package/src/plugins/listInputFields/index.test.ts +5 -9
  182. package/src/plugins/listInputFields/index.ts +20 -2
  183. package/src/plugins/manifest/index.test.ts +503 -197
  184. package/src/plugins/manifest/index.ts +338 -82
  185. package/src/plugins/manifest/schemas.ts +9 -2
  186. package/src/plugins/registry/index.ts +8 -2
  187. package/src/plugins/request/index.ts +1 -0
  188. package/src/plugins/runAction/index.ts +18 -0
  189. package/src/resolvers/actionKey.ts +15 -13
  190. package/src/resolvers/actionType.ts +10 -12
  191. package/src/resolvers/appKey.ts +2 -6
  192. package/src/resolvers/authenticationId.ts +25 -19
  193. package/src/resolvers/index.ts +7 -113
  194. package/src/resolvers/inputFieldKey.ts +38 -0
  195. package/src/resolvers/inputs.ts +28 -10
  196. package/src/schemas/Action.ts +8 -3
  197. package/src/schemas/App.ts +7 -9
  198. package/src/schemas/Auth.ts +1 -1
  199. package/src/schemas/Field.ts +24 -57
  200. package/src/schemas/Run.ts +40 -0
  201. package/src/schemas/UserProfile.ts +24 -7
  202. package/src/sdk.ts +18 -12
  203. package/src/types/plugin.ts +8 -0
  204. package/src/types/sdk.ts +31 -21
  205. package/src/utils/domain-utils.test.ts +196 -2
  206. package/src/utils/domain-utils.ts +77 -102
  207. package/src/utils/file-utils.test.ts +73 -0
  208. package/src/utils/file-utils.ts +94 -0
  209. package/src/utils/schema-utils.ts +96 -44
  210. package/tsconfig.tsbuildinfo +1 -1
  211. package/dist/plugins/lockVersion/index.d.ts +0 -24
  212. package/dist/plugins/lockVersion/index.d.ts.map +0 -1
  213. package/dist/plugins/lockVersion/index.js +0 -72
  214. package/dist/plugins/lockVersion/index.test.d.ts +0 -2
  215. package/dist/plugins/lockVersion/index.test.d.ts.map +0 -1
  216. package/dist/plugins/lockVersion/index.test.js +0 -129
  217. package/dist/plugins/lockVersion/schemas.d.ts +0 -10
  218. package/dist/plugins/lockVersion/schemas.d.ts.map +0 -1
  219. package/dist/plugins/lockVersion/schemas.js +0 -6
  220. package/src/plugins/lockVersion/index.test.ts +0 -176
  221. package/src/plugins/lockVersion/index.ts +0 -112
  222. package/src/plugins/lockVersion/schemas.ts +0 -9
@@ -118,7 +118,7 @@ export const FieldSchema = z.object({
118
118
  });
119
119
 
120
120
  export const ActionExecutionResultSchema = z.object({
121
- data: z.array(z.any()),
121
+ data: z.array(z.unknown()),
122
122
  });
123
123
 
124
124
  export const ActionFieldChoiceSchema = z.object({
@@ -217,9 +217,9 @@ export const UserProfileSchema = z.object({
217
217
  enable_totp_2fa: z.boolean(),
218
218
  viewed_help: z.record(z.boolean()),
219
219
  show_editor_migration_mesaging: z.boolean(),
220
- switches: z.record(z.any()),
221
- organizations: z.array(z.any().nullable()),
222
- primary_organization: z.any().nullable(),
220
+ switches: z.record(z.unknown()),
221
+ organizations: z.array(z.record(z.unknown()).nullable()),
222
+ primary_organization: z.record(z.unknown()).nullable(),
223
223
  has_active_zaps: z.boolean(),
224
224
  has_google_sso: z.boolean(),
225
225
  auth_realm: z.string(),
@@ -236,7 +236,7 @@ export const AppSchema = z.object({
236
236
  api_docs_url: z.string().nullable().optional(),
237
237
  app_profile_url: z.string(),
238
238
  banner: z.string().optional(),
239
- categories: z.array(z.any()).optional(), // TODO: Define proper service_category type
239
+ categories: z.array(z.string()).optional(), // Service category names
240
240
  canonical_id: z.string().optional(),
241
241
  current_implementation_id: z.string(),
242
242
  days_since_last_update: z.string().optional(),
@@ -294,7 +294,7 @@ export const NeedsRequestSchema = z.object({
294
294
  action: z.string(),
295
295
  type_of: z.string(),
296
296
  authentication_id: z.number().optional(),
297
- params: z.record(z.any()).optional(),
297
+ params: z.record(z.unknown()).optional(),
298
298
  });
299
299
 
300
300
  export const NeedsResponseSchema = z.object({
@@ -341,20 +341,11 @@ export const ImplementationsResponseSchema = z.object({
341
341
  // ============================================================================
342
342
 
343
343
  export const ImplementationMetaSchema = z.object({
344
- id: z.string(), // e.g. "ZapierFormatterCLIAPI@1.0.7"
344
+ id: z.string(), // e.g. "100HiresCLIAPI@1.2.1"
345
345
  name: z.string(),
346
346
  slug: z.string(),
347
- images: z
348
- .object({
349
- url_16x16: z.string().optional(),
350
- url_32x32: z.string().optional(),
351
- url_64x64: z.string().optional(),
352
- url_128x128: z.string().optional(),
353
- })
354
- .optional(),
355
- // Include other fields for completeness but we'll only use what we need
356
- ageInDays: z.union([z.string(), z.number()]).optional(),
357
- authType: z.string().nullable().optional(),
347
+ age_in_days: z.number().optional(),
348
+ auth_type: z.string().optional(),
358
349
  banner: z.string().optional(),
359
350
  categories: z
360
351
  .array(
@@ -365,18 +356,49 @@ export const ImplementationMetaSchema = z.object({
365
356
  }),
366
357
  )
367
358
  .optional(),
368
- isBeta: z.boolean().optional(),
369
- isBuiltIn: z.boolean().optional(),
370
- isDeprecated: z.boolean().optional(),
371
- isFeatured: z.boolean().optional(),
372
- isHidden: z.boolean().optional(),
373
- isInvite: z.boolean().optional(),
374
- isPremium: z.boolean().optional(),
375
- isPublic: z.boolean().optional(),
376
- isUpcoming: z.boolean().optional(),
359
+ images: z
360
+ .object({
361
+ url_16x16: z.string().optional(),
362
+ url_32x32: z.string().optional(),
363
+ url_64x64: z.string().optional(),
364
+ url_128x128: z.string().optional(),
365
+ })
366
+ .optional(),
377
367
  popularity: z.number().optional(),
378
- apiDocsUrl: z.string().optional(),
368
+ has_filters: z.boolean().optional(),
369
+ has_reads: z.boolean().optional(),
370
+ has_searches: z.boolean().optional(),
371
+ has_searches_or_writes: z.boolean().optional(),
372
+ has_upfront_fields: z.boolean().optional(),
373
+ has_writes: z.boolean().optional(),
374
+ is_beta: z.boolean().optional(),
375
+ is_built_in: z.boolean().optional(),
376
+ is_deprecated: z.boolean().optional(),
377
+ is_featured: z.boolean().optional(),
378
+ is_hidden: z.boolean().optional(),
379
+ is_invite: z.boolean().optional(),
380
+ is_premium: z.boolean().optional(),
381
+ is_public: z.boolean().optional(),
382
+ is_upcoming: z.boolean().optional(),
383
+ version: z.string().optional(),
384
+ visibility: z.string().optional(),
385
+ actions: z
386
+ .object({
387
+ read: z.number().optional(),
388
+ read_bulk: z.number().optional(),
389
+ write: z.number().optional(),
390
+ search: z.number().optional(),
391
+ search_or_write: z.number().optional(),
392
+ search_and_write: z.number().optional(),
393
+ filter: z.number().optional(),
394
+ })
395
+ .optional(),
396
+ description: z.string().optional(),
397
+ primary_color: z.string().optional(),
398
+ secondary_color: z.string().optional(),
379
399
  classification: z.string().optional(),
400
+ api_docs_url: z.string().optional(),
401
+ image: z.string().optional(),
380
402
  });
381
403
 
382
404
  export const ImplementationsMetaResponseSchema = z.object({
@@ -413,7 +435,7 @@ export const NeedChoicesRequestSchema = z.object({
413
435
  "If the app needs auth, provide an `authentication_id` that has the `selected_api` of the app you want to run. Can be any auth visible to the user (including shared).",
414
436
  ),
415
437
  params: z
416
- .record(z.any())
438
+ .record(z.unknown())
417
439
  .optional()
418
440
  .describe(
419
441
  "Object that matches the input the node would normally get. Has all the same keys/types as the `needs` of the action.",
package/src/index.ts CHANGED
@@ -17,7 +17,6 @@ export * from "./plugins/findUniqueAuthentication";
17
17
  export * from "./plugins/runAction";
18
18
  export * from "./plugins/request";
19
19
  export * from "./plugins/manifest";
20
- export * from "./plugins/lockVersion";
21
20
  export * from "./plugins/getProfile";
22
21
  export * from "./plugins/api";
23
22
 
@@ -39,16 +38,15 @@ export type {
39
38
  } from "./api/types";
40
39
 
41
40
  // Export schema utilities for CLI
42
- export { isPositional } from "./utils/schema-utils";
43
- export { hasResolver } from "./resolvers";
41
+ export { isPositional, PositionalMetadata } from "./utils/schema-utils";
44
42
  export { createFunction } from "./utils/function-utils";
45
43
 
44
+ // Export resolver utilities for CLI
45
+ export * from "./resolvers";
46
+
46
47
  // Export auth utilities for CLI use
47
48
  export * from "./auth";
48
49
 
49
- // Export resolvers for CLI use
50
- export * from "./resolvers";
51
-
52
50
  // All functions now available through the plugin system via createZapierSdk()
53
51
  // Export plugin schemas for external use
54
52
  export {
@@ -74,6 +72,7 @@ export type {
74
72
  PluginDependencies,
75
73
  PluginOptions,
76
74
  GetSdkType,
75
+ GetContextType,
77
76
  Sdk,
78
77
  } from "./types/plugin";
79
78
 
@@ -1,5 +1,4 @@
1
- import type { ActionExecutionOptions } from "./types";
2
- import type { ActionProxy } from "./types";
1
+ import type { ActionExecutionOptions, ActionProxy } from "./types";
3
2
  import { ZapierValidationError } from "../../types/errors";
4
3
  import type { Plugin, GetSdkType } from "../../types/plugin";
5
4
  import type { FetchPluginProvides } from "../fetch/index";
@@ -173,3 +172,11 @@ export const appsPlugin: Plugin<
173
172
  apps: createAppsProxy({ sdk }),
174
173
  };
175
174
  };
175
+
176
+ // Export types for use in generated code
177
+ export type { ActionExecutionOptions } from "./types";
178
+ export type { ActionExecutionResult } from "../../api/types";
179
+
180
+ // Interface for generated apps - will be augmented by generated .d.ts files
181
+ // This interface will contain only the specifically typed apps
182
+ export interface ZapierSdkApps {}
@@ -132,17 +132,20 @@ describe("findFirstAuthentication plugin", () => {
132
132
  expect(result.data).toEqual(mockAuth);
133
133
  });
134
134
 
135
- it("should return null when no authentications found", async () => {
135
+ it("should throw error when no authentications found", async () => {
136
136
  mockListAuthentications.mockResolvedValue({
137
137
  data: [],
138
138
  });
139
139
 
140
140
  const sdk = createTestSdk();
141
- const result = await sdk.findFirstAuthentication({
142
- appKey: "nonexistent",
143
- });
144
141
 
145
- expect(result.data).toBeNull();
142
+ await expect(
143
+ sdk.findFirstAuthentication({
144
+ appKey: "nonexistent",
145
+ }),
146
+ ).rejects.toThrow(
147
+ "No authentication found matching the specified criteria",
148
+ );
146
149
  });
147
150
 
148
151
  it("should return first authentication when multiple found", async () => {
@@ -6,11 +6,13 @@ import {
6
6
  } from "./schemas";
7
7
  import { createFunction } from "../../utils/function-utils";
8
8
  import type { ListAuthenticationsPluginProvides } from "../listAuthentications";
9
+ import { AuthenticationItemSchema } from "../../schemas/Auth";
10
+ import { ZapierResourceNotFoundError } from "../../types/errors";
9
11
 
10
12
  export interface FindFirstAuthenticationPluginProvides {
11
13
  findFirstAuthentication: (
12
14
  options?: FindFirstAuthenticationOptions,
13
- ) => Promise<{ data: AuthenticationItem | null }>;
15
+ ) => Promise<{ data: AuthenticationItem }>;
14
16
  context: {
15
17
  meta: {
16
18
  findFirstAuthentication: {
@@ -35,8 +37,15 @@ export const findFirstAuthenticationPlugin: Plugin<
35
37
  maxItems: 1,
36
38
  });
37
39
 
40
+ if (authsResponse.data.length === 0) {
41
+ throw new ZapierResourceNotFoundError(
42
+ "No authentication found matching the specified criteria",
43
+ { resourceType: "Authentication" },
44
+ );
45
+ }
46
+
38
47
  return {
39
- data: authsResponse.data.length > 0 ? authsResponse.data[0] : null,
48
+ data: authsResponse.data[0],
40
49
  };
41
50
  },
42
51
  FindFirstAuthenticationSchema,
@@ -48,7 +57,10 @@ export const findFirstAuthenticationPlugin: Plugin<
48
57
  meta: {
49
58
  findFirstAuthentication: {
50
59
  categories: ["authentication"],
60
+ type: "item",
61
+ itemType: "Authentication",
51
62
  inputSchema: FindFirstAuthenticationSchema,
63
+ outputSchema: AuthenticationItemSchema,
52
64
  },
53
65
  },
54
66
  },
@@ -10,6 +10,7 @@ import {
10
10
  } from "../../types/errors";
11
11
  import { createFunction } from "../../utils/function-utils";
12
12
  import type { ListAuthenticationsPluginProvides } from "../listAuthentications";
13
+ import { AuthenticationItemSchema } from "../../schemas/Auth";
13
14
 
14
15
  export interface FindUniqueAuthenticationPluginProvides {
15
16
  findUniqueAuthentication: (
@@ -65,7 +66,10 @@ export const findUniqueAuthenticationPlugin: Plugin<
65
66
  meta: {
66
67
  findUniqueAuthentication: {
67
68
  categories: ["authentication"],
69
+ type: "item",
70
+ itemType: "Authentication",
68
71
  inputSchema: FindUniqueAuthenticationSchema,
72
+ outputSchema: AuthenticationItemSchema,
69
73
  },
70
74
  },
71
75
  },
@@ -5,6 +5,12 @@ import { GetActionSchema, type GetActionOptions } from "./schemas";
5
5
  import { ZapierResourceNotFoundError } from "../../types/errors";
6
6
  import { createFunction } from "../../utils/function-utils";
7
7
  import type { ListActionsPluginProvides } from "../listActions";
8
+ import {
9
+ appKeyResolver,
10
+ actionTypeResolver,
11
+ actionKeyResolver,
12
+ } from "../../resolvers";
13
+ import { ActionItemSchema } from "../../schemas/Action";
8
14
 
9
15
  export interface GetActionPluginProvides {
10
16
  getAction: (options: GetActionOptions) => Promise<{ data: ActionItem }>;
@@ -50,7 +56,15 @@ export const getActionPlugin: Plugin<
50
56
  meta: {
51
57
  getAction: {
52
58
  categories: ["action"],
59
+ type: "item",
60
+ itemType: "Action",
53
61
  inputSchema: GetActionSchema,
62
+ outputSchema: ActionItemSchema,
63
+ resolvers: {
64
+ appKey: appKeyResolver,
65
+ actionType: actionTypeResolver,
66
+ actionKey: actionKeyResolver,
67
+ },
54
68
  },
55
69
  },
56
70
  },
@@ -12,8 +12,8 @@ import { manifestPlugin } from "../manifest";
12
12
  function createTestSdk() {
13
13
  return createSdk()
14
14
  .addPlugin(apiPlugin, { fetch: global.fetch })
15
- .addPlugin(listAppsPlugin)
16
15
  .addPlugin(manifestPlugin)
16
+ .addPlugin(listAppsPlugin)
17
17
  .addPlugin(getAppPlugin);
18
18
  }
19
19
 
@@ -72,7 +72,7 @@ describe("getApp plugin", () => {
72
72
 
73
73
  expect(result.data.title).toBe("Slack");
74
74
  expect(result.data.key).toBe("SlackCLIAPI");
75
- expect(result.data.current_implementation_id).toBe("SlackCLIAPI@1.0.0");
75
+ expect(result.data.implementation_id).toBe("SlackCLIAPI@1.0.0");
76
76
  expect(result.data.version).toBe("1.0.0");
77
77
  });
78
78
  });
@@ -121,7 +121,7 @@ describe("getApp plugin", () => {
121
121
 
122
122
  expect(result.data.title).toBeDefined();
123
123
  expect(result.data.key).toBeDefined();
124
- expect(result.data.current_implementation_id).toBeDefined();
124
+ expect(result.data.implementation_id).toBeDefined();
125
125
  expect(result.data.title).toBe("Test App");
126
126
  expect(result.data.key).toBe("TestCLIAPI");
127
127
  });
@@ -3,10 +3,11 @@ import { createFunction } from "../../utils/function-utils";
3
3
  import { GetAppSchema } from "./schemas";
4
4
  import type { GetAppOptions } from "./schemas";
5
5
  import type { AppItem } from "../../types/domain";
6
+ import { AppItemSchema } from "../../schemas/App";
6
7
  import { ZapierAppNotFoundError } from "../../types/errors";
7
8
  import type { GetSdkType } from "../../types/plugin";
8
- import type { GetImplementation } from "../manifest/schemas";
9
- import type { ManifestPluginProvides } from "../manifest";
9
+ import type { ListAppsPluginProvides } from "../listApps";
10
+ import { appKeyResolver } from "../../resolvers";
10
11
 
11
12
  // GetApp plugin provides interface - getApp goes directly to SDK root
12
13
  export interface GetAppPluginProvides {
@@ -22,21 +23,20 @@ export interface GetAppPluginProvides {
22
23
 
23
24
  // GetApp plugin depends on listApps SDK function
24
25
  export const getAppPlugin: Plugin<
25
- GetSdkType<ManifestPluginProvides>, // depends on manifest plugin with getImplementation in context
26
- { getImplementation: GetImplementation }, //
26
+ GetSdkType<ListAppsPluginProvides>,
27
+ {},
27
28
  GetAppPluginProvides
28
- > = ({ context }) => {
29
+ > = ({ sdk }) => {
29
30
  const getApp = createFunction(async function getApp(options: GetAppOptions) {
30
- const app = await context.getImplementation(options.appKey);
31
- if (!app) {
32
- throw new ZapierAppNotFoundError("App not found", {
33
- appKey: options.appKey,
34
- });
31
+ const appsIterator = sdk.listApps({ appKeys: [options.appKey] }).items();
32
+ for await (const app of appsIterator) {
33
+ return {
34
+ data: app,
35
+ };
35
36
  }
36
-
37
- return {
38
- data: app,
39
- };
37
+ throw new ZapierAppNotFoundError("App not found", {
38
+ appKey: options.appKey,
39
+ });
40
40
  }, GetAppSchema);
41
41
 
42
42
  // Return flat structure - getApp goes directly to SDK
@@ -46,7 +46,13 @@ export const getAppPlugin: Plugin<
46
46
  meta: {
47
47
  getApp: {
48
48
  categories: ["app"],
49
+ type: "item",
50
+ itemType: "App",
49
51
  inputSchema: GetAppSchema,
52
+ outputSchema: AppItemSchema,
53
+ resolvers: {
54
+ appKey: appKeyResolver,
55
+ },
50
56
  },
51
57
  },
52
58
  },
@@ -1,7 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { AppKeyPropertySchema } from "../../types/properties";
3
- import { withOutputSchema } from "../../utils/schema-utils";
4
- import { AppItemSchema } from "../../schemas/App";
5
3
  import type { AppItem } from "../../types/domain";
6
4
  import type {
7
5
  ZapierApiError,
@@ -18,16 +16,13 @@ export type GetAppError =
18
16
  | ZapierValidationError;
19
17
 
20
18
  // Pure Zod schema - no resolver metadata!
21
- export const GetAppSchema = withOutputSchema(
22
- z
23
- .object({
24
- appKey: AppKeyPropertySchema.describe(
25
- "App key of app to fetch (e.g., 'SlackCLIAPI')",
26
- ),
27
- })
28
- .describe("Get detailed information about a specific app"),
29
- AppItemSchema,
30
- );
19
+ export const GetAppSchema = z
20
+ .object({
21
+ appKey: AppKeyPropertySchema.describe(
22
+ "App key of app to fetch (e.g., 'SlackCLIAPI')",
23
+ ),
24
+ })
25
+ .describe("Get detailed information about a specific app");
31
26
 
32
27
  // Type inferred from schema
33
28
  export type GetAppOptions = z.infer<typeof GetAppSchema>;
@@ -45,8 +45,8 @@ describe("getAuthentication plugin", () => {
45
45
  function createTestSdk() {
46
46
  return createSdk()
47
47
  .addPlugin(apiPlugin)
48
- .addPlugin(listAppsPlugin)
49
48
  .addPlugin(manifestPlugin)
49
+ .addPlugin(listAppsPlugin)
50
50
  .addPlugin(getAuthenticationPlugin);
51
51
  }
52
52
 
@@ -12,6 +12,8 @@ import {
12
12
  } from "../../types/errors";
13
13
  import { createFunction } from "../../utils/function-utils";
14
14
  import { normalizeAuthenticationItem } from "../../utils/domain-utils";
15
+ import { authenticationIdGenericResolver } from "../../resolvers";
16
+ import { AuthenticationItemSchema } from "../../schemas/Auth";
15
17
 
16
18
  export interface GetAuthenticationPluginProvides {
17
19
  getAuthentication: (
@@ -79,7 +81,13 @@ export const getAuthenticationPlugin: Plugin<
79
81
  meta: {
80
82
  getAuthentication: {
81
83
  categories: ["authentication"],
84
+ type: "item",
85
+ itemType: "Authentication",
82
86
  inputSchema: GetAuthenticationSchema,
87
+ outputSchema: AuthenticationItemSchema,
88
+ resolvers: {
89
+ authenticationId: authenticationIdGenericResolver,
90
+ },
83
91
  },
84
92
  },
85
93
  },
@@ -4,6 +4,7 @@ import { createFunction } from "../../utils/function-utils";
4
4
  import type { Plugin } from "../../types/plugin";
5
5
  import type { UserProfileItem } from "../../types/domain";
6
6
  import { GetProfileSchema } from "./schemas";
7
+ import { UserProfileItemSchema } from "../../schemas/UserProfile";
7
8
 
8
9
  // GetProfile plugin provides interface - getProfile goes directly to SDK root
9
10
  export interface GetProfilePluginProvides {
@@ -48,7 +49,10 @@ export const getProfilePlugin: Plugin<
48
49
  meta: {
49
50
  getProfile: {
50
51
  categories: ["account"],
52
+ type: "item",
53
+ itemType: "Profile",
51
54
  inputSchema: GetProfileSchema,
55
+ outputSchema: UserProfileItemSchema,
52
56
  },
53
57
  },
54
58
  },
@@ -1,6 +1,4 @@
1
1
  import { z } from "zod";
2
- import { withOutputSchema } from "../../utils/schema-utils";
3
- import { UserProfileItemSchema } from "../../schemas/UserProfile";
4
2
  import type { FunctionOptions } from "../../types/functions";
5
3
  import type { UserProfileItem } from "../../types/domain";
6
4
  import type { ZapierApiError, ZapierValidationError } from "../../types/errors";
@@ -9,10 +7,10 @@ import type { ZapierApiError, ZapierValidationError } from "../../types/errors";
9
7
  export type GetProfileError = ZapierApiError | ZapierValidationError;
10
8
 
11
9
  // Pure Zod schema - no resolver metadata!
12
- export const GetProfileSchema = withOutputSchema(
13
- z.object({}).optional().describe("Get current user's profile information"),
14
- UserProfileItemSchema,
15
- );
10
+ export const GetProfileSchema = z
11
+ .object({})
12
+ .optional()
13
+ .describe("Get current user's profile information");
16
14
 
17
15
  // Type inferred from schema + function config
18
16
  export type GetProfileOptions = z.infer<typeof GetProfileSchema> &
@@ -68,6 +68,8 @@ describe("listActions plugin", () => {
68
68
  .mockResolvedValue("SlackCLIAPI@1.21.1");
69
69
  });
70
70
 
71
+ const mockResolveAppKeys = vi.fn().mockResolvedValue([]);
72
+
71
73
  function createTestSdk() {
72
74
  // Create a proper plugin chain with context dependencies
73
75
 
@@ -76,18 +78,17 @@ describe("listActions plugin", () => {
76
78
  .addPlugin(() => ({
77
79
  context: {
78
80
  api: mockApiClient,
79
- getVersionedImplementationId: mockGetVersionedImplementationId,
80
81
  },
81
82
  }))
82
- .addPlugin(listAppsPlugin)
83
83
  .addPlugin(() => ({
84
84
  context: {
85
85
  manifest: null,
86
- getManifestEntry: () => null,
87
86
  getVersionedImplementationId: mockGetVersionedImplementationId,
88
- getImplementation: () => Promise.resolve(null),
87
+ resolveAppKeys: mockResolveAppKeys,
88
+ updateManifestEntry: vi.fn().mockResolvedValue(["test-key", {}]),
89
89
  },
90
90
  }))
91
+ .addPlugin(listAppsPlugin)
91
92
  .addPlugin(listActionsPlugin);
92
93
  }
93
94
 
@@ -166,7 +167,7 @@ describe("listActions plugin", () => {
166
167
 
167
168
  expect(result.data).toHaveLength(2); // Only write actions
168
169
  expect(
169
- result.data.every((action) => action.action_type === "write"),
170
+ result.data.every((action: any) => action.action_type === "write"),
170
171
  ).toBe(true);
171
172
  });
172
173
  });
@@ -309,9 +310,9 @@ describe("listActions plugin", () => {
309
310
 
310
311
  expect(result.data).toHaveLength(2);
311
312
  expect(
312
- result.data.every((action) => action.action_type === "write"),
313
+ result.data.every((action: any) => action.action_type === "write"),
313
314
  ).toBe(true);
314
- expect(result.data.map((action) => action.key)).toEqual([
315
+ expect(result.data.map((action: any) => action.key)).toEqual([
315
316
  "send_message",
316
317
  "create_channel",
317
318
  ]);
@@ -7,6 +7,7 @@ import {
7
7
  type ListActionsOptions,
8
8
  type ListActionsPage,
9
9
  } from "./schemas";
10
+ import { ActionItemSchema } from "../../schemas/Action";
10
11
  import {
11
12
  ZapierConfigurationError,
12
13
  ZapierAuthenticationError,
@@ -14,6 +15,7 @@ import {
14
15
  import { createPaginatedFunction } from "../../utils/function-utils";
15
16
  import type { ManifestPluginProvides } from "../manifest";
16
17
  import type { GetVersionedImplementationId } from "../manifest/schemas";
18
+ import { appKeyResolver, actionTypeResolver } from "../../resolvers";
17
19
 
18
20
  export interface ListActionsPluginProvides {
19
21
  listActions: (options?: ListActionsOptions) => Promise<{
@@ -32,11 +34,11 @@ export interface ListActionsPluginProvides {
32
34
  }
33
35
 
34
36
  export const listActionsPlugin: Plugin<
35
- GetSdkType<ManifestPluginProvides>, // requires getApp in SDK
37
+ GetSdkType<ManifestPluginProvides>,
36
38
  {
37
39
  api: ApiClient;
38
40
  getVersionedImplementationId: GetVersionedImplementationId;
39
- }, // requires api and getVersionedImplementationId in context
41
+ },
40
42
  ListActionsPluginProvides
41
43
  > = ({ context }) => {
42
44
  const listActions = createPaginatedFunction(async function listActionsPage(
@@ -44,7 +46,7 @@ export const listActionsPlugin: Plugin<
44
46
  ): Promise<ListActionsPage> {
45
47
  const { api, getVersionedImplementationId } = context;
46
48
 
47
- // Use the getApp function from the SDK (dependency injection)
49
+ // Use getVersionedImplementationId (optimized to check manifest first)
48
50
  const selectedApi = await getVersionedImplementationId(options.appKey);
49
51
 
50
52
  if (!selectedApi) {
@@ -114,7 +116,14 @@ export const listActionsPlugin: Plugin<
114
116
  meta: {
115
117
  listActions: {
116
118
  categories: ["action"],
119
+ type: "list",
120
+ itemType: "Action",
117
121
  inputSchema: ListActionsSchema,
122
+ outputSchema: ActionItemSchema,
123
+ resolvers: {
124
+ appKey: appKeyResolver,
125
+ actionType: actionTypeResolver,
126
+ },
118
127
  },
119
128
  },
120
129
  },
@@ -3,8 +3,6 @@ import {
3
3
  AppKeyPropertySchema,
4
4
  ActionTypePropertySchema,
5
5
  } from "../../types/properties";
6
- import { withOutputSchema } from "../../utils/schema-utils";
7
- import { ActionItemSchema } from "../../schemas/Action";
8
6
  import type { ActionItem } from "../../types/domain";
9
7
  import type { PaginatedSdkFunction } from "../../types/functions";
10
8
  import type {
@@ -14,29 +12,26 @@ import type {
14
12
  } from "../../types/errors";
15
13
 
16
14
  // Pure Zod schema - no resolver metadata!
17
- export const ListActionsSchema = withOutputSchema(
18
- z
19
- .object({
20
- appKey: AppKeyPropertySchema.describe(
21
- "App key of actions to list (e.g., 'SlackCLIAPI')",
22
- ),
23
- actionType: ActionTypePropertySchema.optional().describe(
24
- "Filter actions by type",
25
- ),
26
- pageSize: z
27
- .number()
28
- .min(1)
29
- .optional()
30
- .describe("Number of actions per page"),
31
- maxItems: z
32
- .number()
33
- .min(1)
34
- .optional()
35
- .describe("Maximum total items to return across all pages"),
36
- })
37
- .describe("List all actions for a specific app"),
38
- ActionItemSchema,
39
- );
15
+ export const ListActionsSchema = z
16
+ .object({
17
+ appKey: AppKeyPropertySchema.describe(
18
+ "App key of actions to list (e.g., 'SlackCLIAPI')",
19
+ ),
20
+ actionType: ActionTypePropertySchema.optional().describe(
21
+ "Filter actions by type",
22
+ ),
23
+ pageSize: z
24
+ .number()
25
+ .min(1)
26
+ .optional()
27
+ .describe("Number of actions per page"),
28
+ maxItems: z
29
+ .number()
30
+ .min(1)
31
+ .optional()
32
+ .describe("Maximum total items to return across all pages"),
33
+ })
34
+ .describe("List all actions for a specific app");
40
35
 
41
36
  // Type inferred from schema
42
37
  export type ListActionsOptions = z.infer<typeof ListActionsSchema>;