@bitcobblers/wod-wiki-wql 0.8.39 → 0.9.40

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
@@ -58,9 +58,9 @@ type WqlGrain = (typeof WQL_GRAINS)[number];
58
58
  /** Content-discovery query targets (find:<target>). */
59
59
  declare const WQL_FIND_TARGETS: readonly ["note", "block", "effort"];
60
60
  type WqlFindTarget = (typeof WQL_FIND_TARGETS)[number];
61
- /** Content query scopes (in <scope>). */
62
- declare const WQL_SCOPES: readonly ["journal", "collections", "feeds", "all"];
63
- type WqlScope = (typeof WQL_SCOPES)[number];
61
+ /** Canonical source filter values (C2): scope folded into the source: filter key. */
62
+ declare const WQL_SOURCE_VALUES: readonly ["journal", "collections", "feeds", "all"];
63
+ type WqlSourceValue = (typeof WQL_SOURCE_VALUES)[number];
64
64
  /** Result planes — `rows:<plane>` narrows raw output-statement rows by the
65
65
  * unified store's promoted `outputType` column. The STORE vocabulary is
66
66
  * open (core KNOWN_OUTPUT_TYPES, ticket 002: unknowns are stored and
@@ -152,22 +152,31 @@ declare namespace wql_parser_terms {
152
152
  * Encapsulates suffix parsing order, regexes, depth-0 brace-aware splitting,
153
153
  * and AST extraction for all WQL suffix clauses:
154
154
  * - Outer join: `where <joinClause>`
155
- * - Display unit: `in <unit>`
155
+ * - Display unit: `in <unit>` (analytics queries only — C2 de-overloaded `in`)
156
156
  * - Rollup period: `.rollup(<size><unit>)`
157
157
  * - Group-by: `by {<dims>}`
158
- * - Time window: `last <n><unit>`
159
- * - Scope: `in <scope>`
158
+ * - Time window: `last <n><unit>` or `from <YYYY-MM-DD> [to <YYYY-MM-DD>]`
159
+ * (C1 — one window per query, every family)
160
160
  */
161
161
  interface ParsedWqlRollupSuffix {
162
162
  size: number;
163
163
  unit: string;
164
164
  raw: string;
165
165
  }
