openalgo-script 0.1.0-alpha.1 → 0.2.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/CHANGELOG.md +1200 -0
- package/README.md +49 -28
- package/dist/adapters/charts/alerts.d.ts +70 -0
- package/dist/adapters/charts/alerts.d.ts.map +1 -0
- package/dist/adapters/charts/alerts.js +52 -0
- package/dist/adapters/charts/alerts.js.map +1 -0
- package/dist/adapters/charts/bars.d.ts +39 -0
- package/dist/adapters/charts/bars.d.ts.map +1 -0
- package/dist/adapters/charts/bars.js +32 -0
- package/dist/adapters/charts/bars.js.map +1 -0
- package/dist/adapters/charts/candles.d.ts +40 -0
- package/dist/adapters/charts/candles.d.ts.map +1 -0
- package/dist/adapters/charts/candles.js +85 -0
- package/dist/adapters/charts/candles.js.map +1 -0
- package/dist/adapters/charts/colours.d.ts +47 -0
- package/dist/adapters/charts/colours.d.ts.map +1 -0
- package/dist/adapters/charts/colours.js +80 -0
- package/dist/adapters/charts/colours.js.map +1 -0
- package/dist/adapters/charts/columns.d.ts +37 -0
- package/dist/adapters/charts/columns.d.ts.map +1 -0
- package/dist/adapters/charts/columns.js +56 -0
- package/dist/adapters/charts/columns.js.map +1 -0
- package/dist/adapters/charts/contract.d.ts +278 -0
- package/dist/adapters/charts/contract.d.ts.map +1 -0
- package/dist/adapters/charts/contract.js +2 -0
- package/dist/adapters/charts/contract.js.map +1 -0
- package/dist/adapters/charts/descriptor.d.ts +48 -0
- package/dist/adapters/charts/descriptor.d.ts.map +1 -0
- package/dist/adapters/charts/descriptor.js +111 -0
- package/dist/adapters/charts/descriptor.js.map +1 -0
- package/dist/adapters/charts/drawings.d.ts +43 -0
- package/dist/adapters/charts/drawings.d.ts.map +1 -0
- package/dist/adapters/charts/drawings.js +172 -0
- package/dist/adapters/charts/drawings.js.map +1 -0
- package/dist/adapters/charts/errors.d.ts +28 -0
- package/dist/adapters/charts/errors.d.ts.map +1 -0
- package/dist/adapters/charts/errors.js +21 -0
- package/dist/adapters/charts/errors.js.map +1 -0
- package/dist/adapters/charts/fields.d.ts +33 -0
- package/dist/adapters/charts/fields.d.ts.map +1 -0
- package/dist/adapters/charts/fields.js +51 -0
- package/dist/adapters/charts/fields.js.map +1 -0
- package/dist/adapters/charts/fills.d.ts +23 -0
- package/dist/adapters/charts/fills.d.ts.map +1 -0
- package/dist/adapters/charts/fills.js +48 -0
- package/dist/adapters/charts/fills.js.map +1 -0
- package/dist/adapters/charts/index.d.ts +37 -0
- package/dist/adapters/charts/index.d.ts.map +1 -0
- package/dist/adapters/charts/index.js +33 -0
- package/dist/adapters/charts/index.js.map +1 -0
- package/dist/adapters/charts/levels.d.ts +39 -0
- package/dist/adapters/charts/levels.d.ts.map +1 -0
- package/dist/adapters/charts/levels.js +61 -0
- package/dist/adapters/charts/levels.js.map +1 -0
- package/dist/adapters/charts/markers.d.ts +41 -0
- package/dist/adapters/charts/markers.d.ts.map +1 -0
- package/dist/adapters/charts/markers.js +75 -0
- package/dist/adapters/charts/markers.js.map +1 -0
- package/dist/adapters/charts/paint.d.ts +61 -0
- package/dist/adapters/charts/paint.d.ts.map +1 -0
- package/dist/adapters/charts/paint.js +47 -0
- package/dist/adapters/charts/paint.js.map +1 -0
- package/dist/adapters/charts/plots.d.ts +39 -0
- package/dist/adapters/charts/plots.d.ts.map +1 -0
- package/dist/adapters/charts/plots.js +117 -0
- package/dist/adapters/charts/plots.js.map +1 -0
- package/dist/adapters/charts/produced.d.ts +57 -0
- package/dist/adapters/charts/produced.d.ts.map +1 -0
- package/dist/adapters/charts/produced.js +11 -0
- package/dist/adapters/charts/produced.js.map +1 -0
- package/dist/adapters/charts/requests.d.ts +114 -0
- package/dist/adapters/charts/requests.d.ts.map +1 -0
- package/dist/adapters/charts/requests.js +277 -0
- package/dist/adapters/charts/requests.js.map +1 -0
- package/dist/adapters/charts/run.d.ts +147 -0
- package/dist/adapters/charts/run.d.ts.map +1 -0
- package/dist/adapters/charts/run.js +148 -0
- package/dist/adapters/charts/run.js.map +1 -0
- package/dist/adapters/charts/settings.d.ts +78 -0
- package/dist/adapters/charts/settings.d.ts.map +1 -0
- package/dist/adapters/charts/settings.js +225 -0
- package/dist/adapters/charts/settings.js.map +1 -0
- package/dist/adapters/charts/surfaces.d.ts +204 -0
- package/dist/adapters/charts/surfaces.d.ts.map +1 -0
- package/dist/adapters/charts/surfaces.js +2 -0
- package/dist/adapters/charts/surfaces.js.map +1 -0
- package/dist/adapters/charts/tables.d.ts +65 -0
- package/dist/adapters/charts/tables.d.ts.map +1 -0
- package/dist/adapters/charts/tables.js +84 -0
- package/dist/adapters/charts/tables.js.map +1 -0
- package/dist/core/catalogue/catalogue.generated.d.ts +98 -10
- package/dist/core/catalogue/catalogue.generated.d.ts.map +1 -1
- package/dist/core/catalogue/catalogue.generated.js +17 -9
- package/dist/core/catalogue/catalogue.generated.js.map +1 -1
- package/dist/core/catalogue/values.generated.d.ts +25 -0
- package/dist/core/catalogue/values.generated.d.ts.map +1 -1
- package/dist/core/check/arguments.d.ts +41 -0
- package/dist/core/check/arguments.d.ts.map +1 -0
- package/dist/core/check/arguments.js +84 -0
- package/dist/core/check/arguments.js.map +1 -0
- package/dist/core/check/call-sites.d.ts +22 -0
- package/dist/core/check/call-sites.d.ts.map +1 -0
- package/dist/core/check/call-sites.js +329 -0
- package/dist/core/check/call-sites.js.map +1 -0
- package/dist/core/check/call-warmup.d.ts +37 -0
- package/dist/core/check/call-warmup.d.ts.map +1 -0
- package/dist/core/check/call-warmup.js +97 -0
- package/dist/core/check/call-warmup.js.map +1 -0
- package/dist/core/check/calls.d.ts +33 -0
- package/dist/core/check/calls.d.ts.map +1 -0
- package/dist/core/check/calls.js +348 -0
- package/dist/core/check/calls.js.map +1 -0
- package/dist/core/check/check.d.ts +23 -0
- package/dist/core/check/check.d.ts.map +1 -0
- package/dist/core/check/check.js +163 -0
- package/dist/core/check/check.js.map +1 -0
- package/dist/core/check/checked.d.ts +198 -0
- package/dist/core/check/checked.d.ts.map +1 -0
- package/dist/core/check/checked.js +19 -0
- package/dist/core/check/checked.js.map +1 -0
- package/dist/core/check/checker.d.ts +182 -0
- package/dist/core/check/checker.d.ts.map +1 -0
- package/dist/core/check/checker.js +280 -0
- package/dist/core/check/checker.js.map +1 -0
- package/dist/core/check/conditional.d.ts +35 -0
- package/dist/core/check/conditional.d.ts.map +1 -0
- package/dist/core/check/conditional.js +100 -0
- package/dist/core/check/conditional.js.map +1 -0
- package/dist/core/check/constant.d.ts +47 -0
- package/dist/core/check/constant.d.ts.map +1 -0
- package/dist/core/check/constant.js +101 -0
- package/dist/core/check/constant.js.map +1 -0
- package/dist/core/check/declaration.d.ts +33 -0
- package/dist/core/check/declaration.d.ts.map +1 -0
- package/dist/core/check/declaration.js +181 -0
- package/dist/core/check/declaration.js.map +1 -0
- package/dist/core/check/expressions.d.ts +36 -0
- package/dist/core/check/expressions.d.ts.map +1 -0
- package/dist/core/check/expressions.js +398 -0
- package/dist/core/check/expressions.js.map +1 -0
- package/dist/core/check/functions.d.ts +31 -0
- package/dist/core/check/functions.d.ts.map +1 -0
- package/dist/core/check/functions.js +238 -0
- package/dist/core/check/functions.js.map +1 -0
- package/dist/core/check/handles.d.ts +48 -0
- package/dist/core/check/handles.d.ts.map +1 -0
- package/dist/core/check/handles.js +43 -0
- package/dist/core/check/handles.js.map +1 -0
- package/dist/core/check/index.d.ts +30 -0
- package/dist/core/check/index.d.ts.map +1 -0
- package/dist/core/check/index.js +26 -0
- package/dist/core/check/index.js.map +1 -0
- package/dist/core/check/library-bars.d.ts +7 -0
- package/dist/core/check/library-bars.d.ts.map +1 -0
- package/dist/core/check/library-bars.js +181 -0
- package/dist/core/check/library-bars.js.map +1 -0
- package/dist/core/check/library-orders.d.ts +5 -0
- package/dist/core/check/library-orders.d.ts.map +1 -0
- package/dist/core/check/library-orders.js +250 -0
- package/dist/core/check/library-orders.js.map +1 -0
- package/dist/core/check/library-output.d.ts +7 -0
- package/dist/core/check/library-output.d.ts.map +1 -0
- package/dist/core/check/library-output.js +195 -0
- package/dist/core/check/library-output.js.map +1 -0
- package/dist/core/check/library-series.d.ts +3 -0
- package/dist/core/check/library-series.d.ts.map +1 -0
- package/dist/core/check/library-series.js +415 -0
- package/dist/core/check/library-series.js.map +1 -0
- package/dist/core/check/library.d.ts +204 -0
- package/dist/core/check/library.d.ts.map +1 -0
- package/dist/core/check/library.js +198 -0
- package/dist/core/check/library.js.map +1 -0
- package/dist/core/check/literals.d.ts +19 -0
- package/dist/core/check/literals.d.ts.map +1 -0
- package/dist/core/check/literals.js +22 -0
- package/dist/core/check/literals.js.map +1 -0
- package/dist/core/check/outputs.d.ts +31 -0
- package/dist/core/check/outputs.d.ts.map +1 -0
- package/dist/core/check/outputs.js +113 -0
- package/dist/core/check/outputs.js.map +1 -0
- package/dist/core/check/statements.d.ts +25 -0
- package/dist/core/check/statements.d.ts.map +1 -0
- package/dist/core/check/statements.js +377 -0
- package/dist/core/check/statements.js.map +1 -0
- package/dist/core/check/suggest.d.ts +25 -0
- package/dist/core/check/suggest.d.ts.map +1 -0
- package/dist/core/check/suggest.js +61 -0
- package/dist/core/check/suggest.js.map +1 -0
- package/dist/core/check/surface.d.ts +38 -0
- package/dist/core/check/surface.d.ts.map +1 -0
- package/dist/core/check/surface.js +100 -0
- package/dist/core/check/surface.js.map +1 -0
- package/dist/core/check/tags.d.ts +4 -0
- package/dist/core/check/tags.d.ts.map +1 -0
- package/dist/core/check/tags.js +54 -0
- package/dist/core/check/tags.js.map +1 -0
- package/dist/core/check/types.d.ts +153 -0
- package/dist/core/check/types.d.ts.map +1 -0
- package/dist/core/check/types.js +221 -0
- package/dist/core/check/types.js.map +1 -0
- package/dist/core/check/warmup.d.ts +73 -0
- package/dist/core/check/warmup.d.ts.map +1 -0
- package/dist/core/check/warmup.js +62 -0
- package/dist/core/check/warmup.js.map +1 -0
- package/dist/core/diagnostics/collector.d.ts +12 -0
- package/dist/core/diagnostics/collector.d.ts.map +1 -1
- package/dist/core/diagnostics/collector.js +27 -1
- package/dist/core/diagnostics/collector.js.map +1 -1
- package/dist/core/emit/calls.d.ts +38 -0
- package/dist/core/emit/calls.d.ts.map +1 -0
- package/dist/core/emit/calls.js +347 -0
- package/dist/core/emit/calls.js.map +1 -0
- package/dist/core/emit/canonical.d.ts +39 -0
- package/dist/core/emit/canonical.d.ts.map +1 -0
- package/dist/core/emit/canonical.js +71 -0
- package/dist/core/emit/canonical.js.map +1 -0
- package/dist/core/emit/channels.d.ts +28 -0
- package/dist/core/emit/channels.d.ts.map +1 -0
- package/dist/core/emit/channels.js +110 -0
- package/dist/core/emit/channels.js.map +1 -0
- package/dist/core/emit/code.d.ts +75 -0
- package/dist/core/emit/code.d.ts.map +1 -0
- package/dist/core/emit/code.js +104 -0
- package/dist/core/emit/code.js.map +1 -0
- package/dist/core/emit/colours.d.ts +35 -0
- package/dist/core/emit/colours.d.ts.map +1 -0
- package/dist/core/emit/colours.js +50 -0
- package/dist/core/emit/colours.js.map +1 -0
- package/dist/core/emit/context.d.ts +271 -0
- package/dist/core/emit/context.d.ts.map +1 -0
- package/dist/core/emit/context.js +358 -0
- package/dist/core/emit/context.js.map +1 -0
- package/dist/core/emit/defaults.d.ts +45 -0
- package/dist/core/emit/defaults.d.ts.map +1 -0
- package/dist/core/emit/defaults.js +116 -0
- package/dist/core/emit/defaults.js.map +1 -0
- package/dist/core/emit/emit.d.ts +13 -0
- package/dist/core/emit/emit.d.ts.map +1 -0
- package/dist/core/emit/emit.js +281 -0
- package/dist/core/emit/emit.js.map +1 -0
- package/dist/core/emit/events.d.ts +21 -0
- package/dist/core/emit/events.d.ts.map +1 -0
- package/dist/core/emit/events.js +112 -0
- package/dist/core/emit/events.js.map +1 -0
- package/dist/core/emit/expressions.d.ts +23 -0
- package/dist/core/emit/expressions.d.ts.map +1 -0
- package/dist/core/emit/expressions.js +253 -0
- package/dist/core/emit/expressions.js.map +1 -0
- package/dist/core/emit/functions.d.ts +30 -0
- package/dist/core/emit/functions.d.ts.map +1 -0
- package/dist/core/emit/functions.js +171 -0
- package/dist/core/emit/functions.js.map +1 -0
- package/dist/core/emit/gaps.d.ts +34 -0
- package/dist/core/emit/gaps.d.ts.map +1 -0
- package/dist/core/emit/gaps.js +16 -0
- package/dist/core/emit/gaps.js.map +1 -0
- package/dist/core/emit/index.d.ts +29 -0
- package/dist/core/emit/index.d.ts.map +1 -0
- package/dist/core/emit/index.js +23 -0
- package/dist/core/emit/index.js.map +1 -0
- package/dist/core/emit/inputs.d.ts +47 -0
- package/dist/core/emit/inputs.d.ts.map +1 -0
- package/dist/core/emit/inputs.js +150 -0
- package/dist/core/emit/inputs.js.map +1 -0
- package/dist/core/emit/layout.d.ts +73 -0
- package/dist/core/emit/layout.d.ts.map +1 -0
- package/dist/core/emit/layout.js +126 -0
- package/dist/core/emit/layout.js.map +1 -0
- package/dist/core/emit/meta.d.ts +14 -0
- package/dist/core/emit/meta.d.ts.map +1 -0
- package/dist/core/emit/meta.js +68 -0
- package/dist/core/emit/meta.js.map +1 -0
- package/dist/core/emit/opcodes.d.ts +28 -0
- package/dist/core/emit/opcodes.d.ts.map +1 -0
- package/dist/core/emit/opcodes.js +137 -0
- package/dist/core/emit/opcodes.js.map +1 -0
- package/dist/core/emit/outputs.d.ts +67 -0
- package/dist/core/emit/outputs.d.ts.map +1 -0
- package/dist/core/emit/outputs.js +293 -0
- package/dist/core/emit/outputs.js.map +1 -0
- package/dist/core/emit/pool.d.ts +33 -0
- package/dist/core/emit/pool.d.ts.map +1 -0
- package/dist/core/emit/pool.js +79 -0
- package/dist/core/emit/pool.js.map +1 -0
- package/dist/core/emit/program.d.ts +333 -0
- package/dist/core/emit/program.d.ts.map +1 -0
- package/dist/core/emit/program.js +15 -0
- package/dist/core/emit/program.js.map +1 -0
- package/dist/core/emit/registers.d.ts +35 -0
- package/dist/core/emit/registers.d.ts.map +1 -0
- package/dist/core/emit/registers.js +170 -0
- package/dist/core/emit/registers.js.map +1 -0
- package/dist/core/emit/request-scope.d.ts +36 -0
- package/dist/core/emit/request-scope.d.ts.map +1 -0
- package/dist/core/emit/request-scope.js +41 -0
- package/dist/core/emit/request-scope.js.map +1 -0
- package/dist/core/emit/requests.d.ts +69 -0
- package/dist/core/emit/requests.d.ts.map +1 -0
- package/dist/core/emit/requests.js +230 -0
- package/dist/core/emit/requests.js.map +1 -0
- package/dist/core/emit/requires.d.ts +4 -0
- package/dist/core/emit/requires.d.ts.map +1 -0
- package/dist/core/emit/requires.js +71 -0
- package/dist/core/emit/requires.js.map +1 -0
- package/dist/core/emit/sha256.d.ts +24 -0
- package/dist/core/emit/sha256.d.ts.map +1 -0
- package/dist/core/emit/sha256.js +109 -0
- package/dist/core/emit/sha256.js.map +1 -0
- package/dist/core/emit/statements.d.ts +20 -0
- package/dist/core/emit/statements.d.ts.map +1 -0
- package/dist/core/emit/statements.js +393 -0
- package/dist/core/emit/statements.js.map +1 -0
- package/dist/core/emit/values.d.ts +80 -0
- package/dist/core/emit/values.d.ts.map +1 -0
- package/dist/core/emit/values.js +242 -0
- package/dist/core/emit/values.js.map +1 -0
- package/dist/core/engine/alerts.d.ts +66 -0
- package/dist/core/engine/alerts.d.ts.map +1 -0
- package/dist/core/engine/alerts.js +119 -0
- package/dist/core/engine/alerts.js.map +1 -0
- package/dist/core/engine/arithmetic.d.ts +82 -0
- package/dist/core/engine/arithmetic.d.ts.map +1 -0
- package/dist/core/engine/arithmetic.js +141 -0
- package/dist/core/engine/arithmetic.js.map +1 -0
- package/dist/core/engine/bars.d.ts +95 -0
- package/dist/core/engine/bars.d.ts.map +1 -0
- package/dist/core/engine/bars.js +133 -0
- package/dist/core/engine/bars.js.map +1 -0
- package/dist/core/engine/budget.d.ts +162 -0
- package/dist/core/engine/budget.d.ts.map +1 -0
- package/dist/core/engine/budget.js +188 -0
- package/dist/core/engine/budget.js.map +1 -0
- package/dist/core/engine/channels.d.ts +106 -0
- package/dist/core/engine/channels.d.ts.map +1 -0
- package/dist/core/engine/channels.js +99 -0
- package/dist/core/engine/channels.js.map +1 -0
- package/dist/core/engine/drawings.d.ts +64 -0
- package/dist/core/engine/drawings.d.ts.map +1 -0
- package/dist/core/engine/drawings.js +67 -0
- package/dist/core/engine/drawings.js.map +1 -0
- package/dist/core/engine/engine.d.ts +140 -0
- package/dist/core/engine/engine.d.ts.map +1 -0
- package/dist/core/engine/engine.js +405 -0
- package/dist/core/engine/engine.js.map +1 -0
- package/dist/core/engine/errors.d.ts +64 -0
- package/dist/core/engine/errors.d.ts.map +1 -0
- package/dist/core/engine/errors.js +63 -0
- package/dist/core/engine/errors.js.map +1 -0
- package/dist/core/engine/frames.d.ts +48 -0
- package/dist/core/engine/frames.d.ts.map +1 -0
- package/dist/core/engine/frames.js +41 -0
- package/dist/core/engine/frames.js.map +1 -0
- package/dist/core/engine/grids.d.ts +25 -0
- package/dist/core/engine/grids.d.ts.map +1 -0
- package/dist/core/engine/grids.js +77 -0
- package/dist/core/engine/grids.js.map +1 -0
- package/dist/core/engine/guard.d.ts +4 -0
- package/dist/core/engine/guard.d.ts.map +1 -0
- package/dist/core/engine/guard.js +46 -0
- package/dist/core/engine/guard.js.map +1 -0
- package/dist/core/engine/host.d.ts +219 -0
- package/dist/core/engine/host.d.ts.map +1 -0
- package/dist/core/engine/host.js +38 -0
- package/dist/core/engine/host.js.map +1 -0
- package/dist/core/engine/index.d.ts +49 -0
- package/dist/core/engine/index.d.ts.map +1 -0
- package/dist/core/engine/index.js +33 -0
- package/dist/core/engine/index.js.map +1 -0
- package/dist/core/engine/inputs.d.ts +77 -0
- package/dist/core/engine/inputs.d.ts.map +1 -0
- package/dist/core/engine/inputs.js +205 -0
- package/dist/core/engine/inputs.js.map +1 -0
- package/dist/core/engine/ledger/call.d.ts +63 -0
- package/dist/core/engine/ledger/call.d.ts.map +1 -0
- package/dist/core/engine/ledger/call.js +136 -0
- package/dist/core/engine/ledger/call.js.map +1 -0
- package/dist/core/engine/ledger/closable.d.ts +155 -0
- package/dist/core/engine/ledger/closable.d.ts.map +1 -0
- package/dist/core/engine/ledger/closable.js +173 -0
- package/dist/core/engine/ledger/closable.js.map +1 -0
- package/dist/core/engine/ledger/holdings.d.ts +194 -0
- package/dist/core/engine/ledger/holdings.d.ts.map +1 -0
- package/dist/core/engine/ledger/holdings.js +237 -0
- package/dist/core/engine/ledger/holdings.js.map +1 -0
- package/dist/core/engine/ledger/index.d.ts +19 -0
- package/dist/core/engine/ledger/index.d.ts.map +1 -0
- package/dist/core/engine/ledger/index.js +2 -0
- package/dist/core/engine/ledger/index.js.map +1 -0
- package/dist/core/engine/ledger/intent.d.ts +106 -0
- package/dist/core/engine/ledger/intent.d.ts.map +1 -0
- package/dist/core/engine/ledger/intent.js +21 -0
- package/dist/core/engine/ledger/intent.js.map +1 -0
- package/dist/core/engine/ledger/ledger.d.ts +143 -0
- package/dist/core/engine/ledger/ledger.d.ts.map +1 -0
- package/dist/core/engine/ledger/ledger.js +237 -0
- package/dist/core/engine/ledger/ledger.js.map +1 -0
- package/dist/core/engine/ledger/place.d.ts +75 -0
- package/dist/core/engine/ledger/place.d.ts.map +1 -0
- package/dist/core/engine/ledger/place.js +174 -0
- package/dist/core/engine/ledger/place.js.map +1 -0
- package/dist/core/engine/ledger/positions.d.ts +68 -0
- package/dist/core/engine/ledger/positions.d.ts.map +1 -0
- package/dist/core/engine/ledger/positions.js +114 -0
- package/dist/core/engine/ledger/positions.js.map +1 -0
- package/dist/core/engine/ledger/refuse.d.ts +43 -0
- package/dist/core/engine/ledger/refuse.d.ts.map +1 -0
- package/dist/core/engine/ledger/refuse.js +329 -0
- package/dist/core/engine/ledger/refuse.js.map +1 -0
- package/dist/core/engine/ledger/row.d.ts +176 -0
- package/dist/core/engine/ledger/row.d.ts.map +1 -0
- package/dist/core/engine/ledger/row.js +169 -0
- package/dist/core/engine/ledger/row.js.map +1 -0
- package/dist/core/engine/ledger/sizing.d.ts +142 -0
- package/dist/core/engine/ledger/sizing.d.ts.map +1 -0
- package/dist/core/engine/ledger/sizing.js +223 -0
- package/dist/core/engine/ledger/sizing.js.map +1 -0
- package/dist/core/engine/library/arrays.d.ts +14 -0
- package/dist/core/engine/library/arrays.d.ts.map +1 -0
- package/dist/core/engine/library/arrays.js +285 -0
- package/dist/core/engine/library/arrays.js.map +1 -0
- package/dist/core/engine/library/averages.d.ts +9 -0
- package/dist/core/engine/library/averages.d.ts.map +1 -0
- package/dist/core/engine/library/averages.js +41 -0
- package/dist/core/engine/library/averages.js.map +1 -0
- package/dist/core/engine/library/binding.d.ts +230 -0
- package/dist/core/engine/library/binding.d.ts.map +1 -0
- package/dist/core/engine/library/binding.js +109 -0
- package/dist/core/engine/library/binding.js.map +1 -0
- package/dist/core/engine/library/chart.d.ts +3 -0
- package/dist/core/engine/library/chart.d.ts.map +1 -0
- package/dist/core/engine/library/chart.js +83 -0
- package/dist/core/engine/library/chart.js.map +1 -0
- package/dist/core/engine/library/colours.d.ts +26 -0
- package/dist/core/engine/library/colours.d.ts.map +1 -0
- package/dist/core/engine/library/colours.js +81 -0
- package/dist/core/engine/library/colours.js.map +1 -0
- package/dist/core/engine/library/dates.d.ts +3 -0
- package/dist/core/engine/library/dates.d.ts.map +1 -0
- package/dist/core/engine/library/dates.js +75 -0
- package/dist/core/engine/library/dates.js.map +1 -0
- package/dist/core/engine/library/index.d.ts +13 -0
- package/dist/core/engine/library/index.d.ts.map +1 -0
- package/dist/core/engine/library/index.js +86 -0
- package/dist/core/engine/library/index.js.map +1 -0
- package/dist/core/engine/library/maths.d.ts +3 -0
- package/dist/core/engine/library/maths.d.ts.map +1 -0
- package/dist/core/engine/library/maths.js +89 -0
- package/dist/core/engine/library/maths.js.map +1 -0
- package/dist/core/engine/library/objects.d.ts +3 -0
- package/dist/core/engine/library/objects.d.ts.map +1 -0
- package/dist/core/engine/library/objects.js +199 -0
- package/dist/core/engine/library/objects.js.map +1 -0
- package/dist/core/engine/library/oscillators.d.ts +3 -0
- package/dist/core/engine/library/oscillators.d.ts.map +1 -0
- package/dist/core/engine/library/oscillators.js +29 -0
- package/dist/core/engine/library/oscillators.js.map +1 -0
- package/dist/core/engine/library/ranges.d.ts +3 -0
- package/dist/core/engine/library/ranges.d.ts.map +1 -0
- package/dist/core/engine/library/ranges.js +23 -0
- package/dist/core/engine/library/ranges.js.map +1 -0
- package/dist/core/engine/library/series.d.ts +3 -0
- package/dist/core/engine/library/series.d.ts.map +1 -0
- package/dist/core/engine/library/series.js +46 -0
- package/dist/core/engine/library/series.js.map +1 -0
- package/dist/core/engine/library/state.d.ts +35 -0
- package/dist/core/engine/library/state.d.ts.map +1 -0
- package/dist/core/engine/library/state.js +19 -0
- package/dist/core/engine/library/state.js.map +1 -0
- package/dist/core/engine/library/studies.d.ts +3 -0
- package/dist/core/engine/library/studies.d.ts.map +1 -0
- package/dist/core/engine/library/studies.js +35 -0
- package/dist/core/engine/library/studies.js.map +1 -0
- package/dist/core/engine/library/text.d.ts +6 -0
- package/dist/core/engine/library/text.d.ts.map +1 -0
- package/dist/core/engine/library/text.js +280 -0
- package/dist/core/engine/library/text.js.map +1 -0
- package/dist/core/engine/library/trend.d.ts +3 -0
- package/dist/core/engine/library/trend.d.ts.map +1 -0
- package/dist/core/engine/library/trend.js +29 -0
- package/dist/core/engine/library/trend.js.map +1 -0
- package/dist/core/engine/library/volume.d.ts +3 -0
- package/dist/core/engine/library/volume.d.ts.map +1 -0
- package/dist/core/engine/library/volume.js +51 -0
- package/dist/core/engine/library/volume.js.map +1 -0
- package/dist/core/engine/load.d.ts +45 -0
- package/dist/core/engine/load.d.ts.map +1 -0
- package/dist/core/engine/load.js +60 -0
- package/dist/core/engine/load.js.map +1 -0
- package/dist/core/engine/machine.d.ts +107 -0
- package/dist/core/engine/machine.d.ts.map +1 -0
- package/dist/core/engine/machine.js +337 -0
- package/dist/core/engine/machine.js.map +1 -0
- package/dist/core/engine/memory.d.ts +60 -0
- package/dist/core/engine/memory.d.ts.map +1 -0
- package/dist/core/engine/memory.js +92 -0
- package/dist/core/engine/memory.js.map +1 -0
- package/dist/core/engine/operations.d.ts +62 -0
- package/dist/core/engine/operations.d.ts.map +1 -0
- package/dist/core/engine/operations.js +149 -0
- package/dist/core/engine/operations.js.map +1 -0
- package/dist/core/engine/orders.d.ts +56 -0
- package/dist/core/engine/orders.d.ts.map +1 -0
- package/dist/core/engine/orders.js +83 -0
- package/dist/core/engine/orders.js.map +1 -0
- package/dist/core/engine/registers.d.ts +50 -0
- package/dist/core/engine/registers.d.ts.map +1 -0
- package/dist/core/engine/registers.js +85 -0
- package/dist/core/engine/registers.js.map +1 -0
- package/dist/core/engine/request-body.d.ts +138 -0
- package/dist/core/engine/request-body.d.ts.map +1 -0
- package/dist/core/engine/request-body.js +227 -0
- package/dist/core/engine/request-body.js.map +1 -0
- package/dist/core/engine/request-plan.d.ts +79 -0
- package/dist/core/engine/request-plan.d.ts.map +1 -0
- package/dist/core/engine/request-plan.js +228 -0
- package/dist/core/engine/request-plan.js.map +1 -0
- package/dist/core/engine/requests.d.ts +105 -0
- package/dist/core/engine/requests.d.ts.map +1 -0
- package/dist/core/engine/requests.js +260 -0
- package/dist/core/engine/requests.js.map +1 -0
- package/dist/core/engine/results.d.ts +40 -0
- package/dist/core/engine/results.d.ts.map +1 -0
- package/dist/core/engine/results.js +2 -0
- package/dist/core/engine/results.js.map +1 -0
- package/dist/core/engine/series.d.ts +61 -0
- package/dist/core/engine/series.d.ts.map +1 -0
- package/dist/core/engine/series.js +41 -0
- package/dist/core/engine/series.js.map +1 -0
- package/dist/core/engine/session/hours.d.ts +49 -0
- package/dist/core/engine/session/hours.d.ts.map +1 -0
- package/dist/core/engine/session/hours.js +31 -0
- package/dist/core/engine/session/hours.js.map +1 -0
- package/dist/core/engine/session/index.d.ts +17 -0
- package/dist/core/engine/session/index.d.ts.map +1 -0
- package/dist/core/engine/session/index.js +3 -0
- package/dist/core/engine/session/index.js.map +1 -0
- package/dist/core/engine/session/record.d.ts +56 -0
- package/dist/core/engine/session/record.d.ts.map +1 -0
- package/dist/core/engine/session/record.js +165 -0
- package/dist/core/engine/session/record.js.map +1 -0
- package/dist/core/engine/session/spec.d.ts +19 -0
- package/dist/core/engine/session/spec.d.ts.map +1 -0
- package/dist/core/engine/session/spec.js +31 -0
- package/dist/core/engine/session/spec.js.map +1 -0
- package/dist/core/engine/timeframe.d.ts +59 -0
- package/dist/core/engine/timeframe.d.ts.map +1 -0
- package/dist/core/engine/timeframe.js +140 -0
- package/dist/core/engine/timeframe.js.map +1 -0
- package/dist/core/engine/types.d.ts +15 -0
- package/dist/core/engine/types.d.ts.map +1 -0
- package/dist/core/engine/types.js +2 -0
- package/dist/core/engine/types.js.map +1 -0
- package/dist/core/engine/values/heap.d.ts +134 -0
- package/dist/core/engine/values/heap.d.ts.map +1 -0
- package/dist/core/engine/values/heap.js +230 -0
- package/dist/core/engine/values/heap.js.map +1 -0
- package/dist/core/engine/values/index.d.ts +13 -0
- package/dist/core/engine/values/index.d.ts.map +1 -0
- package/dist/core/engine/values/index.js +3 -0
- package/dist/core/engine/values/index.js.map +1 -0
- package/dist/core/engine/values/value.d.ts +82 -0
- package/dist/core/engine/values/value.d.ts.map +1 -0
- package/dist/core/engine/values/value.js +134 -0
- package/dist/core/engine/values/value.js.map +1 -0
- package/dist/core/engine/verify-budgets.d.ts +35 -0
- package/dist/core/engine/verify-budgets.d.ts.map +1 -0
- package/dist/core/engine/verify-budgets.js +172 -0
- package/dist/core/engine/verify-budgets.js.map +1 -0
- package/dist/core/engine/verify-code.d.ts +32 -0
- package/dist/core/engine/verify-code.d.ts.map +1 -0
- package/dist/core/engine/verify-code.js +278 -0
- package/dist/core/engine/verify-code.js.map +1 -0
- package/dist/core/engine/verify-requests.d.ts +44 -0
- package/dist/core/engine/verify-requests.d.ts.map +1 -0
- package/dist/core/engine/verify-requests.js +220 -0
- package/dist/core/engine/verify-requests.js.map +1 -0
- package/dist/core/engine/verify-shape.d.ts +46 -0
- package/dist/core/engine/verify-shape.d.ts.map +1 -0
- package/dist/core/engine/verify-shape.js +147 -0
- package/dist/core/engine/verify-shape.js.map +1 -0
- package/dist/core/engine/verify-tables.d.ts +19 -0
- package/dist/core/engine/verify-tables.d.ts.map +1 -0
- package/dist/core/engine/verify-tables.js +171 -0
- package/dist/core/engine/verify-tables.js.map +1 -0
- package/dist/core/engine/verify.d.ts +19 -0
- package/dist/core/engine/verify.d.ts.map +1 -0
- package/dist/core/engine/verify.js +309 -0
- package/dist/core/engine/verify.js.map +1 -0
- package/dist/core/index.d.ts +61 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +48 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/parse/expressions.js +1 -1
- package/dist/core/parse/expressions.js.map +1 -1
- package/dist/core/parse/names.d.ts +7 -1
- package/dist/core/parse/names.d.ts.map +1 -1
- package/dist/core/parse/names.js +28 -2
- package/dist/core/parse/names.js.map +1 -1
- package/dist/core/stdlib/averages/exponential.d.ts +51 -0
- package/dist/core/stdlib/averages/exponential.d.ts.map +1 -0
- package/dist/core/stdlib/averages/exponential.js +72 -0
- package/dist/core/stdlib/averages/exponential.js.map +1 -0
- package/dist/core/stdlib/averages/index.d.ts +7 -0
- package/dist/core/stdlib/averages/index.d.ts.map +1 -0
- package/dist/core/stdlib/averages/index.js +5 -0
- package/dist/core/stdlib/averages/index.js.map +1 -0
- package/dist/core/stdlib/averages/select.d.ts +35 -0
- package/dist/core/stdlib/averages/select.d.ts.map +1 -0
- package/dist/core/stdlib/averages/select.js +43 -0
- package/dist/core/stdlib/averages/select.js.map +1 -0
- package/dist/core/stdlib/averages/shaped.d.ts +61 -0
- package/dist/core/stdlib/averages/shaped.d.ts.map +1 -0
- package/dist/core/stdlib/averages/shaped.js +126 -0
- package/dist/core/stdlib/averages/shaped.js.map +1 -0
- package/dist/core/stdlib/averages/simple.d.ts +58 -0
- package/dist/core/stdlib/averages/simple.d.ts.map +1 -0
- package/dist/core/stdlib/averages/simple.js +92 -0
- package/dist/core/stdlib/averages/simple.js.map +1 -0
- package/dist/core/stdlib/calendar/civil.d.ts +56 -0
- package/dist/core/stdlib/calendar/civil.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/civil.js +70 -0
- package/dist/core/stdlib/calendar/civil.js.map +1 -0
- package/dist/core/stdlib/calendar/fields.d.ts +36 -0
- package/dist/core/stdlib/calendar/fields.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/fields.js +93 -0
- package/dist/core/stdlib/calendar/fields.js.map +1 -0
- package/dist/core/stdlib/calendar/format.d.ts +19 -0
- package/dist/core/stdlib/calendar/format.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/format.js +51 -0
- package/dist/core/stdlib/calendar/format.js.map +1 -0
- package/dist/core/stdlib/calendar/index.d.ts +7 -0
- package/dist/core/stdlib/calendar/index.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/index.js +5 -0
- package/dist/core/stdlib/calendar/index.js.map +1 -0
- package/dist/core/stdlib/calendar/zone.d.ts +53 -0
- package/dist/core/stdlib/calendar/zone.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/zone.js +138 -0
- package/dist/core/stdlib/calendar/zone.js.map +1 -0
- package/dist/core/stdlib/index.d.ts +57 -0
- package/dist/core/stdlib/index.d.ts.map +1 -0
- package/dist/core/stdlib/index.js +51 -0
- package/dist/core/stdlib/index.js.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts +38 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.js +66 -0
- package/dist/core/stdlib/maths/arithmetic.js.map +1 -0
- package/dist/core/stdlib/maths/elementary.d.ts +65 -0
- package/dist/core/stdlib/maths/elementary.d.ts.map +1 -0
- package/dist/core/stdlib/maths/elementary.js +93 -0
- package/dist/core/stdlib/maths/elementary.js.map +1 -0
- package/dist/core/stdlib/maths/index.d.ts +4 -0
- package/dist/core/stdlib/maths/index.d.ts.map +1 -0
- package/dist/core/stdlib/maths/index.js +4 -0
- package/dist/core/stdlib/maths/index.js.map +1 -0
- package/dist/core/stdlib/maths/rounding.d.ts +43 -0
- package/dist/core/stdlib/maths/rounding.d.ts.map +1 -0
- package/dist/core/stdlib/maths/rounding.js +62 -0
- package/dist/core/stdlib/maths/rounding.js.map +1 -0
- package/dist/core/stdlib/momentum/convergence.d.ts +36 -0
- package/dist/core/stdlib/momentum/convergence.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/convergence.js +48 -0
- package/dist/core/stdlib/momentum/convergence.js.map +1 -0
- package/dist/core/stdlib/momentum/index.d.ts +6 -0
- package/dist/core/stdlib/momentum/index.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/index.js +6 -0
- package/dist/core/stdlib/momentum/index.js.map +1 -0
- package/dist/core/stdlib/momentum/pressure.d.ts +43 -0
- package/dist/core/stdlib/momentum/pressure.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/pressure.js +103 -0
- package/dist/core/stdlib/momentum/pressure.js.map +1 -0
- package/dist/core/stdlib/momentum/rates.d.ts +74 -0
- package/dist/core/stdlib/momentum/rates.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rates.js +134 -0
- package/dist/core/stdlib/momentum/rates.js.map +1 -0
- package/dist/core/stdlib/momentum/rsi.d.ts +21 -0
- package/dist/core/stdlib/momentum/rsi.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rsi.js +30 -0
- package/dist/core/stdlib/momentum/rsi.js.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts +44 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.js +97 -0
- package/dist/core/stdlib/momentum/stochastic.js.map +1 -0
- package/dist/core/stdlib/series/changes.d.ts +59 -0
- package/dist/core/stdlib/series/changes.d.ts.map +1 -0
- package/dist/core/stdlib/series/changes.js +129 -0
- package/dist/core/stdlib/series/changes.js.map +1 -0
- package/dist/core/stdlib/series/conditions.d.ts +34 -0
- package/dist/core/stdlib/series/conditions.d.ts.map +1 -0
- package/dist/core/stdlib/series/conditions.js +52 -0
- package/dist/core/stdlib/series/conditions.js.map +1 -0
- package/dist/core/stdlib/series/extremes.d.ts +29 -0
- package/dist/core/stdlib/series/extremes.d.ts.map +1 -0
- package/dist/core/stdlib/series/extremes.js +62 -0
- package/dist/core/stdlib/series/extremes.js.map +1 -0
- package/dist/core/stdlib/series/index.d.ts +9 -0
- package/dist/core/stdlib/series/index.d.ts.map +1 -0
- package/dist/core/stdlib/series/index.js +7 -0
- package/dist/core/stdlib/series/index.js.map +1 -0
- package/dist/core/stdlib/series/pivots.d.ts +25 -0
- package/dist/core/stdlib/series/pivots.d.ts.map +1 -0
- package/dist/core/stdlib/series/pivots.js +42 -0
- package/dist/core/stdlib/series/pivots.js.map +1 -0
- package/dist/core/stdlib/series/statistics.d.ts +64 -0
- package/dist/core/stdlib/series/statistics.d.ts.map +1 -0
- package/dist/core/stdlib/series/statistics.js +148 -0
- package/dist/core/stdlib/series/statistics.js.map +1 -0
- package/dist/core/stdlib/series/totals.d.ts +68 -0
- package/dist/core/stdlib/series/totals.d.ts.map +1 -0
- package/dist/core/stdlib/series/totals.js +115 -0
- package/dist/core/stdlib/series/totals.js.map +1 -0
- package/dist/core/stdlib/trend/directional.d.ts +69 -0
- package/dist/core/stdlib/trend/directional.d.ts.map +1 -0
- package/dist/core/stdlib/trend/directional.js +151 -0
- package/dist/core/stdlib/trend/directional.js.map +1 -0
- package/dist/core/stdlib/trend/index.d.ts +4 -0
- package/dist/core/stdlib/trend/index.d.ts.map +1 -0
- package/dist/core/stdlib/trend/index.js +4 -0
- package/dist/core/stdlib/trend/index.js.map +1 -0
- package/dist/core/stdlib/trend/psar.d.ts +33 -0
- package/dist/core/stdlib/trend/psar.d.ts.map +1 -0
- package/dist/core/stdlib/trend/psar.js +86 -0
- package/dist/core/stdlib/trend/psar.js.map +1 -0
- package/dist/core/stdlib/trend/supertrend.d.ts +30 -0
- package/dist/core/stdlib/trend/supertrend.d.ts.map +1 -0
- package/dist/core/stdlib/trend/supertrend.js +65 -0
- package/dist/core/stdlib/trend/supertrend.js.map +1 -0
- package/dist/core/stdlib/values/bar.d.ts +39 -0
- package/dist/core/stdlib/values/bar.d.ts.map +1 -0
- package/dist/core/stdlib/values/bar.js +33 -0
- package/dist/core/stdlib/values/bar.js.map +1 -0
- package/dist/core/stdlib/values/index.d.ts +11 -0
- package/dist/core/stdlib/values/index.d.ts.map +1 -0
- package/dist/core/stdlib/values/index.js +6 -0
- package/dist/core/stdlib/values/index.js.map +1 -0
- package/dist/core/stdlib/values/lookback.d.ts +83 -0
- package/dist/core/stdlib/values/lookback.d.ts.map +1 -0
- package/dist/core/stdlib/values/lookback.js +134 -0
- package/dist/core/stdlib/values/lookback.js.map +1 -0
- package/dist/core/stdlib/values/region.d.ts +55 -0
- package/dist/core/stdlib/values/region.d.ts.map +1 -0
- package/dist/core/stdlib/values/region.js +73 -0
- package/dist/core/stdlib/values/region.js.map +1 -0
- package/dist/core/stdlib/values/tail.d.ts +44 -0
- package/dist/core/stdlib/values/tail.d.ts.map +1 -0
- package/dist/core/stdlib/values/tail.js +23 -0
- package/dist/core/stdlib/values/tail.js.map +1 -0
- package/dist/core/stdlib/values/value.d.ts +64 -0
- package/dist/core/stdlib/values/value.d.ts.map +1 -0
- package/dist/core/stdlib/values/value.js +61 -0
- package/dist/core/stdlib/values/value.js.map +1 -0
- package/dist/core/stdlib/volatility/bands.d.ts +50 -0
- package/dist/core/stdlib/volatility/bands.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/bands.js +101 -0
- package/dist/core/stdlib/volatility/bands.js.map +1 -0
- package/dist/core/stdlib/volatility/deviation.d.ts +43 -0
- package/dist/core/stdlib/volatility/deviation.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/deviation.js +75 -0
- package/dist/core/stdlib/volatility/deviation.js.map +1 -0
- package/dist/core/stdlib/volatility/index.d.ts +6 -0
- package/dist/core/stdlib/volatility/index.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/index.js +5 -0
- package/dist/core/stdlib/volatility/index.js.map +1 -0
- package/dist/core/stdlib/volatility/measures.d.ts +48 -0
- package/dist/core/stdlib/volatility/measures.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/measures.js +73 -0
- package/dist/core/stdlib/volatility/measures.js.map +1 -0
- package/dist/core/stdlib/volatility/range.d.ts +69 -0
- package/dist/core/stdlib/volatility/range.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/range.js +86 -0
- package/dist/core/stdlib/volatility/range.js.map +1 -0
- package/dist/core/stdlib/volume/accumulation.d.ts +61 -0
- package/dist/core/stdlib/volume/accumulation.d.ts.map +1 -0
- package/dist/core/stdlib/volume/accumulation.js +127 -0
- package/dist/core/stdlib/volume/accumulation.js.map +1 -0
- package/dist/core/stdlib/volume/flow.d.ts +60 -0
- package/dist/core/stdlib/volume/flow.d.ts.map +1 -0
- package/dist/core/stdlib/volume/flow.js +125 -0
- package/dist/core/stdlib/volume/flow.js.map +1 -0
- package/dist/core/stdlib/volume/index.d.ts +5 -0
- package/dist/core/stdlib/volume/index.d.ts.map +1 -0
- package/dist/core/stdlib/volume/index.js +4 -0
- package/dist/core/stdlib/volume/index.js.map +1 -0
- package/dist/core/stdlib/volume/weighted.d.ts +52 -0
- package/dist/core/stdlib/volume/weighted.d.ts.map +1 -0
- package/dist/core/stdlib/volume/weighted.js +64 -0
- package/dist/core/stdlib/volume/weighted.js.map +1 -0
- package/dist/core/version/version.generated.d.ts +2 -2
- package/dist/core/version/version.generated.d.ts.map +1 -1
- package/dist/core/version/version.generated.js +2 -2
- package/dist/core/version/version.generated.js.map +1 -1
- package/package.json +38 -14
- package/spec/errors.json +382 -183
- package/src/adapters/charts/alerts.ts +116 -0
- package/src/adapters/charts/bars.ts +63 -0
- package/src/adapters/charts/candles.ts +137 -0
- package/src/adapters/charts/colours.ts +113 -0
- package/src/adapters/charts/columns.ts +99 -0
- package/src/adapters/charts/contract.ts +320 -0
- package/src/adapters/charts/descriptor.ts +199 -0
- package/src/adapters/charts/drawings.ts +213 -0
- package/src/adapters/charts/errors.ts +45 -0
- package/src/adapters/charts/fields.ts +74 -0
- package/src/adapters/charts/fills.ts +71 -0
- package/src/adapters/charts/index.ts +78 -0
- package/src/adapters/charts/levels.ts +92 -0
- package/src/adapters/charts/markers.ts +119 -0
- package/src/adapters/charts/paint.ts +101 -0
- package/src/adapters/charts/plots.ts +185 -0
- package/src/adapters/charts/produced.ts +68 -0
- package/src/adapters/charts/requests.ts +357 -0
- package/src/adapters/charts/run.ts +327 -0
- package/src/adapters/charts/settings.ts +273 -0
- package/src/adapters/charts/surfaces.ts +238 -0
- package/src/adapters/charts/tables.ts +155 -0
- package/src/core/catalogue/catalogue.generated.ts +17 -9
- package/src/core/catalogue/values.generated.ts +8 -0
- package/src/core/check/arguments.ts +126 -0
- package/src/core/check/call-sites.ts +385 -0
- package/src/core/check/call-warmup.ts +121 -0
- package/src/core/check/calls.ts +412 -0
- package/src/core/check/check.ts +183 -0
- package/src/core/check/checked.ts +228 -0
- package/src/core/check/checker.ts +393 -0
- package/src/core/check/conditional.ts +143 -0
- package/src/core/check/constant.ts +127 -0
- package/src/core/check/declaration.ts +230 -0
- package/src/core/check/expressions.ts +471 -0
- package/src/core/check/functions.ts +283 -0
- package/src/core/check/handles.ts +75 -0
- package/src/core/check/index.ts +67 -0
- package/src/core/check/library-bars.ts +194 -0
- package/src/core/check/library-orders.ts +290 -0
- package/src/core/check/library-output.ts +241 -0
- package/src/core/check/library-series.ts +457 -0
- package/src/core/check/library.ts +374 -0
- package/src/core/check/literals.ts +35 -0
- package/src/core/check/outputs.ts +152 -0
- package/src/core/check/statements.ts +465 -0
- package/src/core/check/suggest.ts +63 -0
- package/src/core/check/surface.ts +115 -0
- package/src/core/check/tags.ts +94 -0
- package/src/core/check/types.ts +260 -0
- package/src/core/check/warmup.ts +100 -0
- package/src/core/diagnostics/collector.ts +27 -1
- package/src/core/emit/calls.ts +415 -0
- package/src/core/emit/canonical.ts +81 -0
- package/src/core/emit/channels.ts +144 -0
- package/src/core/emit/code.ts +155 -0
- package/src/core/emit/colours.ts +75 -0
- package/src/core/emit/context.ts +461 -0
- package/src/core/emit/defaults.ts +150 -0
- package/src/core/emit/emit.ts +313 -0
- package/src/core/emit/events.ts +141 -0
- package/src/core/emit/expressions.ts +292 -0
- package/src/core/emit/functions.ts +195 -0
- package/src/core/emit/gaps.ts +44 -0
- package/src/core/emit/index.ts +74 -0
- package/src/core/emit/inputs.ts +179 -0
- package/src/core/emit/layout.ts +165 -0
- package/src/core/emit/meta.ts +104 -0
- package/src/core/emit/opcodes.ts +160 -0
- package/src/core/emit/outputs.ts +357 -0
- package/src/core/emit/pool.ts +102 -0
- package/src/core/emit/program.ts +385 -0
- package/src/core/emit/registers.ts +179 -0
- package/src/core/emit/request-scope.ts +52 -0
- package/src/core/emit/requests.ts +258 -0
- package/src/core/emit/requires.ts +91 -0
- package/src/core/emit/sha256.ts +119 -0
- package/src/core/emit/statements.ts +438 -0
- package/src/core/emit/values.ts +284 -0
- package/src/core/engine/alerts.ts +152 -0
- package/src/core/engine/arithmetic.ts +165 -0
- package/src/core/engine/bars.ts +224 -0
- package/src/core/engine/budget.ts +284 -0
- package/src/core/engine/channels.ts +171 -0
- package/src/core/engine/drawings.ts +127 -0
- package/src/core/engine/engine.ts +498 -0
- package/src/core/engine/errors.ts +100 -0
- package/src/core/engine/frames.ts +85 -0
- package/src/core/engine/grids.ts +98 -0
- package/src/core/engine/guard.ts +71 -0
- package/src/core/engine/host.ts +251 -0
- package/src/core/engine/index.ts +93 -0
- package/src/core/engine/inputs.ts +263 -0
- package/src/core/engine/ledger/call.ts +218 -0
- package/src/core/engine/ledger/closable.ts +269 -0
- package/src/core/engine/ledger/holdings.ts +354 -0
- package/src/core/engine/ledger/index.ts +28 -0
- package/src/core/engine/ledger/intent.ts +112 -0
- package/src/core/engine/ledger/ledger.ts +314 -0
- package/src/core/engine/ledger/place.ts +277 -0
- package/src/core/engine/ledger/positions.ts +123 -0
- package/src/core/engine/ledger/refuse.ts +378 -0
- package/src/core/engine/ledger/row.ts +318 -0
- package/src/core/engine/ledger/sizing.ts +292 -0
- package/src/core/engine/library/arrays.ts +316 -0
- package/src/core/engine/library/averages.ts +97 -0
- package/src/core/engine/library/binding.ts +325 -0
- package/src/core/engine/library/chart.ts +115 -0
- package/src/core/engine/library/colours.ts +111 -0
- package/src/core/engine/library/dates.ts +109 -0
- package/src/core/engine/library/index.ts +103 -0
- package/src/core/engine/library/maths.ts +134 -0
- package/src/core/engine/library/objects.ts +265 -0
- package/src/core/engine/library/oscillators.ts +124 -0
- package/src/core/engine/library/ranges.ts +51 -0
- package/src/core/engine/library/series.ts +236 -0
- package/src/core/engine/library/state.ts +47 -0
- package/src/core/engine/library/studies.ts +150 -0
- package/src/core/engine/library/text.ts +303 -0
- package/src/core/engine/library/trend.ts +79 -0
- package/src/core/engine/library/volume.ts +101 -0
- package/src/core/engine/load.ts +104 -0
- package/src/core/engine/machine.ts +446 -0
- package/src/core/engine/memory.ts +129 -0
- package/src/core/engine/operations.ts +171 -0
- package/src/core/engine/orders.ts +121 -0
- package/src/core/engine/registers.ts +104 -0
- package/src/core/engine/request-body.ts +328 -0
- package/src/core/engine/request-plan.ts +270 -0
- package/src/core/engine/requests.ts +382 -0
- package/src/core/engine/results.ts +41 -0
- package/src/core/engine/series.ts +82 -0
- package/src/core/engine/session/hours.ts +86 -0
- package/src/core/engine/session/index.ts +17 -0
- package/src/core/engine/session/record.ts +191 -0
- package/src/core/engine/session/spec.ts +45 -0
- package/src/core/engine/timeframe.ts +161 -0
- package/src/core/engine/types.ts +47 -0
- package/src/core/engine/values/heap.ts +295 -0
- package/src/core/engine/values/index.ts +34 -0
- package/src/core/engine/values/value.ts +158 -0
- package/src/core/engine/verify-budgets.ts +202 -0
- package/src/core/engine/verify-code.ts +332 -0
- package/src/core/engine/verify-requests.ts +255 -0
- package/src/core/engine/verify-shape.ts +164 -0
- package/src/core/engine/verify-tables.ts +176 -0
- package/src/core/engine/verify.ts +341 -0
- package/src/core/index.ts +128 -6
- package/src/core/parse/expressions.ts +1 -1
- package/src/core/parse/names.ts +29 -2
- package/src/core/stdlib/averages/exponential.ts +119 -0
- package/src/core/stdlib/averages/index.ts +45 -0
- package/src/core/stdlib/averages/select.ts +71 -0
- package/src/core/stdlib/averages/shaped.ts +161 -0
- package/src/core/stdlib/averages/simple.ts +139 -0
- package/src/core/stdlib/calendar/civil.ts +89 -0
- package/src/core/stdlib/calendar/fields.ts +124 -0
- package/src/core/stdlib/calendar/format.ts +71 -0
- package/src/core/stdlib/calendar/index.ts +15 -0
- package/src/core/stdlib/calendar/zone.ts +161 -0
- package/src/core/stdlib/index.ts +400 -0
- package/src/core/stdlib/maths/arithmetic.ts +74 -0
- package/src/core/stdlib/maths/elementary.ts +124 -0
- package/src/core/stdlib/maths/index.ts +43 -0
- package/src/core/stdlib/maths/rounding.ts +78 -0
- package/src/core/stdlib/momentum/convergence.ts +82 -0
- package/src/core/stdlib/momentum/index.ts +47 -0
- package/src/core/stdlib/momentum/pressure.ts +141 -0
- package/src/core/stdlib/momentum/rates.ts +188 -0
- package/src/core/stdlib/momentum/rsi.ts +49 -0
- package/src/core/stdlib/momentum/stochastic.ts +147 -0
- package/src/core/stdlib/series/changes.ts +177 -0
- package/src/core/stdlib/series/conditions.ts +74 -0
- package/src/core/stdlib/series/extremes.ts +92 -0
- package/src/core/stdlib/series/index.ts +83 -0
- package/src/core/stdlib/series/pivots.ts +63 -0
- package/src/core/stdlib/series/statistics.ts +207 -0
- package/src/core/stdlib/series/totals.ts +164 -0
- package/src/core/stdlib/trend/directional.ts +196 -0
- package/src/core/stdlib/trend/index.ts +13 -0
- package/src/core/stdlib/trend/psar.ts +131 -0
- package/src/core/stdlib/trend/supertrend.ts +100 -0
- package/src/core/stdlib/values/bar.ts +54 -0
- package/src/core/stdlib/values/index.ts +14 -0
- package/src/core/stdlib/values/lookback.ts +198 -0
- package/src/core/stdlib/values/region.ts +86 -0
- package/src/core/stdlib/values/tail.ts +58 -0
- package/src/core/stdlib/values/value.ts +82 -0
- package/src/core/stdlib/volatility/bands.ts +178 -0
- package/src/core/stdlib/volatility/deviation.ts +111 -0
- package/src/core/stdlib/volatility/index.ts +48 -0
- package/src/core/stdlib/volatility/measures.ts +96 -0
- package/src/core/stdlib/volatility/range.ts +143 -0
- package/src/core/stdlib/volume/accumulation.ts +152 -0
- package/src/core/stdlib/volume/flow.ts +173 -0
- package/src/core/stdlib/volume/index.ts +43 -0
- package/src/core/stdlib/volume/weighted.ts +101 -0
- package/src/core/version/version.generated.ts +2 -2
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check 1 of `compiled-program.md` 3.5: every required field is present and of
|
|
3
|
+
* the declared type.
|
|
4
|
+
*
|
|
5
|
+
* This is the half of verification that reads an untrusted object and decides
|
|
6
|
+
* whether it is a compiled program at all. It runs before anything else,
|
|
7
|
+
* because every later check indexes into a table this one proves is a table.
|
|
8
|
+
*
|
|
9
|
+
* The failures are all one code. OS6018 covers a malformed instruction list, an
|
|
10
|
+
* unreadable encoding and a field of the wrong type because they are not
|
|
11
|
+
* separate fixes: each is a defect of the compiler that wrote the program, and
|
|
12
|
+
* none of them is repairable by hand. What varies is the location, and the
|
|
13
|
+
* location is a field path, so a compiler author is told `outputs.plots[2].
|
|
14
|
+
* channel` rather than "structure".
|
|
15
|
+
*/
|
|
16
|
+
import type { Diagnostic } from '../diagnostics/index.js';
|
|
17
|
+
import { malformed } from './errors.js';
|
|
18
|
+
|
|
19
|
+
type Unknown = Readonly<Record<string, unknown>>;
|
|
20
|
+
|
|
21
|
+
/** Collects the first failure and stops: a malformed program has no second opinion. */
|
|
22
|
+
export class ShapeCheck {
|
|
23
|
+
private failure: Diagnostic | undefined;
|
|
24
|
+
|
|
25
|
+
problem(): Diagnostic | undefined {
|
|
26
|
+
return this.failure;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fail(path: string, reason: string): false {
|
|
30
|
+
this.failure ??= malformed(path, reason);
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
object(value: unknown, path: string): value is Unknown {
|
|
35
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
36
|
+
return this.fail(path, 'an object was required');
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
array(value: unknown, path: string): value is readonly unknown[] {
|
|
42
|
+
if (!Array.isArray(value)) return this.fail(path, 'an array was required');
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
number(value: unknown, path: string): value is number {
|
|
47
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
48
|
+
return this.fail(path, 'a finite number was required');
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
whole(value: unknown, path: string): value is number {
|
|
54
|
+
if (!this.number(value, path)) return false;
|
|
55
|
+
if (!Number.isInteger(value)) return this.fail(path, 'a whole number was required');
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
string(value: unknown, path: string): value is string {
|
|
60
|
+
if (typeof value !== 'string') return this.fail(path, 'a string was required');
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
bool(value: unknown, path: string): value is boolean {
|
|
65
|
+
if (typeof value !== 'boolean') return this.fail(path, 'a true or false was required');
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** A whole number that indexes a table, with the table's size in the message. */
|
|
70
|
+
index(value: unknown, path: string, size: number, table: string): value is number {
|
|
71
|
+
if (!this.whole(value, path)) return false;
|
|
72
|
+
if (value < 0 || value >= size) {
|
|
73
|
+
return this.fail(path, `${value} is outside ${table}, which holds ${size}`);
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
one<T extends string>(value: unknown, path: string, allowed: readonly T[]): value is T {
|
|
79
|
+
if (!this.string(value, path)) return false;
|
|
80
|
+
if (!(allowed as readonly string[]).includes(value)) {
|
|
81
|
+
return this.fail(path, `${value} is not one of ${allowed.join(', ')}`);
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** A field that may be a value or null, which is a value the script could write. */
|
|
87
|
+
nullable(value: unknown, path: string, check: (v: unknown, p: string) => boolean): boolean {
|
|
88
|
+
return value === null ? true : check.call(this, value, path);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** The tags of a constant pool entry, 2.9. */
|
|
93
|
+
const CONSTANT_TAGS = ['z', 'b', 'n', 's', 'c'] as const;
|
|
94
|
+
|
|
95
|
+
export function checkConstant(shape: ShapeCheck, value: unknown, path: string): boolean {
|
|
96
|
+
if (!shape.array(value, path)) return false;
|
|
97
|
+
if (value.length !== 2) return shape.fail(path, 'a pool entry is a tag and a value');
|
|
98
|
+
const tag = value[0];
|
|
99
|
+
if (!shape.one(tag, `${path}[0]`, CONSTANT_TAGS)) return false;
|
|
100
|
+
const held = value[1];
|
|
101
|
+
switch (tag) {
|
|
102
|
+
case 'z':
|
|
103
|
+
return held === null ? true : shape.fail(`${path}[1]`, 'the absent entry holds null');
|
|
104
|
+
case 'b':
|
|
105
|
+
return shape.bool(held, `${path}[1]`);
|
|
106
|
+
case 'n':
|
|
107
|
+
return shape.number(held, `${path}[1]`);
|
|
108
|
+
case 's':
|
|
109
|
+
return shape.string(held, `${path}[1]`);
|
|
110
|
+
default:
|
|
111
|
+
return checkColour(shape, held, `${path}[1]`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function checkColour(shape: ShapeCheck, value: unknown, path: string): boolean {
|
|
116
|
+
if (!shape.array(value, path)) return false;
|
|
117
|
+
if (value.length !== 4) return shape.fail(path, 'a colour is four numbers');
|
|
118
|
+
for (let i = 0; i < 3; i += 1) {
|
|
119
|
+
if (!shape.whole(value[i], `${path}[${i}]`)) return false;
|
|
120
|
+
const channel = value[i] as number;
|
|
121
|
+
if (channel < 0 || channel > 255) {
|
|
122
|
+
return shape.fail(`${path}[${i}]`, `a channel runs 0 to 255 and this is ${channel}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (!shape.number(value[3], `${path}[3]`)) return false;
|
|
126
|
+
const alpha = value[3] as number;
|
|
127
|
+
if (alpha < 0 || alpha > 1) {
|
|
128
|
+
return shape.fail(`${path}[3]`, `an alpha runs 0 to 1 and this is ${alpha}`);
|
|
129
|
+
}
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* A declaration field, 2.3: a value, or the `{ "input": key }` reference.
|
|
135
|
+
*
|
|
136
|
+
* The key half of check 10 lives here, because this is the one walk that
|
|
137
|
+
* visits every field that may hold one. The value half runs later, with the
|
|
138
|
+
* host's settings in hand.
|
|
139
|
+
*/
|
|
140
|
+
export function checkField(
|
|
141
|
+
shape: ShapeCheck,
|
|
142
|
+
value: unknown,
|
|
143
|
+
path: string,
|
|
144
|
+
keys: ReadonlySet<string>,
|
|
145
|
+
): boolean {
|
|
146
|
+
if (value === null) return true;
|
|
147
|
+
const kind = typeof value;
|
|
148
|
+
if (kind === 'boolean' || kind === 'string') return true;
|
|
149
|
+
if (kind === 'number') return shape.number(value, path);
|
|
150
|
+
if (Array.isArray(value)) {
|
|
151
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
152
|
+
if (!shape.number(value[i], `${path}[${i}]`)) return false;
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
if (!shape.object(value, path)) return false;
|
|
157
|
+
const key = value['input'];
|
|
158
|
+
if (key === undefined) return shape.fail(path, 'an object here is an input reference');
|
|
159
|
+
if (!shape.string(key, `${path}.input`)) return false;
|
|
160
|
+
if (!keys.has(key)) {
|
|
161
|
+
return shape.fail(path, `it names the input ${key}, which inputs[] does not declare`);
|
|
162
|
+
}
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check 1 of `compiled-program.md` 3.5 over the program's own tables, and check
|
|
3
|
+
* 10's key half.
|
|
4
|
+
*
|
|
5
|
+
* `verify-shape.ts` answers "is this field a number"; this walks the whole
|
|
6
|
+
* program asking it, table by table, and checks every index into a table is in
|
|
7
|
+
* range: constant pool, slots, cells, states, registers, channels, library
|
|
8
|
+
* functions, call sites, loops and functions. The tables a machine indexes and
|
|
9
|
+
* the `requests` table are in `verify-requests.ts`, because a read's body holds
|
|
10
|
+
* the same tables counted from zero and one walk has to serve both. Separate
|
|
11
|
+
* from `verify.ts` because
|
|
12
|
+
* it is one long traversal with no decisions in it, and because the decisions
|
|
13
|
+
* there, which version, which capability, which budget, are what a reader comes
|
|
14
|
+
* looking for.
|
|
15
|
+
*/
|
|
16
|
+
import type { ShapeCheck } from './verify-shape.js';
|
|
17
|
+
import { checkConstant, checkField } from './verify-shape.js';
|
|
18
|
+
import { checkMachineTables, checkRequests } from './verify-requests.js';
|
|
19
|
+
|
|
20
|
+
const META_KINDS = ['study', 'strategy'] as const;
|
|
21
|
+
const CHANNEL_TYPES = ['number', 'string', 'color', 'bool'] as const;
|
|
22
|
+
const EFFECTS = ['none', 'signal', 'order', 'draw', 'log'] as const;
|
|
23
|
+
|
|
24
|
+
/** Check 1 over every table the machine indexes, and every declaration field. */
|
|
25
|
+
export function checkTables(shape: ShapeCheck, raw: Readonly<Record<string, unknown>>): boolean {
|
|
26
|
+
for (const name of ['requires', 'inputs', 'channels', 'consts', 'series', 'cells', 'states',
|
|
27
|
+
'functions', 'callSites', 'loops', 'code', 'requests']) {
|
|
28
|
+
if (!shape.array(raw[name], name)) return false;
|
|
29
|
+
}
|
|
30
|
+
for (const name of ['compiler', 'source', 'meta', 'limits', 'lib', 'outputs', 'frame', 'debug']) {
|
|
31
|
+
if (!shape.object(raw[name], name)) return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const limits = raw['limits'] as Readonly<Record<string, unknown>>;
|
|
35
|
+
if (!shape.whole(limits['loops'], 'limits.loops')) return false;
|
|
36
|
+
if (limits['history'] !== null && !shape.whole(limits['history'], 'limits.history')) return false;
|
|
37
|
+
|
|
38
|
+
const frame = raw['frame'] as Readonly<Record<string, unknown>>;
|
|
39
|
+
if (!shape.whole(frame['slots'], 'frame.slots')) return false;
|
|
40
|
+
|
|
41
|
+
const lib = raw['lib'] as Readonly<Record<string, unknown>>;
|
|
42
|
+
if (!shape.whole(lib['manifest'], 'lib.manifest')) return false;
|
|
43
|
+
if (!shape.array(lib['functions'], 'lib.functions')) return false;
|
|
44
|
+
for (let i = 0; i < lib['functions'].length; i += 1) {
|
|
45
|
+
const entry = lib['functions'][i];
|
|
46
|
+
const path = `lib.functions[${i}]`;
|
|
47
|
+
if (!shape.object(entry, path)) return false;
|
|
48
|
+
if (!shape.string(entry['name'], `${path}.name`)) return false;
|
|
49
|
+
if (!shape.whole(entry['arity'], `${path}.arity`)) return false;
|
|
50
|
+
if (!shape.bool(entry['state'], `${path}.state`)) return false;
|
|
51
|
+
if (!shape.one(entry['effect'], `${path}.effect`, EFFECTS)) return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const consts = raw['consts'] as readonly unknown[];
|
|
55
|
+
for (let i = 0; i < consts.length; i += 1) {
|
|
56
|
+
if (!checkConstant(shape, consts[i], `consts[${i}]`)) return false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const keys = new Set<string>();
|
|
60
|
+
const inputs = raw['inputs'] as readonly unknown[];
|
|
61
|
+
for (let i = 0; i < inputs.length; i += 1) {
|
|
62
|
+
const input = inputs[i];
|
|
63
|
+
const path = `inputs[${i}]`;
|
|
64
|
+
if (!shape.object(input, path)) return false;
|
|
65
|
+
if (!shape.string(input['key'], `${path}.key`)) return false;
|
|
66
|
+
if (!shape.string(input['kind'], `${path}.kind`)) return false;
|
|
67
|
+
if (!shape.index(input['slot'], `${path}.slot`, Number(frame['slots']), 'the frame')) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (!checkConstant(shape, input['default'], `${path}.default`)) return false;
|
|
71
|
+
keys.add(input['key']);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const channels = raw['channels'] as readonly unknown[];
|
|
75
|
+
for (let i = 0; i < channels.length; i += 1) {
|
|
76
|
+
const channel = channels[i];
|
|
77
|
+
const path = `channels[${i}]`;
|
|
78
|
+
if (!shape.object(channel, path)) return false;
|
|
79
|
+
if (channel['id'] !== i) return shape.fail(`${path}.id`, 'a channel id is its position');
|
|
80
|
+
if (!shape.one(channel['type'], `${path}.type`, CHANNEL_TYPES)) return false;
|
|
81
|
+
if (!shape.bool(channel['defer'], `${path}.defer`)) return false;
|
|
82
|
+
if (!shape.bool(channel['once'], `${path}.once`)) return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const series = raw['series'] as readonly unknown[];
|
|
86
|
+
if (!checkMachineTables(shape, '', {
|
|
87
|
+
series,
|
|
88
|
+
cells: raw['cells'] as readonly unknown[],
|
|
89
|
+
states: raw['states'] as readonly unknown[],
|
|
90
|
+
functions: raw['functions'] as readonly unknown[],
|
|
91
|
+
callSites: raw['callSites'] as readonly unknown[],
|
|
92
|
+
loops: raw['loops'] as readonly unknown[],
|
|
93
|
+
slots: Number(frame['slots']),
|
|
94
|
+
libFunctions: lib['functions'].length,
|
|
95
|
+
})) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 2.16: a read's body is walked on the same terms, because the same machine
|
|
100
|
+
// executes it over another instrument's bars.
|
|
101
|
+
if (!checkRequests(shape, '', raw['requests'] as readonly unknown[], series.length,
|
|
102
|
+
lib['functions'].length, keys)) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const meta = raw['meta'] as Readonly<Record<string, unknown>>;
|
|
107
|
+
if (!shape.one(meta['kind'], 'meta.kind', META_KINDS)) return false;
|
|
108
|
+
for (const field of ['title', 'short', 'overlay', 'precision', 'format', 'range', 'scale',
|
|
109
|
+
'group', 'onUnconfirmed']) {
|
|
110
|
+
if (!checkField(shape, meta[field], `meta.${field}`, keys)) return false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const debug = raw['debug'] as Readonly<Record<string, unknown>>;
|
|
114
|
+
if (!shape.array(debug['pos'], 'debug.pos')) return false;
|
|
115
|
+
if (!shape.array(debug['fnPos'], 'debug.fnPos')) return false;
|
|
116
|
+
|
|
117
|
+
return checkOutputs(shape, raw['outputs'] as Readonly<Record<string, unknown>>,
|
|
118
|
+
channels.length, Number(frame['slots']), keys);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Every declaration in `outputs`, and every channel it points at. */
|
|
122
|
+
function checkOutputs(
|
|
123
|
+
shape: ShapeCheck,
|
|
124
|
+
outputs: Readonly<Record<string, unknown>>,
|
|
125
|
+
channels: number,
|
|
126
|
+
slots: number,
|
|
127
|
+
keys: ReadonlySet<string>,
|
|
128
|
+
): boolean {
|
|
129
|
+
for (const group of ['plots', 'fills', 'levels', 'markers', 'tables', 'alerts']) {
|
|
130
|
+
if (!shape.array(outputs[group], `outputs.${group}`)) return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const channelField = (holder: unknown, path: string, field: string): boolean => {
|
|
134
|
+
const value = (holder as Readonly<Record<string, unknown>>)[field];
|
|
135
|
+
return shape.index(value, `${path}.${field}`, channels, 'channels');
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const declarations: readonly (readonly [string, readonly string[], readonly string[]])[] = [
|
|
139
|
+
['plots', ['channel'], ['title', 'color', 'width', 'lineStyle', 'offset', 'overlay', 'scale']],
|
|
140
|
+
['levels', ['channel'], ['title', 'color', 'lineStyle', 'lineWidth']],
|
|
141
|
+
['markers', ['channel'], ['position', 'shape', 'color', 'textColor']],
|
|
142
|
+
['alerts', ['condChannel'], ['title', 'frequency']],
|
|
143
|
+
];
|
|
144
|
+
for (const [group, channelFields, valueFields] of declarations) {
|
|
145
|
+
const list = outputs[group] as readonly unknown[];
|
|
146
|
+
for (let i = 0; i < list.length; i += 1) {
|
|
147
|
+
const path = `outputs.${group}[${i}]`;
|
|
148
|
+
if (!shape.object(list[i], path)) return false;
|
|
149
|
+
for (const field of channelFields) if (!channelField(list[i], path, field)) return false;
|
|
150
|
+
for (const field of valueFields) {
|
|
151
|
+
const value = (list[i] as Readonly<Record<string, unknown>>)[field];
|
|
152
|
+
if (!checkField(shape, value, `${path}.${field}`, keys)) return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const tables = outputs['tables'] as readonly unknown[];
|
|
158
|
+
for (let i = 0; i < tables.length; i += 1) {
|
|
159
|
+
const path = `outputs.tables[${i}]`;
|
|
160
|
+
if (!shape.object(tables[i], path)) return false;
|
|
161
|
+
const grid = tables[i] as Readonly<Record<string, unknown>>;
|
|
162
|
+
if (!shape.index(grid['slot'], `${path}.slot`, slots, 'the frame')) return false;
|
|
163
|
+
for (const field of ['title', 'position', 'rows', 'cols']) {
|
|
164
|
+
if (!checkField(shape, grid[field], `${path}.${field}`, keys)) return false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
for (const paint of ['barColor', 'background']) {
|
|
169
|
+
const value = outputs[paint];
|
|
170
|
+
if (value === null) continue;
|
|
171
|
+
if (!shape.object(value, `outputs.${paint}`)) return false;
|
|
172
|
+
if (!channelField(value, `outputs.${paint}`, 'channel')) return false;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load-time verification, `compiled-program.md` 3.5, and the refusals a host
|
|
3
|
+
* makes beside it.
|
|
4
|
+
*
|
|
5
|
+
* Before executing a single bar an engine must verify the program. What is
|
|
6
|
+
* bought by doing it here rather than discovering a problem halfway through a
|
|
7
|
+
* bar is stated in the specification and is the reason the interpreter is as
|
|
8
|
+
* plain as it is: a verified program cannot underflow the stack, cannot jump
|
|
9
|
+
* out of bounds, cannot address a slot that does not exist and cannot loop
|
|
10
|
+
* without charging the budget. Every remaining failure is a script error with a
|
|
11
|
+
* source position, which is the only kind of failure a user should ever see.
|
|
12
|
+
*
|
|
13
|
+
* Three refusals that are not verification sit here too, because they happen at
|
|
14
|
+
* the same moment and for the same reason: a version this engine does not
|
|
15
|
+
* implement (OS6016, OS6017), a capability it does not have (OS6006), and a
|
|
16
|
+
* library entry that disagrees with its manifest (OS6004). Each names what it
|
|
17
|
+
* refused, and none of them silently accepts a program it cannot run. The
|
|
18
|
+
* fourth, the budgets a host is willing to spend, is `verify-budgets.ts`: it is
|
|
19
|
+
* a question about this host rather than about this program, and two hosts may
|
|
20
|
+
* honestly answer it differently.
|
|
21
|
+
*
|
|
22
|
+
* **The order of those refusals is the specification's, 9.4, and not an
|
|
23
|
+
* accident of where the code grew.** It is an ordered list that stops at the
|
|
24
|
+
* first failure, so a program that is wrong in two ways reports the one the
|
|
25
|
+
* list reaches first, and two engines hand the same program the same message.
|
|
26
|
+
* Each step below says which number it is.
|
|
27
|
+
*/
|
|
28
|
+
import { COMPILED_FORMAT_VERSION } from '../version/index.js';
|
|
29
|
+
import type { Diagnostic } from '../diagnostics/index.js';
|
|
30
|
+
import type { EngineLimits } from './budget.js';
|
|
31
|
+
import { NO_POSITION, failure } from './errors.js';
|
|
32
|
+
import { manifestEntry, manifestSays } from './library/index.js';
|
|
33
|
+
import type { CompiledProgram, Request } from './types.js';
|
|
34
|
+
import { checkList, checkOnce } from './verify-code.js';
|
|
35
|
+
import type { ListLimits } from './verify-code.js';
|
|
36
|
+
import { allCode, checkBudgets } from './verify-budgets.js';
|
|
37
|
+
import { ShapeCheck } from './verify-shape.js';
|
|
38
|
+
import { checkTables } from './verify-tables.js';
|
|
39
|
+
|
|
40
|
+
/** The language versions whose library semantics this engine implements. */
|
|
41
|
+
export const LANGUAGE_VERSIONS: readonly number[] = [1];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The format major this engine loads, and the only part of the format version a
|
|
45
|
+
* refusal turns on.
|
|
46
|
+
*
|
|
47
|
+
* `COMPILED_FORMAT_VERSION` is the highest minor of that major this engine was
|
|
48
|
+
* built against, which is what 9.1 asks an engine to declare: the majors it can
|
|
49
|
+
* load, and the highest minor of each. 9.4 step 3 then says a higher minor
|
|
50
|
+
* continues, and that line is the whole compatibility promise in one decision.
|
|
51
|
+
*
|
|
52
|
+
* A minor bump is additive by 9.2: it may add a field an engine that ignores it
|
|
53
|
+
* still computes the same numbers from, and anything whose absence would change
|
|
54
|
+
* a number must be announced by a tag in `requires`, which step 4 checks
|
|
55
|
+
* immediately afterwards. So the tag is the real mechanism and the version is
|
|
56
|
+
* the coarse one. An engine that refused a higher minor would refuse every
|
|
57
|
+
* program in the world the day the format reached 1.1, including every program
|
|
58
|
+
* it can run perfectly, and a minor bump would be a major one wearing a smaller
|
|
59
|
+
* number. An older minor loads for the same reason from the other side: it
|
|
60
|
+
* carries a subset of the fields this engine already reads.
|
|
61
|
+
*
|
|
62
|
+
* A major is a different format that happens to share a name (9.3), so a major
|
|
63
|
+
* that is not this one, in either direction, is OS6016 and never a best effort.
|
|
64
|
+
*/
|
|
65
|
+
const ENGINE_FORMAT_MAJOR = majorOf(COMPILED_FORMAT_VERSION);
|
|
66
|
+
|
|
67
|
+
/** The leading number of a dotted version, or nothing when it is not one. */
|
|
68
|
+
function majorOf(version: string): number | undefined {
|
|
69
|
+
if (!/^\d+(\.\d+)*$/.test(version)) return undefined;
|
|
70
|
+
return Number(version.split('.')[0]);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* What this engine can do, as the tags of 2.2.
|
|
75
|
+
*
|
|
76
|
+
* Two tags are not here, and both for the same reason: they are the host's
|
|
77
|
+
* rather than the engine's.
|
|
78
|
+
*
|
|
79
|
+
* `orders` is one. The engine turns an order call into a pending effect and
|
|
80
|
+
* hands it to whatever route the host supplied, so the capability belongs to
|
|
81
|
+
* the configuration, and `capabilitiesFor` adds it when a route exists.
|
|
82
|
+
*
|
|
83
|
+
* `req.symbol` is the other. A read of another instrument needs bars the engine
|
|
84
|
+
* does not hold and cannot derive, so a host with no request provider cannot
|
|
85
|
+
* serve one, and a program that makes one is refused at load with OS6006 naming
|
|
86
|
+
* the tag rather than drawing a study with a silently empty line through it.
|
|
87
|
+
* **`req.timeframe` is here unconditionally**, because a read of the chart's own
|
|
88
|
+
* instrument at a coarser interval is folded from the bars the engine already
|
|
89
|
+
* has (`host-interface.md` 5.1), so there is nothing for a host to supply and
|
|
90
|
+
* nothing for it to decline.
|
|
91
|
+
*/
|
|
92
|
+
const ENGINE_CAPABILITIES: readonly string[] = [
|
|
93
|
+
'core.1',
|
|
94
|
+
'arrays',
|
|
95
|
+
'functions',
|
|
96
|
+
'loops',
|
|
97
|
+
'objects',
|
|
98
|
+
'tables',
|
|
99
|
+
'alerts',
|
|
100
|
+
'req.timeframe',
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
export function capabilitiesFor(
|
|
104
|
+
hasOrderRoute: boolean,
|
|
105
|
+
hasRequestProvider = false,
|
|
106
|
+
): readonly string[] {
|
|
107
|
+
const tags = [...ENGINE_CAPABILITIES];
|
|
108
|
+
if (hasOrderRoute) tags.push('orders');
|
|
109
|
+
if (hasRequestProvider) tags.push('req.symbol');
|
|
110
|
+
return tags;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface VerifyOptions {
|
|
114
|
+
readonly capabilities: readonly string[];
|
|
115
|
+
readonly limits: EngineLimits;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type VerifyResult =
|
|
119
|
+
| { readonly ok: true; readonly program: CompiledProgram }
|
|
120
|
+
| { readonly ok: false; readonly diagnostic: Diagnostic };
|
|
121
|
+
|
|
122
|
+
/** Which instruction needs which tag, the part of check 8 the program decides. */
|
|
123
|
+
const INSTRUCTION_TAGS: Readonly<Record<string, string>> = {
|
|
124
|
+
ARRAY: 'arrays',
|
|
125
|
+
ELEM: 'arrays',
|
|
126
|
+
CALL_FN: 'functions',
|
|
127
|
+
TICK: 'loops',
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export function verify(raw: unknown, options: VerifyOptions): VerifyResult {
|
|
131
|
+
const shape = new ShapeCheck();
|
|
132
|
+
const refused = (diagnostic: Diagnostic): VerifyResult => ({ ok: false, diagnostic });
|
|
133
|
+
const broken = (): VerifyResult =>
|
|
134
|
+
refused(shape.problem() ?? failure('OS6018', NO_POSITION, {
|
|
135
|
+
location: 'the program',
|
|
136
|
+
reason: 'it is not a compiled program',
|
|
137
|
+
}));
|
|
138
|
+
|
|
139
|
+
if (!shape.object(raw, 'the program')) return broken();
|
|
140
|
+
|
|
141
|
+
const version = raw['openscript'];
|
|
142
|
+
if (!shape.object(version, 'openscript')) return broken();
|
|
143
|
+
if (!shape.string(version['format'], 'openscript.format')) return broken();
|
|
144
|
+
if (!shape.whole(version['language'], 'openscript.language')) return broken();
|
|
145
|
+
|
|
146
|
+
// Steps 2 and 3: the major decides, and a higher minor loads.
|
|
147
|
+
const major = majorOf(version['format']);
|
|
148
|
+
if (major === undefined) {
|
|
149
|
+
shape.fail('openscript.format', 'a version of the form major.minor was required');
|
|
150
|
+
return broken();
|
|
151
|
+
}
|
|
152
|
+
if (major !== ENGINE_FORMAT_MAJOR) {
|
|
153
|
+
return refused(
|
|
154
|
+
failure('OS6016', NO_POSITION, {
|
|
155
|
+
found: version['format'],
|
|
156
|
+
max: COMPILED_FORMAT_VERSION,
|
|
157
|
+
}),
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Step 1's other half: the tables every later step indexes into.
|
|
162
|
+
if (!checkTables(shape, raw)) return broken();
|
|
163
|
+
const program = raw as unknown as CompiledProgram;
|
|
164
|
+
|
|
165
|
+
// Step 4, and it comes before the language version on purpose: a program that
|
|
166
|
+
// is both compiled from a language this engine lacks and dependent on a
|
|
167
|
+
// capability it lacks reports the capability, which names the feature that was
|
|
168
|
+
// refused rather than a number the reader has to look up.
|
|
169
|
+
for (const tag of program.requires) {
|
|
170
|
+
if (!options.capabilities.includes(tag)) {
|
|
171
|
+
return refused(failure('OS6006', NO_POSITION, { tag }));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Step 5.
|
|
176
|
+
if (!LANGUAGE_VERSIONS.includes(program.openscript.language)) {
|
|
177
|
+
return refused(
|
|
178
|
+
failure('OS6017', NO_POSITION, {
|
|
179
|
+
found: program.openscript.language,
|
|
180
|
+
versions: LANGUAGE_VERSIONS.join(', '),
|
|
181
|
+
}),
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Step 6.
|
|
186
|
+
const library = checkLibrary(program);
|
|
187
|
+
if (library !== undefined) return refused(library);
|
|
188
|
+
|
|
189
|
+
// Step 7.
|
|
190
|
+
const budget = checkBudgets(program, options.limits);
|
|
191
|
+
if (budget !== undefined) return refused(budget);
|
|
192
|
+
|
|
193
|
+
// Step 8, which is 3.5 itself.
|
|
194
|
+
const sizes = tableSizes(program);
|
|
195
|
+
if (!checkList(shape, 'code', program.code, sizes, 'HALT')) return broken();
|
|
196
|
+
for (let f = 0; f < program.functions.length; f += 1) {
|
|
197
|
+
const body = program.functions[f]?.code ?? [];
|
|
198
|
+
if (!checkList(shape, `functions[${f}]`, body, bodySizes(sizes, program, f), 'RET')) {
|
|
199
|
+
return broken();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (!checkOnce(shape, program.code, program.channels.map((one) => one.once))) return broken();
|
|
203
|
+
// 2.16.1: a body is an instruction list the same machine walks, so it gets
|
|
204
|
+
// the same walk. Its terminator is `RET` rather than `HALT`, because a body
|
|
205
|
+
// produces a value and `HALT` does not.
|
|
206
|
+
if (!checkBodies(shape, 'requests', program.requests, sizes)) return broken();
|
|
207
|
+
|
|
208
|
+
// Check 8, the program's half: an instruction whose tag it never declared.
|
|
209
|
+
const missing = missingTag(program);
|
|
210
|
+
if (missing !== undefined) {
|
|
211
|
+
return refused(
|
|
212
|
+
failure('OS6018', NO_POSITION, {
|
|
213
|
+
location: 'requires',
|
|
214
|
+
reason: `the program uses ${missing.opcode} and does not declare ${missing.tag}`,
|
|
215
|
+
}),
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return { ok: true, program };
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** Check 9: every `lib.functions` entry agrees with this engine's manifest. */
|
|
223
|
+
function checkLibrary(program: CompiledProgram): Diagnostic | undefined {
|
|
224
|
+
for (let index = 0; index < program.lib.functions.length; index += 1) {
|
|
225
|
+
const entry = program.lib.functions[index];
|
|
226
|
+
if (entry === undefined) continue;
|
|
227
|
+
const mine = manifestEntry(entry.name, entry.arity);
|
|
228
|
+
if (mine === undefined) {
|
|
229
|
+
return failure('OS6004', NO_POSITION, {
|
|
230
|
+
index,
|
|
231
|
+
name: entry.name,
|
|
232
|
+
arity: entry.arity,
|
|
233
|
+
manifest: manifestSays(entry.name),
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
if (mine.state !== entry.state || mine.effect !== entry.effect) {
|
|
237
|
+
return failure('OS6004', NO_POSITION, {
|
|
238
|
+
index,
|
|
239
|
+
name: entry.name,
|
|
240
|
+
arity: entry.arity,
|
|
241
|
+
manifest: `${entry.name} holding state ${String(mine.state)} with effect ${mine.effect}`,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
247
|
+
/** Check 8's other half: an instruction whose tag the program did not declare. */
|
|
248
|
+
function missingTag(
|
|
249
|
+
program: CompiledProgram,
|
|
250
|
+
): { readonly opcode: string; readonly tag: string } | undefined {
|
|
251
|
+
for (const code of allCode(program)) {
|
|
252
|
+
for (const instruction of code) {
|
|
253
|
+
const tag = INSTRUCTION_TAGS[instruction[0]];
|
|
254
|
+
if (tag !== undefined && !program.requires.includes(tag)) {
|
|
255
|
+
return { opcode: instruction[0], tag };
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Check 8 over every read's body, and every read written inside one.
|
|
264
|
+
*
|
|
265
|
+
* The body's tables are its own and counted from zero, so the limits a walk is
|
|
266
|
+
* given are rebuilt for each of them; `consts` and `lib.functions` stay the
|
|
267
|
+
* program's, because those are the two the body shares (2.16.1). `channels` is
|
|
268
|
+
* zero, which is what refuses an `EMIT` inside a body without a rule of its
|
|
269
|
+
* own: a read carries no channel, no plot and no declaration.
|
|
270
|
+
*/
|
|
271
|
+
function checkBodies(
|
|
272
|
+
shape: ShapeCheck,
|
|
273
|
+
prefix: string,
|
|
274
|
+
requests: readonly Request[],
|
|
275
|
+
outer: ListLimits,
|
|
276
|
+
): boolean {
|
|
277
|
+
for (let i = 0; i < requests.length; i += 1) {
|
|
278
|
+
const body = requests[i]?.body;
|
|
279
|
+
if (body === undefined) continue;
|
|
280
|
+
const at = `${prefix}[${i}].body`;
|
|
281
|
+
const sizes: ListLimits = {
|
|
282
|
+
...outer,
|
|
283
|
+
slots: body.frame.slots,
|
|
284
|
+
cells: body.cells.length,
|
|
285
|
+
states: body.states.length,
|
|
286
|
+
registers: body.series.length,
|
|
287
|
+
channels: 0,
|
|
288
|
+
callSites: body.callSites.length,
|
|
289
|
+
loops: body.loops.length,
|
|
290
|
+
series: 0,
|
|
291
|
+
argcOf: (site: number) => body.callSites[site]?.argc ?? 0,
|
|
292
|
+
};
|
|
293
|
+
if (!checkList(shape, `${at}.code`, body.code, sizes, 'RET')) return false;
|
|
294
|
+
for (let f = 0; f < body.functions.length; f += 1) {
|
|
295
|
+
const fn = body.functions[f];
|
|
296
|
+
if (fn === undefined) continue;
|
|
297
|
+
let series = 0;
|
|
298
|
+
for (const site of body.callSites) {
|
|
299
|
+
if (site.fn === f) series = series === 0 ? site.series.length : Math.min(series, site.series.length);
|
|
300
|
+
}
|
|
301
|
+
if (!checkList(shape, `${at}.functions[${f}]`, fn.code, { ...sizes, slots: fn.slots, series },
|
|
302
|
+
'RET')) {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (!checkBodies(shape, `${at}.requests`, body.requests, sizes)) return false;
|
|
307
|
+
}
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function tableSizes(program: CompiledProgram): ListLimits {
|
|
312
|
+
return {
|
|
313
|
+
slots: program.frame.slots,
|
|
314
|
+
cells: program.cells.length,
|
|
315
|
+
states: program.states.length,
|
|
316
|
+
registers: program.series.length,
|
|
317
|
+
channels: program.channels.length,
|
|
318
|
+
libFunctions: program.lib.functions.length,
|
|
319
|
+
callSites: program.callSites.length,
|
|
320
|
+
loops: program.loops.length,
|
|
321
|
+
consts: program.consts.length,
|
|
322
|
+
series: 0,
|
|
323
|
+
argcOf: (site: number) => program.callSites[site]?.argc ?? 0,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* The sizes inside a function body.
|
|
329
|
+
*
|
|
330
|
+
* A body's slots are its own frame's, and a `HISTP` indexes the series bindings
|
|
331
|
+
* of whichever call site reached it. Every site that calls this function has to
|
|
332
|
+
* bind the same number, because the operand is fixed in the body, so the
|
|
333
|
+
* smallest binding list is the one that decides what is in range.
|
|
334
|
+
*/
|
|
335
|
+
function bodySizes(base: ListLimits, program: CompiledProgram, fn: number): ListLimits {
|
|
336
|
+
let series = 0;
|
|
337
|
+
for (const site of program.callSites) {
|
|
338
|
+
if (site.fn === fn) series = series === 0 ? site.series.length : Math.min(series, site.series.length);
|
|
339
|
+
}
|
|
340
|
+
return { ...base, slots: program.functions[fn]?.slots ?? 0, series };
|
|
341
|
+
}
|