@zapier/zapier-sdk-cli 0.39.2 → 0.39.4
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 +15 -0
- package/README.md +6 -6
- package/dist/cli.cjs +41 -13
- package/dist/cli.mjs +41 -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/src/utils/cli-renderer.js +3 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @zapier/zapier-sdk-cli
|
|
2
2
|
|
|
3
|
+
## 0.39.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5aff110: Fix bug previously including envelope for curl with json input
|
|
8
|
+
|
|
9
|
+
## 0.39.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b250545: Connections - Replace isExpired with expired
|
|
14
|
+
- Updated dependencies [b250545]
|
|
15
|
+
- @zapier/zapier-sdk@0.40.3
|
|
16
|
+
- @zapier/zapier-sdk-mcp@0.10.9
|
|
17
|
+
|
|
3
18
|
## 0.39.2
|
|
4
19
|
|
|
5
20
|
### 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.4"};
|
|
1107
1107
|
|
|
1108
1108
|
// src/telemetry/builders.ts
|
|
1109
1109
|
function createCliBaseEvent(context = {}) {
|
|
@@ -1339,6 +1339,9 @@ function createJsonRenderer() {
|
|
|
1339
1339
|
outputJson({ data: items, errors: [] });
|
|
1340
1340
|
},
|
|
1341
1341
|
renderItem(value, options) {
|
|
1342
|
+
if (value === void 0 && !options?.outputFile) {
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1342
1345
|
outputJson({
|
|
1343
1346
|
data: options?.outputFile ? { outputFile: options.outputFile } : value ?? null,
|
|
1344
1347
|
errors: []
|
|
@@ -1628,6 +1631,27 @@ function emitDeprecationWarning({
|
|
|
1628
1631
|
console.warn(chalk7__default.default.yellow(` ${deprecation.message}`));
|
|
1629
1632
|
console.warn();
|
|
1630
1633
|
}
|
|
1634
|
+
function emitParamDeprecationWarnings({
|
|
1635
|
+
options,
|
|
1636
|
+
parameters
|
|
1637
|
+
}) {
|
|
1638
|
+
for (const param of parameters) {
|
|
1639
|
+
if (!param.isDeprecated) continue;
|
|
1640
|
+
const value = options[param.name];
|
|
1641
|
+
if (value === void 0) continue;
|
|
1642
|
+
if (Array.isArray(value) && value.length === 0) continue;
|
|
1643
|
+
console.warn();
|
|
1644
|
+
console.warn(
|
|
1645
|
+
chalk7__default.default.yellow.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk7__default.default.yellow(
|
|
1646
|
+
` - \`${toKebabCase(param.name)}\` is deprecated and may be removed in a future release.`
|
|
1647
|
+
)
|
|
1648
|
+
);
|
|
1649
|
+
if (param.deprecationMessage) {
|
|
1650
|
+
console.warn(chalk7__default.default.yellow(` ${param.deprecationMessage}`));
|
|
1651
|
+
}
|
|
1652
|
+
console.warn();
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1631
1655
|
function resolveOutputMode({
|
|
1632
1656
|
isListCommand,
|
|
1633
1657
|
hasPaginationParams,
|
|
@@ -1666,11 +1690,15 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1666
1690
|
let required = true;
|
|
1667
1691
|
let defaultValue = void 0;
|
|
1668
1692
|
let isDeprecated = false;
|
|
1693
|
+
let deprecationMessage;
|
|
1669
1694
|
while (true) {
|
|
1670
1695
|
const meta = baseSchema.meta?.();
|
|
1671
1696
|
if (meta?.deprecated) {
|
|
1672
1697
|
isDeprecated = true;
|
|
1673
1698
|
}
|
|
1699
|
+
if (meta?.deprecationMessage && !deprecationMessage) {
|
|
1700
|
+
deprecationMessage = meta.deprecationMessage;
|
|
1701
|
+
}
|
|
1674
1702
|
if (baseSchema instanceof zod.z.ZodOptional) {
|
|
1675
1703
|
required = false;
|
|
1676
1704
|
baseSchema = baseSchema._zod.def.innerType;
|
|
@@ -1727,7 +1755,8 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1727
1755
|
hasResolver: paramHasResolver,
|
|
1728
1756
|
isPositional: zapierSdk.isPositional(schema),
|
|
1729
1757
|
elementType,
|
|
1730
|
-
|
|
1758
|
+
deprecationMessage,
|
|
1759
|
+
isDeprecated
|
|
1731
1760
|
};
|
|
1732
1761
|
}
|
|
1733
1762
|
function analyzeInputParameters(inputParameters, functionInfo) {
|
|
@@ -1892,17 +1921,16 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1892
1921
|
const interactiveMode = !options.json;
|
|
1893
1922
|
const renderer = interactiveMode ? createInteractiveRenderer() : createJsonRenderer();
|
|
1894
1923
|
try {
|
|
1895
|
-
const commandObj2 = args[args.length - 1];
|
|
1896
|
-
const options2 = commandObj2.opts();
|
|
1897
1924
|
emitDeprecationWarning({
|
|
1898
1925
|
cliCommandName,
|
|
1899
1926
|
deprecation: functionInfo.deprecation
|
|
1900
1927
|
});
|
|
1928
|
+
emitParamDeprecationWarnings({ options, parameters });
|
|
1901
1929
|
const isListCommand = functionInfo.type === "list";
|
|
1902
1930
|
const hasPaginationParams = parameters.some(
|
|
1903
1931
|
(p) => PAGINATION_PARAM_NAMES.has(p.name)
|
|
1904
1932
|
);
|
|
1905
|
-
const hasUserSpecifiedMaxItems = "maxItems" in
|
|
1933
|
+
const hasUserSpecifiedMaxItems = "maxItems" in options && options.maxItems !== void 0;
|
|
1906
1934
|
const outputMode = resolveOutputMode({
|
|
1907
1935
|
isListCommand,
|
|
1908
1936
|
hasPaginationParams,
|
|
@@ -1911,7 +1939,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1911
1939
|
const rawParams = convertCliArgsToSdkParams(
|
|
1912
1940
|
parameters,
|
|
1913
1941
|
args.slice(0, -1),
|
|
1914
|
-
|
|
1942
|
+
options
|
|
1915
1943
|
);
|
|
1916
1944
|
const schemaAliases2 = getSchemaAliases(schema);
|
|
1917
1945
|
if (schemaAliases2) {
|
|
@@ -1931,7 +1959,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1931
1959
|
functionInfo.name,
|
|
1932
1960
|
{
|
|
1933
1961
|
interactiveMode,
|
|
1934
|
-
debug: !!
|
|
1962
|
+
debug: !!options.debug || process.env.DEBUG === "true" || process.argv.includes("--debug")
|
|
1935
1963
|
}
|
|
1936
1964
|
);
|
|
1937
1965
|
} else {
|
|
@@ -2090,7 +2118,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2090
2118
|
`<${kebabName}>`,
|
|
2091
2119
|
param.description || `${kebabName} parameter`
|
|
2092
2120
|
);
|
|
2093
|
-
} else if (param.isPositional && !param.
|
|
2121
|
+
} else if (param.isPositional && !param.isDeprecated && !param.isAlias) {
|
|
2094
2122
|
command.argument(
|
|
2095
2123
|
`[${kebabName}]`,
|
|
2096
2124
|
param.description || `${kebabName} parameter`
|
|
@@ -2104,7 +2132,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2104
2132
|
flags.push(`--${kebabName}`);
|
|
2105
2133
|
if (param.type === "boolean") {
|
|
2106
2134
|
const opt = new commander.Option(flags.join(", "), param.description);
|
|
2107
|
-
if (param.
|
|
2135
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2108
2136
|
command.addOption(opt);
|
|
2109
2137
|
} else if (param.type === "array") {
|
|
2110
2138
|
const flagSignature = flags.join(", ") + ` <value>`;
|
|
@@ -2113,7 +2141,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2113
2141
|
opt.argParser(
|
|
2114
2142
|
(value, previous) => (previous || []).concat([value])
|
|
2115
2143
|
);
|
|
2116
|
-
if (param.
|
|
2144
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2117
2145
|
command.addOption(opt);
|
|
2118
2146
|
} else {
|
|
2119
2147
|
const flagSignature = flags.join(", ") + ` <${param.type}>`;
|
|
@@ -2121,7 +2149,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2121
2149
|
if (param.default !== void 0) {
|
|
2122
2150
|
opt.default(param.default);
|
|
2123
2151
|
}
|
|
2124
|
-
if (param.
|
|
2152
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2125
2153
|
command.addOption(opt);
|
|
2126
2154
|
}
|
|
2127
2155
|
}
|
|
@@ -2138,7 +2166,7 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
|
|
|
2138
2166
|
const sdkParams = {};
|
|
2139
2167
|
let argIndex = 0;
|
|
2140
2168
|
parameters.forEach((param) => {
|
|
2141
|
-
if ((param.required || param.isPositional && !param.
|
|
2169
|
+
if ((param.required || param.isPositional && !param.isDeprecated && !param.isAlias) && argIndex < positionalArgs.length) {
|
|
2142
2170
|
sdkParams[param.name] = convertValue(
|
|
2143
2171
|
positionalArgs[argIndex],
|
|
2144
2172
|
param.type,
|
|
@@ -4668,7 +4696,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4668
4696
|
// package.json with { type: 'json' }
|
|
4669
4697
|
var package_default2 = {
|
|
4670
4698
|
name: "@zapier/zapier-sdk-cli",
|
|
4671
|
-
version: "0.39.
|
|
4699
|
+
version: "0.39.4"};
|
|
4672
4700
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4673
4701
|
var CACHE_RESET_INTERVAL_MS = (() => {
|
|
4674
4702
|
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.4"};
|
|
1069
1069
|
|
|
1070
1070
|
// src/telemetry/builders.ts
|
|
1071
1071
|
function createCliBaseEvent(context = {}) {
|
|
@@ -1301,6 +1301,9 @@ function createJsonRenderer() {
|
|
|
1301
1301
|
outputJson({ data: items, errors: [] });
|
|
1302
1302
|
},
|
|
1303
1303
|
renderItem(value, options) {
|
|
1304
|
+
if (value === void 0 && !options?.outputFile) {
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1304
1307
|
outputJson({
|
|
1305
1308
|
data: options?.outputFile ? { outputFile: options.outputFile } : value ?? null,
|
|
1306
1309
|
errors: []
|
|
@@ -1590,6 +1593,27 @@ function emitDeprecationWarning({
|
|
|
1590
1593
|
console.warn(chalk7.yellow(` ${deprecation.message}`));
|
|
1591
1594
|
console.warn();
|
|
1592
1595
|
}
|
|
1596
|
+
function emitParamDeprecationWarnings({
|
|
1597
|
+
options,
|
|
1598
|
+
parameters
|
|
1599
|
+
}) {
|
|
1600
|
+
for (const param of parameters) {
|
|
1601
|
+
if (!param.isDeprecated) continue;
|
|
1602
|
+
const value = options[param.name];
|
|
1603
|
+
if (value === void 0) continue;
|
|
1604
|
+
if (Array.isArray(value) && value.length === 0) continue;
|
|
1605
|
+
console.warn();
|
|
1606
|
+
console.warn(
|
|
1607
|
+
chalk7.yellow.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk7.yellow(
|
|
1608
|
+
` - \`${toKebabCase(param.name)}\` is deprecated and may be removed in a future release.`
|
|
1609
|
+
)
|
|
1610
|
+
);
|
|
1611
|
+
if (param.deprecationMessage) {
|
|
1612
|
+
console.warn(chalk7.yellow(` ${param.deprecationMessage}`));
|
|
1613
|
+
}
|
|
1614
|
+
console.warn();
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1593
1617
|
function resolveOutputMode({
|
|
1594
1618
|
isListCommand,
|
|
1595
1619
|
hasPaginationParams,
|
|
@@ -1628,11 +1652,15 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1628
1652
|
let required = true;
|
|
1629
1653
|
let defaultValue = void 0;
|
|
1630
1654
|
let isDeprecated = false;
|
|
1655
|
+
let deprecationMessage;
|
|
1631
1656
|
while (true) {
|
|
1632
1657
|
const meta = baseSchema.meta?.();
|
|
1633
1658
|
if (meta?.deprecated) {
|
|
1634
1659
|
isDeprecated = true;
|
|
1635
1660
|
}
|
|
1661
|
+
if (meta?.deprecationMessage && !deprecationMessage) {
|
|
1662
|
+
deprecationMessage = meta.deprecationMessage;
|
|
1663
|
+
}
|
|
1636
1664
|
if (baseSchema instanceof z.ZodOptional) {
|
|
1637
1665
|
required = false;
|
|
1638
1666
|
baseSchema = baseSchema._zod.def.innerType;
|
|
@@ -1689,7 +1717,8 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1689
1717
|
hasResolver: paramHasResolver,
|
|
1690
1718
|
isPositional: isPositional(schema),
|
|
1691
1719
|
elementType,
|
|
1692
|
-
|
|
1720
|
+
deprecationMessage,
|
|
1721
|
+
isDeprecated
|
|
1693
1722
|
};
|
|
1694
1723
|
}
|
|
1695
1724
|
function analyzeInputParameters(inputParameters, functionInfo) {
|
|
@@ -1854,17 +1883,16 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1854
1883
|
const interactiveMode = !options.json;
|
|
1855
1884
|
const renderer = interactiveMode ? createInteractiveRenderer() : createJsonRenderer();
|
|
1856
1885
|
try {
|
|
1857
|
-
const commandObj2 = args[args.length - 1];
|
|
1858
|
-
const options2 = commandObj2.opts();
|
|
1859
1886
|
emitDeprecationWarning({
|
|
1860
1887
|
cliCommandName,
|
|
1861
1888
|
deprecation: functionInfo.deprecation
|
|
1862
1889
|
});
|
|
1890
|
+
emitParamDeprecationWarnings({ options, parameters });
|
|
1863
1891
|
const isListCommand = functionInfo.type === "list";
|
|
1864
1892
|
const hasPaginationParams = parameters.some(
|
|
1865
1893
|
(p) => PAGINATION_PARAM_NAMES.has(p.name)
|
|
1866
1894
|
);
|
|
1867
|
-
const hasUserSpecifiedMaxItems = "maxItems" in
|
|
1895
|
+
const hasUserSpecifiedMaxItems = "maxItems" in options && options.maxItems !== void 0;
|
|
1868
1896
|
const outputMode = resolveOutputMode({
|
|
1869
1897
|
isListCommand,
|
|
1870
1898
|
hasPaginationParams,
|
|
@@ -1873,7 +1901,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1873
1901
|
const rawParams = convertCliArgsToSdkParams(
|
|
1874
1902
|
parameters,
|
|
1875
1903
|
args.slice(0, -1),
|
|
1876
|
-
|
|
1904
|
+
options
|
|
1877
1905
|
);
|
|
1878
1906
|
const schemaAliases2 = getSchemaAliases(schema);
|
|
1879
1907
|
if (schemaAliases2) {
|
|
@@ -1893,7 +1921,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1893
1921
|
functionInfo.name,
|
|
1894
1922
|
{
|
|
1895
1923
|
interactiveMode,
|
|
1896
|
-
debug: !!
|
|
1924
|
+
debug: !!options.debug || process.env.DEBUG === "true" || process.argv.includes("--debug")
|
|
1897
1925
|
}
|
|
1898
1926
|
);
|
|
1899
1927
|
} else {
|
|
@@ -2052,7 +2080,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2052
2080
|
`<${kebabName}>`,
|
|
2053
2081
|
param.description || `${kebabName} parameter`
|
|
2054
2082
|
);
|
|
2055
|
-
} else if (param.isPositional && !param.
|
|
2083
|
+
} else if (param.isPositional && !param.isDeprecated && !param.isAlias) {
|
|
2056
2084
|
command.argument(
|
|
2057
2085
|
`[${kebabName}]`,
|
|
2058
2086
|
param.description || `${kebabName} parameter`
|
|
@@ -2066,7 +2094,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2066
2094
|
flags.push(`--${kebabName}`);
|
|
2067
2095
|
if (param.type === "boolean") {
|
|
2068
2096
|
const opt = new Option(flags.join(", "), param.description);
|
|
2069
|
-
if (param.
|
|
2097
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2070
2098
|
command.addOption(opt);
|
|
2071
2099
|
} else if (param.type === "array") {
|
|
2072
2100
|
const flagSignature = flags.join(", ") + ` <value>`;
|
|
@@ -2075,7 +2103,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2075
2103
|
opt.argParser(
|
|
2076
2104
|
(value, previous) => (previous || []).concat([value])
|
|
2077
2105
|
);
|
|
2078
|
-
if (param.
|
|
2106
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2079
2107
|
command.addOption(opt);
|
|
2080
2108
|
} else {
|
|
2081
2109
|
const flagSignature = flags.join(", ") + ` <${param.type}>`;
|
|
@@ -2083,7 +2111,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2083
2111
|
if (param.default !== void 0) {
|
|
2084
2112
|
opt.default(param.default);
|
|
2085
2113
|
}
|
|
2086
|
-
if (param.
|
|
2114
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2087
2115
|
command.addOption(opt);
|
|
2088
2116
|
}
|
|
2089
2117
|
}
|
|
@@ -2100,7 +2128,7 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
|
|
|
2100
2128
|
const sdkParams = {};
|
|
2101
2129
|
let argIndex = 0;
|
|
2102
2130
|
parameters.forEach((param) => {
|
|
2103
|
-
if ((param.required || param.isPositional && !param.
|
|
2131
|
+
if ((param.required || param.isPositional && !param.isDeprecated && !param.isAlias) && argIndex < positionalArgs.length) {
|
|
2104
2132
|
sdkParams[param.name] = convertValue(
|
|
2105
2133
|
positionalArgs[argIndex],
|
|
2106
2134
|
param.type,
|
|
@@ -4630,7 +4658,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4630
4658
|
// package.json with { type: 'json' }
|
|
4631
4659
|
var package_default2 = {
|
|
4632
4660
|
name: "@zapier/zapier-sdk-cli",
|
|
4633
|
-
version: "0.39.
|
|
4661
|
+
version: "0.39.4"};
|
|
4634
4662
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4635
4663
|
var CACHE_RESET_INTERVAL_MS = (() => {
|
|
4636
4664
|
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);
|
|
@@ -76,6 +76,9 @@ export function createJsonRenderer() {
|
|
|
76
76
|
outputJson({ data: items, errors: [] });
|
|
77
77
|
},
|
|
78
78
|
renderItem(value, options) {
|
|
79
|
+
if (value === undefined && !options?.outputFile) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
79
82
|
outputJson({
|
|
80
83
|
data: options?.outputFile
|
|
81
84
|
? { outputFile: options.outputFile }
|