@automattic/vip 2.35.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 (63) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/dist/bin/vip-app-list.js +1 -1
  3. package/dist/bin/vip-app.js +1 -0
  4. package/dist/bin/vip-cache-purge-url.js +0 -5
  5. package/dist/bin/vip-cache.js +0 -5
  6. package/dist/bin/vip-config-envvar-delete.js +6 -5
  7. package/dist/bin/vip-config-envvar-get-all.js +6 -5
  8. package/dist/bin/vip-config-envvar-get.js +6 -5
  9. package/dist/bin/vip-config-envvar-list.js +6 -5
  10. package/dist/bin/vip-config-envvar-set.js +0 -5
  11. package/dist/bin/vip-config-envvar.js +0 -5
  12. package/dist/bin/vip-config-software-get.js +0 -5
  13. package/dist/bin/vip-config-software-update.js +2 -5
  14. package/dist/bin/vip-config-software.js +0 -5
  15. package/dist/bin/vip-config.js +2 -0
  16. package/dist/bin/vip-dev-env-create.js +2 -5
  17. package/dist/bin/vip-dev-env-destroy.js +0 -5
  18. package/dist/bin/vip-dev-env-exec.js +2 -5
  19. package/dist/bin/vip-dev-env-import-media.js +0 -5
  20. package/dist/bin/vip-dev-env-import-sql.js +0 -5
  21. package/dist/bin/vip-dev-env-import.js +0 -5
  22. package/dist/bin/vip-dev-env-info.js +0 -5
  23. package/dist/bin/vip-dev-env-list.js +0 -5
  24. package/dist/bin/vip-dev-env-logs.js +1 -1
  25. package/dist/bin/vip-dev-env-shell.js +8 -1
  26. package/dist/bin/vip-dev-env-start.js +0 -5
  27. package/dist/bin/vip-dev-env-stop.js +0 -5
  28. package/dist/bin/vip-dev-env-sync-sql.js +0 -5
  29. package/dist/bin/vip-dev-env-sync.js +0 -5
  30. package/dist/bin/vip-dev-env-update.js +4 -5
  31. package/dist/bin/vip-dev-env.js +0 -5
  32. package/dist/bin/vip-export-sql.js +0 -5
  33. package/dist/bin/vip-import-media-abort.js +0 -5
  34. package/dist/bin/vip-import-media-status.js +0 -5
  35. package/dist/bin/vip-import-media.js +0 -5
  36. package/dist/bin/vip-import-sql-status.js +1 -5
  37. package/dist/bin/vip-import-sql.js +10 -5
  38. package/dist/bin/vip-import-validate-files.js +1 -0
  39. package/dist/bin/vip-import-validate-sql.js +2 -0
  40. package/dist/bin/vip-logs.js +11 -0
  41. package/dist/bin/vip-search-replace.js +0 -5
  42. package/dist/bin/vip-slowlogs.js +1 -0
  43. package/dist/bin/vip-sync.js +1 -2
  44. package/dist/bin/vip-validate-preflight.js +13 -0
  45. package/dist/bin/vip-wp.js +1 -2
  46. package/dist/bin/vip.js +7 -0
  47. package/dist/commands/backup-db.js +9 -5
  48. package/dist/commands/dev-env-import-sql.js +4 -5
  49. package/dist/commands/dev-env-sync-sql.js +8 -5
  50. package/dist/commands/export-sql.js +9 -5
  51. package/dist/lib/analytics/clients/pendo.js +4 -0
  52. package/dist/lib/analytics/clients/tracks.js +3 -0
  53. package/dist/lib/analytics/index.js +1 -0
  54. package/dist/lib/backup-storage-availability/backup-storage-availability.js +1 -0
  55. package/dist/lib/cli/command.js +11 -1
  56. package/dist/lib/cli/format.js +1 -0
  57. package/dist/lib/cli/progress.js +9 -0
  58. package/dist/lib/keychain/insecure.js +2 -0
  59. package/dist/lib/media-import/progress.js +8 -1
  60. package/dist/lib/token.js +4 -0
  61. package/helpers/prepublishOnly.js +1 -1
  62. package/npm-shrinkwrap.json +2 -175
  63. package/package.json +2 -6
package/CONTRIBUTING.md CHANGED
@@ -113,7 +113,7 @@ Changelogs allow customers to keep up with all the changes happening across our
113
113
 
114
114
  ### Pre-publish Checks
115
115
 
