@dxos/plugin-automation 0.8.4-main.406dc2a → 0.8.4-main.422d1c7879

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 (287) hide show
  1. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  2. package/dist/lib/browser/chunk-LEN2XWRB.mjs +44 -0
  3. package/dist/lib/browser/chunk-LEN2XWRB.mjs.map +7 -0
  4. package/dist/lib/browser/chunk-VKSAIOAL.mjs +54 -0
  5. package/dist/lib/browser/chunk-VKSAIOAL.mjs.map +7 -0
  6. package/dist/lib/browser/cli/index.mjs +1110 -0
  7. package/dist/lib/browser/cli/index.mjs.map +7 -0
  8. package/dist/lib/browser/create-trigger-from-template-NH5EL6LB.mjs +71 -0
  9. package/dist/lib/browser/create-trigger-from-template-NH5EL6LB.mjs.map +7 -0
  10. package/dist/lib/browser/hooks/index.mjs +81 -6
  11. package/dist/lib/browser/hooks/index.mjs.map +4 -4
  12. package/dist/lib/browser/index.mjs +76 -103
  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/types/index.mjs +10 -4
  18. package/dist/lib/node-esm/{chunk-CJUI6AKX.mjs → chunk-45PS7CQD.mjs} +24 -7
  19. package/dist/lib/node-esm/chunk-45PS7CQD.mjs.map +7 -0
  20. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  21. package/dist/lib/node-esm/chunk-V2SSR4MK.mjs +45 -0
  22. package/dist/lib/node-esm/chunk-V2SSR4MK.mjs.map +7 -0
  23. package/dist/lib/node-esm/cli/index.mjs +1111 -0
  24. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  25. package/dist/lib/node-esm/create-trigger-from-template-C7UPU2VL.mjs +72 -0
  26. package/dist/lib/node-esm/create-trigger-from-template-C7UPU2VL.mjs.map +7 -0
  27. package/dist/lib/node-esm/hooks/index.mjs +81 -6
  28. package/dist/lib/node-esm/hooks/index.mjs.map +4 -4
  29. package/dist/lib/node-esm/index.mjs +76 -103
  30. package/dist/lib/node-esm/index.mjs.map +4 -4
  31. package/dist/lib/node-esm/meta.json +1 -1
  32. package/dist/lib/node-esm/operations/index.mjs +15 -0
  33. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  34. package/dist/lib/node-esm/types/index.mjs +10 -4
  35. package/dist/types/src/AutomationPlugin.d.ts +2 -1
  36. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  37. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  38. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  39. package/dist/types/src/capabilities/compute-runtime.d.ts +12 -3
  40. package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -1
  41. package/dist/types/src/capabilities/index.d.ts +6 -5
  42. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  43. package/dist/types/src/capabilities/node.d.ts +3 -0
  44. package/dist/types/src/capabilities/node.d.ts.map +1 -0
  45. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  46. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  47. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  48. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  49. package/dist/types/src/cli/commands/index.d.ts +2 -0
  50. package/dist/types/src/cli/commands/index.d.ts.map +1 -0
  51. package/dist/types/src/cli/commands/trigger/create/index.d.ts +25 -0
  52. package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +1 -0
  53. package/dist/types/src/cli/commands/trigger/create/queue.d.ts +13 -0
  54. package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +1 -0
  55. package/dist/types/src/cli/commands/trigger/create/subscription.d.ts +15 -0
  56. package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +1 -0
  57. package/dist/types/src/cli/commands/trigger/create/timer.d.ts +13 -0
  58. package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +1 -0
  59. package/dist/types/src/cli/commands/trigger/index.d.ts +57 -0
  60. package/dist/types/src/cli/commands/trigger/index.d.ts.map +1 -0
  61. package/dist/types/src/cli/commands/trigger/list.d.ts +7 -0
  62. package/dist/types/src/cli/commands/trigger/list.d.ts.map +1 -0
  63. package/dist/types/src/cli/commands/trigger/options.d.ts +11 -0
  64. package/dist/types/src/cli/commands/trigger/options.d.ts.map +1 -0
  65. package/dist/types/src/cli/commands/trigger/remove.d.ts +8 -0
  66. package/dist/types/src/cli/commands/trigger/remove.d.ts.map +1 -0
  67. package/dist/types/src/cli/commands/trigger/update/index.d.ts +28 -0
  68. package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +1 -0
  69. package/dist/types/src/cli/commands/trigger/update/queue.d.ts +12 -0
  70. package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +1 -0
  71. package/dist/types/src/cli/commands/trigger/update/subscription.d.ts +13 -0
  72. package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +1 -0
  73. package/dist/types/src/cli/commands/trigger/update/timer.d.ts +11 -0
  74. package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +1 -0
  75. package/dist/types/src/cli/commands/trigger/util.d.ts +46 -0
  76. package/dist/types/src/cli/commands/trigger/util.d.ts.map +1 -0
  77. package/dist/types/src/cli/index.d.ts +2 -0
  78. package/dist/types/src/cli/index.d.ts.map +1 -0
  79. package/dist/types/src/cli/plugin.d.ts +3 -0
  80. package/dist/types/src/cli/plugin.d.ts.map +1 -0
  81. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +6 -7
  82. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  83. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +31 -26
  84. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  85. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
  86. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +8 -0
  87. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
  88. package/dist/types/src/components/FunctionsRegistry/index.d.ts +4 -0
  89. package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
  90. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
  91. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
  92. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
  93. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
  94. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +9 -8
  95. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  96. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +102 -28
  97. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  98. package/dist/types/src/components/index.d.ts +3 -4
  99. package/dist/types/src/components/index.d.ts.map +1 -1
  100. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +6 -0
  101. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
  102. package/dist/types/src/containers/AutomationSettings/index.d.ts +2 -0
  103. package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
  104. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts +4 -0
  105. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
  106. package/dist/types/src/containers/FunctionsContainer/index.d.ts +2 -0
  107. package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -0
  108. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
  109. package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
  110. package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
  111. package/dist/types/src/containers/index.d.ts +5 -0
  112. package/dist/types/src/containers/index.d.ts.map +1 -0
  113. package/dist/types/src/hooks/index.d.ts +2 -0
  114. package/dist/types/src/hooks/index.d.ts.map +1 -1
  115. package/dist/types/src/hooks/useComputeRuntime.d.ts +8 -0
  116. package/dist/types/src/hooks/useComputeRuntime.d.ts.map +1 -0
  117. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +5 -4
  118. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
  119. package/dist/types/src/hooks/useComputeRuntimeService.d.ts +5 -0
  120. package/dist/types/src/hooks/useComputeRuntimeService.d.ts.map +1 -0
  121. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +6 -5
  122. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
  123. package/dist/types/src/index.d.ts +2 -5
  124. package/dist/types/src/index.d.ts.map +1 -1
  125. package/dist/types/src/meta.d.ts +2 -2
  126. package/dist/types/src/meta.d.ts.map +1 -1
  127. package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
  128. package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
  129. package/dist/types/src/operations/definitions.d.ts +19 -0
  130. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  131. package/dist/types/src/operations/index.d.ts +4 -0
  132. package/dist/types/src/operations/index.d.ts.map +1 -0
  133. package/dist/types/src/testing/test-functions.d.ts +204 -3
  134. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  135. package/dist/types/src/translations.d.ts +32 -27
  136. package/dist/types/src/translations.d.ts.map +1 -1
  137. package/dist/types/src/types/capabilities.d.ts +25 -0
  138. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  139. package/dist/types/src/types/events.d.ts +5 -0
  140. package/dist/types/src/types/events.d.ts.map +1 -0
  141. package/dist/types/src/types/index.d.ts +2 -0
  142. package/dist/types/src/types/index.d.ts.map +1 -1
  143. package/dist/types/src/types/schema.d.ts +11 -3
  144. package/dist/types/src/types/schema.d.ts.map +1 -1
  145. package/dist/types/tsconfig.tsbuildinfo +1 -1
  146. package/package.json +92 -58
  147. package/src/AutomationPlugin.tsx +19 -36
  148. package/src/capabilities/app-graph-builder.ts +55 -80
  149. package/src/capabilities/compute-runtime.ts +246 -78
  150. package/src/capabilities/index.ts +9 -7
  151. package/src/capabilities/node.ts +7 -0
  152. package/src/capabilities/operation-handler.ts +16 -0
  153. package/src/capabilities/react-surface.tsx +49 -45
  154. package/src/cli/commands/index.ts +5 -0
  155. package/src/cli/commands/trigger/create/index.ts +14 -0
  156. package/src/cli/commands/trigger/create/queue.ts +87 -0
  157. package/src/cli/commands/trigger/create/subscription.ts +126 -0
  158. package/src/cli/commands/trigger/create/timer.ts +91 -0
  159. package/src/cli/commands/trigger/index.ts +16 -0
  160. package/src/cli/commands/trigger/list.ts +68 -0
  161. package/src/cli/commands/trigger/options.ts +59 -0
  162. package/src/cli/commands/trigger/remove.ts +45 -0
  163. package/src/cli/commands/trigger/update/index.ts +14 -0
  164. package/src/cli/commands/trigger/update/queue.ts +195 -0
  165. package/src/cli/commands/trigger/update/subscription.ts +279 -0
  166. package/src/cli/commands/trigger/update/timer.ts +194 -0
  167. package/src/cli/commands/trigger/util.ts +409 -0
  168. package/src/cli/index.ts +5 -0
  169. package/src/cli/plugin.ts +23 -0
  170. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +8 -7
  171. package/src/components/AutomationPanel/AutomationPanel.tsx +201 -99
  172. package/src/components/FunctionsPanel/FunctionsPanel.tsx +50 -30
  173. package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +114 -0
  174. package/src/components/FunctionsRegistry/index.ts +8 -0
  175. package/src/components/TriggerEditor/FunctionInputEditor.tsx +34 -33
  176. package/src/components/TriggerEditor/SpecSelector.tsx +27 -21
  177. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +88 -41
  178. package/src/components/TriggerEditor/TriggerEditor.tsx +92 -50
  179. package/src/components/index.ts +1 -2
  180. package/src/containers/AutomationSettings/AutomationSettings.tsx +31 -0
  181. package/src/containers/AutomationSettings/index.ts +5 -0
  182. package/src/containers/FunctionsContainer/FunctionsContainer.tsx +34 -0
  183. package/src/containers/FunctionsContainer/index.ts +5 -0
  184. package/src/containers/TriggerSettings/TriggerSettings.tsx +48 -0
  185. package/src/containers/TriggerSettings/index.ts +6 -0
  186. package/src/containers/index.ts +9 -0
  187. package/src/hooks/index.ts +3 -0
  188. package/src/hooks/useComputeRuntime.ts +21 -0
  189. package/src/hooks/useComputeRuntimeCallback.ts +11 -9
  190. package/src/hooks/useComputeRuntimeService.ts +25 -0
  191. package/src/hooks/useTriggerRuntimeControls.ts +30 -15
  192. package/src/index.ts +2 -6
  193. package/src/meta.ts +9 -6
  194. package/src/operations/create-trigger-from-template.ts +72 -0
  195. package/src/operations/definitions.ts +28 -0
  196. package/src/operations/index.ts +9 -0
  197. package/src/testing/test-functions.ts +9 -6
  198. package/src/translations.ts +39 -33
  199. package/src/types/capabilities.ts +47 -0
  200. package/src/types/events.ts +11 -0
  201. package/src/types/index.ts +2 -0
  202. package/src/types/schema.ts +5 -5
  203. package/dist/lib/browser/AutomationPanel-3PHA5FTJ.mjs +0 -11
  204. package/dist/lib/browser/AutomationSettings-3EYSPFKB.mjs +0 -69
  205. package/dist/lib/browser/AutomationSettings-3EYSPFKB.mjs.map +0 -7
  206. package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs +0 -36
  207. package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs.map +0 -7
  208. package/dist/lib/browser/FunctionsPanel-NRIKAPQV.mjs +0 -10
  209. package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs +0 -81
  210. package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs.map +0 -7
  211. package/dist/lib/browser/chunk-5ARH77PV.mjs +0 -15
  212. package/dist/lib/browser/chunk-5ARH77PV.mjs.map +0 -7
  213. package/dist/lib/browser/chunk-6TUZQIEN.mjs +0 -14
  214. package/dist/lib/browser/chunk-6TUZQIEN.mjs.map +0 -7
  215. package/dist/lib/browser/chunk-DK7BLEKU.mjs +0 -14
  216. package/dist/lib/browser/chunk-DK7BLEKU.mjs.map +0 -7
  217. package/dist/lib/browser/chunk-DLLE4FKP.mjs +0 -94
  218. package/dist/lib/browser/chunk-DLLE4FKP.mjs.map +0 -7
  219. package/dist/lib/browser/chunk-MVPRI3DB.mjs +0 -53
  220. package/dist/lib/browser/chunk-MVPRI3DB.mjs.map +0 -7
  221. package/dist/lib/browser/chunk-SUKAEYF3.mjs +0 -267
  222. package/dist/lib/browser/chunk-SUKAEYF3.mjs.map +0 -7
  223. package/dist/lib/browser/chunk-VGBZKM3O.mjs +0 -38
  224. package/dist/lib/browser/chunk-VGBZKM3O.mjs.map +0 -7
  225. package/dist/lib/browser/chunk-VL3KSDVL.mjs +0 -183
  226. package/dist/lib/browser/chunk-VL3KSDVL.mjs.map +0 -7
  227. package/dist/lib/browser/chunk-WWURMV25.mjs +0 -13
  228. package/dist/lib/browser/chunk-WWURMV25.mjs.map +0 -7
  229. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs +0 -160
  230. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs.map +0 -7
  231. package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs +0 -77
  232. package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs.map +0 -7
  233. package/dist/lib/browser/react-surface-G7CG7BML.mjs +0 -63
  234. package/dist/lib/browser/react-surface-G7CG7BML.mjs.map +0 -7
  235. package/dist/lib/node-esm/AutomationPanel-EETYIR35.mjs +0 -12
  236. package/dist/lib/node-esm/AutomationPanel-EETYIR35.mjs.map +0 -7
  237. package/dist/lib/node-esm/AutomationSettings-WKSMWITV.mjs +0 -70
  238. package/dist/lib/node-esm/AutomationSettings-WKSMWITV.mjs.map +0 -7
  239. package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs +0 -37
  240. package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs.map +0 -7
  241. package/dist/lib/node-esm/FunctionsPanel-SAMRTELO.mjs +0 -11
  242. package/dist/lib/node-esm/FunctionsPanel-SAMRTELO.mjs.map +0 -7
  243. package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs +0 -82
  244. package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs.map +0 -7
  245. package/dist/lib/node-esm/chunk-2EWXIFEK.mjs +0 -16
  246. package/dist/lib/node-esm/chunk-2EWXIFEK.mjs.map +0 -7
  247. package/dist/lib/node-esm/chunk-5MQJPJR2.mjs +0 -15
  248. package/dist/lib/node-esm/chunk-5MQJPJR2.mjs.map +0 -7
  249. package/dist/lib/node-esm/chunk-AKHETVIQ.mjs +0 -184
  250. package/dist/lib/node-esm/chunk-AKHETVIQ.mjs.map +0 -7
  251. package/dist/lib/node-esm/chunk-B7N3H45O.mjs +0 -16
  252. package/dist/lib/node-esm/chunk-B7N3H45O.mjs.map +0 -7
  253. package/dist/lib/node-esm/chunk-CJUI6AKX.mjs.map +0 -7
  254. package/dist/lib/node-esm/chunk-J3XEBEIE.mjs +0 -268
  255. package/dist/lib/node-esm/chunk-J3XEBEIE.mjs.map +0 -7
  256. package/dist/lib/node-esm/chunk-QCA543ZR.mjs +0 -54
  257. package/dist/lib/node-esm/chunk-QCA543ZR.mjs.map +0 -7
  258. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs +0 -16
  259. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs.map +0 -7
  260. package/dist/lib/node-esm/chunk-YQXW3JXD.mjs +0 -95
  261. package/dist/lib/node-esm/chunk-YQXW3JXD.mjs.map +0 -7
  262. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs +0 -161
  263. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs.map +0 -7
  264. package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs +0 -78
  265. package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs.map +0 -7
  266. package/dist/lib/node-esm/react-surface-OMZSBDHS.mjs +0 -64
  267. package/dist/lib/node-esm/react-surface-OMZSBDHS.mjs.map +0 -7
  268. package/dist/types/src/capabilities/capabilities.d.ts +0 -19
  269. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  270. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  271. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  272. package/dist/types/src/components/AutomationSettings.d.ts +0 -5
  273. package/dist/types/src/components/AutomationSettings.d.ts.map +0 -1
  274. package/dist/types/src/components/FunctionsContainer.d.ts +0 -7
  275. package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
  276. package/dist/types/src/components/TriggerSettings.d.ts.map +0 -1
  277. package/dist/types/src/events.d.ts +0 -4
  278. package/dist/types/src/events.d.ts.map +0 -1
  279. package/src/capabilities/capabilities.ts +0 -48
  280. package/src/capabilities/intent-resolver.ts +0 -72
  281. package/src/components/AutomationSettings.tsx +0 -30
  282. package/src/components/FunctionsContainer.tsx +0 -29
  283. package/src/components/TriggerSettings.tsx +0 -25
  284. package/src/events.ts +0 -11
  285. /package/dist/lib/browser/{AutomationPanel-3PHA5FTJ.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
  286. /package/dist/lib/{browser/FunctionsPanel-NRIKAPQV.mjs.map → node-esm/chunk-HSLMI22Q.mjs.map} +0 -0
  287. /package/dist/types/src/{components → containers/TriggerSettings}/TriggerSettings.d.ts +0 -0
@@ -2,29 +2,26 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import type * as SchemaAST from 'effect/SchemaAST';
5
6
  import React, { useCallback, useMemo } from 'react';
6
7
 
7
- import { Ref, Type } from '@dxos/echo';
8
+ import { type Database, JsonSchema, Obj, Ref } from '@dxos/echo';
8
9
  import { type JsonPath } from '@dxos/echo/internal';
9
- import { type FunctionType } from '@dxos/functions';
10
- import { useOnTransition } from '@dxos/react-ui';
11
- import { Form, type FormInputStateProps, type QueryRefOptions, useFormValues } from '@dxos/react-ui-form';
10
+ import { type Operation } from '@dxos/operation';
11
+ import { useOnTransition, useTranslation } from '@dxos/react-ui';
12
+ import { Form, type FormFieldStateProps, type FormRootProps, useFormValues } from '@dxos/react-ui-form';
13
+
14
+ import { meta } from '#meta';
12
15
 
13
16
  export type FunctionInputEditorProps = {
14
- functions: FunctionType[];
15
- onQueryRefOptions: QueryRefOptions;
16
- } & FormInputStateProps;
17
+ type: SchemaAST.AST;
18
+ functions: Operation.PersistentOperation[];
19
+ db?: Database.Database;
20
+ } & FormFieldStateProps;
17
21
 
