zapier-platform-cli 15.18.1 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/oclif.manifest.json +2316 -1
  2. package/package.json +43 -33
  3. package/scaffold/create.template.ts +64 -0
  4. package/scaffold/resource.template.ts +119 -0
  5. package/scaffold/search.template.ts +63 -0
  6. package/scaffold/test.template.ts +18 -0
  7. package/scaffold/trigger.template.ts +58 -0
  8. package/src/bin/run +4 -4
  9. package/src/bin/run.cmd +0 -3
  10. package/src/generators/index.js +11 -11
  11. package/src/index.js +1 -1
  12. package/src/oclif/ZapierBaseCommand.js +51 -44
  13. package/src/oclif/buildFlags.js +14 -16
  14. package/src/oclif/commands/analytics.js +6 -6
  15. package/src/oclif/commands/build.js +6 -6
  16. package/src/oclif/commands/cache/clear.js +13 -13
  17. package/src/oclif/commands/canary/create.js +27 -20
  18. package/src/oclif/commands/canary/delete.js +26 -16
  19. package/src/oclif/commands/canary/list.js +5 -7
  20. package/src/oclif/commands/convert.js +16 -16
  21. package/src/oclif/commands/delete/version.js +6 -6
  22. package/src/oclif/commands/deprecate.js +10 -11
  23. package/src/oclif/commands/describe.js +5 -5
  24. package/src/oclif/commands/env/get.js +5 -5
  25. package/src/oclif/commands/env/set.js +11 -12
  26. package/src/oclif/commands/env/unset.js +9 -10
  27. package/src/oclif/commands/init.js +12 -13
  28. package/src/oclif/commands/invoke.js +67 -69
  29. package/src/oclif/commands/jobs.js +1 -1
  30. package/src/oclif/commands/link.js +2 -2
  31. package/src/oclif/commands/login.js +15 -15
  32. package/src/oclif/commands/logout.js +1 -1
  33. package/src/oclif/commands/logs.js +9 -9
  34. package/src/oclif/commands/migrate.js +19 -22
  35. package/src/oclif/commands/promote.js +25 -27
  36. package/src/oclif/commands/push.js +2 -2
  37. package/src/oclif/commands/register.js +31 -32
  38. package/src/oclif/commands/scaffold.js +112 -106
  39. package/src/oclif/commands/team/add.js +12 -15
  40. package/src/oclif/commands/team/get.js +2 -2
  41. package/src/oclif/commands/team/remove.js +6 -6
  42. package/src/oclif/commands/test.js +8 -8
  43. package/src/oclif/commands/upload.js +1 -1
  44. package/src/oclif/commands/users/add.js +9 -11
  45. package/src/oclif/commands/users/get.js +7 -7
  46. package/src/oclif/commands/users/links.js +4 -4
  47. package/src/oclif/commands/users/remove.js +8 -9
  48. package/src/oclif/commands/validate.js +29 -21
  49. package/src/oclif/commands/versions.js +26 -1
  50. package/src/oclif/hooks/checkValidNodeVersion.js +1 -1
  51. package/src/oclif/hooks/deprecated.js +1 -1
  52. package/src/oclif/hooks/getAppRegistrationFieldChoices.js +4 -4
  53. package/src/oclif/hooks/renderMarkdownHelp.js +1 -2
  54. package/src/oclif/hooks/versionInfo.js +2 -2
  55. package/src/utils/analytics.js +4 -4
  56. package/src/utils/api.js +26 -29
  57. package/src/utils/ast.js +112 -11
  58. package/src/utils/auth-files-codegen.js +102 -99
  59. package/src/utils/build.js +27 -28
  60. package/src/utils/changelog.js +1 -1
  61. package/src/utils/check-missing-app-info.js +2 -2
  62. package/src/utils/convert.js +26 -20
  63. package/src/utils/credentials.js +1 -1
  64. package/src/utils/display.js +31 -8
  65. package/src/utils/files.js +3 -3
  66. package/src/utils/ignore.js +2 -2
  67. package/src/utils/local.js +1 -1
  68. package/src/utils/metadata.js +1 -1
  69. package/src/utils/misc.js +21 -22
  70. package/src/utils/promisify.js +1 -1
  71. package/src/utils/scaffold.js +293 -40
  72. package/src/utils/team.js +3 -3
  73. package/src/utils/xdg.js +3 -3
