@dxos/plugin-automation 0.8.4-main.3f58842 → 0.8.4-main.548089c

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 (194) hide show
  1. package/dist/lib/browser/AutomationPanel-W6K45EP4.mjs +11 -0
  2. package/dist/lib/browser/AutomationSettings-YGXYZZEU.mjs +68 -0
  3. package/dist/lib/browser/AutomationSettings-YGXYZZEU.mjs.map +7 -0
  4. package/dist/lib/browser/FunctionsContainer-JIFRD7DW.mjs +151 -0
  5. package/dist/lib/browser/FunctionsContainer-JIFRD7DW.mjs.map +7 -0
  6. package/dist/lib/browser/{FunctionsPanel-56ZKRVM5.mjs → FunctionsPanel-CRW6SJUN.mjs} +3 -3
  7. package/dist/lib/browser/{app-graph-builder-ZTAUTFI4.mjs → app-graph-builder-W7LLC6XW.mjs} +13 -12
  8. package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-ERTIGJYE.mjs → chunk-DLZNSNOV.mjs} +72 -35
  10. package/dist/lib/browser/chunk-DLZNSNOV.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-HUHVG4BU.mjs +14 -0
  12. package/dist/lib/browser/chunk-HUHVG4BU.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-FSJZXTS2.mjs → chunk-JW7XSPYW.mjs} +69 -32
  14. package/dist/lib/browser/chunk-JW7XSPYW.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-LZQFZO3B.mjs +17 -0
  16. package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-RYEK6OMM.mjs +67 -0
  18. package/dist/lib/browser/chunk-RYEK6OMM.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-LYJVTIVD.mjs → chunk-TWWFNOIR.mjs} +30 -15
  20. package/dist/lib/browser/chunk-TWWFNOIR.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-XAKZ4ANY.mjs +15 -0
  22. package/dist/lib/browser/chunk-XAKZ4ANY.mjs.map +7 -0
  23. package/dist/lib/browser/{chunk-HN7OHFCB.mjs → chunk-YBPJCY3F.mjs} +3 -3
  24. package/dist/lib/browser/chunk-YBPJCY3F.mjs.map +7 -0
  25. package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs +113 -0
  26. package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs.map +7 -0
  27. package/dist/lib/browser/hooks/index.mjs +11 -0
  28. package/dist/lib/browser/index.mjs +46 -19
  29. package/dist/lib/browser/index.mjs.map +4 -4
  30. package/dist/lib/browser/{intent-resolver-U3ZAQEFW.mjs → intent-resolver-5HR7M7T6.mjs} +15 -14
  31. package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs.map +7 -0
  32. package/dist/lib/browser/meta.json +1 -1
  33. package/dist/lib/browser/{react-surface-4DFSM7OX.mjs → react-surface-LXPASRXE.mjs} +20 -20
  34. package/dist/lib/browser/react-surface-LXPASRXE.mjs.map +7 -0
  35. package/dist/lib/browser/types/index.mjs +2 -2
  36. package/dist/lib/node-esm/{AutomationPanel-YYUMSK2W.mjs → AutomationPanel-NI6EHUWH.mjs} +4 -4
  37. package/dist/lib/node-esm/AutomationSettings-3BAIEDRA.mjs +69 -0
  38. package/dist/lib/node-esm/AutomationSettings-3BAIEDRA.mjs.map +7 -0
  39. package/dist/lib/node-esm/FunctionsContainer-MK76KBEW.mjs +152 -0
  40. package/dist/lib/node-esm/FunctionsContainer-MK76KBEW.mjs.map +7 -0
  41. package/dist/lib/node-esm/{FunctionsPanel-KGIOZSPZ.mjs → FunctionsPanel-RVVCS6VH.mjs} +3 -3
  42. package/dist/lib/node-esm/FunctionsPanel-RVVCS6VH.mjs.map +7 -0
  43. package/dist/lib/node-esm/{app-graph-builder-3FP63ZSG.mjs → app-graph-builder-SLQOO7GH.mjs} +13 -12
  44. package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs.map +7 -0
  45. package/dist/lib/node-esm/chunk-CEVIVRTY.mjs +19 -0
  46. package/dist/lib/node-esm/chunk-CEVIVRTY.mjs.map +7 -0
  47. package/dist/lib/node-esm/chunk-CPJ33QGN.mjs +16 -0
  48. package/dist/lib/node-esm/chunk-CPJ33QGN.mjs.map +7 -0
  49. package/dist/lib/node-esm/{chunk-OEZNHUL2.mjs → chunk-ECJKIUBO.mjs} +3 -3
  50. package/dist/lib/node-esm/chunk-ECJKIUBO.mjs.map +7 -0
  51. package/dist/lib/node-esm/chunk-KB7NFEYY.mjs +16 -0
  52. package/dist/lib/node-esm/chunk-KB7NFEYY.mjs.map +7 -0
  53. package/dist/lib/node-esm/chunk-LMTQG3PX.mjs +68 -0
  54. package/dist/lib/node-esm/chunk-LMTQG3PX.mjs.map +7 -0
  55. package/dist/lib/node-esm/{chunk-HIMYPGHF.mjs → chunk-O4KCL7XS.mjs} +72 -35
  56. package/dist/lib/node-esm/chunk-O4KCL7XS.mjs.map +7 -0
  57. package/dist/lib/node-esm/{chunk-ZGPUV5VS.mjs → chunk-RVK52XGK.mjs} +30 -15
  58. package/dist/lib/node-esm/chunk-RVK52XGK.mjs.map +7 -0
  59. package/dist/lib/node-esm/{chunk-AZH66CED.mjs → chunk-W76WUTZY.mjs} +69 -32
  60. package/dist/lib/node-esm/chunk-W76WUTZY.mjs.map +7 -0
  61. package/dist/lib/node-esm/compute-runtime-URROOC34.mjs +114 -0
  62. package/dist/lib/node-esm/compute-runtime-URROOC34.mjs.map +7 -0
  63. package/dist/lib/node-esm/hooks/index.mjs +12 -0
  64. package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
  65. package/dist/lib/node-esm/index.mjs +46 -19
  66. package/dist/lib/node-esm/index.mjs.map +4 -4
  67. package/dist/lib/node-esm/{intent-resolver-3QWXEBPX.mjs → intent-resolver-KDRYB5BC.mjs} +15 -14
  68. package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs.map +7 -0
  69. package/dist/lib/node-esm/meta.json +1 -1
  70. package/dist/lib/node-esm/{react-surface-3PNW7NDW.mjs → react-surface-AFCHOTCJ.mjs} +20 -20
  71. package/dist/lib/node-esm/react-surface-AFCHOTCJ.mjs.map +7 -0
  72. package/dist/lib/node-esm/types/index.mjs +2 -2
  73. package/dist/types/src/AutomationPlugin.d.ts +1 -1
  74. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  75. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  76. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  77. package/dist/types/src/capabilities/capabilities.d.ts +20 -0
  78. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/compute-runtime.d.ts +5 -0
  80. package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/index.d.ts +5 -3
  82. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  83. package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
  84. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  85. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  86. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  87. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +6 -5
  88. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  89. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +48 -4
  90. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  91. package/dist/types/src/components/AutomationSettings.d.ts +5 -0
  92. package/dist/types/src/components/AutomationSettings.d.ts.map +1 -0
  93. package/dist/types/src/components/FunctionsContainer.d.ts.map +1 -1
  94. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
  95. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +8 -0
  96. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
  97. package/dist/types/src/components/FunctionsRegistry/index.d.ts +2 -0
  98. package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
  99. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +2 -2
  100. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
  101. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
  102. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +7 -5
  103. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  104. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +49 -4
  105. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  106. package/dist/types/src/components/TriggerSettings.d.ts +6 -0
  107. package/dist/types/src/components/TriggerSettings.d.ts.map +1 -0
  108. package/dist/types/src/components/index.d.ts +2 -2
  109. package/dist/types/src/components/index.d.ts.map +1 -1
  110. package/dist/types/src/events.d.ts +4 -0
  111. package/dist/types/src/events.d.ts.map +1 -0
  112. package/dist/types/src/hooks/index.d.ts +3 -0
  113. package/dist/types/src/hooks/index.d.ts.map +1 -0
  114. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +8 -0
  115. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
  116. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +11 -0
  117. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -0
  118. package/dist/types/src/index.d.ts +3 -0
  119. package/dist/types/src/index.d.ts.map +1 -1
  120. package/dist/types/src/meta.d.ts +0 -1
  121. package/dist/types/src/meta.d.ts.map +1 -1
  122. package/dist/types/src/translations.d.ts +5 -0
  123. package/dist/types/src/translations.d.ts.map +1 -1
  124. package/dist/types/src/types/schema.d.ts +1 -1
  125. package/dist/types/src/types/schema.d.ts.map +1 -1
  126. package/dist/types/tsconfig.tsbuildinfo +1 -1
  127. package/package.json +63 -38
  128. package/src/AutomationPlugin.tsx +37 -31
  129. package/src/capabilities/app-graph-builder.ts +16 -15
  130. package/src/capabilities/capabilities.ts +41 -0
  131. package/src/capabilities/compute-runtime.ts +127 -0
  132. package/src/capabilities/index.ts +3 -0
  133. package/src/capabilities/intent-resolver.ts +11 -11
  134. package/src/capabilities/react-surface.tsx +15 -15
  135. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +15 -16
  136. package/src/components/AutomationPanel/AutomationPanel.tsx +105 -53
  137. package/src/components/AutomationSettings.tsx +30 -0
  138. package/src/components/FunctionsContainer.tsx +18 -13
  139. package/src/components/FunctionsPanel/FunctionsPanel.tsx +35 -16
  140. package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +135 -0
  141. package/src/components/FunctionsRegistry/index.ts +5 -0
  142. package/src/components/TriggerEditor/FunctionInputEditor.tsx +10 -4
  143. package/src/components/TriggerEditor/SpecSelector.tsx +23 -17
  144. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +69 -26
  145. package/src/components/TriggerEditor/TriggerEditor.tsx +45 -25
  146. package/src/components/TriggerSettings.tsx +25 -0
  147. package/src/components/index.ts +1 -1
  148. package/src/events.ts +11 -0
  149. package/src/hooks/index.ts +6 -0
  150. package/src/hooks/useComputeRuntimeCallback.ts +32 -0
  151. package/src/hooks/useTriggerRuntimeControls.ts +53 -0
  152. package/src/index.ts +3 -0
  153. package/src/meta.ts +6 -5
  154. package/src/testing/test-functions.ts +1 -1
  155. package/src/translations.ts +7 -0
  156. package/src/types/schema.ts +1 -1
  157. package/dist/lib/browser/AutomationContainer-VZNV2ZQF.mjs +0 -38
  158. package/dist/lib/browser/AutomationContainer-VZNV2ZQF.mjs.map +0 -7
  159. package/dist/lib/browser/AutomationPanel-ZWA6GOFY.mjs +0 -11
  160. package/dist/lib/browser/FunctionsContainer-IOB333TX.mjs +0 -39
  161. package/dist/lib/browser/FunctionsContainer-IOB333TX.mjs.map +0 -7
  162. package/dist/lib/browser/app-graph-builder-ZTAUTFI4.mjs.map +0 -7
  163. package/dist/lib/browser/chunk-ECSTS2UI.mjs +0 -14
  164. package/dist/lib/browser/chunk-ECSTS2UI.mjs.map +0 -7
  165. package/dist/lib/browser/chunk-ERTIGJYE.mjs.map +0 -7
  166. package/dist/lib/browser/chunk-FSJZXTS2.mjs.map +0 -7
  167. package/dist/lib/browser/chunk-GW5U2DGT.mjs +0 -15
  168. package/dist/lib/browser/chunk-GW5U2DGT.mjs.map +0 -7
  169. package/dist/lib/browser/chunk-HN7OHFCB.mjs.map +0 -7
  170. package/dist/lib/browser/chunk-LYJVTIVD.mjs.map +0 -7
  171. package/dist/lib/browser/intent-resolver-U3ZAQEFW.mjs.map +0 -7
  172. package/dist/lib/browser/react-surface-4DFSM7OX.mjs.map +0 -7
  173. package/dist/lib/node-esm/AutomationContainer-WMIH3F4V.mjs +0 -39
  174. package/dist/lib/node-esm/AutomationContainer-WMIH3F4V.mjs.map +0 -7
  175. package/dist/lib/node-esm/FunctionsContainer-DJWB6WFH.mjs +0 -40
  176. package/dist/lib/node-esm/FunctionsContainer-DJWB6WFH.mjs.map +0 -7
  177. package/dist/lib/node-esm/app-graph-builder-3FP63ZSG.mjs.map +0 -7
  178. package/dist/lib/node-esm/chunk-AZH66CED.mjs.map +0 -7
  179. package/dist/lib/node-esm/chunk-HIMYPGHF.mjs.map +0 -7
  180. package/dist/lib/node-esm/chunk-NK5N3QKD.mjs +0 -17
  181. package/dist/lib/node-esm/chunk-NK5N3QKD.mjs.map +0 -7
  182. package/dist/lib/node-esm/chunk-OEZNHUL2.mjs.map +0 -7
  183. package/dist/lib/node-esm/chunk-SGZPTJ47.mjs +0 -16
  184. package/dist/lib/node-esm/chunk-SGZPTJ47.mjs.map +0 -7
  185. package/dist/lib/node-esm/chunk-ZGPUV5VS.mjs.map +0 -7
  186. package/dist/lib/node-esm/intent-resolver-3QWXEBPX.mjs.map +0 -7
  187. package/dist/lib/node-esm/react-surface-3PNW7NDW.mjs.map +0 -7
  188. package/dist/types/src/components/AutomationContainer.d.ts +0 -5
  189. package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
  190. package/src/components/AutomationContainer.tsx +0 -30
  191. /package/dist/lib/browser/{AutomationPanel-ZWA6GOFY.mjs.map → AutomationPanel-W6K45EP4.mjs.map} +0 -0
  192. /package/dist/lib/browser/{FunctionsPanel-56ZKRVM5.mjs.map → FunctionsPanel-CRW6SJUN.mjs.map} +0 -0
  193. /package/dist/lib/{node-esm/AutomationPanel-YYUMSK2W.mjs.map → browser/hooks/index.mjs.map} +0 -0
  194. /package/dist/lib/node-esm/{FunctionsPanel-KGIOZSPZ.mjs.map → AutomationPanel-NI6EHUWH.mjs.map} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport * from './TriggerEditor';\n\nexport const AutomationPanel = lazy(() => import('./AutomationPanel'));\nexport const AutomationSettings = lazy(() => import('./AutomationSettings'));\nexport const FunctionsContainer = lazy(() => import('./FunctionsContainer'));\nexport const FunctionsPanel = lazy(() => import('./FunctionsPanel'));\n"],
