@bitcobblers/wod-wiki-wql 0.7.38 → 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.cjs +343 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +90 -37
- package/dist/index.d.ts +90 -37
- package/dist/index.mjs +339 -140
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -58,9 +58,26 @@ 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
|
-
/**
|
|
62
|
-
declare const
|
|
63
|
-
type
|
|
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
|
+
/** Result planes — `rows:<plane>` narrows raw output-statement rows by the
|
|
65
|
+
* unified store's promoted `outputType` column. The STORE vocabulary is
|
|
66
|
+
* open (core KNOWN_OUTPUT_TYPES, ticket 002: unknowns are stored and
|
|
67
|
+
* returned); the QUERY surface is a closed enum at parse (prototype C7) —
|
|
68
|
+
* reopening toward a registry is a later, separate decision. Custom types
|
|
69
|
+
* stay addressable programmatically via hand-built ASTs. */
|
|
70
|
+
declare const WQL_RESULT_PLANES: readonly ["segment", "system", "load", "event", "compiler", "completion", "analytics", "wellness"];
|
|
71
|
+
type WqlResultPlane = (typeof WQL_RESULT_PLANES)[number];
|
|
72
|
+
/** All `rows:` targets — content planes plus result planes (rows model
|
|
73
|
+
* §1.0: every query selects rows from a target) plus `all`, the explicit
|
|
74
|
+
* no-narrowing pseudo-target (spec v2 decision 1: the bare `rows:{…}`
|
|
75
|
+
* alias retires). Content-plane targets scope by content, not outputType
|
|
76
|
+
* (C4). */
|
|
77
|
+
declare const WQL_ROWS_TARGETS: readonly ["note", "block", "effort", "segment", "system", "load", "event", "compiler", "completion", "analytics", "wellness", "all"];
|
|
78
|
+
type WqlRowsTarget = (typeof WQL_ROWS_TARGETS)[number];
|
|
79
|
+
/** Rows scope filter keys (C4): the exact-match keys a rows query filters by. */
|
|
80
|
+
declare const WQL_ROWS_SCOPE_KEYS: readonly ["result", "block", "note"];
|
|
64
81
|
/** Content-specific filter keys (beyond the analytics tag keys). */
|
|
65
82
|
declare const WQL_CONTENT_FILTER_KEYS: readonly ["type", "text", "has", "source", "catalog", "effort", "discipline", "intensity", "note", "page", "origin", "grain", "metric", "block", "result", "tags"];
|
|
66
83
|
type WqlContentFilterKey = (typeof WQL_CONTENT_FILTER_KEYS)[number];
|
|
@@ -135,22 +152,31 @@ declare namespace wql_parser_terms {
|
|
|
135
152
|
* Encapsulates suffix parsing order, regexes, depth-0 brace-aware splitting,
|
|
136
153
|
* and AST extraction for all WQL suffix clauses:
|
|
137
154
|
* - Outer join: `where <joinClause>`
|
|
138
|
-
* - Display unit: `in <unit>`
|
|
155
|
+
* - Display unit: `in <unit>` (analytics queries only — C2 de-overloaded `in`)
|
|
139
156
|
* - Rollup period: `.rollup(<size><unit>)`
|
|
140
157
|
* - Group-by: `by {<dims>}`
|
|
141
|
-
* - Time window: `last <n><unit>`
|
|
142
|
-
*
|
|
158
|
+
* - Time window: `last <n><unit>` or `from <YYYY-MM-DD> [to <YYYY-MM-DD>]`
|
|
159
|
+
* (C1 — one window per query, every family)
|
|
143
160
|
*/
|
|
144
161
|
interface ParsedWqlRollupSuffix {
|
|
145
162
|
size: number;
|
|
146
163
|
unit: string;
|
|
147
164
|
raw: string;
|
|
148
165
|
}
|
|
149
|
-
|
|
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';
|
|
150
171
|
size: number;
|
|
151
172
|
unit: 'd' | 'w';
|
|
152
173
|
raw: string;
|
|
153
|
-
}
|
|
174
|
+
} | {
|
|
175
|
+
kind: 'range';
|
|
176
|
+
start: string;
|
|
177
|
+
end?: string;
|
|
178
|
+
raw: string;
|
|
179
|
+
};
|
|
154
180
|
interface ParsedWqlSuffixes {
|
|
155
181
|
/** Outer cross-store join clause text (`where ...`). */
|
|
156
182
|
where?: string;
|
|
@@ -160,10 +186,10 @@ interface ParsedWqlSuffixes {
|
|
|
160
186
|
rollup?: ParsedWqlRollupSuffix;
|
|
161
187
|
/** Group-by dimensions (`by {week, effort}`). */
|
|
162
188
|
groupBy?: string[];
|
|
163
|
-
/**
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
|
|
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;
|
|
167
193
|
/** Duplicate-clause diagnostics (C3) — each names both conflicting spans. */
|
|
168
194
|
conflicts?: string[];
|
|
169
195
|
/** Primary query text with suffixes removed. */
|
|
@@ -180,7 +206,8 @@ declare function splitAtWhere(text: string): {
|
|
|
180
206
|
/**
|
|
181
207
|
* Extract suffixes from a raw WQL query string.
|
|
182
208
|
* Strips outer join (`where`), display unit (`in kg`), rollup (`.rollup(1w)`),
|
|
183
|
-
* group-by (`by {week}`), time window (`last 8w`
|
|
209
|
+
* group-by (`by {week}`), time window (`last 8w` / `from … [to …]`), and
|
|
210
|
+
* legacy scope (`in journal`).
|
|
184
211
|
*/
|
|
185
212
|
declare function parseWqlSuffixes(raw: string): ParsedWqlSuffixes;
|
|
186
213
|
|
|
@@ -232,7 +259,6 @@ interface MetricPredicate {
|
|
|
232
259
|
interface FindPredicate {
|
|
233
260
|
target: string;
|
|
234
261
|
filters: TagFilter[];
|
|
235
|
-
scope?: string;
|
|
236
262
|
last?: {
|
|
237
263
|
size: number;
|
|
238
264
|
unit: 'd' | 'w';
|
|
@@ -255,30 +281,46 @@ interface ParsedAggregateQuery {
|
|
|
255
281
|
size: number;
|
|
256
282
|
unit: 'd' | 'w';
|
|
257
283
|
};
|
|
284
|
+
/** Time-selection window (C1): `last 6w` or `from … [to …]`. */
|
|
285
|
+
window?: QueryWindow;
|
|
258
286
|
/** Optional display unit directive — `in kg` / `in lb`. */
|
|
259
287
|
displayUnit?: string;
|
|
260
288
|
/** Cross-store content join (`where find:note{...}`); restricts to raw logs. */
|
|
261
289
|
join?: FindPredicate;
|
|
290
|
+
/** Deprecation advisories (C2 normalizer). */
|
|
291
|
+
advisories?: string[];
|
|
262
292
|
error?: string;
|
|
263
293
|
}
|
|
264
294
|
/** Result of parsing a content-discovery query (`find:target{filters} in scope`). */
|
|
265
295
|
interface ParsedFindQuery {
|
|
266
296
|
family: 'find';
|
|
267
297
|
raw: string;
|
|
268
|
-
/** Content target
|
|
298
|
+
/** Content target — a WQL_FIND_TARGETS value (C7 closed enum). */
|
|
269
299
|
target: string;
|
|
270
300
|
filters: TagFilter[];
|
|
271
|
-
/**
|
|
272
|
-
|
|
273
|
-
/** Time window: last 8w, last 4d. */
|
|
274
|
-
last?: {
|
|
275
|
-
size: number;
|
|
276
|
-
unit: 'd' | 'w';
|
|
277
|
-
};
|
|
301
|
+
/** Time-selection window (C1): `last 8w` or `from … [to …]`. */
|
|
302
|
+
window?: QueryWindow;
|
|
278
303
|
/** Cross-store metric join (`where sum:totalVolume{} > 5000`). */
|
|
279
304
|
join?: MetricPredicate;
|
|
305
|
+
/** Deprecation advisories (C2 normalizer). */
|
|
306
|
+
advisories?: string[];
|
|
280
307
|
error?: string;
|
|
281
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
|
+
};
|
|
282
324
|
type AnyParsedQuery = ParsedAggregateQuery | ParsedFindQuery | ParsedRowsQuery;
|
|
283
325
|
/** Type guard: true for content-discovery queries. */
|
|
284
326
|
declare function isFindQuery(parsed: AnyParsedQuery): parsed is ParsedFindQuery;
|
|
@@ -303,11 +345,11 @@ interface ParsedRowsQuery {
|
|
|
303
345
|
/** Output-statement type narrowing from the optional target (`rows:segment{…}`); undefined = all types. */
|
|
304
346
|
outputType?: string;
|
|
305
347
|
filters: TagFilter[];
|
|
306
|
-
/** Time window
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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[];
|
|
311
353
|
error?: string;
|
|
312
354
|
}
|
|
313
355
|
interface Series {
|
|
@@ -323,6 +365,16 @@ interface Series {
|
|
|
323
365
|
* `rows` to the rows path, everything else to analytics.
|
|
324
366
|
*/
|
|
325
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
|
+
};
|
|
326
378
|
|
|
327
379
|
/**
|
|
328
380
|
* Canonical discipline vocabulary — the single source of truth for effort
|
|
@@ -681,9 +733,10 @@ declare class QueryService {
|
|
|
681
733
|
getFactsByTimeRange(start: number, end: number): Promise<AnalyticsDataPoint[]>;
|
|
682
734
|
runQuery(raw: string, options?: QueryOptions): Promise<QueryResult>;
|
|
683
735
|
/**
|
|
684
|
-
* Execute a rows query (rows
|
|
685
|
-
*
|
|
686
|
-
*
|
|
736
|
+
* Execute a rows query (rows:<target>{…}, #949/C4) — the session results
|
|
737
|
+
* table plane. Filter rules are validated at parse; this executes only.
|
|
738
|
+
* Reads event rows directly over the unified store: outputType narrowing
|
|
739
|
+
* hits the promoted column; content-plane targets scope by content.
|
|
687
740
|
*/
|
|
688
741
|
runRows(parsed: ParsedRowsQuery, options?: {
|
|
689
742
|
anchorNow?: number;
|
|
@@ -956,13 +1009,13 @@ declare function parseFrontmatterProps(lines: string[]): Record<string, string>;
|
|
|
956
1009
|
* Auto-generated build version metadata.
|
|
957
1010
|
* Do not edit directly; updated by scripts/stamp-version.ts
|
|
958
1011
|
*/
|
|
959
|
-
declare const VERSION = "0.
|
|
960
|
-
declare const GIT_SHA = "
|
|
961
|
-
declare const BUILD_TIME = "2026-08-
|
|
1012
|
+
declare const VERSION = "0.9.40";
|
|
1013
|
+
declare const GIT_SHA = "2462ec9";
|
|
1014
|
+
declare const BUILD_TIME = "2026-08-26T01:04:47.412Z";
|
|
962
1015
|
declare const SEMVER: {
|
|
963
|
-
readonly version: "0.
|
|
964
|
-
readonly gitSha: "
|
|
965
|
-
readonly buildTime: "2026-08-
|
|
1016
|
+
readonly version: "0.9.40";
|
|
1017
|
+
readonly gitSha: "2462ec9";
|
|
1018
|
+
readonly buildTime: "2026-08-26T01:04:47.412Z";
|
|
966
1019
|
};
|
|
967
1020
|
|
|
968
|
-
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
|
|
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,26 @@ 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
|
-
/**
|
|
62
|
-
declare const
|
|
63
|
-
type
|
|
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
|
+
/** Result planes — `rows:<plane>` narrows raw output-statement rows by the
|
|
65
|
+
* unified store's promoted `outputType` column. The STORE vocabulary is
|
|
66
|
+
* open (core KNOWN_OUTPUT_TYPES, ticket 002: unknowns are stored and
|
|
67
|
+
* returned); the QUERY surface is a closed enum at parse (prototype C7) —
|
|
68
|
+
* reopening toward a registry is a later, separate decision. Custom types
|
|
69
|
+
* stay addressable programmatically via hand-built ASTs. */
|
|
70
|
+
declare const WQL_RESULT_PLANES: readonly ["segment", "system", "load", "event", "compiler", "completion", "analytics", "wellness"];
|
|
71
|
+
type WqlResultPlane = (typeof WQL_RESULT_PLANES)[number];
|
|
72
|
+
/** All `rows:` targets — content planes plus result planes (rows model
|
|
73
|
+
* §1.0: every query selects rows from a target) plus `all`, the explicit
|
|
74
|
+
* no-narrowing pseudo-target (spec v2 decision 1: the bare `rows:{…}`
|
|
75
|
+
* alias retires). Content-plane targets scope by content, not outputType
|
|
76
|
+
* (C4). */
|
|
77
|
+
declare const WQL_ROWS_TARGETS: readonly ["note", "block", "effort", "segment", "system", "load", "event", "compiler", "completion", "analytics", "wellness", "all"];
|
|
78
|
+
type WqlRowsTarget = (typeof WQL_ROWS_TARGETS)[number];
|
|
79
|
+
/** Rows scope filter keys (C4): the exact-match keys a rows query filters by. */
|
|
80
|
+
declare const WQL_ROWS_SCOPE_KEYS: readonly ["result", "block", "note"];
|
|
64
81
|
/** Content-specific filter keys (beyond the analytics tag keys). */
|
|
65
82
|
declare const WQL_CONTENT_FILTER_KEYS: readonly ["type", "text", "has", "source", "catalog", "effort", "discipline", "intensity", "note", "page", "origin", "grain", "metric", "block", "result", "tags"];
|
|
66
83
|
type WqlContentFilterKey = (typeof WQL_CONTENT_FILTER_KEYS)[number];
|
|
@@ -135,22 +152,31 @@ declare namespace wql_parser_terms {
|
|
|
135
152
|
* Encapsulates suffix parsing order, regexes, depth-0 brace-aware splitting,
|
|
136
153
|
* and AST extraction for all WQL suffix clauses:
|
|
137
154
|
* - Outer join: `where <joinClause>`
|
|
138
|
-
* - Display unit: `in <unit>`
|
|
155
|
+
* - Display unit: `in <unit>` (analytics queries only — C2 de-overloaded `in`)
|
|
139
156
|
* - Rollup period: `.rollup(<size><unit>)`
|
|
140
157
|
* - Group-by: `by {<dims>}`
|
|
141
|
-
* - Time window: `last <n><unit>`
|
|
142
|
-
*
|
|
158
|
+
* - Time window: `last <n><unit>` or `from <YYYY-MM-DD> [to <YYYY-MM-DD>]`
|
|
159
|
+
* (C1 — one window per query, every family)
|
|
143
160
|
*/
|
|
144
161
|
interface ParsedWqlRollupSuffix {
|
|
145
162
|
size: number;
|
|
146
163
|
unit: string;
|
|
147
164
|
raw: string;
|
|
148
165
|
}
|
|
149
|
-
|
|
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';
|
|
150
171
|
size: number;
|
|
151
172
|
unit: 'd' | 'w';
|
|
152
173
|
raw: string;
|
|
153
|
-
}
|
|
174
|
+
} | {
|
|
175
|
+
kind: 'range';
|
|
176
|
+
start: string;
|
|
177
|
+
end?: string;
|
|
178
|
+
raw: string;
|
|
179
|
+
};
|
|
154
180
|
interface ParsedWqlSuffixes {
|
|
155
181
|
/** Outer cross-store join clause text (`where ...`). */
|
|
156
182
|
where?: string;
|
|
@@ -160,10 +186,10 @@ interface ParsedWqlSuffixes {
|
|
|
160
186
|
rollup?: ParsedWqlRollupSuffix;
|
|
161
187
|
/** Group-by dimensions (`by {week, effort}`). */
|
|
162
188
|
groupBy?: string[];
|
|
163
|
-
/**
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
|
|
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;
|
|
167
193
|
/** Duplicate-clause diagnostics (C3) — each names both conflicting spans. */
|
|
168
194
|
conflicts?: string[];
|
|
169
195
|
/** Primary query text with suffixes removed. */
|
|
@@ -180,7 +206,8 @@ declare function splitAtWhere(text: string): {
|
|
|
180
206
|
/**
|
|
181
207
|
* Extract suffixes from a raw WQL query string.
|
|
182
208
|
* Strips outer join (`where`), display unit (`in kg`), rollup (`.rollup(1w)`),
|
|
183
|
-
* group-by (`by {week}`), time window (`last 8w`
|
|
209
|
+
* group-by (`by {week}`), time window (`last 8w` / `from … [to …]`), and
|
|
210
|
+
* legacy scope (`in journal`).
|
|
184
211
|
*/
|
|
185
212
|
declare function parseWqlSuffixes(raw: string): ParsedWqlSuffixes;
|
|
186
213
|
|
|
@@ -232,7 +259,6 @@ interface MetricPredicate {
|
|
|
232
259
|
interface FindPredicate {
|
|
233
260
|
target: string;
|
|
234
261
|
filters: TagFilter[];
|
|
235
|
-
scope?: string;
|
|
236
262
|
last?: {
|
|
237
263
|
size: number;
|
|
238
264
|
unit: 'd' | 'w';
|
|
@@ -255,30 +281,46 @@ interface ParsedAggregateQuery {
|
|
|
255
281
|
size: number;
|
|
256
282
|
unit: 'd' | 'w';
|
|
257
283
|
};
|
|
284
|
+
/** Time-selection window (C1): `last 6w` or `from … [to …]`. */
|
|
285
|
+
window?: QueryWindow;
|
|
258
286
|
/** Optional display unit directive — `in kg` / `in lb`. */
|
|
259
287
|
displayUnit?: string;
|
|
260
288
|
/** Cross-store content join (`where find:note{...}`); restricts to raw logs. */
|
|
261
289
|
join?: FindPredicate;
|
|
290
|
+
/** Deprecation advisories (C2 normalizer). */
|
|
291
|
+
advisories?: string[];
|
|
262
292
|
error?: string;
|
|
263
293
|
}
|
|
264
294
|
/** Result of parsing a content-discovery query (`find:target{filters} in scope`). */
|
|
265
295
|
interface ParsedFindQuery {
|
|
266
296
|
family: 'find';
|
|
267
297
|
raw: string;
|
|
268
|
-
/** Content target
|
|
298
|
+
/** Content target — a WQL_FIND_TARGETS value (C7 closed enum). */
|
|
269
299
|
target: string;
|
|
270
300
|
filters: TagFilter[];
|
|
271
|
-
/**
|
|
272
|
-
|
|
273
|
-
/** Time window: last 8w, last 4d. */
|
|
274
|
-
last?: {
|
|
275
|
-
size: number;
|
|
276
|
-
unit: 'd' | 'w';
|
|
277
|
-
};
|
|
301
|
+
/** Time-selection window (C1): `last 8w` or `from … [to …]`. */
|
|
302
|
+
window?: QueryWindow;
|
|
278
303
|
/** Cross-store metric join (`where sum:totalVolume{} > 5000`). */
|
|
279
304
|
join?: MetricPredicate;
|
|
305
|
+
/** Deprecation advisories (C2 normalizer). */
|
|
306
|
+
advisories?: string[];
|
|
280
307
|
error?: string;
|
|
281
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
|
+
};
|
|
282
324
|
type AnyParsedQuery = ParsedAggregateQuery | ParsedFindQuery | ParsedRowsQuery;
|
|
283
325
|
/** Type guard: true for content-discovery queries. */
|
|
284
326
|
declare function isFindQuery(parsed: AnyParsedQuery): parsed is ParsedFindQuery;
|
|
@@ -303,11 +345,11 @@ interface ParsedRowsQuery {
|
|
|
303
345
|
/** Output-statement type narrowing from the optional target (`rows:segment{…}`); undefined = all types. */
|
|
304
346
|
outputType?: string;
|
|
305
347
|
filters: TagFilter[];
|
|
306
|
-
/** Time window
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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[];
|
|
311
353
|
error?: string;
|
|
312
354
|
}
|
|
313
355
|
interface Series {
|
|
@@ -323,6 +365,16 @@ interface Series {
|
|
|
323
365
|
* `rows` to the rows path, everything else to analytics.
|
|
324
366
|
*/
|
|
325
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
|
+
};
|
|
326
378
|
|
|
327
379
|
/**
|
|
328
380
|
* Canonical discipline vocabulary — the single source of truth for effort
|
|
@@ -681,9 +733,10 @@ declare class QueryService {
|
|
|
681
733
|
getFactsByTimeRange(start: number, end: number): Promise<AnalyticsDataPoint[]>;
|
|
682
734
|
runQuery(raw: string, options?: QueryOptions): Promise<QueryResult>;
|
|
683
735
|
/**
|
|
684
|
-
* Execute a rows query (rows
|
|
685
|
-
*
|
|
686
|
-
*
|
|
736
|
+
* Execute a rows query (rows:<target>{…}, #949/C4) — the session results
|
|
737
|
+
* table plane. Filter rules are validated at parse; this executes only.
|
|
738
|
+
* Reads event rows directly over the unified store: outputType narrowing
|
|
739
|
+
* hits the promoted column; content-plane targets scope by content.
|
|
687
740
|
*/
|
|
688
741
|
runRows(parsed: ParsedRowsQuery, options?: {
|
|
689
742
|
anchorNow?: number;
|
|
@@ -956,13 +1009,13 @@ declare function parseFrontmatterProps(lines: string[]): Record<string, string>;
|
|
|
956
1009
|
* Auto-generated build version metadata.
|
|
957
1010
|
* Do not edit directly; updated by scripts/stamp-version.ts
|
|
958
1011
|
*/
|
|
959
|
-
declare const VERSION = "0.
|
|
960
|
-
declare const GIT_SHA = "
|
|
961
|
-
declare const BUILD_TIME = "2026-08-
|
|
1012
|
+
declare const VERSION = "0.9.40";
|
|
1013
|
+
declare const GIT_SHA = "2462ec9";
|
|
1014
|
+
declare const BUILD_TIME = "2026-08-26T01:04:47.412Z";
|
|
962
1015
|
declare const SEMVER: {
|
|
963
|
-
readonly version: "0.
|
|
964
|
-
readonly gitSha: "
|
|
965
|
-
readonly buildTime: "2026-08-
|
|
1016
|
+
readonly version: "0.9.40";
|
|
1017
|
+
readonly gitSha: "2462ec9";
|
|
1018
|
+
readonly buildTime: "2026-08-26T01:04:47.412Z";
|
|
966
1019
|
};
|
|
967
1020
|
|
|
968
|
-
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
|
|
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 };
|