@bitcobblers/wod-wiki-engine 0.59.2246 → 0.60.2248

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.59.2246";
945
- var GIT_SHA = "222739e";
946
- var BUILD_TIME = "2026-11-18T17:13:06.344Z";
944
+ var VERSION = "0.60.2248";
945
+ var GIT_SHA = "e331129";
946
+ var BUILD_TIME = "2026-11-19T04:20:48.739Z";
947
947
  var SEMVER = {
948
- version: "0.59.2246",
949
- gitSha: "222739e",
950
- buildTime: "2026-11-18T17:13:06.344Z"
948
+ version: "0.60.2248",
949
+ gitSha: "e331129",
950
+ buildTime: "2026-11-19T04:20:48.739Z"
951
951
  };
952
952
  var SEED_SCHEMA = 9;
953
953
  var SEED_REGISTERED_WIDGETS = wodWikiCore.KNOWN_SECTION_WIDGETS;
@@ -4061,6 +4061,12 @@ async function cloneRemoteRecord(storage, reader, input) {
4061
4061
  );
4062
4062
  return clonedNote;
4063
4063
  }
4064
+ var portableTextDecoder = new TextDecoder();
4065
+ function decodePortableFileContent(entry) {
4066
+ if (typeof entry.content === "string") return entry.content;
4067
+ if (entry.bytes instanceof Uint8Array) return portableTextDecoder.decode(entry.bytes);
4068
+ throw new Error(`PortableFileEntry '${entry.path}' is missing both 'content' and 'bytes'.`);
4069
+ }
4064
4070
  async function exportPortableFilesFromStorage(storage, options = {}) {
4065
4071
  const telemetryFormat = options.telemetryFormat ?? "jsonl";
4066
4072
  const [allNotes, allSessions, allEvents, allRevisions] = await Promise.all([
@@ -4144,12 +4150,12 @@ async function ingestPortableFilesIntoStorage(storage, files, options = {}) {
4144
4150
  );
4145
4151
  const telemetryBundles = [];
4146
4152
  for (const jf of jsonlFiles) {
4147
- const parsed = wodWikiCore.parseNoteBundleFromJsonl(jf.content);
4153
+ const parsed = wodWikiCore.parseNoteBundleFromJsonl(decodePortableFileContent(jf));
4148
4154
  errors.push(...parsed.errors.map((e) => `${jf.path}: ${e}`));
4149
4155
  telemetryBundles.push(...parsed.bundles);
4150
4156
  }
4151
4157
  for (const cf of csvFiles) {
4152
- const parsed = csvToTelemetryBundle(cf.content);
4158
+ const parsed = csvToTelemetryBundle(decodePortableFileContent(cf));
4153
4159
  errors.push(...parsed.errors.map((e) => `${cf.path}: ${e}`));
4154
4160
  telemetryBundles.push(...parsed.bundles);
4155
4161
  }
@@ -4173,7 +4179,7 @@ async function ingestPortableFilesIntoStorage(storage, files, options = {}) {
4173
4179
  for (const mf of mdFiles) {
4174
4180
  try {
4175
4181
  const fallbackTitle = (mf.path.split("/").at(-1) ?? "Imported Note").replace(/\.md$/i, "");
4176
- const parsed = parseNoteMarkdown(mf.content, { fallbackTitle });
4182
+ const parsed = parseNoteMarkdown(decodePortableFileContent(mf), { fallbackTitle });
4177
4183
  const noteId = parsed.id ?? await seedNoteId(`import:${mf.path}:${now}`);
4178
4184
  const existing = await noteStore.get(noteId);
4179
4185
  const nextRev = existing && existing.rawContent !== parsed.rawContent ? existing.sourceRevision + 1 : existing?.sourceRevision ?? 1;
@@ -4697,21 +4703,12 @@ async function prepareJournalSessionRun(storage, input) {
4697
4703
  targetId: clonedNoteId,
4698
4704
  noteId: clonedNoteId,
4699
4705
  createdAt: startedAt
4700
- },
4701
- {
4702
- id: makeNotebookLinkId("notebook/journal", "session", sessionId),
4703
- notebookId: "notebook/journal",
4704
- targetKind: "session",
4705
- targetId: sessionId,
4706
- noteId: clonedNoteId,
4707
- createdAt: startedAt
4708
4706
  }
4709
4707
  ];
4710
4708
  await tx.readwrite("notes").put(clonedNote);
4711
4709
  if (revisions.length > 0) await tx.readwrite("block_revisions").putMany(revisions);
4712
4710
  if (projections.length > 0) await tx.readwrite("block_index").putMany(projections);
4713
4711
  await tx.readwrite("page_notes").put(pageNote);
4714
- await tx.readwrite("sessions").put(session2);
4715
4712
  await tx.readwrite("notebook_links").putMany(links2);
4716
4713
  return {
4717
4714
  note: clonedNote,
@@ -4773,15 +4770,6 @@ async function prepareJournalSessionRun(storage, input) {
4773
4770
  noteId: sourceNote.id,
4774
4771
  createdAt: startedAt
4775
4772
  }));
4776
- links.push({
4777
- id: makeNotebookLinkId("notebook/journal", "session", sessionId),
4778
- notebookId: "notebook/journal",
4779
- targetKind: "session",
4780
- targetId: sessionId,
4781
- noteId: sourceNote.id,
4782
- createdAt: startedAt
4783
- });
4784
- await tx.readwrite("sessions").put(session);
4785
4773
  await tx.readwrite("notebook_links").putMany(links);
4786
4774
  return {
4787
4775
  note: updatedNote,
@@ -5010,6 +4998,19 @@ function buildQueryServiceStoresFromStorage(storage, options = {}) {
5010
4998
  },
5011
4999
  feedCatalogStore
5012
5000
  };
5001
+ const sessionStore = {
5002
+ getAll: async () => {
5003
+ const rows = await storage.readonly("sessions").getAll();
5004
+ return rows.map((s) => ({
5005
+ id: s.id,
5006
+ noteId: s.noteId,
5007
+ startedAt: s.startTime,
5008
+ ...s.completed ? { completedAt: s.endTime } : {},
5009
+ createdAt: s.createdAt
5010
+ }));
5011
+ }
5012
+ };
5013
+ Object.assign(stores, { sessionStore });
5013
5014
  if (options.datasetStore) {
5014
5015
  stores.datasetStore = options.datasetStore;
5015
5016
  }