collabmd 0.1.33 → 0.1.35
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/client/assets/{CodeMirrorEditor-UCMRAMCV-Bg0dawOb.js → CodeMirrorEditor-UCMRAMCV-CvLFeHXu.js} +1 -1
- package/dist/client/assets/_baseFor-Bfo4esZ5.js +1 -0
- package/dist/client/assets/arc-tRoMuWFi.js +1 -0
- package/dist/client/assets/architecture-YZFGNWBL-CtU43_5T.js +1 -0
- package/dist/client/assets/{architectureDiagram-2XIMDMQ5-kYbOThe4.js → architectureDiagram-Q4EWVU46-CVdcOotN.js} +4 -4
- package/dist/client/assets/blockDiagram-DXYQGD6D-B_gNUKQ4.js +132 -0
- package/dist/client/assets/c4Diagram-AHTNJAMY-BSDwfduG.js +10 -0
- package/dist/client/assets/channel-BDb1g_mJ.js +1 -0
- package/dist/client/assets/chunk-2KRD3SAO-C6u8y11R.js +1 -0
- package/dist/client/assets/chunk-336JU56O-Ch9X5KoM.js +2 -0
- package/dist/client/assets/{chunk-HHEYEP7N-DlevL8bq.js → chunk-426QAEUC-CwJ7loGf.js} +1 -1
- package/dist/client/assets/chunk-4TB4RGXK-BEsauZP5.js +206 -0
- package/dist/client/assets/chunk-5FUZZQ4R-6x8SlhH9.js +62 -0
- package/dist/client/assets/chunk-5PVQY5BW-R5SE6dhE.js +2 -0
- package/dist/client/assets/chunk-67CJDMHE-CjXw5hFa.js +1 -0
- package/dist/client/assets/chunk-7N4EOEYR-DNHyuswJ.js +1 -0
- package/dist/client/assets/chunk-AA7GKIK3-DayE4IF_.js +1 -0
- package/dist/client/assets/chunk-BSJP7CBP-CexlYBxB.js +1 -0
- package/dist/client/assets/chunk-CIAEETIT-CkDJ4DYI.js +1 -0
- package/dist/client/assets/{chunk-KX2RTZJC-BTiOJb7N.js → chunk-EDXVE4YY-BVR_nF3y.js} +1 -1
- package/dist/client/assets/chunk-ENJZ2VHE-CFVWytAB.js +10 -0
- package/dist/client/assets/chunk-FOC6F5B3-DzCiCLGs.js +1 -0
- package/dist/client/assets/chunk-ICPOFSXX-B9LPHgU7.js +122 -0
- package/dist/client/assets/chunk-K5T4RW27-kmGSebVE.js +94 -0
- package/dist/client/assets/chunk-KGLVRYIC-DVjPRsaR.js +1 -0
- package/dist/client/assets/chunk-LIHQZDEY-DKFj13sC.js +1 -0
- package/dist/client/assets/chunk-NU2UP6EN-UVL-wkIc.js +35 -0
- package/dist/client/assets/chunk-ORNJ4GCN-D0uTAC-5.js +1 -0
- package/dist/client/assets/{chunk-NQ4KR5QH-CMJKI6Oj.js → chunk-OYMX7WX6-nWiNHNyD.js} +25 -14
- package/dist/client/assets/{chunk-PU5JKC2W-D_6N6t8f.js → chunk-U2HBQHQK-Bue4Ufzn.js} +6 -6
- package/dist/client/assets/{chunk-PQ6SQG4A-D1AbThjy.js → chunk-X2U36JSP-CRE6lp7n.js} +1 -1
- package/dist/client/assets/{chunk-XPW4576I-DJr4_4Yy.js → chunk-XPW4576I-BL5M-tF8.js} +1 -1
- package/dist/client/assets/{chunk-JSJVCQXG-DPQ9cPJt.js → chunk-YZCP3GAM-D7Z5wUWA.js} +1 -1
- package/dist/client/assets/chunk-ZZ45TVLE-CBbl1Qec.js +1 -0
- package/dist/client/assets/classDiagram-6PBFFD2Q-MIbgV5UL.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-Bb70vg2O.js +1 -0
- package/dist/client/assets/clike-BFTLRaGS.js +1 -0
- package/dist/client/assets/clone-D6JWrlxJ.js +1 -0
- package/dist/client/assets/{coffeescript-B_7eyHAa.js → coffeescript-B7GZajzV.js} +1 -1
- package/dist/client/assets/{cose-bilkent-S5V4N54A-DASO2hrk.js → cose-bilkent-S5V4N54A-xxgR5OJ-.js} +1 -1
- package/dist/client/assets/{cypher-DE6I2lIA.js → cypher-DEGl2llJ.js} +1 -1
- package/dist/client/assets/cytoscape.esm-B3PRdePO.js +321 -0
- package/dist/client/assets/{d-BNkKjn0o.js → d-BspB0dox.js} +1 -1
- package/dist/client/assets/dagre-KV5264BT-C2K9mFg1.js +4 -0
- package/dist/client/assets/dagre-VaFYRFbD.js +1 -0
- package/dist/client/assets/diagram-5BDNPKRD-DE0M0jaM.js +10 -0
- package/dist/client/assets/diagram-G4DWMVQ6-BfaRuSTT.js +24 -0
- package/dist/client/assets/diagram-MMDJMWI5-91Bly_hN.js +43 -0
- package/dist/client/assets/diagram-TYMM5635-fBkLwZGN.js +24 -0
- package/dist/client/assets/{dist-BzpfHRaE.js → dist-74GtnE06.js} +1 -1
- package/dist/client/assets/dist-B3lARV_e.js +1 -0
- package/dist/client/assets/{dist-O1z0Ayg0.js → dist-BCvzlTeb.js} +1 -1
- package/dist/client/assets/{dist-DsL7sqZR.js → dist-BMlUxhOz.js} +1 -1
- package/dist/client/assets/dist-BSED50tI.js +13 -0
- package/dist/client/assets/{dist-B-02vKOA.js → dist-Bkn7JaJv.js} +1 -1
- package/dist/client/assets/dist-Bq8Z0WUT.js +1 -0
- package/dist/client/assets/{dist-E_jPb93e.js → dist-Bzb9nPam.js} +1 -1
- package/dist/client/assets/{dist-CL-jjdvG.js → dist-C0e9kfNh.js} +1 -1
- package/dist/client/assets/dist-C8wdW7W4.js +1 -0
- package/dist/client/assets/dist-CDUQ5ELn.js +1 -0
- package/dist/client/assets/dist-CHSg_nUM.js +1 -0
- package/dist/client/assets/dist-CSAH9iuE.js +6 -0
- package/dist/client/assets/{dist-CxfohGIV.js → dist-CSNMpi-w.js} +1 -1
- package/dist/client/assets/dist-CZPTvk_g2.js +1 -0
- package/dist/client/assets/{dist-k47-Io7D.js → dist-Co8HE14w.js} +1 -1
- package/dist/client/assets/{dist-Bc2ND6i3.js → dist-CqU98NzX.js} +1 -1
- package/dist/client/assets/{dist-BzbYwa8m.js → dist-D0dQAc9b.js} +1 -1
- package/dist/client/assets/{dist-Dyt7n5Ui.js → dist-D1-dK0Dk.js} +1 -1
- package/dist/client/assets/{dist-B4uQVR_X.js → dist-DAKGEzm0.js} +1 -1
- package/dist/client/assets/dist-DBzteOlY.js +1 -0
- package/dist/client/assets/{dist-CjII8VDS.js → dist-DSRCADL9.js} +1 -1
- package/dist/client/assets/{dist-lDhnP-K1.js → dist-DdR2aYqj.js} +1 -1
- package/dist/client/assets/{dist-DUvaQ-Bj.js → dist-DidT3Jay.js} +1 -1
- package/dist/client/assets/dist-Doo91MTa.js +1 -0
- package/dist/client/assets/{dist-BLAlZer_.js → dist-Dwy75xI6.js} +1 -1
- package/dist/client/assets/{dist-3uAMa5w5.js → dist-FC9LftvP.js} +1 -1
- package/dist/client/assets/{dist-CGV1S_as.js → dist-PPAeaw4t.js} +1 -1
- package/dist/client/assets/{dist-BtnXjRx0.js → dist-VPEWg0Ob.js} +1 -1
- package/dist/client/assets/{dist-CXpKYW9s.js → dist-cQSK4Xor.js} +1 -1
- package/dist/client/assets/{dist-rMhng5DK.js → dist-r5I9Jgww.js} +1 -1
- package/dist/client/assets/drawio-editor-CWLEpwps.js +9 -0
- package/dist/client/assets/{drawioEditor-D6clB5OH.js → drawioEditor-5rJhxjA4.js} +2 -2
- package/dist/client/assets/{ecl-M7Iek4lq.js → ecl-D9rhJ9-u.js} +1 -1
- package/dist/client/assets/{editor-session-Dzy_85Wp.js → editor-session-CLOuvy37.js} +3 -3
- package/dist/client/assets/{erDiagram-INFDFZHY-DlIf-fb7.js → erDiagram-SMLLAGMA-DUQcqEQ1.js} +33 -18
- package/dist/client/assets/excalidraw-editor-ukEKPqGJ.js +9 -0
- package/dist/client/assets/{excalidraw-mermaid-stub-Bwe-bKcT.js → excalidraw-mermaid-stub-Df0Q2qkW.js} +1 -1
- package/dist/client/assets/excalidraw-scene-CDK3oDnm.js +176 -0
- package/dist/client/assets/excalidrawEditor-BJ8QLmWc.js +2 -0
- package/dist/client/assets/{export-page-PeexH2QK.js → export-page-D2rCmrUH.js} +2 -2
- package/dist/client/assets/exportDocument-Dunnjgii.js +2 -0
- package/dist/client/assets/{fcl-BWKK0S4-.js → fcl-CUXJFJn1.js} +1 -1
- package/dist/client/assets/flatten-CX_XvnUf.js +1 -0
- package/dist/client/assets/flowDiagram-DWJPFMVM-B_A5JyId.js +162 -0
- package/dist/client/assets/ganttDiagram-T4ZO3ILL-HM3CD7bk.js +292 -0
- package/dist/client/assets/gitGraph-7Q5UKJZL-BrBlB49D.js +1 -0
- package/dist/client/assets/gitGraphDiagram-UUTBAWPF-Dw7twZDm.js +106 -0
- package/dist/client/assets/graphlib-DDD4Vdye.js +1 -0
- package/dist/client/assets/{groovy-BEKazBrO.js → groovy-Di--Vb9Z.js} +1 -1
- package/dist/client/assets/{haxe-BY9d_5nB.js → haxe-CcPA1xnA.js} +1 -1
- package/dist/client/assets/image-XLNPCCAD-BFNybKza.js +1 -0
- package/dist/client/assets/{image-blob-reduce.esm-DriR2zT9.js → image-blob-reduce.esm-DiuPkovC.js} +1 -1
- package/dist/client/assets/{index-Czg_KL-i.js → index-BbziNMqE.js} +2 -2
- package/dist/client/assets/info-OMHHGYJF-BcmgcSx1.js +1 -0
- package/dist/client/assets/{infoDiagram-LFFYTUFH-DFTI0nfs.js → infoDiagram-42DDH7IO-DX-d3DMp.js} +1 -1
- package/dist/client/assets/isEmpty-BKDbo1FH.js +1 -0
- package/dist/client/assets/ishikawaDiagram-UXIWVN3A-BHmsxpMs.js +70 -0
- package/dist/client/assets/{javascript-CdiVhQeA.js → javascript-gTK9fxz6.js} +1 -1
- package/dist/client/assets/javascript-qUBHINSy.js +1 -0
- package/dist/client/assets/{journeyDiagram-4ABVD52K-DDur6iHm.js → journeyDiagram-VCZTEJTY-jxDSjgE1.js} +2 -2
- package/dist/client/assets/{jsx-runtime-C2p7wRmT.js → jsx-runtime-B_8UNt-W.js} +1 -1
- package/dist/client/assets/{kanban-definition-K7BYSVSG-dA6NPLsg.js → kanban-definition-6JOO6SKY-od3qY1mE.js} +2 -2
- package/dist/client/assets/line-CZsGUM4H.js +1 -0
- package/dist/client/assets/{lua-kutgyRGY.js → lua-Cg0FqIlO.js} +1 -1
- package/dist/client/assets/main-CN0kbtGk.js +1369 -0
- package/dist/client/assets/mermaid-parser.core-DtIbxv6L.js +4 -0
- package/dist/client/assets/mermaid-runtime-vVJfjscE.js +11 -0
- package/dist/client/assets/{mindmap-definition-YRQLILUH-DjQcsPoe.js → mindmap-definition-QFDTVHPH-C9qrdAqo.js} +39 -11
- package/dist/client/assets/packet-4T2RLAQJ-DYYSvRuJ.js +1 -0
- package/dist/client/assets/pica-BEurQXMu.js +2 -0
- package/dist/client/assets/pie-ZZUOXDRM-cG65Mc64.js +1 -0
- package/dist/client/assets/pieDiagram-DEJITSTG-BHXxj7wl.js +30 -0
- package/dist/client/assets/{preview-render-compiler-BjLlHmiQ.js → preview-render-compiler-BHeDhYho.js} +2 -2
- package/dist/client/assets/preview-render-compiler-D3QM1Ryz.js +1 -0
- package/dist/client/assets/{preview-render-profile-CR4dJZrp.js → preview-render-profile-BF6os3x9.js} +5 -5
- package/dist/client/assets/{preview-render-worker-B4dH2yxj.js → preview-render-worker-C4AFtMIr.js} +6 -6
- package/dist/client/assets/{pug-DkUcLYWt.js → pug-lkTEco3G.js} +1 -1
- package/dist/client/assets/{python-CZtTmYkS.js → python-BUyhM0Ew.js} +1 -1
- package/dist/client/assets/{q-I27iQntV.js → q-Dls1OX0D.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-337W2JSQ-CYKgdx7K.js → quadrantDiagram-34T5L4WZ-CWW7LORF.js} +1 -1
- package/dist/client/assets/{quick-switcher-controller-DcyllYpm.js → quick-switcher-controller-B1erSgJ1.js} +1 -1
- package/dist/client/assets/{r-DN_EydfL.js → r-DeZ8Mdev.js} +1 -1
- package/dist/client/assets/radar-PYXPWWZC-Bmpup_xw.js +1 -0
- package/dist/client/assets/reduce-C6FuFJbE.js +1 -0
- package/dist/client/assets/requirementDiagram-MS252O5E-CTljNdQH.js +84 -0
- package/dist/client/assets/{room-yJaBAoEU.js → room-DI7DXGeS.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-WA2Y5GQK-CfHe3D6R.js → sankeyDiagram-XADWPNL6-CCfFkC74.js} +1 -1
- package/dist/client/assets/sequenceDiagram-FGHM5R23-BD9vj6WG.js +157 -0
- package/dist/client/assets/{sparql-BOvq0dv7.js → sparql-vm8qNO8J.js} +1 -1
- package/dist/client/assets/sql-GL7dVWcd.js +1 -0
- package/dist/client/assets/stateDiagram-FHFEXIEX-CpiX3KPd.js +1 -0
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-D_5ufPqT.js +1 -0
- package/dist/client/assets/{swift-BCxe4-cw.js → swift-CKcKnWv9.js} +1 -1
- package/dist/client/assets/timeline-definition-GMOUNBTQ-BafRAkSF.js +120 -0
- package/dist/client/assets/treeView-SZITEDCU-NbjhK5cw.js +1 -0
- package/dist/client/assets/treemap-W4RFUUIX-DJzRbb-x.js +1 -0
- package/dist/client/assets/{turtle-GBz_E4RG.js → turtle-BkP3ExOG.js} +1 -1
- package/dist/client/assets/{vault-api-client-p7h7cXKM.js → vault-api-client-DSx3mWkH.js} +1 -1
- package/dist/client/assets/{vault-utils-5Xr0MXCb.js → vault-utils-CRpy8MQz.js} +1 -1
- package/dist/client/assets/vennDiagram-DHZGUBPP-DSngq_Zj.js +34 -0
- package/dist/client/assets/{verilog-C4wTycyo.js → verilog-DSARZZPc.js} +1 -1
- package/dist/client/assets/{vhdl-Bwndeg44.js → vhdl-CnYyYTpa.js} +1 -1
- package/dist/client/assets/wardley-RL74JXVD-DTNoH_BY.js +1 -0
- package/dist/client/assets/wardleyDiagram-NUSXRM2D-CAEd2kJG.js +20 -0
- package/dist/client/assets/{xychartDiagram-JWTSCODW-C3vA70iJ.js → xychartDiagram-5P7HB3ND-BScQpnru.js} +6 -6
- package/dist/client/assets/{yjs-provider-reset-guard-CtERLBID.js → yjs-provider-reset-guard-_Q3mj6tP.js} +1 -1
- package/dist/client/drawio-editor.html +1 -1
- package/dist/client/excalidraw-editor.html +1 -1
- package/dist/client/export-document.html +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +12 -11
- package/src/client/application/app-shell/git-feature.js +44 -36
- package/src/client/application/app-shell/ui-feature-shell.js +87 -63
- package/src/client/application/quick-switcher-loader.js +39 -0
- package/src/client/bootstrap/collabmd-app-shell.js +16 -20
- package/src/client/domain/keyboard-shortcuts.js +8 -0
- package/src/client/drawio-editor.js +13 -0
- package/src/client/excalidraw-editor.js +13 -0
- package/src/client/infrastructure/excalidraw-room-client.js +1 -1
- package/src/client/infrastructure/workspace-sync-client.js +26 -3
- package/src/client/presentation/comment-ui/comment-ui-card.js +83 -3
- package/src/client/presentation/comment-ui/comment-ui-state.js +25 -2
- package/src/client/presentation/drawio-embed-controller.js +18 -0
- package/src/client/presentation/excalidraw-embed-controller.js +11 -1
- package/src/client/presentation/file-history-view-controller.js +9 -1
- package/src/client/presentation/git-panel-controller.js +103 -91
- package/src/server/domain/backlink-index.js +74 -94
- package/src/server/domain/bases/base-index-snapshot-store.js +46 -62
- package/src/server/domain/markdown-reference-extractor.js +233 -0
- package/src/server/infrastructure/http/create-request-handler.js +63 -28
- package/src/server/infrastructure/http/create-vault-api-command-handler.js +275 -256
- package/src/server/infrastructure/http/create-vault-api-query-handler.js +255 -233
- package/src/server/infrastructure/persistence/vault-file-store.js +107 -16
- package/src/server/infrastructure/workspace/file-system-sync-service.js +37 -11
- package/dist/client/assets/_basePickBy-Dv0sK1l7.js +0 -1
- package/dist/client/assets/_baseUniq-DKYX57ji.js +0 -1
- package/dist/client/assets/arc-DrfYGhWk.js +0 -1
- package/dist/client/assets/architecture-PBZL5I3N-DiglIZi9.js +0 -1
- package/dist/client/assets/blockDiagram-WCTKOSBZ-GIgTqnhk.js +0 -132
- package/dist/client/assets/c4Diagram-IC4MRINW-CkHO1i_L.js +0 -10
- package/dist/client/assets/channel-CgsU9TSN.js +0 -1
- package/dist/client/assets/chunk-7E7YKBS2-TdU92i9i.js +0 -1
- package/dist/client/assets/chunk-7R4GIKGN-mqd2GwMg.js +0 -80
- package/dist/client/assets/chunk-C72U2L5F-CJKQWBtz.js +0 -1
- package/dist/client/assets/chunk-EGIJ26TM-C4nq20om.js +0 -1
- package/dist/client/assets/chunk-GEFDOKGD-Bs7FmFox.js +0 -2
- package/dist/client/assets/chunk-GLR3WWYH-qQe2O5VQ.js +0 -2
- package/dist/client/assets/chunk-KYZI473N-CTSCuqRb.js +0 -53
- package/dist/client/assets/chunk-L3YUKLVL-CJZMBtKF.js +0 -1
- package/dist/client/assets/chunk-MX3YWQON-DQpSwRf6.js +0 -1
- package/dist/client/assets/chunk-NU2UP6EN-DlUENSHU.js +0 -35
- package/dist/client/assets/chunk-O4XLMI2P-CcVxZh41.js +0 -7
- package/dist/client/assets/chunk-OZEHJAEY-DjBZbgu0.js +0 -1
- package/dist/client/assets/chunk-R5LLSJPH-CkjKXM73.js +0 -1
- package/dist/client/assets/chunk-WL4C6EOR-axcuKSup.js +0 -189
- package/dist/client/assets/chunk-XIRO2GV7-4wqVHjs_.js +0 -1
- package/dist/client/assets/chunk-XZSTWKYB-C8Y_hIKZ.js +0 -94
- package/dist/client/assets/chunk-YBOYWFTD-CKg4ymFF.js +0 -1
- package/dist/client/assets/classDiagram-VBA2DB6C-BHZpvOxK.js +0 -1
- package/dist/client/assets/classDiagram-v2-RAHNMMFH-DA7HMUUs.js +0 -1
- package/dist/client/assets/clike-1_ZsiVV8.js +0 -1
- package/dist/client/assets/clone-Dgi8Z4IL.js +0 -1
- package/dist/client/assets/cytoscape.esm-Czjc507F.js +0 -321
- package/dist/client/assets/dagre-CfB3Fw33.js +0 -1
- package/dist/client/assets/dagre-KLK3FWXG-CC7tq2Ky.js +0 -4
- package/dist/client/assets/diagram-E7M64L7V-CMt7BN5M.js +0 -24
- package/dist/client/assets/diagram-IFDJBPK2-BFMBUGpd.js +0 -43
- package/dist/client/assets/diagram-P4PSJMXO-CviA1xXr.js +0 -24
- package/dist/client/assets/dist-3bQB_we3.js +0 -1
- package/dist/client/assets/dist-8Igu3Ee_2.js +0 -1
- package/dist/client/assets/dist-BU8uusJX.js +0 -1
- package/dist/client/assets/dist-BVB8rn7o.js +0 -1
- package/dist/client/assets/dist-D5QOYy7y.js +0 -6
- package/dist/client/assets/dist-DIi0uqLJ.js +0 -1
- package/dist/client/assets/dist-DJ16N7ol.js +0 -1
- package/dist/client/assets/dist-DWJL3_bF.js +0 -13
- package/dist/client/assets/dist-OQE68wIX.js +0 -1
- package/dist/client/assets/dist-x7PIEmJu.js +0 -1
- package/dist/client/assets/drawio-editor-BMTwP5mD.js +0 -9
- package/dist/client/assets/excalidraw-editor-CAP9F8CB.js +0 -9
- package/dist/client/assets/excalidraw-scene-BF_bT1OL.js +0 -176
- package/dist/client/assets/excalidrawEditor-DD4AvzYP.js +0 -2
- package/dist/client/assets/exportDocument-Zfwq1XVx.js +0 -2
- package/dist/client/assets/flowDiagram-PKNHOUZH-C_t-mkwb.js +0 -162
- package/dist/client/assets/ganttDiagram-A5KZAMGK-BtK9Tb--.js +0 -292
- package/dist/client/assets/gitGraph-HDMCJU4V-CT7YfbD3.js +0 -1
- package/dist/client/assets/gitGraphDiagram-K3NZZRJ6-DULDLGiJ.js +0 -65
- package/dist/client/assets/graphlib-BgRST-Qg.js +0 -1
- package/dist/client/assets/image-XLNPCCAD-CFiKwiWK.js +0 -1
- package/dist/client/assets/info-3K5VOQVL-DUpNyDC-.js +0 -1
- package/dist/client/assets/isArrayLikeObject-BId_dPHM.js +0 -1
- package/dist/client/assets/isEmpty-CVvRj8fj.js +0 -1
- package/dist/client/assets/ishikawaDiagram-PHBUUO56-DpBuDpC6.js +0 -70
- package/dist/client/assets/javascript-UJe68_xi.js +0 -1
- package/dist/client/assets/line-B2GMovaI.js +0 -1
- package/dist/client/assets/main-DeowJOSp.js +0 -1368
- package/dist/client/assets/math-B-LMBwub.js +0 -1
- package/dist/client/assets/mermaid-parser.core-B1ogGcR8.js +0 -4
- package/dist/client/assets/mermaid-runtime-Bn8A6DGx.js +0 -11
- package/dist/client/assets/packet-RMMSAZCW-DEwNbIrA.js +0 -1
- package/dist/client/assets/pica-C1TdTz-C.js +0 -2
- package/dist/client/assets/pie-UPGHQEXC-D5M_lSjo.js +0 -1
- package/dist/client/assets/pieDiagram-SKSYHLDU-jhHouFpk.js +0 -30
- package/dist/client/assets/preview-render-compiler-Duy_3IcP.js +0 -1
- package/dist/client/assets/radar-KQ55EAFF-AU1qh3Bw.js +0 -1
- package/dist/client/assets/requirementDiagram-Z7DCOOCP-D9SHxoW7.js +0 -73
- package/dist/client/assets/sequenceDiagram-2WXFIKYE-CZsMMqAJ.js +0 -145
- package/dist/client/assets/sql-DDFeQNTK.js +0 -1
- package/dist/client/assets/stateDiagram-RAJIS63D-CoNZjTYV.js +0 -1
- package/dist/client/assets/stateDiagram-v2-FVOUBMTO-1zOw6NmQ.js +0 -1
- package/dist/client/assets/timeline-definition-YZTLITO2-DSe2mrG8.js +0 -61
- package/dist/client/assets/treemap-KZPCXAKY-C9UI2fwP.js +0 -1
- package/dist/client/assets/vennDiagram-LZ73GAT5-xSzaIpy1.js +0 -34
- /package/dist/client/assets/{chunk-55IACEB6-CpncB3ru.js → chunk-55IACEB6-DLqevMSj.js} +0 -0
- /package/dist/client/assets/{chunk-QZHKN3VN-CgLPFSk5.js → chunk-QZHKN3VN-BnOS2iQW.js} +0 -0
- /package/dist/client/assets/{drawio-room-DEivFyNV.js → drawio-room-1i6Nn0_Z.js} +0 -0
- /package/dist/client/assets/{excalidraw-mermaid-stub-BZPU4ZhU.js → excalidraw-mermaid-stub-DzxtBcQW.js} +0 -0
- /package/dist/client/assets/{file-kind-DBptLlF_.js → file-kind-DmKq2MvD.js} +0 -0
- /package/dist/client/assets/{preview-diagram-utils-COt-IYMD.js → preview-diagram-utils-D8VypUft.js} +0 -0
- /package/dist/client/assets/{rough.esm-DE_lJ5Ge.js → rough.esm-BU2knLt9.js} +0 -0
- /package/dist/client/assets/{runtime-config-CqhchMC4.js → runtime-config-DWTejofP.js} +0 -0
|
@@ -96,291 +96,310 @@ function getDirectoryDeleteStatusCode(message = '') {
|
|
|
96
96
|
return String(message).includes('Directory is not empty') ? 409 : 400;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
})
|
|
104
|
-
return async function handleVaultApiCommand(req, res, requestUrl) {
|
|
105
|
-
if (requestUrl.pathname === '/api/export/docx' && req.method === 'POST') {
|
|
106
|
-
try {
|
|
107
|
-
const body = await parseJsonBody(req, DOCX_EXPORT_REQUEST_LIMIT_BYTES);
|
|
108
|
-
if (!body?.filePath || typeof body?.html !== 'string') {
|
|
109
|
-
jsonResponse(req, res, 400, { error: 'Missing filePath or html' });
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (!docxExporter?.render) {
|
|
114
|
-
jsonResponse(req, res, 503, { error: 'DOCX export is unavailable' });
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const docxBuffer = await docxExporter.render({
|
|
119
|
-
html: body.html,
|
|
120
|
-
title: body.title || '',
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
sendResponse(req, res, {
|
|
124
|
-
body: docxBuffer,
|
|
125
|
-
headers: createDocxDownloadHeaders(body.filePath),
|
|
126
|
-
statusCode: 200,
|
|
127
|
-
});
|
|
128
|
-
} catch (error) {
|
|
129
|
-
handleVaultError(req, res, error, '[api] Failed to export DOCX:', 'Failed to export DOCX');
|
|
130
|
-
}
|
|
99
|
+
async function handleExportDocx({ docxExporter }, req, res) {
|
|
100
|
+
try {
|
|
101
|
+
const body = await parseJsonBody(req, DOCX_EXPORT_REQUEST_LIMIT_BYTES);
|
|
102
|
+
if (!body?.filePath || typeof body?.html !== 'string') {
|
|
103
|
+
jsonResponse(req, res, 400, { error: 'Missing filePath or html' });
|
|
131
104
|
return true;
|
|
132
105
|
}
|
|
133
106
|
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
const body = await parseJsonBody(req);
|
|
137
|
-
if (!body.path || typeof body.content !== 'string') {
|
|
138
|
-
jsonResponse(req, res, 400, { error: 'Missing path or content' });
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const result = await selectWriteOperation(vaultFileStore, body.path, body.content);
|
|
143
|
-
if (!result.ok) {
|
|
144
|
-
jsonResponse(req, res, 400, { error: result.error });
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
await workspaceMutationCoordinator?.apply?.({
|
|
149
|
-
action: 'write-file',
|
|
150
|
-
origin: 'api',
|
|
151
|
-
requestId: readRequestId(req),
|
|
152
|
-
workspaceChange: createWorkspaceChange({
|
|
153
|
-
changedPaths: [body.path],
|
|
154
|
-
}),
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
jsonResponse(req, res, 200, { ok: true });
|
|
158
|
-
} catch (error) {
|
|
159
|
-
handleVaultError(req, res, error, '[api] Failed to write file:', 'Failed to write file');
|
|
160
|
-
}
|
|
107
|
+
if (!docxExporter?.render) {
|
|
108
|
+
jsonResponse(req, res, 503, { error: 'DOCX export is unavailable' });
|
|
161
109
|
return true;
|
|
162
110
|
}
|
|
163
111
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
await workspaceMutationCoordinator?.apply?.({
|
|
187
|
-
action: 'upload-attachment',
|
|
188
|
-
origin: 'api',
|
|
189
|
-
requestId: readRequestId(req),
|
|
190
|
-
workspaceChange: createWorkspaceChange({
|
|
191
|
-
changedPaths: [result.path],
|
|
192
|
-
}),
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
jsonResponse(req, res, 201, {
|
|
196
|
-
markdown: result.markdownSnippet,
|
|
197
|
-
ok: true,
|
|
198
|
-
path: result.path,
|
|
199
|
-
});
|
|
200
|
-
} catch (error) {
|
|
201
|
-
handleVaultError(req, res, error, '[api] Failed to upload attachment:', 'Failed to upload attachment');
|
|
202
|
-
}
|
|
112
|
+
const docxBuffer = await docxExporter.render({
|
|
113
|
+
html: body.html,
|
|
114
|
+
title: body.title || '',
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
sendResponse(req, res, {
|
|
118
|
+
body: docxBuffer,
|
|
119
|
+
headers: createDocxDownloadHeaders(body.filePath),
|
|
120
|
+
statusCode: 200,
|
|
121
|
+
});
|
|
122
|
+
} catch (error) {
|
|
123
|
+
handleVaultError(req, res, error, '[api] Failed to export DOCX:', 'Failed to export DOCX');
|
|
124
|
+
}
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function handleWriteFile({ vaultFileStore, workspaceMutationCoordinator }, req, res) {
|
|
129
|
+
try {
|
|
130
|
+
const body = await parseJsonBody(req);
|
|
131
|
+
if (!body.path || typeof body.content !== 'string') {
|
|
132
|
+
jsonResponse(req, res, 400, { error: 'Missing path or content' });
|
|
203
133
|
return true;
|
|
204
134
|
}
|
|
205
135
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (!body.path) {
|
|
210
|
-
jsonResponse(req, res, 400, { error: 'Missing path' });
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const result = await vaultFileStore.createFile(body.path, body.content || '');
|
|
215
|
-
if (!result.ok) {
|
|
216
|
-
jsonResponse(req, res, 409, { error: result.error });
|
|
217
|
-
return true;
|
|
218
|
-
}
|
|
219
|
-
await workspaceMutationCoordinator?.apply?.({
|
|
220
|
-
action: 'create-file',
|
|
221
|
-
origin: 'api',
|
|
222
|
-
requestId: readRequestId(req),
|
|
223
|
-
workspaceChange: createWorkspaceChange({
|
|
224
|
-
changedPaths: [body.path],
|
|
225
|
-
}),
|
|
226
|
-
});
|
|
227
|
-
jsonResponse(req, res, 201, { ok: true, path: body.path });
|
|
228
|
-
} catch (error) {
|
|
229
|
-
handleVaultError(req, res, error, '[api] Failed to create file:', 'Failed to create file');
|
|
230
|
-
}
|
|
136
|
+
const result = await selectWriteOperation(vaultFileStore, body.path, body.content);
|
|
137
|
+
if (!result.ok) {
|
|
138
|
+
jsonResponse(req, res, 400, { error: result.error });
|
|
231
139
|
return true;
|
|
232
140
|
}
|
|
233
141
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
142
|
+
await workspaceMutationCoordinator?.apply?.({
|
|
143
|
+
action: 'write-file',
|
|
144
|
+
origin: 'api',
|
|
145
|
+
requestId: readRequestId(req),
|
|
146
|
+
workspaceChange: createWorkspaceChange({
|
|
147
|
+
changedPaths: [body.path],
|
|
148
|
+
}),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
jsonResponse(req, res, 200, { ok: true });
|
|
152
|
+
} catch (error) {
|
|
153
|
+
handleVaultError(req, res, error, '[api] Failed to write file:', 'Failed to write file');
|
|
154
|
+
}
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
240
157
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
origin: 'api',
|
|
250
|
-
requestId: readRequestId(req),
|
|
251
|
-
workspaceChange: createWorkspaceChange({
|
|
252
|
-
deletedPaths: [filePath],
|
|
253
|
-
}),
|
|
254
|
-
});
|
|
255
|
-
jsonResponse(req, res, 200, { ok: true });
|
|
256
|
-
} catch (error) {
|
|
257
|
-
console.error('[api] Failed to delete file:', error.message);
|
|
258
|
-
jsonResponse(req, res, 500, { error: 'Failed to delete file' });
|
|
259
|
-
}
|
|
158
|
+
async function handleUploadAttachment({ vaultFileStore, workspaceMutationCoordinator }, req, res) {
|
|
159
|
+
try {
|
|
160
|
+
const sourceDocumentPath = decodeHeaderMetadata(req.headers['x-collabmd-source-path']);
|
|
161
|
+
const originalFileName = decodeHeaderMetadata(req.headers['x-collabmd-file-name']);
|
|
162
|
+
const mimeType = String(req.headers['content-type'] || '').trim();
|
|
163
|
+
|
|
164
|
+
if (!sourceDocumentPath) {
|
|
165
|
+
jsonResponse(req, res, 400, { error: 'Missing source document path' });
|
|
260
166
|
return true;
|
|
261
167
|
}
|
|
262
168
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const result = await vaultFileStore.renameFile(body.oldPath, body.newPath);
|
|
272
|
-
if (!result.ok) {
|
|
273
|
-
jsonResponse(req, res, 400, { error: result.error });
|
|
274
|
-
return true;
|
|
275
|
-
}
|
|
276
|
-
await workspaceMutationCoordinator?.apply?.({
|
|
277
|
-
action: 'rename-file',
|
|
278
|
-
origin: 'api',
|
|
279
|
-
requestId: readRequestId(req),
|
|
280
|
-
workspaceChange: createWorkspaceChange({
|
|
281
|
-
renamedPaths: [{ oldPath: body.oldPath, newPath: body.newPath }],
|
|
282
|
-
}),
|
|
283
|
-
});
|
|
284
|
-
jsonResponse(req, res, 200, { ok: true, path: body.newPath });
|
|
285
|
-
} catch (error) {
|
|
286
|
-
handleVaultError(req, res, error, '[api] Failed to rename file:', 'Failed to rename file');
|
|
287
|
-
}
|
|
169
|
+
const content = await readBinaryRequestBody(req);
|
|
170
|
+
const result = await vaultFileStore.writeImageAttachmentForDocument(sourceDocumentPath, {
|
|
171
|
+
content,
|
|
172
|
+
mimeType,
|
|
173
|
+
originalFileName,
|
|
174
|
+
});
|
|
175
|
+
if (!result.ok) {
|
|
176
|
+
jsonResponse(req, res, 400, { error: result.error });
|
|
288
177
|
return true;
|
|
289
178
|
}
|
|
290
179
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
handleVaultError(req, res, error, '[api] Failed to create directory:', 'Failed to create directory');
|
|
317
|
-
}
|
|
180
|
+
await workspaceMutationCoordinator?.apply?.({
|
|
181
|
+
action: 'upload-attachment',
|
|
182
|
+
origin: 'api',
|
|
183
|
+
requestId: readRequestId(req),
|
|
184
|
+
workspaceChange: createWorkspaceChange({
|
|
185
|
+
changedPaths: [result.path],
|
|
186
|
+
}),
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
jsonResponse(req, res, 201, {
|
|
190
|
+
markdown: result.markdownSnippet,
|
|
191
|
+
ok: true,
|
|
192
|
+
path: result.path,
|
|
193
|
+
});
|
|
194
|
+
} catch (error) {
|
|
195
|
+
handleVaultError(req, res, error, '[api] Failed to upload attachment:', 'Failed to upload attachment');
|
|
196
|
+
}
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
async function handleCreateFile({ vaultFileStore, workspaceMutationCoordinator }, req, res) {
|
|
201
|
+
try {
|
|
202
|
+
const body = await parseJsonBody(req);
|
|
203
|
+
if (!body.path) {
|
|
204
|
+
jsonResponse(req, res, 400, { error: 'Missing path' });
|
|
318
205
|
return true;
|
|
319
206
|
}
|
|
320
207
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
if (!body.oldPath || !body.newPath) {
|
|
325
|
-
jsonResponse(req, res, 400, { error: 'Missing oldPath or newPath' });
|
|
326
|
-
return true;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
const workspaceChange = await workspaceMutationCoordinator?.createDirectoryRenameWorkspaceChange?.(body.oldPath, body.newPath);
|
|
330
|
-
const result = await vaultFileStore.renameDirectory(body.oldPath, body.newPath);
|
|
331
|
-
if (!result.ok) {
|
|
332
|
-
jsonResponse(req, res, 400, { error: result.error });
|
|
333
|
-
return true;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
await workspaceMutationCoordinator?.apply?.({
|
|
337
|
-
action: 'rename-directory',
|
|
338
|
-
origin: 'api',
|
|
339
|
-
requestId: readRequestId(req),
|
|
340
|
-
workspaceChange: workspaceChange ?? {
|
|
341
|
-
renamedPaths: [{ oldPath: body.oldPath, newPath: body.newPath }],
|
|
342
|
-
},
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
jsonResponse(req, res, 200, { ok: true, path: body.newPath });
|
|
346
|
-
} catch (error) {
|
|
347
|
-
handleVaultError(req, res, error, '[api] Failed to rename directory:', 'Failed to rename directory');
|
|
348
|
-
}
|
|
208
|
+
const result = await vaultFileStore.createFile(body.path, body.content || '');
|
|
209
|
+
if (!result.ok) {
|
|
210
|
+
jsonResponse(req, res, 409, { error: result.error });
|
|
349
211
|
return true;
|
|
350
212
|
}
|
|
213
|
+
await workspaceMutationCoordinator?.apply?.({
|
|
214
|
+
action: 'create-file',
|
|
215
|
+
origin: 'api',
|
|
216
|
+
requestId: readRequestId(req),
|
|
217
|
+
workspaceChange: createWorkspaceChange({
|
|
218
|
+
changedPaths: [body.path],
|
|
219
|
+
}),
|
|
220
|
+
});
|
|
221
|
+
jsonResponse(req, res, 201, { ok: true, path: body.path });
|
|
222
|
+
} catch (error) {
|
|
223
|
+
handleVaultError(req, res, error, '[api] Failed to create file:', 'Failed to create file');
|
|
224
|
+
}
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
351
227
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
228
|
+
async function handleDeleteFile({ vaultFileStore, workspaceMutationCoordinator }, req, res, requestUrl) {
|
|
229
|
+
const filePath = requestUrl.searchParams.get('path');
|
|
230
|
+
if (!filePath) {
|
|
231
|
+
jsonResponse(req, res, 400, { error: 'Missing path parameter' });
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
359
234
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
235
|
+
try {
|
|
236
|
+
const result = await vaultFileStore.deleteFile(filePath);
|
|
237
|
+
if (!result.ok) {
|
|
238
|
+
jsonResponse(req, res, 400, { error: result.error });
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
await workspaceMutationCoordinator?.apply?.({
|
|
242
|
+
action: 'delete-file',
|
|
243
|
+
origin: 'api',
|
|
244
|
+
requestId: readRequestId(req),
|
|
245
|
+
workspaceChange: createWorkspaceChange({
|
|
246
|
+
deletedPaths: [filePath],
|
|
247
|
+
}),
|
|
248
|
+
});
|
|
249
|
+
jsonResponse(req, res, 200, { ok: true });
|
|
250
|
+
} catch (error) {
|
|
251
|
+
console.error('[api] Failed to delete file:', error.message);
|
|
252
|
+
jsonResponse(req, res, 500, { error: 'Failed to delete file' });
|
|
253
|
+
}
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async function handleRenameFile({ vaultFileStore, workspaceMutationCoordinator }, req, res) {
|
|
258
|
+
try {
|
|
259
|
+
const body = await parseJsonBody(req);
|
|
260
|
+
if (!body.oldPath || !body.newPath) {
|
|
261
|
+
jsonResponse(req, res, 400, { error: 'Missing oldPath or newPath' });
|
|
381
262
|
return true;
|
|
382
263
|
}
|
|
383
264
|
|
|
265
|
+
const result = await vaultFileStore.renameFile(body.oldPath, body.newPath);
|
|
266
|
+
if (!result.ok) {
|
|
267
|
+
jsonResponse(req, res, 400, { error: result.error });
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
await workspaceMutationCoordinator?.apply?.({
|
|
271
|
+
action: 'rename-file',
|
|
272
|
+
origin: 'api',
|
|
273
|
+
requestId: readRequestId(req),
|
|
274
|
+
workspaceChange: createWorkspaceChange({
|
|
275
|
+
renamedPaths: [{ oldPath: body.oldPath, newPath: body.newPath }],
|
|
276
|
+
}),
|
|
277
|
+
});
|
|
278
|
+
jsonResponse(req, res, 200, { ok: true, path: body.newPath });
|
|
279
|
+
} catch (error) {
|
|
280
|
+
handleVaultError(req, res, error, '[api] Failed to rename file:', 'Failed to rename file');
|
|
281
|
+
}
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
async function handleCreateDirectory({ vaultFileStore, workspaceMutationCoordinator }, req, res) {
|
|
286
|
+
try {
|
|
287
|
+
const body = await parseJsonBody(req);
|
|
288
|
+
if (!body.path) {
|
|
289
|
+
jsonResponse(req, res, 400, { error: 'Missing path' });
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const result = await vaultFileStore.createDirectory(body.path);
|
|
294
|
+
if (!result.ok) {
|
|
295
|
+
jsonResponse(req, res, 400, { error: result.error });
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
await workspaceMutationCoordinator?.apply?.({
|
|
300
|
+
action: 'create-directory',
|
|
301
|
+
origin: 'api',
|
|
302
|
+
requestId: readRequestId(req),
|
|
303
|
+
workspaceChange: createWorkspaceChange({
|
|
304
|
+
changedPaths: [body.path],
|
|
305
|
+
}),
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
jsonResponse(req, res, 201, { ok: true });
|
|
309
|
+
} catch (error) {
|
|
310
|
+
handleVaultError(req, res, error, '[api] Failed to create directory:', 'Failed to create directory');
|
|
311
|
+
}
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
async function handleRenameDirectory({ vaultFileStore, workspaceMutationCoordinator }, req, res) {
|
|
316
|
+
try {
|
|
317
|
+
const body = await parseJsonBody(req);
|
|
318
|
+
if (!body.oldPath || !body.newPath) {
|
|
319
|
+
jsonResponse(req, res, 400, { error: 'Missing oldPath or newPath' });
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const workspaceChange = await workspaceMutationCoordinator?.createDirectoryRenameWorkspaceChange?.(body.oldPath, body.newPath);
|
|
324
|
+
const result = await vaultFileStore.renameDirectory(body.oldPath, body.newPath);
|
|
325
|
+
if (!result.ok) {
|
|
326
|
+
jsonResponse(req, res, 400, { error: result.error });
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
await workspaceMutationCoordinator?.apply?.({
|
|
331
|
+
action: 'rename-directory',
|
|
332
|
+
origin: 'api',
|
|
333
|
+
requestId: readRequestId(req),
|
|
334
|
+
workspaceChange: workspaceChange ?? {
|
|
335
|
+
renamedPaths: [{ oldPath: body.oldPath, newPath: body.newPath }],
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
jsonResponse(req, res, 200, { ok: true, path: body.newPath });
|
|
340
|
+
} catch (error) {
|
|
341
|
+
handleVaultError(req, res, error, '[api] Failed to rename directory:', 'Failed to rename directory');
|
|
342
|
+
}
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
async function handleDeleteDirectory({ vaultFileStore, workspaceMutationCoordinator }, req, res, requestUrl) {
|
|
347
|
+
const dirPath = requestUrl.searchParams.get('path');
|
|
348
|
+
const recursive = requestUrl.searchParams.get('recursive') === '1';
|
|
349
|
+
if (!dirPath) {
|
|
350
|
+
jsonResponse(req, res, 400, { error: 'Missing path parameter' });
|
|
351
|
+
return true;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
try {
|
|
355
|
+
const workspaceChange = await workspaceMutationCoordinator?.createDirectoryDeleteWorkspaceChange?.(dirPath);
|
|
356
|
+
const result = await vaultFileStore.deleteDirectory(dirPath, { recursive });
|
|
357
|
+
if (!result.ok) {
|
|
358
|
+
jsonResponse(req, res, getDirectoryDeleteStatusCode(result.error), { error: result.error });
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
await workspaceMutationCoordinator?.apply?.({
|
|
363
|
+
action: 'delete-directory',
|
|
364
|
+
origin: 'api',
|
|
365
|
+
requestId: readRequestId(req),
|
|
366
|
+
workspaceChange: workspaceChange ?? {
|
|
367
|
+
deletedPaths: [dirPath],
|
|
368
|
+
},
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
jsonResponse(req, res, 200, { ok: true });
|
|
372
|
+
} catch (error) {
|
|
373
|
+
handleVaultError(req, res, error, '[api] Failed to delete directory:', 'Failed to delete directory');
|
|
374
|
+
}
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const ROUTE_TABLE = [
|
|
379
|
+
{ method: 'POST', path: '/api/export/docx', handler: handleExportDocx },
|
|
380
|
+
{ method: 'PUT', path: '/api/file', handler: handleWriteFile },
|
|
381
|
+
{ method: 'POST', path: '/api/attachments', handler: handleUploadAttachment },
|
|
382
|
+
{ method: 'POST', path: '/api/file', handler: handleCreateFile },
|
|
383
|
+
{ method: 'DELETE', path: '/api/file', handler: handleDeleteFile },
|
|
384
|
+
{ method: 'PATCH', path: '/api/file', handler: handleRenameFile },
|
|
385
|
+
{ method: 'POST', path: '/api/directory', handler: handleCreateDirectory },
|
|
386
|
+
{ method: 'PATCH', path: '/api/directory', handler: handleRenameDirectory },
|
|
387
|
+
{ method: 'DELETE', path: '/api/directory', handler: handleDeleteDirectory },
|
|
388
|
+
];
|
|
389
|
+
|
|
390
|
+
export function createVaultApiCommandHandler({
|
|
391
|
+
docxExporter = null,
|
|
392
|
+
vaultFileStore,
|
|
393
|
+
workspaceMutationCoordinator = null,
|
|
394
|
+
}) {
|
|
395
|
+
const context = { docxExporter, vaultFileStore, workspaceMutationCoordinator };
|
|
396
|
+
|
|
397
|
+
return async function handleVaultApiCommand(req, res, requestUrl) {
|
|
398
|
+
for (const route of ROUTE_TABLE) {
|
|
399
|
+
if (requestUrl.pathname === route.path && req.method === route.method) {
|
|
400
|
+
return route.handler(context, req, res, requestUrl);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
384
403
|
return false;
|
|
385
404
|
};
|
|
386
405
|
}
|