@zapier/zapier-sdk 0.88.0 → 0.89.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.89.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e24c236: Added `listWorkflowDrafts` and `getWorkflowDraft` (experimental). `listWorkflowDrafts` is paginated (cursor + pageSize), returns a workflow's drafts most recently edited first, and filters by `status` (server default: open) or exact `slug`. `getWorkflowDraft` returns the full draft state including `source_files` and `draft_revision`, the draft's optimistic-concurrency counter. CLI commands taking a draft id present an interactive picker. All ID inputs are UUID-validated at the boundary.
8
+
9
+ ## 0.88.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 60892be: _This release contains no user-facing changes._
14
+
3
15
  ## 0.88.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -35,9 +35,11 @@
35
35
  - [`getDurableRun`](#getdurablerun--experimental)
36
36
  - [`getTriggerRun`](#gettriggerrun--experimental)
37
37
  - [`getWorkflow`](#getworkflow--experimental)
38
+ - [`getWorkflowDraft`](#getworkflowdraft--experimental)
38
39
  - [`getWorkflowRun`](#getworkflowrun--experimental)
39
40
  - [`getWorkflowVersion`](#getworkflowversion--experimental)
40
41
  - [`listDurableRuns`](#listdurableruns--experimental)
42
+ - [`listWorkflowDrafts`](#listworkflowdrafts--experimental)
41
43
  - [`listWorkflowRuns`](#listworkflowruns--experimental)
42
44
  - [`listWorkflowVersions`](#listworkflowversions--experimental)
43
45
  - [`listWorkflows`](#listworkflows--experimental)
@@ -1379,6 +1381,51 @@ const { data: workflow } = await zapier.getWorkflow({
1379
1381
  });
1380
1382
  ```
1381
1383
 
1384
+ #### `getWorkflowDraft` 🧪 _experimental_
1385
+
1386
+ Get full details of a workflow draft including source files
1387
+
1388
+ **Parameters:**
1389
+
1390
+ | Name | Type | Required | Default | Possible Values | Description |
1391
+ | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
1392
+ | `options` | `object` | ✅ | — | — | |
1393
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1394
+ | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
1395
+
1396
+ **Returns:** `Promise<WorkflowDraftItem>`
1397
+
1398
+ | Name | Type | Required | Possible Values | Description |
1399
+ | ---------------------------- | -------- | -------- | ------------------- | ---------------------------------------------------------------------------------------------------------------- |
1400
+ | `data` | `object` | ✅ | — | |
1401
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
1402
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
1403
+ | ​ ↳ `slug` | `string` | ✅ | — | Human-friendly identifier for URL routing; unique among open drafts per workflow |
1404
+ | ​ ↳ `base_version_id` | `string` | ✅ | — | Live version at draft creation or last publish rebase, or null before the workflow's first publish |
1405
+ | ​ ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
1406
+ | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
1407
+ | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
1408
+ | ​ ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
1409
+ | ​ ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
1410
+ | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
1411
+ | ​ ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
1412
+ | ​ ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
1413
+ | ​ ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
1414
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
1415
+ | ​ ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
1416
+ | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
1417
+ | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
1418
+ | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
1419
+
1420
+ **Example:**
1421
+
1422
+ ```typescript
1423
+ const { data: workflowDraft } = await zapier.getWorkflowDraft({
1424
+ workflow: "example-workflow",
1425
+ draft: "example-draft",
1426
+ });
1427
+ ```
1428
+
1382
1429
  #### `getWorkflowRun` 🧪 _experimental_
1383
1430
 
1384
1431
  Get the current state of a workflow run (a triggered execution of a deployed workflow)
@@ -1498,6 +1545,64 @@ for await (const durableRun of zapier.listDurableRuns().items()) {
1498
1545
  }
1499
1546
  ```
1500
1547
 
1548
+ #### `listWorkflowDrafts` 🧪 _experimental_
1549
+
1550
+ List drafts for a workflow, most recently edited first (open drafts by default)
1551
+
1552
+ **Parameters:**
1553
+
1554
+ | Name | Type | Required | Default | Possible Values | Description |
1555
+ | -------------- | -------- | -------- | ------- | ------------------- | ----------------------------------------------------- |
1556
+ | `options` | `object` | ✅ | — | — | |
1557
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1558
+ | ​ ↳ `status` | `string` | ❌ | — | `open`, `discarded` | Filter by draft status (server default: open) |
1559
+ | ​ ↳ `slug` | `string` | ❌ | — | — | Filter by exact slug match; returns at most one draft |
1560
+ | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of drafts per page (max 100) |
1561
+ | ​ ↳ `cursor` | `string` | ❌ | — | — | Pagination cursor |
1562
+ | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total drafts to return across all pages |
1563
+
1564
+ **Returns:** `Promise<PaginatedResult<WorkflowDraftItem>>`
1565
+
1566
+ | Name | Type | Required | Possible Values | Description |
1567
+ | ---------------------------- | ---------- | -------- | ------------------- | -------------------------------------------------------------------------------------------------- |
1568
+ | `data[]` | `object[]` | ✅ | — | |
1569
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
1570
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
1571
+ | ​ ↳ `slug` | `string` | ✅ | — | Human-friendly identifier for URL routing; unique among open drafts per workflow |
1572
+ | ​ ↳ `base_version_id` | `string` | ✅ | — | Live version at draft creation or last publish rebase, or null before the workflow's first publish |
1573
+ | ​ ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
1574
+ | ​ ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
1575
+ | ​ ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
1576
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
1577
+ | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
1578
+
1579
+ **Example:**
1580
+
1581
+ ```typescript
1582
+ // Get first page and a cursor for the second page
1583
+ const { data: workflowDrafts, nextCursor } = await zapier.listWorkflowDrafts({
1584
+ workflow: "example-workflow",
1585
+ });
1586
+
1587
+ // Or iterate over all pages
1588
+ for await (const page of zapier
1589
+ .listWorkflowDrafts({
1590
+ workflow: "example-workflow",
1591
+ })
1592
+ .pages()) {
1593
+ // Do something with each page
1594
+ }
1595
+
1596
+ // Or iterate over individual items across all pages
1597
+ for await (const workflowDraft of zapier
1598
+ .listWorkflowDrafts({
1599
+ workflow: "example-workflow",
1600
+ })
1601
+ .items()) {
1602
+ // Do something with each workflowDraft
1603
+ }
1604
+ ```
1605
+
1501
1606
  #### `listWorkflowRuns` 🧪 _experimental_
1502
1607
 
1503
1608
  List workflow runs (triggered executions) for a specific deployed workflow, newest first