@dxos/plugin-automation 0.8.4-main.f9ba587 → 0.8.4-main.fcc0d83b33

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 (275) hide show
  1. package/dist/lib/browser/chunk-3JLJBF5C.mjs +54 -0
  2. package/dist/lib/browser/chunk-3JLJBF5C.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  4. package/dist/lib/browser/chunk-SZIGF7TB.mjs +44 -0
  5. package/dist/lib/browser/chunk-SZIGF7TB.mjs.map +7 -0
  6. package/dist/lib/browser/cli/index.mjs +1107 -0
  7. package/dist/lib/browser/cli/index.mjs.map +7 -0
  8. package/dist/lib/browser/create-trigger-from-template-RSZIPHIG.mjs +71 -0
  9. package/dist/lib/browser/create-trigger-from-template-RSZIPHIG.mjs.map +7 -0
  10. package/dist/lib/browser/hooks/index.mjs +129 -0
  11. package/dist/lib/browser/hooks/index.mjs.map +7 -0
  12. package/dist/lib/browser/index.mjs +44 -94
  13. package/dist/lib/browser/index.mjs.map +4 -4
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/browser/operations/index.mjs +14 -0
  16. package/dist/lib/browser/operations/index.mjs.map +7 -0
  17. package/dist/lib/browser/translations.mjs +47 -0
  18. package/dist/lib/browser/translations.mjs.map +7 -0
  19. package/dist/lib/browser/types/index.mjs +14 -0
  20. package/dist/lib/node-esm/chunk-7I6EPBJI.mjs +56 -0
  21. package/dist/lib/node-esm/chunk-7I6EPBJI.mjs.map +7 -0
  22. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  23. package/dist/lib/node-esm/chunk-TR5BMZG5.mjs +45 -0
  24. package/dist/lib/node-esm/chunk-TR5BMZG5.mjs.map +7 -0
  25. package/dist/lib/node-esm/cli/index.mjs +1108 -0
  26. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  27. package/dist/lib/node-esm/create-trigger-from-template-GE76I6FE.mjs +72 -0
  28. package/dist/lib/node-esm/create-trigger-from-template-GE76I6FE.mjs.map +7 -0
  29. package/dist/lib/node-esm/hooks/index.mjs +130 -0
  30. package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
  31. package/dist/lib/node-esm/index.mjs +44 -94
  32. package/dist/lib/node-esm/index.mjs.map +4 -4
  33. package/dist/lib/node-esm/meta.json +1 -1
  34. package/dist/lib/node-esm/operations/index.mjs +15 -0
  35. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  36. package/dist/lib/node-esm/translations.mjs +48 -0
  37. package/dist/lib/node-esm/translations.mjs.map +7 -0
  38. package/dist/lib/node-esm/types/index.mjs +15 -0
  39. package/dist/types/src/AutomationPlugin.d.ts +2 -1
  40. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  41. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  42. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  43. package/dist/types/src/capabilities/compute-runtime.d.ts +14 -0
  44. package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
  45. package/dist/types/src/capabilities/index.d.ts +6 -3
  46. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  47. package/dist/types/src/capabilities/node.d.ts +3 -0
  48. package/dist/types/src/capabilities/node.d.ts.map +1 -0
  49. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  50. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  51. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  52. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  53. package/dist/types/src/cli/commands/index.d.ts +2 -0
  54. package/dist/types/src/cli/commands/index.d.ts.map +1 -0
  55. package/dist/types/src/cli/commands/trigger/create/index.d.ts +25 -0
  56. package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +1 -0
  57. package/dist/types/src/cli/commands/trigger/create/queue.d.ts +13 -0
  58. package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +1 -0
  59. package/dist/types/src/cli/commands/trigger/create/subscription.d.ts +15 -0
  60. package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +1 -0
  61. package/dist/types/src/cli/commands/trigger/create/timer.d.ts +13 -0
  62. package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +1 -0
  63. package/dist/types/src/cli/commands/trigger/index.d.ts +57 -0
  64. package/dist/types/src/cli/commands/trigger/index.d.ts.map +1 -0
  65. package/dist/types/src/cli/commands/trigger/list.d.ts +7 -0
  66. package/dist/types/src/cli/commands/trigger/list.d.ts.map +1 -0
  67. package/dist/types/src/cli/commands/trigger/options.d.ts +11 -0
  68. package/dist/types/src/cli/commands/trigger/options.d.ts.map +1 -0
  69. package/dist/types/src/cli/commands/trigger/remove.d.ts +8 -0
  70. package/dist/types/src/cli/commands/trigger/remove.d.ts.map +1 -0
  71. package/dist/types/src/cli/commands/trigger/update/index.d.ts +28 -0
  72. package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +1 -0
  73. package/dist/types/src/cli/commands/trigger/update/queue.d.ts +12 -0
  74. package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +1 -0
  75. package/dist/types/src/cli/commands/trigger/update/subscription.d.ts +13 -0
  76. package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +1 -0
  77. package/dist/types/src/cli/commands/trigger/update/timer.d.ts +11 -0
  78. package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +1 -0
  79. package/dist/types/src/cli/commands/trigger/util.d.ts +46 -0
  80. package/dist/types/src/cli/commands/trigger/util.d.ts.map +1 -0
  81. package/dist/types/src/cli/index.d.ts +2 -0
  82. package/dist/types/src/cli/index.d.ts.map +1 -0
  83. package/dist/types/src/cli/plugin.d.ts +3 -0
  84. package/dist/types/src/cli/plugin.d.ts.map +1 -0
  85. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +3 -3
  86. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  87. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +50 -4
  88. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  89. package/dist/types/src/components/AutomationPanel/index.d.ts.map +1 -1
  90. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
  91. package/dist/types/src/components/FunctionsPanel/index.d.ts.map +1 -1
  92. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +8 -0
  93. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
  94. package/dist/types/src/components/FunctionsRegistry/index.d.ts +4 -0
  95. package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
  96. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
  97. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
  98. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
  99. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
  100. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +11 -8
  101. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  102. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +121 -4
  103. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  104. package/dist/types/src/components/index.d.ts +2 -3
  105. package/dist/types/src/components/index.d.ts.map +1 -1
  106. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +6 -0
  107. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
  108. package/dist/types/src/containers/AutomationSettings/index.d.ts +2 -0
  109. package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
  110. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts +4 -0
  111. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
  112. package/dist/types/src/containers/FunctionsContainer/index.d.ts +2 -0
  113. package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -0
  114. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts +6 -0
  115. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
  116. package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
  117. package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
  118. package/dist/types/src/containers/index.d.ts +5 -0
  119. package/dist/types/src/containers/index.d.ts.map +1 -0
  120. package/dist/types/src/hooks/index.d.ts +5 -0
  121. package/dist/types/src/hooks/index.d.ts.map +1 -0
  122. package/dist/types/src/hooks/useComputeRuntime.d.ts +8 -0
  123. package/dist/types/src/hooks/useComputeRuntime.d.ts.map +1 -0
  124. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +9 -0
  125. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
  126. package/dist/types/src/hooks/useComputeRuntimeService.d.ts +17 -0
  127. package/dist/types/src/hooks/useComputeRuntimeService.d.ts.map +1 -0
  128. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +12 -0
  129. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -0
  130. package/dist/types/src/index.d.ts +2 -3
  131. package/dist/types/src/index.d.ts.map +1 -1
  132. package/dist/types/src/meta.d.ts +2 -3
  133. package/dist/types/src/meta.d.ts.map +1 -1
  134. package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
  135. package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
  136. package/dist/types/src/operations/definitions.d.ts +19 -0
  137. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  138. package/dist/types/src/operations/index.d.ts +4 -0
  139. package/dist/types/src/operations/index.d.ts.map +1 -0
  140. package/dist/types/src/testing/test-functions.d.ts +204 -3
  141. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  142. package/dist/types/src/translations.d.ts +32 -26
  143. package/dist/types/src/translations.d.ts.map +1 -1
  144. package/dist/types/src/types/capabilities.d.ts +25 -0
  145. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  146. package/dist/types/src/types/events.d.ts +5 -0
  147. package/dist/types/src/types/events.d.ts.map +1 -0
  148. package/dist/types/src/types/index.d.ts +4 -0
  149. package/dist/types/src/types/index.d.ts.map +1 -0
  150. package/dist/types/src/{types.d.ts → types/schema.d.ts} +13 -5
  151. package/dist/types/src/types/schema.d.ts.map +1 -0
  152. package/dist/types/tsconfig.tsbuildinfo +1 -1
  153. package/package.json +110 -46
  154. package/src/AutomationPlugin.tsx +22 -34
  155. package/src/capabilities/app-graph-builder.ts +56 -79
  156. package/src/capabilities/compute-runtime.ts +320 -0
  157. package/src/capabilities/index.ts +9 -4
  158. package/src/capabilities/node.ts +7 -0
  159. package/src/capabilities/operation-handler.ts +16 -0
  160. package/src/capabilities/react-surface.tsx +49 -46
  161. package/src/cli/commands/index.ts +5 -0
  162. package/src/cli/commands/trigger/create/index.ts +14 -0
  163. package/src/cli/commands/trigger/create/queue.ts +87 -0
  164. package/src/cli/commands/trigger/create/subscription.ts +126 -0
  165. package/src/cli/commands/trigger/create/timer.ts +91 -0
  166. package/src/cli/commands/trigger/index.ts +16 -0
  167. package/src/cli/commands/trigger/list.ts +70 -0
  168. package/src/cli/commands/trigger/options.ts +59 -0
  169. package/src/cli/commands/trigger/remove.ts +45 -0
  170. package/src/cli/commands/trigger/update/index.ts +14 -0
  171. package/src/cli/commands/trigger/update/queue.ts +195 -0
  172. package/src/cli/commands/trigger/update/subscription.ts +279 -0
  173. package/src/cli/commands/trigger/update/timer.ts +194 -0
  174. package/src/cli/commands/trigger/util.ts +411 -0
  175. package/src/cli/index.ts +5 -0
  176. package/src/cli/plugin.ts +23 -0
  177. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +18 -17
  178. package/src/components/AutomationPanel/AutomationPanel.tsx +250 -94
  179. package/src/components/FunctionsPanel/FunctionsPanel.tsx +52 -32
  180. package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +114 -0
  181. package/src/components/FunctionsRegistry/index.ts +8 -0
  182. package/src/components/TriggerEditor/FunctionInputEditor.tsx +42 -35
  183. package/src/components/TriggerEditor/SpecSelector.tsx +34 -22
  184. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +129 -40
  185. package/src/components/TriggerEditor/TriggerEditor.tsx +110 -48
  186. package/src/components/index.ts +1 -2
  187. package/src/containers/AutomationSettings/AutomationSettings.tsx +31 -0
  188. package/src/containers/AutomationSettings/index.ts +5 -0
  189. package/src/containers/FunctionsContainer/FunctionsContainer.tsx +33 -0
  190. package/src/containers/FunctionsContainer/index.ts +5 -0
  191. package/src/containers/TriggerSettings/TriggerSettings.tsx +48 -0
  192. package/src/containers/TriggerSettings/index.ts +6 -0
  193. package/src/containers/index.ts +9 -0
  194. package/src/hooks/index.ts +9 -0
  195. package/src/hooks/useComputeRuntime.ts +30 -0
  196. package/src/hooks/useComputeRuntimeCallback.ts +32 -0
  197. package/src/hooks/useComputeRuntimeService.ts +64 -0
  198. package/src/hooks/useTriggerRuntimeControls.ts +70 -0
  199. package/src/index.ts +2 -4
  200. package/src/meta.ts +9 -8
  201. package/src/operations/create-trigger-from-template.ts +72 -0
  202. package/src/operations/definitions.ts +28 -0
  203. package/src/operations/index.ts +9 -0
  204. package/src/testing/test-functions.ts +10 -7
  205. package/src/translations.ts +39 -29
  206. package/src/types/capabilities.ts +48 -0
  207. package/src/types/events.ts +11 -0
  208. package/src/types/index.ts +7 -0
  209. package/src/{types.ts → types/schema.ts} +6 -8
  210. package/dist/lib/browser/AutomationContainer-VZNV2ZQF.mjs +0 -38
  211. package/dist/lib/browser/AutomationContainer-VZNV2ZQF.mjs.map +0 -7
  212. package/dist/lib/browser/AutomationPanel-ZWA6GOFY.mjs +0 -11
  213. package/dist/lib/browser/FunctionsContainer-IOB333TX.mjs +0 -39
  214. package/dist/lib/browser/FunctionsContainer-IOB333TX.mjs.map +0 -7
  215. package/dist/lib/browser/FunctionsPanel-56ZKRVM5.mjs +0 -10
  216. package/dist/lib/browser/app-graph-builder-ZTAUTFI4.mjs +0 -80
  217. package/dist/lib/browser/app-graph-builder-ZTAUTFI4.mjs.map +0 -7
  218. package/dist/lib/browser/chunk-ECSTS2UI.mjs +0 -14
  219. package/dist/lib/browser/chunk-ECSTS2UI.mjs.map +0 -7
  220. package/dist/lib/browser/chunk-ERTIGJYE.mjs +0 -147
  221. package/dist/lib/browser/chunk-ERTIGJYE.mjs.map +0 -7
  222. package/dist/lib/browser/chunk-FSJZXTS2.mjs +0 -230
  223. package/dist/lib/browser/chunk-FSJZXTS2.mjs.map +0 -7
  224. package/dist/lib/browser/chunk-GW5U2DGT.mjs +0 -15
  225. package/dist/lib/browser/chunk-GW5U2DGT.mjs.map +0 -7
  226. package/dist/lib/browser/chunk-LYJVTIVD.mjs +0 -94
  227. package/dist/lib/browser/chunk-LYJVTIVD.mjs.map +0 -7
  228. package/dist/lib/browser/chunk-S2LE7SYB.mjs +0 -39
  229. package/dist/lib/browser/chunk-S2LE7SYB.mjs.map +0 -7
  230. package/dist/lib/browser/intent-resolver-YLRSMLH4.mjs +0 -76
  231. package/dist/lib/browser/intent-resolver-YLRSMLH4.mjs.map +0 -7
  232. package/dist/lib/browser/react-surface-4DFSM7OX.mjs +0 -64
  233. package/dist/lib/browser/react-surface-4DFSM7OX.mjs.map +0 -7
  234. package/dist/lib/browser/types.mjs +0 -8
  235. package/dist/lib/node-esm/AutomationContainer-WMIH3F4V.mjs +0 -39
  236. package/dist/lib/node-esm/AutomationContainer-WMIH3F4V.mjs.map +0 -7
  237. package/dist/lib/node-esm/AutomationPanel-YYUMSK2W.mjs +0 -12
  238. package/dist/lib/node-esm/FunctionsContainer-DJWB6WFH.mjs +0 -40
  239. package/dist/lib/node-esm/FunctionsContainer-DJWB6WFH.mjs.map +0 -7
  240. package/dist/lib/node-esm/FunctionsPanel-KGIOZSPZ.mjs +0 -11
  241. package/dist/lib/node-esm/FunctionsPanel-KGIOZSPZ.mjs.map +0 -7
  242. package/dist/lib/node-esm/app-graph-builder-3FP63ZSG.mjs +0 -81
  243. package/dist/lib/node-esm/app-graph-builder-3FP63ZSG.mjs.map +0 -7
  244. package/dist/lib/node-esm/chunk-AZH66CED.mjs +0 -231
  245. package/dist/lib/node-esm/chunk-AZH66CED.mjs.map +0 -7
  246. package/dist/lib/node-esm/chunk-HIMYPGHF.mjs +0 -148
  247. package/dist/lib/node-esm/chunk-HIMYPGHF.mjs.map +0 -7
  248. package/dist/lib/node-esm/chunk-NK5N3QKD.mjs +0 -17
  249. package/dist/lib/node-esm/chunk-NK5N3QKD.mjs.map +0 -7
  250. package/dist/lib/node-esm/chunk-SGZPTJ47.mjs +0 -16
  251. package/dist/lib/node-esm/chunk-SGZPTJ47.mjs.map +0 -7
  252. package/dist/lib/node-esm/chunk-UKATFY3R.mjs +0 -40
  253. package/dist/lib/node-esm/chunk-UKATFY3R.mjs.map +0 -7
  254. package/dist/lib/node-esm/chunk-ZGPUV5VS.mjs +0 -95
  255. package/dist/lib/node-esm/chunk-ZGPUV5VS.mjs.map +0 -7
  256. package/dist/lib/node-esm/intent-resolver-LU7EYWEO.mjs +0 -77
  257. package/dist/lib/node-esm/intent-resolver-LU7EYWEO.mjs.map +0 -7
  258. package/dist/lib/node-esm/react-surface-3PNW7NDW.mjs +0 -65
  259. package/dist/lib/node-esm/react-surface-3PNW7NDW.mjs.map +0 -7
  260. package/dist/lib/node-esm/types.mjs +0 -9
  261. package/dist/lib/node-esm/types.mjs.map +0 -7
  262. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  263. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  264. package/dist/types/src/components/AutomationContainer.d.ts +0 -5
  265. package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
  266. package/dist/types/src/components/FunctionsContainer.d.ts +0 -7
  267. package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
  268. package/dist/types/src/types.d.ts.map +0 -1
  269. package/src/capabilities/intent-resolver.ts +0 -72
  270. package/src/components/AutomationContainer.tsx +0 -30
  271. package/src/components/FunctionsContainer.tsx +0 -31
  272. /package/dist/lib/browser/{AutomationPanel-ZWA6GOFY.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
  273. /package/dist/lib/browser/{FunctionsPanel-56ZKRVM5.mjs.map → types/index.mjs.map} +0 -0
  274. /package/dist/lib/{browser/types.mjs.map → node-esm/chunk-HSLMI22Q.mjs.map} +0 -0
  275. /package/dist/lib/node-esm/{AutomationPanel-YYUMSK2W.mjs.map → types/index.mjs.map} +0 -0
@@ -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 {\n FunctionType,\n FunctionTrigger,\n FunctionTriggerSchema,\n type FunctionTriggerType,\n ScriptType,\n TriggerKind,\n} from '@dxos/functions';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { useQuery, type Space, getSpace } from '@dxos/react-client/echo';\nimport { Clipboard, IconButton, Input, Separator, useTranslation } from '@dxos/react-ui';\nimport { ControlItem, controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { AUTOMATION_PLUGIN } from '../../meta';\nimport { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';\n\nconst grid = 'grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]';\n\nexport type AutomationPanelProps = {\n space: Space;\n object?: Obj.Any;\n initialTrigger?: FunctionTriggerType;\n onDone?: () => void;\n};\n\n// TODO(burdon): Factor out common layout with ViewEditor.\nexport const AutomationPanel = ({ space, object, initialTrigger, onDone }: AutomationPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const client = useClient();\n const triggers = useQuery(space, Filter.type(FunctionTrigger));\n const functions = useQuery(space, Filter.type(FunctionType));\n const scripts = useQuery(space, Filter.type(ScriptType));\n\n const [trigger, setTrigger] = useState<FunctionTriggerType | undefined>(initialTrigger);\n const [selected, setSelected] = useState<FunctionTrigger>();\n\n const handleSelect = (trigger: FunctionTrigger) => {\n const { id: _, ...values } = trigger;\n setTrigger(values);\n setSelected(trigger);\n };\n\n const handleAdd = () => {\n setTrigger(Obj.make(FunctionTriggerSchema, {}));\n setSelected(undefined);\n };\n\n const handleDelete = (trigger: FunctionTrigger) => {\n space.db.remove(trigger);\n setTrigger(undefined);\n setSelected(undefined);\n };\n\n const handleSave: TriggerEditorProps['onSave'] = (trigger) => {\n if (selected) {\n Object.assign(selected, trigger);\n } else {\n space.db.add(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={controlItemClasses}>\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 === TriggerKind.Email) {\n return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };\n }\n\n if (trigger?.spec?.kind === TriggerKind.Webhook) {\n return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };\n }\n\n return undefined;\n};\n\nconst getWebhookUrl = (client: Client, trigger: FunctionTrigger) => {\n const spaceId = getSpace(trigger)!.id;\n const edgeUrl = new URL(client.config.values.runtime!.services!.edge!.url!);\n const isSecure = edgeUrl.protocol.startsWith('https') || edgeUrl.protocol.startsWith('wss');\n edgeUrl.protocol = isSecure ? 'https' : 'http';\n return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();\n};\n\nconst getFunctionName = (scripts: ScriptType[], functions: FunctionType[], trigger: FunctionTriggerType) => {\n // TODO(wittjosiah): Truncation should be done in the UI.\n // Warning that the List component is currently a can of worms.\n const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;\n const functionObject = functions.find((fn) => fn === trigger.function?.target);\n if (!functionObject) {\n return shortId;\n }\n\n return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ?? shortId;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AutomationPanel } from './AutomationPanel';\n\nexport * from './AutomationPanel';\n\nexport default AutomationPanel;\n"],
5
- "mappings": ";;;;;;;;;;AAIA,SAASA,cAAc;AACvB,OAAOC,SAASC,gBAAgB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QsF,UAAUM,MAAAA;AACvE,MAAI,CAACH,gBAAgB;AACnB,WAAOJ;EACT;AAEA,SAAOvF,QAAQ4F,KAAK,CAACG,MAAMJ,eAAeK,QAAQF,QAAQtF,OAAOuF,EAAEvF,EAAE,GAAGyF,QAAQV;AAClF;;;AClKA,IAAA,0BAAeW;",
6
- "names": ["Schema", "React", "useState", "Filter", "Obj", "FunctionType", "FunctionTrigger", "FunctionTriggerSchema", "ScriptType", "TriggerKind", "useClient", "useQuery", "getSpace", "Clipboard", "IconButton", "Input", "Separator", "useTranslation", "ControlItem", "controlItemClasses", "List", "ghostHover", "mx", "grid", "AutomationPanel", "space", "object", "initialTrigger", "onDone", "t", "useTranslation", "AUTOMATION_PLUGIN", "client", "useClient", "triggers", "useQuery", "Filter", "type", "FunctionTrigger", "functions", "FunctionType", "scripts", "ScriptType", "trigger", "setTrigger", "useState", "selected", "setSelected", "handleSelect", "id", "_", "values", "handleAdd", "Obj", "make", "FunctionTriggerSchema", "undefined", "handleDelete", "db", "remove", "handleSave", "Object", "assign", "add", "handleCancel", "ControlItem", "title", "TriggerEditor", "onSave", "onCancel", "div", "className", "controlItemClasses", "length", "List", "Root", "items", "isItem", "Schema", "is", "getId", "field", "role", "map", "copyAction", "getCopyAction", "Item", "key", "item", "classNames", "mx", "ghostHover", "Input", "Switch", "checked", "enabled", "onCheckedChange", "ItemTitle", "onClick", "getFunctionName", "Clipboard", "IconButton", "label", "translationKey", "value", "contentProvider", "ItemDeleteButton", "Separator", "icon", "spec", "kind", "TriggerKind", "Email", "getSpace", "Webhook", "getWebhookUrl", "spaceId", "edgeUrl", "URL", "config", "runtime", "services", "edge", "url", "isSecure", "protocol", "startsWith", "toString", "shortId", "function", "dxn", "slice", "functionObject", "find", "fn", "target", "s", "source", "name", "AutomationPanel"]
7
- }
@@ -1,17 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/meta.ts
4
- var AUTOMATION_PLUGIN = "dxos.org/plugin/automation";
5
- var meta = {
6
- id: AUTOMATION_PLUGIN,
7
- name: "Automation",
8
- description: "The Automation tab allows you to trigger pre-defined workflows related to the element you are interacting with inside of Composer.",
9
- icon: "ph--robot--regular",
10
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation"
11
- };
12
-
13
- export {
14
- AUTOMATION_PLUGIN,
15
- meta
16
- };
17
- //# sourceMappingURL=chunk-NK5N3QKD.mjs.map
@@ -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,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-WMIH3F4V.mjs"));
6
- var AutomationPanel = lazy(() => import("./AutomationPanel-YYUMSK2W.mjs"));
7
- var FunctionsContainer = lazy(() => import("./FunctionsContainer-DJWB6WFH.mjs"));
8
- var FunctionsPanel = lazy(() => import("./FunctionsPanel-KGIOZSPZ.mjs"));
9
-
10
- export {
11
- AutomationContainer,
12
- AutomationPanel,
13
- FunctionsContainer,
14
- FunctionsPanel
15
- };
16
- //# sourceMappingURL=chunk-SGZPTJ47.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,40 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AUTOMATION_PLUGIN
4
- } from "./chunk-NK5N3QKD.mjs";
5
-
6
- // src/types.ts
7
- import { Schema } from "effect";
8
- import { SpaceSchema } from "@dxos/react-client/echo";
9
- var TriggerTemplate = Schema.Union(Schema.Struct({
10
- type: Schema.Literal("timer"),
11
- cron: Schema.String
12
- }), Schema.Struct({
13
- type: Schema.Literal("queue"),
14
- queueDXN: Schema.Any
15
- }));
16
- (function(AutomationAction2) {
17
- const AUTOMATION_ACTION = `${AUTOMATION_PLUGIN}/action`;
18
- class CreateTriggerFromTemplate extends Schema.TaggedClass()(`${AUTOMATION_ACTION}/create-trigger-from-template`, {
19
- input: Schema.Struct({
20
- space: SpaceSchema,
21
- template: TriggerTemplate,
22
- enabled: Schema.optional(Schema.Boolean),
23
- // TODO(wittjosiah): Improve how this lookup is done.
24
- scriptName: Schema.optional(Schema.String),
25
- input: Schema.optional(Schema.Record({
26
- key: Schema.String,
27
- value: Schema.Any
28
- }))
29
- }),
30
- output: Schema.Void
31
- }) {
32
- }
33
- AutomationAction2.CreateTriggerFromTemplate = CreateTriggerFromTemplate;
34
- })(AutomationAction || (AutomationAction = {}));
35
- var AutomationAction;
36
-
37
- export {
38
- AutomationAction
39
- };
40
- //# sourceMappingURL=chunk-UKATFY3R.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { SpaceSchema } from '@dxos/react-client/echo';\n\nimport { AUTOMATION_PLUGIN } 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 const AUTOMATION_ACTION = `${AUTOMATION_PLUGIN}/action`;\n\n export class CreateTriggerFromTemplate extends Schema.TaggedClass<CreateTriggerFromTemplate>()(\n `${AUTOMATION_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;AACf,QAAMC,oBAAoB,GAAGC,iBAAAA;EAEtB,MAAMC,kCAAkCZ,OAAOa,YAAW,EAC/D,GAAGH,iBAAAA,iCACH;IACEI,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;oBAbUd,4BAAAA;AAcf,GAjBiBH,qBAAAA,mBAAAA,CAAAA,EAAAA;;",
6
- "names": ["Schema", "SpaceSchema", "TriggerTemplate", "Schema", "Union", "Struct", "type", "Literal", "cron", "String", "queueDXN", "Any", "AutomationAction", "AUTOMATION_ACTION", "AUTOMATION_PLUGIN", "CreateTriggerFromTemplate", "TaggedClass", "input", "space", "SpaceSchema", "template", "enabled", "optional", "Boolean", "scriptName", "Record", "key", "value", "output", "Void"]
7
- }
@@ -1,95 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AUTOMATION_PLUGIN
4
- } from "./chunk-NK5N3QKD.mjs";
5
-
6
- // src/components/FunctionsPanel/FunctionsPanel.tsx
7
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
8
- import { Schema } from "effect";
9
- import React, { useCallback, useMemo } from "react";
10
- import { createIntent, LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
11
- import { FunctionType, ScriptType } from "@dxos/functions";
12
- import { Filter, fullyQualifiedId, useQuery } from "@dxos/react-client/echo";
13
- import { Button, useTranslation } from "@dxos/react-ui";
14
- import { controlItemClasses } from "@dxos/react-ui-form";
15
- import { List } from "@dxos/react-ui-list";
16
- import { ghostHover, mx } from "@dxos/react-ui-theme";
17
- var grid = "grid grid-cols-[1fr_auto] min-bs-[2.5rem]";
18
- var FunctionsPanel = ({ space }) => {
19
- var _effect = _useSignals();
20
- try {
21
- const { t } = useTranslation(AUTOMATION_PLUGIN);
22
- const functions = useQuery(space, Filter.type(FunctionType));
23
- const scripts = useQuery(space, Filter.type(ScriptType));
24
- const { dispatchPromise: dispatch } = useIntentDispatcher();
25
- const functionToScriptMap = useMemo(() => functions.reduce((map, func) => {
26
- const scriptId = func.source?.target?.id;
27
- if (scriptId) {
28
- const script = scripts.find((s) => s.id === scriptId);
29
- if (script) {
30
- map[func.id] = script;
31
- }
32
- }
33
- return map;
34
- }, {}), [
35
- functions,
36
- scripts
37
- ]);
38
- const getScriptName = useCallback((func) => {
39
- const script = functionToScriptMap[func.id];
40
- return script?.name;
41
- }, [
42
- functionToScriptMap
43
- ]);
44
- const handleGoToScript = useCallback((func) => {
45
- const script = functionToScriptMap[func.id];
46
- if (script) {
47
- void dispatch(createIntent(LayoutAction.Open, {
48
- part: "main",
49
- subject: [
50
- fullyQualifiedId(script)
51
- ]
52
- }));
53
- }
54
- }, [
55
- functionToScriptMap,
56
- dispatch
57
- ]);
58
- return /* @__PURE__ */ React.createElement("div", {
59
- role: "none",
60
- className: mx(controlItemClasses)
61
- }, functions.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
62
- items: functions,
63
- isItem: Schema.is(FunctionType),
64
- getId: (func) => func.id
65
- }, ({ items }) => /* @__PURE__ */ React.createElement("div", {
66
- role: "list",
67
- className: "flex flex-col w-full"
68
- }, items?.map((func) => /* @__PURE__ */ React.createElement(List.Item, {
69
- key: func.id,
70
- item: func,
71
- classNames: mx(grid, ghostHover, "items-center", "pli-2", "min-bs-[3rem]")
72
- }, /* @__PURE__ */ React.createElement("div", {
73
- className: "flex flex-col truncate"
74
- }, /* @__PURE__ */ React.createElement(List.ItemTitle, {
75
- classNames: "truncate"
76
- }, func.name), getScriptName(func) && /* @__PURE__ */ React.createElement("div", {
77
- className: "text-xs text-description truncate"
78
- }, getScriptName(func))), functionToScriptMap[func.id] && /* @__PURE__ */ React.createElement(Button, {
79
- onClick: () => handleGoToScript(func)
80
- }, t("go to function source button label")))))), functions.length === 0 && /* @__PURE__ */ React.createElement("div", {
81
- className: "text-center plb-4 text-gray-500"
82
- }, t("no functions found")));
83
- } finally {
84
- _effect.f();
85
- }
86
- };
87
-
88
- // src/components/FunctionsPanel/index.ts
89
- var FunctionsPanel_default = FunctionsPanel;
90
-
91
- export {
92
- FunctionsPanel,
93
- FunctionsPanel_default
94
- };
95
- //# sourceMappingURL=chunk-ZGPUV5VS.mjs.map
@@ -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 { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { FunctionType, ScriptType } from '@dxos/functions';\nimport { Filter, fullyQualifiedId, useQuery, type Space } 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,QAAQC,kBAAkBC,gBAA4B;AAC/D,SAASC,QAAQC,sBAAsB;AACvC,SAASC,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AAGvC,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", "createIntent", "LayoutAction", "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,77 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AutomationAction
4
- } from "./chunk-UKATFY3R.mjs";
5
- import "./chunk-NK5N3QKD.mjs";
6
-
7
- // src/capabilities/intent-resolver.ts
8
- import { contributes, Capabilities, createResolver, createIntent, LayoutAction } from "@dxos/app-framework";
9
- import { Obj, Ref } from "@dxos/echo";
10
- import { FunctionTrigger, FunctionType, ScriptType, TriggerKind } from "@dxos/functions";
11
- import { ATTENDABLE_PATH_SEPARATOR } from "@dxos/plugin-deck/types";
12
- import { SpaceAction } from "@dxos/plugin-space/types";
13
- import { Filter } from "@dxos/react-client/echo";
14
- var intent_resolver_default = (context) => contributes(Capabilities.IntentResolver, [
15
- createResolver({
16
- intent: AutomationAction.CreateTriggerFromTemplate,
17
- resolve: async ({ space, template, enabled = false, scriptName, input }) => {
18
- const trigger = Obj.make(FunctionTrigger, {
19
- enabled,
20
- input
21
- });
22
- if (scriptName) {
23
- const { objects: [script] } = await space.db.query(Filter.type(ScriptType, {
24
- name: scriptName
25
- })).run();
26
- if (script) {
27
- const { objects: [fn] } = await space.db.query(Filter.type(FunctionType, {
28
- source: Ref.make(script)
29
- })).run();
30
- if (fn) {
31
- trigger.function = Ref.make(fn);
32
- }
33
- }
34
- }
35
- switch (template.type) {
36
- case "timer": {
37
- trigger.spec = {
38
- kind: TriggerKind.Timer,
39
- cron: template.cron
40
- };
41
- break;
42
- }
43
- case "queue": {
44
- trigger.spec = {
45
- kind: TriggerKind.Queue,
46
- queue: template.queueDXN.toString()
47
- };
48
- break;
49
- }
50
- default: {
51
- break;
52
- }
53
- }
54
- return {
55
- intents: [
56
- createIntent(SpaceAction.AddObject, {
57
- object: trigger,
58
- target: space
59
- }),
60
- createIntent(LayoutAction.Open, {
61
- part: "main",
62
- subject: [
63
- `automation-settings${ATTENDABLE_PATH_SEPARATOR}${space.id}`
64
- ],
65
- options: {
66
- workspace: space.id
67
- }
68
- })
69
- ]
70
- };
71
- }
72
- })
73
- ]);
74
- export {
75
- intent_resolver_default as default
76
- };
77
- //# sourceMappingURL=intent-resolver-LU7EYWEO.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/intent-resolver.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n contributes,\n Capabilities,\n createResolver,\n type PluginContext,\n createIntent,\n LayoutAction,\n} from '@dxos/app-framework';\nimport { Obj, Ref } from '@dxos/echo';\nimport { FunctionTrigger, FunctionType, ScriptType, TriggerKind } from '@dxos/functions';\nimport { type DXN } from '@dxos/keys';\nimport { ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter } from '@dxos/react-client/echo';\n\nimport { AutomationAction } from '../types';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.IntentResolver, [\n createResolver({\n intent: AutomationAction.CreateTriggerFromTemplate,\n resolve: async ({ space, template, enabled = false, scriptName, input }) => {\n const trigger = Obj.make(FunctionTrigger, { enabled, input });\n\n // TODO(wittjosiah): Factor out function lookup by script name?\n if (scriptName) {\n const {\n objects: [script],\n } = await space.db.query(Filter.type(ScriptType, { name: scriptName })).run();\n if (script) {\n const {\n objects: [fn],\n } = await space.db.query(Filter.type(FunctionType, { source: Ref.make(script) })).run();\n if (fn) {\n trigger.function = Ref.make(fn);\n }\n }\n }\n\n switch (template.type) {\n case 'timer': {\n trigger.spec = { kind: TriggerKind.Timer, cron: template.cron };\n break;\n }\n case 'queue': {\n trigger.spec = { kind: TriggerKind.Queue, queue: (template.queueDXN as DXN).toString() };\n break;\n }\n default: {\n break;\n }\n }\n\n return {\n intents: [\n createIntent(SpaceAction.AddObject, { object: trigger, target: space }),\n createIntent(LayoutAction.Open, {\n part: 'main',\n subject: [`automation-settings${ATTENDABLE_PATH_SEPARATOR}${space.id}`],\n options: {\n workspace: space.id,\n },\n }),\n ],\n };\n },\n }),\n ]);\n"],
5
- "mappings": ";;;;;;;AAIA,SACEA,aACAC,cACAC,gBAEAC,cACAC,oBACK;AACP,SAASC,KAAKC,WAAW;AACzB,SAASC,iBAAiBC,cAAcC,YAAYC,mBAAmB;AAEvE,SAASC,iCAAiC;AAC1C,SAASC,mBAAmB;AAC5B,SAASC,cAAc;AAIvB,IAAA,0BAAe,CAACC,YACdC,YAAYC,aAAaC,gBAAgB;EACvCC,eAAe;IACbC,QAAQC,iBAAiBC;IACzBC,SAAS,OAAO,EAAEC,OAAOC,UAAUC,UAAU,OAAOC,YAAYC,MAAK,MAAE;AACrE,YAAMC,UAAUC,IAAIC,KAAKC,iBAAiB;QAAEN;QAASE;MAAM,CAAA;AAG3D,UAAID,YAAY;AACd,cAAM,EACJM,SAAS,CAACC,MAAAA,EAAO,IACf,MAAMV,MAAMW,GAAGC,MAAMC,OAAOC,KAAKC,YAAY;UAAEC,MAAMb;QAAW,CAAA,CAAA,EAAIc,IAAG;AAC3E,YAAIP,QAAQ;AACV,gBAAM,EACJD,SAAS,CAACS,EAAAA,EAAG,IACX,MAAMlB,MAAMW,GAAGC,MAAMC,OAAOC,KAAKK,cAAc;YAAEC,QAAQC,IAAId,KAAKG,MAAAA;UAAQ,CAAA,CAAA,EAAIO,IAAG;AACrF,cAAIC,IAAI;AACNb,oBAAQiB,WAAWD,IAAId,KAAKW,EAAAA;UAC9B;QACF;MACF;AAEA,cAAQjB,SAASa,MAAI;QACnB,KAAK,SAAS;AACZT,kBAAQkB,OAAO;YAAEC,MAAMC,YAAYC;YAAOC,MAAM1B,SAAS0B;UAAK;AAC9D;QACF;QACA,KAAK,SAAS;AACZtB,kBAAQkB,OAAO;YAAEC,MAAMC,YAAYG;YAAOC,OAAQ5B,SAAS6B,SAAiBC,SAAQ;UAAG;AACvF;QACF;QACA,SAAS;AACP;QACF;MACF;AAEA,aAAO;QACLC,SAAS;UACPC,aAAaC,YAAYC,WAAW;YAAEC,QAAQ/B;YAASgC,QAAQrC;UAAM,CAAA;UACrEiC,aAAaK,aAAaC,MAAM;YAC9BC,MAAM;YACNC,SAAS;cAAC,sBAAsBC,yBAAAA,GAA4B1C,MAAM2C,EAAE;;YACpEC,SAAS;cACPC,WAAW7C,MAAM2C;YACnB;UACF,CAAA;;MAEJ;IACF;EACF,CAAA;CACD;",
6
- "names": ["contributes", "Capabilities", "createResolver", "createIntent", "LayoutAction", "Obj", "Ref", "FunctionTrigger", "FunctionType", "ScriptType", "TriggerKind", "ATTENDABLE_PATH_SEPARATOR", "SpaceAction", "Filter", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "AutomationAction", "CreateTriggerFromTemplate", "resolve", "space", "template", "enabled", "scriptName", "input", "trigger", "Obj", "make", "FunctionTrigger", "objects", "script", "db", "query", "Filter", "type", "ScriptType", "name", "run", "fn", "FunctionType", "source", "Ref", "function", "spec", "kind", "TriggerKind", "Timer", "cron", "Queue", "queue", "queueDXN", "toString", "intents", "createIntent", "SpaceAction", "AddObject", "object", "target", "LayoutAction", "Open", "part", "subject", "ATTENDABLE_PATH_SEPARATOR", "id", "options", "workspace"]
7
- }
@@ -1,65 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AutomationContainer,
4
- FunctionsContainer
5
- } from "./chunk-SGZPTJ47.mjs";
6
- import "./chunk-AZH66CED.mjs";
7
- import {
8
- meta
9
- } from "./chunk-NK5N3QKD.mjs";
10
-
11
- // src/capabilities/react-surface.tsx
12
- import React from "react";
13
- import { Capabilities, contributes, createSurface, useLayout } from "@dxos/app-framework";
14
- import { Obj } from "@dxos/echo";
15
- import { ScriptType } from "@dxos/functions";
16
- import { getSpace, parseId, useSpace } from "@dxos/react-client/echo";
17
- var react_surface_default = () => contributes(Capabilities.ReactSurface, [
18
- createSurface({
19
- id: `${meta.id}/space-settings-automation`,
20
- role: "article",
21
- filter: (data) => data.subject === `${meta.id}/space-settings-automation`,
22
- component: () => {
23
- const layout = useLayout();
24
- const { spaceId } = parseId(layout.workspace);
25
- const space = useSpace(spaceId);
26
- if (!space || !spaceId) {
27
- return null;
28
- }
29
- return /* @__PURE__ */ React.createElement(AutomationContainer, {
30
- space
31
- });
32
- }
33
- }),
34
- createSurface({
35
- id: `${meta.id}/space-settings-functions`,
36
- role: "article",
37
- filter: (data) => data.subject === `${meta.id}/space-settings-functions`,
38
- component: () => {
39
- const layout = useLayout();
40
- const { spaceId } = parseId(layout.workspace);
41
- const space = useSpace(spaceId);
42
- if (!space || !spaceId) {
43
- return null;
44
- }
45
- return /* @__PURE__ */ React.createElement(FunctionsContainer, {
46
- space
47
- });
48
- }
49
- }),
50
- createSurface({
51
- id: `${meta.id}/companion/automation`,
52
- role: "article",
53
- filter: (data) => Obj.instanceOf(ScriptType, data.companionTo) && data.subject === "automation",
54
- component: ({ data, role }) => {
55
- return /* @__PURE__ */ React.createElement(AutomationContainer, {
56
- space: getSpace(data.companionTo),
57
- object: data.companionTo
58
- });
59
- }
60
- })
61
- ]);
62
- export {
63
- react_surface_default as default
64
- };
65
- //# sourceMappingURL=react-surface-3PNW7NDW.mjs.map
@@ -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,9 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AutomationAction
4
- } from "./chunk-UKATFY3R.mjs";
5
- import "./chunk-NK5N3QKD.mjs";
6
- export {
7
- AutomationAction
8
- };
9
- //# sourceMappingURL=types.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,4 +0,0 @@
1
- import { Capabilities, type PluginContext } from '@dxos/app-framework';
2
- declare const _default: (context: PluginContext) => import("@dxos/app-framework").Capability<Capabilities.IntentResolver>;
3
- export default _default;
4
- //# sourceMappingURL=intent-resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,YAAY,EAEZ,KAAK,aAAa,EAGnB,MAAM,qBAAqB,CAAC;yBAUb,SAAS,aAAa;AAAtC,wBAkDK"}
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { type AutomationPanelProps } from './AutomationPanel';
3
- export declare const AutomationContainer: (props: AutomationPanelProps) => React.JSX.Element;
4
- export default AutomationContainer;
5
- //# sourceMappingURL=AutomationContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutomationContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/AutomationContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG/E,eAAO,MAAM,mBAAmB,GAAI,OAAO,oBAAoB,sBAc9D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { type Space } from '@dxos/react-client/echo';
3
- export declare const FunctionsContainer: ({ space }: {
4
- space: Space;
5
- }) => React.JSX.Element;
6
- export default FunctionsContainer;
7
- //# sourceMappingURL=FunctionsContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FunctionsContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/FunctionsContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAQrD,eAAO,MAAM,kBAAkB,GAAI,WAAW;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,sBAc7D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWhC,yBAAiB,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;IAGhC,MAAM,OAAO,yBAA0B,SAAQ,8BAa9C;KAAG;;CACL"}
@@ -1,72 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import {
6
- contributes,
7
- Capabilities,
8
- createResolver,
9
- type PluginContext,
10
- createIntent,
11
- LayoutAction,
12
- } from '@dxos/app-framework';
13
- import { Obj, Ref } from '@dxos/echo';
14
- import { FunctionTrigger, FunctionType, ScriptType, TriggerKind } from '@dxos/functions';
15
- import { type DXN } from '@dxos/keys';
16
- import { ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';
17
- import { SpaceAction } from '@dxos/plugin-space/types';
18
- import { Filter } from '@dxos/react-client/echo';
19
-
20
- import { AutomationAction } from '../types';
21
-
22
- export default (context: PluginContext) =>
23
- contributes(Capabilities.IntentResolver, [
24
- createResolver({
25
- intent: AutomationAction.CreateTriggerFromTemplate,
26
- resolve: async ({ space, template, enabled = false, scriptName, input }) => {
27
- const trigger = Obj.make(FunctionTrigger, { enabled, input });
28
-
29
- // TODO(wittjosiah): Factor out function lookup by script name?
30
- if (scriptName) {
31
- const {
32
- objects: [script],
33
- } = await space.db.query(Filter.type(ScriptType, { name: scriptName })).run();
34
- if (script) {
35
- const {
36
- objects: [fn],
37
- } = await space.db.query(Filter.type(FunctionType, { source: Ref.make(script) })).run();
38
- if (fn) {
39
- trigger.function = Ref.make(fn);
40
- }
41
- }
42
- }
43
-
44
- switch (template.type) {
45
- case 'timer': {
46
- trigger.spec = { kind: TriggerKind.Timer, cron: template.cron };
47
- break;
48
- }
49
- case 'queue': {
50
- trigger.spec = { kind: TriggerKind.Queue, queue: (template.queueDXN as DXN).toString() };
51
- break;
52
- }
53
- default: {
54
- break;
55
- }
56
- }
57
-
58
- return {
59
- intents: [
60
- createIntent(SpaceAction.AddObject, { object: trigger, target: space }),
61
- createIntent(LayoutAction.Open, {
62
- part: 'main',
63
- subject: [`automation-settings${ATTENDABLE_PATH_SEPARATOR}${space.id}`],
64
- options: {
65
- workspace: space.id,
66
- },
67
- }),
68
- ],
69
- };
70
- },
71
- }),
72
- ]);
@@ -1,30 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { useTranslation } from '@dxos/react-ui';
8
- import { ControlSection, ControlPage } from '@dxos/react-ui-form';
9
- import { StackItem } from '@dxos/react-ui-stack';
10
-
11
- import { AutomationPanel, type AutomationPanelProps } from './AutomationPanel';
12
- import { AUTOMATION_PLUGIN } from '../meta';
13
-
14
- export const AutomationContainer = (props: AutomationPanelProps) => {
15
- const { t } = useTranslation(AUTOMATION_PLUGIN);
16
- return (
17
- <StackItem.Content classNames='block overflow-y-auto'>
18
- <ControlPage>
19
- <ControlSection
20
- title={t('automation verbose label', { ns: AUTOMATION_PLUGIN })}
21
- description={t('automation description', { ns: AUTOMATION_PLUGIN })}
22
- >
23
- <AutomationPanel {...props} />
24
- </ControlSection>
25
- </ControlPage>
26
- </StackItem.Content>
27
- );
28
- };
29
-
30
- export default AutomationContainer;
@@ -1,31 +0,0 @@
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 { useTranslation } from '@dxos/react-ui';
9
- import { ControlPage, ControlSection } from '@dxos/react-ui-form';
10
- import { StackItem } from '@dxos/react-ui-stack';
11
-
12
- import { FunctionsPanel } from './FunctionsPanel';
13
- import { AUTOMATION_PLUGIN } from '../meta';
14
-
15
- export const FunctionsContainer = ({ space }: { space: Space }) => {
16
- const { t } = useTranslation(AUTOMATION_PLUGIN);
17
- return (
18
- <StackItem.Content classNames='block overflow-y-auto'>
19
- <ControlPage>
20
- <ControlSection
21
- title={t('functions verbose label', { ns: AUTOMATION_PLUGIN })}
22
- description={t('functions description', { ns: AUTOMATION_PLUGIN })}
23
- >
24
- <FunctionsPanel space={space} />
25
- </ControlSection>
26
- </ControlPage>
27
- </StackItem.Content>
28
- );
29
- };
30
-
31
- export default FunctionsContainer;