@dxos/plugin-automation 0.8.4-main.72ec0f3 → 0.8.4-main.7996785055

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 (348) hide show
  1. package/dist/lib/browser/AutomationPanel-UPV6GR5B.mjs +11 -0
  2. package/dist/lib/browser/AutomationSettings-OJ4VECH7.mjs +37 -0
  3. package/dist/lib/browser/AutomationSettings-OJ4VECH7.mjs.map +7 -0
  4. package/dist/lib/browser/FunctionsContainer-DJB2M6DI.mjs +43 -0
  5. package/dist/lib/browser/FunctionsContainer-DJB2M6DI.mjs.map +7 -0
  6. package/dist/lib/browser/{FunctionsPanel-CRW6SJUN.mjs → FunctionsPanel-FFGPFXSF.mjs} +3 -3
  7. package/dist/lib/browser/FunctionsRegistry-7FVC2YMN.mjs +10 -0
  8. package/dist/lib/browser/TriggerSettings-3UW3UTJE.mjs +11 -0
  9. package/dist/lib/browser/app-graph-builder-FHMSJUKB.mjs +82 -0
  10. package/dist/lib/browser/app-graph-builder-FHMSJUKB.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-3KUXM6DD.mjs +31 -0
  12. package/dist/lib/browser/chunk-3KUXM6DD.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-4HKBI6EW.mjs +295 -0
  14. package/dist/lib/browser/chunk-4HKBI6EW.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-7SRDQVB2.mjs +275 -0
  16. package/dist/lib/browser/chunk-7SRDQVB2.mjs.map +7 -0
  17. package/dist/lib/browser/{chunk-NAPXRXTY.mjs → chunk-FNYP7F2T.mjs} +29 -36
  18. package/dist/lib/browser/chunk-FNYP7F2T.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-LZQFZO3B.mjs → chunk-H4ZAXPLY.mjs} +9 -2
  20. package/dist/lib/browser/chunk-H4ZAXPLY.mjs.map +7 -0
  21. package/dist/lib/browser/{chunk-YBPJCY3F.mjs → chunk-HAGI3PXT.mjs} +22 -5
  22. package/dist/lib/browser/chunk-HAGI3PXT.mjs.map +7 -0
  23. package/dist/lib/browser/chunk-UI4Q7M5V.mjs +8 -0
  24. package/dist/lib/browser/chunk-UI4Q7M5V.mjs.map +7 -0
  25. package/dist/lib/browser/chunk-UJZVGZBO.mjs +98 -0
  26. package/dist/lib/browser/chunk-UJZVGZBO.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-VMFDCTFG.mjs +44 -0
  28. package/dist/lib/browser/chunk-VMFDCTFG.mjs.map +7 -0
  29. package/dist/lib/browser/chunk-YPUJSTT3.mjs +8 -0
  30. package/dist/lib/browser/chunk-YPUJSTT3.mjs.map +7 -0
  31. package/dist/lib/browser/chunk-ZDSWGE3W.mjs +101 -0
  32. package/dist/lib/browser/chunk-ZDSWGE3W.mjs.map +7 -0
  33. package/dist/lib/browser/cli/index.mjs +1127 -0
  34. package/dist/lib/browser/cli/index.mjs.map +7 -0
  35. package/dist/lib/browser/compute-runtime-Y3GEKNFP.mjs +128 -0
  36. package/dist/lib/browser/compute-runtime-Y3GEKNFP.mjs.map +7 -0
  37. package/dist/lib/browser/create-trigger-from-template-GVYDOR56.mjs +78 -0
  38. package/dist/lib/browser/create-trigger-from-template-GVYDOR56.mjs.map +7 -0
  39. package/dist/lib/browser/hooks/index.mjs +3 -3
  40. package/dist/lib/browser/index.mjs +57 -63
  41. package/dist/lib/browser/index.mjs.map +4 -4
  42. package/dist/lib/browser/meta.json +1 -1
  43. package/dist/lib/browser/operation-handler-OBMV73N3.mjs +17 -0
  44. package/dist/lib/browser/operation-handler-OBMV73N3.mjs.map +7 -0
  45. package/dist/lib/browser/operations/index.mjs +13 -0
  46. package/dist/lib/browser/operations/index.mjs.map +7 -0
  47. package/dist/lib/browser/react-surface-YRA4ZGCL.mjs +65 -0
  48. package/dist/lib/browser/react-surface-YRA4ZGCL.mjs.map +7 -0
  49. package/dist/lib/browser/types/index.mjs +10 -4
  50. package/dist/lib/node-esm/{AutomationPanel-HCVFNHGQ.mjs → AutomationPanel-TLKFNGI7.mjs} +4 -4
  51. package/dist/lib/node-esm/AutomationPanel-TLKFNGI7.mjs.map +7 -0
  52. package/dist/lib/node-esm/AutomationSettings-QAMDNV4N.mjs +38 -0
  53. package/dist/lib/node-esm/AutomationSettings-QAMDNV4N.mjs.map +7 -0
  54. package/dist/lib/node-esm/FunctionsContainer-2QRAWQGX.mjs +44 -0
  55. package/dist/lib/node-esm/FunctionsContainer-2QRAWQGX.mjs.map +7 -0
  56. package/dist/lib/node-esm/{FunctionsPanel-RVVCS6VH.mjs → FunctionsPanel-G3UFETZW.mjs} +3 -3
  57. package/dist/lib/node-esm/FunctionsPanel-G3UFETZW.mjs.map +7 -0
  58. package/dist/lib/node-esm/FunctionsRegistry-KB7NMKET.mjs +11 -0
  59. package/dist/lib/node-esm/FunctionsRegistry-KB7NMKET.mjs.map +7 -0
  60. package/dist/lib/node-esm/TriggerSettings-KL75WR7U.mjs +12 -0
  61. package/dist/lib/node-esm/TriggerSettings-KL75WR7U.mjs.map +7 -0
  62. package/dist/lib/node-esm/app-graph-builder-OVST2O6U.mjs +83 -0
  63. package/dist/lib/node-esm/app-graph-builder-OVST2O6U.mjs.map +7 -0
  64. package/dist/lib/node-esm/{chunk-CEVIVRTY.mjs → chunk-ANHRRBQW.mjs} +8 -2
  65. package/dist/lib/node-esm/chunk-ANHRRBQW.mjs.map +7 -0
  66. package/dist/lib/node-esm/{chunk-ECJKIUBO.mjs → chunk-DXL5YA73.mjs} +22 -5
  67. package/dist/lib/node-esm/chunk-DXL5YA73.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-GVKXGLAF.mjs +296 -0
  69. package/dist/lib/node-esm/chunk-GVKXGLAF.mjs.map +7 -0
  70. package/dist/lib/node-esm/{chunk-PICJ2REN.mjs → chunk-HT2NACMK.mjs} +29 -36
  71. package/dist/lib/node-esm/chunk-HT2NACMK.mjs.map +7 -0
  72. package/dist/lib/node-esm/chunk-JYMW4Z5N.mjs +45 -0
  73. package/dist/lib/node-esm/chunk-JYMW4Z5N.mjs.map +7 -0
  74. package/dist/lib/node-esm/chunk-L6MEXN7V.mjs +32 -0
  75. package/dist/lib/node-esm/chunk-L6MEXN7V.mjs.map +7 -0
  76. package/dist/lib/node-esm/chunk-O5QHCG5A.mjs +276 -0
  77. package/dist/lib/node-esm/chunk-O5QHCG5A.mjs.map +7 -0
  78. package/dist/lib/node-esm/chunk-OKFUZA72.mjs +10 -0
  79. package/dist/lib/node-esm/chunk-OKFUZA72.mjs.map +7 -0
  80. package/dist/lib/node-esm/chunk-P3Q5IBZF.mjs +102 -0
  81. package/dist/lib/node-esm/chunk-P3Q5IBZF.mjs.map +7 -0
  82. package/dist/lib/node-esm/chunk-SUG55563.mjs +99 -0
  83. package/dist/lib/node-esm/chunk-SUG55563.mjs.map +7 -0
  84. package/dist/lib/node-esm/chunk-TGVY4GMA.mjs +10 -0
  85. package/dist/lib/node-esm/chunk-TGVY4GMA.mjs.map +7 -0
  86. package/dist/lib/node-esm/cli/index.mjs +1128 -0
  87. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  88. package/dist/lib/node-esm/compute-runtime-X2FXU47A.mjs +129 -0
  89. package/dist/lib/node-esm/compute-runtime-X2FXU47A.mjs.map +7 -0
  90. package/dist/lib/node-esm/create-trigger-from-template-HF7XIIRQ.mjs +79 -0
  91. package/dist/lib/node-esm/create-trigger-from-template-HF7XIIRQ.mjs.map +7 -0
  92. package/dist/lib/node-esm/hooks/index.mjs +3 -3
  93. package/dist/lib/node-esm/index.mjs +57 -63
  94. package/dist/lib/node-esm/index.mjs.map +4 -4
  95. package/dist/lib/node-esm/meta.json +1 -1
  96. package/dist/lib/node-esm/operation-handler-CI67LMB3.mjs +18 -0
  97. package/dist/lib/node-esm/operation-handler-CI67LMB3.mjs.map +7 -0
  98. package/dist/lib/node-esm/operations/index.mjs +14 -0
  99. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  100. package/dist/lib/node-esm/react-surface-C5MRQ2E3.mjs +66 -0
  101. package/dist/lib/node-esm/react-surface-C5MRQ2E3.mjs.map +7 -0
  102. package/dist/lib/node-esm/types/index.mjs +10 -4
  103. package/dist/types/src/AutomationPlugin.d.ts +2 -1
  104. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  105. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  106. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  107. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  108. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  109. package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts +6 -0
  110. package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +1 -0
  111. package/dist/types/src/capabilities/compute-runtime/index.d.ts +3 -0
  112. package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +1 -0
  113. package/dist/types/src/capabilities/index.d.ts +4 -5
  114. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  115. package/dist/types/src/capabilities/operation-handler/index.d.ts +4 -0
  116. package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
  117. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +6 -0
  118. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
  119. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  120. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  121. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  122. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  123. package/dist/types/src/cli/commands/index.d.ts +2 -0
  124. package/dist/types/src/cli/commands/index.d.ts.map +1 -0
  125. package/dist/types/src/cli/commands/trigger/create/index.d.ts +25 -0
  126. package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +1 -0
  127. package/dist/types/src/cli/commands/trigger/create/queue.d.ts +13 -0
  128. package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +1 -0
  129. package/dist/types/src/cli/commands/trigger/create/subscription.d.ts +15 -0
  130. package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +1 -0
  131. package/dist/types/src/cli/commands/trigger/create/timer.d.ts +13 -0
  132. package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +1 -0
  133. package/dist/types/src/cli/commands/trigger/index.d.ts +57 -0
  134. package/dist/types/src/cli/commands/trigger/index.d.ts.map +1 -0
  135. package/dist/types/src/cli/commands/trigger/list.d.ts +7 -0
  136. package/dist/types/src/cli/commands/trigger/list.d.ts.map +1 -0
  137. package/dist/types/src/cli/commands/trigger/options.d.ts +11 -0
  138. package/dist/types/src/cli/commands/trigger/options.d.ts.map +1 -0
  139. package/dist/types/src/cli/commands/trigger/remove.d.ts +8 -0
  140. package/dist/types/src/cli/commands/trigger/remove.d.ts.map +1 -0
  141. package/dist/types/src/cli/commands/trigger/update/index.d.ts +28 -0
  142. package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +1 -0
  143. package/dist/types/src/cli/commands/trigger/update/queue.d.ts +12 -0
  144. package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +1 -0
  145. package/dist/types/src/cli/commands/trigger/update/subscription.d.ts +13 -0
  146. package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +1 -0
  147. package/dist/types/src/cli/commands/trigger/update/timer.d.ts +11 -0
  148. package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +1 -0
  149. package/dist/types/src/cli/commands/trigger/util.d.ts +46 -0
  150. package/dist/types/src/cli/commands/trigger/util.d.ts.map +1 -0
  151. package/dist/types/src/cli/index.d.ts +2 -0
  152. package/dist/types/src/cli/index.d.ts.map +1 -0
  153. package/dist/types/src/cli/plugin.d.ts +3 -0
  154. package/dist/types/src/cli/plugin.d.ts.map +1 -0
  155. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +4 -5
  156. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  157. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +2 -0
  158. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  159. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
  160. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -1
  161. package/dist/types/src/components/FunctionsRegistry/index.d.ts +3 -1
  162. package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -1
  163. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
  164. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
  165. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
  166. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
  167. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +7 -6
  168. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  169. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +73 -2
  170. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  171. package/dist/types/src/components/index.d.ts +3 -4
  172. package/dist/types/src/components/index.d.ts.map +1 -1
  173. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +4 -0
  174. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
  175. package/dist/types/src/containers/AutomationSettings/index.d.ts +3 -0
  176. package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
  177. package/dist/types/src/{components → containers/FunctionsContainer}/FunctionsContainer.d.ts +0 -1
  178. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
  179. package/dist/types/src/containers/FunctionsContainer/index.d.ts +3 -0
  180. package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -0
  181. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts +6 -0
  182. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
  183. package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
  184. package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
  185. package/dist/types/src/containers/index.d.ts +5 -0
  186. package/dist/types/src/containers/index.d.ts.map +1 -0
  187. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +7 -6
  188. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
  189. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +4 -3
  190. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
  191. package/dist/types/src/index.d.ts +1 -2
  192. package/dist/types/src/index.d.ts.map +1 -1
  193. package/dist/types/src/meta.d.ts +2 -2
  194. package/dist/types/src/meta.d.ts.map +1 -1
  195. package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
  196. package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
  197. package/dist/types/src/operations/definitions.d.ts +19 -0
  198. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  199. package/dist/types/src/operations/index.d.ts +4 -0
  200. package/dist/types/src/operations/index.d.ts.map +1 -0
  201. package/dist/types/src/testing/test-functions.d.ts +204 -3
  202. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  203. package/dist/types/src/translations.d.ts +2 -0
  204. package/dist/types/src/translations.d.ts.map +1 -1
  205. package/dist/types/src/types/capabilities.d.ts +23 -0
  206. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  207. package/dist/types/src/types/events.d.ts +5 -0
  208. package/dist/types/src/types/events.d.ts.map +1 -0
  209. package/dist/types/src/types/index.d.ts +2 -0
  210. package/dist/types/src/types/index.d.ts.map +1 -1
  211. package/dist/types/src/types/schema.d.ts +11 -3
  212. package/dist/types/src/types/schema.d.ts.map +1 -1
  213. package/dist/types/tsconfig.tsbuildinfo +1 -1
  214. package/package.json +73 -50
  215. package/src/AutomationPlugin.tsx +16 -34
  216. package/src/capabilities/app-graph-builder/app-graph-builder.ts +72 -0
  217. package/src/capabilities/app-graph-builder/index.ts +7 -0
  218. package/src/capabilities/compute-runtime/compute-runtime.ts +156 -0
  219. package/src/capabilities/compute-runtime/index.ts +7 -0
  220. package/src/capabilities/index.ts +4 -8
  221. package/src/capabilities/operation-handler/index.ts +11 -0
  222. package/src/capabilities/operation-handler/operation-handler.ts +16 -0
  223. package/src/capabilities/react-surface/index.ts +7 -0
  224. package/src/capabilities/react-surface/react-surface.tsx +57 -0
  225. package/src/cli/commands/index.ts +5 -0
  226. package/src/cli/commands/trigger/create/index.ts +14 -0
  227. package/src/cli/commands/trigger/create/queue.ts +90 -0
  228. package/src/cli/commands/trigger/create/subscription.ts +129 -0
  229. package/src/cli/commands/trigger/create/timer.ts +94 -0
  230. package/src/cli/commands/trigger/index.ts +16 -0
  231. package/src/cli/commands/trigger/list.ts +68 -0
  232. package/src/cli/commands/trigger/options.ts +59 -0
  233. package/src/cli/commands/trigger/remove.ts +45 -0
  234. package/src/cli/commands/trigger/update/index.ts +14 -0
  235. package/src/cli/commands/trigger/update/queue.ts +196 -0
  236. package/src/cli/commands/trigger/update/subscription.ts +279 -0
  237. package/src/cli/commands/trigger/update/timer.ts +194 -0
  238. package/src/cli/commands/trigger/util.ts +409 -0
  239. package/src/cli/index.ts +5 -0
  240. package/src/cli/plugin.ts +24 -0
  241. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +8 -6
  242. package/src/components/AutomationPanel/AutomationPanel.tsx +170 -72
  243. package/src/components/FunctionsPanel/FunctionsPanel.tsx +27 -30
  244. package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +28 -46
  245. package/src/components/FunctionsRegistry/index.ts +4 -1
  246. package/src/components/TriggerEditor/FunctionInputEditor.tsx +34 -33
  247. package/src/components/TriggerEditor/SpecSelector.tsx +9 -7
  248. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +76 -30
  249. package/src/components/TriggerEditor/TriggerEditor.tsx +95 -48
  250. package/src/components/index.ts +1 -2
  251. package/src/{components → containers/AutomationSettings}/AutomationSettings.tsx +9 -12
  252. package/src/containers/AutomationSettings/index.ts +7 -0
  253. package/src/{components → containers/FunctionsContainer}/FunctionsContainer.tsx +10 -13
  254. package/src/containers/FunctionsContainer/index.ts +7 -0
  255. package/src/containers/TriggerSettings/TriggerSettings.tsx +26 -0
  256. package/src/containers/TriggerSettings/index.ts +6 -0
  257. package/src/containers/index.ts +9 -0
  258. package/src/hooks/useComputeRuntimeCallback.ts +12 -12
  259. package/src/hooks/useTriggerRuntimeControls.ts +28 -14
  260. package/src/index.ts +1 -2
  261. package/src/meta.ts +3 -3
  262. package/src/operations/create-trigger-from-template.ts +74 -0
  263. package/src/operations/definitions.ts +27 -0
  264. package/src/operations/index.ts +9 -0
  265. package/src/testing/test-functions.ts +9 -6
  266. package/src/translations.ts +4 -0
  267. package/src/{capabilities → types}/capabilities.ts +11 -7
  268. package/src/types/events.ts +11 -0
  269. package/src/types/index.ts +2 -0
  270. package/src/types/schema.ts +4 -4
  271. package/dist/lib/browser/AutomationPanel-7OECLR5N.mjs +0 -11
  272. package/dist/lib/browser/AutomationSettings-KCZISXI6.mjs +0 -68
  273. package/dist/lib/browser/AutomationSettings-KCZISXI6.mjs.map +0 -7
  274. package/dist/lib/browser/FunctionsContainer-MIWEISRR.mjs +0 -151
  275. package/dist/lib/browser/FunctionsContainer-MIWEISRR.mjs.map +0 -7
  276. package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs +0 -81
  277. package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs.map +0 -7
  278. package/dist/lib/browser/chunk-EPEXQP45.mjs +0 -14
  279. package/dist/lib/browser/chunk-EPEXQP45.mjs.map +0 -7
  280. package/dist/lib/browser/chunk-JW7XSPYW.mjs +0 -267
  281. package/dist/lib/browser/chunk-JW7XSPYW.mjs.map +0 -7
  282. package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +0 -7
  283. package/dist/lib/browser/chunk-NAPXRXTY.mjs.map +0 -7
  284. package/dist/lib/browser/chunk-QKFBHAGN.mjs +0 -184
  285. package/dist/lib/browser/chunk-QKFBHAGN.mjs.map +0 -7
  286. package/dist/lib/browser/chunk-TWWFNOIR.mjs +0 -109
  287. package/dist/lib/browser/chunk-TWWFNOIR.mjs.map +0 -7
  288. package/dist/lib/browser/chunk-XAKZ4ANY.mjs +0 -15
  289. package/dist/lib/browser/chunk-XAKZ4ANY.mjs.map +0 -7
  290. package/dist/lib/browser/chunk-YBPJCY3F.mjs.map +0 -7
  291. package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs +0 -113
  292. package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs.map +0 -7
  293. package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs +0 -77
  294. package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs.map +0 -7
  295. package/dist/lib/browser/react-surface-YQW7WCFW.mjs +0 -64
  296. package/dist/lib/browser/react-surface-YQW7WCFW.mjs.map +0 -7
  297. package/dist/lib/node-esm/AutomationSettings-UUUPVNUJ.mjs +0 -69
  298. package/dist/lib/node-esm/AutomationSettings-UUUPVNUJ.mjs.map +0 -7
  299. package/dist/lib/node-esm/FunctionsContainer-6OB3JN5O.mjs +0 -152
  300. package/dist/lib/node-esm/FunctionsContainer-6OB3JN5O.mjs.map +0 -7
  301. package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs +0 -82
  302. package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs.map +0 -7
  303. package/dist/lib/node-esm/chunk-6YRKST6M.mjs +0 -185
  304. package/dist/lib/node-esm/chunk-6YRKST6M.mjs.map +0 -7
  305. package/dist/lib/node-esm/chunk-CEVIVRTY.mjs.map +0 -7
  306. package/dist/lib/node-esm/chunk-CPP35BE6.mjs +0 -16
  307. package/dist/lib/node-esm/chunk-CPP35BE6.mjs.map +0 -7
  308. package/dist/lib/node-esm/chunk-ECJKIUBO.mjs.map +0 -7
  309. package/dist/lib/node-esm/chunk-KB7NFEYY.mjs +0 -16
  310. package/dist/lib/node-esm/chunk-KB7NFEYY.mjs.map +0 -7
  311. package/dist/lib/node-esm/chunk-PICJ2REN.mjs.map +0 -7
  312. package/dist/lib/node-esm/chunk-RVK52XGK.mjs +0 -110
  313. package/dist/lib/node-esm/chunk-RVK52XGK.mjs.map +0 -7
  314. package/dist/lib/node-esm/chunk-W76WUTZY.mjs +0 -268
  315. package/dist/lib/node-esm/chunk-W76WUTZY.mjs.map +0 -7
  316. package/dist/lib/node-esm/compute-runtime-URROOC34.mjs +0 -114
  317. package/dist/lib/node-esm/compute-runtime-URROOC34.mjs.map +0 -7
  318. package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs +0 -78
  319. package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs.map +0 -7
  320. package/dist/lib/node-esm/react-surface-NNHYNBO6.mjs +0 -65
  321. package/dist/lib/node-esm/react-surface-NNHYNBO6.mjs.map +0 -7
  322. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  323. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  324. package/dist/types/src/capabilities/capabilities.d.ts +0 -20
  325. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  326. package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
  327. package/dist/types/src/capabilities/compute-runtime.d.ts.map +0 -1
  328. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  329. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  330. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  331. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  332. package/dist/types/src/components/AutomationSettings.d.ts +0 -5
  333. package/dist/types/src/components/AutomationSettings.d.ts.map +0 -1
  334. package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
  335. package/dist/types/src/components/TriggerSettings.d.ts +0 -6
  336. package/dist/types/src/components/TriggerSettings.d.ts.map +0 -1
  337. package/dist/types/src/events.d.ts +0 -4
  338. package/dist/types/src/events.d.ts.map +0 -1
  339. package/src/capabilities/app-graph-builder.ts +0 -87
  340. package/src/capabilities/compute-runtime.ts +0 -127
  341. package/src/capabilities/intent-resolver.ts +0 -72
  342. package/src/capabilities/react-surface.tsx +0 -56
  343. package/src/components/TriggerSettings.tsx +0 -25
  344. package/src/events.ts +0 -11
  345. /package/dist/lib/browser/{AutomationPanel-7OECLR5N.mjs.map → AutomationPanel-UPV6GR5B.mjs.map} +0 -0
  346. /package/dist/lib/browser/{FunctionsPanel-CRW6SJUN.mjs.map → FunctionsPanel-FFGPFXSF.mjs.map} +0 -0
  347. /package/dist/lib/{node-esm/AutomationPanel-HCVFNHGQ.mjs.map → browser/FunctionsRegistry-7FVC2YMN.mjs.map} +0 -0
  348. /package/dist/lib/{node-esm/FunctionsPanel-RVVCS6VH.mjs.map → browser/TriggerSettings-3UW3UTJE.mjs.map} +0 -0
