@salesforce/plugin-telemetry 2.1.1 → 2.1.2
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/lib/commandExecution.d.ts +0 -2
- package/lib/commandExecution.js +35 -22
- package/lib/commandExecution.js.map +1 -1
- package/lib/{debuger.js → debugger.js} +1 -1
- package/lib/debugger.js.map +1 -0
- package/lib/hooks/telemetryPrerun.js +10 -10
- package/lib/hooks/telemetryPrerun.js.map +1 -1
- package/lib/telemetry.js +15 -15
- package/lib/telemetry.js.map +1 -1
- package/lib/uploader.js +5 -5
- package/lib/uploader.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +127 -24
- package/lib/debuger.js.map +0 -1
- package/lib/hooks/telemetryInit.d.ts +0 -10
- package/lib/hooks/telemetryInit.js +0 -23
- package/lib/hooks/telemetryInit.js.map +0 -1
- /package/lib/{debuger.d.ts → debugger.d.ts} +0 -0
package/lib/commandExecution.js
CHANGED
|
@@ -13,18 +13,15 @@ const core_1 = require("@oclif/core");
|
|
|
13
13
|
const core_2 = require("@salesforce/core");
|
|
14
14
|
const kit_1 = require("@salesforce/kit");
|
|
15
15
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
16
|
-
const
|
|
17
|
-
const telemetryInit_1 = require("./hooks/telemetryInit");
|
|
16
|
+
const debugger_1 = require("./debugger");
|
|
18
17
|
class CommandExecution extends kit_1.AsyncCreatable {
|
|
19
18
|
constructor(options) {
|
|
20
19
|
super(options);
|
|
21
20
|
this.specifiedFlags = [];
|
|
22
21
|
this.specifiedFlagFullNames = [];
|
|
23
|
-
this.start = Date.now();
|
|
24
22
|
this.command = options.command;
|
|
25
23
|
this.argv = options.argv;
|
|
26
24
|
this.config = options.config;
|
|
27
|
-
this.upTimeAtCmdStart = process.uptime() * 1000;
|
|
28
25
|
}
|
|
29
26
|
/**
|
|
30
27
|
* Determines whether the SFDX project is using GIT for version control or some other VCS.
|
|
@@ -37,7 +34,7 @@ class CommandExecution extends kit_1.AsyncCreatable {
|
|
|
37
34
|
possibleVcsPath = await core_2.SfProject.resolveProjectPath();
|
|
38
35
|
}
|
|
39
36
|
catch (err) {
|
|
40
|
-
(0,
|
|
37
|
+
(0, debugger_1.debug)('Not in a sfdx project, using current working directory');
|
|
41
38
|
possibleVcsPath = process.cwd();
|
|
42
39
|
}
|
|
43
40
|
const gitPath = (0, path_1.join)(possibleVcsPath, '.git');
|
|
@@ -84,10 +81,31 @@ class CommandExecution extends kit_1.AsyncCreatable {
|
|
|
84
81
|
// Don't log status or timestamp as a number, otherwise vscode will think it is a metric
|
|
85
82
|
status: (0, ts_types_1.isNumber)(this.status) ? this.status.toString() : undefined,
|
|
86
83
|
timestamp: String(Date.now()),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
// The amount of time (ms) required for oclif to execute the main `run` function.
|
|
85
|
+
// This does not represent the entire execution time of the command. The `processUptime`
|
|
86
|
+
// metric is the most accurate measure of how long the command execution.
|
|
87
|
+
//
|
|
88
|
+
// Our CLIs instantiate the Config before running oclif's `run` method, meaning that
|
|
89
|
+
// this metric will be less than the actual time spent in oclif.
|
|
90
|
+
'oclif.runMs': core_1.Performance.highlights.runTime,
|
|
91
|
+
// The amount of time (ms) required for oclif to get to the point where it can start running the command.
|
|
92
|
+
'oclif.initMs': core_1.Performance.highlights.initTime,
|
|
93
|
+
// The amount of time (ms) required for oclif to load the Config.
|
|
94
|
+
'oclif.configLoadMs': core_1.Performance.highlights.configLoadTime,
|
|
95
|
+
// The amount of time (ms) required for oclif to load the command.
|
|
96
|
+
'oclif.commandLoadMs': core_1.Performance.highlights.commandLoadTime,
|
|
97
|
+
// The amount of time (ms) required for oclif to load core (i.e. bundled) plugins.
|
|
98
|
+
'oclif.corePluginsLoadMs': core_1.Performance.highlights.corePluginsLoadTime,
|
|
99
|
+
// The amount of time (ms) required for oclif to load user plugins.
|
|
100
|
+
'oclif.userPluginsLoadMs': core_1.Performance.highlights.userPluginsLoadTime,
|
|
101
|
+
// The amount of time (ms) required for oclif to load linked plugins.
|
|
102
|
+
'oclif.linkedPluginsLoadMs': core_1.Performance.highlights.linkedPluginsLoadTime,
|
|
103
|
+
// The amount of time (ms) required for oclif to run all the init hooks
|
|
104
|
+
'oclif.initHookMs': core_1.Performance.highlights.hookRunTimes.init?.total,
|
|
105
|
+
// The amount of time (ms) required for oclif to run all the prerun hooks
|
|
106
|
+
'oclif.prerunHookMs': core_1.Performance.highlights.hookRunTimes.prerun?.total,
|
|
107
|
+
// The amount of time (ms) required for oclif to run all the postrun hooks
|
|
108
|
+
'oclif.postrunHookMs': core_1.Performance.highlights.hookRunTimes.postrun?.total,
|
|
91
109
|
// Salesforce Information
|
|
92
110
|
// Set the usernames so the uploader can resolve it to orgIds.
|
|
93
111
|
// Since resolving org ids can make API calls, we want to do that in the
|
|
@@ -107,27 +125,24 @@ class CommandExecution extends kit_1.AsyncCreatable {
|
|
|
107
125
|
}
|
|
108
126
|
async init() {
|
|
109
127
|
const argv = this.argv;
|
|
110
|
-
const flagDefinitions = this.command.flags
|
|
111
|
-
// We can't get varargs on type Class, so we need to cast to any to parse flags properly
|
|
112
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
|
-
const anyCmd = this.command;
|
|
114
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
115
|
-
const commandDef = { flags: flagDefinitions, args: this.command.args, strict: !anyCmd.varargs };
|
|
116
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
128
|
+
const flagDefinitions = this.command.flags ?? {};
|
|
117
129
|
let flags = {};
|
|
118
130
|
try {
|
|
119
|
-
|
|
120
|
-
|
|
131
|
+
flags = (await core_1.Parser.parse(argv, {
|
|
132
|
+
flags: flagDefinitions,
|
|
133
|
+
args: this.command.args,
|
|
134
|
+
// @ts-expect-error because varargs is not on SfCommand but is on SfdxCommand
|
|
135
|
+
strict: this.command.strict ?? !this.command.varargs,
|
|
136
|
+
})).flags;
|
|
121
137
|
}
|
|
122
138
|
catch (error) {
|
|
123
|
-
(0,
|
|
139
|
+
(0, debugger_1.debug)('Error parsing flags');
|
|
124
140
|
}
|
|
125
141
|
this.orgUsername = flags['targetusername'];
|
|
126
142
|
this.devHubOrgUsername = flags['targetdevhubusername'];
|
|
127
143
|
this.determineSpecifiedFlags(argv, flags, flagDefinitions);
|
|
128
144
|
this.vcs = await CommandExecution.resolveVCSInfo();
|
|
129
145
|
}
|
|
130
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
131
146
|
determineSpecifiedFlags(argv, flags, flagDefinitions) {
|
|
132
147
|
// Help won't be in the parsed flags
|
|
133
148
|
const shortHelp = argv.find((arg) => /^-h$/.test(arg));
|
|
@@ -143,9 +158,7 @@ class CommandExecution extends kit_1.AsyncCreatable {
|
|
|
143
158
|
// All other flags don't matter if help is specified, so end here.
|
|
144
159
|
}
|
|
145
160
|
else {
|
|
146
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
147
161
|
Object.keys(flags).forEach((flagName) => {
|
|
148
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
149
162
|
const shortCode = flagDefinitions[flagName] && flagDefinitions[flagName].char;
|
|
150
163
|
// Oclif will include the flag if there is a default, but we only want to add it if the
|
|
151
164
|
// user specified it, so confirm in the argv list.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandExecution.js","sourceRoot":"","sources":["../src/commandExecution.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAA4B;AAC5B,yBAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"commandExecution.js","sourceRoot":"","sources":["../src/commandExecution.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAA4B;AAC5B,yBAAyB;AACzB,sCAAmE;AAEnE,2CAA6C;AAC7C,yCAAiD;AACjD,mDAAmE;AACnE,yCAAmC;AAanC,MAAa,gBAAiB,SAA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CAAC,CAAC;aAClC;YACD,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACzC,kEAAkE;SACnE;aAAM;YACL,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACtC,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,IAAK,eAAe,CAAC,QAAQ,CAAC,CAAC,IAAe,CAAC;gBAC1F,uFAAuF;gBACvF,kDAAkD;gBAClD,IAAI,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,KAAK,SAAS,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;oBAClF,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;oBACpC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBAC5C;qBAAM,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,QAAQ,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;oBAC5E,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBACnC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBAC5C;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;CACF;AApLD,4CAoLC"}
|
|
@@ -12,4 +12,4 @@ const debug_1 = require("debug");
|
|
|
12
12
|
const packageJson = require('../package.json');
|
|
13
13
|
exports.version = packageJson.version;
|
|
14
14
|
exports.debug = (0, debug_1.default)(`sfdx:telemetry@${exports.version}`);
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=debugger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugger.js","sourceRoot":"","sources":["../src/debugger.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iCAA0B;AAO1B,8DAA8D;AAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAgB,CAAC;AACjD,QAAA,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;AAE9B,QAAA,KAAK,GAAG,IAAA,eAAK,EAAC,kBAAkB,eAAO,EAAE,CAAC,CAAC"}
|
|
@@ -11,7 +11,7 @@ const core_1 = require("@salesforce/core");
|
|
|
11
11
|
const telemetry_1 = require("@salesforce/telemetry");
|
|
12
12
|
const telemetry_2 = require("../telemetry");
|
|
13
13
|
const commandExecution_1 = require("../commandExecution");
|
|
14
|
-
const
|
|
14
|
+
const debugger_1 = require("../debugger");
|
|
15
15
|
/**
|
|
16
16
|
* A hook that runs before every command that:
|
|
17
17
|
* 1. Warns the user about command usage data collection the CLI does unless they have already acknowledged the warning.
|
|
@@ -22,7 +22,7 @@ const hook = async function (options) {
|
|
|
22
22
|
const telemetryEnabled = await telemetry_1.TelemetryReporter.determineSfdxTelemetryEnabled();
|
|
23
23
|
// Don't even bother logging if telemetry is disabled
|
|
24
24
|
if (!telemetryEnabled) {
|
|
25
|
-
(0,
|
|
25
|
+
(0, debugger_1.debug)('Telemetry disabled. Doing nothing.');
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
try {
|
|
@@ -41,19 +41,17 @@ const hook = async function (options) {
|
|
|
41
41
|
let commonData;
|
|
42
42
|
try {
|
|
43
43
|
core_1.Lifecycle.getInstance().onTelemetry(async (data) => {
|
|
44
|
-
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/await-thenable
|
|
46
|
-
await telemetry.record({
|
|
44
|
+
await Promise.resolve(telemetry.record({
|
|
47
45
|
type: 'EVENT',
|
|
48
46
|
...commonDataMemoized(),
|
|
49
47
|
...data,
|
|
50
|
-
});
|
|
48
|
+
}));
|
|
51
49
|
});
|
|
52
50
|
}
|
|
53
51
|
catch (err) {
|
|
54
52
|
// even if this throws, the rest of telemetry is not affected
|
|
55
53
|
const error = err;
|
|
56
|
-
(0,
|
|
54
|
+
(0, debugger_1.debug)('Error subscribing to telemetry events', error.message);
|
|
57
55
|
}
|
|
58
56
|
process.on('warning', (warning) => {
|
|
59
57
|
telemetry.record({
|
|
@@ -64,7 +62,7 @@ const hook = async function (options) {
|
|
|
64
62
|
message: warning.message,
|
|
65
63
|
});
|
|
66
64
|
});
|
|
67
|
-
(0,
|
|
65
|
+
(0, debugger_1.debug)('Setting up process exit handler');
|
|
68
66
|
process.once('exit', (status) => {
|
|
69
67
|
commandExecution.status = status;
|
|
70
68
|
telemetry.record(commandExecution.toJson());
|
|
@@ -80,7 +78,9 @@ const hook = async function (options) {
|
|
|
80
78
|
if (telemetry.firstRun) {
|
|
81
79
|
telemetry.record({
|
|
82
80
|
eventName: 'INSTALL',
|
|
83
|
-
installType: this.config.binPath?.includes((0, path_1.join)('sfdx', 'client'))
|
|
81
|
+
installType: this.config.binPath?.includes((0, path_1.join)('sfdx', 'client')) || this.config.binPath?.includes((0, path_1.join)('sf', 'client'))
|
|
82
|
+
? 'installer'
|
|
83
|
+
: 'npm',
|
|
84
84
|
platform: this.config.platform,
|
|
85
85
|
});
|
|
86
86
|
}
|
|
@@ -128,7 +128,7 @@ const hook = async function (options) {
|
|
|
128
128
|
}
|
|
129
129
|
catch (err) {
|
|
130
130
|
const error = err;
|
|
131
|
-
(0,
|
|
131
|
+
(0, debugger_1.debug)('Error with logging or sending telemetry:', error.message);
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
exports.default = hook;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetryPrerun.js","sourceRoot":"","sources":["../../src/hooks/telemetryPrerun.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,+BAA4B;AAE5B,2CAA2D;AAC3D,qDAA0D;AAC1D,4CAAqC;AAErC,0DAAuD;AACvD,
|
|
1
|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BACrC,cAAc,EAAE,UAAU,CAAC,OAAO;oBAClC,OAAO,EAAE,gBAAgB,CAAC,cAAc,EAAE;iBAC3C,CAAC;aACH;YACD,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC;KACH;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,KAAK,GAAG,GAAc,CAAC;QAC7B,IAAA,gBAAK,EAAC,0CAA0C,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;KAClE;AACH,CAAC,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
package/lib/telemetry.js
CHANGED
|
@@ -13,7 +13,7 @@ const os_1 = require("os");
|
|
|
13
13
|
const path_1 = require("path");
|
|
14
14
|
const kit_1 = require("@salesforce/kit");
|
|
15
15
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
16
|
-
const
|
|
16
|
+
const debugger_1 = require("./debugger");
|
|
17
17
|
const CLI_ID_FILE_NAME = 'CLIID.txt';
|
|
18
18
|
const USAGE_ACKNOWLEDGEMENT_FILE_NAME = 'acknowledgedUsageCollection.json';
|
|
19
19
|
class Telemetry extends kit_1.AsyncCreatable {
|
|
@@ -40,13 +40,13 @@ class Telemetry extends kit_1.AsyncCreatable {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
if (!Telemetry.cacheDir) {
|
|
43
|
-
(0,
|
|
43
|
+
(0, debugger_1.debug)('Unable to check acknowledgment path because Telemetry.cacheDir is not set yet');
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
const acknowledgementFilePath = (0, path_1.join)(Telemetry.cacheDir, USAGE_ACKNOWLEDGEMENT_FILE_NAME);
|
|
47
47
|
try {
|
|
48
48
|
await fs.promises.access(acknowledgementFilePath, fs.constants.R_OK);
|
|
49
|
-
(0,
|
|
49
|
+
(0, debugger_1.debug)('Usage acknowledgement file already exists');
|
|
50
50
|
}
|
|
51
51
|
catch (error) {
|
|
52
52
|
const err = error;
|
|
@@ -58,10 +58,10 @@ class Telemetry extends kit_1.AsyncCreatable {
|
|
|
58
58
|
Telemetry.acknowledged = true;
|
|
59
59
|
await fs.promises.mkdir(Telemetry.cacheDir, { recursive: true });
|
|
60
60
|
await fs.promises.writeFile(acknowledgementFilePath, JSON.stringify({ acknowledged: true }));
|
|
61
|
-
(0,
|
|
61
|
+
(0, debugger_1.debug)('Wrote usage acknowledgement file', acknowledgementFilePath);
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
64
|
-
(0,
|
|
64
|
+
(0, debugger_1.debug)('Could not access', acknowledgementFilePath, 'DUE TO:', err.code, err.message);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -150,7 +150,7 @@ class Telemetry extends kit_1.AsyncCreatable {
|
|
|
150
150
|
this.cliId = fs.readFileSync(cliIdPath, 'utf8');
|
|
151
151
|
}
|
|
152
152
|
catch (err) {
|
|
153
|
-
(0,
|
|
153
|
+
(0, debugger_1.debug)('Unique CLI ID not found, generating and writing new ID to ', cliIdPath);
|
|
154
154
|
this.cliId = Telemetry.generateRandomId();
|
|
155
155
|
fs.writeFileSync(cliIdPath, this.cliId, 'utf8');
|
|
156
156
|
// If there is not a unique ID for this CLI, consider it a first run.
|
|
@@ -188,7 +188,7 @@ class Telemetry extends kit_1.AsyncCreatable {
|
|
|
188
188
|
// Replace HOME for GDPR.
|
|
189
189
|
dataToRecord.requestorLocation = locations[1].replace(process.env.HOME || '', '');
|
|
190
190
|
}
|
|
191
|
-
(0,
|
|
191
|
+
(0, debugger_1.debug)('Missing event name!');
|
|
192
192
|
}
|
|
193
193
|
// Unique to this CLI installation
|
|
194
194
|
dataToRecord.cliId = this.getCLIId();
|
|
@@ -199,7 +199,7 @@ class Telemetry extends kit_1.AsyncCreatable {
|
|
|
199
199
|
}
|
|
200
200
|
catch (err) {
|
|
201
201
|
const error = err;
|
|
202
|
-
(0,
|
|
202
|
+
(0, debugger_1.debug)(`Error saving telemetry line to file: ${error.message}`);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
recordError(error, data) {
|
|
@@ -215,12 +215,12 @@ class Telemetry extends kit_1.AsyncCreatable {
|
|
|
215
215
|
this.record(data);
|
|
216
216
|
}
|
|
217
217
|
async clear() {
|
|
218
|
-
(0,
|
|
218
|
+
(0, debugger_1.debug)('Deleting the log file', this.getTelemetryFilePath());
|
|
219
219
|
await fs.promises.unlink(this.getTelemetryFilePath());
|
|
220
220
|
}
|
|
221
221
|
async read() {
|
|
222
222
|
try {
|
|
223
|
-
(0,
|
|
223
|
+
(0, debugger_1.debug)(`Reading ${this.getTelemetryFilePath()}`);
|
|
224
224
|
const data = await fs.promises.readFile(this.getTelemetryFilePath(), 'utf8');
|
|
225
225
|
return data
|
|
226
226
|
.split(os_1.EOL)
|
|
@@ -229,7 +229,7 @@ class Telemetry extends kit_1.AsyncCreatable {
|
|
|
229
229
|
}
|
|
230
230
|
catch (error) {
|
|
231
231
|
const err = error;
|
|
232
|
-
(0,
|
|
232
|
+
(0, debugger_1.debug)(`Error reading: ${err.message}`);
|
|
233
233
|
// If anything goes wrong, it just means a couple of lost telemetry events.
|
|
234
234
|
return [];
|
|
235
235
|
}
|
|
@@ -241,14 +241,14 @@ class Telemetry extends kit_1.AsyncCreatable {
|
|
|
241
241
|
const nodePath = process.argv[0];
|
|
242
242
|
// Don't spawn if we are in telemetry debug. This allows us to run the process manually with --inspect-brk.
|
|
243
243
|
if (!telemetryDebug) {
|
|
244
|
-
(0,
|
|
244
|
+
(0, debugger_1.debug)(`Spawning "${nodePath} ${processPath} ${Telemetry.cacheDir} ${this.getTelemetryFilePath()}"`);
|
|
245
245
|
(0, child_process_1.spawn)(nodePath, [processPath, Telemetry.cacheDir, this.getTelemetryFilePath()], {
|
|
246
246
|
detached: true,
|
|
247
247
|
stdio: 'ignore',
|
|
248
248
|
}).unref();
|
|
249
249
|
}
|
|
250
250
|
else {
|
|
251
|
-
(0,
|
|
251
|
+
(0, debugger_1.debug)(`DEBUG MODE. Run the uploader manually with the following command:${os_1.EOL}${processPath} ${Telemetry.cacheDir} ${this.getTelemetryFilePath()}`);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
async init() {
|
|
@@ -261,13 +261,13 @@ class Telemetry extends kit_1.AsyncCreatable {
|
|
|
261
261
|
catch (error) {
|
|
262
262
|
const err = error;
|
|
263
263
|
if (err.code === 'ENOENT') {
|
|
264
|
-
(0,
|
|
264
|
+
(0, debugger_1.debug)('Telemetry temp dir does not exist, creating...');
|
|
265
265
|
await fs.promises.mkdir(Telemetry.tmpDir, { recursive: true });
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
// Create a file descriptor to be used
|
|
269
269
|
this.fileDescriptor = fs.openSync(this.getTelemetryFilePath(), 'a');
|
|
270
|
-
(0,
|
|
270
|
+
(0, debugger_1.debug)(`Using telemetry logging file ${this.getTelemetryFilePath()}`);
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
exports.default = Telemetry;
|
package/lib/telemetry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,iDAAsC;AACtC,mCAAqC;AACrC,yBAAyB;AACzB,2BAAiC;AACjC,+BAA4B;AAE5B,yCAAsD;AAEtD,mDAA8E;AAC9E,
|
|
1
|
+
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,iDAAsC;AACtC,mCAAqC;AACrC,yBAAyB;AACzB,2BAAiC;AACjC,+BAA4B;AAE5B,yCAAsD;AAEtD,mDAA8E;AAC9E,yCAAmC;AAEnC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AACrC,MAAM,+BAA+B,GAAG,kCAAkC,CAAC;AAgC3E,MAAqB,SAAU,SAAQ,oBAAc;IAyBnD,YAAmB,OAAyB;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QALV,aAAQ,GAAG,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|
@@ -11,7 +11,7 @@ const core_1 = require("@salesforce/core");
|
|
|
11
11
|
const telemetry_1 = require("@salesforce/telemetry");
|
|
12
12
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
13
13
|
const telemetry_2 = require("./telemetry");
|
|
14
|
-
const
|
|
14
|
+
const debugger_1 = require("./debugger");
|
|
15
15
|
const PROJECT = 'salesforce-cli';
|
|
16
16
|
const APP_INSIGHTS_KEY = '2ca64abb-6123-4c7b-bd9e-4fe73e71fe9c';
|
|
17
17
|
class Uploader {
|
|
@@ -41,7 +41,7 @@ class Uploader {
|
|
|
41
41
|
}
|
|
42
42
|
catch (err) {
|
|
43
43
|
const error = err;
|
|
44
|
-
(0,
|
|
44
|
+
(0, debugger_1.debug)(`Error creating reporter: ${error.message}`);
|
|
45
45
|
// We can't do much without a reporter, so clear the telemetry file and move on.
|
|
46
46
|
await this.telemetry.clear();
|
|
47
47
|
return;
|
|
@@ -54,7 +54,7 @@ class Uploader {
|
|
|
54
54
|
delete event.type;
|
|
55
55
|
delete event.eventName;
|
|
56
56
|
if (eventType === telemetry_2.default.EVENT) {
|
|
57
|
-
event.telemetryVersion =
|
|
57
|
+
event.telemetryVersion = debugger_1.version;
|
|
58
58
|
// Resolve orgs for all events.
|
|
59
59
|
// eslint-disable-next-line no-await-in-loop
|
|
60
60
|
event.orgId = await getOrgId(false, (0, ts_types_1.asString)(event.orgUsername));
|
|
@@ -80,7 +80,7 @@ class Uploader {
|
|
|
80
80
|
}
|
|
81
81
|
catch (err) {
|
|
82
82
|
const error = err;
|
|
83
|
-
(0,
|
|
83
|
+
(0, debugger_1.debug)(`Error reading or sending telemetry events: ${error.message}`);
|
|
84
84
|
}
|
|
85
85
|
finally {
|
|
86
86
|
try {
|
|
@@ -89,7 +89,7 @@ class Uploader {
|
|
|
89
89
|
}
|
|
90
90
|
catch (err) {
|
|
91
91
|
const error = err;
|
|
92
|
-
(0,
|
|
92
|
+
(0, debugger_1.debug)(`Error stopping telemetry reporter: ${error.message}`);
|
|
93
93
|
}
|
|
94
94
|
finally {
|
|
95
95
|
// We alway want to clear the file.
|
package/lib/uploader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploader.js","sourceRoot":"","sources":["../src/uploader.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAAgD;AAChD,qDAAsD;AACtD,mDAA4D;AAC5D,2CAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"uploader.js","sourceRoot":"","sources":["../src/uploader.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAAgD;AAChD,qDAAsD;AACtD,mDAA4D;AAC5D,2CAAoC;AACpC,yCAA4C;AAM5C,MAAM,OAAO,GAAG,gBAAgB,CAAC;AACjC,MAAM,gBAAgB,GAAG,sCAAsC,CAAC;AAEhE,MAAa,QAAQ;IACnB,YAA4B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAEpD;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAgB,EAAE,iBAAyB;QACpE,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,mBAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC;QAClG,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;QACzC,MAAM,QAAQ,CAAC,eAAe,EAAE,CAAC;IACnC,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,eAAe;QAC3B,IAAI,QAA2B,CAAC;QAChC,IAAI;YACF,QAAQ,GAAG,MAAM,mBAAiB,CAAC,MAAM,CAAC;gBACxC,OAAO,EAAE,OAAO;gBAChB,GAAG,EAAE,gBAAgB;gBACrB,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;gBACjC,iBAAiB,EAAE,IAAI;aACxB,CAAC,CAAC;SACJ;QAAC,OAAO,GAAG,E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ACD,IAAI;QACF,OAAO,CAAC,MAAM,UAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;KAClD;IAAC,OAAO,KAAK,EAAE;QACd,uDAAuD;KACxD;AACH,CAAC,CAAC"}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-telemetry",
|
|
3
3
|
"description": "Command usage and error telemetry for the Salesforce CLI",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.2",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@oclif/core": "^2.0
|
|
8
|
+
"@oclif/core": "^2.5.0",
|
|
9
9
|
"@salesforce/core": "^3.32.2",
|
|
10
10
|
"@salesforce/telemetry": "^3.2.5",
|
|
11
11
|
"debug": "^4.3.4",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@oclif/plugin-command-snapshot": "^3.3.2",
|
|
16
|
-
"@oclif/plugin-help": "^5.2.
|
|
17
|
-
"@salesforce/cli-plugins-testkit": "^3.2.
|
|
16
|
+
"@oclif/plugin-help": "^5.2.4",
|
|
17
|
+
"@salesforce/cli-plugins-testkit": "^3.2.21",
|
|
18
18
|
"@salesforce/dev-config": "^3.0.1",
|
|
19
|
-
"@salesforce/dev-scripts": "^
|
|
19
|
+
"@salesforce/dev-scripts": "^4.1.2",
|
|
20
20
|
"@salesforce/plugin-command-reference": "^1.6.1",
|
|
21
21
|
"@salesforce/prettier-config": "^0.0.2",
|
|
22
|
-
"@salesforce/ts-sinon": "^1.4.
|
|
22
|
+
"@salesforce/ts-sinon": "^1.4.6",
|
|
23
23
|
"@swc/core": "^1.3.14",
|
|
24
24
|
"@types/debug": "^4.1.5",
|
|
25
25
|
"@typescript-eslint/eslint-plugin": "^5.43.0",
|
|
@@ -27,22 +27,23 @@
|
|
|
27
27
|
"chai": "^4.3.7",
|
|
28
28
|
"eslint": "^8.28.0",
|
|
29
29
|
"eslint-config-prettier": "^8.5.0",
|
|
30
|
-
"eslint-config-salesforce": "^1.1.
|
|
31
|
-
"eslint-config-salesforce-license": "^0.
|
|
30
|
+
"eslint-config-salesforce": "^1.1.1",
|
|
31
|
+
"eslint-config-salesforce-license": "^0.2.0",
|
|
32
32
|
"eslint-config-salesforce-typescript": "^1.1.1",
|
|
33
33
|
"eslint-plugin-header": "^3.0.0",
|
|
34
34
|
"eslint-plugin-import": "2.26.0",
|
|
35
|
-
"eslint-plugin-jsdoc": "^39.
|
|
35
|
+
"eslint-plugin-jsdoc": "^39.9.1",
|
|
36
36
|
"husky": "^7.0.4",
|
|
37
37
|
"mocha": "^9.1.3",
|
|
38
38
|
"nyc": "^15.1.0",
|
|
39
|
-
"oclif": "^3.6.
|
|
40
|
-
"prettier": "^2.
|
|
39
|
+
"oclif": "^3.6.2",
|
|
40
|
+
"prettier": "^2.8.4",
|
|
41
41
|
"pretty-quick": "^3.1.0",
|
|
42
42
|
"shx": "0.3.4",
|
|
43
43
|
"sinon": "10.0.0",
|
|
44
44
|
"ts-node": "^10.0.0",
|
|
45
|
-
"typescript": "^4.9.4"
|
|
45
|
+
"typescript": "^4.9.4",
|
|
46
|
+
"wireit": "^0.9.5"
|
|
46
47
|
},
|
|
47
48
|
"config": {},
|
|
48
49
|
"engines": {
|
|
@@ -66,7 +67,6 @@
|
|
|
66
67
|
"commands": "./lib/commands",
|
|
67
68
|
"bin": "sfdx",
|
|
68
69
|
"hooks": {
|
|
69
|
-
"init": "./lib/hooks/telemetryInit.js",
|
|
70
70
|
"prerun": "./lib/hooks/telemetryPrerun.js"
|
|
71
71
|
},
|
|
72
72
|
"devPlugins": [
|
|
@@ -77,30 +77,133 @@
|
|
|
77
77
|
},
|
|
78
78
|
"repository": "salesforcecli/plugin-telemetry",
|
|
79
79
|
"scripts": {
|
|
80
|
-
"build": "
|
|
80
|
+
"build": "wireit",
|
|
81
81
|
"clean": "sf-clean",
|
|
82
82
|
"clean-all": "sf-clean all",
|
|
83
83
|
"clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json",
|
|
84
|
-
"compile": "
|
|
84
|
+
"compile": "wireit",
|
|
85
85
|
"docs": "sf-docs",
|
|
86
|
-
"format": "
|
|
87
|
-
"lint": "
|
|
86
|
+
"format": "wireit",
|
|
87
|
+
"lint": "wireit",
|
|
88
88
|
"postpack": "shx rm -f oclif.manifest.json",
|
|
89
|
-
"posttest": "yarn lint && yarn test:deprecation-policy && yarn test:command-reference",
|
|
90
89
|
"prepack": "sf-prepack",
|
|
91
90
|
"prepare": "sf-install",
|
|
92
|
-
"
|
|
93
|
-
"test": "sf-test",
|
|
94
|
-
"test:command-reference": "./bin/dev commandreference:generate --erroronwarnings",
|
|
95
|
-
"test:deprecation-policy": "./bin/dev snapshot:compare",
|
|
91
|
+
"test": "wireit",
|
|
96
92
|
"test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
|
|
93
|
+
"test:only": "wireit",
|
|
97
94
|
"version": "oclif readme"
|
|
98
95
|
},
|
|
99
96
|
"publishConfig": {
|
|
100
97
|
"access": "public"
|
|
101
98
|
},
|
|
99
|
+
"wireit": {
|
|
100
|
+
"build": {
|
|
101
|
+
"dependencies": [
|
|
102
|
+
"compile",
|
|
103
|
+
"lint"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"compile": {
|
|
107
|
+
"command": "tsc -p . --pretty --incremental",
|
|
108
|
+
"files": [
|
|
109
|
+
"src/**/*.ts",
|
|
110
|
+
"tsconfig.json",
|
|
111
|
+
"messages/**"
|
|
112
|
+
],
|
|
113
|
+
"output": [
|
|
114
|
+
"lib/**",
|
|
115
|
+
"*.tsbuildinfo"
|
|
116
|
+
],
|
|
117
|
+
"clean": "if-file-deleted"
|
|
118
|
+
},
|
|
119
|
+
"format": {
|
|
120
|
+
"command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\"",
|
|
121
|
+
"files": [
|
|
122
|
+
"src/**/*.ts",
|
|
123
|
+
"test/**/*.ts",
|
|
124
|
+
"schemas/**/*.json",
|
|
125
|
+
"command-snapshot.json",
|
|
126
|
+
".prettier*"
|
|
127
|
+
],
|
|
128
|
+
"output": []
|
|
129
|
+
},
|
|
130
|
+
"lint": {
|
|
131
|
+
"command": "eslint src test --color --cache --cache-location .eslintcache",
|
|
132
|
+
"files": [
|
|
133
|
+
"src/**/*.ts",
|
|
134
|
+
"test/**/*.ts",
|
|
135
|
+
"messages/**",
|
|
136
|
+
".eslint*"
|
|
137
|
+
],
|
|
138
|
+
"output": []
|
|
139
|
+
},
|
|
140
|
+
"test:compile": {
|
|
141
|
+
"command": "tsc -p \"./test\" --pretty",
|
|
142
|
+
"files": [
|
|
143
|
+
"test/**/*.ts",
|
|
144
|
+
"tsconfig.json",
|
|
145
|
+
"test/tsconfig.json"
|
|
146
|
+
],
|
|
147
|
+
"output": []
|
|
148
|
+
},
|
|
149
|
+
"test": {
|
|
150
|
+
"dependencies": [
|
|
151
|
+
"test:compile",
|
|
152
|
+
"test:only",
|
|
153
|
+
"test:command-reference",
|
|
154
|
+
"test:deprecation-policy",
|
|
155
|
+
"lint",
|
|
156
|
+
"test:json-schema"
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"test:only": {
|
|
160
|
+
"command": "nyc mocha \"test/**/*.test.ts\"",
|
|
161
|
+
"env": {
|
|
162
|
+
"FORCE_COLOR": "2"
|
|
163
|
+
},
|
|
164
|
+
"files": [
|
|
165
|
+
"test/**/*.ts",
|
|
166
|
+
"src/**/*.ts",
|
|
167
|
+
"tsconfig.json",
|
|
168
|
+
".mocha*",
|
|
169
|
+
"test/tsconfig.json",
|
|
170
|
+
"!*.nut.ts",
|
|
171
|
+
".nycrc"
|
|
172
|
+
],
|
|
173
|
+
"output": []
|
|
174
|
+
},
|
|
175
|
+
"test:command-reference": {
|
|
176
|
+
"command": "\"./bin/dev\" commandreference:generate --erroronwarnings",
|
|
177
|
+
"files": [
|
|
178
|
+
"src/**/*.ts",
|
|
179
|
+
"messages/**",
|
|
180
|
+
"package.json"
|
|
181
|
+
],
|
|
182
|
+
"output": [
|
|
183
|
+
"tmp/root"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
"test:deprecation-policy": {
|
|
187
|
+
"command": "\"./bin/dev\" snapshot:compare",
|
|
188
|
+
"files": [
|
|
189
|
+
"src/**/*.ts"
|
|
190
|
+
],
|
|
191
|
+
"output": [],
|
|
192
|
+
"dependencies": [
|
|
193
|
+
"compile"
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
"test:json-schema": {
|
|
197
|
+
"command": "\"./bin/dev\" schema:compare",
|
|
198
|
+
"files": [
|
|
199
|
+
"src/**/*.ts",
|
|
200
|
+
"schemas"
|
|
201
|
+
],
|
|
202
|
+
"output": []
|
|
203
|
+
}
|
|
204
|
+
},
|
|
102
205
|
"sfdx": {
|
|
103
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-telemetry/2.1.
|
|
104
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-telemetry/2.1.
|
|
206
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-telemetry/2.1.2.crt",
|
|
207
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-telemetry/2.1.2.sig"
|
|
105
208
|
}
|
|
106
209
|
}
|
package/lib/debuger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debuger.js","sourceRoot":"","sources":["../src/debuger.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iCAA0B;AAO1B,8DAA8D;AAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAgB,CAAC;AACjD,QAAA,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;AAE9B,QAAA,KAAK,GAAG,IAAA,eAAK,EAAC,kBAAkB,eAAO,EAAE,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Hook } from '@oclif/core';
|
|
2
|
-
export declare class InitData {
|
|
3
|
-
static upTimeAtInit: number;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* A hook that runs when the CLI is initialized but before a command is found to run.
|
|
7
|
-
* Records the process uptime, which we take as the time it takes to load OCLIF
|
|
8
|
-
*/
|
|
9
|
-
declare const hook: Hook.Init;
|
|
10
|
-
export default hook;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.InitData = void 0;
|
|
10
|
-
class InitData {
|
|
11
|
-
}
|
|
12
|
-
exports.InitData = InitData;
|
|
13
|
-
/**
|
|
14
|
-
* A hook that runs when the CLI is initialized but before a command is found to run.
|
|
15
|
-
* Records the process uptime, which we take as the time it takes to load OCLIF
|
|
16
|
-
*/
|
|
17
|
-
// We don't need to do anything async but make it clear oclif takes an async function with the right signature.
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
19
|
-
const hook = async () => {
|
|
20
|
-
InitData.upTimeAtInit = process.uptime() * 1000;
|
|
21
|
-
};
|
|
22
|
-
exports.default = hook;
|
|
23
|
-
//# sourceMappingURL=telemetryInit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetryInit.js","sourceRoot":"","sources":["../../src/hooks/telemetryInit.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH,MAAa,QAAQ;CAEpB;AAFD,4BAEC;AAED;;;GAGG;AACH,+GAA+G;AAC/G,4DAA4D;AAC5D,MAAM,IAAI,GAAc,KAAK,IAAmB,EAAE;IAChD,QAAQ,CAAC,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;AAClD,CAAC,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
File without changes
|