@bitcobblers/wod-wiki-engine 0.63.2270 → 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/index.cjs CHANGED
@@ -941,13 +941,13 @@ function csvToTelemetryBundle(csv) {
941
941
  }
942
942
 
943
943
  // src/version.ts
944
- var VERSION = "0.63.2270";
945
- var GIT_SHA = "933be8b";
946
- var BUILD_TIME = "2026-11-25T23:07:35.393Z";
944
+ var VERSION = "0.63.2271";
945
+ var GIT_SHA = "b3b70b1";
946
+ var BUILD_TIME = "2026-11-27T02:37:15.802Z";
947
947
  var SEMVER = {
948
- version: "0.63.2270",
949
- gitSha: "933be8b",
950
- buildTime: "2026-11-25T23:07:35.393Z"
948
+ version: "0.63.2271",
949
+ gitSha: "b3b70b1",
950
+ buildTime: "2026-11-27T02:37:15.802Z"
951
951
  };
952
952
  var SEED_SCHEMA = 9;
953
953
  var SEED_REGISTERED_WIDGETS = wodWikiCore.KNOWN_SECTION_WIDGETS;
@@ -1957,6 +1957,8 @@ async function applyPreparedSeedChunkInTx(tx, prepared) {
1957
1957
  const seedCommit = row.commit ?? write.manifest.commit;
1958
1958
  const existingRetention = existing;
1959
1959
  const resolvedPin = pinnedNoteIds.has(id) || existingRetention?.retention === "session-pinned" ? "session-pinned" : existingRetention?.retention === "schedule-pinned" ? "schedule-pinned" : void 0;
1960
+ const parsedBuiltAt = typeof write.manifest.builtAt === "string" ? Date.parse(write.manifest.builtAt) : Number.NaN;
1961
+ const seedCreatedAt = write.manifest.version === 0 ? 0 : Number.isFinite(parsedBuiltAt) && parsedBuiltAt >= 9466848e5 ? parsedBuiltAt : Number.isFinite(write.meta.importedAt) && write.meta.importedAt >= 9466848e5 ? write.meta.importedAt : Date.now();
1960
1962
  const note = {
1961
1963
  ...existing,
1962
1964
  id,
@@ -1964,7 +1966,7 @@ async function applyPreparedSeedChunkInTx(tx, prepared) {
1964
1966
  rawContent: row.content,
1965
1967
  sourceRevision,
1966
1968
  blocks: map,
1967
- createdAt: write.manifest.version,
1969
+ createdAt: seedCreatedAt,
1968
1970
  ...date === void 0 ? {} : { date },
1969
1971
  type: write.chunkId === DASHBOARDS_CHUNK_ID ? "dashboard" : "note",
1970
1972
  sourceId,
@@ -2063,8 +2065,8 @@ async function applyPreparedSeedChunkInTx(tx, prepared) {
2063
2065
  const slug = fm["slug"];
2064
2066
  if (typeof slug === "string" && pagesBySlug.has(slug)) {
2065
2067
  const pageId = pagesBySlug.get(slug);
2066
- pages.push({ id: pageId, slug, title: titleFromPath(row.path), createdAt: write.manifest.version });
2067
- pageNotes.push({ id: linkIds.get(id), pageId, noteId: id, createdAt: write.manifest.version });
2068
+ pages.push({ id: pageId, slug, title: titleFromPath(row.path), createdAt: seedCreatedAt });
2069
+ pageNotes.push({ id: linkIds.get(id), pageId, noteId: id, createdAt: seedCreatedAt });
2068
2070
  }
2069
2071
  result.totalNotes++;
2070
2072
  result.totalBlocks += Object.keys(map).length;
@@ -2418,6 +2420,40 @@ function buildQueryServiceStoresFromStorage(storage, options = {}) {
2418
2420
  const bundles = /* @__PURE__ */ new Map();
2419
2421
  const uniqueIds = [...new Set(noteIds)];
2420
2422
  if (uniqueIds.length === 0) return bundles;
2423
+ if (storage.queryDomain) {
2424
+ const CHUNK_SIZE = 100;
2425
+ let usedDomain = true;
2426
+ let matchedRows = 0;
2427
+ for (let offset = 0; offset < uniqueIds.length; offset += CHUNK_SIZE) {
2428
+ const chunk = uniqueIds.slice(offset, offset + CHUNK_SIZE);
2429
+ const result = await storage.queryDomain({
2430
+ plan: "detail",
2431
+ selection: [{ field: "id", values: chunk }]
2432
+ });
2433
+ if (!result || result.plan !== "detail") {
2434
+ usedDomain = false;
2435
+ bundles.clear();
2436
+ break;
2437
+ }
2438
+ matchedRows += result.rows.length;
2439
+ for (const row of result.rows) {
2440
+ bundles.set(row.note.id, {
2441
+ tags: row.tags.map((t) => ({ label: t.label, ...t.type ? { type: t.type } : {} })),
2442
+ links: [...row.links],
2443
+ pages: [...row.pages]
2444
+ });
2445
+ }
2446
+ }
2447
+ if (usedDomain && matchedRows > 0) {
2448
+ for (const id of uniqueIds) {
2449
+ if (!bundles.has(id)) {
2450
+ bundles.set(id, { tags: [], links: [], pages: [] });
2451
+ }
2452
+ }
2453
+ return bundles;
2454
+ }
2455
+ bundles.clear();
2456
+ }
2421
2457
  return storage.transaction(["page_notes", "note_tags", "tags", "page"], "readonly", async (tx) => {
2422
2458
  const [pageLinkGroups, tagLinkGroups] = await Promise.all([
2423
2459
  tx.readonly("page_notes").getAllFromIndexMany("by-note", uniqueIds),
@@ -5552,20 +5588,27 @@ async function deleteUserNotebook(storage, notebookIdOrSlug) {
5552
5588
  );
5553
5589
  let touchedMembers = 0;
5554
5590
  const noteWriter = tx.readwrite("notes");
5591
+ const legacyColonTag = `notebook:${slug}`;
5592
+ const legacySlashTag = `notebook/${slug}`;
5555
5593
  for (const note of allNotes) {
5556
5594
  if (wodWikiCore.isNotebookLanding(note)) continue;
5557
5595
  const hasSingle = note.notebookId === nbId;
5558
5596
  const hasMulti = (note.notebookIds ?? []).includes(nbId);
5559
5597
  const hasLink = linkedNoteIds.has(note.id);
5560
- if (!hasSingle && !hasMulti && !hasLink) continue;
5598
+ const hasLegacyTag = (note.tags ?? []).some(
5599
+ (t) => t === legacyColonTag || t === legacySlashTag
5600
+ );
5601
+ if (!hasSingle && !hasMulti && !hasLink && !hasLegacyTag) continue;
5561
5602
  const baseIds = note.notebookIds !== void 0 ? note.notebookIds : note.notebookId ? [note.notebookId] : [];
5562
5603
  const remaining = baseIds.map((id) => wodWikiCore.toNotebookId(id)).filter((id) => id !== nbId);
5563
5604
  const primaryUser = remaining.find(
5564
5605
  (id) => id !== "notebook/journal" && id !== "notebook/playground"
5565
5606
  );
5607
+ const nextTags = hasLegacyTag ? (note.tags ?? []).filter((t) => t !== legacyColonTag && t !== legacySlashTag) : note.tags;
5566
5608
  const { notebookId: _droppedSingle, notebookIds: _droppedMulti, ...rest } = note;
5567
5609
  await noteWriter.put({
5568
5610
  ...rest,
5611
+ ...nextTags !== void 0 ? { tags: nextTags } : {},
5569
5612
  notebookIds: remaining,
5570
5613
  ...primaryUser ? { notebookId: primaryUser } : {}
5571
5614
  });