@dxos/plugin-automation 0.8.4-main.406dc2a → 0.8.4-main.43cb759274

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 (361) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +428 -0
  3. package/README.md +1 -1
  4. package/dist/lib/neutral/AutomationPanel-OKF2MDLO.mjs +12 -0
  5. package/dist/lib/neutral/AutomationPlugin.mjs +10 -0
  6. package/dist/lib/neutral/AutomationPlugin.node.mjs +1113 -0
  7. package/dist/lib/neutral/AutomationPlugin.node.mjs.map +7 -0
  8. package/dist/lib/neutral/AutomationPlugin.workerd.mjs +23 -0
  9. package/dist/lib/neutral/AutomationPlugin.workerd.mjs.map +7 -0
  10. package/dist/lib/neutral/AutomationSettings-GQF5UFM6.mjs +32 -0
  11. package/dist/lib/neutral/AutomationSettings-GQF5UFM6.mjs.map +7 -0
  12. package/dist/lib/neutral/FunctionsContainer-YBTQGCL3.mjs +38 -0
  13. package/dist/lib/neutral/FunctionsContainer-YBTQGCL3.mjs.map +7 -0
  14. package/dist/lib/neutral/FunctionsPanel-L32Z67B7.mjs +97 -0
  15. package/dist/lib/neutral/FunctionsPanel-L32Z67B7.mjs.map +7 -0
  16. package/dist/lib/neutral/FunctionsRegistry-RTCY3LXE.mjs +95 -0
  17. package/dist/lib/neutral/FunctionsRegistry-RTCY3LXE.mjs.map +7 -0
  18. package/dist/lib/neutral/TriggerSettings-XCHIZPOR.mjs +9 -0
  19. package/dist/lib/neutral/app-graph-builder-Q3LJLICE.mjs +75 -0
  20. package/dist/lib/neutral/app-graph-builder-Q3LJLICE.mjs.map +7 -0
  21. package/dist/lib/neutral/capabilities/index.mjs +19 -0
  22. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  23. package/dist/lib/neutral/capabilities/node.mjs +17 -0
  24. package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-2JP77CMN.mjs +42 -0
  26. package/dist/lib/neutral/chunk-2JP77CMN.mjs.map +7 -0
  27. package/dist/lib/neutral/chunk-7YWISQOZ.mjs +54 -0
  28. package/dist/lib/neutral/chunk-7YWISQOZ.mjs.map +7 -0
  29. package/dist/lib/neutral/chunk-C7H62AU3.mjs +435 -0
  30. package/dist/lib/neutral/chunk-C7H62AU3.mjs.map +7 -0
  31. package/dist/lib/neutral/chunk-CMM3AFHR.mjs +111 -0
  32. package/dist/lib/neutral/chunk-CMM3AFHR.mjs.map +7 -0
  33. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  34. package/dist/lib/neutral/chunk-LRVJEKMN.mjs +40 -0
  35. package/dist/lib/neutral/chunk-LRVJEKMN.mjs.map +7 -0
  36. package/dist/lib/neutral/chunk-MBIODLCB.mjs +12 -0
  37. package/dist/lib/neutral/chunk-MBIODLCB.mjs.map +7 -0
  38. package/dist/lib/neutral/chunk-NCCFEPBZ.mjs +76 -0
  39. package/dist/lib/neutral/chunk-NCCFEPBZ.mjs.map +7 -0
  40. package/dist/lib/neutral/chunk-RCBE37YU.mjs +368 -0
  41. package/dist/lib/neutral/chunk-RCBE37YU.mjs.map +7 -0
  42. package/dist/lib/neutral/chunk-TJOQNSS5.mjs +8 -0
  43. package/dist/lib/neutral/chunk-TJOQNSS5.mjs.map +7 -0
  44. package/dist/lib/neutral/components/index.mjs +16 -0
  45. package/dist/lib/neutral/containers/index.mjs +13 -0
  46. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  47. package/dist/lib/neutral/create-trigger-from-template-5YUHZOFA.mjs +68 -0
  48. package/dist/lib/neutral/create-trigger-from-template-5YUHZOFA.mjs.map +7 -0
  49. package/dist/lib/neutral/hooks/index.mjs +10 -0
  50. package/dist/lib/neutral/index.mjs +16 -0
  51. package/dist/lib/neutral/layer-specs-OXK75RDW.mjs +141 -0
  52. package/dist/lib/neutral/layer-specs-OXK75RDW.mjs.map +7 -0
  53. package/dist/lib/neutral/meta.json +1 -0
  54. package/dist/lib/neutral/meta.mjs +8 -0
  55. package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs +13 -0
  56. package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs.map +7 -0
  57. package/dist/lib/neutral/operations/index.mjs +8 -0
  58. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  59. package/dist/lib/neutral/plugin.mjs +16 -0
  60. package/dist/lib/neutral/plugin.mjs.map +7 -0
  61. package/dist/lib/neutral/react-surface-FOOBGYNG.mjs +57 -0
  62. package/dist/lib/neutral/react-surface-FOOBGYNG.mjs.map +7 -0
  63. package/dist/lib/neutral/registry-sync-JYDDTBAE.mjs +82 -0
  64. package/dist/lib/neutral/registry-sync-JYDDTBAE.mjs.map +7 -0
  65. package/dist/lib/neutral/testing.mjs +8 -0
  66. package/dist/lib/neutral/testing.mjs.map +7 -0
  67. package/dist/lib/neutral/translations.mjs +60 -0
  68. package/dist/lib/neutral/translations.mjs.map +7 -0
  69. package/dist/lib/neutral/trigger-runtime-controller-BOEJYGWC.mjs +77 -0
  70. package/dist/lib/neutral/trigger-runtime-controller-BOEJYGWC.mjs.map +7 -0
  71. package/dist/lib/neutral/types/index.mjs +12 -0
  72. package/dist/lib/neutral/types/index.mjs.map +7 -0
  73. package/dist/types/src/AutomationPlugin.d.ts +3 -1
  74. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  75. package/dist/types/src/AutomationPlugin.node.d.ts +4 -0
  76. package/dist/types/src/AutomationPlugin.node.d.ts.map +1 -0
  77. package/dist/types/src/AutomationPlugin.test.d.ts +2 -0
  78. package/dist/types/src/AutomationPlugin.test.d.ts.map +1 -0
  79. package/dist/types/src/AutomationPlugin.workerd.d.ts +4 -0
  80. package/dist/types/src/AutomationPlugin.workerd.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  82. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  83. package/dist/types/src/capabilities/index.d.ts +8 -5
  84. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  85. package/dist/types/src/capabilities/layer-specs.d.ts +6 -0
  86. package/dist/types/src/capabilities/layer-specs.d.ts.map +1 -0
  87. package/dist/types/src/capabilities/node.d.ts +8 -0
  88. package/dist/types/src/capabilities/node.d.ts.map +1 -0
  89. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  90. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  92. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  93. package/dist/types/src/capabilities/registry-sync.d.ts +21 -0
  94. package/dist/types/src/capabilities/registry-sync.d.ts.map +1 -0
  95. package/dist/types/src/capabilities/trigger-runtime-controller.d.ts +5 -0
  96. package/dist/types/src/capabilities/trigger-runtime-controller.d.ts.map +1 -0
  97. package/dist/types/src/capabilities/trigger-runtime-controller.test.d.ts +2 -0
  98. package/dist/types/src/capabilities/trigger-runtime-controller.test.d.ts.map +1 -0
  99. package/dist/types/src/commands/index.d.ts +2 -0
  100. package/dist/types/src/commands/index.d.ts.map +1 -0
  101. package/dist/types/src/commands/trigger/create/index.d.ts +25 -0
  102. package/dist/types/src/commands/trigger/create/index.d.ts.map +1 -0
  103. package/dist/types/src/commands/trigger/create/queue.d.ts +13 -0
  104. package/dist/types/src/commands/trigger/create/queue.d.ts.map +1 -0
  105. package/dist/types/src/commands/trigger/create/subscription.d.ts +15 -0
  106. package/dist/types/src/commands/trigger/create/subscription.d.ts.map +1 -0
  107. package/dist/types/src/commands/trigger/create/timer.d.ts +13 -0
  108. package/dist/types/src/commands/trigger/create/timer.d.ts.map +1 -0
  109. package/dist/types/src/commands/trigger/index.d.ts +57 -0
  110. package/dist/types/src/commands/trigger/index.d.ts.map +1 -0
  111. package/dist/types/src/commands/trigger/list.d.ts +7 -0
  112. package/dist/types/src/commands/trigger/list.d.ts.map +1 -0
  113. package/dist/types/src/commands/trigger/options.d.ts +10 -0
  114. package/dist/types/src/commands/trigger/options.d.ts.map +1 -0
  115. package/dist/types/src/commands/trigger/remove.d.ts +8 -0
  116. package/dist/types/src/commands/trigger/remove.d.ts.map +1 -0
  117. package/dist/types/src/commands/trigger/update/index.d.ts +28 -0
  118. package/dist/types/src/commands/trigger/update/index.d.ts.map +1 -0
  119. package/dist/types/src/commands/trigger/update/queue.d.ts +11 -0
  120. package/dist/types/src/commands/trigger/update/queue.d.ts.map +1 -0
  121. package/dist/types/src/commands/trigger/update/subscription.d.ts +13 -0
  122. package/dist/types/src/commands/trigger/update/subscription.d.ts.map +1 -0
  123. package/dist/types/src/commands/trigger/update/timer.d.ts +11 -0
  124. package/dist/types/src/commands/trigger/update/timer.d.ts.map +1 -0
  125. package/dist/types/src/commands/trigger/util.d.ts +85 -0
  126. package/dist/types/src/commands/trigger/util.d.ts.map +1 -0
  127. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +6 -7
  128. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  129. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +45 -27
  130. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  131. package/dist/types/src/components/AutomationPanel/TriggerEdgeMetadata.d.ts +18 -0
  132. package/dist/types/src/components/AutomationPanel/TriggerEdgeMetadata.d.ts.map +1 -0
  133. package/dist/types/src/components/AutomationPanel/index.d.ts.map +1 -1
  134. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
  135. package/dist/types/src/components/FunctionsPanel/index.d.ts.map +1 -1
  136. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +8 -0
  137. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
  138. package/dist/types/src/components/FunctionsRegistry/index.d.ts +4 -0
  139. package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
  140. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
  141. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
  142. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
  143. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
  144. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +9 -8
  145. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  146. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +117 -29
  147. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  148. package/dist/types/src/components/TriggerEditor/util.d.ts +14 -0
  149. package/dist/types/src/components/TriggerEditor/util.d.ts.map +1 -0
  150. package/dist/types/src/components/index.d.ts +3 -4
  151. package/dist/types/src/components/index.d.ts.map +1 -1
  152. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +6 -0
  153. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
  154. package/dist/types/src/containers/AutomationSettings/index.d.ts +2 -0
  155. package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
  156. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts +4 -0
  157. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
  158. package/dist/types/src/containers/FunctionsContainer/index.d.ts +2 -0
  159. package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -0
  160. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
  161. package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
  162. package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
  163. package/dist/types/src/containers/index.d.ts +5 -0
  164. package/dist/types/src/containers/index.d.ts.map +1 -0
  165. package/dist/types/src/hooks/index.d.ts +1 -1
  166. package/dist/types/src/hooks/index.d.ts.map +1 -1
  167. package/dist/types/src/hooks/useEdgeTriggersDispatcherStatus.d.ts +13 -0
  168. package/dist/types/src/hooks/useEdgeTriggersDispatcherStatus.d.ts.map +1 -0
  169. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +6 -5
  170. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
  171. package/dist/types/src/index.d.ts +1 -4
  172. package/dist/types/src/index.d.ts.map +1 -1
  173. package/dist/types/src/meta.d.ts +2 -2
  174. package/dist/types/src/meta.d.ts.map +1 -1
  175. package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
  176. package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
  177. package/dist/types/src/operations/index.d.ts +3 -0
  178. package/dist/types/src/operations/index.d.ts.map +1 -0
  179. package/dist/types/src/plugin.d.ts +4 -0
  180. package/dist/types/src/plugin.d.ts.map +1 -0
  181. package/dist/types/src/testing/test-functions.d.ts +318 -3
  182. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  183. package/dist/types/src/testing.d.ts +2 -0
  184. package/dist/types/src/testing.d.ts.map +1 -0
  185. package/dist/types/src/translations.d.ts +45 -28
  186. package/dist/types/src/translations.d.ts.map +1 -1
  187. package/dist/types/src/types/AutomationOperation.d.ts +21 -0
  188. package/dist/types/src/types/AutomationOperation.d.ts.map +1 -0
  189. package/dist/types/src/types/index.d.ts +1 -0
  190. package/dist/types/src/types/index.d.ts.map +1 -1
  191. package/dist/types/src/types/schema.d.ts +13 -5
  192. package/dist/types/src/types/schema.d.ts.map +1 -1
  193. package/dist/types/tsconfig.tsbuildinfo +1 -1
  194. package/package.json +136 -69
  195. package/src/AutomationPlugin.node.ts +35 -0
  196. package/src/AutomationPlugin.test.ts +27 -0
  197. package/src/AutomationPlugin.tsx +39 -36
  198. package/src/AutomationPlugin.workerd.ts +18 -0
  199. package/src/capabilities/app-graph-builder.ts +59 -80
  200. package/src/capabilities/index.ts +14 -7
  201. package/src/capabilities/layer-specs.ts +197 -0
  202. package/src/capabilities/node.ts +18 -0
  203. package/src/capabilities/operation-handler.ts +16 -0
  204. package/src/capabilities/react-surface.tsx +49 -45
  205. package/src/capabilities/registry-sync.ts +110 -0
  206. package/src/capabilities/trigger-runtime-controller.test.ts +103 -0
  207. package/src/capabilities/trigger-runtime-controller.ts +126 -0
  208. package/src/commands/index.ts +5 -0
  209. package/src/commands/trigger/create/index.ts +14 -0
  210. package/src/commands/trigger/create/queue.ts +87 -0
  211. package/src/commands/trigger/create/subscription.ts +125 -0
  212. package/src/commands/trigger/create/timer.ts +90 -0
  213. package/src/commands/trigger/index.ts +16 -0
  214. package/src/commands/trigger/list.ts +70 -0
  215. package/src/commands/trigger/options.ts +47 -0
  216. package/src/commands/trigger/remove.ts +45 -0
  217. package/src/commands/trigger/update/index.ts +14 -0
  218. package/src/commands/trigger/update/queue.ts +191 -0
  219. package/src/commands/trigger/update/subscription.ts +279 -0
  220. package/src/commands/trigger/update/timer.ts +195 -0
  221. package/src/commands/trigger/util.ts +410 -0
  222. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +13 -7
  223. package/src/components/AutomationPanel/AutomationPanel.tsx +260 -100
  224. package/src/components/AutomationPanel/TriggerEdgeMetadata.tsx +148 -0
  225. package/src/components/FunctionsPanel/FunctionsPanel.tsx +50 -30
  226. package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +119 -0
  227. package/src/components/FunctionsRegistry/index.ts +8 -0
  228. package/src/components/TriggerEditor/FunctionInputEditor.tsx +39 -42
  229. package/src/components/TriggerEditor/SpecSelector.tsx +28 -22
  230. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +105 -41
  231. package/src/components/TriggerEditor/TriggerEditor.tsx +179 -56
  232. package/src/components/TriggerEditor/util.ts +51 -0
  233. package/src/components/index.ts +1 -2
  234. package/src/containers/AutomationSettings/AutomationSettings.tsx +31 -0
  235. package/src/containers/AutomationSettings/index.ts +5 -0
  236. package/src/containers/FunctionsContainer/FunctionsContainer.tsx +33 -0
  237. package/src/containers/FunctionsContainer/index.ts +5 -0
  238. package/src/containers/TriggerSettings/TriggerSettings.tsx +48 -0
  239. package/src/containers/TriggerSettings/index.ts +6 -0
  240. package/src/containers/index.ts +9 -0
  241. package/src/hooks/index.ts +2 -1
  242. package/src/hooks/useEdgeTriggersDispatcherStatus.ts +78 -0
  243. package/src/hooks/useTriggerRuntimeControls.ts +39 -19
  244. package/src/index.ts +1 -5
  245. package/src/meta.ts +30 -7
  246. package/src/operations/create-trigger-from-template.ts +70 -0
  247. package/src/operations/index.ts +7 -0
  248. package/src/plugin.ts +11 -0
  249. package/src/testing/test-functions.ts +43 -9
  250. package/src/testing.ts +7 -0
  251. package/src/translations.ts +53 -33
  252. package/src/types/AutomationOperation.ts +39 -0
  253. package/src/types/index.ts +2 -0
  254. package/src/types/schema.ts +6 -6
  255. package/src/vite-env.d.ts +10 -0
  256. package/dist/lib/browser/AutomationPanel-3PHA5FTJ.mjs +0 -11
  257. package/dist/lib/browser/AutomationSettings-3EYSPFKB.mjs +0 -69
  258. package/dist/lib/browser/AutomationSettings-3EYSPFKB.mjs.map +0 -7
  259. package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs +0 -36
  260. package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs.map +0 -7
  261. package/dist/lib/browser/FunctionsPanel-NRIKAPQV.mjs +0 -10
  262. package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs +0 -81
  263. package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs.map +0 -7
  264. package/dist/lib/browser/chunk-5ARH77PV.mjs +0 -15
  265. package/dist/lib/browser/chunk-5ARH77PV.mjs.map +0 -7
  266. package/dist/lib/browser/chunk-6TUZQIEN.mjs +0 -14
  267. package/dist/lib/browser/chunk-6TUZQIEN.mjs.map +0 -7
  268. package/dist/lib/browser/chunk-DK7BLEKU.mjs +0 -14
  269. package/dist/lib/browser/chunk-DK7BLEKU.mjs.map +0 -7
  270. package/dist/lib/browser/chunk-DLLE4FKP.mjs +0 -94
  271. package/dist/lib/browser/chunk-DLLE4FKP.mjs.map +0 -7
  272. package/dist/lib/browser/chunk-MVPRI3DB.mjs +0 -53
  273. package/dist/lib/browser/chunk-MVPRI3DB.mjs.map +0 -7
  274. package/dist/lib/browser/chunk-SUKAEYF3.mjs +0 -267
  275. package/dist/lib/browser/chunk-SUKAEYF3.mjs.map +0 -7
  276. package/dist/lib/browser/chunk-VGBZKM3O.mjs +0 -38
  277. package/dist/lib/browser/chunk-VGBZKM3O.mjs.map +0 -7
  278. package/dist/lib/browser/chunk-VL3KSDVL.mjs +0 -183
  279. package/dist/lib/browser/chunk-VL3KSDVL.mjs.map +0 -7
  280. package/dist/lib/browser/chunk-WWURMV25.mjs +0 -13
  281. package/dist/lib/browser/chunk-WWURMV25.mjs.map +0 -7
  282. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs +0 -160
  283. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs.map +0 -7
  284. package/dist/lib/browser/hooks/index.mjs +0 -12
  285. package/dist/lib/browser/index.mjs +0 -121
  286. package/dist/lib/browser/index.mjs.map +0 -7
  287. package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs +0 -77
  288. package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs.map +0 -7
  289. package/dist/lib/browser/meta.json +0 -1
  290. package/dist/lib/browser/react-surface-G7CG7BML.mjs +0 -63
  291. package/dist/lib/browser/react-surface-G7CG7BML.mjs.map +0 -7
  292. package/dist/lib/browser/types/index.mjs +0 -8
  293. package/dist/lib/node-esm/AutomationPanel-EETYIR35.mjs +0 -12
  294. package/dist/lib/node-esm/AutomationSettings-WKSMWITV.mjs +0 -70
  295. package/dist/lib/node-esm/AutomationSettings-WKSMWITV.mjs.map +0 -7
  296. package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs +0 -37
  297. package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs.map +0 -7
  298. package/dist/lib/node-esm/FunctionsPanel-SAMRTELO.mjs +0 -11
  299. package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs +0 -82
  300. package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs.map +0 -7
  301. package/dist/lib/node-esm/chunk-2EWXIFEK.mjs +0 -16
  302. package/dist/lib/node-esm/chunk-2EWXIFEK.mjs.map +0 -7
  303. package/dist/lib/node-esm/chunk-5MQJPJR2.mjs +0 -15
  304. package/dist/lib/node-esm/chunk-5MQJPJR2.mjs.map +0 -7
  305. package/dist/lib/node-esm/chunk-AKHETVIQ.mjs +0 -184
  306. package/dist/lib/node-esm/chunk-AKHETVIQ.mjs.map +0 -7
  307. package/dist/lib/node-esm/chunk-B7N3H45O.mjs +0 -16
  308. package/dist/lib/node-esm/chunk-B7N3H45O.mjs.map +0 -7
  309. package/dist/lib/node-esm/chunk-CJUI6AKX.mjs +0 -39
  310. package/dist/lib/node-esm/chunk-CJUI6AKX.mjs.map +0 -7
  311. package/dist/lib/node-esm/chunk-J3XEBEIE.mjs +0 -268
  312. package/dist/lib/node-esm/chunk-J3XEBEIE.mjs.map +0 -7
  313. package/dist/lib/node-esm/chunk-QCA543ZR.mjs +0 -54
  314. package/dist/lib/node-esm/chunk-QCA543ZR.mjs.map +0 -7
  315. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs +0 -16
  316. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs.map +0 -7
  317. package/dist/lib/node-esm/chunk-YQXW3JXD.mjs +0 -95
  318. package/dist/lib/node-esm/chunk-YQXW3JXD.mjs.map +0 -7
  319. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs +0 -161
  320. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs.map +0 -7
  321. package/dist/lib/node-esm/hooks/index.mjs +0 -13
  322. package/dist/lib/node-esm/index.mjs +0 -122
  323. package/dist/lib/node-esm/index.mjs.map +0 -7
  324. package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs +0 -78
  325. package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs.map +0 -7
  326. package/dist/lib/node-esm/meta.json +0 -1
  327. package/dist/lib/node-esm/react-surface-OMZSBDHS.mjs +0 -64
  328. package/dist/lib/node-esm/react-surface-OMZSBDHS.mjs.map +0 -7
  329. package/dist/lib/node-esm/types/index.mjs +0 -9
  330. package/dist/types/src/capabilities/capabilities.d.ts +0 -19
  331. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  332. package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
  333. package/dist/types/src/capabilities/compute-runtime.d.ts.map +0 -1
  334. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  335. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  336. package/dist/types/src/components/AutomationSettings.d.ts +0 -5
  337. package/dist/types/src/components/AutomationSettings.d.ts.map +0 -1
  338. package/dist/types/src/components/FunctionsContainer.d.ts +0 -7
  339. package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
  340. package/dist/types/src/components/TriggerSettings.d.ts.map +0 -1
  341. package/dist/types/src/events.d.ts +0 -4
  342. package/dist/types/src/events.d.ts.map +0 -1
  343. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +0 -8
  344. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +0 -1
  345. package/src/capabilities/capabilities.ts +0 -48
  346. package/src/capabilities/compute-runtime.ts +0 -138
  347. package/src/capabilities/intent-resolver.ts +0 -72
  348. package/src/components/AutomationSettings.tsx +0 -30
  349. package/src/components/FunctionsContainer.tsx +0 -29
  350. package/src/components/TriggerSettings.tsx +0 -25
  351. package/src/events.ts +0 -11
  352. package/src/hooks/useComputeRuntimeCallback.ts +0 -30
  353. /package/dist/lib/{browser/AutomationPanel-3PHA5FTJ.mjs.map → neutral/AutomationPanel-OKF2MDLO.mjs.map} +0 -0
  354. /package/dist/lib/{browser/FunctionsPanel-NRIKAPQV.mjs.map → neutral/AutomationPlugin.mjs.map} +0 -0
  355. /package/dist/lib/{browser/hooks/index.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
  356. /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  357. /package/dist/lib/{node-esm/hooks → neutral/components}/index.mjs.map +0 -0
  358. /package/dist/lib/{node-esm/types → neutral/hooks}/index.mjs.map +0 -0
  359. /package/dist/lib/{node-esm/AutomationPanel-EETYIR35.mjs.map → neutral/index.mjs.map} +0 -0
  360. /package/dist/lib/{node-esm/FunctionsPanel-SAMRTELO.mjs.map → neutral/meta.mjs.map} +0 -0
  361. /package/dist/types/src/{components → containers/TriggerSettings}/TriggerSettings.d.ts +0 -0
@@ -5,17 +5,18 @@
5
5
  import * as Schema from 'effect/Schema';
6
6
  import React, { useCallback, useMemo } from 'react';
7
7
 
8
- import { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';
9
- import { FunctionType, ScriptType } from '@dxos/functions';
10
- import { Filter, type Space, fullyQualifiedId, useQuery } from '@dxos/react-client/echo';
11
- import { Button, useTranslation } from '@dxos/react-ui';
12
- import { controlItemClasses } from '@dxos/react-ui-form';
8
+ import { useOperationInvoker } from '@dxos/app-framework/ui';
9
+ import { LayoutOperation, getObjectPathFromObject } from '@dxos/app-toolkit';
10
+ import { Operation, Script } from '@dxos/compute';
11
+ import { Filter, Type } from '@dxos/echo';
12
+ import { SpaceOperation } from '@dxos/plugin-space';
13
+ import { type Space, useQuery } from '@dxos/react-client/echo';
14
+ import { IconButton, useTranslation } from '@dxos/react-ui';
15
+ import { Settings } from '@dxos/react-ui-form';
13
16
  import { List } from '@dxos/react-ui-list';
14
- import { ghostHover, mx } from '@dxos/react-ui-theme';
17
+ import { ghostHover, mx } from '@dxos/ui-theme';
15
18
 
16
- import { meta } from '../../meta';
17
-
18
- const grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';
19
+ import { meta } from '#meta';
19
20
 
20
21
  export type FunctionsPanelProps = {
21
22
  space: Space;
@@ -23,9 +24,9 @@ export type FunctionsPanelProps = {
23
24
 
24
25
  export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
25
26
  const { t } = useTranslation(meta.id);
26
- const functions = useQuery(space, Filter.type(FunctionType));
27
- const scripts = useQuery(space, Filter.type(ScriptType));
28
- const { dispatchPromise: dispatch } = useIntentDispatcher();
27
+ const functions = useQuery(space.db, Filter.type(Operation.PersistentOperation));
28
+ const scripts = useQuery(space.db, Filter.type(Script.Script));
29
+ const { invokePromise } = useOperationInvoker();
29
30
 
30
31
  const functionToScriptMap = useMemo(
31
32
  () =>
@@ -40,13 +41,13 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
40
41
  }
41
42
  return map;
42
43
  },
43
- {} as Record<string, ScriptType>,
44
+ {} as Record<string, Script.Script>,
44
45
  ),
45
46
  [functions, scripts],
46
47
  );
47
48
 
48
49
  const getScriptName = useCallback(
49
- (func: FunctionType) => {
50
+ (func: Operation.PersistentOperation) => {
50
51
  const script = functionToScriptMap[func.id];
51
52
  return script?.name;
52
53
  },
@@ -54,44 +55,63 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
54
55
  );
55
56
 
56
57
  const handleGoToScript = useCallback(
57
- (func: FunctionType) => {
58
+ (func: Operation.PersistentOperation) => {
58
59
  const script = functionToScriptMap[func.id];
59
60
  if (script) {
60
- void dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [fullyQualifiedId(script)] }));
61
+ void invokePromise(LayoutOperation.Open, { subject: [getObjectPathFromObject(script)] });
61
62
  }
62
63
  },
63
- [functionToScriptMap, dispatch],
64
+ [functionToScriptMap, invokePromise],
65
+ );
66
+
67
+ const handleDelete = useCallback(
68
+ (func: Operation.PersistentOperation) => invokePromise(SpaceOperation.RemoveObjects, { objects: [func] }),
69
+ [invokePromise],
64
70
  );
