memorysync-sdk 1.7.0 → 1.7.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.mjs CHANGED
@@ -532,7 +532,7 @@ var IntegrationsNamespace = class extends Namespace {
532
532
  };
533
533
 
534
534
  // src/control-plane.ts
535
- var SDK_VERSION = "1.7.0";
535
+ var SDK_VERSION = "1.7.2";
536
536
  function safeJson(text) {
537
537
  try {
538
538
  return JSON.parse(text);
@@ -1088,7 +1088,7 @@ var ControlPlaneClient = class {
1088
1088
  };
1089
1089
 
1090
1090
  // src/index.ts
1091
- var SDK_VERSION2 = "1.7.0";
1091
+ var SDK_VERSION2 = "1.7.2";
1092
1092
  function camelToSnakeKey(key) {
1093
1093
  return key.replace(/([A-Z])/g, "_$1").toLowerCase();
1094
1094
  }
@@ -1365,7 +1365,7 @@ var MemorySyncClient = class {
1365
1365
  if (f.after !== void 0) filters.after = f.after;
1366
1366
  if (Object.keys(filters).length === 0) {
1367
1367
  throw new ValidationError(
1368
- "filters must set at least one criterion; use purgeUser() to remove everything for an end user"
1368
+ "filters must set at least one criterion; to remove everything for an end user use a wide criterion such as { before: new Date() }"
1369
1369
  );
1370
1370
  }
1371
1371
  body.filters = filters;
@@ -1375,13 +1375,33 @@ var MemorySyncClient = class {
1375
1375
  return await this.request("DELETE", "/memory/forget", { body });
1376
1376
  }
1377
1377
  /**
1378
- * Delete every memory belonging to the calling end user.
1378
+ * Not a memory operation, and not callable from this SDK. Always throws.
1379
1379
  *
1380
- * Separate from {@link forget} on purpose: this reads like what it does, so a
1381
- * whole-namespace delete can never be the accidental result of an empty filter.
1380
+ * `DELETE /memory/user/purge` reads as if it clears one end user's memories.
1381
+ * It does neither. It ignores `endUserId` and erases the **account** behind
1382
+ * the credential, cascading to the password hash, every API key, memberships,
1383
+ * auth providers and MFA credentials. Nobody can sign in afterwards, and the
1384
+ * API cannot repair it, because the credential that would authorise a repair
1385
+ * is one of the things it destroys.
1386
+ *
1387
+ * Earlier versions of this method described it as "delete every memory
1388
+ * belonging to the calling end user", and callers who believed that lost
1389
+ * accounts.
1390
+ *
1391
+ * The server now refuses account erasure for every API-key caller, and this
1392
+ * client authenticates only with an API key, so the call could never succeed.
1393
+ * It throws locally rather than sending a request that can only come back 403,
1394
+ * so the reason arrives immediately and no destructive intent leaves the
1395
+ * process. Erase an account from the dashboard, where a human is present.
1396
+ *
1397
+ * @deprecated Use {@link forget} for anything memory-related: by ids, or with
1398
+ * a wide criterion such as `{ before: new Date() }` to clear an end user.
1399
+ * @throws {ValidationError} Always.
1382
1400
  */
1383
1401
  async purgeUser() {
1384
- return await this.request("DELETE", "/memory/user/purge") ?? {};
1402
+ throw new ValidationError(
1403
+ "purgeUser() erases the whole account, not its memories: the password hash, every API key and all sign-in credentials go with it. The API refuses this for API-key callers, and this client only supports API keys, so the call cannot succeed. To delete memories use forget(), either with ids or a wide criterion such as { before: new Date() }. To close an account, use the dashboard."
1404
+ );
1385
1405
  }
1386
1406
  async summarize(req) {
1387
1407
  if (!req.memoryIds || req.memoryIds.length === 0) {