@microsoft/power-apps-native-common 0.2.2 → 0.3.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.
Files changed (38) hide show
  1. package/lib/NOTICE.txt +26 -0
  2. package/lib/commonjs/index.js +29 -5
  3. package/lib/commonjs/telemetry/AnonymousTelemetry.js +25 -0
  4. package/lib/commonjs/telemetry/CustomEventsLogger.js +56 -0
  5. package/lib/commonjs/telemetry/OneDsTelemetryProvider.js +47 -5
  6. package/lib/commonjs/telemetry/TelemetrySanitizer.js +25 -4
  7. package/lib/commonjs/telemetry/resolveTelemetryLocation.js +29 -3
  8. package/lib/commonjs/telemetry/stringifyError.js +7 -15
  9. package/lib/commonjs/utils/DeviceIdUtils.js +9 -28
  10. package/lib/module/index.js +3 -3
  11. package/lib/module/telemetry/AnonymousTelemetry.js +21 -0
  12. package/lib/module/telemetry/CustomEventsLogger.js +51 -0
  13. package/lib/module/telemetry/OneDsTelemetryProvider.js +47 -5
  14. package/lib/module/telemetry/TelemetrySanitizer.js +25 -4
  15. package/lib/module/telemetry/resolveTelemetryLocation.js +26 -3
  16. package/lib/module/telemetry/stringifyError.js +7 -16
  17. package/lib/module/utils/DeviceIdUtils.js +8 -28
  18. package/lib/typescript/commonjs/index.d.ts +4 -4
  19. package/lib/typescript/commonjs/telemetry/AnonymousTelemetry.d.ts +4 -0
  20. package/lib/typescript/commonjs/telemetry/CustomEventsLogger.d.ts +21 -0
  21. package/lib/typescript/commonjs/telemetry/OneDsTelemetryProvider.d.ts +8 -1
  22. package/lib/typescript/commonjs/telemetry/TelemetryTypes.d.ts +8 -1
  23. package/lib/typescript/commonjs/telemetry/resolveTelemetryLocation.d.ts +8 -1
  24. package/lib/typescript/commonjs/telemetry/stringifyError.d.ts +3 -3
  25. package/lib/typescript/commonjs/utils/DeviceIdUtils.d.ts +5 -12
  26. package/lib/typescript/module/index.d.ts +4 -4
  27. package/lib/typescript/module/telemetry/AnonymousTelemetry.d.ts +4 -0
  28. package/lib/typescript/module/telemetry/CustomEventsLogger.d.ts +21 -0
  29. package/lib/typescript/module/telemetry/OneDsTelemetryProvider.d.ts +8 -1
  30. package/lib/typescript/module/telemetry/TelemetryTypes.d.ts +8 -1
  31. package/lib/typescript/module/telemetry/resolveTelemetryLocation.d.ts +8 -1
  32. package/lib/typescript/module/telemetry/stringifyError.d.ts +3 -3
  33. package/lib/typescript/module/utils/DeviceIdUtils.d.ts +5 -12
  34. package/package.json +3 -2
  35. package/lib/commonjs/telemetry/CustomerTelemetryLogger.js +0 -56
  36. package/lib/module/telemetry/CustomerTelemetryLogger.js +0 -51
  37. package/lib/typescript/commonjs/telemetry/CustomerTelemetryLogger.d.ts +0 -21
  38. package/lib/typescript/module/telemetry/CustomerTelemetryLogger.d.ts +0 -21
@@ -2,9 +2,9 @@
2
2
  * Copyright (C) Microsoft Corporation. All rights reserved.
3
3
  */
4
4
  /**
5
- * Converts an unknown thrown value to a string suitable for telemetry.
6
- * PII (email addresses, private IPv4 addresses) is redacted before the
7
- * string is returned.
5
+ * Classifies an unknown thrown value without exporting its message, stack, or
6
+ * serialized contents. Error prose is not a safe telemetry contract because
7
+ * upstream services may include customer data or credentials in it.
8
8
  */
9
9
  export declare function stringifyError(error: unknown): string;
10
10
  //# sourceMappingURL=stringifyError.d.ts.map
@@ -2,18 +2,9 @@
2
2
  * Copyright (C) Microsoft Corporation. All rights reserved.
