@contractkit/plugin-typescript 0.21.0 → 0.23.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.
@@ -37,16 +37,16 @@
37
37
 
38
38
 
39
39
  <div class='fl pad1y space-right2'>
40
- <span class="strong">83.54% </span>
40
+ <span class="strong">83.5% </span>
41
41
  <span class="quiet">Functions</span>
42
- <span class='fraction'>335/401</span>
42
+ <span class='fraction'>334/400</span>
43
43
  </div>
44
44
 
45
45
 
46
46
  <div class='fl pad1y space-right2'>
47
- <span class="strong">82.56% </span>
47
+ <span class="strong">82.57% </span>
48
48
  <span class="quiet">Lines</span>
49
- <span class='fraction'>1776/2151</span>
49
+ <span class='fraction'>1777/2152</span>
50
50
  </div>
51
51
 
52
52
 
@@ -87,10 +87,10 @@
87
87
  <td data-value="2484" class="abs medium">1981/2484</td>
88
88
  <td data-value="74.78" class="pct medium">74.78%</td>
89
89
  <td data-value="1602" class="abs medium">1198/1602</td>
90
- <td data-value="83.1" class="pct high">83.1%</td>
91
- <td data-value="373" class="abs high">310/373</td>
92
- <td data-value="82.32" class="pct high">82.32%</td>
93
- <td data-value="2105" class="abs high">1733/2105</td>
90
+ <td data-value="83.06" class="pct high">83.06%</td>
91
+ <td data-value="372" class="abs high">309/372</td>
92
+ <td data-value="82.33" class="pct high">82.33%</td>
93
+ <td data-value="2106" class="abs high">1734/2106</td>
94
94
  </tr>
95
95
 
96
96
  <tr>
@@ -116,7 +116,7 @@
116
116
  <div class='footer quiet pad2 space-top1 center small'>
117
117
  Code coverage generated by
118
118
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
119
- at 2026-05-07T11:53:53.335Z
119
+ at 2026-05-12T12:06:55.452Z
120
120
  </div>
121
121
  <script src="prettify.js"></script>
122
122
  <script>
