@dxos/plugin-sheet 0.6.12-main.c974201 → 0.6.12-main.f9d0246

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 (122) hide show
  1. package/dist/lib/browser/{SheetContainer-V4GCCZTX.mjs → SheetContainer-VISF3VUB.mjs} +6 -6
  2. package/dist/lib/browser/{SheetContainer-V4GCCZTX.mjs.map → SheetContainer-VISF3VUB.mjs.map} +3 -3
  3. package/dist/lib/browser/{chunk-T3NJFTD4.mjs → chunk-WZMOZKQZ.mjs} +2 -2
  4. package/dist/lib/browser/{chunk-T3NJFTD4.mjs.map → chunk-WZMOZKQZ.mjs.map} +3 -3
  5. package/dist/lib/browser/{chunk-6ZMQVB4Z.mjs → chunk-Z2XOOC2R.mjs} +81 -62
  6. package/dist/lib/browser/chunk-Z2XOOC2R.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-U2JHW3L6.mjs → chunk-ZLJ2GRE2.mjs} +173 -42
  8. package/dist/lib/browser/chunk-ZLJ2GRE2.mjs.map +7 -0
  9. package/dist/lib/browser/{graph-T27BOBOV.mjs → graph-4XFKIHRL.mjs} +4 -4
  10. package/dist/lib/browser/index.mjs +15 -13
  11. package/dist/lib/browser/index.mjs.map +3 -3
  12. package/dist/lib/browser/meta.json +1 -1
  13. package/dist/lib/browser/types.mjs +1 -1
  14. package/dist/lib/node/{SheetContainer-3ZY7MPWJ.cjs → SheetContainer-2MEALQWW.cjs} +14 -14
  15. package/dist/lib/node/{SheetContainer-3ZY7MPWJ.cjs.map → SheetContainer-2MEALQWW.cjs.map} +3 -3
  16. package/dist/lib/node/{chunk-OTTD7FBK.cjs → chunk-6DQABRGJ.cjs} +192 -60
  17. package/dist/lib/node/chunk-6DQABRGJ.cjs.map +7 -0
  18. package/dist/lib/node/{chunk-Q3HBHPRL.cjs → chunk-AOP42UAA.cjs} +5 -5
  19. package/dist/lib/node/{chunk-Q3HBHPRL.cjs.map → chunk-AOP42UAA.cjs.map} +3 -3
  20. package/dist/lib/node/{chunk-DD6FIXWC.cjs → chunk-P5QYYEHQ.cjs} +86 -67
  21. package/dist/lib/node/chunk-P5QYYEHQ.cjs.map +7 -0
  22. package/dist/lib/node/{graph-SPKGX7W4.cjs → graph-2LRDUXBZ.cjs} +14 -14
  23. package/dist/lib/node/graph-2LRDUXBZ.cjs.map +7 -0
  24. package/dist/lib/node/index.cjs +25 -24
  25. package/dist/lib/node/index.cjs.map +3 -3
  26. package/dist/lib/node/meta.json +1 -1
  27. package/dist/lib/node/types.cjs +8 -8
  28. package/dist/lib/node/types.cjs.map +1 -1
  29. package/dist/lib/node-esm/{SheetContainer-PXSJX6XK.mjs → SheetContainer-RPSUSXWS.mjs} +6 -6
  30. package/dist/lib/node-esm/{SheetContainer-PXSJX6XK.mjs.map → SheetContainer-RPSUSXWS.mjs.map} +3 -3
  31. package/dist/lib/node-esm/{chunk-D6KU5MI7.mjs → chunk-4MM7THJW.mjs} +81 -62
  32. package/dist/lib/node-esm/chunk-4MM7THJW.mjs.map +7 -0
  33. package/dist/lib/node-esm/{chunk-7HVSOTGA.mjs → chunk-5RLTCIE2.mjs} +173 -42
  34. package/dist/lib/node-esm/chunk-5RLTCIE2.mjs.map +7 -0
  35. package/dist/lib/node-esm/{chunk-BMNA27EX.mjs → chunk-RR2AO4SM.mjs} +2 -2
  36. package/dist/lib/node-esm/{chunk-BMNA27EX.mjs.map → chunk-RR2AO4SM.mjs.map} +3 -3
  37. package/dist/lib/node-esm/{graph-U67IO4UC.mjs → graph-WG5EKOMO.mjs} +4 -4
  38. package/dist/lib/node-esm/index.mjs +15 -13
  39. package/dist/lib/node-esm/index.mjs.map +3 -3
  40. package/dist/lib/node-esm/meta.json +1 -1
  41. package/dist/lib/node-esm/types.mjs +1 -1
  42. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  43. package/dist/types/src/components/GridSheet/GridSheet.d.ts +3 -3
  44. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  45. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +1 -1
  46. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
  47. package/dist/types/src/components/GridSheet/util.d.ts +3 -2
  48. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
  49. package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +1 -1
  50. package/dist/types/src/components/Sheet/sheet-context.d.ts +3 -3
  51. package/dist/types/src/components/Sheet/sheet-context.d.ts.map +1 -1
  52. package/dist/types/src/components/SheetContainer.d.ts +1 -1
  53. package/dist/types/src/components/index.d.ts +1 -1
  54. package/dist/types/src/defs/types.d.ts.map +1 -1
  55. package/dist/types/src/defs/util.d.ts +1 -1
  56. package/dist/types/src/defs/util.d.ts.map +1 -1
  57. package/dist/types/src/extensions/compute.d.ts +5 -1
  58. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  59. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
  60. package/dist/types/src/graph/async-function.d.ts +7 -1
  61. package/dist/types/src/graph/async-function.d.ts.map +1 -1
  62. package/dist/types/src/graph/compute-graph.d.ts +12 -9
  63. package/dist/types/src/graph/compute-graph.d.ts.map +1 -1
  64. package/dist/types/src/graph/compute-graph.stories.d.ts.map +1 -1
  65. package/dist/types/src/graph/compute-graph.test.d.ts +2 -0
  66. package/dist/types/src/graph/compute-graph.test.d.ts.map +1 -0
  67. package/dist/types/src/graph/compute-node.d.ts +9 -2
  68. package/dist/types/src/graph/compute-node.d.ts.map +1 -1
  69. package/dist/types/src/graph/edge-function.d.ts.map +1 -1
  70. package/dist/types/src/graph/{custom-function.d.ts → testing/custom-function.d.ts} +3 -1
  71. package/dist/types/src/graph/testing/custom-function.d.ts.map +1 -0
  72. package/dist/types/src/graph/testing/index.d.ts +2 -0
  73. package/dist/types/src/graph/testing/index.d.ts.map +1 -0
  74. package/dist/types/src/hooks/useComputeGraph.d.ts.map +1 -1
  75. package/dist/types/src/hooks/useSheetModel.d.ts +2 -2
  76. package/dist/types/src/hooks/useSheetModel.d.ts.map +1 -1
  77. package/dist/types/src/model/sheet-model.d.ts +3 -3
  78. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  79. package/dist/types/src/testing/testing.d.ts +4 -5
  80. package/dist/types/src/testing/testing.d.ts.map +1 -1
  81. package/dist/types/src/types.d.ts +4 -3
  82. package/dist/types/src/types.d.ts.map +1 -1
  83. package/package.json +33 -33
  84. package/src/SheetPlugin.tsx +9 -7
  85. package/src/components/CellEditor/CellEditor.stories.tsx +1 -1
  86. package/src/components/GridSheet/GridSheet.stories.tsx +5 -4
  87. package/src/components/GridSheet/GridSheet.tsx +6 -6
  88. package/src/components/GridSheet/util.ts +46 -27
  89. package/src/components/Sheet/Sheet.stories.tsx +21 -20
  90. package/src/components/Sheet/sheet-context.tsx +4 -4
  91. package/src/components/SheetContainer.tsx +2 -2
  92. package/src/defs/types.ts +1 -0
  93. package/src/defs/util.ts +19 -3
  94. package/src/extensions/compute.stories.tsx +18 -16
  95. package/src/extensions/compute.ts +72 -39
  96. package/src/graph/async-function.ts +13 -6
  97. package/src/graph/compute-graph.stories.tsx +4 -3
  98. package/src/graph/compute-graph.test.ts +127 -0
  99. package/src/graph/compute-graph.ts +64 -41
  100. package/src/graph/compute-node.ts +16 -5
  101. package/src/graph/edge-function.ts +1 -2
  102. package/src/graph/{custom-function.ts → testing/custom-function.ts} +10 -2
  103. package/src/graph/testing/index.ts +5 -0
  104. package/src/hooks/hooks.stories.tsx +3 -3
  105. package/src/hooks/useComputeGraph.ts +2 -1
  106. package/src/hooks/useSheetModel.ts +4 -7
  107. package/src/model/sheet-model.ts +44 -29
  108. package/src/testing/testing.tsx +17 -15
  109. package/src/types.ts +3 -3
  110. package/dist/lib/browser/chunk-6ZMQVB4Z.mjs.map +0 -7
  111. package/dist/lib/browser/chunk-U2JHW3L6.mjs.map +0 -7
  112. package/dist/lib/node/chunk-DD6FIXWC.cjs.map +0 -7
  113. package/dist/lib/node/chunk-OTTD7FBK.cjs.map +0 -7
  114. package/dist/lib/node/graph-SPKGX7W4.cjs.map +0 -7
  115. package/dist/lib/node-esm/chunk-7HVSOTGA.mjs.map +0 -7
  116. package/dist/lib/node-esm/chunk-D6KU5MI7.mjs.map +0 -7
  117. package/dist/types/src/graph/compute-graph.browser.test.d.ts +0 -2
  118. package/dist/types/src/graph/compute-graph.browser.test.d.ts.map +0 -1
  119. package/dist/types/src/graph/custom-function.d.ts.map +0 -1
  120. package/src/graph/compute-graph.browser.test.ts +0 -104
  121. /package/dist/lib/browser/{graph-T27BOBOV.mjs.map → graph-4XFKIHRL.mjs.map} +0 -0
  122. /package/dist/lib/node-esm/{graph-U67IO4UC.mjs.map → graph-WG5EKOMO.mjs.map} +0 -0