5
+ "mappings": ";AAIA,SAASA,YAAY;AAId,IAAMC,kBAAkBC,KAAK,MAAM,OAAO,gCAAA,CAAA;AAC1C,IAAMC,qBAAqBD,KAAK,MAAM,OAAO,mCAAA,CAAA;AAC7C,IAAME,qBAAqBF,KAAK,MAAM,OAAO,mCAAA,CAAA;AAC7C,IAAMG,iBAAiBH,KAAK,MAAM,OAAO,+BAAA,CAAA;",
6
+ "names": ["lazy", "AutomationPanel", "lazy", "AutomationSettings", "FunctionsContainer", "FunctionsPanel"]
7
+ }
@@ -1,15 +1,17 @@
1
1
  import {
2
- AUTOMATION_PLUGIN
3
- } from "./chunk-GW5U2DGT.mjs";
2
+ meta
3
+ } from "./chunk-LZQFZO3B.mjs";
4
4
 
5
5
  // src/components/TriggerEditor/TriggerEditor.tsx
6
6
  import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
7
7
  import React3, { useCallback as useCallback3, useMemo as useMemo3 } from "react";
8
8
  import { ComputeGraph } from "@dxos/conductor";
9
9
  import { Type as Type2 } from "@dxos/echo";
10
- import { FunctionType, FunctionTriggerSchema, ScriptType } from "@dxos/functions";
11
- import { Filter, Ref as Ref2, useQuery } from "@dxos/react-client/echo";
12
- import { Form as Form2, SelectInput as SelectInput2, useRefQueryLookupHandler } from "@dxos/react-ui-form";
10
+ import { Function, Script, Trigger as Trigger2 } from "@dxos/functions";
11
+ import { Filter as Filter2, Ref as Ref2, useQuery } from "@dxos/react-client/echo";
12
+ import { Input } from "@dxos/react-ui";
13
+ import { QueryForm } from "@dxos/react-ui-components";
14
+ import { Form as Form2, InputHeader, SelectInput as SelectInput2, useRefQueryLookupHandler } from "@dxos/react-ui-form";
13
15
 
