@ricsam/formula-engine 0.2.4 → 0.2.5

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.
Files changed (38) hide show
  1. package/dist/cjs/core/commands/table-commands.cjs +158 -10
  2. package/dist/cjs/core/commands/table-commands.cjs.map +3 -3
  3. package/dist/cjs/core/commands/types.cjs.map +2 -2
  4. package/dist/cjs/core/engine.cjs +22 -1
  5. package/dist/cjs/core/engine.cjs.map +3 -3
  6. package/dist/cjs/core/managers/dependency-manager.cjs +157 -2
  7. package/dist/cjs/core/managers/dependency-manager.cjs.map +3 -3
  8. package/dist/cjs/core/managers/evaluation-manager.cjs +32 -1
  9. package/dist/cjs/core/managers/evaluation-manager.cjs.map +3 -3
  10. package/dist/cjs/core/managers/frontier-dependency-manager.cjs +4 -4
  11. package/dist/cjs/core/managers/frontier-dependency-manager.cjs.map +3 -3
  12. package/dist/cjs/core/managers/workbook-manager.cjs +48 -4
  13. package/dist/cjs/core/managers/workbook-manager.cjs.map +3 -3
  14. package/dist/cjs/evaluator/evaluation-context.cjs.map +2 -2
  15. package/dist/cjs/evaluator/formula-evaluator.cjs.map +1 -1
  16. package/dist/cjs/package.json +1 -1
  17. package/dist/mjs/core/commands/table-commands.mjs +163 -11
  18. package/dist/mjs/core/commands/table-commands.mjs.map +3 -3
  19. package/dist/mjs/core/commands/types.mjs.map +2 -2
  20. package/dist/mjs/core/engine.mjs +22 -1
  21. package/dist/mjs/core/engine.mjs.map +3 -3
  22. package/dist/mjs/core/managers/dependency-manager.mjs +157 -2
  23. package/dist/mjs/core/managers/dependency-manager.mjs.map +3 -3
  24. package/dist/mjs/core/managers/evaluation-manager.mjs +32 -1
  25. package/dist/mjs/core/managers/evaluation-manager.mjs.map +3 -3
  26. package/dist/mjs/core/managers/frontier-dependency-manager.mjs +4 -4
  27. package/dist/mjs/core/managers/frontier-dependency-manager.mjs.map +3 -3
  28. package/dist/mjs/core/managers/workbook-manager.mjs +48 -4
  29. package/dist/mjs/core/managers/workbook-manager.mjs.map +3 -3
  30. package/dist/mjs/evaluator/evaluation-context.mjs.map +2 -2
  31. package/dist/mjs/evaluator/formula-evaluator.mjs.map +1 -1
  32. package/dist/mjs/package.json +1 -1
  33. package/dist/types/core/commands/types.d.ts +5 -0
  34. package/dist/types/core/engine.d.ts +12 -4
  35. package/dist/types/core/managers/dependency-manager.d.ts +7 -0
  36. package/dist/types/core/managers/evaluation-manager.d.ts +1 -0
  37. package/dist/types/core/managers/workbook-manager.d.ts +3 -0
  38. package/package.json +3 -2
