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