@@ -3,7 +3,7 @@ const fs = require('node:fs/promises');
3
3
  const http = require('node:http');
4
4
 
5
5
  const _ = require('lodash');
6
- const { flags } = require('@oclif/command');
6
+ const { Args, Flags } = require('@oclif/core');
7
7
  const debug = require('debug')('zapier:invoke');
8
8
  const dotenv = require('dotenv');
9
9
 
@@ -68,7 +68,7 @@ const readStream = async (stream) => {
68
68
 
69
69
  const getMissingRequiredInputFields = (inputData, inputFields) => {
70
70
  return inputFields.filter(
71
- (f) => f.required && !f.default && !inputData[f.key]
71
+ (f) => f.required && !f.default && !inputData[f.key],
72
72
  );
73
73
  };
74
74
 
@@ -145,7 +145,7 @@ const parseTimestamp = (dtString, tzName) => {
145
145
  }
146
146
 
147
147
  return DateTime.fromMillis(timestamp, { zone: tzName }).toFormat(
148
- "yyyy-MM-dd'T'HH:mm:ssZZ"
148
+ "yyyy-MM-dd'T'HH:mm:ssZZ",
149
149
  );
150
150
  };
151
151
 
@@ -179,7 +179,7 @@ const parseDatetime = (dtString, tzName, now) => {
179
179
  }
180
180
 
181
181
  return DateTime.fromISO(isoString, { zone: tzName }).toFormat(
182
- "yyyy-MM-dd'T'HH:mm:ssZZ"
182
+ "yyyy-MM-dd'T'HH:mm:ssZZ",
183
183
  );
184
184
  };
185
185
 
@@ -231,7 +231,7 @@ const appendEnv = async (vars, prefix = '') => {
231
231
  '.env',
232
232
  Object.entries(vars)
233
233
  .filter(([k, v]) => v !== undefined)
234
- .map(([k, v]) => `${prefix}${k}='${v || ''}'\n`)
234
+ .map(([k, v]) => `${prefix}${k}='${v || ''}'\n`),
235
235
  );
236
236
  };
237
237
 
