@salesforce/telemetry 7.0.4 → 7.0.5

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.
@@ -16,15 +16,14 @@ exports.O11yReporter = void 0;
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  */
19
+ /* eslint-disable no-underscore-dangle */
19
20
  /* eslint-disable-next-line @typescript-eslint/triple-slash-reference -- needed so dynamic import('o11y_schema/sf_pdp') is typed when test tsconfig compiles */
20
21
  /// <reference path="../types/o11y_schema_sf_pdp.d.ts" />
21
22
  const o11y_reporter_1 = require("@salesforce/o11y-reporter");
22
23
  // o11y_schema is ESM-only; load via dynamic import() so it works when telemetry is required as CJS
23
24
  let pdpEventSchemaPromise = null;
24
25
  async function getPdpEventSchema() {
25
- if (!pdpEventSchemaPromise) {
26
- pdpEventSchemaPromise = import('o11y_schema/sf_pdp').then((m) => m.pdpEventSchema);
27
- }
26
+ pdpEventSchemaPromise ??= import('o11y_schema/sf_pdp').then((m) => m.pdpEventSchema);
28
27
  return pdpEventSchemaPromise;
29
28
  }
30
29
  const baseReporter_1 = require("./baseReporter");
@@ -40,9 +39,7 @@ class O11yReporter extends baseReporter_1.BaseReporter {
40
39
  super(options);
41
40
  this.extensionName = options.extensionName ?? options.project;
42
41
  this.service = o11y_reporter_1.O11yService.getInstance(this.extensionName);
43
- const dynamicO11yUploadEndpointPath = options.dynamicO11yUploadEndpoint
44
- ? options.dynamicO11yUploadEndpoint
45
- : undefined;
42
+ const dynamicO11yUploadEndpointPath = options.dynamicO11yUploadEndpoint ?? undefined;
46
43
  this.initialized = this.service.initialize(this.extensionName, options.o11yUploadEndpoint, options.getConnectionFn, dynamicO11yUploadEndpointPath ? { dynamicO11yUploadEndpointPath } : undefined);
47
44
  this.commonProperties = this.buildO11yCommonProperties(options.commonProperties);
48
45
  }
@@ -86,6 +86,7 @@ class TelemetryReporter extends kit_1.AsyncCreatable {
86
86
  static async determineSfdxTelemetryEnabled() {
87
87
  return (0, enabledCheck_1.isEnabled)();
88
88
  }
89
+ // eslint-disable-next-line complexity
89
90
  async init() {
90
91
  this.enabled = await (0, enabledCheck_1.isEnabled)();
91
92
  this.logger = await core_1.Logger.child('TelemetryReporter');
@@ -196,7 +197,7 @@ class TelemetryReporter extends kit_1.AsyncCreatable {
196
197
  this.logger.error(`${appInsights_1.AppInsights.APP_INSIGHTS_SERVER} responded with ${resp.statusCode}`);
197
198
  throw new Error(resp.statusCode.toString());
198
199
  }
199
- catch (err) {
200
+ catch {
200
201
  this.logger.warn(`Connection to ${appInsights_1.AppInsights.APP_INSIGHTS_SERVER} timed out after ${timeout} ms`);
201
202
  return false;
202
203
  }
package/lib/types.d.ts CHANGED
@@ -22,22 +22,22 @@ export type O11ySchema = Record<string, unknown>;
22
22
  export type PdpEvent = {
23
23
  /**
24
24
  * Unique identifier for the event. Follows this naming convention:
25
- * <object>.<action>
25
+ * `<object>.<action>`
26
26
  *
27
27
  * object = Specific object within the Product Feature that give us context around the action in lowerCamelCase format.
28
- * Note: The object name can include context around the Product Feature (eg. slackforceMessage).
29
- * Examples: calculatedInsightsRecord,checkoutPaymentmethod, slackforceMessage, promptBuilderTemplate
28
+ * Note: The object name can include context around the Product Feature (eg. slackforceMessage).
29
+ * Examples: calculatedInsightsRecord,checkoutPaymentmethod, slackforceMessage, promptBuilderTemplate
30
30
  *
31
31
  * action = Action the user takes in past tense. This should only be ONE word, in lower case
32
- * Examples: processed, selected, sent, saved
32
+ * Examples: processed, selected, sent, saved
33
33
  */
34
34
  eventName: `${string}.${string}`;
35
35
  /**
36
36
  * Product Feature ID from GUS.
37
37
  *
38
38
  * Examples:
39
- * Salesforce CLI = aJCEE0000000mHP4AY
40
- * Salesforce Extensions for VS Code = aJCEE0000000mLm4AI
39
+ * Salesforce CLI = aJCEE0000000mHP4AY
40
+ * Salesforce Extensions for VS Code = aJCEE0000000mLm4AI
41
41
  */
42
42
  productFeatureId: `aJC${string}`;
43
43
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/telemetry",
3
- "version": "7.0.4",
3
+ "version": "7.0.5",
4
4
  "description": "Library for telemetry reporting to Application Insights and O11y",
5
5
  "main": "lib/exported",
6
6
  "exports": {
@@ -50,7 +50,13 @@
50
50
  "proxy-agent": "^6.5.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@salesforce/dev-scripts": "^11.0.4",
53
+ "@salesforce/dev-scripts": "^13.0.2",
54
+ "@types/chai": "^4.3.17",
55
+ "@types/mocha": "^10.0.10",
56
+ "@types/node": "^18",
57
+ "@types/sinon": "^10.0.20",
58
+ "eslint": "^10.4.0",
59
+ "eslint-config-salesforce-typescript": "^6.0.0",
54
60
  "ts-node": "^10.9.2",
55
61
  "typescript": "^5.9.3"
56
62
  },
@@ -95,6 +101,7 @@
95
101
  "src/**/*.ts",
96
102
  "test/**/*.ts",
97
103
  "messages/**",
104
+ "**/eslint.config.*",
98
105
  "**/.eslint*",
99
106
  "**/tsconfig.json"
100
107
  ],