@tsed/mongoose 8.0.0-alpha.1 → 8.0.0-alpha.11
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/lib/esm/MongooseModule.js.map +1 -1
- package/lib/esm/decorators/dynamicRef.js +1 -1
- package/lib/esm/decorators/dynamicRef.js.map +1 -1
- package/lib/esm/decorators/indexed.js.map +1 -1
- package/lib/esm/decorators/model.js +0 -2
- package/lib/esm/decorators/model.js.map +1 -1
- package/lib/esm/decorators/mongoosePlugin.js.map +1 -1
- package/lib/esm/decorators/numberDecimal.js +1 -1
- package/lib/esm/decorators/numberDecimal.js.map +1 -1
- package/lib/esm/decorators/objectID.js.map +1 -1
- package/lib/esm/decorators/postHook.js.map +1 -1
- package/lib/esm/decorators/preHook.js.map +1 -1
- package/lib/esm/decorators/ref.js.map +1 -1
- package/lib/esm/decorators/schema.js.map +1 -1
- package/lib/esm/decorators/versionKey.js.map +1 -1
- package/lib/esm/decorators/virtualRef.js.map +1 -1
- package/lib/esm/services/MongooseConnections.js +1 -1
- package/lib/esm/services/MongooseConnections.js.map +1 -1
- package/lib/esm/services/MongooseService.js.map +1 -1
- package/lib/esm/utils/createModel.js.map +1 -1
- package/lib/esm/utils/createSchema.js.map +1 -1
- package/lib/esm/utils/resolveRefType.js.map +1 -1
- package/lib/esm/utils/schemaOptions.js.map +1 -1
- package/lib/types/decorators/indexed.d.ts +25 -0
- package/lib/types/decorators/mongoosePlugin.d.ts +25 -0
- package/lib/types/decorators/numberDecimal.d.ts +25 -0
- package/lib/types/decorators/objectID.d.ts +25 -0
- package/lib/types/decorators/schema.d.ts +25 -0
- package/lib/types/interfaces/MongooseConnectionOptions.d.ts +25 -0
- package/lib/types/interfaces/MongooseDocument.d.ts +25 -0
- package/lib/types/interfaces/MongooseModel.d.ts +25 -0
- package/lib/types/interfaces/MongooseModelOptions.d.ts +0 -4
- package/lib/types/interfaces/MongooseSchemaOptions.d.ts +25 -0
- package/lib/types/services/MongooseService.d.ts +25 -0
- package/lib/types/utils/createModel.d.ts +25 -0
- package/lib/types/utils/createSchema.d.ts +25 -0
- package/lib/types/utils/schemaOptions.d.ts +25 -0
- package/package.json +24 -24
- package/vitest.config.mts +5 -5
- package/lib/cjs/MongooseModule.js +0 -36
- package/lib/cjs/MongooseModule.js.map +0 -1
- package/lib/cjs/constants/constants.js +0 -24
- package/lib/cjs/constants/constants.js.map +0 -1
- package/lib/cjs/decorators/auto.js +0 -28
- package/lib/cjs/decorators/auto.js.map +0 -1
- package/lib/cjs/decorators/discriminatorKey.js +0 -6
- package/lib/cjs/decorators/discriminatorKey.js.map +0 -1
- package/lib/cjs/decorators/dynamicRef.js +0 -65
- package/lib/cjs/decorators/dynamicRef.js.map +0 -1
- package/lib/cjs/decorators/excludeIndexes.js +0 -28
- package/lib/cjs/decorators/excludeIndexes.js.map +0 -1
- package/lib/cjs/decorators/expires.js +0 -28
- package/lib/cjs/decorators/expires.js.map +0 -1
- package/lib/cjs/decorators/immutable.js +0 -30
- package/lib/cjs/decorators/immutable.js.map +0 -1
- package/lib/cjs/decorators/indexed.js +0 -26
- package/lib/cjs/decorators/indexed.js.map +0 -1
- package/lib/cjs/decorators/lowercase.js +0 -28
- package/lib/cjs/decorators/lowercase.js.map +0 -1
- package/lib/cjs/decorators/model.js +0 -71
- package/lib/cjs/decorators/model.js.map +0 -1
- package/lib/cjs/decorators/mongooseIndex.js +0 -39
- package/lib/cjs/decorators/mongooseIndex.js.map +0 -1
- package/lib/cjs/decorators/mongooseIndexes.js +0 -39
- package/lib/cjs/decorators/mongooseIndexes.js.map +0 -1
- package/lib/cjs/decorators/mongoosePlugin.js +0 -22
- package/lib/cjs/decorators/mongoosePlugin.js.map +0 -1
- package/lib/cjs/decorators/numberDecimal.js +0 -78
- package/lib/cjs/decorators/numberDecimal.js.map +0 -1
- package/lib/cjs/decorators/objectID.js +0 -32
- package/lib/cjs/decorators/objectID.js.map +0 -1
- package/lib/cjs/decorators/postHook.js +0 -26
- package/lib/cjs/decorators/postHook.js.map +0 -1
- package/lib/cjs/decorators/preHook.js +0 -71
- package/lib/cjs/decorators/preHook.js.map +0 -1
- package/lib/cjs/decorators/ref.js +0 -84
- package/lib/cjs/decorators/ref.js.map +0 -1
- package/lib/cjs/decorators/schema.js +0 -32
- package/lib/cjs/decorators/schema.js.map +0 -1
- package/lib/cjs/decorators/schemaIgnore.js +0 -27
- package/lib/cjs/decorators/schemaIgnore.js.map +0 -1
- package/lib/cjs/decorators/select.js +0 -28
- package/lib/cjs/decorators/select.js.map +0 -1
- package/lib/cjs/decorators/sparse.js +0 -30
- package/lib/cjs/decorators/sparse.js.map +0 -1
- package/lib/cjs/decorators/text.js +0 -29
- package/lib/cjs/decorators/text.js.map +0 -1
- package/lib/cjs/decorators/trim.js +0 -27
- package/lib/cjs/decorators/trim.js.map +0 -1
- package/lib/cjs/decorators/unique.js +0 -27
- package/lib/cjs/decorators/unique.js.map +0 -1
- package/lib/cjs/decorators/uppercase.js +0 -28
- package/lib/cjs/decorators/uppercase.js.map +0 -1
- package/lib/cjs/decorators/versionKey.js +0 -12
- package/lib/cjs/decorators/versionKey.js.map +0 -1
- package/lib/cjs/decorators/virtualRef.js +0 -38
- package/lib/cjs/decorators/virtualRef.js.map +0 -1
- package/lib/cjs/index.js +0 -51
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/interfaces/MongooseConnectionOptions.js +0 -3
- package/lib/cjs/interfaces/MongooseConnectionOptions.js.map +0 -1
- package/lib/cjs/interfaces/MongooseDocument.js +0 -3
- package/lib/cjs/interfaces/MongooseDocument.js.map +0 -1
- package/lib/cjs/interfaces/MongooseModel.js +0 -3
- package/lib/cjs/interfaces/MongooseModel.js.map +0 -1
- package/lib/cjs/interfaces/MongooseModelOptions.js +0 -3
- package/lib/cjs/interfaces/MongooseModelOptions.js.map +0 -1
- package/lib/cjs/interfaces/MongooseSchemaOptions.js +0 -3
- package/lib/cjs/interfaces/MongooseSchemaOptions.js.map +0 -1
- package/lib/cjs/interfaces/MongooseSchemaTypes.js +0 -10
- package/lib/cjs/interfaces/MongooseSchemaTypes.js.map +0 -1
- package/lib/cjs/interfaces/MongooseVirtualRefOptions.js +0 -3
- package/lib/cjs/interfaces/MongooseVirtualRefOptions.js.map +0 -1
- package/lib/cjs/interfaces/interfaces.js +0 -3
- package/lib/cjs/interfaces/interfaces.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/registries/MongooseModels.js +0 -5
- package/lib/cjs/registries/MongooseModels.js.map +0 -1
- package/lib/cjs/services/MongooseConnections.js +0 -47
- package/lib/cjs/services/MongooseConnections.js.map +0 -1
- package/lib/cjs/services/MongooseService.js +0 -78
- package/lib/cjs/services/MongooseService.js.map +0 -1
- package/lib/cjs/utils/createModel.js +0 -44
- package/lib/cjs/utils/createModel.js.map +0 -1
- package/lib/cjs/utils/createSchema.js +0 -161
- package/lib/cjs/utils/createSchema.js.map +0 -1
- package/lib/cjs/utils/resolveRefType.js +0 -19
- package/lib/cjs/utils/resolveRefType.js.map +0 -1
- package/lib/cjs/utils/schemaOptions.js +0 -60
- package/lib/cjs/utils/schemaOptions.js.map +0 -1
- package/lib/esm/package.json +0 -3
- package/lib/types-esm/MongooseModule.d.ts +0 -13
- package/lib/types-esm/constants/constants.d.ts +0 -20
- package/lib/types-esm/decorators/auto.d.ts +0 -20
- package/lib/types-esm/decorators/discriminatorKey.d.ts +0 -1
- package/lib/types-esm/decorators/dynamicRef.d.ts +0 -35
- package/lib/types-esm/decorators/excludeIndexes.d.ts +0 -20
- package/lib/types-esm/decorators/expires.d.ts +0 -20
- package/lib/types-esm/decorators/immutable.d.ts +0 -22
- package/lib/types-esm/decorators/indexed.d.ts +0 -19
- package/lib/types-esm/decorators/lowercase.d.ts +0 -20
- package/lib/types-esm/decorators/model.d.ts +0 -39
- package/lib/types-esm/decorators/mongooseIndex.d.ts +0 -27
- package/lib/types-esm/decorators/mongooseIndexes.d.ts +0 -32
- package/lib/types-esm/decorators/mongoosePlugin.d.ts +0 -11
- package/lib/types-esm/decorators/numberDecimal.d.ts +0 -32
- package/lib/types-esm/decorators/objectID.d.ts +0 -19
- package/lib/types-esm/decorators/postHook.d.ts +0 -48
- package/lib/types-esm/decorators/preHook.d.ts +0 -49
- package/lib/types-esm/decorators/ref.d.ts +0 -38
- package/lib/types-esm/decorators/schema.d.ts +0 -54
- package/lib/types-esm/decorators/schemaIgnore.d.ts +0 -19
- package/lib/types-esm/decorators/select.d.ts +0 -20
- package/lib/types-esm/decorators/sparse.d.ts +0 -22
- package/lib/types-esm/decorators/text.d.ts +0 -21
- package/lib/types-esm/decorators/trim.d.ts +0 -19
- package/lib/types-esm/decorators/unique.d.ts +0 -19
- package/lib/types-esm/decorators/uppercase.d.ts +0 -20
- package/lib/types-esm/decorators/versionKey.d.ts +0 -1
- package/lib/types-esm/decorators/virtualRef.d.ts +0 -26
- package/lib/types-esm/index.d.ts +0 -47
- package/lib/types-esm/interfaces/MongooseConnectionOptions.d.ts +0 -9
- package/lib/types-esm/interfaces/MongooseDocument.d.ts +0 -2
- package/lib/types-esm/interfaces/MongooseModel.d.ts +0 -8
- package/lib/types-esm/interfaces/MongooseModelOptions.d.ts +0 -11
- package/lib/types-esm/interfaces/MongooseSchemaOptions.d.ts +0 -36
- package/lib/types-esm/interfaces/MongooseSchemaTypes.d.ts +0 -5
- package/lib/types-esm/interfaces/MongooseVirtualRefOptions.d.ts +0 -9
- package/lib/types-esm/interfaces/interfaces.d.ts +0 -8
- package/lib/types-esm/registries/MongooseModels.d.ts +0 -2
- package/lib/types-esm/services/MongooseConnections.d.ts +0 -9
- package/lib/types-esm/services/MongooseService.d.ts +0 -25
- package/lib/types-esm/utils/createModel.d.ts +0 -18
- package/lib/types-esm/utils/createSchema.d.ts +0 -28
- package/lib/types-esm/utils/resolveRefType.d.ts +0 -5
- package/lib/types-esm/utils/schemaOptions.d.ts +0 -14
- package/vitest.setup.mts +0 -10
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* If [truthy](https://masteringjs.io/tutorials/fundamentals/truthy), Mongoose will
|
|
3
|
-
* disallow changes to this path once the document is saved to the database for the first time. Read more
|
|
4
|
-
* about [immutability in Mongoose here](http://thecodebarbarian.com/whats-new-in-mongoose-5-6-immutable-properties.html).
|
|
5
|
-
*
|
|
6
|
-
* ### Example
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* @Model()
|
|
10
|
-
* export class EventModel {
|
|
11
|
-
* @Sparse()
|
|
12
|
-
* field: string;
|
|
13
|
-
* }
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @param {boolean | number} sparse
|
|
17
|
-
* @returns {Function}
|
|
18
|
-
* @decorator
|
|
19
|
-
* @mongoose
|
|
20
|
-
* @property
|
|
21
|
-
*/
|
|
22
|
-
export declare function Sparse(sparse?: boolean | number): PropertyDecorator;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* If [truthy](https://masteringjs.io/tutorials/fundamentals/truthy), Mongoose
|
|
3
|
-
* will build a text index on this path.
|
|
4
|
-
*
|
|
5
|
-
* ### Example
|
|
6
|
-
*
|
|
7
|
-
* ```typescript
|
|
8
|
-
* @Model()
|
|
9
|
-
* export class EventModel {
|
|
10
|
-
* @Text()
|
|
11
|
-
* field: string;
|
|
12
|
-
* }
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* @param {boolean | number | any} text
|
|
16
|
-
* @returns {Function}
|
|
17
|
-
* @decorator
|
|
18
|
-
* @mongoose
|
|
19
|
-
* @property
|
|
20
|
-
*/
|
|
21
|
-
export declare function Text(text?: boolean | number | any): PropertyDecorator;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tell Mongoose to make the property trimmable.
|
|
3
|
-
*
|
|
4
|
-
* ### Example
|
|
5
|
-
*
|
|
6
|
-
* ```typescript
|
|
7
|
-
* @Model()
|
|
8
|
-
* export class EventModel {
|
|
9
|
-
* @Trim()
|
|
10
|
-
* name: string;
|
|
11
|
-
* }
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* @returns {Function}
|
|
15
|
-
* @decorator
|
|
16
|
-
* @mongoose
|
|
17
|
-
* @property
|
|
18
|
-
*/
|
|
19
|
-
export declare function Trim(): Function;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tell Mongoose to ensure a unique index is created for this path.
|
|
3
|
-
*
|
|
4
|
-
* ### Example
|
|
5
|
-
*
|
|
6
|
-
* ```typescript
|
|
7
|
-
* @Model()
|
|
8
|
-
* export class EventModel {
|
|
9
|
-
* @Unique()
|
|
10
|
-
* index: string;
|
|
11
|
-
* }
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* @param {boolean | any} unique
|
|
15
|
-
* @returns {Function}
|
|
16
|
-
* @decorator
|
|
17
|
-
* @mongoose
|
|
18
|
-
*/
|
|
19
|
-
export declare function Unique(unique?: boolean | any): Function;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* If truthy, Mongoose will add a custom setter that uppercases this string using JavaScript's built-in String#toUpperCase().
|
|
3
|
-
*
|
|
4
|
-
* ### Example
|
|
5
|
-
*
|
|
6
|
-
* ```typescript
|
|
7
|
-
* @Model()
|
|
8
|
-
* export class EventModel {
|
|
9
|
-
* @Uppercase()
|
|
10
|
-
* field: string;
|
|
11
|
-
* }
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* @param {boolean} uppercase
|
|
15
|
-
* @returns {Function}
|
|
16
|
-
* @decorator
|
|
17
|
-
* @mongoose
|
|
18
|
-
* @property
|
|
19
|
-
*/
|
|
20
|
-
export declare function Uppercase(uppercase?: boolean): PropertyDecorator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function VersionKey(): PropertyDecorator;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { MongooseVirtualRefOptions } from "../interfaces/MongooseVirtualRefOptions.js";
|
|
2
|
-
/**
|
|
3
|
-
* Define a property as mongoose virtual reference to other Model (decorated with @Model).
|
|
4
|
-
*
|
|
5
|
-
* ::: warning
|
|
6
|
-
* To avoid circular dependencies, do not use the virtual reference model in
|
|
7
|
-
* anything except a type declaration. Using the virtual reference model will prevent
|
|
8
|
-
* typescript transpiler from stripping away the import statement and cause a circular
|
|
9
|
-
* import in node.
|
|
10
|
-
* :::
|
|
11
|
-
*
|
|
12
|
-
* @param ref
|
|
13
|
-
* @param foreignField
|
|
14
|
-
* @returns {Function}
|
|
15
|
-
* @decorator
|
|
16
|
-
* @mongoose
|
|
17
|
-
* @property
|
|
18
|
-
*/
|
|
19
|
-
export declare function VirtualRef(ref: string, foreignField: string): Function;
|
|
20
|
-
export declare function VirtualRef(options: MongooseVirtualRefOptions): Function;
|
|
21
|
-
export declare function VirtualRef(options: string | MongooseVirtualRefOptions, foreignField?: string): Function;
|
|
22
|
-
export type VirtualRef<T> = T | null;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Use T[] instead
|
|
25
|
-
*/
|
|
26
|
-
export type VirtualRefs<T> = T[];
|
package/lib/types-esm/index.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Automatically generated by @tsed/barrels.
|
|
3
|
-
*/
|
|
4
|
-
export * from "./constants/constants.js";
|
|
5
|
-
export * from "./decorators/auto.js";
|
|
6
|
-
export * from "./decorators/discriminatorKey.js";
|
|
7
|
-
export * from "./decorators/dynamicRef.js";
|
|
8
|
-
export * from "./decorators/excludeIndexes.js";
|
|
9
|
-
export * from "./decorators/expires.js";
|
|
10
|
-
export * from "./decorators/immutable.js";
|
|
11
|
-
export * from "./decorators/indexed.js";
|
|
12
|
-
export * from "./decorators/lowercase.js";
|
|
13
|
-
export * from "./decorators/model.js";
|
|
14
|
-
export * from "./decorators/mongooseIndex.js";
|
|
15
|
-
export * from "./decorators/mongooseIndexes.js";
|
|
16
|
-
export * from "./decorators/mongoosePlugin.js";
|
|
17
|
-
export * from "./decorators/numberDecimal.js";
|
|
18
|
-
export * from "./decorators/objectID.js";
|
|
19
|
-
export * from "./decorators/postHook.js";
|
|
20
|
-
export * from "./decorators/preHook.js";
|
|
21
|
-
export * from "./decorators/ref.js";
|
|
22
|
-
export * from "./decorators/schema.js";
|
|
23
|
-
export * from "./decorators/schemaIgnore.js";
|
|
24
|
-
export * from "./decorators/select.js";
|
|
25
|
-
export * from "./decorators/sparse.js";
|
|
26
|
-
export * from "./decorators/text.js";
|
|
27
|
-
export * from "./decorators/trim.js";
|
|
28
|
-
export * from "./decorators/unique.js";
|
|
29
|
-
export * from "./decorators/uppercase.js";
|
|
30
|
-
export * from "./decorators/versionKey.js";
|
|
31
|
-
export * from "./decorators/virtualRef.js";
|
|
32
|
-
export * from "./interfaces/interfaces.js";
|
|
33
|
-
export * from "./interfaces/MongooseConnectionOptions.js";
|
|
34
|
-
export * from "./interfaces/MongooseDocument.js";
|
|
35
|
-
export * from "./interfaces/MongooseModel.js";
|
|
36
|
-
export * from "./interfaces/MongooseModelOptions.js";
|
|
37
|
-
export * from "./interfaces/MongooseSchemaOptions.js";
|
|
38
|
-
export * from "./interfaces/MongooseSchemaTypes.js";
|
|
39
|
-
export * from "./interfaces/MongooseVirtualRefOptions.js";
|
|
40
|
-
export * from "./MongooseModule.js";
|
|
41
|
-
export * from "./registries/MongooseModels.js";
|
|
42
|
-
export * from "./services/MongooseConnections.js";
|
|
43
|
-
export * from "./services/MongooseService.js";
|
|
44
|
-
export * from "./utils/createModel.js";
|
|
45
|
-
export * from "./utils/createSchema.js";
|
|
46
|
-
export * from "./utils/resolveRefType.js";
|
|
47
|
-
export * from "./utils/schemaOptions.js";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Document, Model } from "mongoose";
|
|
2
|
-
export type MongooseMergedDocument<T> = {
|
|
3
|
-
[K in keyof T]: T[K];
|
|
4
|
-
};
|
|
5
|
-
export interface MongooseDocumentMethods<T> {
|
|
6
|
-
toClass(): T;
|
|
7
|
-
}
|
|
8
|
-
export type MongooseModel<T> = Model<MongooseMergedDocument<Document & T & MongooseDocumentMethods<T>>>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { MongooseSchemaOptions } from "./MongooseSchemaOptions.js";
|
|
2
|
-
export interface MongooseModelOptions extends MongooseSchemaOptions {
|
|
3
|
-
name?: string;
|
|
4
|
-
connection?: string;
|
|
5
|
-
collection?: string;
|
|
6
|
-
overwriteModels?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Since 2022-11-30. Use @DiscriminatorValue instead
|
|
9
|
-
*/
|
|
10
|
-
discriminatorValue?: string;
|
|
11
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type IndexOptions, Schema, SchemaOptions } from "mongoose";
|
|
2
|
-
import { MongooseDocument } from "./MongooseDocument.js";
|
|
3
|
-
export type MongooseNextCB = (err?: Error) => void;
|
|
4
|
-
export interface MongooseHookOptions {
|
|
5
|
-
document?: boolean;
|
|
6
|
-
query?: boolean;
|
|
7
|
-
parallel?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export type MongooseHookPromised<T = any> = (doc: T | MongooseDocument<T>) => Promise<void> | void;
|
|
10
|
-
export type MongoosePreHookCB<T = any> = ((doc: T | MongooseDocument<T>, next: MongooseNextCB) => void) | MongooseHookPromised;
|
|
11
|
-
export type MongoosePostHookCB<T = any> = ((doc: T | MongooseDocument<T>, error: Error, next: MongooseNextCB) => void) | ((doc: T | MongooseDocument<T>, error: Error) => Promise<void> | void) | ((doc: T | MongooseDocument<T>, next: MongooseNextCB) => void) | MongooseHookPromised;
|
|
12
|
-
export interface MongoosePreHook<T = any> {
|
|
13
|
-
method: string | RegExp;
|
|
14
|
-
fn: MongoosePreHookCB<T>;
|
|
15
|
-
options?: MongooseHookOptions;
|
|
16
|
-
}
|
|
17
|
-
export interface MongoosePostHook<T = any> {
|
|
18
|
-
method: string | RegExp;
|
|
19
|
-
fn: MongoosePostHookCB<T>;
|
|
20
|
-
options?: MongooseHookOptions;
|
|
21
|
-
}
|
|
22
|
-
export interface MongoosePluginOptions {
|
|
23
|
-
plugin: (schema: Schema, options?: any) => void;
|
|
24
|
-
options?: Record<string, unknown>;
|
|
25
|
-
}
|
|
26
|
-
export interface MongooseIndexOptions {
|
|
27
|
-
fields: Record<any, any>;
|
|
28
|
-
options?: IndexOptions;
|
|
29
|
-
}
|
|
30
|
-
export interface MongooseSchemaOptions {
|
|
31
|
-
schemaOptions?: SchemaOptions;
|
|
32
|
-
plugins?: MongoosePluginOptions[];
|
|
33
|
-
indexes?: MongooseIndexOptions[];
|
|
34
|
-
pre?: MongoosePreHook[];
|
|
35
|
-
post?: MongoosePostHook[];
|
|
36
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Logger } from "@tsed/logger";
|
|
2
|
-
import Mongoose from "mongoose";
|
|
3
|
-
import { ConnectOptions } from "mongoose";
|
|
4
|
-
export declare class MongooseService {
|
|
5
|
-
readonly connections: Map<string, Mongoose.Connection>;
|
|
6
|
-
private defaultConnection;
|
|
7
|
-
logger: Logger;
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @returns {Promise<"mongoose".Connection>}
|
|
11
|
-
*/
|
|
12
|
-
connect(id: string, url: string, connectionOptions: ConnectOptions, isDefault?: boolean): Promise<any>;
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @returns {"mongoose".Connection}
|
|
16
|
-
*/
|
|
17
|
-
get(id?: string): Mongoose.Connection | undefined;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param {string} id
|
|
21
|
-
* @returns {boolean}
|
|
22
|
-
*/
|
|
23
|
-
has(id?: string): boolean;
|
|
24
|
-
closeConnections(): Promise<void>;
|
|
25
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import mongoose, { Connection } from "mongoose";
|
|
3
|
-
export declare function getModelToken(target: Type<any>, options: any): {
|
|
4
|
-
token: symbol;
|
|
5
|
-
collectionName: any;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Create an instance of mongoose.model from a class.
|
|
9
|
-
*
|
|
10
|
-
* @param {Type<any>} target Class attached to the schema and model.
|
|
11
|
-
* @param {"mongoose".Schema} schema Schema that will be attached to the model.
|
|
12
|
-
* @param name model name
|
|
13
|
-
* @param collection (optional, induced from model name)
|
|
14
|
-
* @param overwriteModels
|
|
15
|
-
* @param connection
|
|
16
|
-
* @returns {Model<T extends Document>}
|
|
17
|
-
*/
|
|
18
|
-
export declare function createModel<T>(target: any, schema: mongoose.Schema, name?: string, collection?: string, overwriteModels?: boolean, connection?: Connection): any;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { JsonEntityStore } from "@tsed/schema";
|
|
3
|
-
import mongoose, { Schema, SchemaDefinition, SchemaTypeOptions } from "mongoose";
|
|
4
|
-
import { MongooseSchemaOptions } from "../interfaces/MongooseSchemaOptions.js";
|
|
5
|
-
import { MongooseVirtualRefOptions } from "../interfaces/MongooseVirtualRefOptions.js";
|
|
6
|
-
export interface MongooseSchemaMetadata {
|
|
7
|
-
schema: SchemaDefinition;
|
|
8
|
-
virtuals: Map<string, MongooseVirtualRefOptions>;
|
|
9
|
-
}
|
|
10
|
-
export declare function createSchema(target: Type<any>, options?: MongooseSchemaOptions): mongoose.Schema;
|
|
11
|
-
/**
|
|
12
|
-
* Get a schema already created. If the schema doesn't exists in registry, it'll be created.
|
|
13
|
-
* @param target
|
|
14
|
-
* @param options
|
|
15
|
-
*/
|
|
16
|
-
export declare function getSchema(target: Type<any>, options?: MongooseSchemaOptions): Schema;
|
|
17
|
-
export declare function getSchemaToken(target: Type<any>, options?: any): {
|
|
18
|
-
token: symbol;
|
|
19
|
-
collectionName: any;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* @ignore
|
|
23
|
-
*/
|
|
24
|
-
export declare function buildMongooseSchema(target: any): MongooseSchemaMetadata;
|
|
25
|
-
/**
|
|
26
|
-
* @ignore
|
|
27
|
-
*/
|
|
28
|
-
export declare function createSchemaTypeOptions<T = any>(propEntity: JsonEntityStore): SchemaTypeOptions<T> | SchemaTypeOptions<T>[];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Schema } from "mongoose";
|
|
2
|
-
import { MongooseNextCB, MongoosePreHookCB, MongooseSchemaOptions } from "../interfaces/MongooseSchemaOptions.js";
|
|
3
|
-
/**
|
|
4
|
-
* @ignore
|
|
5
|
-
*/
|
|
6
|
-
export declare function schemaOptions(target: any, options?: MongooseSchemaOptions): any;
|
|
7
|
-
/**
|
|
8
|
-
* @ignore
|
|
9
|
-
*/
|
|
10
|
-
export declare function buildPreHook(fn: MongoosePreHookCB): (next: MongooseNextCB) => void | Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* @ignore
|
|
13
|
-
*/
|
|
14
|
-
export declare function applySchemaOptions(schema: Schema, options: MongooseSchemaOptions): void;
|
package/vitest.setup.mts
DELETED