@bitcobblers/wod-wiki-engine 0.59.2238 → 0.59.2243

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.
@@ -1,6 +1,6 @@
1
1
  import { KNOWN_SECTION_WIDGETS, MetricType, reconcileNoteBlocks, validateNoteBlocks, parseDocumentSections, blockContentId, toNotebookId as toNotebookId$1, isSystemReadOnlyNotebook, notebookSlugFromId as notebookSlugFromId$1, patchFrontmatterProperty, createTagIndex, isNonPublishableNotebook, serializeNoteBundleToJsonl, derivePublicationVisibility, isPublishableNotebookLanding, parseNoteBundleFromJsonl, isNoteEditable, mapNoteBlockChanges } from '@bitcobblers/wod-wiki-core';
2
- import { getHints, documentToEffort, documentToEquipment, documentToTag, createReferenceIndex, parseEffortFile, parseEquipmentFile, parseScript, extractStatementRefs } from '@bitcobblers/wod-wiki-lang';
3
- import { WQL_TYPED_TAG_KEYS, notebookSlugFromId, toNotebookId, migrateLegacyChunkId, hasLegacyIdentity, migrateLegacyRow, notebooksOfItem, notebookOfItem, notebookOriginOfItem, notebookSlugOfSourceId } from '@bitcobblers/wod-wiki-wql';
2
+ import { getHints, documentToEffort, documentToEquipment, documentToTag, createReferenceIndex, parseEffortFile, parseEquipmentFile, bundledEfforts, parseScript, extractStatementRefs } from '@bitcobblers/wod-wiki-lang';
3
+ import { WQL_TYPED_TAG_KEYS, notebookSlugFromId, toNotebookId, migrateLegacyChunkId, hasLegacyIdentity, migrateLegacyRow, notebooksOfItem, notebookOfItem, notebookOriginOfItem, coalescingEventStore, notebookSlugOfSourceId } from '@bitcobblers/wod-wiki-wql';
4
4
  import { userDeletedSeedNoteId } from '@bitcobblers/wod-wiki-storage';
5
5
 
6
6
  // src/ir.ts
@@ -858,13 +858,13 @@ function csvToTelemetryBundle(csv) {
858
858
  }
859
859
 
860
860
  // src/version.ts
861
- var VERSION = "0.59.2238";
862
- var GIT_SHA = "9029981";
863
- var BUILD_TIME = "2026-11-16T16:02:29.109Z";
861
+ var VERSION = "0.59.2243";
862
+ var GIT_SHA = "4a45031";
863
+ var BUILD_TIME = "2026-11-17T18:40:05.124Z";
864
864
  var SEMVER = {
865
- version: "0.59.2238",
866
- gitSha: "9029981",
867
- buildTime: "2026-11-16T16:02:29.109Z"
865
+ version: "0.59.2243",
866
+ gitSha: "4a45031",
867
+ buildTime: "2026-11-17T18:40:05.124Z"
868
868
  };
869
869
  var SEED_SCHEMA = 9;
870
870
  var SEED_REGISTERED_WIDGETS = KNOWN_SECTION_WIDGETS;
@@ -4743,7 +4743,198 @@ function buildNoteProvenance(sourceNote, sourceNotebookId, clonedAt) {
4743
4743
  clonedAt
4744
4744
  };
4745
4745
  }
