@zapier/zapier-sdk 0.96.0 → 0.97.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.97.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e45f03b: _This release contains no user-facing changes._
8
+
9
+ ## 0.97.0
10
+
11
+ ### Minor Changes
12
+
13
+ - abbeb60: Added a `manual` option (experimental) to `publishWorkflowDraft` and `updateWorkflowDraft`, exposed in the CLI as `--manual` on `publish-workflow-draft` and `update-workflow-draft`. Pass `manual: true` to declare a draft (or its publish) on-demand and triggerless; pass `trigger` for a triggered one. The two are mutually exclusive — sending both is rejected with a 400. This extends the `manual` flag `publishWorkflowVersion` already supports (see the previous release) to the draft path.
14
+
3
15
  ## 0.96.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -1951,13 +1951,14 @@ Publish an open draft as a new immutable workflow version. Advances the workflow
1951
1951
 
1952
1952
  **Parameters:**
1953
1953
 
1954
- | Name | Type | Required | Default | Possible Values | Description |
1955
- | ------------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1956
- | `options` | `object` | ✅ | — | — | |
1957
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1958
- | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
1959
- | ​ ↳ `enabled` | `boolean` | ❌ | — | — | Set the workflow's enabled state as part of the publish. If omitted, the current enabled state is preserved. |
1960
- | ​ ↳ `draftRevision` | `number` | ❌ | — | — | Expected draft revision for optimistic concurrency. Pass the revision from the last read; the server rejects the publish with a conflict if the draft has changed since. Omit to skip the check. |
1954
+ | Name | Type | Required | Default | Possible Values | Description |
1955
+ | ------------------- | --------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1956
+ | `options` | `object` | ✅ | — | — | |
1957
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1958
+ | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
1959
+ | ​ ↳ `enabled` | `boolean` | ❌ | — | — | Set the workflow's enabled state as part of the publish. If omitted, the current enabled state is preserved. |
1960
+ | ​ ↳ `draftRevision` | `number` | ❌ | — | — | Expected draft revision for optimistic concurrency. Pass the revision from the last read; the server rejects the publish with a conflict if the draft has changed since. Omit to skip the check. |
1961
+ | ​ ↳ `manual` | `boolean` | ❌ | — | — | Declare this publish on-demand and triggerless, overriding the draft's stored intent for this publish only. Pass `manual: true` only when the draft has no trigger configured; the API rejects a draft with a trigger published as `manual: true` as a contradiction (400). |
1961
1962
 
1962
1963
  **Returns:** `Promise<PublishWorkflowDraftResponse>`
1963
1964
 
@@ -2164,18 +2165,19 @@ Update (autosave) an open workflow draft
2164
2165
 
2165
2166
  **Parameters:**
2166
2167
 
2167
- | Name | Type | Required | Default | Possible Values | Description |
2168
- | -------------------------- | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2169
- | `options` | `object` | ✅ | — | — | |
2170
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2171
- | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
2172
- | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Source files keyed by filename → contents |
2173
- | ​ ↳ `zapierDurableVersion` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Leaves the stored pin unchanged if omitted. |
2174
- | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies |
2175
- | ​ ↳ `draftRevision` | `number` | ❌ | — | — | Expected draft revision for optimistic concurrency. Pass the revision from the last read; the server rejects the save with a conflict if the draft has changed since. Omit to skip the check. |
2176
- | ​ ↳ `trigger` | `object` | ❌ | — | — | Trigger configuration. Omit to leave the stored trigger unchanged, pass null to clear it, or pass an object to replace it. |
2177
- | ​ ↳ `connections` | `object` | ❌ | — | — | Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding. |
2178
- | ​ ↳ `appVersions` | `object` | ❌ | — | — | Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding. |
2168
+ | Name | Type | Required | Default | Possible Values | Description |
2169
+ | -------------------------- | --------- | -------- | ------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2170
+ | `options` | `object` | ✅ | — | — | |
2171
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2172
+ | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
2173
+ | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Source files keyed by filename → contents |
2174
+ | ​ ↳ `zapierDurableVersion` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Leaves the stored pin unchanged if omitted. |
2175
+ | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies |
2176
+ | ​ ↳ `draftRevision` | `number` | ❌ | — | — | Expected draft revision for optimistic concurrency. Pass the revision from the last read; the server rejects the save with a conflict if the draft has changed since. Omit to skip the check. |
2177
+ | ​ ↳ `trigger` | `object` | ❌ | — | — | Trigger configuration. Omit to leave the stored trigger unchanged, pass null to clear it, or pass an object to replace it; for an on-demand, triggerless workflow, clear this and pass `manual: true` instead. |
2178
+ | ​ ↳ `connections` | `object` | ❌ | — | — | Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding. |
2179
+ | ​ ↳ `appVersions` | `object` | ❌ | — | — | Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding. |
2180
+ | ​ ↳ `manual` | `boolean` | ❌ | — | — | Declare this draft on-demand and triggerless. Pass `manual: true` only when omitting `trigger` (or clearing it with `trigger: null`); passing both is a contradiction the API rejects with a 400. Setting a `trigger` later clears a previously stored `manual: true`. |
2179
2181
 
