@automattic/vip 2.16.0 → 2.18.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  ## Changelog
2
2
 
3
+ ### 2.18.0 (15 Sep 2022)
4
+ - #1103 Force the preference for WebSocket in case we see an error during connection
5
+ - #1102 Remove http proxy support
6
+ - #1096 [dev-env] Supports extended information table
7
+ - #1100 Add GitHub action to mark inactive issues and PRs as stale
8
+ - #1099 Add @app.env to commands help
9
+ - #1092 Improve login + logout
10
+ - #1097 Don't pipe output through less
11
+
12
+ ### 2.17.0 (06 Sep 2022)
13
+ - #1093 [dev-env] use latest proxy image
14
+ - #1091 Extract http helper into standalone function
15
+ - #1090 Add tracking to software update
16
+ - #1083 Software Management: Update
17
+ - #1089 [dev-env] Fix wording in wizard
18
+
3
19
  ### 2.16.0 (29 Aug 2022)
4
20
 
5
21
  - #1086 Add tracking to config software get
package/CONTRIBUTING.md CHANGED
@@ -85,7 +85,7 @@ Prepare the release by making sure that:
85
85
 
86
86
  ```
87
87
  export LAST_RELEASE_DATE=2021-08-25T13:40:00+02
88
- gh pr list --search "is:merged sort:updated-desc closed:>$LAST_RELEASE_DATE" | sed -e 's/\s*\S\+\s*\S\+\s*$//' -e 's/^/- #/'
88
+ gh pr list --search "is:merged sort:updated-desc closed:>$LAST_RELEASE_DATE" | sed -e 's/\s\+\S\+\tMERGED.*$//' -e 's/^/- #/'
89
89
  ```
90
90
 
91
91
  Then, let's publish:
@@ -34,7 +34,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
34
34
  /**
35
35
  * Internal dependencies
36
36
  */
37
- const baseUsage = 'vip config envvar delete'; // Command examples
37
+ const baseUsage = 'vip @mysite.develop config envvar delete'; // Command examples
38
38
 
