@dxos/plugin-script 0.8.4-main.7ace549 → 0.8.4-main.8baae0fced
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/LICENSE +102 -5
- package/README.md +15 -13
- package/dist/lib/neutral/DeploymentDialog-6DBF3V6C.mjs +112 -0
- package/dist/lib/neutral/DeploymentDialog-6DBF3V6C.mjs.map +7 -0
- package/dist/lib/{browser/NotebookContainer-MHY3DXDE.mjs → neutral/NotebookArticle-VBBVX4BW.mjs} +245 -299
- package/dist/lib/neutral/NotebookArticle-VBBVX4BW.mjs.map +7 -0
- package/dist/lib/neutral/ScriptArticle-UBT27SB6.mjs +79 -0
- package/dist/lib/neutral/ScriptArticle-UBT27SB6.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.mjs +39 -0
- package/dist/lib/neutral/ScriptPlugin.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs +27 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs +21 -0
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs +31 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs.map +7 -0
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs +297 -0
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs.map +7 -0
- package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs +44 -0
- package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs +52 -0
- package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-T33SBPP2.mjs +15 -0
- package/dist/lib/neutral/blueprint-definition-T33SBPP2.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +10 -0
- package/dist/lib/neutral/capabilities/index.mjs +21 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +17 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2REUEDUA.mjs +56 -0
- package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +7 -0
- package/dist/lib/{browser/chunk-EB6AXFXO.mjs → neutral/chunk-436PZKYX.mjs} +4 -3
- package/dist/lib/neutral/chunk-436PZKYX.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4OWPUMGN.mjs +8 -0
- package/dist/lib/neutral/chunk-4OWPUMGN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-A4LRH25S.mjs +105 -0
- package/dist/lib/neutral/chunk-A4LRH25S.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BDRB6ZX2.mjs +52 -0
- package/dist/lib/neutral/chunk-BDRB6ZX2.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BMO5VOKL.mjs +125 -0
- package/dist/lib/neutral/chunk-BMO5VOKL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs +336 -0
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SNUWHNEW.mjs +8 -0
- package/dist/lib/neutral/chunk-SNUWHNEW.mjs.map +7 -0
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs +150 -0
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +7 -0
- package/dist/lib/neutral/compiler-ODK4UA2N.mjs +101 -0
- package/dist/lib/neutral/compiler-ODK4UA2N.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +721 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +17 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-ZUHIXCBS.mjs +46 -0
- package/dist/lib/neutral/create-ZUHIXCBS.mjs.map +7 -0
- package/dist/lib/neutral/create-object-F2NWICFV.mjs +44 -0
- package/dist/lib/neutral/create-object-F2NWICFV.mjs.map +7 -0
- package/dist/lib/neutral/create-script-H5S4AO47.mjs +45 -0
- package/dist/lib/neutral/create-script-H5S4AO47.mjs.map +7 -0
- package/dist/lib/neutral/delete-PAUWA2QM.mjs +21 -0
- package/dist/lib/neutral/delete-PAUWA2QM.mjs.map +7 -0
- package/dist/lib/neutral/deploy-M73G7HMP.mjs +63 -0
- package/dist/lib/neutral/deploy-M73G7HMP.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +369 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +41 -0
- package/dist/lib/neutral/inspect-invocations-UO27IPCL.mjs +59 -0
- package/dist/lib/neutral/inspect-invocations-UO27IPCL.mjs.map +7 -0
- package/dist/lib/neutral/install-function-MSWSC244.mjs +49 -0
- package/dist/lib/neutral/install-function-MSWSC244.mjs.map +7 -0
- package/dist/lib/neutral/invoke-V6XYXKLD.mjs +32 -0
- package/dist/lib/neutral/invoke-V6XYXKLD.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +10 -0
- package/dist/lib/neutral/operation-handler-KIZ7XZ5G.mjs +18 -0
- package/dist/lib/neutral/operation-handler-KIZ7XZ5G.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/query-deployed-functions-4MMKQ6BR.mjs +34 -0
- package/dist/lib/neutral/query-deployed-functions-4MMKQ6BR.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-K4SSUR57.mjs +120 -0
- package/dist/lib/neutral/react-surface-K4SSUR57.mjs.map +7 -0
- package/dist/lib/neutral/read-FFOSK6A3.mjs +26 -0
- package/dist/lib/neutral/read-FFOSK6A3.mjs.map +7 -0
- package/dist/lib/neutral/settings-VJBW4OMK.mjs +30 -0
- package/dist/lib/neutral/settings-VJBW4OMK.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/templates/index.mjs +1 -1
- package/dist/lib/neutral/translations.mjs +104 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +17 -0
- package/dist/lib/neutral/update-PJS5GG3Y.mjs +63 -0
- package/dist/lib/neutral/update-PJS5GG3Y.mjs.map +7 -0
- package/dist/types/src/ScriptPlugin.d.ts +3 -1
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/ScriptPlugin.node.d.ts +4 -0
- package/dist/types/src/ScriptPlugin.node.d.ts.map +1 -0
- package/dist/types/src/ScriptPlugin.test.d.ts +2 -0
- package/dist/types/src/ScriptPlugin.test.d.ts.map +1 -0
- package/dist/types/src/ScriptPlugin.workerd.d.ts +4 -0
- package/dist/types/src/ScriptPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.d.ts +11 -0
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts +129 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/delete.d.ts +16 -0
- package/dist/types/src/blueprints/functions/delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts +20 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts +4 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +27 -0
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/install-function.d.ts +11 -0
- package/dist/types/src/blueprints/functions/install-function.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/invoke.d.ts +20 -0
- package/dist/types/src/blueprints/functions/invoke.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts +13 -0
- package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/read.d.ts +20 -0
- package/dist/types/src/blueprints/functions/read.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +25 -0
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +3 -2
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -4
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/compiler.d.ts +3 -1
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +16 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +19 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +18 -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 +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +5 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/compiler/compiler.d.ts +1 -1
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/{FrameContainer/FrameContainer.d.ts → FramePanel/FramePanel.d.ts} +3 -3
- package/dist/types/src/components/FramePanel/FramePanel.d.ts.map +1 -0
- package/dist/types/src/components/FramePanel/index.d.ts +2 -0
- package/dist/types/src/components/FramePanel/index.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +4 -4
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts +1 -1
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +5 -3
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +221 -229
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +5 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +13 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/index.d.ts +2 -0
- package/dist/types/src/components/QueryEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts +8 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +1 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts +241 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts +2 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +8 -6
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +221 -229
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts +4 -2
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/index.d.ts +0 -1
- package/dist/types/src/components/TestPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +6 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +3 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +6 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/DeploymentDialog/DeploymentDialog.d.ts +0 -2
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +240 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +2 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/index.d.ts +2 -0
- package/dist/types/src/containers/NotebookArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts +10 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts +242 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +6 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts +242 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts +2 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -0
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts +8 -0
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -0
- package/dist/types/src/containers/TestContainer/index.d.ts +2 -0
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +7 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/e2e/ai.test.d.ts +2 -0
- package/dist/types/src/e2e/ai.test.d.ts.map +1 -0
- package/dist/types/src/e2e/deploy.test.d.ts +2 -0
- package/dist/types/src/e2e/deploy.test.d.ts.map +1 -0
- package/dist/types/src/hooks/deploy.d.ts +20 -26
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +4 -3
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +4 -3
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts +7 -0
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -0
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +8 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -3
- 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/notebook/compute-graph.d.ts +25 -12
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
- package/dist/types/src/notebook/eval.d.ts.map +1 -1
- package/dist/types/src/notebook/vfs-parser.d.ts.map +1 -1
- package/dist/types/src/operations/create-script.d.ts +5 -0
- package/dist/types/src/operations/create-script.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/templates/anthropic.d.ts +7 -0
- package/dist/types/src/templates/anthropic.d.ts.map +1 -0
- package/dist/types/src/templates/chat.d.ts.map +1 -1
- package/dist/types/src/templates/chess-bot.d.ts +12 -0
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
- package/dist/types/src/templates/commentary.d.ts +13 -0
- package/dist/types/src/templates/commentary.d.ts.map +1 -0
- package/dist/types/src/templates/data-generator.d.ts.map +1 -1
- package/dist/types/src/templates/discord.d.ts.map +1 -1
- package/dist/types/src/templates/email.d.ts.map +1 -1
- package/dist/types/src/templates/forex-effect.d.ts +5 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +5 -1
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/gmail.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +33 -24
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +2 -4
- package/dist/types/src/templates/ping.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/simulator.test.d.ts +2 -0
- package/dist/types/src/testing/simulator.test.d.ts.map +1 -0
- package/dist/types/src/testing/test-notebook.d.ts +3 -0
- package/dist/types/src/testing/test-notebook.d.ts.map +1 -0
- package/dist/types/src/testing/test-script.d.ts +7 -0
- package/dist/types/src/testing/test-script.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +222 -92
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +109 -22
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/ScriptCapabilities.d.ts +6 -0
- package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/ScriptEvents.d.ts +3 -0
- package/dist/types/src/types/ScriptEvents.d.ts.map +1 -0
- package/dist/types/src/types/ScriptOperation.d.ts +29 -0
- package/dist/types/src/types/ScriptOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +7 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +1 -5
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts +2 -2
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +2 -2
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +178 -101
- package/src/ScriptPlugin.node.ts +21 -0
- package/src/ScriptPlugin.test.ts +31 -0
- package/src/ScriptPlugin.tsx +23 -80
- package/src/ScriptPlugin.workerd.ts +18 -0
- package/src/blueprints/functions/create.ts +47 -0
- package/src/blueprints/functions/definitions.ts +323 -0
- package/src/blueprints/functions/delete.ts +23 -0
- package/src/blueprints/functions/deploy.ts +71 -0
- package/src/blueprints/functions/index.ts +19 -0
- package/src/blueprints/functions/inspect-invocations.ts +56 -0
- package/src/blueprints/functions/install-function.ts +56 -0
- package/src/blueprints/functions/invoke.ts +34 -0
- package/src/blueprints/functions/query-deployed-functions.ts +35 -0
- package/src/blueprints/functions/read.ts +29 -0
- package/src/blueprints/functions/update.ts +68 -0
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +55 -0
- package/src/capabilities/app-graph-builder.ts +40 -58
- package/src/capabilities/artifact-definition.ts +99 -97
- package/src/capabilities/blueprint-definition.ts +13 -24
- package/src/capabilities/compiler.ts +99 -22
- package/src/capabilities/create-object.ts +48 -0
- package/src/capabilities/index.ts +13 -9
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +21 -0
- package/src/capabilities/react-surface.tsx +120 -93
- package/src/capabilities/settings.ts +26 -14
- package/src/compiler/compiler.ts +21 -3
- package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +7 -6
- package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +42 -32
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +24 -25
- package/src/components/NotebookStack/NotebookStack.tsx +31 -20
- package/src/components/QueryEditor/QueryEditor.stories.tsx +96 -0
- package/src/components/QueryEditor/QueryEditor.tsx +49 -0
- package/src/components/QueryEditor/index.ts +5 -0
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.tsx +32 -0
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.tsx +42 -0
- package/src/components/ScriptPluginSettings/index.ts +5 -0
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +42 -20
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +38 -43
- package/src/components/TestPanel/TestPanel.tsx +110 -194
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +24 -17
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +74 -66
- package/src/components/index.ts +6 -7
- package/src/constants.ts +7 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +63 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +99 -0
- package/src/containers/DeploymentDialog/index.ts +5 -0
- package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +85 -0
- package/src/{components/NotebookContainer.tsx → containers/NotebookArticle/NotebookArticle.tsx} +93 -98
- package/src/containers/NotebookArticle/index.ts +5 -0
- package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +107 -0
- package/src/containers/ScriptArticle/ScriptArticle.tsx +85 -0
- package/src/containers/ScriptArticle/index.ts +5 -0
- package/src/containers/ScriptProperties/BlueprintEditor.tsx +102 -0
- package/src/containers/ScriptProperties/FunctionBinding.tsx +83 -0
- package/src/containers/ScriptProperties/FunctionPublishing.tsx +121 -0
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +76 -0
- package/src/containers/ScriptProperties/ScriptProperties.tsx +24 -0
- package/src/containers/ScriptProperties/index.ts +5 -0
- package/src/containers/TestContainer/TestContainer.tsx +44 -0
- package/src/containers/TestContainer/index.ts +5 -0
- package/src/containers/index.ts +11 -0
- package/src/e2e/ai.test.ts +93 -0
- package/src/e2e/deploy.test.ts +66 -0
- package/src/hooks/deploy.ts +42 -33
- package/src/hooks/format.ts +9 -4
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +19 -12
- package/src/hooks/useCompiler.ts +25 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +15 -20
- package/src/hooks/useToolbarState.ts +29 -4
- package/src/index.ts +2 -4
- package/src/meta.ts +5 -4
- package/src/notebook/compute-graph.test.ts +21 -9
- package/src/notebook/compute-graph.ts +46 -22
- package/src/notebook/vfs-parser.ts +10 -3
- package/src/operations/create-script.ts +46 -0
- package/src/operations/index.ts +7 -0
- package/src/plugin.ts +11 -0
- package/src/templates/anthropic.ts +49 -0
- package/src/templates/chat.ts +1 -1
- package/src/templates/chess-bot.ts +63 -0
- package/src/templates/commentary.ts +248 -0
- package/src/templates/data-generator.ts +2 -2
- package/src/templates/discord.ts +3 -3
- package/src/templates/forex-effect.ts +35 -29
- package/src/templates/forex.ts +27 -17
- package/src/templates/gmail.ts +4 -4
- package/src/templates/index.ts +31 -18
- package/src/templates/ping.ts +22 -5
- package/src/testing/index.ts +2 -1
- package/src/testing/simulator.test.ts +39 -0
- package/src/testing/{data.ts → test-notebook.ts} +11 -12
- package/src/testing/test-script.ts +28 -0
- package/src/translations.ts +86 -87
- package/src/types/Notebook.ts +18 -15
- package/src/types/ScriptCapabilities.ts +18 -0
- package/src/types/ScriptEvents.ts +11 -0
- package/src/types/ScriptOperation.ts +42 -0
- package/src/types/Settings.ts +20 -0
- package/src/types/index.ts +5 -2
- package/src/types/types.ts +1 -11
- package/src/util/deploy.ts +25 -29
- package/src/util/functions.ts +30 -27
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-5TKNGPVR.mjs +0 -14
- package/dist/lib/browser/NotebookContainer-MHY3DXDE.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-CW6YN3DQ.mjs +0 -148
- package/dist/lib/browser/ScriptContainer-CW6YN3DQ.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-2WR2ATTJ.mjs +0 -66
- package/dist/lib/browser/app-graph-builder-2WR2ATTJ.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs +0 -30
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs.map +0 -7
- package/dist/lib/browser/chunk-2G2NA6DQ.mjs +0 -88
- package/dist/lib/browser/chunk-2G2NA6DQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-ALS6X4HU.mjs +0 -304
- package/dist/lib/browser/chunk-ALS6X4HU.mjs.map +0 -7
- package/dist/lib/browser/chunk-EB6AXFXO.mjs.map +0 -7
- package/dist/lib/browser/chunk-M6KJPUJK.mjs +0 -111
- package/dist/lib/browser/chunk-M6KJPUJK.mjs.map +0 -7
- package/dist/lib/browser/chunk-N5EYLQOT.mjs +0 -647
- package/dist/lib/browser/chunk-N5EYLQOT.mjs.map +0 -7
- package/dist/lib/browser/chunk-QIZ3BPRK.mjs +0 -103
- package/dist/lib/browser/chunk-QIZ3BPRK.mjs.map +0 -7
- package/dist/lib/browser/chunk-SAN5Y7FI.mjs +0 -155
- package/dist/lib/browser/chunk-SAN5Y7FI.mjs.map +0 -7
- package/dist/lib/browser/chunk-ULJFT73Q.mjs +0 -513
- package/dist/lib/browser/chunk-ULJFT73Q.mjs.map +0 -7
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs +0 -15
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs.map +0 -7
- package/dist/lib/browser/compiler-4KHRSX7J.mjs +0 -86
- package/dist/lib/browser/compiler-4KHRSX7J.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -268
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-TXTBWOVD.mjs +0 -104
- package/dist/lib/browser/intent-resolver-TXTBWOVD.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-R245YN52.mjs +0 -128
- package/dist/lib/browser/react-surface-R245YN52.mjs.map +0 -7
- package/dist/lib/browser/settings-MHJXRGDF.mjs +0 -26
- package/dist/lib/browser/settings-MHJXRGDF.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -14
- package/dist/lib/node-esm/DeploymentDialog-2ULNOZQH.mjs +0 -15
- package/dist/lib/node-esm/NotebookContainer-U4C2HQ4T.mjs +0 -818
- package/dist/lib/node-esm/NotebookContainer-U4C2HQ4T.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-VRPEKB4T.mjs +0 -149
- package/dist/lib/node-esm/ScriptContainer-VRPEKB4T.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NCVLUL5R.mjs +0 -67
- package/dist/lib/node-esm/app-graph-builder-NCVLUL5R.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs +0 -31
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs +0 -16
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-57JA6XL5.mjs +0 -90
- package/dist/lib/node-esm/chunk-57JA6XL5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HDKR5WCD.mjs +0 -113
- package/dist/lib/node-esm/chunk-HDKR5WCD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IBV2DR36.mjs +0 -33
- package/dist/lib/node-esm/chunk-IBV2DR36.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ND4BPYPR.mjs +0 -156
- package/dist/lib/node-esm/chunk-ND4BPYPR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UEVZP5DN.mjs +0 -648
- package/dist/lib/node-esm/chunk-UEVZP5DN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VJSRZRLI.mjs +0 -514
- package/dist/lib/node-esm/chunk-VJSRZRLI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VTRMJSQL.mjs +0 -305
- package/dist/lib/node-esm/chunk-VTRMJSQL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XYKKDWUR.mjs +0 -104
- package/dist/lib/node-esm/chunk-XYKKDWUR.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-DU5NQISX.mjs +0 -87
- package/dist/lib/node-esm/compiler-DU5NQISX.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -269
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-D6AVAQRA.mjs +0 -105
- package/dist/lib/node-esm/intent-resolver-D6AVAQRA.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-MHT3PJ6C.mjs +0 -129
- package/dist/lib/node-esm/react-surface-MHT3PJ6C.mjs.map +0 -7
- package/dist/lib/node-esm/settings-BVJORMMJ.mjs +0 -27
- package/dist/lib/node-esm/settings-BVJORMMJ.mjs.map +0 -7
- package/dist/lib/node-esm/templates/index.mjs +0 -11
- package/dist/lib/node-esm/types/index.mjs +0 -15
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.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/components/DeploymentDialog/DeploymentDialog.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +0 -251
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/index.d.ts +0 -4
- package/dist/types/src/components/DeploymentDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/frame.d.ts +0 -2
- package/dist/types/src/components/FrameContainer/frame.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/index.d.ts +0 -2
- package/dist/types/src/components/FrameContainer/index.d.ts.map +0 -1
- package/dist/types/src/components/NotebookContainer.d.ts +0 -10
- package/dist/types/src/components/NotebookContainer.d.ts.map +0 -1
- package/dist/types/src/components/NotebookContainer.stories.d.ts +0 -254
- package/dist/types/src/components/NotebookContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/ScriptContainer.d.ts +0 -12
- package/dist/types/src/components/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts +0 -8
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +0 -6
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/index.d.ts +0 -3
- package/dist/types/src/components/Settings/index.d.ts.map +0 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +0 -8
- package/dist/types/src/components/TestPanel/TestContainer.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/dist/types/src/templates/chess.d.ts +0 -3
- package/dist/types/src/templates/chess.d.ts.map +0 -1
- package/dist/types/src/testing/data.d.ts +0 -3
- package/dist/types/src/testing/data.d.ts.map +0 -1
- package/dist/types/src/types/actions.d.ts +0 -54
- package/dist/types/src/types/actions.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/intent-resolver.ts +0 -86
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +0 -58
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +0 -123
- package/src/components/DeploymentDialog/index.ts +0 -9
- package/src/components/FrameContainer/frame.html +0 -25
- package/src/components/FrameContainer/frame.tsx +0 -51
- package/src/components/NotebookContainer.stories.tsx +0 -83
- package/src/components/ScriptContainer.tsx +0 -70
- package/src/components/Settings/ScriptObjectSettings.tsx +0 -298
- package/src/components/Settings/ScriptPluginSettings.tsx +0 -61
- package/src/components/Settings/index.ts +0 -6
- package/src/components/TestPanel/TestContainer.tsx +0 -27
- package/src/events.ts +0 -11
- package/src/templates/chess.ts +0 -49
- package/src/types/actions.ts +0 -53
- /package/dist/lib/{browser/templates → neutral/blueprints}/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser/DeploymentDialog-5TKNGPVR.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/templates → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types → neutral/templates}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-2ULNOZQH.mjs.map → neutral/types/index.mjs.map} +0 -0
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { ClientService } from '@dxos/client';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Database, Feed, Ref } from '@dxos/echo';
|
|
10
|
+
import { trim } from '@dxos/util';
|
|
11
|
+
|
|
12
|
+
const FunctionRef = Ref.Ref(Operation.PersistentOperation).annotations({
|
|
13
|
+
description: 'The ID of the function.',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const FunctionId = Schema.String.annotations({
|
|
17
|
+
description: 'The ID of the function. Can be passed as the function parameter to other operations.',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const FUNCTION_FORMAT = trim`
|
|
21
|
+
IMPORTANT: Every function MUST follow this exact pattern — define an Operation, then export default the handler:
|
|
22
|
+
|
|
23
|
+
\`\`\`typescript
|
|
24
|
+
import * as Effect from 'effect/Effect';
|
|
25
|
+
import * as Schema from 'effect/Schema';
|
|
26
|
+
|
|
27
|
+
import { Operation } from '@dxos/compute';
|
|
28
|
+
|
|
29
|
+
const MyFunction = Operation.make({
|
|
30
|
+
meta: {
|
|
31
|
+
key: 'org.dxos.script.my-function',
|
|
32
|
+
name: 'My Function',
|
|
33
|
+
},
|
|
34
|
+
input: Schema.Struct({
|
|
35
|
+
city: Schema.String.annotations({ description: 'City name' }),
|
|
36
|
+
}),
|
|
37
|
+
output: Schema.Any,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export default MyFunction.pipe(
|
|
41
|
+
Operation.withHandler(
|
|
42
|
+
Effect.fn(function* ({ city }) {
|
|
43
|
+
const res = yield* Effect.promise(() =>
|
|
44
|
+
fetch(\`https://wttr.in/\${city}?format=j1\`)
|
|
45
|
+
);
|
|
46
|
+
const data = yield* Effect.promise(() => res.json());
|
|
47
|
+
return data;
|
|
48
|
+
}),
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
\`\`\`
|
|
52
|
+
|
|
53
|
+
Key rules:
|
|
54
|
+
- The file MUST have a single \`export default\` of Operation.pipe(Operation.withHandler(...)).
|
|
55
|
+
- Use \`Effect.fn(function* (...) { ... })\` for the handler body.
|
|
56
|
+
- Wrap async calls with \`yield* Effect.promise(() => ...)\`.
|
|
57
|
+
- Do NOT use top-level await; do NOT export named functions; do NOT use module.exports.
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
const AVAILABLE_PACKAGES = trim`
|
|
61
|
+
Scripts run in an Edge runtime (Cloudflare Workers) with the following pre-bundled packages:
|
|
62
|
+
|
|
63
|
+
DXOS SDK:
|
|
64
|
+
- \`@dxos/echo\` — Reactive local-first database: query, filter, and mutate ECHO objects in spaces.
|
|
65
|
+
- \`@dxos/functions\` — Edge function framework: triggers, queues, and function definitions.
|
|
66
|
+
- \`@dxos/ai\` — AI/LLM integration via AiService (access models like Claude, GPT).
|
|
67
|
+
- \`@dxos/schema\` — Schema utilities and built-in DXOS types.
|
|
68
|
+
- \`@dxos/types\` — DXOS type definitions.
|
|
69
|
+
- \`@dxos/operation\` — Define and handle typed operations with input/output schemas.
|
|
70
|
+
- \`@dxos/util\` — General utility functions.
|
|
71
|
+
- \`@dxos/log\` — Structured logging.
|
|
72
|
+
|
|
73
|
+
Effect-TS (functional programming toolkit):
|
|
74
|
+
- \`effect\` — Core effect system with sub-modules: Effect, Schema, Stream, Schedule, Array, Record, Option, Either, Match, etc.
|
|
75
|
+
- \`@effect/platform\` — HTTP client (\`HttpClient\`), platform abstractions for making typed API requests.
|
|
76
|
+
|
|
77
|
+
Data format parsing & querying:
|
|
78
|
+
- \`jsonata\` — Powerful query and transformation expressions for JSON data (filter, sort, group, aggregate, reshape).
|
|
79
|
+
- \`yaml\` — Parse and stringify YAML documents.
|
|
80
|
+
- \`fast-xml-parser\` — Fast XML parser and builder; convert between XML and JSON.
|
|
81
|
+
- \`papaparse\` — CSV parsing and serialization; stream large files, auto-detect delimiters.
|
|
82
|
+
|
|
83
|
+
Text & markup processing:
|
|
84
|
+
- \`turndown\` — HTML to Markdown converter (useful for feeding web content to LLMs).
|
|
85
|
+
|
|
86
|
+
HTML/DOM parsing:
|
|
87
|
+
- \`linkedom\` — Lightweight DOM parser for worker environments; parse and query HTML documents.
|
|
88
|
+
|
|
89
|
+
Data processing & utilities:
|
|
90
|
+
- \`date-fns\` — Comprehensive date utility library: parsing, formatting, comparison, arithmetic, time zones.
|
|
91
|
+
|
|
92
|
+
Other:
|
|
93
|
+
- \`@automerge/automerge\` — CRDT library for conflict-free collaborative data structures.
|
|
94
|
+
- \`chess.js\` — Chess game logic, move generation, and validation.
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
export const Create = Operation.make({
|
|
98
|
+
meta: {
|
|
99
|
+
key: 'org.dxos.function.script.create',
|
|
100
|
+
name: 'Create',
|
|
101
|
+
description: `Creates a new function with TypeScript source code and adds it to the space. ${FUNCTION_FORMAT} ${AVAILABLE_PACKAGES}`,
|
|
102
|
+
},
|
|
103
|
+
input: Schema.Struct({
|
|
104
|
+
name: Schema.String.annotations({
|
|
105
|
+
description: 'Name of the function.',
|
|
106
|
+
}),
|
|
107
|
+
source: Schema.optional(Schema.String).annotations({
|
|
108
|
+
description: 'TypeScript source code for the function.',
|
|
109
|
+
}),
|
|
110
|
+
templateId: Schema.optional(Schema.String).annotations({
|
|
111
|
+
description: 'ID of a template to use as the initial source.',
|
|
112
|
+
}),
|
|
113
|
+
}),
|
|
114
|
+
output: Schema.Struct({
|
|
115
|
+
function: FunctionId,
|
|
116
|
+
}),
|
|
117
|
+
services: [Database.Service],
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
export const Read = Operation.make({
|
|
121
|
+
meta: {
|
|
122
|
+
key: 'org.dxos.function.script.read',
|
|
123
|
+
name: 'Read',
|
|
124
|
+
description: 'Reads the source code and metadata of a function.',
|
|
125
|
+
},
|
|
126
|
+
input: Schema.Struct({
|
|
127
|
+
function: FunctionRef,
|
|
128
|
+
}),
|
|
129
|
+
output: Schema.Struct({
|
|
130
|
+
name: Schema.optional(Schema.String),
|
|
131
|
+
source: Schema.String,
|
|
132
|
+
description: Schema.optional(Schema.String),
|
|
133
|
+
}),
|
|
134
|
+
services: [Database.Service],
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const Edit = Schema.Struct({
|
|
138
|
+
oldString: Schema.String.annotations({
|
|
139
|
+
description: 'The text to find in the source.',
|
|
140
|
+
}),
|
|
141
|
+
newString: Schema.String.annotations({
|
|
142
|
+
description: 'The text to replace it with.',
|
|
143
|
+
}),
|
|
144
|
+
replaceAll: Schema.optional(Schema.Boolean).annotations({
|
|
145
|
+
description: 'If true, replaces all occurrences. Defaults to false (first occurrence only).',
|
|
146
|
+
}),
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export const Update = Operation.make({
|
|
150
|
+
meta: {
|
|
151
|
+
key: 'org.dxos.function.script.update',
|
|
152
|
+
name: 'Update',
|
|
153
|
+
description: `Updates the source code or metadata of a function. ${FUNCTION_FORMAT}`,
|
|
154
|
+
},
|
|
155
|
+
input: Schema.Struct({
|
|
156
|
+
function: FunctionRef,
|
|
157
|
+
name: Schema.optional(Schema.String).annotations({
|
|
158
|
+
description: 'New name for the function.',
|
|
159
|
+
}),
|
|
160
|
+
description: Schema.optional(Schema.String).annotations({
|
|
161
|
+
description: 'New description for the function.',
|
|
162
|
+
}),
|
|
163
|
+
edits: Schema.optional(Schema.Array(Edit)).annotations({
|
|
164
|
+
description: 'Edits to apply to the source. Each edit finds oldString and replaces it with newString.',
|
|
165
|
+
}),
|
|
166
|
+
}),
|
|
167
|
+
output: Schema.Struct({
|
|
168
|
+
function: FunctionId,
|
|
169
|
+
}),
|
|
170
|
+
services: [Database.Service],
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
export const Delete = Operation.make({
|
|
174
|
+
meta: {
|
|
175
|
+
key: 'org.dxos.function.script.delete',
|
|
176
|
+
name: 'Delete',
|
|
177
|
+
description: 'Deletes a function and its source from the space.',
|
|
178
|
+
},
|
|
179
|
+
input: Schema.Struct({
|
|
180
|
+
function: FunctionRef,
|
|
181
|
+
}),
|
|
182
|
+
output: Schema.Void,
|
|
183
|
+
services: [Database.Service],
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
export const Deploy = Operation.make({
|
|
187
|
+
meta: {
|
|
188
|
+
key: 'org.dxos.function.script.deploy',
|
|
189
|
+
name: 'Deploy',
|
|
190
|
+
description: `Deploys a function to the Edge runtime. The function source must follow the required format: a single export default of Operation.pipe(Operation.withHandler(Effect.fn(function* (...) { ... }))). See the Create operation description for a full example.`,
|
|
191
|
+
},
|
|
192
|
+
input: Schema.Struct({
|
|
193
|
+
function: FunctionRef,
|
|
194
|
+
}),
|
|
195
|
+
output: Schema.Struct({
|
|
196
|
+
function: FunctionId,
|
|
197
|
+
functionUrl: Schema.optional(Schema.String).annotations({
|
|
198
|
+
description: 'The URL of the deployed function.',
|
|
199
|
+
}),
|
|
200
|
+
}),
|
|
201
|
+
services: [Database.Service, ClientService],
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
export const Invoke = Operation.make({
|
|
205
|
+
meta: {
|
|
206
|
+
key: 'org.dxos.function.script.invoke',
|
|
207
|
+
name: 'Invoke',
|
|
208
|
+
description: 'Invokes a deployed Edge function with the given payload.',
|
|
209
|
+
},
|
|
210
|
+
input: Schema.Struct({
|
|
211
|
+
function: FunctionRef,
|
|
212
|
+
payload: Schema.optional(Schema.Unknown).annotations({
|
|
213
|
+
description: 'The input payload to pass to the function.',
|
|
214
|
+
}),
|
|
215
|
+
}),
|
|
216
|
+
output: Schema.Struct({
|
|
217
|
+
response: Schema.Unknown.annotations({
|
|
218
|
+
description: 'The response from the function.',
|
|
219
|
+
}),
|
|
220
|
+
}),
|
|
221
|
+
services: [Database.Service, ClientService],
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
const InvocationSpanSchema = Schema.Struct({
|
|
225
|
+
id: Schema.String.annotations({
|
|
226
|
+
description: 'The invocation ID.',
|
|
227
|
+
}),
|
|
228
|
+
timestamp: Schema.Number.annotations({
|
|
229
|
+
description: 'Start time of the invocation (epoch ms).',
|
|
230
|
+
}),
|
|
231
|
+
duration: Schema.Number.annotations({
|
|
232
|
+
description: 'Duration in milliseconds.',
|
|
233
|
+
}),
|
|
234
|
+
outcome: Schema.String.annotations({
|
|
235
|
+
description: 'Invocation outcome: success, failure, or pending.',
|
|
236
|
+
}),
|
|
237
|
+
input: Schema.Object.annotations({
|
|
238
|
+
description: 'The input payload passed to the function.',
|
|
239
|
+
}),
|
|
240
|
+
error: Schema.optional(Schema.Object).annotations({
|
|
241
|
+
description: 'Error details if the invocation failed.',
|
|
242
|
+
}),
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
export const InspectInvocations = Operation.make({
|
|
246
|
+
meta: {
|
|
247
|
+
key: 'org.dxos.function.script.inspect-invocations',
|
|
248
|
+
name: 'InspectInvocations',
|
|
249
|
+
description: 'Queries the invocation trace feed for a function, returning its invocation history.',
|
|
250
|
+
},
|
|
251
|
+
input: Schema.Struct({
|
|
252
|
+
function: FunctionRef,
|
|
253
|
+
limit: Schema.optional(Schema.Number).annotations({
|
|
254
|
+
description: 'Maximum number of invocations to return. Defaults to 20.',
|
|
255
|
+
}),
|
|
256
|
+
}),
|
|
257
|
+
output: Schema.Struct({
|
|
258
|
+
invocations: Schema.Array(InvocationSpanSchema).annotations({
|
|
259
|
+
description: 'List of invocation spans, most recent first.',
|
|
260
|
+
}),
|
|
261
|
+
total: Schema.Number.annotations({
|
|
262
|
+
description: 'Total number of invocations found.',
|
|
263
|
+
}),
|
|
264
|
+
}),
|
|
265
|
+
services: [Database.Service, Feed.FeedService],
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
const DeployedFunctionSchema = Schema.Struct({
|
|
269
|
+
key: Schema.optional(Schema.String).annotations({
|
|
270
|
+
description: 'Unique key identifying the function. Pass to InstallFunction to install it.',
|
|
271
|
+
}),
|
|
272
|
+
name: Schema.String.annotations({
|
|
273
|
+
description: 'Display name of the function.',
|
|
274
|
+
}),
|
|
275
|
+
version: Schema.String.annotations({
|
|
276
|
+
description: 'Semantic version of the deployed function.',
|
|
277
|
+
}),
|
|
278
|
+
description: Schema.optional(Schema.String).annotations({
|
|
279
|
+
description: 'Description of what the function does.',
|
|
280
|
+
}),
|
|
281
|
+
updated: Schema.optional(Schema.String).annotations({
|
|
282
|
+
description: 'ISO timestamp of the last deployment.',
|
|
283
|
+
}),
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
export const QueryDeployedFunctions = Operation.make({
|
|
287
|
+
meta: {
|
|
288
|
+
key: 'org.dxos.function.script.query-deployed',
|
|
289
|
+
name: 'QueryDeployedFunctions',
|
|
290
|
+
description: 'Lists all functions deployed to the EDGE runtime. Use InstallFunction to add one to the space.',
|
|
291
|
+
},
|
|
292
|
+
input: Schema.Void,
|
|
293
|
+
output: Schema.Struct({
|
|
294
|
+
functions: Schema.Array(DeployedFunctionSchema).annotations({
|
|
295
|
+
description: 'List of deployed functions.',
|
|
296
|
+
}),
|
|
297
|
+
}),
|
|
298
|
+
services: [ClientService],
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
export const InstallFunction = Operation.make({
|
|
302
|
+
meta: {
|
|
303
|
+
key: 'org.dxos.function.script.install',
|
|
304
|
+
name: 'InstallFunction',
|
|
305
|
+
description:
|
|
306
|
+
'Installs a deployed EDGE function into the current space by key. The returned function ID can be passed directly to Invoke.',
|
|
307
|
+
},
|
|
308
|
+
input: Schema.Struct({
|
|
309
|
+
key: Schema.String.annotations({
|
|
310
|
+
description: 'The unique key of the deployed function to install (from QueryDeployedFunctions).',
|
|
311
|
+
}),
|
|
312
|
+
}),
|
|
313
|
+
output: Schema.Struct({
|
|
314
|
+
function: FunctionId,
|
|
315
|
+
name: Schema.String.annotations({
|
|
316
|
+
description: 'Name of the installed function.',
|
|
317
|
+
}),
|
|
318
|
+
version: Schema.String.annotations({
|
|
319
|
+
description: 'Version of the installed function.',
|
|
320
|
+
}),
|
|
321
|
+
}),
|
|
322
|
+
services: [ClientService],
|
|
323
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
import { Database } from '@dxos/echo';
|
|
9
|
+
|
|
10
|
+
import { Delete } from './definitions';
|
|
11
|
+
|
|
12
|
+
export default Delete.pipe(
|
|
13
|
+
Operation.withHandler(
|
|
14
|
+
Effect.fn(function* ({ function: fn }) {
|
|
15
|
+
const { db } = yield* Database.Service;
|
|
16
|
+
const loaded = yield* Database.load(fn);
|
|
17
|
+
if (loaded.source?.target) {
|
|
18
|
+
db.remove(loaded.source.target);
|
|
19
|
+
}
|
|
20
|
+
db.remove(loaded);
|
|
21
|
+
}),
|
|
22
|
+
),
|
|
23
|
+
);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import wasmUrl from 'esbuild-wasm/esbuild.wasm?url';
|
|
7
|
+
|
|
8
|
+
import { ClientService } from '@dxos/client';
|
|
9
|
+
import { Script, Operation } from '@dxos/compute';
|
|
10
|
+
import { Context } from '@dxos/context';
|
|
11
|
+
import { Database, Obj } from '@dxos/echo';
|
|
12
|
+
import { getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
13
|
+
import { bundleFunction, initializeBundler } from '@dxos/functions-runtime/bundler';
|
|
14
|
+
import { FunctionsServiceClient, incrementSemverPatch } from '@dxos/functions-runtime/edge';
|
|
15
|
+
import { FunctionRuntimeKind } from '@dxos/protocols';
|
|
16
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
17
|
+
|
|
18
|
+
import { Deploy } from './definitions';
|
|
19
|
+
|
|
20
|
+
export default Deploy.pipe(
|
|
21
|
+
Operation.withHandler(
|
|
22
|
+
Effect.fn(function* ({ function: fn }) {
|
|
23
|
+
const loaded = yield* Database.load(fn);
|
|
24
|
+
const client = yield* ClientService;
|
|
25
|
+
if (!loaded.source) {
|
|
26
|
+
return yield* Effect.fail(new Error('Function has no source script.'));
|
|
27
|
+
}
|
|
28
|
+
const script = (yield* Database.load(loaded.source)) as Script.Script;
|
|
29
|
+
|
|
30
|
+
const space = getSpace(loaded);
|
|
31
|
+
if (!space || !script.source?.target?.content) {
|
|
32
|
+
return yield* Effect.fail(new Error('Script source or space not available'));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
yield* Effect.promise(() => initializeBundler({ wasmUrl }));
|
|
36
|
+
const buildResult = yield* Effect.promise(() => bundleFunction({ source: script.source!.target!.content }));
|
|
37
|
+
if ('error' in buildResult) {
|
|
38
|
+
return yield* Effect.fail(buildResult.error ?? new Error('Bundle creation failed'));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const existingFunctionId = getUserFunctionIdInMetadata(Obj.getMeta(loaded));
|
|
42
|
+
const currentVersion = Obj.getMeta(loaded).version;
|
|
43
|
+
|
|
44
|
+
const functionsService = FunctionsServiceClient.fromClient(client);
|
|
45
|
+
const newFunction = yield* Effect.promise(() =>
|
|
46
|
+
functionsService.deploy(Context.default(), {
|
|
47
|
+
ownerPublicKey: space.key,
|
|
48
|
+
version: currentVersion ? incrementSemverPatch(currentVersion) : '0.0.1',
|
|
49
|
+
functionId: existingFunctionId,
|
|
50
|
+
entryPoint: buildResult.entryPoint,
|
|
51
|
+
assets: buildResult.assets,
|
|
52
|
+
runtime: FunctionRuntimeKind.enums.WORKER_LOADER,
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
Operation.setFrom(loaded, newFunction);
|
|
57
|
+
|
|
58
|
+
Obj.update(script, (script) => {
|
|
59
|
+
script.changed = false;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const edgeFunctionId = getUserFunctionIdInMetadata(Obj.getMeta(loaded));
|
|
63
|
+
return {
|
|
64
|
+
function: Obj.getDXN(loaded).toString(),
|
|
65
|
+
functionUrl: edgeFunctionId
|
|
66
|
+
? `${client.config.values.runtime?.services?.edge?.url ?? ''}/functions/${edgeFunctionId}`
|
|
67
|
+
: undefined,
|
|
68
|
+
};
|
|
69
|
+
}),
|
|
70
|
+
),
|
|
71
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
|
+
|
|
7
|
+
export * from './definitions';
|
|
8
|
+
|
|
9
|
+
export const ScriptHandlers = OperationHandlerSet.lazy(
|
|
10
|
+
() => import('./create'),
|
|
11
|
+
() => import('./read'),
|
|
12
|
+
() => import('./update'),
|
|
13
|
+
() => import('./delete'),
|
|
14
|
+
() => import('./deploy'),
|
|
15
|
+
() => import('./invoke'),
|
|
16
|
+
() => import('./inspect-invocations'),
|
|
17
|
+
() => import('./query-deployed-functions'),
|
|
18
|
+
() => import('./install-function'),
|
|
19
|
+
);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { SpaceProperties } from '@dxos/client-protocol';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Database, Feed, Filter, Obj, Query } from '@dxos/echo';
|
|
10
|
+
import { getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
11
|
+
import { InvocationTraceEndEvent, InvocationTraceStartEvent, createInvocationSpans } from '@dxos/functions-runtime';
|
|
12
|
+
|
|
13
|
+
import { InspectInvocations } from './definitions';
|
|
14
|
+
|
|
15
|
+
export default InspectInvocations.pipe(
|
|
16
|
+
Operation.withHandler(
|
|
17
|
+
Effect.fn(function* ({ function: fn, limit }) {
|
|
18
|
+
const loaded = yield* Database.load(fn);
|
|
19
|
+
const maxResults = limit ?? 20;
|
|
20
|
+
|
|
21
|
+
const [properties] = yield* Database.runQuery(Query.type(SpaceProperties));
|
|
22
|
+
if (!properties?.invocationTraceFeed) {
|
|
23
|
+
return { invocations: [], total: 0 };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const feed = yield* Database.load(properties.invocationTraceFeed);
|
|
27
|
+
const startEvents = yield* Feed.runQuery(feed, Filter.type(InvocationTraceStartEvent));
|
|
28
|
+
const endEvents = yield* Feed.runQuery(feed, Filter.type(InvocationTraceEndEvent));
|
|
29
|
+
const allSpans = createInvocationSpans([...startEvents, ...endEvents]);
|
|
30
|
+
|
|
31
|
+
const functionId = getUserFunctionIdInMetadata(Obj.getMeta(loaded));
|
|
32
|
+
|
|
33
|
+
const filtered = allSpans.filter((span) => {
|
|
34
|
+
if (!span.invocationTarget || !functionId) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const targetDXN = span.invocationTarget.dxn.toString();
|
|
38
|
+
const uuidPart = targetDXN.split(':').pop();
|
|
39
|
+
return uuidPart === functionId;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
filtered.sort((a, b) => b.timestamp - a.timestamp);
|
|
43
|
+
const total = filtered.length;
|
|
44
|
+
const invocations = filtered.slice(0, maxResults).map((span) => ({
|
|
45
|
+
id: span.id,
|
|
46
|
+
timestamp: span.timestamp,
|
|
47
|
+
duration: span.duration,
|
|
48
|
+
outcome: `${span.outcome}`,
|
|
49
|
+
input: span.input !== null && typeof span.input === 'object' ? span.input : { value: span.input },
|
|
50
|
+
error: span.error ? (span.error as object) : undefined,
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
return { invocations, total };
|
|
54
|
+
}),
|
|
55
|
+
),
|
|
56
|
+
);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { ClientService } from '@dxos/client';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Context } from '@dxos/context';
|
|
10
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
11
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
12
|
+
|
|
13
|
+
import { InstallFunction } from './definitions';
|
|
14
|
+
|
|
15
|
+
export default InstallFunction.pipe(
|
|
16
|
+
Operation.withHandler(
|
|
17
|
+
Effect.fn(function* ({ key }) {
|
|
18
|
+
const client = yield* ClientService;
|
|
19
|
+
const functionsService = FunctionsServiceClient.fromClient(client);
|
|
20
|
+
const deployed = yield* Effect.promise(() => functionsService.query(Context.default()));
|
|
21
|
+
|
|
22
|
+
const fn = deployed.findLast((entry) => Obj.getMeta(entry).key === key);
|
|
23
|
+
if (!fn) {
|
|
24
|
+
return yield* Effect.fail(new Error(`No deployed function found with key: ${key}`));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const space = client.spaces.get()[0];
|
|
28
|
+
if (!space) {
|
|
29
|
+
return yield* Effect.fail(new Error('No space available'));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
yield* Effect.promise(() => client.addTypes([Operation.PersistentOperation]));
|
|
33
|
+
|
|
34
|
+
const existingFunctions = yield* Effect.promise(() =>
|
|
35
|
+
space.db.query(Filter.and(Filter.type(Operation.PersistentOperation), Filter.key(key))).run(),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
let installed: Operation.PersistentOperation;
|
|
39
|
+
if (existingFunctions.length > 0) {
|
|
40
|
+
installed = existingFunctions[0];
|
|
41
|
+
for (const existing of existingFunctions) {
|
|
42
|
+
Operation.setFrom(existing, fn);
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
installed = Obj.clone(fn);
|
|
46
|
+
space.db.add(installed);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
function: Obj.getDXN(installed).toString(),
|
|
51
|
+
name: fn.name ?? 'Unnamed function',
|
|
52
|
+
version: Obj.getMeta(fn).version ?? '0.0.0',
|
|
53
|
+
};
|
|
54
|
+
}),
|
|
55
|
+
),
|
|
56
|
+
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { ClientService } from '@dxos/client';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Context } from '@dxos/context';
|
|
10
|
+
import { Database, Obj } from '@dxos/echo';
|
|
11
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
12
|
+
|
|
13
|
+
import { Invoke } from './definitions';
|
|
14
|
+
|
|
15
|
+
export default Invoke.pipe(
|
|
16
|
+
Operation.withHandler(
|
|
17
|
+
Effect.fn(function* ({ function: fn, payload }) {
|
|
18
|
+
const loaded = yield* Database.load(fn);
|
|
19
|
+
const client = yield* ClientService;
|
|
20
|
+
|
|
21
|
+
const spaceId = Obj.getDatabase(loaded)?.spaceId;
|
|
22
|
+
if (!spaceId) {
|
|
23
|
+
return yield* Effect.fail(new Error('Function is not in a space.'));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const functionsService = FunctionsServiceClient.fromClient(client);
|
|
27
|
+
const result = yield* Effect.promise(() =>
|
|
28
|
+
functionsService.invoke(Context.default(), loaded, payload ?? {}, { spaceId }),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
return { response: result };
|
|
32
|
+
}),
|
|
33
|
+
),
|
|
34
|
+
);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { ClientService } from '@dxos/client';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Context } from '@dxos/context';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
12
|
+
|
|
13
|
+
import { QueryDeployedFunctions } from './definitions';
|
|
14
|
+
|
|
15
|
+
export default QueryDeployedFunctions.pipe(
|
|
16
|
+
Operation.withHandler(
|
|
17
|
+
Effect.fn(function* () {
|
|
18
|
+
const client = yield* ClientService;
|
|
19
|
+
const functionsService = FunctionsServiceClient.fromClient(client);
|
|
20
|
+
const deployed = yield* Effect.promise(() => functionsService.query(Context.default()));
|
|
21
|
+
return {
|
|
22
|
+
functions: deployed.map((fn) => {
|
|
23
|
+
const meta = Obj.getMeta(fn);
|
|
24
|
+
return {
|
|
25
|
+
key: meta.key,
|
|
26
|
+
name: fn.name ?? 'Unnamed function',
|
|
27
|
+
version: meta.version ?? '0.0.0',
|
|
28
|
+
description: fn.description,
|
|
29
|
+
updated: fn.updated,
|
|
30
|
+
};
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
}),
|
|
34
|
+
),
|
|
35
|
+
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { type Script, Operation } from '@dxos/compute';
|
|
8
|
+
import { Database } from '@dxos/echo';
|
|
9
|
+
|
|
10
|
+
import { Read } from './definitions';
|
|
11
|
+
|
|
12
|
+
export default Read.pipe(
|
|
13
|
+
Operation.withHandler(
|
|
14
|
+
Effect.fn(function* ({ function: fn }) {
|
|
15
|
+
const loaded = yield* Database.load(fn);
|
|
16
|
+
if (!loaded.source) {
|
|
17
|
+
return yield* Effect.fail(new Error('Function has no source script.'));
|
|
18
|
+
}
|
|
19
|
+
const script = (yield* Database.load(loaded.source)) as Script.Script;
|
|
20
|
+
const text = yield* Database.load(script.source);
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
name: script.name,
|
|
24
|
+
source: text.content,
|
|
25
|
+
description: script.description,
|
|
26
|
+
};
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
29
|
+
);
|