@dxos/plugin-automation 0.8.4-main.72ec0f3 → 0.8.4-main.8360d9e660
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-IGLIQY2N.mjs +11 -0
- package/dist/lib/browser/AutomationSettings-XGJGVBDD.mjs +37 -0
- package/dist/lib/browser/AutomationSettings-XGJGVBDD.mjs.map +7 -0
- package/dist/lib/browser/FunctionsContainer-R4ZMYSFJ.mjs +43 -0
- package/dist/lib/browser/FunctionsContainer-R4ZMYSFJ.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsPanel-CRW6SJUN.mjs → FunctionsPanel-NMA4RYJL.mjs} +3 -3
- package/dist/lib/browser/FunctionsRegistry-TMKAEG5E.mjs +10 -0
- package/dist/lib/browser/TriggerSettings-GW5OEM2G.mjs +11 -0
- package/dist/lib/browser/app-graph-builder-74ILZP25.mjs +83 -0
- package/dist/lib/browser/app-graph-builder-74ILZP25.mjs.map +7 -0
- package/dist/lib/browser/chunk-5WMYSXEH.mjs +83 -0
- package/dist/lib/browser/chunk-5WMYSXEH.mjs.map +7 -0
- package/dist/lib/browser/chunk-75XLBFAG.mjs +97 -0
- package/dist/lib/browser/chunk-75XLBFAG.mjs.map +7 -0
- package/dist/lib/browser/chunk-BWEKRPFJ.mjs +294 -0
- package/dist/lib/browser/chunk-BWEKRPFJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LZQFZO3B.mjs → chunk-EL64ZPPN.mjs} +2 -2
- package/dist/lib/browser/chunk-EL64ZPPN.mjs.map +7 -0
- package/dist/lib/browser/chunk-FUVAC5EC.mjs +96 -0
- package/dist/lib/browser/chunk-FUVAC5EC.mjs.map +7 -0
- package/dist/lib/browser/chunk-LHJEQVX5.mjs +8 -0
- package/dist/lib/browser/chunk-LHJEQVX5.mjs.map +7 -0
- package/dist/lib/browser/chunk-O23LHDEX.mjs +269 -0
- package/dist/lib/browser/chunk-O23LHDEX.mjs.map +7 -0
- package/dist/lib/browser/chunk-PUYY7B5F.mjs +31 -0
- package/dist/lib/browser/chunk-PUYY7B5F.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZBEMNWNY.mjs +93 -0
- package/dist/lib/browser/chunk-ZBEMNWNY.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +1115 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/compute-runtime-I3I2BIRE.mjs +130 -0
- package/dist/lib/browser/compute-runtime-I3I2BIRE.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +3 -3
- package/dist/lib/browser/index.mjs +55 -62
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-NGN4BEWN.mjs +84 -0
- package/dist/lib/browser/operation-resolver-NGN4BEWN.mjs.map +7 -0
- package/dist/lib/browser/react-surface-SXDIM3RM.mjs +65 -0
- package/dist/lib/browser/react-surface-SXDIM3RM.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -4
- package/dist/lib/node-esm/{AutomationPanel-HCVFNHGQ.mjs → AutomationPanel-O2BCQA7P.mjs} +4 -4
- package/dist/lib/node-esm/AutomationPanel-O2BCQA7P.mjs.map +7 -0
- package/dist/lib/node-esm/AutomationSettings-W52ZO2XI.mjs +38 -0
- package/dist/lib/node-esm/AutomationSettings-W52ZO2XI.mjs.map +7 -0
- package/dist/lib/node-esm/FunctionsContainer-GYRPQZM7.mjs +44 -0
- package/dist/lib/node-esm/FunctionsContainer-GYRPQZM7.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsPanel-RVVCS6VH.mjs → FunctionsPanel-DCXXLSVP.mjs} +3 -3
- package/dist/lib/node-esm/FunctionsPanel-DCXXLSVP.mjs.map +7 -0
- package/dist/lib/node-esm/FunctionsRegistry-7WCHC64E.mjs +11 -0
- package/dist/lib/node-esm/FunctionsRegistry-7WCHC64E.mjs.map +7 -0
- package/dist/lib/node-esm/TriggerSettings-2GKFPECW.mjs +12 -0
- package/dist/lib/node-esm/TriggerSettings-2GKFPECW.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-VDXPOWCH.mjs +84 -0
- package/dist/lib/node-esm/app-graph-builder-VDXPOWCH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6JVB3IHW.mjs +97 -0
- package/dist/lib/node-esm/chunk-6JVB3IHW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BNWZ2NNI.mjs +32 -0
- package/dist/lib/node-esm/chunk-BNWZ2NNI.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-FPXVLTEY.mjs +270 -0
- package/dist/lib/node-esm/chunk-FPXVLTEY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-K7T2MVB7.mjs +98 -0
- package/dist/lib/node-esm/chunk-K7T2MVB7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Q5JSKD6Z.mjs +295 -0
- package/dist/lib/node-esm/chunk-Q5JSKD6Z.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-V3VUE2NR.mjs +10 -0
- package/dist/lib/node-esm/chunk-V3VUE2NR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CEVIVRTY.mjs → chunk-WC5AT7B3.mjs} +2 -2
- package/dist/lib/node-esm/chunk-WC5AT7B3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XCFO2IXT.mjs +84 -0
- package/dist/lib/node-esm/chunk-XCFO2IXT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PICJ2REN.mjs → chunk-XQO3HK62.mjs} +30 -37
- package/dist/lib/node-esm/chunk-XQO3HK62.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +1116 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/compute-runtime-7HCSIYFG.mjs +131 -0
- package/dist/lib/node-esm/compute-runtime-7HCSIYFG.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +3 -3
- package/dist/lib/node-esm/index.mjs +55 -62
- 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-ANGACQZG.mjs +85 -0
- package/dist/lib/node-esm/operation-resolver-ANGACQZG.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-QVLVDEVW.mjs +66 -0
- package/dist/lib/node-esm/react-surface-QVLVDEVW.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +10 -4
- 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 -5
- 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 +4 -5
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +2 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.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.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 +10 -7
- 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 +7 -6
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +72 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +4 -0
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts +3 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/FunctionsContainer}/FunctionsContainer.d.ts +0 -1
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
- package/dist/types/src/containers/FunctionsContainer/index.d.ts +3 -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/useComputeRuntimeCallback.d.ts +6 -6
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +4 -3
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- 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 +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +23 -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 +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +32 -3
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +67 -50
- package/src/AutomationPlugin.tsx +14 -33
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +73 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/compute-runtime/compute-runtime.ts +155 -0
- package/src/capabilities/compute-runtime/index.ts +7 -0
- package/src/capabilities/index.ts +4 -8
- 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 +57 -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 +404 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +24 -0
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +3 -3
- package/src/components/AutomationPanel/AutomationPanel.tsx +165 -69
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +17 -24
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +18 -43
- package/src/components/FunctionsRegistry/index.ts +4 -1
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +32 -31
- package/src/components/TriggerEditor/SpecSelector.tsx +9 -7
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +75 -30
- package/src/components/TriggerEditor/TriggerEditor.tsx +90 -45
- package/src/components/index.ts +1 -2
- package/src/{components → containers/AutomationSettings}/AutomationSettings.tsx +9 -12
- package/src/containers/AutomationSettings/index.ts +7 -0
- package/src/{components → containers/FunctionsContainer}/FunctionsContainer.tsx +10 -13
- package/src/containers/FunctionsContainer/index.ts +7 -0
- package/src/containers/TriggerSettings/TriggerSettings.tsx +26 -0
- package/src/containers/TriggerSettings/index.ts +6 -0
- package/src/containers/index.ts +9 -0
- package/src/hooks/useComputeRuntimeCallback.ts +10 -11
- package/src/hooks/useTriggerRuntimeControls.ts +28 -14
- package/src/index.ts +1 -2
- package/src/meta.ts +3 -3
- package/src/testing/test-functions.ts +6 -6
- package/src/translations.ts +4 -0
- package/src/{capabilities → types}/capabilities.ts +11 -7
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +24 -3
- package/dist/lib/browser/AutomationPanel-7OECLR5N.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-KCZISXI6.mjs +0 -68
- package/dist/lib/browser/AutomationSettings-KCZISXI6.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-MIWEISRR.mjs +0 -151
- package/dist/lib/browser/FunctionsContainer-MIWEISRR.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs +0 -81
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs.map +0 -7
- package/dist/lib/browser/chunk-EPEXQP45.mjs +0 -14
- package/dist/lib/browser/chunk-EPEXQP45.mjs.map +0 -7
- package/dist/lib/browser/chunk-JW7XSPYW.mjs +0 -267
- package/dist/lib/browser/chunk-JW7XSPYW.mjs.map +0 -7
- package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-NAPXRXTY.mjs +0 -100
- package/dist/lib/browser/chunk-NAPXRXTY.mjs.map +0 -7
- package/dist/lib/browser/chunk-QKFBHAGN.mjs +0 -184
- package/dist/lib/browser/chunk-QKFBHAGN.mjs.map +0 -7
- package/dist/lib/browser/chunk-TWWFNOIR.mjs +0 -109
- package/dist/lib/browser/chunk-TWWFNOIR.mjs.map +0 -7
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs +0 -15
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs.map +0 -7
- package/dist/lib/browser/chunk-YBPJCY3F.mjs +0 -38
- package/dist/lib/browser/chunk-YBPJCY3F.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs +0 -113
- package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs +0 -77
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs.map +0 -7
- package/dist/lib/browser/react-surface-YQW7WCFW.mjs +0 -64
- package/dist/lib/browser/react-surface-YQW7WCFW.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationSettings-UUUPVNUJ.mjs +0 -69
- package/dist/lib/node-esm/AutomationSettings-UUUPVNUJ.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-6OB3JN5O.mjs +0 -152
- package/dist/lib/node-esm/FunctionsContainer-6OB3JN5O.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs +0 -82
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6YRKST6M.mjs +0 -185
- package/dist/lib/node-esm/chunk-6YRKST6M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CEVIVRTY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CPP35BE6.mjs +0 -16
- package/dist/lib/node-esm/chunk-CPP35BE6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs +0 -39
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs +0 -16
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PICJ2REN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs +0 -110
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W76WUTZY.mjs +0 -268
- package/dist/lib/node-esm/chunk-W76WUTZY.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-URROOC34.mjs +0 -114
- package/dist/lib/node-esm/compute-runtime-URROOC34.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs +0 -78
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-NNHYNBO6.mjs +0 -65
- package/dist/lib/node-esm/react-surface-NNHYNBO6.mjs.map +0 -7
- 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/capabilities.d.ts +0 -20
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
- package/dist/types/src/capabilities/compute-runtime.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/AutomationSettings.d.ts +0 -5
- package/dist/types/src/components/AutomationSettings.d.ts.map +0 -1
- 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/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -87
- package/src/capabilities/compute-runtime.ts +0 -127
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/capabilities/react-surface.tsx +0 -56
- package/src/components/TriggerSettings.tsx +0 -25
- package/src/events.ts +0 -11
- /package/dist/lib/browser/{AutomationPanel-7OECLR5N.mjs.map → AutomationPanel-IGLIQY2N.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-CRW6SJUN.mjs.map → FunctionsPanel-NMA4RYJL.mjs.map} +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-HCVFNHGQ.mjs.map → browser/FunctionsRegistry-TMKAEG5E.mjs.map} +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-RVVCS6VH.mjs.map → browser/TriggerSettings-GW5OEM2G.mjs.map} +0 -0
|
@@ -6,43 +6,52 @@ import * as Array from 'effect/Array';
|
|
|
6
6
|
import * as EFn from 'effect/Function';
|
|
7
7
|
import * as Match from 'effect/Match';
|
|
8
8
|
import * as Schema from 'effect/Schema';
|
|
9
|
-
import React, { useMemo, useState } from 'react';
|
|
9
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
10
10
|
|
|
11
11
|
import { Filter, Obj, Tag } from '@dxos/echo';
|
|
12
12
|
import { Function, Script, Trigger } from '@dxos/functions';
|
|
13
|
+
import { KEY_QUEUE_CURSOR } from '@dxos/functions-runtime';
|
|
14
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
13
15
|
import { useTypeOptions } from '@dxos/plugin-space';
|
|
14
16
|
import { type Client, useClient } from '@dxos/react-client';
|
|
15
|
-
import { type Space,
|
|
16
|
-
import { Clipboard, IconButton, Input, Separator,
|
|
17
|
-
import {
|
|
17
|
+
import { type Space, useObject, useQuery } from '@dxos/react-client/echo';
|
|
18
|
+
import { Clipboard, IconButton, type IconButtonProps, Input, Separator, useTranslation } from '@dxos/react-ui';
|
|
19
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
18
20
|
import { List } from '@dxos/react-ui-list';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
21
|
+
import { Pipeline } from '@dxos/types';
|
|
22
|
+
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
23
|
+
import { isNonNullable } from '@dxos/util';
|
|
22
24
|
|
|
23
25
|
import { meta } from '../../meta';
|
|
24
26
|
import { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';
|
|
25
27
|
|
|
26
|
-
const grid = 'grid grid-cols-[
|
|
28
|
+
const grid = 'grid grid-cols-[40px_1fr_32px_32px] min-h-[2.5rem]';
|
|
27
29
|
|
|
28
|
-
export type AutomationPanelProps =
|
|
30
|
+
export type AutomationPanelProps = {
|
|
29
31
|
space: Space;
|
|
30
|
-
object?: Obj.
|
|
32
|
+
object?: Obj.Unknown;
|
|
31
33
|
initialTrigger?: Trigger.Trigger;
|
|
32
34
|
onDone?: () => void;
|
|
33
|
-
}
|
|
35
|
+
};
|
|
34
36
|
|
|
35
37
|
// TODO(burdon): Factor out common layout with ViewEditor.
|
|
36
|
-
export const AutomationPanel = ({
|
|
38
|
+
export const AutomationPanel = ({ space, object, initialTrigger, onDone }: AutomationPanelProps) => {
|
|
37
39
|
const { t } = useTranslation(meta.id);
|
|
38
40
|
const client = useClient();
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
+
const functionsServiceClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);
|
|
42
|
+
const functions = useQuery(space.db, Filter.type(Function.Function));
|
|
43
|
+
const triggers = useQuery(space.db, Filter.type(Trigger.Trigger));
|
|
41
44
|
const filteredTriggers = useMemo(() => {
|
|
42
45
|
return object ? triggers.filter(triggerMatch(object)) : triggers;
|
|
43
46
|
}, [object, triggers]);
|
|
44
|
-
const tags = useQuery(space, Filter.type(Tag.Tag));
|
|
45
|
-
const types = useTypeOptions({
|
|
47
|
+
const tags = useQuery(space.db, Filter.type(Tag.Tag));
|
|
48
|
+
const types = useTypeOptions({
|
|
49
|
+
space,
|
|
50
|
+
annotation: {
|
|
51
|
+
location: ['database', 'runtime'],
|
|
52
|
+
kind: ['user'],
|
|
53
|
+
},
|
|
54
|
+
});
|
|
46
55
|
|
|
47
56
|
const [trigger, setTrigger] = useState<Trigger.Trigger | undefined>(initialTrigger);
|
|
48
57
|
const [selected, setSelected] = useState<Trigger.Trigger>();
|
|
@@ -65,7 +74,9 @@ export const AutomationPanel = ({ classNames, space, object, initialTrigger, onD
|
|
|
65
74
|
|
|
66
75
|
const handleSave: TriggerEditorProps['onSave'] = (trigger) => {
|
|
67
76
|
if (selected) {
|
|
68
|
-
|
|
77
|
+
Obj.change(selected, (mutable) => {
|
|
78
|
+
Object.assign(mutable, trigger);
|
|
79
|
+
});
|
|
69
80
|
} else {
|
|
70
81
|
space.db.add(Trigger.make(trigger));
|
|
71
82
|
}
|
|
@@ -80,11 +91,22 @@ export const AutomationPanel = ({ classNames, space, object, initialTrigger, onD
|
|
|
80
91
|
onDone?.();
|
|
81
92
|
};
|
|
82
93
|
|
|
94
|
+
const handleForceRunTrigger = async (trigger: Trigger.Trigger) => {
|
|
95
|
+
await functionsServiceClient.forceRunCronTrigger(space.id, trigger.id);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const handleResetCursor = async (trigger: Trigger.Trigger) => {
|
|
99
|
+
Obj.change(trigger, (t) => {
|
|
100
|
+
Obj.deleteKeys(t, KEY_QUEUE_CURSOR);
|
|
101
|
+
});
|
|
102
|
+
await space.db.flush({ indexes: true });
|
|
103
|
+
};
|
|
104
|
+
|
|
83
105
|
if (trigger) {
|
|
84
106
|
return (
|
|
85
|
-
<
|
|
107
|
+
<Settings.Item title={t('trigger editor title')} description={t('trigger editor description')}>
|
|
86
108
|
<TriggerEditor
|
|
87
|
-
|
|
109
|
+
db={space.db}
|
|
88
110
|
trigger={trigger}
|
|
89
111
|
readonlySpec={Boolean(object)}
|
|
90
112
|
tags={tags}
|
|
@@ -92,12 +114,12 @@ export const AutomationPanel = ({ classNames, space, object, initialTrigger, onD
|
|
|
92
114
|
onSave={handleSave}
|
|
93
115
|
onCancel={handleCancel}
|
|
94
116
|
/>
|
|
95
|
-
</
|
|
117
|
+
</Settings.Item>
|
|
96
118
|
);
|
|
97
119
|
}
|
|
98
120
|
|
|
99
121
|
return (
|
|
100
|
-
<
|
|
122
|
+
<Settings.Container>
|
|
101
123
|
{filteredTriggers.length > 0 && (
|
|
102
124
|
<List.Root<Trigger.Trigger>
|
|
103
125
|
items={filteredTriggers}
|
|
@@ -105,67 +127,141 @@ export const AutomationPanel = ({ classNames, space, object, initialTrigger, onD
|
|
|
105
127
|
getId={(field) => field.id}
|
|
106
128
|
>
|
|
107
129
|
{({ items: filteredTriggers }) => (
|
|
108
|
-
<div role='list' className='flex flex-col
|
|
109
|
-
{filteredTriggers?.map((trigger) =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
onCheckedChange={(checked) => (trigger.enabled = checked)}
|
|
121
|
-
/>
|
|
122
|
-
</Input.Root>
|
|
123
|
-
|
|
124
|
-
<div className={'flex'}>
|
|
125
|
-
<List.ItemTitle
|
|
126
|
-
classNames='pli-1 cursor-pointer is-0 shrink truncate'
|
|
127
|
-
onClick={() => handleSelect(trigger)}
|
|
128
|
-
>
|
|
129
|
-
{getFunctionName(functions, trigger) ?? '∅'}
|
|
130
|
-
</List.ItemTitle>
|
|
131
|
-
|
|
132
|
-
{/* TODO: a better way to expose copy action */}
|
|
133
|
-
{copyAction && (
|
|
134
|
-
<Clipboard.IconButton
|
|
135
|
-
label={t(copyAction.translationKey)}
|
|
136
|
-
value={copyAction.contentProvider()}
|
|
137
|
-
/>
|
|
138
|
-
)}
|
|
139
|
-
</div>
|
|
140
|
-
|
|
141
|
-
<List.ItemDeleteButton onClick={() => handleDelete(trigger)} />
|
|
142
|
-
</List.Item>
|
|
143
|
-
);
|
|
144
|
-
})}
|
|
130
|
+
<div role='list' className='flex flex-col w-full'>
|
|
131
|
+
{filteredTriggers?.map((trigger) => (
|
|
132
|
+
<TriggerListItem
|
|
133
|
+
key={trigger.id}
|
|
134
|
+
trigger={trigger}
|
|
135
|
+
functions={functions}
|
|
136
|
+
onSelect={handleSelect}
|
|
137
|
+
onDelete={handleDelete}
|
|
138
|
+
onResetCursor={handleResetCursor}
|
|
139
|
+
onForceRun={handleForceRunTrigger}
|
|
140
|
+
/>
|
|
141
|
+
))}
|
|
145
142
|
</div>
|
|
146
143
|
)}
|
|
147
144
|
</List.Root>
|
|
148
145
|
)}
|
|
149
|
-
|
|
146
|
+
|
|
147
|
+
{filteredTriggers.length > 0 && <Separator classNames='my-4' />}
|
|
150
148
|
<IconButton icon='ph--plus--regular' label={t('new trigger label')} onClick={handleAdd} />
|
|
151
|
-
</
|
|
149
|
+
</Settings.Container>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const TriggerListItem = ({
|
|
154
|
+
trigger,
|
|
155
|
+
functions,
|
|
156
|
+
onSelect,
|
|
157
|
+
onDelete,
|
|
158
|
+
onResetCursor,
|
|
159
|
+
onForceRun,
|
|
160
|
+
}: {
|
|
161
|
+
trigger: Trigger.Trigger;
|
|
162
|
+
functions: Function.Function[];
|
|
163
|
+
onSelect?: (trigger: Trigger.Trigger) => void;
|
|
164
|
+
onDelete?: (trigger: Trigger.Trigger) => void;
|
|
165
|
+
onResetCursor?: (trigger: Trigger.Trigger) => void;
|
|
166
|
+
onForceRun?: (trigger: Trigger.Trigger) => void;
|
|
167
|
+
}) => {
|
|
168
|
+
const client = useClient();
|
|
169
|
+
const copyAction = getCopyAction(client, trigger);
|
|
170
|
+
const { t } = useTranslation(meta.id);
|
|
171
|
+
const cursor = Obj.getKeys(trigger, KEY_QUEUE_CURSOR).at(0)?.id;
|
|
172
|
+
const [snapshot, updateTrigger] = useObject(trigger);
|
|
173
|
+
|
|
174
|
+
const enabled = snapshot.enabled ?? false;
|
|
175
|
+
const onEnabledChange = (checked: boolean) => {
|
|
176
|
+
updateTrigger((trigger) => {
|
|
177
|
+
trigger.enabled = checked;
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const handleSelect = useCallback(() => {
|
|
182
|
+
onSelect?.(trigger);
|
|
183
|
+
}, [onSelect, trigger]);
|
|
184
|
+
|
|
185
|
+
const handleDelete = useCallback(() => {
|
|
186
|
+
onDelete?.(trigger);
|
|
187
|
+
}, [onDelete, trigger]);
|
|
188
|
+
|
|
189
|
+
const handleResetCursor = useCallback(() => {
|
|
190
|
+
onResetCursor?.(trigger);
|
|
191
|
+
}, [onResetCursor, trigger]);
|
|
192
|
+
|
|
193
|
+
const handleForceRun = useCallback(() => {
|
|
194
|
+
onForceRun?.(trigger);
|
|
195
|
+
}, [onForceRun, trigger]);
|
|
196
|
+
|
|
197
|
+
const actionProps = useMemo<IconButtonProps | undefined>(() => {
|
|
198
|
+
if (trigger.spec?.kind === 'timer' && onForceRun) {
|
|
199
|
+
return {
|
|
200
|
+
disabled: !enabled || trigger.spec?.kind !== 'timer',
|
|
201
|
+
icon: 'ph--play--regular',
|
|
202
|
+
label: 'Force run',
|
|
203
|
+
onClick: handleForceRun,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (trigger.spec?.kind === 'queue' && onResetCursor) {
|
|
208
|
+
return {
|
|
209
|
+
disabled: !cursor,
|
|
210
|
+
icon: 'ph--arrow-clockwise--regular',
|
|
211
|
+
label: 'Reset cursor',
|
|
212
|
+
onClick: handleResetCursor,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}, [enabled, trigger.spec?.kind, handleForceRun]);
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<List.Item<Obj.Snapshot<Trigger.Trigger>>
|
|
219
|
+
key={trigger.id}
|
|
220
|
+
item={snapshot}
|
|
221
|
+
classNames={mx(grid, ghostHover, 'items-center', 'px-2')}
|
|
222
|
+
>
|
|
223
|
+
<Input.Root>
|
|
224
|
+
<Input.Switch checked={enabled} onCheckedChange={onEnabledChange} />
|
|
225
|
+
</Input.Root>
|
|
226
|
+
|
|
227
|
+
<div className={'flex'}>
|
|
228
|
+
<List.ItemTitle classNames='px-1 cursor-pointer w-0 shrink truncate' onClick={handleSelect}>
|
|
229
|
+
{getFunctionName(functions, trigger) ?? '∅'}
|
|
230
|
+
{cursor && <div className='text-xs text-description truncate ml-4'>Position: {cursor}</div>}
|
|
231
|
+
</List.ItemTitle>
|
|
232
|
+
|
|
233
|
+
{copyAction && (
|
|
234
|
+
<Clipboard.IconButton label={t(copyAction.translationKey)} value={copyAction.contentProvider()} />
|
|
235
|
+
)}
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
{actionProps ? <List.ItemIconButton {...actionProps} autoHide={false} /> : <div />}
|
|
239
|
+
|
|
240
|
+
{onDelete && <List.ItemDeleteButton onClick={handleDelete} />}
|
|
241
|
+
</List.Item>
|
|
152
242
|
);
|
|
153
243
|
};
|
|
154
244
|
|
|
155
245
|
const getCopyAction = (client: Client, trigger: Trigger.Trigger | undefined) => {
|
|
156
246
|
if (trigger?.spec?.kind === 'email') {
|
|
157
|
-
return {
|
|
247
|
+
return {
|
|
248
|
+
translationKey: 'trigger copy email' as const,
|
|
249
|
+
contentProvider: () => `${Obj.getDatabase(trigger)!.spaceId}@dxos.network`,
|
|
250
|
+
};
|
|
158
251
|
}
|
|
159
252
|
|
|
160
253
|
if (trigger?.spec?.kind === 'webhook') {
|
|
161
|
-
return {
|
|
254
|
+
return {
|
|
255
|
+
translationKey: 'trigger copy url' as const,
|
|
256
|
+
contentProvider: () => getWebhookUrl(client, trigger!),
|
|
257
|
+
};
|
|
162
258
|
}
|
|
163
259
|
|
|
164
260
|
return undefined;
|
|
165
261
|
};
|
|
166
262
|
|
|
167
263
|
const getWebhookUrl = (client: Client, trigger: Trigger.Trigger) => {
|
|
168
|
-
const spaceId =
|
|
264
|
+
const spaceId = Obj.getDatabase(trigger)!.spaceId;
|
|
169
265
|
const edgeUrl = new URL(client.config.values.runtime!.services!.edge!.url!);
|
|
170
266
|
const isSecure = edgeUrl.protocol.startsWith('https') || edgeUrl.protocol.startsWith('wss');
|
|
171
267
|
edgeUrl.protocol = isSecure ? 'https' : 'http';
|
|
@@ -189,11 +285,11 @@ const scriptMatch = (script: Script.Script) => (trigger: Trigger.Trigger) => {
|
|
|
189
285
|
return fn.source?.target === script;
|
|
190
286
|
};
|
|
191
287
|
|
|
192
|
-
const projectMatch = (project:
|
|
288
|
+
const projectMatch = (project: Pipeline.Pipeline) => {
|
|
193
289
|
const viewQueries = EFn.pipe(
|
|
194
|
-
project.
|
|
195
|
-
Array.map((
|
|
196
|
-
Array.filter(
|
|
290
|
+
project.columns,
|
|
291
|
+
Array.map((column) => column.view.target),
|
|
292
|
+
Array.filter(isNonNullable),
|
|
197
293
|
Array.map((view) => Obj.getSnapshot(view).query.ast),
|
|
198
294
|
Array.map((ast) => JSON.stringify(ast)),
|
|
199
295
|
);
|
|
@@ -209,14 +305,14 @@ const projectMatch = (project: Project.Project) => {
|
|
|
209
305
|
};
|
|
210
306
|
};
|
|
211
307
|
|
|
212
|
-
const triggerMatch = Match.type<Obj.
|
|
308
|
+
const triggerMatch = Match.type<Obj.Unknown>().pipe(
|
|
213
309
|
Match.withReturnType<(trigger: Trigger.Trigger) => boolean>(),
|
|
214
310
|
Match.when(
|
|
215
311
|
(obj) => Obj.instanceOf(Script.Script, obj),
|
|
216
312
|
(obj) => scriptMatch(obj),
|
|
217
313
|
),
|
|
218
314
|
Match.when(
|
|
219
|
-
(obj) => Obj.instanceOf(
|
|
315
|
+
(obj) => Obj.instanceOf(Pipeline.Pipeline, obj),
|
|
220
316
|
(obj) => projectMatch(obj),
|
|
221
317
|
),
|
|
222
318
|
Match.orElse((_obj) => () => true),
|
|
@@ -5,30 +5,28 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { LayoutOperation, getObjectPathFromObject } from '@dxos/app-toolkit';
|
|
10
10
|
import { Obj } from '@dxos/echo';
|
|
11
11
|
import { Function, Script } from '@dxos/functions';
|
|
12
|
-
import {
|
|
12
|
+
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
13
13
|
import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
|
|
14
14
|
import { Button, IconButton, useTranslation } from '@dxos/react-ui';
|
|
15
|
-
import {
|
|
15
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
16
16
|
import { List } from '@dxos/react-ui-list';
|
|
17
|
-
import { ghostHover, mx } from '@dxos/
|
|
17
|
+
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
18
18
|
|
|
19
19
|
import { meta } from '../../meta';
|
|
20
20
|
|
|
21
|
-
const grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';
|
|
22
|
-
|
|
23
21
|
export type FunctionsPanelProps = {
|
|
24
22
|
space: Space;
|
|
25
23
|
};
|
|
26
24
|
|
|
27
25
|
export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
28
26
|
const { t } = useTranslation(meta.id);
|
|
29
|
-
const functions = useQuery(space, Filter.type(Function.Function));
|
|
30
|
-
const scripts = useQuery(space, Filter.type(Script.Script));
|
|
31
|
-
const {
|
|
27
|
+
const functions = useQuery(space.db, Filter.type(Function.Function));
|
|
28
|
+
const scripts = useQuery(space.db, Filter.type(Script.Script));
|
|
29
|
+
const { invokePromise } = useOperationInvoker();
|
|
32
30
|
|
|
33
31
|
const functionToScriptMap = useMemo(
|
|
34
32
|
() =>
|
|
@@ -60,33 +58,28 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
60
58
|
(func: Function.Function) => {
|
|
61
59
|
const script = functionToScriptMap[func.id];
|
|
62
60
|
if (script) {
|
|
63
|
-
void
|
|
64
|
-
createIntent(LayoutAction.Open, {
|
|
65
|
-
part: 'main',
|
|
66
|
-
subject: [Obj.getDXN(script).toString()],
|
|
67
|
-
}),
|
|
68
|
-
);
|
|
61
|
+
void invokePromise(LayoutOperation.Open, { subject: [getObjectPathFromObject(script)] });
|
|
69
62
|
}
|
|
70
63
|
},
|
|
71
|
-
[functionToScriptMap,
|
|
64
|
+
[functionToScriptMap, invokePromise],
|
|
72
65
|
);
|
|
73
66
|
|
|
74
67
|
const handleDelete = useCallback(
|
|
75
|
-
(func: Function.Function) =>
|
|
76
|
-
[
|
|
68
|
+
(func: Function.Function) => invokePromise(SpaceOperation.RemoveObjects, { objects: [func] }),
|
|
69
|
+
[invokePromise],
|
|
77
70
|
);
|
|
78
71
|
|
|
79
72
|
return (
|
|
80
|
-
<
|
|
73
|
+
<Settings.Container>
|
|
81
74
|
{functions.length > 0 && (
|
|
82
75
|
<List.Root<Function.Function> items={functions} isItem={Schema.is(Function.Function)} getId={(func) => func.id}>
|
|
83
76
|
{({ items }) => (
|
|
84
|
-
<div role='list' className='flex flex-col
|
|
77
|
+
<div role='list' className='flex flex-col w-full'>
|
|
85
78
|
{items?.map((func) => (
|
|
86
79
|
<List.Item<Function.Function>
|
|
87
80
|
key={func.id}
|
|
88
81
|
item={func}
|
|
89
|
-
classNames={mx(grid
|
|
82
|
+
classNames={mx('grid grid-cols-[1fr_auto] min-h-[2.5rem] min-h-[3rem] px-2 items-center', ghostHover)}
|
|
90
83
|
>
|
|
91
84
|
<div className='flex flex-col truncate'>
|
|
92
85
|
<List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
|
|
@@ -110,7 +103,7 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
110
103
|
</List.Root>
|
|
111
104
|
)}
|
|
112
105
|
|
|
113
|
-
{functions.length === 0 && <div className='text-center
|
|
114
|
-
</
|
|
106
|
+
{functions.length === 0 && <div className='text-center py-4 text-description'>{t('no functions found')}</div>}
|
|
107
|
+
</Settings.Container>
|
|
115
108
|
);
|
|
116
109
|
};
|
|
@@ -2,27 +2,22 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Array from 'effect/Array';
|
|
6
|
-
import * as EffectFunction from 'effect/Function';
|
|
7
|
-
import * as Order from 'effect/Order';
|
|
8
5
|
import * as Schema from 'effect/Schema';
|
|
9
6
|
import { useState } from 'react';
|
|
10
7
|
import React, { useCallback } from 'react';
|
|
11
8
|
|
|
12
|
-
import { Obj } from '@dxos/echo';
|
|
13
9
|
import { Function } from '@dxos/functions';
|
|
14
10
|
import { getDeployedFunctions } from '@dxos/functions-runtime/edge';
|
|
15
11
|
import { useClient } from '@dxos/react-client';
|
|
16
12
|
import { Filter, Query, type Space, useQuery } from '@dxos/react-client/echo';
|
|
17
|
-
import { useAsyncEffect } from '@dxos/react-ui';
|
|
18
|
-
import {
|
|
19
|
-
import { controlItemClasses } from '@dxos/react-ui-form';
|
|
13
|
+
import { IconButton, useAsyncEffect, useTranslation } from '@dxos/react-ui';
|
|
14
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
20
15
|
import { List } from '@dxos/react-ui-list';
|
|
21
|
-
import { ghostHover, mx } from '@dxos/
|
|
16
|
+
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
22
17
|
|
|
23
18
|
import { meta } from '../../meta';
|
|
24
19
|
|
|
25
|
-
const grid = 'grid grid-cols-[1fr_1fr_auto] min-
|
|
20
|
+
const grid = 'grid grid-cols-[1fr_1fr_auto] min-h-[2.5rem]';
|
|
26
21
|
|
|
27
22
|
type FunctionsRegistryProps = {
|
|
28
23
|
space: Space;
|
|
@@ -34,7 +29,7 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
34
29
|
const [functions, setFunctions] = useState<Function.Function[]>([]);
|
|
35
30
|
const { t } = useTranslation(meta.id);
|
|
36
31
|
|
|
37
|
-
const dbFunctions = useQuery(space, Filter.type(Function.Function));
|
|
32
|
+
const dbFunctions = useQuery(space.db, Filter.type(Function.Function));
|
|
38
33
|
|
|
39
34
|
const state = (func: Function.Function) => {
|
|
40
35
|
const dbFunction = dbFunctions.find((f) => f.key === func.key);
|
|
@@ -49,55 +44,35 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
49
44
|
|
|
50
45
|
useAsyncEffect(async () => {
|
|
51
46
|
setLoading(true);
|
|
52
|
-
const functions = await getDeployedFunctions(client);
|
|
47
|
+
const functions = await getDeployedFunctions(client, true);
|
|
53
48
|
setFunctions(functions);
|
|
54
49
|
setLoading(false);
|
|
55
50
|
}, []);
|
|
56
51
|
|
|
57
|
-
const dedupedFunctions = EffectFunction.pipe(
|
|
58
|
-
functions,
|
|
59
|
-
Array.filter((_) => _.key !== undefined),
|
|
60
|
-
Array.sort(Order.reverse(Order.mapInput(Order.string, (_: Function.Function) => _.updated ?? ''))),
|
|
61
|
-
Array.dedupeWith((self, that) => self.key === that.key),
|
|
62
|
-
Array.sort(Order.mapInput(Order.string, (_: Function.Function) => _.key ?? '')),
|
|
63
|
-
);
|
|
64
|
-
|
|
65
52
|
const hanleImportOrUpdate = useCallback(
|
|
66
53
|
async (func: Function.Function) => {
|
|
67
|
-
const {
|
|
68
|
-
|
|
69
|
-
} = await space.db.query(Query.type(Function.Function, { key: func.key })).run();
|
|
54
|
+
const functions = await space.db.query(Query.type(Function.Function, { key: func.key })).run();
|
|
55
|
+
const [existingFunc] = functions;
|
|
70
56
|
if (!existingFunc) {
|
|
71
57
|
space.db.add(func);
|
|
72
58
|
return;
|
|
73
59
|
}
|
|
74
|
-
existingFunc
|
|
75
|
-
existingFunc.updated = func.updated;
|
|
76
|
-
existingFunc.name = func.name;
|
|
77
|
-
existingFunc.description = func.description;
|
|
78
|
-
// TODO(dmaretskyi): A workaround for an ECHO bug.
|
|
79
|
-
existingFunc.inputSchema = JSON.parse(JSON.stringify(func.inputSchema));
|
|
80
|
-
existingFunc.outputSchema = JSON.parse(JSON.stringify(func.outputSchema));
|
|
81
|
-
Obj.getMeta(existingFunc).keys = JSON.parse(JSON.stringify(Obj.getMeta(func).keys));
|
|
60
|
+
Function.setFrom(existingFunc, func);
|
|
82
61
|
},
|
|
83
62
|
[space],
|
|
84
63
|
);
|
|
85
64
|
|
|
86
65
|
return (
|
|
87
|
-
<
|
|
88
|
-
{
|
|
89
|
-
<List.Root<Function.Function>
|
|
90
|
-
items={dedupedFunctions}
|
|
91
|
-
isItem={Schema.is(Function.Function)}
|
|
92
|
-
getId={(func) => func.id}
|
|
93
|
-
>
|
|
66
|
+
<Settings.Container>
|
|
67
|
+
{functions.length > 0 && (
|
|
68
|
+
<List.Root<Function.Function> items={functions} isItem={Schema.is(Function.Function)} getId={(func) => func.id}>
|
|
94
69
|
{({ items }) => (
|
|
95
|
-
<div role='list' className='flex flex-col
|
|
70
|
+
<div role='list' className='flex flex-col w-full'>
|
|
96
71
|
{items?.map((func) => (
|
|
97
72
|
<List.Item<Function.Function>
|
|
98
73
|
key={func.id}
|
|
99
74
|
item={func}
|
|
100
|
-
classNames={mx(grid, ghostHover, 'items-center', '
|
|
75
|
+
classNames={mx(grid, ghostHover, 'items-center', 'px-2', 'min-h-[3rem]')}
|
|
101
76
|
>
|
|
102
77
|
<div className='flex flex-col truncate'>
|
|
103
78
|
<List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
|
|
@@ -126,10 +101,10 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
126
101
|
</List.Root>
|
|
127
102
|
)}
|
|
128
103
|
|
|
129
|
-
{
|
|
130
|
-
<div className='text-center
|
|
104
|
+
{functions.length === 0 && !loading && (
|
|
105
|
+
<div className='text-center py-4 text-gray-500'>{t('no functions found')}</div>
|
|
131
106
|
)}
|
|
132
|
-
{loading && <div className='text-center
|
|
133
|
-
</
|
|
107
|
+
{loading && <div className='text-center py-4 text-gray-500'>{t('loading functions')}</div>}
|
|
108
|
+
</Settings.Container>
|
|
134
109
|
);
|
|
135
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 {
|
|
8
|
+
import { type Database, JsonSchema, Obj, Ref } from '@dxos/echo';
|
|
8
9
|
import { type JsonPath } from '@dxos/echo/internal';
|
|
9
10
|
import { type Function } from '@dxos/functions';
|
|
10
|
-
import { useOnTransition } from '@dxos/react-ui';
|
|
11
|
-
import { Form, type
|
|
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 = {
|
|
17
|
+
type: SchemaAST.AST;
|
|
14
18
|
functions: Function.Function[];
|
|
15
|
-
|
|
16
|
-
} &
|
|
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);
|
|
@@ -47,20 +44,22 @@ export const FunctionInputEditor = ({
|
|
|
47
44
|
return prevValue.dxn.toString() !== selectedFunctionValue.dxn.toString();
|
|
48
45
|
},
|
|
49
46
|
(currValue) => currValue !== undefined,
|
|
50
|
-
() => onValueChange(
|
|
47
|
+
() => onValueChange(type, {}),
|
|
51
48
|
);
|
|
52
49
|
|
|
53
50
|
const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);
|
|
54
|
-
const effectSchema = useMemo(() => (inputSchema ?
|
|
51
|
+
const effectSchema = useMemo(() => (inputSchema ? JsonSchema.toEffectSchema(inputSchema) : undefined), [inputSchema]);
|
|
55
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]);
|
|
56
57
|
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
(values: any) => {
|
|
61
|
-
onValueChange('object', values);
|
|
58
|
+
const handleValuesChanged = useCallback<NonNullable<FormRootProps['onValuesChanged']>>(
|
|
59
|
+
(values) => {
|
|
60
|
+
onValueChange(type, values);
|
|
62
61
|
},
|
|
63
|
-
[onValueChange],
|
|
62
|
+
[type, onValueChange],
|
|
64
63
|
);
|
|
65
64
|
|
|
66
65
|
if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {
|
|
@@ -69,16 +68,18 @@ export const FunctionInputEditor = ({
|
|
|
69
68
|
|
|
70
69
|
return (
|
|
71
70
|
<>
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<Form
|
|
71
|
+
<Form.Label label={t('function parameters label')} asChild />
|
|
72
|
+
<Form.Root
|
|
73
|
+
key={selectedFunction.id}
|
|
76
74
|
schema={effectSchema}
|
|
77
|
-
|
|
75
|
+
defaultValues={defaultValues}
|
|
76
|
+
db={db}
|
|
78
77
|
onValuesChanged={handleValuesChanged}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
>
|
|
79
|
+
<Form.FieldSet />
|
|
80
|
+
</Form.Root>
|
|
82
81
|
</>
|
|
83
82
|
);
|
|
84
83
|
};
|
|
84
|
+
|
|
85
|
+
FunctionInputEditor.displayName = 'AutomationTrigger.FunctionInputEditor';
|