@automattic/vip 2.25.0 → 2.26.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 +34 -6
- package/assets/dev-env.lando.template.yml.ejs +7 -3
- package/automattic-vip-2.26.0.tgz +0 -0
- package/dist/bin/vip-config-software-get.js +1 -1
- package/dist/bin/vip-dev-env-import-sql.js +1 -1
- package/dist/bin/vip-dev-env-start.js +1 -1
- package/dist/bin/vip-import-media-abort.js +2 -2
- package/dist/bin/vip-import-sql.js +4 -4
- package/dist/bin/vip-import-validate-files.js +2 -4
- package/dist/bin/vip-logs.js +10 -1
- package/dist/bin/vip-sync.js +1 -1
- package/dist/bin/vip-validate-preflight.js +2 -2
- package/dist/bin/vip-wp.js +4 -4
- package/dist/lib/analytics/clients/pendo.js +1 -1
- package/dist/lib/analytics/clients/stub.js +1 -2
- package/dist/lib/analytics/index.js +0 -2
- package/dist/lib/api/app.js +1 -1
- package/dist/lib/api/cache-purge.js +1 -1
- package/dist/lib/api/feature-flags.js +1 -1
- package/dist/lib/api/http.js +7 -7
- package/dist/lib/api/user.js +1 -1
- package/dist/lib/api.js +1 -1
- package/dist/lib/app-logs/app-logs.js +1 -1
- package/dist/lib/app.js +6 -6
- package/dist/lib/cli/apiConfig.js +21 -28
- package/dist/lib/cli/command.js +91 -81
- package/dist/lib/cli/envAlias.js +15 -10
- package/dist/lib/cli/exit.js +1 -1
- package/dist/lib/cli/format.js +22 -7
- package/dist/lib/cli/progress.js +1 -2
- package/dist/lib/cli/prompt.js +1 -3
- package/dist/lib/cli/repo.js +0 -1
- package/dist/lib/client-file-uploader.js +14 -16
- package/dist/lib/config/software.js +0 -2
- package/dist/lib/dev-environment/dev-environment-cli.js +11 -5
- package/dist/lib/dev-environment/dev-environment-core.js +44 -19
- package/dist/lib/dev-environment/dev-environment-lando.js +76 -33
- package/dist/lib/envvar/api-delete.js +1 -1
- package/dist/lib/envvar/api-get-all.js +1 -1
- package/dist/lib/envvar/api-get.js +1 -1
- package/dist/lib/envvar/api-list.js +1 -1
- package/dist/lib/envvar/api-set.js +1 -1
- package/dist/lib/envvar/api.js +1 -1
- package/dist/lib/envvar/logging.js +1 -1
- package/dist/lib/envvar/read-file.js +1 -1
- package/dist/lib/http/proxy-agent.js +5 -6
- package/dist/lib/keychain/secure.js +0 -6
- package/dist/lib/keychain.js +6 -1
- package/dist/lib/logout.js +3 -3
- package/dist/lib/media-import/media-file-import.js +1 -1
- package/dist/lib/media-import/progress.js +2 -2
- package/dist/lib/media-import/status.js +6 -5
- package/dist/lib/read-file.js +1 -1
- package/dist/lib/rollbar.js +1 -1
- package/dist/lib/search-and-replace.js +11 -9
- package/dist/lib/site-import/db-file-import.js +1 -1
- package/dist/lib/site-import/status.js +6 -5
- package/dist/lib/sql-export.js +360 -0
- package/dist/lib/tracker.js +2 -2
- package/dist/lib/utils.js +28 -0
- package/dist/lib/validations/is-multi-site-sql-dump.js +3 -40
- package/dist/lib/validations/is-multi-site.js +4 -5
- package/dist/lib/validations/is-multisite-domain-mapped.js +15 -18
- package/dist/lib/validations/line-by-line.js +4 -14
- package/dist/lib/validations/site-type.js +5 -5
- package/dist/lib/validations/sql.js +16 -16
- package/dist/lib/validations/utils.js +2 -2
- package/dist/lib/vip-import-validate-files.js +44 -44
- package/npm-shrinkwrap.json +21091 -4237
- package/package.json +9 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
### 2.26.0
|
|
4
|
+
|
|
5
|
+
- #1237 Skip requoting if the arg is a valid JSON Object
|
|
6
|
+
- #1258 fix(dev-env): Get more verbose logs from Lando in debug mode
|
|
7
|
+
- #1249 refactor(dev-env): Do not use Lando's memcached plugin
|
|
8
|
+
- #1266 fix(dev-env): Fix incorrect working directory when vip dev-env exec is run from a 8 level deep directory
|
|
9
|
+
- #1263 Dev-env: Do not prompt to update WP version if trunk is used
|
|
10
|
+
- #1244 chore(deps): Pin @apollo/client to 3.3.6
|
|
11
|
+
- #1261 fix(dev-env): Gracefully handle failures to fetch WP versions
|
|
12
|
+
- #1257 fix(dev-env): Fix "This app was built on a different version of Lando" warning
|
|
13
|
+
- #1260 Config Software: fix small typo in "include" usage
|
|
14
|
+
- #1250 feat(dev-env): Implement upgrade path for changes affecting .lando.yml
|
|
15
|
+
- #1259 Add notifications commands to package.json
|
|
16
|
+
- #1228 fix(dev-env): Do not use a temporary directory for Lando
|
|
17
|
+
- #1251 Fix lint errors fix/lint-errors
|
|
18
|
+
- #1247 Add library to facilitate SQL backup export
|
|
19
|
+
- #1246 fix(dev-env): ElasticSearch => Elasticsearch
|
|
20
|
+
- #1243 fix: Fix peer dependencies and code style issues
|
|
21
|
+
- #1242 chore: Set minimum Node.js version to 16
|
|
22
|
+
|
|
23
|
+
### 2.25.1
|
|
24
|
+
|
|
25
|
+
- #1239 Downgrade Apollo client to 3.3.6
|
|
26
|
+
|
|
27
|
+
### 2.25.0
|
|
4
28
|
|
|
5
29
|
- #1233 Update @automattic/vip-go-preflight-checks to 2.0.16
|
|
6
30
|
- #1232 fix(dev-env): Make environment existence check more robust
|
|
@@ -30,16 +54,20 @@
|
|
|
30
54
|
- #1200 fix(dev-env): Reuse Lando App instead of recreating it every time
|
|
31
55
|
- #1204 Dev-env: Update ES to 7.17.8 to match prod
|
|
32
56
|
- #1205 ci: Pass correct node-version in CI workflow
|
|
57
|
+
- #1199 fix(dev-env): Update `max_allowed_packet` to mirror prod envs
|
|
58
|
+
- #1194 Add debugger instructions
|
|
59
|
+
- #1196 fix(dev-env): Fix ambiguous short option for MailHog/MariaDB
|
|
60
|
+
- #1195 fix(dev-env): increase max number of event listeners for AsyncEvents
|
|
33
61
|
|
|
34
|
-
|
|
62
|
+
### 2.24.2 (22 Dec 2022)
|
|
35
63
|
|
|
36
64
|
- #1219 fix(dev-env): Fix search/replace on SQL file import
|
|
37
65
|
|
|
38
|
-
|
|
66
|
+
### 2.24.1 (10 Dec 2022)
|
|
39
67
|
|
|
40
68
|
- #1193 Fix regression in vip dev-env import sql related to the fact we don't mount User's home dir anymore
|
|
41
69
|
|
|
42
|
-
|
|
70
|
+
### 2.24.0 (06 Dec 2022)
|
|
43
71
|
|
|
44
72
|
- #1139 fix(dev-env): Fall back to copy when rename fails due to EXDEV
|
|
45
73
|
- #1170 [dev-env] Substitute the check for forward slash to with a cross-platform regex when processing component argument value
|
|
@@ -57,14 +85,14 @@
|
|
|
57
85
|
- #1188 fix: Make bin files executables
|
|
58
86
|
- #1189 refactor(dev-env): Bootstrap Lando only once
|
|
59
87
|
|
|
60
|
-
|
|
88
|
+
### 2.23.0 (11 Nov 2022)
|
|
61
89
|
|
|
62
90
|
- #1169 Preflight Validation: Change return code on error
|
|
63
91
|
- #1095 Harmonia Pre Deploy Validation: Add `validate` command
|
|
64
92
|
- #1156 Validate env before resolving path
|
|
65
93
|
- #1167 dev-env: Fix bug in getVersionList() when path doesn't exist
|
|
66
94
|
|
|
67
|
-
|
|
95
|
+
### 2.22.0 (2 Nov 2022)
|
|
68
96
|
|
|
69
97
|
#1165 Add caching type policy for `WPSite` data
|
|
70
98
|
#1164 Fix regExp to categorize multisite tables during SQL Imports
|
|
@@ -77,10 +77,14 @@ services:
|
|
|
77
77
|
database_data:
|
|
78
78
|
|
|
79
79
|
memcached:
|
|
80
|
-
type:
|
|
81
|
-
|
|
80
|
+
type: compose
|
|
81
|
+
services:
|
|
82
82
|
image: memcached:1.6-alpine3.16
|
|
83
|
-
command:
|
|
83
|
+
command: memcached -m 64
|
|
84
|
+
environment:
|
|
85
|
+
LANDO_NO_USER_PERMS: 1
|
|
86
|
+
LANDO_NO_SCRIPTS: 1
|
|
87
|
+
LANDO_NEEDS_EXEC: 1
|
|
84
88
|
|
|
85
89
|
<% if ( phpmyadmin ) { %>
|
|
86
90
|
phpmyadmin:
|
|
Binary file
|
|
@@ -37,7 +37,7 @@ const VALID_INCLUDES = ['available_versions'];
|
|
|
37
37
|
wildcardCommand: true,
|
|
38
38
|
format: true,
|
|
39
39
|
usage: 'vip @mysite.develop config software get <wordpress|php|nodejs|muplugins>'
|
|
40
|
-
}).option('include', `Extra information to be included.
|
|
40
|
+
}).option('include', `Extra information to be included. Valid values: ${VALID_INCLUDES.join(',')}`).examples(examples).argv(process.argv, async (arg, opt) => {
|
|
41
41
|
var _opt$env;
|
|
42
42
|
const trackingInfo = {
|
|
43
43
|
environment_id: (_opt$env = opt.env) === null || _opt$env === void 0 ? void 0 : _opt$env.id,
|
|
@@ -91,7 +91,7 @@ const examples = [{
|
|
|
91
91
|
await (0, _devEnvironmentCore.exec)(lando, slug, cacheArg);
|
|
92
92
|
try {
|
|
93
93
|
await (0, _devEnvironmentCore.exec)(lando, slug, ['wp', 'cli', 'has-command', 'vip-search']);
|
|
94
|
-
const doIndex = await (0, _devEnvironmentCli.promptForBoolean)('Do you want to index data in
|
|
94
|
+
const doIndex = await (0, _devEnvironmentCli.promptForBoolean)('Do you want to index data in Elasticsearch (used by Enterprise Search)?', true);
|
|
95
95
|
if (doIndex) {
|
|
96
96
|
await (0, _devEnvironmentCore.exec)(lando, slug, ['wp', 'vip-search', 'index', '--setup', '--network-wide', '--skip-confirm']);
|
|
97
97
|
}
|
|
@@ -49,7 +49,7 @@ const examples = [{
|
|
|
49
49
|
(0, _child_process.exec)(dockerWindowsPathCmd, {
|
|
50
50
|
shell: 'powershell.exe'
|
|
51
51
|
}, (error, stdout) => {
|
|
52
|
-
if (error
|
|
52
|
+
if (error) {
|
|
53
53
|
debug(error);
|
|
54
54
|
console.log(`${_chalk.default.red('✕')} There was an error while applying the Windows Docker patch.`);
|
|
55
55
|
} else {
|
|
@@ -23,8 +23,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
23
|
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; }
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
26
|
+
* Internal dependencies
|
|
27
|
+
*/
|
|
28
28
|
// eslint-disable-next-line no-duplicate-imports
|
|
29
29
|
const appQuery = `
|
|
30
30
|
id,
|
|
@@ -233,7 +233,7 @@ If you are confident the file does not contain unsupported statements, you can r
|
|
|
233
233
|
return (0, _sql.getTableNames)();
|
|
234
234
|
}
|
|
235
235
|
function validateFilename(filename) {
|
|
236
|
-
const re = /^[a-z0-9
|
|
236
|
+
const re = /^[a-z0-9\-_.]+$/i;
|
|
237
237
|
|
|
238
238
|
// Exits if filename contains anything outside a-z A-Z - _ .
|
|
239
239
|
if (!re.test(filename)) {
|
|
@@ -305,7 +305,7 @@ const displayPlaybook = ({
|
|
|
305
305
|
console.log(_chalk.default.yellowBright('You are updating tables in a launched multi site installation. Sites in the same network may have their performance impacted by this operation.'));
|
|
306
306
|
}
|
|
307
307
|
console.log(_chalk.default.yellow('The following sites will be affected by the import:'));
|
|
308
|
-
multiSiteBreakdown.
|
|
308
|
+
multiSiteBreakdown.forEach(siteObject => {
|
|
309
309
|
console.log();
|
|
310
310
|
console.log(_chalk.default.blueBright(`Blog with ID ${siteObject.id} and URL ${siteObject.url} will import the following tables:`));
|
|
311
311
|
console.log((0, _cliColumns.default)(siteObject.tables));
|
|
@@ -464,8 +464,8 @@ Processing the SQL import for your environment...
|
|
|
464
464
|
startImportVariables.input = {
|
|
465
465
|
id: app.id,
|
|
466
466
|
environmentId: env.id,
|
|
467
|
-
basename
|
|
468
|
-
md5
|
|
467
|
+
basename,
|
|
468
|
+
md5,
|
|
469
469
|
searchReplace: []
|
|
470
470
|
};
|
|
471
471
|
if (searchReplace) {
|
|
@@ -8,7 +8,6 @@ var _url = _interopRequireDefault(require("url"));
|
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
10
10
|
var _fs = _interopRequireDefault(require("fs"));
|
|
11
|
-
var _util = require("util");
|
|
12
11
|
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
13
12
|
var _vipImportValidateFiles = require("../lib/vip-import-validate-files");
|
|
14
13
|
var _tracker = require("../lib/tracker");
|
|
@@ -16,8 +15,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
16
15
|
/**
|
|
17
16
|
* Internal dependencies
|
|
18
17
|
*/
|
|
19
|
-
// Promisify to use async/await
|
|
20
|
-
const stat = (0, _util.promisify)(_fs.default.stat);
|
|
21
18
|
(0, _command.default)({
|
|
22
19
|
requiredArgs: 1,
|
|
23
20
|
format: true
|
|
@@ -79,7 +76,8 @@ const stat = (0, _util.promisify)(_fs.default.stat);
|
|
|
79
76
|
// Iterate through each file to isolate the extension name
|
|
80
77
|
for (const file of files) {
|
|
81
78
|
// Check if file is a directory
|
|
82
|
-
|
|
79
|
+
// eslint-disable-next-line no-await-in-loop
|
|
80
|
+
const stats = await _fs.default.promises.stat(file);
|
|
83
81
|
const isFolder = stats.isDirectory();
|
|
84
82
|
const extension = _path.default.extname(file); // Extract the extension of the file
|
|
85
83
|
const ext = extension.substr(1); // We only want the ext name minus the period (e.g- .jpg -> jpg)
|
package/dist/bin/vip-logs.js
CHANGED
|
@@ -12,6 +12,7 @@ exports.followLogs = followLogs;
|
|
|
12
12
|
exports.getLogs = getLogs;
|
|
13
13
|
exports.validateInputs = validateInputs;
|
|
14
14
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
15
|
+
var _promises = require("timers/promises");
|
|
15
16
|
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
16
17
|
var _rollbar = require("../lib/rollbar");
|
|
17
18
|
var _tracker = require("../lib/tracker");
|
|
@@ -68,6 +69,8 @@ async function followLogs(opt) {
|
|
|
68
69
|
|
|
69
70
|
// Set an initial default delay
|
|
70
71
|
let delay = DEFAULT_POLLING_DELAY_IN_SECONDS;
|
|
72
|
+
|
|
73
|
+
// eslint-disable-next-line no-constant-condition
|
|
71
74
|
while (true) {
|
|
72
75
|
const limit = isFirstRequest ? opt.limit : LIMIT_MAX;
|
|
73
76
|
requestNumber++;
|
|
@@ -77,12 +80,16 @@ async function followLogs(opt) {
|
|
|
77
80
|
let logs;
|
|
78
81
|
try {
|
|
79
82
|
var _logs;
|
|
83
|
+
// eslint-disable-next-line no-await-in-loop
|
|
80
84
|
logs = await logsLib.getRecentLogs(opt.app.id, opt.env.id, opt.type, limit, after);
|
|
85
|
+
|
|
86
|
+
// eslint-disable-next-line no-await-in-loop
|
|
81
87
|
await (0, _tracker.trackEvent)('logs_command_follow_success', {
|
|
82
88
|
...trackingParams,
|
|
83
89
|
total: (_logs = logs) === null || _logs === void 0 ? void 0 : _logs.nodes.length
|
|
84
90
|
});
|
|
85
91
|
} catch (error) {
|
|
92
|
+
// eslint-disable-next-line no-await-in-loop
|
|
86
93
|
await (0, _tracker.trackEvent)('logs_command_follow_error', {
|
|
87
94
|
...trackingParams,
|
|
88
95
|
error: error.message
|
|
@@ -110,7 +117,9 @@ async function followLogs(opt) {
|
|
|
110
117
|
// Keep a sane lower limit of MIN_POLLING_DELAY_IN_SECONDS just in case something goes wrong in the server-side
|
|
111
118
|
delay = Math.max(((_logs4 = logs) === null || _logs4 === void 0 ? void 0 : _logs4.pollingDelaySeconds) || DEFAULT_POLLING_DELAY_IN_SECONDS, MIN_POLLING_DELAY_IN_SECONDS);
|
|
112
119
|
}
|
|
113
|
-
|
|
120
|
+
|
|
121
|
+
// eslint-disable-next-line no-await-in-loop
|
|
122
|
+
await (0, _promises.setTimeout)(delay * 1000);
|
|
114
123
|
}
|
|
115
124
|
}
|
|
116
125
|
function getBaseTrackingParams(opt) {
|
package/dist/bin/vip-sync.js
CHANGED
|
@@ -426,8 +426,8 @@ async function validateArgs(opt) {
|
|
|
426
426
|
/**
|
|
427
427
|
* Remove sensitive information from the tracked events and snake_case the keys.
|
|
428
428
|
*
|
|
429
|
-
* @param {
|
|
430
|
-
* @
|
|
429
|
+
* @param {Object} args The arguments passed to the command.
|
|
430
|
+
* @return {Object} Copy of the arguments without sensitive information.
|
|
431
431
|
*/
|
|
432
432
|
function sanitizeArgsForTracking(args) {
|
|
433
433
|
const protectedKeys = ['npmToken', 'nodeBuildDockerEnv'];
|
package/dist/bin/vip-wp.js
CHANGED
|
@@ -136,7 +136,7 @@ const cancelCommand = async guid => {
|
|
|
136
136
|
`,
|
|
137
137
|
variables: {
|
|
138
138
|
input: {
|
|
139
|
-
guid
|
|
139
|
+
guid
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
});
|
|
@@ -220,7 +220,7 @@ const bindReconnectEvents = ({
|
|
|
220
220
|
currentJob = await launchCommandAndGetStreams({
|
|
221
221
|
socket: currentJob.socket,
|
|
222
222
|
guid: cliCommand.guid,
|
|
223
|
-
inputToken
|
|
223
|
+
inputToken,
|
|
224
224
|
offset: currentOffset
|
|
225
225
|
});
|
|
226
226
|
|
|
@@ -362,7 +362,7 @@ const bindReconnectEvents = ({
|
|
|
362
362
|
const promptIdentifier = `${appName}.${(0, _command.getEnvIdentifier)(opts.env)}`;
|
|
363
363
|
let countSIGINT = 0;
|
|
364
364
|
const mutableStdout = new _stream.Writable({
|
|
365
|
-
write
|
|
365
|
+
write(chunk, encoding, callback) {
|
|
366
366
|
if (!this.muted) {
|
|
367
367
|
process.stdout.write(chunk, encoding);
|
|
368
368
|
}
|
|
@@ -462,7 +462,7 @@ const bindReconnectEvents = ({
|
|
|
462
462
|
currentJob = await launchCommandAndGetStreams({
|
|
463
463
|
socket,
|
|
464
464
|
guid: cliCommand.guid,
|
|
465
|
-
inputToken
|
|
465
|
+
inputToken
|
|
466
466
|
});
|
|
467
467
|
pipeStreamsToProcess({
|
|
468
468
|
stdin: currentJob.stdinStream,
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _http = _interopRequireDefault(require("
|
|
7
|
+
var _http = _interopRequireDefault(require("../../../lib/api/http"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
9
|
/**
|
|
10
10
|
* External dependencies
|
|
@@ -7,11 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
10
|
class AnalyticsClientStub {
|
|
12
11
|
// eslint-disable-next-line no-unused-vars
|
|
13
12
|
trackEvent(name, props) {
|
|
14
|
-
return
|
|
13
|
+
return Promise.resolve(true);
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
exports.default = AnalyticsClientStub;
|
|
@@ -11,11 +11,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
11
11
|
/**
|
|
12
12
|
* External dependencies
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
14
|
/**
|
|
16
15
|
* Internal dependencies
|
|
17
16
|
*/
|
|
18
|
-
|
|
19
17
|
const debug = (0, _debug.default)('@automattic/vip:analytics');
|
|
20
18
|
|
|
21
19
|
/* eslint-disable camelcase */
|
package/dist/lib/api/app.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = _default;
|
|
7
7
|
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
8
|
-
var _api = _interopRequireDefault(require("
|
|
8
|
+
var _api = _interopRequireDefault(require("../../lib/api"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
/**
|
|
11
11
|
* External dependencies
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.appQuery = void 0;
|
|
7
7
|
exports.purgeCache = purgeCache;
|
|
8
8
|
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
9
|
-
var _api = _interopRequireDefault(require("
|
|
9
|
+
var _api = _interopRequireDefault(require("../../lib/api"));
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.get = get;
|
|
7
7
|
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
8
|
-
var _api = _interopRequireDefault(require("
|
|
8
|
+
var _api = _interopRequireDefault(require("../../lib/api"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
/**
|
|
11
11
|
* External dependencies
|
package/dist/lib/api/http.js
CHANGED
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
8
|
-
var _token = _interopRequireDefault(require("
|
|
9
|
-
var _env = _interopRequireDefault(require("
|
|
10
|
-
var _proxyAgent = require("
|
|
11
|
-
var _api = require("
|
|
8
|
+
var _token = _interopRequireDefault(require("../../lib/token"));
|
|
9
|
+
var _env = _interopRequireDefault(require("../../lib/env"));
|
|
10
|
+
var _proxyAgent = require("../../lib/http/proxy-agent");
|
|
11
|
+
var _api = require("../../lib/api");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
/**
|
|
14
14
|
* External dependencies
|
|
@@ -26,9 +26,9 @@ const debug = require('debug')('@automattic/vip:http');
|
|
|
26
26
|
*
|
|
27
27
|
* This is simply a wrapper around node-fetch
|
|
28
28
|
*
|
|
29
|
-
* @param {string} path
|
|
30
|
-
* @param {
|
|
31
|
-
* @
|
|
29
|
+
* @param {string} path API path to pass to `fetch` -- will be prefixed by the API_HOST
|
|
30
|
+
* @param {Object} options options to pass to `fetch`
|
|
31
|
+
* @return {Promise} Return value of the `fetch` call
|
|
32
32
|
*/
|
|
33
33
|
var _default = async (path, options = {}) => {
|
|
34
34
|
let url = path;
|
package/dist/lib/api/user.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getCurrentUserInfo = getCurrentUserInfo;
|
|
7
7
|
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
8
|
-
var _api = _interopRequireDefault(require("
|
|
8
|
+
var _api = _interopRequireDefault(require("../../lib/api"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
/**
|
|
11
11
|
*
|
package/dist/lib/api.js
CHANGED
|
@@ -14,7 +14,7 @@ var _error = require("@apollo/client/link/error");
|
|
|
14
14
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
15
15
|
var _token = _interopRequireDefault(require("./token"));
|
|
16
16
|
var _env = _interopRequireDefault(require("./env"));
|
|
17
|
-
var _proxyAgent = require("
|
|
17
|
+
var _proxyAgent = require("../lib/http/proxy-agent");
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.LIMIT_MAX = void 0;
|
|
7
7
|
exports.getRecentLogs = getRecentLogs;
|
|
8
8
|
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
9
|
-
var _api = _interopRequireDefault(require("
|
|
9
|
+
var _api = _interopRequireDefault(require("../../lib/api"));
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
/**
|
|
12
12
|
*
|
package/dist/lib/app.js
CHANGED
|
@@ -9,15 +9,14 @@ var _vipgo = require("./constants/vipgo");
|
|
|
9
9
|
/**
|
|
10
10
|
* External dependencies
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
12
|
/**
|
|
14
13
|
* Internal dependencies
|
|
15
14
|
*/
|
|
16
|
-
|
|
17
15
|
/**
|
|
18
16
|
* Is this a WordPress application?
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
17
|
+
*
|
|
18
|
+
* @param {number} appTypeId application type ID
|
|
19
|
+
* @return {boolean} Whether this a WordPress application
|
|
21
20
|
*/
|
|
22
21
|
function isAppWordPress(appTypeId) {
|
|
23
22
|
return _vipgo.WORDPRESS_SITE_TYPE_IDS.includes(appTypeId);
|
|
@@ -25,8 +24,9 @@ function isAppWordPress(appTypeId) {
|
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
26
|
* Is this a Nodejs application?
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
27
|
+
*
|
|
28
|
+
* @param {number} appTypeId application type ID
|
|
29
|
+
* @return {boolean} Whether this a Node.js application
|
|
30
30
|
*/
|
|
31
31
|
function isAppNodejs(appTypeId) {
|
|
32
32
|
return _vipgo.NODEJS_SITE_TYPE_IDS.includes(appTypeId);
|
|
@@ -6,26 +6,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.checkFeatureEnabled = checkFeatureEnabled;
|
|
7
7
|
exports.checkIfUserIsVip = checkIfUserIsVip;
|
|
8
8
|
exports.exitWhenFeatureDisabled = exitWhenFeatureDisabled;
|
|
9
|
-
var _tracker = require("
|
|
9
|
+
var _tracker = require("../../lib/tracker");
|
|
10
10
|
var exit = _interopRequireWildcard(require("./exit"));
|
|
11
|
-
var featureFlags = _interopRequireWildcard(require("
|
|
12
|
-
var _token = _interopRequireDefault(require("
|
|
11
|
+
var featureFlags = _interopRequireWildcard(require("../../lib/api/feature-flags"));
|
|
12
|
+
var _token = _interopRequireDefault(require("../../lib/token"));
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
|
-
|
|
17
|
-
*
|
|
18
|
-
* @format
|
|
19
|
-
*/
|
|
20
|
-
|
|
16
|
+
// @format
|
|
21
17
|
/**
|
|
22
18
|
* External dependencies
|
|
23
19
|
*/
|
|
24
|
-
|
|
25
20
|
/**
|
|
26
21
|
* Internal dependencies
|
|
27
22
|
*/
|
|
28
|
-
|
|
29
23
|
async function checkFeatureEnabled(featureName, exitOnFalse = false) {
|
|
30
24
|
// TODO: eventually let's look at more feature flags coming from the public api,
|
|
31
25
|
// for now, let's see if the user of the CLI is VIP
|
|
@@ -33,25 +27,24 @@ async function checkFeatureEnabled(featureName, exitOnFalse = false) {
|
|
|
33
27
|
featureName,
|
|
34
28
|
exitOnFalse
|
|
35
29
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
} catch (err) {
|
|
46
|
-
const message = err.toString();
|
|
47
|
-
await (0, _tracker.trackEvent)('checkFeatureEnabled_fetch_error', {
|
|
48
|
-
featureName,
|
|
49
|
-
exitOnFalse,
|
|
50
|
-
error: message
|
|
51
|
-
});
|
|
52
|
-
exit.withError('Failed to determine if feature is enabled' + message);
|
|
30
|
+
let isVIP;
|
|
31
|
+
try {
|
|
32
|
+
var _res$data, _res$data$me;
|
|
33
|
+
const res = await featureFlags.get();
|
|
34
|
+
if ((res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$me = _res$data.me) === null || _res$data$me === void 0 ? void 0 : _res$data$me.isVIP) !== undefined) {
|
|
35
|
+
isVIP = res.data.me.isVIP;
|
|
36
|
+
} else {
|
|
37
|
+
isVIP = false;
|
|
53
38
|
}
|
|
54
|
-
})
|
|
39
|
+
} catch (err) {
|
|
40
|
+
const message = err.toString();
|
|
41
|
+
await (0, _tracker.trackEvent)('checkFeatureEnabled_fetch_error', {
|
|
42
|
+
featureName,
|
|
43
|
+
exitOnFalse,
|
|
44
|
+
error: message
|
|
45
|
+
});
|
|
46
|
+
exit.withError('Failed to determine if feature is enabled' + message);
|
|
47
|
+
}
|
|
55
48
|
if (exitOnFalse === true && isVIP === false) {
|
|
56
49
|
exit.withError('The feature you are attempting to use is not currently enabled.');
|
|
57
50
|
}
|