@strapi/data-transfer 4.25.19 → 4.25.20

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 CHANGED
@@ -1913,6 +1913,7 @@ class LocalStrapiDestinationProvider {
1913
1913
  if (!this.strapi) {
1914
1914
  throw new ProviderInitializationError("Could not access local strapi");
1915
1915
  }
1916
+ this.strapi.db.lifecycles.disable();
1916
1917
  this.transaction = createTransaction(this.strapi);
1917
1918
  }
1918
1919
  // TODO: either move this to restore strategy, or restore strategy should given access to these instead of repeating the logic possibly in a different way
@@ -1937,6 +1938,8 @@ class LocalStrapiDestinationProvider {
1937
1938
  async close() {
1938
1939
  const { autoDestroy } = this.options;
1939
1940
  this.transaction?.end();
1941
+ assertValidStrapi(this.strapi);
1942
+ this.strapi.db.lifecycles.enable();
1940
1943
  if (autoDestroy === void 0 || autoDestroy === true) {
1941
1944
  await this.strapi?.destroy();
1942
1945
  }
@@ -2412,6 +2415,7 @@ class LocalStrapiSourceProvider {
2412
2415
  async bootstrap(diagnostics) {
2413
2416
  this.#diagnostics = diagnostics;
2414
2417
  this.strapi = await this.options.getStrapi();
2418
+ this.strapi.db.lifecycles.disable();
2415
2419
  }
2416
2420
  #reportInfo(message) {
2417
2421
  this.#diagnostics?.report({
@@ -2425,6 +2429,8 @@ class LocalStrapiSourceProvider {
2425
2429
  }
2426
2430
  async close() {
2427
2431
  const { autoDestroy } = this.options;
2432
+ assertValidStrapi(this.strapi);
2433
+ this.strapi.db.lifecycles.enable();
2428
2434
  if (autoDestroy === void 0 || autoDestroy === true) {
2429
2435
  await this.strapi?.destroy();
2430
2436
  }
@@ -3401,6 +3407,8 @@ const handleWSUpgrade = (wss, ctx, callback) => {
3401
3407
  return;
3402
3408
  }
3403
3409
  disableTimeouts();
3410
+ strapi.db.lifecycles.disable();
3411
+ strapi.log.info("[Data transfer] Disabling lifecycle hooks");
3404
3412
  wss.emit("connection", client, ctx.req);
3405
3413
  callback(client, request);
3406
3414
  });
@@ -3581,6 +3589,8 @@ const handlerControllerFactory = (implementation) => (options) => {
3581
3589
  cannotRespondHandler(err);
3582
3590
  } finally {
3583
3591
  resetTimeouts();
3592
+ strapi.db.lifecycles.enable();
3593
+ strapi.log.info("[Data transfer] Restoring lifecycle hooks");
3584
3594
  }
3585
3595
  });
3586
3596
  ws2.on("error", async (...args) => {