@react-native-windows/telemetry 0.0.0-canary.11 → 0.0.0-canary.111

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 (47) hide show
  1. package/lib-commonjs/e2etest/telemetry.test.d.ts +26 -0
  2. package/lib-commonjs/e2etest/telemetry.test.js +489 -0
  3. package/lib-commonjs/e2etest/telemetry.test.js.map +1 -0
  4. package/lib-commonjs/index.d.ts +11 -6
  5. package/lib-commonjs/index.js +26 -11
  6. package/lib-commonjs/index.js.map +1 -1
  7. package/lib-commonjs/telemetry.d.ts +74 -27
  8. package/lib-commonjs/telemetry.js +404 -171
  9. package/lib-commonjs/telemetry.js.map +1 -1
  10. package/lib-commonjs/test/{sanitize.test.d.ts → basePropUtils.test.d.ts} +7 -7
  11. package/lib-commonjs/test/basePropUtils.test.js +145 -0
  12. package/lib-commonjs/test/basePropUtils.test.js.map +1 -0
  13. package/lib-commonjs/test/errorUtils.test.d.ts +7 -0
  14. package/lib-commonjs/test/errorUtils.test.js +160 -0
  15. package/lib-commonjs/test/errorUtils.test.js.map +1 -0
  16. package/lib-commonjs/test/projectUtils.test.d.ts +7 -0
  17. package/lib-commonjs/test/projectUtils.test.js +88 -0
  18. package/lib-commonjs/test/projectUtils.test.js.map +1 -0
  19. package/lib-commonjs/test/sanitizeUtils.test.d.ts +7 -0
  20. package/lib-commonjs/test/sanitizeUtils.test.js +98 -0
  21. package/lib-commonjs/test/sanitizeUtils.test.js.map +1 -0
  22. package/lib-commonjs/test/versionUtils.test.d.ts +7 -0
  23. package/lib-commonjs/test/versionUtils.test.js +115 -0
  24. package/lib-commonjs/test/versionUtils.test.js.map +1 -0
  25. package/lib-commonjs/utils/basePropUtils.d.ts +92 -0
  26. package/lib-commonjs/utils/basePropUtils.js +217 -0
  27. package/lib-commonjs/utils/basePropUtils.js.map +1 -0
  28. package/lib-commonjs/utils/errorUtils.d.ts +93 -0
  29. package/lib-commonjs/utils/errorUtils.js +183 -0
  30. package/lib-commonjs/utils/errorUtils.js.map +1 -0
  31. package/lib-commonjs/utils/optionUtils.d.ts +45 -0
  32. package/lib-commonjs/utils/optionUtils.js +96 -0
  33. package/lib-commonjs/utils/optionUtils.js.map +1 -0
  34. package/lib-commonjs/utils/projectUtils.d.ts +50 -0
  35. package/lib-commonjs/utils/projectUtils.js +187 -0
  36. package/lib-commonjs/utils/projectUtils.js.map +1 -0
  37. package/lib-commonjs/utils/sanitizeUtils.d.ts +12 -0
  38. package/lib-commonjs/utils/sanitizeUtils.js +85 -0
  39. package/lib-commonjs/utils/sanitizeUtils.js.map +1 -0
  40. package/lib-commonjs/utils/versionUtils.d.ts +38 -0
  41. package/lib-commonjs/utils/versionUtils.js +156 -0
  42. package/lib-commonjs/utils/versionUtils.js.map +1 -0
  43. package/package.json +40 -22
  44. package/CHANGELOG.json +0 -155
  45. package/CHANGELOG.md +0 -79
  46. package/lib-commonjs/test/sanitize.test.js +0 -220
  47. package/lib-commonjs/test/sanitize.test.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAEH,yCAAwE;AAAhE,sGAAA,SAAS,OAAA;AAAE,2GAAA,cAAc,OAAA;AAAE,6GAAA,gBAAgB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,yCAKqB;AAJnB,sGAAA,SAAS,OAAA;AAMX,uDAA2E;AAAnE,mHAAA,kBAAkB,OAAA;AAAE,iHAAA,gBAAgB,OAAA;AAE5C,iDAA2E;AAAnE,wGAAA,UAAU,OAAA;AAAkB,yGAAA,WAAW,OAAA;AAE/C,mDAQ6B;AAP3B,oHAAA,qBAAqB,OAAA;AACrB,wHAAA,yBAAyB,OAAA;AACzB,wHAAA,yBAAyB,OAAA;AACzB,4GAAA,aAAa,OAAA;AAMf,qDAK8B;AAJ5B,mHAAA,mBAAmB,OAAA;AACnB,wHAAA,wBAAwB,OAAA;AAK1B,qDAA4D;AAApD,sHAAA,sBAAsB,OAAA","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nexport {\n Telemetry,\n TelemetryOptions,\n CommandStartInfo,\n CommandEndInfo,\n} from './telemetry';\n\nexport {deviceArchitecture, nodeArchitecture} from './utils/basePropUtils';\n\nexport {CodedError, CodedErrorType, CodedErrors} from './utils/errorUtils';\n\nexport {\n yargsOptionsToOptions,\n commanderNameToOptionName,\n commanderOptionsToOptions,\n optionsToArgs,\n OptionSanitizer,\n YargsOptionsType,\n CommanderOptionsType,\n} from './utils/optionUtils';\n\nexport {\n configToProjectInfo,\n getProjectFileFromConfig,\n AppProjectInfo,\n DependencyProjectInfo,\n} from './utils/projectUtils';\n\nexport {getVersionOfNpmPackage} from './utils/versionUtils';\n"]}
