@react-native-windows/telemetry 0.73.1 → 0.74.0-preview.1

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.
Files changed (30) hide show
  1. package/lib-commonjs/e2etest/telemetry.test.d.ts +28 -28
  2. package/lib-commonjs/e2etest/telemetry.test.js +496 -496
  3. package/lib-commonjs/index.d.ts +11 -11
  4. package/lib-commonjs/index.js +26 -26
  5. package/lib-commonjs/telemetry.d.ts +84 -84
  6. package/lib-commonjs/telemetry.js +370 -370
  7. package/lib-commonjs/telemetry.js.map +1 -1
  8. package/lib-commonjs/test/basePropUtils.test.d.ts +7 -7
  9. package/lib-commonjs/test/basePropUtils.test.js +137 -137
  10. package/lib-commonjs/test/errorUtils.test.d.ts +7 -7
  11. package/lib-commonjs/test/errorUtils.test.js +159 -159
  12. package/lib-commonjs/test/projectUtils.test.d.ts +7 -7
  13. package/lib-commonjs/test/projectUtils.test.js +87 -87
  14. package/lib-commonjs/test/sanitizeUtils.test.d.ts +7 -7
  15. package/lib-commonjs/test/sanitizeUtils.test.js +97 -97
  16. package/lib-commonjs/test/versionUtils.test.d.ts +7 -7
  17. package/lib-commonjs/test/versionUtils.test.js +114 -114
  18. package/lib-commonjs/utils/basePropUtils.d.ts +81 -81
  19. package/lib-commonjs/utils/basePropUtils.js +173 -173
  20. package/lib-commonjs/utils/errorUtils.d.ts +87 -87
  21. package/lib-commonjs/utils/errorUtils.js +178 -178
  22. package/lib-commonjs/utils/optionUtils.d.ts +45 -45
  23. package/lib-commonjs/utils/optionUtils.js +95 -95
  24. package/lib-commonjs/utils/projectUtils.d.ts +50 -50
  25. package/lib-commonjs/utils/projectUtils.js +186 -186
  26. package/lib-commonjs/utils/sanitizeUtils.d.ts +12 -12
  27. package/lib-commonjs/utils/sanitizeUtils.js +81 -81
  28. package/lib-commonjs/utils/versionUtils.d.ts +38 -38
  29. package/lib-commonjs/utils/versionUtils.js +155 -155
  30. package/package.json +14 -16
