@zapier/zapier-sdk-cli 0.49.1 → 0.50.0
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 +16 -0
- package/dist/cli.cjs +20 -3
- package/dist/cli.mjs +20 -3
- package/dist/experimental.cjs +1 -1
- package/dist/experimental.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/package.json +1 -1
- package/dist/src/utils/parameter-resolver.d.ts +21 -0
- package/dist/src/utils/parameter-resolver.js +41 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @zapier/zapier-sdk-cli
|
|
2
2
|
|
|
3
|
+
## 0.50.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ce779d1: Add `hint?: string | string[]` to `PromptConfig.choices`. The CLI renders it after the choice's `name` as dimmed parens; an unset `hint` with a primitive `value` auto-renders the value.
|
|
8
|
+
|
|
9
|
+
All built-in resolvers migrate to the new shape, so existing dropdowns get small visual cleanups (dim parens, no `ID:` prefix, dash converted to parens, em-dash in `tableRecordId` gone).
|
|
10
|
+
|
|
11
|
+
Plugin authors who embed the value in `name` (e.g. `"Foo (${id})"`) should drop the embedded parens; the auto-default appends a second otherwise.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [ce779d1]
|
|
16
|
+
- @zapier/zapier-sdk@0.55.0
|
|
17
|
+
- @zapier/zapier-sdk-mcp@0.13.7
|
|
18
|
+
|
|
3
19
|
## 0.49.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cli.cjs
CHANGED
|
@@ -178,6 +178,20 @@ function coerceToSchemaType(value, schema) {
|
|
|
178
178
|
}
|
|
179
179
|
return value;
|
|
180
180
|
}
|
|
181
|
+
function renderChoiceLabel(choice) {
|
|
182
|
+
let effectiveHint = choice.hint;
|
|
183
|
+
if (effectiveHint === void 0 && (typeof choice.value === "string" || typeof choice.value === "number")) {
|
|
184
|
+
effectiveHint = String(choice.value);
|
|
185
|
+
}
|
|
186
|
+
if (!effectiveHint || Array.isArray(effectiveHint) && effectiveHint.length === 0) {
|
|
187
|
+
return choice;
|
|
188
|
+
}
|
|
189
|
+
const hintText = Array.isArray(effectiveHint) ? effectiveHint.join(", ") : effectiveHint;
|
|
190
|
+
if (hintText === choice.name) {
|
|
191
|
+
return choice;
|
|
192
|
+
}
|
|
193
|
+
return { ...choice, name: `${choice.name} ${chalk__default.default.dim(`(${hintText})`)}` };
|
|
194
|
+
}
|
|
181
195
|
var SchemaParameterResolver = class {
|
|
182
196
|
constructor() {
|
|
183
197
|
this.debug = false;
|
|
@@ -585,7 +599,7 @@ var SchemaParameterResolver = class {
|
|
|
585
599
|
}
|
|
586
600
|
const { items } = await this.unpackFetchResult(fetchResult, promptLabel);
|
|
587
601
|
const choicesConfig = resolver.prompt(items, searchParams);
|
|
588
|
-
const dataChoices = choicesConfig.choices ?? [];
|
|
602
|
+
const dataChoices = (choicesConfig.choices ?? []).map(renderChoiceLabel);
|
|
589
603
|
const capabilityHintMessages = await this.computeCapabilityHints(
|
|
590
604
|
resolver,
|
|
591
605
|
context
|
|
@@ -774,6 +788,9 @@ var SchemaParameterResolver = class {
|
|
|
774
788
|
context.resolvedParams
|
|
775
789
|
);
|
|
776
790
|
promptConfig.name = promptName;
|
|
791
|
+
if (promptConfig.choices) {
|
|
792
|
+
promptConfig.choices = promptConfig.choices.map(renderChoiceLabel);
|
|
793
|
+
}
|
|
777
794
|
const hasSelectableChoice = promptConfig.choices?.some(
|
|
778
795
|
(c) => !c.disabled
|
|
779
796
|
);
|
|
@@ -1555,7 +1572,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
|
|
|
1555
1572
|
|
|
1556
1573
|
// package.json
|
|
1557
1574
|
var package_default = {
|
|
1558
|
-
version: "0.
|
|
1575
|
+
version: "0.50.0"};
|
|
1559
1576
|
|
|
1560
1577
|
// src/telemetry/builders.ts
|
|
1561
1578
|
function createCliBaseEvent(context = {}) {
|
|
@@ -6586,7 +6603,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
|
|
|
6586
6603
|
// package.json with { type: 'json' }
|
|
6587
6604
|
var package_default2 = {
|
|
6588
6605
|
name: "@zapier/zapier-sdk-cli",
|
|
6589
|
-
version: "0.
|
|
6606
|
+
version: "0.50.0"};
|
|
6590
6607
|
|
|
6591
6608
|
// src/sdk.ts
|
|
6592
6609
|
zapierSdk.injectCliLogin(login_exports);
|
package/dist/cli.mjs
CHANGED
|
@@ -136,6 +136,20 @@ function coerceToSchemaType(value, schema) {
|
|
|
136
136
|
}
|
|
137
137
|
return value;
|
|
138
138
|
}
|
|
139
|
+
function renderChoiceLabel(choice) {
|
|
140
|
+
let effectiveHint = choice.hint;
|
|
141
|
+
if (effectiveHint === void 0 && (typeof choice.value === "string" || typeof choice.value === "number")) {
|
|
142
|
+
effectiveHint = String(choice.value);
|
|
143
|
+
}
|
|
144
|
+
if (!effectiveHint || Array.isArray(effectiveHint) && effectiveHint.length === 0) {
|
|
145
|
+
return choice;
|
|
146
|
+
}
|
|
147
|
+
const hintText = Array.isArray(effectiveHint) ? effectiveHint.join(", ") : effectiveHint;
|
|
148
|
+
if (hintText === choice.name) {
|
|
149
|
+
return choice;
|
|
150
|
+
}
|
|
151
|
+
return { ...choice, name: `${choice.name} ${chalk.dim(`(${hintText})`)}` };
|
|
152
|
+
}
|
|
139
153
|
var SchemaParameterResolver = class {
|
|
140
154
|
constructor() {
|
|
141
155
|
this.debug = false;
|
|
@@ -543,7 +557,7 @@ var SchemaParameterResolver = class {
|
|
|
543
557
|
}
|
|
544
558
|
const { items } = await this.unpackFetchResult(fetchResult, promptLabel);
|
|
545
559
|
const choicesConfig = resolver.prompt(items, searchParams);
|
|
546
|
-
const dataChoices = choicesConfig.choices ?? [];
|
|
560
|
+
const dataChoices = (choicesConfig.choices ?? []).map(renderChoiceLabel);
|
|
547
561
|
const capabilityHintMessages = await this.computeCapabilityHints(
|
|
548
562
|
resolver,
|
|
549
563
|
context
|
|
@@ -732,6 +746,9 @@ var SchemaParameterResolver = class {
|
|
|
732
746
|
context.resolvedParams
|
|
733
747
|
);
|
|
734
748
|
promptConfig.name = promptName;
|
|
749
|
+
if (promptConfig.choices) {
|
|
750
|
+
promptConfig.choices = promptConfig.choices.map(renderChoiceLabel);
|
|
751
|
+
}
|
|
735
752
|
const hasSelectableChoice = promptConfig.choices?.some(
|
|
736
753
|
(c) => !c.disabled
|
|
737
754
|
);
|
|
@@ -1513,7 +1530,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
|
|
|
1513
1530
|
|
|
1514
1531
|
// package.json
|
|
1515
1532
|
var package_default = {
|
|
1516
|
-
version: "0.
|
|
1533
|
+
version: "0.50.0"};
|
|
1517
1534
|
|
|
1518
1535
|
// src/telemetry/builders.ts
|
|
1519
1536
|
function createCliBaseEvent(context = {}) {
|
|
@@ -6544,7 +6561,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
|
|
|
6544
6561
|
// package.json with { type: 'json' }
|
|
6545
6562
|
var package_default2 = {
|
|
6546
6563
|
name: "@zapier/zapier-sdk-cli",
|
|
6547
|
-
version: "0.
|
|
6564
|
+
version: "0.50.0"};
|
|
6548
6565
|
|
|
6549
6566
|
// src/sdk.ts
|
|
6550
6567
|
injectCliLogin(login_exports);
|
package/dist/experimental.cjs
CHANGED
|
@@ -3963,7 +3963,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
|
|
|
3963
3963
|
// package.json with { type: 'json' }
|
|
3964
3964
|
var package_default = {
|
|
3965
3965
|
name: "@zapier/zapier-sdk-cli",
|
|
3966
|
-
version: "0.
|
|
3966
|
+
version: "0.50.0"};
|
|
3967
3967
|
|
|
3968
3968
|
// src/experimental.ts
|
|
3969
3969
|
experimental.injectCliLogin(login_exports);
|
package/dist/experimental.mjs
CHANGED
|
@@ -3927,7 +3927,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
|
|
|
3927
3927
|
// package.json with { type: 'json' }
|
|
3928
3928
|
var package_default = {
|
|
3929
3929
|
name: "@zapier/zapier-sdk-cli",
|
|
3930
|
-
version: "0.
|
|
3930
|
+
version: "0.50.0"};
|
|
3931
3931
|
|
|
3932
3932
|
// src/experimental.ts
|
|
3933
3933
|
injectCliLogin(login_exports);
|
package/dist/index.cjs
CHANGED
|
@@ -3962,7 +3962,7 @@ zapierSdk.definePlugin(
|
|
|
3962
3962
|
// package.json with { type: 'json' }
|
|
3963
3963
|
var package_default = {
|
|
3964
3964
|
name: "@zapier/zapier-sdk-cli",
|
|
3965
|
-
version: "0.
|
|
3965
|
+
version: "0.50.0"};
|
|
3966
3966
|
|
|
3967
3967
|
// src/sdk.ts
|
|
3968
3968
|
zapierSdk.injectCliLogin(login_exports);
|
|
@@ -3990,7 +3990,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
3990
3990
|
|
|
3991
3991
|
// package.json
|
|
3992
3992
|
var package_default2 = {
|
|
3993
|
-
version: "0.
|
|
3993
|
+
version: "0.50.0"};
|
|
3994
3994
|
|
|
3995
3995
|
// src/telemetry/builders.ts
|
|
3996
3996
|
function createCliBaseEvent(context = {}) {
|
package/dist/index.mjs
CHANGED
|
@@ -3926,7 +3926,7 @@ definePlugin(
|
|
|
3926
3926
|
// package.json with { type: 'json' }
|
|
3927
3927
|
var package_default = {
|
|
3928
3928
|
name: "@zapier/zapier-sdk-cli",
|
|
3929
|
-
version: "0.
|
|
3929
|
+
version: "0.50.0"};
|
|
3930
3930
|
|
|
3931
3931
|
// src/sdk.ts
|
|
3932
3932
|
injectCliLogin(login_exports);
|
|
@@ -3954,7 +3954,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
3954
3954
|
|
|
3955
3955
|
// package.json
|
|
3956
3956
|
var package_default2 = {
|
|
3957
|
-
version: "0.
|
|
3957
|
+
version: "0.50.0"};
|
|
3958
3958
|
|
|
3959
3959
|
// src/telemetry/builders.ts
|
|
3960
3960
|
function createCliBaseEvent(context = {}) {
|
package/dist/package.json
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type ZapierSdk } from "@zapier/zapier-sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Append a choice's `hint` to its name as dimmed parens, returning a new
|
|
5
|
+
* choice object. An array hint is joined with ", ". Used by every prompt
|
|
6
|
+
* backend that renders resolver-supplied choices so the dim styling lives
|
|
7
|
+
* in one place.
|
|
8
|
+
*
|
|
9
|
+
* Default-when-unset: if `hint` is not provided and the choice's `value`
|
|
10
|
+
* is a primitive (string or number), the value is auto-rendered as the
|
|
11
|
+
* hint. So a resolver returning `{ name: "Slack", value: "SlackCLIAPI" }`
|
|
12
|
+
* with no `hint` renders as `Slack (SlackCLIAPI)`. To opt out of the
|
|
13
|
+
* auto-default, set `hint: ""` or `hint: []` explicitly.
|
|
14
|
+
*
|
|
15
|
+
* Skip-when-equal: a hint that matches the rendered name verbatim is
|
|
16
|
+
* suppressed so primitive-enum resolvers (where `name === String(value)`)
|
|
17
|
+
* don't render "read (read)". Case differences still render both.
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderChoiceLabel<T extends {
|
|
20
|
+
name: string;
|
|
21
|
+
value: unknown;
|
|
22
|
+
hint?: string | string[];
|
|
23
|
+
}>(choice: T): T;
|
|
3
24
|
export declare class SchemaParameterResolver {
|
|
4
25
|
private debug;
|
|
5
26
|
private spinner;
|
|
@@ -87,6 +87,40 @@ function coerceToSchemaType(value, schema) {
|
|
|
87
87
|
// ============================================================================
|
|
88
88
|
// Schema Parameter Resolver
|
|
89
89
|
// ============================================================================
|
|
90
|
+
/**
|
|
91
|
+
* Append a choice's `hint` to its name as dimmed parens, returning a new
|
|
92
|
+
* choice object. An array hint is joined with ", ". Used by every prompt
|
|
93
|
+
* backend that renders resolver-supplied choices so the dim styling lives
|
|
94
|
+
* in one place.
|
|
95
|
+
*
|
|
96
|
+
* Default-when-unset: if `hint` is not provided and the choice's `value`
|
|
97
|
+
* is a primitive (string or number), the value is auto-rendered as the
|
|
98
|
+
* hint. So a resolver returning `{ name: "Slack", value: "SlackCLIAPI" }`
|
|
99
|
+
* with no `hint` renders as `Slack (SlackCLIAPI)`. To opt out of the
|
|
100
|
+
* auto-default, set `hint: ""` or `hint: []` explicitly.
|
|
101
|
+
*
|
|
102
|
+
* Skip-when-equal: a hint that matches the rendered name verbatim is
|
|
103
|
+
* suppressed so primitive-enum resolvers (where `name === String(value)`)
|
|
104
|
+
* don't render "read (read)". Case differences still render both.
|
|
105
|
+
*/
|
|
106
|
+
export function renderChoiceLabel(choice) {
|
|
107
|
+
let effectiveHint = choice.hint;
|
|
108
|
+
if (effectiveHint === undefined &&
|
|
109
|
+
(typeof choice.value === "string" || typeof choice.value === "number")) {
|
|
110
|
+
effectiveHint = String(choice.value);
|
|
111
|
+
}
|
|
112
|
+
if (!effectiveHint ||
|
|
113
|
+
(Array.isArray(effectiveHint) && effectiveHint.length === 0)) {
|
|
114
|
+
return choice;
|
|
115
|
+
}
|
|
116
|
+
const hintText = Array.isArray(effectiveHint)
|
|
117
|
+
? effectiveHint.join(", ")
|
|
118
|
+
: effectiveHint;
|
|
119
|
+
if (hintText === choice.name) {
|
|
120
|
+
return choice;
|
|
121
|
+
}
|
|
122
|
+
return { ...choice, name: `${choice.name} ${chalk.dim(`(${hintText})`)}` };
|
|
123
|
+
}
|
|
90
124
|
export class SchemaParameterResolver {
|
|
91
125
|
constructor() {
|
|
92
126
|
this.debug = false;
|
|
@@ -513,7 +547,7 @@ export class SchemaParameterResolver {
|
|
|
513
547
|
}
|
|
514
548
|
const { items } = await this.unpackFetchResult(fetchResult, promptLabel);
|
|
515
549
|
const choicesConfig = resolver.prompt(items, searchParams);
|
|
516
|
-
const dataChoices = choicesConfig.choices ?? [];
|
|
550
|
+
const dataChoices = (choicesConfig.choices ?? []).map(renderChoiceLabel);
|
|
517
551
|
const capabilityHintMessages = await this.computeCapabilityHints(resolver, context);
|
|
518
552
|
const selected = await search({
|
|
519
553
|
message: choicesConfig.message,
|
|
@@ -730,6 +764,12 @@ export class SchemaParameterResolver {
|
|
|
730
764
|
while (true) {
|
|
731
765
|
const promptConfig = dynamicResolver.prompt(items, context.resolvedParams);
|
|
732
766
|
promptConfig.name = promptName;
|
|
767
|
+
// Fold any per-choice `hint` into the rendered name once, here, so
|
|
768
|
+
// both the search-backed list path and the checkbox path below
|
|
769
|
+
// pick up the dim styling without each having to know about hints.
|
|
770
|
+
if (promptConfig.choices) {
|
|
771
|
+
promptConfig.choices = promptConfig.choices.map(renderChoiceLabel);
|
|
772
|
+
}
|
|
733
773
|
// Friendlier than inquirer's default "No selectable choices. All
|
|
734
774
|
// choices are disabled." when the resolver returns no items (or
|
|
735
775
|
// filters everything out in `prompt`). Use ZapierCliValidationError
|