@dxos/plugin-debug 0.7.5-labs.c0e040f → 0.7.5-labs.d199c0f
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/{DebugSpace-4JHYA7FG.mjs → DebugSpace-BTMTVZ6C.mjs} +2 -2
- package/dist/lib/browser/{SpaceGenerator-OIDM3MIN.mjs → SpaceGenerator-BPZGOSH4.mjs} +290 -111
- package/dist/lib/browser/SpaceGenerator-BPZGOSH4.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-BZFZ6UG6.mjs +533 -0
- package/dist/lib/browser/app-graph-builder-BZFZ6UG6.mjs.map +7 -0
- package/dist/lib/browser/chunk-UASI2CRI.mjs +72 -0
- package/dist/lib/browser/chunk-UASI2CRI.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +44 -8
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-TCD3MNIT.mjs +16 -0
- package/dist/lib/browser/react-context-TCD3MNIT.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-YAJPSHG4.mjs → react-surface-W6QLG4YJ.mjs} +191 -34
- package/dist/lib/browser/react-surface-W6QLG4YJ.mjs.map +7 -0
- package/dist/lib/browser/{settings-OIMSBZUC.mjs → settings-INPXR64L.mjs} +5 -6
- package/dist/lib/browser/{settings-OIMSBZUC.mjs.map → settings-INPXR64L.mjs.map} +3 -3
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +110 -110
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +115 -110
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +8 -0
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/components/Container.d.ts +2 -2
- package/dist/types/src/components/Container.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +1 -2
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts +1 -2
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/DebugSpace/ObjectCreator.d.ts +1 -2
- package/dist/types/src/components/DebugSpace/ObjectCreator.d.ts.map +1 -1
- package/dist/types/src/components/DebugStatus.d.ts +1 -2
- package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts +1 -2
- package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +1 -2
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +3 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +1 -2
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +28 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +44 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +49 -47
- package/src/DebugPlugin.tsx +12 -4
- package/src/capabilities/app-graph-builder.ts +292 -82
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/react-context.tsx +16 -0
- package/src/capabilities/react-surface.tsx +204 -27
- package/src/capabilities/settings.ts +0 -1
- package/src/components/DebugSettings.tsx +0 -3
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +68 -2
- package/src/components/SpaceGenerator/presets.ts +170 -60
- package/src/translations.ts +28 -0
- package/src/types.ts +52 -1
- package/dist/lib/browser/SpaceGenerator-OIDM3MIN.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-DCMGZAT3.mjs +0 -181
- package/dist/lib/browser/app-graph-builder-DCMGZAT3.mjs.map +0 -7
- package/dist/lib/browser/chunk-P7GHHMDB.mjs +0 -21
- package/dist/lib/browser/chunk-P7GHHMDB.mjs.map +0 -7
- package/dist/lib/browser/react-surface-YAJPSHG4.mjs.map +0 -7
- /package/dist/lib/browser/{DebugSpace-4JHYA7FG.mjs.map → DebugSpace-BTMTVZ6C.mjs.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-GSJS3HEM.mjs";
|
|
4
4
|
import {
|
|
5
5
|
DebugContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UASI2CRI.mjs";
|
|
7
7
|
|
|
8
8
|
// packages/plugins/plugin-debug/src/components/DebugSpace/DebugSpace.tsx
|
|
9
9
|
import React2, { useContext, useMemo as useMemo2, useState as useState2 } from "react";
|
|
@@ -274,4 +274,4 @@ var DebugSpace_default = DebugSpace;
|
|
|
274
274
|
export {
|
|
275
275
|
DebugSpace_default as default
|
|
276
276
|
};
|
|
277
|
-
//# sourceMappingURL=DebugSpace-
|
|
277
|
+
//# sourceMappingURL=DebugSpace-BTMTVZ6C.mjs.map
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
// packages/plugins/plugin-debug/src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
2
2
|
import React2, { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { createIntent, useIntentDispatcher } from "@dxos/app-framework";
|
|
3
4
|
import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
|
|
5
|
+
import { toEffectSchema } from "@dxos/echo-schema";
|
|
6
|
+
import { create as create3 } from "@dxos/live-object";
|
|
7
|
+
import { log } from "@dxos/log";
|
|
4
8
|
import { DocumentType as DocumentType2 } from "@dxos/plugin-markdown/types";
|
|
5
9
|
import { SheetType as SheetType2 } from "@dxos/plugin-sheet/types";
|
|
6
10
|
import { DiagramType as DiagramType2 } from "@dxos/plugin-sketch/types";
|
|
11
|
+
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
7
12
|
import { useClient } from "@dxos/react-client";
|
|
8
13
|
import { getTypename } from "@dxos/react-client/echo";
|
|
9
14
|
import { IconButton as IconButton2, Input, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
10
15
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
16
|
+
import { initializeTable, TableType as TableType3 } from "@dxos/react-ui-table";
|
|
11
17
|
import { Testing } from "@dxos/schema/testing";
|
|
12
18
|
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
13
19
|
|
|
@@ -15,7 +21,7 @@ import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
|
15
21
|
import { addressToA1Notation } from "@dxos/compute";
|
|
16
22
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from "@dxos/conductor";
|
|
17
23
|
import { ObjectId } from "@dxos/echo-schema";
|
|
18
|
-
import { DXN
|
|
24
|
+
import { DXN } from "@dxos/keys";
|
|
19
25
|
import { create, makeRef } from "@dxos/live-object";
|
|
20
26
|
import { DocumentType } from "@dxos/plugin-markdown/types";
|
|
21
27
|
import { createSheet } from "@dxos/plugin-sheet/types";
|
|
@@ -124,7 +130,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
124
130
|
type: "constant",
|
|
125
131
|
value: new DXN(DXN.kind.QUEUE, [
|
|
126
132
|
"data",
|
|
127
|
-
|
|
133
|
+
space.id,
|
|
128
134
|
ObjectId.random()
|
|
129
135
|
]).toString()
|
|
130
136
|
}).createNode({
|
|
@@ -236,10 +242,10 @@ import { EmailTriggerOutput, NODE_INPUT as NODE_INPUT2 } from "@dxos/conductor";
|
|
|
236
242
|
import { AST, ObjectId as ObjectId2, S, toJsonSchema } from "@dxos/echo-schema";
|
|
237
243
|
import { FunctionTrigger, TriggerKind } from "@dxos/functions/types";
|
|
238
244
|
import { invariant } from "@dxos/invariant";
|
|
239
|
-
import { DXN as DXN2
|
|
245
|
+
import { DXN as DXN2 } from "@dxos/keys";
|
|
240
246
|
import { create as create2, makeRef as makeRef2 } from "@dxos/live-object";
|
|
241
247
|
import { Filter as Filter2 } from "@dxos/react-client/echo";
|
|
242
|
-
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createSurface, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
248
|
+
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createSurface, createRandom, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
243
249
|
import { CanvasBoardType, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
244
250
|
import { TableType as TableType2 } from "@dxos/react-ui-table";
|
|
245
251
|
import { range as range2 } from "@dxos/util";
|
|
@@ -252,7 +258,9 @@ var PresetName;
|
|
|
252
258
|
PresetName2["EMAIL_WITH_SUMMARY"] = "email-gptSummary-table";
|
|
253
259
|
PresetName2["OBJECT_CHANGE_QUEUE"] = "objectChange-queue";
|
|
254
260
|
PresetName2["FOREX_FUNCTION_CALL"] = "forex-function-call";
|
|
261
|
+
PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
|
|
255
262
|
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
263
|
+
PresetName2["KANBAN_QUEUE"] = "kanban-queue";
|
|
256
264
|
})(PresetName || (PresetName = {}));
|
|
257
265
|
var presets = {
|
|
258
266
|
schemas: [
|
|
@@ -275,6 +283,7 @@ var presets = {
|
|
|
275
283
|
y: -14
|
|
276
284
|
})));
|
|
277
285
|
const triggerShape = createTrigger({
|
|
286
|
+
spaceId: space.id,
|
|
278
287
|
triggerKind: TriggerKind.Webhook,
|
|
279
288
|
...position({
|
|
280
289
|
x: -18,
|
|
@@ -288,7 +297,7 @@ var presets = {
|
|
|
288
297
|
width: 10,
|
|
289
298
|
height: 10
|
|
290
299
|
})));
|
|
291
|
-
const { queueId } = setupQueue(canvasModel);
|
|
300
|
+
const { queueId } = setupQueue(space, canvasModel);
|
|
292
301
|
const append = canvasModel.createNode(createAppend(position({
|
|
293
302
|
x: 10,
|
|
294
303
|
y: 6
|
|
@@ -326,102 +335,26 @@ var presets = {
|
|
|
326
335
|
"objectChange-queue",
|
|
327
336
|
async (space, n, cb) => {
|
|
328
337
|
const objects = range2(n, () => {
|
|
329
|
-
const canvasModel =
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
...rawPosition({
|
|
333
|
-
centerX: -64,
|
|
334
|
-
centerY: -79,
|
|
335
|
-
width: 320,
|
|
336
|
-
height: 320
|
|
337
|
-
})
|
|
338
|
-
}));
|
|
339
|
-
let functionTrigger;
|
|
340
|
-
canvasModel.builder.call((builder) => {
|
|
341
|
-
const triggerShape = createTrigger({
|
|
342
|
-
triggerKind: TriggerKind.Subscription,
|
|
343
|
-
...position({
|
|
344
|
-
x: -18,
|
|
345
|
-
y: -2
|
|
346
|
-
})
|
|
347
|
-
});
|
|
348
|
-
const trigger = canvasModel.createNode(triggerShape);
|
|
349
|
-
const { queueId } = setupQueue(canvasModel, {
|
|
350
|
-
queuePosition: {
|
|
351
|
-
centerX: -80,
|
|
352
|
-
centerY: 378,
|
|
353
|
-
width: 320,
|
|
354
|
-
height: 448
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
const append = canvasModel.createNode(createAppend(rawPosition({
|
|
358
|
-
centerX: 320,
|
|
359
|
-
centerY: 192,
|
|
360
|
-
width: 128,
|
|
361
|
-
height: 122
|
|
362
|
-
})));
|
|
363
|
-
builder.createEdge({
|
|
364
|
-
source: queueId.id,
|
|
365
|
-
target: append.id,
|
|
366
|
-
input: "id"
|
|
367
|
-
}).createEdge({
|
|
368
|
-
source: template.id,
|
|
369
|
-
target: append.id,
|
|
370
|
-
input: "items"
|
|
371
|
-
}).createEdge({
|
|
372
|
-
source: trigger.id,
|
|
373
|
-
target: template.id,
|
|
374
|
-
output: "type",
|
|
375
|
-
input: "type"
|
|
376
|
-
}).createEdge({
|
|
377
|
-
source: trigger.id,
|
|
378
|
-
target: template.id,
|
|
379
|
-
output: "changedObjectId",
|
|
380
|
-
input: "changedObjectId"
|
|
381
|
-
});
|
|
382
|
-
functionTrigger = triggerShape.functionTrigger.target;
|
|
383
|
-
const triggerSpec = functionTrigger.spec;
|
|
384
|
-
invariant(triggerSpec && triggerSpec.type === TriggerKind.Subscription, "No trigger spec.", {
|
|
385
|
-
F: __dxlog_file,
|
|
386
|
-
L: 127,
|
|
387
|
-
S: void 0,
|
|
388
|
-
A: [
|
|
389
|
-
"triggerSpec && triggerSpec.type === TriggerKind.Subscription",
|
|
390
|
-
"'No trigger spec.'"
|
|
391
|
-
]
|
|
392
|
-
});
|
|
393
|
-
triggerSpec.filter = {
|
|
394
|
-
type: "dxn:type:dxos.org/type/Chess"
|
|
395
|
-
};
|
|
396
|
-
});
|
|
397
|
-
const computeModel = createComputeGraph(canvasModel);
|
|
398
|
-
const templateComputeNode = computeModel.nodes.find((n2) => n2.id === template.node);
|
|
399
|
-
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
400
|
-
F: __dxlog_file,
|
|
401
|
-
L: 134,
|
|
402
|
-
S: void 0,
|
|
403
|
-
A: [
|
|
404
|
-
"templateComputeNode",
|
|
405
|
-
"'Template compute node was not created.'"
|
|
406
|
-
]
|
|
407
|
-
});
|
|
408
|
-
templateComputeNode.value = [
|
|
409
|
-
"{",
|
|
410
|
-
' "@type": "{{type}}",',
|
|
411
|
-
' "id": "{{changedObjectId}}"',
|
|
412
|
-
"}"
|
|
413
|
-
].join("\n");
|
|
414
|
-
templateComputeNode.inputSchema = toJsonSchema(S.Struct({
|
|
415
|
-
type: S.String,
|
|
416
|
-
changedObjectId: S.String
|
|
417
|
-
}));
|
|
418
|
-
attachTrigger(functionTrigger, computeModel);
|
|
338
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, TriggerKind.Subscription, (triggerSpec) => triggerSpec.filter = {
|
|
339
|
+
type: "dxn:type:dxos.org/type/Chess"
|
|
340
|
+
}, "type");
|
|
419
341
|
return addToSpace("objectChange-queue", space, canvasModel, computeModel);
|
|
420
342
|
});
|
|
421
343
|
cb?.(objects);
|
|
422
344
|
return objects;
|
|
423
345
|
}
|
|
424
346
|
],
|
|
347
|
+
[
|
|
348
|
+
"timerTick-queue",
|
|
349
|
+
async (space, n, cb) => {
|
|
350
|
+
const objects = range2(n, () => {
|
|
351
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, TriggerKind.Timer, (triggerSpec) => triggerSpec.cron = "*/5 * * * * *", "result");
|
|
352
|
+
return addToSpace("timerTick-queue", space, canvasModel, computeModel);
|
|
353
|
+
});
|
|
354
|
+
cb?.(objects);
|
|
355
|
+
return objects;
|
|
356
|
+
}
|
|
357
|
+
],
|
|
425
358
|
[
|
|
426
359
|
"email-table",
|
|
427
360
|
async (space, n, cb) => {
|
|
@@ -431,7 +364,7 @@ var presets = {
|
|
|
431
364
|
const emailTable = results.find((r) => r.object?.view?.target?.query?.type?.endsWith("Email"));
|
|
432
365
|
invariant(emailTable, "Email table not found.", {
|
|
433
366
|
F: __dxlog_file,
|
|
434
|
-
L:
|
|
367
|
+
L: 136,
|
|
435
368
|
S: void 0,
|
|
436
369
|
A: [
|
|
437
370
|
"emailTable",
|
|
@@ -453,6 +386,7 @@ var presets = {
|
|
|
453
386
|
let functionTrigger;
|
|
454
387
|
canvasModel.builder.call((builder) => {
|
|
455
388
|
const triggerShape = createTrigger({
|
|
389
|
+
spaceId: space.id,
|
|
456
390
|
triggerKind: TriggerKind.Email,
|
|
457
391
|
...position({
|
|
458
392
|
x: -18,
|
|
@@ -500,7 +434,7 @@ var presets = {
|
|
|
500
434
|
const templateComputeNode = computeModel.nodes.find((n2) => n2.id === template.node);
|
|
501
435
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
502
436
|
F: __dxlog_file,
|
|
503
|
-
L:
|
|
437
|
+
L: 182,
|
|
504
438
|
S: void 0,
|
|
505
439
|
A: [
|
|
506
440
|
"templateComputeNode",
|
|
@@ -536,7 +470,7 @@ var presets = {
|
|
|
536
470
|
width: 10,
|
|
537
471
|
height: 10
|
|
538
472
|
})));
|
|
539
|
-
const { queueId } = setupQueue(canvasModel);
|
|
473
|
+
const { queueId } = setupQueue(space, canvasModel);
|
|
540
474
|
const append = canvasModel.createNode(createAppend(position({
|
|
541
475
|
x: 10,
|
|
542
476
|
y: 6
|
|
@@ -576,7 +510,7 @@ var presets = {
|
|
|
576
510
|
const emailTable = results.find((r) => r.object?.view?.target?.query?.type?.endsWith("Email"));
|
|
577
511
|
invariant(emailTable, "Email table not found.", {
|
|
578
512
|
F: __dxlog_file,
|
|
579
|
-
L:
|
|
513
|
+
L: 233,
|
|
580
514
|
S: void 0,
|
|
581
515
|
A: [
|
|
582
516
|
"emailTable",
|
|
@@ -613,6 +547,7 @@ var presets = {
|
|
|
613
547
|
})
|
|
614
548
|
}));
|
|
615
549
|
const triggerShape = createTrigger({
|
|
550
|
+
spaceId: space.id,
|
|
616
551
|
triggerKind: TriggerKind.Email,
|
|
617
552
|
...rawPosition({
|
|
618
553
|
centerX: -736,
|
|
@@ -622,7 +557,7 @@ var presets = {
|
|
|
622
557
|
})
|
|
623
558
|
});
|
|
624
559
|
const trigger = canvasModel.createNode(triggerShape);
|
|
625
|
-
const { queueId } = setupQueue(canvasModel, {
|
|
560
|
+
const { queueId } = setupQueue(space, canvasModel, {
|
|
626
561
|
idPosition: {
|
|
627
562
|
centerX: -720,
|
|
628
563
|
centerY: 224,
|
|
@@ -709,7 +644,7 @@ var presets = {
|
|
|
709
644
|
const templateComputeNode = computeModel.nodes.find((n2) => n2.id === template.node);
|
|
710
645
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
711
646
|
F: __dxlog_file,
|
|
712
|
-
L:
|
|
647
|
+
L: 305,
|
|
713
648
|
S: void 0,
|
|
714
649
|
A: [
|
|
715
650
|
"templateComputeNode",
|
|
@@ -782,18 +717,28 @@ var presets = {
|
|
|
782
717
|
async (space, n, cb) => {
|
|
783
718
|
const objects = range2(n, () => {
|
|
784
719
|
const canvasModel = CanvasGraphModel.create();
|
|
720
|
+
let functionTrigger;
|
|
785
721
|
canvasModel.builder.call((builder) => {
|
|
786
|
-
const
|
|
787
|
-
|
|
722
|
+
const triggerShape = createTrigger({
|
|
723
|
+
spaceId: space.id,
|
|
724
|
+
triggerKind: TriggerKind.Timer,
|
|
788
725
|
...position({
|
|
789
726
|
x: -10,
|
|
790
727
|
y: -5
|
|
791
728
|
})
|
|
729
|
+
});
|
|
730
|
+
const trigger = canvasModel.createNode(triggerShape);
|
|
731
|
+
const channelId = canvasModel.createNode(createConstant({
|
|
732
|
+
value: "1088569858767212554",
|
|
733
|
+
...position({
|
|
734
|
+
x: -10,
|
|
735
|
+
y: 0
|
|
736
|
+
})
|
|
792
737
|
}));
|
|
793
738
|
const queueId = canvasModel.createNode(createConstant({
|
|
794
739
|
value: new DXN2(DXN2.kind.QUEUE, [
|
|
795
740
|
"data",
|
|
796
|
-
|
|
741
|
+
space.id,
|
|
797
742
|
ObjectId2.random()
|
|
798
743
|
]).toString(),
|
|
799
744
|
...position({
|
|
@@ -814,13 +759,17 @@ var presets = {
|
|
|
814
759
|
y: 12
|
|
815
760
|
})));
|
|
816
761
|
builder.createEdge({
|
|
817
|
-
source:
|
|
762
|
+
source: trigger.id,
|
|
818
763
|
target: converter.id,
|
|
819
|
-
input: "
|
|
764
|
+
input: "tick"
|
|
820
765
|
}).createEdge({
|
|
821
766
|
source: channelId.id,
|
|
822
767
|
target: converter.id,
|
|
823
768
|
input: "channelId"
|
|
769
|
+
}).createEdge({
|
|
770
|
+
source: queueId.id,
|
|
771
|
+
target: converter.id,
|
|
772
|
+
input: "queueId"
|
|
824
773
|
}).createEdge({
|
|
825
774
|
source: converter.id,
|
|
826
775
|
target: view.id,
|
|
@@ -830,16 +779,178 @@ var presets = {
|
|
|
830
779
|
target: queue.id,
|
|
831
780
|
input: "input"
|
|
832
781
|
});
|
|
782
|
+
functionTrigger = triggerShape.functionTrigger.target;
|
|
833
783
|
});
|
|
834
784
|
const computeModel = createComputeGraph(canvasModel);
|
|
785
|
+
attachTrigger(functionTrigger, computeModel);
|
|
835
786
|
return addToSpace("discord-messages", space, canvasModel, computeModel);
|
|
836
787
|
});
|
|
837
788
|
cb?.(objects);
|
|
838
789
|
return objects;
|
|
839
790
|
}
|
|
791
|
+
],
|
|
792
|
+
[
|
|
793
|
+
"kanban-queue",
|
|
794
|
+
async (space, n, cb) => {
|
|
795
|
+
const objects = range2(n, () => {
|
|
796
|
+
const canvasModel = CanvasGraphModel.create();
|
|
797
|
+
const results = space.db.query(Filter2.schema(TableType2)).runSync();
|
|
798
|
+
const messages = results.find((r) => r.object?.view?.target?.query?.type?.endsWith("Message"));
|
|
799
|
+
invariant(messages, "Table not found.", {
|
|
800
|
+
F: __dxlog_file,
|
|
801
|
+
L: 411,
|
|
802
|
+
S: void 0,
|
|
803
|
+
A: [
|
|
804
|
+
"messages",
|
|
805
|
+
"'Table not found.'"
|
|
806
|
+
]
|
|
807
|
+
});
|
|
808
|
+
let functionTrigger;
|
|
809
|
+
canvasModel.builder.call((builder) => {
|
|
810
|
+
const triggerShape = createTrigger({
|
|
811
|
+
spaceId: space.id,
|
|
812
|
+
triggerKind: TriggerKind.Queue,
|
|
813
|
+
...position({
|
|
814
|
+
x: -10,
|
|
815
|
+
y: -5
|
|
816
|
+
})
|
|
817
|
+
});
|
|
818
|
+
const trigger = canvasModel.createNode(triggerShape);
|
|
819
|
+
const tableId = canvasModel.createNode(createConstant({
|
|
820
|
+
value: DXN2.fromLocalObjectId(messages.id).toString(),
|
|
821
|
+
...position({
|
|
822
|
+
x: -10,
|
|
823
|
+
y: 5
|
|
824
|
+
})
|
|
825
|
+
}));
|
|
826
|
+
const appendToTable = canvasModel.createNode(createAppend(position({
|
|
827
|
+
x: 10,
|
|
828
|
+
y: 0
|
|
829
|
+
})));
|
|
830
|
+
builder.createEdge({
|
|
831
|
+
source: tableId.id,
|
|
832
|
+
target: appendToTable.id,
|
|
833
|
+
input: "id"
|
|
834
|
+
}).createEdge({
|
|
835
|
+
source: trigger.id,
|
|
836
|
+
target: appendToTable.id,
|
|
837
|
+
input: "items",
|
|
838
|
+
output: "item"
|
|
839
|
+
});
|
|
840
|
+
functionTrigger = triggerShape.functionTrigger.target;
|
|
841
|
+
});
|
|
842
|
+
const computeModel = createComputeGraph(canvasModel);
|
|
843
|
+
attachTrigger(functionTrigger, computeModel);
|
|
844
|
+
return addToSpace("kanban-queue", space, canvasModel, computeModel);
|
|
845
|
+
});
|
|
846
|
+
cb?.(objects);
|
|
847
|
+
return objects;
|
|
848
|
+
}
|
|
840
849
|
]
|
|
841
850
|
]
|
|
842
851
|
};
|
|
852
|
+
var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) => {
|
|
853
|
+
const canvasModel = CanvasGraphModel.create();
|
|
854
|
+
const template = canvasModel.createNode(createTemplate({
|
|
855
|
+
valueType: "object",
|
|
856
|
+
...rawPosition({
|
|
857
|
+
centerX: -64,
|
|
858
|
+
centerY: -79,
|
|
859
|
+
width: 320,
|
|
860
|
+
height: 320
|
|
861
|
+
})
|
|
862
|
+
}));
|
|
863
|
+
let functionTrigger;
|
|
864
|
+
canvasModel.builder.call((builder) => {
|
|
865
|
+
const triggerShape = createTrigger({
|
|
866
|
+
spaceId: space.id,
|
|
867
|
+
triggerKind,
|
|
868
|
+
...rawPosition({
|
|
869
|
+
centerX: -578,
|
|
870
|
+
centerY: -187,
|
|
871
|
+
height: 320,
|
|
872
|
+
width: 320
|
|
873
|
+
})
|
|
874
|
+
});
|
|
875
|
+
const trigger = canvasModel.createNode(triggerShape);
|
|
876
|
+
const { queueId } = setupQueue(space, canvasModel, {
|
|
877
|
+
queuePosition: {
|
|
878
|
+
centerX: -80,
|
|
879
|
+
centerY: 378,
|
|
880
|
+
width: 320,
|
|
881
|
+
height: 448
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
const append = canvasModel.createNode(createAppend(rawPosition({
|
|
885
|
+
centerX: 320,
|
|
886
|
+
centerY: 192,
|
|
887
|
+
width: 128,
|
|
888
|
+
height: 122
|
|
889
|
+
})));
|
|
890
|
+
const random = canvasModel.createNode(createRandom(rawPosition({
|
|
891
|
+
centerX: -509,
|
|
892
|
+
centerY: -30,
|
|
893
|
+
width: 64,
|
|
894
|
+
height: 64
|
|
895
|
+
})));
|
|
896
|
+
builder.createEdge({
|
|
897
|
+
source: queueId.id,
|
|
898
|
+
target: append.id,
|
|
899
|
+
input: "id"
|
|
900
|
+
}).createEdge({
|
|
901
|
+
source: template.id,
|
|
902
|
+
target: append.id,
|
|
903
|
+
input: "items"
|
|
904
|
+
}).createEdge({
|
|
905
|
+
source: trigger.id,
|
|
906
|
+
target: template.id,
|
|
907
|
+
output: triggerOutputName,
|
|
908
|
+
input: "type"
|
|
909
|
+
}).createEdge({
|
|
910
|
+
source: random.id,
|
|
911
|
+
target: template.id,
|
|
912
|
+
input: "changeId"
|
|
913
|
+
});
|
|
914
|
+
functionTrigger = triggerShape.functionTrigger.target;
|
|
915
|
+
const triggerSpec = functionTrigger.spec;
|
|
916
|
+
invariant(triggerSpec && triggerSpec.type === triggerKind, "No trigger spec.", {
|
|
917
|
+
F: __dxlog_file,
|
|
918
|
+
L: 494,
|
|
919
|
+
S: void 0,
|
|
920
|
+
A: [
|
|
921
|
+
"triggerSpec && triggerSpec.type === triggerKind",
|
|
922
|
+
"'No trigger spec.'"
|
|
923
|
+
]
|
|
924
|
+
});
|
|
925
|
+
initSpec(triggerSpec);
|
|
926
|
+
});
|
|
927
|
+
const computeModel = createComputeGraph(canvasModel);
|
|
928
|
+
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
929
|
+
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
930
|
+
F: __dxlog_file,
|
|
931
|
+
L: 501,
|
|
932
|
+
S: void 0,
|
|
933
|
+
A: [
|
|
934
|
+
"templateComputeNode",
|
|
935
|
+
"'Template compute node was not created.'"
|
|
936
|
+
]
|
|
937
|
+
});
|
|
938
|
+
templateComputeNode.value = [
|
|
939
|
+
"{",
|
|
940
|
+
' "@type": "{{type}}",',
|
|
941
|
+
' "id": "@{{changeId}}"',
|
|
942
|
+
"}"
|
|
943
|
+
].join("\n");
|
|
944
|
+
templateComputeNode.inputSchema = toJsonSchema(S.Struct({
|
|
945
|
+
type: S.String,
|
|
946
|
+
changeId: S.String
|
|
947
|
+
}));
|
|
948
|
+
attachTrigger(functionTrigger, computeModel);
|
|
949
|
+
return {
|
|
950
|
+
canvasModel,
|
|
951
|
+
computeModel
|
|
952
|
+
};
|
|
953
|
+
};
|
|
843
954
|
var addToSpace = (name, space, canvas, compute) => {
|
|
844
955
|
return space.db.add(create2(CanvasBoardType, {
|
|
845
956
|
name,
|
|
@@ -847,11 +958,11 @@ var addToSpace = (name, space, canvas, compute) => {
|
|
|
847
958
|
layout: canvas.graph
|
|
848
959
|
}));
|
|
849
960
|
};
|
|
850
|
-
var setupQueue = (canvasModel, args) => {
|
|
961
|
+
var setupQueue = (space, canvasModel, args) => {
|
|
851
962
|
const queueId = canvasModel.createNode(createConstant({
|
|
852
963
|
value: new DXN2(DXN2.kind.QUEUE, [
|
|
853
964
|
"data",
|
|
854
|
-
|
|
965
|
+
space.id,
|
|
855
966
|
ObjectId2.random()
|
|
856
967
|
]).toString(),
|
|
857
968
|
...args?.idPosition ? rawPosition(args.idPosition) : position({
|
|
@@ -879,7 +990,7 @@ var setupQueue = (canvasModel, args) => {
|
|
|
879
990
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
880
991
|
invariant(functionTrigger, void 0, {
|
|
881
992
|
F: __dxlog_file,
|
|
882
|
-
L:
|
|
993
|
+
L: 541,
|
|
883
994
|
S: void 0,
|
|
884
995
|
A: [
|
|
885
996
|
"functionTrigger",
|
|
@@ -936,7 +1047,9 @@ var position = (rect) => {
|
|
|
936
1047
|
};
|
|
937
1048
|
|
|
938
1049
|
// packages/plugins/plugin-debug/src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
1050
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/SpaceGenerator.tsx";
|
|
939
1051
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
1052
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
940
1053
|
const client = useClient();
|
|
941
1054
|
const staticTypes = [
|
|
942
1055
|
DocumentType2,
|
|
@@ -948,7 +1061,8 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
948
1061
|
Testing.OrgType,
|
|
949
1062
|
Testing.ProjectType,
|
|
950
1063
|
Testing.ContactType,
|
|
951
|
-
Testing.EmailType
|
|
1064
|
+
Testing.EmailType,
|
|
1065
|
+
Testing.MessageType
|
|
952
1066
|
];
|
|
953
1067
|
const [count, setCount] = useState(1);
|
|
954
1068
|
const [info, setInfo] = useState({});
|
|
@@ -1003,6 +1117,66 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
1003
1117
|
typeMap,
|
|
1004
1118
|
count
|
|
1005
1119
|
]);
|
|
1120
|
+
const handleLoadTables = useCallback(async () => {
|
|
1121
|
+
const input = document.createElement("input");
|
|
1122
|
+
input.type = "file";
|
|
1123
|
+
input.accept = ".json";
|
|
1124
|
+
input.onchange = async (e) => {
|
|
1125
|
+
const file = e.target.files?.[0];
|
|
1126
|
+
if (!file) {
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
try {
|
|
1130
|
+
const content = await file.text();
|
|
1131
|
+
const data = JSON.parse(content);
|
|
1132
|
+
const schemas = await space.db.schemaRegistry.register(data.schemas.map(toEffectSchema));
|
|
1133
|
+
await Promise.all(schemas.map(async (schema) => {
|
|
1134
|
+
const parts = schema.typename.split("/");
|
|
1135
|
+
const name = parts[parts.length - 1];
|
|
1136
|
+
const table = create3(TableType3, {
|
|
1137
|
+
name,
|
|
1138
|
+
threads: []
|
|
1139
|
+
});
|
|
1140
|
+
await initializeTable({
|
|
1141
|
+
space,
|
|
1142
|
+
table,
|
|
1143
|
+
initialSchema: schema.typename
|
|
1144
|
+
});
|
|
1145
|
+
await dispatch(createIntent(SpaceAction.AddObject, {
|
|
1146
|
+
target: space,
|
|
1147
|
+
object: table
|
|
1148
|
+
}));
|
|
1149
|
+
return table;
|
|
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: 131,
|
|
1160
|
+
S: void 0,
|
|
1161
|
+
C: (f, a) => f(...a)
|
|
1162
|
+
});
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1165
|
+
const object = create3(schema, fields);
|
|
1166
|
+
space.db.add(object);
|
|
1167
|
+
return object;
|
|
1168
|
+
}));
|
|
1169
|
+
} catch (err) {
|
|
1170
|
+
log.catch(err, void 0, {
|
|
1171
|
+
F: __dxlog_file2,
|
|
1172
|
+
L: 140,
|
|
1173
|
+
S: void 0,
|
|
1174
|
+
C: (f, a) => f(...a)
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
input.click();
|
|
1179
|
+
}, []);
|
|
1006
1180
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
1007
1181
|
role: "none",
|
|
1008
1182
|
className: "flex flex-col divide-y divide-separator"
|
|
@@ -1013,6 +1187,11 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
1013
1187
|
iconOnly: true,
|
|
1014
1188
|
label: "Refresh",
|
|
1015
1189
|
onClick: updateInfo
|
|
1190
|
+
}), /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
1191
|
+
icon: "ph--file-arrow-up--regular",
|
|
1192
|
+
iconOnly: true,
|
|
1193
|
+
label: "Load tables from JSON",
|
|
1194
|
+
onClick: handleLoadTables
|
|
1016
1195
|
}), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
|
|
1017
1196
|
variant: "gap"
|
|
1018
1197
|
}), /* @__PURE__ */ React2.createElement("div", {
|
|
@@ -1056,4 +1235,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
1056
1235
|
export {
|
|
1057
1236
|
SpaceGenerator_default as default
|
|
1058
1237
|
};
|
|
1059
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1238
|
+
//# sourceMappingURL=SpaceGenerator-BPZGOSH4.mjs.map
|