65
71
 
66
72
  return (
67
- <div role='none' className={mx(controlItemClasses)}>
73
+ <Settings.Panel>
68
74
  {functions.length > 0 && (
69
- <List.Root<FunctionType> items={functions} isItem={Schema.is(FunctionType)} getId={(func) => func.id}>
75
+ <List.Root<Operation.PersistentOperation>
76
+ items={functions}
77
+ isItem={Schema.is(Type.getSchema(Operation.PersistentOperation))}
78
+ getId={(func) => func.id}
79
+ >
70
80
  {({ items }) => (
71
81
  <div role='list' className='flex flex-col w-full'>
72
82
  {items?.map((func) => (
73
- <List.Item<FunctionType>
83
+ <List.Item<Operation.PersistentOperation>
74
84
  key={func.id}
75
85
  item={func}
76
- classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}
86
+ classNames={mx(
87
+ 'grid grid-cols-[1fr_min-content_auto] min-h-[2.5rem] min-h-[3rem] px-2 items-center',
88
+ ghostHover,
89
+ )}
77
90
  >
78
91
  <div className='flex flex-col truncate'>
79
92
  <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
80
- {getScriptName(func) && (
81
- <div className='text-xs text-description truncate'>{getScriptName(func)}</div>
82
- )}
93
+ {getScriptName(func) && <p className='text-xs text-description truncate'>{getScriptName(func)}</p>}
83
94
  </div>
84
- {functionToScriptMap[func.id] && (
85
- <Button onClick={() => handleGoToScript(func)}>{t('go to function source button label')}</Button>
86
- )}
95
+ {(functionToScriptMap[func.id] && (
96
+ <IconButton
97
+ icon='ph--arrow-square-out--regular'
98
+ iconOnly
99
+ label={t('show-source-button.label')}
100
+ onClick={() => handleGoToScript(func)}
101
+ />
102
+ )) || <div />}
103
+ <IconButton
104
+ icon='ph--trash--regular'
105
+ iconOnly
106
+ label={t('delete-function-button.label')}
107
+ onClick={() => handleDelete(func)}
108
+ />
87
109
  </List.Item>
88
110
  ))}
89
111
  </div>
90
112
  )}
91
113
  </List.Root>
92
114
  )}
