@dxos/plugin-automation 0.8.4-main.406dc2a → 0.8.4-main.4a85c3132b

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 (332) hide show
  1. package/dist/lib/browser/AutomationPanel-EHRSV2DL.mjs +11 -0
  2. package/dist/lib/browser/AutomationSettings-TJYG77L6.mjs +37 -0
  3. package/dist/lib/browser/AutomationSettings-TJYG77L6.mjs.map +7 -0
  4. package/dist/lib/browser/FunctionsContainer-XHEQSNNO.mjs +43 -0
  5. package/dist/lib/browser/FunctionsContainer-XHEQSNNO.mjs.map +7 -0
  6. package/dist/lib/browser/{FunctionsPanel-NRIKAPQV.mjs → FunctionsPanel-5WPUZGRB.mjs} +3 -3
  7. package/dist/lib/browser/FunctionsRegistry-XRXIZRLL.mjs +10 -0
  8. package/dist/lib/browser/TriggerSettings-HUQT53SV.mjs +13 -0
  9. package/dist/lib/browser/TriggerSettings-HUQT53SV.mjs.map +7 -0
  10. package/dist/lib/browser/app-graph-builder-HLARI3VW.mjs +85 -0
  11. package/dist/lib/browser/app-graph-builder-HLARI3VW.mjs.map +7 -0
  12. package/dist/lib/browser/chunk-3P4R5WNC.mjs +8 -0
  13. package/dist/lib/browser/chunk-3P4R5WNC.mjs.map +7 -0
  14. package/dist/lib/browser/chunk-4EY2KMCM.mjs +272 -0
  15. package/dist/lib/browser/chunk-4EY2KMCM.mjs.map +7 -0
  16. package/dist/lib/browser/chunk-PZNBEKO5.mjs +17 -0
  17. package/dist/lib/browser/chunk-PZNBEKO5.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-QPG3AKFX.mjs +93 -0
  19. package/dist/lib/browser/chunk-QPG3AKFX.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-SEG5OCGB.mjs +31 -0
  21. package/dist/lib/browser/chunk-SEG5OCGB.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-U55ZXRYM.mjs +98 -0
  23. package/dist/lib/browser/chunk-U55ZXRYM.mjs.map +7 -0
  24. package/dist/lib/browser/chunk-WOBCY2FQ.mjs +83 -0
  25. package/dist/lib/browser/chunk-WOBCY2FQ.mjs.map +7 -0
  26. package/dist/lib/browser/chunk-XFXYU645.mjs +96 -0
  27. package/dist/lib/browser/chunk-XFXYU645.mjs.map +7 -0
  28. package/dist/lib/browser/chunk-ZNI2CGQP.mjs +270 -0
  29. package/dist/lib/browser/chunk-ZNI2CGQP.mjs.map +7 -0
  30. package/dist/lib/browser/cli/index.mjs +1108 -0
  31. package/dist/lib/browser/cli/index.mjs.map +7 -0
  32. package/dist/lib/browser/compute-runtime-L2RVWXY2.mjs +124 -0
  33. package/dist/lib/browser/compute-runtime-L2RVWXY2.mjs.map +7 -0
  34. package/dist/lib/browser/hooks/index.mjs +5 -4
  35. package/dist/lib/browser/index.mjs +66 -64
  36. package/dist/lib/browser/index.mjs.map +4 -4
  37. package/dist/lib/browser/meta.json +1 -1
  38. package/dist/lib/browser/operation-resolver-2U6ZQVXR.mjs +83 -0
  39. package/dist/lib/browser/operation-resolver-2U6ZQVXR.mjs.map +7 -0
  40. package/dist/lib/browser/{react-surface-G7CG7BML.mjs → react-surface-U6FAYV42.mjs} +20 -14
  41. package/dist/lib/browser/react-surface-U6FAYV42.mjs.map +7 -0
  42. package/dist/lib/browser/types/index.mjs +10 -4
  43. package/dist/lib/node-esm/{AutomationPanel-EETYIR35.mjs → AutomationPanel-F7MPUR7U.mjs} +4 -4
  44. package/dist/lib/node-esm/AutomationSettings-5AHJMILI.mjs +38 -0
  45. package/dist/lib/node-esm/AutomationSettings-5AHJMILI.mjs.map +7 -0
  46. package/dist/lib/node-esm/FunctionsContainer-U5UVRKVT.mjs +44 -0
  47. package/dist/lib/node-esm/FunctionsContainer-U5UVRKVT.mjs.map +7 -0
  48. package/dist/lib/node-esm/{FunctionsPanel-SAMRTELO.mjs → FunctionsPanel-UFL5LT2R.mjs} +3 -3
  49. package/dist/lib/node-esm/FunctionsPanel-UFL5LT2R.mjs.map +7 -0
  50. package/dist/lib/node-esm/FunctionsRegistry-574OBZ5T.mjs +11 -0
  51. package/dist/lib/node-esm/FunctionsRegistry-574OBZ5T.mjs.map +7 -0
  52. package/dist/lib/node-esm/TriggerSettings-RDIJHUKK.mjs +14 -0
  53. package/dist/lib/node-esm/TriggerSettings-RDIJHUKK.mjs.map +7 -0
  54. package/dist/lib/node-esm/app-graph-builder-Z2TMQHVX.mjs +86 -0
  55. package/dist/lib/node-esm/app-graph-builder-Z2TMQHVX.mjs.map +7 -0
  56. package/dist/lib/node-esm/chunk-2X564LII.mjs +10 -0
  57. package/dist/lib/node-esm/chunk-2X564LII.mjs.map +7 -0
  58. package/dist/lib/node-esm/chunk-34HGM46Z.mjs +32 -0
  59. package/dist/lib/node-esm/chunk-34HGM46Z.mjs.map +7 -0
  60. package/dist/lib/node-esm/chunk-4DK33JDH.mjs +84 -0
  61. package/dist/lib/node-esm/chunk-4DK33JDH.mjs.map +7 -0
  62. package/dist/lib/node-esm/{chunk-5MQJPJR2.mjs → chunk-5FXNN3MV.mjs} +6 -2
  63. package/dist/lib/node-esm/chunk-5FXNN3MV.mjs.map +7 -0
  64. package/dist/lib/node-esm/chunk-7AIKTEAX.mjs +273 -0
  65. package/dist/lib/node-esm/chunk-7AIKTEAX.mjs.map +7 -0
  66. package/dist/lib/node-esm/chunk-CMZ4NKSK.mjs +271 -0
  67. package/dist/lib/node-esm/chunk-CMZ4NKSK.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-GXFQR3KI.mjs +99 -0
  69. package/dist/lib/node-esm/chunk-GXFQR3KI.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-QNPYY3XZ.mjs +94 -0
  71. package/dist/lib/node-esm/chunk-QNPYY3XZ.mjs.map +7 -0
  72. package/dist/lib/node-esm/chunk-RTEXGGBX.mjs +97 -0
  73. package/dist/lib/node-esm/chunk-RTEXGGBX.mjs.map +7 -0
  74. package/dist/lib/node-esm/cli/index.mjs +1109 -0
  75. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  76. package/dist/lib/node-esm/compute-runtime-XD6A5Q7Q.mjs +125 -0
  77. package/dist/lib/node-esm/compute-runtime-XD6A5Q7Q.mjs.map +7 -0
  78. package/dist/lib/node-esm/hooks/index.mjs +5 -4
  79. package/dist/lib/node-esm/index.mjs +66 -64
  80. package/dist/lib/node-esm/index.mjs.map +4 -4
  81. package/dist/lib/node-esm/meta.json +1 -1
  82. package/dist/lib/node-esm/operation-resolver-XWJGBHJZ.mjs +84 -0
  83. package/dist/lib/node-esm/operation-resolver-XWJGBHJZ.mjs.map +7 -0
  84. package/dist/lib/node-esm/{react-surface-OMZSBDHS.mjs → react-surface-BVNHCWQ7.mjs} +20 -14
  85. package/dist/lib/node-esm/react-surface-BVNHCWQ7.mjs.map +7 -0
  86. package/dist/lib/node-esm/types/index.mjs +10 -4
  87. package/dist/types/src/AutomationPlugin.d.ts +2 -1
  88. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  89. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  90. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  92. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  93. package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts +6 -0
  94. package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +1 -0
  95. package/dist/types/src/capabilities/compute-runtime/index.d.ts +3 -0
  96. package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +1 -0
  97. package/dist/types/src/capabilities/index.d.ts +4 -5
  98. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  99. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  100. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  101. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  102. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  103. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  104. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  105. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  106. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  107. package/dist/types/src/cli/commands/index.d.ts +2 -0
  108. package/dist/types/src/cli/commands/index.d.ts.map +1 -0
  109. package/dist/types/src/cli/commands/trigger/create/index.d.ts +25 -0
  110. package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +1 -0
  111. package/dist/types/src/cli/commands/trigger/create/queue.d.ts +13 -0
  112. package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +1 -0
  113. package/dist/types/src/cli/commands/trigger/create/subscription.d.ts +15 -0
  114. package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +1 -0
  115. package/dist/types/src/cli/commands/trigger/create/timer.d.ts +13 -0
  116. package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +1 -0
  117. package/dist/types/src/cli/commands/trigger/index.d.ts +57 -0
  118. package/dist/types/src/cli/commands/trigger/index.d.ts.map +1 -0
  119. package/dist/types/src/cli/commands/trigger/list.d.ts +7 -0
  120. package/dist/types/src/cli/commands/trigger/list.d.ts.map +1 -0
  121. package/dist/types/src/cli/commands/trigger/options.d.ts +11 -0
  122. package/dist/types/src/cli/commands/trigger/options.d.ts.map +1 -0
  123. package/dist/types/src/cli/commands/trigger/remove.d.ts +8 -0
  124. package/dist/types/src/cli/commands/trigger/remove.d.ts.map +1 -0
  125. package/dist/types/src/cli/commands/trigger/update/index.d.ts +28 -0
  126. package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +1 -0
  127. package/dist/types/src/cli/commands/trigger/update/queue.d.ts +12 -0
  128. package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +1 -0
  129. package/dist/types/src/cli/commands/trigger/update/subscription.d.ts +13 -0
  130. package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +1 -0
  131. package/dist/types/src/cli/commands/trigger/update/timer.d.ts +11 -0
  132. package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +1 -0
  133. package/dist/types/src/cli/commands/trigger/util.d.ts +46 -0
  134. package/dist/types/src/cli/commands/trigger/util.d.ts.map +1 -0
  135. package/dist/types/src/cli/index.d.ts +2 -0
  136. package/dist/types/src/cli/index.d.ts.map +1 -0
  137. package/dist/types/src/cli/plugin.d.ts +3 -0
  138. package/dist/types/src/cli/plugin.d.ts.map +1 -0
  139. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +6 -7
  140. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  141. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +5 -0
  142. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  143. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
  144. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +8 -0
  145. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
  146. package/dist/types/src/components/FunctionsRegistry/index.d.ts +4 -0
  147. package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
  148. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
  149. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
  150. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
  151. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
  152. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +9 -8
  153. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  154. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +74 -2
  155. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  156. package/dist/types/src/components/index.d.ts +3 -4
  157. package/dist/types/src/components/index.d.ts.map +1 -1
  158. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +4 -0
  159. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
  160. package/dist/types/src/containers/AutomationSettings/index.d.ts +3 -0
  161. package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
  162. package/dist/types/src/{components → containers/FunctionsContainer}/FunctionsContainer.d.ts +0 -1
  163. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
  164. package/dist/types/src/containers/FunctionsContainer/index.d.ts +3 -0
  165. package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -0
  166. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts +6 -0
  167. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
  168. package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
  169. package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
  170. package/dist/types/src/containers/index.d.ts +5 -0
  171. package/dist/types/src/containers/index.d.ts.map +1 -0
  172. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +8 -4
  173. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
  174. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +6 -5
  175. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
  176. package/dist/types/src/index.d.ts +2 -2
  177. package/dist/types/src/index.d.ts.map +1 -1
  178. package/dist/types/src/meta.d.ts +2 -2
  179. package/dist/types/src/meta.d.ts.map +1 -1
  180. package/dist/types/src/testing/test-functions.d.ts +202 -3
  181. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  182. package/dist/types/src/translations.d.ts +5 -0
  183. package/dist/types/src/translations.d.ts.map +1 -1
  184. package/dist/types/src/types/capabilities.d.ts +22 -0
  185. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  186. package/dist/types/src/types/events.d.ts +5 -0
  187. package/dist/types/src/types/events.d.ts.map +1 -0
  188. package/dist/types/src/types/index.d.ts +2 -0
  189. package/dist/types/src/types/index.d.ts.map +1 -1
  190. package/dist/types/src/types/schema.d.ts +30 -1
  191. package/dist/types/src/types/schema.d.ts.map +1 -1
  192. package/dist/types/tsconfig.tsbuildinfo +1 -1
  193. package/package.json +66 -48
  194. package/src/AutomationPlugin.tsx +15 -34
  195. package/src/capabilities/app-graph-builder/app-graph-builder.ts +72 -0
  196. package/src/capabilities/app-graph-builder/index.ts +7 -0
  197. package/src/capabilities/compute-runtime/compute-runtime.ts +146 -0
  198. package/src/capabilities/compute-runtime/index.ts +7 -0
  199. package/src/capabilities/index.ts +4 -8
  200. package/src/capabilities/operation-resolver/index.ts +7 -0
  201. package/src/capabilities/operation-resolver/operation-resolver.ts +80 -0
  202. package/src/capabilities/react-surface/index.ts +7 -0
  203. package/src/capabilities/react-surface/react-surface.tsx +61 -0
  204. package/src/cli/commands/index.ts +5 -0
  205. package/src/cli/commands/trigger/create/index.ts +14 -0
  206. package/src/cli/commands/trigger/create/queue.ts +89 -0
  207. package/src/cli/commands/trigger/create/subscription.ts +128 -0
  208. package/src/cli/commands/trigger/create/timer.ts +93 -0
  209. package/src/cli/commands/trigger/index.ts +16 -0
  210. package/src/cli/commands/trigger/list.ts +67 -0
  211. package/src/cli/commands/trigger/options.ts +59 -0
  212. package/src/cli/commands/trigger/remove.ts +45 -0
  213. package/src/cli/commands/trigger/update/index.ts +14 -0
  214. package/src/cli/commands/trigger/update/queue.ts +195 -0
  215. package/src/cli/commands/trigger/update/subscription.ts +278 -0
  216. package/src/cli/commands/trigger/update/timer.ts +193 -0
  217. package/src/cli/commands/trigger/util.ts +395 -0
  218. package/src/cli/index.ts +5 -0
  219. package/src/cli/plugin.ts +24 -0
  220. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +5 -6
  221. package/src/components/AutomationPanel/AutomationPanel.tsx +185 -87
  222. package/src/components/FunctionsPanel/FunctionsPanel.tsx +34 -22
  223. package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +110 -0
  224. package/src/components/FunctionsRegistry/index.ts +8 -0
  225. package/src/components/TriggerEditor/FunctionInputEditor.tsx +34 -33
  226. package/src/components/TriggerEditor/SpecSelector.tsx +12 -10
  227. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +82 -36
  228. package/src/components/TriggerEditor/TriggerEditor.tsx +77 -49
  229. package/src/components/index.ts +1 -2
  230. package/src/{components → containers/AutomationSettings}/AutomationSettings.tsx +9 -12
  231. package/src/containers/AutomationSettings/index.ts +7 -0
  232. package/src/containers/FunctionsContainer/FunctionsContainer.tsx +33 -0
  233. package/src/containers/FunctionsContainer/index.ts +7 -0
  234. package/src/containers/TriggerSettings/TriggerSettings.tsx +26 -0
  235. package/src/containers/TriggerSettings/index.ts +7 -0
  236. package/src/containers/index.ts +9 -0
  237. package/src/hooks/useComputeRuntimeCallback.ts +45 -8
  238. package/src/hooks/useTriggerRuntimeControls.ts +30 -15
  239. package/src/index.ts +2 -2
  240. package/src/meta.ts +7 -4
  241. package/src/testing/test-functions.ts +6 -6
  242. package/src/translations.ts +7 -0
  243. package/src/{capabilities → types}/capabilities.ts +9 -14
  244. package/src/types/events.ts +11 -0
  245. package/src/types/index.ts +2 -0
  246. package/src/types/schema.ts +23 -2
  247. package/dist/lib/browser/AutomationPanel-3PHA5FTJ.mjs +0 -11
  248. package/dist/lib/browser/AutomationSettings-3EYSPFKB.mjs +0 -69
  249. package/dist/lib/browser/AutomationSettings-3EYSPFKB.mjs.map +0 -7
  250. package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs +0 -36
  251. package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs.map +0 -7
  252. package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs +0 -81
  253. package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs.map +0 -7
  254. package/dist/lib/browser/chunk-5ARH77PV.mjs +0 -15
  255. package/dist/lib/browser/chunk-5ARH77PV.mjs.map +0 -7
  256. package/dist/lib/browser/chunk-6TUZQIEN.mjs +0 -14
  257. package/dist/lib/browser/chunk-6TUZQIEN.mjs.map +0 -7
  258. package/dist/lib/browser/chunk-DK7BLEKU.mjs +0 -14
  259. package/dist/lib/browser/chunk-DK7BLEKU.mjs.map +0 -7
  260. package/dist/lib/browser/chunk-DLLE4FKP.mjs +0 -94
  261. package/dist/lib/browser/chunk-DLLE4FKP.mjs.map +0 -7
  262. package/dist/lib/browser/chunk-MVPRI3DB.mjs +0 -53
  263. package/dist/lib/browser/chunk-MVPRI3DB.mjs.map +0 -7
  264. package/dist/lib/browser/chunk-SUKAEYF3.mjs +0 -267
  265. package/dist/lib/browser/chunk-SUKAEYF3.mjs.map +0 -7
  266. package/dist/lib/browser/chunk-VGBZKM3O.mjs +0 -38
  267. package/dist/lib/browser/chunk-VGBZKM3O.mjs.map +0 -7
  268. package/dist/lib/browser/chunk-VL3KSDVL.mjs +0 -183
  269. package/dist/lib/browser/chunk-VL3KSDVL.mjs.map +0 -7
  270. package/dist/lib/browser/chunk-WWURMV25.mjs +0 -13
  271. package/dist/lib/browser/chunk-WWURMV25.mjs.map +0 -7
  272. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs +0 -160
  273. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs.map +0 -7
  274. package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs +0 -77
  275. package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs.map +0 -7
  276. package/dist/lib/browser/react-surface-G7CG7BML.mjs.map +0 -7
  277. package/dist/lib/node-esm/AutomationSettings-WKSMWITV.mjs +0 -70
  278. package/dist/lib/node-esm/AutomationSettings-WKSMWITV.mjs.map +0 -7
  279. package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs +0 -37
  280. package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs.map +0 -7
  281. package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs +0 -82
  282. package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs.map +0 -7
  283. package/dist/lib/node-esm/chunk-2EWXIFEK.mjs +0 -16
  284. package/dist/lib/node-esm/chunk-2EWXIFEK.mjs.map +0 -7
  285. package/dist/lib/node-esm/chunk-5MQJPJR2.mjs.map +0 -7
  286. package/dist/lib/node-esm/chunk-AKHETVIQ.mjs +0 -184
  287. package/dist/lib/node-esm/chunk-AKHETVIQ.mjs.map +0 -7
  288. package/dist/lib/node-esm/chunk-B7N3H45O.mjs +0 -16
  289. package/dist/lib/node-esm/chunk-B7N3H45O.mjs.map +0 -7
  290. package/dist/lib/node-esm/chunk-CJUI6AKX.mjs +0 -39
  291. package/dist/lib/node-esm/chunk-CJUI6AKX.mjs.map +0 -7
  292. package/dist/lib/node-esm/chunk-J3XEBEIE.mjs +0 -268
  293. package/dist/lib/node-esm/chunk-J3XEBEIE.mjs.map +0 -7
  294. package/dist/lib/node-esm/chunk-QCA543ZR.mjs +0 -54
  295. package/dist/lib/node-esm/chunk-QCA543ZR.mjs.map +0 -7
  296. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs +0 -16
  297. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs.map +0 -7
  298. package/dist/lib/node-esm/chunk-YQXW3JXD.mjs +0 -95
  299. package/dist/lib/node-esm/chunk-YQXW3JXD.mjs.map +0 -7
  300. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs +0 -161
  301. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs.map +0 -7
  302. package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs +0 -78
  303. package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs.map +0 -7
  304. package/dist/lib/node-esm/react-surface-OMZSBDHS.mjs.map +0 -7
  305. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  306. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  307. package/dist/types/src/capabilities/capabilities.d.ts +0 -19
  308. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  309. package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
  310. package/dist/types/src/capabilities/compute-runtime.d.ts.map +0 -1
  311. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  312. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  313. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  314. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  315. package/dist/types/src/components/AutomationSettings.d.ts +0 -5
  316. package/dist/types/src/components/AutomationSettings.d.ts.map +0 -1
  317. package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
  318. package/dist/types/src/components/TriggerSettings.d.ts +0 -6
  319. package/dist/types/src/components/TriggerSettings.d.ts.map +0 -1
  320. package/dist/types/src/events.d.ts +0 -4
  321. package/dist/types/src/events.d.ts.map +0 -1
  322. package/src/capabilities/app-graph-builder.ts +0 -87
  323. package/src/capabilities/compute-runtime.ts +0 -138
  324. package/src/capabilities/intent-resolver.ts +0 -72
  325. package/src/capabilities/react-surface.tsx +0 -55
  326. package/src/components/FunctionsContainer.tsx +0 -29
  327. package/src/components/TriggerSettings.tsx +0 -25
  328. package/src/events.ts +0 -11
  329. /package/dist/lib/browser/{AutomationPanel-3PHA5FTJ.mjs.map → AutomationPanel-EHRSV2DL.mjs.map} +0 -0
  330. /package/dist/lib/browser/{FunctionsPanel-NRIKAPQV.mjs.map → FunctionsPanel-5WPUZGRB.mjs.map} +0 -0
  331. /package/dist/lib/{node-esm/AutomationPanel-EETYIR35.mjs.map → browser/FunctionsRegistry-XRXIZRLL.mjs.map} +0 -0
  332. /package/dist/lib/node-esm/{FunctionsPanel-SAMRTELO.mjs.map → AutomationPanel-F7MPUR7U.mjs.map} +0 -0
