@dxos/plugin-debug 0.8.4-main.3c1ae3b → 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/neutral/DebugGraph-G4FWS57E.mjs +15 -0
- 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/neutral/app-graph-builder-YPYHL2K5.mjs +577 -0
- 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-WZFZ4ESO.mjs → neutral/chunk-3OGPOE7H.mjs} +2 -2
- package/dist/lib/neutral/chunk-3OGPOE7H.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/{browser/chunk-SRV2AIGJ.mjs → neutral/chunk-NFIOTQRZ.mjs} +30 -9
- package/dist/lib/neutral/chunk-NFIOTQRZ.mjs.map +7 -0
- package/dist/lib/{browser/SpaceGenerator-GYCIEMMO.mjs → neutral/components/index.mjs} +293 -470
- 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/neutral/react-context-MUZ3KVLU.mjs +17 -0
- 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/neutral/settings-MPM6YUP4.mjs +28 -0
- 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 +4 -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 +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +8 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +4 -2
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +7 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +5 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- 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 +1 -48
- 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/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -0
- 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/{components → containers/Wireframe}/Wireframe.d.ts +1 -1
- 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/meta.d.ts +2 -2
- package/dist/types/src/meta.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 +131 -75
- package/src/DebugPlugin.node.ts +18 -0
- package/src/DebugPlugin.test.ts +29 -0
- package/src/DebugPlugin.tsx +28 -34
- package/src/capabilities/app-graph-builder.ts +362 -388
- package/src/capabilities/index.ts +5 -5
- package/src/capabilities/react-context.tsx +16 -7
- package/src/capabilities/react-surface.tsx +377 -356
- package/src/capabilities/settings.ts +24 -12
- 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 +18 -19
- package/src/components/SpaceGenerator/draw-util.ts +8 -8
- package/src/components/SpaceGenerator/index.ts +2 -3
- package/src/components/SpaceGenerator/presets.ts +179 -96
- package/src/components/index.ts +4 -8
- package/src/containers/DebugGraph/DebugGraph.tsx +14 -0
- 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/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +25 -0
- 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 +5 -9
- 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 +3 -3
- 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} +20 -11
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-JXVZVPHN.mjs +0 -25
- package/dist/lib/browser/DevtoolsOverviewContainer-JXVZVPHN.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-GYCIEMMO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs +0 -588
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +0 -7
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -130
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
- package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-RFG63TTF.mjs +0 -774
- package/dist/lib/browser/react-surface-RFG63TTF.mjs.map +0 -7
- package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
- package/dist/lib/browser/settings-SQXR3OAH.mjs.map +0 -7
- 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 -8
- 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 -6
- 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.d.ts.map +0 -1
- 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 -63
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/components/Container.tsx +0 -15
- package/src/components/DebugGraph.tsx +0 -14
- package/src/components/DebugObjectPanel.tsx +0 -33
- package/src/components/DebugSettings.tsx +0 -180
- package/src/components/DevtoolsOverviewContainer.tsx +0 -20
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -52
- 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
|
@@ -1,216 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import React2, { useCallback, useMemo, useState } from "react";
|
|
4
|
-
import { useIntentDispatcher } from "@dxos/app-framework/react";
|
|
5
|
-
import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
|
|
6
|
-
import { Filter as Filter3, Obj as Obj2 } from "@dxos/echo";
|
|
7
|
-
import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
|
|
8
|
-
import { Sheet as Sheet2 } from "@dxos/plugin-sheet/types";
|
|
9
|
-
import { Diagram as Diagram2 } from "@dxos/plugin-sketch/types";
|
|
10
|
-
import { useClient } from "@dxos/react-client";
|
|
11
|
-
import { IconButton as IconButton2, Input, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
12
|
-
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
13
|
-
import { Organization as Organization2, Person as Person2, Task } from "@dxos/types";
|
|
14
|
-
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
1
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
15
2
|
|
|
16
|
-
// src/components/
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (!view && !staticSchema) {
|
|
42
|
-
await dispatch(createIntent(SpaceAction.AddSchema, {
|
|
43
|
-
space,
|
|
44
|
-
schema,
|
|
45
|
-
show: false
|
|
46
|
-
}));
|
|
47
|
-
} else if (!view && staticSchema) {
|
|
48
|
-
await dispatch(createIntent(SpaceAction.UseStaticSchema, {
|
|
49
|
-
space,
|
|
50
|
-
typename,
|
|
51
|
-
show: false
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
const generate = createAsyncGenerator(generator, schema, {
|
|
55
|
-
db: space.db
|
|
56
|
-
});
|
|
57
|
-
return generate.createObjects(n);
|
|
58
|
-
};
|
|
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
|
+
}))));
|
|
59
28
|
};
|
|
60
|
-
var staticGenerators = /* @__PURE__ */ new Map([
|
|
61
|
-
[
|
|
62
|
-
Markdown.Document.typename,
|
|
63
|
-
async (space, n, cb) => {
|
|
64
|
-
const objects = range(n).map(() => {
|
|
65
|
-
return space.db.add(Markdown.make({
|
|
66
|
-
name: faker.commerce.productName(),
|
|
67
|
-
content: faker.lorem.sentences(5)
|
|
68
|
-
}));
|
|
69
|
-
});
|
|
70
|
-
cb?.(objects);
|
|
71
|
-
return objects;
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
[
|
|
75
|
-
Diagram.Diagram.typename,
|
|
76
|
-
async (space, n, cb) => {
|
|
77
|
-
const objects = range(n).map(() => {
|
|
78
|
-
const obj = space.db.add(Diagram.make({
|
|
79
|
-
name: faker.commerce.productName()
|
|
80
|
-
}));
|
|
81
|
-
return obj;
|
|
82
|
-
});
|
|
83
|
-
cb?.(objects);
|
|
84
|
-
return objects;
|
|
85
|
-
}
|
|
86
|
-
],
|
|
87
|
-
// TODO(burdon): Create unit tests.
|
|
88
|
-
[
|
|
89
|
-
Sheet.Sheet.typename,
|
|
90
|
-
async (space, n, cb) => {
|
|
91
|
-
const objects = range(n).map(() => {
|
|
92
|
-
const cells = {};
|
|
93
|
-
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
94
|
-
const cols = 4;
|
|
95
|
-
const rows = 16;
|
|
96
|
-
for (let col = 1; col <= cols; col++) {
|
|
97
|
-
for (let row = 1; row <= rows; row++) {
|
|
98
|
-
const cell = addressToA1Notation({
|
|
99
|
-
col,
|
|
100
|
-
row
|
|
101
|
-
});
|
|
102
|
-
if (row === 1) {
|
|
103
|
-
cells[cell] = {
|
|
104
|
-
value: `${year} Q${col}`
|
|
105
|
-
};
|
|
106
|
-
} else if (row === rows) {
|
|
107
|
-
const from = addressToA1Notation({
|
|
108
|
-
col,
|
|
109
|
-
row: 2
|
|
110
|
-
});
|
|
111
|
-
const to = addressToA1Notation({
|
|
112
|
-
col,
|
|
113
|
-
row: rows - 1
|
|
114
|
-
});
|
|
115
|
-
cells[cell] = {
|
|
116
|
-
value: `=SUM(${from}:${to})`
|
|
117
|
-
};
|
|
118
|
-
} else if (row > 2 && row < rows - 1) {
|
|
119
|
-
cells[cell] = {
|
|
120
|
-
value: Math.floor(Math.random() * 1e4)
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return space.db.add(Sheet.make({
|
|
126
|
-
name: faker.commerce.productName(),
|
|
127
|
-
cells
|
|
128
|
-
}));
|
|
129
|
-
});
|
|
130
|
-
cb?.(objects);
|
|
131
|
-
return objects;
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
[
|
|
135
|
-
ComputeGraph.typename,
|
|
136
|
-
async (space, n, cb) => {
|
|
137
|
-
const objects = range(n, () => {
|
|
138
|
-
const model = ComputeGraphModel.create();
|
|
139
|
-
model.builder.createNode({
|
|
140
|
-
id: "gpt-INPUT",
|
|
141
|
-
type: NODE_INPUT
|
|
142
|
-
}).createNode({
|
|
143
|
-
id: "gpt-GPT",
|
|
144
|
-
type: "gpt"
|
|
145
|
-
}).createNode({
|
|
146
|
-
id: "gpt-QUEUE_ID",
|
|
147
|
-
type: "constant",
|
|
148
|
-
value: new DXN(DXN.kind.QUEUE, [
|
|
149
|
-
"data",
|
|
150
|
-
space.id,
|
|
151
|
-
Key.ObjectId.random()
|
|
152
|
-
]).toString()
|
|
153
|
-
}).createNode({
|
|
154
|
-
id: "gpt-APPEND",
|
|
155
|
-
type: "append"
|
|
156
|
-
}).createNode({
|
|
157
|
-
id: "gpt-OUTPUT",
|
|
158
|
-
type: NODE_OUTPUT
|
|
159
|
-
}).createEdge({
|
|
160
|
-
node: "gpt-INPUT",
|
|
161
|
-
property: "prompt"
|
|
162
|
-
}, {
|
|
163
|
-
node: "gpt-GPT",
|
|
164
|
-
property: "prompt"
|
|
165
|
-
}).createEdge({
|
|
166
|
-
node: "gpt-GPT",
|
|
167
|
-
property: "text"
|
|
168
|
-
}, {
|
|
169
|
-
node: "gpt-OUTPUT",
|
|
170
|
-
property: "text"
|
|
171
|
-
}).createEdge({
|
|
172
|
-
node: "gpt-QUEUE_ID",
|
|
173
|
-
property: DEFAULT_OUTPUT
|
|
174
|
-
}, {
|
|
175
|
-
node: "gpt-APPEND",
|
|
176
|
-
property: "id"
|
|
177
|
-
}).createEdge({
|
|
178
|
-
node: "gpt-GPT",
|
|
179
|
-
property: "messages"
|
|
180
|
-
}, {
|
|
181
|
-
node: "gpt-APPEND",
|
|
182
|
-
property: "items"
|
|
183
|
-
}).createEdge({
|
|
184
|
-
node: "gpt-QUEUE_ID",
|
|
185
|
-
property: DEFAULT_OUTPUT
|
|
186
|
-
}, {
|
|
187
|
-
node: "gpt-OUTPUT",
|
|
188
|
-
property: "queue"
|
|
189
|
-
});
|
|
190
|
-
return space.db.add(model.root);
|
|
191
|
-
});
|
|
192
|
-
cb?.(objects);
|
|
193
|
-
return objects;
|
|
194
|
-
}
|
|
195
|
-
]
|
|
196
|
-
]);
|
|
197
29
|
|
|
198
30
|
// src/components/SpaceGenerator/presets.ts
|
|
199
31
|
import * as Schema from "effect/Schema";
|
|
200
|
-
import {
|
|
201
|
-
import {
|
|
202
|
-
import { NODE_INPUT
|
|
203
|
-
import { DXN
|
|
204
|
-
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";
|
|
205
36
|
import { invariant } from "@dxos/invariant";
|
|
206
|
-
import {
|
|
207
|
-
import { Mailbox } from "@dxos/plugin-inbox
|
|
208
|
-
import { Markdown
|
|
209
|
-
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt,
|
|
210
|
-
import {
|
|
211
|
-
import {
|
|
212
|
-
import { Message, Organization, Person,
|
|
213
|
-
import { range
|
|
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";
|
|
41
|
+
import { CanvasBoard, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
42
|
+
import { ViewModel } from "@dxos/schema";
|
|
43
|
+
import { Message, Organization, Person, Pipeline } from "@dxos/types";
|
|
44
|
+
import { range, trim } from "@dxos/util";
|
|
214
45
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
|
|
215
46
|
var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
216
47
|
PresetName2["DXOS_TEAM"] = "dxos-team";
|
|
@@ -223,9 +54,9 @@ var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
|
223
54
|
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
224
55
|
return PresetName2;
|
|
225
56
|
})({});
|
|
226
|
-
var
|
|
57
|
+
var generator = () => ({
|
|
227
58
|
schemas: [
|
|
228
|
-
|
|
59
|
+
CanvasBoard.CanvasBoard,
|
|
229
60
|
Trigger.Trigger
|
|
230
61
|
],
|
|
231
62
|
types: Object.values(PresetName).map((name) => ({
|
|
@@ -235,12 +66,12 @@ var generator2 = () => ({
|
|
|
235
66
|
[
|
|
236
67
|
"dxos-team",
|
|
237
68
|
async (space, n, cb) => {
|
|
238
|
-
const objects =
|
|
69
|
+
const objects = range(n, () => {
|
|
239
70
|
const org = space.db.add(Obj.make(Organization.Organization, {
|
|
240
71
|
name: "DXOS",
|
|
241
72
|
website: "https://dxos.org"
|
|
242
73
|
}));
|
|
243
|
-
const doc = space.db.add(
|
|
74
|
+
const doc = space.db.add(Markdown.make({
|
|
244
75
|
name: "DXOS Research",
|
|
245
76
|
content: "DXOS builds Composer, an open-source AI-powered malleable application."
|
|
246
77
|
}));
|
|
@@ -248,16 +79,19 @@ var generator2 = () => ({
|
|
|
248
79
|
label: "Investor"
|
|
249
80
|
}));
|
|
250
81
|
const tagDxn = Obj.getDXN(tag).toString();
|
|
251
|
-
Obj.
|
|
252
|
-
|
|
253
|
-
|
|
82
|
+
Obj.update(doc, (doc2) => {
|
|
83
|
+
Obj.getMeta(doc2).tags = [
|
|
84
|
+
tagDxn
|
|
85
|
+
];
|
|
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,48 +152,43 @@ 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
|
-
return space.db.add(
|
|
191
|
+
return space.db.add(Pipeline.make({
|
|
372
192
|
name: "Investor Research",
|
|
373
193
|
columns: [
|
|
374
194
|
{
|
|
@@ -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,41 +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
|
-
]
|
|
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);
|
|
871
686
|
});
|
|
872
|
-
initSpec(triggerSpec);
|
|
873
687
|
});
|
|
874
688
|
const computeModel = createComputeGraph(canvasModel);
|
|
875
689
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
876
|
-
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
877
|
-
F: __dxlog_file,
|
|
878
|
-
L: 682,
|
|
879
|
-
S: void 0,
|
|
880
|
-
A: [
|
|
881
|
-
"templateComputeNode",
|
|
882
|
-
"'Template compute node was not created.'"
|
|
883
|
-
]
|
|
884
|
-
});
|
|
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.'"] });
|
|
885
691
|
templateComputeNode.value = [
|
|
886
692
|
"{",
|
|
887
693
|
' "@type": "{{type}}",',
|
|
888
694
|
' "id": "@{{changeId}}"',
|
|
889
695
|
"}"
|
|
890
696
|
].join("\n");
|
|
891
|
-
templateComputeNode.inputSchema =
|
|
697
|
+
templateComputeNode.inputSchema = JsonSchema.toJsonSchema(Schema.Struct({
|
|
892
698
|
type: Schema.String,
|
|
893
699
|
changeId: Schema.String
|
|
894
700
|
}));
|
|
@@ -899,7 +705,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
899
705
|
};
|
|
900
706
|
};
|
|
901
707
|
var addToSpace = (name, space, canvas, compute) => {
|
|
902
|
-
return space.db.add(Obj.make(
|
|
708
|
+
return space.db.add(Obj.make(CanvasBoard.CanvasBoard, {
|
|
903
709
|
name,
|
|
904
710
|
computeGraph: Ref.make(compute.root),
|
|
905
711
|
layout: canvas.graph
|
|
@@ -907,10 +713,10 @@ var addToSpace = (name, space, canvas, compute) => {
|
|
|
907
713
|
};
|
|
908
714
|
var setupQueue = (space, canvasModel, args) => {
|
|
909
715
|
const queueId = canvasModel.createNode(createConstant({
|
|
910
|
-
value: new
|
|
716
|
+
value: new DXN(DXN.kind.QUEUE, [
|
|
911
717
|
"data",
|
|
912
718
|
space.id,
|
|
913
|
-
|
|
719
|
+
Key.ObjectId.random()
|
|
914
720
|
]).toString(),
|
|
915
721
|
...args?.idPosition ? rawPosition(args.idPosition) : position({
|
|
916
722
|
x: -18,
|
|
@@ -919,7 +725,7 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
919
725
|
height: 6
|
|
920
726
|
})
|
|
921
727
|
}));
|
|
922
|
-
const queue = canvasModel.createNode(
|
|
728
|
+
const queue = canvasModel.createNode(createFeed(args?.queuePosition ? rawPosition(args.queuePosition) : position({
|
|
923
729
|
x: -3,
|
|
924
730
|
y: 3,
|
|
925
731
|
width: 14,
|
|
@@ -935,18 +741,12 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
935
741
|
};
|
|
936
742
|
};
|
|
937
743
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
938
|
-
invariant(functionTrigger, void 0, {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
"functionTrigger",
|
|
944
|
-
""
|
|
945
|
-
]
|
|
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;
|
|
946
749
|
});
|
|
947
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
948
|
-
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT2);
|
|
949
|
-
functionTrigger.inputNodeId = inputNode.id;
|
|
950
750
|
};
|
|
951
751
|
var rawPosition = (args) => {
|
|
952
752
|
return {
|
|
@@ -992,167 +792,190 @@ var position = (rect) => {
|
|
|
992
792
|
}
|
|
993
793
|
};
|
|
994
794
|
|
|
995
|
-
// src/components/SpaceGenerator/
|
|
996
|
-
import {
|
|
997
|
-
import
|
|
998
|
-
import {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
1012
|
-
className: "pli-2 text-right font-mono"
|
|
1013
|
-
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
1014
|
-
variant: "ghost",
|
|
1015
|
-
icon: "ph--plus--regular",
|
|
1016
|
-
iconOnly: true,
|
|
1017
|
-
label: "Create data",
|
|
1018
|
-
onClick: () => onClick(type.typename)
|
|
1019
|
-
}))));
|
|
1020
|
-
} finally {
|
|
1021
|
-
_effect.f();
|
|
1022
|
-
}
|
|
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);
|
|
1023
811
|
};
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
const recordTypes = [
|
|
1038
|
-
Organization2.Organization,
|
|
1039
|
-
Person2.Person,
|
|
1040
|
-
Task.Task
|
|
1041
|
-
];
|
|
1042
|
-
const [count, setCount] = useState(1);
|
|
1043
|
-
const [info, setInfo] = useState({});
|
|
1044
|
-
const presets = useMemo(() => generator2(), []);
|
|
1045
|
-
useAsyncEffect(async () => {
|
|
1046
|
-
await client.addTypes([
|
|
1047
|
-
...staticTypes,
|
|
1048
|
-
...recordTypes,
|
|
1049
|
-
...presets.schemas
|
|
1050
|
-
]);
|
|
1051
|
-
}, [
|
|
1052
|
-
client
|
|
1053
|
-
]);
|
|
1054
|
-
const typeMap = useMemo(() => {
|
|
1055
|
-
const recordGenerators = new Map(recordTypes.map((type) => [
|
|
1056
|
-
type.typename,
|
|
1057
|
-
createGenerator(client, dispatch, type)
|
|
1058
|
-
]));
|
|
1059
|
-
return new Map([
|
|
1060
|
-
...staticGenerators,
|
|
1061
|
-
...presets.items,
|
|
1062
|
-
...recordGenerators
|
|
1063
|
-
]);
|
|
1064
|
-
}, [
|
|
1065
|
-
client,
|
|
1066
|
-
recordTypes
|
|
1067
|
-
]);
|
|
1068
|
-
const updateInfo = async () => {
|
|
1069
|
-
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
1070
|
-
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
1071
|
-
const objects = await space.db.query(Filter3.everything()).run();
|
|
1072
|
-
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
1073
|
-
const type = Obj2.getTypename(obj);
|
|
1074
|
-
if (type) {
|
|
1075
|
-
const count2 = map[type] ?? 0;
|
|
1076
|
-
map[type] = count2 + 1;
|
|
1077
|
-
}
|
|
1078
|
-
return map;
|
|
1079
|
-
}, {}));
|
|
1080
|
-
setInfo({
|
|
1081
|
-
schema: {
|
|
1082
|
-
static: staticSchema.length,
|
|
1083
|
-
mutable: echoSchema.length
|
|
1084
|
-
},
|
|
1085
|
-
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
|
|
1086
825
|
});
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
space
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
if (constructor) {
|
|
1094
|
-
await constructor(space, count, onCreateObjects);
|
|
1095
|
-
await updateInfo();
|
|
1096
|
-
}
|
|
1097
|
-
}, [
|
|
1098
|
-
typeMap,
|
|
1099
|
-
count
|
|
1100
|
-
]);
|
|
1101
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
1102
|
-
role: "none",
|
|
1103
|
-
className: "flex flex-col grow overflow-hidden"
|
|
1104
|
-
}, /* @__PURE__ */ React2.createElement(Toolbar.Root, {
|
|
1105
|
-
classNames: "border-be border-subduedSeparator"
|
|
1106
|
-
}, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
1107
|
-
icon: "ph--arrow-clockwise--regular",
|
|
1108
|
-
iconOnly: true,
|
|
1109
|
-
label: "Refresh",
|
|
1110
|
-
onClick: updateInfo
|
|
1111
|
-
}), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
|
|
1112
|
-
variant: "gap"
|
|
1113
|
-
}), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
1114
|
-
type: "number",
|
|
1115
|
-
min: 1,
|
|
1116
|
-
max: 100,
|
|
1117
|
-
placeholder: "Count",
|
|
1118
|
-
classNames: "!w-[4rem] !text-right",
|
|
1119
|
-
size: 8,
|
|
1120
|
-
value: count,
|
|
1121
|
-
onChange: (ev) => setCount(parseInt(ev.target.value))
|
|
1122
|
-
}))), /* @__PURE__ */ React2.createElement("div", {
|
|
1123
|
-
className: "flex flex-col overflow-y-auto divide-y divide-separator"
|
|
1124
|
-
}, /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1125
|
-
types: staticTypes,
|
|
1126
|
-
objects: info.objects,
|
|
1127
|
-
label: "Static Types",
|
|
1128
|
-
onClick: handleCreateData
|
|
1129
|
-
}), /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1130
|
-
types: recordTypes,
|
|
1131
|
-
objects: info.objects,
|
|
1132
|
-
label: "Record Types",
|
|
1133
|
-
onClick: handleCreateData
|
|
1134
|
-
}), /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1135
|
-
types: presets.types,
|
|
1136
|
-
objects: info.objects,
|
|
1137
|
-
label: "Presets",
|
|
1138
|
-
onClick: handleCreateData
|
|
1139
|
-
}), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
|
|
1140
|
-
language: "json",
|
|
1141
|
-
classNames: "text-xs"
|
|
1142
|
-
}, JSON.stringify({
|
|
1143
|
-
space,
|
|
1144
|
-
...info
|
|
1145
|
-
}, jsonKeyReplacer({
|
|
1146
|
-
truncate: true
|
|
1147
|
-
}), 2)))));
|
|
1148
|
-
} finally {
|
|
1149
|
-
_effect.f();
|
|
1150
|
-
}
|
|
826
|
+
}
|
|
827
|
+
const generate = createAsyncGenerator(generator2, schema, {
|
|
828
|
+
db: space.db
|
|
829
|
+
});
|
|
830
|
+
return generate.createObjects(n);
|
|
831
|
+
};
|
|
1151
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
|
+
]);
|
|
1152
970
|
|
|
1153
|
-
// src/components/
|
|
1154
|
-
var
|
|
971
|
+
// src/components/index.ts
|
|
972
|
+
var DebugSettings = lazy(() => import("../DebugSettings-Z3XADRNK.mjs"));
|
|
1155
973
|
export {
|
|
1156
|
-
|
|
974
|
+
DebugSettings,
|
|
975
|
+
PresetName,
|
|
976
|
+
SchemaTable,
|
|
977
|
+
createGenerator,
|
|
978
|
+
generator,
|
|
979
|
+
staticGenerators
|
|
1157
980
|
};
|
|
1158
|
-
//# sourceMappingURL=
|
|
981
|
+
//# sourceMappingURL=index.mjs.map
|