@salesforce/telemetry 6.7.0 → 6.7.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.
@@ -16,10 +16,17 @@ 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-next-line @typescript-eslint/triple-slash-reference -- needed so dynamic import('o11y_schema/sf_pdp') is typed when test tsconfig compiles */
20
+ /// <reference path="../types/o11y_schema_sf_pdp.d.ts" />
19
21
  const o11y_reporter_1 = require("@salesforce/o11y-reporter");
20
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
21
- // @ts-ignore o11y_schema/sf_pdp.d.ts is not a valid module
22
- const sf_pdp_1 = require("o11y_schema/sf_pdp");
22
+ // o11y_schema is ESM-only; load via dynamic import() so it works when telemetry is required as CJS
23
+ let pdpEventSchemaPromise = null;
24
+ async function getPdpEventSchema() {
25
+ if (!pdpEventSchemaPromise) {
26
+ pdpEventSchemaPromise = import('o11y_schema/sf_pdp').then((m) => m.pdpEventSchema);
27
+ }
28
+ return pdpEventSchemaPromise;
29
+ }
23
30
  const baseReporter_1 = require("./baseReporter");
24
31
  const utils_1 = require("./utils");
25
32
  class O11yReporter extends baseReporter_1.BaseReporter {
@@ -119,7 +126,8 @@ class O11yReporter extends baseReporter_1.BaseReporter {
119
126
  */
120
127
  async sendPdpEvent(event) {
121
128
  await this.initialized;
122
- this.service.logEventWithSchema(event, sf_pdp_1.pdpEventSchema);
129
+ const schema = await getPdpEventSchema();
130
+ this.service.logEventWithSchema(event, schema);
123
131
  if (!this._batchingEnabled) {
124
132
  await this.service.forceFlush();
125
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/telemetry",
3
- "version": "6.7.0",
3
+ "version": "6.7.1",
4
4
  "description": "Library for telemetry reporting to Application Insights and O11y",
5
5
  "main": "lib/exported",
6
6
  "exports": {