@marimo-team/islands 0.20.5-dev9 → 0.20.5-dev91
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/{Combination-Du-o_hC9.js → Combination-Dk6JxauT.js} +1 -1
- package/dist/{ConnectedDataExplorerComponent-DUS-zJoR.js → ConnectedDataExplorerComponent-Bh11efrC.js} +17 -17
- package/dist/{_baseIsEqual-5cAxzk6f.js → _baseIsEqual-CvgsjYoW.js} +38 -38
- package/dist/{_basePickBy-3JVb5wYm.js → _basePickBy-pTDW2_2A.js} +6 -6
- package/dist/{_baseUniq-DSSiFuIJ.js → _baseUniq-BUFhl85h.js} +1 -1
- package/dist/{any-language-editor-BL9o7y0_.js → any-language-editor-BIj11a2e.js} +19 -19
- package/dist/{architecture-7HQA4BMR-BxkNpYRp.js → architecture-7HQA4BMR-BmtmhGMc.js} +2 -2
- package/dist/{architectureDiagram-VXUJARFQ-DrJeyFHq.js → architectureDiagram-VXUJARFQ-Df0FNeBR.js} +14 -14
- package/dist/assets/__vite-browser-external-Us1ds95c.js +1 -0
- package/dist/assets/{worker-DUYMdbtA.js → worker-D10K3OOz.js} +2 -2
- package/dist/{blockDiagram-VD42YOAC-BJrP6qKc.js → blockDiagram-VD42YOAC-DszWqlLz.js} +7 -7
- package/dist/{button-KYalaJYu.js → button-DQpBib29.js} +24 -11
- package/dist/{c4Diagram-YG6GDRKO-Bo4gytQ5.js → c4Diagram-YG6GDRKO-Dyj8LoUX.js} +4 -4
- package/dist/{channel-IWLGkaBE.js → channel-CUFaIkTh.js} +1 -1
- package/dist/{check-C50jsehH.js → check-DpqPQmzz.js} +1 -1
- package/dist/{chunk-4F5CHEZ2-CxKDFd-t.js → chunk-4F5CHEZ2-CRwwZ2ED.js} +1 -1
- package/dist/{chunk-ABZYJK2D-CRwanrkd.js → chunk-ABZYJK2D-7QYXAAhe.js} +1 -1
- package/dist/{chunk-ATLVNIR6-CMMCMvOK.js → chunk-ATLVNIR6-pmHPAPSd.js} +1 -1
- package/dist/{chunk-B2363JML-e_W7KW1D.js → chunk-B2363JML-BuBMltZc.js} +1 -1
- package/dist/{chunk-B4BG7PRW-BNsHrGHG.js → chunk-B4BG7PRW-Dbta9cTX.js} +4 -4
- package/dist/{chunk-DI55MBZ5-DQeYbfMV.js → chunk-DI55MBZ5-DyKB35wC.js} +4 -4
- package/dist/{chunk-EXTU4WIE-CV_DQeaX.js → chunk-EXTU4WIE-BRFl4iNd.js} +1 -1
- package/dist/{chunk-FRFDVMJY-C7q09nvl.js → chunk-FRFDVMJY-Bk2LD5Te.js} +1 -1
- package/dist/{chunk-JA3XYJ7Z-Cmt--e0q.js → chunk-JA3XYJ7Z-BkrY9SdL.js} +2 -2
- package/dist/{chunk-JZLCHNYA-CkyMJnI9.js → chunk-JZLCHNYA-Bk_Lil-q.js} +4 -4
- package/dist/{chunk-N4CR4FBY-BJfHtJbD.js → chunk-N4CR4FBY-f5n6meOd.js} +5 -5
- package/dist/{chunk-PL6DKKU2-ChKBqnoD.js → chunk-PL6DKKU2-DiFkzMfM.js} +1 -1
- package/dist/{chunk-QN33PNHL-WOLIPUAJ.js → chunk-QN33PNHL-CXfJywHv.js} +1 -1
- package/dist/{chunk-QXUST7PY-DYuD50pU.js → chunk-QXUST7PY-D7-26sj3.js} +5 -5
- package/dist/{chunk-S3R3BYOJ-CsnX6RKs.js → chunk-S3R3BYOJ-BRT9vd1R.js} +3 -3
- package/dist/{chunk-SJTYNZTY-j6_1s5om.js → chunk-SJTYNZTY-BvVkbShU.js} +1 -1
- package/dist/{chunk-TCCFYFTB-DdLCbCTn.js → chunk-TCCFYFTB-DqxhgXG0.js} +31 -31
- package/dist/{chunk-TQ3KTPDO-CGsUIC73.js → chunk-TQ3KTPDO-CPkEruAA.js} +1 -1
- package/dist/{chunk-TZMSLE5B-B3eYTGCw.js → chunk-TZMSLE5B-DSfBOnzx.js} +1 -1
- package/dist/{chunk-UMXZTB3W--LdAK3Bv.js → chunk-UMXZTB3W-C4ypIY3V.js} +1 -1
- package/dist/{classDiagram-v2-WZHVMYZB-UTw37Gg8.js → classDiagram-2ON5EDUG-DphiMW3Y.js} +10 -10
- package/dist/{classDiagram-2ON5EDUG-C7C-oefv.js → classDiagram-v2-WZHVMYZB-BH1x5h4a.js} +10 -10
- package/dist/{clone-BJrS4PdE.js → clone-CEQ-pda1.js} +1 -1
- package/dist/{constants-D1Tbg_6B.js → constants-CytQ_3LM.js} +3 -3
- package/dist/{copy-oc-FcZzt.js → copy-BkBF0Xgk.js} +2 -2
- package/dist/{dagre-6UL2VRFP-BgsUhJrV.js → dagre-6UL2VRFP-DGEbtmgU.js} +12 -12
- package/dist/{dagre-CyZCGfV_.js → dagre-BVnNvbvD.js} +37 -37
- package/dist/{diagram-PSM6KHXK-BIUUOfKo.js → diagram-PSM6KHXK-CG_usglE.js} +15 -15
- package/dist/{diagram-QEK2KX5R-BFjolZQv.js → diagram-QEK2KX5R-CtGFEwzJ.js} +13 -13
- package/dist/{diagram-S2PKOQOG-4jfkWoZw.js → diagram-S2PKOQOG-ClKAGmbv.js} +13 -13
- package/dist/dist-B4MxkKHf.js +8 -0
- package/dist/{dist-De9X_Des.js → dist-B9EjSb9T.js} +1 -1
- package/dist/{dist-IW_ARJ3S.js → dist-BFxYppVR.js} +4 -4
- package/dist/{dist-D7ZGWV_9.js → dist-BGZ7TWS9.js} +3 -3
- package/dist/{dist-CwtEWuFb.js → dist-BSfYc7vq.js} +2 -2
- package/dist/{dist-DMS81OrU.js → dist-BUrWeMEP.js} +1 -1
- package/dist/dist-BYghZv6b.js +5 -0
- package/dist/dist-Be-uQhz5.js +6 -0
- package/dist/{dist-Ch_JuCvc.js → dist-BpMlUdNO.js} +3 -3
- package/dist/{dist-C6z8U-ms.js → dist-Bq5eYK43.js} +2 -2
- package/dist/{dist-BFL9TlzD.js → dist-Bq9zYwJs.js} +5 -5
- package/dist/{dist-7ZF--V_D.js → dist-C4K7pumm.js} +2 -2
- package/dist/{dist-Qjf6pcqK.js → dist-CAKwXCWI.js} +2 -2
- package/dist/dist-CB_xf0ju.js +5 -0
- package/dist/{dist-BwQHkjA9.js → dist-CDHl2i1x.js} +4 -4
- package/dist/dist-CK0qFAbF.js +8 -0
- package/dist/{dist-C4XMUaob.js → dist-CPlGUbk-.js} +2 -2
- package/dist/{dist-BT6_J2eq.js → dist-CSEWGuDq.js} +7 -2
- package/dist/dist-CYEk-qrr.js +8 -0
- package/dist/{dist-CYo3w-nC.js → dist-Cl5iM8xL.js} +3 -3
- package/dist/dist-CmKoWpMk.js +5 -0
- package/dist/{dist-I8MQW60_.js → dist-CseYuPtL.js} +2 -2
- package/dist/dist-D1nf4IQl.js +5 -0
- package/dist/{dist-CsqiXw7J.js → dist-D4gcY469.js} +2 -2
- package/dist/{dist-DUxS2paD.js → dist-D5NMgbbv.js} +2 -2
- package/dist/{dist-UYm1IE5s.js → dist-DERtJN02.js} +2 -2
- package/dist/{dist-CFToYDWO.js → dist-DEj2X26M.js} +2 -2
- package/dist/{dist-BuapEdlD.js → dist-DOoqn-VL.js} +70 -67
- package/dist/{dist-BLThQiU4.js → dist-DUretbKK.js} +2 -2
- package/dist/{dist-DEFZ7dnD.js → dist-D_-CGmlh.js} +2 -2
- package/dist/dist-Df3AcKpt.js +6 -0
- package/dist/dist-DgaFHt_I.js +5 -0
- package/dist/dist-Dk10C3ui.js +5 -0
- package/dist/{dist-D0f6Yrrb.js → dist-DodLQWPg.js} +1 -1
- package/dist/dist-DtyPVMHR.js +5 -0
- package/dist/{dist-Cb3cLT39.js → dist-HoZO6brh.js} +2 -2
- package/dist/{dist-Cqpjy6bK.js → dist-RNGn_-uD.js} +1 -1
- package/dist/{dist-BBcqvpvP.js → dist-Ux6dL_VB.js} +1 -1
- package/dist/{dist-B8Y11RWn.js → dist-WIWVvdBh.js} +2 -2
- package/dist/{dist-CB6qhQ8K.js → dist-gc9KgJuA.js} +1 -1
- package/dist/{dist-ovDpXuSB.js → dist-i-ud9aCA.js} +1 -1
- package/dist/dist-ko7WnHAO.js +5 -0
- package/dist/{dist-BTQbjEKU.js → dist-lNe4i1Nm.js} +1 -1
- package/dist/dist-of7gLRFK.js +8 -0
- package/dist/{erDiagram-Q2GNP2WA-Cq5Bz5lG.js → erDiagram-Q2GNP2WA-DPMseVVp.js} +10 -10
- package/dist/{error-banner-D0tXnwl4.js → error-banner-BctofTCP.js} +2 -2
- package/dist/{esm-BxMbHo0y.js → esm-BBkPJL8N.js} +29 -27
- package/dist/{flowDiagram-NV44I4VS-6WPJVFl7.js → flowDiagram-NV44I4VS-BpAIFwW7.js} +10 -10
- package/dist/{ganttDiagram-JELNMOA3-AfDhh9CI.js → ganttDiagram-JELNMOA3-DXYghZ9C.js} +3 -3
- package/dist/{gitGraph-G5XIXVHT-C0o6gecv.js → gitGraph-G5XIXVHT-ChHUSAop.js} +2 -2
- package/dist/{gitGraphDiagram-V2S2FVAM-BRSwuj0Q.js → gitGraphDiagram-V2S2FVAM-CBL-7g3_.js} +12 -12
- package/dist/{glide-data-editor-ByPNTNVG.js → glide-data-editor-DqxJOnJk.js} +63 -63
- package/dist/{graphlib-DZnBMcsX.js → graphlib-D18eZCT4.js} +10 -10
- package/dist/hasIn-B9AbGLj3.js +86 -0
- package/dist/{info-VBDWY6EO-Bzsods6X.js → info-VBDWY6EO-CwyXEo8E.js} +2 -2
- package/dist/{infoDiagram-HS3SLOUP-Cmxo6jKx.js → infoDiagram-HS3SLOUP-BXGbfBss.js} +12 -12
- package/dist/{isArrayLikeObject-Btu-i6_P.js → isArrayLikeObject-BrYl-ETg.js} +25 -26
- package/dist/{isEmpty-CZvUtYFp.js → isEmpty-C-xMag79.js} +2 -2
- package/dist/{isString-CBr7TEb7.js → isString-D-vNYDBA.js} +1 -1
- package/dist/{isSymbol-BuQsMXhk.js → isSymbol-Dyt2NSnN.js} +1 -1
- package/dist/{journeyDiagram-XKPGCS4Q-CKYr8cSR.js → journeyDiagram-XKPGCS4Q-D5BIjS4N.js} +3 -3
- package/dist/{kanban-definition-3W4ZIXB7-DVvAZzQD.js → kanban-definition-3W4ZIXB7-DhDkqxFB.js} +7 -7
- package/dist/{label-CV0KYhtH.js → label-BLDcDYdI.js} +6 -6
- package/dist/{loader-eJCvvApN.js → loader-DsE3MiYo.js} +2 -2
- package/dist/main.js +1673 -1163
- package/dist/{memoize-P1T1IGb9.js → memoize-Cs8aS5RW.js} +1 -1
- package/dist/merge-NuyC7LN7.js +51 -0
- package/dist/{mermaid-COOB_abB.js → mermaid-DkdSmFY8.js} +42 -42
- package/dist/{mermaid-parser.core-Cd-wu4tE.js → mermaid-parser.core-OkWZ8nr-.js} +8 -8
- package/dist/{min-CMDDtXJP.js → min-ECVRnCdn.js} +30 -30
- package/dist/{mindmap-definition-VGOIOE7T-1ExmnvYy.js → mindmap-definition-VGOIOE7T-BxQi78Vl.js} +9 -9
- package/dist/{now-BxlRp0OQ.js → now-BC2mX0ZT.js} +1 -1
- package/dist/{packet-DYOGHKS2-Bf1CvFco.js → packet-DYOGHKS2-C62XQjZh.js} +2 -2
- package/dist/{pie-VRWISCQL-LY_wbqji.js → pie-VRWISCQL-nfAKQJw3.js} +2 -2
- package/dist/{pieDiagram-ADFJNKIX-CJlIsdsU.js → pieDiagram-ADFJNKIX-DfSJXUHa.js} +13 -13
- package/dist/{purify.es-CyOIw8ru.js → purify.es-DGenX2XH.js} +67 -67
- package/dist/{quadrantDiagram-AYHSOK5B-BU78RiaH.js → quadrantDiagram-AYHSOK5B-CAcVWXc-.js} +2 -2
- package/dist/{radar-ZZBFDIW7-Ro3iXZCk.js → radar-ZZBFDIW7-lopS8_4j.js} +2 -2
- package/dist/{range-Dh0_-r8P.js → range-BKaWvVUE.js} +8 -8
- package/dist/reduce-CqQo8ppc.js +275 -0
- package/dist/{requirementDiagram-UZGBJVZJ-DACHtrFr.js → requirementDiagram-UZGBJVZJ-BU7dwzFM.js} +9 -9
- package/dist/{sankeyDiagram-TZEHDZUN-Bzg7_UWs.js → sankeyDiagram-TZEHDZUN-BVJnR4_b.js} +2 -2
- package/dist/{sequenceDiagram-WL72ISMW-agybEe9J.js → sequenceDiagram-WL72ISMW-CQcFQTwX.js} +4 -4
- package/dist/{slides-component-B0yK5GXP.js → slides-component-DwvL_HJi.js} +2 -2
- package/dist/{spec-Dq_reDGM.js → spec-CbYkiXG3.js} +5 -5
- package/dist/{stateDiagram-FKZM4ZOC-DehQAt8g.js → stateDiagram-FKZM4ZOC-Dx9AIGDe.js} +12 -12
- package/dist/{stateDiagram-v2-4FDKWEC3-8VzeREl9.js → stateDiagram-v2-4FDKWEC3-BIeUs-Ed.js} +10 -10
- package/dist/style.css +1 -1
- package/dist/{timeline-definition-IT6M3QCI-CdCfdaCF.js → timeline-definition-IT6M3QCI-D8B3p7ID.js} +2 -2
- package/dist/{toNumber-By7s5JC_.js → toNumber-CbZ70FdN.js} +2 -2
- package/dist/{toString-Ckpb50uw.js → toString-DbIAWQpF.js} +2 -2
- package/dist/{tooltip-CL8m4f9y.js → tooltip-SPkubVH3.js} +3 -3
- package/dist/{treemap-GDKQZRPO-DRxfDG65.js → treemap-GDKQZRPO-CkR-5ai2.js} +2 -2
- package/dist/{types-BwnzGcE4.js → types-0FB-N7AA.js} +519 -408
- package/dist/{uniq-cCc07Q8K.js → uniq-H2E5nMLq.js} +1 -1
- package/dist/{useAsyncData-B4hMFGnF.js → useAsyncData-D7-oahg5.js} +1 -1
- package/dist/{useDeepCompareMemoize-DuPhOXzr.js → useDeepCompareMemoize-DLS-bHHT.js} +5 -5
- package/dist/{useIframeCapabilities-CAt6D2EI.js → useIframeCapabilities-DFGZKWkO.js} +1 -1
- package/dist/{useTheme-BNYQnvu-.js → useTheme-D0rdoMBF.js} +6 -5
- package/dist/{vega-component-DouPy8AI.js → vega-component-CnO3mkFC.js} +11 -11
- package/dist/{xychartDiagram-PRI3JC2R-rEm_SIsC.js → xychartDiagram-PRI3JC2R-XO8FiQjU.js} +5 -5
- package/package.json +9 -9
- package/src/__mocks__/common.ts +41 -8
- package/src/__mocks__/requests.ts +1 -0
- package/src/components/chat/__tests__/useFileState.test.tsx +2 -3
- package/src/components/chat/acp/__tests__/context-utils.test.ts +2 -6
- package/src/components/datasources/components.tsx +3 -6
- package/src/components/datasources/datasources.tsx +8 -21
- package/src/components/editor/__tests__/data-attributes.test.tsx +2 -11
- package/src/components/editor/actions/types.ts +6 -1
- package/src/components/editor/actions/useNotebookActions.tsx +50 -13
- package/src/components/editor/cell/cell-context-menu.tsx +2 -6
- package/src/components/editor/chrome/types.ts +17 -0
- package/src/components/editor/connections/add-connection-dialog.tsx +27 -2
- package/src/components/editor/connections/database/__tests__/__snapshots__/as-code.test.ts.snap +105 -6
- package/src/components/editor/connections/database/__tests__/as-code.test.ts +101 -8
- package/src/components/editor/connections/database/as-code.ts +115 -25
- package/src/components/editor/connections/database/schemas.ts +49 -2
- package/src/components/editor/connections/storage/as-code.ts +1 -1
- package/src/components/editor/controls/command-palette.tsx +7 -0
- package/src/components/editor/controls/keyboard-shortcuts.tsx +3 -1
- package/src/components/editor/file-tree/__tests__/requesting-tree.test.ts +2 -3
- package/src/components/editor/file-tree/file-explorer.tsx +48 -62
- package/src/components/editor/file-tree/file-icons.tsx +132 -0
- package/src/components/editor/file-tree/file-viewer.tsx +1 -1
- package/src/components/editor/file-tree/tree-actions.tsx +107 -0
- package/src/components/editor/file-tree/types.ts +2 -96
- package/src/components/editor/header/filename-input.tsx +4 -1
- package/src/components/editor/navigation/__tests__/clipboard.test.ts +2 -4
- package/src/components/editor/output/console/ConsoleOutput.tsx +51 -2
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +97 -16
- package/src/components/editor/package-alert.tsx +4 -0
- package/src/components/icons/marimo-icons.tsx +2 -2
- package/src/components/pages/home-page.tsx +5 -5
- package/src/components/storage/__tests__/storage-snippets.test.ts +253 -0
- package/src/components/storage/components.tsx +0 -38
- package/src/components/storage/storage-file-viewer.tsx +1 -1
- package/src/components/storage/storage-inspector.tsx +66 -51
- package/src/components/storage/storage-snippets.ts +67 -0
- package/src/components/ui/command.tsx +2 -0
- package/src/core/ai/tools/__tests__/run-cells-tool.test.ts +206 -0
- package/src/core/ai/tools/run-cells-tool.ts +75 -40
- package/src/core/alerts/state.ts +1 -0
- package/src/core/cells/__tests__/cells.test.ts +62 -0
- package/src/core/cells/__tests__/session.test.ts +2 -7
- package/src/core/cells/cells.ts +25 -3
- package/src/core/cells/ids.ts +2 -1
- package/src/core/codemirror/compat/__tests__/jupyter.test.ts +2 -3
- package/src/core/codemirror/keymaps/vim.ts +32 -3
- package/src/core/codemirror/markdown/__tests__/commands.test.ts +2 -3
- package/src/core/config/__tests__/config-schema.test.ts +6 -2
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/config/feature-flag.tsx +1 -1
- package/src/core/dom/ui-element-constants.ts +15 -0
- package/src/core/dom/ui-element.ts +3 -2
- package/src/core/export/__tests__/hooks.test.ts +3 -10
- package/src/core/hotkeys/__tests__/hotkeys.test.ts +64 -1
- package/src/core/hotkeys/hotkeys.ts +29 -3
- package/src/core/islands/bridge.ts +1 -0
- package/src/core/islands/components/web-components.tsx +2 -1
- package/src/core/network/__tests__/requests-network.test.ts +17 -0
- package/src/core/network/requests-lazy.ts +1 -0
- package/src/core/network/requests-network.ts +9 -0
- package/src/core/network/requests-static.ts +1 -0
- package/src/core/network/requests-toasting.tsx +1 -0
- package/src/core/network/types.ts +1 -0
- package/src/core/runtime/__tests__/runtime.test.ts +2 -8
- package/src/core/storage/__tests__/state.test.ts +1 -0
- package/src/core/wasm/bridge.ts +1 -0
- package/src/core/websocket/useMarimoKernelConnection.tsx +2 -0
- package/src/plugins/impl/DataTablePlugin.tsx +53 -3
- package/src/plugins/impl/FileBrowserPlugin.tsx +8 -5
- package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +2 -11
- package/src/plugins/impl/__tests__/DropdownPlugin.test.tsx +2 -11
- package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +4 -1
- package/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx +8 -1
- package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +309 -0
- package/src/plugins/impl/mpl-interactive/__tests__/mpl-websocket-shim.test.ts +110 -0
- package/src/plugins/impl/mpl-interactive/mpl-websocket-shim.ts +57 -0
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +8 -2
- package/src/plugins/impl/vega/vega-component.tsx +7 -1
- package/src/plugins/impl/vega/vega.css +4 -11
- package/src/plugins/plugins.ts +2 -0
- package/src/utils/__tests__/copy.test.ts +129 -0
- package/src/utils/__tests__/download.test.tsx +12 -14
- package/src/utils/__tests__/filenames.test.ts +7 -0
- package/src/utils/__tests__/smartMatch.test.ts +61 -0
- package/src/utils/copy.ts +43 -0
- package/src/utils/filenames.ts +3 -0
- package/src/utils/smartMatch.ts +62 -0
- package/dist/_baseProperty-D1nWkRMz.js +0 -93
- package/dist/assets/__vite-browser-external-WSlCcXn_.js +0 -1
- package/dist/dist-BAeGo2rp.js +0 -5
- package/dist/dist-BqwCMSEa.js +0 -5
- package/dist/dist-Bum8FwTO.js +0 -6
- package/dist/dist-C0YiOwt_.js +0 -5
- package/dist/dist-C2uPv4iU.js +0 -5
- package/dist/dist-C5hOLsJN.js +0 -8
- package/dist/dist-C9NIAKMs.js +0 -8
- package/dist/dist-CCrzTtvk.js +0 -5
- package/dist/dist-CFS9i1rS.js +0 -8
- package/dist/dist-CyHZuhPH.js +0 -5
- package/dist/dist-CzcjWdIk.js +0 -6
- package/dist/dist-DaYyUSNC.js +0 -5
- package/dist/dist-DpDcJYNh.js +0 -8
- package/dist/dist-U_BfxcPn.js +0 -5
- package/dist/merge-CGQkMGzr.js +0 -51
- package/dist/reduce-BXFHs7IQ.js +0 -268
|
@@ -59,6 +59,8 @@ export interface PanelDescriptor {
|
|
|
59
59
|
defaultSection: PanelSection;
|
|
60
60
|
/** Capability required for this panel to be visible. If the capability is false, the panel is hidden. */
|
|
61
61
|
requiredCapability?: keyof Capabilities;
|
|
62
|
+
/** Additional search keywords for the command palette */
|
|
63
|
+
additionalKeywords?: string[];
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
/**
|
|
@@ -73,6 +75,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
73
75
|
label: "Files",
|
|
74
76
|
tooltip: "View files",
|
|
75
77
|
defaultSection: "sidebar",
|
|
78
|
+
additionalKeywords: ["explorer", "browser", "directory"],
|
|
76
79
|
},
|
|
77
80
|
{
|
|
78
81
|
type: "variables",
|
|
@@ -80,6 +83,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
80
83
|
label: "Variables",
|
|
81
84
|
tooltip: "Explore variables and data sources",
|
|
82
85
|
defaultSection: "sidebar",
|
|
86
|
+
additionalKeywords: ["state", "scope", "inspector"],
|
|
83
87
|
},
|
|
84
88
|
{
|
|
85
89
|
type: "packages",
|
|
@@ -87,6 +91,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
87
91
|
label: "Packages",
|
|
88
92
|
tooltip: "Manage packages",
|
|
89
93
|
defaultSection: "sidebar",
|
|
94
|
+
additionalKeywords: ["dependencies", "pip", "install"],
|
|
90
95
|
},
|
|
91
96
|
{
|
|
92
97
|
type: "ai",
|
|
@@ -94,6 +99,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
94
99
|
label: "AI",
|
|
95
100
|
tooltip: "Chat & Agents",
|
|
96
101
|
defaultSection: "sidebar",
|
|
102
|
+
additionalKeywords: ["chat", "copilot", "assistant"],
|
|
97
103
|
},
|
|
98
104
|
{
|
|
99
105
|
type: "outline",
|
|
@@ -101,6 +107,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
101
107
|
label: "Outline",
|
|
102
108
|
tooltip: "View outline",
|
|
103
109
|
defaultSection: "sidebar",
|
|
110
|
+
additionalKeywords: ["toc", "structure", "headings"],
|
|
104
111
|
},
|
|
105
112
|
{
|
|
106
113
|
type: "documentation",
|
|
@@ -108,6 +115,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
108
115
|
label: "Docs",
|
|
109
116
|
tooltip: "View live docs",
|
|
110
117
|
defaultSection: "sidebar",
|
|
118
|
+
additionalKeywords: ["reference", "api"],
|
|
111
119
|
},
|
|
112
120
|
{
|
|
113
121
|
type: "dependencies",
|
|
@@ -115,6 +123,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
115
123
|
label: "Dependencies",
|
|
116
124
|
tooltip: "Explore dependencies",
|
|
117
125
|
defaultSection: "sidebar",
|
|
126
|
+
additionalKeywords: ["graph", "imports"],
|
|
118
127
|
},
|
|
119
128
|
// Developer panel defaults
|
|
120
129
|
{
|
|
@@ -123,6 +132,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
123
132
|
label: "Errors",
|
|
124
133
|
tooltip: "View errors",
|
|
125
134
|
defaultSection: "developer-panel",
|
|
135
|
+
additionalKeywords: ["exceptions", "problems", "diagnostics"],
|
|
126
136
|
},
|
|
127
137
|
{
|
|
128
138
|
type: "scratchpad",
|
|
@@ -130,6 +140,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
130
140
|
label: "Scratchpad",
|
|
131
141
|
tooltip: "Scratchpad",
|
|
132
142
|
defaultSection: "developer-panel",
|
|
143
|
+
additionalKeywords: ["scratch", "draft", "playground"],
|
|
133
144
|
},
|
|
134
145
|
{
|
|
135
146
|
type: "tracing",
|
|
@@ -137,6 +148,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
137
148
|
label: "Tracing",
|
|
138
149
|
tooltip: "View tracing",
|
|
139
150
|
defaultSection: "developer-panel",
|
|
151
|
+
additionalKeywords: ["profiling", "performance"],
|
|
140
152
|
},
|
|
141
153
|
{
|
|
142
154
|
type: "secrets",
|
|
@@ -145,6 +157,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
145
157
|
tooltip: "Manage secrets",
|
|
146
158
|
defaultSection: "developer-panel",
|
|
147
159
|
hidden: isWasm(),
|
|
160
|
+
additionalKeywords: ["env", "environment", "keys", "credentials"],
|
|
148
161
|
},
|
|
149
162
|
{
|
|
150
163
|
type: "logs",
|
|
@@ -152,6 +165,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
152
165
|
label: "Logs",
|
|
153
166
|
tooltip: "View logs",
|
|
154
167
|
defaultSection: "developer-panel",
|
|
168
|
+
additionalKeywords: ["console", "stdout"],
|
|
155
169
|
},
|
|
156
170
|
{
|
|
157
171
|
type: "terminal",
|
|
@@ -161,6 +175,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
161
175
|
hidden: isWasm(),
|
|
162
176
|
defaultSection: "developer-panel",
|
|
163
177
|
requiredCapability: "terminal",
|
|
178
|
+
additionalKeywords: ["shell", "console", "bash", "command"],
|
|
164
179
|
},
|
|
165
180
|
{
|
|
166
181
|
type: "snippets",
|
|
@@ -168,6 +183,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
168
183
|
label: "Snippets",
|
|
169
184
|
tooltip: "Snippets",
|
|
170
185
|
defaultSection: "developer-panel",
|
|
186
|
+
additionalKeywords: ["templates", "examples"],
|
|
171
187
|
},
|
|
172
188
|
{
|
|
173
189
|
type: "cache",
|
|
@@ -176,6 +192,7 @@ export const PANELS: PanelDescriptor[] = [
|
|
|
176
192
|
tooltip: "View cache",
|
|
177
193
|
defaultSection: "developer-panel",
|
|
178
194
|
hidden: !getFeatureFlag("cache_panel"),
|
|
195
|
+
additionalKeywords: ["memory", "memoize"],
|
|
179
196
|
},
|
|
180
197
|
];
|
|
181
198
|
|
|
@@ -37,6 +37,8 @@ export const AddConnectionDialogContent: React.FC<{
|
|
|
37
37
|
defaultTab?: ConnectionTab;
|
|
38
38
|
onClose: () => void;
|
|
39
39
|
}> = ({ defaultTab = "databases", onClose }) => {
|
|
40
|
+
const [activeTab, setActiveTab] = useState<ConnectionTab>(defaultTab);
|
|
41
|
+
|
|
40
42
|
const tabHeader = (
|
|
41
43
|
<TabsList className="w-full mb-4">
|
|
42
44
|
<TabsTrigger value="databases" className="flex-1">
|
|
@@ -48,6 +50,25 @@ export const AddConnectionDialogContent: React.FC<{
|
|
|
48
50
|
</TabsList>
|
|
49
51
|
);
|
|
50
52
|
|
|
53
|
+
const codeSnippetHint =
|
|
54
|
+
activeTab === "databases" ? (
|
|
55
|
+
<>
|
|
56
|
+
Don't see your database or connection method? A{" "}
|
|
57
|
+
<ExternalLink href="https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database">
|
|
58
|
+
code snippet
|
|
59
|
+
</ExternalLink>{" "}
|
|
60
|
+
is all you need.
|
|
61
|
+
</>
|
|
62
|
+
) : (
|
|
63
|
+
<>
|
|
64
|
+
Don't see your storage or connection method? A{" "}
|
|
65
|
+
<ExternalLink href="https://docs.marimo.io/guides/working_with_data/remote_storage/#creating-a-storage-connection">
|
|
66
|
+
code snippet
|
|
67
|
+
</ExternalLink>{" "}
|
|
68
|
+
is all you need.
|
|
69
|
+
</>
|
|
70
|
+
);
|
|
71
|
+
|
|
51
72
|
return (
|
|
52
73
|
<DialogContent className="max-h-[75vh] overflow-y-auto">
|
|
53
74
|
<DialogHeader>
|
|
@@ -61,10 +82,14 @@ export const AddConnectionDialogContent: React.FC<{
|
|
|
61
82
|
<ExternalLink href="https://docs.marimo.io/guides/working_with_data/remote_storage/">
|
|
62
83
|
remote storage
|
|
63
84
|
</ExternalLink>{" "}
|
|
64
|
-
|
|
85
|
+
directly from your notebook.
|
|
86
|
+
<span className="block">{codeSnippetHint}</span>
|
|
65
87
|
</DialogDescription>
|
|
66
88
|
</DialogHeader>
|
|
67
|
-
<Tabs
|
|
89
|
+
<Tabs
|
|
90
|
+
value={activeTab}
|
|
91
|
+
onValueChange={(v) => setActiveTab(v as ConnectionTab)}
|
|
92
|
+
>
|
|
68
93
|
<TabsContent
|
|
69
94
|
value="databases"
|
|
70
95
|
className="mt-0 focus-visible:ring-0 focus-visible:ring-offset-0"
|
package/src/components/editor/connections/database/__tests__/__snapshots__/as-code.test.ts.snap
CHANGED
|
@@ -248,16 +248,95 @@ _password = os.environ.get("SNOWFLAKE_PASSWORD", "pass")
|
|
|
248
248
|
engine = sqlmodel.create_engine(
|
|
249
249
|
URL(
|
|
250
250
|
account="account",
|
|
251
|
+
database="db",
|
|
252
|
+
warehouse="warehouse",
|
|
253
|
+
schema="schema",
|
|
254
|
+
role="role",
|
|
251
255
|
user="user",
|
|
256
|
+
password=_password,
|
|
257
|
+
)
|
|
258
|
+
)"
|
|
259
|
+
`;
|
|
260
|
+
|
|
261
|
+
exports[`generateDatabaseCode > basic connections > snowflake with MFA 1`] = `
|
|
262
|
+
"from snowflake.sqlalchemy import URL
|
|
263
|
+
import os
|
|
264
|
+
import sqlmodel
|
|
265
|
+
|
|
266
|
+
_password = os.environ.get("SNOWFLAKE_PASSWORD", "pass")
|
|
267
|
+
engine = sqlmodel.create_engine(
|
|
268
|
+
URL(
|
|
269
|
+
account="account",
|
|
252
270
|
database="db",
|
|
253
271
|
warehouse="warehouse",
|
|
254
272
|
schema="schema",
|
|
255
273
|
role="role",
|
|
274
|
+
user="user",
|
|
256
275
|
password=_password,
|
|
276
|
+
),
|
|
277
|
+
connect_args={"authenticator": "username_password_mfa"},
|
|
278
|
+
)"
|
|
279
|
+
`;
|
|
280
|
+
|
|
281
|
+
exports[`generateDatabaseCode > basic connections > snowflake with OAuth/PAT 1`] = `
|
|
282
|
+
"from snowflake.sqlalchemy import URL
|
|
283
|
+
import os
|
|
284
|
+
import sqlmodel
|
|
285
|
+
|
|
286
|
+
_password = os.environ.get("SNOWFLAKE_TOKEN", "my_token")
|
|
287
|
+
engine = sqlmodel.create_engine(
|
|
288
|
+
URL(
|
|
289
|
+
account="account",
|
|
290
|
+
database="db",
|
|
291
|
+
warehouse="warehouse",
|
|
292
|
+
schema="schema",
|
|
293
|
+
role="role",
|
|
294
|
+
authenticator="oauth",
|
|
295
|
+
token=_password,
|
|
296
|
+
)
|
|
297
|
+
)"
|
|
298
|
+
`;
|
|
299
|
+
|
|
300
|
+
exports[`generateDatabaseCode > basic connections > snowflake with SSO 1`] = `
|
|
301
|
+
"from snowflake.sqlalchemy import URL
|
|
302
|
+
import sqlmodel
|
|
303
|
+
|
|
304
|
+
engine = sqlmodel.create_engine(
|
|
305
|
+
URL(
|
|
306
|
+
account="account",
|
|
307
|
+
database="db",
|
|
308
|
+
warehouse="warehouse",
|
|
309
|
+
schema="schema",
|
|
310
|
+
role="role",
|
|
311
|
+
user="user",
|
|
312
|
+
authenticator="externalbrowser",
|
|
257
313
|
)
|
|
258
314
|
)"
|
|
259
315
|
`;
|
|
260
316
|
|
|
317
|
+
exports[`generateDatabaseCode > basic connections > snowflake with key pair 1`] = `
|
|
318
|
+
"from snowflake.sqlalchemy import URL
|
|
319
|
+
import os
|
|
320
|
+
import sqlmodel
|
|
321
|
+
|
|
322
|
+
_password = os.environ.get("SNOWFLAKE_PRIVATE_KEY_PASSPHRASE", "my_passphrase")
|
|
323
|
+
engine = sqlmodel.create_engine(
|
|
324
|
+
URL(
|
|
325
|
+
account="account",
|
|
326
|
+
database="db",
|
|
327
|
+
warehouse="warehouse",
|
|
328
|
+
schema="schema",
|
|
329
|
+
role="role",
|
|
330
|
+
user="user",
|
|
331
|
+
),
|
|
332
|
+
connect_args={
|
|
333
|
+
"authenticator": "SNOWFLAKE_JWT",
|
|
334
|
+
"private_key_file": "/path/to/rsa_key.p8",
|
|
335
|
+
"private_key_file_pwd": _password,
|
|
336
|
+
},
|
|
337
|
+
)"
|
|
338
|
+
`;
|
|
339
|
+
|
|
261
340
|
exports[`generateDatabaseCode > basic connections > sqlite 1`] = `
|
|
262
341
|
"import sqlmodel
|
|
263
342
|
|
|
@@ -362,17 +441,17 @@ exports[`generateDatabaseCode > connections with secrets > snowflake with multip
|
|
|
362
441
|
import os
|
|
363
442
|
import sqlmodel
|
|
364
443
|
|
|
365
|
-
_password = os.environ.get("ENV_PASSWORD")
|
|
366
444
|
_account = os.environ.get("ENV_ACCOUNT")
|
|
445
|
+
_password = os.environ.get("ENV_PASSWORD")
|
|
367
446
|
_user = os.environ.get("ENV_USER")
|
|
368
447
|
engine = sqlmodel.create_engine(
|
|
369
448
|
URL(
|
|
370
449
|
account=_account,
|
|
371
|
-
user=_user,
|
|
372
450
|
database="db",
|
|
373
451
|
warehouse="warehouse",
|
|
374
452
|
schema="schema",
|
|
375
453
|
role="role",
|
|
454
|
+
user=_user,
|
|
376
455
|
password=_password,
|
|
377
456
|
)
|
|
378
457
|
)"
|
|
@@ -563,6 +642,26 @@ DATABASE_URL = f"postgresql://用户:{_password}@localhost:5432/测试数据库"
|
|
|
563
642
|
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
|
|
564
643
|
`;
|
|
565
644
|
|
|
645
|
+
exports[`generateDatabaseCode > edge cases > snowflake key pair without passphrase 1`] = `
|
|
646
|
+
"from snowflake.sqlalchemy import URL
|
|
647
|
+
import sqlmodel
|
|
648
|
+
|
|
649
|
+
engine = sqlmodel.create_engine(
|
|
650
|
+
URL(
|
|
651
|
+
account="account",
|
|
652
|
+
database="db",
|
|
653
|
+
warehouse="warehouse",
|
|
654
|
+
schema="schema",
|
|
655
|
+
role="role",
|
|
656
|
+
user="user",
|
|
657
|
+
),
|
|
658
|
+
connect_args={
|
|
659
|
+
"authenticator": "SNOWFLAKE_JWT",
|
|
660
|
+
"private_key_file": "/path/to/rsa_key.p8",
|
|
661
|
+
},
|
|
662
|
+
)"
|
|
663
|
+
`;
|
|
664
|
+
|
|
566
665
|
exports[`generateDatabaseCode > edge cases > snowflake with all optional fields filled 1`] = `
|
|
567
666
|
"from snowflake.sqlalchemy import URL
|
|
568
667
|
import os
|
|
@@ -572,11 +671,11 @@ _password = os.environ.get("SNOWFLAKE_PASSWORD", "pass")
|
|
|
572
671
|
engine = sqlmodel.create_engine(
|
|
573
672
|
URL(
|
|
574
673
|
account="org-account",
|
|
575
|
-
user="user",
|
|
576
674
|
database="db",
|
|
577
675
|
warehouse="compute_wh",
|
|
578
676
|
schema="public",
|
|
579
677
|
role="accountadmin",
|
|
678
|
+
user="user",
|
|
580
679
|
password=_password,
|
|
581
680
|
)
|
|
582
681
|
)"
|
|
@@ -591,8 +690,8 @@ _password = os.environ.get("SNOWFLAKE_PASSWORD", "pass")
|
|
|
591
690
|
engine = sqlmodel.create_engine(
|
|
592
691
|
URL(
|
|
593
692
|
account="account",
|
|
594
|
-
user="user",
|
|
595
693
|
database="db",
|
|
694
|
+
user="user",
|
|
596
695
|
password=_password,
|
|
597
696
|
)
|
|
598
697
|
)"
|
|
@@ -711,11 +810,11 @@ _password = os.environ.get("SNOWFLAKE_PASSWORD", "pass")
|
|
|
711
810
|
engine = sqlmodel.create_engine(
|
|
712
811
|
URL(
|
|
713
812
|
account="account-with-password123",
|
|
714
|
-
user="user",
|
|
715
813
|
database="db",
|
|
716
814
|
warehouse="warehouse",
|
|
717
815
|
schema="schema",
|
|
718
816
|
role="role",
|
|
817
|
+
user="user",
|
|
719
818
|
password=_password,
|
|
720
819
|
)
|
|
721
820
|
)"
|
|
@@ -730,11 +829,11 @@ _password = os.environ.get("SNOWFLAKE_PASSWORD", "pass")
|
|
|
730
829
|
engine = sqlalchemy.create_engine(
|
|
731
830
|
URL(
|
|
732
831
|
account="account-with-password123",
|
|
733
|
-
user="user",
|
|
734
832
|
database="db",
|
|
735
833
|
warehouse="warehouse",
|
|
736
834
|
schema="schema",
|
|
737
835
|
role="role",
|
|
836
|
+
user="user",
|
|
738
837
|
password=_password,
|
|
739
838
|
)
|
|
740
839
|
)"
|
|
@@ -46,12 +46,72 @@ describe("generateDatabaseCode", () => {
|
|
|
46
46
|
const snowflakeConnection: DatabaseConnection = {
|
|
47
47
|
type: "snowflake",
|
|
48
48
|
account: "account",
|
|
49
|
-
username: "user",
|
|
50
|
-
password: "pass",
|
|
51
49
|
warehouse: "warehouse",
|
|
52
50
|
database: "db",
|
|
53
51
|
schema: "schema",
|
|
54
52
|
role: "role",
|
|
53
|
+
authType: {
|
|
54
|
+
type: "Password",
|
|
55
|
+
username: "user",
|
|
56
|
+
password: "pass",
|
|
57
|
+
enable_mfa: false,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const snowflakeMFAConnection: DatabaseConnection = {
|
|
62
|
+
type: "snowflake",
|
|
63
|
+
account: "account",
|
|
64
|
+
warehouse: "warehouse",
|
|
65
|
+
database: "db",
|
|
66
|
+
schema: "schema",
|
|
67
|
+
role: "role",
|
|
68
|
+
authType: {
|
|
69
|
+
type: "Password",
|
|
70
|
+
username: "user",
|
|
71
|
+
password: "pass",
|
|
72
|
+
enable_mfa: true,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const snowflakeSSOConnection: DatabaseConnection = {
|
|
77
|
+
type: "snowflake",
|
|
78
|
+
account: "account",
|
|
79
|
+
warehouse: "warehouse",
|
|
80
|
+
database: "db",
|
|
81
|
+
schema: "schema",
|
|
82
|
+
role: "role",
|
|
83
|
+
authType: {
|
|
84
|
+
type: "SSO (Browser)",
|
|
85
|
+
username: "user",
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const snowflakeKeyPairConnection: DatabaseConnection = {
|
|
90
|
+
type: "snowflake",
|
|
91
|
+
account: "account",
|
|
92
|
+
warehouse: "warehouse",
|
|
93
|
+
database: "db",
|
|
94
|
+
schema: "schema",
|
|
95
|
+
role: "role",
|
|
96
|
+
authType: {
|
|
97
|
+
type: "Key Pair",
|
|
98
|
+
username: "user",
|
|
99
|
+
private_key_path: "/path/to/rsa_key.p8",
|
|
100
|
+
private_key_passphrase: "my_passphrase",
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const snowflakeOAuthConnection: DatabaseConnection = {
|
|
105
|
+
type: "snowflake",
|
|
106
|
+
account: "account",
|
|
107
|
+
warehouse: "warehouse",
|
|
108
|
+
database: "db",
|
|
109
|
+
schema: "schema",
|
|
110
|
+
role: "role",
|
|
111
|
+
authType: {
|
|
112
|
+
type: "OAuth / PAT",
|
|
113
|
+
token: "my_token",
|
|
114
|
+
},
|
|
55
115
|
};
|
|
56
116
|
|
|
57
117
|
const bigqueryConnection: DatabaseConnection = {
|
|
@@ -240,6 +300,10 @@ describe("generateDatabaseCode", () => {
|
|
|
240
300
|
["duckdb", duckdbConnection, "duckdb"],
|
|
241
301
|
["motherduck", motherduckConnection, "duckdb"],
|
|
242
302
|
["snowflake", snowflakeConnection, "sqlmodel"],
|
|
303
|
+
["snowflake with MFA", snowflakeMFAConnection, "sqlmodel"],
|
|
304
|
+
["snowflake with SSO", snowflakeSSOConnection, "sqlmodel"],
|
|
305
|
+
["snowflake with key pair", snowflakeKeyPairConnection, "sqlmodel"],
|
|
306
|
+
["snowflake with OAuth/PAT", snowflakeOAuthConnection, "sqlmodel"],
|
|
243
307
|
["bigquery", bigqueryConnection, "sqlmodel"],
|
|
244
308
|
["clickhouse", clickhouseConnection, "clickhouse_connect"],
|
|
245
309
|
["chdb", chdbConnection, "chdb"],
|
|
@@ -300,9 +364,13 @@ describe("generateDatabaseCode", () => {
|
|
|
300
364
|
"snowflake with multiple secrets",
|
|
301
365
|
{
|
|
302
366
|
...snowflakeConnection,
|
|
303
|
-
username: prefixSecret("ENV_USER"),
|
|
304
|
-
password: prefixSecret("ENV_PASSWORD"),
|
|
305
367
|
account: prefixSecret("ENV_ACCOUNT"),
|
|
368
|
+
authType: {
|
|
369
|
+
type: "Password" as const,
|
|
370
|
+
username: prefixSecret("ENV_USER"),
|
|
371
|
+
password: prefixSecret("ENV_PASSWORD"),
|
|
372
|
+
enable_mfa: false,
|
|
373
|
+
},
|
|
306
374
|
},
|
|
307
375
|
"sqlmodel",
|
|
308
376
|
],
|
|
@@ -388,12 +456,16 @@ describe("generateDatabaseCode", () => {
|
|
|
388
456
|
{
|
|
389
457
|
type: "snowflake",
|
|
390
458
|
account: "account",
|
|
391
|
-
username: "user",
|
|
392
|
-
password: "pass",
|
|
393
459
|
database: "db",
|
|
394
460
|
warehouse: "",
|
|
395
461
|
schema: "",
|
|
396
462
|
role: "",
|
|
463
|
+
authType: {
|
|
464
|
+
type: "Password" as const,
|
|
465
|
+
username: "user",
|
|
466
|
+
password: "pass",
|
|
467
|
+
enable_mfa: false,
|
|
468
|
+
},
|
|
397
469
|
},
|
|
398
470
|
"sqlmodel",
|
|
399
471
|
],
|
|
@@ -489,12 +561,33 @@ describe("generateDatabaseCode", () => {
|
|
|
489
561
|
{
|
|
490
562
|
type: "snowflake",
|
|
491
563
|
account: "org-account",
|
|
492
|
-
username: "user",
|
|
493
|
-
password: "pass",
|
|
494
564
|
database: "db",
|
|
495
565
|
warehouse: "compute_wh",
|
|
496
566
|
schema: "public",
|
|
497
567
|
role: "accountadmin",
|
|
568
|
+
authType: {
|
|
569
|
+
type: "Password" as const,
|
|
570
|
+
username: "user",
|
|
571
|
+
password: "pass",
|
|
572
|
+
enable_mfa: false,
|
|
573
|
+
},
|
|
574
|
+
},
|
|
575
|
+
"sqlmodel",
|
|
576
|
+
],
|
|
577
|
+
[
|
|
578
|
+
"snowflake key pair without passphrase",
|
|
579
|
+
{
|
|
580
|
+
type: "snowflake",
|
|
581
|
+
account: "account",
|
|
582
|
+
database: "db",
|
|
583
|
+
warehouse: "warehouse",
|
|
584
|
+
schema: "schema",
|
|
585
|
+
role: "role",
|
|
586
|
+
authType: {
|
|
587
|
+
type: "Key Pair" as const,
|
|
588
|
+
username: "user",
|
|
589
|
+
private_key_path: "/path/to/rsa_key.p8",
|
|
590
|
+
},
|
|
498
591
|
},
|
|
499
592
|
"sqlmodel",
|
|
500
593
|
],
|
|
@@ -293,34 +293,124 @@ class SnowflakeGenerator extends CodeGenerator<"snowflake"> {
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
generateConnectionCode(): string {
|
|
296
|
-
const
|
|
297
|
-
this.connection
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
user: this.secrets.print("user", this.connection.username),
|
|
304
|
-
database: this.secrets.print("database", this.connection.database),
|
|
305
|
-
warehouse: this.connection.warehouse
|
|
306
|
-
? this.secrets.print("warehouse", this.connection.warehouse)
|
|
307
|
-
: undefined,
|
|
308
|
-
schema: this.connection.schema
|
|
309
|
-
? this.secrets.print("schema", this.connection.schema)
|
|
310
|
-
: undefined,
|
|
311
|
-
role: this.connection.role
|
|
312
|
-
? this.secrets.print("role", this.connection.role)
|
|
296
|
+
const { authType, account, database, warehouse, schema, role } =
|
|
297
|
+
this.connection;
|
|
298
|
+
const baseParams: Record<string, string | undefined> = {
|
|
299
|
+
account: this.secrets.print("account", account),
|
|
300
|
+
database: this.secrets.print("database", database),
|
|
301
|
+
warehouse: warehouse
|
|
302
|
+
? this.secrets.print("warehouse", warehouse)
|
|
313
303
|
: undefined,
|
|
314
|
-
|
|
304
|
+
schema: schema ? this.secrets.print("schema", schema) : undefined,
|
|
305
|
+
role: role ? this.secrets.print("role", role) : undefined,
|
|
315
306
|
};
|
|
316
307
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
308
|
+
switch (authType.type) {
|
|
309
|
+
case "Password": {
|
|
310
|
+
const password = this.secrets.printPassword(
|
|
311
|
+
authType.password,
|
|
312
|
+
"SNOWFLAKE_PASSWORD",
|
|
313
|
+
false,
|
|
314
|
+
);
|
|
315
|
+
const params = {
|
|
316
|
+
...baseParams,
|
|
317
|
+
user: this.secrets.print("user", authType.username),
|
|
318
|
+
password,
|
|
319
|
+
};
|
|
320
|
+
if (authType.enable_mfa) {
|
|
321
|
+
return dedent(`
|
|
322
|
+
engine = ${this.orm}.create_engine(
|
|
323
|
+
URL(
|
|
324
|
+
${formatUrlParams(params, (inner) => ` ${inner}`)},
|
|
325
|
+
),
|
|
326
|
+
connect_args={"authenticator": "username_password_mfa"},
|
|
327
|
+
)
|
|
328
|
+
`);
|
|
329
|
+
}
|
|
330
|
+
return dedent(`
|
|
331
|
+
engine = ${this.orm}.create_engine(
|
|
332
|
+
URL(
|
|
333
|
+
${formatUrlParams(params, (inner) => ` ${inner}`)},
|
|
334
|
+
)
|
|
335
|
+
)
|
|
336
|
+
`);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
case "SSO (Browser)": {
|
|
340
|
+
const params = {
|
|
341
|
+
...baseParams,
|
|
342
|
+
user: this.secrets.print("user", authType.username),
|
|
343
|
+
authenticator: '"externalbrowser"',
|
|
344
|
+
};
|
|
345
|
+
return dedent(`
|
|
346
|
+
engine = ${this.orm}.create_engine(
|
|
347
|
+
URL(
|
|
348
|
+
${formatUrlParams(params, (inner) => ` ${inner}`)},
|
|
349
|
+
)
|
|
350
|
+
)
|
|
351
|
+
`);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
case "Key Pair": {
|
|
355
|
+
const params = {
|
|
356
|
+
...baseParams,
|
|
357
|
+
user: this.secrets.print("user", authType.username),
|
|
358
|
+
};
|
|
359
|
+
const privateKeyPath = this.secrets.print(
|
|
360
|
+
"private_key_path",
|
|
361
|
+
authType.private_key_path,
|
|
362
|
+
);
|
|
363
|
+
const passphrase = authType.private_key_passphrase
|
|
364
|
+
? this.secrets.printPassword(
|
|
365
|
+
authType.private_key_passphrase,
|
|
366
|
+
"SNOWFLAKE_PRIVATE_KEY_PASSPHRASE",
|
|
367
|
+
false,
|
|
368
|
+
)
|
|
369
|
+
: undefined;
|
|
370
|
+
const connectArgLines = [
|
|
371
|
+
` "authenticator": "SNOWFLAKE_JWT"`,
|
|
372
|
+
` "private_key_file": ${privateKeyPath}`,
|
|
373
|
+
];
|
|
374
|
+
if (passphrase) {
|
|
375
|
+
connectArgLines.push(
|
|
376
|
+
` "private_key_file_pwd": ${passphrase}`,
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
return dedent(`
|
|
380
|
+
engine = ${this.orm}.create_engine(
|
|
381
|
+
URL(
|
|
382
|
+
${formatUrlParams(params, (inner) => ` ${inner}`)},
|
|
383
|
+
),
|
|
384
|
+
connect_args={
|
|
385
|
+
${connectArgLines.join(",\n")},
|
|
386
|
+
},
|
|
387
|
+
)
|
|
388
|
+
`);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
case "OAuth / PAT": {
|
|
392
|
+
const token = this.secrets.printPassword(
|
|
393
|
+
authType.token,
|
|
394
|
+
"SNOWFLAKE_TOKEN",
|
|
395
|
+
false,
|
|
396
|
+
);
|
|
397
|
+
const params = {
|
|
398
|
+
...baseParams,
|
|
399
|
+
authenticator: '"oauth"',
|
|
400
|
+
token,
|
|
401
|
+
};
|
|
402
|
+
return dedent(`
|
|
403
|
+
engine = ${this.orm}.create_engine(
|
|
404
|
+
URL(
|
|
405
|
+
${formatUrlParams(params, (inner) => ` ${inner}`)},
|
|
406
|
+
)
|
|
407
|
+
)
|
|
408
|
+
`);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
default:
|
|
412
|
+
assertNever(authType);
|
|
413
|
+
}
|
|
324
414
|
}
|
|
325
415
|
}
|
|
326
416
|
|