@bitcobblers/wod-wiki-wql 0.6.36 → 0.7.37

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.d.cts CHANGED
@@ -164,6 +164,8 @@ interface ParsedWqlSuffixes {
164
164
  last?: ParsedWqlLastSuffix;
165
165
  /** Content scope (`in journal` / `in all`). */
166
166
  scope?: string;
167
+ /** Duplicate-clause diagnostics (C3) — each names both conflicting spans. */
168
+ conflicts?: string[];
167
169
  /** Primary query text with suffixes removed. */
168
170
  primaryText: string;
169
171
  }
@@ -945,13 +947,13 @@ declare function parseFrontmatterProps(lines: string[]): Record<string, string>;
945
947
  * Auto-generated build version metadata.
946
948
  * Do not edit directly; updated by scripts/stamp-version.ts
947
949
  */
948
- declare const VERSION = "0.6.36";
949
- declare const GIT_SHA = "c5ad2b0";
950
- declare const BUILD_TIME = "2026-08-24T20:14:33.951Z";
950
+ declare const VERSION = "0.7.37";
951
+ declare const GIT_SHA = "713c593";
952
+ declare const BUILD_TIME = "2026-08-25T00:18:25.714Z";
951
953
  declare const SEMVER: {
952
- readonly version: "0.6.36";
953
- readonly gitSha: "c5ad2b0";
954
- readonly buildTime: "2026-08-24T20:14:33.951Z";
954
+ readonly version: "0.7.37";
955
+ readonly gitSha: "713c593";
956
+ readonly buildTime: "2026-08-25T00:18:25.714Z";
955
957
  };
956
958
 
957
959
  export { type Aggregator, type AnyParsedQuery, BUILD_TIME, type BlockQueryStore, type ComparisonOp, DASHBOARD_GRID_MAX_COLS, DASHBOARD_WIDGET_TYPES, DEFAULT_DASHBOARD_TITLE, DISCIPLINE_FACTORS, type DashboardDocument, type DashboardMeta, type DashboardParsedSection, type DashboardSectionInput, type DashboardToken, type DashboardWidget, type DashboardWidgetType, EFFORT_DISCIPLINES, type EffortDiscipline, type EffortQueryStore, type EventRowIdentity, type FindOptions, type FindPredicate, type FindQueryResult, GIT_SHA, type IEffort, KG_PER_LB, type LinkWidget, type MetricPredicate, type NoteQueryStore, PLANNED_WIDGET_TYPES, type ParsedFindQuery, type ParsedFrontmatter, type ParsedQuery, type ParsedRowsQuery, type ParsedWqlLastSuffix, type ParsedWqlRollupSuffix, type ParsedWqlSuffixes, type QueryOptions, type QueryResult, QueryService, type QueryServiceStores, type QueryWidgetSuffix, type RowsQueryResult, type RowsRun, SEMVER, type Series, type SeriesPoint, type SummaryFactIdentity, type SummaryFactSourceOutput, type TagFilter, type TagValue, UNIT_FAMILIES, type UnifiedEventStore, type UnitFamily, type UnitFamilyDef, VERSION, WQL_AGGREGATORS, WQL_CALC_TARGETS, WQL_COMPARISON_OPS, WQL_CONTENT_FILTER_KEYS, WQL_DISPLAY_UNITS, WQL_FIND_TARGETS, WQL_GRAINS, WQL_INTENSITY_TIERS, WQL_KEYWORDS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_ROLLUP_PERIODS, WQL_SCOPES, WQL_SOURCES, WQL_TAG_KEYS, WQL_VIRTUAL_DIMS, type WqlAggregator, type WqlCalcTarget, type WqlComparisonOp, type WqlCompletionOptions, type WqlContentFilterKey, type WqlDisplayUnit, type WqlFindTarget, type WqlGrain, type WqlIntensityTier, type WqlKeyword, type WqlMetricAggregate, type WqlMetricFamily, type WqlRollupPeriod, type WqlScope, type WqlSource, type WqlTagKey, type WqlVirtualDim, buildDashboardDocument, buildDashboardScaffold, convert, dashboardSlug, defaultTokenValues, disciplineFactorFor, extractDashboardTokens, extractFrontmatterTags, getList, getScalar, getUnitFamily, isDashboardMeta, isDashboardWidgetType, isEffortDiscipline, isFindQuery, isProposedMetric, isRowsQuery, normalizeSummaryFacts, parseDashboardNote, parseFlatProperties, parseFrontmatter, parseFrontmatterBody, parseFrontmatterCategories, parseFrontmatterProps, parseQuery, parseQueryWidgetSuffix, parseWqlSuffixes, projectEventToFacts, referencedTokens, resolveCanonicalMetricKey, resolveDisplayUnit, resolveWidgetType, serializeFrontmatter, setDashboardTokenValue, splitAtWhere, splitWidgetBody, staticNotesFromBlocks, staticTagIndexFromBlocks, stripFrontmatter, substituteTokens, toEventRows, toSummaryEventRows, unknownTokensMessage, unknownWidgetTypeMessage, wql, wqlCompletion, wqlCompletionSource, wqlHighlightStyle, wqlLanguage, parser as wqlParser, wql_parser_terms as wqlTerms };
