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