@zapier/zapier-sdk-cli 0.34.9 → 0.34.10
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 +9 -0
- package/dist/cli.cjs +111 -90
- package/dist/cli.mjs +110 -89
- package/dist/index.cjs +5 -2
- package/dist/index.mjs +5 -2
- package/dist/package.json +1 -1
- package/dist/src/plugins/cliOverrides/index.d.ts +2 -1
- package/dist/src/plugins/cliOverrides/index.js +3 -0
- package/dist/src/utils/cli-generator.js +14 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @zapier/zapier-sdk-cli
|
|
2
2
|
|
|
3
|
+
## 0.34.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 623dc25: Add deprecation warning for fetch CLI command
|
|
8
|
+
- Updated dependencies [623dc25]
|
|
9
|
+
- @zapier/zapier-sdk@0.33.2
|
|
10
|
+
- @zapier/zapier-sdk-mcp@0.9.19
|
|
11
|
+
|
|
3
12
|
## 0.34.9
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/cli.cjs
CHANGED
|
@@ -5,7 +5,7 @@ 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 chalk3 = require('chalk');
|
|
9
9
|
var util = require('util');
|
|
10
10
|
var cliLogin = require('@zapier/zapier-sdk-cli-login');
|
|
11
11
|
var open = require('open');
|
|
@@ -48,7 +48,7 @@ function _interopNamespace(e) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
var inquirer__default = /*#__PURE__*/_interopDefault(inquirer);
|
|
51
|
-
var
|
|
51
|
+
var chalk3__default = /*#__PURE__*/_interopDefault(chalk3);
|
|
52
52
|
var util__default = /*#__PURE__*/_interopDefault(util);
|
|
53
53
|
var cliLogin__namespace = /*#__PURE__*/_interopNamespace(cliLogin);
|
|
54
54
|
var open__default = /*#__PURE__*/_interopDefault(open);
|
|
@@ -189,7 +189,7 @@ var SchemaParameterResolver = class {
|
|
|
189
189
|
context.resolvedParams = resolvedParams;
|
|
190
190
|
} catch (error) {
|
|
191
191
|
if (this.isUserCancellation(error)) {
|
|
192
|
-
console.log(
|
|
192
|
+
console.log(chalk3__default.default.yellow("\n\nOperation cancelled by user"));
|
|
193
193
|
throw new ZapierCliUserCancellationError();
|
|
194
194
|
}
|
|
195
195
|
throw error;
|
|
@@ -227,7 +227,7 @@ var SchemaParameterResolver = class {
|
|
|
227
227
|
context.resolvedParams = resolvedParams;
|
|
228
228
|
} catch (error) {
|
|
229
229
|
if (this.isUserCancellation(error)) {
|
|
230
|
-
console.log(
|
|
230
|
+
console.log(chalk3__default.default.yellow("\n\nOperation cancelled by user"));
|
|
231
231
|
throw new ZapierCliUserCancellationError();
|
|
232
232
|
}
|
|
233
233
|
throw error;
|
|
@@ -262,7 +262,7 @@ var SchemaParameterResolver = class {
|
|
|
262
262
|
context.resolvedParams = resolvedParams;
|
|
263
263
|
} catch (error) {
|
|
264
264
|
if (this.isUserCancellation(error)) {
|
|
265
|
-
console.log(
|
|
265
|
+
console.log(chalk3__default.default.yellow("\n\nOperation cancelled by user"));
|
|
266
266
|
throw new ZapierCliUserCancellationError();
|
|
267
267
|
}
|
|
268
268
|
throw error;
|
|
@@ -273,7 +273,7 @@ var SchemaParameterResolver = class {
|
|
|
273
273
|
const finalResult = schema.safeParse(resolvedParams);
|
|
274
274
|
if (!finalResult.success) {
|
|
275
275
|
console.error(
|
|
276
|
-
|
|
276
|
+
chalk3__default.default.red("\u274C Parameter validation failed after resolution:")
|
|
277
277
|
);
|
|
278
278
|
throw finalResult.error;
|
|
279
279
|
}
|
|
@@ -325,7 +325,7 @@ var SchemaParameterResolver = class {
|
|
|
325
325
|
if (!resolver) {
|
|
326
326
|
throw new Error(`No resolver found for parameter: ${param.name}`);
|
|
327
327
|
}
|
|
328
|
-
console.log(
|
|
328
|
+
console.log(chalk3__default.default.blue(`
|
|
329
329
|
\u{1F50D} Resolving ${param.name}...`));
|
|
330
330
|
if (resolver.type === "static") {
|
|
331
331
|
const staticResolver = resolver;
|
|
@@ -354,7 +354,7 @@ var SchemaParameterResolver = class {
|
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
if (param.isRequired && param.name !== "connectionId") {
|
|
357
|
-
console.log(
|
|
357
|
+
console.log(chalk3__default.default.gray(`Fetching options for ${param.name}...`));
|
|
358
358
|
}
|
|
359
359
|
const items = await dynamicResolver.fetch(
|
|
360
360
|
context.sdk,
|
|
@@ -391,7 +391,7 @@ var SchemaParameterResolver = class {
|
|
|
391
391
|
}
|
|
392
392
|
};
|
|
393
393
|
console.log(
|
|
394
|
-
|
|
394
|
+
chalk3__default.default.gray(
|
|
395
395
|
`Fetching input fields for ${param.name}${iteration > 1 ? ` (iteration ${iteration})` : ""}...`
|
|
396
396
|
)
|
|
397
397
|
);
|
|
@@ -402,7 +402,7 @@ var SchemaParameterResolver = class {
|
|
|
402
402
|
if (!rootFieldItems || rootFieldItems.length === 0) {
|
|
403
403
|
if (iteration === 1) {
|
|
404
404
|
console.log(
|
|
405
|
-
|
|
405
|
+
chalk3__default.default.yellow(`No input fields required for this action.`)
|
|
406
406
|
);
|
|
407
407
|
}
|
|
408
408
|
break;
|
|
@@ -424,7 +424,7 @@ var SchemaParameterResolver = class {
|
|
|
424
424
|
}
|
|
425
425
|
if (iteration >= maxIterations) {
|
|
426
426
|
console.log(
|
|
427
|
-
|
|
427
|
+
chalk3__default.default.yellow(
|
|
428
428
|
`
|
|
429
429
|
\u26A0\uFE0F Maximum field resolution iterations reached. Some dynamic fields may not have been discovered.`
|
|
430
430
|
)
|
|
@@ -446,7 +446,7 @@ var SchemaParameterResolver = class {
|
|
|
446
446
|
const fieldsetTitle = typedItem.title || typedItem.key;
|
|
447
447
|
const pathDisplay = fieldsetPath.length > 0 ? ` (in ${fieldsetPath.join(" > ")})` : "";
|
|
448
448
|
console.log(
|
|
449
|
-
|
|
449
|
+
chalk3__default.default.cyan(
|
|
450
450
|
`
|
|
451
451
|
\u{1F4C1} Processing fieldset: ${fieldsetTitle}${pathDisplay}`
|
|
452
452
|
)
|
|
@@ -478,7 +478,7 @@ var SchemaParameterResolver = class {
|
|
|
478
478
|
newRequiredCount++;
|
|
479
479
|
if (newRequiredCount === 1 && fieldsetPath.length === 0) {
|
|
480
480
|
console.log(
|
|
481
|
-
|
|
481
|
+
chalk3__default.default.blue(
|
|
482
482
|
`
|
|
483
483
|
\u{1F4DD} Please provide values for the following ${iteration === 1 ? "" : "additional "}input fields:`
|
|
484
484
|
)
|
|
@@ -499,7 +499,7 @@ var SchemaParameterResolver = class {
|
|
|
499
499
|
if (optionalFields.length > 0) {
|
|
500
500
|
const pathContext = fieldsetPath.length > 0 ? ` in ${fieldsetPath.join(" > ")}` : "";
|
|
501
501
|
console.log(
|
|
502
|
-
|
|
502
|
+
chalk3__default.default.gray(
|
|
503
503
|
`
|
|
504
504
|
There are ${optionalFields.length} ${iteration === 1 ? "" : "additional "}optional field(s) available${pathContext}.`
|
|
505
505
|
)
|
|
@@ -514,7 +514,7 @@ There are ${optionalFields.length} ${iteration === 1 ? "" : "additional "}option
|
|
|
514
514
|
}
|
|
515
515
|
]);
|
|
516
516
|
if (shouldConfigureOptional.configure) {
|
|
517
|
-
console.log(
|
|
517
|
+
console.log(chalk3__default.default.cyan(`
|
|
518
518
|
Optional fields${pathContext}:`));
|
|
519
519
|
for (const field of optionalFields) {
|
|
520
520
|
await this.promptForField(field, targetInputs, context);
|
|
@@ -530,7 +530,7 @@ Optional fields${pathContext}:`));
|
|
|
530
530
|
}
|
|
531
531
|
} catch (error) {
|
|
532
532
|
if (this.isUserCancellation(error)) {
|
|
533
|
-
console.log(
|
|
533
|
+
console.log(chalk3__default.default.yellow("\n\nOperation cancelled by user"));
|
|
534
534
|
throw new ZapierCliUserCancellationError();
|
|
535
535
|
}
|
|
536
536
|
throw error;
|
|
@@ -585,7 +585,7 @@ Optional fields${pathContext}:`));
|
|
|
585
585
|
async fetchChoices(fieldMeta, inputs, context, cursor) {
|
|
586
586
|
try {
|
|
587
587
|
console.log(
|
|
588
|
-
|
|
588
|
+
chalk3__default.default.gray(
|
|
589
589
|
cursor ? ` Fetching more choices...` : ` Fetching choices for ${fieldMeta.title}...`
|
|
590
590
|
)
|
|
591
591
|
);
|
|
@@ -604,7 +604,7 @@ Optional fields${pathContext}:`));
|
|
|
604
604
|
}));
|
|
605
605
|
if (choices.length === 0 && !cursor) {
|
|
606
606
|
console.log(
|
|
607
|
-
|
|
607
|
+
chalk3__default.default.yellow(` No choices available for ${fieldMeta.title}`)
|
|
608
608
|
);
|
|
609
609
|
}
|
|
610
610
|
return {
|
|
@@ -613,7 +613,7 @@ Optional fields${pathContext}:`));
|
|
|
613
613
|
};
|
|
614
614
|
} catch (error) {
|
|
615
615
|
console.warn(
|
|
616
|
-
|
|
616
|
+
chalk3__default.default.yellow(` \u26A0\uFE0F Failed to fetch choices for ${fieldMeta.title}:`),
|
|
617
617
|
error
|
|
618
618
|
);
|
|
619
619
|
return { choices: [] };
|
|
@@ -639,7 +639,7 @@ Optional fields${pathContext}:`));
|
|
|
639
639
|
}));
|
|
640
640
|
if (nextCursor) {
|
|
641
641
|
promptChoices.push({
|
|
642
|
-
name:
|
|
642
|
+
name: chalk3__default.default.dim("(Load more...)"),
|
|
643
643
|
value: LOAD_MORE_SENTINEL
|
|
644
644
|
});
|
|
645
645
|
}
|
|
@@ -702,7 +702,7 @@ Optional fields${pathContext}:`));
|
|
|
702
702
|
};
|
|
703
703
|
}
|
|
704
704
|
if (fieldMeta.description) {
|
|
705
|
-
promptConfig.prefix =
|
|
705
|
+
promptConfig.prefix = chalk3__default.default.gray(`\u2139 ${fieldMeta.description}
|
|
706
706
|
`);
|
|
707
707
|
}
|
|
708
708
|
try {
|
|
@@ -710,7 +710,7 @@ Optional fields${pathContext}:`));
|
|
|
710
710
|
return answer[fieldMeta.key];
|
|
711
711
|
} catch (error) {
|
|
712
712
|
if (this.isUserCancellation(error)) {
|
|
713
|
-
console.log(
|
|
713
|
+
console.log(chalk3__default.default.yellow("\n\nOperation cancelled by user"));
|
|
714
714
|
throw new ZapierCliUserCancellationError();
|
|
715
715
|
}
|
|
716
716
|
throw error;
|
|
@@ -728,7 +728,7 @@ Optional fields${pathContext}:`));
|
|
|
728
728
|
}
|
|
729
729
|
} catch (error) {
|
|
730
730
|
if (this.isUserCancellation(error)) {
|
|
731
|
-
console.log(
|
|
731
|
+
console.log(chalk3__default.default.yellow("\n\nOperation cancelled by user"));
|
|
732
732
|
throw new ZapierCliUserCancellationError();
|
|
733
733
|
}
|
|
734
734
|
throw error;
|
|
@@ -832,7 +832,7 @@ function formatItemsFromSchema(functionInfo, items, startingNumber = 0) {
|
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
834
|
function formatSingleItem(formatted, itemNumber) {
|
|
835
|
-
let titleLine = `${
|
|
835
|
+
let titleLine = `${chalk3__default.default.gray(`${itemNumber + 1}.`)} ${chalk3__default.default.cyan(formatted.title)}`;
|
|
836
836
|
const subtitleParts = [];
|
|
837
837
|
if (formatted.keys) {
|
|
838
838
|
subtitleParts.push(...formatted.keys);
|
|
@@ -844,11 +844,11 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
844
844
|
}
|
|
845
845
|
const uniqueParts = [...new Set(subtitleParts)];
|
|
846
846
|
if (uniqueParts.length > 0) {
|
|
847
|
-
titleLine += ` ${
|
|
847
|
+
titleLine += ` ${chalk3__default.default.gray(`(${uniqueParts.join(", ")})`)}`;
|
|
848
848
|
}
|
|
849
849
|
console.log(titleLine);
|
|
850
850
|
if (formatted.description) {
|
|
851
|
-
console.log(` ${
|
|
851
|
+
console.log(` ${chalk3__default.default.dim(formatted.description)}`);
|
|
852
852
|
}
|
|
853
853
|
if (formatted.data !== void 0) {
|
|
854
854
|
formatJsonOutput(formatted.data);
|
|
@@ -864,16 +864,16 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
864
864
|
function applyStyle(value, style) {
|
|
865
865
|
switch (style) {
|
|
866
866
|
case "dim":
|
|
867
|
-
return
|
|
867
|
+
return chalk3__default.default.dim(value);
|
|
868
868
|
case "accent":
|
|
869
|
-
return
|
|
869
|
+
return chalk3__default.default.magenta(value);
|
|
870
870
|
case "warning":
|
|
871
|
-
return
|
|
871
|
+
return chalk3__default.default.red(value);
|
|
872
872
|
case "success":
|
|
873
|
-
return
|
|
873
|
+
return chalk3__default.default.green(value);
|
|
874
874
|
case "normal":
|
|
875
875
|
default:
|
|
876
|
-
return
|
|
876
|
+
return chalk3__default.default.blue(value);
|
|
877
877
|
}
|
|
878
878
|
}
|
|
879
879
|
function convertGenericItemToFormattedItem(item) {
|
|
@@ -923,7 +923,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
|
|
|
923
923
|
|
|
924
924
|
// package.json
|
|
925
925
|
var package_default = {
|
|
926
|
-
version: "0.34.
|
|
926
|
+
version: "0.34.10"};
|
|
927
927
|
|
|
928
928
|
// src/telemetry/builders.ts
|
|
929
929
|
function createCliBaseEvent(context = {}) {
|
|
@@ -1024,7 +1024,7 @@ async function promptConfirm(confirmType) {
|
|
|
1024
1024
|
return { confirmed: true };
|
|
1025
1025
|
}
|
|
1026
1026
|
const { messageBefore, messageAfter } = CONFIRM_MESSAGES[confirmType];
|
|
1027
|
-
console.log(
|
|
1027
|
+
console.log(chalk3__default.default.yellow(`
|
|
1028
1028
|
${messageBefore}
|
|
1029
1029
|
`));
|
|
1030
1030
|
const { confirmed } = await inquirer__default.default.prompt([
|
|
@@ -1037,6 +1037,20 @@ ${messageBefore}
|
|
|
1037
1037
|
]);
|
|
1038
1038
|
return { confirmed, messageAfter };
|
|
1039
1039
|
}
|
|
1040
|
+
function emitDeprecationWarning({
|
|
1041
|
+
cliCommandName,
|
|
1042
|
+
deprecation
|
|
1043
|
+
}) {
|
|
1044
|
+
if (!deprecation) {
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
console.warn();
|
|
1048
|
+
console.warn(
|
|
1049
|
+
chalk3__default.default.yellow.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk3__default.default.yellow(` - \`${cliCommandName}\` is deprecated.`)
|
|
1050
|
+
);
|
|
1051
|
+
console.warn(chalk3__default.default.yellow(` ${deprecation.message}`));
|
|
1052
|
+
console.warn();
|
|
1053
|
+
}
|
|
1040
1054
|
function analyzeZodSchema(schema, functionInfo) {
|
|
1041
1055
|
const parameters = [];
|
|
1042
1056
|
const schemaDef = schema._zod?.def;
|
|
@@ -1271,6 +1285,10 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1271
1285
|
try {
|
|
1272
1286
|
const commandObj = args[args.length - 1];
|
|
1273
1287
|
const options = commandObj.opts();
|
|
1288
|
+
emitDeprecationWarning({
|
|
1289
|
+
cliCommandName,
|
|
1290
|
+
deprecation: functionInfo.deprecation
|
|
1291
|
+
});
|
|
1274
1292
|
const isListCommand = functionInfo.type === "list";
|
|
1275
1293
|
const hasPaginationParams = parameters.some(
|
|
1276
1294
|
(p) => p.name === "maxItems" || p.name === "pageSize"
|
|
@@ -1298,7 +1316,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1298
1316
|
if (confirm && !shouldUseJson) {
|
|
1299
1317
|
const confirmResult = await promptConfirm(confirm);
|
|
1300
1318
|
if (!confirmResult.confirmed) {
|
|
1301
|
-
console.log(
|
|
1319
|
+
console.log(chalk3__default.default.yellow("Operation cancelled."));
|
|
1302
1320
|
return;
|
|
1303
1321
|
}
|
|
1304
1322
|
confirmMessageAfter = confirmResult.messageAfter;
|
|
@@ -1317,9 +1335,9 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1317
1335
|
const sdkObj = sdk2;
|
|
1318
1336
|
await sdkObj[functionInfo.name](resolvedParams);
|
|
1319
1337
|
console.log(
|
|
1320
|
-
|
|
1338
|
+
chalk3__default.default.green(`\u2705 ${cliCommandName} completed successfully!`)
|
|
1321
1339
|
);
|
|
1322
|
-
console.log(
|
|
1340
|
+
console.log(chalk3__default.default.gray(`Output written to: ${hasOutputFile}`));
|
|
1323
1341
|
return;
|
|
1324
1342
|
}
|
|
1325
1343
|
let result;
|
|
@@ -1366,7 +1384,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1366
1384
|
formatJsonOutput(items);
|
|
1367
1385
|
}
|
|
1368
1386
|
if (confirmMessageAfter) {
|
|
1369
|
-
console.log(
|
|
1387
|
+
console.log(chalk3__default.default.yellow(`
|
|
1370
1388
|
${confirmMessageAfter}`));
|
|
1371
1389
|
}
|
|
1372
1390
|
}
|
|
@@ -1376,23 +1394,23 @@ ${confirmMessageAfter}`));
|
|
|
1376
1394
|
if (error instanceof Error && error.message.includes('"code"')) {
|
|
1377
1395
|
try {
|
|
1378
1396
|
const validationErrors = JSON.parse(error.message);
|
|
1379
|
-
console.error(
|
|
1397
|
+
console.error(chalk3__default.default.red("\u274C Validation Error:"));
|
|
1380
1398
|
validationErrors.forEach((err) => {
|
|
1381
1399
|
const errorObj = err;
|
|
1382
1400
|
const field = errorObj?.path?.join(".") || "unknown";
|
|
1383
1401
|
console.error(
|
|
1384
|
-
|
|
1402
|
+
chalk3__default.default.yellow(
|
|
1385
1403
|
` \u2022 ${field}: ${errorObj?.message || "Unknown error"}`
|
|
1386
1404
|
)
|
|
1387
1405
|
);
|
|
1388
1406
|
});
|
|
1389
1407
|
console.error(
|
|
1390
|
-
"\n" +
|
|
1408
|
+
"\n" + chalk3__default.default.dim(`Use --help to see available options`)
|
|
1391
1409
|
);
|
|
1392
1410
|
throw new ZapierCliExitError("Validation failed", 1);
|
|
1393
1411
|
} catch {
|
|
1394
1412
|
console.error(
|
|
1395
|
-
|
|
1413
|
+
chalk3__default.default.red("Error:"),
|
|
1396
1414
|
error instanceof Error ? error.message : String(error)
|
|
1397
1415
|
);
|
|
1398
1416
|
throw new ZapierCliExitError(
|
|
@@ -1404,11 +1422,11 @@ ${confirmMessageAfter}`));
|
|
|
1404
1422
|
throw error;
|
|
1405
1423
|
} else if (error instanceof zapierSdk.ZapierError) {
|
|
1406
1424
|
const formattedMessage = zapierSdk.formatErrorMessage(error);
|
|
1407
|
-
console.error(
|
|
1425
|
+
console.error(chalk3__default.default.red("\u274C Error:"), formattedMessage);
|
|
1408
1426
|
throw new ZapierCliExitError(formattedMessage, 1);
|
|
1409
1427
|
} else {
|
|
1410
1428
|
const msg = error instanceof Error ? error.message : "Unknown error";
|
|
1411
|
-
console.error(
|
|
1429
|
+
console.error(chalk3__default.default.red("\u274C Error:"), msg);
|
|
1412
1430
|
throw new ZapierCliExitError(msg, 1);
|
|
1413
1431
|
}
|
|
1414
1432
|
} finally {
|
|
@@ -1572,7 +1590,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1572
1590
|
let totalShown = 0;
|
|
1573
1591
|
let pageCount = 0;
|
|
1574
1592
|
console.log(
|
|
1575
|
-
|
|
1593
|
+
chalk3__default.default.blue(`\u{1F4CB} ${getListTitleFromMethod(sdkMethodName, functionInfo)}
|
|
1576
1594
|
`)
|
|
1577
1595
|
);
|
|
1578
1596
|
try {
|
|
@@ -1580,11 +1598,11 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1580
1598
|
const items = page.data || page;
|
|
1581
1599
|
pageCount++;
|
|
1582
1600
|
if (!Array.isArray(items)) {
|
|
1583
|
-
console.log(
|
|
1601
|
+
console.log(chalk3__default.default.yellow(`No ${itemName} found.`));
|
|
1584
1602
|
return;
|
|
1585
1603
|
}
|
|
1586
1604
|
if (items.length === 0 && pageCount === 1) {
|
|
1587
|
-
console.log(
|
|
1605
|
+
console.log(chalk3__default.default.yellow(`No ${itemName} found.`));
|
|
1588
1606
|
return;
|
|
1589
1607
|
}
|
|
1590
1608
|
if (items.length === 0) {
|
|
@@ -1593,7 +1611,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1593
1611
|
if (pageCount > 1) {
|
|
1594
1612
|
console.clear();
|
|
1595
1613
|
console.log(
|
|
1596
|
-
|
|
1614
|
+
chalk3__default.default.blue(
|
|
1597
1615
|
`\u{1F4CB} ${getListTitleFromMethod(sdkMethodName, functionInfo)}
|
|
1598
1616
|
`
|
|
1599
1617
|
)
|
|
@@ -1610,7 +1628,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1610
1628
|
}
|
|
1611
1629
|
totalShown += items.length;
|
|
1612
1630
|
console.log(
|
|
1613
|
-
|
|
1631
|
+
chalk3__default.default.green(
|
|
1614
1632
|
`
|
|
1615
1633
|
\u2705 Showing ${totalShown} ${itemName} (page ${pageCount})`
|
|
1616
1634
|
)
|
|
@@ -1631,13 +1649,13 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1631
1649
|
break;
|
|
1632
1650
|
}
|
|
1633
1651
|
}
|
|
1634
|
-
console.log(
|
|
1652
|
+
console.log(chalk3__default.default.gray(`
|
|
1635
1653
|
\u{1F4C4} Finished browsing ${itemName}`));
|
|
1636
1654
|
} catch (error) {
|
|
1637
1655
|
const items = sdkResult?.data || sdkResult;
|
|
1638
1656
|
if (Array.isArray(items)) {
|
|
1639
1657
|
if (items.length === 0) {
|
|
1640
|
-
console.log(
|
|
1658
|
+
console.log(chalk3__default.default.yellow(`No ${itemName} found.`));
|
|
1641
1659
|
return;
|
|
1642
1660
|
}
|
|
1643
1661
|
if (functionInfo && functionInfo.inputSchema) {
|
|
@@ -1649,7 +1667,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1649
1667
|
} else {
|
|
1650
1668
|
formatItemsGeneric2(items, 0);
|
|
1651
1669
|
}
|
|
1652
|
-
console.log(
|
|
1670
|
+
console.log(chalk3__default.default.green(`
|
|
1653
1671
|
\u2705 Showing ${items.length} ${itemName}`));
|
|
1654
1672
|
} else {
|
|
1655
1673
|
throw error;
|
|
@@ -1671,10 +1689,10 @@ function formatNonPaginatedResults(result, requestedMaxItems, userSpecifiedMaxIt
|
|
|
1671
1689
|
}
|
|
1672
1690
|
const itemName = functionInfo ? getItemNameFromMethod(functionInfo) : "items";
|
|
1673
1691
|
if (result.length === 0) {
|
|
1674
|
-
console.log(
|
|
1692
|
+
console.log(chalk3__default.default.yellow(`No ${itemName} found.`));
|
|
1675
1693
|
return;
|
|
1676
1694
|
}
|
|
1677
|
-
console.log(
|
|
1695
|
+
console.log(chalk3__default.default.green(`
|
|
1678
1696
|
\u2705 Found ${result.length} ${itemName}:
|
|
1679
1697
|
`));
|
|
1680
1698
|
if (functionInfo && functionInfo.inputSchema) {
|
|
@@ -1687,13 +1705,13 @@ function formatNonPaginatedResults(result, requestedMaxItems, userSpecifiedMaxIt
|
|
|
1687
1705
|
}
|
|
1688
1706
|
if (userSpecifiedMaxItems && requestedMaxItems) {
|
|
1689
1707
|
console.log(
|
|
1690
|
-
|
|
1708
|
+
chalk3__default.default.gray(
|
|
1691
1709
|
`
|
|
1692
1710
|
\u{1F4C4} Showing up to ${requestedMaxItems} ${itemName} (--max-items ${requestedMaxItems})`
|
|
1693
1711
|
)
|
|
1694
1712
|
);
|
|
1695
1713
|
} else {
|
|
1696
|
-
console.log(
|
|
1714
|
+
console.log(chalk3__default.default.gray(`
|
|
1697
1715
|
\u{1F4C4} All available ${itemName} shown`));
|
|
1698
1716
|
}
|
|
1699
1717
|
}
|
|
@@ -1702,10 +1720,10 @@ function formatItemsGeneric2(items, startingNumber = 0) {
|
|
|
1702
1720
|
const itemObj = item;
|
|
1703
1721
|
const name = itemObj?.name || itemObj?.key || itemObj?.id || "Item";
|
|
1704
1722
|
console.log(
|
|
1705
|
-
`${
|
|
1723
|
+
`${chalk3__default.default.gray(`${startingNumber + index + 1}.`)} ${chalk3__default.default.cyan(String(name))}`
|
|
1706
1724
|
);
|
|
1707
1725
|
if (itemObj?.description) {
|
|
1708
|
-
console.log(` ${
|
|
1726
|
+
console.log(` ${chalk3__default.default.dim(String(itemObj.description))}`);
|
|
1709
1727
|
}
|
|
1710
1728
|
console.log();
|
|
1711
1729
|
});
|
|
@@ -1741,20 +1759,20 @@ var spinPromise = async (promise, text) => {
|
|
|
1741
1759
|
};
|
|
1742
1760
|
var log = {
|
|
1743
1761
|
info: (message, ...args) => {
|
|
1744
|
-
console.log(
|
|
1762
|
+
console.log(chalk3__default.default.blue("\u2139"), message, ...args);
|
|
1745
1763
|
},
|
|
1746
1764
|
error: (message, ...args) => {
|
|
1747
|
-
console.error(
|
|
1765
|
+
console.error(chalk3__default.default.red("\u2716"), message, ...args);
|
|
1748
1766
|
},
|
|
1749
1767
|
success: (message, ...args) => {
|
|
1750
|
-
console.log(
|
|
1768
|
+
console.log(chalk3__default.default.green("\u2713"), message, ...args);
|
|
1751
1769
|
},
|
|
1752
1770
|
warn: (message, ...args) => {
|
|
1753
|
-
console.log(
|
|
1771
|
+
console.log(chalk3__default.default.yellow("\u26A0"), message, ...args);
|
|
1754
1772
|
},
|
|
1755
1773
|
debug: (message, ...args) => {
|
|
1756
1774
|
if (process.env.DEBUG === "true" || process.argv.includes("--debug")) {
|
|
1757
|
-
console.log(
|
|
1775
|
+
console.log(chalk3__default.default.gray("\u{1F41B}"), message, ...args);
|
|
1758
1776
|
}
|
|
1759
1777
|
}
|
|
1760
1778
|
};
|
|
@@ -3662,7 +3680,10 @@ var cliOverridesPlugin = ({ context }) => {
|
|
|
3662
3680
|
meta: {
|
|
3663
3681
|
fetch: {
|
|
3664
3682
|
...context.meta.fetch,
|
|
3665
|
-
categories: [...context.meta.fetch.categories || [], "deprecated"]
|
|
3683
|
+
categories: [...context.meta.fetch.categories || [], "deprecated"],
|
|
3684
|
+
deprecation: {
|
|
3685
|
+
message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
|
|
3686
|
+
}
|
|
3666
3687
|
}
|
|
3667
3688
|
}
|
|
3668
3689
|
}
|
|
@@ -3816,7 +3837,7 @@ function buildTemplateVariables({
|
|
|
3816
3837
|
};
|
|
3817
3838
|
}
|
|
3818
3839
|
function cleanupProject({ projectDir }) {
|
|
3819
|
-
console.log("\n" +
|
|
3840
|
+
console.log("\n" + chalk3__default.default.yellow("!") + " Cleaning up...");
|
|
3820
3841
|
fs.rmSync(projectDir, { recursive: true, force: true });
|
|
3821
3842
|
}
|
|
3822
3843
|
async function withInterruptCleanup(cleanup, fn) {
|
|
@@ -4026,8 +4047,8 @@ function buildNextSteps({
|
|
|
4026
4047
|
}
|
|
4027
4048
|
function createConsoleDisplayHooks() {
|
|
4028
4049
|
return {
|
|
4029
|
-
onItemComplete: (message) => console.log(" " +
|
|
4030
|
-
onWarn: (message) => console.warn(
|
|
4050
|
+
onItemComplete: (message) => console.log(" " + chalk3__default.default.green("\u2713") + " " + chalk3__default.default.dim(message)),
|
|
4051
|
+
onWarn: (message) => console.warn(chalk3__default.default.yellow("!") + " " + message),
|
|
4031
4052
|
onStepStart: ({
|
|
4032
4053
|
description,
|
|
4033
4054
|
stepNumber,
|
|
@@ -4036,31 +4057,31 @@ function createConsoleDisplayHooks() {
|
|
|
4036
4057
|
skipPrompts
|
|
4037
4058
|
}) => {
|
|
4038
4059
|
const progressMessage = `${description}...`;
|
|
4039
|
-
const stepCounter =
|
|
4060
|
+
const stepCounter = chalk3__default.default.dim(`${stepNumber}/${totalSteps}`);
|
|
4040
4061
|
if (skipPrompts) {
|
|
4041
4062
|
console.log(
|
|
4042
|
-
"\n" +
|
|
4063
|
+
"\n" + chalk3__default.default.bold(`\u276F ${progressMessage}`) + " " + stepCounter + "\n"
|
|
4043
4064
|
);
|
|
4044
4065
|
} else {
|
|
4045
4066
|
console.log(
|
|
4046
|
-
|
|
4067
|
+
chalk3__default.default.dim("\u2192") + " " + progressMessage + " " + stepCounter
|
|
4047
4068
|
);
|
|
4048
4069
|
}
|
|
4049
4070
|
if (command) {
|
|
4050
|
-
console.log(" " +
|
|
4071
|
+
console.log(" " + chalk3__default.default.cyan(`$ ${command}`));
|
|
4051
4072
|
}
|
|
4052
4073
|
},
|
|
4053
4074
|
onStepSuccess: ({ stepNumber, totalSteps }) => console.log(
|
|
4054
|
-
"\n" +
|
|
4075
|
+
"\n" + chalk3__default.default.green("\u2713") + " " + chalk3__default.default.dim(`Step ${stepNumber}/${totalSteps} complete`) + "\n"
|
|
4055
4076
|
),
|
|
4056
4077
|
onStepError: ({ description, command, err }) => {
|
|
4057
4078
|
const detail = err instanceof Error && err.message ? `
|
|
4058
|
-
${
|
|
4079
|
+
${chalk3__default.default.dim(err.message)}` : "";
|
|
4059
4080
|
const hint = command ? `
|
|
4060
|
-
${
|
|
4081
|
+
${chalk3__default.default.dim("run manually:")} ${chalk3__default.default.cyan(`$ ${command}`)}` : "";
|
|
4061
4082
|
console.error(
|
|
4062
4083
|
`
|
|
4063
|
-
${
|
|
4084
|
+
${chalk3__default.default.red("\u2716")} ${chalk3__default.default.bold(description)}${chalk3__default.default.dim(" failed")}${detail}${hint}`
|
|
4064
4085
|
);
|
|
4065
4086
|
}
|
|
4066
4087
|
};
|
|
@@ -4072,22 +4093,22 @@ function displaySummaryAndNextSteps({
|
|
|
4072
4093
|
packageManager
|
|
4073
4094
|
}) {
|
|
4074
4095
|
const formatStatus = (complete) => ({
|
|
4075
|
-
icon: complete ?
|
|
4076
|
-
text: complete ?
|
|
4096
|
+
icon: complete ? chalk3__default.default.green("\u2713") : chalk3__default.default.yellow("!"),
|
|
4097
|
+
text: complete ? chalk3__default.default.green("Setup complete") : chalk3__default.default.yellow("Setup interrupted")
|
|
4077
4098
|
});
|
|
4078
|
-
const formatNextStep = (step, i) => " " +
|
|
4079
|
-
const formatCommand = (cmd) => " " +
|
|
4080
|
-
const formatCompletedStep = (step) => " " +
|
|
4099
|
+
const formatNextStep = (step, i) => " " + chalk3__default.default.dim(`${i + 1}.`) + " " + chalk3__default.default.bold(step.description);
|
|
4100
|
+
const formatCommand = (cmd) => " " + chalk3__default.default.cyan(`$ ${cmd}`);
|
|
4101
|
+
const formatCompletedStep = (step) => " " + chalk3__default.default.green("\u2713") + " " + step.description;
|
|
4081
4102
|
const { execCmd } = getPackageManagerCommands({ packageManager });
|
|
4082
4103
|
const leftoverSteps = steps.filter(
|
|
4083
4104
|
(s) => !completedSetupStepIds.includes(s.id)
|
|
4084
4105
|
);
|
|
4085
4106
|
const isComplete = leftoverSteps.length === 0;
|
|
4086
4107
|
const status = formatStatus(isComplete);
|
|
4087
|
-
console.log("\n" +
|
|
4088
|
-
console.log(" " +
|
|
4108
|
+
console.log("\n" + chalk3__default.default.bold("\u276F Summary") + "\n");
|
|
4109
|
+
console.log(" " + chalk3__default.default.dim("Project") + " " + chalk3__default.default.bold(projectName));
|
|
4089
4110
|
console.log(
|
|
4090
|
-
" " +
|
|
4111
|
+
" " + chalk3__default.default.dim("Status") + " " + status.icon + " " + status.text
|
|
4091
4112
|
);
|
|
4092
4113
|
const completedSteps = steps.filter(
|
|
4093
4114
|
(s) => completedSetupStepIds.includes(s.id)
|
|
@@ -4097,7 +4118,7 @@ function displaySummaryAndNextSteps({
|
|
|
4097
4118
|
for (const step of completedSteps) console.log(formatCompletedStep(step));
|
|
4098
4119
|
}
|
|
4099
4120
|
const nextSteps = buildNextSteps({ projectName, leftoverSteps, execCmd });
|
|
4100
|
-
console.log("\n" +
|
|
4121
|
+
console.log("\n" + chalk3__default.default.bold("\u276F Next Steps") + "\n");
|
|
4101
4122
|
nextSteps.forEach((step, i) => {
|
|
4102
4123
|
console.log(formatNextStep(step, i));
|
|
4103
4124
|
if (step.command) console.log(formatCommand(step.command));
|
|
@@ -4178,7 +4199,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4178
4199
|
// package.json with { type: 'json' }
|
|
4179
4200
|
var package_default2 = {
|
|
4180
4201
|
name: "@zapier/zapier-sdk-cli",
|
|
4181
|
-
version: "0.34.
|
|
4202
|
+
version: "0.34.10"};
|
|
4182
4203
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4183
4204
|
var CACHE_RESET_INTERVAL_MS = (() => {
|
|
4184
4205
|
const { ZAPIER_SDK_UPDATE_CHECK_INTERVAL_MS = `${ONE_DAY_MS}` } = process.env;
|
|
@@ -4288,26 +4309,26 @@ function displayUpdateNotification(versionInfo, packageName) {
|
|
|
4288
4309
|
if (versionInfo.isDeprecated) {
|
|
4289
4310
|
console.error();
|
|
4290
4311
|
console.error(
|
|
4291
|
-
|
|
4312
|
+
chalk3__default.default.red.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk3__default.default.red(
|
|
4292
4313
|
` - ${packageName} v${versionInfo.currentVersion} is deprecated.`
|
|
4293
4314
|
)
|
|
4294
4315
|
);
|
|
4295
4316
|
if (versionInfo.deprecationMessage) {
|
|
4296
|
-
console.error(
|
|
4317
|
+
console.error(chalk3__default.default.red(` ${versionInfo.deprecationMessage}`));
|
|
4297
4318
|
}
|
|
4298
|
-
console.error(
|
|
4319
|
+
console.error(chalk3__default.default.red(` Please update to the latest version.`));
|
|
4299
4320
|
console.error();
|
|
4300
4321
|
}
|
|
4301
4322
|
if (versionInfo.hasUpdate) {
|
|
4302
4323
|
console.error();
|
|
4303
4324
|
console.error(
|
|
4304
|
-
|
|
4325
|
+
chalk3__default.default.yellow.bold("\u{1F4E6} Update available!") + chalk3__default.default.yellow(
|
|
4305
4326
|
` ${packageName} v${versionInfo.currentVersion} \u2192 v${versionInfo.latestVersion}`
|
|
4306
4327
|
)
|
|
4307
4328
|
);
|
|
4308
4329
|
console.error(
|
|
4309
|
-
|
|
4310
|
-
` Run ${
|
|
4330
|
+
chalk3__default.default.yellow(
|
|
4331
|
+
` Run ${chalk3__default.default.bold(getUpdateCommand(packageName))} to update.`
|
|
4311
4332
|
)
|
|
4312
4333
|
);
|
|
4313
4334
|
console.error();
|