@strapi/data-transfer 5.7.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.js CHANGED
@@ -1923,6 +1923,7 @@ class LocalStrapiDestinationProvider {
1923
1923
  if (!this.strapi) {
1924
1924
  throw new ProviderInitializationError("Could not access local strapi");
1925
1925
  }
1926
+ this.strapi.db.lifecycles.disable();
1926
1927
  this.transaction = createTransaction(this.strapi);
1927
1928
  }
1928
1929
  // 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
@@ -1946,7 +1947,9 @@ class LocalStrapiDestinationProvider {
1946
1947
  }
1947
1948
  async close() {
1948
1949
  const { autoDestroy } = this.options;
1950
+ assertValidStrapi(this.strapi);
1949
1951
  this.transaction?.end();
1952
+ this.strapi.db.lifecycles.enable();
1950
1953
  if (autoDestroy === void 0 || autoDestroy === true) {
1951
1954
  await this.strapi?.destroy();
1952
1955
  }
@@ -2403,6 +2406,7 @@ class LocalStrapiSourceProvider {
2403
2406
  async bootstrap(diagnostics) {
2404
2407
  this.#diagnostics = diagnostics;
2405
2408
  this.strapi = await this.options.getStrapi();
2409
+ this.strapi.db.lifecycles.disable();
2406
2410
  }
2407
2411
  #reportInfo(message) {
2408
2412
  this.#diagnostics?.report({
@@ -2416,6 +2420,8 @@ class LocalStrapiSourceProvider {
2416
2420
  }
2417
2421
  async close() {
2418
2422
  const { autoDestroy } = this.options;
2423
+ assertValidStrapi(this.strapi);
2424
+ this.strapi.db.lifecycles.enable();
2419
2425
  if (autoDestroy === void 0 || autoDestroy === true) {
2420
2426
  await this.strapi?.destroy();
2421
2427
  }
@@ -3420,6 +3426,8 @@ const handleWSUpgrade = (wss, ctx, callback) => {
3420
3426
  return;
3421
3427
  }
3422
3428
  disableTimeouts();
3429
+ strapi.db.lifecycles.disable();
3430
+ strapi.log.info("[Data transfer] Disabling lifecycle hooks");
3423
3431
  wss.emit("connection", client, ctx.req);
3424
3432
  callback(client, request);
3425
3433
  });
@@ -3600,6 +3608,8 @@ const handlerControllerFactory = (implementation) => (options) => {
3600
3608
  cannotRespondHandler(err);
3601
3609
  } finally {
3602
3610
  resetTimeouts();
3611
+ strapi.db.lifecycles.enable();
3612
+ strapi.log.info("[Data transfer] Restoring lifecycle hooks");
3603
3613
  }
3604
3614
  });
3605
3615
  ws2.on("error", async (...args) => {