@strapi/data-transfer 5.10.3 → 5.10.4

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
@@ -2845,7 +2845,11 @@ function _class_private_field_loose_key$4(name) {
2845
2845
  const createLocalStrapiSourceProvider = (options)=>{
2846
2846
  return new LocalStrapiSourceProvider(options);
2847
2847
  };
2848
- var _diagnostics$4 = /*#__PURE__*/ _class_private_field_loose_key$4("_diagnostics"), _reportInfo$4 = /*#__PURE__*/ _class_private_field_loose_key$4("_reportInfo");
2848
+ var _diagnostics$4 = /*#__PURE__*/ _class_private_field_loose_key$4("_diagnostics"), _reportInfo$4 = /*#__PURE__*/ _class_private_field_loose_key$4("_reportInfo"), /**
2849
+ * Reports an error to the diagnostic reporter.
2850
+ */ _reportError = /*#__PURE__*/ _class_private_field_loose_key$4("_reportError"), /**
2851
+ * Handles errors that occur in read streams.
2852
+ */ _handleStreamError = /*#__PURE__*/ _class_private_field_loose_key$4("_handleStreamError");
2849
2853
  class LocalStrapiSourceProvider {
2850
2854
  async bootstrap(diagnostics) {
2851
2855
  _class_private_field_loose_base$4(this, _diagnostics$4)[_diagnostics$4] = diagnostics;
@@ -2907,12 +2911,22 @@ class LocalStrapiSourceProvider {
2907
2911
  createAssetsReadStream() {
2908
2912
  assertValidStrapi(this.strapi, 'Not able to stream assets');
2909
2913
  _class_private_field_loose_base$4(this, _reportInfo$4)[_reportInfo$4]('creating assets read stream');
2910
- return createAssetsStream(this.strapi);
2914
+ const stream = createAssetsStream(this.strapi);
2915
+ stream.on('error', (err)=>{
2916
+ _class_private_field_loose_base$4(this, _handleStreamError)[_handleStreamError]('assets', err);
2917
+ });
2918
+ return stream;
2911
2919
  }
2912
2920
  constructor(options){
2913
2921
  Object.defineProperty(this, _reportInfo$4, {
2914
2922
  value: reportInfo$4
2915
2923
  });
2924
+ Object.defineProperty(this, _reportError, {
2925
+ value: reportError
2926
+ });
2927
+ Object.defineProperty(this, _handleStreamError, {
2928
+ value: handleStreamError
2929
+ });
2916
2930
  Object.defineProperty(this, _diagnostics$4, {
2917
2931
  writable: true,
2918
2932
  value: void 0
@@ -2932,6 +2946,29 @@ function reportInfo$4(message) {
2932
2946
  kind: 'info'
2933
2947
  });
2934
2948
  }
2949
+ function reportError(message, error) {
2950
+ _class_private_field_loose_base$4(this, _diagnostics$4)[_diagnostics$4]?.report({
2951
+ details: {
2952
+ createdAt: new Date(),
2953
+ message,
2954
+ error,
2955
+ severity: 'fatal',
2956
+ name: error.name
2957
+ },
2958
+ kind: 'error'
2959
+ });
2960
+ }
2961
+ function handleStreamError(streamType, err) {
2962
+ const { message, stack } = err;
2963
+ const errorMessage = `Error in ${streamType} read stream: ${message}`;
2964
+ const formattedError = {
2965
+ message: errorMessage,
2966
+ stack,
2967
+ timestamp: new Date().toISOString()
2968
+ };
2969
+ this.strapi?.log.error(formattedError);
2970
+ _class_private_field_loose_base$4(this, _reportError)[_reportError](formattedError.message, err);
2971
+ }
2935
2972
 
2936
2973
  const createDispatcher = (ws, retryMessageOptions = {
2937
2974
  retryMessageMaxRetries: 5,