@redocly/cli 2.63.0 → 2.64.1

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 (128) hide show
  1. package/THIRD_PARTY_NOTICES +1 -1
  2. package/lib/chunks/{AAPHKNGA.js → 23FVFXSV.js} +1 -1
  3. package/lib/chunks/{C2OCU4E3.js → 2N5733QR.js} +1 -1
  4. package/lib/chunks/{LXSCIQFU.js → 2XSAJEYO.js} +1 -1
  5. package/lib/chunks/{J373CXCH.js → 33LAXFAC.js} +1 -1
  6. package/lib/chunks/{BS3AUVYD.js → 3BFBASRW.js} +1 -1
  7. package/lib/chunks/{FCZH3476.js → 3JJ7NFAQ.js} +1 -1
  8. package/lib/chunks/{QNCKZURN.js → 3TWUZE25.js} +1 -1
  9. package/lib/chunks/{2G2Q42ND.js → 47H5P7DF.js} +1 -1
  10. package/lib/chunks/{I3M476SQ.js → 4BWADBBP.js} +1 -1
  11. package/lib/chunks/{24AVTWC7.js → 4K73EOV3.js} +1 -1
  12. package/lib/chunks/{OYUXHAGQ.js → 4S35DNJF.js} +1 -1
  13. package/lib/chunks/{Y4UTXOI2.js → 4XKO52KS.js} +1 -1
  14. package/lib/chunks/{4JKMQCWY.js → 5BB2E772.js} +1 -1
  15. package/lib/chunks/{IODGA6FG.js → 5KWYBSEY.js} +1 -1
  16. package/lib/chunks/{JHK6XIMG.js → 6D6SERR2.js} +1 -1
  17. package/lib/chunks/{SXIFTBZB.js → 6TFC2OYQ.js} +1 -1
  18. package/lib/chunks/{YKST56C6.js → 7BZGNWGO.js} +1 -1
  19. package/lib/chunks/{7RQW6KPZ.js → AC25ILS5.js} +224 -115
  20. package/lib/chunks/{NERCHMVY.js → AQ5W4E54.js} +1 -1
  21. package/lib/chunks/{HW7ZCN7J.js → AVOA7IGA.js} +1 -1
  22. package/lib/chunks/{VSBSD3XZ.js → B6HQPQVF.js} +1 -1
  23. package/lib/chunks/{X2V5QOZP.js → BWA2MZEG.js} +1 -1
  24. package/lib/chunks/{L2EBKZQZ.js → C462YNOX.js} +1 -1
  25. package/lib/chunks/{6LEQ46KS.js → C6QQGZXT.js} +1 -1
  26. package/lib/chunks/{CQMZF72H.js → CBJ23L7Q.js} +1 -1
  27. package/lib/chunks/{BC3XCWQE.js → DZLV4HEX.js} +1 -1
  28. package/lib/chunks/{4C44BO5N.js → EIGOI65B.js} +1 -1
  29. package/lib/chunks/{Z52TEGV5.js → FGKVDZSD.js} +1 -1
  30. package/lib/chunks/{6QRNEF7K.js → FRHR2DRO.js} +1 -1
  31. package/lib/chunks/{NR3R4HFM.js → HAOBCQWB.js} +313 -1
  32. package/lib/chunks/{A22GELRX.js → HNEOPZAP.js} +1 -1
  33. package/lib/chunks/{OFJ2KV5N.js → HQSXMF3M.js} +1 -1
  34. package/lib/chunks/{AU7VOB4V.js → HYTOV6S5.js} +1 -1
  35. package/lib/chunks/{PHWKGYUT.js → IJJGUPFL.js} +1 -1
  36. package/lib/chunks/{5IIJHGNO.js → IPZEPCLP.js} +1 -1
  37. package/lib/chunks/{7AWM5GPD.js → J4MBQ4RQ.js} +1 -1
  38. package/lib/chunks/{Q4UGLPO2.js → JUZHXP62.js} +1 -1
  39. package/lib/chunks/{U52CY34I.js → KIY6ZQFM.js} +1 -1
  40. package/lib/chunks/{5VDBZVBF.js → KXCAMRHJ.js} +1 -1
  41. package/lib/chunks/{IYKYAJDC.js → LDFG6R4G.js} +1 -1
  42. package/lib/chunks/{ZK27F53P.js → N7JGYQGR.js} +1 -1
  43. package/lib/chunks/{Z7J6WWCO.js → OB24ZAXJ.js} +1 -1
  44. package/lib/chunks/{TCALQAX5.js → OD47UYXG.js} +1 -1
  45. package/lib/chunks/{ITUUIAOZ.js → PV7QRLRM.js} +1 -1
  46. package/lib/chunks/Q2CLTRW6.js +69 -0
  47. package/lib/chunks/{JGBWIR5U.js → QQ3NOFPI.js} +1 -1
  48. package/lib/chunks/{RFGNVCAR.js → QV24OXH3.js} +2 -2
  49. package/lib/chunks/{DQFNUDOT.js → S242M5IF.js} +1 -1
  50. package/lib/chunks/{VB4PNWOR.js → S4LDFBGV.js} +1 -1
  51. package/lib/chunks/{6AB3BDX4.js → SAQECLWB.js} +1 -1
  52. package/lib/chunks/{Z5QYTPVY.js → SCB6ZITR.js} +1 -1
  53. package/lib/chunks/{NCBLLIQ3.js → SDQYWQUI.js} +2 -2
  54. package/lib/chunks/{KMP5ZE2D.js → SEKSITHZ.js} +1 -1
  55. package/lib/chunks/{7LNKXEIU.js → SF5X7PGJ.js} +1 -1
  56. package/lib/chunks/{XNNK5G6V.js → SMBH5JAE.js} +1 -1
  57. package/lib/chunks/{WV2NAII3.js → T7ZIDP7J.js} +1 -1
  58. package/lib/chunks/{B4ONRSDG.js → TYTWIWRT.js} +3 -3
  59. package/lib/chunks/{DEXQ6S3P.js → U2GUGMK3.js} +35 -35
  60. package/lib/chunks/{3LGZAJES.js → UE7IAPIP.js} +1 -1
  61. package/lib/chunks/{BFIZTFWS.js → UOPNHN3X.js} +1 -1
  62. package/lib/chunks/{YXH72HCU.js → UQLM53UV.js} +1 -1
  63. package/lib/chunks/{HTG3RKCV.js → V4EDWQZH.js} +1 -1
  64. package/lib/chunks/{ACMV5RZA.js → VAPFU7OM.js} +101 -101
  65. package/lib/chunks/{J7J4PH3V.js → W2RELNUN.js} +1 -1
  66. package/lib/chunks/{CTPVBOG5.js → WDTMN7JE.js} +1 -1
  67. package/lib/chunks/{E2D25T4G.js → XDXN5CNA.js} +3 -2
  68. package/lib/chunks/{6WESXERF.js → XIQZ6CQT.js} +1 -1
  69. package/lib/chunks/{ZP54RCIQ.js → YDPANNWI.js} +1 -1
  70. package/lib/chunks/{CVUPOCX4.js → ZB7MWGMD.js} +1 -1
  71. package/lib/chunks/{LLWU7A5G.js → ZCLACSBJ.js} +1 -1
  72. package/lib/chunks/{3SFDVGEQ.js → ZGBAOCP4.js} +1 -1
  73. package/lib/eject-assets/generators/cli/docs.ts +1 -1
  74. package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
  75. package/lib/eject-assets/generators/cli/index.ts +2 -2
  76. package/lib/eject-assets/generators/cli/render.ts +1 -1
  77. package/lib/eject-assets/generators/go/client.ts +1 -1
  78. package/lib/eject-assets/generators/go/descriptor.ts +1 -1
  79. package/lib/eject-assets/generators/go/index.ts +2 -2
  80. package/lib/eject-assets/generators/go/models.ts +1 -1
  81. package/lib/eject-assets/generators/go/naming.ts +1 -1
  82. package/lib/eject-assets/generators/go/operations.ts +1 -1
  83. package/lib/eject-assets/generators/go/pagination.ts +1 -1
  84. package/lib/eject-assets/generators/go/types.ts +1 -1
  85. package/lib/eject-assets/generators/mock/faker.ts +1 -1
  86. package/lib/eject-assets/generators/mock/index.ts +2 -2
  87. package/lib/eject-assets/generators/mock/render.ts +1 -1
  88. package/lib/eject-assets/generators/mock/sample.ts +1 -1
  89. package/lib/eject-assets/generators/mock/values.ts +1 -1
  90. package/lib/eject-assets/generators/php/client.ts +1 -1
  91. package/lib/eject-assets/generators/php/descriptor.ts +1 -1
  92. package/lib/eject-assets/generators/php/index.ts +2 -2
  93. package/lib/eject-assets/generators/php/models.ts +1 -1
  94. package/lib/eject-assets/generators/php/naming.ts +1 -1
  95. package/lib/eject-assets/generators/php/operations.ts +1 -1
  96. package/lib/eject-assets/generators/php/pagination.ts +1 -1
  97. package/lib/eject-assets/generators/php/types.ts +1 -1
  98. package/lib/eject-assets/generators/python/client.ts +1 -1
  99. package/lib/eject-assets/generators/python/descriptor.ts +1 -1
  100. package/lib/eject-assets/generators/python/index.ts +2 -2
  101. package/lib/eject-assets/generators/python/models.ts +1 -1
  102. package/lib/eject-assets/generators/python/naming.ts +1 -1
  103. package/lib/eject-assets/generators/python/operations.ts +1 -1
  104. package/lib/eject-assets/generators/python/pagination.ts +1 -1
  105. package/lib/eject-assets/generators/python/types.ts +1 -1
  106. package/lib/eject-assets/generators/swr/index.ts +2 -2
  107. package/lib/eject-assets/generators/swr/render.ts +1 -1
  108. package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
  109. package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
  110. package/lib/eject-assets/generators/transformers/index.ts +2 -2
  111. package/lib/eject-assets/generators/transformers/render.ts +1 -1
  112. package/lib/eject-assets/generators/typescript/banner.ts +1 -1
  113. package/lib/eject-assets/generators/typescript/client.ts +1 -1
  114. package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
  115. package/lib/eject-assets/generators/typescript/index.ts +29 -3
  116. package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
  117. package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
  118. package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
  119. package/lib/eject-assets/generators/typescript/operations.ts +1 -1
  120. package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
  121. package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
  122. package/lib/eject-assets/generators/typescript/types.ts +1 -1
  123. package/lib/eject-assets/generators/zod/index.ts +2 -2
  124. package/lib/eject-assets/generators/zod/schemas.ts +1 -1
  125. package/lib/eject-assets/skills/typescript-generator/SKILL.md +19 -0
  126. package/lib/index.js +5 -5
  127. package/package.json +1 -1
  128. package/lib/chunks/FRM6TZ42.js +0 -67
