@dudousxd/nestjs-codegen 0.2.1 → 0.4.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.
- package/CHANGELOG.md +57 -0
- package/dist/cli/main.cjs +1229 -1612
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +1211 -1594
- package/dist/cli/main.js.map +1 -1
- package/dist/extension/index.cjs +12 -2
- package/dist/extension/index.cjs.map +1 -1
- package/dist/extension/index.d.cts +1 -1
- package/dist/extension/index.d.ts +1 -1
- package/dist/extension/index.js +10 -1
- package/dist/extension/index.js.map +1 -1
- package/dist/{index-BwIRjOQA.d.cts → index-DA4uySjo.d.cts} +84 -41
- package/dist/{index-BwIRjOQA.d.ts → index-DA4uySjo.d.ts} +84 -41
- package/dist/index.cjs +1073 -1460
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -15
- package/dist/index.d.ts +56 -15
- package/dist/index.js +1043 -1430
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +934 -1365
- package/dist/nest/index.cjs.map +1 -1
- package/dist/nest/index.d.cts +9 -2
- package/dist/nest/index.d.ts +9 -2
- package/dist/nest/index.js +921 -1352
- package/dist/nest/index.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# @dudousxd/nestjs-codegen
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ed04cdc: Validate recursive DTOs instead of degrading them to `unknown`.
|
|
8
|
+
|
|
9
|
+
Self/mutually-recursive `@ValidateNested` DTOs (e.g. a `ColumnFilter` whose `and`/`or`
|
|
10
|
+
reference `ColumnFilter[]`) used to be degraded to `unknown` with a warning, dropping all
|
|
11
|
+
client-side validation for that field. They are now expanded with a real lazy schema:
|
|
12
|
+
|
|
13
|
+
- **zod / valibot** hoist a structural TS `type` alias and annotate the recursive const
|
|
14
|
+
(`z.ZodType<T>` / `v.GenericSchema<T>`) so the implicit-any self-reference cycle is broken;
|
|
15
|
+
the recursion site uses `z.lazy` / `v.lazy`.
|
|
16
|
+
- **arktype** uses the native `this` keyword for self-recursion. Mutual recursion (A ↔ B)
|
|
17
|
+
cannot be expressed per-schema without a scope, so the back-edge schema still degrades to
|
|
18
|
+
`unknown` with a clear warning — use the zod or valibot adapter for full validation there.
|
|
19
|
+
|
|
20
|
+
The over-deep nesting guard is now reported separately ("nesting too deep") instead of being
|
|
21
|
+
mislabelled as recursion. The raw-zod `defineContract` path is unchanged.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- ed04cdc: Fix array detection for union types. A property typed `unknown | unknown[]` (or any
|
|
26
|
+
union whose text happens to end in `[]`) was mistakenly treated as an array and wrapped
|
|
27
|
+
in `z.array(...)`. Array detection now uses the AST (`ArrayTypeNode`) instead of a
|
|
28
|
+
`.endsWith('[]')` text check, so only genuine `T[]` properties become arrays.
|
|
29
|
+
|
|
30
|
+
## 0.3.0
|
|
31
|
+
|
|
32
|
+
### Minor Changes
|
|
33
|
+
|
|
34
|
+
- b0fcd58: BREAKING (0.x minor bump): `validation` is now a required config field, and the zod
|
|
35
|
+
adapter is no longer bundled in core.
|
|
36
|
+
|
|
37
|
+
- `zodAdapter` is no longer exported from `@dudousxd/nestjs-codegen`. Import it from
|
|
38
|
+
`@dudousxd/nestjs-codegen-zod` instead.
|
|
39
|
+
- The `validation: 'zod'` string shortcut no longer resolves — like `'valibot'` and
|
|
40
|
+
`'arktype'`, the string forms now throw, directing you to install the adapter
|
|
41
|
+
package and pass the instance.
|
|
42
|
+
- `validation` must be provided. Both `loadConfig` (config file) and `resolveConfig`
|
|
43
|
+
(`NestjsCodegenModule.forRoot`) throw a clear `ConfigError` when it is missing.
|
|
44
|
+
|
|
45
|
+
Migration:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { zodAdapter } from "@dudousxd/nestjs-codegen-zod";
|
|
49
|
+
|
|
50
|
+
export default defineConfig({
|
|
51
|
+
validation: zodAdapter,
|
|
52
|
+
// ...
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Adapters now advertise raw-zod passthrough via the new optional
|
|
57
|
+
`ValidationAdapter.acceptsRawZodSource` capability (set only by `zodAdapter`),
|
|
58
|
+
decoupling `emit-forms` from a hardcoded `'zod'` name check.
|
|
59
|
+
|
|
3
60
|
## 0.2.1
|
|
4
61
|
|
|
5
62
|
### Patch Changes
|