collabmd 0.1.18
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/LICENSE +21 -0
- package/README.md +453 -0
- package/bin/collabmd.js +241 -0
- package/docker-compose.yml +43 -0
- package/package.json +93 -0
- package/public/assets/css/base.css +1 -0
- package/public/assets/css/style.css +1 -0
- package/public/assets/js/assets/Assistant-Bold-ZDZZ6JHA.woff2 +0 -0
- package/public/assets/js/assets/Assistant-Medium-DZ25RZU3.woff2 +0 -0
- package/public/assets/js/assets/Assistant-Regular-PLF2XOGW.woff2 +0 -0
- package/public/assets/js/assets/Assistant-SemiBold-CZ5MX6FK.woff2 +0 -0
- package/public/assets/js/chunks/CodeMirrorEditor-UCMRAMCV-MAKZFDBE.js +12 -0
- package/public/assets/js/chunks/apl-C5P5JBDI.js +1 -0
- package/public/assets/js/chunks/ar-SA-NXDWD63E-MF6HMEA4.js +8 -0
- package/public/assets/js/chunks/architecture-PBZL5I3N-55LDZ5WS.js +1 -0
- package/public/assets/js/chunks/architectureDiagram-2XIMDMQ5-2VP562X7.js +36 -0
- package/public/assets/js/chunks/asciiarmor-3NCLLELT.js +1 -0
- package/public/assets/js/chunks/asn1-KF4WXU3M.js +1 -0
- package/public/assets/js/chunks/asterisk-EA3VIN65.js +1 -0
- package/public/assets/js/chunks/az-AZ-MXSORGZV-AIGO4TNU.js +1 -0
- package/public/assets/js/chunks/bg-BG-O6MV2KSF-X6AVO2AF.js +5 -0
- package/public/assets/js/chunks/blockDiagram-WCTKOSBZ-KM56WWDE.js +132 -0
- package/public/assets/js/chunks/bn-BD-T2VJNT7N-7OMHRIGC.js +3 -0
- package/public/assets/js/chunks/bn-IN-MMW2ORAC-EPKMNKG7.js +3 -0
- package/public/assets/js/chunks/brainfuck-A3CTQVFD.js +1 -0
- package/public/assets/js/chunks/c4Diagram-IC4MRINW-KX6UEGQZ.js +10 -0
- package/public/assets/js/chunks/ca-ES-MKBCGNOG-U44SUUTN.js +8 -0
- package/public/assets/js/chunks/chunk-2NTQWLZD.js +25 -0
- package/public/assets/js/chunks/chunk-2YRP2AWD.js +1 -0
- package/public/assets/js/chunks/chunk-3BUCGSSJ.js +1 -0
- package/public/assets/js/chunks/chunk-47L7JGE3.js +1 -0
- package/public/assets/js/chunks/chunk-4BCHPULB.js +1 -0
- package/public/assets/js/chunks/chunk-4NKM6YFO.js +161 -0
- package/public/assets/js/chunks/chunk-4WGMPBK5.js +1 -0
- package/public/assets/js/chunks/chunk-55WF6Y2Q.js +1 -0
- package/public/assets/js/chunks/chunk-775E65SU.js +1 -0
- package/public/assets/js/chunks/chunk-AJRGTECU.js +70 -0
- package/public/assets/js/chunks/chunk-B2J3PHGY.js +1 -0
- package/public/assets/js/chunks/chunk-B4JKB3BC.js +1 -0
- package/public/assets/js/chunks/chunk-BBHPYU2R.js +1 -0
- package/public/assets/js/chunks/chunk-CGVY4PKT.js +13 -0
- package/public/assets/js/chunks/chunk-CVTRX3TE.js +220 -0
- package/public/assets/js/chunks/chunk-DW6KK6VF.js +1 -0
- package/public/assets/js/chunks/chunk-E2HMNOQL.js +189 -0
- package/public/assets/js/chunks/chunk-EPTJZP5H.js +7 -0
- package/public/assets/js/chunks/chunk-G7NUGGE7.js +13 -0
- package/public/assets/js/chunks/chunk-GI7LBIBP.js +1 -0
- package/public/assets/js/chunks/chunk-GXRL27M7.js +1 -0
- package/public/assets/js/chunks/chunk-H6EYDHRW.js +1 -0
- package/public/assets/js/chunks/chunk-HOCBCDA5.js +1 -0
- package/public/assets/js/chunks/chunk-HS2CUOC6.js +1 -0
- package/public/assets/js/chunks/chunk-HUAS4BYI.js +12 -0
- package/public/assets/js/chunks/chunk-HVNNEPP5.js +2 -0
- package/public/assets/js/chunks/chunk-I2GVZI7W.js +38 -0
- package/public/assets/js/chunks/chunk-I6PVWGBN.js +14 -0
- package/public/assets/js/chunks/chunk-IR2DOYV4.js +7 -0
- package/public/assets/js/chunks/chunk-IZ3V3F2A.js +1 -0
- package/public/assets/js/chunks/chunk-KPAQHIOI.js +1 -0
- package/public/assets/js/chunks/chunk-M3EW4V74.js +1 -0
- package/public/assets/js/chunks/chunk-MK3AFU3C.js +90 -0
- package/public/assets/js/chunks/chunk-NM6J3ND7.js +1 -0
- package/public/assets/js/chunks/chunk-NO7UPWTU.js +1 -0
- package/public/assets/js/chunks/chunk-OG2TNZEU.js +9 -0
- package/public/assets/js/chunks/chunk-OHGDMMWM.js +1 -0
- package/public/assets/js/chunks/chunk-OOT2HALX.js +1 -0
- package/public/assets/js/chunks/chunk-OQLLZFFN.js +1 -0
- package/public/assets/js/chunks/chunk-PF6TP4EI.js +1 -0
- package/public/assets/js/chunks/chunk-PMOZMECZ.js +85 -0
- package/public/assets/js/chunks/chunk-QBGS6DJR.js +1 -0
- package/public/assets/js/chunks/chunk-QF3ZQ6UQ.js +1 -0
- package/public/assets/js/chunks/chunk-QFXMAUW4.js +1 -0
- package/public/assets/js/chunks/chunk-QSTBGTWJ.js +1 -0
- package/public/assets/js/chunks/chunk-QYKIT2IH.js +41 -0
- package/public/assets/js/chunks/chunk-S75BI2UQ.js +1 -0
- package/public/assets/js/chunks/chunk-SKEZZ3H6.js +1 -0
- package/public/assets/js/chunks/chunk-SO6QBCB6.js +1 -0
- package/public/assets/js/chunks/chunk-SR3U53EQ.js +1 -0
- package/public/assets/js/chunks/chunk-TFP6LRYJ.js +53 -0
- package/public/assets/js/chunks/chunk-U6APNHAF.js +15 -0
- package/public/assets/js/chunks/chunk-VOODXHXA.js +1 -0
- package/public/assets/js/chunks/chunk-W7WJUTSA.js +3 -0
- package/public/assets/js/chunks/chunk-WNXFO2F2.js +1 -0
- package/public/assets/js/chunks/chunk-X6EEYWV4.js +6 -0
- package/public/assets/js/chunks/chunk-YVW3ZETS.js +1 -0
- package/public/assets/js/chunks/chunk-ZR2QRTBG.js +339 -0
- package/public/assets/js/chunks/chunk-ZZJX4LQ2.js +1 -0
- package/public/assets/js/chunks/classDiagram-VBA2DB6C-IYW4O2RM.js +1 -0
- package/public/assets/js/chunks/classDiagram-v2-RAHNMMFH-DNKVN2WD.js +1 -0
- package/public/assets/js/chunks/clike-RTBH33GE.js +1 -0
- package/public/assets/js/chunks/clojure-BR2VJ2JI.js +1 -0
- package/public/assets/js/chunks/cmake-2HEWVFEE.js +1 -0
- package/public/assets/js/chunks/cobol-V6EIK6DN.js +1 -0
- package/public/assets/js/chunks/coffeescript-JW3ZOGMD.js +1 -0
- package/public/assets/js/chunks/commonlisp-UCWSIHYK.js +1 -0
- package/public/assets/js/chunks/cose-bilkent-S5V4N54A-QVYRFFNC.js +1 -0
- package/public/assets/js/chunks/crystal-GR4VLC3M.js +1 -0
- package/public/assets/js/chunks/cs-CZ-V77HGUP7-OLBAKFG5.js +7 -0
- package/public/assets/js/chunks/css-C5DVWGB4.js +1 -0
- package/public/assets/js/chunks/cypher-K7FZM5GC.js +1 -0
- package/public/assets/js/chunks/d-CF3QNNH5.js +1 -0
- package/public/assets/js/chunks/da-DK-I5RFNTM4-QJIG2SEZ.js +2 -0
- package/public/assets/js/chunks/dagre-KLK3FWXG-KVNBUDOY.js +4 -0
- package/public/assets/js/chunks/de-CH-WLRDEVBV-4MMJDMVD.js +7 -0
- package/public/assets/js/chunks/de-DE-DTI4WUSC-ML7C46TT.js +7 -0
- package/public/assets/js/chunks/diagram-E7M64L7V-ZP33VRUC.js +24 -0
- package/public/assets/js/chunks/diagram-IFDJBPK2-ZG35YWOD.js +43 -0
- package/public/assets/js/chunks/diagram-P4PSJMXO-ZGIGM7D2.js +24 -0
- package/public/assets/js/chunks/diff-KOMSZU7O.js +1 -0
- package/public/assets/js/chunks/dist-7RQKSOUX.js +7 -0
- package/public/assets/js/chunks/dist-ARWGZ6MN.js +1 -0
- package/public/assets/js/chunks/dist-DPBSGC3Y.js +2 -0
- package/public/assets/js/chunks/dist-E36PJE5M.js +1 -0
- package/public/assets/js/chunks/dist-E5NM7OBW.js +1 -0
- package/public/assets/js/chunks/dist-ERADYPEK.js +1 -0
- package/public/assets/js/chunks/dist-F43RIHBZ.js +1 -0
- package/public/assets/js/chunks/dist-HAB5NIXI.js +1 -0
- package/public/assets/js/chunks/dist-HG23OLRA.js +1 -0
- package/public/assets/js/chunks/dist-IEJXBSDJ.js +1 -0
- package/public/assets/js/chunks/dist-IQA4KVJK.js +1 -0
- package/public/assets/js/chunks/dist-OIQTNVT2.js +3 -0
- package/public/assets/js/chunks/dist-PMZJ734S.js +1 -0
- package/public/assets/js/chunks/dist-RCQFQRLD.js +1 -0
- package/public/assets/js/chunks/dist-RQLC4GVI.js +1 -0
- package/public/assets/js/chunks/dist-RSJGLSKC.js +1 -0
- package/public/assets/js/chunks/dist-SGNQZVVX.js +1 -0
- package/public/assets/js/chunks/dist-VCFTF7Z6.js +1 -0
- package/public/assets/js/chunks/dist-VTO23SHH.js +1 -0
- package/public/assets/js/chunks/dist-XOODBV4L.js +1 -0
- package/public/assets/js/chunks/dist-ZFZNCRZY.js +1 -0
- package/public/assets/js/chunks/dockerfile-XCIKYOSI.js +1 -0
- package/public/assets/js/chunks/dtd-3XFH7W6Z.js +1 -0
- package/public/assets/js/chunks/dylan-3UWPKVOR.js +1 -0
- package/public/assets/js/chunks/ebnf-OLHTL3VN.js +1 -0
- package/public/assets/js/chunks/ecl-43LZ3ZRM.js +1 -0
- package/public/assets/js/chunks/editor-session-IHFTYG5D.js +22 -0
- package/public/assets/js/chunks/eiffel-ISPO2UJF.js +1 -0
- package/public/assets/js/chunks/el-GR-ZXDJ2OS4-WSCEIO6J.js +7 -0
- package/public/assets/js/chunks/elm-CLK576PK.js +1 -0
- package/public/assets/js/chunks/en-CTDJDZ6K-IC3QAUOI.js +1 -0
- package/public/assets/js/chunks/erDiagram-INFDFZHY-ZMS6H2TH.js +70 -0
- package/public/assets/js/chunks/erlang-AVQXQFOT.js +1 -0
- package/public/assets/js/chunks/es-ES-DYQHAD43-XGB5X5IM.js +7 -0
- package/public/assets/js/chunks/eu-ES-QDSYU5Y3-LA3JTIJ2.js +7 -0
- package/public/assets/js/chunks/excalidraw-mermaid-stub-NYXTOJ4H.js +1 -0
- package/public/assets/js/chunks/fa-IR-26LZG4PM-PFALMEDX.js +9 -0
- package/public/assets/js/chunks/factor-CRTVBD6Q.js +1 -0
- package/public/assets/js/chunks/fcl-FX24LKTH.js +1 -0
- package/public/assets/js/chunks/fi-FI-6YS4KDE4-ES5MV6P4.js +6 -0
- package/public/assets/js/chunks/flowDiagram-PKNHOUZH-QD4L5IE5.js +162 -0
- package/public/assets/js/chunks/forth-YKDKCTVS.js +1 -0
- package/public/assets/js/chunks/fortran-UJWC6SLU.js +1 -0
- package/public/assets/js/chunks/fr-FR-BRLLPTZC-VMFE22YV.js +12 -0
- package/public/assets/js/chunks/ganttDiagram-A5KZAMGK-VTMTQESP.js +292 -0
- package/public/assets/js/chunks/gas-MYEMWGRE.js +1 -0
- package/public/assets/js/chunks/gherkin-JWHAU2YG.js +1 -0
- package/public/assets/js/chunks/gitGraph-HDMCJU4V-YPHS74XX.js +1 -0
- package/public/assets/js/chunks/gitGraphDiagram-K3NZZRJ6-Z3EZ634T.js +65 -0
- package/public/assets/js/chunks/gl-ES-OKUZTLYG-GPT42ZHV.js +6 -0
- package/public/assets/js/chunks/groovy-QZIZQIAK.js +1 -0
- package/public/assets/js/chunks/haskell-JR3G7YNW.js +1 -0
- package/public/assets/js/chunks/haxe-TVLAIYEN.js +1 -0
- package/public/assets/js/chunks/he-IL-26MGYIU7-VQ5XQYYY.js +8 -0
- package/public/assets/js/chunks/hi-IN-Q4ZOGTP2-2Z766MXA.js +3 -0
- package/public/assets/js/chunks/http-YXQRE77G.js +1 -0
- package/public/assets/js/chunks/hu-HU-P2OXPSN5-6XDVPGTE.js +3 -0
- package/public/assets/js/chunks/id-ID-2EIKXYN6-J5GWSY2S.js +8 -0
- package/public/assets/js/chunks/idl-RAQGJ6LJ.js +1 -0
- package/public/assets/js/chunks/image-32MOCVDX-JN2EUMQG.js +1 -0
- package/public/assets/js/chunks/image-blob-reduce.esm-K5OWL55S.js +13 -0
- package/public/assets/js/chunks/info-3K5VOQVL-CXJSPNNP.js +1 -0
- package/public/assets/js/chunks/infoDiagram-LFFYTUFH-WQ34MUJA.js +2 -0
- package/public/assets/js/chunks/ishikawaDiagram-PHBUUO56-4IARWKJK.js +70 -0
- package/public/assets/js/chunks/it-IT-4CFKVXI2-NMBWUWFF.js +12 -0
- package/public/assets/js/chunks/ja-JP-MAND2Z4V-GQZYXXOC.js +7 -0
- package/public/assets/js/chunks/javascript-NM7KDJUE.js +1 -0
- package/public/assets/js/chunks/journeyDiagram-4ABVD52K-FJ4LF4SX.js +139 -0
- package/public/assets/js/chunks/julia-LG3BH25B.js +1 -0
- package/public/assets/js/chunks/kaa-HQRTCXTJ-7D6PAKDJ.js +1 -0
- package/public/assets/js/chunks/kab-KAB-JKIKKTGH-TNKFXNAX.js +4 -0
- package/public/assets/js/chunks/kanban-definition-K7BYSVSG-TY4EVYI3.js +89 -0
- package/public/assets/js/chunks/katex-5YJCUCFD.js +261 -0
- package/public/assets/js/chunks/kk-KZ-HXQ63ZFC-T4HCMWED.js +1 -0
- package/public/assets/js/chunks/km-KH-PKL3LSGX-HTLHEJV6.js +7 -0
- package/public/assets/js/chunks/ko-KR-KXLREZX3-QMR52QVI.js +5 -0
- package/public/assets/js/chunks/ku-TR-MJ4IER3X-K5CNY4UO.js +6 -0
- package/public/assets/js/chunks/livescript-4CVWVI4M.js +1 -0
- package/public/assets/js/chunks/lt-LT-H6WFQ6FJ-IW25FAGX.js +3 -0
- package/public/assets/js/chunks/lua-VWGE7DQ7.js +1 -0
- package/public/assets/js/chunks/lv-LV-GOCK6SJW-KTDFW5OH.js +4 -0
- package/public/assets/js/chunks/mathematica-D7APQSEU.js +1 -0
- package/public/assets/js/chunks/mbox-BN3XQBYX.js +1 -0
- package/public/assets/js/chunks/mermaid-runtime-BIFNJ2CT.js +18 -0
- package/public/assets/js/chunks/mindmap-definition-YRQLILUH-5B565RNP.js +68 -0
- package/public/assets/js/chunks/mirc-565WBI76.js +1 -0
- package/public/assets/js/chunks/mllike-VV3KS46B.js +1 -0
- package/public/assets/js/chunks/modelica-EGX44FZV.js +1 -0
- package/public/assets/js/chunks/mr-IN-IXVLDMEQ-PHM5DT7Q.js +9 -0
- package/public/assets/js/chunks/mscgen-GFGTHENT.js +1 -0
- package/public/assets/js/chunks/mumps-POZYWSMI.js +1 -0
- package/public/assets/js/chunks/my-MM-YG6MYTTD-ZHLCMEVA.js +1 -0
- package/public/assets/js/chunks/nb-NO-XGWJISD2-KSDFG6YU.js +8 -0
- package/public/assets/js/chunks/nginx-JUBX55EU.js +1 -0
- package/public/assets/js/chunks/nl-NL-XVDVCPNC-KVF3ZO2R.js +13 -0
- package/public/assets/js/chunks/nn-NO-EMX5MJX5-34QKSHNR.js +4 -0
- package/public/assets/js/chunks/nsis-RC4CREGM.js +1 -0
- package/public/assets/js/chunks/ntriples-4WK6CNVE.js +1 -0
- package/public/assets/js/chunks/oc-FR-ROEINTVO-5GP4AOYO.js +4 -0
- package/public/assets/js/chunks/octave-GOKFN2V7.js +1 -0
- package/public/assets/js/chunks/oz-OQUMNC63.js +1 -0
- package/public/assets/js/chunks/pa-IN-ZYN6SUDY-MVL7O44W.js +4 -0
- package/public/assets/js/chunks/packet-RMMSAZCW-D7XTR5TT.js +1 -0
- package/public/assets/js/chunks/pascal-BBWQWWWD.js +1 -0
- package/public/assets/js/chunks/percentages-5DKR754L-DG7W23CV.js +1 -0
- package/public/assets/js/chunks/perl-KTPJTTAM.js +1 -0
- package/public/assets/js/chunks/pica-6G3NROWT.js +17 -0
- package/public/assets/js/chunks/pie-UPGHQEXC-KGC3O6LN.js +1 -0
- package/public/assets/js/chunks/pieDiagram-SKSYHLDU-KWKRDEZS.js +30 -0
- package/public/assets/js/chunks/pig-IJMBS4FZ.js +1 -0
- package/public/assets/js/chunks/pl-PL-6VTG7PHC-VADRWSX4.js +12 -0
- package/public/assets/js/chunks/powershell-6YGCBHDP.js +1 -0
- package/public/assets/js/chunks/preview-render-compiler-WD3A76I6.js +25 -0
- package/public/assets/js/chunks/properties-5QTD3364.js +1 -0
- package/public/assets/js/chunks/protobuf-LTRWBIK3.js +1 -0
- package/public/assets/js/chunks/pt-BR-5YFKRR5G-HHF4UPO4.js +6 -0
- package/public/assets/js/chunks/pt-PT-GEIXXZ67-TUTAUZJK.js +8 -0
- package/public/assets/js/chunks/pug-U4PV3WLG.js +1 -0
- package/public/assets/js/chunks/puppet-WGYJPR3Y.js +1 -0
- package/public/assets/js/chunks/python-6YGH4S47.js +1 -0
- package/public/assets/js/chunks/q-VIG4IJLI.js +1 -0
- package/public/assets/js/chunks/quadrantDiagram-337W2JSQ-GWQRUFHQ.js +7 -0
- package/public/assets/js/chunks/quick-switcher-controller-JYDIJVAJ.js +5 -0
- package/public/assets/js/chunks/r-NVPCXGTR.js +1 -0
- package/public/assets/js/chunks/radar-KQ55EAFF-OPO64DRI.js +1 -0
- package/public/assets/js/chunks/requirementDiagram-Z7DCOOCP-ASW7IPJL.js +73 -0
- package/public/assets/js/chunks/ro-RO-E2P6TFZI-RJFCULYF.js +12 -0
- package/public/assets/js/chunks/roundRect-Z3DX3W5S.js +1 -0
- package/public/assets/js/chunks/rpm-UEA257HD.js +1 -0
- package/public/assets/js/chunks/ru-RU-YBIIY43T-BF27TNVK.js +10 -0
- package/public/assets/js/chunks/ruby-KPQRAJGE.js +1 -0
- package/public/assets/js/chunks/sankeyDiagram-WA2Y5GQK-W6BBWCLW.js +10 -0
- package/public/assets/js/chunks/sas-L7VATVH5.js +1 -0
- package/public/assets/js/chunks/scheme-T2NOWR3P.js +1 -0
- package/public/assets/js/chunks/sequenceDiagram-2WXFIKYE-H4G3ISLN.js +145 -0
- package/public/assets/js/chunks/shell-DLVDUNFA.js +1 -0
- package/public/assets/js/chunks/si-LK-673C2CI2-IOFGU4U2.js +1 -0
- package/public/assets/js/chunks/sieve-BKBZYDBU.js +1 -0
- package/public/assets/js/chunks/sk-SK-CKZHQ4AP-6O5JGN26.js +7 -0
- package/public/assets/js/chunks/sl-SI-557H2GWM-2NEHLV7W.js +6 -0
- package/public/assets/js/chunks/smalltalk-WRJQKJSD.js +1 -0
- package/public/assets/js/chunks/solr-66B3BIDL.js +1 -0
- package/public/assets/js/chunks/sparql-S25Z47JG.js +1 -0
- package/public/assets/js/chunks/spreadsheet-B272EF7Y.js +1 -0
- package/public/assets/js/chunks/sql-BPLIIUYC.js +1 -0
- package/public/assets/js/chunks/stateDiagram-RAJIS63D-OF5XXRUS.js +1 -0
- package/public/assets/js/chunks/stateDiagram-v2-FVOUBMTO-IV2CSQSQ.js +1 -0
- package/public/assets/js/chunks/stex-4IJY64QX.js +1 -0
- package/public/assets/js/chunks/stylus-PJUHLGPT.js +1 -0
- package/public/assets/js/chunks/subset-shared.chunk-4NMWHS4D.js +1 -0
- package/public/assets/js/chunks/subset-worker.chunk-NTLP7Y66.js +1 -0
- package/public/assets/js/chunks/sv-SE-XOPKKDWS-Q2L6KGFV.js +8 -0
- package/public/assets/js/chunks/swift-UYHTO4SX.js +1 -0
- package/public/assets/js/chunks/ta-IN-XBH7DQI3-ISSUGZAK.js +6 -0
- package/public/assets/js/chunks/tcl-OQ5J3VO2.js +1 -0
- package/public/assets/js/chunks/textile-NOGVBEYF.js +1 -0
- package/public/assets/js/chunks/th-TH-TOCWH3R4-TABEAMJA.js +1 -0
- package/public/assets/js/chunks/tiddlywiki-SYTK4QUE.js +1 -0
- package/public/assets/js/chunks/tiki-P7K4ZLOM.js +1 -0
- package/public/assets/js/chunks/timeline-definition-YZTLITO2-HBCANIUC.js +61 -0
- package/public/assets/js/chunks/toml-AUZYRP36.js +1 -0
- package/public/assets/js/chunks/tr-TR-GXW6CYY5-5NQRN52Y.js +4 -0
- package/public/assets/js/chunks/treemap-KZPCXAKY-WYMCT5F7.js +1 -0
- package/public/assets/js/chunks/troff-XFYJNQOJ.js +1 -0
- package/public/assets/js/chunks/ttcn-AK2IXWU6.js +1 -0
- package/public/assets/js/chunks/ttcn-cfg-3IDPIYPU.js +1 -0
- package/public/assets/js/chunks/turtle-OIDMF46P.js +1 -0
- package/public/assets/js/chunks/uk-UA-IJKTNUDG-2IIL3TO5.js +6 -0
- package/public/assets/js/chunks/uz-UZ-TBZZEA4V-X22KVKBP.js +1 -0
- package/public/assets/js/chunks/vb-J6K4XVA2.js +1 -0
- package/public/assets/js/chunks/vbscript-FM7DDZZE.js +1 -0
- package/public/assets/js/chunks/velocity-6KZFEOFD.js +1 -0
- package/public/assets/js/chunks/vennDiagram-LZ73GAT5-EBRF3MZR.js +34 -0
- package/public/assets/js/chunks/verilog-EWWQPMNN.js +1 -0
- package/public/assets/js/chunks/vhdl-CJ3M4IHI.js +1 -0
- package/public/assets/js/chunks/vi-VN-MULSGNVB-TENM65C7.js +7 -0
- package/public/assets/js/chunks/webidl-XVBHXCRV.js +1 -0
- package/public/assets/js/chunks/xquery-7WZOZ4UK.js +1 -0
- package/public/assets/js/chunks/xychartDiagram-JWTSCODW-WIFVRQPR.js +7 -0
- package/public/assets/js/chunks/yacas-MZ2ZZPF3.js +1 -0
- package/public/assets/js/chunks/z80-I447CBF7.js +1 -0
- package/public/assets/js/chunks/zh-CN-MVX3E32U-S5VA2BA5.js +11 -0
- package/public/assets/js/chunks/zh-HK-JNU5RLIE-A4VUKZFV.js +1 -0
- package/public/assets/js/chunks/zh-TW-LENVCA6T-KFB6KHMM.js +9 -0
- package/public/assets/js/excalidraw-editor-7ORML5YA.css +1 -0
- package/public/assets/js/excalidraw-editor-LKW2AZBU.js +347 -0
- package/public/assets/js/excalidraw-editor.css +1 -0
- package/public/assets/js/excalidraw-editor.js +1 -0
- package/public/assets/js/main.js +354 -0
- package/public/assets/js/preview-render-worker.js +30 -0
- package/public/assets/vendor/highlight/github-dark.min.css +10 -0
- package/public/assets/vendor/highlight/github.min.css +10 -0
- package/public/excalidraw-editor.html +31 -0
- package/public/index.html +549 -0
- package/scripts/cloudflare-tunnel.mjs +145 -0
- package/scripts/local-plantuml-compose.mjs +92 -0
- package/server.js +1 -0
- package/src/client/application/app-shell/chat-feature.js +363 -0
- package/src/client/application/app-shell/comments-feature.js +33 -0
- package/src/client/application/app-shell/git-feature.js +394 -0
- package/src/client/application/app-shell/presence-feature.js +229 -0
- package/src/client/application/app-shell/ui-feature.js +535 -0
- package/src/client/application/app-shell/workspace-feature.js +132 -0
- package/src/client/application/app-shell-elements.js +78 -0
- package/src/client/application/diagram-preview-hydrator.js +382 -0
- package/src/client/application/file-open-lifecycle.js +26 -0
- package/src/client/application/mermaid-preview-hydrator.js +570 -0
- package/src/client/application/plantuml-preview-hydrator.js +563 -0
- package/src/client/application/preview-diagram-utils.js +223 -0
- package/src/client/application/preview-render-compiler.js +426 -0
- package/src/client/application/preview-render-executor.js +153 -0
- package/src/client/application/preview-render-profile.js +63 -0
- package/src/client/application/preview-render-scheduler.js +73 -0
- package/src/client/application/preview-render-worker.js +19 -0
- package/src/client/application/preview-renderer.js +452 -0
- package/src/client/application/wiki-link-file-controller.js +58 -0
- package/src/client/application/workspace-chrome-controller.js +84 -0
- package/src/client/application/workspace-coordinator.js +238 -0
- package/src/client/application/workspace-preview-controller.js +237 -0
- package/src/client/application/workspace-route-controller.js +170 -0
- package/src/client/application/workspace-state-store.js +46 -0
- package/src/client/bootstrap/collabmd-app-shell.js +479 -0
- package/src/client/domain/diagram-action-icons.js +41 -0
- package/src/client/domain/excalidraw-collaboration.js +153 -0
- package/src/client/domain/excalidraw-scene.js +87 -0
- package/src/client/domain/markdown-formatting.js +370 -0
- package/src/client/domain/plantuml-language.js +226 -0
- package/src/client/domain/room.js +49 -0
- package/src/client/domain/runtime-paths.js +136 -0
- package/src/client/domain/vault-api-client.js +1 -0
- package/src/client/domain/vault-paths.js +80 -0
- package/src/client/domain/vault-utils.js +49 -0
- package/src/client/domain/wiki-link-completions.js +78 -0
- package/src/client/excalidraw-editor.js +630 -0
- package/src/client/excalidraw-mermaid-stub.js +7 -0
- package/src/client/infrastructure/auth-client.js +383 -0
- package/src/client/infrastructure/browser-navigation-port.js +19 -0
- package/src/client/infrastructure/browser-notification-port.js +40 -0
- package/src/client/infrastructure/browser-preferences-port.js +79 -0
- package/src/client/infrastructure/comment-thread-store.js +293 -0
- package/src/client/infrastructure/editor-collaboration-client.js +240 -0
- package/src/client/infrastructure/editor-session.js +255 -0
- package/src/client/infrastructure/editor-view-adapter.js +578 -0
- package/src/client/infrastructure/excalidraw-room-client.js +651 -0
- package/src/client/infrastructure/lobby-presence.js +304 -0
- package/src/client/infrastructure/runtime-config.js +65 -0
- package/src/client/infrastructure/tab-activity-lock.js +193 -0
- package/src/client/infrastructure/vault-api-client.js +61 -0
- package/src/client/infrastructure/yjs-provider-reset-guard.js +19 -0
- package/src/client/main.js +16 -0
- package/src/client/mermaid-runtime.js +3 -0
- package/src/client/presentation/backlinks-panel.js +188 -0
- package/src/client/presentation/comment-ui-controller.js +1235 -0
- package/src/client/presentation/comments-panel.js +531 -0
- package/src/client/presentation/excalidraw-embed-controller.js +968 -0
- package/src/client/presentation/excalidraw-embed-reconciler.js +37 -0
- package/src/client/presentation/file-action-controller.js +596 -0
- package/src/client/presentation/file-explorer-controller.js +81 -0
- package/src/client/presentation/file-explorer-view.js +256 -0
- package/src/client/presentation/file-tree-state.js +77 -0
- package/src/client/presentation/git-diff-view-controller.js +656 -0
- package/src/client/presentation/git-panel-controller.js +516 -0
- package/src/client/presentation/layout-controller.js +222 -0
- package/src/client/presentation/outline-controller.js +239 -0
- package/src/client/presentation/quick-switcher-controller.js +300 -0
- package/src/client/presentation/scroll-sync-controller.js +500 -0
- package/src/client/presentation/theme-controller.js +64 -0
- package/src/client/presentation/toast-controller.js +21 -0
- package/src/client/presentation/video-embed-controller.js +264 -0
- package/src/client/styles/base.css +58 -0
- package/src/client/styles/style.css +4245 -0
- package/src/domain/comment-threads.js +233 -0
- package/src/domain/excalidraw-room-codec.js +427 -0
- package/src/domain/file-kind.js +104 -0
- package/src/domain/wiki-link-resolver.js +75 -0
- package/src/server/auth/create-auth-service.js +272 -0
- package/src/server/auth/session-cookie.js +125 -0
- package/src/server/config/env.js +186 -0
- package/src/server/create-app-server.js +143 -0
- package/src/server/domain/backlink-index.js +291 -0
- package/src/server/domain/collaboration/collaboration-document-store.js +155 -0
- package/src/server/domain/collaboration/collaboration-room.js +603 -0
- package/src/server/domain/collaboration/protocol.js +2 -0
- package/src/server/domain/collaboration/room-client-state-store.js +28 -0
- package/src/server/domain/collaboration/room-persistence-controller.js +80 -0
- package/src/server/domain/collaboration/room-registry.js +94 -0
- package/src/server/domain/git-service.js +1 -0
- package/src/server/domain/plantuml-encoder.js +49 -0
- package/src/server/domain/plantuml-renderer.js +1 -0
- package/src/server/index.js +72 -0
- package/src/server/infrastructure/git/command-runner.js +48 -0
- package/src/server/infrastructure/git/concurrency.js +19 -0
- package/src/server/infrastructure/git/diff-service.js +389 -0
- package/src/server/infrastructure/git/errors.js +5 -0
- package/src/server/infrastructure/git/git-service.js +216 -0
- package/src/server/infrastructure/git/parsers.js +401 -0
- package/src/server/infrastructure/git/path-utils.js +65 -0
- package/src/server/infrastructure/git/responses.js +108 -0
- package/src/server/infrastructure/git/status-service.js +99 -0
- package/src/server/infrastructure/git/untracked-files.js +101 -0
- package/src/server/infrastructure/http/create-auth-api-handler.js +48 -0
- package/src/server/infrastructure/http/create-esm-proxy-handler.js +130 -0
- package/src/server/infrastructure/http/create-git-api-command-handler.js +170 -0
- package/src/server/infrastructure/http/create-git-api-handler.js +40 -0
- package/src/server/infrastructure/http/create-git-api-query-handler.js +62 -0
- package/src/server/infrastructure/http/create-plantuml-api-handler.js +43 -0
- package/src/server/infrastructure/http/create-request-handler.js +138 -0
- package/src/server/infrastructure/http/create-static-handler.js +167 -0
- package/src/server/infrastructure/http/create-vault-api-command-handler.js +161 -0
- package/src/server/infrastructure/http/create-vault-api-handler.js +43 -0
- package/src/server/infrastructure/http/create-vault-api-query-handler.js +82 -0
- package/src/server/infrastructure/http/http-errors.js +13 -0
- package/src/server/infrastructure/http/http-response.js +167 -0
- package/src/server/infrastructure/http/request-body.js +56 -0
- package/src/server/infrastructure/persistence/path-utils.js +90 -0
- package/src/server/infrastructure/persistence/sidecar-store.js +150 -0
- package/src/server/infrastructure/persistence/vault-content-adapter.js +49 -0
- package/src/server/infrastructure/persistence/vault-file-store.js +435 -0
- package/src/server/infrastructure/plantuml/plantuml-renderer.js +56 -0
- package/src/server/infrastructure/websocket/attach-collaboration-gateway.js +194 -0
- package/src/server/infrastructure/websocket/client-socket-session.js +151 -0
- package/src/server/startup/git-remote-bootstrap.js +435 -0
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import * as awarenessProtocol from 'y-protocols/awareness';
|
|
3
|
+
import * as syncProtocol from 'y-protocols/sync';
|
|
4
|
+
import * as encoding from 'lib0/encoding';
|
|
5
|
+
import * as decoding from 'lib0/decoding';
|
|
6
|
+
|
|
7
|
+
import { MSG_AWARENESS, MSG_SYNC } from './protocol.js';
|
|
8
|
+
import { CollaborationDocumentStore } from './collaboration-document-store.js';
|
|
9
|
+
import { RoomClientStateStore } from './room-client-state-store.js';
|
|
10
|
+
import { RoomPersistenceController } from './room-persistence-controller.js';
|
|
11
|
+
import { populateCommentThreads, serializeCommentThreads } from '../../../domain/comment-threads.js';
|
|
12
|
+
import {
|
|
13
|
+
isExcalidrawRoomDocStructured,
|
|
14
|
+
migrateLegacyExcalidrawRoomData,
|
|
15
|
+
readLegacyExcalidrawRoomScene,
|
|
16
|
+
replaceExcalidrawRoomScene,
|
|
17
|
+
serializeExcalidrawRoomScene,
|
|
18
|
+
tryParseExcalidrawSceneJson,
|
|
19
|
+
} from '../../../domain/excalidraw-room-codec.js';
|
|
20
|
+
|
|
21
|
+
function closeSlowClient(ws, clientState, { maxBufferedAmountBytes, name }) {
|
|
22
|
+
if (!clientState || clientState.backpressureCloseIssued) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
clientState.backpressureCloseIssued = true;
|
|
27
|
+
console.warn(
|
|
28
|
+
`[room:${name}] Closing slow client after bufferedAmount=${ws.bufferedAmount} bytes exceeded ${maxBufferedAmountBytes} bytes`,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
ws.close(1013, 'Client too slow');
|
|
33
|
+
} catch {
|
|
34
|
+
try {
|
|
35
|
+
ws.terminate?.();
|
|
36
|
+
} catch {
|
|
37
|
+
// Ignore termination errors while shedding load.
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function sendMessage(ws, payload, { maxBufferedAmountBytes, name }) {
|
|
45
|
+
const clientState = this?.getClientState?.(ws) ?? null;
|
|
46
|
+
if (ws.readyState !== ws.OPEN) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const bufferedAmountBeforeSend = ws.bufferedAmount;
|
|
51
|
+
|
|
52
|
+
if (bufferedAmountBeforeSend > maxBufferedAmountBytes) {
|
|
53
|
+
return closeSlowClient(ws, clientState, { maxBufferedAmountBytes, name });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
ws.send(payload, (error) => {
|
|
57
|
+
if (error) {
|
|
58
|
+
console.error(`[room:${name}] Failed to send websocket frame:`, error.message);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (bufferedAmountBeforeSend > 0 && ws.bufferedAmount > maxBufferedAmountBytes) {
|
|
63
|
+
return closeSlowClient(ws, clientState, { maxBufferedAmountBytes, name });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function readAwarenessEntries(update) {
|
|
70
|
+
const decoder = decoding.createDecoder(update);
|
|
71
|
+
const count = decoding.readVarUint(decoder);
|
|
72
|
+
const entries = [];
|
|
73
|
+
|
|
74
|
+
for (let index = 0; index < count; index += 1) {
|
|
75
|
+
const clientId = decoding.readVarUint(decoder);
|
|
76
|
+
decoding.readVarUint(decoder);
|
|
77
|
+
const state = JSON.parse(decoding.readVarString(decoder));
|
|
78
|
+
|
|
79
|
+
entries.push({ clientId, state });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return entries;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function isExcalidrawRoom(name) {
|
|
86
|
+
return typeof name === 'string' && name.endsWith('.excalidraw');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export class CollaborationRoom {
|
|
90
|
+
constructor({
|
|
91
|
+
documentStore = null,
|
|
92
|
+
name,
|
|
93
|
+
idleGraceMs = 0,
|
|
94
|
+
maxBufferedAmountBytes,
|
|
95
|
+
vaultFileStore,
|
|
96
|
+
backlinkIndex,
|
|
97
|
+
onEmpty,
|
|
98
|
+
}) {
|
|
99
|
+
this.name = name;
|
|
100
|
+
this.idleGraceMs = idleGraceMs;
|
|
101
|
+
this.maxBufferedAmountBytes = maxBufferedAmountBytes;
|
|
102
|
+
this.documentStore = documentStore ?? new CollaborationDocumentStore({
|
|
103
|
+
backlinkIndex,
|
|
104
|
+
name,
|
|
105
|
+
vaultFileStore,
|
|
106
|
+
});
|
|
107
|
+
this.onEmpty = onEmpty;
|
|
108
|
+
this.doc = new Y.Doc({ gc: true });
|
|
109
|
+
this.awareness = new awarenessProtocol.Awareness(this.doc);
|
|
110
|
+
this.clients = new Set();
|
|
111
|
+
this.clientStates = new RoomClientStateStore();
|
|
112
|
+
this.hydrated = false;
|
|
113
|
+
this.hydratePromise = null;
|
|
114
|
+
this.deleted = false;
|
|
115
|
+
this.destroyed = false;
|
|
116
|
+
this.cachedInitialSyncMessage = null;
|
|
117
|
+
this.activePersistPromise = null;
|
|
118
|
+
this.persistence = new RoomPersistenceController({
|
|
119
|
+
idleGraceMs: this.idleGraceMs,
|
|
120
|
+
onDestroy: () => {
|
|
121
|
+
this.awareness.destroy();
|
|
122
|
+
this.doc.destroy();
|
|
123
|
+
this.onEmpty?.(this.name);
|
|
124
|
+
},
|
|
125
|
+
onPersist: () => this.persist(),
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
this.awareness.setLocalState(null);
|
|
129
|
+
this.registerDocListeners();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async hydrate() {
|
|
133
|
+
if (this.hydrated) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!this.hydratePromise) {
|
|
138
|
+
this.hydratePromise = (async () => {
|
|
139
|
+
if (this.documentStore?.hasPersistence()) {
|
|
140
|
+
const snapshot = await this.documentStore.readSnapshot();
|
|
141
|
+
if (snapshot) {
|
|
142
|
+
try {
|
|
143
|
+
if (isExcalidrawRoom(this.name)) {
|
|
144
|
+
const validationDoc = new Y.Doc({ gc: true });
|
|
145
|
+
try {
|
|
146
|
+
Y.applyUpdate(validationDoc, snapshot, 'hydrate');
|
|
147
|
+
if (!this.ensureStructuredExcalidrawState(validationDoc)) {
|
|
148
|
+
throw new Error('snapshot did not contain a valid structured Excalidraw scene');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
Y.applyUpdate(this.doc, Y.encodeStateAsUpdate(validationDoc), 'hydrate');
|
|
152
|
+
} finally {
|
|
153
|
+
validationDoc.destroy();
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
Y.applyUpdate(this.doc, snapshot, 'hydrate');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
this.hydrated = true;
|
|
160
|
+
return;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
console.warn(
|
|
163
|
+
`[room:${this.name}] Discarding invalid collaboration snapshot: ${error.message}`,
|
|
164
|
+
);
|
|
165
|
+
await this.documentStore.deleteSnapshot?.();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const [content, commentThreads] = await Promise.all([
|
|
170
|
+
this.documentStore.readContent(),
|
|
171
|
+
this.documentStore.readCommentThreads(),
|
|
172
|
+
]);
|
|
173
|
+
if (content !== null || commentThreads.length > 0) {
|
|
174
|
+
const ytext = this.doc.getText('codemirror');
|
|
175
|
+
const comments = this.doc.getArray('comments');
|
|
176
|
+
this.doc.transact(() => {
|
|
177
|
+
if (isExcalidrawRoom(this.name)) {
|
|
178
|
+
const parsedScene = tryParseExcalidrawSceneJson(content);
|
|
179
|
+
if (parsedScene) {
|
|
180
|
+
migrateLegacyExcalidrawRoomData(this.doc, parsedScene);
|
|
181
|
+
} else if (content !== null) {
|
|
182
|
+
ytext.insert(0, content);
|
|
183
|
+
}
|
|
184
|
+
} else if (content !== null) {
|
|
185
|
+
ytext.insert(0, content);
|
|
186
|
+
}
|
|
187
|
+
populateCommentThreads(comments, commentThreads);
|
|
188
|
+
}, 'hydrate');
|
|
189
|
+
|
|
190
|
+
void this.documentStore.writeSnapshot(Y.encodeStateAsUpdate(this.doc)).catch((error) => {
|
|
191
|
+
console.error(`[room:${this.name}] Failed to prime collaboration snapshot: ${error.message}`);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
this.hydrated = true;
|
|
197
|
+
})().catch((error) => {
|
|
198
|
+
this.hydratePromise = null;
|
|
199
|
+
console.error(`[room:${this.name}] Failed to hydrate from disk: ${error.message}`);
|
|
200
|
+
throw error;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
await this.hydratePromise;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
registerDocListeners() {
|
|
208
|
+
this.doc.on('update', (update, origin) => {
|
|
209
|
+
this.cachedInitialSyncMessage = null;
|
|
210
|
+
|
|
211
|
+
if (origin !== 'hydrate' && origin !== 'workspace-reconcile') {
|
|
212
|
+
this.schedulePersist();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const encoder = encoding.createEncoder();
|
|
216
|
+
encoding.writeVarUint(encoder, MSG_SYNC);
|
|
217
|
+
syncProtocol.writeUpdate(encoder, update);
|
|
218
|
+
const message = encoding.toUint8Array(encoder);
|
|
219
|
+
|
|
220
|
+
this.broadcastToClients(message, { excludeClient: origin, failureLabel: 'sync update' });
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
this.awareness.on('update', ({ added, updated, removed }) => {
|
|
224
|
+
const changedClientIds = added.concat(updated, removed);
|
|
225
|
+
|
|
226
|
+
if (changedClientIds.length === 0) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const encoder = encoding.createEncoder();
|
|
231
|
+
encoding.writeVarUint(encoder, MSG_AWARENESS);
|
|
232
|
+
encoding.writeVarUint8Array(
|
|
233
|
+
encoder,
|
|
234
|
+
awarenessProtocol.encodeAwarenessUpdate(this.awareness, changedClientIds),
|
|
235
|
+
);
|
|
236
|
+
const message = encoding.toUint8Array(encoder);
|
|
237
|
+
|
|
238
|
+
this.broadcastToClients(message, { failureLabel: 'awareness update' });
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
getClientState(ws) {
|
|
243
|
+
return this.clientStates.get(ws);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
ensureClientState(ws) {
|
|
247
|
+
const existingState = this.getClientState(ws);
|
|
248
|
+
if (existingState) {
|
|
249
|
+
existingState.backpressureCloseIssued = false;
|
|
250
|
+
return existingState;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return this.clientStates.register(ws);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
deleteClientState(ws) {
|
|
257
|
+
this.clientStates.unregister(ws);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
broadcastToClients(message, { excludeClient = null, failureLabel = 'frame' } = {}) {
|
|
261
|
+
for (const client of this.clients) {
|
|
262
|
+
if (client === excludeClient) {
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
try {
|
|
267
|
+
sendMessage.call(this, client, message, this);
|
|
268
|
+
} catch (error) {
|
|
269
|
+
console.error(`[room:${this.name}] Failed to broadcast ${failureLabel}:`, error.message);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
schedulePersist() {
|
|
275
|
+
if (!this.documentStore?.hasPersistence()) {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
this.persistence.schedulePersist(async () => {
|
|
280
|
+
this.persist().catch((error) => {
|
|
281
|
+
console.error(`[room:${this.name}] Failed to persist document:`, error.message);
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
async persist() {
|
|
287
|
+
if (!this.documentStore?.hasPersistence() || this.deleted) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const previousPersistPromise = this.activePersistPromise;
|
|
292
|
+
const persistPromise = (async () => {
|
|
293
|
+
await previousPersistPromise?.catch(() => {});
|
|
294
|
+
if (!this.documentStore?.hasPersistence() || this.deleted) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const content = this.getPersistedContent();
|
|
299
|
+
if (content === null) {
|
|
300
|
+
console.warn(`[room:${this.name}] Skipping persist because the Excalidraw scene is invalid`);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
const commentThreads = serializeCommentThreads(this.doc.getArray('comments'));
|
|
304
|
+
await this.documentStore.persistState({
|
|
305
|
+
commentThreads,
|
|
306
|
+
content,
|
|
307
|
+
snapshot: Y.encodeStateAsUpdate(this.doc),
|
|
308
|
+
});
|
|
309
|
+
})();
|
|
310
|
+
|
|
311
|
+
const trackedPromise = persistPromise.finally(() => {
|
|
312
|
+
if (this.activePersistPromise === trackedPromise) {
|
|
313
|
+
this.activePersistPromise = null;
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
this.activePersistPromise = trackedPromise;
|
|
317
|
+
await trackedPromise;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
async reloadFromDisk() {
|
|
321
|
+
if (!this.documentStore?.hasPersistence() || this.deleted || this.destroyed) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const [content, commentThreads] = await Promise.all([
|
|
326
|
+
this.documentStore.readContent(),
|
|
327
|
+
this.documentStore.readCommentThreads(),
|
|
328
|
+
]);
|
|
329
|
+
if (content === null) {
|
|
330
|
+
this.markDeleted();
|
|
331
|
+
await this.destroy();
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const ytext = this.doc.getText('codemirror');
|
|
336
|
+
const comments = this.doc.getArray('comments');
|
|
337
|
+
const parsedExcalidrawScene = isExcalidrawRoom(this.name)
|
|
338
|
+
? tryParseExcalidrawSceneJson(content)
|
|
339
|
+
: null;
|
|
340
|
+
if (isExcalidrawRoom(this.name) && !parsedExcalidrawScene) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
this.doc.transact(() => {
|
|
345
|
+
if (isExcalidrawRoom(this.name)) {
|
|
346
|
+
if (ytext.length > 0) {
|
|
347
|
+
ytext.delete(0, ytext.length);
|
|
348
|
+
}
|
|
349
|
+
replaceExcalidrawRoomScene(this.doc, parsedExcalidrawScene);
|
|
350
|
+
} else {
|
|
351
|
+
if (ytext.length > 0) {
|
|
352
|
+
ytext.delete(0, ytext.length);
|
|
353
|
+
}
|
|
354
|
+
if (content) {
|
|
355
|
+
ytext.insert(0, content);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (comments.length > 0) {
|
|
359
|
+
comments.delete(0, comments.length);
|
|
360
|
+
}
|
|
361
|
+
populateCommentThreads(comments, commentThreads);
|
|
362
|
+
}, 'workspace-reconcile');
|
|
363
|
+
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
rename(nextName) {
|
|
368
|
+
if (!nextName || nextName === this.name) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
this.name = nextName;
|
|
373
|
+
this.documentStore?.rename(nextName);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
markDeleted() {
|
|
377
|
+
this.deleted = true;
|
|
378
|
+
this.persistence.cancelAll();
|
|
379
|
+
if (this.clients.size === 0) {
|
|
380
|
+
this.finalizeIfIdle();
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
unmarkDeleted() {
|
|
385
|
+
this.deleted = false;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
isDeleted() {
|
|
389
|
+
return this.deleted;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
getInitialSyncMessage() {
|
|
393
|
+
if (this.cachedInitialSyncMessage) {
|
|
394
|
+
return this.cachedInitialSyncMessage;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const syncEncoder = encoding.createEncoder();
|
|
398
|
+
encoding.writeVarUint(syncEncoder, MSG_SYNC);
|
|
399
|
+
encoding.writeVarUint(syncEncoder, syncProtocol.messageYjsSyncStep2);
|
|
400
|
+
encoding.writeVarUint8Array(syncEncoder, Y.encodeStateAsUpdate(this.doc));
|
|
401
|
+
this.cachedInitialSyncMessage = encoding.toUint8Array(syncEncoder);
|
|
402
|
+
return this.cachedInitialSyncMessage;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
sendInitialSync(ws) {
|
|
406
|
+
return sendMessage.call(this, ws, this.getInitialSyncMessage(), this);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
async addClient(ws, { sendInitialSync: shouldSendInitialSync = true } = {}) {
|
|
410
|
+
this.persistence.markActivity();
|
|
411
|
+
await this.hydrate();
|
|
412
|
+
|
|
413
|
+
this.ensureClientState(ws);
|
|
414
|
+
this.clients.add(ws);
|
|
415
|
+
|
|
416
|
+
if (shouldSendInitialSync) {
|
|
417
|
+
this.sendInitialSync(ws);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const awarenessStates = this.awareness.getStates();
|
|
421
|
+
if (awarenessStates.size > 0) {
|
|
422
|
+
const awarenessEncoder = encoding.createEncoder();
|
|
423
|
+
encoding.writeVarUint(awarenessEncoder, MSG_AWARENESS);
|
|
424
|
+
encoding.writeVarUint8Array(
|
|
425
|
+
awarenessEncoder,
|
|
426
|
+
awarenessProtocol.encodeAwarenessUpdate(this.awareness, Array.from(awarenessStates.keys())),
|
|
427
|
+
);
|
|
428
|
+
sendMessage.call(this, ws, encoding.toUint8Array(awarenessEncoder), this);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
removeClient(ws) {
|
|
433
|
+
if (this.destroyed) {
|
|
434
|
+
this.clients.delete(ws);
|
|
435
|
+
this.deleteClientState(ws);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
const clientState = this.getClientState(ws);
|
|
440
|
+
if (clientState?.controlledClientIds.size) {
|
|
441
|
+
awarenessProtocol.removeAwarenessStates(this.awareness, Array.from(clientState.controlledClientIds), ws);
|
|
442
|
+
clientState.controlledClientIds.clear();
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
this.clients.delete(ws);
|
|
446
|
+
this.deleteClientState(ws);
|
|
447
|
+
|
|
448
|
+
if (this.clients.size > 0) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
this.clearEphemeralExcalidrawHistory();
|
|
453
|
+
this.finalizeIfIdle();
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
async destroy() {
|
|
457
|
+
if (this.destroyed) {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
this.destroyed = true;
|
|
462
|
+
this.persistence.cancelAll();
|
|
463
|
+
await Promise.allSettled([
|
|
464
|
+
this.persistence.finalizePromise,
|
|
465
|
+
this.activePersistPromise,
|
|
466
|
+
]);
|
|
467
|
+
|
|
468
|
+
for (const client of this.clients) {
|
|
469
|
+
try {
|
|
470
|
+
client.close(1001, 'Room reset');
|
|
471
|
+
} catch {
|
|
472
|
+
try {
|
|
473
|
+
client.terminate?.();
|
|
474
|
+
} catch {
|
|
475
|
+
// Ignore shutdown errors while force-resetting rooms.
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
this.clients.clear();
|
|
481
|
+
this.awareness.destroy();
|
|
482
|
+
this.doc.destroy();
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
finalizeIfIdle() {
|
|
486
|
+
return this.persistence.finalizeIfIdle({
|
|
487
|
+
isIdle: () => this.clients.size === 0,
|
|
488
|
+
onPersistError: (error) => {
|
|
489
|
+
console.error(`[room:${this.name}] Failed to persist final room state:`, error.message);
|
|
490
|
+
},
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
clearEphemeralExcalidrawHistory() {
|
|
495
|
+
if (!isExcalidrawRoom(this.name)) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const historyEntries = this.doc.getArray('excalidraw-history');
|
|
500
|
+
const historyState = this.doc.getMap('excalidraw-history-state');
|
|
501
|
+
const hasHistoryEntries = historyEntries.length > 0;
|
|
502
|
+
const hasHistoryState = historyState.size > 0;
|
|
503
|
+
|
|
504
|
+
if (!hasHistoryEntries && !hasHistoryState) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
this.doc.transact(() => {
|
|
509
|
+
if (historyEntries.length > 0) {
|
|
510
|
+
historyEntries.delete(0, historyEntries.length);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
Array.from(historyState.keys()).forEach((key) => {
|
|
514
|
+
historyState.delete(key);
|
|
515
|
+
});
|
|
516
|
+
}, 'excalidraw-history-reset');
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
ensureStructuredExcalidrawState(doc = this.doc) {
|
|
520
|
+
if (!isExcalidrawRoom(this.name)) {
|
|
521
|
+
return true;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
if (isExcalidrawRoomDocStructured(doc)) {
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
const legacyScene = readLegacyExcalidrawRoomScene(doc);
|
|
529
|
+
if (!legacyScene) {
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
doc.transact(() => {
|
|
534
|
+
migrateLegacyExcalidrawRoomData(doc, legacyScene);
|
|
535
|
+
}, 'hydrate');
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
getPersistedContent() {
|
|
540
|
+
if (!isExcalidrawRoom(this.name)) {
|
|
541
|
+
return this.doc.getText('codemirror').toString();
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if (isExcalidrawRoomDocStructured(this.doc)) {
|
|
545
|
+
return serializeExcalidrawRoomScene(this.doc);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const legacyScene = readLegacyExcalidrawRoomScene(this.doc);
|
|
549
|
+
if (!legacyScene) {
|
|
550
|
+
return null;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return JSON.stringify(legacyScene);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
handleMessage(ws, rawData) {
|
|
557
|
+
if (this.destroyed) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
const message = new Uint8Array(rawData);
|
|
562
|
+
|
|
563
|
+
try {
|
|
564
|
+
const decoder = decoding.createDecoder(message);
|
|
565
|
+
const messageType = decoding.readVarUint(decoder);
|
|
566
|
+
|
|
567
|
+
switch (messageType) {
|
|
568
|
+
case MSG_SYNC: {
|
|
569
|
+
const encoder = encoding.createEncoder();
|
|
570
|
+
encoding.writeVarUint(encoder, MSG_SYNC);
|
|
571
|
+
syncProtocol.readSyncMessage(decoder, encoder, this.doc, ws);
|
|
572
|
+
|
|
573
|
+
if (encoding.length(encoder) > 1) {
|
|
574
|
+
sendMessage.call(this, ws, encoding.toUint8Array(encoder), this);
|
|
575
|
+
}
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
case MSG_AWARENESS: {
|
|
580
|
+
const update = decoding.readVarUint8Array(decoder);
|
|
581
|
+
const entries = readAwarenessEntries(update);
|
|
582
|
+
const clientState = this.ensureClientState(ws);
|
|
583
|
+
|
|
584
|
+
for (const entry of entries) {
|
|
585
|
+
if (entry.state === null) {
|
|
586
|
+
clientState.controlledClientIds.delete(entry.clientId);
|
|
587
|
+
} else {
|
|
588
|
+
clientState.controlledClientIds.add(entry.clientId);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
awarenessProtocol.applyAwarenessUpdate(this.awareness, update, ws);
|
|
593
|
+
break;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
default:
|
|
597
|
+
console.warn(`[room:${this.name}] Unsupported message type: ${messageType}`);
|
|
598
|
+
}
|
|
599
|
+
} catch (error) {
|
|
600
|
+
console.error(`[room:${this.name}] Failed to handle message:`, error.message);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function createClientState() {
|
|
2
|
+
return {
|
|
3
|
+
backpressureCloseIssued: false,
|
|
4
|
+
controlledClientIds: new Set(),
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class RoomClientStateStore {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.clientState = new WeakMap();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
register(client) {
|
|
14
|
+
const state = createClientState();
|
|
15
|
+
this.clientState.set(client, state);
|
|
16
|
+
return state;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
unregister(client) {
|
|
20
|
+
const state = this.get(client);
|
|
21
|
+
this.clientState.delete(client);
|
|
22
|
+
return state;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get(client) {
|
|
26
|
+
return this.clientState.get(client) ?? null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export class RoomPersistenceController {
|
|
2
|
+
constructor({
|
|
3
|
+
idleGraceMs = 0,
|
|
4
|
+
onDestroy = null,
|
|
5
|
+
onPersist = null,
|
|
6
|
+
}) {
|
|
7
|
+
this.idleGraceMs = idleGraceMs;
|
|
8
|
+
this.onDestroy = onDestroy;
|
|
9
|
+
this.onPersist = onPersist;
|
|
10
|
+
this.persistTimer = null;
|
|
11
|
+
this.destroyTimer = null;
|
|
12
|
+
this.finalizePromise = null;
|
|
13
|
+
this.shutdownGeneration = 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
markActivity() {
|
|
17
|
+
this.shutdownGeneration += 1;
|
|
18
|
+
clearTimeout(this.destroyTimer);
|
|
19
|
+
this.destroyTimer = null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
cancelAll() {
|
|
23
|
+
this.shutdownGeneration += 1;
|
|
24
|
+
clearTimeout(this.persistTimer);
|
|
25
|
+
clearTimeout(this.destroyTimer);
|
|
26
|
+
this.persistTimer = null;
|
|
27
|
+
this.destroyTimer = null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
schedulePersist(callback = this.onPersist) {
|
|
31
|
+
clearTimeout(this.persistTimer);
|
|
32
|
+
this.persistTimer = setTimeout(() => {
|
|
33
|
+
Promise.resolve(callback?.()).catch((error) => {
|
|
34
|
+
console.error(error);
|
|
35
|
+
});
|
|
36
|
+
}, 500);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async finalizeIfIdle({
|
|
40
|
+
isIdle,
|
|
41
|
+
onPersistError = null,
|
|
42
|
+
onDestroy = this.onDestroy,
|
|
43
|
+
onPersist = this.onPersist,
|
|
44
|
+
}) {
|
|
45
|
+
if (!isIdle()) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const generation = ++this.shutdownGeneration;
|
|
50
|
+
if (this.finalizePromise) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this.finalizePromise = (async () => {
|
|
55
|
+
clearTimeout(this.persistTimer);
|
|
56
|
+
this.persistTimer = null;
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
await onPersist?.();
|
|
60
|
+
} catch (error) {
|
|
61
|
+
onPersistError?.(error);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!isIdle() || generation !== this.shutdownGeneration) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this.destroyTimer = setTimeout(() => {
|
|
69
|
+
if (!isIdle() || generation !== this.shutdownGeneration) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
onDestroy?.();
|
|
74
|
+
}, this.idleGraceMs);
|
|
75
|
+
this.destroyTimer.unref?.();
|
|
76
|
+
})().finally(() => {
|
|
77
|
+
this.finalizePromise = null;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|