166
- interface ParsedWqlLastSuffix {
166
+ /** A window clause (C1): relative (`last 8w`) or civil-date range
167
+ * (`from 2026-01-01 [to 2026-03-31]`). One window per query — `last` and
168
+ * `from` are mutually exclusive (validated as a C3-style conflict). */
169
+ type ParsedWqlWindowSuffix = {
170
+ kind: 'relative';
167
171
  size: number;
168
172
  unit: 'd' | 'w';
169
173
  raw: string;
170
- }
174
+ } | {
175
+ kind: 'range';
176
+ start: string;
177
+ end?: string;
178
+ raw: string;
179
+ };
171
180
  interface ParsedWqlSuffixes {
172
181
  /** Outer cross-store join clause text (`where ...`). */
173
182
  where?: string;
@@ -177,10 +186,10 @@ interface ParsedWqlSuffixes {
177
186
  rollup?: ParsedWqlRollupSuffix;
178
187
  /** Group-by dimensions (`by {week, effort}`). */
179
188
  groupBy?: string[];
180
- /** Content time window (`last 8w`). */
181
- last?: ParsedWqlLastSuffix;
182
- /** Content scope (`in journal` / `in all`). */
183
- scope?: string;
189
+ /** Time window — relative or civil-date range, legal on every family (C1). */
190
+ window?: ParsedWqlWindowSuffix;
191
+ /** Legacy scope clause (`in journal` / `in all`) stripped for the C2 compatibility normalizer. */
192
+ legacyScope?: string;
184
193
  /** Duplicate-clause diagnostics (C3) — each names both conflicting spans. */
185
194
  conflicts?: string[];
186
195
  /** Primary query text with suffixes removed. */
@@ -197,7 +206,8 @@ declare function splitAtWhere(text: string): {
197
206
  /**
198
207
  * Extract suffixes from a raw WQL query string.
199
208
  * Strips outer join (`where`), display unit (`in kg`), rollup (`.rollup(1w)`),
200
- * group-by (`by {week}`), time window (`last 8w`), and scope (`in journal`).
209
+ * group-by (`by {week}`), time window (`last 8w` / `from … [to …]`), and
210
+ * legacy scope (`in journal`).
201
211
  */
202
212
  declare function parseWqlSuffixes(raw: string): ParsedWqlSuffixes;
203
213
 
@@ -249,7 +259,6 @@ interface MetricPredicate {
249
259
  interface FindPredicate {
250
260
  target: string;
251
261
  filters: TagFilter[];
252
- scope?: string;
253
262
  last?: {
254
263
  size: number;
255
264
  unit: 'd' | 'w';
@@ -272,10 +281,14 @@ interface ParsedAggregateQuery {
272
281
  size: number;
273
282
  unit: 'd' | 'w';
274
283
  };
284
+ /** Time-selection window (C1): `last 6w` or `from … [to …]`. */
285
+ window?: QueryWindow;
275
286
  /** Optional display unit directive — `in kg` / `in lb`. */
276
287
  displayUnit?: string;
277
288
  /** Cross-store content join (`where find:note{...}`); restricts to raw logs. */
278
289
  join?: FindPredicate;
290
+ /** Deprecation advisories (C2 normalizer). */
291
+ advisories?: string[];
279
292
  error?: string;
280
293
  }
281
294
  /** Result of parsing a content-discovery query (`find:target{filters} in scope`). */
@@ -285,17 +298,29 @@ interface ParsedFindQuery {
285
298
  /** Content target — a WQL_FIND_TARGETS value (C7 closed enum). */
286
299
  target: string;
287
300
  filters: TagFilter[];
288
- /** Where to look: journal | collections | feeds | all. */
289
- scope?: string;
290
- /** Time window: last 8w, last 4d. */
291
- last?: {
292
- size: number;
293
- unit: 'd' | 'w';
294
- };
301
+ /** Time-selection window (C1): `last 8w` or `from … [to …]`. */
302
+ window?: QueryWindow;
295
303
  /** Cross-store metric join (`where sum:totalVolume{} > 5000`). */
296
304
  join?: MetricPredicate;
305
+ /** Deprecation advisories (C2 normalizer). */
306
+ advisories?: string[];
297
307
  error?: string;
298
308
  }
309
+ /**
310
+ * Time-selection window (C1) — legal on every query family. `last <n><d|w>`
311
+ * is relative; `from <YYYY-MM-DD> [to <YYYY-MM-DD>]` is a civil-date range
312
+ * (local-midnight semantics, inclusive end day). One window per query;
313
+ * `last` and `from` are mutually exclusive (C3-style conflict).
314
+ */
315
+ type QueryWindow = {
316
+ kind: 'relative';
317
+ size: number;
318
+ unit: 'd' | 'w';
319
+ } | {
320
+ kind: 'range';
321
+ start: string;
322
+ end?: string;
323
+ };
299
324
  type AnyParsedQuery = ParsedAggregateQuery | ParsedFindQuery | ParsedRowsQuery;
300
325
  /** Type guard: true for content-discovery queries. */
301
326
  declare function isFindQuery(parsed: AnyParsedQuery): parsed is ParsedFindQuery;
@@ -320,11 +345,11 @@ interface ParsedRowsQuery {
320
345
  /** Output-statement type narrowing from the optional target (`rows:segment{…}`); undefined = all types. */
321
346
  outputType?: string;
322
347
  filters: TagFilter[];
323
- /** Time window over the workout end time: last 8w, last 4d. */
324
- last?: {
325
- size: number;
326
- unit: 'd' | 'w';
327
- };
348
+ /** Time-selection window (C1): `last 4w` or `from … [to …]` over the
349
+ * workout end time. */
350
+ window?: QueryWindow;
351
+ /** Deprecation advisories (C2 normalizer). */
352
+ advisories?: string[];
328
353
  error?: string;
329
354
  }
330
355
  interface Series {
@@ -340,6 +365,16 @@ interface Series {
340
365
  * `rows` to the rows path, everything else to analytics.
341
366
  */
342
367
  declare function parseQuery(raw: string): AnyParsedQuery;
368
+ /**
369
+ * C2 Compatibility normalizer: rewrites legacy query syntax into modern WQL.
370
+ * - Bare `rows:{…}` heads rewrite to `rows:all{…}`
371
+ * - Legacy trailing `in <scope>` rewrites into `{source:<scope>}`
372
+ * Returns the normalized query string and any deprecation advisories.
373
+ */
374
+ declare function normalizeWql(raw: string): {
375
+ query: string;
376
+ advisories: string[];
377
+ };
343
378
 
344
379
  /**
345
380
  * Canonical discipline vocabulary — the single source of truth for effort
@@ -974,13 +1009,13 @@ declare function parseFrontmatterProps(lines: string[]): Record<string, string>;
974
1009
  * Auto-generated build version metadata.
975
1010
  * Do not edit directly; updated by scripts/stamp-version.ts
976
1011
  */
977
- declare const VERSION = "0.8.39";
978
- declare const GIT_SHA = "3c19185";
979
- declare const BUILD_TIME = "2026-08-26T00:07:31.934Z";
1012
+ declare const VERSION = "0.9.40";
1013
+ declare const GIT_SHA = "2462ec9";
1014
+ declare const BUILD_TIME = "2026-08-26T01:04:47.412Z";
980
1015
  declare const SEMVER: {
981
- readonly version: "0.8.39";
982
- readonly gitSha: "3c19185";
983
- readonly buildTime: "2026-08-26T00:07:31.934Z";
1016
+ readonly version: "0.9.40";
1017
+ readonly gitSha: "2462ec9";
1018
+ readonly buildTime: "2026-08-26T01:04:47.412Z";
984
1019
  };
985
1020
 
986
- 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 ParsedAggregateQuery, type ParsedFindQuery, type ParsedFrontmatter, 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_RESULT_PLANES, WQL_ROLLUP_PERIODS, WQL_ROWS_SCOPE_KEYS, WQL_ROWS_TARGETS, 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 WqlResultPlane, type WqlRollupPeriod, type WqlRowsTarget, type WqlScope, type WqlSource, type WqlTagKey, type WqlVirtualDim, buildDashboardDocument, buildDashboardScaffold, convert, dashboardSlug, defaultTokenValues, disciplineFactorFor, extractDashboardTokens, extractFrontmatterTags, getList, getScalar, getUnitFamily, isAggregateQuery, 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 };
1021
+ 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 ParsedAggregateQuery, type ParsedFindQuery, type ParsedFrontmatter, type ParsedRowsQuery, type ParsedWqlRollupSuffix, type ParsedWqlSuffixes, type ParsedWqlWindowSuffix, type QueryOptions, type QueryResult, QueryService, type QueryServiceStores, type QueryWidgetSuffix, type QueryWindow, 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_RESULT_PLANES, WQL_ROLLUP_PERIODS, WQL_ROWS_SCOPE_KEYS, WQL_ROWS_TARGETS, WQL_SOURCES, WQL_SOURCE_VALUES, 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 WqlResultPlane, type WqlRollupPeriod, type WqlRowsTarget, type WqlSource, type WqlSourceValue, type WqlTagKey, type WqlVirtualDim, buildDashboardDocument, buildDashboardScaffold, convert, dashboardSlug, defaultTokenValues, disciplineFactorFor, extractDashboardTokens, extractFrontmatterTags, getList, getScalar, getUnitFamily, isAggregateQuery, isDashboardMeta, isDashboardWidgetType, isEffortDiscipline, isFindQuery, isProposedMetric, isRowsQuery, normalizeSummaryFacts, normalizeWql, 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
@@ -58,9 +58,9 @@ type WqlGrain = (typeof WQL_GRAINS)[number];
58
58
  /** Content-discovery query targets (find:<target>). */
59
59
  declare const WQL_FIND_TARGETS: readonly ["note", "block", "effort"];
60
60
  type WqlFindTarget = (typeof WQL_FIND_TARGETS)[number];
61
- /** Content query scopes (in <scope>). */
62
- declare const WQL_SCOPES: readonly ["journal", "collections", "feeds", "all"];
63
- type WqlScope = (typeof WQL_SCOPES)[number];
61
+ /** Canonical source filter values (C2): scope folded into the source: filter key. */
62
+ declare const WQL_SOURCE_VALUES: readonly ["journal", "collections", "feeds", "all"];
63
+ type WqlSourceValue = (typeof WQL_SOURCE_VALUES)[number];
64
64
  /** Result planes — `rows:<plane>` narrows raw output-statement rows by the
65
65
  * unified store's promoted `outputType` column. The STORE vocabulary is
66
66
  * open (core KNOWN_OUTPUT_TYPES, ticket 002: unknowns are stored and
@@ -152,22 +152,31 @@ declare namespace wql_parser_terms {
152
152
  * Encapsulates suffix parsing order, regexes, depth-0 brace-aware splitting,
153
153
  * and AST extraction for all WQL suffix clauses:
154
154
  * - Outer join: `where <joinClause>`
155
- * - Display unit: `in <unit>`
155
+ * - Display unit: `in <unit>` (analytics queries only — C2 de-overloaded `in`)
156
156
  * - Rollup period: `.rollup(<size><unit>)`
157
157
  * - Group-by: `by {<dims>}`
158
- * - Time window: `last <n><unit>`
159
- * - Scope: `in <scope>`
158
+ * - Time window: `last <n><unit>` or `from <YYYY-MM-DD> [to <YYYY-MM-DD>]`
159
+ * (C1 — one window per query, every family)
160
160
  */
161
161
  interface ParsedWqlRollupSuffix {
162
162
  size: number;
163
163
  unit: string;
164
164
  raw: string;
165
165
  }
166
- interface ParsedWqlLastSuffix {
166
+ /** A window clause (C1): relative (`last 8w`) or civil-date range
167
+ * (`from 2026-01-01 [to 2026-03-31]`). One window per query — `last` and
168
+ * `from` are mutually exclusive (validated as a C3-style conflict). */
169
+ type ParsedWqlWindowSuffix = {
170
+ kind: 'relative';
167
171
  size: number;
168
172
  unit: 'd' | 'w';
169
173
  raw: string;
170
- }
174
+ } | {
175
+ kind: 'range';
176
+ start: string;
177
+ end?: string;
178
+ raw: string;
179
+ };
171
180
  interface ParsedWqlSuffixes {
172
181
  /** Outer cross-store join clause text (`where ...`). */
173
182
  where?: string;
@@ -177,10 +186,10 @@ interface ParsedWqlSuffixes {
177
186
  rollup?: ParsedWqlRollupSuffix;
178
187
  /** Group-by dimensions (`by {week, effort}`). */
179
188
  groupBy?: string[];
180
- /** Content time window (`last 8w`). */
181
- last?: ParsedWqlLastSuffix;
182
- /** Content scope (`in journal` / `in all`). */
183
- scope?: string;
189
+ /** Time window — relative or civil-date range, legal on every family (C1). */
190
+ window?: ParsedWqlWindowSuffix;
191
+ /** Legacy scope clause (`in journal` / `in all`) stripped for the C2 compatibility normalizer. */
192
+ legacyScope?: string;
184
193
  /** Duplicate-clause diagnostics (C3) — each names both conflicting spans. */
185
194
  conflicts?: string[];
186
195
  /** Primary query text with suffixes removed. */
@@ -197,7 +206,8 @@ declare function splitAtWhere(text: string): {
197
206
  /**
198
207
  * Extract suffixes from a raw WQL query string.
199
208
  * Strips outer join (`where`), display unit (`in kg`), rollup (`.rollup(1w)`),
200
- * group-by (`by {week}`), time window (`last 8w`), and scope (`in journal`).
209
+ * group-by (`by {week}`), time window (`last 8w` / `from … [to …]`), and
210
+ * legacy scope (`in journal`).
201
211
  */
202
212
  declare function parseWqlSuffixes(raw: string): ParsedWqlSuffixes;
203
213
 
@@ -249,7 +259,6 @@ interface MetricPredicate {
249
259
  interface FindPredicate {
250
260
  target: string;
251
261
  filters: TagFilter[];
252
- scope?: string;
253
262
  last?: {
254
263
  size: number;
255
264
  unit: 'd' | 'w';
@@ -272,10 +281,14 @@ interface ParsedAggregateQuery {
272
281
  size: number;
273
282
  unit: 'd' | 'w';
274
283
  };
284
+ /** Time-selection window (C1): `last 6w` or `from … [to …]`. */
285
+ window?: QueryWindow;
275
286
  /** Optional display unit directive — `in kg` / `in lb`. */
276
287
  displayUnit?: string;
277
288
  /** Cross-store content join (`where find:note{...}`); restricts to raw logs. */
278
289
  join?: FindPredicate;
290
+ /** Deprecation advisories (C2 normalizer). */
291
+ advisories?: string[];
279
292
  error?: string;
280
293
  }
281
294
  /** Result of parsing a content-discovery query (`find:target{filters} in scope`). */
@@ -285,17 +298,29 @@ interface ParsedFindQuery {
285
298
  /** Content target — a WQL_FIND_TARGETS value (C7 closed enum). */
286
299
  target: string;
287
300
  filters: TagFilter[];
288
- /** Where to look: journal | collections | feeds | all. */
289
- scope?: string;
290
- /** Time window: last 8w, last 4d. */
291
- last?: {
292
- size: number;
293
- unit: 'd' | 'w';
294
- };
301
+ /** Time-selection window (C1): `last 8w` or `from … [to …]`. */
302
+ window?: QueryWindow;
295
303
  /** Cross-store metric join (`where sum:totalVolume{} > 5000`). */
296
304
  join?: MetricPredicate;
305
+ /** Deprecation advisories (C2 normalizer). */
306
+ advisories?: string[];
297
307
  error?: string;
298
308
  }
309
+ /**
310
+ * Time-selection window (C1) — legal on every query family. `last <n><d|w>`
311
+ * is relative; `from <YYYY-MM-DD> [to <YYYY-MM-DD>]` is a civil-date range
312
+ * (local-midnight semantics, inclusive end day). One window per query;
313
+ * `last` and `from` are mutually exclusive (C3-style conflict).
314
+ */
315
+ type QueryWindow = {
316
+ kind: 'relative';
317
+ size: number;
318
+ unit: 'd' | 'w';
319
+ } | {
320
+ kind: 'range';
321
+ start: string;
322
+ end?: string;
323
+ };
299
324
  type AnyParsedQuery = ParsedAggregateQuery | ParsedFindQuery | ParsedRowsQuery;
300
325
  /** Type guard: true for content-discovery queries. */
301
326
  declare function isFindQuery(parsed: AnyParsedQuery): parsed is ParsedFindQuery;
@@ -320,11 +345,11 @@ interface ParsedRowsQuery {
320
345
  /** Output-statement type narrowing from the optional target (`rows:segment{…}`); undefined = all types. */
321
346
  outputType?: string;
322
347
  filters: TagFilter[];
323
- /** Time window over the workout end time: last 8w, last 4d. */
324
- last?: {
325
- size: number;
326
- unit: 'd' | 'w';
327
- };
348
+ /** Time-selection window (C1): `last 4w` or `from … [to …]` over the
349
+ * workout end time. */
350
+ window?: QueryWindow;
351
+ /** Deprecation advisories (C2 normalizer). */
352
+ advisories?: string[];
328
353
  error?: string;
329
354
  }
330
355
  interface Series {
@@ -340,6 +365,16 @@ interface Series {
340
365
  * `rows` to the rows path, everything else to analytics.
341
366
  */
342
367
  declare function parseQuery(raw: string): AnyParsedQuery;
368
+ /**
369
+ * C2 Compatibility normalizer: rewrites legacy query syntax into modern WQL.
370
+ * - Bare `rows:{…}` heads rewrite to `rows:all{…}`
371
+ * - Legacy trailing `in <scope>` rewrites into `{source:<scope>}`
372
+ * Returns the normalized query string and any deprecation advisories.
373
+ */
374
+ declare function normalizeWql(raw: string): {
375
+ query: string;
376
+ advisories: string[];
377
+ };
343
378
 
344
379
  /**
345
380
  * Canonical discipline vocabulary — the single source of truth for effort
@@ -974,13 +1009,13 @@ declare function parseFrontmatterProps(lines: string[]): Record<string, string>;
974
1009
  * Auto-generated build version metadata.
975
1010
  * Do not edit directly; updated by scripts/stamp-version.ts
976
1011
  */
977
- declare const VERSION = "0.8.39";
978
- declare const GIT_SHA = "3c19185";
979
- declare const BUILD_TIME = "2026-08-26T00:07:31.934Z";
1012
+ declare const VERSION = "0.9.40";
1013
+ declare const GIT_SHA = "2462ec9";
1014
+ declare const BUILD_TIME = "2026-08-26T01:04:47.412Z";
980
1015
  declare const SEMVER: {
981
- readonly version: "0.8.39";
982
- readonly gitSha: "3c19185";
983
- readonly buildTime: "2026-08-26T00:07:31.934Z";
1016
+ readonly version: "0.9.40";
1017
+ readonly gitSha: "2462ec9";
1018
+ readonly buildTime: "2026-08-26T01:04:47.412Z";
984
1019
  };
985
1020
 
986
- 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 ParsedAggregateQuery, type ParsedFindQuery, type ParsedFrontmatter, 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_RESULT_PLANES, WQL_ROLLUP_PERIODS, WQL_ROWS_SCOPE_KEYS, WQL_ROWS_TARGETS, 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 WqlResultPlane, type WqlRollupPeriod, type WqlRowsTarget, type WqlScope, type WqlSource, type WqlTagKey, type WqlVirtualDim, buildDashboardDocument, buildDashboardScaffold, convert, dashboardSlug, defaultTokenValues, disciplineFactorFor, extractDashboardTokens, extractFrontmatterTags, getList, getScalar, getUnitFamily, isAggregateQuery, 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 };
1021
+ 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 ParsedAggregateQuery, type ParsedFindQuery, type ParsedFrontmatter, type ParsedRowsQuery, type ParsedWqlRollupSuffix, type ParsedWqlSuffixes, type ParsedWqlWindowSuffix, type QueryOptions, type QueryResult, QueryService, type QueryServiceStores, type QueryWidgetSuffix, type QueryWindow, 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_RESULT_PLANES, WQL_ROLLUP_PERIODS, WQL_ROWS_SCOPE_KEYS, WQL_ROWS_TARGETS, WQL_SOURCES, WQL_SOURCE_VALUES, 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 WqlResultPlane, type WqlRollupPeriod, type WqlRowsTarget, type WqlSource, type WqlSourceValue, type WqlTagKey, type WqlVirtualDim, buildDashboardDocument, buildDashboardScaffold, convert, dashboardSlug, defaultTokenValues, disciplineFactorFor, extractDashboardTokens, extractFrontmatterTags, getList, getScalar, getUnitFamily, isAggregateQuery, isDashboardMeta, isDashboardWidgetType, isEffortDiscipline, isFindQuery, isProposedMetric, isRowsQuery, normalizeSummaryFacts, normalizeWql, 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 };