@dxos/plugin-debug 0.8.2-staging.7ac8446 → 0.8.2
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/DebugApp-WSEJPCKY.mjs +225 -0
- package/dist/lib/browser/{DebugApp-7PFYN52J.mjs.map → DebugApp-WSEJPCKY.mjs.map} +1 -1
- package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs +25 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-NBOQZ4JF.mjs → SpaceGenerator-RHQLPN44.mjs} +254 -242
- package/dist/lib/browser/SpaceGenerator-RHQLPN44.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-ALFPRSAR.mjs → app-graph-builder-PIPBIN6P.mjs} +115 -88
- package/dist/lib/browser/app-graph-builder-PIPBIN6P.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RORUXVAC.mjs → chunk-47JOZTT2.mjs} +1 -4
- package/dist/lib/browser/{chunk-RORUXVAC.mjs.map → chunk-47JOZTT2.mjs.map} +3 -3
- package/dist/lib/browser/chunk-KS3YBEL7.mjs +68 -0
- package/dist/lib/browser/chunk-KS3YBEL7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +7 -5
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-ZRLN5KUI.mjs → react-context-ZQRD2WG2.mjs} +2 -2
- package/dist/lib/browser/{react-surface-MXXLOQYV.mjs → react-surface-PHUWS5WD.mjs} +318 -288
- package/dist/lib/browser/react-surface-PHUWS5WD.mjs.map +7 -0
- package/dist/lib/browser/{settings-AP74NCXH.mjs → settings-N4Q6YB7L.mjs} +5 -5
- package/dist/lib/browser/settings-N4Q6YB7L.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -178
- 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/DevtoolsOverviewContainer.d.ts +4 -0
- package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +1 -0
- 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 +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +5 -4
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +60 -53
- package/src/capabilities/app-graph-builder.ts +418 -374
- package/src/capabilities/react-surface.tsx +43 -19
- package/src/capabilities/settings.ts +2 -2
- package/src/components/DebugObjectPanel.tsx +2 -2
- package/src/components/DebugStatus.tsx +4 -29
- package/src/components/DevtoolsOverviewContainer.tsx +20 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +11 -16
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +1 -1
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +9 -9
- package/src/components/SpaceGenerator/presets.ts +20 -18
- package/src/components/Wireframe.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/meta.ts +0 -1
- package/src/translations.ts +2 -0
- package/src/types.ts +6 -5
- package/dist/lib/browser/DebugApp-7PFYN52J.mjs +0 -182
- package/dist/lib/browser/SpaceGenerator-NBOQZ4JF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-ALFPRSAR.mjs.map +0 -7
- package/dist/lib/browser/chunk-TCEHALD4.mjs +0 -73
- package/dist/lib/browser/chunk-TCEHALD4.mjs.map +0 -7
- package/dist/lib/browser/react-surface-MXXLOQYV.mjs.map +0 -7
- package/dist/lib/browser/settings-AP74NCXH.mjs.map +0 -7
- /package/dist/lib/browser/{react-context-ZRLN5KUI.mjs.map → react-context-ZQRD2WG2.mjs.map} +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// packages/plugins/plugin-debug/src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
2
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
2
3
|
import React2, { useCallback, useMemo, useState } from "react";
|
|
3
4
|
import { createIntent, useIntentDispatcher } from "@dxos/app-framework";
|
|
4
5
|
import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
|
|
5
|
-
import { toEffectSchema } from "@dxos/echo-schema";
|
|
6
|
-
import {
|
|
6
|
+
import { Filter as Filter3, toEffectSchema } from "@dxos/echo-schema";
|
|
7
|
+
import { live as live3 } from "@dxos/live-object";
|
|
7
8
|
import { log } from "@dxos/log";
|
|
8
9
|
import { DocumentType as DocumentType2 } from "@dxos/plugin-markdown/types";
|
|
9
10
|
import { SheetType as SheetType2 } from "@dxos/plugin-sheet/types";
|
|
@@ -14,7 +15,7 @@ import { getTypename } from "@dxos/react-client/echo";
|
|
|
14
15
|
import { IconButton as IconButton2, Input, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
15
16
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
16
17
|
import { initializeTable, TableType as TableType3 } from "@dxos/react-ui-table";
|
|
17
|
-
import {
|
|
18
|
+
import { DataType as DataType2 } from "@dxos/schema";
|
|
18
19
|
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
19
20
|
|
|
20
21
|
// packages/plugins/plugin-debug/src/components/SpaceGenerator/ObjectGenerator.tsx
|
|
@@ -22,7 +23,7 @@ import { addressToA1Notation } from "@dxos/compute";
|
|
|
22
23
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from "@dxos/conductor";
|
|
23
24
|
import { ObjectId } from "@dxos/echo-schema";
|
|
24
25
|
import { DXN } from "@dxos/keys";
|
|
25
|
-
import {
|
|
26
|
+
import { live, makeRef } from "@dxos/live-object";
|
|
26
27
|
import { DocumentType } from "@dxos/plugin-markdown/types";
|
|
27
28
|
import { createSheet } from "@dxos/plugin-sheet/types";
|
|
28
29
|
import { SheetType } from "@dxos/plugin-sheet/types";
|
|
@@ -30,7 +31,7 @@ import { CanvasType, DiagramType } from "@dxos/plugin-sketch/types";
|
|
|
30
31
|
import { faker } from "@dxos/random";
|
|
31
32
|
import { Filter } from "@dxos/react-client/echo";
|
|
32
33
|
import { TableType } from "@dxos/react-ui-table";
|
|
33
|
-
import { createView,
|
|
34
|
+
import { createView, DataType } from "@dxos/schema";
|
|
34
35
|
import { createAsyncGenerator } from "@dxos/schema/testing";
|
|
35
36
|
import { range } from "@dxos/util";
|
|
36
37
|
var generator = faker;
|
|
@@ -39,12 +40,11 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
39
40
|
DocumentType.typename,
|
|
40
41
|
async (space, n, cb) => {
|
|
41
42
|
const objects = range(n).map(() => {
|
|
42
|
-
return space.db.add(
|
|
43
|
+
return space.db.add(live(DocumentType, {
|
|
43
44
|
name: faker.commerce.productName(),
|
|
44
|
-
content: makeRef(
|
|
45
|
+
content: makeRef(live(DataType.Text, {
|
|
45
46
|
content: faker.lorem.sentences(5)
|
|
46
|
-
}))
|
|
47
|
-
threads: []
|
|
47
|
+
}))
|
|
48
48
|
}));
|
|
49
49
|
});
|
|
50
50
|
cb?.(objects);
|
|
@@ -55,9 +55,9 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
55
55
|
DiagramType.typename,
|
|
56
56
|
async (space, n, cb) => {
|
|
57
57
|
const objects = range(n).map(() => {
|
|
58
|
-
const obj = space.db.add(
|
|
58
|
+
const obj = space.db.add(live(DiagramType, {
|
|
59
59
|
name: faker.commerce.productName(),
|
|
60
|
-
canvas: makeRef(
|
|
60
|
+
canvas: makeRef(live(CanvasType, {
|
|
61
61
|
content: {}
|
|
62
62
|
}))
|
|
63
63
|
}));
|
|
@@ -188,7 +188,7 @@ var createGenerator = (type) => {
|
|
|
188
188
|
db: space.db
|
|
189
189
|
});
|
|
190
190
|
const objects = await generate.createObjects(n);
|
|
191
|
-
const { objects: tables } = await space.db.query(Filter.
|
|
191
|
+
const { objects: tables } = await space.db.query(Filter.type(TableType)).run();
|
|
192
192
|
const table = tables.find((table2) => table2.view?.target?.query?.typename === type.typename);
|
|
193
193
|
if (!table) {
|
|
194
194
|
const name = type.typename.split("/").pop() ?? type.typename;
|
|
@@ -197,7 +197,7 @@ var createGenerator = (type) => {
|
|
|
197
197
|
typename: type.typename,
|
|
198
198
|
jsonSchema: schema.jsonSchema
|
|
199
199
|
});
|
|
200
|
-
const table2 = space.db.add(
|
|
200
|
+
const table2 = space.db.add(live(TableType, {
|
|
201
201
|
name,
|
|
202
202
|
view: makeRef(view)
|
|
203
203
|
}));
|
|
@@ -210,48 +210,55 @@ var createGenerator = (type) => {
|
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
// packages/plugins/plugin-debug/src/components/SpaceGenerator/SchemaTable.tsx
|
|
213
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
213
214
|
import React from "react";
|
|
214
215
|
import { IconButton } from "@dxos/react-ui";
|
|
215
216
|
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
217
|
+
var _effect = _useSignals();
|
|
218
|
+
try {
|
|
219
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
220
|
+
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
221
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
222
|
+
className: "grid grid-cols-subgrid col-span-3"
|
|
223
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
224
|
+
className: "px-2 text-sm text-primary-500"
|
|
225
|
+
}, label), /* @__PURE__ */ React.createElement("div", {
|
|
226
|
+
className: "px-2 text-xs text-subdued text-right"
|
|
227
|
+
}, "count")), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
228
|
+
key: type.typename,
|
|
229
|
+
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
230
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
231
|
+
className: "px-2 text-sm font-mono text-green-500"
|
|
232
|
+
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
233
|
+
className: "px-2 text-right font-mono"
|
|
234
|
+
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
235
|
+
variant: "ghost",
|
|
236
|
+
icon: "ph--plus--regular",
|
|
237
|
+
iconOnly: true,
|
|
238
|
+
label: "Create data",
|
|
239
|
+
onClick: () => onClick(type.typename)
|
|
240
|
+
}))));
|
|
241
|
+
} finally {
|
|
242
|
+
_effect.f();
|
|
243
|
+
}
|
|
238
244
|
};
|
|
239
245
|
|
|
240
246
|
// packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts
|
|
241
|
-
import {
|
|
242
|
-
import {
|
|
243
|
-
import {
|
|
247
|
+
import { Schema, SchemaAST } from "effect";
|
|
248
|
+
import { NODE_INPUT as NODE_INPUT2 } from "@dxos/conductor";
|
|
249
|
+
import { Ref } from "@dxos/echo";
|
|
250
|
+
import { ObjectId as ObjectId2, toJsonSchema } from "@dxos/echo-schema";
|
|
251
|
+
import { FunctionTrigger, TriggerKind, EmailTriggerOutput } from "@dxos/functions";
|
|
244
252
|
import { invariant } from "@dxos/invariant";
|
|
245
253
|
import { DXN as DXN2 } from "@dxos/keys";
|
|
246
|
-
import {
|
|
254
|
+
import { live as live2, makeRef as makeRef2 } from "@dxos/live-object";
|
|
247
255
|
import { Filter as Filter2 } from "@dxos/react-client/echo";
|
|
248
256
|
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createSurface, createRandom, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
249
257
|
import { CanvasBoardType, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
250
258
|
import { TableType as TableType2 } from "@dxos/react-ui-table";
|
|
251
259
|
import { range as range2 } from "@dxos/util";
|
|
252
260
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
|
|
253
|
-
var PresetName
|
|
254
|
-
(function(PresetName2) {
|
|
261
|
+
var PresetName = /* @__PURE__ */ function(PresetName2) {
|
|
255
262
|
PresetName2["EMAIL_TABLE"] = "email-table";
|
|
256
263
|
PresetName2["GPT_QUEUE"] = "webhook-gpt-queue";
|
|
257
264
|
PresetName2["CHAT_GPT"] = "chat-gpt-text";
|
|
@@ -261,7 +268,8 @@ var PresetName;
|
|
|
261
268
|
PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
|
|
262
269
|
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
263
270
|
PresetName2["KANBAN_QUEUE"] = "kanban-queue";
|
|
264
|
-
|
|
271
|
+
return PresetName2;
|
|
272
|
+
}({});
|
|
265
273
|
var presets = {
|
|
266
274
|
schemas: [
|
|
267
275
|
CanvasBoardType,
|
|
@@ -360,11 +368,11 @@ var presets = {
|
|
|
360
368
|
async (space, n, cb) => {
|
|
361
369
|
const objects = range2(n, () => {
|
|
362
370
|
const canvasModel = CanvasGraphModel.create();
|
|
363
|
-
const results = space.db.query(Filter2.
|
|
371
|
+
const results = space.db.query(Filter2.type(TableType2)).runSync();
|
|
364
372
|
const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith("Email"));
|
|
365
373
|
invariant(emailTable, "Email table not found.", {
|
|
366
374
|
F: __dxlog_file,
|
|
367
|
-
L:
|
|
375
|
+
L: 139,
|
|
368
376
|
S: void 0,
|
|
369
377
|
A: [
|
|
370
378
|
"emailTable",
|
|
@@ -407,7 +415,7 @@ var presets = {
|
|
|
407
415
|
x: 10,
|
|
408
416
|
y: 6
|
|
409
417
|
})));
|
|
410
|
-
const properties =
|
|
418
|
+
const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
|
|
411
419
|
for (let i = 0; i < properties.length; i++) {
|
|
412
420
|
const propName = properties[i].name.toString();
|
|
413
421
|
builder.createEdge({
|
|
@@ -434,7 +442,7 @@ var presets = {
|
|
|
434
442
|
const templateComputeNode = computeModel.nodes.find((n2) => n2.id === template.node);
|
|
435
443
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
436
444
|
F: __dxlog_file,
|
|
437
|
-
L:
|
|
445
|
+
L: 185,
|
|
438
446
|
S: void 0,
|
|
439
447
|
A: [
|
|
440
448
|
"templateComputeNode",
|
|
@@ -506,11 +514,11 @@ var presets = {
|
|
|
506
514
|
async (space, n, cb) => {
|
|
507
515
|
const objects = range2(n, () => {
|
|
508
516
|
const canvasModel = CanvasGraphModel.create();
|
|
509
|
-
const results = space.db.query(Filter2.
|
|
517
|
+
const results = space.db.query(Filter2.type(TableType2)).runSync();
|
|
510
518
|
const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith("Email"));
|
|
511
519
|
invariant(emailTable, "Email table not found.", {
|
|
512
520
|
F: __dxlog_file,
|
|
513
|
-
L:
|
|
521
|
+
L: 236,
|
|
514
522
|
S: void 0,
|
|
515
523
|
A: [
|
|
516
524
|
"emailTable",
|
|
@@ -599,7 +607,7 @@ var presets = {
|
|
|
599
607
|
input: "text",
|
|
600
608
|
output: "text"
|
|
601
609
|
});
|
|
602
|
-
const properties =
|
|
610
|
+
const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
|
|
603
611
|
for (let i = 0; i < properties.length; i++) {
|
|
604
612
|
const propName = properties[i].name.toString();
|
|
605
613
|
builder.createEdge({
|
|
@@ -644,7 +652,7 @@ var presets = {
|
|
|
644
652
|
const templateComputeNode = computeModel.nodes.find((n2) => n2.id === template.node);
|
|
645
653
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
646
654
|
F: __dxlog_file,
|
|
647
|
-
L:
|
|
655
|
+
L: 308,
|
|
648
656
|
S: void 0,
|
|
649
657
|
A: [
|
|
650
658
|
"templateComputeNode",
|
|
@@ -652,8 +660,8 @@ var presets = {
|
|
|
652
660
|
]
|
|
653
661
|
});
|
|
654
662
|
templateComputeNode.value = templateContent.join("\n");
|
|
655
|
-
const extendedSchema =
|
|
656
|
-
text:
|
|
663
|
+
const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({
|
|
664
|
+
text: Schema.String
|
|
657
665
|
}));
|
|
658
666
|
templateComputeNode.inputSchema = toJsonSchema(extendedSchema);
|
|
659
667
|
attachTrigger(functionTrigger, computeModel);
|
|
@@ -794,11 +802,11 @@ var presets = {
|
|
|
794
802
|
async (space, n, cb) => {
|
|
795
803
|
const objects = range2(n, () => {
|
|
796
804
|
const canvasModel = CanvasGraphModel.create();
|
|
797
|
-
const results = space.db.query(Filter2.
|
|
805
|
+
const results = space.db.query(Filter2.type(TableType2)).runSync();
|
|
798
806
|
const messages = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith("Message"));
|
|
799
807
|
invariant(messages, "Table not found.", {
|
|
800
808
|
F: __dxlog_file,
|
|
801
|
-
L:
|
|
809
|
+
L: 414,
|
|
802
810
|
S: void 0,
|
|
803
811
|
A: [
|
|
804
812
|
"messages",
|
|
@@ -913,12 +921,12 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
913
921
|
});
|
|
914
922
|
functionTrigger = triggerShape.functionTrigger.target;
|
|
915
923
|
const triggerSpec = functionTrigger.spec;
|
|
916
|
-
invariant(triggerSpec && triggerSpec.
|
|
924
|
+
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
|
|
917
925
|
F: __dxlog_file,
|
|
918
|
-
L:
|
|
926
|
+
L: 497,
|
|
919
927
|
S: void 0,
|
|
920
928
|
A: [
|
|
921
|
-
"triggerSpec && triggerSpec.
|
|
929
|
+
"triggerSpec && triggerSpec.kind === triggerKind",
|
|
922
930
|
"'No trigger spec.'"
|
|
923
931
|
]
|
|
924
932
|
});
|
|
@@ -928,7 +936,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
928
936
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
929
937
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
930
938
|
F: __dxlog_file,
|
|
931
|
-
L:
|
|
939
|
+
L: 504,
|
|
932
940
|
S: void 0,
|
|
933
941
|
A: [
|
|
934
942
|
"templateComputeNode",
|
|
@@ -941,9 +949,9 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
941
949
|
' "id": "@{{changeId}}"',
|
|
942
950
|
"}"
|
|
943
951
|
].join("\n");
|
|
944
|
-
templateComputeNode.inputSchema = toJsonSchema(
|
|
945
|
-
type:
|
|
946
|
-
changeId:
|
|
952
|
+
templateComputeNode.inputSchema = toJsonSchema(Schema.Struct({
|
|
953
|
+
type: Schema.String,
|
|
954
|
+
changeId: Schema.String
|
|
947
955
|
}));
|
|
948
956
|
attachTrigger(functionTrigger, computeModel);
|
|
949
957
|
return {
|
|
@@ -952,7 +960,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
952
960
|
};
|
|
953
961
|
};
|
|
954
962
|
var addToSpace = (name, space, canvas, compute) => {
|
|
955
|
-
return space.db.add(
|
|
963
|
+
return space.db.add(live2(CanvasBoardType, {
|
|
956
964
|
name,
|
|
957
965
|
computeGraph: makeRef2(compute.root),
|
|
958
966
|
layout: canvas.graph
|
|
@@ -990,17 +998,16 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
990
998
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
991
999
|
invariant(functionTrigger, void 0, {
|
|
992
1000
|
F: __dxlog_file,
|
|
993
|
-
L:
|
|
1001
|
+
L: 544,
|
|
994
1002
|
S: void 0,
|
|
995
1003
|
A: [
|
|
996
1004
|
"functionTrigger",
|
|
997
1005
|
""
|
|
998
1006
|
]
|
|
999
1007
|
});
|
|
1000
|
-
functionTrigger.function =
|
|
1001
|
-
functionTrigger.meta ??= {};
|
|
1008
|
+
functionTrigger.function = Ref.make(computeModel.root);
|
|
1002
1009
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT2);
|
|
1003
|
-
functionTrigger.
|
|
1010
|
+
functionTrigger.inputNodeId = inputNode.id;
|
|
1004
1011
|
};
|
|
1005
1012
|
var rawPosition = (args) => {
|
|
1006
1013
|
return {
|
|
@@ -1049,185 +1056,190 @@ var position = (rect) => {
|
|
|
1049
1056
|
// packages/plugins/plugin-debug/src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
1050
1057
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/SpaceGenerator.tsx";
|
|
1051
1058
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1059
|
+
var _effect = _useSignals2();
|
|
1060
|
+
try {
|
|
1061
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
1062
|
+
const client = useClient();
|
|
1063
|
+
const staticTypes = [
|
|
1064
|
+
DocumentType2,
|
|
1065
|
+
DiagramType2,
|
|
1066
|
+
SheetType2,
|
|
1067
|
+
ComputeGraph2
|
|
1068
|
+
];
|
|
1069
|
+
const mutableTypes = [
|
|
1070
|
+
DataType2.Organization,
|
|
1071
|
+
DataType2.Project,
|
|
1072
|
+
DataType2.Person,
|
|
1073
|
+
DataType2.Message
|
|
1074
|
+
];
|
|
1075
|
+
const [count, setCount] = useState(1);
|
|
1076
|
+
const [info, setInfo] = useState({});
|
|
1077
|
+
const typeMap = useMemo(() => {
|
|
1078
|
+
client.addTypes([
|
|
1079
|
+
...staticTypes,
|
|
1080
|
+
...presets.schemas
|
|
1081
|
+
]);
|
|
1082
|
+
const mutableGenerators = new Map(mutableTypes.map((type) => [
|
|
1083
|
+
type.typename,
|
|
1084
|
+
createGenerator(type)
|
|
1085
|
+
]));
|
|
1086
|
+
return new Map([
|
|
1087
|
+
...staticGenerators,
|
|
1088
|
+
...presets.items,
|
|
1089
|
+
...mutableGenerators
|
|
1090
|
+
]);
|
|
1091
|
+
}, [
|
|
1092
|
+
client,
|
|
1093
|
+
mutableTypes
|
|
1072
1094
|
]);
|
|
1073
|
-
const
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1095
|
+
const updateInfo = async () => {
|
|
1096
|
+
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
1097
|
+
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
1098
|
+
const { objects } = await space.db.query(Filter3.everything()).run();
|
|
1099
|
+
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
1100
|
+
const type = getTypename(obj);
|
|
1101
|
+
if (type) {
|
|
1102
|
+
const count2 = map[type] ?? 0;
|
|
1103
|
+
map[type] = count2 + 1;
|
|
1104
|
+
}
|
|
1105
|
+
return map;
|
|
1106
|
+
}, {}));
|
|
1107
|
+
setInfo({
|
|
1108
|
+
schema: {
|
|
1109
|
+
static: staticSchema.length,
|
|
1110
|
+
mutable: echoSchema.length
|
|
1111
|
+
},
|
|
1112
|
+
objects: objectMap
|
|
1113
|
+
});
|
|
1114
|
+
};
|
|
1115
|
+
useAsyncEffect(updateInfo, [
|
|
1116
|
+
space
|
|
1081
1117
|
]);
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
1088
|
-
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
1089
|
-
const { objects } = await space.db.query().run();
|
|
1090
|
-
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
1091
|
-
const type = getTypename(obj);
|
|
1092
|
-
if (type) {
|
|
1093
|
-
const count2 = map[type] ?? 0;
|
|
1094
|
-
map[type] = count2 + 1;
|
|
1095
|
-
}
|
|
1096
|
-
return map;
|
|
1097
|
-
}, {}));
|
|
1098
|
-
setInfo({
|
|
1099
|
-
schema: {
|
|
1100
|
-
static: staticSchema.length,
|
|
1101
|
-
mutable: echoSchema.length
|
|
1102
|
-
},
|
|
1103
|
-
objects: objectMap
|
|
1104
|
-
});
|
|
1105
|
-
};
|
|
1106
|
-
useAsyncEffect(updateInfo, [
|
|
1107
|
-
space
|
|
1108
|
-
]);
|
|
1109
|
-
const handleCreateData = useCallback(async (typename) => {
|
|
1110
|
-
const constructor = typeMap.get(typename);
|
|
1111
|
-
if (constructor) {
|
|
1112
|
-
await constructor(space, count, onCreateObjects);
|
|
1113
|
-
await updateInfo();
|
|
1114
|
-
}
|
|
1115
|
-
}, [
|
|
1116
|
-
typeMap,
|
|
1117
|
-
count
|
|
1118
|
-
]);
|
|
1119
|
-
const handleLoadTables = useCallback(async () => {
|
|
1120
|
-
const input = document.createElement("input");
|
|
1121
|
-
input.type = "file";
|
|
1122
|
-
input.accept = ".json";
|
|
1123
|
-
input.onchange = async (e) => {
|
|
1124
|
-
const file = e.target.files?.[0];
|
|
1125
|
-
if (!file) {
|
|
1126
|
-
return;
|
|
1118
|
+
const handleCreateData = useCallback(async (typename) => {
|
|
1119
|
+
const constructor = typeMap.get(typename);
|
|
1120
|
+
if (constructor) {
|
|
1121
|
+
await constructor(space, count, onCreateObjects);
|
|
1122
|
+
await updateInfo();
|
|
1127
1123
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
await
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
await Promise.all(data.objects.map(async ({ id, "@type": typename, ...fields }) => {
|
|
1152
|
-
const schema = schemas.find((s) => `dxn:type:${s.typename}:${s.version}` === typename);
|
|
1153
|
-
if (!schema) {
|
|
1154
|
-
log.warn("Missing schema for object", {
|
|
1155
|
-
id,
|
|
1156
|
-
typename
|
|
1157
|
-
}, {
|
|
1158
|
-
F: __dxlog_file2,
|
|
1159
|
-
L: 125,
|
|
1160
|
-
S: void 0,
|
|
1161
|
-
C: (f, a) => f(...a)
|
|
1124
|
+
}, [
|
|
1125
|
+
typeMap,
|
|
1126
|
+
count
|
|
1127
|
+
]);
|
|
1128
|
+
const handleLoadTables = useCallback(async () => {
|
|
1129
|
+
const input = document.createElement("input");
|
|
1130
|
+
input.type = "file";
|
|
1131
|
+
input.accept = ".json";
|
|
1132
|
+
input.onchange = async (e) => {
|
|
1133
|
+
const file = e.target.files?.[0];
|
|
1134
|
+
if (!file) {
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
try {
|
|
1138
|
+
const content = await file.text();
|
|
1139
|
+
const data = JSON.parse(content);
|
|
1140
|
+
const schemas = await space.db.schemaRegistry.register(data.schemas.map(toEffectSchema));
|
|
1141
|
+
await Promise.all(schemas.map(async (schema) => {
|
|
1142
|
+
const parts = schema.typename.split("/");
|
|
1143
|
+
const name = parts[parts.length - 1];
|
|
1144
|
+
const table = live3(TableType3, {
|
|
1145
|
+
name,
|
|
1146
|
+
threads: []
|
|
1162
1147
|
});
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1148
|
+
await initializeTable({
|
|
1149
|
+
client,
|
|
1150
|
+
space,
|
|
1151
|
+
table,
|
|
1152
|
+
typename: schema.typename
|
|
1153
|
+
});
|
|
1154
|
+
await dispatch(createIntent(SpaceAction.AddObject, {
|
|
1155
|
+
target: space,
|
|
1156
|
+
object: table
|
|
1157
|
+
}));
|
|
1158
|
+
return table;
|
|
1159
|
+
}));
|
|
1160
|
+
await Promise.all(data.objects.map(async ({ id, "@type": typename, ...fields }) => {
|
|
1161
|
+
const schema = schemas.find((s) => `dxn:type:${s.typename}:${s.version}` === typename);
|
|
1162
|
+
if (!schema) {
|
|
1163
|
+
log.warn("Missing schema for object", {
|
|
1164
|
+
id,
|
|
1165
|
+
typename
|
|
1166
|
+
}, {
|
|
1167
|
+
F: __dxlog_file2,
|
|
1168
|
+
L: 125,
|
|
1169
|
+
S: void 0,
|
|
1170
|
+
C: (f, a) => f(...a)
|
|
1171
|
+
});
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
const object = live3(schema, fields);
|
|
1175
|
+
space.db.add(object);
|
|
1176
|
+
return object;
|
|
1177
|
+
}));
|
|
1178
|
+
} catch (err) {
|
|
1179
|
+
log.catch(err, void 0, {
|
|
1180
|
+
F: __dxlog_file2,
|
|
1181
|
+
L: 134,
|
|
1182
|
+
S: void 0,
|
|
1183
|
+
C: (f, a) => f(...a)
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
|
+
input.click();
|
|
1188
|
+
}, []);
|
|
1189
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
1190
|
+
role: "none",
|
|
1191
|
+
className: "flex flex-col divide-y divide-separator overflow-y-auto"
|
|
1192
|
+
}, /* @__PURE__ */ React2.createElement(Toolbar.Root, {
|
|
1193
|
+
classNames: "p-1"
|
|
1194
|
+
}, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
1195
|
+
icon: "ph--arrow-clockwise--regular",
|
|
1196
|
+
iconOnly: true,
|
|
1197
|
+
label: "Refresh",
|
|
1198
|
+
onClick: updateInfo
|
|
1199
|
+
}), /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
1200
|
+
icon: "ph--file-arrow-up--regular",
|
|
1201
|
+
iconOnly: true,
|
|
1202
|
+
label: "Load tables from JSON",
|
|
1203
|
+
onClick: handleLoadTables
|
|
1204
|
+
}), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
|
|
1205
|
+
variant: "gap"
|
|
1206
|
+
}), /* @__PURE__ */ React2.createElement("div", {
|
|
1207
|
+
className: "flex"
|
|
1208
|
+
}, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
1209
|
+
type: "number",
|
|
1210
|
+
min: 1,
|
|
1211
|
+
max: 100,
|
|
1212
|
+
placeholder: "Count",
|
|
1213
|
+
classNames: "w-[80px]",
|
|
1214
|
+
value: count,
|
|
1215
|
+
onChange: (ev) => setCount(parseInt(ev.target.value))
|
|
1216
|
+
})))), /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1217
|
+
types: staticTypes,
|
|
1218
|
+
objects: info.objects,
|
|
1219
|
+
label: "Static Types",
|
|
1220
|
+
onClick: handleCreateData
|
|
1221
|
+
}), /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1222
|
+
types: mutableTypes,
|
|
1223
|
+
objects: info.objects,
|
|
1224
|
+
label: "Mutable Types",
|
|
1225
|
+
onClick: handleCreateData
|
|
1226
|
+
}), /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1227
|
+
types: presets.types,
|
|
1228
|
+
objects: info.objects,
|
|
1229
|
+
label: "Presets",
|
|
1230
|
+
onClick: handleCreateData
|
|
1231
|
+
}), /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
|
|
1232
|
+
classNames: "flex text-xs",
|
|
1233
|
+
language: "json"
|
|
1234
|
+
}, JSON.stringify({
|
|
1235
|
+
space,
|
|
1236
|
+
...info
|
|
1237
|
+
}, jsonKeyReplacer({
|
|
1238
|
+
truncate: true
|
|
1239
|
+
}), 2)));
|
|
1240
|
+
} finally {
|
|
1241
|
+
_effect.f();
|
|
1242
|
+
}
|
|
1231
1243
|
};
|
|
1232
1244
|
|
|
1233
1245
|
// packages/plugins/plugin-debug/src/components/SpaceGenerator/index.ts
|
|
@@ -1235,4 +1247,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
1235
1247
|
export {
|
|
1236
1248
|
SpaceGenerator_default as default
|
|
1237
1249
|
};
|
|
1238
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1250
|
+
//# sourceMappingURL=SpaceGenerator-RHQLPN44.mjs.map
|