@tsed/mongoose 7.83.3 → 8.0.0-alpha.10

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.
Files changed (175) hide show
  1. package/lib/esm/MongooseModule.js.map +1 -1
  2. package/lib/esm/decorators/dynamicRef.js +1 -1
  3. package/lib/esm/decorators/dynamicRef.js.map +1 -1
  4. package/lib/esm/decorators/indexed.js.map +1 -1
  5. package/lib/esm/decorators/model.js +0 -2
  6. package/lib/esm/decorators/model.js.map +1 -1
  7. package/lib/esm/decorators/mongoosePlugin.js.map +1 -1
  8. package/lib/esm/decorators/numberDecimal.js +1 -1
  9. package/lib/esm/decorators/numberDecimal.js.map +1 -1
  10. package/lib/esm/decorators/objectID.js.map +1 -1
  11. package/lib/esm/decorators/postHook.js.map +1 -1
  12. package/lib/esm/decorators/preHook.js.map +1 -1
  13. package/lib/esm/decorators/ref.js.map +1 -1
  14. package/lib/esm/decorators/schema.js.map +1 -1
  15. package/lib/esm/decorators/versionKey.js.map +1 -1
  16. package/lib/esm/decorators/virtualRef.js.map +1 -1
  17. package/lib/esm/services/MongooseConnections.js +1 -1
  18. package/lib/esm/services/MongooseConnections.js.map +1 -1
  19. package/lib/esm/services/MongooseService.js.map +1 -1
  20. package/lib/esm/utils/createModel.js.map +1 -1
  21. package/lib/esm/utils/createSchema.js.map +1 -1
  22. package/lib/esm/utils/resolveRefType.js.map +1 -1
  23. package/lib/esm/utils/schemaOptions.js.map +1 -1
  24. package/lib/types/decorators/indexed.d.ts +25 -0
  25. package/lib/types/decorators/mongoosePlugin.d.ts +25 -0
  26. package/lib/types/decorators/numberDecimal.d.ts +25 -0
  27. package/lib/types/decorators/objectID.d.ts +25 -0
  28. package/lib/types/decorators/schema.d.ts +25 -0
  29. package/lib/types/interfaces/MongooseConnectionOptions.d.ts +25 -0
  30. package/lib/types/interfaces/MongooseDocument.d.ts +25 -0
  31. package/lib/types/interfaces/MongooseModel.d.ts +25 -0
  32. package/lib/types/interfaces/MongooseModelOptions.d.ts +0 -4
  33. package/lib/types/interfaces/MongooseSchemaOptions.d.ts +25 -0
  34. package/lib/types/services/MongooseService.d.ts +25 -0
  35. package/lib/types/utils/createModel.d.ts +25 -0
  36. package/lib/types/utils/createSchema.d.ts +25 -0
  37. package/lib/types/utils/schemaOptions.d.ts +25 -0
  38. package/package.json +28 -26
  39. package/lib/cjs/MongooseModule.js +0 -36
  40. package/lib/cjs/MongooseModule.js.map +0 -1
  41. package/lib/cjs/constants/constants.js +0 -24
  42. package/lib/cjs/constants/constants.js.map +0 -1
  43. package/lib/cjs/decorators/auto.js +0 -28
  44. package/lib/cjs/decorators/auto.js.map +0 -1
  45. package/lib/cjs/decorators/discriminatorKey.js +0 -6
  46. package/lib/cjs/decorators/discriminatorKey.js.map +0 -1
  47. package/lib/cjs/decorators/dynamicRef.js +0 -65
  48. package/lib/cjs/decorators/dynamicRef.js.map +0 -1
  49. package/lib/cjs/decorators/excludeIndexes.js +0 -28
  50. package/lib/cjs/decorators/excludeIndexes.js.map +0 -1
  51. package/lib/cjs/decorators/expires.js +0 -28
  52. package/lib/cjs/decorators/expires.js.map +0 -1
  53. package/lib/cjs/decorators/immutable.js +0 -30
  54. package/lib/cjs/decorators/immutable.js.map +0 -1
  55. package/lib/cjs/decorators/indexed.js +0 -26
  56. package/lib/cjs/decorators/indexed.js.map +0 -1
  57. package/lib/cjs/decorators/lowercase.js +0 -28
  58. package/lib/cjs/decorators/lowercase.js.map +0 -1
  59. package/lib/cjs/decorators/model.js +0 -71
  60. package/lib/cjs/decorators/model.js.map +0 -1
  61. package/lib/cjs/decorators/mongooseIndex.js +0 -39
  62. package/lib/cjs/decorators/mongooseIndex.js.map +0 -1
  63. package/lib/cjs/decorators/mongooseIndexes.js +0 -39
  64. package/lib/cjs/decorators/mongooseIndexes.js.map +0 -1
  65. package/lib/cjs/decorators/mongoosePlugin.js +0 -22
  66. package/lib/cjs/decorators/mongoosePlugin.js.map +0 -1
  67. package/lib/cjs/decorators/numberDecimal.js +0 -78
  68. package/lib/cjs/decorators/numberDecimal.js.map +0 -1
  69. package/lib/cjs/decorators/objectID.js +0 -32
  70. package/lib/cjs/decorators/objectID.js.map +0 -1
  71. package/lib/cjs/decorators/postHook.js +0 -26
  72. package/lib/cjs/decorators/postHook.js.map +0 -1
  73. package/lib/cjs/decorators/preHook.js +0 -71
  74. package/lib/cjs/decorators/preHook.js.map +0 -1
  75. package/lib/cjs/decorators/ref.js +0 -84
  76. package/lib/cjs/decorators/ref.js.map +0 -1
  77. package/lib/cjs/decorators/schema.js +0 -32
  78. package/lib/cjs/decorators/schema.js.map +0 -1
  79. package/lib/cjs/decorators/schemaIgnore.js +0 -27
  80. package/lib/cjs/decorators/schemaIgnore.js.map +0 -1
  81. package/lib/cjs/decorators/select.js +0 -28
  82. package/lib/cjs/decorators/select.js.map +0 -1
  83. package/lib/cjs/decorators/sparse.js +0 -30
  84. package/lib/cjs/decorators/sparse.js.map +0 -1
  85. package/lib/cjs/decorators/text.js +0 -29
  86. package/lib/cjs/decorators/text.js.map +0 -1
  87. package/lib/cjs/decorators/trim.js +0 -27
  88. package/lib/cjs/decorators/trim.js.map +0 -1
  89. package/lib/cjs/decorators/unique.js +0 -27
  90. package/lib/cjs/decorators/unique.js.map +0 -1
  91. package/lib/cjs/decorators/uppercase.js +0 -28
  92. package/lib/cjs/decorators/uppercase.js.map +0 -1
  93. package/lib/cjs/decorators/versionKey.js +0 -12
  94. package/lib/cjs/decorators/versionKey.js.map +0 -1
  95. package/lib/cjs/decorators/virtualRef.js +0 -38
  96. package/lib/cjs/decorators/virtualRef.js.map +0 -1
  97. package/lib/cjs/index.js +0 -51
  98. package/lib/cjs/index.js.map +0 -1
  99. package/lib/cjs/interfaces/MongooseConnectionOptions.js +0 -3
  100. package/lib/cjs/interfaces/MongooseConnectionOptions.js.map +0 -1
  101. package/lib/cjs/interfaces/MongooseDocument.js +0 -3
  102. package/lib/cjs/interfaces/MongooseDocument.js.map +0 -1
  103. package/lib/cjs/interfaces/MongooseModel.js +0 -3
  104. package/lib/cjs/interfaces/MongooseModel.js.map +0 -1
  105. package/lib/cjs/interfaces/MongooseModelOptions.js +0 -3
  106. package/lib/cjs/interfaces/MongooseModelOptions.js.map +0 -1
  107. package/lib/cjs/interfaces/MongooseSchemaOptions.js +0 -3
  108. package/lib/cjs/interfaces/MongooseSchemaOptions.js.map +0 -1
  109. package/lib/cjs/interfaces/MongooseSchemaTypes.js +0 -10
  110. package/lib/cjs/interfaces/MongooseSchemaTypes.js.map +0 -1
  111. package/lib/cjs/interfaces/MongooseVirtualRefOptions.js +0 -3
  112. package/lib/cjs/interfaces/MongooseVirtualRefOptions.js.map +0 -1
  113. package/lib/cjs/interfaces/interfaces.js +0 -3
  114. package/lib/cjs/interfaces/interfaces.js.map +0 -1
  115. package/lib/cjs/package.json +0 -3
  116. package/lib/cjs/registries/MongooseModels.js +0 -5
  117. package/lib/cjs/registries/MongooseModels.js.map +0 -1
  118. package/lib/cjs/services/MongooseConnections.js +0 -47
  119. package/lib/cjs/services/MongooseConnections.js.map +0 -1
  120. package/lib/cjs/services/MongooseService.js +0 -78
  121. package/lib/cjs/services/MongooseService.js.map +0 -1
  122. package/lib/cjs/utils/createModel.js +0 -44
  123. package/lib/cjs/utils/createModel.js.map +0 -1
  124. package/lib/cjs/utils/createSchema.js +0 -161
  125. package/lib/cjs/utils/createSchema.js.map +0 -1
  126. package/lib/cjs/utils/resolveRefType.js +0 -19
  127. package/lib/cjs/utils/resolveRefType.js.map +0 -1
  128. package/lib/cjs/utils/schemaOptions.js +0 -60
  129. package/lib/cjs/utils/schemaOptions.js.map +0 -1
  130. package/lib/esm/package.json +0 -3
  131. package/lib/types-esm/MongooseModule.d.ts +0 -13
  132. package/lib/types-esm/constants/constants.d.ts +0 -20
  133. package/lib/types-esm/decorators/auto.d.ts +0 -20
  134. package/lib/types-esm/decorators/discriminatorKey.d.ts +0 -1
  135. package/lib/types-esm/decorators/dynamicRef.d.ts +0 -35
  136. package/lib/types-esm/decorators/excludeIndexes.d.ts +0 -20
  137. package/lib/types-esm/decorators/expires.d.ts +0 -20
  138. package/lib/types-esm/decorators/immutable.d.ts +0 -22
  139. package/lib/types-esm/decorators/indexed.d.ts +0 -19
  140. package/lib/types-esm/decorators/lowercase.d.ts +0 -20
  141. package/lib/types-esm/decorators/model.d.ts +0 -39
  142. package/lib/types-esm/decorators/mongooseIndex.d.ts +0 -27
  143. package/lib/types-esm/decorators/mongooseIndexes.d.ts +0 -32
  144. package/lib/types-esm/decorators/mongoosePlugin.d.ts +0 -11
  145. package/lib/types-esm/decorators/numberDecimal.d.ts +0 -32
  146. package/lib/types-esm/decorators/objectID.d.ts +0 -19
  147. package/lib/types-esm/decorators/postHook.d.ts +0 -48
  148. package/lib/types-esm/decorators/preHook.d.ts +0 -49
  149. package/lib/types-esm/decorators/ref.d.ts +0 -38
  150. package/lib/types-esm/decorators/schema.d.ts +0 -54
  151. package/lib/types-esm/decorators/schemaIgnore.d.ts +0 -19
  152. package/lib/types-esm/decorators/select.d.ts +0 -20
  153. package/lib/types-esm/decorators/sparse.d.ts +0 -22
  154. package/lib/types-esm/decorators/text.d.ts +0 -21
  155. package/lib/types-esm/decorators/trim.d.ts +0 -19
  156. package/lib/types-esm/decorators/unique.d.ts +0 -19
  157. package/lib/types-esm/decorators/uppercase.d.ts +0 -20
  158. package/lib/types-esm/decorators/versionKey.d.ts +0 -1
  159. package/lib/types-esm/decorators/virtualRef.d.ts +0 -26
  160. package/lib/types-esm/index.d.ts +0 -47
  161. package/lib/types-esm/interfaces/MongooseConnectionOptions.d.ts +0 -9
  162. package/lib/types-esm/interfaces/MongooseDocument.d.ts +0 -2
  163. package/lib/types-esm/interfaces/MongooseModel.d.ts +0 -8
  164. package/lib/types-esm/interfaces/MongooseModelOptions.d.ts +0 -11
  165. package/lib/types-esm/interfaces/MongooseSchemaOptions.d.ts +0 -36
  166. package/lib/types-esm/interfaces/MongooseSchemaTypes.d.ts +0 -5
  167. package/lib/types-esm/interfaces/MongooseVirtualRefOptions.d.ts +0 -9
  168. package/lib/types-esm/interfaces/interfaces.d.ts +0 -8
  169. package/lib/types-esm/registries/MongooseModels.d.ts +0 -2
  170. package/lib/types-esm/services/MongooseConnections.d.ts +0 -9
  171. package/lib/types-esm/services/MongooseService.d.ts +0 -25
  172. package/lib/types-esm/utils/createModel.d.ts +0 -18
  173. package/lib/types-esm/utils/createSchema.d.ts +0 -28
  174. package/lib/types-esm/utils/resolveRefType.d.ts +0 -5
  175. package/lib/types-esm/utils/schemaOptions.d.ts +0 -14
