@dxos/plugin-script 0.8.4-main.c85a9c8dae → 0.8.4-main.dfabb4ec29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/{browser/DeploymentDialog-IIOXAS47.mjs → neutral/DeploymentDialog-6DBF3V6C.mjs} +22 -48
- package/dist/lib/neutral/DeploymentDialog-6DBF3V6C.mjs.map +7 -0
- package/dist/lib/{browser/NotebookContainer-VVZOKGRC.mjs → neutral/NotebookContainer-FIAQI3A2.mjs} +49 -139
- package/dist/lib/neutral/NotebookContainer-FIAQI3A2.mjs.map +7 -0
- package/dist/lib/{browser/ScriptContainer-A5SSIUH6.mjs → neutral/ScriptContainer-2OPBAXFB.mjs} +13 -27
- package/dist/lib/neutral/ScriptContainer-2OPBAXFB.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/ScriptPluginSettings-T4JMUSHN.mjs +31 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs.map +7 -0
- package/dist/lib/neutral/ScriptProperties-F6NE6M4H.mjs +296 -0
- package/dist/lib/neutral/ScriptProperties-F6NE6M4H.mjs.map +7 -0
- package/dist/lib/neutral/TestContainer-JNFPLAJX.mjs +44 -0
- package/dist/lib/neutral/TestContainer-JNFPLAJX.mjs.map +7 -0
- package/dist/lib/neutral/access-token-created-ENMCEGVU.mjs +34 -0
- package/dist/lib/neutral/access-token-created-ENMCEGVU.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/{browser/blueprint-definition-YMZEJBAZ.mjs → neutral/blueprint-definition-T33SBPP2.mjs} +4 -6
- package/dist/lib/neutral/blueprint-definition-T33SBPP2.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/blueprints/index.mjs +3 -1
- 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-2DMPFVUM.mjs +8 -0
- package/dist/lib/neutral/chunk-2DMPFVUM.mjs.map +7 -0
- package/dist/lib/{browser/chunk-G3XIOLLI.mjs → neutral/chunk-4RJALG6K.mjs} +21 -44
- package/dist/lib/neutral/chunk-4RJALG6K.mjs.map +7 -0
- package/dist/lib/neutral/chunk-B4FVQEHV.mjs +8 -0
- package/dist/lib/neutral/chunk-B4FVQEHV.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/{browser/chunk-J7PGML5B.mjs → neutral/chunk-BUKQITZT.mjs} +29 -29
- package/dist/lib/neutral/chunk-BUKQITZT.mjs.map +7 -0
- package/dist/lib/{browser/chunk-ATTZUDT7.mjs → neutral/chunk-D7DFASAE.mjs} +5 -20
- package/dist/lib/neutral/chunk-D7DFASAE.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-PDB6UOSB.mjs +125 -0
- package/dist/lib/neutral/chunk-PDB6UOSB.mjs.map +7 -0
- package/dist/lib/{browser/chunk-WYR4QHPE.mjs → neutral/chunk-UYR3YH4Q.mjs} +3 -3
- package/dist/lib/{browser/chunk-WYR4QHPE.mjs.map → neutral/chunk-UYR3YH4Q.mjs.map} +3 -3
- package/dist/lib/{browser/compiler-53G6ZHQM.mjs → neutral/compiler-SMVIP5UN.mjs} +24 -22
- package/dist/lib/neutral/compiler-SMVIP5UN.mjs.map +7 -0
- package/dist/lib/{browser/chunk-PLDBKKYO.mjs → neutral/components/index.mjs} +163 -233
- 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-OZRIZ7RN.mjs +44 -0
- package/dist/lib/neutral/create-OZRIZ7RN.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-VBA3SLSU.mjs +45 -0
- package/dist/lib/neutral/create-script-VBA3SLSU.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-CXVW54JJ.mjs +62 -0
- package/dist/lib/neutral/deploy-CXVW54JJ.mjs.map +7 -0
- package/dist/lib/{browser/chunk-MUEVLYXJ.mjs → neutral/hooks/index.mjs} +52 -80
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +41 -0
- package/dist/lib/neutral/inspect-invocations-LEOEP5I2.mjs +59 -0
- package/dist/lib/neutral/inspect-invocations-LEOEP5I2.mjs.map +7 -0
- package/dist/lib/neutral/install-function-5N24Q45W.mjs +51 -0
- package/dist/lib/neutral/install-function-5N24Q45W.mjs.map +7 -0
- package/dist/lib/neutral/invoke-5QVEZ3X5.mjs +33 -0
- package/dist/lib/neutral/invoke-5QVEZ3X5.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-OTCWYDFI.mjs +18 -0
- package/dist/lib/neutral/operation-handler-OTCWYDFI.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-FVD7NYPA.mjs +30 -0
- package/dist/lib/neutral/query-deployed-functions-FVD7NYPA.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-JH2AOK7V.mjs +117 -0
- package/dist/lib/neutral/react-surface-JH2AOK7V.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/{browser/settings-76UM7442.mjs → neutral/settings-VJBW4OMK.mjs} +6 -12
- 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 +1 -0
- 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/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 +141 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/delete.d.ts +18 -0
- package/dist/types/src/blueprints/functions/delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts +22 -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 +29 -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 +22 -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 +22 -0
- package/dist/types/src/blueprints/functions/read.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +27 -0
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler.d.ts +6 -0
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -0
- 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 -6
- 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.map +1 -0
- package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +2 -5
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- 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 +1 -1
- 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 +4 -2
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +219 -228
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -1
- 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 +7 -6
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +219 -228
- 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/TypescriptEditor/TypescriptEditor.d.ts +5 -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 +3 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +219 -228
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +1 -2
- package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +5 -5
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookContainer/index.d.ts +1 -2
- package/dist/types/src/containers/NotebookContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +7 -7
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.stories.d.ts +242 -0
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptContainer/index.d.ts +1 -2
- package/dist/types/src/containers/ScriptContainer/index.d.ts.map +1 -1
- 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 +4 -5
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -1
- 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 +1 -2
- package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -1
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts +1 -1
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -1
- package/dist/types/src/containers/TestContainer/index.d.ts +1 -2
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +0 -2
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +17 -5
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +1 -1
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +1 -1
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -1
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +1 -1
- 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 +4 -5
- package/dist/types/src/templates/anthropic.d.ts.map +1 -1
- package/dist/types/src/templates/chat.d.ts.map +1 -1
- package/dist/types/src/templates/chess-bot.d.ts +8 -12
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
- package/dist/types/src/templates/commentary.d.ts +8 -11
- package/dist/types/src/templates/commentary.d.ts.map +1 -1
- 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 +3 -2
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +3 -2
- 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 +29 -29
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +2 -1
- 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/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 +37 -25
- 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 -4
- 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 +153 -104
- package/src/ScriptPlugin.node.ts +21 -0
- package/src/ScriptPlugin.test.ts +31 -0
- package/src/ScriptPlugin.tsx +11 -43
- 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 +70 -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 +35 -0
- package/src/blueprints/functions/query-deployed-functions.ts +31 -0
- package/src/blueprints/functions/read.ts +29 -0
- package/src/blueprints/functions/update.ts +68 -0
- package/src/blueprints/script-blueprint.ts +32 -8
- package/src/capabilities/app-graph-builder.ts +47 -0
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +4 -5
- package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
- package/src/capabilities/{compiler/compiler.ts → compiler.ts} +17 -9
- package/src/capabilities/create-object.ts +48 -0
- package/src/capabilities/index.ts +14 -6
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +21 -0
- package/src/capabilities/react-surface.tsx +130 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +4 -4
- package/src/compiler/compiler.ts +8 -1
- package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +2 -2
- package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +23 -12
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +8 -9
- package/src/components/NotebookStack/NotebookStack.tsx +24 -13
- package/src/components/QueryEditor/QueryEditor.stories.tsx +5 -11
- 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 +5 -5
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +24 -26
- package/src/components/TestPanel/TestPanel.tsx +91 -177
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +4 -4
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +25 -18
- package/src/components/index.ts +5 -1
- package/src/constants.ts +2 -2
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +5 -3
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +26 -26
- package/src/containers/DeploymentDialog/index.ts +1 -3
- package/src/containers/NotebookContainer/NotebookContainer.stories.tsx +21 -23
- package/src/containers/NotebookContainer/NotebookContainer.tsx +39 -53
- package/src/containers/NotebookContainer/index.ts +1 -3
- package/src/containers/ScriptContainer/ScriptContainer.stories.tsx +106 -0
- package/src/containers/ScriptContainer/ScriptContainer.tsx +14 -13
- package/src/containers/ScriptContainer/index.ts +1 -3
- package/src/containers/ScriptProperties/BlueprintEditor.tsx +101 -0
- package/src/containers/ScriptProperties/FunctionBinding.tsx +83 -0
- package/src/containers/ScriptProperties/FunctionPublishing.tsx +121 -0
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +75 -0
- package/src/containers/ScriptProperties/ScriptProperties.tsx +12 -21
- package/src/containers/ScriptProperties/index.ts +1 -3
- package/src/containers/TestContainer/TestContainer.tsx +24 -8
- package/src/containers/TestContainer/index.ts +1 -3
- package/src/containers/index.ts +0 -2
- package/src/e2e/ai.test.ts +7 -6
- package/src/e2e/deploy.test.ts +6 -4
- package/src/hooks/deploy.ts +10 -8
- package/src/hooks/format.ts +5 -5
- package/src/hooks/template.ts +7 -6
- package/src/hooks/useCompiler.ts +3 -2
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +4 -3
- package/src/index.ts +2 -5
- package/src/meta.ts +2 -2
- package/src/notebook/compute-graph.test.ts +7 -7
- package/src/notebook/compute-graph.ts +1 -1
- 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 +19 -12
- package/src/templates/chat.ts +1 -1
- package/src/templates/chess-bot.ts +42 -37
- package/src/templates/commentary.ts +179 -161
- package/src/templates/data-generator.ts +1 -1
- package/src/templates/discord.ts +3 -3
- package/src/templates/forex-effect.ts +30 -19
- package/src/templates/forex.ts +24 -15
- package/src/templates/gmail.ts +4 -4
- package/src/templates/index.ts +18 -18
- package/src/templates/ping.ts +16 -8
- package/src/testing/index.ts +2 -1
- package/src/testing/simulator.test.ts +3 -4
- package/src/testing/{data.ts → test-notebook.ts} +11 -12
- package/src/testing/test-script.ts +29 -0
- package/src/translations.ts +86 -87
- package/src/types/Notebook.ts +9 -5
- 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 -4
- package/src/types/types.ts +1 -11
- package/src/util/deploy.ts +13 -11
- package/src/util/functions.ts +9 -8
- package/dist/lib/browser/DeploymentDialog-IIOXAS47.mjs.map +0 -7
- package/dist/lib/browser/NotebookContainer-VVZOKGRC.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-A5SSIUH6.mjs.map +0 -7
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs +0 -294
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs.map +0 -7
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs +0 -55
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs.map +0 -7
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs +0 -28
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs.map +0 -7
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs +0 -39
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs +0 -69
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-YMZEJBAZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-6IXFDTAI.mjs +0 -113
- package/dist/lib/browser/chunk-6IXFDTAI.mjs.map +0 -7
- package/dist/lib/browser/chunk-ATTZUDT7.mjs.map +0 -7
- package/dist/lib/browser/chunk-G3XIOLLI.mjs.map +0 -7
- package/dist/lib/browser/chunk-J7PGML5B.mjs.map +0 -7
- package/dist/lib/browser/chunk-MUEVLYXJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-PLDBKKYO.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q66L5EUR.mjs +0 -20
- package/dist/lib/browser/chunk-Q66L5EUR.mjs.map +0 -7
- package/dist/lib/browser/chunk-TW27W3EL.mjs +0 -29
- package/dist/lib/browser/chunk-TW27W3EL.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs +0 -11
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs.map +0 -7
- package/dist/lib/browser/compiler-53G6ZHQM.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -250
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs +0 -79
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs.map +0 -7
- package/dist/lib/browser/react-surface-26P6HAFD.mjs +0 -141
- package/dist/lib/browser/react-surface-26P6HAFD.mjs.map +0 -7
- package/dist/lib/browser/settings-76UM7442.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -18
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs +0 -139
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-ZLWTNMQA.mjs +0 -851
- package/dist/lib/node-esm/NotebookContainer-ZLWTNMQA.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs +0 -94
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs +0 -295
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs +0 -56
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs +0 -29
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs.map +0 -7
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs +0 -40
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs +0 -70
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.mjs +0 -18
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -9
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs +0 -176
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs +0 -33
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-H46R2RS5.mjs +0 -790
- package/dist/lib/node-esm/chunk-H46R2RS5.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-JGN7TDJH.mjs +0 -69
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QG6ANK4B.mjs +0 -107
- package/dist/lib/node-esm/chunk-QG6ANK4B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs +0 -31
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs +0 -22
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs +0 -12
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs +0 -114
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs +0 -398
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs +0 -100
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -251
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-HFFDXWND.mjs +0 -80
- package/dist/lib/node-esm/operation-resolver-HFFDXWND.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-THCIK266.mjs +0 -142
- package/dist/lib/node-esm/react-surface-THCIK266.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs +0 -37
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs.map +0 -7
- package/dist/lib/node-esm/templates/index.mjs +0 -11
- package/dist/lib/node-esm/types/index.mjs +0 -19
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler/compiler.d.ts +0 -6
- package/dist/types/src/capabilities/compiler/compiler.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler/index.d.ts +0 -3
- package/dist/types/src/capabilities/compiler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -7
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.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/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts +0 -7
- package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts +0 -3
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts +0 -8
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts +0 -3
- package/dist/types/src/containers/ScriptPluginSettings/index.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 -40
- package/dist/types/src/types/actions.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -12
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -56
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/compiler/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -75
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -121
- package/src/capabilities/settings/index.ts +0 -7
- package/src/components/FrameContainer/frame.html +0 -25
- package/src/components/FrameContainer/frame.tsx +0 -51
- package/src/containers/ScriptObjectSettings/ScriptObjectSettings.tsx +0 -291
- package/src/containers/ScriptObjectSettings/index.ts +0 -7
- package/src/containers/ScriptPluginSettings/ScriptPluginSettings.tsx +0 -66
- package/src/containers/ScriptPluginSettings/index.ts +0 -7
- package/src/types/actions.ts +0 -45
- package/src/types/capabilities.ts +0 -17
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser → 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/templates → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprints → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/templates/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{artifact-definition/artifact-definition.d.ts → artifact-definition.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Octokit } from '@octokit/core';
|
|
6
|
+
import React, { useCallback, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { SettingsOperation } from '@dxos/app-toolkit';
|
|
10
|
+
import { type Script } from '@dxos/compute';
|
|
11
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
12
|
+
import { log } from '@dxos/log';
|
|
13
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
import { Button, Clipboard, Message, useAsyncEffect, useTranslation } from '@dxos/react-ui';
|
|
15
|
+
import { Form } from '@dxos/react-ui-form';
|
|
16
|
+
import { AccessToken } from '@dxos/types';
|
|
17
|
+
import { kebabize } from '@dxos/util';
|
|
18
|
+
|
|
19
|
+
import { meta } from '#meta';
|
|
20
|
+
|
|
21
|
+
export type FunctionPublishingProps = { object: Script.Script };
|
|
22
|
+
|
|
23
|
+
// TODO(burdon): Move to separate tab?
|
|
24
|
+
export const FunctionPublishing = ({ object }: FunctionPublishingProps) => {
|
|
25
|
+
const { t } = useTranslation(meta.id);
|
|
26
|
+
const { invokePromise } = useOperationInvoker();
|
|
27
|
+
const db = Obj.getDatabase(object);
|
|
28
|
+
|
|
29
|
+
const [githubToken] = useQuery(db, Filter.type(AccessToken.AccessToken, { source: 'github.com' }));
|
|
30
|
+
const gistKey = Obj.getMeta(object).keys.find(({ source }) => source === 'github.com');
|
|
31
|
+
const [gistUrl, setGistUrl] = useState<string | undefined>();
|
|
32
|
+
|
|
33
|
+
useAsyncEffect(async () => {
|
|
34
|
+
const token = githubToken?.token;
|
|
35
|
+
const gistId = gistKey?.id;
|
|
36
|
+
if (!token || !gistId) {
|
|
37
|
+
setGistUrl(undefined);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const octokit = new Octokit({ auth: githubToken.token });
|
|
43
|
+
const response = await octokit.request('GET /gists/{gist_id}', {
|
|
44
|
+
gist_id: gistId,
|
|
45
|
+
});
|
|
46
|
+
setGistUrl(response.data.html_url);
|
|
47
|
+
} catch (err) {
|
|
48
|
+
log.catch(err);
|
|
49
|
+
setGistUrl(undefined);
|
|
50
|
+
}
|
|
51
|
+
}, [githubToken, gistKey]);
|
|
52
|
+
|
|
53
|
+
const handleOpenTokenManager = useCallback(
|
|
54
|
+
() =>
|
|
55
|
+
invokePromise(SettingsOperation.Open, {
|
|
56
|
+
plugin: 'org.dxos.plugin.token-manager',
|
|
57
|
+
}),
|
|
58
|
+
[invokePromise],
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const [publishing, setPublishing] = useState(false);
|
|
62
|
+
const handlePublish = useCallback(async () => {
|
|
63
|
+
setPublishing(true);
|
|
64
|
+
const octokit = new Octokit({ auth: githubToken.token });
|
|
65
|
+
const source = await object.source.load();
|
|
66
|
+
const filename = object.name ? kebabize(object.name) : 'composer-script';
|
|
67
|
+
const files = { [`${filename}.ts`]: { content: source.content } };
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
// TODO(wittjosiah): Factor out to intent.
|
|
71
|
+
const meta = Obj.getMeta(object);
|
|
72
|
+
const githubKey = meta.keys.find(({ source }) => source === 'github.com');
|
|
73
|
+
const gistId = githubKey?.id;
|
|
74
|
+
if (gistId) {
|
|
75
|
+
await octokit.request('PATCH /gists/{gist_id}', {
|
|
76
|
+
gist_id: gistId,
|
|
77
|
+
files,
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
const response = await octokit.request('POST /gists', {
|
|
81
|
+
public: true,
|
|
82
|
+
files,
|
|
83
|
+
});
|
|
84
|
+
const gistId = response.data.id;
|
|
85
|
+
if (gistId) {
|
|
86
|
+
Obj.update(object, (object) => {
|
|
87
|
+
Obj.getMeta(object).keys.push({ source: 'github.com', id: gistId });
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
} finally {
|
|
92
|
+
setPublishing(false);
|
|
93
|
+
}
|
|
94
|
+
}, [object, githubToken]);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div className='flex flex-col'>
|
|
98
|
+
<Form.Section label={t('script-publish-settings.label')} description={t('script-publish-settings.description')} />
|
|
99
|
+
|
|
100
|
+
{!githubToken && (
|
|
101
|
+
<div className='flex flex-col py-form-gap'>
|
|
102
|
+
<Message.Root valence='info'>
|
|
103
|
+
<Message.Title>{t('no-github-token.label')}</Message.Title>
|
|
104
|
+
</Message.Root>
|
|
105
|
+
<div className='flex pt-form-gap'>
|
|
106
|
+
<Button onClick={handleOpenTokenManager}>{t('open-token-manager.label')}</Button>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
)}
|
|
110
|
+
|
|
111
|
+
{githubToken && (
|
|
112
|
+
<div className='flex justify-end gap-2'>
|
|
113
|
+
{gistUrl && <Clipboard.IconButton value={gistUrl} />}
|
|
114
|
+
<Button disabled={publishing} onClick={handlePublish}>
|
|
115
|
+
{t('publish.label')}
|
|
116
|
+
</Button>
|
|
117
|
+
</div>
|
|
118
|
+
)}
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { Blueprint } from '@dxos/compute';
|
|
11
|
+
import { Script } from '@dxos/compute';
|
|
12
|
+
import { Operation } from '@dxos/compute';
|
|
13
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
14
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
15
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
16
|
+
import { Filter, useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
17
|
+
import { ObjectProperties } from '@dxos/react-ui-form';
|
|
18
|
+
import { Loading, withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
19
|
+
import { Text } from '@dxos/schema';
|
|
20
|
+
|
|
21
|
+
import { createScript } from '#testing';
|
|
22
|
+
import { translations } from '#translations';
|
|
23
|
+
|
|
24
|
+
import { ScriptProperties } from './ScriptProperties';
|
|
25
|
+
|
|
26
|
+
type DefaultStoryProps = {};
|
|
27
|
+
|
|
28
|
+
const DefaultStory = (_: DefaultStoryProps) => {
|
|
29
|
+
const [space] = useSpaces();
|
|
30
|
+
const [script] = useQuery(space?.db, Filter.type(Script.Script));
|
|
31
|
+
if (!script) {
|
|
32
|
+
return <Loading />;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<ObjectProperties object={script}>
|
|
37
|
+
<ScriptProperties role='object-properties' subject={script} />
|
|
38
|
+
</ObjectProperties>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const meta = {
|
|
43
|
+
title: 'plugins/plugin-script/containers/ScriptProperties',
|
|
44
|
+
render: DefaultStory,
|
|
45
|
+
decorators: [
|
|
46
|
+
withTheme(),
|
|
47
|
+
withLayout({ layout: 'column' }),
|
|
48
|
+
withPluginManager({
|
|
49
|
+
plugins: [
|
|
50
|
+
...corePlugins(),
|
|
51
|
+
ClientPlugin({
|
|
52
|
+
types: [Script.Script, Operation.PersistentOperation, Blueprint.Blueprint, Text.Text],
|
|
53
|
+
onClientInitialized: ({ client }) =>
|
|
54
|
+
Effect.gen(function* () {
|
|
55
|
+
yield* initializeIdentity(client);
|
|
56
|
+
const [space] = client.spaces.get();
|
|
57
|
+
yield* Effect.promise(() => space.waitUntilReady());
|
|
58
|
+
createScript(space);
|
|
59
|
+
}),
|
|
60
|
+
}),
|
|
61
|
+
StorybookPlugin({}),
|
|
62
|
+
],
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
parameters: {
|
|
66
|
+
layout: 'fullscreen',
|
|
67
|
+
translations,
|
|
68
|
+
},
|
|
69
|
+
} satisfies Meta<DefaultStoryProps>;
|
|
70
|
+
|
|
71
|
+
export default meta;
|
|
72
|
+
|
|
73
|
+
type Story = StoryObj<typeof meta>;
|
|
74
|
+
|
|
75
|
+
export const Default: Story = {};
|
|
@@ -4,30 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { type Script } from '@dxos/
|
|
9
|
-
import { Input, useTranslation } from '@dxos/react-ui';
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { type Script } from '@dxos/compute';
|
|
10
9
|
|
|
11
|
-
import {
|
|
10
|
+
import { BlueprintEditor } from './BlueprintEditor';
|
|
11
|
+
import { FunctionBinding } from './FunctionBinding';
|
|
12
|
+
import { FunctionPublishing } from './FunctionPublishing';
|
|
12
13
|
|
|
13
|
-
export type ScriptPropertiesProps =
|
|
14
|
-
object: Script.Script;
|
|
15
|
-
};
|
|
14
|
+
export type ScriptPropertiesProps = AppSurface.ObjectPropertiesProps<Script.Script>;
|
|
16
15
|
|
|
17
|
-
export const ScriptProperties = ({ object }: ScriptPropertiesProps) => {
|
|
18
|
-
const { t } = useTranslation(meta.id);
|
|
16
|
+
export const ScriptProperties = ({ subject: object }: ScriptPropertiesProps) => {
|
|
19
17
|
return (
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
onChange={(event) => {
|
|
26
|
-
Obj.change(object, (o) => {
|
|
27
|
-
o.description = event.target.value;
|
|
28
|
-
});
|
|
29
|
-
}}
|
|
30
|
-
/>
|
|
31
|
-
</Input.Root>
|
|
18
|
+
<div className='flex flex-col py-form-gap gap-form-section-gap'>
|
|
19
|
+
<FunctionBinding object={object} />
|
|
20
|
+
<BlueprintEditor object={object} />
|
|
21
|
+
<FunctionPublishing object={object} />
|
|
22
|
+
</div>
|
|
32
23
|
);
|
|
33
24
|
};
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type Script } from '@dxos/
|
|
7
|
+
import { type Script } from '@dxos/compute';
|
|
8
|
+
import { Context } from '@dxos/context';
|
|
9
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
10
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
8
11
|
import { Panel } from '@dxos/react-ui';
|
|
9
12
|
|
|
10
|
-
import { TestPanel } from '
|
|
11
|
-
import {
|
|
13
|
+
import { TestPanel } from '#components';
|
|
14
|
+
import { useDeployDeps } from '#hooks';
|
|
12
15
|
|
|
13
16
|
export type TestContainerProps = {
|
|
14
17
|
role: string;
|
|
@@ -16,12 +19,25 @@ export type TestContainerProps = {
|
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
export const TestContainer = ({ role, script }: TestContainerProps) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
22
|
+
const { client, fn, existingFunctionId } = useDeployDeps({ script });
|
|
23
|
+
const space = getSpace(script);
|
|
24
|
+
|
|
25
|
+
const functionsClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);
|
|
26
|
+
|
|
27
|
+
const handleInvoke = useCallback(
|
|
28
|
+
async (input: unknown) => {
|
|
29
|
+
if (!fn) {
|
|
30
|
+
throw new Error('Function not deployed');
|
|
31
|
+
}
|
|
32
|
+
return functionsClient.invoke(Context.default(), fn, input, { spaceId: space?.id });
|
|
33
|
+
},
|
|
34
|
+
[fn, functionsClient, space?.id],
|
|
35
|
+
);
|
|
36
|
+
|
|
21
37
|
return (
|
|
22
|
-
<Panel.Root role={role} className='dx-
|
|
38
|
+
<Panel.Root role={role} className='dx-document'>
|
|
23
39
|
<Panel.Content asChild>
|
|
24
|
-
<TestPanel
|
|
40
|
+
<TestPanel onInvoke={existingFunctionId ? handleInvoke : undefined} />
|
|
25
41
|
</Panel.Content>
|
|
26
42
|
</Panel.Root>
|
|
27
43
|
);
|
package/src/containers/index.ts
CHANGED
|
@@ -7,7 +7,5 @@ import { type ComponentType, lazy } from 'react';
|
|
|
7
7
|
export const DeploymentDialog: ComponentType<any> = lazy(() => import('./DeploymentDialog'));
|
|
8
8
|
export const NotebookContainer: ComponentType<any> = lazy(() => import('./NotebookContainer'));
|
|
9
9
|
export const ScriptContainer: ComponentType<any> = lazy(() => import('./ScriptContainer'));
|
|
10
|
-
export const ScriptObjectSettings: ComponentType<any> = lazy(() => import('./ScriptObjectSettings'));
|
|
11
|
-
export const ScriptPluginSettings: ComponentType<any> = lazy(() => import('./ScriptPluginSettings'));
|
|
12
10
|
export const ScriptProperties: ComponentType<any> = lazy(() => import('./ScriptProperties'));
|
|
13
11
|
export const TestContainer: ComponentType<any> = lazy(() => import('./TestContainer'));
|
package/src/e2e/ai.test.ts
CHANGED
|
@@ -7,15 +7,16 @@ import { test } from 'vitest';
|
|
|
7
7
|
|
|
8
8
|
import { Client } from '@dxos/client';
|
|
9
9
|
import { type Space } from '@dxos/client-protocol';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
10
11
|
import { configPreset } from '@dxos/config';
|
|
11
|
-
import {
|
|
12
|
+
import { Context } from '@dxos/context';
|
|
12
13
|
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
13
14
|
import { bundleFunction } from '@dxos/functions-runtime/native';
|
|
14
15
|
import { FunctionRuntimeKind } from '@dxos/protocols';
|
|
15
16
|
import { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
16
17
|
|
|
17
18
|
// To heavy to run in CI.
|
|
18
|
-
describe.
|
|
19
|
+
describe.skip('Function', { tags: ['functions-e2e'] }, () => {
|
|
19
20
|
const config = configPreset({ edge: 'local' });
|
|
20
21
|
|
|
21
22
|
test('bundle anthropic function', { timeout: 120_000 }, async () => {
|
|
@@ -47,14 +48,14 @@ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e')).skip('Functi
|
|
|
47
48
|
new URL('../templates/anthropic.ts', import.meta.url).pathname,
|
|
48
49
|
);
|
|
49
50
|
|
|
50
|
-
const result = await functionsServiceClient.invoke(func, {
|
|
51
|
+
const result = await functionsServiceClient.invoke(Context.default(), func, {
|
|
51
52
|
message: 'Hello, world!',
|
|
52
53
|
});
|
|
53
54
|
console.log(result);
|
|
54
55
|
});
|
|
55
56
|
|
|
56
57
|
const setup = async () => {
|
|
57
|
-
const client = await new Client({ config, types: [
|
|
58
|
+
const client = await new Client({ config, types: [Operation.PersistentOperation] }).initialize();
|
|
58
59
|
await client.halo.createIdentity();
|
|
59
60
|
|
|
60
61
|
const space = await client.spaces.create();
|
|
@@ -66,7 +67,7 @@ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e')).skip('Functi
|
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
const sync = async (space: Space) => {
|
|
69
|
-
await space.db.flush(
|
|
70
|
+
await space.db.flush();
|
|
70
71
|
await space.internal.syncToEdge({
|
|
71
72
|
onProgress: (state) =>
|
|
72
73
|
console.log(state ? `${state.unsyncedDocumentCount} documents syncing...` : 'connecting to edge...'),
|
|
@@ -78,7 +79,7 @@ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e')).skip('Functi
|
|
|
78
79
|
entryPoint,
|
|
79
80
|
verbose: true,
|
|
80
81
|
});
|
|
81
|
-
const func = await functionsServiceClient.deploy({
|
|
82
|
+
const func = await functionsServiceClient.deploy(Context.default(), {
|
|
82
83
|
version: '0.0.1',
|
|
83
84
|
ownerPublicKey: space.key,
|
|
84
85
|
entryPoint: artifact.entryPoint,
|
package/src/e2e/deploy.test.ts
CHANGED
|
@@ -3,18 +3,20 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { readFile } from 'node:fs/promises';
|
|
6
|
-
|
|
7
6
|
import { describe, expect, test } from 'vitest';
|
|
8
7
|
|
|
9
8
|
import { Client, type Config } from '@dxos/client';
|
|
10
9
|
import { createEdgeIdentity } from '@dxos/client/edge';
|
|
11
10
|
import { configPreset } from '@dxos/config';
|
|
11
|
+
import { Context } from '@dxos/context';
|
|
12
12
|
import { bundleFunction } from '@dxos/functions-runtime/bundler';
|
|
13
13
|
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
14
14
|
import { invariant } from '@dxos/invariant';
|
|
15
15
|
import { log } from '@dxos/log';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
// TODO(wittjosiah): Re-enable once @dxos/compute.js is available at the R2 dev bucket
|
|
18
|
+
// (https://pub-5745ae82e450484aa28f75fc6a175935.r2.dev/dev/@dxos/compute.js currently 404s).
|
|
19
|
+
describe.skip('Functions deployment', { tags: ['functions-e2e'] }, () => {
|
|
18
20
|
test('deploys FOREX (effect) function and invokes it via EDGE (main)', { timeout: 120_000 }, async () => {
|
|
19
21
|
const config = configPreset({ edge: 'main' });
|
|
20
22
|
await testDeploy(config);
|
|
@@ -42,7 +44,7 @@ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e'))('Functions d
|
|
|
42
44
|
}
|
|
43
45
|
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
44
46
|
|
|
45
|
-
const func = await functionsServiceClient.deploy({
|
|
47
|
+
const func = await functionsServiceClient.deploy(Context.default(), {
|
|
46
48
|
ownerPublicKey: space.key,
|
|
47
49
|
version: '0.0.1',
|
|
48
50
|
entryPoint: buildResult.entryPoint,
|
|
@@ -55,7 +57,7 @@ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e'))('Functions d
|
|
|
55
57
|
edgeClient.setIdentity(createEdgeIdentity(client));
|
|
56
58
|
|
|
57
59
|
const input = { from: 'USD', to: 'EUR' };
|
|
58
|
-
const result = await functionsServiceClient.invoke(func, input);
|
|
60
|
+
const result = await functionsServiceClient.invoke(Context.default(), func, input);
|
|
59
61
|
log.info('>>> result', { result, func });
|
|
60
62
|
const resultNumber = Number(result);
|
|
61
63
|
expect(resultNumber).toBeGreaterThan(0);
|
package/src/hooks/deploy.ts
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import { Script, Operation } from '@dxos/compute';
|
|
7
8
|
import { Obj, Query, Ref } from '@dxos/echo';
|
|
8
|
-
import {
|
|
9
|
+
import { getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
9
10
|
import { log } from '@dxos/log';
|
|
10
11
|
import { type Client, useClient } from '@dxos/react-client';
|
|
11
12
|
import { type Space, getSpace, useQuery } from '@dxos/react-client/echo';
|
|
@@ -13,7 +14,8 @@ import { type TFunction } from '@dxos/react-ui';
|
|
|
13
14
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
14
15
|
import { messageValence } from '@dxos/ui-theme';
|
|
15
16
|
|
|
16
|
-
import { meta } from '
|
|
17
|
+
import { meta } from '#meta';
|
|
18
|
+
|
|
17
19
|
import { deployScript, getFunctionUrl, isScriptDeployed } from '../util';
|
|
18
20
|
|
|
19
21
|
export type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };
|
|
@@ -30,7 +32,7 @@ import { type ScriptToolbarStateStore } from './useToolbarState';
|
|
|
30
32
|
export type CreateDeployOptions = {
|
|
31
33
|
state: ScriptToolbarStateStore;
|
|
32
34
|
script: Script.Script;
|
|
33
|
-
fn:
|
|
35
|
+
fn: Operation.PersistentOperation;
|
|
34
36
|
space?: Space;
|
|
35
37
|
existingFunctionId?: string;
|
|
36
38
|
client: Client;
|
|
@@ -42,7 +44,7 @@ export const createDeploy = ({ state, script, space, fn, client, existingFunctio
|
|
|
42
44
|
|
|
43
45
|
// TODO(wittjosiah): Should this be an action?
|
|
44
46
|
const errorItem = createMenuAction('error', () => {}, {
|
|
45
|
-
label: value.error ?? ['no
|
|
47
|
+
label: value.error ?? ['no-error.label', { ns: meta.id }],
|
|
46
48
|
icon: 'ph--warning-circle--regular',
|
|
47
49
|
hidden: !value.error,
|
|
48
50
|
classNames: value.error && messageValence('error'),
|
|
@@ -62,14 +64,14 @@ export const createDeploy = ({ state, script, space, fn, client, existingFunctio
|
|
|
62
64
|
|
|
63
65
|
if (!result.success) {
|
|
64
66
|
log.catch(result.error);
|
|
65
|
-
state.set('error', t('upload
|
|
67
|
+
state.set('error', t('upload-failed.label'));
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
state.set('deploying', false);
|
|
69
71
|
},
|
|
70
72
|
{
|
|
71
73
|
type: 'deploy',
|
|
72
|
-
label: [value.deploying ? 'publishing
|
|
74
|
+
label: [value.deploying ? 'publishing.label' : 'deploy.label', { ns: meta.id }],
|
|
73
75
|
icon: value.deploying ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular',
|
|
74
76
|
disabled: value.deploying,
|
|
75
77
|
classNames: value.deploying ? '[&_svg]:animate-spin' : '',
|
|
@@ -85,7 +87,7 @@ export const createDeploy = ({ state, script, space, fn, client, existingFunctio
|
|
|
85
87
|
},
|
|
86
88
|
{
|
|
87
89
|
type: 'copy',
|
|
88
|
-
label: ['copy
|
|
90
|
+
label: ['copy-link.label', { ns: meta.id }],
|
|
89
91
|
icon: 'ph--link--regular',
|
|
90
92
|
disabled: !value.functionUrl,
|
|
91
93
|
},
|
|
@@ -126,7 +128,7 @@ export const useDeployState = ({ state, script }: { state: ScriptToolbarStateSto
|
|
|
126
128
|
export const useDeployDeps = ({ script }: { script: Script.Script }) => {
|
|
127
129
|
const client = useClient();
|
|
128
130
|
const space = getSpace(script);
|
|
129
|
-
const [fn] = useQuery(space?.db, Query.type(
|
|
131
|
+
const [fn] = useQuery(space?.db, Query.type(Operation.PersistentOperation, { source: Ref.make(script) }));
|
|
130
132
|
const existingFunctionId = useMemo(() => fn && getUserFunctionIdInMetadata(Obj.getMeta(fn)), [fn]);
|
|
131
133
|
return { client, space, fn, existingFunctionId };
|
|
132
134
|
};
|
package/src/hooks/format.ts
CHANGED
|
@@ -6,12 +6,12 @@ import { format } from 'prettier';
|
|
|
6
6
|
import prettierPluginEstree from 'prettier/plugins/estree';
|
|
7
7
|
import prettierPluginTypescript from 'prettier/plugins/typescript';
|
|
8
8
|
|
|
9
|
+
import { type Script } from '@dxos/compute';
|
|
9
10
|
import { Obj } from '@dxos/echo';
|
|
10
|
-
import { type Script } from '@dxos/functions';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
13
13
|
|
|
14
|
-
import { meta } from '
|
|
14
|
+
import { meta } from '#meta';
|
|
15
15
|
|
|
16
16
|
export type FormatActionProperties = { type: 'format' };
|
|
17
17
|
|
|
@@ -30,8 +30,8 @@ export const createFormat = (script: Script.Script) => {
|
|
|
30
30
|
semi: true,
|
|
31
31
|
singleQuote: true,
|
|
32
32
|
});
|
|
33
|
-
Obj.
|
|
34
|
-
|
|
33
|
+
Obj.update(script.source.target!, (obj) => {
|
|
34
|
+
obj.content = formatted;
|
|
35
35
|
});
|
|
36
36
|
} catch (err: any) {
|
|
37
37
|
// TODO(wittjosiah): Show error in UI.
|
|
@@ -39,7 +39,7 @@ export const createFormat = (script: Script.Script) => {
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
|
-
label: ['format
|
|
42
|
+
label: ['format.label', { ns: meta.id }],
|
|
43
43
|
icon: 'ph--magic-wand--regular',
|
|
44
44
|
},
|
|
45
45
|
);
|
package/src/hooks/template.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Script } from '@dxos/compute';
|
|
5
6
|
import { Obj } from '@dxos/echo';
|
|
6
|
-
import { FUNCTIONS_PRESET_META_KEY
|
|
7
|
+
import { FUNCTIONS_PRESET_META_KEY } from '@dxos/functions';
|
|
7
8
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
8
9
|
|
|
9
10
|
import { templates } from '../templates';
|
|
@@ -15,9 +16,9 @@ const createTemplateSelectActions = (script: Script.Script) => {
|
|
|
15
16
|
return createMenuAction<TemplateActionProperties>(
|
|
16
17
|
`template--${template.id}`,
|
|
17
18
|
() => {
|
|
18
|
-
Obj.
|
|
19
|
-
|
|
20
|
-
const meta = Obj.getMeta(
|
|
19
|
+
Obj.update(script, (script) => {
|
|
20
|
+
script.name = template.name;
|
|
21
|
+
const meta = Obj.getMeta(script);
|
|
21
22
|
const oldPresetIndex = meta.keys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);
|
|
22
23
|
if (oldPresetIndex >= 0) {
|
|
23
24
|
meta.keys.splice(oldPresetIndex, 1);
|
|
@@ -27,8 +28,8 @@ const createTemplateSelectActions = (script: Script.Script) => {
|
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
30
|
if (script.source?.target) {
|
|
30
|
-
Obj.
|
|
31
|
-
|
|
31
|
+
Obj.update(script.source.target, (obj) => {
|
|
32
|
+
obj.content = template.source;
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
},
|
package/src/hooks/useCompiler.ts
CHANGED
|
@@ -6,9 +6,10 @@ import { useCapabilities, usePluginManager } from '@dxos/app-framework/ui';
|
|
|
6
6
|
import { runAndForwardErrors } from '@dxos/effect';
|
|
7
7
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
|
+
import { ScriptEvents } from '#types';
|
|
10
|
+
import { ScriptCapabilities } from '#types';
|
|
11
|
+
|
|
9
12
|
import type { Compiler } from '../compiler';
|
|
10
|
-
import { ScriptEvents } from '../types';
|
|
11
|
-
import { ScriptCapabilities } from '../types';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Asynchronously sets up the compiler and returns it.
|
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
import { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { Script } from '@dxos/compute';
|
|
8
9
|
import { Obj } from '@dxos/echo';
|
|
9
|
-
import { Script } from '@dxos/functions';
|
|
10
10
|
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import { SpaceOperation } from '@dxos/plugin-space
|
|
11
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
12
12
|
import { useClient } from '@dxos/react-client';
|
|
13
13
|
import { type Space } from '@dxos/react-client/echo';
|
|
14
14
|
|
|
15
|
+
import { ScriptOperation } from '#types';
|
|
16
|
+
|
|
15
17
|
import { type Template } from '../templates';
|
|
16
|
-
import { ScriptOperation } from '../types';
|
|
17
18
|
import { deployScript } from '../util';
|
|
18
19
|
|
|
19
20
|
type DeploymentStatus = 'idle' | 'pending' | 'success' | 'error';
|
package/src/index.ts
CHANGED
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
export * from './components';
|
|
7
|
-
export * from './containers';
|
|
5
|
+
export * from './blueprints';
|
|
8
6
|
export * from './meta';
|
|
7
|
+
export * from './types';
|
|
9
8
|
export * from './util';
|
|
10
|
-
|
|
11
|
-
export * from './ScriptPlugin';
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
9
|
+
id: 'org.dxos.plugin.script',
|
|
10
10
|
name: 'Scripts',
|
|
11
11
|
description: trim`
|
|
12
12
|
Write and deploy custom JavaScript functions that extend your workspace capabilities.
|
|
@@ -22,5 +22,5 @@ export const meta: Plugin.Meta = {
|
|
|
22
22
|
// TODO(ZaymonFC): Configure by scopes?
|
|
23
23
|
export const defaultScriptsForIntegration: Record<string, string[]> = {
|
|
24
24
|
// TODO(wittjosiah): Also include content extraction scripts in the default set.
|
|
25
|
-
'gmail.com': ['dxos.
|
|
25
|
+
'gmail.com': ['org.dxos.script.gmail'],
|
|
26
26
|
};
|
|
@@ -7,7 +7,7 @@ import { describe, expect, test } from 'vitest';
|
|
|
7
7
|
|
|
8
8
|
import { Obj } from '@dxos/echo';
|
|
9
9
|
|
|
10
|
-
import { createNotebook } from '
|
|
10
|
+
import { createNotebook } from '#testing';
|
|
11
11
|
|
|
12
12
|
import { ComputeGraph } from './compute-graph';
|
|
13
13
|
|
|
@@ -43,8 +43,8 @@ describe('notebook', () => {
|
|
|
43
43
|
// Replace one of the cells with code that tries to access window/document.
|
|
44
44
|
const sourceTarget = notebook.cells[2].source?.target;
|
|
45
45
|
if (sourceTarget) {
|
|
46
|
-
Obj.
|
|
47
|
-
|
|
46
|
+
Obj.update(sourceTarget, (sourceTarget) => {
|
|
47
|
+
sourceTarget.content = 'b = typeof window';
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -57,8 +57,8 @@ describe('notebook', () => {
|
|
|
57
57
|
|
|
58
58
|
// Test document access.
|
|
59
59
|
if (sourceTarget) {
|
|
60
|
-
Obj.
|
|
61
|
-
|
|
60
|
+
Obj.update(sourceTarget, (sourceTarget) => {
|
|
61
|
+
sourceTarget.content = 'b = typeof document';
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
graph.parse();
|
|
@@ -69,8 +69,8 @@ describe('notebook', () => {
|
|
|
69
69
|
|
|
70
70
|
// Test that safe globals still work.
|
|
71
71
|
if (sourceTarget) {
|
|
72
|
-
Obj.
|
|
73
|
-
|
|
72
|
+
Obj.update(sourceTarget, (sourceTarget) => {
|
|
73
|
+
sourceTarget.content = 'b = Math.max(100, 200)';
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
graph.parse();
|