@redocly/cli 0.0.0-snapshot.1790673161 → 0.0.0-snapshot.1791280335
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/README.md +2 -0
- package/THIRD_PARTY_NOTICES +60 -54
- package/lib/chunks/2JEJKRBC.js +7 -0
- package/lib/chunks/{4X5R7U43.js → 42LIHL2J.js} +1 -1
- package/lib/chunks/4PTNG4EI.js +7 -0
- package/lib/chunks/{AFPC3KID.js → 4TIHLZUM.js} +2 -2
- package/lib/chunks/4URSCMZY.js +14 -0
- package/lib/chunks/4YTHQAQD.js +22 -0
- package/lib/chunks/{7BMFS4Z5.js → 546XKUFV.js} +1 -1
- package/lib/chunks/56B2PEMJ.js +160 -0
- package/lib/chunks/64G5RPLP.js +7 -0
- package/lib/chunks/{3U2KNDZX.js → 6OF6WPDR.js} +1 -1
- package/lib/chunks/7XAVHDLK.js +20 -0
- package/lib/chunks/7XC2742P.js +9 -0
- package/lib/chunks/7XENG2AG.js +29 -0
- package/lib/chunks/{5AUAYKG6.js → A3O4CFXU.js} +1 -1
- package/lib/chunks/ABO36WUM.js +14 -0
- package/lib/chunks/{KMNJCAYW.js → AGBTB7SF.js} +1 -1
- package/lib/chunks/{G7C4T7FQ.js → ANSTN7SQ.js} +1 -1
- package/lib/chunks/{S7GXYJSH.js → BDU7XBDE.js} +1 -1
- package/lib/chunks/{LWSTVQJL.js → BSZNFVAC.js} +1 -1
- package/lib/chunks/BUNUOEXU.js +193 -0
- package/lib/chunks/C7IX7N3U.js +15 -0
- package/lib/chunks/{AMJOKSAL.js → CGKP6TSH.js} +1 -1
- package/lib/chunks/DGP3IDIG.js +9 -0
- package/lib/chunks/{4BGSRF5B.js → DPOMAGAR.js} +1 -1
- package/lib/chunks/{HYKAUCSR.js → DQKO5XDM.js} +1 -1
- package/lib/chunks/DSHKKVPX.js +34 -0
- package/lib/chunks/{S4WOFWA5.js → DVHGNHJZ.js} +1 -1
- package/lib/chunks/G7G7A6XX.js +8 -0
- package/lib/chunks/GGGXO3UN.js +31 -0
- package/lib/chunks/GHSNC2OX.js +9 -0
- package/lib/chunks/GVH5LHLQ.js +11 -0
- package/lib/chunks/H4VN2RX3.js +7 -0
- package/lib/chunks/HBN3S25U.js +119 -0
- package/lib/chunks/HBUZKWXC.js +7 -0
- package/lib/chunks/{KDBUTZUT.js → HUUX2UUW.js} +1 -1
- package/lib/chunks/{GHERRC6V.js → HVE6RZ4R.js} +1 -1
- package/lib/chunks/{JNIZCD5S.js → I7HDPQ2C.js} +2 -2
- package/lib/chunks/I7VUDVNB.js +10 -0
- package/lib/chunks/{DENZJW7D.js → ILBEVBDT.js} +4 -4
- package/lib/chunks/ILLCTJMD.js +11 -0
- package/lib/chunks/IWKQTMKX.js +34 -0
- package/lib/chunks/{Y2HPLCNE.js → JJ7KI5WQ.js} +1 -1
- package/lib/chunks/K56YYY4N.js +13 -0
- package/lib/chunks/{VH6GY6BQ.js → KMFAJMIP.js} +1 -1
- package/lib/chunks/{JQWZYX6X.js → KNVZGXO6.js} +1 -1
- package/lib/chunks/{VPKT5TZ6.js → KTN4AYMQ.js} +1 -1
- package/lib/chunks/{HMYPQDEJ.js → M4QICE7Q.js} +1 -1
- package/lib/chunks/{5AL5JLUI.js → MBEO5G25.js} +1 -1
- package/lib/chunks/ML6MFXCA.js +7 -0
- package/lib/chunks/OC6XELWE.js +7 -0
- package/lib/chunks/{GIOCLCJ6.js → ON4ODZIF.js} +3 -3
- package/lib/chunks/{N3TSMQIC.js → P5JVM5UN.js} +1 -1
- package/lib/chunks/{J7XSOBV7.js → PLQ7NN6L.js} +1 -1
- package/lib/chunks/{PBOXQ3TE.js → PQFDRWBM.js} +1 -1
- package/lib/chunks/{7IAPU2U2.js → Q5DRJ5BO.js} +1 -1
- package/lib/chunks/{KPFGQW4F.js → QMECI4L6.js} +1 -1
- package/lib/chunks/{UV4CQHAM.js → QYVTDZMH.js} +1 -1
- package/lib/chunks/{UFJGOTOA.js → RBG32GXZ.js} +1 -1
- package/lib/chunks/RJ4PV7HC.js +7 -0
- package/lib/chunks/SJHPKWSD.js +9 -0
- package/lib/chunks/SU3AKTM6.js +13 -0
- package/lib/chunks/T2G7FRCU.js +23 -0
- package/lib/chunks/{DG5WCCVN.js → TBQ7P3DK.js} +1 -1
- package/lib/chunks/{YTXW7XO6.js → TVESFIJK.js} +1 -1
- package/lib/chunks/U5DIFWGH.js +7 -0
- package/lib/chunks/{7IULUVWX.js → UF2ZCH7W.js} +1 -1
- package/lib/chunks/{ZZI3UHKX.js → UQ3FZRBO.js} +1 -1
- package/lib/chunks/{GSOISRWG.js → URUDAUJD.js} +2 -2
- package/lib/chunks/{55D5R2CI.js → W2PV4V5E.js} +1 -1
- package/lib/chunks/{NH4WYS7F.js → W2SGNRC5.js} +1 -1
- package/lib/chunks/WCT7KLVB.js +7 -0
- package/lib/chunks/WSDNWUOV.js +7 -0
- package/lib/chunks/{Z2G5S6QY.js → XHDX7P6U.js} +1 -1
- package/lib/chunks/XOSKBT2Y.js +17 -0
- package/lib/chunks/Y37KNOTN.js +10 -0
- package/lib/chunks/YB6QNBDE.js +18 -0
- package/lib/chunks/{PHZLEQDI.js → YHCJDOPH.js} +1 -1
- package/lib/chunks/{6TPSUBEU.js → YITMY64K.js} +1 -1
- package/lib/chunks/{Z5IC4SW3.js → ZIMUTQSS.js} +1 -1
- package/lib/chunks/index.aff +205 -0
- package/lib/chunks/index.dic +49569 -0
- package/lib/eject-assets/generators/cli/docs.ts +1 -1
- package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
- package/lib/eject-assets/generators/cli/index.ts +2 -2
- package/lib/eject-assets/generators/cli/render.ts +1 -1
- package/lib/eject-assets/generators/go/client.ts +1 -1
- package/lib/eject-assets/generators/go/descriptor.ts +1 -1
- package/lib/eject-assets/generators/go/index.ts +2 -2
- package/lib/eject-assets/generators/go/models.ts +1 -1
- package/lib/eject-assets/generators/go/naming.ts +1 -1
- package/lib/eject-assets/generators/go/operations.ts +1 -1
- package/lib/eject-assets/generators/go/pagination.ts +1 -1
- package/lib/eject-assets/generators/go/types.ts +1 -1
- package/lib/eject-assets/generators/mock/faker.ts +1 -1
- package/lib/eject-assets/generators/mock/index.ts +2 -2
- package/lib/eject-assets/generators/mock/render.ts +1 -1
- package/lib/eject-assets/generators/mock/sample.ts +1 -1
- package/lib/eject-assets/generators/mock/values.ts +1 -1
- package/lib/eject-assets/generators/php/client.ts +1 -1
- package/lib/eject-assets/generators/php/descriptor.ts +1 -1
- package/lib/eject-assets/generators/php/index.ts +24 -23
- package/lib/eject-assets/generators/php/models.ts +1 -1
- package/lib/eject-assets/generators/php/naming.ts +1 -1
- package/lib/eject-assets/generators/php/operations.ts +2 -2
- package/lib/eject-assets/generators/php/pagination.ts +2 -2
- package/lib/eject-assets/generators/php/types.ts +1 -1
- package/lib/eject-assets/generators/python/client.ts +1 -1
- package/lib/eject-assets/generators/python/descriptor.ts +1 -1
- package/lib/eject-assets/generators/python/index.ts +2 -2
- package/lib/eject-assets/generators/python/models.ts +1 -1
- package/lib/eject-assets/generators/python/naming.ts +1 -1
- package/lib/eject-assets/generators/python/operations.ts +1 -1
- package/lib/eject-assets/generators/python/pagination.ts +1 -1
- package/lib/eject-assets/generators/python/types.ts +1 -1
- package/lib/eject-assets/generators/swr/index.ts +2 -2
- package/lib/eject-assets/generators/swr/render.ts +1 -1
- package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
- package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
- package/lib/eject-assets/generators/transformers/index.ts +2 -2
- package/lib/eject-assets/generators/transformers/render.ts +1 -1
- package/lib/eject-assets/generators/typescript/banner.ts +1 -1
- package/lib/eject-assets/generators/typescript/client.ts +1 -1
- package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
- package/lib/eject-assets/generators/typescript/index.ts +2 -2
- package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
- package/lib/eject-assets/generators/typescript/operations.ts +1 -1
- package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
- package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
- package/lib/eject-assets/generators/typescript/types.ts +1 -1
- package/lib/eject-assets/generators/zod/index.ts +2 -2
- package/lib/eject-assets/generators/zod/schemas.ts +1 -1
- package/lib/eject-assets/skills/php-generator/SKILL.md +5 -0
- package/lib/index.js +85 -295
- package/package.json +1 -1
- package/lib/chunks/3P2RGSZJ.js +0 -13
- package/lib/chunks/5ZUHMZG3.js +0 -30
- package/lib/chunks/FY3KXOKN.js +0 -11
- package/lib/chunks/HSCVR6IQ.js +0 -7
- package/lib/chunks/HXPNR55A.js +0 -193
- package/lib/chunks/KURCC526.js +0 -7
- package/lib/chunks/LZ2TTGJR.js +0 -22
- package/lib/chunks/N5FQZNDC.js +0 -8
- package/lib/chunks/NABUP3PL.js +0 -47
- package/lib/chunks/NWGQGGMR.js +0 -13
- package/lib/chunks/QSWITRBO.js +0 -9
package/README.md
CHANGED
|
@@ -66,6 +66,8 @@ npx skills add https://redocly.com
|
|
|
66
66
|
- `redocly-cli` — day-to-day usage: lint, bundle, decorate, build docs, test, and generate a client.
|
|
67
67
|
- `redocly-lint-rules` — turn a check written in plain language into a built-in rule, a configurable rule, or a custom plugin.
|
|
68
68
|
It also covers migrating rules from other linters, such as Spectral.
|
|
69
|
+
- `recheck-lint` — run `redocly recheck` on the Markdown the assistant touched, fix what it finds, and never suppress findings to pass.
|
|
70
|
+
- `recheck-config` — write and tune the `recheck` block in `redocly.yaml` from measured counts, and adopt a baseline on a large document set.
|
|
69
71
|
|
|
70
72
|
## Common tasks
|
|
71
73
|
|
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
Third-party software bundled in @redocly/cli
|
|
2
2
|
|
|
3
|
+
============================================================
|
|
4
|
+
(MIT AND BSD)
|
|
5
|
+
|
|
6
|
+
Packages:
|
|
7
|
+
dictionary-en@4.0.0
|
|
8
|
+
|
|
9
|
+
License text:
|
|
10
|
+
(no license text found)
|
|
11
|
+
|
|
3
12
|
============================================================
|
|
4
13
|
(MPL-2.0 OR Apache-2.0)
|
|
5
14
|
|
|
@@ -623,19 +632,21 @@ Packages:
|
|
|
623
632
|
zod-to-json-schema@3.25.2 — Copyright (c) 2020, Stefan Terdell
|
|
624
633
|
|
|
625
634
|
License text:
|
|
626
|
-
|
|
635
|
+
The ISC License
|
|
636
|
+
|
|
637
|
+
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
627
638
|
|
|
628
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
629
|
-
with or without fee is hereby granted, provided that the above
|
|
630
|
-
and this permission notice appear in all copies.
|
|
639
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
640
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
641
|
+
copyright notice and this permission notice appear in all copies.
|
|
631
642
|
|
|
632
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
633
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
634
|
-
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
635
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
636
|
-
OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
637
|
-
|
|
638
|
-
THIS SOFTWARE.
|
|
643
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
644
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
645
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
646
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
647
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
648
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
649
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
639
650
|
|
|
640
651
|
============================================================
|
|
641
652
|
MIT
|
|
@@ -651,18 +662,20 @@ Packages:
|
|
|
651
662
|
@noble/hashes@1.8.0 — Copyright (c) 2022 Paul Miller (https://paulmillr.com)
|
|
652
663
|
@redocly/ajv@8.11.2 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
653
664
|
@redocly/ajv@8.18.3 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
654
|
-
@redocly/cli-otel@0.3.
|
|
665
|
+
@redocly/cli-otel@0.3.7 — Copyright 2025 Redocly Inc, all rights reserved.
|
|
655
666
|
@redocly/config@0.22.0 — Copyright 2024 Redocly Inc.
|
|
656
|
-
@redocly/config@0.
|
|
667
|
+
@redocly/config@0.61.1 — Copyright 2024 Redocly Inc.
|
|
657
668
|
@redocly/openapi-core@1.34.20
|
|
658
669
|
agent-base@7.1.4 — Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
|
659
670
|
ajv-formats@3.0.1 — Copyright (c) 2020 Evgeny Poberezkin
|
|
660
671
|
ajv@8.20.0 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
672
|
+
ansi-regex@6.4.0
|
|
661
673
|
ansi-styles@4.3.0
|
|
662
674
|
balanced-match@1.0.2 — Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
663
675
|
brace-expansion@2.1.4 — Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
664
676
|
call-me-maybe@1.0.2 — Copyright (c) 2015 Eric McCarthy
|
|
665
677
|
chalk@4.1.2
|
|
678
|
+
character-entities@2.0.2
|
|
666
679
|
classnames@2.5.1 — Copyright (c) 2018 Jed Watson
|
|
667
680
|
clsx@2.1.1
|
|
668
681
|
color-convert@2.0.1 — Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>
|
|
@@ -673,17 +686,21 @@ Packages:
|
|
|
673
686
|
cookie@0.7.2 — Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
|
|
674
687
|
cross-spawn@7.0.6 — Copyright (c) 2018 Made With MOXY Lda <hello@moxy.studio>
|
|
675
688
|
debug@4.4.3 — Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
|
689
|
+
decode-named-character-reference@1.3.0
|
|
676
690
|
escalade@3.2.0
|
|
677
691
|
eventemitter3@5.0.1 — Copyright (c) 2014 Arnout Kazemier
|
|
678
692
|
eventsource-parser@3.1.1 — Copyright (c) 2026 Espen Hovlandsdal <espen@hovlandsdal.com>
|
|
679
693
|
eventsource@3.0.7 — Copyright (c) EventSource GitHub organisation
|
|
680
694
|
fast-deep-equal@3.1.3 — Copyright (c) 2017 Evgeny Poberezkin
|
|
681
695
|
fast-safe-stringify@2.1.1 — Copyright (c) 2016 David Mark Clements
|
|
696
|
+
fault@2.0.1
|
|
682
697
|
foreach@2.0.6 — Copyright (c) 2013 Manuel Stofer
|
|
698
|
+
get-east-asian-width@1.7.0
|
|
683
699
|
graphql@16.14.2 — Copyright (c) GraphQL Contributors
|
|
684
700
|
handlebars@4.7.9 — Copyright (C) 2011-2019 by Yehuda Katz
|
|
685
701
|
has-flag@4.0.0
|
|
686
702
|
https-proxy-agent@7.0.6 — Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
|
703
|
+
is-buffer@2.0.5 — Copyright (c) Feross Aboukhadijeh
|
|
687
704
|
js-levenshtein@1.1.6 — Copyright (c) 2017 Gustaf Andersson
|
|
688
705
|
js-tokens@4.0.0 — Copyright (c) 2014, 2015, 2016, 2017, 2018 Simon Lydell
|
|
689
706
|
js-yaml@4.3.2 — Copyright (C) 2011-2015 by Vitaly Puzrin
|
|
@@ -694,16 +711,41 @@ Packages:
|
|
|
694
711
|
leven@3.1.0
|
|
695
712
|
lunr@2.3.9 — Copyright (C) 2013 by Oliver Nightingale
|
|
696
713
|
mark.js@8.11.1 — Copyright (c) 2014–2018 Julian Kühnel
|
|
714
|
+
micromark-core-commonmark@2.0.4
|
|
715
|
+
micromark-extension-directive@4.0.0
|
|
716
|
+
micromark-extension-frontmatter@2.0.0
|
|
717
|
+
micromark-extension-gfm-autolink-literal@2.1.0
|
|
718
|
+
micromark-extension-gfm-footnote@2.1.0
|
|
719
|
+
micromark-extension-gfm-table@2.1.2
|
|
720
|
+
micromark-extension-math@3.1.0
|
|
721
|
+
micromark-factory-destination@2.0.1
|
|
722
|
+
micromark-factory-label@2.0.1
|
|
723
|
+
micromark-factory-space@2.1.0
|
|
724
|
+
micromark-factory-title@2.0.1
|
|
725
|
+
micromark-factory-whitespace@2.0.1
|
|
726
|
+
micromark-util-character@2.1.1
|
|
727
|
+
micromark-util-chunked@2.0.1
|
|
728
|
+
micromark-util-classify-character@2.0.1
|
|
729
|
+
micromark-util-combine-extensions@2.0.1
|
|
730
|
+
micromark-util-edit-map@1.0.0
|
|
731
|
+
micromark-util-html-tag-name@2.0.1
|
|
732
|
+
micromark-util-normalize-identifier@2.0.1
|
|
733
|
+
micromark-util-resolve-all@2.0.1
|
|
734
|
+
micromark-util-subtokenize@2.1.0
|
|
735
|
+
micromark-util-symbol@2.0.1
|
|
736
|
+
micromark@4.0.3
|
|
697
737
|
mobx-react-lite@4.1.1 — Copyright (c) 2015 Michel Weststrate
|
|
698
738
|
mobx-react@9.2.0 — Copyright (c) 2015 Michel Weststrate
|
|
699
739
|
mobx@6.12.3 — Copyright (c) 2015 Michel Weststrate
|
|
700
740
|
ms@2.1.3
|
|
741
|
+
nspell@2.1.5
|
|
701
742
|
object-assign@4.1.1
|
|
702
743
|
openapi-sampler@1.7.5 — Copyright (c) 2017 Roman Hotsiy <gotsijroman@gmail.com>
|
|
703
744
|
outdent@0.8.0 — Copyright (c) 2016 Andrew Bradley
|
|
704
745
|
path-key@3.1.1
|
|
705
746
|
perfect-scrollbar@1.5.6 — Copyright (c) 2012-2019 Hyunje Jun, MDBootstrap.com and other contributors
|
|
706
747
|
picomatch@4.0.4 — Copyright (c) 2017-present, Jon Schlinkert.
|
|
748
|
+
picomatch@4.0.7 — Copyright (c) 2017-present, Jon Schlinkert.
|
|
707
749
|
pkce-challenge@5.0.1 — Copyright (c) 2019
|
|
708
750
|
pluralize@8.0.0 — Copyright (c) 2013 Blake Embrey (hello@blakeembrey.com)
|
|
709
751
|
polished@4.3.1 — Copyright (c) 2016-Present Brian Hough and Maximilian Stoiber
|
|
@@ -718,6 +760,8 @@ Packages:
|
|
|
718
760
|
shebang-command@2.0.0
|
|
719
761
|
shebang-regex@3.0.0
|
|
720
762
|
slugify@1.4.7 — Copyright (c) Simeon Velichkov <simeonvelichkov@gmail.com>
|
|
763
|
+
string-width@8.3.0
|
|
764
|
+
strip-ansi@7.2.0
|
|
721
765
|
styled-components@6.4.2 — Copyright (c) 2016-present Glen Maddern and Maximilian Stoiber
|
|
722
766
|
stylis@4.3.6 — Copyright (c) 2016-present Sultan Tarimo
|
|
723
767
|
supports-color@7.2.0
|
|
@@ -730,53 +774,15 @@ Packages:
|
|
|
730
774
|
zod@4.4.3 — Copyright (c) 2025 Colin McDonnell
|
|
731
775
|
|
|
732
776
|
License text:
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
736
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
737
|
-
in the Software without restriction, including without limitation the rights
|
|
738
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
739
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
740
|
-
furnished to do so, subject to the following conditions:
|
|
741
|
-
|
|
742
|
-
The above copyright notice and this permission notice shall be included in
|
|
743
|
-
all copies or substantial portions of the Software.
|
|
744
|
-
|
|
745
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
746
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
747
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
748
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
749
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
750
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
751
|
-
THE SOFTWARE.
|
|
777
|
+
(no license text found)
|
|
752
778
|
|
|
753
779
|
============================================================
|
|
754
780
|
unknown
|
|
755
781
|
|
|
756
782
|
Packages:
|
|
757
783
|
decko@1.2.0 — Copyright (c) 2017 Jason Miller
|
|
784
|
+
format@0.2.2
|
|
758
785
|
stickyfill@1.1.1 — Copyright (c) 2014 Oleg Korsunsky
|
|
759
786
|
|
|
760
787
|
License text:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
Copyright (c) 2014 Oleg Korsunsky
|
|
764
|
-
Copyright (c) 2014 Automattic Inc.
|
|
765
|
-
|
|
766
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
767
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
768
|
-
in the Software without restriction, including without limitation the rights
|
|
769
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
770
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
771
|
-
furnished to do so, subject to the following conditions:
|
|
772
|
-
|
|
773
|
-
The above copyright notice and this permission notice shall be included in
|
|
774
|
-
all copies or substantial portions of the Software.
|
|
775
|
-
|
|
776
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
777
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
778
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
779
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
780
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
781
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
782
|
-
THE SOFTWARE.
|
|
788
|
+
(no license text found)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{c as r}from"./BUNUOEXU.js";var s="components",p="paths",i="webhooks",O="x-webhooks",c="channels",f="operations";function e(o,n){if(r(o)){n(o);for(let t of Object.keys(o))e(o[t],n)}else if(Array.isArray(o))for(let t of o)e(t,n)}function S(o){return o.startsWith(`#/${s}/`)}export{s as a,p as b,i as c,O as d,c as e,f,e as g,S as h};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as $,b as a,c,d as i,e as m,f}from"./
|
|
7
|
+
import{a as $,b as a,c,d as i,e as m,f}from"./M4QICE7Q.js";import{k as l}from"./LD5MEXEL.js";import{join as p}from"node:path";function k(t,n){let e=$(t,"swr");if(e.length===0)return"";let s=e.some(a),o=e.some(r=>!a(r));return[...s?['import useSWR from "swr";']:[],...o?['import useSWRMutation from "swr/mutation";']:[],f(e,n.sdkModule,s),...e.flatMap(r=>a(r)?g(r):[S(r)])].join(`
|
|
8
8
|
|
|
9
9
|
`)}function y(t,n,e){return`export function use${l(t.name)}(${n}) {
|
|
10
10
|
return ${e};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
var e={realm:"@redocly/realm","redoc-revel":"@redocly/redoc-revel","revel-reef":"@redocly/revel-reef","redoc-reef":"@redocly/redoc-reef",redoc:"@redocly/redoc",revel:"@redocly/revel",reef:"@redocly/reef"},r={redoc:"Redoc",revel:"Revel",reef:"Reef",realm:"Realm","redoc-revel":"Redoc + Revel","redoc-reef":"Redoc + Reef","revel-reef":"Revel + Reef"},o=["pro","enterprise"];export{e as a,r as b,o as c};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as G}from"./
|
|
7
|
+
import{a as G}from"./PQFDRWBM.js";import{c as x,d as C,e as fe,h as N,j as I,k as ue,v as _,w as B}from"./KMFAJMIP.js";import{a as ae,b as Y,c as ce,d as pe}from"./SU3AKTM6.js";import{a as ie}from"./64G5RPLP.js";import"./JJ7KI5WQ.js";import{O as re,P as v,c as g,ia as S,l as O,oa as oe,ta as se}from"./BUNUOEXU.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{mkdir as jt,writeFile as kt}from"node:fs/promises";import At from"node:path";var Be=/^[a-zA-Z][a-zA-Z0-9]*(?:[_\-.][a-zA-Z0-9]+)*$/,De=/^[0-9a-f-]{8,}$/i,ze=[["uuid",/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i],["date-time",/^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:[Zz]|[+-]\d{2}:\d{2})$/],["date",/^\d{4}-\d{2}-\d{2}$/],["email",/^[^\s@]+@[^\s@]+\.[^\s@]+$/],["uri",/^https?:\/\/\S+$/],["ipv4",/^(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)$/]],M=new WeakMap;function D(e){return{formats:ze.filter(([,t])=>t.test(e)).map(([t])=>t),values:[e],count:1,overflow:!1}}function q(e,t){if(!e)return t;if(!t)return e;let n={formats:e.formats.filter(r=>t.formats.includes(r)),values:[],count:e.count+t.count,overflow:e.overflow||t.overflow};if(!n.overflow){let r=[...e.values];for(let o of t.values)r.includes(o)||r.push(o);r.length>10?n.overflow=!0:n.values=r}return n}function z(e,t){M.set(e,t)}function H(e){return M.get(e)}function V(e,t){let n=M.get(e);n&&M.set(t,n)}function He(e){return e.length<=30&&!De.test(e)&&Be.test(e)}function K(e,t){return e.formats.length>0?{format:e.formats[0]}:t&&!e.overflow&&e.count>=4&&e.values.length>0&&e.values.length<=5&&e.values.length*2<=e.count&&e.values.every(He)?{enum:[...e.values].sort()}:{}}function $(e){let t=M.get(e);if(t){let n=typeof e.type=="string"?[e.type]:e.type??[];n.includes("string")&&Object.assign(e,K(t,n.length===1))}for(let n of Object.values(e.properties??{}))$(n);e.additionalProperties&&$(e.additionalProperties),e.items&&$(e.items);for(let n of e.oneOf??[])$(n)}function me(e){for(let t of Object.values(e.paths))for(let n of Object.values(t)){for(let r of Object.values(n.requestBody?.content??{}))$(r.schema);for(let r of Object.values(n.responses))for(let o of Object.values(r.content??{}))$(o.schema)}for(let t of Object.values(e.components?.schemas??{}))$(t);return e}var be=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,F=/^\d+$/,Ve=/^[0-9a-hjkmnp-tv-z]{26}$/i,Ue=/^[a-z][a-z0-9]*_(?=[0-9a-z]*\d)[0-9a-z]{10,}$/i,Fe=/^[a-z](?=[a-z0-9]*\d)[a-z0-9]{23,24}$/,X=new Set(ie),Le=new Set(["get","head"]),de="application/x-www-form-urlencoded",le="multipart/form-data";function Ye(e){return e?F.test(e)||be.test(e)||Ve.test(e)||Ue.test(e)||Fe.test(e)?!0:/^[0-9a-f]{16,}$/i.test(e):!1}function Z(e){let t=e.split("/"),n=[],r=new Set;return{template:t.map((s,c)=>{if(!Ye(s))return s;let i=t[c-1],a=i?`${O(i,1)}Id`:"id",p=1;for(;r.has(a);)p+=1,a=i?`${O(i,1)}Id${p}`:`id${p}`;return r.add(a),n.push({name:a,value:s}),`{${a}}`}).join("/")||"/",params:n}}function j(e){if(e===null)return{type:"null"};if(Array.isArray(e)){if(e.length===0)return{type:"array"};let t=e.slice(0,20).map(j);return{type:"array",items:J(t)}}switch(typeof e){case"string":{let t={type:"string"};return z(t,D(e)),t}case"boolean":return{type:"boolean"};case"number":return Number.isInteger(e)?{type:"integer"}:{type:"number"};case"object":{let t=Object.entries(e);if(t.length>0&&(t.every(([c])=>F.test(c))||t.every(([c])=>be.test(c))))return{type:"object",additionalProperties:J(t.map(([,c])=>j(c)))};let n={},r=[];for(let[s,c]of t)n[s]=j(c),r.push(s);let o={type:"object",properties:n};return r.length>0&&(o.required=r),o}default:return{}}}function J(e){if(e.length===0)return{};let[t,...n]=e,r=t;for(let o of n)r=U(r,o);return r}function he(e){return Object.keys(e).length===0}function k(e){return e.additionalProperties?"map":e.type==="object"?"object":e.type==="array"?"array":"scalar"}function W(e){return e.oneOf?e.oneOf.flatMap(W):Array.isArray(e.type)?e.type.map(t=>{if(t==="object"){let r={type:"object"};return e.properties&&(r.properties=e.properties),e.required&&(r.required=e.required),e.additionalProperties&&(r.additionalProperties=e.additionalProperties),r}if(t==="array")return e.items?{type:"array",items:e.items}:{type:"array"};let n={type:t};return t==="string"&&V(e,n),n}):[e]}var Ke=.5,We=3;function Oe(e,t){let n=Object.keys(e.properties??{}),r=Object.keys(t.properties??{});if(n.length===0||r.length===0)return 1;let o=new Set(r),s=n.filter(c=>o.has(c)).length;return s/(n.length+r.length-s)}function Xe(e,t){let n=k(e);if(n!==k(t))return!1;switch(n){case"scalar":return e.type===t.type||e.type==="integer"&&t.type==="number"||e.type==="number"&&t.type==="integer";case"object":return Oe(e,t)>=Ke;default:return!0}}function ve(e,t){switch(k(e)){case"scalar":{if(e.type!==t.type)return{type:"number"};if(e.type==="string"){let n=q(H(e),H(t));if(n){let r={type:"string"};return z(r,n),r}}return e}case"map":return{type:"object",additionalProperties:U(e.additionalProperties??{},t.additionalProperties??{})};case"object":{let n={...e.properties??{}};for(let[c,i]of Object.entries(t.properties??{}))n[c]=n[c]?U(n[c],i):i;let r=new Set(t.required??[]),o=(e.required??[]).filter(c=>r.has(c)),s={type:"object",properties:n};return o.length>0&&(s.required=o),s}case"array":{if(!e.items||!t.items){let n=e.items??t.items;return n?{type:"array",items:n}:{type:"array"}}return{type:"array",items:U(e.items,t.items)}}}}function Ze(e){let t=[...e],n=()=>t.filter(r=>k(r)==="object").length;for(;n()>We;){let r=-1,o=-1,s=-1;for(let c=0;c<t.length;c++)if(k(t[c])==="object")for(let i=c+1;i<t.length;i++){if(k(t[i])!=="object")continue;let a=Oe(t[c],t[i]);a>s&&(s=a,r=c,o=i)}t[r]=ve(t[r],t[o]),t.splice(o,1)}return t}var Qe=["boolean","integer","number","string","null"];function et(e){if(e.length===1)return e[0];let t=[],n=new Set,r;for(let i of e)k(i)==="scalar"&&typeof i.type=="string"?(n.add(i.type),i.type==="string"&&(r=q(r,H(i)))):t.push(i);let o=Qe.filter(i=>n.has(i)),s=i=>{let a={type:i};return(typeof i=="string"?i==="string":i.includes("string"))&&r&&z(a,r),a};if(t.length===0)return o.length===1?s(o[0]):s(o);if(t.length===1&&o.length===1&&o[0]==="null"&&typeof t[0].type=="string")return{...t[0],type:[t[0].type,"null"]};let c=[...t];return o.length===1?c.push(s(o[0])):o.length>1&&c.push(s(o)),{oneOf:c}}function U(e,t){if(he(e)||he(t))return{};let n=W(e);for(let r of W(t)){let o=n.findIndex(s=>Xe(s,r));o===-1?n.push(r):n[o]=ve(n[o],r)}return et(Ze(n))}function tt(e){if(!e)return;let t=e.trim();if(!(!t.startsWith("{")&&!t.startsWith("[")))try{return JSON.parse(t)}catch{return}}function nt(e,t){let n=t?.match(/boundary="?([^";,]+)"?/i)?.[1];if(!n)return;let r={};for(let o of e.split(`--${n}`)){let s=o.match(/^\r?\n([\s\S]*?)\r?\n\r?\n([\s\S]*)\r?\n$/);if(!s)continue;let[,c,i]=s,a=c.match(/\bname="([^"]*)"/i)?.[1];a!==void 0&&(r[a]=/\bfilename="/i.test(c)?{type:"string",format:"binary"}:j(i))}if(Object.keys(r).length!==0)return{type:"object",properties:r,required:Object.keys(r)}}function ge(e){let t=I(e.contentType);if(e.bodyJson!==void 0)return{mime:ue(t)?t:"application/json",schema:j(e.bodyJson)};if(t===de&&e.bodyText){let r={};for(let[o,s]of new URLSearchParams(e.bodyText))r[o]=s;return Object.keys(r).length===0?void 0:{mime:de,schema:j(r)}}if(t===le&&e.bodyText){let r=nt(e.bodyText,e.contentType);return r?{mime:le,schema:r}:void 0}let n=tt(e.bodyText);if(n!==void 0)return{mime:"application/json",schema:j(n)}}function ye(e,t,n){let r=e.get(t);e.set(t,r?J([r,n]):n)}async function we(e){let t=await C(e.trafficPath);if(t.length===0)throw new Error("No traffic files found in the provided traffic path.");let n=_(e.server),r=new Map,o=new Set,s=0,c=a=>{let p=a.request.method.toLowerCase();if(!X.has(p))return;let f=a.request.path||"/";if(n){let u=B(a.request,n);if(u===void 0)return;f=u}else a.request.host&&!fe(a.request.host)&&o.add(`${a.request.protocol}//${a.request.host}`);let{template:m,params:d}=Z(N(f)),P=`${p} ${m}`,h=r.get(P);h||(h={method:p,template:m,pathParams:new Map,queryParams:new Map,requestBodies:new Map,responses:new Map},r.set(P,h));for(let{name:u,value:l}of d){let y=h.pathParams.get(u);h.pathParams.set(u,{numeric:(y?.numeric??!0)&&F.test(l),observations:q(y?.observations,D(l))})}for(let u of new Set(a.request.query.keys())){let l=a.request.query.getAll(u),y=h.queryParams.get(u),T=l.length>0&&l.every(b=>F.test(b)),R=y?.observations;for(let b of l)R=q(R,D(b));h.queryParams.set(u,{numeric:(y?.numeric??!0)&&T,observations:R})}if(!Le.has(p)){let u=ge(a.request);u&&ye(h.requestBodies,u.mime,u.schema)}if(a.response&&a.response.status>=100){let u=String(a.response.status),l=h.responses.get(u);l||(l={bodies:new Map},h.responses.set(u,l)),l.statusText??=a.response.statusText||void 0;let y=ge(a.response);y&&ye(l.bodies,y.mime,y.schema)}};for(let a of t){let p=await G(a,e.format);if(!p){S.warn(`Skipping traffic file with unrecognized format: ${a}
|
|
8
8
|
`);continue}s+=1;for await(let f of p.parse(a))c(f)}if(s===0)throw new Error("No supported traffic files found to generate an OpenAPI description from.");if(r.size===0)throw new Error(n?`No HTTP exchanges in the traffic matched the server "${n}".`:"No HTTP exchanges were observed in the traffic. Cannot generate an OpenAPI description.");let i=n?[n]:Array.from(o).sort();return rt(r,e.title??"Generated API",i)}function Pe(e){return Object.values(e.paths).reduce((t,n)=>t+Object.keys(n).length,0)}function Se(e,t){if(e.numeric)return{type:"integer"};let n={type:"string"};return e.observations&&Object.assign(n,K(e.observations,t)),n}function rt(e,t,n){let r={};for(let o of e.values()){let s=r[o.template]??={},c=[...Array.from(o.pathParams).map(([a,p])=>({name:a,in:"path",required:!0,schema:Se(p,!1)})),...Array.from(o.queryParams).map(([a,p])=>({name:a,in:"query",required:!1,schema:Se(p,!0)}))],i={operationId:ot(o.method,o.template),responses:{}};if(c.length>0&&(i.parameters=c),o.requestBodies.size>0){let a={};for(let[p,f]of o.requestBodies)a[p]={schema:f};i.requestBody={content:a}}if(o.responses.size===0)i.responses.default={description:"Observed response"};else for(let[a,p]of o.responses){let f={description:p.statusText||"Observed response"};if(p.bodies.size>0){let m={};for(let[d,P]of p.bodies)m[d]={schema:P};f.content=m}i.responses[a]=f}s[o.method]=i}return{openapi:"3.2.0",info:{title:t,version:"1.0.0"},...n.length>0?{servers:n.map(o=>({url:o}))}:{},paths:r}}function ot(e,t){let n=t.split("/").filter(Boolean).map(r=>r.replace(/[{}]/g,"")).join("-");return`${e}-${n||"root"}`}function L(e,t){return`${e.toUpperCase()} ${t}`}function Te(e,t){let n;if(e.bodyJson!==void 0)try{n=JSON.stringify(e.bodyJson)}catch{n=void 0}if(n??=e.bodyText,!n)return;let r=n.trim();if(r)return r.length>t?`${r.slice(0,t)}\u2026[truncated]`:r}function $e(e){if(!e)return"";let t=e.bodyJson;return t===void 0?e.bodyText?I(e.contentType)||"text":"":t===null?"null":Array.isArray(t)?`array<${t.length>0?je(t[0]):""}>`:je(t)}function je(e){return g(e)?Object.keys(e).sort().join(","):e===null?"null":typeof e}async function ke(e){let t=e.perGroup??2,n=e.perOperation??4,r=e.maxBodyChars??2e3,o=_(e.server),s=await C(e.trafficPath),c=new Map;for(let a of s){let p=await G(a,e.format);if(p)for await(let f of p.parse(a)){let m=f.request.method.toUpperCase();if(!X.has(m.toLowerCase()))continue;let d=f.request.path||"/";if(o){let ne=B(f.request,o);if(ne===void 0)continue;d=ne}let P=N(d),{template:h}=Z(P),u=f.response&&f.response.status>=100?f.response:void 0,l=u?.status,y=`${$e(f.request)}\u2192${$e(u)}`,T=c.get(L(m,h));T||(T=new Map,c.set(L(m,h),T));let R=`${l??""} ${y}`,b=T.get(R);b||(b=[],T.set(R,b)),!(b.length>=t)&&b.push({method:m,path:P,query:f.request.query.toString(),status:l,requestContentType:f.request.contentType,requestBody:Te(f.request,r),responseContentType:u?.contentType,responseBody:u?Te(u,r):void 0})}}let i=new Map;for(let[a,p]of c){let f=[];for(let m=0;m<t&&f.length<n;m++)for(let d of p.values()){if(f.length>=n)break;d[m]&&f.push(d[m])}i.set(a,f)}return i}var st=`You are an expert API designer. You are given one operation from an OpenAPI 3.2 description that was inferred mechanically from recorded HTTP traffic, the component schemas it references, and a sample of the real recorded HTTP exchanges for that operation. The inferred description is only a hypothesis: types are coarse, every observed property is marked required, and descriptions are missing. Alternative body shapes observed in the traffic appear as "oneOf" variants or type unions. Common string formats (uuid, date-time, date, email, uri, ipv4) and small closed enums are detected conservatively from the observed values.
|
|
9
9
|
|
|
10
10
|
Refine the operation into the most accurate OpenAPI 3.2 definition you can justify from the evidence, while staying conservative:
|
|
@@ -43,7 +43,7 @@ ${e.reservedComponentNames.join(", ")}`),t.push(`# Recorded HTTP exchanges for t
|
|
|
43
43
|
|
|
44
44
|
${it(e.samples)}`),t.push(`Refine ${e.method.toUpperCase()} ${e.path} as instructed and output only the YAML document.`),{system:st,user:t.join(`
|
|
45
45
|
|
|
46
|
-
`)}}var Re=/^#\/components\/schemas\/(.+)$/;function Q(e,t){if(Array.isArray(e)){for(let n of e)Q(n,t);return}if(g(e)){if(typeof e.$ref=="string"){let n=e.$ref.match(Re);n&&t.add(n[1])}if(g(e.discriminator)&&g(e.discriminator.mapping)){for(let n of Object.values(e.discriminator.mapping))if(typeof n=="string"){let r=n.match(Re);t.add(r?r[1]:n)}}for(let n of Object.values(e))Q(n,t)}}function Je(e,t){let n=new Set,r=[e];for(;r.length>0;){let o=new Set;Q(r.pop(),o);for(let s of o)!n.has(s)&&s in t&&(n.add(s),r.push(t[s]))}return n}function at(e){let t=e.components?.schemas;if(!t)return;let n=Je(e.paths,t);for(let r of Object.keys(t))n.has(r)||delete t[r];Object.keys(t).length===0&&delete e.components}function ct(e,t,n){let r=
|
|
46
|
+
`)}}var Re=/^#\/components\/schemas\/(.+)$/;function Q(e,t){if(Array.isArray(e)){for(let n of e)Q(n,t);return}if(g(e)){if(typeof e.$ref=="string"){let n=e.$ref.match(Re);n&&t.add(n[1])}if(g(e.discriminator)&&g(e.discriminator.mapping)){for(let n of Object.values(e.discriminator.mapping))if(typeof n=="string"){let r=n.match(Re);t.add(r?r[1]:n)}}for(let n of Object.values(e))Q(n,t)}}function Je(e,t){let n=new Set,r=[e];for(;r.length>0;){let o=new Set;Q(r.pop(),o);for(let s of o)!n.has(s)&&s in t&&(n.add(s),r.push(t[s]))}return n}function at(e){let t=e.components?.schemas;if(!t)return;let n=Je(e.paths,t);for(let r of Object.keys(t))n.has(r)||delete t[r];Object.keys(t).length===0&&delete e.components}function ct(e,t,n){let r=ae(e),o;try{o=re(r)}catch(f){throw new Error(`the provider did not return valid YAML: ${f instanceof Error?f.message:String(f)}`)}if(!g(o))throw new Error('the response is not a YAML document with a "paths" object');let s=o.paths;if(!g(s))throw new Error('the response is not a YAML document with a "paths" object');let c=s[t];if(!g(c))throw new Error(`the response does not keep the path template "${t}"`);let i=c[n];if(!g(i))throw new Error(`the response does not contain the ${n.toUpperCase()} operation`);let a=o.components,p=g(a)?a.schemas:void 0;return{operation:i,components:g(p)?p:{}}}function pt(e,t){let n=g(t.responses)?t.responses:{};return Object.keys(e.responses).filter(r=>!(r in n))}async function ft(e){let t=e.document.components?.schemas??{},n=Je(e.operation,t),r={};for(let d of n)r[d]=t[d];let o=Object.keys(t).filter(d=>!n.has(d)),{system:s,user:c}=Ae({path:e.path,method:e.method,operation:e.operation,components:r,reservedComponentNames:o,samples:e.samples}),{text:i}=await ce(e.provider,{system:s,user:c,model:e.model}),a=ct(i,e.path,e.method),p=pt(e.operation,a.operation);if(p.length>0)throw new Error(`the response dropped observed response status(es): ${p.join(", ")}`);if(typeof a.operation.operationId!="string")throw new Error("the response dropped the operationId");let f=Object.keys(a.components).filter(d=>o.includes(d));if(f.length>0)throw new Error(`the response redefines reserved component(s): ${f.join(", ")}`);let m={openapi:e.document.openapi,info:e.document.info,paths:{[e.path]:{[e.method]:a.operation}},components:{schemas:{...t,...a.components}}};return await Y(v(m),e.config),a}function ut(e,t,n,r){e.paths[t][n]=r.operation,Object.keys(r.components).length>0&&(e.components??={schemas:{}},Object.assign(e.components.schemas,r.components))}async function Ee(e){let t=structuredClone(e.baseline),n=await se({extends:["spec"]}),r=[];for(let[i,a]of Object.entries(e.baseline.paths))for(let[p,f]of Object.entries(a))r.push({path:i,method:p,operation:f});let s=(await pe({items:r,concurrency:e.concurrency??1,action:"Refining",successNote:"refined",failureNote:"kept the baseline",label:({path:i,method:a})=>`${a.toUpperCase()} ${i}`,run:async({path:i,method:a,operation:p})=>{let f=await ft({provider:e.provider,model:e.model,document:t,path:i,method:a,operation:p,samples:e.samplesByOperation.get(L(a,i))??[],config:n});return ut(t,i,a,f),f}})).filter(i=>i!==null).length;if(s===0)throw new Error(`the ${e.provider} provider did not produce a usable refinement for any operation`);at(t);let c=v(t);return await Y(c,n),{yaml:c,document:t,refined:s,total:r.length}}var mt=2,dt=2,lt=.75,ht=2,Me=new Set(["integer","number"]),qe=new WeakMap;function w(e){let t=qe.get(e);if(t!==void 0)return t;let n;if(e.$ref!==void 0)n=`ref(${e.$ref})`;else if(e.oneOf)n=`oneOf(${e.oneOf.map(w).sort().join("|")})`;else{let o=[`type=${(Array.isArray(e.type)?[...e.type].sort().join(","):e.type)??""}`];if(e.properties){let s=Object.entries(e.properties).map(([c,i])=>`${JSON.stringify(c)}:${w(i)}`).sort().join(",");o.push(`props{${s}}`)}e.additionalProperties&&o.push(`values(${w(e.additionalProperties)})`),e.items&&o.push(`items(${w(e.items)})`),n=o.join(";")}return qe.set(e,n),n}function gt(e){return e.$ref===void 0&&e.type==="object"&&e.oneOf===void 0&&e.additionalProperties===void 0&&Object.keys(e.properties??{}).length>=mt}function xe(e,t){for(let n of t)e.set(n,(e.get(n)??0)+1)}function E(e,t,n){if(e.oneOf){e.oneOf.forEach((s,c)=>E(s,{...t,path:`${t.path}/oneOf/${c}`,fallbackHints:[]},n));return}let r=t.container,o=`${t.path}/`;if(gt(e)){let s=w(e),c=n.get(s);c||(c={keys:[s],schemas:[],merged:{},contexts:new Set,primaryVotes:new Map,fallbackVotes:new Map},n.set(s,c)),c.schemas.push(e),c.contexts.add(`${t.container}#${t.path}`),xe(c.primaryVotes,t.primaryHints),xe(c.fallbackVotes,t.fallbackHints),r=s,o=""}for(let[s,c]of Object.entries(e.properties??{}))E(c,{container:r,path:`${o}${s}`,primaryHints:[s],fallbackHints:[]},n);e.additionalProperties&&E(e.additionalProperties,{container:r,path:`${o}additionalProperties`,primaryHints:t.primaryHints.map(s=>O(s,1)),fallbackHints:t.fallbackHints.map(s=>O(s,1))},n),e.items&&E(e.items,{container:r,path:`${o}items`,primaryHints:t.primaryHints.map(s=>O(s,1)),fallbackHints:t.fallbackHints.map(s=>O(s,1))},n)}function yt(e){return e.split("/").filter(n=>n&&!n.startsWith("{")).at(-1)}function St(e){let t=new Map;for(let[n,r]of Object.entries(e.paths)){let o=yt(n),s=o?O(o,1):void 0;for(let[c,i]of Object.entries(r)){for(let[a,p]of Object.entries(i.requestBody?.content??{}))E(p.schema,{container:`request ${c} ${n} ${a}`,path:"",primaryHints:s?[s]:[],fallbackHints:s?[`${s} request`]:[]},t);for(let[a,p]of Object.entries(i.responses)){let f=Number(a)>=400;for(let[m,d]of Object.entries(p.content??{}))E(d.schema,{container:`response ${c} ${n} ${a} ${m}`,path:"",primaryHints:f?["error"]:s?[s]:[],fallbackHints:f?s?[`${s} error`]:[]:s?[`${s} response`]:[]},t)}}}return t}function Ce(e){return Object.keys(e.properties??{})}function bt(e,t){let n=Ce(e),r=new Set(Ce(t)),o=n.filter(c=>r.has(c)).length,s=n.length+r.size-o;return s===0?0:o/s}function Ne(e){if(e.$ref!==void 0||e.properties||e.additionalProperties||e.items||e.oneOf)return;let t=typeof e.type=="string"?[e.type]:e.type;if(!(!t||t.some(n=>n==="object"||n==="array")))return t}function ee(e){return Object.keys(e).length===0}function Ge(e,t){if(w(e)===w(t)||ee(e)||ee(t))return!0;let n=Ne(e),r=Ne(t);if(n&&r){let s=new Set(n.filter(i=>i!=="null")),c=new Set(r.filter(i=>i!=="null"));return s.size===c.size&&[...s].every(i=>c.has(i))?!0:[...s].every(i=>Me.has(i))&&[...c].every(i=>Me.has(i))}let o=s=>s.type==="array"||s.items!==void 0;return o(e)&&o(t)?!e.items||!t.items||Ge(e.items,t.items):!1}function Ot(e,t){let n=t.merged.properties??{};return Object.entries(e.merged.properties??{}).every(([r,o])=>!(r in n)||Ge(o,n[r]))}function vt(e){let t=[...e];for(;t.length>1;){let n=-1,r=-1,o=0;for(let i=0;i<t.length;i++)for(let a=i+1;a<t.length;a++){let p=bt(t[i].merged,t[a].merged);p>=lt&&p>o&&Ot(t[i],t[a])&&(o=p,n=i,r=a)}if(n===-1)break;let s=t[n],c=t[r];s.keys.push(...c.keys),s.schemas.push(...c.schemas),s.merged=J([s.merged,c.merged]);for(let i of c.contexts)s.contexts.add(i);for(let[i,a]of c.primaryVotes)s.primaryVotes.set(i,(s.primaryVotes.get(i)??0)+a);for(let[i,a]of c.fallbackVotes)s.fallbackVotes.set(i,(s.fallbackVotes.get(i)??0)+a);t.splice(r,1)}return t}function te(e,t){return e<t?-1:e>t?1:0}function wt(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function Ie(e){return[...e.entries()].sort(([t,n],[r,o])=>o-n||te(t,r)).map(([t])=>t)}function Pt(e){let t=[...e].sort((r,o)=>o.contexts.size-r.contexts.size||o.schemas.length-r.schemas.length||te(r.keys[0],o.keys[0])),n=new Set;return t.map(r=>{let o=[...Ie(r.primaryVotes),...Ie(r.fallbackVotes)].map(wt).filter(c=>c.length>0);o.length===0&&o.push("Schema");let s=o.find(c=>!n.has(c));for(let c=2;s===void 0;c++){let i=`${o[0]}${c}`;n.has(i)||(s=i)}return n.add(s),{group:r,name:s}})}function A(e,t,n=!1){if(!n){let o=t.get(w(e));if(o!==void 0)return{$ref:`#/components/schemas/${o}`}}let r={...e};return V(e,r),e.properties&&(r.properties=Object.fromEntries(Object.entries(e.properties).map(([o,s])=>[o,A(s,t)]))),e.additionalProperties&&(r.additionalProperties=A(e.additionalProperties,t)),e.items&&(r.items=A(e.items,t)),e.oneOf&&(r.oneOf=e.oneOf.map(o=>A(o,t))),r}function Tt(e){let t=Object.values(e.properties??{}),n=t.filter(r=>r.type==="array"&&(!r.items||ee(r.items)));return n.length>0&&t.length-n.length<=ht}function $t(e){let t=0,n=0;for(let r of e.primaryVotes.values())t+=r,n=Math.max(n,r);return n*2>t}function _e(e){let t=St(e);for(let i of t.values())i.merged=J(i.schemas);let r=vt([...t.values()]).filter(i=>i.contexts.size>=dt&&($t(i)||!i.schemas.some(Tt)));if(r.length===0)return e;let o=Pt(r),s=new Map;for(let{group:i,name:a}of o)for(let p of i.keys)s.set(p,a);let c={};for(let{group:i,name:a}of[...o].sort((p,f)=>te(p.name,f.name)))c[a]=A(i.merged,s,!0);for(let i of Object.values(e.paths))for(let a of Object.values(i)){for(let p of Object.values(a.requestBody?.content??{}))p.schema=A(p.schema,s);for(let p of Object.values(a.responses))for(let f of Object.values(p.content??{}))f.schema=A(f.schema,s)}return e.components={schemas:c},e}async function Rt(e,t){let n=x(e);await jt(At.dirname(n),{recursive:!0}),await kt(n,t,"utf8")}function Jt(e){let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n>0?`${n}m ${r}s`:`${r}s`}async function gn({argv:e}){if(e.type!=="openapi")throw new oe(`Unsupported spec type "${e.type}". Only "openapi" is supported.`);let t=Date.now(),n=x(e.traffic),r=e["traffic-format"],o=me(_e(await we({trafficPath:n,format:r,title:e.title,server:e.server})));S.info(`Inferred a baseline OpenAPI description from traffic: ${Pe(o)} operation(s).
|
|
47
47
|
`);let s=v(o);if(e["with-ai"]){let c=e["ai-provider"];S.info(`Refining the description with AI provider "${c}"...
|
|
48
48
|
`),S.warn(`Note: --with-ai sends samples of the recorded traffic (URLs, query strings, request and response bodies) to the selected AI provider. Make sure the traffic contains no secrets or personal data you are not allowed to share.
|
|
49
49
|
`);let i=await ke({trafficPath:n,format:r,server:e.server});try{let a=await Ee({provider:c,model:e["ai-model"],baseline:o,samplesByOperation:i,concurrency:e["ai-concurrency"]});s=a.yaml,S.info(`AI refinement complete: ${a.refined} of ${a.total} operation(s) refined (${c}).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{b as D}from"./IWKQTMKX.js";import{V as C,W as j,ia as $,ka as k,la as M,ma as S,oa as b,q as F,u as R,w as x}from"./BUNUOEXU.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{relative as I,resolve as U}from"node:path";var A=20;async function B({argv:o,config:t,collectSpecData:r}){let[{path:s}]=await D([o.api],t),n=new C(t.resolve),e=await n.resolveDocument(null,s,!0);r?.(e);let i=k(e.parsed),d=F(t.extendTypes(x(i),i),t),p=new Map,u=({source:l,pointer:c},f,N)=>{let v=`${l.absoluteRef}${c}`,y=p.get(v);if(!y){p.set(v,{absoluteRef:l.absoluteRef,pointer:c,types:[f],resolvesTo:N});return}y.types.includes(f)||y.types.push(f),y.resolvesTo||(y.resolvesTo=N)},m={any:{enter(l,{location:c,type:f}){u(c,f.name)}},ref(l,{location:c,type:f},N){u(c,f.name,N.location)}},h={problems:[],specVersion:i,config:t,visitorsData:{}},a=await j({rootDocument:e,rootType:d.Root,externalRefResolver:n});if(S({document:e,rootType:d.Root,normalizedVisitors:M([{severity:"warn",ruleId:"inspect-node-types",visitor:m}],d),resolvedRefMap:a,ctx:h}),o.pointer){let l=W(p,o.pointer,e.source.absoluteRef);o.parents?L(w(p,l,e.source.absoluteRef)):$.output(`${l.types.join(`
|
|
8
|
+
`)}
|
|
9
|
+
`);return}let g=[...p.values()];if(o.summary)V(g);else if(o.type){let l=o.type,c=g.filter(({types:f})=>f.includes(l));if(c.length===0)throw new b(`No nodes of type '${l}'. Run the command with --summary to see the types used in this description.`);o.parents?L(c.flatMap(f=>w(p,f,e.source.absoluteRef)),l):E(c)}else E(g)}function w(o,t,r,s=new Set){let n=`${t.absoluteRef}${t.pointer}`;if(s.has(n))return[[t]];s.add(n);let e=[],i=t.pointer.split("/");for(let p=1;p<i.length;p++){let u=p===1?"#/":i.slice(0,p).join("/");if(u===t.pointer)continue;let m=o.get(`${t.absoluteRef}${u}`);m&&e.push(m)}e.push(t);let d=[];e[0].absoluteRef===r&&e[0].pointer==="#/"&&d.push(e);for(let[p,u]of e.entries()){let m=[...o.values()].filter(a=>a.resolvesTo?.source.absoluteRef===u.absoluteRef&&a.resolvesTo.pointer===u.pointer),h=e.slice(p+1);for(let a of m)d.push(...w(o,a,r,s).map(g=>[...g,...h]))}return d.length?d:[e]}function L(o,t){let r=new Set(o.map(s=>s.map(({types:n})=>t&&n.includes(t)?t:n.join(", ")).join(" \u2192 ")));for(let s of r)$.output(`${s}
|
|
10
|
+
`)}function W(o,t,r){let[s,n]=t.split("#"),e=s?R(s)?s:U(process.cwd(),s):r,i=o.get(`${e}#${n||"/"}`);if(!i)throw new b(`No node at ${t}. ${z(o,e,`#${n||"/"}`,s)??`Check the pointer, and make sure the file is referenced from ${T(r)}.`}`);return i}function z(o,t,r,s){let n=r.split("/");for(let e=n.length-1;e>=1;e--){let i=e===1?"#/":n.slice(0,e).join("/"),d=o.get(`${t}${i}`);if(!d)continue;let p=n[e].toLowerCase(),u=e===1?"#/":`${i}/`,m=[...o.values()].filter(c=>c.absoluteRef===t&&c.pointer.startsWith(u)&&!c.pointer.slice(u.length).includes("/")),h=m.filter(c=>c.pointer.slice(u.length).toLowerCase().includes(p)),a=(h.length?h:m).map(c=>` ${s}${c.pointer}`),g=a.length-A;g>0&&(a.length=A,a.push(` \u2026and ${g} more`));let l=`The closest node is ${d.types.join(", ")} at ${s}${i}.`;return a.length?`${l} Did you mean:
|
|
11
|
+
${a.join(`
|
|
12
|
+
`)}`:l}}function V(o){let t=new Map;for(let{types:n,resolvesTo:e}of o)if(!e)for(let i of n)t.set(i,(t.get(i)??0)+1);let r=[...t.keys()].sort(),s=Math.max(...r.map(n=>n.length))+2;for(let n of r)$.output(`${n.padEnd(s)}${t.get(n)}
|
|
13
|
+
`)}function T(o){return R(o)?o:I(process.cwd(),o)}function E(o){let t=Math.max(...o.map(({types:r})=>r.join(", ").length))+2;for(let{absoluteRef:r,pointer:s,types:n,resolvesTo:e}of o){let i=e?` \u2192 ${T(e.source.absoluteRef)}${e.pointer==="#/"?"":e.pointer}`:"";$.output(`${n.join(", ").padEnd(t)}${T(r)}${s}${i}
|
|
14
|
+
`)}}export{B as handleInspectNodeTypes};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as ye,e as ve,f as Se,g as we,h as O,i as Re,k,l as A,m as Ie,n as Pe,v as be,w as Oe}from"./KMFAJMIP.js";import{$,K as ot,V as ce,Y as at,Z as pe,_ as g,aa as de,ba as E,c as d,ca as q,ea as S,ga as v,ia as R,ja as le,ka as fe,la as me,ma as he,q as ae,ra as ge,w as ue}from"./BUNUOEXU.js";import{e as oe}from"./RFWIIJFG.js";import ke from"node:path";function I(t){return t?t.trim():""}function B(t){let e=I(t.operationId)||I(t.path);return[I(t.ruleId),I(t.severity),I(t.message),e,I(t.target),I(t.schemaPath)].join("")}var _=t=>pe(S(t));function ut(t){return t==="error"?"error":t==="warning"?"warning":"note"}function ct(t){if(t==null)return"";let e=String(t);return!e.includes(",")&&!e.includes('"')&&!e.includes(`
|
|
8
|
+
`)?e:`"${e.replace(/"/g,'""')}"`}function pt(t){return ke.isAbsolute(t)?ke.relative(process.cwd(),t)||".":t}function dt(t){if(!t)return null;let e=t.operationPathTemplate;return typeof e=="string"&&e.length>0?e:null}function lt(t){return Object.entries(t).sort((e,r)=>{let n=r[1]-e[1];return n!==0?n:e[0].localeCompare(r[0])})}function ft(t){let e=[],r=new Map;for(let n of t){let s=B({ruleId:n.ruleId,severity:n.severity,message:n.message,operationId:n.operationId,path:n.path,target:n.target,schemaPath:n.schemaPath}),i=r.get(s);if(i!==void 0){e[i].occurrences+=1;continue}r.set(s,e.length),e.push({finding:n,occurrences:1})}return e}function mt(t){let e=ft(t.findings).map(n=>({occurrences:n.occurrences,exchangeIndex:n.finding.exchangeIndex,ruleId:n.finding.ruleId,severity:n.finding.severity,category:n.finding.category,message:n.finding.message,operationId:n.finding.operationId,specSource:n.finding.specSource,target:n.finding.target,schemaPath:n.finding.schemaPath,dataPath:n.finding.dataPath,details:n.finding.details,method:n.finding.method,url:n.finding.url,path:n.finding.path,status:n.finding.status})),r={run:{id:t.runId,specSource:t.meta.specSource,trafficPath:t.meta.trafficPath,format:t.meta.format,matchMode:t.meta.matchMode,server:t.meta.server,totalExchanges:t.summary.totalExchanges,documentedExchanges:t.summary.documentedExchanges,undocumentedExchanges:t.summary.undocumentedExchanges,skippedExchanges:t.summary.skippedExchanges,findingsBySeverity:t.summary.findingsBySeverity,findingsByRule:t.summary.findingsByRule,totalProblems:t.summary.totalProblemGroups,durationMs:t.summary.durationMs},problems:e};return`${JSON.stringify(r,null,2)}
|
|
9
|
+
`}function ht(t){let e=["run_id","finding_id","exchange_index","severity","category","rule_id","message","method","path","url","status","operation_id","spec_source","target","schema_path","data_path"],r=t.findings.map(s=>[t.runId,s.id,s.exchangeIndex,s.severity,s.category,s.ruleId,s.message,s.method,s.path,s.url,s.status,s.operationId,s.specSource,s.target,s.schemaPath,s.dataPath]);return`${[e,...r].map(s=>s.map(ct).join(",")).join(`
|
|
10
|
+
`)}
|
|
11
|
+
`}function gt(t){let e=new Map;for(let s of t.findings)e.has(s.ruleId)||e.set(s.ruleId,{id:s.ruleId,name:s.ruleId,shortDescription:{text:`${s.category} detection`}});let r=t.findings.map(s=>{let i=s.specSource??s.url??void 0;return{ruleId:s.ruleId,level:ut(s.severity),message:{text:s.message},locations:i?[{physicalLocation:{artifactLocation:{uri:i}}}]:void 0,properties:{runId:t.runId,exchangeIndex:s.exchangeIndex,method:s.method,path:s.path,status:s.status,operationId:s.operationId,target:s.target,schemaPath:s.schemaPath,dataPath:s.dataPath}}}),n={$schema:"https://json.schemastore.org/sarif-2.1.0.json",version:"2.1.0",runs:[{tool:{driver:{name:"drift",rules:Array.from(e.values())}},results:r}]};return`${JSON.stringify(n,null,2)}
|
|
12
|
+
`}function yt(t){return t.findingsBySeverity.error+t.findingsBySeverity.warning+t.findingsBySeverity.info}function vt(t){return t>=500?$:t>=400?E:t>=300?q:t>=200?de:v}function St(t,e,r){let n=(f,h)=>e?h(f):f,s=f=>f==="error"?n("\u2716",$):f==="warning"?n("\u25B2",E):n("\u25CF",q),i=f=>f==="error"?n("ERROR",$):f==="warning"?n("WARN",E):n("INFO",q),{summary:o,meta:a}=t,c=yt(o),l=o.previewFindings.slice(0,r),u=[];if(u.push(n("\u250F\u2501 Drift Report",_)),u.push(`\u2503 Run: ${t.runId}`),u.push(`\u2503 Spec: ${a.specSource}`),u.push(`\u2503 Traffic: ${a.trafficPath}`),u.push(a.server?`\u2503 Server: ${a.server} (overrides description servers)`:`\u2503 Match mode: ${a.matchMode}`),u.push(`\u2503 Traffic format: ${a.format}${a.format==="auto"?" (auto-detect)":""}`),u.push(`\u2503 Exchanges: total=${o.totalExchanges} documented=${o.documentedExchanges} undocumented=${o.undocumentedExchanges}${o.skippedExchanges>0?` skipped=${o.skippedExchanges}`:""}`),u.push(`\u2503 Findings: total=${c} ${n(`error=${o.findingsBySeverity.error}`,$)} ${n(`warning=${o.findingsBySeverity.warning}`,E)} ${n(`info=${o.findingsBySeverity.info}`,q)}`),u.push(`\u2503 Problems: total=${o.totalProblemGroups}`),u.push(`\u2517 Duration: ${o.durationMs}ms`),c===0)return u.push(""),u.push(n("\u2714 No findings.",S)),`${u.join(`
|
|
13
|
+
`)}
|
|
14
|
+
`;u.push(""),u.push(n(`Types (${Object.keys(o.problemGroupsByRule).length})`,_));for(let[f,h]of lt(o.problemGroupsByRule)){let y=o.findingsByRule[f]??h;u.push(` ${n("\u2022",v)} ${f}: ${h} problems / ${y} findings`)}let m=new Map;for(let f of l)m.has(f.ruleId)||m.set(f.ruleId,[]),m.get(f.ruleId).push(f);let w=Array.from(m.keys()).sort((f,h)=>{let y=(o.problemGroupsByRule[h]??0)-(o.problemGroupsByRule[f]??0);return y!==0?y:f.localeCompare(h)});u.push(""),u.push(n(`Problems by type (showing first ${l.length} of ${o.totalProblemGroups})`,_));let j=0;for(let f of w){let h=m.get(f);if(!h||h.length===0)continue;let y=o.problemGroupsByRule[f]??h.length,Y=o.findingsByRule[f]??y;u.push(""),u.push(`${n("\u25C9",S)} ${n(f,_)} ${n(`(${h.length} problems shown / ${y} total, ${Y} findings)`,v)}`);for(let p of h){j+=1;let re=p.occurrences,nt=p.status!==void 0?n(String(p.status),vt(p.status)):n("-",v),rt=dt(p.details)??p.path,st=p.operationId?` ${n(p.operationId,g)}`:"";if(u.push(`${s(p.severity)} ${i(p.severity)} #${j}${re>1?` ${n(`\xD7${re}`,v)}`:""} ${n("\u2192",v)} ${p.message}`),u.push(` \u21B3 sample exchange=${p.exchangeIndex} ${n(p.method,S)} ${rt} (${nt})${st}`),u.push(""),u.push(` ${n(p.url,v)}`),(p.specSource||p.schemaPath||p.dataPath)&&(u.push(""),p.specSource&&u.push(` ${n("spec:",g)} ${n(pt(p.specSource),S)}`),p.schemaPath&&u.push(` ${n("schemaPath=",g)} ${n(p.schemaPath,g)}`),p.dataPath&&u.push(` ${n("dataPath=",g)} ${n(p.dataPath,S)}`)),p.details)if(u.push(""),p.ruleId==="security-baseline"&&typeof p.details.summary=="string")u.push(` ${n("security:",g)} ${p.details.summary}`);else if(p.ruleId==="owasp-api-top10"&&typeof p.details.summary=="string"){let x=typeof p.details.issueId=="string"?p.details.issueId:null,C=typeof p.details.issueTitle=="string"?p.details.issueTitle:null;u.push(` ${n("owasp:",g)} ${p.details.summary}`),(x||C)&&u.push(` ${n("issue:",g)} ${[x,C].filter(Boolean).join(" - ")}`)}else if(p.ruleId==="schema-consistency"&&typeof p.details.summary=="string"){let x=typeof p.details.path=="string"?p.details.path:null,C=typeof p.details.expected=="string"?p.details.expected:null,se=typeof p.details.actual=="string"?p.details.actual:null,ie=typeof p.details.suggestion=="string"?p.details.suggestion:null;if(u.push(` ${n("schema:",g)} ${p.details.summary}`),x&&u.push(` ${n("path:",g)} ${n(x,S)}`),C&&u.push(` ${n("expected:",g)} ${C}`),se&&u.push(` ${n("actual:",g)} ${se}`),ie){u.push(` ${n("hint:",g)}`);for(let it of ie.split(`
|
|
15
|
+
`))u.push(` ${it}`)}}else u.push(` ${n("details:",g)} ${JSON.stringify(p.details)}`);u.push("")}}let b=o.totalProblemGroups-l.length;return b>0?(u[u.length-1]!==""&&u.push(""),u.push(n(`\u2026 ${b} problems omitted from terminal output. Use --format json/csv/sarif for the complete export.`,v))):u[u.length-1]===""&&u.pop(),`${u.join(`
|
|
16
|
+
`)}
|
|
17
|
+
`}function Zn(t,e){let r=e.maxFindings??10;switch(e.format){case"json":return mt(t);case"csv":return ht(t);case"sarif":return gt(t);case"pretty":return St(t,e.color??!1,r);default:throw new Error(`Unsupported report format: ${e.format}`)}}import{randomUUID as Qe}from"node:crypto";function wt(t,e){let r=O(t||"/")||"/",n=O(e.basePath||"/")||"/";return n==="/"?r:r===n?"/":r.startsWith(`${n}/`)?r.slice(n.length)||"/":null}function Rt(t,e){return!t.host||!e?!0:t.host===e.toLowerCase()}function It(t){try{return decodeURIComponent(t)}catch{return t}}function Pt(t,e,r){let n=r==="strict-host"?e.host?20:5:0;return t.pathScore*10+n}function Ae(t,e){let r={};for(let n=0;n<t.pathParams.length;n+=1){let s=t.pathParams[n],i=e[n+1];s&&i!==void 0&&(r[s]=It(i))}return r}function bt(t,e){let r=O(e)||"/";for(let n of t){let s=n.pathRegex.exec(r);if(s)return{operation:n,pathParams:Ae(n,s)}}return null}function xe(t,e,r,n){let s=e.request.method.toLowerCase(),i=t.operationsByMethod.get(s);if(!i||i.length===0)return null;if(n!==void 0)return bt(i,n);let o=null;for(let a of i)for(let c of a.servers){if(r==="strict-host"&&!Rt(c,e.request.host))continue;let l=wt(e.request.path,c);if(!l)continue;let u=a.pathRegex.exec(l);if(!u)continue;let m={score:Pt(a,c,r),matched:{operation:a,pathParams:Ae(a,u)}};(!o||m.score>o.score)&&(o=m)}return o?.matched??null}var Ce=6,Ot=2e3,kt=50,At=5,xt=1e6,Ct=/(?:token|api[_-]?key|apikey|password|passwd|secret|authorization|jwt)/i,$t=/(?:password|passwd|secret|api[_-]?key|access[_-]?token|refresh[_-]?token|private[_-]?key|ssn|credit[_-]?card|card[_-]?number|cvv)/i,Et=new Set(["page","limit","offset","cursor","per_page","perpage","size","start","after","before"]),$e=4,qt=$e*2;function Tt(t){return t.length<=qt?"***":`${t.slice(0,$e)}\u2026`}function Ft(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Mt(t){return typeof t=="string"||typeof t=="number"}function jt(t){let e=t.toLowerCase();return e.includes("secret")||e.includes("token")||e.includes("key")?e.startsWith("is")||e.startsWith("has")||e.startsWith("can")||e.startsWith("should")||e.startsWith("enable")||e.startsWith("allow"):!1}function Bt(t){if(typeof t=="number")return t===0||t===1;let e=t.trim().toLowerCase();return e==="true"||e==="false"||e==="0"||e==="1"}function _t(t){if(!d(t)&&!Array.isArray(t))return[];let e=[],r=[{value:t,path:""}],n=0;for(;r.length>0&&n<Ot&&e.length<Ce;){let s=r.pop();if(!s)break;if(n+=1,Array.isArray(s.value)){let i=Math.min(s.value.length,kt);for(let o=0;o<i;o+=1){let a=s.value[o];(d(a)||Array.isArray(a))&&r.push({value:a,path:`${s.path}/${o}`})}continue}if(d(s.value))for(let[i,o]of Object.entries(s.value)){let a=`${s.path}/${Ft(i)}`;if($t.test(i)&&Mt(o)){let c=String(o);if(jt(i)&&Bt(o))continue;if(c.length>0&&(e.push(a||"/"),e.length>=Ce))break}(d(o)||Array.isArray(o))&&r.push({value:o,path:a})}}return e}function Lt(t){for(let e of t.keys())if(Et.has(e.toLowerCase()))return!0;return!1}function P(t,e,r,n,s){return{ruleId:"owasp-api-top10",severity:n,category:"security",message:e,exchangeIndex:t.exchange.index,operationId:t.matchedOperation?.operation.operationId,specSource:t.matchedOperation?.operation.specSource,target:r,details:s}}function Nt(t){let e=[];for(let[r,n]of t.exchange.request.query.entries())if(Ct.test(r)&&(e.push({key:r,valuePreview:Tt(n)}),e.length>=At))break;return e.length===0?[]:[P(t,"Sensitive credential-like query parameters detected","request","warning",{issueId:"API2:2023",issueTitle:"Broken Authentication",summary:"Authentication data should not be passed via query parameters because it can leak via logs, browser history, and referrers.",sensitiveQueryParams:e})]}function zt(t){let e=t.exchange.response;if(!e)return[];let r=e.headers["access-control-allow-origin"]?.trim(),n=e.headers["access-control-allow-credentials"]?.trim().toLowerCase();return r!=="*"||n!=="true"?[]:[P(t,"Insecure CORS policy: wildcard origin with credentials enabled","response","error",{issueId:"API8:2023",issueTitle:"Security Misconfiguration",summary:'Access-Control-Allow-Origin is "*" while Access-Control-Allow-Credentials is true. Browsers may expose authenticated API responses to untrusted origins.',headers:{accessControlAllowOrigin:r,accessControlAllowCredentials:n}})]}function Vt(t){let e=t.exchange.response;if(!e)return[];let r=e.headers["set-cookie"];if(!r)return[];let n=[];for(let s of Se(r)){let i=new Set(s.split(";").slice(1).map(o=>o.split("=")[0].trim().toLowerCase()));t.exchange.request.protocol==="https:"&&!i.has("secure")&&n.push(P(t,'Set-Cookie header is missing "Secure" attribute',"response","warning",{issueId:"API2:2023",issueTitle:"Broken Authentication",summary:'Session cookies over HTTPS should include "Secure" to prevent transmission over plain HTTP.',setCookiePreview:s.slice(0,200)})),i.has("httponly")||n.push(P(t,'Set-Cookie header is missing "HttpOnly" attribute',"response","warning",{issueId:"API2:2023",issueTitle:"Broken Authentication",summary:'Session cookies should include "HttpOnly" to reduce risk of token theft via client-side script access.',setCookiePreview:s.slice(0,200)})),i.has("samesite")||n.push(P(t,'Set-Cookie header is missing "SameSite" attribute',"response","info",{issueId:"API8:2023",issueTitle:"Security Misconfiguration",summary:'Set "SameSite" on session cookies to reduce CSRF risk for state-changing requests.',setCookiePreview:s.slice(0,200)}))}return n}function Ht(t){let e=t.exchange.response;if(!e||e.bodyJson===void 0)return[];let r=_t(e.bodyJson);return r.length===0?[]:[P(t,"Potential sensitive data exposure in response payload","response","warning",{issueId:"API3:2019",issueTitle:"Excessive Data Exposure",summary:`Sensitive-looking fields detected in response payload: ${r.join(", ")}`,exposedPaths:r})]}function Dt(t){let e=t.exchange.response;return!e||e.status>=400||t.exchange.request.method!=="GET"?[]:!e.bodyText||e.bodyText.length<xt?[]:Lt(t.exchange.request.query)?[]:[P(t,"Large response without pagination parameters (possible resource-consumption risk)","response","info",{issueId:"API4:2023",issueTitle:"Unrestricted Resource Consumption",summary:"A large response was returned without common pagination query parameters. Consider explicit page/limit controls for large collections.",responseBytes:e.bodyText.length})]}var L=class{id="owasp-api-top10";analyze(e){return e.matchedOperation?[...Nt(e),...zt(e),...Vt(e),...Ht(e),...Dt(e)]:[]}};function N(t,e){let r=t.replace(/\{([^}]+)\}/g,(i,o)=>{let a=e?.[o];return a?.default!==void 0?String(a.default):Array.isArray(a?.enum)&&a.enum.length>0?String(a.enum[0]):""}),n=we(r),s=!!(n.host&&!ve(n.host));return{rawUrl:t,protocol:s?n.protocol:void 0,host:s?n.host.toLowerCase():void 0,basePath:O(n.pathname||"/")}}function Ee(t){return t?t.startsWith("/")?t:`/${t}`:"/"}function z(t,e){let r=`${Math.floor(t/100)}XX`;return[String(t),r,r.toLowerCase(),"default"].find(n=>e.includes(n))}function qe(t){if(!t)return{};let e={};for(let r of t.split(";")){let[n,...s]=r.trim().split("=");if(!n)continue;let i=s.join("=").trim();e[n]=i}return e}var Kt=/^([^[\]]+)\[([^[\]]+)\]$/;function Q(t){let e=t.match(Kt);return e?{parameterName:e[1],property:e[2]}:void 0}function Ut(t,e){let r;for(let[n,s]of e){let i=Q(n);i?.parameterName===t&&(r??={},r[i.property]=s)}return r}function V(t,e,r,n){switch(t.in){case"path":return r[t.name];case"query":{if(t.style==="deepObject")return Ut(t.name,e.query);let s=e.query.getAll(t.name);return s.length===0?void 0:(d(t.schema)?t.schema.type:void 0)==="array"||s.length>1?s:s[0]}case"header":return e.headers[t.name.toLowerCase()];case"cookie":return n[t.name];default:return}}var Te=200;function Fe(t){return t!==void 0&&t!==""}function Gt(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Jt(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Wt(t){return!t||t==="#"?"":t.startsWith("#")?t.slice(1):t}function X(t){let e=Wt(t);return!e||e==="/"?[]:e.split("/").slice(1).map(r=>Gt(r))}function Me(t,e){return`/${[...X(t),Jt(e)].join("/")}`}function Yt(t,e){let r=X(e),n=t;for(let s of r){if(Array.isArray(n)){let i=Number.parseInt(s,10);if(!Number.isInteger(i)||i<0||i>=n.length)return;n=n[i];continue}if(!d(n))return;n=n[s]}return n}function Z(t){let e=t.instancePath??"",r=t.params??{};return t.keyword==="required"&&typeof r.missingProperty=="string"?Me(e,r.missingProperty):t.keyword==="additionalProperties"&&typeof r.additionalProperty=="string"?Me(e,r.additionalProperty):e}function Qt(t){let e=X(t);if(e.length===0)return"root";let r=[];for(let n of e)/^\d+$/.test(n)?r.push(`[${n}]`):r.length===0?r.push(n):r.push(`.${n}`);return r.join("")}function Xt(t){if(t===void 0)return"[missing]";let e=JSON.stringify(t);return e?e.length>Te?`${e.slice(0,Te)}\u2026`:e:String(t)}function Zt(t){let e=t.params??{};if(t.keyword==="required"&&typeof e.missingProperty=="string")return`required field "${e.missingProperty}"`;if(t.keyword==="type"&&typeof e.type=="string")return`type "${e.type}"`;if(t.keyword==="additionalProperties")return"no additional undocumented properties";if(t.keyword==="format"&&typeof e.format=="string")return`format "${e.format}"`}function en(t,e,r){let n=t==="request"?"Request":"Response",s=e.params??{},i=Qt(r);return e.keyword==="required"&&typeof s.missingProperty=="string"?`${n} is missing required field "${i}".`:e.keyword==="additionalProperties"&&typeof s.additionalProperty=="string"?`${n} has undocumented field "${i}".`:e.keyword==="type"&&typeof s.type=="string"?`${n} field "${i}" must be ${s.type}.`:e.keyword==="enum"?`${n} field "${i}" has a value outside allowed enum values.`:e.keyword==="format"&&typeof s.format=="string"?`${n} field "${i}" does not match format "${s.format}".`:`${n} schema mismatch at "${i}": ${e.message??"validation error"}`}function Be(t,e,r){let n=Z(e),s=Yt(t,n);return{summary:en(r,e,n),keyword:e.keyword??null,path:n||"/",expected:Zt(e)??null,actual:Xt(s),suggestion:null,params:e.params??{},ajvMessage:e.message??"validation error"}}function tn(t,e,r,n){if(e==null||!t.schema)return;let s=r.validateSchema(t.schema,e,{coerce:!0});if(!s.valid)for(let i of s.errors){let o=Be(e,i,"request");n.push({ruleId:"schema-consistency",severity:"error",category:"schema",message:`Invalid ${t.in} parameter "${t.name}": ${typeof o.summary=="string"?o.summary:i.message??"schema mismatch"}`,exchangeIndex:r.exchange.index,operationId:r.matchedOperation?.operation.operationId,specSource:r.matchedOperation?.operation.specSource,target:"request",schemaPath:i.schemaPath,dataPath:Z(i),details:{...o,parameter:{name:t.name,in:t.in}}})}}function nn(t,e){let r=[],n={query:new Set,header:new Set,cookie:new Set},s=new Set;for(let i of e.operation.requestParameters)i.in==="header"?n.header.add(i.name.toLowerCase()):(i.in==="query"||i.in==="cookie")&&(n[i.in].add(i.name),i.in==="query"&&i.style==="deepObject"&&s.add(i.name));for(let i of new Set(t.exchange.request.query.keys())){if(n.query.has(i))continue;let o=Q(i);o&&s.has(o.parameterName)||r.push({ruleId:"schema-consistency",severity:"warning",category:"documentation",message:`Undocumented query parameter in traffic: "${i}"`,exchangeIndex:t.exchange.index,operationId:e.operation.operationId,specSource:e.operation.specSource,target:"request"})}for(let i of Object.keys(t.exchange.request.headers))Pe(i,t.ignoreHeaders)||n.header.has(i.toLowerCase())||r.push({ruleId:"schema-consistency",severity:"info",category:"documentation",message:`Undocumented header in traffic: "${i}"`,exchangeIndex:t.exchange.index,operationId:e.operation.operationId,specSource:e.operation.specSource,target:"request"});return r}function rn(t){let e=t.exchange.response;return e!==void 0&&e.status>=400&&e.status<500}function sn(t,e){let r=t.exchange.response;if(!r)return;let{responseStatuses:n,responseBodyContent:s}=e.operation,i=z(r.status,n);if(!(i===void 0||s[i]===void 0))return A(s[i],r.contentType)}function je(t,e,r,n){let s=r.validateSchema(t,e,{target:n});return s.valid?[]:s.errors.map(i=>{let o=Be(e,i,n);return{ruleId:"schema-consistency",severity:"error",category:"schema",message:typeof o.summary=="string"?o.summary:`Schema mismatch (${n}): ${i.message??"validation error"}`,exchangeIndex:r.exchange.index,operationId:r.matchedOperation?.operation.operationId,specSource:r.matchedOperation?.operation.specSource,target:n,schemaPath:i.schemaPath,dataPath:Z(i),details:o}})}var H=class{id="schema-consistency";analyze(e){let r=e.matchedOperation;if(!r)return[];let n=[];if(n.push(...nn(e,r)),!rn(e)){for(let c of r.operation.requestParameters){if(e.ignoreCookies&&c.in==="cookie")continue;let l=V(c,e.exchange.request,r.pathParams,e.cookies);if(c.required&&l==null){n.push({ruleId:this.id,severity:"error",category:"documentation",message:`Missing required ${c.in} parameter: "${c.name}"`,exchangeIndex:e.exchange.index,operationId:r.operation.operationId,specSource:r.operation.specSource,target:"request"});continue}tn(c,l,e,n)}let i=e.exchange.request.contentType,o=A(r.operation.requestBodyContent,i),a=Fe(e.exchange.request.bodyText);r.operation.requestBodyRequired&&!a&&n.push({ruleId:this.id,severity:"error",category:"documentation",message:"Missing required request body",exchangeIndex:e.exchange.index,operationId:r.operation.operationId,specSource:r.operation.specSource,target:"request"}),o&&a&&k(i)&&(e.exchange.request.bodyJson===void 0?n.push({ruleId:this.id,severity:"error",category:"schema",message:"Request body is not valid JSON for JSON content-type",exchangeIndex:e.exchange.index,operationId:r.operation.operationId,specSource:r.operation.specSource,target:"request"}):n.push(...je(o,e.exchange.request.bodyJson,e,"request")))}let s=sn(e,r);if(s&&e.exchange.response&&Fe(e.exchange.response.bodyText)){let i=e.exchange.response.contentType;k(i)&&(e.exchange.response.bodyJson===void 0?n.push({ruleId:this.id,severity:"error",category:"schema",message:"Response body is not valid JSON for JSON content-type",exchangeIndex:e.exchange.index,operationId:r.operation.operationId,specSource:r.operation.specSource,target:"response"}):n.push(...je(s,e.exchange.response.bodyJson,e,"response")))}return n}};function ee(t){if(!t)return null;let[e]=t.trim().split(/\s+/,1);return e?e.toLowerCase():null}function Le(t){return!!t.exchange.request.headers.authorization}function on(t,e){return t?t.split(";").map(r=>r.trim()).some(r=>r.startsWith(`${e}=`)):!1}function an(t,e){let r=t.matchedOperation?.operation;if(!r)return{schemeName:e,schemeType:"unknown",satisfied:!0,reason:"No matched OpenAPI operation."};let n=r.securitySchemes[e];if(!n)return{schemeName:e,schemeType:"missing",satisfied:!1,reason:"Security scheme is referenced but not defined in components.securitySchemes."};let s=String(n.type??"unknown");if(n.type==="apiKey"){let i=String(n.name??""),o=String(n.in??"header");if(!i)return{schemeName:e,schemeType:s,satisfied:!1,reason:'apiKey scheme is missing the "name" field in the OpenAPI spec.'};if(o==="header"){let a=!!t.exchange.request.headers[i.toLowerCase()];return{schemeName:e,schemeType:s,satisfied:a,reason:a?`Found required apiKey header "${i}".`:`Missing required apiKey header "${i}".`}}if(o==="query"){let a=t.exchange.request.query.has(i);return{schemeName:e,schemeType:s,satisfied:a,reason:a?`Found required apiKey query parameter "${i}".`:`Missing required apiKey query parameter "${i}".`}}if(o==="cookie"){if(t.ignoreCookies)return{schemeName:e,schemeType:s,satisfied:!0,skipped:!0,reason:`Skipped apiKey cookie "${i}" validation because --ignore-cookies is enabled.`};let a=on(t.exchange.request.headers.cookie,i);return{schemeName:e,schemeType:s,satisfied:a,reason:a?`Found required apiKey cookie "${i}".`:`Missing required apiKey cookie "${i}".`}}return{schemeName:e,schemeType:s,satisfied:!1,reason:`Unsupported apiKey location "${o}" in OpenAPI security scheme.`}}if(n.type==="http"){let i=t.exchange.request.headers.authorization;if(!i)return{schemeName:e,schemeType:s,satisfied:!1,reason:"Missing Authorization header."};let o=String(n.scheme??"").toLowerCase(),a=ee(i);if(!o)return{schemeName:e,schemeType:s,satisfied:!0,reason:"Authorization header is present and no specific HTTP auth scheme is documented."};if(!a)return{schemeName:e,schemeType:s,satisfied:!1,reason:"Authorization header is malformed and does not include an auth scheme."};let c=a===o;return{schemeName:e,schemeType:s,satisfied:c,reason:c?`Authorization uses expected "${o}" scheme.`:`Authorization uses "${a}" but "${o}" is required.`}}if(n.type==="oauth2"||n.type==="openIdConnect"){let i=t.exchange.request.headers.authorization;if(!i)return{schemeName:e,schemeType:s,satisfied:!1,reason:"Missing Authorization header for OAuth2/OpenID Connect scheme."};let o=ee(i),a=o==="bearer";return{schemeName:e,schemeType:s,satisfied:a,reason:a?"Authorization uses bearer token as expected for OAuth2/OpenID Connect.":`Authorization scheme "${o??"unknown"}" does not satisfy OAuth2/OpenID Connect (expected bearer).`}}return n.type==="mutualTLS"?{schemeName:e,schemeType:s,satisfied:!0,reason:"mutualTLS cannot be validated from HTTP traffic logs alone."}:{schemeName:e,schemeType:s,satisfied:!1,reason:`Unsupported security scheme type "${s}".`}}function un(t){let e=t.matchedOperation?.operation.security;if(!e)return{satisfied:!0,requirements:[]};if(e.length===0)return{satisfied:!0,requirements:[]};let r=e.map((n,s)=>{let i=Object.keys(n);if(i.length===0)return{requirementIndex:s,satisfied:!0,schemeResults:[]};let o=i.map(a=>an(t,a));return{requirementIndex:s,satisfied:o.every(a=>a.satisfied),schemeResults:o}});return{satisfied:r.some(n=>n.satisfied),requirements:r}}function cn(t){let e=[];for(let r of t.requirements)for(let n of r.schemeResults)n.satisfied||e.push({requirement:r.requirementIndex+1,schemeName:n.schemeName,reason:n.reason});return e}function _e(t){let e=[];for(let r of t.requirements)for(let n of r.schemeResults)n.skipped&&e.push({requirement:r.requirementIndex+1,schemeName:n.schemeName,reason:n.reason});return e}function pn(t){if(t.length===0)return"All documented security requirements are satisfied.";let e=new Map;for(let n of t){let s=e.get(n.requirement);s?s.push(n):e.set(n.requirement,[n])}let r=Array.from(e.entries()).sort((n,s)=>n[0]-s[0]).map(([n,s])=>{let i=s.map(a=>a.schemeName).join(" + "),o=s.map(a=>a.reason).join(" ");return`Option ${n} (${i}): ${o}`});return r.length===1?`Authentication check failed. ${r[0]}`:`None of the documented authentication options matched. Any one of these options would satisfy the OpenAPI security requirements: ${r.join(" | ")}`}function dn(t){return Array.from(t.exchange.request.query.keys()).filter(e=>{let r=e.toLowerCase();return r.includes("token")||r.includes("apikey")||r.includes("api_key")||r.includes("access_key")})}var ln=/^(?:(?:.+\.)?localhost|127(?:\.\d{1,3}){3}|::1)$/i;function fn(t){let e;try{e=new URL(t.url).hostname}catch{e=t.host?.replace(/:\d+$/,"")}return e?ln.test(e.replace(/^\[|\]$/g,"")):!1}function mn(t){if(t.exchange.request.protocol!=="http:"||!t.exchange.request.protocolKnown||fn(t.exchange.request))return{flag:!1,hasAuthHeader:!1,sensitiveQueryKeys:[]};let e=Le(t),r=dn(t);return{flag:e||r.length>0,hasAuthHeader:e,sensitiveQueryKeys:r}}var D=class{id="security-baseline";analyze(e){if(!e.matchedOperation)return[];let r=[],n=un(e);if(n.satisfied){let i=_e(n);i.length>0&&r.push({ruleId:this.id,severity:"info",category:"security",message:"Some documented cookie-based security checks were skipped",exchangeIndex:e.exchange.index,operationId:e.matchedOperation.operation.operationId,specSource:e.matchedOperation.operation.specSource,target:"request",details:{summary:i.map(o=>`Skipped option ${o.requirement} (${o.schemeName}): ${o.reason}`).join(" "),skippedChecks:i}})}else{let i=cn(n);r.push({ruleId:this.id,severity:"error",category:"security",message:"Request does not satisfy documented OpenAPI security requirements",exchangeIndex:e.exchange.index,operationId:e.matchedOperation.operation.operationId,specSource:e.matchedOperation.operation.specSource,target:"request",details:{summary:pn(i),failedChecks:i,skippedChecks:_e(n),authorizationScheme:ee(e.exchange.request.headers.authorization),hasAuthorizationHeader:Le(e)}})}let s=mn(e);return s.flag&&r.push({ruleId:this.id,severity:"warning",category:"security",message:"Potential credential exposure over insecure HTTP transport",exchangeIndex:e.exchange.index,operationId:e.matchedOperation.operation.operationId,specSource:e.matchedOperation.operation.specSource,target:"request",details:{protocol:e.exchange.request.protocol,hasAuthorizationHeader:s.hasAuthHeader,sensitiveQueryKeys:s.sensitiveQueryKeys}}),r}};var K=class{id="undocumented-endpoint";analyze(e){if(e.matchedOperation)return[];let{method:r,path:n,host:s}=e.exchange.request,o=e.matchMode==="strict-host"&&!e.hostCompatibleWithSpecServers?`Undocumented server: ${r} ${n} was sent to "${s}", which does not match any server in the description`:`Undocumented endpoint: ${r} ${n}`;return[{ruleId:this.id,severity:"error",category:"documentation",message:o,exchangeIndex:e.exchange.index,target:"request"}]}};var te={"undocumented-endpoint":()=>new K,"schema-consistency":()=>new H,"security-baseline":()=>new D,"owasp-api-top10":()=>new L},hn=Object.keys(te),gn=["undocumented-endpoint","schema-consistency","security-baseline"];function Ne(t){return!t||t.length===0?gn.map(e=>te[e]()):[...new Set(t)].map(e=>{let r=te[e];if(!r)throw new Error(`Unknown rule id: "${e}". Available rules: ${hn.join(", ")}`);return r()})}var He=oe(ot(),1);var De=oe(at(),1),ze=He.default,Ve=De.default;function ne(t,e){if(!d(t))return!1;let r=e==="request"?"readOnly":"writeOnly";return t[r]===!0||Array.isArray(t.allOf)&&t.allOf.some(n=>d(n)&&n[r]===!0)}function Ke(t,e,r,n=new WeakSet){if(!d(t)||n.has(t))return!1;n.add(t);let s=t.properties;return d(s)&&ne(s[e],r)?!0:[t.allOf,t.oneOf,t.anyOf].some(i=>Array.isArray(i)&&i.some(o=>Ke(o,e,r,n)))}var yn=new Set(["items","additionalItems","additionalProperties","unevaluatedItems","unevaluatedProperties","contains","propertyNames","not","if","then","else"]),vn=new Set(["allOf","anyOf","oneOf","prefixItems"]),Sn=new Set(["properties","patternProperties","dependentSchemas","$defs","definitions"]);function Ue(t,e,r=new WeakSet){if(!d(t))return t;if(r.has(t))return!0;r.add(t);let n=i=>Ue(i,e,r),s={};for(let[i,o]of Object.entries(t))yn.has(i)?s[i]=Array.isArray(o)?o.map(n):n(o):vn.has(i)&&Array.isArray(o)?s[i]=o.map(n):Sn.has(i)&&d(o)?s[i]=Object.fromEntries(Object.entries(o).map(([a,c])=>[a,n(c)])):s[i]=o;return Array.isArray(t.required)&&(s.required=t.required.filter(i=>typeof i!="string"||!Ke(t,i,e))),r.delete(t),s}var T=class{ajv;fallbackAjv;objectSchemaCaches={none:new WeakMap,request:new WeakMap,response:new WeakMap};scalarSchemaCache=new Map;constructor(e){let r={strict:!1,allErrors:!0,allowUnionTypes:!0,discriminator:!0,coerceTypes:e?.coerceTypes?"array":!1,validateFormats:!0,verbose:!0,formats:{enum:!0}};this.ajv=new ze(r),this.fallbackAjv=new ze({...r,discriminator:!1}),Ve(this.ajv),Ve(this.fallbackAjv)}validate(e,r,n){if(e===void 0)return{valid:!0,errors:[]};let s;try{s=this.getOrCompileValidator(e,n)}catch(a){return{valid:!1,errors:[{message:`Schema compilation failed: ${a.message}`}]}}let i=!!s(r),o=s.errors??[];return{valid:i,errors:o}}getOrCompileValidator(e,r){if(d(e)){let o=this.objectSchemaCaches[r??"none"],a=o.get(e);if(a)return a;let c=r?Ue(e,r):e,l=this.compileSchema(c);return o.set(e,l),l}let n=`${r??"none"}:${JSON.stringify(e)}`,s=this.scalarSchemaCache.get(n);if(s)return s;let i=this.compileSchema(e);return this.scalarSchemaCache.set(n,i),i}compileSchema(e){try{return this.ajv.compile(e)}catch{return this.fallbackAjv.compile(e)}}};function Ge(t){switch(t.kind){case"operation":return"operation";case"parameter":return`parameter:${t.in}:${t.name}`;case"response":return`response:${t.status}`;case"property":return`property:${t.target}:${t.status??""}:${t.path}`}}function G(t,e){let r=Ge(e);t.has(r)||t.set(r,{item:e,covered:!1})}function J(t,e){let r=t.get(Ge(e));r&&(r.covered=!0)}function Je(t,e){return t?`${t}.${e}`:e}function F(t,e,r,n,s){if(!(!d(t)||s.has(t))){s.add(t);for(let i of[t.allOf,t.oneOf,t.anyOf])if(Array.isArray(i))for(let o of i)F(o,e,r,n,s);if(d(t.properties))for(let[i,o]of Object.entries(t.properties)){if(ne(o,e.target))continue;let a=Je(r,i);G(n,{kind:"property",...e,path:a}),F(o,e,a,n,s)}d(t.items)&&F(t.items,e,`${r}[]`,n,s),s.delete(t)}}function M(t,e,r,n,s,i){if(!(!d(e)||i.has(e))){i.add(e);for(let o of[e.allOf,e.oneOf,e.anyOf])if(Array.isArray(o))for(let a of o)M(t,a,r,n,s,i);if(d(e.properties)&&d(t))for(let[o,a]of Object.entries(e.properties)){if(t[o]===void 0)continue;let c=Je(n,o);J(s,{kind:"property",...r,path:c}),M(t[o],a,r,c,s,i)}if(d(e.items)&&Array.isArray(t))for(let o of t)M(o,e.items,r,`${n}[]`,s,i);i.delete(e)}}function wn(t,e){let r=new Map;G(r,{kind:"operation"});for(let n of t.requestParameters)e&&n.in==="cookie"||G(r,{kind:"parameter",name:n.name,in:n.in});for(let[n,s]of Object.entries(t.requestBodyContent))k(n)&&F(s,{target:"request"},"",r,new Set);for(let n of t.responseStatuses){G(r,{kind:"response",status:n});for(let[s,i]of Object.entries(t.responseBodyContent[n]??{}))k(s)&&F(i,{target:"response",status:n},"",r,new Set)}return{operation:t,entries:r}}function Rn(t){return t.request.bodyJson!==void 0||t.response?.bodyJson!==void 0}function U(t,e){let r={covered:0,total:0};for(let n of t)for(let s of n.entries.values())s.item.kind===e&&(r.total+=1,s.covered&&(r.covered+=1));return r}function In(t){let e={method:t.operation.method.toUpperCase(),path:t.operation.pathTemplate,operationId:t.operation.operationId,missing:[],covered:[]};for(let r of t.entries.values())(r.covered?e.covered:e.missing).push(r.item);return e}var W=class{states=new Map;exchanges={total:0,matched:0,withBody:0};constructor(e){for(let r of e.openApiIndex.operationsByMethod.values())for(let n of r)this.states.set(n,wn(n,e.ignoreCookies))}record(e,r,n){if(this.exchanges.total+=1,!r)return;let s=this.states.get(r.operation);if(!s)return;this.exchanges.matched+=1,Rn(e)&&(this.exchanges.withBody+=1);let{operation:i,pathParams:o}=r,{entries:a}=s;J(a,{kind:"operation"});for(let u of i.requestParameters){let m=V(u,e.request,o,n);m!=null&&J(a,{kind:"parameter",name:u.name,in:u.in})}if(e.request.bodyJson!==void 0){let u=A(i.requestBodyContent,e.request.contentType);M(e.request.bodyJson,u,{target:"request"},"",a,new Set)}let c=e.response;if(!c)return;let l=z(c.status,i.responseStatuses);if(l!==void 0&&(J(a,{kind:"response",status:l}),c.bodyJson!==void 0)){let u=A(i.responseBodyContent[l]??{},c.contentType);M(c.bodyJson,u,{target:"response",status:l},"",a,new Set)}}finalize(){let e=Array.from(this.states.values()).sort((r,n)=>r.operation.pathTemplate.localeCompare(n.operation.pathTemplate)||r.operation.method.localeCompare(n.operation.method));return{exchanges:this.exchanges,totals:{operations:U(e,"operation"),parameters:U(e,"parameter"),properties:U(e,"property"),responses:U(e,"response")},operations:e.map(In)}}};var Pn=10,We={info:0,warning:1,error:2};function bn(){return{totalExchanges:0,documentedExchanges:0,undocumentedExchanges:0,skippedExchanges:0,hostCompatibleExchanges:0,findingsBySeverity:{info:0,warning:0,error:0},findingsByRule:{}}}function On(t,e){t.findingsBySeverity[e.severity]+=1,t.findingsByRule[e.ruleId]=(t.findingsByRule[e.ruleId]??0)+1}function kn(t,e){return{...t,id:Qe(),method:e.request.method,url:e.request.url,path:e.request.path,status:e.response?.status}}function An(t,e){return{exchangeIndex:t.exchangeIndex,ruleId:t.ruleId,severity:t.severity,category:t.category,message:t.message,occurrences:1,operationId:t.operationId,specSource:t.specSource,target:t.target,schemaPath:t.schemaPath,dataPath:t.dataPath,details:t.details,method:e.request.method,url:e.request.url,path:e.request.path,status:e.response?.status}}function xn(t,e){if(!e)return;t.operationId||(t.operationId=e.operation.operationId),t.specSource||(t.specSource=e.operation.specSource);let r=t.details??{};if(!d(r)){t.details={operationPathTemplate:e.operation.pathTemplate};return}typeof r.operationPathTemplate!="string"&&(r.operationPathTemplate=e.operation.pathTemplate),t.details=r}function Cn(t){let e=new Set,r=!1;for(let n of t.operationsByMethod.values())for(let s of n)for(let i of s.servers)i.host?e.add(i.host):r=!0;return{specServerHosts:e,hasHostlessSpecServer:r}}async function $n(t,e){let r=[];for(let n of t)try{let s=await n.analyze(e);s.length>0&&r.push(...s)}catch(s){R.warn(`Rule "${n.id}" failed to execute: ${s.message}
|
|
18
|
+
`)}return r}var Ye=class t{startedAt=Date.now();runId=Qe();previewLimit;rules;schemaValidator=new T;coercingSchemaValidator=new T({coerceTypes:!0});options;coverage;counters=bn();findings=[];previewFindings=[];problemGroupsByRule={};problemKeyStats=new Map;totalProblemGroups=0;server;ignoreHeaders;minSeverityRank;specServerHosts;hasHostlessSpecServer;constructor(e,r){this.options=e,this.rules=r,this.server=be(e.server),this.ignoreHeaders=e.ignoreHeaders?Ie(e.ignoreHeaders):void 0;let{specServerHosts:n,hasHostlessSpecServer:s}=Cn(e.openApiIndex);this.specServerHosts=n,this.hasHostlessSpecServer=s,this.minSeverityRank=We[e.minSeverity??"info"],this.previewLimit=e.previewFindingsLimit&&e.previewFindingsLimit>0?e.previewFindingsLimit:Pn,this.coverage=e.coverage?new W({openApiIndex:e.openApiIndex,ignoreCookies:e.ignoreCookies??!1}):void 0}static create(e){if(e.openApiIndex.loadedOperations===0)throw new Error("No OpenAPI operations available to validate traffic against.");return new t(e,Ne(e.activeRules))}async process(e){this.counters.totalExchanges+=1;let r=qe(e.request.headers.cookie),n;if(this.server!==void 0&&(n=Oe(e.request,this.server),n===void 0))return this.counters.skippedExchanges+=1,this.coverage?.record(e,null,r),[];let s=this.isHostCompatible(e.request.host);s&&(this.counters.hostCompatibleExchanges+=1);let i=xe(this.options.openApiIndex,e,this.options.matchMode,n);i?this.counters.documentedExchanges+=1:this.counters.undocumentedExchanges+=1,this.coverage?.record(e,i,r);let o=await $n(this.rules,{exchange:e,matchedOperation:i,matchMode:this.options.matchMode,hostCompatibleWithSpecServers:n!==void 0||s,ignoreCookies:this.options.ignoreCookies??!1,ignoreHeaders:this.ignoreHeaders,cookies:r,validateSchema:(c,l,u)=>u?.coerce?this.coercingSchemaValidator.validate(c,l,u?.target):this.schemaValidator.validate(c,l,u?.target)}),a=[];for(let c of o){if(We[c.severity]<this.minSeverityRank)continue;xn(c,i);let l=kn(c,e);this.findings.push(l),a.push(l),On(this.counters,c);let u=B({ruleId:c.ruleId,severity:c.severity,message:c.message,operationId:c.operationId,path:e.request.path,target:c.target,schemaPath:c.schemaPath}),m=this.problemKeyStats.get(u);if(m){m.occurrences+=1,m.previewIndex!==null&&(this.previewFindings[m.previewIndex].occurrences=m.occurrences);continue}if(this.totalProblemGroups+=1,this.problemGroupsByRule[c.ruleId]=(this.problemGroupsByRule[c.ruleId]??0)+1,this.previewFindings.length<this.previewLimit){let w=this.previewFindings.length;this.previewFindings.push(An(c,e)),this.problemKeyStats.set(u,{occurrences:1,previewIndex:w});continue}this.problemKeyStats.set(u,{occurrences:1,previewIndex:null})}return a}isHostCompatible(e){return!e||this.hasHostlessSpecServer||this.specServerHosts.has(e.toLowerCase())}finalize(){let e={runId:this.runId,totalExchanges:this.counters.totalExchanges,documentedExchanges:this.counters.documentedExchanges,undocumentedExchanges:this.counters.undocumentedExchanges,skippedExchanges:this.counters.skippedExchanges,hostCompatibleExchanges:this.counters.hostCompatibleExchanges,findingsBySeverity:this.counters.findingsBySeverity,findingsByRule:this.counters.findingsByRule,problemGroupsByRule:this.problemGroupsByRule,totalProblemGroups:this.totalProblemGroups,durationMs:Date.now()-this.startedAt,previewFindings:this.previewFindings,previewLimit:this.previewLimit,previewTruncated:this.totalProblemGroups>this.previewFindings.length};return{runId:this.runId,summary:e,findings:this.findings,coverage:this.coverage?.finalize()}}};import{stat as En}from"node:fs/promises";var qn=["get","put","post","delete","patch","head","options","trace"],Tn=new Set(["query","header","path","cookie"]),Fn=/^(default|[1-5](\d{2}|xx))$/i;function Mn(t){return qn.includes(t)}function jn(t){return Tn.has(t)}function Xe(t){if(!Array.isArray(t))return[];let e=[];for(let r of t){if(!d(r))continue;let n=r.in;typeof n!="string"||!jn(n)||e.push({name:String(r.name??""),in:n,required:!!r.required||n==="path",style:typeof r.style=="string"?r.style:void 0,schema:r.schema})}return e}function Ze(t){let e=t.in==="header";return`${t.in}:${e?t.name.toLowerCase():t.name}`}function Bn(t,e){let r=new Map;for(let n of t)r.set(Ze(n),n);for(let n of e)r.set(Ze(n),n);return Array.from(r.values())}function tt(t){let e={};if(!d(t))return e;for(let[r,n]of Object.entries(t))d(n)&&"schema"in n&&(e[r.toLowerCase()]=n.schema);return e}function _n(t){return d(t)?tt(t.content):{}}function Ln(t){let e={};for(let[r,n]of Object.entries(t))!d(n)||!("content"in n)||(e[r]=tt(n.content));return e}function Nn(t,e,r){let n=t??e??r;return!Array.isArray(n)||n.length===0?[N("/")]:n.map(s=>{if(!d(s))return N("/");let i=typeof s.url=="string"?s.url:"/",o=d(s.variables)?s.variables:void 0;return N(i,o)})}function zn(t,e,r){return r||`${t.toUpperCase()} ${e}`}function Vn(t){try{let e=fe(t.parsed);return le(e)==="oas3"?e:null}catch{return null}}function et(t){return Array.isArray(t)?t:void 0}function Hn(t,e){let r,n,s={},i="/",o=[],a;return{Root:{enter(c){r=c.servers,n=c.security;let l=d(c.components)?c.components.securitySchemes:void 0;s=d(l)?l:{}}},Paths:{PathItem:{enter(c,l){i=Ee(String(l.key)),o=Xe(c.parameters),a=c.servers},Operation:{enter(c,l){let u=String(l.key);if(!Mn(u))return;let m=Bn(o,Xe(c.parameters)),w=Re(i),j=Nn(c.servers,a,r),b=c.requestBody,f=d(c.responses)?Object.fromEntries(Object.entries(c.responses).filter(([Y])=>Fn.test(Y))):{},h={operationId:zn(u,i,typeof c.operationId=="string"?c.operationId:void 0),method:u,pathTemplate:i,pathRegex:w.regex,pathParams:w.params,pathScore:w.score,servers:j,requestParameters:m,requestBodyContent:_n(b),requestBodyRequired:d(b)&&!!b.required,responseStatuses:Object.keys(f),responseBodyContent:Ln(f),security:et(c.security)??et(n),securitySchemes:s,specSource:t},y=e.get(u)??[];y.push(h),e.set(u,y)}}}}}}function Dn(t,e,r,n,s){let i=ae(r.extendTypes(ue(e),e),r),o=new Map,a={problems:[],specVersion:e,config:r,visitorsData:{}},c=me([{severity:"warn",ruleId:"drift-index",visitor:Hn(n,s)}],i);he({document:t,rootType:i.Root,normalizedVisitors:c,resolvedRefMap:o,ctx:a})}function Kn(t){return`${t.host??""}|${t.basePath}`}function Un(t){for(let e of t.values()){let r=new Map;for(let n of e){let s=r.get(n.pathRegex.source)??[];s.push(n),r.set(n.pathRegex.source,s)}for(let n of r.values()){let s=new Map;for(let i of n)for(let o of i.servers){let a=Kn(o),c=s.get(a)??new Set;c.add(i.specSource),s.set(a,c)}for(let i of s.values())if(i.size>1){let[o]=n;R.warn(`"${o.method.toUpperCase()} ${o.pathTemplate}" is documented for the same server in multiple descriptions (${Array.from(i).join(", ")}). Matching traffic is validated against only one of them.
|
|
19
|
+
`);break}}}}function Gn(t,e){for(let n of t.values())n.sort((s,i)=>i.pathScore-s.pathScore);let r=Array.from(t.values()).reduce((n,s)=>n+s.length,0);return{operationsByMethod:t,loadedSpecs:e,loadedOperations:r}}async function Jn(t){return(await En(t)).isDirectory()?{specFiles:await ye(t),fromDirectory:!0}:{specFiles:[t],fromDirectory:!1}}async function Ur(t,e){let{specFiles:r,fromDirectory:n}=await Jn(t),s=new Map,i=new ce(e.resolve),o=0;for(let a of r){let c=await i.resolveDocument(null,a,!0);if(c instanceof Error){R.warn(`Failed to load OpenAPI description ${a}: ${c.message}
|
|
20
|
+
`);continue}let l=Vn(c);if(!l){n||R.warn(`Skipping ${a}: not an OpenAPI 3.x description.
|
|
21
|
+
`);continue}let u;try{let{bundle:m}=await ge({config:e,doc:c,externalRefResolver:i,dereference:!0});u=m}catch(m){R.warn(`Failed to bundle OpenAPI description ${a}: ${m.message}
|
|
22
|
+
`);continue}o+=1,Dn(u,l,e,a,s)}return o>1&&Un(s),Gn(s,o)}function Jr(t){return t.split(",").map(e=>e.trim()).filter(Boolean)}export{Zn as a,Ye as b,Ur as c,Jr as d};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as T,b as O,c as A,d as E}from"./
|
|
7
|
+
import{a as T,b as O,c as A,d as E}from"./4YTHQAQD.js";import{c as m,k as C,r as $}from"./KMFAJMIP.js";import{a as q}from"./LRUXN6H5.js";import{c as H,ia as u,oa as y,pa as R}from"./BUNUOEXU.js";import"./NEWT5A6S.js";import{e as z}from"./RFWIIJFG.js";import{createReadStream as F,createWriteStream as k,existsSync as N}from"node:fs";import{appendFile as V,mkdir as _,rm as j,writeFile as W}from"node:fs/promises";import B from"node:path";import{createInterface as G}from"node:readline";var w=class{outputPath;entriesPath;creatorVersion;writeChain=Promise.resolve();directoryEnsured=!1;started=!1;count=0;constructor(t,r){this.outputPath=B.resolve(process.cwd(),t),this.entriesPath=`${this.outputPath}.entries.tmp`,this.creatorVersion=r}get entryCount(){return this.count}add(t){let r=`${JSON.stringify(t)}
|
|
8
8
|
`,n=this.writeChain.catch(()=>{}).then(()=>this.append(r)).then(()=>{this.count+=1});return this.writeChain=n.catch(()=>{}),n}async finalize(){await this.writeChain.catch(()=>{}),await this.ensureDirectory(),await this.writeDocument(),await j(this.entriesPath,{force:!0})}async append(t){if(await this.ensureDirectory(),!this.started){await W(this.entriesPath,t,"utf8"),this.started=!0;return}await V(this.entriesPath,t,"utf8")}async ensureDirectory(){this.directoryEnsured||(await _(B.dirname(this.outputPath),{recursive:!0}),this.directoryEnsured=!0)}async writeDocument(){let t=k(this.outputPath,{encoding:"utf8"}),r=n=>new Promise((o,s)=>{t.write(n,i=>i?s(i):o())});try{let n=JSON.stringify({name:"redocly-cli proxy",version:this.creatorVersion});await r(`{
|
|
9
9
|
"log": {
|
|
10
10
|
"version": "1.2",
|