93
-
94
- {functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}
95
- </div>
115
+ </Settings.Panel>
96
116
  );
97
117
  };
@@ -0,0 +1,119 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Schema from 'effect/Schema';
6
+ import { useState } from 'react';
7
+ import React, { useCallback } from 'react';
8
+
9
+ import * as OperationModule from '@dxos/compute';
10
+ import { Context } from '@dxos/context';
11
+ import { Filter, Obj, Type } from '@dxos/echo';
12
+ import { getDeployedFunctions } from '@dxos/functions-runtime/edge';
13
+ import { useClient } from '@dxos/react-client';
14
+ import { type Space, useQuery } from '@dxos/react-client/echo';
15
+ import { IconButton, useAsyncEffect, useTranslation } from '@dxos/react-ui';
16
+ import { Settings } from '@dxos/react-ui-form';
17
+ import { List } from '@dxos/react-ui-list';
18
+ import { ghostHover, mx } from '@dxos/ui-theme';
19
+
20
+ import { meta } from '#meta';
21
+
22
+ const grid = 'grid grid-cols-[1fr_1fr_auto] min-h-[2.5rem]';
23
+
24
+ type FunctionsRegistryProps = {
25
+ space: Space;
26
+ };
27
+
28
+ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
29
+ const client = useClient();
30
+ const [loading, setLoading] = useState(true);
31
+ const [functions, setFunctions] = useState<OperationModule.Operation.PersistentOperation[]>([]);
32
+ const { t } = useTranslation(meta.id);
33
+
34
+ const dbFunctions = useQuery(space.db, Filter.type(OperationModule.Operation.PersistentOperation));
35
+
36
+ const state = (func: OperationModule.Operation.PersistentOperation) => {
37
+ const funcKey = Obj.getMeta(func).key;
38
+ const dbFunction = dbFunctions.find((f) => Obj.getMeta(f).key === funcKey);
39
+ if (!dbFunction) {
40
+ return 'import';
41
+ }
42
+ if (Obj.getMeta(dbFunction).version === Obj.getMeta(func).version && dbFunction.updated === func.updated) {
43
+ return 'none';
44
+ }
45
+ return 'update';
46
+ };
47
+
48
+ useAsyncEffect(async () => {
49
+ setLoading(true);
50
+ const functions = await getDeployedFunctions(Context.default(), client, true);
51
+ setFunctions(functions);
52
+ setLoading(false);
53
+ }, []);
54
+
55
+ const hanleImportOrUpdate = useCallback(
56
+ async (func: OperationModule.Operation.PersistentOperation) => {
57
+ const funcKey = Obj.getMeta(func).key;
58
+ const functions = funcKey
59
+ ? await space.db
60
+ .query(Filter.and(Filter.type(OperationModule.Operation.PersistentOperation), Filter.key(funcKey)))
61
+ .run()
62
+ : [];
63
+ const [existingFunc] = functions;
64
+ if (!existingFunc) {
65
+ space.db.add(func);
66
+ return;
67
+ }
68
+ OperationModule.Operation.setFrom(existingFunc, func);
69
+ },
70
+ [space],
71
+ );
72
+
73
+ return (
74
+ <Settings.Panel>
75
+ {functions.length > 0 && (
76
+ <List.Root<OperationModule.Operation.PersistentOperation>
77
+ items={functions}
78
+ isItem={Schema.is(Type.getSchema(OperationModule.Operation.PersistentOperation))}
79
+ getId={(func) => func.id}
80
+ >
81
+ {({ items }) => (
82
+ <div role='list' className='flex flex-col w-full'>
83
+ {items?.map((func) => (
84
+ <List.Item<OperationModule.Operation.PersistentOperation>
85
+ key={func.id}
86
+ item={func}
87
+ classNames={mx(grid, ghostHover, 'items-center', 'px-2', 'min-h-[3rem]')}
88
+ >
89
+ <div className='flex flex-col truncate'>
90
+ <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
91
+ <div className='text-xs text-description truncate'>{Obj.getMeta(func).key}</div>
92
+ </div>
93
+ <div className='flex flex-col truncate'>
94
+ <div className='text-xs text-description truncate'>{Obj.getMeta(func).version}</div>
95
+ <div className='text-xs text-description truncate'>
96
+ {func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : ''}
97
+ </div>
98
+ </div>
99
+
100
+ <IconButton
101
+ iconOnly
102
+ icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}
103
+ label={
104
+ state(func) === 'update' ? t('update-function-button.label') : t('import-function-button.label')
105
+ }
106
+ disabled={state(func) === 'none'}
107
+ onClick={() => hanleImportOrUpdate(func)}
108
+ />
109
+ </List.Item>
110
+ ))}
111
+ </div>
112
+ )}
113
+ </List.Root>
114
+ )}
115
+
116
+ {loading && <div className='text-center py-4 text-gray-500'>{t('loading-functions.message')}</div>}
117
+ </Settings.Panel>
118
+ );
119
+ };
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { FunctionsRegistry } from './FunctionsRegistry';
6
+
7
+ export { FunctionsRegistry };
8
+ export default FunctionsRegistry;
@@ -2,38 +2,31 @@
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 Operation } from '@dxos/compute';
9
+ import { type Database, JsonSchema, Obj, Ref } from '@dxos/echo';
8
10
  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';
