@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/dist/cli.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { Command, CommanderError } from 'commander';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { createFunction, OutputPropertySchema, DEFAULT_CONFIG_PATH, injectCliLogin, createZapierSdkWithoutRegistry, registryPlugin, ZapierError, ZapierValidationError, ZapierUnknownError, batch, toSnakeCase, buildApplicationLifecycleEvent, formatErrorMessage, isCredentialsObject, isPositional, getOsInfo, getPlatformVersions, getCiPlatform, isCi, getReleaseId, getCurrentTimestamp, generateEventId } from '@zapier/zapier-sdk';
|
|
5
5
|
import inquirer from 'inquirer';
|
|
6
|
-
import
|
|
6
|
+
import chalk3 from 'chalk';
|
|
7
7
|
import util from 'util';
|
|
8
8
|
import * as cliLogin from '@zapier/zapier-sdk-cli-login';
|
|
9
9
|
import { logout, getConfigPath, getLoggedInUser, getPkceLoginConfig, AUTH_MODE_HEADER, getLoginStorageMode, updateLogin, getConfig } from '@zapier/zapier-sdk-cli-login';
|
|
@@ -152,7 +152,7 @@ var SchemaParameterResolver = class {
|
|
|
152
152
|
context.resolvedParams = resolvedParams;
|
|
153
153
|
} catch (error) {
|
|
154
154
|
if (this.isUserCancellation(error)) {
|
|
155
|
-
console.log(
|
|
155
|
+
console.log(chalk3.yellow("\n\nOperation cancelled by user"));
|
|
156
156
|
throw new ZapierCliUserCancellationError();
|
|
157
157
|
}
|
|
158
158
|
throw error;
|
|
@@ -190,7 +190,7 @@ var SchemaParameterResolver = class {
|
|
|
190
190
|
context.resolvedParams = resolvedParams;
|
|
191
191
|
} catch (error) {
|
|
192
192
|
if (this.isUserCancellation(error)) {
|
|
193
|
-
console.log(
|
|
193
|
+
console.log(chalk3.yellow("\n\nOperation cancelled by user"));
|
|
194
194
|
throw new ZapierCliUserCancellationError();
|
|
195
195
|
}
|
|
196
196
|
throw error;
|
|
@@ -225,7 +225,7 @@ var SchemaParameterResolver = class {
|
|
|
225
225
|
context.resolvedParams = resolvedParams;
|
|
226
226
|
} catch (error) {
|
|
227
227
|
if (this.isUserCancellation(error)) {
|
|
228
|
-
console.log(
|
|
228
|
+
console.log(chalk3.yellow("\n\nOperation cancelled by user"));
|
|
229
229
|
throw new ZapierCliUserCancellationError();
|
|
230
230
|
}
|
|
231
231
|
throw error;
|
|
@@ -236,7 +236,7 @@ var SchemaParameterResolver = class {
|
|
|
236
236
|
const finalResult = schema.safeParse(resolvedParams);
|
|
237
237
|
if (!finalResult.success) {
|
|
238
238
|
console.error(
|
|
239
|
-
|
|
239
|
+
chalk3.red("\u274C Parameter validation failed after resolution:")
|
|
240
240
|
);
|
|
241
241
|
throw finalResult.error;
|
|
242
242
|
}
|
|
@@ -288,7 +288,7 @@ var SchemaParameterResolver = class {
|
|
|
288
288
|
if (!resolver) {
|
|
289
289
|
throw new Error(`No resolver found for parameter: ${param.name}`);
|
|
290
290
|
}
|
|
291
|
-
console.log(
|
|
291
|
+
console.log(chalk3.blue(`
|
|
292
292
|
\u{1F50D} Resolving ${param.name}...`));
|
|
293
293
|
if (resolver.type === "static") {
|
|
294
294
|
const staticResolver = resolver;
|
|
@@ -317,7 +317,7 @@ var SchemaParameterResolver = class {
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
if (param.isRequired && param.name !== "connectionId") {
|
|
320
|
-
console.log(
|
|
320
|
+
console.log(chalk3.gray(`Fetching options for ${param.name}...`));
|
|
321
321
|
}
|
|
322
322
|
const items = await dynamicResolver.fetch(
|
|
323
323
|
context.sdk,
|
|
@@ -354,7 +354,7 @@ var SchemaParameterResolver = class {
|
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
console.log(
|
|
357
|
-
|
|
357
|
+
chalk3.gray(
|
|
358
358
|
`Fetching input fields for ${param.name}${iteration > 1 ? ` (iteration ${iteration})` : ""}...`
|
|
359
359
|
)
|
|
360
360
|
);
|
|
@@ -365,7 +365,7 @@ var SchemaParameterResolver = class {
|
|
|
365
365
|
if (!rootFieldItems || rootFieldItems.length === 0) {
|
|
366
366
|
if (iteration === 1) {
|
|
367
367
|
console.log(
|
|
368
|
-
|
|
368
|
+
chalk3.yellow(`No input fields required for this action.`)
|
|
369
369
|
);
|
|
370
370
|
}
|
|
371
371
|
break;
|
|
@@ -387,7 +387,7 @@ var SchemaParameterResolver = class {
|
|
|
387
387
|
}
|
|
388
388
|
if (iteration >= maxIterations) {
|
|
389
389
|
console.log(
|
|
390
|
-
|
|
390
|
+
chalk3.yellow(
|
|
391
391
|
`
|
|
392
392
|
\u26A0\uFE0F Maximum field resolution iterations reached. Some dynamic fields may not have been discovered.`
|
|
393
393
|
)
|
|
@@ -409,7 +409,7 @@ var SchemaParameterResolver = class {
|
|
|
409
409
|
const fieldsetTitle = typedItem.title || typedItem.key;
|
|
410
410
|
const pathDisplay = fieldsetPath.length > 0 ? ` (in ${fieldsetPath.join(" > ")})` : "";
|
|
411
411
|
console.log(
|
|
412
|
-
|
|
412
|
+
chalk3.cyan(
|
|
413
413
|
`
|
|
414
414
|
\u{1F4C1} Processing fieldset: ${fieldsetTitle}${pathDisplay}`
|
|
415
415
|
)
|
|
@@ -441,7 +441,7 @@ var SchemaParameterResolver = class {
|
|
|
441
441
|
newRequiredCount++;
|
|
442
442
|
if (newRequiredCount === 1 && fieldsetPath.length === 0) {
|
|
443
443
|
console.log(
|
|
444
|
-
|
|
444
|
+
chalk3.blue(
|
|
445
445
|
`
|
|
446
446
|
\u{1F4DD} Please provide values for the following ${iteration === 1 ? "" : "additional "}input fields:`
|
|
447
447
|
)
|
|
@@ -462,7 +462,7 @@ var SchemaParameterResolver = class {
|
|
|
462
462
|
if (optionalFields.length > 0) {
|
|
463
463
|
const pathContext = fieldsetPath.length > 0 ? ` in ${fieldsetPath.join(" > ")}` : "";
|
|
464
464
|
console.log(
|
|
465
|
-
|
|
465
|
+
chalk3.gray(
|
|
466
466
|
`
|
|
467
467
|
There are ${optionalFields.length} ${iteration === 1 ? "" : "additional "}optional field(s) available${pathContext}.`
|
|
468
468
|
)
|
|
@@ -477,7 +477,7 @@ There are ${optionalFields.length} ${iteration === 1 ? "" : "additional "}option
|
|
|
477
477
|
}
|
|
478
478
|
]);
|
|
479
479
|
if (shouldConfigureOptional.configure) {
|
|
480
|
-
console.log(
|
|
480
|
+
console.log(chalk3.cyan(`
|
|
481
481
|
Optional fields${pathContext}:`));
|
|
482
482
|
for (const field of optionalFields) {
|
|
483
483
|
await this.promptForField(field, targetInputs, context);
|
|
@@ -493,7 +493,7 @@ Optional fields${pathContext}:`));
|
|
|
493
493
|
}
|
|
494
494
|
} catch (error) {
|
|
495
495
|
if (this.isUserCancellation(error)) {
|
|
496
|
-
console.log(
|
|
496
|
+
console.log(chalk3.yellow("\n\nOperation cancelled by user"));
|
|
497
497
|
throw new ZapierCliUserCancellationError();
|
|
498
498
|
}
|
|
499
499
|
throw error;
|
|
@@ -548,7 +548,7 @@ Optional fields${pathContext}:`));
|
|
|
548
548
|
async fetchChoices(fieldMeta, inputs, context, cursor) {
|
|
549
549
|
try {
|
|
550
550
|
console.log(
|
|
551
|
-
|
|
551
|
+
chalk3.gray(
|
|
552
552
|
cursor ? ` Fetching more choices...` : ` Fetching choices for ${fieldMeta.title}...`
|
|
553
553
|
)
|
|
554
554
|
);
|
|
@@ -567,7 +567,7 @@ Optional fields${pathContext}:`));
|
|
|
567
567
|
}));
|
|
568
568
|
if (choices.length === 0 && !cursor) {
|
|
569
569
|
console.log(
|
|
570
|
-
|
|
570
|
+
chalk3.yellow(` No choices available for ${fieldMeta.title}`)
|
|
571
571
|
);
|
|
572
572
|
}
|
|
573
573
|
return {
|
|
@@ -576,7 +576,7 @@ Optional fields${pathContext}:`));
|
|
|
576
576
|
};
|
|
577
577
|
} catch (error) {
|
|
578
578
|
console.warn(
|
|
579
|
-
|
|
579
|
+
chalk3.yellow(` \u26A0\uFE0F Failed to fetch choices for ${fieldMeta.title}:`),
|
|
580
580
|
error
|
|
581
581
|
);
|
|
582
582
|
return { choices: [] };
|
|
@@ -602,7 +602,7 @@ Optional fields${pathContext}:`));
|
|
|
602
602
|
}));
|
|
603
603
|
if (nextCursor) {
|
|
604
604
|
promptChoices.push({
|
|
605
|
-
name:
|
|
605
|
+
name: chalk3.dim("(Load more...)"),
|
|
606
606
|
value: LOAD_MORE_SENTINEL
|
|
607
607
|
});
|
|
608
608
|
}
|
|
@@ -665,7 +665,7 @@ Optional fields${pathContext}:`));
|
|
|
665
665
|
};
|
|
666
666
|
}
|
|
667
667
|
if (fieldMeta.description) {
|
|
668
|
-
promptConfig.prefix =
|
|
668
|
+
promptConfig.prefix = chalk3.gray(`\u2139 ${fieldMeta.description}
|
|
669
669
|
`);
|
|
670
670
|
}
|
|
671
671
|
try {
|
|
@@ -673,7 +673,7 @@ Optional fields${pathContext}:`));
|
|
|
673
673
|
return answer[fieldMeta.key];
|
|
674
674
|
} catch (error) {
|
|
675
675
|
if (this.isUserCancellation(error)) {
|
|
676
|
-
console.log(
|
|
676
|
+
console.log(chalk3.yellow("\n\nOperation cancelled by user"));
|
|
677
677
|
throw new ZapierCliUserCancellationError();
|
|
678
678
|
}
|
|
679
679
|
throw error;
|
|
@@ -691,7 +691,7 @@ Optional fields${pathContext}:`));
|
|
|
691
691
|
}
|
|
692
692
|
} catch (error) {
|
|
693
693
|
if (this.isUserCancellation(error)) {
|
|
694
|
-
console.log(
|
|
694
|
+
console.log(chalk3.yellow("\n\nOperation cancelled by user"));
|
|
695
695
|
throw new ZapierCliUserCancellationError();
|
|
696
696
|
}
|
|
697
697
|
throw error;
|
|
@@ -795,7 +795,7 @@ function formatItemsFromSchema(functionInfo, items, startingNumber = 0) {
|
|
|
795
795
|
});
|
|
796
796
|
}
|
|
797
797
|
function formatSingleItem(formatted, itemNumber) {
|
|
798
|
-
let titleLine = `${
|
|
798
|
+
let titleLine = `${chalk3.gray(`${itemNumber + 1}.`)} ${chalk3.cyan(formatted.title)}`;
|
|
799
799
|
const subtitleParts = [];
|
|
800
800
|
if (formatted.keys) {
|
|
801
801
|
subtitleParts.push(...formatted.keys);
|
|
@@ -807,11 +807,11 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
807
807
|
}
|
|
808
808
|
const uniqueParts = [...new Set(subtitleParts)];
|
|
809
809
|
if (uniqueParts.length > 0) {
|
|
810
|
-
titleLine += ` ${
|
|
810
|
+
titleLine += ` ${chalk3.gray(`(${uniqueParts.join(", ")})`)}`;
|
|
811
811
|
}
|
|
812
812
|
console.log(titleLine);
|
|
813
813
|
if (formatted.description) {
|
|
814
|
-
console.log(` ${
|
|
814
|
+
console.log(` ${chalk3.dim(formatted.description)}`);
|
|
815
815
|
}
|
|
816
816
|
if (formatted.data !== void 0) {
|
|
817
817
|
formatJsonOutput(formatted.data);
|
|
@@ -827,16 +827,16 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
827
827
|
function applyStyle(value, style) {
|
|
828
828
|
switch (style) {
|
|
829
829
|
case "dim":
|
|
830
|
-
return
|
|
830
|
+
return chalk3.dim(value);
|
|
831
831
|
case "accent":
|
|
832
|
-
return
|
|
832
|
+
return chalk3.magenta(value);
|
|
833
833
|
case "warning":
|
|
834
|
-
return
|
|
834
|
+
return chalk3.red(value);
|
|
835
835
|
case "success":
|
|
836
|
-
return
|
|
836
|
+
return chalk3.green(value);
|
|
837
837
|
case "normal":
|
|
838
838
|
default:
|
|
839
|
-
return
|
|
839
|
+
return chalk3.blue(value);
|
|
840
840
|
}
|
|
841
841
|
}
|
|
842
842
|
function convertGenericItemToFormattedItem(item) {
|
|
@@ -886,7 +886,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
|
|
|
886
886
|
|
|
887
887
|
// package.json
|
|
888
888
|
var package_default = {
|
|
889
|
-
version: "0.34.
|
|
889
|
+
version: "0.34.10"};
|
|
890
890
|
|
|
891
891
|
// src/telemetry/builders.ts
|
|
892
892
|
function createCliBaseEvent(context = {}) {
|
|
@@ -987,7 +987,7 @@ async function promptConfirm(confirmType) {
|
|
|
987
987
|
return { confirmed: true };
|
|
988
988
|
}
|
|
989
989
|
const { messageBefore, messageAfter } = CONFIRM_MESSAGES[confirmType];
|
|
990
|
-
console.log(
|
|
990
|
+
console.log(chalk3.yellow(`
|
|
991
991
|
${messageBefore}
|
|
992
992
|
`));
|
|
993
993
|
const { confirmed } = await inquirer.prompt([
|
|
@@ -1000,6 +1000,20 @@ ${messageBefore}
|
|
|
1000
1000
|
]);
|
|
1001
1001
|
return { confirmed, messageAfter };
|
|
1002
1002
|
}
|
|
1003
|
+
function emitDeprecationWarning({
|
|
1004
|
+
cliCommandName,
|
|
1005
|
+
deprecation
|
|
1006
|
+
}) {
|
|
1007
|
+
if (!deprecation) {
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
console.warn();
|
|
1011
|
+
console.warn(
|
|
1012
|
+
chalk3.yellow.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk3.yellow(` - \`${cliCommandName}\` is deprecated.`)
|
|
1013
|
+
);
|
|
1014
|
+
console.warn(chalk3.yellow(` ${deprecation.message}`));
|
|
1015
|
+
console.warn();
|
|
1016
|
+
}
|
|
1003
1017
|
function analyzeZodSchema(schema, functionInfo) {
|
|
1004
1018
|
const parameters = [];
|
|
1005
1019
|
const schemaDef = schema._zod?.def;
|
|
@@ -1234,6 +1248,10 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1234
1248
|
try {
|
|
1235
1249
|
const commandObj = args[args.length - 1];
|
|
1236
1250
|
const options = commandObj.opts();
|
|
1251
|
+
emitDeprecationWarning({
|
|
1252
|
+
cliCommandName,
|
|
1253
|
+
deprecation: functionInfo.deprecation
|
|
1254
|
+
});
|
|
1237
1255
|
const isListCommand = functionInfo.type === "list";
|
|
1238
1256
|
const hasPaginationParams = parameters.some(
|
|
1239
1257
|
(p) => p.name === "maxItems" || p.name === "pageSize"
|
|
@@ -1261,7 +1279,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1261
1279
|
if (confirm && !shouldUseJson) {
|
|
1262
1280
|
const confirmResult = await promptConfirm(confirm);
|
|
1263
1281
|
if (!confirmResult.confirmed) {
|
|
1264
|
-
console.log(
|
|
1282
|
+
console.log(chalk3.yellow("Operation cancelled."));
|
|
1265
1283
|
return;
|
|
1266
1284
|
}
|
|
1267
1285
|
confirmMessageAfter = confirmResult.messageAfter;
|
|
@@ -1280,9 +1298,9 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1280
1298
|
const sdkObj = sdk2;
|
|
1281
1299
|
await sdkObj[functionInfo.name](resolvedParams);
|
|
1282
1300
|
console.log(
|
|
1283
|
-
|
|
1301
|
+
chalk3.green(`\u2705 ${cliCommandName} completed successfully!`)
|
|
1284
1302
|
);
|
|
1285
|
-
console.log(
|
|
1303
|
+
console.log(chalk3.gray(`Output written to: ${hasOutputFile}`));
|
|
1286
1304
|
return;
|
|
1287
1305
|
}
|
|
1288
1306
|
let result;
|
|
@@ -1329,7 +1347,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
|
|
|
1329
1347
|
formatJsonOutput(items);
|
|
1330
1348
|
}
|
|
1331
1349
|
if (confirmMessageAfter) {
|
|
1332
|
-
console.log(
|
|
1350
|
+
console.log(chalk3.yellow(`
|
|
1333
1351
|
${confirmMessageAfter}`));
|
|
1334
1352
|
}
|
|
1335
1353
|
}
|
|
@@ -1339,23 +1357,23 @@ ${confirmMessageAfter}`));
|
|
|
1339
1357
|
if (error instanceof Error && error.message.includes('"code"')) {
|
|
1340
1358
|
try {
|
|
1341
1359
|
const validationErrors = JSON.parse(error.message);
|
|
1342
|
-
console.error(
|
|
1360
|
+
console.error(chalk3.red("\u274C Validation Error:"));
|
|
1343
1361
|
validationErrors.forEach((err) => {
|
|
1344
1362
|
const errorObj = err;
|
|
1345
1363
|
const field = errorObj?.path?.join(".") || "unknown";
|
|
1346
1364
|
console.error(
|
|
1347
|
-
|
|
1365
|
+
chalk3.yellow(
|
|
1348
1366
|
` \u2022 ${field}: ${errorObj?.message || "Unknown error"}`
|
|
1349
1367
|
)
|
|
1350
1368
|
);
|
|
1351
1369
|
});
|
|
1352
1370
|
console.error(
|
|
1353
|
-
"\n" +
|
|
1371
|
+
"\n" + chalk3.dim(`Use --help to see available options`)
|
|
1354
1372
|
);
|
|
1355
1373
|
throw new ZapierCliExitError("Validation failed", 1);
|
|
1356
1374
|
} catch {
|
|
1357
1375
|
console.error(
|
|
1358
|
-
|
|
1376
|
+
chalk3.red("Error:"),
|
|
1359
1377
|
error instanceof Error ? error.message : String(error)
|
|
1360
1378
|
);
|
|
1361
1379
|
throw new ZapierCliExitError(
|
|
@@ -1367,11 +1385,11 @@ ${confirmMessageAfter}`));
|
|
|
1367
1385
|
throw error;
|
|
1368
1386
|
} else if (error instanceof ZapierError) {
|
|
1369
1387
|
const formattedMessage = formatErrorMessage(error);
|
|
1370
|
-
console.error(
|
|
1388
|
+
console.error(chalk3.red("\u274C Error:"), formattedMessage);
|
|
1371
1389
|
throw new ZapierCliExitError(formattedMessage, 1);
|
|
1372
1390
|
} else {
|
|
1373
1391
|
const msg = error instanceof Error ? error.message : "Unknown error";
|
|
1374
|
-
console.error(
|
|
1392
|
+
console.error(chalk3.red("\u274C Error:"), msg);
|
|
1375
1393
|
throw new ZapierCliExitError(msg, 1);
|
|
1376
1394
|
}
|
|
1377
1395
|
} finally {
|
|
@@ -1535,7 +1553,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1535
1553
|
let totalShown = 0;
|
|
1536
1554
|
let pageCount = 0;
|
|
1537
1555
|
console.log(
|
|
1538
|
-
|
|
1556
|
+
chalk3.blue(`\u{1F4CB} ${getListTitleFromMethod(sdkMethodName, functionInfo)}
|
|
1539
1557
|
`)
|
|
1540
1558
|
);
|
|
1541
1559
|
try {
|
|
@@ -1543,11 +1561,11 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1543
1561
|
const items = page.data || page;
|
|
1544
1562
|
pageCount++;
|
|
1545
1563
|
if (!Array.isArray(items)) {
|
|
1546
|
-
console.log(
|
|
1564
|
+
console.log(chalk3.yellow(`No ${itemName} found.`));
|
|
1547
1565
|
return;
|
|
1548
1566
|
}
|
|
1549
1567
|
if (items.length === 0 && pageCount === 1) {
|
|
1550
|
-
console.log(
|
|
1568
|
+
console.log(chalk3.yellow(`No ${itemName} found.`));
|
|
1551
1569
|
return;
|
|
1552
1570
|
}
|
|
1553
1571
|
if (items.length === 0) {
|
|
@@ -1556,7 +1574,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1556
1574
|
if (pageCount > 1) {
|
|
1557
1575
|
console.clear();
|
|
1558
1576
|
console.log(
|
|
1559
|
-
|
|
1577
|
+
chalk3.blue(
|
|
1560
1578
|
`\u{1F4CB} ${getListTitleFromMethod(sdkMethodName, functionInfo)}
|
|
1561
1579
|
`
|
|
1562
1580
|
)
|
|
@@ -1573,7 +1591,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1573
1591
|
}
|
|
1574
1592
|
totalShown += items.length;
|
|
1575
1593
|
console.log(
|
|
1576
|
-
|
|
1594
|
+
chalk3.green(
|
|
1577
1595
|
`
|
|
1578
1596
|
\u2705 Showing ${totalShown} ${itemName} (page ${pageCount})`
|
|
1579
1597
|
)
|
|
@@ -1594,13 +1612,13 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1594
1612
|
break;
|
|
1595
1613
|
}
|
|
1596
1614
|
}
|
|
1597
|
-
console.log(
|
|
1615
|
+
console.log(chalk3.gray(`
|
|
1598
1616
|
\u{1F4C4} Finished browsing ${itemName}`));
|
|
1599
1617
|
} catch (error) {
|
|
1600
1618
|
const items = sdkResult?.data || sdkResult;
|
|
1601
1619
|
if (Array.isArray(items)) {
|
|
1602
1620
|
if (items.length === 0) {
|
|
1603
|
-
console.log(
|
|
1621
|
+
console.log(chalk3.yellow(`No ${itemName} found.`));
|
|
1604
1622
|
return;
|
|
1605
1623
|
}
|
|
1606
1624
|
if (functionInfo && functionInfo.inputSchema) {
|
|
@@ -1612,7 +1630,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
|
|
|
1612
1630
|
} else {
|
|
1613
1631
|
formatItemsGeneric2(items, 0);
|
|
1614
1632
|
}
|
|
1615
|
-
console.log(
|
|
1633
|
+
console.log(chalk3.green(`
|
|
1616
1634
|
\u2705 Showing ${items.length} ${itemName}`));
|
|
1617
1635
|
} else {
|
|
1618
1636
|
throw error;
|
|
@@ -1634,10 +1652,10 @@ function formatNonPaginatedResults(result, requestedMaxItems, userSpecifiedMaxIt
|
|
|
1634
1652
|
}
|
|
1635
1653
|
const itemName = functionInfo ? getItemNameFromMethod(functionInfo) : "items";
|
|
1636
1654
|
if (result.length === 0) {
|
|
1637
|
-
console.log(
|
|
1655
|
+
console.log(chalk3.yellow(`No ${itemName} found.`));
|
|
1638
1656
|
return;
|
|
1639
1657
|
}
|
|
1640
|
-
console.log(
|
|
1658
|
+
console.log(chalk3.green(`
|
|
1641
1659
|
\u2705 Found ${result.length} ${itemName}:
|
|
1642
1660
|
`));
|
|
1643
1661
|
if (functionInfo && functionInfo.inputSchema) {
|
|
@@ -1650,13 +1668,13 @@ function formatNonPaginatedResults(result, requestedMaxItems, userSpecifiedMaxIt
|
|
|
1650
1668
|
}
|
|
1651
1669
|
if (userSpecifiedMaxItems && requestedMaxItems) {
|
|
1652
1670
|
console.log(
|
|
1653
|
-
|
|
1671
|
+
chalk3.gray(
|
|
1654
1672
|
`
|
|
1655
1673
|
\u{1F4C4} Showing up to ${requestedMaxItems} ${itemName} (--max-items ${requestedMaxItems})`
|
|
1656
1674
|
)
|
|
1657
1675
|
);
|
|
1658
1676
|
} else {
|
|
1659
|
-
console.log(
|
|
1677
|
+
console.log(chalk3.gray(`
|
|
1660
1678
|
\u{1F4C4} All available ${itemName} shown`));
|
|
1661
1679
|
}
|
|
1662
1680
|
}
|
|
@@ -1665,10 +1683,10 @@ function formatItemsGeneric2(items, startingNumber = 0) {
|
|
|
1665
1683
|
const itemObj = item;
|
|
1666
1684
|
const name = itemObj?.name || itemObj?.key || itemObj?.id || "Item";
|
|
1667
1685
|
console.log(
|
|
1668
|
-
`${
|
|
1686
|
+
`${chalk3.gray(`${startingNumber + index + 1}.`)} ${chalk3.cyan(String(name))}`
|
|
1669
1687
|
);
|
|
1670
1688
|
if (itemObj?.description) {
|
|
1671
|
-
console.log(` ${
|
|
1689
|
+
console.log(` ${chalk3.dim(String(itemObj.description))}`);
|
|
1672
1690
|
}
|
|
1673
1691
|
console.log();
|
|
1674
1692
|
});
|
|
@@ -1704,20 +1722,20 @@ var spinPromise = async (promise, text) => {
|
|
|
1704
1722
|
};
|
|
1705
1723
|
var log = {
|
|
1706
1724
|
info: (message, ...args) => {
|
|
1707
|
-
console.log(
|
|
1725
|
+
console.log(chalk3.blue("\u2139"), message, ...args);
|
|
1708
1726
|
},
|
|
1709
1727
|
error: (message, ...args) => {
|
|
1710
|
-
console.error(
|
|
1728
|
+
console.error(chalk3.red("\u2716"), message, ...args);
|
|
1711
1729
|
},
|
|
1712
1730
|
success: (message, ...args) => {
|
|
1713
|
-
console.log(
|
|
1731
|
+
console.log(chalk3.green("\u2713"), message, ...args);
|
|
1714
1732
|
},
|
|
1715
1733
|
warn: (message, ...args) => {
|
|
1716
|
-
console.log(
|
|
1734
|
+
console.log(chalk3.yellow("\u26A0"), message, ...args);
|
|
1717
1735
|
},
|
|
1718
1736
|
debug: (message, ...args) => {
|
|
1719
1737
|
if (process.env.DEBUG === "true" || process.argv.includes("--debug")) {
|
|
1720
|
-
console.log(
|
|
1738
|
+
console.log(chalk3.gray("\u{1F41B}"), message, ...args);
|
|
1721
1739
|
}
|
|
1722
1740
|
}
|
|
1723
1741
|
};
|
|
@@ -3625,7 +3643,10 @@ var cliOverridesPlugin = ({ context }) => {
|
|
|
3625
3643
|
meta: {
|
|
3626
3644
|
fetch: {
|
|
3627
3645
|
...context.meta.fetch,
|
|
3628
|
-
categories: [...context.meta.fetch.categories || [], "deprecated"]
|
|
3646
|
+
categories: [...context.meta.fetch.categories || [], "deprecated"],
|
|
3647
|
+
deprecation: {
|
|
3648
|
+
message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
|
|
3649
|
+
}
|
|
3629
3650
|
}
|
|
3630
3651
|
}
|
|
3631
3652
|
}
|
|
@@ -3779,7 +3800,7 @@ function buildTemplateVariables({
|
|
|
3779
3800
|
};
|
|
3780
3801
|
}
|
|
3781
3802
|
function cleanupProject({ projectDir }) {
|
|
3782
|
-
console.log("\n" +
|
|
3803
|
+
console.log("\n" + chalk3.yellow("!") + " Cleaning up...");
|
|
3783
3804
|
rmSync(projectDir, { recursive: true, force: true });
|
|
3784
3805
|
}
|
|
3785
3806
|
async function withInterruptCleanup(cleanup, fn) {
|
|
@@ -3989,8 +4010,8 @@ function buildNextSteps({
|
|
|
3989
4010
|
}
|
|
3990
4011
|
function createConsoleDisplayHooks() {
|
|
3991
4012
|
return {
|
|
3992
|
-
onItemComplete: (message) => console.log(" " +
|
|
3993
|
-
onWarn: (message) => console.warn(
|
|
4013
|
+
onItemComplete: (message) => console.log(" " + chalk3.green("\u2713") + " " + chalk3.dim(message)),
|
|
4014
|
+
onWarn: (message) => console.warn(chalk3.yellow("!") + " " + message),
|
|
3994
4015
|
onStepStart: ({
|
|
3995
4016
|
description,
|
|
3996
4017
|
stepNumber,
|
|
@@ -3999,31 +4020,31 @@ function createConsoleDisplayHooks() {
|
|
|
3999
4020
|
skipPrompts
|
|
4000
4021
|
}) => {
|
|
4001
4022
|
const progressMessage = `${description}...`;
|
|
4002
|
-
const stepCounter =
|
|
4023
|
+
const stepCounter = chalk3.dim(`${stepNumber}/${totalSteps}`);
|
|
4003
4024
|
if (skipPrompts) {
|
|
4004
4025
|
console.log(
|
|
4005
|
-
"\n" +
|
|
4026
|
+
"\n" + chalk3.bold(`\u276F ${progressMessage}`) + " " + stepCounter + "\n"
|
|
4006
4027
|
);
|
|
4007
4028
|
} else {
|
|
4008
4029
|
console.log(
|
|
4009
|
-
|
|
4030
|
+
chalk3.dim("\u2192") + " " + progressMessage + " " + stepCounter
|
|
4010
4031
|
);
|
|
4011
4032
|
}
|
|
4012
4033
|
if (command) {
|
|
4013
|
-
console.log(" " +
|
|
4034
|
+
console.log(" " + chalk3.cyan(`$ ${command}`));
|
|
4014
4035
|
}
|
|
4015
4036
|
},
|
|
4016
4037
|
onStepSuccess: ({ stepNumber, totalSteps }) => console.log(
|
|
4017
|
-
"\n" +
|
|
4038
|
+
"\n" + chalk3.green("\u2713") + " " + chalk3.dim(`Step ${stepNumber}/${totalSteps} complete`) + "\n"
|
|
4018
4039
|
),
|
|
4019
4040
|
onStepError: ({ description, command, err }) => {
|
|
4020
4041
|
const detail = err instanceof Error && err.message ? `
|
|
4021
|
-
${
|
|
4042
|
+
${chalk3.dim(err.message)}` : "";
|
|
4022
4043
|
const hint = command ? `
|
|
4023
|
-
${
|
|
4044
|
+
${chalk3.dim("run manually:")} ${chalk3.cyan(`$ ${command}`)}` : "";
|
|
4024
4045
|
console.error(
|
|
4025
4046
|
`
|
|
4026
|
-
${
|
|
4047
|
+
${chalk3.red("\u2716")} ${chalk3.bold(description)}${chalk3.dim(" failed")}${detail}${hint}`
|
|
4027
4048
|
);
|
|
4028
4049
|
}
|
|
4029
4050
|
};
|
|
@@ -4035,22 +4056,22 @@ function displaySummaryAndNextSteps({
|
|
|
4035
4056
|
packageManager
|
|
4036
4057
|
}) {
|
|
4037
4058
|
const formatStatus = (complete) => ({
|
|
4038
|
-
icon: complete ?
|
|
4039
|
-
text: complete ?
|
|
4059
|
+
icon: complete ? chalk3.green("\u2713") : chalk3.yellow("!"),
|
|
4060
|
+
text: complete ? chalk3.green("Setup complete") : chalk3.yellow("Setup interrupted")
|
|
4040
4061
|
});
|
|
4041
|
-
const formatNextStep = (step, i) => " " +
|
|
4042
|
-
const formatCommand = (cmd) => " " +
|
|
4043
|
-
const formatCompletedStep = (step) => " " +
|
|
4062
|
+
const formatNextStep = (step, i) => " " + chalk3.dim(`${i + 1}.`) + " " + chalk3.bold(step.description);
|
|
4063
|
+
const formatCommand = (cmd) => " " + chalk3.cyan(`$ ${cmd}`);
|
|
4064
|
+
const formatCompletedStep = (step) => " " + chalk3.green("\u2713") + " " + step.description;
|
|
4044
4065
|
const { execCmd } = getPackageManagerCommands({ packageManager });
|
|
4045
4066
|
const leftoverSteps = steps.filter(
|
|
4046
4067
|
(s) => !completedSetupStepIds.includes(s.id)
|
|
4047
4068
|
);
|
|
4048
4069
|
const isComplete = leftoverSteps.length === 0;
|
|
4049
4070
|
const status = formatStatus(isComplete);
|
|
4050
|
-
console.log("\n" +
|
|
4051
|
-
console.log(" " +
|
|
4071
|
+
console.log("\n" + chalk3.bold("\u276F Summary") + "\n");
|
|
4072
|
+
console.log(" " + chalk3.dim("Project") + " " + chalk3.bold(projectName));
|
|
4052
4073
|
console.log(
|
|
4053
|
-
" " +
|
|
4074
|
+
" " + chalk3.dim("Status") + " " + status.icon + " " + status.text
|
|
4054
4075
|
);
|
|
4055
4076
|
const completedSteps = steps.filter(
|
|
4056
4077
|
(s) => completedSetupStepIds.includes(s.id)
|
|
@@ -4060,7 +4081,7 @@ function displaySummaryAndNextSteps({
|
|
|
4060
4081
|
for (const step of completedSteps) console.log(formatCompletedStep(step));
|
|
4061
4082
|
}
|
|
4062
4083
|
const nextSteps = buildNextSteps({ projectName, leftoverSteps, execCmd });
|
|
4063
|
-
console.log("\n" +
|
|
4084
|
+
console.log("\n" + chalk3.bold("\u276F Next Steps") + "\n");
|
|
4064
4085
|
nextSteps.forEach((step, i) => {
|
|
4065
4086
|
console.log(formatNextStep(step, i));
|
|
4066
4087
|
if (step.command) console.log(formatCommand(step.command));
|
|
@@ -4141,7 +4162,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4141
4162
|
// package.json with { type: 'json' }
|
|
4142
4163
|
var package_default2 = {
|
|
4143
4164
|
name: "@zapier/zapier-sdk-cli",
|
|
4144
|
-
version: "0.34.
|
|
4165
|
+
version: "0.34.10"};
|
|
4145
4166
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4146
4167
|
var CACHE_RESET_INTERVAL_MS = (() => {
|
|
4147
4168
|
const { ZAPIER_SDK_UPDATE_CHECK_INTERVAL_MS = `${ONE_DAY_MS}` } = process.env;
|
|
@@ -4251,26 +4272,26 @@ function displayUpdateNotification(versionInfo, packageName) {
|
|
|
4251
4272
|
if (versionInfo.isDeprecated) {
|
|
4252
4273
|
console.error();
|
|
4253
4274
|
console.error(
|
|
4254
|
-
|
|
4275
|
+
chalk3.red.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk3.red(
|
|
4255
4276
|
` - ${packageName} v${versionInfo.currentVersion} is deprecated.`
|
|
4256
4277
|
)
|
|
4257
4278
|
);
|
|
4258
4279
|
if (versionInfo.deprecationMessage) {
|
|
4259
|
-
console.error(
|
|
4280
|
+
console.error(chalk3.red(` ${versionInfo.deprecationMessage}`));
|
|
4260
4281
|
}
|
|
4261
|
-
console.error(
|
|
4282
|
+
console.error(chalk3.red(` Please update to the latest version.`));
|
|
4262
4283
|
console.error();
|
|
4263
4284
|
}
|
|
4264
4285
|
if (versionInfo.hasUpdate) {
|
|
4265
4286
|
console.error();
|
|
4266
4287
|
console.error(
|
|
4267
|
-
|
|
4288
|
+
chalk3.yellow.bold("\u{1F4E6} Update available!") + chalk3.yellow(
|
|
4268
4289
|
` ${packageName} v${versionInfo.currentVersion} \u2192 v${versionInfo.latestVersion}`
|
|
4269
4290
|
)
|
|
4270
4291
|
);
|
|
4271
4292
|
console.error(
|
|
4272
|
-
|
|
4273
|
-
` Run ${
|
|
4293
|
+
chalk3.yellow(
|
|
4294
|
+
` Run ${chalk3.bold(getUpdateCommand(packageName))} to update.`
|
|
4274
4295
|
)
|
|
4275
4296
|
);
|
|
4276
4297
|
console.error();
|
package/dist/index.cjs
CHANGED
|
@@ -2016,7 +2016,10 @@ var cliOverridesPlugin = ({ context }) => {
|
|
|
2016
2016
|
meta: {
|
|
2017
2017
|
fetch: {
|
|
2018
2018
|
...context.meta.fetch,
|
|
2019
|
-
categories: [...context.meta.fetch.categories || [], "deprecated"]
|
|
2019
|
+
categories: [...context.meta.fetch.categories || [], "deprecated"],
|
|
2020
|
+
deprecation: {
|
|
2021
|
+
message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
|
|
2022
|
+
}
|
|
2020
2023
|
}
|
|
2021
2024
|
}
|
|
2022
2025
|
}
|
|
@@ -2504,7 +2507,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
2504
2507
|
|
|
2505
2508
|
// package.json
|
|
2506
2509
|
var package_default = {
|
|
2507
|
-
version: "0.34.
|
|
2510
|
+
version: "0.34.10"};
|
|
2508
2511
|
|
|
2509
2512
|
// src/telemetry/builders.ts
|
|
2510
2513
|
function createCliBaseEvent(context = {}) {
|
package/dist/index.mjs
CHANGED
|
@@ -1983,7 +1983,10 @@ var cliOverridesPlugin = ({ context }) => {
|
|
|
1983
1983
|
meta: {
|
|
1984
1984
|
fetch: {
|
|
1985
1985
|
...context.meta.fetch,
|
|
1986
|
-
categories: [...context.meta.fetch.categories || [], "deprecated"]
|
|
1986
|
+
categories: [...context.meta.fetch.categories || [], "deprecated"],
|
|
1987
|
+
deprecation: {
|
|
1988
|
+
message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
|
|
1989
|
+
}
|
|
1987
1990
|
}
|
|
1988
1991
|
}
|
|
1989
1992
|
}
|
|
@@ -2471,7 +2474,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
2471
2474
|
|
|
2472
2475
|
// package.json
|
|
2473
2476
|
var package_default = {
|
|
2474
|
-
version: "0.34.
|
|
2477
|
+
version: "0.34.10"};
|
|
2475
2478
|
|
|
2476
2479
|
// src/telemetry/builders.ts
|
|
2477
2480
|
function createCliBaseEvent(context = {}) {
|