@hasna/mementos 0.14.70 → 0.14.71
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/lib/gdpr.d.ts +17 -2
- package/dist/lib/gdpr.d.ts.map +1 -1
- package/dist/mcp/index.js +12 -7
- package/package.json +1 -1
package/dist/lib/gdpr.d.ts
CHANGED
|
@@ -12,9 +12,24 @@ export interface GdprErasureResult {
|
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Erase all memories containing the given PII identifier.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
*
|
|
16
|
+
* Replaces `value` with "[REDACTED]", clears `summary`, `tags` and `metadata`,
|
|
17
|
+
* and rewrites `key` to `[REDACTED]:<random token>` — per-row, for the reason
|
|
18
|
+
* given at the UPDATE below. Nothing derived from the original key or imported
|
|
19
|
+
* row id is retained.
|
|
20
|
+
*
|
|
21
|
+
* The erase runs in ONE TRANSACTION and is therefore all-or-nothing: a caller
|
|
22
|
+
* never observes a partially-erased subject, and a failed attempt leaves the
|
|
23
|
+
* store fully intact so a retry starts from a clean, still-fully-matching set.
|
|
24
|
+
*
|
|
17
25
|
* Preserves the audit trail (audit_log entries have hashes, not content).
|
|
26
|
+
*
|
|
27
|
+
* NOTE: an erased memory is no longer reachable by its original key, so a later
|
|
28
|
+
* `save` under that key creates a NEW record rather than merging into the
|
|
29
|
+
* tombstone. That is deliberate: silently resurrecting an erased row and
|
|
30
|
+
* re-associating it with the data subject is precisely what erasure must
|
|
31
|
+
* prevent. Every foreign key into `memories` references `memories(id)` — no
|
|
32
|
+
* relational integrity depends on `key`, which is a human lookup handle only.
|
|
18
33
|
*/
|
|
19
34
|
export declare function gdprErase(identifier: string, options?: {
|
|
20
35
|
project_id?: string;
|
package/dist/lib/gdpr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gdpr.d.ts","sourceRoot":"","sources":["../../src/lib/gdpr.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG1D,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED
|
|
1
|
+
{"version":3,"file":"gdpr.d.ts","sourceRoot":"","sources":["../../src/lib/gdpr.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG1D,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IACP,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,EACN,EAAE,CAAC,EAAE,QAAQ,GACZ,iBAAiB,CA8JnB"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -12074,18 +12074,23 @@ function gdprErase(identifier, options = {}, db) {
|
|
|
12074
12074
|
timestamp
|
|
12075
12075
|
};
|
|
12076
12076
|
}
|
|
12077
|
-
const memoryIds =
|
|
12078
|
-
|
|
12079
|
-
|
|
12077
|
+
const memoryIds = d.transaction(() => {
|
|
12078
|
+
const ids = [];
|
|
12079
|
+
for (const row of rows) {
|
|
12080
|
+
const redactedKey = `[REDACTED]:${crypto.randomUUID()}`;
|
|
12081
|
+
d.run(`UPDATE memories SET
|
|
12082
|
+
key = ?,
|
|
12080
12083
|
value = '[REDACTED]',
|
|
12081
12084
|
summary = NULL,
|
|
12082
12085
|
tags = '[]',
|
|
12083
12086
|
metadata = '{}',
|
|
12084
12087
|
updated_at = ?
|
|
12085
|
-
WHERE id = ?`, [timestamp, row.id]);
|
|
12086
|
-
|
|
12087
|
-
|
|
12088
|
-
|
|
12088
|
+
WHERE id = ?`, [redactedKey, timestamp, row.id]);
|
|
12089
|
+
d.run("DELETE FROM memory_tags WHERE memory_id = ?", [row.id]);
|
|
12090
|
+
ids.push(row.id);
|
|
12091
|
+
}
|
|
12092
|
+
return ids;
|
|
12093
|
+
});
|
|
12089
12094
|
return {
|
|
12090
12095
|
erased_count: memoryIds.length,
|
|
12091
12096
|
memory_ids: memoryIds,
|