@zapier/zapier-sdk-cli 0.71.0 → 0.71.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-cli
2
2
 
3
+ ## 0.71.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0f54b24: CLI commands with an object-typed parameter (e.g. `run-durable`'s `<source-files>`, or an array-of-object parameter like its `notifications`) now reject invalid input with a clear error naming the parameter, instead of silently passing it through to a confusing downstream validation error like `expected record, received string`:
8
+ - A string that isn't valid JSON reports the parse failure. A value that looks like a file path (contains a slash or ends in `.ts`/`.js`/`.tsx`/`.jsx`/`.json`) gets an additional hint that a JSON value was expected, not a path on disk.
9
+ - A string that parses as valid JSON but isn't an object (e.g. `42`, `true`, `null`) is also rejected, since it can never satisfy an object-shaped parameter.
10
+
11
+ - Updated dependencies [59a8180]
12
+ - @zapier/zapier-sdk@0.94.1
13
+ - @zapier/zapier-sdk-mcp@0.19.1
14
+
3
15
  ## 0.71.0
4
16
 
5
17
  ### Minor Changes
package/dist/cli.cjs CHANGED
@@ -602,7 +602,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
602
602
 
603
603
  // package.json
604
604
  var package_default = {
605
- version: "0.71.0"};
605
+ version: "0.71.1"};
606
606
  var PACKAGE_MANAGERS = ["npm", "pnpm", "yarn", "bun"];
607
607
  var LOCKFILES = [
608
608
  ["pnpm-lock.yaml", "pnpm"],
@@ -1982,7 +1982,8 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
1982
1982
  sdkParams[param.name] = convertValue(
1983
1983
  positionalValue,
1984
1984
  param.type,
1985
- param.elementType
1985
+ param.elementType,
1986
+ param.name
1986
1987
  );
1987
1988
  }
1988
1989
  });
@@ -2005,7 +2006,12 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
2005
2006
  if (param.type === "array" && Array.isArray(value) && value.length === 0) {
2006
2007
  return;
2007
2008
  }
2008
- sdkParams[camelKey] = convertValue(value, param.type, param.elementType);
2009
+ sdkParams[camelKey] = convertValue(
2010
+ value,
2011
+ param.type,
2012
+ param.elementType,
2013
+ param.name
2014
+ );
2009
2015
  }
2010
2016
  });
2011
2017
  return sdkParams;
@@ -2020,7 +2026,28 @@ function parseCliBoolean(value) {
2020
2026
  `Expected a boolean (true or false), received "${value}".`
2021
2027
  );
2022
2028
  }
