@strapi/data-transfer 4.25.19 → 4.25.21

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
@@ -1880,6 +1880,7 @@ class LocalStrapiDestinationProvider {
1880
1880
  if (!this.strapi) {
1881
1881
  throw new ProviderInitializationError("Could not access local strapi");
1882
1882
  }
1883
+ this.strapi.db.lifecycles.disable();
1883
1884
  this.transaction = createTransaction(this.strapi);
1884
1885
  }
1885
1886
  // 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
@@ -1904,6 +1905,8 @@ class LocalStrapiDestinationProvider {
1904
1905
  async close() {
1905
1906
  const { autoDestroy } = this.options;
1906
1907
  this.transaction?.end();
1908
+ assertValidStrapi(this.strapi);
1909
+ this.strapi.db.lifecycles.enable();
1907
1910
  if (autoDestroy === void 0 || autoDestroy === true) {
1908
1911
  await this.strapi?.destroy();
1909
1912
  }
@@ -2379,6 +2382,7 @@ class LocalStrapiSourceProvider {
2379
2382
  async bootstrap(diagnostics) {
2380
2383
  this.#diagnostics = diagnostics;
2381
2384
  this.strapi = await this.options.getStrapi();
2385
+ this.strapi.db.lifecycles.disable();
2382
2386
  }
2383
2387
  #reportInfo(message) {
2384
2388
  this.#diagnostics?.report({
@@ -2392,6 +2396,8 @@ class LocalStrapiSourceProvider {
2392
2396
  }
2393
2397
  async close() {
2394
2398
  const { autoDestroy } = this.options;
2399
+ assertValidStrapi(this.strapi);
2400
+ this.strapi.db.lifecycles.enable();
2395
2401
  if (autoDestroy === void 0 || autoDestroy === true) {
2396
2402
  await this.strapi?.destroy();
2397
2403
  }
@@ -3368,6 +3374,8 @@ const handleWSUpgrade = (wss, ctx, callback) => {
3368
3374
  return;
3369
3375
  }
3370
3376
  disableTimeouts();
3377
+ strapi.db.lifecycles.disable();
3378
+ strapi.log.info("[Data transfer] Disabling lifecycle hooks");
3371
3379
  wss.emit("connection", client, ctx.req);
3372
3380
  callback(client, request);
3373
3381
  });
@@ -3548,6 +3556,8 @@ const handlerControllerFactory = (implementation) => (options) => {
3548
3556
  cannotRespondHandler(err);
3549
3557
  } finally {
3550
3558
  resetTimeouts();
3559
+ strapi.db.lifecycles.enable();
3560
+ strapi.log.info("[Data transfer] Restoring lifecycle hooks");
3551
3561
  }
3552
3562
  });
3553
3563
  ws.on("error", async (...args) => {