@zapier/zapier-sdk 0.21.0 → 0.21.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.21.1
4
+
5
+ ### Patch Changes
6
+
7
+ - dd54c22: `request` and `fetch` now require auth and provide a more helpful error message
8
+
3
9
  ## 0.21.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -2872,7 +2872,8 @@ var requestPlugin = ({ context }) => {
2872
2872
  return await api.fetch(relayPath, {
2873
2873
  method,
2874
2874
  body,
2875
- headers
2875
+ headers,
2876
+ authRequired: true
2876
2877
  });
2877
2878
  }
2878
2879
  const requestDefinition = createFunction(
@@ -5028,7 +5029,7 @@ function getCpuTime() {
5028
5029
 
5029
5030
  // package.json
5030
5031
  var package_default = {
5031
- version: "0.21.0"};
5032
+ version: "0.21.1"};
5032
5033
 
5033
5034
  // src/plugins/eventEmission/builders.ts
5034
5035
  function createBaseEvent(context = {}) {
package/dist/index.mjs CHANGED
@@ -2850,7 +2850,8 @@ var requestPlugin = ({ context }) => {
2850
2850
  return await api.fetch(relayPath, {
2851
2851
  method,
2852
2852
  body,
2853
- headers
2853
+ headers,
2854
+ authRequired: true
2854
2855
  });
2855
2856
  }
2856
2857
  const requestDefinition = createFunction(
@@ -5006,7 +5007,7 @@ function getCpuTime() {
5006
5007
 
5007
5008
  // package.json
5008
5009
  var package_default = {
5009
- version: "0.21.0"};
5010
+ version: "0.21.1"};
5010
5011
 
5011
5012
  // src/plugins/eventEmission/builders.ts
5012
5013
  function createBaseEvent(context = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAA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B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EAAE,0BAA0B;AACrE,qBAAqB,CA4FtB,CAAC"}
@@ -58,6 +58,7 @@ export const requestPlugin = ({ context }) => {
58
58
  method,
59
59
  body,
60
60
  headers,
61
+ authRequired: true,
61
62
  });
62
63
  }
63
64
  const requestDefinition = createFunction(request, RelayRequestSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, request.name));
@@ -126,6 +126,7 @@ describe("request plugin", () => {
126
126
  "Content-Type": "application/json",
127
127
  "X-Custom-Header": "test-value",
128
128
  },
129
+ authRequired: true,
129
130
  });
130
131
  });
131
132
  it("should add relay-specific headers when provided", async () => {
@@ -145,6 +146,7 @@ describe("request plugin", () => {
145
146
  "X-Relay-Callback-Url": "https://webhook.example.com/callback",
146
147
  "X-Authentication-Template": '{"token": "{{auth.token}}"}',
147
148
  },
149
+ authRequired: true,
148
150
  });
149
151
  });
150
152
  it("should handle Headers object", async () => {
@@ -163,6 +165,7 @@ describe("request plugin", () => {
163
165
  "content-type": "application/json", // Headers constructor lowercases names
164
166
  authorization: "Bearer token", // Headers constructor lowercases names
165
167
  },
168
+ authRequired: true,
166
169
  });
167
170
  });
168
171
  it("should handle headers as array of tuples", async () => {
@@ -182,6 +185,7 @@ describe("request plugin", () => {
182
185
  "Content-Type": "application/json",
183
186
  "X-Api-Key": "secret",
184
187
  },
188
+ authRequired: true,
185
189
  });
186
190
  });
187
191
  });
@@ -206,6 +210,7 @@ describe("request plugin", () => {
206
210
  method,
207
211
  body: undefined,
208
212
  headers: {},
213
+ authRequired: true,
209
214
  });
210
215
  });
211
216
  });
@@ -218,6 +223,7 @@ describe("request plugin", () => {
218
223
  method: "GET",
219
224
  body: undefined,
220
225
  headers: {},
226
+ authRequired: true,
221
227
  });
222
228
  });
223
229
  });
@@ -236,6 +242,7 @@ describe("request plugin", () => {
236
242
  headers: {
237
243
  "Content-Type": "application/json; charset=utf-8",
238
244
  },
245
+ authRequired: true,
239
246
  });
240
247
  });
241
248
  it("should auto-set Content-Type for JSON object bodies", async () => {
@@ -252,6 +259,7 @@ describe("request plugin", () => {
252
259
  headers: {
253
260
  "Content-Type": "application/json; charset=utf-8",
254
261
  },
262
+ authRequired: true,
255
263
  });
256
264
  });
257
265
  it("should auto-set Content-Type for JSON array bodies", async () => {
@@ -268,6 +276,7 @@ describe("request plugin", () => {
268
276
  headers: {
269
277
  "Content-Type": "application/json; charset=utf-8",
270
278
  },
279
+ authRequired: true,
271
280
  });
272
281
  });
273
282
  it("should not override explicit Content-Type header", async () => {
@@ -287,6 +296,7 @@ describe("request plugin", () => {
287
296
  headers: {
288
297
  "Content-Type": "text/plain",
289
298
  },
299
+ authRequired: true,
290
300
  });
291
301
  });
292
302
  it("should not set Content-Type for non-JSON bodies", async () => {
@@ -301,9 +311,19 @@ describe("request plugin", () => {
301
311
  method: "POST",
302
312
  body,
303
313
  headers: {},
314
+ authRequired: true,
304
315
  });
305
316
  });
306
317
  });
318
+ describe("authentication", () => {
319
+ it("should set authRequired to true in API call options", async () => {
320
+ const sdk = createTestSdk();
321
+ await sdk.request({ url: "https://api.example.com/data" });
322
+ expect(mockFetch).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({
323
+ authRequired: true,
324
+ }));
325
+ });
326
+ });
307
327
  describe("response handling", () => {
308
328
  it("should return the response from api.fetch", async () => {
309
329
  const mockResponse = new Response('{"result": "success"}', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",