@@ -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[];
@@ -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,9 +0,0 @@
1
- import { ConnectOptions } from "mongoose";
2
- export interface MongooseConnectionOptions {
3
- url: string;
4
- /**
5
- * The connection ID
6
- */
7
- id: string;
8
- connectionOptions?: ConnectOptions;
9
- }
@@ -1,2 +0,0 @@
1
- import { Document } from "mongoose";
2
- export type MongooseDocument<T> = T & Document;
@@ -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,5 +0,0 @@
1
- export declare enum MongooseSchemaTypes {
2
- OBJECT_ID = "ObjectId",
3
- STRING = "String",
4
- NUMBER = "Number"
5
- }
@@ -1,9 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- export interface MongooseVirtualRefOptions {
3
- ref?: string | Type<any> | (() => Type<any>);
4
- foreignField?: string;
5
- localField?: string;
6
- justOne?: boolean;
7
- count?: boolean;
8
- options?: object;
9
- }
@@ -1,8 +0,0 @@
1
- import { MongooseConnectionOptions } from "./MongooseConnectionOptions.js";
2
- declare global {
3
- namespace TsED {
4
- interface Configuration {
5
- mongoose: Omit<MongooseConnectionOptions, "id"> | MongooseConnectionOptions[];
6
- }
7
- }
8
- }
@@ -1,2 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- export declare const MongooseModels: Map<string, Type>;
@@ -1,9 +0,0 @@
1
- import { MongooseService } from "../services/MongooseService.js";
2
- /**
3
- * @ignore
4
- */
5
- export declare const MONGOOSE_CONNECTIONS: unique symbol;
6
- /**
7
- * @ignore
8
- */
9
- export type MONGOOSE_CONNECTIONS = MongooseService;
@@ -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,5 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- /**
3
- * @ignore
4
- */
5
- export declare function resolveRefType(type: string | (() => Type<any>) | Type<any>): string;
@@ -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;