@@ -3,60 +3,71 @@
3
3
  //
4
4
 
5
5
  import * as Array from 'effect/Array';
6
- import * as Function from 'effect/Function';
6
+ import * as EFn from 'effect/Function';
7
7
  import * as Match from 'effect/Match';
8
8
  import * as Schema from 'effect/Schema';
9
- import React, { useMemo, useState } from 'react';
9
+ import React, { useCallback, useMemo, useState } from 'react';
10
10
 
11
11
  import { Filter, Obj, Tag } from '@dxos/echo';
12
- import { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';
12
+ import { Function, Script, Trigger } from '@dxos/functions';
13
+ import { KEY_QUEUE_CURSOR } from '@dxos/functions-runtime';
14
+ import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
13
15
  import { useTypeOptions } from '@dxos/plugin-space';
14
16
  import { type Client, useClient } from '@dxos/react-client';
15
- import { type Space, getSpace, useQuery } from '@dxos/react-client/echo';
16
- import { Clipboard, IconButton, Input, Separator, type ThemedClassName, useTranslation } from '@dxos/react-ui';
17
- import { ControlItem, controlItemClasses } from '@dxos/react-ui-form';
17
+ import { type Space, useObject, useQuery } from '@dxos/react-client/echo';
18
+ import { Clipboard, IconButton, type IconButtonProps, Input, Separator, useTranslation } from '@dxos/react-ui';
19
+ import { Settings } from '@dxos/react-ui-form';
18
20
  import { List } from '@dxos/react-ui-list';
19
- import { ghostHover, mx } from '@dxos/react-ui-theme';
20
- import { DataType } from '@dxos/schema';
21
+ import { Pipeline } from '@dxos/types';
22
+ import { ghostHover, mx } from '@dxos/ui-theme';
23
+ import { isNonNullable } from '@dxos/util';
21
24
 
22
25
  import { meta } from '../../meta';
23
26
  import { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';
24
27
 
25
- const grid = 'grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]';
28
+ const grid = 'grid grid-cols-[40px_1fr_32px_32px] min-h-[2.5rem]';
26
29
 
27
- export type AutomationPanelProps = ThemedClassName<{
30
+ export type AutomationPanelProps = {
28
31
  space: Space;
29
- object?: Obj.Any;
30
- initialTrigger?: FunctionTrigger;
32
+ object?: Obj.Unknown;
33
+ initialTrigger?: Trigger.Trigger;
31
34
  onDone?: () => void;
32
- }>;
35
+ };
33
36
 
34
37
  // TODO(burdon): Factor out common layout with ViewEditor.
35
- export const AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }: AutomationPanelProps) => {
38
+ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: AutomationPanelProps) => {
36
39
  const { t } = useTranslation(meta.id);
37
40
  const client = useClient();
38
- const functions = useQuery(space, Filter.type(FunctionType));
39
- const triggers = useQuery(space, Filter.type(FunctionTrigger));
41
+ const functionsServiceClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);
42
+ const functions = useQuery(space.db, Filter.type(Function.Function));
43
+ const triggers = useQuery(space.db, Filter.type(Trigger.Trigger));
40
44
  const filteredTriggers = useMemo(() => {
41
45
  return object ? triggers.filter(triggerMatch(object)) : triggers;
42
46
  }, [object, triggers]);