@@ -6,43 +6,54 @@ import * as Array from 'effect/Array';
6
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
+ import { Context } from '@dxos/context';
11
12
  import { Filter, Obj, Tag } from '@dxos/echo';
12
- import { Function, Script, Trigger } from '@dxos/functions';
13
+ import { Script, Trigger } from '@dxos/functions';
14
+ import { Operation } from '@dxos/operation';
15
+ import { KEY_QUEUE_CURSOR } from '@dxos/functions-runtime';
16
+ import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
13
17
  import { useTypeOptions } from '@dxos/plugin-space';
14
18
  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';
19
+ import { type Space, useObject, useQuery } from '@dxos/react-client/echo';
20
+ import { Clipboard, IconButton, type IconButtonProps, Input, Separator, useTranslation } from '@dxos/react-ui';
21
+ import { Settings } from '@dxos/react-ui-form';
18
22
  import { List } from '@dxos/react-ui-list';
19
- import { ghostHover, mx } from '@dxos/react-ui-theme';
20
- import { View } from '@dxos/schema';
21
- import { Project } from '@dxos/types';
23
+ import { Pipeline } from '@dxos/types';
24
+ import { ghostHover, mx } from '@dxos/ui-theme';
25
+ import { isNonNullable } from '@dxos/util';
22
26
 
