@bitcobblers/wod-wiki-engine 0.63.2269 → 0.63.2271

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/agent.cjs CHANGED
@@ -2148,6 +2148,40 @@ function buildQueryServiceStoresFromStorage(storage, options = {}) {
2148
2148
  const bundles = /* @__PURE__ */ new Map();
2149
2149
  const uniqueIds = [...new Set(noteIds)];
2150
2150
  if (uniqueIds.length === 0) return bundles;
2151
+ if (storage.queryDomain) {
2152
+ const CHUNK_SIZE = 100;
2153
+ let usedDomain = true;
2154
+ let matchedRows = 0;
2155
+ for (let offset = 0; offset < uniqueIds.length; offset += CHUNK_SIZE) {
2156
+ const chunk = uniqueIds.slice(offset, offset + CHUNK_SIZE);
2157
+ const result = await storage.queryDomain({
2158
+ plan: "detail",
2159
+ selection: [{ field: "id", values: chunk }]
2160
+ });
2161
+ if (!result || result.plan !== "detail") {
2162
+ usedDomain = false;
2163
+ bundles.clear();
2164
+ break;
2165
+ }
2166
+ matchedRows += result.rows.length;
2167
+ for (const row of result.rows) {
2168
+ bundles.set(row.note.id, {
2169
+ tags: row.tags.map((t) => ({ label: t.label, ...t.type ? { type: t.type } : {} })),
2170
+ links: [...row.links],
2171
+ pages: [...row.pages]
2172
+ });
2173
+ }
2174
+ }
2175
+ if (usedDomain && matchedRows > 0) {
2176
+ for (const id of uniqueIds) {
2177
+ if (!bundles.has(id)) {
2178
+ bundles.set(id, { tags: [], links: [], pages: [] });
2179
+ }
2180
+ }
2181
+ return bundles;
2182
+ }
2183
+ bundles.clear();
2184
+ }
2151
2185
  return storage.transaction(["page_notes", "note_tags", "tags", "page"], "readonly", async (tx) => {
2152
2186
  const [pageLinkGroups, tagLinkGroups] = await Promise.all([
2153
2187
  tx.readonly("page_notes").getAllFromIndexMany("by-note", uniqueIds),
@@ -4366,7 +4400,7 @@ async function ingestPortableFilesIntoStorage(storage, files, options = {}) {
4366
4400
  }
4367
4401
 
4368
4402
  // src/version.ts
4369
- var VERSION = "0.63.2269";
4403
+ var VERSION = "0.63.2271";
4370
4404
 
4371
4405
  // src/feed/qr.ts
4372
4406
  var APP_ORIGIN = "https://wod.wiki";
@@ -6198,20 +6232,27 @@ async function deleteUserNotebook(storage, notebookIdOrSlug) {
6198
6232
  );
6199
6233
  let touchedMembers = 0;
6200
6234
  const noteWriter = tx.readwrite("notes");
6235
+ const legacyColonTag = `notebook:${slug}`;
6236
+ const legacySlashTag = `notebook/${slug}`;
6201
6237
  for (const note of allNotes) {
6202
6238
  if (wodWikiCore.isNotebookLanding(note)) continue;
6203
6239
  const hasSingle = note.notebookId === nbId;
6204
6240
  const hasMulti = (note.notebookIds ?? []).includes(nbId);
6205
6241
  const hasLink = linkedNoteIds.has(note.id);
6206
- if (!hasSingle && !hasMulti && !hasLink) continue;
6242
+ const hasLegacyTag = (note.tags ?? []).some(
6243
+ (t) => t === legacyColonTag || t === legacySlashTag
6244
+ );
6245
+ if (!hasSingle && !hasMulti && !hasLink && !hasLegacyTag) continue;
6207
6246
  const baseIds = note.notebookIds !== void 0 ? note.notebookIds : note.notebookId ? [note.notebookId] : [];
6208
6247
  const remaining = baseIds.map((id) => wodWikiCore.toNotebookId(id)).filter((id) => id !== nbId);
6209
6248
  const primaryUser = remaining.find(
6210
6249
  (id) => id !== "notebook/journal" && id !== "notebook/playground"
6211
6250
  );
6251
+ const nextTags = hasLegacyTag ? (note.tags ?? []).filter((t) => t !== legacyColonTag && t !== legacySlashTag) : note.tags;
6212
6252
  const { notebookId: _droppedSingle, notebookIds: _droppedMulti, ...rest } = note;
6213
6253
  await noteWriter.put({
6214
6254
  ...rest,
6255
+ ...nextTags !== void 0 ? { tags: nextTags } : {},
6215
6256
  notebookIds: remaining,
6216
6257
  ...primaryUser ? { notebookId: primaryUser } : {}
6217
6258
  });