@mastra/observability 1.17.6-alpha.1 → 1.17.6

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.js CHANGED
@@ -9230,7 +9230,7 @@ var SensitiveDataFilter = class {
9230
9230
  if (obj === null || typeof obj !== "object") {
9231
9231
  if (typeof obj === "string") {
9232
9232
  const trimmed = obj.trim();
9233
- if (trimmed.startsWith("{") || trimmed.startsWith("[")) return this.redactJsonString(obj, indexedState);
9233
+ if (this.isJsonCandidate(trimmed)) return this.redactJsonString(obj, indexedState);
9234
9234
  }
9235
9235
  return obj;
9236
9236
  }
@@ -9247,6 +9247,16 @@ var SensitiveDataFilter = class {
9247
9247
  }
9248
9248
  return filtered;
9249
9249
  }
9250
+ isJsonCandidate(value) {
9251
+ const opening = value[0];
9252
+ if (opening !== "{" && opening !== "[") return false;
9253
+ let index = 1;
9254
+ while (value[index] === " " || value[index] === " " || value[index] === "\r" || value[index] === "\n") index++;
9255
+ const first = value[index];
9256
+ if (first === void 0) return false;
9257
+ if (opening === "{") return first === "\"" || first === "}";
9258
+ return first === "]" || first === "{" || first === "[" || first === "\"" || first === "-" || first >= "0" && first <= "9" || first === "t" || first === "f" || first === "n";
9259
+ }
9250
9260
  tryFilter(value, indexedState) {
9251
9261
  try {
9252
9262
  return this.deepFilter(value, /* @__PURE__ */ new WeakSet(), indexedState);