@@ -1,27 +1,74 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- * @format
5
- */
6
- import * as appInsights from 'applicationinsights';
7
- export declare class Telemetry {
8
- static client?: appInsights.TelemetryClient | undefined;
9
- static disable(): void;
10
- static setup(): void;
11
- static isCI(): boolean;
12
- static shouldDisable: boolean;
13
- }
14
- /**
15
- * Sanitize any paths that appear between quotes (''), brackets ([]), or double quotes ("").
16
- * @param msg the string to sanitize
17
- */
18
- export declare function sanitizeMessage(msg: string): string;
19
- export declare function sanitizeFrame(frame: any): void;
20
- export declare function tryGetErrorCode(msg: string): string | undefined;
21
- /**
22
- * Remove PII from exceptions' stack traces and messages
23
- * @param envelope the telemetry envelope. Provided by AppInsights.
24
- */
25
- export declare function sanitizeEnvelope(envelope: any): boolean;
26
- export declare function isMSFTInternal(): boolean;
27
- export declare function getDiskFreeSpace(drivePath: string | null): number;
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ * @format
5
+ */
6
+ import * as coreOneDS from '@microsoft/1ds-core-js';
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 appInsightsCore?: coreOneDS.AppInsightsCore;
39
+ protected static options: TelemetryOptions;
40
+ protected static isTestEnvironment: boolean;
41
+ protected static commandInfo: CommandInfo;
42
+ protected static versionsProp: Record<string, string>;
43
+ protected static projectProp?: projectUtils.AppProjectInfo | projectUtils.DependencyProjectInfo;
44
+ protected static commonProperties: {
45
+ [key: string]: string;
46
+ };
47
+ protected static getDefaultSetupString(): string;
48
+ protected static reset(): void;
49
+ static isEnabled(): boolean;
50
+ static getSessionId(): string;
51
+ /** Sets up the Telemetry static to be used elsewhere. */
52
+ static setup(options?: Partial<TelemetryOptions>): Promise<void>;
53
+ private static basicTelemetryInitializer;
54
+ /** Sets up Telemetry.appInsightsCore. */
55
+ private static setupClient;
56
+ /** Sets up any base properties that all telemetry events require. */
57
+ private static setupBaseProperties;
58
+ /** Tries to update the version of the named package/tool by calling getValue(). */
59
+ static tryUpdateVersionsProp(name: string, getValue: () => Promise<string | null>, forceRefresh?: boolean): Promise<boolean>;
60
+ /** Populates the versions property of tools we care to track. */
61
+ static populateToolsVersions(refresh?: boolean): Promise<void>;
62
+ /** Populates the versions property of npm packages we care to track. */
63
+ static populateNpmPackageVersions(refresh?: boolean): Promise<void>;
64
+ /** Populates the versions property of nuget packages we care to track. */
65
+ static populateNuGetPackageVersions(projectFile: string, refresh?: boolean): Promise<void>;
66
+ static setProjectInfo(info: projectUtils.AppProjectInfo | projectUtils.DependencyProjectInfo): void;
67
+ static startCommand(info: CommandStartInfo): void;
68
+ static endCommand(info: CommandEndInfo, extraProps?: Record<string, any>): void;
69
+ private static trackEvent;
70
+ private static trackCommandEvent;
71
+ static trackException(error: Error, extraProps?: Record<string, any>): void;
72
+ static convertErrorIntoExceptionData(error: Error): Record<string, any>;
73
+ }
74
+ export {};