@marimo-team/frontend 0.23.16-dev3 → 0.23.16-dev34
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/assets/{CellStatus-BalYv0pK.js → CellStatus-CmojVYzm.js} +1 -1
- package/dist/assets/{ConnectedDataExplorerComponent-DI7mV-Gw.js → ConnectedDataExplorerComponent-CMaZapRd.js} +1 -1
- package/dist/assets/{ErrorBoundary-C7_5jjWi.js → ErrorBoundary-DzTD8LVq.js} +1 -1
- package/dist/assets/{ImperativeModal-BIavOiUv.js → ImperativeModal-fY-ZfT0b.js} +1 -1
- package/dist/assets/{JsonOutput-CkCD-FgM.js → JsonOutput-BwwRpByA.js} +12 -12
- package/dist/assets/{LazyAnyLanguageCodeMirror-sVm_hz8A.js → LazyAnyLanguageCodeMirror-B2JvSXP-.js} +2 -2
- package/dist/assets/{MarimoErrorOutput-DO2k2fA5.js → MarimoErrorOutput-BWte8vjk.js} +4 -4
- package/dist/assets/{RSPContexts-CgC81f0I.js → RSPContexts-WiCgGm__.js} +1 -1
- package/dist/assets/RenderHTML-DRltV71H.js +1 -0
- package/dist/assets/{RunButton-BKRupqr7.js → RunButton-DIegd2mN.js} +1 -1
- package/dist/assets/{add-cell-with-ai-CEZtaZCK.js → add-cell-with-ai-BBFD-M9V.js} +17 -17
- package/dist/assets/add-connection-dialog-CECJ8507.js +170 -0
- package/dist/assets/{agent-panel-CHB6t7Zy.js → agent-panel-YaS0WXP1.js} +5 -5
- package/dist/assets/ai-model-dropdown-BpVBUZnz.js +5 -0
- package/dist/assets/{alert-dialog-BXegNC0I.js → alert-dialog-Bb8Lz8ko.js} +1 -1
- package/dist/assets/{any-language-editor-DCpZRrpx.js → any-language-editor--tRHs8C_.js} +1 -1
- package/dist/assets/{app-config-button-NrM9ywXA.js → app-config-button-BW-w01aF.js} +1 -1
- package/dist/assets/{button-eIihcbUw.js → button-DDGiD1NW.js} +1 -1
- package/dist/assets/{cache-panel-wllSTlbM.js → cache-panel-DcQUeUpg.js} +1 -1
- package/dist/assets/{capabilities-B09j1Eor.js → capabilities-DoEg0XwL.js} +1 -1
- package/dist/assets/{cell-editor-B5JVq7_q.js → cell-editor-EV-1IccQ.js} +10 -10
- package/dist/assets/cell-link-C5gpAn3R.js +1 -0
- package/dist/assets/cells-6yd8nOAu.js +231 -0
- package/dist/assets/{chat-display-BG08ltQ3.js → chat-display-8BbC5B-D.js} +1 -1
- package/dist/assets/{chat-panel-P2CzCtXJ.js → chat-panel-CMOZp5xW.js} +3 -3
- package/dist/assets/{chat-ui-fAJZAoTD.js → chat-ui-DWhJ2Ozy.js} +1 -1
- package/dist/assets/{column-preview-Dne1dIt0.js → column-preview-DeXESYpM.js} +1 -1
- package/dist/assets/{command-CAJLPEBq.js → command-Dqxie4gq.js} +1 -1
- package/dist/assets/{command-palette-iOCqUIs1.js → command-palette-Dx6AkiPd.js} +1 -1
- package/dist/assets/{common-CD6Mj8n6.js → common-XVELED_O.js} +1 -1
- package/dist/assets/components-BLHpmhXx.js +1 -0
- package/dist/assets/config-B-Q7J_6d.js +1 -0
- package/dist/assets/{config-COUOIPEq.js → config-BJVx3eBW.js} +1 -1
- package/dist/assets/{copy-BtTOqPTS.js → copy-Bxb1_Gtw.js} +1 -1
- package/dist/assets/{copy-icon-C2pG0ZNK.js → copy-icon-neDQUo4Q.js} +1 -1
- package/dist/assets/{createReducer-C7kZ8zEe.js → createReducer-DGx5Af-C.js} +1 -1
- package/dist/assets/{datasource-ySAiC9gr.js → datasource-CTqa8bf-.js} +2 -2
- package/dist/assets/{dates-D-kIKDYA.js → dates-C2LWzsCZ.js} +1 -1
- package/dist/assets/{dependency-graph-panel-BF23EwcD.js → dependency-graph-panel-C4Nzcddp.js} +4 -4
- package/dist/assets/{dialog-D1DEsRZ2.js → dialog-BCVepWLJ.js} +1 -1
- package/dist/assets/{dist-ByVeMWkr.js → dist-BLN8PNJV.js} +1 -1
- package/dist/assets/dist-CiVShZKM.js +2 -0
- package/dist/assets/{documentation-panel-e9Fi9R7e.js → documentation-panel-Bym4G7IS.js} +1 -1
- package/dist/assets/download-HKgqJX4l.js +9 -0
- package/dist/assets/{dropdown-menu-BFZLnWeO.js → dropdown-menu-dHmZR8bI.js} +1 -1
- package/dist/assets/{edit-page-DSEkwJ4O.js → edit-page-Jtp6Qqjl.js} +6 -6
- package/dist/assets/{error-banner-B6eIlxzg.js → error-banner-BSxEOIn2.js} +1 -1
- package/dist/assets/{error-entries-Birw-8VX.js → error-entries-CxyvaxEM.js} +2 -2
- package/dist/assets/{error-panel-DdsUL6b7.js → error-panel-CfSy7uUr.js} +1 -1
- package/dist/assets/{es-1D83cgiu.js → es-gYgfF8y5.js} +1 -1
- package/dist/assets/{esm-BL7jQmzn.js → esm-B30N1GS0.js} +1 -1
- package/dist/assets/{field-BeZbVzXA.js → field-BsxD35VE.js} +1 -1
- package/dist/assets/file-explorer-panel-Dd5Xn2TK.js +26 -0
- package/dist/assets/{file-icons-Cb54mIL8.js → file-icons-CSjJ3JC6.js} +1 -1
- package/dist/assets/{file-name-input-BWFcK1ey.js → file-name-input-CrKtrXMl.js} +1 -1
- package/dist/assets/floating-outline-ByQ8vvif.js +1 -0
- package/dist/assets/focus-CVONl-Dy.js +1 -0
- package/dist/assets/{form-B6BkSCJb.js → form-Ca3yd_Od.js} +1 -1
- package/dist/assets/{formats-ClEFGPy-.js → formats-DzmLpc9A.js} +1 -1
- package/dist/assets/{formatting-B_41gSF5.js → formatting-CDf6w1Kt.js} +1 -1
- package/dist/assets/{fullscreen-dUjPYOmm.js → fullscreen-CTDqNQr6.js} +1 -1
- package/dist/assets/{gallery-page-CWQQAYpa.js → gallery-page-CJ3ms1Hn.js} +1 -1
- package/dist/assets/{glide-data-editor-lMARFWHS.js → glide-data-editor-j2igs9Y_.js} +1 -1
- package/dist/assets/home-page-FpAawj9s.js +4 -0
- package/dist/assets/{html-to-image-CwmX28T9.js → html-to-image-C-4ysbGe.js} +2 -2
- package/dist/assets/index-CiJmYQBT.js +38 -0
- package/dist/assets/index-xs-zSSrX.css +2 -0
- package/dist/assets/{input-CqrUjynb.js → input-JxFwu-3G.js} +1 -1
- package/dist/assets/kiosk-mode-BumOFEtY.js +1 -0
- package/dist/assets/{label-BElwWzf0.js → label-CqjrpwRC.js} +1 -1
- package/dist/assets/{layout-CUlZijwG.js → layout-Dtql_o_T.js} +5 -5
- package/dist/assets/{links-CToBjIIj.js → links-CZr5bjvo.js} +1 -1
- package/dist/assets/{logs-panel-iFV4ZJ9b.js → logs-panel-5u1wUBn1.js} +1 -1
- package/dist/assets/{markdown-renderer-QvXG0CRk.js → markdown-renderer-dABDqZDw.js} +2 -2
- package/dist/assets/{menu-items-DbSLBfXR.js → menu-items-CCi6aOPm.js} +1 -1
- package/dist/assets/{mermaid-Bh0flEIb.js → mermaid-CYN0wOyG.js} +1 -1
- package/dist/assets/name-cell-input-Y4knmEIU.js +1 -0
- package/dist/assets/node-sql-parser-Si4oZ2P-.js +68 -0
- package/dist/assets/{numbers-CeeaFKqu.js → numbers-rmawRqQP.js} +1 -1
- package/dist/assets/outline-panel-CQ_KWLip.js +1 -0
- package/dist/assets/{packages-panel-BzQF60rG.js → packages-panel-Ijt7d51P.js} +1 -1
- package/dist/assets/pair-with-agent-modal-BCRSACei.js +4 -0
- package/dist/assets/panels-DfU1Oikj.js +4 -0
- package/dist/assets/{popover-DrHQ3KEt.js → popover-Bcz1Zikb.js} +1 -1
- package/dist/assets/process-output-Dd11YI04.js +1 -0
- package/dist/assets/{radio-group-CLBjGkt5.js → radio-group-22eWJ9fv.js} +1 -1
- package/dist/assets/readonly-code-display-BjK-TEri.js +1 -0
- package/dist/assets/{readonly-python-code-CW_G5e4E.js → readonly-python-code-n_TrLmsR.js} +1 -1
- package/dist/assets/{renderShortcut-BZLr8D7H.js → renderShortcut-Bl8_FVn8.js} +1 -1
- package/dist/assets/{reveal-component-BLMTmd8T.js → reveal-component-CCLTV1q6.js} +60 -60
- package/dist/assets/{run-page-B6pgDYEJ.js → run-page-DbezK7Qs.js} +1 -1
- package/dist/assets/{runs-D51Xwrsk.js → runs-DBTXqJHS.js} +1 -1
- package/dist/assets/scratchpad-panel-C2wAEv5n.js +1 -0
- package/dist/assets/{scroll-to-bottom-button-Cgr10kaJ.js → scroll-to-bottom-button-C8yfT4wq.js} +1 -1
- package/dist/assets/{secrets-panel-Cc5KDBk6.js → secrets-panel-6J6wcuVR.js} +1 -1
- package/dist/assets/{select-B5TFNjmU.js → select-BP75_5jJ.js} +1 -1
- package/dist/assets/{session-CEFnN9Cq.js → session-BmukRjSi.js} +1 -1
- package/dist/assets/{session-panel-Y0Oon0sD.js → session-panel-BZGNcZmp.js} +1 -1
- package/dist/assets/{share-CYpcX4N4.js → share-852X_cqy.js} +1 -1
- package/dist/assets/{skeleton-D3QPxqWC.js → skeleton-BzlKcq21.js} +1 -1
- package/dist/assets/slides-DkEgzTJB.css +1 -0
- package/dist/assets/{snippets-panel-CXpGflMO.js → snippets-panel-DNaNtkR0.js} +1 -1
- package/dist/assets/{spec-CzqcmYQk.js → spec-C7opZZRp.js} +1 -1
- package/dist/assets/{state-BvdK8eiw.js → state-D10U2MwA.js} +1 -1
- package/dist/assets/{state-WBgc7MiA.js → state-DDag0B_B.js} +1 -1
- package/dist/assets/state-DFPAfLw7.js +3 -0
- package/dist/assets/{state-DBzEQtWz.js → state-jCdh8Dcx.js} +1 -1
- package/dist/assets/{strings-Djnbwmfl.js → strings--BknHX9C.js} +1 -1
- package/dist/assets/{swiper-component-DInvCxhI.js → swiper-component-g8EXE911.js} +1 -1
- package/dist/assets/switch-OVajJBPR.js +1 -0
- package/dist/assets/{terminal-D3IQBBYo.js → terminal-217O8hlZ.js} +1 -1
- package/dist/assets/{textarea-CpFfEUet.js → textarea-DuEtSOCl.js} +1 -1
- package/dist/assets/{tooltip-CFX4fYHU.js → tooltip-4bZlU7jl.js} +1 -1
- package/dist/assets/{tooltip-HLb6RxVp.js → tooltip-B7U4xkIN.js} +1 -1
- package/dist/assets/{tracing-panel-BU-o_LCd.js → tracing-panel-rVAa3En0.js} +2 -2
- package/dist/assets/{tracing-CKn3gWHw.js → tracing-ttUd3J7U.js} +1 -1
- package/dist/assets/{tree-actions-CsC2XmGo.js → tree-actions-UCr1tMHw.js} +1 -1
- package/dist/assets/{useBoolean-D89u30n-.js → useBoolean-CFj86iac.js} +1 -1
- package/dist/assets/useCellActionButton-CJknR0XY.js +1 -0
- package/dist/assets/{useDeleteCell-EPH4kcG7.js → useDeleteCell-PrgejW8A.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-CZnK7N2L.js → useDependencyPanelTab-5jc-_-hy.js} +1 -1
- package/dist/assets/useEventListener-C0195JsF.js +1 -0
- package/dist/assets/{useHotkey-DIuRH8Wu.js → useHotkey-DLZvrRZT.js} +1 -1
- package/dist/assets/{useIframeCapabilities-Ccb4fvKc.js → useIframeCapabilities-j6fR_dBA.js} +1 -1
- package/dist/assets/{useInstallPackage-BRbUAUFn.js → useInstallPackage-WiYBwhUO.js} +1 -1
- package/dist/assets/{useInterval-CC0vKpWm.js → useInterval-CWBTUy5W.js} +1 -1
- package/dist/assets/useNotebookActions-4vw_NiRs.js +12 -0
- package/dist/assets/useRunCells-DHsd7HGL.js +1 -0
- package/dist/assets/{useSplitCell-9Qz93yPZ.js → useSplitCell-MZpER0Bh.js} +1 -1
- package/dist/assets/{useTheme-KXqAyDPC.js → useTheme-Bxv9B31g.js} +1 -1
- package/dist/assets/{utils-Z80SV4_d.js → utils-BWBBpCkT.js} +1 -1
- package/dist/assets/{vega-component-Cie3ag_T.js → vega-component-Db8KjZJG.js} +1 -1
- package/dist/assets/{write-secret-modal-DEEn7sZV.js → write-secret-modal-3-v-dHVj.js} +1 -1
- package/dist/index.html +68 -68
- package/package.json +2 -2
- package/src/__mocks__/requests.ts +45 -4
- package/src/components/data-table/__tests__/__snapshots__/chart-spec-model.test.ts.snap +174 -21
- package/src/components/data-table/__tests__/chart-spec-model.test.ts +102 -1
- package/src/components/data-table/column-summary/chart-spec-model.tsx +163 -103
- package/src/components/data-table/column-summary/legacy-chart-spec.ts +15 -7
- package/src/components/data-table/column-summary/utils.ts +26 -7
- package/src/components/data-table/types.ts +1 -1
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +99 -18
- package/src/components/editor/actions/__tests__/pdf-export.test.ts +0 -4
- package/src/components/editor/actions/pair-with-agent-commands.ts +21 -10
- package/src/components/editor/actions/pair-with-agent-modal.tsx +2 -2
- package/src/components/editor/actions/pdf-export.ts +1 -4
- package/src/components/editor/actions/useNotebookActions.tsx +7 -13
- package/src/components/editor/connections/storage/__tests__/__snapshots__/as-code.test.ts.snap +50 -0
- package/src/components/editor/connections/storage/__tests__/as-code.test.ts +87 -8
- package/src/components/editor/connections/storage/as-code.ts +40 -21
- package/src/components/editor/connections/storage/schemas.ts +83 -42
- package/src/components/editor/file-tree/__tests__/file-render-mode.test.ts +27 -0
- package/src/components/editor/file-tree/__tests__/file-viewer.test.tsx +150 -0
- package/src/components/editor/file-tree/file-preview-metadata.tsx +51 -0
- package/src/components/editor/file-tree/file-render-mode.ts +32 -0
- package/src/components/editor/file-tree/file-viewer.tsx +76 -50
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -1
- package/src/components/slides/__tests__/cell-output-block.test.tsx +40 -0
- package/src/components/slides/__tests__/slide-cell-view.test.tsx +33 -0
- package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +198 -0
- package/src/components/slides/reveal-component.tsx +25 -19
- package/src/components/slides/slide-cell-view.tsx +1 -1
- package/src/components/slides/slide-scroll-hint.tsx +161 -0
- package/src/components/slides/slides.css +4 -2
- package/src/components/static-html/share-modal.tsx +1 -1
- package/src/components/ui/input.tsx +1 -1
- package/src/core/codemirror/find-replace/__tests__/navigate.test.ts +42 -30
- package/src/core/codemirror/find-replace/navigate.ts +2 -0
- package/src/core/codemirror/go-to-definition/__tests__/commands.test.ts +24 -3
- package/src/core/codemirror/go-to-definition/commands.ts +3 -0
- package/src/core/codemirror/keymaps/__tests__/keymaps.test.ts +31 -2
- package/src/core/codemirror/keymaps/keymaps.ts +12 -0
- package/src/core/codemirror/language/__tests__/sql.test.ts +443 -61
- package/src/core/codemirror/language/languages/sql/completion-store.ts +5 -1
- package/src/core/codemirror/language/languages/sql/sql.ts +210 -3
- package/src/core/codemirror/utils.ts +28 -0
- package/src/core/hotkeys/hotkeys.ts +0 -2
- package/src/core/islands/__tests__/bridge.test.ts +107 -0
- package/src/core/islands/bridge.ts +16 -0
- package/src/core/mode.ts +10 -0
- package/src/core/network/__tests__/api.test.ts +42 -0
- package/src/core/network/__tests__/connection.test.ts +45 -0
- package/src/core/network/__tests__/requests-lazy.test.ts +32 -1
- package/src/core/network/__tests__/requests-network.test.ts +21 -0
- package/src/core/network/api.ts +27 -0
- package/src/core/network/connection.ts +15 -0
- package/src/core/network/requests-lazy.ts +1 -0
- package/src/core/network/requests-network.ts +14 -8
- package/src/core/network/requests-static.ts +1 -0
- package/src/core/network/requests-toasting.tsx +1 -0
- package/src/core/network/types.ts +25 -7
- package/src/core/static/download-html.ts +5 -14
- package/src/core/wasm/bridge.ts +4 -2
- package/src/core/wasm/worker/types.ts +5 -2
- package/src/plugins/impl/FormPlugin.tsx +1 -1
- package/src/plugins/impl/__tests__/FormPlugin.test.tsx +162 -0
- package/src/utils/__tests__/download.test.tsx +24 -1
- package/src/utils/download.ts +11 -6
- package/dist/assets/RenderHTML-BCvU9dYz.js +0 -1
- package/dist/assets/add-connection-dialog-B-jCRNTN.js +0 -170
- package/dist/assets/ai-model-dropdown-DXgLphFa.js +0 -5
- package/dist/assets/cell-link-DqBkyAFe.js +0 -1
- package/dist/assets/cells-Cf7bHHq3.js +0 -229
- package/dist/assets/components-BH6gDVv6.js +0 -1
- package/dist/assets/config-BbOTTCYY.js +0 -1
- package/dist/assets/dist-BCMBu0rO.js +0 -2
- package/dist/assets/download-BomYt3nl.js +0 -9
- package/dist/assets/file-explorer-panel-BfXM2BOd.js +0 -26
- package/dist/assets/floating-outline-wz-WSRgP.js +0 -1
- package/dist/assets/focus-DiEyfiAG.js +0 -1
- package/dist/assets/home-page-DJ4jJsZj.js +0 -4
- package/dist/assets/index-A71LAt6h.css +0 -2
- package/dist/assets/index-Dbc5mg7a.js +0 -38
- package/dist/assets/kiosk-mode-ABm3oYgq.js +0 -1
- package/dist/assets/name-cell-input-C6cukQ9k.js +0 -1
- package/dist/assets/node-sql-parser-BWgUjcfV.js +0 -68
- package/dist/assets/outline-panel-BPlg9_CE.js +0 -1
- package/dist/assets/pair-with-agent-modal-CKOYwOYw.js +0 -4
- package/dist/assets/panels-Dj45fW-v.js +0 -4
- package/dist/assets/process-output-BEhIGfkO.js +0 -1
- package/dist/assets/readonly-code-display-D63oRtBP.js +0 -1
- package/dist/assets/scratchpad-panel-B0mEqBNk.js +0 -1
- package/dist/assets/slides-MCbMDtlY.css +0 -1
- package/dist/assets/state-BZQc7xxL.js +0 -3
- package/dist/assets/switch-CvweaCXq.js +0 -1
- package/dist/assets/useCellActionButton-CRfIEVB5.js +0 -1
- package/dist/assets/useEventListener-B_w3A283.js +0 -1
- package/dist/assets/useNotebookActions-DTXAoukG.js +0 -12
- package/dist/assets/useRunCells-CSSF_mJ0.js +0 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
4
4
|
import {
|
|
5
5
|
type ConnectionInfo,
|
|
6
|
+
getFileFromURL,
|
|
6
7
|
getMarimoCommand,
|
|
7
8
|
getRawPrompt,
|
|
8
9
|
getTerminalCommand,
|
|
@@ -12,7 +13,11 @@ import {
|
|
|
12
13
|
|
|
13
14
|
const CONNECTION: ConnectionInfo = {
|
|
14
15
|
url: "http://localhost:8000",
|
|
15
|
-
|
|
16
|
+
file: "notebooks/example.py",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const CONNECTION_WITHOUT_FILE: ConnectionInfo = {
|
|
20
|
+
url: "http://localhost:8000",
|
|
16
21
|
};
|
|
17
22
|
|
|
18
23
|
describe("shellQuote", () => {
|
|
@@ -22,7 +27,7 @@ describe("shellQuote", () => {
|
|
|
22
27
|
|
|
23
28
|
it("leaves shell-safe values untouched", () => {
|
|
24
29
|
expect(shellQuote("http://localhost:8000")).toBe("http://localhost:8000");
|
|
25
|
-
expect(shellQuote("
|
|
30
|
+
expect(shellQuote("notebooks/example.py")).toBe("notebooks/example.py");
|
|
26
31
|
});
|
|
27
32
|
|
|
28
33
|
it("quotes values with shell metacharacters", () => {
|
|
@@ -37,6 +42,49 @@ describe("shellQuote", () => {
|
|
|
37
42
|
// Closes the quote, emits a literal ' via "'", then reopens: '"'"'
|
|
38
43
|
expect(shellQuote("a'b")).toBe(`'a'"'"'b'`);
|
|
39
44
|
});
|
|
45
|
+
|
|
46
|
+
it.each([
|
|
47
|
+
["/tmp/my notebook.py", "'/tmp/my notebook.py'"],
|
|
48
|
+
[
|
|
49
|
+
String.raw`C:\Users\Jane Doe\notebook.py`,
|
|
50
|
+
String.raw`'C:\Users\Jane Doe\notebook.py'`,
|
|
51
|
+
],
|
|
52
|
+
[
|
|
53
|
+
String.raw`\\server\share\my notebook.py`,
|
|
54
|
+
String.raw`'\\server\share\my notebook.py'`,
|
|
55
|
+
],
|
|
56
|
+
])("quotes non-portable path %s as one argument", (path, expected) => {
|
|
57
|
+
expect(shellQuote(path)).toBe(expected);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe("getFileFromURL", () => {
|
|
62
|
+
it("returns undefined when the file query parameter is absent or empty", () => {
|
|
63
|
+
expect(getFileFromURL("http://localhost:8000")).toBeUndefined();
|
|
64
|
+
expect(getFileFromURL("http://localhost:8000?file=")).toBeUndefined();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("decodes spaces and literal plus signs", () => {
|
|
68
|
+
expect(
|
|
69
|
+
getFileFromURL(
|
|
70
|
+
"http://localhost:8000?file=relative%2Fmy%20notebook%2Bdata.py",
|
|
71
|
+
),
|
|
72
|
+
).toBe("relative/my notebook+data.py");
|
|
73
|
+
expect(getFileFromURL("http://localhost:8000?file=my+notebook.py")).toBe(
|
|
74
|
+
"my notebook.py",
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("preserves decoded Windows paths and uses the first duplicate value", () => {
|
|
79
|
+
expect(
|
|
80
|
+
getFileFromURL(
|
|
81
|
+
"http://localhost:8000?file=C%3A%5CUsers%5CJane%20Doe%5Cnotebook.py",
|
|
82
|
+
),
|
|
83
|
+
).toBe(String.raw`C:\Users\Jane Doe\notebook.py`);
|
|
84
|
+
expect(
|
|
85
|
+
getFileFromURL("http://localhost:8000?file=first.py&file=second.py"),
|
|
86
|
+
).toBe("first.py");
|
|
87
|
+
});
|
|
40
88
|
});
|
|
41
89
|
|
|
42
90
|
describe("getMarimoCommand", () => {
|
|
@@ -56,30 +104,56 @@ describe("getMarimoCommand", () => {
|
|
|
56
104
|
});
|
|
57
105
|
|
|
58
106
|
describe("getTerminalCommand", () => {
|
|
59
|
-
it("includes the url and
|
|
107
|
+
it("includes the url and file for each agent", () => {
|
|
60
108
|
expect(getTerminalCommand("claude", CONNECTION, false)).toBe(
|
|
61
|
-
`claude "$(uv run marimo pair prompt --url http://localhost:8000 --
|
|
109
|
+
`claude "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --claude)"`,
|
|
62
110
|
);
|
|
63
111
|
expect(getTerminalCommand("codex", CONNECTION, false)).toBe(
|
|
64
|
-
`codex "$(uv run marimo pair prompt --url http://localhost:8000 --
|
|
112
|
+
`codex "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --codex)"`,
|
|
65
113
|
);
|
|
66
114
|
expect(getTerminalCommand("opencode", CONNECTION, false)).toBe(
|
|
67
|
-
`opencode --prompt "$(uv run marimo pair prompt --url http://localhost:8000 --
|
|
115
|
+
`opencode --prompt "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --opencode)"`,
|
|
68
116
|
);
|
|
69
117
|
});
|
|
70
118
|
|
|
71
|
-
it("
|
|
72
|
-
const command = getTerminalCommand(
|
|
73
|
-
|
|
119
|
+
it("omits the file flag when the page URL has no file", () => {
|
|
120
|
+
const command = getTerminalCommand(
|
|
121
|
+
"claude",
|
|
122
|
+
CONNECTION_WITHOUT_FILE,
|
|
123
|
+
false,
|
|
124
|
+
);
|
|
125
|
+
expect(command).not.toContain("--file");
|
|
126
|
+
expect(command).not.toContain("--session");
|
|
74
127
|
});
|
|
75
128
|
|
|
76
129
|
it("shell-escapes a url containing metacharacters", () => {
|
|
77
130
|
const command = getTerminalCommand(
|
|
78
131
|
"claude",
|
|
79
|
-
{ url: "http://host:8000?
|
|
132
|
+
{ url: "http://host:8000?auth=a&b", file: "notebook.py" },
|
|
80
133
|
false,
|
|
81
134
|
);
|
|
82
|
-
expect(command).toContain("--url 'http://host:8000?
|
|
135
|
+
expect(command).toContain("--url 'http://host:8000?auth=a&b'");
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it.each([
|
|
139
|
+
["relative/my notebook.py", "--file 'relative/my notebook.py'"],
|
|
140
|
+
["/tmp/my notebook.py", "--file '/tmp/my notebook.py'"],
|
|
141
|
+
[
|
|
142
|
+
String.raw`C:\Users\Jane Doe\notebook.py`,
|
|
143
|
+
String.raw`--file 'C:\Users\Jane Doe\notebook.py'`,
|
|
144
|
+
],
|
|
145
|
+
[
|
|
146
|
+
String.raw`\\server\share\my notebook.py`,
|
|
147
|
+
String.raw`--file '\\server\share\my notebook.py'`,
|
|
148
|
+
],
|
|
149
|
+
["notebooks/it's.py", `--file 'notebooks/it'"'"'s.py'`],
|
|
150
|
+
])("shell-escapes file path %s", (file, expected) => {
|
|
151
|
+
const command = getTerminalCommand(
|
|
152
|
+
"claude",
|
|
153
|
+
{ url: CONNECTION.url, file },
|
|
154
|
+
false,
|
|
155
|
+
);
|
|
156
|
+
expect(command).toContain(expected);
|
|
83
157
|
});
|
|
84
158
|
|
|
85
159
|
it("adds --with-token before the agent flag when requested", () => {
|
|
@@ -95,26 +169,33 @@ describe("getTerminalCommand", () => {
|
|
|
95
169
|
});
|
|
96
170
|
|
|
97
171
|
describe("getRawPrompt", () => {
|
|
98
|
-
it("references the
|
|
172
|
+
it("references the file-scoped execute-code command", () => {
|
|
99
173
|
const prompt = getRawPrompt(CONNECTION, null);
|
|
100
174
|
expect(prompt).toContain(
|
|
101
|
-
"execute-code.sh --url http://localhost:8000 --
|
|
175
|
+
"execute-code.sh --url http://localhost:8000 --file notebooks/example.py",
|
|
102
176
|
);
|
|
103
177
|
expect(prompt).toContain(
|
|
104
|
-
"Connect to the notebook at: http://localhost:8000 (
|
|
178
|
+
"Connect to the notebook at: http://localhost:8000 (file notebooks/example.py)",
|
|
105
179
|
);
|
|
106
180
|
});
|
|
107
181
|
|
|
182
|
+
it("omits file targeting when the page URL has no file", () => {
|
|
183
|
+
const prompt = getRawPrompt(CONNECTION_WITHOUT_FILE, null);
|
|
184
|
+
expect(prompt).toContain("execute-code.sh --url http://localhost:8000");
|
|
185
|
+
expect(prompt).not.toContain("--file");
|
|
186
|
+
expect(prompt).not.toContain("--session");
|
|
187
|
+
});
|
|
188
|
+
|
|
108
189
|
it("omits the token hint when there is no token", () => {
|
|
109
190
|
const prompt = getRawPrompt(CONNECTION, null);
|
|
110
191
|
expect(prompt).not.toContain("--token");
|
|
111
192
|
expect(prompt).not.toContain("auth token");
|
|
112
193
|
});
|
|
113
194
|
|
|
114
|
-
it("includes a
|
|
195
|
+
it("includes a file-scoped token hint when a token is present", () => {
|
|
115
196
|
const prompt = getRawPrompt(CONNECTION, "secret-token");
|
|
116
197
|
expect(prompt).toContain(
|
|
117
|
-
"execute-code.sh --url http://localhost:8000 --
|
|
198
|
+
"execute-code.sh --url http://localhost:8000 --file notebooks/example.py --token secret-token",
|
|
118
199
|
);
|
|
119
200
|
});
|
|
120
201
|
|
|
@@ -128,9 +209,9 @@ describe("getRawPrompt", () => {
|
|
|
128
209
|
expect(prompt).toMatchInlineSnapshot(`
|
|
129
210
|
"Use the /marimo-pair skill to pair-program on a running marimo notebook.
|
|
130
211
|
|
|
131
|
-
Connect to the notebook at: http://localhost:8000 (
|
|
212
|
+
Connect to the notebook at: http://localhost:8000 (file notebooks/example.py)
|
|
132
213
|
|
|
133
|
-
Use \`execute-code.sh --url http://localhost:8000 --
|
|
214
|
+
Use \`execute-code.sh --url http://localhost:8000 --file notebooks/example.py\` from the marimo-pair skill to execute code in the notebook.
|
|
134
215
|
|
|
135
216
|
Once you are connected, send a fun toast (mo.status.toast(...)) to the user inside marimo letting them know you're ready to pair."
|
|
136
217
|
`);
|
|
@@ -8,13 +8,11 @@ describe("runServerSidePDFDownload", () => {
|
|
|
8
8
|
const downloadPDF = vi.fn().mockResolvedValue(undefined);
|
|
9
9
|
|
|
10
10
|
await runServerSidePDFDownload({
|
|
11
|
-
filename: "slides.py",
|
|
12
11
|
preset: "document",
|
|
13
12
|
downloadPDF,
|
|
14
13
|
});
|
|
15
14
|
|
|
16
15
|
expect(downloadPDF).toHaveBeenCalledWith({
|
|
17
|
-
filename: "slides.py",
|
|
18
16
|
webpdf: false,
|
|
19
17
|
preset: "document",
|
|
20
18
|
includeInputs: true,
|
|
@@ -26,13 +24,11 @@ describe("runServerSidePDFDownload", () => {
|
|
|
26
24
|
const downloadPDF = vi.fn().mockResolvedValue(undefined);
|
|
27
25
|
|
|
28
26
|
await runServerSidePDFDownload({
|
|
29
|
-
filename: "slides.py",
|
|
30
27
|
preset: "slides",
|
|
31
28
|
downloadPDF,
|
|
32
29
|
});
|
|
33
30
|
|
|
34
31
|
expect(downloadPDF).toHaveBeenCalledWith({
|
|
35
|
-
filename: "slides.py",
|
|
36
32
|
webpdf: false,
|
|
37
33
|
preset: "slides",
|
|
38
34
|
includeInputs: true,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import { assertNever } from "@/utils/assertNever";
|
|
4
|
+
import { KnownQueryParams } from "@/core/constants";
|
|
4
5
|
|
|
5
6
|
export type AgentTab = "claude" | "codex" | "opencode" | "prompt";
|
|
6
7
|
|
|
@@ -43,14 +44,21 @@ export function shellQuote(value: string): string {
|
|
|
43
44
|
return `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
/** Return the server file key from a page URL, preserving its decoded value. */
|
|
48
|
+
export function getFileFromURL(href: string): string | undefined {
|
|
49
|
+
const file = new URL(href).searchParams.get(KnownQueryParams.filePath);
|
|
50
|
+
return file === null || file === "" ? undefined : file;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getFileFlag(file: string | undefined): string {
|
|
54
|
+
return file ? ` --file ${shellQuote(file)}` : "";
|
|
55
|
+
}
|
|
56
|
+
|
|
46
57
|
/** Identifies the specific running notebook to pair on. */
|
|
47
58
|
export interface ConnectionInfo {
|
|
48
59
|
url: string;
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
* guessing when multiple sessions are open on the same server.
|
|
52
|
-
*/
|
|
53
|
-
sessionId: string;
|
|
60
|
+
/** The server's file key, when the page URL identifies a notebook. */
|
|
61
|
+
file?: string;
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
/**
|
|
@@ -59,11 +67,12 @@ export interface ConnectionInfo {
|
|
|
59
67
|
*/
|
|
60
68
|
export function getTerminalCommand(
|
|
61
69
|
agent: Exclude<AgentTab, "prompt">,
|
|
62
|
-
{ url,
|
|
70
|
+
{ url, file }: ConnectionInfo,
|
|
63
71
|
withToken: boolean,
|
|
64
72
|
): string {
|
|
73
|
+
const fileFlag = getFileFlag(file);
|
|
65
74
|
const tokenFlag = withToken ? " --with-token" : "";
|
|
66
|
-
const base = `${getMarimoCommand()} pair prompt --url ${shellQuote(url)}
|
|
75
|
+
const base = `${getMarimoCommand()} pair prompt --url ${shellQuote(url)}${fileFlag}${tokenFlag}`;
|
|
67
76
|
switch (agent) {
|
|
68
77
|
case "claude":
|
|
69
78
|
return `claude "$(${base} --claude)"`;
|
|
@@ -82,17 +91,19 @@ export function getTerminalCommand(
|
|
|
82
91
|
* an agent behaves the same as the terminal commands.
|
|
83
92
|
*/
|
|
84
93
|
export function getRawPrompt(
|
|
85
|
-
{ url,
|
|
94
|
+
{ url, file }: ConnectionInfo,
|
|
86
95
|
token: string | null,
|
|
87
96
|
): string {
|
|
88
|
-
const
|
|
97
|
+
const fileFlag = getFileFlag(file);
|
|
98
|
+
const fileHint = file ? ` (file ${file})` : "";
|
|
99
|
+
const executeCmd = `execute-code.sh --url ${shellQuote(url)}${fileFlag}`;
|
|
89
100
|
const tokenHint = token
|
|
90
101
|
? `\n\nUse this auth token when calling \`execute-code.sh\`: \`${executeCmd} --token ${shellQuote(token)}\`.`
|
|
91
102
|
: "";
|
|
92
103
|
return [
|
|
93
104
|
"Use the /marimo-pair skill to pair-program on a running marimo notebook.",
|
|
94
105
|
"",
|
|
95
|
-
`Connect to the notebook at: ${url}
|
|
106
|
+
`Connect to the notebook at: ${url}${fileHint}`,
|
|
96
107
|
"",
|
|
97
108
|
`Use \`${executeCmd}\` from the marimo-pair skill to execute code in the notebook.${tokenHint}`,
|
|
98
109
|
"",
|
|
@@ -16,12 +16,12 @@ import { Events } from "@/utils/events";
|
|
|
16
16
|
import { Tooltip } from "@/components/ui/tooltip";
|
|
17
17
|
import { asRemoteURL, useRuntimeManager } from "@/core/runtime/config";
|
|
18
18
|
import { API } from "@/core/network/api";
|
|
19
|
-
import { getSessionId } from "@/core/kernel/session";
|
|
20
19
|
import {
|
|
21
20
|
AGENT_LABELS,
|
|
22
21
|
AGENT_TABS,
|
|
23
22
|
type AgentTab,
|
|
24
23
|
type ConnectionInfo,
|
|
24
|
+
getFileFromURL,
|
|
25
25
|
getRawPrompt,
|
|
26
26
|
getTerminalCommand,
|
|
27
27
|
maskToken,
|
|
@@ -53,7 +53,7 @@ export const PairWithAgentModal: React.FC<{
|
|
|
53
53
|
const hasToken = Boolean(authToken);
|
|
54
54
|
const connection: ConnectionInfo = {
|
|
55
55
|
url: runtimeManager.httpURL.toString(),
|
|
56
|
-
|
|
56
|
+
file: getFileFromURL(window.location.href),
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
return (
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
type Preset = "document" | "slides";
|
|
4
4
|
type DownloadPDF = (opts: {
|
|
5
|
-
filename: string;
|
|
6
5
|
webpdf: boolean;
|
|
7
6
|
preset: Preset;
|
|
8
7
|
includeInputs: boolean;
|
|
@@ -10,14 +9,12 @@ type DownloadPDF = (opts: {
|
|
|
10
9
|
}) => Promise<void>;
|
|
11
10
|
|
|
12
11
|
export async function runServerSidePDFDownload(opts: {
|
|
13
|
-
filename: string;
|
|
14
12
|
preset: Preset;
|
|
15
13
|
downloadPDF: DownloadPDF;
|
|
16
14
|
}): Promise<void> {
|
|
17
|
-
const {
|
|
15
|
+
const { preset, downloadPDF } = opts;
|
|
18
16
|
|
|
19
17
|
await downloadPDF({
|
|
20
|
-
filename,
|
|
21
18
|
webpdf: false,
|
|
22
19
|
preset,
|
|
23
20
|
includeInputs: true,
|
|
@@ -83,6 +83,7 @@ import {
|
|
|
83
83
|
ADD_PRINTING_CLASS,
|
|
84
84
|
downloadAsPDF,
|
|
85
85
|
downloadBlob,
|
|
86
|
+
downloadExportedFile,
|
|
86
87
|
downloadHTMLAsImage,
|
|
87
88
|
withLoadingToast,
|
|
88
89
|
} from "@/utils/download";
|
|
@@ -197,7 +198,6 @@ export function useNotebookActions() {
|
|
|
197
198
|
updateCellOutputs,
|
|
198
199
|
});
|
|
199
200
|
await runServerSidePDFDownload({
|
|
200
|
-
filename,
|
|
201
201
|
preset,
|
|
202
202
|
downloadPDF: downloadAsPDF,
|
|
203
203
|
});
|
|
@@ -231,11 +231,8 @@ export function useNotebookActions() {
|
|
|
231
231
|
takeScreenshots: () => takeScreenshots({ progress }),
|
|
232
232
|
updateCellOutputs,
|
|
233
233
|
});
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
new Blob([ipynb], { type: "application/x-ipynb+json" }),
|
|
237
|
-
Filenames.toIPYNB(document.title),
|
|
238
|
-
);
|
|
234
|
+
const exportedFile = await exportAsIPYNB({ download: false });
|
|
235
|
+
downloadExportedFile(exportedFile);
|
|
239
236
|
};
|
|
240
237
|
|
|
241
238
|
await withLoadingToast("Downloading IPYNB...", runDownload);
|
|
@@ -255,7 +252,7 @@ export function useNotebookActions() {
|
|
|
255
252
|
toastNotebookMustBeNamed();
|
|
256
253
|
return;
|
|
257
254
|
}
|
|
258
|
-
await downloadAsHTML({
|
|
255
|
+
await downloadAsHTML({ includeCode: true });
|
|
259
256
|
},
|
|
260
257
|
},
|
|
261
258
|
{
|
|
@@ -266,7 +263,7 @@ export function useNotebookActions() {
|
|
|
266
263
|
toastNotebookMustBeNamed();
|
|
267
264
|
return;
|
|
268
265
|
}
|
|
269
|
-
await downloadAsHTML({
|
|
266
|
+
await downloadAsHTML({ includeCode: false });
|
|
270
267
|
},
|
|
271
268
|
},
|
|
272
269
|
{
|
|
@@ -275,11 +272,8 @@ export function useNotebookActions() {
|
|
|
275
272
|
),
|
|
276
273
|
label: "Download as Markdown",
|
|
277
274
|
handle: async () => {
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
new Blob([md], { type: "text/plain" }),
|
|
281
|
-
Filenames.toMarkdown(document.title),
|
|
282
|
-
);
|
|
275
|
+
const exportedFile = await exportAsMarkdown({ download: false });
|
|
276
|
+
downloadExportedFile(exportedFile);
|
|
283
277
|
},
|
|
284
278
|
},
|
|
285
279
|
{
|
package/src/components/editor/connections/storage/__tests__/__snapshots__/as-code.test.ts.snap
CHANGED
|
@@ -51,6 +51,21 @@ store = S3Store("operator-bucket",
|
|
|
51
51
|
)"
|
|
52
52
|
`;
|
|
53
53
|
|
|
54
|
+
exports[`generateStorageCode > CoreWeave > with container credentials 1`] = `
|
|
55
|
+
"from obstore.store import S3Store
|
|
56
|
+
import os
|
|
57
|
+
|
|
58
|
+
_container_credentials_full_uri = os.environ.get("AWS_CONTAINER_CREDENTIALS_FULL_URI")
|
|
59
|
+
_container_authorization_token_file = os.environ.get("AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE")
|
|
60
|
+
store = S3Store("operator-bucket",
|
|
61
|
+
region="US-EAST-04A",
|
|
62
|
+
container_credentials_full_uri=_container_credentials_full_uri,
|
|
63
|
+
container_authorization_token_file=_container_authorization_token_file,
|
|
64
|
+
endpoint="https://operator-bucket.cwobject.com",
|
|
65
|
+
virtual_hosted_style_request=True,
|
|
66
|
+
)"
|
|
67
|
+
`;
|
|
68
|
+
|
|
54
69
|
exports[`generateStorageCode > CoreWeave > with secrets 1`] = `
|
|
55
70
|
"from obstore.store import S3Store
|
|
56
71
|
import os
|
|
@@ -119,6 +134,29 @@ exports[`generateStorageCode > S3 > minimal connection (bucket only) 1`] = `
|
|
|
119
134
|
store = S3Store("my-bucket",)"
|
|
120
135
|
`;
|
|
121
136
|
|
|
137
|
+
exports[`generateStorageCode > S3 > with container credentials 1`] = `
|
|
138
|
+
"from obstore.store import S3Store
|
|
139
|
+
|
|
140
|
+
store = S3Store("my-bucket",
|
|
141
|
+
region="us-east-1",
|
|
142
|
+
container_credentials_full_uri="http://169.254.170.23/v1/credentials",
|
|
143
|
+
container_authorization_token_file="/var/run/secrets/token",
|
|
144
|
+
)"
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
exports[`generateStorageCode > S3 > with container credentials from secrets 1`] = `
|
|
148
|
+
"from obstore.store import S3Store
|
|
149
|
+
import os
|
|
150
|
+
|
|
151
|
+
_container_credentials_full_uri = os.environ.get("AWS_CONTAINER_CREDENTIALS_FULL_URI")
|
|
152
|
+
_container_authorization_token_file = os.environ.get("AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE")
|
|
153
|
+
store = S3Store("my-bucket",
|
|
154
|
+
region="us-east-1",
|
|
155
|
+
container_credentials_full_uri=_container_credentials_full_uri,
|
|
156
|
+
container_authorization_token_file=_container_authorization_token_file,
|
|
157
|
+
)"
|
|
158
|
+
`;
|
|
159
|
+
|
|
122
160
|
exports[`generateStorageCode > S3 > with custom endpoint 1`] = `
|
|
123
161
|
"from obstore.store import S3Store
|
|
124
162
|
|
|
@@ -130,6 +168,18 @@ store = S3Store("my-bucket",
|
|
|
130
168
|
)"
|
|
131
169
|
`;
|
|
132
170
|
|
|
171
|
+
exports[`generateStorageCode > S3 > with plain-http endpoint 1`] = `
|
|
172
|
+
"from obstore.store import S3Store
|
|
173
|
+
|
|
174
|
+
store = S3Store("my-bucket",
|
|
175
|
+
region="us-east-1",
|
|
176
|
+
access_key_id="AKIAIOSFODNN7EXAMPLE",
|
|
177
|
+
secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
178
|
+
endpoint_url="http://cwlota.com",
|
|
179
|
+
allow_http=True,
|
|
180
|
+
)"
|
|
181
|
+
`;
|
|
182
|
+
|
|
133
183
|
exports[`generateStorageCode > S3 > with secrets 1`] = `
|
|
134
184
|
"from obstore.store import S3Store
|
|
135
185
|
import os
|
|
@@ -9,9 +9,13 @@ describe("generateStorageCode", () => {
|
|
|
9
9
|
type: "s3",
|
|
10
10
|
bucket: "my-bucket",
|
|
11
11
|
region: "us-east-1",
|
|
12
|
-
access_key_id: "AKIAIOSFODNN7EXAMPLE",
|
|
13
|
-
secret_access_key: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
14
12
|
endpoint_url: undefined,
|
|
13
|
+
allow_http: false,
|
|
14
|
+
auth: {
|
|
15
|
+
type: "Access keys",
|
|
16
|
+
access_key_id: "AKIAIOSFODNN7EXAMPLE",
|
|
17
|
+
secret_access_key: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
18
|
+
},
|
|
15
19
|
};
|
|
16
20
|
|
|
17
21
|
const baseGCS: StorageConnection = {
|
|
@@ -31,8 +35,11 @@ describe("generateStorageCode", () => {
|
|
|
31
35
|
type: "coreweave",
|
|
32
36
|
bucket: "operator-bucket",
|
|
33
37
|
region: "US-EAST-04A",
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
auth: {
|
|
39
|
+
type: "Access keys",
|
|
40
|
+
access_key_id: "AKIAIOSFODNN7EXAMPLE",
|
|
41
|
+
secret_access_key: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
42
|
+
},
|
|
36
43
|
};
|
|
37
44
|
|
|
38
45
|
const baseGDrive: StorageConnection = {
|
|
@@ -52,6 +59,8 @@ describe("generateStorageCode", () => {
|
|
|
52
59
|
const conn: StorageConnection = {
|
|
53
60
|
type: "s3",
|
|
54
61
|
bucket: "my-bucket",
|
|
62
|
+
allow_http: false,
|
|
63
|
+
auth: { type: "Access keys" },
|
|
55
64
|
};
|
|
56
65
|
expect(
|
|
57
66
|
generateStorageCode(conn, { library: "obstore" }),
|
|
@@ -68,13 +77,61 @@ describe("generateStorageCode", () => {
|
|
|
68
77
|
).toMatchSnapshot();
|
|
69
78
|
});
|
|
70
79
|
|
|
80
|
+
it("with plain-http endpoint", () => {
|
|
81
|
+
const conn: StorageConnection = {
|
|
82
|
+
...baseS3,
|
|
83
|
+
endpoint_url: "http://cwlota.com",
|
|
84
|
+
allow_http: true,
|
|
85
|
+
};
|
|
86
|
+
expect(
|
|
87
|
+
generateStorageCode(conn, { library: "obstore" }),
|
|
88
|
+
).toMatchSnapshot();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("with container credentials", () => {
|
|
92
|
+
const conn: StorageConnection = {
|
|
93
|
+
...baseS3,
|
|
94
|
+
auth: {
|
|
95
|
+
type: "Container credentials",
|
|
96
|
+
container_credentials_full_uri:
|
|
97
|
+
"http://169.254.170.23/v1/credentials",
|
|
98
|
+
container_authorization_token_file: "/var/run/secrets/token",
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
expect(
|
|
102
|
+
generateStorageCode(conn, { library: "obstore" }),
|
|
103
|
+
).toMatchSnapshot();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("with container credentials from secrets", () => {
|
|
107
|
+
const conn: StorageConnection = {
|
|
108
|
+
...baseS3,
|
|
109
|
+
auth: {
|
|
110
|
+
type: "Container credentials",
|
|
111
|
+
container_credentials_full_uri: prefixSecret(
|
|
112
|
+
"AWS_CONTAINER_CREDENTIALS_FULL_URI",
|
|
113
|
+
),
|
|
114
|
+
container_authorization_token_file: prefixSecret(
|
|
115
|
+
"AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE",
|
|
116
|
+
),
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
expect(
|
|
120
|
+
generateStorageCode(conn, { library: "obstore" }),
|
|
121
|
+
).toMatchSnapshot();
|
|
122
|
+
});
|
|
123
|
+
|
|
71
124
|
it("with secrets", () => {
|
|
72
125
|
const conn: StorageConnection = {
|
|
73
126
|
type: "s3",
|
|
74
127
|
bucket: "my-bucket",
|
|
75
128
|
region: "us-east-1",
|
|
76
|
-
|
|
77
|
-
|
|
129
|
+
allow_http: false,
|
|
130
|
+
auth: {
|
|
131
|
+
type: "Access keys",
|
|
132
|
+
access_key_id: prefixSecret("AWS_ACCESS_KEY_ID"),
|
|
133
|
+
secret_access_key: prefixSecret("AWS_SECRET_ACCESS_KEY"),
|
|
134
|
+
},
|
|
78
135
|
};
|
|
79
136
|
expect(
|
|
80
137
|
generateStorageCode(conn, { library: "obstore" }),
|
|
@@ -143,6 +200,25 @@ describe("generateStorageCode", () => {
|
|
|
143
200
|
type: "coreweave",
|
|
144
201
|
bucket: "operator-bucket",
|
|
145
202
|
region: "US-EAST-04A",
|
|
203
|
+
auth: { type: "Access keys" },
|
|
204
|
+
};
|
|
205
|
+
expect(
|
|
206
|
+
generateStorageCode(conn, { library: "obstore" }),
|
|
207
|
+
).toMatchSnapshot();
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it("with container credentials", () => {
|
|
211
|
+
const conn: StorageConnection = {
|
|
212
|
+
...baseCoreWeave,
|
|
213
|
+
auth: {
|
|
214
|
+
type: "Container credentials",
|
|
215
|
+
container_credentials_full_uri: prefixSecret(
|
|
216
|
+
"AWS_CONTAINER_CREDENTIALS_FULL_URI",
|
|
217
|
+
),
|
|
218
|
+
container_authorization_token_file: prefixSecret(
|
|
219
|
+
"AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE",
|
|
220
|
+
),
|
|
221
|
+
},
|
|
146
222
|
};
|
|
147
223
|
expect(
|
|
148
224
|
generateStorageCode(conn, { library: "obstore" }),
|
|
@@ -154,8 +230,11 @@ describe("generateStorageCode", () => {
|
|
|
154
230
|
type: "coreweave",
|
|
155
231
|
bucket: "operator-bucket",
|
|
156
232
|
region: "US-EAST-04A",
|
|
157
|
-
|
|
158
|
-
|
|
233
|
+
auth: {
|
|
234
|
+
type: "Access keys",
|
|
235
|
+
access_key_id: prefixSecret("COREWEAVE_OBJECT_STORAGE_KEY"),
|
|
236
|
+
secret_access_key: prefixSecret("COREWEAVE_OBJECT_STORAGE_SECRET"),
|
|
237
|
+
},
|
|
159
238
|
};
|
|
160
239
|
expect(
|
|
161
240
|
generateStorageCode(conn, { library: "obstore" }),
|