solve-engine 1.0.0-beta.7 → 1.0.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/{BytecodeBuilder-3egMyuDi.d.cts → BytecodeBuilder-B0xskcv5.d.cts} +2 -1
- package/dist/{BytecodeBuilder-3egMyuDi.d.ts → BytecodeBuilder-B0xskcv5.d.ts} +2 -1
- package/dist/{Configuration-fVpd-HC-.d.cts → Configuration-B-G5gTRn.d.cts} +107 -29
- package/dist/{Configuration-fVpd-HC-.d.ts → Configuration-B-G5gTRn.d.ts} +107 -29
- package/dist/{EngineError-DvPSnhZi.d.cts → EngineError-LU7W7AgI.d.cts} +96 -16
- package/dist/{EngineError-DvPSnhZi.d.ts → EngineError-LU7W7AgI.d.ts} +96 -16
- package/dist/{Lexer-W9MBOP0V.d.ts → Lexer-BN5mt30n.d.ts} +16 -0
- package/dist/{Lexer-Cfm79Dak.d.cts → Lexer-D78E2yDW.d.cts} +16 -0
- package/dist/{PackageRegistry-CjDt-Jy_.d.ts → PackageRegistry-DFeINv2O.d.ts} +54 -13
- package/dist/{PackageRegistry-pHtKythi.d.cts → PackageRegistry-u2zdfFaj.d.cts} +54 -13
- package/dist/{Parselet-DEdF9I7n.d.ts → Parselet-BaySkMV3.d.ts} +37 -5
- package/dist/{Parselet-Cu0bLSis.d.cts → Parselet-DuI1Pjiq.d.cts} +37 -5
- package/dist/{ScopeManager-CKfQtl7l.d.cts → ScopeManager-B6GzdhVG.d.cts} +75 -6
- package/dist/{ScopeManager-B5k0nk05.d.ts → ScopeManager-udv4Twwq.d.ts} +75 -6
- package/dist/{VMCheckpoints-BmDwIXgK.d.ts → VMCheckpoints-BiaIlOOY.d.ts} +4 -4
- package/dist/{VMCheckpoints-CqFuLwrT.d.cts → VMCheckpoints-DwLjivM7.d.cts} +4 -4
- package/dist/{Value-KtAQNHur.d.cts → Value-CXJqDH9J.d.cts} +5 -2
- package/dist/{Value-KtAQNHur.d.ts → Value-CXJqDH9J.d.ts} +5 -2
- package/dist/{chunk-CSG5XVNJ.cjs → chunk-3AFRJYP4.cjs} +556 -414
- package/dist/chunk-3AFRJYP4.cjs.map +1 -0
- package/dist/chunk-3BOK2LDK.js +17 -0
- package/dist/chunk-3BOK2LDK.js.map +1 -0
- package/dist/{chunk-6RDSQURE.js → chunk-3D7V24DG.js} +57 -6
- package/dist/chunk-3D7V24DG.js.map +1 -0
- package/dist/{chunk-MEOHSQEH.js → chunk-3LAEG75D.js} +47 -15
- package/dist/chunk-3LAEG75D.js.map +1 -0
- package/dist/{chunk-P75775WC.js → chunk-3VNGREMU.js} +118 -41
- package/dist/chunk-3VNGREMU.js.map +1 -0
- package/dist/{chunk-4AVD7NZW.cjs → chunk-4B2CNWQU.cjs} +13 -7
- package/dist/chunk-4B2CNWQU.cjs.map +1 -0
- package/dist/{chunk-6GCKCWLB.js → chunk-526PMQOA.js} +126 -69
- package/dist/chunk-526PMQOA.js.map +1 -0
- package/dist/{chunk-2CS6OMZK.js → chunk-5F4C26RU.js} +8 -5
- package/dist/chunk-5F4C26RU.js.map +1 -0
- package/dist/{chunk-M4N5GA5Z.cjs → chunk-5KMIY374.cjs} +57 -6
- package/dist/chunk-5KMIY374.cjs.map +1 -0
- package/dist/{chunk-R24DI24X.cjs → chunk-5LI5EPGJ.cjs} +6 -5
- package/dist/chunk-5LI5EPGJ.cjs.map +1 -0
- package/dist/{chunk-BAMZT3GL.js → chunk-5WVP4YHP.js} +939 -134
- package/dist/chunk-5WVP4YHP.js.map +1 -0
- package/dist/{chunk-MZOVP3WI.cjs → chunk-6KFYJ6TD.cjs} +3 -2
- package/dist/chunk-6KFYJ6TD.cjs.map +1 -0
- package/dist/{chunk-BXKJLM5R.cjs → chunk-6WFMPTGB.cjs} +972 -636
- package/dist/chunk-6WFMPTGB.cjs.map +1 -0
- package/dist/{chunk-2MV4HBKC.cjs → chunk-A2N2GFCG.cjs} +10 -10
- package/dist/{chunk-2MV4HBKC.cjs.map → chunk-A2N2GFCG.cjs.map} +1 -1
- package/dist/chunk-ADBA3XBE.cjs +20 -0
- package/dist/chunk-ADBA3XBE.cjs.map +1 -0
- package/dist/{chunk-MBNQVDVC.cjs → chunk-AMOJYLG2.cjs} +16 -10
- package/dist/chunk-AMOJYLG2.cjs.map +1 -0
- package/dist/{chunk-CLVQBF5C.cjs → chunk-AQNHHJMJ.cjs} +5 -5
- package/dist/{chunk-CLVQBF5C.cjs.map → chunk-AQNHHJMJ.cjs.map} +1 -1
- package/dist/{chunk-AHCLWAM5.cjs → chunk-BHTNFEGZ.cjs} +13 -13
- package/dist/chunk-BHTNFEGZ.cjs.map +1 -0
- package/dist/{chunk-35IWNZPJ.cjs → chunk-E4NUZXVK.cjs} +58 -27
- package/dist/chunk-E4NUZXVK.cjs.map +1 -0
- package/dist/{chunk-P33SBYGG.js → chunk-GLG5ZMX7.js} +54 -23
- package/dist/chunk-GLG5ZMX7.js.map +1 -0
- package/dist/{chunk-BVAR5J2F.js → chunk-GQCOSXMG.js} +117 -6
- package/dist/chunk-GQCOSXMG.js.map +1 -0
- package/dist/{chunk-QDMPOAI7.cjs → chunk-HDP7VK3C.cjs} +1118 -313
- package/dist/chunk-HDP7VK3C.cjs.map +1 -0
- package/dist/{chunk-GVWHCL2N.js → chunk-HMOISHXR.js} +217 -75
- package/dist/chunk-HMOISHXR.js.map +1 -0
- package/dist/{chunk-MTX2KVU7.cjs → chunk-HVQFNJKE.cjs} +122 -90
- package/dist/chunk-HVQFNJKE.cjs.map +1 -0
- package/dist/{chunk-OC6LTXYS.cjs → chunk-JMXUNXQS.cjs} +126 -7
- package/dist/chunk-JMXUNXQS.cjs.map +1 -0
- package/dist/{chunk-WWOLFXTX.cjs → chunk-KBSXGXPM.cjs} +10 -7
- package/dist/chunk-KBSXGXPM.cjs.map +1 -0
- package/dist/{chunk-YU2CUNFO.js → chunk-KV7UW6T6.js} +11 -5
- package/dist/chunk-KV7UW6T6.js.map +1 -0
- package/dist/{chunk-CCJPSHGI.cjs → chunk-N7FNVFXW.cjs} +4 -12
- package/dist/chunk-N7FNVFXW.cjs.map +1 -0
- package/dist/{chunk-CYFK5SY2.js → chunk-O3ANBHSA.js} +169 -39
- package/dist/chunk-O3ANBHSA.js.map +1 -0
- package/dist/{chunk-NZFKROS7.cjs → chunk-PA4VC73I.cjs} +130 -72
- package/dist/chunk-PA4VC73I.cjs.map +1 -0
- package/dist/{chunk-NJTXJ5AG.cjs → chunk-PFUESQTW.cjs} +18 -18
- package/dist/{chunk-NJTXJ5AG.cjs.map → chunk-PFUESQTW.cjs.map} +1 -1
- package/dist/{chunk-SFQWJMKT.js → chunk-QY25VWBF.js} +51 -12
- package/dist/chunk-QY25VWBF.js.map +1 -0
- package/dist/{chunk-WC5FFSHB.js → chunk-R3PY4G7J.js} +3 -3
- package/dist/{chunk-WC5FFSHB.js.map → chunk-R3PY4G7J.js.map} +1 -1
- package/dist/{chunk-M5E34VG5.js → chunk-SBUFNJVE.js} +3 -3
- package/dist/{chunk-M5E34VG5.js.map → chunk-SBUFNJVE.js.map} +1 -1
- package/dist/{chunk-UKPGSAZW.js → chunk-TMA4RCEN.js} +3 -3
- package/dist/{chunk-UKPGSAZW.js.map → chunk-TMA4RCEN.js.map} +1 -1
- package/dist/{chunk-V6HA6JJZ.cjs → chunk-U5VAY32K.cjs} +215 -138
- package/dist/chunk-U5VAY32K.cjs.map +1 -0
- package/dist/{chunk-DUEZFTK2.js → chunk-UKQHXPGW.js} +4 -12
- package/dist/chunk-UKQHXPGW.js.map +1 -0
- package/dist/{chunk-4CVLFLOB.cjs → chunk-UM6BVY2S.cjs} +201 -69
- package/dist/chunk-UM6BVY2S.cjs.map +1 -0
- package/dist/{chunk-75JP4BZX.js → chunk-UQ3UIZJC.js} +3 -2
- package/dist/chunk-UQ3UIZJC.js.map +1 -0
- package/dist/{chunk-PCPX42KL.js → chunk-V4XG5QF6.js} +16 -10
- package/dist/chunk-V4XG5QF6.js.map +1 -0
- package/dist/{chunk-GPPLSM2Z.js → chunk-VB37OC6I.js} +6 -5
- package/dist/chunk-VB37OC6I.js.map +1 -0
- package/dist/{chunk-MVBEL57Q.js → chunk-Y7FT4IQT.js} +500 -170
- package/dist/chunk-Y7FT4IQT.js.map +1 -0
- package/dist/{chunk-OFXOTECC.js → chunk-YPPPYLSR.js} +7 -7
- package/dist/chunk-YPPPYLSR.js.map +1 -0
- package/dist/{chunk-M4F66R4O.cjs → chunk-YWQ6V4ZN.cjs} +121 -82
- package/dist/chunk-YWQ6V4ZN.cjs.map +1 -0
- package/dist/constants.cjs +5 -5
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +2 -2
- package/dist/engine.cjs +31 -31
- package/dist/engine.d.cts +11 -11
- package/dist/engine.d.ts +11 -11
- package/dist/engine.js +21 -21
- package/dist/errors.cjs +19 -19
- package/dist/errors.d.cts +2 -2
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +1 -1
- package/dist/format.cjs +29 -22
- package/dist/format.cjs.map +1 -1
- package/dist/format.d.cts +1 -2
- package/dist/format.d.ts +1 -2
- package/dist/format.js +23 -16
- package/dist/format.js.map +1 -1
- package/dist/index.cjs +31 -31
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +22 -22
- package/dist/language.cjs +8 -8
- package/dist/language.cjs.map +1 -1
- package/dist/language.d.cts +10 -10
- package/dist/language.d.ts +10 -10
- package/dist/language.js +6 -6
- package/dist/language.js.map +1 -1
- package/dist/lexer.cjs +18 -18
- package/dist/lexer.d.cts +2 -2
- package/dist/lexer.d.ts +2 -2
- package/dist/lexer.js +6 -6
- package/dist/normalizer.cjs +12 -12
- package/dist/normalizer.js +6 -6
- package/dist/packages.cjs +39 -39
- package/dist/packages.d.cts +9 -9
- package/dist/packages.d.ts +9 -9
- package/dist/packages.js +16 -16
- package/dist/parser.cjs +15 -15
- package/dist/parser.d.cts +23 -9
- package/dist/parser.d.ts +23 -9
- package/dist/parser.js +5 -5
- package/dist/{pipeline-CrsRPmsv.d.ts → pipeline-B6k5lCB7.d.ts} +1 -1
- package/dist/{pipeline-DPUQt7yL.d.cts → pipeline-BEb3hujr.d.cts} +1 -1
- package/dist/resolvers.d.cts +2 -2
- package/dist/resolvers.d.ts +2 -2
- package/dist/uom.cjs +17 -17
- package/dist/uom.d.cts +2 -2
- package/dist/uom.d.ts +2 -2
- package/dist/uom.js +7 -7
- package/dist/utilities.cjs +8 -4
- package/dist/utilities.d.cts +19 -3
- package/dist/utilities.d.ts +19 -3
- package/dist/utilities.js +2 -2
- package/dist/vm.cjs +43 -31
- package/dist/vm.d.cts +105 -9
- package/dist/vm.d.ts +105 -9
- package/dist/vm.js +9 -9
- package/package.json +1 -1
- package/dist/chunk-2CS6OMZK.js.map +0 -1
- package/dist/chunk-35IWNZPJ.cjs.map +0 -1
- package/dist/chunk-4AVD7NZW.cjs.map +0 -1
- package/dist/chunk-4CVLFLOB.cjs.map +0 -1
- package/dist/chunk-6GCKCWLB.js.map +0 -1
- package/dist/chunk-6RDSQURE.js.map +0 -1
- package/dist/chunk-75JP4BZX.js.map +0 -1
- package/dist/chunk-AHCLWAM5.cjs.map +0 -1
- package/dist/chunk-BAMZT3GL.js.map +0 -1
- package/dist/chunk-BVAR5J2F.js.map +0 -1
- package/dist/chunk-BXKJLM5R.cjs.map +0 -1
- package/dist/chunk-CCJPSHGI.cjs.map +0 -1
- package/dist/chunk-CSG5XVNJ.cjs.map +0 -1
- package/dist/chunk-CYFK5SY2.js.map +0 -1
- package/dist/chunk-DUEZFTK2.js.map +0 -1
- package/dist/chunk-GPPLSM2Z.js.map +0 -1
- package/dist/chunk-GVWHCL2N.js.map +0 -1
- package/dist/chunk-M4F66R4O.cjs.map +0 -1
- package/dist/chunk-M4N5GA5Z.cjs.map +0 -1
- package/dist/chunk-MBNQVDVC.cjs.map +0 -1
- package/dist/chunk-MEOHSQEH.js.map +0 -1
- package/dist/chunk-MTX2KVU7.cjs.map +0 -1
- package/dist/chunk-MVBEL57Q.js.map +0 -1
- package/dist/chunk-MZOVP3WI.cjs.map +0 -1
- package/dist/chunk-N5YFR4UP.cjs +0 -10
- package/dist/chunk-N5YFR4UP.cjs.map +0 -1
- package/dist/chunk-NZFKROS7.cjs.map +0 -1
- package/dist/chunk-OC6LTXYS.cjs.map +0 -1
- package/dist/chunk-OFXOTECC.js.map +0 -1
- package/dist/chunk-P33SBYGG.js.map +0 -1
- package/dist/chunk-P75775WC.js.map +0 -1
- package/dist/chunk-PCPX42KL.js.map +0 -1
- package/dist/chunk-PFSDGGYL.js +0 -8
- package/dist/chunk-PFSDGGYL.js.map +0 -1
- package/dist/chunk-QDMPOAI7.cjs.map +0 -1
- package/dist/chunk-R24DI24X.cjs.map +0 -1
- package/dist/chunk-SFQWJMKT.js.map +0 -1
- package/dist/chunk-V6HA6JJZ.cjs.map +0 -1
- package/dist/chunk-WWOLFXTX.cjs.map +0 -1
- package/dist/chunk-YU2CUNFO.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { V as Value } from './Value-
|
|
2
|
-
import { U as UserFunctionDef, A as AnonymousBodyDef, a as BytecodeProgram } from './BytecodeBuilder-
|
|
3
|
-
import { E as EngineError } from './EngineError-
|
|
4
|
-
import { D as DiagnosticPipeline } from './pipeline-
|
|
1
|
+
import { V as Value } from './Value-CXJqDH9J.cjs';
|
|
2
|
+
import { U as UserFunctionDef, A as AnonymousBodyDef, a as BytecodeProgram } from './BytecodeBuilder-B0xskcv5.cjs';
|
|
3
|
+
import { E as EngineError } from './EngineError-LU7W7AgI.cjs';
|
|
4
|
+
import { D as DiagnosticPipeline } from './pipeline-BEb3hujr.cjs';
|
|
5
5
|
import { VariableResolver } from './variables.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -19,8 +19,27 @@ import { VariableResolver } from './variables.cjs';
|
|
|
19
19
|
* @param maxFunctionRecursionDepth - Maximum nested user-defined-function
|
|
20
20
|
* calls (default 50). See the VM interface's `pushCallFrame` doc for why
|
|
21
21
|
* this exists as its own dedicated guard, separate from `maxInstructions`.
|
|
22
|
+
* @param maxCollectionSize - Maximum elements a Range or Matrix may be
|
|
23
|
+
* expanded to by `map`/`reduce` (default 100000). Neither of the two
|
|
24
|
+
* counters above can see that expansion, since it happens inside one
|
|
25
|
+
* opcode and never touches the value stack.
|
|
26
|
+
* @param maxAllocatedElements - Maximum elements one evaluation may
|
|
27
|
+
* materialise in TOTAL (default 2000000). The parameter above bounds one
|
|
28
|
+
* collection; per-site bounds do not compose, and an operation whose result
|
|
29
|
+
* is the product of two legal operands (a matrix multiply) is bounded by
|
|
30
|
+
* neither. See `vm/AllocationBudget.ts`.
|
|
31
|
+
* @param maxFunctionCalls - Maximum user-defined-function calls one
|
|
32
|
+
* evaluation may make in total (default 10000). `maxFunctionRecursionDepth`
|
|
33
|
+
* above bounds how deep they nest and cannot see how many there are: a
|
|
34
|
+
* doubling chain reaches two million calls at a depth of twenty-two.
|
|
35
|
+
* @param maxDateOffsetYears - How far forward `<date> + N workdays` may
|
|
36
|
+
* reach, in years (default 100). The one date offset that walks rather than
|
|
37
|
+
* computing, so the one that needs a ceiling. See `addBusinessDays()`.
|
|
38
|
+
* @param minDateOffsetYears - The same bound backwards, negative (default
|
|
39
|
+
* -100).
|
|
40
|
+
* @param context - Registries belonging to the engine that created this VM.
|
|
22
41
|
*/
|
|
23
|
-
declare function createVM(registry: OpRegistry, maxStackDepth?: number, maxInstructions?: number, maxFunctionRecursionDepth?: number, context?: EngineContext): VM;
|
|
42
|
+
declare function createVM(registry: OpRegistry, maxStackDepth?: number, maxInstructions?: number, maxFunctionRecursionDepth?: number, maxCollectionSize?: number, maxAllocatedElements?: number, maxFunctionCalls?: number, maxDateOffsetYears?: number, minDateOffsetYears?: number, context?: EngineContext): VM;
|
|
24
43
|
/**
|
|
25
44
|
* Compiled bytecode ready for VM execution.
|
|
26
45
|
*
|
|
@@ -310,7 +329,26 @@ declare class OpRegistry {
|
|
|
310
329
|
interface VM {
|
|
311
330
|
push(value: Value): void;
|
|
312
331
|
pop(): Value;
|
|
332
|
+
/**
|
|
333
|
+
* Pop the top of the stack as a number.
|
|
334
|
+
*
|
|
335
|
+
* @throws `STACK_UNDERFLOW` (INTERNAL) if the stack is empty. Unlike
|
|
336
|
+
* `pop()`, which answers an empty stack with `0`, this reports it: a
|
|
337
|
+
* handler asking for a number has no way to tell that `0` from a real
|
|
338
|
+
* one. Every Value converts, so there is no operand-type throw here.
|
|
339
|
+
*/
|
|
313
340
|
popNumber(): number;
|
|
341
|
+
/**
|
|
342
|
+
* Pop the top of the stack as a string, e.g. a unit name a handler's own
|
|
343
|
+
* bytecode pushed for it to read.
|
|
344
|
+
*
|
|
345
|
+
* @throws `STACK_UNDERFLOW` (INTERNAL) if the stack is empty, and
|
|
346
|
+
* `MALFORMED_BYTECODE_OPERAND_TYPE` (VALIDATION, recoverable) if the
|
|
347
|
+
* value on top is not a string. Both are structured `EngineError`s
|
|
348
|
+
* naming this method, in place of the raw TypeError a bare `pop()!` and
|
|
349
|
+
* a compile-time-only cast used to produce somewhere further along. A
|
|
350
|
+
* handler that would rather branch than throw can `peek()` first.
|
|
351
|
+
*/
|
|
314
352
|
popString(): string;
|
|
315
353
|
peek(): Value;
|
|
316
354
|
getStack(): Value[];
|
|
@@ -360,8 +398,39 @@ interface VM {
|
|
|
360
398
|
getScalarEquation(variable: string): ScalarEquationDef | undefined;
|
|
361
399
|
hasScalarEquation(variable: string): boolean;
|
|
362
400
|
reset(): void;
|
|
401
|
+
/** The innermost call frame's bindings, or `undefined` when no call is in progress. Read-only, for building a frame that extends the current one rather than replacing it (see `BIND_UNKNOWN`'s handler). */
|
|
402
|
+
getCallFrame(): ReadonlyMap<string, Value> | undefined;
|
|
363
403
|
getMaxInstructions(): number;
|
|
364
404
|
getMaxStackDepth(): number;
|
|
405
|
+
/** Maximum elements a Range or Matrix may be expanded to by `map`/`reduce`. See `constants/Configuration.ts`'s `maxCollectionSize`. */
|
|
406
|
+
getMaxCollectionSize(): number;
|
|
407
|
+
/**
|
|
408
|
+
* Maximum elements (collection Values, matrix cells) one evaluation may
|
|
409
|
+
* materialise in total.
|
|
410
|
+
*
|
|
411
|
+
* The bound the two limits above cannot be. Both are checked between
|
|
412
|
+
* opcodes, so neither sees what one opcode allocates inside a loop of its
|
|
413
|
+
* own, and `getMaxCollectionSize()` bounds one collection without bounding
|
|
414
|
+
* the total. See `vm/AllocationBudget.ts` for the counter this configures
|
|
415
|
+
* and for why charging goes through that module rather than through the VM.
|
|
416
|
+
*/
|
|
417
|
+
getMaxAllocatedElements(): number;
|
|
418
|
+
/**
|
|
419
|
+
* Maximum user-defined-function calls one evaluation may make in total.
|
|
420
|
+
*
|
|
421
|
+
* `maxFunctionRecursionDepth` (see `pushCallFrame` above) bounds how DEEP
|
|
422
|
+
* calls nest; this bounds how MANY there are, which is a different number
|
|
423
|
+
* and the one a doubling chain runs away with: twenty-two lines of
|
|
424
|
+
* `f(v) = g(v) + g(v)` reach two million calls at a depth of twenty-two.
|
|
425
|
+
* Held by `vm/AllocationBudget.ts` rather than counted here, because it has
|
|
426
|
+
* to survive `executeBytecode()` re-entering itself, exactly like the
|
|
427
|
+
* element tally and unlike `maxInstructions`.
|
|
428
|
+
*/
|
|
429
|
+
getMaxFunctionCalls(): number;
|
|
430
|
+
/** How far forward `<date> + N workdays` may reach, in years. The one date offset that walks the calendar rather than computing, so the one with a ceiling. See `constants/Configuration.ts`'s `date.maxOffsetYears`. */
|
|
431
|
+
getMaxDateOffsetYears(): number;
|
|
432
|
+
/** The same bound backwards, as a negative number of years. */
|
|
433
|
+
getMinDateOffsetYears(): number;
|
|
365
434
|
getInstructionCount(): number;
|
|
366
435
|
incrementInstructions(n: number): void;
|
|
367
436
|
/** Active AbortSignal for the current expression evaluation. Checked before cache writes. */
|
|
@@ -556,4 +625,4 @@ declare class ScopeManager {
|
|
|
556
625
|
clear(): void;
|
|
557
626
|
}
|
|
558
627
|
|
|
559
|
-
export { type Bytecode as B,
|
|
628
|
+
export { type Bytecode as B, type DagSnapshot as D, type ExpressionRecord as E, type LineExecutionContext as L, OpRegistry as O, type PluginFunctionHandler as P, ScopeManager as S, type VM as V, DependencyGraph as a, type EngineContext as b, createVM as c, executeBytecode as e, sharedOpRegistry as s };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { V as Value } from './Value-
|
|
2
|
-
import { U as UserFunctionDef, A as AnonymousBodyDef, a as BytecodeProgram } from './BytecodeBuilder-
|
|
3
|
-
import { E as EngineError } from './EngineError-
|
|
4
|
-
import { D as DiagnosticPipeline } from './pipeline-
|
|
1
|
+
import { V as Value } from './Value-CXJqDH9J.js';
|
|
2
|
+
import { U as UserFunctionDef, A as AnonymousBodyDef, a as BytecodeProgram } from './BytecodeBuilder-B0xskcv5.js';
|
|
3
|
+
import { E as EngineError } from './EngineError-LU7W7AgI.js';
|
|
4
|
+
import { D as DiagnosticPipeline } from './pipeline-B6k5lCB7.js';
|
|
5
5
|
import { VariableResolver } from './variables.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -19,8 +19,27 @@ import { VariableResolver } from './variables.js';
|
|
|
19
19
|
* @param maxFunctionRecursionDepth - Maximum nested user-defined-function
|
|
20
20
|
* calls (default 50). See the VM interface's `pushCallFrame` doc for why
|
|
21
21
|
* this exists as its own dedicated guard, separate from `maxInstructions`.
|
|
22
|
+
* @param maxCollectionSize - Maximum elements a Range or Matrix may be
|
|
23
|
+
* expanded to by `map`/`reduce` (default 100000). Neither of the two
|
|
24
|
+
* counters above can see that expansion, since it happens inside one
|
|
25
|
+
* opcode and never touches the value stack.
|
|
26
|
+
* @param maxAllocatedElements - Maximum elements one evaluation may
|
|
27
|
+
* materialise in TOTAL (default 2000000). The parameter above bounds one
|
|
28
|
+
* collection; per-site bounds do not compose, and an operation whose result
|
|
29
|
+
* is the product of two legal operands (a matrix multiply) is bounded by
|
|
30
|
+
* neither. See `vm/AllocationBudget.ts`.
|
|
31
|
+
* @param maxFunctionCalls - Maximum user-defined-function calls one
|
|
32
|
+
* evaluation may make in total (default 10000). `maxFunctionRecursionDepth`
|
|
33
|
+
* above bounds how deep they nest and cannot see how many there are: a
|
|
34
|
+
* doubling chain reaches two million calls at a depth of twenty-two.
|
|
35
|
+
* @param maxDateOffsetYears - How far forward `<date> + N workdays` may
|
|
36
|
+
* reach, in years (default 100). The one date offset that walks rather than
|
|
37
|
+
* computing, so the one that needs a ceiling. See `addBusinessDays()`.
|
|
38
|
+
* @param minDateOffsetYears - The same bound backwards, negative (default
|
|
39
|
+
* -100).
|
|
40
|
+
* @param context - Registries belonging to the engine that created this VM.
|
|
22
41
|
*/
|
|
23
|
-
declare function createVM(registry: OpRegistry, maxStackDepth?: number, maxInstructions?: number, maxFunctionRecursionDepth?: number, context?: EngineContext): VM;
|
|
42
|
+
declare function createVM(registry: OpRegistry, maxStackDepth?: number, maxInstructions?: number, maxFunctionRecursionDepth?: number, maxCollectionSize?: number, maxAllocatedElements?: number, maxFunctionCalls?: number, maxDateOffsetYears?: number, minDateOffsetYears?: number, context?: EngineContext): VM;
|
|
24
43
|
/**
|
|
25
44
|
* Compiled bytecode ready for VM execution.
|
|
26
45
|
*
|
|
@@ -310,7 +329,26 @@ declare class OpRegistry {
|
|
|
310
329
|
interface VM {
|
|
311
330
|
push(value: Value): void;
|
|
312
331
|
pop(): Value;
|
|
332
|
+
/**
|
|
333
|
+
* Pop the top of the stack as a number.
|
|
334
|
+
*
|
|
335
|
+
* @throws `STACK_UNDERFLOW` (INTERNAL) if the stack is empty. Unlike
|
|
336
|
+
* `pop()`, which answers an empty stack with `0`, this reports it: a
|
|
337
|
+
* handler asking for a number has no way to tell that `0` from a real
|
|
338
|
+
* one. Every Value converts, so there is no operand-type throw here.
|
|
339
|
+
*/
|
|
313
340
|
popNumber(): number;
|
|
341
|
+
/**
|
|
342
|
+
* Pop the top of the stack as a string, e.g. a unit name a handler's own
|
|
343
|
+
* bytecode pushed for it to read.
|
|
344
|
+
*
|
|
345
|
+
* @throws `STACK_UNDERFLOW` (INTERNAL) if the stack is empty, and
|
|
346
|
+
* `MALFORMED_BYTECODE_OPERAND_TYPE` (VALIDATION, recoverable) if the
|
|
347
|
+
* value on top is not a string. Both are structured `EngineError`s
|
|
348
|
+
* naming this method, in place of the raw TypeError a bare `pop()!` and
|
|
349
|
+
* a compile-time-only cast used to produce somewhere further along. A
|
|
350
|
+
* handler that would rather branch than throw can `peek()` first.
|
|
351
|
+
*/
|
|
314
352
|
popString(): string;
|
|
315
353
|
peek(): Value;
|
|
316
354
|
getStack(): Value[];
|
|
@@ -360,8 +398,39 @@ interface VM {
|
|
|
360
398
|
getScalarEquation(variable: string): ScalarEquationDef | undefined;
|
|
361
399
|
hasScalarEquation(variable: string): boolean;
|
|
362
400
|
reset(): void;
|
|
401
|
+
/** The innermost call frame's bindings, or `undefined` when no call is in progress. Read-only, for building a frame that extends the current one rather than replacing it (see `BIND_UNKNOWN`'s handler). */
|
|
402
|
+
getCallFrame(): ReadonlyMap<string, Value> | undefined;
|
|
363
403
|
getMaxInstructions(): number;
|
|
364
404
|
getMaxStackDepth(): number;
|
|
405
|
+
/** Maximum elements a Range or Matrix may be expanded to by `map`/`reduce`. See `constants/Configuration.ts`'s `maxCollectionSize`. */
|
|
406
|
+
getMaxCollectionSize(): number;
|
|
407
|
+
/**
|
|
408
|
+
* Maximum elements (collection Values, matrix cells) one evaluation may
|
|
409
|
+
* materialise in total.
|
|
410
|
+
*
|
|
411
|
+
* The bound the two limits above cannot be. Both are checked between
|
|
412
|
+
* opcodes, so neither sees what one opcode allocates inside a loop of its
|
|
413
|
+
* own, and `getMaxCollectionSize()` bounds one collection without bounding
|
|
414
|
+
* the total. See `vm/AllocationBudget.ts` for the counter this configures
|
|
415
|
+
* and for why charging goes through that module rather than through the VM.
|
|
416
|
+
*/
|
|
417
|
+
getMaxAllocatedElements(): number;
|
|
418
|
+
/**
|
|
419
|
+
* Maximum user-defined-function calls one evaluation may make in total.
|
|
420
|
+
*
|
|
421
|
+
* `maxFunctionRecursionDepth` (see `pushCallFrame` above) bounds how DEEP
|
|
422
|
+
* calls nest; this bounds how MANY there are, which is a different number
|
|
423
|
+
* and the one a doubling chain runs away with: twenty-two lines of
|
|
424
|
+
* `f(v) = g(v) + g(v)` reach two million calls at a depth of twenty-two.
|
|
425
|
+
* Held by `vm/AllocationBudget.ts` rather than counted here, because it has
|
|
426
|
+
* to survive `executeBytecode()` re-entering itself, exactly like the
|
|
427
|
+
* element tally and unlike `maxInstructions`.
|
|
428
|
+
*/
|
|
429
|
+
getMaxFunctionCalls(): number;
|
|
430
|
+
/** How far forward `<date> + N workdays` may reach, in years. The one date offset that walks the calendar rather than computing, so the one with a ceiling. See `constants/Configuration.ts`'s `date.maxOffsetYears`. */
|
|
431
|
+
getMaxDateOffsetYears(): number;
|
|
432
|
+
/** The same bound backwards, as a negative number of years. */
|
|
433
|
+
getMinDateOffsetYears(): number;
|
|
365
434
|
getInstructionCount(): number;
|
|
366
435
|
incrementInstructions(n: number): void;
|
|
367
436
|
/** Active AbortSignal for the current expression evaluation. Checked before cache writes. */
|
|
@@ -556,4 +625,4 @@ declare class ScopeManager {
|
|
|
556
625
|
clear(): void;
|
|
557
626
|
}
|
|
558
627
|
|
|
559
|
-
export { type Bytecode as B,
|
|
628
|
+
export { type Bytecode as B, type DagSnapshot as D, type ExpressionRecord as E, type LineExecutionContext as L, OpRegistry as O, type PluginFunctionHandler as P, ScopeManager as S, type VM as V, DependencyGraph as a, type EngineContext as b, createVM as c, executeBytecode as e, sharedOpRegistry as s };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { V as Value } from './Value-
|
|
2
|
-
import { V as VM } from './ScopeManager-
|
|
3
|
-
import { U as UserFunctionDef } from './BytecodeBuilder-
|
|
1
|
+
import { V as Value } from './Value-CXJqDH9J.js';
|
|
2
|
+
import { V as VM } from './ScopeManager-udv4Twwq.js';
|
|
3
|
+
import { U as UserFunctionDef } from './BytecodeBuilder-B0xskcv5.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A point-in-time snapshot of VM variable state.
|
|
@@ -168,4 +168,4 @@ declare class VMCheckpointer {
|
|
|
168
168
|
get vmInstance(): VM;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
export {
|
|
171
|
+
export { VMCheckpointer as V, type VMCheckpoint as a };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { V as Value } from './Value-
|
|
2
|
-
import { V as VM } from './ScopeManager-
|
|
3
|
-
import { U as UserFunctionDef } from './BytecodeBuilder-
|
|
1
|
+
import { V as Value } from './Value-CXJqDH9J.cjs';
|
|
2
|
+
import { V as VM } from './ScopeManager-B6GzdhVG.cjs';
|
|
3
|
+
import { U as UserFunctionDef } from './BytecodeBuilder-B0xskcv5.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A point-in-time snapshot of VM variable state.
|
|
@@ -168,4 +168,4 @@ declare class VMCheckpointer {
|
|
|
168
168
|
get vmInstance(): VM;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
export {
|
|
171
|
+
export { VMCheckpointer as V, type VMCheckpoint as a };
|
|
@@ -266,11 +266,14 @@ type DisplayBase = "hex" | "bin" | "oct";
|
|
|
266
266
|
* as zero in arithmetic, and nothing about that failure is visible at the point
|
|
267
267
|
* of use.
|
|
268
268
|
*
|
|
269
|
-
* @param n - The number itself, in full precision.
|
|
269
|
+
* @param n - The number itself, in full precision. A `bigint` is accepted for
|
|
270
|
+
* the same reason the type is numeric at all: `12345678901234567890n as hex`
|
|
271
|
+
* has an exact answer, and forcing it through a double first rendered
|
|
272
|
+
* 0xAB54A98CEB1F0800 for a value ending 0AD2.
|
|
270
273
|
* @param base - How to display it, defaulting to hexadecimal. Carried in the
|
|
271
274
|
* `unit` slot, which is free for this type.
|
|
272
275
|
*/
|
|
273
|
-
declare function hexValue(n: number, base?: DisplayBase): Value;
|
|
276
|
+
declare function hexValue(n: number | bigint, base?: DisplayBase): Value;
|
|
274
277
|
/** Create a BigInt-typed Value (arbitrary-precision integer). */
|
|
275
278
|
declare function bigIntValue(n: bigint): Value;
|
|
276
279
|
/** Create a String-typed Value. */
|
|
@@ -266,11 +266,14 @@ type DisplayBase = "hex" | "bin" | "oct";
|
|
|
266
266
|
* as zero in arithmetic, and nothing about that failure is visible at the point
|
|
267
267
|
* of use.
|
|
268
268
|
*
|
|
269
|
-
* @param n - The number itself, in full precision.
|
|
269
|
+
* @param n - The number itself, in full precision. A `bigint` is accepted for
|
|
270
|
+
* the same reason the type is numeric at all: `12345678901234567890n as hex`
|
|
271
|
+
* has an exact answer, and forcing it through a double first rendered
|
|
272
|
+
* 0xAB54A98CEB1F0800 for a value ending 0AD2.
|
|
270
273
|
* @param base - How to display it, defaulting to hexadecimal. Carried in the
|
|
271
274
|
* `unit` slot, which is free for this type.
|
|
272
275
|
*/
|
|
273
|
-
declare function hexValue(n: number, base?: DisplayBase): Value;
|
|
276
|
+
declare function hexValue(n: number | bigint, base?: DisplayBase): Value;
|
|
274
277
|
/** Create a BigInt-typed Value (arbitrary-precision integer). */
|
|
275
278
|
declare function bigIntValue(n: bigint): Value;
|
|
276
279
|
/** Create a String-typed Value. */
|