@dxos/plugin-sheet 0.6.12-main.15a606f → 0.6.12-main.2d19bf1
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/lib/browser/SheetContainer-NDNIS44E.mjs +265 -0
- package/dist/lib/browser/SheetContainer-NDNIS44E.mjs.map +7 -0
- package/dist/lib/browser/chunk-AQSGDA4X.mjs +1614 -0
- package/dist/lib/browser/chunk-AQSGDA4X.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QILRZNE5.mjs → chunk-D3QTX46O.mjs} +4 -5
- package/dist/lib/browser/chunk-D3QTX46O.mjs.map +7 -0
- package/dist/lib/browser/{chunk-T3NJFTD4.mjs → chunk-GKI67SEF.mjs} +20 -26
- package/dist/lib/browser/chunk-GKI67SEF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6ZMQVB4Z.mjs → chunk-GSV5QNLD.mjs} +220 -177
- package/dist/lib/browser/chunk-GSV5QNLD.mjs.map +7 -0
- package/dist/lib/browser/graph-M4IQ76QX.mjs +33 -0
- package/dist/lib/browser/index.mjs +41 -22
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types.mjs +4 -8
- package/dist/lib/node/SheetContainer-YSQGJD7K.cjs +276 -0
- package/dist/lib/node/SheetContainer-YSQGJD7K.cjs.map +7 -0
- package/dist/lib/node/{chunk-DD6FIXWC.cjs → chunk-5XPK2V4A.cjs} +222 -175
- package/dist/lib/node/chunk-5XPK2V4A.cjs.map +7 -0
- package/dist/lib/node/chunk-6F43RV45.cjs +1610 -0
- package/dist/lib/node/chunk-6F43RV45.cjs.map +7 -0
- package/dist/lib/node/{chunk-Q3HBHPRL.cjs → chunk-ER3PM7GD.cjs} +26 -34
- package/dist/lib/node/chunk-ER3PM7GD.cjs.map +7 -0
- package/dist/lib/node/{chunk-BNARJ5GM.cjs → chunk-QIFIGEKV.cjs} +6 -7
- package/dist/lib/node/chunk-QIFIGEKV.cjs.map +7 -0
- package/dist/lib/node/graph-Q3N2X26H.cjs +55 -0
- package/dist/lib/node/graph-Q3N2X26H.cjs.map +7 -0
- package/dist/lib/node/index.cjs +61 -44
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.cjs +3 -3
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +8 -12
- package/dist/lib/node/types.cjs.map +2 -2
- package/dist/lib/node-esm/SheetContainer-M7WRMZDU.mjs +266 -0
- package/dist/lib/node-esm/SheetContainer-M7WRMZDU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-D6KU5MI7.mjs → chunk-5WPZCXNS.mjs} +220 -177
- package/dist/lib/node-esm/chunk-5WPZCXNS.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ELTFPX5B.mjs +1615 -0
- package/dist/lib/node-esm/chunk-ELTFPX5B.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IU2L277A.mjs → chunk-VCYJWE3O.mjs} +4 -5
- package/dist/lib/node-esm/chunk-VCYJWE3O.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BMNA27EX.mjs → chunk-ZVLLQ2PJ.mjs} +20 -26
- package/dist/lib/node-esm/chunk-ZVLLQ2PJ.mjs.map +7 -0
- package/dist/lib/node-esm/graph-SMPUMOV2.mjs +34 -0
- package/dist/lib/node-esm/index.mjs +41 -22
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/types.mjs +4 -8
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +3 -0
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +1 -0
- package/dist/types/src/components/FunctionEditor/index.d.ts +2 -0
- package/dist/types/src/components/FunctionEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/GridSheet.d.ts +1 -8
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/{CellEditor/CellEditor.stories.d.ts → GridSheet/SheetCellEditor.stories.d.ts} +2 -2
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/index.d.ts +2 -0
- package/dist/types/src/components/GridSheet/index.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/util.d.ts +13 -3
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +6 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +11 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContainer/index.d.ts +3 -0
- package/dist/types/src/components/SheetContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContext/SheetContext.d.ts +27 -0
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -0
- package/dist/types/src/components/SheetContext/index.d.ts +2 -0
- package/dist/types/src/components/SheetContext/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +31 -17
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +1 -1
- package/dist/types/src/components/index.d.ts +3 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/defs/types.d.ts.map +1 -1
- package/dist/types/src/defs/util.d.ts +1 -1
- package/dist/types/src/defs/util.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.d.ts +3 -2
- package/dist/types/src/extensions/compute.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/extension.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/extension.test.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/index.d.ts +2 -0
- package/dist/types/src/extensions/editor/index.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +1 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/graph/compute-graph-registry.d.ts +34 -0
- package/dist/types/src/graph/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/graph/compute-graph.d.ts +17 -34
- package/dist/types/src/graph/compute-graph.d.ts.map +1 -1
- package/dist/types/src/graph/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/graph/compute-graph.test.d.ts +2 -0
- package/dist/types/src/graph/compute-graph.test.d.ts.map +1 -0
- package/dist/types/src/graph/compute-node.d.ts +9 -2
- package/dist/types/src/graph/compute-node.d.ts.map +1 -1
- package/dist/types/src/graph/{async-function.d.ts → functions/async-function.d.ts} +13 -4
- package/dist/types/src/graph/functions/async-function.d.ts.map +1 -0
- package/dist/types/src/graph/functions/edge-function.d.ts +21 -0
- package/dist/types/src/graph/functions/edge-function.d.ts.map +1 -0
- package/dist/types/src/graph/functions/function-defs.d.ts.map +1 -0
- package/dist/types/src/graph/functions/index.d.ts +4 -0
- package/dist/types/src/graph/functions/index.d.ts.map +1 -0
- package/dist/types/src/graph/index.d.ts +2 -1
- package/dist/types/src/graph/index.d.ts.map +1 -1
- package/dist/types/src/graph/testing/index.d.ts +3 -0
- package/dist/types/src/graph/testing/index.d.ts.map +1 -0
- package/dist/types/src/graph/testing/test-builder.d.ts +15 -0
- package/dist/types/src/graph/testing/test-builder.d.ts.map +1 -0
- package/dist/types/src/graph/testing/test-plugin.d.ts +36 -0
- package/dist/types/src/graph/testing/test-plugin.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/threads.d.ts +8 -0
- package/dist/types/src/hooks/threads.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeGraph.d.ts.map +1 -1
- package/dist/types/src/hooks/useSheetModel.d.ts +2 -2
- package/dist/types/src/hooks/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -6
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/{components/Sheet → model}/decorations.d.ts +1 -0
- package/dist/types/src/model/decorations.d.ts.map +1 -0
- package/dist/types/src/model/formatting-model.d.ts +3 -0
- package/dist/types/src/model/formatting-model.d.ts.map +1 -1
- package/dist/types/src/model/index.d.ts +1 -0
- package/dist/types/src/model/index.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +6 -5
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.test.d.ts +2 -0
- package/dist/types/src/model/sheet-model.test.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +4 -5
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +17 -31
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +42 -41
- package/src/SheetPlugin.tsx +22 -17
- package/src/components/FunctionEditor/FunctionEditor.tsx +45 -0
- package/src/components/FunctionEditor/index.ts +5 -0
- package/src/components/GridSheet/GridSheet.stories.tsx +11 -5
- package/src/components/GridSheet/GridSheet.tsx +78 -70
- package/src/components/{CellEditor/CellEditor.stories.tsx → GridSheet/SheetCellEditor.stories.tsx} +4 -5
- package/src/components/{Sheet → GridSheet}/index.ts +1 -1
- package/src/components/GridSheet/util.ts +94 -39
- package/src/components/SheetContainer/SheetContainer.stories.tsx +40 -0
- package/src/components/SheetContainer/SheetContainer.tsx +52 -0
- package/src/components/SheetContainer/index.ts +7 -0
- package/src/components/{Sheet/sheet-context.tsx → SheetContext/SheetContext.tsx} +48 -28
- package/src/components/SheetContext/index.ts +5 -0
- package/src/components/Toolbar/Toolbar.tsx +127 -86
- package/src/components/index.ts +2 -1
- package/src/defs/types.ts +1 -0
- package/src/defs/util.ts +20 -4
- package/src/extensions/compute.stories.tsx +23 -23
- package/src/extensions/compute.ts +91 -42
- package/src/{components/CellEditor → extensions/editor}/extension.test.ts +0 -1
- package/src/{components/CellEditor → extensions/editor}/extension.ts +4 -3
- package/src/{components/CellEditor → extensions/editor}/index.ts +0 -1
- package/src/extensions/index.ts +1 -0
- package/src/graph/compute-graph-registry.ts +90 -0
- package/src/graph/compute-graph.stories.tsx +4 -3
- package/src/graph/compute-graph.test.ts +87 -0
- package/src/graph/compute-graph.ts +73 -121
- package/src/graph/compute-node.ts +17 -5
- package/src/graph/{async-function.ts → functions/async-function.ts} +23 -15
- package/src/graph/{edge-function.ts → functions/edge-function.ts} +14 -13
- package/src/graph/functions/index.ts +7 -0
- package/src/graph/hyperformula.test.ts +1 -2
- package/src/graph/index.ts +2 -1
- package/src/graph/testing/index.ts +6 -0
- package/src/graph/testing/test-builder.ts +54 -0
- package/src/graph/{custom-function.ts → testing/test-plugin.ts} +43 -9
- package/src/hooks/hooks.stories.tsx +3 -3
- package/src/hooks/index.ts +1 -0
- package/src/{components/Sheet/threads.tsx → hooks/threads.ts} +26 -84
- package/src/hooks/useComputeGraph.ts +9 -1
- package/src/hooks/useSheetModel.ts +4 -7
- package/src/{meta.tsx → meta.ts} +3 -3
- package/src/{components/Sheet → model}/decorations.ts +2 -0
- package/src/model/formatting-model.ts +12 -9
- package/src/model/index.ts +1 -0
- package/src/model/sheet-model.test.ts +57 -0
- package/src/model/sheet-model.ts +60 -41
- package/src/testing/testing.tsx +17 -15
- package/src/types.ts +12 -38
- package/dist/lib/browser/SheetContainer-V4GCCZTX.mjs +0 -261
- package/dist/lib/browser/SheetContainer-V4GCCZTX.mjs.map +0 -7
- package/dist/lib/browser/chunk-6ZMQVB4Z.mjs.map +0 -7
- package/dist/lib/browser/chunk-QILRZNE5.mjs.map +0 -7
- package/dist/lib/browser/chunk-T3NJFTD4.mjs.map +0 -7
- package/dist/lib/browser/chunk-U2JHW3L6.mjs +0 -2552
- package/dist/lib/browser/chunk-U2JHW3L6.mjs.map +0 -7
- package/dist/lib/browser/graph-T27BOBOV.mjs +0 -21
- package/dist/lib/node/SheetContainer-3ZY7MPWJ.cjs +0 -279
- package/dist/lib/node/SheetContainer-3ZY7MPWJ.cjs.map +0 -7
- package/dist/lib/node/chunk-BNARJ5GM.cjs.map +0 -7
- package/dist/lib/node/chunk-DD6FIXWC.cjs.map +0 -7
- package/dist/lib/node/chunk-OTTD7FBK.cjs +0 -2536
- package/dist/lib/node/chunk-OTTD7FBK.cjs.map +0 -7
- package/dist/lib/node/chunk-Q3HBHPRL.cjs.map +0 -7
- package/dist/lib/node/graph-SPKGX7W4.cjs +0 -43
- package/dist/lib/node/graph-SPKGX7W4.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-PXSJX6XK.mjs +0 -262
- package/dist/lib/node-esm/SheetContainer-PXSJX6XK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7HVSOTGA.mjs +0 -2553
- package/dist/lib/node-esm/chunk-7HVSOTGA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BMNA27EX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D6KU5MI7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IU2L277A.mjs.map +0 -7
- package/dist/lib/node-esm/graph-U67IO4UC.mjs +0 -22
- package/dist/types/src/components/CellEditor/CellEditor.d.ts +0 -34
- package/dist/types/src/components/CellEditor/CellEditor.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/extension.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/extension.test.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/index.d.ts +0 -3
- package/dist/types/src/components/CellEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +0 -55
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts +0 -53
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/decorations.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/grid.d.ts +0 -52
- package/dist/types/src/components/Sheet/grid.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/index.d.ts +0 -2
- package/dist/types/src/components/Sheet/index.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/nav.d.ts +0 -29
- package/dist/types/src/components/Sheet/nav.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/sheet-context.d.ts +0 -26
- package/dist/types/src/components/Sheet/sheet-context.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/threads.d.ts +0 -2
- package/dist/types/src/components/Sheet/threads.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/util.d.ts +0 -18
- package/dist/types/src/components/Sheet/util.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer.d.ts +0 -8
- package/dist/types/src/components/SheetContainer.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/common.d.ts +0 -20
- package/dist/types/src/components/Toolbar/common.d.ts.map +0 -1
- package/dist/types/src/graph/async-function.d.ts.map +0 -1
- package/dist/types/src/graph/compute-graph.browser.test.d.ts +0 -2
- package/dist/types/src/graph/compute-graph.browser.test.d.ts.map +0 -1
- package/dist/types/src/graph/custom-function.d.ts +0 -21
- package/dist/types/src/graph/custom-function.d.ts.map +0 -1
- package/dist/types/src/graph/edge-function.d.ts +0 -20
- package/dist/types/src/graph/edge-function.d.ts.map +0 -1
- package/dist/types/src/graph/function-defs.d.ts.map +0 -1
- package/src/components/CellEditor/CellEditor.tsx +0 -163
- package/src/components/Sheet/Sheet.stories.tsx +0 -250
- package/src/components/Sheet/Sheet.tsx +0 -1199
- package/src/components/Sheet/grid.ts +0 -191
- package/src/components/Sheet/nav.ts +0 -157
- package/src/components/Sheet/util.ts +0 -56
- package/src/components/SheetContainer.tsx +0 -88
- package/src/components/Toolbar/common.tsx +0 -72
- package/src/graph/compute-graph.browser.test.ts +0 -104
- /package/dist/lib/browser/{graph-T27BOBOV.mjs.map → graph-M4IQ76QX.mjs.map} +0 -0
- /package/dist/lib/node-esm/{graph-U67IO4UC.mjs.map → graph-SMPUMOV2.mjs.map} +0 -0
- /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.d.ts +0 -0
- /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.test.d.ts +0 -0
- /package/dist/types/src/graph/{function-defs.d.ts → functions/function-defs.d.ts} +0 -0
- /package/src/graph/{function-defs.ts → functions/function-defs.ts} +0 -0
|
@@ -26,33 +26,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_5XPK2V4A_exports = {};
|
|
30
|
+
__export(chunk_5XPK2V4A_exports, {
|
|
31
|
+
AsyncFunctionPlugin: () => AsyncFunctionPlugin,
|
|
31
32
|
ComputeGraph: () => ComputeGraph,
|
|
32
33
|
ComputeGraphRegistry: () => ComputeGraphRegistry,
|
|
33
34
|
ComputeNode: () => ComputeNode,
|
|
34
|
-
|
|
35
|
+
EDGE_FUNCTION_NAME: () => EDGE_FUNCTION_NAME,
|
|
36
|
+
EdgeFunctionPlugin: () => EdgeFunctionPlugin,
|
|
37
|
+
EdgeFunctionPluginTranslations: () => EdgeFunctionPluginTranslations,
|
|
38
|
+
FunctionContext: () => FunctionContext,
|
|
35
39
|
createSheetName: () => createSheetName,
|
|
40
|
+
defaultFunctionContextOptions: () => defaultFunctionContextOptions,
|
|
36
41
|
defaultFunctions: () => defaultFunctions,
|
|
37
42
|
defaultOptions: () => defaultOptions,
|
|
38
|
-
|
|
43
|
+
defaultPlugins: () => defaultPlugins,
|
|
44
|
+
parseSheetName: () => parseSheetName
|
|
39
45
|
});
|
|
40
|
-
module.exports = __toCommonJS(
|
|
46
|
+
module.exports = __toCommonJS(chunk_5XPK2V4A_exports);
|
|
41
47
|
var import_async = require("@dxos/async");
|
|
42
48
|
var import_echo = require("@dxos/client/echo");
|
|
43
49
|
var import_context = require("@dxos/context");
|
|
50
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
44
51
|
var import_invariant = require("@dxos/invariant");
|
|
45
52
|
var import_keys = require("@dxos/keys");
|
|
46
53
|
var import_log = require("@dxos/log");
|
|
47
54
|
var import_types = require("@dxos/plugin-script/types");
|
|
48
55
|
var import_util = require("@dxos/util");
|
|
49
56
|
var import_hyperformula = require("#hyperformula");
|
|
50
|
-
var import_lodash = __toESM(require("lodash.defaultsdeep"));
|
|
51
57
|
var import_async2 = require("@dxos/async");
|
|
52
|
-
var
|
|
58
|
+
var import_context2 = require("@dxos/context");
|
|
53
59
|
var import_hyperformula2 = require("#hyperformula");
|
|
60
|
+
var import_lodash = __toESM(require("lodash.defaultsdeep"));
|
|
54
61
|
var import_async3 = require("@dxos/async");
|
|
55
|
-
var
|
|
62
|
+
var import_log2 = require("@dxos/log");
|
|
56
63
|
var import_hyperformula3 = require("#hyperformula");
|
|
57
64
|
var import_signals_core = require("@preact/signals-core");
|
|
58
65
|
var import_echo2 = require("@dxos/client/echo");
|
|
@@ -61,10 +68,55 @@ var import_edge = require("@dxos/plugin-script/edge");
|
|
|
61
68
|
var import_types2 = require("@dxos/plugin-script/types");
|
|
62
69
|
var import_util2 = require("@dxos/util");
|
|
63
70
|
var import_hyperformula4 = require("#hyperformula");
|
|
64
|
-
var
|
|
71
|
+
var import_lodash2 = __toESM(require("lodash.defaultsdeep"));
|
|
72
|
+
var import_context3 = require("@dxos/context");
|
|
73
|
+
var import_invariant2 = require("@dxos/invariant");
|
|
74
|
+
var import_log4 = require("@dxos/log");
|
|
75
|
+
var import_hyperformula5 = require("#hyperformula");
|
|
76
|
+
var ComputeNode = class extends import_context2.Resource {
|
|
77
|
+
constructor(_graph, sheetId) {
|
|
78
|
+
super();
|
|
79
|
+
this._graph = _graph;
|
|
80
|
+
this.sheetId = sheetId;
|
|
81
|
+
this.update = new import_async2.Event();
|
|
82
|
+
}
|
|
83
|
+
get graph() {
|
|
84
|
+
return this._graph;
|
|
85
|
+
}
|
|
86
|
+
clear() {
|
|
87
|
+
this._graph.hf.clearSheet(this.sheetId);
|
|
88
|
+
}
|
|
89
|
+
getValue(cell) {
|
|
90
|
+
const value = this._graph.hf.getCellValue({
|
|
91
|
+
sheet: this.sheetId,
|
|
92
|
+
row: cell.row,
|
|
93
|
+
col: cell.col
|
|
94
|
+
});
|
|
95
|
+
if (value instanceof import_hyperformula2.DetailedCellError) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
setValue(cell, value) {
|
|
101
|
+
const mappedValue = typeof value === "string" && value.charAt(0) === "=" ? this._graph.mapFormulaToNative(value) : value;
|
|
102
|
+
this._graph.hf.setCellContents({
|
|
103
|
+
sheet: this.sheetId,
|
|
104
|
+
row: cell.row,
|
|
105
|
+
col: cell.col
|
|
106
|
+
}, [
|
|
107
|
+
[
|
|
108
|
+
mappedValue
|
|
109
|
+
]
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
// TODO(burdon): Load data into sheet.
|
|
113
|
+
async _open() {
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/graph/functions/async-function.ts";
|
|
65
117
|
var defaultFunctionContextOptions = {
|
|
66
118
|
defaultTtl: 5e3,
|
|
67
|
-
|
|
119
|
+
debounceDelay: 200,
|
|
68
120
|
remoteFunctionUrl: "https://edge.dxos.workers.dev/functions"
|
|
69
121
|
};
|
|
70
122
|
var FunctionContext = class _FunctionContext {
|
|
@@ -75,7 +127,7 @@ var FunctionContext = class _FunctionContext {
|
|
|
75
127
|
...args
|
|
76
128
|
});
|
|
77
129
|
}
|
|
78
|
-
constructor(_hf, _space,
|
|
130
|
+
constructor(_hf, _space, _options) {
|
|
79
131
|
this._hf = _hf;
|
|
80
132
|
this._space = _space;
|
|
81
133
|
this._cache = /* @__PURE__ */ new Map();
|
|
@@ -83,12 +135,11 @@ var FunctionContext = class _FunctionContext {
|
|
|
83
135
|
this._subscriptions = /* @__PURE__ */ new Map();
|
|
84
136
|
this._invocations = {};
|
|
85
137
|
this._options = (0, import_lodash.default)(_options ?? {}, defaultFunctionContextOptions);
|
|
86
|
-
this._onUpdate = (0,
|
|
138
|
+
this._onUpdate = (0, import_async3.debounce)((update) => {
|
|
87
139
|
this._hf.resumeEvaluation();
|
|
88
|
-
onUpdate(
|
|
89
|
-
}, this._options.
|
|
140
|
+
this._options.onUpdate?.(update);
|
|
141
|
+
}, this._options.debounceDelay);
|
|
90
142
|
}
|
|
91
|
-
// TODO(burdon): Remove?
|
|
92
143
|
get space() {
|
|
93
144
|
return this._space;
|
|
94
145
|
}
|
|
@@ -137,23 +188,26 @@ var FunctionContext = class _FunctionContext {
|
|
|
137
188
|
value: value2
|
|
138
189
|
}, {
|
|
139
190
|
F: __dxlog_file,
|
|
140
|
-
L:
|
|
191
|
+
L: 143,
|
|
141
192
|
S: this,
|
|
142
193
|
C: (f, a) => f(...a)
|
|
143
194
|
});
|
|
144
|
-
this._onUpdate(
|
|
195
|
+
this._onUpdate({
|
|
196
|
+
name,
|
|
197
|
+
cell
|
|
198
|
+
});
|
|
145
199
|
} catch (err) {
|
|
146
200
|
import_log2.log.warn("failed", {
|
|
147
201
|
cell,
|
|
148
202
|
err
|
|
149
203
|
}, {
|
|
150
204
|
F: __dxlog_file,
|
|
151
|
-
L:
|
|
205
|
+
L: 147,
|
|
152
206
|
S: this,
|
|
153
207
|
C: (f, a) => f(...a)
|
|
154
208
|
});
|
|
155
209
|
this._cache.set(invocationKey, {
|
|
156
|
-
value: new
|
|
210
|
+
value: new import_hyperformula3.CellError(import_hyperformula3.ErrorType.ERROR, "Function failed."),
|
|
157
211
|
ts: Date.now()
|
|
158
212
|
});
|
|
159
213
|
} finally {
|
|
@@ -168,67 +222,33 @@ var FunctionContext = class _FunctionContext {
|
|
|
168
222
|
cache: value
|
|
169
223
|
}, {
|
|
170
224
|
F: __dxlog_file,
|
|
171
|
-
L:
|
|
225
|
+
L: 155,
|
|
172
226
|
S: this,
|
|
173
227
|
C: (f, a) => f(...a)
|
|
174
228
|
});
|
|
175
229
|
return value;
|
|
176
230
|
}
|
|
177
231
|
};
|
|
178
|
-
var
|
|
232
|
+
var AsyncFunctionPlugin = class extends import_hyperformula3.FunctionPlugin {
|
|
179
233
|
get context() {
|
|
180
234
|
return this.config.context;
|
|
181
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Immediately returns cached value then runs the async function.
|
|
238
|
+
*/
|
|
182
239
|
runAsyncFunction(ast, state, cb, options) {
|
|
183
240
|
const { procedureName } = ast;
|
|
184
241
|
const metadata = this.metadata(procedureName);
|
|
185
242
|
return this.runFunction(ast.args, state, metadata, (...args) => {
|
|
186
|
-
return this.context.invokeFunction(procedureName, state, args, cb, options) ??
|
|
243
|
+
return this.context.invokeFunction(procedureName, state, args, cb, options) ?? import_hyperformula3.EmptyValue;
|
|
187
244
|
});
|
|
188
245
|
}
|
|
189
246
|
};
|
|
190
|
-
var
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
this.update = new import_async3.Event();
|
|
196
|
-
}
|
|
197
|
-
// TODO(burdon): Remove?
|
|
198
|
-
get graph() {
|
|
199
|
-
return this._graph;
|
|
200
|
-
}
|
|
201
|
-
get hf() {
|
|
202
|
-
return this._graph.hf;
|
|
203
|
-
}
|
|
204
|
-
getValue(cell) {
|
|
205
|
-
const value = this._graph.hf.getCellValue({
|
|
206
|
-
sheet: this.sheetId,
|
|
207
|
-
row: cell.row,
|
|
208
|
-
col: cell.col
|
|
209
|
-
});
|
|
210
|
-
if (value instanceof import_hyperformula3.DetailedCellError) {
|
|
211
|
-
return null;
|
|
212
|
-
}
|
|
213
|
-
return value;
|
|
214
|
-
}
|
|
215
|
-
setValue(cell, value) {
|
|
216
|
-
const mappedValue = typeof value === "string" && value.charAt(0) === "=" ? this._graph.mapFormulaToNative(value) : value;
|
|
217
|
-
this._graph.hf.setCellContents({
|
|
218
|
-
sheet: this.sheetId,
|
|
219
|
-
row: cell.row,
|
|
220
|
-
col: cell.col
|
|
221
|
-
}, [
|
|
222
|
-
[
|
|
223
|
-
mappedValue
|
|
224
|
-
]
|
|
225
|
-
]);
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/graph/edge-function.ts";
|
|
229
|
-
var EDGE_FUNCTION_TTL = 1e4;
|
|
230
|
-
var EdgeFunctionPlugin = class extends FunctionPluginAsync {
|
|
231
|
-
edge(ast, state) {
|
|
247
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/graph/functions/edge-function.ts";
|
|
248
|
+
var EDGE_FUNCTION_NAME = "DX";
|
|
249
|
+
var FUNCTION_TTL = 1e4;
|
|
250
|
+
var EdgeFunctionPlugin = class extends AsyncFunctionPlugin {
|
|
251
|
+
dx(ast, state) {
|
|
232
252
|
const handler = (subscribe = false) => async (binding, ...args) => {
|
|
233
253
|
const space = this.context.space;
|
|
234
254
|
if (!space) {
|
|
@@ -242,7 +262,7 @@ var EdgeFunctionPlugin = class extends FunctionPluginAsync {
|
|
|
242
262
|
binding
|
|
243
263
|
}, {
|
|
244
264
|
F: __dxlog_file2,
|
|
245
|
-
L:
|
|
265
|
+
L: 41,
|
|
246
266
|
S: this,
|
|
247
267
|
C: (f, a) => f(...a)
|
|
248
268
|
});
|
|
@@ -254,13 +274,13 @@ var EdgeFunctionPlugin = class extends FunctionPluginAsync {
|
|
|
254
274
|
fn
|
|
255
275
|
}, {
|
|
256
276
|
F: __dxlog_file2,
|
|
257
|
-
L:
|
|
277
|
+
L: 47,
|
|
258
278
|
S: this,
|
|
259
279
|
C: (f, a) => f(...a)
|
|
260
280
|
});
|
|
261
281
|
const _ = fn?.version;
|
|
262
282
|
this.runAsyncFunction(ast, state, handler(false), {
|
|
263
|
-
ttl:
|
|
283
|
+
ttl: FUNCTION_TTL
|
|
264
284
|
});
|
|
265
285
|
});
|
|
266
286
|
this.context.createSubscription(ast.procedureName, unsubscribe);
|
|
@@ -278,23 +298,19 @@ var EdgeFunctionPlugin = class extends FunctionPluginAsync {
|
|
|
278
298
|
return await result.text();
|
|
279
299
|
};
|
|
280
300
|
return this.runAsyncFunction(ast, state, handler(true), {
|
|
281
|
-
ttl:
|
|
301
|
+
ttl: FUNCTION_TTL
|
|
282
302
|
});
|
|
283
303
|
}
|
|
284
304
|
};
|
|
285
305
|
EdgeFunctionPlugin.implementedFunctions = {
|
|
286
|
-
|
|
287
|
-
method: "
|
|
306
|
+
[EDGE_FUNCTION_NAME]: {
|
|
307
|
+
method: "dx",
|
|
288
308
|
parameters: [
|
|
289
309
|
// Binding
|
|
290
310
|
{
|
|
291
311
|
argumentType: import_hyperformula4.FunctionArgumentType.STRING
|
|
292
312
|
},
|
|
293
|
-
// Remote function arguments (currently supporting up to
|
|
294
|
-
{
|
|
295
|
-
argumentType: import_hyperformula4.FunctionArgumentType.ANY,
|
|
296
|
-
optionalArg: true
|
|
297
|
-
},
|
|
313
|
+
// Remote function arguments (currently supporting up to 8).
|
|
298
314
|
{
|
|
299
315
|
argumentType: import_hyperformula4.FunctionArgumentType.ANY,
|
|
300
316
|
optionalArg: true
|
|
@@ -333,10 +349,10 @@ EdgeFunctionPlugin.implementedFunctions = {
|
|
|
333
349
|
};
|
|
334
350
|
var EdgeFunctionPluginTranslations = {
|
|
335
351
|
enGB: {
|
|
336
|
-
|
|
352
|
+
[EDGE_FUNCTION_NAME]: "Remote function"
|
|
337
353
|
},
|
|
338
354
|
enUS: {
|
|
339
|
-
|
|
355
|
+
[EDGE_FUNCTION_NAME]: "Remote function"
|
|
340
356
|
}
|
|
341
357
|
};
|
|
342
358
|
var defaultFunctions = [
|
|
@@ -2713,68 +2729,15 @@ var defaultFunctions = [
|
|
|
2713
2729
|
];
|
|
2714
2730
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/graph/compute-graph.ts";
|
|
2715
2731
|
var OBJECT_ID_LENGTH = 60;
|
|
2716
|
-
var
|
|
2717
|
-
var
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
};
|
|
2726
|
-
var PREFIX = "__";
|
|
2727
|
-
var createSheetName = (id) => `${PREFIX}${id}`;
|
|
2728
|
-
var getSheetId = (name) => name.startsWith(PREFIX) ? name.slice(PREFIX.length) : void 0;
|
|
2729
|
-
var createComputeGraphRegistry = (options = {}) => {
|
|
2730
|
-
return new ComputeGraphRegistry({
|
|
2731
|
-
...defaultOptions,
|
|
2732
|
-
...options
|
|
2733
|
-
});
|
|
2734
|
-
};
|
|
2735
|
-
var ComputeGraphRegistry = class extends import_context.Resource {
|
|
2736
|
-
constructor(_options = defaultOptions) {
|
|
2737
|
-
super();
|
|
2738
|
-
this._options = _options;
|
|
2739
|
-
this._registry = /* @__PURE__ */ new Map();
|
|
2740
|
-
this._options.plugins?.forEach(({ plugin, translations }) => {
|
|
2741
|
-
import_hyperformula.HyperFormula.registerFunctionPlugin(plugin, translations);
|
|
2742
|
-
});
|
|
2743
|
-
}
|
|
2744
|
-
getGraph(spaceId) {
|
|
2745
|
-
return this._registry.get(spaceId);
|
|
2746
|
-
}
|
|
2747
|
-
async getOrCreateGraph(space) {
|
|
2748
|
-
let graph = this.getGraph(space.id);
|
|
2749
|
-
if (!graph) {
|
|
2750
|
-
import_log.log.info("create graph", {
|
|
2751
|
-
space: space.id
|
|
2752
|
-
}, {
|
|
2753
|
-
F: __dxlog_file3,
|
|
2754
|
-
L: 95,
|
|
2755
|
-
S: this,
|
|
2756
|
-
C: (f, a) => f(...a)
|
|
2757
|
-
});
|
|
2758
|
-
graph = await this.createGraph(space);
|
|
2759
|
-
}
|
|
2760
|
-
return graph;
|
|
2761
|
-
}
|
|
2762
|
-
async createGraph(space) {
|
|
2763
|
-
(0, import_invariant.invariant)(!this._registry.has(space.id), `ComputeGraph already exists for space: ${space.id}`, {
|
|
2764
|
-
F: __dxlog_file3,
|
|
2765
|
-
L: 103,
|
|
2766
|
-
S: this,
|
|
2767
|
-
A: [
|
|
2768
|
-
"!this._registry.has(space.id)",
|
|
2769
|
-
"`ComputeGraph already exists for space: ${space.id}`"
|
|
2770
|
-
]
|
|
2771
|
-
});
|
|
2772
|
-
const hf = import_hyperformula.HyperFormula.buildEmpty(this._options);
|
|
2773
|
-
const graph = new ComputeGraph(hf, space, this._options);
|
|
2774
|
-
await graph.open(this._ctx);
|
|
2775
|
-
this._registry.set(space.id, graph);
|
|
2776
|
-
return graph;
|
|
2777
|
-
}
|
|
2732
|
+
var createSheetName = ({ type, id }) => `${type}@${id}`;
|
|
2733
|
+
var parseSheetName = (name) => {
|
|
2734
|
+
const [type, id] = name.split("@");
|
|
2735
|
+
return id ? {
|
|
2736
|
+
type,
|
|
2737
|
+
id
|
|
2738
|
+
} : {
|
|
2739
|
+
id: type
|
|
2740
|
+
};
|
|
2778
2741
|
};
|
|
2779
2742
|
var ComputeGraph = class extends import_context.Resource {
|
|
2780
2743
|
constructor(_hf, _space, _options) {
|
|
@@ -2784,34 +2747,41 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2784
2747
|
this._options = _options;
|
|
2785
2748
|
this.id = `graph-${import_keys.PublicKey.random().truncate()}`;
|
|
2786
2749
|
this._nodes = /* @__PURE__ */ new Map();
|
|
2787
|
-
this.
|
|
2788
|
-
this.context = new FunctionContext(this._hf, this._space, this.refresh.bind(this), this._options);
|
|
2750
|
+
this._remoteFunctions = [];
|
|
2789
2751
|
this.update = new import_async.Event();
|
|
2752
|
+
this.context = new FunctionContext(this._hf, this._space, this._options);
|
|
2790
2753
|
this._hf.updateConfig({
|
|
2791
2754
|
context: this.context
|
|
2792
2755
|
});
|
|
2756
|
+
const onValuesUpdate = (changes) => {
|
|
2757
|
+
for (const change of changes) {
|
|
2758
|
+
if (change instanceof import_hyperformula.ExportedCellChange) {
|
|
2759
|
+
const { sheet } = change;
|
|
2760
|
+
const node = this._nodes.get(sheet);
|
|
2761
|
+
if (node) {
|
|
2762
|
+
node.update.emit({
|
|
2763
|
+
type: "valuesUpdated",
|
|
2764
|
+
change
|
|
2765
|
+
});
|
|
2766
|
+
}
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
};
|
|
2770
|
+
this._hf.on("valuesUpdated", onValuesUpdate);
|
|
2771
|
+
this._ctx.onDispose(() => this._hf.off("valuesUpdated", onValuesUpdate));
|
|
2793
2772
|
}
|
|
2794
|
-
// TODO(burdon): Remove.
|
|
2795
2773
|
get hf() {
|
|
2796
2774
|
return this._hf;
|
|
2797
2775
|
}
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
F: __dxlog_file3,
|
|
2803
|
-
L: 152,
|
|
2804
|
-
S: this,
|
|
2805
|
-
C: (f, a) => f(...a)
|
|
2806
|
-
});
|
|
2807
|
-
this.update.emit();
|
|
2808
|
-
}
|
|
2809
|
-
getFunctions({ standard = true, echo = true } = {}) {
|
|
2776
|
+
getFunctions({ standard, echo } = {
|
|
2777
|
+
standard: true,
|
|
2778
|
+
echo: true
|
|
2779
|
+
}) {
|
|
2810
2780
|
return [
|
|
2811
2781
|
...standard ? this._hf.getRegisteredFunctionNames().map((name) => defaultFunctions.find((fn) => fn.name === name) ?? {
|
|
2812
2782
|
name
|
|
2813
2783
|
}) : [],
|
|
2814
|
-
...echo ? this.
|
|
2784
|
+
...echo ? this._remoteFunctions.map((fn) => ({
|
|
2815
2785
|
name: fn.binding
|
|
2816
2786
|
})) : []
|
|
2817
2787
|
];
|
|
@@ -2827,7 +2797,7 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2827
2797
|
getOrCreateNode(name) {
|
|
2828
2798
|
(0, import_invariant.invariant)(name.length, void 0, {
|
|
2829
2799
|
F: __dxlog_file3,
|
|
2830
|
-
L:
|
|
2800
|
+
L: 117,
|
|
2831
2801
|
S: this,
|
|
2832
2802
|
A: [
|
|
2833
2803
|
"name.length",
|
|
@@ -2837,20 +2807,19 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2837
2807
|
if (!this._hf.doesSheetExist(name)) {
|
|
2838
2808
|
import_log.log.info("created node", {
|
|
2839
2809
|
space: this._space?.id,
|
|
2840
|
-
name
|
|
2810
|
+
sheet: name
|
|
2841
2811
|
}, {
|
|
2842
2812
|
F: __dxlog_file3,
|
|
2843
|
-
L:
|
|
2813
|
+
L: 119,
|
|
2844
2814
|
S: this,
|
|
2845
2815
|
C: (f, a) => f(...a)
|
|
2846
2816
|
});
|
|
2847
2817
|
this._hf.addSheet(name);
|
|
2848
|
-
this.update.emit();
|
|
2849
2818
|
}
|
|
2850
2819
|
const sheetId = this._hf.getSheetId(name);
|
|
2851
2820
|
(0, import_invariant.invariant)(sheetId !== void 0, void 0, {
|
|
2852
2821
|
F: __dxlog_file3,
|
|
2853
|
-
L:
|
|
2822
|
+
L: 124,
|
|
2854
2823
|
S: this,
|
|
2855
2824
|
A: [
|
|
2856
2825
|
"sheetId !== undefined",
|
|
@@ -2869,25 +2838,29 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2869
2838
|
return formula.replace(/['"]?([ \w]+)['"]?!/, (_match, name) => {
|
|
2870
2839
|
if (name) {
|
|
2871
2840
|
const objects = this._hf.getSheetNames().map((name2) => {
|
|
2872
|
-
const id =
|
|
2873
|
-
return id ? this._space?.db.getObjectById(id) : void 0;
|
|
2841
|
+
const { type, id } = parseSheetName(name2);
|
|
2842
|
+
return type && id ? this._space?.db.getObjectById(id) : void 0;
|
|
2874
2843
|
}).filter(import_util.nonNullable);
|
|
2875
2844
|
for (const obj of objects) {
|
|
2876
|
-
if (obj.name === name
|
|
2877
|
-
|
|
2845
|
+
if (obj.name === name) {
|
|
2846
|
+
const type = (0, import_echo_schema.getTypename)(obj);
|
|
2847
|
+
return `'${createSheetName({
|
|
2848
|
+
type,
|
|
2849
|
+
id: obj.id
|
|
2850
|
+
})}'!`;
|
|
2878
2851
|
}
|
|
2879
2852
|
}
|
|
2880
2853
|
}
|
|
2881
2854
|
return `${name}!`;
|
|
2882
2855
|
}).replace(/(\w+)\((.*)\)/g, (match, binding, args) => {
|
|
2883
|
-
const fn = this.
|
|
2856
|
+
const fn = this._remoteFunctions.find((fn2) => fn2.binding === binding);
|
|
2884
2857
|
if (!fn) {
|
|
2885
2858
|
return match;
|
|
2886
2859
|
}
|
|
2887
2860
|
if (args.trim() === "") {
|
|
2888
|
-
return `${
|
|
2861
|
+
return `${EDGE_FUNCTION_NAME}("${binding}")`;
|
|
2889
2862
|
} else {
|
|
2890
|
-
return `${
|
|
2863
|
+
return `${EDGE_FUNCTION_NAME}("${binding}", ${args})`;
|
|
2891
2864
|
}
|
|
2892
2865
|
});
|
|
2893
2866
|
}
|
|
@@ -2897,10 +2870,10 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2897
2870
|
*/
|
|
2898
2871
|
mapFunctionBindingToId(formula) {
|
|
2899
2872
|
return formula.replace(/(\w+)\((.*)\)/g, (match, binding, args) => {
|
|
2900
|
-
if (binding ===
|
|
2873
|
+
if (binding === EDGE_FUNCTION_NAME || defaultFunctions.find((fn2) => fn2.name === binding)) {
|
|
2901
2874
|
return match;
|
|
2902
2875
|
}
|
|
2903
|
-
const fn = this.
|
|
2876
|
+
const fn = this._remoteFunctions.find((fn2) => fn2.binding === binding);
|
|
2904
2877
|
if (fn) {
|
|
2905
2878
|
const id = (0, import_echo.fullyQualifiedId)(fn);
|
|
2906
2879
|
return `${id}(${args})`;
|
|
@@ -2919,7 +2892,7 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2919
2892
|
if (id.length !== OBJECT_ID_LENGTH) {
|
|
2920
2893
|
return match;
|
|
2921
2894
|
}
|
|
2922
|
-
const fn = this.
|
|
2895
|
+
const fn = this._remoteFunctions.find((fn2) => (0, import_echo.fullyQualifiedId)(fn2) === id);
|
|
2923
2896
|
if (fn?.binding) {
|
|
2924
2897
|
return `${fn.binding}(${args})`;
|
|
2925
2898
|
} else {
|
|
@@ -2931,22 +2904,96 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2931
2904
|
if (this._space) {
|
|
2932
2905
|
const query = this._space.db.query(import_echo.Filter.schema(import_types.FunctionType));
|
|
2933
2906
|
const unsubscribe = query.subscribe(({ objects }) => {
|
|
2934
|
-
this.
|
|
2935
|
-
this.update.emit(
|
|
2907
|
+
this._remoteFunctions = objects.filter(({ binding }) => binding);
|
|
2908
|
+
this.update.emit({
|
|
2909
|
+
type: "functionsUpdated"
|
|
2910
|
+
});
|
|
2936
2911
|
});
|
|
2937
2912
|
this._ctx.onDispose(unsubscribe);
|
|
2938
2913
|
}
|
|
2939
2914
|
}
|
|
2915
|
+
async _close() {
|
|
2916
|
+
for (const node of this._nodes.values()) {
|
|
2917
|
+
await node.close();
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
};
|
|
2921
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/graph/compute-graph-registry.ts";
|
|
2922
|
+
var defaultOptions = {
|
|
2923
|
+
licenseKey: "gpl-v3"
|
|
2924
|
+
};
|
|
2925
|
+
var defaultPlugins = [
|
|
2926
|
+
{
|
|
2927
|
+
plugin: EdgeFunctionPlugin,
|
|
2928
|
+
translations: EdgeFunctionPluginTranslations
|
|
2929
|
+
}
|
|
2930
|
+
];
|
|
2931
|
+
var ComputeGraphRegistry = class extends import_context3.Resource {
|
|
2932
|
+
constructor(options = {
|
|
2933
|
+
plugins: defaultPlugins
|
|
2934
|
+
}) {
|
|
2935
|
+
super();
|
|
2936
|
+
this._graphs = /* @__PURE__ */ new Map();
|
|
2937
|
+
this._options = (0, import_lodash2.default)({}, options, defaultOptions);
|
|
2938
|
+
this._options.plugins?.forEach(({ plugin, translations }) => {
|
|
2939
|
+
import_hyperformula5.HyperFormula.registerFunctionPlugin(plugin, translations);
|
|
2940
|
+
});
|
|
2941
|
+
}
|
|
2942
|
+
getGraph(spaceId) {
|
|
2943
|
+
return this._graphs.get(spaceId);
|
|
2944
|
+
}
|
|
2945
|
+
getOrCreateGraph(space) {
|
|
2946
|
+
let graph = this._graphs.get(space.id);
|
|
2947
|
+
if (!graph) {
|
|
2948
|
+
(0, import_log4.log)("create graph", {
|
|
2949
|
+
space: space.id
|
|
2950
|
+
}, {
|
|
2951
|
+
F: __dxlog_file4,
|
|
2952
|
+
L: 69,
|
|
2953
|
+
S: this,
|
|
2954
|
+
C: (f, a) => f(...a)
|
|
2955
|
+
});
|
|
2956
|
+
graph = this.createGraph(space);
|
|
2957
|
+
}
|
|
2958
|
+
return graph;
|
|
2959
|
+
}
|
|
2960
|
+
createGraph(space) {
|
|
2961
|
+
(0, import_invariant2.invariant)(!this._graphs.has(space.id), `ComputeGraph already exists for space: ${space.id}`, {
|
|
2962
|
+
F: __dxlog_file4,
|
|
2963
|
+
L: 77,
|
|
2964
|
+
S: this,
|
|
2965
|
+
A: [
|
|
2966
|
+
"!this._graphs.has(space.id)",
|
|
2967
|
+
"`ComputeGraph already exists for space: ${space.id}`"
|
|
2968
|
+
]
|
|
2969
|
+
});
|
|
2970
|
+
const hf = import_hyperformula5.HyperFormula.buildEmpty(this._options);
|
|
2971
|
+
const graph = new ComputeGraph(hf, space, this._options);
|
|
2972
|
+
this._graphs.set(space.id, graph);
|
|
2973
|
+
return graph;
|
|
2974
|
+
}
|
|
2975
|
+
async _close() {
|
|
2976
|
+
for (const graph of this._graphs.values()) {
|
|
2977
|
+
await graph.close();
|
|
2978
|
+
}
|
|
2979
|
+
this._graphs.clear();
|
|
2980
|
+
}
|
|
2940
2981
|
};
|
|
2941
2982
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2942
2983
|
0 && (module.exports = {
|
|
2984
|
+
AsyncFunctionPlugin,
|
|
2943
2985
|
ComputeGraph,
|
|
2944
2986
|
ComputeGraphRegistry,
|
|
2945
2987
|
ComputeNode,
|
|
2946
|
-
|
|
2988
|
+
EDGE_FUNCTION_NAME,
|
|
2989
|
+
EdgeFunctionPlugin,
|
|
2990
|
+
EdgeFunctionPluginTranslations,
|
|
2991
|
+
FunctionContext,
|
|
2947
2992
|
createSheetName,
|
|
2993
|
+
defaultFunctionContextOptions,
|
|
2948
2994
|
defaultFunctions,
|
|
2949
2995
|
defaultOptions,
|
|
2950
|
-
|
|
2996
|
+
defaultPlugins,
|
|
2997
|
+
parseSheetName
|
|
2951
2998
|
});
|
|
2952
|
-
//# sourceMappingURL=chunk-
|
|
2999
|
+
//# sourceMappingURL=chunk-5XPK2V4A.cjs.map
|