@dxos/plugin-automation 0.8.4-main.406dc2a → 0.8.4-main.548089c
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/AutomationPanel-W6K45EP4.mjs +11 -0
- package/dist/lib/browser/{AutomationSettings-3EYSPFKB.mjs → AutomationSettings-YGXYZZEU.mjs} +6 -7
- package/dist/lib/{node-esm/AutomationSettings-WKSMWITV.mjs.map → browser/AutomationSettings-YGXYZZEU.mjs.map} +1 -1
- package/dist/lib/browser/FunctionsContainer-JIFRD7DW.mjs +151 -0
- package/dist/lib/browser/FunctionsContainer-JIFRD7DW.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsPanel-NRIKAPQV.mjs → FunctionsPanel-CRW6SJUN.mjs} +3 -3
- package/dist/lib/browser/{app-graph-builder-DV5HMFX4.mjs → app-graph-builder-W7LLC6XW.mjs} +7 -7
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VL3KSDVL.mjs → chunk-DLZNSNOV.mjs} +18 -17
- package/dist/lib/browser/chunk-DLZNSNOV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DK7BLEKU.mjs → chunk-HUHVG4BU.mjs} +5 -5
- package/dist/lib/browser/{chunk-SUKAEYF3.mjs → chunk-JW7XSPYW.mjs} +8 -8
- package/dist/lib/browser/chunk-JW7XSPYW.mjs.map +7 -0
- package/dist/lib/browser/chunk-LZQFZO3B.mjs +17 -0
- package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +7 -0
- package/dist/lib/browser/{chunk-MVPRI3DB.mjs → chunk-RYEK6OMM.mjs} +20 -6
- package/dist/lib/browser/chunk-RYEK6OMM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DLLE4FKP.mjs → chunk-TWWFNOIR.mjs} +27 -12
- package/dist/lib/browser/chunk-TWWFNOIR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5ARH77PV.mjs → chunk-XAKZ4ANY.mjs} +2 -2
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VGBZKM3O.mjs → chunk-YBPJCY3F.mjs} +2 -2
- package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs +113 -0
- package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +3 -4
- package/dist/lib/browser/index.mjs +17 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-D2OHKQRR.mjs → intent-resolver-5HR7M7T6.mjs} +8 -8
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-G7CG7BML.mjs → react-surface-LXPASRXE.mjs} +6 -5
- package/dist/lib/browser/react-surface-LXPASRXE.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{AutomationPanel-EETYIR35.mjs → AutomationPanel-NI6EHUWH.mjs} +4 -4
- package/dist/lib/node-esm/{AutomationSettings-WKSMWITV.mjs → AutomationSettings-3BAIEDRA.mjs} +6 -7
- package/dist/lib/node-esm/FunctionsContainer-MK76KBEW.mjs +152 -0
- package/dist/lib/node-esm/FunctionsContainer-MK76KBEW.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsPanel-SAMRTELO.mjs → FunctionsPanel-RVVCS6VH.mjs} +3 -3
- package/dist/lib/node-esm/{app-graph-builder-TR2WXPX2.mjs → app-graph-builder-SLQOO7GH.mjs} +7 -7
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-5MQJPJR2.mjs → chunk-CEVIVRTY.mjs} +6 -2
- package/dist/lib/node-esm/chunk-CEVIVRTY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-B7N3H45O.mjs → chunk-CPJ33QGN.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-CJUI6AKX.mjs → chunk-ECJKIUBO.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-WHCSOUNN.mjs → chunk-KB7NFEYY.mjs} +2 -2
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-QCA543ZR.mjs → chunk-LMTQG3PX.mjs} +20 -6
- package/dist/lib/node-esm/chunk-LMTQG3PX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AKHETVIQ.mjs → chunk-O4KCL7XS.mjs} +18 -17
- package/dist/lib/node-esm/chunk-O4KCL7XS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-YQXW3JXD.mjs → chunk-RVK52XGK.mjs} +27 -12
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-J3XEBEIE.mjs → chunk-W76WUTZY.mjs} +8 -8
- package/dist/lib/node-esm/chunk-W76WUTZY.mjs.map +7 -0
- package/dist/lib/node-esm/compute-runtime-URROOC34.mjs +114 -0
- package/dist/lib/node-esm/compute-runtime-URROOC34.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +3 -4
- package/dist/lib/node-esm/index.mjs +17 -10
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-2LGBVXT5.mjs → intent-resolver-KDRYB5BC.mjs} +8 -8
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-OMZSBDHS.mjs → react-surface-AFCHOTCJ.mjs} +6 -5
- package/dist/lib/node-esm/react-surface-AFCHOTCJ.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/capabilities/capabilities.d.ts +2 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +2 -2
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +3 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsContainer.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +8 -0
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +2 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +2 -2
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +3 -3
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +3 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +2 -2
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -34
- package/src/AutomationPlugin.tsx +2 -2
- package/src/capabilities/app-graph-builder.ts +6 -6
- package/src/capabilities/capabilities.ts +2 -9
- package/src/capabilities/compute-runtime.ts +22 -33
- package/src/capabilities/intent-resolver.ts +5 -5
- package/src/capabilities/react-surface.tsx +2 -1
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +3 -4
- package/src/components/AutomationPanel/AutomationPanel.tsx +31 -30
- package/src/components/FunctionsContainer.tsx +7 -0
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +32 -13
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +135 -0
- package/src/components/FunctionsRegistry/index.ts +5 -0
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +2 -2
- package/src/components/TriggerEditor/SpecSelector.tsx +4 -4
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +14 -13
- package/src/components/TriggerEditor/TriggerEditor.tsx +10 -10
- package/src/hooks/useComputeRuntimeCallback.ts +3 -1
- package/src/hooks/useTriggerRuntimeControls.ts +4 -3
- package/src/index.ts +1 -0
- package/src/meta.ts +5 -2
- package/src/translations.ts +3 -0
- package/dist/lib/browser/AutomationPanel-3PHA5FTJ.mjs +0 -11
- package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs +0 -36
- package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs.map +0 -7
- package/dist/lib/browser/chunk-5ARH77PV.mjs.map +0 -7
- package/dist/lib/browser/chunk-6TUZQIEN.mjs +0 -14
- package/dist/lib/browser/chunk-6TUZQIEN.mjs.map +0 -7
- package/dist/lib/browser/chunk-DLLE4FKP.mjs.map +0 -7
- package/dist/lib/browser/chunk-MVPRI3DB.mjs.map +0 -7
- package/dist/lib/browser/chunk-SUKAEYF3.mjs.map +0 -7
- package/dist/lib/browser/chunk-VL3KSDVL.mjs.map +0 -7
- package/dist/lib/browser/chunk-WWURMV25.mjs +0 -13
- package/dist/lib/browser/chunk-WWURMV25.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-YJREH6WP.mjs +0 -160
- package/dist/lib/browser/compute-runtime-YJREH6WP.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs.map +0 -7
- package/dist/lib/browser/react-surface-G7CG7BML.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs +0 -37
- package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2EWXIFEK.mjs +0 -16
- package/dist/lib/node-esm/chunk-2EWXIFEK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5MQJPJR2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AKHETVIQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-J3XEBEIE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QCA543ZR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WHCSOUNN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YQXW3JXD.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs +0 -161
- package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-OMZSBDHS.mjs.map +0 -7
- /package/dist/lib/browser/{AutomationPanel-3PHA5FTJ.mjs.map → AutomationPanel-W6K45EP4.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-NRIKAPQV.mjs.map → FunctionsPanel-CRW6SJUN.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-DK7BLEKU.mjs.map → chunk-HUHVG4BU.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-VGBZKM3O.mjs.map → chunk-YBPJCY3F.mjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-EETYIR35.mjs.map → AutomationPanel-NI6EHUWH.mjs.map} +0 -0
- /package/dist/lib/{browser/AutomationSettings-3EYSPFKB.mjs.map → node-esm/AutomationSettings-3BAIEDRA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-SAMRTELO.mjs.map → FunctionsPanel-RVVCS6VH.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-B7N3H45O.mjs.map → chunk-CPJ33QGN.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-CJUI6AKX.mjs.map → chunk-ECJKIUBO.mjs.map} +0 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
meta
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CEVIVRTY.mjs";
|
|
5
5
|
|
|
6
6
|
// src/capabilities/app-graph-builder.ts
|
|
7
|
-
import {
|
|
7
|
+
import { Atom } from "@effect-atom/atom-react";
|
|
8
8
|
import * as Function from "effect/Function";
|
|
9
9
|
import * as Option from "effect/Option";
|
|
10
10
|
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
11
11
|
import { Obj } from "@dxos/echo";
|
|
12
|
-
import {
|
|
12
|
+
import { Script } from "@dxos/functions";
|
|
13
13
|
import { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from "@dxos/plugin-deck/types";
|
|
14
14
|
import { createExtension } from "@dxos/plugin-graph";
|
|
15
15
|
import { meta as spaceMeta } from "@dxos/plugin-space";
|
|
16
16
|
var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphBuilder, [
|
|
17
17
|
createExtension({
|
|
18
18
|
id: `${meta.id}/space-settings-automation`,
|
|
19
|
-
connector: (node) =>
|
|
19
|
+
connector: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.type === `${spaceMeta.id}/settings` ? Option.some(node2) : Option.none()), Option.map((node2) => [
|
|
20
20
|
{
|
|
21
21
|
id: `automation-${node2.id}`,
|
|
22
22
|
type: `${meta.id}/space-settings-automation`,
|
|
@@ -35,7 +35,7 @@ var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphB
|
|
|
35
35
|
}),
|
|
36
36
|
createExtension({
|
|
37
37
|
id: `${meta.id}/space-settings-functions`,
|
|
38
|
-
connector: (node) =>
|
|
38
|
+
connector: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.type === `${spaceMeta.id}/settings` ? Option.some(node2) : Option.none()), Option.map((node2) => [
|
|
39
39
|
{
|
|
40
40
|
id: `functions-${node2.id}`,
|
|
41
41
|
type: `${meta.id}/space-settings-functions`,
|
|
@@ -54,7 +54,7 @@ var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphB
|
|
|
54
54
|
}),
|
|
55
55
|
createExtension({
|
|
56
56
|
id: `${meta.id}/script-companion`,
|
|
57
|
-
connector: (node) =>
|
|
57
|
+
connector: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => Obj.instanceOf(Script.Script, node2.data) ? Option.some(node2) : Option.none()), Option.map((node2) => [
|
|
58
58
|
{
|
|
59
59
|
id: [
|
|
60
60
|
node2.id,
|
|
@@ -79,4 +79,4 @@ var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphB
|
|
|
79
79
|
export {
|
|
80
80
|
app_graph_builder_default as default
|
|
81
81
|
};
|
|
82
|
-
//# sourceMappingURL=app-graph-builder-
|
|
82
|
+
//# sourceMappingURL=app-graph-builder-SLQOO7GH.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport * as Function from 'effect/Function';\nimport * as Option from 'effect/Option';\n\nimport { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { Script } from '@dxos/functions';\nimport { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';\nimport { createExtension } from '@dxos/plugin-graph';\nimport { meta as spaceMeta } from '@dxos/plugin-space';\n\nimport { meta } from '../meta';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${meta.id}/space-settings-automation`,\n connector: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.type === `${spaceMeta.id}/settings` ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: `automation-${node.id}`,\n type: `${meta.id}/space-settings-automation`,\n data: `${meta.id}/space-settings-automation`,\n properties: {\n label: ['automation panel label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/space-settings-functions`,\n connector: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.type === `${spaceMeta.id}/settings` ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: `functions-${node.id}`,\n type: `${meta.id}/space-settings-functions`,\n data: `${meta.id}/space-settings-functions`,\n properties: {\n label: ['functions panel label', { ns: meta.id }],\n icon: 'ph--function--regular',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/script-companion`,\n connector: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (Obj.instanceOf(Script.Script, node.data) ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: [node.id, 'automation'].join(ATTENDABLE_PATH_SEPARATOR),\n type: PLANK_COMPANION_TYPE,\n data: 'automation',\n properties: {\n label: ['script automation label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n disposition: 'hidden',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,SAASA,YAAY;AACrB,YAAYC,cAAc;AAC1B,YAAYC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B;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACdE,WAAW,CAACC,SACVC,KAAKC,KAAK,CAACC,QACAC,cACPD,IAAIH,IAAAA,GACGK,eAAQ,CAACL,UAAUiB,IAAIC,WAAWC,OAAOA,QAAQnB,MAAKW,IAAI,IAAWH,YAAKR,KAAAA,IAAeS,YAAI,CAAA,GAC7FC,WAAI,CAACV,UAAS;MACnB;QACEH,IAAI;UAACG,MAAKH;UAAI;UAAcuB,KAAKC,yBAAAA;QACjCf,MAAMgB;QACNX,MAAM;QACNC,YAAY;UACVC,OAAO;YAAC;YAA2B;cAAEC,IAAIhB,KAAKD;YAAG;;UACjDkB,MAAM;UACNQ,aAAa;QACf;MACF;KACD,GACMP,iBAAU,MAAM,CAAA,CAAE,CAAA,CAAA;EAGjC,CAAA;CACD;",
|
|
6
|
+
"names": ["Atom", "Function", "Option", "Capabilities", "contributes", "Obj", "Script", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "createExtension", "meta", "spaceMeta", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "connector", "node", "Atom", "make", "get", "pipe", "flatMap", "type", "spaceMeta", "some", "none", "map", "data", "properties", "label", "ns", "icon", "getOrElse", "Obj", "instanceOf", "Script", "join", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "disposition"]
|
|
7
|
+
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// src/meta.ts
|
|
4
|
+
import { trim } from "@dxos/util";
|
|
4
5
|
var meta = {
|
|
5
6
|
id: "dxos.org/plugin/automation",
|
|
6
7
|
name: "Automation",
|
|
7
|
-
description:
|
|
8
|
+
description: trim`
|
|
9
|
+
Workflow automation engine that triggers custom actions based on object events and conditions.
|
|
10
|
+
Create automated pipelines that respond to changes and streamline repetitive tasks.
|
|
11
|
+
`,
|
|
8
12
|
icon: "ph--robot--regular",
|
|
9
13
|
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation"
|
|
10
14
|
};
|
|
@@ -12,4 +16,4 @@ var meta = {
|
|
|
12
16
|
export {
|
|
13
17
|
meta
|
|
14
18
|
};
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
19
|
+
//# sourceMappingURL=chunk-CEVIVRTY.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/automation',\n name: 'Automation',\n description: trim`\n Workflow automation engine that triggers custom actions based on object events and conditions.\n Create automated pipelines that respond to changes and streamline repetitive tasks.\n `,\n icon: 'ph--robot--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation',\n};\n"],
|
|
5
|
+
"mappings": ";;;AAKA,SAASA,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,QAAQ;AACV;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "description", "trim", "icon", "source"]
|
|
7
|
+
}
|
|
@@ -2,10 +2,10 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
|
|
3
3
|
// src/components/index.ts
|
|
4
4
|
import { lazy } from "react";
|
|
5
|
-
var AutomationPanel = lazy(() => import("./AutomationPanel-
|
|
6
|
-
var AutomationSettings = lazy(() => import("./AutomationSettings-
|
|
7
|
-
var FunctionsContainer = lazy(() => import("./FunctionsContainer-
|
|
8
|
-
var FunctionsPanel = lazy(() => import("./FunctionsPanel-
|
|
5
|
+
var AutomationPanel = lazy(() => import("./AutomationPanel-NI6EHUWH.mjs"));
|
|
6
|
+
var AutomationSettings = lazy(() => import("./AutomationSettings-3BAIEDRA.mjs"));
|
|
7
|
+
var FunctionsContainer = lazy(() => import("./FunctionsContainer-MK76KBEW.mjs"));
|
|
8
|
+
var FunctionsPanel = lazy(() => import("./FunctionsPanel-RVVCS6VH.mjs"));
|
|
9
9
|
|
|
10
10
|
export {
|
|
11
11
|
AutomationPanel,
|
|
@@ -13,4 +13,4 @@ export {
|
|
|
13
13
|
FunctionsContainer,
|
|
14
14
|
FunctionsPanel
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-CPJ33QGN.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
meta
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CEVIVRTY.mjs";
|
|
5
5
|
|
|
6
6
|
// src/types/schema.ts
|
|
7
7
|
import * as Schema from "effect/Schema";
|
|
@@ -36,4 +36,4 @@ var AutomationAction;
|
|
|
36
36
|
export {
|
|
37
37
|
AutomationAction
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-ECJKIUBO.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
meta
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CEVIVRTY.mjs";
|
|
5
5
|
|
|
6
6
|
// src/capabilities/capabilities.ts
|
|
7
7
|
import { defineCapability } from "@dxos/app-framework";
|
|
@@ -13,4 +13,4 @@ var AutomationCapabilities;
|
|
|
13
13
|
export {
|
|
14
14
|
AutomationCapabilities
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-KB7NFEYY.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/capabilities.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as ManagedRuntime from 'effect/ManagedRuntime';\n\nimport { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';\nimport { defineCapability } from '@dxos/app-framework';\nimport type { CredentialsService, DatabaseService, FunctionInvocationService, QueueService } from '@dxos/functions';\nimport type { InvocationTracer, TriggerDispatcher, TriggerStateStore } from '@dxos/functions-runtime';\nimport type { SpaceId } from '@dxos/keys';\n\nimport { meta } from '../meta';\n\nexport namespace AutomationCapabilities {\n /**\n * Service stack for executing agents, functions, and triggers.\n */\n export type ComputeServices =\n | TriggerDispatcher\n | AiService.AiService\n | DatabaseService\n | QueueService\n | CredentialsService\n | FunctionInvocationService\n | InvocationTracer\n | TriggerStateStore\n // TODO(dmaretskyi): Those should be provided at AI-chat call site.\n | ToolResolverService\n | ToolExecutionService;\n\n export type ComputeRuntime = ManagedRuntime.ManagedRuntime<AutomationCapabilities.ComputeServices, never>;\n export interface ComputeRuntimeProvider {\n getRuntime(spaceId: SpaceId): ComputeRuntime;\n }\n\n /**\n * Runtime for executing agents, functions, and triggers.\n */\n export const ComputeRuntime = defineCapability<ComputeRuntimeProvider>(`${meta.id}/capability/compute-runtime`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;AAOA,SAASA,wBAAwB;UAOhBC,yBAAAA;0BAyBFC,iBAAiBC,iBAAyC,GAAGC,KAAKC,EAAE,6BAA6B;AAChH,GA1BiBJ,2BAAAA,yBAAAA,CAAAA,EAAAA;;",
|
|
6
|
+
"names": ["defineCapability", "AutomationCapabilities", "ComputeRuntime", "defineCapability", "meta", "id"]
|
|
7
|
+
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
AutomationCapabilities
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KB7NFEYY.mjs";
|
|
5
5
|
|
|
6
6
|
// src/hooks/useComputeRuntimeCallback.ts
|
|
7
7
|
import { useCallback } from "react";
|
|
8
|
-
import { useCapability } from "@dxos/app-framework";
|
|
8
|
+
import { useCapability } from "@dxos/app-framework/react";
|
|
9
|
+
|
|
10
|
+
// src/capabilities/index.ts
|
|
11
|
+
import { lazy } from "@dxos/app-framework";
|
|
12
|
+
var AppGraphBuilder = lazy(() => import("./app-graph-builder-SLQOO7GH.mjs"));
|
|
13
|
+
var ComputeRuntime = lazy(() => import("./compute-runtime-URROOC34.mjs"));
|
|
14
|
+
var IntentResolver = lazy(() => import("./intent-resolver-KDRYB5BC.mjs"));
|
|
15
|
+
var ReactSurface = lazy(() => import("./react-surface-AFCHOTCJ.mjs"));
|
|
16
|
+
|
|
17
|
+
// src/hooks/useComputeRuntimeCallback.ts
|
|
9
18
|
var useComputeRuntimeCallback = (space, fn, deps) => {
|
|
10
19
|
const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
11
20
|
const runtime = space !== void 0 ? computeRuntime.getRuntime(space.id) : void 0;
|
|
@@ -23,11 +32,12 @@ var useComputeRuntimeCallback = (space, fn, deps) => {
|
|
|
23
32
|
// src/hooks/useTriggerRuntimeControls.ts
|
|
24
33
|
import * as Effect from "effect/Effect";
|
|
25
34
|
import { Filter } from "@dxos/echo";
|
|
26
|
-
import {
|
|
35
|
+
import { Trigger } from "@dxos/functions";
|
|
36
|
+
import { TriggerDispatcher } from "@dxos/functions-runtime";
|
|
27
37
|
import { useQuery } from "@dxos/react-client/echo";
|
|
28
38
|
import { useAsyncState } from "@dxos/react-ui";
|
|
29
39
|
var useTriggerRuntimeControls = (space) => {
|
|
30
|
-
const triggers = useQuery(space, Filter.type(
|
|
40
|
+
const triggers = useQuery(space, Filter.type(Trigger.Trigger));
|
|
31
41
|
const [isRunningState, setIsRunningState] = useAsyncState(useComputeRuntimeCallback(space, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))));
|
|
32
42
|
const start = useComputeRuntimeCallback(space, Effect.fnUntraced(function* () {
|
|
33
43
|
const dispatcher = yield* TriggerDispatcher;
|
|
@@ -49,6 +59,10 @@ var useTriggerRuntimeControls = (space) => {
|
|
|
49
59
|
|
|
50
60
|
export {
|
|
51
61
|
useComputeRuntimeCallback,
|
|
52
|
-
useTriggerRuntimeControls
|
|
62
|
+
useTriggerRuntimeControls,
|
|
63
|
+
AppGraphBuilder,
|
|
64
|
+
ComputeRuntime,
|
|
65
|
+
IntentResolver,
|
|
66
|
+
ReactSurface
|
|
53
67
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
68
|
+
//# sourceMappingURL=chunk-LMTQG3PX.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useComputeRuntimeCallback.ts", "../../../src/capabilities/index.ts", "../../../src/hooks/useTriggerRuntimeControls.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Effect from 'effect/Effect';\nimport { useCallback } from 'react';\n\nimport { useCapability } from '@dxos/app-framework/react';\nimport type { Space } from '@dxos/react-client/echo';\n\nimport { AutomationCapabilities } from '../capabilities';\n\n/**\n * Create an effectful function that has access to compute services\n */\n// TODO(burdon): Factor out (figure out cross-plugin capabilities dependencies).\nexport const useComputeRuntimeCallback = <T>(\n space: Space | undefined,\n fn: () => Effect.Effect<T, any, AutomationCapabilities.ComputeServices>,\n deps?: React.DependencyList,\n): (() => Promise<T>) => {\n const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);\n const runtime = space !== undefined ? computeRuntime.getRuntime(space.id) : undefined;\n\n return useCallback(() => {\n if (!runtime) {\n throw new TypeError('Space not provided to useComputeRuntimeCallback');\n }\n\n return runtime.runPromise(fn());\n }, [runtime, ...(deps ?? [])]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const AppGraphBuilder = lazy(() => import('./app-graph-builder'));\nexport const ComputeRuntime = lazy(() => import('./compute-runtime'));\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Filter } from '@dxos/echo';\nimport { Trigger } from '@dxos/functions';\nimport { TriggerDispatcher } from '@dxos/functions-runtime';\nimport { type Space, useQuery } from '@dxos/react-client/echo';\nimport { useAsyncState } from '@dxos/react-ui';\n\nimport { useComputeRuntimeCallback } from './useComputeRuntimeCallback';\n\ninterface TriggerRuntimeControls {\n triggers: Trigger.Trigger[];\n isRunning: boolean;\n start: () => void;\n stop: () => void;\n}\n\nexport const useTriggerRuntimeControls = (space: Space | undefined): TriggerRuntimeControls => {\n const triggers = useQuery(space, Filter.type(Trigger.Trigger));\n\n const [isRunningState, setIsRunningState] = useAsyncState(\n useComputeRuntimeCallback(space, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))),\n );\n\n const start = useComputeRuntimeCallback(\n space,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.start();\n setIsRunningState(true);\n }),\n );\n\n const stop = useComputeRuntimeCallback(\n space,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.stop();\n setIsRunningState(false);\n }),\n );\n\n return {\n triggers,\n isRunning: isRunningState ?? false,\n start: () => void start(),\n stop: () => void stop(),\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;AAKA,SAASA,mBAAmB;AAE5B,SAASC,qBAAqB;;;ACH9B,SAASC,YAAY;AAEd,IAAMC,kBAAkBC,KAAK,MAAM,OAAO,kCAAA,CAAA;AAC1C,IAAMC,iBAAiBD,KAAK,MAAM,OAAO,gCAAA,CAAA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;AACF;",
|
|
6
|
+
"names": ["useCallback", "useCapability", "lazy", "AppGraphBuilder", "lazy", "ComputeRuntime", "IntentResolver", "ReactSurface", "useComputeRuntimeCallback", "space", "fn", "deps", "computeRuntime", "useCapability", "AutomationCapabilities", "ComputeRuntime", "runtime", "undefined", "getRuntime", "id", "useCallback", "TypeError", "runPromise", "Effect", "Filter", "Trigger", "TriggerDispatcher", "useQuery", "useAsyncState", "useTriggerRuntimeControls", "space", "triggers", "useQuery", "Filter", "type", "Trigger", "isRunningState", "setIsRunningState", "useAsyncState", "useComputeRuntimeCallback", "TriggerDispatcher", "pipe", "map", "t", "running", "start", "fnUntraced", "dispatcher", "stop", "isRunning"]
|
|
7
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
TriggerEditor
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-W76WUTZY.mjs";
|
|
5
5
|
import {
|
|
6
6
|
meta
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CEVIVRTY.mjs";
|
|
8
8
|
|
|
9
9
|
// src/components/AutomationPanel/AutomationPanel.tsx
|
|
10
10
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
11
11
|
import * as Array from "effect/Array";
|
|
12
|
-
import * as
|
|
12
|
+
import * as EFn from "effect/Function";
|
|
13
13
|
import * as Match from "effect/Match";
|
|
14
14
|
import * as Schema from "effect/Schema";
|
|
15
15
|
import React, { useMemo, useState } from "react";
|
|
16
16
|
import { Filter, Obj, Tag } from "@dxos/echo";
|
|
17
|
-
import {
|
|
17
|
+
import { Function, Script, Trigger } from "@dxos/functions";
|
|
18
18
|
import { useTypeOptions } from "@dxos/plugin-space";
|
|
19
19
|
import { useClient } from "@dxos/react-client";
|
|
20
20
|
import { getSpace, useQuery } from "@dxos/react-client/echo";
|
|
@@ -22,15 +22,16 @@ import { Clipboard, IconButton, Input, Separator, useTranslation } from "@dxos/r
|
|
|
22
22
|
import { ControlItem, controlItemClasses } from "@dxos/react-ui-form";
|
|
23
23
|
import { List } from "@dxos/react-ui-list";
|
|
24
24
|
import { ghostHover, mx } from "@dxos/react-ui-theme";
|
|
25
|
-
import {
|
|
25
|
+
import { View } from "@dxos/schema";
|
|
26
|
+
import { Project } from "@dxos/types";
|
|
26
27
|
var grid = "grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]";
|
|
27
28
|
var AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }) => {
|
|
28
29
|
var _effect = _useSignals();
|
|
29
30
|
try {
|
|
30
31
|
const { t } = useTranslation(meta.id);
|
|
31
32
|
const client = useClient();
|
|
32
|
-
const functions = useQuery(space, Filter.type(
|
|
33
|
-
const triggers = useQuery(space, Filter.type(
|
|
33
|
+
const functions = useQuery(space, Filter.type(Function.Function));
|
|
34
|
+
const triggers = useQuery(space, Filter.type(Trigger.Trigger));
|
|
34
35
|
const filteredTriggers = useMemo(() => {
|
|
35
36
|
return object ? triggers.filter(triggerMatch(object)) : triggers;
|
|
36
37
|
}, [
|
|
@@ -53,7 +54,7 @@ var AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }) =>
|
|
|
53
54
|
setSelected(trigger2);
|
|
54
55
|
};
|
|
55
56
|
const handleAdd = () => {
|
|
56
|
-
setTrigger(
|
|
57
|
+
setTrigger(Trigger.make({}));
|
|
57
58
|
setSelected(void 0);
|
|
58
59
|
};
|
|
59
60
|
const handleDelete = (trigger2) => {
|
|
@@ -65,7 +66,7 @@ var AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }) =>
|
|
|
65
66
|
if (selected) {
|
|
66
67
|
Object.assign(selected, trigger2);
|
|
67
68
|
} else {
|
|
68
|
-
space.db.add(
|
|
69
|
+
space.db.add(Trigger.make(trigger2));
|
|
69
70
|
}
|
|
70
71
|
setTrigger(void 0);
|
|
71
72
|
setSelected(void 0);
|
|
@@ -92,24 +93,24 @@ var AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }) =>
|
|
|
92
93
|
className: mx(controlItemClasses, classNames)
|
|
93
94
|
}, filteredTriggers.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
|
|
94
95
|
items: filteredTriggers,
|
|
95
|
-
isItem: Schema.is(
|
|
96
|
+
isItem: Schema.is(Trigger.Trigger),
|
|
96
97
|
getId: (field) => field.id
|
|
97
98
|
}, ({ items: filteredTriggers2 }) => /* @__PURE__ */ React.createElement("div", {
|
|
98
99
|
role: "list",
|
|
99
|
-
className: "flex flex-col
|
|
100
|
+
className: "flex flex-col is-full"
|
|
100
101
|
}, filteredTriggers2?.map((trigger2) => {
|
|
101
102
|
const copyAction = getCopyAction(client, trigger2);
|
|
102
103
|
return /* @__PURE__ */ React.createElement(List.Item, {
|
|
103
104
|
key: trigger2.id,
|
|
104
105
|
item: trigger2,
|
|
105
|
-
classNames: mx(grid, ghostHover, "items-center", "
|
|
106
|
+
classNames: mx(grid, ghostHover, "items-center", "pli-2")
|
|
106
107
|
}, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Switch, {
|
|
107
108
|
checked: trigger2.enabled,
|
|
108
109
|
onCheckedChange: (checked) => trigger2.enabled = checked
|
|
109
110
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
110
111
|
className: "flex"
|
|
111
112
|
}, /* @__PURE__ */ React.createElement(List.ItemTitle, {
|
|
112
|
-
classNames: "
|
|
113
|
+
classNames: "pli-1 cursor-pointer w-0 shrink truncate",
|
|
113
114
|
onClick: () => handleSelect(trigger2)
|
|
114
115
|
}, getFunctionName(functions, trigger2) ?? "\u2205"), copyAction && /* @__PURE__ */ React.createElement(Clipboard.IconButton, {
|
|
115
116
|
label: t(copyAction.translationKey),
|
|
@@ -157,13 +158,13 @@ var getFunctionName = (functions, trigger) => {
|
|
|
157
158
|
};
|
|
158
159
|
var scriptMatch = (script) => (trigger) => {
|
|
159
160
|
const fn = trigger.function?.target;
|
|
160
|
-
if (!Obj.instanceOf(
|
|
161
|
+
if (!Obj.instanceOf(Function.Function, fn)) {
|
|
161
162
|
return false;
|
|
162
163
|
}
|
|
163
164
|
return fn.source?.target === script;
|
|
164
165
|
};
|
|
165
166
|
var projectMatch = (project) => {
|
|
166
|
-
const viewQueries =
|
|
167
|
+
const viewQueries = EFn.pipe(project.collections, Array.map((collection) => collection.target), Array.filter(Schema.is(View.View)), Array.map((view) => Obj.getSnapshot(view).query.ast), Array.map((ast) => JSON.stringify(ast)));
|
|
167
168
|
return (trigger) => {
|
|
168
169
|
const spec = Obj.getSnapshot(trigger).spec;
|
|
169
170
|
if (spec?.kind !== "subscription") {
|
|
@@ -172,7 +173,7 @@ var projectMatch = (project) => {
|
|
|
172
173
|
return viewQueries.some((query) => JSON.stringify(spec.query) === query);
|
|
173
174
|
};
|
|
174
175
|
};
|
|
175
|
-
var triggerMatch = Match.type().pipe(Match.withReturnType(), Match.when((obj) => Obj.instanceOf(
|
|
176
|
+
var triggerMatch = Match.type().pipe(Match.withReturnType(), Match.when((obj) => Obj.instanceOf(Script.Script, obj), (obj) => scriptMatch(obj)), Match.when((obj) => Obj.instanceOf(Project.Project, obj), (obj) => projectMatch(obj)), Match.orElse((_obj) => () => true));
|
|
176
177
|
|
|
177
178
|
// src/components/AutomationPanel/index.ts
|
|
178
179
|
var AutomationPanel_default = AutomationPanel;
|
|
@@ -181,4 +182,4 @@ export {
|
|
|
181
182
|
AutomationPanel,
|
|
182
183
|
AutomationPanel_default
|
|
183
184
|
};
|
|
184
|
-
//# sourceMappingURL=chunk-
|
|
185
|
+
//# sourceMappingURL=chunk-O4KCL7XS.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/AutomationPanel/AutomationPanel.tsx", "../../../src/components/AutomationPanel/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Array from 'effect/Array';\nimport * as EFn from 'effect/Function';\nimport * as Match from 'effect/Match';\nimport * as Schema from 'effect/Schema';\nimport React, { useMemo, useState } from 'react';\n\nimport { Filter, Obj, Tag } from '@dxos/echo';\nimport { Function, Script, Trigger } from '@dxos/functions';\nimport { useTypeOptions } from '@dxos/plugin-space';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { type Space, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { Clipboard, IconButton, Input, Separator, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { ControlItem, controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\nimport { View } from '@dxos/schema';\nimport { Project } from '@dxos/types';\n\nimport { meta } from '../../meta';\nimport { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';\n\nconst grid = 'grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]';\n\nexport type AutomationPanelProps = ThemedClassName<{\n space: Space;\n object?: Obj.Any;\n initialTrigger?: Trigger.Trigger;\n onDone?: () => void;\n}>;\n\n// TODO(burdon): Factor out common layout with ViewEditor.\nexport const AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }: AutomationPanelProps) => {\n const { t } = useTranslation(meta.id);\n const client = useClient();\n const functions = useQuery(space, Filter.type(Function.Function));\n const triggers = useQuery(space, Filter.type(Trigger.Trigger));\n const filteredTriggers = useMemo(() => {\n return object ? triggers.filter(triggerMatch(object)) : triggers;\n }, [object, triggers]);\n const tags = useQuery(space, Filter.type(Tag.Tag));\n const types = useTypeOptions({ space, annotation: ['dynamic', 'limited-static', 'object-form'] });\n\n const [trigger, setTrigger] = useState<Trigger.Trigger | undefined>(initialTrigger);\n const [selected, setSelected] = useState<Trigger.Trigger>();\n\n const handleSelect = (trigger: Trigger.Trigger) => {\n setTrigger(trigger);\n setSelected(trigger);\n };\n\n const handleAdd = () => {\n setTrigger(Trigger.make({}));\n setSelected(undefined);\n };\n\n const handleDelete = (trigger: Trigger.Trigger) => {\n space.db.remove(trigger);\n setTrigger(undefined);\n setSelected(undefined);\n };\n\n const handleSave: TriggerEditorProps['onSave'] = (trigger) => {\n if (selected) {\n Object.assign(selected, trigger);\n } else {\n space.db.add(Trigger.make(trigger));\n }\n\n setTrigger(undefined);\n setSelected(undefined);\n onDone?.();\n };\n\n const handleCancel: TriggerEditorProps['onCancel'] = () => {\n setTrigger(undefined);\n onDone?.();\n };\n\n if (trigger) {\n return (\n <ControlItem title={t('trigger editor title')}>\n <TriggerEditor\n space={space}\n trigger={trigger}\n readonlySpec={Boolean(object)}\n tags={tags}\n types={types}\n onSave={handleSave}\n onCancel={handleCancel}\n />\n </ControlItem>\n );\n }\n\n return (\n <div className={mx(controlItemClasses, classNames)}>\n {filteredTriggers.length > 0 && (\n <List.Root<Trigger.Trigger>\n items={filteredTriggers}\n isItem={Schema.is(Trigger.Trigger)}\n getId={(field) => field.id}\n >\n {({ items: filteredTriggers }) => (\n <div role='list' className='flex flex-col is-full'>\n {filteredTriggers?.map((trigger) => {\n const copyAction = getCopyAction(client, trigger);\n return (\n <List.Item<Trigger.Trigger>\n key={trigger.id}\n item={trigger}\n classNames={mx(grid, ghostHover, 'items-center', 'pli-2')}\n >\n <Input.Root>\n <Input.Switch\n checked={trigger.enabled}\n onCheckedChange={(checked) => (trigger.enabled = checked)}\n />\n </Input.Root>\n\n <div className={'flex'}>\n <List.ItemTitle\n classNames='pli-1 cursor-pointer w-0 shrink truncate'\n onClick={() => handleSelect(trigger)}\n >\n {getFunctionName(functions, trigger) ?? '∅'}\n </List.ItemTitle>\n\n {/* TODO: a better way to expose copy action */}\n {copyAction && (\n <Clipboard.IconButton\n label={t(copyAction.translationKey)}\n value={copyAction.contentProvider()}\n />\n )}\n </div>\n\n <List.ItemDeleteButton onClick={() => handleDelete(trigger)} />\n </List.Item>\n );\n })}\n </div>\n )}\n </List.Root>\n )}\n {filteredTriggers.length > 0 && <Separator classNames='mlb-4' />}\n <IconButton icon='ph--plus--regular' label={t('new trigger label')} onClick={handleAdd} />\n </div>\n );\n};\n\nconst getCopyAction = (client: Client, trigger: Trigger.Trigger | undefined) => {\n if (trigger?.spec?.kind === 'email') {\n return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };\n }\n\n if (trigger?.spec?.kind === 'webhook') {\n return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };\n }\n\n return undefined;\n};\n\nconst getWebhookUrl = (client: Client, trigger: Trigger.Trigger) => {\n const spaceId = getSpace(trigger)!.id;\n const edgeUrl = new URL(client.config.values.runtime!.services!.edge!.url!);\n const isSecure = edgeUrl.protocol.startsWith('https') || edgeUrl.protocol.startsWith('wss');\n edgeUrl.protocol = isSecure ? 'https' : 'http';\n return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();\n};\n\nconst getFunctionName = (functions: Function.Function[], trigger: Trigger.Trigger) => {\n // TODO(wittjosiah): Truncation should be done in the UI.\n // Warning that the List component is currently a can of worms.\n const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;\n const functionObject = functions.find((fn) => fn === trigger.function?.target);\n return functionObject?.name ?? shortId;\n};\n\nconst scriptMatch = (script: Script.Script) => (trigger: Trigger.Trigger) => {\n const fn = trigger.function?.target;\n if (!Obj.instanceOf(Function.Function, fn)) {\n return false;\n }\n\n return fn.source?.target === script;\n};\n\nconst projectMatch = (project: Project.Project) => {\n const viewQueries = EFn.pipe(\n project.collections,\n Array.map((collection) => collection.target),\n Array.filter(Schema.is(View.View)),\n Array.map((view) => Obj.getSnapshot(view).query.ast),\n Array.map((ast) => JSON.stringify(ast)),\n );\n\n return (trigger: Trigger.Trigger) => {\n const spec = Obj.getSnapshot(trigger).spec;\n if (spec?.kind !== 'subscription') {\n return false;\n }\n\n // TODO(wittjosiah): Implement better way of comparing query ASTs.\n return viewQueries.some((query) => JSON.stringify(spec.query) === query);\n };\n};\n\nconst triggerMatch = Match.type<Obj.Any>().pipe(\n Match.withReturnType<(trigger: Trigger.Trigger) => boolean>(),\n Match.when(\n (obj) => Obj.instanceOf(Script.Script, obj),\n (obj) => scriptMatch(obj),\n ),\n Match.when(\n (obj) => Obj.instanceOf(Project.Project, obj),\n (obj) => projectMatch(obj),\n ),\n Match.orElse((_obj) => () => true),\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AutomationPanel } from './AutomationPanel';\n\nexport * from './AutomationPanel';\n\nexport default AutomationPanel;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;AAIA,YAAYA,WAAW;AACvB,YAAYC,SAAS;AACrB,YAAYC,WAAW;AACvB,YAAYC,YAAY;AACxB,OAAOC,SAASC,SAASC,gBAAgB;AAEzC,SAASC,QAAQC,KAAKC,WAAW;AACjC,SAASC,UAAUC,QAAQC,eAAe;AAC1C,SAASC,sBAAsB;AAC/B,SAAsBC,iBAAiB;AACvC,SAAqBC,UAAUC,gBAAgB;AAC/C,SAASC,WAAWC,YAAYC,OAAOC,WAAiCC,sBAAsB;AAC9F,SAASC,aAAaC,0BAA0B;AAChD,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAC/B,SAASC,YAAY;AACrB,SAASC,eAAe;AAKxB,IAAMC,OAAO;AAUN,IAAMC,kBAAkB,CAAC,EAAEC,YAAYC,OAAOC,QAAQC,gBAAgBC,OAAM,MAAwB;;;AACzG,UAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,UAAMC,SAASC,UAAAA;AACf,UAAMC,YAAYC,SAASX,OAAOY,OAAOC,KAAKC,SAASA,QAAQ,CAAA;AAC/D,UAAMC,WAAWJ,SAASX,OAAOY,OAAOC,KAAKG,QAAQA,OAAO,CAAA;AAC5D,UAAMC,mBAAmBC,QAAQ,MAAA;AAC/B,aAAOjB,SAASc,SAASI,OAAOC,aAAanB,MAAAA,CAAAA,IAAWc;IAC1D,GAAG;MAACd;MAAQc;KAAS;AACrB,UAAMM,OAAOV,SAASX,OA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C7CjE,UAAI,CAACiE,QAAQC,KAAKC,UAAUF,GAAAA,CAAAA,CAAAA;AAGpC,SAAO,CAACtG,YAAAA;AACN,UAAM6D,OAAO4B,IAAIW,YAAYpG,OAAAA,EAAS6D;AACtC,QAAIA,MAAMC,SAAS,gBAAgB;AACjC,aAAO;IACT;AAGA,WAAOgC,YAAYW,KAAK,CAACJ,UAAUE,KAAKC,UAAU3C,KAAKwC,KAAK,MAAMA,KAAAA;EACpE;AACF;AAEA,IAAM3G,eAAqBP,WAAI,EAAY4G,KACnCW,qBAAc,GACdC,WACJ,CAACC,QAAQnB,IAAIC,WAAWmB,OAAOA,QAAQD,GAAAA,GACvC,CAACA,QAAQrB,YAAYqB,GAAAA,CAAAA,GAEjBD,WACJ,CAACC,QAAQnB,IAAIC,WAAWoB,QAAQA,SAASF,GAAAA,GACzC,CAACA,QAAQhB,aAAagB,GAAAA,CAAAA,GAElBG,aAAO,CAACC,SAAS,MAAM,IAAA,CAAA;;;ACrN/B,IAAA,0BAAeC;",
|
|
6
|
+
"names": ["Array", "EFn", "Match", "Schema", "React", "useMemo", "useState", "Filter", "Obj", "Tag", "Function", "Script", "Trigger", "useTypeOptions", "useClient", "getSpace", "useQuery", "Clipboard", "IconButton", "Input", "Separator", "useTranslation", "ControlItem", "controlItemClasses", "List", "ghostHover", "mx", "View", "Project", "grid", "AutomationPanel", "classNames", "space", "object", "initialTrigger", "onDone", "t", "useTranslation", "meta", "id", "client", "useClient", "functions", "useQuery", "Filter", "type", "Function", "triggers", "Trigger", "filteredTriggers", "useMemo", "filter", "triggerMatch", "tags", "Tag", "types", "useTypeOptions", "annotation", "trigger", "setTrigger", "useState", "selected", "setSelected", "handleSelect", "handleAdd", "make", "undefined", "handleDelete", "db", "remove", "handleSave", "Object", "assign", "add", "handleCancel", "ControlItem", "title", "TriggerEditor", "readonlySpec", "Boolean", "onSave", "onCancel", "div", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "is", "getId", "field", "role", "map", "copyAction", "getCopyAction", "Item", "key", "item", "ghostHover", "Input", "Switch", "checked", "enabled", "onCheckedChange", "ItemTitle", "onClick", "getFunctionName", "Clipboard", "IconButton", "label", "translationKey", "value", "contentProvider", "ItemDeleteButton", "Separator", "icon", "spec", "kind", "getSpace", "getWebhookUrl", "spaceId", "edgeUrl", "URL", "config", "values", "runtime", "services", "edge", "url", "isSecure", "protocol", "startsWith", "toString", "shortId", "function", "dxn", "slice", "functionObject", "find", "fn", "target", "name", "scriptMatch", "script", "Obj", "instanceOf", "source", "projectMatch", "project", "viewQueries", "pipe", "collections", "collection", "View", "view", "getSnapshot", "query", "ast", "JSON", "stringify", "some", "withReturnType", "when", "obj", "Script", "Project", "orElse", "_obj", "AutomationPanel"]
|
|
7
|
+
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
meta
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CEVIVRTY.mjs";
|
|
5
5
|
|
|
6
6
|
// src/components/FunctionsPanel/FunctionsPanel.tsx
|
|
7
7
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
8
8
|
import * as Schema from "effect/Schema";
|
|
9
9
|
import React, { useCallback, useMemo } from "react";
|
|
10
|
-
import { LayoutAction, createIntent
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { LayoutAction, createIntent } from "@dxos/app-framework";
|
|
11
|
+
import { useIntentDispatcher } from "@dxos/app-framework/react";
|
|
12
|
+
import { Obj } from "@dxos/echo";
|
|
13
|
+
import { Function, Script } from "@dxos/functions";
|
|
14
|
+
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
15
|
+
import { Filter, useQuery } from "@dxos/react-client/echo";
|
|
16
|
+
import { Button, IconButton, useTranslation } from "@dxos/react-ui";
|
|
14
17
|
import { controlItemClasses } from "@dxos/react-ui-form";
|
|
15
18
|
import { List } from "@dxos/react-ui-list";
|
|
16
19
|
import { ghostHover, mx } from "@dxos/react-ui-theme";
|
|
@@ -19,8 +22,8 @@ var FunctionsPanel = ({ space }) => {
|
|
|
19
22
|
var _effect = _useSignals();
|
|
20
23
|
try {
|
|
21
24
|
const { t } = useTranslation(meta.id);
|
|
22
|
-
const functions = useQuery(space, Filter.type(
|
|
23
|
-
const scripts = useQuery(space, Filter.type(
|
|
25
|
+
const functions = useQuery(space, Filter.type(Function.Function));
|
|
26
|
+
const scripts = useQuery(space, Filter.type(Script.Script));
|
|
24
27
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
25
28
|
const functionToScriptMap = useMemo(() => functions.reduce((map, func) => {
|
|
26
29
|
const scriptId = func.source?.target?.id;
|
|
@@ -47,7 +50,7 @@ var FunctionsPanel = ({ space }) => {
|
|
|
47
50
|
void dispatch(createIntent(LayoutAction.Open, {
|
|
48
51
|
part: "main",
|
|
49
52
|
subject: [
|
|
50
|
-
|
|
53
|
+
Obj.getDXN(script).toString()
|
|
51
54
|
]
|
|
52
55
|
}));
|
|
53
56
|
}
|
|
@@ -55,16 +58,23 @@ var FunctionsPanel = ({ space }) => {
|
|
|
55
58
|
functionToScriptMap,
|
|
56
59
|
dispatch
|
|
57
60
|
]);
|
|
61
|
+
const handleDelete = useCallback((func) => dispatch(createIntent(SpaceAction.RemoveObjects, {
|
|
62
|
+
objects: [
|
|
63
|
+
func
|
|
64
|
+
]
|
|
65
|
+
})), [
|
|
66
|
+
dispatch
|
|
67
|
+
]);
|
|
58
68
|
return /* @__PURE__ */ React.createElement("div", {
|
|
59
69
|
role: "none",
|
|
60
70
|
className: mx(controlItemClasses)
|
|
61
71
|
}, functions.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
|
|
62
72
|
items: functions,
|
|
63
|
-
isItem: Schema.is(
|
|
73
|
+
isItem: Schema.is(Function.Function),
|
|
64
74
|
getId: (func) => func.id
|
|
65
75
|
}, ({ items }) => /* @__PURE__ */ React.createElement("div", {
|
|
66
76
|
role: "list",
|
|
67
|
-
className: "flex flex-col
|
|
77
|
+
className: "flex flex-col is-full"
|
|
68
78
|
}, items?.map((func) => /* @__PURE__ */ React.createElement(List.Item, {
|
|
69
79
|
key: func.id,
|
|
70
80
|
item: func,
|
|
@@ -77,7 +87,12 @@ var FunctionsPanel = ({ space }) => {
|
|
|
77
87
|
className: "text-xs text-description truncate"
|
|
78
88
|
}, getScriptName(func))), functionToScriptMap[func.id] && /* @__PURE__ */ React.createElement(Button, {
|
|
79
89
|
onClick: () => handleGoToScript(func)
|
|
80
|
-
}, t("go to function source button label"))
|
|
90
|
+
}, t("go to function source button label")), /* @__PURE__ */ React.createElement(IconButton, {
|
|
91
|
+
iconOnly: true,
|
|
92
|
+
icon: "ph--trash--regular",
|
|
93
|
+
label: t("delete function button label"),
|
|
94
|
+
onClick: () => handleDelete(func)
|
|
95
|
+
}))))), functions.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
81
96
|
className: "text-center plb-4 text-gray-500"
|
|
82
97
|
}, t("no functions found")));
|
|
83
98
|
} finally {
|
|
@@ -92,4 +107,4 @@ export {
|
|
|
92
107
|
FunctionsPanel,
|
|
93
108
|
FunctionsPanel_default
|
|
94
109
|
};
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
110
|
+
//# sourceMappingURL=chunk-RVK52XGK.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/FunctionsPanel/FunctionsPanel.tsx", "../../../src/components/FunctionsPanel/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { LayoutAction, createIntent } from '@dxos/app-framework';\nimport { useIntentDispatcher } from '@dxos/app-framework/react';\nimport { Obj } from '@dxos/echo';\nimport { Function, Script } from '@dxos/functions';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter, type Space, useQuery } from '@dxos/react-client/echo';\nimport { Button, IconButton, useTranslation } from '@dxos/react-ui';\nimport { controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { meta } from '../../meta';\n\nconst grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';\n\nexport type FunctionsPanelProps = {\n space: Space;\n};\n\nexport const FunctionsPanel = ({ space }: FunctionsPanelProps) => {\n const { t } = useTranslation(meta.id);\n const functions = useQuery(space, Filter.type(Function.Function));\n const scripts = useQuery(space, Filter.type(Script.Script));\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const functionToScriptMap = useMemo(\n () =>\n functions.reduce(\n (map, func) => {\n const scriptId = func.source?.target?.id;\n if (scriptId) {\n const script = scripts.find((s) => s.id === scriptId);\n if (script) {\n map[func.id] = script;\n }\n }\n return map;\n },\n {} as Record<string, Script.Script>,\n ),\n [functions, scripts],\n );\n\n const getScriptName = useCallback(\n (func: Function.Function) => {\n const script = functionToScriptMap[func.id];\n return script?.name;\n },\n [functionToScriptMap],\n );\n\n const handleGoToScript = useCallback(\n (func: Function.Function) => {\n const script = functionToScriptMap[func.id];\n if (script) {\n void dispatch(\n createIntent(LayoutAction.Open, {\n part: 'main',\n subject: [Obj.getDXN(script).toString()],\n }),\n );\n }\n },\n [functionToScriptMap, dispatch],\n );\n\n const handleDelete = useCallback(\n (func: Function.Function) => dispatch(createIntent(SpaceAction.RemoveObjects, { objects: [func] })),\n [dispatch],\n );\n\n return (\n <div role='none' className={mx(controlItemClasses)}>\n {functions.length > 0 && (\n <List.Root<Function.Function> items={functions} isItem={Schema.is(Function.Function)} getId={(func) => func.id}>\n {({ items }) => (\n <div role='list' className='flex flex-col is-full'>\n {items?.map((func) => (\n <List.Item<Function.Function>\n key={func.id}\n item={func}\n classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}\n >\n <div className='flex flex-col truncate'>\n <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>\n {getScriptName(func) && (\n <div className='text-xs text-description truncate'>{getScriptName(func)}</div>\n )}\n </div>\n {functionToScriptMap[func.id] && (\n <Button onClick={() => handleGoToScript(func)}>{t('go to function source button label')}</Button>\n )}\n <IconButton\n iconOnly\n icon='ph--trash--regular'\n label={t('delete function button label')}\n onClick={() => handleDelete(func)}\n />\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { FunctionsPanel } from './FunctionsPanel';\n\nexport * from './FunctionsPanel';\nexport default FunctionsPanel;\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAASC,cAAcC,oBAAoB;AAC3C,SAASC,2BAA2B;AACpC,SAASC,WAAW;AACpB,SAASC,UAAUC,cAAc;AACjC,SAASC,mBAAmB;AAC5B,SAASC,QAAoBC,gBAAgB;AAC7C,SAASC,QAAQC,YAAYC,sBAAsB;AACnD,SAASC,0BAA0B;AACnC,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAI/B,IAAMC,OAAO;AAMN,IAAMC,iBAAiB,CAAC,EAAEC,MAAK,MAAuB;;;AAC3D,UAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,UAAMC,YAAYC,SAASN,OAAOO,OAAOC,KAAKC,SAASA,QAAQ,CAAA;AAC/D,UAAMC,UAAUJ,SAASN,OAAOO,OAAOC,KAAKG,OAAOA,MAAM,CAAA;AACzD,UAAM,EAAEC,iBAAiBC,SAAQ,IAAKC,oBAAAA;AAEtC,UAAMC,sBAAsBC,QAC1B,MACEX,UAAUY,OACR,CAACC,KAAKC,SAAAA;AACJ,YAAMC,WAAWD,KAAKE,QAA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A,cAAChB,OAAAA;MAAIE,WAAU;OACb,sBAAA,cAACI,KAAKW,WAAS;MAACF,YAAW;OAAYtC,KAAKS,IAAI,GAC/CF,cAAcP,IAAAA,KACb,sBAAA,cAACuB,OAAAA;MAAIE,WAAU;OAAqClB,cAAcP,IAAAA,CAAAA,CAAAA,GAGrEJ,oBAAoBI,KAAKf,EAAE,KAC1B,sBAAA,cAACwD,QAAAA;MAAOC,SAAS,MAAMhC,iBAAiBV,IAAAA;OAAQlB,EAAE,oCAAA,CAAA,GAEpD,sBAAA,cAAC6D,YAAAA;MACCC,UAAAA;MACAC,MAAK;MACLC,OAAOhE,EAAE,8BAAA;MACT4D,SAAS,MAAMvB,aAAanB,IAAAA;YASzCd,UAAU0C,WAAW,KAAK,sBAAA,cAACL,OAAAA;MAAIE,WAAU;OAAmC3C,EAAE,oBAAA,CAAA,CAAA;;;;AAGrF;;;AC5GA,IAAA,yBAAeiE;",
|
|
6
|
+
"names": ["Schema", "React", "useCallback", "useMemo", "LayoutAction", "createIntent", "useIntentDispatcher", "Obj", "Function", "Script", "SpaceAction", "Filter", "useQuery", "Button", "IconButton", "useTranslation", "controlItemClasses", "List", "ghostHover", "mx", "grid", "FunctionsPanel", "space", "t", "useTranslation", "meta", "id", "functions", "useQuery", "Filter", "type", "Function", "scripts", "Script", "dispatchPromise", "dispatch", "useIntentDispatcher", "functionToScriptMap", "useMemo", "reduce", "map", "func", "scriptId", "source", "target", "script", "find", "s", "getScriptName", "useCallback", "name", "handleGoToScript", "createIntent", "LayoutAction", "Open", "part", "subject", "Obj", "getDXN", "toString", "handleDelete", "SpaceAction", "RemoveObjects", "objects", "div", "role", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "is", "getId", "Item", "key", "item", "classNames", "ghostHover", "ItemTitle", "Button", "onClick", "IconButton", "iconOnly", "icon", "label", "FunctionsPanel"]
|
|
7
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
meta
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CEVIVRTY.mjs";
|
|
5
5
|
|
|
6
6
|
// src/components/TriggerEditor/TriggerEditor.tsx
|
|
7
7
|
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
8
8
|
import React3, { useCallback as useCallback3, useMemo as useMemo3 } from "react";
|
|
9
9
|
import { ComputeGraph } from "@dxos/conductor";
|
|
10
10
|
import { Type as Type2 } from "@dxos/echo";
|
|
11
|
-
import {
|
|
11
|
+
import { Function, Script, Trigger as Trigger2 } from "@dxos/functions";
|
|
12
12
|
import { Filter as Filter2, Ref as Ref2, useQuery } from "@dxos/react-client/echo";
|
|
13
13
|
import { Input } from "@dxos/react-ui";
|
|
14
14
|
import { QueryForm } from "@dxos/react-ui-components";
|
|
@@ -85,7 +85,7 @@ var FunctionInputEditor = ({ functions, getValue, onValueChange, onQueryRefOptio
|
|
|
85
85
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
86
86
|
import React2, { useCallback as useCallback2, useMemo as useMemo2 } from "react";
|
|
87
87
|
import { Filter, Query } from "@dxos/echo";
|
|
88
|
-
import {
|
|
88
|
+
import { Trigger } from "@dxos/functions";
|
|
89
89
|
import { useTranslation } from "@dxos/react-ui";
|
|
90
90
|
import { SelectInput, useInputProps } from "@dxos/react-ui-form";
|
|
91
91
|
var SpecSelector = (props) => {
|
|
@@ -135,7 +135,7 @@ var SpecSelector = (props) => {
|
|
|
135
135
|
}, [
|
|
136
136
|
specProps
|
|
137
137
|
]);
|
|
138
|
-
const options = useMemo2(() =>
|
|
138
|
+
const options = useMemo2(() => Trigger.Kinds.map((kind) => ({
|
|
139
139
|
value: kind,
|
|
140
140
|
label: t(`trigger type ${kind}`)
|
|
141
141
|
})), [
|
|
@@ -171,7 +171,7 @@ var TriggerEditor = ({ space, trigger, readonlySpec, types, tags, onSave, onCanc
|
|
|
171
171
|
return /* @__PURE__ */ React3.createElement(Form2, {
|
|
172
172
|
outerSpacing: false,
|
|
173
173
|
Custom,
|
|
174
|
-
schema:
|
|
174
|
+
schema: Trigger2.Trigger,
|
|
175
175
|
values: trigger,
|
|
176
176
|
onSave: handleSave,
|
|
177
177
|
onCancel,
|
|
@@ -182,9 +182,9 @@ var TriggerEditor = ({ space, trigger, readonlySpec, types, tags, onSave, onCanc
|
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
var useCustomInputs = ({ space, readonlySpec, types, tags, onQueryRefOptions }) => {
|
|
185
|
-
const functions = useQuery(space, Filter2.type(
|
|
185
|
+
const functions = useQuery(space, Filter2.type(Function.Function));
|
|
186
186
|
const workflows = useQuery(space, Filter2.type(ComputeGraph));
|
|
187
|
-
const scripts = useQuery(space, Filter2.type(
|
|
187
|
+
const scripts = useQuery(space, Filter2.type(Script.Script));
|
|
188
188
|
return useMemo3(() => ({
|
|
189
189
|
// Function selector.
|
|
190
190
|
["function"]: (props) => {
|
|
@@ -265,4 +265,4 @@ var getFunctionOptions = (scripts, functions) => {
|
|
|
265
265
|
export {
|
|
266
266
|
TriggerEditor
|
|
267
267
|
};
|
|
268
|
-
//# sourceMappingURL=chunk-
|
|
268
|
+
//# sourceMappingURL=chunk-W76WUTZY.mjs.map
|