@@ -1,16 +1,21 @@
1
- // Ejected from @redocly/client-generator@0.6.0 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.7.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
5
5
  import {
6
6
  type CodeSample,
7
+ type EmitOptions,
7
8
  type Generator,
9
+ GENERATOR_VERSION,
10
+ type GeneratedFile,
8
11
  type OperationModel,
9
12
  renderReferencePage,
10
13
  type SampleContext,
11
14
  } from '@redocly/client-generator';
15
+ import { TELEMETRY_RUNTIME_SOURCE } from '@redocly/client-generator/runtime-sources';
12
16
  import { join } from 'node:path';
13
17
 
18
+ import { HEADER } from './banner.ts';
14
19
  import { emitClientSingleFile, emitClientSplit, emitRuntimeFiles } from './client.ts';
15
20
  import { packageIdents } from './descriptor.ts';
16
21
 
@@ -29,6 +34,10 @@ export const typescriptGenerator: Generator = ({ model, output, outputMode, emit
29
34
  path: join(output.dir, 'runtime', name),
30
35
  content,
31
36
  }));
37
+ const telemetry: GeneratedFile[] = [];
38
+ if (emit.telemetry === 'on') {
39
+ telemetry.push(telemetryFile(output.dir, output.stem, emit));
40
+ }
32
41
  if (outputMode === 'split') {
33
42
  const { dir, stem } = output;
34
43
  const { entry, schemas } = emitClientSplit(model, emit, stem);
@@ -38,11 +47,28 @@ export const typescriptGenerator: Generator = ({ model, output, outputMode, emit
38
47
  : [{ path: join(dir, `${stem}.schemas.ts`), content: schemas }]),
39
48
  { path: output.path, content: entry },
40
49
  ...runtime,
50
+ ...telemetry,
41
51
  ];
42
52
  }
