@zapier/zapier-sdk-cli 0.34.9 → 0.34.11

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/dist/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command, CommanderError } from 'commander';
3
3
  import { z } from 'zod';
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';
4
+ import { createFunction, OutputPropertySchema, DEFAULT_CONFIG_PATH, injectCliLogin, createZapierSdkWithoutRegistry, registryPlugin, ZapierError, ZapierValidationError, ZapierUnknownError, batch, toSnakeCase, buildApplicationLifecycleEvent, formatErrorMessage, isCredentialsObject, isPositional, runWithTelemetryContext, getOsInfo, getPlatformVersions, getCiPlatform, isCi, getReleaseId, getCurrentTimestamp, generateEventId } from '@zapier/zapier-sdk';
5
5
  import inquirer from 'inquirer';
6
- import chalk6 from 'chalk';
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';
@@ -82,139 +82,105 @@ function getLocalResolutionOrderForParams(paramNames, resolvers) {
82
82
  }
83
83
  var SchemaParameterResolver = class {
84
84
  async resolveParameters(schema, providedParams, sdk2, functionName) {
85
- const parseResult = schema.safeParse(providedParams);
86
- const allParams = this.extractParametersFromSchema(schema);
87
- const resolvableParams = allParams.filter(
88
- (param) => this.hasResolver(param.name, sdk2, functionName)
89
- );
90
- const missingResolvable = resolvableParams.filter((param) => {
91
- const hasValue = this.getNestedValue(providedParams, param.path) !== void 0;
92
- return !hasValue;
93
- });
94
- const functionallyRequired = missingResolvable.filter((param) => {
95
- if (param.isRequired) return true;
96
- if (param.name === "inputs") {
97
- return true;
98
- }
99
- return false;
100
- });
101
- const alwaysPrompt = missingResolvable.filter((param) => {
102
- if (functionallyRequired.includes(param)) return false;
103
- if (param.name === "connectionId") {
104
- return true;
105
- }
106
- return false;
107
- });
108
- const trulyOptional = missingResolvable.filter(
109
- (param) => !functionallyRequired.includes(param) && !alwaysPrompt.includes(param)
110
- );
111
- if (parseResult.success && functionallyRequired.length === 0 && alwaysPrompt.length === 0) {
112
- return parseResult.data;
113
- }
114
- if (functionallyRequired.length === 0 && alwaysPrompt.length === 0) {
115
- if (!parseResult.success) {
116
- throw parseResult.error;
117
- }
118
- return parseResult.data;
119
- }
120
- const resolvedParams = { ...providedParams };
121
- const context = {
122
- sdk: sdk2,
123
- currentParams: providedParams,
124
- resolvedParams,
125
- functionName
126
- };
127
- const localResolvers = this.getLocalResolvers(sdk2, functionName);
128
- if (functionallyRequired.length > 0) {
129
- const requiredParamNames = functionallyRequired.map((p) => p.name);
130
- const requiredResolutionOrder = getLocalResolutionOrderForParams(
131
- requiredParamNames,
132
- localResolvers
85
+ return runWithTelemetryContext(async () => {
86
+ const parseResult = schema.safeParse(providedParams);
87
+ const allParams = this.extractParametersFromSchema(schema);
88
+ const resolvableParams = allParams.filter(
89
+ (param) => this.hasResolver(param.name, sdk2, functionName)
133
90
  );
134
- const orderedRequiredParams = requiredResolutionOrder.map((paramName) => {
135
- let param = functionallyRequired.find((p) => p.name === paramName);
136
- if (!param) {
137
- param = alwaysPrompt.find((p) => p.name === paramName);
91
+ const missingResolvable = resolvableParams.filter((param) => {
92
+ const hasValue = this.getNestedValue(providedParams, param.path) !== void 0;
93
+ return !hasValue;
94
+ });
95
+ const functionallyRequired = missingResolvable.filter((param) => {
96
+ if (param.isRequired) return true;
97
+ if (param.name === "inputs") {
98
+ return true;
138
99
  }
139
- if (!param) {
140
- param = trulyOptional.find((p) => p.name === paramName);
100
+ return false;
101
+ });
102
+ const alwaysPrompt = missingResolvable.filter((param) => {
103
+ if (functionallyRequired.includes(param)) return false;
104
+ if (param.name === "connectionId") {
105
+ return true;
141
106
  }
142
- return param;
143
- }).filter((param) => param !== void 0);
144
- for (const param of orderedRequiredParams) {
145
- try {
146
- const value = await this.resolveParameter(
147
- param,
148
- context,
149
- functionName
150
- );
151
- this.setNestedValue(resolvedParams, param.path, value);
152
- context.resolvedParams = resolvedParams;
153
- } catch (error) {
154
- if (this.isUserCancellation(error)) {
155
- console.log(chalk6.yellow("\n\nOperation cancelled by user"));
156
- throw new ZapierCliUserCancellationError();
157
- }
158
- throw error;
107
+ return false;
108
+ });
109
+ const trulyOptional = missingResolvable.filter(
110
+ (param) => !functionallyRequired.includes(param) && !alwaysPrompt.includes(param)
111
+ );
112
+ if (parseResult.success && functionallyRequired.length === 0 && alwaysPrompt.length === 0) {
113
+ return parseResult.data;
114
+ }
115
+ if (functionallyRequired.length === 0 && alwaysPrompt.length === 0) {
116
+ if (!parseResult.success) {
117
+ throw parseResult.error;
159
118
  }
119
+ return parseResult.data;
160
120
  }
161
- const resolvedParamNames = new Set(
162
- orderedRequiredParams.map((p) => p.name)
163
- );
164
- alwaysPrompt.splice(
165
- 0,
166
- alwaysPrompt.length,
167
- ...alwaysPrompt.filter((p) => !resolvedParamNames.has(p.name))
168
- );
169
- trulyOptional.splice(
170
- 0,
171
- trulyOptional.length,
172
- ...trulyOptional.filter((p) => !resolvedParamNames.has(p.name))
173
- );
174
- }
175
- if (alwaysPrompt.length > 0) {
176
- const alwaysPromptNames = alwaysPrompt.map((p) => p.name);
177
- const alwaysPromptResolutionOrder = getLocalResolutionOrderForParams(
178
- alwaysPromptNames,
179
- localResolvers
180
- );
181
- const orderedAlwaysPromptParams = alwaysPromptResolutionOrder.map((paramName) => alwaysPrompt.find((p) => p.name === paramName)).filter((param) => param !== void 0);
182
- for (const param of orderedAlwaysPromptParams) {
183
- try {
184
- const value = await this.resolveParameter(
185
- param,
186
- context,
187
- functionName
188
- );
189
- this.setNestedValue(resolvedParams, param.path, value);
190
- context.resolvedParams = resolvedParams;
191
- } catch (error) {
192
- if (this.isUserCancellation(error)) {
193
- console.log(chalk6.yellow("\n\nOperation cancelled by user"));
194
- throw new ZapierCliUserCancellationError();
121
+ const resolvedParams = { ...providedParams };
122
+ const context = {
123
+ sdk: sdk2,
124
+ currentParams: providedParams,
125
+ resolvedParams,
126
+ functionName
127
+ };
128
+ const localResolvers = this.getLocalResolvers(sdk2, functionName);
129
+ if (functionallyRequired.length > 0) {
130
+ const requiredParamNames = functionallyRequired.map((p) => p.name);
131
+ const requiredResolutionOrder = getLocalResolutionOrderForParams(
132
+ requiredParamNames,
133
+ localResolvers
134
+ );
135
+ const orderedRequiredParams = requiredResolutionOrder.map((paramName) => {
136
+ let param = functionallyRequired.find((p) => p.name === paramName);
137
+ if (!param) {
138
+ param = alwaysPrompt.find((p) => p.name === paramName);
139
+ }
140
+ if (!param) {
141
+ param = trulyOptional.find((p) => p.name === paramName);
142
+ }
143
+ return param;
144
+ }).filter((param) => param !== void 0);
145
+ for (const param of orderedRequiredParams) {
146
+ try {
147
+ const value = await this.resolveParameter(
148
+ param,
149
+ context,
150
+ functionName
151
+ );
152
+ this.setNestedValue(resolvedParams, param.path, value);
153
+ context.resolvedParams = resolvedParams;
154
+ } catch (error) {
155
+ if (this.isUserCancellation(error)) {
156
+ console.log(chalk3.yellow("\n\nOperation cancelled by user"));
157
+ throw new ZapierCliUserCancellationError();
158
+ }
159
+ throw error;
195
160
  }
196
- throw error;
197
161
  }
162
+ const resolvedParamNames = new Set(
163
+ orderedRequiredParams.map((p) => p.name)
164
+ );
165
+ alwaysPrompt.splice(
166
+ 0,
167
+ alwaysPrompt.length,
168
+ ...alwaysPrompt.filter((p) => !resolvedParamNames.has(p.name))
169
+ );
170
+ trulyOptional.splice(
171
+ 0,
172
+ trulyOptional.length,
173
+ ...trulyOptional.filter((p) => !resolvedParamNames.has(p.name))
174
+ );
198
175
  }
199
- }
200
- if (trulyOptional.length > 0) {
201
- const optionalNames = trulyOptional.map((p) => p.name).join(", ");
202
- const shouldResolveOptional = await inquirer.prompt([
203
- {
204
- type: "confirm",
205
- name: "resolveOptional",
206
- message: `Would you like to be prompted for optional parameters (${optionalNames})?`,
207
- default: false
208
- }
209
- ]);
210
- if (shouldResolveOptional.resolveOptional) {
211
- const optionalParamNames = trulyOptional.map((p) => p.name);
212
- const optionalResolutionOrder = getLocalResolutionOrderForParams(
213
- optionalParamNames,
176
+ if (alwaysPrompt.length > 0) {
177
+ const alwaysPromptNames = alwaysPrompt.map((p) => p.name);
178
+ const alwaysPromptResolutionOrder = getLocalResolutionOrderForParams(
179
+ alwaysPromptNames,
214
180
  localResolvers
215
181
  );
216
- const orderedOptionalParams = optionalResolutionOrder.map((paramName) => trulyOptional.find((p) => p.name === paramName)).filter((param) => param !== void 0);
217
- for (const param of orderedOptionalParams) {
182
+ const orderedAlwaysPromptParams = alwaysPromptResolutionOrder.map((paramName) => alwaysPrompt.find((p) => p.name === paramName)).filter((param) => param !== void 0);
183
+ for (const param of orderedAlwaysPromptParams) {
218
184
  try {
219
185
  const value = await this.resolveParameter(
220
186
  param,
@@ -225,22 +191,60 @@ var SchemaParameterResolver = class {
225
191
  context.resolvedParams = resolvedParams;
226
192
  } catch (error) {
227
193
  if (this.isUserCancellation(error)) {
228
- console.log(chalk6.yellow("\n\nOperation cancelled by user"));
194
+ console.log(chalk3.yellow("\n\nOperation cancelled by user"));
229
195
  throw new ZapierCliUserCancellationError();
230
196
  }
231
197
  throw error;
232
198
  }
233
199
  }
234
200
  }
235
- }
236
- const finalResult = schema.safeParse(resolvedParams);
237
- if (!finalResult.success) {
238
- console.error(
239
- chalk6.red("\u274C Parameter validation failed after resolution:")
240
- );
241
- throw finalResult.error;
242
- }
243
- return finalResult.data;
201
+ if (trulyOptional.length > 0) {
202
+ const optionalNames = trulyOptional.map((p) => p.name).join(", ");
203
+ const shouldResolveOptional = await inquirer.prompt([
204
+ {
205
+ type: "confirm",
206
+ name: "resolveOptional",
207
+ message: `Would you like to be prompted for optional parameters (${optionalNames})?`,
208
+ default: false
209
+ }
210
+ ]);
211
+ if (shouldResolveOptional.resolveOptional) {
212
+ const optionalParamNames = trulyOptional.map((p) => p.name);
213
+ const optionalResolutionOrder = getLocalResolutionOrderForParams(
214
+ optionalParamNames,
215
+ localResolvers
216
+ );
217
+ const orderedOptionalParams = optionalResolutionOrder.map((paramName) => trulyOptional.find((p) => p.name === paramName)).filter(
218
+ (param) => param !== void 0
219
+ );
220
+ for (const param of orderedOptionalParams) {
221
+ try {
222
+ const value = await this.resolveParameter(
223
+ param,
224
+ context,
225
+ functionName
226
+ );
227
+ this.setNestedValue(resolvedParams, param.path, value);
228
+ context.resolvedParams = resolvedParams;
229
+ } catch (error) {
230
+ if (this.isUserCancellation(error)) {
231
+ console.log(chalk3.yellow("\n\nOperation cancelled by user"));
232
+ throw new ZapierCliUserCancellationError();
233
+ }
234
+ throw error;
235
+ }
236
+ }
237
+ }
238
+ }
239
+ const finalResult = schema.safeParse(resolvedParams);
240
+ if (!finalResult.success) {
241
+ console.error(
242
+ chalk3.red("\u274C Parameter validation failed after resolution:")
243
+ );
244
+ throw finalResult.error;
245
+ }
246
+ return finalResult.data;
247
+ });
244
248
  }
245
249
  extractParametersFromSchema(schema) {
246
250
  const parameters = [];
@@ -288,7 +292,7 @@ var SchemaParameterResolver = class {
288
292
  if (!resolver) {
289
293
  throw new Error(`No resolver found for parameter: ${param.name}`);
290
294
  }
291
- console.log(chalk6.blue(`
295
+ console.log(chalk3.blue(`
292
296
  \u{1F50D} Resolving ${param.name}...`));
293
297
  if (resolver.type === "static") {
294
298
  const staticResolver = resolver;
@@ -317,7 +321,7 @@ var SchemaParameterResolver = class {
317
321
  }
318
322
  }
319
323
  if (param.isRequired && param.name !== "connectionId") {
320
- console.log(chalk6.gray(`Fetching options for ${param.name}...`));
324
+ console.log(chalk3.gray(`Fetching options for ${param.name}...`));
321
325
  }
322
326
  const items = await dynamicResolver.fetch(
323
327
  context.sdk,
@@ -354,7 +358,7 @@ var SchemaParameterResolver = class {
354
358
  }
355
359
  };
356
360
  console.log(
357
- chalk6.gray(
361
+ chalk3.gray(
358
362
  `Fetching input fields for ${param.name}${iteration > 1 ? ` (iteration ${iteration})` : ""}...`
359
363
  )
360
364
  );
@@ -365,7 +369,7 @@ var SchemaParameterResolver = class {
365
369
  if (!rootFieldItems || rootFieldItems.length === 0) {
366
370
  if (iteration === 1) {
367
371
  console.log(
368
- chalk6.yellow(`No input fields required for this action.`)
372
+ chalk3.yellow(`No input fields required for this action.`)
369
373
  );
370
374
  }
371
375
  break;
@@ -387,7 +391,7 @@ var SchemaParameterResolver = class {
387
391
  }
388
392
  if (iteration >= maxIterations) {
389
393
  console.log(
390
- chalk6.yellow(
394
+ chalk3.yellow(
391
395
  `
392
396
  \u26A0\uFE0F Maximum field resolution iterations reached. Some dynamic fields may not have been discovered.`
393
397
  )
@@ -409,7 +413,7 @@ var SchemaParameterResolver = class {
409
413
  const fieldsetTitle = typedItem.title || typedItem.key;
410
414
  const pathDisplay = fieldsetPath.length > 0 ? ` (in ${fieldsetPath.join(" > ")})` : "";
411
415
  console.log(
412
- chalk6.cyan(
416
+ chalk3.cyan(
413
417
  `
414
418
  \u{1F4C1} Processing fieldset: ${fieldsetTitle}${pathDisplay}`
415
419
  )
@@ -441,7 +445,7 @@ var SchemaParameterResolver = class {
441
445
  newRequiredCount++;
442
446
  if (newRequiredCount === 1 && fieldsetPath.length === 0) {
443
447
  console.log(
444
- chalk6.blue(
448
+ chalk3.blue(
445
449
  `
446
450
  \u{1F4DD} Please provide values for the following ${iteration === 1 ? "" : "additional "}input fields:`
447
451
  )
@@ -462,7 +466,7 @@ var SchemaParameterResolver = class {
462
466
  if (optionalFields.length > 0) {
463
467
  const pathContext = fieldsetPath.length > 0 ? ` in ${fieldsetPath.join(" > ")}` : "";
464
468
  console.log(
465
- chalk6.gray(
469
+ chalk3.gray(
466
470
  `
467
471
  There are ${optionalFields.length} ${iteration === 1 ? "" : "additional "}optional field(s) available${pathContext}.`
468
472
  )
@@ -477,7 +481,7 @@ There are ${optionalFields.length} ${iteration === 1 ? "" : "additional "}option
477
481
  }
478
482
  ]);
479
483
  if (shouldConfigureOptional.configure) {
480
- console.log(chalk6.cyan(`
484
+ console.log(chalk3.cyan(`
481
485
  Optional fields${pathContext}:`));
482
486
  for (const field of optionalFields) {
483
487
  await this.promptForField(field, targetInputs, context);
@@ -493,7 +497,7 @@ Optional fields${pathContext}:`));
493
497
  }
494
498
  } catch (error) {
495
499
  if (this.isUserCancellation(error)) {
496
- console.log(chalk6.yellow("\n\nOperation cancelled by user"));
500
+ console.log(chalk3.yellow("\n\nOperation cancelled by user"));
497
501
  throw new ZapierCliUserCancellationError();
498
502
  }
499
503
  throw error;
@@ -548,7 +552,7 @@ Optional fields${pathContext}:`));
548
552
  async fetchChoices(fieldMeta, inputs, context, cursor) {
549
553
  try {
550
554
  console.log(
551
- chalk6.gray(
555
+ chalk3.gray(
552
556
  cursor ? ` Fetching more choices...` : ` Fetching choices for ${fieldMeta.title}...`
553
557
  )
554
558
  );
@@ -567,7 +571,7 @@ Optional fields${pathContext}:`));
567
571
  }));
568
572
  if (choices.length === 0 && !cursor) {
569
573
  console.log(
570
- chalk6.yellow(` No choices available for ${fieldMeta.title}`)
574
+ chalk3.yellow(` No choices available for ${fieldMeta.title}`)
571
575
  );
572
576
  }
573
577
  return {
@@ -576,7 +580,7 @@ Optional fields${pathContext}:`));
576
580
  };
577
581
  } catch (error) {
578
582
  console.warn(
579
- chalk6.yellow(` \u26A0\uFE0F Failed to fetch choices for ${fieldMeta.title}:`),
583
+ chalk3.yellow(` \u26A0\uFE0F Failed to fetch choices for ${fieldMeta.title}:`),
580
584
  error
581
585
  );
582
586
  return { choices: [] };
@@ -602,7 +606,7 @@ Optional fields${pathContext}:`));
602
606
  }));
603
607
  if (nextCursor) {
604
608
  promptChoices.push({
605
- name: chalk6.dim("(Load more...)"),
609
+ name: chalk3.dim("(Load more...)"),
606
610
  value: LOAD_MORE_SENTINEL
607
611
  });
608
612
  }
@@ -665,7 +669,7 @@ Optional fields${pathContext}:`));
665
669
  };
666
670
  }
667
671
  if (fieldMeta.description) {
668
- promptConfig.prefix = chalk6.gray(`\u2139 ${fieldMeta.description}
672
+ promptConfig.prefix = chalk3.gray(`\u2139 ${fieldMeta.description}
669
673
  `);
670
674
  }
671
675
  try {
@@ -673,7 +677,7 @@ Optional fields${pathContext}:`));
673
677
  return answer[fieldMeta.key];
674
678
  } catch (error) {
675
679
  if (this.isUserCancellation(error)) {
676
- console.log(chalk6.yellow("\n\nOperation cancelled by user"));
680
+ console.log(chalk3.yellow("\n\nOperation cancelled by user"));
677
681
  throw new ZapierCliUserCancellationError();
678
682
  }
679
683
  throw error;
@@ -691,7 +695,7 @@ Optional fields${pathContext}:`));
691
695
  }
692
696
  } catch (error) {
693
697
  if (this.isUserCancellation(error)) {
694
- console.log(chalk6.yellow("\n\nOperation cancelled by user"));
698
+ console.log(chalk3.yellow("\n\nOperation cancelled by user"));
695
699
  throw new ZapierCliUserCancellationError();
696
700
  }
697
701
  throw error;
@@ -795,7 +799,7 @@ function formatItemsFromSchema(functionInfo, items, startingNumber = 0) {
795
799
  });
796
800
  }
797
801
  function formatSingleItem(formatted, itemNumber) {
798
- let titleLine = `${chalk6.gray(`${itemNumber + 1}.`)} ${chalk6.cyan(formatted.title)}`;
802
+ let titleLine = `${chalk3.gray(`${itemNumber + 1}.`)} ${chalk3.cyan(formatted.title)}`;
799
803
  const subtitleParts = [];
800
804
  if (formatted.keys) {
801
805
  subtitleParts.push(...formatted.keys);
@@ -807,11 +811,11 @@ function formatSingleItem(formatted, itemNumber) {
807
811
  }
808
812
  const uniqueParts = [...new Set(subtitleParts)];
809
813
  if (uniqueParts.length > 0) {
810
- titleLine += ` ${chalk6.gray(`(${uniqueParts.join(", ")})`)}`;
814
+ titleLine += ` ${chalk3.gray(`(${uniqueParts.join(", ")})`)}`;
811
815
  }
812
816
  console.log(titleLine);
813
817
  if (formatted.description) {
814
- console.log(` ${chalk6.dim(formatted.description)}`);
818
+ console.log(` ${chalk3.dim(formatted.description)}`);
815
819
  }
816
820
  if (formatted.data !== void 0) {
817
821
  formatJsonOutput(formatted.data);
@@ -827,16 +831,16 @@ function formatSingleItem(formatted, itemNumber) {
827
831
  function applyStyle(value, style) {
828
832
  switch (style) {
829
833
  case "dim":
830
- return chalk6.dim(value);
834
+ return chalk3.dim(value);
831
835
  case "accent":
832
- return chalk6.magenta(value);
836
+ return chalk3.magenta(value);
833
837
  case "warning":
834
- return chalk6.red(value);
838
+ return chalk3.red(value);
835
839
  case "success":
836
- return chalk6.green(value);
840
+ return chalk3.green(value);
837
841
  case "normal":
838
842
  default:
839
- return chalk6.blue(value);
843
+ return chalk3.blue(value);
840
844
  }
841
845
  }
842
846
  function convertGenericItemToFormattedItem(item) {
@@ -886,7 +890,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
886
890
 
887
891
  // package.json
888
892
  var package_default = {
889
- version: "0.34.9"};
893
+ version: "0.34.11"};
890
894
 
891
895
  // src/telemetry/builders.ts
892
896
  function createCliBaseEvent(context = {}) {
@@ -987,7 +991,7 @@ async function promptConfirm(confirmType) {
987
991
  return { confirmed: true };
988
992
  }
989
993
  const { messageBefore, messageAfter } = CONFIRM_MESSAGES[confirmType];
990
- console.log(chalk6.yellow(`
994
+ console.log(chalk3.yellow(`
991
995
  ${messageBefore}
992
996
  `));
993
997
  const { confirmed } = await inquirer.prompt([
@@ -1000,6 +1004,20 @@ ${messageBefore}
1000
1004
  ]);
1001
1005
  return { confirmed, messageAfter };
1002
1006
  }
1007
+ function emitDeprecationWarning({
1008
+ cliCommandName,
1009
+ deprecation
1010
+ }) {
1011
+ if (!deprecation) {
1012
+ return;
1013
+ }
1014
+ console.warn();
1015
+ console.warn(
1016
+ chalk3.yellow.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk3.yellow(` - \`${cliCommandName}\` is deprecated.`)
1017
+ );
1018
+ console.warn(chalk3.yellow(` ${deprecation.message}`));
1019
+ console.warn();
1020
+ }
1003
1021
  function analyzeZodSchema(schema, functionInfo) {
1004
1022
  const parameters = [];
1005
1023
  const schemaDef = schema._zod?.def;
@@ -1234,6 +1252,10 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
1234
1252
  try {
1235
1253
  const commandObj = args[args.length - 1];
1236
1254
  const options = commandObj.opts();
1255
+ emitDeprecationWarning({
1256
+ cliCommandName,
1257
+ deprecation: functionInfo.deprecation
1258
+ });
1237
1259
  const isListCommand = functionInfo.type === "list";
1238
1260
  const hasPaginationParams = parameters.some(
1239
1261
  (p) => p.name === "maxItems" || p.name === "pageSize"
@@ -1261,7 +1283,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
1261
1283
  if (confirm && !shouldUseJson) {
1262
1284
  const confirmResult = await promptConfirm(confirm);
1263
1285
  if (!confirmResult.confirmed) {
1264
- console.log(chalk6.yellow("Operation cancelled."));
1286
+ console.log(chalk3.yellow("Operation cancelled."));
1265
1287
  return;
1266
1288
  }
1267
1289
  confirmMessageAfter = confirmResult.messageAfter;
@@ -1280,9 +1302,9 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
1280
1302
  const sdkObj = sdk2;
1281
1303
  await sdkObj[functionInfo.name](resolvedParams);
1282
1304
  console.log(
1283
- chalk6.green(`\u2705 ${cliCommandName} completed successfully!`)
1305
+ chalk3.green(`\u2705 ${cliCommandName} completed successfully!`)
1284
1306
  );
1285
- console.log(chalk6.gray(`Output written to: ${hasOutputFile}`));
1307
+ console.log(chalk3.gray(`Output written to: ${hasOutputFile}`));
1286
1308
  return;
1287
1309
  }
1288
1310
  let result;
@@ -1329,7 +1351,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk2) {
1329
1351
  formatJsonOutput(items);
1330
1352
  }
1331
1353
  if (confirmMessageAfter) {
1332
- console.log(chalk6.yellow(`
1354
+ console.log(chalk3.yellow(`
1333
1355
  ${confirmMessageAfter}`));
1334
1356
  }
1335
1357
  }
@@ -1339,23 +1361,23 @@ ${confirmMessageAfter}`));
1339
1361
  if (error instanceof Error && error.message.includes('"code"')) {
1340
1362
  try {
1341
1363
  const validationErrors = JSON.parse(error.message);
1342
- console.error(chalk6.red("\u274C Validation Error:"));
1364
+ console.error(chalk3.red("\u274C Validation Error:"));
1343
1365
  validationErrors.forEach((err) => {
1344
1366
  const errorObj = err;
1345
1367
  const field = errorObj?.path?.join(".") || "unknown";
1346
1368
  console.error(
1347
- chalk6.yellow(
1369
+ chalk3.yellow(
1348
1370
  ` \u2022 ${field}: ${errorObj?.message || "Unknown error"}`
1349
1371
  )
1350
1372
  );
1351
1373
  });
1352
1374
  console.error(
1353
- "\n" + chalk6.dim(`Use --help to see available options`)
1375
+ "\n" + chalk3.dim(`Use --help to see available options`)
1354
1376
  );
1355
1377
  throw new ZapierCliExitError("Validation failed", 1);
1356
1378
  } catch {
1357
1379
  console.error(
1358
- chalk6.red("Error:"),
1380
+ chalk3.red("Error:"),
1359
1381
  error instanceof Error ? error.message : String(error)
1360
1382
  );
1361
1383
  throw new ZapierCliExitError(
@@ -1367,11 +1389,11 @@ ${confirmMessageAfter}`));
1367
1389
  throw error;
1368
1390
  } else if (error instanceof ZapierError) {
1369
1391
  const formattedMessage = formatErrorMessage(error);
1370
- console.error(chalk6.red("\u274C Error:"), formattedMessage);
1392
+ console.error(chalk3.red("\u274C Error:"), formattedMessage);
1371
1393
  throw new ZapierCliExitError(formattedMessage, 1);
1372
1394
  } else {
1373
1395
  const msg = error instanceof Error ? error.message : "Unknown error";
1374
- console.error(chalk6.red("\u274C Error:"), msg);
1396
+ console.error(chalk3.red("\u274C Error:"), msg);
1375
1397
  throw new ZapierCliExitError(msg, 1);
1376
1398
  }
1377
1399
  } finally {
@@ -1535,7 +1557,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
1535
1557
  let totalShown = 0;
1536
1558
  let pageCount = 0;
1537
1559
  console.log(
1538
- chalk6.blue(`\u{1F4CB} ${getListTitleFromMethod(sdkMethodName, functionInfo)}
1560
+ chalk3.blue(`\u{1F4CB} ${getListTitleFromMethod(sdkMethodName, functionInfo)}
1539
1561
  `)
1540
1562
  );
1541
1563
  try {
@@ -1543,11 +1565,11 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
1543
1565
  const items = page.data || page;
1544
1566
  pageCount++;
1545
1567
  if (!Array.isArray(items)) {
1546
- console.log(chalk6.yellow(`No ${itemName} found.`));
1568
+ console.log(chalk3.yellow(`No ${itemName} found.`));
1547
1569
  return;
1548
1570
  }
1549
1571
  if (items.length === 0 && pageCount === 1) {
1550
- console.log(chalk6.yellow(`No ${itemName} found.`));
1572
+ console.log(chalk3.yellow(`No ${itemName} found.`));
1551
1573
  return;
1552
1574
  }
1553
1575
  if (items.length === 0) {
@@ -1556,7 +1578,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
1556
1578
  if (pageCount > 1) {
1557
1579
  console.clear();
1558
1580
  console.log(
1559
- chalk6.blue(
1581
+ chalk3.blue(
1560
1582
  `\u{1F4CB} ${getListTitleFromMethod(sdkMethodName, functionInfo)}
1561
1583
  `
1562
1584
  )
@@ -1573,7 +1595,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
1573
1595
  }
1574
1596
  totalShown += items.length;
1575
1597
  console.log(
1576
- chalk6.green(
1598
+ chalk3.green(
1577
1599
  `
1578
1600
  \u2705 Showing ${totalShown} ${itemName} (page ${pageCount})`
1579
1601
  )
@@ -1594,13 +1616,13 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
1594
1616
  break;
1595
1617
  }
1596
1618
  }
1597
- console.log(chalk6.gray(`
1619
+ console.log(chalk3.gray(`
1598
1620
  \u{1F4C4} Finished browsing ${itemName}`));
1599
1621
  } catch (error) {
1600
1622
  const items = sdkResult?.data || sdkResult;
1601
1623
  if (Array.isArray(items)) {
1602
1624
  if (items.length === 0) {
1603
- console.log(chalk6.yellow(`No ${itemName} found.`));
1625
+ console.log(chalk3.yellow(`No ${itemName} found.`));
1604
1626
  return;
1605
1627
  }
1606
1628
  if (functionInfo && functionInfo.inputSchema) {
@@ -1612,7 +1634,7 @@ async function handlePaginatedListWithAsyncIteration(sdkMethodName, sdkResult, f
1612
1634
  } else {
1613
1635
  formatItemsGeneric2(items, 0);
1614
1636
  }
1615
- console.log(chalk6.green(`
1637
+ console.log(chalk3.green(`
1616
1638
  \u2705 Showing ${items.length} ${itemName}`));
1617
1639
  } else {
1618
1640
  throw error;
@@ -1634,10 +1656,10 @@ function formatNonPaginatedResults(result, requestedMaxItems, userSpecifiedMaxIt
1634
1656
  }
1635
1657
  const itemName = functionInfo ? getItemNameFromMethod(functionInfo) : "items";
1636
1658
  if (result.length === 0) {
1637
- console.log(chalk6.yellow(`No ${itemName} found.`));
1659
+ console.log(chalk3.yellow(`No ${itemName} found.`));
1638
1660
  return;
1639
1661
  }
1640
- console.log(chalk6.green(`
1662
+ console.log(chalk3.green(`
1641
1663
  \u2705 Found ${result.length} ${itemName}:
1642
1664
  `));
1643
1665
  if (functionInfo && functionInfo.inputSchema) {
@@ -1650,13 +1672,13 @@ function formatNonPaginatedResults(result, requestedMaxItems, userSpecifiedMaxIt
1650
1672
  }
1651
1673
  if (userSpecifiedMaxItems && requestedMaxItems) {
1652
1674
  console.log(
1653
- chalk6.gray(
1675
+ chalk3.gray(
1654
1676
  `
1655
1677
  \u{1F4C4} Showing up to ${requestedMaxItems} ${itemName} (--max-items ${requestedMaxItems})`
1656
1678
  )
1657
1679
  );
1658
1680
  } else {
1659
- console.log(chalk6.gray(`
1681
+ console.log(chalk3.gray(`
1660
1682
  \u{1F4C4} All available ${itemName} shown`));
1661
1683
  }
1662
1684
  }
@@ -1665,10 +1687,10 @@ function formatItemsGeneric2(items, startingNumber = 0) {
1665
1687
  const itemObj = item;
1666
1688
  const name = itemObj?.name || itemObj?.key || itemObj?.id || "Item";
1667
1689
  console.log(
1668
- `${chalk6.gray(`${startingNumber + index + 1}.`)} ${chalk6.cyan(String(name))}`
1690
+ `${chalk3.gray(`${startingNumber + index + 1}.`)} ${chalk3.cyan(String(name))}`
1669
1691
  );
1670
1692
  if (itemObj?.description) {
1671
- console.log(` ${chalk6.dim(String(itemObj.description))}`);
1693
+ console.log(` ${chalk3.dim(String(itemObj.description))}`);
1672
1694
  }
1673
1695
  console.log();
1674
1696
  });
@@ -1704,20 +1726,20 @@ var spinPromise = async (promise, text) => {
1704
1726
  };
1705
1727
  var log = {
1706
1728
  info: (message, ...args) => {
1707
- console.log(chalk6.blue("\u2139"), message, ...args);
1729
+ console.log(chalk3.blue("\u2139"), message, ...args);
1708
1730
  },
1709
1731
  error: (message, ...args) => {
1710
- console.error(chalk6.red("\u2716"), message, ...args);
1732
+ console.error(chalk3.red("\u2716"), message, ...args);
1711
1733
  },
1712
1734
  success: (message, ...args) => {
1713
- console.log(chalk6.green("\u2713"), message, ...args);
1735
+ console.log(chalk3.green("\u2713"), message, ...args);
1714
1736
  },
1715
1737
  warn: (message, ...args) => {
1716
- console.log(chalk6.yellow("\u26A0"), message, ...args);
1738
+ console.log(chalk3.yellow("\u26A0"), message, ...args);
1717
1739
  },
1718
1740
  debug: (message, ...args) => {
1719
1741
  if (process.env.DEBUG === "true" || process.argv.includes("--debug")) {
1720
- console.log(chalk6.gray("\u{1F41B}"), message, ...args);
1742
+ console.log(chalk3.gray("\u{1F41B}"), message, ...args);
1721
1743
  }
1722
1744
  }
1723
1745
  };
@@ -3625,7 +3647,10 @@ var cliOverridesPlugin = ({ context }) => {
3625
3647
  meta: {
3626
3648
  fetch: {
3627
3649
  ...context.meta.fetch,
3628
- categories: [...context.meta.fetch.categories || [], "deprecated"]
3650
+ categories: [...context.meta.fetch.categories || [], "deprecated"],
3651
+ deprecation: {
3652
+ message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
3653
+ }
3629
3654
  }
3630
3655
  }
3631
3656
  }
@@ -3779,7 +3804,7 @@ function buildTemplateVariables({
3779
3804
  };
3780
3805
  }
3781
3806
  function cleanupProject({ projectDir }) {
3782
- console.log("\n" + chalk6.yellow("!") + " Cleaning up...");
3807
+ console.log("\n" + chalk3.yellow("!") + " Cleaning up...");
3783
3808
  rmSync(projectDir, { recursive: true, force: true });
3784
3809
  }
3785
3810
  async function withInterruptCleanup(cleanup, fn) {
@@ -3989,8 +4014,8 @@ function buildNextSteps({
3989
4014
  }
3990
4015
  function createConsoleDisplayHooks() {
3991
4016
  return {
3992
- onItemComplete: (message) => console.log(" " + chalk6.green("\u2713") + " " + chalk6.dim(message)),
3993
- onWarn: (message) => console.warn(chalk6.yellow("!") + " " + message),
4017
+ onItemComplete: (message) => console.log(" " + chalk3.green("\u2713") + " " + chalk3.dim(message)),
4018
+ onWarn: (message) => console.warn(chalk3.yellow("!") + " " + message),
3994
4019
  onStepStart: ({
3995
4020
  description,
3996
4021
  stepNumber,
@@ -3999,31 +4024,31 @@ function createConsoleDisplayHooks() {
3999
4024
  skipPrompts
4000
4025
  }) => {
4001
4026
  const progressMessage = `${description}...`;
4002
- const stepCounter = chalk6.dim(`${stepNumber}/${totalSteps}`);
4027
+ const stepCounter = chalk3.dim(`${stepNumber}/${totalSteps}`);
4003
4028
  if (skipPrompts) {
4004
4029
  console.log(
4005
- "\n" + chalk6.bold(`\u276F ${progressMessage}`) + " " + stepCounter + "\n"
4030
+ "\n" + chalk3.bold(`\u276F ${progressMessage}`) + " " + stepCounter + "\n"
4006
4031
  );
4007
4032
  } else {
4008
4033
  console.log(
4009
- chalk6.dim("\u2192") + " " + progressMessage + " " + stepCounter
4034
+ chalk3.dim("\u2192") + " " + progressMessage + " " + stepCounter
4010
4035
  );
4011
4036
  }
4012
4037
  if (command) {
4013
- console.log(" " + chalk6.cyan(`$ ${command}`));
4038
+ console.log(" " + chalk3.cyan(`$ ${command}`));
4014
4039
  }
4015
4040
  },
4016
4041
  onStepSuccess: ({ stepNumber, totalSteps }) => console.log(
4017
- "\n" + chalk6.green("\u2713") + " " + chalk6.dim(`Step ${stepNumber}/${totalSteps} complete`) + "\n"
4042
+ "\n" + chalk3.green("\u2713") + " " + chalk3.dim(`Step ${stepNumber}/${totalSteps} complete`) + "\n"
4018
4043
  ),
4019
4044
  onStepError: ({ description, command, err }) => {
4020
4045
  const detail = err instanceof Error && err.message ? `
4021
- ${chalk6.dim(err.message)}` : "";
4046
+ ${chalk3.dim(err.message)}` : "";
4022
4047
  const hint = command ? `
4023
- ${chalk6.dim("run manually:")} ${chalk6.cyan(`$ ${command}`)}` : "";
4048
+ ${chalk3.dim("run manually:")} ${chalk3.cyan(`$ ${command}`)}` : "";
4024
4049
  console.error(
4025
4050
  `
4026
- ${chalk6.red("\u2716")} ${chalk6.bold(description)}${chalk6.dim(" failed")}${detail}${hint}`
4051
+ ${chalk3.red("\u2716")} ${chalk3.bold(description)}${chalk3.dim(" failed")}${detail}${hint}`
4027
4052
  );
4028
4053
  }
4029
4054
  };
@@ -4035,22 +4060,22 @@ function displaySummaryAndNextSteps({
4035
4060
  packageManager
4036
4061
  }) {
4037
4062
  const formatStatus = (complete) => ({
4038
- icon: complete ? chalk6.green("\u2713") : chalk6.yellow("!"),
4039
- text: complete ? chalk6.green("Setup complete") : chalk6.yellow("Setup interrupted")
4063
+ icon: complete ? chalk3.green("\u2713") : chalk3.yellow("!"),
4064
+ text: complete ? chalk3.green("Setup complete") : chalk3.yellow("Setup interrupted")
4040
4065
  });
4041
- const formatNextStep = (step, i) => " " + chalk6.dim(`${i + 1}.`) + " " + chalk6.bold(step.description);
4042
- const formatCommand = (cmd) => " " + chalk6.cyan(`$ ${cmd}`);
4043
- const formatCompletedStep = (step) => " " + chalk6.green("\u2713") + " " + step.description;
4066
+ const formatNextStep = (step, i) => " " + chalk3.dim(`${i + 1}.`) + " " + chalk3.bold(step.description);
4067
+ const formatCommand = (cmd) => " " + chalk3.cyan(`$ ${cmd}`);
4068
+ const formatCompletedStep = (step) => " " + chalk3.green("\u2713") + " " + step.description;
4044
4069
  const { execCmd } = getPackageManagerCommands({ packageManager });
4045
4070
  const leftoverSteps = steps.filter(
4046
4071
  (s) => !completedSetupStepIds.includes(s.id)
4047
4072
  );
4048
4073
  const isComplete = leftoverSteps.length === 0;
4049
4074
  const status = formatStatus(isComplete);
4050
- console.log("\n" + chalk6.bold("\u276F Summary") + "\n");
4051
- console.log(" " + chalk6.dim("Project") + " " + chalk6.bold(projectName));
4075
+ console.log("\n" + chalk3.bold("\u276F Summary") + "\n");
4076
+ console.log(" " + chalk3.dim("Project") + " " + chalk3.bold(projectName));
4052
4077
  console.log(
4053
- " " + chalk6.dim("Status") + " " + status.icon + " " + status.text
4078
+ " " + chalk3.dim("Status") + " " + status.icon + " " + status.text
4054
4079
  );
4055
4080
  const completedSteps = steps.filter(
4056
4081
  (s) => completedSetupStepIds.includes(s.id)
@@ -4060,7 +4085,7 @@ function displaySummaryAndNextSteps({
4060
4085
  for (const step of completedSteps) console.log(formatCompletedStep(step));
4061
4086
  }
4062
4087
  const nextSteps = buildNextSteps({ projectName, leftoverSteps, execCmd });
4063
- console.log("\n" + chalk6.bold("\u276F Next Steps") + "\n");
4088
+ console.log("\n" + chalk3.bold("\u276F Next Steps") + "\n");
4064
4089
  nextSteps.forEach((step, i) => {
4065
4090
  console.log(formatNextStep(step, i));
4066
4091
  if (step.command) console.log(formatCommand(step.command));
@@ -4141,7 +4166,7 @@ function createZapierCliSdk(options = {}) {
4141
4166
  // package.json with { type: 'json' }
4142
4167
  var package_default2 = {
4143
4168
  name: "@zapier/zapier-sdk-cli",
4144
- version: "0.34.9"};
4169
+ version: "0.34.11"};
4145
4170
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
4146
4171
  var CACHE_RESET_INTERVAL_MS = (() => {
4147
4172
  const { ZAPIER_SDK_UPDATE_CHECK_INTERVAL_MS = `${ONE_DAY_MS}` } = process.env;
@@ -4251,26 +4276,26 @@ function displayUpdateNotification(versionInfo, packageName) {
4251
4276
  if (versionInfo.isDeprecated) {
4252
4277
  console.error();
4253
4278
  console.error(
4254
- chalk6.red.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk6.red(
4279
+ chalk3.red.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk3.red(
4255
4280
  ` - ${packageName} v${versionInfo.currentVersion} is deprecated.`
4256
4281
  )
4257
4282
  );
4258
4283
  if (versionInfo.deprecationMessage) {
4259
- console.error(chalk6.red(` ${versionInfo.deprecationMessage}`));
4284
+ console.error(chalk3.red(` ${versionInfo.deprecationMessage}`));
4260
4285
  }
4261
- console.error(chalk6.red(` Please update to the latest version.`));
4286
+ console.error(chalk3.red(` Please update to the latest version.`));
4262
4287
  console.error();
4263
4288
  }
4264
4289
  if (versionInfo.hasUpdate) {
4265
4290
  console.error();
4266
4291
  console.error(
4267
- chalk6.yellow.bold("\u{1F4E6} Update available!") + chalk6.yellow(
4292
+ chalk3.yellow.bold("\u{1F4E6} Update available!") + chalk3.yellow(
4268
4293
  ` ${packageName} v${versionInfo.currentVersion} \u2192 v${versionInfo.latestVersion}`
4269
4294
  )
4270
4295
  );
4271
4296
  console.error(
4272
- chalk6.yellow(
4273
- ` Run ${chalk6.bold(getUpdateCommand(packageName))} to update.`
4297
+ chalk3.yellow(
4298
+ ` Run ${chalk3.bold(getUpdateCommand(packageName))} to update.`
4274
4299
  )
4275
4300
  );
4276
4301
  console.error();