@dxos/plugin-script 0.8.4-main.937b3ca → 0.8.4-main.abd8ff62ef
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/README.md +15 -13
- package/dist/lib/browser/DeploymentDialog-6DBF3V6C.mjs +112 -0
- package/dist/lib/browser/DeploymentDialog-6DBF3V6C.mjs.map +7 -0
- package/dist/lib/browser/{NotebookContainer-4MM2VAQF.mjs → NotebookContainer-RO4NJRYH.mjs} +59 -144
- package/dist/lib/browser/NotebookContainer-RO4NJRYH.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-2OPBAXFB.mjs +79 -0
- package/dist/lib/browser/ScriptContainer-2OPBAXFB.mjs.map +7 -0
- package/dist/lib/browser/ScriptProperties-NRXG4PBX.mjs +304 -0
- package/dist/lib/browser/ScriptProperties-NRXG4PBX.mjs.map +7 -0
- package/dist/lib/browser/TestContainer-JNFPLAJX.mjs +44 -0
- package/dist/lib/browser/TestContainer-JNFPLAJX.mjs.map +7 -0
- package/dist/lib/browser/access-token-created-MSWZWZCT.mjs +37 -0
- package/dist/lib/browser/access-token-created-MSWZWZCT.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +53 -3
- package/dist/lib/browser/blueprints/index.mjs.map +4 -4
- package/dist/lib/browser/chunk-KF6H7J5N.mjs +81 -0
- package/dist/lib/browser/chunk-KF6H7J5N.mjs.map +7 -0
- package/dist/lib/browser/chunk-MI6X5CTJ.mjs +336 -0
- package/dist/lib/browser/chunk-MI6X5CTJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UX4GHJ5E.mjs → chunk-NSAF3763.mjs} +29 -29
- package/dist/lib/browser/chunk-NSAF3763.mjs.map +7 -0
- package/dist/lib/browser/chunk-RQ5LDVFK.mjs +49 -0
- package/dist/lib/browser/chunk-RQ5LDVFK.mjs.map +7 -0
- package/dist/lib/browser/containers/index.mjs +17 -0
- package/dist/lib/browser/containers/index.mjs.map +7 -0
- package/dist/lib/browser/create-JDXWBARB.mjs +44 -0
- package/dist/lib/browser/create-JDXWBARB.mjs.map +7 -0
- package/dist/lib/browser/create-script-Q7B3CFAP.mjs +45 -0
- package/dist/lib/browser/create-script-Q7B3CFAP.mjs.map +7 -0
- package/dist/lib/browser/delete-PAUWA2QM.mjs +21 -0
- package/dist/lib/browser/delete-PAUWA2QM.mjs.map +7 -0
- package/dist/lib/browser/deploy-CXVW54JJ.mjs +62 -0
- package/dist/lib/browser/deploy-CXVW54JJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +169 -220
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/inspect-invocations-LEOEP5I2.mjs +59 -0
- package/dist/lib/browser/inspect-invocations-LEOEP5I2.mjs.map +7 -0
- package/dist/lib/browser/install-function-5N24Q45W.mjs +51 -0
- package/dist/lib/browser/install-function-5N24Q45W.mjs.map +7 -0
- package/dist/lib/browser/invoke-5QVEZ3X5.mjs +33 -0
- package/dist/lib/browser/invoke-5QVEZ3X5.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +14 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/query-deployed-functions-FVD7NYPA.mjs +30 -0
- package/dist/lib/browser/query-deployed-functions-FVD7NYPA.mjs.map +7 -0
- package/dist/lib/browser/read-FFOSK6A3.mjs +26 -0
- package/dist/lib/browser/read-FFOSK6A3.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +1 -1
- package/dist/lib/browser/translations.mjs +104 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -7
- package/dist/lib/browser/update-PJS5GG3Y.mjs +63 -0
- package/dist/lib/browser/update-PJS5GG3Y.mjs.map +7 -0
- package/dist/lib/node-esm/DeploymentDialog-A5BZHUJB.mjs +113 -0
- package/dist/lib/node-esm/DeploymentDialog-A5BZHUJB.mjs.map +7 -0
- package/dist/lib/node-esm/{NotebookContainer-QLW5ZYGS.mjs → NotebookContainer-DPT65MA7.mjs} +59 -144
- package/dist/lib/node-esm/NotebookContainer-DPT65MA7.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-UKD7QORM.mjs +80 -0
- package/dist/lib/node-esm/ScriptContainer-UKD7QORM.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptProperties-FQXEOJKG.mjs +305 -0
- package/dist/lib/node-esm/ScriptProperties-FQXEOJKG.mjs.map +7 -0
- package/dist/lib/node-esm/TestContainer-Y4XVV7KQ.mjs +45 -0
- package/dist/lib/node-esm/TestContainer-Y4XVV7KQ.mjs.map +7 -0
- package/dist/lib/node-esm/access-token-created-DCD6LYQC.mjs +38 -0
- package/dist/lib/node-esm/access-token-created-DCD6LYQC.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +53 -3
- package/dist/lib/node-esm/blueprints/index.mjs.map +4 -4
- package/dist/lib/node-esm/chunk-2DZNF5NG.mjs +82 -0
- package/dist/lib/node-esm/chunk-2DZNF5NG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-C55UYWN4.mjs +50 -0
- package/dist/lib/node-esm/chunk-C55UYWN4.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4F5FJZ36.mjs → chunk-EW63XFRQ.mjs} +29 -29
- package/dist/lib/node-esm/chunk-EW63XFRQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XFM2BEHY.mjs +338 -0
- package/dist/lib/node-esm/chunk-XFM2BEHY.mjs.map +7 -0
- package/dist/lib/node-esm/containers/index.mjs +18 -0
- package/dist/lib/node-esm/containers/index.mjs.map +7 -0
- package/dist/lib/node-esm/create-D2JDNXY6.mjs +45 -0
- package/dist/lib/node-esm/create-D2JDNXY6.mjs.map +7 -0
- package/dist/lib/node-esm/create-script-4AB4G7GQ.mjs +46 -0
- package/dist/lib/node-esm/create-script-4AB4G7GQ.mjs.map +7 -0
- package/dist/lib/node-esm/delete-YXLT7J27.mjs +22 -0
- package/dist/lib/node-esm/delete-YXLT7J27.mjs.map +7 -0
- package/dist/lib/node-esm/deploy-MXVZXAUC.mjs +63 -0
- package/dist/lib/node-esm/deploy-MXVZXAUC.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +169 -220
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/inspect-invocations-TVAKGYX5.mjs +60 -0
- package/dist/lib/node-esm/inspect-invocations-TVAKGYX5.mjs.map +7 -0
- package/dist/lib/node-esm/install-function-ST3VABJH.mjs +52 -0
- package/dist/lib/node-esm/install-function-ST3VABJH.mjs.map +7 -0
- package/dist/lib/node-esm/invoke-64WDU55Y.mjs +34 -0
- package/dist/lib/node-esm/invoke-64WDU55Y.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operations/index.mjs +15 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/query-deployed-functions-2VCNGQ7X.mjs +31 -0
- package/dist/lib/node-esm/query-deployed-functions-2VCNGQ7X.mjs.map +7 -0
- package/dist/lib/node-esm/read-PECQUAPS.mjs +27 -0
- package/dist/lib/node-esm/read-PECQUAPS.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +1 -1
- package/dist/lib/node-esm/translations.mjs +105 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +3 -7
- package/dist/lib/node-esm/update-XDFTGSPP.mjs +64 -0
- package/dist/lib/node-esm/update-XDFTGSPP.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/index.d.ts +1 -1
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/script-blueprint.d.ts +3 -21
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/{artifact-definition/artifact-definition.d.ts → artifact-definition.d.ts} +1 -1
- 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/index.d.ts +8 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +7 -0
- 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 -5
- 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/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 +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 +6 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/DeploymentDialog/DeploymentDialog.d.ts +0 -2
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +240 -0
- package/dist/types/src/{components → containers}/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- 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/NotebookContainer/NotebookContainer.d.ts +7 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookContainer/index.d.ts +2 -0
- package/dist/types/src/containers/NotebookContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +10 -0
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +1 -0
- 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 +2 -0
- package/dist/types/src/containers/ScriptContainer/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/{components/TestPanel → containers/TestContainer}/TestContainer.d.ts +1 -1
- 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/hooks/deploy.d.ts +18 -5
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +2 -1
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +2 -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 -2
- 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/definitions.d.ts +29 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.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 +7 -5
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
- package/dist/types/src/templates/commentary.d.ts +7 -4
- 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 +65 -49
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- 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/capabilities.d.ts +2 -5
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- 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 +121 -99
- package/src/ScriptPlugin.node.ts +70 -0
- package/src/ScriptPlugin.test.ts +31 -0
- package/src/ScriptPlugin.tsx +52 -34
- 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/index.ts +1 -1
- package/src/blueprints/script-blueprint.ts +40 -9
- package/src/capabilities/app-graph-builder.ts +47 -0
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +2 -3
- package/src/capabilities/blueprint-definition.ts +19 -0
- package/src/capabilities/{compiler/compiler.ts → compiler.ts} +17 -9
- package/src/capabilities/index.ts +13 -6
- package/src/capabilities/operation-handler.ts +21 -0
- package/src/capabilities/react-surface.tsx +130 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +7 -6
- package/src/compiler/compiler.ts +8 -1
- package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +4 -5
- package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +31 -22
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +7 -9
- package/src/components/NotebookStack/NotebookStack.tsx +27 -16
- package/src/components/QueryEditor/QueryEditor.stories.tsx +18 -22
- 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 +8 -9
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +24 -26
- package/src/components/TestPanel/TestPanel.tsx +110 -194
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +17 -15
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +26 -19
- package/src/components/index.ts +6 -7
- package/src/constants.ts +7 -0
- package/src/{components → containers}/DeploymentDialog/DeploymentDialog.stories.tsx +8 -7
- package/src/{components → containers}/DeploymentDialog/DeploymentDialog.tsx +33 -37
- package/src/containers/DeploymentDialog/index.ts +5 -0
- package/src/{components → containers/NotebookContainer}/NotebookContainer.stories.tsx +18 -20
- package/src/{components → containers/NotebookContainer}/NotebookContainer.tsx +61 -77
- package/src/containers/NotebookContainer/index.ts +5 -0
- package/src/containers/ScriptContainer/ScriptContainer.stories.tsx +106 -0
- package/src/{components → containers/ScriptContainer}/ScriptContainer.tsx +28 -27
- package/src/containers/ScriptContainer/index.ts +5 -0
- 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 +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 +7 -6
- package/src/e2e/deploy.test.ts +5 -5
- package/src/hooks/deploy.ts +15 -13
- package/src/hooks/format.ts +6 -5
- package/src/hooks/template.ts +9 -8
- package/src/hooks/useCompiler.ts +4 -3
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +5 -4
- package/src/hooks/useToolbarState.ts +7 -6
- package/src/index.ts +6 -3
- 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/definitions.ts +40 -0
- package/src/operations/index.ts +12 -0
- package/src/templates/anthropic.ts +19 -12
- package/src/templates/chat.ts +1 -1
- package/src/templates/chess-bot.ts +37 -34
- package/src/templates/commentary.ts +178 -162
- 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} +4 -5
- package/src/testing/test-script.ts +29 -0
- package/src/translations.ts +86 -87
- package/src/types/Notebook.ts +12 -8
- package/src/types/Settings.ts +20 -0
- package/src/types/capabilities.ts +5 -5
- package/src/types/events.ts +2 -2
- package/src/types/index.ts +0 -1
- 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-GXNRUXF6.mjs +0 -14
- package/dist/lib/browser/DeploymentDialog-GXNRUXF6.mjs.map +0 -7
- package/dist/lib/browser/NotebookContainer-4MM2VAQF.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-X6GCYZZW.mjs +0 -149
- package/dist/lib/browser/ScriptContainer-X6GCYZZW.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs +0 -68
- package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs +0 -17
- package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs.map +0 -7
- package/dist/lib/browser/chunk-3O2DQGCP.mjs +0 -113
- package/dist/lib/browser/chunk-3O2DQGCP.mjs.map +0 -7
- package/dist/lib/browser/chunk-BTWHM6FH.mjs +0 -270
- package/dist/lib/browser/chunk-BTWHM6FH.mjs.map +0 -7
- package/dist/lib/browser/chunk-F3QKSKSF.mjs +0 -35
- package/dist/lib/browser/chunk-F3QKSKSF.mjs.map +0 -7
- package/dist/lib/browser/chunk-I7CSE6T3.mjs +0 -110
- package/dist/lib/browser/chunk-I7CSE6T3.mjs.map +0 -7
- package/dist/lib/browser/chunk-IQRLM6JK.mjs +0 -137
- package/dist/lib/browser/chunk-IQRLM6JK.mjs.map +0 -7
- package/dist/lib/browser/chunk-NWSK27QB.mjs +0 -606
- package/dist/lib/browser/chunk-NWSK27QB.mjs.map +0 -7
- package/dist/lib/browser/chunk-UX4GHJ5E.mjs.map +0 -7
- package/dist/lib/browser/chunk-WX2NVNFQ.mjs +0 -557
- package/dist/lib/browser/chunk-WX2NVNFQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-WYR4QHPE.mjs +0 -31
- package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +0 -7
- package/dist/lib/browser/compiler-XRBFQFXO.mjs +0 -161
- package/dist/lib/browser/compiler-XRBFQFXO.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-MUNR376F.mjs +0 -82
- package/dist/lib/browser/operation-resolver-MUNR376F.mjs.map +0 -7
- package/dist/lib/browser/react-surface-5TEC66UY.mjs +0 -139
- package/dist/lib/browser/react-surface-5TEC66UY.mjs.map +0 -7
- package/dist/lib/browser/settings-R4WKREUJ.mjs +0 -35
- package/dist/lib/browser/settings-R4WKREUJ.mjs.map +0 -7
- package/dist/lib/node-esm/DeploymentDialog-EVFV2VJT.mjs +0 -15
- package/dist/lib/node-esm/DeploymentDialog-EVFV2VJT.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-QLW5ZYGS.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-3DZ3BMHW.mjs +0 -150
- package/dist/lib/node-esm/ScriptContainer-3DZ3BMHW.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs +0 -69
- package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs +0 -18
- package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4F5FJZ36.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-KN6SQYUF.mjs +0 -114
- package/dist/lib/node-esm/chunk-KN6SQYUF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MGWKULCD.mjs +0 -558
- package/dist/lib/node-esm/chunk-MGWKULCD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs +0 -112
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VWOLKNMO.mjs +0 -271
- package/dist/lib/node-esm/chunk-VWOLKNMO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs +0 -36
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YEWLTVBT.mjs +0 -138
- package/dist/lib/node-esm/chunk-YEWLTVBT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZQGHFNO3.mjs +0 -607
- package/dist/lib/node-esm/chunk-ZQGHFNO3.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-ORJAXDN7.mjs +0 -162
- package/dist/lib/node-esm/compiler-ORJAXDN7.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-CLE4ZCC5.mjs +0 -83
- package/dist/lib/node-esm/operation-resolver-CLE4ZCC5.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-O3UDMKOQ.mjs +0 -140
- package/dist/lib/node-esm/react-surface-O3UDMKOQ.mjs.map +0 -7
- package/dist/lib/node-esm/settings-OFIMHU7K.mjs +0 -36
- package/dist/lib/node-esm/settings-OFIMHU7K.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/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 -9
- 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 +0 -5
- 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 +0 -9
- package/dist/types/src/capabilities/settings/settings.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 -249
- package/dist/types/src/components/DeploymentDialog/index.d.ts +0 -4
- package/dist/types/src/components/DeploymentDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/frame.d.ts +0 -2
- package/dist/types/src/components/FrameContainer/frame.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/index.d.ts +0 -2
- package/dist/types/src/components/FrameContainer/index.d.ts.map +0 -1
- package/dist/types/src/components/NotebookContainer.d.ts +0 -8
- package/dist/types/src/components/NotebookContainer.d.ts.map +0 -1
- package/dist/types/src/components/NotebookContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/ScriptContainer.d.ts +0 -11
- 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 -8
- 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.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/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -55
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -23
- 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 -74
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -118
- package/src/capabilities/settings/index.ts +0 -7
- 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/Settings/ScriptObjectSettings.tsx +0 -309
- package/src/components/Settings/ScriptPluginSettings.tsx +0 -66
- package/src/components/Settings/index.ts +0 -6
- package/src/components/TestPanel/TestContainer.tsx +0 -27
- package/src/types/actions.ts +0 -45
- /package/dist/types/src/{components → containers/NotebookContainer}/NotebookContainer.stories.d.ts +0 -0
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
templates
|
|
4
|
-
} from "./chunk-4F5FJZ36.mjs";
|
|
5
|
-
import {
|
|
6
|
-
meta
|
|
7
|
-
} from "./chunk-5HSJPAK7.mjs";
|
|
8
|
-
import {
|
|
9
|
-
__export
|
|
10
|
-
} from "./chunk-HSLMI22Q.mjs";
|
|
11
|
-
|
|
12
|
-
// src/types/actions.ts
|
|
13
|
-
import * as Schema from "effect/Schema";
|
|
14
|
-
import { Database } from "@dxos/echo";
|
|
15
|
-
import { Script } from "@dxos/functions";
|
|
16
|
-
import { Operation } from "@dxos/operation";
|
|
17
|
-
var SCRIPT_OPERATION = `${meta.id}/operation`;
|
|
18
|
-
(function(ScriptOperation2) {
|
|
19
|
-
ScriptOperation2.ScriptProps = Schema.Struct({
|
|
20
|
-
name: Schema.optional(Schema.String),
|
|
21
|
-
// TODO(wittjosiah): Placeholder annotation?
|
|
22
|
-
gistUrl: Schema.optional(Schema.String.annotations({
|
|
23
|
-
title: "Import from Gist (url)"
|
|
24
|
-
})),
|
|
25
|
-
initialTemplateId: Schema.Literal(...templates.map(({ id }) => id)).pipe(Schema.annotations({
|
|
26
|
-
title: "Template"
|
|
27
|
-
}), Schema.optional)
|
|
28
|
-
});
|
|
29
|
-
ScriptOperation2.NotebookProps = Schema.Struct({
|
|
30
|
-
name: Schema.optional(Schema.String)
|
|
31
|
-
});
|
|
32
|
-
ScriptOperation2.CreateScript = Operation.make({
|
|
33
|
-
meta: {
|
|
34
|
-
key: `${SCRIPT_OPERATION}/create-script`,
|
|
35
|
-
name: "Create Script"
|
|
36
|
-
},
|
|
37
|
-
schema: {
|
|
38
|
-
input: Schema.extend(ScriptOperation2.ScriptProps, Schema.Struct({
|
|
39
|
-
db: Database.Database
|
|
40
|
-
})),
|
|
41
|
-
output: Schema.Struct({
|
|
42
|
-
object: Script.Script
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
})(ScriptOperation || (ScriptOperation = {}));
|
|
47
|
-
var ScriptOperation;
|
|
48
|
-
|
|
49
|
-
// src/types/capabilities.ts
|
|
50
|
-
import { Capability } from "@dxos/app-framework";
|
|
51
|
-
(function(ScriptCapabilities2) {
|
|
52
|
-
ScriptCapabilities2.Settings = Capability.make(`${meta.id}/capability/settings`);
|
|
53
|
-
ScriptCapabilities2.Compiler = Capability.make(`${meta.id}/capability/compiler`);
|
|
54
|
-
})(ScriptCapabilities || (ScriptCapabilities = {}));
|
|
55
|
-
var ScriptCapabilities;
|
|
56
|
-
|
|
57
|
-
// src/types/events.ts
|
|
58
|
-
import { ActivationEvent } from "@dxos/app-framework";
|
|
59
|
-
(function(ScriptEvents2) {
|
|
60
|
-
ScriptEvents2.SetupCompiler = ActivationEvent.make(`${meta.id}/event/setup-compiler`);
|
|
61
|
-
})(ScriptEvents || (ScriptEvents = {}));
|
|
62
|
-
var ScriptEvents;
|
|
63
|
-
|
|
64
|
-
// src/types/Notebook.ts
|
|
65
|
-
var Notebook_exports = {};
|
|
66
|
-
__export(Notebook_exports, {
|
|
67
|
-
Cell: () => Cell,
|
|
68
|
-
Notebook: () => Notebook,
|
|
69
|
-
make: () => make
|
|
70
|
-
});
|
|
71
|
-
import * as Schema2 from "effect/Schema";
|
|
72
|
-
import { Prompt } from "@dxos/blueprints";
|
|
73
|
-
import { Obj, Type } from "@dxos/echo";
|
|
74
|
-
import { FormInputAnnotation } from "@dxos/echo/internal";
|
|
75
|
-
import { LabelAnnotation } from "@dxos/echo/internal";
|
|
76
|
-
import { Graph } from "@dxos/plugin-explorer/types";
|
|
77
|
-
import { Text } from "@dxos/schema";
|
|
78
|
-
var Cell = Schema2.Struct({
|
|
79
|
-
id: Schema2.String,
|
|
80
|
-
type: Schema2.String,
|
|
81
|
-
name: Schema2.optional(Schema2.String),
|
|
82
|
-
// TODO(burdon): Union type.
|
|
83
|
-
source: Schema2.optional(Type.Ref(Text.Text)),
|
|
84
|
-
prompt: Schema2.optional(Type.Ref(Prompt.Prompt)),
|
|
85
|
-
graph: Schema2.optional(Type.Ref(Graph.Graph))
|
|
86
|
-
}).pipe(Schema2.mutable);
|
|
87
|
-
var Notebook = Schema2.Struct({
|
|
88
|
-
name: Schema2.String.pipe(Schema2.optional),
|
|
89
|
-
cells: Cell.pipe(Schema2.Array, Schema2.mutable, FormInputAnnotation.set(false))
|
|
90
|
-
}).pipe(Type.object({
|
|
91
|
-
typename: "dxos.org/type/Notebook",
|
|
92
|
-
version: "0.1.0"
|
|
93
|
-
}), LabelAnnotation.set([
|
|
94
|
-
"name"
|
|
95
|
-
]));
|
|
96
|
-
var make = (props = {
|
|
97
|
-
cells: []
|
|
98
|
-
}) => Obj.make(Notebook, props);
|
|
99
|
-
|
|
100
|
-
// src/types/types.ts
|
|
101
|
-
import * as Schema3 from "effect/Schema";
|
|
102
|
-
import { EditorInputMode } from "@dxos/ui-editor";
|
|
103
|
-
var ScriptSettings = Schema3.mutable(Schema3.Struct({
|
|
104
|
-
editorInputMode: EditorInputMode
|
|
105
|
-
}));
|
|
106
|
-
|
|
107
|
-
export {
|
|
108
|
-
ScriptOperation,
|
|
109
|
-
ScriptCapabilities,
|
|
110
|
-
ScriptEvents,
|
|
111
|
-
Notebook_exports,
|
|
112
|
-
ScriptSettings
|
|
113
|
-
};
|
|
114
|
-
//# sourceMappingURL=chunk-KN6SQYUF.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/actions.ts", "../../../src/types/capabilities.ts", "../../../src/types/events.ts", "../../../src/types/Notebook.ts", "../../../src/types/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Database } from '@dxos/echo';\nimport { Script } from '@dxos/functions';\nimport { Operation } from '@dxos/operation';\n\nimport { meta } from '../meta';\nimport { templates } from '../templates';\n\nconst SCRIPT_OPERATION = `${meta.id}/operation`;\n\nexport namespace ScriptOperation {\n export const ScriptProps = Schema.Struct({\n name: Schema.optional(Schema.String),\n // TODO(wittjosiah): Placeholder annotation?\n gistUrl: Schema.optional(Schema.String.annotations({ title: 'Import from Gist (url)' })),\n initialTemplateId: Schema.Literal(...templates.map(({ id }) => id)).pipe(\n Schema.annotations({ title: 'Template' }),\n Schema.optional,\n ),\n });\n\n export const NotebookProps = Schema.Struct({\n name: Schema.optional(Schema.String),\n });\n\n export const CreateScript = Operation.make({\n meta: { key: `${SCRIPT_OPERATION}/create-script`, name: 'Create Script' },\n schema: {\n input: Schema.extend(\n ScriptProps,\n Schema.Struct({\n db: Database.Database,\n }),\n ),\n output: Schema.Struct({\n object: Script.Script,\n }),\n },\n });\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom-react';\n\nimport { Capability } from '@dxos/app-framework';\n\nimport { type Compiler } from '../compiler';\nimport { meta } from '../meta';\n\nimport { type ScriptSettings } from './types';\n\nexport namespace ScriptCapabilities {\n export const Settings = Capability.make<Atom.Writable<ScriptSettings>>(`${meta.id}/capability/settings`);\n export const Compiler = Capability.make<Compiler>(`${meta.id}/capability/compiler`);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { ActivationEvent } from '@dxos/app-framework';\n\nimport { meta } from '../meta';\n\nexport namespace ScriptEvents {\n export const SetupCompiler = ActivationEvent.make(`${meta.id}/event/setup-compiler`);\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Prompt } from '@dxos/blueprints';\nimport { Obj, Type } from '@dxos/echo';\nimport { FormInputAnnotation } from '@dxos/echo/internal';\nimport { LabelAnnotation } from '@dxos/echo/internal';\nimport { Graph } from '@dxos/plugin-explorer/types';\nimport { Text } from '@dxos/schema';\n\nexport type CellType = 'markdown' | 'script' | 'query' | 'prompt' | 'view';\n\nexport const Cell = Schema.Struct({\n id: Schema.String,\n type: Schema.String,\n name: Schema.optional(Schema.String),\n // TODO(burdon): Union type.\n source: Schema.optional(Type.Ref(Text.Text)),\n prompt: Schema.optional(Type.Ref(Prompt.Prompt)),\n graph: Schema.optional(Type.Ref(Graph.Graph)),\n}).pipe(Schema.mutable);\n\nexport interface Cell extends Schema.Schema.Type<typeof Cell> {}\n\nexport const Notebook = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n cells: Cell.pipe(Schema.Array, Schema.mutable, FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Notebook',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n\nexport type Notebook = Schema.Schema.Type<typeof Notebook>;\n\nexport const make = (props: Obj.MakeProps<typeof Notebook> = { cells: [] }): Notebook => Obj.make(Notebook, props);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { EditorInputMode } from '@dxos/ui-editor';\n\nexport const ScriptSettings = Schema.mutable(\n Schema.Struct({\n editorInputMode: EditorInputMode,\n }),\n);\n\nexport type ScriptSettings = Schema.Schema.Type<typeof ScriptSettings>;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,iBAAiB;AAK1B,IAAMC,mBAAmB,GAAGC,KAAKC,EAAE;UAElBC,kBAAAA;mBACFC,cAAqBC,cAAO;IACvCC,MAAaC,gBAAgBC,aAAM;;IAEnCC,SAAgBF,gBAAgBC,cAAOE,YAAY;MAAEC,OAAO;IAAyB,CAAA,CAAA;IACrFC,mBAA0BC,eAAO,GAAIC,UAAUC,IAAI,CAAC,EAAEb,GAAE,MAAOA,EAAAA,CAAAA,EAAKc,KAC3DN,mBAAY;MAAEC,OAAO;IAAW,CAAA,GAChCJ,eAAQ;EAEnB,CAAA;mBAEaU,gBAAuBZ,cAAO;IACzCC,MAAaC,gBAAgBC,aAAM;EACrC,CAAA;mBAEaU,eAAeC,UAAUC,KAAK;IACzCnB,MAAM;MAAEoB,KAAK,GAAGrB,gBAAAA;MAAkCM,MAAM;IAAgB;IACxEgB,QAAQ;MACNC,OAAcC,cAAMrB,iBAClBC,aACOC,cAAO;QACZoB,IAAIC,SAASA;MACf,CAAA,CAAA;MAEFC,QAAetB,cAAO;QACpBuB,QAAQC,OAAOA;MACjB,CAAA;IACF;EACF,CAAA;AACF,GA7BiB1B,oBAAAA,kBAAAA,CAAAA,EAAAA;;;;ACTjB,SAAS2B,kBAAkB;UAOVC,qBAAAA;sBACFC,WAAWC,WAAWC,KAAoC,GAAGC,KAAKC,EAAE,sBAAsB;sBAC1FC,WAAWJ,WAAWC,KAAe,GAAGC,KAAKC,EAAE,sBAAsB;AACpF,GAHiBL,uBAAAA,qBAAAA,CAAAA,EAAAA;;;;ACTjB,SAASO,uBAAuB;UAIfC,eAAAA;gBACFC,gBAAgBC,gBAAgBC,KAAK,GAAGC,KAAKC,EAAE,uBAAuB;AACrF,GAFiBL,iBAAAA,eAAAA,CAAAA,EAAAA;;;;ACRjB;;;;;;AAIA,YAAYM,aAAY;AAExB,SAASC,cAAc;AACvB,SAASC,KAAKC,YAAY;AAC1B,SAASC,2BAA2B;AACpC,SAASC,uBAAuB;AAChC,SAASC,aAAa;AACtB,SAASC,YAAY;AAId,IAAMC,OAAcC,eAAO;EAChCC,IAAWC;EACXC,MAAaD;EACbE,MAAaC,iBAAgBH,cAAM;;EAEnCI,QAAeD,iBAASE,KAAKC,IAAIC,KAAKA,IAAI,CAAA;EAC1CC,QAAeL,iBAASE,KAAKC,IAAIG,OAAOA,MAAM,CAAA;EAC9CC,OAAcP,iBAASE,KAAKC,IAAIK,MAAMA,KAAK,CAAA;AAC7C,CAAA,EAAGC,KAAYC,eAAO;AAIf,IAAMC,WAAkBhB,eAAO;EACpCI,MAAaF,eAAOY,KAAYT,gBAAQ;EACxCY,OAAOlB,KAAKe,KAAYI,eAAcH,iBAASI,oBAAoBC,IAAI,KAAA,CAAA;AACzE,CAAA,EAAGN,KACDP,KAAKc,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBJ,IAAI;EAAC;CAAO,CAAA;AAKvB,IAAMK,OAAO,CAACC,QAAwC;EAAET,OAAO,CAAA;AAAG,MAAgBU,IAAIF,KAAKT,UAAUU,KAAAA;;;ACpC5G,YAAYE,aAAY;AAExB,SAASC,uBAAuB;AAEzB,IAAMC,iBAAwBC,gBAC5BC,eAAO;EACZC,iBAAiBC;AACnB,CAAA,CAAA;",
|
|
6
|
-
"names": ["Schema", "Database", "Script", "Operation", "SCRIPT_OPERATION", "meta", "id", "ScriptOperation", "ScriptProps", "Struct", "name", "optional", "String", "gistUrl", "annotations", "title", "initialTemplateId", "Literal", "templates", "map", "pipe", "NotebookProps", "CreateScript", "Operation", "make", "key", "schema", "input", "extend", "db", "Database", "output", "object", "Script", "Capability", "ScriptCapabilities", "Settings", "Capability", "make", "meta", "id", "Compiler", "ActivationEvent", "ScriptEvents", "SetupCompiler", "ActivationEvent", "make", "meta", "id", "Schema", "Prompt", "Obj", "Type", "FormInputAnnotation", "LabelAnnotation", "Graph", "Text", "Cell", "Struct", "id", "String", "type", "name", "optional", "source", "Type", "Ref", "Text", "prompt", "Prompt", "graph", "Graph", "pipe", "mutable", "Notebook", "cells", "Array", "FormInputAnnotation", "set", "object", "typename", "version", "LabelAnnotation", "make", "props", "Obj", "Schema", "EditorInputMode", "ScriptSettings", "mutable", "Struct", "editorInputMode", "EditorInputMode"]
|
|
7
|
-
}
|
|
@@ -1,558 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
ScriptCapabilities,
|
|
4
|
-
ScriptEvents,
|
|
5
|
-
ScriptOperation
|
|
6
|
-
} from "./chunk-KN6SQYUF.mjs";
|
|
7
|
-
import {
|
|
8
|
-
templates
|
|
9
|
-
} from "./chunk-4F5FJZ36.mjs";
|
|
10
|
-
import {
|
|
11
|
-
meta
|
|
12
|
-
} from "./chunk-5HSJPAK7.mjs";
|
|
13
|
-
|
|
14
|
-
// src/util/deploy.ts
|
|
15
|
-
import { Obj, Ref } from "@dxos/echo";
|
|
16
|
-
import { Function, getUserFunctionIdInMetadata } from "@dxos/functions";
|
|
17
|
-
import { bundleFunction } from "@dxos/functions-runtime/bundler";
|
|
18
|
-
import { FunctionsServiceClient, incrementSemverPatch } from "@dxos/functions-runtime/edge";
|
|
19
|
-
import { log } from "@dxos/log";
|
|
20
|
-
import { FunctionRuntimeKind } from "@dxos/protocols";
|
|
21
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/util/deploy.ts";
|
|
22
|
-
var isScriptDeployed = ({ script, fn }) => {
|
|
23
|
-
const existingFunctionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
|
|
24
|
-
return Boolean(existingFunctionId) && !script.changed;
|
|
25
|
-
};
|
|
26
|
-
var deployScript = async ({ script, client, space, fn, existingFunctionId }) => {
|
|
27
|
-
const validationError = validateDeployInputs(script, space);
|
|
28
|
-
if (validationError) {
|
|
29
|
-
return {
|
|
30
|
-
success: false,
|
|
31
|
-
error: validationError
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
const buildResult = await bundleFunction({
|
|
36
|
-
source: script.source.target.content
|
|
37
|
-
});
|
|
38
|
-
if ("error" in buildResult) {
|
|
39
|
-
throw buildResult.error || new Error("Bundle creation failed");
|
|
40
|
-
}
|
|
41
|
-
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
42
|
-
const newFunction = await functionsServiceClient.deploy({
|
|
43
|
-
// TODO(dmaretskyi): Space key or identity key.
|
|
44
|
-
ownerPublicKey: space.key,
|
|
45
|
-
version: fn ? incrementSemverPatch(fn.version) : "0.0.1",
|
|
46
|
-
functionId: existingFunctionId,
|
|
47
|
-
entryPoint: buildResult.entryPoint,
|
|
48
|
-
assets: buildResult.assets,
|
|
49
|
-
runtime: FunctionRuntimeKind.enums.WORKER_LOADER
|
|
50
|
-
});
|
|
51
|
-
const storedFunction = createOrUpdateFunctionInSpace(space, fn, script, newFunction);
|
|
52
|
-
Obj.change(script, (s) => {
|
|
53
|
-
s.changed = false;
|
|
54
|
-
});
|
|
55
|
-
return {
|
|
56
|
-
success: true,
|
|
57
|
-
functionId: getUserFunctionIdInMetadata(Obj.getMeta(storedFunction))
|
|
58
|
-
};
|
|
59
|
-
} catch (err) {
|
|
60
|
-
log.catch(err, void 0, {
|
|
61
|
-
F: __dxlog_file,
|
|
62
|
-
L: 70,
|
|
63
|
-
S: void 0,
|
|
64
|
-
C: (f, a) => f(...a)
|
|
65
|
-
});
|
|
66
|
-
return {
|
|
67
|
-
success: false,
|
|
68
|
-
error: err
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var validateDeployInputs = (script, space) => {
|
|
73
|
-
if (!script.source || !space) {
|
|
74
|
-
return new Error("Script source or space not available");
|
|
75
|
-
}
|
|
76
|
-
return null;
|
|
77
|
-
};
|
|
78
|
-
var createOrUpdateFunctionInSpace = (space, fn, script, newFunction) => {
|
|
79
|
-
if (fn) {
|
|
80
|
-
Function.setFrom(fn, newFunction);
|
|
81
|
-
return fn;
|
|
82
|
-
} else {
|
|
83
|
-
Obj.change(newFunction, (f) => {
|
|
84
|
-
f.source = Ref.make(script);
|
|
85
|
-
});
|
|
86
|
-
return space.db.add(newFunction);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// src/util/functions.ts
|
|
91
|
-
import { Obj as Obj2 } from "@dxos/echo";
|
|
92
|
-
import { getUserFunctionIdInMetadata as getUserFunctionIdInMetadata2 } from "@dxos/functions";
|
|
93
|
-
import { getInvocationUrl } from "@dxos/functions-runtime";
|
|
94
|
-
import { log as log2 } from "@dxos/log";
|
|
95
|
-
import { getSpace } from "@dxos/react-client/echo";
|
|
96
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/util/functions.ts";
|
|
97
|
-
var getFunctionUrl = ({ script, fn, edgeUrl }) => {
|
|
98
|
-
const space = getSpace(script);
|
|
99
|
-
const existingFunctionId = fn && getUserFunctionIdInMetadata2(Obj2.getMeta(fn));
|
|
100
|
-
if (!existingFunctionId) {
|
|
101
|
-
return void 0;
|
|
102
|
-
}
|
|
103
|
-
return getInvocationUrl(existingFunctionId, edgeUrl, {
|
|
104
|
-
spaceId: space?.id
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
var updateFunctionMetadata = (script, storedFunction, meta2, functionId) => {
|
|
108
|
-
Obj2.change(storedFunction, (f) => {
|
|
109
|
-
if (script.description !== void 0 && script.description.trim() !== "") {
|
|
110
|
-
f.description = script.description;
|
|
111
|
-
} else if (meta2.description) {
|
|
112
|
-
f.description = meta2.description;
|
|
113
|
-
} else {
|
|
114
|
-
log2.verbose("no description in function metadata", {
|
|
115
|
-
functionId
|
|
116
|
-
}, {
|
|
117
|
-
F: __dxlog_file2,
|
|
118
|
-
L: 48,
|
|
119
|
-
S: void 0,
|
|
120
|
-
C: (f2, a) => f2(...a)
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
if (meta2.inputSchema) {
|
|
124
|
-
f.inputSchema = meta2.inputSchema;
|
|
125
|
-
} else {
|
|
126
|
-
log2.verbose("no input schema in function metadata", {
|
|
127
|
-
functionId
|
|
128
|
-
}, {
|
|
129
|
-
F: __dxlog_file2,
|
|
130
|
-
L: 54,
|
|
131
|
-
S: void 0,
|
|
132
|
-
C: (f2, a) => f2(...a)
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
if (meta2.outputSchema) {
|
|
136
|
-
f.outputSchema = meta2.outputSchema;
|
|
137
|
-
} else {
|
|
138
|
-
log2.verbose("no output schema in function metadata", {
|
|
139
|
-
functionId
|
|
140
|
-
}, {
|
|
141
|
-
F: __dxlog_file2,
|
|
142
|
-
L: 60,
|
|
143
|
-
S: void 0,
|
|
144
|
-
C: (f2, a) => f2(...a)
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
if (meta2.key) {
|
|
148
|
-
f.key = meta2.key;
|
|
149
|
-
} else {
|
|
150
|
-
log2.verbose("no key in function metadata", {
|
|
151
|
-
functionId
|
|
152
|
-
}, {
|
|
153
|
-
F: __dxlog_file2,
|
|
154
|
-
L: 66,
|
|
155
|
-
S: void 0,
|
|
156
|
-
C: (f2, a) => f2(...a)
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
var getAccessCredential = (identityKey) => {
|
|
162
|
-
return {
|
|
163
|
-
issuer: identityKey,
|
|
164
|
-
issuanceDate: /* @__PURE__ */ new Date(),
|
|
165
|
-
subject: {
|
|
166
|
-
id: identityKey,
|
|
167
|
-
assertion: {
|
|
168
|
-
"@type": "dxos.halo.credentials.ServiceAccess",
|
|
169
|
-
serverName: "hub.dxos.network",
|
|
170
|
-
serverKey: identityKey,
|
|
171
|
-
identityKey,
|
|
172
|
-
capabilities: [
|
|
173
|
-
"composer:beta"
|
|
174
|
-
]
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
// src/hooks/deploy.ts
|
|
181
|
-
import { useEffect, useMemo } from "react";
|
|
182
|
-
import { Obj as Obj3, Query, Ref as Ref2 } from "@dxos/echo";
|
|
183
|
-
import { Function as Function2, getUserFunctionIdInMetadata as getUserFunctionIdInMetadata3 } from "@dxos/functions";
|
|
184
|
-
import { log as log3 } from "@dxos/log";
|
|
185
|
-
import { useClient } from "@dxos/react-client";
|
|
186
|
-
import { getSpace as getSpace2, useQuery } from "@dxos/react-client/echo";
|
|
187
|
-
import { createMenuAction } from "@dxos/react-ui-menu";
|
|
188
|
-
import { errorMessageColors } from "@dxos/ui-theme";
|
|
189
|
-
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/hooks/deploy.ts";
|
|
190
|
-
var createDeploy = ({ state, script, space, fn, client, existingFunctionId, t }) => {
|
|
191
|
-
const { value } = state;
|
|
192
|
-
const errorItem = createMenuAction("error", () => {
|
|
193
|
-
}, {
|
|
194
|
-
label: value.error ?? [
|
|
195
|
-
"no error label",
|
|
196
|
-
{
|
|
197
|
-
ns: meta.id
|
|
198
|
-
}
|
|
199
|
-
],
|
|
200
|
-
icon: "ph--warning-circle--regular",
|
|
201
|
-
hidden: !value.error,
|
|
202
|
-
classNames: value.error && errorMessageColors
|
|
203
|
-
});
|
|
204
|
-
const deployAction = createMenuAction("deploy", async () => {
|
|
205
|
-
if (!script.source || !space) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
state.set("error", void 0);
|
|
209
|
-
state.set("deploying", true);
|
|
210
|
-
const result = await deployScript({
|
|
211
|
-
script,
|
|
212
|
-
client,
|
|
213
|
-
space,
|
|
214
|
-
fn,
|
|
215
|
-
existingFunctionId
|
|
216
|
-
});
|
|
217
|
-
if (!result.success) {
|
|
218
|
-
log3.catch(result.error, void 0, {
|
|
219
|
-
F: __dxlog_file3,
|
|
220
|
-
L: 64,
|
|
221
|
-
S: void 0,
|
|
222
|
-
C: (f, a) => f(...a)
|
|
223
|
-
});
|
|
224
|
-
state.set("error", t("upload failed label"));
|
|
225
|
-
}
|
|
226
|
-
state.set("deploying", false);
|
|
227
|
-
}, {
|
|
228
|
-
type: "deploy",
|
|
229
|
-
label: [
|
|
230
|
-
value.deploying ? "publishing label" : "deploy label",
|
|
231
|
-
{
|
|
232
|
-
ns: meta.id
|
|
233
|
-
}
|
|
234
|
-
],
|
|
235
|
-
icon: value.deploying ? "ph--spinner-gap--regular" : "ph--cloud-arrow-up--regular",
|
|
236
|
-
disabled: value.deploying,
|
|
237
|
-
classNames: value.deploying ? "[&_svg]:animate-spin" : ""
|
|
238
|
-
});
|
|
239
|
-
const copyAction = createMenuAction("copy", async () => {
|
|
240
|
-
if (value.functionUrl) {
|
|
241
|
-
await navigator.clipboard.writeText(value.functionUrl);
|
|
242
|
-
}
|
|
243
|
-
}, {
|
|
244
|
-
type: "copy",
|
|
245
|
-
label: [
|
|
246
|
-
"copy link label",
|
|
247
|
-
{
|
|
248
|
-
ns: meta.id
|
|
249
|
-
}
|
|
250
|
-
],
|
|
251
|
-
icon: "ph--link--regular",
|
|
252
|
-
disabled: !value.functionUrl
|
|
253
|
-
});
|
|
254
|
-
return {
|
|
255
|
-
nodes: [
|
|
256
|
-
errorItem,
|
|
257
|
-
deployAction,
|
|
258
|
-
copyAction
|
|
259
|
-
],
|
|
260
|
-
edges: [
|
|
261
|
-
{
|
|
262
|
-
source: "root",
|
|
263
|
-
target: "error"
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
source: "root",
|
|
267
|
-
target: "deploy"
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
source: "root",
|
|
271
|
-
target: "copy"
|
|
272
|
-
}
|
|
273
|
-
]
|
|
274
|
-
};
|
|
275
|
-
};
|
|
276
|
-
var useDeployState = ({ state, script }) => {
|
|
277
|
-
const { space, client, fn, existingFunctionId } = useDeployDeps({
|
|
278
|
-
script
|
|
279
|
-
});
|
|
280
|
-
useEffect(() => {
|
|
281
|
-
if (!existingFunctionId) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
state.set("functionUrl", getFunctionUrl({
|
|
285
|
-
script,
|
|
286
|
-
fn,
|
|
287
|
-
edgeUrl: client.config.values.runtime?.services?.edge?.url ?? ""
|
|
288
|
-
}));
|
|
289
|
-
}, [
|
|
290
|
-
existingFunctionId,
|
|
291
|
-
space,
|
|
292
|
-
fn,
|
|
293
|
-
script,
|
|
294
|
-
client.config.values.runtime?.services?.edge?.url,
|
|
295
|
-
state
|
|
296
|
-
]);
|
|
297
|
-
useEffect(() => {
|
|
298
|
-
state.set("deployed", isScriptDeployed({
|
|
299
|
-
script,
|
|
300
|
-
fn
|
|
301
|
-
}));
|
|
302
|
-
}, [
|
|
303
|
-
script.changed,
|
|
304
|
-
existingFunctionId,
|
|
305
|
-
fn,
|
|
306
|
-
script,
|
|
307
|
-
state
|
|
308
|
-
]);
|
|
309
|
-
};
|
|
310
|
-
var useDeployDeps = ({ script }) => {
|
|
311
|
-
const client = useClient();
|
|
312
|
-
const space = getSpace2(script);
|
|
313
|
-
const [fn] = useQuery(space?.db, Query.type(Function2.Function, {
|
|
314
|
-
source: Ref2.make(script)
|
|
315
|
-
}));
|
|
316
|
-
const existingFunctionId = useMemo(() => fn && getUserFunctionIdInMetadata3(Obj3.getMeta(fn)), [
|
|
317
|
-
fn
|
|
318
|
-
]);
|
|
319
|
-
return {
|
|
320
|
-
client,
|
|
321
|
-
space,
|
|
322
|
-
fn,
|
|
323
|
-
existingFunctionId
|
|
324
|
-
};
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
// src/hooks/useToolbarState.ts
|
|
328
|
-
import { Atom, RegistryContext, useAtomValue } from "@effect-atom/atom-react";
|
|
329
|
-
import { useContext, useMemo as useMemo2 } from "react";
|
|
330
|
-
var useToolbarState = (initialState = {}) => {
|
|
331
|
-
const registry = useContext(RegistryContext);
|
|
332
|
-
const atom = useMemo2(() => Atom.make(initialState), []);
|
|
333
|
-
const value = useAtomValue(atom);
|
|
334
|
-
return useMemo2(() => ({
|
|
335
|
-
atom,
|
|
336
|
-
get value() {
|
|
337
|
-
return registry.get(atom);
|
|
338
|
-
},
|
|
339
|
-
update: (updater) => {
|
|
340
|
-
registry.set(atom, updater(registry.get(atom)));
|
|
341
|
-
},
|
|
342
|
-
set: (key, v) => {
|
|
343
|
-
registry.set(atom, {
|
|
344
|
-
...registry.get(atom),
|
|
345
|
-
[key]: v
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
}), [
|
|
349
|
-
atom,
|
|
350
|
-
registry,
|
|
351
|
-
value
|
|
352
|
-
]);
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
// src/hooks/useCompiler.ts
|
|
356
|
-
import { useCapabilities, usePluginManager } from "@dxos/app-framework/react";
|
|
357
|
-
import { runAndForwardErrors } from "@dxos/effect";
|
|
358
|
-
import { useAsyncEffect } from "@dxos/react-ui";
|
|
359
|
-
var useCompiler = () => {
|
|
360
|
-
const manager = usePluginManager();
|
|
361
|
-
useAsyncEffect(async () => {
|
|
362
|
-
await manager.activate(ScriptEvents.SetupCompiler).pipe(runAndForwardErrors);
|
|
363
|
-
}, [
|
|
364
|
-
manager
|
|
365
|
-
]);
|
|
366
|
-
const [compiler] = useCapabilities(ScriptCapabilities.Compiler);
|
|
367
|
-
return compiler;
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
// src/hooks/format.ts
|
|
371
|
-
import { format } from "prettier";
|
|
372
|
-
import prettierPluginEstree from "prettier/plugins/estree";
|
|
373
|
-
import prettierPluginTypescript from "prettier/plugins/typescript";
|
|
374
|
-
import { Obj as Obj4 } from "@dxos/echo";
|
|
375
|
-
import { log as log4 } from "@dxos/log";
|
|
376
|
-
import { createMenuAction as createMenuAction2 } from "@dxos/react-ui-menu";
|
|
377
|
-
var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/hooks/format.ts";
|
|
378
|
-
var createFormat = (script) => {
|
|
379
|
-
const formatAction = createMenuAction2("format", async () => {
|
|
380
|
-
if (!script.source) {
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
try {
|
|
384
|
-
const formatted = await format(script.source.target.content, {
|
|
385
|
-
parser: "typescript",
|
|
386
|
-
plugins: [
|
|
387
|
-
prettierPluginEstree,
|
|
388
|
-
prettierPluginTypescript
|
|
389
|
-
],
|
|
390
|
-
semi: true,
|
|
391
|
-
singleQuote: true
|
|
392
|
-
});
|
|
393
|
-
Obj4.change(script.source.target, (s) => {
|
|
394
|
-
s.content = formatted;
|
|
395
|
-
});
|
|
396
|
-
} catch (err) {
|
|
397
|
-
log4.catch(err, void 0, {
|
|
398
|
-
F: __dxlog_file4,
|
|
399
|
-
L: 38,
|
|
400
|
-
S: void 0,
|
|
401
|
-
C: (f, a) => f(...a)
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
}, {
|
|
405
|
-
label: [
|
|
406
|
-
"format label",
|
|
407
|
-
{
|
|
408
|
-
ns: meta.id
|
|
409
|
-
}
|
|
410
|
-
],
|
|
411
|
-
icon: "ph--magic-wand--regular"
|
|
412
|
-
});
|
|
413
|
-
return {
|
|
414
|
-
nodes: [
|
|
415
|
-
formatAction
|
|
416
|
-
],
|
|
417
|
-
edges: [
|
|
418
|
-
{
|
|
419
|
-
source: "root",
|
|
420
|
-
target: "format"
|
|
421
|
-
}
|
|
422
|
-
]
|
|
423
|
-
};
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
// src/hooks/template.ts
|
|
427
|
-
import { Obj as Obj5 } from "@dxos/echo";
|
|
428
|
-
import { FUNCTIONS_PRESET_META_KEY } from "@dxos/functions";
|
|
429
|
-
import { createMenuAction as createMenuAction3 } from "@dxos/react-ui-menu";
|
|
430
|
-
var createTemplateSelectActions = (script) => {
|
|
431
|
-
return templates.map((template) => {
|
|
432
|
-
return createMenuAction3(`template--${template.id}`, () => {
|
|
433
|
-
Obj5.change(script, (s) => {
|
|
434
|
-
s.name = template.name;
|
|
435
|
-
const meta2 = Obj5.getMeta(s);
|
|
436
|
-
const oldPresetIndex = meta2.keys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);
|
|
437
|
-
if (oldPresetIndex >= 0) {
|
|
438
|
-
meta2.keys.splice(oldPresetIndex, 1);
|
|
439
|
-
}
|
|
440
|
-
if ("presetId" in template) {
|
|
441
|
-
meta2.keys.push({
|
|
442
|
-
source: FUNCTIONS_PRESET_META_KEY,
|
|
443
|
-
id: template.presetId
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
if (script.source?.target) {
|
|
448
|
-
Obj5.change(script.source.target, (s) => {
|
|
449
|
-
s.content = template.source;
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
}, {
|
|
453
|
-
label: template.name,
|
|
454
|
-
value: template.id,
|
|
455
|
-
type: "template"
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
};
|
|
459
|
-
var createTemplateSelect = (script) => {
|
|
460
|
-
const templateSelectActions = createTemplateSelectActions(script);
|
|
461
|
-
return {
|
|
462
|
-
nodes: [
|
|
463
|
-
...templateSelectActions
|
|
464
|
-
],
|
|
465
|
-
edges: [
|
|
466
|
-
{
|
|
467
|
-
source: "root",
|
|
468
|
-
target: "template-select"
|
|
469
|
-
},
|
|
470
|
-
...templateSelectActions.map((action) => ({
|
|
471
|
-
source: "template-select",
|
|
472
|
-
target: action.id
|
|
473
|
-
}))
|
|
474
|
-
]
|
|
475
|
-
};
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
// src/hooks/useCreateAndDeployScriptTemplates.ts
|
|
479
|
-
import { useCallback, useState } from "react";
|
|
480
|
-
import { useOperationInvoker } from "@dxos/app-framework/react";
|
|
481
|
-
import { Obj as Obj6 } from "@dxos/echo";
|
|
482
|
-
import { Script } from "@dxos/functions";
|
|
483
|
-
import { invariant } from "@dxos/invariant";
|
|
484
|
-
import { SpaceOperation } from "@dxos/plugin-space/types";
|
|
485
|
-
import { useClient as useClient2 } from "@dxos/react-client";
|
|
486
|
-
var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/hooks/useCreateAndDeployScriptTemplates.ts";
|
|
487
|
-
var useCreateAndDeployScriptTemplates = (space, scriptTemplates) => {
|
|
488
|
-
const { invokePromise } = useOperationInvoker();
|
|
489
|
-
const client = useClient2();
|
|
490
|
-
const [status, setStatus] = useState("idle");
|
|
491
|
-
const [error, setError] = useState(void 0);
|
|
492
|
-
const handleCreateAndDeployScripts = useCallback(async () => {
|
|
493
|
-
invariant(space, void 0, {
|
|
494
|
-
F: __dxlog_file5,
|
|
495
|
-
L: 35,
|
|
496
|
-
S: void 0,
|
|
497
|
-
A: [
|
|
498
|
-
"space",
|
|
499
|
-
""
|
|
500
|
-
]
|
|
501
|
-
});
|
|
502
|
-
setStatus("pending");
|
|
503
|
-
setError(void 0);
|
|
504
|
-
const deploymentResults = await Promise.all(scriptTemplates.map(async (template) => {
|
|
505
|
-
const createResult = await invokePromise(ScriptOperation.CreateScript, {
|
|
506
|
-
db: space.db,
|
|
507
|
-
initialTemplateId: template.id
|
|
508
|
-
});
|
|
509
|
-
invariant(Obj6.instanceOf(Script.Script, createResult.data?.object), void 0, {
|
|
510
|
-
F: __dxlog_file5,
|
|
511
|
-
L: 45,
|
|
512
|
-
S: void 0,
|
|
513
|
-
A: [
|
|
514
|
-
"Obj.instanceOf(Script.Script, createResult.data?.object)",
|
|
515
|
-
""
|
|
516
|
-
]
|
|
517
|
-
});
|
|
518
|
-
await invokePromise(SpaceOperation.AddObject, {
|
|
519
|
-
target: space.db,
|
|
520
|
-
object: createResult.data.object
|
|
521
|
-
});
|
|
522
|
-
return deployScript({
|
|
523
|
-
space,
|
|
524
|
-
client,
|
|
525
|
-
script: createResult.data.object
|
|
526
|
-
});
|
|
527
|
-
}));
|
|
528
|
-
const hasErrors = deploymentResults.some((result) => !result.success);
|
|
529
|
-
setStatus(hasErrors ? "error" : "success");
|
|
530
|
-
}, [
|
|
531
|
-
space,
|
|
532
|
-
invokePromise,
|
|
533
|
-
client,
|
|
534
|
-
scriptTemplates
|
|
535
|
-
]);
|
|
536
|
-
return {
|
|
537
|
-
handleCreateAndDeployScripts,
|
|
538
|
-
status,
|
|
539
|
-
error
|
|
540
|
-
};
|
|
541
|
-
};
|
|
542
|
-
|
|
543
|
-
export {
|
|
544
|
-
isScriptDeployed,
|
|
545
|
-
deployScript,
|
|
546
|
-
getFunctionUrl,
|
|
547
|
-
updateFunctionMetadata,
|
|
548
|
-
getAccessCredential,
|
|
549
|
-
createDeploy,
|
|
550
|
-
useDeployState,
|
|
551
|
-
useDeployDeps,
|
|
552
|
-
createFormat,
|
|
553
|
-
createTemplateSelect,
|
|
554
|
-
useCreateAndDeployScriptTemplates,
|
|
555
|
-
useToolbarState,
|
|
556
|
-
useCompiler
|
|
557
|
-
};
|
|
558
|
-
//# sourceMappingURL=chunk-MGWKULCD.mjs.map
|