@dxos/compute 0.8.4-main.84f28bd → 0.8.4-main.a4bbb77
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-2PBHA7EI.mjs → chunk-XQYPCRZP.mjs} +143 -81
- package/dist/lib/browser/chunk-XQYPCRZP.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 +19 -6
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-GTPQNWA3.mjs → chunk-2XWWSGAU.mjs} +143 -81
- package/dist/lib/node-esm/chunk-2XWWSGAU.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 +19 -6
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/compute-graph-registry.d.ts +2 -4
- package/dist/types/src/compute-graph-registry.d.ts.map +1 -1
- package/dist/types/src/compute-graph.d.ts +1 -1
- package/dist/types/src/compute-graph.d.ts.map +1 -1
- package/dist/types/src/compute-node.d.ts +1 -2
- package/dist/types/src/compute-node.d.ts.map +1 -1
- package/dist/types/src/functions/async-function.d.ts +6 -6
- package/dist/types/src/functions/async-function.d.ts.map +1 -1
- package/dist/types/src/functions/edge-function.d.ts +3 -3
- package/dist/types/src/functions/edge-function.d.ts.map +1 -1
- package/dist/types/src/testing/test-plugin.d.ts +4 -5
- package/dist/types/src/testing/test-plugin.d.ts.map +1 -1
- package/dist/types/src/types/hyperformula.d.ts +3 -6
- package/dist/types/src/types/hyperformula.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -28
- package/src/compute-graph-registry.ts +3 -5
- package/src/compute-graph.test.ts +2 -2
- package/src/compute-graph.ts +5 -6
- package/src/compute-node.ts +2 -4
- package/src/functions/async-function.ts +12 -8
- package/src/functions/edge-function.ts +6 -6
- package/src/hyperformula.test.ts +2 -2
- package/src/testing/test-plugin.ts +2 -4
- package/src/testing/util.ts +1 -1
- package/src/types/hyperformula.ts +8 -8
- package/src/types/types.test.ts +2 -2
- package/dist/lib/browser/chunk-2PBHA7EI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GTPQNWA3.mjs.map +0 -7
- package/dist/vendor/hyperformula.mjs +0 -36400
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/compute",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.a4bbb77",
|
|
4
4
|
"description": "Low-level compute API",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -8,19 +8,15 @@
|
|
|
8
8
|
"author": "DXOS.org",
|
|
9
9
|
"sideEffects": true,
|
|
10
10
|
"type": "module",
|
|
11
|
-
"imports": {
|
|
12
|
-
"#hyperformula": {
|
|
13
|
-
"types": "hyperformula",
|
|
14
|
-
"default": "./dist/vendor/hyperformula.mjs"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
11
|
"exports": {
|
|
18
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
19
14
|
"types": "./dist/types/src/index.d.ts",
|
|
20
15
|
"browser": "./dist/lib/browser/index.mjs",
|
|
21
16
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
22
17
|
},
|
|
23
18
|
"./testing": {
|
|
19
|
+
"source": "./src/testing/index.ts",
|
|
24
20
|
"types": "./dist/types/src/testing/index.d.ts",
|
|
25
21
|
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
26
22
|
"node": "./dist/lib/node-esm/testing/index.mjs"
|
|
@@ -39,32 +35,32 @@
|
|
|
39
35
|
"src"
|
|
40
36
|
],
|
|
41
37
|
"dependencies": {
|
|
42
|
-
"@preact/signals-core": "^1.
|
|
43
|
-
"effect": "3.
|
|
44
|
-
"hyperformula": "^2.7.1",
|
|
38
|
+
"@preact/signals-core": "^1.12.1",
|
|
39
|
+
"effect": "3.18.3",
|
|
45
40
|
"lodash.defaultsdeep": "^4.6.1",
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/echo": "0.8.4-main.
|
|
51
|
-
"@dxos/echo-
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
41
|
+
"@dxos/client": "0.8.4-main.a4bbb77",
|
|
42
|
+
"@dxos/async": "0.8.4-main.a4bbb77",
|
|
43
|
+
"@dxos/debug": "0.8.4-main.a4bbb77",
|
|
44
|
+
"@dxos/context": "0.8.4-main.a4bbb77",
|
|
45
|
+
"@dxos/echo-db": "0.8.4-main.a4bbb77",
|
|
46
|
+
"@dxos/echo-schema": "0.8.4-main.a4bbb77",
|
|
47
|
+
"@dxos/functions": "0.8.4-main.a4bbb77",
|
|
48
|
+
"@dxos/invariant": "0.8.4-main.a4bbb77",
|
|
49
|
+
"@dxos/keys": "0.8.4-main.a4bbb77",
|
|
50
|
+
"@dxos/live-object": "0.8.4-main.a4bbb77",
|
|
51
|
+
"@dxos/log": "0.8.4-main.a4bbb77",
|
|
52
|
+
"@dxos/protocols": "0.8.4-main.a4bbb77",
|
|
53
|
+
"@dxos/schema": "0.8.4-main.a4bbb77",
|
|
54
|
+
"@dxos/util": "0.8.4-main.a4bbb77",
|
|
55
|
+
"@dxos/vendor-hyperformula": "0.8.4-main.a4bbb77",
|
|
56
|
+
"@dxos/echo": "0.8.4-main.a4bbb77"
|
|
61
57
|
},
|
|
62
58
|
"devDependencies": {
|
|
63
59
|
"@tldraw/indices": "^2.0.0-alpha.14",
|
|
64
60
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
65
|
-
"@dxos/echo-
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
61
|
+
"@dxos/echo-schema": "0.8.4-main.a4bbb77",
|
|
62
|
+
"@dxos/echo-db": "0.8.4-main.a4bbb77",
|
|
63
|
+
"@dxos/random": "0.8.4-main.a4bbb77"
|
|
68
64
|
},
|
|
69
65
|
"peerDependencies": {
|
|
70
66
|
"effect": "^3.13.3"
|
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import type { FunctionPluginDefinition } from 'hyperformula';
|
|
6
|
-
import type { ConfigParams } from 'hyperformula/typings/ConfigParams';
|
|
7
|
-
import type { FunctionTranslationsPackage } from 'hyperformula/typings/interpreter';
|
|
8
5
|
import defaultsDeep from 'lodash.defaultsdeep';
|
|
9
6
|
|
|
10
|
-
import { type
|
|
7
|
+
import { type Space, type SpaceId } from '@dxos/client/echo';
|
|
11
8
|
import { Resource } from '@dxos/context';
|
|
12
9
|
import { invariant } from '@dxos/invariant';
|
|
13
10
|
import { log } from '@dxos/log';
|
|
11
|
+
import type { ConfigParams, FunctionPluginDefinition, FunctionTranslationsPackage } from '@dxos/vendor-hyperformula';
|
|
12
|
+
import { HyperFormula } from '@dxos/vendor-hyperformula';
|
|
14
13
|
|
|
15
|
-
import { HyperFormula } from '#hyperformula';
|
|
16
14
|
import { ComputeGraph } from './compute-graph';
|
|
17
15
|
import { EdgeFunctionPlugin, EdgeFunctionPluginTranslations, type FunctionContextOptions } from './functions';
|
|
18
16
|
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type CellValue } from 'hyperformula';
|
|
6
5
|
import { afterEach, beforeEach, describe, expect, test } from 'vitest';
|
|
7
6
|
|
|
8
7
|
import { Trigger } from '@dxos/async';
|
|
9
8
|
import { fullyQualifiedId } from '@dxos/client/echo';
|
|
10
9
|
import { Obj } from '@dxos/echo';
|
|
11
10
|
import { FunctionType } from '@dxos/functions';
|
|
11
|
+
import { type CellValue } from '@dxos/vendor-hyperformula';
|
|
12
|
+
import { DetailedCellError } from '@dxos/vendor-hyperformula';
|
|
12
13
|
|
|
13
|
-
import { DetailedCellError } from '#hyperformula';
|
|
14
14
|
import { TestBuilder } from './testing';
|
|
15
15
|
|
|
16
16
|
describe('ComputeGraph', () => {
|
package/src/compute-graph.ts
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Listeners } from 'hyperformula/typings/Emitter';
|
|
6
|
-
|
|
7
5
|
import { Event } from '@dxos/async';
|
|
8
|
-
import { type Space,
|
|
6
|
+
import { Filter, type Space, fullyQualifiedId } from '@dxos/client/echo';
|
|
9
7
|
import { FQ_ID_LENGTH } from '@dxos/client/echo';
|
|
10
8
|
import { Resource } from '@dxos/context';
|
|
11
9
|
import { getTypename } from '@dxos/echo-schema';
|
|
@@ -14,15 +12,16 @@ import { invariant } from '@dxos/invariant';
|
|
|
14
12
|
import { PublicKey } from '@dxos/keys';
|
|
15
13
|
import { log } from '@dxos/log';
|
|
16
14
|
import { isNonNullable } from '@dxos/util';
|
|
15
|
+
import { type Listeners } from '@dxos/vendor-hyperformula';
|
|
16
|
+
import { ExportedCellChange, type HyperFormula } from '@dxos/vendor-hyperformula';
|
|
17
17
|
|
|
18
|
-
import { ExportedCellChange, type HyperFormula } from '#hyperformula';
|
|
19
18
|
import { ComputeNode } from './compute-node';
|
|
20
19
|
import {
|
|
21
|
-
|
|
20
|
+
EDGE_FUNCTION_NAME,
|
|
22
21
|
FunctionContext,
|
|
23
22
|
type FunctionContextOptions,
|
|
24
23
|
type FunctionDefinition,
|
|
25
|
-
|
|
24
|
+
defaultFunctions,
|
|
26
25
|
} from './functions';
|
|
27
26
|
|
|
28
27
|
// TODO(burdon): Factor out compute-graph.
|
package/src/compute-node.ts
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Listeners } from 'hyperformula/typings/Emitter';
|
|
6
|
-
import { type ExportedCellChange } from 'hyperformula/typings/Exporter';
|
|
7
|
-
|
|
8
5
|
import { Event } from '@dxos/async';
|
|
9
6
|
import { Resource } from '@dxos/context';
|
|
7
|
+
import { type ExportedCellChange, type Listeners } from '@dxos/vendor-hyperformula';
|
|
8
|
+
import { DetailedCellError } from '@dxos/vendor-hyperformula';
|
|
10
9
|
|
|
11
|
-
import { DetailedCellError } from '#hyperformula';
|
|
12
10
|
import { type ComputeGraph } from './compute-graph';
|
|
13
11
|
import { type CellAddress, type CellScalarValue, isFormula } from './types';
|
|
14
12
|
|
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type SimpleCellAddress } from 'hyperformula/typings/Cell';
|
|
6
|
-
import { type InterpreterState } from 'hyperformula/typings/interpreter/InterpreterState';
|
|
7
|
-
import { type InterpreterValue } from 'hyperformula/typings/interpreter/InterpreterValue';
|
|
8
|
-
import { type ProcedureAst } from 'hyperformula/typings/parser';
|
|
9
5
|
import defaultsDeep from 'lodash.defaultsdeep';
|
|
10
6
|
|
|
11
|
-
import {
|
|
7
|
+
import { type CleanupFn, debounce } from '@dxos/async';
|
|
12
8
|
import { type Space } from '@dxos/client/echo';
|
|
13
9
|
import { log } from '@dxos/log';
|
|
14
|
-
|
|
15
|
-
import {
|
|
10
|
+
import { type RawInterpreterValue, type SimpleCellAddress } from '@dxos/vendor-hyperformula';
|
|
11
|
+
import { type InterpreterState } from '@dxos/vendor-hyperformula';
|
|
12
|
+
import { type InterpreterValue } from '@dxos/vendor-hyperformula';
|
|
13
|
+
import { type ProcedureAst } from '@dxos/vendor-hyperformula';
|
|
14
|
+
import { CellError, EmptyValue, ErrorType, FunctionPlugin, type HyperFormula } from '@dxos/vendor-hyperformula';
|
|
16
15
|
|
|
17
16
|
// TODO(burdon): Create API gateways:
|
|
18
17
|
// https://publicapis.io
|
|
@@ -169,7 +168,12 @@ export class AsyncFunctionPlugin extends FunctionPlugin {
|
|
|
169
168
|
/**
|
|
170
169
|
* Immediately returns cached value then runs the async function.
|
|
171
170
|
*/
|
|
172
|
-
protected runAsyncFunction(
|
|
171
|
+
protected runAsyncFunction(
|
|
172
|
+
ast: ProcedureAst,
|
|
173
|
+
state: InterpreterState,
|
|
174
|
+
cb: AsyncFunction,
|
|
175
|
+
options?: FunctionOptions,
|
|
176
|
+
): RawInterpreterValue {
|
|
173
177
|
const { procedureName } = ast;
|
|
174
178
|
const metadata = this.metadata(procedureName);
|
|
175
179
|
return this.runFunction(ast.args, state, metadata, (...args: any) => {
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import { effect } from '@preact/signals-core';
|
|
6
6
|
import { SchemaAST } from 'effect';
|
|
7
|
-
import { type InterpreterState } from 'hyperformula/typings/interpreter/InterpreterState';
|
|
8
|
-
import { type ProcedureAst } from 'hyperformula/typings/parser';
|
|
9
7
|
|
|
10
8
|
import { Filter, getMeta } from '@dxos/client/echo';
|
|
11
9
|
import { toEffectSchema } from '@dxos/echo-schema';
|
|
12
|
-
import { FunctionType,
|
|
10
|
+
import { FunctionType, getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
13
11
|
import { log } from '@dxos/log';
|
|
14
12
|
import { isNonNullable } from '@dxos/util';
|
|
13
|
+
import { type ProcedureAst } from '@dxos/vendor-hyperformula';
|
|
14
|
+
import { type InterpreterState } from '@dxos/vendor-hyperformula';
|
|
15
|
+
import { CellError, ErrorType, FunctionArgumentType } from '@dxos/vendor-hyperformula';
|
|
15
16
|
|
|
16
|
-
import { CellError, ErrorType, FunctionArgumentType } from '#hyperformula';
|
|
17
17
|
import { type AsyncFunction, AsyncFunctionPlugin } from './async-function';
|
|
18
18
|
|
|
19
19
|
export const EDGE_FUNCTION_NAME = 'DX';
|
|
@@ -64,8 +64,8 @@ export class EdgeFunctionPlugin extends AsyncFunctionPlugin {
|
|
|
64
64
|
} else {
|
|
65
65
|
body.args = args.filter(isNonNullable);
|
|
66
66
|
}
|
|
67
|
-
const
|
|
68
|
-
const response = await fetch(`${this.context.remoteFunctionUrl}
|
|
67
|
+
const id = getUserFunctionIdInMetadata(getMeta(fn));
|
|
68
|
+
const response = await fetch(`${this.context.remoteFunctionUrl}/${id}`, {
|
|
69
69
|
method: 'POST',
|
|
70
70
|
headers: { 'Content-Type': 'application/json' },
|
|
71
71
|
body: JSON.stringify(body),
|
package/src/hyperformula.test.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { describe,
|
|
5
|
+
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
|
-
import { HyperFormula } from '
|
|
7
|
+
import { HyperFormula } from '@dxos/vendor-hyperformula';
|
|
8
8
|
|
|
9
9
|
describe('hyperformula', () => {
|
|
10
10
|
test('sanity test', async () => {
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type InterpreterState } from 'hyperformula/typings/interpreter/InterpreterState';
|
|
6
|
-
import { type ProcedureAst } from 'hyperformula/typings/parser';
|
|
7
|
-
|
|
8
5
|
import { getDeep } from '@dxos/util';
|
|
6
|
+
import { type InterpreterState, type ProcedureAst } from '@dxos/vendor-hyperformula';
|
|
7
|
+
import { FunctionArgumentType } from '@dxos/vendor-hyperformula';
|
|
9
8
|
|
|
10
|
-
import { FunctionArgumentType } from '#hyperformula';
|
|
11
9
|
import { type ComputeGraphPlugin } from '../compute-graph-registry';
|
|
12
10
|
import { type AsyncFunction, AsyncFunctionPlugin } from '../functions';
|
|
13
11
|
import { parseNumberString } from '../util';
|
package/src/testing/util.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { HyperFormula } from 'hyperformula';
|
|
5
|
+
import { HyperFormula } from '@dxos/vendor-hyperformula';
|
|
6
6
|
|
|
7
7
|
export const getRegisteredFunctionNames = () => {
|
|
8
8
|
return HyperFormula.buildEmpty({ licenseKey: 'gpl-v3' }).getRegisteredFunctionNames();
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import {
|
|
6
|
+
type SimpleCellAddress,
|
|
7
|
+
type SimpleCellRange,
|
|
8
|
+
type SimpleDate,
|
|
9
|
+
type SimpleDateTime,
|
|
10
|
+
} from '@dxos/vendor-hyperformula';
|
|
11
|
+
import { DetailedCellError, ExportedCellChange } from '@dxos/vendor-hyperformula';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
* so we pre-bundle hyperformula and place it in the vendor directory of this package.
|
|
14
|
+
* Re-exported from vendored hyperformula package.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export { DetailedCellError, ExportedCellChange };
|
package/src/types/types.test.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { getIndices,
|
|
5
|
+
import { getIndices, getIndicesAbove, getIndicesBelow, getIndicesBetween, sortByIndex } from '@tldraw/indices';
|
|
6
6
|
import { describe, expect, test } from 'vitest';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { addressFromA1Notation, addressToA1Notation, inRange, rangeFromA1Notation, rangeToA1Notation } from './types';
|
|
9
9
|
|
|
10
10
|
describe('cell', () => {
|
|
11
11
|
test('posToA1Notation', () => {
|