4746
+ function buildQueryServiceStoresFromStorage(storage, options = {}) {
4747
+ const asRange = (lower, upper) => typeof IDBKeyRange !== "undefined" ? IDBKeyRange.bound(lower, upper) : { lower, upper };
4748
+ const resultRows = (key) => asRange([key, ""], [`${key}\uFFFF`, "\uFFFF"]);
4749
+ const rawEventStore = {
4750
+ getEventsByTimeRange: async (start, end) => storage.readonly("events").getAllFromIndex("by-timestamp", asRange(start, end)),
4751
+ getEventsByMetricDates: async (dates) => {
4752
+ const store = storage.readonly("events");
4753
+ const byId = /* @__PURE__ */ new Map();
4754
+ for (const date of dates) {
4755
+ for (const row of await store.getAllFromIndex("by-metric-date", date)) {
4756
+ byId.set(row.id, row);
4757
+ }
4758
+ }
4759
+ return Array.from(byId.values());
4760
+ },
4761
+ getEventsByResult: async (resultId) => storage.readonly("events").getAllFromIndex("by-result-grain", resultRows(resultId)),
4762
+ getEventsForNote: async (noteId) => (await storage.readonly("events").getAll()).filter((row) => row.noteId === noteId),
4763
+ getEventsByContent: async (cid) => storage.readonly("events").getAllFromIndex("by-content-grain", resultRows(cid)),
4764
+ scanAll: () => storage.readonly("events").getAll(),
4765
+ appendEvents: async (rows) => {
4766
+ if (rows.length > 0) await storage.readwrite("events").putMany(rows);
4767
+ },
4768
+ finalizeSummaries: async (resultId, rows) => {
4769
+ await storage.transaction(["events"], "readwrite", async (tx) => {
4770
+ const allForResult = (await tx.readonly("events").getAll()).filter(
4771
+ (r) => r.resultId === resultId && r.grain === "summary" && r.origin !== "user"
4772
+ );
4773
+ for (const r of allForResult) await tx.readwrite("events").delete(r.id);
4774
+ if (rows.length > 0) await tx.readwrite("events").putMany(rows);
4775
+ });
4776
+ },
4777
+ deleteEvents: async (ids) => {
4778
+ for (const id of ids) await storage.readwrite("events").delete(id);
4779
+ }
4780
+ };
4781
+ const eventStore = options.coalesce !== false ? coalescingEventStore(rawEventStore) : rawEventStore;
4782
+ const noteStore = {
4783
+ getAllNotes: () => storage.readonly("notes").getAll(),
4784
+ getNotesByIds: async (ids) => {
4785
+ const rows = await storage.readonly("notes").getMany([...ids]);
4786
+ return rows.filter((row) => row !== void 0);
4787
+ },
4788
+ getNoteIdsForTag: async (label) => {
4789
+ const ids = /* @__PURE__ */ new Set();
4790
+ for (const tag of await storage.readonly("tags").getAllFromIndex("by-label", label)) {
4791
+ for (const link of await storage.readonly("note_tags").getAllFromIndex("by-tag", tag.id)) {
4792
+ ids.add(link.noteId);
4793
+ }
4794
+ }
4795
+ return ids;
4796
+ },
4797
+ getNoteTagLabels: async (noteId) => {
4798
+ const links = await storage.readonly("note_tags").getAllFromIndex("by-note", noteId);
4799
+ const tags = await storage.readonly("tags").getMany(links.map((l) => l.tagId));
4800
+ return tags.flatMap((t) => t ? [t.label] : []);
4801
+ },
4802
+ queryDomain: async (request) => {
4803
+ if (!storage.queryDomain) return void 0;
4804
+ const result = await storage.queryDomain({ ...request, plan: "notes" });
4805
+ return result && result.plan === "notes" ? result : void 0;
4806
+ }
4807
+ };
4808
+ const blockStore = {
4809
+ getAllBlocks: () => storage.readonly("block_index").getAll(),
4810
+ queryDomain: async (request) => {
4811
+ if (!storage.queryDomain) return void 0;
4812
+ const result = await storage.queryDomain({ ...request, plan: "blocks" });
4813
+ return result && result.plan === "blocks" ? result : void 0;
4814
+ }
4815
+ };
4816
+ const effortStore = options.effortStore ?? {
4817
+ getAllEfforts: async () => {
4818
+ const stored = await storage.readonly("efforts").getAll();
4819
+ const bySlug = /* @__PURE__ */ new Map();
4820
+ for (const eff of bundledEfforts) bySlug.set(eff.slug, eff);
4821
+ for (const eff of stored) bySlug.set(eff.slug, eff);
4822
+ return [...bySlug.values()];
4823
+ }
4824
+ };
4825
+ const feedCatalogStore = options.feedCatalogStore ?? {
4826
+ getAllFeeds: async () => {
4827
+ const rows = [];
4828
+ for (const row of await storage.readonly("meta").getAll()) {
4829
+ const key = row.key;
4830
+ if (typeof key !== "string" || !key.startsWith("seed:") || key === seedMetaKey("user")) continue;
4831
+ const id = key.slice("seed:".length);
4832
+ rows.push({
4833
+ id,
4834
+ label: id,
4835
+ url: `https://${id}.example/feed/`,
4836
+ tier: "imported",
4837
+ subscribed: true,
4838
+ installed: true,
4839
+ notebookCount: 0,
4840
+ itemCount: 0
4841
+ });
4842
+ }
4843
+ return rows;
4844
+ },
4845
+ getAllNotebooks: async () => {
4846
+ const links = await storage.readonly("notebook_links").getAll().catch(() => []);
4847
+ const notes = await storage.readonly("notes").getAll();
4848
+ const memberCount = /* @__PURE__ */ new Map();
4849
+ for (const link of links) {
4850
+ if (link.targetKind === "note") {
4851
+ memberCount.set(link.notebookId, (memberCount.get(link.notebookId) ?? 0) + 1);
4852
+ }
4853
+ }
4854
+ const rows = [];
4855
+ for (const [notebookId, count] of memberCount) {
4856
+ const slug = notebookId.startsWith("notebook/") ? notebookId.slice("notebook/".length) : notebookId;
4857
+ const landing = notes.find((n) => n.id === notebookId);
4858
+ const feedSourceId = landing?.feedSourceId;
4859
+ const chunkId = `notebook.${slug}`;
4860
+ const feedId = feedSourceId ?? "local";
4861
+ let subscribed = feedSourceId !== void 0;
4862
+ if (options.isNotebookSubscribed) {
4863
+ const res = options.isNotebookSubscribed(feedId, chunkId);
4864
+ subscribed = typeof res === "boolean" ? res : Boolean(await res);
4865
+ }
4866
+ rows.push({
4867
+ id: notebookId,
4868
+ feedId,
4869
+ feedLabel: feedSourceId ?? "Yours (Local)",
4870
+ chunkId,
4871
+ slug,
4872
+ label: landing?.title ?? slug,
4873
+ count,
4874
+ subscribed,
4875
+ installed: true,
4876
+ origin: feedSourceId ? "feed" : "user",
4877
+ ...landing?.public !== void 0 ? { public: landing.public } : {}
4878
+ });
4879
+ }
4880
+ return rows;
4881
+ }
4882
+ };
4883
+ const stores = {
4884
+ eventStore,
4885
+ noteStore,
4886
+ blockStore,
4887
+ effortStore,
4888
+ blockEffortsStore: {
4889
+ getAllFromIndex: (index, key) => storage.readonly("block_efforts").getAllFromIndex(index, key)
4890
+ },
4891
+ blockEquipmentStore: {
4892
+ getAllFromIndex: (index, key) => storage.readonly("block_equipment").getAllFromIndex(index, key)
4893
+ },
4894
+ tagsStore: {
4895
+ getAllFromIndex: (index, key) => storage.readonly("tags").getAllFromIndex(index, key),
4896
+ getAll: () => storage.readonly("tags").getAll()
4897
+ },
4898
+ noteTagsStore: {
4899
+ getAllFromIndex: (index, key) => storage.readonly("note_tags").getAllFromIndex(index, key)
4900
+ },
4901
+ pageStore: {
4902
+ getNotePages: (noteId) => storage.readonly("page_notes").getAllFromIndex("by-note", noteId),
4903
+ getPage: (pageId) => storage.readonly("page").get(pageId),
4904
+ getAllPages: () => storage.readonly("page").getAll(),
4905
+ getAllLinks: () => storage.readonly("page_notes").getAll()
4906
+ },
4907
+ relationStore: {
4908
+ getBatches: async (noteIds) => {
4909
+ const bundles = /* @__PURE__ */ new Map();
4910
+ for (const noteId of noteIds) {
4911
+ const links = await storage.readonly("page_notes").getAllFromIndex("by-note", noteId);
4912
+ const tagLinks = await storage.readonly("note_tags").getAllFromIndex("by-note", noteId);
4913
+ const tags = await storage.readonly("tags").getMany(tagLinks.map((l) => l.tagId));
4914
+ const pages = await storage.readonly("page").getMany([...new Set(links.map((l) => l.pageId))]);
4915
+ bundles.set(noteId, {
4916
+ tags: tags.flatMap((t) => t ? [{ label: t.label, ...t.type ? { type: t.type } : {} }] : []),
4917
+ links,
4918
+ pages: pages.filter((p) => p !== void 0)
4919
+ });
4920
+ }
4921
+ return bundles;
4922
+ }
4923
+ },
4924
+ feedCatalogStore
4925
+ };
4926
+ if (options.datasetStore) {
4927
+ stores.datasetStore = options.datasetStore;
4928
+ }
4929
+ if (options.isNotebookSubscribed) {
4930
+ stores.isNotebookSubscribed = (feedId, chunkId) => {
4931
+ const res = options.isNotebookSubscribed(feedId, chunkId);
4932
+ return typeof res === "boolean" ? res : true;
4933
+ };
4934
+ }
4935
+ return stores;
4936
+ }
4746
4937
 
