@bitcobblers/wod-wiki-lang 0.45.2167 → 0.47.2169
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/{browserRuntimeNow-CnGciOM0.d.cts → browserRuntimeNow-CqyFh_Jd.d.cts} +175 -1
- package/dist/{browserRuntimeNow-CnGciOM0.d.ts → browserRuntimeNow-CqyFh_Jd.d.ts} +175 -1
- package/dist/index.cjs +6719 -6399
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +101 -208
- package/dist/index.d.ts +101 -208
- package/dist/index.mjs +6711 -6397
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IMetric, MetricContainer, MetricOrigin, MetricType, IDialect, ICodeStatement, DialectAnalysis, TagIndex, ParsedCodeStatement, TagMetricContribution, IOutputStatement, OutputStatementType, BlockKey, TagReferenceMetadata, ScriptBlock, FenceDialect, Segment, AnalyticsGroup, StoredOutputStatement, OutputStatement } from '@bitcobblers/wod-wiki-core';
|
|
2
2
|
export { ParseError } from '@bitcobblers/wod-wiki-core';
|
|
3
|
-
import { R as ReferenceIndex, a as ReferenceResolutionDefaults, W as WhiteboardScript, I as IEquipment, b as IEffort, c as IEffortResolver, d as IEffortRegistry, E as EffortResolverOptions, e as EffortResolutionOptions, f as ResolvedEffort, g as EffortRegistrySource, h as
|
|
4
|
-
export {
|
|
3
|
+
import { R as ReferenceIndex, a as ReferenceResolutionDefaults, W as WhiteboardScript, I as IEquipment, b as IEffort, c as IEffortResolver, d as IEffortRegistry, E as EffortResolverOptions, e as EffortResolutionOptions, f as ResolvedEffort, g as EffortRegistrySource, h as IEquipmentRegistry, i as EquipmentStorageAdapter, j as EffortStorageAdapter, k as IRuntimeActionable, l as IEventBus, m as IRuntimeStack, n as IRuntimeClock, o as IJitCompiler, p as INowProvider, q as RuntimeStackOptions, r as RuntimeError, A as AnalyticsContext, s as IEvent, t as IRuntimeAction, O as OutputListener, U as Unsubscribe, u as IAnalyticsEngine, v as IRuntimeBlock, w as IBehaviorContext, B as BehaviorEventType, x as BehaviorEventListener, S as SubscribeOptions, y as Unsubscribe$1, z as OutputOptions, M as MemoryTag, C as IMemoryLocation, D as IRuntimeBehavior, F as IBlockContext, G as MetricVisibility, H as BlockLifecycleOptions, J as CompletionDecision, T as TimeSpan, K as IRuntimeMemory, L as TypedMemoryReference, N as MemorySearchCriteria, P as IMemoryReference, Q as RuntimeStackLogger, V as StackObserver, X as StackSnapshot, Y as StackListener, Z as MemoryTypeEnum, _ as IAnchorValue, $ as SoundProfile, a0 as ButtonConfig, a1 as IEventHandler, a2 as HandlerScope, a3 as IScriptRuntime, a4 as TestableBlockConfig, a5 as IRuntimeOptions, a6 as ScriptRuntime, a7 as EventHandlerOptions, a8 as EventCallback, a9 as TimerState, aa as CalculationDefinition, ab as PropertyRuleInput, ac as IRealtimeProcessor, ad as ISummaryProcessor, ae as DimVector, af as CalcLine, ag as ExprNode, ah as CalcScope, ai as ILookupTable, aj as LookupRegistry, ak as ProjectionResult } from './browserRuntimeNow-CqyFh_Jd.js';
|
|
4
|
+
export { al as ABSENT, am as BinaryOp, an as ButtonVariant, ao as ButtonsState, ap as CalcEvalError, aq as CalcNode, ar as CalcOrigin, as as CalcVariant, at as ChildrenStatusState, au as CompletionState, av as DEFAULT_RESOLVER_OPTIONS, aw as DEFAULT_RUNTIME_OPTIONS, ax as DEFAULT_SOUND_PROFILE, ay as DIM_COUNT, az as DIM_ENERGY, aA as DIM_LENGTH, aB as DIM_MASS, aC as DIM_TIME, aD as DIM_ZERO, aE as DISCIPLINE_FACTORS, aF as DisplayState, aG as EFFORT_DISCIPLINES, aH as EFFORT_REGISTRY_ORIGINS, aI as EffortBaseAttributes, aJ as EffortDerivation, aK as EffortDiscipline, aL as EffortMaterializer, aM as EffortResolvedFrom, aN as EvalContext, aO as FenceDialect, aP as FragmentDisplayState, aQ as FragmentState, aR as IAnalyticsProcessorDescriptor, aS as INTENSITY_TIERS, aT as IScript, aU as IntensityTier, aV as InterceptMode, aW as LookupFieldDef, aX as LookupLayer, aY as MemoryLocation, aZ as MemoryType, a_ as MemoryTypeMap, a$ as MemoryValueOf, b0 as NAMED_COMPOUNDS, b1 as PropertySourceLayer, b2 as ReferenceCatalog, b3 as ResolvedReferences, b4 as RoundState, b5 as RuntimeState, b6 as SEED_PRECEDENCE_RANK, b7 as ScriptRuntimeDependencies, b8 as SeedPrecedenceTier, b9 as ShakeOutQueueOptions, ba as ShakeOutResult, bb as SkippedDependencyDiagnostic, bc as SoundRule, bd as SoundTriggerAnchor, be as SoundTriggerPoint, bf as StackEvent, bg as TimerDirection, bh as VISIBILITY_ICONS, bi as VISIBILITY_LABELS, bj as Val, bk as addDim, bl as compilePropertySummaryCalcs, bm as compoundName, bn as createBrowserRuntimeNow, bo as createReferenceIndex, bp as dedupeEntitiesByPrecedence, bq as dimEquals, br as disciplineFactorFor, bs as evaluate, bt as extractPropertyRulesFromMeta, bu as extractStatementRefs, bv as extractTagPropertyRules, bw as filterTagsByVisibility, bx as formatDim, by as formatSoundTrigger, bz as frozenNow, bA as getMetricVisibility, bB as getRuntimeNowMs, bC as isDimensionless, bD as isEffortDiscipline, bE as isFragmentTag, bF as num, bG as parseSoundTrigger, bH as resolveEntityRank, bI as resolveEntityTier, bJ as resolveProfileRules, bK as resolveSourceRank, bL as resolveSourceTier, bM as runMetricShakeOutQueue, bN as slugifyRefLabel, bO as str, bP as subDim, bQ as truthy, bR as wallClockNow } from './browserRuntimeNow-CqyFh_Jd.js';
|
|
5
5
|
import { Tree } from '@lezer/common';
|
|
6
6
|
import { LanguageSupport, LRLanguage } from '@codemirror/language';
|
|
7
7
|
import { CompletionSource, Completion } from '@codemirror/autocomplete';
|
|
@@ -966,6 +966,34 @@ declare function documentToEquipment(doc: string, baseEquipment?: IEquipment): E
|
|
|
966
966
|
* sourceId/sourcePath) are never serialized as YAML.
|
|
967
967
|
*/
|
|
968
968
|
declare function equipmentToDocument(equipment: IEquipment): string;
|
|
969
|
+
interface TagPropertyDocument {
|
|
970
|
+
id: string;
|
|
971
|
+
slug: string;
|
|
972
|
+
label: string;
|
|
973
|
+
category: string;
|
|
974
|
+
aliases: string[];
|
|
975
|
+
metrics: Record<string, string | number | readonly string[]>;
|
|
976
|
+
summaries: Record<string, string>;
|
|
977
|
+
tags: string[];
|
|
978
|
+
functions: string[];
|
|
979
|
+
body?: string;
|
|
980
|
+
}
|
|
981
|
+
interface TagParseResult {
|
|
982
|
+
tag: TagPropertyDocument;
|
|
983
|
+
errors: string[];
|
|
984
|
+
}
|
|
985
|
+
declare function documentToTag(doc: string, defaultCategory?: string): TagParseResult;
|
|
986
|
+
declare function tagToDocument(tag: TagPropertyDocument): string;
|
|
987
|
+
interface TagCategoryPropertyDocument {
|
|
988
|
+
id?: string;
|
|
989
|
+
name: string;
|
|
990
|
+
label: string;
|
|
991
|
+
color?: string;
|
|
992
|
+
metrics?: Record<string, string | number>;
|
|
993
|
+
summaries?: Record<string, string>;
|
|
994
|
+
body?: string;
|
|
995
|
+
}
|
|
996
|
+
declare function tagCategoryToDocument(category: TagCategoryPropertyDocument): string;
|
|
969
997
|
|
|
970
998
|
/**
|
|
971
999
|
* Effort Resolver — Analytics Boundary
|
|
@@ -1025,46 +1053,60 @@ declare class InMemoryEffortRegistry implements IEffortRegistry {
|
|
|
1025
1053
|
delete(slug: string): Promise<void>;
|
|
1026
1054
|
}
|
|
1027
1055
|
|
|
1056
|
+
interface PropertyEntity {
|
|
1057
|
+
id: string;
|
|
1058
|
+
slug: string;
|
|
1059
|
+
label: string;
|
|
1060
|
+
aliases: string[];
|
|
1061
|
+
registrySource: 'bundled' | 'user' | 'synthetic-unresolved';
|
|
1062
|
+
sourceId?: string;
|
|
1063
|
+
}
|
|
1064
|
+
interface PropertyStorageAdapter<T extends PropertyEntity> {
|
|
1065
|
+
load(): Promise<T[]>;
|
|
1066
|
+
save(entity: T): Promise<void>;
|
|
1067
|
+
delete(slug: string): Promise<void>;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Generic two-tier Property Note registry (bundled seed tier + user custom tier).
|
|
1071
|
+
* User definitions layer over bundled definitions of the same slug; lookups
|
|
1072
|
+
* run in O(1) by slug and normalized alias.
|
|
1073
|
+
*/
|
|
1074
|
+
declare class CompositePropertyRegistry<T extends PropertyEntity> {
|
|
1075
|
+
protected readonly userItems: Map<string, T>;
|
|
1076
|
+
protected readonly bundledItems: Map<string, T>;
|
|
1077
|
+
protected initialized: boolean;
|
|
1078
|
+
protected readonly initialBundled?: Iterable<T>;
|
|
1079
|
+
protected readonly storage?: PropertyStorageAdapter<T>;
|
|
1080
|
+
constructor(options?: {
|
|
1081
|
+
bundled?: Iterable<T>;
|
|
1082
|
+
storage?: PropertyStorageAdapter<T>;
|
|
1083
|
+
});
|
|
1084
|
+
loadBundled(customBundled?: Iterable<T>): Promise<void>;
|
|
1085
|
+
isInitialized(): boolean;
|
|
1086
|
+
resolve(slug: string): T | null;
|
|
1087
|
+
resolveByAlias(label: string): T | null;
|
|
1088
|
+
list(): readonly T[];
|
|
1089
|
+
listByOrigin(origin: 'bundled' | 'user'): readonly T[];
|
|
1090
|
+
upsert(item: T): Promise<void>;
|
|
1091
|
+
delete(slug: string): Promise<void>;
|
|
1092
|
+
}
|
|
1093
|
+
declare class CompositeEquipmentRegistry extends CompositePropertyRegistry<IEquipment> implements IEquipmentRegistry {
|
|
1094
|
+
constructor(options?: {
|
|
1095
|
+
storage?: EquipmentStorageAdapter;
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1028
1099
|
interface CompositeEffortRegistryOptions {
|
|
1029
1100
|
/** Custom bundled efforts to seed the read-only tier (defaults to built-in bundled efforts). */
|
|
1030
1101
|
bundled?: Iterable<IEffort>;
|
|
1031
1102
|
/** Optional persistence adapter for user-defined efforts. */
|
|
1032
1103
|
storage?: EffortStorageAdapter;
|
|
1033
1104
|
}
|
|
1034
|
-
|
|
1035
|
-
* Composite Effort Registry — Two-Tier Lookup
|
|
1036
|
-
*
|
|
1037
|
-
* 1. User tier: loaded from storage adapter into memory
|
|
1038
|
-
* 2. Bundled tier: shipped as read-only seed
|
|
1039
|
-
*
|
|
1040
|
-
* Lookup order: user wins over bundled.
|
|
1041
|
-
* All lookups are O(1) in-memory after initialization.
|
|
1042
|
-
*/
|
|
1043
|
-
declare class CompositeEffortRegistry implements IEffortRegistry {
|
|
1044
|
-
private readonly userEfforts;
|
|
1045
|
-
private readonly bundledEfforts;
|
|
1046
|
-
private initialized;
|
|
1047
|
-
private readonly initialBundled?;
|
|
1048
|
-
private readonly storage?;
|
|
1105
|
+
declare class CompositeEffortRegistry extends CompositePropertyRegistry<IEffort> implements IEffortRegistry {
|
|
1049
1106
|
constructor(options?: CompositeEffortRegistryOptions);
|
|
1050
|
-
/**
|
|
1051
|
-
* Initialize the registry:
|
|
1052
|
-
* 1. Load bundled efforts into memory
|
|
1053
|
-
* 2. Load user efforts from storage adapter into memory
|
|
1054
|
-
*
|
|
1055
|
-
* An explicit `customBundled` REPLACES the bundled tier — passing an empty
|
|
1056
|
-
* set clears it — so a seed source removal never leaves stale bundled
|
|
1057
|
-
* efforts cached. The no-argument call keeps the constructor/default set.
|
|
1058
|
-
* Both tiers rebuild only AFTER a successful adapter load: a failed load
|
|
1059
|
-
* propagates (readiness must never report over stale data), and deleted
|
|
1060
|
-
* custom rows disappear because the user map is cleared too.
|
|
1061
|
-
*/
|
|
1062
1107
|
loadBundled(customBundled?: Iterable<IEffort>): Promise<void>;
|
|
1063
1108
|
/** True after loadBundled() has resolved */
|
|
1064
1109
|
isInitialized(): boolean;
|
|
1065
|
-
resolve(slug: string): IEffort | null;
|
|
1066
|
-
resolveByAlias(label: string): IEffort | null;
|
|
1067
|
-
list(): readonly IEffort[];
|
|
1068
1110
|
listByOrigin(origin: EffortRegistrySource): readonly IEffort[];
|
|
1069
1111
|
upsert(effort: IEffort): Promise<void>;
|
|
1070
1112
|
delete(slug: string): Promise<void>;
|
|
@@ -1203,7 +1245,9 @@ declare function tagMarkerSlug(type: string): string | undefined;
|
|
|
1203
1245
|
*/
|
|
1204
1246
|
declare function tagMarkerSlugs(metrics: Iterable<IMetric>): string[];
|
|
1205
1247
|
/**
|
|
1206
|
-
* The
|
|
1248
|
+
* The static metrics a tag's metric contributions produce at parse time.
|
|
1249
|
+
* Dynamic equations and `summaries.*` definitions are evaluated by the
|
|
1250
|
+
* MetricShakeOutQueue and CalcEngine.
|
|
1207
1251
|
*/
|
|
1208
1252
|
declare function tagContributionMetrics(contributions: readonly TagMetricContribution[], origin?: MetricOrigin): IMetric[];
|
|
1209
1253
|
|
|
@@ -4532,7 +4576,7 @@ interface AnalyticsProfileContext {
|
|
|
4532
4576
|
* User-authored composed calcs (#880), registered after the built-ins so
|
|
4533
4577
|
* they override same-id built-ins and evaluate at high priority.
|
|
4534
4578
|
*/
|
|
4535
|
-
calcs?: CalculationDefinition
|
|
4579
|
+
calcs?: CalculationDefinition[];
|
|
4536
4580
|
/**
|
|
4537
4581
|
* The tag catalogue — the tags a script can reference and the functions
|
|
4538
4582
|
* they carry. A function a tag carries runs where that tag applies.
|
|
@@ -4543,6 +4587,8 @@ interface AnalyticsProfileContext {
|
|
|
4543
4587
|
* profile applies.
|
|
4544
4588
|
*/
|
|
4545
4589
|
activeTags?: readonly string[];
|
|
4590
|
+
/** Property Note metric/summary rules active for this run or block. */
|
|
4591
|
+
propertySources?: readonly PropertyRuleInput[];
|
|
4546
4592
|
}
|
|
4547
4593
|
/**
|
|
4548
4594
|
* Profile that assembles the realtime and summary processor lists
|
|
@@ -4711,7 +4757,7 @@ interface CreateAnalyticsEngineOptions {
|
|
|
4711
4757
|
vo2max?: number;
|
|
4712
4758
|
};
|
|
4713
4759
|
/** User-authored composed calcs (#880), registered after the built-ins. */
|
|
4714
|
-
calcs?: CalculationDefinition
|
|
4760
|
+
calcs?: CalculationDefinition[];
|
|
4715
4761
|
/**
|
|
4716
4762
|
* The tag catalogue — the tags a script can reference and the functions
|
|
4717
4763
|
* they carry.
|
|
@@ -4719,6 +4765,8 @@ interface CreateAnalyticsEngineOptions {
|
|
|
4719
4765
|
tags?: TagIndex;
|
|
4720
4766
|
/** Tags active for the whole run, whatever the segments say. */
|
|
4721
4767
|
activeTags?: readonly string[];
|
|
4768
|
+
/** Property Note metric/summary rules active for this run or block. */
|
|
4769
|
+
propertySources?: readonly PropertyRuleInput[];
|
|
4722
4770
|
}
|
|
4723
4771
|
/**
|
|
4724
4772
|
* Creates a fully-configured AnalyticsEngine for a workout block.
|
|
@@ -4801,64 +4849,6 @@ declare function resolveDominantOrigin(origins: MetricOrigin[]): MetricOrigin;
|
|
|
4801
4849
|
*/
|
|
4802
4850
|
declare function extractMetrics(outputs: IOutputStatement[]): IMetric[];
|
|
4803
4851
|
|
|
4804
|
-
interface CalculationDefinition {
|
|
4805
|
-
readonly target: string;
|
|
4806
|
-
readonly expression: string;
|
|
4807
|
-
readonly raw: string;
|
|
4808
|
-
readonly line: number;
|
|
4809
|
-
readonly ast: ExpressionNode;
|
|
4810
|
-
readonly sources: string[];
|
|
4811
|
-
}
|
|
4812
|
-
interface CalculateBlockParseError {
|
|
4813
|
-
readonly line: number;
|
|
4814
|
-
readonly raw: string;
|
|
4815
|
-
readonly message: string;
|
|
4816
|
-
}
|
|
4817
|
-
interface CalculateBlockParseResult {
|
|
4818
|
-
readonly definitions: CalculationDefinition[];
|
|
4819
|
-
readonly errors: CalculateBlockParseError[];
|
|
4820
|
-
}
|
|
4821
|
-
type ExpressionNode = NumberNode | IdentifierNode | UnaryNode | BinaryNode | CallNode;
|
|
4822
|
-
interface NumberNode {
|
|
4823
|
-
readonly kind: 'number';
|
|
4824
|
-
readonly value: number;
|
|
4825
|
-
}
|
|
4826
|
-
interface IdentifierNode {
|
|
4827
|
-
readonly kind: 'identifier';
|
|
4828
|
-
readonly name: string;
|
|
4829
|
-
}
|
|
4830
|
-
interface UnaryNode {
|
|
4831
|
-
readonly kind: 'unary';
|
|
4832
|
-
readonly operator: '+' | '-';
|
|
4833
|
-
readonly argument: ExpressionNode;
|
|
4834
|
-
}
|
|
4835
|
-
interface BinaryNode {
|
|
4836
|
-
readonly kind: 'binary';
|
|
4837
|
-
readonly operator: '+' | '-' | '*' | '/' | '^';
|
|
4838
|
-
readonly left: ExpressionNode;
|
|
4839
|
-
readonly right: ExpressionNode;
|
|
4840
|
-
}
|
|
4841
|
-
interface CallNode {
|
|
4842
|
-
readonly kind: 'call';
|
|
4843
|
-
readonly name: string;
|
|
4844
|
-
readonly args: ExpressionNode[];
|
|
4845
|
-
}
|
|
4846
|
-
declare class CalculateBlockProcessor implements ISummaryProcessor {
|
|
4847
|
-
private readonly definitions;
|
|
4848
|
-
readonly id = "calculate-block";
|
|
4849
|
-
readonly name = "CalculateBlockProcessor";
|
|
4850
|
-
constructor(definitions: readonly CalculationDefinition[]);
|
|
4851
|
-
summarize(outputs: IOutputStatement[]): ProjectionResult[];
|
|
4852
|
-
}
|
|
4853
|
-
/**
|
|
4854
|
-
* Parse a `calculate` block into assignment definitions.
|
|
4855
|
-
*/
|
|
4856
|
-
declare function parseCalculateBlock(content: string): CalculateBlockParseResult;
|
|
4857
|
-
/**
|
|
4858
|
-
* Evaluate calculate definitions against runtime output statements.
|
|
4859
|
-
*/
|
|
4860
|
-
declare function evaluateCalculateDefinitions(definitions: readonly CalculationDefinition[], outputs: readonly IOutputStatement[]): ProjectionResult[];
|
|
4861
|
-
|
|
4862
4852
|
/**
|
|
4863
4853
|
* Unit registry for the composed calculations layer.
|
|
4864
4854
|
*
|
|
@@ -4899,40 +4889,6 @@ declare function composeMulUnit(a: string | undefined, aDim: DimVector, b: strin
|
|
|
4899
4889
|
/** Compose units through `/` (`m` ÷ `s` → `m/s`). */
|
|
4900
4890
|
declare function composeDivUnit(a: string | undefined, b: string | undefined, bDim: DimVector, resultDim: DimVector): string | undefined;
|
|
4901
4891
|
|
|
4902
|
-
/**
|
|
4903
|
-
* Dimension-aware value model for calc evaluation.
|
|
4904
|
-
*
|
|
4905
|
-
* Numbers carry a dimension vector and (optionally) the unit they were
|
|
4906
|
-
* measured in; arithmetic tracks vectors per spec §5.1. `absent` is the
|
|
4907
|
-
* missing-data value: it propagates through arithmetic, reads as `false` in
|
|
4908
|
-
* predicates (applicability decision, #848), and is what `has()` probes.
|
|
4909
|
-
*/
|
|
4910
|
-
|
|
4911
|
-
type Val = {
|
|
4912
|
-
kind: 'number';
|
|
4913
|
-
value: number;
|
|
4914
|
-
dim: DimVector;
|
|
4915
|
-
unit?: string;
|
|
4916
|
-
} | {
|
|
4917
|
-
kind: 'string';
|
|
4918
|
-
value: string;
|
|
4919
|
-
} | {
|
|
4920
|
-
kind: 'series';
|
|
4921
|
-
points: Map<number, number>;
|
|
4922
|
-
dim: DimVector;
|
|
4923
|
-
unit?: string;
|
|
4924
|
-
} | {
|
|
4925
|
-
kind: 'period';
|
|
4926
|
-
days: number;
|
|
4927
|
-
} | {
|
|
4928
|
-
kind: 'absent';
|
|
4929
|
-
};
|
|
4930
|
-
declare const ABSENT: Val;
|
|
4931
|
-
declare function num(value: number, dim?: DimVector, unit?: string): Val;
|
|
4932
|
-
declare function str(value: string): Val;
|
|
4933
|
-
/** Predicate truthiness: absent → false; numbers → ≠ 0; strings → non-empty. */
|
|
4934
|
-
declare function truthy(v: Val): boolean;
|
|
4935
|
-
|
|
4936
4892
|
/**
|
|
4937
4893
|
* Hand-rolled parser for the calc expression language.
|
|
4938
4894
|
*
|
|
@@ -4982,7 +4938,7 @@ interface LineFormScope {
|
|
|
4982
4938
|
fences?: string[];
|
|
4983
4939
|
}
|
|
4984
4940
|
interface CompiledLineForm {
|
|
4985
|
-
defs: CalculationDefinition
|
|
4941
|
+
defs: CalculationDefinition[];
|
|
4986
4942
|
warnings: string[];
|
|
4987
4943
|
}
|
|
4988
4944
|
/**
|
|
@@ -5002,37 +4958,8 @@ declare function compileLineForm(src: string, defaultScope?: LineFormScope): Com
|
|
|
5002
4958
|
* origins, units, output clauses, intermediate nodes).
|
|
5003
4959
|
*/
|
|
5004
4960
|
/** First output node id (output.nodeId may be a single id or an array). */
|
|
5005
|
-
declare function outputNodeId(def: CalculationDefinition
|
|
5006
|
-
declare function printCalculation(def: CalculationDefinition
|
|
5007
|
-
|
|
5008
|
-
/**
|
|
5009
|
-
* Expression evaluator for the composed calculations layer.
|
|
5010
|
-
*
|
|
5011
|
-
* The core owns arithmetic, comparison/logic, and the scalar function table
|
|
5012
|
-
* (min, max, abs, round, floor, ceil, clamp, convert, has). Everything
|
|
5013
|
-
* scope-dependent — metric refs, context nodes, stream aggregates, lookup(),
|
|
5014
|
-
* WQL atoms — resolves through the EvalContext, so the same evaluator serves
|
|
5015
|
-
* segment, workout, and store scopes (spec §3.1).
|
|
5016
|
-
*/
|
|
5017
|
-
|
|
5018
|
-
declare class CalcEvalError extends Error {
|
|
5019
|
-
constructor(message: string);
|
|
5020
|
-
}
|
|
5021
|
-
interface EvalContext {
|
|
5022
|
-
/** Resolve a ref atom (metric, context node, library node). ABSENT when missing. */
|
|
5023
|
-
resolveRef(name: string): Val;
|
|
5024
|
-
/**
|
|
5025
|
-
* Extension functions (stream aggregates, lookup). Receives evaluated args
|
|
5026
|
-
* plus the raw arg nodes (aggregates need the filter node unevaluated).
|
|
5027
|
-
* Return undefined to signal "not mine" → CalcEvalError.
|
|
5028
|
-
*/
|
|
5029
|
-
callFunction?(name: string, args: Val[], rawArgs: ExprNode[]): Val | undefined;
|
|
5030
|
-
/** Store-scope WQL selections (QueryService). Store scope only. */
|
|
5031
|
-
resolveWql?(node: Extract<ExprNode, {
|
|
5032
|
-
kind: 'wql';
|
|
5033
|
-
}>): Val;
|
|
5034
|
-
}
|
|
5035
|
-
declare function evaluate(node: ExprNode, ctx: EvalContext): Val;
|
|
4961
|
+
declare function outputNodeId(def: CalculationDefinition): string | undefined;
|
|
4962
|
+
declare function printCalculation(def: CalculationDefinition): string;
|
|
5036
4963
|
|
|
5037
4964
|
/**
|
|
5038
4965
|
* Static dimension checking, run at calc registration time (spec §5).
|
|
@@ -5072,46 +4999,6 @@ declare function validateOutputUnit(exprDim: DimVector, unit: string | undefined
|
|
|
5072
4999
|
/** Full registration-time check for one calc line. Returns the computed vector. */
|
|
5073
5000
|
declare function checkCalcLine(line: CalcLine, env: StaticEnv): DimVector;
|
|
5074
5001
|
|
|
5075
|
-
/**
|
|
5076
|
-
* Lookup table registry (spec §4).
|
|
5077
|
-
*
|
|
5078
|
-
* Tables are adapters over heterogeneous sources (effort resolver, static
|
|
5079
|
-
* maps, user profile) exposing a uniform single-row lookup contract:
|
|
5080
|
-
* `lookup("table", keyExpr, "field")`. Registration is layered —
|
|
5081
|
-
* bundled → dialect → user — with later layers replacing earlier ones
|
|
5082
|
-
* (mirrors the Dialect Stack's personal-overrides-last rule). Miss behavior
|
|
5083
|
-
* is per-table: `absent` yields the absent value; `default-row` yields a
|
|
5084
|
-
* synthetic row so calcs never see a miss.
|
|
5085
|
-
*/
|
|
5086
|
-
|
|
5087
|
-
interface LookupFieldDef {
|
|
5088
|
-
dimension: DimVector;
|
|
5089
|
-
type: 'number' | 'string';
|
|
5090
|
-
}
|
|
5091
|
-
interface ILookupTable {
|
|
5092
|
-
readonly id: string;
|
|
5093
|
-
readonly fields: Record<string, LookupFieldDef>;
|
|
5094
|
-
readonly missPolicy: 'absent' | 'default-row';
|
|
5095
|
-
/** Single-row lookup. `absent` tables return undefined on a miss. */
|
|
5096
|
-
get(key: string, field: string): Val | undefined;
|
|
5097
|
-
}
|
|
5098
|
-
type LookupLayer = 'bundled' | 'dialect' | 'user';
|
|
5099
|
-
declare class LookupRegistry {
|
|
5100
|
-
private readonly tables;
|
|
5101
|
-
/** Register a table; a later-or-equal layer replaces the existing entry. */
|
|
5102
|
-
register(table: ILookupTable, layer?: LookupLayer): void;
|
|
5103
|
-
get(tableId: string): ILookupTable | undefined;
|
|
5104
|
-
/** Field dimension for static checking; undefined when table/field unknown. */
|
|
5105
|
-
fieldDim(tableId: string, field: string): DimVector | undefined;
|
|
5106
|
-
/** Runtime lookup honoring the table's miss policy. */
|
|
5107
|
-
lookup(tableId: string, key: string, field: string): Val;
|
|
5108
|
-
/**
|
|
5109
|
-
* EvalContext `callFunction` implementation for `lookup("table", key, "field")`.
|
|
5110
|
-
* Compose with other extension functions (aggregates) at the engine layer.
|
|
5111
|
-
*/
|
|
5112
|
-
readonly callFunction: EvalContext['callFunction'];
|
|
5113
|
-
}
|
|
5114
|
-
|
|
5115
5002
|
/**
|
|
5116
5003
|
* Built-in lookup table adapters (spec §4.1).
|
|
5117
5004
|
*
|
|
@@ -5177,22 +5064,24 @@ declare class CalculationRegistry {
|
|
|
5177
5064
|
private readonly libraryDims;
|
|
5178
5065
|
constructor(lookups: LookupRegistry);
|
|
5179
5066
|
/** All registered calcs for a scope, registration order preserved. */
|
|
5180
|
-
byScope(scope: CalcScope): CalculationDefinition
|
|
5181
|
-
get(id: string): CalculationDefinition
|
|
5067
|
+
byScope(scope: CalcScope): CalculationDefinition[];
|
|
5068
|
+
get(id: string): CalculationDefinition | undefined;
|
|
5069
|
+
/** Register a custom statement-level metric dimension (e.g. from a Property Note). */
|
|
5070
|
+
registerAtom(name: string, dim?: DimVector): void;
|
|
5182
5071
|
/**
|
|
5183
5072
|
* Register a calculation. Compiles every node expression and predicate,
|
|
5184
5073
|
* runs static dimension checking, and (for library calcs) publishes node
|
|
5185
5074
|
* dimensions for dependent calcs. Throws CalcRegistrationError on any
|
|
5186
5075
|
* violation.
|
|
5187
5076
|
*/
|
|
5188
|
-
register(def: CalculationDefinition
|
|
5077
|
+
register(def: CalculationDefinition): void;
|
|
5189
5078
|
/** Parse + dimension-check every node and predicate in a variant. */
|
|
5190
5079
|
private compileVariant;
|
|
5191
5080
|
/** Static environment for a calc: siblings → library → stream → context. */
|
|
5192
5081
|
private staticEnv;
|
|
5193
5082
|
}
|
|
5194
5083
|
/** Output node ids as an array regardless of the single/multi form. */
|
|
5195
|
-
declare function outputNodeIds(def: CalculationDefinition
|
|
5084
|
+
declare function outputNodeIds(def: CalculationDefinition): string[];
|
|
5196
5085
|
|
|
5197
5086
|
/**
|
|
5198
5087
|
* Composed calculation engine — Phases 1 & 2 of the evaluation pipeline
|
|
@@ -5229,6 +5118,8 @@ interface CalcEngineDeps {
|
|
|
5229
5118
|
tags?: TagIndex;
|
|
5230
5119
|
/** Tags active for the whole run, whatever the segments say. */
|
|
5231
5120
|
activeTags?: readonly string[];
|
|
5121
|
+
/** Property Note metric/summary rules active for this run or block. */
|
|
5122
|
+
propertySources?: readonly PropertyRuleInput[];
|
|
5232
5123
|
}
|
|
5233
5124
|
declare class CalcEngine implements IRealtimeProcessor, ISummaryProcessor {
|
|
5234
5125
|
private readonly registry;
|
|
@@ -5305,8 +5196,8 @@ declare class CalcEngine implements IRealtimeProcessor, ISummaryProcessor {
|
|
|
5305
5196
|
|
|
5306
5197
|
/** Shared rest/pause exclusion filter constant (§10.6). */
|
|
5307
5198
|
declare const REST_EXCLUSION = "rest|pause|rest-*";
|
|
5308
|
-
declare const BUILTIN_CALCS: CalculationDefinition
|
|
5309
|
-
declare const STORE_CALCS: CalculationDefinition
|
|
5199
|
+
declare const BUILTIN_CALCS: CalculationDefinition[];
|
|
5200
|
+
declare const STORE_CALCS: CalculationDefinition[];
|
|
5310
5201
|
|
|
5311
5202
|
/**
|
|
5312
5203
|
* Factory for a fully-seeded composed calculation stack: lookup registry
|
|
@@ -5319,13 +5210,15 @@ interface CalcStackOptions {
|
|
|
5319
5210
|
effortResolver: IEffortResolver;
|
|
5320
5211
|
userProfile?: IProfileSource;
|
|
5321
5212
|
/** Extra/override calcs (dialect, user) registered after the built-ins. */
|
|
5322
|
-
calcs?: CalculationDefinition
|
|
5213
|
+
calcs?: CalculationDefinition[];
|
|
5323
5214
|
/**
|
|
5324
5215
|
* The tag catalogue. A function a tag carries runs where that tag applies.
|
|
5325
5216
|
*/
|
|
5326
5217
|
tags?: TagIndex;
|
|
5327
5218
|
/** Tags active for the whole run, whatever the segments say. */
|
|
5328
5219
|
activeTags?: readonly string[];
|
|
5220
|
+
/** Property Note metric/summary rules active for this run or block. */
|
|
5221
|
+
propertySources?: readonly PropertyRuleInput[];
|
|
5329
5222
|
}
|
|
5330
5223
|
interface CalcStack {
|
|
5331
5224
|
lookups: LookupRegistry;
|
|
@@ -5339,7 +5232,7 @@ interface CalcDiagnostic {
|
|
|
5339
5232
|
message: string;
|
|
5340
5233
|
}
|
|
5341
5234
|
interface CalcAnalysis {
|
|
5342
|
-
defs: CalculationDefinition
|
|
5235
|
+
defs: CalculationDefinition[];
|
|
5343
5236
|
diagnostics: CalcDiagnostic[];
|
|
5344
5237
|
dim: DimVector | undefined;
|
|
5345
5238
|
compound: string | undefined;
|
|
@@ -5473,4 +5366,4 @@ declare function diffStatement(expected: MetricLine[], actual: readonly IMetric[
|
|
|
5473
5366
|
*/
|
|
5474
5367
|
declare function compareStatement(expectations: MetricLine[], actual: readonly IMetric[], mode: MatchMode): string[];
|
|
5475
5368
|
|
|
5476
|
-
export {
|
|
5369
|
+
export { AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AbortSessionAction, type ActionDescriptor, type ActionPrimitive, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, type AnalyticsProfileContext, type AnalyticsResult, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BehaviorEventListener, BehaviorEventType, BlockBuilder, BlockContext, BlockLifecycleOptions, ButtonBehavior, ButtonConfig, COMPLETION_PROPERTY_KEYS, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, type CalcAnalysis, CalculationDefinition as CalcDefinition, type CalcDiagnostic, CalcEngine, type CalcEngineDeps, CalcLine, CalcParseError, CalcRegistrationError, CalcScope, type CalcStack, type CalcStackOptions, type UnitDef as CalcUnitDef, CalcUnitError, CalculationDefinition, CalculationRegistry, CardioDialect, ChildSelectionBehavior, type ChildSelectionConfig, type ChildSelectionLoopCondition, ChildrenStrategy, ChoiceGroupMetric, ClearChildrenAction, ClimbDialect, type ClimbGradeMetricValue, type ClimbGradeSystem, ClimbMetricType, CompileAndPushBlockAction, type CompiledLineForm, CompletionDecision, CompletionTimestampBehavior, type CompletionValueOption, type CompletionValueSource, CompositeEffortRegistry, type CompositeEffortRegistryOptions, CompositeEquipmentRegistry, CompositePropertyRegistry, type ControlsConfig, type CountdownMode, CountdownTimerBehavior, type CountdownTimerConfig, CountupTimerBehavior, type CountupTimerConfig, type CreateAnalyticsEngineOptions, type CreateAnalyticsEngineResult, CrossFitDialect, DAY, DEFAULT_UNRESOLVED_EFFORT_MET, type DayRollup, DialectStack, DimVector, type Dimension, type DurationPrimitive, EFFORT_DATA_METRIC_TYPE, EffortBlock, type EffortBlockConfig, EffortFallbackStrategy, type EffortPrimitive, EffortRegistrySource, EffortResolutionOptions, EffortResolver, EffortResolverOptions, EffortStorageAdapter, EmitEventAction, EmitSystemOutputAction, type EquipmentParseResult, EquipmentStorageAdapter, ErrorAction, EventBus, EventCallback, EventHandlerOptions, type EventHandlerRegistration, ExecutionContext, type ExecutionSnapshot, type ExecutionStatus, ExitBehavior, type ExitConfig, ExprNode, FixtureSyntaxError, type FuzzyCandidate, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, type HeadingPrimitive, IAnalyticsEngine, type IAnalyticsProfile, IAnchorValue, IBehaviorContext, IBlockContext, type ICastSubscription, IEffort, IEffortRegistry, IEffortResolver, IEquipment, IEquipmentRegistry, IEvent, IEventBus, IEventHandler, IJitCompiler, ILookupTable, IMemoryLocation, IMemoryReference, type IMetricPresentationPolicy, INowProvider, type IProfileSource, IRealtimeProcessor, IRuntimeAction, IRuntimeActionable, IRuntimeBehavior, IRuntimeBlock, type IRuntimeBlockStrategy, IRuntimeClock, type IRuntimeEventProvider, type IRuntimeFactory, IRuntimeMemory, IRuntimeStack, type IRuntimeSubscription, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, IntervalLogicStrategy, JitCompiler, LabelingBehavior, type LabelingConfig, type LapPrimitive, type LineFormScope, type LineLocator, type LiteralKind, LocalEventProvider, LocalRuntimeSubscription, type LogLevel, type LoggableOutput, LookupRegistry, MAX_TAG_CONTRIBUTION_DEPTH, type MatchMode, MdTimerRuntime, type MemoryEntry, MemoryTag, MemoryTypeEnum, type MetricLine, type MetricObjectPrimitive, type MetricPresentationSurface, type MetricPresentationToken, MetricPromotionBehavior, type MetricPromotionConfig, type MetricRenderKind, type MetricTone, MetricVisibility, type MockClock, NextAction, NextEvent, NextEventHandler, OutputEmitter, OutputListener, PRODUCTION_STRATEGIES, PROPERTY_KEY_TO_METRIC_TYPE, type ParseOptions, type ParseReferences, type ParseResult, type ParserConfig, PopBlockAction, ProjectionResult, type PromotionRule, type PropertyEntity, type PropertyPrimitive, PropertyRuleInput, type PropertyStorageAdapter, PushBlockAction, PushRestBlockAction, type QuantityPrimitive, REFERENCE_PAIR_KEYS, REST_EXCLUSION, RPE_LABELS, RUNTIME_LOG_SUBJECT_WIDTH, ReferenceIndex, ReferenceResolutionDefaults, RegisterEventHandlerAction, Registry, ReportOutputBehavior, type ReportOutputConfig, ReportOutputStrategy, ResolvedEffort, type ResolvedEffortData, type ResolvedTagContributions, RestBlock, type RestBlockConfig, type RoundSchemePrimitive, RoundsMetric, type RoundsPrimitive, RuntimeAdapter, RuntimeBlock, type RuntimeBlockOptions, RuntimeBuilder, type RuntimeButton, RuntimeClock, type RuntimeController, type RuntimeControls, RuntimeError, RuntimeFactory, type RuntimeLogEntry, RuntimeLogger, RuntimeMemory, type RuntimeMemoryLocation, RuntimeObservers, RuntimeStack, RuntimeStackOptions, SOUND_PLAY_EVENT, SOUND_PROFILE_METRIC, STANDARD_UNITS, STORE_CALCS, STREAM_ATOMS, STRUCTURAL_EFFORT_WORDS, ScriptRuntime, type SegmentWithMetadata, SessionRootBlock, type SessionRootConfig, SessionRootStrategy, SnapshotClock, SoundProfile, SoundProfileBehavior, type SoundProfileBehaviorConfig, SoundStrategy, type SourceInput, type SpanList, SpanTrackingBehavior, StackListener, StackObserver, StackSnapshot, StandardAnalyticsProfile, StartSessionAction, type StartSessionOptions, StartWorkoutAction, type StartWorkoutOptions, type StatementMetricDiff, type StaticEnv, type StreamAtomDef, SubscribeOptions, SubscriptionManager, type SyntaxFacts, type SyntaxMeta, type SyntaxPrimitive, type SyntaxStatement, TAG_MARKER_PREFIX, type TagCategoryPropertyDocument, type TagParseResult, type TagPropertyDocument, type TagRefPrimitive, TestableBlockConfig, type TextPrimitive, ThrowError, ThrowErrorAction, TimeSpan, TimerState, TwoPassEffortResolutionProcess, TypedMemoryReference, UNITS, type UnitDef$1 as UnitDef, type UnitMatch, UnitRegistry, UnitSet, UnitsDialect, UnregisterEventHandlerAction, Unsubscribe, UpdateNextPreviewAction, WaitingToStartBlock, WaitingToStartInjectorBehavior, WhiteboardScript, type WhiteboardScriptCompletionOptions, type WhiteboardScriptSnippet, WodDialect, YogaDialect, addAliasToEffort, applyTemplateDefaults, buildStaticLookups, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, checkCalcLine, classifyStatements, closeCurrentSpan, collapseUnresolvedChoices, commonFixtureSet, compareStatement, compileLineForm, composeDivUnit, composeMulUnit, computeColumnLabel, computeLabel, computeWorkloadRollups, convertScalar, createAnalyticsEngineForBlock, createCalcEngine, createCalcStack, createCompiler, createDialectStack, createDisciplinesTable, createEffortTable, createLineLocator, createPolicy as createMetricPresentationPolicy, createMockClock, createParser, createProfileTable, createRpeLabelsTable, dailySessionLoads, dayBucket, dialectRegistry, dialectStack, diffStatement, documentToEffort, documentToEquipment, documentToTag, effortToDocument, equipmentToDocument, extractEffortData, extractMetrics, extractStatements, extractStatementsRaw, extractSyntaxFacts, findBestFuzzyMatch, findTagContributionCycles, findUnresolvedChoices, fixtureBackSquat, fixtureBurpee, fixturePlank, fixtureRowing, fixtureRunning, fixtureUserCustom, fixtureUserOverride, formatDuration, formatRuntimeLogLine, formatRuntimeLogRule, formatRuntimeTimestamp, metricsToLabel as fragmentsToLabel, fullFixtureSet, fuseUnits, fuseUnitsInMetrics, getAnalyticsFromLogs, getAnalyticsFromRuntime, getHints, getUnit, hasHint, hintMetric, hintsToContainer, inferDim, isCastSubscription, isChoiceResolved, isTimeLikeMetric, isWithinThreshold, levenshteinDistance, metricPresentation, mutateTimerSpans, normalizeForFuzzy, openSpan, outputNodeId, outputNodeIds, padRuntimeLogEvent, padRuntimeLogSubject, parseCalcLine, parseEffortFile, parseEquipmentFile, parseExpression, parseMetricLine, parseScript, printCalculation, readNestedSection, readTimer, realtimeProcessorRegistry, renderMetric, resolveDominantOrigin, resolveSoundProfile, resolveTagContributions, snippetCompletions, startSpan, strategyRegistry, summaryProcessorRegistry, tagCategoryToDocument, tagContributionMetrics, tagMarkerSlug, tagMarkerSlugs, tagMarkerType, tagToDocument, toStoredOutputStatement, validateOutputUnit, parser as whiteboardParser, whiteboardScript, whiteboardScriptCompletion, whiteboardScriptCompletionSource, whiteboardScriptLanguage, whiteboardScriptSnippets, writeChoiceSelection };
|