@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
@@ -1,8 +1,9 @@
1
- import type { Plugin } from "../../types/plugin";
2
- import type { ApiClient } from "../../api/types";
1
+ import type { GetContextType, Plugin } from "../../types/plugin";
3
2
  import { ListAppsSchema } from "./schemas";
4
3
  import type { ListAppsOptions } from "./schemas";
5
4
  import type { AppItem } from "../../types/domain";
5
+ import type { ManifestPluginProvides } from "../manifest";
6
+ import type { ApiPluginProvides } from "../api";
6
7
  export interface ListAppsPluginProvides {
7
8
  listApps: (options?: ListAppsOptions) => Promise<{
8
9
  data: AppItem[];
@@ -20,9 +21,5 @@ export interface ListAppsPluginProvides {
20
21
  };
21
22
  };
22
23
  }
23
- export declare const listAppsPlugin: Plugin<{}, // no SDK dependencies
24
- {
25
- api: ApiClient;
26
- }, // requires api in context
27
- ListAppsPluginProvides>;
24
+ export declare const listAppsPlugin: Plugin<{}, GetContextType<ApiPluginProvides & ManifestPluginProvides>, ListAppsPluginProvides>;
28
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listApps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AASlD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC,GACnE,aAAa,CAAC;QAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACxD,KAAK,IAAI,aAAa,CAAC,OAAO,CAAC,CA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iB,GAAG,sBAAsB,CAAC,EAC1D,sBAAsB,CA+GvB,CAAC"}
@@ -1,13 +1,30 @@
1
1
  import { createPaginatedFunction } from "../../utils/function-utils";
2
2
  import { ListAppsSchema } from "./schemas";
3
- import { groupAppKeysByType, normalizeImplementationMetaToAppItem, splitVersionedKey, } from "../../utils/domain-utils";
3
+ import { AppItemSchema } from "../../schemas/App";
4
+ import { normalizeImplementationMetaToAppItem, splitVersionedKey, toAppLocator, toImplementationId, } from "../../utils/domain-utils";
4
5
  import { extractCursor } from "../../utils/function-utils";