116
- We use a custom pre-publish [script](https://github.com/Automattic/vip/blob/trunk/hellpers/prepublishOnly.js) that performs some confidence checks to avoid common mistakes.
116
+ We use a custom pre-publish [script](https://github.com/Automattic/vip/blob/trunk/helpers/prepublishOnly.js) that performs some confidence checks to avoid common mistakes.
117
117
 
118
118
  Further checks can be added to this flow as needed.
119
119
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  * External dependencies
4
5
  */
@@ -20,7 +21,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
21
  let response;
21
22
  try {
22
23
  response = await api.query({
23
- // $FlowFixMe: gql template is not supported by flow
24
24
  query: (0, _graphqlTag.default)`
25
25
  query Apps($first: Int, $after: String) {
26
26
  apps(first: $first, after: $after) {
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  * External dependencies
4
5
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -31,6 +26,12 @@ const examples = [{
31
26
  usage: `${baseUsage} MY_VARIABLE`,
32
27
  description: 'Permanently deletes the environment variable "MY_VARIABLE"'
33
28
  }];
29
+
30
+ /**
31
+ * @param {string[]} arg
32
+ * @param {object} opt
33
+ * @return {Promise<void>}
34
+ */
34
35
  async function deleteEnvVarCommand(arg, opt) {
35
36
  // Help the user by uppercasing input.
36
37
  const name = arg[0].trim().toUpperCase();
@@ -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
  */
@@ -31,6 +26,12 @@ const examples = [{
31
26
  usage,
32
27
  description: 'Get the values of all environment variables'
33
28
  }];
29
+
30
+ /**
31
+ * @param {string[]} arg
32
+ * @param {object} opt
33
+ * @return {Promise<void>}
34
+ */
34
35
  async function getAllEnvVarsCommand(arg, opt) {
35
36
  const trackingParams = {
36
37
  app_id: opt.app.id,
@@ -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
  */
@@ -30,6 +25,12 @@ const examples = [{
30
25
  usage: `${baseUsage} MY_VARIABLE`,
31
26
  description: 'Get the value of the environment variable "MY_VARIABLE"'
32
27
  }];
28
+
29
+ /**
30
+ * @param {string[]} arg
31
+ * @param {object} opt
32
+ * @return {Promise<void>}
33
+ */
33
34
  async function getEnvVarCommand(arg, opt) {
34
35
  // Help the user by uppercasing input.
35
36
  const name = arg[0].trim().toUpperCase();
@@ -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
  */
@@ -31,6 +26,12 @@ const examples = [{
31
26
  usage,
32
27
  description: 'Lists all environment variables (names only)'
33
28
  }];
29
+
30
+ /**
31
+ * @param {string[]} arg
32
+ * @param {object} opt
33
+ * @return {Promise<void>}
34
+ */
34
35
  async function listEnvVarsCommand(arg, opt) {
35
36
  const trackingParams = {
36
37
  app_id: opt.app.id,
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -62,6 +57,8 @@ cmd.argv(process.argv, async (arg, opt) => {
62
57
  if (softwareSettings === null) {
63
58
  throw new _userError.default('Software settings are not supported for this environment.');
64
59
  }
60
+
61
+ /** @type {UpdatePromptOptions} */
65
62
  const updateOptions = {
66
63
  force: !!opt.yes
67
64
  };
@@ -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
  */
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  * External dependencies
4
5
  */
6
+
5
7
  /**
6
8
  * Internal dependencies
7
9
  */
@@ -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
  */
@@ -78,6 +73,8 @@ cmd.argv(process.argv, async (arg, opt) => {
78
73
  const messageToShow = `Environment already exists\n\n\nTo start the environment run:\n\n${startCommand}\n\n` + `To create another environment use ${_chalk.default.bold('--slug')} option with a unique name.\n`;
79
74
  exit.withError(messageToShow);
80
75
  }
76
+
77
+ /** @type {InstanceOptions} */
81
78
  let defaultOptions = {};
82
79
  try {
83
80
  if (opt.app) {
@@ -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
  */
@@ -1,10 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- /**
4
- *
5
- * @format
6
- */
7
-
8
3
  /**
9
4
  * Internal dependencies
10
5
  */
@@ -43,6 +38,8 @@ const examples = [{
43
38
  if (unmatchedArgs.length > 0 && !argSplitterFound) {
44
39
  throw new Error('Please provide "--" argument to separate arguments for "vip" and command to be executed (see "--help" for examples)');
45
40
  }
41
+
42
+ /** @type {string[]} */
46
43
  let arg = [];
47
44
  if (argSplitterFound && argSplitterIx + 1 < process.argv.length) {
48
45
  arg = process.argv.slice(argSplitterIx + 1);
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // @format
2
+
3
3
  /**
4
4
  * External dependencies
5
5
  */
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // @format
2
+
3
3
  /**
4
4
  * External dependencies
5
5
  */
@@ -41,11 +41,18 @@ const examples = [{
41
41
  usage: `${_devEnvironment.DEV_ENVIRONMENT_FULL_COMMAND} shell -S database -- ls -lha`,
42
42
  description: 'Runs `ls -lha` command in the shell of the database service in the dev environment'
43
43
  }];
44
+
45
+ /**
46
+ * @param {string[]} args
47
+ * @return {string[]}
48
+ */
44
49
  function getCommand(args) {
45
50
  const splitterIdx = process.argv.findIndex(argument => '--' === argument);
46
51
  if (args.length > 0 && splitterIdx === -1) {
47
52
  throw new Error('Please provide "--" argument to separate arguments for "vip" and command to be executed (see "--help" for examples)');
48
53
  }
54
+
55
+ /** @type {string[]} */
49
56
  let cmd = [];
50
57
  if (splitterIdx !== -1 && splitterIdx + 1 < process.argv.length) {
51
58
  cmd = process.argv.slice(splitterIdx + 1);
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -45,6 +40,8 @@ cmd.argv(process.argv, async (arg, opt) => {
45
40
  }
46
41
  const currentInstanceData = (0, _devEnvironmentCore.readEnvironmentData)(slug);
47
42
  debug('Read instance data', currentInstanceData);
43
+
44
+ /** @type {InstanceOptions} */
48
45
  const preselectedOptions = {
49
46
  title: currentInstanceData.wpTitle,
50
47
  multisite: currentInstanceData.multisite,
@@ -53,6 +50,8 @@ cmd.argv(process.argv, async (arg, opt) => {
53
50
  const configurationFileOptions = await (0, _devEnvironmentConfigurationFile.getConfigurationFileOptions)();
54
51
  const thereAreOptionsFromConfigFile = Object.keys(configurationFileOptions).length > 0;
55
52
  const finalPreselectedOptions = (0, _devEnvironmentConfigurationFile.mergeConfigurationFileOptions)(preselectedOptions, configurationFileOptions);
53
+
54
+ /** @type {InstanceOptions} */
56
55
  const defaultOptions = {
57
56
  appCode: currentInstanceData.appCode.dir || currentInstanceData.appCode.tag || 'latest',
58
57
  muPlugins: currentInstanceData.muPlugins.dir || currentInstanceData.muPlugins.tag || 'latest',
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -26,6 +21,7 @@ const appQuery = `
26
21
  id,
27
22
  name,
28
23
  type,
24
+ typeId,
29
25
  environments{
30
26
  id
31
27
  appId
@@ -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
  */
@@ -90,6 +85,12 @@ const SQL_IMPORT_PREFLIGHT_PROGRESS_STEPS = [{
90
85
  id: 'queue_import',
91
86
  name: 'Queueing Import'
92
87
  }];
88
+
89
+ /**
90
+ * @param {AppForImport} app
91
+ * @param {EnvForImport} env
92
+ * @param {string} fileName
93
+ */
93
94
  async function gates(app, env, fileName) {
94
95
  const {
95
96
  id: envId,
@@ -214,6 +215,10 @@ const promptToContinue = async ({
214
215
  exit.withError('The input did not match the expected environment label. Import aborted.');
215
216
  }
216
217
  };
218
+
219
+ /**
220
+ * @returns {Promise<string[]>}
221
+ */
217
222
  async function validateAndGetTableNames({
218
223
  skipValidate,
219
224
  appId,
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  * External dependencies
4
5
  */
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  * External dependencies
4
5
  */
6
+
5
7
  /**
6
8
  * Internal dependencies
7
9
  */
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  * External dependencies
4
5
  */
@@ -31,6 +32,10 @@ const ALLOWED_FORMATS = ['csv', 'json', 'text'];
31
32
  const DEFAULT_POLLING_DELAY_IN_SECONDS = 30;
32
33
  const MIN_POLLING_DELAY_IN_SECONDS = 5;
33
34
  const MAX_POLLING_DELAY_IN_SECONDS = 300;
35
+
36
+ /**
37
+ * @param {string[]} arg
38
+ */
34
39
  async function getLogs(arg, opt) {
35
40
  validateInputs(opt.type, opt.limit, opt.format);
36
41
  const trackingParams = getBaseTrackingParams(opt);
@@ -158,6 +163,12 @@ function printLogs(logs, format) {
158
163
  }
159
164
  console.log(output);
160
165
  }
166
+
167
+ /**
168
+ * @param {string} type
169
+ * @param {number} limit
170
+ * @param {string} format
171
+ */
161
172
  function validateInputs(type, limit, format) {
162
173
  if (!ALLOWED_TYPES.includes(type)) {
163
174
  exit.withError(`Invalid type: ${type}. The supported types are: ${ALLOWED_TYPES.join(', ')}.`);
@@ -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
  */
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  /**
3
4
  * External dependencies
4
5
  */
@@ -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) {