@dxos/plugin-debug 0.8.4-main.3eb6e50203 → 0.8.4-main.3fbcb4aa9b
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/DebugGraph-6VMEOKEV.mjs → neutral/DebugGraph-G4FWS57E.mjs} +5 -5
- package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs.map +7 -0
- package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs +59 -0
- package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.mjs +47 -0
- package/dist/lib/neutral/DebugPlugin.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.node.mjs +18 -0
- package/dist/lib/neutral/DebugPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs +224 -0
- package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs.map +7 -0
- package/dist/lib/neutral/DebugSpaceObjectsPanel-NISULU6U.mjs +34 -0
- package/dist/lib/neutral/DebugSpaceObjectsPanel-NISULU6U.mjs.map +7 -0
- package/dist/lib/neutral/DebugStatus-YB3KFP7G.mjs +121 -0
- package/dist/lib/neutral/DebugStatus-YB3KFP7G.mjs.map +7 -0
- package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs +23 -0
- package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs.map +7 -0
- package/dist/lib/neutral/SpaceGenerator-UBYB4NPD.mjs +143 -0
- package/dist/lib/neutral/SpaceGenerator-UBYB4NPD.mjs.map +7 -0
- package/dist/lib/neutral/Wireframe-7SNRUKET.mjs +52 -0
- package/dist/lib/neutral/Wireframe-7SNRUKET.mjs.map +7 -0
- package/dist/lib/{browser/app-graph-builder-DEBTVBQG.mjs → neutral/app-graph-builder-YPYHL2K5.mjs} +217 -239
- package/dist/lib/neutral/app-graph-builder-YPYHL2K5.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +15 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/{browser/chunk-A5H5GRV6.mjs → neutral/chunk-3OGPOE7H.mjs} +2 -2
- package/dist/lib/{browser/chunk-A5H5GRV6.mjs.map → neutral/chunk-3OGPOE7H.mjs.map} +3 -3
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/{browser/chunk-4UFQXPP7.mjs → neutral/chunk-NFIOTQRZ.mjs} +23 -12
- package/dist/lib/neutral/chunk-NFIOTQRZ.mjs.map +7 -0
- package/dist/lib/{browser/SpaceGenerator-W3LJORYT.mjs → neutral/components/index.mjs} +283 -454
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +21 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +18 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/{browser/react-context-I3USIAF6.mjs → neutral/react-context-MUZ3KVLU.mjs} +6 -6
- package/dist/lib/neutral/react-context-MUZ3KVLU.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-NH2H63KW.mjs +420 -0
- package/dist/lib/neutral/react-surface-NH2H63KW.mjs.map +7 -0
- package/dist/lib/{browser/settings-SLTQJJNF.mjs → neutral/settings-MPM6YUP4.mjs} +7 -11
- package/dist/lib/neutral/settings-MPM6YUP4.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +83 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +14 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +3 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/DebugPlugin.node.d.ts +5 -0
- package/dist/types/src/DebugPlugin.node.d.ts.map +1 -0
- package/dist/types/src/DebugPlugin.test.d.ts +2 -0
- package/dist/types/src/DebugPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/{react-context/react-context.d.ts → react-context.d.ts} +1 -1
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +9 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +7 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.d.ts +11 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts +99 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/index.d.ts +2 -0
- package/dist/types/src/components/DebugSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -0
- package/dist/types/src/components/SchemaTable/index.d.ts +2 -0
- package/dist/types/src/components/SchemaTable/index.d.ts.map +1 -0
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/index.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/index.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -10
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +8 -0
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/containers/DebugGraph/index.d.ts +2 -0
- package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +6 -0
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts +2 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +5 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +2 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -0
- package/dist/types/src/containers/DebugStatus/index.d.ts +2 -0
- package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.d.ts +0 -1
- package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -0
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +2 -0
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +11 -0
- package/dist/types/src/{components → containers}/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/containers/SpaceGenerator/index.d.ts +2 -0
- package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
- package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
- package/dist/types/src/containers/Wireframe/index.d.ts +2 -0
- package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +9 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +80 -59
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +8 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +69 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +116 -66
- package/src/DebugPlugin.node.ts +18 -0
- package/src/DebugPlugin.test.ts +29 -0
- package/src/DebugPlugin.tsx +14 -6
- package/src/capabilities/app-graph-builder.ts +405 -0
- package/src/capabilities/index.ts +6 -4
- package/src/capabilities/{react-context/react-context.tsx → react-context.tsx} +7 -2
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +175 -147
- package/src/capabilities/{settings/settings.ts → settings.ts} +4 -4
- package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
- package/src/components/DebugSettings/DebugSettings.tsx +262 -0
- package/src/components/DebugSettings/index.ts +5 -0
- package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +2 -2
- package/src/components/SchemaTable/index.ts +5 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +16 -17
- package/src/components/SpaceGenerator/draw-util.ts +8 -8
- package/src/components/SpaceGenerator/index.ts +2 -3
- package/src/components/SpaceGenerator/presets.ts +49 -63
- package/src/components/index.ts +4 -11
- package/src/{components → containers/DebugGraph}/DebugGraph.tsx +3 -4
- package/src/containers/DebugGraph/index.ts +5 -0
- package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +76 -0
- package/src/containers/DebugObjectPanel/index.ts +5 -0
- package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +47 -0
- package/src/containers/DebugSpaceObjectsPanel/index.ts +5 -0
- package/src/{components → containers/DebugStatus}/DebugStatus.tsx +41 -19
- package/src/containers/DebugStatus/index.ts +5 -0
- package/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.tsx +8 -3
- package/src/containers/DevtoolsOverviewContainer/index.ts +5 -0
- package/src/containers/SpaceGenerator/SpaceGenerator.tsx +126 -0
- package/src/containers/SpaceGenerator/index.ts +5 -0
- package/src/{components → containers/Wireframe}/Wireframe.tsx +3 -7
- package/src/containers/Wireframe/index.ts +5 -0
- package/src/containers/index.ts +13 -0
- package/src/index.ts +1 -1
- package/src/meta.ts +1 -1
- package/src/plugin.ts +10 -0
- package/src/translations.ts +75 -58
- package/src/types/Settings.ts +16 -0
- package/src/{types.ts → types/index.ts} +15 -14
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs +0 -19
- package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-W3LJORYT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-DEBTVBQG.mjs.map +0 -7
- package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -126
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-context-I3USIAF6.mjs.map +0 -7
- package/dist/lib/browser/react-surface-FMVC5GPV.mjs +0 -758
- package/dist/lib/browser/react-surface-FMVC5GPV.mjs.map +0 -7
- package/dist/lib/browser/settings-SLTQJJNF.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context/index.d.ts +0 -7
- package/dist/types/src/capabilities/react-context/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -3
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +0 -6
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/components/Container.d.ts +0 -5
- package/dist/types/src/components/Container.d.ts.map +0 -1
- package/dist/types/src/components/DebugGraph.d.ts +0 -9
- package/dist/types/src/components/DebugGraph.d.ts.map +0 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +0 -7
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
- package/dist/types/src/components/DebugSettings.d.ts +0 -8
- package/dist/types/src/components/DebugSettings.d.ts.map +0 -1
- package/dist/types/src/components/DebugStatus.d.ts.map +0 -1
- package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
- package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +0 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +0 -9
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -15
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +0 -1
- package/dist/types/src/components/Wireframe.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -68
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -421
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/react-context/index.ts +0 -7
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/settings/index.ts +0 -7
- package/src/components/Container.tsx +0 -15
- package/src/components/DebugObjectPanel.tsx +0 -32
- package/src/components/DebugSettings.tsx +0 -185
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -54
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +0 -126
- /package/dist/types/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.d.ts +0 -0
- /package/dist/types/src/{components → containers/DebugStatus}/DebugStatus.d.ts +0 -0
- /package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +0 -0
|
@@ -1,214 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
import React2, { useCallback, useMemo, useState } from "react";
|
|
3
|
-
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
4
|
-
import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
|
|
5
|
-
import { Filter as Filter3, Obj as Obj2 } from "@dxos/echo";
|
|
6
|
-
import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
|
|
7
|
-
import { Sheet as Sheet2 } from "@dxos/plugin-sheet/types";
|
|
8
|
-
import { Diagram as Diagram2 } from "@dxos/plugin-sketch/types";
|
|
9
|
-
import { useClient } from "@dxos/react-client";
|
|
10
|
-
import { IconButton as IconButton2, Input, Layout, ScrollArea, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
11
|
-
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
12
|
-
import { Organization as Organization2, Person as Person2, Task } from "@dxos/types";
|
|
13
|
-
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
1
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
14
2
|
|
|
15
|
-
// src/components/
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
await invokePromise(SpaceOperation.AddSchema, {
|
|
41
|
-
db: space.db,
|
|
42
|
-
schema,
|
|
43
|
-
show: false
|
|
44
|
-
});
|
|
45
|
-
} else if (!view && staticSchema) {
|
|
46
|
-
await invokePromise(SpaceOperation.UseStaticSchema, {
|
|
47
|
-
db: space.db,
|
|
48
|
-
typename,
|
|
49
|
-
show: false
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const generate = createAsyncGenerator(generator, schema, {
|
|
53
|
-
db: space.db
|
|
54
|
-
});
|
|
55
|
-
return generate.createObjects(n);
|
|
56
|
-
};
|
|
3
|
+
// src/components/index.ts
|
|
4
|
+
import { lazy } from "react";
|
|
5
|
+
|
|
6
|
+
// src/components/SchemaTable/SchemaTable.tsx
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { IconButton } from "@dxos/react-ui";
|
|
9
|
+
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
10
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
11
|
+
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
12
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
13
|
+
className: "p-2"
|
|
14
|
+
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
15
|
+
key: type.typename,
|
|
16
|
+
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
17
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
18
|
+
className: "px-2 text-sm font-mono text-subdued"
|
|
19
|
+
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
20
|
+
className: "px-2 text-right font-mono"
|
|
21
|
+
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
22
|
+
variant: "ghost",
|
|
23
|
+
icon: "ph--plus--regular",
|
|
24
|
+
iconOnly: true,
|
|
25
|
+
label: "Create data",
|
|
26
|
+
onClick: () => onClick(type.typename)
|
|
27
|
+
}))));
|
|
57
28
|
};
|
|
58
|
-
var staticGenerators = /* @__PURE__ */ new Map([
|
|
59
|
-
[
|
|
60
|
-
Markdown.Document.typename,
|
|
61
|
-
async (space, n, cb) => {
|
|
62
|
-
const objects = range(n).map(() => {
|
|
63
|
-
return space.db.add(Markdown.make({
|
|
64
|
-
name: faker.commerce.productName(),
|
|
65
|
-
content: faker.lorem.sentences(5)
|
|
66
|
-
}));
|
|
67
|
-
});
|
|
68
|
-
cb?.(objects);
|
|
69
|
-
return objects;
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
[
|
|
73
|
-
Diagram.Diagram.typename,
|
|
74
|
-
async (space, n, cb) => {
|
|
75
|
-
const objects = range(n).map(() => {
|
|
76
|
-
const obj = space.db.add(Diagram.make({
|
|
77
|
-
name: faker.commerce.productName()
|
|
78
|
-
}));
|
|
79
|
-
return obj;
|
|
80
|
-
});
|
|
81
|
-
cb?.(objects);
|
|
82
|
-
return objects;
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
// TODO(burdon): Create unit tests.
|
|
86
|
-
[
|
|
87
|
-
Sheet.Sheet.typename,
|
|
88
|
-
async (space, n, cb) => {
|
|
89
|
-
const objects = range(n).map(() => {
|
|
90
|
-
const cells = {};
|
|
91
|
-
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
92
|
-
const cols = 4;
|
|
93
|
-
const rows = 16;
|
|
94
|
-
for (let col = 1; col <= cols; col++) {
|
|
95
|
-
for (let row = 1; row <= rows; row++) {
|
|
96
|
-
const cell = addressToA1Notation({
|
|
97
|
-
col,
|
|
98
|
-
row
|
|
99
|
-
});
|
|
100
|
-
if (row === 1) {
|
|
101
|
-
cells[cell] = {
|
|
102
|
-
value: `${year} Q${col}`
|
|
103
|
-
};
|
|
104
|
-
} else if (row === rows) {
|
|
105
|
-
const from = addressToA1Notation({
|
|
106
|
-
col,
|
|
107
|
-
row: 2
|
|
108
|
-
});
|
|
109
|
-
const to = addressToA1Notation({
|
|
110
|
-
col,
|
|
111
|
-
row: rows - 1
|
|
112
|
-
});
|
|
113
|
-
cells[cell] = {
|
|
114
|
-
value: `=SUM(${from}:${to})`
|
|
115
|
-
};
|
|
116
|
-
} else if (row > 2 && row < rows - 1) {
|
|
117
|
-
cells[cell] = {
|
|
118
|
-
value: Math.floor(Math.random() * 1e4)
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return space.db.add(Sheet.make({
|
|
124
|
-
name: faker.commerce.productName(),
|
|
125
|
-
cells
|
|
126
|
-
}));
|
|
127
|
-
});
|
|
128
|
-
cb?.(objects);
|
|
129
|
-
return objects;
|
|
130
|
-
}
|
|
131
|
-
],
|
|
132
|
-
[
|
|
133
|
-
ComputeGraph.typename,
|
|
134
|
-
async (space, n, cb) => {
|
|
135
|
-
const objects = range(n, () => {
|
|
136
|
-
const model = ComputeGraphModel.create();
|
|
137
|
-
model.builder.createNode({
|
|
138
|
-
id: "gpt-INPUT",
|
|
139
|
-
type: NODE_INPUT
|
|
140
|
-
}).createNode({
|
|
141
|
-
id: "gpt-GPT",
|
|
142
|
-
type: "gpt"
|
|
143
|
-
}).createNode({
|
|
144
|
-
id: "gpt-QUEUE_ID",
|
|
145
|
-
type: "constant",
|
|
146
|
-
value: new DXN(DXN.kind.QUEUE, [
|
|
147
|
-
"data",
|
|
148
|
-
space.id,
|
|
149
|
-
Key.ObjectId.random()
|
|
150
|
-
]).toString()
|
|
151
|
-
}).createNode({
|
|
152
|
-
id: "gpt-APPEND",
|
|
153
|
-
type: "append"
|
|
154
|
-
}).createNode({
|
|
155
|
-
id: "gpt-OUTPUT",
|
|
156
|
-
type: NODE_OUTPUT
|
|
157
|
-
}).createEdge({
|
|
158
|
-
node: "gpt-INPUT",
|
|
159
|
-
property: "prompt"
|
|
160
|
-
}, {
|
|
161
|
-
node: "gpt-GPT",
|
|
162
|
-
property: "prompt"
|
|
163
|
-
}).createEdge({
|
|
164
|
-
node: "gpt-GPT",
|
|
165
|
-
property: "text"
|
|
166
|
-
}, {
|
|
167
|
-
node: "gpt-OUTPUT",
|
|
168
|
-
property: "text"
|
|
169
|
-
}).createEdge({
|
|
170
|
-
node: "gpt-QUEUE_ID",
|
|
171
|
-
property: DEFAULT_OUTPUT
|
|
172
|
-
}, {
|
|
173
|
-
node: "gpt-APPEND",
|
|
174
|
-
property: "id"
|
|
175
|
-
}).createEdge({
|
|
176
|
-
node: "gpt-GPT",
|
|
177
|
-
property: "messages"
|
|
178
|
-
}, {
|
|
179
|
-
node: "gpt-APPEND",
|
|
180
|
-
property: "items"
|
|
181
|
-
}).createEdge({
|
|
182
|
-
node: "gpt-QUEUE_ID",
|
|
183
|
-
property: DEFAULT_OUTPUT
|
|
184
|
-
}, {
|
|
185
|
-
node: "gpt-OUTPUT",
|
|
186
|
-
property: "queue"
|
|
187
|
-
});
|
|
188
|
-
return space.db.add(model.root);
|
|
189
|
-
});
|
|
190
|
-
cb?.(objects);
|
|
191
|
-
return objects;
|
|
192
|
-
}
|
|
193
|
-
]
|
|
194
|
-
]);
|
|
195
29
|
|
|
196
30
|
// src/components/SpaceGenerator/presets.ts
|
|
197
31
|
import * as Schema from "effect/Schema";
|
|
198
|
-
import {
|
|
199
|
-
import {
|
|
200
|
-
import { NODE_INPUT
|
|
201
|
-
import { DXN
|
|
202
|
-
import { Trigger, serializeFunction } from "@dxos/functions";
|
|
32
|
+
import { AgentPrompt, WebSearchBlueprint } from "@dxos/assistant-toolkit";
|
|
33
|
+
import { Routine, Trigger, Operation } from "@dxos/compute";
|
|
34
|
+
import { NODE_INPUT } from "@dxos/conductor";
|
|
35
|
+
import { DXN, Feed, Filter, JsonSchema, Key, Obj, Query, Ref, Tag } from "@dxos/echo";
|
|
203
36
|
import { invariant } from "@dxos/invariant";
|
|
204
|
-
import {
|
|
205
|
-
import { Mailbox } from "@dxos/plugin-inbox
|
|
206
|
-
import { Markdown
|
|
207
|
-
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt,
|
|
37
|
+
import { InboxOperation } from "@dxos/plugin-inbox";
|
|
38
|
+
import { Mailbox } from "@dxos/plugin-inbox";
|
|
39
|
+
import { Markdown } from "@dxos/plugin-markdown";
|
|
40
|
+
import { createAppend, createChat, createComputeGraph, createConstant, createFeed, createFunction, createGpt, createRandom, createSurface, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
208
41
|
import { CanvasBoard, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
209
|
-
import {
|
|
42
|
+
import { ViewModel } from "@dxos/schema";
|
|
210
43
|
import { Message, Organization, Person, Pipeline } from "@dxos/types";
|
|
211
|
-
import { range
|
|
44
|
+
import { range, trim } from "@dxos/util";
|
|
212
45
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
|
|
213
46
|
var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
214
47
|
PresetName2["DXOS_TEAM"] = "dxos-team";
|
|
@@ -221,7 +54,7 @@ var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
|
221
54
|
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
222
55
|
return PresetName2;
|
|
223
56
|
})({});
|
|
224
|
-
var
|
|
57
|
+
var generator = () => ({
|
|
225
58
|
schemas: [
|
|
226
59
|
CanvasBoard.CanvasBoard,
|
|
227
60
|
Trigger.Trigger
|
|
@@ -233,12 +66,12 @@ var generator2 = () => ({
|
|
|
233
66
|
[
|
|
234
67
|
"dxos-team",
|
|
235
68
|
async (space, n, cb) => {
|
|
236
|
-
const objects =
|
|
69
|
+
const objects = range(n, () => {
|
|
237
70
|
const org = space.db.add(Obj.make(Organization.Organization, {
|
|
238
71
|
name: "DXOS",
|
|
239
72
|
website: "https://dxos.org"
|
|
240
73
|
}));
|
|
241
|
-
const doc = space.db.add(
|
|
74
|
+
const doc = space.db.add(Markdown.make({
|
|
242
75
|
name: "DXOS Research",
|
|
243
76
|
content: "DXOS builds Composer, an open-source AI-powered malleable application."
|
|
244
77
|
}));
|
|
@@ -246,18 +79,19 @@ var generator2 = () => ({
|
|
|
246
79
|
label: "Investor"
|
|
247
80
|
}));
|
|
248
81
|
const tagDxn = Obj.getDXN(tag).toString();
|
|
249
|
-
Obj.
|
|
250
|
-
Obj.getMeta(
|
|
82
|
+
Obj.update(doc, (doc2) => {
|
|
83
|
+
Obj.getMeta(doc2).tags = [
|
|
251
84
|
tagDxn
|
|
252
85
|
];
|
|
253
86
|
});
|
|
254
87
|
space.db.add(Obj.make(Person.Person, {
|
|
88
|
+
[Obj.Meta]: {
|
|
89
|
+
tags: [
|
|
90
|
+
tagDxn
|
|
91
|
+
]
|
|
92
|
+
},
|
|
255
93
|
fullName: "Rich",
|
|
256
94
|
organization: Ref.make(org)
|
|
257
|
-
}, {
|
|
258
|
-
tags: [
|
|
259
|
-
tagDxn
|
|
260
|
-
]
|
|
261
95
|
}));
|
|
262
96
|
space.db.add(Obj.make(Person.Person, {
|
|
263
97
|
fullName: "Josiah",
|
|
@@ -280,39 +114,30 @@ var generator2 = () => ({
|
|
|
280
114
|
[
|
|
281
115
|
"org-research-project",
|
|
282
116
|
async (space, n, cb) => {
|
|
283
|
-
const
|
|
284
|
-
const
|
|
117
|
+
const mailboxes = await space.db.query(Filter.type(Mailbox.Mailbox)).run();
|
|
118
|
+
const mailbox = mailboxes[0];
|
|
119
|
+
invariant(mailbox, "Mailbox not found", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 100, S: void 0, A: ["mailbox", "'Mailbox not found'"] });
|
|
120
|
+
const mailboxFeed = await mailbox.feed?.tryLoad();
|
|
121
|
+
invariant(mailboxFeed, "Mailbox missing feed reference", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 102, S: void 0, A: ["mailboxFeed", "'Mailbox missing feed reference'"] });
|
|
122
|
+
const queueDxn = Feed.getQueueDxn(mailboxFeed)?.toString();
|
|
123
|
+
invariant(queueDxn, "Mailbox feed missing queue DXN key", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 104, S: void 0, A: ["queueDxn", "'Mailbox feed missing queue DXN key'"] });
|
|
124
|
+
const tag = await space.db.query(Filter.type(Tag.Tag, {
|
|
285
125
|
label: "Investor"
|
|
286
126
|
})).first();
|
|
287
127
|
const tagDxn = Obj.getDXN(tag).toString();
|
|
288
|
-
const objects =
|
|
289
|
-
const contactsQuery = Query.select(
|
|
290
|
-
const organizationsQuery = Query.select(
|
|
291
|
-
const notesQuery = Query.select(
|
|
128
|
+
const objects = range(n, () => {
|
|
129
|
+
const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(tagDxn));
|
|
130
|
+
const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagDxn));
|
|
131
|
+
const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagDxn));
|
|
292
132
|
space.db.add(Trigger.make({
|
|
293
133
|
enabled: true,
|
|
294
|
-
spec:
|
|
295
|
-
|
|
296
|
-
cron: "* * * * *"
|
|
297
|
-
},
|
|
298
|
-
function: Ref.make(serializeFunction(gmail.sync)),
|
|
134
|
+
spec: Trigger.specTimer("* * * * *"),
|
|
135
|
+
function: Ref.make(Operation.serialize(InboxOperation.GoogleMailSync)),
|
|
299
136
|
input: {
|
|
300
137
|
mailbox: Ref.make(mailbox)
|
|
301
138
|
}
|
|
302
139
|
}));
|
|
303
|
-
space.db.add(
|
|
304
|
-
enabled: true,
|
|
305
|
-
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
306
|
-
spec: {
|
|
307
|
-
kind: "queue",
|
|
308
|
-
queue: mailbox.queue.dxn.toString()
|
|
309
|
-
},
|
|
310
|
-
function: Ref.make(serializeFunction(EntityExtraction.extract)),
|
|
311
|
-
input: {
|
|
312
|
-
source: "{{event.item}}"
|
|
313
|
-
}
|
|
314
|
-
}));
|
|
315
|
-
const researchPrompt = space.db.add(Prompt.make({
|
|
140
|
+
const researchPrompt = space.db.add(Routine.make({
|
|
316
141
|
name: "Research",
|
|
317
142
|
description: "Research organization",
|
|
318
143
|
input: Schema.Struct({
|
|
@@ -327,46 +152,41 @@ var generator2 = () => ({
|
|
|
327
152
|
NOTE: Do mocked reseach (set mockSearch to true).
|
|
328
153
|
`,
|
|
329
154
|
blueprints: [
|
|
330
|
-
Ref.make(
|
|
155
|
+
Ref.make(WebSearchBlueprint.make())
|
|
331
156
|
]
|
|
332
157
|
}));
|
|
333
158
|
space.db.add(Trigger.make({
|
|
334
159
|
enabled: true,
|
|
335
|
-
spec:
|
|
336
|
-
|
|
337
|
-
query: {
|
|
338
|
-
ast: organizationsQuery.ast
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
function: Ref.make(serializeFunction(Agent.prompt)),
|
|
160
|
+
spec: Trigger.specSubscription(organizationsQuery),
|
|
161
|
+
function: Ref.make(Operation.serialize(AgentPrompt)),
|
|
342
162
|
input: {
|
|
343
163
|
prompt: Ref.make(researchPrompt),
|
|
344
164
|
input: "{{event.subject}}"
|
|
345
165
|
}
|
|
346
166
|
}));
|
|
347
|
-
const mailboxView =
|
|
348
|
-
query: Query.select(
|
|
167
|
+
const mailboxView = ViewModel.make({
|
|
168
|
+
query: Query.select(Filter.type(Message.Message, {
|
|
349
169
|
properties: {
|
|
350
|
-
labels:
|
|
170
|
+
labels: Filter.contains("investor")
|
|
351
171
|
}
|
|
352
|
-
})).
|
|
172
|
+
})).from({
|
|
353
173
|
queues: [
|
|
354
|
-
|
|
174
|
+
queueDxn
|
|
355
175
|
]
|
|
356
176
|
}),
|
|
357
|
-
jsonSchema:
|
|
177
|
+
jsonSchema: JsonSchema.toJsonSchema(Message.Message)
|
|
358
178
|
});
|
|
359
|
-
const contactsView =
|
|
179
|
+
const contactsView = ViewModel.make({
|
|
360
180
|
query: contactsQuery,
|
|
361
|
-
jsonSchema:
|
|
181
|
+
jsonSchema: JsonSchema.toJsonSchema(Person.Person)
|
|
362
182
|
});
|
|
363
|
-
const organizationsView =
|
|
183
|
+
const organizationsView = ViewModel.make({
|
|
364
184
|
query: organizationsQuery,
|
|
365
|
-
jsonSchema:
|
|
185
|
+
jsonSchema: JsonSchema.toJsonSchema(Organization.Organization)
|
|
366
186
|
});
|
|
367
|
-
const notesView =
|
|
187
|
+
const notesView = ViewModel.make({
|
|
368
188
|
query: notesQuery,
|
|
369
|
-
jsonSchema:
|
|
189
|
+
jsonSchema: JsonSchema.toJsonSchema(Markdown.Document)
|
|
370
190
|
});
|
|
371
191
|
return space.db.add(Pipeline.make({
|
|
372
192
|
name: "Investor Research",
|
|
@@ -401,7 +221,7 @@ var generator2 = () => ({
|
|
|
401
221
|
[
|
|
402
222
|
"webhook-gpt-queue",
|
|
403
223
|
async (space, n, cb) => {
|
|
404
|
-
const objects =
|
|
224
|
+
const objects = range(n, () => {
|
|
405
225
|
const canvasModel = CanvasGraphModel.create();
|
|
406
226
|
let functionTrigger;
|
|
407
227
|
canvasModel.builder.call((builder) => {
|
|
@@ -461,9 +281,9 @@ var generator2 = () => ({
|
|
|
461
281
|
[
|
|
462
282
|
"objectChange-queue",
|
|
463
283
|
async (space, n, cb) => {
|
|
464
|
-
const objects =
|
|
284
|
+
const objects = range(n, () => {
|
|
465
285
|
const { canvasModel, computeModel } = createQueueSinkPreset(space, "subscription", (triggerSpec) => triggerSpec.query = {
|
|
466
|
-
ast: Query.select(
|
|
286
|
+
ast: Query.select(Filter.typename("org.dxos.type.chess")).ast
|
|
467
287
|
}, "type");
|
|
468
288
|
return addToSpace("objectChange-queue", space, canvasModel, computeModel);
|
|
469
289
|
});
|
|
@@ -474,7 +294,7 @@ var generator2 = () => ({
|
|
|
474
294
|
[
|
|
475
295
|
"timerTick-queue",
|
|
476
296
|
async (space, n, cb) => {
|
|
477
|
-
const objects =
|
|
297
|
+
const objects = range(n, () => {
|
|
478
298
|
const { canvasModel, computeModel } = createQueueSinkPreset(space, "timer", (triggerSpec) => triggerSpec.cron = "*/5 * * * * *", "result");
|
|
479
299
|
return addToSpace("timerTick-queue", space, canvasModel, computeModel);
|
|
480
300
|
});
|
|
@@ -529,7 +349,7 @@ var generator2 = () => ({
|
|
|
529
349
|
// const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
530
350
|
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
531
351
|
// templateComputeNode.value = templateContent.join('\n');
|
|
532
|
-
// templateComputeNode.inputSchema =
|
|
352
|
+
// templateComputeNode.inputSchema = JsonSchema.toJsonSchema(EmailTriggerOutput);
|
|
533
353
|
// attachTrigger(functionTrigger, computeModel);
|
|
534
354
|
// return addToSpace(PresetName.EMAIL_TABLE, space, canvasModel, computeModel);
|
|
535
355
|
// });
|
|
@@ -540,7 +360,7 @@ var generator2 = () => ({
|
|
|
540
360
|
[
|
|
541
361
|
"chat-gpt-text",
|
|
542
362
|
async (space, n, cb) => {
|
|
543
|
-
const objects =
|
|
363
|
+
const objects = range(n, () => {
|
|
544
364
|
const canvasModel = CanvasGraphModel.create();
|
|
545
365
|
canvasModel.builder.call((builder) => {
|
|
546
366
|
const gpt = canvasModel.createNode(createGpt(position({
|
|
@@ -660,7 +480,7 @@ var generator2 = () => ({
|
|
|
660
480
|
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
661
481
|
// templateComputeNode.value = templateContent.join('\n');
|
|
662
482
|
// const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({ text: Schema.String }));
|
|
663
|
-
// templateComputeNode.inputSchema =
|
|
483
|
+
// templateComputeNode.inputSchema = JsonSchema.toJsonSchema(extendedSchema);
|
|
664
484
|
// attachTrigger(functionTrigger, computeModel);
|
|
665
485
|
// return addToSpace(PresetName.EMAIL_WITH_SUMMARY, space, canvasModel, computeModel);
|
|
666
486
|
// });
|
|
@@ -671,7 +491,7 @@ var generator2 = () => ({
|
|
|
671
491
|
[
|
|
672
492
|
"forex-function-call",
|
|
673
493
|
async (space, n, cb) => {
|
|
674
|
-
const objects =
|
|
494
|
+
const objects = range(n, () => {
|
|
675
495
|
const canvasModel = CanvasGraphModel.create();
|
|
676
496
|
canvasModel.builder.call((builder) => {
|
|
677
497
|
const sourceCurrency = canvasModel.createNode(createConstant({
|
|
@@ -720,7 +540,7 @@ var generator2 = () => ({
|
|
|
720
540
|
[
|
|
721
541
|
"discord-messages",
|
|
722
542
|
async (space, n, cb) => {
|
|
723
|
-
const objects =
|
|
543
|
+
const objects = range(n, () => {
|
|
724
544
|
const canvasModel = CanvasGraphModel.create();
|
|
725
545
|
let functionTrigger;
|
|
726
546
|
canvasModel.builder.call((builder) => {
|
|
@@ -741,10 +561,10 @@ var generator2 = () => ({
|
|
|
741
561
|
})
|
|
742
562
|
}));
|
|
743
563
|
const queueId = canvasModel.createNode(createConstant({
|
|
744
|
-
value: new
|
|
564
|
+
value: new DXN(DXN.kind.QUEUE, [
|
|
745
565
|
"data",
|
|
746
566
|
space.id,
|
|
747
|
-
|
|
567
|
+
Key.ObjectId.random()
|
|
748
568
|
]).toString(),
|
|
749
569
|
...position({
|
|
750
570
|
x: -10,
|
|
@@ -759,7 +579,7 @@ var generator2 = () => ({
|
|
|
759
579
|
x: 12,
|
|
760
580
|
y: 0
|
|
761
581
|
})));
|
|
762
|
-
const queue = canvasModel.createNode(
|
|
582
|
+
const queue = canvasModel.createNode(createFeed(position({
|
|
763
583
|
x: 0,
|
|
764
584
|
y: 12
|
|
765
585
|
})));
|
|
@@ -834,7 +654,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
834
654
|
width: 128,
|
|
835
655
|
height: 122
|
|
836
656
|
})));
|
|
837
|
-
const
|
|
657
|
+
const random2 = canvasModel.createNode(createRandom(rawPosition({
|
|
838
658
|
centerX: -509,
|
|
839
659
|
centerY: -30,
|
|
840
660
|
width: 64,
|
|
@@ -854,43 +674,27 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
854
674
|
output: triggerOutputName,
|
|
855
675
|
input: "type"
|
|
856
676
|
}).createEdge({
|
|
857
|
-
source:
|
|
677
|
+
source: random2.id,
|
|
858
678
|
target: template.id,
|
|
859
679
|
input: "changeId"
|
|
860
680
|
});
|
|
861
681
|
functionTrigger = triggerShape.functionTrigger.target;
|
|
862
682
|
const triggerSpec = functionTrigger.spec;
|
|
863
|
-
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
S: void 0,
|
|
867
|
-
A: [
|
|
868
|
-
"triggerSpec && triggerSpec.kind === triggerKind",
|
|
869
|
-
"'No trigger spec.'"
|
|
870
|
-
]
|
|
871
|
-
});
|
|
872
|
-
Obj.change(functionTrigger, (ft) => {
|
|
873
|
-
initSpec(ft.spec);
|
|
683
|
+
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 665, S: void 0, A: ["triggerSpec && triggerSpec.kind === triggerKind", "'No trigger spec.'"] });
|
|
684
|
+
Obj.update(functionTrigger, (functionTrigger2) => {
|
|
685
|
+
initSpec(functionTrigger2.spec);
|
|
874
686
|
});
|
|
875
687
|
});
|
|
876
688
|
const computeModel = createComputeGraph(canvasModel);
|
|
877
689
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
878
|
-
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
879
|
-
F: __dxlog_file,
|
|
880
|
-
L: 765,
|
|
881
|
-
S: void 0,
|
|
882
|
-
A: [
|
|
883
|
-
"templateComputeNode",
|
|
884
|
-
"'Template compute node was not created.'"
|
|
885
|
-
]
|
|
886
|
-
});
|
|
690
|
+
invariant(templateComputeNode, "Template compute node was not created.", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 672, S: void 0, A: ["templateComputeNode", "'Template compute node was not created.'"] });
|
|
887
691
|
templateComputeNode.value = [
|
|
888
692
|
"{",
|
|
889
693
|
' "@type": "{{type}}",',
|
|
890
694
|
' "id": "@{{changeId}}"',
|
|
891
695
|
"}"
|
|
892
696
|
].join("\n");
|
|
893
|
-
templateComputeNode.inputSchema =
|
|
697
|
+
templateComputeNode.inputSchema = JsonSchema.toJsonSchema(Schema.Struct({
|
|
894
698
|
type: Schema.String,
|
|
895
699
|
changeId: Schema.String
|
|
896
700
|
}));
|
|
@@ -909,10 +713,10 @@ var addToSpace = (name, space, canvas, compute) => {
|
|
|
909
713
|
};
|
|
910
714
|
var setupQueue = (space, canvasModel, args) => {
|
|
911
715
|
const queueId = canvasModel.createNode(createConstant({
|
|
912
|
-
value: new
|
|
716
|
+
value: new DXN(DXN.kind.QUEUE, [
|
|
913
717
|
"data",
|
|
914
718
|
space.id,
|
|
915
|
-
|
|
719
|
+
Key.ObjectId.random()
|
|
916
720
|
]).toString(),
|
|
917
721
|
...args?.idPosition ? rawPosition(args.idPosition) : position({
|
|
918
722
|
x: -18,
|
|
@@ -921,7 +725,7 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
921
725
|
height: 6
|
|
922
726
|
})
|
|
923
727
|
}));
|
|
924
|
-
const queue = canvasModel.createNode(
|
|
728
|
+
const queue = canvasModel.createNode(createFeed(args?.queuePosition ? rawPosition(args.queuePosition) : position({
|
|
925
729
|
x: -3,
|
|
926
730
|
y: 3,
|
|
927
731
|
width: 14,
|
|
@@ -937,19 +741,11 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
937
741
|
};
|
|
938
742
|
};
|
|
939
743
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
940
|
-
invariant(functionTrigger, void 0, {
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
"functionTrigger",
|
|
946
|
-
""
|
|
947
|
-
]
|
|
948
|
-
});
|
|
949
|
-
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT2);
|
|
950
|
-
Obj.change(functionTrigger, (t) => {
|
|
951
|
-
t.function = Ref.make(computeModel.root);
|
|
952
|
-
t.inputNodeId = inputNode.id;
|
|
744
|
+
invariant(functionTrigger, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 727, S: void 0, A: ["functionTrigger", ""] });
|
|
745
|
+
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT);
|
|
746
|
+
Obj.update(functionTrigger, (functionTrigger2) => {
|
|
747
|
+
functionTrigger2.function = Ref.make(computeModel.root);
|
|
748
|
+
functionTrigger2.inputNodeId = inputNode.id;
|
|
953
749
|
});
|
|
954
750
|
};
|
|
955
751
|
var rawPosition = (args) => {
|
|
@@ -996,157 +792,190 @@ var position = (rect) => {
|
|
|
996
792
|
}
|
|
997
793
|
};
|
|
998
794
|
|
|
999
|
-
// src/components/SpaceGenerator/
|
|
1000
|
-
import
|
|
1001
|
-
import {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
variant: "ghost",
|
|
1016
|
-
icon: "ph--plus--regular",
|
|
1017
|
-
iconOnly: true,
|
|
1018
|
-
label: "Create data",
|
|
1019
|
-
onClick: () => onClick(type.typename)
|
|
1020
|
-
}))));
|
|
795
|
+
// src/components/SpaceGenerator/ObjectGenerator.tsx
|
|
796
|
+
import { addressToA1Notation } from "@dxos/compute-hyperformula";
|
|
797
|
+
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT as NODE_INPUT2, NODE_OUTPUT } from "@dxos/conductor";
|
|
798
|
+
import { DXN as DXN2, Filter as Filter2, Key as Key2 } from "@dxos/echo";
|
|
799
|
+
import { View } from "@dxos/echo";
|
|
800
|
+
import { Markdown as Markdown2 } from "@dxos/plugin-markdown";
|
|
801
|
+
import { Sheet } from "@dxos/plugin-sheet";
|
|
802
|
+
import { Sketch } from "@dxos/plugin-sketch";
|
|
803
|
+
import { SpaceOperation } from "@dxos/plugin-space";
|
|
804
|
+
import { random } from "@dxos/random";
|
|
805
|
+
import { getTypenameFromQuery } from "@dxos/schema";
|
|
806
|
+
import { createAsyncGenerator } from "@dxos/schema/testing";
|
|
807
|
+
import { range as range2 } from "@dxos/util";
|
|
808
|
+
var generator2 = random;
|
|
809
|
+
var findViewByTypename = async (views, typename) => {
|
|
810
|
+
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
1021
811
|
};
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
const [info, setInfo] = useState({});
|
|
1040
|
-
const presets = useMemo(() => generator2(), []);
|
|
1041
|
-
useAsyncEffect(async () => {
|
|
1042
|
-
await client.addTypes([
|
|
1043
|
-
...staticTypes,
|
|
1044
|
-
...recordTypes,
|
|
1045
|
-
...presets.schemas
|
|
1046
|
-
]);
|
|
1047
|
-
}, [
|
|
1048
|
-
client
|
|
1049
|
-
]);
|
|
1050
|
-
const typeMap = useMemo(() => {
|
|
1051
|
-
const recordGenerators = new Map(recordTypes.map((type) => [
|
|
1052
|
-
type.typename,
|
|
1053
|
-
createGenerator(client, invokePromise, type)
|
|
1054
|
-
]));
|
|
1055
|
-
return new Map([
|
|
1056
|
-
...staticGenerators,
|
|
1057
|
-
...presets.items,
|
|
1058
|
-
...recordGenerators
|
|
1059
|
-
]);
|
|
1060
|
-
}, [
|
|
1061
|
-
client,
|
|
1062
|
-
recordTypes,
|
|
1063
|
-
invokePromise
|
|
1064
|
-
]);
|
|
1065
|
-
const updateInfo = async () => {
|
|
1066
|
-
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
1067
|
-
const staticSchema = await space.db.graph.schemaRegistry.query().run();
|
|
1068
|
-
const objects = await space.db.query(Filter3.everything()).run();
|
|
1069
|
-
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
1070
|
-
const type = Obj2.getTypename(obj);
|
|
1071
|
-
if (type) {
|
|
1072
|
-
const count2 = map[type] ?? 0;
|
|
1073
|
-
map[type] = count2 + 1;
|
|
1074
|
-
}
|
|
1075
|
-
return map;
|
|
1076
|
-
}, {}));
|
|
1077
|
-
setInfo({
|
|
1078
|
-
schema: {
|
|
1079
|
-
static: staticSchema.length,
|
|
1080
|
-
mutable: echoSchema.length
|
|
1081
|
-
},
|
|
1082
|
-
objects: objectMap
|
|
812
|
+
var createGenerator = (client, invokePromise, schema) => {
|
|
813
|
+
return async (space, n) => {
|
|
814
|
+
const typename = schema.typename;
|
|
815
|
+
const views = await space.db.query(Filter2.type(View.View)).run();
|
|
816
|
+
const view = await findViewByTypename(views, typename);
|
|
817
|
+
const staticSchema = client?.graph.schemaRegistry.query({
|
|
818
|
+
typename
|
|
819
|
+
}).runSync()[0];
|
|
820
|
+
if (!view && !staticSchema) {
|
|
821
|
+
await invokePromise(SpaceOperation.AddSchema, {
|
|
822
|
+
db: space.db,
|
|
823
|
+
schema,
|
|
824
|
+
show: false
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
const generate = createAsyncGenerator(generator2, schema, {
|
|
828
|
+
db: space.db
|
|
1083
829
|
});
|
|
830
|
+
return generate.createObjects(n);
|
|
1084
831
|
};
|
|
1085
|
-
useAsyncEffect(updateInfo, [
|
|
1086
|
-
space
|
|
1087
|
-
]);
|
|
1088
|
-
const handleCreateData = useCallback(async (typename) => {
|
|
1089
|
-
const constructor = typeMap.get(typename);
|
|
1090
|
-
if (constructor) {
|
|
1091
|
-
await constructor(space, count, onCreateObjects);
|
|
1092
|
-
await updateInfo();
|
|
1093
|
-
}
|
|
1094
|
-
}, [
|
|
1095
|
-
typeMap,
|
|
1096
|
-
count
|
|
1097
|
-
]);
|
|
1098
|
-
return /* @__PURE__ */ React2.createElement(Layout.Main, {
|
|
1099
|
-
toolbar: true
|
|
1100
|
-
}, /* @__PURE__ */ React2.createElement(Toolbar.Root, null, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
1101
|
-
icon: "ph--arrow-clockwise--regular",
|
|
1102
|
-
iconOnly: true,
|
|
1103
|
-
label: "Refresh",
|
|
1104
|
-
onClick: updateInfo
|
|
1105
|
-
}), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
|
|
1106
|
-
variant: "gap"
|
|
1107
|
-
}), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
1108
|
-
type: "number",
|
|
1109
|
-
placeholder: "Count",
|
|
1110
|
-
classNames: "is-[4rem] text-right",
|
|
1111
|
-
min: 1,
|
|
1112
|
-
max: 100,
|
|
1113
|
-
size: 8,
|
|
1114
|
-
value: count,
|
|
1115
|
-
onChange: (event) => setCount(parseInt(event.target.value))
|
|
1116
|
-
}))), /* @__PURE__ */ React2.createElement(ScrollArea.Root, {
|
|
1117
|
-
thin: true,
|
|
1118
|
-
orientation: "vertical"
|
|
1119
|
-
}, /* @__PURE__ */ React2.createElement(ScrollArea.Viewport, {
|
|
1120
|
-
classNames: "gap-4 divide-y divide-subduedSeparator"
|
|
1121
|
-
}, /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1122
|
-
types: staticTypes,
|
|
1123
|
-
objects: info.objects,
|
|
1124
|
-
label: "Static Types",
|
|
1125
|
-
onClick: handleCreateData
|
|
1126
|
-
}), /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1127
|
-
types: recordTypes,
|
|
1128
|
-
objects: info.objects,
|
|
1129
|
-
label: "Record Types",
|
|
1130
|
-
onClick: handleCreateData
|
|
1131
|
-
}), /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1132
|
-
types: presets.types,
|
|
1133
|
-
objects: info.objects,
|
|
1134
|
-
label: "Presets",
|
|
1135
|
-
onClick: handleCreateData
|
|
1136
|
-
}), /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
|
|
1137
|
-
language: "json",
|
|
1138
|
-
classNames: "text-xs"
|
|
1139
|
-
}, JSON.stringify({
|
|
1140
|
-
space,
|
|
1141
|
-
...info
|
|
1142
|
-
}, jsonKeyReplacer({
|
|
1143
|
-
truncate: true
|
|
1144
|
-
}), 2)))));
|
|
1145
832
|
};
|
|
833
|
+
var staticGenerators = /* @__PURE__ */ new Map([
|
|
834
|
+
[
|
|
835
|
+
Markdown2.Document.typename,
|
|
836
|
+
async (space, n, cb) => {
|
|
837
|
+
const objects = range2(n).map(() => {
|
|
838
|
+
return space.db.add(Markdown2.make({
|
|
839
|
+
name: random.commerce.productName(),
|
|
840
|
+
content: random.lorem.sentences(5)
|
|
841
|
+
}));
|
|
842
|
+
});
|
|
843
|
+
cb?.(objects);
|
|
844
|
+
return objects;
|
|
845
|
+
}
|
|
846
|
+
],
|
|
847
|
+
[
|
|
848
|
+
Sketch.Sketch.typename,
|
|
849
|
+
async (space, n, cb) => {
|
|
850
|
+
const objects = range2(n).map(() => {
|
|
851
|
+
const obj = space.db.add(Sketch.make({
|
|
852
|
+
name: random.commerce.productName()
|
|
853
|
+
}));
|
|
854
|
+
return obj;
|
|
855
|
+
});
|
|
856
|
+
cb?.(objects);
|
|
857
|
+
return objects;
|
|
858
|
+
}
|
|
859
|
+
],
|
|
860
|
+
// TODO(burdon): Create unit tests.
|
|
861
|
+
[
|
|
862
|
+
Sheet.Sheet.typename,
|
|
863
|
+
async (space, n, cb) => {
|
|
864
|
+
const objects = range2(n).map(() => {
|
|
865
|
+
const cells = {};
|
|
866
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
867
|
+
const cols = 4;
|
|
868
|
+
const rows = 16;
|
|
869
|
+
for (let col = 1; col <= cols; col++) {
|
|
870
|
+
for (let row = 1; row <= rows; row++) {
|
|
871
|
+
const cell = addressToA1Notation({
|
|
872
|
+
col,
|
|
873
|
+
row
|
|
874
|
+
});
|
|
875
|
+
if (row === 1) {
|
|
876
|
+
cells[cell] = {
|
|
877
|
+
value: `${year} Q${col}`
|
|
878
|
+
};
|
|
879
|
+
} else if (row === rows) {
|
|
880
|
+
const from = addressToA1Notation({
|
|
881
|
+
col,
|
|
882
|
+
row: 2
|
|
883
|
+
});
|
|
884
|
+
const to = addressToA1Notation({
|
|
885
|
+
col,
|
|
886
|
+
row: rows - 1
|
|
887
|
+
});
|
|
888
|
+
cells[cell] = {
|
|
889
|
+
value: `=SUM(${from}:${to})`
|
|
890
|
+
};
|
|
891
|
+
} else if (row > 2 && row < rows - 1) {
|
|
892
|
+
cells[cell] = {
|
|
893
|
+
value: Math.floor(Math.random() * 1e4)
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
return space.db.add(Sheet.make({
|
|
899
|
+
name: random.commerce.productName(),
|
|
900
|
+
cells
|
|
901
|
+
}));
|
|
902
|
+
});
|
|
903
|
+
cb?.(objects);
|
|
904
|
+
return objects;
|
|
905
|
+
}
|
|
906
|
+
],
|
|
907
|
+
[
|
|
908
|
+
ComputeGraph.typename,
|
|
909
|
+
async (space, n, cb) => {
|
|
910
|
+
const objects = range2(n, () => {
|
|
911
|
+
const model = ComputeGraphModel.create();
|
|
912
|
+
model.builder.createNode({
|
|
913
|
+
id: "gpt-INPUT",
|
|
914
|
+
type: NODE_INPUT2
|
|
915
|
+
}).createNode({
|
|
916
|
+
id: "gpt-GPT",
|
|
917
|
+
type: "gpt"
|
|
918
|
+
}).createNode({
|
|
919
|
+
id: "gpt-QUEUE_ID",
|
|
920
|
+
type: "constant",
|
|
921
|
+
value: new DXN2(DXN2.kind.QUEUE, [
|
|
922
|
+
"data",
|
|
923
|
+
space.id,
|
|
924
|
+
Key2.ObjectId.random()
|
|
925
|
+
]).toString()
|
|
926
|
+
}).createNode({
|
|
927
|
+
id: "gpt-APPEND",
|
|
928
|
+
type: "append"
|
|
929
|
+
}).createNode({
|
|
930
|
+
id: "gpt-OUTPUT",
|
|
931
|
+
type: NODE_OUTPUT
|
|
932
|
+
}).createEdge({
|
|
933
|
+
node: "gpt-INPUT",
|
|
934
|
+
property: "prompt"
|
|
935
|
+
}, {
|
|
936
|
+
node: "gpt-GPT",
|
|
937
|
+
property: "prompt"
|
|
938
|
+
}).createEdge({
|
|
939
|
+
node: "gpt-GPT",
|
|
940
|
+
property: "text"
|
|
941
|
+
}, {
|
|
942
|
+
node: "gpt-OUTPUT",
|
|
943
|
+
property: "text"
|
|
944
|
+
}).createEdge({
|
|
945
|
+
node: "gpt-QUEUE_ID",
|
|
946
|
+
property: DEFAULT_OUTPUT
|
|
947
|
+
}, {
|
|
948
|
+
node: "gpt-APPEND",
|
|
949
|
+
property: "id"
|
|
950
|
+
}).createEdge({
|
|
951
|
+
node: "gpt-GPT",
|
|
952
|
+
property: "messages"
|
|
953
|
+
}, {
|
|
954
|
+
node: "gpt-APPEND",
|
|
955
|
+
property: "items"
|
|
956
|
+
}).createEdge({
|
|
957
|
+
node: "gpt-QUEUE_ID",
|
|
958
|
+
property: DEFAULT_OUTPUT
|
|
959
|
+
}, {
|
|
960
|
+
node: "gpt-OUTPUT",
|
|
961
|
+
property: "queue"
|
|
962
|
+
});
|
|
963
|
+
return space.db.add(model.root);
|
|
964
|
+
});
|
|
965
|
+
cb?.(objects);
|
|
966
|
+
return objects;
|
|
967
|
+
}
|
|
968
|
+
]
|
|
969
|
+
]);
|
|
1146
970
|
|
|
1147
|
-
// src/components/
|
|
1148
|
-
var
|
|
971
|
+
// src/components/index.ts
|
|
972
|
+
var DebugSettings = lazy(() => import("../DebugSettings-Z3XADRNK.mjs"));
|
|
1149
973
|
export {
|
|
1150
|
-
|
|
974
|
+
DebugSettings,
|
|
975
|
+
PresetName,
|
|
976
|
+
SchemaTable,
|
|
977
|
+
createGenerator,
|
|
978
|
+
generator,
|
|
979
|
+
staticGenerators
|
|
1151
980
|
};
|
|
1152
|
-
//# sourceMappingURL=
|
|
981
|
+
//# sourceMappingURL=index.mjs.map
|