23
27
  import { meta } from '../../meta';
24
28
  import { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';
25
29
 
26
- const grid = 'grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]';
30
+ const grid = 'grid grid-cols-[40px_1fr_32px_32px] min-h-[2.5rem]';
27
31
 
28
- export type AutomationPanelProps = ThemedClassName<{
32
+ export type AutomationPanelProps = {
29
33
  space: Space;
30
- object?: Obj.Any;
34
+ object?: Obj.Unknown;
31
35
  initialTrigger?: Trigger.Trigger;
32
36
  onDone?: () => void;
33
- }>;
37
+ };
34
38
 
35
39
  // TODO(burdon): Factor out common layout with ViewEditor.
36
- export const AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }: AutomationPanelProps) => {
40
+ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: AutomationPanelProps) => {
37
41
  const { t } = useTranslation(meta.id);
38
42
  const client = useClient();
39
- const functions = useQuery(space, Filter.type(Function.Function));
40
- const triggers = useQuery(space, Filter.type(Trigger.Trigger));
43
+ const functionsServiceClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);
44
+ const functions = useQuery(space.db, Filter.type(Operation.PersistentOperation));
45
+ const triggers = useQuery(space.db, Filter.type(Trigger.Trigger));
41
46
  const filteredTriggers = useMemo(() => {
42
47
  return object ? triggers.filter(triggerMatch(object)) : triggers;
43
48
  }, [object, triggers]);
