@automattic/vip 2.34.0 → 2.35.1

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 (77) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/CONTRIBUTING.md +1 -1
  3. package/dist/bin/vip-app-list.js +1 -1
  4. package/dist/bin/vip-app.js +1 -0
  5. package/dist/bin/vip-backup-db.js +0 -5
  6. package/dist/bin/vip-cache-purge-url.js +0 -5
  7. package/dist/bin/vip-cache.js +0 -5
  8. package/dist/bin/vip-config-envvar-delete.js +6 -5
  9. package/dist/bin/vip-config-envvar-get-all.js +6 -5
  10. package/dist/bin/vip-config-envvar-get.js +6 -5
  11. package/dist/bin/vip-config-envvar-list.js +6 -5
  12. package/dist/bin/vip-config-envvar-set.js +0 -5
  13. package/dist/bin/vip-config-envvar.js +0 -5
  14. package/dist/bin/vip-config-software-get.js +0 -5
  15. package/dist/bin/vip-config-software-update.js +2 -5
  16. package/dist/bin/vip-config-software.js +0 -5
  17. package/dist/bin/vip-config.js +2 -0
  18. package/dist/bin/vip-dev-env-create.js +2 -5
  19. package/dist/bin/vip-dev-env-destroy.js +0 -5
  20. package/dist/bin/vip-dev-env-exec.js +2 -5
  21. package/dist/bin/vip-dev-env-import-media.js +0 -5
  22. package/dist/bin/vip-dev-env-import-sql.js +0 -5
  23. package/dist/bin/vip-dev-env-import.js +0 -5
  24. package/dist/bin/vip-dev-env-info.js +0 -5
  25. package/dist/bin/vip-dev-env-list.js +0 -5
  26. package/dist/bin/vip-dev-env-logs.js +1 -1
  27. package/dist/bin/vip-dev-env-shell.js +8 -1
  28. package/dist/bin/vip-dev-env-start.js +0 -5
  29. package/dist/bin/vip-dev-env-stop.js +0 -5
  30. package/dist/bin/vip-dev-env-sync-sql.js +0 -5
  31. package/dist/bin/vip-dev-env-sync.js +0 -5
  32. package/dist/bin/vip-dev-env-update.js +4 -5
  33. package/dist/bin/vip-dev-env.js +0 -5
  34. package/dist/bin/vip-export-sql.js +0 -5
  35. package/dist/bin/vip-import-media-abort.js +0 -5
  36. package/dist/bin/vip-import-media-status.js +0 -5
  37. package/dist/bin/vip-import-media.js +0 -5
  38. package/dist/bin/vip-import-sql-status.js +1 -5
  39. package/dist/bin/vip-import-sql.js +11 -5
  40. package/dist/bin/vip-import-validate-files.js +1 -0
  41. package/dist/bin/vip-import-validate-sql.js +2 -0
  42. package/dist/bin/vip-logs.js +11 -0
  43. package/dist/bin/vip-search-replace.js +0 -5
  44. package/dist/bin/vip-slowlogs.js +1 -0
  45. package/dist/bin/vip-sync.js +1 -2
  46. package/dist/bin/vip-validate-preflight.js +13 -0
  47. package/dist/bin/vip-wp.js +1 -2
  48. package/dist/bin/vip.js +7 -0
  49. package/dist/commands/backup-db.js +9 -5
  50. package/dist/commands/dev-env-import-sql.js +4 -5
  51. package/dist/commands/dev-env-sync-sql.js +8 -5
  52. package/dist/commands/export-sql.js +9 -5
  53. package/dist/lib/analytics/clients/pendo.js +4 -0
  54. package/dist/lib/analytics/clients/tracks.js +3 -0
  55. package/dist/lib/analytics/index.js +1 -0
  56. package/dist/lib/backup-storage-availability/backup-storage-availability.js +1 -0
  57. package/dist/lib/cli/command.js +11 -1
  58. package/dist/lib/cli/config.js +2 -0
  59. package/dist/lib/cli/format.js +1 -0
  60. package/dist/lib/cli/progress.js +19 -13
  61. package/dist/lib/client-file-uploader.js +3 -3
  62. package/dist/lib/config/software.js +3 -2
  63. package/dist/lib/constants/vipgo.js +4 -2
  64. package/dist/lib/dev-environment/dev-environment-lando.js +4 -3
  65. package/dist/lib/envvar/logging.js +2 -5
  66. package/dist/lib/keychain/insecure.js +2 -0
  67. package/dist/lib/keychain.js +1 -0
  68. package/dist/lib/media-import/progress.js +8 -1
  69. package/dist/lib/site-import/db-file-import.js +4 -5
  70. package/dist/lib/site-import/status.js +1 -1
  71. package/dist/lib/token.js +4 -0
  72. package/dist/lib/validations/is-multi-site.js +1 -1
  73. package/dist/lib/validations/is-multisite-domain-mapped.js +1 -1
  74. package/helpers/prepublishOnly.js +8 -5
  75. package/npm-shrinkwrap.json +1407 -1512
  76. package/package.json +15 -22
  77. package/tsconfig.json +11 -11
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  * External dependencies
4
5
  */
