@dxos/plugin-debug 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{SpaceGenerator-CGRY2M6A.mjs → SpaceGenerator-NBOQZ4JF.mjs} +41 -42
- package/dist/lib/browser/SpaceGenerator-NBOQZ4JF.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-SSTQU7MF.mjs → app-graph-builder-ALFPRSAR.mjs} +87 -114
- package/dist/lib/browser/app-graph-builder-ALFPRSAR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ZJTKMYOG.mjs → chunk-TCEHALD4.mjs} +4 -5
- package/dist/lib/browser/chunk-TCEHALD4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3 -5
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-BQSJLXPZ.mjs → react-surface-MXXLOQYV.mjs} +41 -32
- package/dist/lib/browser/react-surface-MXXLOQYV.mjs.map +7 -0
- package/dist/lib/browser/{settings-6SG54GZO.mjs → settings-AP74NCXH.mjs} +4 -4
- package/dist/lib/browser/settings-AP74NCXH.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +179 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +178 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Container.d.ts.map +1 -1
- package/dist/types/src/components/DebugApp/Tree.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +2 -2
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +2 -2
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +0 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +4 -5
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +50 -58
- package/src/capabilities/app-graph-builder.ts +374 -418
- package/src/capabilities/react-surface.tsx +19 -43
- package/src/capabilities/settings.ts +2 -2
- package/src/components/DebugObjectPanel.tsx +2 -2
- package/src/components/DebugStatus.tsx +29 -4
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +15 -11
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +1 -1
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +5 -5
- package/src/components/SpaceGenerator/presets.ts +18 -20
- package/src/components/Wireframe.tsx +2 -2
- package/src/components/index.ts +0 -1
- package/src/translations.ts +0 -2
- package/src/types.ts +5 -6
- package/dist/lib/browser/DevtoolsOverviewContainer-HYNZTH2Z.mjs +0 -19
- package/dist/lib/browser/DevtoolsOverviewContainer-HYNZTH2Z.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-CGRY2M6A.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-SSTQU7MF.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZJTKMYOG.mjs.map +0 -7
- package/dist/lib/browser/react-surface-BQSJLXPZ.mjs.map +0 -7
- package/dist/lib/browser/settings-6SG54GZO.mjs.map +0 -7
- package/dist/types/src/components/DevtoolsOverviewContainer.d.ts +0 -4
- package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
- package/src/components/DevtoolsOverviewContainer.tsx +0 -20
|
@@ -13,35 +13,33 @@ import {
|
|
|
13
13
|
createSurface,
|
|
14
14
|
LayoutAction,
|
|
15
15
|
useCapability,
|
|
16
|
-
|
|
17
|
-
type PluginContext,
|
|
16
|
+
type PluginsContext,
|
|
18
17
|
} from '@dxos/app-framework';
|
|
19
18
|
import {
|
|
20
|
-
AutomergePanel,
|
|
21
19
|
ConfigPanel,
|
|
22
20
|
CredentialsPanel,
|
|
23
21
|
DeviceListPanel,
|
|
24
22
|
DiagnosticsPanel,
|
|
25
|
-
EdgeDashboardPanel,
|
|
26
23
|
FeedsPanel,
|
|
27
24
|
IdentityPanel,
|
|
28
|
-
InvocationTraceContainer,
|
|
29
25
|
KeyringPanel,
|
|
30
26
|
LoggingPanel,
|
|
31
27
|
MembersPanel,
|
|
32
28
|
MetadataPanel,
|
|
33
29
|
NetworkPanel,
|
|
34
30
|
ObjectsPanel,
|
|
35
|
-
QueuesPanel,
|
|
36
|
-
SchemaPanel,
|
|
37
31
|
SignalPanel,
|
|
38
32
|
SpaceInfoPanel,
|
|
39
33
|
SpaceListPanel,
|
|
40
34
|
StoragePanel,
|
|
41
35
|
SwarmPanel,
|
|
42
|
-
TestingPanel,
|
|
43
36
|
TracingPanel,
|
|
37
|
+
EdgeDashboardPanel,
|
|
38
|
+
AutomergePanel,
|
|
44
39
|
WorkflowPanel,
|
|
40
|
+
QueuesPanel,
|
|
41
|
+
InvocationTracePanel,
|
|
42
|
+
TestingPanel,
|
|
45
43
|
} from '@dxos/devtools';
|
|
46
44
|
import { SettingsStore } from '@dxos/local-storage';
|
|
47
45
|
import { log } from '@dxos/log';
|
|
@@ -53,21 +51,13 @@ import {
|
|
|
53
51
|
SpaceState,
|
|
54
52
|
isSpace,
|
|
55
53
|
isEchoObject,
|
|
56
|
-
type
|
|
57
|
-
type
|
|
54
|
+
type ReactiveEchoObject,
|
|
55
|
+
type ReactiveObject,
|
|
58
56
|
type Space,
|
|
59
57
|
parseId,
|
|
60
58
|
} from '@dxos/react-client/echo';
|
|
61
59
|
|
|
62
|
-
import {
|
|
63
|
-
DebugApp,
|
|
64
|
-
DebugObjectPanel,
|
|
65
|
-
DebugSettings,
|
|
66
|
-
DebugStatus,
|
|
67
|
-
DevtoolsOverviewContainer,
|
|
68
|
-
SpaceGenerator,
|
|
69
|
-
Wireframe,
|
|
70
|
-
} from '../components';
|
|
60
|
+
import { DebugApp, DebugObjectPanel, DebugSettings, DebugStatus, SpaceGenerator, Wireframe } from '../components';
|
|
71
61
|
import { DEBUG_PLUGIN } from '../meta';
|
|
72
62
|
import { type DebugSettingsProps, Devtools } from '../types';
|
|
73
63
|
|
|
@@ -92,7 +82,7 @@ const useCurrentSpace = () => {
|
|
|
92
82
|
return space;
|
|
93
83
|
};
|
|
94
84
|
|
|
95
|
-
export default (context:
|
|
85
|
+
export default (context: PluginsContext) =>
|
|
96
86
|
contributes(Capabilities.ReactSurface, [
|
|
97
87
|
createSurface({
|
|
98
88
|
id: `${DEBUG_PLUGIN}/plugin-settings`,
|
|
@@ -107,7 +97,7 @@ export default (context: PluginContext) =>
|
|
|
107
97
|
filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
|
|
108
98
|
component: ({ data }) => {
|
|
109
99
|
const handleCreateObject = useCallback(
|
|
110
|
-
(objects:
|
|
100
|
+
(objects: ReactiveObject<any>[]) => {
|
|
111
101
|
if (!isSpace(data.subject.space)) {
|
|
112
102
|
return;
|
|
113
103
|
}
|
|
@@ -119,7 +109,7 @@ export default (context: PluginContext) =>
|
|
|
119
109
|
return;
|
|
120
110
|
}
|
|
121
111
|
|
|
122
|
-
const { dispatchPromise: dispatch } =
|
|
112
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
123
113
|
objects.forEach((object) => {
|
|
124
114
|
void dispatch(createIntent(SpaceAction.AddObject, { target: collection, object }));
|
|
125
115
|
});
|
|
@@ -140,9 +130,9 @@ export default (context: PluginContext) =>
|
|
|
140
130
|
id: `${DEBUG_PLUGIN}/wireframe`,
|
|
141
131
|
role: ['article', 'section'],
|
|
142
132
|
position: 'hoist',
|
|
143
|
-
filter: (data): data is { subject:
|
|
133
|
+
filter: (data): data is { subject: ReactiveEchoObject<any> } => {
|
|
144
134
|
const settings = context
|
|
145
|
-
.
|
|
135
|
+
.requestCapability(Capabilities.SettingsStore)
|
|
146
136
|
.getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
|
|
147
137
|
return isEchoObject(data.subject) && !!settings.wireframe;
|
|
148
138
|
},
|
|
@@ -153,15 +143,10 @@ export default (context: PluginContext) =>
|
|
|
153
143
|
createSurface({
|
|
154
144
|
id: `${DEBUG_PLUGIN}/object-debug`,
|
|
155
145
|
role: 'article',
|
|
156
|
-
filter: (data): data is { companionTo:
|
|
146
|
+
filter: (data): data is { companionTo: ReactiveEchoObject<any> } =>
|
|
157
147
|
data.subject === 'debug' && isEchoObject(data.companionTo),
|
|
158
148
|
component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
|
|
159
149
|
}),
|
|
160
|
-
createSurface({
|
|
161
|
-
id: `${DEBUG_PLUGIN}/devtools-overview`,
|
|
162
|
-
role: 'deck-companion--devtools',
|
|
163
|
-
component: () => <DevtoolsOverviewContainer />,
|
|
164
|
-
}),
|
|
165
150
|
createSurface({
|
|
166
151
|
id: `${DEBUG_PLUGIN}/status`,
|
|
167
152
|
role: 'status',
|
|
@@ -234,7 +219,7 @@ export default (context: PluginContext) =>
|
|
|
234
219
|
role: 'article',
|
|
235
220
|
filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
|
|
236
221
|
component: () => {
|
|
237
|
-
const { dispatchPromise: dispatch } =
|
|
222
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
238
223
|
const handleSelect = useCallback(
|
|
239
224
|
() => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Space] })),
|
|
240
225
|
[dispatch],
|
|
@@ -248,7 +233,7 @@ export default (context: PluginContext) =>
|
|
|
248
233
|
filter: (data): data is any => data.subject === Devtools.Echo.Space,
|
|
249
234
|
component: () => {
|
|
250
235
|
const space = useCurrentSpace();
|
|
251
|
-
const { dispatchPromise: dispatch } =
|
|
236
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
252
237
|
const handleSelect = useCallback(
|
|
253
238
|
() => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Feeds] })),
|
|
254
239
|
[dispatch],
|
|
@@ -274,15 +259,6 @@ export default (context: PluginContext) =>
|
|
|
274
259
|
return <ObjectsPanel space={space} />;
|
|
275
260
|
},
|
|
276
261
|
}),
|
|
277
|
-
createSurface({
|
|
278
|
-
id: `${DEBUG_PLUGIN}/echo/schema`,
|
|
279
|
-
role: 'article',
|
|
280
|
-
filter: (data): data is any => data.subject === Devtools.Echo.Schema,
|
|
281
|
-
component: () => {
|
|
282
|
-
const space = useCurrentSpace();
|
|
283
|
-
return <SchemaPanel space={space} />;
|
|
284
|
-
},
|
|
285
|
-
}),
|
|
286
262
|
createSurface({
|
|
287
263
|
id: `${DEBUG_PLUGIN}/echo/automerge`,
|
|
288
264
|
role: 'article',
|
|
@@ -362,7 +338,7 @@ export default (context: PluginContext) =>
|
|
|
362
338
|
filter: (data): data is any => data.subject === Devtools.Edge.Traces,
|
|
363
339
|
component: () => {
|
|
364
340
|
const space = useCurrentSpace();
|
|
365
|
-
return <
|
|
341
|
+
return <InvocationTracePanel space={space} />;
|
|
366
342
|
},
|
|
367
343
|
}),
|
|
368
344
|
createSurface({
|
|
@@ -370,7 +346,7 @@ export default (context: PluginContext) =>
|
|
|
370
346
|
role: 'article',
|
|
371
347
|
filter: (data): data is any => data.subject === Devtools.Edge.Testing,
|
|
372
348
|
component: () => {
|
|
373
|
-
const { dispatchPromise: dispatch } =
|
|
349
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
374
350
|
const onSpaceCreate = useCallback(
|
|
375
351
|
async (space: Space) => {
|
|
376
352
|
await space.waitUntilReady();
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
-
import {
|
|
6
|
+
import { create } from '@dxos/react-client/echo';
|
|
7
7
|
|
|
8
8
|
import { DEBUG_PLUGIN } from '../meta';
|
|
9
9
|
import { type DebugSettingsProps, DebugSettingsSchema } from '../types';
|
|
10
10
|
|
|
11
11
|
export default () => {
|
|
12
|
-
const settings =
|
|
12
|
+
const settings = create<DebugSettingsProps>({});
|
|
13
13
|
|
|
14
14
|
return contributes(Capabilities.Settings, { schema: DebugSettingsSchema, prefix: DEBUG_PLUGIN, value: settings });
|
|
15
15
|
};
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type ReactiveEchoObject } from '@dxos/client/echo';
|
|
8
8
|
import { Clipboard, Input } from '@dxos/react-ui';
|
|
9
9
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
10
10
|
|
|
11
11
|
export type DebugObjectPanelProps = {
|
|
12
|
-
object:
|
|
12
|
+
object: ReactiveEchoObject<any>;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
// TODO(burdon): Get schema and traverse references.
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
+
import { useAppGraph, useLayout } from '@dxos/app-framework';
|
|
7
8
|
import { TimeoutError } from '@dxos/async';
|
|
8
|
-
import {
|
|
9
|
+
import { StatsPanel, useStats } from '@dxos/devtools';
|
|
10
|
+
import { getActiveSpace } from '@dxos/plugin-space';
|
|
9
11
|
import { StatusBar } from '@dxos/plugin-status-bar';
|
|
10
12
|
import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
|
|
11
13
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
12
|
-
import { Icon } from '@dxos/react-ui';
|
|
14
|
+
import { Icon, Popover } from '@dxos/react-ui';
|
|
13
15
|
|
|
14
16
|
const styles = {
|
|
15
17
|
success: 'text-sky-300 dark:text-green-700',
|
|
@@ -133,7 +135,9 @@ const SwarmIndicator = () => {
|
|
|
133
135
|
// TODO(burdon): Merge with SaveStatus.
|
|
134
136
|
const SavingIndicator = () => {
|
|
135
137
|
const [state, _setState] = useState(0);
|
|
136
|
-
const
|
|
138
|
+
const layout = useLayout();
|
|
139
|
+
const { graph } = useAppGraph();
|
|
140
|
+
const _space = graph ? getActiveSpace(graph, layout.active[0]) : undefined;
|
|
137
141
|
// TODO(dmaretskyi): Fix this when we have save status for automerge.
|
|
138
142
|
// useEffect(() => {
|
|
139
143
|
// if (!space) {
|
|
@@ -176,7 +180,28 @@ const SavingIndicator = () => {
|
|
|
176
180
|
}
|
|
177
181
|
};
|
|
178
182
|
|
|
179
|
-
const
|
|
183
|
+
const PerformanceIndicator = () => {
|
|
184
|
+
const [visible, setVisible] = useState(false);
|
|
185
|
+
const [stats, refreshStats] = useStats();
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<Popover.Root open={visible} onOpenChange={setVisible}>
|
|
189
|
+
<Popover.Trigger asChild>
|
|
190
|
+
<StatusBar.Button onClick={() => setVisible((visible) => !visible)} title='Performance panels'>
|
|
191
|
+
<Icon icon='ph--chart-bar--regular' size={4} />
|
|
192
|
+
</StatusBar.Button>
|
|
193
|
+
</Popover.Trigger>
|
|
194
|
+
<Popover.Portal>
|
|
195
|
+
<Popover.Content classNames='max-is-[min(var(--radix-popover-content-available-width),300px)] max-bs-[--radix-popover-content-available-height]'>
|
|
196
|
+
<StatsPanel stats={stats} onRefresh={refreshStats} />
|
|
197
|
+
<Popover.Arrow />
|
|
198
|
+
</Popover.Content>
|
|
199
|
+
</Popover.Portal>
|
|
200
|
+
</Popover.Root>
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const indicators = [SavingIndicator, SwarmIndicator, PerformanceIndicator, ErrorIndicator];
|
|
180
205
|
|
|
181
206
|
export const DebugStatus = () => {
|
|
182
207
|
return (
|
|
@@ -6,7 +6,7 @@ import { addressToA1Notation } from '@dxos/compute';
|
|
|
6
6
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
|
|
7
7
|
import { ObjectId, type BaseObject, type TypedObject } from '@dxos/echo-schema';
|
|
8
8
|
import { DXN } from '@dxos/keys';
|
|
9
|
-
import {
|
|
9
|
+
import { create, makeRef, type ReactiveObject } from '@dxos/live-object';
|
|
10
10
|
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
11
11
|
import { createSheet } from '@dxos/plugin-sheet/types';
|
|
12
12
|
import { SheetType, type CellValue } from '@dxos/plugin-sheet/types';
|
|
@@ -14,7 +14,7 @@ import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
|
|
|
14
14
|
import { faker } from '@dxos/random';
|
|
15
15
|
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
16
16
|
import { TableType } from '@dxos/react-ui-table';
|
|
17
|
-
import { createView,
|
|
17
|
+
import { createView, TextType } from '@dxos/schema';
|
|
18
18
|
import { createAsyncGenerator, type ValueGenerator } from '@dxos/schema/testing';
|
|
19
19
|
import { range } from '@dxos/util';
|
|
20
20
|
|
|
@@ -31,8 +31,8 @@ const generator: ValueGenerator = faker as any;
|
|
|
31
31
|
export type ObjectGenerator<T extends BaseObject> = (
|
|
32
32
|
space: Space,
|
|
33
33
|
n: number,
|
|
34
|
-
cb?: (objects:
|
|
35
|
-
) => Promise<
|
|
34
|
+
cb?: (objects: ReactiveObject<any>[]) => void,
|
|
35
|
+
) => Promise<ReactiveObject<T>[]>;
|
|
36
36
|
|
|
37
37
|
export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
38
38
|
[
|
|
@@ -40,9 +40,9 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
40
40
|
async (space, n, cb) => {
|
|
41
41
|
const objects = range(n).map(() => {
|
|
42
42
|
return space.db.add(
|
|
43
|
-
|
|
43
|
+
create(DocumentType, {
|
|
44
44
|
name: faker.commerce.productName(),
|
|
45
|
-
content: makeRef(
|
|
45
|
+
content: makeRef(create(TextType, { content: faker.lorem.sentences(5) })),
|
|
46
46
|
threads: [],
|
|
47
47
|
}),
|
|
48
48
|
);
|
|
@@ -58,9 +58,9 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
58
58
|
const objects = range(n).map(() => {
|
|
59
59
|
// TODO(burdon): Generate diagram.
|
|
60
60
|
const obj = space.db.add(
|
|
61
|
-
|
|
61
|
+
create(DiagramType, {
|
|
62
62
|
name: faker.commerce.productName(),
|
|
63
|
-
canvas: makeRef(
|
|
63
|
+
canvas: makeRef(create(CanvasType, { content: {} })),
|
|
64
64
|
}),
|
|
65
65
|
);
|
|
66
66
|
|
|
@@ -139,7 +139,11 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
139
139
|
]);
|
|
140
140
|
|
|
141
141
|
export const createGenerator = <T extends BaseObject>(type: TypedObject<T>): ObjectGenerator<T> => {
|
|
142
|
-
return async (
|
|
142
|
+
return async (
|
|
143
|
+
space: Space,
|
|
144
|
+
n: number,
|
|
145
|
+
cb?: (objects: ReactiveObject<any>[]) => void,
|
|
146
|
+
): Promise<ReactiveObject<T>[]> => {
|
|
143
147
|
// Find or create mutable schema.
|
|
144
148
|
const schema =
|
|
145
149
|
(await space.db.schemaRegistry.query({ typename: type.typename }).firstOrUndefined()) ??
|
|
@@ -150,12 +154,12 @@ export const createGenerator = <T extends BaseObject>(type: TypedObject<T>): Obj
|
|
|
150
154
|
const objects = await generate.createObjects(n);
|
|
151
155
|
|
|
152
156
|
// Find or create table and view.
|
|
153
|
-
const { objects: tables } = await space.db.query(Filter.
|
|
157
|
+
const { objects: tables } = await space.db.query(Filter.schema(TableType)).run();
|
|
154
158
|
const table = tables.find((table) => table.view?.target?.query?.typename === type.typename);
|
|
155
159
|
if (!table) {
|
|
156
160
|
const name = type.typename.split('/').pop() ?? type.typename;
|
|
157
161
|
const view = createView({ name, typename: type.typename, jsonSchema: schema.jsonSchema });
|
|
158
|
-
const table = space.db.add(
|
|
162
|
+
const table = space.db.add(create(TableType, { name, view: makeRef(view) }));
|
|
159
163
|
cb?.([table]);
|
|
160
164
|
}
|
|
161
165
|
|
|
@@ -26,7 +26,7 @@ const meta: Meta = {
|
|
|
26
26
|
title: 'plugins/plugin-debug/SpaceGenerator',
|
|
27
27
|
component: SpaceGenerator,
|
|
28
28
|
render: render(DefaultStory),
|
|
29
|
-
decorators: [withClientProvider({ createSpace: true }), withLayout(), withTheme],
|
|
29
|
+
decorators: [withClientProvider({ createSpace: true }), withLayout({ tooltips: true }), withTheme],
|
|
30
30
|
parameters: {
|
|
31
31
|
layout: 'fullscreen',
|
|
32
32
|
},
|
|
@@ -7,7 +7,7 @@ import React, { useCallback, useMemo, useState } from 'react';
|
|
|
7
7
|
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { ComputeGraph } from '@dxos/conductor';
|
|
9
9
|
import { toEffectSchema } from '@dxos/echo-schema';
|
|
10
|
-
import {
|
|
10
|
+
import { create, type ReactiveObject } from '@dxos/live-object';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
13
13
|
import { SheetType } from '@dxos/plugin-sheet/types';
|
|
@@ -27,14 +27,14 @@ import { presets } from './presets';
|
|
|
27
27
|
|
|
28
28
|
export type SpaceGeneratorProps = {
|
|
29
29
|
space: Space;
|
|
30
|
-
onCreateObjects?: (objects:
|
|
30
|
+
onCreateObjects?: (objects: ReactiveObject<any>[]) => void;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {
|
|
34
34
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
35
35
|
const client = useClient();
|
|
36
36
|
const staticTypes = [DocumentType, DiagramType, SheetType, ComputeGraph]; // TODO(burdon): Make extensible.
|
|
37
|
-
const mutableTypes = [Testing.
|
|
37
|
+
const mutableTypes = [Testing.Org, Testing.Project, Testing.Contact, Testing.Message];
|
|
38
38
|
const [count, setCount] = useState(1);
|
|
39
39
|
const [info, setInfo] = useState<any>({});
|
|
40
40
|
|
|
@@ -111,7 +111,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
111
111
|
schemas.map(async (schema) => {
|
|
112
112
|
const parts = schema.typename.split('/');
|
|
113
113
|
const name = parts[parts.length - 1];
|
|
114
|
-
const table =
|
|
114
|
+
const table = create(TableType, { name, threads: [] });
|
|
115
115
|
await initializeTable({ client, space, table, typename: schema.typename });
|
|
116
116
|
await dispatch(createIntent(SpaceAction.AddObject, { target: space, object: table }));
|
|
117
117
|
return table;
|
|
@@ -125,7 +125,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
125
125
|
log.warn('Missing schema for object', { id, typename });
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
const object =
|
|
128
|
+
const object = create(schema, fields);
|
|
129
129
|
space.db.add(object);
|
|
130
130
|
return object;
|
|
131
131
|
}),
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import { Ref } from '@dxos/echo';
|
|
9
|
-
import { ObjectId, toJsonSchema } from '@dxos/echo-schema';
|
|
10
|
-
import { FunctionTrigger, TriggerKind, EmailTriggerOutput, type TriggerType } from '@dxos/functions';
|
|
5
|
+
import { type ComputeGraphModel, EmailTriggerOutput, NODE_INPUT } from '@dxos/conductor';
|
|
6
|
+
import { AST, ObjectId, S, toJsonSchema } from '@dxos/echo-schema';
|
|
7
|
+
import { FunctionTrigger, TriggerKind, type TriggerType } from '@dxos/functions/types';
|
|
11
8
|
import { invariant } from '@dxos/invariant';
|
|
12
9
|
import { DXN } from '@dxos/keys';
|
|
13
|
-
import {
|
|
10
|
+
import { create, makeRef } from '@dxos/live-object';
|
|
14
11
|
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
15
12
|
import {
|
|
16
13
|
type ComputeShape,
|
|
@@ -134,7 +131,7 @@ export const presets = {
|
|
|
134
131
|
const objects = range(n, () => {
|
|
135
132
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
136
133
|
|
|
137
|
-
const results = space.db.query(Filter.
|
|
134
|
+
const results = space.db.query(Filter.schema(TableType)).runSync();
|
|
138
135
|
const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
|
|
139
136
|
invariant(emailTable, 'Email table not found.');
|
|
140
137
|
|
|
@@ -164,7 +161,7 @@ export const presets = {
|
|
|
164
161
|
|
|
165
162
|
const appendToTable = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
166
163
|
|
|
167
|
-
const properties =
|
|
164
|
+
const properties = AST.getPropertySignatures(EmailTriggerOutput.ast);
|
|
168
165
|
for (let i = 0; i < properties.length; i++) {
|
|
169
166
|
const propName = properties[i].name.toString();
|
|
170
167
|
builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
|
|
@@ -231,7 +228,7 @@ export const presets = {
|
|
|
231
228
|
const objects = range(n, () => {
|
|
232
229
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
233
230
|
|
|
234
|
-
const results = space.db.query(Filter.
|
|
231
|
+
const results = space.db.query(Filter.schema(TableType)).runSync();
|
|
235
232
|
const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
|
|
236
233
|
invariant(emailTable, 'Email table not found.');
|
|
237
234
|
|
|
@@ -283,7 +280,7 @@ export const presets = {
|
|
|
283
280
|
templateContent.push(' "category": "{{text}}",');
|
|
284
281
|
builder.createEdge({ source: gpt.id, target: template.id, input: 'text', output: 'text' });
|
|
285
282
|
|
|
286
|
-
const properties =
|
|
283
|
+
const properties = AST.getPropertySignatures(EmailTriggerOutput.ast);
|
|
287
284
|
for (let i = 0; i < properties.length; i++) {
|
|
288
285
|
const propName = properties[i].name.toString();
|
|
289
286
|
builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
|
|
@@ -307,7 +304,7 @@ export const presets = {
|
|
|
307
304
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
308
305
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
309
306
|
templateComputeNode.value = templateContent.join('\n');
|
|
310
|
-
const extendedSchema =
|
|
307
|
+
const extendedSchema = S.extend(EmailTriggerOutput, S.Struct({ text: S.String }));
|
|
311
308
|
templateComputeNode.inputSchema = toJsonSchema(extendedSchema);
|
|
312
309
|
|
|
313
310
|
attachTrigger(functionTrigger, computeModel);
|
|
@@ -405,11 +402,11 @@ export const presets = {
|
|
|
405
402
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
406
403
|
|
|
407
404
|
// TODO(wittjosiah): Integrate directly w/ Kanban.
|
|
408
|
-
// const results = space.db.query(Filter.
|
|
405
|
+
// const results = space.db.query(Filter.schema(KanbanType)).runSync();
|
|
409
406
|
// const kanban = results.find((r) => r.object?.cardView?.target?.query?.type?.endsWith('Message'));
|
|
410
407
|
// invariant(kanban, 'Kanban not found.');
|
|
411
408
|
|
|
412
|
-
const results = space.db.query(Filter.
|
|
409
|
+
const results = space.db.query(Filter.schema(TableType)).runSync();
|
|
413
410
|
const messages = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Message'));
|
|
414
411
|
invariant(messages, 'Table not found.');
|
|
415
412
|
|
|
@@ -452,7 +449,7 @@ export const presets = {
|
|
|
452
449
|
const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
453
450
|
space: Space,
|
|
454
451
|
triggerKind: SpecType,
|
|
455
|
-
initSpec: (spec: Extract<TriggerType, {
|
|
452
|
+
initSpec: (spec: Extract<TriggerType, { type: SpecType }>) => void,
|
|
456
453
|
triggerOutputName: string,
|
|
457
454
|
) => {
|
|
458
455
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
@@ -494,7 +491,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
494
491
|
|
|
495
492
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
496
493
|
const triggerSpec = functionTrigger.spec;
|
|
497
|
-
invariant(triggerSpec && triggerSpec.
|
|
494
|
+
invariant(triggerSpec && triggerSpec.type === triggerKind, 'No trigger spec.');
|
|
498
495
|
initSpec(triggerSpec as any);
|
|
499
496
|
});
|
|
500
497
|
|
|
@@ -503,7 +500,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
503
500
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
504
501
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
505
502
|
templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
|
|
506
|
-
templateComputeNode.inputSchema = toJsonSchema(
|
|
503
|
+
templateComputeNode.inputSchema = toJsonSchema(S.Struct({ type: S.String, changeId: S.String }));
|
|
507
504
|
|
|
508
505
|
attachTrigger(functionTrigger, computeModel);
|
|
509
506
|
|
|
@@ -512,7 +509,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
512
509
|
|
|
513
510
|
const addToSpace = (name: string, space: Space, canvas: CanvasGraphModel, compute: ComputeGraphModel) => {
|
|
514
511
|
return space.db.add(
|
|
515
|
-
|
|
512
|
+
create(CanvasBoardType, {
|
|
516
513
|
name,
|
|
517
514
|
computeGraph: makeRef(compute.root),
|
|
518
515
|
layout: canvas.graph,
|
|
@@ -542,9 +539,10 @@ const setupQueue = (
|
|
|
542
539
|
|
|
543
540
|
const attachTrigger = (functionTrigger: FunctionTrigger | undefined, computeModel: ComputeGraphModel) => {
|
|
544
541
|
invariant(functionTrigger);
|
|
545
|
-
functionTrigger.function =
|
|
542
|
+
functionTrigger.function = DXN.fromLocalObjectId(computeModel.root.id).toString();
|
|
543
|
+
functionTrigger.meta ??= {};
|
|
546
544
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
547
|
-
functionTrigger.
|
|
545
|
+
functionTrigger.meta.computeNodeId = inputNode.id;
|
|
548
546
|
};
|
|
549
547
|
|
|
550
548
|
type RawPositionInput = { centerX: number; centerY: number; width: number; height: number };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { useResizeDetector } from 'react-resize-detector';
|
|
7
7
|
|
|
8
|
-
import { fullyQualifiedId, type
|
|
8
|
+
import { fullyQualifiedId, type ReactiveEchoObject } from '@dxos/react-client/echo';
|
|
9
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
10
|
import { useAttendableAttributes } from '@dxos/react-ui-attention';
|
|
11
11
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
@@ -14,7 +14,7 @@ import { mx } from '@dxos/react-ui-theme';
|
|
|
14
14
|
// TODO(burdon): Create generic container with wireframe mode.
|
|
15
15
|
export type WireframeProps = ThemedClassName<{
|
|
16
16
|
label?: string;
|
|
17
|
-
object:
|
|
17
|
+
object: ReactiveEchoObject<any>;
|
|
18
18
|
}>;
|
|
19
19
|
|
|
20
20
|
// TODO(burdon): Make focusable and attendable with input.
|
package/src/components/index.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { lazy } from 'react';
|
|
6
6
|
|
|
7
7
|
export const DebugApp = lazy(() => import('./DebugApp'));
|
|
8
|
-
export const DevtoolsOverviewContainer = lazy(() => import('./DevtoolsOverviewContainer'));
|
|
9
8
|
export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
|
|
10
9
|
|
|
11
10
|
export * from './DebugObjectPanel';
|
package/src/translations.ts
CHANGED
|
@@ -13,7 +13,6 @@ export default [
|
|
|
13
13
|
'mutation period': 'Mutation period',
|
|
14
14
|
'open devtools label': 'Open DevTools',
|
|
15
15
|
'devtools label': 'DevTools',
|
|
16
|
-
'devtools overview label': 'DevTools Stats',
|
|
17
16
|
'debug label': 'Debug',
|
|
18
17
|
'settings show debug panel': 'Show Debug panel.',
|
|
19
18
|
'settings show devtools panel': 'Show DevTools panel.',
|
|
@@ -48,7 +47,6 @@ export default [
|
|
|
48
47
|
'space label': 'Space',
|
|
49
48
|
'feeds label': 'Feeds',
|
|
50
49
|
'objects label': 'Objects',
|
|
51
|
-
'schema label': 'Schema',
|
|
52
50
|
'automerge label': 'Automerge',
|
|
53
51
|
'queues label': 'Queues',
|
|
54
52
|
'members label': 'Members',
|
package/src/types.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
5
|
import { type Context, createContext } from 'react';
|
|
7
6
|
|
|
8
7
|
import type { TimerCallback, TimerOptions } from '@dxos/async';
|
|
8
|
+
import { S } from '@dxos/echo-schema';
|
|
9
9
|
|
|
10
10
|
export type DebugContextType = {
|
|
11
11
|
running: boolean;
|
|
@@ -19,13 +19,13 @@ export const DebugContext: Context<DebugContextType> = createContext<DebugContex
|
|
|
19
19
|
stop: () => {},
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
export const DebugSettingsSchema =
|
|
23
|
-
|
|
24
|
-
wireframe:
|
|
22
|
+
export const DebugSettingsSchema = S.mutable(
|
|
23
|
+
S.Struct({
|
|
24
|
+
wireframe: S.optional(S.Boolean),
|
|
25
25
|
}),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
-
export interface DebugSettingsProps extends
|
|
28
|
+
export interface DebugSettingsProps extends S.Schema.Type<typeof DebugSettingsSchema> {}
|
|
29
29
|
|
|
30
30
|
export namespace Devtools {
|
|
31
31
|
// TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
|
|
@@ -54,7 +54,6 @@ export namespace Devtools {
|
|
|
54
54
|
export const Space = `${Devtools.Echo.id}.space`;
|
|
55
55
|
export const Feeds = `${Devtools.Echo.id}.feeds`;
|
|
56
56
|
export const Objects = `${Devtools.Echo.id}.objects`;
|
|
57
|
-
export const Schema = `${Devtools.Echo.id}.schema`;
|
|
58
57
|
export const Automerge = `${Devtools.Echo.id}.automerge`;
|
|
59
58
|
export const Queues = `${Devtools.Echo.id}.queues`;
|
|
60
59
|
export const Members = `${Devtools.Echo.id}.members`;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// packages/plugins/plugin-debug/src/components/DevtoolsOverviewContainer.tsx
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Surface } from "@dxos/app-framework";
|
|
4
|
-
import { StatsPanel, useStats } from "@dxos/devtools";
|
|
5
|
-
var DevtoolsOverviewContainer = () => {
|
|
6
|
-
const [stats, refreshStats] = useStats();
|
|
7
|
-
return /* @__PURE__ */ React.createElement(StatsPanel, {
|
|
8
|
-
stats,
|
|
9
|
-
onRefresh: refreshStats
|
|
10
|
-
}, /* @__PURE__ */ React.createElement(Surface, {
|
|
11
|
-
role: "devtools-overview"
|
|
12
|
-
}));
|
|
13
|
-
};
|
|
14
|
-
var DevtoolsOverviewContainer_default = DevtoolsOverviewContainer;
|
|
15
|
-
export {
|
|
16
|
-
DevtoolsOverviewContainer,
|
|
17
|
-
DevtoolsOverviewContainer_default as default
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=DevtoolsOverviewContainer-HYNZTH2Z.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/DevtoolsOverviewContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Surface } from '@dxos/app-framework';\nimport { StatsPanel, useStats } from '@dxos/devtools';\n\nexport const DevtoolsOverviewContainer = () => {\n const [stats, refreshStats] = useStats();\n\n return (\n <StatsPanel stats={stats} onRefresh={refreshStats}>\n <Surface role='devtools-overview' />\n </StatsPanel>\n );\n};\n\nexport default DevtoolsOverviewContainer;\n"],
|
|
5
|
-
"mappings": ";AAIA,OAAOA,WAAW;AAElB,SAASC,eAAe;AACxB,SAASC,YAAYC,gBAAgB;AAE9B,IAAMC,4BAA4B,MAAA;AACvC,QAAM,CAACC,OAAOC,YAAAA,IAAgBC,SAAAA;AAE9B,SACE,sBAAA,cAACC,YAAAA;IAAWH;IAAcI,WAAWH;KACnC,sBAAA,cAACI,SAAAA;IAAQC,MAAK;;AAGpB;AAEA,IAAA,oCAAeP;",
|
|
6
|
-
"names": ["React", "Surface", "StatsPanel", "useStats", "DevtoolsOverviewContainer", "stats", "refreshStats", "useStats", "StatsPanel", "onRefresh", "Surface", "role"]
|
|
7
|
-
}
|