@contractkit/plugin-typescript 0.17.2 → 0.17.3
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 +13 -13
- package/CHANGELOG.md +6 -0
- package/coverage/clover.xml +541 -522
- package/coverage/coverage-final.json +2 -2
- package/coverage/index.html +18 -18
- package/coverage/src/codegen-contract.ts.html +350 -218
- 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 +1 -1
- package/coverage/src/index.html +18 -18
- 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 +5 -0
- package/dist/codegen-contract.d.ts.map +1 -1
- package/dist/index.js +33 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/codegen-contract.ts +47 -3
- package/tests/codegen-contract.test.ts +26 -0
|
@@ -2515,7 +2515,7 @@ function deriveTypeImportPath(file: string, template?: string): string {
|
|
|
2515
2515
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
2516
2516
|
Code coverage generated by
|
|
2517
2517
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
2518
|
-
at 2026-05-
|
|
2518
|
+
at 2026-05-05T15:36:48.642Z
|
|
2519
2519
|
</div>
|
|
2520
2520
|
<script src="../prettify.js"></script>
|
|
2521
2521
|
<script>
|
|
@@ -886,7 +886,7 @@ function renderOutputField(field: FieldNode, outputCase: 'camel' | 'snake' | 'pa
|
|
|
886
886
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
887
887
|
Code coverage generated by
|
|
888
888
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
889
|
-
at 2026-05-
|
|
889
|
+
at 2026-05-05T15:36:48.642Z
|
|
890
890
|
</div>
|
|
891
891
|
<script src="../prettify.js"></script>
|
|
892
892
|
<script>
|
|
@@ -2782,7 +2782,7 @@ export function generateSdkAggregator(clients: SdkClientInfo[], sdkOptionsImport
|
|
|
2782
2782
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
2783
2783
|
Code coverage generated by
|
|
2784
2784
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
2785
|
-
at 2026-05-
|
|
2785
|
+
at 2026-05-05T15:36:48.642Z
|
|
2786
2786
|
</div>
|
|
2787
2787
|
<script src="../prettify.js"></script>
|
|
2788
2788
|
<script>
|
package/coverage/src/index.html
CHANGED
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">77.
|
|
26
|
+
<span class="strong">77.35% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>1670/2159</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">73.
|
|
33
|
+
<span class="strong">73.93% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>1078/1458</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">81.
|
|
40
|
+
<span class="strong">81.51% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>269/330</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">79.
|
|
47
|
+
<span class="strong">79.28% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>1454/1834</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.83" 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="
|
|
89
|
-
<td data-value="
|
|
90
|
-
<td data-value="
|
|
91
|
-
<td data-value="
|
|
92
|
-
<td data-value="88.
|
|
93
|
-
<td data-value="
|
|
86
|
+
<td data-value="87.83" class="pct high">87.83%</td>
|
|
87
|
+
<td data-value="674" class="abs high">592/674</td>
|
|
88
|
+
<td data-value="82.12" class="pct high">82.12%</td>
|
|
89
|
+
<td data-value="470" class="abs high">386/470</td>
|
|
90
|
+
<td data-value="90.08" class="pct high">90.08%</td>
|
|
91
|
+
<td data-value="121" class="abs high">109/121</td>
|
|
92
|
+
<td data-value="88.96" class="pct high">88.96%</td>
|
|
93
|
+
<td data-value="553" class="abs high">492/553</td>
|
|
94
94
|
</tr>
|
|
95
95
|
|
|
96
96
|
<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-05T15:36:48.642Z
|
|
195
195
|
</div>
|
|
196
196
|
<script src="../prettify.js"></script>
|
|
197
197
|
<script>
|
|
@@ -1345,7 +1345,7 @@ export function createTypescriptPlugin(config: TypescriptPluginConfig, rootDir:
|
|
|
1345
1345
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1346
1346
|
Code coverage generated by
|
|
1347
1347
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1348
|
-
at 2026-05-
|
|
1348
|
+
at 2026-05-05T15:36:48.642Z
|
|
1349
1349
|
</div>
|
|
1350
1350
|
<script src="../prettify.js"></script>
|
|
1351
1351
|
<script>
|
|
@@ -634,7 +634,7 @@ export function <span class="fstat-no" title="function not covered" >computePubl
|
|
|
634
634
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
635
635
|
Code coverage generated by
|
|
636
636
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
637
|
-
at 2026-05-
|
|
637
|
+
at 2026-05-05T15:36:48.642Z
|
|
638
638
|
</div>
|
|
639
639
|
<script src="../prettify.js"></script>
|
|
640
640
|
<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-05T15:36:48.642Z
|
|
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">857x</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">313x</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">247x</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">171x</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">134x</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-05T15:36:48.642Z
|
|
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-05T15:36:48.642Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -5,6 +5,7 @@ import type { ContractRootNode, ModelNode, ContractTypeNode, ObjectMode } from '
|
|
|
5
5
|
* @returns `"z.strictObject"` | `"z.object"` | `"z.looseObject"`
|
|
6
6
|
*/
|
|
7
7
|
export declare function modeToWrapper(mode: ObjectMode): string;
|
|
8
|
+
/** Cross-file context passed to `generateContract` to wire up imports and Input/Output variant tracking. */
|
|
8
9
|
export interface ContractCodegenContext {
|
|
9
10
|
/** Map from model name → absolute output file path */
|
|
10
11
|
modelOutPaths: Map<string, string>;
|
|
@@ -56,9 +57,13 @@ export declare function renderInputType(type: ContractTypeNode, modelsWithInput?
|
|
|
56
57
|
* Also uses Input variants for model refs when modelsWithInput is provided.
|
|
57
58
|
*/
|
|
58
59
|
export declare function renderQueryType(type: ContractTypeNode, modelsWithInput?: Set<string>, defaultMode?: ObjectMode): string;
|
|
60
|
+
/** Returns true if `type` (recursively) contains a scalar with the given `name`. */
|
|
59
61
|
export declare function typeNeedsScalar(type: ContractTypeNode, name: string): boolean;
|
|
62
|
+
/** Returns true if any model in `root` uses a scalar with the given `name`. */
|
|
60
63
|
export declare function rootNeedsScalar(root: ContractRootNode, name: string): boolean;
|
|
64
|
+
/** Returns true if `type` (recursively) contains a `date`, `time`, or `datetime` scalar. */
|
|
61
65
|
export declare function typeNeedsDateTime(type: ContractTypeNode): boolean;
|
|
66
|
+
/** Collect model names referenced in `root` that are not defined locally (need to be imported). */
|
|
62
67
|
export declare function collectExternalRefs(root: ContractRootNode): string[];
|
|
63
68
|
/** Collect external Input variant refs needed for Input schema fields. */
|
|
64
69
|
export declare function collectExternalInputRefs(root: ContractRootNode, modelsWithInput: Set<string>): string[];
|
|
@@ -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,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,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;AAsUD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,EAAE,OAAO,GAAG,QAAQ,EAAE,WAAW,CAAC,EAAE,UAAU,GAAG,MAAM,CA6B5H;AA0ND;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,EAAE,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,EAAE,UAAU,GAAG,MAAM,CAuDvH;AA2BD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,EAAE,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,EAAE,UAAU,GAAG,MAAM,CAsCvH;AA0CD,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAuB7E;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED,4FAA4F;AAC5F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAiBjE;AAED,mGAAmG;AACnG,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAcpE;AAED,0EAA0E;AAC1E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CA4BvG;AAmCD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CA6D/D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAgB3F;AAED,gGAAgG;AAChG,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
package/dist/index.js
CHANGED
|
@@ -159,7 +159,7 @@ function generateModel(model, outPath, modelsWithInput, modelsWithWriteonly, mod
|
|
|
159
159
|
}
|
|
160
160
|
const effective = modelMap ? flattenFormatChain(model, modelMap) : model;
|
|
161
161
|
const needsInputSplit = effective.fields.some((f) => f.visibility !== "normal") || (modelsWithInput?.has(effective.name) ?? false);
|
|
162
|
-
const lines = needsInputSplit ? generateThreeSchemaModel(effective, outPath, modelsWithInput, modelsWithWriteonly) : generateSimpleModel(effective, outPath);
|
|
162
|
+
const lines = needsInputSplit ? generateThreeSchemaModel(effective, outPath, modelsWithInput, modelsWithWriteonly, modelMap) : generateSimpleModel(effective, outPath);
|
|
163
163
|
if (modelsWithOutput?.has(effective.name)) {
|
|
164
164
|
lines.push(`export type ${effective.name}Output = z.output<typeof ${effective.name}>;`);
|
|
165
165
|
}
|
|
@@ -229,7 +229,21 @@ function buildExtendChain(bases, resolveName) {
|
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
231
|
__name(buildExtendChain, "buildExtendChain");
|
|
232
|
-
function
|
|
232
|
+
function collectEffectiveWritableFieldNames(modelName, modelMap) {
|
|
233
|
+
const model = modelMap.get(modelName);
|
|
234
|
+
if (!model || model.type) return /* @__PURE__ */ new Set();
|
|
235
|
+
const result = /* @__PURE__ */ new Set();
|
|
236
|
+
for (const base of model.bases ?? []) {
|
|
237
|
+
for (const f of collectEffectiveWritableFieldNames(base, modelMap)) result.add(f);
|
|
238
|
+
}
|
|
239
|
+
for (const field of model.fields) {
|
|
240
|
+
if (field.visibility === "readonly") result.delete(field.name);
|
|
241
|
+
else result.add(field.name);
|
|
242
|
+
}
|
|
243
|
+
return result;
|
|
244
|
+
}
|
|
245
|
+
__name(collectEffectiveWritableFieldNames, "collectEffectiveWritableFieldNames");
|
|
246
|
+
function generateThreeSchemaModel(model, outPath, modelsWithInput, modelsWithWriteonly, modelMap) {
|
|
233
247
|
const lines = [];
|
|
234
248
|
const name = model.name;
|
|
235
249
|
lines.push(...generateComments(model, outPath));
|
|
@@ -263,9 +277,25 @@ function generateThreeSchemaModel(model, outPath, modelsWithInput, modelsWithWri
|
|
|
263
277
|
lines.push("");
|
|
264
278
|
const writeFields = allFields.filter((f) => f.visibility !== "readonly");
|
|
265
279
|
const writeBody = modelsWithInput ? renderInputFields(writeFields, modelsWithInput, model.mode) : renderFields(writeFields, model.mode);
|
|
280
|
+
const fieldsToOmit = /* @__PURE__ */ new Set();
|
|
281
|
+
if (bases.length > 0 && modelMap) {
|
|
282
|
+
for (const field of allFields) {
|
|
283
|
+
if (field.visibility === "readonly") {
|
|
284
|
+
for (const base of bases) {
|
|
285
|
+
if (collectEffectiveWritableFieldNames(base, modelMap).has(field.name)) {
|
|
286
|
+
fieldsToOmit.add(field.name);
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const omitClause = fieldsToOmit.size > 0 ? `.omit({ ${[
|
|
294
|
+
...fieldsToOmit
|
|
295
|
+
].map((f) => `${quoteKey(f)}: true`).join(", ")} })` : "";
|
|
266
296
|
if (bases.length > 0) {
|
|
267
297
|
const { head, tail } = buildExtendChain(bases, (b) => modelsWithInput?.has(b) ? `${b}Input` : b);
|
|
268
|
-
lines.push(`export const ${name}Input = ${head}${tail}.extend({`);
|
|
298
|
+
lines.push(`export const ${name}Input = ${head}${tail}${omitClause}.extend({`);
|
|
269
299
|
} else {
|
|
270
300
|
lines.push(`export const ${name}Input = ${wrapper}({`);
|
|
271
301
|
}
|