package/dist/index.d.ts CHANGED
@@ -164,6 +164,8 @@ interface ParsedWqlSuffixes {
164
164
  last?: ParsedWqlLastSuffix;
165
165
  /** Content scope (`in journal` / `in all`). */
166
166
  scope?: string;
167
+ /** Duplicate-clause diagnostics (C3) — each names both conflicting spans. */
168
+ conflicts?: string[];
167
169
  /** Primary query text with suffixes removed. */
168
170
  primaryText: string;
169
171
  }
@@ -945,13 +947,13 @@ declare function parseFrontmatterProps(lines: string[]): Record<string, string>;
945
947
  * Auto-generated build version metadata.
946
948
  * Do not edit directly; updated by scripts/stamp-version.ts
947
949
  */
948
- declare const VERSION = "0.6.36";
949
- declare const GIT_SHA = "c5ad2b0";
950
- declare const BUILD_TIME = "2026-08-24T20:14:33.951Z";
950
+ declare const VERSION = "0.7.37";
951
+ declare const GIT_SHA = "713c593";
952
+ declare const BUILD_TIME = "2026-08-25T00:18:25.714Z";
951
953
  declare const SEMVER: {
952
- readonly version: "0.6.36";
953
- readonly gitSha: "c5ad2b0";
954
- readonly buildTime: "2026-08-24T20:14:33.951Z";
954
+ readonly version: "0.7.37";
955
+ readonly gitSha: "713c593";
956
+ readonly buildTime: "2026-08-25T00:18:25.714Z";
955
957
  };
956
958
 
