@zapier/zapier-sdk 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +28 -0
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +45 -22
  5. package/dist/api/schemas.d.ts +3 -0
  6. package/dist/api/schemas.d.ts.map +1 -1
  7. package/dist/api/schemas.js +1 -0
  8. package/dist/index.cjs +181 -87
  9. package/dist/index.d.mts +47 -2
  10. package/dist/index.mjs +181 -87
  11. package/dist/plugins/getAuthentication/index.js +1 -1
  12. package/dist/plugins/getAuthentication/index.test.js +1 -1
  13. package/dist/plugins/getInputFieldsSchema/index.d.ts +22 -0
  14. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -0
  15. package/dist/plugins/getInputFieldsSchema/index.js +51 -0
  16. package/dist/plugins/getInputFieldsSchema/index.test.d.ts +2 -0
  17. package/dist/plugins/getInputFieldsSchema/index.test.d.ts.map +1 -0
  18. package/dist/plugins/getInputFieldsSchema/index.test.js +288 -0
  19. package/dist/plugins/getInputFieldsSchema/schemas.d.ts +31 -0
  20. package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +1 -0
  21. package/dist/plugins/getInputFieldsSchema/schemas.js +13 -0
  22. package/dist/plugins/getProfile/index.d.ts.map +1 -1
  23. package/dist/plugins/getProfile/index.js +1 -1
  24. package/dist/plugins/listActions/index.js +1 -1
  25. package/dist/plugins/listActions/index.test.js +1 -1
  26. package/dist/plugins/listApps/index.js +2 -2
  27. package/dist/plugins/listApps/index.test.js +1 -1
  28. package/dist/plugins/listAuthentications/index.js +1 -1
  29. package/dist/plugins/listAuthentications/index.test.js +13 -13
  30. package/dist/plugins/listInputFieldChoices/index.test.js +19 -19
  31. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  32. package/dist/plugins/listInputFields/index.js +2 -0
  33. package/dist/plugins/listInputFields/index.test.js +4 -4
  34. package/dist/plugins/manifest/index.js +2 -2
  35. package/dist/plugins/manifest/index.test.js +3 -3
  36. package/dist/plugins/runAction/index.js +2 -2
  37. package/dist/plugins/runAction/index.test.js +4 -4
  38. package/dist/sdk.d.ts +7 -1
  39. package/dist/sdk.d.ts.map +1 -1
  40. package/dist/sdk.js +2 -0
  41. package/dist/sdk.test.js +1 -1
  42. package/dist/services/implementations.js +2 -2
  43. package/dist/temporary-internal-core/index.d.ts +14 -0
  44. package/dist/temporary-internal-core/index.d.ts.map +1 -0
  45. package/dist/temporary-internal-core/index.js +14 -0
  46. package/dist/types/sdk.d.ts +2 -1
  47. package/dist/types/sdk.d.ts.map +1 -1
  48. package/package.json +1 -1
