@mastra/observability 1.21.0-alpha.2 → 1.21.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.
package/dist/index.cjs CHANGED
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
@@ -77,9 +77,7 @@ function routeToHandler(handler, event, logger) {
77
77
  }), handler.name, "score", logger);
78
78
  }
79
79
  break;
80
- case "feedback":
81
- if (handler.onFeedbackEvent) return catchAsyncResult(handler.onFeedbackEvent(event), handler.name, "feedback", logger);
82
- break;
80
+ case "feedback": if (handler.onFeedbackEvent) return catchAsyncResult(handler.onFeedbackEvent(event), handler.name, "feedback", logger);
83
81
  }
84
82
  } catch (err) {
85
83
  logger.error(`[Observability] Handler error [handler=${handler.name}]:`, err);
@@ -228,7 +226,7 @@ const VALUE_STRIP_KEYS = /* @__PURE__ */ new Set([
228
226
  const DEFAULT_DEEP_CLEAN_OPTIONS = Object.freeze({
229
227
  keysToStrip: [],
230
228
  maxDepth: 8,
231
- maxStringLength: 128 * 1024,
229
+ maxStringLength: 131072,
232
230
  maxArrayLength: 50,
233
231
  maxObjectKeys: 50
234
232
  });
@@ -1302,8 +1300,8 @@ function isRecord(value) {
1302
1300
  //#endregion
1303
1301
  //#region src/metrics/pricing-registry.ts
1304
1302
  const DATA_FILE_NAME = "pricing-data.json";
1305
- const REFRESH_INTERVAL_MS = 1440 * 60 * 1e3;
1306
- const MIN_REFRESH_ATTEMPT_INTERVAL_MS = 3600 * 1e3;
1303
+ const REFRESH_INTERVAL_MS = 864e5;
1304
+ const MIN_REFRESH_ATTEMPT_INTERVAL_MS = 36e5;
1307
1305
  const REFRESH_TIMEOUT_MS = 5e3;
1308
1306
  const CACHE_FILE = () => path.default.join(os.default.homedir(), ".cache", "mastra", "pricing-data.json");
1309
1307
  const CACHE_VERSION = 1;
@@ -2962,9 +2960,7 @@ var ModelSpanTracker = class {
2962
2960
  if (this.#currentChunkType !== "text") this.#startChunkSpan("text");
2963
2961
  this.#appendToAccumulator("text", chunk.payload.text);
2964
2962
  break;
2965
- case "text-end":
2966
- this.#endChunkSpan();
2967
- break;
2963
+ case "text-end": this.#endChunkSpan();
2968
2964
  }
2969
2965
  }
2970
2966
  /**
@@ -2979,9 +2975,7 @@ var ModelSpanTracker = class {
2979
2975
  if (this.#currentChunkType !== "reasoning") this.#startChunkSpan("reasoning");
2980
2976
  this.#appendToAccumulator("text", chunk.payload.text);
2981
2977
  break;
2982
- case "reasoning-end":
2983
- this.#endChunkSpan();
2984
- break;
2978
+ case "reasoning-end": this.#endChunkSpan();
2985
2979
  }
2986
2980
  }
2987
2981
  /**
@@ -3024,9 +3018,7 @@ var ModelSpanTracker = class {
3024
3018
  case "object":
3025
3019
  if (this.#currentChunkType !== "object") this.#startChunkSpan("object");
3026
3020
  break;
3027
- case "object-result":
3028
- this.#endChunkSpan(chunk.object);
3029
- break;
3021
+ case "object-result": this.#endChunkSpan(chunk.object);
3030
3022
  }
3031
3023
  }
3032
3024
  /**
@@ -3129,7 +3121,6 @@ var ModelSpanTracker = class {
3129
3121
  this.#createEventSpan(chunk.type, spanOutput, { metadata });
3130
3122
  break;
3131
3123
  }
3132
- default: break;
3133
3124
  }
3134
3125
  } }));
3135
3126
  }
@@ -3670,10 +3661,14 @@ var DefaultSpan = class extends BaseSpan {
3670
3661
  }
3671
3662
  this.traceId = getOrCreateTraceId(options);
3672
3663
  this.id = generateSpanId();
3673
- if (options.parentSpanId) if (isValidSpanId(options.parentSpanId)) this.parentSpanId = options.parentSpanId;
3674
- else console.error(`[Mastra Tracing] Invalid parentSpanId: must be 1-16 hexadecimal characters, got "${options.parentSpanId}". Ignoring.`);
3675
- if (options.externalParentSpanId) if (isValidSpanId(options.externalParentSpanId)) this.externalParentSpanId = options.externalParentSpanId;
3676
- else console.error(`[Mastra Tracing] Invalid externalParentSpanId: must be 1-16 hexadecimal characters, got "${options.externalParentSpanId}". Ignoring.`);
3664
+ if (options.parentSpanId) {
3665
+ if (isValidSpanId(options.parentSpanId)) this.parentSpanId = options.parentSpanId;
3666
+ else console.error(`[Mastra Tracing] Invalid parentSpanId: must be 1-16 hexadecimal characters, got "${options.parentSpanId}". Ignoring.`);
3667
+ }
3668
+ if (options.externalParentSpanId) {
3669
+ if (isValidSpanId(options.externalParentSpanId)) this.externalParentSpanId = options.externalParentSpanId;
3670
+ else console.error(`[Mastra Tracing] Invalid externalParentSpanId: must be 1-16 hexadecimal characters, got "${options.externalParentSpanId}". Ignoring.`);
3671
+ }
3677
3672
  }
3678
3673
  end(options) {
3679
3674
  if (this.isEvent) return;
@@ -3795,8 +3790,10 @@ function isValidSpanId(spanId) {
3795
3790
  return /^[0-9a-f]{1,16}$/i.test(spanId);
3796
3791
  }
3797
3792
  function getOrCreateTraceId(options) {
3798
- if (options.traceId) if (isValidTraceId(options.traceId)) return options.traceId;
3799
- else console.error(`[Mastra Tracing] Invalid traceId: must be 1-32 hexadecimal characters, got "${options.traceId}". Generating new trace ID.`);
3793
+ if (options.traceId) {
3794
+ if (isValidTraceId(options.traceId)) return options.traceId;
3795
+ else console.error(`[Mastra Tracing] Invalid traceId: must be 1-32 hexadecimal characters, got "${options.traceId}". Generating new trace ID.`);
3796
+ }
3800
3797
  return generateTraceId();
3801
3798
  }
3802
3799
  //#endregion
@@ -4045,17 +4042,13 @@ var EventBuffer = class {
4045
4042
  switch (this.#storageStrategy) {
4046
4043
  case "realtime":
4047
4044
  case "event-sourced":
4048
- case "batch-with-updates":
4049
- this.pushCreate(event);
4050
- break;
4045
+ case "batch-with-updates": this.pushCreate(event);
4051
4046
  }
4052
4047
  break;
4053
4048
  case _mastra_core_observability.TracingEventType.SPAN_UPDATED:
4054
4049
  switch (this.#storageStrategy) {
4055
4050
  case "realtime":
4056
- case "batch-with-updates":
4057
- this.pushUpdate(event);
4058
- break;
4051
+ case "batch-with-updates": this.pushUpdate(event);
4059
4052
  }
4060
4053
  break;
4061
4054
  case _mastra_core_observability.TracingEventType.SPAN_ENDED:
@@ -4065,14 +4058,10 @@ var EventBuffer = class {
4065
4058
  case "batch-with-updates":
4066
4059
  this.pushUpdate(event);
4067
4060
  break;
4068
- default:
4069
- this.pushCreate(event);
4070
- break;
4061
+ default: this.pushCreate(event);
4071
4062
  }
4072
4063
  break;
4073
- default:
4074
- this.pushCreate(event);
4075
- break;
4064
+ default: this.pushCreate(event);
4076
4065
  }
4077
4066
  }
4078
4067
  /** Re-add failed create events to the buffer, returning events that exceed max retries. */
@@ -4447,17 +4436,13 @@ var DefaultExporter = class extends BaseExporter {
4447
4436
  case "score":
4448
4437
  createScoreEvents.push(createEvent);
4449
4438
  break;
4450
- default:
4451
- createSpanEvents.push(createEvent);
4452
- break;
4439
+ default: createSpanEvents.push(createEvent);
4453
4440
  }
4454
4441
  for (const updateEvent of updates) switch (updateEvent.type) {
4455
4442
  case _mastra_core_observability.TracingEventType.SPAN_UPDATED:
4456
4443
  updateSpanEvents.push(updateEvent);
4457
4444
  break;
4458
- case _mastra_core_observability.TracingEventType.SPAN_ENDED:
4459
- endSpanEvents.push(updateEvent);
4460
- break;
4445
+ case _mastra_core_observability.TracingEventType.SPAN_ENDED: endSpanEvents.push(updateEvent);
4461
4446
  }
4462
4447
  const flushResults = await Promise.all([
4463
4448
  this.flushCreates("feedback", createFeedbackEvents, (events) => this.#observabilityStorage.batchCreateFeedback({ feedbacks: events.map((f) => (0, _mastra_core_storage.buildFeedbackRecord)(f)) })),
@@ -4474,13 +4459,15 @@ var DefaultExporter = class extends BaseExporter {
4474
4459
  flushResults.push(await this.flushSpanUpdates(updateSpanEvents, deferredUpdates, false));
4475
4460
  flushResults.push(await this.flushSpanUpdates(endSpanEvents, deferredUpdates, true));
4476
4461
  let deferredDropCount = 0;
4477
- if (deferredUpdates.length > 0) if (this.#unsupportedSignals.has("tracing")) {
4478
- deferredDropCount = deferredUpdates.length;
4479
- this.emitDrop("tracing", "unsupported-storage", deferredDropCount);
4480
- deferredUpdates.length = 0;
4481
- } else {
4482
- deferredDropCount = this.#eventBuffer.reAddUpdates(deferredUpdates).length;
4483
- this.emitDrop("tracing", "retry-exhausted", deferredDropCount);
4462
+ if (deferredUpdates.length > 0) {
4463
+ if (this.#unsupportedSignals.has("tracing")) {
4464
+ deferredDropCount = deferredUpdates.length;
4465
+ this.emitDrop("tracing", "unsupported-storage", deferredDropCount);
4466
+ deferredUpdates.length = 0;
4467
+ } else {
4468
+ deferredDropCount = this.#eventBuffer.reAddUpdates(deferredUpdates).length;
4469
+ this.emitDrop("tracing", "retry-exhausted", deferredDropCount);
4470
+ }
4484
4471
  }
4485
4472
  const retryAttempt = flushResults.reduce((earliestAttempt, result) => {
4486
4473
  if (result.retryAttempt === void 0) return earliestAttempt;
@@ -4898,17 +4885,13 @@ var MastraStorageExporter = class extends BaseExporter {
4898
4885
  case "score":
4899
4886
  createScoreEvents.push(createEvent);
4900
4887
  break;
4901
- default:
4902
- createSpanEvents.push(createEvent);
4903
- break;
4888
+ default: createSpanEvents.push(createEvent);
4904
4889
  }
4905
4890
  for (const updateEvent of updates) switch (updateEvent.type) {
4906
4891
  case _mastra_core_observability.TracingEventType.SPAN_UPDATED:
4907
4892
  updateSpanEvents.push(updateEvent);
4908
4893
  break;
4909
- case _mastra_core_observability.TracingEventType.SPAN_ENDED:
4910
- endSpanEvents.push(updateEvent);
4911
- break;
4894
+ case _mastra_core_observability.TracingEventType.SPAN_ENDED: endSpanEvents.push(updateEvent);
4912
4895
  }
4913
4896
  const flushResults = await Promise.all([
4914
4897
  this.flushCreates("feedback", createFeedbackEvents, (events) => this.#observabilityStorage.batchCreateFeedback({ feedbacks: events.map((f) => (0, _mastra_core_storage.buildFeedbackRecord)(f)) })),
@@ -4925,13 +4908,15 @@ var MastraStorageExporter = class extends BaseExporter {
4925
4908
  flushResults.push(await this.flushSpanUpdates(updateSpanEvents, deferredUpdates, false));
4926
4909
  flushResults.push(await this.flushSpanUpdates(endSpanEvents, deferredUpdates, true));
4927
4910
  let deferredDropCount = 0;
4928
- if (deferredUpdates.length > 0) if (this.#unsupportedSignals.has("tracing")) {
4929
- deferredDropCount = deferredUpdates.length;
4930
- this.emitDrop("tracing", "unsupported-storage", deferredDropCount);
4931
- deferredUpdates.length = 0;
4932
- } else {
4933
- deferredDropCount = this.#eventBuffer.reAddUpdates(deferredUpdates).length;
4934
- this.emitDrop("tracing", "retry-exhausted", deferredDropCount);
4911
+ if (deferredUpdates.length > 0) {
4912
+ if (this.#unsupportedSignals.has("tracing")) {
4913
+ deferredDropCount = deferredUpdates.length;
4914
+ this.emitDrop("tracing", "unsupported-storage", deferredDropCount);
4915
+ deferredUpdates.length = 0;
4916
+ } else {
4917
+ deferredDropCount = this.#eventBuffer.reAddUpdates(deferredUpdates).length;
4918
+ this.emitDrop("tracing", "retry-exhausted", deferredDropCount);
4919
+ }
4935
4920
  }
4936
4921
  const retryAttempt = flushResults.reduce((earliestAttempt, result) => {
4937
4922
  if (result.retryAttempt === void 0) return earliestAttempt;
@@ -5451,10 +5436,13 @@ var BaseObservabilityInstance = class extends _mastra_core_base.MastraBase {
5451
5436
  const parts = key.split(".");
5452
5437
  const rootKey = parts[0];
5453
5438
  const value = requestContext.get(rootKey);
5454
- if (value !== void 0) if (parts.length > 1) {
5455
- const nestedValue = (0, _mastra_core_utils.getNestedValue)(value, parts.slice(1).join("."));
5456
- if (nestedValue !== void 0) (0, _mastra_core_utils.setNestedValue)(result, key, nestedValue);
5457
- } else (0, _mastra_core_utils.setNestedValue)(result, key, value);
5439
+ if (value !== void 0) {
5440
+ if (parts.length > 1) {
5441
+ const nestedPath = parts.slice(1).join(".");
5442
+ const nestedValue = (0, _mastra_core_utils.getNestedValue)(value, nestedPath);
5443
+ if (nestedValue !== void 0) (0, _mastra_core_utils.setNestedValue)(result, key, nestedValue);
5444
+ } else (0, _mastra_core_utils.setNestedValue)(result, key, value);
5445
+ }
5458
5446
  }
5459
5447
  return result;
5460
5448
  }
@@ -6002,7 +5990,7 @@ function formatBaggage(entries) {
6002
5990
  const DEFAULT_LIMITS = {
6003
5991
  maxSpans: 10,
6004
5992
  maxLogs: 10,
6005
- maxPayloadBytes: 1024 * 1024
5993
+ maxPayloadBytes: 1048576
6006
5994
  };
6007
5995
  var ClientObservabilityProxyImpl = class {
6008
5996
  #resolveInstance;
@@ -6937,36 +6925,38 @@ var TrackingExporter = class extends BaseExporter {
6937
6925
  method
6938
6926
  });
6939
6927
  const { exportedSpan } = await this._preExportTracingEvent(event);
6940
- if (!this.skipBuildRootTask && !traceData.hasRoot()) if (exportedSpan.isRootSpan) {
6941
- this.logger.debug(`${this.name}: Building root`, {
6942
- traceId: exportedSpan.traceId,
6943
- spanId: exportedSpan.id
6944
- });
6945
- const rootData = await this._buildRoot({
6946
- span: exportedSpan,
6947
- traceData
6948
- });
6949
- if (rootData) {
6950
- this.logger.debug(`${this.name}: Adding root`, {
6928
+ if (!this.skipBuildRootTask && !traceData.hasRoot()) {
6929
+ if (exportedSpan.isRootSpan) {
6930
+ this.logger.debug(`${this.name}: Building root`, {
6951
6931
  traceId: exportedSpan.traceId,
6952
6932
  spanId: exportedSpan.id
6953
6933
  });
6954
- traceData.addRoot({
6955
- rootId: exportedSpan.id,
6956
- rootData
6934
+ const rootData = await this._buildRoot({
6935
+ span: exportedSpan,
6936
+ traceData
6957
6937
  });
6958
- this.#scheduleProcessWaitingForRoot(traceId);
6938
+ if (rootData) {
6939
+ this.logger.debug(`${this.name}: Adding root`, {
6940
+ traceId: exportedSpan.traceId,
6941
+ spanId: exportedSpan.id
6942
+ });
6943
+ traceData.addRoot({
6944
+ rootId: exportedSpan.id,
6945
+ rootData
6946
+ });
6947
+ this.#scheduleProcessWaitingForRoot(traceId);
6948
+ }
6949
+ } else {
6950
+ this.logger.debug(`${this.name}: Root does not exist, adding span to waiting queue.`, {
6951
+ traceId: exportedSpan.traceId,
6952
+ spanId: exportedSpan.id
6953
+ });
6954
+ traceData.addToWaitingQueue({
6955
+ event,
6956
+ waitingFor: "root"
6957
+ });
6958
+ return;
6959
6959
  }
6960
- } else {
6961
- this.logger.debug(`${this.name}: Root does not exist, adding span to waiting queue.`, {
6962
- traceId: exportedSpan.traceId,
6963
- spanId: exportedSpan.id
6964
- });
6965
- traceData.addToWaitingQueue({
6966
- event,
6967
- waitingFor: "root"
6968
- });
6969
- return;
6970
6960
  }
6971
6961
  if (exportedSpan.metadata && this.name in exportedSpan.metadata) {
6972
6962
  const metadata = exportedSpan.metadata[this.name];
@@ -7093,7 +7083,6 @@ var TrackingExporter = class extends BaseExporter {
7093
7083
  traceData
7094
7084
  });
7095
7085
  if (traceData.activeSpanCount() === 0) this.#scheduleCleanup(traceId);
7096
- break;
7097
7086
  }
7098
7087
  } catch (error) {
7099
7088
  this.logger.error(`${this.name}: exporter error`, {
@@ -7259,7 +7248,7 @@ function chainFormatters(formatters) {
7259
7248
  //#region src/exporters/auth-failure-cooldown.ts
7260
7249
  const AUTH_FAILURE_STATUSES = /* @__PURE__ */ new Set([401, 403]);
7261
7250
  const AUTH_COOLDOWN_BASE_MS = 6e4;
7262
- const AUTH_COOLDOWN_MAX_MS = 15 * 6e4;
7251
+ const AUTH_COOLDOWN_MAX_MS = 9e5;
7263
7252
  const AUTH_COOLDOWN_JITTER_RATIO = .1;
7264
7253
  var AuthFailureError = class extends Error {
7265
7254
  status;
@@ -7688,8 +7677,9 @@ var CloudExporter = class extends BaseExporter {
7688
7677
  succeeded: false,
7689
7678
  authFailureStatus: error.status
7690
7679
  };
7680
+ const errorId = `CLOUD_EXPORTER_FAILED_TO_BATCH_UPLOAD_${signal.toUpperCase()}`;
7691
7681
  const mastraError = new _mastra_core_error.MastraError({
7692
- id: `CLOUD_EXPORTER_FAILED_TO_BATCH_UPLOAD_${signal.toUpperCase()}`,
7682
+ id: errorId,
7693
7683
  domain: _mastra_core_error.ErrorDomain.MASTRA_OBSERVABILITY,
7694
7684
  category: _mastra_core_error.ErrorCategory.USER,
7695
7685
  details: {
@@ -8278,8 +8268,9 @@ var MastraPlatformExporter = class extends BaseExporter {
8278
8268
  succeeded: false,
8279
8269
  authFailureStatus: error.status
8280
8270
  };
8271
+ const errorId = `MASTRA_PLATFORM_EXPORTER_FAILED_TO_BATCH_UPLOAD_${signal.toUpperCase()}`;
8281
8272
  const mastraError = new _mastra_core_error.MastraError({
8282
- id: `MASTRA_PLATFORM_EXPORTER_FAILED_TO_BATCH_UPLOAD_${signal.toUpperCase()}`,
8273
+ id: errorId,
8283
8274
  domain: _mastra_core_error.ErrorDomain.MASTRA_OBSERVABILITY,
8284
8275
  category: _mastra_core_error.ErrorCategory.USER,
8285
8276
  details: {
@@ -9143,16 +9134,18 @@ var TestExporter = class extends BaseExporter {
9143
9134
  for (let i = 0; i < maxLen; i++) {
9144
9135
  const actualLine = actual[i];
9145
9136
  const expectedLine = expected[i];
9146
- if (actualLine !== expectedLine) if (actualLine === void 0) {
9147
- diffs.push(`Line ${i + 1}: Missing in actual`);
9148
- diffs.push(` Expected: ${expectedLine}`);
9149
- } else if (expectedLine === void 0) {
9150
- diffs.push(`Line ${i + 1}: Extra in actual`);
9151
- diffs.push(` Actual: ${actualLine}`);
9152
- } else {
9153
- diffs.push(`Line ${i + 1}:`);
9154
- diffs.push(` Expected: ${expectedLine}`);
9155
- diffs.push(` Actual: ${actualLine}`);
9137
+ if (actualLine !== expectedLine) {
9138
+ if (actualLine === void 0) {
9139
+ diffs.push(`Line ${i + 1}: Missing in actual`);
9140
+ diffs.push(` Expected: ${expectedLine}`);
9141
+ } else if (expectedLine === void 0) {
9142
+ diffs.push(`Line ${i + 1}: Extra in actual`);
9143
+ diffs.push(` Actual: ${actualLine}`);
9144
+ } else {
9145
+ diffs.push(`Line ${i + 1}:`);
9146
+ diffs.push(` Expected: ${expectedLine}`);
9147
+ diffs.push(` Actual: ${actualLine}`);
9148
+ }
9156
9149
  }
9157
9150
  }
9158
9151
  return diffs;
@@ -9161,15 +9154,15 @@ var TestExporter = class extends BaseExporter {
9161
9154
  * Deep compare two values, supporting special markers like __or__ and __any__.
9162
9155
  * Collects all mismatches into the provided array.
9163
9156
  */
9164
- #deepCompareWithMarkers(actual, expected, path$2, mismatches) {
9157
+ #deepCompareWithMarkers(actual, expected, path, mismatches) {
9165
9158
  if (this.#isOrMarker(expected)) {
9166
9159
  const allowedValues = expected.__or__;
9167
9160
  if (!allowedValues.some((allowed) => {
9168
9161
  const tempMismatches = [];
9169
- this.#deepCompareWithMarkers(actual, allowed, path$2, tempMismatches);
9162
+ this.#deepCompareWithMarkers(actual, allowed, path, tempMismatches);
9170
9163
  return tempMismatches.length === 0;
9171
9164
  })) mismatches.push({
9172
- path: path$2,
9165
+ path,
9173
9166
  expected: { __or__: allowedValues },
9174
9167
  actual
9175
9168
  });
@@ -9179,7 +9172,7 @@ var TestExporter = class extends BaseExporter {
9179
9172
  const typeConstraint = expected.__any__;
9180
9173
  if (actual === null || actual === void 0) {
9181
9174
  mismatches.push({
9182
- path: path$2,
9175
+ path,
9183
9176
  expected: { __any__: typeConstraint },
9184
9177
  actual
9185
9178
  });
@@ -9188,7 +9181,7 @@ var TestExporter = class extends BaseExporter {
9188
9181
  if (typeConstraint === true) return;
9189
9182
  const actualType = Array.isArray(actual) ? "array" : typeof actual;
9190
9183
  if (actualType !== typeConstraint) mismatches.push({
9191
- path: path$2,
9184
+ path,
9192
9185
  expected: { __any__: typeConstraint },
9193
9186
  actual: `(${actualType}) ${JSON.stringify(actual).slice(0, 50)}...`
9194
9187
  });
@@ -9197,7 +9190,7 @@ var TestExporter = class extends BaseExporter {
9197
9190
  if (Array.isArray(expected)) {
9198
9191
  if (!Array.isArray(actual)) {
9199
9192
  mismatches.push({
9200
- path: path$2,
9193
+ path,
9201
9194
  expected,
9202
9195
  actual
9203
9196
  });
@@ -9205,19 +9198,19 @@ var TestExporter = class extends BaseExporter {
9205
9198
  }
9206
9199
  if (actual.length !== expected.length) {
9207
9200
  mismatches.push({
9208
- path: `${path$2}.length`,
9201
+ path: `${path}.length`,
9209
9202
  expected: expected.length,
9210
9203
  actual: actual.length
9211
9204
  });
9212
9205
  return;
9213
9206
  }
9214
- for (let i = 0; i < expected.length; i++) this.#deepCompareWithMarkers(actual[i], expected[i], `${path$2}[${i}]`, mismatches);
9207
+ for (let i = 0; i < expected.length; i++) this.#deepCompareWithMarkers(actual[i], expected[i], `${path}[${i}]`, mismatches);
9215
9208
  return;
9216
9209
  }
9217
9210
  if (expected !== null && typeof expected === "object") {
9218
9211
  if (actual === null || typeof actual !== "object" || Array.isArray(actual)) {
9219
9212
  mismatches.push({
9220
- path: path$2,
9213
+ path,
9221
9214
  expected,
9222
9215
  actual
9223
9216
  });
@@ -9229,19 +9222,19 @@ var TestExporter = class extends BaseExporter {
9229
9222
  if (this.#isMetadataKey(key)) continue;
9230
9223
  if (!(key in actualObj)) {
9231
9224
  if (expectedObj[key] !== void 0) mismatches.push({
9232
- path: `${path$2}.${key}`,
9225
+ path: `${path}.${key}`,
9233
9226
  expected: expectedObj[key],
9234
9227
  actual: void 0
9235
9228
  });
9236
9229
  continue;
9237
9230
  }
9238
- this.#deepCompareWithMarkers(actualObj[key], expectedObj[key], `${path$2}.${key}`, mismatches);
9231
+ this.#deepCompareWithMarkers(actualObj[key], expectedObj[key], `${path}.${key}`, mismatches);
9239
9232
  }
9240
9233
  for (const key of Object.keys(actualObj)) {
9241
9234
  if (this.#isMetadataKey(key)) continue;
9242
9235
  if (!(key in expectedObj)) {
9243
9236
  if (actualObj[key] !== void 0) mismatches.push({
9244
- path: `${path$2}.${key}`,
9237
+ path: `${path}.${key}`,
9245
9238
  expected: void 0,
9246
9239
  actual: actualObj[key]
9247
9240
  });
@@ -9250,7 +9243,7 @@ var TestExporter = class extends BaseExporter {
9250
9243
  return;
9251
9244
  }
9252
9245
  if (actual !== expected) mismatches.push({
9253
- path: path$2,
9246
+ path,
9254
9247
  expected,
9255
9248
  actual
9256
9249
  });
@@ -9915,9 +9908,10 @@ var SensitiveDataFilter = class {
9915
9908
  const filtered = {};
9916
9909
  for (const key of Object.keys(obj)) {
9917
9910
  const normKey = this.normalizeKey(key);
9918
- if (this.isSensitive(normKey)) if (obj[key] && typeof obj[key] === "object") filtered[key] = this.deepFilter(obj[key], seen, indexedState);
9919
- else filtered[key] = this.redactValue(obj[key], normKey, indexedState);
9920
- else filtered[key] = this.deepFilter(obj[key], seen, indexedState);
9911
+ if (this.isSensitive(normKey)) {
9912
+ if (obj[key] && typeof obj[key] === "object") filtered[key] = this.deepFilter(obj[key], seen, indexedState);
9913
+ else filtered[key] = this.redactValue(obj[key], normKey, indexedState);
9914
+ } else filtered[key] = this.deepFilter(obj[key], seen, indexedState);
9921
9915
  }
9922
9916
  return filtered;
9923
9917
  }