@dxos/plugin-automation 0.8.2-main.fbd8ed0 → 0.8.2-staging.4d6ad0f
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/AutomationContainer-HQK7FTN6.mjs +40 -0
- package/dist/lib/{node-esm/AutomationContainer-OP43F4PD.mjs.map → browser/AutomationContainer-HQK7FTN6.mjs.map} +1 -1
- package/dist/lib/browser/AutomationPanel-GU37N5LO.mjs +11 -0
- package/dist/lib/browser/FunctionsContainer-B7RDWVMX.mjs +39 -0
- package/dist/lib/{node-esm/FunctionsContainer-5TVRDIX5.mjs.map → browser/FunctionsContainer-B7RDWVMX.mjs.map} +1 -1
- package/dist/lib/browser/{FunctionsPanel-NSI3P53X.mjs → FunctionsPanel-LCCPDIT6.mjs} +3 -3
- package/dist/lib/browser/{app-graph-builder-2OGPEVBA.mjs → app-graph-builder-BYECL42X.mjs} +4 -3
- package/dist/lib/browser/{app-graph-builder-2OGPEVBA.mjs.map → app-graph-builder-BYECL42X.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-ADYCSC6Y.mjs → chunk-4E2KPMLB.mjs} +3 -3
- package/dist/lib/{node-esm/chunk-EEA6CZ6B.mjs.map → browser/chunk-4E2KPMLB.mjs.map} +1 -1
- package/dist/lib/browser/chunk-4QTXMPBC.mjs +229 -0
- package/dist/lib/browser/chunk-4QTXMPBC.mjs.map +7 -0
- package/dist/lib/browser/chunk-D2ESAYQD.mjs +149 -0
- package/dist/lib/browser/chunk-D2ESAYQD.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SGT76SL2.mjs → chunk-ELQ2FX5G.mjs} +5 -5
- package/dist/lib/browser/{chunk-WKKQV4PC.mjs → chunk-IHAKPP5A.mjs} +2 -2
- package/dist/lib/browser/{chunk-WKKQV4PC.mjs.map → chunk-IHAKPP5A.mjs.map} +1 -1
- package/dist/lib/browser/chunk-ZTRYR6RJ.mjs +94 -0
- package/dist/lib/{node-esm/chunk-AD4C4IK2.mjs.map → browser/chunk-ZTRYR6RJ.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +6 -6
- package/dist/lib/browser/{intent-resolver-X3H6ZSP4.mjs → intent-resolver-ZRBBYZUX.mjs} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-MOXIHBMS.mjs → react-surface-VKO6PA2P.mjs} +4 -4
- package/dist/lib/browser/types.mjs +2 -2
- package/dist/lib/node/{AutomationContainer-FIFH4P5T.cjs → AutomationContainer-5J7LJK7L.cjs} +26 -20
- package/dist/lib/node/{AutomationContainer-FIFH4P5T.cjs.map → AutomationContainer-5J7LJK7L.cjs.map} +1 -1
- package/dist/lib/node/{AutomationPanel-HTNEWBGB.cjs → AutomationPanel-NPDBUQ7D.cjs} +9 -9
- package/dist/lib/node/{AutomationPanel-HTNEWBGB.cjs.map → AutomationPanel-NPDBUQ7D.cjs.map} +2 -2
- package/dist/lib/node/{FunctionsContainer-LF2F6CPE.cjs → FunctionsContainer-LNLDZUZ6.cjs} +25 -19
- package/dist/lib/node/{FunctionsContainer-LF2F6CPE.cjs.map → FunctionsContainer-LNLDZUZ6.cjs.map} +1 -1
- package/dist/lib/node/{FunctionsPanel-6HOAIMQ3.cjs → FunctionsPanel-7AOXIQMA.cjs} +8 -8
- package/dist/lib/node/FunctionsPanel-7AOXIQMA.cjs.map +7 -0
- package/dist/lib/node/{app-graph-builder-3XGDVWHR.cjs → app-graph-builder-DUKR2BRB.cjs} +17 -16
- package/dist/lib/node/{app-graph-builder-3XGDVWHR.cjs.map → app-graph-builder-DUKR2BRB.cjs.map} +3 -3
- package/dist/lib/node/{chunk-7GXNXMSM.cjs → chunk-3EF7MLFX.cjs} +5 -5
- package/dist/lib/node/{chunk-7GXNXMSM.cjs.map → chunk-3EF7MLFX.cjs.map} +1 -1
- package/dist/lib/node/chunk-4O627QZU.cjs +175 -0
- package/dist/lib/node/chunk-4O627QZU.cjs.map +7 -0
- package/dist/lib/node/{chunk-SV2CB3FT.cjs → chunk-DOLMQUQ5.cjs} +8 -8
- package/dist/lib/node/{chunk-GDCG2BML.cjs → chunk-GIIVTK4O.cjs} +7 -7
- package/dist/lib/node/{chunk-GDCG2BML.cjs.map → chunk-GIIVTK4O.cjs.map} +1 -1
- package/dist/lib/node/chunk-O42NQYQT.cjs +252 -0
- package/dist/lib/node/chunk-O42NQYQT.cjs.map +7 -0
- package/dist/lib/node/chunk-WXQAVUBJ.cjs +122 -0
- package/dist/lib/node/{chunk-CBHWMYKF.cjs.map → chunk-WXQAVUBJ.cjs.map} +1 -1
- package/dist/lib/node/index.cjs +20 -20
- package/dist/lib/node/{intent-resolver-Q7WJ4PZZ.cjs → intent-resolver-JC4Q4TYU.cjs} +7 -7
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-43VHU36V.cjs → react-surface-HB3MYTCK.cjs} +15 -15
- package/dist/lib/node/types.cjs +3 -3
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/AutomationContainer-OJGH76X2.mjs +41 -0
- package/dist/lib/{browser/AutomationContainer-DA6IW7O2.mjs.map → node-esm/AutomationContainer-OJGH76X2.mjs.map} +1 -1
- package/dist/lib/node-esm/{AutomationPanel-ZQKRBWP2.mjs → AutomationPanel-HIWEJUWL.mjs} +4 -4
- package/dist/lib/node-esm/FunctionsContainer-PPR6XNNR.mjs +40 -0
- package/dist/lib/{browser/FunctionsContainer-MPBMMOMS.mjs.map → node-esm/FunctionsContainer-PPR6XNNR.mjs.map} +1 -1
- package/dist/lib/node-esm/{FunctionsPanel-NMEW26KL.mjs → FunctionsPanel-SBXKWTHR.mjs} +3 -3
- package/dist/lib/node-esm/{app-graph-builder-UR2E5CQY.mjs → app-graph-builder-UAXHKKGW.mjs} +4 -3
- package/dist/lib/node-esm/{app-graph-builder-UR2E5CQY.mjs.map → app-graph-builder-UAXHKKGW.mjs.map} +3 -3
- package/dist/lib/node-esm/chunk-5IAHBEHR.mjs +95 -0
- package/dist/lib/{browser/chunk-TRC3J2I6.mjs.map → node-esm/chunk-5IAHBEHR.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-EEA6CZ6B.mjs → chunk-6JOJ2NN4.mjs} +3 -3
- package/dist/lib/{browser/chunk-ADYCSC6Y.mjs.map → node-esm/chunk-6JOJ2NN4.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-D5HK4XLC.mjs +230 -0
- package/dist/lib/node-esm/chunk-D5HK4XLC.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-DZ44LGYT.mjs → chunk-HCCLRNMJ.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-DZ44LGYT.mjs.map → chunk-HCCLRNMJ.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-P2FKMPRE.mjs +150 -0
- package/dist/lib/node-esm/chunk-P2FKMPRE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CUPEMOYK.mjs → chunk-Z7VAQDEE.mjs} +5 -5
- package/dist/lib/node-esm/index.mjs +6 -6
- package/dist/lib/node-esm/{intent-resolver-HEUGQ6SL.mjs → intent-resolver-KRCXJEDR.mjs} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-TER7JEF6.mjs → react-surface-TRKCIZAB.mjs} +4 -4
- package/dist/lib/node-esm/types.mjs +2 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/package.json +27 -26
- package/src/capabilities/app-graph-builder.ts +1 -0
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +3 -2
- package/src/components/AutomationPanel/AutomationPanel.tsx +14 -10
- package/src/components/TriggerEditor/TriggerEditor.tsx +29 -27
- package/src/meta.ts +1 -1
- package/src/testing/test-functions.ts +5 -5
- package/dist/lib/browser/AutomationContainer-DA6IW7O2.mjs +0 -34
- package/dist/lib/browser/AutomationPanel-R42D3LDD.mjs +0 -11
- package/dist/lib/browser/FunctionsContainer-MPBMMOMS.mjs +0 -33
- package/dist/lib/browser/chunk-2QF27UJ2.mjs +0 -140
- package/dist/lib/browser/chunk-2QF27UJ2.mjs.map +0 -7
- package/dist/lib/browser/chunk-BNQNURZN.mjs +0 -211
- package/dist/lib/browser/chunk-BNQNURZN.mjs.map +0 -7
- package/dist/lib/browser/chunk-TRC3J2I6.mjs +0 -88
- package/dist/lib/node/FunctionsPanel-6HOAIMQ3.cjs.map +0 -7
- package/dist/lib/node/chunk-CBHWMYKF.cjs +0 -116
- package/dist/lib/node/chunk-S3Z4AP77.cjs +0 -234
- package/dist/lib/node/chunk-S3Z4AP77.cjs.map +0 -7
- package/dist/lib/node/chunk-TI3WBQIB.cjs +0 -166
- package/dist/lib/node/chunk-TI3WBQIB.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationContainer-OP43F4PD.mjs +0 -35
- package/dist/lib/node-esm/FunctionsContainer-5TVRDIX5.mjs +0 -34
- package/dist/lib/node-esm/chunk-AD4C4IK2.mjs +0 -89
- package/dist/lib/node-esm/chunk-DIUPZXCQ.mjs +0 -141
- package/dist/lib/node-esm/chunk-DIUPZXCQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DZ7RKC52.mjs +0 -212
- package/dist/lib/node-esm/chunk-DZ7RKC52.mjs.map +0 -7
- /package/dist/lib/browser/{AutomationPanel-R42D3LDD.mjs.map → AutomationPanel-GU37N5LO.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-NSI3P53X.mjs.map → FunctionsPanel-LCCPDIT6.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-SGT76SL2.mjs.map → chunk-ELQ2FX5G.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-X3H6ZSP4.mjs.map → intent-resolver-ZRBBYZUX.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-MOXIHBMS.mjs.map → react-surface-VKO6PA2P.mjs.map} +0 -0
- /package/dist/lib/node/{chunk-SV2CB3FT.cjs.map → chunk-DOLMQUQ5.cjs.map} +0 -0
- /package/dist/lib/node/{intent-resolver-Q7WJ4PZZ.cjs.map → intent-resolver-JC4Q4TYU.cjs.map} +0 -0
- /package/dist/lib/node/{react-surface-43VHU36V.cjs.map → react-surface-HB3MYTCK.cjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-ZQKRBWP2.mjs.map → AutomationPanel-HIWEJUWL.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-NMEW26KL.mjs.map → FunctionsPanel-SBXKWTHR.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-CUPEMOYK.mjs.map → chunk-Z7VAQDEE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-resolver-HEUGQ6SL.mjs.map → intent-resolver-KRCXJEDR.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-surface-TER7JEF6.mjs.map → react-surface-TRKCIZAB.mjs.map} +0 -0
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var chunk_CBHWMYKF_exports = {};
|
|
30
|
-
__export(chunk_CBHWMYKF_exports, {
|
|
31
|
-
FunctionsPanel: () => FunctionsPanel,
|
|
32
|
-
FunctionsPanel_default: () => FunctionsPanel_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(chunk_CBHWMYKF_exports);
|
|
35
|
-
var import_chunk_7GXNXMSM = require("./chunk-7GXNXMSM.cjs");
|
|
36
|
-
var import_effect = require("effect");
|
|
37
|
-
var import_react = __toESM(require("react"));
|
|
38
|
-
var import_app_framework = require("@dxos/app-framework");
|
|
39
|
-
var import_functions = require("@dxos/functions");
|
|
40
|
-
var import_echo = require("@dxos/react-client/echo");
|
|
41
|
-
var import_react_ui = require("@dxos/react-ui");
|
|
42
|
-
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
43
|
-
var import_react_ui_list = require("@dxos/react-ui-list");
|
|
44
|
-
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
45
|
-
var grid = "grid grid-cols-[1fr_auto] min-bs-[2.5rem]";
|
|
46
|
-
var FunctionsPanel = ({ space }) => {
|
|
47
|
-
const { t } = (0, import_react_ui.useTranslation)(import_chunk_7GXNXMSM.AUTOMATION_PLUGIN);
|
|
48
|
-
const functions = (0, import_echo.useQuery)(space, import_echo.Filter.type(import_functions.FunctionType));
|
|
49
|
-
const scripts = (0, import_echo.useQuery)(space, import_echo.Filter.type(import_functions.ScriptType));
|
|
50
|
-
const { dispatchPromise: dispatch } = (0, import_app_framework.useIntentDispatcher)();
|
|
51
|
-
const functionToScriptMap = (0, import_react.useMemo)(() => functions.reduce((map, func) => {
|
|
52
|
-
const scriptId = func.source?.target?.id;
|
|
53
|
-
if (scriptId) {
|
|
54
|
-
const script = scripts.find((s) => s.id === scriptId);
|
|
55
|
-
if (script) {
|
|
56
|
-
map[func.id] = script;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return map;
|
|
60
|
-
}, {}), [
|
|
61
|
-
functions,
|
|
62
|
-
scripts
|
|
63
|
-
]);
|
|
64
|
-
const getScriptName = (0, import_react.useCallback)((func) => {
|
|
65
|
-
const script = functionToScriptMap[func.id];
|
|
66
|
-
return script?.name;
|
|
67
|
-
}, [
|
|
68
|
-
functionToScriptMap
|
|
69
|
-
]);
|
|
70
|
-
const handleGoToScript = (0, import_react.useCallback)((func) => {
|
|
71
|
-
const script = functionToScriptMap[func.id];
|
|
72
|
-
if (script) {
|
|
73
|
-
void dispatch((0, import_app_framework.createIntent)(import_app_framework.LayoutAction.Open, {
|
|
74
|
-
part: "main",
|
|
75
|
-
subject: [
|
|
76
|
-
(0, import_echo.fullyQualifiedId)(script)
|
|
77
|
-
]
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
}, [
|
|
81
|
-
functionToScriptMap,
|
|
82
|
-
dispatch
|
|
83
|
-
]);
|
|
84
|
-
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
85
|
-
role: "none",
|
|
86
|
-
className: (0, import_react_ui_theme.mx)(import_react_ui_form.controlItemClasses)
|
|
87
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_list.List.Root, {
|
|
88
|
-
items: functions,
|
|
89
|
-
isItem: import_effect.Schema.is(import_functions.FunctionType),
|
|
90
|
-
getId: (func) => func.id
|
|
91
|
-
}, ({ items }) => /* @__PURE__ */ import_react.default.createElement("div", {
|
|
92
|
-
role: "list",
|
|
93
|
-
className: "flex flex-col w-full"
|
|
94
|
-
}, items?.map((func) => /* @__PURE__ */ import_react.default.createElement(import_react_ui_list.List.Item, {
|
|
95
|
-
key: func.id,
|
|
96
|
-
item: func,
|
|
97
|
-
classNames: (0, import_react_ui_theme.mx)(grid, import_react_ui_theme.ghostHover, "items-center", "pli-2", "min-bs-[3rem]")
|
|
98
|
-
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
99
|
-
className: "flex flex-col truncate"
|
|
100
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_list.List.ItemTitle, {
|
|
101
|
-
classNames: "truncate"
|
|
102
|
-
}, func.name), getScriptName(func) && /* @__PURE__ */ import_react.default.createElement("div", {
|
|
103
|
-
className: "text-xs text-description truncate"
|
|
104
|
-
}, getScriptName(func))), functionToScriptMap[func.id] && /* @__PURE__ */ import_react.default.createElement(import_react_ui.Button, {
|
|
105
|
-
onClick: () => handleGoToScript(func)
|
|
106
|
-
}, t("go to function source button label")))))), functions.length === 0 && /* @__PURE__ */ import_react.default.createElement("div", {
|
|
107
|
-
className: "text-center plb-4 text-gray-500"
|
|
108
|
-
}, t("no functions found")));
|
|
109
|
-
};
|
|
110
|
-
var FunctionsPanel_default = FunctionsPanel;
|
|
111
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
112
|
-
0 && (module.exports = {
|
|
113
|
-
FunctionsPanel,
|
|
114
|
-
FunctionsPanel_default
|
|
115
|
-
});
|
|
116
|
-
//# sourceMappingURL=chunk-CBHWMYKF.cjs.map
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var chunk_S3Z4AP77_exports = {};
|
|
30
|
-
__export(chunk_S3Z4AP77_exports, {
|
|
31
|
-
TriggerEditor: () => TriggerEditor
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(chunk_S3Z4AP77_exports);
|
|
34
|
-
var import_chunk_7GXNXMSM = require("./chunk-7GXNXMSM.cjs");
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_conductor = require("@dxos/conductor");
|
|
37
|
-
var import_echo = require("@dxos/echo");
|
|
38
|
-
var import_functions = require("@dxos/functions");
|
|
39
|
-
var import_echo2 = require("@dxos/react-client/echo");
|
|
40
|
-
var import_react_ui = require("@dxos/react-ui");
|
|
41
|
-
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
42
|
-
var import_react2 = __toESM(require("react"));
|
|
43
|
-
var import_echo_schema = require("@dxos/echo-schema");
|
|
44
|
-
var import_react_ui2 = require("@dxos/react-ui");
|
|
45
|
-
var import_react_ui_form2 = require("@dxos/react-ui-form");
|
|
46
|
-
var import_react3 = __toESM(require("react"));
|
|
47
|
-
var import_functions2 = require("@dxos/functions");
|
|
48
|
-
var import_react_ui3 = require("@dxos/react-ui");
|
|
49
|
-
var import_react_ui_form3 = require("@dxos/react-ui-form");
|
|
50
|
-
var FunctionInputEditor = ({ functions, getValue, onValueChange, onQueryRefOptions }) => {
|
|
51
|
-
const selectedFunctionValue = (0, import_react_ui_form2.useFormValues)([
|
|
52
|
-
"function"
|
|
53
|
-
]);
|
|
54
|
-
const selectedFunctionId = (0, import_react2.useMemo)(() => {
|
|
55
|
-
if (selectedFunctionValue instanceof import_echo_schema.RefImpl) {
|
|
56
|
-
return selectedFunctionValue.dxn.toString().split("dxn:echo:@:").at(1);
|
|
57
|
-
}
|
|
58
|
-
}, [
|
|
59
|
-
selectedFunctionValue
|
|
60
|
-
]);
|
|
61
|
-
const selectedFunction = (0, import_react2.useMemo)(() => functions.find((f) => f.id === selectedFunctionId), [
|
|
62
|
-
functions,
|
|
63
|
-
selectedFunctionId
|
|
64
|
-
]);
|
|
65
|
-
(0, import_react_ui2.useOnTransition)(
|
|
66
|
-
// Clear function parameter input when the function changes.
|
|
67
|
-
selectedFunctionValue,
|
|
68
|
-
(prevValue) => prevValue !== void 0 && prevValue !== selectedFunctionValue,
|
|
69
|
-
(currValue) => currValue !== void 0,
|
|
70
|
-
() => onValueChange("object", {})
|
|
71
|
-
);
|
|
72
|
-
const inputSchema = (0, import_react2.useMemo)(() => selectedFunction?.inputSchema, [
|
|
73
|
-
selectedFunction
|
|
74
|
-
]);
|
|
75
|
-
const effectSchema = (0, import_react2.useMemo)(() => inputSchema ? (0, import_echo_schema.toEffectSchema)(inputSchema) : void 0, [
|
|
76
|
-
inputSchema
|
|
77
|
-
]);
|
|
78
|
-
const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;
|
|
79
|
-
const values = (0, import_react2.useMemo)(() => getValue() ?? {}, [
|
|
80
|
-
getValue
|
|
81
|
-
]);
|
|
82
|
-
const handleValuesChanged = (0, import_react2.useCallback)((values2) => {
|
|
83
|
-
onValueChange("object", values2);
|
|
84
|
-
}, [
|
|
85
|
-
onValueChange
|
|
86
|
-
]);
|
|
87
|
-
if (selectedFunction === void 0 || effectSchema === void 0 || propertyCount === 0) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("h3", {
|
|
91
|
-
className: "text-md"
|
|
92
|
-
}, "Function parameters"), /* @__PURE__ */ import_react2.default.createElement(import_react_ui_form2.Form, {
|
|
93
|
-
schema: effectSchema,
|
|
94
|
-
values,
|
|
95
|
-
classNames: "p-0",
|
|
96
|
-
onValuesChanged: handleValuesChanged,
|
|
97
|
-
onQueryRefOptions
|
|
98
|
-
}));
|
|
99
|
-
};
|
|
100
|
-
var SpecSelector = (props) => {
|
|
101
|
-
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_7GXNXMSM.AUTOMATION_PLUGIN);
|
|
102
|
-
const specProps = (0, import_react_ui_form3.useInputProps)([
|
|
103
|
-
"spec"
|
|
104
|
-
]);
|
|
105
|
-
const handleTypeChange = (0, import_react3.useCallback)((_type, value) => {
|
|
106
|
-
const getDefaultTriggerSpec = (kind) => {
|
|
107
|
-
switch (kind) {
|
|
108
|
-
case import_functions2.TriggerKind.Timer:
|
|
109
|
-
return {
|
|
110
|
-
kind: import_functions2.TriggerKind.Timer,
|
|
111
|
-
cron: ""
|
|
112
|
-
};
|
|
113
|
-
case import_functions2.TriggerKind.Subscription:
|
|
114
|
-
return {
|
|
115
|
-
kind: import_functions2.TriggerKind.Subscription,
|
|
116
|
-
filter: {}
|
|
117
|
-
};
|
|
118
|
-
case import_functions2.TriggerKind.Queue:
|
|
119
|
-
return {
|
|
120
|
-
kind: import_functions2.TriggerKind.Queue,
|
|
121
|
-
queue: ""
|
|
122
|
-
};
|
|
123
|
-
case import_functions2.TriggerKind.Email:
|
|
124
|
-
return {
|
|
125
|
-
kind: import_functions2.TriggerKind.Email
|
|
126
|
-
};
|
|
127
|
-
case import_functions2.TriggerKind.Webhook:
|
|
128
|
-
return {
|
|
129
|
-
kind: import_functions2.TriggerKind.Webhook
|
|
130
|
-
};
|
|
131
|
-
default:
|
|
132
|
-
return void 0;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
const defaultSpec = getDefaultTriggerSpec(value);
|
|
136
|
-
if (!defaultSpec) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
specProps.onValueChange("object", defaultSpec);
|
|
140
|
-
}, [
|
|
141
|
-
specProps
|
|
142
|
-
]);
|
|
143
|
-
const options = (0, import_react3.useMemo)(() => Object.values(import_functions2.TriggerKind).map((kind) => ({
|
|
144
|
-
value: kind,
|
|
145
|
-
label: t(`trigger type ${kind}`)
|
|
146
|
-
})), [
|
|
147
|
-
t
|
|
148
|
-
]);
|
|
149
|
-
return /* @__PURE__ */ import_react3.default.createElement(import_react_ui_form3.SelectInput, {
|
|
150
|
-
...props,
|
|
151
|
-
options,
|
|
152
|
-
onValueChange: handleTypeChange
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
var TriggerEditor = ({ space, trigger, onSave, onCancel }) => {
|
|
156
|
-
const { t } = (0, import_react_ui.useTranslation)(import_chunk_7GXNXMSM.AUTOMATION_PLUGIN);
|
|
157
|
-
const functions = (0, import_echo2.useQuery)(space, import_echo2.Filter.type(import_functions.FunctionType));
|
|
158
|
-
const workflows = (0, import_echo2.useQuery)(space, import_echo2.Filter.type(import_conductor.ComputeGraph));
|
|
159
|
-
const scripts = (0, import_echo2.useQuery)(space, import_echo2.Filter.type(import_functions.ScriptType));
|
|
160
|
-
const handleSave = (values) => {
|
|
161
|
-
onSave?.(values);
|
|
162
|
-
};
|
|
163
|
-
const handleRefQueryLookup = (0, import_react_ui_form.useRefQueryLookupHandler)({
|
|
164
|
-
space
|
|
165
|
-
});
|
|
166
|
-
const Custom = (0, import_react.useMemo)(() => ({
|
|
167
|
-
["function"]: (props) => {
|
|
168
|
-
const getValue = (0, import_react.useCallback)(() => {
|
|
169
|
-
const formValue = props.getValue();
|
|
170
|
-
if (import_echo2.Ref.isRef(formValue)) {
|
|
171
|
-
return formValue.dxn.toString();
|
|
172
|
-
}
|
|
173
|
-
return void 0;
|
|
174
|
-
}, [
|
|
175
|
-
props
|
|
176
|
-
]);
|
|
177
|
-
const handleOnValueChange = (0, import_react.useCallback)((_type, dxnString) => {
|
|
178
|
-
const dxn = import_echo.DXN.parse(dxnString);
|
|
179
|
-
if (dxn) {
|
|
180
|
-
const ref = import_echo2.Ref.fromDXN(dxn);
|
|
181
|
-
props.onValueChange("object", ref);
|
|
182
|
-
}
|
|
183
|
-
}, [
|
|
184
|
-
props.onValueChange
|
|
185
|
-
]);
|
|
186
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react_ui_form.SelectInput, {
|
|
187
|
-
...props,
|
|
188
|
-
getValue,
|
|
189
|
-
onValueChange: handleOnValueChange,
|
|
190
|
-
options: getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))
|
|
191
|
-
});
|
|
192
|
-
},
|
|
193
|
-
["spec.kind"]: SpecSelector,
|
|
194
|
-
["input"]: (props) => /* @__PURE__ */ import_react.default.createElement(FunctionInputEditor, {
|
|
195
|
-
...props,
|
|
196
|
-
functions,
|
|
197
|
-
onQueryRefOptions: handleRefQueryLookup
|
|
198
|
-
})
|
|
199
|
-
}), [
|
|
200
|
-
workflows,
|
|
201
|
-
scripts,
|
|
202
|
-
functions,
|
|
203
|
-
t
|
|
204
|
-
]);
|
|
205
|
-
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
206
|
-
role: "none",
|
|
207
|
-
className: "bs-full is-full"
|
|
208
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_form.Form, {
|
|
209
|
-
schema: import_functions.FunctionTriggerSchema,
|
|
210
|
-
values: trigger,
|
|
211
|
-
onSave: handleSave,
|
|
212
|
-
onCancel,
|
|
213
|
-
Custom,
|
|
214
|
-
onQueryRefOptions: handleRefQueryLookup
|
|
215
|
-
}));
|
|
216
|
-
};
|
|
217
|
-
var getWorkflowOptions = (graphs) => {
|
|
218
|
-
return graphs.map((graph) => ({
|
|
219
|
-
label: `compute-${graph.id}`,
|
|
220
|
-
value: `dxn:echo:@:${graph.id}`
|
|
221
|
-
}));
|
|
222
|
-
};
|
|
223
|
-
var getFunctionOptions = (scripts, functions) => {
|
|
224
|
-
const getLabel = (fn) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
|
|
225
|
-
return functions.map((fn) => ({
|
|
226
|
-
label: getLabel(fn),
|
|
227
|
-
value: `dxn:echo:@:${fn.id}`
|
|
228
|
-
}));
|
|
229
|
-
};
|
|
230
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
231
|
-
0 && (module.exports = {
|
|
232
|
-
TriggerEditor
|
|
233
|
-
});
|
|
234
|
-
//# sourceMappingURL=chunk-S3Z4AP77.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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 } from '@dxos/echo';\nimport {\n FunctionType,\n FunctionTriggerSchema,\n type FunctionTriggerType,\n type FunctionTrigger,\n ScriptType,\n} from '@dxos/functions';\nimport { Filter, Ref, useQuery, type Space } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { type CustomInputMap, Form, SelectInput, useRefQueryLookupHandler } from '@dxos/react-ui-form';\n\nimport { FunctionInputEditor } from './FunctionInputEditor';\nimport { SpecSelector } from './SpecSelector';\nimport { AUTOMATION_PLUGIN } from '../../meta';\n\nexport type TriggerEditorProps = {\n space: Space;\n trigger: FunctionTriggerType;\n onSave?: (trigger: Omit<FunctionTrigger, 'id'>) => void;\n onCancel?: () => void;\n};\n\nexport const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEditorProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n\n const functions = useQuery(space, Filter.type(FunctionType));\n const workflows = useQuery(space, Filter.type(ComputeGraph));\n const scripts = useQuery(space, Filter.type(ScriptType));\n\n const handleSave = (values: FunctionTriggerType) => {\n onSave?.(values);\n };\n\n const handleRefQueryLookup = useRefQueryLookupHandler({ space });\n\n const Custom = useMemo(\n (): CustomInputMap => ({\n ['function' satisfies keyof FunctionTriggerType]: (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('object', ref);\n }\n },\n [props.onValueChange],\n );\n\n return (\n <SelectInput\n {...props}\n getValue={getValue as any}\n onValueChange={handleOnValueChange}\n options={getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))}\n />\n );\n },\n ['spec.kind' as const]: SpecSelector,\n ['input' as const]: (props) => (\n <FunctionInputEditor {...props} functions={functions} onQueryRefOptions={handleRefQueryLookup} />\n ),\n }),\n [workflows, scripts, functions, t],\n );\n\n return (\n <div role='none' className='bs-full is-full'>\n <Form\n schema={FunctionTriggerSchema}\n values={trigger}\n onSave={handleSave}\n onCancel={onCancel}\n Custom={Custom}\n onQueryRefOptions={handleRefQueryLookup}\n />\n </div>\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: ScriptType[], functions: FunctionType[]) => {\n const getLabel = (fn: FunctionType) => 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 React, { useCallback, useMemo } from 'react';\n\nimport { type JsonPath, RefImpl, toEffectSchema } from '@dxos/echo-schema';\nimport { type FunctionType } from '@dxos/functions';\nimport { useOnTransition } from '@dxos/react-ui';\nimport { Form, type FormInputStateProps, type QueryRefOptions, useFormValues } from '@dxos/react-ui-form';\n\nexport type FunctionInputEditorProps = {\n functions: FunctionType[];\n onQueryRefOptions: QueryRefOptions;\n} & FormInputStateProps;\n\n/**\n * Editor component for function input parameters.\n */\nexport const FunctionInputEditor = ({\n functions,\n getValue,\n onValueChange,\n onQueryRefOptions,\n}: FunctionInputEditorProps) => {\n const selectedFunctionValue = useFormValues(['function' as JsonPath]);\n const selectedFunctionId = useMemo(() => {\n if (selectedFunctionValue instanceof RefImpl) {\n return selectedFunctionValue.dxn.toString().split('dxn:echo:@:').at(1);\n }\n }, [selectedFunctionValue]);\n\n const selectedFunction = useMemo(\n () => functions.find((f) => f.id === selectedFunctionId),\n [functions, selectedFunctionId],\n );\n\n useOnTransition(\n // Clear function parameter input when the function changes.\n selectedFunctionValue,\n (prevValue) => prevValue !== undefined && prevValue !== selectedFunctionValue,\n (currValue) => currValue !== undefined,\n () => onValueChange('object', {}),\n );\n\n const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);\n const effectSchema = useMemo(() => (inputSchema ? toEffectSchema(inputSchema) : undefined), [inputSchema]);\n const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;\n\n const values = useMemo(() => getValue() ?? {}, [getValue]);\n\n const handleValuesChanged = useCallback(\n (values: any) => {\n onValueChange('object', values);\n },\n [onValueChange],\n );\n\n if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {\n return null;\n }\n\n return (\n <>\n <h3 className='text-md'>Function parameters</h3>\n {/* TODO(ZaymonFC): Try using <FormFields /> internal component for this nesting.\n This would allow errors to flow up to the root context. */}\n <Form\n schema={effectSchema}\n values={values}\n classNames='p-0'\n onValuesChanged={handleValuesChanged}\n onQueryRefOptions={onQueryRefOptions}\n />\n </>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { type FunctionTriggerType, TriggerKind, type TriggerType } from '@dxos/functions';\nimport { useTranslation } from '@dxos/react-ui';\nimport { SelectInput, type InputProps, useInputProps } from '@dxos/react-ui-form';\n\nimport { AUTOMATION_PLUGIN } from '../../meta';\n\nexport type SpecSelectorProps = InputProps;\n\nexport const SpecSelector = (props: SpecSelectorProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const specProps = useInputProps(['spec' satisfies keyof FunctionTriggerType]);\n\n const handleTypeChange = useCallback(\n (_type: any, value: string): TriggerType | undefined => {\n const getDefaultTriggerSpec = (kind: string) => {\n switch (kind) {\n case TriggerKind.Timer:\n return { kind: TriggerKind.Timer, cron: '' };\n case TriggerKind.Subscription:\n return { kind: TriggerKind.Subscription, filter: {} };\n case TriggerKind.Queue:\n return { kind: TriggerKind.Queue, queue: '' };\n case TriggerKind.Email:\n return { kind: TriggerKind.Email };\n case TriggerKind.Webhook:\n return { kind: TriggerKind.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('object', defaultSpec);\n },\n [specProps],\n );\n\n const options = useMemo(\n () =>\n Object.values(TriggerKind).map((kind) => ({\n value: kind,\n label: t(`trigger type ${kind}`),\n })),\n [t],\n );\n\n return <SelectInput {...props} options={options} onValueChange={handleTypeChange} />;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAA4C;AAE5C,uBAA6B;AAC7B,kBAAoB;AACpB,uBAMO;AACP,IAAAA,eAAkD;AAClD,sBAA+B;AAC/B,2BAAiF;ACbjF,IAAAC,gBAA4C;AAE5C,yBAAuD;AAEvD,IAAAC,mBAAgC;AAChC,IAAAC,wBAAoF;ACLpF,IAAAF,gBAA4C;AAE5C,IAAAG,oBAAwE;AACxE,IAAAF,mBAA+B;AAC/B,IAAAC,wBAA4D;ADWrD,IAAME,sBAAsB,CAAC,EAClCC,WACAC,UACAC,eACAC,kBAAiB,MACQ;AACzB,QAAMC,4BAAwBC,qCAAc;IAAC;GAAuB;AACpE,QAAMC,yBAAqBC,uBAAQ,MAAA;AACjC,QAAIH,iCAAiCI,4BAAS;AAC5C,aAAOJ,sBAAsBK,IAAIC,SAAQ,EAAGC,MAAM,aAAA,EAAeC,GAAG,CAAA;IACtE;EACF,GAAG;IAACR;GAAsB;AAE1B,QAAMS,uBAAmBN,uBACvB,MAAMP,UAAUc,KAAK,CAACC,MAAMA,EAAEC,OAAOV,kBAAAA,GACrC;IAACN;IAAWM;GAAmB;AAGjCW;;IAEEb;IACA,CAACc,cAAcA,cAAcC,UAAaD,cAAcd;IACxD,CAACgB,cAAcA,cAAcD;IAC7B,MAAMjB,cAAc,UAAU,CAAC,CAAA;EAAA;AAGjC,QAAMmB,kBAAcd,uBAAQ,MAAMM,kBAAkBQ,aAAa;IAACR;GAAiB;AACnF,QAAMS,mBAAef,uBAAQ,MAAOc,k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echo", "import_react", "import_react_ui", "import_react_ui_form", "import_functions", "FunctionInputEditor", "functions", "getValue", "onValueChange", "onQueryRefOptions", "selectedFunctionValue", "useFormValues", "selectedFunctionId", "useMemo", "RefImpl", "dxn", "toString", "split", "at", "selectedFunction", "find", "f", "id", "useOnTransition", "prevValue", "undefined", "currValue", "inputSchema", "effectSchema", "toEffectSchema", "propertyCount", "properties", "Object", "keys", "length", "values", "handleValuesChanged", "useCallback", "React", "h3", "className", "Form", "schema", "classNames", "onValuesChanged", "SpecSelector", "props", "t", "useTranslation", "AUTOMATION_PLUGIN", "specProps", "useInputProps", "handleTypeChange", "_type", "value", "getDefaultTriggerSpec", "kind", "TriggerKind", "Timer", "cron", "Subscription", "filter", "Queue", "queue", "Email", "Webhook", "defaultSpec", "options", "map", "label", "SelectInput", "TriggerEditor", "space", "trigger", "onSave", "onCancel", "useQuery", "Filter", "type", "FunctionType", "workflows", "ComputeGraph", "scripts", "ScriptType", "handleSave", "handleRefQueryLookup", "useRefQueryLookupHandler", "Custom", "formValue", "Ref", "isRef", "handleOnValueChange", "dxnString", "DXN", "parse", "ref", "fromDXN", "getWorkflowOptions", "concat", "getFunctionOptions", "div", "role", "FunctionTriggerSchema", "graphs", "graph", "getLabel", "fn", "s", "source", "target", "name"]
|
|
7
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var chunk_TI3WBQIB_exports = {};
|
|
30
|
-
__export(chunk_TI3WBQIB_exports, {
|
|
31
|
-
AutomationPanel: () => AutomationPanel,
|
|
32
|
-
AutomationPanel_default: () => AutomationPanel_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(chunk_TI3WBQIB_exports);
|
|
35
|
-
var import_chunk_S3Z4AP77 = require("./chunk-S3Z4AP77.cjs");
|
|
36
|
-
var import_chunk_7GXNXMSM = require("./chunk-7GXNXMSM.cjs");
|
|
37
|
-
var import_effect = require("effect");
|
|
38
|
-
var import_react = __toESM(require("react"));
|
|
39
|
-
var import_functions = require("@dxos/functions");
|
|
40
|
-
var import_react_client = require("@dxos/react-client");
|
|
41
|
-
var import_echo = require("@dxos/react-client/echo");
|
|
42
|
-
var import_react_ui = require("@dxos/react-ui");
|
|
43
|
-
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
44
|
-
var import_react_ui_list = require("@dxos/react-ui-list");
|
|
45
|
-
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
46
|
-
var grid = "grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]";
|
|
47
|
-
var AutomationPanel = ({ space, object, initialTrigger, onDone }) => {
|
|
48
|
-
const { t } = (0, import_react_ui.useTranslation)(import_chunk_7GXNXMSM.AUTOMATION_PLUGIN);
|
|
49
|
-
const client = (0, import_react_client.useClient)();
|
|
50
|
-
const triggers = (0, import_echo.useQuery)(space, import_echo.Filter.type(import_functions.FunctionTrigger));
|
|
51
|
-
const functions = (0, import_echo.useQuery)(space, import_echo.Filter.type(import_functions.FunctionType));
|
|
52
|
-
const scripts = (0, import_echo.useQuery)(space, import_echo.Filter.type(import_functions.ScriptType));
|
|
53
|
-
const [trigger, setTrigger] = (0, import_react.useState)(initialTrigger);
|
|
54
|
-
const [selected, setSelected] = (0, import_react.useState)();
|
|
55
|
-
const handleSelect = (trigger2) => {
|
|
56
|
-
const { id: _, ...values } = trigger2;
|
|
57
|
-
setTrigger(values);
|
|
58
|
-
setSelected(trigger2);
|
|
59
|
-
};
|
|
60
|
-
const handleAdd = () => {
|
|
61
|
-
setTrigger((0, import_echo.live)(import_functions.FunctionTriggerSchema, {}));
|
|
62
|
-
setSelected(void 0);
|
|
63
|
-
};
|
|
64
|
-
const handleDelete = (trigger2) => {
|
|
65
|
-
space.db.remove(trigger2);
|
|
66
|
-
setTrigger(void 0);
|
|
67
|
-
setSelected(void 0);
|
|
68
|
-
};
|
|
69
|
-
const handleSave = (trigger2) => {
|
|
70
|
-
if (selected) {
|
|
71
|
-
Object.assign(selected, trigger2);
|
|
72
|
-
} else {
|
|
73
|
-
space.db.add((0, import_echo.live)(import_functions.FunctionTrigger, trigger2));
|
|
74
|
-
}
|
|
75
|
-
setTrigger(void 0);
|
|
76
|
-
setSelected(void 0);
|
|
77
|
-
onDone?.();
|
|
78
|
-
};
|
|
79
|
-
const handleCancel = () => {
|
|
80
|
-
setTrigger(void 0);
|
|
81
|
-
onDone?.();
|
|
82
|
-
};
|
|
83
|
-
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
84
|
-
className: "flex flex-col w-full"
|
|
85
|
-
}, trigger ? /* @__PURE__ */ import_react.default.createElement(import_react_ui_form.ControlItem, {
|
|
86
|
-
title: t("trigger editor title")
|
|
87
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_chunk_S3Z4AP77.TriggerEditor, {
|
|
88
|
-
space,
|
|
89
|
-
trigger,
|
|
90
|
-
onSave: handleSave,
|
|
91
|
-
onCancel: handleCancel
|
|
92
|
-
})) : /* @__PURE__ */ import_react.default.createElement("div", {
|
|
93
|
-
role: "none",
|
|
94
|
-
className: import_react_ui_form.controlItemClasses
|
|
95
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_list.List.Root, {
|
|
96
|
-
items: triggers,
|
|
97
|
-
isItem: import_effect.Schema.is(import_functions.FunctionTrigger),
|
|
98
|
-
getId: (field) => field.id
|
|
99
|
-
}, ({ items: triggers2 }) => /* @__PURE__ */ import_react.default.createElement("div", {
|
|
100
|
-
role: "list",
|
|
101
|
-
className: "flex flex-col w-full"
|
|
102
|
-
}, triggers2?.map((trigger2) => {
|
|
103
|
-
const copyAction = getCopyAction(client, trigger2);
|
|
104
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react_ui_list.List.Item, {
|
|
105
|
-
key: trigger2.id,
|
|
106
|
-
item: trigger2,
|
|
107
|
-
classNames: (0, import_react_ui_theme.mx)(grid, import_react_ui_theme.ghostHover, "items-center", "px-2")
|
|
108
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.Root, null, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.Switch, {
|
|
109
|
-
checked: trigger2.enabled,
|
|
110
|
-
onCheckedChange: (checked) => trigger2.enabled = checked
|
|
111
|
-
})), /* @__PURE__ */ import_react.default.createElement("div", {
|
|
112
|
-
className: "flex"
|
|
113
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_list.List.ItemTitle, {
|
|
114
|
-
classNames: "px-1 cursor-pointer w-0 shrink truncate",
|
|
115
|
-
onClick: () => handleSelect(trigger2)
|
|
116
|
-
}, getFunctionName(scripts, functions, trigger2) ?? "\u2205"), copyAction && /* @__PURE__ */ import_react.default.createElement(import_react_ui.Clipboard.IconButton, {
|
|
117
|
-
label: t(copyAction.translationKey),
|
|
118
|
-
value: copyAction.contentProvider()
|
|
119
|
-
})), /* @__PURE__ */ import_react.default.createElement(import_react_ui_list.List.ItemDeleteButton, {
|
|
120
|
-
onClick: () => handleDelete(trigger2)
|
|
121
|
-
}));
|
|
122
|
-
}))), triggers.length > 0 && /* @__PURE__ */ import_react.default.createElement(import_react_ui.Separator, {
|
|
123
|
-
classNames: "mlb-4"
|
|
124
|
-
}), /* @__PURE__ */ import_react.default.createElement(import_react_ui.IconButton, {
|
|
125
|
-
icon: "ph--plus--regular",
|
|
126
|
-
label: t("new trigger label"),
|
|
127
|
-
onClick: handleAdd
|
|
128
|
-
})));
|
|
129
|
-
};
|
|
130
|
-
var getCopyAction = (client, trigger) => {
|
|
131
|
-
if (trigger?.spec?.kind === import_functions.TriggerKind.Email) {
|
|
132
|
-
return {
|
|
133
|
-
translationKey: "trigger copy email",
|
|
134
|
-
contentProvider: () => `${(0, import_echo.getSpace)(trigger).id}@dxos.network`
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
if (trigger?.spec?.kind === import_functions.TriggerKind.Webhook) {
|
|
138
|
-
return {
|
|
139
|
-
translationKey: "trigger copy url",
|
|
140
|
-
contentProvider: () => getWebhookUrl(client, trigger)
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
return void 0;
|
|
144
|
-
};
|
|
145
|
-
var getWebhookUrl = (client, trigger) => {
|
|
146
|
-
const spaceId = (0, import_echo.getSpace)(trigger).id;
|
|
147
|
-
const edgeUrl = new URL(client.config.values.runtime.services.edge.url);
|
|
148
|
-
const isSecure = edgeUrl.protocol.startsWith("https") || edgeUrl.protocol.startsWith("wss");
|
|
149
|
-
edgeUrl.protocol = isSecure ? "https" : "http";
|
|
150
|
-
return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();
|
|
151
|
-
};
|
|
152
|
-
var getFunctionName = (scripts, functions, trigger) => {
|
|
153
|
-
const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}\u2026`;
|
|
154
|
-
const functionObject = functions.find((fn) => fn === trigger.function?.target);
|
|
155
|
-
if (!functionObject) {
|
|
156
|
-
return shortId;
|
|
157
|
-
}
|
|
158
|
-
return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ?? shortId;
|
|
159
|
-
};
|
|
160
|
-
var AutomationPanel_default = AutomationPanel;
|
|
161
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
162
|
-
0 && (module.exports = {
|
|
163
|
-
AutomationPanel,
|
|
164
|
-
AutomationPanel_default
|
|
165
|
-
});
|
|
166
|
-
//# sourceMappingURL=chunk-TI3WBQIB.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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 { Schema } from 'effect';\nimport React, { useState } from 'react';\n\nimport {\n FunctionType,\n FunctionTrigger,\n FunctionTriggerSchema,\n TriggerKind,\n type FunctionTriggerType,\n ScriptType,\n} from '@dxos/functions';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { live, Filter, useQuery, type Space, type Live, getSpace } from '@dxos/react-client/echo';\nimport { Clipboard, IconButton, Input, Separator, 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';\n\nimport { AUTOMATION_PLUGIN } 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 = {\n space: Space;\n object?: Live<any>;\n initialTrigger?: FunctionTriggerType;\n onDone?: () => void;\n};\n\n// TODO(burdon): Factor out common layout with ViewEditor.\nexport const AutomationPanel = ({ space, object, initialTrigger, onDone }: AutomationPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const client = useClient();\n const triggers = useQuery(space, Filter.type(FunctionTrigger));\n const functions = useQuery(space, Filter.type(FunctionType));\n const scripts = useQuery(space, Filter.type(ScriptType));\n\n const [trigger, setTrigger] = useState<FunctionTriggerType | undefined>(initialTrigger);\n const [selected, setSelected] = useState<FunctionTrigger>();\n\n const handleSelect = (trigger: FunctionTrigger) => {\n const { id: _, ...values } = trigger;\n setTrigger(values);\n setSelected(trigger);\n };\n\n const handleAdd = () => {\n setTrigger(live(FunctionTriggerSchema, {}));\n setSelected(undefined);\n };\n\n const handleDelete = (trigger: FunctionTrigger) => {\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(live(FunctionTrigger, 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 return (\n <div className='flex flex-col w-full'>\n {trigger ? (\n <ControlItem title={t('trigger editor title')}>\n <TriggerEditor space={space} trigger={trigger} onSave={handleSave} onCancel={handleCancel} />\n </ControlItem>\n ) : (\n <div role='none' className={controlItemClasses}>\n <List.Root<FunctionTrigger> items={triggers} isItem={Schema.is(FunctionTrigger)} getId={(field) => field.id}>\n {({ items: triggers }) => (\n <div role='list' className='flex flex-col w-full'>\n {triggers?.map((trigger) => {\n const copyAction = getCopyAction(client, trigger);\n return (\n <List.Item<FunctionTrigger>\n key={trigger.id}\n item={trigger}\n classNames={mx(grid, ghostHover, 'items-center', 'px-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='px-1 cursor-pointer w-0 shrink truncate'\n onClick={() => handleSelect(trigger)}\n >\n {getFunctionName(scripts, 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 {triggers.length > 0 && <Separator classNames='mlb-4' />}\n <IconButton icon='ph--plus--regular' label={t('new trigger label')} onClick={handleAdd} />\n </div>\n )}\n </div>\n );\n};\n\nconst getCopyAction = (client: Client, trigger: FunctionTrigger | undefined) => {\n if (trigger?.spec?.kind === TriggerKind.Email) {\n return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };\n }\n\n if (trigger?.spec?.kind === TriggerKind.Webhook) {\n return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };\n }\n\n return undefined;\n};\n\nconst getWebhookUrl = (client: Client, trigger: FunctionTrigger) => {\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 = (scripts: ScriptType[], functions: FunctionType[], trigger: FunctionTriggerType) => {\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 if (!functionObject) {\n return shortId;\n }\n\n return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ?? shortId;\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,oBAAuB;AACvB,mBAAgC;AAEhC,uBAOO;AACP,0BAAuC;AACvC,kBAAwE;AACxE,sBAAwE;AACxE,2BAAgD;AAChD,2BAAqB;AACrB,4BAA+B;AAK/B,IAAMA,OAAO;AAUN,IAAMC,kBAAkB,CAAC,EAAEC,OAAOC,QAAQC,gBAAgBC,OAAM,MAAwB;AAC7F,QAAM,EAAEC,EAAC,QAAKC,gCAAeC,uCAAAA;AAC7B,QAAMC,aAASC,+BAAAA;AACf,QAAMC,eAAWC,sBAASV,OAAOW,mBAAOC,KAAKC,gCAAAA,CAAAA;AAC7C,QAAMC,gBAAYJ,sBAASV,OAAOW,mBAAOC,KAAKG,6BAAAA,CAAAA;AAC9C,QAAMC,cAAUN,sBAASV,OAAOW,mBAAOC,KAAKK,2BAAAA,CAAAA;AAE5C,QAAM,CAACC,SAASC,UAAAA,QAAcC,uBAA0ClB,cAAAA;AACxE,QAAM,CAACmB,UAAUC,WAAAA,QAAeF,uBAAAA;AAEhC,QAAMG,eAAe,CAACL,aAAAA;AACpB,UAAM,EAAEM,IAAIC,GAAG,GAAGC,OAAAA,IAAWR;AAC7BC,eAAWO,MAAAA;AACXJ,gBAAYJ,QAAAA;EACd;AAEA,QAAMS,YAAY,MAAA;AAChBR,mBAAWS,kBAAKC,wCAAuB,CAAC,CAAA,CAAA;AACxCP,gBAAYQ,MAAAA;EACd;AAEA,QAAMC,eAAe,CAACb,aAAAA;AACpBlB,UAAMgC,GAAGC,OAAOf,QAAAA;AACh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,UAAU;AACxC,SAAO,IAAIN,IAAI,YAAYF,OAAAA,IAAWzE,QAAQM,EAAE,IAAIoE,OAAAA,EAASU,SAAQ;AACvE;AAEA,IAAM7B,kBAAkB,CAACzD,SAAuBF,WAA2BI,YAAAA;AAGzE,QAAMqF,UAAUrF,QAAQsF,YAAY,GAAGtF,QAAQsF,SAASC,IAAIH,SAAQ,EAAGI,MAAM,GAAG,EAAA,CAAA;AAChF,QAAMC,iBAAiB7F,UAAU8F,KAAK,CAACC,OAAOA,OAAO3F,QAAQsF,UAAUM,MAAAA;AACvE,MAAI,CAACH,gBAAgB;AACnB,WAAOJ;EACT;AAEA,SAAOvF,QAAQ4F,KAAK,CAACG,MAAMJ,eAAeK,QAAQF,QAAQtF,OAAOuF,EAAEvF,EAAE,GAAGyF,QAAQV;AAClF;AC/JA,IAAA,0BAAexG;",
|
|
6
|
-
"names": ["grid", "AutomationPanel", "space", "object", "initialTrigger", "onDone", "t", "useTranslation", "AUTOMATION_PLUGIN", "client", "useClient", "triggers", "useQuery", "Filter", "type", "FunctionTrigger", "functions", "FunctionType", "scripts", "ScriptType", "trigger", "setTrigger", "useState", "selected", "setSelected", "handleSelect", "id", "_", "values", "handleAdd", "live", "FunctionTriggerSchema", "undefined", "handleDelete", "db", "remove", "handleSave", "Object", "assign", "add", "handleCancel", "React", "div", "className", "ControlItem", "title", "TriggerEditor", "onSave", "onCancel", "role", "controlItemClasses", "List", "Root", "items", "isItem", "Schema", "is", "getId", "field", "map", "copyAction", "getCopyAction", "Item", "key", "item", "classNames", "mx", "ghostHover", "Input", "Switch", "checked", "enabled", "onCheckedChange", "ItemTitle", "onClick", "getFunctionName", "Clipboard", "IconButton", "label", "translationKey", "value", "contentProvider", "ItemDeleteButton", "length", "Separator", "icon", "spec", "kind", "TriggerKind", "Email", "getSpace", "Webhook", "getWebhookUrl", "spaceId", "edgeUrl", "URL", "config", "runtime", "services", "edge", "url", "isSecure", "protocol", "startsWith", "toString", "shortId", "function", "dxn", "slice", "functionObject", "find", "fn", "target", "s", "source", "name"]
|
|
7
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
AutomationPanel
|
|
4
|
-
} from "./chunk-DIUPZXCQ.mjs";
|
|
5
|
-
import "./chunk-DZ7RKC52.mjs";
|
|
6
|
-
import {
|
|
7
|
-
AUTOMATION_PLUGIN
|
|
8
|
-
} from "./chunk-DZ44LGYT.mjs";
|
|
9
|
-
|
|
10
|
-
// packages/plugins/plugin-automation/src/components/AutomationContainer.tsx
|
|
11
|
-
import React from "react";
|
|
12
|
-
import { useTranslation } from "@dxos/react-ui";
|
|
13
|
-
import { ControlSection, ControlPage } from "@dxos/react-ui-form";
|
|
14
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
15
|
-
var AutomationContainer = ({ space }) => {
|
|
16
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
17
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
18
|
-
classNames: "block overflow-y-auto"
|
|
19
|
-
}, /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
|
|
20
|
-
title: t("automation verbose label", {
|
|
21
|
-
ns: AUTOMATION_PLUGIN
|
|
22
|
-
}),
|
|
23
|
-
description: t("automation description", {
|
|
24
|
-
ns: AUTOMATION_PLUGIN
|
|
25
|
-
})
|
|
26
|
-
}, /* @__PURE__ */ React.createElement(AutomationPanel, {
|
|
27
|
-
space
|
|
28
|
-
}))));
|
|
29
|
-
};
|
|
30
|
-
var AutomationContainer_default = AutomationContainer;
|
|
31
|
-
export {
|
|
32
|
-
AutomationContainer,
|
|
33
|
-
AutomationContainer_default as default
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=AutomationContainer-OP43F4PD.mjs.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
FunctionsPanel
|
|
4
|
-
} from "./chunk-AD4C4IK2.mjs";
|
|
5
|
-
import {
|
|
6
|
-
AUTOMATION_PLUGIN
|
|
7
|
-
} from "./chunk-DZ44LGYT.mjs";
|
|
8
|
-
|
|
9
|
-
// packages/plugins/plugin-automation/src/components/FunctionsContainer.tsx
|
|
10
|
-
import React from "react";
|
|
11
|
-
import { useTranslation } from "@dxos/react-ui";
|
|
12
|
-
import { ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
13
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
14
|
-
var FunctionsContainer = ({ space }) => {
|
|
15
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
16
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
17
|
-
classNames: "block overflow-y-auto"
|
|
18
|
-
}, /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
|
|
19
|
-
title: t("functions verbose label", {
|
|
20
|
-
ns: AUTOMATION_PLUGIN
|
|
21
|
-
}),
|
|
22
|
-
description: t("functions description", {
|
|
23
|
-
ns: AUTOMATION_PLUGIN
|
|
24
|
-
})
|
|
25
|
-
}, /* @__PURE__ */ React.createElement(FunctionsPanel, {
|
|
26
|
-
space
|
|
27
|
-
}))));
|
|
28
|
-
};
|
|
29
|
-
var FunctionsContainer_default = FunctionsContainer;
|
|
30
|
-
export {
|
|
31
|
-
FunctionsContainer,
|
|
32
|
-
FunctionsContainer_default as default
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=FunctionsContainer-5TVRDIX5.mjs.map
|