@bitcobblers/wod-wiki-wql 0.38.2141 → 0.39.2143

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
@@ -63,12 +63,15 @@ var WQL_FIND_TARGETS = ["note", "block", "effort", "session", "segment", "event"
63
63
  var WQL_SOURCE_VALUES = ["journal", "feeds", "guides", "playground", "dashboards", "efforts", "equipment"];
64
64
  var WQL_SOURCE_HEADS = [
65
65
  "note",
66
+ "notes",
66
67
  "block",
67
68
  "effort",
68
69
  "session",
69
70
  "segment",
70
71
  "event",
71
72
  "journal",
73
+ "notebook",
74
+ "notebooks",
72
75
  "feed",
73
76
  "feeds",
74
77
  "catalog",
@@ -78,6 +81,8 @@ var WQL_SOURCE_HEADS = [
78
81
  ];
79
82
  var WQL_SOURCE_HEAD_SCOPES = {
80
83
  journal: "journal",
84
+ notebook: "feeds",
85
+ notebooks: "feeds",
81
86
  feed: "feeds",
82
87
  feeds: "feeds",
83
88
  catalog: "feeds",
@@ -92,7 +97,7 @@ var WQL_FUNCTION_HEADS = WQL_AGGREGATORS;
92
97
  var WQL_CHART_HEADS = ["timeseries", "bar", "table", "donut", "toplist", "value"];
93
98
  var WQL_STANDARD_DATASETS = ["@session", "@today"];
94
99
  var WQL_RESULT_PLANES = wodWikiCore.KNOWN_OUTPUT_TYPES;
95
- var WQL_CONTENT_FILTER_KEYS = ["type", "text", "has", "source", "catalog", ...WQL_TAG_KEYS];
100
+ var WQL_CONTENT_FILTER_KEYS = ["type", "text", "has", "source", "catalog", "notebook", ...WQL_TAG_KEYS];
96
101
  var WQL_SOURCES = ["note", "block", "effort", "session", "segment", "event"];
97
102
  var WQL_ROLLUP_PERIODS = ["2w", "4w"];
98
103
  var WQL_DISPLAY_UNITS = ["kg", "lb"];
@@ -114,7 +119,7 @@ var WQL_KEYWORDS = [
114
119
  ];
115
120
 
116
121
  // src/capabilities.ts
117
- var CONTENT_GROUPING_DIMENSIONS = ["date", "day", "week", "month", "year", "discipline", "origin", "source", "kind", "type", "tag"];
122
+ var CONTENT_GROUPING_DIMENSIONS = ["date", "day", "week", "month", "year", "discipline", "origin", "source", "notebook", "kind", "type", "tag"];
118
123
  var STRUCTURAL_TYPES = { time: true, groupby: true, rollup: true, unit: true, where: true, agg: true };
119
124
  var FACT_KEYS = WQL_TAG_KEYS.filter((key) => key !== "metric");
120
125
  var TABLE_KEYS = WQL_TAG_KEYS.filter((key) => key !== "tags");
@@ -657,7 +662,7 @@ function validateSourceFilter(filters) {
657
662
  if (val === "collection" || val === "collections") {
658
663
  return `source:${val} is retired \u2014 collections were renamed to feeds; use source:feeds or :feed{}.`;
659
664
  }
660
- if (WQL_SOURCE_VALUES.includes(val) || val === "feed" || val.startsWith("collection:") || val.startsWith("feed:")) {
665
+ if (WQL_SOURCE_VALUES.includes(val) || val === "feed" || val === "notebook" || val === "notebooks" || val.startsWith("collection:") || val.startsWith("feed:") || val.startsWith("notebook:") || val.startsWith("notebook/")) {
661
666
  continue;
662
667
  }
663
668
  return `Unknown source "${val}". Try: ${WQL_SOURCE_VALUES.join(", ")} (or collection:<id>, feed:<id>)`;
@@ -943,7 +948,7 @@ function parseFindQuery(raw, opts) {
943
948
  if (scope || typeScope) {
944
949
  result.target = "note";
945
950
  } else {
946
- result.target = headName;
951
+ result.target = headName === "notes" ? "note" : headName;
947
952
  if (result.target === "page") {
948
953
  result.error = "find:page is retired \u2014 page-ness is handled by type: (e.g. :note{source:guides} or type:feed).";
949
954
  return result;
@@ -967,7 +972,7 @@ function parseFindQuery(raw, opts) {
967
972
  negate: false,
968
973
  values: [{ value: scope, wildcard: false }]
969
974
  });
970
- if (headName === "catalog" || headName === "catalogs") {
975
+ if (headName === "catalog" || headName === "catalogs" || headName === "notebook" || headName === "notebooks") {
971
976
  result.filters.push({
972
977
  key: "type",
973
978
  negate: false,
@@ -1503,7 +1508,7 @@ function headApply(o, colonTyped) {
1503
1508
  return { ...o, apply: `${colonTyped ? "" : ":"}${o.label}{` };
1504
1509
  }
1505
1510
  var LEGACY_HEAD_OPTIONS = WQL_AGGREGATORS.map((label) => ({ label, type: "keyword" }));
1506
- var NOTE_COLUMNS = ["title", "date", "createdAt", "type", "sourceId", "catalog"];
1511
+ var NOTE_COLUMNS = ["title", "date", "createdAt", "type", "sourceId", "catalog", "notebookId"];
1507
1512
  var BLOCK_COLUMNS = ["noteTitle", "dataType", "position", "createdAt", "noteId", "sourceId"];
1508
1513
  var EFFORT_COLUMNS = ["slug", "label", "registrySource"];
1509
1514
  var SESSION_COLUMNS = ["duration", "startTime", "origin"];
@@ -1530,14 +1535,18 @@ function resolveColonHead(name) {
1530
1535
  const n = name.toLowerCase();
1531
1536
  if (WQL_FUNCTION_HEADS.includes(n)) return { family: "aggregate" };
1532
1537
  if (WQL_CHART_HEADS.includes(n)) return { family: "find" };
1533
- let source = n;
1534
- if (!WQL_SOURCE_HEADS.includes(source)) {
1535
- const partial = source ? WQL_SOURCE_HEADS.filter((t2) => t2.startsWith(source)) : [];
1536
- if (partial.length === 1) source = partial[0];
1538
+ const headTarget = (head) => {
1539
+ if (head === "notes") return "note";
1540
+ const scoped = WQL_SOURCE_HEAD_SCOPES[head] || WQL_TYPE_HEADS[head];
1541
+ return scoped ? "note" : head;
1542
+ };
1543
+ if (WQL_SOURCE_HEADS.includes(n)) {
1544
+ return { family: "find", target: headTarget(n) };
1537
1545
  }
1538
- if (WQL_SOURCE_HEADS.includes(source)) {
1539
- const scoped = WQL_SOURCE_HEAD_SCOPES[source] || WQL_TYPE_HEADS[source];
1540
- return { family: "find", target: scoped ? "note" : source };
1546
+ const partial = n ? WQL_SOURCE_HEADS.filter((t2) => t2.startsWith(n)) : [];
1547
+ const targets = [...new Set(partial.map(headTarget))];
1548
+ if (targets.length === 1) {
1549
+ return { family: "find", target: targets[0] };
1541
1550
  }
1542
1551
  return { family: "find" };
1543
1552
  }
@@ -2941,7 +2950,7 @@ function sourceMatches(item, kind) {
2941
2950
  if (sourceId && sourceId !== "journal" && !NOTE_UUID_RE.test(sourceId) && !/^journal\/\d{4}-\d{2}-\d{2}$/.test(sourceId)) return false;
2942
2951
  return item.type !== "dashboard" && item.type !== "effort" && item.type !== "equipment" && item.seedOrigin !== "seed" && item.seedChunkId === void 0 && !item.catalog && !(!!item.sourcePath && item.sourcePath.startsWith("markdown/"));
2943
2952
  }
2944
- if (kind === "feed" || kind === "feeds") {
2953
+ if (kind === "feed" || kind === "feeds" || kind === "notebook" || kind === "notebooks") {
2945
2954
  return !!sourceId && (sourceId.startsWith("collection:") || sourceId.startsWith("page:collection:"));
2946
2955
  }
2947
2956
  if (kind === "page" || kind === "pages") {
@@ -2959,6 +2968,9 @@ function sourceMatches(item, kind) {
2959
2968
  const idRest = sourceId.slice("feed:".length).replace(/^feeds\//, "");
2960
2969
  return idRest === rest || idRest.startsWith(`${rest}/`);
2961
2970
  }
2971
+ if (kind.startsWith("notebook:") || kind.startsWith("notebook/")) {
2972
+ return notebookOfItem(item) === wodWikiCore.toNotebookId(kind);
2973
+ }
2962
2974
  return sourceId === kind;
2963
2975
  }
2964
2976
  function applySourceFilter(items, filters) {
@@ -3675,7 +3687,7 @@ var QueryService = class {
3675
3687
  if (parsed.target === "segment" || parsed.target === "event") {
3676
3688
  return this.runFindTable(parsed, options2);
3677
3689
  }
3678
- const isCatalogHead = parsed.target === "note" && parsed.filters.some((f) => f.key === "type" && !f.negate && f.values.some((v) => v.value === "feed")) && (parsed.filters.some((f) => f.key === "source" && !f.negate && f.values.some((v) => v.value === "feed" || v.value === "feeds")) || parsed.sourceScope?.includes("feeds"));
3690
+ const isCatalogHead = parsed.target === "note" && parsed.filters.some((f) => f.key === "type" && !f.negate && f.values.some((v) => v.value === "feed")) && (parsed.filters.some((f) => f.key === "source" && !f.negate && f.values.some((v) => v.value === "feed" || v.value === "feeds" || v.value === "notebook" || v.value === "notebooks")) || parsed.sourceScope?.includes("feeds") || parsed.sourceScope?.includes("notebooks"));
3679
3691
  if (isCatalogHead) {
3680
3692
  return this.runFindCatalog(parsed, options2, await this.noteStore.getAllNotes());
3681
3693
  }
@@ -4524,14 +4536,14 @@ var QueryService = class {
4524
4536
  }
4525
4537
  }
4526
4538
  const criteriaFilters = parsed.filters.filter(
4527
- (f) => !(f.key === "source" && !f.negate && f.values.some((v) => v.value === "feeds" || v.value === "feed")) && !(f.key === "type" && !f.negate && f.values.some((v) => v.value === "feed"))
4539
+ (f) => !(f.key === "source" && !f.negate && f.values.some((v) => v.value === "feeds" || v.value === "feed" || v.value === "notebooks" || v.value === "notebook")) && !(f.key === "type" && !f.negate && f.values.some((v) => v.value === "feed"))
4528
4540
  );
4529
4541
  let matchingCatalogs = [...catalogNotes];
4530
4542
  for (const filter of criteriaFilters) {
4531
- if (filter.key === "catalog") {
4532
- const wanted = new Set(filter.values.map((v) => v.value));
4543
+ if (filter.key === "catalog" || filter.key === "notebook") {
4544
+ const wanted = new Set(filter.values.map((v) => wodWikiCore.notebookSlugFromId(v.value)));
4533
4545
  matchingCatalogs = matchingCatalogs.filter((c) => {
4534
- const catId = catalogOfItem(c) ?? c.id;
4546
+ const catId = wodWikiCore.notebookSlugFromId(catalogOfItem(c) ?? c.id);
4535
4547
  const hit = wanted.has(catId);
4536
4548
  return filter.negate ? !hit : hit;
4537
4549
  });
@@ -5257,13 +5269,13 @@ ${query}
5257
5269
  }
5258
5270
 
5259
5271
  // src/version.ts
5260
- var VERSION = "0.38.2141";
5261
- var GIT_SHA = "b9b40a7";
5262
- var BUILD_TIME = "2026-10-19T12:09:48.802Z";
5272
+ var VERSION = "0.39.2143";
5273
+ var GIT_SHA = "6749fcd";
5274
+ var BUILD_TIME = "2026-10-19T23:48:27.952Z";
5263
5275
  var SEMVER = {
5264
- version: "0.38.2141",
5265
- gitSha: "b9b40a7",
5266
- buildTime: "2026-10-19T12:09:48.802Z"
5276
+ version: "0.39.2143",
5277
+ gitSha: "6749fcd",
5278
+ buildTime: "2026-10-19T23:48:27.952Z"
5267
5279
  };
5268
5280
 
5269
5281
  Object.defineProperty(exports, "DEFAULT_NOTEBOOK_SLUGS", {