5
- // Direct plugin function - takes options + sdk + context in one object
6
6
  export const listAppsPlugin = ({ context }) => {
7
7
  const listApps = createPaginatedFunction(async function listAppsPage(options) {
8
8
  const api = context.api;
9
9
  const opts = options;
10
- const appKeys = [...(opts.appKeys ?? [])].map((key) => splitVersionedKey(key)[0]);
10
+ const appLocators = await context.resolveAppKeys({
11
+ appKeys: [...(opts.appKeys ?? [])],
12
+ });
13
+ const implementationNameToLocator = {};
14
+ for (const locator of appLocators) {
15
+ implementationNameToLocator[locator.implementationName] = [
16
+ ...(implementationNameToLocator[locator.implementationName] ?? []),
17
+ locator,
18
+ ];
19
+ }
20
+ const duplicatedLookupAppKeys = Object.keys(implementationNameToLocator)
21
+ .filter((key) => implementationNameToLocator[key].length > 1)
22
+ .map((key) => implementationNameToLocator[key])
23
+ .flat()
24
+ .map((locator) => locator.lookupAppKey);
25
+ if (duplicatedLookupAppKeys.length > 0) {
26
+ throw new Error(`Duplicate lookup app keys found: ${duplicatedLookupAppKeys.join(", ")}`);
27
+ }
11
28
  if (opts.search) {
12
29
  const searchParams = {};
13
30
  searchParams.term = opts.search;
@@ -15,11 +32,15 @@ export const listAppsPlugin = ({ context }) => {
15
32
  searchParams,
16
33
  });
17
34
  const implementations = searchEnvelope.results.map(normalizeImplementationMetaToAppItem);
18
- const appKeysSet = new Set(appKeys);
35
+ const implementationNameSet = new Set(appLocators.map((locator) => locator.implementationName));
19
36
  for (const implementation of implementations) {
20
- if (!appKeysSet.has(implementation.key)) {
21
- appKeysSet.add(implementation.key);
22
- appKeys.push(implementation.key);
37
+ const [implementationName] = splitVersionedKey(implementation.key);
38
+ if (!implementationNameSet.has(implementationName)) {
39
+ implementationNameSet.add(implementationName);
40
+ appLocators.push({
41
+ ...toAppLocator(implementation.key),
42
+ implementationName,
43
+ });
23
44
  }
24
45
  }
25
46
  }
@@ -27,19 +48,15 @@ export const listAppsPlugin = ({ context }) => {
27
48
  if (opts.pageSize) {
28
49
  searchParams.limit = opts.pageSize.toString();
29
50
  }
30
- searchParams.latest_only = "true";
51
+ if (appLocators.length === 0) {
52
+ searchParams.latest_only = "true";
53
+ }
31
54
  if (opts.cursor) {
32
55
  searchParams.offset = opts.cursor;
33
56
  }
34
- if (appKeys.length > 0) {
35
- const groupedAppKeys = groupAppKeysByType(appKeys);
36
- if (groupedAppKeys.selectedApi.length > 0) {
37
- searchParams.selected_apis = groupedAppKeys.selectedApi.join(",");
38
- }
39
- if (groupedAppKeys.slug.length > 0) {
40
- searchParams.slugs = groupedAppKeys.slug.join(",");
41
- }
42
- }
57
+ searchParams.selected_apis = appLocators
58
+ .map((locator) => toImplementationId(locator))
59
+ .join(",");
43
60
  const implementationsEnvelope = await api.get("/api/v4/implementations-meta/lookup/", {
44
61
  searchParams,
45
62
  });
@@ -55,7 +72,10 @@ export const listAppsPlugin = ({ context }) => {
55
72
  meta: {
56
73
  listApps: {
57
74
  categories: ["app"],
75
+ type: "list",
76
+ itemType: "App",
58
77
  inputSchema: ListAppsSchema,
78
+ outputSchema: AppItemSchema,
59
79
  },
60
80
  },
61
81
  },
@@ -26,9 +26,25 @@ const mockAppsResponse = {
26
26
  next_cursor: null,
27
27
  },
28
28
  };
29
+ const mockResolveAppKeys = vi
30
+ .fn()
31
+ .mockImplementation(async ({ appKeys }) => {
32
+ // Mock implementation that returns resolved locators for the app keys
33
+ return appKeys.map((appKey) => ({
34
+ lookupAppKey: appKey,
35
+ implementationName: appKey, // For testing, use appKey as implementationName
36
+ slug: appKey.toLowerCase(),
37
+ version: undefined,
38
+ }));
39
+ });
29
40
  function createTestSdk() {
30
41
  return createSdk()
31
42
  .addPlugin(apiPlugin, { fetch: global.fetch })
43
+ .addPlugin(() => ({
44
+ context: {
45
+ resolveAppKeys: mockResolveAppKeys,
46
+ },
47
+ }))
32
48
  .addPlugin(listAppsPlugin);
33
49
  }
34
50
  describe("listApps plugin", () => {
@@ -88,7 +104,11 @@ describe("listApps plugin", () => {
88
104
  title: "Slack",
89
105
  });
90
106
  expect(context.api.get).toHaveBeenCalledWith("/api/v4/implementations-meta/lookup/", {
91
- searchParams: { latest_only: "true", limit: "100" },
107
+ searchParams: {
108
+ latest_only: "true",
109
+ limit: "100",
110
+ selected_apis: "",
111
+ },
92
112
  });
93
113
  });
94
114
  it("should throw validation error for invalid pageSize", () => {
@@ -181,7 +201,7 @@ describe("listApps plugin", () => {
181
201
  const result = await sdk.listApps({});
182
202
  expect(result.data[0]).toHaveProperty("title");
183
203
  expect(result.data[0]).toHaveProperty("key");
184
- expect(result.data[0]).toHaveProperty("current_implementation_id");
204
+ expect(result.data[0]).toHaveProperty("implementation_id");
185
205
  // Version is optional
186
206
  expect(result.data[0]).toHaveProperty("version");
187
207
  });
@@ -297,7 +317,7 @@ describe("listApps plugin", () => {
297
317
  await sdk.listApps({ appKeys: ["SlackCLIAPI", "GitHubCLIAPI"] });
298
318
  expect(mockGet).toHaveBeenCalledWith(expect.stringContaining("implementations-meta"), expect.objectContaining({
299
319
  searchParams: expect.objectContaining({
300
- selected_apis: "SlackCLIAPI,GitHubCLIAPI",
320
+ selected_apis: "SlackCLIAPI@latest,GitHubCLIAPI@latest",
301
321
  }),
302
322
  }));
303
323
  });
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listApps/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAA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oB,CAAC,eAAe,GAAG,SAAS,EAAE,OAAO,CAAC,CAAC;CACtE"}
@@ -1,23 +1,17 @@
1
1
  import { z } from "zod";
2
- import { AppItemSchema } from "../../schemas/App";
3
- import { withOutputSchema } from "../../utils/schema-utils";
4
2
  // Pure Zod schema - no pagination metadata exposed
5
- export const ListAppsSchema = withOutputSchema(z
3
+ export const ListAppsSchema = z
6
4
  .object({
7
5
  appKeys: z
8
6
  .array(z.string())
9
7
  .optional()
10
8
  .describe("Filter apps by app keys (e.g., 'SlackCLIAPI' or slug like 'github')"),
11
9
  search: z.string().optional().describe("Search for apps by name"),
12
- pageSize: z
13
- .number()
14
- .min(1)
15
- .optional()
16
- .describe("Number of apps per page"),
10
+ pageSize: z.number().min(1).optional().describe("Number of apps per page"),
17
11
  maxItems: z
18
12
  .number()
19
13
  .min(1)
20
14
  .optional()
21
15
  .describe("Maximum total items to return across all pages"),
22
16
  })
23
- .describe("List all available apps with optional filtering"), AppItemSchema);
17
+ .describe("List all available apps with optional filtering");
@@ -21,10 +21,8 @@ export interface ListAuthenticationsPluginProvides {
21
21
  };
22
22
  };
23
23
  }
24
- export declare const listAuthenticationsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, // requires getApp in SDK
25
- {
24
+ export declare const listAuthenticationsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, {
26
25
  api: ApiClient;
27
26
  getVersionedImplementationId: GetVersionedImplementationId;
28
- }, // requires api in context
29
- ListAuthenticationsPluginProvides>;
27
+ }, ListAuthenticationsPluginProvides>;
30
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listAuthentications/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAA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AK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAI1D,MAAM,WAAW,iCAAiC;IAChD,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,0BAA0B,KAAK,OAAO,CAAC;QACrE,IAAI,EAAE,kBAAkB,EAAE,CAAC;KAC5B,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACnE,KAAK,IAAI,aAAa,CAAC,kBAAkB,CAAC,CAAC;KAC5C,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,mBAAmB,EAAE;gBACnB,WAAW,EAAE,OAAO,yBAAyB,CAAC;aAC/C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAC5C,UAAU,CAAC,sBAAsB,CAAC,EAClC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,EACD,iCAAiC,CAyGlC,CAAC"}
@@ -2,6 +2,8 @@ import { ListAuthenticationsSchema, } from "./schemas";
2
2
  import { normalizeAuthenticationItem, splitVersionedKey, } from "../../utils/domain-utils";
3
3
  import { ZapierAuthenticationError } from "../../types/errors";
4
4
  import { createPaginatedFunction, extractCursor, } from "../../utils/function-utils";
5
+ import { appKeyResolver } from "../../resolvers";
6
+ import { AuthenticationItemSchema } from "../../schemas/Auth";
5
7
  export const listAuthenticationsPlugin = ({ context }) => {
6
8
  const listAuthentications = createPaginatedFunction(async function listAuthenticationsPage(options) {
7
9
  const { api, getVersionedImplementationId } = context;
@@ -15,6 +17,10 @@ export const listAuthenticationsPlugin = ({ context }) => {
15
17
  searchParams.versionless_selected_api = versionlessSelectedApi;
16
18
  }
17
19
  }
20
+ // Add authenticationIds as ids parameter if provided
21
+ if (options.authenticationIds && options.authenticationIds.length > 0) {
22
+ searchParams.ids = options.authenticationIds.join(",");
23
+ }
18
24
  // Add other query parameters if provided
19
25
  // Use title as search if no explicit search provided
20
26
  if (options.search) {
@@ -65,7 +71,13 @@ export const listAuthenticationsPlugin = ({ context }) => {
65
71
  meta: {
66
72
  listAuthentications: {
67
73
  categories: ["authentication"],
74
+ type: "list",
75
+ itemType: "Authentication",
68
76
  inputSchema: ListAuthenticationsSchema,
77
+ outputSchema: AuthenticationItemSchema,
78
+ resolvers: {
79
+ appKey: appKeyResolver,
80
+ },
69
81
  },
70
82
  },
71
83
  },
@@ -35,14 +35,6 @@ const mockAuthenticationsResponse = {
35
35
  next: null,
36
36
  previous: null,
37
37
  };
38
- const mockSlackApp = {
39
- title: "Slack",
40
- key: "SlackCLIAPI",
41
- current_implementation_id: "SlackCLIAPI@1.21.1",
42
- version: "1.21.1",
43
- description: "Team communication platform",
44
- slug: "slack",
45
- };
46
38
  describe("listAuthentications plugin", () => {
47
39
  let mockApiClient;
48
40
  let mockGetVersionedImplementationId;
@@ -60,15 +52,13 @@ describe("listAuthentications plugin", () => {
60
52
  api: mockApiClient,
61
53
  },
62
54
  });
55
+ const mockResolveAppKeys = vi.fn().mockResolvedValue([]);
63
56
  const manifestPlugin = () => ({
64
57
  context: {
65
58
  manifest: null,
66
59
  getVersionedImplementationId: mockGetVersionedImplementationId,
67
- getManifestEntry: () => ({
68
- implementationName: "SlackCLIAPI",
69
- version: "1.21.1",
70
- }),
71
- getImplementation: vi.fn().mockResolvedValue(mockSlackApp),
60
+ resolveAppKeys: mockResolveAppKeys,
61
+ updateManifestEntry: vi.fn().mockResolvedValue(["test-key", {}]),
72
62
  },
73
63
  });
74
64
  function createTestSdk() {
@@ -131,6 +121,19 @@ describe("listAuthentications plugin", () => {
131
121
  });
132
122
  }).toThrow(ZapierValidationError);
133
123
  });
124
+ it("should throw validation error for invalid authenticationIds type", () => {
125
+ const sdk = createTestSdk();
126
+ expect(() => {
127
+ sdk.listAuthentications({
128
+ authenticationIds: "123", // Should be array of strings
129
+ });
130
+ }).toThrow(ZapierValidationError);
131
+ expect(() => {
132
+ sdk.listAuthentications({
133
+ authenticationIds: [123], // Should be array of strings, not numbers
134
+ });
135
+ }).toThrow(ZapierValidationError);
136
+ });
134
137
  it("should throw validation error for invalid pageSize", () => {
135
138
  const sdk = createTestSdk();
136
139
  expect(() => {
@@ -161,6 +164,7 @@ describe("listAuthentications plugin", () => {
161
164
  const sdk = createTestSdk();
162
165
  const result = await sdk.listAuthentications({
163
166
  appKey: "slack",
167
+ authenticationIds: ["123", "456"],
164
168
  search: "workspace",
165
169
  title: "My Slack Workspace",
166
170
  accountId: "acc_123",
@@ -273,6 +277,28 @@ describe("listAuthentications plugin", () => {
273
277
  }),
274
278
  }));
275
279
  });
280
+ it("should pass authenticationIds as ids parameter to API", async () => {
281
+ const sdk = createTestSdk();
282
+ await sdk.listAuthentications({
283
+ authenticationIds: ["123", "456", "789"],
284
+ });
285
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
286
+ searchParams: expect.objectContaining({
287
+ ids: "123,456,789",
288
+ }),
289
+ }));
290
+ });
291
+ it("should not include ids parameter when authenticationIds is empty", async () => {
292
+ const sdk = createTestSdk();
293
+ await sdk.listAuthentications({
294
+ authenticationIds: [],
295
+ });
296
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
297
+ searchParams: expect.not.objectContaining({
298
+ ids: expect.anything(),
299
+ }),
300
+ }));
301
+ });
276
302
  });