44
- const tags = useQuery(space, Filter.type(Tag.Tag));
45
- const types = useTypeOptions({ space, annotation: ['dynamic', 'limited-static', 'object-form'] });
49
+ const tags = useQuery(space.db, Filter.type(Tag.Tag));
50
+ const types = useTypeOptions({
51
+ space,
52
+ annotation: {
53
+ location: ['database', 'runtime'],
54
+ kind: ['user'],
55
+ },
56
+ });
46
57
 
47
58
  const [trigger, setTrigger] = useState<Trigger.Trigger | undefined>(initialTrigger);
48
59
  const [selected, setSelected] = useState<Trigger.Trigger>();
@@ -65,7 +76,9 @@ export const AutomationPanel = ({ classNames, space, object, initialTrigger, onD
65
76
 
66
77
  const handleSave: TriggerEditorProps['onSave'] = (trigger) => {
67
78
  if (selected) {
68
- Object.assign(selected, trigger);
79
+ Obj.change(selected, (mutable) => {
80
+ Object.assign(mutable, trigger);
81
+ });
69
82
  } else {
70
83
  space.db.add(Trigger.make(trigger));
71
84
  }
@@ -80,11 +93,22 @@ export const AutomationPanel = ({ classNames, space, object, initialTrigger, onD
80
93
  onDone?.();
81
94
  };
82
95
 
96
+ const handleForceRunTrigger = async (trigger: Trigger.Trigger) => {
97
+ await functionsServiceClient.forceRunCronTrigger(Context.default(), space.id, trigger.id);
98
+ };
99
+
100
+ const handleResetCursor = async (trigger: Trigger.Trigger) => {
101
+ Obj.change(trigger, (obj) => {
102
+ Obj.deleteKeys(obj, KEY_QUEUE_CURSOR);
103
+ });
104
+ await space.db.flush({ indexes: true });
105
+ };
106
+
83
107
  if (trigger) {
84
108
  return (
85
- <ControlItem title={t('trigger editor title')}>
109
+ <Settings.Item title={t('trigger editor title')} description={t('trigger editor description')}>
86
110
  <TriggerEditor
87
- space={space}
111
+ db={space.db}
88
112
  trigger={trigger}
89
113
  readonlySpec={Boolean(object)}
90
114
  tags={tags}
@@ -92,12 +116,12 @@ export const AutomationPanel = ({ classNames, space, object, initialTrigger, onD
92
116
  onSave={handleSave}
93
117
  onCancel={handleCancel}
94
118
  />
95
- </ControlItem>
119
+ </Settings.Item>
96
120
  );
97
121
  }
98
122
 
99
123
  return (
100
- <div className={mx(controlItemClasses, classNames)}>
124
+ <Settings.Container>
101
125
  {filteredTriggers.length > 0 && (
102
126
  <List.Root<Trigger.Trigger>
103
127
  items={filteredTriggers}
@@ -105,74 +129,148 @@ export const AutomationPanel = ({ classNames, space, object, initialTrigger, onD
105
129
  getId={(field) => field.id}
106
130
  >
107
131
  {({ items: filteredTriggers }) => (
108
- <div role='list' className='flex flex-col is-full'>
109
- {filteredTriggers?.map((trigger) => {
110
- const copyAction = getCopyAction(client, trigger);
111
- return (
112
- <List.Item<Trigger.Trigger>
113
- key={trigger.id}
114
- item={trigger}
115
- classNames={mx(grid, ghostHover, 'items-center', 'pli-2')}
116
- >
117
- <Input.Root>
118
- <Input.Switch
119
- checked={trigger.enabled}
120
- onCheckedChange={(checked) => (trigger.enabled = checked)}
121
- />
122
- </Input.Root>
123
-
124
- <div className={'flex'}>
125
- <List.ItemTitle
126
- classNames='pli-1 cursor-pointer is-0 shrink truncate'
127
- onClick={() => handleSelect(trigger)}
128
- >
129
- {getFunctionName(functions, trigger) ?? '∅'}
130
- </List.ItemTitle>
131
-
132
- {/* TODO: a better way to expose copy action */}
133
- {copyAction && (
134
- <Clipboard.IconButton
135
- label={t(copyAction.translationKey)}
136
- value={copyAction.contentProvider()}
137
- />
138
- )}
139
- </div>
140
-
141
- <List.ItemDeleteButton onClick={() => handleDelete(trigger)} />
142
- </List.Item>
143
- );
144
- })}
132
+ <div role='list' className='flex flex-col w-full'>
133
+ {filteredTriggers?.map((trigger) => (
134
+ <TriggerListItem
135
+ key={trigger.id}
136
+ trigger={trigger}
137
+ functions={functions}
138
+ onSelect={handleSelect}
139
+ onDelete={handleDelete}
140
+ onResetCursor={handleResetCursor}
141
+ onForceRun={handleForceRunTrigger}
142
+ />
143
+ ))}
145
144
  </div>
146
145
  )}
147
146
  </List.Root>
148
147
  )}
149
- {filteredTriggers.length > 0 && <Separator classNames='mlb-4' />}
148
+
149
+ {filteredTriggers.length > 0 && <Separator classNames='my-4' />}
150
150
  <IconButton icon='ph--plus--regular' label={t('new trigger label')} onClick={handleAdd} />
151
- </div>
151
+ </Settings.Container>
152
+ );
153
+ };
154
+
155
+ const TriggerListItem = ({
156
+ trigger,
157
+ functions,
158
+ onSelect,
159
+ onDelete,
160
+ onResetCursor,
161
+ onForceRun,
162
+ }: {
163
+ trigger: Trigger.Trigger;
164
+ functions: Operation.PersistentOperation[];
165
+ onSelect?: (trigger: Trigger.Trigger) => void;
166
+ onDelete?: (trigger: Trigger.Trigger) => void;
167
+ onResetCursor?: (trigger: Trigger.Trigger) => void;
168
+ onForceRun?: (trigger: Trigger.Trigger) => void;
169
+ }) => {
170
+ const client = useClient();
171
+ const copyAction = getCopyAction(client, trigger);
172
+ const { t } = useTranslation(meta.id);
173
+ const cursor = Obj.getKeys(trigger, KEY_QUEUE_CURSOR).at(0)?.id;
174
+ const [snapshot, updateTrigger] = useObject(trigger);
175
+
176
+ const enabled = snapshot.enabled ?? false;
177
+ const onEnabledChange = (checked: boolean) => {
178
+ updateTrigger((trigger) => {
179
+ trigger.enabled = checked;
180
+ });
181
+ };
182
+
183
+ const handleSelect = useCallback(() => {
184
+ onSelect?.(trigger);
185
+ }, [onSelect, trigger]);
186
+
187
+ const handleDelete = useCallback(() => {
188
+ onDelete?.(trigger);
189
+ }, [onDelete, trigger]);
190
+
191
+ const handleResetCursor = useCallback(() => {
192
+ onResetCursor?.(trigger);
193
+ }, [onResetCursor, trigger]);
194
+
195
+ const handleForceRun = useCallback(() => {
196
+ onForceRun?.(trigger);
197
+ }, [onForceRun, trigger]);
198
+
199
+ const actionProps = useMemo<IconButtonProps | undefined>(() => {
200
+ if (trigger.spec?.kind === 'timer' && onForceRun) {
201
+ return {
202
+ disabled: !enabled || trigger.spec?.kind !== 'timer',
203
+ icon: 'ph--play--regular',
204
+ label: 'Force run',
205
+ onClick: handleForceRun,
206
+ };
207
+ }
208
+
209
+ if (trigger.spec?.kind === 'queue' && onResetCursor) {
210
+ return {
211
+ disabled: !cursor,
212
+ icon: 'ph--arrow-clockwise--regular',
213
+ label: 'Reset cursor',
214
+ onClick: handleResetCursor,
215
+ };
216
+ }
217
+ }, [enabled, trigger.spec?.kind, handleForceRun]);
218
+
219
+ return (
220
+ <List.Item<Obj.Snapshot<Trigger.Trigger>>
221
+ key={trigger.id}
222
+ item={snapshot}
223
+ classNames={mx(grid, ghostHover, 'items-center', 'px-2')}
224
+ >
225
+ <Input.Root>
226
+ <Input.Switch checked={enabled} onCheckedChange={onEnabledChange} />
227
+ </Input.Root>
228
+
229
+ <div className={'flex'}>
230
+ <List.ItemTitle classNames='px-1 cursor-pointer w-0 shrink truncate' onClick={handleSelect}>
231
+ {getFunctionName(functions, trigger) ?? '∅'}
232
+ {cursor && <div className='text-xs text-description truncate ml-4'>Position: {cursor}</div>}
233
+ </List.ItemTitle>
234
+
235
+ {copyAction && (
236
+ <Clipboard.IconButton label={t(copyAction.translationKey)} value={copyAction.contentProvider()} />
237
+ )}
238
+ </div>
239
+
240
+ {actionProps ? <List.ItemIconButton {...actionProps} autoHide={false} /> : <div />}
241
+
242
+ {onDelete && <List.ItemDeleteButton onClick={handleDelete} />}
243
+ </List.Item>
152
244
  );
153
245
  };
154
246
 
155
247
  const getCopyAction = (client: Client, trigger: Trigger.Trigger | undefined) => {
156
248
  if (trigger?.spec?.kind === 'email') {
157
- return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };
249
+ return {
250
+ translationKey: 'trigger copy email' as const,
251
+ contentProvider: () => `${Obj.getDatabase(trigger)!.spaceId}@dxos.network`,
252
+ };
158
253
  }
159
254
 
160
255
  if (trigger?.spec?.kind === 'webhook') {
161
- return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };
256
+ return {
257
+ translationKey: 'trigger copy url' as const,
258
+ contentProvider: () => getWebhookUrl(client, trigger!),
259
+ };
162
260
  }
163
261
 
164
262
  return undefined;
165
263
  };
166
264
 
167
265
  const getWebhookUrl = (client: Client, trigger: Trigger.Trigger) => {
168
- const spaceId = getSpace(trigger)!.id;
266
+ const spaceId = Obj.getDatabase(trigger)!.spaceId;
169
267
  const edgeUrl = new URL(client.config.values.runtime!.services!.edge!.url!);
170
268
  const isSecure = edgeUrl.protocol.startsWith('https') || edgeUrl.protocol.startsWith('wss');
171
269
  edgeUrl.protocol = isSecure ? 'https' : 'http';
172
270
  return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();
173
271
  };
174
272
 
175
- const getFunctionName = (functions: Function.Function[], trigger: Trigger.Trigger) => {
273
+ const getFunctionName = (functions: Operation.PersistentOperation[], trigger: Trigger.Trigger) => {
176
274
  // TODO(wittjosiah): Truncation should be done in the UI.
177
275
  // Warning that the List component is currently a can of worms.
178
276
  const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;
@@ -182,18 +280,18 @@ const getFunctionName = (functions: Function.Function[], trigger: Trigger.Trigge
182
280
 
183
281
  const scriptMatch = (script: Script.Script) => (trigger: Trigger.Trigger) => {
184
282
  const fn = trigger.function?.target;
185
- if (!Obj.instanceOf(Function.Function, fn)) {
283
+ if (!Obj.instanceOf(Operation.PersistentOperation, fn)) {
186
284
  return false;
187
285
  }
188
286
 
189
287
  return fn.source?.target === script;
190
288
  };
191
289
 
192
- const projectMatch = (project: Project.Project) => {
290
+ const projectMatch = (project: Pipeline.Pipeline) => {
193
291
  const viewQueries = EFn.pipe(
194
- project.collections,
195
- Array.map((collection) => collection.target),
196
- Array.filter(Schema.is(View.View)),
292
+ project.columns,
293
+ Array.map((column) => column.view.target),
294
+ Array.filter(isNonNullable),
197
295
  Array.map((view) => Obj.getSnapshot(view).query.ast),
198
296
  Array.map((ast) => JSON.stringify(ast)),
199
297
  );
@@ -209,14 +307,14 @@ const projectMatch = (project: Project.Project) => {
209
307
  };
210
308
  };
211
309
 
212
- const triggerMatch = Match.type<Obj.Any>().pipe(
310
+ const triggerMatch = Match.type<Obj.Unknown>().pipe(
213
311
  Match.withReturnType<(trigger: Trigger.Trigger) => boolean>(),
214
312
  Match.when(
215
313
  (obj) => Obj.instanceOf(Script.Script, obj),
216
314
  (obj) => scriptMatch(obj),
217
315
  ),
218
316
  Match.when(
219
- (obj) => Obj.instanceOf(Project.Project, obj),
317
+ (obj) => Obj.instanceOf(Pipeline.Pipeline, obj),
220
318
  (obj) => projectMatch(obj),
221
319
  ),
222
320
  Match.orElse((_obj) => () => true),
@@ -5,30 +5,28 @@
5
5
  import * as Schema from 'effect/Schema';
6
6
  import React, { useCallback, useMemo } from 'react';
7
7
 
8
- import { LayoutAction, createIntent } from '@dxos/app-framework';
9
- import { useIntentDispatcher } from '@dxos/app-framework/react';
10
- import { Obj } from '@dxos/echo';
11
- import { Function, Script } from '@dxos/functions';
12
- import { SpaceAction } from '@dxos/plugin-space/types';
8
+ import { useOperationInvoker } from '@dxos/app-framework/ui';
9
+ import { LayoutOperation, getObjectPathFromObject } from '@dxos/app-toolkit';
10
+ import { Script } from '@dxos/functions';
11
+ import { Operation } from '@dxos/operation';
12
+ import { SpaceOperation } from '@dxos/plugin-space/operations';
13
13
  import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
14
14
  import { Button, IconButton, useTranslation } from '@dxos/react-ui';
15
- import { controlItemClasses } from '@dxos/react-ui-form';
15
+ import { Settings } from '@dxos/react-ui-form';
16
16
  import { List } from '@dxos/react-ui-list';
17
- import { ghostHover, mx } from '@dxos/react-ui-theme';
17
+ import { ghostHover, mx } from '@dxos/ui-theme';
18
18
 
19
19
  import { meta } from '../../meta';
20
20
 
21
- const grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';
22
-
23
21
  export type FunctionsPanelProps = {
24
22
  space: Space;
25
23
  };
26
24
 
27
25
  export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
28
26
  const { t } = useTranslation(meta.id);
29
- const functions = useQuery(space, Filter.type(Function.Function));
30
- const scripts = useQuery(space, Filter.type(Script.Script));
31
- 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();
32
30
 
33
31
  const functionToScriptMap = useMemo(
34
32
  () =>
@@ -49,7 +47,7 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
49
47
  );
50
48
 
51
49
  const getScriptName = useCallback(
52
- (func: Function.Function) => {
50
+ (func: Operation.PersistentOperation) => {
53
51
  const script = functionToScriptMap[func.id];
54
52
  return script?.name;
55
53
  },
@@ -57,36 +55,35 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
57
55
  );
58
56
 
59
57
  const handleGoToScript = useCallback(
60
- (func: Function.Function) => {
58
+ (func: Operation.PersistentOperation) => {
61
59
  const script = functionToScriptMap[func.id];
62
60
  if (script) {
63
- void dispatch(
64
- createIntent(LayoutAction.Open, {
65
- part: 'main',
66
- subject: [Obj.getDXN(script).toString()],
67
- }),
68
- );
61
+ void invokePromise(LayoutOperation.Open, { subject: [getObjectPathFromObject(script)] });
69
62
  }
70
63
  },
71
- [functionToScriptMap, dispatch],
64
+ [functionToScriptMap, invokePromise],
72
65
  );
73
66
 
74
67
  const handleDelete = useCallback(
75
- (func: Function.Function) => dispatch(createIntent(SpaceAction.RemoveObjects, { objects: [func] })),
76
- [dispatch],
68
+ (func: Operation.PersistentOperation) => invokePromise(SpaceOperation.RemoveObjects, { objects: [func] }),
69
+ [invokePromise],
77
70
  );
78
71
 
79
72
  return (
80
- <div role='none' className={mx(controlItemClasses)}>
73
+ <Settings.Container>
81
74
  {functions.length > 0 && (
82
- <List.Root<Function.Function> items={functions} isItem={Schema.is(Function.Function)} getId={(func) => func.id}>
75
+ <List.Root<Operation.PersistentOperation>
76
+ items={functions}
77
+ isItem={Schema.is(Operation.PersistentOperation)}
78
+ getId={(func) => func.id}
79
+ >
83
80
  {({ items }) => (
84
- <div role='list' className='flex flex-col is-full'>
81
+ <div role='list' className='flex flex-col w-full'>
85
82
  {items?.map((func) => (
86
- <List.Item<Function.Function>
83
+ <List.Item<Operation.PersistentOperation>
87
84
  key={func.id}
88
85
  item={func}
89
- classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}
86
+ classNames={mx('grid grid-cols-[1fr_auto] min-h-[2.5rem] min-h-[3rem] px-2 items-center', ghostHover)}
90
87
  >
91
88
  <div className='flex flex-col truncate'>
92
89
  <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
@@ -110,7 +107,7 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
110
107
  </List.Root>
111
108
  )}
112
109
 
113
- {functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}
114
- </div>
110
+ {functions.length === 0 && <div className='text-center py-4 text-description'>{t('no functions found')}</div>}
111
+ </Settings.Container>
115
112
  );
116
113
  };
@@ -2,27 +2,23 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import * as Array from 'effect/Array';
6
- import * as EffectFunction from 'effect/Function';
7
- import * as Order from 'effect/Order';
8
5
  import * as Schema from 'effect/Schema';
9
6
  import { useState } from 'react';
10
7
  import React, { useCallback } from 'react';
11
8
 
12
- import { Obj } from '@dxos/echo';
13
- import { Function } from '@dxos/functions';
9
+ import { Context } from '@dxos/context';
10
+ import * as OperationModule from '@dxos/operation';
14
11
  import { getDeployedFunctions } from '@dxos/functions-runtime/edge';
15
12
  import { useClient } from '@dxos/react-client';
16
13
  import { Filter, Query, type Space, useQuery } from '@dxos/react-client/echo';
17
- import { useAsyncEffect } from '@dxos/react-ui';
18
- import { IconButton, useTranslation } from '@dxos/react-ui';
19
- import { controlItemClasses } from '@dxos/react-ui-form';
14
+ import { IconButton, useAsyncEffect, useTranslation } from '@dxos/react-ui';
15
+ import { Settings } from '@dxos/react-ui-form';
20
16
  import { List } from '@dxos/react-ui-list';
21
- import { ghostHover, mx } from '@dxos/react-ui-theme';
17
+ import { ghostHover, mx } from '@dxos/ui-theme';
22
18
 
23
19
  import { meta } from '../../meta';
24
20
 
25
- const grid = 'grid grid-cols-[1fr_1fr_auto] min-bs-[2.5rem]';
21
+ const grid = 'grid grid-cols-[1fr_1fr_auto] min-h-[2.5rem]';
26
22
 
27
23
  type FunctionsRegistryProps = {
28
24
  space: Space;
@@ -31,12 +27,12 @@ type FunctionsRegistryProps = {
31
27
  export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
32
28
  const client = useClient();
33
29
  const [loading, setLoading] = useState(true);
34
- const [functions, setFunctions] = useState<Function.Function[]>([]);
30
+ const [functions, setFunctions] = useState<OperationModule.Operation.PersistentOperation[]>([]);
35
31
  const { t } = useTranslation(meta.id);
36
32
 
37
- const dbFunctions = useQuery(space, Filter.type(Function.Function));
33
+ const dbFunctions = useQuery(space.db, Filter.type(OperationModule.Operation.PersistentOperation));
38
34
 
39
- const state = (func: Function.Function) => {
35
+ const state = (func: OperationModule.Operation.PersistentOperation) => {
40
36
  const dbFunction = dbFunctions.find((f) => f.key === func.key);
41
37
  if (!dbFunction) {
42
38
  return 'import';
@@ -49,55 +45,41 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
49
45
 
50
46
  useAsyncEffect(async () => {
51
47
  setLoading(true);
52
- const functions = await getDeployedFunctions(client);
48
+ const functions = await getDeployedFunctions(Context.default(), client, true);
53
49
  setFunctions(functions);
54
50
  setLoading(false);
55
51
  }, []);
56
52
 
57
- const dedupedFunctions = EffectFunction.pipe(
58
- functions,
59
- Array.filter((_) => _.key !== undefined),
60
- Array.sort(Order.reverse(Order.mapInput(Order.string, (_: Function.Function) => _.updated ?? ''))),
61
- Array.dedupeWith((self, that) => self.key === that.key),
62
- Array.sort(Order.mapInput(Order.string, (_: Function.Function) => _.key ?? '')),
63
- );
64
-
65
53
  const hanleImportOrUpdate = useCallback(
66
- async (func: Function.Function) => {
67
- const {
68
- objects: [existingFunc],
69
- } = await space.db.query(Query.type(Function.Function, { key: func.key })).run();
54
+ async (func: OperationModule.Operation.PersistentOperation) => {
55
+ const functions = await space.db
56
+ .query(Query.type(OperationModule.Operation.PersistentOperation, { key: func.key }))
57
+ .run();
58
+ const [existingFunc] = functions;
70
59
  if (!existingFunc) {
71
60
  space.db.add(func);
72
61
  return;
73
62
  }
74
- existingFunc.version = func.version;
75
- existingFunc.updated = func.updated;
76
- existingFunc.name = func.name;
77
- existingFunc.description = func.description;
78
- // TODO(dmaretskyi): A workaround for an ECHO bug.
79
- existingFunc.inputSchema = JSON.parse(JSON.stringify(func.inputSchema));
80
- existingFunc.outputSchema = JSON.parse(JSON.stringify(func.outputSchema));
81
- Obj.getMeta(existingFunc).keys = JSON.parse(JSON.stringify(Obj.getMeta(func).keys));
63
+ OperationModule.Operation.setFrom(existingFunc, func);
82
64
  },
83
65
  [space],
84
66
  );
85
67
 
86
68
  return (
87
- <div role='none' className={mx(controlItemClasses)}>
88
- {dedupedFunctions.length > 0 && (
89
- <List.Root<Function.Function>
90
- items={dedupedFunctions}
91
- isItem={Schema.is(Function.Function)}
69
+ <Settings.Container>
70
+ {functions.length > 0 && (
71
+ <List.Root<OperationModule.Operation.PersistentOperation>
72
+ items={functions}
73
+ isItem={Schema.is(OperationModule.Operation.PersistentOperation)}
92
74
  getId={(func) => func.id}
93
75
  >
94
76
  {({ items }) => (
95
- <div role='list' className='flex flex-col is-full'>
77
+ <div role='list' className='flex flex-col w-full'>
96
78
  {items?.map((func) => (
97
- <List.Item<Function.Function>
79
+ <List.Item<OperationModule.Operation.PersistentOperation>
98
80
  key={func.id}
99
81
  item={func}
100
- classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}
82
+ classNames={mx(grid, ghostHover, 'items-center', 'px-2', 'min-h-[3rem]')}
101
83
  >
102
84
  <div className='flex flex-col truncate'>
103
85
  <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
@@ -126,10 +108,10 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
126
108
  </List.Root>
127
109
  )}
128
110
 
129
- {dedupedFunctions.length === 0 && !loading && (
130
- <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>
111
+ {functions.length === 0 && !loading && (
112
+ <div className='text-center py-4 text-gray-500'>{t('no functions found')}</div>
131
113
  )}
132
- {loading && <div className='text-center plb-4 text-gray-500'>{t('loading functions')}</div>}
133
- </div>
114
+ {loading && <div className='text-center py-4 text-gray-500'>{t('loading functions')}</div>}
115
+ </Settings.Container>
134
116
  );
135
117
  };
@@ -2,4 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export { FunctionsRegistry } from './FunctionsRegistry';
5
+ import { FunctionsRegistry } from './FunctionsRegistry';
6
+
7
+ export { FunctionsRegistry };
8
+ export default FunctionsRegistry;