43
- return [{ path: output.path, content: emitClientSingleFile(model, emit) }, ...runtime];
53
+ return [
54
+ { path: output.path, content: emitClientSingleFile(model, emit) },
55
+ ...runtime,
56
+ ...telemetry,
57
+ ];
44
58
  };
45
59
 
60
+ function telemetryFile(dir: string, stem: string, emit: EmitOptions): GeneratedFile {
61
+ const clientModule = `./${stem}.${emit.importExt ?? 'js'}`;
62
+ const content = TELEMETRY_RUNTIME_SOURCE.replace(
63
+ "from '../../../runtime-contract.js';",
64
+ () => `from '${clientModule}';`
65
+ ).replace(
66
+ "const GENERATOR_VERSION: string = 'dev';",
67
+ () => `const GENERATOR_VERSION: string = '${GENERATOR_VERSION}';`
68
+ );
69
+ return { path: join(dir, `${stem}.telemetry.ts`), content: `${HEADER}\n\n${content}` };
70
+ }
71
+
46
72
  /**
47
73
  * The client's own reference page, written when `client.docs` is on. Its snippets come from
48
74
  * `typescriptSample` below, so the page shows the calling convention this run generated —
@@ -97,5 +123,5 @@ export default {
97
123
  run: typescriptGenerator,
98
124
  sample: typescriptSample,
99
125
  docs: typescriptDocs,
100
- requiresGenerator: '^0.6.0',
126
+ requiresGenerator: '^0.7.1',
101
127
  };
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.6.0 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.7.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.6.0 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.7.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.6.0 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.7.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.6.0 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.7.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.6.0 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.7.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.6.0 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.7.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.6.0 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.7.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.6.0 — the built-in "zod" generator.
1
+ // Ejected from @redocly/client-generator@0.7.1 — the built-in "zod" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator zod --update`.
@@ -28,5 +28,5 @@ export const zodGenerator: Generator = ({ model, output, banner }) => {
28
28
  export default {
29
29
  name: 'zod',
30
30
  run: zodGenerator,
31
- requiresGenerator: '^0.6.0',
31
+ requiresGenerator: '^0.7.1',
32
32
  };
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.6.0 — the built-in "zod" generator.
1
+ // Ejected from @redocly/client-generator@0.7.1 — the built-in "zod" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator zod --update`.
@@ -17,6 +17,10 @@ operation, and the runtime — embedded in the file (`runtime: inline`, the defa
17
17
  written as real modules in a `runtime/` folder beside it that the client imports
18
18
  relatively (`runtime: module`).
19
19
 
20
+ With `client.telemetry: on`, it also writes `<stem>.telemetry.ts`: the usage telemetry
21
+ middleware. The module exports `telemetry()` and `flush()`, and the application registers
22
+ it with `use(telemetry({ sdkName, sdkVersion, client }))`.
23
+
20
24
  ## Design decisions that must hold
21
25
 
22
26
  - **Descriptor-driven:** generated code is DATA (`OPERATIONS` + `Ops`) plus wiring;
@@ -61,6 +65,18 @@ relatively (`runtime: module`).
61
65
  derives, boundary included), `send()` sets the operation's declared content type only
62
66
  when the caller set none, the same rule the JSON branch already follows. A forwarded
63
67
  multipart boundary therefore survives, and a binary upload is never sent untyped.
68
+ - **`onSettled` sees every sent call once.** `send()` calls it after the last attempt
69
+ with the final response, the error, or both, the attempt count, and the duration from
70
+ the first attempt to the end of the `onResponse` hooks on the final response. A call
71
+ that fails in `onRequest` or in body serialization does not reach it. A call whose
72
+ signal is already aborted reaches it with 0 attempts.
73
+ Every hook runs. The first hook error rejects a successful call; on a failed call, the
74
+ original error wins.
75
+ - **Telemetry is opt-in at generation time.** Without `telemetry: on`, the output holds
76
+ no telemetry code, and the client file does not change. An event holds only the
77
+ operation id, the counts, the window, and the SDK identity. The kill switches and a
78
+ browser turn the middleware off. The module embeds on its own, not in
79
+ `RUNTIME_SOURCES`, so `telemetry` and `flush` never become reserved names of a client.
64
80
  - **Throw mode returns the body**; `{ envelope: true }` opts into
65
81
  `{ data, headers, response }` with typed declared headers. Result mode returns
66
82
  `{ data, error, response }` and ignores `envelope`.
@@ -82,6 +98,9 @@ inside the package and reach the generator through
82
98
  `@redocly/client-generator/runtime-sources` (in this repo they live in `runtime/` beside
83
99
  these files). Naming and string escaping live in the TypeScript printer
84
100
  (`@redocly/client-generator/printers/typescript`).
101
+ The telemetry middleware ships the same way, as `TELEMETRY_RUNTIME_SOURCE` (in this repo
102
+ it lives in `telemetry/`); `index.ts` writes it with the contract import pointed at the
103
+ client entry and the generator version baked in.
85
104
 
86
105
  ## Ejecting it
87
106