18
- /**
19
- * Editor component for function input parameters.
20
- */
21
- export const FunctionInputEditor = ({
22
- functions,
23
- getValue,
24
- onValueChange,
25
- onQueryRefOptions,
26
- }: FunctionInputEditorProps) => {
27
- const selectedFunctionValue = useFormValues(['function' as JsonPath]);
22
+ export const FunctionInputEditor = ({ type, functions, db, getValue, onValueChange }: FunctionInputEditorProps) => {
23
+ const { t } = useTranslation(meta.id);
24
+ const selectedFunctionValue = useFormValues(FunctionInputEditor.displayName, ['function' as JsonPath]);
28
25
  const selectedFunctionId = useMemo(() => {
29
26
  if (Ref.isRef(selectedFunctionValue)) {
30
27
  return selectedFunctionValue.dxn.toString().split('dxn:echo:@:').at(1);
@@ -47,20 +44,22 @@ export const FunctionInputEditor = ({
47
44
  return prevValue.dxn.toString() !== selectedFunctionValue.dxn.toString();
48
45
  },
49
46
  (currValue) => currValue !== undefined,
50
- () => onValueChange('object', {}),
47
+ () => onValueChange(type, {}),
51
48
  );
52
49
 
53
50
  const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);
54
- const effectSchema = useMemo(() => (inputSchema ? Type.toEffectSchema(inputSchema) : undefined), [inputSchema]);
51
+ const effectSchema = useMemo(() => (inputSchema ? JsonSchema.toEffectSchema(inputSchema) : undefined), [inputSchema]);
55
52
  const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;
53
+ const defaultValues = useMemo(() => {
54
+ const raw = getValue() ?? {};
55
+ return Obj.isObject(raw) ? { ...Obj.getSnapshot(raw) } : { ...raw };
56
+ }, [getValue]);
56
57
 
57
- const values = useMemo(() => getValue() ?? {}, [getValue]);
58
-
59
- const handleValuesChanged = useCallback(
60
- (values: any) => {
61
- onValueChange('object', values);
58
+ const handleValuesChanged = useCallback<NonNullable<FormRootProps['onValuesChanged']>>(
59
+ (values) => {
60
+ onValueChange(type, values);
62
61
  },
63
- [onValueChange],
62
+ [type, onValueChange],
64
63
  );
65
64
 
66
65
  if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {
@@ -69,16 +68,18 @@ export const FunctionInputEditor = ({
69
68
 
70
69
  return (
71
70
  <>
72
- <h3 className='text-md'>Function parameters</h3>
73
- {/* TODO(ZaymonFC): Try using <FormFields /> internal component for this nesting.
74
- This would allow errors to flow up to the root context. */}
75
- <Form
71
+ <Form.Label label={t('function-parameters.label')} asChild />
72
+ <Form.Root
73
+ key={selectedFunction.id}
76
74
  schema={effectSchema}
77
- values={values}
75
+ defaultValues={defaultValues}
76
+ db={db}
78
77
  onValuesChanged={handleValuesChanged}
79
- onQueryRefOptions={onQueryRefOptions}
80
- outerSpacing={false}
81
- />
78
+ >
79
+ <Form.FieldSet />
80
+ </Form.Root>
82
81
  </>
83
82
  );
84
83
  };
84
+
85
+ FunctionInputEditor.displayName = 'AutomationTrigger.FunctionInputEditor';
@@ -5,37 +5,32 @@
5
5
  import React, { useCallback, useMemo } from 'react';
6
6
 
7
7
  import { Filter, Query } from '@dxos/echo';
8
- import { type FunctionTrigger, TriggerKinds, type TriggerType } from '@dxos/functions';
8
+ import { Trigger } from '@dxos/functions';
9
9
  import { useTranslation } from '@dxos/react-ui';
10
- import { type InputProps, SelectInput, useInputProps } from '@dxos/react-ui-form';
10
+ import { type FormFieldComponentProps, SelectField, useFormFieldState } from '@dxos/react-ui-form';
11
11
 
12
- import { meta } from '../../meta';
12
+ import { meta } from '#meta';
13
13
 
14
- export type SpecSelectorProps = InputProps;
14
+ export type SpecSelectorProps = FormFieldComponentProps;
15
15
 
16
16
  export const SpecSelector = (props: SpecSelectorProps) => {
17
17
  const { t } = useTranslation(meta.id);
18
- const specProps = useInputProps(['spec' satisfies keyof FunctionTrigger]);
18
+ const specProps = useFormFieldState(SpecSelector.displayName, ['spec' satisfies keyof Trigger.Trigger]);
19
19
 
20
20
  const handleTypeChange = useCallback(
21
- (_type: any, value: string): TriggerType | undefined => {
21
+ (_type: any, value: string): Trigger.Spec | undefined => {
22
22
  const getDefaultTriggerSpec = (kind: string) => {
23
23
  switch (kind) {
24
24
  case 'timer':
25
- return { kind: 'timer', cron: '' };
25
+ return Trigger.specTimer('');
26
26
  case 'subscription':
27
- return {
28
- kind: 'subscription',
29
- query: {
30
- ast: Query.select(Filter.nothing()).ast,
31
- },
32
- };
27
+ return Trigger.specSubscription(Query.select(Filter.nothing()));
33
28
  case 'queue':
34
- return { kind: 'queue', queue: 'dxn:' };
29
+ return Trigger.specQueue('dxn:queue:default');
35
30
  case 'email':
36
- return { kind: 'email' };
31
+ return Trigger.specEmail();
37
32
  case 'webhook':
38
- return { kind: 'webhook' };
33
+ return Trigger.specWebhook();
39
34
  default:
40
35
  return undefined;
41
36
  }
@@ -47,19 +42,30 @@ export const SpecSelector = (props: SpecSelectorProps) => {
47
42
  }
48
43
 
49
44
  // Update the entire spec object, not just the `spec.kind`.
50
- specProps.onValueChange('object', defaultSpec);
45
+ specProps.onValueChange(props.type, defaultSpec);
51
46
  },
52
- [specProps],
47
+ [props.type, specProps],
53
48
  );
54
49
 
50
+ const kindLabels: Record<string, string> = {
51
+ timer: t('trigger-type.timer.label'),
52
+ webhook: t('trigger-type.webhook.label'),
53
+ websocket: t('trigger-type.websocket.label'),
54
+ subscription: t('trigger-type.subscription.label'),
55
+ email: t('trigger-type.email.label'),
56
+ queue: t('trigger-type.queue.label'),
57
+ };
58
+
55
59
  const options = useMemo(
56
60
  () =>
57
- TriggerKinds.map((kind) => ({
61
+ Trigger.Kinds.map((kind) => ({
58
62
  value: kind,
59
- label: t(`trigger type ${kind}`),
63
+ label: kindLabels[kind],
60
64
  })),
61
65
  [t],
62
66
  );
63
67
 
64
- return <SelectInput {...props} options={options} onValueChange={handleTypeChange} />;
68
+ return <SelectField {...props} options={options} onValueChange={handleTypeChange} />;
65
69
  };
70
+
71
+ SpecSelector.displayName = 'Form.SpecSelector';
@@ -4,47 +4,50 @@
4
4
 
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { useState } from 'react';
7
+ import { expect, userEvent, within } from 'storybook/test';
7
8
 
8
9
  import { Filter, Obj, Ref, Tag, Type } from '@dxos/echo';
9
- import { FunctionTrigger, FunctionType } from '@dxos/functions';
10
+ import { Trigger } from '@dxos/functions';
10
11
  import { invariant } from '@dxos/invariant';
11
- import { faker } from '@dxos/random';
12
+ import { Operation } from '@dxos/operation';
13
+ import { random } from '@dxos/random';
12
14
  import { useQuery } from '@dxos/react-client/echo';
13
- import { ContactType, useClientProvider, withClientProvider } from '@dxos/react-client/testing';
15
+ import { TestSchema, useClientStory, withClientProvider } from '@dxos/react-client/testing';
14
16
  import { useAsyncEffect } from '@dxos/react-ui';
15
- import { withTheme } from '@dxos/react-ui/testing';
16
- import { DataType } from '@dxos/schema';
17
+ import { translations as formTranslations } from '@dxos/react-ui-form';
18
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
19
+ import { Employer, Organization, Person, Pipeline } from '@dxos/types';
17
20
 
18
- import { functions } from '../../testing';
19
- import { translations } from '../../translations';
21
+ import { functions } from '#testing';
20
22
 
23
+ import { translations } from '../../translations';
21
24
  import { TriggerEditor, type TriggerEditorProps } from './TriggerEditor';
22
25
 
23
26
  const types = [
24
27
  // TODO(burdon): Get label from annotation.
25
- { value: Type.getTypename(DataType.Organization), label: 'Organization' },
26
- { value: Type.getTypename(DataType.Person), label: 'Person' },
27
- { value: Type.getTypename(DataType.Project), label: 'Project' },
28
- { value: Type.getTypename(DataType.Employer), label: 'Employer' },
28
+ { value: Organization.Organization.typename, label: 'Organization' },
29
+ { value: Person.Person.typename, label: 'Person' },
30
+ { value: Type.getTypename(Pipeline.Pipeline), label: 'Project' },
31
+ { value: Employer.Employer.typename, label: 'Employer' },
29
32
  ];
30
33
 
31
34
  const DefaultStory = (props: Partial<TriggerEditorProps>) => {
32
- const { space } = useClientProvider();
33
- const [trigger, setTrigger] = useState<FunctionTrigger>();
34
- const tags = useQuery(space, Filter.type(Tag.Tag));
35
+ const { space } = useClientStory();
36
+ const [trigger, setTrigger] = useState<Trigger.Trigger>();
37
+ const tags = useQuery(space?.db, Filter.type(Tag.Tag));
35
38
 
36
39
  useAsyncEffect(async () => {
37
40
  if (!space) {
38
41
  return;
39
42
  }
40
43
 
41
- const result = await space.db.query(Filter.type(FunctionType)).run();
42
- const fn = result.objects.find((fn) => fn.name === 'example.com/function/forex');
44
+ const functions = await space.db.query(Filter.type(Operation.PersistentOperation)).run();
45
+ const fn = functions.find((fn) => fn.name === 'example.com/function/forex');
43
46
  invariant(fn);
44
47
  const trigger = space.db.add(
45
- Obj.make(FunctionTrigger, {
48
+ Trigger.make({
46
49
  function: Ref.make(fn),
47
- spec: { kind: 'webhook' },
50
+ spec: Trigger.specWebhook(),
48
51
  input: {
49
52
  from: 'USD',
50
53
  to: 'JPY',
@@ -59,41 +62,44 @@ const DefaultStory = (props: Partial<TriggerEditorProps>) => {
59
62
  }
60
63
 
61
64
  return (
62
- <div role='none' className='w-[32rem] bs-fit border border-separator rounded-sm'>
63
- <TriggerEditor
64
- space={space}
65
- trigger={trigger}
66
- types={types}
67
- tags={tags}
68
- onSave={(values) => console.log('on save', values)}
69
- {...props}
70
- />
71
- </div>
65
+ <TriggerEditor
66
+ db={space.db}
67
+ trigger={trigger}
68
+ types={types}
69
+ tags={tags}
70
+ onSave={(values) => console.log('on save', values)}
71
+ {...props}
72
+ />
72
73
  );
73
74
  };
74
75
 
75
76
  const meta = {
76
- title: 'plugins/plugin-automation/TriggerEditor',
77
+ title: 'plugins/plugin-automation/components/TriggerEditor',
77
78
  component: TriggerEditor as any,
78
79
  render: DefaultStory,
79
80
  decorators: [
80
- withTheme,
81
+ withTheme(),
82
+ withLayout({ layout: 'column' }),
81
83
  withClientProvider({
82
84
  createIdentity: true,
83
85
  createSpace: true,
84
- types: [Tag.Tag, FunctionType, FunctionTrigger, ContactType],
86
+ types: [Tag.Tag, Operation.PersistentOperation, Trigger.Trigger, TestSchema.ContactType],
85
87
  onCreateSpace: ({ space }) => {
86
- space.db.add(Tag.make({ label: 'Important' }));
87
- space.db.add(Tag.make({ label: 'Investor' }));
88
- space.db.add(Tag.make({ label: 'New' }));
88
+ // Tags.
89
+ ['Important', 'Investor', 'New'].forEach((label) => {
90
+ space.db.add(Tag.make({ label }));
91
+ });
92
+
93
+ // Functions.
94
+ functions.forEach((fn) => {
95
+ space.db.add(Obj.make(Operation.PersistentOperation, { ...fn, version: fn.version ?? '0.1.0' }));
96
+ });
89
97
 
90
- for (const fn of functions) {
91
- space.db.add(Obj.make(FunctionType, fn));
92
- }
98
+ // Objects.
93
99
  Array.from({ length: 10 }).map(() => {
94
100
  return space.db.add(
95
- Obj.make(ContactType, {
96
- name: faker.person.fullName(),
101
+ Obj.make(TestSchema.ContactType, {
102
+ name: random.person.fullName(),
97
103
  identifiers: [],
98
104
  }),
99
105
  );
@@ -102,8 +108,8 @@ const meta = {
102
108
  }),
103
109
  ],
104
110
  parameters: {
105
- layout: 'column',
106
- translations,
111
+ layout: 'fullscreen',
112
+ translations: [...formTranslations, ...translations],
107
113
  },
108
114
  } satisfies Meta<typeof DefaultStory>;
109
115
 
@@ -118,3 +124,44 @@ export const ReadonlySpec: Story = {
118
124
  readonlySpec: true,
119
125
  },
120
126
  };
127
+
128
+ export const Spec: Story = {
129
+ play: async ({ canvasElement }) => {
130
+ const canvas = within(canvasElement);
131
+ const webhookText = await canvas.findByText('Webhook', {}, { timeout: 10_000 });
132
+ const combobox = webhookText.closest('[role="combobox"]') as HTMLElement;
133
+ await expect(combobox).not.toBeDisabled();
134
+
135
+ // Helper to switch to a kind via keyboard.
136
+ // TODO(wittjosiah): Radix Select in popper mode doesn't close on click.
137
+ // Use keyboard navigation: open, type first letter to jump, Enter to select.
138
+ const selectKind = async (combobox: HTMLElement, firstLetter: string) => {
139
+ combobox.focus();
140
+ await userEvent.keyboard('{Enter}');
141
+ await userEvent.keyboard(firstLetter);
142
+ await userEvent.keyboard('{Enter}');
143
+ };
144
+
145
+ // Timer — should show "Cron" field.
146
+ await selectKind(combobox, 't');
147
+ await expect(canvas.findByLabelText('Cron')).resolves.toBeInTheDocument();
148
+
149
+ // Email — no extra fields; Cron should be gone.
150
+ await selectKind(combobox, 'e');
151
+ await expect(combobox).not.toBeDisabled();
152
+ await expect(canvas.queryByLabelText('Cron')).not.toBeInTheDocument();
153
+
154
+ // Webhook — should show "Method" field.
155
+ await selectKind(combobox, 'w');
156
+ await expect(canvas.findByLabelText('Method')).resolves.toBeInTheDocument();
157
+
158
+ // Subscription — should show query editor.
159
+ await selectKind(combobox, 's');
160
+ await expect(combobox).not.toBeDisabled();
161
+ await expect(canvas.queryByLabelText('Method')).not.toBeInTheDocument();
162
+
163
+ // Feed — should show DXN field (the queue address). DXN is a combobox, not an input, so use getByText.
164
+ await selectKind(combobox, 'f');
165
+ await expect(canvas.findByText('DXN')).resolves.toBeInTheDocument();
166
+ },
167
+ };
@@ -5,61 +5,89 @@
5
5
  import React, { useCallback, useMemo } from 'react';
6
6
 
7
7
  import { ComputeGraph } from '@dxos/conductor';
8
- import { type Query, Type } from '@dxos/echo';
9
- import { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';
10
- import { Filter, Ref, type Space, useQuery } from '@dxos/react-client/echo';
8
+ import { DXN, type Database, Entity, Feed, Obj, type Query } from '@dxos/echo';
9
+ import { Script, Trigger } from '@dxos/functions';
10
+ import { Operation } from '@dxos/operation';
11
+ import { Filter, Ref, useQuery } from '@dxos/react-client/echo';
11
12
  import { Input } from '@dxos/react-ui';
12
13
  import { QueryForm, type QueryFormProps } from '@dxos/react-ui-components';
13
- import { type CustomInputMap, Form, InputHeader, SelectInput, useRefQueryLookupHandler } from '@dxos/react-ui-form';
14
-
15
- import { FunctionInputEditor, type FunctionInputEditorProps } from './FunctionInputEditor';
14
+ import {
15
+ type ExcludeId,
16
+ Form,
17
+ FormFieldLabel,
18
+ type FormFieldMap,
19
+ type FormRootProps,
20
+ SelectField,
21
+ omitId,
22
+ } from '@dxos/react-ui-form';
23
+
24
+ import { FunctionInputEditor } from './FunctionInputEditor';
16
25
  import { SpecSelector } from './SpecSelector';
17
26
 
27
+ type TriggerFormSchema = ExcludeId<typeof Trigger.Trigger>;
28
+
18
29
  export type TriggerEditorProps = {
19
- space: Space;
20
- trigger: FunctionTrigger;
30
+ db: Database.Database;
31
+ trigger: Trigger.Trigger;
21
32
  // TODO(wittjosiah): This needs to apply to whole spec but currently only applies to spec.kind & spec.query.
22
33
  readonlySpec?: boolean;
23
- onSave?: (trigger: Omit<FunctionTrigger, 'id'>) => void;
24
- onCancel?: () => void;
25
- } & Pick<QueryFormProps, 'types' | 'tags'>;
26
-
27
- export const TriggerEditor = ({ space, trigger, readonlySpec, types, tags, onSave, onCancel }: TriggerEditorProps) => {
28
- const handleSave = ({ id: _, ...values }: FunctionTrigger) => {
29
- onSave?.(values);
30
- };
34
+ } &
35
+ // prettier-ignore
36
+ Pick<QueryFormProps, 'types' | 'tags'> &
37
+ Pick<FormRootProps<TriggerFormSchema>, 'onSave' | 'onCancel'>;
38
+
39
+ export const TriggerEditor = ({ db, types, tags, readonlySpec, trigger, ...formProps }: TriggerEditorProps) => {
40
+ const fieldMap = useCustomInputs({ db, types, tags, readonlySpec });
41
+
42
+ const handleValuesChanged = useCallback(
43
+ (newValues: Partial<TriggerFormSchema>) => {
44
+ Obj.change(trigger, (trigger) => {
45
+ Object.assign(trigger, newValues);
46
+ });
47
+ },
48
+ [trigger],
49
+ );
31
50
 
32
- const handleRefQueryLookup = useRefQueryLookupHandler({ space });
33
- const Custom = useCustomInputs({ space, readonlySpec, types, tags, onQueryRefOptions: handleRefQueryLookup });
51
+ const triggerSchema = useMemo(() => omitId(Trigger.Trigger), []);
52
+ const defaultValues = useMemo(() => {
53
+ const { id: _, ...values } = trigger;
54
+ return values;
55
+ }, [trigger]);
34
56
 
35
57
  return (
36
- <Form
37
- outerSpacing={false}
38
- Custom={Custom}
39
- schema={FunctionTrigger}
40
- values={trigger}
41
- onSave={handleSave}
42
- onCancel={onCancel}
43
- onQueryRefOptions={handleRefQueryLookup}
44
- />
58
+ <Form.Root<TriggerFormSchema>
59
+ {...formProps}
60
+ db={db}
61
+ schema={triggerSchema}
62
+ defaultValues={defaultValues}
63
+ fieldMap={fieldMap}
64
+ onValuesChanged={handleValuesChanged}
65
+ >
66
+ <Form.Viewport>
67
+ <Form.Content>
68
+ <Form.FieldSet />
69
+ <Form.Actions />
70
+ </Form.Content>
71
+ </Form.Viewport>
72
+ </Form.Root>
45
73
  );
46
74
  };
47
75
 
48
76
  type UseCustomInputsProps = {
49
- space: Space;
77
+ db: Database.Database;
50
78
  readonlySpec?: boolean;
51
- onQueryRefOptions: FunctionInputEditorProps['onQueryRefOptions'];
52
79
  } & Pick<QueryFormProps, 'types' | 'tags'>;
53
80
 
54
- const useCustomInputs = ({ space, readonlySpec, types, tags, onQueryRefOptions }: UseCustomInputsProps) => {
55
- const functions = useQuery(space, Filter.type(FunctionType));
56
- const workflows = useQuery(space, Filter.type(ComputeGraph));
57
- const scripts = useQuery(space, Filter.type(ScriptType));
81
+ const useCustomInputs = ({ db, readonlySpec, types, tags }: UseCustomInputsProps): FormFieldMap => {
82
+ const functions = useQuery(db, Filter.type(Operation.PersistentOperation));
83
+ const workflows = useQuery(db, Filter.type(ComputeGraph));
84
+ const scripts = useQuery(db, Filter.type(Script.Script));
85
+ const feeds = useQuery(db, Filter.type(Feed.Feed));
58
86
 
59
87
  return useMemo(
60
- (): CustomInputMap => ({
88
+ (): FormFieldMap => ({
61
89
  // Function selector.
62
- ['function' satisfies keyof FunctionTrigger]: (props) => {
90
+ ['function' satisfies keyof Trigger.Trigger]: (props) => {
63
91
  const getValue = useCallback(() => {
64
92
  const formValue = props.getValue();
65
93
  if (Ref.isRef(formValue)) {
@@ -70,17 +98,17 @@ const useCustomInputs = ({ space, readonlySpec, types, tags, onQueryRefOptions }
70
98
 
71
99
  const handleOnValueChange = useCallback(
72
100
  (_type: any, dxnString: string) => {
73
- const dxn = Type.DXN.parse(dxnString);
101
+ const dxn = DXN.parse(dxnString);
74
102
  if (dxn) {
75
103
  const ref = Ref.fromDXN(dxn);
76
- props.onValueChange('object', ref);
104
+ props.onValueChange(props.type, ref);
77
105
  }
78
106
  },
79
- [props.onValueChange],
107
+ [props.type, props.onValueChange],
80
108
  );
81
109
 
82
110
  return (
83
- <SelectInput
111
+ <SelectField
84
112
  {...props}
85
113
  getValue={getValue as any}
86
114
  onValueChange={handleOnValueChange}
@@ -90,30 +118,31 @@ const useCustomInputs = ({ space, readonlySpec, types, tags, onQueryRefOptions }
90
118
  },
91
119
 
92
120
  // Spec selector.
93
- ['spec.kind' as const]: (props) => <SpecSelector {...props} readonly={readonlySpec ? 'disabled-input' : false} />,
121
+ 'spec.kind': (props) => <SpecSelector {...props} readonly={readonlySpec} />,
122
+
123
+ // Queue feed selector with parent labels.
124
+ 'spec.queue': (props) => <SelectField {...props} options={getFeedQueueOptions(feeds)} />,
94
125
 
95
126
  // TODO(wittjosiah): Copied from ViewEditor.
96
127
  // Query input editor.
97
- ['spec.query' as const]: (props) => {
128
+ 'spec.query': (props) => {
98
129
  const handleChange = useCallback(
99
- (query: Query.Any) => props.onValueChange('object', { ast: query.ast }),
100
- [props.onValueChange],
130
+ (query: Query.Any) => props.onValueChange(props.type, { ast: query.ast }),
131
+ [props.type, props.onValueChange],
101
132
  );
102
133
 
103
134
  return (
104
135
  <Input.Root>
105
- <InputHeader label={props.label} />
136
+ <FormFieldLabel label={props.label} asChild />
106
137
  <QueryForm initialQuery={(props.getValue() as any).ast} types={types} tags={tags} onChange={handleChange} />
107
138
  </Input.Root>
108
139
  );
109
140
  },
110
141
 
111
142
  // Function input editor.
112
- ['input' as const]: (props) => (
113
- <FunctionInputEditor {...props} functions={functions} onQueryRefOptions={onQueryRefOptions} />
114
- ),
143
+ input: (props) => <FunctionInputEditor {...props} functions={functions} db={db} />,
115
144
  }),
116
- [workflows, scripts, functions, readonlySpec],
145
+ [workflows, scripts, functions, feeds, readonlySpec],
117
146
  );
118
147
  };
119
148
 
@@ -121,7 +150,20 @@ const getWorkflowOptions = (graphs: ComputeGraph[]) => {
121
150
  return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));
122
151
  };
123
152
 
124
- const getFunctionOptions = (scripts: ScriptType[], functions: FunctionType[]) => {
125
- const getLabel = (fn: FunctionType) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
153
+ const getFunctionOptions = (scripts: Script.Script[], functions: Operation.PersistentOperation[]) => {
154
+ const getLabel = (fn: Operation.PersistentOperation) =>
155
+ scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
126
156
  return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:echo:@:${fn.id}` }));
127
157
  };
158
+
159
+ const getFeedQueueOptions = (feeds: Feed.Feed[]) => {
160
+ return feeds.flatMap((feed) => {
161
+ const queueDxn = Feed.getQueueDxn(feed);
162
+ if (!queueDxn) {
163
+ return [];
164
+ }
165
+ const parent = Obj.getParent(feed);
166
+ const label = parent ? Entity.getLabel(parent) : Entity.getLabel(feed);
167
+ return [{ label: label ?? feed.id, value: queueDxn.toString() }];
168
+ });
169
+ };
@@ -7,6 +7,5 @@ import { lazy } from 'react';
7
7
  export * from './TriggerEditor';
8
8
 
9
9
  export const AutomationPanel = lazy(() => import('./AutomationPanel'));
10
- export const AutomationSettings = lazy(() => import('./AutomationSettings'));
11
- export const FunctionsContainer = lazy(() => import('./FunctionsContainer'));
12
10
  export const FunctionsPanel = lazy(() => import('./FunctionsPanel'));
11
+ export const FunctionsRegistry = lazy(() => import('./FunctionsRegistry'));
@@ -0,0 +1,31 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { AppSurface } from '@dxos/app-toolkit/ui';
8
+ import { useTranslation } from '@dxos/react-ui';
9
+ import { Settings } from '@dxos/react-ui-form';
10
+
11
+ import { meta } from '#meta';
12
+
13
+ import { AutomationPanel, type AutomationPanelProps } from '../../components/AutomationPanel';
14
+ import { TriggersSettings } from '../TriggerSettings';
15
+
16
+ export type AutomationSettingsProps = AppSurface.SpaceArticleProps<Omit<AutomationPanelProps, 'space'>>;
17
+
18
+ export const AutomationSettings = (props: AutomationSettingsProps) => {
19
+ const { t } = useTranslation(meta.id);
20
+ return (
21
+ <Settings.Viewport>
22
+ <Settings.Section
23
+ title={t('automation-verbose.label', { ns: meta.id })}
24
+ description={t('automation.description', { ns: meta.id })}
25
+ >
26
+ <AutomationPanel {...props} />
27
+ <TriggersSettings space={props.space} />
28
+ </Settings.Section>
29
+ </Settings.Viewport>
30
+ );
31
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export { AutomationSettings as default } from './AutomationSettings';