@tsed/mongoose 7.70.1 → 7.71.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/jest.config.js +3 -1
- package/lib/cjs/MongooseModule.js +4 -4
- package/lib/cjs/MongooseModule.js.map +1 -1
- package/lib/cjs/decorators/auto.js +2 -2
- package/lib/cjs/decorators/auto.js.map +1 -1
- package/lib/cjs/decorators/dynamicRef.js +4 -4
- package/lib/cjs/decorators/dynamicRef.js.map +1 -1
- package/lib/cjs/decorators/excludeIndexes.js +2 -2
- package/lib/cjs/decorators/excludeIndexes.js.map +1 -1
- package/lib/cjs/decorators/expires.js +2 -2
- package/lib/cjs/decorators/expires.js.map +1 -1
- package/lib/cjs/decorators/immutable.js +2 -2
- package/lib/cjs/decorators/immutable.js.map +1 -1
- package/lib/cjs/decorators/indexed.js +2 -2
- package/lib/cjs/decorators/indexed.js.map +1 -1
- package/lib/cjs/decorators/lowercase.js +2 -2
- package/lib/cjs/decorators/lowercase.js.map +1 -1
- package/lib/cjs/decorators/model.js +9 -9
- package/lib/cjs/decorators/model.js.map +1 -1
- package/lib/cjs/decorators/mongooseIndex.js +2 -2
- package/lib/cjs/decorators/mongooseIndex.js.map +1 -1
- package/lib/cjs/decorators/mongooseIndexes.js +2 -2
- package/lib/cjs/decorators/mongooseIndexes.js.map +1 -1
- package/lib/cjs/decorators/mongoosePlugin.js +2 -2
- package/lib/cjs/decorators/mongoosePlugin.js.map +1 -1
- package/lib/cjs/decorators/numberDecimal.js +2 -2
- package/lib/cjs/decorators/numberDecimal.js.map +1 -1
- package/lib/cjs/decorators/objectID.js +3 -3
- package/lib/cjs/decorators/objectID.js.map +1 -1
- package/lib/cjs/decorators/postHook.js +2 -2
- package/lib/cjs/decorators/postHook.js.map +1 -1
- package/lib/cjs/decorators/preHook.js +2 -2
- package/lib/cjs/decorators/preHook.js.map +1 -1
- package/lib/cjs/decorators/ref.js +7 -7
- package/lib/cjs/decorators/ref.js.map +1 -1
- package/lib/cjs/decorators/schema.js +5 -5
- package/lib/cjs/decorators/schema.js.map +1 -1
- package/lib/cjs/decorators/schemaIgnore.js +2 -2
- package/lib/cjs/decorators/schemaIgnore.js.map +1 -1
- package/lib/cjs/decorators/select.js +2 -2
- package/lib/cjs/decorators/select.js.map +1 -1
- package/lib/cjs/decorators/sparse.js +2 -2
- package/lib/cjs/decorators/sparse.js.map +1 -1
- package/lib/cjs/decorators/text.js +2 -2
- package/lib/cjs/decorators/text.js.map +1 -1
- package/lib/cjs/decorators/trim.js +2 -2
- package/lib/cjs/decorators/trim.js.map +1 -1
- package/lib/cjs/decorators/unique.js +2 -2
- package/lib/cjs/decorators/unique.js.map +1 -1
- package/lib/cjs/decorators/uppercase.js +2 -2
- package/lib/cjs/decorators/uppercase.js.map +1 -1
- package/lib/cjs/decorators/versionKey.js +2 -2
- package/lib/cjs/decorators/versionKey.js.map +1 -1
- package/lib/cjs/decorators/virtualRef.js +5 -5
- package/lib/cjs/decorators/virtualRef.js.map +1 -1
- package/lib/cjs/index.js +47 -47
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/services/MongooseConnections.js +2 -2
- package/lib/cjs/services/MongooseConnections.js.map +1 -1
- package/lib/cjs/utils/createModel.js +8 -8
- package/lib/cjs/utils/createModel.js.map +1 -1
- package/lib/cjs/utils/createSchema.js +11 -11
- package/lib/cjs/utils/createSchema.js.map +1 -1
- package/lib/cjs/utils/resolveRefType.js +2 -2
- package/lib/cjs/utils/resolveRefType.js.map +1 -1
- package/lib/cjs/utils/schemaOptions.js +5 -5
- package/lib/cjs/utils/schemaOptions.js.map +1 -1
- package/lib/esm/MongooseModule.js.map +1 -1
- package/lib/esm/decorators/auto.js.map +1 -1
- package/lib/esm/decorators/dynamicRef.js.map +1 -1
- package/lib/esm/decorators/excludeIndexes.js.map +1 -1
- package/lib/esm/decorators/expires.js.map +1 -1
- package/lib/esm/decorators/immutable.js.map +1 -1
- package/lib/esm/decorators/indexed.js.map +1 -1
- package/lib/esm/decorators/lowercase.js.map +1 -1
- package/lib/esm/decorators/model.js.map +1 -1
- package/lib/esm/decorators/mongooseIndex.js.map +1 -1
- package/lib/esm/decorators/mongooseIndexes.js.map +1 -1
- package/lib/esm/decorators/mongoosePlugin.js.map +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/schemaIgnore.js.map +1 -1
- package/lib/esm/decorators/select.js.map +1 -1
- package/lib/esm/decorators/sparse.js.map +1 -1
- package/lib/esm/decorators/text.js.map +1 -1
- package/lib/esm/decorators/trim.js.map +1 -1
- package/lib/esm/decorators/unique.js.map +1 -1
- package/lib/esm/decorators/uppercase.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/index.js +3 -3
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/services/MongooseConnections.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/MongooseModule.d.ts +1 -1
- package/lib/types/decorators/model.d.ts +1 -1
- package/lib/types/decorators/postHook.d.ts +1 -1
- package/lib/types/decorators/preHook.d.ts +1 -1
- package/lib/types/decorators/ref.d.ts +1 -1
- package/lib/types/decorators/schema.d.ts +1 -1
- package/lib/types/decorators/virtualRef.d.ts +1 -1
- package/lib/types/index.d.ts +45 -45
- package/lib/types/interfaces/MongooseModelOptions.d.ts +1 -1
- package/lib/types/interfaces/MongooseSchemaOptions.d.ts +1 -1
- package/lib/types/interfaces/interfaces.d.ts +1 -1
- package/lib/types/services/MongooseConnections.d.ts +1 -1
- package/lib/types/utils/createSchema.d.ts +2 -2
- package/lib/types/utils/schemaOptions.d.ts +1 -1
- package/package.json +14 -14
- package/readme.md +1 -1
package/jest.config.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// For a detailed explanation regarding each configuration property, visit:
|
|
2
2
|
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
+
const config = require("@tsed/jest-config");
|
|
3
4
|
|
|
4
5
|
module.exports = {
|
|
5
|
-
...
|
|
6
|
+
...config,
|
|
6
7
|
roots: ["<rootDir>/src", "<rootDir>/test"],
|
|
7
8
|
moduleNameMapper: {
|
|
9
|
+
...config.moduleNameMapper,
|
|
8
10
|
"@tsed/mongoose": "<rootDir>/src/index.ts"
|
|
9
11
|
},
|
|
10
12
|
coverageThreshold: {
|
|
@@ -4,8 +4,8 @@ exports.MongooseModule = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const di_1 = require("@tsed/di");
|
|
6
6
|
const di_2 = require("@tsed/di");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const MongooseConnections_js_1 = require("./services/MongooseConnections.js");
|
|
8
|
+
const MongooseService_js_1 = require("./services/MongooseService.js");
|
|
9
9
|
/**
|
|
10
10
|
* @ignore
|
|
11
11
|
*/
|
|
@@ -29,10 +29,10 @@ let MongooseModule = class MongooseModule {
|
|
|
29
29
|
};
|
|
30
30
|
MongooseModule = tslib_1.__decorate([
|
|
31
31
|
(0, di_2.Module)({
|
|
32
|
-
imports: [
|
|
32
|
+
imports: [MongooseConnections_js_1.MONGOOSE_CONNECTIONS]
|
|
33
33
|
}),
|
|
34
34
|
tslib_1.__param(1, (0, di_1.Configuration)()),
|
|
35
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
35
|
+
tslib_1.__metadata("design:paramtypes", [MongooseService_js_1.MongooseService, Object])
|
|
36
36
|
], MongooseModule);
|
|
37
37
|
exports.MongooseModule = MongooseModule;
|
|
38
38
|
//# sourceMappingURL=MongooseModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongooseModule.js","sourceRoot":"","sources":["../../src/MongooseModule.ts"],"names":[],"mappings":";;;;AAAA,iCAA+C;AAC/C,iCAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"MongooseModule.js","sourceRoot":"","sources":["../../src/MongooseModule.ts"],"names":[],"mappings":";;;;AAAA,iCAA+C;AAC/C,iCAA2C;AAC3C,8EAAuE;AACvE,sEAA8D;AAE9D;;GAEG;AAII,IAAM,cAAc,GAApB,MAAM,cAAc;IAEf;IACiB;IAF3B,YACU,eAAgC,EACf,QAAuB;QADxC,oBAAe,GAAf,eAAe,CAAiB;QACf,aAAQ,GAAR,QAAQ,CAAe;QAEhD,6EAA6E;QAC7E,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAM,OAAO,CAAC,CAAC;QAE9C,uBAAuB;QACvB,IAAI,KAAK,EAAE,QAAQ,EAAE;YACnB,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC;SAC/C;IACH,CAAC;IAED,OAAO,KAAyB,CAAC;IAEjC,UAAU;QACR,OAAO,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC;IACjD,CAAC;CACF,CAAA;AAnBY,cAAc;IAH1B,IAAA,WAAM,EAAC;QACN,OAAO,EAAE,CAAC,6CAAoB,CAAC;KAChC,CAAC;IAIG,mBAAA,IAAA,kBAAa,GAAE,CAAA;6CADS,oCAAe;GAF/B,cAAc,CAmB1B;AAnBY,wCAAc"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Auto = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schema_js_1 = require("./schema.js");
|
|
5
5
|
/**
|
|
6
6
|
* If true, uses Mongoose's default _id settings. Only allowed for ObjectIds
|
|
7
7
|
*
|
|
@@ -22,7 +22,7 @@ const schema_1 = require("./schema");
|
|
|
22
22
|
* @property
|
|
23
23
|
*/
|
|
24
24
|
function Auto(auto = true) {
|
|
25
|
-
return (0,
|
|
25
|
+
return (0, schema_js_1.MongooseSchema)({ auto });
|
|
26
26
|
}
|
|
27
27
|
exports.Auto = Auto;
|
|
28
28
|
//# sourceMappingURL=auto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto.js","sourceRoot":"","sources":["../../../src/decorators/auto.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"auto.js","sourceRoot":"","sources":["../../../src/decorators/auto.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAE3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,IAAI,CAAC,OAAgB,IAAI;IACvC,OAAO,IAAA,0BAAc,EAAC,EAAC,IAAI,EAAQ,CAAC,CAAC;AACvC,CAAC;AAFD,oBAEC"}
|
|
@@ -4,14 +4,14 @@ exports.DynamicRef = void 0;
|
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
5
|
const schema_1 = require("@tsed/schema");
|
|
6
6
|
const mongoose_1 = require("mongoose");
|
|
7
|
-
const
|
|
7
|
+
const constants_js_1 = require("../constants/constants.js");
|
|
8
8
|
const json_mapper_1 = require("@tsed/json-mapper");
|
|
9
|
-
const
|
|
9
|
+
const MongooseModels_js_1 = require("../registries/MongooseModels.js");
|
|
10
10
|
function isRef(value) {
|
|
11
11
|
return (value && value._bsontype) || (0, core_1.isString)(value);
|
|
12
12
|
}
|
|
13
13
|
function getType(refPath, ctx) {
|
|
14
|
-
return (ctx?.self[refPath] &&
|
|
14
|
+
return (ctx?.self[refPath] && MongooseModels_js_1.MongooseModels.get(ctx.self[refPath])) || Object;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Define a property as mongoose reference to other Model (decorated with @Model).
|
|
@@ -46,7 +46,7 @@ function getType(refPath, ctx) {
|
|
|
46
46
|
* @property
|
|
47
47
|
*/
|
|
48
48
|
function DynamicRef(refPath, ...types) {
|
|
49
|
-
return (0, core_1.useDecorators)((0, schema_1.Property)(Object), (0, schema_1.Example)("5ce7ad3028890bd71749d477"), (0, schema_1.Description)("A reference ObjectID"), (0, core_1.StoreMerge)(
|
|
49
|
+
return (0, core_1.useDecorators)((0, schema_1.Property)(Object), (0, schema_1.Example)("5ce7ad3028890bd71749d477"), (0, schema_1.Description)("A reference ObjectID"), (0, core_1.StoreMerge)(constants_js_1.MONGOOSE_SCHEMA, {
|
|
50
50
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
51
51
|
refPath
|
|
52
52
|
}), (0, json_mapper_1.OnDeserialize)((value, ctx) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamicRef.js","sourceRoot":"","sources":["../../../src/decorators/dynamicRef.ts"],"names":[],"mappings":";;;AAAA,qCAAyF;AACzF,yCAA4F;AAC5F,uCAAkD;AAClD,
|
|
1
|
+
{"version":3,"file":"dynamicRef.js","sourceRoot":"","sources":["../../../src/decorators/dynamicRef.ts"],"names":[],"mappings":";;;AAAA,qCAAyF;AACzF,yCAA4F;AAC5F,uCAAkD;AAClD,4DAA0D;AAC1D,mDAAqF;AACrF,uEAA+D;AAE/D,SAAS,KAAK,CAAC,KAA+B;IAC5C,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,IAAA,eAAQ,EAAC,KAAK,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,OAAO,CAAC,OAAe,EAAE,GAAoB;IACpD,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,kCAAc,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAW,CAAC,CAAC,IAAI,MAAM,CAAC;AAC3F,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,SAAgB,UAAU,CAAC,OAAe,EAAE,GAAG,KAAkB;IAC/D,OAAO,IAAA,oBAAa,EAClB,IAAA,iBAAQ,EAAC,MAAM,CAAC,EAChB,IAAA,gBAAO,EAAC,0BAA0B,CAAC,EACnC,IAAA,oBAAW,EAAC,sBAAsB,CAAC,EACnC,IAAA,iBAAU,EAAC,8BAAe,EAAE;QAC1B,IAAI,EAAE,iBAAc,CAAC,KAAK,CAAC,QAAQ;QACnC,OAAO;KACR,CAAC,EACF,IAAA,2BAAa,EAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAC3B,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;YAChB,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;SACzB;QAED,OAAO,IAAA,yBAAW,EAAC,KAAK,EAAE,EAAC,GAAG,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,EAAC,CAAC,CAAC;IACnE,CAAC,CAAC,EACF,IAAA,yBAAW,EAAC,CAAC,KAAU,EAAE,GAAG,EAAE,EAAE;QAC9B,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;YAChB,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;SACzB;QAED,OAAO,IAAA,uBAAS,EAAC,KAAK,EAAE,EAAC,GAAG,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,EAAC,CAAC,CAAC;IACjE,CAAC,CAAC,EACF,IAAA,cAAK,EAAC,IAAA,eAAM,GAAE,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,WAAW,CAAC,sBAAsB,CAAC,EAAE,GAAG,KAAK,CAAC,CAC7E,CAAC;AACzB,CAAC;AAzBD,gCAyBC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExcludeIndexes = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schema_js_1 = require("./schema.js");
|
|
5
5
|
/**
|
|
6
6
|
* If true, Mongoose will skip gathering indexes on subpaths. Only allowed for subdocuments and subdocument arrays.
|
|
7
7
|
*
|
|
@@ -22,7 +22,7 @@ const schema_1 = require("./schema");
|
|
|
22
22
|
* @property
|
|
23
23
|
*/
|
|
24
24
|
function ExcludeIndexes(excludeIndexes = true) {
|
|
25
|
-
return (0,
|
|
25
|
+
return (0, schema_js_1.MongooseSchema)({ excludeIndexes });
|
|
26
26
|
}
|
|
27
27
|
exports.ExcludeIndexes = ExcludeIndexes;
|
|
28
28
|
//# sourceMappingURL=excludeIndexes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"excludeIndexes.js","sourceRoot":"","sources":["../../../src/decorators/excludeIndexes.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"excludeIndexes.js","sourceRoot":"","sources":["../../../src/decorators/excludeIndexes.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAE3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,cAAc,CAAC,iBAA0B,IAAI;IAC3D,OAAO,IAAA,0BAAc,EAAC,EAAC,cAAc,EAAQ,CAAC,CAAC;AACjD,CAAC;AAFD,wCAEC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Expires = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schema_js_1 = require("./schema.js");
|
|
5
5
|
/**
|
|
6
6
|
* Defines a TTL index on this path. Only allowed for dates.
|
|
7
7
|
*
|
|
@@ -22,7 +22,7 @@ const schema_1 = require("./schema");
|
|
|
22
22
|
* @property
|
|
23
23
|
*/
|
|
24
24
|
function Expires(expires) {
|
|
25
|
-
return (0,
|
|
25
|
+
return (0, schema_js_1.MongooseSchema)({ expires });
|
|
26
26
|
}
|
|
27
27
|
exports.Expires = Expires;
|
|
28
28
|
//# sourceMappingURL=expires.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expires.js","sourceRoot":"","sources":["../../../src/decorators/expires.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"expires.js","sourceRoot":"","sources":["../../../src/decorators/expires.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAE3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,OAAO,CAAC,OAA+B;IACrD,OAAO,IAAA,0BAAc,EAAC,EAAC,OAAO,EAAQ,CAAC,CAAC;AAC1C,CAAC;AAFD,0BAEC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Immutable = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schema_js_1 = require("./schema.js");
|
|
5
5
|
/**
|
|
6
6
|
* If [truthy](https://masteringjs.io/tutorials/fundamentals/truthy), Mongoose will
|
|
7
7
|
* disallow changes to this path once the document is saved to the database for the first time. Read more
|
|
@@ -24,7 +24,7 @@ const schema_1 = require("./schema");
|
|
|
24
24
|
* @property
|
|
25
25
|
*/
|
|
26
26
|
function Immutable(immutable = true) {
|
|
27
|
-
return (0,
|
|
27
|
+
return (0, schema_js_1.MongooseSchema)({ immutable });
|
|
28
28
|
}
|
|
29
29
|
exports.Immutable = Immutable;
|
|
30
30
|
//# sourceMappingURL=immutable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"immutable.js","sourceRoot":"","sources":["../../../src/decorators/immutable.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"immutable.js","sourceRoot":"","sources":["../../../src/decorators/immutable.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAE3C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,SAAS,CAAC,YAA0D,IAAI;IACtF,OAAO,IAAA,0BAAc,EAAC,EAAC,SAAS,EAAQ,CAAC,CAAC;AAC5C,CAAC;AAFD,8BAEC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Indexed = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schema_js_1 = require("./schema.js");
|
|
5
5
|
/**
|
|
6
6
|
* Tell Mongoose whether to define an index for the property.
|
|
7
7
|
* ### Example
|
|
@@ -20,7 +20,7 @@ const schema_1 = require("./schema");
|
|
|
20
20
|
* @property
|
|
21
21
|
*/
|
|
22
22
|
function Indexed(index = true) {
|
|
23
|
-
return (0,
|
|
23
|
+
return (0, schema_js_1.MongooseSchema)({ index });
|
|
24
24
|
}
|
|
25
25
|
exports.Indexed = Indexed;
|
|
26
26
|
//# sourceMappingURL=indexed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexed.js","sourceRoot":"","sources":["../../../src/decorators/indexed.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"indexed.js","sourceRoot":"","sources":["../../../src/decorators/indexed.ts"],"names":[],"mappings":";;;AACA,2CAA2C;AAE3C;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,OAAO,CAAC,QAAyC,IAAI;IACnE,OAAO,IAAA,0BAAc,EAAC,EAAC,KAAK,EAAQ,CAAC,CAAC;AACxC,CAAC;AAFD,0BAEC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Lowercase = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schema_js_1 = require("./schema.js");
|
|
5
5
|
/**
|
|
6
6
|
* If truthy, Mongoose will add a custom setter that lowercases this string using JavaScript's built-in String#toLowerCase().
|
|
7
7
|
*
|
|
@@ -22,7 +22,7 @@ const schema_1 = require("./schema");
|
|
|
22
22
|
* @property
|
|
23
23
|
*/
|
|
24
24
|
function Lowercase(lowercase = true) {
|
|
25
|
-
return (0,
|
|
25
|
+
return (0, schema_js_1.MongooseSchema)({ lowercase });
|
|
26
26
|
}
|
|
27
27
|
exports.Lowercase = Lowercase;
|
|
28
28
|
//# sourceMappingURL=lowercase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lowercase.js","sourceRoot":"","sources":["../../../src/decorators/lowercase.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"lowercase.js","sourceRoot":"","sources":["../../../src/decorators/lowercase.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAE3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,SAAS,CAAC,YAAqB,IAAI;IACjD,OAAO,IAAA,0BAAc,EAAC,EAAC,SAAS,EAAQ,CAAC,CAAC;AAC5C,CAAC;AAFD,8BAEC"}
|
|
@@ -4,10 +4,10 @@ exports.Model = void 0;
|
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
5
|
const di_1 = require("@tsed/di");
|
|
6
6
|
const schema_1 = require("@tsed/schema");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
7
|
+
const MongooseConnections_js_1 = require("../services/MongooseConnections.js");
|
|
8
|
+
const createModel_js_1 = require("../utils/createModel.js");
|
|
9
|
+
const createSchema_js_1 = require("../utils/createSchema.js");
|
|
10
|
+
const schemaOptions_js_1 = require("../utils/schemaOptions.js");
|
|
11
11
|
/**
|
|
12
12
|
* Define a class as a Mongoose Model. The model can be injected to the Service, Controller, Middleware, Converters or Filter with
|
|
13
13
|
* `@Inject` annotation.
|
|
@@ -47,22 +47,22 @@ const schemaOptions_1 = require("../utils/schemaOptions");
|
|
|
47
47
|
*/
|
|
48
48
|
function Model(options = {}) {
|
|
49
49
|
return (0, core_1.useDecorators)((target) => {
|
|
50
|
-
const { token, collectionName } = (0,
|
|
50
|
+
const { token, collectionName } = (0, createModel_js_1.getModelToken)(target, options);
|
|
51
51
|
options.discriminatorValue && (0, schema_1.DiscriminatorValue)(options.discriminatorValue)(target);
|
|
52
52
|
(0, di_1.registerProvider)({
|
|
53
53
|
provide: token,
|
|
54
54
|
deps: [],
|
|
55
55
|
useFactory() {
|
|
56
|
-
return (0,
|
|
56
|
+
return (0, createSchema_js_1.getSchema)(target, options);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
(0, di_1.registerProvider)({
|
|
60
60
|
provide: target,
|
|
61
61
|
type: "mongoose:model",
|
|
62
|
-
deps: [
|
|
62
|
+
deps: [MongooseConnections_js_1.MONGOOSE_CONNECTIONS, token],
|
|
63
63
|
useFactory(connections, schema) {
|
|
64
|
-
(0,
|
|
65
|
-
return (0,
|
|
64
|
+
(0, schemaOptions_js_1.applySchemaOptions)(schema, (0, schemaOptions_js_1.schemaOptions)(target));
|
|
65
|
+
return (0, createModel_js_1.createModel)(target, schema, collectionName, options.collection, options.overwriteModels, connections.get(options.connection));
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/decorators/model.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AACjD,iCAA0C;AAC1C,yCAAgD;AAGhD
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/decorators/model.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AACjD,iCAA0C;AAC1C,yCAAgD;AAGhD,+EAAwE;AACxE,4DAAmE;AACnE,8DAAmD;AACnD,gEAA4E;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAgB,KAAK,CAAC,UAAgC,EAAE;IACtD,OAAO,IAAA,oBAAa,EAAC,CAAC,MAAW,EAAE,EAAE;QACnC,MAAM,EAAC,KAAK,EAAE,cAAc,EAAC,GAAG,IAAA,8BAAa,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE/D,OAAO,CAAC,kBAAkB,IAAI,IAAA,2BAAkB,EAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;QAErF,IAAA,qBAAgB,EAAC;YACf,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,EAAE;YACR,UAAU;gBACR,OAAO,IAAA,2BAAS,EAAC,MAAM,EAAE,OAAc,CAAC,CAAC;YAC3C,CAAC;SACF,CAAC,CAAC;QAEH,IAAA,qBAAgB,EAAC;YACf,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,CAAC,6CAAoB,EAAE,KAAK,CAAC;YACnC,UAAU,CAAC,WAAiC,EAAE,MAAc;gBAC1D,IAAA,qCAAkB,EAAC,MAAM,EAAE,IAAA,gCAAa,EAAC,MAAM,CAAC,CAAC,CAAC;gBAClD,OAAO,IAAA,4BAAW,EAChB,MAAM,EACN,MAAM,EACN,cAAc,EACd,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,eAAe,EACvB,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CACpC,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AA/BD,sBA+BC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MongooseIndex = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schemaOptions_js_1 = require("../utils/schemaOptions.js");
|
|
5
5
|
/**
|
|
6
6
|
* Calls schema.index() to define an index (most likely compound) for the schema.
|
|
7
7
|
*
|
|
@@ -30,7 +30,7 @@ const schemaOptions_1 = require("../utils/schemaOptions");
|
|
|
30
30
|
*/
|
|
31
31
|
function MongooseIndex(fields, options) {
|
|
32
32
|
return (target) => {
|
|
33
|
-
(0,
|
|
33
|
+
(0, schemaOptions_js_1.schemaOptions)(target, {
|
|
34
34
|
indexes: [{ fields, options }]
|
|
35
35
|
});
|
|
36
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongooseIndex.js","sourceRoot":"","sources":["../../../src/decorators/mongooseIndex.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"mongooseIndex.js","sourceRoot":"","sources":["../../../src/decorators/mongooseIndex.ts"],"names":[],"mappings":";;;AAAA,gEAAwD;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,aAAa,CAAC,MAAc,EAAE,OAAa;IACzD,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,IAAA,gCAAa,EAAC,MAAM,EAAE;YACpB,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,OAAO,EAAC,CAAC;SAC7B,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAND,sCAMC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MongooseIndexes = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schemaOptions_js_1 = require("../utils/schemaOptions.js");
|
|
5
5
|
/**
|
|
6
6
|
* Calls schema.index() to define multiple indexes (most likely compound) for the schema.
|
|
7
7
|
*
|
|
@@ -32,7 +32,7 @@ const schemaOptions_1 = require("../utils/schemaOptions");
|
|
|
32
32
|
*/
|
|
33
33
|
function MongooseIndexes(indexes) {
|
|
34
34
|
return (target) => {
|
|
35
|
-
(0,
|
|
35
|
+
(0, schemaOptions_js_1.schemaOptions)(target, { indexes });
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
exports.MongooseIndexes = MongooseIndexes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongooseIndexes.js","sourceRoot":"","sources":["../../../src/decorators/mongooseIndexes.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"mongooseIndexes.js","sourceRoot":"","sources":["../../../src/decorators/mongooseIndexes.ts"],"names":[],"mappings":";;;AAAA,gEAAwD;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,eAAe,CAAC,OAA+C;IAC7E,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,IAAA,gCAAa,EAAC,MAAM,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC;IACnC,CAAC,CAAC;AACJ,CAAC;AAJD,0CAIC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MongoosePlugin = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schemaOptions_js_1 = require("../utils/schemaOptions.js");
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
7
|
* @param {(schema: "mongoose".Schema, options?: any) => void} plugin
|
|
@@ -13,7 +13,7 @@ const schemaOptions_1 = require("../utils/schemaOptions");
|
|
|
13
13
|
*/
|
|
14
14
|
function MongoosePlugin(plugin, options) {
|
|
15
15
|
return (target) => {
|
|
16
|
-
(0,
|
|
16
|
+
(0, schemaOptions_js_1.schemaOptions)(target, {
|
|
17
17
|
plugins: [{ plugin, options }]
|
|
18
18
|
});
|
|
19
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongoosePlugin.js","sourceRoot":"","sources":["../../../src/decorators/mongoosePlugin.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"mongoosePlugin.js","sourceRoot":"","sources":["../../../src/decorators/mongoosePlugin.ts"],"names":[],"mappings":";;;AACA,gEAAwD;AAExD;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAAC,MAAwD,EAAE,OAAa;IACpG,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,IAAA,gCAAa,EAAC,MAAM,EAAE;YACpB,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,OAAO,EAAC,CAAC;SAC7B,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAND,wCAMC"}
|
|
@@ -7,7 +7,7 @@ const core_1 = require("@tsed/core");
|
|
|
7
7
|
const json_mapper_1 = require("@tsed/json-mapper");
|
|
8
8
|
const schema_1 = require("@tsed/schema");
|
|
9
9
|
const mongoose_1 = require("mongoose");
|
|
10
|
-
const
|
|
10
|
+
const constants_js_1 = require("../constants/constants.js");
|
|
11
11
|
let DecimalFormat = class DecimalFormat {
|
|
12
12
|
validate(num) {
|
|
13
13
|
return (0, core_1.isString)(num) || (0, core_1.isNumber)(num);
|
|
@@ -55,7 +55,7 @@ function NumberDecimal(type) {
|
|
|
55
55
|
return isDecimal(value) ? new type(value) : value;
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
return (0, core_1.useDecorators)((0, schema_1.Property)(Number), (0, schema_1.Format)("decimal"), (0, schema_1.Example)(12.34), (0, core_1.StoreMerge)(
|
|
58
|
+
return (0, core_1.useDecorators)((0, schema_1.Property)(Number), (0, schema_1.Format)("decimal"), (0, schema_1.Example)(12.34), (0, core_1.StoreMerge)(constants_js_1.MONGOOSE_SCHEMA, schema),
|
|
59
59
|
// Deserialize number value from JSON to Decimal128
|
|
60
60
|
(0, json_mapper_1.OnDeserialize)((value) => {
|
|
61
61
|
if (value === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberDecimal.js","sourceRoot":"","sources":["../../../src/decorators/numberDecimal.ts"],"names":[],"mappings":";;;;AAAA,mCAAkD;AAClD,qCAAyE;AACzE,mDAA6D;AAC7D,yCAAuD;AACvD,uCAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"numberDecimal.js","sourceRoot":"","sources":["../../../src/decorators/numberDecimal.ts"],"names":[],"mappings":";;;;AAAA,mCAAkD;AAClD,qCAAyE;AACzE,mDAA6D;AAC7D,yCAAuD;AACvD,uCAA4E;AAC5E,4DAA0D;AAGnD,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,QAAQ,CAAC,GAAoB;QAC3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ACD,OAAO,gBAAK,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;IACjD,CAAC,CAAC;IAEF,mDAAmD;IACnD,IAAA,yBAAW,EAAC,CAAC,KAAU,EAAE,GAAG,EAAE,EAAE;QAC9B,OAAO,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AArCD,sCAqCC"}
|
|
@@ -4,8 +4,8 @@ exports.ObjectID = void 0;
|
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
5
|
const schema_1 = require("@tsed/schema");
|
|
6
6
|
const mongoose_1 = require("mongoose");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const auto_js_1 = require("./auto.js");
|
|
8
|
+
const schema_js_1 = require("./schema.js");
|
|
9
9
|
/**
|
|
10
10
|
* Tell Mongoose whether to define an ObjectId property.
|
|
11
11
|
* ### Example
|
|
@@ -23,7 +23,7 @@ const schema_2 = require("./schema");
|
|
|
23
23
|
* @schema
|
|
24
24
|
*/
|
|
25
25
|
function ObjectID(name) {
|
|
26
|
-
return (0, core_1.useDecorators)(name && (0, schema_1.Name)(name), (0, schema_1.Pattern)(/^[0-9a-fA-F]{24}$/), (0, schema_1.Description)("An ObjectID"), (0, schema_1.Example)("5ce7ad3028890bd71749d477"), (0,
|
|
26
|
+
return (0, core_1.useDecorators)(name && (0, schema_1.Name)(name), (0, schema_1.Pattern)(/^[0-9a-fA-F]{24}$/), (0, schema_1.Description)("An ObjectID"), (0, schema_1.Example)("5ce7ad3028890bd71749d477"), (0, auto_js_1.Auto)(), (0, schema_js_1.Schema)({
|
|
27
27
|
type: mongoose_1.Types.ObjectId,
|
|
28
28
|
match: undefined
|
|
29
29
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectID.js","sourceRoot":"","sources":["../../../src/decorators/objectID.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AAEzC,yCAAiE;AACjE,uCAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"objectID.js","sourceRoot":"","sources":["../../../src/decorators/objectID.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AAEzC,yCAAiE;AACjE,uCAA+B;AAC/B,uCAA+B;AAC/B,2CAAmC;AAEnC;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,QAAQ,CAAC,IAAa;IACpC,OAAO,IAAA,oBAAa,EAClB,IAAI,IAAI,IAAA,aAAI,EAAC,IAAI,CAAC,EAClB,IAAA,gBAAO,EAAC,mBAAmB,CAAC,EAC5B,IAAA,oBAAW,EAAC,aAAa,CAAC,EAC1B,IAAA,gBAAO,EAAC,0BAA0B,CAAC,EACnC,IAAA,cAAI,GAAE,EACN,IAAA,kBAAM,EAAC;QACL,IAAI,EAAE,gBAAK,CAAC,QAAQ;QACpB,KAAK,EAAE,SAAS;KACjB,CAAC,CACH,CAAC;AACJ,CAAC;AAZD,4BAYC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PostHook = void 0;
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
|
-
const
|
|
5
|
+
const schemaOptions_js_1 = require("../utils/schemaOptions.js");
|
|
6
6
|
function PostHook(method, ...params) {
|
|
7
7
|
return ((...args) => {
|
|
8
8
|
let options = params[1];
|
|
@@ -11,7 +11,7 @@ function PostHook(method, ...params) {
|
|
|
11
11
|
options = params[0];
|
|
12
12
|
fn = args[0][args[1]].bind(args[0]);
|
|
13
13
|
}
|
|
14
|
-
(0,
|
|
14
|
+
(0, schemaOptions_js_1.schemaOptions)(args[0], {
|
|
15
15
|
post: [
|
|
16
16
|
{
|
|
17
17
|
method,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postHook.js","sourceRoot":"","sources":["../../../src/decorators/postHook.ts"],"names":[],"mappings":";;;AAAA,qCAAkF;AAElF,
|
|
1
|
+
{"version":3,"file":"postHook.js","sourceRoot":"","sources":["../../../src/decorators/postHook.ts"],"names":[],"mappings":";;;AAAA,qCAAkF;AAElF,gEAAwD;AAgDxD,SAAgB,QAAQ,CAAU,MAAc,EAAE,GAAG,MAAa;IAChE,OAAO,CAAC,CAAC,GAAG,IAAW,EAAE,EAAE;QACzB,IAAI,OAAO,GAAwB,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7C,IAAI,EAAE,GAA0B,MAAM,CAAC,CAAC,CAAC,CAAC;QAE1C,IAAI,IAAA,sBAAe,EAAC,IAAI,CAAC,KAAK,qBAAc,CAAC,UAAU,EAAE;YACvD,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACpB,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SACrC;QAED,IAAA,gCAAa,EAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YACrB,IAAI,EAAE;gBACJ;oBACE,MAAM;oBACN,EAAE;oBACF,OAAO;iBACR;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAQ,CAAC;AACZ,CAAC;AApBD,4BAoBC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PreHook = void 0;
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
|
-
const
|
|
5
|
+
const schemaOptions_js_1 = require("../utils/schemaOptions.js");
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* We can simply attach a `@PreHook` decorator to your model class and
|
|
@@ -56,7 +56,7 @@ function PreHook(method, fn, options) {
|
|
|
56
56
|
options = fn;
|
|
57
57
|
fn = args[0][args[1]].bind(args[0]);
|
|
58
58
|
}
|
|
59
|
-
(0,
|
|
59
|
+
(0, schemaOptions_js_1.schemaOptions)(args[0], {
|
|
60
60
|
pre: [
|
|
61
61
|
{
|
|
62
62
|
method,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preHook.js","sourceRoot":"","sources":["../../../src/decorators/preHook.ts"],"names":[],"mappings":";;;AAAA,qCAA2D;AAE3D,
|
|
1
|
+
{"version":3,"file":"preHook.js","sourceRoot":"","sources":["../../../src/decorators/preHook.ts"],"names":[],"mappings":";;;AAAA,qCAA2D;AAE3D,gEAAwD;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,SAAgB,OAAO,CAAU,MAAc,EAAE,EAA+C,EAAE,OAA6B;IAC7H,OAAO,CAAC,GAAG,IAAW,EAAE,EAAE;QACxB,IAAI,IAAA,sBAAe,EAAC,IAAI,CAAC,KAAK,qBAAc,CAAC,UAAU,EAAE;YACvD,OAAO,GAAG,EAAyB,CAAC;YACpC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SACrC;QAED,IAAA,gCAAa,EAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YACrB,GAAG,EAAE;gBACH;oBACE,MAAM;oBACN,EAAE,EAAE,EAA0B;oBAC9B,OAAO;iBACR;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAjBD,0BAiBC"}
|
|
@@ -5,9 +5,9 @@ const core_1 = require("@tsed/core");
|
|
|
5
5
|
const json_mapper_1 = require("@tsed/json-mapper");
|
|
6
6
|
const schema_1 = require("@tsed/schema");
|
|
7
7
|
const mongoose_1 = require("mongoose");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const constants_js_1 = require("../constants/constants.js");
|
|
9
|
+
const MongooseSchemaTypes_js_1 = require("../interfaces/MongooseSchemaTypes.js");
|
|
10
|
+
const MongooseModels_js_1 = require("../registries/MongooseModels.js");
|
|
11
11
|
function isRef(value) {
|
|
12
12
|
return (0, core_1.isObjectID)(value) || (0, core_1.isString)(value);
|
|
13
13
|
}
|
|
@@ -52,14 +52,14 @@ function PopulateGroups(populatedGroups) {
|
|
|
52
52
|
* @mongoose
|
|
53
53
|
* @property
|
|
54
54
|
*/
|
|
55
|
-
function Ref(model, options =
|
|
55
|
+
function Ref(model, options = MongooseSchemaTypes_js_1.MongooseSchemaTypes.OBJECT_ID) {
|
|
56
56
|
if (!model) {
|
|
57
57
|
throw new Error("A model is required on `@Ref(model)` decorator. Please give a model or wrap it inside an arrow function if you have a circular reference.");
|
|
58
58
|
}
|
|
59
|
-
const getType = () => ((0, core_1.isString)(model) ?
|
|
59
|
+
const getType = () => ((0, core_1.isString)(model) ? MongooseModels_js_1.MongooseModels.get(model) : (0, core_1.isArrowFn)(model) ? model() : model);
|
|
60
60
|
const populatedGroups = ((0, core_1.isObject)(options) && options.populatedGroups) || [];
|
|
61
|
-
return (0, core_1.useDecorators)((0, schema_1.Property)(Object), (0, core_1.StoreMerge)(
|
|
62
|
-
type: mongoose_1.Schema.Types[(0, core_1.isObject)(options) ? options.type ||
|
|
61
|
+
return (0, core_1.useDecorators)((0, schema_1.Property)(Object), (0, core_1.StoreMerge)(constants_js_1.MONGOOSE_SCHEMA, {
|
|
62
|
+
type: mongoose_1.Schema.Types[(0, core_1.isObject)(options) ? options.type || MongooseSchemaTypes_js_1.MongooseSchemaTypes.OBJECT_ID : options],
|
|
63
63
|
ref: model
|
|
64
64
|
}), (0, json_mapper_1.OnDeserialize)((value) => {
|
|
65
65
|
if (isRef(value)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../src/decorators/ref.ts"],"names":[],"mappings":";;;AAAA,qCAAoH;AACpH,mDAAqF;AACrF,yCAAwG;AACxG,uCAAkD;AAClD,
|
|
1
|
+
{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../src/decorators/ref.ts"],"names":[],"mappings":";;;AAA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CAAC;SAC1B;QAED,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;QAEvB,OAAO,IAAA,uBAAS,EAAC,KAAK,EAAE,EAAC,GAAG,GAAG,EAAE,IAAI,EAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,EACF,IAAA,cAAK,EAAC,IAAA,eAAM,GAAE,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,WAAW,CAAC,sBAAsB,CAAC,EAAE,IAAA,gBAAO,EAAC,OAAO,CAAC,CAAC,EACzG,eAAe,CAAC,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,CACrC,CAAC;AACzB,CAAC;AA9CD,kBA8CC"}
|
|
@@ -4,20 +4,20 @@ exports.MongooseSchema = exports.Schema = void 0;
|
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
5
|
const di_1 = require("@tsed/di");
|
|
6
6
|
const schema_1 = require("@tsed/schema");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const constants_js_1 = require("../constants/constants.js");
|
|
8
|
+
const createSchema_js_1 = require("../utils/createSchema.js");
|
|
9
9
|
function Schema(options = {}) {
|
|
10
10
|
return (...parameters) => {
|
|
11
11
|
switch ((0, core_1.decoratorTypeOf)(parameters)) {
|
|
12
12
|
case "property":
|
|
13
|
-
return (0, core_1.useDecorators)((0, schema_1.Property)(), (0, core_1.StoreMerge)(
|
|
13
|
+
return (0, core_1.useDecorators)((0, schema_1.Property)(), (0, core_1.StoreMerge)(constants_js_1.MONGOOSE_SCHEMA, options))(parameters[0], parameters[1], parameters[2]);
|
|
14
14
|
case "class":
|
|
15
|
-
const { token } = (0,
|
|
15
|
+
const { token } = (0, createSchema_js_1.getSchemaToken)(parameters[0], options);
|
|
16
16
|
(0, di_1.registerProvider)({
|
|
17
17
|
provide: token,
|
|
18
18
|
deps: [],
|
|
19
19
|
useFactory() {
|
|
20
|
-
return (0,
|
|
20
|
+
return (0, createSchema_js_1.getSchema)(parameters[0], options);
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/decorators/schema.ts"],"names":[],"mappings":";;;AAAA,qCAAsE;AACtE,iCAA0C;AAC1C,yCAAsC;AAEtC,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/decorators/schema.ts"],"names":[],"mappings":";;;AAAA,qCAAsE;AACtE,iCAA0C;AAC1C,yCAAsC;AAEtC,4DAA0D;AAE1D,8DAAmE;AA4BnE,SAAgB,MAAM,CAAC,UAA0D,EAAE;IACjF,OAAO,CAAC,GAAG,UAAiB,EAAE,EAAE;QAC9B,QAAQ,IAAA,sBAAe,EAAC,UAAU,CAAC,EAAE;YACnC,KAAK,UAAU;gBACb,OAAO,IAAA,oBAAa,EAAC,IAAA,iBAAQ,GAAE,EAAE,IAAA,iBAAU,EAAC,8BAAe,EAAE,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YAEtH,KAAK,OAAO;gBACV,MAAM,EAAC,KAAK,EAAC,GAAG,IAAA,gCAAc,EAAC,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;gBAEvD,IAAA,qBAAgB,EAAC;oBACf,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,EAAE;oBACR,UAAU;wBACR,OAAO,IAAA,2BAAS,EAAC,UAAU,CAAC,CAAC,CAAC,EAAE,OAAc,CAAC,CAAC;oBAClD,CAAC;iBACF,CAAC,CAAC;gBACH,MAAM;SACT;IACH,CAAC,CAAC;AACJ,CAAC;AAnBD,wBAmBC;AA4BD,SAAgB,cAAc,CAAC,UAA0D,EAAE;IACzF,OAAO,MAAM,CAAC,OAAc,CAAC,CAAC;AAChC,CAAC;AAFD,wCAEC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SchemaIgnore = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schema_js_1 = require("./schema.js");
|
|
5
5
|
/**
|
|
6
6
|
* Do not apply this property to schema (create virtual property)
|
|
7
7
|
*
|
|
@@ -21,7 +21,7 @@ const schema_1 = require("./schema");
|
|
|
21
21
|
* @class
|
|
22
22
|
*/
|
|
23
23
|
function SchemaIgnore() {
|
|
24
|
-
return (0,
|
|
24
|
+
return (0, schema_js_1.MongooseSchema)({ schemaIgnore: true });
|
|
25
25
|
}
|
|
26
26
|
exports.SchemaIgnore = SchemaIgnore;
|
|
27
27
|
//# sourceMappingURL=schemaIgnore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaIgnore.js","sourceRoot":"","sources":["../../../src/decorators/schemaIgnore.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"schemaIgnore.js","sourceRoot":"","sources":["../../../src/decorators/schemaIgnore.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAE3C;;;;;;;;;;;;;;;;;GAiBG;AAEH,SAAgB,YAAY;IAC1B,OAAO,IAAA,0BAAc,EAAC,EAAC,YAAY,EAAE,IAAI,EAAQ,CAAC,CAAC;AACrD,CAAC;AAFD,oCAEC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Select = void 0;
|
|
4
|
-
const
|
|
4
|
+
const schema_js_1 = require("./schema.js");
|
|
5
5
|
/**
|
|
6
6
|
* Tell Mongoose to set default select() behavior for this path.
|
|
7
7
|
*
|
|
@@ -22,7 +22,7 @@ const schema_1 = require("./schema");
|
|
|
22
22
|
* @property
|
|
23
23
|
*/
|
|
24
24
|
function Select(select = true) {
|
|
25
|
-
return (0,
|
|
25
|
+
return (0, schema_js_1.MongooseSchema)({ select });
|
|
26
26
|
}
|
|
27
27
|
exports.Select = Select;
|
|
28
28
|
//# sourceMappingURL=select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/decorators/select.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/decorators/select.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAE3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,MAAM,CAAC,SAAwB,IAAI;IACjD,OAAO,IAAA,0BAAc,EAAC,EAAC,MAAM,EAAC,CAAC,CAAC;AAClC,CAAC;AAFD,wBAEC"}
|