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