957
959
  export { type Aggregator, type AnyParsedQuery, BUILD_TIME, type BlockQueryStore, type ComparisonOp, DASHBOARD_GRID_MAX_COLS, DASHBOARD_WIDGET_TYPES, DEFAULT_DASHBOARD_TITLE, DISCIPLINE_FACTORS, type DashboardDocument, type DashboardMeta, type DashboardParsedSection, type DashboardSectionInput, type DashboardToken, type DashboardWidget, type DashboardWidgetType, EFFORT_DISCIPLINES, type EffortDiscipline, type EffortQueryStore, type EventRowIdentity, type FindOptions, type FindPredicate, type FindQueryResult, GIT_SHA, type IEffort, KG_PER_LB, type LinkWidget, type MetricPredicate, type NoteQueryStore, PLANNED_WIDGET_TYPES, type ParsedFindQuery, type ParsedFrontmatter, type ParsedQuery, type ParsedRowsQuery, type ParsedWqlLastSuffix, type ParsedWqlRollupSuffix, type ParsedWqlSuffixes, type QueryOptions, type QueryResult, QueryService, type QueryServiceStores, type QueryWidgetSuffix, type RowsQueryResult, type RowsRun, SEMVER, type Series, type SeriesPoint, type SummaryFactIdentity, type SummaryFactSourceOutput, type TagFilter, type TagValue, UNIT_FAMILIES, type UnifiedEventStore, type UnitFamily, type UnitFamilyDef, VERSION, WQL_AGGREGATORS, WQL_CALC_TARGETS, WQL_COMPARISON_OPS, WQL_CONTENT_FILTER_KEYS, WQL_DISPLAY_UNITS, WQL_FIND_TARGETS, WQL_GRAINS, WQL_INTENSITY_TIERS, WQL_KEYWORDS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_ROLLUP_PERIODS, WQL_SCOPES, WQL_SOURCES, WQL_TAG_KEYS, WQL_VIRTUAL_DIMS, type WqlAggregator, type WqlCalcTarget, type WqlComparisonOp, type WqlCompletionOptions, type WqlContentFilterKey, type WqlDisplayUnit, type WqlFindTarget, type WqlGrain, type WqlIntensityTier, type WqlKeyword, type WqlMetricAggregate, type WqlMetricFamily, type WqlRollupPeriod, type WqlScope, type WqlSource, type WqlTagKey, type WqlVirtualDim, buildDashboardDocument, buildDashboardScaffold, convert, dashboardSlug, defaultTokenValues, disciplineFactorFor, extractDashboardTokens, extractFrontmatterTags, getList, getScalar, getUnitFamily, isDashboardMeta, isDashboardWidgetType, isEffortDiscipline, isFindQuery, isProposedMetric, isRowsQuery, normalizeSummaryFacts, parseDashboardNote, parseFlatProperties, parseFrontmatter, parseFrontmatterBody, parseFrontmatterCategories, parseFrontmatterProps, parseQuery, parseQueryWidgetSuffix, parseWqlSuffixes, projectEventToFacts, referencedTokens, resolveCanonicalMetricKey, resolveDisplayUnit, resolveWidgetType, serializeFrontmatter, setDashboardTokenValue, splitAtWhere, splitWidgetBody, staticNotesFromBlocks, staticTagIndexFromBlocks, stripFrontmatter, substituteTokens, toEventRows, toSummaryEventRows, unknownTokensMessage, unknownWidgetTypeMessage, wql, wqlCompletion, wqlCompletionSource, wqlHighlightStyle, wqlLanguage, parser as wqlParser, wql_parser_terms as wqlTerms };