39
39
  const examples = [{
40
40
  usage: `${baseUsage} MY_VARIABLE`,
@@ -34,7 +34,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
34
34
  /**
35
35
  * Internal dependencies
36
36
  */
37
- const usage = 'vip config envvar get-all'; // Command examples
37
+ const usage = 'vip @mysite.develop config envvar get-all'; // Command examples
38
38
 
39
39
  const examples = [{
40
40
  usage,
@@ -32,7 +32,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
32
32
  /**
33
33
  * Internal dependencies
34
34
  */
35
- const baseUsage = 'vip config envvar get'; // Command examples
35
+ const baseUsage = 'vip @mysite.develop config envvar get'; // Command examples
36
36
 
37
37
  const examples = [{
38
38
  usage: `${baseUsage} MY_VARIABLE`,
@@ -34,7 +34,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
34
34
  /**
35
35
  * Internal dependencies
36
36
  */
37
- const usage = 'vip config envvar list'; // Command examples
37
+ const usage = 'vip @mysite.develop config envvar list'; // Command examples
38
38
 
39
39
  const examples = [{
40
40
  usage,
@@ -36,7 +36,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
36
36
  /**
37
37
  * Internal dependencies
38
38
  */
39
- const baseUsage = 'vip config envvar set';
39
+ const baseUsage = 'vip @mysite.develop config envvar set';
40
40
  const NEW_RELIC_ENVVAR_KEY = 'NEW_RELIC_LICENSE_KEY'; // Command examples
41
41
 
42
42
  const examples = [{
@@ -22,16 +22,16 @@ var _format = require("../lib/cli/format");
22
22
 
23
23
  var _software = require("../lib/config/software");
24
24
 
25
- var _userError = _interopRequireDefault(require("../lib/cli/userError"));
25
+ var _userError = _interopRequireDefault(require("../lib/user-error"));
26
26
 
27
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
28
 
29
29
  // Command examples
30
30
  const examples = [{
31
- usage: 'vip config software get wordpress --format json',
31
+ usage: 'vip @mysite.develop config software get wordpress --format json',
32
32
  description: 'Read current software settings for WordPress in JSON format'
33
33
  }, {
34
- usage: 'vip config software get',
34
+ usage: 'vip @mysite.develop config software get',
35
35
  description: 'Read current software settings for all components'
36
36
  }];
37
37
  (0, _command.default)({
@@ -41,7 +41,7 @@ const examples = [{
41
41
  envContext: true,
42
42
  wildcardCommand: true,
43
43
  format: true,
44
- usage: 'vip config software get <wordpress|php|nodejs|muplugins>'
44
+ usage: 'vip @mysite.develop config software get <wordpress|php|nodejs|muplugins>'
45
45
  }).examples(examples).argv(process.argv, async (arg, opt) => {
46
46
  var _opt$env;
47
47
 
@@ -0,0 +1,147 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ *
5
+ * @format
6
+ */
7
+
8
+ /**
9
+ * External dependencies
10
+ */
11
+ "use strict";
12
+
13
+ var _chalk = _interopRequireDefault(require("chalk"));
14
+
15
+ var _debug = _interopRequireDefault(require("debug"));
16
+
17
+ var _command = _interopRequireDefault(require("../lib/cli/command"));
18
+
19
+ var _software = require("../lib/config/software");
20
+
21
+ var _progress = require("../lib/cli/progress");
22
+
23
+ var _userError = _interopRequireDefault(require("../lib/user-error"));
24
+
25
+ var _tracker = require("../lib/tracker");
26
+
27
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
+
29
+ /**
30
+ * Internal dependencies
31
+ */
32
+ const debug = (0, _debug.default)('@automattic/vip:bin:config-software');
33
+ const UPDATE_SOFTWARE_PROGRESS_STEPS = [{
34
+ id: 'trigger',
35
+ name: 'Trigger software update'
36
+ }, {
37
+ id: 'process',
38
+ name: 'Process software update'
39
+ }];
40
+ const cmd = (0, _command.default)({
41
+ appContext: true,
42
+ appQuery: _software.appQuery,
43
+ appQueryFragments: _software.appQueryFragments,
44
+ envContext: true,
45
+ wildcardCommand: true,
46
+ usage: 'vip @mysite.develop config software update <wordpress|php|nodejs|muplugins> <version>'
47
+ }).examples([{
48
+ usage: 'vip @mysite.develop config software update wordpress 6.0',
49
+ description: 'Update WordPress to 6.0.x'
50
+ }, {
51
+ usage: 'vip @mysite.develop config software update nodejs 16',
52
+ description: 'Update Node.js to v16'
53
+ }]);
54
+ cmd.option('force', 'Auto-confirm update');
55
+ cmd.argv(process.argv, async (arg, opt) => {
56
+ const {
57
+ app,
58
+ env
59
+ } = opt;
60
+ const {
61
+ softwareSettings
62
+ } = env;
63
+ const baseTrackingInfo = {
64
+ environment_id: env === null || env === void 0 ? void 0 : env.id,
65
+ args: JSON.stringify(arg)
66
+ };
67
+ await (0, _tracker.trackEvent)('config_software_update_execute', baseTrackingInfo);
68
+ let updateData = {};
69
+
70
+ try {
71
+ if (softwareSettings === null) {
72
+ throw new _userError.default('Software settings are not supported for this environment.');
73
+ }
74
+
75
+ const updateOptions = {
76
+ force: !!opt.force
77
+ };
78
+
79
+ if (arg.length > 0) {
80
+ updateOptions.component = arg[0];
81
+ }
82
+
83
+ if (arg.length > 1) {
84
+ updateOptions.version = arg[1];
85
+ }
86
+
87
+ updateData = await (0, _software.promptForUpdate)(app.typeId, updateOptions, softwareSettings);
88
+ const hasProcessJob = updateData.component !== 'nodejs';
89
+ const steps = hasProcessJob ? UPDATE_SOFTWARE_PROGRESS_STEPS : [UPDATE_SOFTWARE_PROGRESS_STEPS[0]];
90
+ const progressTracker = new _progress.ProgressTracker(steps);
91
+ progressTracker.startPrinting();
92
+ progressTracker.stepRunning('trigger');
93
+ const triggerResult = await (0, _software.triggerUpdate)({
94
+ appId: app.id,
95
+ envId: env.id,
96
+ ...updateData
97
+ });
98
+ debug('Triggered update with result', triggerResult);
99
+ progressTracker.stepSuccess('trigger');
100
+
101
+ if (hasProcessJob) {
102
+ const {
103
+ ok,
104
+ errorMessage
105
+ } = await (0, _software.getUpdateResult)(app.id, env.id);
106
+
107
+ if (ok) {
108
+ progressTracker.stepSuccess('process');
109
+ } else {
110
+ progressTracker.stepFailed('process');
111
+ }
112
+
113
+ progressTracker.print();
114
+ progressTracker.stopPrinting();
115
+
116
+ if (ok) {
117
+ console.log(_chalk.default.green('✓') + ' Software update complete');
118
+ } else {
119
+ throw Error(errorMessage);
120
+ }
121
+ } else {
122
+ progressTracker.print();
123
+ progressTracker.stopPrinting();
124
+ const deploymentsLink = `https://dashboard.wpvip.com/apps/${app.id}/${env.uniqueLabel}/deploys`;
125
+ const message = ` A new build of the application code has been initiated and will be deployed using Node.js v${updateData.version} when the build is successful\n` + `View the deployments page in VIP Dashboard for progress updates. - ${deploymentsLink}`;
126
+ console.log(_chalk.default.green('✓') + message);
127
+ }
128
+
129
+ await (0, _tracker.trackEvent)('config_software_update_success', { ...baseTrackingInfo,
130
+ ...updateData
131
+ });
132
+ } catch (error) {
133
+ if (error instanceof _userError.default) {
134
+ await (0, _tracker.trackEvent)('config_software_update_success', { ...baseTrackingInfo,
135
+ ...updateData,
136
+ user_error: error === null || error === void 0 ? void 0 : error.message
137
+ });
138
+ } else {
139
+ await (0, _tracker.trackEvent)('config_software_update_error', { ...baseTrackingInfo,
140
+ ...updateData,
141
+ error: error === null || error === void 0 ? void 0 : error.message
142
+ });
143
+ }
144
+
145
+ throw error;
146
+ }
147
+ });
@@ -19,5 +19,6 @@ var _command = _interopRequireDefault(require("../lib/cli/command"));
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
20
 
21
21
  (0, _command.default)({
22
- requiredArgs: 1
23
- }).command('get', 'Read current software settings').argv(process.argv);
22
+ requiredArgs: 1,
23
+ usage: 'vip @mysite.develop config software <action>'
24
+ }).command('get', 'Read current software settings').command('update', 'Update software settings').argv(process.argv);
@@ -97,7 +97,9 @@ cmd.argv(process.argv, async (arg, opt) => {
97
97
 
98
98
  try {
99
99
  await (0, _devEnvironmentCore.createEnvironment)(instanceData);
100
- await (0, _devEnvironmentCore.printEnvironmentInfo)(slug);
100
+ await (0, _devEnvironmentCore.printEnvironmentInfo)(slug, {
101
+ extended: false
102
+ });
101
103
  const message = '\n' + _chalk.default.green('✓') + ` environment created.\n\nTo start it please run:\n\n${startCommand}\n`;
102
104
  console.log(message);
103
105
  await (0, _tracker.trackEvent)('dev_env_create_command_success', trackingInfo);
@@ -35,7 +35,7 @@ const examples = [{
35
35
  usage: `${_devEnvironment.DEV_ENVIRONMENT_FULL_COMMAND} info --slug=my_site`,
36
36
  description: 'Return information about a local dev environment named "my_site"'
37
37
  }];
38
- (0, _command.default)().option('slug', 'Custom name of the dev environment').option('all', 'Show Info for all local dev environments').examples(examples).argv(process.argv, async (arg, opt) => {
38
+ (0, _command.default)().option('slug', 'Custom name of the dev environment').option('all', 'Show Info for all local dev environments').option('extended', 'Show extended information about the dev environment').examples(examples).argv(process.argv, async (arg, opt) => {
39
39
  await (0, _devEnvironmentCli.validateDependencies)();
40
40
  const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
41
41
  const trackingInfo = opt.all ? {
@@ -45,10 +45,14 @@ const examples = [{
45
45
  debug('Args: ', arg, 'Options: ', opt);
46
46
 
47
47
  try {
48
+ const options = {
49
+ extended: !!opt.extended
50
+ };
51
+
48
52
  if (opt.all) {
49
- await (0, _devEnvironmentCore.printAllEnvironmentsInfo)();
53
+ await (0, _devEnvironmentCore.printAllEnvironmentsInfo)(options);
50
54
  } else {
51
- await (0, _devEnvironmentCore.printEnvironmentInfo)(slug);
55
+ await (0, _devEnvironmentCore.printEnvironmentInfo)(slug, options);
52
56
  }
53
57
 
54
58
  await (0, _tracker.trackEvent)('dev_env_info_command_success', trackingInfo);
@@ -229,6 +229,7 @@ const bindReconnectEvents = ({
229
229
  currentJob.socket.io.removeAllListeners('reconnect');
230
230
  currentJob.socket.io.removeAllListeners('reconnect_attempt');
231
231
  currentJob.socket.removeAllListeners('retry');
232
+ currentJob.socket.removeAllListeners('connect_error');
232
233
  currentJob.socket.io.on('reconnect', async () => {
233
234
  debug('socket.io: reconnect');
234
235
 
@@ -286,6 +287,20 @@ const bindReconnectEvents = ({
286
287
  currentJob.socket.io.engine.close();
287
288
  }, 5000);
288
289
  });
290
+ currentJob.socket.on('connect_error', () => {
291
+ debug('socket: connect_error; forcing the preference for websocket');
292
+
293
+ _rollbar.rollbar.info('WP-CLI socket.on( \'connect_error\' )', {
294
+ custom: {
295
+ code: 'wp-cli-on-connect_error',
296
+ commandGuid: cliCommand.guid
297
+ }
298
+ }); // Force the preference for WebSocket in case we see an error during connection
299
+ // https://socket.io/docs/v3/client-initialization/#low-level-engine-options
300
+
301
+
302
+ currentJob.socket.io.opts.transports = ['websocket', 'polling'];
303
+ });
289
304
  currentJob.socket.on('exit', async ({
290
305
  exitCode,
291
306
  message
@@ -479,12 +494,16 @@ const bindReconnectEvents = ({
479
494
  }
480
495
 
481
496
  const token = await _token.default.get();
497
+ const extraHeaders = {
498
+ Authorization: `Bearer ${token.raw}`
499
+ };
482
500
  const socket = (0, _socket.default)(`${_api.API_HOST}/wp-cli`, {
483
501
  transportOptions: {
484
502
  polling: {
485
- extraHeaders: {
486
- Authorization: `Bearer ${token.raw}`
487
- }
503
+ extraHeaders
504
+ },
505
+ websocket: {
506
+ extraHeaders
488
507
  }
489
508
  },
490
509
  agent: (0, _proxyAgent.createProxyAgent)(_api.API_HOST)
package/dist/bin/vip.js CHANGED
@@ -23,6 +23,8 @@ var _tracker = require("../lib/tracker");
23
23
 
24
24
  var _rollbar = require("../lib/rollbar");
25
25
 
26
+ var _logout = _interopRequireDefault(require("../lib/logout"));
27
+
26
28
  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); }
27
29
 
28
30
  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; }
@@ -45,8 +47,7 @@ const tokenURL = 'https://dashboard.wpvip.com/me/cli/token';
45
47
  const runCmd = async function () {
46
48
  const cmd = (0, _command.default)();
47
49
  cmd.command('logout', 'Logout from your current session', async () => {
48
- await _token.default.purge();
49
- await (0, _tracker.trackEvent)('logout_command_execute');
50
+ await (0, _logout.default)();
50
51
  console.log('You are successfully logged out.');
51
52
  }).command('app', 'List and modify your 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('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('sync', 'Sync production to a development environment').command('whoami', 'Display details about the currently logged-in user').command('wp', 'Run WP CLI commands against an environment');
52
53
  cmd.argv(process.argv);
@@ -56,10 +57,11 @@ const rootCmd = async function () {
56
57
  let token = await _token.default.get();
57
58
  const isHelpCommand = process.argv.some(arg => arg === 'help' || arg === '-h' || arg === '--help');
58
59
  const isLogoutCommand = process.argv.some(arg => arg === 'logout');
60
+ const isLoginCommand = process.argv.some(arg => arg === 'login');
59
61
  const isDevEnvCommandWithoutEnv = process.argv.some(arg => arg === 'dev-env') && !(0, _command.containsAppEnvArgument)(process.argv);
60
62
  debug('Argv:', process.argv);
61
63
 
62
- if (isLogoutCommand || isHelpCommand || isDevEnvCommandWithoutEnv || token && token.valid()) {
64
+ if (!isLoginCommand && (isLogoutCommand || isHelpCommand || isDevEnvCommandWithoutEnv || token && token.valid())) {
63
65
  runCmd();
64
66
  } else {
65
67
  console.log();
@@ -142,6 +144,12 @@ const rootCmd = async function () {
142
144
 
143
145
  await (0, _tracker.aliasUser)(token.id);
144
146
  await (0, _tracker.trackEvent)('login_command_token_submit_success');
147
+
148
+ if (isLoginCommand) {
149
+ console.log('You are now logged in - see `vip -h` for a list of available commands.');
150
+ process.exit();
151
+ }
152
+
145
153
  runCmd();
146
154
  }
147
155
  };
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _api = _interopRequireDefault(require("../../api"));
8
+ var _http = _interopRequireDefault(require("../../api/http"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
@@ -75,10 +75,7 @@ class Pendo {
75
75
  visitorId: `${this.context.userId}`
76
76
  };
77
77
  debug('send()', body);
78
- const {
79
- apiFetch
80
- } = await (0, _api.default)();
81
- const response = await apiFetch(Pendo.ENDPOINT, {
78
+ const response = await (0, _http.default)(Pendo.ENDPOINT, {
82
79
  method: 'POST',
83
80
  body
84
81
  });
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _nodeFetch = _interopRequireDefault(require("node-fetch"));
9
+
10
+ var _token = _interopRequireDefault(require("../token"));
11
+
12
+ var _env = _interopRequireDefault(require("../env"));
13
+
14
+ var _proxyAgent = require("../http/proxy-agent");
15
+
16
+ var _api = require("../api");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ /**
21
+ * External dependencies
22
+ */
23
+
24
+ /**
25
+ * Internal dependencies
26
+ */
27
+ const debug = require('debug')('@automattic/vip:http');
28
+ /**
29
+ * Call the Public API with an arbitrary path (e.g. to connect to REST endpoints).
30
+ * This will include the token in an Authorization header so requests are "logged-in."
31
+ *
32
+ * This is simply a wrapper around node-fetch
33
+ *
34
+ * @param {string} path API path to pass to `fetch` -- will be prefixed by the API_HOST
35
+ * @param {object} options options to pass to `fetch`
36
+ * @returns {Promise} Return value of the `fetch` call
37
+ */
38
+
39
+
40
+ var _default = async (path, options = {}) => {
41
+ let url = path; // For convenience, we support just passing in the path to this function...
42
+ // but some things (Apollo) always pass the full url
43
+
44
+ if (!path.startsWith(_api.API_HOST)) {
45
+ url = `${_api.API_HOST}${path}`;
46
+ }
47
+
48
+ const authToken = await _token.default.get();
49
+ const headers = {
50
+ 'User-Agent': _env.default.userAgent,
51
+ Authorization: authToken ? `Bearer ${authToken.raw}` : null
52
+ };
53
+ const proxyAgent = (0, _proxyAgent.createProxyAgent)(url);
54
+ debug('running fetch', url);
55
+ return (0, _nodeFetch.default)(url, { ...options,
56
+ ...{
57
+ agent: proxyAgent,
58
+ headers: { ...headers,
59
+ ...{
60
+ 'Content-Type': 'application/json'
61
+ },
62
+ ...options.headers
63
+ }
64
+ },
65
+ ...{
66
+ body: typeof options.body === 'object' ? JSON.stringify(options.body) : options.body
67
+ }
68
+ });
69
+ };
70
+
71
+ exports.default = _default;
package/dist/lib/api.js CHANGED
@@ -97,10 +97,13 @@ async function API({
97
97
  return forward(operation);
98
98
  });
99
99
  const proxyAgent = (0, _proxyAgent.createProxyAgent)(API_URL);
100
+
101
+ const http = require("./api/http").default;
102
+
100
103
  const httpLink = new _core.HttpLink({
101
104
  uri: API_URL,
102
105
  headers,
103
- fetch: _nodeFetch.default,
106
+ fetch: http,
104
107
  fetchOptions: {
105
108
  agent: proxyAgent
106
109
  }
@@ -109,28 +112,5 @@ async function API({
109
112
  link: _core2.ApolloLink.from([withToken, errorLink, authLink, httpLink]),
110
113
  cache: new _core.InMemoryCache()
111
114
  });
112
- /**
113
- * Call the Public API with an arbitrary path (e.g. to connect to REST endpoints).
114
- * This will include the token in an Authorization header so requests are "logged-in."
115
- * @param {string} path API path to pass to `fetch` -- will be prefixed by the API_HOST
116
- * @param {object} options options to pass to `fetch`
117
- * @returns {Promise} Return value of the `fetch` call
118
- */
119
-
120
- apiClient.apiFetch = (path, options = {}) => (0, _nodeFetch.default)(`${API_HOST}${path}`, { ...options,
121
- ...{
122
- agent: proxyAgent,
123
- headers: { ...headers,
124
- ...{
125
- 'Content-Type': 'application/json'
126
- },
127
- ...options.headers
128
- }
129
- },
130
- ...{
131
- body: typeof options.body === 'object' ? JSON.stringify(options.body) : options.body
132
- }
133
- });
134
-
135
115
  return apiClient;
136
116
  }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isAppWordPress = isAppWordPress;
7
+ exports.isAppNodejs = isAppNodejs;
8
+
9
+ var _vipgo = require("./constants/vipgo");
10
+
11
+ /**
12
+ * External dependencies
13
+ */
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+
19
+ /**
20
+ * Is this a WordPress application?
21
+ * @param {int} appTypeId application type ID
22
+ * @constructor
23
+ */
24
+ function isAppWordPress(appTypeId) {
25
+ return _vipgo.WORDPRESS_SITE_TYPE_IDS.includes(appTypeId);
26
+ }
27
+ /**
28
+ * Is this a Nodejs application?
29
+ * @param {int} appTypeId application type ID
30
+ * @constructor
31
+ */
32
+
33
+
34
+ function isAppNodejs(appTypeId) {
35
+ return _vipgo.NODEJS_SITE_TYPE_IDS.includes(appTypeId);
36
+ }
@@ -29,8 +29,6 @@ var _package = _interopRequireDefault(require("../../../package.json"));
29
29
 
30
30
  var _tracker = require("../tracker");
31
31
 
32
- var _pager = _interopRequireDefault(require("./pager"));
33
-
34
32
  var _envAlias = require("./envAlias");
35
33
 
36
34
  var _rollbar = require("../rollbar");
@@ -39,7 +37,7 @@ var exit = _interopRequireWildcard(require("./exit"));
39
37
 
40
38
  var _debug = _interopRequireDefault(require("debug"));
41
39
 
42
- var _userError = _interopRequireDefault(require("./userError"));
40
+ var _userError = _interopRequireDefault(require("../user-error"));
43
41
 
44
42
  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); }
45
43
 
@@ -526,9 +524,7 @@ _args.default.argv = async function (argv, cb) {
526
524
  format: options.format
527
525
  });
528
526
  const formattedOut = (0, _format.formatData)(res, options.format);
529
- const page = (0, _pager.default)();
530
- page.write(formattedOut + '\n');
531
- page.end();
527
+ console.log(formattedOut);
532
528
  return {};
533
529
  }
534
530
  }
@@ -39,7 +39,7 @@ var _xml2js = require("xml2js");
39
39
 
40
40
  var _debug = _interopRequireDefault(require("debug"));
41
41
 
42
- var _api = _interopRequireDefault(require("./api"));
42
+ var _http = _interopRequireDefault(require("./api/http"));
43
43
 
44
44
  var _fileSize = require("./constants/file-size");
45
45
 
@@ -308,10 +308,7 @@ async function getSignedUploadRequestData({
308
308
  uploadId = undefined,
309
309
  partNumber = undefined
310
310
  }) {
311
- const {
312
- apiFetch
313
- } = await (0, _api.default)();
314
- const response = await apiFetch('/upload/site-import-presigned-url', {
311
+ const response = await (0, _http.default)('/upload/site-import-presigned-url', {
315
312
  method: 'POST',
316
313
  body: {
317
314
  action,