@dxos/plugin-automation 0.8.4-main.21d9917 → 0.8.4-main.2244d791bb
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-FAS6ADCW.mjs → AutomationPanel-C6MZ22CB.mjs} +3 -3
- package/dist/lib/browser/{AutomationSettings-XN2OIYWL.mjs → AutomationSettings-D7UO5V3Q.mjs} +10 -9
- package/dist/lib/browser/AutomationSettings-D7UO5V3Q.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsContainer-6QLC7JP4.mjs → FunctionsContainer-5NHAAP5H.mjs} +8 -12
- package/dist/lib/browser/FunctionsContainer-5NHAAP5H.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsPanel-ZX4J75UM.mjs → FunctionsPanel-RD22LYMR.mjs} +2 -2
- package/dist/lib/browser/{app-graph-builder-LAQMEBMH.mjs → app-graph-builder-HLARI3VW.mjs} +4 -3
- package/dist/lib/browser/app-graph-builder-HLARI3VW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YWLEY2FD.mjs → chunk-C273ZYLE.mjs} +100 -42
- package/dist/lib/browser/chunk-C273ZYLE.mjs.map +7 -0
- package/dist/lib/browser/{chunk-54PANILA.mjs → chunk-JFBUK3WR.mjs} +5 -5
- package/dist/lib/browser/{chunk-QW3EM35H.mjs → chunk-JN7QRQQX.mjs} +14 -6
- package/dist/lib/browser/chunk-JN7QRQQX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BKFQBKYO.mjs → chunk-O5Y2F33G.mjs} +2 -2
- package/dist/lib/browser/{chunk-RAF2FJST.mjs → chunk-P5AEO35Y.mjs} +18 -11
- package/dist/lib/browser/chunk-P5AEO35Y.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BFUIVUQH.mjs → chunk-QNEQ23BF.mjs} +8 -12
- package/dist/lib/browser/chunk-QNEQ23BF.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +29 -28
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/{compute-runtime-WTWLQ67J.mjs → compute-runtime-BUBHYS4Y.mjs} +20 -15
- package/dist/lib/browser/compute-runtime-BUBHYS4Y.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +1 -1
- package/dist/lib/browser/index.mjs +17 -16
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-Q3MWOR7K.mjs → operation-resolver-IN2FRGOT.mjs} +5 -4
- package/dist/lib/browser/operation-resolver-IN2FRGOT.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-EV3AC62F.mjs → react-surface-246NXXJR.mjs} +10 -9
- package/dist/lib/browser/react-surface-246NXXJR.mjs.map +7 -0
- package/dist/lib/node-esm/{AutomationPanel-B7NAGDFA.mjs → AutomationPanel-RTBY7YFM.mjs} +3 -3
- package/dist/lib/node-esm/{AutomationSettings-M5PMZJ6P.mjs → AutomationSettings-GK4RLSDN.mjs} +10 -9
- package/dist/lib/node-esm/AutomationSettings-GK4RLSDN.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsContainer-J4O2ULWR.mjs → FunctionsContainer-AHHZODM5.mjs} +8 -12
- package/dist/lib/node-esm/FunctionsContainer-AHHZODM5.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsPanel-SS6GIVNU.mjs → FunctionsPanel-V2DKWYMU.mjs} +2 -2
- package/dist/lib/node-esm/{app-graph-builder-4UCMXHYY.mjs → app-graph-builder-Z2TMQHVX.mjs} +4 -3
- package/dist/lib/node-esm/app-graph-builder-Z2TMQHVX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-KWKWOGS5.mjs → chunk-AENSLAVD.mjs} +8 -12
- package/dist/lib/node-esm/chunk-AENSLAVD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-LJAXQ6CX.mjs → chunk-EJPZWAGR.mjs} +14 -6
- package/dist/lib/node-esm/chunk-EJPZWAGR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7QRUPEHH.mjs → chunk-K5Z4UGIO.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-K7GCM342.mjs → chunk-M3UPTGXF.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-2CKVH7JC.mjs → chunk-OJEFRZEV.mjs} +100 -42
- package/dist/lib/node-esm/chunk-OJEFRZEV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HQLVREIX.mjs → chunk-Q7EMIPMW.mjs} +18 -11
- package/dist/lib/node-esm/chunk-Q7EMIPMW.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +29 -28
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/{compute-runtime-ZHROOBLY.mjs → compute-runtime-6UEDBN76.mjs} +20 -15
- package/dist/lib/node-esm/compute-runtime-6UEDBN76.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +1 -1
- package/dist/lib/node-esm/index.mjs +17 -16
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-R5GA4YNO.mjs → operation-resolver-67CEAKXP.mjs} +5 -4
- package/dist/lib/node-esm/operation-resolver-67CEAKXP.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-S6VZJCEZ.mjs → react-surface-U6762KPI.mjs} +10 -9
- package/dist/lib/node-esm/react-surface-U6762KPI.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/cli/plugin.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +3 -4
- package/dist/types/src/components/AutomationPanel/AutomationPanel.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.map +1 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerSettings.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +2 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts +202 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -45
- package/src/AutomationPlugin.tsx +7 -6
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +3 -2
- package/src/capabilities/compute-runtime/compute-runtime.ts +19 -12
- package/src/capabilities/operation-resolver/operation-resolver.ts +4 -3
- package/src/capabilities/react-surface/react-surface.tsx +7 -6
- package/src/cli/commands/trigger/create/queue.ts +2 -2
- package/src/cli/commands/trigger/create/subscription.ts +2 -2
- package/src/cli/commands/trigger/create/timer.ts +2 -2
- package/src/cli/commands/trigger/list.ts +1 -1
- package/src/cli/commands/trigger/remove.ts +2 -2
- package/src/cli/commands/trigger/update/queue.ts +3 -3
- package/src/cli/commands/trigger/update/subscription.ts +3 -3
- package/src/cli/commands/trigger/update/timer.ts +3 -3
- package/src/cli/commands/trigger/util.ts +7 -7
- package/src/cli/plugin.ts +3 -2
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +1 -1
- package/src/components/AutomationPanel/AutomationPanel.tsx +131 -65
- package/src/components/AutomationSettings.tsx +5 -5
- package/src/components/FunctionsContainer.tsx +7 -7
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +11 -10
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +4 -5
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +12 -3
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +3 -3
- package/src/components/TriggerSettings.tsx +5 -4
- package/src/hooks/useComputeRuntimeCallback.ts +1 -1
- package/src/hooks/useTriggerRuntimeControls.ts +22 -8
- package/dist/lib/browser/AutomationSettings-XN2OIYWL.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-6QLC7JP4.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LAQMEBMH.mjs.map +0 -7
- package/dist/lib/browser/chunk-BFUIVUQH.mjs.map +0 -7
- package/dist/lib/browser/chunk-QW3EM35H.mjs.map +0 -7
- package/dist/lib/browser/chunk-RAF2FJST.mjs.map +0 -7
- package/dist/lib/browser/chunk-YWLEY2FD.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-WTWLQ67J.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-Q3MWOR7K.mjs.map +0 -7
- package/dist/lib/browser/react-surface-EV3AC62F.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationSettings-M5PMZJ6P.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-J4O2ULWR.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-4UCMXHYY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2CKVH7JC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HQLVREIX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KWKWOGS5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LJAXQ6CX.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-ZHROOBLY.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-R5GA4YNO.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-S6VZJCEZ.mjs.map +0 -7
- /package/dist/lib/browser/{AutomationPanel-FAS6ADCW.mjs.map → AutomationPanel-C6MZ22CB.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-ZX4J75UM.mjs.map → FunctionsPanel-RD22LYMR.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-54PANILA.mjs.map → chunk-JFBUK3WR.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-BKFQBKYO.mjs.map → chunk-O5Y2F33G.mjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-B7NAGDFA.mjs.map → AutomationPanel-RTBY7YFM.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-SS6GIVNU.mjs.map → FunctionsPanel-V2DKWYMU.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-7QRUPEHH.mjs.map → chunk-K5Z4UGIO.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-K7GCM342.mjs.map → chunk-M3UPTGXF.mjs.map} +0 -0
|
@@ -2,11 +2,11 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
AutomationPanel,
|
|
4
4
|
AutomationPanel_default
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-OJEFRZEV.mjs";
|
|
6
|
+
import "./chunk-EJPZWAGR.mjs";
|
|
7
7
|
import "./chunk-5FXNN3MV.mjs";
|
|
8
8
|
export {
|
|
9
9
|
AutomationPanel,
|
|
10
10
|
AutomationPanel_default as default
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=AutomationPanel-
|
|
12
|
+
//# sourceMappingURL=AutomationPanel-RTBY7YFM.mjs.map
|
package/dist/lib/node-esm/{AutomationSettings-M5PMZJ6P.mjs → AutomationSettings-GK4RLSDN.mjs}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
useTriggerRuntimeControls
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q7EMIPMW.mjs";
|
|
5
5
|
import "./chunk-RX52VKI2.mjs";
|
|
6
6
|
import {
|
|
7
7
|
AutomationPanel
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-OJEFRZEV.mjs";
|
|
9
|
+
import "./chunk-EJPZWAGR.mjs";
|
|
10
10
|
import {
|
|
11
11
|
meta
|
|
12
12
|
} from "./chunk-5FXNN3MV.mjs";
|
|
@@ -14,18 +14,19 @@ import {
|
|
|
14
14
|
// src/components/AutomationSettings.tsx
|
|
15
15
|
import React2 from "react";
|
|
16
16
|
import { useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
17
|
-
import {
|
|
17
|
+
import { Settings as Settings2 } from "@dxos/react-ui-form";
|
|
18
18
|
|
|
19
19
|
// src/components/TriggerSettings.tsx
|
|
20
20
|
import React from "react";
|
|
21
21
|
import { Input, useTranslation } from "@dxos/react-ui";
|
|
22
|
-
import {
|
|
22
|
+
import { Settings } from "@dxos/react-ui-form";
|
|
23
23
|
var TriggersSettings = ({ db }) => {
|
|
24
|
-
const {
|
|
24
|
+
const { state, start, stop } = useTriggerRuntimeControls(db);
|
|
25
|
+
const isRunning = state?.enabled ?? false;
|
|
25
26
|
const { t } = useTranslation(meta.id);
|
|
26
27
|
return /* @__PURE__ */ React.createElement("div", {
|
|
27
28
|
className: "container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]"
|
|
28
|
-
}, /* @__PURE__ */ React.createElement(
|
|
29
|
+
}, /* @__PURE__ */ React.createElement(Settings.ItemInput, {
|
|
29
30
|
title: t("runtime label"),
|
|
30
31
|
description: t("runtime description")
|
|
31
32
|
}, /* @__PURE__ */ React.createElement(Input.Switch, {
|
|
@@ -38,7 +39,7 @@ var TriggersSettings = ({ db }) => {
|
|
|
38
39
|
// src/components/AutomationSettings.tsx
|
|
39
40
|
var AutomationSettings = (props) => {
|
|
40
41
|
const { t } = useTranslation2(meta.id);
|
|
41
|
-
return /* @__PURE__ */ React2.createElement(
|
|
42
|
+
return /* @__PURE__ */ React2.createElement(Settings2.Root, null, /* @__PURE__ */ React2.createElement(Settings2.Section, {
|
|
42
43
|
title: t("automation verbose label", {
|
|
43
44
|
ns: meta.id
|
|
44
45
|
}),
|
|
@@ -54,4 +55,4 @@ export {
|
|
|
54
55
|
AutomationSettings,
|
|
55
56
|
AutomationSettings_default as default
|
|
56
57
|
};
|
|
57
|
-
//# sourceMappingURL=AutomationSettings-
|
|
58
|
+
//# sourceMappingURL=AutomationSettings-GK4RLSDN.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/AutomationSettings.tsx", "../../../src/components/TriggerSettings.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { useTranslation } from '@dxos/react-ui';\nimport { Settings } from '@dxos/react-ui-form';\n\nimport { meta } from '../meta';\n\nimport { AutomationPanel, type AutomationPanelProps } from './AutomationPanel';\nimport { TriggersSettings } from './TriggerSettings';\n\nexport const AutomationSettings = (props: AutomationPanelProps) => {\n const { t } = useTranslation(meta.id);\n return (\n <Settings.Root>\n <Settings.Section\n title={t('automation verbose label', { ns: meta.id })}\n description={t('automation description', { ns: meta.id })}\n >\n <AutomationPanel {...props} />\n <TriggersSettings db={props.space.db} />\n </Settings.Section>\n </Settings.Root>\n );\n};\n\nexport default AutomationSettings;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Database } from '@dxos/echo';\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { Settings } from '@dxos/react-ui-form';\n\nimport { useTriggerRuntimeControls } from '../hooks';\nimport { meta } from '../meta';\n\nexport const TriggersSettings = ({ db }: { db: Database.Database }) => {\n const { state, start, stop } = useTriggerRuntimeControls(db);\n const isRunning = state?.enabled ?? false;\n const { t } = useTranslation(meta.id);\n\n return (\n <div className='container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]'>\n <Settings.ItemInput title={t('runtime label')} description={t('runtime description')}>\n <Input.Switch classNames='justify-self-end' checked={isRunning} onCheckedChange={isRunning ? stop : start} />\n </Settings.ItemInput>\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,kBAAAA,uBAAsB;AAC/B,SAASC,YAAAA,iBAAgB;;;ACHzB,OAAOC,WAAW;AAGlB,SAASC,OAAOC,sBAAsB;AACtC,SAASC,gBAAgB;AAKlB,IAAMC,mBAAmB,CAAC,EAAEC,GAAE,MAA6B;AAChE,QAAM,EAAEC,OAAOC,OAAOC,KAAI,IAAKC,0BAA0BJ,EAAAA;AACzD,QAAMK,YAAYJ,OAAOK,WAAW;AACpC,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,SACE,sBAAA,cAACC,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACC,SAASC,WAAS;IAACC,OAAOR,EAAE,eAAA;IAAkBS,aAAaT,EAAE,qBAAA;KAC5D,sBAAA,cAACU,MAAMC,QAAM;IAACC,YAAW;IAAmBC,SAASf;IAAWgB,iBAAiBhB,YAAYF,OAAOD;;AAI5G;;;ADXO,IAAMoB,qBAAqB,CAACC,UAAAA;AACjC,QAAM,EAAEC,EAAC,IAAKC,gBAAeC,KAAKC,EAAE;AACpC,SACE,gBAAAC,OAAA,cAACC,UAASC,MAAI,MACZ,gBAAAF,OAAA,cAACC,UAASE,SAAO;IACfC,OAAOR,EAAE,4BAA4B;MAAES,IAAIP,KAAKC;IAAG,CAAA;IACnDO,aAAaV,EAAE,0BAA0B;MAAES,IAAIP,KAAKC;IAAG,CAAA;KAEvD,gBAAAC,OAAA,cAACO,iBAAoBZ,KAAAA,GACrB,gBAAAK,OAAA,cAACQ,kBAAAA;IAAiBC,IAAId,MAAMe,MAAMD;;AAI1C;AAEA,IAAA,6BAAef;",
|
|
6
|
+
"names": ["React", "useTranslation", "Settings", "React", "Input", "useTranslation", "Settings", "TriggersSettings", "db", "state", "start", "stop", "useTriggerRuntimeControls", "isRunning", "enabled", "t", "useTranslation", "meta", "id", "div", "className", "Settings", "ItemInput", "title", "description", "Input", "Switch", "classNames", "checked", "onCheckedChange", "AutomationSettings", "props", "t", "useTranslation", "meta", "id", "React", "Settings", "Root", "Section", "title", "ns", "description", "AutomationPanel", "TriggersSettings", "db", "space"]
|
|
7
|
+
}
|
package/dist/lib/node-esm/{FunctionsContainer-J4O2ULWR.mjs → FunctionsContainer-AHHZODM5.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
FunctionsPanel
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AENSLAVD.mjs";
|
|
5
5
|
import {
|
|
6
6
|
meta
|
|
7
7
|
} from "./chunk-5FXNN3MV.mjs";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
// src/components/FunctionsContainer.tsx
|
|
10
10
|
import React2 from "react";
|
|
11
11
|
import { useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
12
|
-
import {
|
|
12
|
+
import { Settings as Settings2 } from "@dxos/react-ui-form";
|
|
13
13
|
|
|
14
14
|
// src/components/FunctionsRegistry/FunctionsRegistry.tsx
|
|
15
15
|
import * as Schema from "effect/Schema";
|
|
@@ -19,9 +19,8 @@ import { Function } from "@dxos/functions";
|
|
|
19
19
|
import { getDeployedFunctions } from "@dxos/functions-runtime/edge";
|
|
20
20
|
import { useClient } from "@dxos/react-client";
|
|
21
21
|
import { Filter, Query, useQuery } from "@dxos/react-client/echo";
|
|
22
|
-
import { useAsyncEffect } from "@dxos/react-ui";
|
|
23
|
-
import {
|
|
24
|
-
import { controlItemClasses } from "@dxos/react-ui-form";
|
|
22
|
+
import { IconButton, useAsyncEffect, useTranslation } from "@dxos/react-ui";
|
|
23
|
+
import { Settings } from "@dxos/react-ui-form";
|
|
25
24
|
import { List } from "@dxos/react-ui-list";
|
|
26
25
|
import { ghostHover, mx } from "@dxos/ui-theme";
|
|
27
26
|
var grid = "grid grid-cols-[1fr_1fr_auto] min-bs-[2.5rem]";
|
|
@@ -60,10 +59,7 @@ var FunctionsRegistry = ({ space }) => {
|
|
|
60
59
|
}, [
|
|
61
60
|
space
|
|
62
61
|
]);
|
|
63
|
-
return /* @__PURE__ */ React.createElement(
|
|
64
|
-
role: "none",
|
|
65
|
-
className: mx(controlItemClasses)
|
|
66
|
-
}, functions.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
|
|
62
|
+
return /* @__PURE__ */ React.createElement(Settings.Container, null, functions.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
|
|
67
63
|
items: functions,
|
|
68
64
|
isItem: Schema.is(Function.Function),
|
|
69
65
|
getId: (func) => func.id
|
|
@@ -102,7 +98,7 @@ var FunctionsRegistry = ({ space }) => {
|
|
|
102
98
|
// src/components/FunctionsContainer.tsx
|
|
103
99
|
var FunctionsContainer = ({ space }) => {
|
|
104
100
|
const { t } = useTranslation2(meta.id);
|
|
105
|
-
return /* @__PURE__ */ React2.createElement(
|
|
101
|
+
return /* @__PURE__ */ React2.createElement(Settings2.Root, null, /* @__PURE__ */ React2.createElement(Settings2.Section, {
|
|
106
102
|
title: t("functions verbose label", {
|
|
107
103
|
ns: meta.id
|
|
108
104
|
}),
|
|
@@ -111,7 +107,7 @@ var FunctionsContainer = ({ space }) => {
|
|
|
111
107
|
})
|
|
112
108
|
}, /* @__PURE__ */ React2.createElement(FunctionsPanel, {
|
|
113
109
|
space
|
|
114
|
-
})), /* @__PURE__ */ React2.createElement(
|
|
110
|
+
})), /* @__PURE__ */ React2.createElement(Settings2.Section, {
|
|
115
111
|
title: t("functions registry verbose label", {
|
|
116
112
|
ns: meta.id
|
|
117
113
|
}),
|
|
@@ -127,4 +123,4 @@ export {
|
|
|
127
123
|
FunctionsContainer,
|
|
128
124
|
FunctionsContainer_default as default
|
|
129
125
|
};
|
|
130
|
-
//# sourceMappingURL=FunctionsContainer-
|
|
126
|
+
//# sourceMappingURL=FunctionsContainer-AHHZODM5.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/FunctionsContainer.tsx", "../../../src/components/FunctionsRegistry/FunctionsRegistry.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Space } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { Settings } from '@dxos/react-ui-form';\n\nimport { meta } from '../meta';\n\nimport { FunctionsPanel } from './FunctionsPanel';\nimport { FunctionsRegistry } from './FunctionsRegistry';\n\nexport const FunctionsContainer = ({ space }: { space: Space }) => {\n const { t } = useTranslation(meta.id);\n return (\n <Settings.Root>\n <Settings.Section\n title={t('functions verbose label', { ns: meta.id })}\n description={t('functions description', { ns: meta.id })}\n >\n <FunctionsPanel space={space} />\n </Settings.Section>\n <Settings.Section\n title={t('functions registry verbose label', { ns: meta.id })}\n description={t('functions registry description', { ns: meta.id })}\n >\n <FunctionsRegistry space={space} />\n </Settings.Section>\n </Settings.Root>\n );\n};\n\nexport default FunctionsContainer;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport { useState } from 'react';\nimport React, { useCallback } from 'react';\n\nimport { Function } from '@dxos/functions';\nimport { getDeployedFunctions } from '@dxos/functions-runtime/edge';\nimport { useClient } from '@dxos/react-client';\nimport { Filter, Query, type Space, useQuery } from '@dxos/react-client/echo';\nimport { IconButton, useAsyncEffect, useTranslation } from '@dxos/react-ui';\nimport { Settings } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/ui-theme';\n\nimport { meta } from '../../meta';\n\nconst grid = 'grid grid-cols-[1fr_1fr_auto] min-bs-[2.5rem]';\n\ntype FunctionsRegistryProps = {\n space: Space;\n};\n\nexport const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {\n const client = useClient();\n const [loading, setLoading] = useState(true);\n const [functions, setFunctions] = useState<Function.Function[]>([]);\n const { t } = useTranslation(meta.id);\n\n const dbFunctions = useQuery(space.db, Filter.type(Function.Function));\n\n const state = (func: Function.Function) => {\n const dbFunction = dbFunctions.find((f) => f.key === func.key);\n if (!dbFunction) {\n return 'import';\n }\n if (dbFunction.version === func.version && dbFunction.updated === func.updated) {\n return 'none';\n }\n return 'update';\n };\n\n useAsyncEffect(async () => {\n setLoading(true);\n const functions = await getDeployedFunctions(client, true);\n setFunctions(functions);\n setLoading(false);\n }, []);\n\n const hanleImportOrUpdate = useCallback(\n async (func: Function.Function) => {\n const functions = await space.db.query(Query.type(Function.Function, { key: func.key })).run();\n const [existingFunc] = functions;\n if (!existingFunc) {\n space.db.add(func);\n return;\n }\n Function.setFrom(existingFunc, func);\n },\n [space],\n );\n\n return (\n <Settings.Container>\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 <div className='text-xs text-description truncate'>{func.key}</div>\n </div>\n <div className='flex flex-col truncate'>\n <div className='text-xs text-description truncate'>{func.version}</div>\n <div className='text-xs text-description truncate'>\n {func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : ''}\n </div>\n </div>\n\n <IconButton\n iconOnly\n icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}\n label={\n state(func) === 'update' ? t('update function button label') : t('import function button label')\n }\n disabled={state(func) === 'none'}\n onClick={() => hanleImportOrUpdate(func)}\n />\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {functions.length === 0 && !loading && (\n <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>\n )}\n {loading && <div className='text-center plb-4 text-gray-500'>{t('loading functions')}</div>}\n </Settings.Container>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,OAAOA,YAAW;AAGlB,SAASC,kBAAAA,uBAAsB;AAC/B,SAASC,YAAAA,iBAAgB;;;ACJzB,YAAYC,YAAY;AACxB,SAASC,gBAAgB;AACzB,OAAOC,SAASC,mBAAmB;AAEnC,SAASC,gBAAgB;AACzB,SAASC,4BAA4B;AACrC,SAASC,iBAAiB;AAC1B,SAASC,QAAQC,OAAmBC,gBAAgB;AACpD,SAASC,YAAYC,gBAAgBC,sBAAsB;AAC3D,SAASC,gBAAgB;AACzB,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAI/B,IAAMC,OAAO;AAMN,IAAMC,oBAAoB,CAAC,EAAEC,MAAK,MAA0B;AACjE,QAAMC,SAASC,UAAAA;AACf,QAAM,CAACC,SAASC,UAAAA,IAAcC,SAAS,IAAA;AACvC,QAAM,CAACC,WAAWC,YAAAA,IAAgBF,SAA8B,CAAA,CAAE;AAClE,QAAM,EAAEG,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,QAAMC,cAAcC,SAASb,MAAMc,IAAIC,OAAOC,KAAKC,SAASA,QAAQ,CAAA;AAEpE,QAAMC,QAAQ,CAACC,SAAAA;AACb,UAAMC,aAAaR,YAAYS,KAAK,CAACC,MAAMA,EAAEC,QAAQJ,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AC,OAAA,cAACQ,mBAAAA;IAAkBb;;AAI3B;AAEA,IAAA,6BAAeD;",
|
|
6
|
+
"names": ["React", "useTranslation", "Settings", "Schema", "useState", "React", "useCallback", "Function", "getDeployedFunctions", "useClient", "Filter", "Query", "useQuery", "IconButton", "useAsyncEffect", "useTranslation", "Settings", "List", "ghostHover", "mx", "grid", "FunctionsRegistry", "space", "client", "useClient", "loading", "setLoading", "useState", "functions", "setFunctions", "t", "useTranslation", "meta", "id", "dbFunctions", "useQuery", "db", "Filter", "type", "Function", "state", "func", "dbFunction", "find", "f", "key", "version", "updated", "useAsyncEffect", "getDeployedFunctions", "hanleImportOrUpdate", "useCallback", "query", "Query", "run", "existingFunc", "add", "setFrom", "Settings", "Container", "length", "List", "Root", "items", "isItem", "is", "getId", "div", "role", "className", "map", "Item", "item", "classNames", "mx", "ghostHover", "ItemTitle", "name", "Date", "toLocaleString", "IconButton", "iconOnly", "icon", "label", "disabled", "onClick", "FunctionsContainer", "space", "t", "useTranslation", "meta", "id", "React", "Settings", "Root", "Section", "title", "ns", "description", "FunctionsPanel", "FunctionsRegistry"]
|
|
7
|
+
}
|
|
@@ -2,10 +2,10 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
FunctionsPanel,
|
|
4
4
|
FunctionsPanel_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AENSLAVD.mjs";
|
|
6
6
|
import "./chunk-5FXNN3MV.mjs";
|
|
7
7
|
export {
|
|
8
8
|
FunctionsPanel,
|
|
9
9
|
FunctionsPanel_default as default
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=FunctionsPanel-
|
|
11
|
+
//# sourceMappingURL=FunctionsPanel-V2DKWYMU.mjs.map
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
|
|
6
6
|
// src/capabilities/app-graph-builder/app-graph-builder.ts
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
|
-
import { Capability
|
|
8
|
+
import { Capability } from "@dxos/app-framework";
|
|
9
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
9
10
|
import { Script } from "@dxos/functions";
|
|
10
11
|
import { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from "@dxos/plugin-deck/types";
|
|
11
12
|
import { GraphBuilder, NodeMatcher } from "@dxos/plugin-graph";
|
|
@@ -77,9 +78,9 @@ var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function
|
|
|
77
78
|
])
|
|
78
79
|
})
|
|
79
80
|
]);
|
|
80
|
-
return Capability.contributes(
|
|
81
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
81
82
|
}));
|
|
82
83
|
export {
|
|
83
84
|
app_graph_builder_default as default
|
|
84
85
|
};
|
|
85
|
-
//# sourceMappingURL=app-graph-builder-
|
|
86
|
+
//# sourceMappingURL=app-graph-builder-Z2TMQHVX.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/app-graph-builder/app-graph-builder.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { Script } from '@dxos/functions';\nimport { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';\nimport { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';\nimport { meta as spaceMeta } from '@dxos/plugin-space';\n\nimport { meta } from '../../meta';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* Effect.all([\n GraphBuilder.createExtension({\n id: `${meta.id}/space-settings-automation`,\n match: NodeMatcher.whenNodeType(`${spaceMeta.id}/settings`),\n connector: (node) =>\n Effect.succeed([\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 }),\n GraphBuilder.createExtension({\n id: `${meta.id}/space-settings-functions`,\n match: NodeMatcher.whenNodeType(`${spaceMeta.id}/settings`),\n connector: (node) =>\n Effect.succeed([\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 }),\n GraphBuilder.createTypeExtension({\n id: `${meta.id}/script-companion`,\n type: Script.Script,\n connector: (script) =>\n Effect.succeed([\n {\n id: [script.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 }),\n ]);\n\n return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAChC,SAASC,cAAc;AACvB,SAASC,2BAA2BC,4BAA4B;AAChE,SAASC,cAAcC,mBAAmB;AAC1C,SAASC,QAAQC,iBAAiB;AAIlC,IAAA,4BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,aAAa,OAAcC,WAAI;IACnCC,aAAaC,gBAAgB;MAC3BC,IAAI,GAAGC,KAAKD,EAAE;MACdE,OAAOC,YAAYC,aAAa,GAAGC,UAAUL,EAAE,WAAW;MAC1DM,WAAW,CAACC,SACHC,eAAQ;QACb;UACER,IAAI,cAAcO,KAAKP,EAAE;UACzBS,MAAM,GAAGR,KAAKD,EAAE;UAChBU,MAAM,GAAGT,KAAKD,EAAE;UAChBW,YAAY;YACVC,OAAO;cAAC;cAA0B;gBAAEC,IAAIZ,KAAKD;cAAG;;YAChDc,MAAM;UACR;QACF;OACD;IACL,CAAA;IACAhB,aAAaC,gBAAgB;MAC3BC,IAAI,GAAGC,KAAKD,EAAE;MACdE,OAAOC,YAAYC,aAAa,GAAGC,UAAUL,EAAE,WAAW;MAC1DM,WAAW,CAACC,SACHC,eAAQ;QACb;UACER,IAAI,aAAaO,KAAKP,EAAE;UACxBS,MAAM,GAAGR,KAAKD,EAAE;UAChBU,MAAM,GAAGT,KAAKD,EAAE;UAChBW,YAAY;YACVC,OAAO;cAAC;cAAyB;gBAAEC,IAAIZ,KAAKD;cAAG;;YAC/Cc,MAAM;UACR;QACF;OACD;IACL,CAAA;IACAhB,aAAaiB,oBAAoB;MAC/Bf,IAAI,GAAGC,KAAKD,EAAE;MACdS,MAAMO,OAAOA;MACbV,WAAW,CAACW,WACHT,eAAQ;QACb;UACER,IAAI;YAACiB,OAAOjB;YAAI;YAAckB,KAAKC,yBAAAA;UACnCV,MAAMW;UACNV,MAAM;UACNC,YAAY;YACVC,OAAO;cAAC;cAA2B;gBAAEC,IAAIZ,KAAKD;cAAG;;YACjDc,MAAM;YACNO,aAAa;UACf;QACF;OACD;IACL,CAAA;GACD;AAED,SAAO5B,WAAW6B,YAAYC,gBAAgBC,iBAAiB5B,UAAAA;AACjE,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "Capability", "AppCapabilities", "Script", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "GraphBuilder", "NodeMatcher", "meta", "spaceMeta", "Capability", "makeModule", "fnUntraced", "extensions", "all", "GraphBuilder", "createExtension", "id", "meta", "match", "NodeMatcher", "whenNodeType", "spaceMeta", "connector", "node", "succeed", "type", "data", "properties", "label", "ns", "icon", "createTypeExtension", "Script", "script", "join", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "disposition", "contributes", "AppCapabilities", "AppGraphBuilder"]
|
|
7
|
+
}
|
|
@@ -6,17 +6,16 @@ import {
|
|
|
6
6
|
// src/components/FunctionsPanel/FunctionsPanel.tsx
|
|
7
7
|
import * as Schema from "effect/Schema";
|
|
8
8
|
import React, { useCallback, useMemo } from "react";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
10
|
+
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
11
11
|
import { Obj } from "@dxos/echo";
|
|
12
12
|
import { Function, Script } from "@dxos/functions";
|
|
13
13
|
import { SpaceOperation } from "@dxos/plugin-space/types";
|
|
14
14
|
import { Filter, useQuery } from "@dxos/react-client/echo";
|
|
15
15
|
import { Button, IconButton, useTranslation } from "@dxos/react-ui";
|
|
16
|
-
import {
|
|
16
|
+
import { Settings } from "@dxos/react-ui-form";
|
|
17
17
|
import { List } from "@dxos/react-ui-list";
|
|
18
18
|
import { ghostHover, mx } from "@dxos/ui-theme";
|
|
19
|
-
var grid = "grid grid-cols-[1fr_auto] min-bs-[2.5rem]";
|
|
20
19
|
var FunctionsPanel = ({ space }) => {
|
|
21
20
|
const { t } = useTranslation(meta.id);
|
|
22
21
|
const functions = useQuery(space.db, Filter.type(Function.Function));
|
|
@@ -44,7 +43,7 @@ var FunctionsPanel = ({ space }) => {
|
|
|
44
43
|
const handleGoToScript = useCallback((func) => {
|
|
45
44
|
const script = functionToScriptMap[func.id];
|
|
46
45
|
if (script) {
|
|
47
|
-
void invokePromise(
|
|
46
|
+
void invokePromise(LayoutOperation.Open, {
|
|
48
47
|
subject: [
|
|
49
48
|
Obj.getDXN(script).toString()
|
|
50
49
|
]
|
|
@@ -61,10 +60,7 @@ var FunctionsPanel = ({ space }) => {
|
|
|
61
60
|
}), [
|
|
62
61
|
invokePromise
|
|
63
62
|
]);
|
|
64
|
-
return /* @__PURE__ */ React.createElement(
|
|
65
|
-
role: "none",
|
|
66
|
-
className: mx(controlItemClasses)
|
|
67
|
-
}, functions.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
|
|
63
|
+
return /* @__PURE__ */ React.createElement(Settings.Container, null, functions.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
|
|
68
64
|
items: functions,
|
|
69
65
|
isItem: Schema.is(Function.Function),
|
|
70
66
|
getId: (func) => func.id
|
|
@@ -74,7 +70,7 @@ var FunctionsPanel = ({ space }) => {
|
|
|
74
70
|
}, items?.map((func) => /* @__PURE__ */ React.createElement(List.Item, {
|
|
75
71
|
key: func.id,
|
|
76
72
|
item: func,
|
|
77
|
-
classNames: mx(grid
|
|
73
|
+
classNames: mx("grid grid-cols-[1fr_auto] min-bs-[2.5rem] min-bs-[3rem] pli-2 items-center", ghostHover)
|
|
78
74
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
79
75
|
className: "flex flex-col truncate"
|
|
80
76
|
}, /* @__PURE__ */ React.createElement(List.ItemTitle, {
|
|
@@ -89,7 +85,7 @@ var FunctionsPanel = ({ space }) => {
|
|
|
89
85
|
label: t("delete function button label"),
|
|
90
86
|
onClick: () => handleDelete(func)
|
|
91
87
|
}))))), functions.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
92
|
-
className: "text-center plb-4 text-
|
|
88
|
+
className: "text-center plb-4 text-description"
|
|
93
89
|
}, t("no functions found")));
|
|
94
90
|
};
|
|
95
91
|
|
|
@@ -100,4 +96,4 @@ export {
|
|
|
100
96
|
FunctionsPanel,
|
|
101
97
|
FunctionsPanel_default
|
|
102
98
|
};
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
99
|
+
//# sourceMappingURL=chunk-AENSLAVD.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 { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { Obj } from '@dxos/echo';\nimport { Function, Script } from '@dxos/functions';\nimport { SpaceOperation } from '@dxos/plugin-space/types';\nimport { Filter, type Space, useQuery } from '@dxos/react-client/echo';\nimport { Button, IconButton, useTranslation } from '@dxos/react-ui';\nimport { Settings } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/ui-theme';\n\nimport { meta } from '../../meta';\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.db, Filter.type(Function.Function));\n const scripts = useQuery(space.db, Filter.type(Script.Script));\n const { invokePromise } = useOperationInvoker();\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 invokePromise(LayoutOperation.Open, { subject: [Obj.getDXN(script).toString()] });\n }\n },\n [functionToScriptMap, invokePromise],\n );\n\n const handleDelete = useCallback(\n (func: Function.Function) => invokePromise(SpaceOperation.RemoveObjects, { objects: [func] }),\n [invokePromise],\n );\n\n return (\n <Settings.Container>\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(\n 'grid grid-cols-[1fr_auto] min-bs-[2.5rem] min-bs-[3rem] pli-2 items-center',\n ghostHover,\n )}\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-description'>{t('no functions found')}</div>}\n </Settings.Container>\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,2BAA2B;AACpC,SAASC,uBAAuB;AAChC,SAASC,WAAW;AACpB,SAASC,UAAUC,cAAc;AACjC,SAASC,sBAAsB;AAC/B,SAASC,QAAoBC,gBAAgB;AAC7C,SAASC,QAAQC,YAAYC,sBAAsB;AACnD,SAASC,gBAAgB;AACzB,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAQxB,IAAMC,iBAAiB,CAAC,EAAEC,MAAK,MAAuB;AAC3D,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,QAAMC,YAAYC,SAASN,MAAMO,IAAIC,OAAOC,KAAKC,SAASA,QAAQ,CAAA;AAClE,QAAMC,UAAUL,SAASN,MAAMO,IAAIC,OAAOC,KAAKG,OAAOA,MAAM,CAAA;AAC5D,QAAM,EAAEC,cAAa,IAAKC,oBAAAA;AAE1B,QAAMC,sBAAsBC,QAC1B,MACEX,UAAUY,OACR,CAACC,KAAKC,SAAAA;AACJ,UAAMC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AKS,IAAI,GAC/CF,cAAcP,IAAAA,KACb,sBAAA,cAAC8B,OAAAA;IAAIE,WAAU;KAAqCzB,cAAcP,IAAAA,CAAAA,CAAAA,GAGrEJ,oBAAoBI,KAAKf,EAAE,KAC1B,sBAAA,cAACuD,QAAAA;IAAOC,SAAS,MAAM/B,iBAAiBV,IAAAA;KAAQlB,EAAE,oCAAA,CAAA,GAEpD,sBAAA,cAAC4D,YAAAA;IACCC,UAAAA;IACAC,MAAK;IACLC,OAAO/D,EAAE,8BAAA;IACT2D,SAAS,MAAMxB,aAAajB,IAAAA;UASzCd,UAAUqC,WAAW,KAAK,sBAAA,cAACO,OAAAA;IAAIE,WAAU;KAAsClD,EAAE,oBAAA,CAAA,CAAA;AAGxF;;;ACxGA,IAAA,yBAAegE;",
|
|
6
|
+
"names": ["Schema", "React", "useCallback", "useMemo", "useOperationInvoker", "LayoutOperation", "Obj", "Function", "Script", "SpaceOperation", "Filter", "useQuery", "Button", "IconButton", "useTranslation", "Settings", "List", "ghostHover", "mx", "FunctionsPanel", "space", "t", "useTranslation", "meta", "id", "functions", "useQuery", "db", "Filter", "type", "Function", "scripts", "Script", "invokePromise", "useOperationInvoker", "functionToScriptMap", "useMemo", "reduce", "map", "func", "scriptId", "source", "target", "script", "find", "s", "getScriptName", "useCallback", "name", "handleGoToScript", "LayoutOperation", "Open", "subject", "Obj", "getDXN", "toString", "handleDelete", "SpaceOperation", "RemoveObjects", "objects", "Settings", "Container", "length", "List", "Root", "items", "isItem", "is", "getId", "div", "role", "className", "Item", "key", "item", "classNames", "mx", "ghostHover", "ItemTitle", "Button", "onClick", "IconButton", "iconOnly", "icon", "label", "FunctionsPanel"]
|
|
7
|
+
}
|
|
@@ -15,7 +15,7 @@ import { Form as Form2, FormFieldLabel, SelectField as SelectField2, omitId } fr
|
|
|
15
15
|
|
|
16
16
|
// src/components/TriggerEditor/FunctionInputEditor.tsx
|
|
17
17
|
import React, { useCallback, useMemo } from "react";
|
|
18
|
-
import { Ref, Type } from "@dxos/echo";
|
|
18
|
+
import { Obj, Ref, Type } from "@dxos/echo";
|
|
19
19
|
import { useOnTransition, useTranslation } from "@dxos/react-ui";
|
|
20
20
|
import { Form, useFormValues } from "@dxos/react-ui-form";
|
|
21
21
|
var FunctionInputEditor = ({ type, functions, db, getValue, onValueChange }) => {
|
|
@@ -53,11 +53,18 @@ var FunctionInputEditor = ({ type, functions, db, getValue, onValueChange }) =>
|
|
|
53
53
|
inputSchema
|
|
54
54
|
]);
|
|
55
55
|
const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;
|
|
56
|
-
const
|
|
56
|
+
const defaultValues = useMemo(() => {
|
|
57
|
+
const raw = getValue() ?? {};
|
|
58
|
+
return Obj.isObject(raw) ? {
|
|
59
|
+
...Obj.getSnapshot(raw)
|
|
60
|
+
} : {
|
|
61
|
+
...raw
|
|
62
|
+
};
|
|
63
|
+
}, [
|
|
57
64
|
getValue
|
|
58
65
|
]);
|
|
59
|
-
const handleValuesChanged = useCallback((
|
|
60
|
-
onValueChange(type,
|
|
66
|
+
const handleValuesChanged = useCallback((values) => {
|
|
67
|
+
onValueChange(type, values);
|
|
61
68
|
}, [
|
|
62
69
|
type,
|
|
63
70
|
onValueChange
|
|
@@ -69,8 +76,9 @@ var FunctionInputEditor = ({ type, functions, db, getValue, onValueChange }) =>
|
|
|
69
76
|
label: t("function parameters label"),
|
|
70
77
|
asChild: true
|
|
71
78
|
}), /* @__PURE__ */ React.createElement(Form.Root, {
|
|
79
|
+
key: selectedFunction.id,
|
|
72
80
|
schema: effectSchema,
|
|
73
|
-
|
|
81
|
+
defaultValues,
|
|
74
82
|
db,
|
|
75
83
|
onValuesChanged: handleValuesChanged
|
|
76
84
|
}, /* @__PURE__ */ React.createElement(Form.FieldSet, null)));
|
|
@@ -246,4 +254,4 @@ var getFunctionOptions = (scripts, functions) => {
|
|
|
246
254
|
export {
|
|
247
255
|
TriggerEditor
|
|
248
256
|
};
|
|
249
|
-
//# sourceMappingURL=chunk-
|
|
257
|
+
//# sourceMappingURL=chunk-EJPZWAGR.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/TriggerEditor/TriggerEditor.tsx", "../../../src/components/TriggerEditor/FunctionInputEditor.tsx", "../../../src/components/TriggerEditor/SpecSelector.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { ComputeGraph } from '@dxos/conductor';\nimport { DXN, type Database, type Query } from '@dxos/echo';\nimport { Function, Script, Trigger } from '@dxos/functions';\nimport { Filter, Ref, useQuery } from '@dxos/react-client/echo';\nimport { Input } from '@dxos/react-ui';\nimport { QueryForm, type QueryFormProps } from '@dxos/react-ui-components';\nimport {\n type ExcludeId,\n Form,\n FormFieldLabel,\n type FormFieldMap,\n type FormRootProps,\n SelectField,\n omitId,\n} from '@dxos/react-ui-form';\n\nimport { FunctionInputEditor } from './FunctionInputEditor';\nimport { SpecSelector } from './SpecSelector';\n\ntype TriggerFormSchema = ExcludeId<typeof Trigger.Trigger>;\n\nexport type TriggerEditorProps = {\n db: Database.Database;\n trigger: Trigger.Trigger;\n // TODO(wittjosiah): This needs to apply to whole spec but currently only applies to spec.kind & spec.query.\n readonlySpec?: boolean;\n} &\n // prettier-ignore\n Pick<QueryFormProps, 'types' | 'tags'> &\n Pick<FormRootProps<TriggerFormSchema>, 'onSave' | 'onCancel'>;\n\nexport const TriggerEditor = ({ db, types, tags, readonlySpec, trigger, ...formProps }: TriggerEditorProps) => {\n const fieldMap = useCustomInputs({\n db,\n types,\n tags,\n readonlySpec,\n });\n\n return (\n <Form.Root<TriggerFormSchema>\n {...formProps}\n schema={omitId(Trigger.Trigger)}\n values={trigger}\n db={db}\n fieldMap={fieldMap}\n >\n <Form.Viewport>\n <Form.Content>\n <Form.FieldSet />\n <Form.Actions />\n </Form.Content>\n </Form.Viewport>\n </Form.Root>\n );\n};\n\ntype UseCustomInputsProps = {\n db: Database.Database;\n readonlySpec?: boolean;\n} & Pick<QueryFormProps, 'types' | 'tags'>;\n\nconst useCustomInputs = ({ db, readonlySpec, types, tags }: UseCustomInputsProps): FormFieldMap => {\n const functions = useQuery(db, Filter.type(Function.Function));\n const workflows = useQuery(db, Filter.type(ComputeGraph));\n const scripts = useQuery(db, Filter.type(Script.Script));\n\n return useMemo(\n (): FormFieldMap => ({\n // Function selector.\n ['function' satisfies keyof Trigger.Trigger]: (props) => {\n const getValue = useCallback(() => {\n const formValue = props.getValue();\n if (Ref.isRef(formValue)) {\n return formValue.dxn.toString() as string;\n }\n return undefined;\n }, [props]);\n\n const handleOnValueChange = useCallback(\n (_type: any, dxnString: string) => {\n const dxn = DXN.parse(dxnString);\n if (dxn) {\n const ref = Ref.fromDXN(dxn);\n props.onValueChange(props.type, ref);\n }\n },\n [props.type, props.onValueChange],\n );\n\n return (\n <SelectField\n {...props}\n getValue={getValue as any}\n onValueChange={handleOnValueChange}\n options={getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))}\n />\n );\n },\n\n // Spec selector.\n ['spec.kind' as const]: (props) => <SpecSelector {...props} readonly={readonlySpec} />,\n\n // TODO(wittjosiah): Copied from ViewEditor.\n // Query input editor.\n ['spec.query' as const]: (props) => {\n const handleChange = useCallback(\n (query: Query.Any) => props.onValueChange(props.type, { ast: query.ast }),\n [props.type, props.onValueChange],\n );\n\n return (\n <Input.Root>\n <FormFieldLabel label={props.label} asChild />\n <QueryForm initialQuery={(props.getValue() as any).ast} types={types} tags={tags} onChange={handleChange} />\n </Input.Root>\n );\n },\n\n // Function input editor.\n ['input' as const]: (props) => <FunctionInputEditor {...props} functions={functions} db={db} />,\n }),\n [workflows, scripts, functions, readonlySpec],\n );\n};\n\nconst getWorkflowOptions = (graphs: ComputeGraph[]) => {\n return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));\n};\n\nconst getFunctionOptions = (scripts: Script.Script[], functions: Function.Function[]) => {\n const getLabel = (fn: Function.Function) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;\n return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:echo:@:${fn.id}` }));\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as SchemaAST from 'effect/SchemaAST';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { type Database, Obj, Ref, Type } from '@dxos/echo';\nimport { type JsonPath } from '@dxos/echo/internal';\nimport { type Function } from '@dxos/functions';\nimport { useOnTransition, useTranslation } from '@dxos/react-ui';\nimport { Form, type FormFieldStateProps, type FormRootProps, useFormValues } from '@dxos/react-ui-form';\n\nimport { meta } from '../../meta';\n\nexport type FunctionInputEditorProps = {\n type: SchemaAST.AST;\n functions: Function.Function[];\n db?: Database.Database;\n} & FormFieldStateProps;\n\nexport const FunctionInputEditor = ({ type, functions, db, getValue, onValueChange }: FunctionInputEditorProps) => {\n const { t } = useTranslation(meta.id);\n const selectedFunctionValue = useFormValues(FunctionInputEditor.displayName, ['function' as JsonPath]);\n const selectedFunctionId = useMemo(() => {\n if (Ref.isRef(selectedFunctionValue)) {\n return selectedFunctionValue.dxn.toString().split('dxn:echo:@:').at(1);\n }\n }, [selectedFunctionValue]);\n\n const selectedFunction = useMemo(\n () => functions.find((fn) => fn.id === selectedFunctionId),\n [functions, selectedFunctionId],\n );\n\n useOnTransition(\n // Clear function parameter input when the function changes.\n selectedFunctionValue,\n (prevValue) => {\n if (!Ref.isRef(prevValue) || !Ref.isRef(selectedFunctionValue)) {\n return false;\n }\n\n return prevValue.dxn.toString() !== selectedFunctionValue.dxn.toString();\n },\n (currValue) => currValue !== undefined,\n () => onValueChange(type, {}),\n );\n\n const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);\n const effectSchema = useMemo(() => (inputSchema ? Type.toEffectSchema(inputSchema) : undefined), [inputSchema]);\n const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;\n const defaultValues = useMemo(() => {\n const raw = getValue() ?? {};\n return Obj.isObject(raw) ? { ...Obj.getSnapshot(raw) } : { ...raw };\n }, [getValue]);\n\n const handleValuesChanged = useCallback<NonNullable<FormRootProps['onValuesChanged']>>(\n (values) => {\n onValueChange(type, values);\n },\n [type, onValueChange],\n );\n\n if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {\n return null;\n }\n\n return (\n <>\n <Form.Label label={t('function parameters label')} asChild />\n <Form.Root\n key={selectedFunction.id}\n schema={effectSchema}\n defaultValues={defaultValues}\n db={db}\n onValuesChanged={handleValuesChanged}\n >\n <Form.FieldSet />\n </Form.Root>\n </>\n );\n};\n\nFunctionInputEditor.displayName = 'AutomationTrigger.FunctionInputEditor';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { Filter, Query } from '@dxos/echo';\nimport { Trigger } from '@dxos/functions';\nimport { useTranslation } from '@dxos/react-ui';\nimport { type FormFieldComponentProps, SelectField, useFormFieldState } from '@dxos/react-ui-form';\n\nimport { meta } from '../../meta';\n\nexport type SpecSelectorProps = FormFieldComponentProps;\n\nexport const SpecSelector = (props: SpecSelectorProps) => {\n const { t } = useTranslation(meta.id);\n const specProps = useFormFieldState(SpecSelector.displayName, ['spec' satisfies keyof Trigger.Trigger]);\n\n const handleTypeChange = useCallback(\n (_type: any, value: string): Trigger.Spec | undefined => {\n const getDefaultTriggerSpec = (kind: string) => {\n switch (kind) {\n case 'timer':\n return { kind: 'timer', cron: '' };\n case 'subscription':\n return {\n kind: 'subscription',\n query: {\n ast: Query.select(Filter.nothing()).ast,\n },\n };\n case 'queue':\n return { kind: 'queue', queue: 'dxn:' };\n case 'email':\n return { kind: 'email' };\n case 'webhook':\n return { kind: 'webhook' };\n default:\n return undefined;\n }\n };\n\n const defaultSpec = getDefaultTriggerSpec(value);\n if (!defaultSpec) {\n return;\n }\n\n // Update the entire spec object, not just the `spec.kind`.\n specProps.onValueChange(props.type, defaultSpec);\n },\n [props.type, specProps],\n );\n\n const options = useMemo(\n () =>\n Trigger.Kinds.map((kind) => ({\n value: kind,\n label: t(`trigger type ${kind}`),\n })),\n [t],\n );\n\n return <SelectField {...props} options={options} onValueChange={handleTypeChange} />;\n};\n\nSpecSelector.displayName = 'Form.SpecSelector';\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,OAAOA,UAASC,eAAAA,cAAaC,WAAAA,gBAAe;AAE5C,SAASC,oBAAoB;AAC7B,SAASC,WAAsC;AAC/C,SAASC,UAAUC,QAAQC,WAAAA,gBAAe;AAC1C,SAASC,UAAAA,SAAQC,OAAAA,MAAKC,gBAAgB;AACtC,SAASC,aAAa;AACtB,SAASC,iBAAsC;AAC/C,SAEEC,QAAAA,OACAC,gBAGAC,eAAAA,cACAC,cACK;;;ACfP,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAAwBC,KAAKC,KAAKC,YAAY;AAG9C,SAASC,iBAAiBC,sBAAsB;AAChD,SAASC,MAAoDC,qBAAqB;AAU3E,IAAMC,sBAAsB,CAAC,EAAEC,MAAMC,WAAWC,IAAIC,UAAUC,cAAa,MAA4B;AAC5G,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,QAAMC,wBAAwBC,cAAcX,oBAAoBY,aAAa;IAAC;GAAuB;AACrG,QAAMC,qBAAqBC,QAAQ,MAAA;AACjC,QAAIC,IAAIC,MAAMN,qBAAAA,GAAwB;AACpC,aAAOA,sBAAsBO,IAAIC,SAAQ,EAAGC,MAAM,aAAA,EAAeC,GAAG,CAAA;IACtE;EACF,GAAG;IAACV;GAAsB;AAE1B,QAAMW,mBAAmBP,QACvB,MAAMZ,UAAUoB,KAAK,CAACC,OAAOA,GAAGd,OAAOI,kBAAAA,GACvC;IAACX;IAAWW;GAAmB;AAGjCW;;IAEEd;IACA,CAACe,cAAAA;AACC,UAAI,CAACV,IAAIC,MAAMS,SAAAA,KAAc,CAACV,IAAIC,MAA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ph", "DXN", "Function", "Script", "Trigger", "Filter", "Ref", "useQuery", "Input", "QueryForm", "Form", "FormFieldLabel", "SelectField", "omitId", "React", "useCallback", "useMemo", "Obj", "Ref", "Type", "useOnTransition", "useTranslation", "Form", "useFormValues", "FunctionInputEditor", "type", "functions", "db", "getValue", "onValueChange", "t", "useTranslation", "meta", "id", "selectedFunctionValue", "useFormValues", "displayName", "selectedFunctionId", "useMemo", "Ref", "isRef", "dxn", "toString", "split", "at", "selectedFunction", "find", "fn", "useOnTransition", "prevValue", "currValue", "undefined", "inputSchema", "effectSchema", "Type", "toEffectSchema", "propertyCount", "properties", "Object", "keys", "length", "defaultValues", "raw", "Obj", "isObject", "getSnapshot", "handleValuesChanged", "useCallback", "values", "Form", "Label", "label", "asChild", "Root", "key", "schema", "onValuesChanged", "FieldSet", "React", "useCallback", "useMemo", "Filter", "Query", "Trigger", "useTranslation", "SelectField", "useFormFieldState", "SpecSelector", "props", "t", "useTranslation", "meta", "id", "specProps", "useFormFieldState", "displayName", "handleTypeChange", "useCallback", "_type", "value", "getDefaultTriggerSpec", "kind", "cron", "query", "ast", "Query", "select", "Filter", "nothing", "queue", "undefined", "defaultSpec", "onValueChange", "type", "options", "useMemo", "Trigger", "Kinds", "map", "label", "React", "SelectField", "TriggerEditor", "db", "types", "tags", "readonlySpec", "trigger", "formProps", "fieldMap", "useCustomInputs", "React", "Form", "Root", "schema", "omitId", "Trigger", "values", "Viewport", "Content", "FieldSet", "Actions", "functions", "useQuery", "Filter", "type", "Function", "workflows", "ComputeGraph", "scripts", "Script", "useMemo", "props", "getValue", "useCallback", "formValue", "Ref", "isRef", "dxn", "toString", "undefined", "handleOnValueChange", "_type", "dxnString", "DXN", "parse", "ref", "fromDXN", "onValueChange", "SelectField", "options", "getWorkflowOptions", "concat", "getFunctionOptions", "SpecSelector", "readonly", "handleChange", "query", "ast", "Input", "FormFieldLabel", "label", "asChild", "QueryForm", "initialQuery", "onChange", "FunctionInputEditor", "graphs", "map", "graph", "id", "value", "getLabel", "fn", "find", "s", "source", "target", "name"]
|
|
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-RTBY7YFM.mjs"));
|
|
6
|
+
var AutomationSettings = lazy(() => import("./AutomationSettings-GK4RLSDN.mjs"));
|
|
7
|
+
var FunctionsContainer = lazy(() => import("./FunctionsContainer-AHHZODM5.mjs"));
|
|
8
|
+
var FunctionsPanel = lazy(() => import("./FunctionsPanel-V2DKWYMU.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-K5Z4UGIO.mjs.map
|
|
@@ -2,9 +2,9 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
|
|
3
3
|
// src/capabilities/compute-runtime/index.ts
|
|
4
4
|
import { Capability } from "@dxos/app-framework";
|
|
5
|
-
var ComputeRuntime = Capability.lazy("ComputeRuntime", () => import("./compute-runtime-
|
|
5
|
+
var ComputeRuntime = Capability.lazy("ComputeRuntime", () => import("./compute-runtime-6UEDBN76.mjs"));
|
|
6
6
|
|
|
7
7
|
export {
|
|
8
8
|
ComputeRuntime
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-M3UPTGXF.mjs.map
|