@dxos/plugin-script 0.8.4-main.ae835ea → 0.8.4-main.bc2380dfbc
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-C36N7AFF.mjs → neutral/NotebookArticle-3TE4WBZC.mjs} +245 -299
- package/dist/lib/neutral/NotebookArticle-3TE4WBZC.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/access-token-created-XNDXOZ2U.mjs +34 -0
- package/dist/lib/neutral/access-token-created-XNDXOZ2U.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/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-LYPVNW4K.mjs +8 -0
- package/dist/lib/neutral/chunk-LYPVNW4K.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-P2F3STZN.mjs +8 -0
- package/dist/lib/neutral/chunk-P2F3STZN.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/{browser/chunk-EB6AXFXO.mjs → neutral/chunk-UYR3YH4Q.mjs} +3 -3
- package/dist/lib/neutral/chunk-UYR3YH4Q.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-ZMU2CRJ7.mjs +117 -0
- package/dist/lib/neutral/react-surface-ZMU2CRJ7.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/FramePanel/FramePanel.d.ts +12 -0
- 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 -226
- 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 -226
- 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 +2 -4
- 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 +22 -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/access-token-created.d.ts +5 -0
- package/dist/types/src/operations/access-token-created.d.ts.map +1 -0
- 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 -90
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +110 -23
- 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 -98
- package/src/ScriptPlugin.node.ts +21 -0
- package/src/ScriptPlugin.test.ts +31 -0
- package/src/ScriptPlugin.tsx +24 -94
- 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 -98
- package/src/capabilities/blueprint-definition.ts +13 -24
- package/src/capabilities/compiler.ts +100 -23
- 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 -92
- package/src/capabilities/settings.ts +26 -14
- package/src/compiler/compiler.ts +21 -3
- package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +8 -7
- package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +53 -35
- 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 +40 -45
- package/src/components/TestPanel/TestPanel.tsx +124 -185
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +26 -19
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +74 -67
- 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/containers/NotebookArticle/NotebookArticle.tsx +254 -0
- 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 +45 -35
- 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 -16
- package/src/hooks/useToolbarState.ts +29 -4
- package/src/index.ts +2 -4
- package/src/meta.ts +4 -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/access-token-created.ts +37 -0
- package/src/operations/create-script.ts +46 -0
- package/src/operations/index.ts +10 -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 +5 -6
- 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} +12 -13
- package/src/testing/test-script.ts +28 -0
- package/src/translations.ts +86 -85
- package/src/types/Notebook.ts +20 -16
- 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 +29 -33
- package/src/util/functions.ts +33 -28
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-E5NXT4UQ.mjs +0 -14
- package/dist/lib/browser/NotebookContainer-C36N7AFF.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-4YPRUM3C.mjs +0 -148
- package/dist/lib/browser/ScriptContainer-4YPRUM3C.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LEOPGBJD.mjs +0 -66
- package/dist/lib/browser/app-graph-builder-LEOPGBJD.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-5S5YQNJZ.mjs +0 -304
- package/dist/lib/browser/chunk-5S5YQNJZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-A5K3TXYA.mjs +0 -269
- package/dist/lib/browser/chunk-A5K3TXYA.mjs.map +0 -7
- package/dist/lib/browser/chunk-EB6AXFXO.mjs.map +0 -7
- package/dist/lib/browser/chunk-HCURXADW.mjs +0 -102
- package/dist/lib/browser/chunk-HCURXADW.mjs.map +0 -7
- package/dist/lib/browser/chunk-HHTOAI2J.mjs +0 -644
- package/dist/lib/browser/chunk-HHTOAI2J.mjs.map +0 -7
- package/dist/lib/browser/chunk-IQMYIWHG.mjs +0 -153
- package/dist/lib/browser/chunk-IQMYIWHG.mjs.map +0 -7
- package/dist/lib/browser/chunk-LI4P25M5.mjs +0 -111
- package/dist/lib/browser/chunk-LI4P25M5.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q2DGRQRN.mjs +0 -255
- package/dist/lib/browser/chunk-Q2DGRQRN.mjs.map +0 -7
- package/dist/lib/browser/chunk-ST3ACVUC.mjs +0 -88
- package/dist/lib/browser/chunk-ST3ACVUC.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-Q4UY2COU.mjs +0 -86
- package/dist/lib/browser/compiler-Q4UY2COU.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -274
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-AMMHATM7.mjs +0 -105
- package/dist/lib/browser/intent-resolver-AMMHATM7.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-X4NATU6B.mjs +0 -128
- package/dist/lib/browser/react-surface-X4NATU6B.mjs.map +0 -7
- package/dist/lib/browser/settings-6UXY7F7D.mjs +0 -26
- package/dist/lib/browser/settings-6UXY7F7D.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -14
- package/dist/lib/node-esm/DeploymentDialog-OSHHSEBH.mjs +0 -15
- package/dist/lib/node-esm/NotebookContainer-FOVFGJQR.mjs +0 -818
- package/dist/lib/node-esm/NotebookContainer-FOVFGJQR.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-EW24D5II.mjs +0 -149
- package/dist/lib/node-esm/ScriptContainer-EW24D5II.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-XJ3MY5BM.mjs +0 -67
- package/dist/lib/node-esm/app-graph-builder-XJ3MY5BM.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-2GVTWESW.mjs +0 -90
- package/dist/lib/node-esm/chunk-2GVTWESW.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-EJLYOSD7.mjs +0 -113
- package/dist/lib/node-esm/chunk-EJLYOSD7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GA27XSEY.mjs +0 -270
- package/dist/lib/node-esm/chunk-GA27XSEY.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-N2XLVOFB.mjs +0 -103
- package/dist/lib/node-esm/chunk-N2XLVOFB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-O7HXE72S.mjs +0 -256
- package/dist/lib/node-esm/chunk-O7HXE72S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OZ6LCME4.mjs +0 -645
- package/dist/lib/node-esm/chunk-OZ6LCME4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TUGLYZDT.mjs +0 -305
- package/dist/lib/node-esm/chunk-TUGLYZDT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UEGPBCSF.mjs +0 -154
- package/dist/lib/node-esm/chunk-UEGPBCSF.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-I6A4KE6E.mjs +0 -87
- package/dist/lib/node-esm/compiler-I6A4KE6E.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -275
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YKLZQR7U.mjs +0 -106
- package/dist/lib/node-esm/intent-resolver-YKLZQR7U.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-LVGLBSTE.mjs +0 -129
- package/dist/lib/node-esm/react-surface-LVGLBSTE.mjs.map +0 -7
- package/dist/lib/node-esm/settings-O4EZPUE3.mjs +0 -27
- package/dist/lib/node-esm/settings-O4EZPUE3.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 -248
- 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 +0 -12
- 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 -251
- 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 -106
- 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/NotebookContainer.tsx +0 -263
- package/src/components/ScriptContainer.tsx +0 -69
- package/src/components/Settings/ScriptObjectSettings.tsx +0 -286
- 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-E5NXT4UQ.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-OSHHSEBH.mjs.map → neutral/types/index.mjs.map} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Record from 'effect/Record';
|
|
6
|
+
import { readFile } from 'node:fs/promises';
|
|
7
|
+
import { describe, expect, test } from 'vitest';
|
|
8
|
+
|
|
9
|
+
import { bundleFunction } from '@dxos/functions-runtime/bundler';
|
|
10
|
+
import { FunctionWorker } from '@dxos/functions-simulator-cloudflare';
|
|
11
|
+
import { ErrorCodec } from '@dxos/protocols';
|
|
12
|
+
|
|
13
|
+
// Requires downloading assets from R2.
|
|
14
|
+
describe('Run script in sumulator', { tags: ['functions-e2e'] }, () => {
|
|
15
|
+
test('forex-effect', { timeout: 120_000 }, async () => {
|
|
16
|
+
const source = await readFile(new URL('../templates/forex-effect.ts', import.meta.url), 'utf-8');
|
|
17
|
+
|
|
18
|
+
// Bundle and upload.
|
|
19
|
+
const buildResult = await bundleFunction({ source });
|
|
20
|
+
if ('error' in buildResult) {
|
|
21
|
+
throw buildResult.error ?? new Error('Bundle creation failed');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const worker = new FunctionWorker({
|
|
25
|
+
mainModule: buildResult.entryPoint,
|
|
26
|
+
modules: Record.map(buildResult.assets, (contents, filename) => ({
|
|
27
|
+
contents: contents as Uint8Array<ArrayBuffer>,
|
|
28
|
+
contentType: filename.endsWith('.wasm') ? 'application/wasm' : 'application/javascript',
|
|
29
|
+
})),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const result = await worker.invoke({ from: 'USD', to: 'EUR' });
|
|
33
|
+
console.log(result);
|
|
34
|
+
if (result._kind === 'error') {
|
|
35
|
+
throw ErrorCodec.decode(result.error);
|
|
36
|
+
}
|
|
37
|
+
expect(Number(result.result)).toBeGreaterThan(0);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -2,51 +2,50 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Routine } from '@dxos/compute';
|
|
6
6
|
import { Ref } from '@dxos/echo';
|
|
7
7
|
import { createObject } from '@dxos/echo-db';
|
|
8
8
|
import { PublicKey } from '@dxos/keys';
|
|
9
|
-
import { Markdown } from '@dxos/plugin-markdown
|
|
10
|
-
import {
|
|
9
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
10
|
+
import { Text } from '@dxos/schema';
|
|
11
11
|
|
|
12
|
-
import { Notebook } from '
|
|
12
|
+
import { Notebook } from '#types';
|
|
13
13
|
|
|
14
14
|
// TODO(burdon): NOTE: createObject is required for tests.
|
|
15
|
-
|
|
16
15
|
export const createNotebook = (): Notebook.Notebook =>
|
|
17
16
|
Notebook.make({
|
|
18
17
|
cells: [
|
|
19
18
|
{
|
|
20
19
|
id: PublicKey.random().toString(),
|
|
21
20
|
type: 'script',
|
|
22
|
-
source: Ref.make(createObject(
|
|
21
|
+
source: Ref.make(createObject(Text.make({ content: 'c = a() + b' }))),
|
|
23
22
|
},
|
|
24
23
|
{
|
|
25
24
|
id: PublicKey.random().toString(),
|
|
26
25
|
type: 'script',
|
|
27
|
-
source: Ref.make(createObject(
|
|
26
|
+
source: Ref.make(createObject(Text.make({ content: 'a = () => 100' }))),
|
|
28
27
|
},
|
|
29
28
|
{
|
|
30
29
|
id: PublicKey.random().toString(),
|
|
31
30
|
type: 'script',
|
|
32
|
-
source: Ref.make(createObject(
|
|
31
|
+
source: Ref.make(createObject(Text.make({ content: 'b = 200' }))),
|
|
33
32
|
},
|
|
34
33
|
{
|
|
35
34
|
id: PublicKey.random().toString(),
|
|
36
35
|
type: 'script',
|
|
37
|
-
source: Ref.make(createObject(
|
|
36
|
+
source: Ref.make(createObject(Text.make({ content: 'd = a() * 2' }))),
|
|
38
37
|
},
|
|
39
38
|
{
|
|
40
39
|
id: PublicKey.random().toString(),
|
|
41
40
|
type: 'script',
|
|
42
|
-
source: Ref.make(createObject(
|
|
41
|
+
source: Ref.make(createObject(Text.make({ content: 'c + d' }))),
|
|
43
42
|
},
|
|
44
43
|
{
|
|
45
44
|
id: PublicKey.random().toString(),
|
|
46
45
|
type: 'prompt',
|
|
47
46
|
prompt: Ref.make(
|
|
48
47
|
createObject(
|
|
49
|
-
|
|
48
|
+
Routine.make({
|
|
50
49
|
instructions: 'Very briefly, what colors are associated with the numbers {{a}} and {{b}}.',
|
|
51
50
|
}),
|
|
52
51
|
),
|
|
@@ -55,14 +54,14 @@ export const createNotebook = (): Notebook.Notebook =>
|
|
|
55
54
|
{
|
|
56
55
|
id: PublicKey.random().toString(),
|
|
57
56
|
type: 'query',
|
|
58
|
-
source: Ref.make(createObject(
|
|
57
|
+
source: Ref.make(createObject(Text.make({ content: `docs = (type: ${Markdown.Document.typename})` }))),
|
|
59
58
|
},
|
|
60
59
|
{
|
|
61
60
|
id: PublicKey.random().toString(),
|
|
62
61
|
type: 'prompt',
|
|
63
62
|
prompt: Ref.make(
|
|
64
63
|
createObject(
|
|
65
|
-
|
|
64
|
+
Routine.make({
|
|
66
65
|
instructions: 'Very briefly, summarize the documents: {{docs}}',
|
|
67
66
|
}),
|
|
68
67
|
),
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Script, Operation } from '@dxos/compute';
|
|
6
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
7
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Seeds a script and linked persistent operation for Storybook stories.
|
|
11
|
+
*/
|
|
12
|
+
export const createScript = (space: Space): Script.Script => {
|
|
13
|
+
const script = Script.make({
|
|
14
|
+
name: 'Test',
|
|
15
|
+
source: 'export default () => 42;',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
space.db.add(script);
|
|
19
|
+
space.db.add(
|
|
20
|
+
Obj.make(Operation.PersistentOperation, {
|
|
21
|
+
[Obj.Meta]: { key: 'org.dxos.script.story-fn', version: '0.1.0' },
|
|
22
|
+
name: 'Test',
|
|
23
|
+
source: Ref.make(script),
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return script;
|
|
28
|
+
};
|
package/src/translations.ts
CHANGED
|
@@ -2,105 +2,106 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Script } from '@dxos/
|
|
5
|
+
import { Script } from '@dxos/compute';
|
|
6
6
|
import { type Resource } from '@dxos/react-ui';
|
|
7
7
|
|
|
8
|
-
import { meta } from '
|
|
9
|
-
import { Notebook } from '
|
|
8
|
+
import { meta } from '#meta';
|
|
9
|
+
import { Notebook } from '#types';
|
|
10
10
|
|
|
11
11
|
export const translations = [
|
|
12
12
|
{
|
|
13
13
|
'en-US': {
|
|
14
14
|
[Script.Script.typename]: {
|
|
15
|
-
'typename
|
|
16
|
-
'typename
|
|
17
|
-
'typename
|
|
18
|
-
'typename
|
|
19
|
-
'object
|
|
20
|
-
'
|
|
21
|
-
'
|
|
15
|
+
'typename.label': 'Script',
|
|
16
|
+
'typename.label_zero': 'Scripts',
|
|
17
|
+
'typename.label_one': 'Script',
|
|
18
|
+
'typename.label_other': 'Scripts',
|
|
19
|
+
'object-name.placeholder': 'New script',
|
|
20
|
+
'add-object.label': 'Add script',
|
|
21
|
+
'rename-object.label': 'Rename script',
|
|
22
|
+
'delete-object.label': 'Delete script',
|
|
23
|
+
'object-deleted.label': 'Script deleted',
|
|
22
24
|
},
|
|
23
25
|
[Notebook.Notebook.typename]: {
|
|
24
|
-
'typename
|
|
25
|
-
'typename
|
|
26
|
-
'typename
|
|
27
|
-
'typename
|
|
28
|
-
'object
|
|
29
|
-
'
|
|
30
|
-
'
|
|
26
|
+
'typename.label': 'Notebook',
|
|
27
|
+
'typename.label_zero': 'Notebooks',
|
|
28
|
+
'typename.label_one': 'Notebook',
|
|
29
|
+
'typename.label_other': 'Notebooks',
|
|
30
|
+
'object-name.placeholder': 'New notebook',
|
|
31
|
+
'add-object.label': 'Add notebook',
|
|
32
|
+
'rename-object.label': 'Rename notebook',
|
|
33
|
+
'delete-object.label': 'Delete notebook',
|
|
34
|
+
'object-deleted.label': 'Notebook deleted',
|
|
31
35
|
},
|
|
32
36
|
[meta.id]: {
|
|
33
|
-
'plugin
|
|
34
|
-
'settings
|
|
35
|
-
'description
|
|
36
|
-
'description
|
|
37
|
-
'binding
|
|
38
|
-
'function
|
|
39
|
-
'deploy
|
|
40
|
-
'deployed
|
|
41
|
-
'upload
|
|
42
|
-
'copy
|
|
43
|
-
'format
|
|
44
|
-
'toggle
|
|
45
|
-
'authenticate
|
|
46
|
-
'authenticate
|
|
47
|
-
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
'function
|
|
51
|
-
'function
|
|
52
|
-
'
|
|
53
|
-
'
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
59
|
-
'blueprint
|
|
60
|
-
'blueprint
|
|
61
|
-
'blueprint
|
|
62
|
-
'
|
|
63
|
-
'
|
|
64
|
-
'
|
|
65
|
-
'
|
|
66
|
-
'
|
|
67
|
-
'
|
|
68
|
-
'
|
|
69
|
-
'function panel label': 'Debug Function',
|
|
70
|
-
'script test label': 'Test',
|
|
71
|
-
'script logs label': 'Logs',
|
|
37
|
+
'plugin.name': 'Scripts',
|
|
38
|
+
'settings.title': 'Scripts settings',
|
|
39
|
+
'description.label': 'Description',
|
|
40
|
+
'description.placeholder': 'Enter description',
|
|
41
|
+
'binding.placeholder': 'Function name',
|
|
42
|
+
'function-request.placeholder': 'Function request',
|
|
43
|
+
'deploy.label': 'Deploy',
|
|
44
|
+
'deployed.label': 'Current version of the script is deployed',
|
|
45
|
+
'upload-failed.label': 'Upload failed',
|
|
46
|
+
'copy-link.label': 'Copy function link',
|
|
47
|
+
'format.label': 'Format',
|
|
48
|
+
'toggle-details.label': 'Toggle details panel',
|
|
49
|
+
'authenticate-action.label': 'Authenticate functions service',
|
|
50
|
+
'authenticate-action.description':
|
|
51
|
+
'Sign in to the remote functions service to enable script deployment and execution.',
|
|
52
|
+
'authenticate-button.label': 'Authenticate',
|
|
53
|
+
'name.label': 'Name',
|
|
54
|
+
'remote-function-settings.heading': 'Remote Function',
|
|
55
|
+
'function-url.label': 'Invocation URL',
|
|
56
|
+
'function-binding.label': 'Function binding',
|
|
57
|
+
'function-binding.placeholder': 'Enter binding name (e.g., NAME)',
|
|
58
|
+
'script-publish-settings.label': 'Publishing',
|
|
59
|
+
'script-publish-settings.description': 'Scripts can be shared publicly as Github gists.',
|
|
60
|
+
'no-github-token.label': 'This space has no GitHub access token available.',
|
|
61
|
+
'open-token-manager.label': 'Open Token Manager',
|
|
62
|
+
'publish.label': 'Publish',
|
|
63
|
+
'blueprint-editor.label': 'Blueprint',
|
|
64
|
+
'blueprint-editor.description': 'Create a blueprint that exposes this script as a tool.',
|
|
65
|
+
'blueprint-instructions.label': 'Instructions',
|
|
66
|
+
'blueprint-instructions.placeholder': 'Describe how this tool should be used.',
|
|
67
|
+
'create-blueprint.label': 'Create blueprint',
|
|
68
|
+
'update-blueprint.label': 'Update blueprint',
|
|
69
|
+
'function-panel.label': 'Debug Function',
|
|
70
|
+
'script-test.label': 'Test',
|
|
71
|
+
'script-logs.label': 'Logs',
|
|
72
|
+
'compute.label': 'Compute',
|
|
72
73
|
|
|
73
|
-
'deployment
|
|
74
|
-
'deployment
|
|
75
|
-
'deployment
|
|
76
|
-
'deployment
|
|
77
|
-
'deployment
|
|
78
|
-
'deployment
|
|
79
|
-
'deployment
|
|
74
|
+
'deployment-dialog.title': 'Default Scripts',
|
|
75
|
+
'deployment-dialog-scripts-found.message': 'Script templates:',
|
|
76
|
+
'deployment-dialog-deploy-functions-button.label_one': 'Create and deploy script',
|
|
77
|
+
'deployment-dialog-deploy-functions-button.label_other': 'Create and deploy scripts',
|
|
78
|
+
'deployment-dialog-deploy-functions-pending-button.label_one': 'Deploying script',
|
|
79
|
+
'deployment-dialog-deploy-functions-pending-button.label_other': 'Deploying scripts',
|
|
80
|
+
'deployment-dialog-skip-button.label': 'Skip',
|
|
80
81
|
|
|
81
|
-
'script
|
|
82
|
-
'script
|
|
83
|
-
'script
|
|
84
|
-
'script
|
|
85
|
-
'script
|
|
86
|
-
'script
|
|
87
|
-
'script
|
|
88
|
-
'script
|
|
89
|
-
'script
|
|
90
|
-
'script
|
|
91
|
-
'script
|
|
92
|
-
'script
|
|
82
|
+
'script-deployment-toast.label_one': 'Script deployed',
|
|
83
|
+
'script-deployment-toast.label_other': 'Scripts deployed',
|
|
84
|
+
'script-deployment-toast.description_one': 'Your script has been deployed successfully.',
|
|
85
|
+
'script-deployment-toast.description_other': 'Your scripts have been deployed successfully.',
|
|
86
|
+
'script-deployment-toast-close.label_one': 'Close',
|
|
87
|
+
'script-deployment-toast-close.label_other': 'Close',
|
|
88
|
+
'script-deployment-error-toast.label_one': 'Script deployment failed',
|
|
89
|
+
'script-deployment-error-toast.label_other': 'Scripts deployment failed',
|
|
90
|
+
'script-deployment-error-toast.description_one': 'There was an error deploying your script.',
|
|
91
|
+
'script-deployment-error-toast.description_other': 'There was an error deploying your scripts.',
|
|
92
|
+
'script-deployment-error-toast-close.label_one': 'Close',
|
|
93
|
+
'script-deployment-error-toast-close.label_other': 'Close',
|
|
93
94
|
|
|
94
|
-
'notebook
|
|
95
|
-
'notebook
|
|
96
|
-
'notebook
|
|
97
|
-
'notebook
|
|
98
|
-
'notebook
|
|
99
|
-
'notebook
|
|
100
|
-
'notebook
|
|
101
|
-
'notebook
|
|
102
|
-
'notebook
|
|
103
|
-
'notebook
|
|
95
|
+
'notebook-cell.placeholder': 'Enter script',
|
|
96
|
+
'notebook-cell-delete.label': 'Delete cell',
|
|
97
|
+
'notebook-cell-prompt-run.label': 'Run',
|
|
98
|
+
'notebook-cell-insert-markdown.label': 'Insert Markdown',
|
|
99
|
+
'notebook-cell-insert-script.label': 'Insert Script',
|
|
100
|
+
'notebook-cell-insert-prompt.label': 'Insert Prompt',
|
|
101
|
+
'notebook-cell-insert-query.label': 'Insert Query',
|
|
102
|
+
'notebook-markdown.placeholder': 'Enter Markdown',
|
|
103
|
+
'notebook-prompt.placeholder': 'Enter prompt',
|
|
104
|
+
'notebook-cell-insert.label': 'Insert cell',
|
|
104
105
|
},
|
|
105
106
|
},
|
|
106
107
|
},
|
package/src/types/Notebook.ts
CHANGED
|
@@ -4,38 +4,42 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { Obj, Type } from '@dxos/echo';
|
|
9
|
-
import {
|
|
7
|
+
import { Routine } from '@dxos/compute';
|
|
8
|
+
import { Annotation, Obj, Ref, Type } from '@dxos/echo';
|
|
9
|
+
import { FormInputAnnotation } from '@dxos/echo/internal';
|
|
10
10
|
import { LabelAnnotation } from '@dxos/echo/internal';
|
|
11
|
-
import {
|
|
11
|
+
import { Graph } from '@dxos/plugin-explorer';
|
|
12
|
+
import { Text } from '@dxos/schema';
|
|
12
13
|
|
|
13
14
|
export type CellType = 'markdown' | 'script' | 'query' | 'prompt' | 'view';
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
+
export const Cell = Schema.Struct({
|
|
16
17
|
id: Schema.String,
|
|
17
18
|
type: Schema.String,
|
|
18
19
|
name: Schema.optional(Schema.String),
|
|
19
20
|
// TODO(burdon): Union type.
|
|
20
|
-
source: Schema.optional(
|
|
21
|
-
prompt: Schema.optional(
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
export interface
|
|
26
|
-
export const Cell: Schema.Schema<Cell, Cell_Encoded> = Cell_;
|
|
21
|
+
source: Schema.optional(Ref.Ref(Text.Text)),
|
|
22
|
+
prompt: Schema.optional(Ref.Ref(Routine.Routine)),
|
|
23
|
+
graph: Schema.optional(Ref.Ref(Graph.Graph)),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export interface Cell extends Schema.Schema.Type<typeof Cell> {}
|
|
27
27
|
|
|
28
28
|
export const Notebook = Schema.Struct({
|
|
29
29
|
name: Schema.String.pipe(Schema.optional),
|
|
30
|
-
cells: Cell.pipe(Schema.Array,
|
|
30
|
+
cells: Cell.pipe(Schema.Array, FormInputAnnotation.set(false)),
|
|
31
31
|
}).pipe(
|
|
32
|
-
Type.
|
|
33
|
-
typename: 'dxos.
|
|
32
|
+
Type.object({
|
|
33
|
+
typename: 'org.dxos.type.notebook',
|
|
34
34
|
version: '0.1.0',
|
|
35
35
|
}),
|
|
36
36
|
LabelAnnotation.set(['name']),
|
|
37
|
+
Annotation.IconAnnotation.set({
|
|
38
|
+
icon: 'ph--notebook--regular',
|
|
39
|
+
hue: 'sky',
|
|
40
|
+
}),
|
|
37
41
|
);
|
|
38
42
|
|
|
39
43
|
export type Notebook = Schema.Schema.Type<typeof Notebook>;
|
|
40
44
|
|
|
41
|
-
export const make = (props: Obj.MakeProps<typeof Notebook> = { cells: [] }) => Obj.make(Notebook, props);
|
|
45
|
+
export const make = (props: Obj.MakeProps<typeof Notebook> = { cells: [] }): Notebook => Obj.make(Notebook, props);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
8
|
+
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
import { type Compiler as CompilerType } from '../compiler';
|
|
14
|
+
|
|
15
|
+
// Inline import to avoid `Settings` namespace alias colliding with the
|
|
16
|
+
// `Settings` capability export below.
|
|
17
|
+
export const Settings = Capability.make<Atom.Writable<import('./Settings').Settings>>(`${meta.id}.capability.settings`);
|
|
18
|
+
export const Compiler = Capability.make<CompilerType>(`${meta.id}.capability.compiler`);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Script, Operation } from '@dxos/compute';
|
|
10
|
+
import { Database } from '@dxos/echo';
|
|
11
|
+
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
14
|
+
import { templates } from '../templates';
|
|
15
|
+
|
|
16
|
+
const SCRIPT_OPERATION = `${meta.id}.operation`;
|
|
17
|
+
|
|
18
|
+
export const ScriptProps = Schema.Struct({
|
|
19
|
+
name: Schema.optional(Schema.String),
|
|
20
|
+
gistUrl: Schema.optional(Schema.String.annotations({ title: 'Import from Gist (url)' })),
|
|
21
|
+
initialTemplateId: Schema.Literal(...templates.map(({ id }) => id)).pipe(
|
|
22
|
+
Schema.annotations({ title: 'Template' }),
|
|
23
|
+
Schema.optional,
|
|
24
|
+
),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const NotebookProps = Schema.Struct({
|
|
28
|
+
name: Schema.optional(Schema.String),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const CreateScript = Operation.make({
|
|
32
|
+
meta: { key: `${SCRIPT_OPERATION}.create-script`, name: 'Create Script' },
|
|
33
|
+
input: Schema.extend(
|
|
34
|
+
ScriptProps,
|
|
35
|
+
Schema.Struct({
|
|
36
|
+
db: Database.Database,
|
|
37
|
+
}),
|
|
38
|
+
),
|
|
39
|
+
output: Schema.Struct({
|
|
40
|
+
object: Script.Script,
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { EditorInputMode } from '@dxos/ui-editor/types';
|
|
10
|
+
|
|
11
|
+
export const Settings = Schema.mutable(
|
|
12
|
+
Schema.Struct({
|
|
13
|
+
editorInputMode: EditorInputMode.annotations({
|
|
14
|
+
title: 'Editor input mode',
|
|
15
|
+
description: 'Choose the keybinding style for the script editor.',
|
|
16
|
+
}),
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export interface Settings extends Schema.Schema.Type<typeof Settings> {}
|
package/src/types/index.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * from './actions';
|
|
6
|
-
export * as Notebook from './Notebook';
|
|
7
5
|
export * from './types';
|
|
6
|
+
|
|
7
|
+
export * as Notebook from './Notebook';
|
|
8
|
+
export * as ScriptCapabilities from './ScriptCapabilities';
|
|
9
|
+
export * as ScriptEvents from './ScriptEvents';
|
|
10
|
+
export * as ScriptOperation from './ScriptOperation';
|
package/src/types/types.ts
CHANGED
|
@@ -2,14 +2,4 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { EditorInputMode } from '@dxos/react-ui-editor';
|
|
8
|
-
|
|
9
|
-
export const ScriptSettings = Schema.mutable(
|
|
10
|
-
Schema.Struct({
|
|
11
|
-
editorInputMode: EditorInputMode,
|
|
12
|
-
}),
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
export type ScriptSettings = Schema.Schema.Type<typeof ScriptSettings>;
|
|
5
|
+
export * as Settings from './Settings';
|
package/src/util/deploy.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Client } from '@dxos/client';
|
|
6
|
+
import { Script, Operation } from '@dxos/compute';
|
|
7
|
+
import { Context } from '@dxos/context';
|
|
6
8
|
import { Obj, Ref } from '@dxos/echo';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
9
|
+
import { getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
10
|
+
import { bundleFunction } from '@dxos/functions-runtime/bundler';
|
|
11
|
+
import { FunctionsServiceClient, incrementSemverPatch } from '@dxos/functions-runtime/edge';
|
|
10
12
|
import { log } from '@dxos/log';
|
|
13
|
+
import { FunctionRuntimeKind } from '@dxos/protocols';
|
|
11
14
|
import { type Space } from '@dxos/react-client/echo';
|
|
12
|
-
import { isNode } from '@dxos/util';
|
|
13
|
-
|
|
14
|
-
import { updateFunctionMetadata } from './functions';
|
|
15
15
|
|
|
16
16
|
export const isScriptDeployed = ({ script, fn }: { script: Script.Script; fn: any }): boolean => {
|
|
17
17
|
const existingFunctionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
|
|
@@ -22,7 +22,7 @@ type DeployScriptProps = {
|
|
|
22
22
|
script: Script.Script;
|
|
23
23
|
client: Client;
|
|
24
24
|
space: Space;
|
|
25
|
-
fn?:
|
|
25
|
+
fn?: Operation.PersistentOperation;
|
|
26
26
|
existingFunctionId?: string;
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -44,32 +44,30 @@ export const deployScript = async ({
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
try {
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const buildResult = await bundleFunction({
|
|
48
|
+
source: script.source!.target!.content,
|
|
49
|
+
});
|
|
49
50
|
if ('error' in buildResult) {
|
|
50
51
|
throw buildResult.error || new Error('Bundle creation failed');
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
const
|
|
54
|
-
|
|
54
|
+
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
55
|
+
const newFunction = await functionsServiceClient.deploy(Context.default(), {
|
|
56
|
+
// TODO(dmaretskyi): Space key or identity key.
|
|
55
57
|
ownerPublicKey: space.key,
|
|
56
|
-
version: fn ? incrementSemverPatch(fn.version) : '0.0.1',
|
|
58
|
+
version: fn ? incrementSemverPatch(Obj.getMeta(fn).version ?? '0.0.0') : '0.0.1',
|
|
57
59
|
functionId: existingFunctionId,
|
|
58
60
|
entryPoint: buildResult.entryPoint,
|
|
59
|
-
assets:
|
|
61
|
+
assets: buildResult.assets,
|
|
62
|
+
runtime: FunctionRuntimeKind.enums.WORKER_LOADER,
|
|
60
63
|
});
|
|
61
64
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const storedFunction = createOrUpdateFunctionInSpace(space, fn, script, functionId, version);
|
|
67
|
-
script.changed = false;
|
|
68
|
-
updateFunctionMetadata(script, storedFunction, meta, functionId);
|
|
69
|
-
|
|
70
|
-
setUserFunctionIdInMetadata(Obj.getMeta(storedFunction), functionId);
|
|
65
|
+
const storedFunction = createOrUpdateFunctionInSpace(space, fn, script, newFunction);
|
|
66
|
+
Obj.update(script, (script) => {
|
|
67
|
+
script.changed = false;
|
|
68
|
+
});
|
|
71
69
|
|
|
72
|
-
return { success: true, functionId };
|
|
70
|
+
return { success: true, functionId: getUserFunctionIdInMetadata(Obj.getMeta(storedFunction)) };
|
|
73
71
|
} catch (err: any) {
|
|
74
72
|
log.catch(err);
|
|
75
73
|
return { success: false, error: err };
|
|
@@ -88,19 +86,17 @@ const validateDeployInputs = (script: Script.Script, space: Space): Error | null
|
|
|
88
86
|
|
|
89
87
|
const createOrUpdateFunctionInSpace = (
|
|
90
88
|
space: Space,
|
|
91
|
-
fn:
|
|
89
|
+
fn: Operation.PersistentOperation | undefined,
|
|
92
90
|
script: Script.Script,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
): Function.Function => {
|
|
91
|
+
newFunction: Operation.PersistentOperation,
|
|
92
|
+
): Operation.PersistentOperation => {
|
|
96
93
|
if (fn) {
|
|
97
|
-
fn
|
|
98
|
-
fn.version = version;
|
|
94
|
+
Operation.setFrom(fn, newFunction);
|
|
99
95
|
return fn;
|
|
100
96
|
} else {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return
|
|
97
|
+
Obj.update(newFunction, (newFunction) => {
|
|
98
|
+
newFunction.source = Ref.make(script);
|
|
99
|
+
});
|
|
100
|
+
return space.db.add(newFunction);
|
|
105
101
|
}
|
|
106
102
|
};
|