@@ -33,7 +34,6 @@ const appQuery = `id,name,environments{
33
34
  await (0, _tracker.trackEvent)('sync_command_execute');
34
35
  try {
35
36
  await api.mutate({
36
- // $FlowFixMe: gql template is not supported by flow
37
37
  mutation: (0, _graphqlTag.default)`
38
38
  mutation SyncEnvironmentMutation($input: AppEnvironmentSyncInput) {
39
39
  syncEnvironment(input: $input) {
@@ -105,7 +105,6 @@ const appQuery = `id,name,environments{
105
105
  // Query the API 1/10 of the time (every 1s)
106
106
  // The rest of the iterations are just for moving the spinner
107
107
  api.query({
108
- // $FlowFixMe: gql template is not supported by flow
109
108
  query: (0, _graphqlTag.default)`
110
109
  query App($id: Int, $sync: Int) {
111
110
  app(id: $id) {
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  * External dependencies
4
5
  */
@@ -53,6 +54,10 @@ exports.appQuery = appQuery;
53
54
  let suppressOutput = false;
54
55
  let outputJson = false;
55
56
  let harmoniaArgs = [];
57
+
58
+ /**
59
+ * @param {string[]} messages
60
+ */
56
61
  function logToConsole(...messages) {
57
62
  if (suppressOutput) {
58
63
  return;
@@ -110,6 +115,10 @@ async function getBuildConfiguration(application, environment) {
110
115
  }
111
116
  }
112
117
  }
118
+
119
+ /**
120
+ * @param {string} argv
121
+ */
113
122
  async function vipValidatePreflightCommand(arg, opt) {
114
123
  var _opt$env, _opt$env2, _opt$app, _opt$env3;
115
124
  harmoniaArgs = await validateArgs(opt);
@@ -210,6 +219,10 @@ async function vipValidatePreflightCommand(arg, opt) {
210
219
  setupEvents(harmonia);
211
220
  runHarmonia(harmonia);
212
221
  }
222
+
223
+ /**
224
+ * @param {Harmonia} harmonia
225
+ */
213
226
  function setupEvents(harmonia) {
214
227
  // Register some events handlers
215
228
  harmonia.on('ready', () => {
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  * External dependencies
4
5
  */
@@ -98,7 +99,6 @@ const bindStreamEvents = ({
98
99
  const getTokenForCommand = async (appId, envId, command) => {
99
100
  const api = await (0, _api.default)();
100
101
  return api.mutate({
101
- // $FlowFixMe: gql template is not supported by flow
102
102
  mutation: (0, _graphqlTag.default)`
103
103
  mutation TriggerWPCLICommandMutation($input: AppEnvironmentTriggerWPCLICommandInput) {
104
104
  triggerWPCLICommandOnAppEnvironment(input: $input) {
@@ -123,7 +123,6 @@ const getTokenForCommand = async (appId, envId, command) => {
123
123
  const cancelCommand = async guid => {
124
124
  const api = await (0, _api.default)();
125
125
  return api.mutate({
126
- // $FlowFixMe: gql template is not supported by flow
127
126
  mutation: (0, _graphqlTag.default)`
128
127
  mutation cancelWPCLICommand($input: CancelWPCLICommandInput) {
129
128
  cancelWPCLICommand(input: $input) {
package/dist/bin/vip.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  * External dependencies
4
5
  */
@@ -31,6 +32,12 @@ const runCmd = async function () {
31
32
  cmd.command('logout', 'Logout from your current session').command('app', 'List and modify your VIP applications').command('backup', 'Generate a backup for VIP applications').command('cache', 'Manage page cache for your VIP applications').command('config', 'Set configuration for your VIP applications').command('dev-env', 'Use local dev-environment').command('export', 'Export data from your VIP application').command('import', 'Import media or SQL files into your VIP applications').command('logs', 'Get logs from your VIP applications').command('search-replace', 'Perform search and replace tasks on files').command('slowlogs', 'Get slowlogs from your VIP applications').command('sync', 'Sync production to a development environment').command('whoami', 'Display details about the currently logged-in user').command('validate', 'Validate your VIP application and environment').command('wp', 'Run WP CLI commands against an environment');
32
33
  cmd.argv(process.argv);
33
34
  };
35
+
36
+ /**
37
+ * @param {any[]} argv
38
+ * @param {any[]} params
39
+ * @returns {boolean}
40
+ */
34
41
  function doesArgvHaveAtLeastOneParam(argv, params) {
35
42
  return argv.some(arg => params.includes(arg));
36
43
  }
@@ -14,11 +14,6 @@ var _format = require("../lib/cli/format");
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
- /**
18
- *
19
- * @format
20
- */
21
-
22
17
  /**
23
18
  * External dependencies
24
19
  */
@@ -99,10 +94,19 @@ async function createBackupJob(appId, envId) {
99
94
 
100
95
  // Library for a possible command in the future: vip backup db @app.env
101
96
  class BackupDBCommand {
97
+ app;
98
+ env;
99
+ job;
100
+ jobStatus;
101
+ jobAge;
102
+ backupName;
103
+ silent;
102
104
  steps = {
103
105
  PREPARE: 'prepare',
104
106
  GENERATE: 'generate'
105
107
  };
108
+ track;
109
+ progressTracker;
106
110
  constructor(app, env, trackerFn = async () => {}) {
107
111
  this.app = app;
108
112
  this.env = env;
@@ -12,11 +12,6 @@ var _devEnvironmentLando = require("../lib/dev-environment/dev-environment-lando
12
12
  var _userError = _interopRequireDefault(require("../lib/user-error"));
13
13
  var _sql = require("../lib/validations/sql");
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
- /**
16
- *
17
- * @format
18
- */
19
-
20
15
  /**
21
16
  * External dependencies
22
17
  */
@@ -26,6 +21,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
26
21
  */
27
22
 
28
23
  class DevEnvImportSQLCommand {
24
+ fileName;
25
+ options;
26
+ slug;
27
+ trackingInfo;
29
28
  constructor(fileName, options, slug) {
30
29
  this.fileName = fileName;
31
30
  this.options = options;
@@ -1,10 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- /**
4
- *
5
- * @format
6
- */
7
-
8
3
  /**
9
4
  * External dependencies
10
5
  */
@@ -69,6 +64,14 @@ async function extractSiteUrls(sqlFile) {
69
64
  });
70
65
  }
71
66
  class DevEnvSyncSQLCommand {
67
+ app;
68
+ env;
69
+ slug;
70
+ tmpDir;
71
+ siteUrls;
72
+ searchReplaceMap;
73
+ track;
74
+
72
75
  /**
73
76
  * Creates a new instance of the command
74
77
  *
@@ -19,11 +19,6 @@ var _backupStorageAvailability = require("../lib/backup-storage-availability/bac
19
19
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
- /**
23
- *
24
- * @format
25
- */
26
-
27
22
  /**
28
23
  * External dependencies
29
24
  */
@@ -187,6 +182,13 @@ async function createExportJob(appId, envId, backupId) {
187
182
  * Class representing an export command workflow
188
183
  */
189
184
  class ExportSQLCommand {
185
+ app;
186
+ env;
187
+ downloadLink;
188
+ progressTracker;
189
+ outputFile;
190
+ generateBackup;
191
+ confirmEnoughStorageHook;
190
192
  steps = {
191
193
  PREPARE: 'prepare',
192
194
  CREATE: 'create',
@@ -194,6 +196,8 @@ class ExportSQLCommand {
194
196
  CONFIRM_ENOUGH_STORAGE: 'confirmEnoughStorage',
195
197
  DOWNLOAD: 'download'
196
198
  };
199
+ track;
200
+
197
201
  /**
198
202
  * Creates an instance of SQLExportCommand
199
203
  *
@@ -20,6 +20,10 @@ const debug = (0, _debug.default)('@automattic/vip:analytics:clients:pendo');
20
20
  * Pendo analytics client.
21
21
  */
22
22
  class Pendo {
23
+ eventPrefix;
24
+ userAgent;
25
+ userId;
26
+ context;
23
27
  static ENDPOINT = '/pendo';
24
28
  constructor(options) {
25
29
  this.eventPrefix = options.eventPrefix;
@@ -28,6 +28,9 @@ const validEventOrPropNamePattern = /^[a-z_][a-z0-9_]*$/;
28
28
  // TODO: add batch support (can include multiples in `events` array)
29
29
 
30
30
  class Tracks {
31
+ eventPrefix;
32
+ userAgent;
33
+ baseParams;
31
34
  static ENDPOINT = 'https://public-api.wordpress.com/rest/v1.1/tracks/record';
32
35
  constructor(userId, userType, eventPrefix, env) {
33
36
  this.eventPrefix = eventPrefix;
@@ -27,6 +27,7 @@ const client_info = {
27
27
  /* eslint-enable camelcase */
28
28
 
29
29
  class Analytics {
30
+ clients;
30
31
  constructor(clients) {
31
32
  this.clients = clients;
32
33
  }
@@ -15,6 +15,7 @@ var _dockerMachineNotFoundError = require("./docker-machine-not-found-error");
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
  const oneGiBInBytes = 1024 * 1024 * 1024;
17
17
  class BackupStorageAvailability {
18
+ archiveSize;
18
19
  constructor(archiveSize) {
19
20
  this.archiveSize = archiveSize;
20
21
  }
@@ -27,9 +27,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
27
27
  /**
28
28
  * External dependencies
29
29
  */
30
+
30
31
  /**
31
32
  * Internal dependencies
32
33
  */
34
+
33
35
  function uncaughtError(err) {
34
36
  // Error raised when trying to write to an already closed stream
35
37
  if (err.code === 'EPIPE') {
@@ -166,7 +168,6 @@ _args.default.argv = async function (argv, cb) {
166
168
  await (0, _tracker.trackEvent)('command_appcontext_list_fetch');
167
169
  try {
168
170
  res = await api.query({
169
- // $FlowFixMe: gql template is not supported by flow
170
171
  query: (0, _graphqlTag.default)`query Apps( $first: Int, $after: String ) {
171
172
  apps( first: $first, after: $after ) {
172
173
  total
@@ -301,6 +302,7 @@ _args.default.argv = async function (argv, cb) {
301
302
 
302
303
  // Prompt for confirmation if necessary
303
304
  if (_opts.requireConfirm && !options.force) {
305
+ /** @type {Tuple[]} */
304
306
  const info = [];
305
307
  if (options.app) {
306
308
  info.push({
@@ -467,6 +469,10 @@ _args.default.argv = async function (argv, cb) {
467
469
  }
468
470
  return options;
469
471
  };
472
+
473
+ /**
474
+ * @returns {Error|undefined}
475
+ */
470
476
  function validateOpts(opts) {
471
477
  if (opts.app) {
472
478
  if (typeof opts.app !== 'string' && typeof opts.app !== 'number') {
@@ -485,6 +491,10 @@ function validateOpts(opts) {
485
491
  }
486
492
  }
487
493
  }
494
+
495
+ /**
496
+ * @returns {args}
497
+ */
488
498
  function _default(opts) {
489
499
  _opts = Object.assign({
490
500
  appContext: false,
@@ -14,10 +14,12 @@ const debug = (0, _debug.default)('@automattic/vip:lib:cli:config');
14
14
  let configFromFile;
15
15
  try {
16
16
  // Get `local` config first; this will only exist in dev as it's npmignore-d.
17
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
17
18
  configFromFile = require("../../../config/config.local.json");
18
19
  debug('Loaded config data from config.local.json');
19
20
  } catch {
20
21
  // Fall back to `publish` config file.
22
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
21
23
  configFromFile = require("../../../config/config.publish.json");
22
24
  debug('Loaded config data from config.publish.json');
23
25
  }
@@ -141,6 +141,7 @@ function capitalize(str) {
141
141
  const RUNNING_SPRITE_GLYPHS = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
142
142
  exports.RUNNING_SPRITE_GLYPHS = RUNNING_SPRITE_GLYPHS;
143
143
  class RunningSprite {
144
+ count;
144
145
  constructor() {
145
146
  this.count = 0;
146
147
  }
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.StepStatus = exports.ProgressTracker = void 0;
7
+ var _nodeOs = require("node:os");
7
8
  var _singleLineLog = require("single-line-log");
8
9
  var _format = require("../../lib/cli/format");
9
- var _os = _interopRequireDefault(require("os"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- // @format
12
-
13
10
  /**
14
11
  * External dependencies
15
12
  */
@@ -31,13 +28,22 @@ let StepStatus = /*#__PURE__*/function (StepStatus) {
31
28
  exports.StepStatus = StepStatus;
32
29
  const COMPLETED_STEP_SLUGS = [StepStatus.SUCCESS, StepStatus.SKIPPED];
33
30
  class ProgressTracker {
31
+ hasFailure;
32
+ hasPrinted;
33
+ printInterval;
34
+
34
35
  // Track the state of each step
36
+ stepsFromCaller;
37
+ stepsFromServer;
35
38
 
36
39
  // Spinnerz go brrrr
40
+ runningSprite;
37
41
 
38
42
  // This gets printed before the step status
43
+ prefix;
39
44
 
40
45
  // This gets printed after the step status
46
+ suffix;
41
47
 
42
48
  /**
43
49
  * This determines from which step should we display the steps
@@ -68,7 +74,7 @@ class ProgressTracker {
68
74
  map.set(id, {
69
75
  id,
70
76
  name,
71
- status: status || StepStatus.PENDING
77
+ status: status ?? StepStatus.PENDING
72
78
  });
73
79
  return map;
74
80
  }, new Map());
@@ -104,10 +110,10 @@ class ProgressTracker {
104
110
  }));
105
111
  if (!steps.some(({
106
112
  status
107
- }) => status === 'running')) {
113
+ }) => status === StepStatus.RUNNING)) {
108
114
  const firstPendingStepIndex = steps.findIndex(({
109
115
  status
110
- }) => status === 'pending');
116
+ }) => status === StepStatus.PENDING);
111
117
  if (firstPendingStepIndex !== -1) {
112
118
  // "Promote" the first "pending" to "running"
113
119
  formattedSteps[firstPendingStepIndex].status = StepStatus.RUNNING;
@@ -122,7 +128,7 @@ class ProgressTracker {
122
128
  const steps = [...this.getSteps().values()];
123
129
  return steps.find(({
124
130
  status
125
- }) => status === 'pending');
131
+ }) => status === StepStatus.PENDING);
126
132
  }
127
133
  getCurrentStep() {
128
134
  if (this.allStepsSucceeded()) {
@@ -131,7 +137,7 @@ class ProgressTracker {
131
137
  const steps = [...this.getSteps().values()];
132
138
  return steps.find(({
133
139
  status
134
- }) => status === 'running');
140
+ }) => status === StepStatus.RUNNING);
135
141
  }
136
142
  stepRunning(stepId) {
137
143
  this.setStatusForStepId(stepId, StepStatus.RUNNING);
@@ -153,7 +159,7 @@ class ProgressTracker {
153
159
  allStepsSucceeded() {
154
160
  return [...this.getSteps().values()].every(({
155
161
  status
156
- }) => status === 'success');
162
+ }) => status === StepStatus.SUCCESS);
157
163
  }
158
164
  setStatusForStepId(stepId, status) {
159
165
  const step = this.stepsFromCaller.get(stepId);
@@ -164,7 +170,7 @@ class ProgressTracker {
164
170
  if (COMPLETED_STEP_SLUGS.includes(step.status)) {
165
171
  throw new Error(`Step name ${stepId} is already completed.`);
166
172
  }
167
- if (status === 'failed') {
173
+ if (status === StepStatus.FAILED) {
168
174
  this.hasFailure = true;
169
175
  }
170
176
  this.stepsFromCaller.set(stepId, {
@@ -199,7 +205,7 @@ class ProgressTracker {
199
205
  // without this, any prompt, or any text in between will get overwritten by the progress tracker
200
206
  let linesToSkip = '';
201
207
  for (let iteration = 0; iteration < this.stepsFromCaller.size; iteration++) {
202
- linesToSkip += _os.default.EOL;
208
+ linesToSkip += _nodeOs.EOL;
203
209
  }
204
210
  process.stdout.write(linesToSkip);
205
211
  hasPrintedOnce = true;
@@ -230,7 +236,7 @@ class ProgressTracker {
230
236
  const statusIcon = (0, _format.getGlyphForStatus)(status, this.runningSprite);
231
237
  let suffix = '';
232
238
  if (id === 'upload') {
233
- if (status === 'running' && percentage) {
239
+ if (status === StepStatus.RUNNING && percentage) {
234
240
  suffix = percentage;
235
241
  }
236
242
  } else if (progress) {
@@ -42,11 +42,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
42
42
  // Need to use CommonJS imports here as the `fetch-retry` typedefs are messed up and throwing TypeJS errors when using `import`
43
43
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
44
44
  const fetchWithRetry =
45
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
45
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-var-requires
46
46
  require('fetch-retry')(_nodeFetch.default, {
47
47
  // Set default retry options
48
48
  retries: 3,
49
- retryDelay: (attempt, error, response) => {
49
+ retryDelay: attempt => {
50
50
  return Math.pow(2, attempt) * 1000; // 1000, 2000, 4000
51
51
  }
52
52
  });
@@ -213,7 +213,7 @@ async function uploadUsingPutObject({
213
213
  });
214
214
  const response = await fetchWithRetry(presignedRequest.url, {
215
215
  ...fetchOptions,
216
- body: fileContent ? fileContent : (0, _fs.createReadStream)(fileName).pipe(progressPassThrough)
216
+ body: fileContent ?? (0, _fs.createReadStream)(fileName).pipe(progressPassThrough)
217
217
  });
218
218
  if (response.status === 200) {
219
219
  return 'ok';
@@ -239,8 +239,9 @@ const promptForUpdate = async (appTypeId, opts, softwareSettings) => {
239
239
  const version = await _processComponentVersion(softwareSettings, component, opts.version);
240
240
  const confirm =
241
241
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
242
- opts.force || (await new _enquirer.Confirm({
243
- // NOSONAR
242
+ opts.force || (
243
+ // NOSONAR
244
+ await new _enquirer.Confirm({
244
245
  message: `Are you sure you want to upgrade ${COMPONENT_NAMES[component]} to ${version}?`
245
246
  }).run().catch(() => {
246
247
  throw new _userError.default('Command cancelled by user.');
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WORDPRESS_SITE_TYPE_IDS = exports.WORDPRESS_NON_PROD_APPLICATION_TYPE_ID = exports.WORDPRESS_APPLICATION_TYPE_ID = exports.NODEJS_SITE_TYPE_IDS = exports.NODEJS_REDIS_APPLICATION_TYPE_ID = exports.NODEJS_MYSQL_REDIS_APPLICATION_TYPE_ID = exports.NODEJS_MYSQL_APPLICATION_TYPE_ID = exports.NODEJS_APPLICATION_TYPE_ID = void 0;
6
+ exports.WORDPRESS_SITE_TYPE_IDS = exports.WORDPRESS_NON_PROD_APPLICATION_TYPE_ID = exports.WORDPRESS_APPLICATION_TYPE_ID = exports.NODEJS_SITE_TYPE_IDS = exports.NODEJS_REDIS_APPLICATION_TYPE_ID = exports.NODEJS_MYSQL_REDIS_APPLICATION_TYPE_ID = exports.NODEJS_MYSQL_APPLICATION_TYPE_ID = exports.NODEJS_APPLICATION_TYPE_ID = exports.DATABASE_APPLICATION_TYPE_IDS = void 0;
7
7
  const WORDPRESS_APPLICATION_TYPE_ID = 2;
8
8
  exports.WORDPRESS_APPLICATION_TYPE_ID = WORDPRESS_APPLICATION_TYPE_ID;
9
9
  const WORDPRESS_NON_PROD_APPLICATION_TYPE_ID = 6;
@@ -19,4 +19,6 @@ exports.NODEJS_REDIS_APPLICATION_TYPE_ID = NODEJS_REDIS_APPLICATION_TYPE_ID;
19
19
  const NODEJS_MYSQL_REDIS_APPLICATION_TYPE_ID = 8;
20
20
  exports.NODEJS_MYSQL_REDIS_APPLICATION_TYPE_ID = NODEJS_MYSQL_REDIS_APPLICATION_TYPE_ID;
21
21
  const NODEJS_SITE_TYPE_IDS = [NODEJS_APPLICATION_TYPE_ID, NODEJS_MYSQL_APPLICATION_TYPE_ID, NODEJS_REDIS_APPLICATION_TYPE_ID, NODEJS_MYSQL_REDIS_APPLICATION_TYPE_ID];
22
- exports.NODEJS_SITE_TYPE_IDS = NODEJS_SITE_TYPE_IDS;
22
+ exports.NODEJS_SITE_TYPE_IDS = NODEJS_SITE_TYPE_IDS;
23
+ const DATABASE_APPLICATION_TYPE_IDS = [WORDPRESS_APPLICATION_TYPE_ID, WORDPRESS_NON_PROD_APPLICATION_TYPE_ID, NODEJS_MYSQL_APPLICATION_TYPE_ID, NODEJS_MYSQL_REDIS_APPLICATION_TYPE_ID];
24
+ exports.DATABASE_APPLICATION_TYPE_IDS = DATABASE_APPLICATION_TYPE_IDS;
@@ -91,7 +91,7 @@ async function getLandoConfig() {
91
91
  proxyName: 'vip-dev-env-proxy',
92
92
  userConfRoot: landoDir,
93
93
  home: fakeHomeDir,
94
- domain: 'lndo.site',
94
+ domain: 'vipdev.lndo.site',
95
95
  version: 'unknown'
96
96
  };
97
97
  return (0, _bootstrap.buildConfig)(config);
@@ -101,8 +101,9 @@ async function initLandoApplication(lando, instancePath) {
101
101
  const app = lando.getApp(instancePath);
102
102
  app.events.on('post-init', 1, () => {
103
103
  const initOnly = [];
104
- Object.keys(app.config.services).forEach(serviceName => {
105
- if (app.config.services[serviceName].initOnly) {
104
+ const services = app.config.services;
105
+ Object.keys(services).forEach(serviceName => {
106
+ if (services[serviceName].initOnly) {
106
107
  initOnly.push(serviceName);
107
108
  app.config.services[serviceName].scanner = false;
108
109
  }
@@ -8,11 +8,6 @@ exports.getEnvContext = getEnvContext;
8
8
  var _debug = _interopRequireDefault(require("debug"));
9
9
  var _command = require("../../lib/cli/command");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- /**
12
- *
13
- * @format
14
- */
15
-
16
11
  /**
17
12
  * External dependencies
18
13
  */
@@ -23,6 +18,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
23
18
 
24
19
  // Shared debugger.
25
20
  const debug = (0, _debug.default)('@automattic/vip:bin:config:envvar');
21
+
22
+ // FIXME: Replace with a proper type
26
23
  exports.debug = debug;
27
24
  function getEnvContext(app, env) {
28
25
  return `@${app.id}.${(0, _command.getEnvIdentifier)(env)}`;
@@ -15,6 +15,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
15
15
  */
16
16
 
17
17
  class Insecure {
18
+ file;
19
+ configstore;
18
20
  constructor(file) {
19
21
  this.file = file;
20
22
  this.configstore = new _configstore.default(this.file);
@@ -19,6 +19,7 @@ let exportValue;
19
19
  const debug = (0, _debug.default)('@automattic/vip:keychain');
20
20
  try {
21
21
  // Try using Secure keychain ("keytar") first
22
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
22
23
  const Secure = require("./keychain/secure");
23
24
  exportValue = new Secure();
24
25
  } catch (error) {
@@ -18,12 +18,19 @@ var _format = require("../../lib/cli/format");
18
18
  const PRINT_INTERVAL = process.env.DEBUG ? 5000 : 200; // How often the report is printed. Mainly affects the "spinner" animation.
19
19
 
20
20
  class MediaImportProgressTracker {
21
+ hasFailure;
22
+ hasPrinted;
23
+ printInterval;
24
+ status;
25
+
21
26
  // Spinnerz go brrrr
27
+ runningSprite;
22
28
 
23
29
  // This gets printed before the step status
30
+ prefix;
24
31
 
25
32
  // This gets printed after the step status
26
-
33
+ suffix;
27
34
  constructor(status) {
28
35
  this.runningSprite = new _format.RunningSprite();
29
36
  this.hasFailure = false;
@@ -3,10 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.SYNC_STATUS_NOT_SYNCING = exports.SUPPORTED_DB_FILE_IMPORT_SITE_TYPES = exports.SQL_IMPORT_FILE_SIZE_LIMIT_LAUNCHED = exports.SQL_IMPORT_FILE_SIZE_LIMIT = void 0;
6
+ exports.SYNC_STATUS_NOT_SYNCING = exports.SQL_IMPORT_FILE_SIZE_LIMIT_LAUNCHED = exports.SQL_IMPORT_FILE_SIZE_LIMIT = void 0;
7
7
  exports.currentUserCanImportForApp = currentUserCanImportForApp;
8
8
  exports.isSupportedApp = exports.isImportingBlockedBySync = void 0;
9
9
  var _fileSize = require("../../lib/constants/file-size");
10
+ var _vipgo = require("../../lib/constants/vipgo");
10
11
  /**
11
12
  * Internal dependencies
12
13
  */
@@ -19,11 +20,9 @@ function currentUserCanImportForApp(app) {
19
20
  // TODO: implement
20
21
  return !!app;
21
22
  }
22
- const SUPPORTED_DB_FILE_IMPORT_SITE_TYPES = ['WordPress'];
23
- exports.SUPPORTED_DB_FILE_IMPORT_SITE_TYPES = SUPPORTED_DB_FILE_IMPORT_SITE_TYPES;
24
23
  const isSupportedApp = ({
25
- type
26
- }) => SUPPORTED_DB_FILE_IMPORT_SITE_TYPES.includes(type);
24
+ typeId
25
+ }) => _vipgo.DATABASE_APPLICATION_TYPE_IDS.includes(typeId);
27
26
  exports.isSupportedApp = isSupportedApp;
28
27
  const SYNC_STATUS_NOT_SYNCING = 'not_syncing';
29
28
  exports.SYNC_STATUS_NOT_SYNCING = SYNC_STATUS_NOT_SYNCING;
@@ -9,9 +9,9 @@ var _chalk = _interopRequireDefault(require("chalk"));
9
9
  var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
10
10
  var _debug = _interopRequireDefault(require("debug"));
11
11
  var _api = _interopRequireDefault(require("../../lib/api"));
12
- var _dbFileImport = require("../../lib/site-import/db-file-import");
13
12
  var exit = _interopRequireWildcard(require("../../lib/cli/exit"));
14
13
  var _format = require("../../lib/cli/format");
14
+ var _dbFileImport = require("./db-file-import");
15
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/dist/lib/token.js CHANGED
@@ -21,6 +21,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
21
21
  const SERVICE = 'vip-go-cli';
22
22
  exports.SERVICE = SERVICE;
23
23
  class Token {
24
+ _raw;
25
+ _id;
26
+ iat;
27
+ exp;
24
28
  constructor(token) {
25
29
  if (!token) {
26
30
  return;
@@ -69,7 +69,7 @@ async function isMultiSiteInSiteMeta(appId, envId) {
69
69
  }
70
70
  if (Array.isArray((_res$data$app = res.data.app) === null || _res$data$app === void 0 ? void 0 : _res$data$app.environments)) {
71
71
  const environments = res.data.app.environments;
72
- if (!environments.length) {
72
+ if (!(environments !== null && environments !== void 0 && environments.length)) {
73
73
  isMultiSite.set(args, false);
74
74
  return false;
75
75
  }
@@ -119,7 +119,7 @@ async function isMultisitePrimaryDomainMapped(appId, envId, primaryDomain) {
119
119
  return false;
120
120
  }
121
121
  const environments = res.data.app.environments;
122
- if (!environments.length) {
122
+ if (!(environments !== null && environments !== void 0 && environments.length)) {
123
123
  return false;
124
124
  }
125
125
  const mappedDomains = ((_environments$ = environments[0]) === null || _environments$ === void 0 || (_environments$ = _environments$.domains) === null || _environments$ === void 0 || (_environments$ = _environments$.nodes) === null || _environments$ === void 0 ? void 0 : _environments$.map(domain => domain === null || domain === void 0 ? void 0 : domain.name)) ?? [];