@dxos/plugin-automation 0.8.3 → 0.8.4-main.1068cf700f
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.
- package/dist/lib/browser/AutomationPanel-C6MZ22CB.mjs +11 -0
- package/dist/lib/browser/AutomationSettings-D7UO5V3Q.mjs +57 -0
- package/dist/lib/browser/AutomationSettings-D7UO5V3Q.mjs.map +7 -0
- package/dist/lib/browser/FunctionsContainer-5NHAAP5H.mjs +125 -0
- package/dist/lib/browser/FunctionsContainer-5NHAAP5H.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsPanel-LY4IFKR7.mjs → FunctionsPanel-RD22LYMR.mjs} +3 -3
- package/dist/lib/browser/app-graph-builder-HLARI3VW.mjs +85 -0
- package/dist/lib/browser/app-graph-builder-HLARI3VW.mjs.map +7 -0
- package/dist/lib/browser/chunk-C273ZYLE.mjs +258 -0
- package/dist/lib/browser/chunk-C273ZYLE.mjs.map +7 -0
- package/dist/lib/browser/chunk-JFBUK3WR.mjs +14 -0
- package/dist/lib/browser/chunk-JFBUK3WR.mjs.map +7 -0
- package/dist/lib/browser/chunk-JN7QRQQX.mjs +256 -0
- package/dist/lib/browser/chunk-JN7QRQQX.mjs.map +7 -0
- package/dist/lib/browser/chunk-JOXPQ27I.mjs +83 -0
- package/dist/lib/browser/chunk-JOXPQ27I.mjs.map +7 -0
- package/dist/lib/browser/chunk-O5Y2F33G.mjs +8 -0
- package/dist/lib/browser/chunk-O5Y2F33G.mjs.map +7 -0
- package/dist/lib/browser/chunk-P5AEO35Y.mjs +93 -0
- package/dist/lib/browser/chunk-P5AEO35Y.mjs.map +7 -0
- package/dist/lib/browser/chunk-PZNBEKO5.mjs +17 -0
- package/dist/lib/browser/chunk-PZNBEKO5.mjs.map +7 -0
- package/dist/lib/browser/chunk-QNEQ23BF.mjs +98 -0
- package/dist/lib/browser/chunk-QNEQ23BF.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +1108 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/compute-runtime-BUBHYS4Y.mjs +119 -0
- package/dist/lib/browser/compute-runtime-BUBHYS4Y.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +13 -0
- package/dist/lib/browser/index.mjs +73 -51
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-IN2FRGOT.mjs +83 -0
- package/dist/lib/browser/operation-resolver-IN2FRGOT.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-Z7A272CA.mjs → react-surface-246NXXJR.mjs} +26 -24
- package/dist/lib/browser/react-surface-246NXXJR.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +14 -0
- package/dist/lib/node-esm/{AutomationPanel-Y3ODAHH7.mjs → AutomationPanel-RTBY7YFM.mjs} +4 -4
- package/dist/lib/node-esm/AutomationSettings-GK4RLSDN.mjs +58 -0
- package/dist/lib/node-esm/AutomationSettings-GK4RLSDN.mjs.map +7 -0
- package/dist/lib/node-esm/FunctionsContainer-AHHZODM5.mjs +126 -0
- package/dist/lib/node-esm/FunctionsContainer-AHHZODM5.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsPanel-HVGF5AJP.mjs → FunctionsPanel-V2DKWYMU.mjs} +3 -3
- package/dist/lib/node-esm/app-graph-builder-Z2TMQHVX.mjs +86 -0
- package/dist/lib/node-esm/app-graph-builder-Z2TMQHVX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs +19 -0
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-AENSLAVD.mjs +99 -0
- package/dist/lib/node-esm/chunk-AENSLAVD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EJPZWAGR.mjs +257 -0
- package/dist/lib/node-esm/chunk-EJPZWAGR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-K5Z4UGIO.mjs +16 -0
- package/dist/lib/node-esm/chunk-K5Z4UGIO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-M3UPTGXF.mjs +10 -0
- package/dist/lib/node-esm/chunk-M3UPTGXF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OJEFRZEV.mjs +259 -0
- package/dist/lib/node-esm/chunk-OJEFRZEV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Q7EMIPMW.mjs +94 -0
- package/dist/lib/node-esm/chunk-Q7EMIPMW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs +84 -0
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +1109 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/compute-runtime-6UEDBN76.mjs +120 -0
- package/dist/lib/node-esm/compute-runtime-6UEDBN76.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +14 -0
- package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +73 -51
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-67CEAKXP.mjs +84 -0
- package/dist/lib/node-esm/operation-resolver-67CEAKXP.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-TP6IYSR4.mjs → react-surface-U6762KPI.mjs} +26 -24
- package/dist/lib/node-esm/react-surface-U6762KPI.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +15 -0
- package/dist/lib/node-esm/types/index.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts +2 -1
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts +6 -0
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime/index.d.ts +3 -0
- package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/commands/index.d.ts +2 -0
- package/dist/types/src/cli/commands/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/index.d.ts +25 -0
- package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts +15 -0
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/index.d.ts +57 -0
- package/dist/types/src/cli/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/list.d.ts +7 -0
- package/dist/types/src/cli/commands/trigger/list.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/options.d.ts +11 -0
- package/dist/types/src/cli/commands/trigger/options.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/remove.d.ts +8 -0
- package/dist/types/src/cli/commands/trigger/remove.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/index.d.ts +28 -0
- package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts +12 -0
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts +11 -0
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/util.d.ts +46 -0
- package/dist/types/src/cli/commands/trigger/util.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +3 -3
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +49 -4
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/AutomationSettings.d.ts +5 -0
- package/dist/types/src/components/AutomationSettings.d.ts.map +1 -0
- package/dist/types/src/components/FunctionsContainer.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +8 -0
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +2 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +11 -8
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +117 -4
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerSettings.d.ts +6 -0
- package/dist/types/src/components/TriggerSettings.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +3 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +12 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +12 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts +202 -3
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +35 -29
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +22 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/schema.d.ts +54 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +84 -44
- package/src/AutomationPlugin.tsx +20 -33
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +72 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/compute-runtime/compute-runtime.ts +140 -0
- package/src/capabilities/compute-runtime/index.ts +7 -0
- package/src/capabilities/index.ts +4 -5
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +80 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +61 -0
- package/src/cli/commands/index.ts +5 -0
- package/src/cli/commands/trigger/create/index.ts +14 -0
- package/src/cli/commands/trigger/create/queue.ts +89 -0
- package/src/cli/commands/trigger/create/subscription.ts +128 -0
- package/src/cli/commands/trigger/create/timer.ts +93 -0
- package/src/cli/commands/trigger/index.ts +16 -0
- package/src/cli/commands/trigger/list.ts +67 -0
- package/src/cli/commands/trigger/options.ts +59 -0
- package/src/cli/commands/trigger/remove.ts +45 -0
- package/src/cli/commands/trigger/update/index.ts +14 -0
- package/src/cli/commands/trigger/update/queue.ts +195 -0
- package/src/cli/commands/trigger/update/subscription.ts +278 -0
- package/src/cli/commands/trigger/update/timer.ts +193 -0
- package/src/cli/commands/trigger/util.ts +395 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +24 -0
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +17 -18
- package/src/components/AutomationPanel/AutomationPanel.tsx +235 -89
- package/src/components/AutomationSettings.tsx +30 -0
- package/src/components/FunctionsContainer.tsx +19 -14
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +41 -26
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +110 -0
- package/src/components/FunctionsRegistry/index.ts +5 -0
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +41 -34
- package/src/components/TriggerEditor/SpecSelector.tsx +29 -21
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +79 -33
- package/src/components/TriggerEditor/TriggerEditor.tsx +81 -48
- package/src/components/TriggerSettings.tsx +26 -0
- package/src/components/index.ts +1 -1
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useComputeRuntimeCallback.ts +67 -0
- package/src/hooks/useTriggerRuntimeControls.ts +67 -0
- package/src/index.ts +2 -0
- package/src/meta.ts +8 -7
- package/src/testing/test-functions.ts +3 -3
- package/src/translations.ts +15 -4
- package/src/types/capabilities.ts +42 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +7 -0
- package/src/types/schema.ts +52 -0
- package/dist/lib/browser/AutomationContainer-OGNK3HD5.mjs +0 -38
- package/dist/lib/browser/AutomationContainer-OGNK3HD5.mjs.map +0 -7
- package/dist/lib/browser/AutomationPanel-PRIIAXD5.mjs +0 -11
- package/dist/lib/browser/FunctionsContainer-JY7V7PLF.mjs +0 -39
- package/dist/lib/browser/FunctionsContainer-JY7V7PLF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-T34RV5UA.mjs +0 -80
- package/dist/lib/browser/app-graph-builder-T34RV5UA.mjs.map +0 -7
- package/dist/lib/browser/chunk-4E2KPMLB.mjs +0 -39
- package/dist/lib/browser/chunk-4E2KPMLB.mjs.map +0 -7
- package/dist/lib/browser/chunk-C5VOC5EE.mjs +0 -147
- package/dist/lib/browser/chunk-C5VOC5EE.mjs.map +0 -7
- package/dist/lib/browser/chunk-IHAKPP5A.mjs +0 -15
- package/dist/lib/browser/chunk-IHAKPP5A.mjs.map +0 -7
- package/dist/lib/browser/chunk-N5VLW7UZ.mjs +0 -230
- package/dist/lib/browser/chunk-N5VLW7UZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-RHSCK7AU.mjs +0 -94
- package/dist/lib/browser/chunk-RHSCK7AU.mjs.map +0 -7
- package/dist/lib/browser/chunk-VQWJ5UYA.mjs +0 -14
- package/dist/lib/browser/chunk-VQWJ5UYA.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-AX46HSU7.mjs +0 -76
- package/dist/lib/browser/intent-resolver-AX46HSU7.mjs.map +0 -7
- package/dist/lib/browser/react-surface-Z7A272CA.mjs.map +0 -7
- package/dist/lib/browser/types.mjs +0 -8
- package/dist/lib/node/AutomationContainer-B7PSJFIS.cjs +0 -66
- package/dist/lib/node/AutomationContainer-B7PSJFIS.cjs.map +0 -7
- package/dist/lib/node/AutomationPanel-XYLZU4MI.cjs +0 -32
- package/dist/lib/node/AutomationPanel-XYLZU4MI.cjs.map +0 -7
- package/dist/lib/node/FunctionsContainer-4FGOQW5X.cjs +0 -67
- package/dist/lib/node/FunctionsContainer-4FGOQW5X.cjs.map +0 -7
- package/dist/lib/node/FunctionsPanel-EWWAZK3W.cjs +0 -31
- package/dist/lib/node/FunctionsPanel-EWWAZK3W.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-5XRIIV7E.cjs +0 -96
- package/dist/lib/node/app-graph-builder-5XRIIV7E.cjs.map +0 -7
- package/dist/lib/node/chunk-3EF7MLFX.cjs +0 -38
- package/dist/lib/node/chunk-3EF7MLFX.cjs.map +0 -7
- package/dist/lib/node/chunk-6X3XJ4VI.cjs +0 -122
- package/dist/lib/node/chunk-6X3XJ4VI.cjs.map +0 -7
- package/dist/lib/node/chunk-GIIVTK4O.cjs +0 -58
- package/dist/lib/node/chunk-GIIVTK4O.cjs.map +0 -7
- package/dist/lib/node/chunk-IXUCZ3YY.cjs +0 -173
- package/dist/lib/node/chunk-IXUCZ3YY.cjs.map +0 -7
- package/dist/lib/node/chunk-LQ6XK4N5.cjs +0 -253
- package/dist/lib/node/chunk-LQ6XK4N5.cjs.map +0 -7
- package/dist/lib/node/chunk-TH4XDKAY.cjs +0 -49
- package/dist/lib/node/chunk-TH4XDKAY.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -124
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-EAREQZFE.cjs +0 -92
- package/dist/lib/node/intent-resolver-EAREQZFE.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-OI6CDHEI.cjs +0 -87
- package/dist/lib/node/react-surface-OI6CDHEI.cjs.map +0 -7
- package/dist/lib/node/types.cjs +0 -30
- package/dist/lib/node/types.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationContainer-ANCUYDDA.mjs +0 -39
- package/dist/lib/node-esm/AutomationContainer-ANCUYDDA.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-25M5VT3J.mjs +0 -40
- package/dist/lib/node-esm/FunctionsContainer-25M5VT3J.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-DYWAKQM3.mjs +0 -81
- package/dist/lib/node-esm/app-graph-builder-DYWAKQM3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2IH4VB3R.mjs +0 -95
- package/dist/lib/node-esm/chunk-2IH4VB3R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2T2OZC3A.mjs +0 -148
- package/dist/lib/node-esm/chunk-2T2OZC3A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JOJ2NN4.mjs +0 -40
- package/dist/lib/node-esm/chunk-6JOJ2NN4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HCCLRNMJ.mjs +0 -17
- package/dist/lib/node-esm/chunk-HCCLRNMJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UFHDB2OA.mjs +0 -231
- package/dist/lib/node-esm/chunk-UFHDB2OA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WJHKFPX2.mjs +0 -16
- package/dist/lib/node-esm/chunk-WJHKFPX2.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-WXHFNJJI.mjs +0 -77
- package/dist/lib/node-esm/intent-resolver-WXHFNJJI.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-TP6IYSR4.mjs.map +0 -7
- package/dist/lib/node-esm/types.mjs +0 -9
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/AutomationContainer.d.ts +0 -5
- package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -25
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -86
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/capabilities/react-surface.tsx +0 -56
- package/src/components/AutomationContainer.tsx +0 -30
- package/src/types.ts +0 -33
- /package/dist/lib/browser/{AutomationPanel-PRIIAXD5.mjs.map → AutomationPanel-C6MZ22CB.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-LY4IFKR7.mjs.map → FunctionsPanel-RD22LYMR.mjs.map} +0 -0
- /package/dist/lib/browser/{types.mjs.map → hooks/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-Y3ODAHH7.mjs.map → browser/types/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-HVGF5AJP.mjs.map → AutomationPanel-RTBY7YFM.mjs.map} +0 -0
- /package/dist/lib/node-esm/{types.mjs.map → FunctionsPanel-V2DKWYMU.mjs.map} +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
import React, { useCallback } from 'react';
|
|
8
|
+
|
|
9
|
+
import { Function } from '@dxos/functions';
|
|
10
|
+
import { getDeployedFunctions } from '@dxos/functions-runtime/edge';
|
|
11
|
+
import { useClient } from '@dxos/react-client';
|
|
12
|
+
import { Filter, Query, type Space, useQuery } from '@dxos/react-client/echo';
|
|
13
|
+
import { IconButton, useAsyncEffect, useTranslation } from '@dxos/react-ui';
|
|
14
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
15
|
+
import { List } from '@dxos/react-ui-list';
|
|
16
|
+
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
17
|
+
|
|
18
|
+
import { meta } from '../../meta';
|
|
19
|
+
|
|
20
|
+
const grid = 'grid grid-cols-[1fr_1fr_auto] min-bs-[2.5rem]';
|
|
21
|
+
|
|
22
|
+
type FunctionsRegistryProps = {
|
|
23
|
+
space: Space;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
27
|
+
const client = useClient();
|
|
28
|
+
const [loading, setLoading] = useState(true);
|
|
29
|
+
const [functions, setFunctions] = useState<Function.Function[]>([]);
|
|
30
|
+
const { t } = useTranslation(meta.id);
|
|
31
|
+
|
|
32
|
+
const dbFunctions = useQuery(space.db, Filter.type(Function.Function));
|
|
33
|
+
|
|
34
|
+
const state = (func: Function.Function) => {
|
|
35
|
+
const dbFunction = dbFunctions.find((f) => f.key === func.key);
|
|
36
|
+
if (!dbFunction) {
|
|
37
|
+
return 'import';
|
|
38
|
+
}
|
|
39
|
+
if (dbFunction.version === func.version && dbFunction.updated === func.updated) {
|
|
40
|
+
return 'none';
|
|
41
|
+
}
|
|
42
|
+
return 'update';
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
useAsyncEffect(async () => {
|
|
46
|
+
setLoading(true);
|
|
47
|
+
const functions = await getDeployedFunctions(client, true);
|
|
48
|
+
setFunctions(functions);
|
|
49
|
+
setLoading(false);
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
const hanleImportOrUpdate = useCallback(
|
|
53
|
+
async (func: Function.Function) => {
|
|
54
|
+
const functions = await space.db.query(Query.type(Function.Function, { key: func.key })).run();
|
|
55
|
+
const [existingFunc] = functions;
|
|
56
|
+
if (!existingFunc) {
|
|
57
|
+
space.db.add(func);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
Function.setFrom(existingFunc, func);
|
|
61
|
+
},
|
|
62
|
+
[space],
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Settings.Container>
|
|
67
|
+
{functions.length > 0 && (
|
|
68
|
+
<List.Root<Function.Function> items={functions} isItem={Schema.is(Function.Function)} getId={(func) => func.id}>
|
|
69
|
+
{({ items }) => (
|
|
70
|
+
<div role='list' className='flex flex-col is-full'>
|
|
71
|
+
{items?.map((func) => (
|
|
72
|
+
<List.Item<Function.Function>
|
|
73
|
+
key={func.id}
|
|
74
|
+
item={func}
|
|
75
|
+
classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}
|
|
76
|
+
>
|
|
77
|
+
<div className='flex flex-col truncate'>
|
|
78
|
+
<List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
|
|
79
|
+
<div className='text-xs text-description truncate'>{func.key}</div>
|
|
80
|
+
</div>
|
|
81
|
+
<div className='flex flex-col truncate'>
|
|
82
|
+
<div className='text-xs text-description truncate'>{func.version}</div>
|
|
83
|
+
<div className='text-xs text-description truncate'>
|
|
84
|
+
{func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : ''}
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<IconButton
|
|
89
|
+
iconOnly
|
|
90
|
+
icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}
|
|
91
|
+
label={
|
|
92
|
+
state(func) === 'update' ? t('update function button label') : t('import function button label')
|
|
93
|
+
}
|
|
94
|
+
disabled={state(func) === 'none'}
|
|
95
|
+
onClick={() => hanleImportOrUpdate(func)}
|
|
96
|
+
/>
|
|
97
|
+
</List.Item>
|
|
98
|
+
))}
|
|
99
|
+
</div>
|
|
100
|
+
)}
|
|
101
|
+
</List.Root>
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
{functions.length === 0 && !loading && (
|
|
105
|
+
<div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>
|
|
106
|
+
)}
|
|
107
|
+
{loading && <div className='text-center plb-4 text-gray-500'>{t('loading functions')}</div>}
|
|
108
|
+
</Settings.Container>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
@@ -2,29 +2,26 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import type * as SchemaAST from 'effect/SchemaAST';
|
|
5
6
|
import React, { useCallback, useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import { Ref, Type } from '@dxos/echo';
|
|
8
|
-
import { type JsonPath } from '@dxos/echo
|
|
9
|
-
import { type
|
|
10
|
-
import { useOnTransition } from '@dxos/react-ui';
|
|
11
|
-
import { Form, type
|
|
8
|
+
import { type Database, Obj, Ref, Type } from '@dxos/echo';
|
|
9
|
+
import { type JsonPath } from '@dxos/echo/internal';
|
|
10
|
+
import { type Function } from '@dxos/functions';
|
|
11
|
+
import { useOnTransition, useTranslation } from '@dxos/react-ui';
|
|
12
|
+
import { Form, type FormFieldStateProps, type FormRootProps, useFormValues } from '@dxos/react-ui-form';
|
|
13
|
+
|
|
14
|
+
import { meta } from '../../meta';
|
|
12
15
|
|
|
13
16
|
export type FunctionInputEditorProps = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
type: SchemaAST.AST;
|
|
18
|
+
functions: Function.Function[];
|
|
19
|
+
db?: Database.Database;
|
|
20
|
+
} & FormFieldStateProps;
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export const FunctionInputEditor = ({
|
|
22
|
-
functions,
|
|
23
|
-
getValue,
|
|
24
|
-
onValueChange,
|
|
25
|
-
onQueryRefOptions,
|
|
26
|
-
}: FunctionInputEditorProps) => {
|
|
27
|
-
const selectedFunctionValue = useFormValues(['function' as JsonPath]);
|
|
22
|
+
export const FunctionInputEditor = ({ type, functions, db, getValue, onValueChange }: FunctionInputEditorProps) => {
|
|
23
|
+
const { t } = useTranslation(meta.id);
|
|
24
|
+
const selectedFunctionValue = useFormValues(FunctionInputEditor.displayName, ['function' as JsonPath]);
|
|
28
25
|
const selectedFunctionId = useMemo(() => {
|
|
29
26
|
if (Ref.isRef(selectedFunctionValue)) {
|
|
30
27
|
return selectedFunctionValue.dxn.toString().split('dxn:echo:@:').at(1);
|
|
@@ -39,22 +36,30 @@ export const FunctionInputEditor = ({
|
|
|
39
36
|
useOnTransition(
|
|
40
37
|
// Clear function parameter input when the function changes.
|
|
41
38
|
selectedFunctionValue,
|
|
42
|
-
(prevValue) =>
|
|
39
|
+
(prevValue) => {
|
|
40
|
+
if (!Ref.isRef(prevValue) || !Ref.isRef(selectedFunctionValue)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return prevValue.dxn.toString() !== selectedFunctionValue.dxn.toString();
|
|
45
|
+
},
|
|
43
46
|
(currValue) => currValue !== undefined,
|
|
44
|
-
() => onValueChange(
|
|
47
|
+
() => onValueChange(type, {}),
|
|
45
48
|
);
|
|
46
49
|
|
|
47
50
|
const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);
|
|
48
51
|
const effectSchema = useMemo(() => (inputSchema ? Type.toEffectSchema(inputSchema) : undefined), [inputSchema]);
|
|
49
52
|
const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;
|
|
53
|
+
const defaultValues = useMemo(() => {
|
|
54
|
+
const raw = getValue() ?? {};
|
|
55
|
+
return Obj.isObject(raw) ? { ...Obj.getSnapshot(raw) } : { ...raw };
|
|
56
|
+
}, [getValue]);
|
|
50
57
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
(values: any) => {
|
|
55
|
-
onValueChange('object', values);
|
|
58
|
+
const handleValuesChanged = useCallback<NonNullable<FormRootProps['onValuesChanged']>>(
|
|
59
|
+
(values) => {
|
|
60
|
+
onValueChange(type, values);
|
|
56
61
|
},
|
|
57
|
-
[onValueChange],
|
|
62
|
+
[type, onValueChange],
|
|
58
63
|
);
|
|
59
64
|
|
|
60
65
|
if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {
|
|
@@ -63,16 +68,18 @@ export const FunctionInputEditor = ({
|
|
|
63
68
|
|
|
64
69
|
return (
|
|
65
70
|
<>
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<Form
|
|
71
|
+
<Form.Label label={t('function parameters label')} asChild />
|
|
72
|
+
<Form.Root
|
|
73
|
+
key={selectedFunction.id}
|
|
70
74
|
schema={effectSchema}
|
|
71
|
-
|
|
75
|
+
defaultValues={defaultValues}
|
|
76
|
+
db={db}
|
|
72
77
|
onValuesChanged={handleValuesChanged}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
>
|
|
79
|
+
<Form.FieldSet />
|
|
80
|
+
</Form.Root>
|
|
76
81
|
</>
|
|
77
82
|
);
|
|
78
83
|
};
|
|
84
|
+
|
|
85
|
+
FunctionInputEditor.displayName = 'AutomationTrigger.FunctionInputEditor';
|
|
@@ -4,32 +4,38 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Filter, Query } from '@dxos/echo';
|
|
8
|
+
import { Trigger } from '@dxos/functions';
|
|
8
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import {
|
|
10
|
+
import { type FormFieldComponentProps, SelectField, useFormFieldState } from '@dxos/react-ui-form';
|
|
10
11
|
|
|
11
|
-
import {
|
|
12
|
+
import { meta } from '../../meta';
|
|
12
13
|
|
|
13
|
-
export type SpecSelectorProps =
|
|
14
|
+
export type SpecSelectorProps = FormFieldComponentProps;
|
|
14
15
|
|
|
15
16
|
export const SpecSelector = (props: SpecSelectorProps) => {
|
|
16
|
-
const { t } = useTranslation(
|
|
17
|
-
const specProps =
|
|
17
|
+
const { t } = useTranslation(meta.id);
|
|
18
|
+
const specProps = useFormFieldState(SpecSelector.displayName, ['spec' satisfies keyof Trigger.Trigger]);
|
|
18
19
|
|
|
19
20
|
const handleTypeChange = useCallback(
|
|
20
|
-
(_type: any, value: string):
|
|
21
|
+
(_type: any, value: string): Trigger.Spec | undefined => {
|
|
21
22
|
const getDefaultTriggerSpec = (kind: string) => {
|
|
22
23
|
switch (kind) {
|
|
23
|
-
case
|
|
24
|
-
return { kind:
|
|
25
|
-
case
|
|
26
|
-
return {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
case 'timer':
|
|
25
|
+
return { kind: 'timer', cron: '' };
|
|
26
|
+
case 'subscription':
|
|
27
|
+
return {
|
|
28
|
+
kind: 'subscription',
|
|
29
|
+
query: {
|
|
30
|
+
ast: Query.select(Filter.nothing()).ast,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
case 'queue':
|
|
34
|
+
return { kind: 'queue', queue: 'dxn:' };
|
|
35
|
+
case 'email':
|
|
36
|
+
return { kind: 'email' };
|
|
37
|
+
case 'webhook':
|
|
38
|
+
return { kind: 'webhook' };
|
|
33
39
|
default:
|
|
34
40
|
return undefined;
|
|
35
41
|
}
|
|
@@ -41,19 +47,21 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
// Update the entire spec object, not just the `spec.kind`.
|
|
44
|
-
specProps.onValueChange(
|
|
50
|
+
specProps.onValueChange(props.type, defaultSpec);
|
|
45
51
|
},
|
|
46
|
-
[specProps],
|
|
52
|
+
[props.type, specProps],
|
|
47
53
|
);
|
|
48
54
|
|
|
49
55
|
const options = useMemo(
|
|
50
56
|
() =>
|
|
51
|
-
|
|
57
|
+
Trigger.Kinds.map((kind) => ({
|
|
52
58
|
value: kind,
|
|
53
59
|
label: t(`trigger type ${kind}`),
|
|
54
60
|
})),
|
|
55
61
|
[t],
|
|
56
62
|
);
|
|
57
63
|
|
|
58
|
-
return <
|
|
64
|
+
return <SelectField {...props} options={options} onValueChange={handleTypeChange} />;
|
|
59
65
|
};
|
|
66
|
+
|
|
67
|
+
SpecSelector.displayName = 'Form.SpecSelector';
|
|
@@ -2,32 +2,56 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useState } from 'react';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { FunctionType, FunctionTrigger, TriggerKind } from '@dxos/functions';
|
|
8
|
+
import { Filter, Obj, Ref, Tag, Type } from '@dxos/echo';
|
|
9
|
+
import { Function, Trigger } from '@dxos/functions';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
12
11
|
import { faker } from '@dxos/random';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
13
|
+
import { TestSchema, useClientStory, withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
15
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
16
|
+
import { translations as formTranslations } from '@dxos/react-ui-form';
|
|
17
|
+
import { Employer, Organization, Person, Pipeline } from '@dxos/types';
|
|
16
18
|
|
|
17
|
-
import { TriggerEditor } from './TriggerEditor';
|
|
18
19
|
import { functions } from '../../testing';
|
|
19
|
-
import translations from '../../translations';
|
|
20
|
+
import { translations } from '../../translations';
|
|
21
|
+
|
|
22
|
+
import { TriggerEditor, type TriggerEditorProps } from './TriggerEditor';
|
|
23
|
+
|
|
24
|
+
const types = [
|
|
25
|
+
// TODO(burdon): Get label from annotation.
|
|
26
|
+
{ value: Organization.Organization.typename, label: 'Organization' },
|
|
27
|
+
{ value: Person.Person.typename, label: 'Person' },
|
|
28
|
+
{ value: Type.getTypename(Pipeline.Pipeline), label: 'Project' },
|
|
29
|
+
{ value: Employer.Employer.typename, label: 'Employer' },
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const DefaultStory = (props: Partial<TriggerEditorProps>) => {
|
|
33
|
+
const { space } = useClientStory();
|
|
34
|
+
const [trigger, setTrigger] = useState<Trigger.Trigger>();
|
|
35
|
+
const tags = useQuery(space?.db, Filter.type(Tag.Tag));
|
|
20
36
|
|
|
21
|
-
|
|
22
|
-
const spaces = useSpaces();
|
|
23
|
-
const space = spaces[1];
|
|
24
|
-
const [trigger, setTrigger] = useState<FunctionTrigger>();
|
|
25
|
-
useEffect(() => {
|
|
37
|
+
useAsyncEffect(async () => {
|
|
26
38
|
if (!space) {
|
|
27
39
|
return;
|
|
28
40
|
}
|
|
29
41
|
|
|
30
|
-
const
|
|
42
|
+
const functions = await space.db.query(Filter.type(Function.Function)).run();
|
|
43
|
+
const fn = functions.find((fn) => fn.name === 'example.com/function/forex');
|
|
44
|
+
invariant(fn);
|
|
45
|
+
const trigger = space.db.add(
|
|
46
|
+
Trigger.make({
|
|
47
|
+
function: Ref.make(fn),
|
|
48
|
+
spec: { kind: 'webhook' },
|
|
49
|
+
input: {
|
|
50
|
+
from: 'USD',
|
|
51
|
+
to: 'JPY',
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
31
55
|
setTrigger(trigger);
|
|
32
56
|
}, [space]);
|
|
33
57
|
|
|
@@ -36,28 +60,43 @@ const DefaultStory = () => {
|
|
|
36
60
|
}
|
|
37
61
|
|
|
38
62
|
return (
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
63
|
+
<TriggerEditor
|
|
64
|
+
db={space.db}
|
|
65
|
+
trigger={trigger}
|
|
66
|
+
types={types}
|
|
67
|
+
tags={tags}
|
|
68
|
+
onSave={(values) => console.log('on save', values)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
42
71
|
);
|
|
43
72
|
};
|
|
44
73
|
|
|
45
|
-
const meta
|
|
74
|
+
const meta = {
|
|
46
75
|
title: 'plugins/plugin-automation/TriggerEditor',
|
|
47
|
-
component: TriggerEditor,
|
|
76
|
+
component: TriggerEditor as any,
|
|
48
77
|
render: DefaultStory,
|
|
49
78
|
decorators: [
|
|
79
|
+
withTheme(),
|
|
80
|
+
withLayout({ layout: 'column' }),
|
|
50
81
|
withClientProvider({
|
|
51
82
|
createIdentity: true,
|
|
52
83
|
createSpace: true,
|
|
53
|
-
types: [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
84
|
+
types: [Tag.Tag, Function.Function, Trigger.Trigger, TestSchema.ContactType],
|
|
85
|
+
onCreateSpace: ({ space }) => {
|
|
86
|
+
// Tags.
|
|
87
|
+
['Important', 'Investor', 'New'].forEach((label) => {
|
|
88
|
+
space.db.add(Tag.make({ label }));
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// Functions.
|
|
92
|
+
functions.forEach((fn) => {
|
|
93
|
+
space.db.add(Function.make(fn));
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Objects.
|
|
58
97
|
Array.from({ length: 10 }).map(() => {
|
|
59
98
|
return space.db.add(
|
|
60
|
-
Obj.make(ContactType, {
|
|
99
|
+
Obj.make(TestSchema.ContactType, {
|
|
61
100
|
name: faker.person.fullName(),
|
|
62
101
|
identifiers: [],
|
|
63
102
|
}),
|
|
@@ -65,14 +104,21 @@ const meta: Meta = {
|
|
|
65
104
|
});
|
|
66
105
|
},
|
|
67
106
|
}),
|
|
68
|
-
withLayout({ fullscreen: true, classNames: 'flex justify-center m-2' }),
|
|
69
|
-
withTheme,
|
|
70
107
|
],
|
|
71
108
|
parameters: {
|
|
72
|
-
|
|
109
|
+
layout: 'fullscreen',
|
|
110
|
+
translations: [...formTranslations, ...translations],
|
|
73
111
|
},
|
|
74
|
-
}
|
|
112
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
75
113
|
|
|
76
114
|
export default meta;
|
|
77
115
|
|
|
78
|
-
|
|
116
|
+
type Story = StoryObj<typeof meta>;
|
|
117
|
+
|
|
118
|
+
export const Default: Story = {};
|
|
119
|
+
|
|
120
|
+
export const ReadonlySpec: Story = {
|
|
121
|
+
args: {
|
|
122
|
+
readonlySpec: true,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
@@ -5,57 +5,76 @@
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { ComputeGraph } from '@dxos/conductor';
|
|
8
|
-
import {
|
|
8
|
+
import { DXN, type Database, type Query } from '@dxos/echo';
|
|
9
|
+
import { Function, Script, Trigger } from '@dxos/functions';
|
|
10
|
+
import { Filter, Ref, useQuery } from '@dxos/react-client/echo';
|
|
11
|
+
import { Input } from '@dxos/react-ui';
|
|
12
|
+
import { QueryForm, type QueryFormProps } from '@dxos/react-ui-components';
|
|
9
13
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import { FunctionInputEditor
|
|
14
|
+
type ExcludeId,
|
|
15
|
+
Form,
|
|
16
|
+
FormFieldLabel,
|
|
17
|
+
type FormFieldMap,
|
|
18
|
+
type FormRootProps,
|
|
19
|
+
SelectField,
|
|
20
|
+
omitId,
|
|
21
|
+
} from '@dxos/react-ui-form';
|
|
22
|
+
|
|
23
|
+
import { FunctionInputEditor } from './FunctionInputEditor';
|
|
20
24
|
import { SpecSelector } from './SpecSelector';
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
space: Space;
|
|
24
|
-
trigger: FunctionTriggerType;
|
|
25
|
-
onSave?: (trigger: Omit<FunctionTrigger, 'id'>) => void;
|
|
26
|
-
onCancel?: () => void;
|
|
27
|
-
};
|
|
26
|
+
type TriggerFormSchema = ExcludeId<typeof Trigger.Trigger>;
|
|
28
27
|
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
export type TriggerEditorProps = {
|
|
29
|
+
db: Database.Database;
|
|
30
|
+
trigger: Trigger.Trigger;
|
|
31
|
+
// TODO(wittjosiah): This needs to apply to whole spec but currently only applies to spec.kind & spec.query.
|
|
32
|
+
readonlySpec?: boolean;
|
|
33
|
+
} &
|
|
34
|
+
// prettier-ignore
|
|
35
|
+
Pick<QueryFormProps, 'types' | 'tags'> &
|
|
36
|
+
Pick<FormRootProps<TriggerFormSchema>, 'onSave' | 'onCancel'>;
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
const
|
|
38
|
+
export const TriggerEditor = ({ db, types, tags, readonlySpec, trigger, ...formProps }: TriggerEditorProps) => {
|
|
39
|
+
const fieldMap = useCustomInputs({
|
|
40
|
+
db,
|
|
41
|
+
types,
|
|
42
|
+
tags,
|
|
43
|
+
readonlySpec,
|
|
44
|
+
});
|
|
36
45
|
|
|
37
46
|
return (
|
|
38
|
-
<Form
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
schema={FunctionTriggerSchema}
|
|
47
|
+
<Form.Root<TriggerFormSchema>
|
|
48
|
+
{...formProps}
|
|
49
|
+
schema={omitId(Trigger.Trigger)}
|
|
42
50
|
values={trigger}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
db={db}
|
|
52
|
+
fieldMap={fieldMap}
|
|
53
|
+
>
|
|
54
|
+
<Form.Viewport>
|
|
55
|
+
<Form.Content>
|
|
56
|
+
<Form.FieldSet />
|
|
57
|
+
<Form.Actions />
|
|
58
|
+
</Form.Content>
|
|
59
|
+
</Form.Viewport>
|
|
60
|
+
</Form.Root>
|
|
47
61
|
);
|
|
48
62
|
};
|
|
49
63
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
type UseCustomInputsProps = {
|
|
65
|
+
db: Database.Database;
|
|
66
|
+
readonlySpec?: boolean;
|
|
67
|
+
} & Pick<QueryFormProps, 'types' | 'tags'>;
|
|
68
|
+
|
|
69
|
+
const useCustomInputs = ({ db, readonlySpec, types, tags }: UseCustomInputsProps): FormFieldMap => {
|
|
70
|
+
const functions = useQuery(db, Filter.type(Function.Function));
|
|
71
|
+
const workflows = useQuery(db, Filter.type(ComputeGraph));
|
|
72
|
+
const scripts = useQuery(db, Filter.type(Script.Script));
|
|
54
73
|
|
|
55
74
|
return useMemo(
|
|
56
|
-
():
|
|
75
|
+
(): FormFieldMap => ({
|
|
57
76
|
// Function selector.
|
|
58
|
-
['function' satisfies keyof
|
|
77
|
+
['function' satisfies keyof Trigger.Trigger]: (props) => {
|
|
59
78
|
const getValue = useCallback(() => {
|
|
60
79
|
const formValue = props.getValue();
|
|
61
80
|
if (Ref.isRef(formValue)) {
|
|
@@ -66,17 +85,17 @@ const useCustomInputs = (space: Space, onQueryRefOptions: FunctionInputEditorPro
|
|
|
66
85
|
|
|
67
86
|
const handleOnValueChange = useCallback(
|
|
68
87
|
(_type: any, dxnString: string) => {
|
|
69
|
-
const dxn =
|
|
88
|
+
const dxn = DXN.parse(dxnString);
|
|
70
89
|
if (dxn) {
|
|
71
90
|
const ref = Ref.fromDXN(dxn);
|
|
72
|
-
props.onValueChange(
|
|
91
|
+
props.onValueChange(props.type, ref);
|
|
73
92
|
}
|
|
74
93
|
},
|
|
75
|
-
[props.onValueChange],
|
|
94
|
+
[props.type, props.onValueChange],
|
|
76
95
|
);
|
|
77
96
|
|
|
78
97
|
return (
|
|
79
|
-
<
|
|
98
|
+
<SelectField
|
|
80
99
|
{...props}
|
|
81
100
|
getValue={getValue as any}
|
|
82
101
|
onValueChange={handleOnValueChange}
|
|
@@ -86,14 +105,28 @@ const useCustomInputs = (space: Space, onQueryRefOptions: FunctionInputEditorPro
|
|
|
86
105
|
},
|
|
87
106
|
|
|
88
107
|
// Spec selector.
|
|
89
|
-
['spec.kind' as const]: SpecSelector
|
|
108
|
+
['spec.kind' as const]: (props) => <SpecSelector {...props} readonly={readonlySpec} />,
|
|
109
|
+
|
|
110
|
+
// TODO(wittjosiah): Copied from ViewEditor.
|
|
111
|
+
// Query input editor.
|
|
112
|
+
['spec.query' as const]: (props) => {
|
|
113
|
+
const handleChange = useCallback(
|
|
114
|
+
(query: Query.Any) => props.onValueChange(props.type, { ast: query.ast }),
|
|
115
|
+
[props.type, props.onValueChange],
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<Input.Root>
|
|
120
|
+
<FormFieldLabel label={props.label} asChild />
|
|
121
|
+
<QueryForm initialQuery={(props.getValue() as any).ast} types={types} tags={tags} onChange={handleChange} />
|
|
122
|
+
</Input.Root>
|
|
123
|
+
);
|
|
124
|
+
},
|
|
90
125
|
|
|
91
126
|
// Function input editor.
|
|
92
|
-
['input' as const]: (props) =>
|
|
93
|
-
<FunctionInputEditor {...props} functions={functions} onQueryRefOptions={onQueryRefOptions} />
|
|
94
|
-
),
|
|
127
|
+
['input' as const]: (props) => <FunctionInputEditor {...props} functions={functions} db={db} />,
|
|
95
128
|
}),
|
|
96
|
-
[workflows, scripts, functions],
|
|
129
|
+
[workflows, scripts, functions, readonlySpec],
|
|
97
130
|
);
|
|
98
131
|
};
|
|
99
132
|
|
|
@@ -101,7 +134,7 @@ const getWorkflowOptions = (graphs: ComputeGraph[]) => {
|
|
|
101
134
|
return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));
|
|
102
135
|
};
|
|
103
136
|
|
|
104
|
-
const getFunctionOptions = (scripts:
|
|
105
|
-
const getLabel = (fn:
|
|
137
|
+
const getFunctionOptions = (scripts: Script.Script[], functions: Function.Function[]) => {
|
|
138
|
+
const getLabel = (fn: Function.Function) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
|
|
106
139
|
return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:echo:@:${fn.id}` }));
|
|
107
140
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Database } from '@dxos/echo';
|
|
8
|
+
import { Input, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { useTriggerRuntimeControls } from '../hooks';
|
|
12
|
+
import { meta } from '../meta';
|
|
13
|
+
|
|
14
|
+
export const TriggersSettings = ({ db }: { db: Database.Database }) => {
|
|
15
|
+
const { state, start, stop } = useTriggerRuntimeControls(db);
|
|
16
|
+
const isRunning = state?.enabled ?? false;
|
|
17
|
+
const { t } = useTranslation(meta.id);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className='container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]'>
|
|
21
|
+
<Settings.ItemInput title={t('runtime label')} description={t('runtime description')}>
|
|
22
|
+
<Input.Switch classNames='justify-self-end' checked={isRunning} onCheckedChange={isRunning ? stop : start} />
|
|
23
|
+
</Settings.ItemInput>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|