@zapier/zapier-sdk 0.14.0 → 0.15.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.
package/dist/index.mjs CHANGED
@@ -1273,7 +1273,7 @@ var listAppsPlugin = ({ context }) => {
1273
1273
  const searchParams2 = {};
1274
1274
  searchParams2.term = options.search;
1275
1275
  const searchEnvelope = await api.get(
1276
- "/api/v4/implementations-meta/search/",
1276
+ "/zapier/api/v4/implementations-meta/search/",
1277
1277
  {
1278
1278
  searchParams: searchParams2
1279
1279
  }
@@ -1313,7 +1313,7 @@ var listAppsPlugin = ({ context }) => {
1313
1313
  };
1314
1314
  }
1315
1315
  const implementationsEnvelope = await api.get(
1316
- "/api/v4/implementations-meta/lookup/",
1316
+ "/zapier/api/v4/implementations-meta/lookup/",
1317
1317
  {
1318
1318
  searchParams
1319
1319
  }
@@ -1599,7 +1599,7 @@ var listActionsPlugin = ({ context }) => {
1599
1599
  selected_apis: selectedApi
1600
1600
  };
1601
1601
  const data = await api.get(
1602
- "/api/v4/implementations/",
1602
+ "/zapier/api/v4/implementations/",
1603
1603
  {
1604
1604
  searchParams,
1605
1605
  customErrorHandler: ({ status }) => {
@@ -1809,7 +1809,7 @@ async function fetchImplementationNeeds({
1809
1809
  request.authentication_id = authenticationId;
1810
1810
  }
1811
1811
  const response = await api.post(
1812
- "/api/v4/implementations/needs/",
1812
+ "/zapier/api/v4/implementations/needs/",
1813
1813
  request
1814
1814
  );
1815
1815
  if (!response.success) {
@@ -1837,7 +1837,7 @@ async function fetchImplementationChoices({
1837
1837
  request.authentication_id = authenticationId;
1838
1838
  }
1839
1839
  const response = await api.post(
1840
- "/api/v4/implementations/choices/",
1840
+ "/zapier/api/v4/implementations/choices/",
1841
1841
  request
1842
1842
  );
1843
1843
  if (!response.success) {
@@ -2102,7 +2102,7 @@ var listAuthenticationsPlugin = ({ context }) => {
2102
2102
  searchParams.offset = options.cursor;
2103
2103
  }
2104
2104
  const data = await api.get(
2105
- "/api/v4/authentications/",
2105
+ "/zapier/api/v4/authentications/",
2106
2106
  {
2107
2107
  searchParams,
2108
2108
  customErrorHandler: ({ status }) => {
@@ -2242,7 +2242,7 @@ var getAuthenticationPlugin = ({ context }) => {
2242
2242
  const { api } = context;
2243
2243
  const { authenticationId } = options;
2244
2244
  const data = await api.get(
2245
- `/api/v4/authentications/${authenticationId}/`,
2245
+ `/zapier/api/v4/authentications/${authenticationId}/`,
2246
2246
  {
2247
2247
  customErrorHandler: ({ status }) => {
2248
2248
  if (status === 401) {
@@ -2435,11 +2435,11 @@ async function executeAction(actionOptions) {
2435
2435
  data: runRequestData
2436
2436
  };
2437
2437
  const runData = await api.post(
2438
- "/api/actions/v1/runs",
2438
+ "/zapier/api/actions/v1/runs",
2439
2439
  runRequest
2440
2440
  );
2441
2441
  const runId = runData.data.id;
2442
- return await api.poll(`/api/actions/v1/runs/${runId}`, {
2442
+ return await api.poll(`/zapier/api/actions/v1/runs/${runId}`, {
2443
2443
  successStatus: 200,
2444
2444
  pendingStatus: 202,
2445
2445
  resultExtractor: (result) => result.data
@@ -2720,7 +2720,7 @@ async function getPreferredManifestEntryKey({
2720
2720
  }
2721
2721
  if (locator.implementationName) {
2722
2722
  try {
2723
- const implementationsEnvelope = await api.get(`/api/v4/implementations-meta/lookup/`, {
2723
+ const implementationsEnvelope = await api.get(`/zapier/api/v4/implementations-meta/lookup/`, {
2724
2724
  searchParams: {
2725
2725
  selected_apis: locator.implementationName
2726
2726
  }
@@ -2747,7 +2747,7 @@ async function listAppsForSlugsPage({
2747
2747
  searchParams.offset = cursor;
2748
2748
  }
2749
2749
  const implementationsEnvelope = await api.get(
2750
- "/api/v4/implementations-meta/lookup/",
2750
+ "/zapier/api/v4/implementations-meta/lookup/",
2751
2751
  {
2752
2752
  searchParams
2753
2753
  }
@@ -2986,9 +2986,12 @@ var UserProfileItemSchema = withFormatter(
2986
2986
  // src/plugins/getProfile/index.ts
2987
2987
  var getProfilePlugin = ({ context }) => {
2988
2988
  const getProfile = createFunction(async function getProfile2() {
2989
- const profile = await context.api.get("/api/v4/profile/", {
2990
- authRequired: true
2991
- });
2989
+ const profile = await context.api.get(
2990
+ "/zapier/api/v4/profile/",
2991
+ {
2992
+ authRequired: true
2993
+ }
2994
+ );
2992
2995
  const { user_id: _unusedUserId, ...data } = profile;
2993
2996
  return {
2994
2997
  data: {
@@ -3315,11 +3318,63 @@ async function getTokenFromEnvOrConfig(options = {}) {
3315
3318
  return getTokenFromCliLogin(options);
3316
3319
  }
3317
3320
 
3321
+ // src/utils/url-utils.ts
3322
+ function getZapierBaseUrl(baseUrl) {
3323
+ if (!baseUrl) {
3324
+ return void 0;
3325
+ }
3326
+ try {
3327
+ const url = new URL(baseUrl);
3328
+ const hostname = url.hostname;
3329
+ const hostParts = hostname.split(".");
3330
+ if (hostParts.length < 2) {
3331
+ return void 0;
3332
+ }
3333
+ const hasZapierPart = hostParts.some(
3334
+ (part) => part === "zapier" || part.startsWith("zapier-")
3335
+ );
3336
+ if (!hasZapierPart) {
3337
+ return void 0;
3338
+ }
3339
+ const rootDomain = hostParts.slice(-2).join(".");
3340
+ return `${url.protocol}//${rootDomain}`;
3341
+ } catch {
3342
+ return void 0;
3343
+ }
3344
+ }
3345
+ function getTrackingBaseUrl({
3346
+ trackingBaseUrl,
3347
+ baseUrl
3348
+ }) {
3349
+ if (trackingBaseUrl) {
3350
+ return trackingBaseUrl;
3351
+ }
3352
+ if (process.env.ZAPIER_TRACKING_BASE_URL) {
3353
+ return process.env.ZAPIER_TRACKING_BASE_URL;
3354
+ }
3355
+ if (baseUrl) {
3356
+ const zapierBaseUrl = getZapierBaseUrl(baseUrl);
3357
+ if (zapierBaseUrl) {
3358
+ return zapierBaseUrl;
3359
+ }
3360
+ }
3361
+ if (baseUrl) {
3362
+ return baseUrl;
3363
+ }
3364
+ return ZAPIER_BASE_URL;
3365
+ }
3366
+
3318
3367
  // src/api/client.ts
3319
- var SubdomainConfigMap = {
3320
- // e.g. https://relay.zapier.com
3321
- relay: {
3322
- authHeader: "X-Relay-Authorization"
3368
+ var pathConfig = {
3369
+ // e.g. /relay -> https://sdkapi.zapier.com/api/v0/sdk/relay/...
3370
+ "/relay": {
3371
+ authHeader: "X-Relay-Authorization",
3372
+ pathPrefix: "/api/v0/sdk/relay"
3373
+ },
3374
+ // e.g. /zapier -> https://sdkapi.zapier.com/api/v0/sdk/zapier/...
3375
+ "/zapier": {
3376
+ authHeader: "Authorization",
3377
+ pathPrefix: "/api/v0/sdk/zapier"
3323
3378
  }
3324
3379
  };
3325
3380
  var ZapierApiClient = class {
@@ -3508,39 +3563,47 @@ var ZapierApiClient = class {
3508
3563
  return { message: fallbackMessage };
3509
3564
  }
3510
3565
  }
3511
- // Check if this is a path that needs subdomain routing
3512
- // e.g. /relay/workflows -> relay.zapier.com/workflows
3513
- applySubdomainBehavior(path) {
3514
- const pathSegments = path.split("/").filter(Boolean);
3515
- if (pathSegments.length > 0 && pathSegments[0] in SubdomainConfigMap) {
3516
- const domainPrefix = pathSegments[0];
3517
- const subdomainConfig = SubdomainConfigMap[domainPrefix];
3566
+ // Apply any special routing logic for configured paths.
3567
+ applyPathConfiguration(path) {
3568
+ const matchingPathKey = Object.keys(pathConfig).find(
3569
+ (configPath) => path === configPath || path.startsWith(configPath + "/")
3570
+ );
3571
+ const config = matchingPathKey ? pathConfig[matchingPathKey] : void 0;
3572
+ const zapierBaseUrl = getZapierBaseUrl(this.options.baseUrl);
3573
+ if (zapierBaseUrl === this.options.baseUrl) {
3518
3574
  const originalBaseUrl = new URL(this.options.baseUrl);
3519
- const finalBaseUrl = `https://${domainPrefix}.${originalBaseUrl.hostname}`;
3520
- const pathWithoutPrefix = "/" + pathSegments.slice(1).join("/");
3521
- return { url: new URL(pathWithoutPrefix, finalBaseUrl), subdomainConfig };
3575
+ const finalBaseUrl = `https://sdkapi.${originalBaseUrl.hostname}`;
3576
+ let finalPath = path;
3577
+ if (config && "pathPrefix" in config && config.pathPrefix && matchingPathKey) {
3578
+ const pathWithoutPrefix = path.slice(matchingPathKey.length) || "/";
3579
+ finalPath = `${config.pathPrefix}${pathWithoutPrefix}`;
3580
+ }
3581
+ return {
3582
+ url: new URL(finalPath, finalBaseUrl),
3583
+ pathConfig: config
3584
+ };
3522
3585
  }
3523
3586
  return {
3524
3587
  url: new URL(path, this.options.baseUrl),
3525
- subdomainConfig: void 0
3588
+ pathConfig: config
3526
3589
  };
3527
3590
  }
3528
3591
  // Helper to build full URLs and return routing info
3529
3592
  buildUrl(path, searchParams) {
3530
- const { url, subdomainConfig } = this.applySubdomainBehavior(path);
3593
+ const { url, pathConfig: config } = this.applyPathConfiguration(path);
3531
3594
  if (searchParams) {
3532
3595
  Object.entries(searchParams).forEach(([key, value]) => {
3533
3596
  url.searchParams.set(key, value);
3534
3597
  });
3535
3598
  }
3536
- return { url: url.toString(), subdomainConfig };
3599
+ return { url: url.toString(), pathConfig: config };
3537
3600
  }
3538
3601
  // Helper to build headers
3539
- async buildHeaders(options = {}, subdomainConfig) {
3602
+ async buildHeaders(options = {}, pathConfig2) {
3540
3603
  const headers = new Headers(options.headers ?? {});
3541
3604
  const authToken = await this.getAuthToken();
3542
3605
  if (authToken) {
3543
- const authHeaderName = subdomainConfig?.authHeader || "Authorization";
3606
+ const authHeaderName = pathConfig2?.authHeader || "Authorization";
3544
3607
  headers.set(authHeaderName, getAuthorizationHeader(authToken));
3545
3608
  }
3546
3609
  if (options.authRequired) {
@@ -3587,13 +3650,10 @@ var ZapierApiClient = class {
3587
3650
  if (fetchOptions?.body && typeof fetchOptions.body === "object") {
3588
3651
  fetchOptions.body = JSON.stringify(fetchOptions.body);
3589
3652
  }
3590
- const { url, subdomainConfig } = this.buildUrl(
3591
- path,
3592
- fetchOptions?.searchParams
3593
- );
3653
+ const { url, pathConfig: pathConfig2 } = this.buildUrl(path, fetchOptions?.searchParams);
3594
3654
  const builtHeaders = await this.buildHeaders(
3595
3655
  fetchOptions,
3596
- subdomainConfig
3656
+ pathConfig2
3597
3657
  );
3598
3658
  const inputHeaders = new Headers(fetchOptions?.headers ?? {});
3599
3659
  const mergedHeaders = new Headers();
@@ -4140,7 +4200,7 @@ function getCpuTime() {
4140
4200
 
4141
4201
  // package.json
4142
4202
  var package_default = {
4143
- version: "0.14.0"};
4203
+ version: "0.15.0"};
4144
4204
 
4145
4205
  // src/plugins/eventEmission/builders.ts
4146
4206
  function createBaseEvent(context = {}) {
@@ -4210,52 +4270,6 @@ function buildErrorEventWithContext(data, context = {}) {
4210
4270
  };
4211
4271
  }
4212
4272
 
4213
- // src/utils/url-utils.ts
4214
- function getZapierBaseUrl(baseUrl) {
4215
- if (!baseUrl) {
4216
- return void 0;
4217
- }
4218
- try {
4219
- const url = new URL(baseUrl);
4220
- const hostname = url.hostname;
4221
- const hostParts = hostname.split(".");
4222
- if (hostParts.length < 2) {
4223
- return void 0;
4224
- }
4225
- const hasZapierPart = hostParts.some(
4226
- (part) => part === "zapier" || part.startsWith("zapier-")
4227
- );
4228
- if (!hasZapierPart) {
4229
- return void 0;
4230
- }
4231
- const rootDomain = hostParts.slice(-2).join(".");
4232
- return `${url.protocol}//${rootDomain}`;
4233
- } catch {
4234
- return void 0;
4235
- }
4236
- }
4237
- function getTrackingBaseUrl({
4238
- trackingBaseUrl,
4239
- baseUrl
4240
- }) {
4241
- if (trackingBaseUrl) {
4242
- return trackingBaseUrl;
4243
- }
4244
- if (process.env.ZAPIER_TRACKING_BASE_URL) {
4245
- return process.env.ZAPIER_TRACKING_BASE_URL;
4246
- }
4247
- if (baseUrl) {
4248
- const zapierBaseUrl = getZapierBaseUrl(baseUrl);
4249
- if (zapierBaseUrl) {
4250
- return zapierBaseUrl;
4251
- }
4252
- }
4253
- if (baseUrl) {
4254
- return baseUrl;
4255
- }
4256
- return ZAPIER_BASE_URL;
4257
- }
4258
-
4259
4273
  // src/plugins/eventEmission/index.ts
4260
4274
  var APPLICATION_LIFECYCLE_EVENT_SUBJECT = "platform.sdk.ApplicationLifecycleEvent";
4261
4275
  var ERROR_OCCURRED_EVENT_SUBJECT = "platform.sdk.ErrorOccurredEvent";
@@ -8,7 +8,7 @@ export const getAuthenticationPlugin = ({ context }) => {
8
8
  const getAuthentication = createFunction(async function getAuthentication(options) {
9
9
  const { api } = context;
10
10
  const { authenticationId } = options;
11
- const data = await api.get(`/api/v4/authentications/${authenticationId}/`, {
11
+ const data = await api.get(`/zapier/api/v4/authentications/${authenticationId}/`, {
12
12
  customErrorHandler: ({ status }) => {
13
13
  if (status === 401) {
14
14
  return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to access authentications or may be expired. (HTTP ${status})`, { statusCode: status });
@@ -72,7 +72,7 @@ describe("getAuthentication plugin", () => {
72
72
  it("should call the correct API endpoint", async () => {
73
73
  const sdk = createTestSdk();
74
74
  await sdk.getAuthentication({ authenticationId: 123 });
75
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/123/", expect.objectContaining({
75
+ expect(mockApiClient.get).toHaveBeenCalledWith("/zapier/api/v4/authentications/123/", expect.objectContaining({
76
76
  authRequired: true,
77
77
  customErrorHandler: expect.any(Function),
78
78
  }));
@@ -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
  }),