@zapier/zapier-sdk 0.29.0 → 0.31.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +23 -9
  3. package/dist/api/schemas.d.ts +2 -2
  4. package/dist/index.cjs +276 -204
  5. package/dist/index.d.mts +203 -86
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -0
  9. package/dist/index.mjs +270 -205
  10. package/dist/plugins/createClientCredentials/schemas.d.ts +0 -3
  11. package/dist/plugins/createClientCredentials/schemas.d.ts.map +1 -1
  12. package/dist/plugins/createClientCredentials/schemas.js +0 -2
  13. package/dist/plugins/deleteClientCredentials/schemas.d.ts +0 -3
  14. package/dist/plugins/deleteClientCredentials/schemas.d.ts.map +1 -1
  15. package/dist/plugins/deleteClientCredentials/schemas.js +0 -2
  16. package/dist/plugins/fetch/index.d.ts +0 -3
  17. package/dist/plugins/fetch/index.d.ts.map +1 -1
  18. package/dist/plugins/fetch/index.js +59 -53
  19. package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
  20. package/dist/plugins/findFirstConnection/index.js +0 -1
  21. package/dist/plugins/findFirstConnection/schemas.d.ts +1 -1
  22. package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
  23. package/dist/plugins/findFirstConnection/schemas.js +0 -1
  24. package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
  25. package/dist/plugins/findUniqueConnection/index.js +0 -1
  26. package/dist/plugins/findUniqueConnection/schemas.d.ts +1 -1
  27. package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
  28. package/dist/plugins/findUniqueConnection/schemas.js +0 -1
  29. package/dist/plugins/getAction/index.d.ts.map +1 -1
  30. package/dist/plugins/getAction/index.js +1 -3
  31. package/dist/plugins/getAction/schemas.d.ts +0 -3
  32. package/dist/plugins/getAction/schemas.d.ts.map +1 -1
  33. package/dist/plugins/getAction/schemas.js +0 -2
  34. package/dist/plugins/getApp/index.d.ts.map +1 -1
  35. package/dist/plugins/getApp/index.js +0 -1
  36. package/dist/plugins/listActions/schemas.d.ts +0 -3
  37. package/dist/plugins/listActions/schemas.d.ts.map +1 -1
  38. package/dist/plugins/listActions/schemas.js +0 -2
  39. package/dist/plugins/listApps/schemas.d.ts +0 -3
  40. package/dist/plugins/listApps/schemas.d.ts.map +1 -1
  41. package/dist/plugins/listApps/schemas.js +0 -2
  42. package/dist/plugins/listClientCredentials/schemas.d.ts +0 -3
  43. package/dist/plugins/listClientCredentials/schemas.d.ts.map +1 -1
  44. package/dist/plugins/listClientCredentials/schemas.js +0 -2
  45. package/dist/plugins/listConnections/schemas.d.ts +1 -4
  46. package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
  47. package/dist/plugins/listConnections/schemas.js +0 -2
  48. package/dist/plugins/request/index.d.ts.map +1 -1
  49. package/dist/plugins/request/index.js +0 -1
  50. package/dist/plugins/request/schemas.d.ts +0 -6
  51. package/dist/plugins/request/schemas.d.ts.map +1 -1
  52. package/dist/plugins/request/schemas.js +0 -2
  53. package/dist/plugins/runAction/index.d.ts.map +1 -1
  54. package/dist/plugins/runAction/index.js +0 -1
  55. package/dist/schemas/Action.d.ts +2 -2
  56. package/dist/types/credentials.d.ts +137 -17
  57. package/dist/types/credentials.d.ts.map +1 -1
  58. package/dist/types/credentials.js +80 -0
  59. package/dist/types/meta.d.ts +9 -0
  60. package/dist/types/meta.d.ts.map +1 -0
  61. package/dist/types/meta.js +3 -0
  62. package/dist/types/sdk.d.ts +61 -35
  63. package/dist/types/sdk.d.ts.map +1 -1
  64. package/dist/types/sdk.js +55 -1
  65. package/dist/utils/function-utils.d.ts +1 -14
  66. package/dist/utils/function-utils.d.ts.map +1 -1
  67. package/dist/utils/function-utils.js +115 -123
  68. package/dist/utils/function-utils.test.js +79 -1
  69. package/dist/utils/telemetry-context.d.ts +3 -0
  70. package/dist/utils/telemetry-context.d.ts.map +1 -0
  71. package/dist/utils/telemetry-context.js +23 -0
  72. package/dist/utils/telemetry-context.test.d.ts +2 -0
  73. package/dist/utils/telemetry-context.test.d.ts.map +1 -0
  74. package/dist/utils/telemetry-context.test.js +92 -0
  75. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.31.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4a874c6: Add Zod schema for base SDK options, autodoc generation for SDK factory options and CLI base command options
