@dxos/react-ui-canvas-compute 0.8.4-main.b97322e → 0.8.4-main.c4373fc
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/index.mjs +217 -172
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +217 -172
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/compute.stories.d.ts +12 -5
- package/dist/types/src/compute.stories.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +34 -8
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/graph/node-defs.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts +2 -2
- package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts +3 -2
- package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphMonitor.d.ts +1 -1
- package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
- package/dist/types/src/json.test.d.ts +1 -1
- package/dist/types/src/json.test.d.ts.map +1 -1
- package/dist/types/src/shapes/Append.d.ts +1 -1
- package/dist/types/src/shapes/Append.d.ts.map +1 -1
- package/dist/types/src/shapes/Array.d.ts +1 -1
- package/dist/types/src/shapes/Array.d.ts.map +1 -1
- package/dist/types/src/shapes/Audio.d.ts +1 -1
- package/dist/types/src/shapes/Audio.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts +1 -1
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/Boolean.d.ts +1 -1
- package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
- package/dist/types/src/shapes/Chat.d.ts +1 -1
- package/dist/types/src/shapes/Chat.d.ts.map +1 -1
- package/dist/types/src/shapes/Constant.d.ts +1 -1
- package/dist/types/src/shapes/Constant.d.ts.map +1 -1
- package/dist/types/src/shapes/Database.d.ts +1 -1
- package/dist/types/src/shapes/Database.d.ts.map +1 -1
- package/dist/types/src/shapes/Function.d.ts +1 -1
- package/dist/types/src/shapes/Function.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts +1 -1
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
- package/dist/types/src/shapes/Json.d.ts +1 -1
- package/dist/types/src/shapes/Json.d.ts.map +1 -1
- package/dist/types/src/shapes/Logic.d.ts +1 -1
- package/dist/types/src/shapes/Logic.d.ts.map +1 -1
- package/dist/types/src/shapes/Queue.d.ts +1 -1
- package/dist/types/src/shapes/Queue.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts +1 -1
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Scope.d.ts +1 -1
- package/dist/types/src/shapes/Scope.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts +1 -1
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Switch.d.ts +1 -1
- package/dist/types/src/shapes/Switch.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts +1 -1
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Template.d.ts +1 -1
- package/dist/types/src/shapes/Template.d.ts.map +1 -1
- package/dist/types/src/shapes/Text.d.ts +1 -1
- package/dist/types/src/shapes/Text.d.ts.map +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts +1 -1
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +3 -32
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
- package/dist/types/src/shapes/defs.d.ts +2 -1
- package/dist/types/src/shapes/defs.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +51 -49
- package/src/compute-layout.ts +1 -1
- package/src/compute.stories.tsx +24 -25
- package/src/graph/controller.ts +13 -9
- package/src/graph/node-defs.ts +4 -4
- package/src/hooks/useComputeGraphController.ts +2 -2
- package/src/hooks/useComputeNodeState.ts +7 -5
- package/src/hooks/useGraphMonitor.ts +2 -2
- package/src/json.test.ts +1 -1
- package/src/registry.ts +2 -2
- package/src/schema.test.ts +4 -4
- package/src/shapes/Append.tsx +3 -3
- package/src/shapes/Array.tsx +3 -3
- package/src/shapes/Audio.tsx +4 -3
- package/src/shapes/Beacon.tsx +4 -3
- package/src/shapes/Boolean.tsx +3 -3
- package/src/shapes/Chat.tsx +4 -3
- package/src/shapes/Constant.tsx +4 -3
- package/src/shapes/Database.tsx +2 -2
- package/src/shapes/Function.tsx +7 -6
- package/src/shapes/Gpt.tsx +7 -5
- package/src/shapes/GptRealtime.tsx +2 -2
- package/src/shapes/Json.tsx +4 -3
- package/src/shapes/Logic.tsx +3 -3
- package/src/shapes/Queue.tsx +4 -3
- package/src/shapes/RNG.tsx +4 -3
- package/src/shapes/Scope.tsx +5 -4
- package/src/shapes/Surface.tsx +4 -3
- package/src/shapes/Switch.tsx +4 -3
- package/src/shapes/Table.tsx +3 -3
- package/src/shapes/Template.tsx +6 -5
- package/src/shapes/Text.tsx +5 -4
- package/src/shapes/TextToImage.tsx +2 -2
- package/src/shapes/Thread.tsx +3 -3
- package/src/shapes/Trigger.tsx +37 -33
- package/src/shapes/common/Box.tsx +1 -1
- package/src/shapes/common/FunctionBody.tsx +3 -2
- package/src/shapes/defs.ts +3 -2
- package/src/testing/circuits.ts +1 -1
|
@@ -1,94 +1,21 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
2
|
|
|
3
3
|
// src/graph/controller.ts
|
|
4
|
-
import
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Either from "effect/Either";
|
|
6
|
+
import * as Exit from "effect/Exit";
|
|
7
|
+
import * as Scope from "effect/Scope";
|
|
5
8
|
import { Event, synchronized } from "@dxos/async";
|
|
6
9
|
import { GraphExecutor, ValueBag, isNotExecuted } from "@dxos/conductor";
|
|
7
10
|
import { Resource } from "@dxos/context";
|
|
8
11
|
import { log } from "@dxos/log";
|
|
9
12
|
|
|
10
|
-
// src/graph/node-defs.ts
|
|
11
|
-
import { NODE_INPUT, NODE_OUTPUT, registry, getTemplateInputSchema } from "@dxos/conductor";
|
|
12
|
-
import { raise } from "@dxos/debug";
|
|
13
|
-
import { ObjectId, toJsonSchema } from "@dxos/echo-schema";
|
|
14
|
-
import { invariant } from "@dxos/invariant";
|
|
15
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
|
|
16
|
-
var resolveComputeNode = async (node) => {
|
|
17
|
-
const impl = registry[node.type];
|
|
18
|
-
invariant(impl, `Unknown node type: ${node.type}`, {
|
|
19
|
-
F: __dxlog_file,
|
|
20
|
-
L: 22,
|
|
21
|
-
S: void 0,
|
|
22
|
-
A: [
|
|
23
|
-
"impl",
|
|
24
|
-
"`Unknown node type: ${node.type}`"
|
|
25
|
-
]
|
|
26
|
-
});
|
|
27
|
-
return impl;
|
|
28
|
-
};
|
|
29
|
-
var isValidComputeNode = (type) => {
|
|
30
|
-
return nodeFactory[type] !== void 0;
|
|
31
|
-
};
|
|
32
|
-
var createComputeNode = (shape) => {
|
|
33
|
-
const type = shape.type ?? raise(new Error("Type not specified"));
|
|
34
|
-
const factory = nodeFactory[type] ?? raise(new Error(`Unknown shape type: ${type}`));
|
|
35
|
-
return factory(shape);
|
|
36
|
-
};
|
|
37
|
-
var nodeFactory = {
|
|
38
|
-
// System.
|
|
39
|
-
[NODE_INPUT]: () => createNode(NODE_INPUT),
|
|
40
|
-
[NODE_OUTPUT]: () => createNode(NODE_OUTPUT),
|
|
41
|
-
// Extensions.
|
|
42
|
-
["text-to-image"]: () => createNode("text-to-image"),
|
|
43
|
-
["and"]: () => createNode("and"),
|
|
44
|
-
["append"]: () => createNode("append"),
|
|
45
|
-
["audio"]: () => createNode("audio"),
|
|
46
|
-
["beacon"]: () => createNode("beacon"),
|
|
47
|
-
["chat"]: () => createNode("chat"),
|
|
48
|
-
["constant"]: (shape) => createNode("constant", {
|
|
49
|
-
value: shape.value
|
|
50
|
-
}),
|
|
51
|
-
["make-queue"]: () => createNode("make-queue"),
|
|
52
|
-
["database"]: () => createNode("database"),
|
|
53
|
-
["gpt"]: () => createNode("gpt"),
|
|
54
|
-
["gpt-realtime"]: () => createNode("gpt-realtime"),
|
|
55
|
-
["if"]: () => createNode("if"),
|
|
56
|
-
["if-else"]: () => createNode("if-else"),
|
|
57
|
-
["function"]: () => createNode("function"),
|
|
58
|
-
["json"]: () => createNode("json"),
|
|
59
|
-
["json-transform"]: () => createNode("json-transform"),
|
|
60
|
-
["not"]: () => createNode("not"),
|
|
61
|
-
["or"]: () => createNode("or"),
|
|
62
|
-
["queue"]: () => createNode("queue"),
|
|
63
|
-
["rng"]: () => createNode("rng"),
|
|
64
|
-
["reducer"]: () => createNode("reducer"),
|
|
65
|
-
["scope"]: () => createNode("scope"),
|
|
66
|
-
["surface"]: () => createNode("surface"),
|
|
67
|
-
["switch"]: () => createNode("switch"),
|
|
68
|
-
["template"]: (shape) => {
|
|
69
|
-
const node = createNode("template", {
|
|
70
|
-
valueType: shape.valueType,
|
|
71
|
-
value: shape.text
|
|
72
|
-
});
|
|
73
|
-
node.inputSchema = toJsonSchema(getTemplateInputSchema(node));
|
|
74
|
-
return node;
|
|
75
|
-
},
|
|
76
|
-
["text"]: () => createNode("text"),
|
|
77
|
-
["thread"]: () => createNode("thread"),
|
|
78
|
-
["trigger"]: () => createNode(NODE_INPUT)
|
|
79
|
-
};
|
|
80
|
-
var createNode = (type, props) => ({
|
|
81
|
-
id: ObjectId.random(),
|
|
82
|
-
type,
|
|
83
|
-
...props
|
|
84
|
-
});
|
|
85
|
-
|
|
86
13
|
// src/hooks/compute-context.ts
|
|
87
14
|
import { createContext, useContext } from "react";
|
|
88
|
-
import { raise
|
|
15
|
+
import { raise } from "@dxos/debug";
|
|
89
16
|
var ComputeContext = createContext(null);
|
|
90
17
|
var useComputeContext = () => {
|
|
91
|
-
return useContext(ComputeContext) ??
|
|
18
|
+
return useContext(ComputeContext) ?? raise(new Error("Missing ComputeContext"));
|
|
92
19
|
};
|
|
93
20
|
|
|
94
21
|
// src/hooks/useComputeGraphController.ts
|
|
@@ -142,15 +69,15 @@ var useComputeGraphController = ({ controller, graph, editorRef }) => {
|
|
|
142
69
|
};
|
|
143
70
|
|
|
144
71
|
// src/hooks/useComputeNodeState.ts
|
|
145
|
-
import
|
|
72
|
+
import * as Schema from "effect/Schema";
|
|
146
73
|
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
147
|
-
import { invariant
|
|
148
|
-
var
|
|
74
|
+
import { invariant } from "@dxos/invariant";
|
|
75
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useComputeNodeState.ts";
|
|
149
76
|
var useComputeNodeState = (shape) => {
|
|
150
77
|
const { controller } = useComputeContext();
|
|
151
|
-
|
|
152
|
-
F:
|
|
153
|
-
L:
|
|
78
|
+
invariant(controller, void 0, {
|
|
79
|
+
F: __dxlog_file,
|
|
80
|
+
L: 34,
|
|
154
81
|
S: void 0,
|
|
155
82
|
A: [
|
|
156
83
|
"controller",
|
|
@@ -161,9 +88,9 @@ var useComputeNodeState = (shape) => {
|
|
|
161
88
|
useEffect2(() => {
|
|
162
89
|
let disposed = false;
|
|
163
90
|
queueMicrotask(async () => {
|
|
164
|
-
|
|
165
|
-
F:
|
|
166
|
-
L:
|
|
91
|
+
invariant(shape.node, "Node not specified", {
|
|
92
|
+
F: __dxlog_file,
|
|
93
|
+
L: 40,
|
|
167
94
|
S: void 0,
|
|
168
95
|
A: [
|
|
169
96
|
"shape.node",
|
|
@@ -218,16 +145,16 @@ var useComputeNodeState = (shape) => {
|
|
|
218
145
|
// src/hooks/useGraphMonitor.ts
|
|
219
146
|
import { useMemo } from "react";
|
|
220
147
|
import { ComputeGraphModel, DEFAULT_INPUT, DEFAULT_OUTPUT } from "@dxos/conductor";
|
|
221
|
-
import { ObjectId
|
|
222
|
-
import { invariant as
|
|
148
|
+
import { ObjectId, Ref } from "@dxos/echo/internal";
|
|
149
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
223
150
|
import { getSpace } from "@dxos/react-client/echo";
|
|
224
151
|
import { isNonNullable } from "@dxos/util";
|
|
225
|
-
var
|
|
152
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useGraphMonitor.ts";
|
|
226
153
|
var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT_INPUT }) => {
|
|
227
154
|
const sourceNode = graph.findNode(source);
|
|
228
155
|
const targetNode = graph.findNode(target);
|
|
229
|
-
|
|
230
|
-
F:
|
|
156
|
+
invariant2(sourceNode?.node, void 0, {
|
|
157
|
+
F: __dxlog_file2,
|
|
231
158
|
L: 26,
|
|
232
159
|
S: void 0,
|
|
233
160
|
A: [
|
|
@@ -235,8 +162,8 @@ var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT
|
|
|
235
162
|
""
|
|
236
163
|
]
|
|
237
164
|
});
|
|
238
|
-
|
|
239
|
-
F:
|
|
165
|
+
invariant2(targetNode?.node, void 0, {
|
|
166
|
+
F: __dxlog_file2,
|
|
240
167
|
L: 27,
|
|
241
168
|
S: void 0,
|
|
242
169
|
A: [
|
|
@@ -245,7 +172,7 @@ var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT
|
|
|
245
172
|
]
|
|
246
173
|
});
|
|
247
174
|
return {
|
|
248
|
-
id:
|
|
175
|
+
id: ObjectId.random(),
|
|
249
176
|
source: sourceNode.node,
|
|
250
177
|
target: targetNode.node,
|
|
251
178
|
output,
|
|
@@ -259,8 +186,8 @@ var useGraphMonitor = (model) => {
|
|
|
259
186
|
if (!model) {
|
|
260
187
|
return;
|
|
261
188
|
}
|
|
262
|
-
|
|
263
|
-
F:
|
|
189
|
+
invariant2(node.type, void 0, {
|
|
190
|
+
F: __dxlog_file2,
|
|
264
191
|
L: 52,
|
|
265
192
|
S: void 0,
|
|
266
193
|
A: [
|
|
@@ -317,8 +244,8 @@ var createComputeGraph = (graph) => {
|
|
|
317
244
|
};
|
|
318
245
|
var linkTriggerToCompute = (graph, computeNode, triggerData) => {
|
|
319
246
|
const functionTrigger = triggerData.functionTrigger?.target;
|
|
320
|
-
|
|
321
|
-
F:
|
|
247
|
+
invariant2(functionTrigger, void 0, {
|
|
248
|
+
F: __dxlog_file2,
|
|
322
249
|
L: 115,
|
|
323
250
|
S: void 0,
|
|
324
251
|
A: [
|
|
@@ -342,7 +269,96 @@ var deleteTriggerObjects = (computeGraph, deleted) => {
|
|
|
342
269
|
}
|
|
343
270
|
};
|
|
344
271
|
|
|
272
|
+
// src/graph/node-defs.ts
|
|
273
|
+
import { NODE_INPUT, NODE_OUTPUT, getTemplateInputSchema, registry } from "@dxos/conductor";
|
|
274
|
+
import { raise as raise2 } from "@dxos/debug";
|
|
275
|
+
import { ObjectId as ObjectId2, toJsonSchema } from "@dxos/echo/internal";
|
|
276
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
277
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
|
|
278
|
+
var resolveComputeNode = async (node) => {
|
|
279
|
+
const impl = registry[node.type];
|
|
280
|
+
invariant3(impl, `Unknown node type: ${node.type}`, {
|
|
281
|
+
F: __dxlog_file3,
|
|
282
|
+
L: 22,
|
|
283
|
+
S: void 0,
|
|
284
|
+
A: [
|
|
285
|
+
"impl",
|
|
286
|
+
"`Unknown node type: ${node.type}`"
|
|
287
|
+
]
|
|
288
|
+
});
|
|
289
|
+
return impl;
|
|
290
|
+
};
|
|
291
|
+
var isValidComputeNode = (type) => {
|
|
292
|
+
return nodeFactory[type] !== void 0;
|
|
293
|
+
};
|
|
294
|
+
var createComputeNode = (shape) => {
|
|
295
|
+
const type = shape.type ?? raise2(new Error("Type not specified"));
|
|
296
|
+
const factory = nodeFactory[type] ?? raise2(new Error(`Unknown shape type: ${type}`));
|
|
297
|
+
return factory(shape);
|
|
298
|
+
};
|
|
299
|
+
var nodeFactory = {
|
|
300
|
+
// System.
|
|
301
|
+
[NODE_INPUT]: () => createNode(NODE_INPUT),
|
|
302
|
+
[NODE_OUTPUT]: () => createNode(NODE_OUTPUT),
|
|
303
|
+
// Extensions.
|
|
304
|
+
["text-to-image"]: () => createNode("text-to-image"),
|
|
305
|
+
["and"]: () => createNode("and"),
|
|
306
|
+
["append"]: () => createNode("append"),
|
|
307
|
+
["audio"]: () => createNode("audio"),
|
|
308
|
+
["beacon"]: () => createNode("beacon"),
|
|
309
|
+
["chat"]: () => createNode("chat"),
|
|
310
|
+
["constant"]: (shape) => createNode("constant", {
|
|
311
|
+
value: shape.value
|
|
312
|
+
}),
|
|
313
|
+
["make-queue"]: () => createNode("make-queue"),
|
|
314
|
+
["database"]: () => createNode("database"),
|
|
315
|
+
["gpt"]: () => createNode("gpt"),
|
|
316
|
+
["gpt-realtime"]: () => createNode("gpt-realtime"),
|
|
317
|
+
["if"]: () => createNode("if"),
|
|
318
|
+
["if-else"]: () => createNode("if-else"),
|
|
319
|
+
["function"]: () => createNode("function"),
|
|
320
|
+
["json"]: () => createNode("json"),
|
|
321
|
+
["json-transform"]: () => createNode("json-transform"),
|
|
322
|
+
["not"]: () => createNode("not"),
|
|
323
|
+
["or"]: () => createNode("or"),
|
|
324
|
+
["queue"]: () => createNode("queue"),
|
|
325
|
+
["rng"]: () => createNode("rng"),
|
|
326
|
+
["reducer"]: () => createNode("reducer"),
|
|
327
|
+
["scope"]: () => createNode("scope"),
|
|
328
|
+
["surface"]: () => createNode("surface"),
|
|
329
|
+
["switch"]: () => createNode("switch"),
|
|
330
|
+
["template"]: (shape) => {
|
|
331
|
+
const node = createNode("template", {
|
|
332
|
+
valueType: shape.valueType,
|
|
333
|
+
value: shape.text
|
|
334
|
+
});
|
|
335
|
+
node.inputSchema = toJsonSchema(getTemplateInputSchema(node));
|
|
336
|
+
return node;
|
|
337
|
+
},
|
|
338
|
+
["text"]: () => createNode("text"),
|
|
339
|
+
["thread"]: () => createNode("thread"),
|
|
340
|
+
["trigger"]: () => createNode(NODE_INPUT)
|
|
341
|
+
};
|
|
342
|
+
var createNode = (type, props) => ({
|
|
343
|
+
id: ObjectId2.random(),
|
|
344
|
+
type,
|
|
345
|
+
...props
|
|
346
|
+
});
|
|
347
|
+
|
|
345
348
|
// src/graph/controller.ts
|
|
349
|
+
function _define_property(obj, key, value) {
|
|
350
|
+
if (key in obj) {
|
|
351
|
+
Object.defineProperty(obj, key, {
|
|
352
|
+
value,
|
|
353
|
+
enumerable: true,
|
|
354
|
+
configurable: true,
|
|
355
|
+
writable: true
|
|
356
|
+
});
|
|
357
|
+
} else {
|
|
358
|
+
obj[key] = value;
|
|
359
|
+
}
|
|
360
|
+
return obj;
|
|
361
|
+
}
|
|
346
362
|
function _ts_decorate(decorators, target, key, desc) {
|
|
347
363
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
348
364
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -365,11 +381,6 @@ var createComputeGraphController = (graph, serviceContainer) => {
|
|
|
365
381
|
};
|
|
366
382
|
};
|
|
367
383
|
var ComputeGraphController = class extends Resource {
|
|
368
|
-
constructor(_serviceContainer, _graph) {
|
|
369
|
-
super(), this._serviceContainer = _serviceContainer, this._graph = _graph, this._executor = new GraphExecutor({
|
|
370
|
-
computeNodeResolver: (node) => resolveComputeNode(node)
|
|
371
|
-
}), this._diagnostics = [], this._forcedOutputs = {}, this._runtimeStateInputs = {}, this._runtimeStateOutputs = {}, this.update = new Event(), this.output = new Event(), this.events = new Event();
|
|
372
|
-
}
|
|
373
384
|
toJSON() {
|
|
374
385
|
return {
|
|
375
386
|
graph: this._graph,
|
|
@@ -430,7 +441,8 @@ var ComputeGraphController = class extends Resource {
|
|
|
430
441
|
return this._runtimeStateOutputs[nodeId] ?? {};
|
|
431
442
|
}
|
|
432
443
|
setOutput(nodeId, property, value) {
|
|
433
|
-
|
|
444
|
+
var _this__forcedOutputs, _nodeId;
|
|
445
|
+
(_this__forcedOutputs = this._forcedOutputs)[_nodeId = nodeId] ?? (_this__forcedOutputs[_nodeId] = {});
|
|
434
446
|
this._forcedOutputs[nodeId][property] = value;
|
|
435
447
|
queueMicrotask(async () => {
|
|
436
448
|
try {
|
|
@@ -438,7 +450,7 @@ var ComputeGraphController = class extends Resource {
|
|
|
438
450
|
} catch (err) {
|
|
439
451
|
log.catch(err, void 0, {
|
|
440
452
|
F: __dxlog_file4,
|
|
441
|
-
L:
|
|
453
|
+
L: 203,
|
|
442
454
|
S: this,
|
|
443
455
|
C: (f, a) => f(...a)
|
|
444
456
|
});
|
|
@@ -532,7 +544,7 @@ var ComputeGraphController = class extends Resource {
|
|
|
532
544
|
event
|
|
533
545
|
}, {
|
|
534
546
|
F: __dxlog_file4,
|
|
535
|
-
L:
|
|
547
|
+
L: 339,
|
|
536
548
|
S: this,
|
|
537
549
|
C: (f, a) => f(...a)
|
|
538
550
|
});
|
|
@@ -555,11 +567,13 @@ var ComputeGraphController = class extends Resource {
|
|
|
555
567
|
this.events.emit(event);
|
|
556
568
|
}
|
|
557
569
|
_onInputComputed(nodeId, property, value) {
|
|
558
|
-
|
|
570
|
+
var _this__runtimeStateInputs, _nodeId;
|
|
571
|
+
(_this__runtimeStateInputs = this._runtimeStateInputs)[_nodeId = nodeId] ?? (_this__runtimeStateInputs[_nodeId] = {});
|
|
559
572
|
this._runtimeStateInputs[nodeId][property] = value;
|
|
560
573
|
}
|
|
561
574
|
_onOutputComputed(nodeId, property, value) {
|
|
562
|
-
|
|
575
|
+
var _this__runtimeStateOutputs, _nodeId;
|
|
576
|
+
(_this__runtimeStateOutputs = this._runtimeStateOutputs)[_nodeId = nodeId] ?? (_this__runtimeStateOutputs[_nodeId] = {});
|
|
563
577
|
this._runtimeStateOutputs[nodeId][property] = value;
|
|
564
578
|
this.output.emit({
|
|
565
579
|
nodeId,
|
|
@@ -567,6 +581,19 @@ var ComputeGraphController = class extends Resource {
|
|
|
567
581
|
value
|
|
568
582
|
});
|
|
569
583
|
}
|
|
584
|
+
constructor(_serviceContainer, _graph) {
|
|
585
|
+
super(), _define_property(this, "_serviceContainer", void 0), _define_property(this, "_graph", void 0), _define_property(this, "_executor", void 0), _define_property(this, "_diagnostics", void 0), /**
|
|
586
|
+
* Canvas force-sets outputs of those nodes.
|
|
587
|
+
*/
|
|
588
|
+
_define_property(this, "_forcedOutputs", void 0), /**
|
|
589
|
+
* Runtime state of the execution graph.
|
|
590
|
+
*/
|
|
591
|
+
_define_property(this, "_runtimeStateInputs", void 0), _define_property(this, "_runtimeStateOutputs", void 0), // TODO(burdon): Remove? Make state reactive?
|
|
592
|
+
_define_property(this, "update", void 0), /** Computed result. */
|
|
593
|
+
_define_property(this, "output", void 0), _define_property(this, "events", void 0), this._serviceContainer = _serviceContainer, this._graph = _graph, this._executor = new GraphExecutor({
|
|
594
|
+
computeNodeResolver: (node) => resolveComputeNode(node)
|
|
595
|
+
}), this._diagnostics = [], this._forcedOutputs = {}, this._runtimeStateInputs = {}, this._runtimeStateOutputs = {}, this.update = new Event(), this.output = new Event(), this.events = new Event();
|
|
596
|
+
}
|
|
570
597
|
};
|
|
571
598
|
_ts_decorate([
|
|
572
599
|
synchronized
|
|
@@ -681,16 +708,17 @@ var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, stat
|
|
|
681
708
|
|
|
682
709
|
// src/shapes/common/FunctionBody.tsx
|
|
683
710
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
684
|
-
import
|
|
711
|
+
import * as SchemaAST2 from "effect/SchemaAST";
|
|
685
712
|
import React2, { useRef, useState as useState3 } from "react";
|
|
686
713
|
import { VoidInput, VoidOutput } from "@dxos/conductor";
|
|
687
714
|
import { useCanvasContext } from "@dxos/react-ui-canvas";
|
|
688
|
-
import {
|
|
715
|
+
import { createAnchors, getParentShapeElement, rowHeight } from "@dxos/react-ui-canvas-editor";
|
|
689
716
|
|
|
690
717
|
// src/shapes/defs.ts
|
|
691
|
-
import
|
|
718
|
+
import * as Schema2 from "effect/Schema";
|
|
719
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
692
720
|
import { DEFAULT_INPUT as DEFAULT_INPUT2, DEFAULT_OUTPUT as DEFAULT_OUTPUT2 } from "@dxos/conductor";
|
|
693
|
-
import { ObjectId as ObjectId3 } from "@dxos/echo
|
|
721
|
+
import { ObjectId as ObjectId3 } from "@dxos/echo/internal";
|
|
694
722
|
import { Polygon } from "@dxos/react-ui-canvas-editor";
|
|
695
723
|
var getProperties = (ast) => SchemaAST.getPropertySignatures(ast).map(({ name }) => ({
|
|
696
724
|
name: name.toString()
|
|
@@ -831,7 +859,7 @@ var TypeSelect = ({ value, onValueChange }) => {
|
|
|
831
859
|
|
|
832
860
|
// src/shapes/Array.tsx
|
|
833
861
|
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
834
|
-
import
|
|
862
|
+
import * as Schema3 from "effect/Schema";
|
|
835
863
|
import React4 from "react";
|
|
836
864
|
import { ReducerInput, ReducerOutput } from "@dxos/conductor";
|
|
837
865
|
var ReducerShape = Schema3.extend(ComputeShape, Schema3.Struct({
|
|
@@ -868,7 +896,7 @@ var reducerShape = {
|
|
|
868
896
|
|
|
869
897
|
// src/shapes/Append.tsx
|
|
870
898
|
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
871
|
-
import
|
|
899
|
+
import * as Schema4 from "effect/Schema";
|
|
872
900
|
import React5 from "react";
|
|
873
901
|
import { AppendInput } from "@dxos/conductor";
|
|
874
902
|
var AppendShape = Schema4.extend(ComputeShape, Schema4.Struct({
|
|
@@ -904,7 +932,7 @@ var appendShape = {
|
|
|
904
932
|
|
|
905
933
|
// src/shapes/Audio.tsx
|
|
906
934
|
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
907
|
-
import
|
|
935
|
+
import * as Schema5 from "effect/Schema";
|
|
908
936
|
import React6, { useEffect as useEffect3, useState as useState4 } from "react";
|
|
909
937
|
import { Icon as Icon2 } from "@dxos/react-ui";
|
|
910
938
|
import { createAnchorMap } from "@dxos/react-ui-canvas-editor";
|
|
@@ -960,7 +988,7 @@ var audioShape = {
|
|
|
960
988
|
|
|
961
989
|
// src/shapes/Beacon.tsx
|
|
962
990
|
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
963
|
-
import
|
|
991
|
+
import * as Schema6 from "effect/Schema";
|
|
964
992
|
import React7 from "react";
|
|
965
993
|
import { DEFAULT_INPUT as DEFAULT_INPUT3, isTruthy } from "@dxos/conductor";
|
|
966
994
|
import { Icon as Icon3 } from "@dxos/react-ui";
|
|
@@ -1011,7 +1039,7 @@ var beaconShape = {
|
|
|
1011
1039
|
};
|
|
1012
1040
|
|
|
1013
1041
|
// src/shapes/Boolean.tsx
|
|
1014
|
-
import
|
|
1042
|
+
import * as Schema7 from "effect/Schema";
|
|
1015
1043
|
import React8 from "react";
|
|
1016
1044
|
import { getAnchorPoints } from "@dxos/react-ui-canvas-editor";
|
|
1017
1045
|
import { createAnchors as createAnchors2 } from "@dxos/react-ui-canvas-editor";
|
|
@@ -1185,7 +1213,7 @@ var notShape = defineShape({
|
|
|
1185
1213
|
|
|
1186
1214
|
// src/shapes/Chat.tsx
|
|
1187
1215
|
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
1188
|
-
import
|
|
1216
|
+
import * as Schema8 from "effect/Schema";
|
|
1189
1217
|
import React9, { useRef as useRef2 } from "react";
|
|
1190
1218
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT3 } from "@dxos/conductor";
|
|
1191
1219
|
import { TextBox } from "@dxos/react-ui-canvas-editor";
|
|
@@ -1246,7 +1274,7 @@ var chatShape = {
|
|
|
1246
1274
|
|
|
1247
1275
|
// src/shapes/Constant.tsx
|
|
1248
1276
|
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
1249
|
-
import
|
|
1277
|
+
import * as Schema9 from "effect/Schema";
|
|
1250
1278
|
import React10, { useCallback as useCallback2, useRef as useRef3, useState as useState5 } from "react";
|
|
1251
1279
|
import { ComputeValueType as ComputeValueType2 } from "@dxos/conductor";
|
|
1252
1280
|
import { Input } from "@dxos/react-ui";
|
|
@@ -1349,7 +1377,7 @@ var constantShape = {
|
|
|
1349
1377
|
|
|
1350
1378
|
// src/shapes/Database.tsx
|
|
1351
1379
|
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
1352
|
-
import
|
|
1380
|
+
import * as Schema10 from "effect/Schema";
|
|
1353
1381
|
import React11 from "react";
|
|
1354
1382
|
import { createAnchorMap as createAnchorMap5 } from "@dxos/react-ui-canvas-editor";
|
|
1355
1383
|
var DatabaseShape = Schema10.extend(ComputeShape, Schema10.Struct({
|
|
@@ -1389,10 +1417,10 @@ var databaseShape = {
|
|
|
1389
1417
|
|
|
1390
1418
|
// src/shapes/Function.tsx
|
|
1391
1419
|
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
1392
|
-
import
|
|
1420
|
+
import * as Schema11 from "effect/Schema";
|
|
1393
1421
|
import React12, { useCallback as useCallback3, useRef as useRef4 } from "react";
|
|
1394
1422
|
import { AnyOutput, FunctionInput } from "@dxos/conductor";
|
|
1395
|
-
import {
|
|
1423
|
+
import { Ref as Ref2, getSnapshot, isInstanceOf } from "@dxos/echo/internal";
|
|
1396
1424
|
import { FunctionType, ScriptType } from "@dxos/functions";
|
|
1397
1425
|
import { useClient } from "@dxos/react-client";
|
|
1398
1426
|
import { Filter, parseId } from "@dxos/react-client/echo";
|
|
@@ -1474,7 +1502,7 @@ var functionShape = {
|
|
|
1474
1502
|
|
|
1475
1503
|
// src/shapes/Gpt.tsx
|
|
1476
1504
|
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
1477
|
-
import
|
|
1505
|
+
import * as Schema12 from "effect/Schema";
|
|
1478
1506
|
import React13, { useEffect as useEffect4, useState as useState6 } from "react";
|
|
1479
1507
|
import { GptInput, GptOutput } from "@dxos/conductor";
|
|
1480
1508
|
var GptShape = Schema12.extend(ComputeShape, Schema12.Struct({
|
|
@@ -1550,7 +1578,7 @@ var gptShape = {
|
|
|
1550
1578
|
|
|
1551
1579
|
// src/shapes/Json.tsx
|
|
1552
1580
|
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1553
|
-
import
|
|
1581
|
+
import * as Schema13 from "effect/Schema";
|
|
1554
1582
|
import React14 from "react";
|
|
1555
1583
|
import { DEFAULT_INPUT as DEFAULT_INPUT4, DefaultOutput, JsonTransformInput } from "@dxos/conductor";
|
|
1556
1584
|
import { createAnchorMap as createAnchorMap6 } from "@dxos/react-ui-canvas-editor";
|
|
@@ -1633,7 +1661,7 @@ var jsonTransformShape = {
|
|
|
1633
1661
|
|
|
1634
1662
|
// src/shapes/Logic.tsx
|
|
1635
1663
|
import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
|
|
1636
|
-
import
|
|
1664
|
+
import * as Schema14 from "effect/Schema";
|
|
1637
1665
|
import React15 from "react";
|
|
1638
1666
|
import { IfElseInput, IfElseOutput, IfInput, IfOutput } from "@dxos/conductor";
|
|
1639
1667
|
var IfShape = Schema14.extend(ComputeShape, Schema14.Struct({
|
|
@@ -1701,7 +1729,7 @@ var ifElseShape = {
|
|
|
1701
1729
|
|
|
1702
1730
|
// src/shapes/Queue.tsx
|
|
1703
1731
|
import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
|
|
1704
|
-
import
|
|
1732
|
+
import * as Schema15 from "effect/Schema";
|
|
1705
1733
|
import React16, { Fragment } from "react";
|
|
1706
1734
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT4, QueueInput, QueueOutput } from "@dxos/conductor";
|
|
1707
1735
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
@@ -1774,7 +1802,7 @@ var queueShape = {
|
|
|
1774
1802
|
|
|
1775
1803
|
// src/shapes/RNG.tsx
|
|
1776
1804
|
import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
|
|
1777
|
-
import
|
|
1805
|
+
import * as Schema16 from "effect/Schema";
|
|
1778
1806
|
import React17, { useEffect as useEffect5, useState as useState7 } from "react";
|
|
1779
1807
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT5 } from "@dxos/conductor";
|
|
1780
1808
|
import { Icon as Icon4 } from "@dxos/react-ui";
|
|
@@ -1855,11 +1883,11 @@ var randomShape = {
|
|
|
1855
1883
|
|
|
1856
1884
|
// src/shapes/Scope.tsx
|
|
1857
1885
|
import { useSignals as _useSignals17 } from "@preact-signals/safe-react/tracking";
|
|
1858
|
-
import
|
|
1886
|
+
import * as Schema17 from "effect/Schema";
|
|
1859
1887
|
import React18 from "react";
|
|
1860
1888
|
import { DEFAULT_INPUT as DEFAULT_INPUT5 } from "@dxos/conductor";
|
|
1861
1889
|
import { createAnchorMap as createAnchorMap8 } from "@dxos/react-ui-canvas-editor";
|
|
1862
|
-
import {
|
|
1890
|
+
import { Chaos, shaderPresets, useAudioStream } from "@dxos/react-ui-sfx";
|
|
1863
1891
|
var ScopeShape = Schema17.extend(ComputeShape, Schema17.Struct({
|
|
1864
1892
|
type: Schema17.Literal("scope")
|
|
1865
1893
|
}));
|
|
@@ -1909,7 +1937,7 @@ var scopeShape = {
|
|
|
1909
1937
|
|
|
1910
1938
|
// src/shapes/Surface.tsx
|
|
1911
1939
|
import { useSignals as _useSignals18 } from "@preact-signals/safe-react/tracking";
|
|
1912
|
-
import
|
|
1940
|
+
import * as Schema18 from "effect/Schema";
|
|
1913
1941
|
import React19 from "react";
|
|
1914
1942
|
import { Surface } from "@dxos/app-framework";
|
|
1915
1943
|
import { DEFAULT_INPUT as DEFAULT_INPUT6 } from "@dxos/conductor";
|
|
@@ -1967,7 +1995,7 @@ var surfaceShape = {
|
|
|
1967
1995
|
|
|
1968
1996
|
// src/shapes/Switch.tsx
|
|
1969
1997
|
import { useSignals as _useSignals19 } from "@preact-signals/safe-react/tracking";
|
|
1970
|
-
import
|
|
1998
|
+
import * as Schema19 from "effect/Schema";
|
|
1971
1999
|
import React20, { useEffect as useEffect6, useState as useState8 } from "react";
|
|
1972
2000
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT6 } from "@dxos/conductor";
|
|
1973
2001
|
import { Input as Input2 } from "@dxos/react-ui";
|
|
@@ -2020,7 +2048,7 @@ var switchShape = {
|
|
|
2020
2048
|
|
|
2021
2049
|
// src/shapes/Table.tsx
|
|
2022
2050
|
import { useSignals as _useSignals20 } from "@preact-signals/safe-react/tracking";
|
|
2023
|
-
import
|
|
2051
|
+
import * as Schema20 from "effect/Schema";
|
|
2024
2052
|
import React21 from "react";
|
|
2025
2053
|
import { createInputSchema, createOutputSchema } from "@dxos/conductor";
|
|
2026
2054
|
import { DataType } from "@dxos/schema";
|
|
@@ -2059,10 +2087,10 @@ var tableShape = {
|
|
|
2059
2087
|
|
|
2060
2088
|
// src/shapes/Template.tsx
|
|
2061
2089
|
import { useSignals as _useSignals21 } from "@preact-signals/safe-react/tracking";
|
|
2062
|
-
import
|
|
2090
|
+
import * as Schema21 from "effect/Schema";
|
|
2063
2091
|
import React22, { useRef as useRef5 } from "react";
|
|
2064
|
-
import { ComputeValueType as ComputeValueType3,
|
|
2065
|
-
import { toJsonSchema as toJsonSchema2 } from "@dxos/echo
|
|
2092
|
+
import { ComputeValueType as ComputeValueType3, TemplateOutput, VoidInput as VoidInput2, getTemplateInputSchema as getTemplateInputSchema2 } from "@dxos/conductor";
|
|
2093
|
+
import { toJsonSchema as toJsonSchema2 } from "@dxos/echo/internal";
|
|
2066
2094
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
2067
2095
|
import { TextBox as TextBox4 } from "@dxos/react-ui-canvas-editor";
|
|
2068
2096
|
var __dxlog_file6 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/Template.tsx";
|
|
@@ -2086,7 +2114,7 @@ var TextInputComponent3 = ({ shape, title, ...props }) => {
|
|
|
2086
2114
|
const handleTypeChange = (newType) => {
|
|
2087
2115
|
invariant5(Schema21.is(ComputeValueType3)(newType), "Invalid type", {
|
|
2088
2116
|
F: __dxlog_file6,
|
|
2089
|
-
L:
|
|
2117
|
+
L: 59,
|
|
2090
2118
|
S: void 0,
|
|
2091
2119
|
A: [
|
|
2092
2120
|
"Schema.is(ComputeValueType)(newType)",
|
|
@@ -2138,7 +2166,7 @@ var templateShape = {
|
|
|
2138
2166
|
|
|
2139
2167
|
// src/shapes/Text.tsx
|
|
2140
2168
|
import { useSignals as _useSignals22 } from "@preact-signals/safe-react/tracking";
|
|
2141
|
-
import
|
|
2169
|
+
import * as Schema22 from "effect/Schema";
|
|
2142
2170
|
import React23 from "react";
|
|
2143
2171
|
import { DEFAULT_INPUT as DEFAULT_INPUT7 } from "@dxos/conductor";
|
|
2144
2172
|
import { TextBox as TextBox5 } from "@dxos/react-ui-canvas-editor";
|
|
@@ -2192,7 +2220,7 @@ var textShape = {
|
|
|
2192
2220
|
|
|
2193
2221
|
// src/shapes/Thread.tsx
|
|
2194
2222
|
import { useSignals as _useSignals23 } from "@preact-signals/safe-react/tracking";
|
|
2195
|
-
import
|
|
2223
|
+
import * as Schema23 from "effect/Schema";
|
|
2196
2224
|
import React24, { useEffect as useEffect7, useRef as useRef6 } from "react";
|
|
2197
2225
|
import { createInputSchema as createInputSchema2, createOutputSchema as createOutputSchema2 } from "@dxos/conductor";
|
|
2198
2226
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
@@ -2267,7 +2295,7 @@ var threadShape = {
|
|
|
2267
2295
|
|
|
2268
2296
|
// src/shapes/TextToImage.tsx
|
|
2269
2297
|
import { useSignals as _useSignals24 } from "@preact-signals/safe-react/tracking";
|
|
2270
|
-
import
|
|
2298
|
+
import * as Schema24 from "effect/Schema";
|
|
2271
2299
|
import React25 from "react";
|
|
2272
2300
|
import { createAnchorMap as createAnchorMap12 } from "@dxos/react-ui-canvas-editor";
|
|
2273
2301
|
var TextToImageShape = Schema24.extend(ComputeShape, Schema24.Struct({
|
|
@@ -2307,20 +2335,21 @@ var textToImageShape = {
|
|
|
2307
2335
|
|
|
2308
2336
|
// src/shapes/Trigger.tsx
|
|
2309
2337
|
import { useSignals as _useSignals25 } from "@preact-signals/safe-react/tracking";
|
|
2310
|
-
import
|
|
2338
|
+
import * as Schema25 from "effect/Schema";
|
|
2311
2339
|
import React26, { useEffect as useEffect8 } from "react";
|
|
2312
2340
|
import { VoidInput as VoidInput3 } from "@dxos/conductor";
|
|
2313
|
-
import {
|
|
2314
|
-
import {
|
|
2341
|
+
import { Filter as Filter2, Obj, Query } from "@dxos/echo";
|
|
2342
|
+
import { ObjectId as ObjectId4, Ref as Ref3 } from "@dxos/echo/internal";
|
|
2343
|
+
import { EmailTriggerOutput, FunctionTrigger, QueueTriggerOutput, SubscriptionTriggerOutput, TimerTriggerOutput, TriggerKinds, WebhookTriggerOutput } from "@dxos/functions";
|
|
2315
2344
|
import { DXN, SpaceId } from "@dxos/keys";
|
|
2316
|
-
import {
|
|
2345
|
+
import { useSpace } from "@dxos/react-client/echo";
|
|
2317
2346
|
import { Select as Select2 } from "@dxos/react-ui";
|
|
2318
2347
|
var TriggerShape = Schema25.extend(ComputeShape, Schema25.Struct({
|
|
2319
2348
|
type: Schema25.Literal("trigger"),
|
|
2320
2349
|
functionTrigger: Schema25.optional(Ref3(FunctionTrigger))
|
|
2321
2350
|
}));
|
|
2322
2351
|
var createTrigger = (props) => {
|
|
2323
|
-
const functionTrigger =
|
|
2352
|
+
const functionTrigger = Obj.make(FunctionTrigger, {
|
|
2324
2353
|
enabled: true,
|
|
2325
2354
|
spec: createTriggerSpec(props)
|
|
2326
2355
|
});
|
|
@@ -2342,7 +2371,7 @@ var TriggerComponent = ({ shape }) => {
|
|
|
2342
2371
|
useEffect8(() => {
|
|
2343
2372
|
if (functionTrigger && !functionTrigger.spec) {
|
|
2344
2373
|
functionTrigger.spec = createTriggerSpec({
|
|
2345
|
-
triggerKind:
|
|
2374
|
+
triggerKind: "email",
|
|
2346
2375
|
spaceId: space?.id
|
|
2347
2376
|
});
|
|
2348
2377
|
}
|
|
@@ -2351,7 +2380,7 @@ var TriggerComponent = ({ shape }) => {
|
|
|
2351
2380
|
functionTrigger?.spec
|
|
2352
2381
|
]);
|
|
2353
2382
|
useEffect8(() => {
|
|
2354
|
-
shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.kind ??
|
|
2383
|
+
shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.kind ?? "email"));
|
|
2355
2384
|
}, [
|
|
2356
2385
|
functionTrigger?.spec?.kind
|
|
2357
2386
|
]);
|
|
@@ -2388,7 +2417,7 @@ var TriggerKindSelect = ({ value, onValueChange }) => {
|
|
|
2388
2417
|
}, /* @__PURE__ */ React26.createElement(Select2.TriggerButton, {
|
|
2389
2418
|
variant: "ghost",
|
|
2390
2419
|
classNames: "w-full !px-0"
|
|
2391
|
-
}), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null,
|
|
2420
|
+
}), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null, TriggerKinds.map((kind) => /* @__PURE__ */ React26.createElement(Select2.Option, {
|
|
2392
2421
|
key: kind,
|
|
2393
2422
|
value: kind
|
|
2394
2423
|
}, kind))), /* @__PURE__ */ React26.createElement(Select2.ScrollDownButton, null), /* @__PURE__ */ React26.createElement(Select2.Arrow, null))));
|
|
@@ -2397,35 +2426,38 @@ var TriggerKindSelect = ({ value, onValueChange }) => {
|
|
|
2397
2426
|
}
|
|
2398
2427
|
};
|
|
2399
2428
|
var createTriggerSpec = (props) => {
|
|
2400
|
-
const kind = props.triggerKind ??
|
|
2429
|
+
const kind = props.triggerKind ?? "email";
|
|
2401
2430
|
switch (kind) {
|
|
2402
|
-
case
|
|
2431
|
+
case "timer":
|
|
2403
2432
|
return {
|
|
2404
|
-
kind:
|
|
2433
|
+
kind: "timer",
|
|
2405
2434
|
cron: "*/10 * * * * *"
|
|
2406
2435
|
};
|
|
2407
|
-
case
|
|
2436
|
+
case "webhook":
|
|
2408
2437
|
return {
|
|
2409
|
-
kind:
|
|
2438
|
+
kind: "webhook",
|
|
2410
2439
|
method: "POST"
|
|
2411
2440
|
};
|
|
2412
|
-
case
|
|
2441
|
+
case "subscription":
|
|
2413
2442
|
return {
|
|
2414
|
-
kind:
|
|
2415
|
-
|
|
2443
|
+
kind: "subscription",
|
|
2444
|
+
query: {
|
|
2445
|
+
string: "Query.select(Filter.nothing())",
|
|
2446
|
+
ast: Query.select(Filter2.nothing()).ast
|
|
2447
|
+
}
|
|
2416
2448
|
};
|
|
2417
|
-
case
|
|
2449
|
+
case "email":
|
|
2418
2450
|
return {
|
|
2419
|
-
kind:
|
|
2451
|
+
kind: "email"
|
|
2420
2452
|
};
|
|
2421
|
-
case
|
|
2453
|
+
case "queue": {
|
|
2422
2454
|
const dxn = new DXN(DXN.kind.QUEUE, [
|
|
2423
2455
|
"data",
|
|
2424
2456
|
props.spaceId ?? SpaceId.random(),
|
|
2425
2457
|
ObjectId4.random()
|
|
2426
2458
|
]).toString();
|
|
2427
2459
|
return {
|
|
2428
|
-
kind:
|
|
2460
|
+
kind: "queue",
|
|
2429
2461
|
queue: dxn
|
|
2430
2462
|
};
|
|
2431
2463
|
}
|
|
@@ -2433,11 +2465,11 @@ var createTriggerSpec = (props) => {
|
|
|
2433
2465
|
};
|
|
2434
2466
|
var getOutputSchema = (kind) => {
|
|
2435
2467
|
const kindToSchema = {
|
|
2436
|
-
[
|
|
2437
|
-
[
|
|
2438
|
-
[
|
|
2439
|
-
[
|
|
2440
|
-
[
|
|
2468
|
+
["email"]: EmailTriggerOutput,
|
|
2469
|
+
["subscription"]: SubscriptionTriggerOutput,
|
|
2470
|
+
["timer"]: TimerTriggerOutput,
|
|
2471
|
+
["webhook"]: WebhookTriggerOutput,
|
|
2472
|
+
["queue"]: QueueTriggerOutput
|
|
2441
2473
|
};
|
|
2442
2474
|
return kindToSchema[kind];
|
|
2443
2475
|
};
|
|
@@ -2447,12 +2479,12 @@ var triggerShape = {
|
|
|
2447
2479
|
icon: "ph--lightning--regular",
|
|
2448
2480
|
component: TriggerComponent,
|
|
2449
2481
|
createShape: createTrigger,
|
|
2450
|
-
getAnchors: (shape) => createFunctionAnchors(shape, VoidInput3, getOutputSchema(shape.functionTrigger?.target?.spec?.kind ??
|
|
2482
|
+
getAnchors: (shape) => createFunctionAnchors(shape, VoidInput3, getOutputSchema(shape.functionTrigger?.target?.spec?.kind ?? "email"))
|
|
2451
2483
|
};
|
|
2452
2484
|
|
|
2453
2485
|
// src/shapes/GptRealtime.tsx
|
|
2454
2486
|
import { useSignals as _useSignals26 } from "@preact-signals/safe-react/tracking";
|
|
2455
|
-
import
|
|
2487
|
+
import * as Schema26 from "effect/Schema";
|
|
2456
2488
|
import React27, { useState as useState9 } from "react";
|
|
2457
2489
|
import { log as log2 } from "@dxos/log";
|
|
2458
2490
|
import { useConfig } from "@dxos/react-client";
|
|
@@ -2648,12 +2680,22 @@ var computeShapes = [
|
|
|
2648
2680
|
|
|
2649
2681
|
// src/compute-layout.ts
|
|
2650
2682
|
import { DefaultInput, DefaultOutput as DefaultOutput2 } from "@dxos/conductor";
|
|
2651
|
-
import { toEffectSchema } from "@dxos/echo
|
|
2683
|
+
import { toEffectSchema } from "@dxos/echo/internal";
|
|
2652
2684
|
import { ShapeLayout } from "@dxos/react-ui-canvas-editor";
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2685
|
+
function _define_property2(obj, key, value) {
|
|
2686
|
+
if (key in obj) {
|
|
2687
|
+
Object.defineProperty(obj, key, {
|
|
2688
|
+
value,
|
|
2689
|
+
enumerable: true,
|
|
2690
|
+
configurable: true,
|
|
2691
|
+
writable: true
|
|
2692
|
+
});
|
|
2693
|
+
} else {
|
|
2694
|
+
obj[key] = value;
|
|
2656
2695
|
}
|
|
2696
|
+
return obj;
|
|
2697
|
+
}
|
|
2698
|
+
var ComputeShapeLayout = class extends ShapeLayout {
|
|
2657
2699
|
// TODO(burdon): Doesn't update.
|
|
2658
2700
|
getAnchors(shape) {
|
|
2659
2701
|
const shapeDef = this._registry.getShapeDef(shape.type);
|
|
@@ -2668,6 +2710,9 @@ var ComputeShapeLayout = class extends ShapeLayout {
|
|
|
2668
2710
|
}
|
|
2669
2711
|
return anchors;
|
|
2670
2712
|
}
|
|
2713
|
+
constructor(_controller, registry2) {
|
|
2714
|
+
super(registry2), _define_property2(this, "_controller", void 0), this._controller = _controller;
|
|
2715
|
+
}
|
|
2671
2716
|
};
|
|
2672
2717
|
export {
|
|
2673
2718
|
AndShape,
|