@@ -351,7 +351,7 @@ class InvokeCommand extends BaseCommand {
351
351
  async startBasicAuth(authFields) {
352
352
  if (this.nonInteractive) {
353
353
  throw new Error(
354
- 'The `auth start` subcommand for "basic" authentication type only works in interactive mode.'
354
+ 'The `auth start` subcommand for "basic" authentication type only works in interactive mode.',
355
355
  );
356
356
  }
357
357
  return this.promptForAuthFields([
@@ -371,7 +371,7 @@ class InvokeCommand extends BaseCommand {
371
371
  async startCustomAuth(authFields, zcacheTestObj) {
372
372
  if (this.nonInteractive) {
373
373
  throw new Error(
374
- 'The `auth start` subcommand for "custom" authentication type only works in interactive mode.'
374
+ 'The `auth start` subcommand for "custom" authentication type only works in interactive mode.',
375
375
  );
376
376
  }
377
377
  return this.promptForAuthFields(authFields);
@@ -385,12 +385,12 @@ class InvokeCommand extends BaseCommand {
385
385
  if (!process.env.CLIENT_ID || !process.env.CLIENT_SECRET) {
386
386
  if (this.nonInteractive) {
387
387
  throw new Error(
388
- 'CLIENT_ID and CLIENT_SECRET must be set in the .env file in non-interactive mode.'
388
+ 'CLIENT_ID and CLIENT_SECRET must be set in the .env file in non-interactive mode.',
389
389
  );
390
390
  } else {
391
391
  console.warn(
392
392
  'CLIENT_ID and CLIENT_SECRET are required for OAuth2, ' +
393
- "but they are not found in the .env file. I'll prompt you for them now."
393
+ "but they are not found in the .env file. I'll prompt you for them now.",
394
394
  );
395
395
  }
396
396
  }
@@ -458,14 +458,14 @@ class InvokeCommand extends BaseCommand {
458
458
 
459
459
  res.writeHead(200, { 'Content-Type': 'text/plain' });
460
460
  res.end(
461
- 'Parameter `code` received successfully. Go back to the terminal to continue.'
461
+ 'Parameter `code` received successfully. Go back to the terminal to continue.',
462
462
  );
463
463
  } else {
464
464
  res.writeHead(400, { 'Content-Type': 'text/plain' });
465
465
  res.end(
466
466
  'Error: Did not receive `code` query parameter. ' +
467
467
  'Did you have the right CLIENT_ID and CLIENT_SECRET? ' +
468
- 'Or did your server respond properly?'
468
+ 'Or did your server respond properly?',
469
469
  );
470
470
  }
471
471
  });
@@ -476,7 +476,7 @@ class InvokeCommand extends BaseCommand {
476
476
 
477
477
  endSpinner();
478
478
  startSpinner(
479
- 'Opening browser to authorize (press Ctrl-C to exit on error)'
479
+ 'Opening browser to authorize (press Ctrl-C to exit on error)',
480
480
  );
481
481
 
482
482
  const { default: open } = await import('open');
@@ -515,11 +515,11 @@ class InvokeCommand extends BaseCommand {
515
515
  async startSessionAuth(appDefinition, zcacheTestObj) {
516
516
  if (this.nonInteractive) {
517
517
  throw new Error(
518
- 'The `auth start` subcommand for "session" authentication type only works in interactive mode.'
518
+ 'The `auth start` subcommand for "session" authentication type only works in interactive mode.',
519
519
  );
520
520
  }
521
521
  const authData = await this.promptForAuthFields(
522
- appDefinition.authentication.fields
522
+ appDefinition.authentication.fields,
523
523
  );
524
524
 
525
525
  startSpinner('Invoking authentication.sessionConfig.perform');
@@ -544,7 +544,7 @@ class InvokeCommand extends BaseCommand {
544
544
  console.warn(
545
545
  "Your integration doesn't seem to need authentication. " +
546
546
  "If that isn't true, the app definition should have " +
547
- 'an `authentication` object at the root level.'
547
+ 'an `authentication` object at the root level.',
548
548
  );
549
549
  return null;
550
550
  }
@@ -560,7 +560,7 @@ class InvokeCommand extends BaseCommand {
560
560
  default:
561
561
  // TODO: Add support for 'digest' and 'oauth1'
562
562
  throw new Error(
563
- `This command doesn't support authentication type "${authentication.type}".`
563
+ `This command doesn't support authentication type "${authentication.type}".`,
564
564
  );
565
565
  }
566
566
  }
@@ -607,13 +607,13 @@ class InvokeCommand extends BaseCommand {
607
607
  console.warn(
608
608
  "Your integration doesn't seem to need authentication. " +
609
609
  "If that isn't true, the app definition should have " +
610
- 'an `authentication` object at the root level.'
610
+ 'an `authentication` object at the root level.',
611
611
  );
612
612
  return null;
613
613
  }
614
614
  if (_.isEmpty(authData)) {
615
615
  throw new Error(
616
- 'No auth data found in the .env file. Run `zapier invoke auth start` first to initialize the auth data.'
616
+ 'No auth data found in the .env file. Run `zapier invoke auth start` first to initialize the auth data.',
617
617
  );
618
618
  }
619
619
  switch (authentication.type) {
@@ -623,7 +623,7 @@ class InvokeCommand extends BaseCommand {
623
623
  return this.refreshSessionAuth(appDefinition, authData, zcacheTestObj);
624
624
  default:
625
625
  throw new Error(
626
- `This command doesn't support refreshing authentication type "${authentication.type}".`
626
+ `This command doesn't support refreshing authentication type "${authentication.type}".`,
627
627
  );
628
628
  }
629
629
  }
@@ -635,7 +635,7 @@ class InvokeCommand extends BaseCommand {
635
635
  authData,
636
636
  timezone,
637
637
  zcacheTestObj,
638
- cursorTestObj
638
+ cursorTestObj,
639
639
  ) {
640
640
  const message = formatFieldDisplay(field) + ':';
641
641
  if (field.dynamic) {
@@ -659,7 +659,7 @@ class InvokeCommand extends BaseCommand {
659
659
  meta,
660
660
  timezone,
661
661
  zcacheTestObj,
662
- cursorTestObj
662
+ cursorTestObj,
663
663
  );
664
664
  return this.promptWithList(
665
665
  message,
@@ -671,7 +671,7 @@ class InvokeCommand extends BaseCommand {
671
671
  value: id,
672
672
  };
673
673
  }),
674
- { useStderr: true }
674
+ { useStderr: true },
675
675
  );
676
676
  } else if (field.type === 'boolean') {
677
677
  const yes = await this.confirm(message, false, !field.required, true);
@@ -689,14 +689,14 @@ class InvokeCommand extends BaseCommand {
689
689
  meta,
690
690
  timezone,
691
691
  zcacheTestObj,
692
- cursorTestObj
692
+ cursorTestObj,
693
693
  ) {
694
694
  const missingFields = getMissingRequiredInputFields(inputData, inputFields);
695
695
  if (missingFields.length) {
696
696
  if (this.nonInteractive || meta.isFillingDynamicDropdown) {
697
697
  throw new Error(
698
698
  "You're in non-interactive mode, so you must at least specify these required fields with --inputData: \n" +
699
- missingFields.map((f) => '* ' + formatFieldDisplay(f)).join('\n')
699
+ missingFields.map((f) => '* ' + formatFieldDisplay(f)).join('\n'),
700
700
  );
701
701
  }
702
702
  for (const f of missingFields) {
@@ -707,7 +707,7 @@ class InvokeCommand extends BaseCommand {
707
707
  authData,
708
708
  timezone,
709
709
  zcacheTestObj,
710
- cursorTestObj
710
+ cursorTestObj,
711
711
  );
712
712
  }
713
713
  }
@@ -720,7 +720,7 @@ class InvokeCommand extends BaseCommand {
720
720
  authData,
721
721
  timezone,
722
722
  zcacheTestObj,
723
- cursorTestObj
723
+ cursorTestObj,
724
724
  ) {
725
725
  inputFields = inputFields.filter((f) => f.key);
726
726
  if (!inputFields.length) {
@@ -757,7 +757,7 @@ class InvokeCommand extends BaseCommand {
757
757
  const fieldKey = await this.promptWithList(
758
758
  'Would you like to edit any of these input fields? Select "DONE" when you are all set.',
759
759
  fieldChoices,
760
- { useStderr: true }
760
+ { useStderr: true },
761
761
  );
762
762
  if (!fieldKey) {
763
763
  break;
@@ -771,7 +771,7 @@ class InvokeCommand extends BaseCommand {
771
771
  authData,
772
772
  timezone,
773
773
  zcacheTestObj,
774
- cursorTestObj
774
+ cursorTestObj,
775
775
  );
776
776
  }
777
777
  }
@@ -784,7 +784,7 @@ class InvokeCommand extends BaseCommand {
784
784
  meta,
785
785
  timezone,
786
786
  zcacheTestObj,
787
- cursorTestObj
787
+ cursorTestObj,
788
788
  ) {
789
789
  await this.promptOrErrorForRequiredInputFields(
790
790
  inputData,
@@ -794,7 +794,7 @@ class InvokeCommand extends BaseCommand {
794
794
  meta,
795
795
  timezone,
796
796
  zcacheTestObj,
797
- cursorTestObj
797
+ cursorTestObj,
798
798
  );
799
799
  if (!this.nonInteractive && !meta.isFillingDynamicDropdown) {
800
800
  await this.promptForInputFieldEdit(
@@ -804,7 +804,7 @@ class InvokeCommand extends BaseCommand {
804
804
  authData,
805
805
  timezone,
806
806
  zcacheTestObj,
807
- cursorTestObj
807
+ cursorTestObj,
808
808
  );
809
809
  }
810
810
  }
@@ -818,7 +818,7 @@ class InvokeCommand extends BaseCommand {
818
818
  meta,
819
819
  timezone,
820
820
  zcacheTestObj,
821
- cursorTestObj
821
+ cursorTestObj,
822
822
  ) {
823
823
  // Do these in order:
824
824
  // 1. Prompt for static input fields that alter dynamic fields
@@ -827,7 +827,7 @@ class InvokeCommand extends BaseCommand {
827
827
  // 4. {actionTypePlural}.{actionKey}.operation.perform
828
828
 
829
829
  const staticInputFields = (action.operation.inputFields || []).filter(
830
- (f) => f.key
830
+ (f) => f.key,
831
831
  );
832
832
  debug('staticInputFields:', staticInputFields);
833
833
 
@@ -839,7 +839,7 @@ class InvokeCommand extends BaseCommand {
839
839
  meta,
840
840
  timezone,
841
841
  zcacheTestObj,
842
- cursorTestObj
842
+ cursorTestObj,
843
843
  );
844
844
 
845
845
  let methodName = `${actionTypePlural}.${action.key}.operation.inputFields`;
@@ -871,7 +871,7 @@ class InvokeCommand extends BaseCommand {
871
871
  meta,
872
872
  timezone,
873
873
  zcacheTestObj,
874
- cursorTestObj
874
+ cursorTestObj,
875
875
  );
876
876
  }
877
877
 
@@ -902,7 +902,7 @@ class InvokeCommand extends BaseCommand {
902
902
  if (_.isEmpty(dotenvResult.parsed)) {
903
903
  console.warn(
904
904
  'The .env file does not exist or is empty. ' +
905
- 'You may need to set some environment variables in there if your code uses process.env.'
905
+ 'You may need to set some environment variables in there if your code uses process.env.',
906
906
  );
907
907
  }
908
908
 
@@ -913,13 +913,13 @@ class InvokeCommand extends BaseCommand {
913
913
  if (!actionType) {
914
914
  if (this.nonInteractive) {
915
915
  throw new Error(
916
- 'You must specify ACTIONTYPE and ACTIONKEY in non-interactive mode.'
916
+ 'You must specify ACTIONTYPE and ACTIONKEY in non-interactive mode.',
917
917
  );
918
918
  }
919
919
  actionType = await this.promptWithList(
920
920
  'Which action type would you like to invoke?',
921
921
  ACTION_TYPES,
922
- { useStderr: true }
922
+ { useStderr: true },
923
923
  );
924
924
  }
925
925
 
@@ -935,22 +935,22 @@ class InvokeCommand extends BaseCommand {
935
935
  actionKey = await this.promptWithList(
936
936
  'Which auth operation would you like to invoke?',
937
937
  actionKeys,
938
- { useStderr: true }
938
+ { useStderr: true },
939
939
  );
940
940
  } else {
941
941
  const actionKeys = Object.keys(
942
- appDefinition[actionTypePlural] || {}
942
+ appDefinition[actionTypePlural] || {},
943
943
  ).sort();
944
944
  if (!actionKeys.length) {
945
945
  throw new Error(
946
- `No "${actionTypePlural}" found in your integration.`
946
+ `No "${actionTypePlural}" found in your integration.`,
947
947
  );
948
948
  }
949
949
 
950
950
  actionKey = await this.promptWithList(
951
951
  `Which "${actionType}" key would you like to invoke?`,
952
952
  actionKeys,
953
- { useStderr: true }
953
+ { useStderr: true },
954
954
  );
955
955
  }
956
956
  }
@@ -972,14 +972,14 @@ class InvokeCommand extends BaseCommand {
972
972
  case 'start': {
973
973
  const newAuthData = await this.startAuth(
974
974
  appDefinition,
975
- zcacheTestObj
975
+ zcacheTestObj,
976
976
  );
977
977
  if (_.isEmpty(newAuthData)) {
978
978
  return;
979
979
  }
980
980
  await appendEnv(newAuthData, AUTH_FIELD_ENV_PREFIX);
981
981
  console.warn(
982
- 'Auth data appended to .env file. Run `zapier invoke auth test` to test it.'
982
+ 'Auth data appended to .env file. Run `zapier invoke auth test` to test it.',
983
983
  );
984
984
  return;
985
985
  }
@@ -987,14 +987,14 @@ class InvokeCommand extends BaseCommand {
987
987
  const newAuthData = await this.refreshAuth(
988
988
  appDefinition,
989
989
  authData,
990
- zcacheTestObj
990
+ zcacheTestObj,
991
991
  );
992
992
  if (_.isEmpty(newAuthData)) {
993
993
  return;
994
994
  }
995
995
  await appendEnv(newAuthData, AUTH_FIELD_ENV_PREFIX);
996
996
  console.warn(
997
- 'Auth data has been refreshed and appended to .env file. Run `zapier invoke auth test` to test it.'
997
+ 'Auth data has been refreshed and appended to .env file. Run `zapier invoke auth test` to test it.',
998
998
  );
999
999
  return;
1000
1000
  }
@@ -1007,7 +1007,7 @@ class InvokeCommand extends BaseCommand {
1007
1007
  const labelTemplate = appDefinition.authentication.connectionLabel;
1008
1008
  if (labelTemplate && labelTemplate.startsWith('$func$')) {
1009
1009
  console.warn(
1010
- 'Function-based connection label is not supported yet. Printing auth test result instead.'
1010
+ 'Function-based connection label is not supported yet. Printing auth test result instead.',
1011
1011
  );
1012
1012
  const output = await testAuth(authData, meta, zcacheTestObj);
1013
1013
  console.log(JSON.stringify(output, null, 2));
@@ -1016,7 +1016,7 @@ class InvokeCommand extends BaseCommand {
1016
1016
  labelTemplate,
1017
1017
  authData,
1018
1018
  meta,
1019
- zcacheTestObj
1019
+ zcacheTestObj,
1020
1020
  );
1021
1021
  if (output) {
1022
1022
  console.log(output);
@@ -1029,7 +1029,7 @@ class InvokeCommand extends BaseCommand {
1029
1029
  default:
1030
1030
  throw new Error(
1031
1031
  `Unknown auth operation "${actionKey}". ` +
1032
- 'The options are "label", "refresh", "start", and "test". \n'
1032
+ 'The options are "label", "refresh", "start", and "test". \n',
1033
1033
  );
1034
1034
  }
1035
1035
  } else {
@@ -1067,7 +1067,7 @@ class InvokeCommand extends BaseCommand {
1067
1067
  'All primitive values in --inputData must be strings. Found non-string values in these paths:\n' +
1068
1068
  nonStringPrimitives
1069
1069
  .map(({ path, value }) => `* ${value} at ${path}`)
1070
- .join('\n')
1070
+ .join('\n'),
1071
1071
  );
1072
1072
  }
1073
1073
 
@@ -1089,7 +1089,7 @@ class InvokeCommand extends BaseCommand {
1089
1089
  meta,
1090
1090
  timezone,
1091
1091
  zcacheTestObj,
1092
- cursorTestObj
1092
+ cursorTestObj,
1093
1093
  );
1094
1094
  console.log(JSON.stringify(output, null, 2));
1095
1095
  }
@@ -1098,53 +1098,53 @@ class InvokeCommand extends BaseCommand {
1098
1098
 
1099
1099
  InvokeCommand.flags = buildFlags({
1100
1100
  commandFlags: {
1101
- inputData: flags.string({
1101
+ inputData: Flags.string({
1102
1102
  char: 'i',
1103
1103
  description:
1104
1104
  'The input data to pass to the action. Must be a JSON-encoded object. The data can be passed from the command directly like \'{"key": "value"}\', read from a file like @file.json, or read from stdin like @-.',
1105
1105
  }),
1106
- isFillingDynamicDropdown: flags.boolean({
1106
+ isFillingDynamicDropdown: Flags.boolean({
1107
1107
  description:
1108
1108
  'Set bundle.meta.isFillingDynamicDropdown to true. Only makes sense for a polling trigger. When true in production, this poll is being used to populate a dynamic dropdown.',
1109
1109
  default: false,
1110
1110
  }),
1111
- isLoadingSample: flags.boolean({
1111
+ isLoadingSample: Flags.boolean({
1112
1112
  description:
1113
1113
  'Set bundle.meta.isLoadingSample to true. When true in production, this run is initiated by the user in the Zap editor trying to pull a sample.',
1114
1114
  default: false,
1115
1115
  }),
1116
- isPopulatingDedupe: flags.boolean({
1116
+ isPopulatingDedupe: Flags.boolean({
1117
1117
  description:
1118
1118
  'Set bundle.meta.isPopulatingDedupe to true. Only makes sense for a polling trigger. When true in production, the results of this poll will be used initialize the deduplication list rather than trigger a Zap. This happens when a user enables a Zap.',
1119
1119
  default: false,
1120
1120
  }),
1121
- limit: flags.integer({
1121
+ limit: Flags.integer({
1122
1122
  description:
1123
1123
  'Set bundle.meta.limit. Only makes sense for a trigger. When used in production, this indicates the number of items you should fetch. -1 means no limit.',
1124
1124
  default: -1,
1125
1125
  }),
1126
- page: flags.integer({
1126
+ page: Flags.integer({
1127
1127
  char: 'p',
1128
1128
  description:
1129
1129
  'Set bundle.meta.page. Only makes sense for a trigger. When used in production, this indicates which page of items you should fetch. First page is 0.',
1130
1130
  default: 0,
1131
1131
  }),
1132
- 'non-interactive': flags.boolean({
1132
+ 'non-interactive': Flags.boolean({
1133
1133
  description: 'Do not show interactive prompts.',
1134
1134
  default: false,
1135
1135
  }),
1136
- timezone: flags.string({
1136
+ timezone: Flags.string({
1137
1137
  char: 'z',
1138
1138
  description:
1139
1139
  'Set the default timezone for datetime field interpretation. If not set, defaults to America/Chicago, which matches Zapier production behavior. Find the list timezone names at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.',
1140
1140
  default: 'America/Chicago',
1141
1141
  }),
1142
- 'redirect-uri': flags.string({
1142
+ 'redirect-uri': Flags.string({
1143
1143
  description:
1144
1144
  "Only used by `auth start` subcommand. The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server's OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost.",
1145
1145
  default: 'http://localhost:9000',
1146
1146
  }),
1147
- 'local-port': flags.integer({
1147
+ 'local-port': Flags.integer({
1148
1148
  description:
1149
1149
  'Only used by `auth start` subcommand. The local port that will be used to start the local HTTP server to listen for the OAuth2 callback. This port can be different from the one in the redirect URI if you have port forwarding set up.',
1150
1150
  default: 9000,
@@ -1152,18 +1152,16 @@ InvokeCommand.flags = buildFlags({
1152
1152
  },
1153
1153
  });
1154
1154
 
1155
- InvokeCommand.args = [
1156
- {
1157
- name: 'actionType',
1155
+ InvokeCommand.args = {
1156
+ actionType: Args.string({
1158
1157
  description: 'The action type you want to invoke.',
1159
1158
  options: ACTION_TYPES,
1160
- },
1161
- {
1162
- name: 'actionKey',
1159
+ }),
1160
+ actionKey: Args.string({
1163
1161
  description:
1164
1162
  'The trigger/action key you want to invoke. If ACTIONTYPE is "auth", this can be "label", "refresh", "start", or "test".',
1165
- },
1166
- ];
1163
+ }),
1164
+ };
1167
1165
 
1168
1166
  InvokeCommand.examples = [
1169
1167
  'zapier invoke',
@@ -22,7 +22,7 @@ class JobsCommand extends BaseCommand {
22
22
  const jobs = chain(migrations)
23
23
  .filter(
24
24
  (migration) =>
25
- migration.job_kind === 'migrate' || migration.job_kind === 'promote'
25
+ migration.job_kind === 'migrate' || migration.job_kind === 'promote',
26
26
  )
27
27
  .map((migration) => {
28
28
  const job = {
@@ -29,9 +29,9 @@ class LinkCommand extends BaseCommand {
29
29
  short: app.title,
30
30
  value: { id: app.id, key: app.key },
31
31
  })),
32
- (app) => app.name.toLowerCase()
32
+ (app) => app.name.toLowerCase(),
33
33
  ),
34
- { pageSize: 15 }
34
+ { pageSize: 15 },
35
35
  );
36
36
 
37
37
  this.startSpinner(`Setting up ${CURRENT_APP_FILE}`);
@@ -2,7 +2,7 @@ const colors = require('colors/safe');
2
2
 
3
3
  const BaseCommand = require('../ZapierBaseCommand');
4
4
  const { buildFlags } = require('../buildFlags');
5
- const { flags } = require('@oclif/command');
5
+ const { Flags } = require('@oclif/core');
6
6
 
7
7
  const {
8
8
  AUTH_LOCATION,
@@ -49,7 +49,7 @@ const isValidDeployKey = (k) =>
49
49
  class LoginCommand extends BaseCommand {
50
50
  promptForDeployKey() {
51
51
  this.log(
52
- `To generate a deploy key, go to ${DEPLOY_KEY_DASH_URL} and create/copy a key, then paste the result below.`
52
+ `To generate a deploy key, go to ${DEPLOY_KEY_DASH_URL} and create/copy a key, then paste the result below.`,
53
53
  );
54
54
  return this.prompt('Paste your Deploy Key here:', {
55
55
  validate: isValidDeployKey,
@@ -70,19 +70,19 @@ class LoginCommand extends BaseCommand {
70
70
  if (!credentialsPresent) {
71
71
  this.stopSpinner(); // end the spinner in checkCredentials()
72
72
  this.log(
73
- colors.yellow(`Your ${AUTH_LOCATION} has not been set up yet.\n`)
73
+ colors.yellow(`Your ${AUTH_LOCATION} has not been set up yet.\n`),
74
74
  );
75
75
  } else if (!credentialsGood) {
76
76
  this.log(
77
77
  colors.red(
78
- `Your ${AUTH_LOCATION} looks like it has invalid credentials.\n`
79
- )
78
+ `Your ${AUTH_LOCATION} looks like it has invalid credentials.\n`,
79
+ ),
80
80
  );
81
81
  } else {
82
82
  this.log(
83
83
  colors.green(
84
- `Your ${AUTH_LOCATION} looks valid. You may update it now though.\n`
85
- )
84
+ `Your ${AUTH_LOCATION} looks valid. You may update it now though.\n`,
85
+ ),
86
86
  );
87
87
  }
88
88
 
@@ -93,7 +93,7 @@ class LoginCommand extends BaseCommand {
93
93
  deployKey = await this.promptForDeployKey();
94
94
  } else {
95
95
  const email = await this.prompt(
96
- 'What email address do you use to log into Zapier?'
96
+ 'What email address do you use to log into Zapier?',
97
97
  );
98
98
  if (await isSamlEmail(email)) {
99
99
  // category 2
@@ -102,13 +102,13 @@ class LoginCommand extends BaseCommand {
102
102
  // category 1
103
103
  this.log(
104
104
  `\n\nNow you'll enter your Zapier password.\nIf you log into Zapier via the ${colors.green(
105
- 'log in with Google button'
105
+ 'log in with Google button',
106
106
  )} (or a different social network), you may not have a Zapier password.\nIf that's the case, hit CTRL+C and re-run this command with the ${colors.cyan(
107
- `--sso`
108
- )} flag.\n\n`
107
+ `--sso`,
108
+ )} flag.\n\n`,
109
109
  );
110
110
  const password = await this.promptHidden(
111
- 'What is your Zapier password?'
111
+ 'What is your Zapier password?',
112
112
  );
113
113
 
114
114
  let goodResponse;
@@ -118,7 +118,7 @@ class LoginCommand extends BaseCommand {
118
118
  if (errors[0].startsWith('missing totp_code')) {
119
119
  const code = await this.prompt(
120
120
  'What is your current 6-digit 2FA code?',
121
- { validate: isValidTotpCode }
121
+ { validate: isValidTotpCode },
122
122
  );
123
123
  goodResponse = await createCredentials(email, password, code);
124
124
  } else {
@@ -132,7 +132,7 @@ class LoginCommand extends BaseCommand {
132
132
  AUTH_LOCATION,
133
133
  prettyJSONstringify({
134
134
  [AUTH_KEY]: deployKey,
135
- })
135
+ }),
136
136
  );
137
137
 
138
138
  await checkCredentials();
@@ -143,7 +143,7 @@ class LoginCommand extends BaseCommand {
143
143
 
144
144
  LoginCommand.flags = buildFlags({
145
145
  commandFlags: {
146
- sso: flags.boolean({
146
+ sso: Flags.boolean({
147
147
  char: 's',
148
148
  description:
149
149
  "Use this flag if you log into Zapier a Single Sign-On (SSO) button and don't have a Zapier password.",
@@ -14,7 +14,7 @@ class LogoutCommand extends BaseCommand {
14
14
  } catch (e) {
15
15
  success = false;
16
16
  this.error(
17
- `Deletion API request failed. Is your ${AUTH_LOCATION} already empty or invalid? If so, feel free to ignore this error.`
17
+ `Deletion API request failed. Is your ${AUTH_LOCATION} already empty or invalid? If so, feel free to ignore this error.`,
18
18
  );
19
19
  } finally {
20
20
  this.stopSpinner({ success });