@automattic/vip
Advanced tools
Comparing version 1.4.0-dev8 to 1.4.0-dev9
@@ -20,2 +20,4 @@ #!/usr/bin/env node | ||
var _os = require("os"); | ||
var _api = _interopRequireWildcard(require("../lib/api")); | ||
@@ -154,3 +156,5 @@ | ||
if (isSubShell) { | ||
console.log(`Welcome to the WP CLI shell for the ${(0, _format.formatEnvironment)(envName)} environment of ${_chalk.default.green(appName)} (${opts.env.primaryDomain.name})!`); | ||
console.log(`Welcome to the WP CLI shell for the ${(0, _format.formatEnvironment)(envName)} environment of ${_chalk.default.green(appName)} (${opts.env.primaryDomain.name})!`); // We'll handle our own errors, thank you | ||
(0, _api.disableGlobalGraphQLErrorHandling)(); | ||
const promptIdentifier = `${appName}.${(0, _command.getEnvIdentifier)(opts.env)}`; | ||
@@ -203,3 +207,13 @@ let commandRunning = false; | ||
} catch (e) { | ||
console.log(e); | ||
// If this was a GraphQL error, print that to the message to the line | ||
if (e.graphQLErrors) { | ||
e.graphQLErrors.forEach(error => { | ||
console.log(_chalk.default.red('Error:'), error.message); | ||
}); | ||
} else { | ||
// Else, other type of error, just dump it | ||
console.log(e); | ||
} | ||
subShellRl.prompt(); | ||
return; | ||
@@ -231,3 +245,9 @@ } | ||
process.stdin.unpipe(commandStreams.stdinStream); | ||
commandStreams.stdoutStream.unpipe(process.stdout); | ||
commandStreams.stdoutStream.unpipe(process.stdout); // Need a newline - WP CLI doesn't always send one :( | ||
// https://github.com/wp-cli/wp-cli/blob/779bdd16025cb718260b35fd2b69ae47ca80cb91/php/WP_CLI/Formatter.php#L129-L141 | ||
if (line.includes('--format=count') || line.includes('--format="count"') || line.includes('--format=\'count\'') || line.includes('--format=ids') || line.includes('--format="ids"') || line.includes('--format=\'ids\'')) { | ||
process.stdout.write(_os.EOL); | ||
} | ||
subShellRl.resume(); | ||
@@ -234,0 +254,0 @@ subShellRl.prompt(); |
@@ -111,4 +111,6 @@ #!/usr/bin/env node | ||
throw e; | ||
} | ||
} //de-anonymize user for tracking | ||
await (0, _tracker.aliasUser)(token.id); | ||
await (0, _tracker.trackEvent)('login_command_token_submit_success'); // Exec the command we originally wanted | ||
@@ -115,0 +117,0 @@ |
@@ -6,2 +6,3 @@ "use strict"; | ||
}); | ||
exports.disableGlobalGraphQLErrorHandling = disableGlobalGraphQLErrorHandling; | ||
exports.default = API; | ||
@@ -36,3 +37,8 @@ exports.API_URL = exports.API_HOST = exports.PRODUCTION_API_HOST = void 0; | ||
exports.API_URL = API_URL; | ||
let globalGraphQLErrorHandlingEnabled = true; | ||
function disableGlobalGraphQLErrorHandling() { | ||
globalGraphQLErrorHandlingEnabled = false; | ||
} | ||
async function API() { | ||
@@ -55,3 +61,3 @@ const token = await _token.default.get(); | ||
if (graphQLErrors && graphQLErrors.length) { | ||
if (graphQLErrors && graphQLErrors.length && globalGraphQLErrorHandlingEnabled) { | ||
graphQLErrors.forEach(error => { | ||
@@ -58,0 +64,0 @@ console.error(_chalk.default.red('Error:'), error.message); |
@@ -97,2 +97,7 @@ "use strict"; | ||
static async setUuid(_uuid) { | ||
const service = Token.getServiceName('-uuid'); | ||
await _keychain.default.setPassword(service, _uuid); | ||
} | ||
static async set(token) { | ||
@@ -99,0 +104,0 @@ const service = Token.getServiceName(); |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.trackEvent = trackEvent; | ||
exports.aliasUser = aliasUser; | ||
@@ -56,2 +57,4 @@ var _index = _interopRequireDefault(require("./analytics/index")); | ||
async function trackEvent(...args) { | ||
const id = await _token.default.uuid(); | ||
try { | ||
@@ -63,2 +66,18 @@ const client = await getInstance(); | ||
} | ||
} | ||
async function aliasUser(vipUserId) { | ||
try { | ||
if (vipUserId) { | ||
await trackEvent('_alias_user', { | ||
ui: vipUserId, | ||
_ut: _config.default.tracksUserType, | ||
anonid: _token.default.uuid() | ||
}); | ||
_token.default.setUuid(vipUserId); | ||
} | ||
} catch (e) { | ||
debug('aliasUser() failed', e); | ||
} | ||
} |
{ | ||
"name": "@automattic/vip", | ||
"version": "1.4.0-dev8", | ||
"version": "1.4.0-dev9", | ||
"description": "The VIP Go Javascript library & CLI", | ||
@@ -50,5 +50,5 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@babel/cli": "7.2.3", | ||
"@babel/core": "7.4.0", | ||
"@babel/plugin-transform-modules-commonjs": "7.4.0", | ||
"@babel/cli": "7.4.4", | ||
"@babel/core": "7.4.4", | ||
"@babel/plugin-transform-modules-commonjs": "7.4.4", | ||
"@babel/preset-flow": "7.0.0", | ||
@@ -59,3 +59,3 @@ "babel-core": "7.0.0-bridge.0", | ||
"babel-plugin-module-resolver": "3.2.0", | ||
"core-js": "3.0.0", | ||
"core-js": "3.0.1", | ||
"eslines": "1.1.0", | ||
@@ -65,3 +65,3 @@ "eslint": "5.16.0", | ||
"eslint-plugin-flowtype": "3.4.2", | ||
"eslint-plugin-import": "2.16.0", | ||
"eslint-plugin-import": "2.17.2", | ||
"eslint-plugin-json": "1.4.0", | ||
@@ -78,29 +78,29 @@ "eslint-plugin-jsx-a11y": "6.2.1", | ||
"dependencies": { | ||
"apollo-cache-inmemory": "~1.5.0", | ||
"apollo-client": "~2.5.0", | ||
"apollo-link-error": "^1.1.8", | ||
"apollo-link-http": "~1.5.5", | ||
"args": "~5.0.0", | ||
"chalk": "~2.4.1", | ||
"apollo-cache-inmemory": "1.5.0", | ||
"apollo-client": "2.5.0", | ||
"apollo-link-error": "1.1.8", | ||
"apollo-link-http": "1.5.5", | ||
"args": "5.0.0", | ||
"chalk": "2.4.1", | ||
"cli-table": "github:automattic/cli-table#7b14232", | ||
"configstore": "^4.0.0", | ||
"debug": "~4.1.0", | ||
"enquirer": "^2.3.0", | ||
"graphql": "~14.1.0", | ||
"graphql-tag": "~2.10.0", | ||
"ini": "~1.3.5", | ||
"isomorphic-fetch": "~2.2.1", | ||
"json2csv": "~4.3.0", | ||
"jwt-decode": "~2.2.0", | ||
"opn": "~5.4.0", | ||
"semver": "~5.6.0", | ||
"single-line-log": "~1.1.2", | ||
"socket.io-client": "^2.2.0", | ||
"socket.io-stream": "^0.9.1", | ||
"update-notifier": "~2.5.0", | ||
"uuid": "~3.3.0" | ||
"configstore": "4.0.0", | ||
"debug": "4.1.0", | ||
"enquirer": "2.3.0", | ||
"graphql": "14.1.0", | ||
"graphql-tag": "2.10.0", | ||
"ini": "1.3.5", | ||
"isomorphic-fetch": "2.2.1", | ||
"json2csv": "4.3.0", | ||
"jwt-decode": "2.2.0", | ||
"opn": "5.4.0", | ||
"semver": "6.0.0", | ||
"single-line-log": "1.1.2", | ||
"socket.io-client": "2.2.0", | ||
"socket.io-stream": "0.9.1", | ||
"update-notifier": "2.5.0", | ||
"uuid": "3.3.0" | ||
}, | ||
"optionalDependencies": { | ||
"keytar": "^4.1.0" | ||
"keytar": "4.1.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79311
36
2046
+ Addedansi-colors@3.2.4(transitive)
+ Addedapollo-cache@1.2.0(transitive)
+ Addedapollo-cache-inmemory@1.5.0(transitive)
+ Addedapollo-client@2.5.0(transitive)
+ Addedapollo-link-error@1.1.8(transitive)
+ Addedapollo-link-http@1.5.5(transitive)
+ Addedapollo-utilities@1.2.0(transitive)
+ Addedargs@5.0.0(transitive)
+ Addedasync-limiter@1.0.1(transitive)
+ Addedbase64-arraybuffer@0.1.5(transitive)
+ Addedbetter-assert@1.0.2(transitive)
+ Addedcallsite@1.0.0(transitive)
+ Addedchalk@2.4.1(transitive)
+ Addedcomponent-emitter@1.2.1(transitive)
+ Addeddebug@4.1.0(transitive)
+ Addedengine.io-client@3.3.3(transitive)
+ Addedengine.io-parser@2.1.3(transitive)
+ Addedenquirer@2.3.0(transitive)
+ Addedgraphql@14.1.0(transitive)
+ Addedgraphql-tag@2.10.0(transitive)
+ Addedini@1.3.5(transitive)
+ Addedjson2csv@4.3.0(transitive)
+ Addedkeytar@4.1.0(transitive)
+ Addedlodash.clonedeep@4.5.0(transitive)
+ Addedlodash.set@4.3.2(transitive)
+ Addedmri@1.1.1(transitive)
+ Addednan@2.5.1(transitive)
+ Addedobject-component@0.0.3(transitive)
+ Addedparseqs@0.0.5(transitive)
+ Addedparseuri@0.0.5(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsemver@5.7.26.0.0(transitive)
+ Addedsocket.io-client@2.2.0(transitive)
+ Addeduuid@3.3.0(transitive)
+ Addedws@6.1.4(transitive)
- Removedansi-colors@4.1.3(transitive)
- Removedansi-regex@5.0.1(transitive)
- Removedapollo-cache@1.2.1(transitive)
- Removedapollo-cache-inmemory@1.5.1(transitive)
- Removedapollo-client@2.5.1(transitive)
- Removedapollo-link-error@1.1.13(transitive)
- Removedapollo-link-http@1.5.17(transitive)
- Removedapollo-utilities@1.2.1(transitive)
- Removedaproba@1.2.0(transitive)
- Removedare-we-there-yet@1.1.7(transitive)
- Removedargs@5.0.3(transitive)
- Removedbase64-arraybuffer@0.1.4(transitive)
- Removedbl@1.2.3(transitive)
- Removedbuffer-alloc@1.2.0(transitive)
- Removedbuffer-alloc-unsafe@1.1.0(transitive)
- Removedbuffer-fill@1.0.0(transitive)
- Removedchalk@2.4.2(transitive)
- Removedchownr@1.1.4(transitive)
- Removedconsole-control-strings@1.1.0(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@4.1.1(transitive)
- Removeddecompress-response@3.3.0(transitive)
- Removeddelegates@1.0.0(transitive)
- Removeddetect-libc@1.0.3(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedengine.io-client@3.5.4(transitive)
- Removedengine.io-parser@2.2.1(transitive)
- Removedenquirer@2.4.1(transitive)
- Removedexpand-template@2.0.3(transitive)
- Removedfs-constants@1.0.0(transitive)
- Removedgauge@2.7.4(transitive)
- Removedgithub-from-package@0.0.0(transitive)
- Removedgraphql@14.1.1(transitive)
- Removedgraphql-tag@2.10.4(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedinherits@2.0.4(transitive)
- Removedini@1.3.8(transitive)
- Removedisarray@1.0.0(transitive)
- Removedjson2csv@4.3.5(transitive)
- Removedkeytar@4.13.0(transitive)
- Removedmimic-response@1.0.1(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedmri@1.1.4(transitive)
- Removednan@2.14.0(transitive)
- Removednapi-build-utils@1.0.2(transitive)
- Removednode-abi@2.30.1(transitive)
- Removednoop-logger@0.1.1(transitive)
- Removednpmlog@4.1.2(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedparseqs@0.0.6(transitive)
- Removedparseuri@0.0.6(transitive)
- Removedprebuild-install@5.3.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedpump@1.0.32.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsemver@5.6.0(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedsimple-concat@1.0.1(transitive)
- Removedsimple-get@2.8.2(transitive)
- Removedsocket.io-client@2.5.0(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedstrip-ansi@6.0.1(transitive)
- Removedtar-fs@1.16.3(transitive)
- Removedtar-stream@1.6.2(transitive)
- Removedto-buffer@1.1.1(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removeduuid@3.3.3(transitive)
- Removedwhich-pm-runs@1.1.0(transitive)
- Removedwide-align@1.1.5(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedws@7.5.10(transitive)
- Removedxtend@4.0.2(transitive)
Updatedapollo-cache-inmemory@1.5.0
Updatedapollo-client@2.5.0
Updatedapollo-link-error@1.1.8
Updatedapollo-link-http@1.5.5
Updatedargs@5.0.0
Updatedchalk@2.4.1
Updatedconfigstore@4.0.0
Updateddebug@4.1.0
Updatedenquirer@2.3.0
Updatedgraphql@14.1.0
Updatedgraphql-tag@2.10.0
Updatedini@1.3.5
Updatedisomorphic-fetch@2.2.1
Updatedjson2csv@4.3.0
Updatedjwt-decode@2.2.0
Updatedopn@5.4.0
Updatedsemver@6.0.0
Updatedsingle-line-log@1.1.2
Updatedsocket.io-client@2.2.0
Updatedsocket.io-stream@0.9.1
Updatedupdate-notifier@2.5.0
Updateduuid@3.3.0