@aomex/mongoose 3.21.1 → 3.22.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 +11 -0
- package/dist/index.d.ts +5 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.22.0](https://github.com/aomex/aomex/compare/v3.21.1...v3.22.0) (2025-04-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **mongoose:** 泛型 ModelInput 推导的可选属性无法跳过 ([29f60b7](https://github.com/aomex/aomex/commit/29f60b7d3d4a100faa934681be183e2cecebd135))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [3.21.1](https://github.com/aomex/aomex/compare/v3.21.0...v3.21.1) (2025-04-06)
|
|
7
18
|
|
|
8
19
|
|
package/dist/index.d.ts
CHANGED
|
@@ -34,9 +34,12 @@ declare module '@aomex/common' {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
type ModelInput<M extends Model<any, any, any, any, any, any>> = M extends Model<any, any, any, any, any, infer
|
|
38
|
-
-readonly [K in keyof
|
|
37
|
+
type ModelInput<M extends Model<any, any, any, any, any, any>> = M extends Model<any, any, any, any, any, infer T extends Record<string, Validator>> ? {
|
|
38
|
+
-readonly [K in keyof T as true extends IsInputRequired<T[K]> ? K : never]: T[K] extends Validator<infer U> ? U extends null | Validator.TDefault | Validator.TOptional ? never : U : never;
|
|
39
|
+
} & {
|
|
40
|
+
-readonly [K in keyof T as true extends IsInputRequired<T[K]> ? never : K]?: T[K] extends Validator<infer U> ? U extends null ? null | undefined : U extends Validator.TDefault | Validator.TOptional ? undefined : U : never;
|
|
39
41
|
} : never;
|
|
42
|
+
type IsInputRequired<T> = true extends Validator.HasUndefined<T> ? false : true extends Validator.HasNull<T> ? false : true extends Validator.HasDefault<T> ? false : true;
|
|
40
43
|
type ModelOutput<M extends Model<any, any, any, any, any, any>> = {
|
|
41
44
|
_id: mongo.ObjectId;
|
|
42
45
|
} & (M extends Model<infer R, any, any, any, any, any> ? R : never);
|