@dxos/plugin-automation 0.8.1-main.ba2dec9 → 0.8.1-staging.31c3ee1
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-KNXI72FK.mjs → AutomationPanel-YAHFXQX6.mjs} +27 -20
- package/dist/lib/browser/AutomationPanel-YAHFXQX6.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-K3BIQFWW.mjs +40 -0
- package/dist/lib/browser/app-graph-builder-K3BIQFWW.mjs.map +7 -0
- package/dist/lib/browser/chunk-FALBBJNO.mjs +138 -0
- package/dist/lib/browser/chunk-FALBBJNO.mjs.map +7 -0
- package/dist/lib/browser/chunk-MT3FZH4V.mjs +8 -0
- package/dist/lib/browser/{chunk-OFDNNRLE.mjs → chunk-WKKQV4PC.mjs} +2 -2
- package/dist/lib/browser/chunk-WKKQV4PC.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +32 -17
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-4QQSJR4A.mjs +42 -0
- package/dist/lib/browser/react-surface-4QQSJR4A.mjs.map +7 -0
- package/dist/lib/node/{AutomationPanel-SVNHL4NI.cjs → AutomationPanel-ZKAMIU6O.cjs} +28 -21
- package/dist/lib/node/AutomationPanel-ZKAMIU6O.cjs.map +7 -0
- package/dist/lib/node/app-graph-builder-HO4FPGZ5.cjs +56 -0
- package/dist/lib/node/app-graph-builder-HO4FPGZ5.cjs.map +7 -0
- package/dist/lib/node/{chunk-ORMEYEBE.cjs → chunk-7GXNXMSM.cjs} +4 -4
- package/dist/lib/node/chunk-7GXNXMSM.cjs.map +7 -0
- package/dist/lib/node/{chunk-Z7QSJQ4S.cjs → chunk-AGJ6XTDN.cjs} +5 -5
- package/dist/lib/node/chunk-FTEDH5Q6.cjs +167 -0
- package/dist/lib/node/chunk-FTEDH5Q6.cjs.map +7 -0
- package/dist/lib/node/index.cjs +37 -22
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-O6QXBWRG.cjs → react-surface-52M54VWV.cjs} +28 -13
- package/dist/lib/node/react-surface-52M54VWV.cjs.map +7 -0
- package/dist/lib/node-esm/{AutomationPanel-YP556U5O.mjs → AutomationPanel-XF7YPSKM.mjs} +27 -20
- package/dist/lib/node-esm/AutomationPanel-XF7YPSKM.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-XCJR33VS.mjs +41 -0
- package/dist/lib/node-esm/app-graph-builder-XCJR33VS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-6MUUH67V.mjs → chunk-DZ44LGYT.mjs} +2 -2
- package/dist/lib/node-esm/chunk-DZ44LGYT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-M4QXMIIB.mjs +139 -0
- package/dist/lib/node-esm/chunk-M4QXMIIB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OA75PSGH.mjs +10 -0
- package/dist/lib/node-esm/index.mjs +32 -17
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-MGKM3OO3.mjs +43 -0
- package/dist/lib/node-esm/react-surface-MGKM3OO3.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +177 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -7
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +5 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +24 -20
- package/src/AutomationPlugin.tsx +14 -5
- package/src/capabilities/app-graph-builder.ts +31 -0
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/react-surface.tsx +22 -7
- package/src/components/AutomationPanel/AutomationPanel.tsx +59 -55
- package/src/components/TriggerEditor/TriggerEditor.tsx +89 -80
- package/src/meta.ts +2 -2
- package/src/translations.ts +6 -4
- package/dist/lib/browser/AutomationPanel-KNXI72FK.mjs.map +0 -7
- package/dist/lib/browser/chunk-HRHRMTAE.mjs +0 -8
- package/dist/lib/browser/chunk-NZZED7GX.mjs +0 -119
- package/dist/lib/browser/chunk-NZZED7GX.mjs.map +0 -7
- package/dist/lib/browser/chunk-OFDNNRLE.mjs.map +0 -7
- package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs +0 -56
- package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs.map +0 -7
- package/dist/lib/browser/react-surface-KZ3CT4BI.mjs +0 -27
- package/dist/lib/browser/react-surface-KZ3CT4BI.mjs.map +0 -7
- package/dist/lib/node/AutomationPanel-SVNHL4NI.cjs.map +0 -7
- package/dist/lib/node/chunk-ORMEYEBE.cjs.map +0 -7
- package/dist/lib/node/chunk-TTISAT2O.cjs +0 -148
- package/dist/lib/node/chunk-TTISAT2O.cjs.map +0 -7
- package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs +0 -72
- package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs.map +0 -7
- package/dist/lib/node/react-surface-O6QXBWRG.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-YP556U5O.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5A5YUVH2.mjs +0 -10
- package/dist/lib/node-esm/chunk-6MUUH67V.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-I2V2NGYF.mjs +0 -120
- package/dist/lib/node-esm/chunk-I2V2NGYF.mjs.map +0 -7
- package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs +0 -57
- package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-F4NLSDP6.mjs +0 -28
- package/dist/lib/node-esm/react-surface-F4NLSDP6.mjs.map +0 -7
- package/dist/types/src/capabilities/complementary-panel.d.ts +0 -4
- package/dist/types/src/capabilities/complementary-panel.d.ts.map +0 -1
- package/src/capabilities/complementary-panel.ts +0 -56
- /package/dist/lib/browser/{chunk-HRHRMTAE.mjs.map → chunk-MT3FZH4V.mjs.map} +0 -0
- /package/dist/lib/node/{chunk-Z7QSJQ4S.cjs.map → chunk-AGJ6XTDN.cjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-5A5YUVH2.mjs.map → chunk-OA75PSGH.mjs.map} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AutomationPanel
|
|
3
|
+
} from "./chunk-MT3FZH4V.mjs";
|
|
4
|
+
import "./chunk-FALBBJNO.mjs";
|
|
5
|
+
import {
|
|
6
|
+
meta
|
|
7
|
+
} from "./chunk-WKKQV4PC.mjs";
|
|
8
|
+
|
|
9
|
+
// packages/plugins/plugin-automation/src/capabilities/react-surface.tsx
|
|
10
|
+
import React from "react";
|
|
11
|
+
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
12
|
+
import { isInstanceOf } from "@dxos/echo-schema";
|
|
13
|
+
import { ScriptType } from "@dxos/functions/types";
|
|
14
|
+
import { getSpace, isSpace } from "@dxos/react-client/echo";
|
|
15
|
+
import { StackItem } from "@dxos/react-ui-stack";
|
|
16
|
+
var react_surface_default = () => contributes(Capabilities.ReactSurface, [
|
|
17
|
+
createSurface({
|
|
18
|
+
id: `${meta.id}/automation`,
|
|
19
|
+
role: "space-settings--automation",
|
|
20
|
+
filter: (data) => isSpace(data.subject),
|
|
21
|
+
component: ({ data }) => /* @__PURE__ */ React.createElement(AutomationPanel, {
|
|
22
|
+
space: data.subject
|
|
23
|
+
})
|
|
24
|
+
}),
|
|
25
|
+
createSurface({
|
|
26
|
+
id: `${meta.id}/companion/automation`,
|
|
27
|
+
role: "article",
|
|
28
|
+
filter: (data) => isInstanceOf(ScriptType, data.companionTo) && data.subject === "automation",
|
|
29
|
+
component: ({ data, role }) => {
|
|
30
|
+
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
31
|
+
role
|
|
32
|
+
}, /* @__PURE__ */ React.createElement(AutomationPanel, {
|
|
33
|
+
space: getSpace(data.companionTo),
|
|
34
|
+
object: data.companionTo
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
]);
|
|
39
|
+
export {
|
|
40
|
+
react_surface_default as default
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=react-surface-4QQSJR4A.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { ScriptType } from '@dxos/functions/types';\nimport { getSpace, isSpace, type Space } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { AutomationPanel } from '../components';\nimport { meta } from '../meta';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${meta.id}/automation`,\n role: 'space-settings--automation',\n filter: (data): data is { subject: Space } => isSpace(data.subject),\n component: ({ data }) => <AutomationPanel space={data.subject} />,\n }),\n createSurface({\n id: `${meta.id}/companion/automation`,\n role: 'article',\n filter: (data): data is { companionTo: ScriptType; subject: 'automation' } =>\n isInstanceOf(ScriptType, data.companionTo) && data.subject === 'automation',\n component: ({ data, role }) => {\n return (\n <StackItem.Content role={role}>\n <AutomationPanel space={getSpace(data.companionTo)!} object={data.companionTo} />\n </StackItem.Content>\n );\n },\n }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,oBAAoB;AAC7B,SAASC,kBAAkB;AAC3B,SAASC,UAAUC,eAA2B;AAC9C,SAASC,iBAAiB;AAK1B,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAqCC,QAAQD,KAAKE,OAAO;IAClEC,WAAW,CAAC,EAAEH,KAAI,MAAO,sBAAA,cAACI,iBAAAA;MAAgBC,OAAOL,KAAKE;;EACxD,CAAA;EACAP,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SACPM,aAAaC,YAAYP,KAAKQ,WAAW,KAAKR,KAAKE,YAAY;IACjEC,WAAW,CAAC,EAAEH,MAAMF,KAAI,MAAE;AACxB,aACE,sBAAA,cAACW,UAAUC,SAAO;QAACZ;SACjB,sBAAA,cAACM,iBAAAA;QAAgBC,OAAOM,SAASX,KAAKQ,WAAW;QAAII,QAAQZ,KAAKQ;;IAGxE;EACF,CAAA;CACD;",
|
|
6
|
+
"names": ["React", "Capabilities", "contributes", "createSurface", "isInstanceOf", "ScriptType", "getSpace", "isSpace", "StackItem", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "isSpace", "subject", "component", "AutomationPanel", "space", "isInstanceOf", "ScriptType", "companionTo", "StackItem", "Content", "getSpace", "object"]
|
|
7
|
+
}
|
|
@@ -26,24 +26,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var AutomationPanel_ZKAMIU6O_exports = {};
|
|
30
|
+
__export(AutomationPanel_ZKAMIU6O_exports, {
|
|
31
31
|
default: () => AutomationPanel_default
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
35
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(AutomationPanel_ZKAMIU6O_exports);
|
|
34
|
+
var import_chunk_FTEDH5Q6 = require("./chunk-FTEDH5Q6.cjs");
|
|
35
|
+
var import_chunk_7GXNXMSM = require("./chunk-7GXNXMSM.cjs");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
38
38
|
var import_types = require("@dxos/functions/types");
|
|
39
39
|
var import_react_client = require("@dxos/react-client");
|
|
40
40
|
var import_echo = require("@dxos/react-client/echo");
|
|
41
41
|
var import_react_ui = require("@dxos/react-ui");
|
|
42
|
+
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
42
43
|
var import_react_ui_list = require("@dxos/react-ui-list");
|
|
44
|
+
var import_react_ui_stack = require("@dxos/react-ui-stack");
|
|
43
45
|
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
44
46
|
var grid = "grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]";
|
|
45
47
|
var AutomationPanel = ({ space, object }) => {
|
|
46
|
-
const { t } = (0, import_react_ui.useTranslation)(
|
|
48
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_7GXNXMSM.AUTOMATION_PLUGIN);
|
|
47
49
|
const client = (0, import_react_client.useClient)();
|
|
48
50
|
const triggers = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_types.FunctionTrigger));
|
|
49
51
|
const functions = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_types.FunctionType));
|
|
@@ -56,9 +58,7 @@ var AutomationPanel = ({ space, object }) => {
|
|
|
56
58
|
setSelected(trigger2);
|
|
57
59
|
};
|
|
58
60
|
const handleAdd = () => {
|
|
59
|
-
setTrigger((0, import_echo.create)(import_types.FunctionTriggerSchema, {
|
|
60
|
-
meta: {}
|
|
61
|
-
}));
|
|
61
|
+
setTrigger((0, import_echo.create)(import_types.FunctionTriggerSchema, {}));
|
|
62
62
|
setSelected(void 0);
|
|
63
63
|
};
|
|
64
64
|
const handleDelete = (trigger2) => {
|
|
@@ -78,9 +78,21 @@ var AutomationPanel = ({ space, object }) => {
|
|
|
78
78
|
const handleCancel = () => {
|
|
79
79
|
setTrigger(void 0);
|
|
80
80
|
};
|
|
81
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react_ui.Clipboard.Provider, null, /* @__PURE__ */ import_react.default.createElement(
|
|
81
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react_ui.Clipboard.Provider, null, /* @__PURE__ */ import_react.default.createElement(import_react_ui_stack.StackItem.Content, {
|
|
82
|
+
classNames: "block overflow-y-auto"
|
|
83
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
82
84
|
className: "flex flex-col w-full"
|
|
83
|
-
},
|
|
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_FTEDH5Q6.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, {
|
|
84
96
|
items: triggers,
|
|
85
97
|
isItem: import_echo_schema.S.is(import_types.FunctionTrigger),
|
|
86
98
|
getId: (field) => field.id
|
|
@@ -107,18 +119,13 @@ var AutomationPanel = ({ space, object }) => {
|
|
|
107
119
|
})), /* @__PURE__ */ import_react.default.createElement(import_react_ui_list.List.ItemDeleteButton, {
|
|
108
120
|
onClick: () => handleDelete(trigger2)
|
|
109
121
|
}));
|
|
110
|
-
}))),
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
onSave: handleSave,
|
|
114
|
-
onCancel: handleCancel
|
|
115
|
-
}), !trigger && /* @__PURE__ */ import_react.default.createElement("div", {
|
|
116
|
-
className: "flex p-2 justify-center"
|
|
117
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui.IconButton, {
|
|
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, {
|
|
118
125
|
icon: "ph--plus--regular",
|
|
119
126
|
label: t("new trigger label"),
|
|
120
127
|
onClick: handleAdd
|
|
121
|
-
}))));
|
|
128
|
+
})))));
|
|
122
129
|
};
|
|
123
130
|
var getCopyAction = (client, trigger) => {
|
|
124
131
|
if (trigger?.spec?.type === import_types.TriggerKind.Email) {
|
|
@@ -151,4 +158,4 @@ var getFunctionName = (scripts, functions, trigger) => {
|
|
|
151
158
|
return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ?? shortId;
|
|
152
159
|
};
|
|
153
160
|
var AutomationPanel_default = AutomationPanel;
|
|
154
|
-
//# sourceMappingURL=AutomationPanel-
|
|
161
|
+
//# sourceMappingURL=AutomationPanel-ZKAMIU6O.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/AutomationPanel/AutomationPanel.tsx", "../../../src/components/AutomationPanel/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { S } from '@dxos/echo-schema';\nimport {\n FunctionType,\n FunctionTrigger,\n FunctionTriggerSchema,\n TriggerKind,\n type FunctionTriggerType,\n ScriptType,\n} from '@dxos/functions/types';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { create, Filter, useQuery, type Space, type ReactiveObject, 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 { StackItem } from '@dxos/react-ui-stack';\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?: ReactiveObject<any>;\n};\n\n// TODO(burdon): Factor out common layout with ViewEditor.\nexport const AutomationPanel = ({ space, object }: AutomationPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const client = useClient();\n const triggers = useQuery(space, Filter.schema(FunctionTrigger));\n const functions = useQuery(space, Filter.schema(FunctionType));\n const scripts = useQuery(space, Filter.schema(ScriptType));\n\n const [trigger, setTrigger] = useState<FunctionTriggerType>();\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(create(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(create(FunctionTrigger, trigger));\n }\n\n setTrigger(undefined);\n setSelected(undefined);\n };\n\n const handleCancel: TriggerEditorProps['onCancel'] = () => {\n setTrigger(undefined);\n };\n\n return (\n <Clipboard.Provider>\n <StackItem.Content classNames='block overflow-y-auto'>\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={S.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 </StackItem.Content>\n </Clipboard.Provider>\n );\n};\n\nconst getCopyAction = (client: Client, trigger: FunctionTrigger | undefined) => {\n if (trigger?.spec?.type === TriggerKind.Email) {\n return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };\n }\n\n if (trigger?.spec?.type === 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?.slice(0, 16)}…`;\n const functionObject = functions.find((fn) => `dxn:worker:${fn.name}` === trigger.function);\n if (!functionObject) {\n return shortId;\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 default AutomationPanel;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAgC;AAEhC,yBAAkB;AAClB,mBAOO;AACP,0BAAuC;AACvC,kBAAoF;AACpF,sBAAwE;AACxE,2BAAgD;AAChD,2BAAqB;AACrB,4BAA0B;AAC1B,4BAA+B;AAK/B,IAAMA,OAAO;AAQN,IAAMC,kBAAkB,CAAC,EAAEC,OAAOC,OAAM,MAAwB;AACrE,QAAM,EAAEC,EAAC,QAAKC,gCAAeC,uCAAAA;AAC7B,QAAMC,aAASC,+BAAAA;AACf,QAAMC,eAAWC,sBAASR,OAAOS,mBAAOC,OAAOC,4BAAAA,CAAAA;AAC/C,QAAMC,gBAAYJ,sBAASR,OAAOS,mBAAOC,OAAOG,yBAAAA,CAAAA;AAChD,QAAMC,cAAUN,sBAASR,OAAOS,mBAAOC,OAAOK,uBAAAA,CAAAA;AAE9C,QAAM,CAACC,SAASC,UAAAA,QAAcC,uBAAAA;AAC9B,QAAM,CAACC,UAAUC,WAAAA,QAAeF,uBAAAA;AAEhC,QAAMG,eAAe,CAACL,aAAAA;AAC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BE,iBAAiB,MAAMW,cAActF,QAAQW,OAAAA;IAAS;EACrG;AAEA,SAAOY;AACT;AAEA,IAAM+D,gBAAgB,CAACtF,QAAgBW,YAAAA;AACrC,QAAM4E,cAAUH,sBAASzE,OAAAA,EAAUM;AACnC,QAAMuE,UAAU,IAAIC,IAAIzF,OAAO0F,OAAOvE,OAAOwE,QAASC,SAAUC,KAAMC,GAAG;AACzE,QAAMC,WAAWP,QAAQQ,SAASC,WAAW,OAAA,KAAYT,QAAQQ,SAASC,WAAW,KAAA;AACrFT,UAAQQ,WAAWD,WAAW,UAAU;AACxC,SAAO,IAAIN,IAAI,YAAYF,OAAAA,IAAW5E,QAAQM,EAAE,IAAIuE,OAAAA,EAASU,SAAQ;AACvE;AAEA,IAAM5B,kBAAkB,CAAC7D,SAAuBF,WAA2BI,YAAAA;AAGzE,QAAMwF,UAAUxF,QAAQyF,YAAY,GAAGzF,QAAQyF,UAAUC,MAAM,GAAG,EAAA,CAAA;AAClE,QAAMC,iBAAiB/F,UAAUgG,KAAK,CAACC,OAAO,cAAcA,GAAGC,IAAI,OAAO9F,QAAQyF,QAAQ;AAC1F,MAAI,CAACE,gBAAgB;AACnB,WAAOH;EACT;AACA,SAAO1F,QAAQ8F,KAAK,CAACG,MAAMJ,eAAeK,QAAQC,QAAQ3F,OAAOyF,EAAEzF,EAAE,GAAGwF,QAAQN;AAClF;ACjKA,IAAA,0BAAezG;",
|
|
6
|
+
"names": ["grid", "AutomationPanel", "space", "object", "t", "useTranslation", "AUTOMATION_PLUGIN", "client", "useClient", "triggers", "useQuery", "Filter", "schema", "FunctionTrigger", "functions", "FunctionType", "scripts", "ScriptType", "trigger", "setTrigger", "useState", "selected", "setSelected", "handleSelect", "id", "_", "values", "handleAdd", "create", "FunctionTriggerSchema", "undefined", "handleDelete", "db", "remove", "handleSave", "Object", "assign", "add", "handleCancel", "React", "Clipboard", "Provider", "StackItem", "Content", "classNames", "div", "className", "ControlItem", "title", "TriggerEditor", "onSave", "onCancel", "role", "controlItemClasses", "List", "Root", "items", "isItem", "S", "is", "getId", "field", "map", "copyAction", "getCopyAction", "Item", "key", "item", "mx", "ghostHover", "Input", "Switch", "checked", "enabled", "onCheckedChange", "ItemTitle", "onClick", "getFunctionName", "IconButton", "label", "translationKey", "value", "contentProvider", "ItemDeleteButton", "length", "Separator", "icon", "spec", "type", "TriggerKind", "Email", "getSpace", "Webhook", "getWebhookUrl", "spaceId", "edgeUrl", "URL", "config", "runtime", "services", "edge", "url", "isSecure", "protocol", "startsWith", "toString", "shortId", "function", "slice", "functionObject", "find", "fn", "name", "s", "source", "target"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var app_graph_builder_HO4FPGZ5_exports = {};
|
|
20
|
+
__export(app_graph_builder_HO4FPGZ5_exports, {
|
|
21
|
+
default: () => app_graph_builder_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(app_graph_builder_HO4FPGZ5_exports);
|
|
24
|
+
var import_chunk_7GXNXMSM = require("./chunk-7GXNXMSM.cjs");
|
|
25
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
26
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
27
|
+
var import_functions = require("@dxos/functions");
|
|
28
|
+
var import_types = require("@dxos/plugin-deck/types");
|
|
29
|
+
var import_plugin_graph = require("@dxos/plugin-graph");
|
|
30
|
+
var import_types2 = require("@dxos/plugin-script/types");
|
|
31
|
+
var app_graph_builder_default = (context) => (0, import_app_framework.contributes)(import_app_framework.Capabilities.AppGraphBuilder, [
|
|
32
|
+
(0, import_plugin_graph.createExtension)({
|
|
33
|
+
id: `${import_types2.SCRIPT_PLUGIN}/script-companion`,
|
|
34
|
+
filter: (node) => (0, import_echo_schema.isInstanceOf)(import_functions.ScriptType, node.data),
|
|
35
|
+
connector: ({ node }) => [
|
|
36
|
+
{
|
|
37
|
+
id: [
|
|
38
|
+
node.id,
|
|
39
|
+
"automation"
|
|
40
|
+
].join(import_types.ATTENDABLE_PATH_SEPARATOR),
|
|
41
|
+
type: import_types.PLANK_COMPANION_TYPE,
|
|
42
|
+
data: "automation",
|
|
43
|
+
properties: {
|
|
44
|
+
label: [
|
|
45
|
+
"script automation label",
|
|
46
|
+
{
|
|
47
|
+
ns: import_chunk_7GXNXMSM.meta.id
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
icon: "ph--lightning--regular"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
]);
|
|
56
|
+
//# sourceMappingURL=app-graph-builder-HO4FPGZ5.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { ScriptType } from '@dxos/functions';\nimport { PLANK_COMPANION_TYPE, ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\nimport { SCRIPT_PLUGIN } from '@dxos/plugin-script/types';\n\nimport { meta } from '../meta';\n\nexport default (context: PluginsContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${SCRIPT_PLUGIN}/script-companion`,\n filter: (node): node is Node<ScriptType> => isInstanceOf(ScriptType, node.data),\n connector: ({ node }) => [\n {\n id: [node.id, 'automation'].join(ATTENDABLE_PATH_SEPARATOR),\n type: PLANK_COMPANION_TYPE,\n data: 'automation',\n properties: {\n label: ['script automation label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n },\n },\n ],\n }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAA+D;AAC/D,yBAA6B;AAC7B,uBAA2B;AAC3B,mBAAgE;AAChE,0BAA2C;AAC3C,IAAAA,gBAA8B;AAI9B,IAAA,4BAAe,CAACC,gBACdC,kCAAYC,kCAAaC,iBAAiB;MACxCC,qCAAgB;IACdC,IAAI,GAAGC,2BAAAA;IACPC,QAAQ,CAACC,aAAmCC,iCAAaC,6BAAYF,KAAKG,IAAI;IAC9EC,WAAW,CAAC,EAAEJ,KAAI,MAAO;MACvB;QACEH,IAAI;UAACG,KAAKH;UAAI;UAAcQ,KAAKC,sCAAAA;QACjCC,MAAMC;QACNL,MAAM;QACNM,YAAY;UACVC,OAAO;YAAC;YAA2B;cAAEC,IAAIC,2BAAKf;YAAG;;UACjDgB,MAAM;QACR;MACF;;EAEJ,CAAA;CACD;",
|
|
6
|
+
"names": ["import_types", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "SCRIPT_PLUGIN", "filter", "node", "isInstanceOf", "ScriptType", "data", "connector", "join", "ATTENDABLE_PATH_SEPARATOR", "type", "PLANK_COMPANION_TYPE", "properties", "label", "ns", "meta", "icon"]
|
|
7
|
+
}
|
|
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_7GXNXMSM_exports = {};
|
|
20
|
+
__export(chunk_7GXNXMSM_exports, {
|
|
21
21
|
AUTOMATION_PLUGIN: () => AUTOMATION_PLUGIN,
|
|
22
22
|
meta: () => meta
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(chunk_7GXNXMSM_exports);
|
|
25
25
|
var AUTOMATION_PLUGIN = "dxos.org/plugin/automation";
|
|
26
26
|
var meta = {
|
|
27
27
|
id: AUTOMATION_PLUGIN,
|
|
@@ -35,4 +35,4 @@ var meta = {
|
|
|
35
35
|
AUTOMATION_PLUGIN,
|
|
36
36
|
meta
|
|
37
37
|
});
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-7GXNXMSM.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const AUTOMATION_PLUGIN = 'dxos.org/plugin/automation';\n\nexport const meta: PluginMeta = {\n id: AUTOMATION_PLUGIN,\n name: 'Automation',\n description:\n 'The Automation tab allows you to trigger pre-defined workflows related to the element you are interacting with inside of Composer.',\n icon: 'ph--robot--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-automation',\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAMA,oBAAoB;AAE1B,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,aACE;EACFC,MAAM;EACNC,QAAQ;AACV;",
|
|
6
|
+
"names": ["AUTOMATION_PLUGIN", "meta", "id", "name", "description", "icon", "source"]
|
|
7
|
+
}
|
|
@@ -26,15 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_AGJ6XTDN_exports = {};
|
|
30
|
+
__export(chunk_AGJ6XTDN_exports, {
|
|
31
31
|
AutomationPanel: () => AutomationPanel
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_AGJ6XTDN_exports);
|
|
34
34
|
var import_react = require("react");
|
|
35
|
-
var AutomationPanel = (0, import_react.lazy)(() => import("./AutomationPanel-
|
|
35
|
+
var AutomationPanel = (0, import_react.lazy)(() => import("./AutomationPanel-ZKAMIU6O.cjs"));
|
|
36
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
37
|
0 && (module.exports = {
|
|
38
38
|
AutomationPanel
|
|
39
39
|
});
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-AGJ6XTDN.cjs.map
|
|
@@ -0,0 +1,167 @@
|
|
|
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_FTEDH5Q6_exports = {};
|
|
30
|
+
__export(chunk_FTEDH5Q6_exports, {
|
|
31
|
+
TriggerEditor: () => TriggerEditor
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(chunk_FTEDH5Q6_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_types = require("@dxos/functions/types");
|
|
38
|
+
var import_echo = require("@dxos/react-client/echo");
|
|
39
|
+
var import_react_ui = require("@dxos/react-ui");
|
|
40
|
+
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
41
|
+
var PayloadInput = (props) => {
|
|
42
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_7GXNXMSM.AUTOMATION_PLUGIN);
|
|
43
|
+
const inputProps = (0, import_react_ui_form.useInputProps)([
|
|
44
|
+
"meta",
|
|
45
|
+
props.property
|
|
46
|
+
]);
|
|
47
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
48
|
+
role: "none",
|
|
49
|
+
className: "flex items-center mt-2 gap-1"
|
|
50
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
51
|
+
role: "none",
|
|
52
|
+
className: "flex-1"
|
|
53
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_form.TextInput, {
|
|
54
|
+
...inputProps,
|
|
55
|
+
type: "string",
|
|
56
|
+
label: props.property
|
|
57
|
+
})), /* @__PURE__ */ import_react.default.createElement(import_react_ui.IconButton, {
|
|
58
|
+
icon: "ph--trash--regular",
|
|
59
|
+
iconOnly: true,
|
|
60
|
+
classNames: "mt-6",
|
|
61
|
+
label: t("trigger meta remove"),
|
|
62
|
+
onClick: () => {
|
|
63
|
+
const newValues = {
|
|
64
|
+
...props.getValue()
|
|
65
|
+
};
|
|
66
|
+
delete newValues[props.property];
|
|
67
|
+
props.onValueChange("object", newValues);
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
var TriggerEditor = ({ space, trigger, onSave, onCancel }) => {
|
|
72
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_7GXNXMSM.AUTOMATION_PLUGIN);
|
|
73
|
+
const functions = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_types.FunctionType));
|
|
74
|
+
const workflows = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_conductor.ComputeGraph));
|
|
75
|
+
const scripts = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_types.ScriptType));
|
|
76
|
+
const handleSave = (values) => {
|
|
77
|
+
onSave?.(values);
|
|
78
|
+
};
|
|
79
|
+
const Custom = (0, import_react.useMemo)(() => ({
|
|
80
|
+
["function"]: (props) => /* @__PURE__ */ import_react.default.createElement(import_react_ui_form.SelectInput, {
|
|
81
|
+
...props,
|
|
82
|
+
options: getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))
|
|
83
|
+
}),
|
|
84
|
+
["spec.type"]: (props) => /* @__PURE__ */ import_react.default.createElement(import_react_ui_form.SelectInput, {
|
|
85
|
+
...props,
|
|
86
|
+
options: Object.values(import_types.TriggerKind).map((kind) => ({
|
|
87
|
+
value: kind,
|
|
88
|
+
label: t(`trigger type ${kind}`)
|
|
89
|
+
}))
|
|
90
|
+
}),
|
|
91
|
+
// TODO(wittjosiah): Form should be able to handle arbitrary records by default.
|
|
92
|
+
["meta"]: (props) => {
|
|
93
|
+
const payload = props.getValue() ?? {};
|
|
94
|
+
(0, import_react.useEffect)(() => props.onValueChange("object", {
|
|
95
|
+
...payload
|
|
96
|
+
}), []);
|
|
97
|
+
const [newPayloadFieldName, setNewPayloadFieldName] = (0, import_react.useState)("");
|
|
98
|
+
const handleAddPayload = (0, import_react.useCallback)(() => {
|
|
99
|
+
if (newPayloadFieldName.length) {
|
|
100
|
+
const payload2 = props.getValue() ?? {};
|
|
101
|
+
const payloadWithNewProp = {
|
|
102
|
+
...payload2,
|
|
103
|
+
[newPayloadFieldName]: ""
|
|
104
|
+
};
|
|
105
|
+
setNewPayloadFieldName("");
|
|
106
|
+
props.onValueChange("object", payloadWithNewProp);
|
|
107
|
+
}
|
|
108
|
+
}, [
|
|
109
|
+
newPayloadFieldName,
|
|
110
|
+
props.getValue,
|
|
111
|
+
props.onValueChange
|
|
112
|
+
]);
|
|
113
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", null, "Payload"), [
|
|
114
|
+
...Object.keys(payload)
|
|
115
|
+
].map((key) => /* @__PURE__ */ import_react.default.createElement(PayloadInput, {
|
|
116
|
+
key,
|
|
117
|
+
property: key,
|
|
118
|
+
...props
|
|
119
|
+
})), /* @__PURE__ */ import_react.default.createElement("div", {
|
|
120
|
+
role: "none",
|
|
121
|
+
className: "flex items-center mt-2 gap-1 plb-1"
|
|
122
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
123
|
+
role: "none",
|
|
124
|
+
className: "flex-1"
|
|
125
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.Root, null, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.TextInput, {
|
|
126
|
+
placeholder: t("trigger payload prop name placeholder"),
|
|
127
|
+
value: newPayloadFieldName,
|
|
128
|
+
onChange: (event) => setNewPayloadFieldName(event.target.value)
|
|
129
|
+
}))), /* @__PURE__ */ import_react.default.createElement(import_react_ui.IconButton, {
|
|
130
|
+
icon: "ph--plus--regular",
|
|
131
|
+
iconOnly: true,
|
|
132
|
+
label: t("trigger payload add"),
|
|
133
|
+
onClick: handleAddPayload
|
|
134
|
+
})));
|
|
135
|
+
}
|
|
136
|
+
}), [
|
|
137
|
+
workflows,
|
|
138
|
+
scripts,
|
|
139
|
+
functions,
|
|
140
|
+
t
|
|
141
|
+
]);
|
|
142
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react_ui_form.Form, {
|
|
143
|
+
schema: import_types.FunctionTriggerSchema,
|
|
144
|
+
values: trigger,
|
|
145
|
+
onSave: handleSave,
|
|
146
|
+
onCancel,
|
|
147
|
+
Custom
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
var getWorkflowOptions = (graphs) => {
|
|
151
|
+
return graphs.map((graph) => ({
|
|
152
|
+
label: `compute-${graph.id}`,
|
|
153
|
+
value: `dxn:echo:@:${graph.id}`
|
|
154
|
+
}));
|
|
155
|
+
};
|
|
156
|
+
var getFunctionOptions = (scripts, functions) => {
|
|
157
|
+
const getLabel = (fn) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
|
|
158
|
+
return functions.map((fn) => ({
|
|
159
|
+
label: getLabel(fn),
|
|
160
|
+
value: `dxn:worker:${fn.name}`
|
|
161
|
+
}));
|
|
162
|
+
};
|
|
163
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
164
|
+
0 && (module.exports = {
|
|
165
|
+
TriggerEditor
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=chunk-FTEDH5Q6.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/TriggerEditor/TriggerEditor.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { ComputeGraph } from '@dxos/conductor';\nimport {\n FunctionType,\n FunctionTriggerSchema,\n type FunctionTriggerType,\n type FunctionTrigger,\n ScriptType,\n TriggerKind,\n} from '@dxos/functions/types';\nimport { Filter, useQuery, type Space } from '@dxos/react-client/echo';\nimport { IconButton, Input, useTranslation } from '@dxos/react-ui';\nimport { type CustomInputMap, Form, type InputProps, SelectInput, TextInput, useInputProps } from '@dxos/react-ui-form';\n\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\nconst PayloadInput = (props: InputProps & { property: string }) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n // TODO(dmaretskyi): Prop name (`meta`) should be passed in.\n const inputProps = useInputProps(['meta', props.property]);\n return (\n <div role='none' className='flex items-center mt-2 gap-1'>\n <div role='none' className='flex-1'>\n <TextInput {...inputProps} type='string' label={props.property} />\n </div>\n <IconButton\n icon='ph--trash--regular'\n iconOnly\n classNames={'mt-6'}\n label={t('trigger meta remove')}\n onClick={() => {\n const newValues: any = { ...props.getValue() };\n delete newValues[props.property];\n props.onValueChange('object', newValues);\n }}\n />\n </div>\n );\n};\n\nexport const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEditorProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n\n const functions = useQuery(space, Filter.schema(FunctionType));\n const workflows = useQuery(space, Filter.schema(ComputeGraph));\n const scripts = useQuery(space, Filter.schema(ScriptType));\n\n const handleSave = (values: FunctionTriggerType) => {\n onSave?.(values);\n };\n\n const Custom = useMemo(\n (): CustomInputMap => ({\n ['function' satisfies keyof FunctionTriggerType]: (props) => (\n <SelectInput\n {...props}\n options={getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))}\n />\n ),\n ['spec.type' as const]: (props) => (\n <SelectInput\n {...props}\n options={Object.values(TriggerKind).map((kind) => ({\n value: kind,\n label: t(`trigger type ${kind}`),\n }))}\n />\n ),\n // TODO(wittjosiah): Form should be able to handle arbitrary records by default.\n ['meta' as const]: (props) => {\n const payload = props.getValue() ?? {};\n useEffect(() => props.onValueChange('object', { ...payload }), []);\n const [newPayloadFieldName, setNewPayloadFieldName] = useState('');\n\n const handleAddPayload = useCallback(() => {\n if (newPayloadFieldName.length) {\n const payload = props.getValue() ?? {};\n const payloadWithNewProp = { ...payload, [newPayloadFieldName]: '' };\n setNewPayloadFieldName('');\n props.onValueChange('object', payloadWithNewProp);\n }\n }, [newPayloadFieldName, props.getValue, props.onValueChange]);\n\n return (\n <>\n <div>{/* TODO(wittjosiah): props.label */ 'Payload'}</div>\n {[...Object.keys(payload)].map((key) => (\n <PayloadInput key={key} property={key} {...props} />\n ))}\n <div role='none' className='flex items-center mt-2 gap-1 plb-1'>\n <div role='none' className='flex-1'>\n <Input.Root>\n <Input.TextInput\n placeholder={t('trigger payload prop name placeholder')}\n value={newPayloadFieldName}\n onChange={(event) => setNewPayloadFieldName(event.target.value)}\n />\n </Input.Root>\n </div>\n <IconButton\n icon='ph--plus--regular'\n iconOnly\n label={t('trigger payload add')}\n onClick={handleAddPayload}\n />\n </div>\n </>\n );\n },\n }),\n [workflows, scripts, functions, t],\n );\n\n return (\n <Form<FunctionTriggerType>\n schema={FunctionTriggerSchema}\n values={trigger}\n onSave={handleSave}\n onCancel={onCancel}\n Custom={Custom}\n />\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:worker:${fn.name}` }));\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAiE;AAEjE,uBAA6B;AAC7B,mBAOO;AACP,kBAA6C;AAC7C,sBAAkD;AAClD,2BAAkG;AAWlG,IAAMA,eAAe,CAACC,UAAAA;AACpB,QAAM,EAAEC,EAAC,QAAKC,gCAAeC,uCAAAA;AAE7B,QAAMC,iBAAaC,oCAAc;IAAC;IAAQL,MAAMM;GAAS;AACzD,SACE,6BAAAC,QAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,6BAAAH,QAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,6BAAAH,QAAA,cAACI,gCAAAA;IAAW,GAAGP;IAAYQ,MAAK;IAASC,OAAOb,MAAMM;OAExD,6BAAAC,QAAA,cAACO,4BAAAA;IACCC,MAAK;IACLC,UAAAA;IACAC,YAAY;IACZJ,OAAOZ,EAAE,qBAAA;IACTiB,SAAS,MAAA;AACP,YAAMC,YAAiB;QAAE,GAAGnB,MAAMoB,SAAQ;MAAG;AAC7C,aAAOD,UAAUnB,MAAMM,QAAQ;AAC/BN,YAAMqB,cAAc,UAAUF,SAAAA;IAChC;;AAIR;AAEO,IAAMG,gBAAgB,CAAC,EAAEC,OAAOC,SAASC,QAAQC,SAAQ,MAAsB;AACpF,QAAM,EAAEzB,EAAC,QAAKC,gCAAeC,uCAAAA;AAE7B,QAAMwB,gBAAYC,sBAASL,OAAOM,mBAAO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
6
|
+
"names": ["PayloadInput", "props", "t", "useTranslation", "AUTOMATION_PLUGIN", "inputProps", "useInputProps", "property", "React", "div", "role", "className", "TextInput", "type", "label", "IconButton", "icon", "iconOnly", "classNames", "onClick", "newValues", "getValue", "onValueChange", "TriggerEditor", "space", "trigger", "onSave", "onCancel", "functions", "useQuery", "Filter", "schema", "FunctionType", "workflows", "ComputeGraph", "scripts", "ScriptType", "handleSave", "values", "Custom", "useMemo", "SelectInput", "options", "getWorkflowOptions", "concat", "getFunctionOptions", "Object", "TriggerKind", "map", "kind", "value", "payload", "useEffect", "newPayloadFieldName", "setNewPayloadFieldName", "useState", "handleAddPayload", "useCallback", "length", "payloadWithNewProp", "keys", "key", "Input", "Root", "placeholder", "onChange", "event", "target", "Form", "FunctionTriggerSchema", "graphs", "graph", "id", "getLabel", "fn", "find", "s", "source", "name"]
|
|
7
|
+
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,30 +28,32 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
|
-
AUTOMATION_PLUGIN: () =>
|
|
32
|
-
AutomationPanel: () =>
|
|
31
|
+
AUTOMATION_PLUGIN: () => import_chunk_7GXNXMSM.AUTOMATION_PLUGIN,
|
|
32
|
+
AutomationPanel: () => import_chunk_AGJ6XTDN.AutomationPanel,
|
|
33
33
|
AutomationPlugin: () => AutomationPlugin,
|
|
34
|
-
TriggerEditor: () =>
|
|
35
|
-
meta: () =>
|
|
34
|
+
TriggerEditor: () => import_chunk_FTEDH5Q6.TriggerEditor,
|
|
35
|
+
meta: () => import_chunk_7GXNXMSM.meta
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(node_exports);
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
38
|
+
var import_chunk_AGJ6XTDN = require("./chunk-AGJ6XTDN.cjs");
|
|
39
|
+
var import_chunk_FTEDH5Q6 = require("./chunk-FTEDH5Q6.cjs");
|
|
40
|
+
var import_chunk_7GXNXMSM = require("./chunk-7GXNXMSM.cjs");
|
|
41
41
|
var import_app_framework = require("@dxos/app-framework");
|
|
42
42
|
var import_types = require("@dxos/functions/types");
|
|
43
43
|
var import_plugin_client = require("@dxos/plugin-client");
|
|
44
|
-
var
|
|
44
|
+
var import_plugin_space = require("@dxos/plugin-space");
|
|
45
45
|
var import_app_framework2 = require("@dxos/app-framework");
|
|
46
|
-
var
|
|
47
|
-
var ReactSurface = (0, import_app_framework2.lazy)(() => import("./react-surface-
|
|
46
|
+
var AppGraphBuilder = (0, import_app_framework2.lazy)(() => import("./app-graph-builder-HO4FPGZ5.cjs"));
|
|
47
|
+
var ReactSurface = (0, import_app_framework2.lazy)(() => import("./react-surface-52M54VWV.cjs"));
|
|
48
48
|
var translations_default = [
|
|
49
49
|
{
|
|
50
50
|
"en-US": {
|
|
51
|
-
[
|
|
51
|
+
[import_chunk_7GXNXMSM.AUTOMATION_PLUGIN]: {
|
|
52
52
|
"plugin name": "Automation",
|
|
53
53
|
"automation panel label": "Automations",
|
|
54
|
-
"
|
|
54
|
+
"script automation label": "Automation",
|
|
55
|
+
"trigger editor title": "New Trigger",
|
|
56
|
+
"new trigger label": "Add Trigger",
|
|
55
57
|
"trigger type timer": "Timer",
|
|
56
58
|
"trigger type webhook": "Webhook",
|
|
57
59
|
"trigger type websocket": "Websocket",
|
|
@@ -60,21 +62,21 @@ var translations_default = [
|
|
|
60
62
|
"trigger type queue": "Queue",
|
|
61
63
|
"trigger copy url": "Copy URL",
|
|
62
64
|
"trigger copy email": "Copy Email",
|
|
63
|
-
"trigger
|
|
64
|
-
"trigger
|
|
65
|
-
"trigger
|
|
65
|
+
"trigger payload add": "Add",
|
|
66
|
+
"trigger payload remove": "Remove",
|
|
67
|
+
"trigger payload prop name placeholder": "New payload property name"
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
];
|
|
70
|
-
var AutomationPlugin = () => (0, import_app_framework.definePlugin)(
|
|
72
|
+
var AutomationPlugin = () => (0, import_app_framework.definePlugin)(import_chunk_7GXNXMSM.meta, [
|
|
71
73
|
(0, import_app_framework.defineModule)({
|
|
72
|
-
id: `${
|
|
74
|
+
id: `${import_chunk_7GXNXMSM.meta.id}/module/translations`,
|
|
73
75
|
activatesOn: import_app_framework.Events.SetupTranslations,
|
|
74
76
|
activate: () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.Translations, translations_default)
|
|
75
77
|
}),
|
|
76
78
|
(0, import_app_framework.defineModule)({
|
|
77
|
-
id: `${
|
|
79
|
+
id: `${import_chunk_7GXNXMSM.meta.id}/module/schema`,
|
|
78
80
|
activatesOn: import_plugin_client.ClientEvents.SetupSchema,
|
|
79
81
|
activate: () => (0, import_app_framework.contributes)(import_plugin_client.ClientCapabilities.Schema, [
|
|
80
82
|
import_types.FunctionType,
|
|
@@ -82,12 +84,25 @@ var AutomationPlugin = () => (0, import_app_framework.definePlugin)(import_chunk
|
|
|
82
84
|
])
|
|
83
85
|
}),
|
|
84
86
|
(0, import_app_framework.defineModule)({
|
|
85
|
-
id: `${
|
|
86
|
-
activatesOn:
|
|
87
|
-
activate:
|
|
87
|
+
id: `${import_chunk_7GXNXMSM.meta.id}/module/app-graph-builder`,
|
|
88
|
+
activatesOn: import_app_framework.Events.SetupAppGraph,
|
|
89
|
+
activate: AppGraphBuilder
|
|
88
90
|
}),
|
|
89
91
|
(0, import_app_framework.defineModule)({
|
|
90
|
-
id: `${
|
|
92
|
+
id: `${import_chunk_7GXNXMSM.meta.id}/module/space-settings`,
|
|
93
|
+
activatesOn: import_plugin_space.SpaceEvents.SetupSettingsPanel,
|
|
94
|
+
activate: () => (0, import_app_framework.contributes)(import_plugin_space.SpaceCapabilities.SettingsSection, {
|
|
95
|
+
id: "automation",
|
|
96
|
+
label: [
|
|
97
|
+
"automation panel label",
|
|
98
|
+
{
|
|
99
|
+
ns: import_chunk_7GXNXMSM.meta.id
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
(0, import_app_framework.defineModule)({
|
|
105
|
+
id: `${import_chunk_7GXNXMSM.meta.id}/module/react-surface`,
|
|
91
106
|
activatesOn: import_app_framework.Events.SetupReactSurface,
|
|
92
107
|
activate: ReactSurface
|
|
93
108
|
})
|