@dxos/plugin-automation 0.8.4-main.8360d9e660 → 0.8.4-main.8baae0fced

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 (352) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/neutral/AutomationPanel-GQCS4EPU.mjs +11 -0
  4. package/dist/lib/neutral/AutomationPlugin.mjs +10 -0
  5. package/dist/lib/{browser/cli/index.mjs → neutral/AutomationPlugin.node.mjs} +126 -130
  6. package/dist/lib/neutral/AutomationPlugin.node.mjs.map +7 -0
  7. package/dist/lib/neutral/AutomationPlugin.workerd.mjs +23 -0
  8. package/dist/lib/neutral/AutomationPlugin.workerd.mjs.map +7 -0
  9. package/dist/lib/neutral/AutomationSettings-F6AZQV74.mjs +31 -0
  10. package/dist/lib/neutral/AutomationSettings-F6AZQV74.mjs.map +7 -0
  11. package/dist/lib/neutral/FunctionsContainer-2ETGQQR2.mjs +38 -0
  12. package/dist/lib/neutral/FunctionsContainer-2ETGQQR2.mjs.map +7 -0
  13. package/dist/lib/{browser/chunk-75XLBFAG.mjs → neutral/FunctionsPanel-SVRKRUXZ.mjs} +22 -22
  14. package/dist/lib/neutral/FunctionsPanel-SVRKRUXZ.mjs.map +7 -0
  15. package/dist/lib/{browser/chunk-FUVAC5EC.mjs → neutral/FunctionsRegistry-7ITCFJCW.mjs} +24 -25
  16. package/dist/lib/neutral/FunctionsRegistry-7ITCFJCW.mjs.map +7 -0
  17. package/dist/lib/neutral/TriggerSettings-XCHIZPOR.mjs +9 -0
  18. package/dist/lib/neutral/app-graph-builder-4QOUKY5L.mjs +75 -0
  19. package/dist/lib/neutral/app-graph-builder-4QOUKY5L.mjs.map +7 -0
  20. package/dist/lib/neutral/capabilities/index.mjs +15 -0
  21. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  22. package/dist/lib/neutral/capabilities/node.mjs +13 -0
  23. package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
  24. package/dist/lib/neutral/chunk-2JP77CMN.mjs +42 -0
  25. package/dist/lib/neutral/chunk-2JP77CMN.mjs.map +7 -0
  26. package/dist/lib/{browser/chunk-EL64ZPPN.mjs → neutral/chunk-4ETZEEYR.mjs} +7 -3
  27. package/dist/lib/neutral/chunk-4ETZEEYR.mjs.map +7 -0
  28. package/dist/lib/{browser/chunk-O23LHDEX.mjs → neutral/chunk-EIIPEUUP.mjs} +60 -26
  29. package/dist/lib/neutral/chunk-EIIPEUUP.mjs.map +7 -0
  30. package/dist/lib/neutral/chunk-HRUXURVS.mjs +12 -0
  31. package/dist/lib/neutral/chunk-HRUXURVS.mjs.map +7 -0
  32. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  33. package/dist/lib/{browser/chunk-BWEKRPFJ.mjs → neutral/chunk-K3C5ZTZA.mjs} +29 -38
  34. package/dist/lib/neutral/chunk-K3C5ZTZA.mjs.map +7 -0
  35. package/dist/lib/neutral/chunk-VCWVO3JE.mjs +8 -0
  36. package/dist/lib/neutral/chunk-VCWVO3JE.mjs.map +7 -0
  37. package/dist/lib/neutral/chunk-VRGWNUVV.mjs +36 -0
  38. package/dist/lib/neutral/chunk-VRGWNUVV.mjs.map +7 -0
  39. package/dist/lib/neutral/chunk-YA2ZTSOH.mjs +73 -0
  40. package/dist/lib/neutral/chunk-YA2ZTSOH.mjs.map +7 -0
  41. package/dist/lib/neutral/components/index.mjs +16 -0
  42. package/dist/lib/neutral/containers/index.mjs +13 -0
  43. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  44. package/dist/lib/neutral/create-trigger-from-template-XAJWHKO2.mjs +68 -0
  45. package/dist/lib/neutral/create-trigger-from-template-XAJWHKO2.mjs.map +7 -0
  46. package/dist/lib/neutral/hooks/index.mjs +47 -0
  47. package/dist/lib/neutral/hooks/index.mjs.map +7 -0
  48. package/dist/lib/neutral/index.mjs +16 -0
  49. package/dist/lib/neutral/layer-specs-XLG75KLY.mjs +161 -0
  50. package/dist/lib/neutral/layer-specs-XLG75KLY.mjs.map +7 -0
  51. package/dist/lib/neutral/meta.json +1 -0
  52. package/dist/lib/neutral/meta.mjs +8 -0
  53. package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs +13 -0
  54. package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs.map +7 -0
  55. package/dist/lib/neutral/operations/index.mjs +8 -0
  56. package/dist/lib/neutral/plugin.mjs +16 -0
  57. package/dist/lib/neutral/plugin.mjs.map +7 -0
  58. package/dist/lib/neutral/react-surface-3OGMAMKV.mjs +57 -0
  59. package/dist/lib/neutral/react-surface-3OGMAMKV.mjs.map +7 -0
  60. package/dist/lib/neutral/testing.mjs +8 -0
  61. package/dist/lib/neutral/translations.mjs +47 -0
  62. package/dist/lib/neutral/translations.mjs.map +7 -0
  63. package/dist/lib/neutral/types/index.mjs +12 -0
  64. package/dist/types/src/AutomationPlugin.d.ts +1 -0
  65. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  66. package/dist/types/src/{cli/plugin.d.ts → AutomationPlugin.node.d.ts} +2 -1
  67. package/dist/types/src/AutomationPlugin.node.d.ts.map +1 -0
  68. package/dist/types/src/AutomationPlugin.test.d.ts +2 -0
  69. package/dist/types/src/AutomationPlugin.test.d.ts.map +1 -0
  70. package/dist/types/src/AutomationPlugin.workerd.d.ts +4 -0
  71. package/dist/types/src/AutomationPlugin.workerd.d.ts.map +1 -0
  72. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/index.d.ts +6 -4
  74. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  75. package/dist/types/src/capabilities/layer-specs.d.ts +5 -0
  76. package/dist/types/src/capabilities/layer-specs.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/node.d.ts +6 -0
  78. package/dist/types/src/capabilities/node.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  80. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  82. package/dist/types/src/commands/index.d.ts.map +1 -0
  83. package/dist/types/src/{cli/commands → commands}/trigger/create/index.d.ts +6 -6
  84. package/dist/types/src/commands/trigger/create/index.d.ts.map +1 -0
  85. package/dist/types/src/{cli/commands → commands}/trigger/create/queue.d.ts +1 -1
  86. package/dist/types/src/commands/trigger/create/queue.d.ts.map +1 -0
  87. package/dist/types/src/{cli/commands → commands}/trigger/create/subscription.d.ts +1 -1
  88. package/dist/types/src/commands/trigger/create/subscription.d.ts.map +1 -0
  89. package/dist/types/src/{cli/commands → commands}/trigger/create/timer.d.ts +1 -1
  90. package/dist/types/src/commands/trigger/create/timer.d.ts.map +1 -0
  91. package/dist/types/src/{cli/commands → commands}/trigger/index.d.ts +7 -7
  92. package/dist/types/src/commands/trigger/index.d.ts.map +1 -0
  93. package/dist/types/src/{cli/commands → commands}/trigger/list.d.ts +1 -1
  94. package/dist/types/src/commands/trigger/list.d.ts.map +1 -0
  95. package/dist/types/src/commands/trigger/options.d.ts.map +1 -0
  96. package/dist/types/src/{cli/commands → commands}/trigger/remove.d.ts +1 -1
  97. package/dist/types/src/commands/trigger/remove.d.ts.map +1 -0
  98. package/dist/types/src/{cli/commands → commands}/trigger/update/index.d.ts +5 -5
  99. package/dist/types/src/commands/trigger/update/index.d.ts.map +1 -0
  100. package/dist/types/src/commands/trigger/update/queue.d.ts.map +1 -0
  101. package/dist/types/src/commands/trigger/update/subscription.d.ts.map +1 -0
  102. package/dist/types/src/commands/trigger/update/timer.d.ts.map +1 -0
  103. package/dist/types/src/{cli/commands → commands}/trigger/util.d.ts +4 -4
  104. package/dist/types/src/commands/trigger/util.d.ts.map +1 -0
  105. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -1
  106. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  107. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +32 -32
  108. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  109. package/dist/types/src/components/AutomationPanel/index.d.ts.map +1 -1
  110. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
  111. package/dist/types/src/components/FunctionsPanel/index.d.ts.map +1 -1
  112. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -1
  113. package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -1
  114. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +6 -6
  115. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
  116. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +4 -4
  117. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
  118. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -1
  119. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  120. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +95 -93
  121. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  122. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +3 -1
  123. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -1
  124. package/dist/types/src/containers/AutomationSettings/index.d.ts +1 -2
  125. package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -1
  126. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts +2 -4
  127. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -1
  128. package/dist/types/src/containers/FunctionsContainer/index.d.ts +1 -2
  129. package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -1
  130. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts +3 -3
  131. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -1
  132. package/dist/types/src/hooks/index.d.ts +0 -1
  133. package/dist/types/src/hooks/index.d.ts.map +1 -1
  134. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +1 -1
  135. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
  136. package/dist/types/src/index.d.ts +0 -3
  137. package/dist/types/src/index.d.ts.map +1 -1
  138. package/dist/types/src/meta.d.ts.map +1 -1
  139. package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
  140. package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
  141. package/dist/types/src/operations/index.d.ts +3 -0
  142. package/dist/types/src/operations/index.d.ts.map +1 -0
  143. package/dist/types/src/plugin.d.ts +4 -0
  144. package/dist/types/src/plugin.d.ts.map +1 -0
  145. package/dist/types/src/testing/test-functions.d.ts +78 -76
  146. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  147. package/dist/types/src/testing.d.ts +2 -0
  148. package/dist/types/src/testing.d.ts.map +1 -0
  149. package/dist/types/src/translations.d.ts +32 -33
  150. package/dist/types/src/translations.d.ts.map +1 -1
  151. package/dist/types/src/types/AutomationOperation.d.ts +19 -0
  152. package/dist/types/src/types/AutomationOperation.d.ts.map +1 -0
  153. package/dist/types/src/types/index.d.ts +1 -2
  154. package/dist/types/src/types/index.d.ts.map +1 -1
  155. package/dist/types/src/types/schema.d.ts +7 -28
  156. package/dist/types/src/types/schema.d.ts.map +1 -1
  157. package/dist/types/tsconfig.tsbuildinfo +1 -1
  158. package/package.json +125 -68
  159. package/src/AutomationPlugin.node.ts +28 -0
  160. package/src/AutomationPlugin.test.ts +27 -0
  161. package/src/AutomationPlugin.tsx +12 -11
  162. package/src/AutomationPlugin.workerd.ts +18 -0
  163. package/src/capabilities/app-graph-builder.ts +66 -0
  164. package/src/capabilities/index.ts +10 -4
  165. package/src/capabilities/layer-specs.ts +231 -0
  166. package/src/capabilities/node.ts +13 -0
  167. package/src/capabilities/operation-handler.ts +16 -0
  168. package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +17 -15
  169. package/src/{cli/commands → commands}/trigger/create/queue.ts +7 -10
  170. package/src/{cli/commands → commands}/trigger/create/subscription.ts +8 -11
  171. package/src/{cli/commands → commands}/trigger/create/timer.ts +4 -7
  172. package/src/{cli/commands → commands}/trigger/list.ts +7 -4
  173. package/src/{cli/commands → commands}/trigger/remove.ts +2 -3
  174. package/src/{cli/commands → commands}/trigger/update/queue.ts +19 -20
  175. package/src/{cli/commands → commands}/trigger/update/subscription.ts +15 -15
  176. package/src/{cli/commands → commands}/trigger/update/timer.ts +16 -16
  177. package/src/{cli/commands → commands}/trigger/util.ts +25 -17
  178. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +12 -5
  179. package/src/components/AutomationPanel/AutomationPanel.tsx +89 -47
  180. package/src/components/FunctionsPanel/FunctionsPanel.tsx +33 -25
  181. package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +32 -23
  182. package/src/components/TriggerEditor/FunctionInputEditor.tsx +4 -4
  183. package/src/components/TriggerEditor/SpecSelector.tsx +17 -13
  184. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +19 -13
  185. package/src/components/TriggerEditor/TriggerEditor.tsx +13 -17
  186. package/src/containers/AutomationSettings/AutomationSettings.tsx +11 -7
  187. package/src/containers/AutomationSettings/index.ts +1 -3
  188. package/src/containers/FunctionsContainer/FunctionsContainer.tsx +11 -11
  189. package/src/containers/FunctionsContainer/index.ts +1 -3
  190. package/src/containers/TriggerSettings/TriggerSettings.tsx +32 -10
  191. package/src/hooks/index.ts +1 -1
  192. package/src/hooks/useTriggerRuntimeControls.ts +13 -8
  193. package/src/index.ts +0 -4
  194. package/src/meta.ts +3 -1
  195. package/src/operations/create-trigger-from-template.ts +71 -0
  196. package/src/operations/index.ts +7 -0
  197. package/src/plugin.ts +11 -0
  198. package/src/testing/test-functions.ts +6 -3
  199. package/src/testing.ts +7 -0
  200. package/src/translations.ts +38 -39
  201. package/src/types/AutomationOperation.ts +30 -0
  202. package/src/types/index.ts +2 -2
  203. package/src/types/schema.ts +2 -23
  204. package/dist/lib/browser/AutomationPanel-IGLIQY2N.mjs +0 -11
  205. package/dist/lib/browser/AutomationSettings-XGJGVBDD.mjs +0 -37
  206. package/dist/lib/browser/AutomationSettings-XGJGVBDD.mjs.map +0 -7
  207. package/dist/lib/browser/FunctionsContainer-R4ZMYSFJ.mjs +0 -43
  208. package/dist/lib/browser/FunctionsContainer-R4ZMYSFJ.mjs.map +0 -7
  209. package/dist/lib/browser/FunctionsPanel-NMA4RYJL.mjs +0 -10
  210. package/dist/lib/browser/FunctionsRegistry-TMKAEG5E.mjs +0 -10
  211. package/dist/lib/browser/TriggerSettings-GW5OEM2G.mjs +0 -11
  212. package/dist/lib/browser/app-graph-builder-74ILZP25.mjs +0 -83
  213. package/dist/lib/browser/app-graph-builder-74ILZP25.mjs.map +0 -7
  214. package/dist/lib/browser/chunk-5WMYSXEH.mjs +0 -83
  215. package/dist/lib/browser/chunk-5WMYSXEH.mjs.map +0 -7
  216. package/dist/lib/browser/chunk-75XLBFAG.mjs.map +0 -7
  217. package/dist/lib/browser/chunk-BWEKRPFJ.mjs.map +0 -7
  218. package/dist/lib/browser/chunk-EL64ZPPN.mjs.map +0 -7
  219. package/dist/lib/browser/chunk-FUVAC5EC.mjs.map +0 -7
  220. package/dist/lib/browser/chunk-LHJEQVX5.mjs +0 -8
  221. package/dist/lib/browser/chunk-LHJEQVX5.mjs.map +0 -7
  222. package/dist/lib/browser/chunk-O23LHDEX.mjs.map +0 -7
  223. package/dist/lib/browser/chunk-PUYY7B5F.mjs +0 -31
  224. package/dist/lib/browser/chunk-PUYY7B5F.mjs.map +0 -7
  225. package/dist/lib/browser/chunk-ZBEMNWNY.mjs +0 -93
  226. package/dist/lib/browser/chunk-ZBEMNWNY.mjs.map +0 -7
  227. package/dist/lib/browser/cli/index.mjs.map +0 -7
  228. package/dist/lib/browser/compute-runtime-I3I2BIRE.mjs +0 -130
  229. package/dist/lib/browser/compute-runtime-I3I2BIRE.mjs.map +0 -7
  230. package/dist/lib/browser/hooks/index.mjs +0 -13
  231. package/dist/lib/browser/index.mjs +0 -123
  232. package/dist/lib/browser/index.mjs.map +0 -7
  233. package/dist/lib/browser/meta.json +0 -1
  234. package/dist/lib/browser/operation-resolver-NGN4BEWN.mjs +0 -84
  235. package/dist/lib/browser/operation-resolver-NGN4BEWN.mjs.map +0 -7
  236. package/dist/lib/browser/react-surface-SXDIM3RM.mjs +0 -65
  237. package/dist/lib/browser/react-surface-SXDIM3RM.mjs.map +0 -7
  238. package/dist/lib/browser/types/index.mjs +0 -14
  239. package/dist/lib/node-esm/AutomationPanel-O2BCQA7P.mjs +0 -12
  240. package/dist/lib/node-esm/AutomationSettings-W52ZO2XI.mjs +0 -38
  241. package/dist/lib/node-esm/AutomationSettings-W52ZO2XI.mjs.map +0 -7
  242. package/dist/lib/node-esm/FunctionsContainer-GYRPQZM7.mjs +0 -44
  243. package/dist/lib/node-esm/FunctionsContainer-GYRPQZM7.mjs.map +0 -7
  244. package/dist/lib/node-esm/FunctionsPanel-DCXXLSVP.mjs +0 -11
  245. package/dist/lib/node-esm/FunctionsRegistry-7WCHC64E.mjs +0 -11
  246. package/dist/lib/node-esm/FunctionsRegistry-7WCHC64E.mjs.map +0 -7
  247. package/dist/lib/node-esm/TriggerSettings-2GKFPECW.mjs +0 -12
  248. package/dist/lib/node-esm/TriggerSettings-2GKFPECW.mjs.map +0 -7
  249. package/dist/lib/node-esm/app-graph-builder-VDXPOWCH.mjs +0 -84
  250. package/dist/lib/node-esm/app-graph-builder-VDXPOWCH.mjs.map +0 -7
  251. package/dist/lib/node-esm/chunk-6JVB3IHW.mjs +0 -97
  252. package/dist/lib/node-esm/chunk-6JVB3IHW.mjs.map +0 -7
  253. package/dist/lib/node-esm/chunk-BNWZ2NNI.mjs +0 -32
  254. package/dist/lib/node-esm/chunk-BNWZ2NNI.mjs.map +0 -7
  255. package/dist/lib/node-esm/chunk-FPXVLTEY.mjs +0 -270
  256. package/dist/lib/node-esm/chunk-FPXVLTEY.mjs.map +0 -7
  257. package/dist/lib/node-esm/chunk-K7T2MVB7.mjs +0 -98
  258. package/dist/lib/node-esm/chunk-K7T2MVB7.mjs.map +0 -7
  259. package/dist/lib/node-esm/chunk-Q5JSKD6Z.mjs +0 -295
  260. package/dist/lib/node-esm/chunk-Q5JSKD6Z.mjs.map +0 -7
  261. package/dist/lib/node-esm/chunk-V3VUE2NR.mjs +0 -10
  262. package/dist/lib/node-esm/chunk-V3VUE2NR.mjs.map +0 -7
  263. package/dist/lib/node-esm/chunk-WC5AT7B3.mjs +0 -19
  264. package/dist/lib/node-esm/chunk-WC5AT7B3.mjs.map +0 -7
  265. package/dist/lib/node-esm/chunk-XCFO2IXT.mjs +0 -84
  266. package/dist/lib/node-esm/chunk-XCFO2IXT.mjs.map +0 -7
  267. package/dist/lib/node-esm/chunk-XQO3HK62.mjs +0 -94
  268. package/dist/lib/node-esm/chunk-XQO3HK62.mjs.map +0 -7
  269. package/dist/lib/node-esm/cli/index.mjs +0 -1116
  270. package/dist/lib/node-esm/cli/index.mjs.map +0 -7
  271. package/dist/lib/node-esm/compute-runtime-7HCSIYFG.mjs +0 -131
  272. package/dist/lib/node-esm/compute-runtime-7HCSIYFG.mjs.map +0 -7
  273. package/dist/lib/node-esm/hooks/index.mjs +0 -14
  274. package/dist/lib/node-esm/index.mjs +0 -124
  275. package/dist/lib/node-esm/index.mjs.map +0 -7
  276. package/dist/lib/node-esm/meta.json +0 -1
  277. package/dist/lib/node-esm/operation-resolver-ANGACQZG.mjs +0 -85
  278. package/dist/lib/node-esm/operation-resolver-ANGACQZG.mjs.map +0 -7
  279. package/dist/lib/node-esm/react-surface-QVLVDEVW.mjs +0 -66
  280. package/dist/lib/node-esm/react-surface-QVLVDEVW.mjs.map +0 -7
  281. package/dist/lib/node-esm/types/index.mjs +0 -15
  282. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
  283. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
  284. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
  285. package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts +0 -6
  286. package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +0 -1
  287. package/dist/types/src/capabilities/compute-runtime/index.d.ts +0 -3
  288. package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +0 -1
  289. package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
  290. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
  291. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
  292. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
  293. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  294. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  295. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  296. package/dist/types/src/cli/commands/index.d.ts.map +0 -1
  297. package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +0 -1
  298. package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +0 -1
  299. package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +0 -1
  300. package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +0 -1
  301. package/dist/types/src/cli/commands/trigger/index.d.ts.map +0 -1
  302. package/dist/types/src/cli/commands/trigger/list.d.ts.map +0 -1
  303. package/dist/types/src/cli/commands/trigger/options.d.ts.map +0 -1
  304. package/dist/types/src/cli/commands/trigger/remove.d.ts.map +0 -1
  305. package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +0 -1
  306. package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +0 -1
  307. package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +0 -1
  308. package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +0 -1
  309. package/dist/types/src/cli/commands/trigger/util.d.ts.map +0 -1
  310. package/dist/types/src/cli/index.d.ts +0 -2
  311. package/dist/types/src/cli/index.d.ts.map +0 -1
  312. package/dist/types/src/cli/plugin.d.ts.map +0 -1
  313. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +0 -12
  314. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +0 -1
  315. package/dist/types/src/types/capabilities.d.ts +0 -23
  316. package/dist/types/src/types/capabilities.d.ts.map +0 -1
  317. package/dist/types/src/types/events.d.ts +0 -5
  318. package/dist/types/src/types/events.d.ts.map +0 -1
  319. package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -73
  320. package/src/capabilities/app-graph-builder/index.ts +0 -7
  321. package/src/capabilities/compute-runtime/compute-runtime.ts +0 -155
  322. package/src/capabilities/compute-runtime/index.ts +0 -7
  323. package/src/capabilities/operation-resolver/index.ts +0 -7
  324. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -80
  325. package/src/capabilities/react-surface/index.ts +0 -7
  326. package/src/cli/index.ts +0 -5
  327. package/src/cli/plugin.ts +0 -24
  328. package/src/hooks/useComputeRuntimeCallback.ts +0 -67
  329. package/src/types/capabilities.ts +0 -45
  330. package/src/types/events.ts +0 -11
  331. /package/dist/lib/{browser/AutomationPanel-IGLIQY2N.mjs.map → neutral/AutomationPanel-GQCS4EPU.mjs.map} +0 -0
  332. /package/dist/lib/{browser/FunctionsPanel-NMA4RYJL.mjs.map → neutral/AutomationPlugin.mjs.map} +0 -0
  333. /package/dist/lib/{browser/FunctionsRegistry-TMKAEG5E.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
  334. /package/dist/lib/{browser/TriggerSettings-GW5OEM2G.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  335. /package/dist/lib/{browser/hooks → neutral/components}/index.mjs.map +0 -0
  336. /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
  337. /package/dist/lib/{node-esm/AutomationPanel-O2BCQA7P.mjs.map → neutral/meta.mjs.map} +0 -0
  338. /package/dist/lib/{node-esm/hooks → neutral/operations}/index.mjs.map +0 -0
  339. /package/dist/lib/{node-esm/FunctionsPanel-DCXXLSVP.mjs.map → neutral/testing.mjs.map} +0 -0
  340. /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
  341. /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
  342. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
  343. /package/dist/types/src/{cli/commands → commands}/index.d.ts +0 -0
  344. /package/dist/types/src/{cli/commands → commands}/trigger/options.d.ts +0 -0
  345. /package/dist/types/src/{cli/commands → commands}/trigger/update/queue.d.ts +0 -0
  346. /package/dist/types/src/{cli/commands → commands}/trigger/update/subscription.d.ts +0 -0
  347. /package/dist/types/src/{cli/commands → commands}/trigger/update/timer.d.ts +0 -0
  348. /package/src/{cli/commands → commands}/index.ts +0 -0
  349. /package/src/{cli/commands → commands}/trigger/create/index.ts +0 -0
  350. /package/src/{cli/commands → commands}/trigger/index.ts +0 -0
  351. /package/src/{cli/commands → commands}/trigger/options.ts +0 -0
  352. /package/src/{cli/commands → commands}/trigger/update/index.ts +0 -0
@@ -1,83 +0,0 @@
1
- import {
2
- meta
3
- } from "./chunk-EL64ZPPN.mjs";
4
-
5
- // src/types/capabilities.ts
6
- import { Capability } from "@dxos/app-framework";
7
- (function(AutomationCapabilities2) {
8
- AutomationCapabilities2.ComputeRuntime = Capability.make(`${meta.id}.capability.compute-runtime`);
9
- })(AutomationCapabilities || (AutomationCapabilities = {}));
10
- var AutomationCapabilities;
11
-
12
- // src/types/events.ts
13
- import { ActivationEvent } from "@dxos/app-framework";
14
- (function(AutomationEvents2) {
15
- AutomationEvents2.ComputeRuntimeReady = ActivationEvent.make(`${meta.id}.event.compute-runtime-ready`);
16
- })(AutomationEvents || (AutomationEvents = {}));
17
- var AutomationEvents;
18
-
19
- // src/types/schema.ts
20
- import * as Schema from "effect/Schema";
21
- import { Capability as Capability2 } from "@dxos/app-framework";
22
- import { Database } from "@dxos/echo";
23
- import { Operation } from "@dxos/operation";
24
- var TriggerTemplate = Schema.Union(Schema.Struct({
25
- type: Schema.Literal("timer"),
26
- cron: Schema.String
27
- }), Schema.Struct({
28
- type: Schema.Literal("queue"),
29
- queueDXN: Schema.Any
30
- }));
31
- (function(AutomationAction2) {
32
- class CreateTriggerFromTemplate extends Schema.TaggedClass()(`${meta.id}.action.create-trigger-from-template`, {
33
- input: Schema.Struct({
34
- db: Database.Database,
35
- template: TriggerTemplate,
36
- enabled: Schema.optional(Schema.Boolean),
37
- // TODO(wittjosiah): Improve how this lookup is done.
38
- scriptName: Schema.optional(Schema.String),
39
- input: Schema.optional(Schema.Record({
40
- key: Schema.String,
41
- value: Schema.Any
42
- }))
43
- }),
44
- output: Schema.Void
45
- }) {
46
- }
47
- AutomationAction2.CreateTriggerFromTemplate = CreateTriggerFromTemplate;
48
- })(AutomationAction || (AutomationAction = {}));
49
- var AUTOMATION_OPERATION = `${meta.id}.operation`;
50
- (function(AutomationOperation2) {
51
- AutomationOperation2.CreateTriggerFromTemplate = Operation.make({
52
- meta: {
53
- key: `${AUTOMATION_OPERATION}.create-trigger-from-template`,
54
- name: "Create Trigger From Template"
55
- },
56
- services: [
57
- Capability2.Service
58
- ],
59
- schema: {
60
- input: Schema.Struct({
61
- db: Database.Database,
62
- template: TriggerTemplate,
63
- enabled: Schema.optional(Schema.Boolean),
64
- scriptName: Schema.optional(Schema.String),
65
- input: Schema.optional(Schema.Record({
66
- key: Schema.String,
67
- value: Schema.Any
68
- }))
69
- }),
70
- output: Schema.Void
71
- }
72
- });
73
- })(AutomationOperation || (AutomationOperation = {}));
74
- var AutomationAction;
75
- var AutomationOperation;
76
-
77
- export {
78
- AutomationCapabilities,
79
- AutomationEvents,
80
- AutomationAction,
81
- AutomationOperation
82
- };
83
- //# sourceMappingURL=chunk-5WMYSXEH.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/capabilities.ts", "../../../src/types/events.ts", "../../../src/types/schema.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as ManagedRuntime from 'effect/ManagedRuntime';\n\nimport { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';\nimport { Capability } from '@dxos/app-framework';\nimport { type Database, type Feed } from '@dxos/echo';\nimport type { CredentialsService, FunctionInvocationService, QueueService, TracingService } from '@dxos/functions';\nimport type { TriggerDispatcher, TriggerStateStore } from '@dxos/functions-runtime';\nimport type { SpaceId } from '@dxos/keys';\nimport type { Blueprint } from '@dxos/blueprints';\n\nimport { meta } from '../meta';\n\nexport namespace AutomationCapabilities {\n /**\n * Service stack for executing agents, functions, and triggers.\n */\n export type ComputeServices =\n | TriggerDispatcher\n | TriggerStateStore\n | AiService.AiService\n | Database.Service\n | Feed.Service\n | QueueService\n | CredentialsService\n | FunctionInvocationService\n | TracingService\n | Blueprint.RegistryService\n // TODO(dmaretskyi): Those should be provided at AI-chat call site.\n | ToolResolverService\n | ToolExecutionService;\n\n export type ComputeRuntime = ManagedRuntime.ManagedRuntime<AutomationCapabilities.ComputeServices, never>;\n export interface ComputeRuntimeProvider {\n getRuntime(spaceId: SpaceId): ComputeRuntime;\n }\n\n /**\n * Runtime for executing agents, functions, and triggers.\n */\n export const ComputeRuntime = Capability.make<ComputeRuntimeProvider>(`${meta.id}.capability.compute-runtime`);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { ActivationEvent } from '@dxos/app-framework';\n\nimport { meta } from '../meta';\n\nexport namespace AutomationEvents {\n export const ComputeRuntimeReady = ActivationEvent.make(`${meta.id}.event.compute-runtime-ready`);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Capability } from '@dxos/app-framework';\nimport { Database } from '@dxos/echo';\nimport { Operation } from '@dxos/operation';\n\nimport { meta } from '../meta';\n\nconst TriggerTemplate = Schema.Union(\n Schema.Struct({ type: Schema.Literal('timer'), cron: Schema.String }),\n Schema.Struct({ type: Schema.Literal('queue'), queueDXN: Schema.Any }),\n);\n\nexport namespace AutomationAction {\n export class CreateTriggerFromTemplate extends Schema.TaggedClass<CreateTriggerFromTemplate>()(\n `${meta.id}.action.create-trigger-from-template`,\n {\n input: Schema.Struct({\n db: Database.Database,\n template: TriggerTemplate,\n enabled: Schema.optional(Schema.Boolean),\n // TODO(wittjosiah): Improve how this lookup is done.\n scriptName: Schema.optional(Schema.String),\n input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n }),\n output: Schema.Void,\n },\n ) {}\n}\n\nconst AUTOMATION_OPERATION = `${meta.id}.operation`;\n\nexport namespace AutomationOperation {\n export const CreateTriggerFromTemplate = Operation.make({\n meta: { key: `${AUTOMATION_OPERATION}.create-trigger-from-template`, name: 'Create Trigger From Template' },\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n db: Database.Database,\n template: TriggerTemplate,\n enabled: Schema.optional(Schema.Boolean),\n scriptName: Schema.optional(Schema.String),\n input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n }),\n output: Schema.Void,\n },\n });\n}\n"],
5
- "mappings": ";;;;;AAOA,SAASA,kBAAkB;UASVC,yBAAAA;0BA2BFC,iBAAiBC,WAAWC,KAA6B,GAAGC,KAAKC,EAAE,6BAA6B;AAC/G,GA5BiBL,2BAAAA,yBAAAA,CAAAA,EAAAA;;;;ACZjB,SAASM,uBAAuB;UAIfC,mBAAAA;oBACFC,sBAAsBC,gBAAgBC,KAAK,GAAGC,KAAKC,EAAE,8BAA8B;AAClG,GAFiBL,qBAAAA,mBAAAA,CAAAA,EAAAA;;;;ACJjB,YAAYM,YAAY;AAExB,SAASC,cAAAA,mBAAkB;AAC3B,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAI1B,IAAMC,kBAAyBC,aACtBC,cAAO;EAAEC,MAAaC,eAAQ,OAAA;EAAUC,MAAaC;AAAO,CAAA,GAC5DJ,cAAO;EAAEC,MAAaC,eAAQ,OAAA;EAAUG,UAAiBC;AAAI,CAAA,CAAA;UAGrDC,mBAAAA;EACR,MAAMC,kCAAyCC,mBAAW,EAC/D,GAAGC,KAAKC,EAAE,wCACV;IACEC,OAAcZ,cAAO;MACnBa,IAAIC,SAASA;MACbC,UAAUjB;MACVkB,SAAgBC,gBAAgBC,cAAO;;MAEvCC,YAAmBF,gBAAgBb,aAAM;MACzCQ,OAAcK,gBAAgBG,cAAO;QAAEC,KAAYjB;QAAQkB,OAAchB;MAAI,CAAA,CAAA;IAC/E,CAAA;IACAiB,QAAeC;EACjB,CAAA,EAAA;EACC;oBAbUhB,4BAAAA;AAcf,GAfiBD,qBAAAA,mBAAAA,CAAAA,EAAAA;AAiBjB,IAAMkB,uBAAuB,GAAGf,KAAKC,EAAE;UAEtBe,sBAAAA;uBACFlB,4BAA4BmB,UAAUC,KAAK;IACtDlB,MAAM;MAAEW,KAAK,GAAGI,oBAAAA;MAAqDI,MAAM;IAA+B;IAC1GC,UAAU;MAACC,YAAWC;;IACtBC,QAAQ;MACNrB,OAAcZ,cAAO;QACnBa,IAAIC,SAASA;QACbC,UAAUjB;QACVkB,SAAgBC,gBAAgBC,cAAO;QACvCC,YAAmBF,gBAAgBb,aAAM;QACzCQ,OAAcK,gBAAgBG,cAAO;UAAEC,KAAYjB;UAAQkB,OAAchB;QAAI,CAAA,CAAA;MAC/E,CAAA;MACAiB,QAAeC;IACjB;EACF,CAAA;AACF,GAfiBE,wBAAAA,sBAAAA,CAAAA,EAAAA;;;",
6
- "names": ["Capability", "AutomationCapabilities", "ComputeRuntime", "Capability", "make", "meta", "id", "ActivationEvent", "AutomationEvents", "ComputeRuntimeReady", "ActivationEvent", "make", "meta", "id", "Schema", "Capability", "Database", "Operation", "TriggerTemplate", "Union", "Struct", "type", "Literal", "cron", "String", "queueDXN", "Any", "AutomationAction", "CreateTriggerFromTemplate", "TaggedClass", "meta", "id", "input", "db", "Database", "template", "enabled", "optional", "Boolean", "scriptName", "Record", "key", "value", "output", "Void", "AUTOMATION_OPERATION", "AutomationOperation", "Operation", "make", "name", "services", "Capability", "Service", "schema"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/FunctionsPanel/FunctionsPanel.tsx", "../../../src/components/FunctionsPanel/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { LayoutOperation, getObjectPathFromObject } from '@dxos/app-toolkit';\nimport { Obj } from '@dxos/echo';\nimport { Function, Script } from '@dxos/functions';\nimport { SpaceOperation } from '@dxos/plugin-space/types';\nimport { Filter, type Space, useQuery } from '@dxos/react-client/echo';\nimport { Button, IconButton, useTranslation } from '@dxos/react-ui';\nimport { Settings } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/ui-theme';\n\nimport { meta } from '../../meta';\n\nexport type FunctionsPanelProps = {\n space: Space;\n};\n\nexport const FunctionsPanel = ({ space }: FunctionsPanelProps) => {\n const { t } = useTranslation(meta.id);\n const functions = useQuery(space.db, Filter.type(Function.Function));\n const scripts = useQuery(space.db, Filter.type(Script.Script));\n const { invokePromise } = useOperationInvoker();\n\n const functionToScriptMap = useMemo(\n () =>\n functions.reduce(\n (map, func) => {\n const scriptId = func.source?.target?.id;\n if (scriptId) {\n const script = scripts.find((s) => s.id === scriptId);\n if (script) {\n map[func.id] = script;\n }\n }\n return map;\n },\n {} as Record<string, Script.Script>,\n ),\n [functions, scripts],\n );\n\n const getScriptName = useCallback(\n (func: Function.Function) => {\n const script = functionToScriptMap[func.id];\n return script?.name;\n },\n [functionToScriptMap],\n );\n\n const handleGoToScript = useCallback(\n (func: Function.Function) => {\n const script = functionToScriptMap[func.id];\n if (script) {\n void invokePromise(LayoutOperation.Open, { subject: [getObjectPathFromObject(script)] });\n }\n },\n [functionToScriptMap, invokePromise],\n );\n\n const handleDelete = useCallback(\n (func: Function.Function) => invokePromise(SpaceOperation.RemoveObjects, { objects: [func] }),\n [invokePromise],\n );\n\n return (\n <Settings.Container>\n {functions.length > 0 && (\n <List.Root<Function.Function> items={functions} isItem={Schema.is(Function.Function)} getId={(func) => func.id}>\n {({ items }) => (\n <div role='list' className='flex flex-col w-full'>\n {items?.map((func) => (\n <List.Item<Function.Function>\n key={func.id}\n item={func}\n classNames={mx('grid grid-cols-[1fr_auto] min-h-[2.5rem] min-h-[3rem] px-2 items-center', ghostHover)}\n >\n <div className='flex flex-col truncate'>\n <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>\n {getScriptName(func) && (\n <div className='text-xs text-description truncate'>{getScriptName(func)}</div>\n )}\n </div>\n {functionToScriptMap[func.id] && (\n <Button onClick={() => handleGoToScript(func)}>{t('go to function source button label')}</Button>\n )}\n <IconButton\n iconOnly\n icon='ph--trash--regular'\n label={t('delete function button label')}\n onClick={() => handleDelete(func)}\n />\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {functions.length === 0 && <div className='text-center py-4 text-description'>{t('no functions found')}</div>}\n </Settings.Container>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { FunctionsPanel } from './FunctionsPanel';\n\nexport * from './FunctionsPanel';\nexport default FunctionsPanel;\n"],
5
- "mappings": ";;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAASC,2BAA2B;AACpC,SAASC,iBAAiBC,+BAA+B;AAEzD,SAASC,UAAUC,cAAc;AACjC,SAASC,sBAAsB;AAC/B,SAASC,QAAoBC,gBAAgB;AAC7C,SAASC,QAAQC,YAAYC,sBAAsB;AACnD,SAASC,gBAAgB;AACzB,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAQxB,IAAMC,iBAAiB,CAAC,EAAEC,MAAK,MAAuB;AAC3D,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,QAAMC,YAAYC,SAASN,MA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xBN,OAAOzB,IAAI,CAACC,SACX,sBAAA,cAACsB,KAAKS,MAAI;IACRC,KAAKhC,KAAKf;IACVgD,MAAMjC;IACNkC,YAAYC,GAAG,2EAA2EC,UAAAA;KAE1F,sBAAA,cAACR,OAAAA;IAAIE,WAAU;KACb,sBAAA,cAACR,KAAKe,WAAS;IAACH,YAAW;KAAYlC,KAAKS,IAAI,GAC/CF,cAAcP,IAAAA,KACb,sBAAA,cAAC4B,OAAAA;IAAIE,WAAU;KAAqCvB,cAAcP,IAAAA,CAAAA,CAAAA,GAGrEJ,oBAAoBI,KAAKf,EAAE,KAC1B,sBAAA,cAACqD,QAAAA;IAAOC,SAAS,MAAM7B,iBAAiBV,IAAAA;KAAQlB,EAAE,oCAAA,CAAA,GAEpD,sBAAA,cAAC0D,YAAAA;IACCC,UAAAA;IACAC,MAAK;IACLC,OAAO7D,EAAE,8BAAA;IACTyD,SAAS,MAAMxB,aAAaf,IAAAA;UASzCd,UAAUmC,WAAW,KAAK,sBAAA,cAACO,OAAAA;IAAIE,WAAU;KAAqChD,EAAE,oBAAA,CAAA,CAAA;AAGvF;;;ACrGA,IAAA,yBAAe8D;",
6
- "names": ["Schema", "React", "useCallback", "useMemo", "useOperationInvoker", "LayoutOperation", "getObjectPathFromObject", "Function", "Script", "SpaceOperation", "Filter", "useQuery", "Button", "IconButton", "useTranslation", "Settings", "List", "ghostHover", "mx", "FunctionsPanel", "space", "t", "useTranslation", "meta", "id", "functions", "useQuery", "db", "Filter", "type", "Function", "scripts", "Script", "invokePromise", "useOperationInvoker", "functionToScriptMap", "useMemo", "reduce", "map", "func", "scriptId", "source", "target", "script", "find", "s", "getScriptName", "useCallback", "name", "handleGoToScript", "LayoutOperation", "Open", "subject", "getObjectPathFromObject", "handleDelete", "SpaceOperation", "RemoveObjects", "objects", "Settings", "Container", "length", "List", "Root", "items", "isItem", "is", "getId", "div", "role", "className", "Item", "key", "item", "classNames", "mx", "ghostHover", "ItemTitle", "Button", "onClick", "IconButton", "iconOnly", "icon", "label", "FunctionsPanel"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/TriggerEditor/TriggerEditor.tsx", "../../../src/components/TriggerEditor/FunctionInputEditor.tsx", "../../../src/components/TriggerEditor/SpecSelector.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { ComputeGraph } from '@dxos/conductor';\nimport { DXN, type Database, Entity, Feed, Obj, type Query } from '@dxos/echo';\nimport { Function, Script, Trigger } from '@dxos/functions';\nimport { Filter, Ref, useQuery } from '@dxos/react-client/echo';\nimport { Input } from '@dxos/react-ui';\nimport { QueryForm, type QueryFormProps } from '@dxos/react-ui-components';\nimport {\n type ExcludeId,\n Form,\n FormFieldLabel,\n type FormFieldMap,\n type FormRootProps,\n SelectField,\n omitId,\n} from '@dxos/react-ui-form';\n\nimport { FunctionInputEditor } from './FunctionInputEditor';\nimport { SpecSelector } from './SpecSelector';\n\ntype TriggerFormSchema = ExcludeId<typeof Trigger.Trigger>;\n\nexport type TriggerEditorProps = {\n db: Database.Database;\n trigger: Trigger.Trigger;\n // TODO(wittjosiah): This needs to apply to whole spec but currently only applies to spec.kind & spec.query.\n readonlySpec?: boolean;\n} &\n // prettier-ignore\n Pick<QueryFormProps, 'types' | 'tags'> &\n Pick<FormRootProps<TriggerFormSchema>, 'onSave' | 'onCancel'>;\n\nexport const TriggerEditor = ({ db, types, tags, readonlySpec, trigger, ...formProps }: TriggerEditorProps) => {\n const fieldMap = useCustomInputs({\n db,\n types,\n tags,\n readonlySpec,\n });\n\n const handleValuesChanged = useCallback(\n (newValues: Partial<TriggerFormSchema>) => {\n Obj.change(trigger, (t) => {\n Object.assign(t, newValues);\n });\n },\n [trigger],\n );\n\n const triggerSchema = useMemo(() => omitId(Trigger.Trigger), []);\n const defaultValues = useMemo(() => {\n const { id: _, ...values } = trigger;\n return values;\n }, [trigger]);\n\n return (\n <Form.Root<TriggerFormSchema>\n {...formProps}\n db={db}\n schema={triggerSchema}\n defaultValues={defaultValues}\n fieldMap={fieldMap}\n onValuesChanged={handleValuesChanged}\n >\n <Form.Viewport>\n <Form.Content>\n <Form.FieldSet />\n <Form.Actions />\n </Form.Content>\n </Form.Viewport>\n </Form.Root>\n );\n};\n\ntype UseCustomInputsProps = {\n db: Database.Database;\n readonlySpec?: boolean;\n} & Pick<QueryFormProps, 'types' | 'tags'>;\n\nconst useCustomInputs = ({ db, readonlySpec, types, tags }: UseCustomInputsProps): FormFieldMap => {\n const functions = useQuery(db, Filter.type(Function.Function));\n const workflows = useQuery(db, Filter.type(ComputeGraph));\n const scripts = useQuery(db, Filter.type(Script.Script));\n const feeds = useQuery(db, Filter.type(Feed.Feed));\n\n return useMemo(\n (): FormFieldMap => ({\n // Function selector.\n ['function' satisfies keyof Trigger.Trigger]: (props) => {\n const getValue = useCallback(() => {\n const formValue = props.getValue();\n if (Ref.isRef(formValue)) {\n return formValue.dxn.toString() as string;\n }\n return undefined;\n }, [props]);\n\n const handleOnValueChange = useCallback(\n (_type: any, dxnString: string) => {\n const dxn = DXN.parse(dxnString);\n if (dxn) {\n const ref = Ref.fromDXN(dxn);\n props.onValueChange(props.type, ref);\n }\n },\n [props.type, props.onValueChange],\n );\n\n return (\n <SelectField\n {...props}\n getValue={getValue as any}\n onValueChange={handleOnValueChange}\n options={getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))}\n />\n );\n },\n\n // Spec selector.\n 'spec.kind': (props) => <SpecSelector {...props} readonly={readonlySpec} />,\n\n // Queue feed selector with parent labels.\n 'spec.queue': (props) => <SelectField {...props} options={getFeedQueueOptions(feeds)} />,\n\n // TODO(wittjosiah): Copied from ViewEditor.\n // Query input editor.\n 'spec.query': (props) => {\n const handleChange = useCallback(\n (query: Query.Any) => props.onValueChange(props.type, { ast: query.ast }),\n [props.type, props.onValueChange],\n );\n\n return (\n <Input.Root>\n <FormFieldLabel label={props.label} asChild />\n <QueryForm initialQuery={(props.getValue() as any).ast} types={types} tags={tags} onChange={handleChange} />\n </Input.Root>\n );\n },\n\n // Function input editor.\n input: (props) => <FunctionInputEditor {...props} functions={functions} db={db} />,\n }),\n [workflows, scripts, functions, feeds, readonlySpec],\n );\n};\n\nconst getWorkflowOptions = (graphs: ComputeGraph[]) => {\n return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));\n};\n\nconst getFunctionOptions = (scripts: Script.Script[], functions: Function.Function[]) => {\n const getLabel = (fn: Function.Function) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;\n return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:echo:@:${fn.id}` }));\n};\n\nconst getFeedQueueOptions = (feeds: Feed.Feed[]) => {\n return feeds.flatMap((feed) => {\n const queueDxn = Feed.getQueueDxn(feed);\n if (!queueDxn) {\n return [];\n }\n const parent = Obj.getParent(feed);\n const label = parent ? Entity.getLabel(parent) : Entity.getLabel(feed);\n return [{ label: label ?? feed.id, value: queueDxn.toString() }];\n });\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as SchemaAST from 'effect/SchemaAST';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { type Database, JsonSchema, Obj, Ref } from '@dxos/echo';\nimport { type JsonPath } from '@dxos/echo/internal';\nimport { type Function } from '@dxos/functions';\nimport { useOnTransition, useTranslation } from '@dxos/react-ui';\nimport { Form, type FormFieldStateProps, type FormRootProps, useFormValues } from '@dxos/react-ui-form';\n\nimport { meta } from '../../meta';\n\nexport type FunctionInputEditorProps = {\n type: SchemaAST.AST;\n functions: Function.Function[];\n db?: Database.Database;\n} & FormFieldStateProps;\n\nexport const FunctionInputEditor = ({ type, functions, db, getValue, onValueChange }: FunctionInputEditorProps) => {\n const { t } = useTranslation(meta.id);\n const selectedFunctionValue = useFormValues(FunctionInputEditor.displayName, ['function' as JsonPath]);\n const selectedFunctionId = useMemo(() => {\n if (Ref.isRef(selectedFunctionValue)) {\n return selectedFunctionValue.dxn.toString().split('dxn:echo:@:').at(1);\n }\n }, [selectedFunctionValue]);\n\n const selectedFunction = useMemo(\n () => functions.find((fn) => fn.id === selectedFunctionId),\n [functions, selectedFunctionId],\n );\n\n useOnTransition(\n // Clear function parameter input when the function changes.\n selectedFunctionValue,\n (prevValue) => {\n if (!Ref.isRef(prevValue) || !Ref.isRef(selectedFunctionValue)) {\n return false;\n }\n\n return prevValue.dxn.toString() !== selectedFunctionValue.dxn.toString();\n },\n (currValue) => currValue !== undefined,\n () => onValueChange(type, {}),\n );\n\n const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);\n const effectSchema = useMemo(() => (inputSchema ? JsonSchema.toEffectSchema(inputSchema) : undefined), [inputSchema]);\n const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;\n const defaultValues = useMemo(() => {\n const raw = getValue() ?? {};\n return Obj.isObject(raw) ? { ...Obj.getSnapshot(raw) } : { ...raw };\n }, [getValue]);\n\n const handleValuesChanged = useCallback<NonNullable<FormRootProps['onValuesChanged']>>(\n (values) => {\n onValueChange(type, values);\n },\n [type, onValueChange],\n );\n\n if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {\n return null;\n }\n\n return (\n <>\n <Form.Label label={t('function parameters label')} asChild />\n <Form.Root\n key={selectedFunction.id}\n schema={effectSchema}\n defaultValues={defaultValues}\n db={db}\n onValuesChanged={handleValuesChanged}\n >\n <Form.FieldSet />\n </Form.Root>\n </>\n );\n};\n\nFunctionInputEditor.displayName = 'AutomationTrigger.FunctionInputEditor';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { Filter, Query } from '@dxos/echo';\nimport { Trigger } from '@dxos/functions';\nimport { useTranslation } from '@dxos/react-ui';\nimport { type FormFieldComponentProps, SelectField, useFormFieldState } from '@dxos/react-ui-form';\n\nimport { meta } from '../../meta';\n\nexport type SpecSelectorProps = FormFieldComponentProps;\n\nexport const SpecSelector = (props: SpecSelectorProps) => {\n const { t } = useTranslation(meta.id);\n const specProps = useFormFieldState(SpecSelector.displayName, ['spec' satisfies keyof Trigger.Trigger]);\n\n const handleTypeChange = useCallback(\n (_type: any, value: string): Trigger.Spec | undefined => {\n const getDefaultTriggerSpec = (kind: string) => {\n switch (kind) {\n case 'timer':\n return { kind: 'timer', cron: '' };\n case 'subscription':\n return {\n kind: 'subscription',\n query: {\n ast: Query.select(Filter.nothing()).ast,\n },\n };\n case 'queue':\n return { kind: 'queue', queue: 'dxn:queue:default' };\n case 'email':\n return { kind: 'email' };\n case 'webhook':\n return { kind: 'webhook' };\n default:\n return undefined;\n }\n };\n\n const defaultSpec = getDefaultTriggerSpec(value);\n if (!defaultSpec) {\n return;\n }\n\n // Update the entire spec object, not just the `spec.kind`.\n specProps.onValueChange(props.type, defaultSpec);\n },\n [props.type, specProps],\n );\n\n const options = useMemo(\n () =>\n Trigger.Kinds.map((kind) => ({\n value: kind,\n label: t(`trigger type ${kind}`),\n })),\n [t],\n );\n\n return <SelectField {...props} options={options} onValueChange={handleTypeChange} />;\n};\n\nSpecSelector.displayName = 'Form.SpecSelector';\n"],
5
- "mappings": ";;;;;AAIA,OAAOA,UAASC,eAAAA,cAAaC,WAAAA,gBAAe;AAE5C,SAASC,oBAAoB;AAC7B,SAASC,KAAoBC,QAAQC,MAAMC,OAAAA,YAAuB;AAClE,SAASC,UAAUC,QAAQC,WAAAA,gBAAe;AAC1C,SAASC,UAAAA,SAAQC,OAAAA,MAAKC,gBAAgB;AACtC,SAASC,aAAa;AACtB,SAASC,iBAAsC;AAC/C,SAEEC,QAAAA,OACAC,gBAGAC,eAAAA,cACAC,cACK;;;ACfP,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAAwBC,YAAYC,KAAKC,WAAW;AAGpD,SAASC,iBAAiBC,sBAAsB;AAChD,SAASC,MAAoDC,qBAAqB;AAU3E,IAAMC,sBAAsB,CAAC,EAAEC,MAAMC,WAAWC,IAAIC,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,QAAQsB,SAASE,OAAOb,SAASW,MAAAA,IAAUE,OAAOb,SAASQ,IAAAA;AACjE,WAAO;MAAC;QAAEnB,OAAOA,SAASmB,KAAKvE;QAAI8D,OAAOU,SAAS3C,SAAQ;MAAG;;EAChE,CAAA;AACF;",
6
- "names": ["React", "useCallback", "useMemo", "ComputeGraph", "DXN", "Entity", "Feed", "Obj", "Function", "Script", "Trigger", "Filter", "Ref", "useQuery", "Input", "QueryForm", "Form", "FormFieldLabel", "SelectField", "omitId", "React", "useCallback", "useMemo", "JsonSchema", "Obj", "Ref", "useOnTransition", "useTranslation", "Form", "useFormValues", "FunctionInputEditor", "type", "functions", "db", "getValue", "onValueChange", "t", "useTranslation", "meta", "id", "selectedFunctionValue", "useFormValues", "displayName", "selectedFunctionId", "useMemo", "Ref", "isRef", "dxn", "toString", "split", "at", "selectedFunction", "find", "fn", "useOnTransition", "prevValue", "currValue", "undefined", "inputSchema", "effectSchema", "JsonSchema", "toEffectSchema", "propertyCount", "properties", "Object", "keys", "length", "defaultValues", "raw", "Obj", "isObject", "getSnapshot", "handleValuesChanged", "useCallback", "values", "Form", "Label", "label", "asChild", "Root", "key", "schema", "onValuesChanged", "FieldSet", "React", "useCallback", "useMemo", "Filter", "Query", "Trigger", "useTranslation", "SelectField", "useFormFieldState", "SpecSelector", "props", "t", "useTranslation", "meta", "id", "specProps", "useFormFieldState", "displayName", "handleTypeChange", "useCallback", "_type", "value", "getDefaultTriggerSpec", "kind", "cron", "query", "ast", "Query", "select", "Filter", "nothing", "queue", "undefined", "defaultSpec", "onValueChange", "type", "options", "useMemo", "Trigger", "Kinds", "map", "label", "React", "SelectField", "TriggerEditor", "db", "types", "tags", "readonlySpec", "trigger", "formProps", "fieldMap", "useCustomInputs", "handleValuesChanged", "useCallback", "newValues", "Obj", "change", "t", "Object", "assign", "triggerSchema", "useMemo", "omitId", "Trigger", "defaultValues", "id", "_", "values", "React", "Form", "Root", "schema", "onValuesChanged", "Viewport", "Content", "FieldSet", "Actions", "functions", "useQuery", "Filter", "type", "Function", "workflows", "ComputeGraph", "scripts", "Script", "feeds", "Feed", "props", "getValue", "formValue", "Ref", "isRef", "dxn", "toString", "undefined", "handleOnValueChange", "_type", "dxnString", "DXN", "parse", "ref", "fromDXN", "onValueChange", "SelectField", "options", "getWorkflowOptions", "concat", "getFunctionOptions", "SpecSelector", "readonly", "getFeedQueueOptions", "handleChange", "query", "ast", "Input", "FormFieldLabel", "label", "asChild", "QueryForm", "initialQuery", "onChange", "input", "FunctionInputEditor", "graphs", "map", "graph", "value", "getLabel", "fn", "find", "s", "source", "target", "name", "flatMap", "feed", "queueDxn", "getQueueDxn", "parent", "getParent", "Entity"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.automation',\n name: 'Automation',\n description: trim`\n Workflow automation engine that triggers custom actions based on object events and conditions.\n Create automated pipelines that respond to changes and streamline repetitive tasks.\n `,\n icon: 'ph--robot--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation',\n};\n"],
5
- "mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,QAAQ;AACV;",
6
- "names": ["trim", "meta", "id", "name", "description", "trim", "icon", "source"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/FunctionsRegistry/FunctionsRegistry.tsx", "../../../src/components/FunctionsRegistry/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport { useState } from 'react';\nimport React, { useCallback } from 'react';\n\nimport { Function } from '@dxos/functions';\nimport { getDeployedFunctions } from '@dxos/functions-runtime/edge';\nimport { useClient } from '@dxos/react-client';\nimport { Filter, Query, type Space, useQuery } from '@dxos/react-client/echo';\nimport { IconButton, useAsyncEffect, useTranslation } from '@dxos/react-ui';\nimport { Settings } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/ui-theme';\n\nimport { meta } from '../../meta';\n\nconst grid = 'grid grid-cols-[1fr_1fr_auto] min-h-[2.5rem]';\n\ntype FunctionsRegistryProps = {\n space: Space;\n};\n\nexport const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {\n const client = useClient();\n const [loading, setLoading] = useState(true);\n const [functions, setFunctions] = useState<Function.Function[]>([]);\n const { t } = useTranslation(meta.id);\n\n const dbFunctions = useQuery(space.db, Filter.type(Function.Function));\n\n const state = (func: Function.Function) => {\n const dbFunction = dbFunctions.find((f) => f.key === func.key);\n if (!dbFunction) {\n return 'import';\n }\n if (dbFunction.version === func.version && dbFunction.updated === func.updated) {\n return 'none';\n }\n return 'update';\n };\n\n useAsyncEffect(async () => {\n setLoading(true);\n const functions = await getDeployedFunctions(client, true);\n setFunctions(functions);\n setLoading(false);\n }, []);\n\n const hanleImportOrUpdate = useCallback(\n async (func: Function.Function) => {\n const functions = await space.db.query(Query.type(Function.Function, { key: func.key })).run();\n const [existingFunc] = functions;\n if (!existingFunc) {\n space.db.add(func);\n return;\n }\n Function.setFrom(existingFunc, func);\n },\n [space],\n );\n\n return (\n <Settings.Container>\n {functions.length > 0 && (\n <List.Root<Function.Function> items={functions} isItem={Schema.is(Function.Function)} getId={(func) => func.id}>\n {({ items }) => (\n <div role='list' className='flex flex-col w-full'>\n {items?.map((func) => (\n <List.Item<Function.Function>\n key={func.id}\n item={func}\n classNames={mx(grid, ghostHover, 'items-center', 'px-2', 'min-h-[3rem]')}\n >\n <div className='flex flex-col truncate'>\n <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>\n <div className='text-xs text-description truncate'>{func.key}</div>\n </div>\n <div className='flex flex-col truncate'>\n <div className='text-xs text-description truncate'>{func.version}</div>\n <div className='text-xs text-description truncate'>\n {func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : ''}\n </div>\n </div>\n\n <IconButton\n iconOnly\n icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}\n label={\n state(func) === 'update' ? t('update function button label') : t('import function button label')\n }\n disabled={state(func) === 'none'}\n onClick={() => hanleImportOrUpdate(func)}\n />\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {functions.length === 0 && !loading && (\n <div className='text-center py-4 text-gray-500'>{t('no functions found')}</div>\n )}\n {loading && <div className='text-center py-4 text-gray-500'>{t('loading functions')}</div>}\n </Settings.Container>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { FunctionsRegistry } from './FunctionsRegistry';\n\nexport { FunctionsRegistry };\nexport default FunctionsRegistry;\n"],
5
- "mappings": ";;;;;AAIA,YAAYA,YAAY;AACxB,SAASC,gBAAgB;AACzB,OAAOC,SAASC,mBAAmB;AAEnC,SAASC,gBAAgB;AACzB,SAASC,4BAA4B;AACrC,SAASC,iBAAiB;AAC1B,SAASC,QAAQC,OAAmBC,gBAAgB;AACpD,SAASC,YAAYC,gBAAgBC,sBAAsB;AAC3D,SAASC,gBAAgB;AACzB,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAI/B,IAAMC,OAAO;AAMN,IAAMC,oBAAoB,CAAC,EAAEC,MAAK,MAA0B;AACjE,QAAMC,SAASC,UAAAA;AACf,QAAM,CAACC,SAASC,UAAAA,IAAcC,SAAS,IAAA;AACvC,QAAM,CAACC,WAAWC,YAAAA,IAAgBF,SAA8B,CAAA,CAAE;AAClE,QAAM,EAAEG,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,QAAMC,cAAcC,SAASb,MAAMc,IAAIC,OAAOC,KAAKC,SAASA,QAAQ,CAAA;AAEpE,QAAMC,QAAQ,CAACC,S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,KAAKoC,IAAI,GAChD,sBAAA,cAACV,OAAAA;IAAIE,WAAU;KAAqC5B,KAAKI,GAAG,CAAA,GAE9D,sBAAA,cAACsB,OAAAA;IAAIE,WAAU;KACb,sBAAA,cAACF,OAAAA;IAAIE,WAAU;KAAqC5B,KAAKK,OAAO,GAChE,sBAAA,cAACqB,OAAAA;IAAIE,WAAU;KACZ5B,KAAKM,UAAU,YAAY,IAAI+B,KAAKrC,KAAKM,OAAO,EAAEgC,eAAc,CAAA,KAAO,EAAA,CAAA,GAI5E,sBAAA,cAACC,YAAAA;IACCC,UAAAA;IACAC,MAAM1C,MAAMC,IAAAA,MAAU,WAAW,kCAAkC;IACnE0C,OACE3C,MAAMC,IAAAA,MAAU,WAAWX,EAAE,8BAAA,IAAkCA,EAAE,8BAAA;IAEnEsD,UAAU5C,MAAMC,IAAAA,MAAU;IAC1B4C,SAAS,MAAMnC,oBAAoBT,IAAAA;UAShDb,UAAUgC,WAAW,KAAK,CAACnC,WAC1B,sBAAA,cAAC0C,OAAAA;IAAIE,WAAU;KAAkCvC,EAAE,oBAAA,CAAA,GAEpDL,WAAW,sBAAA,cAAC0C,OAAAA;IAAIE,WAAU;KAAkCvC,EAAE,mBAAA,CAAA,CAAA;AAGrE;;;ACtGA,IAAA,4BAAewD;",
6
- "names": ["Schema", "useState", "React", "useCallback", "Function", "getDeployedFunctions", "useClient", "Filter", "Query", "useQuery", "IconButton", "useAsyncEffect", "useTranslation", "Settings", "List", "ghostHover", "mx", "grid", "FunctionsRegistry", "space", "client", "useClient", "loading", "setLoading", "useState", "functions", "setFunctions", "t", "useTranslation", "meta", "id", "dbFunctions", "useQuery", "db", "Filter", "type", "Function", "state", "func", "dbFunction", "find", "f", "key", "version", "updated", "useAsyncEffect", "getDeployedFunctions", "hanleImportOrUpdate", "useCallback", "query", "Query", "run", "existingFunc", "add", "setFrom", "Settings", "Container", "length", "List", "Root", "items", "isItem", "is", "getId", "div", "role", "className", "map", "Item", "item", "classNames", "mx", "ghostHover", "ItemTitle", "name", "Date", "toLocaleString", "IconButton", "iconOnly", "icon", "label", "disabled", "onClick", "FunctionsRegistry"]
7
- }
@@ -1,8 +0,0 @@
1
- // src/capabilities/compute-runtime/index.ts
2
- import { Capability } from "@dxos/app-framework";
3
- var ComputeRuntime = Capability.lazy("ComputeRuntime", () => import("./compute-runtime-I3I2BIRE.mjs"));
4
-
5
- export {
6
- ComputeRuntime
7
- };
8
- //# sourceMappingURL=chunk-LHJEQVX5.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/compute-runtime/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const ComputeRuntime = Capability.lazy('ComputeRuntime', () => import('./compute-runtime'));\n"],
5
- "mappings": ";AAIA,SAASA,kBAAkB;AAEpB,IAAMC,iBAAiBC,WAAWC,KAAK,kBAAkB,MAAM,OAAO,gCAAA,CAAA;",
6
- "names": ["Capability", "ComputeRuntime", "Capability", "lazy"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/AutomationPanel/AutomationPanel.tsx", "../../../src/components/AutomationPanel/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Array from 'effect/Array';\nimport * as EFn from 'effect/Function';\nimport * as Match from 'effect/Match';\nimport * as Schema from 'effect/Schema';\nimport React, { useCallback, useMemo, useState } from 'react';\n\nimport { Filter, Obj, Tag } from '@dxos/echo';\nimport { Function, Script, Trigger } from '@dxos/functions';\nimport { KEY_QUEUE_CURSOR } from '@dxos/functions-runtime';\nimport { FunctionsServiceClient } from '@dxos/functions-runtime/edge';\nimport { useTypeOptions } from '@dxos/plugin-space';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { type Space, useObject, useQuery } from '@dxos/react-client/echo';\nimport { Clipboard, IconButton, type IconButtonProps, Input, Separator, useTranslation } from '@dxos/react-ui';\nimport { Settings } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { Pipeline } from '@dxos/types';\nimport { ghostHover, mx } from '@dxos/ui-theme';\nimport { isNonNullable } from '@dxos/util';\n\nimport { meta } from '../../meta';\nimport { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';\n\nconst grid = 'grid grid-cols-[40px_1fr_32px_32px] min-h-[2.5rem]';\n\nexport type AutomationPanelProps = {\n space: Space;\n object?: Obj.Unknown;\n initialTrigger?: Trigger.Trigger;\n onDone?: () => void;\n};\n\n// TODO(burdon): Factor out common layout with ViewEditor.\nexport const AutomationPanel = ({ space, object, initialTrigger, onDone }: AutomationPanelProps) => {\n const { t } = useTranslation(meta.id);\n const client = useClient();\n const functionsServiceClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);\n const functions = useQuery(space.db, Filter.type(Function.Function));\n const triggers = useQuery(space.db, Filter.type(Trigger.Trigger));\n const filteredTriggers = useMemo(() => {\n return object ? triggers.filter(triggerMatch(object)) : triggers;\n }, [object, triggers]);\n const tags = useQuery(space.db, Filter.type(Tag.Tag));\n const types = useTypeOptions({\n space,\n annotation: {\n location: ['database', 'runtime'],\n kind: ['user'],\n },\n });\n\n const [trigger, setTrigger] = useState<Trigger.Trigger | undefined>(initialTrigger);\n const [selected, setSelected] = useState<Trigger.Trigger>();\n\n const handleSelect = (trigger: Trigger.Trigger) => {\n setTrigger(trigger);\n setSelected(trigger);\n };\n\n const handleAdd = () => {\n setTrigger(Trigger.make({}));\n setSelected(undefined);\n };\n\n const handleDelete = (trigger: Trigger.Trigger) => {\n space.db.remove(trigger);\n setTrigger(undefined);\n setSelected(undefined);\n };\n\n const handleSave: TriggerEditorProps['onSave'] = (trigger) => {\n if (selected) {\n Obj.change(selected, (mutable) => {\n Object.assign(mutable, trigger);\n });\n } else {\n space.db.add(Trigger.make(trigger));\n }\n\n setTrigger(undefined);\n setSelected(undefined);\n onDone?.();\n };\n\n const handleCancel: TriggerEditorProps['onCancel'] = () => {\n setTrigger(undefined);\n onDone?.();\n };\n\n const handleForceRunTrigger = async (trigger: Trigger.Trigger) => {\n await functionsServiceClient.forceRunCronTrigger(space.id, trigger.id);\n };\n\n const handleResetCursor = async (trigger: Trigger.Trigger) => {\n Obj.change(trigger, (t) => {\n Obj.deleteKeys(t, KEY_QUEUE_CURSOR);\n });\n await space.db.flush({ indexes: true });\n };\n\n if (trigger) {\n return (\n <Settings.Item title={t('trigger editor title')} description={t('trigger editor description')}>\n <TriggerEditor\n db={space.db}\n trigger={trigger}\n readonlySpec={Boolean(object)}\n tags={tags}\n types={types}\n onSave={handleSave}\n onCancel={handleCancel}\n />\n </Settings.Item>\n );\n }\n\n return (\n <Settings.Container>\n {filteredTriggers.length > 0 && (\n <List.Root<Trigger.Trigger>\n items={filteredTriggers}\n isItem={Schema.is(Trigger.Trigger)}\n getId={(field) => field.id}\n >\n {({ items: filteredTriggers }) => (\n <div role='list' className='flex flex-col w-full'>\n {filteredTriggers?.map((trigger) => (\n <TriggerListItem\n key={trigger.id}\n trigger={trigger}\n functions={functions}\n onSelect={handleSelect}\n onDelete={handleDelete}\n onResetCursor={handleResetCursor}\n onForceRun={handleForceRunTrigger}\n />\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {filteredTriggers.length > 0 && <Separator classNames='my-4' />}\n <IconButton icon='ph--plus--regular' label={t('new trigger label')} onClick={handleAdd} />\n </Settings.Container>\n );\n};\n\nconst TriggerListItem = ({\n trigger,\n functions,\n onSelect,\n onDelete,\n onResetCursor,\n onForceRun,\n}: {\n trigger: Trigger.Trigger;\n functions: Function.Function[];\n onSelect?: (trigger: Trigger.Trigger) => void;\n onDelete?: (trigger: Trigger.Trigger) => void;\n onResetCursor?: (trigger: Trigger.Trigger) => void;\n onForceRun?: (trigger: Trigger.Trigger) => void;\n}) => {\n const client = useClient();\n const copyAction = getCopyAction(client, trigger);\n const { t } = useTranslation(meta.id);\n const cursor = Obj.getKeys(trigger, KEY_QUEUE_CURSOR).at(0)?.id;\n const [snapshot, updateTrigger] = useObject(trigger);\n\n const enabled = snapshot.enabled ?? false;\n const onEnabledChange = (checked: boolean) => {\n updateTrigger((trigger) => {\n trigger.enabled = checked;\n });\n };\n\n const handleSelect = useCallback(() => {\n onSelect?.(trigger);\n }, [onSelect, trigger]);\n\n const handleDelete = useCallback(() => {\n onDelete?.(trigger);\n }, [onDelete, trigger]);\n\n const handleResetCursor = useCallback(() => {\n onResetCursor?.(trigger);\n }, [onResetCursor, trigger]);\n\n const handleForceRun = useCallback(() => {\n onForceRun?.(trigger);\n }, [onForceRun, trigger]);\n\n const actionProps = useMemo<IconButtonProps | undefined>(() => {\n if (trigger.spec?.kind === 'timer' && onForceRun) {\n return {\n disabled: !enabled || trigger.spec?.kind !== 'timer',\n icon: 'ph--play--regular',\n label: 'Force run',\n onClick: handleForceRun,\n };\n }\n\n if (trigger.spec?.kind === 'queue' && onResetCursor) {\n return {\n disabled: !cursor,\n icon: 'ph--arrow-clockwise--regular',\n label: 'Reset cursor',\n onClick: handleResetCursor,\n };\n }\n }, [enabled, trigger.spec?.kind, handleForceRun]);\n\n return (\n <List.Item<Obj.Snapshot<Trigger.Trigger>>\n key={trigger.id}\n item={snapshot}\n classNames={mx(grid, ghostHover, 'items-center', 'px-2')}\n >\n <Input.Root>\n <Input.Switch checked={enabled} onCheckedChange={onEnabledChange} />\n </Input.Root>\n\n <div className={'flex'}>\n <List.ItemTitle classNames='px-1 cursor-pointer w-0 shrink truncate' onClick={handleSelect}>\n {getFunctionName(functions, trigger) ?? '∅'}\n {cursor && <div className='text-xs text-description truncate ml-4'>Position: {cursor}</div>}\n </List.ItemTitle>\n\n {copyAction && (\n <Clipboard.IconButton label={t(copyAction.translationKey)} value={copyAction.contentProvider()} />\n )}\n </div>\n\n {actionProps ? <List.ItemIconButton {...actionProps} autoHide={false} /> : <div />}\n\n {onDelete && <List.ItemDeleteButton onClick={handleDelete} />}\n </List.Item>\n );\n};\n\nconst getCopyAction = (client: Client, trigger: Trigger.Trigger | undefined) => {\n if (trigger?.spec?.kind === 'email') {\n return {\n translationKey: 'trigger copy email' as const,\n contentProvider: () => `${Obj.getDatabase(trigger)!.spaceId}@dxos.network`,\n };\n }\n\n if (trigger?.spec?.kind === 'webhook') {\n return {\n translationKey: 'trigger copy url' as const,\n contentProvider: () => getWebhookUrl(client, trigger!),\n };\n }\n\n return undefined;\n};\n\nconst getWebhookUrl = (client: Client, trigger: Trigger.Trigger) => {\n const spaceId = Obj.getDatabase(trigger)!.spaceId;\n const edgeUrl = new URL(client.config.values.runtime!.services!.edge!.url!);\n const isSecure = edgeUrl.protocol.startsWith('https') || edgeUrl.protocol.startsWith('wss');\n edgeUrl.protocol = isSecure ? 'https' : 'http';\n return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();\n};\n\nconst getFunctionName = (functions: Function.Function[], trigger: Trigger.Trigger) => {\n // TODO(wittjosiah): Truncation should be done in the UI.\n // Warning that the List component is currently a can of worms.\n const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;\n const functionObject = functions.find((fn) => fn === trigger.function?.target);\n return functionObject?.name ?? shortId;\n};\n\nconst scriptMatch = (script: Script.Script) => (trigger: Trigger.Trigger) => {\n const fn = trigger.function?.target;\n if (!Obj.instanceOf(Function.Function, fn)) {\n return false;\n }\n\n return fn.source?.target === script;\n};\n\nconst projectMatch = (project: Pipeline.Pipeline) => {\n const viewQueries = EFn.pipe(\n project.columns,\n Array.map((column) => column.view.target),\n Array.filter(isNonNullable),\n Array.map((view) => Obj.getSnapshot(view).query.ast),\n Array.map((ast) => JSON.stringify(ast)),\n );\n\n return (trigger: Trigger.Trigger) => {\n const spec = Obj.getSnapshot(trigger).spec;\n if (spec?.kind !== 'subscription') {\n return false;\n }\n\n // TODO(wittjosiah): Implement better way of comparing query ASTs.\n return viewQueries.some((query) => JSON.stringify(spec.query) === query);\n };\n};\n\nconst triggerMatch = Match.type<Obj.Unknown>().pipe(\n Match.withReturnType<(trigger: Trigger.Trigger) => boolean>(),\n Match.when(\n (obj) => Obj.instanceOf(Script.Script, obj),\n (obj) => scriptMatch(obj),\n ),\n Match.when(\n (obj) => Obj.instanceOf(Pipeline.Pipeline, obj),\n (obj) => projectMatch(obj),\n ),\n Match.orElse((_obj) => () => true),\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AutomationPanel } from './AutomationPanel';\n\nexport * from './AutomationPanel';\n\nexport default AutomationPanel;\n"],
5
- "mappings": ";;;;;;;;AAIA,YAAYA,WAAW;AACvB,YAAYC,SAAS;AACrB,YAAYC,WAAW;AACvB,YAAYC,YAAY;AACxB,OAAOC,SAASC,aAAaC,SAASC,gBAAgB;AAEtD,SAASC,QAAQC,KAAKC,WAAW;AACjC,SAASC,UAAUC,QAAQC,eAAe;AAC1C,SAASC,wBAAwB;AACjC,SAASC,8BAA8B;AACvC,SAASC,sBAAsB;AAC/B,SAAsBC,iBAAiB;AACvC,SAAqBC,WAAWC,gBAAgB;AAChD,SAASC,WAAWC,YAAkCC,OAAOC,WAAWC,sBAAsB;AAC9F,SAASC,gBAAgB;AACzB,SAASC,YAAY;AACrB,SAASC,gBAAgB;AACzB,SAASC,YAAYC,UAAU;AAC/B,SAASC,qBAAqB;AAK9B,IAAMC,OAAO;AAUN,IAAMC,kBAAkB,CAAC,EAAEC,OAAOC,QAAQC,gBAAgBC,OAAM,MAAwB;AAC7F,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,QAAMC,SAASC,UAAAA;AACf,QAAMC,yBAAyBC,QAAQ,MAAMC,uBAAuBC,WAAWL,MAAAA,GAAS;IAACA;GAAO;AAChG,QAAMM,YAAYC,SAASf,MAAMgB,IAAIC,OAAOC,KAAKC,SAASA,QAAQ,CAAA;AAClE,QAAMC,WAAWL,SAASf,MAAMgB,IAAIC,OAAOC,KAAKG,QAAQA,OAAO,CAAA;AAC/D,QAAMC,mBAAmBX,QAAQ,MAAA;AAC/B,WAAOV,SAASmB,SAAS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B,SAASA,UAAUF,GAAAA,GAC3C,CAACA,QAAQhB,aAAagB,GAAAA,CAAAA,GAElBG,aAAO,CAACC,SAAS,MAAM,IAAA,CAAA;;;ACrT/B,IAAA,0BAAeC;",
6
- "names": ["Array", "EFn", "Match", "Schema", "React", "useCallback", "useMemo", "useState", "Filter", "Obj", "Tag", "Function", "Script", "Trigger", "KEY_QUEUE_CURSOR", "FunctionsServiceClient", "useTypeOptions", "useClient", "useObject", "useQuery", "Clipboard", "IconButton", "Input", "Separator", "useTranslation", "Settings", "List", "Pipeline", "ghostHover", "mx", "isNonNullable", "grid", "AutomationPanel", "space", "object", "initialTrigger", "onDone", "t", "useTranslation", "meta", "id", "client", "useClient", "functionsServiceClient", "useMemo", "FunctionsServiceClient", "fromClient", "functions", "useQuery", "db", "Filter", "type", "Function", "triggers", "Trigger", "filteredTriggers", "filter", "triggerMatch", "tags", "Tag", "types", "useTypeOptions", "annotation", "location", "kind", "trigger", "setTrigger", "useState", "selected", "setSelected", "handleSelect", "handleAdd", "make", "undefined", "handleDelete", "remove", "handleSave", "Obj", "change", "mutable", "Object", "assign", "add", "handleCancel", "handleForceRunTrigger", "forceRunCronTrigger", "handleResetCursor", "deleteKeys", "KEY_QUEUE_CURSOR", "flush", "indexes", "Settings", "Item", "title", "description", "TriggerEditor", "readonlySpec", "Boolean", "onSave", "onCancel", "Container", "length", "List", "Root", "items", "isItem", "is", "getId", "field", "div", "role", "className", "map", "TriggerListItem", "key", "onSelect", "onDelete", "onResetCursor", "onForceRun", "Separator", "classNames", "IconButton", "icon", "label", "onClick", "copyAction", "getCopyAction", "cursor", "getKeys", "at", "snapshot", "updateTrigger", "useObject", "enabled", "onEnabledChange", "checked", "useCallback", "handleForceRun", "actionProps", "spec", "disabled", "item", "mx", "ghostHover", "Input", "Switch", "onCheckedChange", "ItemTitle", "getFunctionName", "Clipboard", "translationKey", "value", "contentProvider", "ItemIconButton", "autoHide", "ItemDeleteButton", "getDatabase", "spaceId", "getWebhookUrl", "edgeUrl", "URL", "config", "values", "runtime", "services", "edge", "url", "isSecure", "protocol", "startsWith", "toString", "shortId", "function", "dxn", "slice", "functionObject", "find", "fn", "target", "name", "scriptMatch", "script", "instanceOf", "source", "projectMatch", "project", "viewQueries", "pipe", "columns", "column", "view", "isNonNullable", "getSnapshot", "query", "ast", "JSON", "stringify", "some", "withReturnType", "when", "obj", "Script", "Pipeline", "orElse", "_obj", "AutomationPanel"]
7
- }
@@ -1,31 +0,0 @@
1
- import {
2
- useTriggerRuntimeControls
3
- } from "./chunk-ZBEMNWNY.mjs";
4
- import {
5
- meta
6
- } from "./chunk-EL64ZPPN.mjs";
7
-
8
- // src/containers/TriggerSettings/TriggerSettings.tsx
9
- import React from "react";
10
- import { Input, useTranslation } from "@dxos/react-ui";
11
- import { Settings } from "@dxos/react-ui-form";
12
- var TriggersSettings = ({ db }) => {
13
- const { state, start, stop } = useTriggerRuntimeControls(db);
14
- const isRunning = state?.enabled ?? false;
15
- const { t } = useTranslation(meta.id);
16
- return /* @__PURE__ */ React.createElement("div", {
17
- className: "grid grid-cols-1 md:grid-cols-[1fr_min-content]"
18
- }, /* @__PURE__ */ React.createElement(Settings.ItemInput, {
19
- title: t("runtime label"),
20
- description: t("runtime description")
21
- }, /* @__PURE__ */ React.createElement(Input.Switch, {
22
- classNames: "justify-self-end",
23
- checked: isRunning,
24
- onCheckedChange: isRunning ? stop : start
25
- })));
26
- };
27
-
28
- export {
29
- TriggersSettings
30
- };
31
- //# sourceMappingURL=chunk-PUYY7B5F.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/containers/TriggerSettings/TriggerSettings.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Database } from '@dxos/echo';\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { Settings } from '@dxos/react-ui-form';\n\nimport { useTriggerRuntimeControls } from '../../hooks';\nimport { meta } from '../../meta';\n\nexport const TriggersSettings = ({ db }: { db: Database.Database }) => {\n const { state, start, stop } = useTriggerRuntimeControls(db);\n const isRunning = state?.enabled ?? false;\n const { t } = useTranslation(meta.id);\n\n return (\n <div className='grid grid-cols-1 md:grid-cols-[1fr_min-content]'>\n <Settings.ItemInput title={t('runtime label')} description={t('runtime description')}>\n <Input.Switch classNames='justify-self-end' checked={isRunning} onCheckedChange={isRunning ? stop : start} />\n </Settings.ItemInput>\n </div>\n );\n};\n"],
5
- "mappings": ";;;;;;;;AAIA,OAAOA,WAAW;AAGlB,SAASC,OAAOC,sBAAsB;AACtC,SAASC,gBAAgB;AAKlB,IAAMC,mBAAmB,CAAC,EAAEC,GAAE,MAA6B;AAChE,QAAM,EAAEC,OAAOC,OAAOC,KAAI,IAAKC,0BAA0BJ,EAAAA;AACzD,QAAMK,YAAYJ,OAAOK,WAAW;AACpC,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,SACE,sBAAA,cAACC,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACC,SAASC,WAAS;IAACC,OAAOR,EAAE,eAAA;IAAkBS,aAAaT,EAAE,qBAAA;KAC5D,sBAAA,cAACU,MAAMC,QAAM;IAACC,YAAW;IAAmBC,SAASf;IAAWgB,iBAAiBhB,YAAYF,OAAOD;;AAI5G;",
6
- "names": ["React", "Input", "useTranslation", "Settings", "TriggersSettings", "db", "state", "start", "stop", "useTriggerRuntimeControls", "isRunning", "enabled", "t", "useTranslation", "meta", "id", "div", "className", "Settings", "ItemInput", "title", "description", "Input", "Switch", "classNames", "checked", "onCheckedChange"]
7
- }
@@ -1,93 +0,0 @@
1
- import {
2
- AutomationCapabilities
3
- } from "./chunk-5WMYSXEH.mjs";
4
-
5
- // src/hooks/useComputeRuntimeCallback.ts
6
- import * as Cause from "effect/Cause";
7
- import * as Effect from "effect/Effect";
8
- import * as Exit from "effect/Exit";
9
- import { useCallback } from "react";
10
- import { useCapability } from "@dxos/app-framework/ui";
11
- import { FunctionInvocationService, TracingService } from "@dxos/functions";
12
- import { log } from "@dxos/log";
13
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-automation/src/hooks/useComputeRuntimeCallback.ts";
14
- var useComputeRuntimeCallback = (id, fn, deps) => {
15
- const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
16
- const runtime = id !== void 0 ? computeRuntime.getRuntime(id) : void 0;
17
- return useCallback(() => {
18
- if (!runtime) {
19
- throw new TypeError("Space not provided to useComputeRuntimeCallback");
20
- }
21
- return runtime.runPromise(fn());
22
- }, [
23
- runtime,
24
- ...deps ?? []
25
- ]);
26
- };
27
- var invokeFunctionWithTracing = (functionDef, inputData) => Effect.gen(function* () {
28
- const tracer = yield* TracingService;
29
- const trace = yield* tracer.traceInvocationStart({
30
- target: void 0,
31
- payload: {
32
- data: {}
33
- }
34
- });
35
- const result = yield* FunctionInvocationService.invokeFunction(functionDef, inputData).pipe(Effect.provide(trace.invocationTraceQueue ? TracingService.layerInvocation(trace) : TracingService.layerNoop), Effect.exit);
36
- if (Exit.isFailure(result)) {
37
- const error = Cause.prettyErrors(result.cause)[0];
38
- log.error(error.message, error.cause ?? error.stack, {
39
- F: __dxlog_file,
40
- L: 57,
41
- S: this,
42
- C: (f, a) => f(...a)
43
- });
44
- }
45
- yield* tracer.traceInvocationEnd({
46
- trace,
47
- // TODO(dmaretskyi): Might miss errors.
48
- exception: Exit.isFailure(result) ? Cause.prettyErrors(result.cause)[0] : void 0
49
- });
50
- return result;
51
- });
52
-
53
- // src/hooks/useTriggerRuntimeControls.ts
54
- import { Atom, useAtomValue } from "@effect-atom/atom-react";
55
- import * as Effect2 from "effect/Effect";
56
- import { useEffect, useState } from "react";
57
- import { Filter } from "@dxos/echo";
58
- import { Trigger } from "@dxos/functions";
59
- import { TriggerDispatcher } from "@dxos/functions-runtime";
60
- import { useQuery } from "@dxos/react-client/echo";
61
- var useTriggerRuntimeControls = (db) => {
62
- const triggers = useQuery(db, Filter.type(Trigger.Trigger));
63
- const [dispatcher, setDispatcher] = useState(void 0);
64
- const init = useComputeRuntimeCallback(db?.spaceId, Effect2.fnUntraced(function* () {
65
- const dispatcher2 = yield* TriggerDispatcher;
66
- setDispatcher(dispatcher2);
67
- }));
68
- useEffect(() => {
69
- void init();
70
- }, []);
71
- const state = useAtomValue(dispatcher?.state ?? Atom.make(void 0));
72
- const start = useComputeRuntimeCallback(db?.spaceId, Effect2.fnUntraced(function* () {
73
- const dispatcher2 = yield* TriggerDispatcher;
74
- yield* dispatcher2.start();
75
- }));
76
- const stop = useComputeRuntimeCallback(db?.spaceId, Effect2.fnUntraced(function* () {
77
- const dispatcher2 = yield* TriggerDispatcher;
78
- yield* dispatcher2.stop();
79
- }));
80
- return {
81
- triggers,
82
- state,
83
- start: () => void start(),
84
- stop: () => void stop()
85
- };
86
- };
87
-
88
- export {
89
- useComputeRuntimeCallback,
90
- invokeFunctionWithTracing,
91
- useTriggerRuntimeControls
92
- };
93
- //# sourceMappingURL=chunk-ZBEMNWNY.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useComputeRuntimeCallback.ts", "../../../src/hooks/useTriggerRuntimeControls.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Cause from 'effect/Cause';\nimport * as Effect from 'effect/Effect';\nimport * as Exit from 'effect/Exit';\nimport { type DependencyList, useCallback } from 'react';\n\nimport { useCapability } from '@dxos/app-framework/ui';\nimport { type Key } from '@dxos/echo';\nimport { type FunctionDefinition, FunctionInvocationService, TracingService } from '@dxos/functions';\nimport { log } from '@dxos/log';\n\nimport { AutomationCapabilities } from '../types';\n\n/**\n * Create an effectful function that has access to compute services\n */\n// TODO(burdon): Factor out (figure out cross-plugin capabilities dependencies).\nexport const useComputeRuntimeCallback = <T>(\n id: Key.SpaceId | undefined,\n fn: () => Effect.Effect<T, any, AutomationCapabilities.ComputeServices>,\n deps?: DependencyList,\n): (() => Promise<T>) => {\n const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);\n const runtime = id !== undefined ? computeRuntime.getRuntime(id) : undefined;\n\n return useCallback(() => {\n if (!runtime) {\n throw new TypeError('Space not provided to useComputeRuntimeCallback');\n }\n\n return runtime.runPromise(fn());\n }, [runtime, ...(deps ?? [])]);\n};\n\n// TODO(wittjosiah): Function invoking should automatically be traced (DX-647).\nexport const invokeFunctionWithTracing = <I, O>(functionDef: FunctionDefinition<I, O>, inputData: I) =>\n Effect.gen(function* () {\n const tracer = yield* TracingService;\n const trace = yield* tracer.traceInvocationStart({\n target: undefined,\n payload: {\n data: {},\n },\n });\n\n // Invoke the function.\n const result = yield* FunctionInvocationService.invokeFunction(functionDef, inputData).pipe(\n Effect.provide(trace.invocationTraceQueue ? TracingService.layerInvocation(trace) : TracingService.layerNoop),\n Effect.exit,\n );\n\n if (Exit.isFailure(result)) {\n const error = Cause.prettyErrors(result.cause)[0];\n log.error(error.message, error.cause ?? error.stack);\n }\n\n yield* tracer.traceInvocationEnd({\n trace,\n // TODO(dmaretskyi): Might miss errors.\n exception: Exit.isFailure(result) ? Cause.prettyErrors(result.cause)[0] : undefined,\n });\n\n return result;\n });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom, useAtomValue } from '@effect-atom/atom-react';\nimport type * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport { useEffect, useState } from 'react';\n\nimport { type Database, Filter } from '@dxos/echo';\nimport { Trigger } from '@dxos/functions';\nimport { TriggerDispatcher, type TriggerDispatcherState } from '@dxos/functions-runtime';\nimport { useQuery } from '@dxos/react-client/echo';\n\nimport { useComputeRuntimeCallback } from './useComputeRuntimeCallback';\n\ninterface TriggerRuntimeControls {\n triggers: Trigger.Trigger[];\n\n state: TriggerDispatcherState | undefined;\n\n start: () => void;\n stop: () => void;\n}\n\nexport const useTriggerRuntimeControls = (db: Database.Database | undefined): TriggerRuntimeControls => {\n const triggers = useQuery(db, Filter.type(Trigger.Trigger));\n\n const [dispatcher, setDispatcher] = useState<Context.Tag.Service<TriggerDispatcher> | undefined>(undefined);\n\n const init = useComputeRuntimeCallback(\n db?.spaceId,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n setDispatcher(dispatcher);\n }),\n );\n\n useEffect(() => {\n void init();\n }, []);\n\n const state = useAtomValue(dispatcher?.state ?? Atom.make(undefined));\n\n const start = useComputeRuntimeCallback(\n db?.spaceId,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.start();\n }),\n );\n\n const stop = useComputeRuntimeCallback(\n db?.spaceId,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.stop();\n }),\n );\n\n return {\n triggers,\n state,\n start: () => void start(),\n stop: () => void stop(),\n };\n};\n"],
5
- "mappings": ";;;;;AAIA,YAAYA,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,UAAU;AACtB,SAA8BC,mBAAmB;AAEjD,SAASC,qBAAqB;AAE9B,SAAkCC,2BAA2BC,sBAAsB;AACnF,SAASC,WAAW;;AAQb,IAAMC,4BAA4B,CACvCC,IACAC,IACAC,SAAAA;AAEA,QAAMC,iBAAiBC,cAAcC,uBAAuBC,cAAc;AAC1E,QAAMC,UAAUP,OAAOQ,SAAYL,eAAeM,WAAWT,EAAAA,IAAMQ;AAEnE,SAAOE,YAAY,MAAA;AACjB,QAAI,CAACH,SAAS;AACZ,YAAM,IAAII,UAAU,iDAAA;IACtB;AAEA,WAAOJ,QAAQK,WAAWX,GAAAA,CAAAA;EAC5B,GAAG;IAACM;OAAaL,QAAQ,CAAA;GAAI;AAC/B;AAGO,IAAMW,4BAA4B,CAAOC,aAAuCC,cAC9EC,WAAI,aAAA;AACT,QAAMC,SAAS,OAAOC;AACtB,QAAMC,QAAQ,OAAOF,OAAOG,qBAAqB;IAC/CC,QAAQb;IACRc,SAAS;MACPC,MAAM,CAAC;IACT;EACF,CAAA;AAGA,QAAMC,SAAS,OAA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AAa,OAAOQ;AAC1B,WAAOR,YAAWe,KAAI;EACxB,CAAA,CAAA;AAGF,SAAO;IACLpB;IACAe;IACAI,OAAO,MAAM,KAAKA,MAAAA;IAClBC,MAAM,MAAM,KAAKA,KAAAA;EACnB;AACF;",
6
- "names": ["Cause", "Effect", "Exit", "useCallback", "useCapability", "FunctionInvocationService", "TracingService", "log", "useComputeRuntimeCallback", "id", "fn", "deps", "computeRuntime", "useCapability", "AutomationCapabilities", "ComputeRuntime", "runtime", "undefined", "getRuntime", "useCallback", "TypeError", "runPromise", "invokeFunctionWithTracing", "functionDef", "inputData", "gen", "tracer", "TracingService", "trace", "traceInvocationStart", "target", "payload", "data", "result", "FunctionInvocationService", "invokeFunction", "pipe", "provide", "invocationTraceQueue", "layerInvocation", "layerNoop", "exit", "isFailure", "error", "prettyErrors", "cause", "log", "message", "stack", "traceInvocationEnd", "exception", "Atom", "useAtomValue", "Effect", "useEffect", "useState", "Filter", "Trigger", "TriggerDispatcher", "useQuery", "useTriggerRuntimeControls", "db", "triggers", "useQuery", "Filter", "type", "Trigger", "dispatcher", "setDispatcher", "useState", "undefined", "init", "useComputeRuntimeCallback", "spaceId", "fnUntraced", "TriggerDispatcher", "useEffect", "state", "useAtomValue", "Atom", "make", "start", "stop"]
7
- }