@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 +6 -0
- package/dist/api/client.js +1 -1
- package/dist/api/client.test.js +9 -0
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/api/client.js
CHANGED
|
@@ -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}`;
|
package/dist/api/client.test.js
CHANGED
|
@@ -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.
|
|
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.
|
|
5484
|
+
version: "0.32.2"};
|
|
5485
5485
|
|
|
5486
5486
|
// src/plugins/eventEmission/builders.ts
|
|
5487
5487
|
function createBaseEvent(context = {}) {
|