@ricsam/formula-engine 0.2.1 → 0.2.3
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/cjs/core/ast-traverser.cjs +19 -9
- package/dist/cjs/core/ast-traverser.cjs.map +2 -2
- package/dist/cjs/core/autofill-utils.cjs +19 -9
- package/dist/cjs/core/autofill-utils.cjs.map +2 -2
- package/dist/cjs/core/cell-mover.cjs +19 -9
- package/dist/cjs/core/cell-mover.cjs.map +2 -2
- package/dist/cjs/core/commands/command-executor.cjs +24 -13
- package/dist/cjs/core/commands/command-executor.cjs.map +3 -3
- package/dist/cjs/core/commands/content-commands.cjs +292 -9
- package/dist/cjs/core/commands/content-commands.cjs.map +3 -3
- package/dist/cjs/core/commands/metadata-commands.cjs +19 -9
- package/dist/cjs/core/commands/metadata-commands.cjs.map +2 -2
- package/dist/cjs/core/commands/named-expression-commands.cjs +138 -13
- package/dist/cjs/core/commands/named-expression-commands.cjs.map +3 -3
- package/dist/cjs/core/commands/structure-commands.cjs +216 -15
- package/dist/cjs/core/commands/structure-commands.cjs.map +3 -3
- package/dist/cjs/core/commands/style-commands.cjs +19 -9
- package/dist/cjs/core/commands/style-commands.cjs.map +2 -2
- package/dist/cjs/core/commands/table-commands.cjs +134 -13
- package/dist/cjs/core/commands/table-commands.cjs.map +3 -3
- package/dist/cjs/core/commands/types.cjs +36 -9
- package/dist/cjs/core/commands/types.cjs.map +3 -3
- package/dist/cjs/core/engine-snapshot.cjs +51 -0
- package/dist/cjs/core/engine-snapshot.cjs.map +10 -0
- package/dist/cjs/core/engine.cjs +58 -34
- package/dist/cjs/core/engine.cjs.map +3 -3
- package/dist/cjs/core/managers/cache-manager.cjs +123 -9
- package/dist/cjs/core/managers/cache-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/copy-manager.cjs +19 -9
- package/dist/cjs/core/managers/copy-manager.cjs.map +2 -2
- package/dist/cjs/core/managers/dependency-manager.cjs +697 -9
- package/dist/cjs/core/managers/dependency-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/dependency-node.cjs +14 -8
- package/dist/cjs/core/managers/dependency-node.cjs.map +1 -1
- package/dist/cjs/core/managers/evaluation-manager.cjs +296 -11
- package/dist/cjs/core/managers/evaluation-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/event-manager.cjs +19 -9
- package/dist/cjs/core/managers/event-manager.cjs.map +2 -2
- package/dist/cjs/core/managers/frontier-dependency-manager.cjs +65 -12
- package/dist/cjs/core/managers/frontier-dependency-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/isDependencyNode.cjs +19 -9
- package/dist/cjs/core/managers/isDependencyNode.cjs.map +2 -2
- package/dist/cjs/core/managers/named-expression-manager.cjs +121 -29
- package/dist/cjs/core/managers/named-expression-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/range-eval-order-builder.cjs +19 -9
- package/dist/cjs/core/managers/range-eval-order-builder.cjs.map +2 -2
- package/dist/cjs/core/managers/reference-manager.cjs +25 -9
- package/dist/cjs/core/managers/reference-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/schema-manager.cjs +19 -9
- package/dist/cjs/core/managers/schema-manager.cjs.map +2 -2
- package/dist/cjs/core/managers/style-manager.cjs +28 -9
- package/dist/cjs/core/managers/style-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/table-manager.cjs +25 -9
- package/dist/cjs/core/managers/table-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/workbook-manager.cjs +38 -13
- package/dist/cjs/core/managers/workbook-manager.cjs.map +3 -3
- package/dist/cjs/core/map-serializer.cjs +19 -9
- package/dist/cjs/core/map-serializer.cjs.map +2 -2
- package/dist/cjs/core/named-expression-renamer.cjs +19 -9
- package/dist/cjs/core/named-expression-renamer.cjs.map +2 -2
- package/dist/cjs/core/resource-keys.cjs +67 -0
- package/dist/cjs/core/resource-keys.cjs.map +10 -0
- package/dist/cjs/core/schema/cell-orm.cjs +19 -9
- package/dist/cjs/core/schema/cell-orm.cjs.map +2 -2
- package/dist/cjs/core/schema/grid-orm.cjs +19 -9
- package/dist/cjs/core/schema/grid-orm.cjs.map +2 -2
- package/dist/cjs/core/schema/schema-builder.cjs +19 -9
- package/dist/cjs/core/schema/schema-builder.cjs.map +2 -2
- package/dist/cjs/core/schema/schema-helpers.cjs +19 -9
- package/dist/cjs/core/schema/schema-helpers.cjs.map +2 -2
- package/dist/cjs/core/schema/schema.cjs +19 -9
- package/dist/cjs/core/schema/schema.cjs.map +2 -2
- package/dist/cjs/core/schema/table-orm.cjs +19 -9
- package/dist/cjs/core/schema/table-orm.cjs.map +2 -2
- package/dist/cjs/core/sheet-renamer.cjs +19 -9
- package/dist/cjs/core/sheet-renamer.cjs.map +2 -2
- package/dist/cjs/core/sheet-utils.cjs +19 -9
- package/dist/cjs/core/sheet-utils.cjs.map +2 -2
- package/dist/cjs/core/table-renamer.cjs +19 -9
- package/dist/cjs/core/table-renamer.cjs.map +2 -2
- package/dist/cjs/core/types.cjs +19 -9
- package/dist/cjs/core/types.cjs.map +2 -2
- package/dist/cjs/core/utils/color-utils.cjs +19 -9
- package/dist/cjs/core/utils/color-utils.cjs.map +2 -2
- package/dist/cjs/core/utils/range-serializer.cjs +19 -9
- package/dist/cjs/core/utils/range-serializer.cjs.map +2 -2
- package/dist/cjs/core/utils/range-utils.cjs +19 -9
- package/dist/cjs/core/utils/range-utils.cjs.map +2 -2
- package/dist/cjs/core/utils/spreadsheet-visualizer.cjs +19 -9
- package/dist/cjs/core/utils/spreadsheet-visualizer.cjs.map +2 -2
- package/dist/cjs/core/utils.cjs +19 -9
- package/dist/cjs/core/utils.cjs.map +2 -2
- package/dist/cjs/core/workbook-renamer.cjs +19 -9
- package/dist/cjs/core/workbook-renamer.cjs.map +2 -2
- package/dist/cjs/debug/flags.cjs +19 -9
- package/dist/cjs/debug/flags.cjs.map +2 -2
- package/dist/cjs/evaluator/arithmetic/add/add.cjs +19 -9
- package/dist/cjs/evaluator/arithmetic/add/add.cjs.map +2 -2
- package/dist/cjs/evaluator/arithmetic/divide/divide.cjs +19 -9
- package/dist/cjs/evaluator/arithmetic/divide/divide.cjs.map +2 -2
- package/dist/cjs/evaluator/arithmetic/multiply/multiply.cjs +19 -9
- package/dist/cjs/evaluator/arithmetic/multiply/multiply.cjs.map +2 -2
- package/dist/cjs/evaluator/arithmetic/power/power.cjs +19 -9
- package/dist/cjs/evaluator/arithmetic/power/power.cjs.map +2 -2
- package/dist/cjs/evaluator/arithmetic/subtract/subtract.cjs +19 -9
- package/dist/cjs/evaluator/arithmetic/subtract/subtract.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/equals.cjs +19 -9
- package/dist/cjs/evaluator/comparison/equals.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/greater-than-or-equal.cjs +19 -9
- package/dist/cjs/evaluator/comparison/greater-than-or-equal.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/greater-than.cjs +19 -9
- package/dist/cjs/evaluator/comparison/greater-than.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/less-than-or-equal.cjs +19 -9
- package/dist/cjs/evaluator/comparison/less-than-or-equal.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/less-than.cjs +19 -9
- package/dist/cjs/evaluator/comparison/less-than.cjs.map +2 -2
- package/dist/cjs/evaluator/comparison/not-equals.cjs +19 -9
- package/dist/cjs/evaluator/comparison/not-equals.cjs.map +2 -2
- package/dist/cjs/evaluator/concatenation/concatenate.cjs +19 -9
- package/dist/cjs/evaluator/concatenation/concatenate.cjs.map +2 -2
- package/dist/cjs/evaluator/dependency-nodes/ast-evaluation-node.cjs +19 -9
- package/dist/cjs/evaluator/dependency-nodes/ast-evaluation-node.cjs.map +2 -2
- package/dist/cjs/evaluator/dependency-nodes/base-eval-node.cjs +35 -9
- package/dist/cjs/evaluator/dependency-nodes/base-eval-node.cjs.map +3 -3
- package/dist/cjs/evaluator/dependency-nodes/cell-value-node.cjs +22 -9
- package/dist/cjs/evaluator/dependency-nodes/cell-value-node.cjs.map +3 -3
- package/dist/cjs/evaluator/dependency-nodes/empty-cell-evaluation-node.cjs +35 -11
- package/dist/cjs/evaluator/dependency-nodes/empty-cell-evaluation-node.cjs.map +3 -3
- package/dist/cjs/evaluator/dependency-nodes/resource-dependency-node.cjs +61 -0
- package/dist/cjs/evaluator/dependency-nodes/resource-dependency-node.cjs.map +10 -0
- package/dist/cjs/evaluator/dependency-nodes/spill-meta-node.cjs +19 -9
- package/dist/cjs/evaluator/dependency-nodes/spill-meta-node.cjs.map +2 -2
- package/dist/cjs/evaluator/dependency-nodes/virtual-cell-value-node.cjs +22 -9
- package/dist/cjs/evaluator/dependency-nodes/virtual-cell-value-node.cjs.map +3 -3
- package/dist/cjs/evaluator/evaluate-scalar-operator.cjs +19 -9
- package/dist/cjs/evaluator/evaluate-scalar-operator.cjs.map +2 -2
- package/dist/cjs/evaluator/evaluation-context.cjs +19 -9
- package/dist/cjs/evaluator/evaluation-context.cjs.map +2 -2
- package/dist/cjs/evaluator/evaluation-error.cjs +19 -9
- package/dist/cjs/evaluator/evaluation-error.cjs.map +2 -2
- package/dist/cjs/evaluator/formula-evaluator.cjs +55 -12
- package/dist/cjs/evaluator/formula-evaluator.cjs.map +3 -3
- package/dist/cjs/evaluator/range-evaluation-node.cjs +35 -11
- package/dist/cjs/evaluator/range-evaluation-node.cjs.map +3 -3
- package/dist/cjs/functions/_template/template.cjs +19 -9
- package/dist/cjs/functions/_template/template.cjs.map +2 -2
- package/dist/cjs/functions/array/sequence/sequence.cjs +19 -9
- package/dist/cjs/functions/array/sequence/sequence.cjs.map +2 -2
- package/dist/cjs/functions/criteria-parser.cjs +19 -9
- package/dist/cjs/functions/criteria-parser.cjs.map +2 -2
- package/dist/cjs/functions/criteria-utils.cjs +19 -9
- package/dist/cjs/functions/criteria-utils.cjs.map +2 -2
- package/dist/cjs/functions/function-registry.cjs +19 -9
- package/dist/cjs/functions/function-registry.cjs.map +2 -2
- package/dist/cjs/functions/function-utils.cjs +19 -9
- package/dist/cjs/functions/function-utils.cjs.map +2 -2
- package/dist/cjs/functions/information/cell/cell.cjs +19 -9
- package/dist/cjs/functions/information/cell/cell.cjs.map +2 -2
- package/dist/cjs/functions/information/column/column.cjs +19 -9
- package/dist/cjs/functions/information/column/column.cjs.map +2 -2
- package/dist/cjs/functions/information/row/row.cjs +19 -9
- package/dist/cjs/functions/information/row/row.cjs.map +2 -2
- package/dist/cjs/functions/logical/and/and.cjs +19 -9
- package/dist/cjs/functions/logical/and/and.cjs.map +2 -2
- package/dist/cjs/functions/logical/if/if.cjs +19 -9
- package/dist/cjs/functions/logical/if/if.cjs.map +2 -2
- package/dist/cjs/functions/logical/iferror/iferror.cjs +19 -9
- package/dist/cjs/functions/logical/iferror/iferror.cjs.map +2 -2
- package/dist/cjs/functions/logical/or/or.cjs +19 -9
- package/dist/cjs/functions/logical/or/or.cjs.map +2 -2
- package/dist/cjs/functions/lookup/count/count-utils.cjs +19 -9
- package/dist/cjs/functions/lookup/count/count-utils.cjs.map +2 -2
- package/dist/cjs/functions/lookup/count/count.cjs +19 -9
- package/dist/cjs/functions/lookup/count/count.cjs.map +2 -2
- package/dist/cjs/functions/lookup/count/countif.cjs +19 -9
- package/dist/cjs/functions/lookup/count/countif.cjs.map +2 -2
- package/dist/cjs/functions/lookup/count/countifs.cjs +19 -9
- package/dist/cjs/functions/lookup/count/countifs.cjs.map +2 -2
- package/dist/cjs/functions/lookup/index-lookup/index-lookup.cjs +19 -9
- package/dist/cjs/functions/lookup/index-lookup/index-lookup.cjs.map +2 -2
- package/dist/cjs/functions/lookup/match/match.cjs +21 -10
- package/dist/cjs/functions/lookup/match/match.cjs.map +3 -3
- package/dist/cjs/functions/lookup/xlookup/xlookup.cjs +19 -9
- package/dist/cjs/functions/lookup/xlookup/xlookup.cjs.map +2 -2
- package/dist/cjs/functions/math/average/average-utils.cjs +19 -9
- package/dist/cjs/functions/math/average/average-utils.cjs.map +2 -2
- package/dist/cjs/functions/math/average/average.cjs +19 -9
- package/dist/cjs/functions/math/average/average.cjs.map +2 -2
- package/dist/cjs/functions/math/average/averageif.cjs +19 -9
- package/dist/cjs/functions/math/average/averageif.cjs.map +2 -2
- package/dist/cjs/functions/math/average/averageifs.cjs +19 -9
- package/dist/cjs/functions/math/average/averageifs.cjs.map +2 -2
- package/dist/cjs/functions/math/ceiling/ceiling.cjs +19 -9
- package/dist/cjs/functions/math/ceiling/ceiling.cjs.map +2 -2
- package/dist/cjs/functions/math/max/max-utils.cjs +19 -9
- package/dist/cjs/functions/math/max/max-utils.cjs.map +2 -2
- package/dist/cjs/functions/math/max/max.cjs +19 -9
- package/dist/cjs/functions/math/max/max.cjs.map +2 -2
- package/dist/cjs/functions/math/max/maxif.cjs +19 -9
- package/dist/cjs/functions/math/max/maxif.cjs.map +2 -2
- package/dist/cjs/functions/math/max/maxifs.cjs +19 -9
- package/dist/cjs/functions/math/max/maxifs.cjs.map +2 -2
- package/dist/cjs/functions/math/min/min-utils.cjs +19 -9
- package/dist/cjs/functions/math/min/min-utils.cjs.map +2 -2
- package/dist/cjs/functions/math/min/min.cjs +19 -9
- package/dist/cjs/functions/math/min/min.cjs.map +2 -2
- package/dist/cjs/functions/math/min/minif.cjs +19 -9
- package/dist/cjs/functions/math/min/minif.cjs.map +2 -2
- package/dist/cjs/functions/math/min/minifs.cjs +19 -9
- package/dist/cjs/functions/math/min/minifs.cjs.map +2 -2
- package/dist/cjs/functions/math/sum/sum.cjs +19 -9
- package/dist/cjs/functions/math/sum/sum.cjs.map +2 -2
- package/dist/cjs/functions/math/sum/sumif.cjs +19 -9
- package/dist/cjs/functions/math/sum/sumif.cjs.map +2 -2
- package/dist/cjs/functions/math/sum/sumifs.cjs +19 -9
- package/dist/cjs/functions/math/sum/sumifs.cjs.map +2 -2
- package/dist/cjs/functions/math/sum/summation-utils.cjs +19 -9
- package/dist/cjs/functions/math/sum/summation-utils.cjs.map +2 -2
- package/dist/cjs/functions/reference/address/address.cjs +19 -9
- package/dist/cjs/functions/reference/address/address.cjs.map +2 -2
- package/dist/cjs/functions/reference/indirect/indirect.cjs +19 -9
- package/dist/cjs/functions/reference/indirect/indirect.cjs.map +2 -2
- package/dist/cjs/functions/reference/offset/offset.cjs +19 -9
- package/dist/cjs/functions/reference/offset/offset.cjs.map +2 -2
- package/dist/cjs/functions/text/concatenate/concatenate.cjs +21 -9
- package/dist/cjs/functions/text/concatenate/concatenate.cjs.map +3 -3
- package/dist/cjs/functions/text/exact/exact.cjs +19 -9
- package/dist/cjs/functions/text/exact/exact.cjs.map +2 -2
- package/dist/cjs/functions/text/find/find.cjs +19 -9
- package/dist/cjs/functions/text/find/find.cjs.map +2 -2
- package/dist/cjs/functions/text/left/left.cjs +19 -9
- package/dist/cjs/functions/text/left/left.cjs.map +2 -2
- package/dist/cjs/functions/text/len/len.cjs +19 -9
- package/dist/cjs/functions/text/len/len.cjs.map +2 -2
- package/dist/cjs/functions/text/mid/mid.cjs +19 -9
- package/dist/cjs/functions/text/mid/mid.cjs.map +2 -2
- package/dist/cjs/functions/text/right/right.cjs +19 -9
- package/dist/cjs/functions/text/right/right.cjs.map +2 -2
- package/dist/cjs/functions/text/text-helpers.cjs +19 -9
- package/dist/cjs/functions/text/text-helpers.cjs.map +2 -2
- package/dist/cjs/functions/text/textjoin/textjoin.cjs +19 -9
- package/dist/cjs/functions/text/textjoin/textjoin.cjs.map +2 -2
- package/dist/cjs/lib.cjs +24 -13
- package/dist/cjs/lib.cjs.map +2 -2
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/parser/ast.cjs +19 -9
- package/dist/cjs/parser/ast.cjs.map +2 -2
- package/dist/cjs/parser/formatter.cjs +19 -9
- package/dist/cjs/parser/formatter.cjs.map +2 -2
- package/dist/cjs/parser/grammar.cjs +19 -9
- package/dist/cjs/parser/grammar.cjs.map +2 -2
- package/dist/cjs/parser/lexer.cjs +19 -9
- package/dist/cjs/parser/lexer.cjs.map +2 -2
- package/dist/cjs/parser/parser.cjs +19 -9
- package/dist/cjs/parser/parser.cjs.map +2 -2
- package/dist/cjs/react/hooks.cjs +31 -10
- package/dist/cjs/react/hooks.cjs.map +2 -2
- package/dist/mjs/core/commands/command-executor.mjs +7 -5
- package/dist/mjs/core/commands/command-executor.mjs.map +3 -3
- package/dist/mjs/core/commands/content-commands.mjs +279 -2
- package/dist/mjs/core/commands/content-commands.mjs.map +3 -3
- package/dist/mjs/core/commands/named-expression-commands.mjs +121 -6
- package/dist/mjs/core/commands/named-expression-commands.mjs.map +3 -3
- package/dist/mjs/core/commands/structure-commands.mjs +204 -8
- package/dist/mjs/core/commands/structure-commands.mjs.map +3 -3
- package/dist/mjs/core/commands/table-commands.mjs +117 -6
- package/dist/mjs/core/commands/table-commands.mjs.map +3 -3
- package/dist/mjs/core/commands/types.mjs +18 -1
- package/dist/mjs/core/commands/types.mjs.map +3 -3
- package/dist/mjs/core/engine-snapshot.mjs +11 -0
- package/dist/mjs/core/engine-snapshot.mjs.map +10 -0
- package/dist/mjs/core/engine.mjs +42 -26
- package/dist/mjs/core/engine.mjs.map +3 -3
- package/dist/mjs/core/managers/cache-manager.mjs +105 -1
- package/dist/mjs/core/managers/cache-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/dependency-manager.mjs +687 -2
- package/dist/mjs/core/managers/dependency-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/evaluation-manager.mjs +283 -4
- package/dist/mjs/core/managers/evaluation-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/frontier-dependency-manager.mjs +47 -4
- package/dist/mjs/core/managers/frontier-dependency-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/named-expression-manager.mjs +104 -21
- package/dist/mjs/core/managers/named-expression-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/reference-manager.mjs +7 -1
- package/dist/mjs/core/managers/reference-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/style-manager.mjs +10 -1
- package/dist/mjs/core/managers/style-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/table-manager.mjs +7 -1
- package/dist/mjs/core/managers/table-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/workbook-manager.mjs +20 -5
- package/dist/mjs/core/managers/workbook-manager.mjs.map +3 -3
- package/dist/mjs/core/resource-keys.mjs +27 -0
- package/dist/mjs/core/resource-keys.mjs.map +10 -0
- package/dist/mjs/evaluator/dependency-nodes/base-eval-node.mjs +17 -1
- package/dist/mjs/evaluator/dependency-nodes/base-eval-node.mjs.map +3 -3
- package/dist/mjs/evaluator/dependency-nodes/cell-value-node.mjs +4 -1
- package/dist/mjs/evaluator/dependency-nodes/cell-value-node.mjs.map +3 -3
- package/dist/mjs/evaluator/dependency-nodes/empty-cell-evaluation-node.mjs +17 -3
- package/dist/mjs/evaluator/dependency-nodes/empty-cell-evaluation-node.mjs.map +3 -3
- package/dist/mjs/evaluator/dependency-nodes/resource-dependency-node.mjs +21 -0
- package/dist/mjs/evaluator/dependency-nodes/resource-dependency-node.mjs.map +10 -0
- package/dist/mjs/evaluator/dependency-nodes/virtual-cell-value-node.mjs +4 -1
- package/dist/mjs/evaluator/dependency-nodes/virtual-cell-value-node.mjs.map +3 -3
- package/dist/mjs/evaluator/formula-evaluator.mjs +42 -4
- package/dist/mjs/evaluator/formula-evaluator.mjs.map +3 -3
- package/dist/mjs/evaluator/range-evaluation-node.mjs +17 -3
- package/dist/mjs/evaluator/range-evaluation-node.mjs.map +3 -3
- package/dist/mjs/functions/lookup/match/match.mjs +3 -2
- package/dist/mjs/functions/lookup/match/match.mjs.map +3 -3
- package/dist/mjs/functions/text/concatenate/concatenate.mjs +3 -1
- package/dist/mjs/functions/text/concatenate/concatenate.mjs.map +3 -3
- package/dist/mjs/package.json +1 -1
- package/dist/types/core/commands/content-commands.d.ts +31 -1
- package/dist/types/core/commands/named-expression-commands.d.ts +16 -1
- package/dist/types/core/commands/structure-commands.d.ts +24 -1
- package/dist/types/core/commands/table-commands.d.ts +16 -1
- package/dist/types/core/commands/types.d.ts +25 -1
- package/dist/types/core/engine-snapshot.d.ts +138 -0
- package/dist/types/core/engine.d.ts +19 -1
- package/dist/types/core/managers/cache-manager.d.ts +9 -0
- package/dist/types/core/managers/dependency-manager.d.ts +56 -1
- package/dist/types/core/managers/dependency-node.d.ts +2 -1
- package/dist/types/core/managers/evaluation-manager.d.ts +21 -1
- package/dist/types/core/managers/frontier-dependency-manager.d.ts +12 -2
- package/dist/types/core/managers/named-expression-manager.d.ts +17 -1
- package/dist/types/core/managers/reference-manager.d.ts +3 -0
- package/dist/types/core/managers/style-manager.d.ts +3 -0
- package/dist/types/core/managers/table-manager.d.ts +3 -0
- package/dist/types/core/managers/workbook-manager.d.ts +4 -1
- package/dist/types/core/resource-keys.d.ts +14 -0
- package/dist/types/evaluator/dependency-nodes/base-eval-node.d.ts +5 -0
- package/dist/types/evaluator/dependency-nodes/cell-value-node.d.ts +1 -0
- package/dist/types/evaluator/dependency-nodes/empty-cell-evaluation-node.d.ts +8 -1
- package/dist/types/evaluator/dependency-nodes/resource-dependency-node.d.ts +8 -0
- package/dist/types/evaluator/dependency-nodes/virtual-cell-value-node.d.ts +1 -0
- package/dist/types/evaluator/range-evaluation-node.d.ts +8 -1
- package/package.json +6 -2
|
@@ -4,7 +4,27 @@
|
|
|
4
4
|
* Commands encapsulate all mutating operations on the engine,
|
|
5
5
|
* enabling undo/redo, schema validation with rollback, and action serialization.
|
|
6
6
|
*/
|
|
7
|
-
import type { CellAddress } from "../types";
|
|
7
|
+
import type { CellAddress, SerializedCellValue } from "../types";
|
|
8
|
+
export type CellContentKind = "empty" | "scalar" | "formula";
|
|
9
|
+
export type RemovedScope = {
|
|
10
|
+
type: "workbook";
|
|
11
|
+
workbookName: string;
|
|
12
|
+
} | {
|
|
13
|
+
type: "sheet";
|
|
14
|
+
workbookName: string;
|
|
15
|
+
sheetName: string;
|
|
16
|
+
};
|
|
17
|
+
export type MutationInvalidation = {
|
|
18
|
+
touchedCells: Array<{
|
|
19
|
+
address: CellAddress;
|
|
20
|
+
beforeKind: CellContentKind;
|
|
21
|
+
afterKind: CellContentKind;
|
|
22
|
+
}>;
|
|
23
|
+
resourceKeys: string[];
|
|
24
|
+
removedScopes?: RemovedScope[];
|
|
25
|
+
};
|
|
26
|
+
export declare function getSerializedCellValueKind(value: SerializedCellValue | undefined): CellContentKind;
|
|
27
|
+
export declare function emptyMutationInvalidation(): MutationInvalidation;
|
|
8
28
|
/**
|
|
9
29
|
* Serializable action representation of a command.
|
|
10
30
|
* Used for persistence, collaboration, and changelog functionality.
|
|
@@ -23,6 +43,10 @@ export interface EngineCommand {
|
|
|
23
43
|
* Commands that only affect metadata or styles don't need re-evaluation.
|
|
24
44
|
*/
|
|
25
45
|
readonly requiresReevaluation: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the exact mutation footprint for the last execute/undo pass.
|
|
48
|
+
*/
|
|
49
|
+
getInvalidationFootprint?(phase: "execute" | "undo"): MutationInvalidation;
|
|
26
50
|
/**
|
|
27
51
|
* Execute the command (forward operation).
|
|
28
52
|
*/
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { ContextDependency } from "../evaluator/evaluation-context";
|
|
2
|
+
import type { DependencyNode } from "./managers/dependency-node";
|
|
3
|
+
import type { CellAddress, CellInRangeResult, CellValue, ConditionalStyle, DirectCellStyle, FormulaError, NamedExpression, RangeAddress, RelativeRange, SpreadsheetRange, TableDefinition, TrackedReference, Workbook } from "./types";
|
|
4
|
+
export declare const ENGINE_SNAPSHOT_VERSION: 3;
|
|
5
|
+
export type NodeSnapshotId = string;
|
|
6
|
+
export type NamedExpressionManagerSnapshot = {
|
|
7
|
+
sheetExpressions: Map<string, Map<string, Map<string, NamedExpression>>>;
|
|
8
|
+
workbookExpressions: Map<string, Map<string, NamedExpression>>;
|
|
9
|
+
globalExpressions: Map<string, NamedExpression>;
|
|
10
|
+
};
|
|
11
|
+
export type WorkbookManagerSnapshot = Map<string, Workbook>;
|
|
12
|
+
export type TableManagerSnapshot = Map<string, Map<string, TableDefinition>>;
|
|
13
|
+
export type StyleManagerSnapshot = {
|
|
14
|
+
conditionalStyles: ConditionalStyle[];
|
|
15
|
+
cellStyles: DirectCellStyle[];
|
|
16
|
+
};
|
|
17
|
+
export type ReferenceManagerSnapshot = Map<string, TrackedReference>;
|
|
18
|
+
export type SerializedValueEvaluationResultSnapshot = {
|
|
19
|
+
type: "value";
|
|
20
|
+
result: CellValue;
|
|
21
|
+
sourceCell?: CellAddress;
|
|
22
|
+
};
|
|
23
|
+
export type SerializedErrorEvaluationResultSnapshot = {
|
|
24
|
+
type: "error";
|
|
25
|
+
err: FormulaError;
|
|
26
|
+
message: string;
|
|
27
|
+
errAddressId: NodeSnapshotId;
|
|
28
|
+
sourceCell?: CellAddress;
|
|
29
|
+
};
|
|
30
|
+
export type SerializedSingleEvaluationResultSnapshot = SerializedValueEvaluationResultSnapshot | SerializedErrorEvaluationResultSnapshot;
|
|
31
|
+
export type SerializedCellInRangeResultSnapshot = {
|
|
32
|
+
relativePos: CellInRangeResult["relativePos"];
|
|
33
|
+
result: SerializedSingleEvaluationResultSnapshot;
|
|
34
|
+
};
|
|
35
|
+
export type SerializedEvaluateAllCellsResultSnapshot = SerializedErrorEvaluationResultSnapshot | {
|
|
36
|
+
type: "values";
|
|
37
|
+
values: SerializedCellInRangeResultSnapshot[];
|
|
38
|
+
};
|
|
39
|
+
export type SerializedMaterializedSpillSnapshot = {
|
|
40
|
+
kind: "materialized";
|
|
41
|
+
relativeSpillArea: RelativeRange;
|
|
42
|
+
source: string;
|
|
43
|
+
sourceCell?: CellAddress;
|
|
44
|
+
sourceRange?: RangeAddress;
|
|
45
|
+
values: SerializedCellInRangeResultSnapshot[];
|
|
46
|
+
};
|
|
47
|
+
export type SerializedSourceRangeSpillSnapshot = {
|
|
48
|
+
kind: "source-range";
|
|
49
|
+
relativeSpillArea: RelativeRange;
|
|
50
|
+
source: string;
|
|
51
|
+
sourceCell?: CellAddress;
|
|
52
|
+
sourceRange: RangeAddress;
|
|
53
|
+
};
|
|
54
|
+
export type SerializedSpillResultSnapshot = SerializedMaterializedSpillSnapshot | SerializedSourceRangeSpillSnapshot;
|
|
55
|
+
export type SerializedSpilledValuesEvaluationResultSnapshot = {
|
|
56
|
+
type: "spilled-values";
|
|
57
|
+
spill: SerializedSpillResultSnapshot;
|
|
58
|
+
};
|
|
59
|
+
export type SerializedFunctionEvaluationResultSnapshot = SerializedSingleEvaluationResultSnapshot | SerializedSpilledValuesEvaluationResultSnapshot;
|
|
60
|
+
export type SerializedSpillMetaEvaluationResultSnapshot = SerializedErrorEvaluationResultSnapshot | SerializedSpilledValuesEvaluationResultSnapshot | {
|
|
61
|
+
type: "does-not-spill";
|
|
62
|
+
};
|
|
63
|
+
type SerializedBaseNodeSnapshot = {
|
|
64
|
+
snapshotId: NodeSnapshotId;
|
|
65
|
+
key: string;
|
|
66
|
+
dependencies: NodeSnapshotId[];
|
|
67
|
+
};
|
|
68
|
+
export type SerializedCellValueNodeSnapshot = SerializedBaseNodeSnapshot & {
|
|
69
|
+
kind: "cell-value";
|
|
70
|
+
evaluationResult: SerializedSingleEvaluationResultSnapshot;
|
|
71
|
+
spillMetaSnapshotId?: NodeSnapshotId;
|
|
72
|
+
};
|
|
73
|
+
export type SerializedSpillMetaNodeSnapshot = SerializedBaseNodeSnapshot & {
|
|
74
|
+
kind: "spill-meta";
|
|
75
|
+
evaluationResult: SerializedSpillMetaEvaluationResultSnapshot;
|
|
76
|
+
};
|
|
77
|
+
export type SerializedEmptyCellNodeSnapshot = SerializedBaseNodeSnapshot & {
|
|
78
|
+
kind: "empty";
|
|
79
|
+
evaluationResult: SerializedSingleEvaluationResultSnapshot;
|
|
80
|
+
};
|
|
81
|
+
export type SerializedRangeNodeSnapshot = SerializedBaseNodeSnapshot & {
|
|
82
|
+
kind: "range";
|
|
83
|
+
result: SerializedEvaluateAllCellsResultSnapshot;
|
|
84
|
+
};
|
|
85
|
+
export type SerializedAstNodeSnapshot = SerializedBaseNodeSnapshot & {
|
|
86
|
+
kind: "ast";
|
|
87
|
+
contextDependency: ContextDependency;
|
|
88
|
+
evaluationResult: SerializedFunctionEvaluationResultSnapshot;
|
|
89
|
+
};
|
|
90
|
+
export type SerializedResourceNodeSnapshot = SerializedBaseNodeSnapshot & {
|
|
91
|
+
kind: "resource";
|
|
92
|
+
};
|
|
93
|
+
export type SerializedDependencyNodeSnapshot = SerializedCellValueNodeSnapshot | SerializedSpillMetaNodeSnapshot | SerializedEmptyCellNodeSnapshot | SerializedRangeNodeSnapshot | SerializedAstNodeSnapshot | SerializedResourceNodeSnapshot;
|
|
94
|
+
export type DependencyManagerSnapshot = {
|
|
95
|
+
nodes: SerializedDependencyNodeSnapshot[];
|
|
96
|
+
spilledValues: Array<[string, {
|
|
97
|
+
origin: CellAddress;
|
|
98
|
+
spillOnto: SpreadsheetRange;
|
|
99
|
+
}]>;
|
|
100
|
+
};
|
|
101
|
+
export type SerializedSCCSnapshot = {
|
|
102
|
+
id: number;
|
|
103
|
+
nodes: NodeSnapshotId[];
|
|
104
|
+
evaluationOrder: NodeSnapshotId[];
|
|
105
|
+
resolved: boolean;
|
|
106
|
+
hardEdgeSCCs: NodeSnapshotId[][];
|
|
107
|
+
};
|
|
108
|
+
export type SerializedEvaluationOrderSnapshot = {
|
|
109
|
+
nodeKey: string;
|
|
110
|
+
evaluationOrder: NodeSnapshotId[];
|
|
111
|
+
hasCycle: boolean;
|
|
112
|
+
cycleNodes?: NodeSnapshotId[];
|
|
113
|
+
hash: string;
|
|
114
|
+
};
|
|
115
|
+
export type CacheManagerSnapshot = {
|
|
116
|
+
evaluationOrders: SerializedEvaluationOrderSnapshot[];
|
|
117
|
+
sccs: Array<{
|
|
118
|
+
hash: string;
|
|
119
|
+
scc: SerializedSCCSnapshot;
|
|
120
|
+
}>;
|
|
121
|
+
};
|
|
122
|
+
export type EngineSnapshotV3 = {
|
|
123
|
+
version: typeof ENGINE_SNAPSHOT_VERSION;
|
|
124
|
+
managers: {
|
|
125
|
+
workbook: WorkbookManagerSnapshot;
|
|
126
|
+
namedExpression: NamedExpressionManagerSnapshot;
|
|
127
|
+
table: TableManagerSnapshot;
|
|
128
|
+
style: StyleManagerSnapshot;
|
|
129
|
+
reference: ReferenceManagerSnapshot;
|
|
130
|
+
dependency: DependencyManagerSnapshot;
|
|
131
|
+
cache: CacheManagerSnapshot;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
export type EngineSnapshotV2 = EngineSnapshotV3;
|
|
135
|
+
export declare function getAstNodeSnapshotId(node: DependencyNode & {
|
|
136
|
+
getContextDependency(): ContextDependency;
|
|
137
|
+
}): NodeSnapshotId;
|
|
138
|
+
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Main FormulaEngine class
|
|
3
3
|
* Core API implementation for spreadsheet calculations
|
|
4
4
|
*/
|
|
5
|
-
import { type CellAddress, type CellStyle, type ConditionalStyle, type CopyCellsOptions, type DirectCellStyle, type NamedExpression, type RangeAddress, type SerializedCellValue, type SingleEvaluationResult, type SpreadsheetRange, type SpreadsheetRangeEnd, type TableDefinition } from "./types";
|
|
5
|
+
import { type CellAddress, type CellStyle, type ConditionalStyle, type CopyCellsOptions, type DirectCellStyle, type FiniteSpreadsheetRange, type NamedExpression, type RangeAddress, type SerializedCellValue, type SingleEvaluationResult, type SpreadsheetRange, type SpreadsheetRangeEnd, type TableDefinition } from "./types";
|
|
6
6
|
import type { FillDirection } from "@ricsam/selection-manager";
|
|
7
7
|
import { AutoFill } from "./autofill-utils";
|
|
8
8
|
import { WorkbookManager } from "./managers/workbook-manager";
|
|
@@ -15,6 +15,7 @@ import { StyleManager } from "./managers/style-manager";
|
|
|
15
15
|
import type { Schema, CreateSchema, SchemaDeclaration } from "./schema/schema";
|
|
16
16
|
import { TableOrm } from "./schema/table-orm";
|
|
17
17
|
import { CellOrm } from "./schema/cell-orm";
|
|
18
|
+
import { GridOrm } from "./schema/grid-orm";
|
|
18
19
|
import type { TableSchemaHeaders } from "./managers/schema-manager";
|
|
19
20
|
import { type EngineAction } from "./commands/types";
|
|
20
21
|
type Metadata = {
|
|
@@ -87,6 +88,22 @@ export declare class FormulaEngine<TMetadata extends Metadata = Metadata, TCreat
|
|
|
87
88
|
value: SerializedCellValue;
|
|
88
89
|
metadata?: MetadataType<TMetadata, "cell">;
|
|
89
90
|
}): CellOrm<TValue>;
|
|
91
|
+
/**
|
|
92
|
+
* Add a grid schema at runtime
|
|
93
|
+
* @param namespace - Unique namespace for the schema
|
|
94
|
+
* @param address - Grid address (workbookName and sheetName)
|
|
95
|
+
* @param range - Finite range of cells for the grid
|
|
96
|
+
* @param parse - Parse function for the cell values
|
|
97
|
+
* @param write - Write function for serializing values (optional for primitive types)
|
|
98
|
+
* @returns The GridOrm instance for immediate use
|
|
99
|
+
*/
|
|
100
|
+
addGridSchema<TValue>(namespace: string, address: {
|
|
101
|
+
workbookName: string;
|
|
102
|
+
sheetName: string;
|
|
103
|
+
}, range: FiniteSpreadsheetRange, parse: (value: unknown, metadata: MetadataType<TMetadata, "cell">) => TValue, write?: (value: TValue) => {
|
|
104
|
+
value: SerializedCellValue;
|
|
105
|
+
metadata?: MetadataType<TMetadata, "cell">;
|
|
106
|
+
}): GridOrm<TValue, MetadataType<TMetadata, "cell">>;
|
|
90
107
|
getCellEvaluationResult(cellAddress: CellAddress): SingleEvaluationResult | undefined;
|
|
91
108
|
getCellValue(cellAddress: CellAddress, debug?: boolean): SerializedCellValue;
|
|
92
109
|
/**
|
|
@@ -503,6 +520,7 @@ export declare class FormulaEngine<TMetadata extends Metadata = Metadata, TCreat
|
|
|
503
520
|
references: Map<string, import("./types").TrackedReference>;
|
|
504
521
|
};
|
|
505
522
|
onUpdate(listener: () => void): () => void;
|
|
523
|
+
private buildSerializedSnapshot;
|
|
506
524
|
serializeEngine(): string;
|
|
507
525
|
resetToSerializedEngine(data: string): void;
|
|
508
526
|
/**
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { EvaluationOrder, SCC } from "../types";
|
|
2
|
+
import type { DependencyNode } from "./dependency-node";
|
|
3
|
+
import type { CacheManagerSnapshot, NodeSnapshotId } from "../engine-snapshot";
|
|
2
4
|
export declare class CacheManager {
|
|
3
5
|
private _evaluationOrderCache;
|
|
4
6
|
/**
|
|
@@ -8,7 +10,14 @@ export declare class CacheManager {
|
|
|
8
10
|
constructor();
|
|
9
11
|
setEvaluationOrder(nodeKey: string, evaluationOrder: EvaluationOrder): void;
|
|
10
12
|
getEvaluationOrder(nodeKey: string): EvaluationOrder | undefined;
|
|
13
|
+
deleteEvaluationOrder(nodeKey: string): void;
|
|
14
|
+
deleteEvaluationOrders(nodeKeys: Iterable<string>): void;
|
|
11
15
|
setSCC(sccHash: string, scc: SCC): void;
|
|
12
16
|
getSCC(sccHash: string): SCC | undefined;
|
|
17
|
+
clearSCCCache(): void;
|
|
13
18
|
clear(): void;
|
|
19
|
+
toSnapshot(getNodeSnapshotId: (node: DependencyNode) => NodeSnapshotId | undefined): CacheManagerSnapshot;
|
|
20
|
+
restoreFromSnapshot(snapshot: CacheManagerSnapshot, resolveNodeSnapshotId: (nodeId: NodeSnapshotId) => DependencyNode | undefined): void;
|
|
21
|
+
private serializeSCC;
|
|
22
|
+
private deserializeSCC;
|
|
14
23
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CacheManagerSnapshot, type DependencyManagerSnapshot } from "../engine-snapshot";
|
|
1
2
|
import { type ContextDependency } from "../../evaluator/evaluation-context";
|
|
2
3
|
import { type CellAddress, type EvaluationOrder, type SerializedCellValue, type SpilledValue } from "../types";
|
|
3
4
|
import { AstEvaluationNode } from "../../evaluator/dependency-nodes/ast-evaluation-node";
|
|
@@ -10,6 +11,9 @@ import { CacheManager } from "./cache-manager";
|
|
|
10
11
|
import type { DependencyNode } from "./dependency-node";
|
|
11
12
|
import { WorkbookManager } from "./workbook-manager";
|
|
12
13
|
import { VirtualCellValueNode } from "../../evaluator/dependency-nodes/virtual-cell-value-node";
|
|
14
|
+
import type { EvaluationManager } from "./evaluation-manager";
|
|
15
|
+
import type { MutationInvalidation } from "../commands/types";
|
|
16
|
+
import { ResourceDependencyNode } from "../../evaluator/dependency-nodes/resource-dependency-node";
|
|
13
17
|
export interface DependencyTreeNode {
|
|
14
18
|
type: "cell" | "range" | "empty";
|
|
15
19
|
circular?: boolean;
|
|
@@ -17,7 +21,7 @@ export interface DependencyTreeNode {
|
|
|
17
21
|
directDepsUpdated?: boolean;
|
|
18
22
|
resolved?: boolean;
|
|
19
23
|
canResolve: boolean;
|
|
20
|
-
resultType: "awaiting-evaluation" | "spilled-values" | "value" | "range" | "error" | "does-not-spill";
|
|
24
|
+
resultType: "awaiting-evaluation" | "spilled-values" | "value" | "range" | "error" | "does-not-spill" | "resource";
|
|
21
25
|
deps?: DependencyTreeNode[];
|
|
22
26
|
frontierDependencies?: DependencyTreeNode[];
|
|
23
27
|
self?: boolean;
|
|
@@ -48,7 +52,33 @@ export declare class DependencyManager {
|
|
|
48
52
|
* Key is workbook:sheetName:rangeKey, e.g. Workbook1:Sheet1:A1:D10, from rangeAddressToKey
|
|
49
53
|
*/
|
|
50
54
|
private ranges;
|
|
55
|
+
private resourceNodes;
|
|
56
|
+
private hardDependents;
|
|
57
|
+
private frontierDependents;
|
|
58
|
+
private registeredDependencies;
|
|
59
|
+
private coverageWatchersBySheet;
|
|
60
|
+
private frontierWatchersBySheet;
|
|
51
61
|
constructor(cacheManager: CacheManager, workbookManager: WorkbookManager);
|
|
62
|
+
private getSheetWatcherKey;
|
|
63
|
+
private addReverseEdge;
|
|
64
|
+
private removeReverseEdge;
|
|
65
|
+
private getWatcherRange;
|
|
66
|
+
private addWatcher;
|
|
67
|
+
private removeWatcher;
|
|
68
|
+
private registerWatcherNode;
|
|
69
|
+
private unregisterWatcherNode;
|
|
70
|
+
private isWatcherNodeResolved;
|
|
71
|
+
private getAllPersistentNodes;
|
|
72
|
+
private getExistingCellValueNode;
|
|
73
|
+
private getExistingSpillMetaNode;
|
|
74
|
+
private getExistingEmptyCellNode;
|
|
75
|
+
private collectExistingNodesForCell;
|
|
76
|
+
private collectSpillOriginsAffectingCell;
|
|
77
|
+
private getLinkedSpillMetaNode;
|
|
78
|
+
private getLinkedCellValueNode;
|
|
79
|
+
registerNode(node: DependencyNode): void;
|
|
80
|
+
unregisterNode(node: DependencyNode): void;
|
|
81
|
+
private rebuildRuntimeIndexes;
|
|
52
82
|
get spilledValues(): IterableIterator<SpilledValue>;
|
|
53
83
|
isSpillOrigin(cellAddress: CellAddress): boolean;
|
|
54
84
|
getSpillValue(cellAddress: CellAddress): SpilledValue | undefined;
|
|
@@ -64,11 +94,23 @@ export declare class DependencyManager {
|
|
|
64
94
|
};
|
|
65
95
|
};
|
|
66
96
|
clearEvaluationCache(): void;
|
|
97
|
+
toSnapshot(evaluationManager: EvaluationManager): {
|
|
98
|
+
dependency: DependencyManagerSnapshot;
|
|
99
|
+
cache: CacheManagerSnapshot;
|
|
100
|
+
};
|
|
101
|
+
restoreFromSnapshot(snapshots: {
|
|
102
|
+
dependency: DependencyManagerSnapshot;
|
|
103
|
+
cache: CacheManagerSnapshot;
|
|
104
|
+
}, evaluationManager: EvaluationManager): void;
|
|
105
|
+
private serializeNodeSnapshot;
|
|
106
|
+
private createNodeFromSnapshot;
|
|
67
107
|
setSpilledValue(nodeKey: string, spilledValue: SpilledValue): void;
|
|
68
108
|
getSpilledValue(nodeKey: string): SpilledValue | undefined;
|
|
109
|
+
deleteSpilledValue(nodeKey: string): void;
|
|
69
110
|
getEmptyCellNode(nodeKey: string): EmptyCellEvaluationNode;
|
|
70
111
|
getSpillMetaNode(nodeKey: string): SpillMetaNode;
|
|
71
112
|
getCellValueNode(nodeKey: string): CellValueNode;
|
|
113
|
+
getResourceNode(resourceKey: string): ResourceDependencyNode;
|
|
72
114
|
getCellValueOrEmptyCellNode(nodeKey: string): CellValueNode | EmptyCellEvaluationNode;
|
|
73
115
|
getSpillMetaOrEmptySpillMetaNode(nodeKey: string): SpillMetaNode | EmptyCellEvaluationNode;
|
|
74
116
|
getVirtualCellValueNode(cellAddress: CellAddress, cellValue: SerializedCellValue): VirtualCellValueNode;
|
|
@@ -98,6 +140,19 @@ export declare class DependencyManager {
|
|
|
98
140
|
* only resolved ast nodes can be saved
|
|
99
141
|
*/
|
|
100
142
|
private saveAstNode;
|
|
143
|
+
private isFiniteEndAfter;
|
|
144
|
+
private doesAddressAffectWatcherFrontier;
|
|
145
|
+
private collectCoverageWatchers;
|
|
146
|
+
private collectFrontierWatchers;
|
|
147
|
+
private collectWatchersIntersectingRange;
|
|
148
|
+
private getNodeDependents;
|
|
149
|
+
private collectInvalidationExtras;
|
|
150
|
+
private invalidateNodeState;
|
|
151
|
+
private isResourceNodeInRemovedScope;
|
|
152
|
+
private isNodeInRemovedScope;
|
|
153
|
+
private collectNodesForRemovedScopes;
|
|
154
|
+
private purgeRemovedScopes;
|
|
155
|
+
invalidateFromMutation(footprint: MutationInvalidation): void;
|
|
101
156
|
/**
|
|
102
157
|
* Get transitive dependencies and transitive frontier dependencies
|
|
103
158
|
* This is only used by buildEvaluationOrder, so we'll optimize it there
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AstEvaluationNode } from "../../evaluator/dependency-nodes/ast-evaluation-node";
|
|
2
2
|
import { CellValueNode } from "../../evaluator/dependency-nodes/cell-value-node";
|
|
3
3
|
import { EmptyCellEvaluationNode } from "../../evaluator/dependency-nodes/empty-cell-evaluation-node";
|
|
4
|
+
import { ResourceDependencyNode } from "../../evaluator/dependency-nodes/resource-dependency-node";
|
|
4
5
|
import { SpillMetaNode } from "../../evaluator/dependency-nodes/spill-meta-node";
|
|
5
6
|
import { RangeEvaluationNode } from "../../evaluator/range-evaluation-node";
|
|
6
|
-
export type DependencyNode = CellValueNode | RangeEvaluationNode | EmptyCellEvaluationNode | AstEvaluationNode | SpillMetaNode;
|
|
7
|
+
export type DependencyNode = CellValueNode | RangeEvaluationNode | EmptyCellEvaluationNode | AstEvaluationNode | SpillMetaNode | ResourceDependencyNode;
|
|
7
8
|
export type CellNodeType = "cell-value" | "empty" | "spill-meta";
|
|
8
9
|
export type CellNodeKey = `${CellNodeType}:${string}`;
|
|
9
10
|
export type CellNodeKeyDictionary = {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { AstEvaluationNode } from "../../evaluator/dependency-nodes/ast-evaluation-node";
|
|
1
2
|
import { CellValueNode } from "../../evaluator/dependency-nodes/cell-value-node";
|
|
2
3
|
import { RangeEvaluationNode } from "../../evaluator/range-evaluation-node";
|
|
3
4
|
import { FormulaEvaluator } from "../../evaluator/formula-evaluator";
|
|
4
|
-
import { type CellAddress, type CellValue, type SerializedCellValue, type SingleEvaluationResult, type SpreadsheetRange } from "../types";
|
|
5
|
+
import { type CellAddress, type CellValue, type EvaluateAllCellsResult, type FunctionEvaluationResult, type SerializedCellValue, type SingleEvaluationResult, type SpreadsheetRange } from "../types";
|
|
5
6
|
import type { DependencyManager } from "./dependency-manager";
|
|
6
7
|
import type { WorkbookManager } from "./workbook-manager";
|
|
7
8
|
import { SpillMetaNode } from "../../evaluator/dependency-nodes/spill-meta-node";
|
|
@@ -9,6 +10,8 @@ import { EmptyCellEvaluationNode } from "../../evaluator/dependency-nodes/empty-
|
|
|
9
10
|
import type { TableManager } from "./table-manager";
|
|
10
11
|
import type { DependencyNode } from "./dependency-node";
|
|
11
12
|
import { VirtualCellValueNode } from "../../evaluator/dependency-nodes/virtual-cell-value-node";
|
|
13
|
+
import type { NodeSnapshotId, SerializedEvaluateAllCellsResultSnapshot, SerializedFunctionEvaluationResultSnapshot, SerializedSingleEvaluationResultSnapshot, SerializedSpillMetaEvaluationResultSnapshot } from "../engine-snapshot";
|
|
14
|
+
import type { MutationInvalidation } from "../commands/types";
|
|
12
15
|
export declare class EvaluationManager {
|
|
13
16
|
private workbookManager;
|
|
14
17
|
private tableManager;
|
|
@@ -17,7 +20,24 @@ export declare class EvaluationManager {
|
|
|
17
20
|
private isEvaluating;
|
|
18
21
|
constructor(workbookManager: WorkbookManager, tableManager: TableManager, formulaEvaluator: FormulaEvaluator, dependencyManager: DependencyManager);
|
|
19
22
|
clearEvaluationCache(): void;
|
|
23
|
+
invalidateFromMutation(footprint: MutationInvalidation): void;
|
|
20
24
|
evaluationResultToSerializedValue(evaluation: SingleEvaluationResult, cellAddress: CellAddress, debug?: boolean): SerializedCellValue;
|
|
25
|
+
private buildSnapshotOrigin;
|
|
26
|
+
private serializeErrorEvaluationResultSnapshot;
|
|
27
|
+
serializeSingleEvaluationResultSnapshot(evaluation: SingleEvaluationResult, getNodeSnapshotId: (node: DependencyNode) => NodeSnapshotId): SerializedSingleEvaluationResultSnapshot | undefined;
|
|
28
|
+
deserializeSingleEvaluationResultSnapshot(evaluation: SerializedSingleEvaluationResultSnapshot, resolveNodeSnapshotId: (nodeId: NodeSnapshotId) => DependencyNode): SingleEvaluationResult;
|
|
29
|
+
serializeEvaluateAllCellsResultSnapshot(evaluation: EvaluateAllCellsResult, getNodeSnapshotId: (node: DependencyNode) => NodeSnapshotId): SerializedEvaluateAllCellsResultSnapshot | undefined;
|
|
30
|
+
deserializeEvaluateAllCellsResultSnapshot(evaluation: SerializedEvaluateAllCellsResultSnapshot, resolveNodeSnapshotId: (nodeId: NodeSnapshotId) => DependencyNode): EvaluateAllCellsResult;
|
|
31
|
+
serializeFunctionEvaluationResultSnapshot(evaluation: FunctionEvaluationResult, options: {
|
|
32
|
+
sourceNode: CellValueNode | SpillMetaNode | AstEvaluationNode;
|
|
33
|
+
getNodeSnapshotId: (node: DependencyNode) => NodeSnapshotId;
|
|
34
|
+
}): SerializedFunctionEvaluationResultSnapshot | undefined;
|
|
35
|
+
deserializeFunctionEvaluationResultSnapshot(evaluation: SerializedFunctionEvaluationResultSnapshot, resolveNodeSnapshotId: (nodeId: NodeSnapshotId) => DependencyNode): FunctionEvaluationResult;
|
|
36
|
+
serializeSpillMetaEvaluationResultSnapshot(evaluation: SpillMetaNode["evaluationResult"], options: {
|
|
37
|
+
sourceNode: CellValueNode | SpillMetaNode | AstEvaluationNode;
|
|
38
|
+
getNodeSnapshotId: (node: DependencyNode) => NodeSnapshotId;
|
|
39
|
+
}): SerializedSpillMetaEvaluationResultSnapshot | undefined;
|
|
40
|
+
deserializeSpillMetaEvaluationResultSnapshot(evaluation: SerializedSpillMetaEvaluationResultSnapshot, resolveNodeSnapshotId: (nodeId: NodeSnapshotId) => DependencyNode): SpillMetaNode["evaluationResult"];
|
|
21
41
|
evaluateEmptyCell(node: EmptyCellEvaluationNode): void;
|
|
22
42
|
evaluateRangeNode(node: RangeEvaluationNode): void;
|
|
23
43
|
evaluateCellNode(node: CellValueNode | SpillMetaNode | VirtualCellValueNode): void;
|
|
@@ -18,13 +18,18 @@ type EvalOrderEntry = {
|
|
|
18
18
|
candidates: SpillMetaNode[];
|
|
19
19
|
};
|
|
20
20
|
export declare class FrontierDependencyManager {
|
|
21
|
-
|
|
21
|
+
protected readonly frontierRange: RangeAddress;
|
|
22
22
|
protected workbookManager: WorkbookManager;
|
|
23
23
|
protected evaluationManager: DependencyManager;
|
|
24
24
|
private evalOrder;
|
|
25
25
|
private _resolved;
|
|
26
26
|
private _directDepsUpdated;
|
|
27
|
-
|
|
27
|
+
private evalOrderInitialized;
|
|
28
|
+
constructor(frontierRange: RangeAddress, workbookManager: WorkbookManager, evaluationManager: DependencyManager, options?: {
|
|
29
|
+
skipInitialBuild?: boolean;
|
|
30
|
+
});
|
|
31
|
+
protected buildInitialEvalOrder(): void;
|
|
32
|
+
protected ensureEvalOrderBuilt(): void;
|
|
28
33
|
/**
|
|
29
34
|
* frontierDependencies is the set of dependency node keys that could spill values onto the target range (if evaluationResult is spilled-values)
|
|
30
35
|
* Key is from cellAddressToKey
|
|
@@ -47,6 +52,11 @@ export declare class FrontierDependencyManager {
|
|
|
47
52
|
*/
|
|
48
53
|
get iterateAllCells(): undefined | Iterable<CellInRangeResult>;
|
|
49
54
|
getRangeEvalOrder(): EvalOrderEntry[];
|
|
55
|
+
getFrontierRange(): RangeAddress;
|
|
56
|
+
restoreResolvedSnapshot(options: {
|
|
57
|
+
dependencies: Set<DependencyNode>;
|
|
58
|
+
}): void;
|
|
59
|
+
invalidate(): void;
|
|
50
60
|
get frontierDependencies(): Set<SpillMetaNode>;
|
|
51
61
|
get discardedFrontierDependencies(): Set<SpillMetaNode>;
|
|
52
62
|
maybeDiscardFrontierDependency(dependency: SpillMetaNode): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NamedExpression } from "../types";
|
|
2
|
+
import type { NamedExpressionManagerSnapshot } from "../engine-snapshot";
|
|
2
3
|
import type { NamedExpressionNode } from "../../parser/ast";
|
|
3
4
|
import type { EvaluationContext } from "../../evaluator/evaluation-context";
|
|
4
5
|
export declare class NamedExpressionManager {
|
|
@@ -28,7 +29,7 @@ export declare class NamedExpressionManager {
|
|
|
28
29
|
workbookName?: string;
|
|
29
30
|
newName: string;
|
|
30
31
|
}): boolean;
|
|
31
|
-
updateAllNamedExpressions(updateCallback: (formula: string) => string):
|
|
32
|
+
updateAllNamedExpressions(updateCallback: (formula: string) => string): string[];
|
|
32
33
|
/**
|
|
33
34
|
* Replace all named expressions
|
|
34
35
|
*/
|
|
@@ -57,6 +58,19 @@ export declare class NamedExpressionManager {
|
|
|
57
58
|
sheetName: string;
|
|
58
59
|
};
|
|
59
60
|
}): NamedExpression | undefined;
|
|
61
|
+
resolveNamedExpressionWithScope(namedExpression: Pick<NamedExpressionNode, "name" | "sheetName" | "workbookName">, context: EvaluationContext): {
|
|
62
|
+
expression: string;
|
|
63
|
+
scope: {
|
|
64
|
+
type: "global";
|
|
65
|
+
} | {
|
|
66
|
+
type: "workbook";
|
|
67
|
+
workbookName: string;
|
|
68
|
+
} | {
|
|
69
|
+
type: "sheet";
|
|
70
|
+
workbookName: string;
|
|
71
|
+
sheetName: string;
|
|
72
|
+
};
|
|
73
|
+
} | undefined;
|
|
60
74
|
resolveNamedExpression(namedExpression: Pick<NamedExpressionNode, "name" | "sheetName" | "workbookName">, context: EvaluationContext): string | undefined;
|
|
61
75
|
getNamedExpressions(): {
|
|
62
76
|
sheetExpressions: Map<string, Map<string, Map<string, NamedExpression>>>;
|
|
@@ -64,6 +78,8 @@ export declare class NamedExpressionManager {
|
|
|
64
78
|
globalExpressions: Map<string, NamedExpression>;
|
|
65
79
|
};
|
|
66
80
|
resetNamedExpressions(namedExpressions: ReturnType<typeof this.getNamedExpressions>): void;
|
|
81
|
+
toSnapshot(): NamedExpressionManagerSnapshot;
|
|
82
|
+
restoreFromSnapshot(snapshot: NamedExpressionManagerSnapshot): void;
|
|
67
83
|
/**
|
|
68
84
|
* When adding a sheet, we need to initialize the new maps
|
|
69
85
|
*/
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* update when sheets/workbooks are renamed and become invalid when deleted.
|
|
6
6
|
*/
|
|
7
7
|
import type { RangeAddress, TrackedReference } from "../types";
|
|
8
|
+
import type { ReferenceManagerSnapshot } from "../engine-snapshot";
|
|
8
9
|
export declare class ReferenceManager {
|
|
9
10
|
private references;
|
|
10
11
|
constructor();
|
|
@@ -51,4 +52,6 @@ export declare class ReferenceManager {
|
|
|
51
52
|
* Restore references from serialization
|
|
52
53
|
*/
|
|
53
54
|
resetReferences(refs: Map<string, TrackedReference>): void;
|
|
55
|
+
toSnapshot(): ReferenceManagerSnapshot;
|
|
56
|
+
restoreFromSnapshot(snapshot: ReferenceManagerSnapshot): void;
|
|
54
57
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* StyleManager - Manages conditional styling for cells
|
|
3
3
|
*/
|
|
4
4
|
import type { CellAddress, CellStyle, ConditionalStyle, DirectCellStyle, RangeAddress } from "../types";
|
|
5
|
+
import type { StyleManagerSnapshot } from "../engine-snapshot";
|
|
5
6
|
import type { EvaluationManager } from "./evaluation-manager";
|
|
6
7
|
export declare class StyleManager {
|
|
7
8
|
private evaluationManager;
|
|
@@ -50,6 +51,8 @@ export declare class StyleManager {
|
|
|
50
51
|
* Reset all styles (for deserialization)
|
|
51
52
|
*/
|
|
52
53
|
resetStyles(conditionalStyles?: ConditionalStyle[], cellStyles?: DirectCellStyle[]): void;
|
|
54
|
+
toSnapshot(): StyleManagerSnapshot;
|
|
55
|
+
restoreFromSnapshot(snapshot: StyleManagerSnapshot): void;
|
|
53
56
|
/**
|
|
54
57
|
* Remove all styles for a workbook
|
|
55
58
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CellAddress, SerializedCellValue, SpreadsheetRange, SpreadsheetRangeEnd, TableDefinition } from "../types";
|
|
2
|
+
import type { TableManagerSnapshot } from "../engine-snapshot";
|
|
2
3
|
import type { WorkbookManager } from "./workbook-manager";
|
|
3
4
|
export declare class TableManager {
|
|
4
5
|
tables: Map<
|
|
@@ -65,6 +66,8 @@ export declare class TableManager {
|
|
|
65
66
|
newWorkbookName: string;
|
|
66
67
|
}): void;
|
|
67
68
|
resetTables(newTables: Map<string, Map<string, TableDefinition>>): void;
|
|
69
|
+
toSnapshot(): TableManagerSnapshot;
|
|
70
|
+
restoreFromSnapshot(snapshot: TableManagerSnapshot): void;
|
|
68
71
|
/**
|
|
69
72
|
* When adding a workbook, we need to initialize the new maps
|
|
70
73
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CellAddress, type SerializedCellValue, type Sheet, type Workbook } from "../types";
|
|
2
|
+
import type { WorkbookManagerSnapshot } from "../engine-snapshot";
|
|
2
3
|
import type { RangeAddress } from "../types";
|
|
3
4
|
interface IndexEntry {
|
|
4
5
|
number: number;
|
|
@@ -54,6 +55,8 @@ export declare class WorkbookManager {
|
|
|
54
55
|
newWorkbookName: string;
|
|
55
56
|
}): void;
|
|
56
57
|
resetWorkbooks(workbooks: Map<string, Workbook>): void;
|
|
58
|
+
toSnapshot(): WorkbookManagerSnapshot;
|
|
59
|
+
restoreFromSnapshot(snapshot: WorkbookManagerSnapshot): void;
|
|
57
60
|
getSheet({ workbookName, sheetName, }: {
|
|
58
61
|
workbookName: string;
|
|
59
62
|
sheetName: string;
|
|
@@ -71,7 +74,7 @@ export declare class WorkbookManager {
|
|
|
71
74
|
sheetName: string;
|
|
72
75
|
newSheetName: string;
|
|
73
76
|
}): Sheet;
|
|
74
|
-
updateAllFormulas(updateCallback: (formula: string) => string):
|
|
77
|
+
updateAllFormulas(updateCallback: (formula: string) => string): CellAddress[];
|
|
75
78
|
updateFormulasExcluding(excludeCellsSet: Set<string>, updateCallback: (formula: string) => string): void;
|
|
76
79
|
updateFormulasForWorkbook(workbookName: string, updateCallback: (formula: string) => string): void;
|
|
77
80
|
getSheetSerialized({ workbookName, sheetName, }: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function getNamedExpressionResourceKey(opts: {
|
|
2
|
+
expressionName: string;
|
|
3
|
+
workbookName?: string;
|
|
4
|
+
sheetName?: string;
|
|
5
|
+
}): string;
|
|
6
|
+
export declare function getTableResourceKey(opts: {
|
|
7
|
+
workbookName: string;
|
|
8
|
+
tableName: string;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function getSheetResourceKey(opts: {
|
|
11
|
+
workbookName: string;
|
|
12
|
+
sheetName: string;
|
|
13
|
+
}): string;
|
|
14
|
+
export declare function getWorkbookResourceKey(workbookName: string): string;
|
|
@@ -14,11 +14,16 @@ export declare class BaseEvalNode<T> {
|
|
|
14
14
|
get resolved(): boolean;
|
|
15
15
|
get evaluationResult(): T;
|
|
16
16
|
setEvaluationResult(result: T): void;
|
|
17
|
+
invalidate(): void;
|
|
17
18
|
resetDirectDepsUpdated(): void;
|
|
18
19
|
/**
|
|
19
20
|
* Get the direct dependencies of the node, either RangeEvaluationNode or DependencyNode
|
|
20
21
|
*/
|
|
21
22
|
getDependencies(): Set<DependencyNode>;
|
|
23
|
+
restoreResolvedSnapshot(options: {
|
|
24
|
+
dependencies: Set<DependencyNode>;
|
|
25
|
+
evaluationResult: T;
|
|
26
|
+
}): void;
|
|
22
27
|
/**
|
|
23
28
|
* Just to mirror the method in RangeEvaluationNode
|
|
24
29
|
*/
|
|
@@ -7,11 +7,18 @@ export declare class EmptyCellEvaluationNode extends FrontierDependencyManager {
|
|
|
7
7
|
key: string;
|
|
8
8
|
cellAddress: CellAddress;
|
|
9
9
|
private _evaluationResult;
|
|
10
|
-
constructor(emptyCellKey: string, evaluationManager: DependencyManager, workbookManager: WorkbookManager
|
|
10
|
+
constructor(emptyCellKey: string, evaluationManager: DependencyManager, workbookManager: WorkbookManager, options?: {
|
|
11
|
+
skipInitialBuild?: boolean;
|
|
12
|
+
});
|
|
11
13
|
setEvaluationResult(result: SingleEvaluationResult): void;
|
|
12
14
|
get evaluationResult(): SingleEvaluationResult;
|
|
13
15
|
resolve(): void;
|
|
14
16
|
canResolve(): boolean;
|
|
17
|
+
restoreResolvedSnapshot(options: {
|
|
18
|
+
dependencies: Set<import("../../core/managers/dependency-node").DependencyNode>;
|
|
19
|
+
evaluationResult: SingleEvaluationResult;
|
|
20
|
+
}): void;
|
|
21
|
+
invalidate(): void;
|
|
15
22
|
toJSON(visitor?: Set<string>): any;
|
|
16
23
|
toString(): string;
|
|
17
24
|
}
|
|
@@ -7,10 +7,17 @@ export declare class RangeEvaluationNode extends FrontierDependencyManager {
|
|
|
7
7
|
key: string;
|
|
8
8
|
address: RangeAddress;
|
|
9
9
|
private _result;
|
|
10
|
-
constructor(rangeKey: string, dependencyManager: DependencyManager, workbookManager: WorkbookManager
|
|
10
|
+
constructor(rangeKey: string, dependencyManager: DependencyManager, workbookManager: WorkbookManager, options?: {
|
|
11
|
+
skipInitialBuild?: boolean;
|
|
12
|
+
});
|
|
11
13
|
setResult(result: EvaluateAllCellsResult): void;
|
|
12
14
|
get result(): EvaluateAllCellsResult;
|
|
13
15
|
canResolve(): boolean;
|
|
16
|
+
restoreResolvedSnapshot(options: {
|
|
17
|
+
dependencies: Set<import("../core/managers/dependency-node").DependencyNode>;
|
|
18
|
+
result: EvaluateAllCellsResult;
|
|
19
|
+
}): void;
|
|
20
|
+
invalidate(): void;
|
|
14
21
|
toJSON(visitor?: Set<string>): any;
|
|
15
22
|
toString(): string;
|
|
16
23
|
}
|