2180
2182
  **Returns:** `Promise<WorkflowDraftItem>`
2181
2183
 
@@ -6514,7 +6514,7 @@ function parseDeprecationDate(value) {
6514
6514
  }
6515
6515
 
6516
6516
  // src/sdk-version.ts
6517
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.96.0" : void 0) || "unknown";
6517
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.97.1" : void 0) || "unknown";
6518
6518
 
6519
6519
  // src/utils/open-url.ts
6520
6520
  var nodePrefix = "node:";
@@ -6911,11 +6911,16 @@ var ZapierApiClient = class {
6911
6911
  if (!approvalContext) {
6912
6912
  return { response };
6913
6913
  }
6914
+ const askStatementIdsHeader = response.headers.get(
6915
+ "x-zapier-ask-statement-ids"
6916
+ );
6917
+ const askStatementIds = askStatementIdsHeader ? JSON.parse(askStatementIdsHeader) : void 0;
6914
6918
  try {
6915
6919
  await this.runOneApprovalRound(
6916
6920
  approvalContext,
6917
6921
  approvalMode,
6918
- init?.signal ?? void 0
6922
+ init?.signal ?? void 0,
6923
+ askStatementIds
6919
6924
  );
6920
6925
  } catch (error) {
6921
6926
  return { response, approvalRoundError: error };
@@ -7518,7 +7523,7 @@ var ZapierApiClient = class {
7518
7523
  * Caller is responsible for passing a non-"disabled" mode; this method
7519
7524
  * unconditionally creates an approval.
7520
7525
  */
7521
- async runOneApprovalRound(buildContext, mode, signal) {
7526
+ async runOneApprovalRound(buildContext, mode, signal, askStatementIds) {
7522
7527
  const context = buildContext();
7523
7528
  let approvalResponse;
7524
7529
  try {
@@ -7528,7 +7533,10 @@ var ZapierApiClient = class {
7528
7533
  "Content-Type": "application/json",
7529
7534
  Accept: "application/json"
7530
7535
  },
7531
- body: JSON.stringify({ context }),
7536
+ body: JSON.stringify({
7537
+ context,
7538
+ ...askStatementIds?.length ? { ask_statement_ids: askStatementIds } : {}
7539
+ }),
7532
7540
  signal
7533
7541
  });
7534
7542
  } catch (err) {
@@ -6512,7 +6512,7 @@ function parseDeprecationDate(value) {
6512
6512
  }
6513
6513
 
6514
6514
  // src/sdk-version.ts
6515
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.96.0" : void 0) || "unknown";
6515
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.97.1" : void 0) || "unknown";
6516
6516
 
6517
6517
  // src/utils/open-url.ts
6518
6518
  var nodePrefix = "node:";
@@ -6909,11 +6909,16 @@ var ZapierApiClient = class {
6909
6909
  if (!approvalContext) {
6910
6910
  return { response };
6911
6911
  }
6912
+ const askStatementIdsHeader = response.headers.get(
6913
+ "x-zapier-ask-statement-ids"
6914
+ );
6915
+ const askStatementIds = askStatementIdsHeader ? JSON.parse(askStatementIdsHeader) : void 0;
6912
6916
  try {
6913
6917
  await this.runOneApprovalRound(
6914
6918
  approvalContext,
6915
6919
  approvalMode,
6916
- init?.signal ?? void 0
6920
+ init?.signal ?? void 0,
6921
+ askStatementIds
6917
6922
  );
6918
6923
  } catch (error) {
6919
6924
  return { response, approvalRoundError: error };
@@ -7516,7 +7521,7 @@ var ZapierApiClient = class {
7516
7521
  * Caller is responsible for passing a non-"disabled" mode; this method
7517
7522
  * unconditionally creates an approval.
7518
7523
  */
7519
- async runOneApprovalRound(buildContext, mode, signal) {
7524
+ async runOneApprovalRound(buildContext, mode, signal, askStatementIds) {
7520
7525
  const context = buildContext();
7521
7526
  let approvalResponse;
7522
7527
  try {
@@ -7526,7 +7531,10 @@ var ZapierApiClient = class {
7526
7531
  "Content-Type": "application/json",
7527
7532
  Accept: "application/json"
7528
7533
  },
7529
- body: JSON.stringify({ context }),
7534
+ body: JSON.stringify({
7535
+ context,
7536
+ ...askStatementIds?.length ? { ask_statement_ids: askStatementIds } : {}
7537
+ }),
7530
7538
  signal
7531
7539
  });
7532
7540
  } catch (err) {