@anuma/sdk 9.1.7 → 9.1.9
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 +120 -66
- package/dist/expo/index.mjs +121 -67
- package/dist/react/index.cjs +157 -103
- package/dist/react/index.mjs +152 -98
- package/dist/server/index.cjs +107 -59
- package/dist/server/index.mjs +107 -59
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -16687,10 +16687,10 @@ async function getVaultRankingProjectionsOp(ctx, options) {
|
|
|
16687
16687
|
function baseVaultSql(ctx, options) {
|
|
16688
16688
|
const clauses = [
|
|
16689
16689
|
`"_status" is not 'deleted'`,
|
|
16690
|
-
'"is_deleted" = 0',
|
|
16690
|
+
...options?.includeDeleted ? [] : ['"is_deleted" = 0'],
|
|
16691
16691
|
...options?.includeArchived ? [] : ['"archived_at" is null'],
|
|
16692
16692
|
...options?.includeQuarantined ? [] : [`"trust_tier" is not 'quarantined'`],
|
|
16693
|
-
'"superseded_by" is null'
|
|
16693
|
+
...options?.includeSuperseded ? [] : ['"superseded_by" is null']
|
|
16694
16694
|
];
|
|
16695
16695
|
const args = [];
|
|
16696
16696
|
if (ctx.userId !== void 0) {
|
|
@@ -16699,6 +16699,38 @@ function baseVaultSql(ctx, options) {
|
|
|
16699
16699
|
}
|
|
16700
16700
|
return { sql: clauses.join(" and "), args };
|
|
16701
16701
|
}
|
|
16702
|
+
async function getVaultProfileMetadataOp(ctx, options) {
|
|
16703
|
+
const mapRaw = (raw) => ({
|
|
16704
|
+
uniqueId: raw.id,
|
|
16705
|
+
scope: raw.scope ?? "",
|
|
16706
|
+
createdAt: new Date(raw.created_at),
|
|
16707
|
+
updatedAt: new Date(raw.updated_at),
|
|
16708
|
+
lastObservedAt: raw.last_observed_at ?? null,
|
|
16709
|
+
supersededAt: raw.superseded_at ?? null,
|
|
16710
|
+
supersededBy: raw.superseded_by ?? null,
|
|
16711
|
+
isDeleted: raw.is_deleted === true || raw.is_deleted === 1,
|
|
16712
|
+
proofCount: raw.proof_count ?? null
|
|
16713
|
+
});
|
|
16714
|
+
const listOptions = { ...options, includeDeleted: true, includeSuperseded: true };
|
|
16715
|
+
let rows;
|
|
16716
|
+
try {
|
|
16717
|
+
const base = baseVaultSql(ctx, listOptions);
|
|
16718
|
+
const clauses = [base.sql, `"_status" != 'deleted'`];
|
|
16719
|
+
const args = [...base.args];
|
|
16720
|
+
if (options?.scopes?.length) {
|
|
16721
|
+
clauses.push(`"scope" in (${options.scopes.map(() => "?").join(",")})`);
|
|
16722
|
+
args.push(...options.scopes);
|
|
16723
|
+
}
|
|
16724
|
+
const sql = `select "id", "scope", "created_at", "updated_at", "last_observed_at", "superseded_at", "superseded_by", "is_deleted", "proof_count" from "memory_vault" where ${clauses.join(" and ")}`;
|
|
16725
|
+
rows = await ctx.vaultMemoryCollection.query(import_watermelondb24.Q.unsafeSqlQuery(sql, args)).unsafeFetchRaw();
|
|
16726
|
+
} catch (err) {
|
|
16727
|
+
getLogger().debug(
|
|
16728
|
+
"memoryVault: getVaultProfileMetadataOp uses the query fallback: " + (err instanceof Error ? err.message : String(err))
|
|
16729
|
+
);
|
|
16730
|
+
rows = await ctx.vaultMemoryCollection.query(...vaultListConditions(ctx, listOptions)).unsafeFetchRaw();
|
|
16731
|
+
}
|
|
16732
|
+
return rows.map(mapRaw);
|
|
16733
|
+
}
|
|
16702
16734
|
async function getVaultCandidateKeysOp(ctx, options) {
|
|
16703
16735
|
const mapRaw = (raw) => ({
|
|
16704
16736
|
uniqueId: raw.id,
|
|
@@ -17582,6 +17614,9 @@ async function findQuarantinedDuplicateOp(ctx, content, sourceIds2, where) {
|
|
|
17582
17614
|
return null;
|
|
17583
17615
|
}
|
|
17584
17616
|
|
|
17617
|
+
// src/lib/db/memoryVault/photoIngest.ts
|
|
17618
|
+
var import_watermelondb25 = require("@nozbe/watermelondb");
|
|
17619
|
+
|
|
17585
17620
|
// src/lib/memory/decay.ts
|
|
17586
17621
|
init_logger();
|
|
17587
17622
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -17655,6 +17690,16 @@ function classifyDecay(m, now, policy) {
|
|
|
17655
17690
|
|
|
17656
17691
|
// src/lib/db/memoryVault/photoIngest.ts
|
|
17657
17692
|
var PHOTO_MEMORY_ID_PREFIX = "photo:";
|
|
17693
|
+
var PHOTO_ID_QUERY_CHUNK_SIZE = 500;
|
|
17694
|
+
async function getExistingPhotoMemoryIds(ctx, rows) {
|
|
17695
|
+
const existing = /* @__PURE__ */ new Set();
|
|
17696
|
+
for (let i = 0; i < rows.length; i += PHOTO_ID_QUERY_CHUNK_SIZE) {
|
|
17697
|
+
const ids = rows.slice(i, i + PHOTO_ID_QUERY_CHUNK_SIZE).map((row) => row.memoryId);
|
|
17698
|
+
const found = await ctx.vaultMemoryCollection.query(import_watermelondb25.Q.where("id", import_watermelondb25.Q.oneOf(ids))).fetchIds();
|
|
17699
|
+
for (const id2 of found) existing.add(id2);
|
|
17700
|
+
}
|
|
17701
|
+
return existing;
|
|
17702
|
+
}
|
|
17658
17703
|
async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
|
|
17659
17704
|
const byId = /* @__PURE__ */ new Map();
|
|
17660
17705
|
for (const r of rows) {
|
|
@@ -17663,7 +17708,7 @@ async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
|
|
|
17663
17708
|
}
|
|
17664
17709
|
const photoRows = [...byId.values()];
|
|
17665
17710
|
if (photoRows.length === 0) return { inserted: 0, skipped: 0 };
|
|
17666
|
-
const known = await ctx
|
|
17711
|
+
const known = await getExistingPhotoMemoryIds(ctx, photoRows);
|
|
17667
17712
|
const candidates = photoRows.filter((r) => !known.has(r.memoryId));
|
|
17668
17713
|
if (candidates.length === 0) return { inserted: 0, skipped: photoRows.length };
|
|
17669
17714
|
const fresh = candidates;
|
|
@@ -17683,7 +17728,7 @@ async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
|
|
|
17683
17728
|
const now = Date.now();
|
|
17684
17729
|
let inserted = 0;
|
|
17685
17730
|
await ctx.database.write(async () => {
|
|
17686
|
-
const present =
|
|
17731
|
+
const present = await getExistingPhotoMemoryIds(ctx, fresh);
|
|
17687
17732
|
const writable = fresh.map((row, i) => ({ row, content: contents[i] })).filter(({ row }) => !present.has(row.memoryId));
|
|
17688
17733
|
inserted = writable.length;
|
|
17689
17734
|
if (writable.length === 0) return;
|
|
@@ -17717,7 +17762,7 @@ async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
|
|
|
17717
17762
|
}
|
|
17718
17763
|
|
|
17719
17764
|
// src/lib/db/project/operations.ts
|
|
17720
|
-
var
|
|
17765
|
+
var import_watermelondb26 = require("@nozbe/watermelondb");
|
|
17721
17766
|
|
|
17722
17767
|
// src/lib/db/project/types.ts
|
|
17723
17768
|
function generateProjectId() {
|
|
@@ -17748,15 +17793,15 @@ async function createProjectOp(ctx, opts, defaultName = "New Project") {
|
|
|
17748
17793
|
return projectToStored(created);
|
|
17749
17794
|
}
|
|
17750
17795
|
async function getProjectOp(ctx, id2) {
|
|
17751
|
-
const results = await ctx.projectsCollection.query(
|
|
17796
|
+
const results = await ctx.projectsCollection.query(import_watermelondb26.Q.where("project_id", id2), import_watermelondb26.Q.where("is_deleted", false)).fetch();
|
|
17752
17797
|
return results.length > 0 ? projectToStored(results[0]) : null;
|
|
17753
17798
|
}
|
|
17754
17799
|
async function getProjectsOp(ctx) {
|
|
17755
|
-
const results = await ctx.projectsCollection.query(
|
|
17800
|
+
const results = await ctx.projectsCollection.query(import_watermelondb26.Q.where("is_deleted", false), import_watermelondb26.Q.sortBy("created_at", import_watermelondb26.Q.desc)).fetch();
|
|
17756
17801
|
return results.map(projectToStored);
|
|
17757
17802
|
}
|
|
17758
17803
|
async function updateProjectNameOp(ctx, id2, name) {
|
|
17759
|
-
const results = await ctx.projectsCollection.query(
|
|
17804
|
+
const results = await ctx.projectsCollection.query(import_watermelondb26.Q.where("project_id", id2), import_watermelondb26.Q.where("is_deleted", false)).fetch();
|
|
17760
17805
|
if (results.length > 0) {
|
|
17761
17806
|
await ctx.database.write(async () => {
|
|
17762
17807
|
await results[0].update((proj) => {
|
|
@@ -17768,7 +17813,7 @@ async function updateProjectNameOp(ctx, id2, name) {
|
|
|
17768
17813
|
return false;
|
|
17769
17814
|
}
|
|
17770
17815
|
async function updateProjectOp(ctx, id2, opts) {
|
|
17771
|
-
const results = await ctx.projectsCollection.query(
|
|
17816
|
+
const results = await ctx.projectsCollection.query(import_watermelondb26.Q.where("project_id", id2), import_watermelondb26.Q.where("is_deleted", false)).fetch();
|
|
17772
17817
|
if (results.length > 0) {
|
|
17773
17818
|
await ctx.database.write(async () => {
|
|
17774
17819
|
await results[0].update((proj) => {
|
|
@@ -17780,7 +17825,7 @@ async function updateProjectOp(ctx, id2, opts) {
|
|
|
17780
17825
|
return false;
|
|
17781
17826
|
}
|
|
17782
17827
|
async function deleteProjectOp(ctx, id2) {
|
|
17783
|
-
const results = await ctx.projectsCollection.query(
|
|
17828
|
+
const results = await ctx.projectsCollection.query(import_watermelondb26.Q.where("project_id", id2), import_watermelondb26.Q.where("is_deleted", false)).fetch();
|
|
17784
17829
|
if (results.length > 0) {
|
|
17785
17830
|
await ctx.database.write(async () => {
|
|
17786
17831
|
await results[0].update((proj) => {
|
|
@@ -17793,14 +17838,14 @@ async function deleteProjectOp(ctx, id2) {
|
|
|
17793
17838
|
}
|
|
17794
17839
|
async function getProjectConversationsOp(ctx, projectId) {
|
|
17795
17840
|
const results = await ctx.conversationsCollection.query(
|
|
17796
|
-
|
|
17797
|
-
|
|
17798
|
-
|
|
17841
|
+
import_watermelondb26.Q.where("project_id", projectId),
|
|
17842
|
+
import_watermelondb26.Q.where("is_deleted", false),
|
|
17843
|
+
import_watermelondb26.Q.sortBy("created_at", import_watermelondb26.Q.desc)
|
|
17799
17844
|
).fetch();
|
|
17800
17845
|
return results.map(conversationToStoredRaw);
|
|
17801
17846
|
}
|
|
17802
17847
|
async function getProjectConversationCountOp(ctx, projectId) {
|
|
17803
|
-
return await ctx.conversationsCollection.query(
|
|
17848
|
+
return await ctx.conversationsCollection.query(import_watermelondb26.Q.where("project_id", projectId), import_watermelondb26.Q.where("is_deleted", false)).fetchCount();
|
|
17804
17849
|
}
|
|
17805
17850
|
|
|
17806
17851
|
// src/lib/db/queue/manager.ts
|
|
@@ -18144,7 +18189,7 @@ var WalletPoller = class {
|
|
|
18144
18189
|
};
|
|
18145
18190
|
|
|
18146
18191
|
// src/lib/db/savedTools/operations.ts
|
|
18147
|
-
var
|
|
18192
|
+
var import_watermelondb27 = require("@nozbe/watermelondb");
|
|
18148
18193
|
function savedToolToStored(tool) {
|
|
18149
18194
|
return {
|
|
18150
18195
|
uniqueId: tool.id,
|
|
@@ -18177,7 +18222,7 @@ async function createSavedToolOp(ctx, opts) {
|
|
|
18177
18222
|
return savedToolToStored(created);
|
|
18178
18223
|
}
|
|
18179
18224
|
async function getAllSavedToolsOp(ctx) {
|
|
18180
|
-
const results = await ctx.savedToolsCollection.query(
|
|
18225
|
+
const results = await ctx.savedToolsCollection.query(import_watermelondb27.Q.where("is_deleted", false), import_watermelondb27.Q.sortBy("created_at", import_watermelondb27.Q.desc)).fetch();
|
|
18181
18226
|
return results.map(savedToolToStored);
|
|
18182
18227
|
}
|
|
18183
18228
|
async function getSavedToolByIdOp(ctx, uniqueId) {
|
|
@@ -18229,7 +18274,7 @@ async function deleteSavedToolOp(ctx, uniqueId) {
|
|
|
18229
18274
|
}
|
|
18230
18275
|
|
|
18231
18276
|
// src/lib/db/settings/operations.ts
|
|
18232
|
-
var
|
|
18277
|
+
var import_watermelondb28 = require("@nozbe/watermelondb");
|
|
18233
18278
|
function modelPreferenceToStored(preference) {
|
|
18234
18279
|
return {
|
|
18235
18280
|
uniqueId: preference.id,
|
|
@@ -18238,12 +18283,12 @@ function modelPreferenceToStored(preference) {
|
|
|
18238
18283
|
};
|
|
18239
18284
|
}
|
|
18240
18285
|
async function getModelPreferenceOp(ctx, walletAddress) {
|
|
18241
|
-
const results = await ctx.modelPreferencesCollection.query(
|
|
18286
|
+
const results = await ctx.modelPreferencesCollection.query(import_watermelondb28.Q.where("wallet_address", walletAddress)).fetch();
|
|
18242
18287
|
return results.length > 0 ? modelPreferenceToStored(results[0]) : null;
|
|
18243
18288
|
}
|
|
18244
18289
|
async function setModelPreferenceOp(ctx, walletAddress, models) {
|
|
18245
18290
|
const result = await ctx.database.write(async () => {
|
|
18246
|
-
const results = await ctx.modelPreferencesCollection.query(
|
|
18291
|
+
const results = await ctx.modelPreferencesCollection.query(import_watermelondb28.Q.where("wallet_address", walletAddress)).fetch();
|
|
18247
18292
|
if (results.length > 0) {
|
|
18248
18293
|
const preference = results[0];
|
|
18249
18294
|
await preference.update((pref) => {
|
|
@@ -18261,7 +18306,7 @@ async function setModelPreferenceOp(ctx, walletAddress, models) {
|
|
|
18261
18306
|
return modelPreferenceToStored(result);
|
|
18262
18307
|
}
|
|
18263
18308
|
async function deleteModelPreferenceOp(ctx, walletAddress) {
|
|
18264
|
-
const results = await ctx.modelPreferencesCollection.query(
|
|
18309
|
+
const results = await ctx.modelPreferencesCollection.query(import_watermelondb28.Q.where("wallet_address", walletAddress)).fetch();
|
|
18265
18310
|
if (results.length === 0) return false;
|
|
18266
18311
|
await ctx.database.write(async () => {
|
|
18267
18312
|
await results[0].destroyPermanently();
|
|
@@ -18270,11 +18315,11 @@ async function deleteModelPreferenceOp(ctx, walletAddress) {
|
|
|
18270
18315
|
}
|
|
18271
18316
|
|
|
18272
18317
|
// src/lib/db/settings/schema.ts
|
|
18273
|
-
var
|
|
18274
|
-
var settingsStorageSchema = (0,
|
|
18318
|
+
var import_watermelondb29 = require("@nozbe/watermelondb");
|
|
18319
|
+
var settingsStorageSchema = (0, import_watermelondb29.appSchema)({
|
|
18275
18320
|
version: 1,
|
|
18276
18321
|
tables: [
|
|
18277
|
-
(0,
|
|
18322
|
+
(0, import_watermelondb29.tableSchema)({
|
|
18278
18323
|
name: "modelPreferences",
|
|
18279
18324
|
columns: [
|
|
18280
18325
|
{ name: "wallet_address", type: "string", isIndexed: true },
|
|
@@ -18285,7 +18330,7 @@ var settingsStorageSchema = (0, import_watermelondb28.appSchema)({
|
|
|
18285
18330
|
});
|
|
18286
18331
|
|
|
18287
18332
|
// src/lib/db/userPreferences/operations.ts
|
|
18288
|
-
var
|
|
18333
|
+
var import_watermelondb30 = require("@nozbe/watermelondb");
|
|
18289
18334
|
function userPreferenceToStored(preference) {
|
|
18290
18335
|
return {
|
|
18291
18336
|
uniqueId: preference.id,
|
|
@@ -18301,7 +18346,7 @@ function userPreferenceToStored(preference) {
|
|
|
18301
18346
|
};
|
|
18302
18347
|
}
|
|
18303
18348
|
async function getUserPreferenceOp(ctx, walletAddress) {
|
|
18304
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
18349
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb30.Q.where("wallet_address", walletAddress)).fetch();
|
|
18305
18350
|
return results.length > 0 ? userPreferenceToStored(results[0]) : null;
|
|
18306
18351
|
}
|
|
18307
18352
|
async function createUserPreferenceOp(ctx, opts) {
|
|
@@ -18322,7 +18367,7 @@ async function createUserPreferenceOp(ctx, opts) {
|
|
|
18322
18367
|
return userPreferenceToStored(created);
|
|
18323
18368
|
}
|
|
18324
18369
|
async function updateUserPreferenceOp(ctx, walletAddress, opts) {
|
|
18325
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
18370
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb30.Q.where("wallet_address", walletAddress)).fetch();
|
|
18326
18371
|
if (results.length === 0) return null;
|
|
18327
18372
|
const preference = results[0];
|
|
18328
18373
|
await ctx.database.write(async () => {
|
|
@@ -18353,7 +18398,7 @@ async function updateUserPreferenceOp(ctx, walletAddress, opts) {
|
|
|
18353
18398
|
async function setUserPreferenceOp(ctx, walletAddress, opts) {
|
|
18354
18399
|
const now = Date.now();
|
|
18355
18400
|
const result = await ctx.database.write(async () => {
|
|
18356
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
18401
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb30.Q.where("wallet_address", walletAddress)).fetch();
|
|
18357
18402
|
if (results.length > 0) {
|
|
18358
18403
|
const preference = results[0];
|
|
18359
18404
|
await preference.update((pref) => {
|
|
@@ -18405,7 +18450,7 @@ async function updateModelsOp(ctx, walletAddress, models) {
|
|
|
18405
18450
|
return updateUserPreferenceOp(ctx, walletAddress, { models });
|
|
18406
18451
|
}
|
|
18407
18452
|
async function deleteUserPreferenceOp(ctx, walletAddress) {
|
|
18408
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
18453
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb30.Q.where("wallet_address", walletAddress)).fetch();
|
|
18409
18454
|
if (results.length === 0) return false;
|
|
18410
18455
|
await ctx.database.write(async () => {
|
|
18411
18456
|
await results[0].destroyPermanently();
|
|
@@ -18420,9 +18465,9 @@ async function migrateFromModelPreferencesOp(ctx, walletAddress) {
|
|
|
18420
18465
|
if (existing) {
|
|
18421
18466
|
return existing;
|
|
18422
18467
|
}
|
|
18423
|
-
const modelResults = await ctx.modelPreferencesCollection.query(
|
|
18468
|
+
const modelResults = await ctx.modelPreferencesCollection.query(import_watermelondb30.Q.where("wallet_address", walletAddress)).fetch();
|
|
18424
18469
|
const personalityKey = `${walletAddress}_personality_settings`;
|
|
18425
|
-
const personalityResults = await ctx.modelPreferencesCollection.query(
|
|
18470
|
+
const personalityResults = await ctx.modelPreferencesCollection.query(import_watermelondb30.Q.where("wallet_address", personalityKey)).fetch();
|
|
18426
18471
|
if (modelResults.length === 0 && personalityResults.length === 0) {
|
|
18427
18472
|
return null;
|
|
18428
18473
|
}
|
|
@@ -18464,11 +18509,11 @@ async function migrateFromModelPreferencesOp(ctx, walletAddress) {
|
|
|
18464
18509
|
}
|
|
18465
18510
|
|
|
18466
18511
|
// src/lib/db/userPreferences/schema.ts
|
|
18467
|
-
var
|
|
18468
|
-
var userPreferencesStorageSchema = (0,
|
|
18512
|
+
var import_watermelondb31 = require("@nozbe/watermelondb");
|
|
18513
|
+
var userPreferencesStorageSchema = (0, import_watermelondb31.appSchema)({
|
|
18469
18514
|
version: 1,
|
|
18470
18515
|
tables: [
|
|
18471
|
-
(0,
|
|
18516
|
+
(0, import_watermelondb31.tableSchema)({
|
|
18472
18517
|
name: "userPreferences",
|
|
18473
18518
|
columns: [
|
|
18474
18519
|
{ name: "wallet_address", type: "string", isIndexed: true },
|
|
@@ -18524,7 +18569,7 @@ var SLIDER_CONFIG = [
|
|
|
18524
18569
|
];
|
|
18525
18570
|
|
|
18526
18571
|
// src/lib/db/vaultFolders/operations.ts
|
|
18527
|
-
var
|
|
18572
|
+
var import_watermelondb32 = require("@nozbe/watermelondb");
|
|
18528
18573
|
function folderToStored(folder) {
|
|
18529
18574
|
return {
|
|
18530
18575
|
uniqueId: folder.id,
|
|
@@ -18549,7 +18594,7 @@ async function createVaultFolderOp(ctx, opts) {
|
|
|
18549
18594
|
return folderToStored(created);
|
|
18550
18595
|
}
|
|
18551
18596
|
async function getAllVaultFoldersOp(ctx) {
|
|
18552
|
-
const results = await ctx.vaultFolderCollection.query(
|
|
18597
|
+
const results = await ctx.vaultFolderCollection.query(import_watermelondb32.Q.where("is_deleted", false), import_watermelondb32.Q.sortBy("created_at", import_watermelondb32.Q.desc)).fetch();
|
|
18553
18598
|
return results.map(folderToStored);
|
|
18554
18599
|
}
|
|
18555
18600
|
async function updateVaultFolderOp(ctx, id2, opts) {
|
|
@@ -18558,7 +18603,7 @@ async function updateVaultFolderOp(ctx, id2, opts) {
|
|
|
18558
18603
|
if (record2.isDeleted) return null;
|
|
18559
18604
|
const scopeChanged = opts.scope !== void 0 && opts.scope !== record2.scope;
|
|
18560
18605
|
const updated = await ctx.database.write(async () => {
|
|
18561
|
-
const memories = scopeChanged ? await ctx.vaultMemoryCollection.query(
|
|
18606
|
+
const memories = scopeChanged ? await ctx.vaultMemoryCollection.query(import_watermelondb32.Q.where("folder_id", id2), import_watermelondb32.Q.where("is_deleted", false)).fetch() : [];
|
|
18562
18607
|
const updates = [];
|
|
18563
18608
|
updates.push(
|
|
18564
18609
|
record2.prepareUpdate((r) => {
|
|
@@ -18587,7 +18632,7 @@ async function deleteVaultFolderOp(ctx, id2) {
|
|
|
18587
18632
|
const record2 = await ctx.vaultFolderCollection.find(id2);
|
|
18588
18633
|
if (record2.isDeleted) return false;
|
|
18589
18634
|
await ctx.database.write(async () => {
|
|
18590
|
-
const memories = await ctx.vaultMemoryCollection.query(
|
|
18635
|
+
const memories = await ctx.vaultMemoryCollection.query(import_watermelondb32.Q.where("folder_id", id2), import_watermelondb32.Q.where("is_deleted", false)).fetch();
|
|
18591
18636
|
const preparedMemories = memories.map(
|
|
18592
18637
|
(memory) => memory.prepareUpdate((r) => {
|
|
18593
18638
|
r._setRaw("folder_id", null);
|
|
@@ -18658,7 +18703,7 @@ async function updateVaultFolderContextOp(ctx, id2, context) {
|
|
|
18658
18703
|
}
|
|
18659
18704
|
}
|
|
18660
18705
|
async function getVaultFolderMemoryCountOp(ctx, folderId) {
|
|
18661
|
-
return await ctx.vaultMemoryCollection.query(
|
|
18706
|
+
return await ctx.vaultMemoryCollection.query(import_watermelondb32.Q.where("folder_id", folderId), import_watermelondb32.Q.where("is_deleted", false)).fetchCount();
|
|
18662
18707
|
}
|
|
18663
18708
|
|
|
18664
18709
|
// src/lib/db/vaultFolders/defaults.ts
|
|
@@ -18707,7 +18752,7 @@ init_logger();
|
|
|
18707
18752
|
init_internalFlowMarker();
|
|
18708
18753
|
|
|
18709
18754
|
// src/lib/memory/autoExtract.ts
|
|
18710
|
-
var
|
|
18755
|
+
var import_watermelondb33 = require("@nozbe/watermelondb");
|
|
18711
18756
|
init_logger();
|
|
18712
18757
|
init_redactor();
|
|
18713
18758
|
|
|
@@ -21520,7 +21565,7 @@ async function assertMergeTargetGoneOrThrow(ctx, targetId, expectedContent) {
|
|
|
21520
21565
|
// src/lib/memory/autoExtract.ts
|
|
21521
21566
|
async function isMemoryTopicsUserManaged(ctx, memoryId) {
|
|
21522
21567
|
try {
|
|
21523
|
-
const rows = await ctx.database.get(VaultMemory.table).query(
|
|
21568
|
+
const rows = await ctx.database.get(VaultMemory.table).query(import_watermelondb33.Q.where("id", memoryId)).fetch();
|
|
21524
21569
|
return rows[0]?.topicsUserManaged === true;
|
|
21525
21570
|
} catch {
|
|
21526
21571
|
return true;
|
|
@@ -24119,7 +24164,7 @@ function parseAnswer(body, base, parseSchema) {
|
|
|
24119
24164
|
}
|
|
24120
24165
|
|
|
24121
24166
|
// src/lib/memory/store/local.ts
|
|
24122
|
-
var
|
|
24167
|
+
var import_watermelondb34 = require("@nozbe/watermelondb");
|
|
24123
24168
|
init_logger();
|
|
24124
24169
|
|
|
24125
24170
|
// src/lib/memory/topicExtract.ts
|
|
@@ -24405,8 +24450,8 @@ function createLocalMemoryStore(options) {
|
|
|
24405
24450
|
writeOptions?.signal?.throwIfAborted();
|
|
24406
24451
|
};
|
|
24407
24452
|
const vaultCache = options.vaultCache ?? createVaultEmbeddingCache();
|
|
24408
|
-
const ownedBy = userId !== void 0 ? [
|
|
24409
|
-
const linksOwnedBy = userId === void 0 ? [] : options.allowUnscopedRows ? [
|
|
24453
|
+
const ownedBy = userId !== void 0 ? [import_watermelondb34.Q.where("user_id", userId)] : [];
|
|
24454
|
+
const linksOwnedBy = userId === void 0 ? [] : options.allowUnscopedRows ? [import_watermelondb34.Q.or(import_watermelondb34.Q.where("user_id", userId), import_watermelondb34.Q.where("user_id", null))] : [import_watermelondb34.Q.where("user_id", userId)];
|
|
24410
24455
|
const watchedColumns = [
|
|
24411
24456
|
"content",
|
|
24412
24457
|
"scope",
|
|
@@ -24452,7 +24497,7 @@ function createLocalMemoryStore(options) {
|
|
|
24452
24497
|
list: (listOptions) => getAllVaultMemoriesOp(vaultCtx, listOptions),
|
|
24453
24498
|
get: (id2) => getVaultMemoryOp(vaultCtx, id2),
|
|
24454
24499
|
listArchived: async () => {
|
|
24455
|
-
const ids = await vaultCtx.vaultMemoryCollection.query(
|
|
24500
|
+
const ids = await vaultCtx.vaultMemoryCollection.query(import_watermelondb34.Q.where("is_deleted", false), import_watermelondb34.Q.where("archived_at", import_watermelondb34.Q.notEq(null)), ...ownedBy).fetchIds();
|
|
24456
24501
|
if (ids.length === 0) return [];
|
|
24457
24502
|
const rows = await getAllVaultMemoriesOp(vaultCtx, { memoryIds: ids, includeArchived: true });
|
|
24458
24503
|
return rows.sort((a, b) => (b.archivedAt ?? 0) - (a.archivedAt ?? 0));
|
|
@@ -24468,7 +24513,7 @@ function createLocalMemoryStore(options) {
|
|
|
24468
24513
|
set.add(String(link.memory_id));
|
|
24469
24514
|
members.set(entityId, set);
|
|
24470
24515
|
}
|
|
24471
|
-
const entities = userId === void 0 ? await entityCtx.entityCollection.query().unsafeFetchRaw() : members.size ? await entityCtx.entityCollection.query(
|
|
24516
|
+
const entities = userId === void 0 ? await entityCtx.entityCollection.query().unsafeFetchRaw() : members.size ? await entityCtx.entityCollection.query(import_watermelondb34.Q.where("id", import_watermelondb34.Q.oneOf([...members.keys()]))).unsafeFetchRaw() : [];
|
|
24472
24517
|
const byName = /* @__PURE__ */ new Map();
|
|
24473
24518
|
for (const entity of entities) {
|
|
24474
24519
|
const name = String(entity.canonical_name);
|
|
@@ -24518,7 +24563,7 @@ function createLocalMemoryStore(options) {
|
|
|
24518
24563
|
setTopics: (memoryId, topics) => setMemoryEntitiesOp(vaultCtx, memoryId, topics),
|
|
24519
24564
|
addTopics: (memoryId, topics, writeOptions) => database.write(async (writer) => {
|
|
24520
24565
|
await assertWrite(writeOptions);
|
|
24521
|
-
const owned = await vaultCtx.vaultMemoryCollection.query(
|
|
24566
|
+
const owned = await vaultCtx.vaultMemoryCollection.query(import_watermelondb34.Q.where("id", memoryId), import_watermelondb34.Q.where("is_deleted", false), ...ownedBy).fetchCount();
|
|
24522
24567
|
return owned > 0 ? writer.callWriter(
|
|
24523
24568
|
() => linkMemoryEntitiesOp(
|
|
24524
24569
|
{
|
|
@@ -24590,7 +24635,7 @@ function createLocalMemoryStore(options) {
|
|
|
24590
24635
|
else onChange();
|
|
24591
24636
|
};
|
|
24592
24637
|
};
|
|
24593
|
-
const memories = subscribeOptions?.includeDeleted ? vaultCtx.vaultMemoryCollection.query(...ownedBy).observe() : vaultCtx.vaultMemoryCollection.query(
|
|
24638
|
+
const memories = subscribeOptions?.includeDeleted ? vaultCtx.vaultMemoryCollection.query(...ownedBy).observe() : vaultCtx.vaultMemoryCollection.query(import_watermelondb34.Q.where("is_deleted", false), ...ownedBy).observeWithColumns(
|
|
24594
24639
|
subscribeOptions?.embeddings ? [...watchedColumns, "embedding", "embedding_model"] : watchedColumns
|
|
24595
24640
|
);
|
|
24596
24641
|
const subscriptions = [memories.subscribe(afterFirst())];
|
|
@@ -25585,32 +25630,38 @@ function stateFilters(options) {
|
|
|
25585
25630
|
include_superseded: options.includeSuperseded
|
|
25586
25631
|
};
|
|
25587
25632
|
}
|
|
25588
|
-
function
|
|
25589
|
-
|
|
25590
|
-
|
|
25591
|
-
return
|
|
25592
|
-
|
|
25593
|
-
|
|
25594
|
-
|
|
25595
|
-
|
|
25596
|
-
|
|
25597
|
-
|
|
25598
|
-
|
|
25599
|
-
|
|
25600
|
-
|
|
25601
|
-
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
|
|
25605
|
-
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
|
|
25609
|
-
|
|
25610
|
-
|
|
25611
|
-
|
|
25612
|
-
|
|
25613
|
-
|
|
25633
|
+
function subscriptionState({ memory, version }) {
|
|
25634
|
+
const membership = memory.trust_tier === "quarantined" ? void 0 : String(!!memory.is_deleted);
|
|
25635
|
+
const hidden = membership === void 0 || memory.is_deleted || memory.archived_at !== void 0 && memory.archived_at !== null || !!memory.superseded_by;
|
|
25636
|
+
return {
|
|
25637
|
+
version,
|
|
25638
|
+
membership,
|
|
25639
|
+
fingerprint: hidden ? void 0 : (0, import_uuid6.v5)(
|
|
25640
|
+
JSON.stringify([
|
|
25641
|
+
memory.content,
|
|
25642
|
+
memory.scope,
|
|
25643
|
+
memory.updated_at,
|
|
25644
|
+
memory.fact_type,
|
|
25645
|
+
memory.event_time_start,
|
|
25646
|
+
memory.event_time_end,
|
|
25647
|
+
memory.event_time_kind,
|
|
25648
|
+
memory.trust_tier,
|
|
25649
|
+
memory.visibility,
|
|
25650
|
+
memory.published_at,
|
|
25651
|
+
memory.geohash,
|
|
25652
|
+
memory.topics,
|
|
25653
|
+
memory.topics_user_managed,
|
|
25654
|
+
memory.media,
|
|
25655
|
+
memory.source
|
|
25656
|
+
]),
|
|
25657
|
+
import_uuid6.v5.URL
|
|
25658
|
+
)
|
|
25659
|
+
};
|
|
25660
|
+
}
|
|
25661
|
+
function subscriptionKey(state, options) {
|
|
25662
|
+
if (options.includeDeleted) return state.membership;
|
|
25663
|
+
if (state.fingerprint === void 0) return void 0;
|
|
25664
|
+
return options.embeddings ? `${state.version}:${state.fingerprint}` : state.fingerprint;
|
|
25614
25665
|
}
|
|
25615
25666
|
function topicInputs(topics, source) {
|
|
25616
25667
|
return topics.flatMap((topic2) => {
|
|
@@ -25688,7 +25739,7 @@ function createRemoteMemoryStore(options) {
|
|
|
25688
25739
|
for (const record2 of records) {
|
|
25689
25740
|
const previous = seen.get(record2.memory.memory_id);
|
|
25690
25741
|
if ((previous?.version ?? 0) + 1 === record2.version)
|
|
25691
|
-
seen.set(record2.memory.memory_id, record2);
|
|
25742
|
+
seen.set(record2.memory.memory_id, subscriptionState(record2));
|
|
25692
25743
|
}
|
|
25693
25744
|
for (const subscriber of [...subscribers])
|
|
25694
25745
|
if (relevant(change, subscriber.options)) safely(subscriber.onChange);
|
|
@@ -26195,7 +26246,8 @@ function createRemoteMemoryStore(options) {
|
|
|
26195
26246
|
const failed = /* @__PURE__ */ new Map();
|
|
26196
26247
|
const collect = (page) => {
|
|
26197
26248
|
warnFailed(page.failed);
|
|
26198
|
-
|
|
26249
|
+
for (const record2 of page.items)
|
|
26250
|
+
records.push({ id: record2.memory.memory_id, state: subscriptionState(record2) });
|
|
26199
26251
|
for (const failure of page.failed) failed.set(failure.memory_id, failure.version);
|
|
26200
26252
|
};
|
|
26201
26253
|
let resume = cursor2;
|
|
@@ -26300,14 +26352,13 @@ function createRemoteMemoryStore(options) {
|
|
|
26300
26352
|
if (subscriber.options.topics) changed.add(subscriber);
|
|
26301
26353
|
}
|
|
26302
26354
|
if (topicState !== void 0) topicFingerprint = topicState;
|
|
26303
|
-
for (const
|
|
26304
|
-
const id2 = record2.memory.memory_id;
|
|
26355
|
+
for (const { id: id2, state } of records) {
|
|
26305
26356
|
const previous = seen.get(id2);
|
|
26306
|
-
seen.set(id2,
|
|
26357
|
+
seen.set(id2, state);
|
|
26307
26358
|
if (!ready) continue;
|
|
26308
26359
|
for (const subscriber of subscribers) {
|
|
26309
26360
|
const before = previous && subscriptionKey(previous, subscriber.options);
|
|
26310
|
-
if (before !== subscriptionKey(
|
|
26361
|
+
if (before !== subscriptionKey(state, subscriber.options)) changed.add(subscriber);
|
|
26311
26362
|
}
|
|
26312
26363
|
}
|
|
26313
26364
|
ready = true;
|
|
@@ -26911,7 +26962,7 @@ async function synthesizeProfile(ctx, options = {}) {
|
|
|
26911
26962
|
};
|
|
26912
26963
|
const previous = options.previous && options.previous.version === PROFILE_DOC_VERSION && configMatches(options.previous.config, config) ? options.previous : void 0;
|
|
26913
26964
|
const listOptions = { scopes, includeDeleted: true, includeSuperseded: true };
|
|
26914
|
-
const [memories, projections] = store ? await Promise.all([store.list(listOptions), store.listProjections(listOptions)]) : [await
|
|
26965
|
+
const [memories, projections] = store ? await Promise.all([store.list(listOptions), store.listProjections(listOptions)]) : [await getVaultProfileMetadataOp(vaultCtx, { scopes }), []];
|
|
26915
26966
|
const watermark = computeVaultWatermark(memories);
|
|
26916
26967
|
const observationTrends = summarizeObservationTrends(
|
|
26917
26968
|
memories.filter((m) => !m.isDeleted && m.supersededBy === null).map((m) => ({
|
|
@@ -26947,7 +26998,8 @@ async function synthesizeProfile(ctx, options = {}) {
|
|
|
26947
26998
|
previous,
|
|
26948
26999
|
watermark,
|
|
26949
27000
|
options.reviewedMemoryIds,
|
|
26950
|
-
previousUnreadable
|
|
27001
|
+
previousUnreadable,
|
|
27002
|
+
store ? void 0 : (ids) => getVaultEmbeddingsByIdsOp(vaultCtx, ids)
|
|
26951
27003
|
);
|
|
26952
27004
|
const memoriesById = new Map(memories.map((memory) => [memory.uniqueId, memory]));
|
|
26953
27005
|
const fallbackPriors = /* @__PURE__ */ new Map();
|
|
@@ -27034,7 +27086,7 @@ function computeVaultWatermark(memories) {
|
|
|
27034
27086
|
}
|
|
27035
27087
|
return max;
|
|
27036
27088
|
}
|
|
27037
|
-
async function computeStaleFacetKeys(ctx, memories, facets, previous, watermark, reviewedMemoryIds, previouslyUnreadable) {
|
|
27089
|
+
async function computeStaleFacetKeys(ctx, memories, facets, previous, watermark, reviewedMemoryIds, previouslyUnreadable, loadEmbeddings) {
|
|
27038
27090
|
const allKeys = new Set(facets.map((f) => f.key));
|
|
27039
27091
|
if (previous && watermark < previous.vaultWatermark) return allKeys;
|
|
27040
27092
|
if (!previous) return allKeys;
|
|
@@ -27067,7 +27119,9 @@ async function computeStaleFacetKeys(ctx, memories, facets, previous, watermark,
|
|
|
27067
27119
|
toAttribute = toAttribute.filter((m) => allowed.has(m.uniqueId));
|
|
27068
27120
|
}
|
|
27069
27121
|
if (toAttribute.length > 0) {
|
|
27070
|
-
const
|
|
27122
|
+
const candidates = loadEmbeddings ? await loadEmbeddings(toAttribute.map((m) => m.uniqueId)) : toAttribute;
|
|
27123
|
+
if (candidates.length !== toAttribute.length) return allKeys;
|
|
27124
|
+
const attributed = await attributeFacts(ctx, candidates, facets);
|
|
27071
27125
|
if (attributed === null) return allKeys;
|
|
27072
27126
|
for (const k of attributed) stale.add(k);
|
|
27073
27127
|
}
|
|
@@ -27491,17 +27545,17 @@ async function assembleMemoryContext(options) {
|
|
|
27491
27545
|
}
|
|
27492
27546
|
|
|
27493
27547
|
// src/lib/memory/durableExtraction.ts
|
|
27494
|
-
var
|
|
27548
|
+
var import_watermelondb35 = require("@nozbe/watermelondb");
|
|
27495
27549
|
async function messagePositions(storage, ids) {
|
|
27496
27550
|
try {
|
|
27497
27551
|
return await storage.messagesCollection.query(
|
|
27498
|
-
|
|
27552
|
+
import_watermelondb35.Q.unsafeSqlQuery(
|
|
27499
27553
|
`select "id", "conversation_id", "message_id" from "history" where "_status" is not 'deleted' and "id" in (${ids.map(() => "?").join(",")})`,
|
|
27500
27554
|
ids
|
|
27501
27555
|
)
|
|
27502
27556
|
).unsafeFetchRaw();
|
|
27503
27557
|
} catch {
|
|
27504
|
-
return await storage.messagesCollection.query(
|
|
27558
|
+
return await storage.messagesCollection.query(import_watermelondb35.Q.where("id", import_watermelondb35.Q.oneOf(ids))).unsafeFetchRaw();
|
|
27505
27559
|
}
|
|
27506
27560
|
}
|
|
27507
27561
|
var MAX_JOBS_PER_PASS = 3;
|
|
@@ -27674,7 +27728,7 @@ function createDurableAutoExtractor(options) {
|
|
|
27674
27728
|
const source = options.messageSource?.(conversationId);
|
|
27675
27729
|
if (source)
|
|
27676
27730
|
return await fromSource(source.status(conversationId)) === "ready" && (await loadFromSource(source, conversationId, ids)).every(Boolean);
|
|
27677
|
-
return await storage.conversationsCollection.query(
|
|
27731
|
+
return await storage.conversationsCollection.query(import_watermelondb35.Q.where("conversation_id", conversationId), import_watermelondb35.Q.where("is_deleted", false)).fetchCount() > 0 && await storage.messagesCollection.query(import_watermelondb35.Q.where("conversation_id", conversationId), import_watermelondb35.Q.where("id", import_watermelondb35.Q.oneOf(ids))).fetchCount() === ids.length;
|
|
27678
27732
|
}
|
|
27679
27733
|
function schedule(delay) {
|
|
27680
27734
|
if (disposed) return;
|
|
@@ -27848,7 +27902,7 @@ function createDurableAutoExtractor(options) {
|
|
|
27848
27902
|
let sourceWaiting = false;
|
|
27849
27903
|
try {
|
|
27850
27904
|
await writes;
|
|
27851
|
-
const pending = await jobs.query(
|
|
27905
|
+
const pending = await jobs.query(import_watermelondb35.Q.where("owner_key", owner), import_watermelondb35.Q.where("message_ids", import_watermelondb35.Q.notEq("[]"))).fetch();
|
|
27852
27906
|
storeFailures = 0;
|
|
27853
27907
|
let processed = 0;
|
|
27854
27908
|
for (const job of pending) {
|
|
@@ -27880,7 +27934,7 @@ function createDurableAutoExtractor(options) {
|
|
|
27880
27934
|
let ids = [];
|
|
27881
27935
|
let loaded = [];
|
|
27882
27936
|
try {
|
|
27883
|
-
const present = source ? sourceStatus === "ready" : await storage.conversationsCollection.query(
|
|
27937
|
+
const present = source ? sourceStatus === "ready" : await storage.conversationsCollection.query(import_watermelondb35.Q.where("conversation_id", conversationId), import_watermelondb35.Q.where("is_deleted", false)).fetchCount() > 0;
|
|
27884
27938
|
if (!present) {
|
|
27885
27939
|
await database.write(() => job.destroyPermanently());
|
|
27886
27940
|
continue;
|
|
@@ -28048,7 +28102,7 @@ function createDurableAutoExtractor(options) {
|
|
|
28048
28102
|
const scope = currentScope();
|
|
28049
28103
|
writes = writes.then(
|
|
28050
28104
|
() => database.write(async () => {
|
|
28051
|
-
const existing = await jobs.query(
|
|
28105
|
+
const existing = await jobs.query(import_watermelondb35.Q.where("owner_key", owner), import_watermelondb35.Q.where("conversation_id", conversationId)).fetch();
|
|
28052
28106
|
const job = existing.find(
|
|
28053
28107
|
(candidate) => candidate._getRaw("scope") === scope && (candidate._getRaw("folder_id") ?? null) === folderId
|
|
28054
28108
|
);
|
|
@@ -28061,8 +28115,8 @@ function createDurableAutoExtractor(options) {
|
|
|
28061
28115
|
if (watermarks.length) {
|
|
28062
28116
|
const misplaced = new Set(
|
|
28063
28117
|
await storage.messagesCollection.query(
|
|
28064
|
-
|
|
28065
|
-
|
|
28118
|
+
import_watermelondb35.Q.where("id", import_watermelondb35.Q.oneOf(watermarks)),
|
|
28119
|
+
import_watermelondb35.Q.where("conversation_id", import_watermelondb35.Q.notEq(conversationId))
|
|
28066
28120
|
).fetchIds()
|
|
28067
28121
|
);
|
|
28068
28122
|
for (const prior of existing)
|
|
@@ -32938,10 +32992,10 @@ var UNREVISIONED_COLUMNS = /* @__PURE__ */ new Set([
|
|
|
32938
32992
|
]);
|
|
32939
32993
|
async function getBackupRevision(database, conversationId) {
|
|
32940
32994
|
const serialized = await database.read(async () => {
|
|
32941
|
-
const { Q:
|
|
32995
|
+
const { Q: Q22 } = await import("@nozbe/watermelondb");
|
|
32942
32996
|
const tables = await Promise.all(
|
|
32943
32997
|
["conversations", "history"].map(
|
|
32944
|
-
(table) => database.get(table).query(
|
|
32998
|
+
(table) => database.get(table).query(Q22.where("conversation_id", conversationId), Q22.sortBy("id", Q22.asc)).unsafeFetchRaw()
|
|
32945
32999
|
)
|
|
32946
33000
|
);
|
|
32947
33001
|
return JSON.stringify(
|
|
@@ -32984,9 +33038,9 @@ async function pushConversationToICloud(database, conversationId, userAddress, d
|
|
|
32984
33038
|
}
|
|
32985
33039
|
async function performICloudExport(database, userAddress, deps, onProgress) {
|
|
32986
33040
|
await deps.requestEncryptionKey(userAddress);
|
|
32987
|
-
const { Q:
|
|
33041
|
+
const { Q: Q22 } = await import("@nozbe/watermelondb");
|
|
32988
33042
|
const conversationsCollection = database.get("conversations");
|
|
32989
|
-
const records = await conversationsCollection.query(
|
|
33043
|
+
const records = await conversationsCollection.query(Q22.where("is_deleted", false)).fetch();
|
|
32990
33044
|
const conversations = records.map(conversationToStoredRaw);
|
|
32991
33045
|
const total = conversations.length;
|
|
32992
33046
|
if (total === 0) {
|
|
@@ -36716,7 +36770,7 @@ function useExportPdf() {
|
|
|
36716
36770
|
}
|
|
36717
36771
|
|
|
36718
36772
|
// src/react/useFiles.ts
|
|
36719
|
-
var
|
|
36773
|
+
var import_watermelondb36 = require("@nozbe/watermelondb");
|
|
36720
36774
|
var import_react10 = require("react");
|
|
36721
36775
|
init_logger();
|
|
36722
36776
|
function useFiles(options) {
|
|
@@ -36735,7 +36789,7 @@ function useFiles(options) {
|
|
|
36735
36789
|
setIsLoading(true);
|
|
36736
36790
|
try {
|
|
36737
36791
|
const coll = database.get("media");
|
|
36738
|
-
await coll.query(
|
|
36792
|
+
await coll.query(import_watermelondb36.Q.take(1)).fetch();
|
|
36739
36793
|
setMediaCollection(coll);
|
|
36740
36794
|
setIsReady(true);
|
|
36741
36795
|
} catch (error) {
|
|
@@ -37957,7 +38011,7 @@ function usePhoneCalls(options = {}) {
|
|
|
37957
38011
|
}
|
|
37958
38012
|
|
|
37959
38013
|
// src/react/useProjects.ts
|
|
37960
|
-
var
|
|
38014
|
+
var import_watermelondb37 = require("@nozbe/watermelondb");
|
|
37961
38015
|
var import_react17 = require("react");
|
|
37962
38016
|
init_logger();
|
|
37963
38017
|
function useProjects(options) {
|
|
@@ -37980,7 +38034,7 @@ function useProjects(options) {
|
|
|
37980
38034
|
conversations: convColl?.table
|
|
37981
38035
|
});
|
|
37982
38036
|
getLogger().debug("[useProjects] Running test query on projects table...");
|
|
37983
|
-
const testResult = await projColl.query(
|
|
38037
|
+
const testResult = await projColl.query(import_watermelondb37.Q.take(1)).fetch();
|
|
37984
38038
|
getLogger().debug(
|
|
37985
38039
|
"[useProjects] Test query succeeded, found",
|
|
37986
38040
|
testResult.length,
|
|
@@ -38067,7 +38121,7 @@ function useProjects(options) {
|
|
|
38067
38121
|
if (!projectsCollection) {
|
|
38068
38122
|
return;
|
|
38069
38123
|
}
|
|
38070
|
-
const subscription = projectsCollection.query(
|
|
38124
|
+
const subscription = projectsCollection.query(import_watermelondb37.Q.where("is_deleted", false)).observe().subscribe((records) => {
|
|
38071
38125
|
setProjects(records.map(projectToStored));
|
|
38072
38126
|
});
|
|
38073
38127
|
return () => subscription.unsubscribe();
|
|
@@ -38189,7 +38243,7 @@ function useProjects(options) {
|
|
|
38189
38243
|
var import_react18 = require("react");
|
|
38190
38244
|
|
|
38191
38245
|
// src/react/userSettingsStore.ts
|
|
38192
|
-
var
|
|
38246
|
+
var import_watermelondb38 = require("@nozbe/watermelondb");
|
|
38193
38247
|
var EMPTY_SNAPSHOT = Object.freeze({
|
|
38194
38248
|
modelPreference: null,
|
|
38195
38249
|
userPreference: null,
|
|
@@ -38241,7 +38295,7 @@ async function startLoad(entry, walletAddress) {
|
|
|
38241
38295
|
}
|
|
38242
38296
|
function startObserve(entry, walletAddress) {
|
|
38243
38297
|
let isInitialEmission = true;
|
|
38244
|
-
entry.observeSub = entry.storageCtx.userPreferencesCollection.query(
|
|
38298
|
+
entry.observeSub = entry.storageCtx.userPreferencesCollection.query(import_watermelondb38.Q.where("wallet_address", walletAddress)).observeWithColumns([
|
|
38245
38299
|
"nickname",
|
|
38246
38300
|
"occupation",
|
|
38247
38301
|
"description",
|