@anthor/mongoose-remove 1.43.0-alpha.0 → 1.65.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/CHANGELOG.md +27 -0
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.65.0](https://github.com/anthorteam/backend/compare/v1.65.0-alpha.2...v1.65.0) (2022-08-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @anthor/mongoose-remove
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.65.0-alpha.1](https://github.com/anthorteam/backend/compare/v1.65.0-alpha.0...v1.65.0-alpha.1) (2022-08-10)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* fix some eslint errors deprecated by previous version ([9f2df23](https://github.com/anthorteam/backend/commit/9f2df235429e878ae4ed894f0ad58bd25723fe30))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [1.43.0](https://github.com/anthorteam/backend/compare/v1.43.0-alpha.0...v1.43.0) (2022-05-12)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @anthor/mongoose-remove
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
# [1.43.0-alpha.0](https://github.com/anthorteam/backend/compare/v1.42.0-alpha.6...v1.43.0-alpha.0) (2022-05-12)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @anthor/mongoose-remove
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.softRemove = exports.setIsRemoved = exports.methodRestore = exports.staticRestore = exports.methodSoftRemoveWrap = exports.staticSoftRemoveWrap = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
|
-
|
|
5
|
+
const staticSoftRemoveWrap = originalStaticRemove => function staticSoftRemove(conditions) {
|
|
6
6
|
if ((conditions === null || conditions === void 0 ? void 0 : conditions.$softRemove) === false) {
|
|
7
7
|
return originalStaticRemove.call(this, conditions);
|
|
8
8
|
}
|
|
@@ -17,7 +17,8 @@ exports.staticSoftRemoveWrap = originalStaticRemove => function staticSoftRemove
|
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
|
-
exports.
|
|
20
|
+
exports.staticSoftRemoveWrap = staticSoftRemoveWrap;
|
|
21
|
+
const methodSoftRemoveWrap = originalMethodRemove => function methodSoftRemove(opts = {}) {
|
|
21
22
|
if ((opts === null || opts === void 0 ? void 0 : opts.softRemove) === false) {
|
|
22
23
|
return originalMethodRemove.call(this);
|
|
23
24
|
}
|
|
@@ -28,6 +29,7 @@ exports.methodSoftRemoveWrap = originalMethodRemove => function methodSoftRemove
|
|
|
28
29
|
this.removedAt = new Date();
|
|
29
30
|
return this.save();
|
|
30
31
|
};
|
|
32
|
+
exports.methodSoftRemoveWrap = methodSoftRemoveWrap;
|
|
31
33
|
function staticRestore(conditions) {
|
|
32
34
|
return this.update({ ...conditions, isRemoved: true }, { $set: { removedAt: null, isRemoved: false } });
|
|
33
35
|
}
|
|
@@ -52,12 +54,11 @@ function softRemove(schema) {
|
|
|
52
54
|
removedAt: { type: Date, index: true, default: null },
|
|
53
55
|
});
|
|
54
56
|
const originalStaticRemove = schema.statics.remove || mongoose_1.Model.remove;
|
|
55
|
-
schema.static('remove', exports.staticSoftRemoveWrap(originalStaticRemove));
|
|
57
|
+
schema.static('remove', (0, exports.staticSoftRemoveWrap)(originalStaticRemove));
|
|
56
58
|
schema.static('restore', staticRestore);
|
|
57
59
|
const originalMethodRemove = schema.methods.remove || mongoose_1.Model.prototype.remove;
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
59
60
|
// @ts-ignore
|
|
60
|
-
schema.method('remove', exports.methodSoftRemoveWrap(originalMethodRemove), { suppressWarning: true });
|
|
61
|
+
schema.method('remove', (0, exports.methodSoftRemoveWrap)(originalMethodRemove), { suppressWarning: true });
|
|
61
62
|
schema.method('restore', methodRestore);
|
|
62
63
|
schema.pre('count', setIsRemoved);
|
|
63
64
|
schema.pre('countDocuments', setIsRemoved);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAAyC;AAElC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,EAAE,CAAC,SAAS,gBAAgB,CAAC,UAAU;IAC9F,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,WAAW,MAAK,KAAK,EAAE;QACrC,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;KACpD;IAED,OAAO,IAAI,CAAC,UAAU,CACpB;QACE,GAAG,UAAU;QACb,WAAW,EAAE,SAAS;QACtB,SAAS,EAAE,KAAK;KACjB,EACD;QACE,IAAI,EAAE;YACJ,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB;KACF,CACF,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B;AAEK,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,EAAE,CAAC,SAAS,gBAAgB,CAAC,OAAY,EAAE;IAClG,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,MAAK,K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
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"jest-sonar-reporter": "^2.0.0",
|
|
23
23
|
"mongoose": "^5.9.18"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "5774f296fde49b7cfca9f62602e2a65c9d71721a"
|
|
26
26
|
}
|