package/dist/index.mjs CHANGED
@@ -160,55 +160,62 @@ function parseWqlSuffixes(raw) {
160
160
  let groupBy;
161
161
  let last;
162
162
  let scope;
163
+ const conflicts = [];
163
164
  const isFind = text.startsWith("find:");
164
165
  const isRows = /^rows(?=[:{]|\s|$)/.test(text);
166
+ const stripRepeated = (re) => {
167
+ const matches = [];
168
+ for (let m = re.exec(text); m; m = re.exec(text)) {
169
+ matches.unshift(m);
170
+ text = text.slice(0, m.index).trim();
171
+ }
172
+ return matches;
173
+ };
174
+ const conflictFrom = (label, ms) => {
175
+ if (ms.length > 1) {
176
+ conflicts.push(
177
+ `Duplicate '${label}' clause: '${ms[0][0].trim()}' conflicts with '${ms[ms.length - 1][0].trim()}'`
178
+ );
179
+ }
180
+ };
165
181
  if (isFind || isRows) {
166
- const lastMatch = LAST_RE.exec(text);
167
- if (lastMatch) {
168
- last = {
169
- size: parseInt(lastMatch[1], 10),
170
- unit: lastMatch[2].toLowerCase(),
171
- raw: lastMatch[0].trim()
172
- };
173
- text = text.slice(0, lastMatch.index).trim();
182
+ const lasts = stripRepeated(LAST_RE);
183
+ conflictFrom("window", lasts);
184
+ if (lasts.length) {
185
+ const m = lasts[lasts.length - 1];
186
+ last = { size: parseInt(m[1], 10), unit: m[2].toLowerCase(), raw: m[0].trim() };
174
187
  }
175
188
  if (isFind) {
176
- const scopeMatch = IN_SCOPE_RE.exec(text);
177
- if (scopeMatch) {
178
- scope = scopeMatch[1];
179
- text = text.slice(0, scopeMatch.index).trim();
180
- }
189
+ const scopes = stripRepeated(IN_SCOPE_RE);
190
+ conflictFrom("scope", scopes);
191
+ if (scopes.length) scope = scopes[scopes.length - 1][1];
181
192
  } else {
182
- const rollupMatch = ROLLUP_RE.exec(text);
183
- if (rollupMatch) {
184
- const rawRollup = rollupMatch[1] + rollupMatch[2];
185
- rollup = { size: rollupMatch[1] ? parseInt(rollupMatch[1], 10) : 1, unit: rollupMatch[2] || "", raw: rawRollup };
186
- text = text.slice(0, rollupMatch.index).trim();
193
+ const rollups = stripRepeated(ROLLUP_RE);
194
+ conflictFrom(".rollup", rollups);
195
+ if (rollups.length) {
196
+ const m = rollups[rollups.length - 1];
197
+ rollup = { size: m[1] ? parseInt(m[1], 10) : 1, unit: m[2] || "", raw: m[1] + m[2] };
187
198
  }
188
- const byMatch = BY_RE.exec(text);
189
- if (byMatch) {
190
- groupBy = byMatch[1].split(",").map((d) => d.trim()).filter(Boolean);
191
- text = text.slice(0, byMatch.index).trim();
199
+ const bys = stripRepeated(BY_RE);
200
+ conflictFrom("by", bys);
201
+ if (bys.length) {
202
+ groupBy = bys[bys.length - 1][1].split(",").map((d) => d.trim()).filter(Boolean);
192
203
  }
193
204
  }
194
205
  } else {
195
- const unitMatch = DISPLAY_UNIT_RE.exec(text);
196
- if (unitMatch) {
197
- displayUnit = unitMatch[1];
198
- text = text.slice(0, unitMatch.index).trim();
206
+ const units = stripRepeated(DISPLAY_UNIT_RE);
207
+ conflictFrom("display-unit", units);
208
+ if (units.length) displayUnit = units[units.length - 1][1];
209
+ const rollups = stripRepeated(ROLLUP_RE);
210
+ conflictFrom(".rollup", rollups);
211
+ if (rollups.length) {
212
+ const m = rollups[rollups.length - 1];
213
+ rollup = { size: m[1] ? parseInt(m[1], 10) : 1, unit: m[2] || "", raw: m[1] + m[2] };
199
214
  }
200
- const rollupMatch = ROLLUP_RE.exec(text);
201
- if (rollupMatch) {
202
- const rawRollup = rollupMatch[1] + rollupMatch[2];
203
- const size = rollupMatch[1] ? parseInt(rollupMatch[1], 10) : 1;
204
- const unit = rollupMatch[2] || "";
205
- rollup = { size, unit, raw: rawRollup };
206
- text = text.slice(0, rollupMatch.index).trim();
207
- }
208
- const byMatch = BY_RE.exec(text);
209
- if (byMatch) {
210
- groupBy = byMatch[1].split(",").map((d) => d.trim()).filter(Boolean);
211
- text = text.slice(0, byMatch.index).trim();
215
+ const bys = stripRepeated(BY_RE);
216
+ conflictFrom("by", bys);
217
+ if (bys.length) {
218
+ groupBy = bys[bys.length - 1][1].split(",").map((d) => d.trim()).filter(Boolean);
212
219
  }
213
220
  }
214
221
  return {
@@ -218,6 +225,7 @@ function parseWqlSuffixes(raw) {
218
225
  groupBy,
219
226
  last,
220
227
  scope,
228
+ conflicts: conflicts.length ? conflicts : void 0,
221
229
  primaryText: text
222
230
  };
223
231
  }
@@ -279,6 +287,10 @@ function parseRowsQuery(raw) {
279
287
  filters: [],
280
288
  last: last ? { size: last.size, unit: last.unit } : void 0
281
289
  };
290
+ if (suffixes.conflicts?.length) {
291
+ result.error = suffixes.conflicts.join("; ");
292
+ return result;
293
+ }
282
294
  if (whereText || groupBy || rollup) {
283
295
  result.error = `Rows queries return raw statements \u2014 no where / by / rollup. Got "${primaryText.trim()}"`;
284
296
  return result;
@@ -367,6 +379,10 @@ function parseAnalyticsQuery(raw) {
367
379
  displayUnit,
368
380
  rollup: rollup ? { size: rollup.size, unit: rollup.unit } : void 0
369
381
  };
382
+ if (suffixes.conflicts?.length) {
383
+ base.error = suffixes.conflicts.join("; ");
384
+ return base;
385
+ }
370
386
  if (rollup && rollup.unit !== "d" && rollup.unit !== "w") {
371
387
  base.error = cannotParse(text);
372
388
  return base;
@@ -428,6 +444,10 @@ function parseFindQuery(raw) {
428
444
  scope,
429
445
  last: last ? { size: last.size, unit: last.unit } : void 0
430
446
  };
447
+ if (suffixes.conflicts?.length) {
448
+ result.error = suffixes.conflicts.join("; ");
449
+ return result;
450
+ }
431
451
  const tree = parser.parse(text);
432
452
  let syntaxError = false;
433
453
  tree.iterate({ enter(node) {
@@ -2024,13 +2044,13 @@ sum:$metric{} rollup:1w
2024
2044
  }
2025
2045
 
2026
2046
  // src/version.ts
2027
- var VERSION = "0.6.36";
2028
- var GIT_SHA = "c5ad2b0";
2029
- var BUILD_TIME = "2026-08-24T20:14:33.951Z";
2047
+ var VERSION = "0.7.37";
2048
+ var GIT_SHA = "713c593";
2049
+ var BUILD_TIME = "2026-08-25T00:18:25.714Z";
2030
2050
  var SEMVER = {
2031
- version: "0.6.36",
2032
- gitSha: "c5ad2b0",
2033
- buildTime: "2026-08-24T20:14:33.951Z"
2051
+ version: "0.7.37",
2052
+ gitSha: "713c593",
2053
+ buildTime: "2026-08-25T00:18:25.714Z"
2034
2054
  };
2035
2055
 
2036
2056
  export { BUILD_TIME, DASHBOARD_GRID_MAX_COLS, DASHBOARD_WIDGET_TYPES, DEFAULT_DASHBOARD_TITLE, DISCIPLINE_FACTORS, EFFORT_DISCIPLINES, GIT_SHA, KG_PER_LB, PLANNED_WIDGET_TYPES, QueryService, SEMVER, UNIT_FAMILIES, VERSION, WQL_AGGREGATORS, WQL_CALC_TARGETS, WQL_COMPARISON_OPS, WQL_CONTENT_FILTER_KEYS, WQL_DISPLAY_UNITS, WQL_FIND_TARGETS, WQL_GRAINS, WQL_INTENSITY_TIERS, WQL_KEYWORDS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_ROLLUP_PERIODS, WQL_SCOPES, WQL_SOURCES, WQL_TAG_KEYS, WQL_VIRTUAL_DIMS, buildDashboardDocument, buildDashboardScaffold, convert, dashboardSlug, defaultTokenValues, disciplineFactorFor, extractDashboardTokens, extractFrontmatterTags, getList, getScalar, getUnitFamily, isDashboardMeta, isDashboardWidgetType, isEffortDiscipline, isFindQuery, isProposedMetric, isRowsQuery, normalizeSummaryFacts, parseDashboardNote, parseFlatProperties, parseFrontmatter, parseFrontmatterBody, parseFrontmatterCategories, parseFrontmatterProps, parseQuery, parseQueryWidgetSuffix, parseWqlSuffixes, projectEventToFacts, referencedTokens, resolveCanonicalMetricKey, resolveDisplayUnit, resolveWidgetType, serializeFrontmatter, setDashboardTokenValue, splitAtWhere, splitWidgetBody, staticNotesFromBlocks, staticTagIndexFromBlocks, stripFrontmatter, substituteTokens, toEventRows, toSummaryEventRows, unknownTokensMessage, unknownWidgetTypeMessage, wql, wqlCompletion, wqlCompletionSource, wqlHighlightStyle, wqlLanguage, parser as wqlParser, wql_parser_terms_exports as wqlTerms };