@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.cjs
CHANGED
|
@@ -15790,6 +15790,9 @@ async function findQuarantinedDuplicateOp(ctx, content, sourceIds2, where) {
|
|
|
15790
15790
|
return null;
|
|
15791
15791
|
}
|
|
15792
15792
|
|
|
15793
|
+
// src/lib/db/memoryVault/photoIngest.ts
|
|
15794
|
+
var import_watermelondb22 = require("@nozbe/watermelondb");
|
|
15795
|
+
|
|
15793
15796
|
// src/lib/memory/decay.ts
|
|
15794
15797
|
init_logger();
|
|
15795
15798
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -15863,6 +15866,16 @@ function classifyDecay(m, now, policy) {
|
|
|
15863
15866
|
|
|
15864
15867
|
// src/lib/db/memoryVault/photoIngest.ts
|
|
15865
15868
|
var PHOTO_MEMORY_ID_PREFIX = "photo:";
|
|
15869
|
+
var PHOTO_ID_QUERY_CHUNK_SIZE = 500;
|
|
15870
|
+
async function getExistingPhotoMemoryIds(ctx, rows) {
|
|
15871
|
+
const existing = /* @__PURE__ */ new Set();
|
|
15872
|
+
for (let i = 0; i < rows.length; i += PHOTO_ID_QUERY_CHUNK_SIZE) {
|
|
15873
|
+
const ids = rows.slice(i, i + PHOTO_ID_QUERY_CHUNK_SIZE).map((row) => row.memoryId);
|
|
15874
|
+
const found = await ctx.vaultMemoryCollection.query(import_watermelondb22.Q.where("id", import_watermelondb22.Q.oneOf(ids))).fetchIds();
|
|
15875
|
+
for (const id2 of found) existing.add(id2);
|
|
15876
|
+
}
|
|
15877
|
+
return existing;
|
|
15878
|
+
}
|
|
15866
15879
|
async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
|
|
15867
15880
|
const byId = /* @__PURE__ */ new Map();
|
|
15868
15881
|
for (const r of rows) {
|
|
@@ -15871,7 +15884,7 @@ async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
|
|
|
15871
15884
|
}
|
|
15872
15885
|
const photoRows = [...byId.values()];
|
|
15873
15886
|
if (photoRows.length === 0) return { inserted: 0, skipped: 0 };
|
|
15874
|
-
const known = await ctx
|
|
15887
|
+
const known = await getExistingPhotoMemoryIds(ctx, photoRows);
|
|
15875
15888
|
const candidates = photoRows.filter((r) => !known.has(r.memoryId));
|
|
15876
15889
|
if (candidates.length === 0) return { inserted: 0, skipped: photoRows.length };
|
|
15877
15890
|
const fresh = candidates;
|
|
@@ -15891,7 +15904,7 @@ async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
|
|
|
15891
15904
|
const now = Date.now();
|
|
15892
15905
|
let inserted = 0;
|
|
15893
15906
|
await ctx.database.write(async () => {
|
|
15894
|
-
const present =
|
|
15907
|
+
const present = await getExistingPhotoMemoryIds(ctx, fresh);
|
|
15895
15908
|
const writable = fresh.map((row, i) => ({ row, content: contents[i] })).filter(({ row }) => !present.has(row.memoryId));
|
|
15896
15909
|
inserted = writable.length;
|
|
15897
15910
|
if (writable.length === 0) return;
|
|
@@ -16265,7 +16278,7 @@ var WalletPoller = class {
|
|
|
16265
16278
|
};
|
|
16266
16279
|
|
|
16267
16280
|
// src/lib/db/vaultFolders/operations.ts
|
|
16268
|
-
var
|
|
16281
|
+
var import_watermelondb23 = require("@nozbe/watermelondb");
|
|
16269
16282
|
function folderToStored(folder) {
|
|
16270
16283
|
return {
|
|
16271
16284
|
uniqueId: folder.id,
|
|
@@ -16290,7 +16303,7 @@ async function createVaultFolderOp(ctx, opts) {
|
|
|
16290
16303
|
return folderToStored(created);
|
|
16291
16304
|
}
|
|
16292
16305
|
async function getAllVaultFoldersOp(ctx) {
|
|
16293
|
-
const results = await ctx.vaultFolderCollection.query(
|
|
16306
|
+
const results = await ctx.vaultFolderCollection.query(import_watermelondb23.Q.where("is_deleted", false), import_watermelondb23.Q.sortBy("created_at", import_watermelondb23.Q.desc)).fetch();
|
|
16294
16307
|
return results.map(folderToStored);
|
|
16295
16308
|
}
|
|
16296
16309
|
async function updateVaultFolderOp(ctx, id2, opts) {
|
|
@@ -16299,7 +16312,7 @@ async function updateVaultFolderOp(ctx, id2, opts) {
|
|
|
16299
16312
|
if (record2.isDeleted) return null;
|
|
16300
16313
|
const scopeChanged = opts.scope !== void 0 && opts.scope !== record2.scope;
|
|
16301
16314
|
const updated = await ctx.database.write(async () => {
|
|
16302
|
-
const memories = scopeChanged ? await ctx.vaultMemoryCollection.query(
|
|
16315
|
+
const memories = scopeChanged ? await ctx.vaultMemoryCollection.query(import_watermelondb23.Q.where("folder_id", id2), import_watermelondb23.Q.where("is_deleted", false)).fetch() : [];
|
|
16303
16316
|
const updates = [];
|
|
16304
16317
|
updates.push(
|
|
16305
16318
|
record2.prepareUpdate((r) => {
|
|
@@ -16328,7 +16341,7 @@ async function deleteVaultFolderOp(ctx, id2) {
|
|
|
16328
16341
|
const record2 = await ctx.vaultFolderCollection.find(id2);
|
|
16329
16342
|
if (record2.isDeleted) return false;
|
|
16330
16343
|
await ctx.database.write(async () => {
|
|
16331
|
-
const memories = await ctx.vaultMemoryCollection.query(
|
|
16344
|
+
const memories = await ctx.vaultMemoryCollection.query(import_watermelondb23.Q.where("folder_id", id2), import_watermelondb23.Q.where("is_deleted", false)).fetch();
|
|
16332
16345
|
const preparedMemories = memories.map(
|
|
16333
16346
|
(memory) => memory.prepareUpdate((r) => {
|
|
16334
16347
|
r._setRaw("folder_id", null);
|
|
@@ -16399,7 +16412,7 @@ async function updateVaultFolderContextOp(ctx, id2, context) {
|
|
|
16399
16412
|
}
|
|
16400
16413
|
}
|
|
16401
16414
|
async function getVaultFolderMemoryCountOp(ctx, folderId) {
|
|
16402
|
-
return await ctx.vaultMemoryCollection.query(
|
|
16415
|
+
return await ctx.vaultMemoryCollection.query(import_watermelondb23.Q.where("folder_id", folderId), import_watermelondb23.Q.where("is_deleted", false)).fetchCount();
|
|
16403
16416
|
}
|
|
16404
16417
|
|
|
16405
16418
|
// src/lib/db/vaultFolders/defaults.ts
|
|
@@ -16445,7 +16458,7 @@ async function _ensureDefaultFoldersImpl(ctx) {
|
|
|
16445
16458
|
init_logger();
|
|
16446
16459
|
|
|
16447
16460
|
// src/lib/memory/autoExtract.ts
|
|
16448
|
-
var
|
|
16461
|
+
var import_watermelondb24 = require("@nozbe/watermelondb");
|
|
16449
16462
|
init_logger();
|
|
16450
16463
|
init_redactor();
|
|
16451
16464
|
|
|
@@ -19258,7 +19271,7 @@ async function assertMergeTargetGoneOrThrow(ctx, targetId, expectedContent) {
|
|
|
19258
19271
|
// src/lib/memory/autoExtract.ts
|
|
19259
19272
|
async function isMemoryTopicsUserManaged(ctx, memoryId) {
|
|
19260
19273
|
try {
|
|
19261
|
-
const rows = await ctx.database.get(VaultMemory.table).query(
|
|
19274
|
+
const rows = await ctx.database.get(VaultMemory.table).query(import_watermelondb24.Q.where("id", memoryId)).fetch();
|
|
19262
19275
|
return rows[0]?.topicsUserManaged === true;
|
|
19263
19276
|
} catch {
|
|
19264
19277
|
return true;
|
|
@@ -21831,7 +21844,7 @@ function parseAnswer(body, base, parseSchema) {
|
|
|
21831
21844
|
}
|
|
21832
21845
|
|
|
21833
21846
|
// src/lib/memory/store/local.ts
|
|
21834
|
-
var
|
|
21847
|
+
var import_watermelondb25 = require("@nozbe/watermelondb");
|
|
21835
21848
|
init_logger();
|
|
21836
21849
|
|
|
21837
21850
|
// src/lib/memory/topicExtract.ts
|
|
@@ -22117,8 +22130,8 @@ function createLocalMemoryStore(options) {
|
|
|
22117
22130
|
writeOptions?.signal?.throwIfAborted();
|
|
22118
22131
|
};
|
|
22119
22132
|
const vaultCache = options.vaultCache ?? createVaultEmbeddingCache();
|
|
22120
|
-
const ownedBy = userId !== void 0 ? [
|
|
22121
|
-
const linksOwnedBy = userId === void 0 ? [] : options.allowUnscopedRows ? [
|
|
22133
|
+
const ownedBy = userId !== void 0 ? [import_watermelondb25.Q.where("user_id", userId)] : [];
|
|
22134
|
+
const linksOwnedBy = userId === void 0 ? [] : options.allowUnscopedRows ? [import_watermelondb25.Q.or(import_watermelondb25.Q.where("user_id", userId), import_watermelondb25.Q.where("user_id", null))] : [import_watermelondb25.Q.where("user_id", userId)];
|
|
22122
22135
|
const watchedColumns = [
|
|
22123
22136
|
"content",
|
|
22124
22137
|
"scope",
|
|
@@ -22164,7 +22177,7 @@ function createLocalMemoryStore(options) {
|
|
|
22164
22177
|
list: (listOptions) => getAllVaultMemoriesOp(vaultCtx, listOptions),
|
|
22165
22178
|
get: (id2) => getVaultMemoryOp(vaultCtx, id2),
|
|
22166
22179
|
listArchived: async () => {
|
|
22167
|
-
const ids = await vaultCtx.vaultMemoryCollection.query(
|
|
22180
|
+
const ids = await vaultCtx.vaultMemoryCollection.query(import_watermelondb25.Q.where("is_deleted", false), import_watermelondb25.Q.where("archived_at", import_watermelondb25.Q.notEq(null)), ...ownedBy).fetchIds();
|
|
22168
22181
|
if (ids.length === 0) return [];
|
|
22169
22182
|
const rows = await getAllVaultMemoriesOp(vaultCtx, { memoryIds: ids, includeArchived: true });
|
|
22170
22183
|
return rows.sort((a, b) => (b.archivedAt ?? 0) - (a.archivedAt ?? 0));
|
|
@@ -22180,7 +22193,7 @@ function createLocalMemoryStore(options) {
|
|
|
22180
22193
|
set.add(String(link.memory_id));
|
|
22181
22194
|
members.set(entityId, set);
|
|
22182
22195
|
}
|
|
22183
|
-
const entities = userId === void 0 ? await entityCtx.entityCollection.query().unsafeFetchRaw() : members.size ? await entityCtx.entityCollection.query(
|
|
22196
|
+
const entities = userId === void 0 ? await entityCtx.entityCollection.query().unsafeFetchRaw() : members.size ? await entityCtx.entityCollection.query(import_watermelondb25.Q.where("id", import_watermelondb25.Q.oneOf([...members.keys()]))).unsafeFetchRaw() : [];
|
|
22184
22197
|
const byName = /* @__PURE__ */ new Map();
|
|
22185
22198
|
for (const entity of entities) {
|
|
22186
22199
|
const name = String(entity.canonical_name);
|
|
@@ -22230,7 +22243,7 @@ function createLocalMemoryStore(options) {
|
|
|
22230
22243
|
setTopics: (memoryId, topics) => setMemoryEntitiesOp(vaultCtx, memoryId, topics),
|
|
22231
22244
|
addTopics: (memoryId, topics, writeOptions) => database.write(async (writer) => {
|
|
22232
22245
|
await assertWrite(writeOptions);
|
|
22233
|
-
const owned = await vaultCtx.vaultMemoryCollection.query(
|
|
22246
|
+
const owned = await vaultCtx.vaultMemoryCollection.query(import_watermelondb25.Q.where("id", memoryId), import_watermelondb25.Q.where("is_deleted", false), ...ownedBy).fetchCount();
|
|
22234
22247
|
return owned > 0 ? writer.callWriter(
|
|
22235
22248
|
() => linkMemoryEntitiesOp(
|
|
22236
22249
|
{
|
|
@@ -22302,7 +22315,7 @@ function createLocalMemoryStore(options) {
|
|
|
22302
22315
|
else onChange();
|
|
22303
22316
|
};
|
|
22304
22317
|
};
|
|
22305
|
-
const memories = subscribeOptions?.includeDeleted ? vaultCtx.vaultMemoryCollection.query(...ownedBy).observe() : vaultCtx.vaultMemoryCollection.query(
|
|
22318
|
+
const memories = subscribeOptions?.includeDeleted ? vaultCtx.vaultMemoryCollection.query(...ownedBy).observe() : vaultCtx.vaultMemoryCollection.query(import_watermelondb25.Q.where("is_deleted", false), ...ownedBy).observeWithColumns(
|
|
22306
22319
|
subscribeOptions?.embeddings ? [...watchedColumns, "embedding", "embedding_model"] : watchedColumns
|
|
22307
22320
|
);
|
|
22308
22321
|
const subscriptions = [memories.subscribe(afterFirst())];
|
|
@@ -23297,32 +23310,38 @@ function stateFilters(options) {
|
|
|
23297
23310
|
include_superseded: options.includeSuperseded
|
|
23298
23311
|
};
|
|
23299
23312
|
}
|
|
23300
|
-
function
|
|
23301
|
-
|
|
23302
|
-
|
|
23303
|
-
return
|
|
23304
|
-
|
|
23305
|
-
|
|
23306
|
-
|
|
23307
|
-
|
|
23308
|
-
|
|
23309
|
-
|
|
23310
|
-
|
|
23311
|
-
|
|
23312
|
-
|
|
23313
|
-
|
|
23314
|
-
|
|
23315
|
-
|
|
23316
|
-
|
|
23317
|
-
|
|
23318
|
-
|
|
23319
|
-
|
|
23320
|
-
|
|
23321
|
-
|
|
23322
|
-
|
|
23323
|
-
|
|
23324
|
-
|
|
23325
|
-
|
|
23313
|
+
function subscriptionState({ memory, version }) {
|
|
23314
|
+
const membership = memory.trust_tier === "quarantined" ? void 0 : String(!!memory.is_deleted);
|
|
23315
|
+
const hidden = membership === void 0 || memory.is_deleted || memory.archived_at !== void 0 && memory.archived_at !== null || !!memory.superseded_by;
|
|
23316
|
+
return {
|
|
23317
|
+
version,
|
|
23318
|
+
membership,
|
|
23319
|
+
fingerprint: hidden ? void 0 : (0, import_uuid5.v5)(
|
|
23320
|
+
JSON.stringify([
|
|
23321
|
+
memory.content,
|
|
23322
|
+
memory.scope,
|
|
23323
|
+
memory.updated_at,
|
|
23324
|
+
memory.fact_type,
|
|
23325
|
+
memory.event_time_start,
|
|
23326
|
+
memory.event_time_end,
|
|
23327
|
+
memory.event_time_kind,
|
|
23328
|
+
memory.trust_tier,
|
|
23329
|
+
memory.visibility,
|
|
23330
|
+
memory.published_at,
|
|
23331
|
+
memory.geohash,
|
|
23332
|
+
memory.topics,
|
|
23333
|
+
memory.topics_user_managed,
|
|
23334
|
+
memory.media,
|
|
23335
|
+
memory.source
|
|
23336
|
+
]),
|
|
23337
|
+
import_uuid5.v5.URL
|
|
23338
|
+
)
|
|
23339
|
+
};
|
|
23340
|
+
}
|
|
23341
|
+
function subscriptionKey(state, options) {
|
|
23342
|
+
if (options.includeDeleted) return state.membership;
|
|
23343
|
+
if (state.fingerprint === void 0) return void 0;
|
|
23344
|
+
return options.embeddings ? `${state.version}:${state.fingerprint}` : state.fingerprint;
|
|
23326
23345
|
}
|
|
23327
23346
|
function topicInputs(topics, source) {
|
|
23328
23347
|
return topics.flatMap((topic2) => {
|
|
@@ -23400,7 +23419,7 @@ function createRemoteMemoryStore(options) {
|
|
|
23400
23419
|
for (const record2 of records) {
|
|
23401
23420
|
const previous = seen.get(record2.memory.memory_id);
|
|
23402
23421
|
if ((previous?.version ?? 0) + 1 === record2.version)
|
|
23403
|
-
seen.set(record2.memory.memory_id, record2);
|
|
23422
|
+
seen.set(record2.memory.memory_id, subscriptionState(record2));
|
|
23404
23423
|
}
|
|
23405
23424
|
for (const subscriber of [...subscribers])
|
|
23406
23425
|
if (relevant(change, subscriber.options)) safely(subscriber.onChange);
|
|
@@ -23907,7 +23926,8 @@ function createRemoteMemoryStore(options) {
|
|
|
23907
23926
|
const failed = /* @__PURE__ */ new Map();
|
|
23908
23927
|
const collect = (page) => {
|
|
23909
23928
|
warnFailed(page.failed);
|
|
23910
|
-
|
|
23929
|
+
for (const record2 of page.items)
|
|
23930
|
+
records.push({ id: record2.memory.memory_id, state: subscriptionState(record2) });
|
|
23911
23931
|
for (const failure of page.failed) failed.set(failure.memory_id, failure.version);
|
|
23912
23932
|
};
|
|
23913
23933
|
let resume = cursor2;
|
|
@@ -24012,14 +24032,13 @@ function createRemoteMemoryStore(options) {
|
|
|
24012
24032
|
if (subscriber.options.topics) changed.add(subscriber);
|
|
24013
24033
|
}
|
|
24014
24034
|
if (topicState !== void 0) topicFingerprint = topicState;
|
|
24015
|
-
for (const
|
|
24016
|
-
const id2 = record2.memory.memory_id;
|
|
24035
|
+
for (const { id: id2, state } of records) {
|
|
24017
24036
|
const previous = seen.get(id2);
|
|
24018
|
-
seen.set(id2,
|
|
24037
|
+
seen.set(id2, state);
|
|
24019
24038
|
if (!ready) continue;
|
|
24020
24039
|
for (const subscriber of subscribers) {
|
|
24021
24040
|
const before = previous && subscriptionKey(previous, subscriber.options);
|
|
24022
|
-
if (before !== subscriptionKey(
|
|
24041
|
+
if (before !== subscriptionKey(state, subscriber.options)) changed.add(subscriber);
|
|
24023
24042
|
}
|
|
24024
24043
|
}
|
|
24025
24044
|
ready = true;
|
|
@@ -25206,17 +25225,17 @@ async function assembleMemoryContext(options) {
|
|
|
25206
25225
|
}
|
|
25207
25226
|
|
|
25208
25227
|
// src/lib/memory/durableExtraction.ts
|
|
25209
|
-
var
|
|
25228
|
+
var import_watermelondb26 = require("@nozbe/watermelondb");
|
|
25210
25229
|
async function messagePositions(storage, ids) {
|
|
25211
25230
|
try {
|
|
25212
25231
|
return await storage.messagesCollection.query(
|
|
25213
|
-
|
|
25232
|
+
import_watermelondb26.Q.unsafeSqlQuery(
|
|
25214
25233
|
`select "id", "conversation_id", "message_id" from "history" where "_status" is not 'deleted' and "id" in (${ids.map(() => "?").join(",")})`,
|
|
25215
25234
|
ids
|
|
25216
25235
|
)
|
|
25217
25236
|
).unsafeFetchRaw();
|
|
25218
25237
|
} catch {
|
|
25219
|
-
return await storage.messagesCollection.query(
|
|
25238
|
+
return await storage.messagesCollection.query(import_watermelondb26.Q.where("id", import_watermelondb26.Q.oneOf(ids))).unsafeFetchRaw();
|
|
25220
25239
|
}
|
|
25221
25240
|
}
|
|
25222
25241
|
var MAX_JOBS_PER_PASS = 3;
|
|
@@ -25389,7 +25408,7 @@ function createDurableAutoExtractor(options) {
|
|
|
25389
25408
|
const source = options.messageSource?.(conversationId);
|
|
25390
25409
|
if (source)
|
|
25391
25410
|
return await fromSource(source.status(conversationId)) === "ready" && (await loadFromSource(source, conversationId, ids)).every(Boolean);
|
|
25392
|
-
return await storage.conversationsCollection.query(
|
|
25411
|
+
return await storage.conversationsCollection.query(import_watermelondb26.Q.where("conversation_id", conversationId), import_watermelondb26.Q.where("is_deleted", false)).fetchCount() > 0 && await storage.messagesCollection.query(import_watermelondb26.Q.where("conversation_id", conversationId), import_watermelondb26.Q.where("id", import_watermelondb26.Q.oneOf(ids))).fetchCount() === ids.length;
|
|
25393
25412
|
}
|
|
25394
25413
|
function schedule(delay) {
|
|
25395
25414
|
if (disposed) return;
|
|
@@ -25563,7 +25582,7 @@ function createDurableAutoExtractor(options) {
|
|
|
25563
25582
|
let sourceWaiting = false;
|
|
25564
25583
|
try {
|
|
25565
25584
|
await writes;
|
|
25566
|
-
const pending = await jobs.query(
|
|
25585
|
+
const pending = await jobs.query(import_watermelondb26.Q.where("owner_key", owner), import_watermelondb26.Q.where("message_ids", import_watermelondb26.Q.notEq("[]"))).fetch();
|
|
25567
25586
|
storeFailures = 0;
|
|
25568
25587
|
let processed = 0;
|
|
25569
25588
|
for (const job of pending) {
|
|
@@ -25595,7 +25614,7 @@ function createDurableAutoExtractor(options) {
|
|
|
25595
25614
|
let ids = [];
|
|
25596
25615
|
let loaded = [];
|
|
25597
25616
|
try {
|
|
25598
|
-
const present = source ? sourceStatus === "ready" : await storage.conversationsCollection.query(
|
|
25617
|
+
const present = source ? sourceStatus === "ready" : await storage.conversationsCollection.query(import_watermelondb26.Q.where("conversation_id", conversationId), import_watermelondb26.Q.where("is_deleted", false)).fetchCount() > 0;
|
|
25599
25618
|
if (!present) {
|
|
25600
25619
|
await database.write(() => job.destroyPermanently());
|
|
25601
25620
|
continue;
|
|
@@ -25763,7 +25782,7 @@ function createDurableAutoExtractor(options) {
|
|
|
25763
25782
|
const scope = currentScope();
|
|
25764
25783
|
writes = writes.then(
|
|
25765
25784
|
() => database.write(async () => {
|
|
25766
|
-
const existing = await jobs.query(
|
|
25785
|
+
const existing = await jobs.query(import_watermelondb26.Q.where("owner_key", owner), import_watermelondb26.Q.where("conversation_id", conversationId)).fetch();
|
|
25767
25786
|
const job = existing.find(
|
|
25768
25787
|
(candidate) => candidate._getRaw("scope") === scope && (candidate._getRaw("folder_id") ?? null) === folderId
|
|
25769
25788
|
);
|
|
@@ -25776,8 +25795,8 @@ function createDurableAutoExtractor(options) {
|
|
|
25776
25795
|
if (watermarks.length) {
|
|
25777
25796
|
const misplaced = new Set(
|
|
25778
25797
|
await storage.messagesCollection.query(
|
|
25779
|
-
|
|
25780
|
-
|
|
25798
|
+
import_watermelondb26.Q.where("id", import_watermelondb26.Q.oneOf(watermarks)),
|
|
25799
|
+
import_watermelondb26.Q.where("conversation_id", import_watermelondb26.Q.notEq(conversationId))
|
|
25781
25800
|
).fetchIds()
|
|
25782
25801
|
);
|
|
25783
25802
|
for (const prior of existing)
|
|
@@ -29021,7 +29040,7 @@ async function cleanupConversationSummary(database, conversationId) {
|
|
|
29021
29040
|
}
|
|
29022
29041
|
|
|
29023
29042
|
// src/lib/db/media/operations.ts
|
|
29024
|
-
var
|
|
29043
|
+
var import_watermelondb27 = require("@nozbe/watermelondb");
|
|
29025
29044
|
|
|
29026
29045
|
// src/lib/storage/opfs.ts
|
|
29027
29046
|
function isOPFSSupported() {
|
|
@@ -29213,7 +29232,7 @@ async function createMediaBatchOp(ctx, optionsArray) {
|
|
|
29213
29232
|
})
|
|
29214
29233
|
);
|
|
29215
29234
|
});
|
|
29216
|
-
const results = await mediaCollection.query(
|
|
29235
|
+
const results = await mediaCollection.query(import_watermelondb27.Q.where("media_id", import_watermelondb27.Q.oneOf(mediaIds))).fetch();
|
|
29217
29236
|
return Promise.all(
|
|
29218
29237
|
results.map(
|
|
29219
29238
|
(m) => mediaToStored(m, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
|
|
@@ -29223,7 +29242,7 @@ async function createMediaBatchOp(ctx, optionsArray) {
|
|
|
29223
29242
|
var IMAGE_VIDEO_MIMES = VIDEO_EXTENSIONS.map((ext) => `image/${ext}`);
|
|
29224
29243
|
async function deleteMediaByConversationOp(ctx, conversationId) {
|
|
29225
29244
|
const mediaCollection = ctx.database.get("media");
|
|
29226
|
-
const results = await mediaCollection.query(
|
|
29245
|
+
const results = await mediaCollection.query(import_watermelondb27.Q.where("conversation_id", conversationId), import_watermelondb27.Q.where("is_deleted", false)).fetch();
|
|
29227
29246
|
if (results.length === 0) {
|
|
29228
29247
|
return 0;
|
|
29229
29248
|
}
|