@dxos/plugin-automation 0.8.4-main.3eb6e50203 → 0.8.4-main.3fbcb4aa9b
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/neutral/AutomationPanel-64U7W3SJ.mjs +11 -0
- package/dist/lib/neutral/AutomationPlugin.mjs +38 -0
- package/dist/lib/neutral/AutomationPlugin.mjs.map +7 -0
- package/dist/lib/{browser/cli/index.mjs → neutral/AutomationPlugin.node.mjs} +138 -133
- package/dist/lib/neutral/AutomationPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AutomationSettings-NNL2AVNT.mjs +31 -0
- package/dist/lib/neutral/AutomationSettings-NNL2AVNT.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsContainer-CU2FVKZF.mjs +38 -0
- package/dist/lib/neutral/FunctionsContainer-CU2FVKZF.mjs.map +7 -0
- package/dist/lib/{browser/chunk-QNEQ23BF.mjs → neutral/FunctionsPanel-GLCUBEDT.mjs} +23 -25
- package/dist/lib/neutral/FunctionsPanel-GLCUBEDT.mjs.map +7 -0
- package/dist/lib/{browser/FunctionsContainer-5NHAAP5H.mjs → neutral/FunctionsRegistry-VRU4FBVH.mjs} +23 -54
- package/dist/lib/neutral/FunctionsRegistry-VRU4FBVH.mjs.map +7 -0
- package/dist/lib/neutral/TriggerSettings-XCHIZPOR.mjs +9 -0
- package/dist/lib/neutral/app-graph-builder-GDCGRYEP.mjs +75 -0
- package/dist/lib/neutral/app-graph-builder-GDCGRYEP.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +15 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +13 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2JP77CMN.mjs +42 -0
- package/dist/lib/neutral/chunk-2JP77CMN.mjs.map +7 -0
- package/dist/lib/{browser/chunk-PZNBEKO5.mjs → neutral/chunk-ATECY555.mjs} +7 -4
- package/dist/lib/{browser/chunk-PZNBEKO5.mjs.map → neutral/chunk-ATECY555.mjs.map} +3 -3
- package/dist/lib/neutral/chunk-DSCOLDT5.mjs +93 -0
- package/dist/lib/neutral/chunk-DSCOLDT5.mjs.map +7 -0
- package/dist/lib/{browser/chunk-C273ZYLE.mjs → neutral/chunk-FKFFU54G.mjs} +53 -41
- package/dist/lib/neutral/chunk-FKFFU54G.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GDNOJOAR.mjs +8 -0
- package/dist/lib/neutral/chunk-GDNOJOAR.mjs.map +7 -0
- package/dist/lib/neutral/chunk-IGGNE2XI.mjs +12 -0
- package/dist/lib/neutral/chunk-IGGNE2XI.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/{node-esm/chunk-EJPZWAGR.mjs → neutral/chunk-N735CP33.mjs} +69 -41
- package/dist/lib/neutral/chunk-N735CP33.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +16 -0
- package/dist/lib/neutral/compute-runtime-2Q5MGOR6.mjs +220 -0
- package/dist/lib/neutral/compute-runtime-2Q5MGOR6.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +13 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-trigger-from-template-5FT7O7OU.mjs +69 -0
- package/dist/lib/neutral/create-trigger-from-template-5FT7O7OU.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +129 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +20 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs +13 -0
- package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-3OGMAMKV.mjs +57 -0
- package/dist/lib/neutral/react-surface-3OGMAMKV.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +47 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +16 -0
- package/dist/types/src/AutomationPlugin.d.ts +1 -0
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/{cli/plugin.d.ts → AutomationPlugin.node.d.ts} +2 -1
- package/dist/types/src/AutomationPlugin.node.d.ts.map +1 -0
- package/dist/types/src/AutomationPlugin.test.d.ts +2 -0
- package/dist/types/src/AutomationPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts +14 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +6 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/commands/index.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/index.d.ts +6 -6
- package/dist/types/src/commands/trigger/create/index.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/queue.d.ts +1 -1
- package/dist/types/src/commands/trigger/create/queue.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/subscription.d.ts +1 -1
- package/dist/types/src/commands/trigger/create/subscription.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/timer.d.ts +1 -1
- package/dist/types/src/commands/trigger/create/timer.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/index.d.ts +7 -7
- package/dist/types/src/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/list.d.ts +1 -1
- package/dist/types/src/commands/trigger/list.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/options.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/remove.d.ts +1 -1
- package/dist/types/src/commands/trigger/remove.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/update/index.d.ts +5 -5
- package/dist/types/src/commands/trigger/update/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/queue.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/subscription.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/timer.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/util.d.ts +4 -4
- package/dist/types/src/commands/trigger/util.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +32 -31
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +3 -1
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +6 -6
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +4 -4
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +96 -92
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +6 -0
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts +2 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts +4 -0
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
- package/dist/types/src/containers/FunctionsContainer/index.d.ts +2 -0
- package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts +6 -0
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntime.d.ts +8 -0
- package/dist/types/src/hooks/useComputeRuntime.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +1 -4
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeService.d.ts +17 -0
- package/dist/types/src/hooks/useComputeRuntimeService.d.ts.map +1 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
- package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +78 -76
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +32 -32
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/AutomationCapabilities.d.ts +22 -0
- package/dist/types/src/types/AutomationCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/AutomationEvents.d.ts +3 -0
- package/dist/types/src/types/AutomationEvents.d.ts.map +1 -0
- package/dist/types/src/types/AutomationOperation.d.ts +19 -0
- package/dist/types/src/types/AutomationOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +9 -30
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +115 -65
- package/src/AutomationPlugin.node.ts +29 -0
- package/src/AutomationPlugin.test.ts +27 -0
- package/src/AutomationPlugin.tsx +11 -9
- package/src/capabilities/app-graph-builder.ts +66 -0
- package/src/capabilities/compute-runtime.ts +325 -0
- package/src/capabilities/index.ts +10 -4
- package/src/capabilities/node.ts +13 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +59 -0
- package/src/{cli/commands → commands}/trigger/create/queue.ts +6 -9
- package/src/{cli/commands → commands}/trigger/create/subscription.ts +10 -13
- package/src/{cli/commands → commands}/trigger/create/timer.ts +6 -9
- package/src/{cli/commands → commands}/trigger/list.ts +7 -4
- package/src/{cli/commands → commands}/trigger/remove.ts +1 -1
- package/src/{cli/commands → commands}/trigger/update/queue.ts +18 -19
- package/src/{cli/commands → commands}/trigger/update/subscription.ts +17 -17
- package/src/{cli/commands → commands}/trigger/update/timer.ts +18 -18
- package/src/{cli/commands → commands}/trigger/util.ts +39 -24
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +8 -7
- package/src/components/AutomationPanel/AutomationPanel.tsx +76 -66
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +31 -27
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +25 -21
- package/src/components/FunctionsRegistry/index.ts +4 -1
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +6 -6
- package/src/components/TriggerEditor/SpecSelector.tsx +17 -13
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +54 -12
- package/src/components/TriggerEditor/TriggerEditor.tsx +45 -17
- package/src/components/index.ts +1 -2
- package/src/containers/AutomationSettings/AutomationSettings.tsx +31 -0
- package/src/containers/AutomationSettings/index.ts +5 -0
- package/src/containers/FunctionsContainer/FunctionsContainer.tsx +33 -0
- package/src/containers/FunctionsContainer/index.ts +5 -0
- package/src/containers/TriggerSettings/TriggerSettings.tsx +48 -0
- package/src/containers/TriggerSettings/index.ts +6 -0
- package/src/containers/index.ts +9 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useComputeRuntime.ts +30 -0
- package/src/hooks/useComputeRuntimeCallback.ts +4 -39
- package/src/hooks/useComputeRuntimeService.ts +64 -0
- package/src/hooks/useTriggerRuntimeControls.ts +6 -3
- package/src/index.ts +0 -4
- package/src/meta.ts +3 -2
- package/src/operations/create-trigger-from-template.ts +72 -0
- package/src/operations/index.ts +7 -0
- package/src/plugin.ts +11 -0
- package/src/testing/test-functions.ts +11 -8
- package/src/translations.ts +39 -38
- package/src/types/AutomationCapabilities.ts +48 -0
- package/src/types/AutomationEvents.ts +11 -0
- package/src/types/AutomationOperation.ts +30 -0
- package/src/types/index.ts +4 -2
- package/src/types/schema.ts +3 -24
- package/dist/lib/browser/AutomationPanel-C6MZ22CB.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-D7UO5V3Q.mjs +0 -57
- package/dist/lib/browser/AutomationSettings-D7UO5V3Q.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-5NHAAP5H.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-RD22LYMR.mjs +0 -10
- package/dist/lib/browser/app-graph-builder-HLARI3VW.mjs +0 -85
- package/dist/lib/browser/app-graph-builder-HLARI3VW.mjs.map +0 -7
- package/dist/lib/browser/chunk-C273ZYLE.mjs.map +0 -7
- package/dist/lib/browser/chunk-JFBUK3WR.mjs +0 -14
- package/dist/lib/browser/chunk-JFBUK3WR.mjs.map +0 -7
- package/dist/lib/browser/chunk-JN7QRQQX.mjs +0 -256
- package/dist/lib/browser/chunk-JN7QRQQX.mjs.map +0 -7
- package/dist/lib/browser/chunk-JOXPQ27I.mjs +0 -83
- package/dist/lib/browser/chunk-JOXPQ27I.mjs.map +0 -7
- package/dist/lib/browser/chunk-O5Y2F33G.mjs +0 -8
- package/dist/lib/browser/chunk-O5Y2F33G.mjs.map +0 -7
- package/dist/lib/browser/chunk-P5AEO35Y.mjs +0 -93
- package/dist/lib/browser/chunk-P5AEO35Y.mjs.map +0 -7
- package/dist/lib/browser/chunk-QNEQ23BF.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-BUBHYS4Y.mjs +0 -119
- package/dist/lib/browser/compute-runtime-BUBHYS4Y.mjs.map +0 -7
- package/dist/lib/browser/hooks/index.mjs +0 -13
- package/dist/lib/browser/index.mjs +0 -123
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-IN2FRGOT.mjs +0 -83
- package/dist/lib/browser/operation-resolver-IN2FRGOT.mjs.map +0 -7
- package/dist/lib/browser/react-surface-246NXXJR.mjs +0 -66
- package/dist/lib/browser/react-surface-246NXXJR.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -14
- package/dist/lib/node-esm/AutomationPanel-RTBY7YFM.mjs +0 -12
- package/dist/lib/node-esm/AutomationSettings-GK4RLSDN.mjs +0 -58
- package/dist/lib/node-esm/AutomationSettings-GK4RLSDN.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-AHHZODM5.mjs +0 -126
- package/dist/lib/node-esm/FunctionsContainer-AHHZODM5.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-V2DKWYMU.mjs +0 -11
- package/dist/lib/node-esm/app-graph-builder-Z2TMQHVX.mjs +0 -86
- package/dist/lib/node-esm/app-graph-builder-Z2TMQHVX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs +0 -19
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AENSLAVD.mjs +0 -99
- package/dist/lib/node-esm/chunk-AENSLAVD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EJPZWAGR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K5Z4UGIO.mjs +0 -16
- package/dist/lib/node-esm/chunk-K5Z4UGIO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-M3UPTGXF.mjs +0 -10
- package/dist/lib/node-esm/chunk-M3UPTGXF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OJEFRZEV.mjs +0 -259
- package/dist/lib/node-esm/chunk-OJEFRZEV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Q7EMIPMW.mjs +0 -94
- package/dist/lib/node-esm/chunk-Q7EMIPMW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs +0 -84
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -1109
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-6UEDBN76.mjs +0 -120
- package/dist/lib/node-esm/compute-runtime-6UEDBN76.mjs.map +0 -7
- package/dist/lib/node-esm/hooks/index.mjs +0 -14
- package/dist/lib/node-esm/index.mjs +0 -124
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-67CEAKXP.mjs +0 -84
- package/dist/lib/node-esm/operation-resolver-67CEAKXP.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-U6762KPI.mjs +0 -67
- package/dist/lib/node-esm/react-surface-U6762KPI.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -15
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts +0 -6
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime/index.d.ts +0 -3
- package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/cli/commands/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/list.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/options.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/remove.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/util.d.ts.map +0 -1
- package/dist/types/src/cli/index.d.ts +0 -2
- package/dist/types/src/cli/index.d.ts.map +0 -1
- package/dist/types/src/cli/plugin.d.ts.map +0 -1
- package/dist/types/src/components/AutomationSettings.d.ts +0 -5
- package/dist/types/src/components/AutomationSettings.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsContainer.d.ts +0 -7
- package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
- package/dist/types/src/components/TriggerSettings.d.ts +0 -6
- package/dist/types/src/components/TriggerSettings.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -22
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -72
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/compute-runtime/compute-runtime.ts +0 -140
- package/src/capabilities/compute-runtime/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -80
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -61
- package/src/cli/index.ts +0 -5
- package/src/cli/plugin.ts +0 -24
- package/src/components/AutomationSettings.tsx +0 -30
- package/src/components/FunctionsContainer.tsx +0 -36
- package/src/components/TriggerSettings.tsx +0 -26
- package/src/types/capabilities.ts +0 -42
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser/AutomationPanel-C6MZ22CB.mjs.map → neutral/AutomationPanel-64U7W3SJ.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-RD22LYMR.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
- /package/dist/lib/{browser/hooks/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/types → neutral/components}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/hooks → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-RTBY7YFM.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-V2DKWYMU.mjs.map → neutral/types/index.mjs.map} +0 -0
- /package/dist/types/src/{cli/commands → commands}/index.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/options.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/update/queue.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/update/subscription.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/update/timer.d.ts +0 -0
- /package/src/{cli/commands → commands}/index.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/create/index.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/index.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/options.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/update/index.ts +0 -0
|
@@ -8,24 +8,27 @@ import * as Match from 'effect/Match';
|
|
|
8
8
|
import * as Schema from 'effect/Schema';
|
|
9
9
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { useTypeOptions } from '@dxos/app-toolkit/ui';
|
|
12
|
+
import { Script, Trigger } from '@dxos/compute';
|
|
13
|
+
import { Operation } from '@dxos/compute';
|
|
14
|
+
import { Context } from '@dxos/context';
|
|
15
|
+
import { Filter, Obj, Query, Tag } from '@dxos/echo';
|
|
13
16
|
import { KEY_QUEUE_CURSOR } from '@dxos/functions-runtime';
|
|
14
17
|
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
15
|
-
import { useTypeOptions } from '@dxos/plugin-space';
|
|
16
18
|
import { type Client, useClient } from '@dxos/react-client';
|
|
17
19
|
import { type Space, useObject, useQuery } from '@dxos/react-client/echo';
|
|
18
|
-
import { Clipboard, IconButton, Input, Separator, useTranslation } from '@dxos/react-ui';
|
|
20
|
+
import { Clipboard, IconButton, type IconButtonProps, Input, Separator, useTranslation } from '@dxos/react-ui';
|
|
19
21
|
import { Settings } from '@dxos/react-ui-form';
|
|
20
22
|
import { List } from '@dxos/react-ui-list';
|
|
21
23
|
import { Pipeline } from '@dxos/types';
|
|
22
24
|
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
23
25
|
import { isNonNullable } from '@dxos/util';
|
|
24
26
|
|
|
25
|
-
import { meta } from '
|
|
27
|
+
import { meta } from '#meta';
|
|
28
|
+
|
|
26
29
|
import { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';
|
|
27
30
|
|
|
28
|
-
const grid = 'grid grid-cols-[40px_1fr_32px_32px] min-
|
|
31
|
+
const grid = 'grid grid-cols-[40px_1fr_32px_32px] min-h-[2.5rem]';
|
|
29
32
|
|
|
30
33
|
export type AutomationPanelProps = {
|
|
31
34
|
space: Space;
|
|
@@ -39,8 +42,11 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
39
42
|
const { t } = useTranslation(meta.id);
|
|
40
43
|
const client = useClient();
|
|
41
44
|
const functionsServiceClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);
|
|
42
|
-
const functions = useQuery(space.db, Filter.type(
|
|
43
|
-
const triggers = useQuery(
|
|
45
|
+
const functions = useQuery(space.db, Filter.type(Operation.PersistentOperation));
|
|
46
|
+
const triggers = useQuery(
|
|
47
|
+
space.db,
|
|
48
|
+
Query.select(Filter.type(Trigger.Trigger)).debugLabel('plugin-automation.AutomationPanel'),
|
|
49
|
+
);
|
|
44
50
|
const filteredTriggers = useMemo(() => {
|
|
45
51
|
return object ? triggers.filter(triggerMatch(object)) : triggers;
|
|
46
52
|
}, [object, triggers]);
|
|
@@ -50,7 +56,6 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
50
56
|
annotation: {
|
|
51
57
|
location: ['database', 'runtime'],
|
|
52
58
|
kind: ['user'],
|
|
53
|
-
registered: ['registered'],
|
|
54
59
|
},
|
|
55
60
|
});
|
|
56
61
|
|
|
@@ -75,8 +80,8 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
75
80
|
|
|
76
81
|
const handleSave: TriggerEditorProps['onSave'] = (trigger) => {
|
|
77
82
|
if (selected) {
|
|
78
|
-
Obj.
|
|
79
|
-
Object.assign(
|
|
83
|
+
Obj.update(selected, (selected) => {
|
|
84
|
+
Object.assign(selected, trigger);
|
|
80
85
|
});
|
|
81
86
|
} else {
|
|
82
87
|
space.db.add(Trigger.make(trigger));
|
|
@@ -93,19 +98,19 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
93
98
|
};
|
|
94
99
|
|
|
95
100
|
const handleForceRunTrigger = async (trigger: Trigger.Trigger) => {
|
|
96
|
-
await functionsServiceClient.forceRunCronTrigger(space.id, trigger.id);
|
|
101
|
+
await functionsServiceClient.forceRunCronTrigger(Context.default(), space.id, trigger.id);
|
|
97
102
|
};
|
|
98
103
|
|
|
99
104
|
const handleResetCursor = async (trigger: Trigger.Trigger) => {
|
|
100
|
-
Obj.
|
|
101
|
-
Obj.deleteKeys(
|
|
105
|
+
Obj.update(trigger, (trigger) => {
|
|
106
|
+
Obj.deleteKeys(trigger, KEY_QUEUE_CURSOR);
|
|
102
107
|
});
|
|
103
108
|
await space.db.flush({ indexes: true });
|
|
104
109
|
};
|
|
105
110
|
|
|
106
111
|
if (trigger) {
|
|
107
112
|
return (
|
|
108
|
-
<Settings.Item title={t('trigger
|
|
113
|
+
<Settings.Item title={t('trigger-editor.title')} description={t('trigger-editor.description')}>
|
|
109
114
|
<TriggerEditor
|
|
110
115
|
db={space.db}
|
|
111
116
|
trigger={trigger}
|
|
@@ -120,34 +125,36 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
return (
|
|
123
|
-
<Settings.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
128
|
+
<Settings.Panel>
|
|
129
|
+
<Clipboard.Provider>
|
|
130
|
+
{filteredTriggers.length > 0 && (
|
|
131
|
+
<List.Root<Trigger.Trigger>
|
|
132
|
+
items={filteredTriggers}
|
|
133
|
+
isItem={Schema.is(Trigger.Trigger)}
|
|
134
|
+
getId={(field) => field.id}
|
|
135
|
+
>
|
|
136
|
+
{({ items: filteredTriggers }) => (
|
|
137
|
+
<div role='list' className='flex flex-col w-full'>
|
|
138
|
+
{filteredTriggers?.map((trigger) => (
|
|
139
|
+
<TriggerListItem
|
|
140
|
+
key={trigger.id}
|
|
141
|
+
trigger={trigger}
|
|
142
|
+
functions={functions}
|
|
143
|
+
onSelect={handleSelect}
|
|
144
|
+
onDelete={handleDelete}
|
|
145
|
+
onResetCursor={handleResetCursor}
|
|
146
|
+
onForceRun={handleForceRunTrigger}
|
|
147
|
+
/>
|
|
148
|
+
))}
|
|
149
|
+
</div>
|
|
150
|
+
)}
|
|
151
|
+
</List.Root>
|
|
152
|
+
)}
|
|
153
|
+
|
|
154
|
+
{filteredTriggers.length > 0 && <Separator classNames='my-4' />}
|
|
155
|
+
<IconButton icon='ph--plus--regular' label={t('new-trigger.label')} onClick={handleAdd} />
|
|
156
|
+
</Clipboard.Provider>
|
|
157
|
+
</Settings.Panel>
|
|
151
158
|
);
|
|
152
159
|
};
|
|
153
160
|
|
|
@@ -160,7 +167,7 @@ const TriggerListItem = ({
|
|
|
160
167
|
onForceRun,
|
|
161
168
|
}: {
|
|
162
169
|
trigger: Trigger.Trigger;
|
|
163
|
-
functions:
|
|
170
|
+
functions: Operation.PersistentOperation[];
|
|
164
171
|
onSelect?: (trigger: Trigger.Trigger) => void;
|
|
165
172
|
onDelete?: (trigger: Trigger.Trigger) => void;
|
|
166
173
|
onResetCursor?: (trigger: Trigger.Trigger) => void;
|
|
@@ -195,18 +202,38 @@ const TriggerListItem = ({
|
|
|
195
202
|
onForceRun?.(trigger);
|
|
196
203
|
}, [onForceRun, trigger]);
|
|
197
204
|
|
|
205
|
+
const actionProps = useMemo<IconButtonProps | undefined>(() => {
|
|
206
|
+
if (trigger.spec?.kind === 'timer' && onForceRun) {
|
|
207
|
+
return {
|
|
208
|
+
disabled: !enabled || trigger.spec?.kind !== 'timer',
|
|
209
|
+
icon: 'ph--play--regular',
|
|
210
|
+
label: 'Force run',
|
|
211
|
+
onClick: handleForceRun,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (trigger.spec?.kind === 'queue' && onResetCursor) {
|
|
216
|
+
return {
|
|
217
|
+
disabled: !cursor,
|
|
218
|
+
icon: 'ph--arrow-clockwise--regular',
|
|
219
|
+
label: 'Reset cursor',
|
|
220
|
+
onClick: handleResetCursor,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}, [enabled, trigger.spec?.kind, handleForceRun]);
|
|
224
|
+
|
|
198
225
|
return (
|
|
199
226
|
<List.Item<Obj.Snapshot<Trigger.Trigger>>
|
|
200
227
|
key={trigger.id}
|
|
201
228
|
item={snapshot}
|
|
202
|
-
classNames={mx(grid, ghostHover, 'items-center', '
|
|
229
|
+
classNames={mx(grid, ghostHover, 'items-center', 'px-2')}
|
|
203
230
|
>
|
|
204
231
|
<Input.Root>
|
|
205
232
|
<Input.Switch checked={enabled} onCheckedChange={onEnabledChange} />
|
|
206
233
|
</Input.Root>
|
|
207
234
|
|
|
208
235
|
<div className={'flex'}>
|
|
209
|
-
<List.ItemTitle classNames='
|
|
236
|
+
<List.ItemTitle classNames='px-1 cursor-pointer w-0 shrink truncate' onClick={handleSelect}>
|
|
210
237
|
{getFunctionName(functions, trigger) ?? '∅'}
|
|
211
238
|
{cursor && <div className='text-xs text-description truncate ml-4'>Position: {cursor}</div>}
|
|
212
239
|
</List.ItemTitle>
|
|
@@ -216,24 +243,7 @@ const TriggerListItem = ({
|
|
|
216
243
|
)}
|
|
217
244
|
</div>
|
|
218
245
|
|
|
219
|
-
{
|
|
220
|
-
<List.ItemButton
|
|
221
|
-
autoHide={false}
|
|
222
|
-
disabled={!enabled || trigger.spec?.kind !== 'timer'}
|
|
223
|
-
icon='ph--play--regular'
|
|
224
|
-
label='Force run'
|
|
225
|
-
onClick={handleForceRun}
|
|
226
|
-
/>
|
|
227
|
-
)}
|
|
228
|
-
{trigger.spec?.kind === 'queue' && onResetCursor && (
|
|
229
|
-
<List.ItemButton
|
|
230
|
-
autoHide={false}
|
|
231
|
-
disabled={!cursor}
|
|
232
|
-
icon='ph--arrow-clockwise--regular'
|
|
233
|
-
label='Reset cursor'
|
|
234
|
-
onClick={handleResetCursor}
|
|
235
|
-
/>
|
|
236
|
-
)}
|
|
246
|
+
{actionProps ? <List.ItemIconButton {...actionProps} autoHide={false} /> : <div />}
|
|
237
247
|
|
|
238
248
|
{onDelete && <List.ItemDeleteButton onClick={handleDelete} />}
|
|
239
249
|
</List.Item>
|
|
@@ -266,7 +276,7 @@ const getWebhookUrl = (client: Client, trigger: Trigger.Trigger) => {
|
|
|
266
276
|
return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();
|
|
267
277
|
};
|
|
268
278
|
|
|
269
|
-
const getFunctionName = (functions:
|
|
279
|
+
const getFunctionName = (functions: Operation.PersistentOperation[], trigger: Trigger.Trigger) => {
|
|
270
280
|
// TODO(wittjosiah): Truncation should be done in the UI.
|
|
271
281
|
// Warning that the List component is currently a can of worms.
|
|
272
282
|
const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;
|
|
@@ -276,7 +286,7 @@ const getFunctionName = (functions: Function.Function[], trigger: Trigger.Trigge
|
|
|
276
286
|
|
|
277
287
|
const scriptMatch = (script: Script.Script) => (trigger: Trigger.Trigger) => {
|
|
278
288
|
const fn = trigger.function?.target;
|
|
279
|
-
if (!Obj.instanceOf(
|
|
289
|
+
if (!Obj.instanceOf(Operation.PersistentOperation, fn)) {
|
|
280
290
|
return false;
|
|
281
291
|
}
|
|
282
292
|
|
|
@@ -6,17 +6,16 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import React, { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
-
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
9
|
+
import { LayoutOperation, getObjectPathFromObject } from '@dxos/app-toolkit';
|
|
10
|
+
import { Operation, Script } from '@dxos/compute';
|
|
11
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
13
12
|
import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
|
|
14
|
-
import {
|
|
13
|
+
import { IconButton, useTranslation } from '@dxos/react-ui';
|
|
15
14
|
import { Settings } from '@dxos/react-ui-form';
|
|
16
15
|
import { List } from '@dxos/react-ui-list';
|
|
17
16
|
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
18
17
|
|
|
19
|
-
import { meta } from '
|
|
18
|
+
import { meta } from '#meta';
|
|
20
19
|
|
|
21
20
|
export type FunctionsPanelProps = {
|
|
22
21
|
space: Space;
|
|
@@ -24,7 +23,7 @@ export type FunctionsPanelProps = {
|
|
|
24
23
|
|
|
25
24
|
export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
26
25
|
const { t } = useTranslation(meta.id);
|
|
27
|
-
const functions = useQuery(space.db, Filter.type(
|
|
26
|
+
const functions = useQuery(space.db, Filter.type(Operation.PersistentOperation));
|
|
28
27
|
const scripts = useQuery(space.db, Filter.type(Script.Script));
|
|
29
28
|
const { invokePromise } = useOperationInvoker();
|
|
30
29
|
|
|
@@ -47,7 +46,7 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
47
46
|
);
|
|
48
47
|
|
|
49
48
|
const getScriptName = useCallback(
|
|
50
|
-
(func:
|
|
49
|
+
(func: Operation.PersistentOperation) => {
|
|
51
50
|
const script = functionToScriptMap[func.id];
|
|
52
51
|
return script?.name;
|
|
53
52
|
},
|
|
@@ -55,48 +54,55 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
55
54
|
);
|
|
56
55
|
|
|
57
56
|
const handleGoToScript = useCallback(
|
|
58
|
-
(func:
|
|
57
|
+
(func: Operation.PersistentOperation) => {
|
|
59
58
|
const script = functionToScriptMap[func.id];
|
|
60
59
|
if (script) {
|
|
61
|
-
void invokePromise(LayoutOperation.Open, { subject: [
|
|
60
|
+
void invokePromise(LayoutOperation.Open, { subject: [getObjectPathFromObject(script)] });
|
|
62
61
|
}
|
|
63
62
|
},
|
|
64
63
|
[functionToScriptMap, invokePromise],
|
|
65
64
|
);
|
|
66
65
|
|
|
67
66
|
const handleDelete = useCallback(
|
|
68
|
-
(func:
|
|
67
|
+
(func: Operation.PersistentOperation) => invokePromise(SpaceOperation.RemoveObjects, { objects: [func] }),
|
|
69
68
|
[invokePromise],
|
|
70
69
|
);
|
|
71
70
|
|
|
72
71
|
return (
|
|
73
|
-
<Settings.
|
|
72
|
+
<Settings.Panel>
|
|
74
73
|
{functions.length > 0 && (
|
|
75
|
-
<List.Root<
|
|
74
|
+
<List.Root<Operation.PersistentOperation>
|
|
75
|
+
items={functions}
|
|
76
|
+
isItem={Schema.is(Operation.PersistentOperation)}
|
|
77
|
+
getId={(func) => func.id}
|
|
78
|
+
>
|
|
76
79
|
{({ items }) => (
|
|
77
|
-
<div role='list' className='flex flex-col
|
|
80
|
+
<div role='list' className='flex flex-col w-full'>
|
|
78
81
|
{items?.map((func) => (
|
|
79
|
-
<List.Item<
|
|
82
|
+
<List.Item<Operation.PersistentOperation>
|
|
80
83
|
key={func.id}
|
|
81
84
|
item={func}
|
|
82
85
|
classNames={mx(
|
|
83
|
-
'grid grid-cols-[
|
|
86
|
+
'grid grid-cols-[1fr_min-content_auto] min-h-[2.5rem] min-h-[3rem] px-2 items-center',
|
|
84
87
|
ghostHover,
|
|
85
88
|
)}
|
|
86
89
|
>
|
|
87
90
|
<div className='flex flex-col truncate'>
|
|
88
91
|
<List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
|
|
89
|
-
{getScriptName(func) && (
|
|
90
|
-
<div className='text-xs text-description truncate'>{getScriptName(func)}</div>
|
|
91
|
-
)}
|
|
92
|
+
{getScriptName(func) && <p className='text-xs text-description truncate'>{getScriptName(func)}</p>}
|
|
92
93
|
</div>
|
|
93
|
-
{functionToScriptMap[func.id] && (
|
|
94
|
-
<
|
|
95
|
-
|
|
94
|
+
{(functionToScriptMap[func.id] && (
|
|
95
|
+
<IconButton
|
|
96
|
+
icon='ph--arrow-square-out--regular'
|
|
97
|
+
iconOnly
|
|
98
|
+
label={t('show-source-button.label')}
|
|
99
|
+
onClick={() => handleGoToScript(func)}
|
|
100
|
+
/>
|
|
101
|
+
)) || <div />}
|
|
96
102
|
<IconButton
|
|
97
|
-
iconOnly
|
|
98
103
|
icon='ph--trash--regular'
|
|
99
|
-
|
|
104
|
+
iconOnly
|
|
105
|
+
label={t('delete-function-button.label')}
|
|
100
106
|
onClick={() => handleDelete(func)}
|
|
101
107
|
/>
|
|
102
108
|
</List.Item>
|
|
@@ -105,8 +111,6 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
105
111
|
)}
|
|
106
112
|
</List.Root>
|
|
107
113
|
)}
|
|
108
|
-
|
|
109
|
-
{functions.length === 0 && <div className='text-center plb-4 text-description'>{t('no functions found')}</div>}
|
|
110
|
-
</Settings.Container>
|
|
114
|
+
</Settings.Panel>
|
|
111
115
|
);
|
|
112
116
|
};
|
|
@@ -6,7 +6,8 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
import React, { useCallback } from 'react';
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import * as OperationModule from '@dxos/compute';
|
|
10
|
+
import { Context } from '@dxos/context';
|
|
10
11
|
import { getDeployedFunctions } from '@dxos/functions-runtime/edge';
|
|
11
12
|
import { useClient } from '@dxos/react-client';
|
|
12
13
|
import { Filter, Query, type Space, useQuery } from '@dxos/react-client/echo';
|
|
@@ -15,9 +16,9 @@ import { Settings } from '@dxos/react-ui-form';
|
|
|
15
16
|
import { List } from '@dxos/react-ui-list';
|
|
16
17
|
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
17
18
|
|
|
18
|
-
import { meta } from '
|
|
19
|
+
import { meta } from '#meta';
|
|
19
20
|
|
|
20
|
-
const grid = 'grid grid-cols-[1fr_1fr_auto] min-
|
|
21
|
+
const grid = 'grid grid-cols-[1fr_1fr_auto] min-h-[2.5rem]';
|
|
21
22
|
|
|
22
23
|
type FunctionsRegistryProps = {
|
|
23
24
|
space: Space;
|
|
@@ -26,12 +27,12 @@ type FunctionsRegistryProps = {
|
|
|
26
27
|
export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
27
28
|
const client = useClient();
|
|
28
29
|
const [loading, setLoading] = useState(true);
|
|
29
|
-
const [functions, setFunctions] = useState<
|
|
30
|
+
const [functions, setFunctions] = useState<OperationModule.Operation.PersistentOperation[]>([]);
|
|
30
31
|
const { t } = useTranslation(meta.id);
|
|
31
32
|
|
|
32
|
-
const dbFunctions = useQuery(space.db, Filter.type(
|
|
33
|
+
const dbFunctions = useQuery(space.db, Filter.type(OperationModule.Operation.PersistentOperation));
|
|
33
34
|
|
|
34
|
-
const state = (func:
|
|
35
|
+
const state = (func: OperationModule.Operation.PersistentOperation) => {
|
|
35
36
|
const dbFunction = dbFunctions.find((f) => f.key === func.key);
|
|
36
37
|
if (!dbFunction) {
|
|
37
38
|
return 'import';
|
|
@@ -44,35 +45,41 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
44
45
|
|
|
45
46
|
useAsyncEffect(async () => {
|
|
46
47
|
setLoading(true);
|
|
47
|
-
const functions = await getDeployedFunctions(client, true);
|
|
48
|
+
const functions = await getDeployedFunctions(Context.default(), client, true);
|
|
48
49
|
setFunctions(functions);
|
|
49
50
|
setLoading(false);
|
|
50
51
|
}, []);
|
|
51
52
|
|
|
52
53
|
const hanleImportOrUpdate = useCallback(
|
|
53
|
-
async (func:
|
|
54
|
-
const functions = await space.db
|
|
54
|
+
async (func: OperationModule.Operation.PersistentOperation) => {
|
|
55
|
+
const functions = await space.db
|
|
56
|
+
.query(Query.type(OperationModule.Operation.PersistentOperation, { key: func.key }))
|
|
57
|
+
.run();
|
|
55
58
|
const [existingFunc] = functions;
|
|
56
59
|
if (!existingFunc) {
|
|
57
60
|
space.db.add(func);
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
60
|
-
|
|
63
|
+
OperationModule.Operation.setFrom(existingFunc, func);
|
|
61
64
|
},
|
|
62
65
|
[space],
|
|
63
66
|
);
|
|
64
67
|
|
|
65
68
|
return (
|
|
66
|
-
<Settings.
|
|
69
|
+
<Settings.Panel>
|
|
67
70
|
{functions.length > 0 && (
|
|
68
|
-
<List.Root<
|
|
71
|
+
<List.Root<OperationModule.Operation.PersistentOperation>
|
|
72
|
+
items={functions}
|
|
73
|
+
isItem={Schema.is(OperationModule.Operation.PersistentOperation)}
|
|
74
|
+
getId={(func) => func.id}
|
|
75
|
+
>
|
|
69
76
|
{({ items }) => (
|
|
70
|
-
<div role='list' className='flex flex-col
|
|
77
|
+
<div role='list' className='flex flex-col w-full'>
|
|
71
78
|
{items?.map((func) => (
|
|
72
|
-
<List.Item<
|
|
79
|
+
<List.Item<OperationModule.Operation.PersistentOperation>
|
|
73
80
|
key={func.id}
|
|
74
81
|
item={func}
|
|
75
|
-
classNames={mx(grid, ghostHover, 'items-center', '
|
|
82
|
+
classNames={mx(grid, ghostHover, 'items-center', 'px-2', 'min-h-[3rem]')}
|
|
76
83
|
>
|
|
77
84
|
<div className='flex flex-col truncate'>
|
|
78
85
|
<List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
|
|
@@ -89,7 +96,7 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
89
96
|
iconOnly
|
|
90
97
|
icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}
|
|
91
98
|
label={
|
|
92
|
-
state(func) === 'update' ? t('update
|
|
99
|
+
state(func) === 'update' ? t('update-function-button.label') : t('import-function-button.label')
|
|
93
100
|
}
|
|
94
101
|
disabled={state(func) === 'none'}
|
|
95
102
|
onClick={() => hanleImportOrUpdate(func)}
|
|
@@ -101,10 +108,7 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
101
108
|
</List.Root>
|
|
102
109
|
)}
|
|
103
110
|
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
)}
|
|
107
|
-
{loading && <div className='text-center plb-4 text-gray-500'>{t('loading functions')}</div>}
|
|
108
|
-
</Settings.Container>
|
|
111
|
+
{loading && <div className='text-center py-4 text-gray-500'>{t('loading-functions.message')}</div>}
|
|
112
|
+
</Settings.Panel>
|
|
109
113
|
);
|
|
110
114
|
};
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
import type * as SchemaAST from 'effect/SchemaAST';
|
|
6
6
|
import React, { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type
|
|
8
|
+
import { type Operation } from '@dxos/compute';
|
|
9
|
+
import { type Database, JsonSchema, Obj, Ref } from '@dxos/echo';
|
|
9
10
|
import { type JsonPath } from '@dxos/echo/internal';
|
|
10
|
-
import { type Function } from '@dxos/functions';
|
|
11
11
|
import { useOnTransition, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
import { Form, type FormFieldStateProps, type FormRootProps, useFormValues } from '@dxos/react-ui-form';
|
|
13
13
|
|
|
14
|
-
import { meta } from '
|
|
14
|
+
import { meta } from '#meta';
|
|
15
15
|
|
|
16
16
|
export type FunctionInputEditorProps = {
|
|
17
17
|
type: SchemaAST.AST;
|
|
18
|
-
functions:
|
|
18
|
+
functions: Operation.PersistentOperation[];
|
|
19
19
|
db?: Database.Database;
|
|
20
20
|
} & FormFieldStateProps;
|
|
21
21
|
|
|
@@ -48,7 +48,7 @@ export const FunctionInputEditor = ({ type, functions, db, getValue, onValueChan
|
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);
|
|
51
|
-
const effectSchema = useMemo(() => (inputSchema ?
|
|
51
|
+
const effectSchema = useMemo(() => (inputSchema ? JsonSchema.toEffectSchema(inputSchema) : undefined), [inputSchema]);
|
|
52
52
|
const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;
|
|
53
53
|
const defaultValues = useMemo(() => {
|
|
54
54
|
const raw = getValue() ?? {};
|
|
@@ -68,7 +68,7 @@ export const FunctionInputEditor = ({ type, functions, db, getValue, onValueChan
|
|
|
68
68
|
|
|
69
69
|
return (
|
|
70
70
|
<>
|
|
71
|
-
<Form.Label label={t('function
|
|
71
|
+
<Form.Label label={t('function-parameters.label')} asChild />
|
|
72
72
|
<Form.Root
|
|
73
73
|
key={selectedFunction.id}
|
|
74
74
|
schema={effectSchema}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import { Trigger } from '@dxos/compute';
|
|
7
8
|
import { Filter, Query } from '@dxos/echo';
|
|
8
|
-
import { Trigger } from '@dxos/functions';
|
|
9
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { type FormFieldComponentProps, SelectField, useFormFieldState } from '@dxos/react-ui-form';
|
|
11
11
|
|
|
12
|
-
import { meta } from '
|
|
12
|
+
import { meta } from '#meta';
|
|
13
13
|
|
|
14
14
|
export type SpecSelectorProps = FormFieldComponentProps;
|
|
15
15
|
|
|
@@ -22,20 +22,15 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
22
22
|
const getDefaultTriggerSpec = (kind: string) => {
|
|
23
23
|
switch (kind) {
|
|
24
24
|
case 'timer':
|
|
25
|
-
return
|
|
25
|
+
return Trigger.specTimer('');
|
|
26
26
|
case 'subscription':
|
|
27
|
-
return
|
|
28
|
-
kind: 'subscription',
|
|
29
|
-
query: {
|
|
30
|
-
ast: Query.select(Filter.nothing()).ast,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
27
|
+
return Trigger.specSubscription(Query.select(Filter.nothing()));
|
|
33
28
|
case 'queue':
|
|
34
|
-
return
|
|
29
|
+
return Trigger.specQueue('dxn:queue:default');
|
|
35
30
|
case 'email':
|
|
36
|
-
return
|
|
31
|
+
return Trigger.specEmail();
|
|
37
32
|
case 'webhook':
|
|
38
|
-
return
|
|
33
|
+
return Trigger.specWebhook();
|
|
39
34
|
default:
|
|
40
35
|
return undefined;
|
|
41
36
|
}
|
|
@@ -52,11 +47,20 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
52
47
|
[props.type, specProps],
|
|
53
48
|
);
|
|
54
49
|
|
|
50
|
+
const kindLabels: Record<string, string> = {
|
|
51
|
+
timer: t('trigger-type.timer.label'),
|
|
52
|
+
webhook: t('trigger-type.webhook.label'),
|
|
53
|
+
websocket: t('trigger-type.websocket.label'),
|
|
54
|
+
subscription: t('trigger-type.subscription.label'),
|
|
55
|
+
email: t('trigger-type.email.label'),
|
|
56
|
+
queue: t('trigger-type.queue.label'),
|
|
57
|
+
};
|
|
58
|
+
|
|
55
59
|
const options = useMemo(
|
|
56
60
|
() =>
|
|
57
61
|
Trigger.Kinds.map((kind) => ({
|
|
58
62
|
value: kind,
|
|
59
|
-
label:
|
|
63
|
+
label: kindLabels[kind],
|
|
60
64
|
})),
|
|
61
65
|
[t],
|
|
62
66
|
);
|