@bitcobblers/wod-wiki-wql 0.8.39 → 0.10.41
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 +346 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -33
- package/dist/index.d.ts +98 -33
- package/dist/index.mjs +344 -92
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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
|
-
/**
|
|
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
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
|
-
*
|
|
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
|
-
|
|
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
|
-
/**
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
|
|
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`
|
|
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
|
-
/**
|
|
289
|
-
|
|
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
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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,46 @@ 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
|
+
};
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* WQL serializer (C6 — one structured interface for code).
|
|
381
|
+
*
|
|
382
|
+
* The total serializer over the C5 discriminated query union: code holds the
|
|
383
|
+
* AST; strings live only at document edges (URL `?q=`, ```query``` fences,
|
|
384
|
+
* dashboard bodies). Properties (proven by tests/serialize.test.ts):
|
|
385
|
+
*
|
|
386
|
+
* 1. `serialize(parse(x)) === x` for canonical inputs (fixed-point text), and
|
|
387
|
+
* 2. `parse(serialize(a))` is structurally equal to `a` for every AST —
|
|
388
|
+
* equal on all query-structure fields; `raw` (provenance text) and
|
|
389
|
+
* `advisories` (parse-time deprecation notices) are intentionally not
|
|
390
|
+
* reproduced, since serialization emits modern canonical syntax.
|
|
391
|
+
*
|
|
392
|
+
* Errored ASTs serialize to their original `raw` text — a query that failed
|
|
393
|
+
* to parse has no well-defined structure to re-emit, and echoing the input
|
|
394
|
+
* keeps the function total.
|
|
395
|
+
*
|
|
396
|
+
* Round-trip equality holds for text-surface-representable ASTs. Three value
|
|
397
|
+
* shapes the grammar cannot express (or parses away) sit outside that
|
|
398
|
+
* contract — documented here rather than silently corrupted:
|
|
399
|
+
* - a `"` inside a filter value: the quoted token has no escape form;
|
|
400
|
+
* - a quoted value with `wildcard: true`: the parser forces wildcard=false
|
|
401
|
+
* on quoted atoms (extractFilters), so the flag cannot survive;
|
|
402
|
+
* - thresholds whose String() is exponential (>= 1e21): outside the join
|
|
403
|
+
* comparison regex's plain-decimal domain.
|
|
404
|
+
*/
|
|
405
|
+
|
|
406
|
+
/** Serialize any parsed query to canonical WQL text. Total: never throws. */
|
|
407
|
+
declare function serialize(parsed: AnyParsedQuery): string;
|
|
343
408
|
|
|
344
409
|
/**
|
|
345
410
|
* Canonical discipline vocabulary — the single source of truth for effort
|
|
@@ -974,13 +1039,13 @@ declare function parseFrontmatterProps(lines: string[]): Record<string, string>;
|
|
|
974
1039
|
* Auto-generated build version metadata.
|
|
975
1040
|
* Do not edit directly; updated by scripts/stamp-version.ts
|
|
976
1041
|
*/
|
|
977
|
-
declare const VERSION = "0.
|
|
978
|
-
declare const GIT_SHA = "
|
|
979
|
-
declare const BUILD_TIME = "2026-08-
|
|
1042
|
+
declare const VERSION = "0.10.41";
|
|
1043
|
+
declare const GIT_SHA = "1b9b771";
|
|
1044
|
+
declare const BUILD_TIME = "2026-08-26T04:16:38.418Z";
|
|
980
1045
|
declare const SEMVER: {
|
|
981
|
-
readonly version: "0.
|
|
982
|
-
readonly gitSha: "
|
|
983
|
-
readonly buildTime: "2026-08-
|
|
1046
|
+
readonly version: "0.10.41";
|
|
1047
|
+
readonly gitSha: "1b9b771";
|
|
1048
|
+
readonly buildTime: "2026-08-26T04:16:38.418Z";
|
|
984
1049
|
};
|
|
985
1050
|
|
|
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
|
|
1051
|
+
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, serialize, 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
|
-
/**
|
|
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
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
|
-
*
|
|
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
|
-
|
|
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
|
-
/**
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
|
|
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`
|
|
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
|
-
/**
|
|
289
|
-
|
|
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
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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,46 @@ 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
|
+
};
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* WQL serializer (C6 — one structured interface for code).
|
|
381
|
+
*
|
|
382
|
+
* The total serializer over the C5 discriminated query union: code holds the
|
|
383
|
+
* AST; strings live only at document edges (URL `?q=`, ```query``` fences,
|
|
384
|
+
* dashboard bodies). Properties (proven by tests/serialize.test.ts):
|
|
385
|
+
*
|
|
386
|
+
* 1. `serialize(parse(x)) === x` for canonical inputs (fixed-point text), and
|
|
387
|
+
* 2. `parse(serialize(a))` is structurally equal to `a` for every AST —
|
|
388
|
+
* equal on all query-structure fields; `raw` (provenance text) and
|
|
389
|
+
* `advisories` (parse-time deprecation notices) are intentionally not
|
|
390
|
+
* reproduced, since serialization emits modern canonical syntax.
|
|
391
|
+
*
|
|
392
|
+
* Errored ASTs serialize to their original `raw` text — a query that failed
|
|
393
|
+
* to parse has no well-defined structure to re-emit, and echoing the input
|
|
394
|
+
* keeps the function total.
|
|
395
|
+
*
|
|
396
|
+
* Round-trip equality holds for text-surface-representable ASTs. Three value
|
|
397
|
+
* shapes the grammar cannot express (or parses away) sit outside that
|
|
398
|
+
* contract — documented here rather than silently corrupted:
|
|
399
|
+
* - a `"` inside a filter value: the quoted token has no escape form;
|
|
400
|
+
* - a quoted value with `wildcard: true`: the parser forces wildcard=false
|
|
401
|
+
* on quoted atoms (extractFilters), so the flag cannot survive;
|
|
402
|
+
* - thresholds whose String() is exponential (>= 1e21): outside the join
|
|
403
|
+
* comparison regex's plain-decimal domain.
|
|
404
|
+
*/
|
|
405
|
+
|
|
406
|
+
/** Serialize any parsed query to canonical WQL text. Total: never throws. */
|
|
407
|
+
declare function serialize(parsed: AnyParsedQuery): string;
|
|
343
408
|
|
|
344
409
|
/**
|
|
345
410
|
* Canonical discipline vocabulary — the single source of truth for effort
|
|
@@ -974,13 +1039,13 @@ declare function parseFrontmatterProps(lines: string[]): Record<string, string>;
|
|
|
974
1039
|
* Auto-generated build version metadata.
|
|
975
1040
|
* Do not edit directly; updated by scripts/stamp-version.ts
|
|
976
1041
|
*/
|
|
977
|
-
declare const VERSION = "0.
|
|
978
|
-
declare const GIT_SHA = "
|
|
979
|
-
declare const BUILD_TIME = "2026-08-
|
|
1042
|
+
declare const VERSION = "0.10.41";
|
|
1043
|
+
declare const GIT_SHA = "1b9b771";
|
|
1044
|
+
declare const BUILD_TIME = "2026-08-26T04:16:38.418Z";
|
|
980
1045
|
declare const SEMVER: {
|
|
981
|
-
readonly version: "0.
|
|
982
|
-
readonly gitSha: "
|
|
983
|
-
readonly buildTime: "2026-08-
|
|
1046
|
+
readonly version: "0.10.41";
|
|
1047
|
+
readonly gitSha: "1b9b771";
|
|
1048
|
+
readonly buildTime: "2026-08-26T04:16:38.418Z";
|
|
984
1049
|
};
|
|
985
1050
|
|
|
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
|
|
1051
|
+
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, serialize, 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 };
|