@zapier/zapier-sdk 0.100.0 → 0.101.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,11 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.101.0
4
+
5
+ ### Minor Changes
6
+
7
+ - cfc7020: Added `importWorkflow` (experimental), exposed in the CLI as `import-workflow`. Converts an existing Zap into a durable workflow: pass `zap` (the Zap ID) and optionally `name` and `private`. Returns `{ workflow, draft, issues }`. The workflow is created disabled with no published version; publish the draft to make it live, once any blocking `issues` are resolved. The original Zap is untouched.
8
+
3
9
  ## 0.100.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -42,6 +42,7 @@
42
42
  - [`getWorkflowDraft`](#getworkflowdraft--experimental)
43
43
  - [`getWorkflowRun`](#getworkflowrun--experimental)
44
44
  - [`getWorkflowVersion`](#getworkflowversion--experimental)
45
+ - [`importWorkflow`](#importworkflow--experimental)
45
46
  - [`listDurableRuns`](#listdurableruns--experimental)
46
47
  - [`listWorkflowDrafts`](#listworkflowdrafts--experimental)
47
48
  - [`listWorkflowRuns`](#listworkflowruns--experimental)
@@ -1671,6 +1672,81 @@ const { data: workflowVersion } = await zapier.getWorkflowVersion({
1671
1672
  });
1672
1673
  ```
1673
1674
 
1675
+ #### `importWorkflow` 🧪 _experimental_
1676
+
1677
+ Convert an existing Zap into a durable workflow. Transforms the Zap's latest published version (falling back to its draft only when the Zap has never been published) and puts the resulting source in an open draft. The workflow is created disabled with no published version, so publish the draft to make it live. The original Zap is untouched and keeps running.
1678
+
1679
+ **Parameters:**
1680
+
1681
+ | Name | Type | Required | Default | Possible Values | Description |
1682
+ | ------------- | --------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
1683
+ | `options` | `object` | ✅ | — | — | |
1684
+ | ​ ↳ `zap` | `string` | ✅ | — | — | ID of the Zap to import. Must be owned by the requesting user. Recorded on the created workflow as source_zap_id. |
1685
+ | ​ ↳ `name` | `string` | ❌ | — | — | Name for the created workflow. Defaults to a kebab-cased form of the Zap's title, or "imported-workflow" when the Zap has no title. |
1686
+ | ​ ↳ `private` | `boolean` | ❌ | — | — | Restrict the created workflow to the creating user. Defaults to false, which makes it account-visible. |
1687
+
1688
+ **Returns:** `Promise<ImportWorkflowResponse>`
1689
+
1690
+ | Name | Type | Required | Possible Values | Description |
1691
+ | ------------------------------ | ---------- | -------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1692
+ | `data` | `object` | ✅ | — | |
1693
+ | ​ ↳ `workflow` | `object` | ✅ | — | The created workflow. Disabled, with no published version, and source_zap_id set to the imported Zap. |
1694
+ | ​   ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
1695
+ | ​   ↳ `name` | `string` | ✅ | — | Workflow name |
1696
+ | ​   ↳ `description` | `string` | ❌ | — | Optional workflow description (null if unset) |
1697
+ | ​   ↳ `trigger_url` | `string` | ✅ | — | Public URL that fires this workflow when POSTed to. Embeds a trigger token in the path — treat as sensitive. Requests must also be authenticated as the account. |
1698
+ | ​   ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow accepts triggers. An import always lands disabled. |
1699
+ | ​   ↳ `disabled_reason` | `string` | ❌ | `trigger_claim_failed` | Why the workflow is off, when system-disabled. |
1700
+ | ​   ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
1701
+ | ​   ↳ `source_zap_id` | `string` | ❌ | — | The Zap this workflow was imported from. |
1702
+ | ​   ↳ `created_by_user_id` | `string` | ✅ | — | |
1703
+ | ​   ↳ `updated_by_user_id` | `string` | ❌ | — | |
1704
+ | ​   ↳ `current_version_id` | `string` | ❌ | — | Null on a fresh import, which has no published version yet. |
1705
+ | ​   ↳ `triggers[]` | `object[]` | ✅ | — | Empty on a fresh import, which has no published version yet. |
1706
+ | ​     ↳ `selected_api` | `string` | ✅ | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI') |
1707
+ | ​     ↳ `action` | `string` | ✅ | — | Trigger action key (e.g. 'new_row') |
1708
+ | ​     ↳ `authentication_id` | `string` | ❌ | — | Connection ID for the trigger source. Null for no-auth triggers. |
1709
+ | ​     ↳ `params` | `object` | ❌ | — | Trigger parameters as a JSON object |
1710
+ | ​     ↳ `status` | `string` | ✅ | `unclaimed`, `pending`, `active`, `releasing`, `released`, `failed` | Live trigger claim status — whether the trigger is currently subscribed to its source. |
1711
+ | ​     ↳ `error` | `string` | ❌ | — | Failure reason for the latest claim. Present (non-null) only when status is 'failed'. |
1712
+ | ​     ↳ `details` | `object` | ❌ | — | Trigger-type-specific metadata; shape varies by trigger type (e.g. `webhook_url` on catch-hook triggers). Null or absent when none applies. |
1713
+ | ​   ↳ `created_at` | `string` | ✅ | — | |
1714
+ | ​   ↳ `updated_at` | `string` | ❌ | — | |
1715
+ | ​ ↳ `draft` | `object` | ✅ | — | The open draft holding the transformed source. |
1716
+ | ​   ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
1717
+ | ​   ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
1718
+ | ​   ↳ `slug` | `string` | ✅ | — | Human-friendly identifier for URL routing; unique among open drafts per workflow |
1719
+ | ​   ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
1720
+ | ​   ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
1721
+ | ​   ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
1722
+ | ​   ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
1723
+ | ​   ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
1724
+ | ​   ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
1725
+ | ​   ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
1726
+ | ​   ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
1727
+ | ​   ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
1728
+ | ​   ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
1729
+ | ​   ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
1730
+ | ​   ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
1731
+ | ​   ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
1732
+ | ​   ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
1733
+ | ​   ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
1734
+ | ​ ↳ `issues[]` | `object[]` | ✅ | — | Blocking and non-blocking translation issues from the transform, passed through unchanged. Blocking issues do not prevent draft creation; they must be resolved before the draft will publish. |
1735
+ | ​   ↳ `line` | `number` | ✅ | — | 1-based line in the generated source the issue relates to, or 0 when not line-specific. |
1736
+ | ​   ↳ `column` | `number` | ✅ | — | 1-based column, or 0 when not column-specific. |
1737
+ | ​   ↳ `node_kind` | `string` | ✅ | — | Category of the issue, used to group and message them, e.g. "invalid-connection-id", "DelayStep", "app-version-conflict". |
1738
+ | ​   ↳ `step_name` | `string` | ❌ | — | ZDL step id or name the issue originated from, when known. |
1739
+ | ​   ↳ `message` | `string` | ✅ | — | Human-readable description of the issue. |
1740
+ | ​   ↳ `blocking` | `boolean` | ✅ | — | Whether the issue must be resolved before the draft can be published. Computed server-side, so callers do not re-derive it. A blocking issue does not prevent the draft being created. |
1741
+
1742
+ **Example:**
1743
+
1744
+ ```typescript
1745
+ const { data: workflow } = await zapier.importWorkflow({
1746
+ zap: "example-zap",
1747
+ });
1748
+ ```
1749
+
1674
1750
  #### `listDurableRuns` 🧪 _experimental_
1675
1751
 
1676
1752
  List run-once durable runs for the authenticated account, newest first
@@ -6903,7 +6903,7 @@ function parseDeprecationDate(value) {
6903
6903
  }
6904
6904
 
6905
6905
  // src/sdk-version.ts
6906
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.100.0" : void 0) || "unknown";
6906
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.101.0" : void 0) || "unknown";
6907
6907
 
6908
6908
  // src/utils/open-url.ts
6909
6909
  var nodePrefix = "node:";
@@ -6901,7 +6901,7 @@ function parseDeprecationDate(value) {
6901
6901
  }
6902
6902
 
6903
6903
  // src/sdk-version.ts
6904
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.100.0" : void 0) || "unknown";
6904
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.101.0" : void 0) || "unknown";
6905
6905
 
6906
6906
  // src/utils/open-url.ts
6907
6907
  var nodePrefix = "node:";