@zapier/zapier-sdk-cli 0.48.1 → 0.49.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 +30 -0
- package/README.md +20 -0
- package/dist/cli.cjs +562 -191
- package/dist/cli.mjs +560 -190
- 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 +2 -1
- package/dist/src/utils/parameter-resolver.d.ts +91 -1
- package/dist/src/utils/parameter-resolver.js +593 -120
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
package/dist/cli.cjs
CHANGED
|
@@ -5,7 +5,8 @@ var commander = require('commander');
|
|
|
5
5
|
var zod = require('zod');
|
|
6
6
|
var zapierSdk = require('@zapier/zapier-sdk');
|
|
7
7
|
var inquirer = require('inquirer');
|
|
8
|
-
var
|
|
8
|
+
var search = require('@inquirer/search');
|
|
9
|
+
var chalk = require('chalk');
|
|
9
10
|
var ora = require('ora');
|
|
10
11
|
var util = require('util');
|
|
11
12
|
var wrapAnsi = require('wrap-ansi');
|
|
@@ -54,7 +55,8 @@ function _interopNamespace(e) {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
var inquirer__default = /*#__PURE__*/_interopDefault(inquirer);
|
|
57
|
-
var
|
|
58
|
+
var search__default = /*#__PURE__*/_interopDefault(search);
|
|
59
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
58
60
|
var ora__default = /*#__PURE__*/_interopDefault(ora);
|
|
59
61
|
var util__default = /*#__PURE__*/_interopDefault(util);
|
|
60
62
|
var wrapAnsi__default = /*#__PURE__*/_interopDefault(wrapAnsi);
|
|
@@ -156,6 +158,26 @@ function getLocalResolutionOrderForParams(paramNames, resolvers) {
|
|
|
156
158
|
}
|
|
157
159
|
return order;
|
|
158
160
|
}
|
|
161
|
+
function unwrapSchema(schema) {
|
|
162
|
+
let current = schema;
|
|
163
|
+
while (current instanceof zod.z.ZodOptional || current instanceof zod.z.ZodDefault || current instanceof zod.z.ZodNullable) {
|
|
164
|
+
current = current._zod.def.innerType;
|
|
165
|
+
}
|
|
166
|
+
return current;
|
|
167
|
+
}
|
|
168
|
+
function coerceToSchemaType(value, schema) {
|
|
169
|
+
if (typeof value !== "string") return value;
|
|
170
|
+
const base = unwrapSchema(schema);
|
|
171
|
+
if (base instanceof zod.z.ZodNumber) {
|
|
172
|
+
const n = Number(value);
|
|
173
|
+
return Number.isNaN(n) ? value : n;
|
|
174
|
+
}
|
|
175
|
+
if (base instanceof zod.z.ZodBoolean) {
|
|
176
|
+
if (value === "true") return true;
|
|
177
|
+
if (value === "false") return false;
|
|
178
|
+
}
|
|
179
|
+
return value;
|
|
180
|
+
}
|
|
159
181
|
var SchemaParameterResolver = class {
|
|
160
182
|
constructor() {
|
|
161
183
|
this.debug = false;
|
|
@@ -164,7 +186,7 @@ var SchemaParameterResolver = class {
|
|
|
164
186
|
debugLog(message) {
|
|
165
187
|
if (this.debug) {
|
|
166
188
|
this.stopSpinner();
|
|
167
|
-
console.log(
|
|
189
|
+
console.log(chalk__default.default.gray(`[Zapier CLI] ${message}`));
|
|
168
190
|
}
|
|
169
191
|
}
|
|
170
192
|
startSpinner() {
|
|
@@ -255,7 +277,7 @@ var SchemaParameterResolver = class {
|
|
|
255
277
|
}
|
|
256
278
|
} catch (error) {
|
|
257
279
|
if (this.isUserCancellation(error)) {
|
|
258
|
-
console.log(
|
|
280
|
+
console.log(chalk__default.default.yellow("\n\nOperation cancelled by user"));
|
|
259
281
|
throw new ZapierCliUserCancellationError();
|
|
260
282
|
}
|
|
261
283
|
throw error;
|
|
@@ -292,7 +314,7 @@ var SchemaParameterResolver = class {
|
|
|
292
314
|
}
|
|
293
315
|
} catch (error) {
|
|
294
316
|
if (this.isUserCancellation(error)) {
|
|
295
|
-
console.log(
|
|
317
|
+
console.log(chalk__default.default.yellow("\n\nOperation cancelled by user"));
|
|
296
318
|
throw new ZapierCliUserCancellationError();
|
|
297
319
|
}
|
|
298
320
|
throw error;
|
|
@@ -403,6 +425,237 @@ var SchemaParameterResolver = class {
|
|
|
403
425
|
throw new ZapierCliMissingParametersError(missingParams);
|
|
404
426
|
}
|
|
405
427
|
}
|
|
428
|
+
/**
|
|
429
|
+
* Wrap a PromptConfig.validate so internal sentinels (Symbols) bypass
|
|
430
|
+
* it. The resolver's validator is intended for actual user values; our
|
|
431
|
+
* Skip / Custom / Load-more sentinels are internal control-flow and
|
|
432
|
+
* should pass through. Returns `undefined` when the resolver didn't
|
|
433
|
+
* supply a validator (so `await search({ ...rest })` doesn't get a
|
|
434
|
+
* pass-through identity function).
|
|
435
|
+
*/
|
|
436
|
+
wrapPromptValidate(validate) {
|
|
437
|
+
if (!validate) return void 0;
|
|
438
|
+
return (value) => typeof value === "symbol" ? true : validate(value);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Apply a PromptConfig.filter to a selected value, but only when the
|
|
442
|
+
* value is a real data choice (not an internal sentinel). @inquirer/search
|
|
443
|
+
* has no built-in filter hook, so the search-backed paths call this
|
|
444
|
+
* explicitly before returning.
|
|
445
|
+
*/
|
|
446
|
+
applyPromptFilter(filter, value) {
|
|
447
|
+
if (!filter || typeof value === "symbol") return value;
|
|
448
|
+
return filter(value);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* If the resolver's PromptConfig sets a `default` value, move the
|
|
452
|
+
* matching choice to the front so it's the first selectable item in
|
|
453
|
+
* the rendered source. @inquirer/search has no built-in `default`
|
|
454
|
+
* option; first-selectable is what Enter picks, so reordering achieves
|
|
455
|
+
* the same semantics inquirer.prompt's list had natively.
|
|
456
|
+
*
|
|
457
|
+
* Returns the original array if no default is set or the default
|
|
458
|
+
* doesn't match any current choice.
|
|
459
|
+
*/
|
|
460
|
+
reorderForDefault(matches, defaultValue) {
|
|
461
|
+
if (defaultValue === void 0) return matches;
|
|
462
|
+
const idx = matches.findIndex((c) => c.value === defaultValue);
|
|
463
|
+
if (idx <= 0) return matches;
|
|
464
|
+
return [matches[idx], ...matches.slice(0, idx), ...matches.slice(idx + 1)];
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Build the disabled "if you had X capability, more results would show"
|
|
468
|
+
* hints for any unmet capabilities the resolver declared. Returns the
|
|
469
|
+
* raw hint strings — callers wrap them into choice objects with whatever
|
|
470
|
+
* sentinel value they prefer (disabled choices' values are inert).
|
|
471
|
+
*/
|
|
472
|
+
async computeCapabilityHints(resolver, context) {
|
|
473
|
+
if (!resolver.requireCapabilities) return [];
|
|
474
|
+
const capContext = context.sdk.context;
|
|
475
|
+
if (!capContext.hasCapability) return [];
|
|
476
|
+
const messages = [];
|
|
477
|
+
for (const cap of resolver.requireCapabilities) {
|
|
478
|
+
const enabled = await capContext.hasCapability(cap);
|
|
479
|
+
if (!enabled) messages.push(zapierSdk.buildCapabilityMessage(cap));
|
|
480
|
+
}
|
|
481
|
+
return messages;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Unpack a DynamicResolver.fetch result into the three shapes the caller
|
|
485
|
+
* cares about: a flat items array, an optional AsyncIterator for further
|
|
486
|
+
* pagination, and a hasMore flag. Centralizing keeps the AsyncIterable /
|
|
487
|
+
* `{data, nextCursor}` / `TItem[]` discrimination in one place — both
|
|
488
|
+
* the main dropdown loop and the search-mode flow consume it.
|
|
489
|
+
*
|
|
490
|
+
* The function is `async` for the AsyncIterable branch only (we eagerly
|
|
491
|
+
* consume the first page so callers don't have to discriminate). The
|
|
492
|
+
* other two branches return synchronously; an explicit Promise.resolve
|
|
493
|
+
* is unnecessary because async automatically wraps.
|
|
494
|
+
*
|
|
495
|
+
* Note: callers in search mode intentionally drop `pageIterator` /
|
|
496
|
+
* `hasMore` because each search() invocation re-prompts from scratch;
|
|
497
|
+
* pagination only matters when the prompt is the dropdown itself.
|
|
498
|
+
*/
|
|
499
|
+
async unpackFetchResult(fetchResult, promptLabel) {
|
|
500
|
+
if (fetchResult != null && typeof fetchResult === "object" && Symbol.asyncIterator in fetchResult) {
|
|
501
|
+
const pageIterator = fetchResult[Symbol.asyncIterator]();
|
|
502
|
+
const first = await pageIterator.next();
|
|
503
|
+
if (!first.done && first.value) {
|
|
504
|
+
return {
|
|
505
|
+
items: Array.isArray(first.value.data) ? first.value.data : [],
|
|
506
|
+
pageIterator,
|
|
507
|
+
hasMore: first.value.nextCursor != null
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
return { items: [], pageIterator, hasMore: false };
|
|
511
|
+
}
|
|
512
|
+
if (fetchResult != null && typeof fetchResult === "object" && "data" in fetchResult) {
|
|
513
|
+
const page = fetchResult;
|
|
514
|
+
const hasMore = page.nextCursor != null;
|
|
515
|
+
if (hasMore) {
|
|
516
|
+
this.debugLog(
|
|
517
|
+
`Resolver for ${promptLabel} has more pages but no iterator. Use toIterable() to enable "Load more..." support.`
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
return {
|
|
521
|
+
items: Array.isArray(page.data) ? page.data : [],
|
|
522
|
+
pageIterator: null,
|
|
523
|
+
hasMore
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
return {
|
|
527
|
+
items: Array.isArray(fetchResult) ? fetchResult : [],
|
|
528
|
+
pageIterator: null,
|
|
529
|
+
hasMore: false
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Search-mode dynamic resolver: prompts the user for free-form text, passes
|
|
534
|
+
* it to fetch via `search`, and either short-circuits on a primitive return
|
|
535
|
+
* (exact match) or renders the results as a search-filterable dropdown.
|
|
536
|
+
* Empty results still render the dropdown so the user can fall through to
|
|
537
|
+
* "(Use 'foo' as-is)" or "(Try a different search)" rather than being
|
|
538
|
+
* stuck.
|
|
539
|
+
*
|
|
540
|
+
* Known limitation: pagination beyond the first page is dropped. Each
|
|
541
|
+
* search() invocation re-prompts from scratch and the user is expected
|
|
542
|
+
* to refine their query if too many results came back. If a future
|
|
543
|
+
* high-cardinality search resolver needs Load-more here, the
|
|
544
|
+
* `pageIterator` / `hasMore` from `unpackFetchResult` is what to wire in.
|
|
545
|
+
*/
|
|
546
|
+
async resolveDynamicWithSearchInput({
|
|
547
|
+
resolver,
|
|
548
|
+
context,
|
|
549
|
+
promptLabel,
|
|
550
|
+
isOptional
|
|
551
|
+
}) {
|
|
552
|
+
const parenParts = [];
|
|
553
|
+
if (isOptional) parenParts.push("optional");
|
|
554
|
+
if (resolver.placeholder) parenParts.push(resolver.placeholder);
|
|
555
|
+
const parens = parenParts.length > 0 ? ` (${parenParts.join(", ")})` : "";
|
|
556
|
+
const message = `Enter or search ${promptLabel}${parens}:`;
|
|
557
|
+
const SKIP_SENTINEL = Symbol("SKIP");
|
|
558
|
+
const USE_AS_IS_SENTINEL = Symbol("USE_AS_IS");
|
|
559
|
+
const TRY_AGAIN_SENTINEL = Symbol("TRY_AGAIN");
|
|
560
|
+
let lastNote;
|
|
561
|
+
while (true) {
|
|
562
|
+
this.stopSpinner();
|
|
563
|
+
if (lastNote) {
|
|
564
|
+
console.log(chalk__default.default.yellow(lastNote));
|
|
565
|
+
lastNote = void 0;
|
|
566
|
+
}
|
|
567
|
+
const answers = await inquirer__default.default.prompt([
|
|
568
|
+
{ type: "input", name: "search", message }
|
|
569
|
+
]);
|
|
570
|
+
const rawInput = answers.search;
|
|
571
|
+
const searchInput = typeof rawInput === "string" ? rawInput.trim() : "";
|
|
572
|
+
if (!searchInput) {
|
|
573
|
+
if (isOptional) return void 0;
|
|
574
|
+
lastNote = `${promptLabel} is required.`;
|
|
575
|
+
continue;
|
|
576
|
+
}
|
|
577
|
+
const searchParams = {
|
|
578
|
+
...context.resolvedParams,
|
|
579
|
+
search: searchInput
|
|
580
|
+
};
|
|
581
|
+
this.startSpinner();
|
|
582
|
+
this.debugLog(`Searching ${promptLabel} for "${searchInput}"`);
|
|
583
|
+
let fetchResult;
|
|
584
|
+
try {
|
|
585
|
+
fetchResult = await resolver.fetch(context.sdk, searchParams);
|
|
586
|
+
} finally {
|
|
587
|
+
this.stopSpinner();
|
|
588
|
+
}
|
|
589
|
+
if (typeof fetchResult === "string" || typeof fetchResult === "number") {
|
|
590
|
+
return fetchResult;
|
|
591
|
+
}
|
|
592
|
+
const { items } = await this.unpackFetchResult(fetchResult, promptLabel);
|
|
593
|
+
const choicesConfig = resolver.prompt(items, searchParams);
|
|
594
|
+
const dataChoices = choicesConfig.choices ?? [];
|
|
595
|
+
const capabilityHintMessages = await this.computeCapabilityHints(
|
|
596
|
+
resolver,
|
|
597
|
+
context
|
|
598
|
+
);
|
|
599
|
+
const selected = await search__default.default({
|
|
600
|
+
message: choicesConfig.message,
|
|
601
|
+
validate: this.wrapPromptValidate(choicesConfig.validate),
|
|
602
|
+
// @inquirer/search passes an AbortSignal as the second arg for
|
|
603
|
+
// cancelling async sources. All three of our source callbacks are
|
|
604
|
+
// pure-local (filter an already-fetched array), so we intentionally
|
|
605
|
+
// ignore the signal. A future server-side filter implementation
|
|
606
|
+
// would need to honor it.
|
|
607
|
+
source: (term) => {
|
|
608
|
+
const trimmed = (term ?? "").trim();
|
|
609
|
+
const lower = trimmed.toLowerCase();
|
|
610
|
+
const matches = trimmed ? dataChoices.filter((c) => c.name.toLowerCase().includes(lower)) : dataChoices;
|
|
611
|
+
const orderedMatches = trimmed ? matches : this.reorderForDefault(matches, choicesConfig.default);
|
|
612
|
+
const skipChoice = isOptional ? [{ name: chalk__default.default.dim("(Skip)"), value: SKIP_SENTINEL }] : [];
|
|
613
|
+
const useAsIsChoice = {
|
|
614
|
+
name: chalk__default.default.dim(`(Use ${JSON.stringify(searchInput)} as-is)`),
|
|
615
|
+
value: USE_AS_IS_SENTINEL
|
|
616
|
+
};
|
|
617
|
+
const tryAgainChoice = {
|
|
618
|
+
name: chalk__default.default.dim("(Try a different search)"),
|
|
619
|
+
value: TRY_AGAIN_SENTINEL
|
|
620
|
+
};
|
|
621
|
+
const out = [];
|
|
622
|
+
if (orderedMatches.length === 0) {
|
|
623
|
+
out.push(useAsIsChoice);
|
|
624
|
+
out.push(tryAgainChoice);
|
|
625
|
+
out.push(...skipChoice);
|
|
626
|
+
} else {
|
|
627
|
+
out.push(...orderedMatches);
|
|
628
|
+
out.push(...skipChoice);
|
|
629
|
+
out.push(useAsIsChoice);
|
|
630
|
+
out.push(tryAgainChoice);
|
|
631
|
+
}
|
|
632
|
+
for (const message2 of capabilityHintMessages) {
|
|
633
|
+
out.push({
|
|
634
|
+
name: chalk__default.default.dim(message2),
|
|
635
|
+
value: SKIP_SENTINEL,
|
|
636
|
+
disabled: true
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
return out;
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
if (selected === SKIP_SENTINEL) return void 0;
|
|
643
|
+
if (selected === USE_AS_IS_SENTINEL) {
|
|
644
|
+
const validationResult = choicesConfig.validate?.(searchInput);
|
|
645
|
+
if (validationResult === false) {
|
|
646
|
+
lastNote = `${promptLabel}: invalid value.`;
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
if (typeof validationResult === "string") {
|
|
650
|
+
lastNote = validationResult;
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
return this.applyPromptFilter(choicesConfig.filter, searchInput);
|
|
654
|
+
}
|
|
655
|
+
if (selected === TRY_AGAIN_SENTINEL) continue;
|
|
656
|
+
return this.applyPromptFilter(choicesConfig.filter, selected);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
406
659
|
async resolveParameter(param, context, functionName, options) {
|
|
407
660
|
const resolver = this.getResolver(
|
|
408
661
|
param.name,
|
|
@@ -416,6 +669,27 @@ var SchemaParameterResolver = class {
|
|
|
416
669
|
isOptional: options?.isOptional
|
|
417
670
|
});
|
|
418
671
|
}
|
|
672
|
+
/**
|
|
673
|
+
* Run a resolver to obtain a value for one parameter, prompting the
|
|
674
|
+
* user when necessary. Routes to one of several prompt backends and
|
|
675
|
+
* has to keep the `PromptConfig` contract honest across each one.
|
|
676
|
+
*
|
|
677
|
+
* `PromptConfig` field × prompt-backend handling:
|
|
678
|
+
*
|
|
679
|
+
* | field | list (search()) | checkbox/confirm (inquirer.prompt) | search-mode dropdown (search()) |
|
|
680
|
+
* | -------- | --------------- | ---------------------------------- | ------------------------------- |
|
|
681
|
+
* | type | required | required | required |
|
|
682
|
+
* | name | (set internally)| forwarded | (set internally) |
|
|
683
|
+
* | message | forwarded | forwarded | forwarded |
|
|
684
|
+
* | choices | filtered in src | passed to inquirer | filtered in src |
|
|
685
|
+
* | default | reorder matches | passed (also internal cursor jump) | reorder matches |
|
|
686
|
+
* | validate | wrapped | passed (inquirer native) | wrapped + manual for (Use as-is)|
|
|
687
|
+
* | filter | manual once | inquirer native (do NOT double) | manual once |
|
|
688
|
+
*
|
|
689
|
+
* Escape-hatch sentinels (Skip / Custom value / Use as-is / Load more
|
|
690
|
+
* / Try again) bypass the resolver's validate/filter because they
|
|
691
|
+
* aren't real user values — they're CLI control-flow.
|
|
692
|
+
*/
|
|
419
693
|
async resolveWithResolver(resolver, param, context, options = {}) {
|
|
420
694
|
const { arrayIndex, isOptional } = options;
|
|
421
695
|
const inArrayContext = arrayIndex != null;
|
|
@@ -442,7 +716,7 @@ var SchemaParameterResolver = class {
|
|
|
442
716
|
if (isOptional && (value === void 0 || value === "" || value === staticResolver.placeholder)) {
|
|
443
717
|
return void 0;
|
|
444
718
|
}
|
|
445
|
-
return value;
|
|
719
|
+
return coerceToSchemaType(value, param.schema);
|
|
446
720
|
} else if (resolver.type === "dynamic") {
|
|
447
721
|
const dynamicResolver = resolver;
|
|
448
722
|
this.startSpinner();
|
|
@@ -454,41 +728,52 @@ var SchemaParameterResolver = class {
|
|
|
454
728
|
this.stopSpinner();
|
|
455
729
|
return autoResolution.resolvedValue;
|
|
456
730
|
}
|
|
731
|
+
if (dynamicResolver.inputType === "search") {
|
|
732
|
+
this.stopSpinner();
|
|
733
|
+
return await this.resolveDynamicWithSearchInput({
|
|
734
|
+
resolver: dynamicResolver,
|
|
735
|
+
context,
|
|
736
|
+
promptLabel,
|
|
737
|
+
isOptional: isOptional ?? false
|
|
738
|
+
});
|
|
739
|
+
}
|
|
457
740
|
this.debugLog(`Fetching options for ${promptLabel}`);
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
741
|
+
let fetchResult;
|
|
742
|
+
try {
|
|
743
|
+
fetchResult = await dynamicResolver.fetch(
|
|
744
|
+
context.sdk,
|
|
745
|
+
context.resolvedParams
|
|
746
|
+
);
|
|
747
|
+
} finally {
|
|
748
|
+
this.stopSpinner();
|
|
749
|
+
}
|
|
750
|
+
if (typeof fetchResult === "string" || typeof fetchResult === "number") {
|
|
751
|
+
console.error(
|
|
752
|
+
chalk__default.default.yellow(
|
|
753
|
+
`Resolver for ${promptLabel} returned a primitive value but is not in search mode. Set inputType: "search" on the resolver if you want exact-match short-circuit. Falling back to manual entry.`
|
|
754
|
+
)
|
|
755
|
+
);
|
|
756
|
+
const fallbackAnswers = await inquirer__default.default.prompt([
|
|
757
|
+
{
|
|
758
|
+
type: "input",
|
|
759
|
+
name: promptName,
|
|
760
|
+
message: `Enter ${promptLabel}${isOptional ? " (optional)" : ""}:`
|
|
761
|
+
}
|
|
762
|
+
]);
|
|
763
|
+
const fallbackValue = fallbackAnswers[promptName];
|
|
764
|
+
if (isOptional && (fallbackValue === void 0 || fallbackValue === "")) {
|
|
765
|
+
return void 0;
|
|
482
766
|
}
|
|
483
|
-
|
|
484
|
-
items = fetchResult || [];
|
|
485
|
-
pageIterator = null;
|
|
767
|
+
return fallbackValue;
|
|
486
768
|
}
|
|
769
|
+
const unpacked = await this.unpackFetchResult(fetchResult, promptLabel);
|
|
770
|
+
let pageIterator = unpacked.pageIterator;
|
|
771
|
+
let items = unpacked.items;
|
|
772
|
+
let hasMore = unpacked.hasMore;
|
|
487
773
|
const LOAD_MORE_SENTINEL = Symbol("LOAD_MORE");
|
|
488
774
|
const SKIP_SENTINEL = Symbol("SKIP");
|
|
489
775
|
const CUSTOM_VALUE_SENTINEL = Symbol("CUSTOM_VALUE");
|
|
490
776
|
let newItemsStartIndex = -1;
|
|
491
|
-
this.stopSpinner();
|
|
492
777
|
while (true) {
|
|
493
778
|
const promptConfig = dynamicResolver.prompt(
|
|
494
779
|
items,
|
|
@@ -503,50 +788,97 @@ var SchemaParameterResolver = class {
|
|
|
503
788
|
`No ${promptLabel} available to select.`
|
|
504
789
|
);
|
|
505
790
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
if (hasMore && pageIterator && promptConfig.choices) {
|
|
520
|
-
promptConfig.choices.push({
|
|
521
|
-
name: chalk7__default.default.dim("(Load more...)"),
|
|
522
|
-
value: LOAD_MORE_SENTINEL
|
|
523
|
-
});
|
|
791
|
+
const capabilityHints = [];
|
|
792
|
+
if (!hasMore) {
|
|
793
|
+
const hintMessages = await this.computeCapabilityHints(
|
|
794
|
+
dynamicResolver,
|
|
795
|
+
context
|
|
796
|
+
);
|
|
797
|
+
for (const message of hintMessages) {
|
|
798
|
+
capabilityHints.push({
|
|
799
|
+
name: chalk__default.default.dim(message),
|
|
800
|
+
value: SKIP_SENTINEL,
|
|
801
|
+
disabled: true
|
|
802
|
+
});
|
|
803
|
+
}
|
|
524
804
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
805
|
+
let selected;
|
|
806
|
+
if (promptConfig.type === "list") {
|
|
807
|
+
const dataChoices = promptConfig.choices ?? [];
|
|
808
|
+
selected = await search__default.default({
|
|
809
|
+
message: promptConfig.message,
|
|
810
|
+
validate: this.wrapPromptValidate(promptConfig.validate),
|
|
811
|
+
source: (term) => {
|
|
812
|
+
const trimmed = (term ?? "").trim();
|
|
813
|
+
const lower = trimmed.toLowerCase();
|
|
814
|
+
const matches = trimmed ? dataChoices.filter(
|
|
815
|
+
(c) => c.name.toLowerCase().includes(lower)
|
|
816
|
+
) : dataChoices;
|
|
817
|
+
const out = [];
|
|
818
|
+
const skipChoice = isOptional ? [
|
|
819
|
+
{
|
|
820
|
+
name: chalk__default.default.dim("(Skip)"),
|
|
821
|
+
value: SKIP_SENTINEL
|
|
822
|
+
}
|
|
823
|
+
] : [];
|
|
824
|
+
const customValueChoice = {
|
|
825
|
+
name: chalk__default.default.dim("(Enter custom value)"),
|
|
826
|
+
value: CUSTOM_VALUE_SENTINEL
|
|
827
|
+
};
|
|
828
|
+
const orderedMatches = trimmed ? matches : this.reorderForDefault(matches, promptConfig.default);
|
|
829
|
+
const matchesFirst = trimmed || promptConfig.default !== void 0;
|
|
830
|
+
const loadMoreChoice = hasMore && pageIterator ? {
|
|
831
|
+
name: chalk__default.default.dim("(Load more...)"),
|
|
832
|
+
value: LOAD_MORE_SENTINEL
|
|
833
|
+
} : null;
|
|
834
|
+
if (matchesFirst && orderedMatches.length > 0) {
|
|
835
|
+
out.push(...orderedMatches);
|
|
836
|
+
out.push(...skipChoice);
|
|
837
|
+
out.push(customValueChoice);
|
|
838
|
+
if (loadMoreChoice) out.push(loadMoreChoice);
|
|
839
|
+
} else if (matchesFirst) {
|
|
840
|
+
out.push(customValueChoice);
|
|
841
|
+
if (loadMoreChoice) out.push(loadMoreChoice);
|
|
842
|
+
out.push(...skipChoice);
|
|
843
|
+
} else {
|
|
844
|
+
out.push(...skipChoice);
|
|
845
|
+
out.push(customValueChoice);
|
|
846
|
+
out.push(...orderedMatches);
|
|
847
|
+
if (loadMoreChoice) out.push(loadMoreChoice);
|
|
536
848
|
}
|
|
849
|
+
if (capabilityHints.length > 0 && (!trimmed || matches.length > 0)) {
|
|
850
|
+
out.push(...capabilityHints);
|
|
851
|
+
}
|
|
852
|
+
return out;
|
|
537
853
|
}
|
|
854
|
+
});
|
|
855
|
+
} else {
|
|
856
|
+
if (isOptional && promptConfig.choices) {
|
|
857
|
+
promptConfig.choices.unshift({
|
|
858
|
+
name: chalk__default.default.dim("(Skip)"),
|
|
859
|
+
value: SKIP_SENTINEL
|
|
860
|
+
});
|
|
538
861
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
promptConfig.default = promptConfig.choices[adjustedIndex].value;
|
|
862
|
+
if (hasMore && pageIterator && promptConfig.choices) {
|
|
863
|
+
promptConfig.choices.push({
|
|
864
|
+
name: chalk__default.default.dim("(Load more...)"),
|
|
865
|
+
value: LOAD_MORE_SENTINEL
|
|
866
|
+
});
|
|
545
867
|
}
|
|
546
|
-
|
|
868
|
+
if (capabilityHints.length > 0 && promptConfig.choices) {
|
|
869
|
+
promptConfig.choices.push(...capabilityHints);
|
|
870
|
+
}
|
|
871
|
+
if (newItemsStartIndex >= 0 && promptConfig.choices) {
|
|
872
|
+
const injectedBefore = isOptional ? 1 : 0;
|
|
873
|
+
const adjustedIndex = newItemsStartIndex + injectedBefore;
|
|
874
|
+
if (promptConfig.choices[adjustedIndex]) {
|
|
875
|
+
promptConfig.default = promptConfig.choices[adjustedIndex].value;
|
|
876
|
+
}
|
|
877
|
+
newItemsStartIndex = -1;
|
|
878
|
+
}
|
|
879
|
+
const answers = await inquirer__default.default.prompt([promptConfig]);
|
|
880
|
+
selected = answers[promptName];
|
|
547
881
|
}
|
|
548
|
-
const answers = await inquirer__default.default.prompt([promptConfig]);
|
|
549
|
-
let selected = answers[promptName];
|
|
550
882
|
if (selected === SKIP_SENTINEL) {
|
|
551
883
|
return void 0;
|
|
552
884
|
}
|
|
@@ -585,7 +917,7 @@ var SchemaParameterResolver = class {
|
|
|
585
917
|
}
|
|
586
918
|
continue;
|
|
587
919
|
}
|
|
588
|
-
return selected;
|
|
920
|
+
return promptConfig.type === "list" ? this.applyPromptFilter(promptConfig.filter, selected) : selected;
|
|
589
921
|
}
|
|
590
922
|
} else if (resolver.type === "fields") {
|
|
591
923
|
if (isOptional && !inArrayContext) {
|
|
@@ -643,7 +975,7 @@ var SchemaParameterResolver = class {
|
|
|
643
975
|
if (!rootFieldItems || rootFieldItems.length === 0) {
|
|
644
976
|
if (iteration === 1) {
|
|
645
977
|
console.log(
|
|
646
|
-
|
|
978
|
+
chalk__default.default.yellow(`No input fields required for this action.`)
|
|
647
979
|
);
|
|
648
980
|
}
|
|
649
981
|
break;
|
|
@@ -666,7 +998,7 @@ var SchemaParameterResolver = class {
|
|
|
666
998
|
}
|
|
667
999
|
if (iteration >= maxIterations) {
|
|
668
1000
|
console.log(
|
|
669
|
-
|
|
1001
|
+
chalk__default.default.yellow(
|
|
670
1002
|
`
|
|
671
1003
|
\u26A0\uFE0F Maximum field resolution iterations reached. Some dynamic fields may not have been discovered.`
|
|
672
1004
|
)
|
|
@@ -717,7 +1049,7 @@ var SchemaParameterResolver = class {
|
|
|
717
1049
|
};
|
|
718
1050
|
}
|
|
719
1051
|
if (items.length >= maxItems) {
|
|
720
|
-
console.log(
|
|
1052
|
+
console.log(chalk__default.default.gray(`Maximum of ${maxItems} items reached.`));
|
|
721
1053
|
}
|
|
722
1054
|
return items;
|
|
723
1055
|
}
|
|
@@ -735,7 +1067,7 @@ var SchemaParameterResolver = class {
|
|
|
735
1067
|
const fieldsetTitle = typedItem.title || typedItem.key;
|
|
736
1068
|
const pathDisplay = fieldsetPath.length > 0 ? ` (in ${fieldsetPath.join(" > ")})` : "";
|
|
737
1069
|
console.log(
|
|
738
|
-
|
|
1070
|
+
chalk__default.default.cyan(
|
|
739
1071
|
`
|
|
740
1072
|
\u{1F4C1} Processing fieldset: ${fieldsetTitle}${pathDisplay}`
|
|
741
1073
|
)
|
|
@@ -803,7 +1135,7 @@ var SchemaParameterResolver = class {
|
|
|
803
1135
|
}
|
|
804
1136
|
} else {
|
|
805
1137
|
console.log(
|
|
806
|
-
|
|
1138
|
+
chalk__default.default.gray(
|
|
807
1139
|
`
|
|
808
1140
|
There are ${optionalFields.length} ${iteration === 1 ? "" : "additional "}optional field(s) available${pathContext}.`
|
|
809
1141
|
)
|
|
@@ -818,7 +1150,7 @@ There are ${optionalFields.length} ${iteration === 1 ? "" : "additional "}option
|
|
|
818
1150
|
}
|
|
819
1151
|
]);
|
|
820
1152
|
if (shouldConfigureOptional.configure) {
|
|
821
|
-
console.log(
|
|
1153
|
+
console.log(chalk__default.default.cyan(`
|
|
822
1154
|
Optional fields${pathContext}:`));
|
|
823
1155
|
for (const field of optionalFields) {
|
|
824
1156
|
await this.promptForField(field, targetInputs, context);
|
|
@@ -834,7 +1166,7 @@ Optional fields${pathContext}:`));
|
|
|
834
1166
|
}
|
|
835
1167
|
} catch (error) {
|
|
836
1168
|
if (this.isUserCancellation(error)) {
|
|
837
|
-
console.log(
|
|
1169
|
+
console.log(chalk__default.default.yellow("\n\nOperation cancelled by user"));
|
|
838
1170
|
throw new ZapierCliUserCancellationError();
|
|
839
1171
|
}
|
|
840
1172
|
throw error;
|
|
@@ -910,7 +1242,7 @@ Optional fields${pathContext}:`));
|
|
|
910
1242
|
}));
|
|
911
1243
|
if (choices.length === 0 && !cursor) {
|
|
912
1244
|
console.log(
|
|
913
|
-
|
|
1245
|
+
chalk__default.default.yellow(`No choices available for ${fieldMeta.title}`)
|
|
914
1246
|
);
|
|
915
1247
|
}
|
|
916
1248
|
return {
|
|
@@ -920,14 +1252,17 @@ Optional fields${pathContext}:`));
|
|
|
920
1252
|
} catch (error) {
|
|
921
1253
|
this.stopSpinner();
|
|
922
1254
|
console.warn(
|
|
923
|
-
|
|
1255
|
+
chalk__default.default.yellow(`Failed to fetch choices for ${fieldMeta.title}:`),
|
|
924
1256
|
error
|
|
925
1257
|
);
|
|
926
1258
|
return { choices: [] };
|
|
927
1259
|
}
|
|
928
1260
|
}
|
|
929
1261
|
/**
|
|
930
|
-
* Prompt user with choices (handles both single and multi-select with pagination)
|
|
1262
|
+
* Prompt user with choices (handles both single and multi-select with pagination).
|
|
1263
|
+
* Single-select goes through @inquirer/search so users can type-to-filter long
|
|
1264
|
+
* dropdowns (SELECT fields); multi-select stays on inquirer.prompt since search
|
|
1265
|
+
* is single-select only.
|
|
931
1266
|
*/
|
|
932
1267
|
async promptWithChoices({
|
|
933
1268
|
fieldMeta,
|
|
@@ -940,45 +1275,81 @@ Optional fields${pathContext}:`));
|
|
|
940
1275
|
const choices = [...initialChoices];
|
|
941
1276
|
let nextCursor = initialCursor;
|
|
942
1277
|
const LOAD_MORE_SENTINEL = Symbol("LOAD_MORE");
|
|
1278
|
+
const SKIP_SENTINEL = Symbol("SKIP");
|
|
943
1279
|
const CUSTOM_VALUE_SENTINEL = Symbol("CUSTOM_VALUE");
|
|
1280
|
+
const message = `${fieldMeta.title}${fieldMeta.isRequired ? " (required)" : " (optional)"}:`;
|
|
944
1281
|
while (true) {
|
|
945
|
-
|
|
946
|
-
name: choice.label,
|
|
947
|
-
value: choice.value
|
|
948
|
-
}));
|
|
1282
|
+
let selectedValue;
|
|
949
1283
|
if (!fieldMeta.isMultiSelect) {
|
|
950
|
-
|
|
951
|
-
name:
|
|
952
|
-
value:
|
|
953
|
-
});
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
1284
|
+
const dataChoices = choices.map((c) => ({
|
|
1285
|
+
name: c.label,
|
|
1286
|
+
value: c.value
|
|
1287
|
+
}));
|
|
1288
|
+
selectedValue = await search__default.default({
|
|
1289
|
+
message,
|
|
1290
|
+
source: (term) => {
|
|
1291
|
+
const trimmed = (term ?? "").trim();
|
|
1292
|
+
const lower = trimmed.toLowerCase();
|
|
1293
|
+
const matches = trimmed ? dataChoices.filter((c) => c.name.toLowerCase().includes(lower)) : dataChoices;
|
|
1294
|
+
const out = [];
|
|
1295
|
+
const skipChoice = !fieldMeta.isRequired ? [{ name: chalk__default.default.dim("(Skip)"), value: SKIP_SENTINEL }] : [];
|
|
1296
|
+
const customValueChoice = {
|
|
1297
|
+
name: chalk__default.default.dim("(Enter custom value)"),
|
|
1298
|
+
value: CUSTOM_VALUE_SENTINEL
|
|
1299
|
+
};
|
|
1300
|
+
const loadMoreChoice = nextCursor && context ? {
|
|
1301
|
+
name: chalk__default.default.dim("(Load more...)"),
|
|
1302
|
+
value: LOAD_MORE_SENTINEL
|
|
1303
|
+
} : null;
|
|
1304
|
+
if (trimmed && matches.length > 0) {
|
|
1305
|
+
out.push(...matches);
|
|
1306
|
+
out.push(...skipChoice);
|
|
1307
|
+
out.push(customValueChoice);
|
|
1308
|
+
if (loadMoreChoice) out.push(loadMoreChoice);
|
|
1309
|
+
} else if (trimmed) {
|
|
1310
|
+
out.push(customValueChoice);
|
|
1311
|
+
if (loadMoreChoice) out.push(loadMoreChoice);
|
|
1312
|
+
out.push(...skipChoice);
|
|
1313
|
+
} else {
|
|
1314
|
+
out.push(...skipChoice);
|
|
1315
|
+
out.push(customValueChoice);
|
|
1316
|
+
out.push(...matches);
|
|
1317
|
+
if (loadMoreChoice) out.push(loadMoreChoice);
|
|
1318
|
+
}
|
|
1319
|
+
return out;
|
|
1320
|
+
}
|
|
959
1321
|
});
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1322
|
+
if (selectedValue === SKIP_SENTINEL) {
|
|
1323
|
+
return void 0;
|
|
1324
|
+
}
|
|
1325
|
+
if (selectedValue === CUSTOM_VALUE_SENTINEL) {
|
|
1326
|
+
return await this.promptFreeForm(fieldMeta);
|
|
1327
|
+
}
|
|
1328
|
+
} else {
|
|
1329
|
+
const promptChoices = choices.map((c) => ({
|
|
1330
|
+
name: c.label,
|
|
1331
|
+
value: c.value
|
|
1332
|
+
}));
|
|
1333
|
+
if (nextCursor) {
|
|
1334
|
+
promptChoices.push({
|
|
1335
|
+
name: chalk__default.default.dim("(Load more...)"),
|
|
1336
|
+
value: LOAD_MORE_SENTINEL
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
const promptConfig = {
|
|
1340
|
+
type: "checkbox",
|
|
1341
|
+
name: fieldMeta.key,
|
|
1342
|
+
message,
|
|
1343
|
+
choices: promptChoices,
|
|
970
1344
|
validate: (input) => {
|
|
971
1345
|
if (fieldMeta.isRequired && (!input || input.length === 0)) {
|
|
972
1346
|
return "At least one selection is required";
|
|
973
1347
|
}
|
|
974
1348
|
return true;
|
|
975
1349
|
}
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
let selectedValue = answer[fieldMeta.key];
|
|
980
|
-
if (selectedValue === CUSTOM_VALUE_SENTINEL) {
|
|
981
|
-
return await this.promptFreeForm(fieldMeta);
|
|
1350
|
+
};
|
|
1351
|
+
const answer = await inquirer__default.default.prompt([promptConfig]);
|
|
1352
|
+
selectedValue = answer[fieldMeta.key];
|
|
982
1353
|
}
|
|
983
1354
|
const wantsMore = fieldMeta.isMultiSelect ? Array.isArray(selectedValue) && selectedValue.includes(LOAD_MORE_SENTINEL) : selectedValue === LOAD_MORE_SENTINEL;
|
|
984
1355
|
if (wantsMore && nextCursor && context) {
|
|
@@ -1041,7 +1412,7 @@ Optional fields${pathContext}:`));
|
|
|
1041
1412
|
};
|
|
1042
1413
|
}
|
|
1043
1414
|
if (fieldMeta.description) {
|
|
1044
|
-
promptConfig.prefix =
|
|
1415
|
+
promptConfig.prefix = chalk__default.default.gray(`\u2139 ${fieldMeta.description}
|
|
1045
1416
|
`);
|
|
1046
1417
|
}
|
|
1047
1418
|
try {
|
|
@@ -1049,7 +1420,7 @@ Optional fields${pathContext}:`));
|
|
|
1049
1420
|
return answer[fieldMeta.key];
|
|
1050
1421
|
} catch (error) {
|
|
1051
1422
|
if (this.isUserCancellation(error)) {
|
|
1052
|
-
console.log(
|
|
1423
|
+
console.log(chalk__default.default.yellow("\n\nOperation cancelled by user"));
|
|
1053
1424
|
throw new ZapierCliUserCancellationError();
|
|
1054
1425
|
}
|
|
1055
1426
|
throw error;
|
|
@@ -1067,7 +1438,7 @@ Optional fields${pathContext}:`));
|
|
|
1067
1438
|
}
|
|
1068
1439
|
} catch (error) {
|
|
1069
1440
|
if (this.isUserCancellation(error)) {
|
|
1070
|
-
console.log(
|
|
1441
|
+
console.log(chalk__default.default.yellow("\n\nOperation cancelled by user"));
|
|
1071
1442
|
throw new ZapierCliUserCancellationError();
|
|
1072
1443
|
}
|
|
1073
1444
|
throw error;
|
|
@@ -1190,7 +1561,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
|
|
|
1190
1561
|
|
|
1191
1562
|
// package.json
|
|
1192
1563
|
var package_default = {
|
|
1193
|
-
version: "0.
|
|
1564
|
+
version: "0.49.0"};
|
|
1194
1565
|
|
|
1195
1566
|
// src/telemetry/builders.ts
|
|
1196
1567
|
function createCliBaseEvent(context = {}) {
|
|
@@ -1275,7 +1646,7 @@ async function formatItemsFromSchema(functionInfo, items, startingNumber = 0, op
|
|
|
1275
1646
|
});
|
|
1276
1647
|
}
|
|
1277
1648
|
function formatSingleItem(formatted, itemNumber) {
|
|
1278
|
-
let titleLine = `${
|
|
1649
|
+
let titleLine = `${chalk__default.default.gray(`${itemNumber + 1}.`)} ${chalk__default.default.cyan(formatted.title)}`;
|
|
1279
1650
|
const subtitleParts = [];
|
|
1280
1651
|
if (formatted.keys) {
|
|
1281
1652
|
subtitleParts.push(...formatted.keys);
|
|
@@ -1287,11 +1658,11 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
1287
1658
|
}
|
|
1288
1659
|
const uniqueParts = [...new Set(subtitleParts)];
|
|
1289
1660
|
if (uniqueParts.length > 0) {
|
|
1290
|
-
titleLine += ` ${
|
|
1661
|
+
titleLine += ` ${chalk__default.default.gray(`(${uniqueParts.join(", ")})`)}`;
|
|
1291
1662
|
}
|
|
1292
1663
|
console.log(titleLine);
|
|
1293
1664
|
if (formatted.description) {
|
|
1294
|
-
console.log(` ${
|
|
1665
|
+
console.log(` ${chalk__default.default.dim(formatted.description)}`);
|
|
1295
1666
|
}
|
|
1296
1667
|
if (formatted.data !== void 0) {
|
|
1297
1668
|
formatJsonOutput(formatted.data);
|
|
@@ -1302,7 +1673,7 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
1302
1673
|
if (detail.label) {
|
|
1303
1674
|
const isMultiline = detail.text.includes("\n");
|
|
1304
1675
|
if (isMultiline) {
|
|
1305
|
-
console.log(` ${
|
|
1676
|
+
console.log(` ${chalk__default.default.gray(detail.label + ":")}`);
|
|
1306
1677
|
const displayText = formatDetailText(
|
|
1307
1678
|
detail.text,
|
|
1308
1679
|
DETAIL_INDENT + " "
|
|
@@ -1311,7 +1682,7 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
1311
1682
|
console.log(`${DETAIL_INDENT} ${styledText}`);
|
|
1312
1683
|
} else {
|
|
1313
1684
|
const styledValue = applyStyle(detail.text, detail.style);
|
|
1314
|
-
console.log(` ${
|
|
1685
|
+
console.log(` ${chalk__default.default.gray(detail.label + ":")} ${styledValue}`);
|
|
1315
1686
|
}
|
|
1316
1687
|
} else {
|
|
1317
1688
|
const displayText = formatDetailText(detail.text, DETAIL_INDENT);
|
|
@@ -1335,16 +1706,16 @@ function formatDetailText(text, indent = DETAIL_INDENT) {
|
|
|
1335
1706
|
function applyStyle(value, style) {
|
|
1336
1707
|
switch (style) {
|
|
1337
1708
|
case "dim":
|
|
1338
|
-
return
|
|
1709
|
+
return chalk__default.default.dim(value);
|
|
1339
1710
|
case "accent":
|
|
1340
|
-
return
|
|
1711
|
+
return chalk__default.default.magenta(value);
|
|
1341
1712
|
case "warning":
|
|
1342
|
-
return
|
|
1713
|
+
return chalk__default.default.red(value);
|
|
1343
1714
|
case "success":
|
|
1344
|
-
return
|
|
1715
|
+
return chalk__default.default.green(value);
|
|
1345
1716
|
case "normal":
|
|
1346
1717
|
default:
|
|
1347
|
-
return
|
|
1718
|
+
return chalk__default.default.blue(value);
|
|
1348
1719
|
}
|
|
1349
1720
|
}
|
|
1350
1721
|
function convertGenericItemToFormattedItem(item) {
|
|
@@ -1476,10 +1847,10 @@ function renderItemsForDisplay(items, functionInfo, startingNumber = 0) {
|
|
|
1476
1847
|
const obj = item;
|
|
1477
1848
|
const name = obj?.name || obj?.key || obj?.id || "Item";
|
|
1478
1849
|
console.log(
|
|
1479
|
-
`${
|
|
1850
|
+
`${chalk__default.default.gray(`${startingNumber + index + 1}.`)} ${chalk__default.default.cyan(String(name))}`
|
|
1480
1851
|
);
|
|
1481
1852
|
if (obj?.description)
|
|
1482
|
-
console.log(` ${
|
|
1853
|
+
console.log(` ${chalk__default.default.dim(String(obj.description))}`);
|
|
1483
1854
|
console.log();
|
|
1484
1855
|
});
|
|
1485
1856
|
}
|
|
@@ -1491,35 +1862,35 @@ function createInteractiveRenderer() {
|
|
|
1491
1862
|
if (!(Symbol.asyncIterator in Object(source))) {
|
|
1492
1863
|
const items = source?.data;
|
|
1493
1864
|
if (!Array.isArray(items) || items.length === 0) {
|
|
1494
|
-
console.log(
|
|
1865
|
+
console.log(chalk__default.default.yellow(`No ${itemName} found.`));
|
|
1495
1866
|
return;
|
|
1496
1867
|
}
|
|
1497
1868
|
renderItemsForDisplay(items, functionInfo, 0);
|
|
1498
|
-
console.log(
|
|
1869
|
+
console.log(chalk__default.default.green(`
|
|
1499
1870
|
\u2705 Showing ${items.length} ${itemName}`));
|
|
1500
1871
|
return;
|
|
1501
1872
|
}
|
|
1502
1873
|
let totalShown = 0;
|
|
1503
1874
|
let pageCount = 0;
|
|
1504
|
-
console.log(
|
|
1875
|
+
console.log(chalk__default.default.blue(`\u{1F4CB} ${getListTitle(functionInfo)}
|
|
1505
1876
|
`));
|
|
1506
1877
|
for await (const page of source) {
|
|
1507
1878
|
const items = page.data ?? [];
|
|
1508
1879
|
pageCount++;
|
|
1509
1880
|
if (items.length === 0 && pageCount === 1) {
|
|
1510
|
-
console.log(
|
|
1881
|
+
console.log(chalk__default.default.yellow(`No ${itemName} found.`));
|
|
1511
1882
|
return;
|
|
1512
1883
|
}
|
|
1513
1884
|
if (items.length === 0) break;
|
|
1514
1885
|
if (pageCount > 1) {
|
|
1515
1886
|
console.clear();
|
|
1516
|
-
console.log(
|
|
1887
|
+
console.log(chalk__default.default.blue(`\u{1F4CB} ${getListTitle(functionInfo)}
|
|
1517
1888
|
`));
|
|
1518
1889
|
}
|
|
1519
1890
|
renderItemsForDisplay(items, functionInfo, totalShown);
|
|
1520
1891
|
totalShown += items.length;
|
|
1521
1892
|
console.log(
|
|
1522
|
-
|
|
1893
|
+
chalk__default.default.green(
|
|
1523
1894
|
`
|
|
1524
1895
|
\u2705 Showing ${totalShown} ${itemName} (page ${pageCount})`
|
|
1525
1896
|
)
|
|
@@ -1538,7 +1909,7 @@ function createInteractiveRenderer() {
|
|
|
1538
1909
|
break;
|
|
1539
1910
|
}
|
|
1540
1911
|
}
|
|
1541
|
-
console.log(
|
|
1912
|
+
console.log(chalk__default.default.gray(`
|
|
1542
1913
|
\u{1F4C4} Finished browsing ${itemName}`));
|
|
1543
1914
|
},
|
|
1544
1915
|
renderCollectedList(items, { maxItems, userSpecifiedMaxItems, functionInfo } = {}) {
|
|
@@ -1548,30 +1919,30 @@ function createInteractiveRenderer() {
|
|
|
1548
1919
|
}
|
|
1549
1920
|
const itemName = getItemName(functionInfo);
|
|
1550
1921
|
if (items.length === 0) {
|
|
1551
|
-
console.log(
|
|
1922
|
+
console.log(chalk__default.default.yellow(`No ${itemName} found.`));
|
|
1552
1923
|
return;
|
|
1553
1924
|
}
|
|
1554
|
-
console.log(
|
|
1925
|
+
console.log(chalk__default.default.green(`
|
|
1555
1926
|
\u2705 Found ${items.length} ${itemName}:
|
|
1556
1927
|
`));
|
|
1557
1928
|
renderItemsForDisplay(items, functionInfo);
|
|
1558
1929
|
if (userSpecifiedMaxItems && maxItems) {
|
|
1559
1930
|
console.log(
|
|
1560
|
-
|
|
1931
|
+
chalk__default.default.gray(
|
|
1561
1932
|
`
|
|
1562
1933
|
\u{1F4C4} Showing up to ${maxItems} ${itemName} (--max-items ${maxItems})`
|
|
1563
1934
|
)
|
|
1564
1935
|
);
|
|
1565
1936
|
} else {
|
|
1566
|
-
console.log(
|
|
1937
|
+
console.log(chalk__default.default.gray(`
|
|
1567
1938
|
\u{1F4C4} All available ${itemName} shown`));
|
|
1568
1939
|
}
|
|
1569
1940
|
},
|
|
1570
1941
|
renderItem(value, options) {
|
|
1571
1942
|
if (options?.outputFile) {
|
|
1572
1943
|
const label = options.commandName ? `\u2705 ${options.commandName} completed successfully!` : "\u2705 Done!";
|
|
1573
|
-
console.log(
|
|
1574
|
-
console.log(
|
|
1944
|
+
console.log(chalk__default.default.green(label));
|
|
1945
|
+
console.log(chalk__default.default.gray(`Output written to: ${options.outputFile}`));
|
|
1575
1946
|
} else {
|
|
1576
1947
|
formatJsonOutput(value);
|
|
1577
1948
|
}
|
|
@@ -1581,17 +1952,17 @@ function createInteractiveRenderer() {
|
|
|
1581
1952
|
},
|
|
1582
1953
|
renderError(error) {
|
|
1583
1954
|
if (error instanceof ZapierCliMissingParametersError) {
|
|
1584
|
-
console.error(
|
|
1585
|
-
console.error("\n" +
|
|
1955
|
+
console.error(chalk__default.default.red("\u274C " + formatMissingParamsError(error)));
|
|
1956
|
+
console.error("\n" + chalk__default.default.dim("Use --help to see available options"));
|
|
1586
1957
|
throw new ZapierCliExitError(error.message, 1);
|
|
1587
1958
|
}
|
|
1588
1959
|
if (error instanceof zapierSdk.ZapierError) {
|
|
1589
1960
|
const formattedMessage = zapierSdk.formatErrorMessage(error);
|
|
1590
|
-
console.error(
|
|
1961
|
+
console.error(chalk__default.default.red("\u274C Error:"), formattedMessage);
|
|
1591
1962
|
throw new ZapierCliExitError(formattedMessage, 1);
|
|
1592
1963
|
}
|
|
1593
1964
|
const msg = error instanceof Error ? error.message : "Unknown error";
|
|
1594
|
-
console.error(
|
|
1965
|
+
console.error(chalk__default.default.red("\u274C Error:"), msg);
|
|
1595
1966
|
throw new ZapierCliExitError(msg, 1);
|
|
1596
1967
|
}
|
|
1597
1968
|
};
|
|
@@ -1701,7 +2072,7 @@ async function promptConfirm(confirmType, itemType) {
|
|
|
1701
2072
|
}
|
|
1702
2073
|
const configOrFn = CONFIRM_MESSAGES[confirmType];
|
|
1703
2074
|
const { messageBefore, messageAfter } = typeof configOrFn === "function" ? configOrFn(itemType) : configOrFn;
|
|
1704
|
-
console.log(
|
|
2075
|
+
console.log(chalk__default.default.yellow(`
|
|
1705
2076
|
${messageBefore}
|
|
1706
2077
|
`));
|
|
1707
2078
|
const { confirmed } = await inquirer__default.default.prompt([
|
|
@@ -1723,9 +2094,9 @@ function emitDeprecationWarning({
|
|
|
1723
2094
|
}
|
|
1724
2095
|
console.warn();
|
|
1725
2096
|
console.warn(
|
|
1726
|
-
|
|
2097
|
+
chalk__default.default.yellow.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk__default.default.yellow(` - \`${cliCommandName}\` is deprecated.`)
|
|
1727
2098
|
);
|
|
1728
|
-
console.warn(
|
|
2099
|
+
console.warn(chalk__default.default.yellow(` ${deprecation.message}`));
|
|
1729
2100
|
console.warn();
|
|
1730
2101
|
}
|
|
1731
2102
|
function emitParamDeprecationWarnings({
|
|
@@ -1739,12 +2110,12 @@ function emitParamDeprecationWarnings({
|
|
|
1739
2110
|
if (Array.isArray(value) && value.length === 0) continue;
|
|
1740
2111
|
console.warn();
|
|
1741
2112
|
console.warn(
|
|
1742
|
-
|
|
2113
|
+
chalk__default.default.yellow.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk__default.default.yellow(
|
|
1743
2114
|
` - \`${toKebabCase(param.name)}\` is deprecated and may be removed in a future release.`
|
|
1744
2115
|
)
|
|
1745
2116
|
);
|
|
1746
2117
|
if (param.deprecationMessage) {
|
|
1747
|
-
console.warn(
|
|
2118
|
+
console.warn(chalk__default.default.yellow(` ${param.deprecationMessage}`));
|
|
1748
2119
|
}
|
|
1749
2120
|
console.warn();
|
|
1750
2121
|
}
|
|
@@ -2075,7 +2446,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
2075
2446
|
functionInfo.itemType
|
|
2076
2447
|
);
|
|
2077
2448
|
if (!confirmResult.confirmed) {
|
|
2078
|
-
console.log(
|
|
2449
|
+
console.log(chalk__default.default.yellow("Operation cancelled."));
|
|
2079
2450
|
return;
|
|
2080
2451
|
}
|
|
2081
2452
|
confirmMessageAfter = confirmResult.messageAfter;
|
|
@@ -2137,7 +2508,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
2137
2508
|
renderer.renderItem(normalizedResult.value);
|
|
2138
2509
|
}
|
|
2139
2510
|
if (confirmMessageAfter) {
|
|
2140
|
-
console.log(
|
|
2511
|
+
console.log(chalk__default.default.yellow(`
|
|
2141
2512
|
${confirmMessageAfter}`));
|
|
2142
2513
|
}
|
|
2143
2514
|
break;
|
|
@@ -3180,20 +3551,20 @@ var spinPromise = async (promise, text) => {
|
|
|
3180
3551
|
};
|
|
3181
3552
|
var log = {
|
|
3182
3553
|
info: (message, ...args) => {
|
|
3183
|
-
console.log(
|
|
3554
|
+
console.log(chalk__default.default.blue("\u2139"), message, ...args);
|
|
3184
3555
|
},
|
|
3185
3556
|
error: (message, ...args) => {
|
|
3186
|
-
console.error(
|
|
3557
|
+
console.error(chalk__default.default.red("\u2716"), message, ...args);
|
|
3187
3558
|
},
|
|
3188
3559
|
success: (message, ...args) => {
|
|
3189
|
-
console.log(
|
|
3560
|
+
console.log(chalk__default.default.green("\u2713"), message, ...args);
|
|
3190
3561
|
},
|
|
3191
3562
|
warn: (message, ...args) => {
|
|
3192
|
-
console.log(
|
|
3563
|
+
console.log(chalk__default.default.yellow("\u26A0"), message, ...args);
|
|
3193
3564
|
},
|
|
3194
3565
|
debug: (message, ...args) => {
|
|
3195
3566
|
if (process.env.DEBUG === "true" || process.argv.includes("--debug")) {
|
|
3196
|
-
console.log(
|
|
3567
|
+
console.log(chalk__default.default.gray("\u{1F41B}"), message, ...args);
|
|
3197
3568
|
}
|
|
3198
3569
|
}
|
|
3199
3570
|
};
|
|
@@ -5403,7 +5774,7 @@ function buildTemplateVariables({
|
|
|
5403
5774
|
};
|
|
5404
5775
|
}
|
|
5405
5776
|
function cleanupProject({ projectDir }) {
|
|
5406
|
-
console.log("\n" +
|
|
5777
|
+
console.log("\n" + chalk__default.default.yellow("!") + " Cleaning up...");
|
|
5407
5778
|
fs.rmSync(projectDir, { recursive: true, force: true });
|
|
5408
5779
|
}
|
|
5409
5780
|
async function withInterruptCleanup(cleanup, fn) {
|
|
@@ -5613,8 +5984,8 @@ function buildNextSteps({
|
|
|
5613
5984
|
}
|
|
5614
5985
|
function createConsoleDisplayHooks() {
|
|
5615
5986
|
return {
|
|
5616
|
-
onItemComplete: (message) => console.log(" " +
|
|
5617
|
-
onWarn: (message) => console.warn(
|
|
5987
|
+
onItemComplete: (message) => console.log(" " + chalk__default.default.green("\u2713") + " " + chalk__default.default.dim(message)),
|
|
5988
|
+
onWarn: (message) => console.warn(chalk__default.default.yellow("!") + " " + message),
|
|
5618
5989
|
onStepStart: ({
|
|
5619
5990
|
description,
|
|
5620
5991
|
stepNumber,
|
|
@@ -5623,31 +5994,31 @@ function createConsoleDisplayHooks() {
|
|
|
5623
5994
|
skipPrompts
|
|
5624
5995
|
}) => {
|
|
5625
5996
|
const progressMessage = `${description}...`;
|
|
5626
|
-
const stepCounter =
|
|
5997
|
+
const stepCounter = chalk__default.default.dim(`${stepNumber}/${totalSteps}`);
|
|
5627
5998
|
if (skipPrompts) {
|
|
5628
5999
|
console.log(
|
|
5629
|
-
"\n" +
|
|
6000
|
+
"\n" + chalk__default.default.bold(`\u276F ${progressMessage}`) + " " + stepCounter + "\n"
|
|
5630
6001
|
);
|
|
5631
6002
|
} else {
|
|
5632
6003
|
console.log(
|
|
5633
|
-
|
|
6004
|
+
chalk__default.default.dim("\u2192") + " " + progressMessage + " " + stepCounter
|
|
5634
6005
|
);
|
|
5635
6006
|
}
|
|
5636
6007
|
if (command) {
|
|
5637
|
-
console.log(" " +
|
|
6008
|
+
console.log(" " + chalk__default.default.cyan(`$ ${command}`));
|
|
5638
6009
|
}
|
|
5639
6010
|
},
|
|
5640
6011
|
onStepSuccess: ({ stepNumber, totalSteps }) => console.log(
|
|
5641
|
-
"\n" +
|
|
6012
|
+
"\n" + chalk__default.default.green("\u2713") + " " + chalk__default.default.dim(`Step ${stepNumber}/${totalSteps} complete`) + "\n"
|
|
5642
6013
|
),
|
|
5643
6014
|
onStepError: ({ description, command, err }) => {
|
|
5644
6015
|
const detail = err instanceof Error && err.message ? `
|
|
5645
|
-
${
|
|
6016
|
+
${chalk__default.default.dim(err.message)}` : "";
|
|
5646
6017
|
const hint = command ? `
|
|
5647
|
-
${
|
|
6018
|
+
${chalk__default.default.dim("run manually:")} ${chalk__default.default.cyan(`$ ${command}`)}` : "";
|
|
5648
6019
|
console.error(
|
|
5649
6020
|
`
|
|
5650
|
-
${
|
|
6021
|
+
${chalk__default.default.red("\u2716")} ${chalk__default.default.bold(description)}${chalk__default.default.dim(" failed")}${detail}${hint}`
|
|
5651
6022
|
);
|
|
5652
6023
|
}
|
|
5653
6024
|
};
|
|
@@ -5659,22 +6030,22 @@ function displaySummaryAndNextSteps({
|
|
|
5659
6030
|
packageManager
|
|
5660
6031
|
}) {
|
|
5661
6032
|
const formatStatus = (complete) => ({
|
|
5662
|
-
icon: complete ?
|
|
5663
|
-
text: complete ?
|
|
6033
|
+
icon: complete ? chalk__default.default.green("\u2713") : chalk__default.default.yellow("!"),
|
|
6034
|
+
text: complete ? chalk__default.default.green("Setup complete") : chalk__default.default.yellow("Setup interrupted")
|
|
5664
6035
|
});
|
|
5665
|
-
const formatNextStep = (step, i) => " " +
|
|
5666
|
-
const formatCommand = (cmd) => " " +
|
|
5667
|
-
const formatCompletedStep = (step) => " " +
|
|
6036
|
+
const formatNextStep = (step, i) => " " + chalk__default.default.dim(`${i + 1}.`) + " " + chalk__default.default.bold(step.description);
|
|
6037
|
+
const formatCommand = (cmd) => " " + chalk__default.default.cyan(`$ ${cmd}`);
|
|
6038
|
+
const formatCompletedStep = (step) => " " + chalk__default.default.green("\u2713") + " " + step.description;
|
|
5668
6039
|
const { execCmd } = getPackageManagerCommands({ packageManager });
|
|
5669
6040
|
const leftoverSteps = steps.filter(
|
|
5670
6041
|
(s) => !completedSetupStepIds.includes(s.id)
|
|
5671
6042
|
);
|
|
5672
6043
|
const isComplete = leftoverSteps.length === 0;
|
|
5673
6044
|
const status = formatStatus(isComplete);
|
|
5674
|
-
console.log("\n" +
|
|
5675
|
-
console.log(" " +
|
|
6045
|
+
console.log("\n" + chalk__default.default.bold("\u276F Summary") + "\n");
|
|
6046
|
+
console.log(" " + chalk__default.default.dim("Project") + " " + chalk__default.default.bold(projectName));
|
|
5676
6047
|
console.log(
|
|
5677
|
-
" " +
|
|
6048
|
+
" " + chalk__default.default.dim("Status") + " " + status.icon + " " + status.text
|
|
5678
6049
|
);
|
|
5679
6050
|
const completedSteps = steps.filter(
|
|
5680
6051
|
(s) => completedSetupStepIds.includes(s.id)
|
|
@@ -5684,7 +6055,7 @@ function displaySummaryAndNextSteps({
|
|
|
5684
6055
|
for (const step of completedSteps) console.log(formatCompletedStep(step));
|
|
5685
6056
|
}
|
|
5686
6057
|
const nextSteps = buildNextSteps({ projectName, leftoverSteps, execCmd });
|
|
5687
|
-
console.log("\n" +
|
|
6058
|
+
console.log("\n" + chalk__default.default.bold("\u276F Next Steps") + "\n");
|
|
5688
6059
|
nextSteps.forEach((step, i) => {
|
|
5689
6060
|
console.log(formatNextStep(step, i));
|
|
5690
6061
|
if (step.command) console.log(formatCommand(step.command));
|
|
@@ -5760,13 +6131,13 @@ function createInteractiveCallback() {
|
|
|
5760
6131
|
const attrs = message.message_attributes;
|
|
5761
6132
|
console.log(
|
|
5762
6133
|
`
|
|
5763
|
-
${
|
|
6134
|
+
${chalk__default.default.bold(`Message #${messageNumber}`)} ${chalk__default.default.dim(message.id)} ${chalk__default.default.dim(`(lease #${attrs.lease_count})`)}`
|
|
5764
6135
|
);
|
|
5765
6136
|
if (attrs.error_message) {
|
|
5766
|
-
console.log(
|
|
6137
|
+
console.log(chalk__default.default.yellow(` upstream error: ${attrs.error_message}`));
|
|
5767
6138
|
}
|
|
5768
6139
|
if (attrs.possible_duplicate_data) {
|
|
5769
|
-
console.log(
|
|
6140
|
+
console.log(chalk__default.default.yellow(" possible duplicate data"));
|
|
5770
6141
|
}
|
|
5771
6142
|
while (true) {
|
|
5772
6143
|
let action;
|
|
@@ -5796,7 +6167,7 @@ ${chalk7__default.default.bold(`Message #${messageNumber}`)} ${chalk7__default.d
|
|
|
5796
6167
|
throw error;
|
|
5797
6168
|
}
|
|
5798
6169
|
if (action === "view") {
|
|
5799
|
-
console.log(
|
|
6170
|
+
console.log(chalk__default.default.dim(JSON.stringify(message.payload, null, 2)));
|
|
5800
6171
|
continue;
|
|
5801
6172
|
}
|
|
5802
6173
|
if (action === "ack") {
|
|
@@ -5899,7 +6270,7 @@ function describeReason(reason) {
|
|
|
5899
6270
|
}
|
|
5900
6271
|
function printDrainError(reason, message) {
|
|
5901
6272
|
console.error(
|
|
5902
|
-
|
|
6273
|
+
chalk__default.default.red(`Error processing ${message.id}: ${describeReason(reason)}`)
|
|
5903
6274
|
);
|
|
5904
6275
|
}
|
|
5905
6276
|
function printDrainSummary(counts) {
|
|
@@ -5909,7 +6280,7 @@ function printDrainSummary(counts) {
|
|
|
5909
6280
|
if (skipped > 0) parts.push(`${skipped} skipped`);
|
|
5910
6281
|
parts.push(`${counts.rejected} rejected`);
|
|
5911
6282
|
console.log(
|
|
5912
|
-
|
|
6283
|
+
chalk__default.default.dim(
|
|
5913
6284
|
`
|
|
5914
6285
|
Processed ${total} message${total === 1 ? "" : "s"} (${parts.join(", ")}).`
|
|
5915
6286
|
)
|
|
@@ -5917,7 +6288,7 @@ Processed ${total} message${total === 1 ? "" : "s"} (${parts.join(", ")}).`
|
|
|
5917
6288
|
}
|
|
5918
6289
|
function warnInteractiveContinueOnErrorOverride() {
|
|
5919
6290
|
console.warn(
|
|
5920
|
-
|
|
6291
|
+
chalk__default.default.yellow(
|
|
5921
6292
|
'Note: continueOnError=false is overridden to true in interactive mode (the "Skip (let lease expire)" choice would otherwise terminate the drain).'
|
|
5922
6293
|
)
|
|
5923
6294
|
);
|
|
@@ -6221,7 +6592,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
|
|
|
6221
6592
|
// package.json with { type: 'json' }
|
|
6222
6593
|
var package_default2 = {
|
|
6223
6594
|
name: "@zapier/zapier-sdk-cli",
|
|
6224
|
-
version: "0.
|
|
6595
|
+
version: "0.49.0"};
|
|
6225
6596
|
|
|
6226
6597
|
// src/sdk.ts
|
|
6227
6598
|
zapierSdk.injectCliLogin(login_exports);
|
|
@@ -6428,26 +6799,26 @@ function displayUpdateNotification(versionInfo, packageName) {
|
|
|
6428
6799
|
if (versionInfo.isDeprecated) {
|
|
6429
6800
|
console.error();
|
|
6430
6801
|
console.error(
|
|
6431
|
-
|
|
6802
|
+
chalk__default.default.red.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk__default.default.red(
|
|
6432
6803
|
` - ${packageName} v${versionInfo.currentVersion} is deprecated.`
|
|
6433
6804
|
)
|
|
6434
6805
|
);
|
|
6435
6806
|
if (versionInfo.deprecationMessage) {
|
|
6436
|
-
console.error(
|
|
6807
|
+
console.error(chalk__default.default.red(` ${versionInfo.deprecationMessage}`));
|
|
6437
6808
|
}
|
|
6438
|
-
console.error(
|
|
6809
|
+
console.error(chalk__default.default.red(` Please update to the latest version.`));
|
|
6439
6810
|
console.error();
|
|
6440
6811
|
}
|
|
6441
6812
|
if (versionInfo.hasUpdate) {
|
|
6442
6813
|
console.error();
|
|
6443
6814
|
console.error(
|
|
6444
|
-
|
|
6815
|
+
chalk__default.default.yellow.bold("\u{1F4E6} Update available!") + chalk__default.default.yellow(
|
|
6445
6816
|
` ${packageName} v${versionInfo.currentVersion} \u2192 v${versionInfo.latestVersion}`
|
|
6446
6817
|
)
|
|
6447
6818
|
);
|
|
6448
6819
|
console.error(
|
|
6449
|
-
|
|
6450
|
-
` Run ${
|
|
6820
|
+
chalk__default.default.yellow(
|
|
6821
|
+
` Run ${chalk__default.default.bold(getUpdateCommand(packageName))} to update.`
|
|
6451
6822
|
)
|
|
6452
6823
|
);
|
|
6453
6824
|
console.error();
|