@microsoft/power-apps-native-common 0.2.0 → 0.3.0

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.
@@ -57,10 +57,10 @@ Object.defineProperty(exports, "configureAppLogger", {
57
57
  return _AppLogger.configureAppLogger;
58
58
  }
59
59
  });
60
- Object.defineProperty(exports, "configureCustomerTelemetryLogger", {
60
+ Object.defineProperty(exports, "configureCustomEventsLogger", {
61
61
  enumerable: true,
62
62
  get: function () {
63
- return _CustomerTelemetryLogger.configureCustomerTelemetryLogger;
63
+ return _CustomEventsLogger.configureCustomEventsLogger;
64
64
  }
65
65
  });
66
66
  Object.defineProperty(exports, "getAppLogger", {
@@ -69,10 +69,10 @@ Object.defineProperty(exports, "getAppLogger", {
69
69
  return _AppLogger.getAppLogger;
70
70
  }
71
71
  });
72
- Object.defineProperty(exports, "getCustomerTelemetryLogger", {
72
+ Object.defineProperty(exports, "getCustomEventsLogger", {
73
73
  enumerable: true,
74
74
  get: function () {
75
- return _CustomerTelemetryLogger.getCustomerTelemetryLogger;
75
+ return _CustomEventsLogger.getCustomEventsLogger;
76
76
  }
77
77
  });
78
78
  Object.defineProperty(exports, "getHttpCorrelationProperties", {
@@ -140,6 +140,6 @@ var _suppressKnownWarnings = require("./telemetry/suppressKnownWarnings.js");
140
140
  var _HttpClient = require("./http/HttpClient.js");
141
141
  var _DeviceIdUtils = require("./utils/DeviceIdUtils.js");
142
142
  var _AppLogger = require("./telemetry/AppLogger.js");
143
- var _CustomerTelemetryLogger = require("./telemetry/CustomerTelemetryLogger.js");
143
+ var _CustomEventsLogger = require("./telemetry/CustomEventsLogger.js");
144
144
  var _TelemetryTypes = require("./telemetry/TelemetryTypes.js");
145
145
  var _ClusterCategory = require("./types/ClusterCategory.js");
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configureCustomEventsLogger = configureCustomEventsLogger;
7
+ exports.getCustomEventsLogger = getCustomEventsLogger;
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 CustomEventsLogger {
15
+ constructor(logger) {
16
+ this.logger = logger;
17
+ }
18
+ trackEvent(name, properties) {
19
+ this.logger.trackActivityEvent(name, this.withCustomEventsSource(properties));
20
+ }
21
+ trackError(name, error, properties) {
22
+ this.logger.trackErrorEvent(name, this.withCustomEventsSource({
23
+ ...properties,
24
+ error: error === undefined ? undefined : (0, _stringifyError.stringifyError)(error)
25
+ }));
26
+ }
27
+ trackScenario(name, properties) {
28
+ return this.logger.trackScenario(name, this.withCustomEventsSource(properties));
29
+ }
30
+ flush() {
31
+ return this.logger.flush();
32
+ }
33
+ withCustomEventsSource(properties) {
34
+ return {
35
+ ...properties,
36
+ telemetry_source: 'custom'
37
+ };
38
+ }
39
+ }
40
+ let customEventsLogger = new CustomEventsLogger(new _Logger.Logger());
41
+
42
+ /**
43
+ * Configures the custom-events singleton. Hosting infrastructure owns
44
+ * this function; application code should use getCustomEventsLogger().
45
+ */
46
+ function configureCustomEventsLogger(logger) {
47
+ customEventsLogger = new CustomEventsLogger(logger);
48
+ }
49
+
50
+ /**
51
+ * Returns the app's custom-events logger. It is a safe no-op until the
52
+ * host configures an Application Insights provider.
53
+ */
54
+ function getCustomEventsLogger() {
55
+ return customEventsLogger;
56
+ }
@@ -16,6 +16,6 @@ export { suppressKnownWarnings } from "./telemetry/suppressKnownWarnings.js";
16
16
  export { HttpClient, getHttpCorrelationProperties } from "./http/HttpClient.js";
17
17
  export { resolveDeviceId } from "./utils/DeviceIdUtils.js";
18
18
  export { configureAppLogger, getAppLogger } from "./telemetry/AppLogger.js";
19
- export { configureCustomerTelemetryLogger, getCustomerTelemetryLogger } from "./telemetry/CustomerTelemetryLogger.js";
19
+ export { configureCustomEventsLogger, getCustomEventsLogger } from "./telemetry/CustomEventsLogger.js";
20
20
  export { ScenarioResults, TelemetryEventNames } from "./telemetry/TelemetryTypes.js";
21
21
  export { Regions, regionToClusterCategory } from "./types/ClusterCategory.js";
@@ -0,0 +1,51 @@
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 CustomEventsLogger {
10
+ constructor(logger) {
11
+ this.logger = logger;
12
+ }
13
+ trackEvent(name, properties) {
14
+ this.logger.trackActivityEvent(name, this.withCustomEventsSource(properties));
15
+ }
16
+ trackError(name, error, properties) {
17
+ this.logger.trackErrorEvent(name, this.withCustomEventsSource({
18
+ ...properties,
19
+ error: error === undefined ? undefined : stringifyError(error)
20
+ }));
21
+ }
22
+ trackScenario(name, properties) {
23
+ return this.logger.trackScenario(name, this.withCustomEventsSource(properties));
24
+ }
25
+ flush() {
26
+ return this.logger.flush();
27
+ }
28
+ withCustomEventsSource(properties) {
29
+ return {
30
+ ...properties,
31
+ telemetry_source: 'custom'
32
+ };
33
+ }
34
+ }
35
+ let customEventsLogger = new CustomEventsLogger(new Logger());
36
+
37
+ /**
38
+ * Configures the custom-events singleton. Hosting infrastructure owns
39
+ * this function; application code should use getCustomEventsLogger().
40
+ */
41
+ export function configureCustomEventsLogger(logger) {
42
+ customEventsLogger = new CustomEventsLogger(logger);
43
+ }
44
+
45
+ /**
46
+ * Returns the app's custom-events logger. It is a safe no-op until the
47
+ * host configures an Application Insights provider.
48
+ */
49
+ export function getCustomEventsLogger() {
50
+ return customEventsLogger;
51
+ }
@@ -14,8 +14,8 @@ export { suppressKnownWarnings } from './telemetry/suppressKnownWarnings';
14
14
  export { HttpClient, getHttpCorrelationProperties } from './http/HttpClient';
15
15
  export { resolveDeviceId } from './utils/DeviceIdUtils';
16
16
  export { configureAppLogger, getAppLogger } from './telemetry/AppLogger';
17
- export { configureCustomerTelemetryLogger, getCustomerTelemetryLogger, } from './telemetry/CustomerTelemetryLogger';
18
- export type { ICustomerTelemetryLogger } from './telemetry/CustomerTelemetryLogger';
17
+ export { configureCustomEventsLogger, getCustomEventsLogger, } from './telemetry/CustomEventsLogger';
18
+ export type { ICustomEventsLogger } from './telemetry/CustomEventsLogger';
19
19
  export type { ITelemetryProvider, LoggerConfig, OneDsTelemetryProviderConfig, ApplicationInsightsTelemetryProviderConfig, PropertyColumnMap, TelemetryEnvelope, TelemetryEvent, TelemetryLocation, TelemetrySeverity, UserIdentity, } from './telemetry/TelemetryTypes';
20
20
  export { ScenarioResults, TelemetryEventNames } from './telemetry/TelemetryTypes';
21
21
  export type { ClusterCategory, Region } from './types/ClusterCategory';
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { ILogger, ScenarioTracker } from './ILogger';
5
+ export interface ICustomEventsLogger {
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 custom-events singleton. Hosting infrastructure owns
13
+ * this function; application code should use getCustomEventsLogger().
14
+ */
15
+ export declare function configureCustomEventsLogger(logger: ILogger): void;
16
+ /**
17
+ * Returns the app's custom-events logger. It is a safe no-op until the
18
+ * host configures an Application Insights provider.
19
+ */
20
+ export declare function getCustomEventsLogger(): ICustomEventsLogger;
21
+ //# sourceMappingURL=CustomEventsLogger.d.ts.map
@@ -86,7 +86,7 @@ export interface OneDsTelemetryProviderConfig {
86
86
  channelConfig?: Record<string, unknown>;
87
87
  }
88
88
  export interface ApplicationInsightsTelemetryProviderConfig {
89
- /** Connection string for the C1-owned workspace-based Application Insights resource. */
89
+ /** Connection string for the customer-owned workspace-based Application Insights resource. */
90
90
  connectionString: string;
91
91
  /** Stable generated-app identifier added to every telemetry item. */
92
92
  appId: string;
@@ -14,8 +14,8 @@ export { suppressKnownWarnings } from './telemetry/suppressKnownWarnings.js';
14
14
  export { HttpClient, getHttpCorrelationProperties } from './http/HttpClient.js';
15
15
  export { resolveDeviceId } from './utils/DeviceIdUtils.js';
16
16
  export { configureAppLogger, getAppLogger } from './telemetry/AppLogger.js';
17
- export { configureCustomerTelemetryLogger, getCustomerTelemetryLogger, } from './telemetry/CustomerTelemetryLogger.js';
18
- export type { ICustomerTelemetryLogger } from './telemetry/CustomerTelemetryLogger.js';
17
+ export { configureCustomEventsLogger, getCustomEventsLogger, } from './telemetry/CustomEventsLogger.js';
18
+ export type { ICustomEventsLogger } from './telemetry/CustomEventsLogger.js';
19
19
  export type { ITelemetryProvider, LoggerConfig, OneDsTelemetryProviderConfig, ApplicationInsightsTelemetryProviderConfig, PropertyColumnMap, TelemetryEnvelope, TelemetryEvent, TelemetryLocation, TelemetrySeverity, UserIdentity, } from './telemetry/TelemetryTypes.js';
20
20
  export { ScenarioResults, TelemetryEventNames } from './telemetry/TelemetryTypes.js';
21
21
  export type { ClusterCategory, Region } from './types/ClusterCategory.js';
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { ILogger, ScenarioTracker } from './ILogger.js';
5
+ export interface ICustomEventsLogger {
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 custom-events singleton. Hosting infrastructure owns
13
+ * this function; application code should use getCustomEventsLogger().
14
+ */
15
+ export declare function configureCustomEventsLogger(logger: ILogger): void;
16
+ /**
17
+ * Returns the app's custom-events logger. It is a safe no-op until the
18
+ * host configures an Application Insights provider.
19
+ */
20
+ export declare function getCustomEventsLogger(): ICustomEventsLogger;
21
+ //# sourceMappingURL=CustomEventsLogger.d.ts.map
@@ -86,7 +86,7 @@ export interface OneDsTelemetryProviderConfig {
86
86
  channelConfig?: Record<string, unknown>;
87
87
  }
88
88
  export interface ApplicationInsightsTelemetryProviderConfig {
89
- /** Connection string for the C1-owned workspace-based Application Insights resource. */
89
+ /** Connection string for the customer-owned workspace-based Application Insights resource. */
90
90
  connectionString: string;
91
91
  /** Stable generated-app identifier added to every telemetry item. */
92
92
  appId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/power-apps-native-common",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Shared utilities and types for Power Apps native packages",
5
5
  "author": "Microsoft Corporation",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -38,8 +38,8 @@
38
38
  "!lib/**/*.map"
39
39
  ],
40
40
  "scripts": {
41
- "prepack": "bob build && node ../../scripts/notices.js",
42
- "build": "bob build && node ../../scripts/notices.js",
41
+ "prepack": "bob build && node ../../scripts/package-build/notices.js",
42
+ "build": "bob build && node ../../scripts/package-build/notices.js",
43
43
  "test": "node --test test/*.test.js",
44
44
  "type-check": "tsc --noEmit"
45
45
  },
@@ -59,6 +59,7 @@
59
59
  "uuid": "^11.1.1"
60
60
  },
61
61
  "devDependencies": {
62
+ "@microsoft/power-apps-cli": "0.15.3",
62
63
  "@types/react": "19.2.14",
63
64
  "@types/uuid": "^10.0.0",
64
65
  "typescript": "5.8.3"
@@ -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