@dxos/plugin-automation 0.8.4-main.dedc0f3 → 0.8.4-main.ead640a

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.
Files changed (177) hide show
  1. package/dist/lib/browser/AutomationPanel-3PHA5FTJ.mjs +11 -0
  2. package/dist/lib/browser/AutomationSettings-OQERZHTG.mjs +69 -0
  3. package/dist/lib/browser/AutomationSettings-OQERZHTG.mjs.map +7 -0
  4. package/dist/lib/browser/{FunctionsContainer-U4HASI4P.mjs → FunctionsContainer-V3OM6BFC.mjs} +7 -7
  5. package/dist/lib/browser/FunctionsContainer-V3OM6BFC.mjs.map +7 -0
  6. package/dist/lib/browser/{FunctionsPanel-I443Y6KB.mjs → FunctionsPanel-PTFCCUTB.mjs} +3 -3
  7. package/dist/lib/browser/{app-graph-builder-4OFKIRAI.mjs → app-graph-builder-DV5HMFX4.mjs} +10 -9
  8. package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-2AOFK5FW.mjs +14 -0
  10. package/dist/lib/browser/chunk-2AOFK5FW.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-5ARH77PV.mjs +15 -0
  12. package/dist/lib/browser/chunk-5ARH77PV.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-Z5DT4MHW.mjs → chunk-DK7R2HNC.mjs} +20 -7
  14. package/dist/lib/browser/chunk-DK7R2HNC.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-MVPRI3DB.mjs +53 -0
  16. package/dist/lib/browser/chunk-MVPRI3DB.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-QACR4BJ7.mjs +14 -0
  18. package/dist/lib/browser/chunk-QACR4BJ7.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-S4SM663I.mjs → chunk-SUKAEYF3.mjs} +55 -18
  20. package/dist/lib/browser/chunk-SUKAEYF3.mjs.map +7 -0
  21. package/dist/lib/browser/{chunk-HN7OHFCB.mjs → chunk-VGBZKM3O.mjs} +3 -3
  22. package/dist/lib/browser/chunk-VGBZKM3O.mjs.map +7 -0
  23. package/dist/lib/browser/{chunk-4TWQV33E.mjs → chunk-VL3KSDVL.mjs} +57 -17
  24. package/dist/lib/browser/chunk-VL3KSDVL.mjs.map +7 -0
  25. package/dist/lib/browser/{chunk-GW5U2DGT.mjs → chunk-WWURMV25.mjs} +2 -4
  26. package/dist/lib/browser/chunk-WWURMV25.mjs.map +7 -0
  27. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs +160 -0
  28. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs.map +7 -0
  29. package/dist/lib/browser/hooks/index.mjs +12 -0
  30. package/dist/lib/browser/index.mjs +35 -14
  31. package/dist/lib/browser/index.mjs.map +4 -4
  32. package/dist/lib/browser/{intent-resolver-4PSYSQQG.mjs → intent-resolver-D2OHKQRR.mjs} +5 -5
  33. package/dist/lib/browser/{intent-resolver-4PSYSQQG.mjs.map → intent-resolver-D2OHKQRR.mjs.map} +1 -1
  34. package/dist/lib/browser/meta.json +1 -1
  35. package/dist/lib/browser/{react-surface-M52XGLXY.mjs → react-surface-POLPITTD.mjs} +18 -19
  36. package/dist/lib/browser/react-surface-POLPITTD.mjs.map +7 -0
  37. package/dist/lib/browser/types/index.mjs +2 -2
  38. package/dist/lib/node-esm/{AutomationPanel-MKOLA2FE.mjs → AutomationPanel-EETYIR35.mjs} +4 -4
  39. package/dist/lib/node-esm/AutomationSettings-MCB7HK3O.mjs +70 -0
  40. package/dist/lib/node-esm/AutomationSettings-MCB7HK3O.mjs.map +7 -0
  41. package/dist/lib/node-esm/{FunctionsContainer-VZIVURH6.mjs → FunctionsContainer-UGODP6YP.mjs} +7 -7
  42. package/dist/lib/node-esm/FunctionsContainer-UGODP6YP.mjs.map +7 -0
  43. package/dist/lib/node-esm/{FunctionsPanel-ELINCXPW.mjs → FunctionsPanel-JQFBRVOC.mjs} +3 -3
  44. package/dist/lib/node-esm/FunctionsPanel-JQFBRVOC.mjs.map +7 -0
  45. package/dist/lib/node-esm/{app-graph-builder-555IHYOB.mjs → app-graph-builder-TR2WXPX2.mjs} +10 -9
  46. package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs.map +7 -0
  47. package/dist/lib/node-esm/{chunk-NK5N3QKD.mjs → chunk-5MQJPJR2.mjs} +2 -4
  48. package/dist/lib/node-esm/chunk-5MQJPJR2.mjs.map +7 -0
  49. package/dist/lib/node-esm/{chunk-AONUBWBE.mjs → chunk-AKHETVIQ.mjs} +57 -17
  50. package/dist/lib/node-esm/chunk-AKHETVIQ.mjs.map +7 -0
  51. package/dist/lib/node-esm/{chunk-OEZNHUL2.mjs → chunk-CJUI6AKX.mjs} +3 -3
  52. package/dist/lib/node-esm/chunk-CJUI6AKX.mjs.map +7 -0
  53. package/dist/lib/node-esm/{chunk-CX2AILIS.mjs → chunk-G72KHW5A.mjs} +20 -7
  54. package/dist/lib/node-esm/chunk-G72KHW5A.mjs.map +7 -0
  55. package/dist/lib/node-esm/{chunk-ZOJVKPCA.mjs → chunk-J3XEBEIE.mjs} +55 -18
  56. package/dist/lib/node-esm/chunk-J3XEBEIE.mjs.map +7 -0
  57. package/dist/lib/node-esm/chunk-LB7UQ4SK.mjs +16 -0
  58. package/dist/lib/node-esm/chunk-LB7UQ4SK.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-QCA543ZR.mjs +54 -0
  60. package/dist/lib/node-esm/chunk-QCA543ZR.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-TXFXIA34.mjs +16 -0
  62. package/dist/lib/node-esm/chunk-TXFXIA34.mjs.map +7 -0
  63. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs +16 -0
  64. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs.map +7 -0
  65. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs +161 -0
  66. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs.map +7 -0
  67. package/dist/lib/node-esm/hooks/index.mjs +13 -0
  68. package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
  69. package/dist/lib/node-esm/index.mjs +35 -14
  70. package/dist/lib/node-esm/index.mjs.map +4 -4
  71. package/dist/lib/node-esm/{intent-resolver-6ZGBUILG.mjs → intent-resolver-2LGBVXT5.mjs} +5 -5
  72. package/dist/lib/node-esm/{intent-resolver-6ZGBUILG.mjs.map → intent-resolver-2LGBVXT5.mjs.map} +1 -1
  73. package/dist/lib/node-esm/meta.json +1 -1
  74. package/dist/lib/node-esm/{react-surface-Y6AOXM75.mjs → react-surface-5ULTTXAZ.mjs} +18 -19
  75. package/dist/lib/node-esm/react-surface-5ULTTXAZ.mjs.map +7 -0
  76. package/dist/lib/node-esm/types/index.mjs +2 -2
  77. package/dist/types/src/AutomationPlugin.d.ts +1 -1
  78. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  79. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  80. package/dist/types/src/capabilities/capabilities.d.ts +19 -0
  81. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  82. package/dist/types/src/capabilities/compute-runtime.d.ts +5 -0
  83. package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
  84. package/dist/types/src/capabilities/index.d.ts +2 -0
  85. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  86. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  87. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  88. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +3 -1
  89. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  90. package/dist/types/src/components/AutomationSettings.d.ts +5 -0
  91. package/dist/types/src/components/AutomationSettings.d.ts.map +1 -0
  92. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
  93. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
  94. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
  95. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +4 -2
  96. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  97. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +7 -4
  98. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  99. package/dist/types/src/components/TriggerSettings.d.ts +6 -0
  100. package/dist/types/src/components/TriggerSettings.d.ts.map +1 -0
  101. package/dist/types/src/components/index.d.ts +1 -1
  102. package/dist/types/src/components/index.d.ts.map +1 -1
  103. package/dist/types/src/events.d.ts +4 -0
  104. package/dist/types/src/events.d.ts.map +1 -0
  105. package/dist/types/src/hooks/index.d.ts +3 -0
  106. package/dist/types/src/hooks/index.d.ts.map +1 -0
  107. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +8 -0
  108. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
  109. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +11 -0
  110. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -0
  111. package/dist/types/src/index.d.ts +2 -0
  112. package/dist/types/src/index.d.ts.map +1 -1
  113. package/dist/types/src/meta.d.ts +0 -1
  114. package/dist/types/src/meta.d.ts.map +1 -1
  115. package/dist/types/src/translations.d.ts +3 -0
  116. package/dist/types/src/translations.d.ts.map +1 -1
  117. package/dist/types/src/types/schema.d.ts +1 -1
  118. package/dist/types/src/types/schema.d.ts.map +1 -1
  119. package/dist/types/tsconfig.tsbuildinfo +1 -1
  120. package/package.json +58 -37
  121. package/src/AutomationPlugin.tsx +35 -29
  122. package/src/capabilities/app-graph-builder.ts +8 -7
  123. package/src/capabilities/capabilities.ts +48 -0
  124. package/src/capabilities/compute-runtime.ts +138 -0
  125. package/src/capabilities/index.ts +3 -0
  126. package/src/capabilities/react-surface.tsx +13 -14
  127. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +3 -6
  128. package/src/components/AutomationPanel/AutomationPanel.tsx +78 -15
  129. package/src/components/{AutomationContainer.tsx → AutomationSettings.tsx} +8 -6
  130. package/src/components/FunctionsContainer.tsx +4 -4
  131. package/src/components/FunctionsPanel/FunctionsPanel.tsx +16 -4
  132. package/src/components/TriggerEditor/FunctionInputEditor.tsx +8 -2
  133. package/src/components/TriggerEditor/SpecSelector.tsx +10 -4
  134. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +57 -18
  135. package/src/components/TriggerEditor/TriggerEditor.tsx +35 -9
  136. package/src/components/TriggerSettings.tsx +25 -0
  137. package/src/components/index.ts +1 -1
  138. package/src/events.ts +11 -0
  139. package/src/hooks/index.ts +6 -0
  140. package/src/hooks/useComputeRuntimeCallback.ts +30 -0
  141. package/src/hooks/useTriggerRuntimeControls.ts +52 -0
  142. package/src/index.ts +2 -0
  143. package/src/meta.ts +1 -3
  144. package/src/testing/test-functions.ts +1 -1
  145. package/src/translations.ts +5 -0
  146. package/src/types/schema.ts +1 -1
  147. package/dist/lib/browser/AutomationContainer-BRV5AJZ3.mjs +0 -35
  148. package/dist/lib/browser/AutomationContainer-BRV5AJZ3.mjs.map +0 -7
  149. package/dist/lib/browser/AutomationPanel-N5HFJJXW.mjs +0 -11
  150. package/dist/lib/browser/FunctionsContainer-U4HASI4P.mjs.map +0 -7
  151. package/dist/lib/browser/app-graph-builder-4OFKIRAI.mjs.map +0 -7
  152. package/dist/lib/browser/chunk-4TWQV33E.mjs.map +0 -7
  153. package/dist/lib/browser/chunk-EIY2EUWC.mjs +0 -14
  154. package/dist/lib/browser/chunk-EIY2EUWC.mjs.map +0 -7
  155. package/dist/lib/browser/chunk-GW5U2DGT.mjs.map +0 -7
  156. package/dist/lib/browser/chunk-HN7OHFCB.mjs.map +0 -7
  157. package/dist/lib/browser/chunk-S4SM663I.mjs.map +0 -7
  158. package/dist/lib/browser/chunk-Z5DT4MHW.mjs.map +0 -7
  159. package/dist/lib/browser/react-surface-M52XGLXY.mjs.map +0 -7
  160. package/dist/lib/node-esm/AutomationContainer-FYRDTERM.mjs +0 -36
  161. package/dist/lib/node-esm/AutomationContainer-FYRDTERM.mjs.map +0 -7
  162. package/dist/lib/node-esm/FunctionsContainer-VZIVURH6.mjs.map +0 -7
  163. package/dist/lib/node-esm/app-graph-builder-555IHYOB.mjs.map +0 -7
  164. package/dist/lib/node-esm/chunk-AONUBWBE.mjs.map +0 -7
  165. package/dist/lib/node-esm/chunk-CICQ73ZT.mjs +0 -16
  166. package/dist/lib/node-esm/chunk-CICQ73ZT.mjs.map +0 -7
  167. package/dist/lib/node-esm/chunk-CX2AILIS.mjs.map +0 -7
  168. package/dist/lib/node-esm/chunk-NK5N3QKD.mjs.map +0 -7
  169. package/dist/lib/node-esm/chunk-OEZNHUL2.mjs.map +0 -7
  170. package/dist/lib/node-esm/chunk-ZOJVKPCA.mjs.map +0 -7
  171. package/dist/lib/node-esm/react-surface-Y6AOXM75.mjs.map +0 -7
  172. package/dist/types/src/components/AutomationContainer.d.ts +0 -5
  173. package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
  174. /package/dist/lib/browser/{AutomationPanel-N5HFJJXW.mjs.map → AutomationPanel-3PHA5FTJ.mjs.map} +0 -0
  175. /package/dist/lib/browser/{FunctionsPanel-I443Y6KB.mjs.map → FunctionsPanel-PTFCCUTB.mjs.map} +0 -0
  176. /package/dist/lib/{node-esm/AutomationPanel-MKOLA2FE.mjs.map → browser/hooks/index.mjs.map} +0 -0
  177. /package/dist/lib/node-esm/{FunctionsPanel-ELINCXPW.mjs.map → AutomationPanel-EETYIR35.mjs.map} +0 -0