11
+ import { useOnTransition, useTranslation } from '@dxos/react-ui';
12
+ import { Form, type FormFieldStateProps, type FormRootProps, useFormValues } from '@dxos/react-ui-form';
12
13
 
13
- export type FunctionInputEditorProps = {
14
- functions: FunctionType[];
15
- onQueryRefOptions: QueryRefOptions;
16
- } & FormInputStateProps;
14
+ import { meta } from '#meta';
15
+
16
+ import { findOperationByUri } from './util';
17
17
 
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]);
28
- const selectedFunctionId = useMemo(() => {
29
- if (Ref.isRef(selectedFunctionValue)) {
30
- return selectedFunctionValue.dxn.toString().split('dxn:echo:@:').at(1);
31
- }
32
- }, [selectedFunctionValue]);
18
+ export type FunctionInputEditorProps = {
19
+ type: SchemaAST.AST;
20
+ functions: Operation.PersistentOperation[];
21
+ db?: Database.Database;
22
+ } & FormFieldStateProps;
33
23
 
24
+ export const FunctionInputEditor = ({ type, functions, db, getValue, onValueChange }: FunctionInputEditorProps) => {
25
+ const { t } = useTranslation(meta.id);
26
+ const selectedFunctionValue = useFormValues(FunctionInputEditor.displayName, ['function' as JsonPath]);
34
27
  const selectedFunction = useMemo(
35
- () => functions.find((fn) => fn.id === selectedFunctionId),
36
- [functions, selectedFunctionId],
28
+ () => (Ref.isRef(selectedFunctionValue) ? findOperationByUri(functions, selectedFunctionValue.uri) : undefined),
29
+ [functions, selectedFunctionValue],
37
30
  );
38
31
 
39
32
  useOnTransition(
@@ -44,23 +37,25 @@ export const FunctionInputEditor = ({
44
37
  return false;
45
38
  }
46
39
 
47
- return prevValue.dxn.toString() !== selectedFunctionValue.dxn.toString();
40
+ return prevValue.uri !== selectedFunctionValue.uri;
48
41
  },
49
42
  (currValue) => currValue !== undefined,
50
- () => onValueChange('object', {}),
43
+ () => onValueChange(type, {}),
51
44
  );
52
45
 
53
46
  const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);
