solve-engine 2.1.0 → 2.3.0
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/{Configuration-B6W0-T67.d.cts → Configuration-Culg8H_o.d.cts} +17 -0
- package/dist/{Configuration-B6W0-T67.d.ts → Configuration-Culg8H_o.d.ts} +17 -0
- package/dist/{PackageCompatibility-Bn5jnBtA.d.cts → PackageCompatibility-CN-2CVhu.d.cts} +1 -1
- package/dist/{PackageCompatibility-CIvq2MP5.d.ts → PackageCompatibility-DbpyKYOe.d.ts} +1 -1
- package/dist/{PackageRegistry-dpdurBVO.d.cts → PackageRegistry-DXsvmpQN.d.cts} +33 -3
- package/dist/{PackageRegistry-DzeiWcv4.d.ts → PackageRegistry-jqdAsm6U.d.ts} +33 -3
- package/dist/{ScopeManager-C2LDOrDx.d.ts → ScopeManager-DkpnlKuz.d.ts} +1 -1
- package/dist/{ScopeManager-D7uMXbhS.d.cts → ScopeManager-t6SnP6Ce.d.cts} +1 -1
- package/dist/{VMCheckpoints-I9jg3jWR.d.cts → VMCheckpoints-C_jQvABf.d.cts} +2 -2
- package/dist/{VMCheckpoints-CGyFhivM.d.ts → VMCheckpoints-CsHmQVaD.d.ts} +2 -2
- package/dist/{chunk-7GK3XEZF.js → chunk-7E7NXKQ5.js} +2 -2
- package/dist/chunk-7E7NXKQ5.js.map +1 -0
- package/dist/chunk-AIIPKVKO.js +3 -0
- package/dist/chunk-AIIPKVKO.js.map +1 -0
- package/dist/chunk-BAVZMGTZ.cjs +2 -0
- package/dist/chunk-BAVZMGTZ.cjs.map +1 -0
- package/dist/chunk-ESXQDRP7.js +2 -0
- package/dist/chunk-ESXQDRP7.js.map +1 -0
- package/dist/chunk-JFREB45J.cjs +3 -0
- package/dist/chunk-JFREB45J.cjs.map +1 -0
- package/dist/chunk-L7ZQQ773.cjs +5 -0
- package/dist/chunk-L7ZQQ773.cjs.map +1 -0
- package/dist/{chunk-ZCNBT44X.cjs → chunk-LNZNJSRW.cjs} +2 -2
- package/dist/chunk-LNZNJSRW.cjs.map +1 -0
- package/dist/chunk-NNYMXK6H.js +5 -0
- package/dist/chunk-NNYMXK6H.js.map +1 -0
- package/dist/{chunk-JUIJ6NRD.cjs → chunk-PBGPQM3X.cjs} +3 -3
- package/dist/chunk-PBGPQM3X.cjs.map +1 -0
- package/dist/chunk-PXWOATTF.js +3 -0
- package/dist/chunk-PXWOATTF.js.map +1 -0
- package/dist/constants.cjs +1 -1
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/engine.cjs +1 -1
- package/dist/engine.d.cts +49 -6
- package/dist/engine.d.ts +49 -6
- package/dist/engine.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/language.d.cts +4 -4
- package/dist/language.d.ts +4 -4
- package/dist/packages.cjs +1 -1
- package/dist/packages.d.cts +12 -3
- package/dist/packages.d.ts +12 -3
- package/dist/packages.js +1 -1
- package/dist/resolvers.cjs +1 -1
- package/dist/resolvers.d.cts +14 -0
- package/dist/resolvers.d.ts +14 -0
- package/dist/resolvers.js +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.cts +4 -4
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +1 -1
- package/dist/vm.d.cts +3 -3
- package/dist/vm.d.ts +3 -3
- package/dist/worker.cjs +2 -2
- package/dist/worker.d.cts +3 -3
- package/dist/worker.d.ts +3 -3
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4E4YVQKK.js +0 -5
- package/dist/chunk-4E4YVQKK.js.map +0 -1
- package/dist/chunk-7GK3XEZF.js.map +0 -1
- package/dist/chunk-E2Q3PQ2G.js +0 -3
- package/dist/chunk-E2Q3PQ2G.js.map +0 -1
- package/dist/chunk-EVI6OHQH.cjs +0 -2
- package/dist/chunk-EVI6OHQH.cjs.map +0 -1
- package/dist/chunk-GK2OHWRF.cjs +0 -5
- package/dist/chunk-GK2OHWRF.cjs.map +0 -1
- package/dist/chunk-I52MYCVI.js +0 -3
- package/dist/chunk-I52MYCVI.js.map +0 -1
- package/dist/chunk-JUIJ6NRD.cjs.map +0 -1
- package/dist/chunk-OVKDDTXO.cjs +0 -3
- package/dist/chunk-OVKDDTXO.cjs.map +0 -1
- package/dist/chunk-U4AEVL5Z.js +0 -2
- package/dist/chunk-U4AEVL5Z.js.map +0 -1
- package/dist/chunk-ZCNBT44X.cjs.map +0 -1
|
@@ -171,6 +171,21 @@ interface DiagnosticConfig {
|
|
|
171
171
|
/** Enable VM trace mode, emits per-opcode execution events (very verbose; disables some optimizations) */
|
|
172
172
|
readonly vmTraceEnabled: boolean;
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Proactive background refresh of live async values.
|
|
176
|
+
*
|
|
177
|
+
* Off by default. When a live value (a stock quote, an FX rate) has gone
|
|
178
|
+
* stale, today it only refetches on the next re-evaluation (a keystroke), so a
|
|
179
|
+
* note left open silently ages. With this enabled, the engine drives a refetch
|
|
180
|
+
* on each such value's own cadence (the resolver's `refetchIntervalMs`) for the
|
|
181
|
+
* values currently on screen, and pushes the fresh result to the host through
|
|
182
|
+
* the same event stream the pull path uses. It needs timers and a live editor
|
|
183
|
+
* consuming that stream, so a headless or batch host leaves it off.
|
|
184
|
+
*/
|
|
185
|
+
interface BackgroundRefreshConfig {
|
|
186
|
+
/** Master switch. When false, no timers run and every value refreshes only on re-evaluation. */
|
|
187
|
+
readonly enabled: boolean;
|
|
188
|
+
}
|
|
174
189
|
/**
|
|
175
190
|
* Virtual Machine configuration.
|
|
176
191
|
* Controls the internal bytecode VM that executes compiled expressions.
|
|
@@ -283,6 +298,8 @@ interface EngineConfig {
|
|
|
283
298
|
readonly worker: WorkerConfig;
|
|
284
299
|
/** Diagnostic pipeline configuration */
|
|
285
300
|
readonly diagnostic: DiagnosticConfig;
|
|
301
|
+
/** Proactive background refresh of live async values */
|
|
302
|
+
readonly backgroundRefresh: BackgroundRefreshConfig;
|
|
286
303
|
}
|
|
287
304
|
/**
|
|
288
305
|
* A partial {@link EngineConfig} override, one section at a time.
|
|
@@ -171,6 +171,21 @@ interface DiagnosticConfig {
|
|
|
171
171
|
/** Enable VM trace mode, emits per-opcode execution events (very verbose; disables some optimizations) */
|
|
172
172
|
readonly vmTraceEnabled: boolean;
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Proactive background refresh of live async values.
|
|
176
|
+
*
|
|
177
|
+
* Off by default. When a live value (a stock quote, an FX rate) has gone
|
|
178
|
+
* stale, today it only refetches on the next re-evaluation (a keystroke), so a
|
|
179
|
+
* note left open silently ages. With this enabled, the engine drives a refetch
|
|
180
|
+
* on each such value's own cadence (the resolver's `refetchIntervalMs`) for the
|
|
181
|
+
* values currently on screen, and pushes the fresh result to the host through
|
|
182
|
+
* the same event stream the pull path uses. It needs timers and a live editor
|
|
183
|
+
* consuming that stream, so a headless or batch host leaves it off.
|
|
184
|
+
*/
|
|
185
|
+
interface BackgroundRefreshConfig {
|
|
186
|
+
/** Master switch. When false, no timers run and every value refreshes only on re-evaluation. */
|
|
187
|
+
readonly enabled: boolean;
|
|
188
|
+
}
|
|
174
189
|
/**
|
|
175
190
|
* Virtual Machine configuration.
|
|
176
191
|
* Controls the internal bytecode VM that executes compiled expressions.
|
|
@@ -283,6 +298,8 @@ interface EngineConfig {
|
|
|
283
298
|
readonly worker: WorkerConfig;
|
|
284
299
|
/** Diagnostic pipeline configuration */
|
|
285
300
|
readonly diagnostic: DiagnosticConfig;
|
|
301
|
+
/** Proactive background refresh of live async values */
|
|
302
|
+
readonly backgroundRefresh: BackgroundRefreshConfig;
|
|
286
303
|
}
|
|
287
304
|
/**
|
|
288
305
|
* A partial {@link EngineConfig} override, one section at a time.
|
|
@@ -3,13 +3,13 @@ import { V as Value, b as ValueType } from './Value-CCi_Eecs.cjs';
|
|
|
3
3
|
import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-B4C1qHXu.cjs';
|
|
4
4
|
import { IAsyncResolver } from './resolvers.cjs';
|
|
5
5
|
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-DnlL7_8c.cjs';
|
|
6
|
-
import {
|
|
6
|
+
import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, P as PluginFunctionHandler } from './ScopeManager-t6SnP6Ce.cjs';
|
|
7
7
|
import { a as BytecodeProgram } from './BytecodeBuilder-DGGeByAP.cjs';
|
|
8
8
|
import { QueryClient } from '@tanstack/query-core';
|
|
9
9
|
import { E as EngineError } from './EngineError-Ce1lPkjZ.cjs';
|
|
10
10
|
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-DCQicwWX.cjs';
|
|
11
11
|
import { T as Token } from './Token-CbP_OutD.cjs';
|
|
12
|
-
import { E as EngineConfigOverride, a as EngineConfig } from './Configuration-
|
|
12
|
+
import { E as EngineConfigOverride, a as EngineConfig } from './Configuration-Culg8H_o.cjs';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* One line's compiled bytecode, plus the variables it reads and writes.
|
|
@@ -1629,6 +1629,13 @@ declare class ExpressionEngine {
|
|
|
1629
1629
|
* {@link makeLineContext} has something to read from.
|
|
1630
1630
|
*/
|
|
1631
1631
|
setDocumentModel(doc: DocumentModel | null): void;
|
|
1632
|
+
/**
|
|
1633
|
+
* The `DocumentModel` this engine is currently wired to, or `null` when it
|
|
1634
|
+
* is not driving one. Lets a caller that borrows the engine for a one-off
|
|
1635
|
+
* incremental pass (see {@link evaluateDocument}) put back whatever a host
|
|
1636
|
+
* had set, rather than assuming it was `null`.
|
|
1637
|
+
*/
|
|
1638
|
+
getDocumentModel(): DocumentModel | null;
|
|
1632
1639
|
/**
|
|
1633
1640
|
* Build the {@link LineExecutionContext} passed to `executeBytecode()`
|
|
1634
1641
|
* for a given line. `lineNumber = -1` (the existing sentinel
|
|
@@ -1683,6 +1690,17 @@ declare class ExpressionEngine {
|
|
|
1683
1690
|
* DAG walk + re-evaluation pass. Replaces the old single-callback pattern.
|
|
1684
1691
|
*/
|
|
1685
1692
|
private batcher;
|
|
1693
|
+
/**
|
|
1694
|
+
* Drives proactive background refresh of live values, or `null` when the
|
|
1695
|
+
* host has not enabled it (the default). See {@link BackgroundRefreshManager}.
|
|
1696
|
+
*/
|
|
1697
|
+
private readonly backgroundRefresh;
|
|
1698
|
+
/**
|
|
1699
|
+
* The signal a background re-evaluation is dispatched under. Never aborted
|
|
1700
|
+
* (a background refetch is not tied to a keystroke), so the batcher treats
|
|
1701
|
+
* its results as current; the manager's own timers are what stop the work.
|
|
1702
|
+
*/
|
|
1703
|
+
private readonly backgroundRefreshSignal;
|
|
1686
1704
|
/** Post-lexer token normalizer for phrase fusion, implicit multiply, etc. */
|
|
1687
1705
|
private normalizer;
|
|
1688
1706
|
/**
|
|
@@ -1841,6 +1859,18 @@ declare class ExpressionEngine {
|
|
|
1841
1859
|
* and fires typed events to all listeners.
|
|
1842
1860
|
*/
|
|
1843
1861
|
private resolveAsync;
|
|
1862
|
+
/**
|
|
1863
|
+
* Start refreshing a value in the background if it declared a cadence and the
|
|
1864
|
+
* host enabled background refresh. A no-op otherwise, so the pull path is
|
|
1865
|
+
* unchanged for a headless host or a value that never wants it.
|
|
1866
|
+
*/
|
|
1867
|
+
private registerBackgroundRefresh;
|
|
1868
|
+
/**
|
|
1869
|
+
* How many live values are currently being refreshed in the background.
|
|
1870
|
+
* Zero when the host has not enabled background refresh. For hosts that want
|
|
1871
|
+
* to surface it, and for tests.
|
|
1872
|
+
*/
|
|
1873
|
+
getBackgroundRefreshCount(): number;
|
|
1844
1874
|
/**
|
|
1845
1875
|
* Unified parsing method that handles different input types and returns comprehensive results
|
|
1846
1876
|
* with precise coordinate mapping for inline solves.
|
|
@@ -3087,4 +3117,4 @@ interface IEnginePackage {
|
|
|
3087
3117
|
asConverters?: Record<string, (value: Value) => Value>;
|
|
3088
3118
|
}
|
|
3089
3119
|
|
|
3090
|
-
export { type ApplyChangesResult as A, type BatcherMetrics as B, type
|
|
3120
|
+
export { type ApplyChangesResult as A, type BatcherMetrics as B, type CompletionItem as C, DocumentModel as D, ExpressionEngine as E, type LineCacheEntryInfo as F, type LineState as G, type LinesUpdatedEvent as H, type IEnginePackage as I, type ParsedLine as J, LanguageService as L, type ParsingResult as P, SNAPSHOT_FORMAT as S, type UnifiedParsingOptions as U, type ViewportRange as V, type EngineOptions as a, type EngineRestoreOptions as b, type EngineSnapshot as c, type Explanation as d, type ExplanationStep as e, SNAPSHOT_VERSION as f, type SerializedAnonymousBody as g, type SerializedBytecode as h, type SerializedDecimal as i, type SerializedLineCacheEntry as j, type SerializedNumber as k, type SerializedRational as l, type SerializedUserFunction as m, type SerializedValue as n, SnapshotErrorCodes as o, type LanguageServiceOptions as p, type SemanticToken as q, type LineChange as r, type InlineSolvePosition as s, type AsyncCachePackageInfo as t, type AsyncErrorEvent as u, AsyncResolutionBatcher as v, type AsyncResolutionEvent as w, type BytecodeCacheEntry as x, type CacheSnapshot as y, type CheckpointSnapshot as z };
|
|
@@ -3,13 +3,13 @@ import { V as Value, b as ValueType } from './Value-CCi_Eecs.js';
|
|
|
3
3
|
import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-DKMlj7Sy.js';
|
|
4
4
|
import { IAsyncResolver } from './resolvers.js';
|
|
5
5
|
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-DCWdZjGz.js';
|
|
6
|
-
import {
|
|
6
|
+
import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, P as PluginFunctionHandler } from './ScopeManager-DkpnlKuz.js';
|
|
7
7
|
import { a as BytecodeProgram } from './BytecodeBuilder-DGGeByAP.js';
|
|
8
8
|
import { QueryClient } from '@tanstack/query-core';
|
|
9
9
|
import { E as EngineError } from './EngineError-Ce1lPkjZ.js';
|
|
10
10
|
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-72QmQlGx.js';
|
|
11
11
|
import { T as Token } from './Token-CbP_OutD.js';
|
|
12
|
-
import { E as EngineConfigOverride, a as EngineConfig } from './Configuration-
|
|
12
|
+
import { E as EngineConfigOverride, a as EngineConfig } from './Configuration-Culg8H_o.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* One line's compiled bytecode, plus the variables it reads and writes.
|
|
@@ -1629,6 +1629,13 @@ declare class ExpressionEngine {
|
|
|
1629
1629
|
* {@link makeLineContext} has something to read from.
|
|
1630
1630
|
*/
|
|
1631
1631
|
setDocumentModel(doc: DocumentModel | null): void;
|
|
1632
|
+
/**
|
|
1633
|
+
* The `DocumentModel` this engine is currently wired to, or `null` when it
|
|
1634
|
+
* is not driving one. Lets a caller that borrows the engine for a one-off
|
|
1635
|
+
* incremental pass (see {@link evaluateDocument}) put back whatever a host
|
|
1636
|
+
* had set, rather than assuming it was `null`.
|
|
1637
|
+
*/
|
|
1638
|
+
getDocumentModel(): DocumentModel | null;
|
|
1632
1639
|
/**
|
|
1633
1640
|
* Build the {@link LineExecutionContext} passed to `executeBytecode()`
|
|
1634
1641
|
* for a given line. `lineNumber = -1` (the existing sentinel
|
|
@@ -1683,6 +1690,17 @@ declare class ExpressionEngine {
|
|
|
1683
1690
|
* DAG walk + re-evaluation pass. Replaces the old single-callback pattern.
|
|
1684
1691
|
*/
|
|
1685
1692
|
private batcher;
|
|
1693
|
+
/**
|
|
1694
|
+
* Drives proactive background refresh of live values, or `null` when the
|
|
1695
|
+
* host has not enabled it (the default). See {@link BackgroundRefreshManager}.
|
|
1696
|
+
*/
|
|
1697
|
+
private readonly backgroundRefresh;
|
|
1698
|
+
/**
|
|
1699
|
+
* The signal a background re-evaluation is dispatched under. Never aborted
|
|
1700
|
+
* (a background refetch is not tied to a keystroke), so the batcher treats
|
|
1701
|
+
* its results as current; the manager's own timers are what stop the work.
|
|
1702
|
+
*/
|
|
1703
|
+
private readonly backgroundRefreshSignal;
|
|
1686
1704
|
/** Post-lexer token normalizer for phrase fusion, implicit multiply, etc. */
|
|
1687
1705
|
private normalizer;
|
|
1688
1706
|
/**
|
|
@@ -1841,6 +1859,18 @@ declare class ExpressionEngine {
|
|
|
1841
1859
|
* and fires typed events to all listeners.
|
|
1842
1860
|
*/
|
|
1843
1861
|
private resolveAsync;
|
|
1862
|
+
/**
|
|
1863
|
+
* Start refreshing a value in the background if it declared a cadence and the
|
|
1864
|
+
* host enabled background refresh. A no-op otherwise, so the pull path is
|
|
1865
|
+
* unchanged for a headless host or a value that never wants it.
|
|
1866
|
+
*/
|
|
1867
|
+
private registerBackgroundRefresh;
|
|
1868
|
+
/**
|
|
1869
|
+
* How many live values are currently being refreshed in the background.
|
|
1870
|
+
* Zero when the host has not enabled background refresh. For hosts that want
|
|
1871
|
+
* to surface it, and for tests.
|
|
1872
|
+
*/
|
|
1873
|
+
getBackgroundRefreshCount(): number;
|
|
1844
1874
|
/**
|
|
1845
1875
|
* Unified parsing method that handles different input types and returns comprehensive results
|
|
1846
1876
|
* with precise coordinate mapping for inline solves.
|
|
@@ -3087,4 +3117,4 @@ interface IEnginePackage {
|
|
|
3087
3117
|
asConverters?: Record<string, (value: Value) => Value>;
|
|
3088
3118
|
}
|
|
3089
3119
|
|
|
3090
|
-
export { type ApplyChangesResult as A, type BatcherMetrics as B, type
|
|
3120
|
+
export { type ApplyChangesResult as A, type BatcherMetrics as B, type CompletionItem as C, DocumentModel as D, ExpressionEngine as E, type LineCacheEntryInfo as F, type LineState as G, type LinesUpdatedEvent as H, type IEnginePackage as I, type ParsedLine as J, LanguageService as L, type ParsingResult as P, SNAPSHOT_FORMAT as S, type UnifiedParsingOptions as U, type ViewportRange as V, type EngineOptions as a, type EngineRestoreOptions as b, type EngineSnapshot as c, type Explanation as d, type ExplanationStep as e, SNAPSHOT_VERSION as f, type SerializedAnonymousBody as g, type SerializedBytecode as h, type SerializedDecimal as i, type SerializedLineCacheEntry as j, type SerializedNumber as k, type SerializedRational as l, type SerializedUserFunction as m, type SerializedValue as n, SnapshotErrorCodes as o, type LanguageServiceOptions as p, type SemanticToken as q, type LineChange as r, type InlineSolvePosition as s, type AsyncCachePackageInfo as t, type AsyncErrorEvent as u, AsyncResolutionBatcher as v, type AsyncResolutionEvent as w, type BytecodeCacheEntry as x, type CacheSnapshot as y, type CheckpointSnapshot as z };
|
|
@@ -674,4 +674,4 @@ declare class ScopeManager {
|
|
|
674
674
|
clear(): void;
|
|
675
675
|
}
|
|
676
676
|
|
|
677
|
-
export { type Bytecode as B,
|
|
677
|
+
export { type Bytecode as B, DependencyGraph as D, type ExpressionRecord as E, OpRegistry as O, type PluginFunctionHandler as P, ScopeManager as S, type VM as V, type DagSnapshot as a, type EngineContext as b, createVM as c, executeBytecode as e, sharedOpRegistry as s };
|
|
@@ -674,4 +674,4 @@ declare class ScopeManager {
|
|
|
674
674
|
clear(): void;
|
|
675
675
|
}
|
|
676
676
|
|
|
677
|
-
export { type Bytecode as B,
|
|
677
|
+
export { type Bytecode as B, DependencyGraph as D, type ExpressionRecord as E, OpRegistry as O, type PluginFunctionHandler as P, ScopeManager as S, type VM as V, type DagSnapshot as a, type EngineContext as b, createVM as c, executeBytecode as e, sharedOpRegistry as s };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { V as Value } from './Value-CCi_Eecs.cjs';
|
|
2
|
-
import { V as VM } from './ScopeManager-
|
|
2
|
+
import { V as VM } from './ScopeManager-t6SnP6Ce.cjs';
|
|
3
3
|
import { U as UserFunctionDef } from './BytecodeBuilder-DGGeByAP.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -168,4 +168,4 @@ declare class VMCheckpointer {
|
|
|
168
168
|
get vmInstance(): VM;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
export {
|
|
171
|
+
export { type VMCheckpoint as V, VMCheckpointer as a };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { V as Value } from './Value-CCi_Eecs.js';
|
|
2
|
-
import { V as VM } from './ScopeManager-
|
|
2
|
+
import { V as VM } from './ScopeManager-DkpnlKuz.js';
|
|
3
3
|
import { U as UserFunctionDef } from './BytecodeBuilder-DGGeByAP.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -168,4 +168,4 @@ declare class VMCheckpointer {
|
|
|
168
168
|
get vmInstance(): VM;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
export {
|
|
171
|
+
export { type VMCheckpoint as V, VMCheckpointer as a };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var n=class{constructor(){this.resolvers=new Map;}register(e){this.resolvers.has(e.namespace)&&(console.warn(`[ResolverRegistry] Namespace "${e.namespace}" already registered. Destroying old resolver and overwriting. Use distinct namespaces (e.g., "${e.namespace}:sub1", "${e.namespace}:sub2") to avoid collisions when a package needs multiple async resolvers.`),this.resolvers.get(e.namespace).destroy()),this.resolvers.set(e.namespace,e);}unregister(e,r){let s=this.resolvers.get(e);s&&(s.destroy(),this.resolvers.delete(e)),r&&r.removeQueries({queryKey:[e]});}preflightAll(e,r,s,i,l){for(let t of this.resolvers.values()){if(!t.preflight)continue;let o=t.preflight(e,r,s,i,l);if(o)return o}return null}get(e){return this.resolvers.get(e)}get size(){return this.resolvers.size}has(e){return this.resolvers.has(e)}clear(){for(let e of this.resolvers.values())e.destroy();this.resolvers.clear();}};export{n as a};//# sourceMappingURL=chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
var n=class{constructor(){this.resolvers=new Map;}register(e){this.resolvers.has(e.namespace)&&(console.warn(`[ResolverRegistry] Namespace "${e.namespace}" already registered. Destroying old resolver and overwriting. Use distinct namespaces (e.g., "${e.namespace}:sub1", "${e.namespace}:sub2") to avoid collisions when a package needs multiple async resolvers.`),this.resolvers.get(e.namespace).destroy()),this.resolvers.set(e.namespace,e);}unregister(e,r){let s=this.resolvers.get(e);s&&(s.destroy(),this.resolvers.delete(e)),r&&r.removeQueries({queryKey:[e]});}preflightAll(e,r,s,i,l){for(let t of this.resolvers.values()){if(!t.preflight)continue;let o=t.preflight(e,r,s,i,l);if(o)return o}return null}get(e){return this.resolvers.get(e)}get size(){return this.resolvers.size}has(e){return this.resolvers.has(e)}clear(){for(let e of this.resolvers.values())e.destroy();this.resolvers.clear();}};export{n as a};//# sourceMappingURL=chunk-7E7NXKQ5.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-7E7NXKQ5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resolvers/ResolverRegistry.ts"],"names":["ResolverRegistry","resolver","namespace","queryClient","tokens","bytecode","packageId","signal","result"],"mappings":"AAqFO,IAAMA,EAAN,KAAuB,CAAvB,WAAA,EAAA,CACN,IAAA,CAAQ,UAAY,IAAI,IAAA,CAWxB,QAAA,CAASC,CAAAA,CAAgC,CAEpC,IAAA,CAAK,SAAA,CAAU,GAAA,CAAIA,CAAAA,CAAS,SAAS,CAAA,GACxC,OAAA,CAAQ,IAAA,CACP,CAAA,8BAAA,EAAiCA,EAAS,SAAS,CAAA,+FAAA,EAExCA,CAAAA,CAAS,SAAS,YAAYA,CAAAA,CAAS,SAAS,CAAA,0EAAA,CAE5D,CAAA,CACA,KAAK,SAAA,CAAU,GAAA,CAAIA,CAAAA,CAAS,SAAS,EAAG,OAAA,EAAQ,CAAA,CAEjD,IAAA,CAAK,SAAA,CAAU,IAAIA,CAAAA,CAAS,SAAA,CAAWA,CAAQ,EAChD,CAMA,UAAA,CAAWC,CAAAA,CAAmBC,CAAAA,CAAiC,CAC9D,IAAMF,CAAAA,CAAW,IAAA,CAAK,SAAA,CAAU,GAAA,CAAIC,CAAS,CAAA,CACzCD,CAAAA,GACHA,CAAAA,CAAS,OAAA,GACT,IAAA,CAAK,SAAA,CAAU,MAAA,CAAOC,CAAS,GAI5BC,CAAAA,EACHA,CAAAA,CAAY,aAAA,CAAc,CAAE,SAAU,CAACD,CAAS,CAAE,CAAC,EAErD,CASA,YAAA,CAAaE,CAAAA,CAAiBC,CAAAA,CAA2BC,EAAmBC,CAAAA,CAAqBJ,CAAAA,CAAmD,CACnJ,IAAA,IAAWF,KAAY,IAAA,CAAK,SAAA,CAAU,MAAA,EAAO,CAAG,CAC/C,GAAI,CAACA,CAAAA,CAAS,SAAA,CAAW,SACzB,IAAMO,CAAAA,CAASP,CAAAA,CAAS,SAAA,CAAUG,EAAQC,CAAAA,CAAUC,CAAAA,CAAWC,CAAAA,CAAQJ,CAAW,EAClF,GAAIK,CAAAA,CAAQ,OAAOA,CACpB,CACA,OAAO,IACR,CAMA,GAAA,CAAIN,EAA+C,CAClD,OAAO,IAAA,CAAK,SAAA,CAAU,IAAIA,CAAS,CACpC,CAGA,IAAI,MAAe,CAClB,OAAO,IAAA,CAAK,SAAA,CAAU,IACvB,CAKA,GAAA,CAAIA,CAAAA,CAA4B,CAC/B,OAAO,IAAA,CAAK,SAAA,CAAU,GAAA,CAAIA,CAAS,CACpC,CAMA,KAAA,EAAc,CACb,IAAA,IAAWD,KAAY,IAAA,CAAK,SAAA,CAAU,MAAA,EAAO,CAC5CA,EAAS,OAAA,EAAQ,CAElB,KAAK,SAAA,CAAU,KAAA,GAChB,CACD","file":"chunk-7E7NXKQ5.js","sourcesContent":["import type { QueryClient } from \"@tanstack/query-core\";\nimport type { Token } from \"@solve-js/lexer\";\nimport type { BytecodeProgram } from \"@solve-js/parser/BytecodeBuilder\";\nimport type { Value } from \"@solve-js/vm/Value\";\n\n/**\n * Result from a resolver's preflight() check.\n * Returned when async data is needed, the orchestrator uses this\n * to subscribe to the resolver and return a Pending value immediately.\n */\nexport interface AsyncCheckResult {\n\t/** Unique cache key for deduplication (e.g., \"{packageId}:rates:USD:GBP\") */\n\tqueryKey: string;\n\t/** Promise that resolves to the final Value */\n\tresolver: Promise<Value>;\n\t/** Package owning this resolver */\n\tpackageId: string;\n\t/** AbortSignal for stale-data prevention */\n\tsignal: AbortSignal;\n\t/** Optional metadata for diagnostics */\n\tmetadata?: Record<string, unknown>;\n\t/**\n\t * Cadence, in ms, at which this value wants proactive background refresh\n\t * (a live quote every minute, an FX rate every few minutes). Absent, or\n\t * paired with no {@link refetch}, means pull-only: the value refreshes on\n\t * re-evaluation, never on its own. Only acted on when the host has enabled\n\t * background refresh; see {@link BackgroundRefreshConfig}.\n\t */\n\trefetchIntervalMs?: number;\n\t/**\n\t * Force a fresh fetch of this exact query, bypassing `staleTime`, and return\n\t * the new value. Supplied alongside {@link refetchIntervalMs} so the engine\n\t * can drive the background refresh without re-scanning bytecode.\n\t */\n\trefetch?: () => Promise<Value>;\n}\n\n/**\n * Interface for async resolvers registered by packages/plugins.\n *\n * Each resolver handles a domain of async data (currency rates,\n * weather, stock prices, etc.). The preflight() method is called\n * BEFORE VM execution to check if all data is cached. If not,\n * it returns an AsyncCheckResult and the engine skips the VM,\n * returning a Pending value instead.\n */\nexport interface IAsyncResolver {\n\t/** Unique namespace for cache key scoping (e.g., \"currency\", \"weather\") */\n\treadonly namespace: string;\n\n\t/**\n\t * Pre-flight check: called BEFORE VM execution.\n\t *\n\t * Returns null if all data for this expression is cached and ready.\n\t * Returns an AsyncCheckResult if async work is needed.\n\t *\n\t * This method is synchronous, it only checks caches, never fetches.\n\t * If data is missing, it creates a Promise and returns immediately.\n\t *\n\t * @param tokens - The lexed tokens for the expression\n\t * @param bytecode - The compiled bytecode program\n\t * @param pluginId - The plugin ID (for cache key scoping)\n\t * @param signal - AbortSignal for the current evaluation\n\t */\n\tpreflight?(tokens: Token[], bytecode: BytecodeProgram, packageId: string, signal: AbortSignal, queryClient: QueryClient): AsyncCheckResult | null;\n\n\t/**\n\t * Called when the resolver's namespace is being unregistered.\n\t * Clean up any in-flight promises, clear caches, unsubscribe.\n\t */\n\tdestroy(): void;\n}\n\n/**\n * Registry of async resolvers, keyed by namespace.\n *\n * Plugins/packages register resolvers alongside their parselets\n * and opcode handlers. The engine calls preflightAll() before\n * VM execution to short-circuit async expressions.\n *\n * Lifecycle:\n * - register(), when a package is loaded\n * - unregister(), when a package is unloaded (clears cache entries)\n * - clear(), on document switch (clears all resolvers)\n */\nexport class ResolverRegistry {\n\tprivate resolvers = new Map<string, IAsyncResolver>();\n\n\t/**\n\t * Register an async resolver.\n\t *\n\t * Each resolver must have a unique `namespace`. If a resolver with the\n\t * same namespace is already registered, the old one is destroyed and\n\t * replaced (with a console warning). Packages that need multiple async\n\t * operations should use `asyncResolvers: [...]` with distinct namespaces\n\t * (e.g., `\"weather:current\"`, `\"weather:forecast\"`).\n\t */\n\tregister(resolver: IAsyncResolver): void {\n\t\t// Clean up previous resolver with same namespace if any\n\t\tif (this.resolvers.has(resolver.namespace)) {\n\t\t\tconsole.warn(\n\t\t\t\t`[ResolverRegistry] Namespace \"${resolver.namespace}\" already registered. ` +\n\t\t\t\t`Destroying old resolver and overwriting. Use distinct namespaces ` +\n\t\t\t\t`(e.g., \"${resolver.namespace}:sub1\", \"${resolver.namespace}:sub2\") ` +\n\t\t\t\t`to avoid collisions when a package needs multiple async resolvers.`,\n\t\t\t);\n\t\t\tthis.resolvers.get(resolver.namespace)!.destroy();\n\t\t}\n\t\tthis.resolvers.set(resolver.namespace, resolver);\n\t}\n\n\t/**\n\t * Unregister a resolver by namespace.\n\t * Calls destroy() and clears all cache entries with that namespace prefix.\n\t */\n\tunregister(namespace: string, queryClient?: QueryClient): void {\n\t\tconst resolver = this.resolvers.get(namespace);\n\t\tif (resolver) {\n\t\t\tresolver.destroy();\n\t\t\tthis.resolvers.delete(namespace);\n\t\t}\n\t\t// Clear all cache entries for this namespace via TanStack Query\n\t\t// Hierarchical keys: [\"osrs\"] clears all [\"osrs\", ...] queries\n\t\tif (queryClient) {\n\t\t\tqueryClient.removeQueries({ queryKey: [namespace] });\n\t\t}\n\t}\n\n\t/**\n\t * Run all registered resolvers' preflight checks against compiled bytecode.\n\t *\n\t * Returns the first AsyncCheckResult found, or null if all data is ready.\n\t * Short-circuits on first pending, subsequent pending ops will be\n\t * discovered on re-evaluation when the first resolves.\n\t */\n\tpreflightAll(tokens: Token[], bytecode: BytecodeProgram, packageId: string, signal: AbortSignal, queryClient: QueryClient): AsyncCheckResult | null {\n\t\tfor (const resolver of this.resolvers.values()) {\n\t\t\tif (!resolver.preflight) continue;\n\t\t\tconst result = resolver.preflight(tokens, bytecode, packageId, signal, queryClient);\n\t\t\tif (result) return result;\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**\n\t * Get a resolver by namespace.\n\t * Returns undefined if no resolver is registered for that namespace.\n\t */\n\tget(namespace: string): IAsyncResolver | undefined {\n\t\treturn this.resolvers.get(namespace);\n\t}\n\n\t/** Number of registered resolvers. */\n\tget size(): number {\n\t\treturn this.resolvers.size;\n\t}\n\n\t/**\n\t * Check if a resolver is registered for the given namespace.\n\t */\n\thas(namespace: string): boolean {\n\t\treturn this.resolvers.has(namespace);\n\t}\n\n\t/**\n\t * Clear all resolvers (document switch, engine reset).\n\t * Calls destroy() on each resolver and clears the map.\n\t */\n\tclear(): void {\n\t\tfor (const resolver of this.resolvers.values()) {\n\t\t\tresolver.destroy();\n\t\t}\n\t\tthis.resolvers.clear();\n\t}\n}\n"]}
|