@@ -26,18 +26,19 @@ 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 chunk_DD6FIXWC_exports = {};
30
- __export(chunk_DD6FIXWC_exports, {
29
+ var chunk_P5QYYEHQ_exports = {};
30
+ __export(chunk_P5QYYEHQ_exports, {
31
31
  ComputeGraph: () => ComputeGraph,
32
32
  ComputeGraphRegistry: () => ComputeGraphRegistry,
33
33
  ComputeNode: () => ComputeNode,
34
- createComputeGraphRegistry: () => createComputeGraphRegistry,
35
34
  createSheetName: () => createSheetName,
36
35
  defaultFunctions: () => defaultFunctions,
37
36
  defaultOptions: () => defaultOptions,
37
+ defaultPlugins: () => defaultPlugins,
38
38
  getSheetId: () => getSheetId
39
39
  });
40
- module.exports = __toCommonJS(chunk_DD6FIXWC_exports);
40
+ module.exports = __toCommonJS(chunk_P5QYYEHQ_exports);
41
+ var import_lodash = __toESM(require("lodash.defaultsdeep"));
41
42
  var import_async = require("@dxos/async");
42
43
  var import_echo = require("@dxos/client/echo");
43
44
  var import_context = require("@dxos/context");
@@ -47,7 +48,7 @@ var import_log = require("@dxos/log");
47
48
  var import_types = require("@dxos/plugin-script/types");
48
49
  var import_util = require("@dxos/util");
49
50
  var import_hyperformula = require("#hyperformula");
50
- var import_lodash = __toESM(require("lodash.defaultsdeep"));
51
+ var import_lodash2 = __toESM(require("lodash.defaultsdeep"));
51
52
  var import_async2 = require("@dxos/async");
52
53
  var import_log2 = require("@dxos/log");
53
54
  var import_hyperformula2 = require("#hyperformula");
@@ -75,20 +76,19 @@ var FunctionContext = class _FunctionContext {
75
76
  ...args
76
77
  });
77
78
  }