277
303
  describe("pagination", () => {
278
304
  it("should handle pagination with maxItems by collecting all items", async () => {
@@ -3,7 +3,10 @@ import type { PaginatedSdkFunction } from "../../types/functions";
3
3
  import type { AuthenticationItem } from "../../types/domain";
4
4
  import type { ZapierAuthenticationError, ZapierApiError, ZapierAppNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
5
5
  export declare const ListAuthenticationsSchema: z.ZodObject<{
6
- appKey: z.ZodOptional<z.ZodString>;
6
+ appKey: z.ZodOptional<z.ZodString & {
7
+ _def: z.ZodStringDef & import("../..").PositionalMetadata;
8
+ }>;
9
+ authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
7
10
  search: z.ZodOptional<z.ZodString>;
8
11
  title: z.ZodOptional<z.ZodString>;
9
12
  accountId: z.ZodOptional<z.ZodString>;
@@ -11,21 +14,23 @@ export declare const ListAuthenticationsSchema: z.ZodObject<{
11
14
  pageSize: z.ZodOptional<z.ZodNumber>;
12
15
  maxItems: z.ZodOptional<z.ZodNumber>;
13
16
  }, "strip", z.ZodTypeAny, {
14
- title?: string | undefined;
15
17
  search?: string | undefined;
18
+ title?: string | undefined;
16
19
  appKey?: string | undefined;
17
20
  pageSize?: number | undefined;
18
21
  maxItems?: number | undefined;
19
22
  accountId?: string | undefined;
20
23
  owner?: string | undefined;
24
+ authenticationIds?: string[] | undefined;
21
25
  }, {
22
- title?: string | undefined;
23
26
  search?: string | undefined;
27
+ title?: string | undefined;
24
28
  appKey?: string | undefined;
25
29
  pageSize?: number | undefined;
26
30
  maxItems?: number | undefined;
27
31
  accountId?: string | undefined;
28
32
  owner?: string | undefined;
33
+ authenticationIds?: string[] | undefined;
29
34
  }>;
30
35
  export type ListAuthenticationsOptions = z.infer<typeof ListAuthenticationsSchema>;
31
36
  export interface ListAuthenticationsPage {
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listAuthentications/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,C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BAA8B;IAC7C,mBAAmB,EAAE,oBAAoB,CACvC,0BAA0B,EAC1B,kBAAkB,CACnB,CAAC;CACH"}
@@ -4,6 +4,10 @@ import { AppKeyPropertySchema } from "../../types/properties";
4
4
  export const ListAuthenticationsSchema = z
5
5
  .object({
6
6
  appKey: AppKeyPropertySchema.optional().describe("App key of authentications to list (e.g., 'SlackCLIAPI')"),
7
+ authenticationIds: z
8
+ .array(z.string())
9
+ .optional()
10
+ .describe("List of authentication IDs to filter by"),
7
11
  search: z
8
12
  .string()
9
13
  .optional()
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAM3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EAElC,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAc5D,MAAM,WAAW,mCAAmC;IAClD,qBAAqB,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,OAAO,CAAC;QACxE,IAAI,EAAE,oBAAoB,EAAE,CAAC;KAC9B,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACrE,KAAK,IAAI,aAAa,CAAC,oBAAoB,CAAC,CAAC;KAC9C,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,qBAAqB,EAAE;gBACrB,WAAW,EAAE,OAAO,2BAA2B,CAAC;aACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,UAAU,CAAC,uBAAuB,CAAC,EAAE,4BAA4B;AACjE;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,mCAAmC,CAuGpC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAM3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EAGlC,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAsB5D,MAAM,WAAW,mCAAmC;IAClD,qBAAqB,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,OAAO,CAAC;QACxE,IAAI,EAAE,oBAAoB,EAAE,CAAC;KAC9B,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACrE,KAAK,IAAI,aAAa,CAAC,oBAAoB,CAAC,CAAC;KAC9C,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,qBAAqB,EAAE;gBACrB,WAAW,EAAE,OAAO,2BAA2B,CAAC;aACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,UAAU,CAAC,uBAAuB,CAAC,EAAE,4BAA4B;AACjE;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,mCAAmC,CAkHpC,CAAC"}
@@ -1,6 +1,7 @@
1
- import { ListInputFieldChoicesSchema, } from "./schemas";
1
+ import { ListInputFieldChoicesSchema, InputFieldChoiceItemSchema, } from "./schemas";
2
2
  import { ZapierApiError } from "../../types/errors";
3
3
  import { createPaginatedFunction } from "../../utils/function-utils";
4
+ import { appKeyResolver, actionTypeResolver, actionKeyResolver, authenticationIdResolver, inputFieldKeyResolver, inputsAllOptionalResolver, } from "../../resolvers";
4
5
  // Transform NeedChoices to InputFieldChoiceItem
5
6
  function transformNeedChoicesToInputFieldChoiceItem(choice) {
6
7
  return {
@@ -42,7 +43,7 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
42
43
  const choices = (choicesData.choices || []).map(transformNeedChoicesToInputFieldChoiceItem);
43
44
  // Handle pagination
44
45
  let nextCursor;
45
- if (choicesData.next_page !== undefined) {
46
+ if (choicesData.next_page != null) {
46
47
  nextCursor = choicesData.next_page.toString();
47
48
  }
48
49
  else if (choicesData.links?.next) {
@@ -70,7 +71,18 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
70
71
  meta: {
71
72
  listInputFieldChoices: {
72
73
  categories: ["action"],
74
+ type: "list",
75
+ itemType: "InputFieldChoice",
73
76
  inputSchema: ListInputFieldChoicesSchema,
77
+ outputSchema: InputFieldChoiceItemSchema,
78
+ resolvers: {
79
+ appKey: appKeyResolver,
80
+ actionType: actionTypeResolver,
81
+ actionKey: actionKeyResolver,
82
+ authenticationId: authenticationIdResolver,
83
+ inputFieldKey: inputFieldKeyResolver,
84
+ inputs: inputsAllOptionalResolver,
85
+ },
74
86
  },
75
87
  },
76
88
  },
@@ -19,7 +19,9 @@ export declare const InputFieldChoiceItemSchema: z.ZodObject<{
19
19
  }>;
20
20
  export type InputFieldChoiceItem = z.infer<typeof InputFieldChoiceItemSchema>;
21
21
  export declare const ListInputFieldChoicesSchema: z.ZodObject<{
22
- appKey: z.ZodString;
22
+ appKey: z.ZodString & {
23
+ _def: z.ZodStringDef & import("../..").PositionalMetadata;
24
+ };
23
25
  actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
24
26
  actionKey: z.ZodString;
25
27
  inputFieldKey: z.ZodString;
@@ -30,7 +32,7 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
30
32
  maxItems: z.ZodOptional<z.ZodNumber>;
31
33
  }, "strip", z.ZodTypeAny, {
32
34
  appKey: string;
33
- actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
35
+ actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
34
36
  actionKey: string;
35
37
  inputFieldKey: string;
36
38
  page?: number | undefined;
@@ -40,7 +42,7 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
40
42
  maxItems?: number | undefined;
41
43
  }, {
42
44
  appKey: string;
43
- actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
45
+ actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
44
46
  actionKey: string;
45
47
  inputFieldKey: string;
46
48
  page?: number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EACV,wBAAwB,EACxB,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAM5B,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;EAuCtC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAM9E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCvC,CAAC;AAGF,MAAM,MAAM,4BAA4B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AAC;CACrB;AAGD,MAAM,WAAW,gCAAgC;IAC/C,qBAAqB,EAAE,oBAAoB,CACzC,4BAA4B,EAC5B,oBAAoB,CACrB,CAAC;CACH"}
@@ -1,27 +1,18 @@
1
1
  import { z } from "zod";
2
2
  import { AuthenticationIdPropertySchema, AppKeyPropertySchema, ActionTypePropertySchema, ActionKeyPropertySchema, InputsPropertySchema, } from "../../types/properties";
3
- import { withFormatter, withOutputSchema } from "../../utils/schema-utils";
3
+ import { withFormatter } from "../../utils/schema-utils";
4
+ import { NeedChoicesSchema } from "../../api/schemas";
4
5
  // ============================================================================
5
6
  // Input Field Choice Item Schema
6
7
  // ============================================================================
7
- export const InputFieldChoiceItemSchema = withFormatter(z.object({
8
- key: z.string().optional().describe("Unique key/value for the choice"),
9
- label: z
10
- .string()
11
- .optional()
12
- .describe("Human readable label for the choice"),
13
- sample: z.string().optional().describe("Sample value for the choice"),
14
- value: z
15
- .string()
16
- .optional()
17
- .describe("Value to be submitted when selected"),
18
- }), {
8
+ export const InputFieldChoiceItemSchema = withFormatter(NeedChoicesSchema, {
19
9
  format: (item) => {
20
10
  const title = item.label || item.key || "Choice";
21
- const subtitle = item.label && item.key && item.label !== item.key
22
- ? `(${item.key})`
23
- : undefined;
24
11
  const details = [];
12
+ // Show key as detail if different from label
13
+ if (item.label && item.key && item.label !== item.key) {
14
+ details.push({ text: `Key: ${item.key}`, style: "dim" });
15
+ }
25
16
  if (item.sample && item.sample !== item.key) {
26
17
  details.push({ text: `Sample: ${item.sample}`, style: "dim" });
27
18
  }
@@ -30,7 +21,7 @@ export const InputFieldChoiceItemSchema = withFormatter(z.object({
30
21
  }
31
22
  return {
32
23
  title,
33
- subtitle,
24
+ key: item.key,
34
25
  details,
35
26
  };
36
27
  },
@@ -38,7 +29,7 @@ export const InputFieldChoiceItemSchema = withFormatter(z.object({
38
29
  // ============================================================================
39
30
  // Plugin Schema Definition
40
31
  // ============================================================================
41
- export const ListInputFieldChoicesSchema = withOutputSchema(z
32
+ export const ListInputFieldChoicesSchema = z
42
33
  .object({
43
34
  // Required action identification
44
35
  appKey: AppKeyPropertySchema,
@@ -70,4 +61,4 @@ export const ListInputFieldChoicesSchema = withOutputSchema(z
70
61
  .optional()
71
62
  .describe("Maximum total items to return across all pages"),
72
63
  })
73
- .describe("Get the available choices for a dynamic dropdown input field"), InputFieldChoiceItemSchema);
64
+ .describe("Get the available choices for a dynamic dropdown input field");
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFields/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,qBAAqB,EACrB,KAAK,sBAAsB,EAE5B,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAkGxE,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAC7D,IAAI,EAAE,cAAc,EAAE,CAAC;KACxB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,cAAc,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC/D,KAAK,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;KACxC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,eAAe,EAAE;gBACf,WAAW,EAAE,OAAO,qBAAqB,CAAC;aAC3C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,UAAU,CAAC,oBAAo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B,CAqF9B,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import { ListInputFieldsSchema, } from "./schemas";
2
2
  import { ZapierConfigurationError, ZapierApiError } from "../../types/errors";
3
3
  import { createPaginatedFunction } from "../../utils/function-utils";
4
+ import { appKeyResolver, actionTypeResolver, actionKeyResolver, authenticationIdResolver, inputsAllOptionalResolver, } from "../../resolvers";
5
+ import { InputFieldItemSchema } from "../../schemas/Field";
4
6
  // Enums for input field transformation
5
7
  var InputFieldType;
6
8
  (function (InputFieldType) {
@@ -72,8 +74,8 @@ function getItemsTypeFromNeed(need) {
72
74
  function transformNeedToInputFieldItem(need) {
73
75
  const itemsType = getItemsTypeFromNeed(need);
74
76
  return {
75
- ...need, // Pass through all original Need fields
76
- id: need.key,
77
+ // Only the final computed/mapped fields that are in InputFieldItemSchema
78
+ key: need.key,
77
79
  default_value: need.default || "",
78
80
  depends_on: need.depends_on || [],
79
81
  description: need.help_text || "",
@@ -125,7 +127,17 @@ export const listInputFieldsPlugin = ({ context }) => {
125
127
  meta: {
126
128
  listInputFields: {
127
129
  categories: ["action"],
130
+ type: "list",
131
+ itemType: "InputField",
128
132
  inputSchema: ListInputFieldsSchema,
133
+ outputSchema: InputFieldItemSchema,
134
+ resolvers: {
135
+ appKey: appKeyResolver,
136
+ actionType: actionTypeResolver,
137
+ actionKey: actionKeyResolver,
138
+ authenticationId: authenticationIdResolver,
139
+ inputs: inputsAllOptionalResolver,
140
+ },
129
141
  },
130
142
  },
131
143
  },