@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.
- package/CHANGELOG.md +12 -0
- package/README.md +23 -9
- package/dist/api/schemas.d.ts +2 -2
- package/dist/index.cjs +276 -204
- package/dist/index.d.mts +203 -86
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +270 -205
- package/dist/plugins/createClientCredentials/schemas.d.ts +0 -3
- package/dist/plugins/createClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/createClientCredentials/schemas.js +0 -2
- package/dist/plugins/deleteClientCredentials/schemas.d.ts +0 -3
- package/dist/plugins/deleteClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/schemas.js +0 -2
- package/dist/plugins/fetch/index.d.ts +0 -3
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +59 -53
- package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/index.js +0 -1
- package/dist/plugins/findFirstConnection/schemas.d.ts +1 -1
- package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/schemas.js +0 -1
- package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.js +0 -1
- package/dist/plugins/findUniqueConnection/schemas.d.ts +1 -1
- package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/schemas.js +0 -1
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +1 -3
- package/dist/plugins/getAction/schemas.d.ts +0 -3
- package/dist/plugins/getAction/schemas.d.ts.map +1 -1
- package/dist/plugins/getAction/schemas.js +0 -2
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +0 -1
- package/dist/plugins/listActions/schemas.d.ts +0 -3
- package/dist/plugins/listActions/schemas.d.ts.map +1 -1
- package/dist/plugins/listActions/schemas.js +0 -2
- package/dist/plugins/listApps/schemas.d.ts +0 -3
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/schemas.js +0 -2
- package/dist/plugins/listClientCredentials/schemas.d.ts +0 -3
- package/dist/plugins/listClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/schemas.js +0 -2
- package/dist/plugins/listConnections/schemas.d.ts +1 -4
- package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
- package/dist/plugins/listConnections/schemas.js +0 -2
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +0 -1
- package/dist/plugins/request/schemas.d.ts +0 -6
- package/dist/plugins/request/schemas.d.ts.map +1 -1
- package/dist/plugins/request/schemas.js +0 -2
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +0 -1
- package/dist/schemas/Action.d.ts +2 -2
- package/dist/types/credentials.d.ts +137 -17
- package/dist/types/credentials.d.ts.map +1 -1
- package/dist/types/credentials.js +80 -0
- package/dist/types/meta.d.ts +9 -0
- package/dist/types/meta.d.ts.map +1 -0
- package/dist/types/meta.js +3 -0
- package/dist/types/sdk.d.ts +61 -35
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +55 -1
- package/dist/utils/function-utils.d.ts +1 -14
- package/dist/utils/function-utils.d.ts.map +1 -1
- package/dist/utils/function-utils.js +115 -123
- package/dist/utils/function-utils.test.js +79 -1
- package/dist/utils/telemetry-context.d.ts +3 -0
- package/dist/utils/telemetry-context.d.ts.map +1 -0
- package/dist/utils/telemetry-context.js +23 -0
- package/dist/utils/telemetry-context.test.d.ts +2 -0
- package/dist/utils/telemetry-context.test.d.ts.map +1 -0
- package/dist/utils/telemetry-context.test.js +92 -0
- 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
|
|
876
|
-
| ---------------- |
|
|
877
|
-
| `url` | `string, custom`
|
|
878
|
-
| `init` | `object`
|
|
879
|
-
| ↳ `method` | `string`
|
|
880
|
-
| ↳ `headers` | `object`
|
|
881
|
-
| ↳ `body` | `string, custom,
|
|
882
|
-
| ↳ `connectionId` | `string, number`
|
|
883
|
-
| ↳ `callbackUrl` | `string`
|
|
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
|
|
package/dist/api/schemas.d.ts
CHANGED
|
@@ -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";
|