@@ -0,0 +1,52 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/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
@@ -2,7 +2,9 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ export { AutomationCapabilities } from './capabilities';
5
6
  export * from './components';
6
7
  export * from './meta';
8
+ export * from './events';
7
9
 
8
10
  export * from './AutomationPlugin';
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: AUTOMATION_PLUGIN,
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.',
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
7
  import { ContactType } from '@dxos/client/testing';
8
8
  import { Type } from '@dxos/echo';
@@ -16,12 +16,17 @@ 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.',
22
26
  'function copy id': 'Copy Function ID',
23
27
  'no functions found': 'No functions found',
24
28
  'go to function source button label': 'Show function source',
29
+ 'delete function button label': 'Delete function',
25
30
 
26
31
  'trigger editor title': 'Configure Trigger',
27
32
  'new trigger label': 'Add Trigger',
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
7
  import { SpaceSchema } from '@dxos/react-client/echo';
8
8
 
@@ -1,35 +0,0 @@
1
- import {
2
- AutomationPanel
3
- } from "./chunk-4TWQV33E.mjs";
4
- import "./chunk-S4SM663I.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 { ControlPage, ControlSection } from "@dxos/react-ui-form";
14
- var AutomationContainer = (props) => {
15
- var _effect = _useSignals();
16
- try {
17
- const { t } = useTranslation(AUTOMATION_PLUGIN);
18
- return /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
19
- title: t("automation verbose label", {
20
- ns: AUTOMATION_PLUGIN
21
- }),
22
- description: t("automation description", {
23
- ns: AUTOMATION_PLUGIN
24
- })
25
- }, /* @__PURE__ */ React.createElement(AutomationPanel, props)));
26
- } finally {
27
- _effect.f();
28
- }
29
- };
30
- var AutomationContainer_default = AutomationContainer;
31
- export {
32
- AutomationContainer,
33
- AutomationContainer_default as default
34
- };
35
- //# sourceMappingURL=AutomationContainer-BRV5AJZ3.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 { ControlPage, ControlSection } from '@dxos/react-ui-form';\n\nimport { AUTOMATION_PLUGIN } from '../meta';\n\nimport { AutomationPanel, type AutomationPanelProps } from './AutomationPanel';\n\nexport const AutomationContainer = (props: AutomationPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n return (\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 );\n};\n\nexport default AutomationContainer;\n"],
5
- "mappings": ";;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,sBAAsB;AAC/B,SAASC,aAAaC,sBAAsB;AAMrC,IAAMC,sBAAsB,CAACC,UAAAA;;;AAClC,UAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,WACE,sBAAA,cAACC,aAAAA,MACC,sBAAA,cAACC,gBAAAA;MACCC,OAAOL,EAAE,4BAA4B;QAAEM,IAAIJ;MAAkB,CAAA;MAC7DK,aAAaP,EAAE,0BAA0B;QAAEM,IAAIJ;MAAkB,CAAA;OAEjE,sBAAA,cAACM,iBAAoBT,KAAAA,CAAAA,CAAAA;;;;AAI7B;AAEA,IAAA,8BAAeD;",
6
- "names": ["React", "useTranslation", "ControlPage", "ControlSection", "AutomationContainer", "props", "t", "useTranslation", "AUTOMATION_PLUGIN", "ControlPage", "ControlSection", "title", "ns", "description", "AutomationPanel"]
7
- }
@@ -1,11 +0,0 @@
1
- import {
2
- AutomationPanel,
3
- AutomationPanel_default
4
- } from "./chunk-4TWQV33E.mjs";
5
- import "./chunk-S4SM663I.mjs";
6
- import "./chunk-GW5U2DGT.mjs";
7
- export {
8
- AutomationPanel,
9
- AutomationPanel_default as default
10
- };
11
- //# sourceMappingURL=AutomationPanel-N5HFJJXW.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';\n\nimport { AUTOMATION_PLUGIN } from '../meta';\n\nimport { FunctionsPanel } from './FunctionsPanel';\n\nexport const FunctionsContainer = ({ space }: { space: Space }) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n return (\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 );\n};\n\nexport default FunctionsContainer;\n"],
5
- "mappings": ";;;;;;;;;AAIA,OAAOA,WAAW;AAGlB,SAASC,sBAAsB;AAC/B,SAASC,aAAaC,sBAAsB;AAMrC,IAAMC,qBAAqB,CAAC,EAAEC,MAAK,MAAoB;;;AAC5D,UAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,WACE,sBAAA,cAACC,aAAAA,MACC,sBAAA,cAACC,gBAAAA;MACCC,OAAOL,EAAE,2BAA2B;QAAEM,IAAIJ;MAAkB,CAAA;MAC5DK,aAAaP,EAAE,yBAAyB;QAAEM,IAAIJ;MAAkB,CAAA;OAEhE,sBAAA,cAACM,gBAAAA;MAAeT;;;;;AAIxB;AAEA,IAAA,6BAAeD;",
6
- "names": ["React", "useTranslation", "ControlPage", "ControlSection", "FunctionsContainer", "space", "t", "useTranslation", "AUTOMATION_PLUGIN", "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, type PluginContext, contributes } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { ScriptType } from '@dxos/functions';\nimport { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } 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,cAAkCC,mBAAmB;AAC9D,SAASC,WAAW;AACpB,SAASC,kBAAkB;AAC3B,SAASC,2BAA2BC,4BAA4B;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", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "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
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/AutomationPanel/AutomationPanel.tsx", "../../../src/components/AutomationPanel/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\nimport React, { useState } from 'react';\n\nimport { Filter, Obj } from '@dxos/echo';\nimport { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { type Space, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { Clipboard, IconButton, Input, Separator, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { ControlItem, controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\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 = ThemedClassName<{\n space: Space;\n object?: Obj.Any;\n initialTrigger?: FunctionTrigger;\n onDone?: () => void;\n}>;\n\n// TODO(burdon): Factor out common layout with ViewEditor.\nexport const AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }: AutomationPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const client = useClient();\n const triggers = useQuery(space, Filter.type(FunctionTrigger));\n const functions = useQuery(space, Filter.type(FunctionType));\n const scripts = useQuery(space, Filter.type(ScriptType));\n\n const [trigger, setTrigger] = useState<FunctionTrigger | undefined>(initialTrigger);\n const [selected, setSelected] = useState<FunctionTrigger>();\n\n const handleSelect = (trigger: FunctionTrigger) => {\n setTrigger(trigger);\n setSelected(trigger);\n };\n\n const handleAdd = () => {\n setTrigger(Obj.make(FunctionTrigger, {}));\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(Obj.make(FunctionTrigger, trigger));\n }\n\n setTrigger(undefined);\n setSelected(undefined);\n onDone?.();\n };\n\n const handleCancel: TriggerEditorProps['onCancel'] = () => {\n setTrigger(undefined);\n onDone?.();\n };\n\n if (trigger) {\n return (\n <ControlItem title={t('trigger editor title')}>\n <TriggerEditor space={space} trigger={trigger} onSave={handleSave} onCancel={handleCancel} />\n </ControlItem>\n );\n }\n\n return (\n <div className={mx(controlItemClasses, classNames)}>\n {triggers.length > 0 && (\n <List.Root<FunctionTrigger> items={triggers} isItem={Schema.is(FunctionTrigger)} getId={(field) => field.id}>\n {({ items: triggers }) => (\n <div role='list' className='flex flex-col w-full'>\n {triggers?.map((trigger) => {\n const copyAction = getCopyAction(client, trigger);\n return (\n <List.Item<FunctionTrigger>\n key={trigger.id}\n item={trigger}\n classNames={mx(grid, ghostHover, 'items-center', 'px-2')}\n >\n <Input.Root>\n <Input.Switch\n checked={trigger.enabled}\n onCheckedChange={(checked) => (trigger.enabled = checked)}\n />\n </Input.Root>\n\n <div className={'flex'}>\n <List.ItemTitle\n classNames='px-1 cursor-pointer w-0 shrink truncate'\n onClick={() => handleSelect(trigger)}\n >\n {getFunctionName(scripts, functions, trigger) ?? '∅'}\n </List.ItemTitle>\n\n {/* TODO: a better way to expose copy action */}\n {copyAction && (\n <Clipboard.IconButton\n label={t(copyAction.translationKey)}\n value={copyAction.contentProvider()}\n />\n )}\n </div>\n\n <List.ItemDeleteButton onClick={() => handleDelete(trigger)} />\n </List.Item>\n );\n })}\n </div>\n )}\n </List.Root>\n )}\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};\n\nconst getCopyAction = (client: Client, trigger: FunctionTrigger | undefined) => {\n if (trigger?.spec?.kind === 'email') {\n return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };\n }\n\n if (trigger?.spec?.kind === 'webhook') {\n return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };\n }\n\n return undefined;\n};\n\nconst getWebhookUrl = (client: Client, trigger: 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: FunctionTrigger) => {\n // TODO(wittjosiah): Truncation should be done in the UI.\n // Warning that the List component is currently a can of worms.\n const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;\n const functionObject = functions.find((fn) => fn === trigger.function?.target);\n return functionObject?.name ?? shortId;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AutomationPanel } from './AutomationPanel';\n\nexport * from './AutomationPanel';\n\nexport default AutomationPanel;\n"],
5
- "mappings": ";;;;;;;;;AAIA,SAASA,cAAc;AACvB,OAAOC,SAASC,gBAAgB;AAEhC,SAASC,QAAQC,WAAW;AAC5B,SAASC,iBAAiBC,cAAcC,kBAAkB;AAC1D,SAAsBC,iBAAiB;AACvC,SAAqBC,UAAUC,gBAAgB;AAC/C,SAASC,WAAWC,YAAYC,OAAOC,WAAiCC,sBAAsB;AAC9F,SAASC,aAAaC,0BAA0B;AAChD,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;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F;AAEA,IAAMkC,gBAAgB,CAACnD,QAAgBW,YAAAA;AACrC,MAAIA,SAAS8D,MAAMC,SAAS,SAAS;AACnC,WAAO;MAAEP,gBAAgB;MAAsBE,iBAAiB,MAAM,GAAGM,SAAShE,OAAAA,EAAUoC,EAAE;IAAgB;EAChH;AAEA,MAAIpC,SAAS8D,MAAMC,SAAS,WAAW;AACrC,WAAO;MAAEP,gBAAgB;MAAoBE,iBAAiB,MAAMO,cAAc5E,QAAQW,OAAAA;IAAS;EACrG;AAEA,SAAOS;AACT;AAEA,IAAMwD,gBAAgB,CAAC5E,QAAgBW,YAAAA;AACrC,QAAMkE,UAAUF,SAAShE,OAAAA,EAAUoC;AACnC,QAAM+B,UAAU,IAAIC,IAAI/E,OAAOgF,OAAOC,OAAOC,QAASC,SAAUC,KAAMC,GAAG;AACzE,QAAMC,WAAWR,QAAQS,SAASC,WAAW,OAAA,KAAYV,QAAQS,SAASC,WAAW,KAAA;AACrFV,UAAQS,WAAWD,WAAW,UAAU;AACxC,SAAO,IAAIP,IAAI,YAAYF,OAAAA,IAAWlE,QAAQoC,EAAE,IAAI+B,OAAAA,EAASW,SAAQ;AACvE;AAEA,IAAM1B,kBAAkB,CAACtD,SAAuBF,WAA2BI,YAAAA;AAGzE,QAAM+E,UAAU/E,QAAQgF,YAAY,GAAGhF,QAAQgF,SAASC,IAAIH,SAAQ,EAAGI,MAAM,GAAG,EAAA,CAAA;AAChF,QAAMC,iBAAiBvF,UAAUwF,KAAK,CAACC,OAAOA,OAAOrF,QAAQgF,UAAUM,MAAAA;AACvE,SAAOH,gBAAgBI,QAAQR;AACjC;;;ACtJA,IAAA,0BAAeS;",
6
- "names": ["Schema", "React", "useState", "Filter", "Obj", "FunctionTrigger", "FunctionType", "ScriptType", "useClient", "getSpace", "useQuery", "Clipboard", "IconButton", "Input", "Separator", "useTranslation", "ControlItem", "controlItemClasses", "List", "ghostHover", "mx", "grid", "AutomationPanel", "classNames", "space", "object", "initialTrigger", "onDone", "t", "useTranslation", "AUTOMATION_PLUGIN", "client", "useClient", "triggers", "useQuery", "Filter", "type", "FunctionTrigger", "functions", "FunctionType", "scripts", "ScriptType", "trigger", "setTrigger", "useState", "selected", "setSelected", "handleSelect", "handleAdd", "Obj", "make", "undefined", "handleDelete", "db", "remove", "handleSave", "Object", "assign", "add", "handleCancel", "ControlItem", "title", "TriggerEditor", "onSave", "onCancel", "div", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "Schema", "is", "getId", "field", "id", "role", "map", "copyAction", "getCopyAction", "Item", "key", "item", "ghostHover", "Input", "Switch", "checked", "enabled", "onCheckedChange", "ItemTitle", "onClick", "getFunctionName", "Clipboard", "IconButton", "label", "translationKey", "value", "contentProvider", "ItemDeleteButton", "Separator", "icon", "spec", "kind", "getSpace", "getWebhookUrl", "spaceId", "edgeUrl", "URL", "config", "values", "runtime", "services", "edge", "url", "isSecure", "protocol", "startsWith", "toString", "shortId", "function", "dxn", "slice", "functionObject", "find", "fn", "target", "name", "AutomationPanel"]
7
- }
@@ -1,14 +0,0 @@
1
- // src/components/index.ts
2
- import { lazy } from "react";
3
- var AutomationContainer = lazy(() => import("./AutomationContainer-BRV5AJZ3.mjs"));
4
- var AutomationPanel = lazy(() => import("./AutomationPanel-N5HFJJXW.mjs"));
5
- var FunctionsContainer = lazy(() => import("./FunctionsContainer-U4HASI4P.mjs"));
6
- var FunctionsPanel = lazy(() => import("./FunctionsPanel-I443Y6KB.mjs"));
7
-
8
- export {
9
- AutomationContainer,
10
- AutomationPanel,
11
- FunctionsContainer,
12
- FunctionsPanel
13
- };
14
- //# sourceMappingURL=chunk-EIY2EUWC.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport * from './TriggerEditor';\n\nexport const AutomationContainer = lazy(() => import('./AutomationContainer'));\nexport const AutomationPanel = lazy(() => import('./AutomationPanel'));\nexport const FunctionsContainer = lazy(() => import('./FunctionsContainer'));\nexport const FunctionsPanel = lazy(() => import('./FunctionsPanel'));\n"],
5
- "mappings": ";AAIA,SAASA,YAAY;AAId,IAAMC,sBAAsBC,KAAK,MAAM,OAAO,oCAAA,CAAA;AAC9C,IAAMC,kBAAkBD,KAAK,MAAM,OAAO,gCAAA,CAAA;AAC1C,IAAME,qBAAqBF,KAAK,MAAM,OAAO,mCAAA,CAAA;AAC7C,IAAMG,iBAAiBH,KAAK,MAAM,OAAO,+BAAA,CAAA;",
6
- "names": ["lazy", "AutomationContainer", "lazy", "AutomationPanel", "FunctionsContainer", "FunctionsPanel"]
7
- }
@@ -1,7 +0,0 @@
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/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
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/schema.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { SpaceSchema } from '@dxos/react-client/echo';\n\nimport { meta } from '../meta';\n\nconst TriggerTemplate = Schema.Union(\n Schema.Struct({ type: Schema.Literal('timer'), cron: Schema.String }),\n Schema.Struct({ type: Schema.Literal('queue'), queueDXN: Schema.Any }),\n);\n\nexport namespace AutomationAction {\n export class CreateTriggerFromTemplate extends Schema.TaggedClass<CreateTriggerFromTemplate>()(\n `${meta.id}/action/create-trigger-from-template`,\n {\n input: Schema.Struct({\n space: SpaceSchema,\n template: TriggerTemplate,\n enabled: Schema.optional(Schema.Boolean),\n // TODO(wittjosiah): Improve how this lookup is done.\n scriptName: Schema.optional(Schema.String),\n input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n }),\n output: Schema.Void,\n },\n ) {}\n}\n"],
5
- "mappings": ";;;;;AAIA,SAASA,cAAc;AAEvB,SAASC,mBAAmB;AAI5B,IAAMC,kBAAkBC,OAAOC,MAC7BD,OAAOE,OAAO;EAAEC,MAAMH,OAAOI,QAAQ,OAAA;EAAUC,MAAML,OAAOM;AAAO,CAAA,GACnEN,OAAOE,OAAO;EAAEC,MAAMH,OAAOI,QAAQ,OAAA;EAAUG,UAAUP,OAAOQ;AAAI,CAAA,CAAA;UAGrDC,mBAAAA;EACR,MAAMC,kCAAkCV,OAAOW,YAAW,EAC/D,GAAGC,KAAKC,EAAE,wCACV;IACEC,OAAOd,OAAOE,OAAO;MACnBa,OAAOC;MACPC,UAAUlB;MACVmB,SAASlB,OAAOmB,SAASnB,OAAOoB,OAAO;;MAEvCC,YAAYrB,OAAOmB,SAASnB,OAAOM,MAAM;MACzCQ,OAAOd,OAAOmB,SAASnB,OAAOsB,OAAO;QAAEC,KAAKvB,OAAOM;QAAQkB,OAAOxB,OAAOQ;MAAI,CAAA,CAAA;IAC/E,CAAA;IACAiB,QAAQzB,OAAO0B;EACjB,CAAA,EAAA;EACC;oBAbUhB,4BAAAA;AAcf,GAfiBD,qBAAAA,mBAAAA,CAAAA,EAAAA;;",
6
- "names": ["Schema", "SpaceSchema", "TriggerTemplate", "Schema", "Union", "Struct", "type", "Literal", "cron", "String", "queueDXN", "Any", "AutomationAction", "CreateTriggerFromTemplate", "TaggedClass", "meta", "id", "input", "space", "SpaceSchema", "template", "enabled", "optional", "Boolean", "scriptName", "Record", "key", "value", "output", "Void"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/TriggerEditor/TriggerEditor.tsx", "../../../src/components/TriggerEditor/FunctionInputEditor.tsx", "../../../src/components/TriggerEditor/SpecSelector.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { ComputeGraph } from '@dxos/conductor';\nimport { Type } from '@dxos/echo';\nimport { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';\nimport { Filter, Ref, type Space, useQuery } from '@dxos/react-client/echo';\nimport { type CustomInputMap, Form, SelectInput, useRefQueryLookupHandler } from '@dxos/react-ui-form';\n\nimport { FunctionInputEditor, type FunctionInputEditorProps } from './FunctionInputEditor';\nimport { SpecSelector } from './SpecSelector';\n\nexport type TriggerEditorProps = {\n space: Space;\n trigger: FunctionTrigger;\n onSave?: (trigger: Omit<FunctionTrigger, 'id'>) => void;\n onCancel?: () => void;\n};\n\nexport const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEditorProps) => {\n const handleSave = (values: FunctionTrigger) => {\n onSave?.(values);\n };\n\n const handleRefQueryLookup = useRefQueryLookupHandler({ space });\n const Custom = useCustomInputs(space, handleRefQueryLookup);\n\n return (\n <Form\n outerSpacing={false}\n Custom={Custom}\n schema={FunctionTrigger}\n values={trigger}\n onSave={handleSave}\n onCancel={onCancel}\n onQueryRefOptions={handleRefQueryLookup}\n />\n );\n};\n\nconst useCustomInputs = (space: Space, onQueryRefOptions: FunctionInputEditorProps['onQueryRefOptions']) => {\n const functions = useQuery(space, Filter.type(FunctionType));\n const workflows = useQuery(space, Filter.type(ComputeGraph));\n const scripts = useQuery(space, Filter.type(ScriptType));\n\n return useMemo(\n (): CustomInputMap => ({\n // Function selector.\n ['function' satisfies keyof FunctionTrigger]: (props) => {\n const getValue = useCallback(() => {\n const formValue = props.getValue();\n if (Ref.isRef(formValue)) {\n return formValue.dxn.toString() as string;\n }\n return undefined;\n }, [props]);\n\n const handleOnValueChange = useCallback(\n (_type: any, dxnString: string) => {\n const dxn = Type.DXN.parse(dxnString);\n if (dxn) {\n const ref = Ref.fromDXN(dxn);\n props.onValueChange('object', ref);\n }\n },\n [props.onValueChange],\n );\n\n return (\n <SelectInput\n {...props}\n getValue={getValue as any}\n onValueChange={handleOnValueChange}\n options={getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))}\n />\n );\n },\n\n // Spec selector.\n ['spec.kind' as const]: SpecSelector,\n\n // Function input editor.\n ['input' as const]: (props) => (\n <FunctionInputEditor {...props} functions={functions} onQueryRefOptions={onQueryRefOptions} />\n ),\n }),\n [workflows, scripts, functions],\n );\n};\n\nconst getWorkflowOptions = (graphs: ComputeGraph[]) => {\n return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));\n};\n\nconst getFunctionOptions = (scripts: ScriptType[], functions: FunctionType[]) => {\n const getLabel = (fn: FunctionType) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;\n return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:echo:@:${fn.id}` }));\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { type JsonPath } from '@dxos/echo-schema';\nimport { type FunctionType } from '@dxos/functions';\nimport { useOnTransition } from '@dxos/react-ui';\nimport { Form, type FormInputStateProps, type QueryRefOptions, useFormValues } from '@dxos/react-ui-form';\n\nexport type FunctionInputEditorProps = {\n functions: FunctionType[];\n onQueryRefOptions: QueryRefOptions;\n} & FormInputStateProps;\n\n/**\n * Editor component for function input parameters.\n */\nexport const FunctionInputEditor = ({\n functions,\n getValue,\n onValueChange,\n onQueryRefOptions,\n}: FunctionInputEditorProps) => {\n const selectedFunctionValue = useFormValues(['function' as JsonPath]);\n const selectedFunctionId = useMemo(() => {\n if (Ref.isRef(selectedFunctionValue)) {\n return selectedFunctionValue.dxn.toString().split('dxn:echo:@:').at(1);\n }\n }, [selectedFunctionValue]);\n\n const selectedFunction = useMemo(\n () => functions.find((fn) => fn.id === selectedFunctionId),\n [functions, selectedFunctionId],\n );\n\n useOnTransition(\n // Clear function parameter input when the function changes.\n selectedFunctionValue,\n (prevValue) => prevValue !== undefined && prevValue !== selectedFunctionValue,\n (currValue) => currValue !== undefined,\n () => onValueChange('object', {}),\n );\n\n const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);\n const effectSchema = useMemo(() => (inputSchema ? Type.toEffectSchema(inputSchema) : undefined), [inputSchema]);\n const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;\n\n const values = useMemo(() => getValue() ?? {}, [getValue]);\n\n const handleValuesChanged = useCallback(\n (values: any) => {\n onValueChange('object', values);\n },\n [onValueChange],\n );\n\n if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {\n return null;\n }\n\n return (\n <>\n <h3 className='text-md'>Function parameters</h3>\n {/* TODO(ZaymonFC): Try using <FormFields /> internal component for this nesting.\n This would allow errors to flow up to the root context. */}\n <Form\n schema={effectSchema}\n values={values}\n onValuesChanged={handleValuesChanged}\n onQueryRefOptions={onQueryRefOptions}\n outerSpacing={false}\n />\n </>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { type FunctionTrigger, TriggerKinds, type TriggerType } from '@dxos/functions';\nimport { useTranslation } from '@dxos/react-ui';\nimport { type InputProps, SelectInput, useInputProps } from '@dxos/react-ui-form';\n\nimport { AUTOMATION_PLUGIN } from '../../meta';\n\nexport type SpecSelectorProps = InputProps;\n\nexport const SpecSelector = (props: SpecSelectorProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const specProps = useInputProps(['spec' satisfies keyof FunctionTrigger]);\n\n const handleTypeChange = useCallback(\n (_type: any, value: string): TriggerType | undefined => {\n const getDefaultTriggerSpec = (kind: string) => {\n switch (kind) {\n case 'timer':\n return { kind: 'timer', cron: '' };\n case 'subscription':\n return { kind: 'subscription', filter: {} };\n case 'queue':\n return { kind: 'queue', queue: '' };\n case 'email':\n return { kind: 'email' };\n case 'webhook':\n return { kind: 'webhook' };\n default:\n return undefined;\n }\n };\n\n const defaultSpec = getDefaultTriggerSpec(value);\n if (!defaultSpec) {\n return;\n }\n\n // Update the entire spec object, not just the `spec.kind`.\n specProps.onValueChange('object', defaultSpec);\n },\n [specProps],\n );\n\n const options = useMemo(\n () =>\n TriggerKinds.map((kind) => ({\n value: kind,\n label: t(`trigger type ${kind}`),\n })),\n [t],\n );\n\n return <SelectInput {...props} options={options} onValueChange={handleTypeChange} />;\n};\n"],
5
- "mappings": ";;;;;;AAIA,OAAOA,UAASC,eAAAA,cAAaC,WAAAA,gBAAe;AAE5C,SAASC,oBAAoB;AAC7B,SAASC,QAAAA,aAAY;AACrB,SAASC,iBAAiBC,cAAcC,kBAAkB;AAC1D,SAASC,QAAQC,OAAAA,MAAiBC,gBAAgB;AAClD,SAA8BC,QAAAA,OAAMC,eAAAA,cAAaC,gCAAgC;;;;ACNjF,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAASC,KAAKC,YAAY;AAG1B,SAASC,uBAAuB;AAChC,SAASC,MAAsDC,qBAAqB;AAU7E,IAAMC,sBAAsB,CAAC,EAClCC,WACAC,UACAC,eACAC,kBAAiB,MACQ;;;AACzB,UAAMC,wBAAwBC,cAAc;MAAC;KAAuB;AACpE,UAAMC,qBAAqBC,QAAQ,MAAA;AACjC,UAAIC,IAAIC,MAAML,qBAAAA,GAAwB;AACpC,eAAOA,sBAAsBM,IAAIC,SAAQ,EAAGC,MAAM,aAAA,EAAeC,GAAG,CAAA;MACtE;IACF,GAAG;MAACT;KAAsB;AAE1B,UAAMU,mBAAmBP,QACvB,MAAMP,UAAUe,KAAK,CAACC,OAAOA,GAAGC,O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SAASC,EAAAA;IAAKF,OAAO,cAAcE,GAAGH,EAAE;EAAG,EAAA;AACpF;",
6
- "names": ["React", "useCallback", "useMemo", "ComputeGraph", "Type", "FunctionTrigger", "FunctionType", "ScriptType", "Filter", "Ref", "useQuery", "Form", "SelectInput", "useRefQueryLookupHandler", "React", "useCallback", "useMemo", "Ref", "Type", "useOnTransition", "Form", "useFormValues", "FunctionInputEditor", "functions", "getValue", "onValueChange", "onQueryRefOptions", "selectedFunctionValue", "useFormValues", "selectedFunctionId", "useMemo", "Ref", "isRef", "dxn", "toString", "split", "at", "selectedFunction", "find", "fn", "id", "useOnTransition", "prevValue", "undefined", "currValue", "inputSchema", "effectSchema", "Type", "toEffectSchema", "propertyCount", "properties", "Object", "keys", "length", "values", "handleValuesChanged", "useCallback", "h3", "className", "Form", "schema", "onValuesChanged", "outerSpacing", "React", "useCallback", "useMemo", "TriggerKinds", "useTranslation", "SelectInput", "useInputProps", "SpecSelector", "props", "t", "useTranslation", "AUTOMATION_PLUGIN", "specProps", "useInputProps", "handleTypeChange", "useCallback", "_type", "value", "getDefaultTriggerSpec", "kind", "cron", "filter", "queue", "undefined", "defaultSpec", "onValueChange", "options", "useMemo", "TriggerKinds", "map", "label", "React", "SelectInput", "TriggerEditor", "space", "trigger", "onSave", "onCancel", "handleSave", "values", "handleRefQueryLookup", "useRefQueryLookupHandler", "Custom", "useCustomInputs", "React", "Form", "outerSpacing", "schema", "FunctionTrigger", "onQueryRefOptions", "functions", "useQuery", "Filter", "type", "FunctionType", "workflows", "ComputeGraph", "scripts", "ScriptType", "useMemo", "props", "getValue", "useCallback", "formValue", "Ref", "isRef", "dxn", "toString", "undefined", "handleOnValueChange", "_type", "dxnString", "Type", "DXN", "parse", "ref", "fromDXN", "onValueChange", "SelectInput", "options", "getWorkflowOptions", "concat", "getFunctionOptions", "SpecSelector", "FunctionInputEditor", "graphs", "map", "graph", "label", "id", "value", "getLabel", "fn", "find", "s", "source", "target", "name"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/FunctionsPanel/FunctionsPanel.tsx", "../../../src/components/FunctionsPanel/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { FunctionType, ScriptType } from '@dxos/functions';\nimport { Filter, type Space, fullyQualifiedId, useQuery } from '@dxos/react-client/echo';\nimport { Button, useTranslation } from '@dxos/react-ui';\nimport { controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { AUTOMATION_PLUGIN } from '../../meta';\n\nconst grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';\n\nexport type FunctionsPanelProps = {\n space: Space;\n};\n\nexport const FunctionsPanel = ({ space }: FunctionsPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const functions = useQuery(space, Filter.type(FunctionType));\n const scripts = useQuery(space, Filter.type(ScriptType));\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const functionToScriptMap = useMemo(\n () =>\n functions.reduce(\n (map, func) => {\n const scriptId = func.source?.target?.id;\n if (scriptId) {\n const script = scripts.find((s) => s.id === scriptId);\n if (script) {\n map[func.id] = script;\n }\n }\n return map;\n },\n {} as Record<string, ScriptType>,\n ),\n [functions, scripts],\n );\n\n const getScriptName = useCallback(\n (func: FunctionType) => {\n const script = functionToScriptMap[func.id];\n return script?.name;\n },\n [functionToScriptMap],\n );\n\n const handleGoToScript = useCallback(\n (func: FunctionType) => {\n const script = functionToScriptMap[func.id];\n if (script) {\n void dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [fullyQualifiedId(script)] }));\n }\n },\n [functionToScriptMap, dispatch],\n );\n\n return (\n <div role='none' className={mx(controlItemClasses)}>\n {functions.length > 0 && (\n <List.Root<FunctionType> items={functions} isItem={Schema.is(FunctionType)} getId={(func) => func.id}>\n {({ items }) => (\n <div role='list' className='flex flex-col w-full'>\n {items?.map((func) => (\n <List.Item<FunctionType>\n key={func.id}\n item={func}\n classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}\n >\n <div className='flex flex-col truncate'>\n <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>\n {getScriptName(func) && (\n <div className='text-xs text-description truncate'>{getScriptName(func)}</div>\n )}\n </div>\n {functionToScriptMap[func.id] && (\n <Button onClick={() => handleGoToScript(func)}>{t('go to function source button label')}</Button>\n )}\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { FunctionsPanel } from './FunctionsPanel';\n\nexport * from './FunctionsPanel';\nexport default FunctionsPanel;\n"],
5
- "mappings": ";;;;;;AAIA,SAASA,cAAc;AACvB,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAASC,cAAcC,cAAcC,2BAA2B;AAChE,SAASC,cAAcC,kBAAkB;AACzC,SAASC,QAAoBC,kBAAkBC,gBAAgB;AAC/D,SAASC,QAAQC,sBAAsB;AACvC,SAASC,0BAA0B;AACnC,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAI/B,IAAMC,OAAO;AAMN,IAAMC,iBAAiB,CAAC,EAAEC,MAAK,MAAuB;;;AAC3D,UAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,UAAMC,YAAYC,SAASL,OAAOM,OAAOC,KAAKC,YAAAA,CAAAA;AAC9C,UAAMC,UAAUJ,SAASL,OAAOM,OAAOC,KAAKG,UAAAA,CAAAA;AAC5C,UAAM,EAAEC,iBAAiBC,SAAQ,IAAKC,oBAAAA;AAEtC,UAAMC,sBAAsBC,QAC1B,MACEX,UAAUY,OACR,CAACC,KAAKC,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b,sBAAA,cAACkB,OAAAA;MAAIE,WAAU;OAAqCZ,cAAcR,IAAAA,CAAAA,CAAAA,GAGrEJ,oBAAoBI,KAAKI,EAAE,KAC1B,sBAAA,cAACiC,QAAAA;MAAOC,SAAS,MAAM3B,iBAAiBX,IAAAA;OAAQjB,EAAE,oCAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAS/DG,UAAUqC,WAAW,KAAK,sBAAA,cAACL,OAAAA;MAAIE,WAAU;OAAmCrC,EAAE,oBAAA,CAAA,CAAA;;;;AAGrF;;;ACzFA,IAAA,yBAAewD;",
6
- "names": ["Schema", "React", "useCallback", "useMemo", "LayoutAction", "createIntent", "useIntentDispatcher", "FunctionType", "ScriptType", "Filter", "fullyQualifiedId", "useQuery", "Button", "useTranslation", "controlItemClasses", "List", "ghostHover", "mx", "grid", "FunctionsPanel", "space", "t", "useTranslation", "AUTOMATION_PLUGIN", "functions", "useQuery", "Filter", "type", "FunctionType", "scripts", "ScriptType", "dispatchPromise", "dispatch", "useIntentDispatcher", "functionToScriptMap", "useMemo", "reduce", "map", "func", "scriptId", "source", "target", "id", "script", "find", "s", "getScriptName", "useCallback", "name", "handleGoToScript", "createIntent", "LayoutAction", "Open", "part", "subject", "fullyQualifiedId", "div", "role", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "Schema", "is", "getId", "Item", "key", "item", "classNames", "ghostHover", "ItemTitle", "Button", "onClick", "FunctionsPanel"]
7
- }
@@ -1,7 +0,0 @@
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, useLayout } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { ScriptType } from '@dxos/functions';\nimport { getSpace, parseId, useSpace } from '@dxos/react-client/echo';\n\nimport { AutomationContainer, FunctionsContainer } from '../components';\nimport { meta } from '../meta';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${meta.id}/space-settings-automation`,\n role: 'article',\n filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-automation`,\n component: () => {\n const layout = useLayout();\n const { spaceId } = parseId(layout.workspace);\n const space = useSpace(spaceId);\n if (!space || !spaceId) {\n return null;\n }\n\n return <AutomationContainer space={space} />;\n },\n }),\n createSurface({\n id: `${meta.id}/space-settings-functions`,\n role: 'article',\n filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-functions`,\n component: () => {\n const layout = useLayout();\n const { spaceId } = parseId(layout.workspace);\n const space = useSpace(spaceId);\n if (!space || !spaceId) {\n return null;\n }\n\n return <FunctionsContainer space={space} />;\n },\n }),\n createSurface({\n id: `${meta.id}/companion/automation`,\n role: 'article',\n filter: (data): data is { companionTo: ScriptType; subject: 'automation' } =>\n Obj.instanceOf(ScriptType, data.companionTo) && data.subject === 'automation',\n component: ({ data, role }) => {\n return <AutomationContainer space={getSpace(data.companionTo)!} object={data.companionTo} />;\n },\n }),\n ]);\n"],
5
- "mappings": ";;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,eAAeC,iBAAiB;AACpE,SAASC,WAAW;AACpB,SAASC,kBAAkB;AAC3B,SAASC,UAAUC,SAASC,gBAAgB;AAK5C,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAsCA,KAAKC,YAAY,GAAGJ,KAAKD,EAAE;IAC1EM,WAAW,MAAA;AACT,YAAMC,SAASC,UAAAA;AACf,YAAM,EAAEC,QAAO,IAAKC,QAAQH,OAAOI,SAAS;AAC5C,YAAMC,QAAQC,SAASJ,OAAAA;AACvB,UAAI,CAACG,SAAS,CAACH,SAAS;AACtB,eAAO;MACT;AAEA,aAAO,sBAAA,cAACK,qBAAAA;QAAoBF;;IAC9B;EACF,CAAA;EACAb,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAsCA,KAAKC,YAAY,GAAGJ,KAAKD,EAAE;IAC1EM,WAAW,MAAA;AACT,YAAMC,SAASC,UAAAA;AACf,YAAM,EAAEC,QAAO,IAAKC,QAAQH,OAAOI,SAAS;AAC5C,YAAMC,QAAQC,SAASJ,OAAAA;AACvB,UAAI,CAACG,SAAS,CAACH,SAAS;AACtB,eAAO;MACT;AAEA,aAAO,sBAAA,cAACM,oBAAAA;QAAmBH;;IAC7B;EACF,CAAA;EACAb,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SACPY,IAAIC,WAAWC,YAAYd,KAAKe,WAAW,KAAKf,KAAKC,YAAY;IACnEC,WAAW,CAAC,EAAEF,MAAMF,KAAI,MAAE;AACxB,aAAO,sBAAA,cAACY,qBAAAA;QAAoBF,OAAOQ,SAAShB,KAAKe,WAAW;QAAIE,QAAQjB,KAAKe;;IAC/E;EACF,CAAA;CACD;",
6
- "names": ["React", "Capabilities", "contributes", "createSurface", "useLayout", "Obj", "ScriptType", "getSpace", "parseId", "useSpace", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "subject", "component", "layout", "useLayout", "spaceId", "parseId", "workspace", "space", "useSpace", "AutomationContainer", "FunctionsContainer", "Obj", "instanceOf", "ScriptType", "companionTo", "getSpace", "object"]
7
- }
@@ -1,36 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AutomationPanel
4
- } from "./chunk-AONUBWBE.mjs";
5
- import "./chunk-ZOJVKPCA.mjs";
6
- import {
7
- AUTOMATION_PLUGIN
8
- } from "./chunk-NK5N3QKD.mjs";
9
-
10
- // src/components/AutomationContainer.tsx
11
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
12
- import React from "react";
13
- import { useTranslation } from "@dxos/react-ui";
14
- import { ControlPage, ControlSection } from "@dxos/react-ui-form";
15
- var AutomationContainer = (props) => {
16
- var _effect = _useSignals();
17
- try {
18
- const { t } = useTranslation(AUTOMATION_PLUGIN);
19
- return /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
20
- title: t("automation verbose label", {
21
- ns: AUTOMATION_PLUGIN
22
- }),
23
- description: t("automation description", {
24
- ns: AUTOMATION_PLUGIN
25
- })
26
- }, /* @__PURE__ */ React.createElement(AutomationPanel, props)));
27
- } finally {
28
- _effect.f();
29
- }
30
- };
31
- var AutomationContainer_default = AutomationContainer;
32
- export {
33
- AutomationContainer,
34
- AutomationContainer_default as default
35
- };
36
- //# sourceMappingURL=AutomationContainer-FYRDTERM.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 { ControlPage, ControlSection } from '@dxos/react-ui-form';\n\nimport { AUTOMATION_PLUGIN } from '../meta';\n\nimport { AutomationPanel, type AutomationPanelProps } from './AutomationPanel';\n\nexport const AutomationContainer = (props: AutomationPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n return (\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 );\n};\n\nexport default AutomationContainer;\n"],
5
- "mappings": ";;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,sBAAsB;AAC/B,SAASC,aAAaC,sBAAsB;AAMrC,IAAMC,sBAAsB,CAACC,UAAAA;;;AAClC,UAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,WACE,sBAAA,cAACC,aAAAA,MACC,sBAAA,cAACC,gBAAAA;MACCC,OAAOL,EAAE,4BAA4B;QAAEM,IAAIJ;MAAkB,CAAA;MAC7DK,aAAaP,EAAE,0BAA0B;QAAEM,IAAIJ;MAAkB,CAAA;OAEjE,sBAAA,cAACM,iBAAoBT,KAAAA,CAAAA,CAAAA;;;;AAI7B;AAEA,IAAA,8BAAeD;",
6
- "names": ["React", "useTranslation", "ControlPage", "ControlSection", "AutomationContainer", "props", "t", "useTranslation", "AUTOMATION_PLUGIN", "ControlPage", "ControlSection", "title", "ns", "description", "AutomationPanel"]
7
- }
@@ -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';\n\nimport { AUTOMATION_PLUGIN } from '../meta';\n\nimport { FunctionsPanel } from './FunctionsPanel';\n\nexport const FunctionsContainer = ({ space }: { space: Space }) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n return (\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 );\n};\n\nexport default FunctionsContainer;\n"],
5
- "mappings": ";;;;;;;;;;AAIA,OAAOA,WAAW;AAGlB,SAASC,sBAAsB;AAC/B,SAASC,aAAaC,sBAAsB;AAMrC,IAAMC,qBAAqB,CAAC,EAAEC,MAAK,MAAoB;;;AAC5D,UAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,WACE,sBAAA,cAACC,aAAAA,MACC,sBAAA,cAACC,gBAAAA;MACCC,OAAOL,EAAE,2BAA2B;QAAEM,IAAIJ;MAAkB,CAAA;MAC5DK,aAAaP,EAAE,yBAAyB;QAAEM,IAAIJ;MAAkB,CAAA;OAEhE,sBAAA,cAACM,gBAAAA;MAAeT;;;;;AAIxB;AAEA,IAAA,6BAAeD;",
6
- "names": ["React", "useTranslation", "ControlPage", "ControlSection", "FunctionsContainer", "space", "t", "useTranslation", "AUTOMATION_PLUGIN", "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, type PluginContext, contributes } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { ScriptType } from '@dxos/functions';\nimport { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } 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,cAAkCC,mBAAmB;AAC9D,SAASC,WAAW;AACpB,SAASC,kBAAkB;AAC3B,SAASC,2BAA2BC,4BAA4B;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", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "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
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/AutomationPanel/AutomationPanel.tsx", "../../../src/components/AutomationPanel/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\nimport React, { useState } from 'react';\n\nimport { Filter, Obj } from '@dxos/echo';\nimport { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { type Space, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { Clipboard, IconButton, Input, Separator, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { ControlItem, controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\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 = ThemedClassName<{\n space: Space;\n object?: Obj.Any;\n initialTrigger?: FunctionTrigger;\n onDone?: () => void;\n}>;\n\n// TODO(burdon): Factor out common layout with ViewEditor.\nexport const AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }: AutomationPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const client = useClient();\n const triggers = useQuery(space, Filter.type(FunctionTrigger));\n const functions = useQuery(space, Filter.type(FunctionType));\n const scripts = useQuery(space, Filter.type(ScriptType));\n\n const [trigger, setTrigger] = useState<FunctionTrigger | undefined>(initialTrigger);\n const [selected, setSelected] = useState<FunctionTrigger>();\n\n const handleSelect = (trigger: FunctionTrigger) => {\n setTrigger(trigger);\n setSelected(trigger);\n };\n\n const handleAdd = () => {\n setTrigger(Obj.make(FunctionTrigger, {}));\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(Obj.make(FunctionTrigger, trigger));\n }\n\n setTrigger(undefined);\n setSelected(undefined);\n onDone?.();\n };\n\n const handleCancel: TriggerEditorProps['onCancel'] = () => {\n setTrigger(undefined);\n onDone?.();\n };\n\n if (trigger) {\n return (\n <ControlItem title={t('trigger editor title')}>\n <TriggerEditor space={space} trigger={trigger} onSave={handleSave} onCancel={handleCancel} />\n </ControlItem>\n );\n }\n\n return (\n <div className={mx(controlItemClasses, classNames)}>\n {triggers.length > 0 && (\n <List.Root<FunctionTrigger> items={triggers} isItem={Schema.is(FunctionTrigger)} getId={(field) => field.id}>\n {({ items: triggers }) => (\n <div role='list' className='flex flex-col w-full'>\n {triggers?.map((trigger) => {\n const copyAction = getCopyAction(client, trigger);\n return (\n <List.Item<FunctionTrigger>\n key={trigger.id}\n item={trigger}\n classNames={mx(grid, ghostHover, 'items-center', 'px-2')}\n >\n <Input.Root>\n <Input.Switch\n checked={trigger.enabled}\n onCheckedChange={(checked) => (trigger.enabled = checked)}\n />\n </Input.Root>\n\n <div className={'flex'}>\n <List.ItemTitle\n classNames='px-1 cursor-pointer w-0 shrink truncate'\n onClick={() => handleSelect(trigger)}\n >\n {getFunctionName(scripts, functions, trigger) ?? '∅'}\n </List.ItemTitle>\n\n {/* TODO: a better way to expose copy action */}\n {copyAction && (\n <Clipboard.IconButton\n label={t(copyAction.translationKey)}\n value={copyAction.contentProvider()}\n />\n )}\n </div>\n\n <List.ItemDeleteButton onClick={() => handleDelete(trigger)} />\n </List.Item>\n );\n })}\n </div>\n )}\n </List.Root>\n )}\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};\n\nconst getCopyAction = (client: Client, trigger: FunctionTrigger | undefined) => {\n if (trigger?.spec?.kind === 'email') {\n return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };\n }\n\n if (trigger?.spec?.kind === 'webhook') {\n return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };\n }\n\n return undefined;\n};\n\nconst getWebhookUrl = (client: Client, trigger: 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: FunctionTrigger) => {\n // TODO(wittjosiah): Truncation should be done in the UI.\n // Warning that the List component is currently a can of worms.\n const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;\n const functionObject = functions.find((fn) => fn === trigger.function?.target);\n return functionObject?.name ?? shortId;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AutomationPanel } from './AutomationPanel';\n\nexport * from './AutomationPanel';\n\nexport default AutomationPanel;\n"],
5
- "mappings": ";;;;;;;;;;AAIA,SAASA,cAAc;AACvB,OAAOC,SAASC,gBAAgB;AAEhC,SAASC,QAAQC,WAAW;AAC5B,SAASC,iBAAiBC,cAAcC,kBAAkB;AAC1D,SAAsBC,iBAAiB;AACvC,SAAqBC,UAAUC,gBAAgB;AAC/C,SAASC,WAAWC,YAAYC,OAAOC,WAAiCC,sBAAsB;AAC9F,SAASC,aAAaC,0BAA0B;AAChD,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAK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AEA,IAAMkC,gBAAgB,CAACnD,QAAgBW,YAAAA;AACrC,MAAIA,SAAS8D,MAAMC,SAAS,SAAS;AACnC,WAAO;MAAEP,gBAAgB;MAAsBE,iBAAiB,MAAM,GAAGM,SAAShE,OAAAA,EAAUoC,EAAE;IAAgB;EAChH;AAEA,MAAIpC,SAAS8D,MAAMC,SAAS,WAAW;AACrC,WAAO;MAAEP,gBAAgB;MAAoBE,iBAAiB,MAAMO,cAAc5E,QAAQW,OAAAA;IAAS;EACrG;AAEA,SAAOS;AACT;AAEA,IAAMwD,gBAAgB,CAAC5E,QAAgBW,YAAAA;AACrC,QAAMkE,UAAUF,SAAShE,OAAAA,EAAUoC;AACnC,QAAM+B,UAAU,IAAIC,IAAI/E,OAAOgF,OAAOC,OAAOC,QAASC,SAAUC,KAAMC,GAAG;AACzE,QAAMC,WAAWR,QAAQS,SAASC,WAAW,OAAA,KAAYV,QAAQS,SAASC,WAAW,KAAA;AACrFV,UAAQS,WAAWD,WAAW,UAAU;AACxC,SAAO,IAAIP,IAAI,YAAYF,OAAAA,IAAWlE,QAAQoC,EAAE,IAAI+B,OAAAA,EAASW,SAAQ;AACvE;AAEA,IAAM1B,kBAAkB,CAACtD,SAAuBF,WAA2BI,YAAAA;AAGzE,QAAM+E,UAAU/E,QAAQgF,YAAY,GAAGhF,QAAQgF,SAASC,IAAIH,SAAQ,EAAGI,MAAM,GAAG,EAAA,CAAA;AAChF,QAAMC,iBAAiBvF,UAAUwF,KAAK,CAACC,OAAOA,OAAOrF,QAAQgF,UAAUM,MAAAA;AACvE,SAAOH,gBAAgBI,QAAQR;AACjC;;;ACtJA,IAAA,0BAAeS;",
6
- "names": ["Schema", "React", "useState", "Filter", "Obj", "FunctionTrigger", "FunctionType", "ScriptType", "useClient", "getSpace", "useQuery", "Clipboard", "IconButton", "Input", "Separator", "useTranslation", "ControlItem", "controlItemClasses", "List", "ghostHover", "mx", "grid", "AutomationPanel", "classNames", "space", "object", "initialTrigger", "onDone", "t", "useTranslation", "AUTOMATION_PLUGIN", "client", "useClient", "triggers", "useQuery", "Filter", "type", "FunctionTrigger", "functions", "FunctionType", "scripts", "ScriptType", "trigger", "setTrigger", "useState", "selected", "setSelected", "handleSelect", "handleAdd", "Obj", "make", "undefined", "handleDelete", "db", "remove", "handleSave", "Object", "assign", "add", "handleCancel", "ControlItem", "title", "TriggerEditor", "onSave", "onCancel", "div", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "Schema", "is", "getId", "field", "id", "role", "map", "copyAction", "getCopyAction", "Item", "key", "item", "ghostHover", "Input", "Switch", "checked", "enabled", "onCheckedChange", "ItemTitle", "onClick", "getFunctionName", "Clipboard", "IconButton", "label", "translationKey", "value", "contentProvider", "ItemDeleteButton", "Separator", "icon", "spec", "kind", "getSpace", "getWebhookUrl", "spaceId", "edgeUrl", "URL", "config", "values", "runtime", "services", "edge", "url", "isSecure", "protocol", "startsWith", "toString", "shortId", "function", "dxn", "slice", "functionObject", "find", "fn", "target", "name", "AutomationPanel"]
7
- }
@@ -1,16 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/components/index.ts
4
- import { lazy } from "react";
5
- var AutomationContainer = lazy(() => import("./AutomationContainer-FYRDTERM.mjs"));
6
- var AutomationPanel = lazy(() => import("./AutomationPanel-MKOLA2FE.mjs"));
7
- var FunctionsContainer = lazy(() => import("./FunctionsContainer-VZIVURH6.mjs"));
8
- var FunctionsPanel = lazy(() => import("./FunctionsPanel-ELINCXPW.mjs"));
9
-
10
- export {
11
- AutomationContainer,
12
- AutomationPanel,
13
- FunctionsContainer,
14
- FunctionsPanel
15
- };
16
- //# sourceMappingURL=chunk-CICQ73ZT.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport * from './TriggerEditor';\n\nexport const AutomationContainer = lazy(() => import('./AutomationContainer'));\nexport const AutomationPanel = lazy(() => import('./AutomationPanel'));\nexport const FunctionsContainer = lazy(() => import('./FunctionsContainer'));\nexport const FunctionsPanel = lazy(() => import('./FunctionsPanel'));\n"],
5
- "mappings": ";;;AAIA,SAASA,YAAY;AAId,IAAMC,sBAAsBC,KAAK,MAAM,OAAO,oCAAA,CAAA;AAC9C,IAAMC,kBAAkBD,KAAK,MAAM,OAAO,gCAAA,CAAA;AAC1C,IAAME,qBAAqBF,KAAK,MAAM,OAAO,mCAAA,CAAA;AAC7C,IAAMG,iBAAiBH,KAAK,MAAM,OAAO,+BAAA,CAAA;",
6
- "names": ["lazy", "AutomationContainer", "lazy", "AutomationPanel", "FunctionsContainer", "FunctionsPanel"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/FunctionsPanel/FunctionsPanel.tsx", "../../../src/components/FunctionsPanel/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { FunctionType, ScriptType } from '@dxos/functions';\nimport { Filter, type Space, fullyQualifiedId, useQuery } from '@dxos/react-client/echo';\nimport { Button, useTranslation } from '@dxos/react-ui';\nimport { controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { AUTOMATION_PLUGIN } from '../../meta';\n\nconst grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';\n\nexport type FunctionsPanelProps = {\n space: Space;\n};\n\nexport const FunctionsPanel = ({ space }: FunctionsPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const functions = useQuery(space, Filter.type(FunctionType));\n const scripts = useQuery(space, Filter.type(ScriptType));\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const functionToScriptMap = useMemo(\n () =>\n functions.reduce(\n (map, func) => {\n const scriptId = func.source?.target?.id;\n if (scriptId) {\n const script = scripts.find((s) => s.id === scriptId);\n if (script) {\n map[func.id] = script;\n }\n }\n return map;\n },\n {} as Record<string, ScriptType>,\n ),\n [functions, scripts],\n );\n\n const getScriptName = useCallback(\n (func: FunctionType) => {\n const script = functionToScriptMap[func.id];\n return script?.name;\n },\n [functionToScriptMap],\n );\n\n const handleGoToScript = useCallback(\n (func: FunctionType) => {\n const script = functionToScriptMap[func.id];\n if (script) {\n void dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [fullyQualifiedId(script)] }));\n }\n },\n [functionToScriptMap, dispatch],\n );\n\n return (\n <div role='none' className={mx(controlItemClasses)}>\n {functions.length > 0 && (\n <List.Root<FunctionType> items={functions} isItem={Schema.is(FunctionType)} getId={(func) => func.id}>\n {({ items }) => (\n <div role='list' className='flex flex-col w-full'>\n {items?.map((func) => (\n <List.Item<FunctionType>\n key={func.id}\n item={func}\n classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}\n >\n <div className='flex flex-col truncate'>\n <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>\n {getScriptName(func) && (\n <div className='text-xs text-description truncate'>{getScriptName(func)}</div>\n )}\n </div>\n {functionToScriptMap[func.id] && (\n <Button onClick={() => handleGoToScript(func)}>{t('go to function source button label')}</Button>\n )}\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { FunctionsPanel } from './FunctionsPanel';\n\nexport * from './FunctionsPanel';\nexport default FunctionsPanel;\n"],
5
- "mappings": ";;;;;;;AAIA,SAASA,cAAc;AACvB,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAASC,cAAcC,cAAcC,2BAA2B;AAChE,SAASC,cAAcC,kBAAkB;AACzC,SAASC,QAA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AAA,cAACC,KAAKC,MAAI;MAAeC,OAAOxC;MAAWyC,QAAQC,OAAOC,GAAGvC,YAAAA;MAAewC,OAAO,CAAC9B,SAASA,KAAKI;OAC/F,CAAC,EAAEsB,MAAK,MACP,sBAAA,cAACR,OAAAA;MAAIC,MAAK;MAAOC,WAAU;OACxBM,OAAO3B,IAAI,CAACC,SACX,sBAAA,cAACwB,KAAKO,MAAI;MACRC,KAAKhC,KAAKI;MACV6B,MAAMjC;MACNkC,YAAYb,GAAGzC,MAAMuD,YAAY,gBAAgB,SAAS,eAAA;OAE1D,sBAAA,cAACjB,OAAAA;MAAIE,WAAU;OACb,sBAAA,cAACI,KAAKY,WAAS;MAACF,YAAW;OAAYlC,KAAKU,IAAI,GAC/CF,cAAcR,IAAAA,KACb,sBAAA,cAACkB,OAAAA;MAAIE,WAAU;OAAqCZ,cAAcR,IAAAA,CAAAA,CAAAA,GAGrEJ,oBAAoBI,KAAKI,EAAE,KAC1B,sBAAA,cAACiC,QAAAA;MAAOC,SAAS,MAAM3B,iBAAiBX,IAAAA;OAAQjB,EAAE,oCAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAS/DG,UAAUqC,WAAW,KAAK,sBAAA,cAACL,OAAAA;MAAIE,WAAU;OAAmCrC,EAAE,oBAAA,CAAA,CAAA;;;;AAGrF;;;ACzFA,IAAA,yBAAewD;",
6
- "names": ["Schema", "React", "useCallback", "useMemo", "LayoutAction", "createIntent", "useIntentDispatcher", "FunctionType", "ScriptType", "Filter", "fullyQualifiedId", "useQuery", "Button", "useTranslation", "controlItemClasses", "List", "ghostHover", "mx", "grid", "FunctionsPanel", "space", "t", "useTranslation", "AUTOMATION_PLUGIN", "functions", "useQuery", "Filter", "type", "FunctionType", "scripts", "ScriptType", "dispatchPromise", "dispatch", "useIntentDispatcher", "functionToScriptMap", "useMemo", "reduce", "map", "func", "scriptId", "source", "target", "id", "script", "find", "s", "getScriptName", "useCallback", "name", "handleGoToScript", "createIntent", "LayoutAction", "Open", "part", "subject", "fullyQualifiedId", "div", "role", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "Schema", "is", "getId", "Item", "key", "item", "classNames", "ghostHover", "ItemTitle", "Button", "onClick", "FunctionsPanel"]
7
- }
@@ -1,7 +0,0 @@
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/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
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/schema.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { SpaceSchema } from '@dxos/react-client/echo';\n\nimport { meta } from '../meta';\n\nconst TriggerTemplate = Schema.Union(\n Schema.Struct({ type: Schema.Literal('timer'), cron: Schema.String }),\n Schema.Struct({ type: Schema.Literal('queue'), queueDXN: Schema.Any }),\n);\n\nexport namespace AutomationAction {\n export class CreateTriggerFromTemplate extends Schema.TaggedClass<CreateTriggerFromTemplate>()(\n `${meta.id}/action/create-trigger-from-template`,\n {\n input: Schema.Struct({\n space: SpaceSchema,\n template: TriggerTemplate,\n enabled: Schema.optional(Schema.Boolean),\n // TODO(wittjosiah): Improve how this lookup is done.\n scriptName: Schema.optional(Schema.String),\n input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n }),\n output: Schema.Void,\n },\n ) {}\n}\n"],
5
- "mappings": ";;;;;;AAIA,SAASA,cAAc;AAEvB,SAASC,mBAAmB;AAI5B,IAAMC,kBAAkBC,OAAOC,MAC7BD,OAAOE,OAAO;EAAEC,MAAMH,OAAOI,QAAQ,OAAA;EAAUC,MAAML,OAAOM;AAAO,CAAA,GACnEN,OAAOE,OAAO;EAAEC,MAAMH,OAAOI,QAAQ,OAAA;EAAUG,UAAUP,OAAOQ;AAAI,CAAA,CAAA;UAGrDC,mBAAAA;EACR,MAAMC,kCAAkCV,OAAOW,YAAW,EAC/D,GAAGC,KAAKC,EAAE,wCACV;IACEC,OAAOd,OAAOE,OAAO;MACnBa,OAAOC;MACPC,UAAUlB;MACVmB,SAASlB,OAAOmB,SAASnB,OAAOoB,OAAO;;MAEvCC,YAAYrB,OAAOmB,SAASnB,OAAOM,MAAM;MACzCQ,OAAOd,OAAOmB,SAASnB,OAAOsB,OAAO;QAAEC,KAAKvB,OAAOM;QAAQkB,OAAOxB,OAAOQ;MAAI,CAAA,CAAA;IAC/E,CAAA;IACAiB,QAAQzB,OAAO0B;EACjB,CAAA,EAAA;EACC;oBAbUhB,4BAAAA;AAcf,GAfiBD,qBAAAA,mBAAAA,CAAAA,EAAAA;;",
6
- "names": ["Schema", "SpaceSchema", "TriggerTemplate", "Schema", "Union", "Struct", "type", "Literal", "cron", "String", "queueDXN", "Any", "AutomationAction", "CreateTriggerFromTemplate", "TaggedClass", "meta", "id", "input", "space", "SpaceSchema", "template", "enabled", "optional", "Boolean", "scriptName", "Record", "key", "value", "output", "Void"]
7
- }