@contractkit/plugin-typescript 0.22.0 → 0.23.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.
- package/.turbo/turbo-build$colon$ci.log +6 -6
- package/.turbo/turbo-test$colon$ci.log +14 -14
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/coverage/clover.xml +828 -826
- package/coverage/coverage-final.json +3 -3
- package/coverage/index.html +14 -14
- package/coverage/src/codegen-contract.ts.html +170 -167
- package/coverage/src/codegen-operation.ts.html +1 -1
- package/coverage/src/codegen-plain-types.ts.html +1 -1
- package/coverage/src/codegen-sdk.ts.html +14 -8
- package/coverage/src/index.html +19 -19
- package/coverage/src/index.ts.html +1 -1
- package/coverage/src/path-utils.ts.html +1 -1
- package/coverage/src/ts-render.ts.html +1 -1
- package/coverage/tests/helpers.ts.html +6 -6
- package/coverage/tests/index.html +1 -1
- package/dist/codegen-contract.d.ts.map +1 -1
- package/dist/codegen-sdk.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/codegen-contract.ts +2 -1
- package/src/codegen-sdk.ts +4 -2
- package/tests/codegen-contract.test.ts +15 -1
- package/tests/codegen-sdk.test.ts +4 -1
|
@@ -2518,7 +2518,7 @@ function deriveTypeImportPath(file: string, template?: string): string {
|
|
|
2518
2518
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
2519
2519
|
Code coverage generated by
|
|
2520
2520
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
2521
|
-
at 2026-05-
|
|
2521
|
+
at 2026-05-12T14:28:33.558Z
|
|
2522
2522
|
</div>
|
|
2523
2523
|
<script src="../prettify.js"></script>
|
|
2524
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-
|
|
985
|
+
at 2026-05-12T14:28:33.558Z
|
|
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.
|
|
26
|
+
<span class="strong">88.09% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
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.
|
|
47
|
+
<span class="strong">91.32% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
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
|
|
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"> </span>
|
|
1259
1261
|
<span class="cline-any cline-neutral"> </span>
|
|
1260
1262
|
<span class="cline-any cline-neutral"> </span>
|
|
1261
1263
|
<span class="cline-any cline-neutral"> </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"> </span>
|
|
1451
1454
|
<span class="cline-any cline-neutral"> </span>
|
|
1452
1455
|
<span class="cline-any cline-yes">83x</span>
|
|
@@ -2287,6 +2290,7 @@
|
|
|
2287
2290
|
<span class="cline-any cline-neutral"> </span>
|
|
2288
2291
|
<span class="cline-any cline-neutral"> </span>
|
|
2289
2292
|
<span class="cline-any cline-neutral"> </span>
|
|
2293
|
+
<span class="cline-any cline-neutral"> </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"> </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-
|
|
3655
|
+
at 2026-05-12T14:28:33.558Z
|
|
3650
3656
|
</div>
|
|
3651
3657
|
<script src="../prettify.js"></script>
|
|
3652
3658
|
<script>
|
package/coverage/src/index.html
CHANGED
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">79.
|
|
26
|
+
<span class="strong">79.75% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>1982/2485</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">74.
|
|
33
|
+
<span class="strong">74.81% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>1200/1604</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">82.
|
|
47
|
+
<span class="strong">82.34% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>1735/2107</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -80,17 +80,17 @@
|
|
|
80
80
|
</thead>
|
|
81
81
|
<tbody><tr>
|
|
82
82
|
<td class="file high" data-value="codegen-contract.ts"><a href="codegen-contract.ts.html">codegen-contract.ts</a></td>
|
|
83
|
-
<td data-value="87.
|
|
83
|
+
<td data-value="87.85" class="pic high">
|
|
84
84
|
<div class="chart"><div class="cover-fill" style="width: 87%"></div><div class="cover-empty" style="width: 13%"></div></div>
|
|
85
85
|
</td>
|
|
86
|
-
<td data-value="87.
|
|
87
|
-
<td data-value="
|
|
88
|
-
<td data-value="82.
|
|
89
|
-
<td data-value="
|
|
86
|
+
<td data-value="87.85" class="pct high">87.85%</td>
|
|
87
|
+
<td data-value="675" class="abs high">593/675</td>
|
|
88
|
+
<td data-value="82.2" class="pct high">82.2%</td>
|
|
89
|
+
<td data-value="472" class="abs high">388/472</td>
|
|
90
90
|
<td data-value="90.08" class="pct high">90.08%</td>
|
|
91
91
|
<td data-value="121" class="abs high">109/121</td>
|
|
92
|
-
<td data-value="88.
|
|
93
|
-
<td data-value="
|
|
92
|
+
<td data-value="88.98" class="pct high">88.98%</td>
|
|
93
|
+
<td data-value="554" class="abs high">493/554</td>
|
|
94
94
|
</tr>
|
|
95
95
|
|
|
96
96
|
<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.
|
|
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.
|
|
132
|
-
<td data-value="
|
|
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.
|
|
138
|
-
<td data-value="
|
|
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-
|
|
194
|
+
at 2026-05-12T14:28:33.558Z
|
|
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-
|
|
2638
|
+
at 2026-05-12T14:28:33.558Z
|
|
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-
|
|
733
|
+
at 2026-05-12T14:28:33.558Z
|
|
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-
|
|
580
|
+
at 2026-05-12T14:28:33.558Z
|
|
581
581
|
</div>
|
|
582
582
|
<script src="../prettify.js"></script>
|
|
583
583
|
<script>
|
|
@@ -341,11 +341,11 @@
|
|
|
341
341
|
<span class="cline-any cline-neutral"> </span>
|
|
342
342
|
<span class="cline-any cline-neutral"> </span>
|
|
343
343
|
<span class="cline-any cline-neutral"> </span>
|
|
344
|
-
<span class="cline-any cline-yes">
|
|
344
|
+
<span class="cline-any cline-yes">895x</span>
|
|
345
345
|
<span class="cline-any cline-neutral"> </span>
|
|
346
346
|
<span class="cline-any cline-neutral"> </span>
|
|
347
347
|
<span class="cline-any cline-neutral"> </span>
|
|
348
|
-
<span class="cline-any cline-yes">
|
|
348
|
+
<span class="cline-any cline-yes">320x</span>
|
|
349
349
|
<span class="cline-any cline-neutral"> </span>
|
|
350
350
|
<span class="cline-any cline-neutral"> </span>
|
|
351
351
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -389,7 +389,7 @@
|
|
|
389
389
|
<span class="cline-any cline-neutral"> </span>
|
|
390
390
|
<span class="cline-any cline-neutral"> </span>
|
|
391
391
|
<span class="cline-any cline-neutral"> </span>
|
|
392
|
-
<span class="cline-any cline-yes">
|
|
392
|
+
<span class="cline-any cline-yes">259x</span>
|
|
393
393
|
<span class="cline-any cline-neutral"> </span>
|
|
394
394
|
<span class="cline-any cline-neutral"> </span>
|
|
395
395
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -401,7 +401,7 @@
|
|
|
401
401
|
<span class="cline-any cline-neutral"> </span>
|
|
402
402
|
<span class="cline-any cline-neutral"> </span>
|
|
403
403
|
<span class="cline-any cline-neutral"> </span>
|
|
404
|
-
<span class="cline-any cline-yes">
|
|
404
|
+
<span class="cline-any cline-yes">179x</span>
|
|
405
405
|
<span class="cline-any cline-neutral"> </span>
|
|
406
406
|
<span class="cline-any cline-neutral"> </span>
|
|
407
407
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -411,7 +411,7 @@
|
|
|
411
411
|
<span class="cline-any cline-neutral"> </span>
|
|
412
412
|
<span class="cline-any cline-neutral"> </span>
|
|
413
413
|
<span class="cline-any cline-neutral"> </span>
|
|
414
|
-
<span class="cline-any cline-yes">
|
|
414
|
+
<span class="cline-any cline-yes">138x</span>
|
|
415
415
|
<span class="cline-any cline-neutral"> </span>
|
|
416
416
|
<span class="cline-any cline-neutral"> </span>
|
|
417
417
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -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-
|
|
814
|
+
at 2026-05-12T14:28:33.558Z
|
|
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-
|
|
104
|
+
at 2026-05-12T14:28:33.558Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen-contract.d.ts","sourceRoot":"","sources":["../src/codegen-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,gBAAgB,EAChB,SAAS,EAET,gBAAgB,EAWhB,UAAU,EACb,MAAM,mBAAmB,CAAC;AAO3B;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAStD;AAID,4GAA4G;AAC5G,MAAM,WAAW,sBAAsB;IACnC,sDAAsD;IACtD,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,8DAA8D;IAC9D,cAAc,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,6GAA6G;IAC7G,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAID;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,uBAAuB,GAAE,GAAG,CAAC,MAAM,CAAa,GAAG,GAAG,CAAC,MAAM,CAAC,CAsCzH;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAkEjG;
|
|
1
|
+
{"version":3,"file":"codegen-contract.d.ts","sourceRoot":"","sources":["../src/codegen-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,g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ACtB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAC9B,kBAAkB;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,mIAAmI;IACnI,cAAc,EAAE,iBAAiB,CAAC;CACrC;AAED,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IAC/B,8FAA8F;IAC9F,eAAe,EAAE,aAAa,EAAE,CAAC;IACjC,iCAAiC;IACjC,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,kFAAkF;IAClF,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC5B,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb,+HAA+H;IAC/H,OAAO,EAAE,MAAM,CAAC;IAChB,0GAA0G;IAC1G,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,2EAA2E;IAC3E,cAAc,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,aAAa,CAAA;KAAE,EAAE,CAAC;IAClE,yEAAyE;IACzE,cAAc,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
|
@@ -197,7 +197,8 @@ function generateSimpleModel(model, outPath) {
|
|
|
197
197
|
for (const field of model.fields) {
|
|
198
198
|
const inputKey = applyCase(field.name, inputCase);
|
|
199
199
|
const outputKey = applyCase(field.name, outputCase);
|
|
200
|
-
|
|
200
|
+
const val = field.optional ? `data.${inputKey} ?? undefined` : `data.${inputKey}`;
|
|
201
|
+
lines.push(` ${quoteKey(outputKey)}: ${val},`);
|
|
201
202
|
}
|
|
202
203
|
lines.push(`}));`);
|
|
203
204
|
const typeSource = hasOutputTransform && !hasInputTransform ? "input" : "output";
|
|
@@ -1826,6 +1827,7 @@ function generateSdk(root, options = {}) {
|
|
|
1826
1827
|
lines.push(" public readonly status: number,");
|
|
1827
1828
|
lines.push(" public readonly statusText: string,");
|
|
1828
1829
|
lines.push(" public readonly body: unknown,");
|
|
1830
|
+
lines.push(" public readonly headers: Headers,");
|
|
1829
1831
|
lines.push(" ) {");
|
|
1830
1832
|
lines.push(" super(`${status} ${statusText}`);");
|
|
1831
1833
|
lines.push(" this.name = 'SdkError';");
|
|
@@ -1856,7 +1858,7 @@ function generateSdk(root, options = {}) {
|
|
|
1856
1858
|
lines.push(" const text = await res.text();");
|
|
1857
1859
|
lines.push(" let body: unknown;");
|
|
1858
1860
|
lines.push(" try { body = JSON.parse(text); } catch { body = text; }");
|
|
1859
|
-
lines.push(" throw new SdkError(res.status, res.statusText, body);");
|
|
1861
|
+
lines.push(" throw new SdkError(res.status, res.statusText, body, res.headers);");
|
|
1860
1862
|
lines.push(" }");
|
|
1861
1863
|
lines.push(" return res;");
|
|
1862
1864
|
lines.push(" };");
|
|
@@ -2500,6 +2502,7 @@ function generateSdkOptions() {
|
|
|
2500
2502
|
" public readonly status: number,",
|
|
2501
2503
|
" public readonly statusText: string,",
|
|
2502
2504
|
" public readonly body: unknown,",
|
|
2505
|
+
" public readonly headers: Headers,",
|
|
2503
2506
|
" ) {",
|
|
2504
2507
|
" super(`${status} ${statusText}`);",
|
|
2505
2508
|
" this.name = 'SdkError';",
|
|
@@ -2546,7 +2549,7 @@ function generateSdkOptions() {
|
|
|
2546
2549
|
" const text = await res.text();",
|
|
2547
2550
|
" let body: unknown;",
|
|
2548
2551
|
" try { body = JSON.parse(text); } catch { body = text; }",
|
|
2549
|
-
" throw new SdkError(res.status, res.statusText, body);",
|
|
2552
|
+
" throw new SdkError(res.status, res.statusText, body, res.headers);",
|
|
2550
2553
|
" }",
|
|
2551
2554
|
" return res;",
|
|
2552
2555
|
" };",
|