8
+
9
+ ## 0.30.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 0055854: Remove internal `_telemetry` property from all method option types
14
+
3
15
  ## 0.29.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
  - [Documentation](#documentation)
7
7
  - [Installation](#installation)
8
8
  - [Quick Start](#quick-start)
9
+ - [Factory](#factory)
9
10
  - [Available Functions](#available-functions)
10
11
  - [Accounts](#accounts)
11
12
  - [`getProfile`](#getprofile)
@@ -289,6 +290,19 @@ const emojiData = await emojiResponse.json();
289
290
  console.log(emojiData.emoji);
290
291
  ```
291
292
 
293
+ ## Factory
294
+
295
+ The `createZapierSdk(...)` factory function is the main entry point for the SDK. It provides methods for managing connections, listing apps, running actions, and more.
296
+
297
+ | Name | Type | Required | Default | Possible Values | Description |
298
+ | ------------------------ | -------------------------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
299
+ | `credentials` | `string, object, function` | ❌ | — | — | Authentication credentials. Can be a string (token or API key), a client credentials object ({ clientId, clientSecret }), a PKCE object ({ clientId }), or a function returning any of those. |
300
+ | `debug` | `boolean` | ❌ | — | — | Enable debug logging. |
301
+ | `baseUrl` | `string` | ❌ | — | — | Base URL for Zapier API endpoints. |
302
+ | `trackingBaseUrl` | `string` | ❌ | — | — | Base URL for Zapier tracking endpoints. |
303
+ | `maxNetworkRetries` | `number` | ❌ | — | — | Max retries for rate-limited requests (default: 3). |
304
+ | `maxNetworkRetryDelayMs` | `number` | ❌ | — | — | Max delay in ms to wait for retry (default: 60000). |
305
+
292
306
  ## Available Functions
293
307
 
294
308
  ### Accounts
@@ -872,15 +886,15 @@ Make authenticated HTTP requests to any API through Zapier. Pass a connectionId
872
886
 
873
887
  **Parameters:**
874
888
 
875
- | Name | Type | Required | Default | Possible Values | Description |
876
- | ---------------- | -------------------------------- | -------- | ------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
877
- | `url` | `string, custom` | ✅ | — | — | The full URL of the API endpoint to call (proxied through Zapier's Relay service) |
878
- | `init` | `object` | ❌ | — | — | Request options including method, headers, body, and authentication |
879
- | ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method for the request (defaults to GET) |
880
- | ↳ `headers` | `object` | ❌ | — | — | HTTP headers to include in the request |
881
- | ↳ `body` | `string, custom, custom, record` | ❌ | — | — | Request body — plain objects and JSON strings are auto-detected and Content-Type is set accordingly |
882
- | ↳ `connectionId` | `string, number` | ❌ | — | — | Connection ID to use for this action |
883
- | ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
889
+ | Name | Type | Required | Default | Possible Values | Description |
890
+ | ---------------- | ------------------------ | -------- | ------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
891
+ | `url` | `string, custom` | ✅ | — | — | The full URL of the API endpoint to call (proxied through Zapier's Relay service) |
892
+ | `init` | `object` | ❌ | — | — | Request options including method, headers, body, and authentication |
893
+ | ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method for the request (defaults to GET) |
894
+ | ↳ `headers` | `object` | ❌ | — | — | HTTP headers to include in the request |
895
+ | ↳ `body` | `string, custom, record` | ❌ | — | — | Request body — plain objects and JSON strings are auto-detected and Content-Type is set accordingly |
896
+ | ↳ `connectionId` | `string, number` | ❌ | — | — | Connection ID to use for this action |
897
+ | ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
884
898
 
885
899
  **Returns:** `Promise<Response>`
886
900
 
@@ -42,8 +42,8 @@ export declare const NeedSchema: z.ZodObject<{
42
42
  type: z.ZodOptional<z.ZodEnum<{
43
43
  string: "string";
44
44
  boolean: "boolean";
45
- filter: "filter";
46
45
  file: "file";
46
+ filter: "filter";
47
47
  integer: "integer";
48
48
  text: "text";
49
49
  datetime: "datetime";
@@ -286,8 +286,8 @@ export declare const NeedsResponseSchema: z.ZodObject<{
286
286
  type: z.ZodOptional<z.ZodEnum<{
287
287
  string: "string";
288
288
  boolean: "boolean";
289
- filter: "filter";
290
289
  file: "file";
290
+ filter: "filter";
291
291
  integer: "integer";
292
292
  text: "text";
293
293
  datetime: "datetime";