54
- const effectSchema = useMemo(() => (inputSchema ? Type.toEffectSchema(inputSchema) : undefined), [inputSchema]);
47
+ const effectSchema = useMemo(() => (inputSchema ? JsonSchema.toEffectSchema(inputSchema) : undefined), [inputSchema]);
55
48
  const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;
49
+ const defaultValues = useMemo(() => {
50
+ const raw = getValue() ?? {};
51
+ return Obj.isObject(raw) ? { ...Obj.getSnapshot(raw) } : { ...raw };
52
+ }, [getValue]);
56
53
 
57
- const values = useMemo(() => getValue() ?? {}, [getValue]);
58
-
59
- const handleValuesChanged = useCallback(
60
- (values: any) => {
61
- onValueChange('object', values);
54
+ const handleValuesChanged = useCallback<NonNullable<FormRootProps['onValuesChanged']>>(
55
+ (values) => {
56
+ onValueChange(type, values);
62
57
  },
63
- [onValueChange],
58
+ [type, onValueChange],
64
59
  );
65
60
 
66
61
  if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {
@@ -69,16 +64,18 @@ export const FunctionInputEditor = ({
69
64
 
70
65
  return (
71
66
  <>
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
67
+ <Form.Label label={t('function-parameters.label')} asChild />
68
+ <Form.Root
69
+ key={selectedFunction.id}
76
70
  schema={effectSchema}
77
- values={values}
71
+ defaultValues={defaultValues}
72
+ db={db}
78
73
  onValuesChanged={handleValuesChanged}
79
- onQueryRefOptions={onQueryRefOptions}
80
- outerSpacing={false}
81
- />
74
+ >
75
+ <Form.FieldSet />
76
+ </Form.Root>
82
77
  </>
83
78
  );
84
79
  };
80
+
81
+ FunctionInputEditor.displayName = 'AutomationTrigger.FunctionInputEditor';
@@ -4,38 +4,33 @@
4
4
 
5
5
  import React, { useCallback, useMemo } from 'react';
6
6
 
7
+ import { Trigger } from '@dxos/compute';
7
8
  import { Filter, Query } from '@dxos/echo';
8
- import { type FunctionTrigger, TriggerKinds, type TriggerType } 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
- };
33
- case 'queue':
34
- return { kind: 'queue', queue: 'dxn:' };
27
+ return Trigger.specSubscription(Query.select(Filter.nothing()));
28
+ case 'feed':
29
+ return { kind: 'feed' } satisfies Trigger.FeedSpec;
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
+ feed: t('trigger-type.feed.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';