@bitcobblers/wod-wiki-engine 0.63.2270 → 0.63.2272
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 +66 -4
- package/dist/agent.cjs.map +1 -1
- package/dist/agent.mjs +1 -1
- package/dist/{chunk-AK57GBML.mjs → chunk-EYKTDOVO.mjs} +92 -14
- package/dist/chunk-EYKTDOVO.mjs.map +1 -0
- package/dist/index.cjs +90 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
- package/dist/chunk-AK57GBML.mjs.map +0 -1
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.
|
|
945
|
-
var GIT_SHA = "
|
|
946
|
-
var BUILD_TIME = "2026-11-
|
|
944
|
+
var VERSION = "0.63.2272";
|
|
945
|
+
var GIT_SHA = "b843712";
|
|
946
|
+
var BUILD_TIME = "2026-11-27T14:16:52.436Z";
|
|
947
947
|
var SEMVER = {
|
|
948
|
-
version: "0.63.
|
|
949
|
-
gitSha: "
|
|
950
|
-
buildTime: "2026-11-
|
|
948
|
+
version: "0.63.2272",
|
|
949
|
+
gitSha: "b843712",
|
|
950
|
+
buildTime: "2026-11-27T14:16:52.436Z"
|
|
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:
|
|
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:
|
|
2067
|
-
pageNotes.push({ id: linkIds.get(id), pageId, noteId: id, createdAt:
|
|
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;
|
|
@@ -2258,12 +2260,33 @@ function buildQueryServiceStoresFromStorage(storage, options = {}) {
|
|
|
2258
2260
|
const rawEventStore = {
|
|
2259
2261
|
getEventsByTimeRange: async (start, end) => storage.readonly("events").getAllFromIndex("by-timestamp", asRange(start, end)),
|
|
2260
2262
|
getEventsByMetricDates: async (dates) => {
|
|
2263
|
+
if (dates.length === 0) return [];
|
|
2261
2264
|
const store = storage.readonly("events");
|
|
2262
2265
|
const byId = /* @__PURE__ */ new Map();
|
|
2263
|
-
|
|
2264
|
-
for (const row of await store.getAllFromIndex("by-metric-date",
|
|
2266
|
+
if (dates.length === 1) {
|
|
2267
|
+
for (const row of await store.getAllFromIndex("by-metric-date", dates[0])) {
|
|
2265
2268
|
byId.set(row.id, row);
|
|
2266
2269
|
}
|
|
2270
|
+
return Array.from(byId.values());
|
|
2271
|
+
}
|
|
2272
|
+
let minDate = dates[0];
|
|
2273
|
+
let maxDate = dates[0];
|
|
2274
|
+
const wanted = /* @__PURE__ */ new Set();
|
|
2275
|
+
for (const date of dates) {
|
|
2276
|
+
wanted.add(date);
|
|
2277
|
+
if (date < minDate) minDate = date;
|
|
2278
|
+
if (date > maxDate) maxDate = date;
|
|
2279
|
+
}
|
|
2280
|
+
const rows = await store.getAllFromIndex(
|
|
2281
|
+
"by-metric-date",
|
|
2282
|
+
asRange(minDate, maxDate)
|
|
2283
|
+
);
|
|
2284
|
+
for (const row of rows) {
|
|
2285
|
+
if (byId.has(row.id)) continue;
|
|
2286
|
+
if (Array.isArray(row.metricDateKeys) && row.metricDateKeys.length > 0) {
|
|
2287
|
+
if (!row.metricDateKeys.some((k) => wanted.has(k))) continue;
|
|
2288
|
+
}
|
|
2289
|
+
byId.set(row.id, row);
|
|
2267
2290
|
}
|
|
2268
2291
|
return Array.from(byId.values());
|
|
2269
2292
|
},
|
|
@@ -2418,6 +2441,40 @@ function buildQueryServiceStoresFromStorage(storage, options = {}) {
|
|
|
2418
2441
|
const bundles = /* @__PURE__ */ new Map();
|
|
2419
2442
|
const uniqueIds = [...new Set(noteIds)];
|
|
2420
2443
|
if (uniqueIds.length === 0) return bundles;
|
|
2444
|
+
if (storage.queryDomain) {
|
|
2445
|
+
const CHUNK_SIZE = 100;
|
|
2446
|
+
let usedDomain = true;
|
|
2447
|
+
let matchedRows = 0;
|
|
2448
|
+
for (let offset = 0; offset < uniqueIds.length; offset += CHUNK_SIZE) {
|
|
2449
|
+
const chunk = uniqueIds.slice(offset, offset + CHUNK_SIZE);
|
|
2450
|
+
const result = await storage.queryDomain({
|
|
2451
|
+
plan: "detail",
|
|
2452
|
+
selection: [{ field: "id", values: chunk }]
|
|
2453
|
+
});
|
|
2454
|
+
if (!result || result.plan !== "detail") {
|
|
2455
|
+
usedDomain = false;
|
|
2456
|
+
bundles.clear();
|
|
2457
|
+
break;
|
|
2458
|
+
}
|
|
2459
|
+
matchedRows += result.rows.length;
|
|
2460
|
+
for (const row of result.rows) {
|
|
2461
|
+
bundles.set(row.note.id, {
|
|
2462
|
+
tags: row.tags.map((t) => ({ label: t.label, ...t.type ? { type: t.type } : {} })),
|
|
2463
|
+
links: [...row.links],
|
|
2464
|
+
pages: [...row.pages]
|
|
2465
|
+
});
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
if (usedDomain && matchedRows > 0) {
|
|
2469
|
+
for (const id of uniqueIds) {
|
|
2470
|
+
if (!bundles.has(id)) {
|
|
2471
|
+
bundles.set(id, { tags: [], links: [], pages: [] });
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
return bundles;
|
|
2475
|
+
}
|
|
2476
|
+
bundles.clear();
|
|
2477
|
+
}
|
|
2421
2478
|
return storage.transaction(["page_notes", "note_tags", "tags", "page"], "readonly", async (tx) => {
|
|
2422
2479
|
const [pageLinkGroups, tagLinkGroups] = await Promise.all([
|
|
2423
2480
|
tx.readonly("page_notes").getAllFromIndexMany("by-note", uniqueIds),
|
|
@@ -5552,20 +5609,27 @@ async function deleteUserNotebook(storage, notebookIdOrSlug) {
|
|
|
5552
5609
|
);
|
|
5553
5610
|
let touchedMembers = 0;
|
|
5554
5611
|
const noteWriter = tx.readwrite("notes");
|
|
5612
|
+
const legacyColonTag = `notebook:${slug}`;
|
|
5613
|
+
const legacySlashTag = `notebook/${slug}`;
|
|
5555
5614
|
for (const note of allNotes) {
|
|
5556
5615
|
if (wodWikiCore.isNotebookLanding(note)) continue;
|
|
5557
5616
|
const hasSingle = note.notebookId === nbId;
|
|
5558
5617
|
const hasMulti = (note.notebookIds ?? []).includes(nbId);
|
|
5559
5618
|
const hasLink = linkedNoteIds.has(note.id);
|
|
5560
|
-
|
|
5619
|
+
const hasLegacyTag = (note.tags ?? []).some(
|
|
5620
|
+
(t) => t === legacyColonTag || t === legacySlashTag
|
|
5621
|
+
);
|
|
5622
|
+
if (!hasSingle && !hasMulti && !hasLink && !hasLegacyTag) continue;
|
|
5561
5623
|
const baseIds = note.notebookIds !== void 0 ? note.notebookIds : note.notebookId ? [note.notebookId] : [];
|
|
5562
5624
|
const remaining = baseIds.map((id) => wodWikiCore.toNotebookId(id)).filter((id) => id !== nbId);
|
|
5563
5625
|
const primaryUser = remaining.find(
|
|
5564
5626
|
(id) => id !== "notebook/journal" && id !== "notebook/playground"
|
|
5565
5627
|
);
|
|
5628
|
+
const nextTags = hasLegacyTag ? (note.tags ?? []).filter((t) => t !== legacyColonTag && t !== legacySlashTag) : note.tags;
|
|
5566
5629
|
const { notebookId: _droppedSingle, notebookIds: _droppedMulti, ...rest } = note;
|
|
5567
5630
|
await noteWriter.put({
|
|
5568
5631
|
...rest,
|
|
5632
|
+
...nextTags !== void 0 ? { tags: nextTags } : {},
|
|
5569
5633
|
notebookIds: remaining,
|
|
5570
5634
|
...primaryUser ? { notebookId: primaryUser } : {}
|
|
5571
5635
|
});
|
|
@@ -6821,6 +6885,20 @@ async function getJournalDayOverlay(storage, rawDate) {
|
|
|
6821
6885
|
};
|
|
6822
6886
|
}
|
|
6823
6887
|
async function migrateDatedPageNotesToSchedule(storage) {
|
|
6888
|
+
const hasDatedPageNotes = await storage.transaction(["page", "page_notes"], "readonly", async (tx) => {
|
|
6889
|
+
const [pages, pageNotes] = await Promise.all([
|
|
6890
|
+
tx.readonly("page").getAll(),
|
|
6891
|
+
tx.readonly("page_notes").getAll()
|
|
6892
|
+
]);
|
|
6893
|
+
if (pageNotes.length === 0) return false;
|
|
6894
|
+
const datedPageIds = /* @__PURE__ */ new Set();
|
|
6895
|
+
for (const p of pages) {
|
|
6896
|
+
if (p.date) datedPageIds.add(p.id);
|
|
6897
|
+
}
|
|
6898
|
+
if (datedPageIds.size === 0) return false;
|
|
6899
|
+
return pageNotes.some((pn) => datedPageIds.has(pn.pageId));
|
|
6900
|
+
});
|
|
6901
|
+
if (!hasDatedPageNotes) return 0;
|
|
6824
6902
|
return storage.transaction(["page", "page_notes", "schedule_items", "notes"], "readwrite", async (tx) => {
|
|
6825
6903
|
const [pages, pageNotes, existingSchedules, notes] = await Promise.all([
|
|
6826
6904
|
tx.readonly("page").getAll(),
|