3
3
  */
4
4
  /**
5
- * Returns a stable device identifier, preferring platform-native IDs that
6
- * survive app reinstalls:
7
- *
8
- * - **iOS**: `getIosIdForVendorAsync()` (IDFV) — stable while ≥1 app from the
9
- * same vendor bundle prefix is installed. Resets only when ALL vendor apps
10
- * are removed.
11
- * - **Android**: `getAndroidId()` (SSAID) — scoped to the app signing key on
12
- * Android 8+; survives reinstalls as long as the signing key is unchanged.
13
- *
14
- * If the platform API returns null (rare edge cases: first boot, some emulators)
15
- * the function falls back to a UUID persisted in `expo-secure-store`, which on
16
- * iOS survives reinstalls via the Keychain and on Android is per-install only.
5
+ * Returns a random app-scoped telemetry identifier. It does not use IDFV,
6
+ * SSAID, or another platform device identifier, and can be rotated with
7
+ * `resetDeviceId()` for deletion and opt-out workflows.
17
8
  *
18
9
  * Pass the resolved value to `OneDsTelemetryProviderConfig.deviceId` at startup.
19
10
  *
@@ -26,4 +17,6 @@
26
17
  * ```
27
18
  */
28
19
  export declare function resolveDeviceId(): Promise<string>;
20
+ /** Deletes the app-scoped telemetry identifier so the next resolution rotates it. */
21
+ export declare function resetDeviceId(): Promise<void>;
29
22
  //# sourceMappingURL=DeviceIdUtils.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/power-apps-native-common",
3
- "version": "0.2.2",
3
+ "version": "0.3.2",
4
4
  "description": "Shared utilities and types for Power Apps native packages",
5
5
  "author": "Microsoft Corporation",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -53,7 +53,8 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@microsoft/1ds-post-js": "4.4.1",
56
- "@microsoft/applicationinsights-core-js": "3.4.1",
56
+ "@microsoft/applicationinsights-channel-js": "3.4.3",
57
+ "@microsoft/applicationinsights-core-js": "3.4.3",
57
58
  "@microsoft/applicationinsights-react-native": "4.4.1",
58
59
  "@microsoft/applicationinsights-web": "3.4.3",
