@zapier/zapier-sdk 0.99.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 +12 -0
- package/README.md +119 -0
- package/dist/{chunk-BUAAO3AY.cjs → chunk-EOGYMKVF.cjs} +8 -1
- package/dist/{chunk-VXVMVORI.mjs → chunk-R6U6HNVF.mjs} +8 -1
- package/dist/experimental.cjs +578 -385
- package/dist/experimental.d.mts +212 -3
- package/dist/experimental.d.ts +212 -3
- package/dist/experimental.mjs +195 -2
- package/dist/index.cjs +277 -277
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
9
|
+
## 0.100.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 22a885c: Added `validateWorkflow` (experimental) to check durable workflow source without publishing it. Pass `sourceFiles` (absolute logical path → TypeScript source) and an optional `entrypointFile`, which defaults to `/workflow.ts`. The response carries an `issues` array that is empty when the source is valid; each issue has a `kind`, a `message`, a `severity` (`error`, `warning`, `info`, or `hint`), an optional `suggestion`, and usually the `source` location it points at. New `kind` values are added over time, so treat an unfamiliar one as a diagnostic rather than an error.
|
|
14
|
+
|
|
3
15
|
## 0.99.0
|
|
4
16
|
|
|
5
17
|
### 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)
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
- [`triggerWorkflow`](#triggerworkflow--experimental)
|
|
54
55
|
- [`updateWorkflow`](#updateworkflow--experimental)
|
|
55
56
|
- [`updateWorkflowDraft`](#updateworkflowdraft--experimental)
|
|
57
|
+
- [`validateWorkflow`](#validateworkflow--experimental)
|
|
56
58
|
- [Connections](#connections)
|
|
57
59
|
- [`createConnection`](#createconnection)
|
|
58
60
|
- [`findFirstConnection`](#findfirstconnection)
|
|
@@ -1670,6 +1672,81 @@ const { data: workflowVersion } = await zapier.getWorkflowVersion({
|
|
|
1670
1672
|
});
|
|
1671
1673
|
```
|
|
1672
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
|
+
|
|
1673
1750
|
#### `listDurableRuns` 🧪 _experimental_
|
|
1674
1751
|
|
|
1675
1752
|
List run-once durable runs for the authenticated account, newest first
|
|
@@ -2213,6 +2290,48 @@ const { data: workflowDraft } = await zapier.updateWorkflowDraft({
|
|
|
2213
2290
|
});
|
|
2214
2291
|
```
|
|
2215
2292
|
|
|
2293
|
+
#### `validateWorkflow` 🧪 _experimental_
|
|
2294
|
+
|
|
2295
|
+
Validate durable workflow source without publishing it. Returns source diagnostics; issue kinds are extensible and may be unfamiliar to the client.
|
|
2296
|
+
|
|
2297
|
+
**Parameters:**
|
|
2298
|
+
|
|
2299
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
2300
|
+
| -------------------- | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------- |
|
|
2301
|
+
| `options` | `object` | ✅ | — | — | |
|
|
2302
|
+
| ↳ `sourceFiles` | `object` | ✅ | — | — | Exact TypeScript sources keyed by absolute logical path. |
|
|
2303
|
+
| ↳ `entrypointFile` | `string` | ❌ | — | — | Absolute logical path of the entry file in sourceFiles. Defaults to /workflow.ts. |
|
|
2304
|
+
|
|
2305
|
+
**Returns:** `Promise<WorkflowValidationItem>`
|
|
2306
|
+
|
|
2307
|
+
| Name | Type | Required | Possible Values | Description |
|
|
2308
|
+
| ---------------------- | ---------- | -------- | ---------------------------------- | ----------------------------------------------------------------------------------- |
|
|
2309
|
+
| `data` | `object` | ✅ | — | |
|
|
2310
|
+
| ↳ `issues[]` | `object[]` | ✅ | — | Source diagnostics, or an empty array when validation passes. |
|
|
2311
|
+
| ↳ `kind` | `string` | ✅ | — | Extensible diagnostic category; clients must accept unfamiliar values. |
|
|
2312
|
+
| ↳ `message` | `string` | ✅ | — | Safe human-readable explanation. |
|
|
2313
|
+
| ↳ `severity` | `string` | ✅ | `error`, `warning`, `info`, `hint` | Diagnostic severity. |
|
|
2314
|
+
| ↳ `suggestion` | `string` | ❌ | — | Actionable fix hint. |
|
|
2315
|
+
| ↳ `source` | `object` | ❌ | — | Affected source location. |
|
|
2316
|
+
| ↳ `file_id` | `string` | ✅ | — | Source file containing the diagnostic. |
|
|
2317
|
+
| ↳ `start_line` | `number` | ✅ | — | Inclusive 1-based start line. |
|
|
2318
|
+
| ↳ `start_column` | `number` | ✅ | — | Inclusive 1-based start column. |
|
|
2319
|
+
| ↳ `end_line` | `number` | ✅ | — | Inclusive 1-based end line. |
|
|
2320
|
+
| ↳ `end_column` | `number` | ✅ | — | Inclusive 1-based end column. |
|
|
2321
|
+
| ↳ `source_excerpt` | `string` | ❌ | — | Source text the diagnostic was raised against, truncated to 240 characters. |
|
|
2322
|
+
| ↳ `syntax_kind` | `string` | ❌ | — | TypeScript AST node kind the diagnostic was raised against (e.g. `CallExpression`). |
|
|
2323
|
+
|
|
2324
|
+
**Example:**
|
|
2325
|
+
|
|
2326
|
+
```typescript
|
|
2327
|
+
const { data: workflowValidation } = await zapier.validateWorkflow({
|
|
2328
|
+
sourceFiles: {
|
|
2329
|
+
"/workflow.ts":
|
|
2330
|
+
'import { defineDurable } from "@zapier/zapier-durable"; export default defineDurable("hello-world", async (ctx, input) => { return ctx.step("greet", async () => "Hello, world!"); });',
|
|
2331
|
+
},
|
|
2332
|
+
});
|
|
2333
|
+
```
|
|
2334
|
+
|
|
2216
2335
|
### Connections
|
|
2217
2336
|
|
|
2218
2337
|
#### `createConnection`
|
|
@@ -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.
|
|
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:";
|
|
@@ -7138,6 +7138,13 @@ var pathConfig = {
|
|
|
7138
7138
|
authHeader: "Authorization",
|
|
7139
7139
|
pathPrefix: "/api/v0/sdk/code-substrate-workflows"
|
|
7140
7140
|
},
|
|
7141
|
+
// e.g. /code-substrate-analyzer/validations ->
|
|
7142
|
+
// https://api.zapier.com/code-substrate-analyzer/v0/validations
|
|
7143
|
+
"/code-substrate-analyzer": {
|
|
7144
|
+
authHeader: "Authorization",
|
|
7145
|
+
pathPrefix: "/code-substrate-analyzer/v0",
|
|
7146
|
+
subdomain: "api"
|
|
7147
|
+
},
|
|
7141
7148
|
// e.g. /forms/v0/forms -> https://api.zapier.com/forms/v0/forms
|
|
7142
7149
|
// The Forms API is registered on the Public API Gateway and has no sdkapi
|
|
7143
7150
|
// proxy route, so it goes straight to the gateway. Its governance metadata
|
|
@@ -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.
|
|
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:";
|
|
@@ -7136,6 +7136,13 @@ var pathConfig = {
|
|
|
7136
7136
|
authHeader: "Authorization",
|
|
7137
7137
|
pathPrefix: "/api/v0/sdk/code-substrate-workflows"
|
|
7138
7138
|
},
|
|
7139
|
+
// e.g. /code-substrate-analyzer/validations ->
|
|
7140
|
+
// https://api.zapier.com/code-substrate-analyzer/v0/validations
|
|
7141
|
+
"/code-substrate-analyzer": {
|
|
7142
|
+
authHeader: "Authorization",
|
|
7143
|
+
pathPrefix: "/code-substrate-analyzer/v0",
|
|
7144
|
+
subdomain: "api"
|
|
7145
|
+
},
|
|
7139
7146
|
// e.g. /forms/v0/forms -> https://api.zapier.com/forms/v0/forms
|
|
7140
7147
|
// The Forms API is registered on the Public API Gateway and has no sdkapi
|
|
7141
7148
|
// proxy route, so it goes straight to the gateway. Its governance metadata
|