@@ -0,0 +1,288 @@
1
+ import { describe, it, expect, vi, beforeEach } from "vitest";
2
+ import { ZapierValidationError, ZapierConfigurationError, ZapierApiError, } from "../../types/errors";
3
+ import { getInputFieldsSchemaPlugin } from "./index";
4
+ import { getActionPlugin } from "../getAction";
5
+ import { getAppPlugin } from "../getApp";
6
+ import { listActionsPlugin } from "../listActions";
7
+ import { listAppsPlugin } from "../listApps";
8
+ import { createSdk } from "../../sdk";
9
+ const mockSchema = {
10
+ type: "object",
11
+ properties: {
12
+ message: {
13
+ type: "string",
14
+ title: "Message",
15
+ description: "The message to send",
16
+ },
17
+ channel: {
18
+ type: "string",
19
+ title: "Channel",
20
+ description: "The channel to send to",
21
+ },
22
+ tags: {
23
+ type: "array",
24
+ items: {
25
+ type: "string",
26
+ },
27
+ title: "Tags",
28
+ description: "List of tags",
29
+ },
30
+ },
31
+ required: ["message", "channel"],
32
+ };
33
+ const mockNeedsResponse = {
34
+ success: true,
35
+ needs: [],
36
+ schema: mockSchema,
37
+ };
38
+ const mockActionsResponse = {
39
+ results: [
40
+ {
41
+ slug: "slack",
42
+ selected_api: "slack",
43
+ actions: [
44
+ {
45
+ key: "send_message",
46
+ name: "Send Message",
47
+ description: "Send a message to a channel",
48
+ type_of: "write",
49
+ type: "write",
50
+ id: "core:12345",
51
+ },
52
+ ],
53
+ },
54
+ ],
55
+ meta: {
56
+ next_cursor: null,
57
+ },
58
+ };
59
+ describe("getInputFieldsSchema plugin", () => {
60
+ let mockApiClient;
61
+ let mockGetVersionedImplementationId;
62
+ beforeEach(() => {
63
+ vi.clearAllMocks();
64
+ mockApiClient = {
65
+ get: vi.fn().mockResolvedValue(mockActionsResponse),
66
+ post: vi.fn().mockResolvedValue(mockNeedsResponse),
67
+ };
68
+ mockGetVersionedImplementationId = vi
69
+ .fn()
70
+ .mockResolvedValue("SlackCLIAPI@1.21.1");
71
+ });
72
+ function createTestSdk() {
73
+ return createSdk({}, {}, {
74
+ api: mockApiClient,
75
+ meta: {},
76
+ getVersionedImplementationId: mockGetVersionedImplementationId,
77
+ })
78
+ .addPlugin(listAppsPlugin)
79
+ .addPlugin(listActionsPlugin)
80
+ .addPlugin(getAppPlugin)
81
+ .addPlugin(getActionPlugin)
82
+ .addPlugin(getInputFieldsSchemaPlugin);
83
+ }
84
+ describe("schema validation", () => {
85
+ it("should throw validation error for missing required fields", async () => {
86
+ const sdk = createTestSdk();
87
+ await expect(sdk.getInputFieldsSchema({
88
+ // Missing required fields
89
+ })).rejects.toThrow(ZapierValidationError);
90
+ });
91
+ it("should throw validation error for invalid field types", async () => {
92
+ const sdk = createTestSdk();
93
+ await expect(sdk.getInputFieldsSchema({
94
+ appKey: 123,
95
+ actionType: "write",
96
+ actionKey: "send_message",
97
+ })).rejects.toThrow(ZapierValidationError);
98
+ });
99
+ it("should pass validation with all required fields", async () => {
100
+ const sdk = createTestSdk();
101
+ const result = await sdk.getInputFieldsSchema({
102
+ appKey: "slack",
103
+ actionType: "write",
104
+ actionKey: "send_message",
105
+ });
106
+ expect(result.data).toBeDefined();
107
+ });
108
+ it("should pass validation with optional fields", async () => {
109
+ const sdk = createTestSdk();
110
+ const result = await sdk.getInputFieldsSchema({
111
+ appKey: "slack",
112
+ actionType: "write",
113
+ actionKey: "send_message",
114
+ authenticationId: 123,
115
+ inputs: { channel: "#general" },
116
+ });
117
+ expect(result.data).toBeDefined();
118
+ });
119
+ });
120
+ describe("API integration", () => {
121
+ it("should call the correct API endpoint", async () => {
122
+ const sdk = createTestSdk();
123
+ await sdk.getInputFieldsSchema({
124
+ appKey: "slack",
125
+ actionType: "write",
126
+ actionKey: "send_message",
127
+ });
128
+ expect(mockApiClient.post).toHaveBeenCalledWith("/zapier/api/v4/implementations/needs/", {
129
+ selected_api: "SlackCLIAPI@1.21.1",
130
+ action: "send_message",
131
+ type_of: "write",
132
+ params: {},
133
+ });
134
+ });
135
+ it("should include authentication_id when provided", async () => {
136
+ const sdk = createTestSdk();
137
+ await sdk.getInputFieldsSchema({
138
+ appKey: "slack",
139
+ actionType: "write",
140
+ actionKey: "send_message",
141
+ authenticationId: 123,
142
+ });
143
+ expect(mockApiClient.post).toHaveBeenCalledWith("/zapier/api/v4/implementations/needs/", {
144
+ selected_api: "SlackCLIAPI@1.21.1",
145
+ action: "send_message",
146
+ type_of: "write",
147
+ params: {},
148
+ authentication_id: 123,
149
+ });
150
+ });
151
+ it("should exclude authentication_id when null", async () => {
152
+ const sdk = createTestSdk();
153
+ await sdk.getInputFieldsSchema({
154
+ appKey: "slack",
155
+ actionType: "write",
156
+ actionKey: "send_message",
157
+ authenticationId: null,
158
+ });
159
+ expect(mockApiClient.post).toHaveBeenCalledWith("/zapier/api/v4/implementations/needs/", {
160
+ selected_api: "SlackCLIAPI@1.21.1",
161
+ action: "send_message",
162
+ type_of: "write",
163
+ params: {},
164
+ // No authentication_id
165
+ });
166
+ });
167
+ it("should include inputs when provided", async () => {
168
+ const sdk = createTestSdk();
169
+ const inputs = { channel: "#general", message: "test" };
170
+ await sdk.getInputFieldsSchema({
171
+ appKey: "slack",
172
+ actionType: "write",
173
+ actionKey: "send_message",
174
+ inputs,
175
+ });
176
+ expect(mockApiClient.post).toHaveBeenCalledWith("/zapier/api/v4/implementations/needs/", {
177
+ selected_api: "SlackCLIAPI@1.21.1",
178
+ action: "send_message",
179
+ type_of: "write",
180
+ params: inputs,
181
+ });
182
+ });
183
+ });
184
+ describe("data return", () => {
185
+ it("should return the schema object from the API response", async () => {
186
+ const sdk = createTestSdk();
187
+ const result = await sdk.getInputFieldsSchema({
188
+ appKey: "slack",
189
+ actionType: "write",
190
+ actionKey: "send_message",
191
+ });
192
+ expect(result.data).toEqual(mockSchema);
193
+ });
194
+ it("should return empty object when schema is not present", async () => {
195
+ mockApiClient.post = vi.fn().mockResolvedValue({
196
+ success: true,
197
+ needs: [],
198
+ // No schema field
199
+ });
200
+ const sdk = createTestSdk();
201
+ const result = await sdk.getInputFieldsSchema({
202
+ appKey: "slack",
203
+ actionType: "write",
204
+ actionKey: "send_message",
205
+ });
206
+ expect(result.data).toEqual({});
207
+ });
208
+ it("should handle complex schema structures", async () => {
209
+ const complexSchema = {
210
+ type: "object",
211
+ properties: {
212
+ user: {
213
+ type: "object",
214
+ properties: {
215
+ name: { type: "string" },
216
+ age: { type: "number" },
217
+ },
218
+ required: ["name"],
219
+ },
220
+ tags: {
221
+ type: "array",
222
+ items: { type: "string" },
223
+ },
224
+ },
225
+ required: ["user"],
226
+ };
227
+ mockApiClient.post = vi.fn().mockResolvedValue({
228
+ success: true,
229
+ needs: [],
230
+ schema: complexSchema,
231
+ });
232
+ const sdk = createTestSdk();
233
+ const result = await sdk.getInputFieldsSchema({
234
+ appKey: "slack",
235
+ actionType: "write",
236
+ actionKey: "send_message",
237
+ });
238
+ expect(result.data).toEqual(complexSchema);
239
+ });
240
+ });
241
+ describe("error handling", () => {
242
+ it("should throw ZapierConfigurationError when app has no current_implementation_id", async () => {
243
+ mockGetVersionedImplementationId.mockResolvedValue(null);
244
+ const sdk = createTestSdk();
245
+ await expect(sdk.getInputFieldsSchema({
246
+ appKey: "invalid",
247
+ actionType: "write",
248
+ actionKey: "send_message",
249
+ })).rejects.toThrow(ZapierConfigurationError);
250
+ });
251
+ it("should throw ZapierApiError when API response indicates failure", async () => {
252
+ mockApiClient.post = vi.fn().mockResolvedValue({
253
+ success: false,
254
+ errors: ["Authentication failed", "Invalid credentials"],
255
+ });
256
+ const sdk = createTestSdk();
257
+ await expect(sdk.getInputFieldsSchema({
258
+ appKey: "slack",
259
+ actionType: "write",
260
+ actionKey: "send_message",
261
+ })).rejects.toThrow(ZapierApiError);
262
+ await expect(sdk.getInputFieldsSchema({
263
+ appKey: "slack",
264
+ actionType: "write",
265
+ actionKey: "send_message",
266
+ })).rejects.toThrow("Failed to get input fields: Authentication failed, Invalid credentials");
267
+ });
268
+ it("should handle API errors gracefully", async () => {
269
+ mockApiClient.post = vi
270
+ .fn()
271
+ .mockRejectedValue(new Error("Network error"));
272
+ const sdk = createTestSdk();
273
+ await expect(sdk.getInputFieldsSchema({
274
+ appKey: "slack",
275
+ actionType: "write",
276
+ actionKey: "send_message",
277
+ })).rejects.toThrow("Network error");
278
+ });
279
+ });
280
+ describe("context and metadata", () => {
281
+ it("should provide context with meta information", () => {
282
+ const sdk = createTestSdk();
283
+ const context = sdk.getContext();
284
+ expect(context.meta.getInputFieldsSchema).toBeDefined();
285
+ expect(context.meta.getInputFieldsSchema.inputSchema).toBeDefined();
286
+ });
287
+ });
288
+ });
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ import type { ZapierConfigurationError, ZapierApiError, ZapierAuthenticationError, ZapierAppNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
3
+ export declare const GetInputFieldsSchemaSchema: z.ZodObject<{
4
+ appKey: z.ZodString & {
5
+ _def: z.ZodStringDef & import("../..").PositionalMetadata;
6
+ };
7
+ actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
8
+ actionKey: z.ZodString;
9
+ authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
10
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ appKey: string;
13
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
14
+ actionKey: string;
15
+ authenticationId?: number | null | undefined;
16
+ inputs?: Record<string, unknown> | undefined;
17
+ }, {
18
+ appKey: string;
19
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
20
+ actionKey: string;
21
+ authenticationId?: number | null | undefined;
22
+ inputs?: Record<string, unknown> | undefined;
23
+ }>;
24
+ export type GetInputFieldsSchemaOptions = z.infer<typeof GetInputFieldsSchemaSchema>;
25
+ export type GetInputFieldsSchemaError = ZapierConfigurationError | ZapierApiError | ZapierAuthenticationError | ZapierAppNotFoundError | ZapierValidationError | ZapierUnknownError;
26
+ export interface GetInputFieldsSchemaSdkFunction {
27
+ getInputFieldsSchema: (options: GetInputFieldsSchemaOptions) => Promise<{
28
+ data: Record<string, unknown>;
29
+ }>;
30
+ }
31
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,KAAK,EACV,wBAAwB,EACxB,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;EAsBpC,CAAC;AAEJ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,0BAA0B,CAClC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GACjC,wBAAwB,GACxB,cAAc,GACd,yBAAyB,GACzB,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,+BAA+B;IAC9C,oBAAoB,EAAE,CACpB,OAAO,EAAE,2BAA2B,KACjC,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CACjD"}
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ import { AppKeyPropertySchema, ActionTypePropertySchema, ActionKeyPropertySchema, AuthenticationIdPropertySchema, InputsPropertySchema, } from "../../types/properties";
3
+ export const GetInputFieldsSchemaSchema = z
4
+ .object({
5
+ appKey: AppKeyPropertySchema.describe("App key (e.g., 'SlackCLIAPI' or slug like 'github') to get the input schema for"),
6
+ actionType: ActionTypePropertySchema.describe("Action type that matches the action's defined type"),
7
+ actionKey: ActionKeyPropertySchema.describe("Action key to get the input schema for"),
8
+ authenticationId: AuthenticationIdPropertySchema.nullable()
9
+ .optional()
10
+ .describe("Authentication ID to use when fetching the schema. Required if the action needs authentication to determine available fields."),
11
+ inputs: InputsPropertySchema.optional().describe("Current input values that may affect the schema (e.g., when fields depend on other field values)"),
12
+ })
13
+ .describe("Get the JSON Schema representation of input fields for an action. Returns a JSON Schema object describing the structure, types, and validation rules for the action's input parameters.");
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAI7C,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,CACV,OAAO,CAAC,EAAE,iBAAiB,KACxB,OAAO,CAAC;QAAE,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC,CAAC;IACxC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,UAAU,EAAE;gBACV,WAAW,EAAE,OAAO,gBAAgB,CAAC;aACtC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAGD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,EAAE,EAAE,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,wBAAwB,CAiCzB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAI7C,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,CACV,OAAO,CAAC,EAAE,iBAAiB,KACxB,OAAO,CAAC;QAAE,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC,CAAC;IACxC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,UAAU,EAAE;gBACV,WAAW,EAAE,OAAO,gBAAgB,CAAC;aACtC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAGD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,EAAE,EAAE,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,wBAAwB,CAoCzB,CAAC"}
@@ -4,7 +4,7 @@ import { UserProfileItemSchema } from "../../schemas/UserProfile";
4
4
  // Direct plugin function - takes options + sdk + context in one object
5
5
  export const getProfilePlugin = ({ context }) => {
6
6
  const getProfile = createFunction(async function getProfile() {
7
- const profile = await context.api.get("/api/v4/profile/", {
7
+ const profile = await context.api.get("/zapier/api/v4/profile/", {
8
8
  authRequired: true,
9
9
  });
10
10
  // Remove user_id since that's our internal user ID which could confuse things!
@@ -17,7 +17,7 @@ export const listActionsPlugin = ({ context }) => {
17
17
  public_only: "true",
18
18
  selected_apis: selectedApi,
19
19
  };
20
- const data = await api.get("/api/v4/implementations/", {
20
+ const data = await api.get("/zapier/api/v4/implementations/", {
21
21
  searchParams,
22
22
  customErrorHandler: ({ status }) => {
23
23
  if (status === 401) {
@@ -335,7 +335,7 @@ describe("listActions plugin", () => {
335
335
  it("should pass correct search parameters to implementations API", async () => {
336
336
  const sdk = createTestSdk();
337
337
  await sdk.listActions({ appKey: "slack" });
338
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/implementations/", expect.objectContaining({
338
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/implementations/", expect.objectContaining({
339
339
  searchParams: expect.objectContaining({
340
340
  global: "true",
341
341
  public_only: "true",
@@ -28,7 +28,7 @@ export const listAppsPlugin = ({ context }) => {
28
28
  if (options.search) {
29
29
  const searchParams = {};
30
30
  searchParams.term = options.search;
31
- const searchEnvelope = await api.get("/api/v4/implementations-meta/search/", {
31
+ const searchEnvelope = await api.get("/zapier/api/v4/implementations-meta/search/", {
32
32
  searchParams,
33
33
  });
34
34
  const implementations = searchEnvelope.results.map(normalizeImplementationMetaToAppItem);
@@ -65,7 +65,7 @@ export const listAppsPlugin = ({ context }) => {
65
65
  nextCursor: undefined,
66
66
  };
67
67
  }
68
- const implementationsEnvelope = await api.get("/api/v4/implementations-meta/lookup/", {
68
+ const implementationsEnvelope = await api.get("/zapier/api/v4/implementations-meta/lookup/", {
69
69
  searchParams,
70
70
  });
71
71
  return {
@@ -103,7 +103,7 @@ describe("listApps plugin", () => {
103
103
  key: "SlackCLIAPI",
104
104
  title: "Slack",
105
105
  });
106
- expect(context.api.get).toHaveBeenCalledWith("/api/v4/implementations-meta/lookup/", {
106
+ expect(context.api.get).toHaveBeenCalledWith("/zapier/api/v4/implementations-meta/lookup/", {
107
107
  searchParams: {
108
108
  latest_only: "true",
109
109
  limit: "100",
@@ -41,7 +41,7 @@ export const listAuthenticationsPlugin = ({ context }) => {
41
41
  // Convert cursor back to offset for the API
42
42
  searchParams.offset = options.cursor;
43
43
  }
44
- const data = await api.get("/api/v4/authentications/", {
44
+ const data = await api.get("/zapier/api/v4/authentications/", {
45
45
  searchParams,
46
46
  customErrorHandler: ({ status }) => {
47
47
  if (status === 401) {
@@ -234,7 +234,7 @@ describe("listAuthentications plugin", () => {
234
234
  it("should use search parameter when provided", async () => {
235
235
  const sdk = createTestSdk();
236
236
  await sdk.listAuthentications({ search: "workspace" });
237
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
237
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.objectContaining({
238
238
  searchParams: expect.objectContaining({
239
239
  search: "workspace",
240
240
  }),
@@ -243,7 +243,7 @@ describe("listAuthentications plugin", () => {
243
243
  it("should use title as search when search not provided", async () => {
244
244
  const sdk = createTestSdk();
245
245
  await sdk.listAuthentications({ title: "My Slack Workspace" });
246
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
246
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.objectContaining({
247
247
  searchParams: expect.objectContaining({
248
248
  search: "My Slack Workspace",
249
249
  }),
@@ -255,7 +255,7 @@ describe("listAuthentications plugin", () => {
255
255
  search: "explicit search",
256
256
  title: "My Title",
257
257
  });
258
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
258
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.objectContaining({
259
259
  searchParams: expect.objectContaining({
260
260
  search: "explicit search",
261
261
  }),
@@ -264,7 +264,7 @@ describe("listAuthentications plugin", () => {
264
264
  it("should pass accountId filter to API", async () => {
265
265
  const sdk = createTestSdk();
266
266
  await sdk.listAuthentications({ accountId: "acc_123" });
267
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
267
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.objectContaining({
268
268
  searchParams: expect.objectContaining({
269
269
  account_id: "acc_123",
270
270
  }),
@@ -273,7 +273,7 @@ describe("listAuthentications plugin", () => {
273
273
  it("should pass owner filter to API", async () => {
274
274
  const sdk = createTestSdk();
275
275
  await sdk.listAuthentications({ owner: "me" });
276
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
276
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.objectContaining({
277
277
  searchParams: expect.objectContaining({
278
278
  owner: "me",
279
279
  }),
@@ -284,7 +284,7 @@ describe("listAuthentications plugin", () => {
284
284
  await sdk.listAuthentications({
285
285
  authenticationIds: ["123", "456", "789"],
286
286
  });
287
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
287
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.objectContaining({
288
288
  searchParams: expect.objectContaining({
289
289
  ids: "123,456,789",
290
290
  }),
@@ -295,7 +295,7 @@ describe("listAuthentications plugin", () => {
295
295
  await sdk.listAuthentications({
296
296
  authenticationIds: [],
297
297
  });
298
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
298
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.objectContaining({
299
299
  searchParams: expect.not.objectContaining({
300
300
  ids: expect.anything(),
301
301
  }),
@@ -394,7 +394,7 @@ describe("listAuthentications plugin", () => {
394
394
  it("should set appropriate pageSize for API calls", async () => {
395
395
  const sdk = createTestSdk();
396
396
  await sdk.listAuthentications({ pageSize: 1 });
397
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
397
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.objectContaining({
398
398
  searchParams: expect.objectContaining({
399
399
  limit: "1",
400
400
  }),
@@ -405,12 +405,12 @@ describe("listAuthentications plugin", () => {
405
405
  it("should call the correct API endpoint", async () => {
406
406
  const sdk = createTestSdk();
407
407
  await sdk.listAuthentications({});
408
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.any(Object));
408
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.any(Object));
409
409
  });
410
410
  it("should pass pageSize as limit parameter", async () => {
411
411
  const sdk = createTestSdk();
412
412
  await sdk.listAuthentications({ pageSize: 25 });
413
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
413
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.objectContaining({
414
414
  searchParams: expect.objectContaining({
415
415
  limit: "25",
416
416
  }),
@@ -440,7 +440,7 @@ describe("listAuthentications plugin", () => {
440
440
  expect(pageCount).toBe(2);
441
441
  expect(mockApiClient.get).toHaveBeenCalledTimes(2);
442
442
  // The second call should include the offset from the cursor
443
- expect(mockApiClient.get).toHaveBeenNthCalledWith(2, "/api/v4/authentications/", expect.objectContaining({
443
+ expect(mockApiClient.get).toHaveBeenNthCalledWith(2, "/zapier/api/v4/authentications/", expect.objectContaining({
444
444
  searchParams: expect.objectContaining({
445
445
  offset: "1",
446
446
  }),
@@ -500,7 +500,7 @@ describe("listAuthentications plugin", () => {
500
500
  const sdk = createTestSdk();
501
501
  await sdk.listAuthentications({ appKey: "slack" });
502
502
  // Should not add versionless_selected_api parameter
503
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
503
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.objectContaining({
504
504
  searchParams: expect.not.objectContaining({
505
505
  versionless_selected_api: expect.any(String),
506
506
  }),
@@ -510,7 +510,7 @@ describe("listAuthentications plugin", () => {
510
510
  mockGetVersionedImplementationId.mockResolvedValue("SlackCLIAPI@2.1.3");
511
511
  const sdk = createTestSdk();
512
512
  await sdk.listAuthentications({ appKey: "slack" });
513
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
513
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/", expect.objectContaining({
514
514
  searchParams: expect.objectContaining({
515
515
  versionless_selected_api: "SlackCLIAPI",
516
516
  }),