@strapi/database 5.8.0 → 5.9.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/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -1
- package/dist/lifecycles/index.d.ts +2 -0
- package/dist/lifecycles/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -6784,6 +6784,7 @@ const createLifecyclesProvider = (db) => {
|
|
|
6784
6784
|
timestampsLifecyclesSubscriber,
|
|
6785
6785
|
modelsLifecyclesSubscriber
|
|
6786
6786
|
];
|
|
6787
|
+
let isLifecycleHooksDisabled = false;
|
|
6787
6788
|
return {
|
|
6788
6789
|
subscribe(subscriber) {
|
|
6789
6790
|
strict(
|
|
@@ -6796,6 +6797,12 @@ const createLifecyclesProvider = (db) => {
|
|
|
6796
6797
|
clear() {
|
|
6797
6798
|
subscribers = [];
|
|
6798
6799
|
},
|
|
6800
|
+
disable() {
|
|
6801
|
+
isLifecycleHooksDisabled = true;
|
|
6802
|
+
},
|
|
6803
|
+
enable() {
|
|
6804
|
+
isLifecycleHooksDisabled = false;
|
|
6805
|
+
},
|
|
6799
6806
|
createEvent(action, uid, properties, state) {
|
|
6800
6807
|
const model = db.metadata.get(uid);
|
|
6801
6808
|
return {
|
|
@@ -6812,6 +6819,7 @@ const createLifecyclesProvider = (db) => {
|
|
|
6812
6819
|
* @param {Map<any, any>} states
|
|
6813
6820
|
*/
|
|
6814
6821
|
async run(action, uid, properties, states = /* @__PURE__ */ new Map()) {
|
|
6822
|
+
if (isLifecycleHooksDisabled) return states;
|
|
6815
6823
|
for (let i = 0; i < subscribers.length; i += 1) {
|
|
6816
6824
|
const subscriber = subscribers[i];
|
|
6817
6825
|
if (typeof subscriber === "function") {
|