@anuma/sdk 10.2.2 → 10.2.4

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
@@ -3415,6 +3415,7 @@ function isWordChar(ch) {
3415
3415
  }
3416
3416
  var PiiRedactor = class {
3417
3417
  constructor(options = {}) {
3418
+ this.disposed = false;
3418
3419
  /** Maps original PII value → placeholder tag. */
3419
3420
  this.valueToPlaceholder = /* @__PURE__ */ new Map();
3420
3421
  /** Maps placeholder tag → original PII value (reverse lookup for de-anonymization). */
@@ -3489,6 +3490,7 @@ var PiiRedactor = class {
3489
3490
  * The same value always gets the same placeholder within a redactor instance.
3490
3491
  */
3491
3492
  getPlaceholder(category, value) {
3493
+ if (this.disposed) throw new Error("PII redactor session ended");
3492
3494
  const normalizedValue = value.trim();
3493
3495
  const existing = this.valueToPlaceholder.get(normalizedValue);
3494
3496
  if (existing) return existing;
@@ -3864,6 +3866,11 @@ var PiiRedactor = class {
3864
3866
  this.warnedNonText = false;
3865
3867
  this.warnedNerFailure = false;
3866
3868
  }
3869
+ /** Clear the mappings and prevent new reversible mappings. */
3870
+ dispose() {
3871
+ this.disposed = true;
3872
+ this.clear();
3873
+ }
3867
3874
  };
3868
3875
  function isPiiRedactor(value) {
3869
3876
  return typeof value === "object" && value !== null && typeof value.redactMessages === "function" && typeof value.deAnonymize === "function";
package/dist/index.d.mts CHANGED
@@ -7543,6 +7543,7 @@ interface MessageRedactionResult {
7543
7543
  * same email address throughout the conversation.
7544
7544
  */
7545
7545
  declare class PiiRedactor {
7546
+ private disposed;
7546
7547
  /** Maps original PII value → placeholder tag. */
7547
7548
  private valueToPlaceholder;
7548
7549
  /** Maps placeholder tag → original PII value (reverse lookup for de-anonymization). */
@@ -7742,6 +7743,8 @@ declare class PiiRedactor {
7742
7743
  * Reset all state. Useful for testing or when starting a fresh conversation.
7743
7744
  */
7744
7745
  clear(): void;
7746
+ /** Clear the mappings and prevent new reversible mappings. */
7747
+ dispose(): void;
7745
7748
  }
7746
7749
  /**
7747
7750
  * Structural (duck-typed) check for a {@link PiiRedactor}. Used instead of
package/dist/index.d.ts CHANGED
@@ -7543,6 +7543,7 @@ interface MessageRedactionResult {
7543
7543
  * same email address throughout the conversation.
7544
7544
  */
7545
7545
  declare class PiiRedactor {
7546
+ private disposed;
7546
7547
  /** Maps original PII value → placeholder tag. */
7547
7548
  private valueToPlaceholder;
7548
7549
  /** Maps placeholder tag → original PII value (reverse lookup for de-anonymization). */
@@ -7742,6 +7743,8 @@ declare class PiiRedactor {
7742
7743
  * Reset all state. Useful for testing or when starting a fresh conversation.
7743
7744
  */
7744
7745
  clear(): void;
7746
+ /** Clear the mappings and prevent new reversible mappings. */
7747
+ dispose(): void;
7745
7748
  }
7746
7749
  /**
7747
7750
  * Structural (duck-typed) check for a {@link PiiRedactor}. Used instead of
package/dist/index.mjs CHANGED
@@ -3209,6 +3209,7 @@ function isWordChar(ch) {
3209
3209
  }
3210
3210
  var PiiRedactor = class {
3211
3211
  constructor(options = {}) {
3212
+ this.disposed = false;
3212
3213
  /** Maps original PII value → placeholder tag. */
3213
3214
  this.valueToPlaceholder = /* @__PURE__ */ new Map();
3214
3215
  /** Maps placeholder tag → original PII value (reverse lookup for de-anonymization). */
@@ -3283,6 +3284,7 @@ var PiiRedactor = class {
3283
3284
  * The same value always gets the same placeholder within a redactor instance.
3284
3285
  */
3285
3286
  getPlaceholder(category, value) {
3287
+ if (this.disposed) throw new Error("PII redactor session ended");
3286
3288
  const normalizedValue = value.trim();
3287
3289
  const existing = this.valueToPlaceholder.get(normalizedValue);
3288
3290
  if (existing) return existing;
@@ -3658,6 +3660,11 @@ var PiiRedactor = class {
3658
3660
  this.warnedNonText = false;
3659
3661
  this.warnedNerFailure = false;
3660
3662
  }
3663
+ /** Clear the mappings and prevent new reversible mappings. */
3664
+ dispose() {
3665
+ this.disposed = true;
3666
+ this.clear();
3667
+ }
3661
3668
  };
3662
3669
  function isPiiRedactor(value) {
3663
3670
  return typeof value === "object" && value !== null && typeof value.redactMessages === "function" && typeof value.deAnonymize === "function";
@@ -150,6 +150,7 @@ function isWordChar(ch) {
150
150
  }
151
151
  var PiiRedactor = class {
152
152
  constructor(options = {}) {
153
+ this.disposed = false;
153
154
  /** Maps original PII value → placeholder tag. */
154
155
  this.valueToPlaceholder = /* @__PURE__ */ new Map();
155
156
  /** Maps placeholder tag → original PII value (reverse lookup for de-anonymization). */
@@ -224,6 +225,7 @@ var PiiRedactor = class {
224
225
  * The same value always gets the same placeholder within a redactor instance.
225
226
  */
226
227
  getPlaceholder(category, value) {
228
+ if (this.disposed) throw new Error("PII redactor session ended");
227
229
  const normalizedValue = value.trim();
228
230
  const existing = this.valueToPlaceholder.get(normalizedValue);
229
231
  if (existing) return existing;
@@ -599,6 +601,11 @@ var PiiRedactor = class {
599
601
  this.warnedNonText = false;
600
602
  this.warnedNerFailure = false;
601
603
  }
604
+ /** Clear the mappings and prevent new reversible mappings. */
605
+ dispose() {
606
+ this.disposed = true;
607
+ this.clear();
608
+ }
602
609
  };
603
610
  function isPiiRedactor(value) {
604
611
  return typeof value === "object" && value !== null && typeof value.redactMessages === "function" && typeof value.deAnonymize === "function";
@@ -4,7 +4,7 @@ import {
4
4
  notifyConsolidationFallback,
5
5
  requiresResponsesTransport,
6
6
  resolvePiiRedactor
7
- } from "./chunk-RSA3S6OA.mjs";
7
+ } from "./chunk-7JYVPYGQ.mjs";
8
8
  import "./chunk-GYKJOWEO.mjs";
9
9
 
10
10
  // src/lib/memory/consolidate.ts