@@ -48,6 +48,111 @@ __export(exports_table_commands, {
48
48
  module.exports = __toCommonJS(exports_table_commands);
49
49
  var import_types = require("./types.cjs");
50
50
  var import_resource_keys = require("../resource-keys.cjs");
51
+ var import_utils = require("../utils.cjs");
52
+ function getAddressKey(address) {
53
+ return `${address.workbookName}:${address.sheetName}:${address.rowIndex}:${address.colIndex}`;
54
+ }
55
+ function collectTableFootprintCells(workbookManager, table) {
56
+ const cells = new Map;
57
+ const sheet = workbookManager.getSheet({
58
+ workbookName: table.workbookName,
59
+ sheetName: table.sheetName
60
+ });
61
+ if (!sheet) {
62
+ return [];
63
+ }
64
+ const startColIndex = table.start.colIndex;
65
+ const endColIndex = startColIndex + table.headers.size - 1;
66
+ if (table.endRow.type === "number") {
67
+ for (let rowIndex = table.start.rowIndex;rowIndex <= table.endRow.value; rowIndex++) {
68
+ for (let colIndex = startColIndex;colIndex <= endColIndex; colIndex++) {
69
+ const address = {
70
+ workbookName: table.workbookName,
71
+ sheetName: table.sheetName,
72
+ rowIndex,
73
+ colIndex
74
+ };
75
+ cells.set(getAddressKey(address), {
76
+ address,
77
+ content: workbookManager.getCellContent(address)
78
+ });
79
+ }
80
+ }
81
+ return Array.from(cells.values());
82
+ }
83
+ for (const [ref, content] of sheet.content.entries()) {
84
+ const { rowIndex, colIndex } = import_utils.parseCellReference(ref);
85
+ if (rowIndex < table.start.rowIndex) {
86
+ continue;
87
+ }
88
+ if (colIndex < startColIndex || colIndex > endColIndex) {
89
+ continue;
90
+ }
91
+ const address = {
92
+ workbookName: table.workbookName,
93
+ sheetName: table.sheetName,
94
+ rowIndex,
95
+ colIndex
96
+ };
97
+ cells.set(getAddressKey(address), {
98
+ address,
99
+ content
100
+ });
101
+ }
102
+ return Array.from(cells.values());
103
+ }
104
+ function buildTableTouchedCells(workbookManager, tables) {
105
+ const touchedCells = new Map;
106
+ for (const table of tables) {
107
+ if (!table) {
108
+ continue;
109
+ }
110
+ for (const cell of collectTableFootprintCells(workbookManager, table)) {
111
+ touchedCells.set(getAddressKey(cell.address), {
112
+ address: cell.address,
113
+ beforeKind: import_types.getSerializedCellValueKind(cell.content),
114
+ afterKind: import_types.getSerializedCellValueKind(cell.content)
115
+ });
116
+ }
117
+ }
118
+ return Array.from(touchedCells.values());
119
+ }
120
+ function buildTableContextChangedCells(workbookManager, tables) {
121
+ const changedCells = new Map;
122
+ for (const table of tables) {
123
+ if (!table) {
124
+ continue;
125
+ }
126
+ for (const cell of collectTableFootprintCells(workbookManager, table)) {
127
+ changedCells.set(getAddressKey(cell.address), cell.address);
128
+ }
129
+ }
130
+ return Array.from(changedCells.values());
131
+ }
132
+ function mergeTouchedCells(...groups) {
133
+ const precedence = {
134
+ empty: 0,
135
+ scalar: 1,
136
+ formula: 2
137
+ };
138
+ const merged = new Map;
139
+ for (const group of groups) {
140
+ for (const touchedCell of group) {
141
+ const key = getAddressKey(touchedCell.address);
142
+ const existing = merged.get(key);
143
+ if (!existing) {
144
+ merged.set(key, touchedCell);
145
+ continue;
146
+ }
147
+ merged.set(key, {
148
+ address: touchedCell.address,
149
+ beforeKind: precedence[touchedCell.beforeKind] >= precedence[existing.beforeKind] ? touchedCell.beforeKind : existing.beforeKind,
150
+ afterKind: precedence[touchedCell.afterKind] >= precedence[existing.afterKind] ? touchedCell.afterKind : existing.afterKind
151
+ });
152
+ }
153
+ }
154
+ return Array.from(merged.values());
155
+ }
51
156
 
52
157
  class AddTableCommand {
53
158
  deps;
@@ -60,7 +165,7 @@ class AddTableCommand {
60
165
  this.props = props;
61
166
  }
62
167
  execute() {
63
- this.deps.tableManager.addTable({
168
+ const table = this.deps.tableManager.addTable({
64
169
  ...this.props,
65
170
  getCellValue: this.deps.getCellValue
66
171
  });
@@ -69,7 +174,8 @@ class AddTableCommand {
69
174
  tableName: this.props.tableName
70
175
  });
71
176
  this.executeFootprint = {
72
- touchedCells: [],
177
+ touchedCells: buildTableTouchedCells(this.deps.workbookManager, [table]),
178
+ tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [table]),
73
179
  resourceKeys: [resourceKey]
74
180
  };
75
181
  this.undoFootprint = this.executeFootprint;
@@ -113,7 +219,10 @@ class RemoveTableCommand {
113
219
  tableName: this.opts.tableName
114
220
  });
115
221
  this.executeFootprint = {
116
- touchedCells: [],
222
+ touchedCells: buildTableTouchedCells(this.deps.workbookManager, [
223
+ this.removedTable
224
+ ]),
225
+ tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [this.removedTable]),
117
226
  resourceKeys: [resourceKey]
118
227
  };
119
228
  this.undoFootprint = this.executeFootprint;
@@ -159,6 +268,10 @@ class RenameTableCommand {
159
268
  this.newName = newName;
160
269
  }
161
270
  execute() {
271
+ const previousTable = this.deps.tableManager.getTable({
272
+ workbookName: this.workbookName,
273
+ name: this.oldName
274
+ });
162
275
  this.deps.tableManager.renameTable(this.workbookName, {
163
276
  oldName: this.oldName,
164
277
  newName: this.newName
@@ -166,12 +279,20 @@ class RenameTableCommand {
166
279
  const changedCells = this.deps.workbookManager.updateAllFormulas((formula) => this.deps.renameTableInFormula(formula, this.oldName, this.newName));
167
280
  const changedNamedExpressions = this.deps.namedExpressionManager.updateAllNamedExpressions((formula) => this.deps.renameTableInFormula(formula, this.oldName, this.newName));
168
281
  this.deps.apiSchemaManager.updateForTableRename(this.workbookName, this.oldName, this.newName);
282
+ const renamedTable = this.deps.tableManager.getTable({
283
+ workbookName: this.workbookName,
284
+ name: this.newName
285
+ });
169
286
  this.executeFootprint = {
170
- touchedCells: changedCells.map((address) => ({
287
+ touchedCells: mergeTouchedCells(buildTableTouchedCells(this.deps.workbookManager, [
288
+ previousTable,
289
+ renamedTable
290
+ ]), changedCells.map((address) => ({
171
291
  address,
172
292
  beforeKind: "formula",
173
293
  afterKind: "formula"
174
- })),
294
+ }))),
295
+ tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [previousTable, renamedTable]),
175
296
  resourceKeys: [
176
297
  import_resource_keys.getTableResourceKey({
177
298
  workbookName: this.workbookName,
@@ -186,6 +307,10 @@ class RenameTableCommand {
186
307
  };
187
308
  }
188
309
  undo() {
310
+ const currentTable = this.deps.tableManager.getTable({
311
+ workbookName: this.workbookName,
312
+ name: this.newName
313
+ });
189
314
  this.deps.tableManager.renameTable(this.workbookName, {
190
315
  oldName: this.newName,
191
316
  newName: this.oldName
@@ -193,12 +318,20 @@ class RenameTableCommand {
193
318
  const changedCells = this.deps.workbookManager.updateAllFormulas((formula) => this.deps.renameTableInFormula(formula, this.newName, this.oldName));
194
319
  const changedNamedExpressions = this.deps.namedExpressionManager.updateAllNamedExpressions((formula) => this.deps.renameTableInFormula(formula, this.newName, this.oldName));
195
320
  this.deps.apiSchemaManager.updateForTableRename(this.workbookName, this.newName, this.oldName);
321
+ const restoredTable = this.deps.tableManager.getTable({
322
+ workbookName: this.workbookName,
323
+ name: this.oldName
324
+ });
196
325
  this.undoFootprint = {
197
- touchedCells: changedCells.map((address) => ({
326
+ touchedCells: mergeTouchedCells(buildTableTouchedCells(this.deps.workbookManager, [
327
+ currentTable,
328
+ restoredTable
329
+ ]), changedCells.map((address) => ({
198
330
  address,
199
331
  beforeKind: "formula",
200
332
  afterKind: "formula"
201
- })),
333
+ }))),
334
+ tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [currentTable, restoredTable]),
202
335
  resourceKeys: [
203
336
  import_resource_keys.getTableResourceKey({
204
337
  workbookName: this.workbookName,
@@ -251,8 +384,16 @@ class UpdateTableCommand {
251
384
  workbookName: this.opts.workbookName,
252
385
  tableName: this.opts.tableName
253
386
  });
387
+ const nextTable = this.deps.tableManager.getTable({
388
+ workbookName: this.opts.workbookName,
389
+ name: this.opts.tableName
390
+ });
254
391
  this.executeFootprint = {
255
- touchedCells: [],
392
+ touchedCells: buildTableTouchedCells(this.deps.workbookManager, [
393
+ this.previousTable,
394
+ nextTable
395
+ ]),
396
+ tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [this.previousTable, nextTable]),
256
397
  resourceKeys: [resourceKey]
257
398
  };
258
399
  this.undoFootprint = this.executeFootprint;
@@ -318,7 +459,14 @@ class ResetTablesCommand {
318
459
  }
319
460
  }
320
461
  this.executeFootprint = {
321
- touchedCells: [],
462
+ touchedCells: buildTableTouchedCells(this.deps.workbookManager, [
463
+ ...Array.from(this.previousTables?.values() ?? []).flatMap((tables) => Array.from(tables.values())),
464
+ ...Array.from(this.newTables.values()).flatMap((tables) => Array.from(tables.values()))
465
+ ]),
466
+ tableContextChangedCells: buildTableContextChangedCells(this.deps.workbookManager, [
467
+ ...Array.from(this.previousTables?.values() ?? []).flatMap((tables) => Array.from(tables.values())),
468
+ ...Array.from(this.newTables.values()).flatMap((tables) => Array.from(tables.values()))
469
+ ]),
322
470
  resourceKeys: Array.from(resourceKeys)
323
471
  };
324
472
  this.undoFootprint = this.executeFootprint;
@@ -344,4 +492,4 @@ class ResetTablesCommand {
344
492
  }
345
493
  }
346
494
 
347
- //# debugId=A5F238226D88790C64756E2164756E21
495
+ //# debugId=B613AEE64997BD0E64756E2164756E21
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/core/commands/table-commands.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * Table Commands - Commands that modify table definitions\n *\n * These commands all require re-evaluation after execution.\n */\n\nimport type { TableManager } from \"../managers/table-manager.cjs\";\nimport type { NamedExpressionManager } from \"../managers/named-expression-manager.cjs\";\nimport type { WorkbookManager } from \"../managers/workbook-manager.cjs\";\nimport type { SchemaManager } from \"../managers/schema-manager.cjs\";\nimport type {\n CellAddress,\n SerializedCellValue,\n SpreadsheetRangeEnd,\n TableDefinition,\n} from \"../types.cjs\";\nimport type {\n EngineCommand,\n EngineAction,\n MutationInvalidation,\n} from \"./types.cjs\";\nimport { ActionTypes, emptyMutationInvalidation } from \"./types.cjs\";\nimport { getTableResourceKey } from \"../resource-keys.cjs\";\n\n/**\n * Dependencies needed for table commands.\n */\nexport interface TableCommandDeps {\n tableManager: TableManager;\n namedExpressionManager: NamedExpressionManager;\n workbookManager: WorkbookManager;\n apiSchemaManager: SchemaManager;\n getCellValue: (cellAddress: CellAddress) => SerializedCellValue;\n renameTableInFormula: (\n formula: string,\n oldName: string,\n newName: string\n ) => string;\n}\n\n/**\n * Command to add a table.\n */\nexport class AddTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private props: {\n tableName: string;\n sheetName: string;\n workbookName: string;\n start: string;\n numRows: SpreadsheetRangeEnd;\n numCols: number;\n }\n ) {}\n\n execute(): void {\n this.deps.tableManager.addTable({\n ...this.props,\n getCellValue: this.deps.getCellValue,\n });\n const resourceKey = getTableResourceKey({\n workbookName: this.props.workbookName,\n tableName: this.props.tableName,\n });\n this.executeFootprint = {\n touchedCells: [],\n resourceKeys: [resourceKey],\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n this.deps.tableManager.removeTable({\n workbookName: this.props.workbookName,\n tableName: this.props.tableName,\n });\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.ADD_TABLE,\n payload: this.props,\n };\n }\n}\n\n/**\n * Command to remove a table.\n */\nexport class RemoveTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private removedTable: TableDefinition | undefined;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private opts: { tableName: string; workbookName: string }\n ) {}\n\n execute(): void {\n // Capture table before removal\n this.removedTable = this.deps.tableManager.getTable({\n workbookName: this.opts.workbookName,\n name: this.opts.tableName,\n });\n\n this.deps.tableManager.removeTable(this.opts);\n const resourceKey = getTableResourceKey({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n });\n this.executeFootprint = {\n touchedCells: [],\n resourceKeys: [resourceKey],\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n if (!this.removedTable) return;\n\n // Recreate the table\n const { start, endRow, headers, sheetName } = this.removedTable;\n const startRef = `${String.fromCharCode(65 + start.colIndex)}${start.rowIndex + 1}`;\n\n this.deps.tableManager.addTable({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n sheetName,\n start: startRef,\n numRows: endRow,\n numCols: headers.size,\n getCellValue: this.deps.getCellValue,\n });\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.REMOVE_TABLE,\n payload: this.opts,\n };\n }\n}\n\n/**\n * Command to rename a table.\n */\nexport class RenameTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private workbookName: string,\n private oldName: string,\n private newName: string\n ) {}\n\n execute(): void {\n this.deps.tableManager.renameTable(this.workbookName, {\n oldName: this.oldName,\n newName: this.newName,\n });\n\n // Update formulas in sheet cells\n const changedCells = this.deps.workbookManager.updateAllFormulas((formula) =>\n this.deps.renameTableInFormula(formula, this.oldName, this.newName)\n );\n\n // Update named expressions\n const changedNamedExpressions =\n this.deps.namedExpressionManager.updateAllNamedExpressions((formula) =>\n this.deps.renameTableInFormula(formula, this.oldName, this.newName)\n );\n\n // Update API schemas\n this.deps.apiSchemaManager.updateForTableRename(\n this.workbookName,\n this.oldName,\n this.newName\n );\n\n this.executeFootprint = {\n touchedCells: changedCells.map((address) => ({\n address,\n beforeKind: \"formula\" as const,\n afterKind: \"formula\" as const,\n })),\n resourceKeys: [\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.oldName,\n }),\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.newName,\n }),\n ...changedNamedExpressions,\n ],\n };\n }\n\n undo(): void {\n // Rename back\n this.deps.tableManager.renameTable(this.workbookName, {\n oldName: this.newName,\n newName: this.oldName,\n });\n\n // Update formulas back\n const changedCells = this.deps.workbookManager.updateAllFormulas((formula) =>\n this.deps.renameTableInFormula(formula, this.newName, this.oldName)\n );\n\n // Update named expressions back\n const changedNamedExpressions =\n this.deps.namedExpressionManager.updateAllNamedExpressions((formula) =>\n this.deps.renameTableInFormula(formula, this.newName, this.oldName)\n );\n\n // Update API schemas back\n this.deps.apiSchemaManager.updateForTableRename(\n this.workbookName,\n this.newName,\n this.oldName\n );\n\n this.undoFootprint = {\n touchedCells: changedCells.map((address) => ({\n address,\n beforeKind: \"formula\" as const,\n afterKind: \"formula\" as const,\n })),\n resourceKeys: [\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.oldName,\n }),\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.newName,\n }),\n ...changedNamedExpressions,\n ],\n };\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.RENAME_TABLE,\n payload: {\n workbookName: this.workbookName,\n oldName: this.oldName,\n newName: this.newName,\n },\n };\n }\n}\n\n/**\n * Command to update a table.\n */\nexport class UpdateTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private previousTable: TableDefinition | undefined;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private opts: {\n tableName: string;\n sheetName?: string;\n start?: string;\n numRows?: SpreadsheetRangeEnd;\n numCols?: number;\n workbookName: string;\n }\n ) {}\n\n execute(): void {\n // Capture previous table state\n this.previousTable = this.deps.tableManager.getTable({\n workbookName: this.opts.workbookName,\n name: this.opts.tableName,\n });\n\n this.deps.tableManager.updateTable({\n ...this.opts,\n getCellValue: this.deps.getCellValue,\n });\n const resourceKey = getTableResourceKey({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n });\n this.executeFootprint = {\n touchedCells: [],\n resourceKeys: [resourceKey],\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n if (!this.previousTable) return;\n\n // Restore previous table state\n const { start, endRow, headers, sheetName } = this.previousTable;\n const startRef = `${String.fromCharCode(65 + start.colIndex)}${start.rowIndex + 1}`;\n\n this.deps.tableManager.updateTable({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n sheetName,\n start: startRef,\n numRows: endRow,\n numCols: headers.size,\n getCellValue: this.deps.getCellValue,\n });\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.UPDATE_TABLE,\n payload: this.opts,\n };\n }\n}\n\n/**\n * Command to reset all tables.\n */\nexport class ResetTablesCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private previousTables: Map<string, Map<string, TableDefinition>> | undefined;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private newTables: Map<string, Map<string, TableDefinition>>\n ) {}\n\n execute(): void {\n // Capture previous tables\n this.previousTables = new Map();\n for (const [workbookName, tables] of this.deps.tableManager.tables) {\n this.previousTables.set(workbookName, new Map(tables));\n }\n\n this.deps.tableManager.resetTables(this.newTables);\n const resourceKeys = new Set<string>();\n for (const [workbookName, tables] of this.previousTables ?? []) {\n for (const tableName of tables.keys()) {\n resourceKeys.add(\n getTableResourceKey({\n workbookName,\n tableName,\n })\n );\n }\n }\n for (const [workbookName, tables] of this.newTables) {\n for (const tableName of tables.keys()) {\n resourceKeys.add(\n getTableResourceKey({\n workbookName,\n tableName,\n })\n );\n }\n }\n this.executeFootprint = {\n touchedCells: [],\n resourceKeys: Array.from(resourceKeys),\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n if (!this.previousTables) return;\n this.deps.tableManager.resetTables(this.previousTables);\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.RESET_TABLES,\n payload: {\n tables: Array.from(this.newTables.entries()).map(([wb, tables]) => [\n wb,\n Array.from(tables.entries()),\n ]),\n },\n };\n }\n}\n"
5
+ "/**\n * Table Commands - Commands that modify table definitions\n *\n * These commands all require re-evaluation after execution.\n */\n\nimport type { TableManager } from \"../managers/table-manager.cjs\";\nimport type { NamedExpressionManager } from \"../managers/named-expression-manager.cjs\";\nimport type { WorkbookManager } from \"../managers/workbook-manager.cjs\";\nimport type { SchemaManager } from \"../managers/schema-manager.cjs\";\nimport type {\n CellAddress,\n SerializedCellValue,\n SpreadsheetRangeEnd,\n TableDefinition,\n} from \"../types.cjs\";\nimport type {\n EngineCommand,\n EngineAction,\n MutationInvalidation,\n} from \"./types.cjs\";\nimport {\n ActionTypes,\n emptyMutationInvalidation,\n getSerializedCellValueKind,\n} from \"./types.cjs\";\nimport { getTableResourceKey } from \"../resource-keys.cjs\";\nimport { parseCellReference } from \"../utils.cjs\";\n\nfunction getAddressKey(address: CellAddress): string {\n return `${address.workbookName}:${address.sheetName}:${address.rowIndex}:${address.colIndex}`;\n}\n\nfunction collectTableFootprintCells(\n workbookManager: WorkbookManager,\n table: TableDefinition\n): Array<{\n address: CellAddress;\n content: SerializedCellValue | undefined;\n}> {\n const cells = new Map<\n string,\n {\n address: CellAddress;\n content: SerializedCellValue | undefined;\n }\n >();\n const sheet = workbookManager.getSheet({\n workbookName: table.workbookName,\n sheetName: table.sheetName,\n });\n if (!sheet) {\n return [];\n }\n\n const startColIndex = table.start.colIndex;\n const endColIndex = startColIndex + table.headers.size - 1;\n\n if (table.endRow.type === \"number\") {\n for (let rowIndex = table.start.rowIndex; rowIndex <= table.endRow.value; rowIndex++) {\n for (let colIndex = startColIndex; colIndex <= endColIndex; colIndex++) {\n const address = {\n workbookName: table.workbookName,\n sheetName: table.sheetName,\n rowIndex,\n colIndex,\n };\n cells.set(getAddressKey(address), {\n address,\n content: workbookManager.getCellContent(address),\n });\n }\n }\n return Array.from(cells.values());\n }\n\n for (const [ref, content] of sheet.content.entries()) {\n const { rowIndex, colIndex } = parseCellReference(ref);\n if (rowIndex < table.start.rowIndex) {\n continue;\n }\n if (colIndex < startColIndex || colIndex > endColIndex) {\n continue;\n }\n\n const address = {\n workbookName: table.workbookName,\n sheetName: table.sheetName,\n rowIndex,\n colIndex,\n };\n cells.set(getAddressKey(address), {\n address,\n content,\n });\n }\n\n return Array.from(cells.values());\n}\n\nfunction buildTableTouchedCells(\n workbookManager: WorkbookManager,\n tables: Array<TableDefinition | undefined>\n): MutationInvalidation[\"touchedCells\"] {\n const touchedCells = new Map<\n string,\n {\n address: CellAddress;\n beforeKind: ReturnType<typeof getSerializedCellValueKind>;\n afterKind: ReturnType<typeof getSerializedCellValueKind>;\n }\n >();\n\n for (const table of tables) {\n if (!table) {\n continue;\n }\n for (const cell of collectTableFootprintCells(workbookManager, table)) {\n touchedCells.set(getAddressKey(cell.address), {\n address: cell.address,\n beforeKind: getSerializedCellValueKind(cell.content),\n afterKind: getSerializedCellValueKind(cell.content),\n });\n }\n }\n\n return Array.from(touchedCells.values());\n}\n\nfunction buildTableContextChangedCells(\n workbookManager: WorkbookManager,\n tables: Array<TableDefinition | undefined>\n): CellAddress[] {\n const changedCells = new Map<string, CellAddress>();\n\n for (const table of tables) {\n if (!table) {\n continue;\n }\n for (const cell of collectTableFootprintCells(workbookManager, table)) {\n changedCells.set(getAddressKey(cell.address), cell.address);\n }\n }\n\n return Array.from(changedCells.values());\n}\n\nfunction mergeTouchedCells(\n ...groups: MutationInvalidation[\"touchedCells\"][]\n): MutationInvalidation[\"touchedCells\"] {\n const precedence = {\n empty: 0,\n scalar: 1,\n formula: 2,\n } as const;\n const merged = new Map<\n string,\n MutationInvalidation[\"touchedCells\"][number]\n >();\n\n for (const group of groups) {\n for (const touchedCell of group) {\n const key = getAddressKey(touchedCell.address);\n const existing = merged.get(key);\n if (!existing) {\n merged.set(key, touchedCell);\n continue;\n }\n\n merged.set(key, {\n address: touchedCell.address,\n beforeKind:\n precedence[touchedCell.beforeKind] >= precedence[existing.beforeKind]\n ? touchedCell.beforeKind\n : existing.beforeKind,\n afterKind:\n precedence[touchedCell.afterKind] >= precedence[existing.afterKind]\n ? touchedCell.afterKind\n : existing.afterKind,\n });\n }\n }\n\n return Array.from(merged.values());\n}\n\n/**\n * Dependencies needed for table commands.\n */\nexport interface TableCommandDeps {\n tableManager: TableManager;\n namedExpressionManager: NamedExpressionManager;\n workbookManager: WorkbookManager;\n apiSchemaManager: SchemaManager;\n getCellValue: (cellAddress: CellAddress) => SerializedCellValue;\n renameTableInFormula: (\n formula: string,\n oldName: string,\n newName: string\n ) => string;\n}\n\n/**\n * Command to add a table.\n */\nexport class AddTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private props: {\n tableName: string;\n sheetName: string;\n workbookName: string;\n start: string;\n numRows: SpreadsheetRangeEnd;\n numCols: number;\n }\n ) {}\n\n execute(): void {\n const table = this.deps.tableManager.addTable({\n ...this.props,\n getCellValue: this.deps.getCellValue,\n });\n const resourceKey = getTableResourceKey({\n workbookName: this.props.workbookName,\n tableName: this.props.tableName,\n });\n this.executeFootprint = {\n touchedCells: buildTableTouchedCells(this.deps.workbookManager, [table]),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [table]\n ),\n resourceKeys: [resourceKey],\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n this.deps.tableManager.removeTable({\n workbookName: this.props.workbookName,\n tableName: this.props.tableName,\n });\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.ADD_TABLE,\n payload: this.props,\n };\n }\n}\n\n/**\n * Command to remove a table.\n */\nexport class RemoveTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private removedTable: TableDefinition | undefined;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private opts: { tableName: string; workbookName: string }\n ) {}\n\n execute(): void {\n // Capture table before removal\n this.removedTable = this.deps.tableManager.getTable({\n workbookName: this.opts.workbookName,\n name: this.opts.tableName,\n });\n\n this.deps.tableManager.removeTable(this.opts);\n const resourceKey = getTableResourceKey({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n });\n this.executeFootprint = {\n touchedCells: buildTableTouchedCells(this.deps.workbookManager, [\n this.removedTable,\n ]),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [this.removedTable]\n ),\n resourceKeys: [resourceKey],\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n if (!this.removedTable) return;\n\n // Recreate the table\n const { start, endRow, headers, sheetName } = this.removedTable;\n const startRef = `${String.fromCharCode(65 + start.colIndex)}${start.rowIndex + 1}`;\n\n this.deps.tableManager.addTable({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n sheetName,\n start: startRef,\n numRows: endRow,\n numCols: headers.size,\n getCellValue: this.deps.getCellValue,\n });\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.REMOVE_TABLE,\n payload: this.opts,\n };\n }\n}\n\n/**\n * Command to rename a table.\n */\nexport class RenameTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private workbookName: string,\n private oldName: string,\n private newName: string\n ) {}\n\n execute(): void {\n const previousTable = this.deps.tableManager.getTable({\n workbookName: this.workbookName,\n name: this.oldName,\n });\n this.deps.tableManager.renameTable(this.workbookName, {\n oldName: this.oldName,\n newName: this.newName,\n });\n\n // Update formulas in sheet cells\n const changedCells = this.deps.workbookManager.updateAllFormulas((formula) =>\n this.deps.renameTableInFormula(formula, this.oldName, this.newName)\n );\n\n // Update named expressions\n const changedNamedExpressions =\n this.deps.namedExpressionManager.updateAllNamedExpressions((formula) =>\n this.deps.renameTableInFormula(formula, this.oldName, this.newName)\n );\n\n // Update API schemas\n this.deps.apiSchemaManager.updateForTableRename(\n this.workbookName,\n this.oldName,\n this.newName\n );\n const renamedTable = this.deps.tableManager.getTable({\n workbookName: this.workbookName,\n name: this.newName,\n });\n\n this.executeFootprint = {\n touchedCells: mergeTouchedCells(\n buildTableTouchedCells(this.deps.workbookManager, [\n previousTable,\n renamedTable,\n ]),\n changedCells.map((address) => ({\n address,\n beforeKind: \"formula\" as const,\n afterKind: \"formula\" as const,\n }))\n ),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [previousTable, renamedTable]\n ),\n resourceKeys: [\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.oldName,\n }),\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.newName,\n }),\n ...changedNamedExpressions,\n ],\n };\n }\n\n undo(): void {\n const currentTable = this.deps.tableManager.getTable({\n workbookName: this.workbookName,\n name: this.newName,\n });\n // Rename back\n this.deps.tableManager.renameTable(this.workbookName, {\n oldName: this.newName,\n newName: this.oldName,\n });\n\n // Update formulas back\n const changedCells = this.deps.workbookManager.updateAllFormulas((formula) =>\n this.deps.renameTableInFormula(formula, this.newName, this.oldName)\n );\n\n // Update named expressions back\n const changedNamedExpressions =\n this.deps.namedExpressionManager.updateAllNamedExpressions((formula) =>\n this.deps.renameTableInFormula(formula, this.newName, this.oldName)\n );\n\n // Update API schemas back\n this.deps.apiSchemaManager.updateForTableRename(\n this.workbookName,\n this.newName,\n this.oldName\n );\n const restoredTable = this.deps.tableManager.getTable({\n workbookName: this.workbookName,\n name: this.oldName,\n });\n\n this.undoFootprint = {\n touchedCells: mergeTouchedCells(\n buildTableTouchedCells(this.deps.workbookManager, [\n currentTable,\n restoredTable,\n ]),\n changedCells.map((address) => ({\n address,\n beforeKind: \"formula\" as const,\n afterKind: \"formula\" as const,\n }))\n ),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [currentTable, restoredTable]\n ),\n resourceKeys: [\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.oldName,\n }),\n getTableResourceKey({\n workbookName: this.workbookName,\n tableName: this.newName,\n }),\n ...changedNamedExpressions,\n ],\n };\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.RENAME_TABLE,\n payload: {\n workbookName: this.workbookName,\n oldName: this.oldName,\n newName: this.newName,\n },\n };\n }\n}\n\n/**\n * Command to update a table.\n */\nexport class UpdateTableCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private previousTable: TableDefinition | undefined;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private opts: {\n tableName: string;\n sheetName?: string;\n start?: string;\n numRows?: SpreadsheetRangeEnd;\n numCols?: number;\n workbookName: string;\n }\n ) {}\n\n execute(): void {\n // Capture previous table state\n this.previousTable = this.deps.tableManager.getTable({\n workbookName: this.opts.workbookName,\n name: this.opts.tableName,\n });\n\n this.deps.tableManager.updateTable({\n ...this.opts,\n getCellValue: this.deps.getCellValue,\n });\n const resourceKey = getTableResourceKey({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n });\n const nextTable = this.deps.tableManager.getTable({\n workbookName: this.opts.workbookName,\n name: this.opts.tableName,\n });\n this.executeFootprint = {\n touchedCells: buildTableTouchedCells(this.deps.workbookManager, [\n this.previousTable,\n nextTable,\n ]),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [this.previousTable, nextTable]\n ),\n resourceKeys: [resourceKey],\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n if (!this.previousTable) return;\n\n // Restore previous table state\n const { start, endRow, headers, sheetName } = this.previousTable;\n const startRef = `${String.fromCharCode(65 + start.colIndex)}${start.rowIndex + 1}`;\n\n this.deps.tableManager.updateTable({\n workbookName: this.opts.workbookName,\n tableName: this.opts.tableName,\n sheetName,\n start: startRef,\n numRows: endRow,\n numCols: headers.size,\n getCellValue: this.deps.getCellValue,\n });\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.UPDATE_TABLE,\n payload: this.opts,\n };\n }\n}\n\n/**\n * Command to reset all tables.\n */\nexport class ResetTablesCommand implements EngineCommand {\n readonly requiresReevaluation = true;\n private previousTables: Map<string, Map<string, TableDefinition>> | undefined;\n private executeFootprint = emptyMutationInvalidation();\n private undoFootprint = emptyMutationInvalidation();\n\n constructor(\n private deps: TableCommandDeps,\n private newTables: Map<string, Map<string, TableDefinition>>\n ) {}\n\n execute(): void {\n // Capture previous tables\n this.previousTables = new Map();\n for (const [workbookName, tables] of this.deps.tableManager.tables) {\n this.previousTables.set(workbookName, new Map(tables));\n }\n\n this.deps.tableManager.resetTables(this.newTables);\n const resourceKeys = new Set<string>();\n for (const [workbookName, tables] of this.previousTables ?? []) {\n for (const tableName of tables.keys()) {\n resourceKeys.add(\n getTableResourceKey({\n workbookName,\n tableName,\n })\n );\n }\n }\n for (const [workbookName, tables] of this.newTables) {\n for (const tableName of tables.keys()) {\n resourceKeys.add(\n getTableResourceKey({\n workbookName,\n tableName,\n })\n );\n }\n }\n this.executeFootprint = {\n touchedCells: buildTableTouchedCells(this.deps.workbookManager, [\n ...Array.from(this.previousTables?.values() ?? []).flatMap((tables) =>\n Array.from(tables.values())\n ),\n ...Array.from(this.newTables.values()).flatMap((tables) =>\n Array.from(tables.values())\n ),\n ]),\n tableContextChangedCells: buildTableContextChangedCells(\n this.deps.workbookManager,\n [\n ...Array.from(this.previousTables?.values() ?? []).flatMap((tables) =>\n Array.from(tables.values())\n ),\n ...Array.from(this.newTables.values()).flatMap((tables) =>\n Array.from(tables.values())\n ),\n ]\n ),\n resourceKeys: Array.from(resourceKeys),\n };\n this.undoFootprint = this.executeFootprint;\n }\n\n undo(): void {\n if (!this.previousTables) return;\n this.deps.tableManager.resetTables(this.previousTables);\n }\n\n getInvalidationFootprint(phase: \"execute\" | \"undo\"): MutationInvalidation {\n return phase === \"execute\" ? this.executeFootprint : this.undoFootprint;\n }\n\n toAction(): EngineAction {\n return {\n type: ActionTypes.RESET_TABLES,\n payload: {\n tables: Array.from(this.newTables.entries()).map(([wb, tables]) => [\n wb,\n Array.from(tables.entries()),\n ]),\n },\n };\n }\n}\n"
6
6
  ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBuD,IAAvD;AACoC,IAApC;AAAA;AAqBO,MAAM,gBAAyC;AAAA,EAM1C;AAAA,EACA;AAAA,EAND,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9C,MAAM,KAAK,OAAO,OAAO,CAAC,CAC5B;AAAA,MACF,CACF;AAAA,MACA,cAAc,MAAM,KAAK,YAAY;AAAA,IACvC;AAAA,IACA,KAAK,gBAAgB,KAAK;AAAA;AAAA,EAG5B,IAAI,GAAS;AAAA,IACX,IAAI,CAAC,KAAK;AAAA,MAAgB;AAAA,IAC1B,KAAK,KAAK,aAAa,YAAY,KAAK,cAAc;AAAA;AAAA,EAGxD,wBAAwB,CAAC,OAAiD;AAAA,IACxE,OAAO,UAAU,YAAY,KAAK,mBAAmB,KAAK;AAAA;AAAA,EAG5D,QAAQ,GAAiB;AAAA,IACvB,OAAO;AAAA,MACL,MAAM,yBAAY;AAAA,MAClB,SAAS;AAAA,QACP,QAAQ,MAAM,KAAK,KAAK,UAAU,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,YAAY;AAAA,UACjE;AAAA,UACA,MAAM,KAAK,OAAO,QAAQ,CAAC;AAAA,QAC7B,CAAC;AAAA,MACH;AAAA,IACF;AAAA;AAEJ;",
8
+ "debugId": "B613AEE64997BD0E64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/core/commands/types.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * Command Pattern Types for FormulaEngine\n *\n * Commands encapsulate all mutating operations on the engine,\n * enabling undo/redo, schema validation with rollback, and action serialization.\n */\n\nimport type { CellAddress, RangeAddress, SerializedCellValue } from \"../types.cjs\";\n\nexport type CellContentKind = \"empty\" | \"scalar\" | \"formula\";\n\nexport type RemovedScope =\n | { type: \"workbook\"; workbookName: string }\n | { type: \"sheet\"; workbookName: string; sheetName: string };\n\nexport type MutationInvalidation = {\n touchedCells: Array<{\n address: CellAddress;\n beforeKind: CellContentKind;\n afterKind: CellContentKind;\n }>;\n resourceKeys: string[];\n removedScopes?: RemovedScope[];\n};\n\nexport function getSerializedCellValueKind(\n value: SerializedCellValue | undefined\n): CellContentKind {\n if (\n value === undefined ||\n (typeof value === \"string\" && value.length === 0)\n ) {\n return \"empty\";\n }\n if (typeof value === \"string\" && value.startsWith(\"=\")) {\n return \"formula\";\n }\n return \"scalar\";\n}\n\nexport function emptyMutationInvalidation(): MutationInvalidation {\n return {\n touchedCells: [],\n resourceKeys: [],\n };\n}\n\n/**\n * Serializable action representation of a command.\n * Used for persistence, collaboration, and changelog functionality.\n */\nexport interface EngineAction {\n type: string;\n payload: unknown;\n timestamp?: number;\n}\n\n/**\n * Base interface for all engine commands.\n */\nexport interface EngineCommand {\n /**\n * Whether this command affects cell values/formulas and requires re-evaluation.\n * Commands that only affect metadata or styles don't need re-evaluation.\n */\n readonly requiresReevaluation: boolean;\n\n /**\n * Returns the exact mutation footprint for the last execute/undo pass.\n */\n getInvalidationFootprint?(\n phase: \"execute\" | \"undo\"\n ): MutationInvalidation;\n\n /**\n * Execute the command (forward operation).\n */\n execute(): void;\n\n /**\n * Undo the command (reverse operation).\n */\n undo(): void;\n\n /**\n * Convert the command to a serializable action for persistence/collaboration.\n */\n toAction(): EngineAction;\n}\n\n/**\n * Options for command execution.\n */\nexport interface ExecuteOptions {\n /**\n * Whether to validate schema constraints after execution.\n * Only applies to commands that require re-evaluation.\n */\n validate?: boolean;\n\n /**\n * Whether to skip adding to undo stack (for internal use).\n */\n skipUndoStack?: boolean;\n\n /**\n * Whether to skip emitting update events.\n */\n skipEmitUpdate?: boolean;\n}\n\n/**\n * Result of schema validation.\n */\nexport interface SchemaValidationResult {\n valid: boolean;\n errors: SchemaValidationErrorInfo[];\n}\n\n/**\n * Information about a schema validation error.\n */\nexport interface SchemaValidationErrorInfo {\n message: string;\n cellAddress?: CellAddress;\n schemaNamespace?: string;\n columnName?: string;\n originalError?: Error;\n}\n\n/**\n * Action types for all commands.\n * Used for serialization and deserialization.\n */\nexport const ActionTypes = {\n // Content commands\n SET_CELL_CONTENT: \"SET_CELL_CONTENT\",\n SET_SHEET_CONTENT: \"SET_SHEET_CONTENT\",\n CLEAR_RANGE: \"CLEAR_RANGE\",\n PASTE_CELLS: \"PASTE_CELLS\",\n FILL_AREAS: \"FILL_AREAS\",\n MOVE_CELL: \"MOVE_CELL\",\n MOVE_RANGE: \"MOVE_RANGE\",\n AUTO_FILL: \"AUTO_FILL\",\n\n // Structure commands - Workbook\n ADD_WORKBOOK: \"ADD_WORKBOOK\",\n REMOVE_WORKBOOK: \"REMOVE_WORKBOOK\",\n RENAME_WORKBOOK: \"RENAME_WORKBOOK\",\n CLONE_WORKBOOK: \"CLONE_WORKBOOK\",\n\n // Structure commands - Sheet\n ADD_SHEET: \"ADD_SHEET\",\n REMOVE_SHEET: \"REMOVE_SHEET\",\n RENAME_SHEET: \"RENAME_SHEET\",\n\n // Table commands\n ADD_TABLE: \"ADD_TABLE\",\n REMOVE_TABLE: \"REMOVE_TABLE\",\n RENAME_TABLE: \"RENAME_TABLE\",\n UPDATE_TABLE: \"UPDATE_TABLE\",\n RESET_TABLES: \"RESET_TABLES\",\n\n // Named expression commands\n ADD_NAMED_EXPRESSION: \"ADD_NAMED_EXPRESSION\",\n REMOVE_NAMED_EXPRESSION: \"REMOVE_NAMED_EXPRESSION\",\n UPDATE_NAMED_EXPRESSION: \"UPDATE_NAMED_EXPRESSION\",\n RENAME_NAMED_EXPRESSION: \"RENAME_NAMED_EXPRESSION\",\n SET_NAMED_EXPRESSIONS: \"SET_NAMED_EXPRESSIONS\",\n\n // Metadata commands\n SET_CELL_METADATA: \"SET_CELL_METADATA\",\n SET_SHEET_METADATA: \"SET_SHEET_METADATA\",\n SET_WORKBOOK_METADATA: \"SET_WORKBOOK_METADATA\",\n\n // Style commands\n ADD_CONDITIONAL_STYLE: \"ADD_CONDITIONAL_STYLE\",\n REMOVE_CONDITIONAL_STYLE: \"REMOVE_CONDITIONAL_STYLE\",\n ADD_CELL_STYLE: \"ADD_CELL_STYLE\",\n REMOVE_CELL_STYLE: \"REMOVE_CELL_STYLE\",\n CLEAR_CELL_STYLES: \"CLEAR_CELL_STYLES\",\n\n // State commands\n RESET_TO_SERIALIZED: \"RESET_TO_SERIALIZED\",\n} as const;\n\nexport type ActionType = (typeof ActionTypes)[keyof typeof ActionTypes];\n"
5
+ "/**\n * Command Pattern Types for FormulaEngine\n *\n * Commands encapsulate all mutating operations on the engine,\n * enabling undo/redo, schema validation with rollback, and action serialization.\n */\n\nimport type { CellAddress, RangeAddress, SerializedCellValue } from \"../types.cjs\";\n\nexport type CellContentKind = \"empty\" | \"scalar\" | \"formula\";\n\nexport type RemovedScope =\n | { type: \"workbook\"; workbookName: string }\n | { type: \"sheet\"; workbookName: string; sheetName: string };\n\nexport type MutationInvalidation = {\n touchedCells: Array<{\n address: CellAddress;\n beforeKind: CellContentKind;\n afterKind: CellContentKind;\n }>;\n /**\n * Cells whose table membership or implicit current-row table context changed\n * without necessarily changing their formula text.\n */\n tableContextChangedCells?: CellAddress[];\n resourceKeys: string[];\n removedScopes?: RemovedScope[];\n};\n\nexport function getSerializedCellValueKind(\n value: SerializedCellValue | undefined\n): CellContentKind {\n if (\n value === undefined ||\n (typeof value === \"string\" && value.length === 0)\n ) {\n return \"empty\";\n }\n if (typeof value === \"string\" && value.startsWith(\"=\")) {\n return \"formula\";\n }\n return \"scalar\";\n}\n\nexport function emptyMutationInvalidation(): MutationInvalidation {\n return {\n touchedCells: [],\n resourceKeys: [],\n };\n}\n\n/**\n * Serializable action representation of a command.\n * Used for persistence, collaboration, and changelog functionality.\n */\nexport interface EngineAction {\n type: string;\n payload: unknown;\n timestamp?: number;\n}\n\n/**\n * Base interface for all engine commands.\n */\nexport interface EngineCommand {\n /**\n * Whether this command affects cell values/formulas and requires re-evaluation.\n * Commands that only affect metadata or styles don't need re-evaluation.\n */\n readonly requiresReevaluation: boolean;\n\n /**\n * Returns the exact mutation footprint for the last execute/undo pass.\n */\n getInvalidationFootprint?(\n phase: \"execute\" | \"undo\"\n ): MutationInvalidation;\n\n /**\n * Execute the command (forward operation).\n */\n execute(): void;\n\n /**\n * Undo the command (reverse operation).\n */\n undo(): void;\n\n /**\n * Convert the command to a serializable action for persistence/collaboration.\n */\n toAction(): EngineAction;\n}\n\n/**\n * Options for command execution.\n */\nexport interface ExecuteOptions {\n /**\n * Whether to validate schema constraints after execution.\n * Only applies to commands that require re-evaluation.\n */\n validate?: boolean;\n\n /**\n * Whether to skip adding to undo stack (for internal use).\n */\n skipUndoStack?: boolean;\n\n /**\n * Whether to skip emitting update events.\n */\n skipEmitUpdate?: boolean;\n}\n\n/**\n * Result of schema validation.\n */\nexport interface SchemaValidationResult {\n valid: boolean;\n errors: SchemaValidationErrorInfo[];\n}\n\n/**\n * Information about a schema validation error.\n */\nexport interface SchemaValidationErrorInfo {\n message: string;\n cellAddress?: CellAddress;\n schemaNamespace?: string;\n columnName?: string;\n originalError?: Error;\n}\n\n/**\n * Action types for all commands.\n * Used for serialization and deserialization.\n */\nexport const ActionTypes = {\n // Content commands\n SET_CELL_CONTENT: \"SET_CELL_CONTENT\",\n SET_SHEET_CONTENT: \"SET_SHEET_CONTENT\",\n CLEAR_RANGE: \"CLEAR_RANGE\",\n PASTE_CELLS: \"PASTE_CELLS\",\n FILL_AREAS: \"FILL_AREAS\",\n MOVE_CELL: \"MOVE_CELL\",\n MOVE_RANGE: \"MOVE_RANGE\",\n AUTO_FILL: \"AUTO_FILL\",\n\n // Structure commands - Workbook\n ADD_WORKBOOK: \"ADD_WORKBOOK\",\n REMOVE_WORKBOOK: \"REMOVE_WORKBOOK\",\n RENAME_WORKBOOK: \"RENAME_WORKBOOK\",\n CLONE_WORKBOOK: \"CLONE_WORKBOOK\",\n\n // Structure commands - Sheet\n ADD_SHEET: \"ADD_SHEET\",\n REMOVE_SHEET: \"REMOVE_SHEET\",\n RENAME_SHEET: \"RENAME_SHEET\",\n\n // Table commands\n ADD_TABLE: \"ADD_TABLE\",\n REMOVE_TABLE: \"REMOVE_TABLE\",\n RENAME_TABLE: \"RENAME_TABLE\",\n UPDATE_TABLE: \"UPDATE_TABLE\",\n RESET_TABLES: \"RESET_TABLES\",\n\n // Named expression commands\n ADD_NAMED_EXPRESSION: \"ADD_NAMED_EXPRESSION\",\n REMOVE_NAMED_EXPRESSION: \"REMOVE_NAMED_EXPRESSION\",\n UPDATE_NAMED_EXPRESSION: \"UPDATE_NAMED_EXPRESSION\",\n RENAME_NAMED_EXPRESSION: \"RENAME_NAMED_EXPRESSION\",\n SET_NAMED_EXPRESSIONS: \"SET_NAMED_EXPRESSIONS\",\n\n // Metadata commands\n SET_CELL_METADATA: \"SET_CELL_METADATA\",\n SET_SHEET_METADATA: \"SET_SHEET_METADATA\",\n SET_WORKBOOK_METADATA: \"SET_WORKBOOK_METADATA\",\n\n // Style commands\n ADD_CONDITIONAL_STYLE: \"ADD_CONDITIONAL_STYLE\",\n REMOVE_CONDITIONAL_STYLE: \"REMOVE_CONDITIONAL_STYLE\",\n ADD_CELL_STYLE: \"ADD_CELL_STYLE\",\n REMOVE_CELL_STYLE: \"REMOVE_CELL_STYLE\",\n CLEAR_CELL_STYLES: \"CLEAR_CELL_STYLES\",\n\n // State commands\n RESET_TO_SERIALIZED: \"RESET_TO_SERIALIZED\",\n} as const;\n\nexport type ActionType = (typeof ActionTypes)[keyof typeof ActionTypes];\n"
6
6
  ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,SAAS,0BAA0B,CACxC,OACiB;AAAA,EACjB,IACE,UAAU,aACT,OAAO,UAAU,YAAY,MAAM,WAAW,GAC/C;AAAA,IACA,OAAO;AAAA,EACT;AAAA,EACA,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GAAG,GAAG;AAAA,IACtD,OAAO;AAAA,EACT;AAAA,EACA,OAAO;AAAA;AAGF,SAAS,yBAAyB,GAAyB;AAAA,EAChE,OAAO;AAAA,IACL,cAAc,CAAC;AAAA,IACf,cAAc,CAAC;AAAA,EACjB;AAAA;AA0FK,IAAM,cAAc;AAAA,EAEzB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,E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AAA,EACjB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAGhB,WAAW;AAAA,EACX,cAAc;AAAA,EACd,cAAc;AAAA,EAGd,WAAW;AAAA,EACX,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc;AAAA,EAGd,sBAAsB;AAAA,EACtB,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,uBAAuB;AAAA,EAGvB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EAGvB,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EAGnB,qBAAqB;AACvB;",
8
8
  "debugId": "65098011DD3A30FD64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -409,6 +409,18 @@ class FormulaEngine {
409
409
  }
410
410
  addSheet(opts) {
411
411
  this.commandExecutor.execute(new import_structure_commands.AddSheetCommand(this.getStructureCommandDeps(), opts), { validate: this.schemaManager.hasSchemas() });
412
+ const sheet = this.workbookManager.getSheet(opts);
413
+ if (!sheet) {
414
+ throw new Error(`Failed to create sheet '${opts.sheetName}'`);
415
+ }
416
+ return sheet;
417
+ }
418
+ createSheet(opts) {
419
+ const sheetName = opts.sheetName ?? this.workbookManager.getNextAvailableSheetName(opts.workbookName, opts.baseName);
420
+ return this.addSheet({
421
+ workbookName: opts.workbookName,
422
+ sheetName
423
+ });
412
424
  }
413
425
  removeSheet(opts) {
414
426
  this.commandExecutor.execute(new import_structure_commands.RemoveSheetCommand(this.getStructureCommandDeps(), opts), { validate: this.schemaManager.hasSchemas() });
@@ -422,6 +434,15 @@ class FormulaEngine {
422
434
  getSheets(workbookName) {
423
435
  return this.workbookManager.getSheets(workbookName);
424
436
  }
437
+ getOrderedSheets(workbookName) {
438
+ return this.workbookManager.getOrderedSheets(workbookName);
439
+ }
440
+ getOrderedSheetNames(workbookName) {
441
+ return this.workbookManager.getOrderedSheetNames(workbookName);
442
+ }
443
+ getNextAvailableSheetName(workbookName, baseName) {
444
+ return this.workbookManager.getNextAvailableSheetName(workbookName, baseName);
445
+ }
425
446
  getSheet({
426
447
  workbookName,
427
448
  sheetName
@@ -571,4 +592,4 @@ class FormulaEngine {
571
592
  }
572
593
  }
573
594
 
574
- //# debugId=F08768C7E955A82964756E2164756E21
595
+ //# debugId=979808DBD1ADBF8164756E2164756E21