@@ -1,11 +1,11 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- * @format
5
- */
6
- export { Telemetry, TelemetryOptions, CommandStartInfo, CommandEndInfo, } from './telemetry';
7
- export { deviceArchitecture, nodeArchitecture } from './utils/basePropUtils';
8
- export { CodedError, CodedErrorType, CodedErrors } from './utils/errorUtils';
9
- export { yargsOptionsToOptions, commanderNameToOptionName, commanderOptionsToOptions, optionsToArgs, OptionSanitizer, YargsOptionsType, CommanderOptionsType, } from './utils/optionUtils';
10
- export { configToProjectInfo, getProjectFileFromConfig, AppProjectInfo, DependencyProjectInfo, } from './utils/projectUtils';
11
- export { getVersionOfNpmPackage } from './utils/versionUtils';
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ * @format
5
+ */
6
+ export { Telemetry, TelemetryOptions, CommandStartInfo, CommandEndInfo, } from './telemetry';
7
+ export { deviceArchitecture, nodeArchitecture } from './utils/basePropUtils';
8
+ export { CodedError, CodedErrorType, CodedErrors } from './utils/errorUtils';
9
+ export { yargsOptionsToOptions, commanderNameToOptionName, commanderOptionsToOptions, optionsToArgs, OptionSanitizer, YargsOptionsType, CommanderOptionsType, } from './utils/optionUtils';
10
+ export { configToProjectInfo, getProjectFileFromConfig, AppProjectInfo, DependencyProjectInfo, } from './utils/projectUtils';
11
+ export { getVersionOfNpmPackage } from './utils/versionUtils';
@@ -1,27 +1,27 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Microsoft Corporation.
4
- * Licensed under the MIT License.
5
- * @format
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.getVersionOfNpmPackage = exports.getProjectFileFromConfig = exports.configToProjectInfo = exports.optionsToArgs = exports.commanderOptionsToOptions = exports.commanderNameToOptionName = exports.yargsOptionsToOptions = exports.CodedErrors = exports.CodedError = exports.nodeArchitecture = exports.deviceArchitecture = exports.Telemetry = void 0;
9
- var telemetry_1 = require("./telemetry");
10
- Object.defineProperty(exports, "Telemetry", { enumerable: true, get: function () { return telemetry_1.Telemetry; } });
11
- var basePropUtils_1 = require("./utils/basePropUtils");
12
- Object.defineProperty(exports, "deviceArchitecture", { enumerable: true, get: function () { return basePropUtils_1.deviceArchitecture; } });
13
- Object.defineProperty(exports, "nodeArchitecture", { enumerable: true, get: function () { return basePropUtils_1.nodeArchitecture; } });
14
- var errorUtils_1 = require("./utils/errorUtils");
15
- Object.defineProperty(exports, "CodedError", { enumerable: true, get: function () { return errorUtils_1.CodedError; } });
16
- Object.defineProperty(exports, "CodedErrors", { enumerable: true, get: function () { return errorUtils_1.CodedErrors; } });
17
- var optionUtils_1 = require("./utils/optionUtils");
18
- Object.defineProperty(exports, "yargsOptionsToOptions", { enumerable: true, get: function () { return optionUtils_1.yargsOptionsToOptions; } });
19
- Object.defineProperty(exports, "commanderNameToOptionName", { enumerable: true, get: function () { return optionUtils_1.commanderNameToOptionName; } });
20
- Object.defineProperty(exports, "commanderOptionsToOptions", { enumerable: true, get: function () { return optionUtils_1.commanderOptionsToOptions; } });
21
- Object.defineProperty(exports, "optionsToArgs", { enumerable: true, get: function () { return optionUtils_1.optionsToArgs; } });
22
- var projectUtils_1 = require("./utils/projectUtils");
23
- Object.defineProperty(exports, "configToProjectInfo", { enumerable: true, get: function () { return projectUtils_1.configToProjectInfo; } });
24
- Object.defineProperty(exports, "getProjectFileFromConfig", { enumerable: true, get: function () { return projectUtils_1.getProjectFileFromConfig; } });
25
- var versionUtils_1 = require("./utils/versionUtils");
26
- Object.defineProperty(exports, "getVersionOfNpmPackage", { enumerable: true, get: function () { return versionUtils_1.getVersionOfNpmPackage; } });
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Microsoft Corporation.
4
+ * Licensed under the MIT License.
5
+ * @format
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.getVersionOfNpmPackage = exports.getProjectFileFromConfig = exports.configToProjectInfo = exports.optionsToArgs = exports.commanderOptionsToOptions = exports.commanderNameToOptionName = exports.yargsOptionsToOptions = exports.CodedErrors = exports.CodedError = exports.nodeArchitecture = exports.deviceArchitecture = exports.Telemetry = void 0;
9
+ var telemetry_1 = require("./telemetry");
10
+ Object.defineProperty(exports, "Telemetry", { enumerable: true, get: function () { return telemetry_1.Telemetry; } });
11
+ var basePropUtils_1 = require("./utils/basePropUtils");
12
+ Object.defineProperty(exports, "deviceArchitecture", { enumerable: true, get: function () { return basePropUtils_1.deviceArchitecture; } });
13
+ Object.defineProperty(exports, "nodeArchitecture", { enumerable: true, get: function () { return basePropUtils_1.nodeArchitecture; } });
14
+ var errorUtils_1 = require("./utils/errorUtils");
15
+ Object.defineProperty(exports, "CodedError", { enumerable: true, get: function () { return errorUtils_1.CodedError; } });
16
+ Object.defineProperty(exports, "CodedErrors", { enumerable: true, get: function () { return errorUtils_1.CodedErrors; } });
17
+ var optionUtils_1 = require("./utils/optionUtils");
18
+ Object.defineProperty(exports, "yargsOptionsToOptions", { enumerable: true, get: function () { return optionUtils_1.yargsOptionsToOptions; } });
19
+ Object.defineProperty(exports, "commanderNameToOptionName", { enumerable: true, get: function () { return optionUtils_1.commanderNameToOptionName; } });
20
+ Object.defineProperty(exports, "commanderOptionsToOptions", { enumerable: true, get: function () { return optionUtils_1.commanderOptionsToOptions; } });
21
+ Object.defineProperty(exports, "optionsToArgs", { enumerable: true, get: function () { return optionUtils_1.optionsToArgs; } });
22
+ var projectUtils_1 = require("./utils/projectUtils");
23
+ Object.defineProperty(exports, "configToProjectInfo", { enumerable: true, get: function () { return projectUtils_1.configToProjectInfo; } });
24
+ Object.defineProperty(exports, "getProjectFileFromConfig", { enumerable: true, get: function () { return projectUtils_1.getProjectFileFromConfig; } });
25
+ var versionUtils_1 = require("./utils/versionUtils");
26
+ Object.defineProperty(exports, "getVersionOfNpmPackage", { enumerable: true, get: function () { return versionUtils_1.getVersionOfNpmPackage; } });
27
27
  //# sourceMappingURL=index.js.map