78
- constructor(_hf, _space, onUpdate, _options) {
79
+ constructor(_hf, _space, _options) {
79
80
  this._hf = _hf;
80
81
  this._space = _space;
81
82
  this._cache = /* @__PURE__ */ new Map();
82
83
  this._pending = /* @__PURE__ */ new Map();
83
84
  this._subscriptions = /* @__PURE__ */ new Map();
84
85
  this._invocations = {};
85
- this._options = (0, import_lodash.default)(_options ?? {}, defaultFunctionContextOptions);
86
- this._onUpdate = (0, import_async2.debounce)(() => {
86
+ this._options = (0, import_lodash2.default)(_options ?? {}, defaultFunctionContextOptions);
87
+ this._onUpdate = (0, import_async2.debounce)((update) => {
87
88
  this._hf.resumeEvaluation();
88
- onUpdate(this);
89
+ this._options.onUpdate?.(update);
89
90
  }, this._options.recalculationDelay);
90
91
  }
91
- // TODO(burdon): Remove?
92
92
  get space() {
93
93
  return this._space;
94
94
  }
@@ -137,18 +137,21 @@ var FunctionContext = class _FunctionContext {
137
137
  value: value2
138
138
  }, {
139
139
  F: __dxlog_file,
140
- L: 138,
140
+ L: 145,
141
141
  S: this,
142
142
  C: (f, a) => f(...a)
143
143
  });
144
- this._onUpdate();
144
+ this._onUpdate({
145
+ name,
146
+ cell
147
+ });
145
148
  } catch (err) {
146
149
  import_log2.log.warn("failed", {
147
150
  cell,
148
151
  err
149
152
  }, {
150
153
  F: __dxlog_file,
151
- L: 142,
154
+ L: 149,
152
155
  S: this,
153
156
  C: (f, a) => f(...a)
154
157
  });
@@ -168,7 +171,7 @@ var FunctionContext = class _FunctionContext {
168
171
  cache: value
169
172
  }, {
170
173
  F: __dxlog_file,
171
- L: 150,
174
+ L: 157,
172
175
  S: this,
173
176
  C: (f, a) => f(...a)
174
177
  });
@@ -194,12 +197,11 @@ var ComputeNode = class extends import_context2.Resource {
194
197
  this.sheetId = sheetId;
195
198
  this.update = new import_async3.Event();
196
199
  }
197
- // TODO(burdon): Remove?
198
200
  get graph() {
199
201
  return this._graph;
200
202
  }
201
- get hf() {
202
- return this._graph.hf;
203
+ clear() {
204
+ this._graph.hf.clearSheet(this.sheetId);
203
205
  }
204
206
  getValue(cell) {
205
207
  const value = this._graph.hf.getCellValue({
@@ -224,6 +226,8 @@ var ComputeNode = class extends import_context2.Resource {
224
226
  ]
225
227
  ]);
226
228
  }
229
+ async _open() {
230
+ }
227
231
  };
228
232
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/graph/edge-function.ts";
229
233
  var EDGE_FUNCTION_TTL = 1e4;
@@ -290,11 +294,7 @@ EdgeFunctionPlugin.implementedFunctions = {
290
294
  {
291
295
  argumentType: import_hyperformula4.FunctionArgumentType.STRING
292
296
  },
293
- // Remote function arguments (currently supporting up to 9).
294
- {
295
- argumentType: import_hyperformula4.FunctionArgumentType.ANY,
296
- optionalArg: true
297
- },
297
+ // Remote function arguments (currently supporting up to 8).
298
298
  {
299
299
  argumentType: import_hyperformula4.FunctionArgumentType.ANY,
300
300
  optionalArg: true
@@ -2715,34 +2715,30 @@ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/s
2715
2715
  var OBJECT_ID_LENGTH = 60;
2716
2716
  var CUSTOM_FUNCTION = "ECHO";
2717
2717
  var defaultOptions = {
2718
- licenseKey: "gpl-v3",
2719
- plugins: [
2720
- {
2721
- plugin: EdgeFunctionPlugin,
2722
- translations: EdgeFunctionPluginTranslations
2723
- }
2724
- ]
2718
+ licenseKey: "gpl-v3"
2725
2719
  };
2720
+ var defaultPlugins = [
2721
+ {
2722
+ plugin: EdgeFunctionPlugin,
2723
+ translations: EdgeFunctionPluginTranslations
2724
+ }
2725
+ ];
2726
2726
  var PREFIX = "__";
2727
2727
  var createSheetName = (id) => `${PREFIX}${id}`;
2728
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
2729
  var ComputeGraphRegistry = class extends import_context.Resource {
2736
- constructor(_options = defaultOptions) {
2730
+ constructor(options = {
2731
+ plugins: defaultPlugins
2732
+ }) {
2737
2733
  super();
2738
- this._options = _options;
2739
- this._registry = /* @__PURE__ */ new Map();
2734
+ this._graphs = /* @__PURE__ */ new Map();
2735
+ this._options = (0, import_lodash.default)({}, options, defaultOptions);
2740
2736
  this._options.plugins?.forEach(({ plugin, translations }) => {
2741
2737
  import_hyperformula.HyperFormula.registerFunctionPlugin(plugin, translations);
2742
2738
  });
2743
2739
  }
2744
2740
  getGraph(spaceId) {
2745
- return this._registry.get(spaceId);
2741
+ return this._graphs.get(spaceId);
2746
2742
  }
2747
2743
  async getOrCreateGraph(space) {
2748
2744
  let graph = this.getGraph(space.id);
@@ -2751,7 +2747,7 @@ var ComputeGraphRegistry = class extends import_context.Resource {
2751
2747
  space: space.id
2752
2748
  }, {
2753
2749
  F: __dxlog_file3,
2754
- L: 95,
2750
+ L: 93,
2755
2751
  S: this,
2756
2752
  C: (f, a) => f(...a)
2757
2753
  });
@@ -2760,21 +2756,26 @@ var ComputeGraphRegistry = class extends import_context.Resource {
2760
2756
  return graph;
2761
2757
  }
2762
2758
  async createGraph(space) {
2763
- (0, import_invariant.invariant)(!this._registry.has(space.id), `ComputeGraph already exists for space: ${space.id}`, {
2759
+ (0, import_invariant.invariant)(!this._graphs.has(space.id), `ComputeGraph already exists for space: ${space.id}`, {
2764
2760
  F: __dxlog_file3,
2765
- L: 103,
2761
+ L: 101,
2766
2762
  S: this,
2767
2763
  A: [
2768
- "!this._registry.has(space.id)",
2764
+ "!this._graphs.has(space.id)",
2769
2765
  "`ComputeGraph already exists for space: ${space.id}`"
2770
2766
  ]
2771
2767
  });
2772
2768
  const hf = import_hyperformula.HyperFormula.buildEmpty(this._options);
2773
2769
  const graph = new ComputeGraph(hf, space, this._options);
2774
- await graph.open(this._ctx);
2775
- this._registry.set(space.id, graph);
2770
+ this._graphs.set(space.id, graph);
2771
+ await graph.open();
2776
2772
  return graph;
2777
2773
  }
2774
+ async _close() {
2775
+ for (const graph of this._graphs.values()) {
2776
+ await graph.close();
2777
+ }
2778
+ }
2778
2779
  };
2779
2780
  var ComputeGraph = class extends import_context.Resource {
2780
2781
  constructor(_hf, _space, _options) {
@@ -2785,28 +2786,39 @@ var ComputeGraph = class extends import_context.Resource {
2785
2786
  this.id = `graph-${import_keys.PublicKey.random().truncate()}`;
2786
2787
  this._nodes = /* @__PURE__ */ new Map();
2787
2788
  this._functions = [];
2788
- this.context = new FunctionContext(this._hf, this._space, this.refresh.bind(this), this._options);
2789
2789
  this.update = new import_async.Event();
2790
+ this.context = new FunctionContext(this._hf, this._space, this._options);
2790
2791
  this._hf.updateConfig({
2791
2792
  context: this.context
2792
2793
  });
2794
+ const onValuesUpdate = (changes) => {
2795
+ for (const change of changes) {
2796
+ if (change instanceof import_hyperformula.ExportedCellChange) {
2797
+ const { sheet } = change;
2798
+ const node = this._nodes.get(sheet);
2799
+ if (node) {
2800
+ node.update.emit({
2801
+ type: "valuesUpdated",
2802
+ change
2803
+ });
2804
+ }
2805
+ }
2806
+ }
2807
+ };
2808
+ this._hf.on("valuesUpdated", onValuesUpdate);
2809
+ this._ctx.onDispose(() => this._hf.off("valuesUpdated", onValuesUpdate));
2793
2810
  }
2794
- // TODO(burdon): Remove.
2795
2811
  get hf() {
2796
2812
  return this._hf;
2797
2813
  }
2798
- refresh() {
2799
- (0, import_log.log)("refresh", {
2800
- id: this.id
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 } = {}) {
2814
+ // refresh() {
2815
+ // log('refresh', { id: this.id });
2816
+ // this.update.emit();
2817
+ // }
2818
+ getFunctions({ standard, echo } = {
2819
+ standard: true,
2820
+ echo: true
2821
+ }) {
2810
2822
  return [
2811
2823
  ...standard ? this._hf.getRegisteredFunctionNames().map((name) => defaultFunctions.find((fn) => fn.name === name) ?? {
2812
2824
  name
@@ -2824,10 +2836,10 @@ var ComputeGraph = class extends import_context.Resource {
2824
2836
  // This would enable on-the-fly instantiation of new models when then are referenced.
2825
2837
  // E.g., Cross-object reference would be stored as "ObjectId!A1"
2826
2838
  // The graph would then load the object and create a ComputeNode (model) of the appropriate type.
2827
- getOrCreateNode(name) {
2839
+ async getOrCreateNode(name) {
2828
2840
  (0, import_invariant.invariant)(name.length, void 0, {
2829
2841
  F: __dxlog_file3,
2830
- L: 176,
2842
+ L: 193,
2831
2843
  S: this,
2832
2844
  A: [
2833
2845
  "name.length",
@@ -2840,17 +2852,16 @@ var ComputeGraph = class extends import_context.Resource {
2840
2852
  name
2841
2853
  }, {
2842
2854
  F: __dxlog_file3,
2843
- L: 178,
2855
+ L: 195,
2844
2856
  S: this,
2845
2857
  C: (f, a) => f(...a)
2846
2858
  });
2847
2859
  this._hf.addSheet(name);
2848
- this.update.emit();
2849
2860
  }
2850
2861
  const sheetId = this._hf.getSheetId(name);
2851
2862
  (0, import_invariant.invariant)(sheetId !== void 0, void 0, {
2852
2863
  F: __dxlog_file3,
2853
- L: 184,
2864
+ L: 201,
2854
2865
  S: this,
2855
2866
  A: [
2856
2867
  "sheetId !== undefined",
@@ -2858,6 +2869,7 @@ var ComputeGraph = class extends import_context.Resource {
2858
2869
  ]
2859
2870
  });
2860
2871
  const node = new ComputeNode(this, sheetId);
2872
+ await node.open();
2861
2873
  this._nodes.set(sheetId, node);
2862
2874
  return node;
2863
2875
  }
@@ -2932,21 +2944,28 @@ var ComputeGraph = class extends import_context.Resource {
2932
2944
  const query = this._space.db.query(import_echo.Filter.schema(import_types.FunctionType));
2933
2945
  const unsubscribe = query.subscribe(({ objects }) => {
2934
2946
  this._functions = objects.filter(({ binding }) => binding);
2935
- this.update.emit();
2947
+ this.update.emit({
2948
+ type: "functionsUpdated"
2949
+ });
2936
2950
  });
2937
2951
  this._ctx.onDispose(unsubscribe);
2938
2952
  }
2939
2953
  }
2954
+ async _close() {
2955
+ for (const node of this._nodes.values()) {
2956
+ await node.close();
2957
+ }
2958
+ }
2940
2959
  };
2941
2960
  // Annotate the CommonJS export names for ESM import in node:
2942
2961
  0 && (module.exports = {
2943
2962
  ComputeGraph,
2944
2963
  ComputeGraphRegistry,
2945
2964
  ComputeNode,
2946
- createComputeGraphRegistry,
2947
2965
  createSheetName,
2948
2966
  defaultFunctions,
2949
2967
  defaultOptions,
2968
+ defaultPlugins,
2950
2969
  getSheetId
2951
2970
  });
2952
- //# sourceMappingURL=chunk-DD6FIXWC.cjs.map
2971
+ //# sourceMappingURL=chunk-P5QYYEHQ.cjs.map