@zapier/zapier-sdk 0.80.1 → 0.80.2

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.80.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 072fe2b: Decode JSON-string `input` on `triggerWorkflow` and `runDurable`. Their `input`
8
+ field is freeform (`z.unknown()`), which the CLI surfaces as a raw string flag
9
+ and never JSON-parses, so `--input '{"a":1}'` reached the API as a string and
10
+ was double-encoded (server rejected it with `expected object, received string`).
11
+ The input is now normalized at the schema boundary: a `{`/`[`-leading JSON
12
+ string is decoded to its value, while objects and scalar strings pass through
13
+ unchanged. This also fixes programmatic callers passing a JSON string.
14
+
3
15
  ## 0.80.1
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -1712,7 +1712,7 @@ Run a workflow source file as a run-once durable run on sdkdurableapi (no deploy
1712
1712
  | -------------------------- | ---------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
1713
1713
  | `options` | `object` | ✅ | — | — | |
1714
1714
  | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Source files keyed by filename → contents |
1715
- | ​ ↳ `input` | `unknown` | ❌ | — | — | Input data passed to the run |
1715
+ | ​ ↳ `input` | `unknown` | ❌ | — | — | Input data passed to the run. Accepts any JSON value, or its JSON-string encoding. |
1716
1716
  | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies |
1717
1717
  | ​ ↳ `zapierDurableVersion` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted. |
1718
1718
  | ​ ↳ `connections` | `object` | ❌ | — | — | Named connection aliases. Maps each alias to an object holding its Zapier connection ID, e.g. `{ "slack": { "connectionId": "123" } }`. |
@@ -1748,11 +1748,11 @@ Look up a workflow's trigger URL and fire it manually, as the authenticated acco
1748
1748
 
1749
1749
  **Parameters:**
1750
1750
 
1751
- | Name | Type | Required | Default | Possible Values | Description |
1752
- | -------------- | --------- | -------- | ------- | --------------- | -------------------------------------------------------------------------------------------------------- |
1753
- | `options` | `object` | ✅ | — | — | |
1754
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1755
- | ​ ↳ `input` | `unknown` | ❌ | — | — | JSON payload delivered as the trigger body. Sent as `application/json`; omit to fire with an empty body. |
1751
+ | Name | Type | Required | Default | Possible Values | Description |
1752
+ | -------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1753
+ | `options` | `object` | ✅ | — | — | |
1754
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1755
+ | ​ ↳ `input` | `unknown` | ❌ | — | — | JSON payload delivered as the trigger body. Accepts any JSON value, or its JSON-string encoding. Sent as `application/json`; omit to fire with an empty body. |
1756
1756
 
1757
1757
  **Returns:** `Promise<WorkflowRunItem>`
1758
1758
 
@@ -5216,7 +5216,7 @@ function parseDeprecationDate(value) {
5216
5216
  }
5217
5217
 
5218
5218
  // src/sdk-version.ts
5219
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.80.1" : void 0) || "unknown";
5219
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.80.2" : void 0) || "unknown";
5220
5220
 
5221
5221
  // src/utils/open-url.ts
5222
5222
  var nodePrefix = "node:";
@@ -13733,6 +13733,19 @@ var codeSubstrateDefaults = {
13733
13733
  categories: ["code-workflow"],
13734
13734
  experimental: true
13735
13735
  };
13736
+ var JsonPayloadSchema = zod.z.preprocess((val) => {
13737
+ if (typeof val === "string") {
13738
+ const trimmed = val.trim();
13739
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
13740
+ try {
13741
+ return JSON.parse(trimmed);
13742
+ } catch {
13743
+ return val;
13744
+ }
13745
+ }
13746
+ }
13747
+ return val;
13748
+ }, zod.z.unknown());
13736
13749
  var SourceFilesSchema = zod.z.record(zod.z.string(), zod.z.string()).refine((files) => Object.keys(files).length > 0, {
13737
13750
  message: "sourceFiles must contain at least one file"
13738
13751
  }).describe("Source files keyed by filename \u2192 contents");