2023
- function convertValue(value, type, elementType) {
2029
+ function looksLikeFilePath(value) {
2030
+ return /[/\\]/.test(value) || /\.(ts|js|tsx|jsx|json)$/i.test(value);
2031
+ }
2032
+ function parseJsonParameter(value, paramName) {
2033
+ let parsed;
2034
+ try {
2035
+ parsed = JSON.parse(value);
2036
+ } catch (error) {
2037
+ const parseErrorMessage = error instanceof Error ? error.message : String(error);
2038
+ const pathHint = looksLikeFilePath(value) ? ` "${value}" looks like a file path \u2014 this parameter expects a JSON value (e.g. an object), not a path on disk.` : "";
2039
+ throw new commander.InvalidArgumentError(
2040
+ `Parameter "${paramName}" expects JSON, but the value could not be parsed: ${parseErrorMessage}.${pathHint}`
2041
+ );
2042
+ }
2043
+ if (typeof parsed !== "object" || parsed === null) {
2044
+ throw new commander.InvalidArgumentError(
2045
+ `Parameter "${paramName}" expects a JSON object, but got: ${value}.`
2046
+ );
2047
+ }
2048
+ return parsed;
2049
+ }
2050
+ function convertValue(value, type, elementType, paramName) {
2024
2051
  if (value === void 0) {
2025
2052
  return void 0;
2026
2053
  }
@@ -2033,12 +2060,8 @@ function convertValue(value, type, elementType) {
2033
2060
  const arr = Array.isArray(value) ? value : [value];
2034
2061
  if (elementType !== "object") return arr;
2035
2062
  return arr.flatMap((item) => {
2036
- if (typeof item === "string" && (item.startsWith("{") || item.startsWith("["))) {
2037
- try {
2038
- return JSON.parse(item);
2039
- } catch {
2040
- return item;
2041
- }
2063
+ if (typeof item === "string") {
2064
+ return parseJsonParameter(item, paramName ?? "value");
2042
2065
  }
2043
2066
  return item;
2044
2067
  });
@@ -2047,11 +2070,7 @@ function convertValue(value, type, elementType) {
2047
2070
  return value;
2048
2071
  case "object":
2049
2072
  if (typeof value === "string") {
2050
- try {
2051
- return JSON.parse(value);
2052
- } catch {
2053
- return value;
2054
- }
2073
+ return parseJsonParameter(value, paramName ?? "value");
2055
2074
  }
2056
2075
  return value;
2057
2076
  default:
@@ -8341,7 +8360,7 @@ function buildBoxLines(message) {
8341
8360
  // package.json with { type: 'json' }
8342
8361
  var package_default2 = {
8343
8362
  name: "@zapier/zapier-sdk-cli",
8344
- version: "0.71.0"};
8363
+ version: "0.71.1"};
8345
8364
 
8346
8365
  // src/sdk.ts
8347
8366
  var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
package/dist/cli.mjs CHANGED
@@ -558,7 +558,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
558
558
 
559
559
  // package.json
560
560
  var package_default = {
561
- version: "0.71.0"};
561
+ version: "0.71.1"};
562
562
  var PACKAGE_MANAGERS = ["npm", "pnpm", "yarn", "bun"];
563
563
  var LOCKFILES = [
564
564
  ["pnpm-lock.yaml", "pnpm"],
@@ -1938,7 +1938,8 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
1938
1938
  sdkParams[param.name] = convertValue(
1939
1939
  positionalValue,
1940
1940
  param.type,
1941
- param.elementType
1941
+ param.elementType,
1942
+ param.name
1942
1943
  );
1943
1944
  }
1944
1945
  });
@@ -1961,7 +1962,12 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
1961
1962
  if (param.type === "array" && Array.isArray(value) && value.length === 0) {
1962
1963
  return;
1963
1964
  }
1964
- sdkParams[camelKey] = convertValue(value, param.type, param.elementType);
1965
+ sdkParams[camelKey] = convertValue(
1966
+ value,
1967
+ param.type,
1968
+ param.elementType,
1969
+ param.name
1970
+ );
1965
1971
  }
1966
1972
  });
1967
1973
  return sdkParams;
@@ -1976,7 +1982,28 @@ function parseCliBoolean(value) {
1976
1982
  `Expected a boolean (true or false), received "${value}".`
1977
1983
  );
1978
1984
  }