14
16
  // src/components/TriggerEditor/FunctionInputEditor.tsx
15
17
  import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
@@ -37,7 +39,12 @@ var FunctionInputEditor = ({ functions, getValue, onValueChange, onQueryRefOptio
37
39
  useOnTransition(
38
40
  // Clear function parameter input when the function changes.
39
41
  selectedFunctionValue,
40
- (prevValue) => prevValue !== void 0 && prevValue !== selectedFunctionValue,
42
+ (prevValue) => {
43
+ if (!Ref.isRef(prevValue) || !Ref.isRef(selectedFunctionValue)) {
44
+ return false;
45
+ }
46
+ return prevValue.dxn.toString() !== selectedFunctionValue.dxn.toString();
47
+ },
41
48
  (currValue) => currValue !== void 0,
42
49
  () => onValueChange("object", {})
43
50
  );
@@ -76,41 +83,44 @@ var FunctionInputEditor = ({ functions, getValue, onValueChange, onQueryRefOptio
76
83
  // src/components/TriggerEditor/SpecSelector.tsx
77
84
  import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
78
85
  import React2, { useCallback as useCallback2, useMemo as useMemo2 } from "react";
79
- import { TriggerKind } from "@dxos/functions";
86
+ import { Filter, Query } from "@dxos/echo";
87
+ import { Trigger } from "@dxos/functions";
80
88
  import { useTranslation } from "@dxos/react-ui";
81
89
  import { SelectInput, useInputProps } from "@dxos/react-ui-form";
82
90
  var SpecSelector = (props) => {
83
91
  var _effect = _useSignals2();
84
92
  try {
85
- const { t } = useTranslation(AUTOMATION_PLUGIN);
93
+ const { t } = useTranslation(meta.id);
86
94
  const specProps = useInputProps([
87
95
  "spec"
88
96
  ]);
89
97
  const handleTypeChange = useCallback2((_type, value) => {
90
98
  const getDefaultTriggerSpec = (kind) => {
91
99
  switch (kind) {
92
- case TriggerKind.Timer:
100
+ case "timer":
93
101
  return {
94
- kind: TriggerKind.Timer,
102
+ kind: "timer",
95
103
  cron: ""
96
104
  };
97
- case TriggerKind.Subscription:
105
+ case "subscription":
98
106
  return {
99
- kind: TriggerKind.Subscription,
100
- filter: {}
107
+ kind: "subscription",
108
+ query: {
109
+ ast: Query.select(Filter.nothing()).ast
110
+ }
101
111
  };
102
- case TriggerKind.Queue:
112
+ case "queue":
103
113
  return {
104
- kind: TriggerKind.Queue,
105
- queue: ""
114
+ kind: "queue",
115
+ queue: "dxn:"
106
116
  };
107
- case TriggerKind.Email:
117
+ case "email":
108
118
  return {
109
- kind: TriggerKind.Email
119
+ kind: "email"
110
120
  };
111
- case TriggerKind.Webhook:
121
+ case "webhook":
112
122
  return {
113
- kind: TriggerKind.Webhook
123
+ kind: "webhook"
114
124
  };
115
125
  default:
116
126
  return void 0;
@@ -124,7 +134,7 @@ var SpecSelector = (props) => {
124
134
  }, [
125
135
  specProps
126
136
  ]);
127
- const options = useMemo2(() => Object.values(TriggerKind).map((kind) => ({
137
+ const options = useMemo2(() => Trigger.Kinds.map((kind) => ({
128
138
  value: kind,
129
139
  label: t(`trigger type ${kind}`)
130
140
  })), [
@@ -141,20 +151,26 @@ var SpecSelector = (props) => {
141
151
  };
142
152
 
143
153
  // src/components/TriggerEditor/TriggerEditor.tsx
144
- var TriggerEditor = ({ space, trigger, onSave, onCancel }) => {
154
+ var TriggerEditor = ({ space, trigger, readonlySpec, types, tags, onSave, onCancel }) => {
145
155
  var _effect = _useSignals3();
146
156
  try {
147
- const handleSave = (values) => {
157
+ const handleSave = ({ id: _, ...values }) => {
148
158
  onSave?.(values);
149
159
  };
150
160
  const handleRefQueryLookup = useRefQueryLookupHandler({
151
161
  space
152
162
  });
153
- const Custom = useCustomInputs(space, handleRefQueryLookup);
163
+ const Custom = useCustomInputs({
164
+ space,
165
+ readonlySpec,
166
+ types,
167
+ tags,
168
+ onQueryRefOptions: handleRefQueryLookup
169
+ });
154
170
  return /* @__PURE__ */ React3.createElement(Form2, {
155
171
  outerSpacing: false,
156
172
  Custom,
157
- schema: FunctionTriggerSchema,
173
+ schema: Trigger2.Trigger,
158
174
  values: trigger,
159
175
  onSave: handleSave,
160
176
  onCancel,
@@ -164,10 +180,10 @@ var TriggerEditor = ({ space, trigger, onSave, onCancel }) => {
164
180
  _effect.f();
165
181
  }
166
182
  };
167
- var useCustomInputs = (space, onQueryRefOptions) => {
168
- const functions = useQuery(space, Filter.type(FunctionType));
169
- const workflows = useQuery(space, Filter.type(ComputeGraph));
170
- const scripts = useQuery(space, Filter.type(ScriptType));
183
+ var useCustomInputs = ({ space, readonlySpec, types, tags, onQueryRefOptions }) => {
184
+ const functions = useQuery(space, Filter2.type(Function.Function));
185
+ const workflows = useQuery(space, Filter2.type(ComputeGraph));
186
+ const scripts = useQuery(space, Filter2.type(Script.Script));
171
187
  return useMemo3(() => ({
172
188
  // Function selector.
173
189
  ["function"]: (props) => {
@@ -197,7 +213,27 @@ var useCustomInputs = (space, onQueryRefOptions) => {
197
213
  });
198
214
  },
199
215
  // Spec selector.
200
- ["spec.kind"]: SpecSelector,
216
+ ["spec.kind"]: (props) => /* @__PURE__ */ React3.createElement(SpecSelector, {
217
+ ...props,
218
+ readonly: readonlySpec ? "disabled-input" : false
219
+ }),
220
+ // TODO(wittjosiah): Copied from ViewEditor.
221
+ // Query input editor.
222
+ ["spec.query"]: (props) => {
223
+ const handleChange = useCallback3((query) => props.onValueChange("object", {
224
+ ast: query.ast
225
+ }), [
226
+ props.onValueChange
227
+ ]);
228
+ return /* @__PURE__ */ React3.createElement(Input.Root, null, /* @__PURE__ */ React3.createElement(InputHeader, {
229
+ label: props.label
230
+ }), /* @__PURE__ */ React3.createElement(QueryForm, {
231
+ initialQuery: props.getValue().ast,
232
+ types,
233
+ tags,
234
+ onChange: handleChange
235
+ }));
236
+ },
201
237
  // Function input editor.
202
238
  ["input"]: (props) => /* @__PURE__ */ React3.createElement(FunctionInputEditor, {
203
239
  ...props,
@@ -207,7 +243,8 @@ var useCustomInputs = (space, onQueryRefOptions) => {
207
243
  }), [
208
244
  workflows,
209
245
  scripts,
210
- functions
246
+ functions,
247
+ readonlySpec
211
248
  ]);
212
249
  };
213
250
  var getWorkflowOptions = (graphs) => {
@@ -227,4 +264,4 @@ var getFunctionOptions = (scripts, functions) => {
227
264
  export {
228
265
  TriggerEditor
229
266
  };
230
- //# sourceMappingURL=chunk-FSJZXTS2.mjs.map
267
+ //# sourceMappingURL=chunk-JW7XSPYW.mjs.map
@@ -0,0 +1,7 @@
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 { type Query, Type } from '@dxos/echo';\nimport { Function, Script, Trigger } from '@dxos/functions';\nimport { Filter, Ref, type Space, useQuery } from '@dxos/react-client/echo';\nimport { Input } from '@dxos/react-ui';\nimport { QueryForm, type QueryFormProps } from '@dxos/react-ui-components';\nimport { type CustomInputMap, Form, InputHeader, SelectInput, useRefQueryLookupHandler } from '@dxos/react-ui-form';\n\nimport { FunctionInputEditor, type FunctionInputEditorProps } from './FunctionInputEditor';\nimport { SpecSelector } from './SpecSelector';\n\nexport type TriggerEditorProps = {\n space: Space;\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 onSave?: (trigger: Omit<Trigger.Trigger, 'id'>) => void;\n onCancel?: () => void;\n} & Pick<QueryFormProps, 'types' | 'tags'>;\n\nexport const TriggerEditor = ({ space, trigger, readonlySpec, types, tags, onSave, onCancel }: TriggerEditorProps) => {\n const handleSave = ({ id: _, ...values }: Trigger.Trigger) => {\n onSave?.(values);\n };\n\n const handleRefQueryLookup = useRefQueryLookupHandler({ space });\n const Custom = useCustomInputs({ space, readonlySpec, types, tags, onQueryRefOptions: handleRefQueryLookup });\n\n return (\n <Form\n outerSpacing={false}\n Custom={Custom}\n schema={Trigger.Trigger}\n values={trigger}\n onSave={handleSave}\n onCancel={onCancel}\n onQueryRefOptions={handleRefQueryLookup}\n />\n );\n};\n\ntype UseCustomInputsProps = {\n space: Space;\n readonlySpec?: boolean;\n onQueryRefOptions: FunctionInputEditorProps['onQueryRefOptions'];\n} & Pick<QueryFormProps, 'types' | 'tags'>;\n\nconst useCustomInputs = ({ space, readonlySpec, types, tags, onQueryRefOptions }: UseCustomInputsProps) => {\n const functions = useQuery(space, Filter.type(Function.Function));\n const workflows = useQuery(space, Filter.type(ComputeGraph));\n const scripts = useQuery(space, Filter.type(Script.Script));\n\n return useMemo(\n (): CustomInputMap => ({\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 = Type.DXN.parse(dxnString);\n if (dxn) {\n const ref = Ref.fromDXN(dxn);\n props.onValueChange('object', ref);\n }\n },\n [props.onValueChange],\n );\n\n return (\n <SelectInput\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' as const]: (props) => <SpecSelector {...props} readonly={readonlySpec ? 'disabled-input' : false} />,\n\n // TODO(wittjosiah): Copied from ViewEditor.\n // Query input editor.\n ['spec.query' as const]: (props) => {\n const handleChange = useCallback(\n (query: Query.Any) => props.onValueChange('object', { ast: query.ast }),\n [props.onValueChange],\n );\n\n return (\n <Input.Root>\n <InputHeader label={props.label} />\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' as const]: (props) => (\n <FunctionInputEditor {...props} functions={functions} onQueryRefOptions={onQueryRefOptions} />\n ),\n }),\n [workflows, scripts, functions, 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", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { type JsonPath } from '@dxos/echo/internal';\nimport { type Function } from '@dxos/functions';\nimport { useOnTransition } from '@dxos/react-ui';\nimport { Form, type FormInputStateProps, type QueryRefOptions, useFormValues } from '@dxos/react-ui-form';\n\nexport type FunctionInputEditorProps = {\n functions: Function.Function[];\n onQueryRefOptions: QueryRefOptions;\n} & FormInputStateProps;\n\n/**\n * Editor component for function input parameters.\n */\nexport const FunctionInputEditor = ({\n functions,\n getValue,\n onValueChange,\n onQueryRefOptions,\n}: FunctionInputEditorProps) => {\n const selectedFunctionValue = useFormValues(['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('object', {}),\n );\n\n const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);\n const effectSchema = useMemo(() => (inputSchema ? Type.toEffectSchema(inputSchema) : undefined), [inputSchema]);\n const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;\n\n const values = useMemo(() => getValue() ?? {}, [getValue]);\n\n const handleValuesChanged = useCallback(\n (values: any) => {\n onValueChange('object', values);\n },\n [onValueChange],\n );\n\n if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {\n return null;\n }\n\n return (\n <>\n <h3 className='text-md'>Function parameters</h3>\n {/* TODO(ZaymonFC): Try using <FormFields /> internal component for this nesting.\n This would allow errors to flow up to the root context. */}\n <Form\n schema={effectSchema}\n values={values}\n onValuesChanged={handleValuesChanged}\n onQueryRefOptions={onQueryRefOptions}\n outerSpacing={false}\n />\n </>\n );\n};\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 InputProps, SelectInput, useInputProps } from '@dxos/react-ui-form';\n\nimport { meta } from '../../meta';\n\nexport type SpecSelectorProps = InputProps;\n\nexport const SpecSelector = (props: SpecSelectorProps) => {\n const { t } = useTranslation(meta.id);\n const specProps = useInputProps(['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:' };\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('object', defaultSpec);\n },\n [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 <SelectInput {...props} options={options} onValueChange={handleTypeChange} />;\n};\n"],
5
+ "mappings": ";;;;;;AAIA,OAAOA,UAASC,eAAAA,cAAaC,WAAAA,gBAAe;AAE5C,SAASC,oBAAoB;AAC7B,SAAqBC,QAAAA,aAAY;AACjC,SAASC,UAAUC,QAAQC,WAAAA,gBAAe;AAC1C,SAASC,UAAAA,SAAQC,OAAAA,MAAiBC,gBAAgB;AAClD,SAASC,aAAa;AACtB,SAASC,iBAAsC;AAC/C,SAA8BC,QAAAA,OAAMC,aAAaC,eAAAA,cAAaC,gCAAgC;;;;ACR9F,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAASC,KAAKC,YAAY;AAG1B,SAASC,uBAAuB;AAChC,SAASC,MAAsDC,qBAAqB;AAU7E,IAAMC,sBAAsB,CAAC,EAClCC,WACAC,UACAC,eACAC,kBAAiB,MACQ;;;AACzB,UAAMC,wBAAwBC,cAAc;MAAC;KAAuB;AACpE,UAAMC,qBAAqBC,QAAQ,MAAA;AACjC,UAAIC,IAAIC,MAAML,qBAAAA,GAAwB;AACpC,eAAOA,sBAAsBM,IAAIC,SAAQ,EAAGC,MAAM,aAAA,EAAeC,GAAG,CA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GAAGvB;MAAOwB,UAAUrD,eAAe,mBAAmB;;;;IAIxG,CAAC,YAAA,GAAwB,CAAC6B,UAAAA;AACxB,YAAMyB,eAAevB,aACnB,CAACwB,UAAqB1B,MAAMiB,cAAc,UAAU;QAAEU,KAAKD,MAAMC;MAAI,CAAA,GACrE;QAAC3B,MAAMiB;OAAc;AAGvB,aACE,gBAAAhC,OAAA,cAAC2C,MAAMC,MAAI,MACT,gBAAA5C,OAAA,cAAC6C,aAAAA;QAAYC,OAAO/B,MAAM+B;UAC1B,gBAAA9C,OAAA,cAAC+C,WAAAA;QAAUC,cAAejC,MAAMC,SAAQ,EAAW0B;QAAKvD;QAAcC;QAAY6D,UAAUT;;IAGlG;;IAGA,CAAC,OAAA,GAAmB,CAACzB,UACnB,gBAAAf,OAAA,cAACkD,qBAAAA;MAAqB,GAAGnC;MAAOV;MAAsBN;;EAE1D,IACA;IAACW;IAAWE;IAASP;IAAWnB;GAAa;AAEjD;AAEA,IAAMiD,qBAAqB,CAACgB,WAAAA;AAC1B,SAAOA,OAAOC,IAAI,CAACC,WAAW;IAAEP,OAAO,WAAWO,MAAM7D,EAAE;IAAI8D,OAAO,cAAcD,MAAM7D,EAAE;EAAG,EAAA;AAChG;AAEA,IAAM6C,qBAAqB,CAACzB,SAA0BP,cAAAA;AACpD,QAAMkD,WAAW,CAACC,OAA0B5C,QAAQ6C,KAAK,CAACC,MAAMF,GAAGG,QAAQC,QAAQpE,OAAOkE,EAAElE,EAAE,GAAGqE,QAAQL,GAAGK;AAC5G,SAAOxD,UAAU+C,IAAI,CAACI,QAAQ;IAAEV,OAAOS,SAASC,EAAAA;IAAKF,OAAO,cAAcE,GAAGhE,EAAE;EAAG,EAAA;AACpF;",
6
+ "names": ["React", "useCallback", "useMemo", "ComputeGraph", "Type", "Function", "Script", "Trigger", "Filter", "Ref", "useQuery", "Input", "QueryForm", "Form", "InputHeader", "SelectInput", "useRefQueryLookupHandler", "React", "useCallback", "useMemo", "Ref", "Type", "useOnTransition", "Form", "useFormValues", "FunctionInputEditor", "functions", "getValue", "onValueChange", "onQueryRefOptions", "selectedFunctionValue", "useFormValues", "selectedFunctionId", "useMemo", "Ref", "isRef", "dxn", "toString", "split", "at", "selectedFunction", "find", "fn", "id", "useOnTransition", "prevValue", "currValue", "undefined", "inputSchema", "effectSchema", "Type", "toEffectSchema", "propertyCount", "properties", "Object", "keys", "length", "values", "handleValuesChanged", "useCallback", "h3", "className", "Form", "schema", "onValuesChanged", "outerSpacing", "React", "useCallback", "useMemo", "Filter", "Query", "Trigger", "useTranslation", "SelectInput", "useInputProps", "SpecSelector", "props", "t", "useTranslation", "meta", "id", "specProps", "useInputProps", "handleTypeChange", "useCallback", "_type", "value", "getDefaultTriggerSpec", "kind", "cron", "query", "ast", "Query", "select", "Filter", "nothing", "queue", "undefined", "defaultSpec", "onValueChange", "options", "useMemo", "Trigger", "Kinds", "map", "label", "React", "SelectInput", "TriggerEditor", "space", "trigger", "readonlySpec", "types", "tags", "onSave", "onCancel", "handleSave", "id", "_", "values", "handleRefQueryLookup", "useRefQueryLookupHandler", "Custom", "useCustomInputs", "onQueryRefOptions", "React", "Form", "outerSpacing", "schema", "Trigger", "functions", "useQuery", "Filter", "type", "Function", "workflows", "ComputeGraph", "scripts", "Script", "useMemo", "props", "getValue", "useCallback", "formValue", "Ref", "isRef", "dxn", "toString", "undefined", "handleOnValueChange", "_type", "dxnString", "Type", "DXN", "parse", "ref", "fromDXN", "onValueChange", "SelectInput", "options", "getWorkflowOptions", "concat", "getFunctionOptions", "SpecSelector", "readonly", "handleChange", "query", "ast", "Input", "Root", "InputHeader", "label", "QueryForm", "initialQuery", "onChange", "FunctionInputEditor", "graphs", "map", "graph", "value", "getLabel", "fn", "find", "s", "source", "target", "name"]
7
+ }
@@ -0,0 +1,17 @@
1
+ // src/meta.ts
2
+ import { trim } from "@dxos/util";
3
+ var meta = {
4
+ id: "dxos.org/plugin/automation",
5
+ name: "Automation",
6
+ description: trim`
7
+ Workflow automation engine that triggers custom actions based on object events and conditions.
8
+ Create automated pipelines that respond to changes and streamline repetitive tasks.
9
+ `,
10
+ icon: "ph--robot--regular",
11
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation"
12
+ };
13
+
14
+ export {
15
+ meta
16
+ };
17
+ //# sourceMappingURL=chunk-LZQFZO3B.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/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,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,QAAQ;AACV;",
6
+ "names": ["trim", "meta", "id", "name", "description", "trim", "icon", "source"]
7
+ }
@@ -0,0 +1,67 @@
1
+ import {
2
+ AutomationCapabilities
3
+ } from "./chunk-XAKZ4ANY.mjs";
4
+
5
+ // src/hooks/useComputeRuntimeCallback.ts
6
+ import { useCallback } from "react";
7
+ import { useCapability } from "@dxos/app-framework/react";
8
+
9
+ // src/capabilities/index.ts
10
+ import { lazy } from "@dxos/app-framework";
11
+ var AppGraphBuilder = lazy(() => import("./app-graph-builder-W7LLC6XW.mjs"));
12
+ var ComputeRuntime = lazy(() => import("./compute-runtime-EIQTHJFZ.mjs"));
13
+ var IntentResolver = lazy(() => import("./intent-resolver-5HR7M7T6.mjs"));
14
+ var ReactSurface = lazy(() => import("./react-surface-LXPASRXE.mjs"));
15
+
16
+ // src/hooks/useComputeRuntimeCallback.ts
17
+ var useComputeRuntimeCallback = (space, fn, deps) => {
18
+ const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
19
+ const runtime = space !== void 0 ? computeRuntime.getRuntime(space.id) : void 0;
20
+ return useCallback(() => {
21
+ if (!runtime) {
22
+ throw new TypeError("Space not provided to useComputeRuntimeCallback");
23
+ }
24
+ return runtime.runPromise(fn());
25
+ }, [
26
+ runtime,
27
+ ...deps ?? []
28
+ ]);
29
+ };
30
+
31
+ // src/hooks/useTriggerRuntimeControls.ts
32
+ import * as Effect from "effect/Effect";
33
+ import { Filter } from "@dxos/echo";
34
+ import { Trigger } from "@dxos/functions";
35
+ import { TriggerDispatcher } from "@dxos/functions-runtime";
36
+ import { useQuery } from "@dxos/react-client/echo";
37
+ import { useAsyncState } from "@dxos/react-ui";
38
+ var useTriggerRuntimeControls = (space) => {
39
+ const triggers = useQuery(space, Filter.type(Trigger.Trigger));
40
+ const [isRunningState, setIsRunningState] = useAsyncState(useComputeRuntimeCallback(space, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))));
41
+ const start = useComputeRuntimeCallback(space, Effect.fnUntraced(function* () {
42
+ const dispatcher = yield* TriggerDispatcher;
43
+ yield* dispatcher.start();
44
+ setIsRunningState(true);
45
+ }));
46
+ const stop = useComputeRuntimeCallback(space, Effect.fnUntraced(function* () {
47
+ const dispatcher = yield* TriggerDispatcher;
48
+ yield* dispatcher.stop();
49
+ setIsRunningState(false);
50
+ }));
51
+ return {
52
+ triggers,
53
+ isRunning: isRunningState ?? false,
54
+ start: () => void start(),
55
+ stop: () => void stop()
56
+ };
57
+ };
58
+
59
+ export {
60
+ useComputeRuntimeCallback,
61
+ useTriggerRuntimeControls,
62
+ AppGraphBuilder,
63
+ ComputeRuntime,
64
+ IntentResolver,
65
+ ReactSurface
66
+ };
67
+ //# sourceMappingURL=chunk-RYEK6OMM.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/hooks/useComputeRuntimeCallback.ts", "../../../src/capabilities/index.ts", "../../../src/hooks/useTriggerRuntimeControls.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Effect from 'effect/Effect';\nimport { useCallback } from 'react';\n\nimport { useCapability } from '@dxos/app-framework/react';\nimport type { Space } from '@dxos/react-client/echo';\n\nimport { AutomationCapabilities } from '../capabilities';\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 space: Space | undefined,\n fn: () => Effect.Effect<T, any, AutomationCapabilities.ComputeServices>,\n deps?: React.DependencyList,\n): (() => Promise<T>) => {\n const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);\n const runtime = space !== undefined ? computeRuntime.getRuntime(space.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// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const AppGraphBuilder = lazy(() => import('./app-graph-builder'));\nexport const ComputeRuntime = lazy(() => import('./compute-runtime'));\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Filter } from '@dxos/echo';\nimport { Trigger } from '@dxos/functions';\nimport { TriggerDispatcher } from '@dxos/functions-runtime';\nimport { type Space, useQuery } from '@dxos/react-client/echo';\nimport { useAsyncState } from '@dxos/react-ui';\n\nimport { useComputeRuntimeCallback } from './useComputeRuntimeCallback';\n\ninterface TriggerRuntimeControls {\n triggers: Trigger.Trigger[];\n isRunning: boolean;\n start: () => void;\n stop: () => void;\n}\n\nexport const useTriggerRuntimeControls = (space: Space | undefined): TriggerRuntimeControls => {\n const triggers = useQuery(space, Filter.type(Trigger.Trigger));\n\n const [isRunningState, setIsRunningState] = useAsyncState(\n useComputeRuntimeCallback(space, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))),\n );\n\n const start = useComputeRuntimeCallback(\n space,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.start();\n setIsRunningState(true);\n }),\n );\n\n const stop = useComputeRuntimeCallback(\n space,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.stop();\n setIsRunningState(false);\n }),\n );\n\n return {\n triggers,\n isRunning: isRunningState ?? false,\n start: () => void start(),\n stop: () => void stop(),\n };\n};\n"],
5
+ "mappings": ";;;;;AAKA,SAASA,mBAAmB;AAE5B,SAASC,qBAAqB;;;ACH9B,SAASC,YAAY;AAEd,IAAMC,kBAAkBC,KAAK,MAAM,OAAO,kCAAA,CAAA;AAC1C,IAAMC,iBAAiBD,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAME,iBAAiBF,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAMG,eAAeH,KAAK,MAAM,OAAO,8BAAA,CAAA;;;ADOvC,IAAMI,4BAA4B,CACvCC,OACAC,IACAC,SAAAA;AAEA,QAAMC,iBAAiBC,cAAcC,uBAAuBC,cAAc;AAC1E,QAAMC,UAAUP,UAAUQ,SAAYL,eAAeM,WAAWT,MAAMU,EAAE,IAAIF;AAE5E,SAAOG,YAAY,MAAA;AACjB,QAAI,CAACJ,SAAS;AACZ,YAAM,IAAIK,UAAU,iDAAA;IACtB;AAEA,WAAOL,QAAQM,WAAWZ,GAAAA,CAAAA;EAC5B,GAAG;IAACM;OAAaL,QAAQ,CAAA;GAAI;AAC/B;;;AE3BA,YAAYY,YAAY;AAExB,SAASC,cAAc;AACvB,SAASC,eAAe;AACxB,SAASC,yBAAyB;AAClC,SAAqBC,gBAAgB;AACrC,SAASC,qBAAqB;AAWvB,IAAMC,4BAA4B,CAACC,UAAAA;AACxC,QAAMC,WAAWC,SAASF,OAAOG,OAAOC,KAAKC,QAAQA,OAAO,CAAA;AAE5D,QAAM,CAACC,gBAAgBC,iBAAAA,IAAqBC,cAC1CC,0BAA0BT,OAAO,MAAMU,kBAAkBC,KAAYC,WAAI,CAACC,MAAMA,EAAEC,OAAO,CAAA,CAAA,CAAA;AAG3F,QAAMC,QAAQN,0BACZT,OACOgB,kBAAW,aAAA;AAChB,UAAMC,aAAa,OAAOP;AAC1B,WAAOO,WAAWF,MAAK;AACvBR,sBAAkB,IAAA;EACpB,CAAA,CAAA;AAGF,QAAMW,OAAOT,0BACXT,OACOgB,kBAAW,aAAA;AAChB,UAAMC,aAAa,OAAOP;AAC1B,WAAOO,WAAWC,KAAI;AACtBX,sBAAkB,KAAA;EACpB,CAAA,CAAA;AAGF,SAAO;IACLN;IACAkB,WAAWb,kBAAkB;IAC7BS,OAAO,MAAM,KAAKA,MAAAA;IAClBG,MAAM,MAAM,KAAKA,KAAAA;EACnB;AACF;",
6
+ "names": ["useCallback", "useCapability", "lazy", "AppGraphBuilder", "lazy", "ComputeRuntime", "IntentResolver", "ReactSurface", "useComputeRuntimeCallback", "space", "fn", "deps", "computeRuntime", "useCapability", "AutomationCapabilities", "ComputeRuntime", "runtime", "undefined", "getRuntime", "id", "useCallback", "TypeError", "runPromise", "Effect", "Filter", "Trigger", "TriggerDispatcher", "useQuery", "useAsyncState", "useTriggerRuntimeControls", "space", "triggers", "useQuery", "Filter", "type", "Trigger", "isRunningState", "setIsRunningState", "useAsyncState", "useComputeRuntimeCallback", "TriggerDispatcher", "pipe", "map", "t", "running", "start", "fnUntraced", "dispatcher", "stop", "isRunning"]
7
+ }
@@ -1,15 +1,18 @@
1
1
  import {
2
- AUTOMATION_PLUGIN
3
- } from "./chunk-GW5U2DGT.mjs";
2
+ meta
3
+ } from "./chunk-LZQFZO3B.mjs";
4
4
 
5
5
  // src/components/FunctionsPanel/FunctionsPanel.tsx
6
6
  import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
7
- import { Schema } from "effect";
7
+ import * as Schema from "effect/Schema";
8
8
  import React, { useCallback, useMemo } from "react";
9
- import { createIntent, LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
10
- import { FunctionType, ScriptType } from "@dxos/functions";
11
- import { Filter, fullyQualifiedId, useQuery } from "@dxos/react-client/echo";
12
- import { Button, useTranslation } from "@dxos/react-ui";
9
+ import { LayoutAction, createIntent } from "@dxos/app-framework";
10
+ import { useIntentDispatcher } from "@dxos/app-framework/react";
11
+ import { Obj } from "@dxos/echo";
12
+ import { Function, Script } from "@dxos/functions";
13
+ import { SpaceAction } from "@dxos/plugin-space/types";
14
+ import { Filter, useQuery } from "@dxos/react-client/echo";
15
+ import { Button, IconButton, useTranslation } from "@dxos/react-ui";
13
16
  import { controlItemClasses } from "@dxos/react-ui-form";
14
17
  import { List } from "@dxos/react-ui-list";
15
18
  import { ghostHover, mx } from "@dxos/react-ui-theme";
@@ -17,9 +20,9 @@ var grid = "grid grid-cols-[1fr_auto] min-bs-[2.5rem]";
17
20
  var FunctionsPanel = ({ space }) => {
18
21
  var _effect = _useSignals();
19
22
  try {
20
- const { t } = useTranslation(AUTOMATION_PLUGIN);
21
- const functions = useQuery(space, Filter.type(FunctionType));
22
- const scripts = useQuery(space, Filter.type(ScriptType));
23
+ const { t } = useTranslation(meta.id);
24
+ const functions = useQuery(space, Filter.type(Function.Function));
25
+ const scripts = useQuery(space, Filter.type(Script.Script));
23
26
  const { dispatchPromise: dispatch } = useIntentDispatcher();
24
27
  const functionToScriptMap = useMemo(() => functions.reduce((map, func) => {
25
28
  const scriptId = func.source?.target?.id;
@@ -46,7 +49,7 @@ var FunctionsPanel = ({ space }) => {
46
49
  void dispatch(createIntent(LayoutAction.Open, {
47
50
  part: "main",
48
51
  subject: [
49
- fullyQualifiedId(script)
52
+ Obj.getDXN(script).toString()
50
53
  ]
51
54
  }));
52
55
  }
@@ -54,16 +57,23 @@ var FunctionsPanel = ({ space }) => {
54
57
  functionToScriptMap,
55
58
  dispatch
56
59
  ]);
60
+ const handleDelete = useCallback((func) => dispatch(createIntent(SpaceAction.RemoveObjects, {
61
+ objects: [
62
+ func
63
+ ]
64
+ })), [
65
+ dispatch
66
+ ]);
57
67
  return /* @__PURE__ */ React.createElement("div", {
58
68
  role: "none",
59
69
  className: mx(controlItemClasses)
60
70
  }, functions.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
61
71
  items: functions,
62
- isItem: Schema.is(FunctionType),
72
+ isItem: Schema.is(Function.Function),
63
73
  getId: (func) => func.id
64
74
  }, ({ items }) => /* @__PURE__ */ React.createElement("div", {
65
75
  role: "list",
66
- className: "flex flex-col w-full"
76
+ className: "flex flex-col is-full"
67
77
  }, items?.map((func) => /* @__PURE__ */ React.createElement(List.Item, {
68
78
  key: func.id,
69
79
  item: func,
@@ -76,7 +86,12 @@ var FunctionsPanel = ({ space }) => {
76
86
  className: "text-xs text-description truncate"
77
87
  }, getScriptName(func))), functionToScriptMap[func.id] && /* @__PURE__ */ React.createElement(Button, {
78
88
  onClick: () => handleGoToScript(func)
79
- }, t("go to function source button label")))))), functions.length === 0 && /* @__PURE__ */ React.createElement("div", {
89
+ }, t("go to function source button label")), /* @__PURE__ */ React.createElement(IconButton, {
90
+ iconOnly: true,
91
+ icon: "ph--trash--regular",
92
+ label: t("delete function button label"),
93
+ onClick: () => handleDelete(func)
94
+ }))))), functions.length === 0 && /* @__PURE__ */ React.createElement("div", {
80
95
  className: "text-center plb-4 text-gray-500"
81
96
  }, t("no functions found")));
82
97
  } finally {
@@ -91,4 +106,4 @@ export {
91
106
  FunctionsPanel,
92
107
  FunctionsPanel_default
93
108
  };
94
- //# sourceMappingURL=chunk-LYJVTIVD.mjs.map
109
+ //# sourceMappingURL=chunk-TWWFNOIR.mjs.map
@@ -0,0 +1,7 @@
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 { LayoutAction, createIntent } from '@dxos/app-framework';\nimport { useIntentDispatcher } from '@dxos/app-framework/react';\nimport { Obj } from '@dxos/echo';\nimport { Function, Script } from '@dxos/functions';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter, type Space, useQuery } from '@dxos/react-client/echo';\nimport { Button, IconButton, useTranslation } from '@dxos/react-ui';\nimport { controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { meta } from '../../meta';\n\nconst grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';\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, Filter.type(Function.Function));\n const scripts = useQuery(space, Filter.type(Script.Script));\n const { dispatchPromise: dispatch } = useIntentDispatcher();\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 dispatch(\n createIntent(LayoutAction.Open, {\n part: 'main',\n subject: [Obj.getDXN(script).toString()],\n }),\n );\n }\n },\n [functionToScriptMap, dispatch],\n );\n\n const handleDelete = useCallback(\n (func: Function.Function) => dispatch(createIntent(SpaceAction.RemoveObjects, { objects: [func] })),\n [dispatch],\n );\n\n return (\n <div role='none' className={mx(controlItemClasses)}>\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 is-full'>\n {items?.map((func) => (\n <List.Item<Function.Function>\n key={func.id}\n item={func}\n classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}\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 plb-4 text-gray-500'>{t('no functions found')}</div>}\n </div>\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,cAAcC,oBAAoB;AAC3C,SAASC,2BAA2B;AACpC,SAASC,WAAW;AACpB,SAASC,UAAUC,cAAc;AACjC,SAASC,mBAAmB;AAC5B,SAASC,QAAoBC,gBAAgB;AAC7C,SAASC,QAAQC,YAAYC,sBAAsB;AACnD,SAASC,0BAA0B;AACnC,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAI/B,IAAMC,OAAO;AAMN,IAAMC,iBAAiB,CAAC,EAAEC,MAAK,MAAuB;;;AAC3D,UAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,UAAMC,YAAYC,SAASN,OAAOO,OAAOC,KAAKC,SAASA,QAAQ,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,MAAK,MACP,sBAAA,cAACR,OAAAA;MAAIC,MAAK;MAAOC,WAAU;OACxBM,OAAOhC,IAAI,CAACC,SACX,sBAAA,cAAC6B,KAAKM,MAAI;MACRC,KAAKpC,KAAKf;MACVoD,MAAMrC;MACNsC,YAAYZ,GAAG/C,MAAM4D,YAAY,gBAAgB,SAAS,eAAA;OAE1D,sBAAA,cAAChB,OAAAA;MAAIE,WAAU;OACb,sBAAA,cAACI,KAAKW,WAAS;MAACF,YAAW;OAAYtC,KAAKS,IAAI,GAC/CF,cAAcP,IAAAA,KACb,sBAAA,cAACuB,OAAAA;MAAIE,WAAU;OAAqClB,cAAcP,IAAAA,CAAAA,CAAAA,GAGrEJ,oBAAoBI,KAAKf,EAAE,KAC1B,sBAAA,cAACwD,QAAAA;MAAOC,SAAS,MAAMhC,iBAAiBV,IAAAA;OAAQlB,EAAE,oCAAA,CAAA,GAEpD,sBAAA,cAAC6D,YAAAA;MACCC,UAAAA;MACAC,MAAK;MACLC,OAAOhE,EAAE,8BAAA;MACT4D,SAAS,MAAMvB,aAAanB,IAAAA;YASzCd,UAAU0C,WAAW,KAAK,sBAAA,cAACL,OAAAA;MAAIE,WAAU;OAAmC3C,EAAE,oBAAA,CAAA,CAAA;;;;AAGrF;;;AC5GA,IAAA,yBAAeiE;",
6
+ "names": ["Schema", "React", "useCallback", "useMemo", "LayoutAction", "createIntent", "useIntentDispatcher", "Obj", "Function", "Script", "SpaceAction", "Filter", "useQuery", "Button", "IconButton", "useTranslation", "controlItemClasses", "List", "ghostHover", "mx", "grid", "FunctionsPanel", "space", "t", "useTranslation", "meta", "id", "functions", "useQuery", "Filter", "type", "Function", "scripts", "Script", "dispatchPromise", "dispatch", "useIntentDispatcher", "functionToScriptMap", "useMemo", "reduce", "map", "func", "scriptId", "source", "target", "script", "find", "s", "getScriptName", "useCallback", "name", "handleGoToScript", "createIntent", "LayoutAction", "Open", "part", "subject", "Obj", "getDXN", "toString", "handleDelete", "SpaceAction", "RemoveObjects", "objects", "div", "role", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "is", "getId", "Item", "key", "item", "classNames", "ghostHover", "ItemTitle", "Button", "onClick", "IconButton", "iconOnly", "icon", "label", "FunctionsPanel"]
7
+ }
@@ -0,0 +1,15 @@
1
+ import {
2
+ meta
3
+ } from "./chunk-LZQFZO3B.mjs";
4
+
5
+ // src/capabilities/capabilities.ts
6
+ import { defineCapability } from "@dxos/app-framework";
7
+ (function(AutomationCapabilities2) {
8
+ AutomationCapabilities2.ComputeRuntime = defineCapability(`${meta.id}/capability/compute-runtime`);
9
+ })(AutomationCapabilities || (AutomationCapabilities = {}));
10
+ var AutomationCapabilities;
11
+
12
+ export {
13
+ AutomationCapabilities
14
+ };
15
+ //# sourceMappingURL=chunk-XAKZ4ANY.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/capabilities.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 { defineCapability } from '@dxos/app-framework';\nimport type { CredentialsService, DatabaseService, FunctionInvocationService, QueueService } from '@dxos/functions';\nimport type { InvocationTracer, TriggerDispatcher, TriggerStateStore } from '@dxos/functions-runtime';\nimport type { SpaceId } from '@dxos/keys';\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 | AiService.AiService\n | DatabaseService\n | QueueService\n | CredentialsService\n | FunctionInvocationService\n | InvocationTracer\n | TriggerStateStore\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 = defineCapability<ComputeRuntimeProvider>(`${meta.id}/capability/compute-runtime`);\n}\n"],
5
+ "mappings": ";;;;;AAOA,SAASA,wBAAwB;UAOhBC,yBAAAA;0BAyBFC,iBAAiBC,iBAAyC,GAAGC,KAAKC,EAAE,6BAA6B;AAChH,GA1BiBJ,2BAAAA,yBAAAA,CAAAA,EAAAA;;",
6
+ "names": ["defineCapability", "AutomationCapabilities", "ComputeRuntime", "defineCapability", "meta", "id"]
7
+ }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  meta
3
- } from "./chunk-GW5U2DGT.mjs";
3
+ } from "./chunk-LZQFZO3B.mjs";
4
4
 
5
5
  // src/types/schema.ts
6
- import { Schema } from "effect";
6
+ import * as Schema from "effect/Schema";
7
7
  import { SpaceSchema } from "@dxos/react-client/echo";
8
8
  var TriggerTemplate = Schema.Union(Schema.Struct({
9
9
  type: Schema.Literal("timer"),
@@ -35,4 +35,4 @@ var AutomationAction;
35
35
  export {
36
36
  AutomationAction
37
37
  };
38
- //# sourceMappingURL=chunk-HN7OHFCB.mjs.map
38
+ //# sourceMappingURL=chunk-YBPJCY3F.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/schema.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { SpaceSchema } from '@dxos/react-client/echo';\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 space: SpaceSchema,\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"],
5
+ "mappings": ";;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,mBAAmB;AAI5B,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,OAAOC;MACPC,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;;",
6
+ "names": ["Schema", "SpaceSchema", "TriggerTemplate", "Union", "Struct", "type", "Literal", "cron", "String", "queueDXN", "Any", "AutomationAction", "CreateTriggerFromTemplate", "TaggedClass", "meta", "id", "input", "space", "SpaceSchema", "template", "enabled", "optional", "Boolean", "scriptName", "Record", "key", "value", "output", "Void"]
7
+ }