npm package diff
Package: @forge/cli
Versions: 12.3.0-next.0-experimental-47556b0 - 12.3.0-next.0-experimental-8a53773
File: package/out/command-line/command.js
Index: package/out/command-line/command.js
===================================================================
--- package/out/command-line/command.js
+++ package/out/command-line/command.js
@@ -6,9 +6,8 @@
const semver_1 = tslib_1.__importDefault(require("semver"));
const cli_shared_1 = require("@forge/cli-shared");
const environment_1 = require("./environment");
const version_info_1 = require("./version-info");
-const anon_user_id_1 = require("./anon-user-id");
const errors_1 = require("./errors");
const command_suggestion_service_1 = tslib_1.__importDefault(require("../service/command-suggestion-service"));
const sentry_1 = require("./sentry");
class WrapperError extends commander_1.CommanderError {
@@ -207,9 +206,8 @@
}
actionProcessor = async (cb, ...args) => {
const cmdName = this.cmd.name();
const analyticsName = this.analyticsName ?? cmdName;
- let cred = (0, anon_user_id_1.getAnonId)(true);
let attributes = {};
try {
if (this.cliDetails) {
attributes = {
@@ -221,9 +219,9 @@
}
if (cmdName === 'tunnel') {
attributes['isCloudflareTunnel'] = true;
}
- this.analyticsClient.reportCommandInvoke(analyticsName, cred, attributes);
+ await this.analyticsClient.reportCommandInvoke(analyticsName, attributes);
const options = last(args);
await (0, sentry_1.setSentryCmdOptFlags)(analyticsName, options);
const nonInteractive = options.nonInteractive ?? false;
const json = options.json ?? false;
@@ -251,12 +249,9 @@
if (value) {
attributes[analyticsAttribute ?? preconditionAttribute] = value;
}
}
- const actualCred = await this.checkAuthentication();
- if (actualCred) {
- cred = actualCred;
- }
+ await this.checkAuthentication();
let accountId;
try {
accountId = (await this.credentialStore.getCredentials()).accountId;
}
@@ -266,23 +261,22 @@
await (0, sentry_1.setSentryEnvFlags)(accountId, attributes['appId']);
const result = await cb(...args);
if (result) {
attributes = { ...attributes, ...result.analytics };
- if (result.creds) {
- cred = result.creds;
- }
}
- this.analyticsClient.reportSuccess(analyticsName, cred, attributes);
+ await this.analyticsClient.reportSuccess(analyticsName, attributes);
}
catch (e) {
attributes = { ...(0, cli_shared_1.getErrorAttributes)(e), ...attributes };
- this.analyticsClient.reportInvokeFailure(analyticsName, cred, attributes, e);
+ await this.analyticsClient.reportInvokeFailure(analyticsName, attributes, e);
if (e instanceof errors_1.DeferredErrors) {
- e.getErrors().forEach((error) => this.analyticsClient.reportFailure(analyticsName, cred, attributes, error));
+ for (const err of e.getErrors()) {
+ await this.analyticsClient.reportFailure(analyticsName, attributes, err);
+ }
process.exit(1);
}
else {
- this.analyticsClient.reportFailure(analyticsName, cred, attributes, e);
+ await this.analyticsClient.reportFailure(analyticsName, attributes, e);
await (0, cli_shared_1.exitOnError)(this.ui, e);
}
}
};
@@ -343,15 +337,9 @@
this.findLastValidCommand(argv).command.outputHelp();
}
async reportHelp(cmdError) {
try {
- let cred = (0, anon_user_id_1.getAnonId)(true);
- try {
- cred = await this.credentialStore.getCredentials();
- }
- catch (noTokenError) {
- }
- this.analyticsClient.reportSuccess('help', cred, { command: cmdError.getCommandName() });
+ await this.analyticsClient.reportSuccess('help', { command: cmdError.getCommandName() });
}
catch (err) {
}
}