@tsed/mongoose 8.13.5 → 8.14.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.
@@ -58,3 +58,6 @@ export function DynamicRef(refPath, ...types) {
58
58
  return serialize(value, { ...ctx, type: getType(refPath, ctx) });
59
59
  }), OneOf(string().example("5ce7ad3028890bd71749d477").description("A reference ObjectID"), ...types));
60
60
  }
61
+ DynamicRef.$schema = {
62
+ skip: true
63
+ };
@@ -77,3 +77,6 @@ export function Ref(model, options = MongooseSchemaTypes.OBJECT_ID) {
77
77
  return serialize(value, { ...ctx, type });
78
78
  }), OneOf(string().example("5ce7ad3028890bd71749d477").description("A reference ObjectID"), lazyRef(getType)), populatedGroups.length && PopulateGroups(populatedGroups));
79
79
  }
80
+ Ref.$schema = {
81
+ skip: true
82
+ };
@@ -31,3 +31,6 @@ export function VirtualRef(options, foreignField) {
31
31
  const type = getType(opts);
32
32
  return useDecorators(StoreMerge(MONGOOSE_SCHEMA, schema), schema.count ? Property(Number) : type && (schema.justOne ? Property(type) : CollectionOf(type, Array)));
33
33
  }
34
+ VirtualRef.$schema = {
35
+ skip: true
36
+ };
@@ -85,7 +85,7 @@ export function buildMongooseSchema(target) {
85
85
  properties.forEach((propertyMetadata, key) => {
86
86
  // Keeping the Mongoose Schema separate, so it can overwrite everything once schema has been built.
87
87
  const schemaTypeOptions = propertyMetadata.store.get(MONGOOSE_SCHEMA) || {};
88
- if (schemaTypeOptions.schemaIgnore || propertyMetadata.isDiscriminatorKey() || propertyMetadata.isGetterOnly()) {
88
+ if (schemaTypeOptions.schemaIgnore || propertyMetadata.itemSchema.isDiscriminatorKey || propertyMetadata.isGetterOnly()) {
89
89
  return;
90
90
  }
91
91
  if (schemaTypeOptions.ref) {
@@ -106,9 +106,9 @@ export function createSchemaTypeOptions(propEntity) {
106
106
  const key = propEntity.propertyKey;
107
107
  const rawMongooseSchema = propEntity.store.get(MONGOOSE_SCHEMA) || {};
108
108
  let schemaTypeOptions = {
109
- required: propEntity.required
109
+ required: propEntity.parent.schema.isRequired(String(key))
110
110
  ? function () {
111
- return propEntity.isRequired(this[key]);
111
+ return propEntity.parent.schema.isRequiredValue(String(key), this[key]);
112
112
  }
113
113
  : false
114
114
  };
@@ -32,4 +32,9 @@ import { Type } from "@tsed/core";
32
32
  * @property
33
33
  */
34
34
  export declare function DynamicRef(refPath: string, ...types: Type<any>[]): PropertyDecorator;
35
+ export declare namespace DynamicRef {
36
+ var $schema: {
37
+ skip: boolean;
38
+ };
39
+ }
35
40
  export type DynamicRef<T> = T | string;
@@ -34,5 +34,10 @@ interface RefOptions {
34
34
  * @property
35
35
  */
36
36
  export declare function Ref(model: string | (() => Type) | any, options?: RefOptions | MongooseSchemaTypes): PropertyDecorator;
37
+ export declare namespace Ref {
38
+ var $schema: {
39
+ skip: boolean;
40
+ };
41
+ }
37
42
  export type Ref<T> = T | string;
38
43
  export {};
@@ -19,6 +19,11 @@ import { MongooseVirtualRefOptions } from "../interfaces/MongooseVirtualRefOptio
19
19
  export declare function VirtualRef(ref: string, foreignField: string): Function;
20
20
  export declare function VirtualRef(options: MongooseVirtualRefOptions): Function;
21
21
  export declare function VirtualRef(options: string | MongooseVirtualRefOptions, foreignField?: string): Function;
22
+ export declare namespace VirtualRef {
23
+ var $schema: {
24
+ skip: boolean;
25
+ };
26
+ }
22
27
  export type VirtualRef<T> = T | null;
23
28
  /**
24
29
  * @deprecated Use T[] instead
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tsed/mongoose",
3
3
  "description": "Mongoose package for Ts.ED framework",
4
4
  "type": "module",
5
- "version": "8.13.5",
5
+ "version": "8.14.0",
6
6
  "keywords": [
7
7
  "tsed",
8
8
  "mongoose",
@@ -34,15 +34,15 @@
34
34
  "tslib": "2.7.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@tsed/ajv": "8.13.5",
38
- "@tsed/barrels": "8.13.5",
39
- "@tsed/core": "8.13.5",
40
- "@tsed/di": "8.13.5",
41
- "@tsed/json-mapper": "8.13.5",
37
+ "@tsed/ajv": "8.14.0",
38
+ "@tsed/barrels": "8.14.0",
39
+ "@tsed/core": "8.14.0",
40
+ "@tsed/di": "8.14.0",
41
+ "@tsed/json-mapper": "8.14.0",
42
42
  "@tsed/logger": "^7.0.1",
43
- "@tsed/schema": "8.13.5",
44
- "@tsed/testcontainers-mongo": "8.13.5",
45
- "@tsed/typescript": "8.13.5",
43
+ "@tsed/schema": "8.14.0",
44
+ "@tsed/testcontainers-mongo": "8.14.0",
45
+ "@tsed/typescript": "8.14.0",
46
46
  "eslint": "9.12.0",
47
47
  "mongoose": "8.12.2",
48
48
  "typescript": "5.4.5",