@@ -14397,7 +14410,9 @@ var RunNotificationSchema = zod.z.object({
14397
14410
  "Webhook subscriber for run lifecycle events. Server POSTs `{run_id, event}` on each subscribed transition."
14398
14411
  );
14399
14412
  var RunDurableBaseSchema = zod.z.object({
14400
- input: zod.z.unknown().optional().describe("Input data passed to the run"),
14413
+ input: JsonPayloadSchema.optional().describe(
14414
+ "Input data passed to the run. Accepts any JSON value, or its JSON-string encoding."
14415
+ ),
14401
14416
  dependencies: zod.z.record(zod.z.string(), zod.z.string()).optional().describe("Optional npm package dependencies"),
14402
14417
  zapierDurableVersion: zod.z.string().optional().describe(
14403
14418
  'Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'
@@ -14959,8 +14974,8 @@ var TriggerWorkflowLookupResponseSchema = zod.z.object({
14959
14974
  }).passthrough();
14960
14975
  var TriggerWorkflowOptionsSchema = zod.z.object({
14961
14976
  workflow: zod.z.string().uuid().describe("Durable workflow ID"),
14962
- input: zod.z.unknown().optional().describe(
14963
- "JSON payload delivered as the trigger body. Sent as `application/json`; omit to fire with an empty body."
14977
+ input: JsonPayloadSchema.optional().describe(
14978
+ "JSON payload delivered as the trigger body. Accepts any JSON value, or its JSON-string encoding. Sent as `application/json`; omit to fire with an empty body."
14964
14979
  )
14965
14980
  }).describe(
14966
14981
  "Look up a workflow's trigger URL and fire it manually, as the authenticated account."
@@ -5214,7 +5214,7 @@ function parseDeprecationDate(value) {
5214
5214
  }
5215
5215
 
5216
5216
  // src/sdk-version.ts
5217
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.80.1" : void 0) || "unknown";
5217
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.80.2" : void 0) || "unknown";
5218
5218
 
5219
5219
  // src/utils/open-url.ts
5220
5220
  var nodePrefix = "node:";
@@ -13731,6 +13731,19 @@ var codeSubstrateDefaults = {
13731
13731
  categories: ["code-workflow"],
13732
13732
  experimental: true
13733
13733
  };
13734
+ var JsonPayloadSchema = z.preprocess((val) => {
13735
+ if (typeof val === "string") {
13736
+ const trimmed = val.trim();
13737
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
13738
+ try {
13739
+ return JSON.parse(trimmed);
13740
+ } catch {
13741
+ return val;
13742
+ }
13743
+ }
13744
+ }
13745
+ return val;
13746
+ }, z.unknown());
13734
13747
  var SourceFilesSchema = z.record(z.string(), z.string()).refine((files) => Object.keys(files).length > 0, {
13735
13748
  message: "sourceFiles must contain at least one file"
13736
13749
  }).describe("Source files keyed by filename \u2192 contents");
@@ -14395,7 +14408,9 @@ var RunNotificationSchema = z.object({
14395
14408
  "Webhook subscriber for run lifecycle events. Server POSTs `{run_id, event}` on each subscribed transition."
14396
14409
  );
14397
14410
  var RunDurableBaseSchema = z.object({
14398
- input: z.unknown().optional().describe("Input data passed to the run"),
14411
+ input: JsonPayloadSchema.optional().describe(
14412
+ "Input data passed to the run. Accepts any JSON value, or its JSON-string encoding."
14413
+ ),
14399
14414
  dependencies: z.record(z.string(), z.string()).optional().describe("Optional npm package dependencies"),
14400
14415
  zapierDurableVersion: z.string().optional().describe(
14401
14416
  'Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'
@@ -14957,8 +14972,8 @@ var TriggerWorkflowLookupResponseSchema = z.object({
14957
14972
  }).passthrough();
14958
14973
  var TriggerWorkflowOptionsSchema = z.object({
14959
14974
  workflow: z.string().uuid().describe("Durable workflow ID"),
14960
- input: z.unknown().optional().describe(
14961
- "JSON payload delivered as the trigger body. Sent as `application/json`; omit to fire with an empty body."
14975
+ input: JsonPayloadSchema.optional().describe(
14976
+ "JSON payload delivered as the trigger body. Accepts any JSON value, or its JSON-string encoding. Sent as `application/json`; omit to fire with an empty body."
14962
14977
  )
14963
14978
  }).describe(
14964
14979
  "Look up a workflow's trigger URL and fire it manually, as the authenticated account."
package/dist/index.cjs CHANGED
@@ -8749,7 +8749,7 @@ function parseDeprecationDate(value) {
8749
8749
  }
8750
8750
 
8751
8751
  // src/sdk-version.ts
8752
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.80.1" : void 0) || "unknown";
8752
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.80.2" : void 0) || "unknown";
8753
8753
 
8754
8754
  // src/utils/open-url.ts
8755
8755
  var nodePrefix = "node:";
package/dist/index.mjs CHANGED
@@ -8747,7 +8747,7 @@ function parseDeprecationDate(value) {
8747
8747
  }
8748
8748
 
8749
8749
  // src/sdk-version.ts
8750
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.80.1" : void 0) || "unknown";
8750
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.80.2" : void 0) || "unknown";
8751
8751
 
8752
8752
  // src/utils/open-url.ts
8753
8753
  var nodePrefix = "node:";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.80.1",
3
+ "version": "0.80.2",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",