@zapier/zapier-sdk 0.109.1 → 0.110.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 +32 -0
- package/README.md +124 -35
- package/dist/{chunk-NTUEFDSW.cjs → chunk-BURXHBSW.cjs} +408 -105
- package/dist/{chunk-6TOSNLPZ.mjs → chunk-IRHF55YK.mjs} +408 -106
- package/dist/experimental.cjs +519 -395
- package/dist/experimental.d.mts +514 -13
- package/dist/experimental.d.ts +514 -13
- package/dist/experimental.mjs +139 -19
- package/dist/{index-Cum18GPG.d.mts → index-ubhG9-NU.d.mts} +673 -95
- package/dist/{index-Cum18GPG.d.ts → index-ubhG9-NU.d.ts} +673 -95
- package/dist/index.cjs +283 -279
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.110.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 58bd3f7: `listApps` and `getApp` now surface API errors as they are returned:
|
|
8
|
+
- Status codes and messages are preserved. Previously, some 4xx messages were
|
|
9
|
+
replaced with generic text and some 5xx responses were reported as generic
|
|
10
|
+
502 errors.
|
|
11
|
+
- A malformed response now throws `ZapierValidationError` instead of a generic
|
|
12
|
+
`TypeError`.
|
|
13
|
+
|
|
14
|
+
## 0.110.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- f8637ed: Added `runWorkflowDraft` (experimental), exposed in the CLI as `run-workflow-draft`. Launches a draft test run: executes a workflow draft's current source without publishing it.
|
|
19
|
+
- Pass `workflow`, `draft`, and `draftRevision` (from the last read of the draft). The run is rejected with a conflict error if the draft changed since. In interactive CLI use, `draftRevision` resolves via a picker that reads the draft's current revision, so it never has to be typed by hand.
|
|
20
|
+
- Optionally pass `input` for workflows that take input.
|
|
21
|
+
- Draft runs are free (not task-charged) and rate limited per user.
|
|
22
|
+
- The run is accepted asynchronously and returned with `kind: "draft"` and status `initialized`; follow it with `getWorkflowRun`, or list draft runs via `listWorkflowRuns` with `kind: "draft"`.
|
|
23
|
+
|
|
24
|
+
- f8637ed: Workflow runs now carry a `kind` discriminator (`"live"` or `"draft"`), and `listWorkflowRuns` (CLI: `list-workflow-runs`) accepts a `kind` filter — omit it for both kinds interleaved by recency. The `getWorkflowRun` and `listWorkflowRuns` response schemas are discriminated unions on `kind`, so TypeScript narrows kind-specific fields after a `run.kind === "draft"` check, and each kind carries only its own fields:
|
|
25
|
+
|
|
26
|
+
| Kind | Fields |
|
|
27
|
+
| ------- | ----------------------------------------------------------- |
|
|
28
|
+
| `live` | `trigger_id`, `workflow_version_id` (absent on draft runs) |
|
|
29
|
+
| `draft` | `workflow_draft_id`, `draft_revision` (absent on live runs) |
|
|
30
|
+
|
|
31
|
+
This also fixes `listWorkflowRuns` rejecting responses for workflows that have draft runs: draft rows omit the live-only fields, which the previous response schema treated as required.
|
|
32
|
+
|
|
33
|
+
`getWorkflowRun` responses now also include `workflow_id` (always returned by the API, previously stripped by the SDK's response schema).
|
|
34
|
+
|
|
3
35
|
## 0.109.1
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
- [`publishWorkflowDraft`](#publishworkflowdraft--experimental)
|
|
56
56
|
- [`publishWorkflowVersion`](#publishworkflowversion--experimental)
|
|
57
57
|
- [`runDurable`](#rundurable--experimental)
|
|
58
|
+
- [`runWorkflowDraft`](#runworkflowdraft--experimental)
|
|
58
59
|
- [`triggerWorkflow`](#triggerworkflow--experimental)
|
|
59
60
|
- [`updateAgenticManagementConfig`](#updateagenticmanagementconfig--experimental)
|
|
60
61
|
- [`updateAgenticManagementIntent`](#updateagenticmanagementintent--experimental)
|
|
@@ -1738,7 +1739,7 @@ const { data: workflowDraft } = await zapier.getWorkflowDraft({
|
|
|
1738
1739
|
|
|
1739
1740
|
#### `getWorkflowRun` 🧪 _experimental_
|
|
1740
1741
|
|
|
1741
|
-
Get the current state of a workflow run
|
|
1742
|
+
Get the current state of a workflow run — a live run of a published workflow version, or a draft run launched via `runWorkflowDraft` (the `kind` field says which)
|
|
1742
1743
|
|
|
1743
1744
|
**Parameters:**
|
|
1744
1745
|
|
|
@@ -1750,19 +1751,43 @@ Get the current state of a workflow run (a triggered execution of a deployed wor
|
|
|
1750
1751
|
|
|
1751
1752
|
**Returns:** `Promise<WorkflowRunItem>`
|
|
1752
1753
|
|
|
1753
|
-
| Name
|
|
1754
|
-
|
|
|
1755
|
-
| `data`
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
|
1760
|
-
|
|
|
1761
|
-
|
|
|
1762
|
-
|
|
|
1763
|
-
|
|
|
1764
|
-
|
|
|
1765
|
-
|
|
|
1754
|
+
| Name | Type | Required | Possible Values | Description |
|
|
1755
|
+
| ------ | -------- | -------- | --------------- | -------------------------------------------------- |
|
|
1756
|
+
| `data` | `object` | ✅ | — | One of the variants below, distinguished by `kind` |
|
|
1757
|
+
|
|
1758
|
+
**When `kind` is `"live"`:**
|
|
1759
|
+
|
|
1760
|
+
| Name | Type | Required | Possible Values | Description |
|
|
1761
|
+
| --------------------- | --------- | -------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
1762
|
+
| `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
|
|
1763
|
+
| `workflow_id` | `string` | ✅ | — | The workflow this run belongs to |
|
|
1764
|
+
| `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
|
|
1765
|
+
| `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
|
|
1766
|
+
| `input` | `unknown` | ✅ | — | Input passed to the run |
|
|
1767
|
+
| `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
|
|
1768
|
+
| `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
|
|
1769
|
+
| `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
|
|
1770
|
+
| `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
|
|
1771
|
+
| `kind` | `string` | ✅ | `live` | A run of a published workflow version. |
|
|
1772
|
+
| `trigger_id` | `string` | ✅ | — | ID of the trigger that fired this run. Null for runs created without a trigger. |
|
|
1773
|
+
| `workflow_version_id` | `string` | ✅ | — | Workflow version the run is bound to. Null in rare edge cases. |
|
|
1774
|
+
|
|
1775
|
+
**When `kind` is `"draft"`:**
|
|
1776
|
+
|
|
1777
|
+
| Name | Type | Required | Possible Values | Description |
|
|
1778
|
+
| ------------------- | --------- | -------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1779
|
+
| `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
|
|
1780
|
+
| `workflow_id` | `string` | ✅ | — | The workflow this run belongs to |
|
|
1781
|
+
| `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
|
|
1782
|
+
| `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
|
|
1783
|
+
| `input` | `unknown` | ✅ | — | Input passed to the run |
|
|
1784
|
+
| `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
|
|
1785
|
+
| `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
|
|
1786
|
+
| `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
|
|
1787
|
+
| `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
|
|
1788
|
+
| `kind` | `string` | ✅ | `draft` | A run launched from a workflow draft via `runWorkflowDraft`. |
|
|
1789
|
+
| `workflow_draft_id` | `string` | ✅ | — | The draft this run was launched from. Null once that draft has been deleted (the run outlives its draft). |
|
|
1790
|
+
| `draft_revision` | `number` | ✅ | — | The draft's revision at the moment this run was created. Compare against the draft's current `draft_revision` to tell whether the run still reflects the draft as it now stands. |
|
|
1766
1791
|
|
|
1767
1792
|
**Example:**
|
|
1768
1793
|
|
|
@@ -1991,33 +2016,55 @@ for await (const workflowDraft of zapier
|
|
|
1991
2016
|
|
|
1992
2017
|
#### `listWorkflowRuns` 🧪 _experimental_
|
|
1993
2018
|
|
|
1994
|
-
List workflow runs
|
|
2019
|
+
List workflow runs for a specific workflow, newest first. Live runs (of published versions) and draft runs share the one list; pass `kind` to narrow it to one.
|
|
1995
2020
|
|
|
1996
2021
|
**Parameters:**
|
|
1997
2022
|
|
|
1998
|
-
| Name | Type | Required | Default | Possible Values | Description
|
|
1999
|
-
| -------------- | -------- | -------- | ------- | --------------- |
|
|
2000
|
-
| `options` | `object` | ✅ | — | — |
|
|
2001
|
-
| ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID
|
|
2002
|
-
| ↳ `pageSize` | `number` | ❌ | — | — | Number of runs per page (max 100)
|
|
2003
|
-
| ↳ `
|
|
2004
|
-
| ↳ `
|
|
2023
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
2024
|
+
| -------------- | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------- |
|
|
2025
|
+
| `options` | `object` | ✅ | — | — | |
|
|
2026
|
+
| ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
|
|
2027
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of runs per page (max 100) |
|
|
2028
|
+
| ↳ `kind` | `string` | ❌ | — | `live`, `draft` | Return only runs of this kind. Omit for both, interleaved by recency. |
|
|
2029
|
+
| ↳ `cursor` | `string` | ❌ | — | — | Pagination cursor |
|
|
2030
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total runs to return across all pages |
|
|
2005
2031
|
|
|
2006
2032
|
**Returns:** `Promise<PaginatedResult<WorkflowRunItem>>`
|
|
2007
2033
|
|
|
2008
|
-
| Name
|
|
2009
|
-
|
|
|
2010
|
-
| `data[]`
|
|
2011
|
-
|
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
|
2016
|
-
|
|
|
2017
|
-
|
|
|
2018
|
-
|
|
|
2019
|
-
|
|
|
2020
|
-
| `
|
|
2034
|
+
| Name | Type | Required | Possible Values | Description |
|
|
2035
|
+
| ------------ | ---------- | -------- | --------------- | -------------------------------------------------------------- |
|
|
2036
|
+
| `data[]` | `object[]` | ✅ | — | One of the variants below, distinguished by `kind` |
|
|
2037
|
+
| `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
|
|
2038
|
+
|
|
2039
|
+
**When `kind` is `"live"`:**
|
|
2040
|
+
|
|
2041
|
+
| Name | Type | Required | Possible Values | Description |
|
|
2042
|
+
| --------------------- | --------- | -------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
2043
|
+
| `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
|
|
2044
|
+
| `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
|
|
2045
|
+
| `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
|
|
2046
|
+
| `input` | `unknown` | ✅ | — | Input passed to the run |
|
|
2047
|
+
| `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
|
|
2048
|
+
| `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
|
|
2049
|
+
| `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
|
|
2050
|
+
| `kind` | `string` | ✅ | `live` | A run of a published workflow version. |
|
|
2051
|
+
| `trigger_id` | `string` | ✅ | — | ID of the trigger that fired this run. Null for runs created without a trigger. |
|
|
2052
|
+
| `workflow_version_id` | `string` | ✅ | — | Workflow version the run is bound to. Null in rare edge cases. |
|
|
2053
|
+
|
|
2054
|
+
**When `kind` is `"draft"`:**
|
|
2055
|
+
|
|
2056
|
+
| Name | Type | Required | Possible Values | Description |
|
|
2057
|
+
| ------------------- | --------- | -------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
2058
|
+
| `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
|
|
2059
|
+
| `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
|
|
2060
|
+
| `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
|
|
2061
|
+
| `input` | `unknown` | ✅ | — | Input passed to the run |
|
|
2062
|
+
| `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
|
|
2063
|
+
| `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
|
|
2064
|
+
| `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
|
|
2065
|
+
| `kind` | `string` | ✅ | `draft` | A run launched from a workflow draft via `runWorkflowDraft`. |
|
|
2066
|
+
| `workflow_draft_id` | `string` | ✅ | — | The draft this run was launched from. Null once that draft has been deleted (the run outlives its draft). |
|
|
2067
|
+
| `draft_revision` | `number` | ✅ | — | The draft's revision at the moment this run was created. |
|
|
2021
2068
|
|
|
2022
2069
|
**Example:**
|
|
2023
2070
|
|
|
@@ -2310,6 +2357,48 @@ const { data: durableRun } = await zapier.runDurable({
|
|
|
2310
2357
|
});
|
|
2311
2358
|
```
|
|
2312
2359
|
|
|
2360
|
+
#### `runWorkflowDraft` 🧪 _experimental_
|
|
2361
|
+
|
|
2362
|
+
Launch a draft test run: execute the draft's current source without publishing it. The draft's payload is snapshotted onto the run at creation, so later edits (or discarding the draft) never change what the run executed. Draft runs are free (not task-charged) and rate limited per user. The run is accepted asynchronously — it comes back `initialized`; follow it with `getWorkflowRun`, or list it via `listWorkflowRuns` with `kind: "draft"`.
|
|
2363
|
+
|
|
2364
|
+
**Parameters:**
|
|
2365
|
+
|
|
2366
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
2367
|
+
| ------------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
2368
|
+
| `options` | `object` | ✅ | — | — | |
|
|
2369
|
+
| ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
|
|
2370
|
+
| ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
|
|
2371
|
+
| ↳ `draftRevision` | `number` | ✅ | — | — | The draft revision you intend to run, from the last read of the draft. The server rejects the run with a conflict if the draft has changed since. The upstream API treats this check as optional; the SDK requires it so a test run can never silently execute source the caller has already replaced. |
|
|
2372
|
+
| ↳ `input` | `unknown` | ❌ | — | — | Input data passed to the workflow. Accepts any JSON value, or its JSON-string encoding. Omit for a workflow that takes no input. |
|
|
2373
|
+
|
|
2374
|
+
**Returns:** `Promise<RunWorkflowDraftResponse>`
|
|
2375
|
+
|
|
2376
|
+
| Name | Type | Required | Possible Values | Description |
|
|
2377
|
+
| ----------------------- | --------- | -------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
2378
|
+
| `data` | `object` | ✅ | — | |
|
|
2379
|
+
| ↳ `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
|
|
2380
|
+
| ↳ `kind` | `string` | ✅ | `draft` | A run launched from a workflow draft. |
|
|
2381
|
+
| ↳ `workflow_id` | `string` | ✅ | — | The workflow this run belongs to |
|
|
2382
|
+
| ↳ `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Usually still null in this response — the run is accepted and launched in the background. |
|
|
2383
|
+
| ↳ `workflow_draft_id` | `string` | ✅ | — | The draft this run was launched from. Becomes null once that draft is deleted — the run outlives its draft. |
|
|
2384
|
+
| ↳ `draft_revision` | `number` | ✅ | — | The draft's revision at the moment this run was created. |
|
|
2385
|
+
| ↳ `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
|
|
2386
|
+
| ↳ `input` | `unknown` | ✅ | — | Input passed to the run |
|
|
2387
|
+
| ↳ `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
|
|
2388
|
+
| ↳ `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
|
|
2389
|
+
| ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
|
|
2390
|
+
| ↳ `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
|
|
2391
|
+
|
|
2392
|
+
**Example:**
|
|
2393
|
+
|
|
2394
|
+
```typescript
|
|
2395
|
+
const { data: workflowRun } = await zapier.runWorkflowDraft({
|
|
2396
|
+
workflow: "example-workflow",
|
|
2397
|
+
draft: "example-draft",
|
|
2398
|
+
draftRevision: 100,
|
|
2399
|
+
});
|
|
2400
|
+
```
|
|
2401
|
+
|
|
2313
2402
|
#### `triggerWorkflow` 🧪 _experimental_
|
|
2314
2403
|
|
|
2315
2404
|
Look up a workflow's trigger URL and fire it manually, as the authenticated account.
|