59
60
  "uuid": "^11.1.1"
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.configureCustomerTelemetryLogger = configureCustomerTelemetryLogger;
7
- exports.getCustomerTelemetryLogger = getCustomerTelemetryLogger;
8
- var _Logger = require("./Logger.js");
9
- var _stringifyError = require("./stringifyError.js");
10
- /*!
11
- * Copyright (C) Microsoft Corporation. All rights reserved.
12
- */
13
-
14
- class CustomerTelemetryLogger {
15
- constructor(logger) {
16
- this.logger = logger;
17
- }
18
- trackEvent(name, properties) {
19
- this.logger.trackActivityEvent(name, this.withCustomerSource(properties));
20
- }
21
- trackError(name, error, properties) {
22
- this.logger.trackErrorEvent(name, this.withCustomerSource({
23
- ...properties,
24
- error: error === undefined ? undefined : (0, _stringifyError.stringifyError)(error)
25
- }));
26
- }
27
- trackScenario(name, properties) {
28
- return this.logger.trackScenario(name, this.withCustomerSource(properties));
29
- }
30
- flush() {
31
- return this.logger.flush();
32
- }
33
- withCustomerSource(properties) {
34
- return {
35
- ...properties,
36
- telemetry_source: 'customer'
37
- };
38
- }
39
- }
40
- let customerTelemetryLogger = new CustomerTelemetryLogger(new _Logger.Logger());
41
-
42
- /**
43
- * Configures the customer telemetry singleton. Hosting infrastructure owns
44
- * this function; application code should use getCustomerTelemetryLogger().
45
- */
46
- function configureCustomerTelemetryLogger(logger) {
47
- customerTelemetryLogger = new CustomerTelemetryLogger(logger);
48
- }
49
-
50
- /**
51
- * Returns the customer-owned telemetry logger. It is a safe no-op until the
52
- * host configures an Application Insights provider.
53
- */
54
- function getCustomerTelemetryLogger() {
55
- return customerTelemetryLogger;
56
- }
@@ -1,51 +0,0 @@
1
- "use strict";
2
-
3
- /*!
4
- * Copyright (C) Microsoft Corporation. All rights reserved.
5
- */
6
-
7
- import { Logger } from "./Logger.js";
8
- import { stringifyError } from "./stringifyError.js";
9
- class CustomerTelemetryLogger {
10
- constructor(logger) {
11
- this.logger = logger;
12
- }
13
- trackEvent(name, properties) {
14
- this.logger.trackActivityEvent(name, this.withCustomerSource(properties));
15
- }
16
- trackError(name, error, properties) {
17
- this.logger.trackErrorEvent(name, this.withCustomerSource({
18
- ...properties,
19
- error: error === undefined ? undefined : stringifyError(error)
20
- }));
21
- }
22
- trackScenario(name, properties) {
23
- return this.logger.trackScenario(name, this.withCustomerSource(properties));
24
- }
25
- flush() {
26
- return this.logger.flush();
27
- }
28
- withCustomerSource(properties) {
29
- return {
30
- ...properties,
31
- telemetry_source: 'customer'
32
- };
33
- }
34
- }
35
- let customerTelemetryLogger = new CustomerTelemetryLogger(new Logger());
36
-
37
- /**
38
- * Configures the customer telemetry singleton. Hosting infrastructure owns
39
- * this function; application code should use getCustomerTelemetryLogger().
40
- */
41
- export function configureCustomerTelemetryLogger(logger) {
42
- customerTelemetryLogger = new CustomerTelemetryLogger(logger);
43
- }
44
-
45
- /**
46
- * Returns the customer-owned telemetry logger. It is a safe no-op until the
47
- * host configures an Application Insights provider.
48
- */
49
- export function getCustomerTelemetryLogger() {
50
- return customerTelemetryLogger;
51
- }
@@ -1,21 +0,0 @@
1
- /*!
2
- * Copyright (C) Microsoft Corporation. All rights reserved.
3
- */
4
- import type { ILogger, ScenarioTracker } from './ILogger';
5
- export interface ICustomerTelemetryLogger {
6
- trackEvent(name: string, properties?: Record<string, unknown>): void;
7
- trackError(name: string, error?: unknown, properties?: Record<string, unknown>): void;
8
- trackScenario(name: string, properties?: Record<string, unknown>): ScenarioTracker;
9
- flush(): Promise<void>;
10
- }
11
- /**
12
- * Configures the customer telemetry singleton. Hosting infrastructure owns
13
- * this function; application code should use getCustomerTelemetryLogger().
14
- */
15
- export declare function configureCustomerTelemetryLogger(logger: ILogger): void;
16
- /**
17
- * Returns the customer-owned telemetry logger. It is a safe no-op until the
18
- * host configures an Application Insights provider.
19
- */
20
- export declare function getCustomerTelemetryLogger(): ICustomerTelemetryLogger;
21
- //# sourceMappingURL=CustomerTelemetryLogger.d.ts.map
@@ -1,21 +0,0 @@
1
- /*!
2
- * Copyright (C) Microsoft Corporation. All rights reserved.
3
- */
4
- import type { ILogger, ScenarioTracker } from './ILogger.js';
5
- export interface ICustomerTelemetryLogger {
6
- trackEvent(name: string, properties?: Record<string, unknown>): void;
7
- trackError(name: string, error?: unknown, properties?: Record<string, unknown>): void;
8
- trackScenario(name: string, properties?: Record<string, unknown>): ScenarioTracker;
9
- flush(): Promise<void>;
10
- }
11
- /**
12
- * Configures the customer telemetry singleton. Hosting infrastructure owns
13
- * this function; application code should use getCustomerTelemetryLogger().
14
- */
15
- export declare function configureCustomerTelemetryLogger(logger: ILogger): void;
16
- /**
17
- * Returns the customer-owned telemetry logger. It is a safe no-op until the
18
- * host configures an Application Insights provider.
19
- */
20
- export declare function getCustomerTelemetryLogger(): ICustomerTelemetryLogger;
21
- //# sourceMappingURL=CustomerTelemetryLogger.d.ts.map