@strapi/data-transfer 5.8.0 → 5.8.1

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.mjs CHANGED
@@ -1896,6 +1896,7 @@ class LocalStrapiDestinationProvider {
1896
1896
  if (!this.strapi) {
1897
1897
  throw new ProviderInitializationError("Could not access local strapi");
1898
1898
  }
1899
+ this.strapi.db.lifecycles.disable();
1899
1900
  this.transaction = createTransaction(this.strapi);
1900
1901
  }
1901
1902
  // 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
@@ -1919,7 +1920,9 @@ class LocalStrapiDestinationProvider {
1919
1920
  }
1920
1921
  async close() {
1921
1922
  const { autoDestroy } = this.options;
1923
+ assertValidStrapi(this.strapi);
1922
1924
  this.transaction?.end();
1925
+ this.strapi.db.lifecycles.enable();
1923
1926
  if (autoDestroy === void 0 || autoDestroy === true) {
1924
1927
  await this.strapi?.destroy();
1925
1928
  }
@@ -2376,6 +2379,7 @@ class LocalStrapiSourceProvider {
2376
2379
  async bootstrap(diagnostics) {
2377
2380
  this.#diagnostics = diagnostics;
2378
2381
  this.strapi = await this.options.getStrapi();
2382
+ this.strapi.db.lifecycles.disable();
2379
2383
  }
2380
2384
  #reportInfo(message) {
2381
2385
  this.#diagnostics?.report({
@@ -2389,6 +2393,8 @@ class LocalStrapiSourceProvider {
2389
2393
  }
2390
2394
  async close() {
2391
2395
  const { autoDestroy } = this.options;
2396
+ assertValidStrapi(this.strapi);
2397
+ this.strapi.db.lifecycles.enable();
2392
2398
  if (autoDestroy === void 0 || autoDestroy === true) {
2393
2399
  await this.strapi?.destroy();
2394
2400
  }
@@ -3393,6 +3399,8 @@ const handleWSUpgrade = (wss, ctx, callback) => {
3393
3399
  return;
3394
3400
  }
3395
3401
  disableTimeouts();
3402
+ strapi.db.lifecycles.disable();
3403
+ strapi.log.info("[Data transfer] Disabling lifecycle hooks");
3396
3404
  wss.emit("connection", client, ctx.req);
3397
3405
  callback(client, request);
3398
3406
  });
@@ -3573,6 +3581,8 @@ const handlerControllerFactory = (implementation) => (options) => {
3573
3581
  cannotRespondHandler(err);
3574
3582
  } finally {
3575
3583
  resetTimeouts();
3584
+ strapi.db.lifecycles.enable();
3585
+ strapi.log.info("[Data transfer] Restoring lifecycle hooks");
3576
3586
  }
3577
3587
  });
3578
3588
  ws.on("error", async (...args) => {