@anuma/sdk 10.5.3 → 10.5.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.
@@ -12448,7 +12448,7 @@ async function createRemoteMemoryPersistence(options) {
12448
12448
  ...item,
12449
12449
  memory: {
12450
12450
  ...item.memory,
12451
- content: await decrypt(item.memory.content),
12451
+ content: item.memory.is_deleted && item.memory.content === "" ? "" : await decrypt(item.memory.content),
12452
12452
  ...item.memory.kind_value !== void 0 && {
12453
12453
  kind_value: await decrypt(item.memory.kind_value)
12454
12454
  }
@@ -12542,7 +12542,8 @@ async function createRemoteMemoryPersistence(options) {
12542
12542
  }
12543
12543
  if (existing && existing.version !== expectedVersion) throw conflict();
12544
12544
  const decoded = existing ? await decode(existing).catch(() => void 0) : void 0;
12545
- const content = (snapshot?.content ?? decoded?.memory.content) === memory.content ? snapshot?.encryptedContent ?? existing.memory.content : await encryptField2(memory.content);
12545
+ const reusableContent = snapshot?.encryptedContent ?? existing?.memory.content;
12546
+ const content = reusableContent && (snapshot?.content ?? decoded?.memory.content) === memory.content ? reusableContent : await encryptField2(memory.content);
12546
12547
  const kindValue = memory.kind_value === void 0 ? void 0 : (snapshot?.kindValue ?? decoded?.memory.kind_value) === memory.kind_value ? snapshot?.encryptedKindValue ?? existing.memory.kind_value : await encryptField2(memory.kind_value);
12547
12548
  return {
12548
12549
  body: {
@@ -25859,6 +25860,13 @@ var METADATA_FIELDS = [
25859
25860
  "published_at",
25860
25861
  "geohash"
25861
25862
  ];
25863
+ var TOMBSTONE_FIELDS = [
25864
+ "scope",
25865
+ "is_deleted",
25866
+ "embedding_model",
25867
+ "topics_updated_at",
25868
+ "last_observed_at"
25869
+ ];
25862
25870
  function text15(value) {
25863
25871
  return typeof value === "string" && value !== "" ? value : void 0;
25864
25872
  }
@@ -26006,7 +26014,8 @@ async function embedMissing(prepared, options, model, signal) {
26006
26014
  }
26007
26015
  function sameMetadata2(local, remote, model) {
26008
26016
  const mine = metadata2(local, model);
26009
- return METADATA_FIELDS.every((field10) => {
26017
+ const fields = bool(local.is_deleted) ? TOMBSTONE_FIELDS : METADATA_FIELDS;
26018
+ return fields.every((field10) => {
26010
26019
  const a = mine[field10] ?? null;
26011
26020
  const b = remote[field10] ?? null;
26012
26021
  if (field10 === "embedding_model" && a === null) return true;
@@ -10776,7 +10776,7 @@ async function createRemoteMemoryPersistence(options) {
10776
10776
  ...item,
10777
10777
  memory: {
10778
10778
  ...item.memory,
10779
- content: await decrypt(item.memory.content),
10779
+ content: item.memory.is_deleted && item.memory.content === "" ? "" : await decrypt(item.memory.content),
10780
10780
  ...item.memory.kind_value !== void 0 && {
10781
10781
  kind_value: await decrypt(item.memory.kind_value)
10782
10782
  }
@@ -10870,7 +10870,8 @@ async function createRemoteMemoryPersistence(options) {
10870
10870
  }
10871
10871
  if (existing && existing.version !== expectedVersion) throw conflict();
10872
10872
  const decoded = existing ? await decode(existing).catch(() => void 0) : void 0;
10873
- const content = (snapshot?.content ?? decoded?.memory.content) === memory.content ? snapshot?.encryptedContent ?? existing.memory.content : await encryptField2(memory.content);
10873
+ const reusableContent = snapshot?.encryptedContent ?? existing?.memory.content;
10874
+ const content = reusableContent && (snapshot?.content ?? decoded?.memory.content) === memory.content ? reusableContent : await encryptField2(memory.content);
10874
10875
  const kindValue = memory.kind_value === void 0 ? void 0 : (snapshot?.kindValue ?? decoded?.memory.kind_value) === memory.kind_value ? snapshot?.encryptedKindValue ?? existing.memory.kind_value : await encryptField2(memory.kind_value);
10875
10876
  return {
10876
10877
  body: {
@@ -24140,6 +24141,13 @@ var METADATA_FIELDS = [
24140
24141
  "published_at",
24141
24142
  "geohash"
24142
24143
  ];
24144
+ var TOMBSTONE_FIELDS = [
24145
+ "scope",
24146
+ "is_deleted",
24147
+ "embedding_model",
24148
+ "topics_updated_at",
24149
+ "last_observed_at"
24150
+ ];
24143
24151
  function text15(value) {
24144
24152
  return typeof value === "string" && value !== "" ? value : void 0;
24145
24153
  }
@@ -24287,7 +24295,8 @@ async function embedMissing(prepared, options, model, signal) {
24287
24295
  }
24288
24296
  function sameMetadata2(local, remote, model) {
24289
24297
  const mine = metadata2(local, model);
24290
- return METADATA_FIELDS.every((field10) => {
24298
+ const fields = bool(local.is_deleted) ? TOMBSTONE_FIELDS : METADATA_FIELDS;
24299
+ return fields.every((field10) => {
24291
24300
  const a = mine[field10] ?? null;
24292
24301
  const b = remote[field10] ?? null;
24293
24302
  if (field10 === "embedding_model" && a === null) return true;
@@ -13218,7 +13218,7 @@ async function createRemoteMemoryPersistence(options) {
13218
13218
  ...item,
13219
13219
  memory: {
13220
13220
  ...item.memory,
13221
- content: await decrypt(item.memory.content),
13221
+ content: item.memory.is_deleted && item.memory.content === "" ? "" : await decrypt(item.memory.content),
13222
13222
  ...item.memory.kind_value !== void 0 && {
13223
13223
  kind_value: await decrypt(item.memory.kind_value)
13224
13224
  }
@@ -13312,7 +13312,8 @@ async function createRemoteMemoryPersistence(options) {
13312
13312
  }
13313
13313
  if (existing && existing.version !== expectedVersion) throw conflict();
13314
13314
  const decoded = existing ? await decode(existing).catch(() => void 0) : void 0;
13315
- const content = (snapshot?.content ?? decoded?.memory.content) === memory.content ? snapshot?.encryptedContent ?? existing.memory.content : await encryptField2(memory.content);
13315
+ const reusableContent = snapshot?.encryptedContent ?? existing?.memory.content;
13316
+ const content = reusableContent && (snapshot?.content ?? decoded?.memory.content) === memory.content ? reusableContent : await encryptField2(memory.content);
13316
13317
  const kindValue = memory.kind_value === void 0 ? void 0 : (snapshot?.kindValue ?? decoded?.memory.kind_value) === memory.kind_value ? snapshot?.encryptedKindValue ?? existing.memory.kind_value : await encryptField2(memory.kind_value);
13317
13318
  return {
13318
13319
  body: {
@@ -28192,6 +28193,13 @@ var METADATA_FIELDS = [
28192
28193
  "published_at",
28193
28194
  "geohash"
28194
28195
  ];
28196
+ var TOMBSTONE_FIELDS = [
28197
+ "scope",
28198
+ "is_deleted",
28199
+ "embedding_model",
28200
+ "topics_updated_at",
28201
+ "last_observed_at"
28202
+ ];
28195
28203
  function text15(value) {
28196
28204
  return typeof value === "string" && value !== "" ? value : void 0;
28197
28205
  }
@@ -28339,7 +28347,8 @@ async function embedMissing(prepared, options, model, signal) {
28339
28347
  }
28340
28348
  function sameMetadata2(local, remote, model) {
28341
28349
  const mine = metadata2(local, model);
28342
- return METADATA_FIELDS.every((field10) => {
28350
+ const fields = bool(local.is_deleted) ? TOMBSTONE_FIELDS : METADATA_FIELDS;
28351
+ return fields.every((field10) => {
28343
28352
  const a = mine[field10] ?? null;
28344
28353
  const b = remote[field10] ?? null;
28345
28354
  if (field10 === "embedding_model" && a === null) return true;
@@ -11345,7 +11345,7 @@ async function createRemoteMemoryPersistence(options) {
11345
11345
  ...item,
11346
11346
  memory: {
11347
11347
  ...item.memory,
11348
- content: await decrypt(item.memory.content),
11348
+ content: item.memory.is_deleted && item.memory.content === "" ? "" : await decrypt(item.memory.content),
11349
11349
  ...item.memory.kind_value !== void 0 && {
11350
11350
  kind_value: await decrypt(item.memory.kind_value)
11351
11351
  }
@@ -11439,7 +11439,8 @@ async function createRemoteMemoryPersistence(options) {
11439
11439
  }
11440
11440
  if (existing && existing.version !== expectedVersion) throw conflict();
11441
11441
  const decoded = existing ? await decode(existing).catch(() => void 0) : void 0;
11442
- const content = (snapshot?.content ?? decoded?.memory.content) === memory.content ? snapshot?.encryptedContent ?? existing.memory.content : await encryptField2(memory.content);
11442
+ const reusableContent = snapshot?.encryptedContent ?? existing?.memory.content;
11443
+ const content = reusableContent && (snapshot?.content ?? decoded?.memory.content) === memory.content ? reusableContent : await encryptField2(memory.content);
11443
11444
  const kindValue = memory.kind_value === void 0 ? void 0 : (snapshot?.kindValue ?? decoded?.memory.kind_value) === memory.kind_value ? snapshot?.encryptedKindValue ?? existing.memory.kind_value : await encryptField2(memory.kind_value);
11444
11445
  return {
11445
11446
  body: {
@@ -26266,6 +26267,13 @@ var METADATA_FIELDS = [
26266
26267
  "published_at",
26267
26268
  "geohash"
26268
26269
  ];
26270
+ var TOMBSTONE_FIELDS = [
26271
+ "scope",
26272
+ "is_deleted",
26273
+ "embedding_model",
26274
+ "topics_updated_at",
26275
+ "last_observed_at"
26276
+ ];
26269
26277
  function text15(value) {
26270
26278
  return typeof value === "string" && value !== "" ? value : void 0;
26271
26279
  }
@@ -26413,7 +26421,8 @@ async function embedMissing(prepared, options, model, signal) {
26413
26421
  }
26414
26422
  function sameMetadata2(local, remote, model) {
26415
26423
  const mine = metadata2(local, model);
26416
- return METADATA_FIELDS.every((field10) => {
26424
+ const fields = bool(local.is_deleted) ? TOMBSTONE_FIELDS : METADATA_FIELDS;
26425
+ return fields.every((field10) => {
26417
26426
  const a = mine[field10] ?? null;
26418
26427
  const b = remote[field10] ?? null;
26419
26428
  if (field10 === "embedding_model" && a === null) return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "10.5.3",
3
+ "version": "10.5.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",