@redocly/cli 2.47.0 → 2.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/lib/chunks/{QRD3XQNU.js → 2U54VUOE.js} +1 -1
  2. package/lib/chunks/3JJEI7CJ.js +456 -0
  3. package/lib/chunks/4I2OVMBJ.js +11 -0
  4. package/lib/chunks/{REBHK2JR.js → 4JDAOKRJ.js} +1 -1
  5. package/lib/chunks/5JIGUBC3.js +7 -0
  6. package/lib/chunks/{QVV2EKMT.js → 5SAFIITS.js} +1 -1
  7. package/lib/chunks/6KCIFTIG.js +57 -0
  8. package/lib/chunks/{5NR4DJW4.js → 6VSHPQXO.js} +1 -1
  9. package/lib/chunks/{W2NJCZOS.js → 74WJ7S7J.js} +1 -1
  10. package/lib/chunks/{QL4V2A4A.js → 7R5PBTLG.js} +1 -1
  11. package/lib/chunks/BT3ELZVX.js +42 -0
  12. package/lib/chunks/C5TR4MMN.js +19 -0
  13. package/lib/chunks/CCR5RYCX.js +20 -0
  14. package/lib/chunks/DCN3GSUA.js +7 -0
  15. package/lib/chunks/{TEQA5OM7.js → E5I67ZCZ.js} +1 -1
  16. package/lib/chunks/FUMCRNTK.js +78 -0
  17. package/lib/chunks/GNMJA2V2.js +16 -0
  18. package/lib/chunks/GRJG3TOI.js +14 -0
  19. package/lib/chunks/HA22GUKQ.js +7 -0
  20. package/lib/chunks/HJ36YGCI.js +184 -0
  21. package/lib/chunks/HJYFWIVE.js +9 -0
  22. package/lib/chunks/HL5FOKC4.js +16 -0
  23. package/lib/chunks/{SL6AH3N2.js → JBNPGEIJ.js} +1 -1
  24. package/lib/chunks/KHEMMNFU.js +26 -0
  25. package/lib/chunks/{SN2EC2ZR.js → KK2STV73.js} +1 -1
  26. package/lib/chunks/KK77ANZH.js +7 -0
  27. package/lib/chunks/L3TZNNJJ.js +13 -0
  28. package/lib/chunks/M6KLAAY4.js +7 -0
  29. package/lib/chunks/MHITBEGC.js +90 -0
  30. package/lib/chunks/NB54XRRU.js +10 -0
  31. package/lib/chunks/NSIQWNYL.js +7 -0
  32. package/lib/chunks/{YQW463Z7.js → NTPLYWAB.js} +1 -1
  33. package/lib/chunks/{5PXRDPHV.js → NUNOXB7Z.js} +1 -1
  34. package/lib/chunks/NWMTC4AN.js +7 -0
  35. package/lib/chunks/NYLAOZPO.js +22 -0
  36. package/lib/chunks/O4R6BSAS.js +20 -0
  37. package/lib/chunks/OKITK6EF.js +30 -0
  38. package/lib/chunks/OUCZOBEX.js +22 -0
  39. package/lib/chunks/PFYPTG4G.js +7 -0
  40. package/lib/chunks/QZH7EL26.js +7 -0
  41. package/lib/chunks/R4XFBOJU.js +9 -0
  42. package/lib/chunks/REFX2EKS.js +13 -0
  43. package/lib/chunks/{S4MX7JPH.js → RXOEH2LN.js} +1 -1
  44. package/lib/chunks/SGBB4RNM.js +11 -0
  45. package/lib/chunks/SQVG3CEM.js +8 -0
  46. package/lib/chunks/{RIFZSMUA.js → T5EPIBMA.js} +1 -1
  47. package/lib/chunks/TLQZAJQU.js +18 -0
  48. package/lib/chunks/TSB6PODJ.js +13 -0
  49. package/lib/chunks/TSRK76GA.js +19 -0
  50. package/lib/chunks/{34J2ZJDK.js → U2H2LXZE.js} +1 -1
  51. package/lib/chunks/UKSQ7B5H.js +2268 -0
  52. package/lib/chunks/UMQN5HTL.js +42 -0
  53. package/lib/chunks/V2LJ4UGM.js +7 -0
  54. package/lib/chunks/VBPP2WUF.js +7 -0
  55. package/lib/chunks/WPGKH5NI.js +177 -0
  56. package/lib/chunks/WXVC3KOI.js +67 -0
  57. package/lib/chunks/{KEUH3PST.js → YI34NB7D.js} +1 -1
  58. package/lib/chunks/YOJGIGE3.js +7 -0
  59. package/lib/chunks/{TO2KJ36N.js → YP5GHFYE.js} +1 -1
  60. package/lib/chunks/YXXYE4G2.js +7 -0
  61. package/lib/chunks/ZBL4IVEW.js +11 -0
  62. package/lib/chunks/ZMCRMR2V.js +5400 -0
  63. package/lib/chunks/ZOUQBK53.js +14 -0
  64. package/lib/chunks/ZXKOHMC6.js +177 -0
  65. package/lib/eject-assets/AGENTS.md +137 -0
  66. package/lib/eject-assets/generators/cli/docs.ts +224 -0
  67. package/lib/eject-assets/generators/cli/engine-source.ts +21 -0
  68. package/lib/eject-assets/generators/cli/index.ts +90 -0
  69. package/lib/eject-assets/generators/cli/render.ts +348 -0
  70. package/lib/eject-assets/generators/go/client.ts +57 -0
  71. package/lib/eject-assets/generators/go/descriptor.ts +41 -0
  72. package/lib/eject-assets/generators/go/index.ts +336 -0
  73. package/lib/eject-assets/generators/go/models.ts +179 -0
  74. package/lib/eject-assets/generators/go/naming.ts +49 -0
  75. package/lib/eject-assets/generators/go/operations.ts +296 -0
  76. package/lib/eject-assets/generators/go/pagination.ts +194 -0
  77. package/lib/eject-assets/generators/go/types.ts +60 -0
  78. package/lib/eject-assets/generators/mock/faker.ts +214 -0
  79. package/lib/eject-assets/generators/mock/index.ts +35 -0
  80. package/lib/eject-assets/generators/mock/render.ts +282 -0
  81. package/lib/eject-assets/generators/mock/sample.ts +316 -0
  82. package/lib/eject-assets/generators/mock/values.ts +63 -0
  83. package/lib/eject-assets/generators/php/client.ts +63 -0
  84. package/lib/eject-assets/generators/php/descriptor.ts +58 -0
  85. package/lib/eject-assets/generators/php/index.ts +237 -0
  86. package/lib/eject-assets/generators/php/models.ts +275 -0
  87. package/lib/eject-assets/generators/php/naming.ts +51 -0
  88. package/lib/eject-assets/generators/php/operations.ts +232 -0
  89. package/lib/eject-assets/generators/php/pagination.ts +133 -0
  90. package/lib/eject-assets/generators/php/types.ts +148 -0
  91. package/lib/eject-assets/generators/python/client.ts +123 -0
  92. package/lib/eject-assets/generators/python/descriptor.ts +52 -0
  93. package/lib/eject-assets/generators/python/index.ts +251 -0
  94. package/lib/eject-assets/generators/python/models.ts +242 -0
  95. package/lib/eject-assets/generators/python/naming.ts +46 -0
  96. package/lib/eject-assets/generators/python/operations.ts +147 -0
  97. package/lib/eject-assets/generators/python/pagination.ts +128 -0
  98. package/lib/eject-assets/generators/python/types.ts +54 -0
  99. package/lib/eject-assets/generators/swr/index.ts +37 -0
  100. package/lib/eject-assets/generators/swr/render.ts +78 -0
  101. package/lib/eject-assets/generators/tanstack-query/index.ts +48 -0
  102. package/lib/eject-assets/generators/tanstack-query/render.ts +346 -0
  103. package/lib/eject-assets/generators/transformers/index.ts +46 -0
  104. package/lib/eject-assets/generators/transformers/render.ts +506 -0
  105. package/lib/eject-assets/generators/typescript/banner.ts +35 -0
  106. package/lib/eject-assets/generators/typescript/client.ts +254 -0
  107. package/lib/eject-assets/generators/typescript/descriptor.ts +137 -0
  108. package/lib/eject-assets/generators/typescript/index.ts +101 -0
  109. package/lib/eject-assets/generators/typescript/inline-runtime.ts +135 -0
  110. package/lib/eject-assets/generators/typescript/operation-signature.ts +62 -0
  111. package/lib/eject-assets/generators/typescript/operation-types.ts +17 -0
  112. package/lib/eject-assets/generators/typescript/operations.ts +524 -0
  113. package/lib/eject-assets/generators/typescript/response-headers.ts +74 -0
  114. package/lib/eject-assets/generators/typescript/type-guards.ts +159 -0
  115. package/lib/eject-assets/generators/typescript/types.ts +172 -0
  116. package/lib/eject-assets/generators/zod/index.ts +32 -0
  117. package/lib/eject-assets/generators/zod/schemas.ts +456 -0
  118. package/lib/eject-assets/skills/cli-generator/SKILL.md +121 -0
  119. package/lib/eject-assets/skills/client-generators/SKILL.md +142 -0
  120. package/lib/eject-assets/skills/go-generator/SKILL.md +96 -0
  121. package/lib/eject-assets/skills/mock-generator/SKILL.md +50 -0
  122. package/lib/eject-assets/skills/php-generator/SKILL.md +112 -0
  123. package/lib/eject-assets/skills/python-generator/SKILL.md +110 -0
  124. package/lib/eject-assets/skills/swr-generator/SKILL.md +50 -0
  125. package/lib/eject-assets/skills/tanstack-query-generator/SKILL.md +55 -0
  126. package/lib/eject-assets/skills/transformers-generator/SKILL.md +47 -0
  127. package/lib/eject-assets/skills/typescript-generator/SKILL.md +95 -0
  128. package/lib/eject-assets/skills/zod-generator/SKILL.md +54 -0
  129. package/lib/index.js +271 -193
  130. package/package.json +1 -1
  131. package/lib/chunks/B6HS7CVY.js +0 -184
  132. package/lib/chunks/PIJLRHNN.js +0 -8
  133. package/lib/chunks/Y5HLCNL5.js +0 -2542
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: transformers-generator
3
+ description: Design of the ejected Redocly `transformers` client generator. Read it, and update it, before changing generators/transformers/.
4
+ ---
5
+
6
+ # The `transformers` generator — its skill
7
+
8
+ This file is the DESIGN of your ejected `transformers` generator (`generators/transformers/`):
9
+ **to change the generator, edit this skill first, then make the code match it** — a diff
10
+ to `generators/transformers/` that has no covering sentence here is incomplete.
11
+
12
+ ## What it emits
13
+
14
+ Per-schema `to<Name>()` / `from<Name>()` converters that turn wire JSON into typed
15
+ values and back — the bridge for `dateType: Date` clients.
16
+
17
+ ## Design decisions that must hold
18
+
19
+ - **Requires `dateType: Date`** (declared as `dateTypes: ['Date']`, so a mismatched
20
+ selection fails fast): the converters assign `Date` objects to fields the sdk types as
21
+ `Date`, which only type-checks in that mode.
22
+ - **Imports the sdk's schema TYPES** (so `typescript` is required) and nothing else.
23
+ - Converters are pure and total: every named schema gets a pair, nested structures
24
+ recurse, and a missing optional stays missing.
25
+
26
+ ## The stage files
27
+
28
+ `render.ts` holds the whole converter renderer; `index.ts` is the entry. Naming comes
29
+ from the TypeScript printer (`@redocly/client-generator/printers/typescript`).
30
+
31
+ ## Ejecting it
32
+
33
+ `redocly eject-generator transformers` copies this generator's TypeScript source folder
34
+ to `generators/transformers/`, exactly as we wrote it, importing
35
+ `@redocly/client-generator` and `@redocly/client-generator/printers/typescript`. Running
36
+ a `.ts` generator uses Node's type stripping (Node 22.18, 23.6, or newer); newer built-in
37
+ versions merge in per file with `--update`. Change which fields are converted, or how,
38
+ and regenerate.
39
+
40
+ ## The modify loop
41
+
42
+ 1. Edit this skill: state the new behavior or decision.
43
+ 2. Make `generators/transformers/` match it.
44
+ 3. Run `redocly generate-client` and inspect the `git diff` of the generated output —
45
+ generated files are never hand-edited.
46
+
47
+ Newer built-in versions merge in with `redocly eject-generator transformers --update`.
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: typescript-generator
3
+ description: Design of the ejected Redocly `typescript` client generator. Read it, and update it, before changing generators/typescript/.
4
+ ---
5
+
6
+ # The `typescript` generator — its skill
7
+
8
+ This file is the DESIGN of your ejected `typescript` generator (`generators/typescript/`):
9
+ **to change the generator, edit this skill first, then make the code match it** — a diff
10
+ to `generators/typescript/` that has no covering sentence here is incomplete.
11
+
12
+ ## What it emits
13
+
14
+ The typed TypeScript client itself: model types with JSDoc, type guards, the `Ops`
15
+ type map, the `OPERATIONS` descriptor table, a `client` instance, one binding per
16
+ operation, and the runtime — embedded in the file (`runtime: inline`, the default) or
17
+ written as real modules in a `runtime/` folder beside it that the client imports
18
+ relatively (`runtime: module`).
19
+
20
+ ## Design decisions that must hold
21
+
22
+ - **Descriptor-driven:** generated code is DATA (`OPERATIONS` + `Ops`) plus wiring;
23
+ request behavior lives in the runtime, never in per-operation code.
24
+ `satisfies Record<string, OperationDescriptor>` is the version-skew guard.
25
+ - **`single` vs `split`:** split derives `<stem>.schemas.ts` (types, enums, guards) and
26
+ an entry that `export *`s it; the entry type-imports only the schema names it
27
+ references (`collectEntrySchemaRefs`).
28
+ - **Zero runtime dependencies.** `Date`, `Blob`, `fetch` — nothing else.
29
+ - **Names are collision-safe:** `packageIdents` seeds every reserved wiring name before
30
+ any operation is sanitized, so renames are deterministic (`configure` → `configure_2`).
31
+ A rename becomes part of the SDK's public API, so the warning must say WHICH cause it
32
+ is and what the publisher can do: a duplicate `operationId` in the description (fix the
33
+ description — the only real fix), a name that isn't a valid identifier, or a clash with
34
+ a name the generated module already declares. A vague "collides or is invalid" message
35
+ leaves the publisher unable to act.
36
+ - **One operation, one function, one input shape.** The module-level names are bindings
37
+ of the client's own methods (`export const { getOrder } = client;`), never wrappers, so
38
+ `getOrder` and `client.getOrder` cannot disagree about their arguments. `argsStyle`
39
+ shapes the method itself: `grouped` (the default) namespaces the inputs by transport
40
+ layer — `path`, `query`, `headers`, `cookies`, `body` — and `flat` merges them into one
41
+ object, which the runtime converts back using the descriptor's own parameter list. An
42
+ operation whose merged names would collide keeps the grouped shape.
43
+ - **Throw mode returns the body**; `{ envelope: true }` opts into
44
+ `{ data, headers, response }` with typed declared headers. Result mode returns
45
+ `{ data, error, response }` and ignores `envelope`.
46
+
47
+ ## The stage files
48
+
49
+ One file per stage of the emit, same skeleton as the other generators:
50
+ `types.ts` renders type text (`tsType`, JSDoc, the model type aliases);
51
+ `operations.ts` the per-operation surface (the `Ops` map, the `<Op>*` aliases, the
52
+ input shapes, `flatInputShape`);
53
+ `descriptor.ts` the `OPERATIONS` wire table and the collision-safe `packageIdents`;
54
+ `client.ts` the assembly (single/split entries, the runtime needs, the module-mode
55
+ runtime files);
56
+ `type-guards.ts`, `response-headers.ts`, `operation-types.ts`, `operation-signature.ts`
57
+ the narrower questions their names state;
58
+ `banner.ts` the generated-by header and title comment;
59
+ `inline-runtime.ts` the runtime assembly for both modes. The runtime's real sources ship
60
+ inside the package and reach the generator through
61
+ `@redocly/client-generator/runtime-sources` (in this repo they live in `runtime/` beside
62
+ these files). Naming and string escaping live in the TypeScript printer
63
+ (`@redocly/client-generator/printers/typescript`).
64
+
65
+ ## Ejecting it
66
+
67
+ `redocly eject-generator typescript` copies this generator's TypeScript source folder to
68
+ `generators/typescript/` — the stage files above, exactly as we wrote them. Imports stay
69
+ package specifiers: `@redocly/client-generator` (the toolkit and IR types),
70
+ `@redocly/client-generator/printers/typescript` (naming and text mechanics), and
71
+ `@redocly/client-generator/runtime-sources` (the runtime sources it embeds). Running a
72
+ `.ts` generator uses Node's own type stripping (Node 22.18, 23.6, or newer), and newer
73
+ built-in versions merge into your copy per file with
74
+ `redocly eject-generator typescript --update`.
75
+
76
+ It is the largest of them, so reach for the smaller paths first when they fit:
77
+ `client.setup` bakes publisher defaults into the generated client, and middleware or
78
+ `configure()` change behavior at run time rather than generation time.
79
+
80
+ - **It documents itself.** With `client.docs` (or `--docs`), the `docs` hook writes
81
+ `<stem>.typescript.md`: the security schemes, then one section per operation with its parameters,
82
+ body, response type, and behavior notes. The call snippets come from this generator's own
83
+ `sample` hook, so the page can only show the syntax of the SDK beside it, and the layout
84
+ comes from `renderReferencePage` in the authoring toolkit — reachable from an ejected copy
85
+ through `@redocly/client-generator`. Pagination on the page is decided by
86
+ `paginationRuleFor`, the same helper this generator resolves pagination with.
87
+
88
+ ## The modify loop
89
+
90
+ 1. Edit this skill: state the new behavior or decision.
91
+ 2. Make `generators/typescript/` match it.
92
+ 3. Run `redocly generate-client` and inspect the `git diff` of the generated output —
93
+ generated files are never hand-edited.
94
+
95
+ Newer built-in versions merge in with `redocly eject-generator typescript --update`.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: zod-generator
3
+ description: Design of the ejected Redocly `zod` client generator. Read it, and update it, before changing generators/zod/.
4
+ ---
5
+
6
+ # The `zod` generator — its skill
7
+
8
+ This file is the DESIGN of your ejected `zod` generator (`generators/zod/`):
9
+ **to change the generator, edit this skill first, then make the code match it** — a diff
10
+ to `generators/zod/` that has no covering sentence here is incomplete.
11
+
12
+ ## What it emits
13
+
14
+ A standalone `<stem>.zod.ts`: one `export const <Name>Schema` per named IR schema, the
15
+ `operationSchemas` request/response map, and a `zodValidation()` middleware.
16
+
17
+ ## Design decisions that must hold
18
+
19
+ - **The client stays dependency-free.** zod is the CONSUMER's peer dependency; the
20
+ generated client never imports this module, and this module never imports the client.
21
+ - **Output-mode-agnostic:** one module beside the client whatever the sdk's layout.
22
+ - **Emits nothing** when the model has neither named schemas nor JSON operation bodies —
23
+ an empty file is worse than no file.
24
+ - Validation is opt-in at runtime (`use(zodValidation())`), never automatic.
25
+ - **Only ERASABLE TypeScript.** The module must run under `node --experimental-strip-types`
26
+ with no build step, so nothing that needs a transform is emitted: no `enum`, no
27
+ `namespace`, and no constructor parameter properties. `ZodValidationError` therefore
28
+ declares its fields and assigns them in the constructor body — `constructor(readonly
29
+ operationId: string)` fails strip-only mode, which is how the generated CLI broke when it
30
+ imported this module.
31
+
32
+ ## The stage files
33
+
34
+ `schemas.ts` holds the whole renderer — schema expressions, the `operationSchemas` map,
35
+ and the module assembly; `index.ts` is the entry. Naming and literal escaping come from
36
+ the TypeScript printer (`@redocly/client-generator/printers/typescript`).
37
+
38
+ ## Ejecting it
39
+
40
+ `redocly eject-generator zod` copies this generator's TypeScript source folder to
41
+ `generators/zod/`, exactly as we wrote it, importing `@redocly/client-generator` and
42
+ `@redocly/client-generator/printers/typescript`. Running a `.ts` generator uses Node's
43
+ type stripping (Node 22.18, 23.6, or newer); newer built-in versions merge in per file
44
+ with `--update`. Change the schema shapes, the naming, or what gets a schema at all, and
45
+ regenerate.
46
+
47
+ ## The modify loop
48
+
49
+ 1. Edit this skill: state the new behavior or decision.
50
+ 2. Make `generators/zod/` match it.
51
+ 3. Run `redocly generate-client` and inspect the `git diff` of the generated output —
52
+ generated files are never hand-edited.
53
+
54
+ Newer built-in versions merge in with `redocly eject-generator zod --update`.