@dxos/compute 0.8.2-staging.7ac8446 → 0.8.2
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/{chunk-ZTFXLNX3.mjs → chunk-UGMCTYCW.mjs} +13 -22
- package/dist/lib/browser/chunk-UGMCTYCW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +2 -3
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-24ROUXYA.cjs → chunk-KCYHSFFU.cjs} +16 -25
- package/dist/lib/node/chunk-KCYHSFFU.cjs.map +7 -0
- package/dist/lib/node/index.cjs +26 -26
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +4 -5
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/{chunk-25OE2XBY.mjs → chunk-WIABMPQE.mjs} +13 -22
- package/dist/lib/node-esm/chunk-WIABMPQE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +2 -3
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/compute-graph-registry.d.ts.map +1 -1
- package/dist/types/src/compute-graph.d.ts.map +1 -1
- package/dist/types/src/compute-node.d.ts.map +1 -1
- package/dist/types/src/functions/async-function.d.ts.map +1 -1
- package/dist/types/src/functions/edge-function.d.ts.map +1 -1
- package/dist/types/src/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -19
- package/src/compute-graph-registry.ts +1 -1
- package/src/compute-graph.test.ts +3 -3
- package/src/compute-graph.ts +6 -6
- package/src/compute-node.ts +3 -3
- package/src/functions/async-function.ts +3 -3
- package/src/functions/edge-function.ts +5 -4
- package/src/testing/test-builder.ts +1 -1
- package/dist/lib/browser/chunk-ZTFXLNX3.mjs.map +0 -7
- package/dist/lib/node/chunk-24ROUXYA.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-25OE2XBY.mjs.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-function.d.ts","sourceRoot":"","sources":["../../../../src/functions/async-function.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAoC,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAQpG,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAExE,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;CAClD,CAAC;A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CAOpH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-function.d.ts","sourceRoot":"","sources":["../../../../src/functions/edge-function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edge-function.d.ts","sourceRoot":"","sources":["../../../../src/functions/edge-function.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAShE,OAAO,EAAsB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAIvC;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,mBAAmB;IACzD,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;CAqD9C;AAuBD,eAAO,MAAM,8BAA8B;;;;;;;CAO1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-builder.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,KAAK,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,EAAE,KAAK,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,mBAAmB,CAAC;AAGrE,qBAAa,WAAY,SAAQ,QAAQ;IAI3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAHrC,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,SAAS,CAAC,CAAuB;gBAEZ,QAAQ,GAAE,kBAAuB;IAI9D,IAAI,GAAG,IAAI,OAAO,CAEjB;IAED,IAAI,MAAM,IAAI,MAAM,CAGnB;IAED,IAAI,QAAQ,IAAI,oBAAoB,CAGnC;IAEc,KAAK;
|
|
1
|
+
{"version":3,"file":"test-builder.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,KAAK,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,EAAE,KAAK,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,mBAAmB,CAAC;AAGrE,qBAAa,WAAY,SAAQ,QAAQ;IAI3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAHrC,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,SAAS,CAAC,CAAuB;gBAEZ,QAAQ,GAAE,kBAAuB;IAI9D,IAAI,GAAG,IAAI,OAAO,CAEjB;IAED,IAAI,MAAM,IAAI,MAAM,CAGnB;IAED,IAAI,QAAQ,IAAI,oBAAoB,CAGnC;IAEc,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAkBtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC;AAExD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,WAAW,CAAA;CAAE,CAAC;AAEvE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE/D,eAAO,MAAM,cAAc,QAAmC,CAAC;AAE/D,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC;AAExD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,WAAW,CAAA;CAAE,CAAC;AAEvE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE/D,eAAO,MAAM,cAAc,QAAmC,CAAC;AAE/D,eAAO,MAAM,SAAS,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,MAA8D,CAAC;AAE/G,eAAO,MAAM,UAAU,GAAI,GAAG,WAAW,GAAG,SAAS,EAAE,GAAG,WAAW,GAAG,SAAS,YAEhF,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,MAM1C,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,cAAc,WAAW,KAAG,MAE/D,CAAC;AAGF,eAAO,MAAM,qBAAqB,GAAI,KAAK,MAAM,KAAG,WAOnD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,OAAO,SAAS,WAIjD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,KAAG,SAGjD,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,GAAG,SAAS,EAAE,MAAM,WAAW,KAAG,OAwBzE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,MAE/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.
|
|
1
|
+
{"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/compute",
|
|
3
|
-
"version": "0.8.2
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Low-level compute API",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -45,30 +45,34 @@
|
|
|
45
45
|
"src"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@preact/signals-core": "^1.
|
|
48
|
+
"@preact/signals-core": "^1.9.0",
|
|
49
|
+
"effect": "3.14.21",
|
|
49
50
|
"hyperformula": "^2.7.1",
|
|
50
51
|
"lodash.defaultsdeep": "^4.6.1",
|
|
51
|
-
"@dxos/async": "0.8.2
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/debug": "0.8.2
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/echo-schema": "0.8.2
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/keys": "0.8.2
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/schema": "0.8.2
|
|
64
|
-
"@dxos/util": "0.8.2
|
|
52
|
+
"@dxos/async": "0.8.2",
|
|
53
|
+
"@dxos/context": "0.8.2",
|
|
54
|
+
"@dxos/debug": "0.8.2",
|
|
55
|
+
"@dxos/client": "0.8.2",
|
|
56
|
+
"@dxos/echo-db": "0.8.2",
|
|
57
|
+
"@dxos/echo-schema": "0.8.2",
|
|
58
|
+
"@dxos/functions": "0.8.2",
|
|
59
|
+
"@dxos/keys": "0.8.2",
|
|
60
|
+
"@dxos/invariant": "0.8.2",
|
|
61
|
+
"@dxos/live-object": "0.8.2",
|
|
62
|
+
"@dxos/log": "0.8.2",
|
|
63
|
+
"@dxos/protocols": "0.8.2",
|
|
64
|
+
"@dxos/schema": "0.8.2",
|
|
65
|
+
"@dxos/util": "0.8.2"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
68
|
"@tldraw/indices": "^2.0.0-alpha.14",
|
|
68
69
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
69
|
-
"@dxos/echo-
|
|
70
|
-
"@dxos/echo-
|
|
71
|
-
"@dxos/random": "0.8.2
|
|
70
|
+
"@dxos/echo-db": "0.8.2",
|
|
71
|
+
"@dxos/echo-schema": "0.8.2",
|
|
72
|
+
"@dxos/random": "0.8.2"
|
|
73
|
+
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"effect": "^3.13.3"
|
|
72
76
|
},
|
|
73
77
|
"publishConfig": {
|
|
74
78
|
"access": "public"
|
|
@@ -6,8 +6,8 @@ import { type CellValue } from 'hyperformula';
|
|
|
6
6
|
import { afterEach, beforeEach, describe, expect, test } from 'vitest';
|
|
7
7
|
|
|
8
8
|
import { Trigger } from '@dxos/async';
|
|
9
|
-
import {
|
|
10
|
-
import { FunctionType } from '@dxos/functions
|
|
9
|
+
import { live, fullyQualifiedId } from '@dxos/client/echo';
|
|
10
|
+
import { FunctionType } from '@dxos/functions';
|
|
11
11
|
|
|
12
12
|
import { DetailedCellError } from '#hyperformula';
|
|
13
13
|
import { TestBuilder } from './testing';
|
|
@@ -30,7 +30,7 @@ describe('ComputeGraph', () => {
|
|
|
30
30
|
// Create script.
|
|
31
31
|
const trigger = new Trigger();
|
|
32
32
|
graph.update.once(() => trigger.wake());
|
|
33
|
-
const functionObject = space.db.add(
|
|
33
|
+
const functionObject = space.db.add(live(FunctionType, { name: 'test', version: '0.0.1', binding: 'TEST' }));
|
|
34
34
|
await trigger.wait();
|
|
35
35
|
const functions = graph.getFunctions({ echo: true });
|
|
36
36
|
expect(functions).to.toHaveLength(1);
|
package/src/compute-graph.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { type Space, Filter, fullyQualifiedId } from '@dxos/client/echo';
|
|
|
9
9
|
import { FQ_ID_LENGTH } from '@dxos/client/echo';
|
|
10
10
|
import { Resource } from '@dxos/context';
|
|
11
11
|
import { getTypename } from '@dxos/echo-schema';
|
|
12
|
-
import { FunctionType } from '@dxos/functions
|
|
12
|
+
import { FunctionType } from '@dxos/functions';
|
|
13
13
|
import { invariant } from '@dxos/invariant';
|
|
14
14
|
import { PublicKey } from '@dxos/keys';
|
|
15
15
|
import { log } from '@dxos/log';
|
|
@@ -196,7 +196,7 @@ export class ComputeGraph extends Resource {
|
|
|
196
196
|
* Map from binding to fully qualified ECHO ID (to store).
|
|
197
197
|
* E.g., HELLO() => spaceId:objectId()
|
|
198
198
|
*/
|
|
199
|
-
mapFunctionBindingToId(formula: string) {
|
|
199
|
+
mapFunctionBindingToId(formula: string): string {
|
|
200
200
|
return formula.replace(/(\w+)\((.*)\)/g, (match, binding, args) => {
|
|
201
201
|
if (binding === EDGE_FUNCTION_NAME || defaultFunctions.find((fn) => fn.name === binding)) {
|
|
202
202
|
return match;
|
|
@@ -216,7 +216,7 @@ export class ComputeGraph extends Resource {
|
|
|
216
216
|
* Map from fully qualified ECHO ID to binding (from store).
|
|
217
217
|
* E.g., spaceId:objectId() => HELLO()
|
|
218
218
|
*/
|
|
219
|
-
mapFunctionBindingFromId(formula: string) {
|
|
219
|
+
mapFunctionBindingFromId(formula: string): string | undefined {
|
|
220
220
|
const binding = formula.replace(/(\w+):([a-zA-Z0-9]+)\((.*)\)/g, (match, spaceId, objectId, args) => {
|
|
221
221
|
const id = `${spaceId}:${objectId}`;
|
|
222
222
|
if (id.length !== FQ_ID_LENGTH) {
|
|
@@ -238,10 +238,10 @@ export class ComputeGraph extends Resource {
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
protected override async _open() {
|
|
241
|
+
protected override async _open(): Promise<void> {
|
|
242
242
|
if (this._space) {
|
|
243
243
|
// Subscribe to remote function definitions.
|
|
244
|
-
const query = this._space.db.query(Filter.
|
|
244
|
+
const query = this._space.db.query(Filter.type(FunctionType));
|
|
245
245
|
const unsubscribe = query.subscribe(({ objects }) => {
|
|
246
246
|
this._remoteFunctions = objects.filter(({ binding }) => binding);
|
|
247
247
|
this.update.emit({ type: 'functionsUpdated' });
|
|
@@ -251,7 +251,7 @@ export class ComputeGraph extends Resource {
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
protected override async _close() {
|
|
254
|
+
protected override async _close(): Promise<void> {
|
|
255
255
|
for (const node of this._nodes.values()) {
|
|
256
256
|
await node.close();
|
|
257
257
|
}
|
package/src/compute-node.ts
CHANGED
|
@@ -35,7 +35,7 @@ export class ComputeNode extends Resource {
|
|
|
35
35
|
return this._graph;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
clear() {
|
|
38
|
+
clear(): void {
|
|
39
39
|
this._graph.hf.clearSheet(this.sheetId);
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -48,13 +48,13 @@ export class ComputeNode extends Resource {
|
|
|
48
48
|
return value;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
setValue(cell: CellAddress, value: CellScalarValue) {
|
|
51
|
+
setValue(cell: CellAddress, value: CellScalarValue): void {
|
|
52
52
|
const mappedValue = isFormula(value) ? this._graph.mapFormulaToNative(value) : value;
|
|
53
53
|
this._graph.hf.setCellContents({ sheet: this.sheetId, row: cell.row, col: cell.col }, [[mappedValue]]);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// TODO(burdon): Load data into sheet.
|
|
57
|
-
protected override async _open() {
|
|
57
|
+
protected override async _open(): Promise<void> {
|
|
58
58
|
// const unsubscribe = this._graph.update.on(this.update.emit);
|
|
59
59
|
// this._ctx.onDispose(unsubscribe);
|
|
60
60
|
}
|
|
@@ -54,7 +54,7 @@ export const defaultFunctionContextOptions: FunctionContextOptions = {
|
|
|
54
54
|
*/
|
|
55
55
|
export class FunctionContext {
|
|
56
56
|
// Mangle name with params.
|
|
57
|
-
static createInvocationKey(name: string, ...args: any) {
|
|
57
|
+
static createInvocationKey(name: string, ...args: any): string {
|
|
58
58
|
return JSON.stringify({ name, ...args });
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -102,14 +102,14 @@ export class FunctionContext {
|
|
|
102
102
|
return { cache: this._cache.size, invocations: this._invocations };
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
flush() {
|
|
105
|
+
flush(): void {
|
|
106
106
|
this._cache.clear();
|
|
107
107
|
this._invocations = {};
|
|
108
108
|
this._subscriptions.forEach((unsubscribe) => unsubscribe());
|
|
109
109
|
this._subscriptions.clear();
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
createSubscription(name: string, unsubscribe: CleanupFn) {
|
|
112
|
+
createSubscription(name: string, unsubscribe: CleanupFn): void {
|
|
113
113
|
this._subscriptions.get(name)?.();
|
|
114
114
|
this._subscriptions.set(name, unsubscribe);
|
|
115
115
|
}
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { effect } from '@preact/signals-core';
|
|
6
|
+
import { SchemaAST } from 'effect';
|
|
6
7
|
import { type InterpreterState } from 'hyperformula/typings/interpreter/InterpreterState';
|
|
7
8
|
import { type ProcedureAst } from 'hyperformula/typings/parser';
|
|
8
9
|
|
|
9
10
|
import { Filter, getMeta } from '@dxos/client/echo';
|
|
10
|
-
import {
|
|
11
|
-
import { FunctionType, getUserFunctionUrlInMetadata } from '@dxos/functions
|
|
11
|
+
import { toEffectSchema } from '@dxos/echo-schema';
|
|
12
|
+
import { FunctionType, getUserFunctionUrlInMetadata } from '@dxos/functions';
|
|
12
13
|
import { log } from '@dxos/log';
|
|
13
14
|
import { isNonNullable } from '@dxos/util';
|
|
14
15
|
|
|
@@ -35,7 +36,7 @@ export class EdgeFunctionPlugin extends AsyncFunctionPlugin {
|
|
|
35
36
|
|
|
36
37
|
const {
|
|
37
38
|
objects: [fn],
|
|
38
|
-
} = await space.db.query(Filter.
|
|
39
|
+
} = await space.db.query(Filter.type(FunctionType, { binding })).run();
|
|
39
40
|
if (!fn) {
|
|
40
41
|
log.info('Function not found', { binding });
|
|
41
42
|
return new CellError(ErrorType.REF, 'Function not found');
|
|
@@ -57,7 +58,7 @@ export class EdgeFunctionPlugin extends AsyncFunctionPlugin {
|
|
|
57
58
|
const body: Record<string, any> = {};
|
|
58
59
|
if (fn.inputSchema) {
|
|
59
60
|
const schema = toEffectSchema(fn.inputSchema);
|
|
60
|
-
|
|
61
|
+
SchemaAST.getPropertySignatures(schema.ast).forEach(({ name }, index) => {
|
|
61
62
|
body[name.toString()] = args[index];
|
|
62
63
|
});
|
|
63
64
|
} else {
|
|
@@ -33,7 +33,7 @@ export class TestBuilder extends Resource {
|
|
|
33
33
|
return this._registry;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
override async _open() {
|
|
36
|
+
override async _open(): Promise<void> {
|
|
37
37
|
const client = new Client(this._options);
|
|
38
38
|
await client.initialize();
|
|
39
39
|
await client.halo.createIdentity();
|