@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.js
CHANGED
|
@@ -6816,6 +6816,7 @@ const createLifecyclesProvider = (db) => {
|
|
|
6816
6816
|
timestampsLifecyclesSubscriber,
|
|
6817
6817
|
modelsLifecyclesSubscriber
|
|
6818
6818
|
];
|
|
6819
|
+
let isLifecycleHooksDisabled = false;
|
|
6819
6820
|
return {
|
|
6820
6821
|
subscribe(subscriber) {
|
|
6821
6822
|
assert.strict(
|
|
@@ -6828,6 +6829,12 @@ const createLifecyclesProvider = (db) => {
|
|
|
6828
6829
|
clear() {
|
|
6829
6830
|
subscribers = [];
|
|
6830
6831
|
},
|
|
6832
|
+
disable() {
|
|
6833
|
+
isLifecycleHooksDisabled = true;
|
|
6834
|
+
},
|
|
6835
|
+
enable() {
|
|
6836
|
+
isLifecycleHooksDisabled = false;
|
|
6837
|
+
},
|
|
6831
6838
|
createEvent(action, uid, properties, state) {
|
|
6832
6839
|
const model = db.metadata.get(uid);
|
|
6833
6840
|
return {
|
|
@@ -6844,6 +6851,7 @@ const createLifecyclesProvider = (db) => {
|
|
|
6844
6851
|
* @param {Map<any, any>} states
|
|
6845
6852
|
*/
|
|
6846
6853
|
async run(action, uid, properties, states = /* @__PURE__ */ new Map()) {
|
|
6854
|
+
if (isLifecycleHooksDisabled) return states;
|
|
6847
6855
|
for (let i = 0; i < subscribers.length; i += 1) {
|
|
6848
6856
|
const subscriber = subscribers[i];
|
|
6849
6857
|
if (typeof subscriber === "function") {
|