Comparing version 7.5.1 to 7.5.2
@@ -627,4 +627,4 @@ 'use strict'; | ||
if (schema._applyDiscriminators != null) { | ||
for (const disc of Object.keys(schema._applyDiscriminators)) { | ||
model.discriminator(disc, schema._applyDiscriminators[disc]); | ||
for (const disc of schema._applyDiscriminators.keys()) { | ||
model.discriminator(disc, schema._applyDiscriminators.get(disc)); | ||
} | ||
@@ -631,0 +631,0 @@ } |
{ | ||
"name": "mongoose", | ||
"description": "Mongoose MongoDB ODM", | ||
"version": "7.5.1", | ||
"version": "7.5.2", | ||
"author": "Guillermo Rauch <guillermo@learnboost.com>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -239,3 +239,3 @@ /// <reference path="./aggregate.d.ts" /> | ||
*/ | ||
constructor(definition?: SchemaDefinition<SchemaDefinitionType<EnforcedDocType>> | DocType, options?: SchemaOptions<DocType, TInstanceMethods, TQueryHelpers, TStaticMethods, TVirtuals, THydratedDocumentType> | ResolveSchemaOptions<TSchemaOptions>); | ||
constructor(definition?: SchemaDefinition<SchemaDefinitionType<EnforcedDocType>, EnforcedDocType> | DocType, options?: SchemaOptions<DocType, TInstanceMethods, TQueryHelpers, TStaticMethods, TVirtuals, THydratedDocumentType> | ResolveSchemaOptions<TSchemaOptions>); | ||
@@ -304,3 +304,3 @@ /** Adds key path / schema type pairs to this schema. */ | ||
/** The original object passed to the schema constructor */ | ||
obj: SchemaDefinition<SchemaDefinitionType<EnforcedDocType>>; | ||
obj: SchemaDefinition<SchemaDefinitionType<EnforcedDocType>, EnforcedDocType>; | ||
@@ -489,17 +489,17 @@ /** Gets/sets schema paths. */ | ||
export type SchemaDefinitionProperty<T = undefined> = SchemaDefinitionWithBuiltInClass<T> | | ||
SchemaTypeOptions<T extends undefined ? any : T> | | ||
export type SchemaDefinitionProperty<T = undefined, EnforcedDocType = any> = SchemaDefinitionWithBuiltInClass<T> | | ||
SchemaTypeOptions<T extends undefined ? any : T, EnforcedDocType> | | ||
typeof SchemaType | | ||
Schema<any, any, any> | | ||
Schema<any, any, any>[] | | ||
SchemaTypeOptions<T extends undefined ? any : Unpacked<T>>[] | | ||
SchemaTypeOptions<T extends undefined ? any : Unpacked<T>, EnforcedDocType>[] | | ||
Function[] | | ||
SchemaDefinition<T> | | ||
SchemaDefinition<Unpacked<T>>[] | | ||
SchemaDefinition<T, EnforcedDocType> | | ||
SchemaDefinition<Unpacked<T>, EnforcedDocType>[] | | ||
typeof Schema.Types.Mixed | | ||
MixedSchemaTypeOptions; | ||
MixedSchemaTypeOptions<EnforcedDocType>; | ||
export type SchemaDefinition<T = undefined> = T extends undefined | ||
export type SchemaDefinition<T = undefined, EnforcedDocType = any> = T extends undefined | ||
? { [path: string]: SchemaDefinitionProperty; } | ||
: { [path in keyof T]?: SchemaDefinitionProperty<T[path]>; }; | ||
: { [path in keyof T]?: SchemaDefinitionProperty<T[path], EnforcedDocType>; }; | ||
@@ -509,3 +509,3 @@ export type AnyArray<T> = T[] | ReadonlyArray<T>; | ||
export interface MixedSchemaTypeOptions extends SchemaTypeOptions<Schema.Types.Mixed> { | ||
export interface MixedSchemaTypeOptions<EnforcedDocType> extends SchemaTypeOptions<Schema.Types.Mixed, EnforcedDocType> { | ||
type: typeof Schema.Types.Mixed; | ||
@@ -512,0 +512,0 @@ } |
@@ -42,3 +42,3 @@ declare module 'mongoose' { | ||
class SchemaTypeOptions<T> { | ||
class SchemaTypeOptions<T, EnforcedDocType = any> { | ||
type?: | ||
@@ -52,8 +52,8 @@ T extends string ? StringSchemaDefinition : | ||
T extends Types.ObjectId ? ObjectIdSchemaDefinition : | ||
T extends Types.ObjectId[] ? AnyArray<ObjectIdSchemaDefinition> | AnyArray<SchemaTypeOptions<ObjectId>> : | ||
T extends object[] ? (AnyArray<Schema<any, any, any>> | AnyArray<SchemaDefinition<Unpacked<T>>> | AnyArray<SchemaTypeOptions<Unpacked<T>>>) : | ||
T extends string[] ? AnyArray<StringSchemaDefinition> | AnyArray<SchemaTypeOptions<string>> : | ||
T extends number[] ? AnyArray<NumberSchemaDefinition> | AnyArray<SchemaTypeOptions<number>> : | ||
T extends boolean[] ? AnyArray<BooleanSchemaDefinition> | AnyArray<SchemaTypeOptions<boolean>> : | ||
T extends Function[] ? AnyArray<Function | string> | AnyArray<SchemaTypeOptions<Unpacked<T>>> : | ||
T extends Types.ObjectId[] ? AnyArray<ObjectIdSchemaDefinition> | AnyArray<SchemaTypeOptions<ObjectId, EnforcedDocType>> : | ||
T extends object[] ? (AnyArray<Schema<any, any, any>> | AnyArray<SchemaDefinition<Unpacked<T>>> | AnyArray<SchemaTypeOptions<Unpacked<T>, EnforcedDocType>>) : | ||
T extends string[] ? AnyArray<StringSchemaDefinition> | AnyArray<SchemaTypeOptions<string, EnforcedDocType>> : | ||
T extends number[] ? AnyArray<NumberSchemaDefinition> | AnyArray<SchemaTypeOptions<number, EnforcedDocType>> : | ||
T extends boolean[] ? AnyArray<BooleanSchemaDefinition> | AnyArray<SchemaTypeOptions<boolean, EnforcedDocType>> : | ||
T extends Function[] ? AnyArray<Function | string> | AnyArray<SchemaTypeOptions<Unpacked<T>, EnforcedDocType>> : | ||
T | typeof SchemaType | Schema<any, any, any> | SchemaDefinition<T> | Function | AnyArray<Function>; | ||
@@ -79,3 +79,3 @@ | ||
*/ | ||
required?: boolean | (() => boolean) | [boolean, string] | [() => boolean, string]; | ||
required?: boolean | ((this: EnforcedDocType) => boolean) | [boolean, string] | [(this: EnforcedDocType) => boolean, string]; | ||
@@ -86,3 +86,3 @@ /** | ||
*/ | ||
default?: DefaultType<T> | ((this: any, doc: any) => DefaultType<T>) | null; | ||
default?: DefaultType<T> | ((this: EnforcedDocType, doc: any) => DefaultType<T>) | null; | ||
@@ -89,0 +89,0 @@ /** |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2637780
50021