hasancode-api-docs 1.0.0
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 +403 -0
- package/client/dist/assets/abap-BdImnpbu.js +1 -0
- package/client/dist/assets/actionscript-3-CoDkCxhg.js +1 -0
- package/client/dist/assets/ada-bCR0ucgS.js +1 -0
- package/client/dist/assets/andromeeda-C4gqWexZ.js +1 -0
- package/client/dist/assets/angular-html-CU67Zn6k.js +1 -0
- package/client/dist/assets/angular-ts-BwZT4LLn.js +1 -0
- package/client/dist/assets/apache-Pmp26Uib.js +1 -0
- package/client/dist/assets/apex-D8_7TLub.js +1 -0
- package/client/dist/assets/apl-dKokRX4l.js +1 -0
- package/client/dist/assets/applescript-Co6uUVPk.js +1 -0
- package/client/dist/assets/ara-BRHolxvo.js +1 -0
- package/client/dist/assets/asciidoc-Ve4PFQV2.js +1 -0
- package/client/dist/assets/asm-D_Q5rh1f.js +1 -0
- package/client/dist/assets/astro-CbQHKStN.js +1 -0
- package/client/dist/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/client/dist/assets/awk-DMzUqQB5.js +1 -0
- package/client/dist/assets/ayu-dark-DYE7WIF3.js +1 -0
- package/client/dist/assets/ayu-light-BA47KaF1.js +1 -0
- package/client/dist/assets/ayu-mirage-32ctXXKs.js +1 -0
- package/client/dist/assets/ballerina-BFfxhgS-.js +1 -0
- package/client/dist/assets/bat-BkioyH1T.js +1 -0
- package/client/dist/assets/beancount-k_qm7-4y.js +1 -0
- package/client/dist/assets/berry-uYugtg8r.js +1 -0
- package/client/dist/assets/bibtex-CHM0blh-.js +1 -0
- package/client/dist/assets/bicep-Bmn6On1c.js +1 -0
- package/client/dist/assets/bird2-DPOp833l.js +1 -0
- package/client/dist/assets/blade-D4QpJJKB.js +1 -0
- package/client/dist/assets/bsl-BO_Y6i37.js +1 -0
- package/client/dist/assets/c-BIGW1oBm.js +1 -0
- package/client/dist/assets/c3-eo99z4R2.js +1 -0
- package/client/dist/assets/cadence-Bv_4Rxtq.js +1 -0
- package/client/dist/assets/cairo-KRGpt6FW.js +1 -0
- package/client/dist/assets/catppuccin-frappe-DFWUc33u.js +1 -0
- package/client/dist/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/client/dist/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/client/dist/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/client/dist/assets/clarity-D53aC0YG.js +1 -0
- package/client/dist/assets/clojure-P80f7IUj.js +1 -0
- package/client/dist/assets/cmake-D1j8_8rp.js +1 -0
- package/client/dist/assets/cobol-nwyudZeR.js +1 -0
- package/client/dist/assets/codeowners-Bp6g37R7.js +1 -0
- package/client/dist/assets/codeql-DsOJ9woJ.js +1 -0
- package/client/dist/assets/coffee-Ch7k5sss.js +1 -0
- package/client/dist/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/client/dist/assets/coq-DkFqJrB1.js +1 -0
- package/client/dist/assets/cpp-CofmeUqb.js +1 -0
- package/client/dist/assets/crystal-tKQVLTB8.js +1 -0
- package/client/dist/assets/csharp-COcwbKMJ.js +1 -0
- package/client/dist/assets/css-DPfMkruS.js +1 -0
- package/client/dist/assets/csv-fuZLfV_i.js +1 -0
- package/client/dist/assets/cue-D82EKSYY.js +1 -0
- package/client/dist/assets/cypher-COkxafJQ.js +1 -0
- package/client/dist/assets/d-85-TOEBH.js +1 -0
- package/client/dist/assets/dark-plus-C3mMm8J8.js +1 -0
- package/client/dist/assets/dart-CF10PKvl.js +1 -0
- package/client/dist/assets/dax-CEL-wOlO.js +1 -0
- package/client/dist/assets/desktop-BmXAJ9_W.js +1 -0
- package/client/dist/assets/diff-D97Zzqfu.js +1 -0
- package/client/dist/assets/docker-BcOcwvcX.js +1 -0
- package/client/dist/assets/dotenv-Da5cRb03.js +1 -0
- package/client/dist/assets/dracula-BzJJZx-M.js +1 -0
- package/client/dist/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/client/dist/assets/dream-maker-BtqSS_iP.js +1 -0
- package/client/dist/assets/edge-BkV0erSs.js +1 -0
- package/client/dist/assets/elixir-CDX3lj18.js +1 -0
- package/client/dist/assets/elm-DbKCFpqz.js +1 -0
- package/client/dist/assets/emacs-lisp-C9XAeP06.js +1 -0
- package/client/dist/assets/erb-B12qg9BL.js +1 -0
- package/client/dist/assets/erlang-DsQrWhSR.js +1 -0
- package/client/dist/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/client/dist/assets/everforest-light-C8M2exoo.js +1 -0
- package/client/dist/assets/fennel-BYunw83y.js +1 -0
- package/client/dist/assets/fish-BvzEVeQv.js +1 -0
- package/client/dist/assets/fluent-C4IJs8-o.js +1 -0
- package/client/dist/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
- package/client/dist/assets/fortran-free-form-BxgE0vQu.js +1 -0
- package/client/dist/assets/fsharp-CXgrBDvD.js +1 -0
- package/client/dist/assets/gdresource-BOOCDP_w.js +1 -0
- package/client/dist/assets/gdscript-C5YyOfLZ.js +1 -0
- package/client/dist/assets/gdshader-DkwncUOv.js +1 -0
- package/client/dist/assets/genie-D0YGMca9.js +1 -0
- package/client/dist/assets/gherkin-DyxjwDmM.js +1 -0
- package/client/dist/assets/git-commit-F4YmCXRG.js +1 -0
- package/client/dist/assets/git-rebase-r7XF79zn.js +1 -0
- package/client/dist/assets/github-dark-DHJKELXO.js +1 -0
- package/client/dist/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/client/dist/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/client/dist/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/client/dist/assets/github-light-DAi9KRSo.js +1 -0
- package/client/dist/assets/github-light-default-D7oLnXFd.js +1 -0
- package/client/dist/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/client/dist/assets/gleam-BspZqrRM.js +1 -0
- package/client/dist/assets/glimmer-js-Rg0-pVw9.js +1 -0
- package/client/dist/assets/glimmer-ts-U6CK756n.js +1 -0
- package/client/dist/assets/glsl-DplSGwfg.js +1 -0
- package/client/dist/assets/gn-n2N0HUVH.js +1 -0
- package/client/dist/assets/gnuplot-DdkO51Og.js +1 -0
- package/client/dist/assets/go-CxLEBnE3.js +1 -0
- package/client/dist/assets/graphql-ChdNCCLP.js +1 -0
- package/client/dist/assets/groovy-gcz8RCvz.js +1 -0
- package/client/dist/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/client/dist/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/client/dist/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/client/dist/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/client/dist/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/client/dist/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/client/dist/assets/hack-CaT9iCJl.js +1 -0
- package/client/dist/assets/haml-B8DHNrY2.js +1 -0
- package/client/dist/assets/handlebars-BL8al0AC.js +1 -0
- package/client/dist/assets/haskell-Df6bDoY_.js +1 -0
- package/client/dist/assets/haxe-CzTSHFRz.js +1 -0
- package/client/dist/assets/hcl-BWvSN4gD.js +1 -0
- package/client/dist/assets/hjson-D5-asLiD.js +1 -0
- package/client/dist/assets/hlsl-D3lLCCz7.js +1 -0
- package/client/dist/assets/horizon-BUw7H-hv.js +1 -0
- package/client/dist/assets/horizon-bright-Cn-bp-IR.js +1 -0
- package/client/dist/assets/houston-DnULxvSX.js +1 -0
- package/client/dist/assets/html-GMplVEZG.js +1 -0
- package/client/dist/assets/html-derivative-BFtXZ54Q.js +1 -0
- package/client/dist/assets/http-jrhK8wxY.js +1 -0
- package/client/dist/assets/hurl-irOxFIW8.js +1 -0
- package/client/dist/assets/hxml-Bvhsp5Yf.js +1 -0
- package/client/dist/assets/hy-DFXneXwc.js +1 -0
- package/client/dist/assets/imba-DGztddWO.js +1 -0
- package/client/dist/assets/index-BdqrFP6U.js +14 -0
- package/client/dist/assets/index-uUjMOcBA.css +1 -0
- package/client/dist/assets/ini-BEwlwnbL.js +1 -0
- package/client/dist/assets/java-CylS5w8V.js +1 -0
- package/client/dist/assets/javascript-wDzz0qaB.js +1 -0
- package/client/dist/assets/jinja-4LBKfQ-Z.js +1 -0
- package/client/dist/assets/jison-wvAkD_A8.js +1 -0
- package/client/dist/assets/json-Cp-IABpG.js +1 -0
- package/client/dist/assets/json5-C9tS-k6U.js +1 -0
- package/client/dist/assets/jsonc-Des-eS-w.js +1 -0
- package/client/dist/assets/jsonl-DcaNXYhu.js +1 -0
- package/client/dist/assets/jsonnet-DFQXde-d.js +1 -0
- package/client/dist/assets/jssm-C2t-YnRu.js +1 -0
- package/client/dist/assets/jsx-g9-lgVsj.js +1 -0
- package/client/dist/assets/julia-CxzCAyBv.js +1 -0
- package/client/dist/assets/just-Cw27pwNe.js +1 -0
- package/client/dist/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/client/dist/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/client/dist/assets/kanagawa-wave-DWedfzmr.js +1 -0
- package/client/dist/assets/kdl-DV7GczEv.js +1 -0
- package/client/dist/assets/kotlin-BdnUsdx6.js +1 -0
- package/client/dist/assets/kusto-DZf3V79B.js +1 -0
- package/client/dist/assets/laserwave-DUszq2jm.js +1 -0
- package/client/dist/assets/latex-CWtU0Tv5.js +1 -0
- package/client/dist/assets/lean-BZvkOJ9d.js +1 -0
- package/client/dist/assets/less-B1dDrJ26.js +1 -0
- package/client/dist/assets/light-plus-B7mTdjB0.js +1 -0
- package/client/dist/assets/liquid-DYVedYrR.js +1 -0
- package/client/dist/assets/llvm-DjAJT7YJ.js +1 -0
- package/client/dist/assets/log-2UxHyX5q.js +1 -0
- package/client/dist/assets/logo-BtOb2qkB.js +1 -0
- package/client/dist/assets/lua-BaeVxFsk.js +1 -0
- package/client/dist/assets/luau-C-HG3fhB.js +1 -0
- package/client/dist/assets/make-CHLpvVh8.js +1 -0
- package/client/dist/assets/markdown-Cvjx9yec.js +1 -0
- package/client/dist/assets/marko-CnJfTvn9.js +1 -0
- package/client/dist/assets/material-theme-D5KoaKCx.js +1 -0
- package/client/dist/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/client/dist/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/client/dist/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/client/dist/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/client/dist/assets/matlab-D7o27uSR.js +1 -0
- package/client/dist/assets/mdc-BMNejdWA.js +1 -0
- package/client/dist/assets/mdx-Cmh6b_Ma.js +1 -0
- package/client/dist/assets/mermaid-mWjccvbQ.js +1 -0
- package/client/dist/assets/min-dark-CafNBF8u.js +1 -0
- package/client/dist/assets/min-light-CTRr51gU.js +1 -0
- package/client/dist/assets/mipsasm-CKIfxQSi.js +1 -0
- package/client/dist/assets/mojo-rZm6bMo-.js +1 -0
- package/client/dist/assets/monokai-D4h5O-jR.js +1 -0
- package/client/dist/assets/moonbit-_H4v1dQx.js +1 -0
- package/client/dist/assets/move-IF9eRakj.js +1 -0
- package/client/dist/assets/narrat-DRg8JJMk.js +1 -0
- package/client/dist/assets/nextflow-Zz6hmt5N.js +1 -0
- package/client/dist/assets/nextflow-groovy-BeH2EWoN.js +1 -0
- package/client/dist/assets/nginx-BpAMiNFr.js +1 -0
- package/client/dist/assets/night-owl-C39BiMTA.js +1 -0
- package/client/dist/assets/night-owl-light-CMTm3GFP.js +1 -0
- package/client/dist/assets/nim-CVrawwO9.js +1 -0
- package/client/dist/assets/nix-CwoSXNpI.js +1 -0
- package/client/dist/assets/nord-Ddv68eIx.js +1 -0
- package/client/dist/assets/nushell-Cz2AlsmD.js +1 -0
- package/client/dist/assets/objective-c-DXmwc3jG.js +1 -0
- package/client/dist/assets/objective-cpp-CLxacb5B.js +1 -0
- package/client/dist/assets/ocaml-C0hk2d4L.js +1 -0
- package/client/dist/assets/odin-BBf5iR-q.js +1 -0
- package/client/dist/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/client/dist/assets/one-light-C3Wv6jpd.js +1 -0
- package/client/dist/assets/openscad-C4EeE6gA.js +1 -0
- package/client/dist/assets/pascal-D93ZcfNL.js +1 -0
- package/client/dist/assets/perl-C0TMdlhV.js +1 -0
- package/client/dist/assets/php-Dhbhpdrm.js +1 -0
- package/client/dist/assets/pkl-u5AG7uiY.js +1 -0
- package/client/dist/assets/plastic-3e1v2bzS.js +1 -0
- package/client/dist/assets/plsql-ChMvpjG-.js +1 -0
- package/client/dist/assets/po-BTJTHyun.js +1 -0
- package/client/dist/assets/poimandres-CS3Unz2-.js +1 -0
- package/client/dist/assets/polar-C0HS_06l.js +1 -0
- package/client/dist/assets/postcss-CXtECtnM.js +1 -0
- package/client/dist/assets/powerquery-CEu0bR-o.js +1 -0
- package/client/dist/assets/powershell-Dpen1YoG.js +1 -0
- package/client/dist/assets/prisma-Dd19v3D-.js +1 -0
- package/client/dist/assets/prolog-CbFg5uaA.js +1 -0
- package/client/dist/assets/proto-C7zT0LnQ.js +1 -0
- package/client/dist/assets/pug-CGlum2m_.js +1 -0
- package/client/dist/assets/puppet-BMWR74SV.js +1 -0
- package/client/dist/assets/purescript-CklMAg4u.js +1 -0
- package/client/dist/assets/python-B6aJPvgy.js +1 -0
- package/client/dist/assets/qml-3beO22l8.js +1 -0
- package/client/dist/assets/qmldir-C8lEn-DE.js +1 -0
- package/client/dist/assets/qss-IeuSbFQv.js +1 -0
- package/client/dist/assets/r-Dspwwk_N.js +1 -0
- package/client/dist/assets/racket-BqYA7rlc.js +1 -0
- package/client/dist/assets/raku-DXvB9xmW.js +1 -0
- package/client/dist/assets/razor-Uh8Bk_45.js +1 -0
- package/client/dist/assets/red-bN70gL4F.js +1 -0
- package/client/dist/assets/reg-C-SQnVFl.js +1 -0
- package/client/dist/assets/regexp-CDVJQ6XC.js +1 -0
- package/client/dist/assets/rel-C3B-1QV4.js +1 -0
- package/client/dist/assets/riscv-BM1_JUlF.js +1 -0
- package/client/dist/assets/ron-D8l8udqQ.js +1 -0
- package/client/dist/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/client/dist/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/client/dist/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/client/dist/assets/rosmsg-BJDFO7_C.js +1 -0
- package/client/dist/assets/rst-BrH8l1NY.js +1 -0
- package/client/dist/assets/ruby-Dw2BHqvy.js +1 -0
- package/client/dist/assets/rust-B1yitclQ.js +1 -0
- package/client/dist/assets/sas-cz2c8ADy.js +1 -0
- package/client/dist/assets/sass-Cj5Yp3dK.js +1 -0
- package/client/dist/assets/scala-C151Ov-r.js +1 -0
- package/client/dist/assets/scheme-C98Dy4si.js +1 -0
- package/client/dist/assets/scss-OYdSNvt2.js +1 -0
- package/client/dist/assets/sdbl-DVxCFoDh.js +1 -0
- package/client/dist/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/client/dist/assets/shellscript-Yzrsuije.js +1 -0
- package/client/dist/assets/shellsession-BADoaaVG.js +1 -0
- package/client/dist/assets/slack-dark-BthQWCQV.js +1 -0
- package/client/dist/assets/slack-ochin-DqwNpetd.js +1 -0
- package/client/dist/assets/smalltalk-BERRCDM3.js +1 -0
- package/client/dist/assets/snazzy-light-Bw305WKR.js +1 -0
- package/client/dist/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/client/dist/assets/solarized-light-L9t79GZl.js +1 -0
- package/client/dist/assets/solidity-rGO070M0.js +1 -0
- package/client/dist/assets/soy-Brmx7dQM.js +1 -0
- package/client/dist/assets/sparql-rVzFXLq3.js +1 -0
- package/client/dist/assets/splunk-BtCnVYZw.js +1 -0
- package/client/dist/assets/sql-BLtJtn59.js +1 -0
- package/client/dist/assets/ssh-config-_ykCGR6B.js +1 -0
- package/client/dist/assets/stata-BH5u7GGu.js +1 -0
- package/client/dist/assets/stylus-BEDo0Tqx.js +1 -0
- package/client/dist/assets/surrealql-Bq5Q-fJD.js +1 -0
- package/client/dist/assets/svelte-C_ipcX3V.js +1 -0
- package/client/dist/assets/swift-D82vCrfD.js +1 -0
- package/client/dist/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/client/dist/assets/system-verilog-CnnmHF94.js +1 -0
- package/client/dist/assets/systemd-4A_iFExJ.js +1 -0
- package/client/dist/assets/talonscript-CkByrt1z.js +1 -0
- package/client/dist/assets/tasl-QIJgUcNo.js +1 -0
- package/client/dist/assets/tcl-dwOrl1Do.js +1 -0
- package/client/dist/assets/templ-P3uqSqPl.js +1 -0
- package/client/dist/assets/terraform-BETggiCN.js +1 -0
- package/client/dist/assets/tex-idrVyKtj.js +1 -0
- package/client/dist/assets/tokyo-night-hegEt444.js +1 -0
- package/client/dist/assets/toml-vGWfd6FD.js +1 -0
- package/client/dist/assets/ts-tags-zn1MmPIZ.js +1 -0
- package/client/dist/assets/tsv-B_m7g4N7.js +1 -0
- package/client/dist/assets/tsx-COt5Ahok.js +1 -0
- package/client/dist/assets/turtle-BsS91CYL.js +1 -0
- package/client/dist/assets/twig-DNn4PbVi.js +1 -0
- package/client/dist/assets/typescript-BPQ3VLAy.js +1 -0
- package/client/dist/assets/typespec-BGHnOYBU.js +1 -0
- package/client/dist/assets/typst-DHCkPAjA.js +1 -0
- package/client/dist/assets/v-BcVCzyr7.js +1 -0
- package/client/dist/assets/vala-CsfeWuGM.js +1 -0
- package/client/dist/assets/vb-D17OF-Vu.js +1 -0
- package/client/dist/assets/vendor-r6CGHiWc.js +16 -0
- package/client/dist/assets/verilog-BQ8w6xss.js +1 -0
- package/client/dist/assets/vesper-DU1UobuO.js +1 -0
- package/client/dist/assets/vhdl-CeAyd5Ju.js +1 -0
- package/client/dist/assets/viml-CJc9bBzg.js +1 -0
- package/client/dist/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/client/dist/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/client/dist/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/client/dist/assets/vue-DN_0RTcg.js +1 -0
- package/client/dist/assets/vue-html-AaS7Mt5G.js +1 -0
- package/client/dist/assets/vue-vine-CQOfvN7w.js +1 -0
- package/client/dist/assets/vyper-CDx5xZoG.js +1 -0
- package/client/dist/assets/wasm-CG6Dc4jp.js +1 -0
- package/client/dist/assets/wasm-MzD3tlZU.js +1 -0
- package/client/dist/assets/wenyan-BV7otONQ.js +1 -0
- package/client/dist/assets/wgsl-Dx-B1_4e.js +1 -0
- package/client/dist/assets/wikitext-BhOHFoWU.js +1 -0
- package/client/dist/assets/wit-5i3qLPDT.js +1 -0
- package/client/dist/assets/wolfram-lXgVvXCa.js +1 -0
- package/client/dist/assets/xml-sdJ4AIDG.js +1 -0
- package/client/dist/assets/xsl-CtQFsRM5.js +1 -0
- package/client/dist/assets/yaml-Buea-lGh.js +1 -0
- package/client/dist/assets/zenscript-DVFEvuxE.js +1 -0
- package/client/dist/assets/zig-VOosw3JB.js +1 -0
- package/client/dist/index.html +23 -0
- package/client/dist/logo.png +0 -0
- package/dist/code-theme.d.ts +69 -0
- package/dist/code-theme.js +69 -0
- package/dist/decorators/MetadataDecorators.d.ts +56 -0
- package/dist/decorators/MetadataDecorators.js +196 -0
- package/dist/decorators/MethodDecorators.d.ts +40 -0
- package/dist/decorators/MethodDecorators.js +98 -0
- package/dist/decorators/ParameterDecorators.d.ts +33 -0
- package/dist/decorators/ParameterDecorators.js +158 -0
- package/dist/define/DefineDoc.d.ts +39 -0
- package/dist/define/DefineDoc.js +90 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +37 -0
- package/dist/middleware/ApiDoc.d.ts +75 -0
- package/dist/middleware/ApiDoc.js +307 -0
- package/dist/middleware/RouteDoc.js +47 -0
- package/dist/registry/RouteRegistry.d.ts +103 -0
- package/dist/registry/RouteRegistry.js +70 -0
- package/package.json +55 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.ApiDoc = void 0;
|
|
46
|
+
const express_1 = require("express");
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const fs = __importStar(require("fs"));
|
|
49
|
+
const marked_1 = require("marked");
|
|
50
|
+
const RouteRegistry_1 = require("../registry/RouteRegistry");
|
|
51
|
+
const code_theme_1 = require("../code-theme");
|
|
52
|
+
/**
|
|
53
|
+
* Main API Documentation class
|
|
54
|
+
*/
|
|
55
|
+
class ApiDoc {
|
|
56
|
+
constructor(config) {
|
|
57
|
+
this.DOCS_PATH = "/api-docs"; // Fixed path
|
|
58
|
+
this.clientPath = this.resolveClientPath();
|
|
59
|
+
this.config = config; // Set initial config
|
|
60
|
+
this.configReady = this.normalizeConfig(config);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Normalize configuration with defaults
|
|
64
|
+
*/
|
|
65
|
+
normalizeConfig(config) {
|
|
66
|
+
// Convert description to HTML if it exists
|
|
67
|
+
if (config === null || config === void 0 ? void 0 : config.description) {
|
|
68
|
+
const html = marked_1.marked.parse(config.description.toString());
|
|
69
|
+
config.description = '<div class="md__code">' + html + "</div>";
|
|
70
|
+
}
|
|
71
|
+
this.config = Object.assign(Object.assign({}, config), { baseUrl: config.baseUrl || "http://localhost:5000", theme: Object.assign({ primaryColor: "#3b82f6", secondaryColor: "#8b5cf6", accentColor: "#10b981", backgroundColor: "#ffffff", sidebarBackgroundColor: "#1f2937", codeTheme: code_theme_1.CODE_THEMES.VITESSE_BLACK }, config.theme) });
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Resolve client path
|
|
75
|
+
*/
|
|
76
|
+
resolveClientPath() {
|
|
77
|
+
const possiblePaths = [
|
|
78
|
+
path.join(__dirname, "../../client/dist"),
|
|
79
|
+
path.join(__dirname, "../client/dist"),
|
|
80
|
+
path.join(__dirname, "../../../client/dist"),
|
|
81
|
+
];
|
|
82
|
+
for (const testPath of possiblePaths) {
|
|
83
|
+
if (fs.existsSync(testPath) &&
|
|
84
|
+
fs.existsSync(path.join(testPath, "index.html"))) {
|
|
85
|
+
return testPath;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return path.join(__dirname, "../../client/dist");
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Convert route metadata to API documentation format
|
|
92
|
+
*/
|
|
93
|
+
convertRoutesToSections() {
|
|
94
|
+
const routes = RouteRegistry_1.routeRegistry.getAll();
|
|
95
|
+
const sections = [];
|
|
96
|
+
// Group routes by tags
|
|
97
|
+
const grouped = new Map();
|
|
98
|
+
const untagged = [];
|
|
99
|
+
for (const route of routes) {
|
|
100
|
+
if (route.tags && route.tags.length > 0) {
|
|
101
|
+
for (const tag of route.tags) {
|
|
102
|
+
if (!grouped.has(tag)) {
|
|
103
|
+
grouped.set(tag, []);
|
|
104
|
+
}
|
|
105
|
+
grouped.get(tag).push(route);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
untagged.push(route);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Create sections for each tag
|
|
113
|
+
for (const [tag, tagRoutes] of grouped.entries()) {
|
|
114
|
+
sections.push({
|
|
115
|
+
name: tag.toLowerCase().replace(/\s+/g, "-"),
|
|
116
|
+
label: tag,
|
|
117
|
+
type: "GROUP",
|
|
118
|
+
items: tagRoutes.map((route) => this.convertRouteToSection(route)),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
// Add untagged routes
|
|
122
|
+
if (untagged.length > 0) {
|
|
123
|
+
sections.push({
|
|
124
|
+
name: "other",
|
|
125
|
+
label: "Other Endpoints",
|
|
126
|
+
type: "GROUP",
|
|
127
|
+
items: untagged.map((route) => this.convertRouteToSection(route)),
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return sections;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Convert single route to section format
|
|
134
|
+
*/
|
|
135
|
+
convertRouteToSection(route) {
|
|
136
|
+
if (route === null || route === void 0 ? void 0 : route.description) {
|
|
137
|
+
const parsed = marked_1.marked.parse(route.description.toString());
|
|
138
|
+
route.description = '<div class="md__code">' + parsed + "</div>";
|
|
139
|
+
}
|
|
140
|
+
if (route === null || route === void 0 ? void 0 : route.summary) {
|
|
141
|
+
const parsed = marked_1.marked.parse(route.summary.toString());
|
|
142
|
+
route.summary = '<div class="md__code">' + parsed + "</div>";
|
|
143
|
+
}
|
|
144
|
+
if (route === null || route === void 0 ? void 0 : route.note) {
|
|
145
|
+
const parsed = marked_1.marked.parse(route.note.toString());
|
|
146
|
+
route.note = '<div class="md__code">' + parsed + "</div>";
|
|
147
|
+
}
|
|
148
|
+
const section = {
|
|
149
|
+
name: `${route.method}${route.path}`
|
|
150
|
+
.replace(/[/:]/g, "-")
|
|
151
|
+
.replace("--", "-"),
|
|
152
|
+
label: `${route.method.toUpperCase()} ${route.path}`,
|
|
153
|
+
type: "ITEM",
|
|
154
|
+
content: route.description,
|
|
155
|
+
api: {
|
|
156
|
+
method: route.method,
|
|
157
|
+
path: route.path,
|
|
158
|
+
summary: route.summary,
|
|
159
|
+
description: route.description,
|
|
160
|
+
deprecated: route.deprecated,
|
|
161
|
+
note: route.note,
|
|
162
|
+
tags: route.tags,
|
|
163
|
+
auth: route.auth,
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
if (route.params && route.params.length > 0) {
|
|
167
|
+
section.api.params = route.params;
|
|
168
|
+
}
|
|
169
|
+
if (route.query && route.query.length > 0) {
|
|
170
|
+
section.api.query = route.query;
|
|
171
|
+
}
|
|
172
|
+
if (route.headers && route.headers.length > 0) {
|
|
173
|
+
section.api.headers = route.headers;
|
|
174
|
+
}
|
|
175
|
+
if (route.body) {
|
|
176
|
+
section.api.body = {
|
|
177
|
+
contentType: route.body.contentType,
|
|
178
|
+
required: route.body.required,
|
|
179
|
+
description: route.body.description,
|
|
180
|
+
schema: route.body.schema,
|
|
181
|
+
example: route.body.example,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
if (route.responses && route.responses.length > 0) {
|
|
185
|
+
section.api.responses = {};
|
|
186
|
+
for (const response of route.responses) {
|
|
187
|
+
section.api.responses[response.statusCode] = {
|
|
188
|
+
description: response.description,
|
|
189
|
+
contentType: response.contentType,
|
|
190
|
+
schema: response.schema,
|
|
191
|
+
example: response.example,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return section;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Get Express middleware - automatically mounts at /api-docs
|
|
199
|
+
* Usage: app.use(apiDoc.middleware())
|
|
200
|
+
*/
|
|
201
|
+
middleware() {
|
|
202
|
+
const router = (0, express_1.Router)();
|
|
203
|
+
router.get(`${this.DOCS_PATH}/config.json`, this.serveConfig.bind(this));
|
|
204
|
+
router.use(`${this.DOCS_PATH}/assets`, (0, express_1.static)(path.join(this.clientPath, "assets"), {
|
|
205
|
+
maxAge: "1d",
|
|
206
|
+
etag: true,
|
|
207
|
+
fallthrough: false,
|
|
208
|
+
setHeaders: (res, path) => {
|
|
209
|
+
if (path.endsWith(".js")) {
|
|
210
|
+
res.setHeader("Content-Type", "application/javascript");
|
|
211
|
+
}
|
|
212
|
+
else if (path.endsWith(".css")) {
|
|
213
|
+
res.setHeader("Content-Type", "text/css");
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
}));
|
|
217
|
+
router.use(this.serveApp.bind(this));
|
|
218
|
+
return router;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Serve configuration
|
|
222
|
+
*/
|
|
223
|
+
serveConfig(req, res) {
|
|
224
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
+
// Wait for config to be ready
|
|
226
|
+
yield this.configReady;
|
|
227
|
+
// Auto-generate sections from decorated routes
|
|
228
|
+
const sections = this.convertRoutesToSections();
|
|
229
|
+
const runtimeConfig = {
|
|
230
|
+
config: Object.assign(Object.assign({}, this.config), { sections }),
|
|
231
|
+
basePath: this.DOCS_PATH,
|
|
232
|
+
};
|
|
233
|
+
res.json(runtimeConfig);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Serve the React app
|
|
238
|
+
*/
|
|
239
|
+
serveApp(req, res) {
|
|
240
|
+
const indexPath = path.join(this.clientPath, "index.html");
|
|
241
|
+
if (fs.existsSync(indexPath)) {
|
|
242
|
+
let html = fs.readFileSync(indexPath, "utf-8");
|
|
243
|
+
// Inject base tag with trailing slash for proper asset resolution
|
|
244
|
+
const baseTag = `<base href="${this.DOCS_PATH}/">`;
|
|
245
|
+
// Insert base tag right after <head> or before any other tags
|
|
246
|
+
if (html.includes("<base")) {
|
|
247
|
+
// Replace existing base tag
|
|
248
|
+
html = html.replace(/<base[^>]*>/i, baseTag);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
// Insert new base tag
|
|
252
|
+
html = html.replace(/<head>/i, `<head>${baseTag}`);
|
|
253
|
+
}
|
|
254
|
+
res.setHeader("Content-Type", "text/html");
|
|
255
|
+
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
256
|
+
res.send(html);
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
res.status(404).send(`
|
|
260
|
+
<html>
|
|
261
|
+
<head>
|
|
262
|
+
<title>API Docs - Not Built</title>
|
|
263
|
+
<style>
|
|
264
|
+
body {
|
|
265
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
266
|
+
max-width: 600px;
|
|
267
|
+
margin: 100px auto;
|
|
268
|
+
padding: 20px;
|
|
269
|
+
text-align: center;
|
|
270
|
+
}
|
|
271
|
+
h1 { color: #e53e3e; }
|
|
272
|
+
code {
|
|
273
|
+
background: #f7fafc;
|
|
274
|
+
padding: 2px 6px;
|
|
275
|
+
border-radius: 4px;
|
|
276
|
+
}
|
|
277
|
+
</style>
|
|
278
|
+
</head>
|
|
279
|
+
<body>
|
|
280
|
+
<h1>⚠️ Client Not Built</h1>
|
|
281
|
+
<p>Please run <code>npm run build</code> first.</p>
|
|
282
|
+
<p><small>Looking at: ${this.clientPath}</small></p>
|
|
283
|
+
</body>
|
|
284
|
+
</html>
|
|
285
|
+
`);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Get all registered routes
|
|
290
|
+
*/
|
|
291
|
+
getRoutes() {
|
|
292
|
+
return RouteRegistry_1.routeRegistry.getAll();
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Clear all routes (useful for testing)
|
|
296
|
+
*/
|
|
297
|
+
clearRoutes() {
|
|
298
|
+
RouteRegistry_1.routeRegistry.clear();
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Get the documentation path
|
|
302
|
+
*/
|
|
303
|
+
getDocsPath() {
|
|
304
|
+
return this.DOCS_PATH;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
exports.ApiDoc = ApiDoc;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doc = doc;
|
|
4
|
+
const RouteRegistry_1 = require("../registry/RouteRegistry");
|
|
5
|
+
/**
|
|
6
|
+
* doc() — Express route middleware that registers API documentation.
|
|
7
|
+
*
|
|
8
|
+
* Two signatures:
|
|
9
|
+
*
|
|
10
|
+
* ① As a standalone middleware — method & path come from Express router:
|
|
11
|
+
*
|
|
12
|
+
* router.post('/users', doc({ summary: 'Create user', ... }), handler);
|
|
13
|
+
*
|
|
14
|
+
* ② Wrapping the handler directly (handler runs after doc is registered):
|
|
15
|
+
*
|
|
16
|
+
* router.post('/signin/:userType',
|
|
17
|
+
* validateRequest(schema),
|
|
18
|
+
* doc({ summary: 'Sign in', tags: ['Auth'], ... }, AuthControllers.signin),
|
|
19
|
+
* );
|
|
20
|
+
*/
|
|
21
|
+
function doc(options, handler) {
|
|
22
|
+
let registered = false; // register once per route, not on every request
|
|
23
|
+
const middleware = (req, res, next) => {
|
|
24
|
+
var _a, _b, _c, _d;
|
|
25
|
+
if (!registered) {
|
|
26
|
+
registered = true;
|
|
27
|
+
// Express populates req.route only once the route is matched
|
|
28
|
+
// (i.e. on the first real request). We use that to get method & path.
|
|
29
|
+
const method = ((_b = (_a = req.method) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : "get");
|
|
30
|
+
// req.route.path gives us the pattern (/users/:id),
|
|
31
|
+
// NOT the actual URL — exactly what we want for docs.
|
|
32
|
+
const path = (_d = (_c = req.route) === null || _c === void 0 ? void 0 : _c.path) !== null && _d !== void 0 ? _d : req.path;
|
|
33
|
+
const routeDoc = Object.assign({ method,
|
|
34
|
+
path }, options);
|
|
35
|
+
console.log(routeDoc);
|
|
36
|
+
RouteRegistry_1.routeRegistry.register(routeDoc);
|
|
37
|
+
}
|
|
38
|
+
// If the user passed a handler as second arg, call it directly
|
|
39
|
+
if (handler) {
|
|
40
|
+
return handler(req, res, next);
|
|
41
|
+
}
|
|
42
|
+
next();
|
|
43
|
+
};
|
|
44
|
+
// Mark this middleware so ApiDoc can identify it if needed
|
|
45
|
+
middleware.__isDocMiddleware = true;
|
|
46
|
+
return middleware;
|
|
47
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
/**
|
|
3
|
+
* Metadata keys for decorator information
|
|
4
|
+
*/
|
|
5
|
+
export declare const MetadataKeys: {
|
|
6
|
+
ROUTE: string;
|
|
7
|
+
METHOD: string;
|
|
8
|
+
PATH: string;
|
|
9
|
+
SUMMARY: string;
|
|
10
|
+
DESCRIPTION: string;
|
|
11
|
+
TAGS: string;
|
|
12
|
+
DEPRECATED: string;
|
|
13
|
+
PARAMS: string;
|
|
14
|
+
QUERY: string;
|
|
15
|
+
BODY: string;
|
|
16
|
+
HEADERS: string;
|
|
17
|
+
RESPONSES: string;
|
|
18
|
+
AUTH: string;
|
|
19
|
+
};
|
|
20
|
+
export type HttpMethod = "get" | "post" | "put" | "patch" | "delete";
|
|
21
|
+
/**
|
|
22
|
+
* Route metadata structure
|
|
23
|
+
*/
|
|
24
|
+
export interface RouteMetadata {
|
|
25
|
+
method: HttpMethod;
|
|
26
|
+
path: string;
|
|
27
|
+
summary?: string;
|
|
28
|
+
note?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
tags?: string[];
|
|
31
|
+
deprecated?: boolean;
|
|
32
|
+
params?: ParamMetadata[];
|
|
33
|
+
query?: ParamMetadata[];
|
|
34
|
+
body?: BodyMetadata;
|
|
35
|
+
headers?: ParamMetadata[];
|
|
36
|
+
responses?: ResponseMetadata[];
|
|
37
|
+
auth?: boolean | AuthMetadata;
|
|
38
|
+
}
|
|
39
|
+
export interface ParamMetadata {
|
|
40
|
+
name: string;
|
|
41
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
42
|
+
required?: boolean;
|
|
43
|
+
description?: string;
|
|
44
|
+
example?: any;
|
|
45
|
+
default?: any;
|
|
46
|
+
enum?: any[];
|
|
47
|
+
pattern?: string;
|
|
48
|
+
minimum?: number;
|
|
49
|
+
maximum?: number;
|
|
50
|
+
minLength?: number;
|
|
51
|
+
maxLength?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface BodyMetadata {
|
|
54
|
+
contentType?: string;
|
|
55
|
+
required?: boolean;
|
|
56
|
+
description?: string;
|
|
57
|
+
schema: Record<string, ParamMetadata>;
|
|
58
|
+
example?: any;
|
|
59
|
+
}
|
|
60
|
+
export interface ResponseMetadata {
|
|
61
|
+
statusCode: number;
|
|
62
|
+
description: string;
|
|
63
|
+
contentType?: string;
|
|
64
|
+
schema?: Record<string, ParamMetadata>;
|
|
65
|
+
example?: any;
|
|
66
|
+
}
|
|
67
|
+
export interface AuthMetadata {
|
|
68
|
+
required: boolean;
|
|
69
|
+
type?: "Bearer" | "Basic" | "ApiKey";
|
|
70
|
+
scopes?: string[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Global route registry
|
|
74
|
+
*/
|
|
75
|
+
declare class RouteRegistry {
|
|
76
|
+
private routes;
|
|
77
|
+
/**
|
|
78
|
+
* Generate unique key using method + path
|
|
79
|
+
*/
|
|
80
|
+
private generateKey;
|
|
81
|
+
/**
|
|
82
|
+
* Register a route
|
|
83
|
+
*/
|
|
84
|
+
register(metadata: RouteMetadata): void;
|
|
85
|
+
/**
|
|
86
|
+
* Get a specific route
|
|
87
|
+
*/
|
|
88
|
+
get(method: HttpMethod, path: string): RouteMetadata | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Get all registered routes
|
|
91
|
+
*/
|
|
92
|
+
getAll(): RouteMetadata[];
|
|
93
|
+
/**
|
|
94
|
+
* Clear all routes (useful for testing)
|
|
95
|
+
*/
|
|
96
|
+
clear(): void;
|
|
97
|
+
/**
|
|
98
|
+
* Get routes by tag
|
|
99
|
+
*/
|
|
100
|
+
getByTag(tag: string): RouteMetadata[];
|
|
101
|
+
}
|
|
102
|
+
export declare const routeRegistry: RouteRegistry;
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.routeRegistry = exports.MetadataKeys = void 0;
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
/**
|
|
6
|
+
* Metadata keys for decorator information
|
|
7
|
+
*/
|
|
8
|
+
exports.MetadataKeys = {
|
|
9
|
+
ROUTE: "api:route",
|
|
10
|
+
METHOD: "api:method",
|
|
11
|
+
PATH: "api:path",
|
|
12
|
+
SUMMARY: "api:summary",
|
|
13
|
+
DESCRIPTION: "api:description",
|
|
14
|
+
TAGS: "api:tags",
|
|
15
|
+
DEPRECATED: "api:deprecated",
|
|
16
|
+
PARAMS: "api:params",
|
|
17
|
+
QUERY: "api:query",
|
|
18
|
+
BODY: "api:body",
|
|
19
|
+
HEADERS: "api:headers",
|
|
20
|
+
RESPONSES: "api:responses",
|
|
21
|
+
AUTH: "api:auth",
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Global route registry
|
|
25
|
+
*/
|
|
26
|
+
class RouteRegistry {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.routes = new Map();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Generate unique key using method + path
|
|
32
|
+
*/
|
|
33
|
+
generateKey(metadata) {
|
|
34
|
+
return `${metadata.method.toUpperCase()}.${metadata.path}`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Register a route
|
|
38
|
+
*/
|
|
39
|
+
register(metadata) {
|
|
40
|
+
const key = this.generateKey(metadata);
|
|
41
|
+
this.routes.set(key, metadata);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get a specific route
|
|
45
|
+
*/
|
|
46
|
+
get(method, path) {
|
|
47
|
+
const key = `${method.toUpperCase()}.${path}`;
|
|
48
|
+
return this.routes.get(key);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get all registered routes
|
|
52
|
+
*/
|
|
53
|
+
getAll() {
|
|
54
|
+
return Array.from(this.routes.values());
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Clear all routes (useful for testing)
|
|
58
|
+
*/
|
|
59
|
+
clear() {
|
|
60
|
+
this.routes.clear();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get routes by tag
|
|
64
|
+
*/
|
|
65
|
+
getByTag(tag) {
|
|
66
|
+
return this.getAll().filter((route) => route.tags && route.tags.includes(tag));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Singleton instance
|
|
70
|
+
exports.routeRegistry = new RouteRegistry();
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hasancode-api-docs",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A simple and easy to use API documentation generator for Express.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc && cd client && tsc -b && vite build",
|
|
9
|
+
"prepublishOnly": "npm run build"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/",
|
|
13
|
+
"client/dist/",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"api",
|
|
19
|
+
"documentation",
|
|
20
|
+
"express",
|
|
21
|
+
"typescript",
|
|
22
|
+
"decorators",
|
|
23
|
+
"swagger",
|
|
24
|
+
"openapi",
|
|
25
|
+
"auto-generate"
|
|
26
|
+
],
|
|
27
|
+
"author": "Mehedi Hasan <mehedi01616720009@gmail.com>",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/Mehedi01616720009/api-docs.git"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/Mehedi01616720009/api-docs#readme",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/Mehedi01616720009/api-docs/issues"
|
|
36
|
+
},
|
|
37
|
+
"type": "commonjs",
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/express": "^5.0.6",
|
|
40
|
+
"@types/node": "^25.2.3",
|
|
41
|
+
"typescript": "^5.9.3"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"express": "^4.0.0",
|
|
45
|
+
"fs": "^0.0.1-security",
|
|
46
|
+
"marked": "^17.0.2",
|
|
47
|
+
"reflect-metadata": "^0.2.2"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"express": "^4.0.0"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=20.0.0"
|
|
54
|
+
}
|
|
55
|
+
}
|