1979
- function convertValue(value, type, elementType) {
1985
+ function looksLikeFilePath(value) {
1986
+ return /[/\\]/.test(value) || /\.(ts|js|tsx|jsx|json)$/i.test(value);
1987
+ }
1988
+ function parseJsonParameter(value, paramName) {
1989
+ let parsed;
1990
+ try {
1991
+ parsed = JSON.parse(value);
1992
+ } catch (error) {
1993
+ const parseErrorMessage = error instanceof Error ? error.message : String(error);
1994
+ const pathHint = looksLikeFilePath(value) ? ` "${value}" looks like a file path \u2014 this parameter expects a JSON value (e.g. an object), not a path on disk.` : "";
1995
+ throw new InvalidArgumentError(
1996
+ `Parameter "${paramName}" expects JSON, but the value could not be parsed: ${parseErrorMessage}.${pathHint}`
1997
+ );
1998
+ }
1999
+ if (typeof parsed !== "object" || parsed === null) {
2000
+ throw new InvalidArgumentError(
2001
+ `Parameter "${paramName}" expects a JSON object, but got: ${value}.`
2002
+ );
2003
+ }
2004
+ return parsed;
2005
+ }
2006
+ function convertValue(value, type, elementType, paramName) {
1980
2007
  if (value === void 0) {
1981
2008
  return void 0;
1982
2009
  }
@@ -1989,12 +2016,8 @@ function convertValue(value, type, elementType) {
1989
2016
  const arr = Array.isArray(value) ? value : [value];
1990
2017
  if (elementType !== "object") return arr;
1991
2018
  return arr.flatMap((item) => {
1992
- if (typeof item === "string" && (item.startsWith("{") || item.startsWith("["))) {
1993
- try {
1994
- return JSON.parse(item);
1995
- } catch {
1996
- return item;
1997
- }
2019
+ if (typeof item === "string") {
2020
+ return parseJsonParameter(item, paramName ?? "value");
1998
2021
  }
1999
2022
  return item;
2000
2023
  });
@@ -2003,11 +2026,7 @@ function convertValue(value, type, elementType) {
2003
2026
  return value;
2004
2027
  case "object":
2005
2028
  if (typeof value === "string") {
2006
- try {
2007
- return JSON.parse(value);
2008
- } catch {
2009
- return value;
2010
- }
2029
+ return parseJsonParameter(value, paramName ?? "value");
2011
2030
  }
2012
2031
  return value;
2013
2032
  default:
@@ -8297,7 +8316,7 @@ function buildBoxLines(message) {
8297
8316
  // package.json with { type: 'json' }
8298
8317
  var package_default2 = {
8299
8318
  name: "@zapier/zapier-sdk-cli",
8300
- version: "0.71.0"};
8319
+ version: "0.71.1"};
8301
8320
 
8302
8321
  // src/sdk.ts
8303
8322
  var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
@@ -6861,7 +6861,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
6861
6861
  // package.json with { type: 'json' }
6862
6862
  var package_default = {
6863
6863
  name: "@zapier/zapier-sdk-cli",
6864
- version: "0.71.0"};
6864
+ version: "0.71.1"};
6865
6865
 
6866
6866
  // src/sdk.ts
6867
6867
  var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
@@ -6820,7 +6820,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
6820
6820
  // package.json with { type: 'json' }
6821
6821
  var package_default = {
6822
6822
  name: "@zapier/zapier-sdk-cli",
6823
- version: "0.71.0"};
6823
+ version: "0.71.1"};
6824
6824
 
6825
6825
  // src/sdk.ts
6826
6826
  var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
package/dist/index.cjs CHANGED
@@ -6862,7 +6862,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
6862
6862
  // package.json with { type: 'json' }
6863
6863
  var package_default = {
6864
6864
  name: "@zapier/zapier-sdk-cli",
6865
- version: "0.71.0"};
6865
+ version: "0.71.1"};
6866
6866
 
6867
6867
  // src/sdk.ts
6868
6868
  var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
@@ -6946,7 +6946,7 @@ function createZapierCliSdk(options = {}) {
6946
6946
 
6947
6947
  // package.json
6948
6948
  var package_default2 = {
6949
- version: "0.71.0"};
6949
+ version: "0.71.1"};
6950
6950
 
6951
6951
  // src/telemetry/builders.ts
6952
6952
  function createCliBaseEvent(context = {}) {
package/dist/index.mjs CHANGED
@@ -6821,7 +6821,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
6821
6821
  // package.json with { type: 'json' }
6822
6822
  var package_default = {
6823
6823
  name: "@zapier/zapier-sdk-cli",
6824
- version: "0.71.0"};
6824
+ version: "0.71.1"};
6825
6825
 
6826
6826
  // src/sdk.ts
6827
6827
  var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
@@ -6905,7 +6905,7 @@ function createZapierCliSdk(options = {}) {
6905
6905
 
6906
6906
  // package.json
6907
6907
  var package_default2 = {
6908
- version: "0.71.0"};
6908
+ version: "0.71.1"};
6909
6909
 
6910
6910
  // src/telemetry/builders.ts
6911
6911
  function createCliBaseEvent(context = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.71.0",
3
+ "version": "0.71.1",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -95,8 +95,8 @@
95
95
  "typescript": "^5.8.3",
96
96
  "wrap-ansi": "^10.0.0",
97
97
  "zod": "4.3.6",
98
- "@zapier/zapier-sdk": "0.94.0",
99
- "@zapier/zapier-sdk-mcp": "0.19.0"
98
+ "@zapier/zapier-sdk": "0.94.1",
99
+ "@zapier/zapier-sdk-mcp": "0.19.1"
100
100
  },
101
101
  "devDependencies": {
102
102
  "@types/cross-spawn": "^6.0.6",