4747
- export { APP_ORIGIN, BUILD_TIME, CANVAS_CHUNK_ID, DASHBOARDS_CHUNK_ID, DirectoryHandleFeedTree, EFFORTS_CHUNK_ID, EQUIPMENT_CHUNK_ID, FEED_SUBSCRIPTIONS_META_KEY, FeedTreeError, GIT_SHA, HttpFeedTree, MemoryFeedTree, NOTE_ID_FRONTMATTER_KEY, PUBLISHED_FEED_META_KEY, QR_SCRIPT_ID, SEED_BROADCAST_CHANNEL, SEED_NAMESPACE, SEED_REGISTERED_WIDGETS, SEED_SCHEMA, SEMVER, SESSION_CSV_HEADER, TELEMETRY_CSV_HEADER, VERSION, applySeedChunk, applySeedChunks, assertNotebookIndex, assertSeedManifest, assertSeedRow, assertSeedRows, backfillFeedProvenance, buildNoteProvenance, buildStatementTree, canvasRouteSlug, checkUnpublishedFeedChanges, cloneRemoteRecord, composeNoteMarkdown, createIRFile, createUserNotebookLanding, csvToEquipmentLabels, csvToSessionRows, csvToTelemetryBundle, decodeUtf8, deleteFeedSourceHeadless, effortToMarkdown, emptySeedMeta, encodeUtf8, equipmentToCsv, equipmentToMarkdown, exportPortableFilesFromStorage, extractNoteIdentity, extractTypedTags, feedIdOfMetaKey, getNoteNotebooks, getNotePublicationSummary, ingestPortableFilesIntoStorage, injectIdentityFrontmatter, isIRFile, listFeedSubscriptionsHeadless, listScopedPropertyOverrides, makeNotebookLinkId, makeScopedOverrideId, migrateNotebookVocabulary, normalizeFeedTreePath, notebookSlugForChunkId, parseCsvLine, parseFrontmatterDateMs, parseNoteMarkdown, prepareJournalSessionRun, previewRemoteNotebook, previewRemoteRecord, promoteNoteToNotebooks, promoteReferencedOverridesToNotebook, publishFeedFromStorage, qrInlineScript, readFrontmatterMeta, recordPublishedFeedCheckpoint, removeNoteFromNotebook, removeSeedSourceContent, renderFeedLandingHtml, resolveScopedPropertyCatalog, resolveUpstreamProvenance, saveScopedPropertyOverride, seedMetaKey, seedNoteId, seedNoteSourceId, seedPrecedenceRank, seedSourceTier, sessionToCsv, setNoteNotebooks, setNotebookPublic, setSessionPublic, sha256HexAsync, splitCsvRecords, statementToNode, subscribeFeedSourceHeadless, telemetryBundleToCsv, unsubscribeFeedSourceHeadless };
4748
- //# sourceMappingURL=chunk-YUFWRUL6.mjs.map
4749
- //# sourceMappingURL=chunk-YUFWRUL6.mjs.map
4938
+ export { APP_ORIGIN, BUILD_TIME, CANVAS_CHUNK_ID, DASHBOARDS_CHUNK_ID, DirectoryHandleFeedTree, EFFORTS_CHUNK_ID, EQUIPMENT_CHUNK_ID, FEED_SUBSCRIPTIONS_META_KEY, FeedTreeError, GIT_SHA, HttpFeedTree, MemoryFeedTree, NOTE_ID_FRONTMATTER_KEY, PUBLISHED_FEED_META_KEY, QR_SCRIPT_ID, SEED_BROADCAST_CHANNEL, SEED_NAMESPACE, SEED_REGISTERED_WIDGETS, SEED_SCHEMA, SEMVER, SESSION_CSV_HEADER, TELEMETRY_CSV_HEADER, VERSION, applySeedChunk, applySeedChunks, assertNotebookIndex, assertSeedManifest, assertSeedRow, assertSeedRows, backfillFeedProvenance, buildNoteProvenance, buildQueryServiceStoresFromStorage, buildStatementTree, canvasRouteSlug, checkUnpublishedFeedChanges, cloneRemoteRecord, composeNoteMarkdown, createIRFile, createUserNotebookLanding, csvToEquipmentLabels, csvToSessionRows, csvToTelemetryBundle, decodeUtf8, deleteFeedSourceHeadless, effortToMarkdown, emptySeedMeta, encodeUtf8, equipmentToCsv, equipmentToMarkdown, exportPortableFilesFromStorage, extractNoteIdentity, extractTypedTags, feedIdOfMetaKey, getNoteNotebooks, getNotePublicationSummary, ingestPortableFilesIntoStorage, injectIdentityFrontmatter, isIRFile, listFeedSubscriptionsHeadless, listScopedPropertyOverrides, makeNotebookLinkId, makeScopedOverrideId, migrateNotebookVocabulary, normalizeFeedTreePath, notebookSlugForChunkId, parseCsvLine, parseFrontmatterDateMs, parseNoteMarkdown, prepareJournalSessionRun, previewRemoteNotebook, previewRemoteRecord, promoteNoteToNotebooks, promoteReferencedOverridesToNotebook, publishFeedFromStorage, qrInlineScript, readFrontmatterMeta, recordPublishedFeedCheckpoint, removeNoteFromNotebook, removeSeedSourceContent, renderFeedLandingHtml, resolveScopedPropertyCatalog, resolveUpstreamProvenance, saveScopedPropertyOverride, seedMetaKey, seedNoteId, seedNoteSourceId, seedPrecedenceRank, seedSourceTier, sessionToCsv, setNoteNotebooks, setNotebookPublic, setSessionPublic, sha256HexAsync, splitCsvRecords, statementToNode, subscribeFeedSourceHeadless, telemetryBundleToCsv, unsubscribeFeedSourceHeadless };
4939
+ //# sourceMappingURL=chunk-CEPDTTJI.mjs.map
4940
+ //# sourceMappingURL=chunk-CEPDTTJI.mjs.map