@zapier/zapier-sdk-cli 0.39.1 → 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 +18 -0
- package/README.md +10 -10
- package/dist/cli.cjs +53 -16
- package/dist/cli.mjs +53 -16
- 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 +48 -11
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
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
|
+
|
|
12
|
+
## 0.39.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 362bc56: Make sure CLI only shows non-deprecated positional parameters.
|
|
17
|
+
- Updated dependencies [362bc56]
|
|
18
|
+
- @zapier/zapier-sdk@0.40.2
|
|
19
|
+
- @zapier/zapier-sdk-mcp@0.10.8
|
|
20
|
+
|
|
3
21
|
## 0.39.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -409,18 +409,18 @@ Find the first connection matching the criteria
|
|
|
409
409
|
|
|
410
410
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
411
411
|
| ------------------ | --------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
412
|
+
| `[app]` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
412
413
|
| `--search` | `string` | ❌ | — | — | Search term to filter connections by title |
|
|
413
414
|
| `--title` | `string` | ❌ | — | — | Filter connections by exact title match (searches first, then filters locally) |
|
|
414
415
|
| `--owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own connections or a specific user ID |
|
|
415
|
-
| `--app` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
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 [--search] [--title] [--owner] [--
|
|
423
|
+
npx zapier-sdk find-first-connection [app] [--search] [--title] [--owner] [--account] [--include-shared] [--expired]
|
|
424
424
|
```
|
|
425
425
|
|
|
426
426
|
#### `find-unique-connection`
|
|
@@ -431,18 +431,18 @@ Find a unique connection matching the criteria
|
|
|
431
431
|
|
|
432
432
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
433
433
|
| ------------------ | --------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
434
|
+
| `[app]` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
434
435
|
| `--search` | `string` | ❌ | — | — | Search term to filter connections by title |
|
|
435
436
|
| `--title` | `string` | ❌ | — | — | Filter connections by exact title match (searches first, then filters locally) |
|
|
436
437
|
| `--owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own connections or a specific user ID |
|
|
437
|
-
| `--app` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
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 [--search] [--title] [--owner] [--
|
|
445
|
+
npx zapier-sdk find-unique-connection [app] [--search] [--title] [--owner] [--account] [--include-shared] [--expired]
|
|
446
446
|
```
|
|
447
447
|
|
|
448
448
|
#### `get-connection`
|
|
@@ -469,14 +469,14 @@ List available connections with optional filtering
|
|
|
469
469
|
|
|
470
470
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
471
471
|
| ------------------ | --------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
472
|
+
| `[app]` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
472
473
|
| `--search` | `string` | ❌ | — | — | Search term to filter connections by title |
|
|
473
474
|
| `--title` | `string` | ❌ | — | — | Filter connections by exact title match (searches first, then filters locally) |
|
|
474
475
|
| `--owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own connections or a specific user ID |
|
|
475
|
-
| `--app` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
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 [--search] [--title] [--owner] [--
|
|
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
|
|
@@ -695,9 +695,9 @@ List records in a table with optional filtering and sorting
|
|
|
695
695
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
696
696
|
| --------------- | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
697
697
|
| `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
698
|
+
| ↳ `<field-key>` | `string` | ✅ | — | — | The field key to sort by |
|
|
698
699
|
| `--filters` | `array` | ❌ | — | — | Filter conditions for the query |
|
|
699
700
|
| `--sort` | `object` | ❌ | — | — | Sort records by a field |
|
|
700
|
-
| ↳ `<field-key>` | `string` | ✅ | — | — | The field key to sort by |
|
|
701
701
|
| ↳ `--direction` | `string` | ❌ | `"asc"` | — | Sort direction |
|
|
702
702
|
| `--page-size` | `number` | ❌ | — | — | Number of records per page (max 1000) |
|
|
703
703
|
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
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,
|
|
@@ -1637,6 +1658,9 @@ function resolveOutputMode({
|
|
|
1637
1658
|
if (hasUserSpecifiedMaxItems) return "collect";
|
|
1638
1659
|
return "paginate";
|
|
1639
1660
|
}
|
|
1661
|
+
function getSchemaAliases(schema) {
|
|
1662
|
+
return schema?.meta?.()?.aliases;
|
|
1663
|
+
}
|
|
1640
1664
|
function analyzeZodSchema(schema, functionInfo) {
|
|
1641
1665
|
const parameters = [];
|
|
1642
1666
|
const schemaDef = schema._zod?.def;
|
|
@@ -1663,11 +1687,15 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1663
1687
|
let required = true;
|
|
1664
1688
|
let defaultValue = void 0;
|
|
1665
1689
|
let isDeprecated = false;
|
|
1690
|
+
let deprecationMessage;
|
|
1666
1691
|
while (true) {
|
|
1667
1692
|
const meta = baseSchema.meta?.();
|
|
1668
1693
|
if (meta?.deprecated) {
|
|
1669
1694
|
isDeprecated = true;
|
|
1670
1695
|
}
|
|
1696
|
+
if (meta?.deprecationMessage && !deprecationMessage) {
|
|
1697
|
+
deprecationMessage = meta.deprecationMessage;
|
|
1698
|
+
}
|
|
1671
1699
|
if (baseSchema instanceof zod.z.ZodOptional) {
|
|
1672
1700
|
required = false;
|
|
1673
1701
|
baseSchema = baseSchema._zod.def.innerType;
|
|
@@ -1724,7 +1752,8 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1724
1752
|
hasResolver: paramHasResolver,
|
|
1725
1753
|
isPositional: zapierSdk.isPositional(schema),
|
|
1726
1754
|
elementType,
|
|
1727
|
-
|
|
1755
|
+
deprecationMessage,
|
|
1756
|
+
isDeprecated
|
|
1728
1757
|
};
|
|
1729
1758
|
}
|
|
1730
1759
|
function analyzeInputParameters(inputParameters, functionInfo) {
|
|
@@ -1869,6 +1898,15 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1869
1898
|
const usesInputParameters = !functionInfo.inputSchema && !!functionInfo.inputParameters;
|
|
1870
1899
|
const schema = functionInfo.inputSchema;
|
|
1871
1900
|
const parameters = usesInputParameters ? analyzeInputParameters(functionInfo.inputParameters, functionInfo) : analyzeZodSchema(schema, functionInfo);
|
|
1901
|
+
const schemaAliases = getSchemaAliases(schema);
|
|
1902
|
+
if (schemaAliases) {
|
|
1903
|
+
const aliasedNames = new Set(Object.keys(schemaAliases));
|
|
1904
|
+
for (const param of parameters) {
|
|
1905
|
+
if (aliasedNames.has(param.name)) {
|
|
1906
|
+
param.isAlias = true;
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1872
1910
|
const description = functionInfo.description || schema?.description || `${cliCommandName} command`;
|
|
1873
1911
|
const handler = async (...args) => {
|
|
1874
1912
|
const startTime = Date.now();
|
|
@@ -1880,17 +1918,16 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1880
1918
|
const interactiveMode = !options.json;
|
|
1881
1919
|
const renderer = interactiveMode ? createInteractiveRenderer() : createJsonRenderer();
|
|
1882
1920
|
try {
|
|
1883
|
-
const commandObj2 = args[args.length - 1];
|
|
1884
|
-
const options2 = commandObj2.opts();
|
|
1885
1921
|
emitDeprecationWarning({
|
|
1886
1922
|
cliCommandName,
|
|
1887
1923
|
deprecation: functionInfo.deprecation
|
|
1888
1924
|
});
|
|
1925
|
+
emitParamDeprecationWarnings({ options, parameters });
|
|
1889
1926
|
const isListCommand = functionInfo.type === "list";
|
|
1890
1927
|
const hasPaginationParams = parameters.some(
|
|
1891
1928
|
(p) => PAGINATION_PARAM_NAMES.has(p.name)
|
|
1892
1929
|
);
|
|
1893
|
-
const hasUserSpecifiedMaxItems = "maxItems" in
|
|
1930
|
+
const hasUserSpecifiedMaxItems = "maxItems" in options && options.maxItems !== void 0;
|
|
1894
1931
|
const outputMode = resolveOutputMode({
|
|
1895
1932
|
isListCommand,
|
|
1896
1933
|
hasPaginationParams,
|
|
@@ -1899,11 +1936,11 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1899
1936
|
const rawParams = convertCliArgsToSdkParams(
|
|
1900
1937
|
parameters,
|
|
1901
1938
|
args.slice(0, -1),
|
|
1902
|
-
|
|
1939
|
+
options
|
|
1903
1940
|
);
|
|
1904
|
-
const
|
|
1905
|
-
if (
|
|
1906
|
-
for (const [oldName, newName] of Object.entries(
|
|
1941
|
+
const schemaAliases2 = getSchemaAliases(schema);
|
|
1942
|
+
if (schemaAliases2) {
|
|
1943
|
+
for (const [oldName, newName] of Object.entries(schemaAliases2)) {
|
|
1907
1944
|
if (oldName in rawParams && !(newName in rawParams)) {
|
|
1908
1945
|
rawParams[newName] = rawParams[oldName];
|
|
1909
1946
|
delete rawParams[oldName];
|
|
@@ -1919,7 +1956,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1919
1956
|
functionInfo.name,
|
|
1920
1957
|
{
|
|
1921
1958
|
interactiveMode,
|
|
1922
|
-
debug: !!
|
|
1959
|
+
debug: !!options.debug || process.env.DEBUG === "true" || process.argv.includes("--debug")
|
|
1923
1960
|
}
|
|
1924
1961
|
);
|
|
1925
1962
|
} else {
|
|
@@ -2078,7 +2115,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2078
2115
|
`<${kebabName}>`,
|
|
2079
2116
|
param.description || `${kebabName} parameter`
|
|
2080
2117
|
);
|
|
2081
|
-
} else if (param.isPositional) {
|
|
2118
|
+
} else if (param.isPositional && !param.isDeprecated && !param.isAlias) {
|
|
2082
2119
|
command.argument(
|
|
2083
2120
|
`[${kebabName}]`,
|
|
2084
2121
|
param.description || `${kebabName} parameter`
|
|
@@ -2092,7 +2129,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2092
2129
|
flags.push(`--${kebabName}`);
|
|
2093
2130
|
if (param.type === "boolean") {
|
|
2094
2131
|
const opt = new commander.Option(flags.join(", "), param.description);
|
|
2095
|
-
if (param.
|
|
2132
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2096
2133
|
command.addOption(opt);
|
|
2097
2134
|
} else if (param.type === "array") {
|
|
2098
2135
|
const flagSignature = flags.join(", ") + ` <value>`;
|
|
@@ -2101,7 +2138,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2101
2138
|
opt.argParser(
|
|
2102
2139
|
(value, previous) => (previous || []).concat([value])
|
|
2103
2140
|
);
|
|
2104
|
-
if (param.
|
|
2141
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2105
2142
|
command.addOption(opt);
|
|
2106
2143
|
} else {
|
|
2107
2144
|
const flagSignature = flags.join(", ") + ` <${param.type}>`;
|
|
@@ -2109,7 +2146,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2109
2146
|
if (param.default !== void 0) {
|
|
2110
2147
|
opt.default(param.default);
|
|
2111
2148
|
}
|
|
2112
|
-
if (param.
|
|
2149
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2113
2150
|
command.addOption(opt);
|
|
2114
2151
|
}
|
|
2115
2152
|
}
|
|
@@ -2126,7 +2163,7 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
|
|
|
2126
2163
|
const sdkParams = {};
|
|
2127
2164
|
let argIndex = 0;
|
|
2128
2165
|
parameters.forEach((param) => {
|
|
2129
|
-
if ((param.required || param.isPositional) && argIndex < positionalArgs.length) {
|
|
2166
|
+
if ((param.required || param.isPositional && !param.isDeprecated && !param.isAlias) && argIndex < positionalArgs.length) {
|
|
2130
2167
|
sdkParams[param.name] = convertValue(
|
|
2131
2168
|
positionalArgs[argIndex],
|
|
2132
2169
|
param.type,
|
|
@@ -4656,7 +4693,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4656
4693
|
// package.json with { type: 'json' }
|
|
4657
4694
|
var package_default2 = {
|
|
4658
4695
|
name: "@zapier/zapier-sdk-cli",
|
|
4659
|
-
version: "0.39.
|
|
4696
|
+
version: "0.39.3"};
|
|
4660
4697
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4661
4698
|
var CACHE_RESET_INTERVAL_MS = (() => {
|
|
4662
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,
|
|
@@ -1599,6 +1620,9 @@ function resolveOutputMode({
|
|
|
1599
1620
|
if (hasUserSpecifiedMaxItems) return "collect";
|
|
1600
1621
|
return "paginate";
|
|
1601
1622
|
}
|
|
1623
|
+
function getSchemaAliases(schema) {
|
|
1624
|
+
return schema?.meta?.()?.aliases;
|
|
1625
|
+
}
|
|
1602
1626
|
function analyzeZodSchema(schema, functionInfo) {
|
|
1603
1627
|
const parameters = [];
|
|
1604
1628
|
const schemaDef = schema._zod?.def;
|
|
@@ -1625,11 +1649,15 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1625
1649
|
let required = true;
|
|
1626
1650
|
let defaultValue = void 0;
|
|
1627
1651
|
let isDeprecated = false;
|
|
1652
|
+
let deprecationMessage;
|
|
1628
1653
|
while (true) {
|
|
1629
1654
|
const meta = baseSchema.meta?.();
|
|
1630
1655
|
if (meta?.deprecated) {
|
|
1631
1656
|
isDeprecated = true;
|
|
1632
1657
|
}
|
|
1658
|
+
if (meta?.deprecationMessage && !deprecationMessage) {
|
|
1659
|
+
deprecationMessage = meta.deprecationMessage;
|
|
1660
|
+
}
|
|
1633
1661
|
if (baseSchema instanceof z.ZodOptional) {
|
|
1634
1662
|
required = false;
|
|
1635
1663
|
baseSchema = baseSchema._zod.def.innerType;
|
|
@@ -1686,7 +1714,8 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
1686
1714
|
hasResolver: paramHasResolver,
|
|
1687
1715
|
isPositional: isPositional(schema),
|
|
1688
1716
|
elementType,
|
|
1689
|
-
|
|
1717
|
+
deprecationMessage,
|
|
1718
|
+
isDeprecated
|
|
1690
1719
|
};
|
|
1691
1720
|
}
|
|
1692
1721
|
function analyzeInputParameters(inputParameters, functionInfo) {
|
|
@@ -1831,6 +1860,15 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1831
1860
|
const usesInputParameters = !functionInfo.inputSchema && !!functionInfo.inputParameters;
|
|
1832
1861
|
const schema = functionInfo.inputSchema;
|
|
1833
1862
|
const parameters = usesInputParameters ? analyzeInputParameters(functionInfo.inputParameters, functionInfo) : analyzeZodSchema(schema, functionInfo);
|
|
1863
|
+
const schemaAliases = getSchemaAliases(schema);
|
|
1864
|
+
if (schemaAliases) {
|
|
1865
|
+
const aliasedNames = new Set(Object.keys(schemaAliases));
|
|
1866
|
+
for (const param of parameters) {
|
|
1867
|
+
if (aliasedNames.has(param.name)) {
|
|
1868
|
+
param.isAlias = true;
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1834
1872
|
const description = functionInfo.description || schema?.description || `${cliCommandName} command`;
|
|
1835
1873
|
const handler = async (...args) => {
|
|
1836
1874
|
const startTime = Date.now();
|
|
@@ -1842,17 +1880,16 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1842
1880
|
const interactiveMode = !options.json;
|
|
1843
1881
|
const renderer = interactiveMode ? createInteractiveRenderer() : createJsonRenderer();
|
|
1844
1882
|
try {
|
|
1845
|
-
const commandObj2 = args[args.length - 1];
|
|
1846
|
-
const options2 = commandObj2.opts();
|
|
1847
1883
|
emitDeprecationWarning({
|
|
1848
1884
|
cliCommandName,
|
|
1849
1885
|
deprecation: functionInfo.deprecation
|
|
1850
1886
|
});
|
|
1887
|
+
emitParamDeprecationWarnings({ options, parameters });
|
|
1851
1888
|
const isListCommand = functionInfo.type === "list";
|
|
1852
1889
|
const hasPaginationParams = parameters.some(
|
|
1853
1890
|
(p) => PAGINATION_PARAM_NAMES.has(p.name)
|
|
1854
1891
|
);
|
|
1855
|
-
const hasUserSpecifiedMaxItems = "maxItems" in
|
|
1892
|
+
const hasUserSpecifiedMaxItems = "maxItems" in options && options.maxItems !== void 0;
|
|
1856
1893
|
const outputMode = resolveOutputMode({
|
|
1857
1894
|
isListCommand,
|
|
1858
1895
|
hasPaginationParams,
|
|
@@ -1861,11 +1898,11 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1861
1898
|
const rawParams = convertCliArgsToSdkParams(
|
|
1862
1899
|
parameters,
|
|
1863
1900
|
args.slice(0, -1),
|
|
1864
|
-
|
|
1901
|
+
options
|
|
1865
1902
|
);
|
|
1866
|
-
const
|
|
1867
|
-
if (
|
|
1868
|
-
for (const [oldName, newName] of Object.entries(
|
|
1903
|
+
const schemaAliases2 = getSchemaAliases(schema);
|
|
1904
|
+
if (schemaAliases2) {
|
|
1905
|
+
for (const [oldName, newName] of Object.entries(schemaAliases2)) {
|
|
1869
1906
|
if (oldName in rawParams && !(newName in rawParams)) {
|
|
1870
1907
|
rawParams[newName] = rawParams[oldName];
|
|
1871
1908
|
delete rawParams[oldName];
|
|
@@ -1881,7 +1918,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1881
1918
|
functionInfo.name,
|
|
1882
1919
|
{
|
|
1883
1920
|
interactiveMode,
|
|
1884
|
-
debug: !!
|
|
1921
|
+
debug: !!options.debug || process.env.DEBUG === "true" || process.argv.includes("--debug")
|
|
1885
1922
|
}
|
|
1886
1923
|
);
|
|
1887
1924
|
} else {
|
|
@@ -2040,7 +2077,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2040
2077
|
`<${kebabName}>`,
|
|
2041
2078
|
param.description || `${kebabName} parameter`
|
|
2042
2079
|
);
|
|
2043
|
-
} else if (param.isPositional) {
|
|
2080
|
+
} else if (param.isPositional && !param.isDeprecated && !param.isAlias) {
|
|
2044
2081
|
command.argument(
|
|
2045
2082
|
`[${kebabName}]`,
|
|
2046
2083
|
param.description || `${kebabName} parameter`
|
|
@@ -2054,7 +2091,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2054
2091
|
flags.push(`--${kebabName}`);
|
|
2055
2092
|
if (param.type === "boolean") {
|
|
2056
2093
|
const opt = new Option(flags.join(", "), param.description);
|
|
2057
|
-
if (param.
|
|
2094
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2058
2095
|
command.addOption(opt);
|
|
2059
2096
|
} else if (param.type === "array") {
|
|
2060
2097
|
const flagSignature = flags.join(", ") + ` <value>`;
|
|
@@ -2063,7 +2100,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2063
2100
|
opt.argParser(
|
|
2064
2101
|
(value, previous) => (previous || []).concat([value])
|
|
2065
2102
|
);
|
|
2066
|
-
if (param.
|
|
2103
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2067
2104
|
command.addOption(opt);
|
|
2068
2105
|
} else {
|
|
2069
2106
|
const flagSignature = flags.join(", ") + ` <${param.type}>`;
|
|
@@ -2071,7 +2108,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2071
2108
|
if (param.default !== void 0) {
|
|
2072
2109
|
opt.default(param.default);
|
|
2073
2110
|
}
|
|
2074
|
-
if (param.
|
|
2111
|
+
if (param.isDeprecated) opt.hideHelp();
|
|
2075
2112
|
command.addOption(opt);
|
|
2076
2113
|
}
|
|
2077
2114
|
}
|
|
@@ -2088,7 +2125,7 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
|
|
|
2088
2125
|
const sdkParams = {};
|
|
2089
2126
|
let argIndex = 0;
|
|
2090
2127
|
parameters.forEach((param) => {
|
|
2091
|
-
if ((param.required || param.isPositional) && argIndex < positionalArgs.length) {
|
|
2128
|
+
if ((param.required || param.isPositional && !param.isDeprecated && !param.isAlias) && argIndex < positionalArgs.length) {
|
|
2092
2129
|
sdkParams[param.name] = convertValue(
|
|
2093
2130
|
positionalArgs[argIndex],
|
|
2094
2131
|
param.type,
|
|
@@ -4618,7 +4655,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4618
4655
|
// package.json with { type: 'json' }
|
|
4619
4656
|
var package_default2 = {
|
|
4620
4657
|
name: "@zapier/zapier-sdk-cli",
|
|
4621
|
-
version: "0.39.
|
|
4658
|
+
version: "0.39.3"};
|
|
4622
4659
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4623
4660
|
var CACHE_RESET_INTERVAL_MS = (() => {
|
|
4624
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";
|
|
@@ -142,6 +160,10 @@ function resolveOutputMode({ isListCommand, hasPaginationParams, hasUserSpecifie
|
|
|
142
160
|
return "collect";
|
|
143
161
|
return "paginate";
|
|
144
162
|
}
|
|
163
|
+
/** Extract the aliases map from a schema's metadata (e.g., { appKey: "app" }). */
|
|
164
|
+
function getSchemaAliases(schema) {
|
|
165
|
+
return schema?.meta?.()?.aliases;
|
|
166
|
+
}
|
|
145
167
|
// ============================================================================
|
|
146
168
|
// Schema Analysis
|
|
147
169
|
// ============================================================================
|
|
@@ -169,6 +191,7 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
169
191
|
let required = true;
|
|
170
192
|
let defaultValue = undefined;
|
|
171
193
|
let isDeprecated = false;
|
|
194
|
+
let deprecationMessage;
|
|
172
195
|
// Unwrap optional, default, and nullable wrappers - keep unwrapping until we get to the base type.
|
|
173
196
|
// Check .meta()?.deprecated at each level since it doesn't propagate through wrappers.
|
|
174
197
|
while (true) {
|
|
@@ -176,6 +199,9 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
176
199
|
if (meta?.deprecated) {
|
|
177
200
|
isDeprecated = true;
|
|
178
201
|
}
|
|
202
|
+
if (meta?.deprecationMessage && !deprecationMessage) {
|
|
203
|
+
deprecationMessage = meta.deprecationMessage;
|
|
204
|
+
}
|
|
179
205
|
if (baseSchema instanceof z.ZodOptional) {
|
|
180
206
|
required = false;
|
|
181
207
|
baseSchema = baseSchema._zod.def.innerType;
|
|
@@ -250,7 +276,8 @@ function analyzeZodField(name, schema, functionInfo) {
|
|
|
250
276
|
hasResolver: paramHasResolver,
|
|
251
277
|
isPositional: isPositional(schema),
|
|
252
278
|
elementType,
|
|
253
|
-
|
|
279
|
+
deprecationMessage,
|
|
280
|
+
isDeprecated,
|
|
254
281
|
};
|
|
255
282
|
}
|
|
256
283
|
/**
|
|
@@ -410,6 +437,16 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
410
437
|
const parameters = usesInputParameters
|
|
411
438
|
? analyzeInputParameters(functionInfo.inputParameters, functionInfo)
|
|
412
439
|
: analyzeZodSchema(schema, functionInfo);
|
|
440
|
+
// Mark params that are aliases for other params (e.g., appKey is an alias for app).
|
|
441
|
+
const schemaAliases = getSchemaAliases(schema);
|
|
442
|
+
if (schemaAliases) {
|
|
443
|
+
const aliasedNames = new Set(Object.keys(schemaAliases));
|
|
444
|
+
for (const param of parameters) {
|
|
445
|
+
if (aliasedNames.has(param.name)) {
|
|
446
|
+
param.isAlias = true;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
413
450
|
const description = functionInfo.description ||
|
|
414
451
|
schema?.description ||
|
|
415
452
|
`${cliCommandName} command`;
|
|
@@ -418,21 +455,20 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
418
455
|
let success = true;
|
|
419
456
|
let errorMessage = null;
|
|
420
457
|
let resolvedParams = {};
|
|
421
|
-
//
|
|
458
|
+
// The last argument is always the command object with parsed options
|
|
422
459
|
const commandObj = args[args.length - 1];
|
|
423
460
|
const options = commandObj.opts();
|
|
461
|
+
// interactiveMode is true by default; --json disables it
|
|
424
462
|
const interactiveMode = !options.json;
|
|
425
463
|
const renderer = interactiveMode
|
|
426
464
|
? createInteractiveRenderer()
|
|
427
465
|
: createJsonRenderer();
|
|
428
466
|
try {
|
|
429
|
-
// The last argument is always the command object with parsed options
|
|
430
|
-
const commandObj = args[args.length - 1];
|
|
431
|
-
const options = commandObj.opts();
|
|
432
467
|
emitDeprecationWarning({
|
|
433
468
|
cliCommandName,
|
|
434
469
|
deprecation: functionInfo.deprecation,
|
|
435
470
|
});
|
|
471
|
+
emitParamDeprecationWarnings({ options, parameters });
|
|
436
472
|
// Check if this is a list command for pagination
|
|
437
473
|
const isListCommand = functionInfo.type === "list";
|
|
438
474
|
const hasPaginationParams = parameters.some((p) => PAGINATION_PARAM_NAMES.has(p.name));
|
|
@@ -444,7 +480,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
444
480
|
});
|
|
445
481
|
const rawParams = convertCliArgsToSdkParams(parameters, args.slice(0, -1), options);
|
|
446
482
|
// Remap aliased parameter names (e.g., authenticationId → connectionId)
|
|
447
|
-
const schemaAliases = schema
|
|
483
|
+
const schemaAliases = getSchemaAliases(schema);
|
|
448
484
|
if (schemaAliases) {
|
|
449
485
|
for (const [oldName, newName] of Object.entries(schemaAliases)) {
|
|
450
486
|
if (oldName in rawParams && !(newName in rawParams)) {
|
|
@@ -623,7 +659,7 @@ function addCommand(program, commandName, config) {
|
|
|
623
659
|
// Required parameters without resolvers become required positional arguments
|
|
624
660
|
command.argument(`<${kebabName}>`, param.description || `${kebabName} parameter`);
|
|
625
661
|
}
|
|
626
|
-
else if (param.isPositional) {
|
|
662
|
+
else if (param.isPositional && !param.isDeprecated && !param.isAlias) {
|
|
627
663
|
// Optional parameters marked as positional become optional positional arguments
|
|
628
664
|
command.argument(`[${kebabName}]`, param.description || `${kebabName} parameter`);
|
|
629
665
|
}
|
|
@@ -638,7 +674,7 @@ function addCommand(program, commandName, config) {
|
|
|
638
674
|
flags.push(`--${kebabName}`);
|
|
639
675
|
if (param.type === "boolean") {
|
|
640
676
|
const opt = new Option(flags.join(", "), param.description);
|
|
641
|
-
if (param.
|
|
677
|
+
if (param.isDeprecated)
|
|
642
678
|
opt.hideHelp();
|
|
643
679
|
command.addOption(opt);
|
|
644
680
|
}
|
|
@@ -648,7 +684,7 @@ function addCommand(program, commandName, config) {
|
|
|
648
684
|
const opt = new Option(flagSignature, param.description || "");
|
|
649
685
|
opt.default([]);
|
|
650
686
|
opt.argParser((value, previous) => (previous || []).concat([value]));
|
|
651
|
-
if (param.
|
|
687
|
+
if (param.isDeprecated)
|
|
652
688
|
opt.hideHelp();
|
|
653
689
|
command.addOption(opt);
|
|
654
690
|
}
|
|
@@ -658,7 +694,7 @@ function addCommand(program, commandName, config) {
|
|
|
658
694
|
if (param.default !== undefined) {
|
|
659
695
|
opt.default(param.default);
|
|
660
696
|
}
|
|
661
|
-
if (param.
|
|
697
|
+
if (param.isDeprecated)
|
|
662
698
|
opt.hideHelp();
|
|
663
699
|
command.addOption(opt);
|
|
664
700
|
}
|
|
@@ -683,7 +719,8 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
|
|
|
683
719
|
// Handle positional arguments (required parameters or optional positional parameters)
|
|
684
720
|
let argIndex = 0;
|
|
685
721
|
parameters.forEach((param) => {
|
|
686
|
-
if ((param.required ||
|
|
722
|
+
if ((param.required ||
|
|
723
|
+
(param.isPositional && !param.isDeprecated && !param.isAlias)) &&
|
|
687
724
|
argIndex < positionalArgs.length) {
|
|
688
725
|
// Use the original camelCase parameter name for the SDK
|
|
689
726
|
sdkParams[param.name] = convertValue(positionalArgs[argIndex], param.type, param.elementType);
|