@@ -1,84 +1,84 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- * @format
5
- */
6
- import * as appInsights from 'applicationinsights';
7
- import * as errorUtils from './utils/errorUtils';
8
- import * as projectUtils from './utils/projectUtils';
9
- export interface TelemetryOptions {
10
- setupString: string;
11
- preserveErrorMessages: boolean;
12
- populateNpmPackageVersions: boolean;
13
- }
14
- export interface CommandStartInfo {
15
- commandName: string;
16
- args: Record<string, any>;
17
- options: Record<string, any>;
18
- defaultOptions: Record<string, any>;
19
- }
20
- export interface CommandEndInfo {
21
- resultCode: errorUtils.CodedErrorType;
22
- }
23
- interface CommandInfo {
24
- startTime?: number;
25
- endTime?: number;
26
- startInfo?: CommandStartInfo;
27
- endInfo?: CommandEndInfo;
28
- }
29
- export declare const CommandEventName = "RNWCLI.Command";
30
- export declare const CodedErrorEventName = "RNWCLI.CodedError";
31
- export declare const EventNamesWeTrack: string[];
32
- export declare const NpmPackagesWeTrack: string[];
33
- export declare const NuGetPackagesWeTrack: string[];
34
- /**
35
- * The Telemetry class is responsible for reporting telemetry for RNW CLI.
36
- */
37
- export declare class Telemetry {
38
- protected static client?: appInsights.TelemetryClient;
39
- protected static options: TelemetryOptions;
40
- protected static isTest: boolean;
41
- protected static commandInfo: CommandInfo;
42
- protected static versionsProp: Record<string, string>;
43
- protected static projectProp?: projectUtils.AppProjectInfo | projectUtils.DependencyProjectInfo;
44
- protected static getDefaultSetupString(): string;
45
- protected static reset(): void;
46
- static isEnabled(): boolean;
47
- static getSessionId(): string;
48
- /** Sets up the Telemetry static to be used elsewhere. */
49
- static setup(options?: Partial<TelemetryOptions>): Promise<void>;
50
- /** Sets up Telemetry.client. */
51
- private static setupClient;
52
- /** Sets up any base properties that all telemetry events require. */
53
- private static setupBaseProperties;
54
- /** Sets up any telemetry processors. */
55
- private static setupTelemetryProcessors;
56
- /**
57
- * Performs the processing necessary (mostly PII sanitization) for all events.
58
- * @param envelope The ApplicationInsights event envelope.
59
- * @param _contextObjects An optional context object.
60
- * @returns Whether to kee
61
- */
62
- private static basicTelemetryProcessor;
63
- /**
64
- * Performs the processing necessary (mostly PII sanitization) for error events.
65
- * @param envelope
66
- * @param _contextObjects
67
- * @returns
68
- */
69
- private static errorTelemetryProcessor;
70
- /** Tries to update the version of the named package/tool by calling getValue(). */
71
- static tryUpdateVersionsProp(name: string, getValue: () => Promise<string | null>, forceRefresh?: boolean): Promise<boolean>;
72
- /** Populates the versions property of tools we care to track. */
73
- static populateToolsVersions(refresh?: boolean): Promise<void>;
74
- /** Populates the versions property of npm packages we care to track. */
75
- static populateNpmPackageVersions(refresh?: boolean): Promise<void>;
76
- /** Populates the versions property of nuget packages we care to track. */
77
- static populateNuGetPackageVersions(projectFile: string, refresh?: boolean): Promise<void>;
78
- static setProjectInfo(info: projectUtils.AppProjectInfo | projectUtils.DependencyProjectInfo): void;
79
- static startCommand(info: CommandStartInfo): void;
80
- static endCommand(info: CommandEndInfo, extraProps?: Record<string, any>): void;
81
- private static trackCommandEvent;
82
- static trackException(error: Error, extraProps?: Record<string, any>): void;
83
- }
84
- export {};
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ * @format
5
+ */
6
+ import * as appInsights from 'applicationinsights';
7
+ import * as errorUtils from './utils/errorUtils';
8
+ import * as projectUtils from './utils/projectUtils';
9
+ export interface TelemetryOptions {
10
+ setupString: string;
11
+ preserveErrorMessages: boolean;
12
+ populateNpmPackageVersions: boolean;
13
+ }
14
+ export interface CommandStartInfo {
15
+ commandName: string;
16
+ args: Record<string, any>;
17
+ options: Record<string, any>;
18
+ defaultOptions: Record<string, any>;
19
+ }
20
+ export interface CommandEndInfo {
21
+ resultCode: errorUtils.CodedErrorType;
22
+ }
23
+ interface CommandInfo {
24
+ startTime?: number;
25
+ endTime?: number;
26
+ startInfo?: CommandStartInfo;
27
+ endInfo?: CommandEndInfo;
28
+ }
29
+ export declare const CommandEventName = "RNWCLI.Command";
30
+ export declare const CodedErrorEventName = "RNWCLI.CodedError";
31
+ export declare const EventNamesWeTrack: string[];
32
+ export declare const NpmPackagesWeTrack: string[];
33
+ export declare const NuGetPackagesWeTrack: string[];
34
+ /**
35
+ * The Telemetry class is responsible for reporting telemetry for RNW CLI.
36
+ */
37
+ export declare class Telemetry {
38
+ protected static client?: appInsights.TelemetryClient;
39
+ protected static options: TelemetryOptions;
40
+ protected static isTest: boolean;
41
+ protected static commandInfo: CommandInfo;
42
+ protected static versionsProp: Record<string, string>;
43
+ protected static projectProp?: projectUtils.AppProjectInfo | projectUtils.DependencyProjectInfo;
44
+ protected static getDefaultSetupString(): string;
45
+ protected static reset(): void;
46
+ static isEnabled(): boolean;
47
+ static getSessionId(): string;
48
+ /** Sets up the Telemetry static to be used elsewhere. */
49
+ static setup(options?: Partial<TelemetryOptions>): Promise<void>;
50
+ /** Sets up Telemetry.client. */
51
+ private static setupClient;
52
+ /** Sets up any base properties that all telemetry events require. */
53
+ private static setupBaseProperties;
54
+ /** Sets up any telemetry processors. */
55
+ private static setupTelemetryProcessors;
56
+ /**
57
+ * Performs the processing necessary (mostly PII sanitization) for all events.
58
+ * @param envelope The ApplicationInsights event envelope.
59
+ * @param _contextObjects An optional context object.
60
+ * @returns Whether to kee
61
+ */
62
+ private static basicTelemetryProcessor;
63
+ /**
64
+ * Performs the processing necessary (mostly PII sanitization) for error events.
65
+ * @param envelope
66
+ * @param _contextObjects
67
+ * @returns
68
+ */
69
+ private static errorTelemetryProcessor;
70
+ /** Tries to update the version of the named package/tool by calling getValue(). */
71
+ static tryUpdateVersionsProp(name: string, getValue: () => Promise<string | null>, forceRefresh?: boolean): Promise<boolean>;
72
+ /** Populates the versions property of tools we care to track. */
73
+ static populateToolsVersions(refresh?: boolean): Promise<void>;
74
+ /** Populates the versions property of npm packages we care to track. */
75
+ static populateNpmPackageVersions(refresh?: boolean): Promise<void>;
76
+ /** Populates the versions property of nuget packages we care to track. */
77
+ static populateNuGetPackageVersions(projectFile: string, refresh?: boolean): Promise<void>;
78
+ static setProjectInfo(info: projectUtils.AppProjectInfo | projectUtils.DependencyProjectInfo): void;
79
+ static startCommand(info: CommandStartInfo): void;
80
+ static endCommand(info: CommandEndInfo, extraProps?: Record<string, any>): void;
81
+ private static trackCommandEvent;
82
+ static trackException(error: Error, extraProps?: Record<string, any>): void;
83
+ }
84
+ export {};