@mastra/observability 1.17.6-alpha.1 → 1.17.6-alpha.2

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
@@ -9255,7 +9255,7 @@ var SensitiveDataFilter = class {
9255
9255
  if (obj === null || typeof obj !== "object") {
9256
9256
  if (typeof obj === "string") {
9257
9257
  const trimmed = obj.trim();
9258
- if (trimmed.startsWith("{") || trimmed.startsWith("[")) return this.redactJsonString(obj, indexedState);
9258
+ if (this.isJsonCandidate(trimmed)) return this.redactJsonString(obj, indexedState);
9259
9259
  }
9260
9260
  return obj;
9261
9261
  }
@@ -9272,6 +9272,16 @@ var SensitiveDataFilter = class {
9272
9272
  }
9273
9273
  return filtered;
9274
9274
  }
9275
+ isJsonCandidate(value) {
9276
+ const opening = value[0];
9277
+ if (opening !== "{" && opening !== "[") return false;
9278
+ let index = 1;
9279
+ while (value[index] === " " || value[index] === " " || value[index] === "\r" || value[index] === "\n") index++;
9280
+ const first = value[index];
9281
+ if (first === void 0) return false;
9282
+ if (opening === "{") return first === "\"" || first === "}";
9283
+ return first === "]" || first === "{" || first === "[" || first === "\"" || first === "-" || first >= "0" && first <= "9" || first === "t" || first === "f" || first === "n";
9284
+ }
9275
9285
  tryFilter(value, indexedState) {
9276
9286
  try {
9277
9287
  return this.deepFilter(value, /* @__PURE__ */ new WeakSet(), indexedState);