@anuma/sdk 9.1.8 → 9.1.10
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/expo/index.cjs +79 -60
- package/dist/expo/index.mjs +80 -61
- package/dist/react/index.cjs +116 -97
- package/dist/react/index.mjs +111 -92
- package/dist/server/index.cjs +66 -53
- package/dist/server/index.mjs +66 -53
- package/package.json +2 -2
package/dist/expo/index.mjs
CHANGED
|
@@ -14139,6 +14139,9 @@ async function findQuarantinedDuplicateOp(ctx, content, sourceIds2, where) {
|
|
|
14139
14139
|
return null;
|
|
14140
14140
|
}
|
|
14141
14141
|
|
|
14142
|
+
// src/lib/db/memoryVault/photoIngest.ts
|
|
14143
|
+
import { Q as Q7 } from "@nozbe/watermelondb";
|
|
14144
|
+
|
|
14142
14145
|
// src/lib/memory/decay.ts
|
|
14143
14146
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
14144
14147
|
var SHORT_TTL_MS = 30 * DAY_MS;
|
|
@@ -14211,6 +14214,16 @@ function classifyDecay(m, now, policy) {
|
|
|
14211
14214
|
|
|
14212
14215
|
// src/lib/db/memoryVault/photoIngest.ts
|
|
14213
14216
|
var PHOTO_MEMORY_ID_PREFIX = "photo:";
|
|
14217
|
+
var PHOTO_ID_QUERY_CHUNK_SIZE = 500;
|
|
14218
|
+
async function getExistingPhotoMemoryIds(ctx, rows) {
|
|
14219
|
+
const existing = /* @__PURE__ */ new Set();
|
|
14220
|
+
for (let i = 0; i < rows.length; i += PHOTO_ID_QUERY_CHUNK_SIZE) {
|
|
14221
|
+
const ids = rows.slice(i, i + PHOTO_ID_QUERY_CHUNK_SIZE).map((row) => row.memoryId);
|
|
14222
|
+
const found = await ctx.vaultMemoryCollection.query(Q7.where("id", Q7.oneOf(ids))).fetchIds();
|
|
14223
|
+
for (const id2 of found) existing.add(id2);
|
|
14224
|
+
}
|
|
14225
|
+
return existing;
|
|
14226
|
+
}
|
|
14214
14227
|
async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
|
|
14215
14228
|
const byId = /* @__PURE__ */ new Map();
|
|
14216
14229
|
for (const r of rows) {
|
|
@@ -14219,7 +14232,7 @@ async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
|
|
|
14219
14232
|
}
|
|
14220
14233
|
const photoRows = [...byId.values()];
|
|
14221
14234
|
if (photoRows.length === 0) return { inserted: 0, skipped: 0 };
|
|
14222
|
-
const known = await ctx
|
|
14235
|
+
const known = await getExistingPhotoMemoryIds(ctx, photoRows);
|
|
14223
14236
|
const candidates = photoRows.filter((r) => !known.has(r.memoryId));
|
|
14224
14237
|
if (candidates.length === 0) return { inserted: 0, skipped: photoRows.length };
|
|
14225
14238
|
const fresh = candidates;
|
|
@@ -14239,7 +14252,7 @@ async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
|
|
|
14239
14252
|
const now = Date.now();
|
|
14240
14253
|
let inserted = 0;
|
|
14241
14254
|
await ctx.database.write(async () => {
|
|
14242
|
-
const present =
|
|
14255
|
+
const present = await getExistingPhotoMemoryIds(ctx, fresh);
|
|
14243
14256
|
const writable = fresh.map((row, i) => ({ row, content: contents[i] })).filter(({ row }) => !present.has(row.memoryId));
|
|
14244
14257
|
inserted = writable.length;
|
|
14245
14258
|
if (writable.length === 0) return;
|
|
@@ -14612,7 +14625,7 @@ var WalletPoller = class {
|
|
|
14612
14625
|
};
|
|
14613
14626
|
|
|
14614
14627
|
// src/lib/db/vaultFolders/operations.ts
|
|
14615
|
-
import { Q as
|
|
14628
|
+
import { Q as Q8 } from "@nozbe/watermelondb";
|
|
14616
14629
|
function folderToStored(folder) {
|
|
14617
14630
|
return {
|
|
14618
14631
|
uniqueId: folder.id,
|
|
@@ -14637,7 +14650,7 @@ async function createVaultFolderOp(ctx, opts) {
|
|
|
14637
14650
|
return folderToStored(created);
|
|
14638
14651
|
}
|
|
14639
14652
|
async function getAllVaultFoldersOp(ctx) {
|
|
14640
|
-
const results = await ctx.vaultFolderCollection.query(
|
|
14653
|
+
const results = await ctx.vaultFolderCollection.query(Q8.where("is_deleted", false), Q8.sortBy("created_at", Q8.desc)).fetch();
|
|
14641
14654
|
return results.map(folderToStored);
|
|
14642
14655
|
}
|
|
14643
14656
|
async function updateVaultFolderOp(ctx, id2, opts) {
|
|
@@ -14646,7 +14659,7 @@ async function updateVaultFolderOp(ctx, id2, opts) {
|
|
|
14646
14659
|
if (record2.isDeleted) return null;
|
|
14647
14660
|
const scopeChanged = opts.scope !== void 0 && opts.scope !== record2.scope;
|
|
14648
14661
|
const updated = await ctx.database.write(async () => {
|
|
14649
|
-
const memories = scopeChanged ? await ctx.vaultMemoryCollection.query(
|
|
14662
|
+
const memories = scopeChanged ? await ctx.vaultMemoryCollection.query(Q8.where("folder_id", id2), Q8.where("is_deleted", false)).fetch() : [];
|
|
14650
14663
|
const updates = [];
|
|
14651
14664
|
updates.push(
|
|
14652
14665
|
record2.prepareUpdate((r) => {
|
|
@@ -14675,7 +14688,7 @@ async function deleteVaultFolderOp(ctx, id2) {
|
|
|
14675
14688
|
const record2 = await ctx.vaultFolderCollection.find(id2);
|
|
14676
14689
|
if (record2.isDeleted) return false;
|
|
14677
14690
|
await ctx.database.write(async () => {
|
|
14678
|
-
const memories = await ctx.vaultMemoryCollection.query(
|
|
14691
|
+
const memories = await ctx.vaultMemoryCollection.query(Q8.where("folder_id", id2), Q8.where("is_deleted", false)).fetch();
|
|
14679
14692
|
const preparedMemories = memories.map(
|
|
14680
14693
|
(memory) => memory.prepareUpdate((r) => {
|
|
14681
14694
|
r._setRaw("folder_id", null);
|
|
@@ -14746,7 +14759,7 @@ async function updateVaultFolderContextOp(ctx, id2, context) {
|
|
|
14746
14759
|
}
|
|
14747
14760
|
}
|
|
14748
14761
|
async function getVaultFolderMemoryCountOp(ctx, folderId) {
|
|
14749
|
-
return await ctx.vaultMemoryCollection.query(
|
|
14762
|
+
return await ctx.vaultMemoryCollection.query(Q8.where("folder_id", folderId), Q8.where("is_deleted", false)).fetchCount();
|
|
14750
14763
|
}
|
|
14751
14764
|
|
|
14752
14765
|
// src/lib/db/vaultFolders/defaults.ts
|
|
@@ -14789,7 +14802,7 @@ async function _ensureDefaultFoldersImpl(ctx) {
|
|
|
14789
14802
|
}
|
|
14790
14803
|
|
|
14791
14804
|
// src/lib/memory/autoExtract.ts
|
|
14792
|
-
import { Q as
|
|
14805
|
+
import { Q as Q9 } from "@nozbe/watermelondb";
|
|
14793
14806
|
|
|
14794
14807
|
// src/lib/memory/entitySalience.ts
|
|
14795
14808
|
var GENERIC_ENTITY_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -17583,7 +17596,7 @@ async function assertMergeTargetGoneOrThrow(ctx, targetId, expectedContent) {
|
|
|
17583
17596
|
// src/lib/memory/autoExtract.ts
|
|
17584
17597
|
async function isMemoryTopicsUserManaged(ctx, memoryId) {
|
|
17585
17598
|
try {
|
|
17586
|
-
const rows = await ctx.database.get(VaultMemory.table).query(
|
|
17599
|
+
const rows = await ctx.database.get(VaultMemory.table).query(Q9.where("id", memoryId)).fetch();
|
|
17587
17600
|
return rows[0]?.topicsUserManaged === true;
|
|
17588
17601
|
} catch {
|
|
17589
17602
|
return true;
|
|
@@ -20139,7 +20152,7 @@ function parseAnswer(body, base, parseSchema) {
|
|
|
20139
20152
|
}
|
|
20140
20153
|
|
|
20141
20154
|
// src/lib/memory/store/local.ts
|
|
20142
|
-
import { Q as
|
|
20155
|
+
import { Q as Q10 } from "@nozbe/watermelondb";
|
|
20143
20156
|
|
|
20144
20157
|
// src/lib/memory/topicExtract.ts
|
|
20145
20158
|
var TOPIC_EXTRACTION_BATCH_SIZE = 10;
|
|
@@ -20421,8 +20434,8 @@ function createLocalMemoryStore(options) {
|
|
|
20421
20434
|
writeOptions?.signal?.throwIfAborted();
|
|
20422
20435
|
};
|
|
20423
20436
|
const vaultCache = options.vaultCache ?? createVaultEmbeddingCache();
|
|
20424
|
-
const ownedBy = userId !== void 0 ? [
|
|
20425
|
-
const linksOwnedBy = userId === void 0 ? [] : options.allowUnscopedRows ? [
|
|
20437
|
+
const ownedBy = userId !== void 0 ? [Q10.where("user_id", userId)] : [];
|
|
20438
|
+
const linksOwnedBy = userId === void 0 ? [] : options.allowUnscopedRows ? [Q10.or(Q10.where("user_id", userId), Q10.where("user_id", null))] : [Q10.where("user_id", userId)];
|
|
20426
20439
|
const watchedColumns = [
|
|
20427
20440
|
"content",
|
|
20428
20441
|
"scope",
|
|
@@ -20468,7 +20481,7 @@ function createLocalMemoryStore(options) {
|
|
|
20468
20481
|
list: (listOptions) => getAllVaultMemoriesOp(vaultCtx, listOptions),
|
|
20469
20482
|
get: (id2) => getVaultMemoryOp(vaultCtx, id2),
|
|
20470
20483
|
listArchived: async () => {
|
|
20471
|
-
const ids = await vaultCtx.vaultMemoryCollection.query(
|
|
20484
|
+
const ids = await vaultCtx.vaultMemoryCollection.query(Q10.where("is_deleted", false), Q10.where("archived_at", Q10.notEq(null)), ...ownedBy).fetchIds();
|
|
20472
20485
|
if (ids.length === 0) return [];
|
|
20473
20486
|
const rows = await getAllVaultMemoriesOp(vaultCtx, { memoryIds: ids, includeArchived: true });
|
|
20474
20487
|
return rows.sort((a, b) => (b.archivedAt ?? 0) - (a.archivedAt ?? 0));
|
|
@@ -20484,7 +20497,7 @@ function createLocalMemoryStore(options) {
|
|
|
20484
20497
|
set.add(String(link.memory_id));
|
|
20485
20498
|
members.set(entityId, set);
|
|
20486
20499
|
}
|
|
20487
|
-
const entities = userId === void 0 ? await entityCtx.entityCollection.query().unsafeFetchRaw() : members.size ? await entityCtx.entityCollection.query(
|
|
20500
|
+
const entities = userId === void 0 ? await entityCtx.entityCollection.query().unsafeFetchRaw() : members.size ? await entityCtx.entityCollection.query(Q10.where("id", Q10.oneOf([...members.keys()]))).unsafeFetchRaw() : [];
|
|
20488
20501
|
const byName = /* @__PURE__ */ new Map();
|
|
20489
20502
|
for (const entity of entities) {
|
|
20490
20503
|
const name = String(entity.canonical_name);
|
|
@@ -20534,7 +20547,7 @@ function createLocalMemoryStore(options) {
|
|
|
20534
20547
|
setTopics: (memoryId, topics) => setMemoryEntitiesOp(vaultCtx, memoryId, topics),
|
|
20535
20548
|
addTopics: (memoryId, topics, writeOptions) => database.write(async (writer) => {
|
|
20536
20549
|
await assertWrite(writeOptions);
|
|
20537
|
-
const owned = await vaultCtx.vaultMemoryCollection.query(
|
|
20550
|
+
const owned = await vaultCtx.vaultMemoryCollection.query(Q10.where("id", memoryId), Q10.where("is_deleted", false), ...ownedBy).fetchCount();
|
|
20538
20551
|
return owned > 0 ? writer.callWriter(
|
|
20539
20552
|
() => linkMemoryEntitiesOp(
|
|
20540
20553
|
{
|
|
@@ -20606,7 +20619,7 @@ function createLocalMemoryStore(options) {
|
|
|
20606
20619
|
else onChange();
|
|
20607
20620
|
};
|
|
20608
20621
|
};
|
|
20609
|
-
const memories = subscribeOptions?.includeDeleted ? vaultCtx.vaultMemoryCollection.query(...ownedBy).observe() : vaultCtx.vaultMemoryCollection.query(
|
|
20622
|
+
const memories = subscribeOptions?.includeDeleted ? vaultCtx.vaultMemoryCollection.query(...ownedBy).observe() : vaultCtx.vaultMemoryCollection.query(Q10.where("is_deleted", false), ...ownedBy).observeWithColumns(
|
|
20610
20623
|
subscribeOptions?.embeddings ? [...watchedColumns, "embedding", "embedding_model"] : watchedColumns
|
|
20611
20624
|
);
|
|
20612
20625
|
const subscriptions = [memories.subscribe(afterFirst())];
|
|
@@ -21521,7 +21534,7 @@ async function migrateMemoriesToRemote(options) {
|
|
|
21521
21534
|
}
|
|
21522
21535
|
|
|
21523
21536
|
// src/lib/memory/store/remoteStore.ts
|
|
21524
|
-
import { v7 as uuidv75 } from "uuid";
|
|
21537
|
+
import { v5 as uuidv5, v7 as uuidv75 } from "uuid";
|
|
21525
21538
|
function projection({ memory }) {
|
|
21526
21539
|
return {
|
|
21527
21540
|
uniqueId: memory.memory_id,
|
|
@@ -21596,32 +21609,38 @@ function stateFilters(options) {
|
|
|
21596
21609
|
include_superseded: options.includeSuperseded
|
|
21597
21610
|
};
|
|
21598
21611
|
}
|
|
21599
|
-
function
|
|
21600
|
-
|
|
21601
|
-
|
|
21602
|
-
return
|
|
21603
|
-
|
|
21604
|
-
|
|
21605
|
-
|
|
21606
|
-
|
|
21607
|
-
|
|
21608
|
-
|
|
21609
|
-
|
|
21610
|
-
|
|
21611
|
-
|
|
21612
|
-
|
|
21613
|
-
|
|
21614
|
-
|
|
21615
|
-
|
|
21616
|
-
|
|
21617
|
-
|
|
21618
|
-
|
|
21619
|
-
|
|
21620
|
-
|
|
21621
|
-
|
|
21622
|
-
|
|
21623
|
-
|
|
21624
|
-
|
|
21612
|
+
function subscriptionState({ memory, version }) {
|
|
21613
|
+
const membership = memory.trust_tier === "quarantined" ? void 0 : String(!!memory.is_deleted);
|
|
21614
|
+
const hidden = membership === void 0 || memory.is_deleted || memory.archived_at !== void 0 && memory.archived_at !== null || !!memory.superseded_by;
|
|
21615
|
+
return {
|
|
21616
|
+
version,
|
|
21617
|
+
membership,
|
|
21618
|
+
fingerprint: hidden ? void 0 : uuidv5(
|
|
21619
|
+
JSON.stringify([
|
|
21620
|
+
memory.content,
|
|
21621
|
+
memory.scope,
|
|
21622
|
+
memory.updated_at,
|
|
21623
|
+
memory.fact_type,
|
|
21624
|
+
memory.event_time_start,
|
|
21625
|
+
memory.event_time_end,
|
|
21626
|
+
memory.event_time_kind,
|
|
21627
|
+
memory.trust_tier,
|
|
21628
|
+
memory.visibility,
|
|
21629
|
+
memory.published_at,
|
|
21630
|
+
memory.geohash,
|
|
21631
|
+
memory.topics,
|
|
21632
|
+
memory.topics_user_managed,
|
|
21633
|
+
memory.media,
|
|
21634
|
+
memory.source
|
|
21635
|
+
]),
|
|
21636
|
+
uuidv5.URL
|
|
21637
|
+
)
|
|
21638
|
+
};
|
|
21639
|
+
}
|
|
21640
|
+
function subscriptionKey(state, options) {
|
|
21641
|
+
if (options.includeDeleted) return state.membership;
|
|
21642
|
+
if (state.fingerprint === void 0) return void 0;
|
|
21643
|
+
return options.embeddings ? `${state.version}:${state.fingerprint}` : state.fingerprint;
|
|
21625
21644
|
}
|
|
21626
21645
|
function topicInputs(topics, source) {
|
|
21627
21646
|
return topics.flatMap((topic2) => {
|
|
@@ -21699,7 +21718,7 @@ function createRemoteMemoryStore(options) {
|
|
|
21699
21718
|
for (const record2 of records) {
|
|
21700
21719
|
const previous = seen.get(record2.memory.memory_id);
|
|
21701
21720
|
if ((previous?.version ?? 0) + 1 === record2.version)
|
|
21702
|
-
seen.set(record2.memory.memory_id, record2);
|
|
21721
|
+
seen.set(record2.memory.memory_id, subscriptionState(record2));
|
|
21703
21722
|
}
|
|
21704
21723
|
for (const subscriber of [...subscribers])
|
|
21705
21724
|
if (relevant(change, subscriber.options)) safely(subscriber.onChange);
|
|
@@ -22206,7 +22225,8 @@ function createRemoteMemoryStore(options) {
|
|
|
22206
22225
|
const failed = /* @__PURE__ */ new Map();
|
|
22207
22226
|
const collect = (page) => {
|
|
22208
22227
|
warnFailed(page.failed);
|
|
22209
|
-
|
|
22228
|
+
for (const record2 of page.items)
|
|
22229
|
+
records.push({ id: record2.memory.memory_id, state: subscriptionState(record2) });
|
|
22210
22230
|
for (const failure of page.failed) failed.set(failure.memory_id, failure.version);
|
|
22211
22231
|
};
|
|
22212
22232
|
let resume = cursor2;
|
|
@@ -22311,14 +22331,13 @@ function createRemoteMemoryStore(options) {
|
|
|
22311
22331
|
if (subscriber.options.topics) changed.add(subscriber);
|
|
22312
22332
|
}
|
|
22313
22333
|
if (topicState !== void 0) topicFingerprint = topicState;
|
|
22314
|
-
for (const
|
|
22315
|
-
const id2 = record2.memory.memory_id;
|
|
22334
|
+
for (const { id: id2, state } of records) {
|
|
22316
22335
|
const previous = seen.get(id2);
|
|
22317
|
-
seen.set(id2,
|
|
22336
|
+
seen.set(id2, state);
|
|
22318
22337
|
if (!ready) continue;
|
|
22319
22338
|
for (const subscriber of subscribers) {
|
|
22320
22339
|
const before = previous && subscriptionKey(previous, subscriber.options);
|
|
22321
|
-
if (before !== subscriptionKey(
|
|
22340
|
+
if (before !== subscriptionKey(state, subscriber.options)) changed.add(subscriber);
|
|
22322
22341
|
}
|
|
22323
22342
|
}
|
|
22324
22343
|
ready = true;
|
|
@@ -23503,17 +23522,17 @@ async function assembleMemoryContext(options) {
|
|
|
23503
23522
|
}
|
|
23504
23523
|
|
|
23505
23524
|
// src/lib/memory/durableExtraction.ts
|
|
23506
|
-
import { Q as
|
|
23525
|
+
import { Q as Q11 } from "@nozbe/watermelondb";
|
|
23507
23526
|
async function messagePositions(storage, ids) {
|
|
23508
23527
|
try {
|
|
23509
23528
|
return await storage.messagesCollection.query(
|
|
23510
|
-
|
|
23529
|
+
Q11.unsafeSqlQuery(
|
|
23511
23530
|
`select "id", "conversation_id", "message_id" from "history" where "_status" is not 'deleted' and "id" in (${ids.map(() => "?").join(",")})`,
|
|
23512
23531
|
ids
|
|
23513
23532
|
)
|
|
23514
23533
|
).unsafeFetchRaw();
|
|
23515
23534
|
} catch {
|
|
23516
|
-
return await storage.messagesCollection.query(
|
|
23535
|
+
return await storage.messagesCollection.query(Q11.where("id", Q11.oneOf(ids))).unsafeFetchRaw();
|
|
23517
23536
|
}
|
|
23518
23537
|
}
|
|
23519
23538
|
var MAX_JOBS_PER_PASS = 3;
|
|
@@ -23686,7 +23705,7 @@ function createDurableAutoExtractor(options) {
|
|
|
23686
23705
|
const source = options.messageSource?.(conversationId);
|
|
23687
23706
|
if (source)
|
|
23688
23707
|
return await fromSource(source.status(conversationId)) === "ready" && (await loadFromSource(source, conversationId, ids)).every(Boolean);
|
|
23689
|
-
return await storage.conversationsCollection.query(
|
|
23708
|
+
return await storage.conversationsCollection.query(Q11.where("conversation_id", conversationId), Q11.where("is_deleted", false)).fetchCount() > 0 && await storage.messagesCollection.query(Q11.where("conversation_id", conversationId), Q11.where("id", Q11.oneOf(ids))).fetchCount() === ids.length;
|
|
23690
23709
|
}
|
|
23691
23710
|
function schedule(delay) {
|
|
23692
23711
|
if (disposed) return;
|
|
@@ -23860,7 +23879,7 @@ function createDurableAutoExtractor(options) {
|
|
|
23860
23879
|
let sourceWaiting = false;
|
|
23861
23880
|
try {
|
|
23862
23881
|
await writes;
|
|
23863
|
-
const pending = await jobs.query(
|
|
23882
|
+
const pending = await jobs.query(Q11.where("owner_key", owner), Q11.where("message_ids", Q11.notEq("[]"))).fetch();
|
|
23864
23883
|
storeFailures = 0;
|
|
23865
23884
|
let processed = 0;
|
|
23866
23885
|
for (const job of pending) {
|
|
@@ -23892,7 +23911,7 @@ function createDurableAutoExtractor(options) {
|
|
|
23892
23911
|
let ids = [];
|
|
23893
23912
|
let loaded = [];
|
|
23894
23913
|
try {
|
|
23895
|
-
const present = source ? sourceStatus === "ready" : await storage.conversationsCollection.query(
|
|
23914
|
+
const present = source ? sourceStatus === "ready" : await storage.conversationsCollection.query(Q11.where("conversation_id", conversationId), Q11.where("is_deleted", false)).fetchCount() > 0;
|
|
23896
23915
|
if (!present) {
|
|
23897
23916
|
await database.write(() => job.destroyPermanently());
|
|
23898
23917
|
continue;
|
|
@@ -24060,7 +24079,7 @@ function createDurableAutoExtractor(options) {
|
|
|
24060
24079
|
const scope = currentScope();
|
|
24061
24080
|
writes = writes.then(
|
|
24062
24081
|
() => database.write(async () => {
|
|
24063
|
-
const existing = await jobs.query(
|
|
24082
|
+
const existing = await jobs.query(Q11.where("owner_key", owner), Q11.where("conversation_id", conversationId)).fetch();
|
|
24064
24083
|
const job = existing.find(
|
|
24065
24084
|
(candidate) => candidate._getRaw("scope") === scope && (candidate._getRaw("folder_id") ?? null) === folderId
|
|
24066
24085
|
);
|
|
@@ -24073,8 +24092,8 @@ function createDurableAutoExtractor(options) {
|
|
|
24073
24092
|
if (watermarks.length) {
|
|
24074
24093
|
const misplaced = new Set(
|
|
24075
24094
|
await storage.messagesCollection.query(
|
|
24076
|
-
|
|
24077
|
-
|
|
24095
|
+
Q11.where("id", Q11.oneOf(watermarks)),
|
|
24096
|
+
Q11.where("conversation_id", Q11.notEq(conversationId))
|
|
24078
24097
|
).fetchIds()
|
|
24079
24098
|
);
|
|
24080
24099
|
for (const prior of existing)
|
|
@@ -27300,7 +27319,7 @@ async function cleanupConversationSummary(database, conversationId) {
|
|
|
27300
27319
|
}
|
|
27301
27320
|
|
|
27302
27321
|
// src/lib/db/media/operations.ts
|
|
27303
|
-
import { Q as
|
|
27322
|
+
import { Q as Q12 } from "@nozbe/watermelondb";
|
|
27304
27323
|
|
|
27305
27324
|
// src/lib/storage/opfs.ts
|
|
27306
27325
|
function isOPFSSupported() {
|
|
@@ -27491,7 +27510,7 @@ async function createMediaBatchOp(ctx, optionsArray) {
|
|
|
27491
27510
|
})
|
|
27492
27511
|
);
|
|
27493
27512
|
});
|
|
27494
|
-
const results = await mediaCollection.query(
|
|
27513
|
+
const results = await mediaCollection.query(Q12.where("media_id", Q12.oneOf(mediaIds))).fetch();
|
|
27495
27514
|
return Promise.all(
|
|
27496
27515
|
results.map(
|
|
27497
27516
|
(m) => mediaToStored(m, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
|
|
@@ -27501,7 +27520,7 @@ async function createMediaBatchOp(ctx, optionsArray) {
|
|
|
27501
27520
|
var IMAGE_VIDEO_MIMES = VIDEO_EXTENSIONS.map((ext) => `image/${ext}`);
|
|
27502
27521
|
async function deleteMediaByConversationOp(ctx, conversationId) {
|
|
27503
27522
|
const mediaCollection = ctx.database.get("media");
|
|
27504
|
-
const results = await mediaCollection.query(
|
|
27523
|
+
const results = await mediaCollection.query(Q12.where("conversation_id", conversationId), Q12.where("is_deleted", false)).fetch();
|
|
27505
27524
|
if (results.length === 0) {
|
|
27506
27525
|
return 0;
|
|
27507
27526
|
}
|