@dxos/plugin-debug 0.8.4-main.e098934 → 0.8.4-main.e8ec1fe
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/{DevtoolsOverviewContainer-EPD6EWT5.mjs → DevtoolsOverviewContainer-JXVZVPHN.mjs} +2 -2
- package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs.map → DevtoolsOverviewContainer-JXVZVPHN.mjs.map} +1 -1
- package/dist/lib/browser/{SpaceGenerator-SRCIEELZ.mjs → SpaceGenerator-46TAISVE.mjs} +142 -90
- package/dist/lib/browser/SpaceGenerator-46TAISVE.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-JTIEFOWZ.mjs → app-graph-builder-CRH2HJKT.mjs} +60 -59
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-SRV2AIGJ.mjs} +2 -2
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs +20 -0
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +11 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-NVAGLAJD.mjs → react-context-P2YDWEWI.mjs} +6 -6
- package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-HQPOGG33.mjs → react-surface-2SNVZDEA.mjs} +85 -84
- package/dist/lib/browser/react-surface-2SNVZDEA.mjs.map +7 -0
- package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-SQXR3OAH.mjs} +5 -5
- package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-SQXR3OAH.mjs.map} +1 -1
- package/dist/types/src/DebugPlugin.d.ts +1 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- 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/SpaceGenerator/ObjectGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +4 -4
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +67 -66
- package/src/DebugPlugin.tsx +5 -6
- package/src/capabilities/app-graph-builder.ts +59 -58
- package/src/capabilities/react-context.tsx +2 -2
- package/src/capabilities/react-surface.tsx +70 -50
- package/src/components/DebugObjectPanel.tsx +2 -4
- package/src/components/DebugSettings.tsx +39 -18
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/DevtoolsOverviewContainer.tsx +1 -1
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +16 -22
- package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +3 -5
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +6 -6
- package/src/components/SpaceGenerator/draw-util.ts +2 -2
- package/src/components/SpaceGenerator/presets.ts +124 -59
- package/src/components/Wireframe.tsx +2 -3
- package/src/meta.ts +6 -5
- package/src/translations.ts +1 -1
- package/src/types.ts +1 -1
- package/dist/lib/browser/SpaceGenerator-SRCIEELZ.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-JTIEFOWZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-5XPIRNQS.mjs +0 -18
- package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
- package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
- package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-HQPOGG33.mjs.map +0 -7
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Function from 'effect/Function';
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
7
7
|
|
|
8
8
|
import {
|
|
@@ -13,9 +13,8 @@ import {
|
|
|
13
13
|
contributes,
|
|
14
14
|
createIntent,
|
|
15
15
|
createSurface,
|
|
16
|
-
useCapability,
|
|
17
|
-
useIntentDispatcher,
|
|
18
16
|
} from '@dxos/app-framework';
|
|
17
|
+
import { useCapability, useIntentDispatcher } from '@dxos/app-framework/react';
|
|
19
18
|
import {
|
|
20
19
|
AutomergePanel,
|
|
21
20
|
ConfigPanel,
|
|
@@ -52,7 +51,7 @@ import { ScriptAction } from '@dxos/plugin-script/types';
|
|
|
52
51
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
53
52
|
import { type Space, SpaceState, isSpace, parseId } from '@dxos/react-client/echo';
|
|
54
53
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
55
|
-
import {
|
|
54
|
+
import { Collection } from '@dxos/schema';
|
|
56
55
|
|
|
57
56
|
import {
|
|
58
57
|
DebugGraph,
|
|
@@ -63,7 +62,7 @@ import {
|
|
|
63
62
|
SpaceGenerator,
|
|
64
63
|
Wireframe,
|
|
65
64
|
} from '../components';
|
|
66
|
-
import {
|
|
65
|
+
import { meta } from '../meta';
|
|
67
66
|
import { type DebugSettingsProps, Devtools } from '../types';
|
|
68
67
|
|
|
69
68
|
type SpaceDebug = {
|
|
@@ -76,7 +75,7 @@ type GraphDebug = {
|
|
|
76
75
|
root: string;
|
|
77
76
|
};
|
|
78
77
|
|
|
79
|
-
const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${
|
|
78
|
+
const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${meta.id}/space` && isSpace(data.space);
|
|
80
79
|
const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph && typeof data?.root === 'string';
|
|
81
80
|
|
|
82
81
|
// TODO(wittjosiah): Factor out?
|
|
@@ -91,14 +90,14 @@ const useCurrentSpace = () => {
|
|
|
91
90
|
export default (context: PluginContext) =>
|
|
92
91
|
contributes(Capabilities.ReactSurface, [
|
|
93
92
|
createSurface({
|
|
94
|
-
id: `${
|
|
93
|
+
id: `${meta.id}/plugin-settings`,
|
|
95
94
|
role: 'article',
|
|
96
95
|
filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
|
|
97
|
-
data.subject instanceof SettingsStore && data.subject.prefix ===
|
|
96
|
+
data.subject instanceof SettingsStore && data.subject.prefix === meta.id,
|
|
98
97
|
component: ({ data: { subject } }) => <DebugSettings settings={subject.value} />,
|
|
99
98
|
}),
|
|
100
99
|
createSurface({
|
|
101
|
-
id: `${
|
|
100
|
+
id: `${meta.id}/space`,
|
|
102
101
|
role: 'article',
|
|
103
102
|
filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
|
|
104
103
|
component: ({ data }) => {
|
|
@@ -112,13 +111,18 @@ export default (context: PluginContext) =>
|
|
|
112
111
|
|
|
113
112
|
const collection =
|
|
114
113
|
data.subject.space.state.get() === SpaceState.SPACE_READY &&
|
|
115
|
-
data.subject.space.properties[
|
|
116
|
-
if (!Obj.instanceOf(
|
|
114
|
+
data.subject.space.properties[Collection.Collection.typename]?.target;
|
|
115
|
+
if (!Obj.instanceOf(Collection.Collection, collection)) {
|
|
117
116
|
return;
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
objects.forEach((object) => {
|
|
121
|
-
void dispatch(
|
|
120
|
+
void dispatch(
|
|
121
|
+
createIntent(SpaceAction.AddObject, {
|
|
122
|
+
target: collection,
|
|
123
|
+
object,
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
122
126
|
});
|
|
123
127
|
},
|
|
124
128
|
[data.subject.space],
|
|
@@ -132,19 +136,17 @@ export default (context: PluginContext) =>
|
|
|
132
136
|
},
|
|
133
137
|
}),
|
|
134
138
|
createSurface({
|
|
135
|
-
id: `${
|
|
139
|
+
id: `${meta.id}/app-graph`,
|
|
136
140
|
role: 'article',
|
|
137
141
|
filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
|
|
138
142
|
component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
|
|
139
143
|
}),
|
|
140
144
|
createSurface({
|
|
141
|
-
id: `${
|
|
145
|
+
id: `${meta.id}/wireframe`,
|
|
142
146
|
role: ['article', 'section'],
|
|
143
147
|
position: 'hoist',
|
|
144
148
|
filter: (data): data is { subject: Obj.Any } => {
|
|
145
|
-
const settings = context
|
|
146
|
-
.getCapability(Capabilities.SettingsStore)
|
|
147
|
-
.getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
|
|
149
|
+
const settings = context.getCapability(Capabilities.SettingsStore).getStore<DebugSettingsProps>(meta.id)!.value;
|
|
148
150
|
return Obj.isObject(data.subject) && !!settings.wireframe;
|
|
149
151
|
},
|
|
150
152
|
component: ({ data, role }) => (
|
|
@@ -152,18 +154,18 @@ export default (context: PluginContext) =>
|
|
|
152
154
|
),
|
|
153
155
|
}),
|
|
154
156
|
createSurface({
|
|
155
|
-
id: `${
|
|
157
|
+
id: `${meta.id}/object-debug`,
|
|
156
158
|
role: 'article',
|
|
157
159
|
filter: (data): data is { companionTo: Obj.Any } => data.subject === 'debug' && Obj.isObject(data.companionTo),
|
|
158
160
|
component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
|
|
159
161
|
}),
|
|
160
162
|
createSurface({
|
|
161
|
-
id: `${
|
|
163
|
+
id: `${meta.id}/devtools-overview`,
|
|
162
164
|
role: 'deck-companion--devtools',
|
|
163
165
|
component: () => <DevtoolsOverviewContainer />,
|
|
164
166
|
}),
|
|
165
167
|
createSurface({
|
|
166
|
-
id: `${
|
|
168
|
+
id: `${meta.id}/status`,
|
|
167
169
|
role: 'status',
|
|
168
170
|
component: () => <DebugStatus />,
|
|
169
171
|
}),
|
|
@@ -173,55 +175,55 @@ export default (context: PluginContext) =>
|
|
|
173
175
|
//
|
|
174
176
|
|
|
175
177
|
createSurface({
|
|
176
|
-
id: `${
|
|
178
|
+
id: `${meta.id}/client/config`,
|
|
177
179
|
role: 'article',
|
|
178
180
|
filter: (data): data is any => data.subject === Devtools.Client.Config,
|
|
179
181
|
component: () => <ConfigPanel vaultSelector={false} />,
|
|
180
182
|
}),
|
|
181
183
|
createSurface({
|
|
182
|
-
id: `${
|
|
184
|
+
id: `${meta.id}/client/storage`,
|
|
183
185
|
role: 'article',
|
|
184
186
|
filter: (data): data is any => data.subject === Devtools.Client.Storage,
|
|
185
187
|
component: () => <StoragePanel />,
|
|
186
188
|
}),
|
|
187
189
|
createSurface({
|
|
188
|
-
id: `${
|
|
190
|
+
id: `${meta.id}/client/logs`,
|
|
189
191
|
role: 'article',
|
|
190
192
|
filter: (data): data is any => data.subject === Devtools.Client.Logs,
|
|
191
193
|
component: () => <LoggingPanel />,
|
|
192
194
|
}),
|
|
193
195
|
createSurface({
|
|
194
|
-
id: `${
|
|
196
|
+
id: `${meta.id}/client/diagnostics`,
|
|
195
197
|
role: 'article',
|
|
196
198
|
filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
|
|
197
199
|
component: () => <DiagnosticsPanel />,
|
|
198
200
|
}),
|
|
199
201
|
createSurface({
|
|
200
|
-
id: `${
|
|
202
|
+
id: `${meta.id}/client/tracing`,
|
|
201
203
|
role: 'article',
|
|
202
204
|
filter: (data): data is any => data.subject === Devtools.Client.Tracing,
|
|
203
205
|
component: () => <TracingPanel />,
|
|
204
206
|
}),
|
|
205
207
|
createSurface({
|
|
206
|
-
id: `${
|
|
208
|
+
id: `${meta.id}/halo/identity`,
|
|
207
209
|
role: 'article',
|
|
208
210
|
filter: (data): data is any => data.subject === Devtools.Halo.Identity,
|
|
209
211
|
component: () => <IdentityPanel />,
|
|
210
212
|
}),
|
|
211
213
|
createSurface({
|
|
212
|
-
id: `${
|
|
214
|
+
id: `${meta.id}/halo/devices`,
|
|
213
215
|
role: 'article',
|
|
214
216
|
filter: (data): data is any => data.subject === Devtools.Halo.Devices,
|
|
215
217
|
component: () => <DeviceListPanel />,
|
|
216
218
|
}),
|
|
217
219
|
createSurface({
|
|
218
|
-
id: `${
|
|
220
|
+
id: `${meta.id}/halo/keyring`,
|
|
219
221
|
role: 'article',
|
|
220
222
|
filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
|
|
221
223
|
component: () => <KeyringPanel />,
|
|
222
224
|
}),
|
|
223
225
|
createSurface({
|
|
224
|
-
id: `${
|
|
226
|
+
id: `${meta.id}/halo/credentials`,
|
|
225
227
|
role: 'article',
|
|
226
228
|
filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
|
|
227
229
|
component: () => {
|
|
@@ -230,34 +232,46 @@ export default (context: PluginContext) =>
|
|
|
230
232
|
},
|
|
231
233
|
}),
|
|
232
234
|
createSurface({
|
|
233
|
-
id: `${
|
|
235
|
+
id: `${meta.id}/echo/spaces`,
|
|
234
236
|
role: 'article',
|
|
235
237
|
filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
|
|
236
238
|
component: () => {
|
|
237
239
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
238
240
|
const handleSelect = useCallback(
|
|
239
|
-
() =>
|
|
241
|
+
() =>
|
|
242
|
+
dispatch(
|
|
243
|
+
createIntent(LayoutAction.Open, {
|
|
244
|
+
part: 'main',
|
|
245
|
+
subject: [Devtools.Echo.Space],
|
|
246
|
+
}),
|
|
247
|
+
),
|
|
240
248
|
[dispatch],
|
|
241
249
|
);
|
|
242
250
|
return <SpaceListPanel onSelect={handleSelect} />;
|
|
243
251
|
},
|
|
244
252
|
}),
|
|
245
253
|
createSurface({
|
|
246
|
-
id: `${
|
|
254
|
+
id: `${meta.id}/echo/space`,
|
|
247
255
|
role: 'article',
|
|
248
256
|
filter: (data): data is any => data.subject === Devtools.Echo.Space,
|
|
249
257
|
component: () => {
|
|
250
258
|
const space = useCurrentSpace();
|
|
251
259
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
252
260
|
const handleSelect = useCallback(
|
|
253
|
-
() =>
|
|
261
|
+
() =>
|
|
262
|
+
dispatch(
|
|
263
|
+
createIntent(LayoutAction.Open, {
|
|
264
|
+
part: 'main',
|
|
265
|
+
subject: [Devtools.Echo.Feeds],
|
|
266
|
+
}),
|
|
267
|
+
),
|
|
254
268
|
[dispatch],
|
|
255
269
|
);
|
|
256
270
|
return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
|
|
257
271
|
},
|
|
258
272
|
}),
|
|
259
273
|
createSurface({
|
|
260
|
-
id: `${
|
|
274
|
+
id: `${meta.id}/echo/feeds`,
|
|
261
275
|
role: 'article',
|
|
262
276
|
filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
|
|
263
277
|
component: () => {
|
|
@@ -266,7 +280,7 @@ export default (context: PluginContext) =>
|
|
|
266
280
|
},
|
|
267
281
|
}),
|
|
268
282
|
createSurface({
|
|
269
|
-
id: `${
|
|
283
|
+
id: `${meta.id}/echo/objects`,
|
|
270
284
|
role: 'article',
|
|
271
285
|
filter: (data): data is any => data.subject === Devtools.Echo.Objects,
|
|
272
286
|
component: () => {
|
|
@@ -275,7 +289,7 @@ export default (context: PluginContext) =>
|
|
|
275
289
|
},
|
|
276
290
|
}),
|
|
277
291
|
createSurface({
|
|
278
|
-
id: `${
|
|
292
|
+
id: `${meta.id}/echo/schema`,
|
|
279
293
|
role: 'article',
|
|
280
294
|
filter: (data): data is any => data.subject === Devtools.Echo.Schema,
|
|
281
295
|
component: () => {
|
|
@@ -284,7 +298,7 @@ export default (context: PluginContext) =>
|
|
|
284
298
|
},
|
|
285
299
|
}),
|
|
286
300
|
createSurface({
|
|
287
|
-
id: `${
|
|
301
|
+
id: `${meta.id}/echo/automerge`,
|
|
288
302
|
role: 'article',
|
|
289
303
|
filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
|
|
290
304
|
component: () => {
|
|
@@ -293,13 +307,13 @@ export default (context: PluginContext) =>
|
|
|
293
307
|
},
|
|
294
308
|
}),
|
|
295
309
|
createSurface({
|
|
296
|
-
id: `${
|
|
310
|
+
id: `${meta.id}/echo/queues`,
|
|
297
311
|
role: 'article',
|
|
298
312
|
filter: (data): data is any => data.subject === Devtools.Echo.Queues,
|
|
299
313
|
component: () => <QueuesPanel />,
|
|
300
314
|
}),
|
|
301
315
|
createSurface({
|
|
302
|
-
id: `${
|
|
316
|
+
id: `${meta.id}/echo/members`,
|
|
303
317
|
role: 'article',
|
|
304
318
|
filter: (data): data is any => data.subject === Devtools.Echo.Members,
|
|
305
319
|
component: () => {
|
|
@@ -308,25 +322,25 @@ export default (context: PluginContext) =>
|
|
|
308
322
|
},
|
|
309
323
|
}),
|
|
310
324
|
createSurface({
|
|
311
|
-
id: `${
|
|
325
|
+
id: `${meta.id}/echo/metadata`,
|
|
312
326
|
role: 'article',
|
|
313
327
|
filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
|
|
314
328
|
component: () => <MetadataPanel />,
|
|
315
329
|
}),
|
|
316
330
|
createSurface({
|
|
317
|
-
id: `${
|
|
331
|
+
id: `${meta.id}/mesh/signal`,
|
|
318
332
|
role: 'article',
|
|
319
333
|
filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
|
|
320
334
|
component: () => <SignalPanel />,
|
|
321
335
|
}),
|
|
322
336
|
createSurface({
|
|
323
|
-
id: `${
|
|
337
|
+
id: `${meta.id}/mesh/swarm`,
|
|
324
338
|
role: 'article',
|
|
325
339
|
filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
|
|
326
340
|
component: () => <SwarmPanel />,
|
|
327
341
|
}),
|
|
328
342
|
createSurface({
|
|
329
|
-
id: `${
|
|
343
|
+
id: `${meta.id}/mesh/network`,
|
|
330
344
|
role: 'article',
|
|
331
345
|
filter: (data): data is any => data.subject === Devtools.Mesh.Network,
|
|
332
346
|
component: () => {
|
|
@@ -336,19 +350,19 @@ export default (context: PluginContext) =>
|
|
|
336
350
|
}),
|
|
337
351
|
// TODO(wittjosiah): Remove?
|
|
338
352
|
// createSurface({
|
|
339
|
-
// id: `${
|
|
353
|
+
// id: `${meta.id}/agent/dashboard`,
|
|
340
354
|
// role: 'article',
|
|
341
355
|
// filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
|
|
342
356
|
// component: () => <DashboardPanel />,
|
|
343
357
|
// }),
|
|
344
358
|
createSurface({
|
|
345
|
-
id: `${
|
|
359
|
+
id: `${meta.id}/edge/dashboard`,
|
|
346
360
|
role: 'article',
|
|
347
361
|
filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
|
|
348
362
|
component: () => <EdgeDashboardPanel />,
|
|
349
363
|
}),
|
|
350
364
|
createSurface({
|
|
351
|
-
id: `${
|
|
365
|
+
id: `${meta.id}/edge/workflows`,
|
|
352
366
|
role: 'article',
|
|
353
367
|
filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
|
|
354
368
|
component: () => {
|
|
@@ -357,7 +371,7 @@ export default (context: PluginContext) =>
|
|
|
357
371
|
},
|
|
358
372
|
}),
|
|
359
373
|
createSurface({
|
|
360
|
-
id: `${
|
|
374
|
+
id: `${meta.id}/edge/traces`,
|
|
361
375
|
role: 'article',
|
|
362
376
|
filter: (data): data is any => data.subject === Devtools.Edge.Traces,
|
|
363
377
|
component: () => {
|
|
@@ -366,7 +380,7 @@ export default (context: PluginContext) =>
|
|
|
366
380
|
},
|
|
367
381
|
}),
|
|
368
382
|
createSurface({
|
|
369
|
-
id: `${
|
|
383
|
+
id: `${meta.id}/edge/testing`,
|
|
370
384
|
role: 'article',
|
|
371
385
|
filter: (data): data is any => data.subject === Devtools.Edge.Testing,
|
|
372
386
|
component: () => {
|
|
@@ -383,11 +397,17 @@ export default (context: PluginContext) =>
|
|
|
383
397
|
async (space: Space) => {
|
|
384
398
|
await space.waitUntilReady();
|
|
385
399
|
const result = await dispatch(
|
|
386
|
-
pipe(
|
|
400
|
+
Function.pipe(
|
|
401
|
+
createIntent(ScriptAction.CreateScript, { space }),
|
|
402
|
+
chain(SpaceAction.AddObject, { target: space }),
|
|
403
|
+
),
|
|
387
404
|
);
|
|
388
405
|
log.info('script created', { result });
|
|
389
406
|
await dispatch(
|
|
390
|
-
createIntent(LayoutAction.Open, {
|
|
407
|
+
createIntent(LayoutAction.Open, {
|
|
408
|
+
part: 'main',
|
|
409
|
+
subject: [`${space.id}:${result.data?.object.id}`],
|
|
410
|
+
}),
|
|
391
411
|
);
|
|
392
412
|
},
|
|
393
413
|
[dispatch],
|
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import { type Obj } from '@dxos/echo';
|
|
8
8
|
import { Clipboard, Input, Toolbar } from '@dxos/react-ui';
|
|
9
9
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
10
|
-
import {
|
|
10
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
11
11
|
|
|
12
12
|
export type DebugObjectPanelProps = {
|
|
13
13
|
object: Obj.Any;
|
|
@@ -26,9 +26,7 @@ export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
|
|
|
26
26
|
<Clipboard.IconButton value={dxn} />
|
|
27
27
|
</Input.Root>
|
|
28
28
|
</Toolbar.Root>
|
|
29
|
-
<
|
|
30
|
-
{JSON.stringify(object, null, 2)}
|
|
31
|
-
</SyntaxHighlighter>
|
|
29
|
+
<Json data={object} />
|
|
32
30
|
</StackItem.Content>
|
|
33
31
|
</Clipboard.Provider>
|
|
34
32
|
);
|
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Capabilities
|
|
7
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
+
import { useCapabilities } from '@dxos/app-framework/react';
|
|
8
9
|
import { type ConfigProto, SaveConfig, Storage, defs } from '@dxos/config';
|
|
9
10
|
import { log } from '@dxos/log';
|
|
10
11
|
import { useClient } from '@dxos/react-client';
|
|
11
|
-
import {
|
|
12
|
+
import { Icon, IconButton, Input, Select, Toast, useFileDownload, useTranslation } from '@dxos/react-ui';
|
|
12
13
|
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
13
14
|
import { setDeep } from '@dxos/util';
|
|
14
15
|
|
|
15
|
-
import {
|
|
16
|
+
import { meta } from '../meta';
|
|
16
17
|
import { type DebugSettingsProps } from '../types';
|
|
17
18
|
|
|
18
19
|
type Toast = {
|
|
@@ -26,7 +27,7 @@ const StorageAdapters = {
|
|
|
26
27
|
} as const;
|
|
27
28
|
|
|
28
29
|
export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) => {
|
|
29
|
-
const { t } = useTranslation(
|
|
30
|
+
const { t } = useTranslation(meta.id);
|
|
30
31
|
const [toast, setToast] = useState<Toast>();
|
|
31
32
|
const client = useClient();
|
|
32
33
|
const download = useFileDownload();
|
|
@@ -46,22 +47,30 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
46
47
|
|
|
47
48
|
const handleDownload = async () => {
|
|
48
49
|
const data = await client.diagnostics();
|
|
49
|
-
const file = new Blob([JSON.stringify(data, undefined, 2)], {
|
|
50
|
+
const file = new Blob([JSON.stringify(data, undefined, 2)], {
|
|
51
|
+
type: 'text/plain',
|
|
52
|
+
});
|
|
50
53
|
const fileName = `composer-${new Date().toISOString().replace(/\W/g, '-')}.json`;
|
|
51
54
|
download(file, fileName);
|
|
52
55
|
|
|
53
56
|
if (upload) {
|
|
54
|
-
const info = await upload(new File([file], fileName)
|
|
57
|
+
const info = await upload(client.spaces.default, new File([file], fileName));
|
|
55
58
|
if (!info) {
|
|
56
59
|
log.error('diagnostics failed to upload to IPFS');
|
|
57
60
|
return;
|
|
58
61
|
}
|
|
59
|
-
handleToast({
|
|
62
|
+
handleToast({
|
|
63
|
+
title: t('settings uploaded'),
|
|
64
|
+
description: t('settings uploaded to clipboard'),
|
|
65
|
+
});
|
|
60
66
|
|
|
61
67
|
// TODO(nf): move to IpfsPlugin?
|
|
62
68
|
const url = client.config.values.runtime!.services!.ipfs!.gateway + '/' + info.cid;
|
|
63
69
|
void navigator.clipboard.writeText(url);
|
|
64
|
-
handleToast({
|
|
70
|
+
handleToast({
|
|
71
|
+
title: t('settings uploaded'),
|
|
72
|
+
description: t('settings uploaded to clipboard'),
|
|
73
|
+
});
|
|
65
74
|
log.info('diagnostics', { url });
|
|
66
75
|
}
|
|
67
76
|
};
|
|
@@ -70,15 +79,21 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
70
79
|
try {
|
|
71
80
|
const info = await client.repair();
|
|
72
81
|
setStorageConfig(await Storage());
|
|
73
|
-
handleToast({
|
|
82
|
+
handleToast({
|
|
83
|
+
title: t('settings repair success'),
|
|
84
|
+
description: JSON.stringify(info, undefined, 2),
|
|
85
|
+
});
|
|
74
86
|
} catch (err: any) {
|
|
75
|
-
handleToast({
|
|
87
|
+
handleToast({
|
|
88
|
+
title: t('settings repair failed'),
|
|
89
|
+
description: err.message,
|
|
90
|
+
});
|
|
76
91
|
}
|
|
77
92
|
};
|
|
78
93
|
|
|
79
94
|
return (
|
|
80
95
|
<ControlPage>
|
|
81
|
-
<ControlSection title={t('settings title', { ns:
|
|
96
|
+
<ControlSection title={t('settings title', { ns: meta.id })}>
|
|
82
97
|
<ControlGroup>
|
|
83
98
|
<ControlItemInput title={t('settings wireframe')}>
|
|
84
99
|
<Input.Switch
|
|
@@ -87,14 +102,20 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
87
102
|
/>
|
|
88
103
|
</ControlItemInput>
|
|
89
104
|
<ControlItemInput title={t('settings download diagnostics')}>
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
105
|
+
<IconButton
|
|
106
|
+
icon='ph--download-simple--regular'
|
|
107
|
+
iconOnly
|
|
108
|
+
label={t('settings download diagnostics')}
|
|
109
|
+
onClick={handleDownload}
|
|
110
|
+
/>
|
|
93
111
|
</ControlItemInput>
|
|
94
112
|
<ControlItemInput title={t('settings repair')}>
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
113
|
+
<IconButton
|
|
114
|
+
icon='ph--first-aid-kit--regular'
|
|
115
|
+
iconOnly
|
|
116
|
+
label={t('settings repair')}
|
|
117
|
+
onClick={handleRepair}
|
|
118
|
+
/>
|
|
98
119
|
</ControlItemInput>
|
|
99
120
|
|
|
100
121
|
{/* TODO(burdon): Move to layout? */}
|
|
@@ -114,7 +135,7 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
114
135
|
<Select.Root
|
|
115
136
|
value={
|
|
116
137
|
Object.entries(StorageAdapters).find(
|
|
117
|
-
([
|
|
138
|
+
([_name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
|
|
118
139
|
)?.[0]
|
|
119
140
|
}
|
|
120
141
|
onValueChange={(value) => {
|
|
@@ -59,7 +59,7 @@ const _timer = (cb: (err?: Error) => void, options?: { min?: number; max?: numbe
|
|
|
59
59
|
// TODO(burdon): Integrate with Sentry?
|
|
60
60
|
const ErrorIndicator = () => {
|
|
61
61
|
const [, forceUpdate] = useState({});
|
|
62
|
-
const errorRef = useRef<Error>();
|
|
62
|
+
const errorRef = useRef<Error>(null);
|
|
63
63
|
useEffect(() => {
|
|
64
64
|
const errorListener = (event: any) => {
|
|
65
65
|
const error: Error = event.error ?? event.reason;
|
|
@@ -83,7 +83,7 @@ const ErrorIndicator = () => {
|
|
|
83
83
|
}, []);
|
|
84
84
|
|
|
85
85
|
const handleReset = () => {
|
|
86
|
-
errorRef.current =
|
|
86
|
+
errorRef.current = null;
|
|
87
87
|
forceUpdate({});
|
|
88
88
|
};
|
|
89
89
|
|
|
@@ -5,24 +5,23 @@
|
|
|
5
5
|
import { type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
|
|
6
6
|
import { addressToA1Notation } from '@dxos/compute';
|
|
7
7
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
|
|
8
|
-
import { DXN, Filter, Key, Obj,
|
|
9
|
-
import { type TypedObject } from '@dxos/echo
|
|
8
|
+
import { DXN, Filter, Key, type Obj, Type } from '@dxos/echo';
|
|
9
|
+
import { type TypedObject } from '@dxos/echo/internal';
|
|
10
10
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
|
|
11
|
+
import { Sheet } from '@dxos/plugin-sheet/types';
|
|
12
|
+
import { Diagram } from '@dxos/plugin-sketch/types';
|
|
14
13
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
15
14
|
import { faker } from '@dxos/random';
|
|
16
15
|
import { type Client } from '@dxos/react-client';
|
|
17
16
|
import { type Space } from '@dxos/react-client/echo';
|
|
18
|
-
import {
|
|
17
|
+
import { View, getTypenameFromQuery } from '@dxos/schema';
|
|
19
18
|
import { type ValueGenerator, createAsyncGenerator } from '@dxos/schema/testing';
|
|
20
19
|
import { range } from '@dxos/util';
|
|
21
20
|
|
|
22
21
|
const generator: ValueGenerator = faker as any;
|
|
23
22
|
|
|
24
|
-
const findViewByTypename = async (views:
|
|
25
|
-
return views.find((view) =>
|
|
23
|
+
const findViewByTypename = async (views: View.View[], typename: string) => {
|
|
24
|
+
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
export type ObjectGenerator<T extends Obj.Any> = (space: Space, n: number, cb?: (objects: T[]) => void) => Promise<T[]>;
|
|
@@ -36,13 +35,13 @@ export const createGenerator = <T extends Obj.Any>(
|
|
|
36
35
|
const typename = schema.typename;
|
|
37
36
|
|
|
38
37
|
// Find or create table and view.
|
|
39
|
-
const { objects: views } = await space.db.query(Filter.type(
|
|
38
|
+
const { objects: views } = await space.db.query(Filter.type(View.View)).run();
|
|
40
39
|
const view = await findViewByTypename(views, typename);
|
|
41
40
|
const staticSchema = client?.graph.schemaRegistry.schemas.find((schema) => Type.getTypename(schema) === typename);
|
|
42
41
|
if (!view && !staticSchema) {
|
|
43
|
-
await dispatch(createIntent(SpaceAction.AddSchema, { space, schema }));
|
|
42
|
+
await dispatch(createIntent(SpaceAction.AddSchema, { space, schema, show: false }));
|
|
44
43
|
} else if (!view && staticSchema) {
|
|
45
|
-
await dispatch(createIntent(SpaceAction.UseStaticSchema, { space, typename }));
|
|
44
|
+
await dispatch(createIntent(SpaceAction.UseStaticSchema, { space, typename, show: false }));
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
// Create objects.
|
|
@@ -57,7 +56,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
57
56
|
async (space, n, cb) => {
|
|
58
57
|
const objects = range(n).map(() => {
|
|
59
58
|
return space.db.add(
|
|
60
|
-
Markdown.
|
|
59
|
+
Markdown.make({
|
|
61
60
|
name: faker.commerce.productName(),
|
|
62
61
|
content: faker.lorem.sentences(5),
|
|
63
62
|
}),
|
|
@@ -69,16 +68,11 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
69
68
|
},
|
|
70
69
|
],
|
|
71
70
|
[
|
|
72
|
-
|
|
71
|
+
Diagram.Diagram.typename,
|
|
73
72
|
async (space, n, cb) => {
|
|
74
73
|
const objects = range(n).map(() => {
|
|
75
74
|
// TODO(burdon): Generate diagram.
|
|
76
|
-
const obj = space.db.add(
|
|
77
|
-
Obj.make(DiagramType, {
|
|
78
|
-
name: faker.commerce.productName(),
|
|
79
|
-
canvas: Ref.make(Obj.make(CanvasType, { content: {} })),
|
|
80
|
-
}),
|
|
81
|
-
);
|
|
75
|
+
const obj = space.db.add(Diagram.make({ name: faker.commerce.productName() }));
|
|
82
76
|
|
|
83
77
|
return obj;
|
|
84
78
|
});
|
|
@@ -89,10 +83,10 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
89
83
|
],
|
|
90
84
|
// TODO(burdon): Create unit tests.
|
|
91
85
|
[
|
|
92
|
-
|
|
86
|
+
Sheet.Sheet.typename,
|
|
93
87
|
async (space, n, cb) => {
|
|
94
88
|
const objects = range(n).map(() => {
|
|
95
|
-
const cells: Record<string, CellValue> = {};
|
|
89
|
+
const cells: Record<string, Sheet.CellValue> = {};
|
|
96
90
|
const year = new Date().getFullYear();
|
|
97
91
|
const cols = 4;
|
|
98
92
|
const rows = 16;
|
|
@@ -114,7 +108,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
114
108
|
// TODO(burdon): Set width.
|
|
115
109
|
// TODO(burdon): Set formatting for columns.
|
|
116
110
|
return space.db.add(
|
|
117
|
-
|
|
111
|
+
Sheet.make({
|
|
118
112
|
name: faker.commerce.productName(),
|
|
119
113
|
cells,
|
|
120
114
|
}),
|
|
@@ -19,8 +19,8 @@ export const SchemaTable = ({ types, objects = {}, label, onClick }: SchemaTable
|
|
|
19
19
|
<h2 className='p-2'>{label}</h2>
|
|
20
20
|
{types.map((type) => (
|
|
21
21
|
<div key={type.typename} className='grid grid-cols-subgrid col-span-3 items-center'>
|
|
22
|
-
<div className='
|
|
23
|
-
<div className='
|
|
22
|
+
<div className='pli-2 text-sm font-mono text-subdued'>{type.typename}</div>
|
|
23
|
+
<div className='pli-2 text-right font-mono'>{objects[type.typename] ?? 0}</div>
|
|
24
24
|
<IconButton
|
|
25
25
|
variant='ghost'
|
|
26
26
|
icon='ph--plus--regular'
|