@dxos/plugin-debug 0.7.5-labs.ff2ff30 → 0.7.5-main.6a330ac
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-4VO7E5P2.mjs → SpaceGenerator-BPZGOSH4.mjs} +409 -17
- 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-ZRQ4TPNG.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 +6 -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 +250 -9
- package/src/translations.ts +28 -0
- package/src/types.ts +52 -1
- package/dist/lib/browser/SpaceGenerator-4VO7E5P2.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-ZRQ4TPNG.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, createGpt, createQueue, 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";
|
|
@@ -250,6 +256,11 @@ var PresetName;
|
|
|
250
256
|
PresetName2["GPT_QUEUE"] = "webhook-gpt-queue";
|
|
251
257
|
PresetName2["CHAT_GPT"] = "chat-gpt-text";
|
|
252
258
|
PresetName2["EMAIL_WITH_SUMMARY"] = "email-gptSummary-table";
|
|
259
|
+
PresetName2["OBJECT_CHANGE_QUEUE"] = "objectChange-queue";
|
|
260
|
+
PresetName2["FOREX_FUNCTION_CALL"] = "forex-function-call";
|
|
261
|
+
PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
|
|
262
|
+
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
263
|
+
PresetName2["KANBAN_QUEUE"] = "kanban-queue";
|
|
253
264
|
})(PresetName || (PresetName = {}));
|
|
254
265
|
var presets = {
|
|
255
266
|
schemas: [
|
|
@@ -272,6 +283,7 @@ var presets = {
|
|
|
272
283
|
y: -14
|
|
273
284
|
})));
|
|
274
285
|
const triggerShape = createTrigger({
|
|
286
|
+
spaceId: space.id,
|
|
275
287
|
triggerKind: TriggerKind.Webhook,
|
|
276
288
|
...position({
|
|
277
289
|
x: -18,
|
|
@@ -285,7 +297,7 @@ var presets = {
|
|
|
285
297
|
width: 10,
|
|
286
298
|
height: 10
|
|
287
299
|
})));
|
|
288
|
-
const { queueId } = setupQueue(canvasModel);
|
|
300
|
+
const { queueId } = setupQueue(space, canvasModel);
|
|
289
301
|
const append = canvasModel.createNode(createAppend(position({
|
|
290
302
|
x: 10,
|
|
291
303
|
y: 6
|
|
@@ -294,7 +306,7 @@ var presets = {
|
|
|
294
306
|
source: trigger.id,
|
|
295
307
|
target: gpt.id,
|
|
296
308
|
input: "prompt",
|
|
297
|
-
output: "
|
|
309
|
+
output: "bodyText"
|
|
298
310
|
}).createEdge({
|
|
299
311
|
source: gpt.id,
|
|
300
312
|
target: text.id,
|
|
@@ -319,6 +331,30 @@ var presets = {
|
|
|
319
331
|
return objects;
|
|
320
332
|
}
|
|
321
333
|
],
|
|
334
|
+
[
|
|
335
|
+
"objectChange-queue",
|
|
336
|
+
async (space, n, cb) => {
|
|
337
|
+
const objects = range2(n, () => {
|
|
338
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, TriggerKind.Subscription, (triggerSpec) => triggerSpec.filter = {
|
|
339
|
+
type: "dxn:type:dxos.org/type/Chess"
|
|
340
|
+
}, "type");
|
|
341
|
+
return addToSpace("objectChange-queue", space, canvasModel, computeModel);
|
|
342
|
+
});
|
|
343
|
+
cb?.(objects);
|
|
344
|
+
return objects;
|
|
345
|
+
}
|
|
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
|
+
],
|
|
322
358
|
[
|
|
323
359
|
"email-table",
|
|
324
360
|
async (space, n, cb) => {
|
|
@@ -328,7 +364,7 @@ var presets = {
|
|
|
328
364
|
const emailTable = results.find((r) => r.object?.view?.target?.query?.type?.endsWith("Email"));
|
|
329
365
|
invariant(emailTable, "Email table not found.", {
|
|
330
366
|
F: __dxlog_file,
|
|
331
|
-
L:
|
|
367
|
+
L: 136,
|
|
332
368
|
S: void 0,
|
|
333
369
|
A: [
|
|
334
370
|
"emailTable",
|
|
@@ -350,6 +386,7 @@ var presets = {
|
|
|
350
386
|
let functionTrigger;
|
|
351
387
|
canvasModel.builder.call((builder) => {
|
|
352
388
|
const triggerShape = createTrigger({
|
|
389
|
+
spaceId: space.id,
|
|
353
390
|
triggerKind: TriggerKind.Email,
|
|
354
391
|
...position({
|
|
355
392
|
x: -18,
|
|
@@ -397,7 +434,7 @@ var presets = {
|
|
|
397
434
|
const templateComputeNode = computeModel.nodes.find((n2) => n2.id === template.node);
|
|
398
435
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
399
436
|
F: __dxlog_file,
|
|
400
|
-
L:
|
|
437
|
+
L: 182,
|
|
401
438
|
S: void 0,
|
|
402
439
|
A: [
|
|
403
440
|
"templateComputeNode",
|
|
@@ -433,7 +470,7 @@ var presets = {
|
|
|
433
470
|
width: 10,
|
|
434
471
|
height: 10
|
|
435
472
|
})));
|
|
436
|
-
const { queueId } = setupQueue(canvasModel);
|
|
473
|
+
const { queueId } = setupQueue(space, canvasModel);
|
|
437
474
|
const append = canvasModel.createNode(createAppend(position({
|
|
438
475
|
x: 10,
|
|
439
476
|
y: 6
|
|
@@ -473,7 +510,7 @@ var presets = {
|
|
|
473
510
|
const emailTable = results.find((r) => r.object?.view?.target?.query?.type?.endsWith("Email"));
|
|
474
511
|
invariant(emailTable, "Email table not found.", {
|
|
475
512
|
F: __dxlog_file,
|
|
476
|
-
L:
|
|
513
|
+
L: 233,
|
|
477
514
|
S: void 0,
|
|
478
515
|
A: [
|
|
479
516
|
"emailTable",
|
|
@@ -510,6 +547,7 @@ var presets = {
|
|
|
510
547
|
})
|
|
511
548
|
}));
|
|
512
549
|
const triggerShape = createTrigger({
|
|
550
|
+
spaceId: space.id,
|
|
513
551
|
triggerKind: TriggerKind.Email,
|
|
514
552
|
...rawPosition({
|
|
515
553
|
centerX: -736,
|
|
@@ -519,7 +557,7 @@ var presets = {
|
|
|
519
557
|
})
|
|
520
558
|
});
|
|
521
559
|
const trigger = canvasModel.createNode(triggerShape);
|
|
522
|
-
const { queueId } = setupQueue(canvasModel, {
|
|
560
|
+
const { queueId } = setupQueue(space, canvasModel, {
|
|
523
561
|
idPosition: {
|
|
524
562
|
centerX: -720,
|
|
525
563
|
centerY: 224,
|
|
@@ -606,7 +644,7 @@ var presets = {
|
|
|
606
644
|
const templateComputeNode = computeModel.nodes.find((n2) => n2.id === template.node);
|
|
607
645
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
608
646
|
F: __dxlog_file,
|
|
609
|
-
L:
|
|
647
|
+
L: 305,
|
|
610
648
|
S: void 0,
|
|
611
649
|
A: [
|
|
612
650
|
"templateComputeNode",
|
|
@@ -624,9 +662,295 @@ var presets = {
|
|
|
624
662
|
cb?.(objects);
|
|
625
663
|
return objects;
|
|
626
664
|
}
|
|
665
|
+
],
|
|
666
|
+
[
|
|
667
|
+
"forex-function-call",
|
|
668
|
+
async (space, n, cb) => {
|
|
669
|
+
const objects = range2(n, () => {
|
|
670
|
+
const canvasModel = CanvasGraphModel.create();
|
|
671
|
+
canvasModel.builder.call((builder) => {
|
|
672
|
+
const sourceCurrency = canvasModel.createNode(createConstant({
|
|
673
|
+
value: "USD",
|
|
674
|
+
...position({
|
|
675
|
+
x: -10,
|
|
676
|
+
y: -5
|
|
677
|
+
})
|
|
678
|
+
}));
|
|
679
|
+
const targetCurrency = canvasModel.createNode(createConstant({
|
|
680
|
+
value: "EUR",
|
|
681
|
+
...position({
|
|
682
|
+
x: -10,
|
|
683
|
+
y: 5
|
|
684
|
+
})
|
|
685
|
+
}));
|
|
686
|
+
const converter = canvasModel.createNode(createFunction(position({
|
|
687
|
+
x: 0,
|
|
688
|
+
y: 0
|
|
689
|
+
})));
|
|
690
|
+
const view = canvasModel.createNode(createSurface(position({
|
|
691
|
+
x: 12,
|
|
692
|
+
y: 0
|
|
693
|
+
})));
|
|
694
|
+
builder.createEdge({
|
|
695
|
+
source: sourceCurrency.id,
|
|
696
|
+
target: converter.id,
|
|
697
|
+
input: "from"
|
|
698
|
+
}).createEdge({
|
|
699
|
+
source: targetCurrency.id,
|
|
700
|
+
target: converter.id,
|
|
701
|
+
input: "to"
|
|
702
|
+
}).createEdge({
|
|
703
|
+
source: converter.id,
|
|
704
|
+
target: view.id,
|
|
705
|
+
output: "rate"
|
|
706
|
+
});
|
|
707
|
+
});
|
|
708
|
+
const computeModel = createComputeGraph(canvasModel);
|
|
709
|
+
return addToSpace("forex-function-call", space, canvasModel, computeModel);
|
|
710
|
+
});
|
|
711
|
+
cb?.(objects);
|
|
712
|
+
return objects;
|
|
713
|
+
}
|
|
714
|
+
],
|
|
715
|
+
[
|
|
716
|
+
"discord-messages",
|
|
717
|
+
async (space, n, cb) => {
|
|
718
|
+
const objects = range2(n, () => {
|
|
719
|
+
const canvasModel = CanvasGraphModel.create();
|
|
720
|
+
let functionTrigger;
|
|
721
|
+
canvasModel.builder.call((builder) => {
|
|
722
|
+
const triggerShape = createTrigger({
|
|
723
|
+
spaceId: space.id,
|
|
724
|
+
triggerKind: TriggerKind.Timer,
|
|
725
|
+
...position({
|
|
726
|
+
x: -10,
|
|
727
|
+
y: -5
|
|
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
|
+
})
|
|
737
|
+
}));
|
|
738
|
+
const queueId = canvasModel.createNode(createConstant({
|
|
739
|
+
value: new DXN2(DXN2.kind.QUEUE, [
|
|
740
|
+
"data",
|
|
741
|
+
space.id,
|
|
742
|
+
ObjectId2.random()
|
|
743
|
+
]).toString(),
|
|
744
|
+
...position({
|
|
745
|
+
x: -10,
|
|
746
|
+
y: 5
|
|
747
|
+
})
|
|
748
|
+
}));
|
|
749
|
+
const converter = canvasModel.createNode(createFunction(position({
|
|
750
|
+
x: 0,
|
|
751
|
+
y: 0
|
|
752
|
+
})));
|
|
753
|
+
const view = canvasModel.createNode(createText(position({
|
|
754
|
+
x: 12,
|
|
755
|
+
y: 0
|
|
756
|
+
})));
|
|
757
|
+
const queue = canvasModel.createNode(createQueue(position({
|
|
758
|
+
x: 0,
|
|
759
|
+
y: 12
|
|
760
|
+
})));
|
|
761
|
+
builder.createEdge({
|
|
762
|
+
source: trigger.id,
|
|
763
|
+
target: converter.id,
|
|
764
|
+
input: "tick"
|
|
765
|
+
}).createEdge({
|
|
766
|
+
source: channelId.id,
|
|
767
|
+
target: converter.id,
|
|
768
|
+
input: "channelId"
|
|
769
|
+
}).createEdge({
|
|
770
|
+
source: queueId.id,
|
|
771
|
+
target: converter.id,
|
|
772
|
+
input: "queueId"
|
|
773
|
+
}).createEdge({
|
|
774
|
+
source: converter.id,
|
|
775
|
+
target: view.id,
|
|
776
|
+
output: "newMessages"
|
|
777
|
+
}).createEdge({
|
|
778
|
+
source: queueId.id,
|
|
779
|
+
target: queue.id,
|
|
780
|
+
input: "input"
|
|
781
|
+
});
|
|
782
|
+
functionTrigger = triggerShape.functionTrigger.target;
|
|
783
|
+
});
|
|
784
|
+
const computeModel = createComputeGraph(canvasModel);
|
|
785
|
+
attachTrigger(functionTrigger, computeModel);
|
|
786
|
+
return addToSpace("discord-messages", space, canvasModel, computeModel);
|
|
787
|
+
});
|
|
788
|
+
cb?.(objects);
|
|
789
|
+
return objects;
|
|
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
|
+
}
|
|
627
849
|
]
|
|
628
850
|
]
|
|
629
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
|
+
};
|
|
630
954
|
var addToSpace = (name, space, canvas, compute) => {
|
|
631
955
|
return space.db.add(create2(CanvasBoardType, {
|
|
632
956
|
name,
|
|
@@ -634,11 +958,11 @@ var addToSpace = (name, space, canvas, compute) => {
|
|
|
634
958
|
layout: canvas.graph
|
|
635
959
|
}));
|
|
636
960
|
};
|
|
637
|
-
var setupQueue = (canvasModel, args) => {
|
|
961
|
+
var setupQueue = (space, canvasModel, args) => {
|
|
638
962
|
const queueId = canvasModel.createNode(createConstant({
|
|
639
963
|
value: new DXN2(DXN2.kind.QUEUE, [
|
|
640
964
|
"data",
|
|
641
|
-
|
|
965
|
+
space.id,
|
|
642
966
|
ObjectId2.random()
|
|
643
967
|
]).toString(),
|
|
644
968
|
...args?.idPosition ? rawPosition(args.idPosition) : position({
|
|
@@ -666,7 +990,7 @@ var setupQueue = (canvasModel, args) => {
|
|
|
666
990
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
667
991
|
invariant(functionTrigger, void 0, {
|
|
668
992
|
F: __dxlog_file,
|
|
669
|
-
L:
|
|
993
|
+
L: 541,
|
|
670
994
|
S: void 0,
|
|
671
995
|
A: [
|
|
672
996
|
"functionTrigger",
|
|
@@ -723,7 +1047,9 @@ var position = (rect) => {
|
|
|
723
1047
|
};
|
|
724
1048
|
|
|
725
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";
|
|
726
1051
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
1052
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
727
1053
|
const client = useClient();
|
|
728
1054
|
const staticTypes = [
|
|
729
1055
|
DocumentType2,
|
|
@@ -735,7 +1061,8 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
735
1061
|
Testing.OrgType,
|
|
736
1062
|
Testing.ProjectType,
|
|
737
1063
|
Testing.ContactType,
|
|
738
|
-
Testing.EmailType
|
|
1064
|
+
Testing.EmailType,
|
|
1065
|
+
Testing.MessageType
|
|
739
1066
|
];
|
|
740
1067
|
const [count, setCount] = useState(1);
|
|
741
1068
|
const [info, setInfo] = useState({});
|
|
@@ -790,6 +1117,66 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
790
1117
|
typeMap,
|
|
791
1118
|
count
|
|
792
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
|
+
}, []);
|
|
793
1180
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
794
1181
|
role: "none",
|
|
795
1182
|
className: "flex flex-col divide-y divide-separator"
|
|
@@ -800,6 +1187,11 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
800
1187
|
iconOnly: true,
|
|
801
1188
|
label: "Refresh",
|
|
802
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
|
|
803
1195
|
}), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
|
|
804
1196
|
variant: "gap"
|
|
805
1197
|
}), /* @__PURE__ */ React2.createElement("div", {
|
|
@@ -843,4 +1235,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
843
1235
|
export {
|
|
844
1236
|
SpaceGenerator_default as default
|
|
845
1237
|
};
|
|
846
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1238
|
+
//# sourceMappingURL=SpaceGenerator-BPZGOSH4.mjs.map
|