@zapier/zapier-sdk-cli 0.39.0 → 0.39.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +17 -17
- package/dist/cli.cjs +19 -7
- package/dist/cli.mjs +19 -7
- 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 +18 -3
- 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.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 362bc56: Make sure CLI only shows non-deprecated positional parameters.
|
|
8
|
+
- Updated dependencies [362bc56]
|
|
9
|
+
- @zapier/zapier-sdk@0.40.2
|
|
10
|
+
- @zapier/zapier-sdk-mcp@0.10.8
|
|
11
|
+
|
|
12
|
+
## 0.39.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 5391c65: Fix ordering problem with tables CLI commands.
|
|
17
|
+
- Updated dependencies [5391c65]
|
|
18
|
+
- @zapier/zapier-sdk@0.40.1
|
|
19
|
+
- @zapier/zapier-sdk-mcp@0.10.7
|
|
20
|
+
|
|
3
21
|
## 0.39.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -409,10 +409,10 @@ 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
|
| `--is-expired` | `boolean` | ❌ | — | — | Filter by expired status |
|
|
@@ -420,7 +420,7 @@ Find the first connection matching the criteria
|
|
|
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] [--is-expired]
|
|
424
424
|
```
|
|
425
425
|
|
|
426
426
|
#### `find-unique-connection`
|
|
@@ -431,10 +431,10 @@ 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
|
| `--is-expired` | `boolean` | ❌ | — | — | Filter by expired status |
|
|
@@ -442,7 +442,7 @@ Find a unique connection matching the criteria
|
|
|
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] [--is-expired]
|
|
446
446
|
```
|
|
447
447
|
|
|
448
448
|
#### `get-connection`
|
|
@@ -469,10 +469,10 @@ 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. |
|
|
@@ -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] [--is-expired] [--page-size] [--max-items] [--cursor]
|
|
488
488
|
```
|
|
489
489
|
|
|
490
490
|
### HTTP Requests
|
|
@@ -558,13 +558,13 @@ Create one or more fields in a table
|
|
|
558
558
|
|
|
559
559
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
560
560
|
| ---------- | -------- | -------- | ------- | --------------- | ------------------------------------ |
|
|
561
|
-
| `<fields>` | `array` | ✅ | — | — | Array of field definitions to create |
|
|
562
561
|
| `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
562
|
+
| `<fields>` | `array` | ✅ | — | — | Array of field definitions to create |
|
|
563
563
|
|
|
564
564
|
**Usage:**
|
|
565
565
|
|
|
566
566
|
```bash
|
|
567
|
-
npx zapier-sdk create-table-fields <
|
|
567
|
+
npx zapier-sdk create-table-fields <table> <fields>
|
|
568
568
|
```
|
|
569
569
|
|
|
570
570
|
#### `create-table-records`
|
|
@@ -575,14 +575,14 @@ Create one or more records in a table
|
|
|
575
575
|
|
|
576
576
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
577
577
|
| ------------ | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
578
|
+
| `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
578
579
|
| `<records>` | `array` | ✅ | — | — | Array of records to create (max 100) |
|
|
579
580
|
| `--key-mode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
|
|
580
|
-
| `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
581
581
|
|
|
582
582
|
**Usage:**
|
|
583
583
|
|
|
584
584
|
```bash
|
|
585
|
-
npx zapier-sdk create-table-records <
|
|
585
|
+
npx zapier-sdk create-table-records <table> <records> [--key-mode]
|
|
586
586
|
```
|
|
587
587
|
|
|
588
588
|
#### `delete-table`
|
|
@@ -659,9 +659,9 @@ Get a single record from a table by ID
|
|
|
659
659
|
|
|
660
660
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
661
661
|
| ------------ | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
662
|
-
| `--key-mode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
|
|
663
662
|
| `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
664
663
|
| `<record>` | `string` | ✅ | — | — | The unique identifier of the record |
|
|
664
|
+
| `--key-mode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
|
|
665
665
|
|
|
666
666
|
**Usage:**
|
|
667
667
|
|
|
@@ -677,8 +677,8 @@ List fields for a table
|
|
|
677
677
|
|
|
678
678
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
679
679
|
| ---------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------- |
|
|
680
|
-
| `--fields` | `array` | ❌ | — | — | Fields to operate on. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6). |
|
|
681
680
|
| `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
681
|
+
| `--fields` | `array` | ❌ | — | — | Fields to operate on. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6). |
|
|
682
682
|
|
|
683
683
|
**Usage:**
|
|
684
684
|
|
|
@@ -694,20 +694,20 @@ List records in a table with optional filtering and sorting
|
|
|
694
694
|
|
|
695
695
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
696
696
|
| --------------- | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
697
|
+
| `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
698
|
+
| ↳ `<field-key>` | `string` | ✅ | — | — | The field key to sort by |
|
|
697
699
|
| `--filters` | `array` | ❌ | — | — | Filter conditions for the query |
|
|
698
700
|
| `--sort` | `object` | ❌ | — | — | Sort records by a field |
|
|
699
|
-
| ↳ `<field-key>` | `string` | ✅ | — | — | The field key to sort by |
|
|
700
701
|
| ↳ `--direction` | `string` | ❌ | `"asc"` | — | Sort direction |
|
|
701
702
|
| `--page-size` | `number` | ❌ | — | — | Number of records per page (max 1000) |
|
|
702
703
|
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
703
704
|
| `--cursor` | `string` | ❌ | — | — | Cursor to start from |
|
|
704
705
|
| `--key-mode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
|
|
705
|
-
| `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
706
706
|
|
|
707
707
|
**Usage:**
|
|
708
708
|
|
|
709
709
|
```bash
|
|
710
|
-
npx zapier-sdk list-table-records <field-key>
|
|
710
|
+
npx zapier-sdk list-table-records <table> <field-key> [--filters] [--sort] [--direction] [--page-size] [--max-items] [--cursor] [--key-mode]
|
|
711
711
|
```
|
|
712
712
|
|
|
713
713
|
#### `list-tables`
|
|
@@ -741,14 +741,14 @@ Update one or more records in a table
|
|
|
741
741
|
|
|
742
742
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
743
743
|
| ------------ | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
744
|
+
| `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
744
745
|
| `<records>` | `array` | ✅ | — | — | Array of records to update (max 100) |
|
|
745
746
|
| `--key-mode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
|
|
746
|
-
| `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
747
747
|
|
|
748
748
|
**Usage:**
|
|
749
749
|
|
|
750
750
|
```bash
|
|
751
|
-
npx zapier-sdk update-table-records <
|
|
751
|
+
npx zapier-sdk update-table-records <table> <records> [--key-mode]
|
|
752
752
|
```
|
|
753
753
|
|
|
754
754
|
### Utilities
|
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.2"};
|
|
1107
1107
|
|
|
1108
1108
|
// src/telemetry/builders.ts
|
|
1109
1109
|
function createCliBaseEvent(context = {}) {
|
|
@@ -1637,6 +1637,9 @@ function resolveOutputMode({
|
|
|
1637
1637
|
if (hasUserSpecifiedMaxItems) return "collect";
|
|
1638
1638
|
return "paginate";
|
|
1639
1639
|
}
|
|
1640
|
+
function getSchemaAliases(schema) {
|
|
1641
|
+
return schema?.meta?.()?.aliases;
|
|
1642
|
+
}
|
|
1640
1643
|
function analyzeZodSchema(schema, functionInfo) {
|
|
1641
1644
|
const parameters = [];
|
|
1642
1645
|
const schemaDef = schema._zod?.def;
|
|
@@ -1869,6 +1872,15 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1869
1872
|
const usesInputParameters = !functionInfo.inputSchema && !!functionInfo.inputParameters;
|
|
1870
1873
|
const schema = functionInfo.inputSchema;
|
|
1871
1874
|
const parameters = usesInputParameters ? analyzeInputParameters(functionInfo.inputParameters, functionInfo) : analyzeZodSchema(schema, functionInfo);
|
|
1875
|
+
const schemaAliases = getSchemaAliases(schema);
|
|
1876
|
+
if (schemaAliases) {
|
|
1877
|
+
const aliasedNames = new Set(Object.keys(schemaAliases));
|
|
1878
|
+
for (const param of parameters) {
|
|
1879
|
+
if (aliasedNames.has(param.name)) {
|
|
1880
|
+
param.isAlias = true;
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1872
1884
|
const description = functionInfo.description || schema?.description || `${cliCommandName} command`;
|
|
1873
1885
|
const handler = async (...args) => {
|
|
1874
1886
|
const startTime = Date.now();
|
|
@@ -1901,9 +1913,9 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1901
1913
|
args.slice(0, -1),
|
|
1902
1914
|
options2
|
|
1903
1915
|
);
|
|
1904
|
-
const
|
|
1905
|
-
if (
|
|
1906
|
-
for (const [oldName, newName] of Object.entries(
|
|
1916
|
+
const schemaAliases2 = getSchemaAliases(schema);
|
|
1917
|
+
if (schemaAliases2) {
|
|
1918
|
+
for (const [oldName, newName] of Object.entries(schemaAliases2)) {
|
|
1907
1919
|
if (oldName in rawParams && !(newName in rawParams)) {
|
|
1908
1920
|
rawParams[newName] = rawParams[oldName];
|
|
1909
1921
|
delete rawParams[oldName];
|
|
@@ -2078,7 +2090,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2078
2090
|
`<${kebabName}>`,
|
|
2079
2091
|
param.description || `${kebabName} parameter`
|
|
2080
2092
|
);
|
|
2081
|
-
} else if (param.isPositional) {
|
|
2093
|
+
} else if (param.isPositional && !param.hidden && !param.isAlias) {
|
|
2082
2094
|
command.argument(
|
|
2083
2095
|
`[${kebabName}]`,
|
|
2084
2096
|
param.description || `${kebabName} parameter`
|
|
@@ -2126,7 +2138,7 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
|
|
|
2126
2138
|
const sdkParams = {};
|
|
2127
2139
|
let argIndex = 0;
|
|
2128
2140
|
parameters.forEach((param) => {
|
|
2129
|
-
if ((param.required || param.isPositional) && argIndex < positionalArgs.length) {
|
|
2141
|
+
if ((param.required || param.isPositional && !param.hidden && !param.isAlias) && argIndex < positionalArgs.length) {
|
|
2130
2142
|
sdkParams[param.name] = convertValue(
|
|
2131
2143
|
positionalArgs[argIndex],
|
|
2132
2144
|
param.type,
|
|
@@ -4656,7 +4668,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4656
4668
|
// package.json with { type: 'json' }
|
|
4657
4669
|
var package_default2 = {
|
|
4658
4670
|
name: "@zapier/zapier-sdk-cli",
|
|
4659
|
-
version: "0.39.
|
|
4671
|
+
version: "0.39.2"};
|
|
4660
4672
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4661
4673
|
var CACHE_RESET_INTERVAL_MS = (() => {
|
|
4662
4674
|
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.2"};
|
|
1069
1069
|
|
|
1070
1070
|
// src/telemetry/builders.ts
|
|
1071
1071
|
function createCliBaseEvent(context = {}) {
|
|
@@ -1599,6 +1599,9 @@ function resolveOutputMode({
|
|
|
1599
1599
|
if (hasUserSpecifiedMaxItems) return "collect";
|
|
1600
1600
|
return "paginate";
|
|
1601
1601
|
}
|
|
1602
|
+
function getSchemaAliases(schema) {
|
|
1603
|
+
return schema?.meta?.()?.aliases;
|
|
1604
|
+
}
|
|
1602
1605
|
function analyzeZodSchema(schema, functionInfo) {
|
|
1603
1606
|
const parameters = [];
|
|
1604
1607
|
const schemaDef = schema._zod?.def;
|
|
@@ -1831,6 +1834,15 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1831
1834
|
const usesInputParameters = !functionInfo.inputSchema && !!functionInfo.inputParameters;
|
|
1832
1835
|
const schema = functionInfo.inputSchema;
|
|
1833
1836
|
const parameters = usesInputParameters ? analyzeInputParameters(functionInfo.inputParameters, functionInfo) : analyzeZodSchema(schema, functionInfo);
|
|
1837
|
+
const schemaAliases = getSchemaAliases(schema);
|
|
1838
|
+
if (schemaAliases) {
|
|
1839
|
+
const aliasedNames = new Set(Object.keys(schemaAliases));
|
|
1840
|
+
for (const param of parameters) {
|
|
1841
|
+
if (aliasedNames.has(param.name)) {
|
|
1842
|
+
param.isAlias = true;
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1834
1846
|
const description = functionInfo.description || schema?.description || `${cliCommandName} command`;
|
|
1835
1847
|
const handler = async (...args) => {
|
|
1836
1848
|
const startTime = Date.now();
|
|
@@ -1863,9 +1875,9 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1863
1875
|
args.slice(0, -1),
|
|
1864
1876
|
options2
|
|
1865
1877
|
);
|
|
1866
|
-
const
|
|
1867
|
-
if (
|
|
1868
|
-
for (const [oldName, newName] of Object.entries(
|
|
1878
|
+
const schemaAliases2 = getSchemaAliases(schema);
|
|
1879
|
+
if (schemaAliases2) {
|
|
1880
|
+
for (const [oldName, newName] of Object.entries(schemaAliases2)) {
|
|
1869
1881
|
if (oldName in rawParams && !(newName in rawParams)) {
|
|
1870
1882
|
rawParams[newName] = rawParams[oldName];
|
|
1871
1883
|
delete rawParams[oldName];
|
|
@@ -2040,7 +2052,7 @@ function addCommand(program2, commandName, config) {
|
|
|
2040
2052
|
`<${kebabName}>`,
|
|
2041
2053
|
param.description || `${kebabName} parameter`
|
|
2042
2054
|
);
|
|
2043
|
-
} else if (param.isPositional) {
|
|
2055
|
+
} else if (param.isPositional && !param.hidden && !param.isAlias) {
|
|
2044
2056
|
command.argument(
|
|
2045
2057
|
`[${kebabName}]`,
|
|
2046
2058
|
param.description || `${kebabName} parameter`
|
|
@@ -2088,7 +2100,7 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
|
|
|
2088
2100
|
const sdkParams = {};
|
|
2089
2101
|
let argIndex = 0;
|
|
2090
2102
|
parameters.forEach((param) => {
|
|
2091
|
-
if ((param.required || param.isPositional) && argIndex < positionalArgs.length) {
|
|
2103
|
+
if ((param.required || param.isPositional && !param.hidden && !param.isAlias) && argIndex < positionalArgs.length) {
|
|
2092
2104
|
sdkParams[param.name] = convertValue(
|
|
2093
2105
|
positionalArgs[argIndex],
|
|
2094
2106
|
param.type,
|
|
@@ -4618,7 +4630,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4618
4630
|
// package.json with { type: 'json' }
|
|
4619
4631
|
var package_default2 = {
|
|
4620
4632
|
name: "@zapier/zapier-sdk-cli",
|
|
4621
|
-
version: "0.39.
|
|
4633
|
+
version: "0.39.2"};
|
|
4622
4634
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4623
4635
|
var CACHE_RESET_INTERVAL_MS = (() => {
|
|
4624
4636
|
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
|
@@ -142,6 +142,10 @@ function resolveOutputMode({ isListCommand, hasPaginationParams, hasUserSpecifie
|
|
|
142
142
|
return "collect";
|
|
143
143
|
return "paginate";
|
|
144
144
|
}
|
|
145
|
+
/** Extract the aliases map from a schema's metadata (e.g., { appKey: "app" }). */
|
|
146
|
+
function getSchemaAliases(schema) {
|
|
147
|
+
return schema?.meta?.()?.aliases;
|
|
148
|
+
}
|
|
145
149
|
// ============================================================================
|
|
146
150
|
// Schema Analysis
|
|
147
151
|
// ============================================================================
|
|
@@ -410,6 +414,16 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
410
414
|
const parameters = usesInputParameters
|
|
411
415
|
? analyzeInputParameters(functionInfo.inputParameters, functionInfo)
|
|
412
416
|
: analyzeZodSchema(schema, functionInfo);
|
|
417
|
+
// Mark params that are aliases for other params (e.g., appKey is an alias for app).
|
|
418
|
+
const schemaAliases = getSchemaAliases(schema);
|
|
419
|
+
if (schemaAliases) {
|
|
420
|
+
const aliasedNames = new Set(Object.keys(schemaAliases));
|
|
421
|
+
for (const param of parameters) {
|
|
422
|
+
if (aliasedNames.has(param.name)) {
|
|
423
|
+
param.isAlias = true;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
413
427
|
const description = functionInfo.description ||
|
|
414
428
|
schema?.description ||
|
|
415
429
|
`${cliCommandName} command`;
|
|
@@ -444,7 +458,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
444
458
|
});
|
|
445
459
|
const rawParams = convertCliArgsToSdkParams(parameters, args.slice(0, -1), options);
|
|
446
460
|
// Remap aliased parameter names (e.g., authenticationId → connectionId)
|
|
447
|
-
const schemaAliases = schema
|
|
461
|
+
const schemaAliases = getSchemaAliases(schema);
|
|
448
462
|
if (schemaAliases) {
|
|
449
463
|
for (const [oldName, newName] of Object.entries(schemaAliases)) {
|
|
450
464
|
if (oldName in rawParams && !(newName in rawParams)) {
|
|
@@ -623,7 +637,7 @@ function addCommand(program, commandName, config) {
|
|
|
623
637
|
// Required parameters without resolvers become required positional arguments
|
|
624
638
|
command.argument(`<${kebabName}>`, param.description || `${kebabName} parameter`);
|
|
625
639
|
}
|
|
626
|
-
else if (param.isPositional) {
|
|
640
|
+
else if (param.isPositional && !param.hidden && !param.isAlias) {
|
|
627
641
|
// Optional parameters marked as positional become optional positional arguments
|
|
628
642
|
command.argument(`[${kebabName}]`, param.description || `${kebabName} parameter`);
|
|
629
643
|
}
|
|
@@ -683,7 +697,8 @@ function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
|
|
|
683
697
|
// Handle positional arguments (required parameters or optional positional parameters)
|
|
684
698
|
let argIndex = 0;
|
|
685
699
|
parameters.forEach((param) => {
|
|
686
|
-
if ((param.required ||
|
|
700
|
+
if ((param.required ||
|
|
701
|
+
(param.isPositional && !param.hidden && !param.isAlias)) &&
|
|
687
702
|
argIndex < positionalArgs.length) {
|
|
688
703
|
// Use the original camelCase parameter name for the SDK
|
|
689
704
|
sdkParams[param.name] = convertValue(positionalArgs[argIndex], param.type, param.elementType);
|