@@ -3598,7 +3598,7 @@ export function pascalToDotCase(name: string): string {
3598
3598
  <div class='footer quiet pad2 space-top1 center small'>
3599
3599
  Code coverage generated by
3600
3600
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
3601
- at 2026-05-07T11:53:53.335Z
3601
+ at 2026-05-12T12:06:55.452Z
3602
3602
  </div>
3603
3603
  <script src="../prettify.js"></script>
3604
3604
  <script>
@@ -23,9 +23,9 @@
23
23
  <div class='clearfix'>
24
24
 
25
25
  <div class='fl pad1y space-right2'>
26
- <span class="strong">78.18% </span>
26
+ <span class="strong">78.13% </span>
27
27
  <span class="quiet">Statements</span>
28
- <span class='fraction'>362/463</span>
28
+ <span class='fraction'>361/462</span>
29
29
  </div>
30
30
 
31
31
 
@@ -37,9 +37,9 @@
37
37
 
38
38
 
39
39
  <div class='fl pad1y space-right2'>
40
- <span class="strong">78.08% </span>
40
+ <span class="strong">77.77% </span>
41
41
  <span class="quiet">Functions</span>
42
- <span class='fraction'>57/73</span>
42
+ <span class='fraction'>56/72</span>
43
43
  </div>
44
44
 
45
45
 
@@ -878,7 +878,8 @@
878
878
  <a name='L813'></a><a href='#L813'>813</a>
879
879
  <a name='L814'></a><a href='#L814'>814</a>
880
880
  <a name='L815'></a><a href='#L815'>815</a>
881
- <a name='L816'></a><a href='#L816'>816</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
881
+ <a name='L816'></a><a href='#L816'>816</a>
882
+ <a name='L817'></a><a href='#L817'>817</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
882
883
  <span class="cline-any cline-neutral">&nbsp;</span>
883
884
  <span class="cline-any cline-neutral">&nbsp;</span>
884
885
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -1007,6 +1008,7 @@
1007
1008
  <span class="cline-any cline-neutral">&nbsp;</span>
1008
1009
  <span class="cline-any cline-neutral">&nbsp;</span>
1009
1010
  <span class="cline-any cline-neutral">&nbsp;</span>
1011
+ <span class="cline-any cline-neutral">&nbsp;</span>
1010
1012
  <span class="cline-any cline-yes">110x</span>
1011
1013
  <span class="cline-any cline-yes">110x</span>
1012
1014
  <span class="cline-any cline-yes">110x</span>
@@ -1820,6 +1822,7 @@ export interface OpCodegenOptions {
1820
1822
  includeInternal?: boolean;
1821
1823
  }
1822
1824
  &nbsp;
1825
+ /** Generate a Koa router module for every operation in `root`, including the imports, type aliases, and handler list. */
1823
1826
  export function generateOp(root: OpRootNode, options: OpCodegenOptions = {}): string {
1824
1827
  // Collect all referenced types across all routes
1825
1828
  const types = collectTypes(root, options.modelsWithInput, options.modelsWithOutput);
@@ -1935,8 +1938,8 @@ function generateHandler(route: OpRouteNode, op: OpOperationNode, root: OpRootNo
1935
1938
  // Middleware list
1936
1939
  const middlewares: string[] = [];
1937
1940
  if (effectiveSecurity !== SECURITY_NONE) {
1938
- const roles = effectiveSecurity &amp;&amp; effectiveSecurity.roles?.length ? `roles: [${effectiveSecurity.roles.map(r =&gt; `'${r}'`).join(', ')}]` : '';
1939
- middlewares.push(`requireSecurity({ ${roles} })`);
1941
+ const args = effectiveSecurity &amp;&amp; effectiveSecurity.requireMfa !== undefined ? `{ requireMfa: ${effectiveSecurity.requireMfa} }` : '';
1942
+ middlewares.push(`requireSecurity(${args})`);
1940
1943
  }
1941
1944
  if (hasBody) {
1942
1945
  const parserTokens = Array.from(new Set(bodies.map(b =&gt; bodyParserToken(b.contentType))));
@@ -2515,7 +2518,7 @@ function deriveTypeImportPath(file: string, template?: string): string {
2515
2518
  <div class='footer quiet pad2 space-top1 center small'>
2516
2519
  Code coverage generated by
2517
2520
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
2518
- at 2026-05-07T11:53:53.335Z
2521
+ at 2026-05-12T12:06:55.452Z
2519
2522
  </div>
2520
2523
  <script src="../prettify.js"></script>
2521
2524
  <script>
@@ -982,7 +982,7 @@ function renderOutputField(field: FieldNode, outputCase: 'camel' | 'snake' | 'pa
982
982
  <div class='footer quiet pad2 space-top1 center small'>
983
983
  Code coverage generated by
984
984
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
985
- at 2026-05-07T11:53:53.335Z
985
+ at 2026-05-12T12:06:55.452Z
986
986
  </div>
987
987
  <script src="../prettify.js"></script>
988
988
  <script>
@@ -23,9 +23,9 @@
23
23
  <div class='clearfix'>
24
24
 
25
25
  <div class='fl pad1y space-right2'>
26
- <span class="strong">88.07% </span>
26
+ <span class="strong">88.09% </span>
27
27
  <span class="quiet">Statements</span>
28
- <span class='fraction'>554/629</span>
28
+ <span class='fraction'>555/630</span>
29
29
  </div>
30
30
 
31
31
 
@@ -44,9 +44,9 @@
44
44
 
45
45
 
46
46
  <div class='fl pad1y space-right2'>
47
- <span class="strong">91.3% </span>
47
+ <span class="strong">91.32% </span>
48
48
  <span class="quiet">Lines</span>
49
- <span class='fraction'>504/552</span>
49
+ <span class='fraction'>505/553</span>
50
50
  </div>
51
51
 
52
52
 
@@ -1255,7 +1255,9 @@
1255
1255
  <a name='L1190'></a><a href='#L1190'>1190</a>
1256
1256
  <a name='L1191'></a><a href='#L1191'>1191</a>
1257
1257
  <a name='L1192'></a><a href='#L1192'>1192</a>
1258
- <a name='L1193'></a><a href='#L1193'>1193</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
1258
+ <a name='L1193'></a><a href='#L1193'>1193</a>
1259
+ <a name='L1194'></a><a href='#L1194'>1194</a>
1260
+ <a name='L1195'></a><a href='#L1195'>1195</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
1259
1261
  <span class="cline-any cline-neutral">&nbsp;</span>
1260
1262
  <span class="cline-any cline-neutral">&nbsp;</span>
1261
1263
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -1447,6 +1449,7 @@
1447
1449
  <span class="cline-any cline-yes">79x</span>
1448
1450
  <span class="cline-any cline-yes">79x</span>
1449
1451
  <span class="cline-any cline-yes">79x</span>
1452
+ <span class="cline-any cline-yes">79x</span>
1450
1453
  <span class="cline-any cline-neutral">&nbsp;</span>
1451
1454
  <span class="cline-any cline-neutral">&nbsp;</span>
1452
1455
  <span class="cline-any cline-yes">83x</span>
@@ -2287,6 +2290,7 @@
2287
2290
  <span class="cline-any cline-neutral">&nbsp;</span>
2288
2291
  <span class="cline-any cline-neutral">&nbsp;</span>
2289
2292
  <span class="cline-any cline-neutral">&nbsp;</span>
2293
+ <span class="cline-any cline-neutral">&nbsp;</span>
2290
2294
  <span class="cline-any cline-yes">7x</span>
2291
2295
  <span class="cline-any cline-yes">7x</span>
2292
2296
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -2587,6 +2591,7 @@ export function generateSdk(root: OpRootNode, options: SdkCodegenOptions = {}):
2587
2591
  lines.push(' public readonly status: number,');
2588
2592
  lines.push(' public readonly statusText: string,');
2589
2593
  lines.push(' public readonly body: unknown,');
2594
+ lines.push(' public readonly headers: Headers,');
2590
2595
  lines.push(' ) {');
2591
2596
  lines.push(' super(`${status} ${statusText}`);');
2592
2597
  lines.push(" this.name = 'SdkError';");
@@ -2617,7 +2622,7 @@ export function generateSdk(root: OpRootNode, options: SdkCodegenOptions = {}):
2617
2622
  lines.push(' const text = await res.text();');
2618
2623
  lines.push(' let body: unknown;');
2619
2624
  lines.push(' try { body = JSON.parse(text); } catch { body = text; }');
2620
- lines.push(' throw new SdkError(res.status, res.statusText, body);');
2625
+ lines.push(' throw new SdkError(res.status, res.statusText, body, res.headers);');
2621
2626
  lines.push(' }');
2622
2627
  lines.push(' return res;');
2623
2628
  lines.push(' };');
@@ -3334,6 +3339,7 @@ export function generateSdkOptions(): string {
3334
3339
  ' public readonly status: number,',
3335
3340
  ' public readonly statusText: string,',
3336
3341
  ' public readonly body: unknown,',
3342
+ ' public readonly headers: Headers,',
3337
3343
  ' ) {',
3338
3344
  ' super(`${status} ${statusText}`);',
3339
3345
  " this.name = 'SdkError';",
@@ -3380,7 +3386,7 @@ export function generateSdkOptions(): string {
3380
3386
  ' const text = await res.text();',
3381
3387
  ' let body: unknown;',
3382
3388
  ' try { body = JSON.parse(text); } catch { body = text; }',
3383
- ' throw new SdkError(res.status, res.statusText, body);',
3389
+ ' throw new SdkError(res.status, res.statusText, body, res.headers);',
3384
3390
  ' }',
3385
3391
  ' return res;',
3386
3392
  ' };',
@@ -3646,7 +3652,7 @@ export function generateSdkAggregator(input: SdkAggregatorInput): string {
3646
3652
  <div class='footer quiet pad2 space-top1 center small'>
3647
3653
  Code coverage generated by
3648
3654
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
3649
- at 2026-05-07T11:53:53.335Z
3655
+ at 2026-05-12T12:06:55.452Z
3650
3656
  </div>
3651
3657
  <script src="../prettify.js"></script>
3652
3658
  <script>
@@ -37,16 +37,16 @@
37
37
 
38
38
 
39
39
  <div class='fl pad1y space-right2'>
40
- <span class="strong">83.1% </span>
40
+ <span class="strong">83.06% </span>
41
41
  <span class="quiet">Functions</span>
42
- <span class='fraction'>310/373</span>
42
+ <span class='fraction'>309/372</span>
43
43
  </div>
44
44
 
45
45
 
46
46
  <div class='fl pad1y space-right2'>
47
- <span class="strong">82.32% </span>
47
+ <span class="strong">82.33% </span>
48
48
  <span class="quiet">Lines</span>
49
- <span class='fraction'>1733/2105</span>
49
+ <span class='fraction'>1734/2106</span>
50
50
  </div>
51
51
 
52
52
 
@@ -95,15 +95,15 @@
95
95
 
96
96
  <tr>
97
97
  <td class="file medium" data-value="codegen-operation.ts"><a href="codegen-operation.ts.html">codegen-operation.ts</a></td>
98
- <td data-value="78.18" class="pic medium">
98
+ <td data-value="78.13" class="pic medium">
99
99
  <div class="chart"><div class="cover-fill" style="width: 78%"></div><div class="cover-empty" style="width: 22%"></div></div>
100
100
  </td>
101
- <td data-value="78.18" class="pct medium">78.18%</td>
102
- <td data-value="463" class="abs medium">362/463</td>
101
+ <td data-value="78.13" class="pct medium">78.13%</td>
102
+ <td data-value="462" class="abs medium">361/462</td>
103
103
  <td data-value="74.26" class="pct medium">74.26%</td>
104
104
  <td data-value="338" class="abs medium">251/338</td>
105
- <td data-value="78.08" class="pct medium">78.08%</td>
106
- <td data-value="73" class="abs medium">57/73</td>
105
+ <td data-value="77.77" class="pct medium">77.77%</td>
106
+ <td data-value="72" class="abs medium">56/72</td>
107
107
  <td data-value="79.69" class="pct medium">79.69%</td>
108
108
  <td data-value="399" class="abs medium">318/399</td>
109
109
  </tr>
@@ -125,17 +125,17 @@
125
125
 
126
126
  <tr>
127
127
  <td class="file high" data-value="codegen-sdk.ts"><a href="codegen-sdk.ts.html">codegen-sdk.ts</a></td>
128
- <td data-value="88.07" class="pic high">
128
+ <td data-value="88.09" class="pic high">
129
129
  <div class="chart"><div class="cover-fill" style="width: 88%"></div><div class="cover-empty" style="width: 12%"></div></div>
130
130
  </td>
131
- <td data-value="88.07" class="pct high">88.07%</td>
132
- <td data-value="629" class="abs high">554/629</td>
131
+ <td data-value="88.09" class="pct high">88.09%</td>
132
+ <td data-value="630" class="abs high">555/630</td>
133
133
  <td data-value="82.56" class="pct high">82.56%</td>
134
134
  <td data-value="367" class="abs high">303/367</td>
135
135
  <td data-value="87.32" class="pct high">87.32%</td>
136
136
  <td data-value="71" class="abs high">62/71</td>
137
- <td data-value="91.3" class="pct high">91.3%</td>
138
- <td data-value="552" class="abs high">504/552</td>
137
+ <td data-value="91.32" class="pct high">91.32%</td>
138
+ <td data-value="553" class="abs high">505/553</td>
139
139
  </tr>
140
140
 
141
141
  <tr>
@@ -191,7 +191,7 @@
191
191
  <div class='footer quiet pad2 space-top1 center small'>
192
192
  Code coverage generated by
193
193
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
194
- at 2026-05-07T11:53:53.335Z
194
+ at 2026-05-12T12:06:55.452Z
195
195
  </div>
196
196
  <script src="../prettify.js"></script>
197
197
  <script>
@@ -2635,7 +2635,7 @@ function stableSubConfig(config: unknown): string {
2635
2635
  <div class='footer quiet pad2 space-top1 center small'>
2636
2636
  Code coverage generated by
2637
2637
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
2638
- at 2026-05-07T11:53:53.335Z
2638
+ at 2026-05-12T12:06:55.452Z
2639
2639
  </div>
2640
2640
  <script src="../prettify.js"></script>
2641
2641
  <script>
@@ -730,7 +730,7 @@ export function <span class="fstat-no" title="function not covered" >computePubl
730
730
  <div class='footer quiet pad2 space-top1 center small'>
731
731
  Code coverage generated by
732
732
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
733
- at 2026-05-07T11:53:53.335Z
733
+ at 2026-05-12T12:06:55.452Z
734
734
  </div>
735
735
  <script src="../prettify.js"></script>
736
736
  <script>
@@ -577,7 +577,7 @@ export function renderOutputTsType(type: ContractTypeNode, modelsWithOutput?: Se
577
577
  <div class='footer quiet pad2 space-top1 center small'>
578
578
  Code coverage generated by
579
579
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
580
- at 2026-05-07T11:53:53.335Z
580
+ at 2026-05-12T12:06:55.452Z
581
581
  </div>
582
582
  <script src="../prettify.js"></script>
583
583
  <script>
@@ -811,7 +811,7 @@ operation /users/{id}: {
811
811
  <div class='footer quiet pad2 space-top1 center small'>
812
812
  Code coverage generated by
813
813
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
814
- at 2026-05-07T11:53:53.335Z
814
+ at 2026-05-12T12:06:55.452Z
815
815
  </div>
816
816
  <script src="../prettify.js"></script>
817
817
  <script>
@@ -101,7 +101,7 @@
101
101
  <div class='footer quiet pad2 space-top1 center small'>
102
102
  Code coverage generated by
103
103
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
104
- at 2026-05-07T11:53:53.335Z
104
+ at 2026-05-12T12:06:55.452Z
105
105
  </div>
106
106
  <script src="../prettify.js"></script>
107
107
  <script>
@@ -21,5 +21,6 @@ export interface OpCodegenOptions {
21
21
  */
22
22
  includeInternal?: boolean;
23
23
  }
24
+ /** Generate a Koa router module for every operation in `root`, including the imports, type aliases, and handler list. */
24
25
  export declare function generateOp(root: OpRootNode, options?: OpCodegenOptions): string;
25
26
  //# sourceMappingURL=codegen-operation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codegen-operation.d.ts","sourceRoot":"","sources":["../src/codegen-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAgC,gBAAgB,EAA2B,MAAM,mBAAmB,CAAC;AAmC7H;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAkE5F;AAID,MAAM,WAAW,gBAAgB;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sFAAsF;IACtF,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,qFAAqF;IACrF,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAwEnF"}
1
+ {"version":3,"file":"codegen-operation.d.ts","sourceRoot":"","sources":["../src/codegen-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAgC,gBAAgB,EAA2B,MAAM,mBAAmB,CAAC;AAmC7H;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAkE5F;AAID,MAAM,WAAW,gBAAgB;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,OAAO,CAA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Ac,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CA8GjE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAyCvE"}
package/dist/index.js CHANGED
@@ -1251,8 +1251,8 @@ function generateHandler(route, op, root, options) {
1251
1251
  const isSingleMultipart = bodies.length === 1 && bodies[0].contentType === "multipart/form-data";
1252
1252
  const middlewares = [];
1253
1253
  if (effectiveSecurity !== SECURITY_NONE) {
1254
- const roles = effectiveSecurity && effectiveSecurity.roles?.length ? `roles: [${effectiveSecurity.roles.map((r) => `'${r}'`).join(", ")}]` : "";
1255
- middlewares.push(`requireSecurity({ ${roles} })`);
1254
+ const args = effectiveSecurity && effectiveSecurity.requireMfa !== void 0 ? `{ requireMfa: ${effectiveSecurity.requireMfa} }` : "";
1255
+ middlewares.push(`requireSecurity(${args})`);
1256
1256
  }
1257
1257
  if (hasBody) {
1258
1258
  const parserTokens = Array.from(new Set(bodies.map((b) => bodyParserToken(b.contentType))));
@@ -1826,6 +1826,7 @@ function generateSdk(root, options = {}) {
1826
1826
  lines.push(" public readonly status: number,");
1827
1827
  lines.push(" public readonly statusText: string,");
1828
1828
  lines.push(" public readonly body: unknown,");
1829
+ lines.push(" public readonly headers: Headers,");
1829
1830
  lines.push(" ) {");
1830
1831
  lines.push(" super(`${status} ${statusText}`);");
1831
1832
  lines.push(" this.name = 'SdkError';");
@@ -1856,7 +1857,7 @@ function generateSdk(root, options = {}) {
1856
1857
  lines.push(" const text = await res.text();");
1857
1858
  lines.push(" let body: unknown;");
1858
1859
  lines.push(" try { body = JSON.parse(text); } catch { body = text; }");
1859
- lines.push(" throw new SdkError(res.status, res.statusText, body);");
1860
+ lines.push(" throw new SdkError(res.status, res.statusText, body, res.headers);");
1860
1861
  lines.push(" }");
1861
1862
  lines.push(" return res;");
1862
1863
  lines.push(" };");
@@ -2500,6 +2501,7 @@ function generateSdkOptions() {
2500
2501
  " public readonly status: number,",
2501
2502
  " public readonly statusText: string,",
2502
2503
  " public readonly body: unknown,",
2504
+ " public readonly headers: Headers,",
2503
2505
  " ) {",
2504
2506
  " super(`${status} ${statusText}`);",
2505
2507
  " this.name = 'SdkError';",
@@ -2546,7 +2548,7 @@ function generateSdkOptions() {
2546
2548
  " const text = await res.text();",
2547
2549
  " let body: unknown;",
2548
2550
  " try { body = JSON.parse(text); } catch { body = text; }",
2549
- " throw new SdkError(res.status, res.statusText, body);",
2551
+ " throw new SdkError(res.status, res.statusText, body, res.headers);",
2550
2552
  " }",
2551
2553
  " return res;",
2552
2554
  " };",