@dxos/plugin-script 0.8.4-main.7ace549 → 0.8.4-main.937b3ca
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-GXNRUXF6.mjs +14 -0
- package/dist/lib/browser/{NotebookContainer-MHY3DXDE.mjs → NotebookContainer-4MM2VAQF.mjs} +265 -237
- package/dist/lib/browser/NotebookContainer-4MM2VAQF.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-X6GCYZZW.mjs +149 -0
- package/dist/lib/browser/ScriptContainer-X6GCYZZW.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs +68 -0
- package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs +17 -0
- package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/chunk-3O2DQGCP.mjs +113 -0
- package/dist/lib/browser/chunk-3O2DQGCP.mjs.map +7 -0
- package/dist/lib/browser/chunk-BTWHM6FH.mjs +270 -0
- package/dist/lib/browser/chunk-BTWHM6FH.mjs.map +7 -0
- package/dist/lib/browser/chunk-F3QKSKSF.mjs +35 -0
- package/dist/lib/browser/chunk-F3QKSKSF.mjs.map +7 -0
- package/dist/lib/browser/chunk-I7CSE6T3.mjs +110 -0
- package/dist/lib/browser/chunk-I7CSE6T3.mjs.map +7 -0
- package/dist/lib/browser/chunk-IQRLM6JK.mjs +137 -0
- package/dist/lib/browser/chunk-IQRLM6JK.mjs.map +7 -0
- package/dist/lib/browser/chunk-NWSK27QB.mjs +606 -0
- package/dist/lib/browser/chunk-NWSK27QB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2G2NA6DQ.mjs → chunk-UX4GHJ5E.mjs} +28 -11
- package/dist/lib/browser/chunk-UX4GHJ5E.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ULJFT73Q.mjs → chunk-WX2NVNFQ.mjs} +232 -188
- package/dist/lib/browser/chunk-WX2NVNFQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EB6AXFXO.mjs → chunk-WYR4QHPE.mjs} +1 -1
- package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +7 -0
- package/dist/lib/browser/compiler-XRBFQFXO.mjs +161 -0
- package/dist/lib/browser/compiler-XRBFQFXO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +92 -116
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-MUNR376F.mjs +82 -0
- package/dist/lib/browser/operation-resolver-MUNR376F.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-R245YN52.mjs → react-surface-5TEC66UY.mjs} +53 -42
- package/dist/lib/browser/react-surface-5TEC66UY.mjs.map +7 -0
- package/dist/lib/browser/settings-R4WKREUJ.mjs +35 -0
- package/dist/lib/browser/settings-R4WKREUJ.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +9 -5
- package/dist/lib/node-esm/{DeploymentDialog-2ULNOZQH.mjs → DeploymentDialog-EVFV2VJT.mjs} +6 -6
- package/dist/lib/node-esm/DeploymentDialog-EVFV2VJT.mjs.map +7 -0
- package/dist/lib/node-esm/{NotebookContainer-U4C2HQ4T.mjs → NotebookContainer-QLW5ZYGS.mjs} +265 -237
- package/dist/lib/node-esm/NotebookContainer-QLW5ZYGS.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-3DZ3BMHW.mjs +150 -0
- package/dist/lib/node-esm/ScriptContainer-3DZ3BMHW.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs +69 -0
- package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs +18 -0
- package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-57JA6XL5.mjs → chunk-4F5FJZ36.mjs} +28 -11
- package/dist/lib/node-esm/chunk-4F5FJZ36.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IBV2DR36.mjs → chunk-5HSJPAK7.mjs} +1 -1
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KN6SQYUF.mjs +114 -0
- package/dist/lib/node-esm/chunk-KN6SQYUF.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VJSRZRLI.mjs → chunk-MGWKULCD.mjs} +232 -188
- package/dist/lib/node-esm/chunk-MGWKULCD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs +112 -0
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VWOLKNMO.mjs +271 -0
- package/dist/lib/node-esm/chunk-VWOLKNMO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs +36 -0
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YEWLTVBT.mjs +138 -0
- package/dist/lib/node-esm/chunk-YEWLTVBT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZQGHFNO3.mjs +607 -0
- package/dist/lib/node-esm/chunk-ZQGHFNO3.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-ORJAXDN7.mjs +162 -0
- package/dist/lib/node-esm/compiler-ORJAXDN7.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +92 -116
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-CLE4ZCC5.mjs +83 -0
- package/dist/lib/node-esm/operation-resolver-CLE4ZCC5.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-MHT3PJ6C.mjs → react-surface-O3UDMKOQ.mjs} +53 -42
- package/dist/lib/node-esm/react-surface-O3UDMKOQ.mjs.map +7 -0
- package/dist/lib/node-esm/settings-OFIMHU7K.mjs +36 -0
- package/dist/lib/node-esm/settings-OFIMHU7K.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +1 -1
- package/dist/lib/node-esm/types/index.mjs +9 -5
- package/dist/types/src/ScriptPlugin.d.ts +2 -1
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts +22 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +12 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +9 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler/compiler.d.ts +6 -0
- package/dist/types/src/capabilities/compiler/compiler.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler/index.d.ts +3 -0
- package/dist/types/src/capabilities/compiler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +7 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +9 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/compiler/compiler.d.ts +1 -1
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +1 -3
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
- package/dist/types/src/components/NotebookContainer.d.ts +3 -5
- package/dist/types/src/components/NotebookContainer.d.ts.map +1 -1
- package/dist/types/src/components/NotebookContainer.stories.d.ts +3 -250
- package/dist/types/src/components/NotebookContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +3 -3
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +2 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +5 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +13 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/index.d.ts +2 -0
- package/dist/types/src/components/QueryEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptContainer.d.ts +4 -5
- package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +2 -2
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +2 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +4 -2
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +1 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +3 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/e2e/ai.test.d.ts +2 -0
- package/dist/types/src/e2e/ai.test.d.ts.map +1 -0
- package/dist/types/src/e2e/deploy.test.d.ts +2 -0
- package/dist/types/src/e2e/deploy.test.d.ts.map +1 -0
- package/dist/types/src/hooks/deploy.d.ts +9 -26
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +2 -2
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +2 -2
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts +7 -0
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -0
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +8 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +24 -11
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
- package/dist/types/src/templates/anthropic.d.ts +8 -0
- package/dist/types/src/templates/anthropic.d.ts.map +1 -0
- package/dist/types/src/templates/chess-bot.d.ts +16 -0
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
- package/dist/types/src/templates/commentary.d.ts +16 -0
- package/dist/types/src/templates/commentary.d.ts.map +1 -0
- package/dist/types/src/templates/forex-effect.d.ts +4 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +4 -1
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +12 -3
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +1 -4
- package/dist/types/src/templates/ping.d.ts.map +1 -1
- package/dist/types/src/testing/simulator.test.d.ts +2 -0
- package/dist/types/src/testing/simulator.test.d.ts.map +1 -0
- package/dist/types/src/types/Notebook.d.ts +87 -18
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/actions.d.ts +30 -44
- package/dist/types/src/types/actions.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +12 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +113 -88
- package/src/ScriptPlugin.tsx +34 -60
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +24 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +55 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{artifact-definition.ts → artifact-definition/artifact-definition.ts} +97 -94
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +23 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/compiler/compiler.ts +103 -0
- package/src/capabilities/compiler/index.ts +7 -0
- package/src/capabilities/index.ts +6 -10
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +74 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +118 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +32 -0
- package/src/compiler/compiler.ts +10 -3
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +27 -23
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +22 -42
- package/src/components/FrameContainer/FrameContainer.tsx +4 -2
- package/src/components/NotebookContainer.stories.tsx +23 -19
- package/src/components/NotebookContainer.tsx +49 -39
- package/src/components/NotebookStack/NotebookCell.tsx +16 -15
- package/src/components/NotebookStack/NotebookStack.stories.tsx +19 -18
- package/src/components/NotebookStack/NotebookStack.tsx +4 -4
- package/src/components/QueryEditor/QueryEditor.stories.tsx +100 -0
- package/src/components/QueryEditor/QueryEditor.tsx +47 -0
- package/src/components/QueryEditor/index.ts +5 -0
- package/src/components/ScriptContainer.tsx +46 -32
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +38 -15
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +14 -17
- package/src/components/Settings/ScriptObjectSettings.tsx +40 -29
- package/src/components/Settings/ScriptPluginSettings.tsx +8 -3
- package/src/components/TestPanel/TestContainer.tsx +5 -5
- package/src/components/TestPanel/TestPanel.tsx +1 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +12 -7
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +69 -68
- package/src/e2e/ai.test.ts +92 -0
- package/src/e2e/deploy.test.ts +64 -0
- package/src/hooks/deploy.ts +33 -26
- package/src/hooks/format.ts +5 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +15 -9
- package/src/hooks/useCompiler.ts +24 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +13 -19
- package/src/hooks/useToolbarState.ts +29 -5
- package/src/index.ts +1 -1
- package/src/meta.ts +2 -2
- package/src/notebook/compute-graph.test.ts +20 -8
- package/src/notebook/compute-graph.ts +45 -21
- package/src/templates/anthropic.ts +42 -0
- package/src/templates/chess-bot.ts +58 -0
- package/src/templates/commentary.ts +232 -0
- package/src/templates/data-generator.ts +1 -1
- package/src/templates/forex-effect.ts +22 -27
- package/src/templates/forex.ts +7 -6
- package/src/templates/index.ts +18 -5
- package/src/templates/ping.ts +14 -5
- package/src/testing/simulator.test.ts +40 -0
- package/src/types/Notebook.ts +5 -6
- package/src/types/actions.ts +17 -25
- package/src/types/capabilities.ts +17 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +2 -0
- package/src/types/types.ts +1 -1
- package/src/util/deploy.ts +19 -25
- package/src/util/functions.ts +24 -22
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-5TKNGPVR.mjs +0 -14
- package/dist/lib/browser/NotebookContainer-MHY3DXDE.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-CW6YN3DQ.mjs +0 -148
- package/dist/lib/browser/ScriptContainer-CW6YN3DQ.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-2WR2ATTJ.mjs +0 -66
- package/dist/lib/browser/app-graph-builder-2WR2ATTJ.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs +0 -30
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs.map +0 -7
- package/dist/lib/browser/chunk-2G2NA6DQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-ALS6X4HU.mjs +0 -304
- package/dist/lib/browser/chunk-ALS6X4HU.mjs.map +0 -7
- package/dist/lib/browser/chunk-EB6AXFXO.mjs.map +0 -7
- package/dist/lib/browser/chunk-M6KJPUJK.mjs +0 -111
- package/dist/lib/browser/chunk-M6KJPUJK.mjs.map +0 -7
- package/dist/lib/browser/chunk-N5EYLQOT.mjs +0 -647
- package/dist/lib/browser/chunk-N5EYLQOT.mjs.map +0 -7
- package/dist/lib/browser/chunk-QIZ3BPRK.mjs +0 -103
- package/dist/lib/browser/chunk-QIZ3BPRK.mjs.map +0 -7
- package/dist/lib/browser/chunk-SAN5Y7FI.mjs +0 -155
- package/dist/lib/browser/chunk-SAN5Y7FI.mjs.map +0 -7
- package/dist/lib/browser/chunk-ULJFT73Q.mjs.map +0 -7
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs +0 -15
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs.map +0 -7
- package/dist/lib/browser/compiler-4KHRSX7J.mjs +0 -86
- package/dist/lib/browser/compiler-4KHRSX7J.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-TXTBWOVD.mjs +0 -104
- package/dist/lib/browser/intent-resolver-TXTBWOVD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-R245YN52.mjs.map +0 -7
- package/dist/lib/browser/settings-MHJXRGDF.mjs +0 -26
- package/dist/lib/browser/settings-MHJXRGDF.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-U4C2HQ4T.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-VRPEKB4T.mjs +0 -149
- package/dist/lib/node-esm/ScriptContainer-VRPEKB4T.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NCVLUL5R.mjs +0 -67
- package/dist/lib/node-esm/app-graph-builder-NCVLUL5R.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs +0 -31
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs +0 -16
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-57JA6XL5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HDKR5WCD.mjs +0 -113
- package/dist/lib/node-esm/chunk-HDKR5WCD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IBV2DR36.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ND4BPYPR.mjs +0 -156
- package/dist/lib/node-esm/chunk-ND4BPYPR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UEVZP5DN.mjs +0 -648
- package/dist/lib/node-esm/chunk-UEVZP5DN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VJSRZRLI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VTRMJSQL.mjs +0 -305
- package/dist/lib/node-esm/chunk-VTRMJSQL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XYKKDWUR.mjs +0 -104
- package/dist/lib/node-esm/chunk-XYKKDWUR.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-DU5NQISX.mjs +0 -87
- package/dist/lib/node-esm/compiler-DU5NQISX.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-D6AVAQRA.mjs +0 -105
- package/dist/lib/node-esm/intent-resolver-D6AVAQRA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-MHT3PJ6C.mjs.map +0 -7
- package/dist/lib/node-esm/settings-BVJORMMJ.mjs +0 -27
- package/dist/lib/node-esm/settings-BVJORMMJ.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler.d.ts +0 -4
- package/dist/types/src/capabilities/compiler.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/templates/chess.d.ts +0 -3
- package/dist/types/src/templates/chess.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -65
- package/src/capabilities/blueprint-definition.ts +0 -30
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/compiler.ts +0 -34
- package/src/capabilities/intent-resolver.ts +0 -86
- package/src/capabilities/react-surface.tsx +0 -103
- package/src/capabilities/settings.ts +0 -21
- package/src/events.ts +0 -11
- package/src/templates/chess.ts +0 -49
- /package/dist/lib/browser/{DeploymentDialog-5TKNGPVR.mjs.map → DeploymentDialog-GXNRUXF6.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-2ULNOZQH.mjs.map → browser/blueprints/index.mjs.map} +0 -0
|
@@ -1,111 +1,26 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
ScriptCapabilities,
|
|
4
|
+
ScriptEvents,
|
|
5
|
+
ScriptOperation
|
|
6
|
+
} from "./chunk-KN6SQYUF.mjs";
|
|
5
7
|
import {
|
|
6
8
|
templates
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4F5FJZ36.mjs";
|
|
8
10
|
import {
|
|
9
11
|
meta
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
|
|
12
|
-
// src/util/functions.ts
|
|
13
|
-
import { Obj } from "@dxos/echo";
|
|
14
|
-
import { getUserFunctionIdInMetadata } from "@dxos/functions";
|
|
15
|
-
import { getInvocationUrl } from "@dxos/functions-runtime";
|
|
16
|
-
import { log } from "@dxos/log";
|
|
17
|
-
import { getSpace } from "@dxos/react-client/echo";
|
|
18
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/util/functions.ts";
|
|
19
|
-
var getFunctionUrl = ({ script, fn, edgeUrl }) => {
|
|
20
|
-
const space = getSpace(script);
|
|
21
|
-
const existingFunctionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
|
|
22
|
-
if (!existingFunctionId) {
|
|
23
|
-
return void 0;
|
|
24
|
-
}
|
|
25
|
-
return getInvocationUrl(existingFunctionId, edgeUrl, {
|
|
26
|
-
spaceId: space?.id
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
var updateFunctionMetadata = (script, storedFunction, meta2, functionId) => {
|
|
30
|
-
if (script.description !== void 0 && script.description.trim() !== "") {
|
|
31
|
-
storedFunction.description = script.description;
|
|
32
|
-
} else if (meta2.description) {
|
|
33
|
-
storedFunction.description = meta2.description;
|
|
34
|
-
} else {
|
|
35
|
-
log.verbose("no description in function metadata", {
|
|
36
|
-
functionId
|
|
37
|
-
}, {
|
|
38
|
-
F: __dxlog_file,
|
|
39
|
-
L: 47,
|
|
40
|
-
S: void 0,
|
|
41
|
-
C: (f, a) => f(...a)
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
if (meta2.inputSchema) {
|
|
45
|
-
storedFunction.inputSchema = meta2.inputSchema;
|
|
46
|
-
} else {
|
|
47
|
-
log.verbose("no input schema in function metadata", {
|
|
48
|
-
functionId
|
|
49
|
-
}, {
|
|
50
|
-
F: __dxlog_file,
|
|
51
|
-
L: 53,
|
|
52
|
-
S: void 0,
|
|
53
|
-
C: (f, a) => f(...a)
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
if (meta2.outputSchema) {
|
|
57
|
-
storedFunction.outputSchema = meta2.outputSchema;
|
|
58
|
-
} else {
|
|
59
|
-
log.verbose("no output schema in function metadata", {
|
|
60
|
-
functionId
|
|
61
|
-
}, {
|
|
62
|
-
F: __dxlog_file,
|
|
63
|
-
L: 59,
|
|
64
|
-
S: void 0,
|
|
65
|
-
C: (f, a) => f(...a)
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
if (meta2.key) {
|
|
69
|
-
storedFunction.key = meta2.key;
|
|
70
|
-
} else {
|
|
71
|
-
log.verbose("no key in function metadata", {
|
|
72
|
-
functionId
|
|
73
|
-
}, {
|
|
74
|
-
F: __dxlog_file,
|
|
75
|
-
L: 65,
|
|
76
|
-
S: void 0,
|
|
77
|
-
C: (f, a) => f(...a)
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
var getAccessCredential = (identityKey) => {
|
|
82
|
-
return {
|
|
83
|
-
issuer: identityKey,
|
|
84
|
-
issuanceDate: /* @__PURE__ */ new Date(),
|
|
85
|
-
subject: {
|
|
86
|
-
id: identityKey,
|
|
87
|
-
assertion: {
|
|
88
|
-
"@type": "dxos.halo.credentials.ServiceAccess",
|
|
89
|
-
serverName: "hub.dxos.network",
|
|
90
|
-
serverKey: identityKey,
|
|
91
|
-
identityKey,
|
|
92
|
-
capabilities: [
|
|
93
|
-
"composer:beta"
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
};
|
|
12
|
+
} from "./chunk-5HSJPAK7.mjs";
|
|
99
13
|
|
|
100
14
|
// src/util/deploy.ts
|
|
101
|
-
import { Obj
|
|
102
|
-
import { Function, getUserFunctionIdInMetadata
|
|
15
|
+
import { Obj, Ref } from "@dxos/echo";
|
|
16
|
+
import { Function, getUserFunctionIdInMetadata } from "@dxos/functions";
|
|
103
17
|
import { bundleFunction } from "@dxos/functions-runtime/bundler";
|
|
104
|
-
import {
|
|
105
|
-
import { log
|
|
106
|
-
|
|
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";
|
|
107
22
|
var isScriptDeployed = ({ script, fn }) => {
|
|
108
|
-
const existingFunctionId = fn &&
|
|
23
|
+
const existingFunctionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
|
|
109
24
|
return Boolean(existingFunctionId) && !script.changed;
|
|
110
25
|
};
|
|
111
26
|
var deployScript = async ({ script, client, space, fn, existingFunctionId }) => {
|
|
@@ -123,34 +38,28 @@ var deployScript = async ({ script, client, space, fn, existingFunctionId }) =>
|
|
|
123
38
|
if ("error" in buildResult) {
|
|
124
39
|
throw buildResult.error || new Error("Bundle creation failed");
|
|
125
40
|
}
|
|
126
|
-
const
|
|
127
|
-
|
|
41
|
+
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
42
|
+
const newFunction = await functionsServiceClient.deploy({
|
|
43
|
+
// TODO(dmaretskyi): Space key or identity key.
|
|
128
44
|
ownerPublicKey: space.key,
|
|
129
45
|
version: fn ? incrementSemverPatch(fn.version) : "0.0.1",
|
|
130
46
|
functionId: existingFunctionId,
|
|
131
47
|
entryPoint: buildResult.entryPoint,
|
|
132
|
-
assets:
|
|
133
|
-
|
|
134
|
-
|
|
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;
|
|
135
54
|
});
|
|
136
|
-
if (functionId === void 0 || version === void 0) {
|
|
137
|
-
throw new Error(`Upload didn't return expected data: ${JSON.stringify({
|
|
138
|
-
functionId,
|
|
139
|
-
version
|
|
140
|
-
})}`);
|
|
141
|
-
}
|
|
142
|
-
const storedFunction = createOrUpdateFunctionInSpace(space, fn, script, functionId, version);
|
|
143
|
-
script.changed = false;
|
|
144
|
-
updateFunctionMetadata(script, storedFunction, meta2, functionId);
|
|
145
|
-
setUserFunctionIdInMetadata(Obj2.getMeta(storedFunction), functionId);
|
|
146
55
|
return {
|
|
147
56
|
success: true,
|
|
148
|
-
functionId
|
|
57
|
+
functionId: getUserFunctionIdInMetadata(Obj.getMeta(storedFunction))
|
|
149
58
|
};
|
|
150
59
|
} catch (err) {
|
|
151
|
-
|
|
152
|
-
F:
|
|
153
|
-
L:
|
|
60
|
+
log.catch(err, void 0, {
|
|
61
|
+
F: __dxlog_file,
|
|
62
|
+
L: 70,
|
|
154
63
|
S: void 0,
|
|
155
64
|
C: (f, a) => f(...a)
|
|
156
65
|
});
|
|
@@ -166,23 +75,108 @@ var validateDeployInputs = (script, space) => {
|
|
|
166
75
|
}
|
|
167
76
|
return null;
|
|
168
77
|
};
|
|
169
|
-
var createOrUpdateFunctionInSpace = (space, fn, script,
|
|
78
|
+
var createOrUpdateFunctionInSpace = (space, fn, script, newFunction) => {
|
|
170
79
|
if (fn) {
|
|
171
|
-
fn
|
|
172
|
-
fn.version = version;
|
|
80
|
+
Function.setFrom(fn, newFunction);
|
|
173
81
|
return fn;
|
|
174
82
|
} else {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
version,
|
|
178
|
-
source: Ref.make(script)
|
|
83
|
+
Obj.change(newFunction, (f) => {
|
|
84
|
+
f.source = Ref.make(script);
|
|
179
85
|
});
|
|
180
|
-
space.db.add(
|
|
181
|
-
setUserFunctionIdInMetadata(Obj2.getMeta(fn2), functionId);
|
|
182
|
-
return fn2;
|
|
86
|
+
return space.db.add(newFunction);
|
|
183
87
|
}
|
|
184
88
|
};
|
|
185
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
|
+
|
|
186
180
|
// src/hooks/deploy.ts
|
|
187
181
|
import { useEffect, useMemo } from "react";
|
|
188
182
|
import { Obj as Obj3, Query, Ref as Ref2 } from "@dxos/echo";
|
|
@@ -191,27 +185,28 @@ import { log as log3 } from "@dxos/log";
|
|
|
191
185
|
import { useClient } from "@dxos/react-client";
|
|
192
186
|
import { getSpace as getSpace2, useQuery } from "@dxos/react-client/echo";
|
|
193
187
|
import { createMenuAction } from "@dxos/react-ui-menu";
|
|
194
|
-
import { errorMessageColors } from "@dxos/
|
|
188
|
+
import { errorMessageColors } from "@dxos/ui-theme";
|
|
195
189
|
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/hooks/deploy.ts";
|
|
196
190
|
var createDeploy = ({ state, script, space, fn, client, existingFunctionId, t }) => {
|
|
191
|
+
const { value } = state;
|
|
197
192
|
const errorItem = createMenuAction("error", () => {
|
|
198
193
|
}, {
|
|
199
|
-
label:
|
|
194
|
+
label: value.error ?? [
|
|
200
195
|
"no error label",
|
|
201
196
|
{
|
|
202
197
|
ns: meta.id
|
|
203
198
|
}
|
|
204
199
|
],
|
|
205
200
|
icon: "ph--warning-circle--regular",
|
|
206
|
-
hidden: !
|
|
207
|
-
classNames:
|
|
201
|
+
hidden: !value.error,
|
|
202
|
+
classNames: value.error && errorMessageColors
|
|
208
203
|
});
|
|
209
204
|
const deployAction = createMenuAction("deploy", async () => {
|
|
210
205
|
if (!script.source || !space) {
|
|
211
206
|
return;
|
|
212
207
|
}
|
|
213
|
-
state.error
|
|
214
|
-
state.deploying
|
|
208
|
+
state.set("error", void 0);
|
|
209
|
+
state.set("deploying", true);
|
|
215
210
|
const result = await deployScript({
|
|
216
211
|
script,
|
|
217
212
|
client,
|
|
@@ -222,28 +217,28 @@ var createDeploy = ({ state, script, space, fn, client, existingFunctionId, t })
|
|
|
222
217
|
if (!result.success) {
|
|
223
218
|
log3.catch(result.error, void 0, {
|
|
224
219
|
F: __dxlog_file3,
|
|
225
|
-
L:
|
|
220
|
+
L: 64,
|
|
226
221
|
S: void 0,
|
|
227
222
|
C: (f, a) => f(...a)
|
|
228
223
|
});
|
|
229
|
-
state.error
|
|
224
|
+
state.set("error", t("upload failed label"));
|
|
230
225
|
}
|
|
231
|
-
state.deploying
|
|
226
|
+
state.set("deploying", false);
|
|
232
227
|
}, {
|
|
233
228
|
type: "deploy",
|
|
234
229
|
label: [
|
|
235
|
-
|
|
230
|
+
value.deploying ? "publishing label" : "deploy label",
|
|
236
231
|
{
|
|
237
232
|
ns: meta.id
|
|
238
233
|
}
|
|
239
234
|
],
|
|
240
|
-
icon:
|
|
241
|
-
disabled:
|
|
242
|
-
classNames:
|
|
235
|
+
icon: value.deploying ? "ph--spinner-gap--regular" : "ph--cloud-arrow-up--regular",
|
|
236
|
+
disabled: value.deploying,
|
|
237
|
+
classNames: value.deploying ? "[&_svg]:animate-spin" : ""
|
|
243
238
|
});
|
|
244
239
|
const copyAction = createMenuAction("copy", async () => {
|
|
245
|
-
if (
|
|
246
|
-
await navigator.clipboard.writeText(
|
|
240
|
+
if (value.functionUrl) {
|
|
241
|
+
await navigator.clipboard.writeText(value.functionUrl);
|
|
247
242
|
}
|
|
248
243
|
}, {
|
|
249
244
|
type: "copy",
|
|
@@ -254,7 +249,7 @@ var createDeploy = ({ state, script, space, fn, client, existingFunctionId, t })
|
|
|
254
249
|
}
|
|
255
250
|
],
|
|
256
251
|
icon: "ph--link--regular",
|
|
257
|
-
disabled: !
|
|
252
|
+
disabled: !value.functionUrl
|
|
258
253
|
});
|
|
259
254
|
return {
|
|
260
255
|
nodes: [
|
|
@@ -286,34 +281,36 @@ var useDeployState = ({ state, script }) => {
|
|
|
286
281
|
if (!existingFunctionId) {
|
|
287
282
|
return;
|
|
288
283
|
}
|
|
289
|
-
state.functionUrl
|
|
284
|
+
state.set("functionUrl", getFunctionUrl({
|
|
290
285
|
script,
|
|
291
286
|
fn,
|
|
292
287
|
edgeUrl: client.config.values.runtime?.services?.edge?.url ?? ""
|
|
293
|
-
});
|
|
288
|
+
}));
|
|
294
289
|
}, [
|
|
295
290
|
existingFunctionId,
|
|
296
291
|
space,
|
|
297
292
|
fn,
|
|
298
293
|
script,
|
|
299
|
-
client.config.values.runtime?.services?.edge?.url
|
|
294
|
+
client.config.values.runtime?.services?.edge?.url,
|
|
295
|
+
state
|
|
300
296
|
]);
|
|
301
297
|
useEffect(() => {
|
|
302
|
-
state.deployed
|
|
298
|
+
state.set("deployed", isScriptDeployed({
|
|
303
299
|
script,
|
|
304
300
|
fn
|
|
305
|
-
});
|
|
301
|
+
}));
|
|
306
302
|
}, [
|
|
307
303
|
script.changed,
|
|
308
304
|
existingFunctionId,
|
|
309
305
|
fn,
|
|
310
|
-
script
|
|
306
|
+
script,
|
|
307
|
+
state
|
|
311
308
|
]);
|
|
312
309
|
};
|
|
313
310
|
var useDeployDeps = ({ script }) => {
|
|
314
311
|
const client = useClient();
|
|
315
312
|
const space = getSpace2(script);
|
|
316
|
-
const [fn] = useQuery(space, Query.type(Function2.Function, {
|
|
313
|
+
const [fn] = useQuery(space?.db, Query.type(Function2.Function, {
|
|
317
314
|
source: Ref2.make(script)
|
|
318
315
|
}));
|
|
319
316
|
const existingFunctionId = useMemo(() => fn && getUserFunctionIdInMetadata3(Obj3.getMeta(fn)), [
|
|
@@ -328,16 +325,53 @@ var useDeployDeps = ({ script }) => {
|
|
|
328
325
|
};
|
|
329
326
|
|
|
330
327
|
// src/hooks/useToolbarState.ts
|
|
331
|
-
import {
|
|
332
|
-
import {
|
|
328
|
+
import { Atom, RegistryContext, useAtomValue } from "@effect-atom/atom-react";
|
|
329
|
+
import { useContext, useMemo as useMemo2 } from "react";
|
|
333
330
|
var useToolbarState = (initialState = {}) => {
|
|
334
|
-
|
|
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;
|
|
335
368
|
};
|
|
336
369
|
|
|
337
370
|
// src/hooks/format.ts
|
|
338
371
|
import { format } from "prettier";
|
|
339
372
|
import prettierPluginEstree from "prettier/plugins/estree";
|
|
340
373
|
import prettierPluginTypescript from "prettier/plugins/typescript";
|
|
374
|
+
import { Obj as Obj4 } from "@dxos/echo";
|
|
341
375
|
import { log as log4 } from "@dxos/log";
|
|
342
376
|
import { createMenuAction as createMenuAction2 } from "@dxos/react-ui-menu";
|
|
343
377
|
var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/hooks/format.ts";
|
|
@@ -347,7 +381,7 @@ var createFormat = (script) => {
|
|
|
347
381
|
return;
|
|
348
382
|
}
|
|
349
383
|
try {
|
|
350
|
-
|
|
384
|
+
const formatted = await format(script.source.target.content, {
|
|
351
385
|
parser: "typescript",
|
|
352
386
|
plugins: [
|
|
353
387
|
prettierPluginEstree,
|
|
@@ -356,10 +390,13 @@ var createFormat = (script) => {
|
|
|
356
390
|
semi: true,
|
|
357
391
|
singleQuote: true
|
|
358
392
|
});
|
|
393
|
+
Obj4.change(script.source.target, (s) => {
|
|
394
|
+
s.content = formatted;
|
|
395
|
+
});
|
|
359
396
|
} catch (err) {
|
|
360
397
|
log4.catch(err, void 0, {
|
|
361
398
|
F: __dxlog_file4,
|
|
362
|
-
L:
|
|
399
|
+
L: 38,
|
|
363
400
|
S: void 0,
|
|
364
401
|
C: (f, a) => f(...a)
|
|
365
402
|
});
|
|
@@ -387,23 +424,29 @@ var createFormat = (script) => {
|
|
|
387
424
|
};
|
|
388
425
|
|
|
389
426
|
// src/hooks/template.ts
|
|
390
|
-
import { Obj as
|
|
427
|
+
import { Obj as Obj5 } from "@dxos/echo";
|
|
391
428
|
import { FUNCTIONS_PRESET_META_KEY } from "@dxos/functions";
|
|
392
429
|
import { createMenuAction as createMenuAction3 } from "@dxos/react-ui-menu";
|
|
393
430
|
var createTemplateSelectActions = (script) => {
|
|
394
431
|
return templates.map((template) => {
|
|
395
432
|
return createMenuAction3(`template--${template.id}`, () => {
|
|
396
|
-
script
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
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;
|
|
407
450
|
});
|
|
408
451
|
}
|
|
409
452
|
}, {
|
|
@@ -433,25 +476,23 @@ var createTemplateSelect = (script) => {
|
|
|
433
476
|
};
|
|
434
477
|
|
|
435
478
|
// src/hooks/useCreateAndDeployScriptTemplates.ts
|
|
436
|
-
import * as Function3 from "effect/Function";
|
|
437
479
|
import { useCallback, useState } from "react";
|
|
438
|
-
import {
|
|
439
|
-
import {
|
|
440
|
-
import { Obj as Obj5 } from "@dxos/echo";
|
|
480
|
+
import { useOperationInvoker } from "@dxos/app-framework/react";
|
|
481
|
+
import { Obj as Obj6 } from "@dxos/echo";
|
|
441
482
|
import { Script } from "@dxos/functions";
|
|
442
483
|
import { invariant } from "@dxos/invariant";
|
|
443
|
-
import {
|
|
484
|
+
import { SpaceOperation } from "@dxos/plugin-space/types";
|
|
444
485
|
import { useClient as useClient2 } from "@dxos/react-client";
|
|
445
486
|
var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/hooks/useCreateAndDeployScriptTemplates.ts";
|
|
446
487
|
var useCreateAndDeployScriptTemplates = (space, scriptTemplates) => {
|
|
447
|
-
const {
|
|
488
|
+
const { invokePromise } = useOperationInvoker();
|
|
448
489
|
const client = useClient2();
|
|
449
490
|
const [status, setStatus] = useState("idle");
|
|
450
491
|
const [error, setError] = useState(void 0);
|
|
451
492
|
const handleCreateAndDeployScripts = useCallback(async () => {
|
|
452
493
|
invariant(space, void 0, {
|
|
453
494
|
F: __dxlog_file5,
|
|
454
|
-
L:
|
|
495
|
+
L: 35,
|
|
455
496
|
S: void 0,
|
|
456
497
|
A: [
|
|
457
498
|
"space",
|
|
@@ -461,32 +502,34 @@ var useCreateAndDeployScriptTemplates = (space, scriptTemplates) => {
|
|
|
461
502
|
setStatus("pending");
|
|
462
503
|
setError(void 0);
|
|
463
504
|
const deploymentResults = await Promise.all(scriptTemplates.map(async (template) => {
|
|
464
|
-
const
|
|
465
|
-
space,
|
|
505
|
+
const createResult = await invokePromise(ScriptOperation.CreateScript, {
|
|
506
|
+
db: space.db,
|
|
466
507
|
initialTemplateId: template.id
|
|
467
|
-
})
|
|
468
|
-
|
|
469
|
-
})));
|
|
470
|
-
invariant(Obj5.instanceOf(Script.Script, result.data?.object), void 0, {
|
|
508
|
+
});
|
|
509
|
+
invariant(Obj6.instanceOf(Script.Script, createResult.data?.object), void 0, {
|
|
471
510
|
F: __dxlog_file5,
|
|
472
|
-
L:
|
|
511
|
+
L: 45,
|
|
473
512
|
S: void 0,
|
|
474
513
|
A: [
|
|
475
|
-
"Obj.instanceOf(Script.Script,
|
|
514
|
+
"Obj.instanceOf(Script.Script, createResult.data?.object)",
|
|
476
515
|
""
|
|
477
516
|
]
|
|
478
517
|
});
|
|
518
|
+
await invokePromise(SpaceOperation.AddObject, {
|
|
519
|
+
target: space.db,
|
|
520
|
+
object: createResult.data.object
|
|
521
|
+
});
|
|
479
522
|
return deployScript({
|
|
480
523
|
space,
|
|
481
524
|
client,
|
|
482
|
-
script:
|
|
525
|
+
script: createResult.data.object
|
|
483
526
|
});
|
|
484
527
|
}));
|
|
485
528
|
const hasErrors = deploymentResults.some((result) => !result.success);
|
|
486
529
|
setStatus(hasErrors ? "error" : "success");
|
|
487
530
|
}, [
|
|
488
531
|
space,
|
|
489
|
-
|
|
532
|
+
invokePromise,
|
|
490
533
|
client,
|
|
491
534
|
scriptTemplates
|
|
492
535
|
]);
|
|
@@ -498,17 +541,18 @@ var useCreateAndDeployScriptTemplates = (space, scriptTemplates) => {
|
|
|
498
541
|
};
|
|
499
542
|
|
|
500
543
|
export {
|
|
544
|
+
isScriptDeployed,
|
|
545
|
+
deployScript,
|
|
501
546
|
getFunctionUrl,
|
|
502
547
|
updateFunctionMetadata,
|
|
503
548
|
getAccessCredential,
|
|
504
|
-
isScriptDeployed,
|
|
505
|
-
deployScript,
|
|
506
549
|
createDeploy,
|
|
507
550
|
useDeployState,
|
|
508
551
|
useDeployDeps,
|
|
509
552
|
createFormat,
|
|
510
553
|
createTemplateSelect,
|
|
511
554
|
useCreateAndDeployScriptTemplates,
|
|
512
|
-
useToolbarState
|
|
555
|
+
useToolbarState,
|
|
556
|
+
useCompiler
|
|
513
557
|
};
|
|
514
|
-
//# sourceMappingURL=chunk-
|
|
558
|
+
//# sourceMappingURL=chunk-MGWKULCD.mjs.map
|