@dxos/plugin-automation 0.8.4-main.67995b8 → 0.8.4-main.a4bbb77
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-4QA5G3ZY.mjs +11 -0
- package/dist/lib/browser/AutomationSettings-6XLG2PCK.mjs +69 -0
- package/dist/lib/browser/AutomationSettings-6XLG2PCK.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsContainer-IOB333TX.mjs → FunctionsContainer-BQ6VBDIG.mjs} +9 -12
- package/dist/lib/browser/FunctionsContainer-BQ6VBDIG.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsPanel-56ZKRVM5.mjs → FunctionsPanel-QBTOFFNU.mjs} +3 -3
- package/dist/lib/browser/{app-graph-builder-ZTAUTFI4.mjs → app-graph-builder-6TP6ZNYG.mjs} +8 -8
- package/dist/lib/browser/app-graph-builder-6TP6ZNYG.mjs.map +7 -0
- package/dist/lib/browser/chunk-BDJPBZGC.mjs +14 -0
- package/dist/lib/browser/chunk-BDJPBZGC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LYJVTIVD.mjs → chunk-EAQL33PI.mjs} +5 -5
- package/dist/lib/browser/chunk-EAQL33PI.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HN7OHFCB.mjs → chunk-F4K5EMWL.mjs} +2 -2
- package/dist/lib/browser/{chunk-FSJZXTS2.mjs → chunk-IN2YC7NY.mjs} +18 -18
- package/dist/lib/browser/chunk-IN2YC7NY.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ERTIGJYE.mjs → chunk-LNMCGQC2.mjs} +14 -18
- package/dist/lib/browser/chunk-LNMCGQC2.mjs.map +7 -0
- package/dist/lib/browser/chunk-M2WQCY2T.mjs +53 -0
- package/dist/lib/browser/chunk-M2WQCY2T.mjs.map +7 -0
- package/dist/lib/browser/chunk-U66KBK53.mjs +14 -0
- package/dist/lib/browser/chunk-U66KBK53.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GW5U2DGT.mjs → chunk-WWURMV25.mjs} +2 -4
- package/dist/lib/browser/chunk-WWURMV25.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZTXBAXUT.mjs +15 -0
- package/dist/lib/browser/chunk-ZTXBAXUT.mjs.map +7 -0
- package/dist/lib/browser/compute-runtime-OFQPXD5I.mjs +158 -0
- package/dist/lib/browser/compute-runtime-OFQPXD5I.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +12 -0
- package/dist/lib/browser/index.mjs +25 -16
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-U3ZAQEFW.mjs → intent-resolver-JXVWRAAH.mjs} +11 -10
- package/dist/lib/browser/intent-resolver-JXVWRAAH.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-4DFSM7OX.mjs → react-surface-NG3MJCDH.mjs} +17 -17
- package/dist/lib/browser/react-surface-NG3MJCDH.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{AutomationPanel-YYUMSK2W.mjs → AutomationPanel-WMVR3IST.mjs} +4 -4
- package/dist/lib/node-esm/AutomationSettings-4IW7RGMN.mjs +70 -0
- package/dist/lib/node-esm/AutomationSettings-4IW7RGMN.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsContainer-DJWB6WFH.mjs → FunctionsContainer-LHUUOLA5.mjs} +9 -12
- package/dist/lib/node-esm/FunctionsContainer-LHUUOLA5.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsPanel-KGIOZSPZ.mjs → FunctionsPanel-SHTQIMDV.mjs} +3 -3
- package/dist/lib/node-esm/FunctionsPanel-SHTQIMDV.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-3FP63ZSG.mjs → app-graph-builder-3A2NIPR5.mjs} +8 -8
- package/dist/lib/node-esm/app-graph-builder-3A2NIPR5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2L2X4JMP.mjs +16 -0
- package/dist/lib/node-esm/chunk-2L2X4JMP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NK5N3QKD.mjs → chunk-5MQJPJR2.mjs} +2 -4
- package/dist/lib/node-esm/chunk-5MQJPJR2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-B6O6UBS7.mjs +16 -0
- package/dist/lib/node-esm/chunk-B6O6UBS7.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OEZNHUL2.mjs → chunk-CEWZ2CDM.mjs} +2 -2
- package/dist/lib/node-esm/chunk-DSEZPWSO.mjs +54 -0
- package/dist/lib/node-esm/chunk-DSEZPWSO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HIMYPGHF.mjs → chunk-MN5S5J4O.mjs} +14 -18
- package/dist/lib/node-esm/chunk-MN5S5J4O.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AZH66CED.mjs → chunk-N7NES6SZ.mjs} +18 -18
- package/dist/lib/node-esm/chunk-N7NES6SZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZGPUV5VS.mjs → chunk-PBULJE4B.mjs} +5 -5
- package/dist/lib/node-esm/chunk-PBULJE4B.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UTZIMYCX.mjs +16 -0
- package/dist/lib/node-esm/chunk-UTZIMYCX.mjs.map +7 -0
- package/dist/lib/node-esm/compute-runtime-W5UJNSQY.mjs +159 -0
- package/dist/lib/node-esm/compute-runtime-W5UJNSQY.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +13 -0
- package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +25 -16
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-3QWXEBPX.mjs → intent-resolver-ROEBZXSS.mjs} +11 -10
- package/dist/lib/node-esm/intent-resolver-ROEBZXSS.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-3PNW7NDW.mjs → react-surface-A4KTYX6Z.mjs} +17 -17
- package/dist/lib/node-esm/react-surface-A4KTYX6Z.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/AutomationPlugin.d.ts +1 -1
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +18 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts +5 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +6 -5
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +45 -4
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/AutomationSettings.d.ts +5 -0
- package/dist/types/src/components/AutomationSettings.d.ts.map +1 -0
- package/dist/types/src/components/FunctionsContainer.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +2 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +45 -4
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerSettings.d.ts +6 -0
- package/dist/types/src/components/TriggerSettings.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +3 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +8 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +11 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +60 -41
- package/src/AutomationPlugin.tsx +35 -31
- package/src/capabilities/app-graph-builder.ts +5 -5
- package/src/capabilities/capabilities.ts +47 -0
- package/src/capabilities/compute-runtime.ts +136 -0
- package/src/capabilities/index.ts +3 -0
- package/src/capabilities/intent-resolver.ts +7 -7
- package/src/capabilities/react-surface.tsx +11 -11
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +13 -13
- package/src/components/AutomationPanel/AutomationPanel.tsx +17 -29
- package/src/components/AutomationSettings.tsx +30 -0
- package/src/components/FunctionsContainer.tsx +11 -13
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +4 -4
- package/src/components/TriggerEditor/SpecSelector.tsx +16 -16
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +15 -14
- package/src/components/TriggerEditor/TriggerEditor.tsx +6 -12
- package/src/components/TriggerSettings.tsx +25 -0
- package/src/components/index.ts +1 -1
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useComputeRuntimeCallback.ts +30 -0
- package/src/hooks/useTriggerRuntimeControls.ts +52 -0
- package/src/index.ts +1 -0
- package/src/meta.ts +1 -3
- package/src/translations.ts +4 -0
- package/dist/lib/browser/AutomationContainer-VZNV2ZQF.mjs +0 -38
- package/dist/lib/browser/AutomationContainer-VZNV2ZQF.mjs.map +0 -7
- package/dist/lib/browser/AutomationPanel-ZWA6GOFY.mjs +0 -11
- package/dist/lib/browser/FunctionsContainer-IOB333TX.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-ZTAUTFI4.mjs.map +0 -7
- package/dist/lib/browser/chunk-ECSTS2UI.mjs +0 -14
- package/dist/lib/browser/chunk-ECSTS2UI.mjs.map +0 -7
- package/dist/lib/browser/chunk-ERTIGJYE.mjs.map +0 -7
- package/dist/lib/browser/chunk-FSJZXTS2.mjs.map +0 -7
- package/dist/lib/browser/chunk-GW5U2DGT.mjs.map +0 -7
- package/dist/lib/browser/chunk-LYJVTIVD.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-U3ZAQEFW.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4DFSM7OX.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationContainer-WMIH3F4V.mjs +0 -39
- package/dist/lib/node-esm/AutomationContainer-WMIH3F4V.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-DJWB6WFH.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-3FP63ZSG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AZH66CED.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HIMYPGHF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NK5N3QKD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SGZPTJ47.mjs +0 -16
- package/dist/lib/node-esm/chunk-SGZPTJ47.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZGPUV5VS.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3QWXEBPX.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-3PNW7NDW.mjs.map +0 -7
- package/dist/types/src/components/AutomationContainer.d.ts +0 -5
- package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
- package/src/components/AutomationContainer.tsx +0 -30
- /package/dist/lib/browser/{AutomationPanel-ZWA6GOFY.mjs.map → AutomationPanel-4QA5G3ZY.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-56ZKRVM5.mjs.map → FunctionsPanel-QBTOFFNU.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-HN7OHFCB.mjs.map → chunk-F4K5EMWL.mjs.map} +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-YYUMSK2W.mjs.map → browser/hooks/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-KGIOZSPZ.mjs.map → AutomationPanel-WMVR3IST.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-OEZNHUL2.mjs.map → chunk-CEWZ2CDM.mjs.map} +0 -0
|
@@ -6,52 +6,44 @@ import { Schema } from 'effect';
|
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Filter, Obj } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
-
FunctionType,
|
|
11
|
-
FunctionTrigger,
|
|
12
|
-
FunctionTriggerSchema,
|
|
13
|
-
type FunctionTriggerType,
|
|
14
|
-
ScriptType,
|
|
15
|
-
TriggerKind,
|
|
16
|
-
} from '@dxos/functions';
|
|
9
|
+
import { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';
|
|
17
10
|
import { type Client, useClient } from '@dxos/react-client';
|
|
18
|
-
import {
|
|
19
|
-
import { Clipboard, IconButton, Input, Separator, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { type Space, getSpace, useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { Clipboard, IconButton, Input, Separator, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
20
13
|
import { ControlItem, controlItemClasses } from '@dxos/react-ui-form';
|
|
21
14
|
import { List } from '@dxos/react-ui-list';
|
|
22
15
|
import { ghostHover, mx } from '@dxos/react-ui-theme';
|
|
23
16
|
|
|
24
|
-
import {
|
|
17
|
+
import { meta } from '../../meta';
|
|
25
18
|
import { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';
|
|
26
19
|
|
|
27
20
|
const grid = 'grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]';
|
|
28
21
|
|
|
29
|
-
export type AutomationPanelProps = {
|
|
22
|
+
export type AutomationPanelProps = ThemedClassName<{
|
|
30
23
|
space: Space;
|
|
31
24
|
object?: Obj.Any;
|
|
32
|
-
initialTrigger?:
|
|
25
|
+
initialTrigger?: FunctionTrigger;
|
|
33
26
|
onDone?: () => void;
|
|
34
|
-
}
|
|
27
|
+
}>;
|
|
35
28
|
|
|
36
29
|
// TODO(burdon): Factor out common layout with ViewEditor.
|
|
37
|
-
export const AutomationPanel = ({ space, object, initialTrigger, onDone }: AutomationPanelProps) => {
|
|
38
|
-
const { t } = useTranslation(
|
|
30
|
+
export const AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }: AutomationPanelProps) => {
|
|
31
|
+
const { t } = useTranslation(meta.id);
|
|
39
32
|
const client = useClient();
|
|
40
33
|
const triggers = useQuery(space, Filter.type(FunctionTrigger));
|
|
41
34
|
const functions = useQuery(space, Filter.type(FunctionType));
|
|
42
35
|
const scripts = useQuery(space, Filter.type(ScriptType));
|
|
43
36
|
|
|
44
|
-
const [trigger, setTrigger] = useState<
|
|
37
|
+
const [trigger, setTrigger] = useState<FunctionTrigger | undefined>(initialTrigger);
|
|
45
38
|
const [selected, setSelected] = useState<FunctionTrigger>();
|
|
46
39
|
|
|
47
40
|
const handleSelect = (trigger: FunctionTrigger) => {
|
|
48
|
-
|
|
49
|
-
setTrigger(values);
|
|
41
|
+
setTrigger(trigger);
|
|
50
42
|
setSelected(trigger);
|
|
51
43
|
};
|
|
52
44
|
|
|
53
45
|
const handleAdd = () => {
|
|
54
|
-
setTrigger(Obj.make(
|
|
46
|
+
setTrigger(Obj.make(FunctionTrigger, {}));
|
|
55
47
|
setSelected(undefined);
|
|
56
48
|
};
|
|
57
49
|
|
|
@@ -87,7 +79,7 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
87
79
|
}
|
|
88
80
|
|
|
89
81
|
return (
|
|
90
|
-
<div className={controlItemClasses}>
|
|
82
|
+
<div className={mx(controlItemClasses, classNames)}>
|
|
91
83
|
{triggers.length > 0 && (
|
|
92
84
|
<List.Root<FunctionTrigger> items={triggers} isItem={Schema.is(FunctionTrigger)} getId={(field) => field.id}>
|
|
93
85
|
{({ items: triggers }) => (
|
|
@@ -139,11 +131,11 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
139
131
|
};
|
|
140
132
|
|
|
141
133
|
const getCopyAction = (client: Client, trigger: FunctionTrigger | undefined) => {
|
|
142
|
-
if (trigger?.spec?.kind ===
|
|
134
|
+
if (trigger?.spec?.kind === 'email') {
|
|
143
135
|
return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };
|
|
144
136
|
}
|
|
145
137
|
|
|
146
|
-
if (trigger?.spec?.kind ===
|
|
138
|
+
if (trigger?.spec?.kind === 'webhook') {
|
|
147
139
|
return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };
|
|
148
140
|
}
|
|
149
141
|
|
|
@@ -158,14 +150,10 @@ const getWebhookUrl = (client: Client, trigger: FunctionTrigger) => {
|
|
|
158
150
|
return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();
|
|
159
151
|
};
|
|
160
152
|
|
|
161
|
-
const getFunctionName = (scripts: ScriptType[], functions: FunctionType[], trigger:
|
|
153
|
+
const getFunctionName = (scripts: ScriptType[], functions: FunctionType[], trigger: FunctionTrigger) => {
|
|
162
154
|
// TODO(wittjosiah): Truncation should be done in the UI.
|
|
163
155
|
// Warning that the List component is currently a can of worms.
|
|
164
156
|
const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;
|
|
165
157
|
const functionObject = functions.find((fn) => fn === trigger.function?.target);
|
|
166
|
-
|
|
167
|
-
return shortId;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ?? shortId;
|
|
158
|
+
return functionObject?.name ?? shortId;
|
|
171
159
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
9
|
+
|
|
10
|
+
import { meta } from '../meta';
|
|
11
|
+
|
|
12
|
+
import { AutomationPanel, type AutomationPanelProps } from './AutomationPanel';
|
|
13
|
+
import { TriggersSettings } from './TriggerSettings';
|
|
14
|
+
|
|
15
|
+
export const AutomationSettings = (props: AutomationPanelProps) => {
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
|
+
return (
|
|
18
|
+
<ControlPage>
|
|
19
|
+
<ControlSection
|
|
20
|
+
title={t('automation verbose label', { ns: meta.id })}
|
|
21
|
+
description={t('automation description', { ns: meta.id })}
|
|
22
|
+
>
|
|
23
|
+
<AutomationPanel {...props} />
|
|
24
|
+
<TriggersSettings space={props.space} />
|
|
25
|
+
</ControlSection>
|
|
26
|
+
</ControlPage>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default AutomationSettings;
|
|
@@ -7,24 +7,22 @@ import React from 'react';
|
|
|
7
7
|
import { type Space } from '@dxos/react-client/echo';
|
|
8
8
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
import { meta } from '../meta';
|
|
11
12
|
|
|
12
13
|
import { FunctionsPanel } from './FunctionsPanel';
|
|
13
|
-
import { AUTOMATION_PLUGIN } from '../meta';
|
|
14
14
|
|
|
15
15
|
export const FunctionsContainer = ({ space }: { space: Space }) => {
|
|
16
|
-
const { t } = useTranslation(
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
17
|
return (
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</ControlPage>
|
|
27
|
-
</StackItem.Content>
|
|
18
|
+
<ControlPage>
|
|
19
|
+
<ControlSection
|
|
20
|
+
title={t('functions verbose label', { ns: meta.id })}
|
|
21
|
+
description={t('functions description', { ns: meta.id })}
|
|
22
|
+
>
|
|
23
|
+
<FunctionsPanel space={space} />
|
|
24
|
+
</ControlSection>
|
|
25
|
+
</ControlPage>
|
|
28
26
|
);
|
|
29
27
|
};
|
|
30
28
|
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
import React, { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
9
|
import { FunctionType, ScriptType } from '@dxos/functions';
|
|
10
|
-
import { Filter, fullyQualifiedId, useQuery
|
|
10
|
+
import { Filter, type Space, fullyQualifiedId, useQuery } from '@dxos/react-client/echo';
|
|
11
11
|
import { Button, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
import { controlItemClasses } from '@dxos/react-ui-form';
|
|
13
13
|
import { List } from '@dxos/react-ui-list';
|
|
14
14
|
import { ghostHover, mx } from '@dxos/react-ui-theme';
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { meta } from '../../meta';
|
|
17
17
|
|
|
18
18
|
const grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';
|
|
19
19
|
|
|
@@ -22,7 +22,7 @@ export type FunctionsPanelProps = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
25
|
-
const { t } = useTranslation(
|
|
25
|
+
const { t } = useTranslation(meta.id);
|
|
26
26
|
const functions = useQuery(space, Filter.type(FunctionType));
|
|
27
27
|
const scripts = useQuery(space, Filter.type(ScriptType));
|
|
28
28
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
@@ -4,32 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type FunctionTrigger, TriggerKinds, type TriggerType } from '@dxos/functions';
|
|
8
8
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import {
|
|
9
|
+
import { type InputProps, SelectInput, useInputProps } from '@dxos/react-ui-form';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
12
|
|
|
13
13
|
export type SpecSelectorProps = InputProps;
|
|
14
14
|
|
|
15
15
|
export const SpecSelector = (props: SpecSelectorProps) => {
|
|
16
|
-
const { t } = useTranslation(
|
|
17
|
-
const specProps = useInputProps(['spec' satisfies keyof
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
|
+
const specProps = useInputProps(['spec' satisfies keyof FunctionTrigger]);
|
|
18
18
|
|
|
19
19
|
const handleTypeChange = useCallback(
|
|
20
20
|
(_type: any, value: string): TriggerType | undefined => {
|
|
21
21
|
const getDefaultTriggerSpec = (kind: string) => {
|
|
22
22
|
switch (kind) {
|
|
23
|
-
case
|
|
24
|
-
return { kind:
|
|
25
|
-
case
|
|
26
|
-
return { kind:
|
|
27
|
-
case
|
|
28
|
-
return { kind:
|
|
29
|
-
case
|
|
30
|
-
return { kind:
|
|
31
|
-
case
|
|
32
|
-
return { kind:
|
|
23
|
+
case 'timer':
|
|
24
|
+
return { kind: 'timer', cron: '' };
|
|
25
|
+
case 'subscription':
|
|
26
|
+
return { kind: 'subscription', filter: {} };
|
|
27
|
+
case 'queue':
|
|
28
|
+
return { kind: 'queue', queue: '' };
|
|
29
|
+
case 'email':
|
|
30
|
+
return { kind: 'email' };
|
|
31
|
+
case 'webhook':
|
|
32
|
+
return { kind: 'webhook' };
|
|
33
33
|
default:
|
|
34
34
|
return undefined;
|
|
35
35
|
}
|
|
@@ -48,7 +48,7 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
48
48
|
|
|
49
49
|
const options = useMemo(
|
|
50
50
|
() =>
|
|
51
|
-
|
|
51
|
+
TriggerKinds.map((kind) => ({
|
|
52
52
|
value: kind,
|
|
53
53
|
label: t(`trigger type ${kind}`),
|
|
54
54
|
})),
|
|
@@ -2,22 +2,21 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useEffect, useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { Obj } from '@dxos/echo';
|
|
11
|
-
import {
|
|
9
|
+
import { FunctionTrigger, FunctionType } from '@dxos/functions';
|
|
12
10
|
import { faker } from '@dxos/random';
|
|
13
11
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
14
12
|
import { ContactType, withClientProvider } from '@dxos/react-client/testing';
|
|
15
|
-
import {
|
|
13
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
16
14
|
|
|
17
|
-
import { TriggerEditor } from './TriggerEditor';
|
|
18
15
|
import { functions } from '../../testing';
|
|
19
16
|
import { translations } from '../../translations';
|
|
20
17
|
|
|
18
|
+
import { TriggerEditor } from './TriggerEditor';
|
|
19
|
+
|
|
21
20
|
const DefaultStory = () => {
|
|
22
21
|
const spaces = useSpaces();
|
|
23
22
|
const space = spaces[1];
|
|
@@ -27,7 +26,7 @@ const DefaultStory = () => {
|
|
|
27
26
|
return;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
const trigger = space.db.add(Obj.make(FunctionTrigger, { spec: { kind:
|
|
29
|
+
const trigger = space.db.add(Obj.make(FunctionTrigger, { spec: { kind: 'timer', cron: '' } }));
|
|
31
30
|
setTrigger(trigger);
|
|
32
31
|
}, [space]);
|
|
33
32
|
|
|
@@ -42,16 +41,17 @@ const DefaultStory = () => {
|
|
|
42
41
|
);
|
|
43
42
|
};
|
|
44
43
|
|
|
45
|
-
const meta
|
|
44
|
+
const meta = {
|
|
46
45
|
title: 'plugins/plugin-automation/TriggerEditor',
|
|
47
|
-
component: TriggerEditor,
|
|
46
|
+
component: TriggerEditor as any,
|
|
48
47
|
render: DefaultStory,
|
|
49
48
|
decorators: [
|
|
49
|
+
withTheme,
|
|
50
50
|
withClientProvider({
|
|
51
51
|
createIdentity: true,
|
|
52
52
|
createSpace: true,
|
|
53
53
|
types: [FunctionType, FunctionTrigger, ContactType],
|
|
54
|
-
|
|
54
|
+
onCreateSpace: ({ space }) => {
|
|
55
55
|
for (const fn of functions) {
|
|
56
56
|
space.db.add(Obj.make(FunctionType, fn));
|
|
57
57
|
}
|
|
@@ -65,14 +65,15 @@ const meta: Meta = {
|
|
|
65
65
|
});
|
|
66
66
|
},
|
|
67
67
|
}),
|
|
68
|
-
withLayout({ fullscreen: true, classNames: 'flex justify-center m-2' }),
|
|
69
|
-
withTheme,
|
|
70
68
|
],
|
|
71
69
|
parameters: {
|
|
70
|
+
layout: 'column',
|
|
72
71
|
translations,
|
|
73
72
|
},
|
|
74
|
-
}
|
|
73
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
75
74
|
|
|
76
75
|
export default meta;
|
|
77
76
|
|
|
78
|
-
|
|
77
|
+
type Story = StoryObj<typeof meta>;
|
|
78
|
+
|
|
79
|
+
export const Default: Story = {};
|
|
@@ -6,14 +6,8 @@ import React, { useCallback, useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { ComputeGraph } from '@dxos/conductor';
|
|
8
8
|
import { Type } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
FunctionTriggerSchema,
|
|
12
|
-
type FunctionTriggerType,
|
|
13
|
-
type FunctionTrigger,
|
|
14
|
-
ScriptType,
|
|
15
|
-
} from '@dxos/functions';
|
|
16
|
-
import { Filter, Ref, useQuery, type Space } from '@dxos/react-client/echo';
|
|
9
|
+
import { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';
|
|
10
|
+
import { Filter, Ref, type Space, useQuery } from '@dxos/react-client/echo';
|
|
17
11
|
import { type CustomInputMap, Form, SelectInput, useRefQueryLookupHandler } from '@dxos/react-ui-form';
|
|
18
12
|
|
|
19
13
|
import { FunctionInputEditor, type FunctionInputEditorProps } from './FunctionInputEditor';
|
|
@@ -21,13 +15,13 @@ import { SpecSelector } from './SpecSelector';
|
|
|
21
15
|
|
|
22
16
|
export type TriggerEditorProps = {
|
|
23
17
|
space: Space;
|
|
24
|
-
trigger:
|
|
18
|
+
trigger: FunctionTrigger;
|
|
25
19
|
onSave?: (trigger: Omit<FunctionTrigger, 'id'>) => void;
|
|
26
20
|
onCancel?: () => void;
|
|
27
21
|
};
|
|
28
22
|
|
|
29
23
|
export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEditorProps) => {
|
|
30
|
-
const handleSave = (values:
|
|
24
|
+
const handleSave = (values: FunctionTrigger) => {
|
|
31
25
|
onSave?.(values);
|
|
32
26
|
};
|
|
33
27
|
|
|
@@ -38,7 +32,7 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEdito
|
|
|
38
32
|
<Form
|
|
39
33
|
outerSpacing={false}
|
|
40
34
|
Custom={Custom}
|
|
41
|
-
schema={
|
|
35
|
+
schema={FunctionTrigger}
|
|
42
36
|
values={trigger}
|
|
43
37
|
onSave={handleSave}
|
|
44
38
|
onCancel={onCancel}
|
|
@@ -55,7 +49,7 @@ const useCustomInputs = (space: Space, onQueryRefOptions: FunctionInputEditorPro
|
|
|
55
49
|
return useMemo(
|
|
56
50
|
(): CustomInputMap => ({
|
|
57
51
|
// Function selector.
|
|
58
|
-
['function' satisfies keyof
|
|
52
|
+
['function' satisfies keyof FunctionTrigger]: (props) => {
|
|
59
53
|
const getValue = useCallback(() => {
|
|
60
54
|
const formValue = props.getValue();
|
|
61
55
|
if (Ref.isRef(formValue)) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
8
|
+
import { Input, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { ControlItemInput } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { useTriggerRuntimeControls } from '../hooks';
|
|
12
|
+
import { meta } from '../meta';
|
|
13
|
+
|
|
14
|
+
export const TriggersSettings = ({ space }: { space: Space }) => {
|
|
15
|
+
const { triggers, isRunning, start, stop } = useTriggerRuntimeControls(space);
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className='container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]'>
|
|
20
|
+
<ControlItemInput title={t('runtime label')} description={t('runtime description')}>
|
|
21
|
+
<Input.Switch classNames='justify-self-end' checked={isRunning} onCheckedChange={isRunning ? stop : start} />
|
|
22
|
+
</ControlItemInput>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { lazy } from 'react';
|
|
|
6
6
|
|
|
7
7
|
export * from './TriggerEditor';
|
|
8
8
|
|
|
9
|
-
export const AutomationContainer = lazy(() => import('./AutomationContainer'));
|
|
10
9
|
export const AutomationPanel = lazy(() => import('./AutomationPanel'));
|
|
10
|
+
export const AutomationSettings = lazy(() => import('./AutomationSettings'));
|
|
11
11
|
export const FunctionsContainer = lazy(() => import('./FunctionsContainer'));
|
|
12
12
|
export const FunctionsPanel = lazy(() => import('./FunctionsPanel'));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type { Effect } from 'effect';
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
|
|
8
|
+
import { useCapability } from '@dxos/app-framework';
|
|
9
|
+
import type { Space } from '@dxos/react-client/echo';
|
|
10
|
+
|
|
11
|
+
import { AutomationCapabilities } from '../capabilities';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Create an effectful function that has access to compute services
|
|
15
|
+
*/
|
|
16
|
+
export const useComputeRuntimeCallback = <T>(
|
|
17
|
+
space: Space | undefined,
|
|
18
|
+
fn: () => Effect.Effect<T, any, AutomationCapabilities.ComputeServices>,
|
|
19
|
+
deps?: React.DependencyList,
|
|
20
|
+
): (() => Promise<T>) => {
|
|
21
|
+
const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
22
|
+
const runtime = space !== undefined ? computeRuntime.getRuntime(space.id) : undefined;
|
|
23
|
+
|
|
24
|
+
return useCallback(() => {
|
|
25
|
+
if (!runtime) {
|
|
26
|
+
throw new TypeError('Space not provided to useComputeRuntimeCallback');
|
|
27
|
+
}
|
|
28
|
+
return runtime.runPromise(fn());
|
|
29
|
+
}, [runtime, ...(deps ?? [])]);
|
|
30
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Effect } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { Filter } from '@dxos/echo';
|
|
8
|
+
import { FunctionTrigger, TriggerDispatcher } from '@dxos/functions';
|
|
9
|
+
import { type Space, useQuery } from '@dxos/react-client/echo';
|
|
10
|
+
import { useAsyncState } from '@dxos/react-ui';
|
|
11
|
+
|
|
12
|
+
import { useComputeRuntimeCallback } from './useComputeRuntimeCallback';
|
|
13
|
+
|
|
14
|
+
interface TriggerRuntimeControls {
|
|
15
|
+
triggers: FunctionTrigger[];
|
|
16
|
+
isRunning: boolean;
|
|
17
|
+
start: () => void;
|
|
18
|
+
stop: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const useTriggerRuntimeControls = (space: Space | undefined): TriggerRuntimeControls => {
|
|
22
|
+
const triggers = useQuery(space, Filter.type(FunctionTrigger));
|
|
23
|
+
|
|
24
|
+
const [isRunningState, setIsRunningState] = useAsyncState(
|
|
25
|
+
useComputeRuntimeCallback(space, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const start = useComputeRuntimeCallback(
|
|
29
|
+
space,
|
|
30
|
+
Effect.fnUntraced(function* () {
|
|
31
|
+
const dispatcher = yield* TriggerDispatcher;
|
|
32
|
+
yield* dispatcher.start();
|
|
33
|
+
setIsRunningState(true);
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const stop = useComputeRuntimeCallback(
|
|
38
|
+
space,
|
|
39
|
+
Effect.fnUntraced(function* () {
|
|
40
|
+
const dispatcher = yield* TriggerDispatcher;
|
|
41
|
+
yield* dispatcher.stop();
|
|
42
|
+
setIsRunningState(false);
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
triggers,
|
|
48
|
+
isRunning: isRunningState ?? false,
|
|
49
|
+
start: () => void start(),
|
|
50
|
+
stop: () => void stop(),
|
|
51
|
+
};
|
|
52
|
+
};
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const AUTOMATION_PLUGIN = 'dxos.org/plugin/automation';
|
|
8
|
-
|
|
9
7
|
export const meta: PluginMeta = {
|
|
10
|
-
id:
|
|
8
|
+
id: 'dxos.org/plugin/automation',
|
|
11
9
|
name: 'Automation',
|
|
12
10
|
description:
|
|
13
11
|
'The Automation tab allows you to trigger pre-defined workflows related to the element you are interacting with inside of Composer.',
|
package/src/translations.ts
CHANGED
|
@@ -16,6 +16,10 @@ export const translations = [
|
|
|
16
16
|
'automation verbose label': 'Manage automations',
|
|
17
17
|
'automation description': 'You can manage all the triggers which automate your space here.',
|
|
18
18
|
|
|
19
|
+
'runtime label': 'Enable Local Runtime',
|
|
20
|
+
'runtime description':
|
|
21
|
+
'This will start a trigger dispatcher locally for this space to run triggers on your device while Composer is running.',
|
|
22
|
+
|
|
19
23
|
'functions panel label': 'Functions',
|
|
20
24
|
'functions verbose label': 'Manage deployed functions',
|
|
21
25
|
'functions description': 'You can manage all the functions deployed from your space on EDGE here.',
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutomationPanel
|
|
3
|
-
} from "./chunk-ERTIGJYE.mjs";
|
|
4
|
-
import "./chunk-FSJZXTS2.mjs";
|
|
5
|
-
import {
|
|
6
|
-
AUTOMATION_PLUGIN
|
|
7
|
-
} from "./chunk-GW5U2DGT.mjs";
|
|
8
|
-
|
|
9
|
-
// src/components/AutomationContainer.tsx
|
|
10
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
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 = (props) => {
|
|
16
|
-
var _effect = _useSignals();
|
|
17
|
-
try {
|
|
18
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
19
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
20
|
-
classNames: "block overflow-y-auto"
|
|
21
|
-
}, /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
|
|
22
|
-
title: t("automation verbose label", {
|
|
23
|
-
ns: AUTOMATION_PLUGIN
|
|
24
|
-
}),
|
|
25
|
-
description: t("automation description", {
|
|
26
|
-
ns: AUTOMATION_PLUGIN
|
|
27
|
-
})
|
|
28
|
-
}, /* @__PURE__ */ React.createElement(AutomationPanel, props))));
|
|
29
|
-
} finally {
|
|
30
|
-
_effect.f();
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var AutomationContainer_default = AutomationContainer;
|
|
34
|
-
export {
|
|
35
|
-
AutomationContainer,
|
|
36
|
-
AutomationContainer_default as default
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=AutomationContainer-VZNV2ZQF.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/AutomationContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { useTranslation } from '@dxos/react-ui';\nimport { ControlSection, ControlPage } from '@dxos/react-ui-form';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { AutomationPanel, type AutomationPanelProps } from './AutomationPanel';\nimport { AUTOMATION_PLUGIN } from '../meta';\n\nexport const AutomationContainer = (props: AutomationPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n return (\n <StackItem.Content classNames='block overflow-y-auto'>\n <ControlPage>\n <ControlSection\n title={t('automation verbose label', { ns: AUTOMATION_PLUGIN })}\n description={t('automation description', { ns: AUTOMATION_PLUGIN })}\n >\n <AutomationPanel {...props} />\n </ControlSection>\n </ControlPage>\n </StackItem.Content>\n );\n};\n\nexport default AutomationContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,sBAAsB;AAC/B,SAASC,gBAAgBC,mBAAmB;AAC5C,SAASC,iBAAiB;AAKnB,IAAMC,sBAAsB,CAACC,UAAAA;;;AAClC,UAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,WACE,sBAAA,cAACC,UAAUC,SAAO;MAACC,YAAW;OAC5B,sBAAA,cAACC,aAAAA,MACC,sBAAA,cAACC,gBAAAA;MACCC,OAAOR,EAAE,4BAA4B;QAAES,IAAIP;MAAkB,CAAA;MAC7DQ,aAAaV,EAAE,0BAA0B;QAAES,IAAIP;MAAkB,CAAA;OAEjE,sBAAA,cAACS,iBAAoBZ,KAAAA,CAAAA,CAAAA,CAAAA;;;;AAK/B;AAEA,IAAA,8BAAeD;",
|
|
6
|
-
"names": ["React", "useTranslation", "ControlSection", "ControlPage", "StackItem", "AutomationContainer", "props", "t", "useTranslation", "AUTOMATION_PLUGIN", "StackItem", "Content", "classNames", "ControlPage", "ControlSection", "title", "ns", "description", "AutomationPanel"]
|
|
7
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutomationPanel,
|
|
3
|
-
AutomationPanel_default
|
|
4
|
-
} from "./chunk-ERTIGJYE.mjs";
|
|
5
|
-
import "./chunk-FSJZXTS2.mjs";
|
|
6
|
-
import "./chunk-GW5U2DGT.mjs";
|
|
7
|
-
export {
|
|
8
|
-
AutomationPanel,
|
|
9
|
-
AutomationPanel_default as default
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=AutomationPanel-ZWA6GOFY.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/FunctionsContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Space } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { ControlPage, ControlSection } from '@dxos/react-ui-form';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { FunctionsPanel } from './FunctionsPanel';\nimport { AUTOMATION_PLUGIN } from '../meta';\n\nexport const FunctionsContainer = ({ space }: { space: Space }) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n return (\n <StackItem.Content classNames='block overflow-y-auto'>\n <ControlPage>\n <ControlSection\n title={t('functions verbose label', { ns: AUTOMATION_PLUGIN })}\n description={t('functions description', { ns: AUTOMATION_PLUGIN })}\n >\n <FunctionsPanel space={space} />\n </ControlSection>\n </ControlPage>\n </StackItem.Content>\n );\n};\n\nexport default FunctionsContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,OAAOA,WAAW;AAGlB,SAASC,sBAAsB;AAC/B,SAASC,aAAaC,sBAAsB;AAC5C,SAASC,iBAAiB;AAKnB,IAAMC,qBAAqB,CAAC,EAAEC,MAAK,MAAoB;;;AAC5D,UAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,WACE,sBAAA,cAACC,UAAUC,SAAO;MAACC,YAAW;OAC5B,sBAAA,cAACC,aAAAA,MACC,sBAAA,cAACC,gBAAAA;MACCC,OAAOR,EAAE,2BAA2B;QAAES,IAAIP;MAAkB,CAAA;MAC5DQ,aAAaV,EAAE,yBAAyB;QAAES,IAAIP;MAAkB,CAAA;OAEhE,sBAAA,cAACS,gBAAAA;MAAeZ;;;;;AAK1B;AAEA,IAAA,6BAAeD;",
|
|
6
|
-
"names": ["React", "useTranslation", "ControlPage", "ControlSection", "StackItem", "FunctionsContainer", "space", "t", "useTranslation", "AUTOMATION_PLUGIN", "StackItem", "Content", "classNames", "ControlPage", "ControlSection", "title", "ns", "description", "FunctionsPanel"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Rx } from '@effect-rx/rx-react';\nimport { Option, pipe } from 'effect';\n\nimport { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { ScriptType } from '@dxos/functions';\nimport { PLANK_COMPANION_TYPE, ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';\nimport { createExtension } from '@dxos/plugin-graph';\nimport { SPACE_PLUGIN } from '@dxos/plugin-space';\n\nimport { meta } from '../meta';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${meta.id}/space-settings-automation`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.type === `${SPACE_PLUGIN}/settings` ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: `automation-${node.id}`,\n type: `${meta.id}/space-settings-automation`,\n data: `${meta.id}/space-settings-automation`,\n properties: {\n label: ['automation panel label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/space-settings-functions`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.type === `${SPACE_PLUGIN}/settings` ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: `functions-${node.id}`,\n type: `${meta.id}/space-settings-functions`,\n data: `${meta.id}/space-settings-functions`,\n properties: {\n label: ['functions panel label', { ns: meta.id }],\n icon: 'ph--function--regular',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/script-companion`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (Obj.instanceOf(ScriptType, node.data) ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: [node.id, 'automation'].join(ATTENDABLE_PATH_SEPARATOR),\n type: PLANK_COMPANION_TYPE,\n data: 'automation',\n properties: {\n label: ['script automation label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n disposition: 'hidden',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,UAAU;AACnB,SAASC,QAAQC,YAAY;AAE7B,SAASC,cAAcC,mBAAuC;AAC9D,SAASC,WAAW;AACpB,SAASC,kBAAkB;AAC3B,SAASC,sBAAsBC,iCAAiC;AAChE,SAASC,uBAAuB;AAChC,SAASC,oBAAoB;AAI7B,IAAA,4BAAe,CAACC,YACdC,YAAYC,aAAaC,iBAAiB;EACxCC,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACdE,WAAW,CAACC,SACVC,GAAGC,KAAK,CAACC,QACPC,KACED,IAAIH,IAAAA,GACJK,OAAOC,QAAQ,CAACN,UAAUA,MAAKO,SAAS,GAAGC,YAAAA,cAA0BH,OAAOI,KAAKT,KAAAA,IAAQK,OAAOK,KAAI,CAAA,GACpGL,OAAOM,IAAI,CAACX,UAAS;MACnB;QACEH,IAAI,cAAcG,MAAKH,EAAE;QACzBU,MAAM,GAAGT,KAAKD,EAAE;QAChBe,MAAM,GAAGd,KAAKD,EAAE;QAChBgB,YAAY;UACVC,OAAO;YAAC;YAA0B;cAAEC,IAAIjB,KAAKD;YAAG;;UAChDmB,MAAM;QACR;MACF;KACD,GACDX,OAAOY,UAAU,MAAM,CAAA,CAAE,CAAA,CAAA;EAGjC,CAAA;EACArB,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACdE,WAAW,CAACC,SACVC,GAAGC,KAAK,CAACC,QACPC,KACED,IAAIH,IAAAA,GACJK,OAAOC,QAAQ,CAACN,UAAUA,MAAKO,SAAS,GAAGC,YAAAA,cAA0BH,OAAOI,KAAKT,KAAAA,IAAQK,OAAOK,KAAI,CAAA,GACpGL,OAAOM,IAAI,CAACX,UAAS;MACnB;QACEH,IAAI,aAAaG,MAAKH,EAAE;QACxBU,MAAM,GAAGT,KAAKD,EAAE;QAChBe,MAAM,GAAGd,KAAKD,EAAE;QAChBgB,YAAY;UACVC,OAAO;YAAC;YAAyB;cAAEC,IAAIjB,KAAKD;YAAG;;UAC/CmB,MAAM;QACR;MACF;KACD,GACDX,OAAOY,UAAU,MAAM,CAAA,CAAE,CAAA,CAAA;EAGjC,CAAA;EACArB,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACdE,WAAW,CAACC,SACVC,GAAGC,KAAK,CAACC,QACPC,KACED,IAAIH,IAAAA,GACJK,OAAOC,QAAQ,CAACN,UAAUkB,IAAIC,WAAWC,YAAYpB,MAAKY,IAAI,IAAIP,OAAOI,KAAKT,KAAAA,IAAQK,OAAOK,KAAI,CAAA,GACjGL,OAAOM,IAAI,CAACX,UAAS;MACnB;QACEH,IAAI;UAACG,MAAKH;UAAI;UAAcwB,KAAKC,yBAAAA;QACjCf,MAAMgB;QACNX,MAAM;QACNC,YAAY;UACVC,OAAO;YAAC;YAA2B;cAAEC,IAAIjB,KAAKD;YAAG;;UACjDmB,MAAM;UACNQ,aAAa;QACf;MACF;KACD,GACDnB,OAAOY,UAAU,MAAM,CAAA,CAAE,CAAA,CAAA;EAGjC,CAAA;CACD;",
|
|
6
|
-
"names": ["Rx", "Option", "pipe", "Capabilities", "contributes", "Obj", "ScriptType", "PLANK_COMPANION_TYPE", "ATTENDABLE_PATH_SEPARATOR", "createExtension", "SPACE_PLUGIN", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "connector", "node", "Rx", "make", "get", "pipe", "Option", "flatMap", "type", "SPACE_PLUGIN", "some", "none", "map", "data", "properties", "label", "ns", "icon", "getOrElse", "Obj", "instanceOf", "ScriptType", "join", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "disposition"]
|
|
7
|
-
}
|