@redocly/cli 0.0.0-snapshot.1788540651 → 0.0.0-snapshot.1789378191
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 +14 -1
- package/THIRD_PARTY_NOTICES +54 -35
- package/lib/chunks/{BFHO7GW5.js → 24MGFN2H.js} +1 -1
- package/lib/chunks/2LRIFBZK.js +10 -0
- package/lib/chunks/2NYATRFP.js +18 -0
- package/lib/chunks/44D2SQBU.js +7 -0
- package/lib/chunks/{J7P3F7QJ.js → 4HSNO3PP.js} +1 -1
- package/lib/chunks/{UYJYDDDB.js → 4NUNIZSF.js} +1 -1
- package/lib/chunks/{2NNPXF2N.js → 4OMUPCFF.js} +1 -1
- package/lib/chunks/4PTNG4EI.js +7 -0
- package/lib/chunks/{UOSLL6UT.js → 4Q3N3KT7.js} +1 -1
- package/lib/chunks/{ZVBMMURD.js → 5HAZCG6R.js} +1 -1
- package/lib/chunks/64G5RPLP.js +7 -0
- package/lib/chunks/{D3EE6JIC.js → 674SP4Z5.js} +1 -1
- package/lib/chunks/{YQT4MFVP.js → 6V66PW4I.js} +1 -1
- package/lib/chunks/75P32YWW.js +7 -0
- package/lib/chunks/AWTP3WDJ.js +13 -0
- package/lib/chunks/{EQBEQSTM.js → B2E6LPQR.js} +1 -1
- package/lib/chunks/{AEUD4DDQ.js → BLD5IGNL.js} +1 -1
- package/lib/chunks/BVMQ6FMV.js +10 -0
- package/lib/chunks/{HN6GLU35.js → D7RJJEJD.js} +1 -1
- package/lib/chunks/DCAHOUCO.js +13 -0
- package/lib/chunks/{RRLNRULV.js → DJJGZI4P.js} +1 -1
- package/lib/chunks/{XI7NS45W.js → DNJJYVRP.js} +1 -1
- package/lib/chunks/{CFWE2MV4.js → DNULLRHI.js} +1 -1
- package/lib/chunks/E5ZF3QIC.js +9 -0
- package/lib/chunks/EJH6BVJI.js +11 -0
- package/lib/chunks/EPZGM3QX.js +7 -0
- package/lib/chunks/ERBLCNSR.js +9 -0
- package/lib/chunks/{KJK2CVRO.js → FKSE2ZL2.js} +1 -1
- package/lib/chunks/{4SP2VQV6.js → G3RLLEQB.js} +352 -339
- package/lib/chunks/GFD2G3U3.js +7 -0
- package/lib/chunks/GO6ZAGDK.js +7 -0
- package/lib/chunks/HBUZKWXC.js +7 -0
- package/lib/chunks/HLZF5H73.js +7 -0
- package/lib/chunks/{ITXYN4EV.js → HP624JOH.js} +1 -1
- package/lib/chunks/I4NIS5UH.js +7 -0
- package/lib/chunks/IDCP2TSL.js +8 -0
- package/lib/chunks/{BXI4SF2U.js → JYCKA5ET.js} +1 -1
- package/lib/chunks/{2T4XB7HX.js → JZ6NUY4Q.js} +1 -1
- package/lib/chunks/{M4CK5D3I.js → KNBUOIFS.js} +1 -1
- package/lib/chunks/{O6PRCLSV.js → KXHIHQWX.js} +6 -6
- package/lib/chunks/L4SDMJXL.js +45 -0
- package/lib/chunks/{SHUOJE4P.js → LM7NPIFR.js} +1 -1
- package/lib/chunks/LTRDVJ6U.js +11 -0
- package/lib/chunks/{BZKWTLKZ.js → LU7PBC7B.js} +1 -1
- package/lib/chunks/MFDNGDFC.js +18 -0
- package/lib/chunks/MQXAA2TL.js +7 -0
- package/lib/chunks/OGCSP5MS.js +119 -0
- package/lib/chunks/OHJAW5OG.js +7 -0
- package/lib/chunks/ORZQD74F.js +7 -0
- package/lib/chunks/OYPX6FUN.js +11 -0
- package/lib/chunks/{OYM3UZZC.js → PXNLRJQW.js} +1 -1
- package/lib/chunks/{UA3WKZ5N.js → QEWCIFE2.js} +1 -1
- package/lib/chunks/QOBHO3CQ.js +34 -0
- package/lib/chunks/{227BDHLS.js → RADLRSOT.js} +1 -1
- package/lib/chunks/RBBOSADX.js +7 -0
- package/lib/chunks/{CHYVBQIC.js → RHQBOOVR.js} +2 -2
- package/lib/chunks/RORDX6PB.js +14 -0
- package/lib/chunks/{B56TYFA2.js → RY7FLCR6.js} +1 -1
- package/lib/chunks/{LSSHNT5F.js → RYS56VHH.js} +1 -1
- package/lib/chunks/{4K4T5JJX.js → S2CQROXW.js} +1 -1
- package/lib/chunks/{ONCO376P.js → S7FEPMNJ.js} +1 -1
- package/lib/chunks/SJHPKWSD.js +9 -0
- package/lib/chunks/SLEHNWRD.js +20 -0
- package/lib/chunks/{OHW62OX6.js → TYA7TBSX.js} +1 -1
- package/lib/chunks/TZSZR5YA.js +26 -0
- package/lib/chunks/U5DIFWGH.js +7 -0
- package/lib/chunks/{Z2SJI44G.js → UWCKCT24.js} +1 -1
- package/lib/chunks/VBZEJWSL.js +14 -0
- package/lib/chunks/{P26PQ2RU.js → VISOV75D.js} +1 -1
- package/lib/chunks/VQBN45JM.js +184 -0
- package/lib/chunks/{2C23O7BR.js → WK6NGYPJ.js} +1 -1
- package/lib/chunks/WQEJJBLX.js +29 -0
- package/lib/chunks/{FB2577DE.js → X5SAPEFC.js} +1 -1
- package/lib/chunks/{HUI3AHMA.js → XEXOH33A.js} +1 -1
- package/lib/chunks/{V3JDIYRX.js → XJVSUUET.js} +1 -1
- package/lib/chunks/Y772WSP3.js +105 -0
- package/lib/chunks/Y7NJOR7H.js +12 -0
- package/lib/chunks/{JGDGNU3W.js → YB2L2EYM.js} +1 -1
- package/lib/chunks/Z2VRZ47O.js +7 -0
- package/lib/chunks/{QFCBSN5R.js → ZNEWPSG3.js} +2 -2
- package/lib/chunks/ZT77275X.js +96 -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 +2 -2
- 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 +1 -1
- package/lib/eject-assets/generators/php/pagination.ts +1 -1
- 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/index.js +81 -408
- package/package.json +1 -1
- package/lib/chunks/4R45FXVW.js +0 -7
- package/lib/chunks/HJBZSEOJ.js +0 -47
- package/lib/chunks/QJMBADDW.js +0 -7
- package/lib/chunks/XA64NLCK.js +0 -14
- package/lib/chunks/YMXV6NM2.js +0 -22
- package/lib/chunks/ZMAMNQ5K.js +0 -184
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[@Redocly](https://redocly.com) CLI is your all-in-one API documentation utility.
|
|
4
4
|
It builds, manages, improves, and quality-checks your API descriptions, all of which comes in handy for various phases of the API Lifecycle.
|
|
5
5
|
Create your own rulesets to make API governance easy, publish beautiful API reference documentation, and more.
|
|
6
|
-
Supports OpenAPI 3.
|
|
6
|
+
Supports OpenAPI 3.x and 2.0 (legacy Swagger), AsyncAPI 3.x and 2.6, Arazzo 1.x, and more.
|
|
7
7
|
|
|
8
8
|

|
|
9
9
|

|
|
@@ -54,6 +54,19 @@ docker build -t redocly/cli .
|
|
|
54
54
|
docker run --rm -v $PWD:/spec redocly/cli lint path-to-root-file.yaml
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
### Use with AI assistants
|
|
58
|
+
|
|
59
|
+
Redocly CLI ships [agent skills](./.claude/skills) that teach AI coding assistants how to work with the CLI.
|
|
60
|
+
Install them into your project:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
npx skills add https://redocly.com
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- `redocly-cli` — day-to-day usage: lint, bundle, decorate, build docs, test, and generate a client.
|
|
67
|
+
- `redocly-lint-rules` — turn a check written in plain language into a built-in rule, a configurable rule, or a custom plugin.
|
|
68
|
+
It also covers migrating rules from other linters, such as Spectral.
|
|
69
|
+
|
|
57
70
|
## Common tasks
|
|
58
71
|
|
|
59
72
|
### Generate API reference documentation
|
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -612,27 +612,32 @@ ISC
|
|
|
612
612
|
|
|
613
613
|
Packages:
|
|
614
614
|
cliui@7.0.4 — Copyright (c) 2015, Contributors
|
|
615
|
+
isexe@2.0.0 — Copyright (c) Isaac Z. Schlueter and Contributors
|
|
615
616
|
minimatch@5.1.9 — Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors
|
|
616
617
|
picocolors@1.1.1 — Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov
|
|
617
618
|
semver@7.8.5 — Copyright (c) Isaac Z. Schlueter and Contributors
|
|
619
|
+
which@2.0.2 — Copyright (c) Isaac Z. Schlueter and Contributors
|
|
618
620
|
y18n@5.0.8 — Copyright (c) 2015, Contributors
|
|
619
621
|
yaml@2.9.0 — Copyright Eemeli Aro <eemeli@gmail.com>
|
|
620
622
|
yargs-parser@20.2.9 — Copyright (c) 2016, Contributors
|
|
623
|
+
zod-to-json-schema@3.25.2 — Copyright (c) 2020, Stefan Terdell
|
|
621
624
|
|
|
622
625
|
License text:
|
|
623
|
-
|
|
626
|
+
The ISC License
|
|
624
627
|
|
|
625
|
-
|
|
626
|
-
with or without fee is hereby granted, provided that the above copyright notice
|
|
627
|
-
and this permission notice appear in all copies.
|
|
628
|
+
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
628
629
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
630
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
631
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
632
|
+
copyright notice and this permission notice appear in all copies.
|
|
633
|
+
|
|
634
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
635
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
636
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
637
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
638
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
639
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
640
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
636
641
|
|
|
637
642
|
============================================================
|
|
638
643
|
MIT
|
|
@@ -644,13 +649,14 @@ Packages:
|
|
|
644
649
|
@emotion/is-prop-valid@1.4.0 — Copyright (c) Emotion team and other contributors
|
|
645
650
|
@emotion/memoize@0.9.0 — Copyright (c) Emotion team and other contributors
|
|
646
651
|
@faker-js/faker@10.6.0 — Copyright (c) 2022-2025
|
|
652
|
+
@modelcontextprotocol/sdk@1.30.0 — Copyright (c) 2024 Anthropic, PBC
|
|
647
653
|
@noble/hashes@1.8.0 — Copyright (c) 2022 Paul Miller (https://paulmillr.com)
|
|
648
654
|
@redocly/ajv@8.11.2 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
649
655
|
@redocly/ajv@8.18.3 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
650
656
|
@redocly/cli-otel@0.3.5 — Copyright 2025 Redocly Inc, all rights reserved.
|
|
651
657
|
@redocly/config@0.22.0 — Copyright 2024 Redocly Inc.
|
|
652
|
-
@redocly/config@0.
|
|
653
|
-
@redocly/openapi-core@1.34.
|
|
658
|
+
@redocly/config@0.56.0 — Copyright 2024 Redocly Inc.
|
|
659
|
+
@redocly/openapi-core@1.34.20
|
|
654
660
|
agent-base@7.1.4 — Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
|
655
661
|
ajv-formats@3.0.1 — Copyright (c) 2020 Evgeny Poberezkin
|
|
656
662
|
ajv@8.20.0 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
@@ -665,10 +671,14 @@ Packages:
|
|
|
665
671
|
color-name@1.1.4 — Copyright (c) 2015 Dmitry Ivanov
|
|
666
672
|
colorette@1.4.0 — Copyright © Jorge Bucaran <<https://jorgebucaran.com>>
|
|
667
673
|
colorette@2.0.20 — Copyright © Jorge Bucaran <<https://jorgebucaran.com>>
|
|
674
|
+
content-type@1.0.5 — Copyright (c) 2015 Douglas Christopher Wilson
|
|
668
675
|
cookie@0.7.2 — Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
|
|
676
|
+
cross-spawn@7.0.6 — Copyright (c) 2018 Made With MOXY Lda <hello@moxy.studio>
|
|
669
677
|
debug@4.4.3 — Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
|
670
678
|
escalade@3.2.0
|
|
671
679
|
eventemitter3@5.0.1 — Copyright (c) 2014 Arnout Kazemier
|
|
680
|
+
eventsource-parser@3.1.1 — Copyright (c) 2026 Espen Hovlandsdal <espen@hovlandsdal.com>
|
|
681
|
+
eventsource@3.0.7 — Copyright (c) EventSource GitHub organisation
|
|
672
682
|
fast-deep-equal@3.1.3 — Copyright (c) 2017 Evgeny Poberezkin
|
|
673
683
|
fast-safe-stringify@2.1.1 — Copyright (c) 2016 David Mark Clements
|
|
674
684
|
foreach@2.0.6 — Copyright (c) 2013 Manuel Stofer
|
|
@@ -678,7 +688,7 @@ Packages:
|
|
|
678
688
|
https-proxy-agent@7.0.6 — Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
|
679
689
|
js-levenshtein@1.1.6 — Copyright (c) 2017 Gustaf Andersson
|
|
680
690
|
js-tokens@4.0.0 — Copyright (c) 2014, 2015, 2016, 2017, 2018 Simon Lydell
|
|
681
|
-
js-yaml@4.3.
|
|
691
|
+
js-yaml@4.3.2 — Copyright (C) 2011-2015 by Vitaly Puzrin
|
|
682
692
|
js-yaml@5.2.2 — Copyright (C) 2011-2015 by Vitaly Puzrin
|
|
683
693
|
json-pointer@0.6.2 — Copyright (c) 2016 Manuel Stofer
|
|
684
694
|
json-schema-traverse@1.0.0 — Copyright (c) 2017 Evgeny Poberezkin
|
|
@@ -691,10 +701,12 @@ Packages:
|
|
|
691
701
|
mobx@6.12.3 — Copyright (c) 2015 Michel Weststrate
|
|
692
702
|
ms@2.1.3
|
|
693
703
|
object-assign@4.1.1
|
|
694
|
-
openapi-sampler@1.7.
|
|
704
|
+
openapi-sampler@1.7.5 — Copyright (c) 2017 Roman Hotsiy <gotsijroman@gmail.com>
|
|
695
705
|
outdent@0.8.0 — Copyright (c) 2016 Andrew Bradley
|
|
706
|
+
path-key@3.1.1
|
|
696
707
|
perfect-scrollbar@1.5.6 — Copyright (c) 2012-2019 Hyunje Jun, MDBootstrap.com and other contributors
|
|
697
708
|
picomatch@4.0.4 — Copyright (c) 2017-present, Jon Schlinkert.
|
|
709
|
+
pkce-challenge@5.0.1 — Copyright (c) 2019
|
|
698
710
|
pluralize@8.0.0 — Copyright (c) 2013 Blake Embrey (hello@blakeembrey.com)
|
|
699
711
|
polished@4.3.1 — Copyright (c) 2016-Present Brian Hough and Maximilian Stoiber
|
|
700
712
|
prismjs@1.30.0 — Copyright (c) 2012 Lea Verou
|
|
@@ -703,8 +715,10 @@ Packages:
|
|
|
703
715
|
react-is@16.13.1 — Copyright (c) Facebook, Inc. and its affiliates.
|
|
704
716
|
react-tabs@6.1.1 — Copyright (c) Matt Zabriskie and Daniel Tschinder
|
|
705
717
|
react@19.2.7 — Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
706
|
-
redoc@2.5.
|
|
718
|
+
redoc@2.5.4 — Copyright (c) 2015-present, Rebilly, Inc.
|
|
707
719
|
set-cookie-parser@2.7.1 — Copyright (c) 2015 Nathan Friedly <nathan@nfriedly.com> (http://nfriedly.com/)
|
|
720
|
+
shebang-command@2.0.0
|
|
721
|
+
shebang-regex@3.0.0
|
|
708
722
|
slugify@1.4.7 — Copyright (c) Simeon Velichkov <simeonvelichkov@gmail.com>
|
|
709
723
|
styled-components@6.4.2 — Copyright (c) 2016-present Glen Maddern and Maximilian Stoiber
|
|
710
724
|
stylis@4.3.6 — Copyright (c) 2016-present Sultan Tarimo
|
|
@@ -715,27 +729,32 @@ Packages:
|
|
|
715
729
|
uri-js-replace@1.0.1
|
|
716
730
|
use-sync-external-store@1.6.0 — Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
717
731
|
yargs@17.0.1 — Copyright 2010 James Halliday (mail@substack.net); Modified work Copyright 2014 Contributors (ben@npmjs.com)
|
|
732
|
+
zod@4.4.3 — Copyright (c) 2025 Colin McDonnell
|
|
718
733
|
|
|
719
734
|
License text:
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
735
|
+
(The MIT License)
|
|
736
|
+
|
|
737
|
+
Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
|
|
738
|
+
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
|
739
|
+
|
|
740
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
741
|
+
a copy of this software and associated documentation files (the
|
|
742
|
+
'Software'), to deal in the Software without restriction, including
|
|
743
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
744
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
745
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
746
|
+
the following conditions:
|
|
747
|
+
|
|
748
|
+
The above copyright notice and this permission notice shall be
|
|
749
|
+
included in all copies or substantial portions of the Software.
|
|
750
|
+
|
|
751
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
752
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
753
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
754
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
755
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
756
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
757
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
739
758
|
|
|
740
759
|
============================================================
|
|
741
760
|
unknown
|
|
@@ -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 Ei,b as Ah}from"./
|
|
7
|
+
import{a as Ei,b as Ah}from"./KXHIHQWX.js";import{a as wh}from"./32XCOMOR.js";import{ba as It,c as z,da as $s,fa as Os,ga as Ks,ia as Js,l as Mi,m as ha,s as Gs,x as Is}from"./VQBN45JM.js";import{c as pe,e as ve}from"./RFWIIJFG.js";var $i=pe((Zr,Ii)=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.outdent=void 0;function Ut(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r]}function Ml(){return typeof WeakMap<"u"?new WeakMap:hm()}function hm(){return{add:Ut,delete:Ut,get:Ut,set:Ut,has:function(e){return!1}}}var mm=Object.prototype.hasOwnProperty,Gi=function(e,r){return mm.call(e,r)};function Fi(e,r){for(var a in r)Gi(r,a)&&(e[a]=r[a]);return e}var pm=/^[ \t]*(?:\r\n|\r|\n)/,fm=/(?:\r\n|\r|\n)[ \t]*$/,ym=/^(?:[\r\n]|$)/,gm=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,bm=/^[ \t]*[\r\n][ \t\r\n]*$/;function El(e,r,a){var t=0,n=e[0].match(gm);n&&(t=n[1].length);var i="(\\r\\n|\\r|\\n).{0,"+t+"}",o=new RegExp(i,"g");r&&(e=e.slice(1));var l=a.newline,h=a.trimLeadingNewline,p=a.trimTrailingNewline,g=typeof l=="string",b=e.length,T=e.map(function(B,W){return B=B.replace(o,"$1"),W===0&&h&&(B=B.replace(pm,"")),W===b-1&&p&&(B=B.replace(fm,"")),g&&(B=B.replace(/\r\n|\n|\r/g,function(H){return l})),B});return T}function km(e,r){for(var a="",t=0,n=e.length;t<n;t++)a+=e[t],t<n-1&&(a+=r[t]);return a}function Cm(e){return Gi(e,"raw")&&Gi(e,"length")}function xl(e){var r=Ml(),a=Ml();function t(i){for(var o=[],l=1;l<arguments.length;l++)o[l-1]=arguments[l];if(Cm(i)){var h=i,p=(o[0]===t||o[0]===Qe)&&bm.test(h[0])&&ym.test(h[1]),g=p?a:r,b=g.get(h);if(b||(b=El(h,p,e),g.set(h,b)),o.length===0)return b[0];var T=km(b,p?o.slice(1):o);return T}else return xl(Fi(Fi({},e),i||{}))}var n=Fi(t,{string:function(i){return El([i],!1,e)[0]}});return n}var Qe=xl({trimLeadingNewline:!0,trimTrailingNewline:!0});Zr.outdent=Qe;Zr.default=Qe;if(typeof Ii<"u")try{Ii.exports=Qe,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.default=Qe,Qe.outdent=Qe}catch{}});var tu=pe(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var Ef="[",xf="]",Rf="{",Lf="}",Pf=":",Df=",",Zc="true",Xc="false",Qc="null",Vc='"',Nf=new Map([["t",Zc],["f",Xc],["n",Qc]]),ho=new Map([[Vc,Vc],["\\","\\"],["/","/"],["b","\b"],["n",`
|
|
8
8
|
`],["f","\f"],["r","\r"],["t"," "]]),uo=new Map([[Ef,"Punctuator"],[xf,"Punctuator"],[Rf,"Punctuator"],[Lf,"Punctuator"],[Pf,"Punctuator"],[Df,"Punctuator"],[Zc,"Boolean"],[Xc,"Boolean"],[Qc,"Null"]]),Wa=class extends Error{constructor(r,{line:a,column:t,index:n}){super(`${r} (${a}:${t})`),this.line=a,this.column=t,this.index=n}},mo=class extends Wa{constructor(r,a){super(`Unexpected character ${r} found.`,a)}},pr=class extends Wa{constructor(r){super(`Unexpected token ${r.type}(${r.value}) found.`,r.loc.start)}},po=class extends Wa{constructor(r){super("Unexpected end of input found.",r)}},Uc='"',Yc="/",qc="*",Hf={comments:!1,ranges:!1};function Wf(e){return/[\s\n]/.test(e)}function Ca(e){return e>="0"&&e<="9"}function Ff(e){return Ca(e)||/[a-f]/i.test(e)}function Gf(e){return e>="1"&&e<="9"}function If(e){return/[tfn]/.test(e)}function $f(e){return Ca(e)||e==="."||e==="-"}function eu(e,r){r=Object.freeze({...Hf,...r});let a=-1,t=1,n=0,i=!1,o=[];function l(w,S,R,E){let L=R.offset+S.length,re=r.ranges?{range:[R.offset,L]}:void 0;return{type:w,value:S,loc:{start:R,end:E||{line:R.line,column:R.column+S.length,offset:L}},...re}}function h(){let w=e.charAt(++a);return i?(t++,n=1,i=!1):n++,w==="\r"?(i=!0,e.charAt(a+1)===`
|
|
9
9
|
`&&a++):w===`
|
|
10
10
|
`&&(i=!0),w}function p(){return{line:t,column:n,offset:a}}function g(w){let S=Nf.get(w);if(e.slice(a,a+S.length)===S)return a+=S.length-1,n+=S.length-1,{value:S,c:h()};for(let R=1;R<S.length;R++)S[R]!==e.charAt(a+R)&&W(h())}function b(w){let S=w;for(w=h();w&&w!==Uc;){if(w==="\\")if(S+=w,w=h(),ho.has(w))S+=w;else if(w==="u"){S+=w;for(let R=0;R<4;R++)w=h(),Ff(w)?S+=w:W(w)}else W(w);else S+=w;w=h()}return w||H(),S+=w,{value:S,c:h()}}function T(w){let S="";if(w==="-"&&(S+=w,w=h(),Ca(w)||W(w)),w==="0")S+=w,w=h(),Ca(w)&&W(w);else{Gf(w)||W(w);do S+=w,w=h();while(Ca(w))}if(w===".")do S+=w,w=h();while(Ca(w));if(w==="e"||w==="E")for(S+=w,w=h(),(w==="+"||w==="-")&&(S+=w,w=h()),Ca(w)||W(w);Ca(w);)S+=w,w=h();return{value:S,c:w}}function B(w){let S=w;if(w=h(),w==="/"){do S+=w,w=h();while(w&&w!=="\r"&&w!==`
|
|
@@ -0,0 +1,10 @@
|
|
|
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 o,c as n}from"./HBUZKWXC.js";import{W as t}from"./VQBN45JM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as m}from"node:child_process";var j=async({argv:e})=>{t.info(`
|
|
8
|
+
Launching eject using NPX.
|
|
9
|
+
|
|
10
|
+
`);let{npxExecutableName:i,sanitize:r,shell:c}=n(),p=r(e.path,o),s=r(e["project-dir"],o);m(i,["-y","@redocly/realm","eject",`${e.type}`,p,`-d=${s}`,e.force?`--force=${e.force}`:""],{stdio:"inherit",shell:c}).on("error",a=>{throw t.info(`Eject launch failed: ${a.message}`),new Error("Eject launch failed.")})};export{j as handleEject};
|
|
@@ -0,0 +1,18 @@
|
|
|
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 $,d as xt,e as et}from"./I4NIS5UH.js";import{a as Ot}from"./64G5RPLP.js";import{d as lt,g as ut,n as gt,o as ht,t as yt}from"./L4SDMJXL.js";import{b as O}from"./HP624JOH.js";import{H as Z,N as D,O as G,P as k,Q as v,W as T,Y as tt,aa as ft,b as N,c as M,d as it,fa as ct,g as at,ga as mt,i as U,q as E,u as pt}from"./VQBN45JM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import*as Nt from"node:path";import{performance as jt}from"node:perf_hooks";import*as dt from"node:path";function Pt(t,e){xt(t,o=>{if(E(o)&&et(o.$ref)){let r=dt.basename(o.$ref);o.$ref=o.$ref.replace(r,e+"_"+r)}else if(M(o.discriminator)&&M(o.discriminator.mapping)){let{mapping:r}=o.discriminator;for(let i of Object.keys(r)){let c=r[i];typeof c=="string"&&et(c)&&(r[i]=c.split("/").map((d,s,p)=>p.length-1===s&&!d.startsWith(e+"_")?e+"_"+d:d).join("/"))}}})}function j(t,e,o){return e?(t||O("Info section is not found in specification."),t[e]||O(`${k(`prefix-${o}-with-info-prop`)} argument value is not found in info section.`),at(t[e])||O(`${k(`prefix-${o}-with-info-prop`)} argument value should be string.`),t[e].length>50&&O(`${k(`prefix-${o}-with-info-prop`)} argument value length should not exceed 50 characters.`),t[e].replaceAll(/\s/g,"_")):""}function ot(t,e){return e?t?.map(o=>{let r={};for(let[i,c]of Object.entries(o))Object.assign(r,{[e+"_"+i]:c});return r}):t}function C(t,e){return e?e+"_"+t:t}import*as bt from"node:path";function q(t,e){return t.replace(/"(#\/components\/.*?)"/g,o=>{let r=bt.basename(o);return o.replace(r,C(r,e))})}function B(t){return t.map(e=>({name:e}))}import*as K from"node:path";function wt(t){return K.basename(t,K.extname(t))}function vt(t){return Object.entries(t).filter(([e,o])=>o.length>1)}function rt(t,e){for(let[o,r]of e)T.warn(`Conflict on ${t} : ${D(o)} in files: ${v(r)}
|
|
8
|
+
`)}function Tt(t){T.info(G(`
|
|
9
|
+
${t} conflict(s) on tags.
|
|
10
|
+
Suggestion: please use ${v("prefix-tags-with-filename")}, ${v("prefix-tags-with-info-prop")} or ${v("without-x-tag-groups")} to prevent naming conflicts.
|
|
11
|
+
|
|
12
|
+
`))}function $t(t){let e=t.map(([r])=>`\`${r}\``),o=k(", ");T.warn(`
|
|
13
|
+
warning: ${e.length} conflict(s) on the ${D(e.join(o))} tags description.
|
|
14
|
+
`)}function Ft(t,e){return!N(Object.values(t)[0],Object.values(e)[0])}function Jt(t){let e=!1;for(let o=0,r=t.length;o<r;o++){let i=t[o+1];i&&Ft(t[o],i)&&(e=!0)}return e}var st=0;function St({potentialConflicts:t,withoutXTagGroups:e}){for(let o of Object.keys(t))for(let[r,i]of Object.entries(t[o])){let c=vt(i);if(c.length){if(o===$)for(let[d,s]of Object.entries(c))Jt(s[1])&&(s[1]=s[1].map(p=>Object.keys(p)[0]),rt(G(o)+" => "+r,[s]),st+=1);else e&&o==="tags"?$t(c):(st+=c.length,rt(G(o)+" => "+r,c));o==="tags"&&!e&&Tt(c.length)}}return st}var W="tags",A="x-tagGroups";function _({joinedDef:t,withoutXTagGroups:e,context:o}){let{api:r,apiFilename:i,apiTitle:c,tags:d,potentialConflicts:s,tagsPrefix:p,componentsPrefix:w,oasVersion:P}=o;t.hasOwnProperty(W)||(t[W]=[]),s.tags.hasOwnProperty("all")||(s.tags.all={}),e&&!s.tags.hasOwnProperty("description")&&(s.tags.description={});for(let f of d||[]){let g=C(f.name,p);f.description&&(f.description=q(f.description,w));let x=t.tags.find(b=>b.name===g);if(x&&e){let b=f.hasOwnProperty("description")&&x.description!==f.description;s.tags.description[g].push(...b?[r]:[])}else x||(P==="oas3_0"||P==="oas3_1"?f["x-displayName"]=f["x-displayName"]||f.name:P==="oas3_2"&&(f.summary=f.summary||f.name),f.name=g,t.tags.push(f),e&&(s.tags.description[g]=[r]));if(!e&&P!=="oas3_2"){let b=c||i;Vt(t,b),x||Mt(t,g,Ct(t,b))}let S=!s.tags.all[g]||s.tags.all[g]&&!s.tags.all[g].includes(r);s.tags.all[g]=[...s.tags.all[g]||[],...!e&&S?[r]:[]]}}function Ct(t,e){return t[A].findIndex(o=>o.name===e)}function Vt(t,e){t.hasOwnProperty(A)||(t[A]=[]),t[A].some(r=>r.name===e)||t[A].push({name:e,tags:[]});let o=Ct(t,e);t[A][o].hasOwnProperty(W)||(t[A][o][W]=[])}function Mt(t,e,o){t[A][o][W].find(r=>r.name===e)||t[A][o][W].push(e)}import*as kt from"node:path";function At({joinedDef:t,openapi:e,context:o}){let{api:r}=o,{externalDocs:i}=e;if(i){if(t.hasOwnProperty("externalDocs")){T.warn(`warning: skip externalDocs from ${v(kt.basename(r))}
|
|
15
|
+
`);return}t.externalDocs=i}}function It({joinedDef:t,withoutXTagGroups:e,openapi:o,context:r,serversAreTheSame:i}){let{apiFilename:c,apiTitle:d,api:s,potentialConflicts:p,tagsPrefix:w,componentsPrefix:P,oasVersion:f}=r,{paths:g,servers:x}=o,S=new Set(Ot);if(g){t.hasOwnProperty("paths")||(t.paths={});for(let l of U(g)){t.paths.hasOwnProperty(l)||(t.paths[l]={}),p.paths.hasOwnProperty(l)||(p.paths[l]={});let n=g[l],a=i?n.servers:n.servers||x||[];a&&F(a,l);for(let m of U(n))S.has(m)&&L(n,l,m),m==="parameters"&&H(n,l),(typeof n[m]=="string"||m.startsWith("x-"))&&b(n,l,m)}}function b(l,n,a){let m=l[a];if(t.paths[n].hasOwnProperty(a)&&!N(t.paths[n][a],m)){T.warn(`warning: different ${a} values in ${n}
|
|
16
|
+
`);return}t.paths[n][a]=m}function F(l,n){if(l){t.paths[n].hasOwnProperty("servers")||(t.paths[n].servers=[]);for(let a of l){let m=!1;for(let u of t.paths[n].servers)u.url===a.url&&(Gt(u,a)||O(`Different server values for (${a.url}) in ${n}.`),m=!0);m||t.paths[n].servers.push(a)}}}function H(l,n){if(l.parameters){t.paths[n].hasOwnProperty("parameters")||(t.paths[n].parameters=[]);for(let a of l.parameters){let m=!1;for(let u of t.paths[n].parameters)E(u)&&E(a)&&u.$ref===a.$ref&&(m=!0),!E(u)&&!E(a)&&u.name===a.name&&u.in===a.in&&(N(u.schema,a.schema)||O(`Different parameter schemas for (${a.name}) in ${n}.`),m=!0);m||t.paths[n].parameters.push(a)}}}function L(l,n,a){let m=l[a];if(!m)return;t.paths[n][a]=m,p.paths[n][a]=[...p.paths[n][a]||[],s];let{operationId:u}=m;u&&(p.paths.hasOwnProperty("operationIds")||(p.paths.operationIds={}),p.paths.operationIds[u]=[...p.paths.operationIds[u]||[],s]);let{tags:R,security:X}=t.paths[n][a];R?(t.paths[n][a].tags=R.map(Y=>C(Y,w)),_({joinedDef:t,withoutXTagGroups:e,context:{api:s,apiFilename:c,apiTitle:d,tags:B(R),potentialConflicts:p,tagsPrefix:w,componentsPrefix:P,oasVersion:f}})):(t.paths[n][a].tags=[C("other",w||c)],_({joinedDef:t,withoutXTagGroups:e,context:{api:s,apiFilename:c,apiTitle:d,tags:B(["other"]),potentialConflicts:p,tagsPrefix:w||c,componentsPrefix:P,oasVersion:f}})),!X&&o.hasOwnProperty("security")?t.paths[n][a].security=ot(o.security,P):m.security&&(t.paths[n][a].security=ot(m.security,P))}}function Gt(t,e){return t.description===e.description?N(t.variables,e.variables):!1}function Et({joinedDef:t,openapi:e,context:o}){let{api:r,potentialConflicts:i,componentsPrefix:c}=o,{components:d}=e;if(d){t.hasOwnProperty($)||(t[$]={});for(let[s,p]of Object.entries(d)){i[$].hasOwnProperty(s)||(i[$][s]={},t[$][s]={});for(let w of Object.keys(p)){let P=C(w,c);i.components[s][P]=[...i.components[s][w]||[],{[r]:p[w]}],t.components[s][P]=p[w]}}}}function _t({joinedDef:t,withoutXTagGroups:e,openapi:o,context:r}){let{apiFilename:i,apiTitle:c,api:d,potentialConflicts:s,tagsPrefix:p,componentsPrefix:w,oasVersion:P}=r,f=P==="oas3_0"?"x-webhooks":"webhooks",g=o[f];if(g){t.hasOwnProperty(f)||(t[f]={});for(let x of Object.keys(g)){t[f][x]=g[x],s.webhooks.hasOwnProperty(x)||(s.webhooks[x]={});for(let S of Object.keys(g[x]))s.webhooks[x][S]=[...s.webhooks[x][S]||[],d];for(let S of Object.keys(t[f][x])){let{tags:b}=t[f][x][S];b&&(t[f][x][S].tags=b.map(F=>C(F,p)),_({joinedDef:t,withoutXTagGroups:e,context:{api:d,apiFilename:i,apiTitle:c,tags:B(b),potentialConflicts:s,tagsPrefix:p,componentsPrefix:w,oasVersion:P}}))}}}}function Rt(t,e,o){let i=e[0].parsed,c=j(i.info,o,$);i.openapi||O("Version of specification is not found."),i.info||O("Info section is not found in specification."),i.info?.description&&(i.info.description=q(i.info.description,c)),t.openapi=i.openapi,t.info=i.info}async function Oo({argv:t,config:e,version:o,collectSpecData:r}){let i=jt.now(),{"prefix-components-with-info-prop":c,"prefix-tags-with-filename":d,"prefix-tags-with-info-prop":s,"without-x-tag-groups":p,output:w}=t,P=[d&&"prefix-tags-with-filename",s&&"prefix-tags-with-info-prop",p&&"without-x-tag-groups"].filter(Boolean);if(P.length>1)return O(`You use ${k(P.join(", "))} together.
|
|
17
|
+
Please choose only one!`);let f=await lt(t.apis,e);if(f.length<2)return O("At least 2 APIs should be provided.");let g=ht(w||f[0].path),x=w||`openapi.${g}`,S=new Z(e.resolve),b=await Promise.all(f.map(({path:h})=>S.resolveDocument(null,h,!0))),F=new Set([...Object.keys(e.decorators.oas3_0),...Object.keys(e.decorators.oas3_1),...Object.keys(e.decorators.oas2)]);e.skipDecorators(Array.from(F));let H=new Set([...Object.keys(e.preprocessors.oas3_0),...Object.keys(e.preprocessors.oas3_1),...Object.keys(e.preprocessors.oas2)]);e.skipPreprocessors(Array.from(H));let L=await Promise.all(b.map(h=>ft({document:h,config:e,externalRefResolver:new Z(e.resolve),types:pt(tt(h.parsed))}).catch(y=>{O(`${y.message}: ${v(h.source.absoluteRef)}`)})));for(let{problems:h,bundle:y}of L){let I=ct(h);I.errors&&(mt(h,{totals:I,version:o,command:"join"}),O(`\u274C Errors encountered while bundling ${v(y.source.absoluteRef)}: join will not proceed.`))}let l=null;for(let h of b)try{let y=tt(h.parsed);if(r?.(h),y!=="oas3_0"&&y!=="oas3_1"&&y!=="oas3_2")return O(`Only OpenAPI 3.0, 3.1, and 3.2 are supported: ${v(h.source.absoluteRef)}.`);if(l=l??y,l!==y)return O(`All APIs must use the same OpenAPI version: ${v(h.source.absoluteRef)}.`)}catch(y){return O(`${y.message}: ${v(h.source.absoluteRef)}.`)}let[n,...a]=b??[],m=a.every(({parsed:{paths:h,servers:y}})=>!h||it(h||{})?!0:y?.every(I=>n.parsed.servers?.find(({url:J})=>J===I.url))),u={},R={tags:{},paths:{},components:{},webhooks:{}};Rt(u,b,c),m&&n.parsed.servers&&(u.servers=n.parsed.servers);for(let h of b){let y=M(h.parsed)?h.parsed:{},{tags:I,info:J}=y,z=Nt.relative(process.cwd(),h.source.absoluteRef),nt=wt(z),Wt=d?nt:j(J,s,"tags"),Q=j(J,c,$);y.hasOwnProperty("x-tagGroups")&&T.warn(`warning: x-tagGroups at ${v(z)} will be skipped
|
|
18
|
+
`);let V={api:z,apiFilename:nt,apiTitle:J?.title,tags:I,potentialConflicts:R,tagsPrefix:Wt,componentsPrefix:Q,oasVersion:l};I&&_({joinedDef:u,withoutXTagGroups:p,context:V}),At({joinedDef:u,openapi:y,context:V}),It({joinedDef:u,withoutXTagGroups:p,openapi:y,context:V,serversAreTheSame:m}),Et({joinedDef:u,openapi:y,context:V}),_t({joinedDef:u,withoutXTagGroups:p,openapi:y,context:V}),Q&&Pt(y,Q)}let X=St({potentialConflicts:R,withoutXTagGroups:p}),Y=!0;if(X)return O(`Please fix conflicts before running ${k("join")}.`);gt(yt(u),x,Y),ut("join",i,x)}export{Oo as handleJoin};
|
|
@@ -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={name:"@redocly/cli",version:"0.0.0-snapshot.1789378191",description:"",license:"MIT",bin:{redocly:"bin/cli.js",openapi:"bin/cli.js"},type:"module",engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{build:"node ./scripts/build.mjs","prepare:publish-dir":"node ./scripts/prepare-publish-dir.mjs","clean:publish-dir":`node -e "require('fs').rmSync('.publish', {recursive:true, force:true})"`},publishConfig:{directory:".publish"},repository:{type:"git",url:"https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["linter","OpenAPI","Swagger","OpenAPI linter","Swagger linter","AsyncAPI linter","Arazzo linter","oas"],contributors:["Roman Hotsiy <roman@redocly.com> (https://redocly.com/)"],devDependencies:{"@modelcontextprotocol/sdk":"^1.30.0","@opentelemetry/exporter-trace-otlp-http":"0.219.0","@opentelemetry/resources":"2.8.0","@opentelemetry/sdk-trace-node":"2.8.0","@opentelemetry/semantic-conventions":"1.41.1","@redocly/cli-otel":"0.3.5","@redocly/client-generator":"0.0.0-snapshot.1789378191","@redocly/openapi-core":"0.0.0-snapshot.1789378191","@redocly/respect-core":"0.0.0-snapshot.1789378191","@types/cookie":"0.6.0","@types/har-format":"^1.2.16","@types/react":"^17.0.0 || ^18.2.21 || ^19.2.16","@types/react-dom":"^17.0.0 || ^18.2.7 || ^19.2.3","@types/semver":"^7.5.0","@types/set-cookie-parser":"2.4.10","@types/yargs":"17.0.32",colorette:"^1.2.0",cookie:"^0.7.2",dotenv:"16.4.7",esbuild:"^0.28.0",glob:"^13.0.5",handlebars:"^4.7.9","https-proxy-agent":"^7.0.5",react:"^17.0.0 || ^18.2.0 || ^19.2.7","react-dom":"^17.0.0 || ^18.2.0 || ^19.2.7",redoc:"2.5.4",semver:"^7.5.2","set-cookie-parser":"^2.3.5","styled-components":"6.4.2",typescript:"6.0.2",ulid:"^3.0.1",undici:"^6.28.0",yargs:"17.0.1"}};var{version:s,name:n,engines:c}=e,i=e.devDependencies.redoc,p="sha384-w447zOpYfw/1Tv/5AK9NfHTlQIqE3RVR6KY62jCyy9zNDgO64cMwGGP1Fj0zJVf5";export{s as a,n as b,c,i as d,p as e};
|
|
@@ -4,4 +4,4 @@ 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,b,c}from"./
|
|
7
|
+
import{a,b,c}from"./LM7NPIFR.js";import"./2U6O26CV.js";import"./S2CQROXW.js";import"./4OMUPCFF.js";import"./ZNEWPSG3.js";import"./WZXA5XPB.js";import"./VQBN45JM.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as typescriptDocs,a as typescriptGenerator,c as typescriptSample};
|
|
@@ -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{c as U}from"./2U6O26CV.js";import{b as Z,c as R,d as L,e as Y,f as oe,g as K,h as re}from"./
|
|
7
|
+
import{c as U}from"./2U6O26CV.js";import{b as Z,c as R,d as L,e as Y,f as oe,g as K,h as re}from"./4OMUPCFF.js";import{a as X,c as F,d as k,e as D,g as B,h as T,i as ee,j as ne,k as te,l as H,n as se}from"./UW4UC7ZI.js";var M=F.python,j=class extends X{constructor(){super(" ")}typeName(n){return k(n,{style:"pascal",reserved:M})}memberName(n){let t=k(n,{style:"snake",reserved:M});return{identifier:t,renamed:t!==n}}identifier(n){return k(n,{style:"snake",reserved:M})}identifiers(n,t){return D(n,{style:"snake",reserved:M,taken:t})}constName(n){return k(n,{style:"screaming",reserved:M})}string(n){let t='"';for(let s of n){let r=s.codePointAt(0);s==="\\"?t+="\\\\":s==='"'?t+='\\"':s===`
|
|
8
8
|
`?t+="\\n":s==="\r"?t+="\\r":s===" "?t+="\\t":r<32||r===127?t+=`\\x${r.toString(16).padStart(2,"0")}`:r>=55296&&r<=57343?t+=`\\u${r.toString(16).padStart(4,"0")}`:t+=s}return t+'"'}literal(n){return n==null?"None":n===!0?"True":n===!1?"False":typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(s=>this.literal(s)).join(", ")}]`:`{${Object.entries(n).map(([s,r])=>`${this.string(s)}: ${this.literal(r)}`).join(", ")}}`}comment(n){for(let t of H(n))this.line(t===""?"#":`# ${t}`);return this}doc(n){let t=H(n);if(t.length===0)return this;if(t.length===1)return this.line(`"""${t[0]}"""`);this.line(`"""${t[0]}`);for(let s of t.slice(1))this.line(s);return this.line('"""')}};var N=F.python,f=new j;function O(e){return f.typeName(e)}function q(e){let{identifier:n,renamed:t}=f.memberName(e);return{python:n,renamed:t}}function I(e){let n=e.services.flatMap(s=>s.operations),t=D(n.map(s=>s.name),{style:"snake",reserved:N});return n.map((s,r)=>({op:s,ident:t[r]}))}var W=["self","body","headers","timeout","retry","idempotency_key"];function ae(e){return f.literal(e)}function ie(e){if(e!==void 0)return{style:e.style,...e.param!==void 0?{param:e.param}:{},...e.nextCursor!==void 0?{next_cursor:e.nextCursor}:{},...e.hasMore!==void 0?{has_more:e.hasMore}:{},...e.limitParam!==void 0?{limit_param:e.limitParam}:{},...e.items!==void 0?{items:e.items}:{}}}function ce(e,n){let t=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let a=k(r.name,{style:"snake",reserved:N}),c=a,i=2;for(;t.has(c);)c=`${a}_${i++}`;t.add(c);let m=se(r.schema,n);return`(${f.string(r.name)}, ${f.string(c)}, ${f.string(m)})`}).join(", ")}]`}function y(e,n="string"){if(ee(e))return`Optional[${y(ne(e),n)}]`;switch(e.kind){case"scalar":if(n==="Date"&&e.scalar==="string"){if(e.metadata?.format==="date-time")return"datetime";if(e.metadata?.format==="date")return"date"}return{string:"str",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":return`List[${y(e.items,n)}]`;case"record":return`Dict[str, ${y(e.value,n)}]`;case"ref":return O(e.name);case"literal":return`Literal[${f.literal(e.value)}]`;case"enum":return{string:"str",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"union":return`Union[${e.members.map(t=>y(t,n)).join(", ")}]`;case"null":return"None";case"omit":return O(e.base);case"object":case"intersection":case"unknown":return"Any"}}function G(e,n,t,s,r,a,c,i=!1){let m=D([...n.pathParams,...n.queryParams].map(S=>S.name),{style:"snake",reserved:N,taken:W}),l=n.pathParams.map((S,v)=>({param:S,python:m[v]})),o=n.queryParams.map((S,v)=>({param:S,python:m[n.pathParams.length+v]})),d=l.map(({param:S,python:v})=>`${v}: ${y(S.schema,a)}`),u=n.requestBody?[`body: ${y(n.requestBody.schema,a)}`]:[],$=[...o.map(({param:S,python:v})=>{let A=y(S.schema,a),E=A.startsWith("Optional[")?A:`Optional[${A}]`;return`${v}: ${E} = None`}),"headers: Optional[Dict[str, str]] = None","timeout: Optional[float] = None","retry: Optional[Dict[str, Any]] = None","idempotency_key: Any = None"],h=R(n),g=L(n),x=i?`Envelope[${h===void 0?"None":y(h,a)}]`:g!==void 0?`${r?"AsyncIterator":"Iterator"}[ServerSentEvent]`:s==="result"?"Result":h===void 0?"None":y(h,a),P=r&&g===void 0?"async def":"def",p=r?"await ":"",_=r?"send_async":"send",b=["self",...d,...u,"*",...$].join(", "),w=i?`${t}_with_headers`:t;e.block(`${P} ${w}(${b}) -> ${x}:`,()=>{e.doc(i?`Like ${t}(), returning an Envelope with the declared response headers.`:n.summary),e.line(`op = _OPERATIONS["${t}"]`),e.line('auth_headers, auth_query = resolve_auth(op.get("security") or [], self._auth)'),e.line("params: Dict[str, Any] = dict(auth_query)");for(let{param:E,python:C}of o)e.block(`if ${C} is not None:`,()=>{e.line(`params[${f.string(E.name)}] = encode(${C})`)});let S=l.map(({param:E,python:C})=>`${f.string(E.name)}: ${C}`).join(", ");if(e.line(`url = build_url(self._server_url, op["path"], {${S}})`),g!==void 0){let E=g.schema!==void 0&&g.schema.kind!=="unknown"?"json":"text";e.block("def _open(extra_headers: Dict[str, str]):",()=>{e.line('return self._http.stream(op["method"], url, headers={**auth_headers, **(headers or {}), **extra_headers}, params=params, timeout=timeout)')}),e.line(`return ${r?"aiter_sse":"iter_sse"}(_open, data_kind="${E}")`);return}Y(n)&&e.line("form_data, form_files = to_multipart(body)");let v=n.requestBody?Y(n)?", data=form_data, files=form_files":", json_body=encode(body)":"";e.line(`response = ${p}${_}(self._http, self._config, op, url, method=op["method"], headers={**auth_headers, **(headers or {})}, params=params${v}, timeout=timeout, retry=retry, idempotency_key=idempotency_key)`);let A=h===void 0?"None":`decode(${y(h,a)}, _safe_json(response))`;i?(e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line(`return Envelope(data=${A}, headers=read_envelope_headers(response, ${ce(n,c)}), response=response)`)):s==="result"?(e.block("if not response.is_success:",()=>{e.line("return Result(data=None, error=_safe_json(response), response=response)")}),e.line(`return Result(data=${A}, error=None, response=response)`)):(e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line(h===void 0?"return None":`return ${A}`))}),e.blank()}function le(e,n,t,s,r,a){let c=R(n),i=c===void 0?"Any":y(c,a),m=D([...n.pathParams,...n.queryParams].map(p=>p.name),{style:"snake",reserved:N,taken:W}),l=n.pathParams.map((p,_)=>({param:p,python:m[_]})),o=n.queryParams.map((p,_)=>({param:p,python:m[n.pathParams.length+_]})),d=l.map(({param:p,python:_})=>`${_}: ${y(p.schema,a)}`),u=[...o.map(({param:p,python:_})=>{let b=y(p.schema,a),w=b.startsWith("Optional[")?b:`Optional[${b}]`;return`${_}: ${w} = None`}),"headers: Optional[Dict[str, str]] = None","timeout: Optional[float] = None","retry: Optional[Dict[str, Any]] = None"],$=["self",...d,"*",...u].join(", "),h=s?"AsyncIterator":"Iterator",g=s?"aiter_pages":"iter_pages",x=s?"aiter_items":"iter_items",P=()=>{e.line("base: Dict[str, Any] = {}");for(let{param:b,python:w}of o)e.block(`if ${w} is not None:`,()=>{e.line(`base[${f.string(b.name)}] = encode(${w})`)});let p=s?"async def":"def",_=s?"await ":"";e.block(`${p} _page(page_params: Dict[str, Any]) -> Tuple[Any, Any]:`,()=>{e.line('auth_headers, auth_query = resolve_auth(op.get("security") or [], self._auth)');let b=l.map(({param:w,python:S})=>`${f.string(w.name)}: ${S}`).join(", ");e.line(`url = build_url(self._server_url, op["path"], {${b}})`),e.line(`response = ${_}${s?"send_async":"send"}(self._http, self._config, op, url, method=op["method"], headers={**auth_headers, **(headers or {})}, params={**page_params, **auth_query}, timeout=timeout, retry=retry)`),e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line("return _safe_json(response), response")})};s?(e.block(`async def ${t}_pages(${$}) -> ${h}[${i}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.block(`async for page in ${g}(_page, op["pagination"], base):`,()=>{e.line(i==="Any"?"yield page":`yield decode(${i}, page)`)})}),e.blank(),e.block(`async def ${t}_items(${$}) -> ${h}[${r}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.block(`async for item in ${x}(_page, op["pagination"], base):`,()=>{e.line(r==="Any"?"yield item":`yield decode(${r}, item)`)})})):(e.block(`def ${t}_pages(${$}) -> ${h}[${i}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.line(i==="Any"?`return ${g}(_page, op["pagination"], base)`:`return (decode(${i}, page) for page in ${g}(_page, op["pagination"], base))`)}),e.blank(),e.block(`def ${t}_items(${$}) -> ${h}[${r}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.line(r==="Any"?`return ${x}(_page, op["pagination"], base)`:`return (decode(${r}, item) for item in ${x}(_page, op["pagination"], base))`)})),e.blank()}function me(e){return oe(e).map(t=>t.kind==="literal"?f.string(t.value):q(t.name).python).join(" + ")}function de(e,n){let t=n.servers??[];if(t.length===0)return;let s=new Set;e.block("class Servers:",()=>{e.line('"""The declared servers; variables default to the values from the description."""'),e.blank(),t.forEach((r,a)=>{let c=k(r.description??`server${a+1}`,{style:"snake",reserved:N});s.has(c)&&(c=`${c}_${a+1}`),s.add(c);let i=r.variables.map(m=>`${q(m.name).python}: str = ${f.string(m.default)}`);a>0&&e.blank(),e.line("@staticmethod"),e.block(`def ${c}(${i.join(", ")}) -> str:`,()=>{e.line(`return ${me(r)}`)})})}),e.blank()}function V(e,n,t,s,r,a,c){let i=s?"AsyncClient":"Client",m=s?"httpx.AsyncClient":"httpx.Client";e.block(`class ${i}:`,()=>{e.doc(`${s?"Async ":""}client for ${n.title} (${n.version}).`),e.block(`def __init__(self, server_url: str = ${f.string(a)}, *, auth: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, timeout: Optional[float] = None, retry: Optional[Dict[str, Any]] = None, middleware: Optional[List[Any]] = None, idempotency_key: Any = None, http_client: Optional[${m}] = None) -> None:`,()=>{e.line("self._server_url = server_url"),e.line("self._auth = auth or {}"),e.line("self._config: Dict[str, Any] = {"),e.indent(()=>{e.line('"headers": headers or {},'),e.line('"timeout": timeout,'),e.line('"retry": retry or {},'),e.line('"middleware": middleware or [],'),e.line('"idempotency_key": idempotency_key,')}),e.line("}"),e.line(`self._http = http_client or ${m}()`)}),e.blank();for(let{op:l,ident:o}of I(n)){G(e,l,o,t,s,c),L(l)===void 0&&(l.successResponseHeaders?.length??0)>0&&G(e,l,o,t,s,c,n,!0);let d=r.get(o);if(d!==void 0){let u=R(l),$=re(u,typeof d.items=="string"?d.items:void 0,n);le(e,l,o,s,$===void 0?"Any":y($,c),c)}}}),e.blank()}function z(e){let n=new Map,t=new Set,s=[];for(let{name:a,schema:c}of e.schemas){let i=T(c,e);if(!(i===void 0||!i.cases.every(l=>B(l.schema,e)?.properties.some(o=>o.name===i.property)===!0))){for(let l of i.cases){let o=n.get(l.schemaName);if(o!==void 0&&o.value!==l.value){t.add(l.schemaName);continue}n.set(l.schemaName,{property:i.property,value:l.value})}s.push({name:a,property:i.property,members:i.cases.map(l=>l.schemaName)})}}let r=new Map;for(let a of s)a.members.some(c=>t.has(c))||r.set(a.name,q(a.property).python);for(let a of t)n.delete(a);return{pins:n,unions:r}}function fe(e,n,t,s,r,a,c){let i=r==="pydantic";i||e.line("@dataclass");let m=i?`class ${O(n)}(BaseModel):`:`class ${O(n)}:`;e.block(m,()=>{e.doc(a),i&&(e.line("model_config = ConfigDict(populate_by_name=True)"),e.blank());let l=[...t.filter(d=>d.required),...t.filter(d=>!d.required)],o=[];l.length===0&&e.line("pass");for(let d of l){let{python:u,renamed:$}=q(d.name);$&&!i&&o.push([u,d.name]);let h=$&&i?`alias=${f.string(d.name)}`:void 0,g=c?.property===d.name?`Literal[${f.literal(c.value)}]`:y(d.schema,s);if(d.required){let x=h===void 0?"":` = Field(${h})`;e.line(`${u}: ${g}${x}`)}else{let x=g.startsWith("Optional[")?g:`Optional[${g}]`,P=h===void 0?"None":`Field(default=None, ${h})`;e.line(`${u}: ${x} = ${P}`)}}if(o.length>0){e.blank(),e.line("# Python field name -> wire (JSON) name, for (de)serialization.");let d=o.map(([u,$])=>`"${u}": ${f.string($)}`).join(", ");e.line(`_field_map: ClassVar[Dict[str, str]] = {${d}}`)}}),e.blank(),e.blank()}function J(e,n="string",t="dataclass"){let s=new j,{pins:r,unions:a}=t==="pydantic"?z(e):{pins:new Map,unions:new Map};s.line("from __future__ import annotations"),s.blank(),t==="dataclass"&&s.line("from dataclasses import dataclass"),s.line("from enum import Enum");let c=["Any","AsyncIterator","Dict","Iterator","List","Literal","Optional","Tuple","Union"];t==="dataclass"&&c.splice(2,0,"ClassVar"),a.size>0&&c.unshift("Annotated"),s.line(`from typing import ${c.join(", ")}`),t==="pydantic"&&s.line("from pydantic import BaseModel, ConfigDict, Field"),n==="Date"&&s.line("from datetime import date, datetime"),s.blank(),s.blank();let i=[];for(let{name:m,schema:l}of e.schemas){let o=te(l);if(o!==void 0){let d=o.scalar==="string"?"str, Enum":"int, Enum";s.block(`class ${O(m)}(${d}):`,()=>{s.doc(l.description),o.values.forEach((u,$)=>{s.line(`${o.memberNames[$]} = ${f.literal(u)}`)})}),s.blank(),s.blank();continue}if(l.kind==="object"||l.kind==="intersection"){let d=B(l,e);if(d!==void 0){fe(s,m,d.properties,n,t,d.description??l.description,r.get(m));continue}}i.push(()=>{let d=T(l,e);if(d!==void 0){let h=d.cases.map(g=>`${g.value} -> ${O(g.schemaName)}`).join(", ");s.line(`# Discriminated by "${d.property}": ${h}`)}let u=a.get(m),$=u===void 0?y(l,n):`Annotated[${y(l,n)}, Field(discriminator=${f.string(u)})]`;s.line(`${O(m)} = ${$}`),s.blank()})}for(let m of i)m();return s.toString()}function pe(e,n){let t=[];for(let{name:s,schema:r}of e.schemas){if(n.has(s))continue;let a=T(r,e);if(a===void 0)continue;let c=a.cases.map(i=>`${f.string(i.value)}: ${O(i.schemaName)}`).join(", ");t.push(`DISCRIMINATORS[${O(s)}] = (${f.string(a.property)}, {${c}})`)}return t}var nn={type:"object",properties:{models:{enum:["dataclass","pydantic"],default:"dataclass",description:"Model style: standard-library dataclasses (default, httpx is the only dependency), or pydantic BaseModel classes (adds pydantic)."}},additionalProperties:!1};function Q(e){let n=e.lastIndexOf("/")>=0?"/":"\\",t=e.lastIndexOf(n),s=t>=0?e.slice(0,t+1):"",r=(t>=0?e.slice(t+1):e).replace(/\.[^.]+$/,"");return`${s}${k(r,{style:"snake",reserved:N})}.py`}var tn=({model:e,output:n,banner:t,emit:s,options:r,pagination:a})=>{let c=s.errorMode??"throw",i=s.dateType??"string",m=r?.models??"dataclass",l=m==="pydantic"?z(e):void 0,o=new j;if(o.line(`# Generated by @redocly/client-generator (python) from "${e.title}" ${e.version}.`),o.line("# Do not edit by hand \u2014 regenerate with `redocly generate-client`."),o.line(m==="pydantic"?"# Requires Python >= 3.9, httpx, and pydantic: pip install httpx pydantic":"# Requires Python >= 3.9 and httpx: pip install httpx"),o.blank(),o.line(J(e,i,m).trimEnd()),o.blank(),o.blank(),de(o,e),s.runtime==="module"){o.line("# \u2500\u2500\u2500 Runtime (real modules beside this file, written by the same run) \u2500\u2500\u2500");for(let p of Object.keys(U))o.line(`from ${p.replace(/\.py$/,"")} import *`);o.blank(),o.blank()}else{o.line("# \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator python runtime) \u2500\u2500\u2500");for(let p of Object.values(U)){let _=p.split(`
|
|
9
9
|
`).filter(b=>!b.startsWith("from __future__")&&!b.startsWith("from ._")).join(`
|
|
10
10
|
`).trim();o.line(_),o.blank()}o.blank()}let d=pe(e,new Set(l?.unions.keys()));if(d.length>0){o.line("# Discriminated unions dispatch by their property inside decode().");for(let p of d)o.line(p);o.blank()}o.block("def _safe_json(response: httpx.Response) -> Any:",()=>{o.block("try:",()=>{o.line("return response.json()")}),o.block("except Exception:",()=>{o.line("return None")})}),o.blank();let u=new Map;for(let{op:p,ident:_}of I(e))u.set(_,ie(a?.get(p.name)?.spec));o.line("_OPERATIONS = {"),o.indent(()=>{for(let{op:p,ident:_}of I(e)){let b={id:p.specName??p.name,method:p.method.toUpperCase(),path:p.path,...K(p,e).length>0?{security:K(p,e)}:{},...u.get(_)!==void 0?{pagination:u.get(_)}:{}};o.line(`"${_}": ${ae(b)},`)}}),o.line("}"),o.blank(),o.blank();let $=s.serverUrl??e.serverUrl??"";V(o,e,c,!1,u,$,i),V(o,e,c,!0,u,$,i);let h={path:Q(n.path),content:o.toString()};if(s.runtime!=="module")return[h];let g=t.map(p=>`# ${p}`).join(`
|
|
@@ -8,4 +8,4 @@ import{a as m,m as l}from"./UW4UC7ZI.js";function d(e,t){let n=t??{},i=e.specNam
|
|
|
8
8
|
`))e.line(c);e.line("```"),e.blank()}let s=[...t.pathParams,...t.queryParams,...t.headerParams];s.length>0&&h(e,s),t.requestBody!==void 0&&e.line(`Body: \`${t.requestBody.contentType}\`${t.requestBody.required?", required":", optional"}, of type ${o(t.requestBody.schema)}.`);let r=t.successResponses[0];e.line(r===void 0?"Returns no content.":`Returns \`${r.contentType}\`, of type ${o(r.schema)}.`),(n.paginated!==void 0?n.paginated.has(t.name):d(t,n.pagination)!==void 0)&&e.line("This operation is paginated, so the SDK gives it page and item iterators."),t.successResponses.some(c=>c.contentType==="text/event-stream")&&e.line("This operation streams server-sent events, so the SDK iterates the events."),g(t)&&e.line("This operation returns binary content."),e.blank()}function k(e,t){let n=new m;if(t.frontmatter&&(n.line("---"),n.line(`title: ${t.title}`),n.line("---"),n.blank()),n.line(`# ${t.title}`),n.blank(),n.line(`Generated reference for the ${t.language.label} SDK, produced from the API description by \`redocly generate-client\`.`),n.line("Re-run generation to update it \u2014 this file is not hand-edited."),n.blank(),n.line(t.language.requires),n.blank(),n.line("## Authentication"),n.blank(),e.securitySchemes.length===0)n.line("The description declares no security schemes.");else{n.line("The description declares these schemes, which you pass to the client:"),n.blank(),n.line("| Scheme | Kind | Sent as |"),n.line("| ------ | ---- | ------- |");for(let r of e.securitySchemes){let a=r.kind==="bearer"?"`Authorization: Bearer <token>`":r.kind==="basic"?"`Authorization: Basic <base64>`":r.kind==="apiKeyHeader"?`the \`${r.headerName}\` header`:r.kind==="apiKeyQuery"?`the \`${r.paramName}\` query parameter`:`the \`${r.cookieName}\` cookie`;n.line(`| \`${r.key}\` | ${r.kind} | ${a} |`)}}n.blank();let i=e.services.flatMap(r=>r.operations),s=[...new Set(i.map(r=>r.tags[0]))];for(let r of s){n.line(r===void 0?"## Operations":`## ${r}`),n.blank();for(let a of i.filter(c=>c.tags[0]===r))x(n,a,t)}return n.toString().replace(/\n{3,}/g,`
|
|
9
9
|
|
|
10
10
|
`).trimEnd()+`
|
|
11
|
-
`}function b(e){return e.successResponses.find(t=>t.contentType.toLowerCase().includes("json"))?.schema}function R(e){return e.successResponses.find(t=>t.contentType.toLowerCase().includes("text/event-stream"))}function S(e){return e.requestBody?.contentType.toLowerCase().includes("multipart")??!1}function $(e){let t=new Set(e.variables.map(a=>a.name)),n=[],i="",s=e.url,r=/\{([^{}]+)\}/;for(let a=r.exec(s);a!==null;a=r.exec(s))i+=s.slice(0,a.index),t.has(a[1])?(i!==""&&n.push({kind:"literal",value:i}),i="",n.push({kind:"variable",name:a[1]})):i+=a[0],s=s.slice(a.index+a[0].length);return i+=s,(i!==""||n.length===0)&&n.push({kind:"literal",value:i}),n}function P(e,t){return e.security.map(n=>n.flatMap(i=>{let s=t.securitySchemes.find(r=>r.key===i);return s===void 0?[]:s.kind==="bearer"||s.kind==="basic"?[{scheme:i,kind:s.kind}]:s.kind==="apiKeyHeader"?[{scheme:i,kind:"apiKey",name:s.headerName,in:"header"}]:s.kind==="apiKeyQuery"?[{scheme:i,kind:"apiKey",name:s.paramName,in:"query"}]:[{scheme:i,kind:"apiKey",name:s.cookieName,in:"cookie"}]})).filter(n=>n.length>0)}function C(e,t,n){if(e===void 0||t===void 0)return;let i=l(e,t,n);return i?.kind==="array"?i.items:void 0}var J=["Printer","casing","identifierFor","uniqueIdentifiers","RESERVED_WORDS","flattenAllOf","deref","discriminatorCases","jsonSuccessSchema","sseResponse","isMultipartBody","serverUrlParts","securityRequirements","paginationItemSchema","isNullable","unwrapNullable","enumValues","docText","headerCoerceType","schemaAtPointer","paginationRuleFor","renderReferencePage","NotSupportedError"];function v(e){return e}function N(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-")}function q(e){return e.replace(/[^A-Za-z0-9]+/g,"_").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()}function A(e,t){let n={...e};for(let[i,s]of Object.entries(t))s!==void 0&&(n[i]=s);return n}function fe(e){return e}async function ge(e){return(await import("./
|
|
11
|
+
`}function b(e){return e.successResponses.find(t=>t.contentType.toLowerCase().includes("json"))?.schema}function R(e){return e.successResponses.find(t=>t.contentType.toLowerCase().includes("text/event-stream"))}function S(e){return e.requestBody?.contentType.toLowerCase().includes("multipart")??!1}function $(e){let t=new Set(e.variables.map(a=>a.name)),n=[],i="",s=e.url,r=/\{([^{}]+)\}/;for(let a=r.exec(s);a!==null;a=r.exec(s))i+=s.slice(0,a.index),t.has(a[1])?(i!==""&&n.push({kind:"literal",value:i}),i="",n.push({kind:"variable",name:a[1]})):i+=a[0],s=s.slice(a.index+a[0].length);return i+=s,(i!==""||n.length===0)&&n.push({kind:"literal",value:i}),n}function P(e,t){return e.security.map(n=>n.flatMap(i=>{let s=t.securitySchemes.find(r=>r.key===i);return s===void 0?[]:s.kind==="bearer"||s.kind==="basic"?[{scheme:i,kind:s.kind}]:s.kind==="apiKeyHeader"?[{scheme:i,kind:"apiKey",name:s.headerName,in:"header"}]:s.kind==="apiKeyQuery"?[{scheme:i,kind:"apiKey",name:s.paramName,in:"query"}]:[{scheme:i,kind:"apiKey",name:s.cookieName,in:"cookie"}]})).filter(n=>n.length>0)}function C(e,t,n){if(e===void 0||t===void 0)return;let i=l(e,t,n);return i?.kind==="array"?i.items:void 0}var J=["Printer","casing","identifierFor","uniqueIdentifiers","RESERVED_WORDS","flattenAllOf","deref","discriminatorCases","jsonSuccessSchema","sseResponse","isMultipartBody","serverUrlParts","securityRequirements","paginationItemSchema","isNullable","unwrapNullable","enumValues","docText","headerCoerceType","schemaAtPointer","paginationRuleFor","renderReferencePage","NotSupportedError"];function v(e){return e}function N(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-")}function q(e){return e.replace(/[^A-Za-z0-9]+/g,"_").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()}function A(e,t){let n={...e};for(let[i,s]of Object.entries(t))s!==void 0&&(n[i]=s);return n}function fe(e){return e}async function ge(e){return(await import("./PXNLRJQW.js")).generateClient(e)}export{d as a,k as b,b as c,R as d,S as e,$ as f,P as g,C as h,J as i,v as j,N as k,q as l,A as m,fe as n,ge as o};
|
|
@@ -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,4 +4,4 @@ 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}from"./
|
|
7
|
+
import{a}from"./RADLRSOT.js";import"./4OMUPCFF.js";import"./ZNEWPSG3.js";import"./WZXA5XPB.js";import"./VQBN45JM.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as mockGenerator};
|
|
@@ -4,4 +4,4 @@ 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,b as h,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as B,l as C,m as D,n as F,o as G}from"./
|
|
7
|
+
import{a as g,b as h,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as B,l as C,m as D,n as F,o as G}from"./4OMUPCFF.js";import{a as z,e as A,g as E}from"./ZNEWPSG3.js";import{a}from"./WZXA5XPB.js";import"./VQBN45JM.js";import"./NEWT5A6S.js";import{a as b,b as c,c as d,d as e,e as f,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q}from"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{x as AUTHORING_HELPER_NAMES,E as GENERATOR_VERSION,a as NotSupportedError,b as Printer,d as RESERVED_WORDS,A as WIRING_NAMES,z as allOperations,c as casing,C as constantCase,y as defineClientSetup,F as defineGenerator,i as deref,k as discriminatorCases,o as docText,n as enumValues,j as flattenAllOf,G as generateClient,B as groupSlug,q as headerCoerceType,e as identifierFor,t as isMultipartBody,l as isNullable,r as jsonSuccessSchema,D as mergeConfig,w as paginationItemSchema,g as paginationRuleFor,h as renderReferencePage,p as resolveSchemaPointer,p as schemaAtPointer,v as securityRequirements,u as serverUrlParts,s as sseResponse,f as uniqueIdentifiers,m as unwrapNullable};
|
|
@@ -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=["get","put","post","delete","options","head","patch","trace","query"],s=["schemas","responses","parameters","examples","headers","requestBodies","links","callbacks","securitySchemes"];export{e as a,s as b};
|
|
@@ -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 oe,e as ae,f as ue,g as ce,h as b,i as de,k as H,l as V,m as pe,n as le,v as he,w as me}from"./
|
|
7
|
+
import{a as oe,e as ae,f as ue,g as ce,h as b,i as de,k as H,l as V,m as pe,n as le,v as he,w as me}from"./TYA7TBSX.js";import{$ as se,H as X,K as Je,L as Z,M as g,N as O,O as ee,P as $,Q as C,S,U as y,W as w,X as te,Y as ne,Z as re,ba as ie,c as l,p as Y,u as Q,x as We}from"./VQBN45JM.js";import{e as J}from"./RFWIIJFG.js";import fe from"node:path";function R(t){return t?t.trim():""}function T(t){let e=R(t.operationId)||R(t.path);return[R(t.ruleId),R(t.severity),R(t.message),e,R(t.target),R(t.schemaPath)].join("")}var F=t=>Z(S(t));function Ye(t){return t==="error"?"error":t==="warning"?"warning":"note"}function Qe(t){if(t==null)return"";let e=String(t);return!e.includes(",")&&!e.includes('"')&&!e.includes(`
|
|
8
8
|
`)?e:`"${e.replace(/"/g,'""')}"`}function Xe(t){return fe.isAbsolute(t)?fe.relative(process.cwd(),t)||".":t}function Ze(t){if(!t)return null;let e=t.operationPathTemplate;return typeof e=="string"&&e.length>0?e:null}function et(t){return Object.entries(t).sort((e,r)=>{let n=r[1]-e[1];return n!==0?n:e[0].localeCompare(r[0])})}function tt(t){let e=[],r=new Map;for(let n of t){let s=T({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 nt(t){let e=tt(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
9
|
`}function rt(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(Qe).join(",")).join(`
|
|
10
10
|
`)}
|
|
@@ -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{b as B}from"./2U6O26CV.js";import{b as X,c as E,d as T,e as W,f as ne,g as te,h as re}from"./2NNPXF2N.js";import{a as Y,c as C,d as p,e as w,f as x,g as D,h as O,i as Z,j,k as I,l as F,n as ee}from"./UW4UC7ZI.js";var U=C.php,q=class extends Y{constructor(){super(" ")}typeName(n){return p(n,{style:"pascal",reserved:U})}memberName(n){return p(n,{style:"camel",reserved:U})}identifier(n){return p(n,{style:"camel",reserved:U})}identifiers(n,s){return w(n,{style:"camel",reserved:U,taken:s})}string(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}literal(n){return n==null?"null":typeof n=="boolean"||typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(i=>this.literal(i)).join(", ")}]`:`[${Object.entries(n).map(([i,r])=>`${this.string(i)} => ${this.literal(r)}`).join(", ")}]`}comment(n){for(let s of F(n))this.line(s===""?"//":`// ${s}`);return this}doc(n,s,i=[]){let r=F(s);if(r.length===0&&i.length===0)return this;let t=r.length===0?n:`${n} \u2014 ${r.join(" ")}`;if(i.length===0)return this.line(`/** ${t} */`);this.line("/**"),this.line(` * ${t}`),this.line(" *");for(let a of i)this.line(` * ${a}`);return this.line(" */")}};var h=C.php,G=new q;function y(e){return G.typeName(e)}function b(e){return G.memberName(e)}function c(e){return G.string(e)}function ie(e){return p(e.name,{style:"camel",reserved:h})}function K(e){let n=e.services.flatMap(i=>i.operations),s=w(n.map(i=>i.name),{style:"camel",reserved:h});return new Map(n.map((i,r)=>[i.name,s[r]]))}function de(e){return ne(e).map(s=>s.kind==="literal"?c(s.value):`$${b(s.name)}`).join(" . ")}function se(e,n){let s=n.servers??[];if(s.length===0)return;let i=new Set;e.line("/** The declared servers; variables default to the values from the description. */"),e.line("final class Servers"),e.block("{",()=>{s.forEach((r,t)=>{let a=p(r.description??`server${t+1}`,{style:"camel",reserved:h});i.has(a)&&(a=`${a}${t+1}`),i.add(a);let o=r.variables.map(l=>`string $${b(l.name)} = ${c(l.default)}`);t>0&&e.blank(),e.line(`public static function ${a}(${o.join(", ")}): string`),e.block("{",()=>{e.line(`return ${de(r)};`)},"}")})},"}"),e.blank()}function ae(e,n){let s=te(e,n).map(i=>`[${i.map(t=>t.kind==="apiKey"?`['kind' => 'apiKey', 'scheme' => ${c(t.scheme)}, 'name' => ${c(t.name)}, 'in' => ${c(t.in)}]`:`['kind' => ${c(t.kind)}, 'scheme' => ${c(t.scheme)}]`).join(", ")}]`);if(s.length!==0)return`[${s.join(", ")}]`}function oe(e){return`[${[`'style' => ${c(e.style)}`,...e.param!==void 0?[`'param' => ${c(e.param)}`]:[],...e.nextCursor!==void 0?[`'nextCursor' => ${c(e.nextCursor)}`]:[],...e.hasMore!==void 0?[`'hasMore' => ${c(e.hasMore)}`]:[],...e.limitParam!==void 0?[`'limitParam' => ${c(e.limitParam)}`]:[],...e.items!==void 0?[`'items' => ${c(e.items)}`]:[]].join(", ")}]`}function ce(e,n){let s=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let t=p(r.name,{style:"camel",reserved:h}),a=2;for(;s.has(t);)t=`${p(r.name,{style:"camel",reserved:h})}_${a++}`;s.add(t);let o=ee(r.schema,n);return`[${c(r.name)}, ${c(t)}, ${c(o)}]`}).join(", ")}]`}function _(e,n){let s=n.schemas.find(t=>t.name===e);if(s===void 0)return"other";let i=s.schema,r=I(i);return r!==void 0&&(r.scalar==="string"||r.scalar==="integer")?"enum":(i.kind==="object"||i.kind==="intersection")&&D(i,n)!==void 0?"class":"other"}function m(e,n,s="string"){if(Z(e)){let i=m(j(e),n,s);return A(i)}switch(e.kind){case"scalar":return s==="Date"&&e.scalar==="string"&&L(e)?"\\DateTimeImmutable":{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":case"record":return"array";case"ref":{let i=_(e.name,n);if(i==="class"||i==="enum")return y(e.name);let r=x(e,n);return r===void 0?"mixed":m(r,n,s)}case"enum":return{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"literal":return typeof e.value=="string"?"string":typeof e.value=="boolean"?"bool":"float";case"omit":return y(e.base);case"union":return me(e.members,n,s);case"null":case"object":case"intersection":case"unknown":return"mixed"}}function L(e){let n=e.metadata?.format;return n==="date"||n==="date-time"}function A(e){return e==="mixed"||e.startsWith("?")||e.endsWith("|null")?e:e.includes("|")?`${e}|null`:`?${e}`}function me(e,n,s){let i=[];for(let r of e){if(r.kind==="null")continue;let t=m(r,n,s);if(t==="mixed")return"mixed";let a=t.startsWith("?")?t.slice(1):t;i.includes(a)||i.push(a),t.startsWith("?")&&!i.includes("null")&&i.push("null")}return i.length===0?"mixed":i.join("|")}function J(e,n,s){if(e===void 0)return;let i=j(e);if(i.kind==="ref"){let t=x(i,n);return _(i.name,n)==="other"?J(t,n,s):void 0}if(i.kind!=="array")return;let r=m(i.items,n,s);return r==="mixed"?void 0:r}function le(e,n){let s=n.schemas.find(i=>i.name===e);return s!==void 0&&O(s.schema,n)!==void 0}function v(e,n,s,i){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"&&L(r))return`new \\DateTimeImmutable(${n})`;if(r.kind==="omit")return v({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${y(r.name)}::fromArray(${n})`;if(t==="enum")return`${y(r.name)}::from(${n})`;if(le(r.name,s))return`unmarshal${y(r.name)}(${n})`;let a=x(r,s);return a===void 0?void 0:v(a,n,s,i)}if(r.kind==="array"){let t=v(r.items,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}if(r.kind==="record"){let t=v(r.value,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}}function N(e,n,s,i="string"){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"){if(r.metadata?.format==="date")return`${n}->format('Y-m-d')`;if(r.metadata?.format==="date-time")return`${n}->format(\\DateTimeInterface::ATOM)`}if(r.kind==="omit")return N({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${n}->toArray()`;if(t==="enum")return`${n}->value`;if(le(r.name,s))return`is_object(${n}) ? ${n}->toArray() : ${n}`;let a=x(r,s);return a===void 0?void 0:N(a,n,s,i)}if(r.kind==="array"||r.kind==="record"){let t=r.kind==="array"?r.items:r.value,a=N(t,"$item",s,i);return a===void 0?void 0:`array_map(static fn ($item) => ${a}, ${n})`}}function pe(e,n,s,i,r,t){let a=[...s.filter(o=>o.required),...s.filter(o=>!o.required)];e.doc(y(n),t),e.line(`final class ${y(n)}`),e.block("{",()=>{e.block("public function __construct(",()=>{for(let o of a){let l=m(o.schema,i,r);if(o.required)e.line(`public ${l} $${b(o.name)},`);else{let u=A(l);e.line(`public ${u} $${b(o.name)} = null,`)}}},") {"),e.line("}"),e.blank(),e.line("public static function fromArray(array $data): self"),e.block("{",()=>{e.block("return new self(",()=>{for(let o of a){let l=`$data[${c(o.name)}]`,u=v(o.schema,l,i,r),f=b(o.name);o.required?e.line(`${f}: ${u??l},`):u===void 0?e.line(`${f}: ${l} ?? null,`):e.line(`${f}: isset(${l}) ? ${u} : null,`)}},");")},"}"),e.blank(),e.line("public function toArray(): array"),e.block("{",()=>{e.line("$data = [];");for(let o of a){let l=`$this->${b(o.name)}`,u=N(o.schema,l,i,r)??l;o.required?e.line(`$data[${c(o.name)}] = ${u};`):e.block(`if (${l} !== null) {`,()=>{e.line(`$data[${c(o.name)}] = ${u};`)},"}")}e.line("return $data;")},"}")},"}"),e.blank()}function V(e,n="string"){let s=new q;for(let{name:i,schema:r}of e.schemas){let t=I(r);if(t!==void 0&&(t.scalar==="string"||t.scalar==="integer")){let o=t.scalar==="string"?"string":"int";s.doc(y(i),r.description),s.line(`enum ${y(i)}: ${o}`),s.block("{",()=>{let l=w(t.values.map(u=>String(u)),{style:"pascal",reserved:h});t.values.forEach((u,f)=>{let g=typeof u=="string"?c(u):String(u);s.line(`case ${l[f]} = ${g};`)})},"}"),s.blank();continue}if(r.kind==="object"||r.kind==="intersection"){let o=D(r,e);if(o!==void 0){pe(s,i,o.properties,e,n,o.description??r.description);continue}}let a=O(r,e);if(a!==void 0){let o=y(i),l=a.cases.map(u=>`${u.value} -> ${y(u.schemaName)}`).join(", ");s.line(`/** ${o} is a discriminated union (${c(a.property)}): ${l}. */`),s.line(`function unmarshal${o}(array $data): mixed`),s.block("{",()=>{s.block(`return match ($data[${c(a.property)}] ?? null) {`,()=>{for(let u of a.cases)s.line(`${c(u.value)} => ${y(u.schemaName)}::fromArray($data),`);s.line("default => $data,")},"};")},"}"),s.blank();continue}}return s.toString()}var ue=new Set(["post","put","patch"]),he=["body","headers","idempotencyKey"];function z(e,n,s,i){let r=w([...e.pathParams,...e.queryParams].map(l=>l.name),{style:"camel",reserved:h,taken:he}),t=e.pathParams.map((l,u)=>({php:r[u],wire:l.name,type:m(l.schema,n,i)})),a=e.queryParams.map((l,u)=>{let f=r[e.pathParams.length+u];return{php:f,wire:l.name,type:m(l.schema,n,i),value:N(l.schema,`$${f}`,n,i)??`$${f}`}}),o=[...t.map(({php:l,type:u})=>`${u} $${l}`),...s&&e.requestBody?[`${W(e)?"array":m(e.requestBody.schema,n,i)} $body`]:[],...a.map(({php:l,type:u})=>`${A(u)} $${l} = null`),"?array $headers = null",...s&&ue.has(e.method.toLowerCase())?["?string $idempotencyKey = null"]:[]];return{pathArgs:t,queryArgs:a,signature:o}}function ye(e,n,s){e.line(`$op = OPERATIONS[${c(n.specName??n.name)}];`),e.line("[$authHeaders, $query, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);");for(let{php:r,wire:t,value:a}of s.queryArgs)e.block(`if ($${r} !== null) {`,()=>{e.line(`$query[${c(t)}] = ${a};`)},"}");let i=s.pathArgs.map(({php:r,wire:t})=>`${c(t)} => $${r}`).join(", ");e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${i}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}")}function Q(e,n,s,i,r,t=!1){let a=z(n,i,!0,r),o=T(n),l=E(n),u=o===void 0&&l===void 0&&n.successResponses.some(k=>k.contentType!==""),f=t?"Envelope":o!==void 0?"\\Generator":l!==void 0?m(l,i,r):u?"string":"void",g=t?`${s}WithHeaders`:s,H=t?void 0:J(l,i,r);e.doc(g,t?`Like ${s}(), returning an Envelope with the declared response headers.`:n.summary??`${n.method.toUpperCase()} ${n.path}`,H===void 0?[]:[`@return ${H}[]`]),e.line(`public function ${g}(${a.signature.join(", ")}): ${f}`),e.block("{",()=>{if(ye(e,n,a),o!==void 0){let d=o.schema!==void 0&&o.schema.kind!=="unknown";e.line("$url = appendQuery($url, $query);"),e.block("$open = function (array $extraHeaders) use ($url, $requestHeaders): \\CurlHandle {",()=>{e.line("$handle = curl_init($url);"),e.line("$lines = [];"),e.block("foreach (array_merge($requestHeaders, $extraHeaders) as $name => $value) {",()=>{e.line("$lines[] = $name . ': ' . $value;")},"}"),e.line("curl_setopt($handle, CURLOPT_HTTPHEADER, $lines);"),e.line("return $handle;")},"};"),e.line(`yield from iterSse($open, ${d?"true":"false"});`);return}let k=["'operationId' => $op['id']","'method' => $op['method']","'url' => $url","'headers' => $requestHeaders","'query' => $query"];if(n.requestBody&&W(n))e.line("[$contentType, $encoded] = toMultipart($body);"),k.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody){let d=N(n.requestBody.schema,"$body",i,r)??"$body";e.line(`$payload = json_encode(${d});`),k.push("'body' => $payload",`'contentType' => ${c(n.requestBody.contentType)}`)}ue.has(n.method.toLowerCase())&&n.requestBody&&k.push("'idempotencyKey' => $idempotencyKey"),e.line(`$response = send($this->config, [${k.join(", ")}]);`),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}");let $=u?"$response['body']":(l===void 0?void 0:v(l,"decodeJson($response)",i,r))??"decodeJson($response)";if(t){e.line(`$data = ${$};`),e.line(`return new Envelope(data: $data, headers: readEnvelopeHeaders($response, ${ce(n,i)}), status: $response['status']);`);return}if(u){e.line("return $response['body'];");return}if(f==="void"){e.line("decodeJson($response);");return}e.line(`return ${$};`)},"}"),e.blank()}function $e(e,n,s,i,r,t,a,o,l){let u=z(n,i,!1,r),f=s,g=()=>{e.line(`$op = OPERATIONS[${c(n.specName??n.name)}];`),e.line("$base = [];");for(let{php:d,wire:P,value:S}of u.queryArgs)e.block(`if ($${d} !== null) {`,()=>{e.line(`$base[${c(P)}] = ${S};`)},"}");let $=u.pathArgs.map(({php:d,wire:P})=>`${c(P)} => $${d}`).join(", ");e.block("$call = function (array $params) use ($op, $headers): array {",()=>{e.line("[$authHeaders, $authQuery, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);"),e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${$}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}"),e.line("$response = send($this->config, ['operationId' => $op['id'], 'method' => $op['method'], 'url' => $url, 'headers' => $requestHeaders, 'query' => array_merge($params, $authQuery)]);"),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}"),e.line("return [decodeJson($response), $response];")},"};")},H=m(E(n)??{kind:"unknown"},i,r),k=H==="mixed"?"mixed":H;e.line("/**"),e.line(` * ${f} response pages, following the pagination rule automatically.`),e.line(" *"),e.line(` * @return \\Generator<int, ${k}>`),e.line(" */"),e.line(`public function ${f}Pages(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{g(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`yield ${t??"$page"};`)},"}")},"}"),e.blank(),e.line("/**"),e.line(` * The items of every ${f} page.`),e.line(" *"),e.line(` * @return \\Generator<int, ${l}>`),e.line(" */"),e.line(`public function ${f}Items(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{g(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`$items = resolvePointer($page, ${c(o??"")});`),e.block("foreach (is_array($items) ? $items : [] as $item) {",()=>{e.line(`yield ${a??"$item"};`)},"}")},"}")},"}"),e.blank()}function ge(e){let n=e.split(`
|
|
7
|
+
import{b as B}from"./2U6O26CV.js";import{b as X,c as E,d as T,e as W,f as ne,g as te,h as re}from"./4OMUPCFF.js";import{a as Y,c as C,d as p,e as w,f as x,g as D,h as O,i as Z,j,k as I,l as F,n as ee}from"./UW4UC7ZI.js";var U=C.php,q=class extends Y{constructor(){super(" ")}typeName(n){return p(n,{style:"pascal",reserved:U})}memberName(n){return p(n,{style:"camel",reserved:U})}identifier(n){return p(n,{style:"camel",reserved:U})}identifiers(n,s){return w(n,{style:"camel",reserved:U,taken:s})}string(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}literal(n){return n==null?"null":typeof n=="boolean"||typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(i=>this.literal(i)).join(", ")}]`:`[${Object.entries(n).map(([i,r])=>`${this.string(i)} => ${this.literal(r)}`).join(", ")}]`}comment(n){for(let s of F(n))this.line(s===""?"//":`// ${s}`);return this}doc(n,s,i=[]){let r=F(s);if(r.length===0&&i.length===0)return this;let t=r.length===0?n:`${n} \u2014 ${r.join(" ")}`;if(i.length===0)return this.line(`/** ${t} */`);this.line("/**"),this.line(` * ${t}`),this.line(" *");for(let a of i)this.line(` * ${a}`);return this.line(" */")}};var h=C.php,G=new q;function y(e){return G.typeName(e)}function b(e){return G.memberName(e)}function c(e){return G.string(e)}function ie(e){return p(e.name,{style:"camel",reserved:h})}function K(e){let n=e.services.flatMap(i=>i.operations),s=w(n.map(i=>i.name),{style:"camel",reserved:h});return new Map(n.map((i,r)=>[i.name,s[r]]))}function de(e){return ne(e).map(s=>s.kind==="literal"?c(s.value):`$${b(s.name)}`).join(" . ")}function se(e,n){let s=n.servers??[];if(s.length===0)return;let i=new Set;e.line("/** The declared servers; variables default to the values from the description. */"),e.line("final class Servers"),e.block("{",()=>{s.forEach((r,t)=>{let a=p(r.description??`server${t+1}`,{style:"camel",reserved:h});i.has(a)&&(a=`${a}${t+1}`),i.add(a);let o=r.variables.map(l=>`string $${b(l.name)} = ${c(l.default)}`);t>0&&e.blank(),e.line(`public static function ${a}(${o.join(", ")}): string`),e.block("{",()=>{e.line(`return ${de(r)};`)},"}")})},"}"),e.blank()}function ae(e,n){let s=te(e,n).map(i=>`[${i.map(t=>t.kind==="apiKey"?`['kind' => 'apiKey', 'scheme' => ${c(t.scheme)}, 'name' => ${c(t.name)}, 'in' => ${c(t.in)}]`:`['kind' => ${c(t.kind)}, 'scheme' => ${c(t.scheme)}]`).join(", ")}]`);if(s.length!==0)return`[${s.join(", ")}]`}function oe(e){return`[${[`'style' => ${c(e.style)}`,...e.param!==void 0?[`'param' => ${c(e.param)}`]:[],...e.nextCursor!==void 0?[`'nextCursor' => ${c(e.nextCursor)}`]:[],...e.hasMore!==void 0?[`'hasMore' => ${c(e.hasMore)}`]:[],...e.limitParam!==void 0?[`'limitParam' => ${c(e.limitParam)}`]:[],...e.items!==void 0?[`'items' => ${c(e.items)}`]:[]].join(", ")}]`}function ce(e,n){let s=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let t=p(r.name,{style:"camel",reserved:h}),a=2;for(;s.has(t);)t=`${p(r.name,{style:"camel",reserved:h})}_${a++}`;s.add(t);let o=ee(r.schema,n);return`[${c(r.name)}, ${c(t)}, ${c(o)}]`}).join(", ")}]`}function _(e,n){let s=n.schemas.find(t=>t.name===e);if(s===void 0)return"other";let i=s.schema,r=I(i);return r!==void 0&&(r.scalar==="string"||r.scalar==="integer")?"enum":(i.kind==="object"||i.kind==="intersection")&&D(i,n)!==void 0?"class":"other"}function m(e,n,s="string"){if(Z(e)){let i=m(j(e),n,s);return A(i)}switch(e.kind){case"scalar":return s==="Date"&&e.scalar==="string"&&L(e)?"\\DateTimeImmutable":{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":case"record":return"array";case"ref":{let i=_(e.name,n);if(i==="class"||i==="enum")return y(e.name);let r=x(e,n);return r===void 0?"mixed":m(r,n,s)}case"enum":return{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"literal":return typeof e.value=="string"?"string":typeof e.value=="boolean"?"bool":"float";case"omit":return y(e.base);case"union":return me(e.members,n,s);case"null":case"object":case"intersection":case"unknown":return"mixed"}}function L(e){let n=e.metadata?.format;return n==="date"||n==="date-time"}function A(e){return e==="mixed"||e.startsWith("?")||e.endsWith("|null")?e:e.includes("|")?`${e}|null`:`?${e}`}function me(e,n,s){let i=[];for(let r of e){if(r.kind==="null")continue;let t=m(r,n,s);if(t==="mixed")return"mixed";let a=t.startsWith("?")?t.slice(1):t;i.includes(a)||i.push(a),t.startsWith("?")&&!i.includes("null")&&i.push("null")}return i.length===0?"mixed":i.join("|")}function J(e,n,s){if(e===void 0)return;let i=j(e);if(i.kind==="ref"){let t=x(i,n);return _(i.name,n)==="other"?J(t,n,s):void 0}if(i.kind!=="array")return;let r=m(i.items,n,s);return r==="mixed"?void 0:r}function le(e,n){let s=n.schemas.find(i=>i.name===e);return s!==void 0&&O(s.schema,n)!==void 0}function v(e,n,s,i){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"&&L(r))return`new \\DateTimeImmutable(${n})`;if(r.kind==="omit")return v({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${y(r.name)}::fromArray(${n})`;if(t==="enum")return`${y(r.name)}::from(${n})`;if(le(r.name,s))return`unmarshal${y(r.name)}(${n})`;let a=x(r,s);return a===void 0?void 0:v(a,n,s,i)}if(r.kind==="array"){let t=v(r.items,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}if(r.kind==="record"){let t=v(r.value,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}}function N(e,n,s,i="string"){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"){if(r.metadata?.format==="date")return`${n}->format('Y-m-d')`;if(r.metadata?.format==="date-time")return`${n}->format(\\DateTimeInterface::ATOM)`}if(r.kind==="omit")return N({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${n}->toArray()`;if(t==="enum")return`${n}->value`;if(le(r.name,s))return`is_object(${n}) ? ${n}->toArray() : ${n}`;let a=x(r,s);return a===void 0?void 0:N(a,n,s,i)}if(r.kind==="array"||r.kind==="record"){let t=r.kind==="array"?r.items:r.value,a=N(t,"$item",s,i);return a===void 0?void 0:`array_map(static fn ($item) => ${a}, ${n})`}}function pe(e,n,s,i,r,t){let a=[...s.filter(o=>o.required),...s.filter(o=>!o.required)];e.doc(y(n),t),e.line(`final class ${y(n)}`),e.block("{",()=>{e.block("public function __construct(",()=>{for(let o of a){let l=m(o.schema,i,r);if(o.required)e.line(`public ${l} $${b(o.name)},`);else{let u=A(l);e.line(`public ${u} $${b(o.name)} = null,`)}}},") {"),e.line("}"),e.blank(),e.line("public static function fromArray(array $data): self"),e.block("{",()=>{e.block("return new self(",()=>{for(let o of a){let l=`$data[${c(o.name)}]`,u=v(o.schema,l,i,r),f=b(o.name);o.required?e.line(`${f}: ${u??l},`):u===void 0?e.line(`${f}: ${l} ?? null,`):e.line(`${f}: isset(${l}) ? ${u} : null,`)}},");")},"}"),e.blank(),e.line("public function toArray(): array"),e.block("{",()=>{e.line("$data = [];");for(let o of a){let l=`$this->${b(o.name)}`,u=N(o.schema,l,i,r)??l;o.required?e.line(`$data[${c(o.name)}] = ${u};`):e.block(`if (${l} !== null) {`,()=>{e.line(`$data[${c(o.name)}] = ${u};`)},"}")}e.line("return $data;")},"}")},"}"),e.blank()}function V(e,n="string"){let s=new q;for(let{name:i,schema:r}of e.schemas){let t=I(r);if(t!==void 0&&(t.scalar==="string"||t.scalar==="integer")){let o=t.scalar==="string"?"string":"int";s.doc(y(i),r.description),s.line(`enum ${y(i)}: ${o}`),s.block("{",()=>{let l=w(t.values.map(u=>String(u)),{style:"pascal",reserved:h});t.values.forEach((u,f)=>{let g=typeof u=="string"?c(u):String(u);s.line(`case ${l[f]} = ${g};`)})},"}"),s.blank();continue}if(r.kind==="object"||r.kind==="intersection"){let o=D(r,e);if(o!==void 0){pe(s,i,o.properties,e,n,o.description??r.description);continue}}let a=O(r,e);if(a!==void 0){let o=y(i),l=a.cases.map(u=>`${u.value} -> ${y(u.schemaName)}`).join(", ");s.line(`/** ${o} is a discriminated union (${c(a.property)}): ${l}. */`),s.line(`function unmarshal${o}(array $data): mixed`),s.block("{",()=>{s.block(`return match ($data[${c(a.property)}] ?? null) {`,()=>{for(let u of a.cases)s.line(`${c(u.value)} => ${y(u.schemaName)}::fromArray($data),`);s.line("default => $data,")},"};")},"}"),s.blank();continue}}return s.toString()}var ue=new Set(["post","put","patch"]),he=["body","headers","idempotencyKey"];function z(e,n,s,i){let r=w([...e.pathParams,...e.queryParams].map(l=>l.name),{style:"camel",reserved:h,taken:he}),t=e.pathParams.map((l,u)=>({php:r[u],wire:l.name,type:m(l.schema,n,i)})),a=e.queryParams.map((l,u)=>{let f=r[e.pathParams.length+u];return{php:f,wire:l.name,type:m(l.schema,n,i),value:N(l.schema,`$${f}`,n,i)??`$${f}`}}),o=[...t.map(({php:l,type:u})=>`${u} $${l}`),...s&&e.requestBody?[`${W(e)?"array":m(e.requestBody.schema,n,i)} $body`]:[],...a.map(({php:l,type:u})=>`${A(u)} $${l} = null`),"?array $headers = null",...s&&ue.has(e.method.toLowerCase())?["?string $idempotencyKey = null"]:[]];return{pathArgs:t,queryArgs:a,signature:o}}function ye(e,n,s){e.line(`$op = OPERATIONS[${c(n.specName??n.name)}];`),e.line("[$authHeaders, $query, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);");for(let{php:r,wire:t,value:a}of s.queryArgs)e.block(`if ($${r} !== null) {`,()=>{e.line(`$query[${c(t)}] = ${a};`)},"}");let i=s.pathArgs.map(({php:r,wire:t})=>`${c(t)} => $${r}`).join(", ");e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${i}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}")}function Q(e,n,s,i,r,t=!1){let a=z(n,i,!0,r),o=T(n),l=E(n),u=o===void 0&&l===void 0&&n.successResponses.some(k=>k.contentType!==""),f=t?"Envelope":o!==void 0?"\\Generator":l!==void 0?m(l,i,r):u?"string":"void",g=t?`${s}WithHeaders`:s,H=t?void 0:J(l,i,r);e.doc(g,t?`Like ${s}(), returning an Envelope with the declared response headers.`:n.summary??`${n.method.toUpperCase()} ${n.path}`,H===void 0?[]:[`@return ${H}[]`]),e.line(`public function ${g}(${a.signature.join(", ")}): ${f}`),e.block("{",()=>{if(ye(e,n,a),o!==void 0){let d=o.schema!==void 0&&o.schema.kind!=="unknown";e.line("$url = appendQuery($url, $query);"),e.block("$open = function (array $extraHeaders) use ($url, $requestHeaders): \\CurlHandle {",()=>{e.line("$handle = curl_init($url);"),e.line("$lines = [];"),e.block("foreach (array_merge($requestHeaders, $extraHeaders) as $name => $value) {",()=>{e.line("$lines[] = $name . ': ' . $value;")},"}"),e.line("curl_setopt($handle, CURLOPT_HTTPHEADER, $lines);"),e.line("return $handle;")},"};"),e.line(`yield from iterSse($open, ${d?"true":"false"});`);return}let k=["'operationId' => $op['id']","'method' => $op['method']","'url' => $url","'headers' => $requestHeaders","'query' => $query"];if(n.requestBody&&W(n))e.line("[$contentType, $encoded] = toMultipart($body);"),k.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody){let d=N(n.requestBody.schema,"$body",i,r)??"$body";e.line(`$payload = json_encode(${d});`),k.push("'body' => $payload",`'contentType' => ${c(n.requestBody.contentType)}`)}ue.has(n.method.toLowerCase())&&n.requestBody&&k.push("'idempotencyKey' => $idempotencyKey"),e.line(`$response = send($this->config, [${k.join(", ")}]);`),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}");let $=u?"$response['body']":(l===void 0?void 0:v(l,"decodeJson($response)",i,r))??"decodeJson($response)";if(t){e.line(`$data = ${$};`),e.line(`return new Envelope(data: $data, headers: readEnvelopeHeaders($response, ${ce(n,i)}), status: $response['status']);`);return}if(u){e.line("return $response['body'];");return}if(f==="void"){e.line("decodeJson($response);");return}e.line(`return ${$};`)},"}"),e.blank()}function $e(e,n,s,i,r,t,a,o,l){let u=z(n,i,!1,r),f=s,g=()=>{e.line(`$op = OPERATIONS[${c(n.specName??n.name)}];`),e.line("$base = [];");for(let{php:d,wire:P,value:S}of u.queryArgs)e.block(`if ($${d} !== null) {`,()=>{e.line(`$base[${c(P)}] = ${S};`)},"}");let $=u.pathArgs.map(({php:d,wire:P})=>`${c(P)} => $${d}`).join(", ");e.block("$call = function (array $params) use ($op, $headers): array {",()=>{e.line("[$authHeaders, $authQuery, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);"),e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${$}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}"),e.line("$response = send($this->config, ['operationId' => $op['id'], 'method' => $op['method'], 'url' => $url, 'headers' => $requestHeaders, 'query' => array_merge($params, $authQuery)]);"),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}"),e.line("return [decodeJson($response), $response];")},"};")},H=m(E(n)??{kind:"unknown"},i,r),k=H==="mixed"?"mixed":H;e.line("/**"),e.line(` * ${f} response pages, following the pagination rule automatically.`),e.line(" *"),e.line(` * @return \\Generator<int, ${k}>`),e.line(" */"),e.line(`public function ${f}Pages(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{g(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`yield ${t??"$page"};`)},"}")},"}"),e.blank(),e.line("/**"),e.line(` * The items of every ${f} page.`),e.line(" *"),e.line(` * @return \\Generator<int, ${l}>`),e.line(" */"),e.line(`public function ${f}Items(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{g(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`$items = resolvePointer($page, ${c(o??"")});`),e.block("foreach (is_array($items) ? $items : [] as $item) {",()=>{e.line(`yield ${a??"$item"};`)},"}")},"}")},"}"),e.blank()}function ge(e){let n=e.split(`
|
|
8
8
|
`),s=0;for(let i=0;i<n.length;i++)if(n[i].trim().startsWith("namespace ")){s=i+1;break}return n.slice(s).join(`
|
|
9
9
|
`).trim()}var ln=({model:e,output:n,banner:s,emit:i,pagination:r})=>{let t=new q,a=i.dateType??"string",o=p(e.title,{style:"pascal",reserved:h});t.line("<?php"),t.blank(),t.line(`// Code generated by @redocly/client-generator (php) from ${c(e.title)} ${e.version}. DO NOT EDIT.`),t.line("// Regenerate with `redocly generate-client`. PHP >= 8.1, curl extension \u2014 zero Composer dependencies."),t.blank(),t.line("declare(strict_types=1);"),t.blank(),t.line(`namespace ${o};`),t.blank(),t.line(V(e,a)),se(t,e),i.runtime==="module"?(t.line("// \u2500\u2500\u2500 Runtime (a real file beside this one, written by the same run) \u2500\u2500\u2500"),t.line("require_once __DIR__ . '/runtime.php';"),t.blank()):(t.line("// \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator php runtime) \u2500\u2500\u2500"),t.line(ge(B)),t.blank());let l=e.services.flatMap($=>$.operations),u=K(e),f=new Map;for(let $ of l){let d=r?.get($.name)?.spec;d!==void 0&&f.set($.name,d)}t.block("const OPERATIONS = [",()=>{for(let $ of l){let d=$.specName??$.name,P=ae($,e),S=f.get($.name),M=[`'id' => ${c(d)}`,`'method' => ${c($.method.toUpperCase())}`,`'path' => ${c($.path)}`,...P!==void 0?[`'security' => ${P}`]:[],...S!==void 0?[`'pagination' => ${oe(S)}`]:[]];t.line(`${c(d)} => [${M.join(", ")}],`)}},"];"),t.blank(),t.doc("Client",`Client for ${e.title} (${e.version}).`),t.line("class Client"),t.block("{",()=>{t.line("public function __construct(private Config $config)"),t.block("{",()=>{t.block("if ($this->config->serverUrl === '') {",()=>{t.line(`$this->config->serverUrl = ${c(i.serverUrl??e.serverUrl??"")};`)},"}")},"}"),t.blank();for(let $ of l){let d=u.get($.name);Q(t,$,d,e,a),T($)===void 0&&($.successResponseHeaders?.length??0)>0&&Q(t,$,d,e,a,!0);let P=f.get($.name);if(P===void 0)continue;let S=E($),M=S===void 0?void 0:v(S,"$page",e,a),R=re(S,P.items,e),fe=R===void 0?void 0:v(R,"$item",e,a);$e(t,$,d,e,a,M,fe,P.items,R===void 0?"mixed":m(R,e,a))}},"}");let g={path:n.path.replace(/\.[^.\\/]+$/,".php"),content:t.toString()};if(i.runtime!=="module")return[g];let H=s.map($=>`// ${$}`).join(`
|
|
10
10
|
`),k=B.replace(/^namespace .*$/m,`namespace ${o};`).replace(/^<\?php\n/,`<?php
|
|
@@ -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{a as D,c as k}from"./OFAMJNQ6.js";import{b as I}from"./OHJAW5OG.js";import{c as A,d as b}from"./VISOV75D.js";import{a as O}from"./44D2SQBU.js";import{X as T,c as m,s as N}from"./VQBN45JM.js";import{execSync as B,spawn as H}from"node:child_process";import*as d from"node:fs";import{existsSync as K,writeFileSync as q,readFileSync as Q}from"node:fs";import*as P from"node:os";import{tmpdir as V}from"node:os";import{join as J}from"node:path";import{text as Z}from"node:stream/consumers";var y="***";async function Se({config:e,argv:t,...n}){try{let{residency:r}=t,o={...n,argv:t,raw_argv:process.argv.slice(2),reunite_url:I(e,r),has_config:typeof e?.document?.parsed>"u"?"no":"yes"};if(process.pid===1){await R(o);return}let i=H(process.execPath,[process.argv[1],b],{detached:!0,stdio:["pipe","ignore","ignore"],windowsHide:!0});i.on("error",()=>{}),i.stdin.on("error",()=>{}),i.stdin.end(JSON.stringify(o)),i.unref()}catch{}}async function he(){try{let e=JSON.parse(await Z(process.stdin));await R(e)}catch{}}async function R({argv:e,raw_argv:t,reunite_url:n,has_config:r,exit_code:o,execution_time:i,spec_version:s,spec_keyword:c,spec_full_version:u,respect_x_security_auth_types:C,respect_source_description_types:v,respect_criterion_object_types:w,lint_rules_with_errors:z,lint_rules_with_warnings:x,lint_rules_with_ignored_problems:j,generate_client:a,eject_generator:f}){try{let{_:[g],$0:se,...M}=e,{RedoclyOAuthClient:Y}=await import("./GFD2G3U3.js"),G=await new Y().isAuthorized(n),p=ie();p||(p=`ann_${k()}`,oe(p));let _=T(s),U=[{id:g,object:"command",uri:`urn:redocly:cli:command:${g}`,logged_in:G?"yes":"no",command:g,...ne(M,t),node_version:process.version,npm_version:re(),version:O,exit_code:o,execution_time:i,metadata:process.env.REDOCLY_CLI_TELEMETRY_METADATA,environment_ci:process.env.CI,environment:process.env.REDOCLY_ENVIRONMENT,has_config:r,spec_version:s,spec_keyword:c,spec_full_version:u,respect_x_security_auth_types:_==="arazzo1"&&C?.length?JSON.stringify(C):void 0,respect_source_description_types:_==="arazzo1"&&v?.length?JSON.stringify(v):void 0,respect_criterion_object_types:_==="arazzo1"&&w?.length?JSON.stringify(w):void 0,lint_rules_with_errors:z?.length?JSON.stringify(z):void 0,lint_rules_with_warnings:x?.length?JSON.stringify(x):void 0,lint_rules_with_ignored_problems:j?.length?JSON.stringify(j):void 0,generate_client_builtin_generators:a?.generate_client_builtin_generators?.length?JSON.stringify(a.generate_client_builtin_generators):void 0,generate_client_custom_generators_count:a?.generate_client_custom_generators_count,generate_client_toolkit_imports:a?.generate_client_toolkit_imports?.length?JSON.stringify(a.generate_client_toolkit_imports):void 0,generate_client_error_category:a?.generate_client_error_category,generate_client_ejected_generators:a?.generate_client_ejected_generators?.length?JSON.stringify(a.generate_client_ejected_generators):void 0,generate_client_composed_apis_count:a?.generate_client_composed_apis_count,eject_generator_action:f?.eject_generator_action,eject_generator_name:f?.eject_generator_name,eject_generator_outcome:f?.eject_generator_outcome,eject_generator_conflicts:f?.eject_generator_conflicts,eject_generator_from_version:f?.eject_generator_from_version,eject_generator_to_version:f?.eject_generator_to_version}],$=D.mapToCloudEvent({type:"com.redocly.command.ran",source:"urn:redocly:cli",origin:"redocly-cli",env:"development",osPlatform:P.platform(),actor:{id:p,object:"user",uri:""},category:"product",data:U}),{otelTelemetry:W}=await import("./DJJGZI4P.js");W.send($)}catch{}}function Ee(e,t){for(let n of e.sourceDescriptions??[])n.type&&t.add(n.type)}function Ce(e,t){for(let n of e.workflows??[]){l(n.successActions,t),l(n.failureActions,t);for(let r of n.steps??[])F(r.successCriteria,t),l(r.onSuccess,t),l(r.onFailure,t)}l(Object.values(e.components?.successActions??{}),t),l(Object.values(e.components?.failureActions??{}),t)}function l(e,t){for(let n of e??[])F(n.criteria,t)}function F(e,t){for(let n of e??[]){let r=X(n);r&&t.add(r)}}function X(e){let t=e.type;return typeof t=="string"?t:t?.type||(e.condition?"simple":void 0)}function ve(e,t){for(let n of e.workflows??[]){for(let r of n["x-security"]??[]){let o=r.scheme;if(o?.type){let i=o.type==="http"?o.scheme:o.type;i&&t.add(i)}}for(let r of n.steps??[])for(let o of r["x-security"]??[]){let i=o.scheme;if(i?.type){let c=i.type==="http"?i.scheme:i.type;c&&t.add(c)}let s=o.schemeName;s&&t.add(s)}}}function ee(e){return d.existsSync(e)&&d.statSync(e).isFile()}function te(e){return d.existsSync(e)&&d.statSync(e).isDirectory()}function S(e){return e&&(N(e)?e.split("://")[0]+"://url":ee(e)?e.replace(/.+\.([^.]+)$/,(t,n)=>"file-"+n):te(e)?"folder":e)}function h(e,t,n){let r=Array.isArray(t)?t:[t];for(let o of r)o.length>1&&(e=e.replaceAll(o,n));return e}function L(e,t){let n={};for(let[r,o]of Object.entries(e))t.includes(r)?n[r]=y:m(o)?n[r]=L(o,t):n[r]=o;return n}function E(e,t,n=[]){if(Array.isArray(e))return e.forEach(r=>E(r,t,n)),n;if(m(e))for(let[r,o]of Object.entries(e))t.includes(r)&&typeof o=="string"?n.push(o):(m(o)||Array.isArray(o))&&E(o,t,n);return n}function ne(e,t){let n=["organization","o","input","i","author","a","clientCert","clientKey","caCert","server","S"],r=t.join(" "),o={};for(let[i,s]of Object.entries(e))if(n.includes(i))o[i]=y,r=h(r,s,y);else if(typeof s=="string"){let c=S(s);o[i]=c,r=h(r,s,c)}else if(Array.isArray(s)){o[i]=s.map(S);for(let c of s){let u=S(c);r.includes(c)&&(r=r.replaceAll(c,u))}}else if(m(s)){let c=E(s,n);for(let u of c)r=h(r,u,y);o[i]=L(s,n)}else o[i]=s;return{arguments:JSON.stringify(o),raw_input:r}}function re(){try{return B("npm -v",{stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return"unknown"}}var oe=e=>{if(!(process.env.CI||!e))try{let n=J(V(),A);q(n,e)}catch{}},ie=()=>{if(!process.env.CI)try{let t=J(V(),A);return K(t)?Q(t).toString().trim():void 0}catch{return}};export{Se as a,he as b,R as c,Ee as d,Ce as e,ve as f,ne as g,oe as h,ie as i};
|
|
@@ -0,0 +1,13 @@
|
|
|
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 P,b as y,c as $}from"./IDCP2TSL.js";import{W as h,ja as x}from"./VQBN45JM.js";function N(t){let e=t.trim(),n=e.match(/^```(?:ya?ml|json)?\s*\n([\s\S]*?)\n```$/);return n?n[1]:e}async function O(t,e){let r=(await x({source:t,config:e})).filter(o=>o.severity==="error");if(r.length>0){let o=r.slice(0,5).map(s=>`${s.ruleId}: ${s.message}`).join("; ");throw new Error(`the result has ${r.length} validation problem(s): ${o}`)}}import{spawn as T}from"node:child_process";import{mkdtemp as v}from"node:fs/promises";import{tmpdir as R}from"node:os";import S from"node:path";var I=3e5,a=class extends Error{},C;function L(){return C??=v(S.join(R(),"redocly-ai-")),C}async function w(t,e,n,r){let o=await L();return new Promise((s,u)=>{let i=T(t,e,{stdio:["pipe","pipe","pipe"],cwd:o,env:{...process.env,...r}}),l="",f="",g=!1,d=setTimeout(()=>{g=!0,i.kill("SIGKILL")},I);i.stdout.on("data",c=>{l+=c.toString()}),i.stderr.on("data",c=>{f+=c.toString()}),i.on("error",c=>{if(clearTimeout(d),c.code==="ENOENT"){u(new a(`Could not find the "${t}" CLI on PATH. Is it installed?`));return}u(c)}),i.on("close",c=>{if(clearTimeout(d),g){u(new Error(`The "${t}" CLI did not respond within ${I/1e3} seconds.`));return}s({stdout:l,stderr:f,code:c})}),i.stdin.on("error",()=>{}),i.stdin.end(n)})}async function A(t){let e=["-p","--output-format","text","--tools","","--strict-mcp-config","--setting-sources","","--no-session-persistence","--append-system-prompt",t.system];t.model&&e.push("--model",t.model);let{stdout:n,stderr:r,code:o}=await w("claude",e,t.user,{CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:"1"});if(o!==0)throw new Error(`claude CLI exited with code ${o}: ${r.trim()||n.trim()}`);if(!n.trim())throw new Error("claude CLI returned no output.");return{text:n}}async function b(t){let e=["exec","--skip-git-repo-check","--sandbox","read-only","-c","mcp_servers={}","-c","project_doc_max_bytes=0"];t.model&&e.push("--model",t.model),e.push("-");let n=`${t.system}
|
|
8
|
+
|
|
9
|
+
${t.user}`,{stdout:r,stderr:o,code:s}=await w("codex",e,n);if(s!==0)throw new Error(`codex CLI exited with code ${s}: ${o.trim()||r.trim()}`);if(!r.trim())throw new Error("codex CLI returned no output.");return{text:r}}async function _(t){let e=["-p","--output-format","text","--trust"];t.model&&e.push("--model",t.model);let n=`${t.system}
|
|
10
|
+
|
|
11
|
+
${t.user}`,r;try{r=await w("cursor-agent",e,n)}catch(i){if(!(i instanceof a))throw i;try{r=await w("agent",e,n)}catch(l){throw l instanceof a?new a('Could not find the Cursor CLI ("cursor-agent" or "agent") on PATH. Is it installed?'):l}}let{stdout:o,stderr:s,code:u}=r;if(u!==0)throw new Error(`cursor CLI exited with code ${u}: ${s.trim()||o.trim()}`);if(!o.trim())throw new Error("cursor CLI returned no output.");return{text:o}}async function U(t,e){switch(t){case"claude":return A(e);case"codex":return b(e);case"cursor":return _(e);default:throw new Error(`Unknown AI provider: ${t}`)}}async function K(t){let{items:e}=t,n=new Array(e.length).fill(null),r=new P,o=new Set,s=0,u=0,i=!1,l=()=>$(r,{action:t.action,inFlight:o,position:s+1,total:e.length}),f=async()=>{for(;!i&&u<e.length;){let d=u++,c=e[d],m=t.label(c),E=Date.now();o.add(m),l();try{n[d]=await t.run(c,d),s+=1,o.delete(m),y(r),h.info(`[${s}/${e.length}] ${m} \u2014 ${t.successNote} (${Math.round((Date.now()-E)/1e3)}s)
|
|
12
|
+
`)}catch(p){if(s+=1,o.delete(m),y(r),p instanceof a)throw i=!0,p;h.warn(`[${s}/${e.length}] ${m} \u2014 ${t.failureNote}: ${p instanceof Error?p.message:String(p)}
|
|
13
|
+
`)}l()}},g=Math.max(1,Math.min(t.concurrency,e.length));for(let d of await Promise.allSettled(Array.from({length:g},f)))if(d.status==="rejected")throw d.reason;return n}export{N as a,O as b,U as c,K as d};
|
|
@@ -4,6 +4,6 @@ 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}from"./
|
|
7
|
+
import{a}from"./S2CQROXW.js";import{W as p}from"./VQBN45JM.js";function g(t,r){let n=t.services.flatMap(e=>e.operations),s=n.filter(e=>e.sse!==void 0);s.length>0&&p.warn(`generate-client: ${r} skipped ${s.length} server-sent-events operation(s) \u2014 iterate the sdk's exported async generators directly: ${s.map(e=>e.name).join(", ")}.
|
|
8
8
|
`);let i=new Set(t.schemas.map(e=>e.name)),o=n.filter(e=>e.sse===void 0&&m(e,i));return o.length>0&&p.warn(`generate-client: ${r} skipped ${o.length} operation(s) whose variables type name collides with a schema \u2014 rename the schema or the operation: ${o.map(e=>e.name).join(", ")}.
|
|
9
9
|
`),n.filter(e=>e.sse===void 0&&!m(e,i))}function m(t,r){let n=a(t);return n.hasInputs&&r.has(n.variablesTypeName)}function x(t){return t.method==="get"||t.method==="head"}function u(t){return a(t).hasInputs}function f(t){return a(t).variablesTypeName}function $(t,r,n){let s=[];return a(t).hasInputs?s.push(r):n&&s.push("{}"),n&&s.push("{ ...init, envelope: undefined }"),`${t.name}(${s.join(", ")})`}function v(t,r,n){let s=t.map(e=>e.name).sort(),i=t.filter(u).map(f).sort();return n&&i.push("RequestOptions"),`import { ${[...s,...i.map(e=>`type ${e}`)].join(", ")} } from ${JSON.stringify(r)};`}export{g as a,x as b,u as c,f as d,$ as e,v as f};
|