@zapier/zapier-sdk-cli 0.39.2 → 0.39.3
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 +9 -0
- package/README.md +6 -6
- package/dist/cli.cjs +38 -13
- package/dist/cli.mjs +38 -13
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/package.json +1 -1
- package/dist/src/utils/cli-generator.js +32 -10
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @zapier/zapier-sdk-cli
|
|
2
2
|
|
|
3
|
+
## 0.39.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b250545: Connections - Replace isExpired with expired
|
|
8
|
+
- Updated dependencies [b250545]
|
|
9
|
+
- @zapier/zapier-sdk@0.40.3
|
|
10
|
+
- @zapier/zapier-sdk-mcp@0.10.9
|
|
11
|
+
|
|
3
12
|
## 0.39.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -415,12 +415,12 @@ Find the first connection matching the criteria
|
|
|
415
415
|
| `--owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own connections or a specific user ID |
|
|
416
416
|
| `--account` | `string` | ❌ | — | — | Account to filter by |
|
|
417
417
|
| `--include-shared` | `boolean` | ❌ | — | — | Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections. |
|
|
418
|
-
| `--
|
|
418
|
+
| `--expired` | `boolean` | ❌ | — | — | Show only expired connections (default: only non-expired connections are returned) |
|
|
419
419
|
|
|
420
420
|
**Usage:**
|
|
421
421
|
|
|
422
422
|
```bash
|
|
423
|
-
npx zapier-sdk find-first-connection [app] [--search] [--title] [--owner] [--account] [--include-shared] [--
|
|
423
|
+
npx zapier-sdk find-first-connection [app] [--search] [--title] [--owner] [--account] [--include-shared] [--expired]
|
|
424
424
|
```
|
|
425
425
|
|
|
426
426
|
#### `find-unique-connection`
|
|
@@ -437,12 +437,12 @@ Find a unique connection matching the criteria
|
|
|
437
437
|
| `--owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own connections or a specific user ID |
|
|
438
438
|
| `--account` | `string` | ❌ | — | — | Account to filter by |
|
|
439
439
|
| `--include-shared` | `boolean` | ❌ | — | — | Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections. |
|
|
440
|
-
| `--
|
|
440
|
+
| `--expired` | `boolean` | ❌ | — | — | Show only expired connections (default: only non-expired connections are returned) |
|
|
441
441
|
|
|
442
442
|
**Usage:**
|
|
443
443
|
|
|
444
444
|
```bash
|
|
445
|
-
npx zapier-sdk find-unique-connection [app] [--search] [--title] [--owner] [--account] [--include-shared] [--
|
|
445
|
+
npx zapier-sdk find-unique-connection [app] [--search] [--title] [--owner] [--account] [--include-shared] [--expired]
|
|
446
446
|
```
|
|
447
447
|
|
|
448
448
|
#### `get-connection`
|
|
@@ -476,7 +476,7 @@ List available connections with optional filtering
|
|
|
476
476
|
| `--connections` | `array` | ❌ | — | — | List of connection IDs to filter by |
|
|
477
477
|
| `--account` | `string` | ❌ | — | — | Account to filter by |
|
|
478
478
|
| `--include-shared` | `boolean` | ❌ | — | — | Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections. |
|
|
479
|
-
| `--
|
|
479
|
+
| `--expired` | `boolean` | ❌ | — | — | Show only expired connections (default: only non-expired connections are returned) |
|
|
480
480
|
| `--page-size` | `number` | ❌ | — | — | Number of connections per page |
|
|
481
481
|
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
482
482
|
| `--cursor` | `string` | ❌ | — | — | Cursor to start from |
|
|
@@ -484,7 +484,7 @@ List available connections with optional filtering
|
|
|
484
484
|
**Usage:**
|
|
485
485
|
|
|
486
486
|
```bash
|
|
487
|
-
npx zapier-sdk list-connections [app] [--search] [--title] [--owner] [--connections] [--account] [--include-shared] [--
|
|
487
|
+
npx zapier-sdk list-connections [app] [--search] [--title] [--owner] [--connections] [--account] [--include-shared] [--expired] [--page-size] [--max-items] [--cursor]
|
|
488
488
|
```
|
|
489
489
|
|
|
490
490
|
### HTTP Requests
|
package/dist/cli.cjs
CHANGED
|
@@ -1103,7 +1103,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
|
|
|
1103
1103
|
|
|
1104
1104
|
// package.json
|
|
1105
1105
|
var package_default = {
|
|
1106
|
-
version: "0.39.
|
|
1106
|
+
version: "0.39.3"};
|
|
1107
1107
|
|
|
1108
1108
|
// src/telemetry/builders.ts
|
|
1109
1109
|
function createCliBaseEvent(context = {}) {
|
|
@@ -1628,6 +1628,27 @@ function emitDeprecationWarning({
|
|
|
1628
1628
|
console.warn(chalk7__default.default.yellow(` ${deprecation.message}`));
|
|
1629
1629
|
console.warn();
|
|
1630
1630
|
}
|
|
1631
|
+
function emitParamDeprecationWarnings({
|
|
1632
|
+
options,
|
|
1633
|
+
parameters
|
|
1634
|
+
}) {
|
|
1635
|
+
for (const param of parameters) {
|
|
1636
|
+
if (!param.isDeprecated) continue;
|
|
1637
|
+
const value = options[param.name];
|
|
1638
|
+
if (value === void 0) continue;
|
|
1639
|
+
if (Array.isArray(value) && value.length === 0) continue;
|
|
1640
|
+
console.warn();
|
|
1641
|
+
console.warn(
|
|
1642
|
+
chalk7__default.default.yellow.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk7__default.default.yellow(
|
|
1643
|
+
` - \`${toKebabCase(param.name)}\` is deprecated and may be removed in a future release.`
|
|
1644
|
+
)
|
|
1645
|
+
);
|
|
1646
|
+
if (param.deprecationMessage) {
|
|
1647
|
+
console.warn(chalk7__default.default.yellow(` ${param.deprecationMessage}`));
|
|
1648
|
+
}
|
|
1649
|
+
console.warn();
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1631
1652
|
function resolveOutputMode({
|
|
1632
1653
|
isListCommand,
|
|
1633
1654
|
hasPaginationParams,
|
|
@@ -1666,11 +1687,15 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1666
1687
|
let required = true;
|
|
1667
1688
|
let defaultValue = void 0;
|
|
1668
1689
|
let isDeprecated = false;
|
|
1690
|
+
let deprecationMessage;
|
|
1669
1691
|
while (true) {
|
|
1670
1692
|
const meta = baseSchema.meta?.();
|
|
1671
1693
|
if (meta?.deprecated) {
|
|
1672
1694
|
isDeprecated = true;
|
|
1673
1695
|
}
|
|
1696
|
+
if (meta?.deprecationMessage && !deprecationMessage) {
|
|
1697
|
+
deprecationMessage = meta.deprecationMessage;
|
|
1698
|
+
}
|
|
1674
1699
|
if (baseSchema instanceof zod.z.ZodOptional) {
|
|
1675
1700
|
required = false;
|
|
1676
1701
|
baseSchema = baseSchema._zod.def.innerType;
|
|
@@ -1727,7 +1752,8 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1727
1752
|
hasResolver: paramHasResolver,
|
|
1728
1753
|
isPositional: zapierSdk.isPositional(schema),
|
|
1729
1754
|
elementType,
|
|
1730
|
-
|
|
1755
|
+
deprecationMessage,
|
|
1756
|
+
isDeprecated
|
|
1731
1757
|
};
|
|
1732
1758
|
}
|
|
1733
1759
|
function analyzeInputParameters(inputParameters, functionInfo) {
|
|
@@ -1892,17 +1918,16 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1892
1918
|
const interactiveMode = !options.json;
|
|
1893
1919
|
const renderer = interactiveMode ? createInteractiveRenderer() : createJsonRenderer();
|
|
1894
1920
|
try {
|
|
1895
|
-
const commandObj2 = args[args.length - 1];
|
|
1896
|
-
const options2 = commandObj2.opts();
|
|
1897
1921
|
emitDeprecationWarning({
|
|
1898
1922
|
cliCommandName,
|
|
1899
1923
|
deprecation: functionInfo.deprecation
|
|
1900
1924
|
});
|
|
1925
|
+
emitParamDeprecationWarnings({ options, parameters });
|
|
1901
1926
|
const isListCommand = functionInfo.type === "list";
|
|
1902
1927
|
const hasPaginationParams = parameters.some(
|
|
1903
1928
|
(p) => PAGINATION_PARAM_NAMES.has(p.name)
|
|
1904
1929
|
);
|
|
1905
|
-
const hasUserSpecifiedMaxItems = "maxItems" in
|
|
1930
|
+
const hasUserSpecifiedMaxItems = "maxItems" in options && options.maxItems !== void 0;
|
|
1906
1931
|
const outputMode = resolveOutputMode({
|
|
1907
1932
|
isListCommand,
|
|
1908
1933
|
hasPaginationParams,
|
|
@@ -1911,7 +1936,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1911
1936
|
const rawParams = convertCliArgsToSdkParams(
|
|
1912
1937
|
parameters,
|
|
1913
1938
|
args.slice(0, -1),
|
|
1914
|
-
|
|
1939
|
+
options
|
|
1915
1940
|
);
|
|
1916
1941
|
const schemaAliases2 = getSchemaAliases(schema);
|
|
1917
1942
|
if (schemaAliases2) {
|
|
@@ -1931,7 +1956,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1931
1956
|
functionInfo.name,
|
|
1932
1957
|
{
|
|
1933
1958
|
interactiveMode,
|
|
1934
|
-
debug: !!
|
|
1959
|
+
debug: !!options.debug || process.env.DEBUG === "true" || process.argv.includes("--debug")
|
|
1935
1960
|
}
|
|
1936
1961
|
);
|
|
1937
1962
|
} else {
|
|
@@ -2090,7 +2115,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2090
2115
|
`<${kebabName}>`,
|
|
2091
2116
|
param.description || `${kebabName} parameter`
|
|
2092
2117
|
);
|
|
2093
|
-
} else if (param.isPositional && !param.
|
|
2118
|
+
} else if (param.isPositional && !param.isDeprecated && !param.isAlias) {
|
|
2094
2119
|
command.argument(
|
|
2095
2120
|
`[${kebabName}]`,
|
|
2096
2121
|
param.description || `${kebabName} parameter`
|
|
@@ -2104,7 +2129,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2104
2129
|
flags.push(`--${kebabName}`);
|
|
2105
2130
|
if (param.type === "boolean") {
|
|
2106
2131
|
const opt = new commander.Option(flags.join(", "), param.description);
|
|
2107
|
-
if (param.
|
|
2132
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2108
2133
|
command.addOption(opt);
|
|
2109
2134
|
} else if (param.type === "array") {
|
|
2110
2135
|
const flagSignature = flags.join(", ") + ` <value>`;
|
|
@@ -2113,7 +2138,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2113
2138
|
opt.argParser(
|
|
2114
2139
|
(value, previous) => (previous || []).concat([value])
|
|
2115
2140
|
);
|
|
2116
|
-
if (param.
|
|
2141
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2117
2142
|
command.addOption(opt);
|
|
2118
2143
|
} else {
|
|
2119
2144
|
const flagSignature = flags.join(", ") + ` <${param.type}>`;
|
|
@@ -2121,7 +2146,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2121
2146
|
if (param.default !== void 0) {
|
|
2122
2147
|
opt.default(param.default);
|
|
2123
2148
|
}
|
|
2124
|
-
if (param.
|
|
2149
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2125
2150
|
command.addOption(opt);
|
|
2126
2151
|
}
|
|
2127
2152
|
}
|
|
@@ -2138,7 +2163,7 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
|
|
|
2138
2163
|
const sdkParams = {};
|
|
2139
2164
|
let argIndex = 0;
|
|
2140
2165
|
parameters.forEach((param) => {
|
|
2141
|
-
if ((param.required || param.isPositional && !param.
|
|
2166
|
+
if ((param.required || param.isPositional && !param.isDeprecated && !param.isAlias) && argIndex < positionalArgs.length) {
|
|
2142
2167
|
sdkParams[param.name] = convertValue(
|
|
2143
2168
|
positionalArgs[argIndex],
|
|
2144
2169
|
param.type,
|
|
@@ -4668,7 +4693,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4668
4693
|
// package.json with { type: 'json' }
|
|
4669
4694
|
var package_default2 = {
|
|
4670
4695
|
name: "@zapier/zapier-sdk-cli",
|
|
4671
|
-
version: "0.39.
|
|
4696
|
+
version: "0.39.3"};
|
|
4672
4697
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4673
4698
|
var CACHE_RESET_INTERVAL_MS = (() => {
|
|
4674
4699
|
const { ZAPIER_SDK_UPDATE_CHECK_INTERVAL_MS = `${ONE_DAY_MS}` } = process.env;
|
package/dist/cli.mjs
CHANGED
|
@@ -1065,7 +1065,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
|
|
|
1065
1065
|
|
|
1066
1066
|
// package.json
|
|
1067
1067
|
var package_default = {
|
|
1068
|
-
version: "0.39.
|
|
1068
|
+
version: "0.39.3"};
|
|
1069
1069
|
|
|
1070
1070
|
// src/telemetry/builders.ts
|
|
1071
1071
|
function createCliBaseEvent(context = {}) {
|
|
@@ -1590,6 +1590,27 @@ function emitDeprecationWarning({
|
|
|
1590
1590
|
console.warn(chalk7.yellow(` ${deprecation.message}`));
|
|
1591
1591
|
console.warn();
|
|
1592
1592
|
}
|
|
1593
|
+
function emitParamDeprecationWarnings({
|
|
1594
|
+
options,
|
|
1595
|
+
parameters
|
|
1596
|
+
}) {
|
|
1597
|
+
for (const param of parameters) {
|
|
1598
|
+
if (!param.isDeprecated) continue;
|
|
1599
|
+
const value = options[param.name];
|
|
1600
|
+
if (value === void 0) continue;
|
|
1601
|
+
if (Array.isArray(value) && value.length === 0) continue;
|
|
1602
|
+
console.warn();
|
|
1603
|
+
console.warn(
|
|
1604
|
+
chalk7.yellow.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk7.yellow(
|
|
1605
|
+
` - \`${toKebabCase(param.name)}\` is deprecated and may be removed in a future release.`
|
|
1606
|
+
)
|
|
1607
|
+
);
|
|
1608
|
+
if (param.deprecationMessage) {
|
|
1609
|
+
console.warn(chalk7.yellow(` ${param.deprecationMessage}`));
|
|
1610
|
+
}
|
|
1611
|
+
console.warn();
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1593
1614
|
function resolveOutputMode({
|
|
1594
1615
|
isListCommand,
|
|
1595
1616
|
hasPaginationParams,
|
|
@@ -1628,11 +1649,15 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1628
1649
|
let required = true;
|
|
1629
1650
|
let defaultValue = void 0;
|
|
1630
1651
|
let isDeprecated = false;
|
|
1652
|
+
let deprecationMessage;
|
|
1631
1653
|
while (true) {
|
|
1632
1654
|
const meta = baseSchema.meta?.();
|
|
1633
1655
|
if (meta?.deprecated) {
|
|
1634
1656
|
isDeprecated = true;
|
|
1635
1657
|
}
|
|
1658
|
+
if (meta?.deprecationMessage && !deprecationMessage) {
|
|
1659
|
+
deprecationMessage = meta.deprecationMessage;
|
|
1660
|
+
}
|
|
1636
1661
|
if (baseSchema instanceof z.ZodOptional) {
|
|
1637
1662
|
required = false;
|
|
1638
1663
|
baseSchema = baseSchema._zod.def.innerType;
|
|
@@ -1689,7 +1714,8 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1689
1714
|
hasResolver: paramHasResolver,
|
|
1690
1715
|
isPositional: isPositional(schema),
|
|
1691
1716
|
elementType,
|
|
1692
|
-
|
|
1717
|
+
deprecationMessage,
|
|
1718
|
+
isDeprecated
|
|
1693
1719
|
};
|
|
1694
1720
|
}
|
|
1695
1721
|
function analyzeInputParameters(inputParameters, functionInfo) {
|
|
@@ -1854,17 +1880,16 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1854
1880
|
const interactiveMode = !options.json;
|
|
1855
1881
|
const renderer = interactiveMode ? createInteractiveRenderer() : createJsonRenderer();
|
|
1856
1882
|
try {
|
|
1857
|
-
const commandObj2 = args[args.length - 1];
|
|
1858
|
-
const options2 = commandObj2.opts();
|
|
1859
1883
|
emitDeprecationWarning({
|
|
1860
1884
|
cliCommandName,
|
|
1861
1885
|
deprecation: functionInfo.deprecation
|
|
1862
1886
|
});
|
|
1887
|
+
emitParamDeprecationWarnings({ options, parameters });
|
|
1863
1888
|
const isListCommand = functionInfo.type === "list";
|
|
1864
1889
|
const hasPaginationParams = parameters.some(
|
|
1865
1890
|
(p) => PAGINATION_PARAM_NAMES.has(p.name)
|
|
1866
1891
|
);
|
|
1867
|
-
const hasUserSpecifiedMaxItems = "maxItems" in
|
|
1892
|
+
const hasUserSpecifiedMaxItems = "maxItems" in options && options.maxItems !== void 0;
|
|
1868
1893
|
const outputMode = resolveOutputMode({
|
|
1869
1894
|
isListCommand,
|
|
1870
1895
|
hasPaginationParams,
|
|
@@ -1873,7 +1898,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1873
1898
|
const rawParams = convertCliArgsToSdkParams(
|
|
1874
1899
|
parameters,
|
|
1875
1900
|
args.slice(0, -1),
|
|
1876
|
-
|
|
1901
|
+
options
|
|
1877
1902
|
);
|
|
1878
1903
|
const schemaAliases2 = getSchemaAliases(schema);
|
|
1879
1904
|
if (schemaAliases2) {
|
|
@@ -1893,7 +1918,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1893
1918
|
functionInfo.name,
|
|
1894
1919
|
{
|
|
1895
1920
|
interactiveMode,
|
|
1896
|
-
debug: !!
|
|
1921
|
+
debug: !!options.debug || process.env.DEBUG === "true" || process.argv.includes("--debug")
|
|
1897
1922
|
}
|
|
1898
1923
|
);
|
|
1899
1924
|
} else {
|
|
@@ -2052,7 +2077,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2052
2077
|
`<${kebabName}>`,
|
|
2053
2078
|
param.description || `${kebabName} parameter`
|
|
2054
2079
|
);
|
|
2055
|
-
} else if (param.isPositional && !param.
|
|
2080
|
+
} else if (param.isPositional && !param.isDeprecated && !param.isAlias) {
|
|
2056
2081
|
command.argument(
|
|
2057
2082
|
`[${kebabName}]`,
|
|
2058
2083
|
param.description || `${kebabName} parameter`
|
|
@@ -2066,7 +2091,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2066
2091
|
flags.push(`--${kebabName}`);
|
|
2067
2092
|
if (param.type === "boolean") {
|
|
2068
2093
|
const opt = new Option(flags.join(", "), param.description);
|
|
2069
|
-
if (param.
|
|
2094
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2070
2095
|
command.addOption(opt);
|
|
2071
2096
|
} else if (param.type === "array") {
|
|
2072
2097
|
const flagSignature = flags.join(", ") + ` <value>`;
|
|
@@ -2075,7 +2100,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2075
2100
|
opt.argParser(
|
|
2076
2101
|
(value, previous) => (previous || []).concat([value])
|
|
2077
2102
|
);
|
|
2078
|
-
if (param.
|
|
2103
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2079
2104
|
command.addOption(opt);
|
|
2080
2105
|
} else {
|
|
2081
2106
|
const flagSignature = flags.join(", ") + ` <${param.type}>`;
|
|
@@ -2083,7 +2108,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2083
2108
|
if (param.default !== void 0) {
|
|
2084
2109
|
opt.default(param.default);
|
|
2085
2110
|
}
|
|
2086
|
-
if (param.
|
|
2111
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2087
2112
|
command.addOption(opt);
|
|
2088
2113
|
}
|
|
2089
2114
|
}
|
|
@@ -2100,7 +2125,7 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
|
|
|
2100
2125
|
const sdkParams = {};
|
|
2101
2126
|
let argIndex = 0;
|
|
2102
2127
|
parameters.forEach((param) => {
|
|
2103
|
-
if ((param.required || param.isPositional && !param.
|
|
2128
|
+
if ((param.required || param.isPositional && !param.isDeprecated && !param.isAlias) && argIndex < positionalArgs.length) {
|
|
2104
2129
|
sdkParams[param.name] = convertValue(
|
|
2105
2130
|
positionalArgs[argIndex],
|
|
2106
2131
|
param.type,
|
|
@@ -4630,7 +4655,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4630
4655
|
// package.json with { type: 'json' }
|
|
4631
4656
|
var package_default2 = {
|
|
4632
4657
|
name: "@zapier/zapier-sdk-cli",
|
|
4633
|
-
version: "0.39.
|
|
4658
|
+
version: "0.39.3"};
|
|
4634
4659
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4635
4660
|
var CACHE_RESET_INTERVAL_MS = (() => {
|
|
4636
4661
|
const { ZAPIER_SDK_UPDATE_CHECK_INTERVAL_MS = `${ONE_DAY_MS}` } = process.env;
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/dist/package.json
CHANGED
|
@@ -135,6 +135,24 @@ function emitDeprecationWarning({ cliCommandName, deprecation, }) {
|
|
|
135
135
|
console.warn(chalk.yellow(` ${deprecation.message}`));
|
|
136
136
|
console.warn();
|
|
137
137
|
}
|
|
138
|
+
function emitParamDeprecationWarnings({ options, parameters, }) {
|
|
139
|
+
for (const param of parameters) {
|
|
140
|
+
if (!param.isDeprecated)
|
|
141
|
+
continue;
|
|
142
|
+
const value = options[param.name];
|
|
143
|
+
if (value === undefined)
|
|
144
|
+
continue;
|
|
145
|
+
if (Array.isArray(value) && value.length === 0)
|
|
146
|
+
continue;
|
|
147
|
+
console.warn();
|
|
148
|
+
console.warn(chalk.yellow.bold("⚠️ DEPRECATION WARNING") +
|
|
149
|
+
chalk.yellow(` - \`${toKebabCase(param.name)}\` is deprecated and may be removed in a future release.`));
|
|
150
|
+
if (param.deprecationMessage) {
|
|
151
|
+
console.warn(chalk.yellow(` ${param.deprecationMessage}`));
|
|
152
|
+
}
|
|
153
|
+
console.warn();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
138
156
|
function resolveOutputMode({ isListCommand, hasPaginationParams, hasUserSpecifiedMaxItems, }) {
|
|
139
157
|
if (!isListCommand || !hasPaginationParams)
|
|
140
158
|
return "single";
|
|
@@ -173,6 +191,7 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
173
191
|
let required = true;
|
|
174
192
|
let defaultValue = undefined;
|
|
175
193
|
let isDeprecated = false;
|
|
194
|
+
let deprecationMessage;
|
|
176
195
|
// Unwrap optional, default, and nullable wrappers - keep unwrapping until we get to the base type.
|
|
177
196
|
// Check .meta()?.deprecated at each level since it doesn't propagate through wrappers.
|
|
178
197
|
while (true) {
|
|
@@ -180,6 +199,9 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
180
199
|
if (meta?.deprecated) {
|
|
181
200
|
isDeprecated = true;
|
|
182
201
|
}
|
|
202
|
+
if (meta?.deprecationMessage && !deprecationMessage) {
|
|
203
|
+
deprecationMessage = meta.deprecationMessage;
|
|
204
|
+
}
|
|
183
205
|
if (baseSchema instanceof z.ZodOptional) {
|
|
184
206
|
required = false;
|
|
185
207
|
baseSchema = baseSchema._zod.def.innerType;
|
|
@@ -254,7 +276,8 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
254
276
|
hasResolver: paramHasResolver,
|
|
255
277
|
isPositional: isPositional(schema),
|
|
256
278
|
elementType,
|
|
257
|
-
|
|
279
|
+
deprecationMessage,
|
|
280
|
+
isDeprecated,
|
|
258
281
|
};
|
|
259
282
|
}
|
|
260
283
|
/**
|
|
@@ -432,21 +455,20 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
432
455
|
let success = true;
|
|
433
456
|
let errorMessage = null;
|
|
434
457
|
let resolvedParams = {};
|
|
435
|
-
//
|
|
458
|
+
// The last argument is always the command object with parsed options
|
|
436
459
|
const commandObj = args[args.length - 1];
|
|
437
460
|
const options = commandObj.opts();
|
|
461
|
+
// interactiveMode is true by default; --json disables it
|
|
438
462
|
const interactiveMode = !options.json;
|
|
439
463
|
const renderer = interactiveMode
|
|
440
464
|
? createInteractiveRenderer()
|
|
441
465
|
: createJsonRenderer();
|
|
442
466
|
try {
|
|
443
|
-
// The last argument is always the command object with parsed options
|
|
444
|
-
const commandObj = args[args.length - 1];
|
|
445
|
-
const options = commandObj.opts();
|
|
446
467
|
emitDeprecationWarning({
|
|
447
468
|
cliCommandName,
|
|
448
469
|
deprecation: functionInfo.deprecation,
|
|
449
470
|
});
|
|
471
|
+
emitParamDeprecationWarnings({ options, parameters });
|
|
450
472
|
// Check if this is a list command for pagination
|
|
451
473
|
const isListCommand = functionInfo.type === "list";
|
|
452
474
|
const hasPaginationParams = parameters.some((p) => PAGINATION_PARAM_NAMES.has(p.name));
|
|
@@ -637,7 +659,7 @@ function addCommand(program, commandName, config) {
|
|
|
637
659
|
// Required parameters without resolvers become required positional arguments
|
|
638
660
|
command.argument(`<${kebabName}>`, param.description || `${kebabName} parameter`);
|
|
639
661
|
}
|
|
640
|
-
else if (param.isPositional && !param.
|
|
662
|
+
else if (param.isPositional && !param.isDeprecated && !param.isAlias) {
|
|
641
663
|
// Optional parameters marked as positional become optional positional arguments
|
|
642
664
|
command.argument(`[${kebabName}]`, param.description || `${kebabName} parameter`);
|
|
643
665
|
}
|
|
@@ -652,7 +674,7 @@ function addCommand(program, commandName, config) {
|
|
|
652
674
|
flags.push(`--${kebabName}`);
|
|
653
675
|
if (param.type === "boolean") {
|
|
654
676
|
const opt = new Option(flags.join(", "), param.description);
|
|
655
|
-
if (param.
|
|
677
|
+
if (param.isDeprecated)
|
|
656
678
|
opt.hideHelp();
|
|
657
679
|
command.addOption(opt);
|
|
658
680
|
}
|
|
@@ -662,7 +684,7 @@ function addCommand(program, commandName, config) {
|
|
|
662
684
|
const opt = new Option(flagSignature, param.description || "");
|
|
663
685
|
opt.default([]);
|
|
664
686
|
opt.argParser((value, previous) => (previous || []).concat([value]));
|
|
665
|
-
if (param.
|
|
687
|
+
if (param.isDeprecated)
|
|
666
688
|
opt.hideHelp();
|
|
667
689
|
command.addOption(opt);
|
|
668
690
|
}
|
|
@@ -672,7 +694,7 @@ function addCommand(program, commandName, config) {
|
|
|
672
694
|
if (param.default !== undefined) {
|
|
673
695
|
opt.default(param.default);
|
|
674
696
|
}
|
|
675
|
-
if (param.
|
|
697
|
+
if (param.isDeprecated)
|
|
676
698
|
opt.hideHelp();
|
|
677
699
|
command.addOption(opt);
|
|
678
700
|
}
|
|
@@ -698,7 +720,7 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
|
|
|
698
720
|
let argIndex = 0;
|
|
699
721
|
parameters.forEach((param) => {
|
|
700
722
|
if ((param.required ||
|
|
701
|
-
(param.isPositional && !param.
|
|
723
|
+
(param.isPositional && !param.isDeprecated && !param.isAlias)) &&
|
|
702
724
|
argIndex < positionalArgs.length) {
|
|
703
725
|
// Use the original camelCase parameter name for the SDK
|
|
704
726
|
sdkParams[param.name] = convertValue(positionalArgs[argIndex], param.type, param.elementType);
|