@dxos/plugin-automation 0.8.3-staging.0fa589b → 0.8.4-main.f9ba587

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 (105) hide show
  1. package/dist/lib/browser/{AutomationContainer-OGNK3HD5.mjs → AutomationContainer-VZNV2ZQF.mjs} +5 -5
  2. package/dist/lib/browser/AutomationPanel-ZWA6GOFY.mjs +11 -0
  3. package/dist/lib/browser/{FunctionsContainer-JY7V7PLF.mjs → FunctionsContainer-IOB333TX.mjs} +4 -4
  4. package/dist/lib/browser/{FunctionsPanel-LY4IFKR7.mjs → FunctionsPanel-56ZKRVM5.mjs} +3 -3
  5. package/dist/lib/browser/{app-graph-builder-T34RV5UA.mjs → app-graph-builder-ZTAUTFI4.mjs} +3 -3
  6. package/dist/lib/browser/chunk-ECSTS2UI.mjs +14 -0
  7. package/dist/lib/browser/{chunk-C5VOC5EE.mjs → chunk-ERTIGJYE.mjs} +5 -5
  8. package/dist/lib/browser/{chunk-N5VLW7UZ.mjs → chunk-FSJZXTS2.mjs} +6 -6
  9. package/dist/lib/browser/{chunk-IHAKPP5A.mjs → chunk-GW5U2DGT.mjs} +2 -2
  10. package/dist/lib/browser/{chunk-RHSCK7AU.mjs → chunk-LYJVTIVD.mjs} +4 -4
  11. package/dist/lib/browser/{chunk-4E2KPMLB.mjs → chunk-S2LE7SYB.mjs} +3 -3
  12. package/dist/lib/browser/index.mjs +13 -13
  13. package/dist/lib/browser/index.mjs.map +3 -3
  14. package/dist/lib/browser/{intent-resolver-AX46HSU7.mjs → intent-resolver-YLRSMLH4.mjs} +4 -4
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/{react-surface-Z7A272CA.mjs → react-surface-4DFSM7OX.mjs} +5 -5
  17. package/dist/lib/browser/types.mjs +2 -2
  18. package/dist/lib/node-esm/{AutomationContainer-ANCUYDDA.mjs → AutomationContainer-WMIH3F4V.mjs} +5 -5
  19. package/dist/lib/node-esm/{AutomationPanel-Y3ODAHH7.mjs → AutomationPanel-YYUMSK2W.mjs} +4 -4
  20. package/dist/lib/node-esm/{FunctionsContainer-25M5VT3J.mjs → FunctionsContainer-DJWB6WFH.mjs} +4 -4
  21. package/dist/lib/node-esm/{FunctionsPanel-HVGF5AJP.mjs → FunctionsPanel-KGIOZSPZ.mjs} +3 -3
  22. package/dist/lib/node-esm/{app-graph-builder-DYWAKQM3.mjs → app-graph-builder-3FP63ZSG.mjs} +3 -3
  23. package/dist/lib/node-esm/{chunk-UFHDB2OA.mjs → chunk-AZH66CED.mjs} +6 -6
  24. package/dist/lib/node-esm/{chunk-2T2OZC3A.mjs → chunk-HIMYPGHF.mjs} +5 -5
  25. package/dist/lib/node-esm/{chunk-HCCLRNMJ.mjs → chunk-NK5N3QKD.mjs} +2 -2
  26. package/dist/lib/node-esm/{chunk-WJHKFPX2.mjs → chunk-SGZPTJ47.mjs} +6 -6
  27. package/dist/lib/node-esm/{chunk-6JOJ2NN4.mjs → chunk-UKATFY3R.mjs} +3 -3
  28. package/dist/lib/node-esm/{chunk-2IH4VB3R.mjs → chunk-ZGPUV5VS.mjs} +4 -4
  29. package/dist/lib/node-esm/index.mjs +13 -13
  30. package/dist/lib/node-esm/index.mjs.map +3 -3
  31. package/dist/lib/node-esm/{intent-resolver-WXHFNJJI.mjs → intent-resolver-LU7EYWEO.mjs} +4 -4
  32. package/dist/lib/node-esm/meta.json +1 -1
  33. package/dist/lib/node-esm/{react-surface-TP6IYSR4.mjs → react-surface-3PNW7NDW.mjs} +5 -5
  34. package/dist/lib/node-esm/types.mjs +2 -2
  35. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +1 -1
  36. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  37. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +1 -1
  38. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  39. package/dist/types/src/translations.d.ts +29 -29
  40. package/dist/types/src/translations.d.ts.map +1 -1
  41. package/dist/types/tsconfig.tsbuildinfo +1 -1
  42. package/package.json +29 -29
  43. package/src/AutomationPlugin.tsx +1 -1
  44. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +2 -2
  45. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +2 -2
  46. package/src/translations.ts +6 -4
  47. package/dist/lib/browser/AutomationPanel-PRIIAXD5.mjs +0 -11
  48. package/dist/lib/browser/chunk-VQWJ5UYA.mjs +0 -14
  49. package/dist/lib/node/AutomationContainer-B7PSJFIS.cjs +0 -66
  50. package/dist/lib/node/AutomationContainer-B7PSJFIS.cjs.map +0 -7
  51. package/dist/lib/node/AutomationPanel-XYLZU4MI.cjs +0 -32
  52. package/dist/lib/node/AutomationPanel-XYLZU4MI.cjs.map +0 -7
  53. package/dist/lib/node/FunctionsContainer-4FGOQW5X.cjs +0 -67
  54. package/dist/lib/node/FunctionsContainer-4FGOQW5X.cjs.map +0 -7
  55. package/dist/lib/node/FunctionsPanel-EWWAZK3W.cjs +0 -31
  56. package/dist/lib/node/FunctionsPanel-EWWAZK3W.cjs.map +0 -7
  57. package/dist/lib/node/app-graph-builder-5XRIIV7E.cjs +0 -96
  58. package/dist/lib/node/app-graph-builder-5XRIIV7E.cjs.map +0 -7
  59. package/dist/lib/node/chunk-3EF7MLFX.cjs +0 -38
  60. package/dist/lib/node/chunk-3EF7MLFX.cjs.map +0 -7
  61. package/dist/lib/node/chunk-6X3XJ4VI.cjs +0 -122
  62. package/dist/lib/node/chunk-6X3XJ4VI.cjs.map +0 -7
  63. package/dist/lib/node/chunk-GIIVTK4O.cjs +0 -58
  64. package/dist/lib/node/chunk-GIIVTK4O.cjs.map +0 -7
  65. package/dist/lib/node/chunk-IXUCZ3YY.cjs +0 -173
  66. package/dist/lib/node/chunk-IXUCZ3YY.cjs.map +0 -7
  67. package/dist/lib/node/chunk-LQ6XK4N5.cjs +0 -253
  68. package/dist/lib/node/chunk-LQ6XK4N5.cjs.map +0 -7
  69. package/dist/lib/node/chunk-TH4XDKAY.cjs +0 -49
  70. package/dist/lib/node/chunk-TH4XDKAY.cjs.map +0 -7
  71. package/dist/lib/node/index.cjs +0 -124
  72. package/dist/lib/node/index.cjs.map +0 -7
  73. package/dist/lib/node/intent-resolver-EAREQZFE.cjs +0 -92
  74. package/dist/lib/node/intent-resolver-EAREQZFE.cjs.map +0 -7
  75. package/dist/lib/node/meta.json +0 -1
  76. package/dist/lib/node/react-surface-OI6CDHEI.cjs +0 -87
  77. package/dist/lib/node/react-surface-OI6CDHEI.cjs.map +0 -7
  78. package/dist/lib/node/types.cjs +0 -30
  79. package/dist/lib/node/types.cjs.map +0 -7
  80. /package/dist/lib/browser/{AutomationContainer-OGNK3HD5.mjs.map → AutomationContainer-VZNV2ZQF.mjs.map} +0 -0
  81. /package/dist/lib/browser/{AutomationPanel-PRIIAXD5.mjs.map → AutomationPanel-ZWA6GOFY.mjs.map} +0 -0
  82. /package/dist/lib/browser/{FunctionsContainer-JY7V7PLF.mjs.map → FunctionsContainer-IOB333TX.mjs.map} +0 -0
  83. /package/dist/lib/browser/{FunctionsPanel-LY4IFKR7.mjs.map → FunctionsPanel-56ZKRVM5.mjs.map} +0 -0
  84. /package/dist/lib/browser/{app-graph-builder-T34RV5UA.mjs.map → app-graph-builder-ZTAUTFI4.mjs.map} +0 -0
  85. /package/dist/lib/browser/{chunk-VQWJ5UYA.mjs.map → chunk-ECSTS2UI.mjs.map} +0 -0
  86. /package/dist/lib/browser/{chunk-C5VOC5EE.mjs.map → chunk-ERTIGJYE.mjs.map} +0 -0
  87. /package/dist/lib/browser/{chunk-N5VLW7UZ.mjs.map → chunk-FSJZXTS2.mjs.map} +0 -0
  88. /package/dist/lib/browser/{chunk-IHAKPP5A.mjs.map → chunk-GW5U2DGT.mjs.map} +0 -0
  89. /package/dist/lib/browser/{chunk-RHSCK7AU.mjs.map → chunk-LYJVTIVD.mjs.map} +0 -0
  90. /package/dist/lib/browser/{chunk-4E2KPMLB.mjs.map → chunk-S2LE7SYB.mjs.map} +0 -0
  91. /package/dist/lib/browser/{intent-resolver-AX46HSU7.mjs.map → intent-resolver-YLRSMLH4.mjs.map} +0 -0
  92. /package/dist/lib/browser/{react-surface-Z7A272CA.mjs.map → react-surface-4DFSM7OX.mjs.map} +0 -0
  93. /package/dist/lib/node-esm/{AutomationContainer-ANCUYDDA.mjs.map → AutomationContainer-WMIH3F4V.mjs.map} +0 -0
  94. /package/dist/lib/node-esm/{AutomationPanel-Y3ODAHH7.mjs.map → AutomationPanel-YYUMSK2W.mjs.map} +0 -0
  95. /package/dist/lib/node-esm/{FunctionsContainer-25M5VT3J.mjs.map → FunctionsContainer-DJWB6WFH.mjs.map} +0 -0
  96. /package/dist/lib/node-esm/{FunctionsPanel-HVGF5AJP.mjs.map → FunctionsPanel-KGIOZSPZ.mjs.map} +0 -0
  97. /package/dist/lib/node-esm/{app-graph-builder-DYWAKQM3.mjs.map → app-graph-builder-3FP63ZSG.mjs.map} +0 -0
  98. /package/dist/lib/node-esm/{chunk-UFHDB2OA.mjs.map → chunk-AZH66CED.mjs.map} +0 -0
  99. /package/dist/lib/node-esm/{chunk-2T2OZC3A.mjs.map → chunk-HIMYPGHF.mjs.map} +0 -0
  100. /package/dist/lib/node-esm/{chunk-HCCLRNMJ.mjs.map → chunk-NK5N3QKD.mjs.map} +0 -0
  101. /package/dist/lib/node-esm/{chunk-WJHKFPX2.mjs.map → chunk-SGZPTJ47.mjs.map} +0 -0
  102. /package/dist/lib/node-esm/{chunk-6JOJ2NN4.mjs.map → chunk-UKATFY3R.mjs.map} +0 -0
  103. /package/dist/lib/node-esm/{chunk-2IH4VB3R.mjs.map → chunk-ZGPUV5VS.mjs.map} +0 -0
  104. /package/dist/lib/node-esm/{intent-resolver-WXHFNJJI.mjs.map → intent-resolver-LU7EYWEO.mjs.map} +0 -0
  105. /package/dist/lib/node-esm/{react-surface-TP6IYSR4.mjs.map → react-surface-3PNW7NDW.mjs.map} +0 -0