43
- const tags = useQuery(space, Filter.type(Tag.Tag));
44
- const types = useTypeOptions({ space, annotation: ['dynamic', 'limited-static', 'object-form'] });
47
+ const tags = useQuery(space.db, Filter.type(Tag.Tag));
48
+ const types = useTypeOptions({
49
+ space,
50
+ annotation: {
51
+ location: ['database', 'runtime'],
52
+ kind: ['user'],
53
+ registered: ['registered'],
54
+ },
55
+ });
45
56
 
46
- const [trigger, setTrigger] = useState<FunctionTrigger | undefined>(initialTrigger);
47
- const [selected, setSelected] = useState<FunctionTrigger>();
57
+ const [trigger, setTrigger] = useState<Trigger.Trigger | undefined>(initialTrigger);
58
+ const [selected, setSelected] = useState<Trigger.Trigger>();
48
59
 
49
- const handleSelect = (trigger: FunctionTrigger) => {
60
+ const handleSelect = (trigger: Trigger.Trigger) => {
50
61
  setTrigger(trigger);
51
62
  setSelected(trigger);
52
63
  };
53
64
 
54
65
  const handleAdd = () => {
55
- setTrigger(Obj.make(FunctionTrigger, {}));
66
+ setTrigger(Trigger.make({}));
56
67
  setSelected(undefined);
57
68
  };
58
69
 
59
- const handleDelete = (trigger: FunctionTrigger) => {
70
+ const handleDelete = (trigger: Trigger.Trigger) => {
60
71
  space.db.remove(trigger);
61
72
  setTrigger(undefined);
62
73
  setSelected(undefined);
@@ -64,9 +75,11 @@ export const AutomationPanel = ({ classNames, space, object, initialTrigger, onD
64
75
 
65
76
  const handleSave: TriggerEditorProps['onSave'] = (trigger) => {
66
77
  if (selected) {
67
- Object.assign(selected, trigger);
78
+ Obj.change(selected, (mutable) => {
79
+ Object.assign(mutable, trigger);
80
+ });
68
81
  } else {
69
- space.db.add(Obj.make(FunctionTrigger, trigger));
82
+ space.db.add(Trigger.make(trigger));
70
83
  }
71
84
 
72
85
  setTrigger(undefined);
@@ -79,11 +92,22 @@ export const AutomationPanel = ({ classNames, space, object, initialTrigger, onD
79
92
  onDone?.();
80
93
  };
81
94
 
95
+ const handleForceRunTrigger = async (trigger: Trigger.Trigger) => {
96
+ await functionsServiceClient.forceRunCronTrigger(space.id, trigger.id);
97
+ };
98
+
99
+ const handleResetCursor = async (trigger: Trigger.Trigger) => {
100
+ Obj.change(trigger, (t) => {
101
+ Obj.deleteKeys(t, KEY_QUEUE_CURSOR);
102
+ });
103
+ await space.db.flush({ indexes: true });
104
+ };
105
+
82
106
  if (trigger) {
83
107
  return (
84
- <ControlItem title={t('trigger editor title')}>
108
+ <Settings.Item title={t('trigger editor title')} description={t('trigger editor description')}>
85
109
  <TriggerEditor
86
- space={space}
110
+ db={space.db}
87
111
  trigger={trigger}
88
112
  readonlySpec={Boolean(object)}
89
113
  tags={tags}
@@ -91,87 +115,161 @@ export const AutomationPanel = ({ classNames, space, object, initialTrigger, onD
91
115
  onSave={handleSave}
92
116
  onCancel={handleCancel}
93
117
  />
94
- </ControlItem>
118
+ </Settings.Item>
95
119
  );
96
120
  }
97
121
 
98
122
  return (
99
- <div className={mx(controlItemClasses, classNames)}>
123
+ <Settings.Container>
100
124
  {filteredTriggers.length > 0 && (
101
- <List.Root<FunctionTrigger>
125
+ <List.Root<Trigger.Trigger>
102
126
  items={filteredTriggers}
103
- isItem={Schema.is(FunctionTrigger)}
127
+ isItem={Schema.is(Trigger.Trigger)}
104
128
  getId={(field) => field.id}
105
129
  >
106
130
  {({ items: filteredTriggers }) => (
107
131
  <div role='list' className='flex flex-col w-full'>
108
- {filteredTriggers?.map((trigger) => {
109
- const copyAction = getCopyAction(client, trigger);
110
- return (
111
- <List.Item<FunctionTrigger>
112
- key={trigger.id}
113
- item={trigger}
114
- classNames={mx(grid, ghostHover, 'items-center', 'px-2')}
115
- >
116
- <Input.Root>
117
- <Input.Switch
118
- checked={trigger.enabled}
119
- onCheckedChange={(checked) => (trigger.enabled = checked)}
120
- />
121
- </Input.Root>
122
-
123
- <div className={'flex'}>
124
- <List.ItemTitle
125
- classNames='px-1 cursor-pointer w-0 shrink truncate'
126
- onClick={() => handleSelect(trigger)}
127
- >
128
- {getFunctionName(functions, trigger) ?? '∅'}
129
- </List.ItemTitle>
130
-
131
- {/* TODO: a better way to expose copy action */}
132
- {copyAction && (
133
- <Clipboard.IconButton
134
- label={t(copyAction.translationKey)}
135
- value={copyAction.contentProvider()}
136
- />
137
- )}
138
- </div>
139
-
140
- <List.ItemDeleteButton onClick={() => handleDelete(trigger)} />
141
- </List.Item>
142
- );
143
- })}
132
+ {filteredTriggers?.map((trigger) => (
133
+ <TriggerListItem
134
+ key={trigger.id}
135
+ trigger={trigger}
136
+ functions={functions}
137
+ onSelect={handleSelect}
138
+ onDelete={handleDelete}
139
+ onResetCursor={handleResetCursor}
140
+ onForceRun={handleForceRunTrigger}
141
+ />
142
+ ))}
144
143
  </div>
145
144
  )}
146
145
  </List.Root>
147
146
  )}
148
- {filteredTriggers.length > 0 && <Separator classNames='mlb-4' />}
147
+
148
+ {filteredTriggers.length > 0 && <Separator classNames='my-4' />}
149
149
  <IconButton icon='ph--plus--regular' label={t('new trigger label')} onClick={handleAdd} />
150
- </div>
150
+ </Settings.Container>
151
+ );
152
+ };
153
+
154
+ const TriggerListItem = ({
155
+ trigger,
156
+ functions,
157
+ onSelect,
158
+ onDelete,
159
+ onResetCursor,
160
+ onForceRun,
161
+ }: {
162
+ trigger: Trigger.Trigger;
163
+ functions: Function.Function[];
164
+ onSelect?: (trigger: Trigger.Trigger) => void;
165
+ onDelete?: (trigger: Trigger.Trigger) => void;
166
+ onResetCursor?: (trigger: Trigger.Trigger) => void;
167
+ onForceRun?: (trigger: Trigger.Trigger) => void;
168
+ }) => {
169
+ const client = useClient();
170
+ const copyAction = getCopyAction(client, trigger);
171
+ const { t } = useTranslation(meta.id);
172
+ const cursor = Obj.getKeys(trigger, KEY_QUEUE_CURSOR).at(0)?.id;
173
+ const [snapshot, updateTrigger] = useObject(trigger);
174
+
175
+ const enabled = snapshot.enabled ?? false;
176
+ const onEnabledChange = (checked: boolean) => {
177
+ updateTrigger((trigger) => {
178
+ trigger.enabled = checked;
179
+ });
180
+ };
181
+
182
+ const handleSelect = useCallback(() => {
183
+ onSelect?.(trigger);
184
+ }, [onSelect, trigger]);
185
+
186
+ const handleDelete = useCallback(() => {
187
+ onDelete?.(trigger);
188
+ }, [onDelete, trigger]);
189
+
190
+ const handleResetCursor = useCallback(() => {
191
+ onResetCursor?.(trigger);
192
+ }, [onResetCursor, trigger]);
193
+
194
+ const handleForceRun = useCallback(() => {
195
+ onForceRun?.(trigger);
196
+ }, [onForceRun, trigger]);
197
+
198
+ const actionProps = useMemo<IconButtonProps | undefined>(() => {
199
+ if (trigger.spec?.kind === 'timer' && onForceRun) {
200
+ return {
201
+ disabled: !enabled || trigger.spec?.kind !== 'timer',
202
+ icon: 'ph--play--regular',
203
+ label: 'Force run',
204
+ onClick: handleForceRun,
205
+ };
206
+ }
207
+
208
+ if (trigger.spec?.kind === 'queue' && onResetCursor) {
209
+ return {
210
+ disabled: !cursor,
211
+ icon: 'ph--arrow-clockwise--regular',
212
+ label: 'Reset cursor',
213
+ onClick: handleResetCursor,
214
+ };
215
+ }
216
+ }, [enabled, trigger.spec?.kind, handleForceRun]);
217
+
218
+ return (
219
+ <List.Item<Obj.Snapshot<Trigger.Trigger>>
220
+ key={trigger.id}
221
+ item={snapshot}
222
+ classNames={mx(grid, ghostHover, 'items-center', 'px-2')}
223
+ >
224
+ <Input.Root>
225
+ <Input.Switch checked={enabled} onCheckedChange={onEnabledChange} />
226
+ </Input.Root>
227
+
228
+ <div className={'flex'}>
229
+ <List.ItemTitle classNames='px-1 cursor-pointer w-0 shrink truncate' onClick={handleSelect}>
230
+ {getFunctionName(functions, trigger) ?? '∅'}
231
+ {cursor && <div className='text-xs text-description truncate ml-4'>Position: {cursor}</div>}
232
+ </List.ItemTitle>
233
+
234
+ {copyAction && (
235
+ <Clipboard.IconButton label={t(copyAction.translationKey)} value={copyAction.contentProvider()} />
236
+ )}
237
+ </div>
238
+
239
+ {actionProps ? <List.ItemButton {...actionProps} autoHide={false} /> : <div />}
240
+
241
+ {onDelete && <List.ItemDeleteButton onClick={handleDelete} />}
242
+ </List.Item>
151
243
  );
152
244
  };
153
245
 
154
- const getCopyAction = (client: Client, trigger: FunctionTrigger | undefined) => {
246
+ const getCopyAction = (client: Client, trigger: Trigger.Trigger | undefined) => {
155
247
  if (trigger?.spec?.kind === 'email') {
156
- return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };
248
+ return {
249
+ translationKey: 'trigger copy email' as const,
250
+ contentProvider: () => `${Obj.getDatabase(trigger)!.spaceId}@dxos.network`,
251
+ };
157
252
  }
158
253
 
159
254
  if (trigger?.spec?.kind === 'webhook') {
160
- return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };
255
+ return {
256
+ translationKey: 'trigger copy url' as const,
257
+ contentProvider: () => getWebhookUrl(client, trigger!),
258
+ };
161
259
  }
162
260
 
163
261
  return undefined;
164
262
  };
165
263
 
166
- const getWebhookUrl = (client: Client, trigger: FunctionTrigger) => {
167
- const spaceId = getSpace(trigger)!.id;
264
+ const getWebhookUrl = (client: Client, trigger: Trigger.Trigger) => {
265
+ const spaceId = Obj.getDatabase(trigger)!.spaceId;
168
266
  const edgeUrl = new URL(client.config.values.runtime!.services!.edge!.url!);
169
267
  const isSecure = edgeUrl.protocol.startsWith('https') || edgeUrl.protocol.startsWith('wss');
170
268
  edgeUrl.protocol = isSecure ? 'https' : 'http';
171
269
  return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();
172
270
  };
173
271
 
174
- const getFunctionName = (functions: FunctionType[], trigger: FunctionTrigger) => {
272
+ const getFunctionName = (functions: Function.Function[], trigger: Trigger.Trigger) => {
175
273
  // TODO(wittjosiah): Truncation should be done in the UI.
176
274
  // Warning that the List component is currently a can of worms.
177
275
  const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;
@@ -179,25 +277,25 @@ const getFunctionName = (functions: FunctionType[], trigger: FunctionTrigger) =>
179
277
  return functionObject?.name ?? shortId;
180
278
  };
181
279
 
182
- const scriptMatch = (script: ScriptType) => (trigger: FunctionTrigger) => {
280
+ const scriptMatch = (script: Script.Script) => (trigger: Trigger.Trigger) => {
183
281
  const fn = trigger.function?.target;
184
- if (!Obj.instanceOf(FunctionType, fn)) {
282
+ if (!Obj.instanceOf(Function.Function, fn)) {
185
283
  return false;
186
284
  }
187
285
 
188
286
  return fn.source?.target === script;
189
287
  };
190
288
 
191
- const projectMatch = (project: DataType.Project) => {
192
- const viewQueries = Function.pipe(
193
- project.collections,
194
- Array.map((collection) => collection.target),
195
- Array.filter(Schema.is(DataType.View)),
289
+ const projectMatch = (project: Pipeline.Pipeline) => {
290
+ const viewQueries = EFn.pipe(
291
+ project.columns,
292
+ Array.map((column) => column.view.target),
293
+ Array.filter(isNonNullable),
196
294
  Array.map((view) => Obj.getSnapshot(view).query.ast),
197
295
  Array.map((ast) => JSON.stringify(ast)),
198
296
  );
199
297
 
200
- return (trigger: FunctionTrigger) => {
298
+ return (trigger: Trigger.Trigger) => {
201
299
  const spec = Obj.getSnapshot(trigger).spec;
202
300
  if (spec?.kind !== 'subscription') {
203
301
  return false;
@@ -208,14 +306,14 @@ const projectMatch = (project: DataType.Project) => {
208
306
  };
209
307
  };
210
308
 
211
- const triggerMatch = Match.type<Obj.Any>().pipe(
212
- Match.withReturnType<(trigger: FunctionTrigger) => boolean>(),
309
+ const triggerMatch = Match.type<Obj.Unknown>().pipe(
310
+ Match.withReturnType<(trigger: Trigger.Trigger) => boolean>(),
213
311
  Match.when(
214
- (obj) => Obj.instanceOf(ScriptType, obj),
312
+ (obj) => Obj.instanceOf(Script.Script, obj),
215
313
  (obj) => scriptMatch(obj),
216
314
  ),
217
315
  Match.when(
218
- (obj) => Obj.instanceOf(DataType.Project, obj),
316
+ (obj) => Obj.instanceOf(Pipeline.Pipeline, obj),
219
317
  (obj) => projectMatch(obj),
220
318
  ),
221
319
  Match.orElse((_obj) => () => true),
@@ -5,27 +5,28 @@
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 } from '@dxos/app-toolkit';
10
+ import { Obj } from '@dxos/echo';
11
+ import { Function, Script } from '@dxos/functions';
12
+ import { SpaceOperation } from '@dxos/plugin-space/types';
13
+ import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
14
+ import { Button, 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
19
  import { meta } from '../../meta';
17
20
 
18
- const grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';
19
-
20
21
  export type FunctionsPanelProps = {
21
22
  space: Space;
22
23
  };
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(Function.Function));
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: Function.Function) => {
50
51
  const script = functionToScriptMap[func.id];
51
52
  return script?.name;
52
53
  },
@@ -54,26 +55,31 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
54
55
  );
55
56
 
56
57
  const handleGoToScript = useCallback(
57
- (func: FunctionType) => {
58
+ (func: Function.Function) => {
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: [Obj.getDXN(script).toString()] });
61
62
  }
62
63
  },
63
- [functionToScriptMap, dispatch],
64
+ [functionToScriptMap, invokePromise],
65
+ );
66
+
67
+ const handleDelete = useCallback(
68
+ (func: Function.Function) => invokePromise(SpaceOperation.RemoveObjects, { objects: [func] }),
69
+ [invokePromise],
64
70
  );
65
71
 
66
72
  return (
67
- <div role='none' className={mx(controlItemClasses)}>
73
+ <Settings.Container>
68
74
  {functions.length > 0 && (
69
- <List.Root<FunctionType> items={functions} isItem={Schema.is(FunctionType)} getId={(func) => func.id}>
75
+ <List.Root<Function.Function> items={functions} isItem={Schema.is(Function.Function)} getId={(func) => func.id}>
70
76
  {({ items }) => (
71
77
  <div role='list' className='flex flex-col w-full'>
72
78
  {items?.map((func) => (
73
- <List.Item<FunctionType>
79
+ <List.Item<Function.Function>
74
80
  key={func.id}
75
81
  item={func}
76
- classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}
82
+ classNames={mx('grid grid-cols-[1fr_auto] min-h-[2.5rem] min-h-[3rem] px-2 items-center', ghostHover)}
77
83
  >
78
84
  <div className='flex flex-col truncate'>
79
85
  <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
@@ -84,6 +90,12 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
84
90
  {functionToScriptMap[func.id] && (
85
91
  <Button onClick={() => handleGoToScript(func)}>{t('go to function source button label')}</Button>
86
92
  )}
93
+ <IconButton
94
+ iconOnly
95
+ icon='ph--trash--regular'
96
+ label={t('delete function button label')}
97
+ onClick={() => handleDelete(func)}
98
+ />
87
99
  </List.Item>
88
100
  ))}
89
101
  </div>
@@ -91,7 +103,7 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
91
103
  </List.Root>
92
104
  )}
93
105
 
94
- {functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}
95
- </div>
106
+ {functions.length === 0 && <div className='text-center py-4 text-description'>{t('no functions found')}</div>}
107
+ </Settings.Container>
96
108
  );
97
109
  };
@@ -0,0 +1,110 @@
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 { Function } from '@dxos/functions';
10
+ import { getDeployedFunctions } from '@dxos/functions-runtime/edge';
11
+ import { useClient } from '@dxos/react-client';
12
+ import { Filter, Query, type Space, useQuery } from '@dxos/react-client/echo';
13
+ import { IconButton, useAsyncEffect, useTranslation } from '@dxos/react-ui';
14
+ import { Settings } from '@dxos/react-ui-form';
15
+ import { List } from '@dxos/react-ui-list';
16
+ import { ghostHover, mx } from '@dxos/ui-theme';
17
+
18
+ import { meta } from '../../meta';
19
+
20
+ const grid = 'grid grid-cols-[1fr_1fr_auto] min-h-[2.5rem]';
21
+
22
+ type FunctionsRegistryProps = {
23
+ space: Space;
24
+ };
25
+
26
+ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
27
+ const client = useClient();
28
+ const [loading, setLoading] = useState(true);
29
+ const [functions, setFunctions] = useState<Function.Function[]>([]);
30
+ const { t } = useTranslation(meta.id);
31
+
32
+ const dbFunctions = useQuery(space.db, Filter.type(Function.Function));
33
+
34
+ const state = (func: Function.Function) => {
35
+ const dbFunction = dbFunctions.find((f) => f.key === func.key);
36
+ if (!dbFunction) {
37
+ return 'import';
38
+ }
39
+ if (dbFunction.version === func.version && dbFunction.updated === func.updated) {
40
+ return 'none';
41
+ }
42
+ return 'update';
43
+ };
44
+
45
+ useAsyncEffect(async () => {
46
+ setLoading(true);
47
+ const functions = await getDeployedFunctions(client, true);
48
+ setFunctions(functions);
49
+ setLoading(false);
50
+ }, []);
51
+
52
+ const hanleImportOrUpdate = useCallback(
53
+ async (func: Function.Function) => {
54
+ const functions = await space.db.query(Query.type(Function.Function, { key: func.key })).run();
55
+ const [existingFunc] = functions;
56
+ if (!existingFunc) {
57
+ space.db.add(func);
58
+ return;
59
+ }
60
+ Function.setFrom(existingFunc, func);
61
+ },
62
+ [space],
63
+ );
64
+
65
+ return (
66
+ <Settings.Container>
67
+ {functions.length > 0 && (
68
+ <List.Root<Function.Function> items={functions} isItem={Schema.is(Function.Function)} getId={(func) => func.id}>
69
+ {({ items }) => (
70
+ <div role='list' className='flex flex-col w-full'>
71
+ {items?.map((func) => (
72
+ <List.Item<Function.Function>
73
+ key={func.id}
74
+ item={func}
75
+ classNames={mx(grid, ghostHover, 'items-center', 'px-2', 'min-h-[3rem]')}
76
+ >
77
+ <div className='flex flex-col truncate'>
78
+ <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
79
+ <div className='text-xs text-description truncate'>{func.key}</div>
80
+ </div>
81
+ <div className='flex flex-col truncate'>
82
+ <div className='text-xs text-description truncate'>{func.version}</div>
83
+ <div className='text-xs text-description truncate'>
84
+ {func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : ''}
85
+ </div>
86
+ </div>
87
+
88
+ <IconButton
89
+ iconOnly
90
+ icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}
91
+ label={
92
+ state(func) === 'update' ? t('update function button label') : t('import function button label')
93
+ }
94
+ disabled={state(func) === 'none'}
95
+ onClick={() => hanleImportOrUpdate(func)}
96
+ />
97
+ </List.Item>
98
+ ))}
99
+ </div>
100
+ )}
101
+ </List.Root>
102
+ )}
103
+
104
+ {functions.length === 0 && !loading && (
105
+ <div className='text-center py-4 text-gray-500'>{t('no functions found')}</div>
106
+ )}
107
+ {loading && <div className='text-center py-4 text-gray-500'>{t('loading functions')}</div>}
108
+ </Settings.Container>
109
+ );
110
+ };
@@ -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;