@zapier/zapier-sdk 0.32.1 → 0.32.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.32.2
4
+
5
+ ### Patch Changes
6
+
7
+ - a6dec83: Fix base URL with trailing slash bypassing sdkapi.
8
+
3
9
  ## 0.32.1
4
10
 
5
11
  ### Patch Changes
@@ -373,7 +373,7 @@ class ZapierApiClient {
373
373
  // Let's remain compatible with a base URL that is set to a Zapier-inferred
374
374
  // domain, rather than requiring the base URL to go to our proxy. Later, the
375
375
  // proxy will be removed, so this should make that transition easier.
376
- if (zapierBaseUrl === this.options.baseUrl) {
376
+ if (zapierBaseUrl === this.options.baseUrl.replace(/\/$/, "")) {
377
377
  // If baseUrl is already the Zapier base URL, use sdkapi subdomain.
378
378
  const originalBaseUrl = new URL(this.options.baseUrl);
379
379
  const finalBaseUrl = `https://sdkapi.${originalBaseUrl.hostname}`;
@@ -219,6 +219,15 @@ describe("ApiClient", () => {
219
219
  await client.get("/relay");
220
220
  expect(mockFetch).toHaveBeenCalledWith("http://localhost:3000/api/v0/sdk/relay/", expect.any(Object));
221
221
  });
222
+ it("should use sdkapi subdomain when Zapier base URL has trailing slash", async () => {
223
+ const client = createZapierApi({
224
+ baseUrl: "https://zapier-staging.com/",
225
+ credentials: "test-token",
226
+ debug: false,
227
+ });
228
+ await client.get("/zapier/api/v4/profile/");
229
+ expect(mockFetch).toHaveBeenCalledWith("https://sdkapi.zapier-staging.com/api/v0/sdk/zapier/api/v4/profile/", expect.any(Object));
230
+ });
222
231
  it("should preserve base URL path for localhost with path component", async () => {
223
232
  const client = createZapierApi({
224
233
  baseUrl: "http://localhost:3000/a/b/c",
package/dist/index.cjs CHANGED
@@ -4701,7 +4701,7 @@ var ZapierApiClient = class {
4701
4701
  finalPath = `${config.pathPrefix}${pathWithoutPrefix}`;
4702
4702
  }
4703
4703
  const zapierBaseUrl = getZapierBaseUrl(this.options.baseUrl);
4704
- if (zapierBaseUrl === this.options.baseUrl) {
4704
+ if (zapierBaseUrl === this.options.baseUrl.replace(/\/$/, "")) {
4705
4705
  const originalBaseUrl = new URL(this.options.baseUrl);
4706
4706
  const finalBaseUrl = `https://sdkapi.${originalBaseUrl.hostname}`;
4707
4707
  return {
@@ -5503,7 +5503,7 @@ function getCpuTime() {
5503
5503
 
5504
5504
  // package.json
5505
5505
  var package_default = {
5506
- version: "0.32.1"};
5506
+ version: "0.32.2"};
5507
5507
 
5508
5508
  // src/plugins/eventEmission/builders.ts
5509
5509
  function createBaseEvent(context = {}) {
package/dist/index.mjs CHANGED
@@ -4679,7 +4679,7 @@ var ZapierApiClient = class {
4679
4679
  finalPath = `${config.pathPrefix}${pathWithoutPrefix}`;
4680
4680
  }
4681
4681
  const zapierBaseUrl = getZapierBaseUrl(this.options.baseUrl);
4682
- if (zapierBaseUrl === this.options.baseUrl) {
4682
+ if (zapierBaseUrl === this.options.baseUrl.replace(/\/$/, "")) {
4683
4683
  const originalBaseUrl = new URL(this.options.baseUrl);
4684
4684
  const finalBaseUrl = `https://sdkapi.${originalBaseUrl.hostname}`;
4685
4685
  return {
@@ -5481,7 +5481,7 @@ function getCpuTime() {
5481
5481
 
5482
5482
  // package.json
5483
5483
  var package_default = {
5484
- version: "0.32.1"};
5484
+ version: "0.32.2"};
5485
5485
 
5486
5486
  // src/plugins/eventEmission/builders.ts
5487
5487
  function createBaseEvent(context = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.32.1",
3
+ "version": "0.32.2",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",