@@ -1,253 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_LQ6XK4N5_exports = {};
30
- __export(chunk_LQ6XK4N5_exports, {
31
- TriggerEditor: () => TriggerEditor
32
- });
33
- module.exports = __toCommonJS(chunk_LQ6XK4N5_exports);
34
- var import_chunk_3EF7MLFX = require("./chunk-3EF7MLFX.cjs");
35
- var import_tracking = require("@preact-signals/safe-react/tracking");
36
- var import_react = __toESM(require("react"));
37
- var import_conductor = require("@dxos/conductor");
38
- var import_echo = require("@dxos/echo");
39
- var import_functions = require("@dxos/functions");
40
- var import_echo2 = require("@dxos/react-client/echo");
41
- var import_react_ui_form = require("@dxos/react-ui-form");
42
- var import_tracking2 = require("@preact-signals/safe-react/tracking");
43
- var import_react2 = __toESM(require("react"));
44
- var import_echo3 = require("@dxos/echo");
45
- var import_react_ui = require("@dxos/react-ui");
46
- var import_react_ui_form2 = require("@dxos/react-ui-form");
47
- var import_tracking3 = require("@preact-signals/safe-react/tracking");
48
- var import_react3 = __toESM(require("react"));
49
- var import_functions2 = require("@dxos/functions");
50
- var import_react_ui2 = require("@dxos/react-ui");
51
- var import_react_ui_form3 = require("@dxos/react-ui-form");
52
- var FunctionInputEditor = ({ functions, getValue, onValueChange, onQueryRefOptions }) => {
53
- var _effect = (0, import_tracking2.useSignals)();
54
- try {
55
- const selectedFunctionValue = (0, import_react_ui_form2.useFormValues)([
56
- "function"
57
- ]);
58
- const selectedFunctionId = (0, import_react2.useMemo)(() => {
59
- if (import_echo3.Ref.isRef(selectedFunctionValue)) {
60
- return selectedFunctionValue.dxn.toString().split("dxn:echo:@:").at(1);
61
- }
62
- }, [
63
- selectedFunctionValue
64
- ]);
65
- const selectedFunction = (0, import_react2.useMemo)(() => functions.find((fn) => fn.id === selectedFunctionId), [
66
- functions,
67
- selectedFunctionId
68
- ]);
69
- (0, import_react_ui.useOnTransition)(
70
- // Clear function parameter input when the function changes.
71
- selectedFunctionValue,
72
- (prevValue) => prevValue !== void 0 && prevValue !== selectedFunctionValue,
73
- (currValue) => currValue !== void 0,
74
- () => onValueChange("object", {})
75
- );
76
- const inputSchema = (0, import_react2.useMemo)(() => selectedFunction?.inputSchema, [
77
- selectedFunction
78
- ]);
79
- const effectSchema = (0, import_react2.useMemo)(() => inputSchema ? import_echo3.Type.toEffectSchema(inputSchema) : void 0, [
80
- inputSchema
81
- ]);
82
- const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;
83
- const values = (0, import_react2.useMemo)(() => getValue() ?? {}, [
84
- getValue
85
- ]);
86
- const handleValuesChanged = (0, import_react2.useCallback)((values2) => {
87
- onValueChange("object", values2);
88
- }, [
89
- onValueChange
90
- ]);
91
- if (selectedFunction === void 0 || effectSchema === void 0 || propertyCount === 0) {
92
- return null;
93
- }
94
- return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("h3", {
95
- className: "text-md"
96
- }, "Function parameters"), /* @__PURE__ */ import_react2.default.createElement(import_react_ui_form2.Form, {
97
- schema: effectSchema,
98
- values,
99
- onValuesChanged: handleValuesChanged,
100
- onQueryRefOptions,
101
- outerSpacing: false
102
- }));
103
- } finally {
104
- _effect.f();
105
- }
106
- };
107
- var SpecSelector = (props) => {
108
- var _effect = (0, import_tracking3.useSignals)();
109
- try {
110
- const { t } = (0, import_react_ui2.useTranslation)(import_chunk_3EF7MLFX.AUTOMATION_PLUGIN);
111
- const specProps = (0, import_react_ui_form3.useInputProps)([
112
- "spec"
113
- ]);
114
- const handleTypeChange = (0, import_react3.useCallback)((_type, value) => {
115
- const getDefaultTriggerSpec = (kind) => {
116
- switch (kind) {
117
- case import_functions2.TriggerKind.Timer:
118
- return {
119
- kind: import_functions2.TriggerKind.Timer,
120
- cron: ""
121
- };
122
- case import_functions2.TriggerKind.Subscription:
123
- return {
124
- kind: import_functions2.TriggerKind.Subscription,
125
- filter: {}
126
- };
127
- case import_functions2.TriggerKind.Queue:
128
- return {
129
- kind: import_functions2.TriggerKind.Queue,
130
- queue: ""
131
- };
132
- case import_functions2.TriggerKind.Email:
133
- return {
134
- kind: import_functions2.TriggerKind.Email
135
- };
136
- case import_functions2.TriggerKind.Webhook:
137
- return {
138
- kind: import_functions2.TriggerKind.Webhook
139
- };
140
- default:
141
- return void 0;
142
- }
143
- };
144
- const defaultSpec = getDefaultTriggerSpec(value);
145
- if (!defaultSpec) {
146
- return;
147
- }
148
- specProps.onValueChange("object", defaultSpec);
149
- }, [
150
- specProps
151
- ]);
152
- const options = (0, import_react3.useMemo)(() => Object.values(import_functions2.TriggerKind).map((kind) => ({
153
- value: kind,
154
- label: t(`trigger type ${kind}`)
155
- })), [
156
- t
157
- ]);
158
- return /* @__PURE__ */ import_react3.default.createElement(import_react_ui_form3.SelectInput, {
159
- ...props,
160
- options,
161
- onValueChange: handleTypeChange
162
- });
163
- } finally {
164
- _effect.f();
165
- }
166
- };
167
- var TriggerEditor = ({ space, trigger, onSave, onCancel }) => {
168
- var _effect = (0, import_tracking.useSignals)();
169
- try {
170
- const handleSave = (values) => {
171
- onSave?.(values);
172
- };
173
- const handleRefQueryLookup = (0, import_react_ui_form.useRefQueryLookupHandler)({
174
- space
175
- });
176
- const Custom = useCustomInputs(space, handleRefQueryLookup);
177
- return /* @__PURE__ */ import_react.default.createElement(import_react_ui_form.Form, {
178
- outerSpacing: false,
179
- Custom,
180
- schema: import_functions.FunctionTriggerSchema,
181
- values: trigger,
182
- onSave: handleSave,
183
- onCancel,
184
- onQueryRefOptions: handleRefQueryLookup
185
- });
186
- } finally {
187
- _effect.f();
188
- }
189
- };
190
- var useCustomInputs = (space, onQueryRefOptions) => {
191
- const functions = (0, import_echo2.useQuery)(space, import_echo2.Filter.type(import_functions.FunctionType));
192
- const workflows = (0, import_echo2.useQuery)(space, import_echo2.Filter.type(import_conductor.ComputeGraph));
193
- const scripts = (0, import_echo2.useQuery)(space, import_echo2.Filter.type(import_functions.ScriptType));
194
- return (0, import_react.useMemo)(() => ({
195
- // Function selector.
196
- ["function"]: (props) => {
197
- const getValue = (0, import_react.useCallback)(() => {
198
- const formValue = props.getValue();
199
- if (import_echo2.Ref.isRef(formValue)) {
200
- return formValue.dxn.toString();
201
- }
202
- return void 0;
203
- }, [
204
- props
205
- ]);
206
- const handleOnValueChange = (0, import_react.useCallback)((_type, dxnString) => {
207
- const dxn = import_echo.Type.DXN.parse(dxnString);
208
- if (dxn) {
209
- const ref = import_echo2.Ref.fromDXN(dxn);
210
- props.onValueChange("object", ref);
211
- }
212
- }, [
213
- props.onValueChange
214
- ]);
215
- return /* @__PURE__ */ import_react.default.createElement(import_react_ui_form.SelectInput, {
216
- ...props,
217
- getValue,
218
- onValueChange: handleOnValueChange,
219
- options: getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))
220
- });
221
- },
222
- // Spec selector.
223
- ["spec.kind"]: SpecSelector,
224
- // Function input editor.
225
- ["input"]: (props) => /* @__PURE__ */ import_react.default.createElement(FunctionInputEditor, {
226
- ...props,
227
- functions,
228
- onQueryRefOptions
229
- })
230
- }), [
231
- workflows,
232
- scripts,
233
- functions
234
- ]);
235
- };
236
- var getWorkflowOptions = (graphs) => {
237
- return graphs.map((graph) => ({
238
- label: `compute-${graph.id}`,
239
- value: `dxn:echo:@:${graph.id}`
240
- }));
241
- };
242
- var getFunctionOptions = (scripts, functions) => {
243
- const getLabel = (fn) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
244
- return functions.map((fn) => ({
245
- label: getLabel(fn),
246
- value: `dxn:echo:@:${fn.id}`
247
- }));
248
- };
249
- // Annotate the CommonJS export names for ESM import in node:
250
- 0 && (module.exports = {
251
- TriggerEditor
252
- });
253
- //# sourceMappingURL=chunk-LQ6XK4N5.cjs.map
@@ -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 { Type } from '@dxos/echo';\nimport {\n FunctionType,\n FunctionTriggerSchema,\n type FunctionTriggerType,\n type FunctionTrigger,\n ScriptType,\n} from '@dxos/functions';\nimport { Filter, Ref, useQuery, type Space } from '@dxos/react-client/echo';\nimport { type CustomInputMap, Form, 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: FunctionTriggerType;\n onSave?: (trigger: Omit<FunctionTrigger, 'id'>) => void;\n onCancel?: () => void;\n};\n\nexport const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEditorProps) => {\n const handleSave = (values: FunctionTriggerType) => {\n onSave?.(values);\n };\n\n const handleRefQueryLookup = useRefQueryLookupHandler({ space });\n const Custom = useCustomInputs(space, handleRefQueryLookup);\n\n return (\n <Form\n outerSpacing={false}\n Custom={Custom}\n schema={FunctionTriggerSchema}\n values={trigger}\n onSave={handleSave}\n onCancel={onCancel}\n onQueryRefOptions={handleRefQueryLookup}\n />\n );\n};\n\nconst useCustomInputs = (space: Space, onQueryRefOptions: FunctionInputEditorProps['onQueryRefOptions']) => {\n const functions = useQuery(space, Filter.type(FunctionType));\n const workflows = useQuery(space, Filter.type(ComputeGraph));\n const scripts = useQuery(space, Filter.type(ScriptType));\n\n return useMemo(\n (): CustomInputMap => ({\n // Function selector.\n ['function' satisfies keyof FunctionTriggerType]: (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]: SpecSelector,\n\n // Function input editor.\n ['input' as const]: (props) => (\n <FunctionInputEditor {...props} functions={functions} onQueryRefOptions={onQueryRefOptions} />\n ),\n }),\n [workflows, scripts, functions],\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: ScriptType[], functions: FunctionType[]) => {\n const getLabel = (fn: FunctionType) => 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-schema';\nimport { type FunctionType } 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: FunctionType[];\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) => prevValue !== undefined && prevValue !== selectedFunctionValue,\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 { type FunctionTriggerType, TriggerKind, type TriggerType } from '@dxos/functions';\nimport { useTranslation } from '@dxos/react-ui';\nimport { SelectInput, type InputProps, useInputProps } from '@dxos/react-ui-form';\n\nimport { AUTOMATION_PLUGIN } from '../../meta';\n\nexport type SpecSelectorProps = InputProps;\n\nexport const SpecSelector = (props: SpecSelectorProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const specProps = useInputProps(['spec' satisfies keyof FunctionTriggerType]);\n\n const handleTypeChange = useCallback(\n (_type: any, value: string): TriggerType | undefined => {\n const getDefaultTriggerSpec = (kind: string) => {\n switch (kind) {\n case TriggerKind.Timer:\n return { kind: TriggerKind.Timer, cron: '' };\n case TriggerKind.Subscription:\n return { kind: TriggerKind.Subscription, filter: {} };\n case TriggerKind.Queue:\n return { kind: TriggerKind.Queue, queue: '' };\n case TriggerKind.Email:\n return { kind: TriggerKind.Email };\n case TriggerKind.Webhook:\n return { kind: TriggerKind.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 Object.values(TriggerKind).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,mBAA4C;AAE5C,u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c,UAAUyF,GAAAA;QAChC;MACF,GACA;QAACjD,MAAMxC;OAAc;AAGvB,aACEgC,6BAAAA,QAAA,cAACgC,qBAAAA,aAAAA;QACE,GAAGxB;QACJzC;QACAC,eAAeqF;QACfxB,SAAS8B,mBAAmBX,SAAAA,EAAWY,OAAOC,mBAAmBX,SAASpF,SAAAA,CAAAA;;IAGhF;;IAGA,CAAC,WAAA,GAAuByC;;IAGxB,CAAC,OAAA,GAAmB,CAACC,UACnBR,6BAAAA,QAAA,cAACnC,qBAAAA;MAAqB,GAAG2C;MAAO1C;MAAsBG;;EAE1D,IACA;IAAC+E;IAAWE;IAASpF;GAAU;AAEnC;AAEA,IAAM6F,qBAAqB,CAACG,WAAAA;AAC1B,SAAOA,OAAOhC,IAAI,CAACiC,WAAW;IAAEhC,OAAO,WAAWgC,MAAMhF,EAAE;IAAIiC,OAAO,cAAc+C,MAAMhF,EAAE;EAAG,EAAA;AAChG;AAEA,IAAM8E,qBAAqB,CAACX,SAAuBpF,cAAAA;AACjD,QAAMkG,WAAW,CAAClF,OAAqBoE,QAAQrE,KAAK,CAACoF,MAAMnF,GAAGoF,QAAQC,QAAQpF,OAAOkF,EAAElF,EAAE,GAAGqF,QAAQtF,GAAGsF;AACvG,SAAOtG,UAAUgE,IAAI,CAAChD,QAAQ;IAAEiD,OAAOiC,SAASlF,EAAAA;IAAKkC,OAAO,cAAclC,GAAGC,EAAE;EAAG,EAAA;AACpF;",
6
- "names": ["import_echo", "import_react", "import_react_ui_form", "import_functions", "import_react_ui", "FunctionInputEditor", "functions", "getValue", "onValueChange", "onQueryRefOptions", "selectedFunctionValue", "useFormValues", "selectedFunctionId", "useMemo", "Ref", "isRef", "dxn", "toString", "split", "at", "selectedFunction", "find", "fn", "id", "useOnTransition", "prevValue", "undefined", "currValue", "inputSchema", "effectSchema", "Type", "toEffectSchema", "propertyCount", "properties", "Object", "keys", "length", "values", "handleValuesChanged", "useCallback", "React", "h3", "className", "Form", "schema", "onValuesChanged", "outerSpacing", "SpecSelector", "props", "t", "useTranslation", "AUTOMATION_PLUGIN", "specProps", "useInputProps", "handleTypeChange", "_type", "value", "getDefaultTriggerSpec", "kind", "TriggerKind", "Timer", "cron", "Subscription", "filter", "Queue", "queue", "Email", "Webhook", "defaultSpec", "options", "map", "label", "SelectInput", "TriggerEditor", "space", "trigger", "onSave", "onCancel", "handleSave", "handleRefQueryLookup", "useRefQueryLookupHandler", "Custom", "useCustomInputs", "FunctionTriggerSchema", "useQuery", "Filter", "type", "FunctionType", "workflows", "ComputeGraph", "scripts", "ScriptType", "formValue", "handleOnValueChange", "dxnString", "DXN", "parse", "ref", "fromDXN", "getWorkflowOptions", "concat", "getFunctionOptions", "graphs", "graph", "getLabel", "s", "source", "target", "name"]
7
- }
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_TH4XDKAY_exports = {};
30
- __export(chunk_TH4XDKAY_exports, {
31
- AutomationContainer: () => AutomationContainer,
32
- AutomationPanel: () => AutomationPanel,
33
- FunctionsContainer: () => FunctionsContainer,
34
- FunctionsPanel: () => FunctionsPanel
35
- });
36
- module.exports = __toCommonJS(chunk_TH4XDKAY_exports);
37
- var import_react = require("react");
38
- var AutomationContainer = (0, import_react.lazy)(() => import("./AutomationContainer-B7PSJFIS.cjs"));
39
- var AutomationPanel = (0, import_react.lazy)(() => import("./AutomationPanel-XYLZU4MI.cjs"));
40
- var FunctionsContainer = (0, import_react.lazy)(() => import("./FunctionsContainer-4FGOQW5X.cjs"));
41
- var FunctionsPanel = (0, import_react.lazy)(() => import("./FunctionsPanel-EWWAZK3W.cjs"));
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- AutomationContainer,
45
- AutomationPanel,
46
- FunctionsContainer,
47
- FunctionsPanel
48
- });
49
- //# sourceMappingURL=chunk-TH4XDKAY.cjs.map
@@ -1,7 +0,0 @@
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 AutomationContainer = lazy(() => import('./AutomationContainer'));\nexport const AutomationPanel = lazy(() => import('./AutomationPanel'));\nexport const FunctionsContainer = lazy(() => import('./FunctionsContainer'));\nexport const FunctionsPanel = lazy(() => import('./FunctionsPanel'));\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAqB;AAId,IAAMA,0BAAsBC,mBAAK,MAAM,OAAO,oCAAA,CAAA;AAC9C,IAAMC,sBAAkBD,mBAAK,MAAM,OAAO,gCAAA,CAAA;AAC1C,IAAME,yBAAqBF,mBAAK,MAAM,OAAO,mCAAA,CAAA;AAC7C,IAAMG,qBAAiBH,mBAAK,MAAM,OAAO,+BAAA,CAAA;",
6
- "names": ["AutomationContainer", "lazy", "AutomationPanel", "FunctionsContainer", "FunctionsPanel"]
7
- }
@@ -1,124 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var node_exports = {};
30
- __export(node_exports, {
31
- AUTOMATION_PLUGIN: () => import_chunk_3EF7MLFX.AUTOMATION_PLUGIN,
32
- AutomationContainer: () => import_chunk_TH4XDKAY.AutomationContainer,
33
- AutomationPanel: () => import_chunk_TH4XDKAY.AutomationPanel,
34
- AutomationPlugin: () => AutomationPlugin,
35
- FunctionsContainer: () => import_chunk_TH4XDKAY.FunctionsContainer,
36
- FunctionsPanel: () => import_chunk_TH4XDKAY.FunctionsPanel,
37
- TriggerEditor: () => import_chunk_LQ6XK4N5.TriggerEditor,
38
- meta: () => import_chunk_3EF7MLFX.meta
39
- });
40
- module.exports = __toCommonJS(node_exports);
41
- var import_chunk_TH4XDKAY = require("./chunk-TH4XDKAY.cjs");
42
- var import_chunk_LQ6XK4N5 = require("./chunk-LQ6XK4N5.cjs");
43
- var import_chunk_3EF7MLFX = require("./chunk-3EF7MLFX.cjs");
44
- var import_app_framework = require("@dxos/app-framework");
45
- var import_functions = require("@dxos/functions");
46
- var import_plugin_client = require("@dxos/plugin-client");
47
- var import_app_framework2 = require("@dxos/app-framework");
48
- var AppGraphBuilder = (0, import_app_framework2.lazy)(() => import("./app-graph-builder-5XRIIV7E.cjs"));
49
- var IntentResolver = (0, import_app_framework2.lazy)(() => import("./intent-resolver-EAREQZFE.cjs"));
50
- var ReactSurface = (0, import_app_framework2.lazy)(() => import("./react-surface-OI6CDHEI.cjs"));
51
- var translations_default = [
52
- {
53
- "en-US": {
54
- [import_chunk_3EF7MLFX.AUTOMATION_PLUGIN]: {
55
- "plugin name": "Automation",
56
- "automation panel label": "Automations",
57
- "script automation label": "Automation",
58
- "automation verbose label": "Manage automations",
59
- "automation description": "You can manage all the triggers which automate your space here.",
60
- "functions panel label": "Functions",
61
- "functions verbose label": "Manage deployed functions",
62
- "functions description": "You can manage all the functions deployed from your space on EDGE here.",
63
- "function copy id": "Copy Function ID",
64
- "no functions found": "No functions found",
65
- "go to function source button label": "Show function source",
66
- "trigger editor title": "Configure Trigger",
67
- "new trigger label": "Add Trigger",
68
- "trigger type timer": "Timer",
69
- "trigger type webhook": "Webhook",
70
- "trigger type websocket": "Websocket",
71
- "trigger type subscription": "Subscription",
72
- "trigger type email": "Email",
73
- "trigger type queue": "Queue",
74
- "trigger copy url": "Copy URL",
75
- "trigger copy email": "Copy Email",
76
- "trigger payload add": "Add",
77
- "trigger payload remove": "Remove",
78
- "trigger payload prop name placeholder": "New payload property name"
79
- }
80
- }
81
- }
82
- ];
83
- var AutomationPlugin = () => (0, import_app_framework.definePlugin)(import_chunk_3EF7MLFX.meta, [
84
- (0, import_app_framework.defineModule)({
85
- id: `${import_chunk_3EF7MLFX.meta.id}/module/translations`,
86
- activatesOn: import_app_framework.Events.SetupTranslations,
87
- activate: () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.Translations, translations_default)
88
- }),
89
- (0, import_app_framework.defineModule)({
90
- id: `${import_chunk_3EF7MLFX.meta.id}/module/schema`,
91
- activatesOn: import_plugin_client.ClientEvents.SetupSchema,
92
- activate: () => (0, import_app_framework.contributes)(import_plugin_client.ClientCapabilities.Schema, [
93
- import_functions.FunctionType,
94
- import_functions.FunctionTrigger
95
- ])
96
- }),
97
- (0, import_app_framework.defineModule)({
98
- id: `${import_chunk_3EF7MLFX.meta.id}/module/app-graph-builder`,
99
- activatesOn: import_app_framework.Events.SetupAppGraph,
100
- activate: AppGraphBuilder
101
- }),
102
- (0, import_app_framework.defineModule)({
103
- id: `${import_chunk_3EF7MLFX.meta.id}/module/intent-resolver`,
104
- activatesOn: import_app_framework.Events.SetupIntentResolver,
105
- activate: IntentResolver
106
- }),
107
- (0, import_app_framework.defineModule)({
108
- id: `${import_chunk_3EF7MLFX.meta.id}/module/react-surface`,
109
- activatesOn: import_app_framework.Events.SetupReactSurface,
110
- activate: ReactSurface
111
- })
112
- ]);
113
- // Annotate the CommonJS export names for ESM import in node:
114
- 0 && (module.exports = {
115
- AUTOMATION_PLUGIN,
116
- AutomationContainer,
117
- AutomationPanel,
118
- AutomationPlugin,
119
- FunctionsContainer,
120
- FunctionsPanel,
121
- TriggerEditor,
122
- meta
123
- });
124
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/AutomationPlugin.tsx", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';\nimport { FunctionType, FunctionTrigger } from '@dxos/functions';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\n\nimport { AppGraphBuilder, IntentResolver, ReactSurface } from './capabilities';\nimport { meta } from './meta';\nimport translations from './translations';\n\nexport const AutomationPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => contributes(ClientCapabilities.Schema, [FunctionType, FunctionTrigger]),\n }),\n defineModule({\n id: `${meta.id}/module/app-graph-builder`,\n activatesOn: Events.SetupAppGraph,\n activate: AppGraphBuilder,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntentResolver,\n activate: IntentResolver,\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: ReactSurface,\n }),\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 IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { AUTOMATION_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [AUTOMATION_PLUGIN]: {\n 'plugin name': 'Automation',\n 'automation panel label': 'Automations',\n 'script automation label': 'Automation',\n 'automation verbose label': 'Manage automations',\n 'automation description': 'You can manage all the triggers which automate your space here.',\n\n 'functions panel label': 'Functions',\n 'functions verbose label': 'Manage deployed functions',\n 'functions description': 'You can manage all the functions deployed from your space on EDGE here.',\n 'function copy id': 'Copy Function ID',\n 'no functions found': 'No functions found',\n 'go to function source button label': 'Show function source',\n\n 'trigger editor title': 'Configure Trigger',\n 'new trigger label': 'Add Trigger',\n 'trigger type timer': 'Timer',\n 'trigger type webhook': 'Webhook',\n 'trigger type websocket': 'Websocket',\n 'trigger type subscription': 'Subscription',\n 'trigger type email': 'Email',\n 'trigger type queue': 'Queue',\n\n 'trigger copy url': 'Copy URL',\n 'trigger copy email': 'Copy Email',\n\n 'trigger payload add': 'Add',\n 'trigger payload remove': 'Remove',\n 'trigger payload prop name placeholder': 'New payload property name',\n },\n },\n },\n];\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAA8E;AAC9E,uBAA8C;AAC9C,2BAAiD;ACFjD,IAAAA,wBAAqB;AAEd,IAAMC,sBAAkBC,4BAAK,MAAM,OAAO,kCAAA,CAAA;AAC1C,IAAMC,qBAAiBD,4BAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAME,mBAAeF,4BAAK,MAAM,OAAO,8BAAA,CAAA;ACF9C,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACG,uCAAAA,GAAoB;QACnB,eAAe;QACf,0BAA0B;QAC1B,2BAA2B;QAC3B,4BAA4B;QAC5B,0BAA0B;QAE1B,yBAAyB;QACzB,2BAA2B;QAC3B,yBAAyB;QACzB,oBAAoB;QACpB,sBAAsB;QACtB,sCAAsC;QAEtC,wBAAwB;QACxB,qBAAqB;QACrB,sBAAsB;QACtB,wBAAwB;QACxB,0BAA0B;QAC1B,6BAA6B;QAC7B,sBAAsB;QACtB,sBAAsB;QAEtB,oBAAoB;QACpB,sBAAsB;QAEtB,uBAAuB;QACvB,0BAA0B;QAC1B,yCAAyC;MAC3C;IACF;EACF;;AF5BK,IAAMC,mBAAmB,UAC9BC,mCAAaC,4BAAM;MACjBC,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,4BAAOC;IACpBC,UAAU,UAAMC,kCAAYC,kCAAaC,cAAcC,oBAAAA;EACzD,CAAA;MACAT,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaQ,kCAAaC;IAC1BN,UAAU,UAAMC,kCAAYM,wCAAmBC,QAAQ;MAACC;MAAcC;KAAgB;EACxF,CAAA;MACAf,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,4BAAOa;IACpBX,UAAUb;EACZ,CAAA;MACAQ,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,4BAAOc;IACpBZ,UAAUX;EACZ,CAAA;MACAM,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,4BAAOe;IACpBb,UAAUV;EACZ,CAAA;CACD;",
6
- "names": ["import_app_framework", "AppGraphBuilder", "lazy", "IntentResolver", "ReactSurface", "AUTOMATION_PLUGIN", "AutomationPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "ClientEvents", "SetupSchema", "ClientCapabilities", "Schema", "FunctionType", "FunctionTrigger", "SetupAppGraph", "SetupIntentResolver", "SetupReactSurface"]
7
- }
@@ -1,92 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var intent_resolver_EAREQZFE_exports = {};
20
- __export(intent_resolver_EAREQZFE_exports, {
21
- default: () => intent_resolver_default
22
- });
23
- module.exports = __toCommonJS(intent_resolver_EAREQZFE_exports);
24
- var import_chunk_GIIVTK4O = require("./chunk-GIIVTK4O.cjs");
25
- var import_chunk_3EF7MLFX = require("./chunk-3EF7MLFX.cjs");
26
- var import_app_framework = require("@dxos/app-framework");
27
- var import_echo = require("@dxos/echo");
28
- var import_functions = require("@dxos/functions");
29
- var import_types = require("@dxos/plugin-deck/types");
30
- var import_types2 = require("@dxos/plugin-space/types");
31
- var import_echo2 = require("@dxos/react-client/echo");
32
- var intent_resolver_default = (context) => (0, import_app_framework.contributes)(import_app_framework.Capabilities.IntentResolver, [
33
- (0, import_app_framework.createResolver)({
34
- intent: import_chunk_GIIVTK4O.AutomationAction.CreateTriggerFromTemplate,
35
- resolve: async ({ space, template, enabled = false, scriptName, input }) => {
36
- const trigger = import_echo.Obj.make(import_functions.FunctionTrigger, {
37
- enabled,
38
- input
39
- });
40
- if (scriptName) {
41
- const { objects: [script] } = await space.db.query(import_echo2.Filter.type(import_functions.ScriptType, {
42
- name: scriptName
43
- })).run();
44
- if (script) {
45
- const { objects: [fn] } = await space.db.query(import_echo2.Filter.type(import_functions.FunctionType, {
46
- source: import_echo.Ref.make(script)
47
- })).run();
48
- if (fn) {
49
- trigger.function = import_echo.Ref.make(fn);
50
- }
51
- }
52
- }
53
- switch (template.type) {
54
- case "timer": {
55
- trigger.spec = {
56
- kind: import_functions.TriggerKind.Timer,
57
- cron: template.cron
58
- };
59
- break;
60
- }
61
- case "queue": {
62
- trigger.spec = {
63
- kind: import_functions.TriggerKind.Queue,
64
- queue: template.queueDXN.toString()
65
- };
66
- break;
67
- }
68
- default: {
69
- break;
70
- }
71
- }
72
- return {
73
- intents: [
74
- (0, import_app_framework.createIntent)(import_types2.SpaceAction.AddObject, {
75
- object: trigger,
76
- target: space
77
- }),
78
- (0, import_app_framework.createIntent)(import_app_framework.LayoutAction.Open, {
79
- part: "main",
80
- subject: [
81
- `automation-settings${import_types.ATTENDABLE_PATH_SEPARATOR}${space.id}`
82
- ],
83
- options: {
84
- workspace: space.id
85
- }
86
- })
87
- ]
88
- };
89
- }
90
- })
91
- ]);
92
- //# sourceMappingURL=intent-resolver-EAREQZFE.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/intent-resolver.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n contributes,\n Capabilities,\n createResolver,\n type PluginContext,\n createIntent,\n LayoutAction,\n} from '@dxos/app-framework';\nimport { Obj, Ref } from '@dxos/echo';\nimport { FunctionTrigger, FunctionType, ScriptType, TriggerKind } from '@dxos/functions';\nimport { type DXN } from '@dxos/keys';\nimport { ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter } from '@dxos/react-client/echo';\n\nimport { AutomationAction } from '../types';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.IntentResolver, [\n createResolver({\n intent: AutomationAction.CreateTriggerFromTemplate,\n resolve: async ({ space, template, enabled = false, scriptName, input }) => {\n const trigger = Obj.make(FunctionTrigger, { enabled, input });\n\n // TODO(wittjosiah): Factor out function lookup by script name?\n if (scriptName) {\n const {\n objects: [script],\n } = await space.db.query(Filter.type(ScriptType, { name: scriptName })).run();\n if (script) {\n const {\n objects: [fn],\n } = await space.db.query(Filter.type(FunctionType, { source: Ref.make(script) })).run();\n if (fn) {\n trigger.function = Ref.make(fn);\n }\n }\n }\n\n switch (template.type) {\n case 'timer': {\n trigger.spec = { kind: TriggerKind.Timer, cron: template.cron };\n break;\n }\n case 'queue': {\n trigger.spec = { kind: TriggerKind.Queue, queue: (template.queueDXN as DXN).toString() };\n break;\n }\n default: {\n break;\n }\n }\n\n return {\n intents: [\n createIntent(SpaceAction.AddObject, { object: trigger, target: space }),\n createIntent(LayoutAction.Open, {\n part: 'main',\n subject: [`automation-settings${ATTENDABLE_PATH_SEPARATOR}${space.id}`],\n options: {\n work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AAA;cACrEiC,mCAAaK,kCAAaC,MAAM;YAC9BC,MAAM;YACNC,SAAS;cAAC,sBAAsBC,sCAAAA,GAA4B1C,MAAM2C,EAAE;;YACpEC,SAAS;cACPC,WAAW7C,MAAM2C;YACnB;UACF,CAAA;;MAEJ;IACF;EACF,CAAA;CACD;",
6
- "names": ["import_types", "import_echo", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "AutomationAction", "CreateTriggerFromTemplate", "resolve", "space", "template", "enabled", "scriptName", "input", "trigger", "Obj", "make", "FunctionTrigger", "objects", "script", "db", "query", "Filter", "type", "ScriptType", "name", "run", "fn", "FunctionType", "source", "Ref", "function", "spec", "kind", "TriggerKind", "Timer", "cron", "Queue", "queue", "queueDXN", "toString", "intents", "createIntent", "SpaceAction", "AddObject", "object", "target", "LayoutAction", "Open", "part", "subject", "ATTENDABLE_PATH_SEPARATOR", "id", "options", "workspace"]
7
- }