@zapier/zapier-sdk-cli 0.84.6 → 0.85.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 +27 -0
- package/README.md +17 -3
- package/bin/zapier-sdk-experimental.mjs +8 -0
- package/dist/cli.cjs +297 -150
- package/dist/cli.mjs +305 -158
- package/dist/experimental.cjs +37 -18
- package/dist/experimental.d.mts +9 -7
- package/dist/experimental.d.ts +9 -7
- package/dist/experimental.mjs +38 -19
- package/dist/index.cjs +106 -83
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +106 -83
- package/package.json +4 -4
package/dist/cli.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var commander = require('commander');
|
|
|
5
5
|
var zapierSdk = require('@zapier/zapier-sdk');
|
|
6
6
|
var zod = require('zod');
|
|
7
7
|
var inquirer = require('inquirer');
|
|
8
|
-
var
|
|
8
|
+
var chalk10 = require('chalk');
|
|
9
9
|
var core = require('@inquirer/core');
|
|
10
10
|
var ora = require('ora');
|
|
11
11
|
var fs = require('fs');
|
|
@@ -35,6 +35,7 @@ var semver = require('semver');
|
|
|
35
35
|
var crossSpawn = require('cross-spawn');
|
|
36
36
|
var Table = require('cli-table3');
|
|
37
37
|
var experimental = require('@zapier/zapier-sdk/experimental');
|
|
38
|
+
var beta = require('@zapier/zapier-sdk/beta');
|
|
38
39
|
var readline = require('readline');
|
|
39
40
|
|
|
40
41
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -59,7 +60,7 @@ function _interopNamespace(e) {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
var inquirer__default = /*#__PURE__*/_interopDefault(inquirer);
|
|
62
|
-
var
|
|
63
|
+
var chalk10__default = /*#__PURE__*/_interopDefault(chalk10);
|
|
63
64
|
var ora__default = /*#__PURE__*/_interopDefault(ora);
|
|
64
65
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
65
66
|
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
@@ -104,9 +105,9 @@ function normalizeChoices(choices) {
|
|
|
104
105
|
var theme = core.makeTheme({
|
|
105
106
|
icon: { cursor: "\u276F" },
|
|
106
107
|
style: {
|
|
107
|
-
disabled: (text) =>
|
|
108
|
-
searchTerm: (text) =>
|
|
109
|
-
keysHelpTip: (keys) => keys.map(([key, action]) => `${
|
|
108
|
+
disabled: (text) => chalk10__default.default.dim(`- ${text}`),
|
|
109
|
+
searchTerm: (text) => chalk10__default.default.cyan(text),
|
|
110
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${chalk10__default.default.bold(key)} ${chalk10__default.default.dim(action)}`).join(chalk10__default.default.dim(" \u2022 "))
|
|
110
111
|
}
|
|
111
112
|
});
|
|
112
113
|
var searchSelect = core.createPrompt(
|
|
@@ -249,10 +250,10 @@ async function promptText({
|
|
|
249
250
|
]);
|
|
250
251
|
return value;
|
|
251
252
|
}
|
|
252
|
-
var display = (c) => c.hint ? `${c.label} ${
|
|
253
|
+
var display = (c) => c.hint ? `${c.label} ${chalk10__default.default.dim(`(${c.hint})`)}` : c.label;
|
|
253
254
|
var HIGH_CONTRAST_PROMPT_THEME = {
|
|
254
255
|
style: {
|
|
255
|
-
answer: (text) =>
|
|
256
|
+
answer: (text) => chalk10__default.default.inverse.bold(` ${text} `)
|
|
256
257
|
}
|
|
257
258
|
};
|
|
258
259
|
function buildSelectRows(question, term) {
|
|
@@ -268,8 +269,8 @@ function buildSelectRows(question, term) {
|
|
|
268
269
|
name: display(c),
|
|
269
270
|
value: c.value
|
|
270
271
|
}));
|
|
271
|
-
const skipRow = offers(question, "skip") ? [row(
|
|
272
|
-
const customRow = offers(question, "custom") ? [row(
|
|
272
|
+
const skipRow = offers(question, "skip") ? [row(chalk10__default.default.dim("Skip (optional)"), "skip")] : [];
|
|
273
|
+
const customRow = offers(question, "custom") ? [row(chalk10__default.default.dim("Enter a value manually\u2026"), "custom")] : [];
|
|
273
274
|
const committed = !!t || question.search !== void 0;
|
|
274
275
|
let rows;
|
|
275
276
|
if (!committed) {
|
|
@@ -280,13 +281,13 @@ function buildSelectRows(question, term) {
|
|
|
280
281
|
rows = [...customRow, ...skipRow];
|
|
281
282
|
}
|
|
282
283
|
if (offers(question, "search"))
|
|
283
|
-
rows.push(row(
|
|
284
|
+
rows.push(row(chalk10__default.default.cyan("Search again\u2026"), "search"));
|
|
284
285
|
if (offers(question, "next_page"))
|
|
285
|
-
rows.push(row(
|
|
286
|
-
if (offers(question, "retry")) rows.push(row(
|
|
287
|
-
if (offers(question, "cancel")) rows.push(row(
|
|
286
|
+
rows.push(row(chalk10__default.default.dim("Load more\u2026"), "next_page"));
|
|
287
|
+
if (offers(question, "retry")) rows.push(row(chalk10__default.default.yellow("Retry"), "retry"));
|
|
288
|
+
if (offers(question, "cancel")) rows.push(row(chalk10__default.default.dim("Cancel"), "cancel"));
|
|
288
289
|
for (const note of question.notes ?? [])
|
|
289
|
-
rows.push({ name:
|
|
290
|
+
rows.push({ name: chalk10__default.default.dim(note), value: note, disabled: true });
|
|
290
291
|
return rows;
|
|
291
292
|
}
|
|
292
293
|
function foldPage(acc, question, field) {
|
|
@@ -366,12 +367,12 @@ async function answerSelect(question, field, box, failed, mode) {
|
|
|
366
367
|
})),
|
|
367
368
|
...offers(question, "next_page") ? [
|
|
368
369
|
{
|
|
369
|
-
name:
|
|
370
|
+
name: chalk10__default.default.dim("Load more\u2026"),
|
|
370
371
|
value: { action: "next_page" }
|
|
371
372
|
}
|
|
372
373
|
] : [],
|
|
373
374
|
...(question.notes ?? []).map((note) => ({
|
|
374
|
-
name:
|
|
375
|
+
name: chalk10__default.default.dim(note),
|
|
375
376
|
value: note,
|
|
376
377
|
disabled: true
|
|
377
378
|
}))
|
|
@@ -448,14 +449,14 @@ async function answerSelect(question, field, box, failed, mode) {
|
|
|
448
449
|
case "retry":
|
|
449
450
|
return { type: "retry" };
|
|
450
451
|
case "skip":
|
|
451
|
-
printAnswered(view.message,
|
|
452
|
+
printAnswered(view.message, chalk10__default.default.dim("(skipped)"));
|
|
452
453
|
return { type: "skip" };
|
|
453
454
|
case "cancel":
|
|
454
455
|
return { type: "cancel" };
|
|
455
456
|
}
|
|
456
457
|
}
|
|
457
458
|
function printAnswered(message, label) {
|
|
458
|
-
console.log(`${
|
|
459
|
+
console.log(`${chalk10__default.default.green("\u2714")} ${message} ${chalk10__default.default.cyan(label)}`);
|
|
459
460
|
}
|
|
460
461
|
async function answerInput(question) {
|
|
461
462
|
const message = question.placeholder ? question.message.replace(/:?\s*$/, ` (${question.placeholder}):`) : question.message;
|
|
@@ -502,7 +503,7 @@ function createCliAnswer({
|
|
|
502
503
|
try {
|
|
503
504
|
if (result.error !== void 0) {
|
|
504
505
|
const message = typeof result.error === "string" ? result.error : result.error.message;
|
|
505
|
-
console.log(
|
|
506
|
+
console.log(chalk10__default.default.yellow(`! ${message}`));
|
|
506
507
|
}
|
|
507
508
|
const question = result.question;
|
|
508
509
|
const field = question.path.length ? question.path.join(".") : "value";
|
|
@@ -571,8 +572,6 @@ var ZapierCliMissingParametersError = class extends ZapierCliError {
|
|
|
571
572
|
this.params = params;
|
|
572
573
|
}
|
|
573
574
|
};
|
|
574
|
-
|
|
575
|
-
// src/utils/cli-options.ts
|
|
576
575
|
var RESERVED_CLI_OPTIONS = [
|
|
577
576
|
{
|
|
578
577
|
name: "version" /* Version */,
|
|
@@ -585,6 +584,11 @@ var RESERVED_CLI_OPTIONS = [
|
|
|
585
584
|
flag: "--help",
|
|
586
585
|
short: "-h",
|
|
587
586
|
description: "Display help for command"
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
name: "stability" /* Stability */,
|
|
590
|
+
flag: "--stability <level>",
|
|
591
|
+
description: `Which stability tier of the SDK / CLI surface to use: ${zapierSdk.STABILITY_LEVELS.join(", ")}. Can also be set with the ZAPIER_STABILITY environment variable (default: stable).`
|
|
588
592
|
}
|
|
589
593
|
];
|
|
590
594
|
function getReservedCliOption(name) {
|
|
@@ -602,7 +606,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
|
|
|
602
606
|
|
|
603
607
|
// package.json
|
|
604
608
|
var package_default = {
|
|
605
|
-
version: "0.
|
|
609
|
+
version: "0.85.0"};
|
|
606
610
|
var PACKAGE_MANAGERS = ["npm", "pnpm", "yarn", "bun"];
|
|
607
611
|
var LOCKFILES = [
|
|
608
612
|
["pnpm-lock.yaml", "pnpm"],
|
|
@@ -767,7 +771,7 @@ async function formatItemsFromSchema(_functionInfo, items, startingNumber = 0, o
|
|
|
767
771
|
formatItemsGeneric(items, startingNumber);
|
|
768
772
|
}
|
|
769
773
|
function formatSingleItem(formatted, itemNumber) {
|
|
770
|
-
let titleLine = `${
|
|
774
|
+
let titleLine = `${chalk10__default.default.gray(`${itemNumber + 1}.`)} ${chalk10__default.default.cyan(formatted.title)}`;
|
|
771
775
|
const subtitleParts = [];
|
|
772
776
|
if (formatted.hint !== void 0) {
|
|
773
777
|
subtitleParts.push(
|
|
@@ -785,11 +789,11 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
785
789
|
}
|
|
786
790
|
const uniqueParts = [...new Set(subtitleParts)];
|
|
787
791
|
if (uniqueParts.length > 0) {
|
|
788
|
-
titleLine += ` ${
|
|
792
|
+
titleLine += ` ${chalk10__default.default.gray(`(${uniqueParts.join(", ")})`)}`;
|
|
789
793
|
}
|
|
790
794
|
console.log(titleLine);
|
|
791
795
|
if (formatted.description) {
|
|
792
|
-
console.log(` ${
|
|
796
|
+
console.log(` ${chalk10__default.default.dim(formatted.description)}`);
|
|
793
797
|
}
|
|
794
798
|
if (formatted.raw !== void 0) {
|
|
795
799
|
formatJsonOutput(formatted.raw);
|
|
@@ -800,7 +804,7 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
800
804
|
if (detail.label) {
|
|
801
805
|
const isMultiline = detail.text.includes("\n");
|
|
802
806
|
if (isMultiline) {
|
|
803
|
-
console.log(` ${
|
|
807
|
+
console.log(` ${chalk10__default.default.gray(detail.label + ":")}`);
|
|
804
808
|
const displayText = formatDetailText(
|
|
805
809
|
detail.text,
|
|
806
810
|
DETAIL_INDENT + " "
|
|
@@ -809,7 +813,7 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
809
813
|
console.log(`${DETAIL_INDENT} ${styledText}`);
|
|
810
814
|
} else {
|
|
811
815
|
const styledValue = applyStyle(detail.text, detail.style);
|
|
812
|
-
console.log(` ${
|
|
816
|
+
console.log(` ${chalk10__default.default.gray(detail.label + ":")} ${styledValue}`);
|
|
813
817
|
}
|
|
814
818
|
} else {
|
|
815
819
|
const displayText = formatDetailText(detail.text, DETAIL_INDENT);
|
|
@@ -833,16 +837,16 @@ function formatDetailText(text, indent = DETAIL_INDENT) {
|
|
|
833
837
|
function applyStyle(value, style) {
|
|
834
838
|
switch (style) {
|
|
835
839
|
case "dim":
|
|
836
|
-
return
|
|
840
|
+
return chalk10__default.default.dim(value);
|
|
837
841
|
case "accent":
|
|
838
|
-
return
|
|
842
|
+
return chalk10__default.default.magenta(value);
|
|
839
843
|
case "warning":
|
|
840
|
-
return
|
|
844
|
+
return chalk10__default.default.red(value);
|
|
841
845
|
case "success":
|
|
842
|
-
return
|
|
846
|
+
return chalk10__default.default.green(value);
|
|
843
847
|
case "normal":
|
|
844
848
|
default:
|
|
845
|
-
return
|
|
849
|
+
return chalk10__default.default.blue(value);
|
|
846
850
|
}
|
|
847
851
|
}
|
|
848
852
|
function convertGenericItemToFormattedItem(item) {
|
|
@@ -991,10 +995,10 @@ function createInteractiveRenderer(context = {}) {
|
|
|
991
995
|
const obj = item;
|
|
992
996
|
const name = obj?.name || obj?.key || obj?.id || "Item";
|
|
993
997
|
console.log(
|
|
994
|
-
`${
|
|
998
|
+
`${chalk10__default.default.gray(`${startingNumber + index + 1}.`)} ${chalk10__default.default.cyan(String(name))}`
|
|
995
999
|
);
|
|
996
1000
|
if (obj?.description)
|
|
997
|
-
console.log(` ${
|
|
1001
|
+
console.log(` ${chalk10__default.default.dim(String(obj.description))}`);
|
|
998
1002
|
console.log();
|
|
999
1003
|
});
|
|
1000
1004
|
}
|
|
@@ -1005,35 +1009,35 @@ function createInteractiveRenderer(context = {}) {
|
|
|
1005
1009
|
if (!(Symbol.asyncIterator in Object(source))) {
|
|
1006
1010
|
const items = source?.data;
|
|
1007
1011
|
if (!Array.isArray(items) || items.length === 0) {
|
|
1008
|
-
console.log(
|
|
1012
|
+
console.log(chalk10__default.default.yellow(`No ${itemName} found.`));
|
|
1009
1013
|
return;
|
|
1010
1014
|
}
|
|
1011
1015
|
await renderItemsForDisplay(items, functionInfo, 0);
|
|
1012
|
-
console.log(
|
|
1016
|
+
console.log(chalk10__default.default.green(`
|
|
1013
1017
|
\u2705 Showing ${items.length} ${itemName}`));
|
|
1014
1018
|
return;
|
|
1015
1019
|
}
|
|
1016
1020
|
let totalShown = 0;
|
|
1017
1021
|
let pageCount = 0;
|
|
1018
|
-
console.log(
|
|
1022
|
+
console.log(chalk10__default.default.blue(`\u{1F4CB} ${getListTitle(functionInfo)}
|
|
1019
1023
|
`));
|
|
1020
1024
|
for await (const page of source) {
|
|
1021
1025
|
const items = page.data ?? [];
|
|
1022
1026
|
pageCount++;
|
|
1023
1027
|
if (items.length === 0 && pageCount === 1) {
|
|
1024
|
-
console.log(
|
|
1028
|
+
console.log(chalk10__default.default.yellow(`No ${itemName} found.`));
|
|
1025
1029
|
return;
|
|
1026
1030
|
}
|
|
1027
1031
|
if (items.length === 0) break;
|
|
1028
1032
|
if (pageCount > 1) {
|
|
1029
1033
|
console.clear();
|
|
1030
|
-
console.log(
|
|
1034
|
+
console.log(chalk10__default.default.blue(`\u{1F4CB} ${getListTitle(functionInfo)}
|
|
1031
1035
|
`));
|
|
1032
1036
|
}
|
|
1033
1037
|
await renderItemsForDisplay(items, functionInfo, totalShown);
|
|
1034
1038
|
totalShown += items.length;
|
|
1035
1039
|
console.log(
|
|
1036
|
-
|
|
1040
|
+
chalk10__default.default.green(
|
|
1037
1041
|
`
|
|
1038
1042
|
\u2705 Showing ${totalShown} ${itemName} (page ${pageCount})`
|
|
1039
1043
|
)
|
|
@@ -1052,7 +1056,7 @@ function createInteractiveRenderer(context = {}) {
|
|
|
1052
1056
|
break;
|
|
1053
1057
|
}
|
|
1054
1058
|
}
|
|
1055
|
-
console.log(
|
|
1059
|
+
console.log(chalk10__default.default.gray(`
|
|
1056
1060
|
\u{1F4C4} Finished browsing ${itemName}`));
|
|
1057
1061
|
},
|
|
1058
1062
|
async renderCollectedList(items, { maxItems, userSpecifiedMaxItems, functionInfo } = {}) {
|
|
@@ -1062,30 +1066,30 @@ function createInteractiveRenderer(context = {}) {
|
|
|
1062
1066
|
}
|
|
1063
1067
|
const itemName = getItemName(functionInfo);
|
|
1064
1068
|
if (items.length === 0) {
|
|
1065
|
-
console.log(
|
|
1069
|
+
console.log(chalk10__default.default.yellow(`No ${itemName} found.`));
|
|
1066
1070
|
return;
|
|
1067
1071
|
}
|
|
1068
|
-
console.log(
|
|
1072
|
+
console.log(chalk10__default.default.green(`
|
|
1069
1073
|
\u2705 Found ${items.length} ${itemName}:
|
|
1070
1074
|
`));
|
|
1071
1075
|
await renderItemsForDisplay(items, functionInfo);
|
|
1072
1076
|
if (userSpecifiedMaxItems && maxItems) {
|
|
1073
1077
|
console.log(
|
|
1074
|
-
|
|
1078
|
+
chalk10__default.default.gray(
|
|
1075
1079
|
`
|
|
1076
1080
|
\u{1F4C4} Showing up to ${maxItems} ${itemName} (--max-items ${maxItems})`
|
|
1077
1081
|
)
|
|
1078
1082
|
);
|
|
1079
1083
|
} else {
|
|
1080
|
-
console.log(
|
|
1084
|
+
console.log(chalk10__default.default.gray(`
|
|
1081
1085
|
\u{1F4C4} All available ${itemName} shown`));
|
|
1082
1086
|
}
|
|
1083
1087
|
},
|
|
1084
1088
|
renderItem(value, options) {
|
|
1085
1089
|
if (options?.outputFile) {
|
|
1086
1090
|
const label = options.commandName ? `\u2705 ${options.commandName} completed successfully!` : "\u2705 Done!";
|
|
1087
|
-
console.log(
|
|
1088
|
-
console.log(
|
|
1091
|
+
console.log(chalk10__default.default.green(label));
|
|
1092
|
+
console.log(chalk10__default.default.gray(`Output written to: ${options.outputFile}`));
|
|
1089
1093
|
} else {
|
|
1090
1094
|
formatJsonOutput(value);
|
|
1091
1095
|
}
|
|
@@ -1095,17 +1099,17 @@ function createInteractiveRenderer(context = {}) {
|
|
|
1095
1099
|
},
|
|
1096
1100
|
renderError(error) {
|
|
1097
1101
|
if (error instanceof ZapierCliMissingParametersError) {
|
|
1098
|
-
console.error(
|
|
1099
|
-
console.error("\n" +
|
|
1102
|
+
console.error(chalk10__default.default.red("\u274C " + formatMissingParamsError(error)));
|
|
1103
|
+
console.error("\n" + chalk10__default.default.dim("Use --help to see available options"));
|
|
1100
1104
|
throw new ZapierCliExitError(error.message, 1);
|
|
1101
1105
|
}
|
|
1102
1106
|
if (zapierSdk.isZapierError(error)) {
|
|
1103
1107
|
const formattedMessage = zapierSdk.formatErrorMessage(error);
|
|
1104
|
-
console.error(
|
|
1108
|
+
console.error(chalk10__default.default.red("\u274C Error:"), formattedMessage);
|
|
1105
1109
|
throw new ZapierCliExitError(formattedMessage, 1);
|
|
1106
1110
|
}
|
|
1107
1111
|
const msg = error instanceof Error ? error.message : "Unknown error";
|
|
1108
|
-
console.error(
|
|
1112
|
+
console.error(chalk10__default.default.red("\u274C Error:"), msg);
|
|
1109
1113
|
throw new ZapierCliExitError(msg, 1);
|
|
1110
1114
|
}
|
|
1111
1115
|
};
|
|
@@ -1148,6 +1152,17 @@ function sanitizeCliArguments(args) {
|
|
|
1148
1152
|
function resolveNonInteractive(options) {
|
|
1149
1153
|
return options.nonInteractive === true || options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
|
|
1150
1154
|
}
|
|
1155
|
+
function warningBlock({
|
|
1156
|
+
banner,
|
|
1157
|
+
message,
|
|
1158
|
+
detail
|
|
1159
|
+
}) {
|
|
1160
|
+
console.warn();
|
|
1161
|
+
console.warn(chalk10__default.default.yellow.bold(banner) + chalk10__default.default.yellow(message));
|
|
1162
|
+
if (detail) console.warn(chalk10__default.default.yellow(` ${detail}`));
|
|
1163
|
+
console.warn();
|
|
1164
|
+
}
|
|
1165
|
+
var DEPRECATION_BANNER = "\u26A0\uFE0F DEPRECATION WARNING";
|
|
1151
1166
|
var CLI_COMMAND_EXECUTED_EVENT_SUBJECT = "platform.sdk.CliCommandExecutedEvent";
|
|
1152
1167
|
var PAGINATION_PARAM_NAMES = /* @__PURE__ */ new Set(["maxItems", "pageSize", "cursor"]);
|
|
1153
1168
|
function getNormalizedResult(result, { isListCommand }) {
|
|
@@ -1221,7 +1236,7 @@ async function promptConfirm(confirmType, itemType) {
|
|
|
1221
1236
|
}
|
|
1222
1237
|
const configOrFn = CONFIRM_MESSAGES[confirmType];
|
|
1223
1238
|
const { messageBefore, messageAfter } = typeof configOrFn === "function" ? configOrFn(itemType) : configOrFn;
|
|
1224
|
-
console.log(
|
|
1239
|
+
console.log(chalk10__default.default.yellow(`
|
|
1225
1240
|
${messageBefore}
|
|
1226
1241
|
`));
|
|
1227
1242
|
const { confirmed } = await inquirer__default.default.prompt([
|
|
@@ -1243,16 +1258,11 @@ function emitParamDeprecationWarnings({
|
|
|
1243
1258
|
const value = options[param.name];
|
|
1244
1259
|
if (value === void 0) continue;
|
|
1245
1260
|
if (Array.isArray(value) && value.length === 0) continue;
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
);
|
|
1252
|
-
if (param.deprecationMessage) {
|
|
1253
|
-
console.warn(chalk9__default.default.yellow(` ${param.deprecationMessage}`));
|
|
1254
|
-
}
|
|
1255
|
-
console.warn();
|
|
1261
|
+
warningBlock({
|
|
1262
|
+
banner: DEPRECATION_BANNER,
|
|
1263
|
+
message: ` - \`${toKebabCase(param.name)}\` is deprecated and may be removed in a future release.`,
|
|
1264
|
+
detail: param.deprecationMessage
|
|
1265
|
+
});
|
|
1256
1266
|
}
|
|
1257
1267
|
}
|
|
1258
1268
|
function resolveOutputMode({
|
|
@@ -1467,6 +1477,12 @@ function readCliRegistry(sdk) {
|
|
|
1467
1477
|
function generateCliCommands(program2, sdk) {
|
|
1468
1478
|
const registry = readCliRegistry(sdk);
|
|
1469
1479
|
if (!registry) return;
|
|
1480
|
+
const stabilityByCommandName = new Map(
|
|
1481
|
+
registry.functions.map((fn) => [
|
|
1482
|
+
methodNameToCliCommand(fn.name),
|
|
1483
|
+
fn.stability
|
|
1484
|
+
])
|
|
1485
|
+
);
|
|
1470
1486
|
registry.functions.forEach((fnInfo) => {
|
|
1471
1487
|
if (!fnInfo.inputSchema) {
|
|
1472
1488
|
console.warn(`Schema not found for ${fnInfo.name}`);
|
|
@@ -1501,6 +1517,15 @@ function generateCliCommands(program2, sdk) {
|
|
|
1501
1517
|
const commands = helper.visibleCommands(cmd);
|
|
1502
1518
|
if (commands.length > 0) {
|
|
1503
1519
|
output += "\nCommands:\n";
|
|
1520
|
+
const labeledSubcommandTerm = (command) => {
|
|
1521
|
+
const term = helper.subcommandTerm(command);
|
|
1522
|
+
const name = command.name();
|
|
1523
|
+
const labeledName = zapierSdk.applyStabilityLabel({
|
|
1524
|
+
description: name,
|
|
1525
|
+
stability: stabilityByCommandName.get(name)
|
|
1526
|
+
});
|
|
1527
|
+
return labeledName !== name && term.startsWith(name) ? labeledName + term.slice(name.length) : term;
|
|
1528
|
+
};
|
|
1504
1529
|
const categorizedCommands = /* @__PURE__ */ new Set();
|
|
1505
1530
|
registry.categories.forEach((category) => {
|
|
1506
1531
|
const categoryCommands = commands.filter(
|
|
@@ -1514,7 +1539,7 @@ function generateCliCommands(program2, sdk) {
|
|
|
1514
1539
|
${category.titlePlural}:
|
|
1515
1540
|
`;
|
|
1516
1541
|
categoryCommands.forEach((command) => {
|
|
1517
|
-
output += ` ${
|
|
1542
|
+
output += ` ${labeledSubcommandTerm(command)}
|
|
1518
1543
|
`;
|
|
1519
1544
|
categorizedCommands.add(command.name());
|
|
1520
1545
|
});
|
|
@@ -1528,7 +1553,7 @@ function generateCliCommands(program2, sdk) {
|
|
|
1528
1553
|
Other:
|
|
1529
1554
|
`;
|
|
1530
1555
|
otherCommands.forEach((command) => {
|
|
1531
|
-
output += ` ${
|
|
1556
|
+
output += ` ${labeledSubcommandTerm(command)}
|
|
1532
1557
|
`;
|
|
1533
1558
|
});
|
|
1534
1559
|
}
|
|
@@ -1553,7 +1578,10 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
1553
1578
|
}
|
|
1554
1579
|
}
|
|
1555
1580
|
const baseDescription = functionInfo.description || schema?.description || `${cliCommandName} command`;
|
|
1556
|
-
const description =
|
|
1581
|
+
const description = zapierSdk.applyStabilityLabel({
|
|
1582
|
+
description: baseDescription,
|
|
1583
|
+
stability: functionInfo.stability
|
|
1584
|
+
});
|
|
1557
1585
|
const handler = async (...args) => {
|
|
1558
1586
|
const startTime = Date.now();
|
|
1559
1587
|
let success = true;
|
|
@@ -1649,7 +1677,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
1649
1677
|
functionInfo.itemType
|
|
1650
1678
|
);
|
|
1651
1679
|
if (!confirmResult.confirmed) {
|
|
1652
|
-
console.log(
|
|
1680
|
+
console.log(chalk10__default.default.yellow("Operation cancelled."));
|
|
1653
1681
|
return;
|
|
1654
1682
|
}
|
|
1655
1683
|
confirmMessageAfter = confirmResult.messageAfter;
|
|
@@ -1710,7 +1738,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
1710
1738
|
renderer.renderItem(normalizedResult.value);
|
|
1711
1739
|
}
|
|
1712
1740
|
if (confirmMessageAfter) {
|
|
1713
|
-
console.log(
|
|
1741
|
+
console.log(chalk10__default.default.yellow(`
|
|
1714
1742
|
${confirmMessageAfter}`));
|
|
1715
1743
|
}
|
|
1716
1744
|
break;
|
|
@@ -3129,14 +3157,14 @@ function formatCredentialsChoice({
|
|
|
3129
3157
|
credentials: credentials2,
|
|
3130
3158
|
current
|
|
3131
3159
|
}) {
|
|
3132
|
-
const currentLabel = current ?
|
|
3160
|
+
const currentLabel = current ? chalk10__default.default.cyan(" (current)") : "";
|
|
3133
3161
|
const details = [
|
|
3134
3162
|
credentials2.clientId,
|
|
3135
3163
|
credentials2.scopes.join(", "),
|
|
3136
3164
|
`created ${createdAtIso(credentials2).slice(0, 10)}`
|
|
3137
3165
|
].join(" \xB7 ");
|
|
3138
3166
|
return {
|
|
3139
|
-
name: `${credentials2.name}${currentLabel} ${
|
|
3167
|
+
name: `${credentials2.name}${currentLabel} ${chalk10__default.default.dim(`\xB7 ${details}`)}`,
|
|
3140
3168
|
short: credentials2.name,
|
|
3141
3169
|
value: { action: "switch", credentials: credentials2 }
|
|
3142
3170
|
};
|
|
@@ -3312,20 +3340,20 @@ var getCallablePromise = () => {
|
|
|
3312
3340
|
var getCallablePromise_default = getCallablePromise;
|
|
3313
3341
|
var log = {
|
|
3314
3342
|
info: (message, ...args) => {
|
|
3315
|
-
console.error(
|
|
3343
|
+
console.error(chalk10__default.default.blue("\u2139"), message, ...args);
|
|
3316
3344
|
},
|
|
3317
3345
|
error: (message, ...args) => {
|
|
3318
|
-
console.error(
|
|
3346
|
+
console.error(chalk10__default.default.red("\u2716"), message, ...args);
|
|
3319
3347
|
},
|
|
3320
3348
|
success: (message, ...args) => {
|
|
3321
|
-
console.error(
|
|
3349
|
+
console.error(chalk10__default.default.green("\u2713"), message, ...args);
|
|
3322
3350
|
},
|
|
3323
3351
|
warn: (message, ...args) => {
|
|
3324
|
-
console.error(
|
|
3352
|
+
console.error(chalk10__default.default.yellow("\u26A0"), message, ...args);
|
|
3325
3353
|
},
|
|
3326
3354
|
debug: (message, ...args) => {
|
|
3327
3355
|
if (process.env.DEBUG === "true" || process.argv.includes("--debug")) {
|
|
3328
|
-
console.error(
|
|
3356
|
+
console.error(chalk10__default.default.gray("\u{1F41B}"), message, ...args);
|
|
3329
3357
|
}
|
|
3330
3358
|
}
|
|
3331
3359
|
};
|
|
@@ -4837,9 +4865,10 @@ var CLI_EXTENSIONS_ID = "cli/extensions";
|
|
|
4837
4865
|
var cliExtensionsPluginRef = zapierSdk.declareOptionalProperty({
|
|
4838
4866
|
id: CLI_EXTENSIONS_ID
|
|
4839
4867
|
});
|
|
4840
|
-
var
|
|
4841
|
-
var
|
|
4842
|
-
|
|
4868
|
+
var EXPERIMENTAL_BIN_ENV = "ZAPIER_SDK_EXPERIMENTAL_BIN";
|
|
4869
|
+
var CLI_STABILITY_ID = "cli/stability";
|
|
4870
|
+
var cliStabilityPluginRef = zapierSdk.declareOptionalProperty({
|
|
4871
|
+
id: CLI_STABILITY_ID
|
|
4843
4872
|
});
|
|
4844
4873
|
var McpSchema = zod.z.object({
|
|
4845
4874
|
port: zod.z.string().optional().describe("Port to listen on (for future HTTP transport)")
|
|
@@ -4848,11 +4877,7 @@ var McpSchema = zod.z.object({
|
|
|
4848
4877
|
// src/plugins/mcp/index.ts
|
|
4849
4878
|
var mcpPlugin = zapierSdk.defineMethod({
|
|
4850
4879
|
name: "mcp",
|
|
4851
|
-
imports: [
|
|
4852
|
-
zapierSdk.sdkOptionsPluginRef,
|
|
4853
|
-
cliExtensionsPluginRef,
|
|
4854
|
-
cliExperimentalPluginRef
|
|
4855
|
-
],
|
|
4880
|
+
imports: [zapierSdk.sdkOptionsPluginRef, cliExtensionsPluginRef, cliStabilityPluginRef],
|
|
4856
4881
|
output: "raw",
|
|
4857
4882
|
inputSchema: McpSchema,
|
|
4858
4883
|
categories: ["utility"],
|
|
@@ -4862,7 +4887,7 @@ var mcpPlugin = zapierSdk.defineMethod({
|
|
|
4862
4887
|
debug: imports.sdkOptions?.debug,
|
|
4863
4888
|
maxConcurrentRequests: imports.sdkOptions?.maxConcurrentRequests,
|
|
4864
4889
|
extensions: imports.extensions,
|
|
4865
|
-
|
|
4890
|
+
stability: imports.stability
|
|
4866
4891
|
});
|
|
4867
4892
|
}
|
|
4868
4893
|
});
|
|
@@ -6493,7 +6518,7 @@ function buildTemplateVariables({
|
|
|
6493
6518
|
};
|
|
6494
6519
|
}
|
|
6495
6520
|
function cleanupProject({ projectDir }) {
|
|
6496
|
-
console.log("\n" +
|
|
6521
|
+
console.log("\n" + chalk10__default.default.yellow("!") + " Cleaning up...");
|
|
6497
6522
|
fs.rmSync(projectDir, { recursive: true, force: true });
|
|
6498
6523
|
}
|
|
6499
6524
|
async function withInterruptCleanup(cleanup, fn) {
|
|
@@ -6703,8 +6728,8 @@ function buildNextSteps({
|
|
|
6703
6728
|
}
|
|
6704
6729
|
function createConsoleDisplayHooks() {
|
|
6705
6730
|
return {
|
|
6706
|
-
onItemComplete: (message) => console.log(" " +
|
|
6707
|
-
onWarn: (message) => console.warn(
|
|
6731
|
+
onItemComplete: (message) => console.log(" " + chalk10__default.default.green("\u2713") + " " + chalk10__default.default.dim(message)),
|
|
6732
|
+
onWarn: (message) => console.warn(chalk10__default.default.yellow("!") + " " + message),
|
|
6708
6733
|
onStepStart: ({
|
|
6709
6734
|
description,
|
|
6710
6735
|
stepNumber,
|
|
@@ -6713,31 +6738,31 @@ function createConsoleDisplayHooks() {
|
|
|
6713
6738
|
nonInteractive
|
|
6714
6739
|
}) => {
|
|
6715
6740
|
const progressMessage = `${description}...`;
|
|
6716
|
-
const stepCounter =
|
|
6741
|
+
const stepCounter = chalk10__default.default.dim(`${stepNumber}/${totalSteps}`);
|
|
6717
6742
|
if (nonInteractive) {
|
|
6718
6743
|
console.log(
|
|
6719
|
-
"\n" +
|
|
6744
|
+
"\n" + chalk10__default.default.bold(`\u276F ${progressMessage}`) + " " + stepCounter + "\n"
|
|
6720
6745
|
);
|
|
6721
6746
|
} else {
|
|
6722
6747
|
console.log(
|
|
6723
|
-
|
|
6748
|
+
chalk10__default.default.dim("\u2192") + " " + progressMessage + " " + stepCounter
|
|
6724
6749
|
);
|
|
6725
6750
|
}
|
|
6726
6751
|
if (command) {
|
|
6727
|
-
console.log(" " +
|
|
6752
|
+
console.log(" " + chalk10__default.default.cyan(`$ ${command}`));
|
|
6728
6753
|
}
|
|
6729
6754
|
},
|
|
6730
6755
|
onStepSuccess: ({ stepNumber, totalSteps }) => console.log(
|
|
6731
|
-
"\n" +
|
|
6756
|
+
"\n" + chalk10__default.default.green("\u2713") + " " + chalk10__default.default.dim(`Step ${stepNumber}/${totalSteps} complete`) + "\n"
|
|
6732
6757
|
),
|
|
6733
6758
|
onStepError: ({ description, command, err }) => {
|
|
6734
6759
|
const detail = err instanceof Error && err.message ? `
|
|
6735
|
-
${
|
|
6760
|
+
${chalk10__default.default.dim(err.message)}` : "";
|
|
6736
6761
|
const hint = command ? `
|
|
6737
|
-
${
|
|
6762
|
+
${chalk10__default.default.dim("run manually:")} ${chalk10__default.default.cyan(`$ ${command}`)}` : "";
|
|
6738
6763
|
console.error(
|
|
6739
6764
|
`
|
|
6740
|
-
${
|
|
6765
|
+
${chalk10__default.default.red("\u2716")} ${chalk10__default.default.bold(description)}${chalk10__default.default.dim(" failed")}${detail}${hint}`
|
|
6741
6766
|
);
|
|
6742
6767
|
}
|
|
6743
6768
|
};
|
|
@@ -6749,22 +6774,22 @@ function displaySummaryAndNextSteps({
|
|
|
6749
6774
|
packageManager
|
|
6750
6775
|
}) {
|
|
6751
6776
|
const formatStatus = (complete) => ({
|
|
6752
|
-
icon: complete ?
|
|
6753
|
-
text: complete ?
|
|
6777
|
+
icon: complete ? chalk10__default.default.green("\u2713") : chalk10__default.default.yellow("!"),
|
|
6778
|
+
text: complete ? chalk10__default.default.green("Setup complete") : chalk10__default.default.yellow("Setup interrupted")
|
|
6754
6779
|
});
|
|
6755
|
-
const formatNextStep = (step, i) => " " +
|
|
6756
|
-
const formatCommand = (cmd) => " " +
|
|
6757
|
-
const formatCompletedStep = (step) => " " +
|
|
6780
|
+
const formatNextStep = (step, i) => " " + chalk10__default.default.dim(`${i + 1}.`) + " " + chalk10__default.default.bold(step.description);
|
|
6781
|
+
const formatCommand = (cmd) => " " + chalk10__default.default.cyan(`$ ${cmd}`);
|
|
6782
|
+
const formatCompletedStep = (step) => " " + chalk10__default.default.green("\u2713") + " " + step.description;
|
|
6758
6783
|
const { execCmd } = getPackageManagerCommands({ packageManager });
|
|
6759
6784
|
const leftoverSteps = steps.filter(
|
|
6760
6785
|
(s) => !completedSetupStepIds.includes(s.id)
|
|
6761
6786
|
);
|
|
6762
6787
|
const isComplete = leftoverSteps.length === 0;
|
|
6763
6788
|
const status = formatStatus(isComplete);
|
|
6764
|
-
console.log("\n" +
|
|
6765
|
-
console.log(" " +
|
|
6789
|
+
console.log("\n" + chalk10__default.default.bold("\u276F Summary") + "\n");
|
|
6790
|
+
console.log(" " + chalk10__default.default.dim("Project") + " " + chalk10__default.default.bold(projectName));
|
|
6766
6791
|
console.log(
|
|
6767
|
-
" " +
|
|
6792
|
+
" " + chalk10__default.default.dim("Status") + " " + status.icon + " " + status.text
|
|
6768
6793
|
);
|
|
6769
6794
|
const completedSteps = steps.filter(
|
|
6770
6795
|
(s) => completedSetupStepIds.includes(s.id)
|
|
@@ -6774,7 +6799,7 @@ function displaySummaryAndNextSteps({
|
|
|
6774
6799
|
for (const step of completedSteps) console.log(formatCompletedStep(step));
|
|
6775
6800
|
}
|
|
6776
6801
|
const nextSteps = buildNextSteps({ projectName, leftoverSteps, execCmd });
|
|
6777
|
-
console.log("\n" +
|
|
6802
|
+
console.log("\n" + chalk10__default.default.bold("\u276F Next Steps") + "\n");
|
|
6778
6803
|
nextSteps.forEach((step, i) => {
|
|
6779
6804
|
console.log(formatNextStep(step, i));
|
|
6780
6805
|
if (step.command) console.log(formatCommand(step.command));
|
|
@@ -6959,26 +6984,26 @@ function displayUpdateNotification(versionInfo, packageName) {
|
|
|
6959
6984
|
if (versionInfo.isDeprecated) {
|
|
6960
6985
|
console.error();
|
|
6961
6986
|
console.error(
|
|
6962
|
-
|
|
6987
|
+
chalk10__default.default.red.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk10__default.default.red(
|
|
6963
6988
|
` - ${packageName} v${versionInfo.currentVersion} is deprecated.`
|
|
6964
6989
|
)
|
|
6965
6990
|
);
|
|
6966
6991
|
if (versionInfo.deprecationMessage) {
|
|
6967
|
-
console.error(
|
|
6992
|
+
console.error(chalk10__default.default.red(` ${versionInfo.deprecationMessage}`));
|
|
6968
6993
|
}
|
|
6969
|
-
console.error(
|
|
6994
|
+
console.error(chalk10__default.default.red(` Please update to the latest version.`));
|
|
6970
6995
|
console.error();
|
|
6971
6996
|
}
|
|
6972
6997
|
if (versionInfo.hasUpdate) {
|
|
6973
6998
|
console.error();
|
|
6974
6999
|
console.error(
|
|
6975
|
-
|
|
7000
|
+
chalk10__default.default.yellow.bold("\u{1F4E6} Update available!") + chalk10__default.default.yellow(
|
|
6976
7001
|
` ${packageName} v${versionInfo.currentVersion} \u2192 v${versionInfo.latestVersion}`
|
|
6977
7002
|
)
|
|
6978
7003
|
);
|
|
6979
7004
|
console.error(
|
|
6980
|
-
|
|
6981
|
-
` Run ${
|
|
7005
|
+
chalk10__default.default.yellow(
|
|
7006
|
+
` Run ${chalk10__default.default.bold(getUpdateCommand(packageName))} to update.`
|
|
6982
7007
|
)
|
|
6983
7008
|
);
|
|
6984
7009
|
console.error();
|
|
@@ -7019,7 +7044,7 @@ var boltFillRanks = new Map(
|
|
|
7019
7044
|
);
|
|
7020
7045
|
var STATUS_ROW_INDEX = Math.floor(boltRows.length / 2);
|
|
7021
7046
|
function formatPhase({ label, detail }) {
|
|
7022
|
-
return detail ? `${
|
|
7047
|
+
return detail ? `${chalk10__default.default.bold(label)} ${chalk10__default.default.dim(detail)}` : chalk10__default.default.bold(label);
|
|
7023
7048
|
}
|
|
7024
7049
|
function formatLoaderFrame({
|
|
7025
7050
|
phase,
|
|
@@ -7031,7 +7056,7 @@ function formatLoaderFrame({
|
|
|
7031
7056
|
const cellIndex = rowIndex * row.length + columnIndex;
|
|
7032
7057
|
const fillRank = boltFillRanks.get(cellIndex);
|
|
7033
7058
|
const isFilled = fillRank !== void 0 && fillRank < fillStage;
|
|
7034
|
-
return isFilled ?
|
|
7059
|
+
return isFilled ? chalk10__default.default.bold.yellow(cell) : chalk10__default.default.dim.yellow(cell);
|
|
7035
7060
|
}).join("");
|
|
7036
7061
|
const status = rowIndex === STATUS_ROW_INDEX ? ` ${formatPhase(phase)}` : "";
|
|
7037
7062
|
return `${bolt}${status}`;
|
|
@@ -7063,12 +7088,12 @@ async function runWithSetupLoader({
|
|
|
7063
7088
|
const result = await promise;
|
|
7064
7089
|
clearInterval(animationTimer);
|
|
7065
7090
|
const elapsedSeconds = ((Date.now() - startedAt) / 1e3).toFixed(1);
|
|
7066
|
-
loader.succeed(`${formatPhase(phase)} ${
|
|
7091
|
+
loader.succeed(`${formatPhase(phase)} ${chalk10__default.default.dim(`${elapsedSeconds}s`)}`);
|
|
7067
7092
|
return result;
|
|
7068
7093
|
} catch (error) {
|
|
7069
7094
|
clearInterval(animationTimer);
|
|
7070
7095
|
const elapsedSeconds = ((Date.now() - startedAt) / 1e3).toFixed(1);
|
|
7071
|
-
loader.fail(`${formatPhase(phase)} ${
|
|
7096
|
+
loader.fail(`${formatPhase(phase)} ${chalk10__default.default.dim(`${elapsedSeconds}s`)}`);
|
|
7072
7097
|
throw error;
|
|
7073
7098
|
}
|
|
7074
7099
|
}
|
|
@@ -7559,7 +7584,7 @@ async function runCommand({
|
|
|
7559
7584
|
detail: commandLabel
|
|
7560
7585
|
});
|
|
7561
7586
|
}
|
|
7562
|
-
console.log(
|
|
7587
|
+
console.log(chalk10__default.default.dim(commandLabel));
|
|
7563
7588
|
return await execute;
|
|
7564
7589
|
} catch (error) {
|
|
7565
7590
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -7826,7 +7851,7 @@ function printAgentPrompt({
|
|
|
7826
7851
|
message
|
|
7827
7852
|
}) {
|
|
7828
7853
|
console.log();
|
|
7829
|
-
console.log(
|
|
7854
|
+
console.log(chalk10__default.default.bgYellow.black.bold(message));
|
|
7830
7855
|
console.log();
|
|
7831
7856
|
console.log(buildAgentPrompt({ context }));
|
|
7832
7857
|
}
|
|
@@ -8111,7 +8136,7 @@ var MINIMUM_MESSAGE_WIDTH = 20;
|
|
|
8111
8136
|
var MAXIMUM_MESSAGE_WIDTH = 88;
|
|
8112
8137
|
function showPhase({ number, title }) {
|
|
8113
8138
|
console.log();
|
|
8114
|
-
console.log(
|
|
8139
|
+
console.log(chalk10__default.default.bgCyan.black.bold(` ${number}/${PHASE_COUNT} ${title} `));
|
|
8115
8140
|
}
|
|
8116
8141
|
function printWrapped(text) {
|
|
8117
8142
|
const width = Math.max(
|
|
@@ -8125,7 +8150,7 @@ function printWrapped(text) {
|
|
|
8125
8150
|
}
|
|
8126
8151
|
function showReadyMessage() {
|
|
8127
8152
|
console.log();
|
|
8128
|
-
console.log(
|
|
8153
|
+
console.log(chalk10__default.default.bgGreen.black.bold(" \u2713 Zapier SDK setup complete "));
|
|
8129
8154
|
console.log();
|
|
8130
8155
|
printWrapped(
|
|
8131
8156
|
"Use active Zapier connections to access 9,000+ app connectors without managing each app's OAuth, token refresh, or retries."
|
|
@@ -8137,7 +8162,7 @@ function showReadyMessage() {
|
|
|
8137
8162
|
console.log();
|
|
8138
8163
|
}
|
|
8139
8164
|
async function runWizard(context) {
|
|
8140
|
-
console.log(
|
|
8165
|
+
console.log(chalk10__default.default.bold("Zapier SDK setup"));
|
|
8141
8166
|
showPhase({ number: 1, title: "Project directory" });
|
|
8142
8167
|
await chooseDirectory(context);
|
|
8143
8168
|
showPhase({ number: 2, title: "Node.js" });
|
|
@@ -8152,7 +8177,7 @@ async function runWizard(context) {
|
|
|
8152
8177
|
showPhase({ number: 6, title: "Slack demo" });
|
|
8153
8178
|
await offerSlackTest(context);
|
|
8154
8179
|
showReadyMessage();
|
|
8155
|
-
console.log(
|
|
8180
|
+
console.log(chalk10__default.default.bgCyan.black.bold(" Next steps "));
|
|
8156
8181
|
await openAgentHandoff(context);
|
|
8157
8182
|
}
|
|
8158
8183
|
|
|
@@ -8201,13 +8226,13 @@ function createInteractiveCallback() {
|
|
|
8201
8226
|
const attrs = message.message_attributes;
|
|
8202
8227
|
console.log(
|
|
8203
8228
|
`
|
|
8204
|
-
${
|
|
8229
|
+
${chalk10__default.default.bold(`Message #${messageNumber}`)} ${chalk10__default.default.dim(message.id)} ${chalk10__default.default.dim(`(lease #${attrs.lease_count})`)}`
|
|
8205
8230
|
);
|
|
8206
8231
|
if (attrs.error_message) {
|
|
8207
|
-
console.log(
|
|
8232
|
+
console.log(chalk10__default.default.yellow(` upstream error: ${attrs.error_message}`));
|
|
8208
8233
|
}
|
|
8209
8234
|
if (attrs.possible_duplicate_data) {
|
|
8210
|
-
console.log(
|
|
8235
|
+
console.log(chalk10__default.default.yellow(" possible duplicate data"));
|
|
8211
8236
|
}
|
|
8212
8237
|
while (true) {
|
|
8213
8238
|
let action;
|
|
@@ -8237,7 +8262,7 @@ ${chalk9__default.default.bold(`Message #${messageNumber}`)} ${chalk9__default.d
|
|
|
8237
8262
|
throw error;
|
|
8238
8263
|
}
|
|
8239
8264
|
if (action === "view") {
|
|
8240
|
-
console.log(
|
|
8265
|
+
console.log(chalk10__default.default.dim(JSON.stringify(message.payload, null, 2)));
|
|
8241
8266
|
continue;
|
|
8242
8267
|
}
|
|
8243
8268
|
if (action === "ack") {
|
|
@@ -8340,7 +8365,7 @@ function describeReason(reason) {
|
|
|
8340
8365
|
}
|
|
8341
8366
|
function printDrainError(reason, message) {
|
|
8342
8367
|
console.error(
|
|
8343
|
-
|
|
8368
|
+
chalk10__default.default.red(`Error processing ${message.id}: ${describeReason(reason)}`)
|
|
8344
8369
|
);
|
|
8345
8370
|
}
|
|
8346
8371
|
function printDrainSummary(counts) {
|
|
@@ -8350,7 +8375,7 @@ function printDrainSummary(counts) {
|
|
|
8350
8375
|
if (skipped > 0) parts.push(`${skipped} skipped`);
|
|
8351
8376
|
parts.push(`${counts.rejected} rejected`);
|
|
8352
8377
|
console.log(
|
|
8353
|
-
|
|
8378
|
+
chalk10__default.default.dim(
|
|
8354
8379
|
`
|
|
8355
8380
|
Processed ${total} message${total === 1 ? "" : "s"} (${parts.join(", ")}).`
|
|
8356
8381
|
)
|
|
@@ -8358,7 +8383,7 @@ Processed ${total} message${total === 1 ? "" : "s"} (${parts.join(", ")}).`
|
|
|
8358
8383
|
}
|
|
8359
8384
|
function warnInteractiveContinueOnErrorOverride() {
|
|
8360
8385
|
console.warn(
|
|
8361
|
-
|
|
8386
|
+
chalk10__default.default.yellow(
|
|
8362
8387
|
'Note: continueOnError=false is overridden to true in interactive mode (the "Skip (let lease expire)" choice would otherwise terminate the drain).'
|
|
8363
8388
|
)
|
|
8364
8389
|
);
|
|
@@ -8684,7 +8709,7 @@ var createWorkflowCliPlugin = experimental.defineMethod({
|
|
|
8684
8709
|
type: "create",
|
|
8685
8710
|
itemType: "Workflow",
|
|
8686
8711
|
categories: ["code-workflow"],
|
|
8687
|
-
|
|
8712
|
+
stability: "experimental",
|
|
8688
8713
|
inputSchema: CreateWorkflowCliOptionsSchema,
|
|
8689
8714
|
outputSchema: experimental.CreateWorkflowResponseSchema,
|
|
8690
8715
|
skipOutputValidation: true,
|
|
@@ -8716,7 +8741,7 @@ function renderDeprecationNotices() {
|
|
|
8716
8741
|
console.error();
|
|
8717
8742
|
for (const message of messages) {
|
|
8718
8743
|
for (const line of buildBoxLines(message)) {
|
|
8719
|
-
console.error(
|
|
8744
|
+
console.error(chalk10__default.default.red.bold(line));
|
|
8720
8745
|
}
|
|
8721
8746
|
console.error();
|
|
8722
8747
|
}
|
|
@@ -8737,21 +8762,33 @@ function buildBoxLines(message) {
|
|
|
8737
8762
|
// package.json with { type: 'json' }
|
|
8738
8763
|
var package_default2 = {
|
|
8739
8764
|
name: "@zapier/zapier-sdk-cli",
|
|
8740
|
-
version: "0.
|
|
8765
|
+
version: "0.85.0"};
|
|
8741
8766
|
|
|
8742
8767
|
// src/sdk.ts
|
|
8743
8768
|
var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
|
|
8769
|
+
var warnedStabilityMethods = /* @__PURE__ */ new Set();
|
|
8744
8770
|
var cliCoreOptions = {
|
|
8745
8771
|
...zapierSdk.zapierCoreOptions,
|
|
8746
8772
|
logDeprecation: ({ methodName, deprecation }) => {
|
|
8747
8773
|
if (warnedDeprecatedMethods.has(methodName)) return;
|
|
8748
8774
|
warnedDeprecatedMethods.add(methodName);
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8775
|
+
warningBlock({
|
|
8776
|
+
banner: DEPRECATION_BANNER,
|
|
8777
|
+
message: ` - \`${toKebabCase(methodName)}\` is deprecated.`,
|
|
8778
|
+
detail: deprecation.message
|
|
8779
|
+
});
|
|
8780
|
+
},
|
|
8781
|
+
logStabilityNotice: ({ methodName, stability }) => {
|
|
8782
|
+
if (stability === "stable") return;
|
|
8783
|
+
if (warnedStabilityMethods.has(methodName)) return;
|
|
8784
|
+
warnedStabilityMethods.add(methodName);
|
|
8785
|
+
warningBlock({
|
|
8786
|
+
banner: `\u26A0\uFE0F ${stability.toUpperCase()} COMMAND`,
|
|
8787
|
+
message: ` - \`${toKebabCase(methodName)}\` is marked ${stability}.`,
|
|
8788
|
+
// The detail line is the tier's consumer contract, so the CLI says the
|
|
8789
|
+
// same thing as the SDK's runtime notice and the generated docs.
|
|
8790
|
+
detail: zapierSdk.STABILITY_DEFINITIONS[stability]
|
|
8791
|
+
});
|
|
8755
8792
|
}
|
|
8756
8793
|
};
|
|
8757
8794
|
zapierSdk.injectCliLogin(login_exports);
|
|
@@ -8816,8 +8853,65 @@ function createZapierCliSdk(options = {}) {
|
|
|
8816
8853
|
}
|
|
8817
8854
|
return sdk;
|
|
8818
8855
|
}
|
|
8819
|
-
|
|
8856
|
+
beta.injectCliLogin(login_exports);
|
|
8820
8857
|
function createZapierCliSdk2(options = {}) {
|
|
8858
|
+
const { extensions = [], ...sdkOptions } = options;
|
|
8859
|
+
const stackOptions = {
|
|
8860
|
+
...sdkOptions,
|
|
8861
|
+
eventEmission: { ...sdkOptions.eventEmission, callContext: "cli" },
|
|
8862
|
+
callerPackage: { name: package_default2.name, version: package_default2.version },
|
|
8863
|
+
// Collected for the boxed stderr warning rendered in the exit path. The
|
|
8864
|
+
// box is additive: the SDK's own inline warn still fires, so the notice
|
|
8865
|
+
// cannot be hidden by any rendering path.
|
|
8866
|
+
onEvent: (event) => collectDeprecationNoticeAndForward(event, sdkOptions.onEvent)
|
|
8867
|
+
};
|
|
8868
|
+
const cliBetaSdkPlugin = beta.definePlugin({
|
|
8869
|
+
namespace: "zapier",
|
|
8870
|
+
name: "cli-beta-sdk",
|
|
8871
|
+
exports: [
|
|
8872
|
+
beta.omitExports(beta.zapierBetaSdkPlugin, [
|
|
8873
|
+
"drainTriggerInbox",
|
|
8874
|
+
"watchTriggerInbox"
|
|
8875
|
+
]),
|
|
8876
|
+
drainTriggerInboxCliPlugin,
|
|
8877
|
+
watchTriggerInboxCliPlugin,
|
|
8878
|
+
loginPlugin,
|
|
8879
|
+
signupPlugin,
|
|
8880
|
+
logoutPlugin,
|
|
8881
|
+
mcpPlugin,
|
|
8882
|
+
getLoginConfigPathPlugin,
|
|
8883
|
+
initPlugin,
|
|
8884
|
+
setupPlugin,
|
|
8885
|
+
bundleCodePlugin,
|
|
8886
|
+
feedbackPlugin,
|
|
8887
|
+
curlPlugin,
|
|
8888
|
+
addAppsPlugin,
|
|
8889
|
+
buildManifestPlugin,
|
|
8890
|
+
generateAppTypesPlugin
|
|
8891
|
+
]
|
|
8892
|
+
});
|
|
8893
|
+
const sdk = beta.createSdk(cliBetaSdkPlugin, {
|
|
8894
|
+
configuration: {
|
|
8895
|
+
[beta.SDK_OPTIONS_ID]: stackOptions,
|
|
8896
|
+
[beta.CORE_OPTIONS_ID]: cliCoreOptions,
|
|
8897
|
+
[CLI_EXTENSIONS_ID]: extensions,
|
|
8898
|
+
// Built by the beta factory: `mcp` reads this to launch the beta MCP
|
|
8899
|
+
// server so the surfaces stay aligned.
|
|
8900
|
+
[CLI_STABILITY_ID]: "beta"
|
|
8901
|
+
}
|
|
8902
|
+
});
|
|
8903
|
+
beta.addPlugin(sdk, cliFetchOverride);
|
|
8904
|
+
for (const ext of extensions) {
|
|
8905
|
+
try {
|
|
8906
|
+
beta.addPlugin(sdk, ext);
|
|
8907
|
+
} catch (err) {
|
|
8908
|
+
console.warn(beta.formatExtensionPluginFailure(err));
|
|
8909
|
+
}
|
|
8910
|
+
}
|
|
8911
|
+
return sdk;
|
|
8912
|
+
}
|
|
8913
|
+
experimental.injectCliLogin(login_exports);
|
|
8914
|
+
function createZapierCliSdk3(options = {}) {
|
|
8821
8915
|
const { extensions = [], ...sdkOptions } = options;
|
|
8822
8916
|
const stackOptions = {
|
|
8823
8917
|
...sdkOptions,
|
|
@@ -8862,7 +8956,7 @@ function createZapierCliSdk2(options = {}) {
|
|
|
8862
8956
|
[CLI_EXTENSIONS_ID]: extensions,
|
|
8863
8957
|
// Built by the experimental factory: `mcp` reads this to launch the
|
|
8864
8958
|
// experimental MCP server so the surfaces stay aligned.
|
|
8865
|
-
[
|
|
8959
|
+
[CLI_STABILITY_ID]: "experimental"
|
|
8866
8960
|
}
|
|
8867
8961
|
});
|
|
8868
8962
|
experimental.addPlugin(sdk, cliFetchOverride);
|
|
@@ -9003,11 +9097,11 @@ function buildFrameLines(state, frameIndex) {
|
|
|
9003
9097
|
const bodyWidth = width - 2;
|
|
9004
9098
|
const bodyTextWidth = innerWidth - 2;
|
|
9005
9099
|
const content = [];
|
|
9006
|
-
content.push(
|
|
9100
|
+
content.push(chalk10__default.default.bold.cyan("Approval review"));
|
|
9007
9101
|
content.push("");
|
|
9008
9102
|
if (!state.verdict) {
|
|
9009
9103
|
content.push(
|
|
9010
|
-
|
|
9104
|
+
chalk10__default.default.yellow(`${SPINNER_FRAMES[frameIndex]} Checking approval...`)
|
|
9011
9105
|
);
|
|
9012
9106
|
}
|
|
9013
9107
|
const recentMessages = state.messages.slice(-5);
|
|
@@ -9018,13 +9112,13 @@ function buildFrameLines(state, frameIndex) {
|
|
|
9018
9112
|
"\n"
|
|
9019
9113
|
);
|
|
9020
9114
|
segments.forEach((segment, segmentIndex) => {
|
|
9021
|
-
const prefix = segmentIndex === 0 ?
|
|
9022
|
-
content.push(`${prefix}${dimmed ?
|
|
9115
|
+
const prefix = segmentIndex === 0 ? chalk10__default.default.cyan("> ") : " ";
|
|
9116
|
+
content.push(`${prefix}${dimmed ? chalk10__default.default.dim(segment) : segment}`);
|
|
9023
9117
|
});
|
|
9024
9118
|
});
|
|
9025
9119
|
if (state.streamError) {
|
|
9026
9120
|
if (hasMessages || !state.verdict) content.push("");
|
|
9027
|
-
content.push(
|
|
9121
|
+
content.push(chalk10__default.default.bold.red("Approval stream error"));
|
|
9028
9122
|
for (const segment of wrapAnsi4__default.default(state.streamError, bodyTextWidth, {
|
|
9029
9123
|
hard: true
|
|
9030
9124
|
}).split("\n")) {
|
|
@@ -9034,7 +9128,7 @@ function buildFrameLines(state, frameIndex) {
|
|
|
9034
9128
|
if (state.verdict) {
|
|
9035
9129
|
if (hasMessages || state.streamError) content.push("");
|
|
9036
9130
|
content.push(
|
|
9037
|
-
|
|
9131
|
+
chalk10__default.default.bold.green(`${state.verdict.icon} ${state.verdict.label}`)
|
|
9038
9132
|
);
|
|
9039
9133
|
if (state.verdict.reason) {
|
|
9040
9134
|
for (const segment of wrapAnsi4__default.default(state.verdict.reason, bodyTextWidth, {
|
|
@@ -9046,12 +9140,12 @@ function buildFrameLines(state, frameIndex) {
|
|
|
9046
9140
|
}
|
|
9047
9141
|
const pad = (line) => {
|
|
9048
9142
|
const padding = " ".repeat(Math.max(0, innerWidth - displayWidth(line)));
|
|
9049
|
-
return `${
|
|
9143
|
+
return `${chalk10__default.default.cyan("\u2502")} ${line}${padding} ${chalk10__default.default.cyan("\u2502")}`;
|
|
9050
9144
|
};
|
|
9051
9145
|
return [
|
|
9052
|
-
|
|
9146
|
+
chalk10__default.default.cyan(`\u256D${"\u2500".repeat(bodyWidth)}\u256E`),
|
|
9053
9147
|
...content.map(pad),
|
|
9054
|
-
|
|
9148
|
+
chalk10__default.default.cyan(`\u2570${"\u2500".repeat(bodyWidth)}\u256F`)
|
|
9055
9149
|
];
|
|
9056
9150
|
}
|
|
9057
9151
|
function createApprovalProgressRenderer({
|
|
@@ -9251,6 +9345,7 @@ var EXIT_GRACE_PERIOD_MILLISECONDS = 500;
|
|
|
9251
9345
|
var program = new commander.Command();
|
|
9252
9346
|
var versionOption = getReservedCliOption("version" /* Version */);
|
|
9253
9347
|
var helpOption = getReservedCliOption("help" /* Help */);
|
|
9348
|
+
var stabilityOption = getReservedCliOption("stability" /* Stability */);
|
|
9254
9349
|
program.name("zapier-sdk").description("CLI for Zapier SDK").version(
|
|
9255
9350
|
package_default2.version,
|
|
9256
9351
|
`${versionOption.short}, ${versionOption.flag}`,
|
|
@@ -9279,7 +9374,10 @@ program.name("zapier-sdk").description("CLI for Zapier SDK").version(
|
|
|
9279
9374
|
).option(
|
|
9280
9375
|
"--causation-id <id>",
|
|
9281
9376
|
"Causation ID emitted as the zapier-causation-id header on every outbound request. Falls back to ZAPIER_CAUSATION_ID."
|
|
9282
|
-
).option(
|
|
9377
|
+
).option(stabilityOption.flag, stabilityOption.description).option(
|
|
9378
|
+
"--experimental",
|
|
9379
|
+
"Deprecated. Use --stability experimental instead."
|
|
9380
|
+
);
|
|
9283
9381
|
var booleanFlags = [];
|
|
9284
9382
|
for (const [key, fieldSchema] of Object.entries(
|
|
9285
9383
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -9365,8 +9463,57 @@ for (const { camelName, kebabFlag } of booleanFlags) {
|
|
|
9365
9463
|
flagOverrides[camelName] = true;
|
|
9366
9464
|
}
|
|
9367
9465
|
}
|
|
9368
|
-
|
|
9369
|
-
|
|
9466
|
+
function parseStabilityLevel(value, source) {
|
|
9467
|
+
if (value === void 0) return void 0;
|
|
9468
|
+
if (zapierSdk.STABILITY_LEVELS.includes(value)) {
|
|
9469
|
+
return value;
|
|
9470
|
+
}
|
|
9471
|
+
console.error(
|
|
9472
|
+
`Invalid ${source} value "${value}". Valid stability levels: ${zapierSdk.STABILITY_LEVELS.join(", ")}.`
|
|
9473
|
+
);
|
|
9474
|
+
process.exit(1);
|
|
9475
|
+
}
|
|
9476
|
+
function warnDeprecatedOptIn(used, replacement) {
|
|
9477
|
+
warningBlock({
|
|
9478
|
+
banner: DEPRECATION_BANNER,
|
|
9479
|
+
message: ` - \`${used}\` is deprecated.`,
|
|
9480
|
+
detail: `Use \`${replacement}\` instead.`
|
|
9481
|
+
});
|
|
9482
|
+
}
|
|
9483
|
+
function resolveCliStability() {
|
|
9484
|
+
const flagLevel = parseStabilityLevel(
|
|
9485
|
+
getFlagValue("--stability"),
|
|
9486
|
+
"--stability"
|
|
9487
|
+
);
|
|
9488
|
+
if (flagLevel) return flagLevel;
|
|
9489
|
+
if (process.argv.includes("--experimental")) {
|
|
9490
|
+
if (process.env[EXPERIMENTAL_BIN_ENV] === "1") {
|
|
9491
|
+
warnDeprecatedOptIn(
|
|
9492
|
+
"zapier-sdk-experimental",
|
|
9493
|
+
"zapier-sdk --stability experimental"
|
|
9494
|
+
);
|
|
9495
|
+
} else {
|
|
9496
|
+
warnDeprecatedOptIn("--experimental", "--stability experimental");
|
|
9497
|
+
}
|
|
9498
|
+
return "experimental";
|
|
9499
|
+
}
|
|
9500
|
+
const envLevel = parseStabilityLevel(
|
|
9501
|
+
process.env.ZAPIER_STABILITY || void 0,
|
|
9502
|
+
"ZAPIER_STABILITY"
|
|
9503
|
+
);
|
|
9504
|
+
if (envLevel) return envLevel;
|
|
9505
|
+
if (process.env.ZAPIER_EXPERIMENTAL === "1" || process.env.ZAPIER_EXPERIMENTAL === "true") {
|
|
9506
|
+
warnDeprecatedOptIn("ZAPIER_EXPERIMENTAL", "ZAPIER_STABILITY=experimental");
|
|
9507
|
+
return "experimental";
|
|
9508
|
+
}
|
|
9509
|
+
return "stable";
|
|
9510
|
+
}
|
|
9511
|
+
var cliStability = resolveCliStability();
|
|
9512
|
+
var createZapierCliSdk4 = {
|
|
9513
|
+
stable: createZapierCliSdk,
|
|
9514
|
+
beta: createZapierCliSdk2,
|
|
9515
|
+
experimental: createZapierCliSdk3
|
|
9516
|
+
}[cliStability];
|
|
9370
9517
|
var approvalProgress = createApprovalProgressRenderer({
|
|
9371
9518
|
enabled: process.stderr.isTTY === true
|
|
9372
9519
|
});
|
|
@@ -9374,7 +9521,7 @@ program.exitOverride();
|
|
|
9374
9521
|
(async () => {
|
|
9375
9522
|
let exitCode = 0;
|
|
9376
9523
|
const extensions = await resolveExtensions();
|
|
9377
|
-
const sdk =
|
|
9524
|
+
const sdk = createZapierCliSdk4({
|
|
9378
9525
|
debug: isDebugMode,
|
|
9379
9526
|
credentials,
|
|
9380
9527
|
baseUrl,
|