@dxos/react-ui-canvas-compute 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea
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 +88 -100
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +88 -100
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/graph/controller.d.ts +5 -18
- package/dist/types/src/graph/controller.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 +4 -4
- package/dist/types/src/shapes/Trigger.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 +41 -42
- package/src/compute-layout.ts +1 -1
- package/src/compute.stories.tsx +2 -2
- package/src/graph/controller.ts +13 -2
- package/src/graph/node-defs.ts +1 -1
- package/src/hooks/useComputeNodeState.ts +1 -1
- package/src/hooks/useGraphMonitor.ts +1 -1
- package/src/json.test.ts +1 -1
- package/src/schema.test.ts +2 -2
- package/src/shapes/Append.tsx +1 -1
- package/src/shapes/Array.tsx +1 -1
- package/src/shapes/Audio.tsx +1 -1
- package/src/shapes/Beacon.tsx +1 -1
- package/src/shapes/Boolean.tsx +1 -1
- package/src/shapes/Chat.tsx +1 -1
- package/src/shapes/Constant.tsx +1 -1
- package/src/shapes/Database.tsx +1 -1
- package/src/shapes/Function.tsx +5 -5
- package/src/shapes/Gpt.tsx +1 -1
- package/src/shapes/GptRealtime.tsx +1 -1
- package/src/shapes/Json.tsx +1 -1
- package/src/shapes/Logic.tsx +1 -1
- package/src/shapes/Queue.tsx +1 -1
- package/src/shapes/RNG.tsx +1 -1
- package/src/shapes/Scope.tsx +1 -1
- package/src/shapes/Surface.tsx +1 -1
- package/src/shapes/Switch.tsx +1 -1
- package/src/shapes/Table.tsx +1 -1
- package/src/shapes/Template.tsx +2 -2
- package/src/shapes/Text.tsx +1 -1
- package/src/shapes/TextToImage.tsx +1 -1
- package/src/shapes/Thread.tsx +1 -1
- package/src/shapes/Trigger.tsx +29 -39
- package/src/shapes/common/FunctionBody.tsx +2 -1
- package/src/shapes/defs.ts +3 -2
- package/src/testing/circuits.ts +1 -1
|
@@ -1,7 +1,10 @@
|
|
|
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";
|
|
@@ -66,7 +69,7 @@ var useComputeGraphController = ({ controller, graph, editorRef }) => {
|
|
|
66
69
|
};
|
|
67
70
|
|
|
68
71
|
// src/hooks/useComputeNodeState.ts
|
|
69
|
-
import
|
|
72
|
+
import * as Schema from "effect/Schema";
|
|
70
73
|
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
71
74
|
import { invariant } from "@dxos/invariant";
|
|
72
75
|
var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useComputeNodeState.ts";
|
|
@@ -142,7 +145,7 @@ var useComputeNodeState = (shape) => {
|
|
|
142
145
|
// src/hooks/useGraphMonitor.ts
|
|
143
146
|
import { useMemo } from "react";
|
|
144
147
|
import { ComputeGraphModel, DEFAULT_INPUT, DEFAULT_OUTPUT } from "@dxos/conductor";
|
|
145
|
-
import { ObjectId, Ref } from "@dxos/echo
|
|
148
|
+
import { ObjectId, Ref } from "@dxos/echo/internal";
|
|
146
149
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
147
150
|
import { getSpace } from "@dxos/react-client/echo";
|
|
148
151
|
import { isNonNullable } from "@dxos/util";
|
|
@@ -269,7 +272,7 @@ var deleteTriggerObjects = (computeGraph, deleted) => {
|
|
|
269
272
|
// src/graph/node-defs.ts
|
|
270
273
|
import { NODE_INPUT, NODE_OUTPUT, getTemplateInputSchema, registry } from "@dxos/conductor";
|
|
271
274
|
import { raise as raise2 } from "@dxos/debug";
|
|
272
|
-
import { ObjectId as ObjectId2, toJsonSchema } from "@dxos/echo
|
|
275
|
+
import { ObjectId as ObjectId2, toJsonSchema } from "@dxos/echo/internal";
|
|
273
276
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
274
277
|
var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
|
|
275
278
|
var resolveComputeNode = async (node) => {
|
|
@@ -343,19 +346,6 @@ var createNode = (type, props) => ({
|
|
|
343
346
|
});
|
|
344
347
|
|
|
345
348
|
// src/graph/controller.ts
|
|
346
|
-
function _define_property(obj, key, value) {
|
|
347
|
-
if (key in obj) {
|
|
348
|
-
Object.defineProperty(obj, key, {
|
|
349
|
-
value,
|
|
350
|
-
enumerable: true,
|
|
351
|
-
configurable: true,
|
|
352
|
-
writable: true
|
|
353
|
-
});
|
|
354
|
-
} else {
|
|
355
|
-
obj[key] = value;
|
|
356
|
-
}
|
|
357
|
-
return obj;
|
|
358
|
-
}
|
|
359
349
|
function _ts_decorate(decorators, target, key, desc) {
|
|
360
350
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
361
351
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -378,6 +368,29 @@ var createComputeGraphController = (graph, serviceContainer) => {
|
|
|
378
368
|
};
|
|
379
369
|
};
|
|
380
370
|
var ComputeGraphController = class extends Resource {
|
|
371
|
+
_serviceContainer;
|
|
372
|
+
_graph;
|
|
373
|
+
_executor = new GraphExecutor({
|
|
374
|
+
computeNodeResolver: (node) => resolveComputeNode(node)
|
|
375
|
+
});
|
|
376
|
+
_diagnostics = [];
|
|
377
|
+
/**
|
|
378
|
+
* Canvas force-sets outputs of those nodes.
|
|
379
|
+
*/
|
|
380
|
+
_forcedOutputs = {};
|
|
381
|
+
/**
|
|
382
|
+
* Runtime state of the execution graph.
|
|
383
|
+
*/
|
|
384
|
+
_runtimeStateInputs = {};
|
|
385
|
+
_runtimeStateOutputs = {};
|
|
386
|
+
// TODO(burdon): Remove? Make state reactive?
|
|
387
|
+
update = new Event();
|
|
388
|
+
/** Computed result. */
|
|
389
|
+
output = new Event();
|
|
390
|
+
events = new Event();
|
|
391
|
+
constructor(_serviceContainer, _graph) {
|
|
392
|
+
super(), this._serviceContainer = _serviceContainer, this._graph = _graph;
|
|
393
|
+
}
|
|
381
394
|
toJSON() {
|
|
382
395
|
return {
|
|
383
396
|
graph: this._graph,
|
|
@@ -438,8 +451,7 @@ var ComputeGraphController = class extends Resource {
|
|
|
438
451
|
return this._runtimeStateOutputs[nodeId] ?? {};
|
|
439
452
|
}
|
|
440
453
|
setOutput(nodeId, property, value) {
|
|
441
|
-
|
|
442
|
-
(_this__forcedOutputs = this._forcedOutputs)[_nodeId = nodeId] ?? (_this__forcedOutputs[_nodeId] = {});
|
|
454
|
+
this._forcedOutputs[nodeId] ??= {};
|
|
443
455
|
this._forcedOutputs[nodeId][property] = value;
|
|
444
456
|
queueMicrotask(async () => {
|
|
445
457
|
try {
|
|
@@ -447,7 +459,7 @@ var ComputeGraphController = class extends Resource {
|
|
|
447
459
|
} catch (err) {
|
|
448
460
|
log.catch(err, void 0, {
|
|
449
461
|
F: __dxlog_file4,
|
|
450
|
-
L:
|
|
462
|
+
L: 210,
|
|
451
463
|
S: this,
|
|
452
464
|
C: (f, a) => f(...a)
|
|
453
465
|
});
|
|
@@ -541,7 +553,7 @@ var ComputeGraphController = class extends Resource {
|
|
|
541
553
|
event
|
|
542
554
|
}, {
|
|
543
555
|
F: __dxlog_file4,
|
|
544
|
-
L:
|
|
556
|
+
L: 346,
|
|
545
557
|
S: this,
|
|
546
558
|
C: (f, a) => f(...a)
|
|
547
559
|
});
|
|
@@ -564,13 +576,11 @@ var ComputeGraphController = class extends Resource {
|
|
|
564
576
|
this.events.emit(event);
|
|
565
577
|
}
|
|
566
578
|
_onInputComputed(nodeId, property, value) {
|
|
567
|
-
|
|
568
|
-
(_this__runtimeStateInputs = this._runtimeStateInputs)[_nodeId = nodeId] ?? (_this__runtimeStateInputs[_nodeId] = {});
|
|
579
|
+
this._runtimeStateInputs[nodeId] ??= {};
|
|
569
580
|
this._runtimeStateInputs[nodeId][property] = value;
|
|
570
581
|
}
|
|
571
582
|
_onOutputComputed(nodeId, property, value) {
|
|
572
|
-
|
|
573
|
-
(_this__runtimeStateOutputs = this._runtimeStateOutputs)[_nodeId = nodeId] ?? (_this__runtimeStateOutputs[_nodeId] = {});
|
|
583
|
+
this._runtimeStateOutputs[nodeId] ??= {};
|
|
574
584
|
this._runtimeStateOutputs[nodeId][property] = value;
|
|
575
585
|
this.output.emit({
|
|
576
586
|
nodeId,
|
|
@@ -578,19 +588,6 @@ var ComputeGraphController = class extends Resource {
|
|
|
578
588
|
value
|
|
579
589
|
});
|
|
580
590
|
}
|
|
581
|
-
constructor(_serviceContainer, _graph) {
|
|
582
|
-
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), /**
|
|
583
|
-
* Canvas force-sets outputs of those nodes.
|
|
584
|
-
*/
|
|
585
|
-
_define_property(this, "_forcedOutputs", void 0), /**
|
|
586
|
-
* Runtime state of the execution graph.
|
|
587
|
-
*/
|
|
588
|
-
_define_property(this, "_runtimeStateInputs", void 0), _define_property(this, "_runtimeStateOutputs", void 0), // TODO(burdon): Remove? Make state reactive?
|
|
589
|
-
_define_property(this, "update", void 0), /** Computed result. */
|
|
590
|
-
_define_property(this, "output", void 0), _define_property(this, "events", void 0), this._serviceContainer = _serviceContainer, this._graph = _graph, this._executor = new GraphExecutor({
|
|
591
|
-
computeNodeResolver: (node) => resolveComputeNode(node)
|
|
592
|
-
}), this._diagnostics = [], this._forcedOutputs = {}, this._runtimeStateInputs = {}, this._runtimeStateOutputs = {}, this.update = new Event(), this.output = new Event(), this.events = new Event();
|
|
593
|
-
}
|
|
594
591
|
};
|
|
595
592
|
_ts_decorate([
|
|
596
593
|
synchronized
|
|
@@ -705,16 +702,17 @@ var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, stat
|
|
|
705
702
|
|
|
706
703
|
// src/shapes/common/FunctionBody.tsx
|
|
707
704
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
708
|
-
import
|
|
705
|
+
import * as SchemaAST2 from "effect/SchemaAST";
|
|
709
706
|
import React2, { useRef, useState as useState3 } from "react";
|
|
710
707
|
import { VoidInput, VoidOutput } from "@dxos/conductor";
|
|
711
708
|
import { useCanvasContext } from "@dxos/react-ui-canvas";
|
|
712
709
|
import { createAnchors, getParentShapeElement, rowHeight } from "@dxos/react-ui-canvas-editor";
|
|
713
710
|
|
|
714
711
|
// src/shapes/defs.ts
|
|
715
|
-
import
|
|
712
|
+
import * as Schema2 from "effect/Schema";
|
|
713
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
716
714
|
import { DEFAULT_INPUT as DEFAULT_INPUT2, DEFAULT_OUTPUT as DEFAULT_OUTPUT2 } from "@dxos/conductor";
|
|
717
|
-
import { ObjectId as ObjectId3 } from "@dxos/echo
|
|
715
|
+
import { ObjectId as ObjectId3 } from "@dxos/echo/internal";
|
|
718
716
|
import { Polygon } from "@dxos/react-ui-canvas-editor";
|
|
719
717
|
var getProperties = (ast) => SchemaAST.getPropertySignatures(ast).map(({ name }) => ({
|
|
720
718
|
name: name.toString()
|
|
@@ -855,7 +853,7 @@ var TypeSelect = ({ value, onValueChange }) => {
|
|
|
855
853
|
|
|
856
854
|
// src/shapes/Array.tsx
|
|
857
855
|
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
858
|
-
import
|
|
856
|
+
import * as Schema3 from "effect/Schema";
|
|
859
857
|
import React4 from "react";
|
|
860
858
|
import { ReducerInput, ReducerOutput } from "@dxos/conductor";
|
|
861
859
|
var ReducerShape = Schema3.extend(ComputeShape, Schema3.Struct({
|
|
@@ -892,7 +890,7 @@ var reducerShape = {
|
|
|
892
890
|
|
|
893
891
|
// src/shapes/Append.tsx
|
|
894
892
|
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
895
|
-
import
|
|
893
|
+
import * as Schema4 from "effect/Schema";
|
|
896
894
|
import React5 from "react";
|
|
897
895
|
import { AppendInput } from "@dxos/conductor";
|
|
898
896
|
var AppendShape = Schema4.extend(ComputeShape, Schema4.Struct({
|
|
@@ -928,7 +926,7 @@ var appendShape = {
|
|
|
928
926
|
|
|
929
927
|
// src/shapes/Audio.tsx
|
|
930
928
|
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
931
|
-
import
|
|
929
|
+
import * as Schema5 from "effect/Schema";
|
|
932
930
|
import React6, { useEffect as useEffect3, useState as useState4 } from "react";
|
|
933
931
|
import { Icon as Icon2 } from "@dxos/react-ui";
|
|
934
932
|
import { createAnchorMap } from "@dxos/react-ui-canvas-editor";
|
|
@@ -984,7 +982,7 @@ var audioShape = {
|
|
|
984
982
|
|
|
985
983
|
// src/shapes/Beacon.tsx
|
|
986
984
|
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
987
|
-
import
|
|
985
|
+
import * as Schema6 from "effect/Schema";
|
|
988
986
|
import React7 from "react";
|
|
989
987
|
import { DEFAULT_INPUT as DEFAULT_INPUT3, isTruthy } from "@dxos/conductor";
|
|
990
988
|
import { Icon as Icon3 } from "@dxos/react-ui";
|
|
@@ -1035,7 +1033,7 @@ var beaconShape = {
|
|
|
1035
1033
|
};
|
|
1036
1034
|
|
|
1037
1035
|
// src/shapes/Boolean.tsx
|
|
1038
|
-
import
|
|
1036
|
+
import * as Schema7 from "effect/Schema";
|
|
1039
1037
|
import React8 from "react";
|
|
1040
1038
|
import { getAnchorPoints } from "@dxos/react-ui-canvas-editor";
|
|
1041
1039
|
import { createAnchors as createAnchors2 } from "@dxos/react-ui-canvas-editor";
|
|
@@ -1209,7 +1207,7 @@ var notShape = defineShape({
|
|
|
1209
1207
|
|
|
1210
1208
|
// src/shapes/Chat.tsx
|
|
1211
1209
|
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
1212
|
-
import
|
|
1210
|
+
import * as Schema8 from "effect/Schema";
|
|
1213
1211
|
import React9, { useRef as useRef2 } from "react";
|
|
1214
1212
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT3 } from "@dxos/conductor";
|
|
1215
1213
|
import { TextBox } from "@dxos/react-ui-canvas-editor";
|
|
@@ -1270,7 +1268,7 @@ var chatShape = {
|
|
|
1270
1268
|
|
|
1271
1269
|
// src/shapes/Constant.tsx
|
|
1272
1270
|
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
1273
|
-
import
|
|
1271
|
+
import * as Schema9 from "effect/Schema";
|
|
1274
1272
|
import React10, { useCallback as useCallback2, useRef as useRef3, useState as useState5 } from "react";
|
|
1275
1273
|
import { ComputeValueType as ComputeValueType2 } from "@dxos/conductor";
|
|
1276
1274
|
import { Input } from "@dxos/react-ui";
|
|
@@ -1373,7 +1371,7 @@ var constantShape = {
|
|
|
1373
1371
|
|
|
1374
1372
|
// src/shapes/Database.tsx
|
|
1375
1373
|
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
1376
|
-
import
|
|
1374
|
+
import * as Schema10 from "effect/Schema";
|
|
1377
1375
|
import React11 from "react";
|
|
1378
1376
|
import { createAnchorMap as createAnchorMap5 } from "@dxos/react-ui-canvas-editor";
|
|
1379
1377
|
var DatabaseShape = Schema10.extend(ComputeShape, Schema10.Struct({
|
|
@@ -1413,11 +1411,11 @@ var databaseShape = {
|
|
|
1413
1411
|
|
|
1414
1412
|
// src/shapes/Function.tsx
|
|
1415
1413
|
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
1416
|
-
import
|
|
1414
|
+
import * as Schema11 from "effect/Schema";
|
|
1417
1415
|
import React12, { useCallback as useCallback3, useRef as useRef4 } from "react";
|
|
1418
1416
|
import { AnyOutput, FunctionInput } from "@dxos/conductor";
|
|
1419
|
-
import { Ref as Ref2, getSnapshot, isInstanceOf } from "@dxos/echo
|
|
1420
|
-
import {
|
|
1417
|
+
import { Ref as Ref2, getSnapshot, isInstanceOf } from "@dxos/echo/internal";
|
|
1418
|
+
import { Function, Script } from "@dxos/functions";
|
|
1421
1419
|
import { useClient } from "@dxos/react-client";
|
|
1422
1420
|
import { Filter, parseId } from "@dxos/react-client/echo";
|
|
1423
1421
|
import { TextBox as TextBox3 } from "@dxos/react-ui-canvas-editor";
|
|
@@ -1446,10 +1444,10 @@ var TextInputComponent2 = ({ shape, title, ...props }) => {
|
|
|
1446
1444
|
}
|
|
1447
1445
|
const space = client.spaces.get(spaceId);
|
|
1448
1446
|
const object = space?.db.getObjectById(objectId);
|
|
1449
|
-
if (!space || !isInstanceOf(
|
|
1447
|
+
if (!space || !isInstanceOf(Script.Script, object)) {
|
|
1450
1448
|
return;
|
|
1451
1449
|
}
|
|
1452
|
-
const { objects: [fn] } = await space.db.query(Filter.type(
|
|
1450
|
+
const { objects: [fn] } = await space.db.query(Filter.type(Function.Function, {
|
|
1453
1451
|
source: Ref2.make(object)
|
|
1454
1452
|
})).run();
|
|
1455
1453
|
if (!fn) {
|
|
@@ -1498,7 +1496,7 @@ var functionShape = {
|
|
|
1498
1496
|
|
|
1499
1497
|
// src/shapes/Gpt.tsx
|
|
1500
1498
|
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
1501
|
-
import
|
|
1499
|
+
import * as Schema12 from "effect/Schema";
|
|
1502
1500
|
import React13, { useEffect as useEffect4, useState as useState6 } from "react";
|
|
1503
1501
|
import { GptInput, GptOutput } from "@dxos/conductor";
|
|
1504
1502
|
var GptShape = Schema12.extend(ComputeShape, Schema12.Struct({
|
|
@@ -1574,7 +1572,7 @@ var gptShape = {
|
|
|
1574
1572
|
|
|
1575
1573
|
// src/shapes/Json.tsx
|
|
1576
1574
|
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1577
|
-
import
|
|
1575
|
+
import * as Schema13 from "effect/Schema";
|
|
1578
1576
|
import React14 from "react";
|
|
1579
1577
|
import { DEFAULT_INPUT as DEFAULT_INPUT4, DefaultOutput, JsonTransformInput } from "@dxos/conductor";
|
|
1580
1578
|
import { createAnchorMap as createAnchorMap6 } from "@dxos/react-ui-canvas-editor";
|
|
@@ -1657,7 +1655,7 @@ var jsonTransformShape = {
|
|
|
1657
1655
|
|
|
1658
1656
|
// src/shapes/Logic.tsx
|
|
1659
1657
|
import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
|
|
1660
|
-
import
|
|
1658
|
+
import * as Schema14 from "effect/Schema";
|
|
1661
1659
|
import React15 from "react";
|
|
1662
1660
|
import { IfElseInput, IfElseOutput, IfInput, IfOutput } from "@dxos/conductor";
|
|
1663
1661
|
var IfShape = Schema14.extend(ComputeShape, Schema14.Struct({
|
|
@@ -1725,7 +1723,7 @@ var ifElseShape = {
|
|
|
1725
1723
|
|
|
1726
1724
|
// src/shapes/Queue.tsx
|
|
1727
1725
|
import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
|
|
1728
|
-
import
|
|
1726
|
+
import * as Schema15 from "effect/Schema";
|
|
1729
1727
|
import React16, { Fragment } from "react";
|
|
1730
1728
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT4, QueueInput, QueueOutput } from "@dxos/conductor";
|
|
1731
1729
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
@@ -1798,7 +1796,7 @@ var queueShape = {
|
|
|
1798
1796
|
|
|
1799
1797
|
// src/shapes/RNG.tsx
|
|
1800
1798
|
import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
|
|
1801
|
-
import
|
|
1799
|
+
import * as Schema16 from "effect/Schema";
|
|
1802
1800
|
import React17, { useEffect as useEffect5, useState as useState7 } from "react";
|
|
1803
1801
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT5 } from "@dxos/conductor";
|
|
1804
1802
|
import { Icon as Icon4 } from "@dxos/react-ui";
|
|
@@ -1879,7 +1877,7 @@ var randomShape = {
|
|
|
1879
1877
|
|
|
1880
1878
|
// src/shapes/Scope.tsx
|
|
1881
1879
|
import { useSignals as _useSignals17 } from "@preact-signals/safe-react/tracking";
|
|
1882
|
-
import
|
|
1880
|
+
import * as Schema17 from "effect/Schema";
|
|
1883
1881
|
import React18 from "react";
|
|
1884
1882
|
import { DEFAULT_INPUT as DEFAULT_INPUT5 } from "@dxos/conductor";
|
|
1885
1883
|
import { createAnchorMap as createAnchorMap8 } from "@dxos/react-ui-canvas-editor";
|
|
@@ -1933,7 +1931,7 @@ var scopeShape = {
|
|
|
1933
1931
|
|
|
1934
1932
|
// src/shapes/Surface.tsx
|
|
1935
1933
|
import { useSignals as _useSignals18 } from "@preact-signals/safe-react/tracking";
|
|
1936
|
-
import
|
|
1934
|
+
import * as Schema18 from "effect/Schema";
|
|
1937
1935
|
import React19 from "react";
|
|
1938
1936
|
import { Surface } from "@dxos/app-framework";
|
|
1939
1937
|
import { DEFAULT_INPUT as DEFAULT_INPUT6 } from "@dxos/conductor";
|
|
@@ -1991,7 +1989,7 @@ var surfaceShape = {
|
|
|
1991
1989
|
|
|
1992
1990
|
// src/shapes/Switch.tsx
|
|
1993
1991
|
import { useSignals as _useSignals19 } from "@preact-signals/safe-react/tracking";
|
|
1994
|
-
import
|
|
1992
|
+
import * as Schema19 from "effect/Schema";
|
|
1995
1993
|
import React20, { useEffect as useEffect6, useState as useState8 } from "react";
|
|
1996
1994
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT6 } from "@dxos/conductor";
|
|
1997
1995
|
import { Input as Input2 } from "@dxos/react-ui";
|
|
@@ -2044,7 +2042,7 @@ var switchShape = {
|
|
|
2044
2042
|
|
|
2045
2043
|
// src/shapes/Table.tsx
|
|
2046
2044
|
import { useSignals as _useSignals20 } from "@preact-signals/safe-react/tracking";
|
|
2047
|
-
import
|
|
2045
|
+
import * as Schema20 from "effect/Schema";
|
|
2048
2046
|
import React21 from "react";
|
|
2049
2047
|
import { createInputSchema, createOutputSchema } from "@dxos/conductor";
|
|
2050
2048
|
import { DataType } from "@dxos/schema";
|
|
@@ -2083,10 +2081,10 @@ var tableShape = {
|
|
|
2083
2081
|
|
|
2084
2082
|
// src/shapes/Template.tsx
|
|
2085
2083
|
import { useSignals as _useSignals21 } from "@preact-signals/safe-react/tracking";
|
|
2086
|
-
import
|
|
2084
|
+
import * as Schema21 from "effect/Schema";
|
|
2087
2085
|
import React22, { useRef as useRef5 } from "react";
|
|
2088
2086
|
import { ComputeValueType as ComputeValueType3, TemplateOutput, VoidInput as VoidInput2, getTemplateInputSchema as getTemplateInputSchema2 } from "@dxos/conductor";
|
|
2089
|
-
import { toJsonSchema as toJsonSchema2 } from "@dxos/echo
|
|
2087
|
+
import { toJsonSchema as toJsonSchema2 } from "@dxos/echo/internal";
|
|
2090
2088
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
2091
2089
|
import { TextBox as TextBox4 } from "@dxos/react-ui-canvas-editor";
|
|
2092
2090
|
var __dxlog_file6 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/Template.tsx";
|
|
@@ -2162,7 +2160,7 @@ var templateShape = {
|
|
|
2162
2160
|
|
|
2163
2161
|
// src/shapes/Text.tsx
|
|
2164
2162
|
import { useSignals as _useSignals22 } from "@preact-signals/safe-react/tracking";
|
|
2165
|
-
import
|
|
2163
|
+
import * as Schema22 from "effect/Schema";
|
|
2166
2164
|
import React23 from "react";
|
|
2167
2165
|
import { DEFAULT_INPUT as DEFAULT_INPUT7 } from "@dxos/conductor";
|
|
2168
2166
|
import { TextBox as TextBox5 } from "@dxos/react-ui-canvas-editor";
|
|
@@ -2216,7 +2214,7 @@ var textShape = {
|
|
|
2216
2214
|
|
|
2217
2215
|
// src/shapes/Thread.tsx
|
|
2218
2216
|
import { useSignals as _useSignals23 } from "@preact-signals/safe-react/tracking";
|
|
2219
|
-
import
|
|
2217
|
+
import * as Schema23 from "effect/Schema";
|
|
2220
2218
|
import React24, { useEffect as useEffect7, useRef as useRef6 } from "react";
|
|
2221
2219
|
import { createInputSchema as createInputSchema2, createOutputSchema as createOutputSchema2 } from "@dxos/conductor";
|
|
2222
2220
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
@@ -2291,7 +2289,7 @@ var threadShape = {
|
|
|
2291
2289
|
|
|
2292
2290
|
// src/shapes/TextToImage.tsx
|
|
2293
2291
|
import { useSignals as _useSignals24 } from "@preact-signals/safe-react/tracking";
|
|
2294
|
-
import
|
|
2292
|
+
import * as Schema24 from "effect/Schema";
|
|
2295
2293
|
import React25 from "react";
|
|
2296
2294
|
import { createAnchorMap as createAnchorMap12 } from "@dxos/react-ui-canvas-editor";
|
|
2297
2295
|
var TextToImageShape = Schema24.extend(ComputeShape, Schema24.Struct({
|
|
@@ -2331,21 +2329,21 @@ var textToImageShape = {
|
|
|
2331
2329
|
|
|
2332
2330
|
// src/shapes/Trigger.tsx
|
|
2333
2331
|
import { useSignals as _useSignals25 } from "@preact-signals/safe-react/tracking";
|
|
2334
|
-
import
|
|
2332
|
+
import * as Schema25 from "effect/Schema";
|
|
2335
2333
|
import React26, { useEffect as useEffect8 } from "react";
|
|
2336
2334
|
import { VoidInput as VoidInput3 } from "@dxos/conductor";
|
|
2337
|
-
import { Filter as Filter2,
|
|
2338
|
-
import { ObjectId as ObjectId4, Ref as Ref3 } from "@dxos/echo
|
|
2339
|
-
import {
|
|
2335
|
+
import { Filter as Filter2, Query } from "@dxos/echo";
|
|
2336
|
+
import { ObjectId as ObjectId4, Ref as Ref3 } from "@dxos/echo/internal";
|
|
2337
|
+
import { Trigger, TriggerEvent } from "@dxos/functions";
|
|
2340
2338
|
import { DXN, SpaceId } from "@dxos/keys";
|
|
2341
2339
|
import { useSpace } from "@dxos/react-client/echo";
|
|
2342
2340
|
import { Select as Select2 } from "@dxos/react-ui";
|
|
2343
2341
|
var TriggerShape = Schema25.extend(ComputeShape, Schema25.Struct({
|
|
2344
2342
|
type: Schema25.Literal("trigger"),
|
|
2345
|
-
functionTrigger: Schema25.optional(Ref3(
|
|
2343
|
+
functionTrigger: Schema25.optional(Ref3(Trigger.Trigger))
|
|
2346
2344
|
}));
|
|
2347
2345
|
var createTrigger = (props) => {
|
|
2348
|
-
const functionTrigger =
|
|
2346
|
+
const functionTrigger = Trigger.make({
|
|
2349
2347
|
enabled: true,
|
|
2350
2348
|
spec: createTriggerSpec(props)
|
|
2351
2349
|
});
|
|
@@ -2354,7 +2352,7 @@ var createTrigger = (props) => {
|
|
|
2354
2352
|
functionTrigger: Ref3.make(functionTrigger),
|
|
2355
2353
|
size: {
|
|
2356
2354
|
width: 192,
|
|
2357
|
-
height: getHeight(
|
|
2355
|
+
height: getHeight(TriggerEvent.EmailEvent)
|
|
2358
2356
|
},
|
|
2359
2357
|
...props
|
|
2360
2358
|
});
|
|
@@ -2413,7 +2411,7 @@ var TriggerKindSelect = ({ value, onValueChange }) => {
|
|
|
2413
2411
|
}, /* @__PURE__ */ React26.createElement(Select2.TriggerButton, {
|
|
2414
2412
|
variant: "ghost",
|
|
2415
2413
|
classNames: "w-full !px-0"
|
|
2416
|
-
}), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null,
|
|
2414
|
+
}), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null, Trigger.Kinds.map((kind) => /* @__PURE__ */ React26.createElement(Select2.Option, {
|
|
2417
2415
|
key: kind,
|
|
2418
2416
|
value: kind
|
|
2419
2417
|
}, kind))), /* @__PURE__ */ React26.createElement(Select2.ScrollDownButton, null), /* @__PURE__ */ React26.createElement(Select2.Arrow, null))));
|
|
@@ -2437,7 +2435,9 @@ var createTriggerSpec = (props) => {
|
|
|
2437
2435
|
case "subscription":
|
|
2438
2436
|
return {
|
|
2439
2437
|
kind: "subscription",
|
|
2440
|
-
query:
|
|
2438
|
+
query: {
|
|
2439
|
+
ast: Query.select(Filter2.nothing()).ast
|
|
2440
|
+
}
|
|
2441
2441
|
};
|
|
2442
2442
|
case "email":
|
|
2443
2443
|
return {
|
|
@@ -2458,11 +2458,11 @@ var createTriggerSpec = (props) => {
|
|
|
2458
2458
|
};
|
|
2459
2459
|
var getOutputSchema = (kind) => {
|
|
2460
2460
|
const kindToSchema = {
|
|
2461
|
-
["email"]:
|
|
2462
|
-
["subscription"]:
|
|
2463
|
-
["timer"]:
|
|
2464
|
-
["webhook"]:
|
|
2465
|
-
["queue"]:
|
|
2461
|
+
["email"]: TriggerEvent.EmailEvent,
|
|
2462
|
+
["subscription"]: TriggerEvent.SubscriptionEvent,
|
|
2463
|
+
["timer"]: TriggerEvent.TimerEvent,
|
|
2464
|
+
["webhook"]: TriggerEvent.WebhookEvent,
|
|
2465
|
+
["queue"]: TriggerEvent.QueueEvent
|
|
2466
2466
|
};
|
|
2467
2467
|
return kindToSchema[kind];
|
|
2468
2468
|
};
|
|
@@ -2477,7 +2477,7 @@ var triggerShape = {
|
|
|
2477
2477
|
|
|
2478
2478
|
// src/shapes/GptRealtime.tsx
|
|
2479
2479
|
import { useSignals as _useSignals26 } from "@preact-signals/safe-react/tracking";
|
|
2480
|
-
import
|
|
2480
|
+
import * as Schema26 from "effect/Schema";
|
|
2481
2481
|
import React27, { useState as useState9 } from "react";
|
|
2482
2482
|
import { log as log2 } from "@dxos/log";
|
|
2483
2483
|
import { useConfig } from "@dxos/react-client";
|
|
@@ -2673,22 +2673,13 @@ var computeShapes = [
|
|
|
2673
2673
|
|
|
2674
2674
|
// src/compute-layout.ts
|
|
2675
2675
|
import { DefaultInput, DefaultOutput as DefaultOutput2 } from "@dxos/conductor";
|
|
2676
|
-
import { toEffectSchema } from "@dxos/echo
|
|
2676
|
+
import { toEffectSchema } from "@dxos/echo/internal";
|
|
2677
2677
|
import { ShapeLayout } from "@dxos/react-ui-canvas-editor";
|
|
2678
|
-
function _define_property2(obj, key, value) {
|
|
2679
|
-
if (key in obj) {
|
|
2680
|
-
Object.defineProperty(obj, key, {
|
|
2681
|
-
value,
|
|
2682
|
-
enumerable: true,
|
|
2683
|
-
configurable: true,
|
|
2684
|
-
writable: true
|
|
2685
|
-
});
|
|
2686
|
-
} else {
|
|
2687
|
-
obj[key] = value;
|
|
2688
|
-
}
|
|
2689
|
-
return obj;
|
|
2690
|
-
}
|
|
2691
2678
|
var ComputeShapeLayout = class extends ShapeLayout {
|
|
2679
|
+
_controller;
|
|
2680
|
+
constructor(_controller, registry2) {
|
|
2681
|
+
super(registry2), this._controller = _controller;
|
|
2682
|
+
}
|
|
2692
2683
|
// TODO(burdon): Doesn't update.
|
|
2693
2684
|
getAnchors(shape) {
|
|
2694
2685
|
const shapeDef = this._registry.getShapeDef(shape.type);
|
|
@@ -2703,9 +2694,6 @@ var ComputeShapeLayout = class extends ShapeLayout {
|
|
|
2703
2694
|
}
|
|
2704
2695
|
return anchors;
|
|
2705
2696
|
}
|
|
2706
|
-
constructor(_controller, registry2) {
|
|
2707
|
-
super(registry2), _define_property2(this, "_controller", void 0), this._controller = _controller;
|
|
2708
|
-
}
|
|
2709
2697
|
};
|
|
2710
2698
|
export {
|
|
2711
2699
|
AndShape,
|