@strapi/data-transfer 5.48.1 → 5.50.0

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.
Files changed (139) hide show
  1. package/dist/directory/providers/destination/index.d.ts +0 -2
  2. package/dist/directory/providers/destination/index.d.ts.map +1 -1
  3. package/dist/directory/providers/destination/index.js +16 -11
  4. package/dist/directory/providers/destination/index.js.map +1 -1
  5. package/dist/directory/providers/destination/utils.d.ts +0 -1
  6. package/dist/directory/providers/destination/utils.d.ts.map +1 -1
  7. package/dist/directory/providers/destination/utils.js +6 -2
  8. package/dist/directory/providers/destination/utils.js.map +1 -1
  9. package/dist/directory/providers/source/index.d.ts +0 -1
  10. package/dist/directory/providers/source/index.d.ts.map +1 -1
  11. package/dist/directory/providers/source/index.js +25 -20
  12. package/dist/directory/providers/source/index.js.map +1 -1
  13. package/dist/engine/index.d.ts +0 -1
  14. package/dist/engine/index.d.ts.map +1 -1
  15. package/dist/engine/validation/provider.d.ts +1 -1
  16. package/dist/engine/validation/provider.d.ts.map +1 -1
  17. package/dist/engine/validation/schemas/index.d.ts.map +1 -1
  18. package/dist/file/providers/destination/index.d.ts +0 -3
  19. package/dist/file/providers/destination/index.d.ts.map +1 -1
  20. package/dist/file/providers/destination/index.js +10 -4
  21. package/dist/file/providers/destination/index.js.map +1 -1
  22. package/dist/file/providers/destination/utils.d.ts +0 -1
  23. package/dist/file/providers/destination/utils.d.ts.map +1 -1
  24. package/dist/file/providers/source/index.d.ts +0 -1
  25. package/dist/file/providers/source/index.d.ts.map +1 -1
  26. package/dist/file/providers/source/index.js +9 -3
  27. package/dist/file/providers/source/index.js.map +1 -1
  28. package/dist/file/providers/source/utils.d.ts.map +1 -1
  29. package/dist/file/providers/source/utils.js +10 -6
  30. package/dist/file/providers/source/utils.js.map +1 -1
  31. package/dist/strapi/providers/local-destination/assets-destination-writable.d.ts +0 -1
  32. package/dist/strapi/providers/local-destination/assets-destination-writable.d.ts.map +1 -1
  33. package/dist/strapi/providers/local-destination/index.d.ts +0 -1
  34. package/dist/strapi/providers/local-destination/index.d.ts.map +1 -1
  35. package/dist/strapi/providers/local-destination/index.js +11 -7
  36. package/dist/strapi/providers/local-destination/index.js.map +1 -1
  37. package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts +0 -1
  38. package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts.map +1 -1
  39. package/dist/strapi/providers/local-destination/strategies/restore/configuration.js +9 -3
  40. package/dist/strapi/providers/local-destination/strategies/restore/configuration.js.map +1 -1
  41. package/dist/strapi/providers/local-destination/strategies/restore/configuration.mjs +4 -2
  42. package/dist/strapi/providers/local-destination/strategies/restore/configuration.mjs.map +1 -1
  43. package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts +0 -1
  44. package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts.map +1 -1
  45. package/dist/strapi/providers/local-destination/strategies/restore/index.d.ts.map +1 -1
  46. package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts +0 -1
  47. package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts.map +1 -1
  48. package/dist/strapi/providers/local-destination/strategies/restore/links.js +3 -2
  49. package/dist/strapi/providers/local-destination/strategies/restore/links.js.map +1 -1
  50. package/dist/strapi/providers/local-destination/strategies/restore/links.mjs +3 -2
  51. package/dist/strapi/providers/local-destination/strategies/restore/links.mjs.map +1 -1
  52. package/dist/strapi/providers/local-destination/strategies/restore/resolve-link-ref.d.ts +10 -0
  53. package/dist/strapi/providers/local-destination/strategies/restore/resolve-link-ref.d.ts.map +1 -0
  54. package/dist/strapi/providers/local-destination/strategies/restore/resolve-link-ref.js +35 -0
  55. package/dist/strapi/providers/local-destination/strategies/restore/resolve-link-ref.js.map +1 -0
  56. package/dist/strapi/providers/local-destination/strategies/restore/resolve-link-ref.mjs +32 -0
  57. package/dist/strapi/providers/local-destination/strategies/restore/resolve-link-ref.mjs.map +1 -0
  58. package/dist/strapi/providers/local-source/assets.d.ts +0 -1
  59. package/dist/strapi/providers/local-source/assets.d.ts.map +1 -1
  60. package/dist/strapi/providers/local-source/configuration.d.ts +0 -1
  61. package/dist/strapi/providers/local-source/configuration.d.ts.map +1 -1
  62. package/dist/strapi/providers/local-source/configuration.js +8 -0
  63. package/dist/strapi/providers/local-source/configuration.js.map +1 -1
  64. package/dist/strapi/providers/local-source/configuration.mjs +8 -0
  65. package/dist/strapi/providers/local-source/configuration.mjs.map +1 -1
  66. package/dist/strapi/providers/local-source/entities.d.ts +0 -1
  67. package/dist/strapi/providers/local-source/entities.d.ts.map +1 -1
  68. package/dist/strapi/providers/local-source/index.d.ts +0 -1
  69. package/dist/strapi/providers/local-source/index.d.ts.map +1 -1
  70. package/dist/strapi/providers/local-source/links.d.ts +0 -1
  71. package/dist/strapi/providers/local-source/links.d.ts.map +1 -1
  72. package/dist/strapi/providers/remote-destination/index.d.ts +0 -1
  73. package/dist/strapi/providers/remote-destination/index.d.ts.map +1 -1
  74. package/dist/strapi/providers/remote-source/index.d.ts +0 -1
  75. package/dist/strapi/providers/remote-source/index.d.ts.map +1 -1
  76. package/dist/strapi/providers/utils.d.ts +9 -9
  77. package/dist/strapi/providers/utils.d.ts.map +1 -1
  78. package/dist/strapi/queries/entity.d.ts.map +1 -1
  79. package/dist/strapi/queries/link.d.ts.map +1 -1
  80. package/dist/strapi/remote/constants.d.ts.map +1 -1
  81. package/dist/strapi/remote/flows/default.d.ts.map +1 -1
  82. package/dist/strapi/remote/flows/index.d.ts.map +1 -1
  83. package/dist/strapi/remote/handlers/abstract.d.ts +0 -2
  84. package/dist/strapi/remote/handlers/abstract.d.ts.map +1 -1
  85. package/dist/strapi/remote/handlers/pull.d.ts +0 -2
  86. package/dist/strapi/remote/handlers/pull.d.ts.map +1 -1
  87. package/dist/strapi/remote/handlers/push.d.ts +0 -3
  88. package/dist/strapi/remote/handlers/push.d.ts.map +1 -1
  89. package/dist/strapi/remote/handlers/push.js +1 -0
  90. package/dist/strapi/remote/handlers/push.js.map +1 -1
  91. package/dist/strapi/remote/handlers/push.mjs +1 -0
  92. package/dist/strapi/remote/handlers/push.mjs.map +1 -1
  93. package/dist/strapi/remote/handlers/utils.d.ts +0 -1
  94. package/dist/strapi/remote/handlers/utils.d.ts.map +1 -1
  95. package/dist/strapi/utils/project-settings-logos.d.ts +29 -0
  96. package/dist/strapi/utils/project-settings-logos.d.ts.map +1 -0
  97. package/dist/strapi/utils/project-settings-logos.js +174 -0
  98. package/dist/strapi/utils/project-settings-logos.js.map +1 -0
  99. package/dist/strapi/utils/project-settings-logos.mjs +169 -0
  100. package/dist/strapi/utils/project-settings-logos.mjs.map +1 -0
  101. package/dist/types/common-entities.d.ts +4 -7
  102. package/dist/types/common-entities.d.ts.map +1 -1
  103. package/dist/types/encryption.d.ts +4 -2
  104. package/dist/types/encryption.d.ts.map +1 -1
  105. package/dist/types/providers.d.ts +0 -1
  106. package/dist/types/providers.d.ts.map +1 -1
  107. package/dist/types/remote/protocol/client/transfer/utils.d.ts +0 -2
  108. package/dist/types/remote/protocol/client/transfer/utils.d.ts.map +1 -1
  109. package/dist/types/remote/protocol/server/error.d.ts +8 -8
  110. package/dist/types/remote/protocol/server/error.d.ts.map +1 -1
  111. package/dist/types/transfer-engine.d.ts +0 -1
  112. package/dist/types/transfer-engine.d.ts.map +1 -1
  113. package/dist/types/utils.d.ts +0 -1
  114. package/dist/types/utils.d.ts.map +1 -1
  115. package/dist/utils/components.d.ts +2 -2
  116. package/dist/utils/components.d.ts.map +1 -1
  117. package/dist/utils/components.js +10 -6
  118. package/dist/utils/components.js.map +1 -1
  119. package/dist/utils/diagnostic.d.ts.map +1 -1
  120. package/dist/utils/encryption/decrypt.d.ts +3 -2
  121. package/dist/utils/encryption/decrypt.d.ts.map +1 -1
  122. package/dist/utils/encryption/decrypt.js.map +1 -1
  123. package/dist/utils/encryption/decrypt.mjs.map +1 -1
  124. package/dist/utils/encryption/encrypt.d.ts +3 -2
  125. package/dist/utils/encryption/encrypt.d.ts.map +1 -1
  126. package/dist/utils/encryption/encrypt.js.map +1 -1
  127. package/dist/utils/encryption/encrypt.mjs.map +1 -1
  128. package/dist/utils/json.d.ts.map +1 -1
  129. package/dist/utils/middleware.d.ts.map +1 -1
  130. package/dist/utils/schema.d.ts.map +1 -1
  131. package/dist/utils/stream.d.ts +0 -1
  132. package/dist/utils/stream.d.ts.map +1 -1
  133. package/dist/utils/transaction.d.ts.map +1 -1
  134. package/dist/utils/transfer-asset-chunk.d.ts +0 -2
  135. package/dist/utils/transfer-asset-chunk.d.ts.map +1 -1
  136. package/dist/utils/transfer-websocket-json.d.ts.map +1 -1
  137. package/dist/utils/writable-async-write.d.ts +0 -1
  138. package/dist/utils/writable-async-write.d.ts.map +1 -1
  139. package/package.json +15 -9
@@ -4,16 +4,22 @@ var stream = require('stream');
4
4
  var fp = require('lodash/fp');
5
5
  var chalk = require('chalk');
6
6
  var providers = require('../../../../../errors/providers.js');
7
+ var projectSettingsLogos = require('../../../../utils/project-settings-logos.js');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
7
12
 
8
13
  const omitInvalidCreationAttributes = fp.omit([
9
14
  'id'
10
15
  ]);
11
16
  const restoreCoreStore = async (strapi, values)=>{
12
17
  const data = omitInvalidCreationAttributes(values);
18
+ const row = await projectSettingsLogos.restoreProjectSettingsRow(strapi, data);
13
19
  return strapi.db.query('strapi::core-store').create({
14
20
  data: {
15
- ...data,
16
- value: JSON.stringify(data.value)
21
+ ...row,
22
+ value: JSON.stringify(row.value)
17
23
  }
18
24
  });
19
25
  };
@@ -39,7 +45,7 @@ const createConfigurationWriteStream = async (strapi, transaction)=>{
39
45
  try {
40
46
  await restoreConfigs(strapi, config);
41
47
  } catch (error) {
42
- return callback(new providers.ProviderTransferError(`Failed to import ${chalk.yellowBright(config.type)} (${chalk.greenBright(config.value.id)}`));
48
+ return callback(new providers.ProviderTransferError(`Failed to import ${chalk__default.default.yellowBright(config.type)} (${chalk__default.default.greenBright(config.value.id)}`));
43
49
  }
44
50
  callback();
45
51
  });
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.js","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/configuration.ts"],"sourcesContent":["import { Writable } from 'stream';\nimport { omit } from 'lodash/fp';\nimport chalk from 'chalk';\nimport type { Core } from '@strapi/types';\nimport { ProviderTransferError } from '../../../../../errors/providers';\nimport { IConfiguration, Transaction } from '../../../../../types';\n\nconst omitInvalidCreationAttributes = omit(['id']);\n\nconst restoreCoreStore = async <T extends { value: unknown }>(strapi: Core.Strapi, values: T) => {\n const data = omitInvalidCreationAttributes(values);\n return strapi.db.query('strapi::core-store').create({\n data: {\n ...data,\n value: JSON.stringify(data.value),\n },\n });\n};\n\nconst restoreWebhooks = async <T extends { value: unknown }>(strapi: Core.Strapi, values: T) => {\n const data = omitInvalidCreationAttributes(values);\n return strapi.db.query('strapi::webhook').create({ data });\n};\n\nexport const restoreConfigs = async (strapi: Core.Strapi, config: IConfiguration) => {\n if (config.type === 'core-store') {\n return restoreCoreStore(strapi, config.value as { value: unknown });\n }\n\n if (config.type === 'webhook') {\n return restoreWebhooks(strapi, config.value as { value: unknown });\n }\n};\n\nexport const createConfigurationWriteStream = async (\n strapi: Core.Strapi,\n transaction?: Transaction\n) => {\n return new Writable({\n objectMode: true,\n async write<T extends { id: number }>(\n config: IConfiguration<T>,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ) {\n await transaction?.attach(async () => {\n try {\n await restoreConfigs(strapi, config);\n } catch (error) {\n return callback(\n new ProviderTransferError(\n `Failed to import ${chalk.yellowBright(config.type)} (${chalk.greenBright(\n config.value.id\n )}`\n )\n );\n }\n callback();\n });\n },\n });\n};\n"],"names":["omitInvalidCreationAttributes","omit","restoreCoreStore","strapi","values","data","db","query","create","value","JSON","stringify","restoreWebhooks","restoreConfigs","config","type","createConfigurationWriteStream","transaction","Writable","objectMode","write","_encoding","callback","attach","error","Provi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AAAA,CACJN,MAAyB,EACzBO,SAAyB,EACzBC,QAAwC,EAAA;AAExC,YAAA,MAAML,aAAaM,MAAAA,CAAO,UAAA;gBACxB,IAAI;AACF,oBAAA,MAAMV,eAAeV,MAAAA,EAAQW,MAAAA,CAAAA;AAC/B,gBAAA,CAAA,CAAE,OAAOU,KAAAA,EAAO;oBACd,OAAOF,QAAAA,CACL,IAAIG,+BAAAA,CACF,CAAC,iBAAiB,EAAEC,KAAAA,CAAMC,YAAY,CAACb,MAAAA,CAAOC,IAAI,CAAA,CAAE,EAAE,EAAEW,KAAAA,CAAME,WAAW,CACvEd,MAAAA,CAAOL,KAAK,CAACoB,EAAE,CAAA,CAAA,CACd,CAAA,CAAA;AAGT,gBAAA;AACAP,gBAAAA,QAAAA,EAAAA;AACF,YAAA,CAAA,CAAA;AACF,QAAA;AACF,KAAA,CAAA;AACF;;;;;"}
1
+ {"version":3,"file":"configuration.js","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/configuration.ts"],"sourcesContent":["import { Writable } from 'stream';\nimport { omit } from 'lodash/fp';\nimport chalk from 'chalk';\nimport type { Core } from '@strapi/types';\nimport { ProviderTransferError } from '../../../../../errors/providers';\nimport { IConfiguration, Transaction } from '../../../../../types';\nimport { restoreProjectSettingsRow } from '../../../../utils/project-settings-logos';\n\nconst omitInvalidCreationAttributes = omit(['id']);\n\nconst restoreCoreStore = async <T extends { value: unknown }>(strapi: Core.Strapi, values: T) => {\n const data = omitInvalidCreationAttributes(values);\n const row = await restoreProjectSettingsRow(\n strapi,\n data as unknown as { key: string; value: unknown }\n );\n\n return strapi.db.query('strapi::core-store').create({\n data: {\n ...row,\n value: JSON.stringify(row.value),\n },\n });\n};\n\nconst restoreWebhooks = async <T extends { value: unknown }>(strapi: Core.Strapi, values: T) => {\n const data = omitInvalidCreationAttributes(values);\n return strapi.db.query('strapi::webhook').create({ data });\n};\n\nexport const restoreConfigs = async (strapi: Core.Strapi, config: IConfiguration) => {\n if (config.type === 'core-store') {\n return restoreCoreStore(strapi, config.value as { value: unknown });\n }\n\n if (config.type === 'webhook') {\n return restoreWebhooks(strapi, config.value as { value: unknown });\n }\n};\n\nexport const createConfigurationWriteStream = async (\n strapi: Core.Strapi,\n transaction?: Transaction\n) => {\n return new Writable({\n objectMode: true,\n async write<T extends { id: number }>(\n config: IConfiguration<T>,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ) {\n await transaction?.attach(async () => {\n try {\n await restoreConfigs(strapi, config);\n } catch (error) {\n return callback(\n new ProviderTransferError(\n `Failed to import ${chalk.yellowBright(config.type)} (${chalk.greenBright(\n config.value.id\n )}`\n )\n );\n }\n callback();\n });\n },\n });\n};\n"],"names":["omitInvalidCreationAttributes","omit","restoreCoreStore","strapi","values","data","row","restoreProjectSettingsRow","db","query","create","value","JSON","stringify","restoreWebhooks","restoreConfigs","config","type","createConfigurationWriteStream","transaction","Writable","objectMode","write","_encoding","callback","attach","error","ProviderTransferError","chalk","yellowBright","greenBright","id"],"mappings":";;;;;;;;;;;;AAQA,MAAMA,gCAAgCC,OAAAA,CAAK;AAAC,IAAA;AAAK,CAAA,CAAA;AAEjD,MAAMC,gBAAAA,GAAmB,OAAqCC,MAAAA,EAAqBC,MAAAA,GAAAA;AACjF,IAAA,MAAMC,OAAOL,6BAAAA,CAA8BI,MAAAA,CAAAA;IAC3C,MAAME,GAAAA,GAAM,MAAMC,8CAAAA,CAChBJ,MAAAA,EACAE,IAAAA,CAAAA;AAGF,IAAA,OAAOF,OAAOK,EAAE,CAACC,KAAK,CAAC,oBAAA,CAAA,CAAsBC,MAAM,CAAC;QAClDL,IAAAA,EAAM;AACJ,YAAA,GAAGC,GAAG;AACNK,YAAAA,KAAAA,EAAOC,IAAAA,CAAKC,SAAS,CAACP,GAAAA,CAAIK,KAAK;AACjC;AACF,KAAA,CAAA;AACF,CAAA;AAEA,MAAMG,eAAAA,GAAkB,OAAqCX,MAAAA,EAAqBC,MAAAA,GAAAA;AAChF,IAAA,MAAMC,O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 +2,18 @@ import { Writable } from 'stream';
2
2
  import { omit } from 'lodash/fp';
3
3
  import chalk from 'chalk';
4
4
  import { ProviderTransferError } from '../../../../../errors/providers.mjs';
5
+ import { restoreProjectSettingsRow } from '../../../../utils/project-settings-logos.mjs';
5
6
 
6
7
  const omitInvalidCreationAttributes = omit([
7
8
  'id'
8
9
  ]);
9
10
  const restoreCoreStore = async (strapi, values)=>{
10
11
  const data = omitInvalidCreationAttributes(values);
12
+ const row = await restoreProjectSettingsRow(strapi, data);
11
13
  return strapi.db.query('strapi::core-store').create({
12
14
  data: {
13
- ...data,
14
- value: JSON.stringify(data.value)
15
+ ...row,
16
+ value: JSON.stringify(row.value)
15
17
  }
16
18
  });
17
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.mjs","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/configuration.ts"],"sourcesContent":["import { Writable } from 'stream';\nimport { omit } from 'lodash/fp';\nimport chalk from 'chalk';\nimport type { Core } from '@strapi/types';\nimport { ProviderTransferError } from '../../../../../errors/providers';\nimport { IConfiguration, Transaction } from '../../../../../types';\n\nconst omitInvalidCreationAttributes = omit(['id']);\n\nconst restoreCoreStore = async <T extends { value: unknown }>(strapi: Core.Strapi, values: T) => {\n const data = omitInvalidCreationAttributes(values);\n return strapi.db.query('strapi::core-store').create({\n data: {\n ...data,\n value: JSON.stringify(data.value),\n },\n });\n};\n\nconst restoreWebhooks = async <T extends { value: unknown }>(strapi: Core.Strapi, values: T) => {\n const data = omitInvalidCreationAttributes(values);\n return strapi.db.query('strapi::webhook').create({ data });\n};\n\nexport const restoreConfigs = async (strapi: Core.Strapi, config: IConfiguration) => {\n if (config.type === 'core-store') {\n return restoreCoreStore(strapi, config.value as { value: unknown });\n }\n\n if (config.type === 'webhook') {\n return restoreWebhooks(strapi, config.value as { value: unknown });\n }\n};\n\nexport const createConfigurationWriteStream = async (\n strapi: Core.Strapi,\n transaction?: Transaction\n) => {\n return new Writable({\n objectMode: true,\n async write<T extends { id: number }>(\n config: IConfiguration<T>,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ) {\n await transaction?.attach(async () => {\n try {\n await restoreConfigs(strapi, config);\n } catch (error) {\n return callback(\n new ProviderTransferError(\n `Failed to import ${chalk.yellowBright(config.type)} (${chalk.greenBright(\n config.value.id\n )}`\n )\n );\n }\n callback();\n });\n },\n });\n};\n"],"names":["omitInvalidCreationAttributes","omit","restoreCoreStore","strapi","values","data","db","query","create","value","JSON","stringify","restoreWebhooks","restoreConfigs","config","type","createConfigurationWriteStream","transaction","Writable","objectMode","write","_encoding","callback","attach","error","ProviderTransferError","chalk","yellowBright","greenBright","id"],"mappings":";;;;;AAOA,MAAMA,gCAAgCC,IAAAA,CAAK;AAAC,IAAA;AAAK,CAAA,CAAA;AAEjD,MAAMC,gBAAAA,GAAmB,OAAqCC,MAAAA,EAAqBC,MAAAA,GAAAA;AACjF,IAAA,MAAMC,OAAOL,6BAAAA,CAA8BI,MAAAA,CAAAA;AAC3C,IAAA,OAAOD,OAAOG,EAAE,CAACC,KAAK,CAAC,oBAAA,CAAA,CAAsBC,MAAM,CAAC;QAClDH,IAAAA,EAAM;AACJ,YAAA,GAAGA,IAAI;AACPI,YAAAA,KAAAA,EAAOC,IAAAA,CAAKC,SAAS,CAACN,IAAAA,CAAKI,KAAK;AAClC;AACF,KAAA,CAAA;AACF,CAAA;AAEA,MAAMG,eAAAA,GAAkB,OAAqCT,MAAAA,EAAqBC,MAAAA,GAAAA;AAChF,IAAA,MAAMC,OAAOL,6BAAAA,CAA8BI,MAAAA,CAAAA;AAC3C,IAAA,OAAOD,OAAOG,EAAE,CAACC,KAAK,CAAC,iBAAA,CAAA,CAAmBC,MAAM,CAAC;AAAEH,QAAAA;AAAK,KAAA,CAAA;AAC1D,CAAA;AAEO,MAAMQ,cAAAA,GAAiB,OAAOV,MAAAA,EAAqBW,MAAAA,GAAAA;IACxD,IAAIA,MAAAA,CAAOC,IAAI,KAAK,YAAA,EAAc;QAChC,OAAOb,gBAAAA,CAAiBC,MAAAA,EAAQW,MAAAA,CAAOL,KAAK,CAAA;AAC9C,IAAA;IAEA,IAAIK,MAAAA,CAAOC,IAAI,KAAK,SAAA,EAAW;QAC7B,OAAOH,eAAAA,CAAgBT,MAAAA,EAAQW,MAAAA,CAAOL,KAAK,CAAA;AAC7C,IAAA;AACF;AAEO,MAAMO,8BAAAA,GAAiC,OAC5Cb,MAAAA,EACAc,WAAAA,GAAAA;AAEA,IAAA,OAAO,IAAIC,QAAAA,CAAS;QAClBC,UAAAA,EAAY,IAAA;AACZ,QAAA,MAAMC,KAAAA,CAAAA,CACJN,MAAyB,EACzBO,SAAyB,EACzBC,QAAwC,EAAA;AAExC,YAAA,MAAML,aAAaM,MAAAA,CAAO,UAAA;gBACxB,IAAI;AACF,oBAAA,MAAMV,eAAeV,MAAAA,EAAQW,MAAAA,CAAAA;AAC/B,gBAAA,CAAA,CAAE,OAAOU,KAAAA,EAAO;oBACd,OAAOF,QAAAA,CACL,IAAIG,qBAAAA,CACF,CAAC,iBAAiB,EAAEC,KAAAA,CAAMC,YAAY,CAACb,MAAAA,CAAOC,IAAI,CAAA,CAAE,EAAE,EAAEW,KAAAA,CAAME,WAAW,CACvEd,MAAAA,CAAOL,KAAK,CAACoB,EAAE,CAAA,CAAA,CACd,CAAA,CAAA;AAGT,gBAAA;AACAP,gBAAAA,QAAAA,EAAAA;AACF,YAAA,CAAA,CAAA;AACF,QAAA;AACF,KAAA,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"configuration.mjs","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/configuration.ts"],"sourcesContent":["import { Writable } from 'stream';\nimport { omit } from 'lodash/fp';\nimport chalk from 'chalk';\nimport type { Core } from '@strapi/types';\nimport { ProviderTransferError } from '../../../../../errors/providers';\nimport { IConfiguration, Transaction } from '../../../../../types';\nimport { restoreProjectSettingsRow } from '../../../../utils/project-settings-logos';\n\nconst omitInvalidCreationAttributes = omit(['id']);\n\nconst restoreCoreStore = async <T extends { value: unknown }>(strapi: Core.Strapi, values: T) => {\n const data = omitInvalidCreationAttributes(values);\n const row = await restoreProjectSettingsRow(\n strapi,\n data as unknown as { key: string; value: unknown }\n );\n\n return strapi.db.query('strapi::core-store').create({\n data: {\n ...row,\n value: JSON.stringify(row.value),\n },\n });\n};\n\nconst restoreWebhooks = async <T extends { value: unknown }>(strapi: Core.Strapi, values: T) => {\n const data = omitInvalidCreationAttributes(values);\n return strapi.db.query('strapi::webhook').create({ data });\n};\n\nexport const restoreConfigs = async (strapi: Core.Strapi, config: IConfiguration) => {\n if (config.type === 'core-store') {\n return restoreCoreStore(strapi, config.value as { value: unknown });\n }\n\n if (config.type === 'webhook') {\n return restoreWebhooks(strapi, config.value as { value: unknown });\n }\n};\n\nexport const createConfigurationWriteStream = async (\n strapi: Core.Strapi,\n transaction?: Transaction\n) => {\n return new Writable({\n objectMode: true,\n async write<T extends { id: number }>(\n config: IConfiguration<T>,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ) {\n await transaction?.attach(async () => {\n try {\n await restoreConfigs(strapi, config);\n } catch (error) {\n return callback(\n new ProviderTransferError(\n `Failed to import ${chalk.yellowBright(config.type)} (${chalk.greenBright(\n config.value.id\n )}`\n )\n );\n }\n callback();\n });\n },\n });\n};\n"],"names":["omitInvalidCreationAttributes","omit","restoreCoreStore","strapi","values","data","row","restoreProjectSettingsRow","db","query","create","value","JSON","stringify","restoreWebhooks","restoreConfigs","config","type","createConfigurationWriteStream","transaction","Writable","objectMode","write","_encoding","callback","attach","error","ProviderTransferError","chalk","yellowBright","greenBright","id"],"mappings":";;;;;;AAQA,MAAMA,gCAAgCC,IAAAA,CAAK;AAAC,IAAA;AAAK,CAAA,CAAA;AAEjD,MAAMC,gBAAAA,GAAmB,OAAqCC,MAAAA,EAAqBC,MAAAA,GAAAA;AACjF,IAAA,MAAMC,OAAOL,6BAAAA,CAA8BI,MAAAA,CAAAA;IAC3C,MAAME,GAAAA,GAAM,MA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A,CAAE,OAAOU,KAAAA,EAAO;oBACd,OAAOF,QAAAA,CACL,IAAIG,qBAAAA,CACF,CAAC,iBAAiB,EAAEC,KAAAA,CAAMC,YAAY,CAACb,MAAAA,CAAOC,IAAI,CAAA,CAAE,EAAE,EAAEW,KAAAA,CAAME,WAAW,CACvEd,MAAAA,CAAOL,KAAK,CAACoB,EAAE,CAAA,CAAA,CACd,CAAA,CAAA;AAGT,gBAAA;AACAP,gBAAAA,QAAAA,EAAAA;AACF,YAAA,CAAA,CAAA;AACF,QAAA;AACF,KAAA,CAAA;AACF;;;;"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Writable } from 'stream';
3
2
  import type { Core, UID } from '@strapi/types';
4
3
  import type { Transaction } from '../../../../../types';
@@ -1 +1 @@
1
- {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/entities.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIjE,UAAU,6BAA6B;IACrC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IACpB,kBAAkB,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,EAC9C,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,IAAI,CAAC;IACR,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,eAAO,MAAM,yBAAyB,YAAa,6BAA6B,aAgD/E,CAAC"}
1
+ {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIjE,UAAU,6BAA6B;IACrC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IACpB,kBAAkB,CAAC,UAAU,SAAS,GAAG,CAAC,MAAM,EAC9C,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,IAAI,CAAC;IACR,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,eAAO,MAAM,yBAAyB,GAAI,SAAS,6BAA6B,aAgD/E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAO,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvD,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE;QACd,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,iBAAiB,KAAK,OAAO,CAAC,EAAE,CAAC;QACjE,MAAM,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC;KACrC,CAAC;CACH;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CACjD;AAED,eAAO,MAAM,aAAa,WAAkB,KAAK,MAAM,WAAW,eAAe;;;;EAShF,CAAC;AAsIF,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAO,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvD,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE;QACd,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,iBAAiB,KAAK,OAAO,CAAC,EAAE,CAAC;QACjE,MAAM,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC;KACrC,CAAC;CACH;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CACjD;AAED,eAAO,MAAM,aAAa,GAAU,QAAQ,IAAI,CAAC,MAAM,EAAE,SAAS,eAAe;;;;EAShF,CAAC;AAsIF,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Writable } from 'stream';
3
2
  import type { Core } from '@strapi/types';
4
3
  import { Transaction } from '../../../../../types';
@@ -1 +1 @@
1
- {"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/links.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAS,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAuB1D,eAAO,MAAM,sBAAsB,UAC1B,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,UAC9C,KAAK,MAAM,gBACL,WAAW,cACb,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,aA6DtC,CAAC"}
1
+ {"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAS,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAwB1D,eAAO,MAAM,sBAAsB,GACjC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EACtD,QAAQ,IAAI,CAAC,MAAM,EACnB,cAAc,WAAW,EACzB,YAAY,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,aA6DtC,CAAC"}
@@ -3,6 +3,7 @@
3
3
  var stream = require('stream');
4
4
  var providers = require('../../../../../errors/providers.js');
5
5
  var link = require('../../../../queries/link.js');
6
+ var resolveLinkRef = require('./resolve-link-ref.js');
6
7
 
7
8
  const isErrorWithCode = (error)=>{
8
9
  return error && typeof error.code === 'string';
@@ -35,8 +36,8 @@ const createLinksWriteStream = (mapID, strapi, transaction, onWarning)=>{
35
36
  const query = link.createLinkQuery(strapi, trx);
36
37
  const originalLeftRef = left.ref;
37
38
  const originalRightRef = right.ref;
38
- const mappedLeftRef = mapID(left.type, originalLeftRef);
39
- const mappedRightRef = mapID(right.type, originalRightRef);
39
+ const mappedLeftRef = resolveLinkRef.resolveLinkRef(strapi, link$1, 'left', mapID);
40
+ const mappedRightRef = resolveLinkRef.resolveLinkRef(strapi, link$1, 'right', mapID);
40
41
  // A missing mapping means the referenced row was never transferred
41
42
  // during the entities stage (e.g. an orphaned component or a dangling
42
43
  // reference in the source database). Falling back to the original ID
@@ -1 +1 @@
1
- {"version":3,"file":"links.js","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/links.ts"],"sourcesContent":["import { Writable } from 'stream';\nimport type { Core } from '@strapi/types';\nimport { ProviderTransferError } from '../../../../../errors/providers';\nimport { ILink, Transaction } from '../../../../../types';\nimport { createLinkQuery } from '../../../../queries/link';\n\ninterface ErrorWithCode extends Error {\n code: string;\n}\n\nconst isErrorWithCode = (error: any): error is ErrorWithCode => {\n return error && typeof error.code === 'string';\n};\n\nconst isForeignKeyConstraintError = (e: Error) => {\n const MYSQL_FK_ERROR_CODES = ['1452', '1557', '1216', '1217', '1451'];\n const POSTGRES_FK_ERROR_CODE = '23503';\n const SQLITE_FK_ERROR_CODE = 'SQLITE_CONSTRAINT_FOREIGNKEY';\n\n if (isErrorWithCode(e) && e.code) {\n return [SQLITE_FK_ERROR_CODE, POSTGRES_FK_ERROR_CODE, ...MYSQL_FK_ERROR_CODES].includes(e.code);\n }\n\n return e.message.toLowerCase().includes('foreign key constraint');\n};\n\nexport const createLinksWriteStream = (\n mapID: (uid: string, id: number) => number | undefined,\n strapi: Core.Strapi,\n transaction?: Transaction,\n onWarning?: (message: string) => void\n) => {\n return new Writable({\n objectMode: true,\n async write(link: ILink, _encoding, callback) {\n await transaction?.attach(async (trx) => {\n const { left, right } = link;\n const query = createLinkQuery(strapi, trx);\n\n const originalLeftRef = left.ref;\n const originalRightRef = right.ref;\n\n const mappedLeftRef = mapID(left.type, originalLeftRef);\n const mappedRightRef = mapID(right.type, originalRightRef);\n\n // A missing mapping means the referenced row was never transferred\n // during the entities stage (e.g. an orphaned component or a dangling\n // reference in the source database). Falling back to the original ID\n // would either violate a foreign key constraint — which aborts the\n // whole transaction on PostgreSQL — or silently attach the link to an\n // unrelated row, so the link is skipped instead.\n if (mappedLeftRef === undefined || mappedRightRef === undefined) {\n const missingRefs = [\n ...(mappedLeftRef === undefined ? [`${left.type}:${originalLeftRef}`] : []),\n ...(mappedRightRef === undefined ? [`${right.type}:${originalRightRef}`] : []),\n ].join(' and ');\n\n onWarning?.(\n `Skipping link ${left.type}:${originalLeftRef} -> ${right.type}:${originalRightRef} because ${missingRefs} was not transferred during the entities stage.`\n );\n\n return callback(null);\n }\n\n left.ref = mappedLeftRef;\n right.ref = mappedRightRef;\n\n try {\n await query().insert(link);\n } catch (e) {\n if (e instanceof Error) {\n if (isForeignKeyConstraintError(e)) {\n onWarning?.(\n `Skipping link ${left.type}:${originalLeftRef} -> ${right.type}:${originalRightRef} due to a foreign key constraint.`\n );\n return callback(null);\n }\n return callback(e);\n }\n\n return callback(\n new ProviderTransferError(\n `An error happened while trying to import a ${left.type} link.`\n )\n );\n }\n\n callback(null);\n });\n },\n });\n};\n"],"names":["isErrorWithCode","error","code","isForeignKeyConstraintError","e","MYSQL_FK_ERROR_CODES","POSTGRES_FK_ERROR_CODE","SQLITE_FK_ERROR_CODE","includes","message","toLowerCase","createLinksWriteStream","mapID","strapi","transaction","onWarning","Writable","objectMode","write","link","_encoding","callback","attach","trx","left","right","query","createLinkQuery","originalLeftRef","ref","originalRightRef","mappedLeftRef","type","mappedRightRef","undefined","missingRefs","join","insert","Error","ProviderTransferError"],"mappings":";;;;;;AAUA,MAAMA,kBAAkB,CAACC,KAAAA,GAAAA;AACvB,IAAA,OAAOA,KAAAA,IAAS,OAAOA,KAAAA,CAAMC,IAAI,KAAK,QAAA;AACxC,CAAA;AAEA,MAAMC,8BAA8B,CAACC,CAAAA,GAAAA;AACnC,IAAA,MAAMC,oBAAAA,GAAuB;A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T,QAAAA,CAAS,IAAA,CAAA;AAClB,wBAAA;AACA,wBAAA,OAAOA,QAAAA,CAASjB,CAAAA,CAAAA;AAClB,oBAAA;oBAEA,OAAOiB,QAAAA,CACL,IAAIkB,+BAAAA,CACF,CAAC,2CAA2C,EAAEf,IAAAA,CAAKQ,IAAI,CAAC,MAAM,CAAC,CAAA,CAAA;AAGrE,gBAAA;gBAEAX,QAAAA,CAAS,IAAA,CAAA;AACX,YAAA,CAAA,CAAA;AACF,QAAA;AACF,KAAA,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"links.js","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/links.ts"],"sourcesContent":["import { Writable } from 'stream';\nimport type { Core } from '@strapi/types';\nimport { ProviderTransferError } from '../../../../../errors/providers';\nimport { ILink, Transaction } from '../../../../../types';\nimport { createLinkQuery } from '../../../../queries/link';\nimport { resolveLinkRef } from './resolve-link-ref';\n\ninterface ErrorWithCode extends Error {\n code: string;\n}\n\nconst isErrorWithCode = (error: any): error is ErrorWithCode => {\n return error && typeof error.code === 'string';\n};\n\nconst isForeignKeyConstraintError = (e: Error) => {\n const MYSQL_FK_ERROR_CODES = ['1452', '1557', '1216', '1217', '1451'];\n const POSTGRES_FK_ERROR_CODE = '23503';\n const SQLITE_FK_ERROR_CODE = 'SQLITE_CONSTRAINT_FOREIGNKEY';\n\n if (isErrorWithCode(e) && e.code) {\n return [SQLITE_FK_ERROR_CODE, POSTGRES_FK_ERROR_CODE, ...MYSQL_FK_ERROR_CODES].includes(e.code);\n }\n\n return e.message.toLowerCase().includes('foreign key constraint');\n};\n\nexport const createLinksWriteStream = (\n mapID: (uid: string, id: number) => number | undefined,\n strapi: Core.Strapi,\n transaction?: Transaction,\n onWarning?: (message: string) => void\n) => {\n return new Writable({\n objectMode: true,\n async write(link: ILink, _encoding, callback) {\n await transaction?.attach(async (trx) => {\n const { left, right } = link;\n const query = createLinkQuery(strapi, trx);\n\n const originalLeftRef = left.ref;\n const originalRightRef = right.ref;\n\n const mappedLeftRef = resolveLinkRef(strapi, link, 'left', mapID);\n const mappedRightRef = resolveLinkRef(strapi, link, 'right', mapID);\n\n // A missing mapping means the referenced row was never transferred\n // during the entities stage (e.g. an orphaned component or a dangling\n // reference in the source database). Falling back to the original ID\n // would either violate a foreign key constraint — which aborts the\n // whole transaction on PostgreSQL — or silently attach the link to an\n // unrelated row, so the link is skipped instead.\n if (mappedLeftRef === undefined || mappedRightRef === undefined) {\n const missingRefs = [\n ...(mappedLeftRef === undefined ? [`${left.type}:${originalLeftRef}`] : []),\n ...(mappedRightRef === undefined ? [`${right.type}:${originalRightRef}`] : []),\n ].join(' and ');\n\n onWarning?.(\n `Skipping link ${left.type}:${originalLeftRef} -> ${right.type}:${originalRightRef} because ${missingRefs} was not transferred during the entities stage.`\n );\n\n return callback(null);\n }\n\n left.ref = mappedLeftRef;\n right.ref = mappedRightRef;\n\n try {\n await query().insert(link);\n } catch (e) {\n if (e instanceof Error) {\n if (isForeignKeyConstraintError(e)) {\n onWarning?.(\n `Skipping link ${left.type}:${originalLeftRef} -> ${right.type}:${originalRightRef} due to a foreign key constraint.`\n );\n return callback(null);\n }\n return callback(e);\n }\n\n return callback(\n new ProviderTransferError(\n `An error happened while trying to import a ${left.type} link.`\n )\n );\n }\n\n callback(null);\n });\n },\n });\n};\n"],"names":["isErrorWithCode","error","code","isForeignKeyConstraintError","e","MYSQL_FK_ERROR_CODES","POSTGRES_FK_ERROR_CODE","SQLITE_FK_ERROR_CODE","includes","message","toLowerCase","createLinksWriteStream","mapID","strapi","transaction","onWarning","Writable","objectMode","write","link","_encoding","callback","attach","trx","left","right","query","createLinkQuery","originalLeftRef","ref","originalRightRef","mappedLeftRef","resolveLinkRef","mappedRightRef","undefined","missingRefs","type","join","insert","Error","ProviderTransferError"],"mappings":";;;;;;;AAWA,MAAMA,kBAAkB,CAACC,KAAAA,GAAAA;AACvB,IAAA,OAAOA,KAAAA,IAAS,OAAOA,KAAAA,CAAMC,IAAI,KAAK,Q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A,CAAgB,IAAI,EAAEH,MAAMW,IAAI,CAAC,CAAC,EAAEN,gBAAAA,CAAiB,iCAAiC,CAAC,CAAA;AAEvH,4BAAA,OAAOT,QAAAA,CAAS,IAAA,CAAA;AAClB,wBAAA;AACA,wBAAA,OAAOA,QAAAA,CAASjB,CAAAA,CAAAA;AAClB,oBAAA;oBAEA,OAAOiB,QAAAA,CACL,IAAImB,+BAAAA,CACF,CAAC,2CAA2C,EAAEhB,IAAAA,CAAKY,IAAI,CAAC,MAAM,CAAC,CAAA,CAAA;AAGrE,gBAAA;gBAEAf,QAAAA,CAAS,IAAA,CAAA;AACX,YAAA,CAAA,CAAA;AACF,QAAA;AACF,KAAA,CAAA;AACF;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { Writable } from 'stream';
2
2
  import { ProviderTransferError } from '../../../../../errors/providers.mjs';
3
3
  import { createLinkQuery } from '../../../../queries/link.mjs';
4
+ import { resolveLinkRef } from './resolve-link-ref.mjs';
4
5
 
5
6
  const isErrorWithCode = (error)=>{
6
7
  return error && typeof error.code === 'string';
@@ -33,8 +34,8 @@ const createLinksWriteStream = (mapID, strapi, transaction, onWarning)=>{
33
34
  const query = createLinkQuery(strapi, trx);
34
35
  const originalLeftRef = left.ref;
35
36
  const originalRightRef = right.ref;
36
- const mappedLeftRef = mapID(left.type, originalLeftRef);
37
- const mappedRightRef = mapID(right.type, originalRightRef);
37
+ const mappedLeftRef = resolveLinkRef(strapi, link, 'left', mapID);
38
+ const mappedRightRef = resolveLinkRef(strapi, link, 'right', mapID);
38
39
  // A missing mapping means the referenced row was never transferred
39
40
  // during the entities stage (e.g. an orphaned component or a dangling
40
41
  // reference in the source database). Falling back to the original ID
@@ -1 +1 @@
1
- {"version":3,"file":"links.mjs","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/links.ts"],"sourcesContent":["import { Writable } from 'stream';\nimport type { Core } from '@strapi/types';\nimport { ProviderTransferError } from '../../../../../errors/providers';\nimport { ILink, Transaction } from '../../../../../types';\nimport { createLinkQuery } from '../../../../queries/link';\n\ninterface ErrorWithCode extends Error {\n code: string;\n}\n\nconst isErrorWithCode = (error: any): error is ErrorWithCode => {\n return error && typeof error.code === 'string';\n};\n\nconst isForeignKeyConstraintError = (e: Error) => {\n const MYSQL_FK_ERROR_CODES = ['1452', '1557', '1216', '1217', '1451'];\n const POSTGRES_FK_ERROR_CODE = '23503';\n const SQLITE_FK_ERROR_CODE = 'SQLITE_CONSTRAINT_FOREIGNKEY';\n\n if (isErrorWithCode(e) && e.code) {\n return [SQLITE_FK_ERROR_CODE, POSTGRES_FK_ERROR_CODE, ...MYSQL_FK_ERROR_CODES].includes(e.code);\n }\n\n return e.message.toLowerCase().includes('foreign key constraint');\n};\n\nexport const createLinksWriteStream = (\n mapID: (uid: string, id: number) => number | undefined,\n strapi: Core.Strapi,\n transaction?: Transaction,\n onWarning?: (message: string) => void\n) => {\n return new Writable({\n objectMode: true,\n async write(link: ILink, _encoding, callback) {\n await transaction?.attach(async (trx) => {\n const { left, right } = link;\n const query = createLinkQuery(strapi, trx);\n\n const originalLeftRef = left.ref;\n const originalRightRef = right.ref;\n\n const mappedLeftRef = mapID(left.type, originalLeftRef);\n const mappedRightRef = mapID(right.type, originalRightRef);\n\n // A missing mapping means the referenced row was never transferred\n // during the entities stage (e.g. an orphaned component or a dangling\n // reference in the source database). Falling back to the original ID\n // would either violate a foreign key constraint — which aborts the\n // whole transaction on PostgreSQL — or silently attach the link to an\n // unrelated row, so the link is skipped instead.\n if (mappedLeftRef === undefined || mappedRightRef === undefined) {\n const missingRefs = [\n ...(mappedLeftRef === undefined ? [`${left.type}:${originalLeftRef}`] : []),\n ...(mappedRightRef === undefined ? [`${right.type}:${originalRightRef}`] : []),\n ].join(' and ');\n\n onWarning?.(\n `Skipping link ${left.type}:${originalLeftRef} -> ${right.type}:${originalRightRef} because ${missingRefs} was not transferred during the entities stage.`\n );\n\n return callback(null);\n }\n\n left.ref = mappedLeftRef;\n right.ref = mappedRightRef;\n\n try {\n await query().insert(link);\n } catch (e) {\n if (e instanceof Error) {\n if (isForeignKeyConstraintError(e)) {\n onWarning?.(\n `Skipping link ${left.type}:${originalLeftRef} -> ${right.type}:${originalRightRef} due to a foreign key constraint.`\n );\n return callback(null);\n }\n return callback(e);\n }\n\n return callback(\n new ProviderTransferError(\n `An error happened while trying to import a ${left.type} link.`\n )\n );\n }\n\n callback(null);\n });\n },\n });\n};\n"],"names":["isErrorWithCode","error","code","isForeignKeyConstraintError","e","MYSQL_FK_ERROR_CODES","POSTGRES_FK_ERROR_CODE","SQLITE_FK_ERROR_CODE","includes","message","toLowerCase","createLinksWriteStream","mapID","strapi","transaction","onWarning","Writable","objectMode","write","link","_encoding","callback","attach","trx","left","right","query","createLinkQuery","originalLeftRef","ref","originalRightRef","mappedLeftRef","type","mappedRightRef","undefined","missingRefs","join","insert","Error","ProviderTransferError"],"mappings":";;;;AAUA,MAAMA,kBAAkB,CAACC,KAAAA,GAAAA;AACvB,IAAA,OAAOA,KAAAA,IAAS,OAAOA,KAAAA,CAAMC,IAAI,KAAK,QAAA;AACxC,CAAA;AAEA,MAAMC,8BAA8B,CAACC,CAAAA,GAAAA;AACnC,IAAA,MAAMC,oBAAAA,GAAuB;AAAC,QAAA,MAAA;AAAQ,QAAA,MAAA;AAAQ,QAAA,MAAA;AAAQ,QAAA,MAAA;AAAQ,QAAA;AAAO,KAAA;AACrE,IAAA,MAAMC,sBAAAA,GAAyB,OAAA;AAC/B,IAAA,MAAMC,oBAAAA,GAAuB,8BAAA;AAE7B,IAAA,IAAIP,eAAAA,CAAgBI,CAAAA,CAAAA,IAAMA,CAAAA,CAAEF,IAAI,EAAE;QAChC,OAAO;AAACK,YAAAA,oBAAAA;AAAsBD,YAAAA,sBAAAA;AAA2BD,YAAAA,GAAAA;SAAqB,CAACG,QAAQ,CAACJ,CAAAA,CAAEF,IAAI,CAAA;AAChG,IAAA;AAEA,IAAA,OAAOE,EAAEK,OAAO,CAACC,WAAW,EAAA,CAAGF,Q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,GACE,CAAC,cAAc,EAAES,IAAAA,CAAKQ,IAAI,CAAC,CAAC,EAAEJ,eAAAA,CAAgB,IAAI,EAAEH,KAAAA,CAAMO,IAAI,CAAC,CAAC,EAAEF,iBAAiB,SAAS,EAAEK,WAAAA,CAAY,+CAA+C,CAAC,CAAA;AAG5J,oBAAA,OAAOd,QAAAA,CAAS,IAAA,CAAA;AAClB,gBAAA;AAEAG,gBAAAA,IAAAA,CAAKK,GAAG,GAAGE,aAAAA;AACXN,gBAAAA,KAAAA,CAAMI,GAAG,GAAGI,cAAAA;gBAEZ,IAAI;oBACF,MAAMP,KAAAA,EAAAA,CAAQW,MAAM,CAAClB,IAAAA,CAAAA;AACvB,gBAAA,CAAA,CAAE,OAAOf,CAAAA,EAAG;AACV,oBAAA,IAAIA,aAAakC,KAAAA,EAAO;AACtB,wBAAA,IAAInC,4BAA4BC,CAAAA,CAAAA,EAAI;AAClCW,4BAAAA,SAAAA,GACE,CAAC,cAAc,EAAES,KAAKQ,IAAI,CAAC,CAAC,EAAEJ,eAAAA,CAAgB,IAAI,EAAEH,MAAMO,IAAI,CAAC,CAAC,EAAEF,gBAAAA,CAAiB,iCAAiC,CAAC,CAAA;AAEvH,4BAAA,OAAOT,QAAAA,CAAS,IAAA,CAAA;AAClB,wBAAA;AACA,wBAAA,OAAOA,QAAAA,CAASjB,CAAAA,CAAAA;AAClB,oBAAA;oBAEA,OAAOiB,QAAAA,CACL,IAAIkB,qBAAAA,CACF,CAAC,2CAA2C,EAAEf,IAAAA,CAAKQ,IAAI,CAAC,MAAM,CAAC,CAAA,CAAA;AAGrE,gBAAA;gBAEAX,QAAAA,CAAS,IAAA,CAAA;AACX,YAAA,CAAA,CAAA;AACF,QAAA;AACF,KAAA,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"links.mjs","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/links.ts"],"sourcesContent":["import { Writable } from 'stream';\nimport type { Core } from '@strapi/types';\nimport { ProviderTransferError } from '../../../../../errors/providers';\nimport { ILink, Transaction } from '../../../../../types';\nimport { createLinkQuery } from '../../../../queries/link';\nimport { resolveLinkRef } from './resolve-link-ref';\n\ninterface ErrorWithCode extends Error {\n code: string;\n}\n\nconst isErrorWithCode = (error: any): error is ErrorWithCode => {\n return error && typeof error.code === 'string';\n};\n\nconst isForeignKeyConstraintError = (e: Error) => {\n const MYSQL_FK_ERROR_CODES = ['1452', '1557', '1216', '1217', '1451'];\n const POSTGRES_FK_ERROR_CODE = '23503';\n const SQLITE_FK_ERROR_CODE = 'SQLITE_CONSTRAINT_FOREIGNKEY';\n\n if (isErrorWithCode(e) && e.code) {\n return [SQLITE_FK_ERROR_CODE, POSTGRES_FK_ERROR_CODE, ...MYSQL_FK_ERROR_CODES].includes(e.code);\n }\n\n return e.message.toLowerCase().includes('foreign key constraint');\n};\n\nexport const createLinksWriteStream = (\n mapID: (uid: string, id: number) => number | undefined,\n strapi: Core.Strapi,\n transaction?: Transaction,\n onWarning?: (message: string) => void\n) => {\n return new Writable({\n objectMode: true,\n async write(link: ILink, _encoding, callback) {\n await transaction?.attach(async (trx) => {\n const { left, right } = link;\n const query = createLinkQuery(strapi, trx);\n\n const originalLeftRef = left.ref;\n const originalRightRef = right.ref;\n\n const mappedLeftRef = resolveLinkRef(strapi, link, 'left', mapID);\n const mappedRightRef = resolveLinkRef(strapi, link, 'right', mapID);\n\n // A missing mapping means the referenced row was never transferred\n // during the entities stage (e.g. an orphaned component or a dangling\n // reference in the source database). Falling back to the original ID\n // would either violate a foreign key constraint — which aborts the\n // whole transaction on PostgreSQL — or silently attach the link to an\n // unrelated row, so the link is skipped instead.\n if (mappedLeftRef === undefined || mappedRightRef === undefined) {\n const missingRefs = [\n ...(mappedLeftRef === undefined ? [`${left.type}:${originalLeftRef}`] : []),\n ...(mappedRightRef === undefined ? [`${right.type}:${originalRightRef}`] : []),\n ].join(' and ');\n\n onWarning?.(\n `Skipping link ${left.type}:${originalLeftRef} -> ${right.type}:${originalRightRef} because ${missingRefs} was not transferred during the entities stage.`\n );\n\n return callback(null);\n }\n\n left.ref = mappedLeftRef;\n right.ref = mappedRightRef;\n\n try {\n await query().insert(link);\n } catch (e) {\n if (e instanceof Error) {\n if (isForeignKeyConstraintError(e)) {\n onWarning?.(\n `Skipping link ${left.type}:${originalLeftRef} -> ${right.type}:${originalRightRef} due to a foreign key constraint.`\n );\n return callback(null);\n }\n return callback(e);\n }\n\n return callback(\n new ProviderTransferError(\n `An error happened while trying to import a ${left.type} link.`\n )\n );\n }\n\n callback(null);\n });\n },\n });\n};\n"],"names":["isErrorWithCode","error","code","isForeignKeyConstraintError","e","MYSQL_FK_ERROR_CODES","POSTGRES_FK_ERROR_CODE","SQLITE_FK_ERROR_CODE","includes","message","toLowerCase","createLinksWriteStream","mapID","strapi","transaction","onWarning","Writable","objectMode","write","link","_encoding","callback","attach","trx","left","right","query","createLinkQuery","originalLeftRef","ref","originalRightRef","mappedLeftRef","resolveLinkRef","mappedRightRef","undefined","missingRefs","type","join","insert","Error","ProviderTransferError"],"mappings":";;;;;AAWA,MAAMA,kBAAkB,CAACC,KAAAA,GAAAA;AACvB,IAAA,OAAOA,KAAAA,IAAS,OAAOA,KAAAA,CAAMC,IAAI,KAAK,QAAA;AACxC,CAAA;AAEA,MAAMC,8BAA8B,CAACC,CAAAA,GAAAA;AACnC,IAAA,MAAMC,oBAAAA,GAAuB;AAAC,QAAA,MAAA;AAAQ,QAAA,MAAA;AAAQ,QAAA,MAAA;AAAQ,QAAA,MAAA;AAAQ,QAAA;AAAO,KAAA;AACrE,IAAA,MAAMC,sBAAAA,GAAyB,OAAA;AAC/B,IAAA,MAAMC,oBAAAA,GAAuB,8BAAA;AAE7B,IAAA,IAAIP,eAAAA,CAAgBI,CAAAA,CAAAA,IAAMA,CAAAA,CAAEF,IAAI,EAAE;QAChC,OAAO;AAACK,YAAAA,oBAAAA;AAAsBD,YAAAA,sBAAAA;AAA2BD,YAAAA,GAAAA;SAAqB,CAACG,QAAQ,CAACJ,CA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from '@strapi/types';
2
+ import type { ILink } from '../../../../../types';
3
+ /**
4
+ * joinColumn relations (e.g. i18n `localizations`) store `document_id` on the
5
+ * inverse side. Export emits that value as a string ref; restore must not run it
6
+ * through the numeric id mapper.
7
+ */
8
+ export declare const isDocumentIdJoinColumnTarget: (strapi: Core.Strapi, link: ILink, side: "left" | "right") => boolean;
9
+ export declare const resolveLinkRef: (strapi: Core.Strapi, link: ILink, side: "left" | "right", mapID: (uid: string, id: number) => number | undefined) => number | string | undefined;
10
+ //# sourceMappingURL=resolve-link-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-link-ref.d.ts","sourceRoot":"","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/resolve-link-ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GACvC,QAAQ,IAAI,CAAC,MAAM,EACnB,MAAM,KAAK,EACX,MAAM,MAAM,GAAG,OAAO,KACrB,OAiBF,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,QAAQ,IAAI,CAAC,MAAM,EACnB,MAAM,KAAK,EACX,MAAM,MAAM,GAAG,OAAO,EACtB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,KACrD,MAAM,GAAG,MAAM,GAAG,SAcpB,CAAC"}
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * joinColumn relations (e.g. i18n `localizations`) store `document_id` on the
5
+ * inverse side. Export emits that value as a string ref; restore must not run it
6
+ * through the numeric id mapper.
7
+ */ const isDocumentIdJoinColumnTarget = (strapi, link, side)=>{
8
+ if (side !== 'right') {
9
+ return false;
10
+ }
11
+ const metadata = strapi.db?.metadata?.get(link.left.type);
12
+ const attribute = metadata?.attributes?.[link.left.field];
13
+ if (!attribute || attribute.type !== 'relation') {
14
+ return false;
15
+ }
16
+ if (!('joinColumn' in attribute) || !attribute.joinColumn) {
17
+ return false;
18
+ }
19
+ return attribute.joinColumn.referencedColumn === 'document_id';
20
+ };
21
+ const resolveLinkRef = (strapi, link, side, mapID)=>{
22
+ const { type, ref } = side === 'left' ? link.left : link.right;
23
+ if (isDocumentIdJoinColumnTarget(strapi, link, side)) {
24
+ return ref;
25
+ }
26
+ const numericRef = typeof ref === 'number' ? ref : Number(ref);
27
+ if (!Number.isFinite(numericRef)) {
28
+ return undefined;
29
+ }
30
+ return mapID(type, numericRef);
31
+ };
32
+
33
+ exports.isDocumentIdJoinColumnTarget = isDocumentIdJoinColumnTarget;
34
+ exports.resolveLinkRef = resolveLinkRef;
35
+ //# sourceMappingURL=resolve-link-ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-link-ref.js","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/resolve-link-ref.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport type { ILink } from '../../../../../types';\n\n/**\n * joinColumn relations (e.g. i18n `localizations`) store `document_id` on the\n * inverse side. Export emits that value as a string ref; restore must not run it\n * through the numeric id mapper.\n */\nexport const isDocumentIdJoinColumnTarget = (\n strapi: Core.Strapi,\n link: ILink,\n side: 'left' | 'right'\n): boolean => {\n if (side !== 'right') {\n return false;\n }\n\n const metadata = strapi.db?.metadata?.get(link.left.type);\n const attribute = metadata?.attributes?.[link.left.field];\n\n if (!attribute || attribute.type !== 'relation') {\n return false;\n }\n\n if (!('joinColumn' in attribute) || !attribute.joinColumn) {\n return false;\n }\n\n return attribute.joinColumn.referencedColumn === 'document_id';\n};\n\nexport const resolveLinkRef = (\n strapi: Core.Strapi,\n link: ILink,\n side: 'left' | 'right',\n mapID: (uid: string, id: number) => number | undefined\n): number | string | undefined => {\n const { type, ref } = side === 'left' ? link.left : link.right;\n\n if (isDocumentIdJoinColumnTarget(strapi, link, side)) {\n return ref;\n }\n\n const numericRef = typeof ref === 'number' ? ref : Number(ref);\n\n if (!Number.isFinite(numericRef)) {\n return undefined;\n }\n\n return mapID(type, numericRef);\n};\n"],"names":["isDocumentIdJoinColumnTarget","strapi","link","side","metadata","db","get","left","type","attribute","attributes","field","joinColumn","referencedColumn","resolveLinkRef","mapID","ref","right","numericRef","Number","isFinite","undefined"],"mappings":";;AAIA;;;;AAIC,IACM,MAAMA,4BAAAA,GAA+B,CAC1CC,QACAC,IAAAA,EACAC,IAAAA,GAAAA;AAEA,IAAA,IAAIA,SAAS,OAAA,EAAS;QACpB,OAAO,KAAA;AACT,IAAA;IAEA,MAAMC,QAAAA,GAAWH,OAAOI,EAAE,EAAED,UAAUE,GAAAA,CAAIJ,IAAAA,CAAKK,IAAI,CAACC,IAAI,CAAA;IACxD,MAAMC,SAAAA,GAAYL,UAAUM,UAAAA,GAAaR,KAAKK,IAAI,CAACI,KAAK,CAAC;AAEzD,IAAA,IAAI,CAACF,SAAAA,IAAaA,SAAAA,CAAUD,IAAI,KAAK,UAAA,EAAY;QAC/C,OAAO,KAAA;AACT,IAAA;IAEA,IAAI,EAAE,YAAA,IAAgBC,SAAQ,KAAM,CAACA,SAAAA,CAAUG,UAAU,EAAE;QACzD,OAAO,KAAA;AACT,IAAA;AAEA,IAAA,OAAOH,SAAAA,CAAUG,UAAU,CAACC,gBAAgB,KAAK,aAAA;AACnD;AAEO,MAAMC,cAAAA,GAAiB,CAC5Bb,MAAAA,EACAC,MACAC,IAAAA,EACAY,KAAAA,GAAAA;AAEA,IAAA,MAAM,EAAEP,IAAI,EAAEQ,GAAG,EAAE,GAAGb,IAAAA,KAAS,MAAA,GAASD,IAAAA,CAAKK,IAAI,GAAGL,IAAAA,CAAKe,KAAK;IAE9D,IAAIjB,4BAAAA,CAA6BC,MAAAA,EAAQC,IAAAA,EAAMC,IAAAA,CAAAA,EAAO;QACpD,OAAOa,GAAAA;AACT,IAAA;AAEA,IAAA,MAAME,UAAAA,GAAa,OAAOF,GAAAA,KAAQ,QAAA,GAAWA,MAAMG,MAAAA,CAAOH,GAAAA,CAAAA;AAE1D,IAAA,IAAI,CAACG,MAAAA,CAAOC,QAAQ,CAACF,UAAAA,CAAAA,EAAa;QAChC,OAAOG,SAAAA;AACT,IAAA;AAEA,IAAA,OAAON,MAAMP,IAAAA,EAAMU,UAAAA,CAAAA;AACrB;;;;;"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * joinColumn relations (e.g. i18n `localizations`) store `document_id` on the
3
+ * inverse side. Export emits that value as a string ref; restore must not run it
4
+ * through the numeric id mapper.
5
+ */ const isDocumentIdJoinColumnTarget = (strapi, link, side)=>{
6
+ if (side !== 'right') {
7
+ return false;
8
+ }
9
+ const metadata = strapi.db?.metadata?.get(link.left.type);
10
+ const attribute = metadata?.attributes?.[link.left.field];
11
+ if (!attribute || attribute.type !== 'relation') {
12
+ return false;
13
+ }
14
+ if (!('joinColumn' in attribute) || !attribute.joinColumn) {
15
+ return false;
16
+ }
17
+ return attribute.joinColumn.referencedColumn === 'document_id';
18
+ };
19
+ const resolveLinkRef = (strapi, link, side, mapID)=>{
20
+ const { type, ref } = side === 'left' ? link.left : link.right;
21
+ if (isDocumentIdJoinColumnTarget(strapi, link, side)) {
22
+ return ref;
23
+ }
24
+ const numericRef = typeof ref === 'number' ? ref : Number(ref);
25
+ if (!Number.isFinite(numericRef)) {
26
+ return undefined;
27
+ }
28
+ return mapID(type, numericRef);
29
+ };
30
+
31
+ export { isDocumentIdJoinColumnTarget, resolveLinkRef };
32
+ //# sourceMappingURL=resolve-link-ref.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-link-ref.mjs","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/resolve-link-ref.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport type { ILink } from '../../../../../types';\n\n/**\n * joinColumn relations (e.g. i18n `localizations`) store `document_id` on the\n * inverse side. Export emits that value as a string ref; restore must not run it\n * through the numeric id mapper.\n */\nexport const isDocumentIdJoinColumnTarget = (\n strapi: Core.Strapi,\n link: ILink,\n side: 'left' | 'right'\n): boolean => {\n if (side !== 'right') {\n return false;\n }\n\n const metadata = strapi.db?.metadata?.get(link.left.type);\n const attribute = metadata?.attributes?.[link.left.field];\n\n if (!attribute || attribute.type !== 'relation') {\n return false;\n }\n\n if (!('joinColumn' in attribute) || !attribute.joinColumn) {\n return false;\n }\n\n return attribute.joinColumn.referencedColumn === 'document_id';\n};\n\nexport const resolveLinkRef = (\n strapi: Core.Strapi,\n link: ILink,\n side: 'left' | 'right',\n mapID: (uid: string, id: number) => number | undefined\n): number | string | undefined => {\n const { type, ref } = side === 'left' ? link.left : link.right;\n\n if (isDocumentIdJoinColumnTarget(strapi, link, side)) {\n return ref;\n }\n\n const numericRef = typeof ref === 'number' ? ref : Number(ref);\n\n if (!Number.isFinite(numericRef)) {\n return undefined;\n }\n\n return mapID(type, numericRef);\n};\n"],"names":["isDocumentIdJoinColumnTarget","strapi","link","side","metadata","db","get","left","type","attribute","attributes","field","joinColumn","referencedColumn","resolveLinkRef","mapID","ref","right","numericRef","Number","isFinite","undefined"],"mappings":"AAIA;;;;AAIC,IACM,MAAMA,4BAAAA,GAA+B,CAC1CC,QACAC,IAAAA,EACAC,IAAAA,GAAAA;AAEA,IAAA,IAAIA,SAAS,OAAA,EAAS;QACpB,OAAO,KAAA;AACT,IAAA;IAEA,MAAMC,QAAAA,GAAWH,OAAOI,EAAE,EAAED,UAAUE,GAAAA,CAAIJ,IAAAA,CAAKK,IAAI,CAACC,IAAI,CAAA;IACxD,MAAMC,SAAAA,GAAYL,UAAUM,UAAAA,GAAaR,KAAKK,IAAI,CAACI,KAAK,CAAC;AAEzD,IAAA,IAAI,CAACF,SAAAA,IAAaA,SAAAA,CAAUD,IAAI,KAAK,UAAA,EAAY;QAC/C,OAAO,KAAA;AACT,IAAA;IAEA,IAAI,EAAE,YAAA,IAAgBC,SAAQ,KAAM,CAACA,SAAAA,CAAUG,UAAU,EAAE;QACzD,OAAO,KAAA;AACT,IAAA;AAEA,IAAA,OAAOH,SAAAA,CAAUG,UAAU,CAACC,gBAAgB,KAAK,aAAA;AACnD;AAEO,MAAMC,cAAAA,GAAiB,CAC5Bb,MAAAA,EACAC,MACAC,IAAAA,EACAY,KAAAA,GAAAA;AAEA,IAAA,MAAM,EAAEP,IAAI,EAAEQ,GAAG,EAAE,GAAGb,IAAAA,KAAS,MAAA,GAASD,IAAAA,CAAKK,IAAI,GAAGL,IAAAA,CAAKe,KAAK;IAE9D,IAAIjB,4BAAAA,CAA6BC,MAAAA,EAAQC,IAAAA,EAAMC,IAAAA,CAAAA,EAAO;QACpD,OAAOa,GAAAA;AACT,IAAA;AAEA,IAAA,MAAME,UAAAA,GAAa,OAAOF,GAAAA,KAAQ,QAAA,GAAWA,MAAMG,MAAAA,CAAOH,GAAAA,CAAAA;AAE1D,IAAA,IAAI,CAACG,MAAAA,CAAOC,QAAQ,CAACF,UAAAA,CAAAA,EAAa;QAChC,OAAOG,SAAAA;AACT,IAAA;AAEA,IAAA,OAAON,MAAMP,IAAAA,EAAMU,UAAAA,CAAAA;AACrB;;;;"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Duplex } from 'stream';
3
2
  import type { Core } from '@strapi/types';
4
3
  import type { IFile } from '../../../types';
@@ -1 +1 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/assets.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAyB,MAAM,QAAQ,CAAC;AAGvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAU,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAqCpD,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,UAAQ,GACd,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAwB3B;AAED,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,iBAiB/E;AAOD;;GAEG;AACH,eAAO,MAAM,kBAAkB,WACrB,KAAK,MAAM,YACV;IAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,KACjD,MAoFF,CAAC"}
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/assets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAyB,MAAM,QAAQ,CAAC;AAGvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAU,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAqCpD,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,UAAQ,GACd,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAwB3B;AAED,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,iBAiB/E;AAOD;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,IAAI,CAAC,MAAM,EACnB,UAAS;IAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAAO,KACtD,MAoFF,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Readable } from 'stream';
3
2
  import type { Core } from '@strapi/types';
4
3
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/configuration.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGlC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAI1C;;GAEG;AACH,eAAO,MAAM,yBAAyB,WAAY,KAAK,MAAM,KAAG,QAyB/D,CAAC"}
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGlC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAK1C;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,IAAI,CAAC,MAAM,KAAG,QAoC/D,CAAC"}
@@ -3,6 +3,7 @@
3
3
  var stream = require('stream');
4
4
  var streamChain = require('stream-chain');
5
5
  var fp = require('lodash/fp');
6
+ var projectSettingsLogos = require('../../utils/project-settings-logos.js');
6
7
 
7
8
  /**
8
9
  * Create a readable stream that export the Strapi app configuration
@@ -25,6 +26,13 @@ var fp = require('lodash/fp');
25
26
  ];
26
27
  for (const stream of streams){
27
28
  for await (const item of stream){
29
+ if (item.type === 'core-store') {
30
+ yield {
31
+ ...item,
32
+ value: await projectSettingsLogos.enrichProjectSettingsForExport(strapi, item.value)
33
+ };
34
+ continue;
35
+ }
28
36
  yield item;
29
37
  }
30
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.js","sources":["../../../../src/strapi/providers/local-source/configuration.ts"],"sourcesContent":["import { Readable } from 'stream';\nimport { chain } from 'stream-chain';\nimport { set } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\n\nimport type { IConfiguration } from '../../../types';\n\n/**\n * Create a readable stream that export the Strapi app configuration\n */\nexport const createConfigurationStream = (strapi: Core.Strapi): Readable => {\n return Readable.from(\n (async function* configurationGenerator(): AsyncGenerator<IConfiguration> {\n // Core Store\n const coreStoreStream = chain([\n strapi.db.queryBuilder('strapi::core-store').stream(),\n (data) => set('value', JSON.parse(data.value), data),\n wrapConfigurationItem('core-store'),\n ]);\n\n // Webhook\n const webhooksStream = chain([\n strapi.db.queryBuilder('strapi::webhook').stream(),\n wrapConfigurationItem('webhook'),\n ]);\n\n const streams = [coreStoreStream, webhooksStream];\n\n for (const stream of streams) {\n for await (const item of stream) {\n yield item;\n }\n }\n })()\n );\n};\n\nconst wrapConfigurationItem = (type: 'core-store' | 'webhook') => (value: unknown) => ({\n type,\n value,\n});\n"],"names":["createConfigurationStream","strapi","Readable","from","configurationGenerator","coreStoreStream","chain","db","queryBuilder","stream","data","set","JSON","parse","value","wrapConfigurationItem","webhooksStream","streams","item","type"],"mappings":";;;;;;AAOA;;IAGO,MAAMA,yBAAAA,GAA4B,CAACC,MAAAA,GAAAA;AACxC,IAAA,OAAOC,eAAAA,CAASC,IAAI,CACjB,gBAAgBC,sBAAAA,GAAAA;;AAEf,QAAA,MAAMC,kBAAkBC,iBAAAA,CAAM;AAC5BL,YAAAA,MAAAA,CAAOM,EAAE,CAACC,YAAY,CAAC,sBAAsBC,MAAM,EAAA;YACnD,CAACC,IAAAA,GAASC,OAAI,OAAA,EAASC,IAAAA,CAAKC,KAAK,CAACH,IAAAA,CAAKI,KAAK,CAAA,EAAGJ,IAAAA,CAAAA;YAC/CK,qBAAAA,CAAsB,YAAA;AACvB,SAAA,CAAA;;AAGD,QAAA,MAAMC,iBAAiBV,iBAAAA,CAAM;AAC3BL,YAAAA,MAAAA,CAAOM,EAAE,CAACC,YAAY,CAAC,mBAAmBC,MAAM,EAAA;YAChDM,qBAAAA,CAAsB,SAAA;AACvB,SAAA,CAAA;AAED,QAAA,MAAME,OAAAA,GAAU;AAACZ,YAAAA,eAAAA;AAAiBW,YAAAA;AAAe,SAAA;QAEjD,KAAK,MAAMP,UAAUQ,OAAAA,CAAS;YAC5B,WAAW,MAAMC,QAAQT,MAAAA,CAAQ;gBAC/B,MAAMS,IAAAA;AACR,YAAA;AACF,QAAA;AACF,IAAA,CAAA,EAAA,CAAA;AAEJ;AAEA,MAAMH,qBAAAA,GAAwB,CAACI,IAAAA,GAAmC,CAACL,SAAoB;AACrFK,YAAAA,IAAAA;AACAL,YAAAA;SACF,CAAA;;;;"}
1
+ {"version":3,"file":"configuration.js","sources":["../../../../src/strapi/providers/local-source/configuration.ts"],"sourcesContent":["import { Readable } from 'stream';\nimport { chain } from 'stream-chain';\nimport { set } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\n\nimport type { IConfiguration } from '../../../types';\nimport { enrichProjectSettingsForExport } from '../../utils/project-settings-logos';\n\n/**\n * Create a readable stream that export the Strapi app configuration\n */\nexport const createConfigurationStream = (strapi: Core.Strapi): Readable => {\n return Readable.from(\n (async function* configurationGenerator(): AsyncGenerator<IConfiguration> {\n // Core Store\n const coreStoreStream = chain([\n strapi.db.queryBuilder('strapi::core-store').stream(),\n (data) => set('value', JSON.parse(data.value), data),\n wrapConfigurationItem('core-store'),\n ]);\n\n // Webhook\n const webhooksStream = chain([\n strapi.db.queryBuilder('strapi::webhook').stream(),\n wrapConfigurationItem('webhook'),\n ]);\n\n const streams = [coreStoreStream, webhooksStream];\n\n for (const stream of streams) {\n for await (const item of stream) {\n if (item.type === 'core-store') {\n yield {\n ...item,\n value: await enrichProjectSettingsForExport(\n strapi,\n item.value as { key: string; value: unknown }\n ),\n };\n continue;\n }\n\n yield item;\n }\n }\n })()\n );\n};\n\nconst wrapConfigurationItem = (type: 'core-store' | 'webhook') => (value: unknown) => ({\n type,\n value,\n});\n"],"names":["createConfigurationStream","strapi","Readable","from","configurationGenerator","coreStoreStream","chain","db","queryBuilder","stream","data","set","JSON","parse","value","wrapConfigurationItem","webhooksStream","streams","item","type","enrichProjectSettingsForExport"],"mappings":";;;;;;;AAQA;;IAGO,MAAMA,yBAAAA,GAA4B,CAACC,MAAAA,GAAAA;AACxC,IAAA,OAAOC,eAAAA,CAASC,IAAI,CACjB,gBAAgBC,sBAAAA,GAAAA;;AAEf,QAAA,MAAMC,kBAAkBC,iBAAAA,CAAM;AAC5BL,YAAAA,MAAAA,CAAOM,EAAE,CAACC,YAAY,CAAC,sBAAsBC,MAAM,EAAA;YACnD,CAACC,IAAAA,GAASC,OAAI,OAAA,EAASC,IAAAA,CAAKC,KAAK,CAACH,IAAAA,CAAKI,KAAK,CAAA,EAAGJ,IAAAA,CAAAA;YAC/CK,qBAAAA,CAAsB,YAAA;AACvB,SAAA,CAAA;;AAGD,QAAA,MAAMC,iBAAiBV,iBAAAA,CAAM;AAC3BL,YAAAA,MAAAA,CAAOM,EAAE,CAACC,YAAY,CAAC,mBAAmBC,MAAM,EAAA;YAChDM,qBAAAA,CAAsB,SAAA;AACvB,SAAA,CAAA;AAED,QAAA,MAAME,OAAAA,GAAU;AAACZ,YAAAA,eAAAA;AAAiBW,YAAAA;AAAe,SAAA;QAEjD,KAAK,MAAMP,UAAUQ,OAAAA,CAAS;YAC5B,WAAW,MAAMC,QAAQT,MAAAA,CAAQ;gBAC/B,IAAIS,IAAAA,CAAKC,IAAI,KAAK,YAAA,EAAc;oBAC9B,MAAM;AACJ,wBAAA,GAAGD,IAAI;AACPJ,wBAAAA,KAAAA,EAAO,MAAMM,mDAAAA,CACXnB,MAAAA,EACAiB,IAAAA,CAAKJ,KAAK;AAEd,qBAAA;AACA,oBAAA;AACF,gBAAA;gBAEA,MAAMI,IAAAA;AACR,YAAA;AACF,QAAA;AACF,IAAA,CAAA,EAAA,CAAA;AAEJ;AAEA,MAAMH,qBAAAA,GAAwB,CAACI,IAAAA,GAAmC,CAACL,SAAoB;AACrFK,YAAAA,IAAAA;AACAL,YAAAA;SACF,CAAA;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { Readable } from 'stream';
2
2
  import { chain } from 'stream-chain';
3
3
  import { set } from 'lodash/fp';
4
+ import { enrichProjectSettingsForExport } from '../../utils/project-settings-logos.mjs';
4
5
 
5
6
  /**
6
7
  * Create a readable stream that export the Strapi app configuration
@@ -23,6 +24,13 @@ import { set } from 'lodash/fp';
23
24
  ];
24
25
  for (const stream of streams){
25
26
  for await (const item of stream){
27
+ if (item.type === 'core-store') {
28
+ yield {
29
+ ...item,
30
+ value: await enrichProjectSettingsForExport(strapi, item.value)
31
+ };
32
+ continue;
33
+ }
26
34
  yield item;
27
35
  }
28
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.mjs","sources":["../../../../src/strapi/providers/local-source/configuration.ts"],"sourcesContent":["import { Readable } from 'stream';\nimport { chain } from 'stream-chain';\nimport { set } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\n\nimport type { IConfiguration } from '../../../types';\n\n/**\n * Create a readable stream that export the Strapi app configuration\n */\nexport const createConfigurationStream = (strapi: Core.Strapi): Readable => {\n return Readable.from(\n (async function* configurationGenerator(): AsyncGenerator<IConfiguration> {\n // Core Store\n const coreStoreStream = chain([\n strapi.db.queryBuilder('strapi::core-store').stream(),\n (data) => set('value', JSON.parse(data.value), data),\n wrapConfigurationItem('core-store'),\n ]);\n\n // Webhook\n const webhooksStream = chain([\n strapi.db.queryBuilder('strapi::webhook').stream(),\n wrapConfigurationItem('webhook'),\n ]);\n\n const streams = [coreStoreStream, webhooksStream];\n\n for (const stream of streams) {\n for await (const item of stream) {\n yield item;\n }\n }\n })()\n );\n};\n\nconst wrapConfigurationItem = (type: 'core-store' | 'webhook') => (value: unknown) => ({\n type,\n value,\n});\n"],"names":["createConfigurationStream","strapi","Readable","from","configurationGenerator","coreStoreStream","chain","db","queryBuilder","stream","data","set","JSON","parse","value","wrapConfigurationItem","webhooksStream","streams","item","type"],"mappings":";;;;AAOA;;IAGO,MAAMA,yBAAAA,GAA4B,CAACC,MAAAA,GAAAA;AACxC,IAAA,OAAOC,QAAAA,CAASC,IAAI,CACjB,gBAAgBC,sBAAAA,GAAAA;;AAEf,QAAA,MAAMC,kBAAkBC,KAAAA,CAAM;AAC5BL,YAAAA,MAAAA,CAAOM,EAAE,CAACC,YAAY,CAAC,sBAAsBC,MAAM,EAAA;YACnD,CAACC,IAAAA,GAASC,IAAI,OAAA,EAASC,IAAAA,CAAKC,KAAK,CAACH,IAAAA,CAAKI,KAAK,CAAA,EAAGJ,IAAAA,CAAAA;YAC/CK,qBAAAA,CAAsB,YAAA;AACvB,SAAA,CAAA;;AAGD,QAAA,MAAMC,iBAAiBV,KAAAA,CAAM;AAC3BL,YAAAA,MAAAA,CAAOM,EAAE,CAACC,YAAY,CAAC,mBAAmBC,MAAM,EAAA;YAChDM,qBAAAA,CAAsB,SAAA;AACvB,SAAA,CAAA;AAED,QAAA,MAAME,OAAAA,GAAU;AAACZ,YAAAA,eAAAA;AAAiBW,YAAAA;AAAe,SAAA;QAEjD,KAAK,MAAMP,UAAUQ,OAAAA,CAAS;YAC5B,WAAW,MAAMC,QAAQT,MAAAA,CAAQ;gBAC/B,MAAMS,IAAAA;AACR,YAAA;AACF,QAAA;AACF,IAAA,CAAA,EAAA,CAAA;AAEJ;AAEA,MAAMH,qBAAAA,GAAwB,CAACI,IAAAA,GAAmC,CAACL,SAAoB;AACrFK,YAAAA,IAAAA;AACAL,YAAAA;SACF,CAAA;;;;"}
1
+ {"version":3,"file":"configuration.mjs","sources":["../../../../src/strapi/providers/local-source/configuration.ts"],"sourcesContent":["import { Readable } from 'stream';\nimport { chain } from 'stream-chain';\nimport { set } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\n\nimport type { IConfiguration } from '../../../types';\nimport { enrichProjectSettingsForExport } from '../../utils/project-settings-logos';\n\n/**\n * Create a readable stream that export the Strapi app configuration\n */\nexport const createConfigurationStream = (strapi: Core.Strapi): Readable => {\n return Readable.from(\n (async function* configurationGenerator(): AsyncGenerator<IConfiguration> {\n // Core Store\n const coreStoreStream = chain([\n strapi.db.queryBuilder('strapi::core-store').stream(),\n (data) => set('value', JSON.parse(data.value), data),\n wrapConfigurationItem('core-store'),\n ]);\n\n // Webhook\n const webhooksStream = chain([\n strapi.db.queryBuilder('strapi::webhook').stream(),\n wrapConfigurationItem('webhook'),\n ]);\n\n const streams = [coreStoreStream, webhooksStream];\n\n for (const stream of streams) {\n for await (const item of stream) {\n if (item.type === 'core-store') {\n yield {\n ...item,\n value: await enrichProjectSettingsForExport(\n strapi,\n item.value as { key: string; value: unknown }\n ),\n };\n continue;\n }\n\n yield item;\n }\n }\n })()\n );\n};\n\nconst wrapConfigurationItem = (type: 'core-store' | 'webhook') => (value: unknown) => ({\n type,\n value,\n});\n"],"names":["createConfigurationStream","strapi","Readable","from","configurationGenerator","coreStoreStream","chain","db","queryBuilder","stream","data","set","JSON","parse","value","wrapConfigurationItem","webhooksStream","streams","item","type","enrichProjectSettingsForExport"],"mappings":";;;;;AAQA;;IAGO,MAAMA,yBAAAA,GAA4B,CAACC,MAAAA,GAAAA;AACxC,IAAA,OAAOC,QAAAA,CAASC,IAAI,CACjB,gBAAgBC,sBAAAA,GAAAA;;AAEf,QAAA,MAAMC,kBAAkBC,KAAAA,CAAM;AAC5BL,YAAAA,MAAAA,CAAOM,EAAE,CAACC,YAAY,CAAC,sBAAsBC,MAAM,EAAA;YACnD,CAACC,IAAAA,GAASC,IAAI,OAAA,EAASC,IAAAA,CAAKC,KAAK,CAACH,IAAAA,CAAKI,KAAK,CAAA,EAAGJ,IAAAA,CAAAA;YAC/CK,qBAAAA,CAAsB,YAAA;AACvB,SAAA,CAAA;;AAGD,QAAA,MAAMC,iBAAiBV,KAAAA,CAAM;AAC3BL,YAAAA,MAAAA,CAAOM,EAAE,CAACC,YAAY,CAAC,mBAAmBC,MAAM,EAAA;YAChDM,qBAAAA,CAAsB,SAAA;AACvB,SAAA,CAAA;AAED,QAAA,MAAME,OAAAA,GAAU;AAACZ,YAAAA,eAAAA;AAAiBW,YAAAA;AAAe,SAAA;QAEjD,KAAK,MAAMP,UAAUQ,OAAAA,CAAS;YAC5B,WAAW,MAAMC,QAAQT,MAAAA,CAAQ;gBAC/B,IAAIS,IAAAA,CAAKC,IAAI,KAAK,YAAA,EAAc;oBAC9B,MAAM;AACJ,wBAAA,GAAGD,IAAI;AACPJ,wBAAAA,KAAAA,EAAO,MAAMM,8BAAAA,CACXnB,MAAAA,EACAiB,IAAAA,CAAKJ,KAAK;AAEd,qBAAA;AACA,oBAAA;AACF,gBAAA;gBAEA,MAAMI,IAAAA;AACR,YAAA;AACF,QAAA;AACF,IAAA,CAAA,EAAA,CAAA;AAEJ;AAEA,MAAMH,qBAAAA,GAAwB,CAACI,IAAAA,GAAmC,CAACL,SAAoB;AACrFK,YAAAA,IAAAA;AACAL,YAAAA;SACF,CAAA;;;;"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Readable, Transform } from 'stream';
3
2
  import type { Core } from '@strapi/types';
4
3
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/entities.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAU,MAAM,eAAe,CAAC;AAKlD;;GAEG;AACH,eAAO,MAAM,oBAAoB,WACvB,KAAK,MAAM,YACV;IAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,KACjD,QA8CF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,QAAO,SAchD,CAAC"}
1
+ {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAU,MAAM,eAAe,CAAC;AAKlD;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,IAAI,CAAC,MAAM,EACnB,UAAS;IAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAAO,KACtD,QA8CF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,QAAO,SAchD,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Readable } from 'stream';
3
2
  import type { Core, Struct } from '@strapi/types';
4
3
  import type { IMetadata, ISourceProvider, ProviderType, TransferStage } from '../../../types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AASrE,MAAM,WAAW,iCAAiC;IAChD,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEhD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,+BAA+B,YAAa,iCAAiC,8BAEzF,CAAC;AAEF,cAAM,yBAA0B,YAAW,eAAe;;IACxD,IAAI,SAA0B;IAE9B,IAAI,EAAE,YAAY,CAAY;IAE9B,OAAO,EAAE,iCAAiC,CAAC;IAE3C,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;gBAIT,OAAO,EAAE,iCAAiC;IAIhD,SAAS,CAAC,WAAW,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IA4D3D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAU5B,WAAW,IAAI,SAAS;IAclB,wBAAwB,IAAI,OAAO,CAAC,QAAQ,CAAC;IAiBnD,qBAAqB,IAAI,QAAQ;IAOjC,6BAA6B,IAAI,QAAQ;IAMzC,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;IAW3C,uBAAuB,IAAI,QAAQ;IAInC,sBA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AM,EAAE,MAAM,CAAC,MAAM,CAAC;IAW3C,uBAAuB,IAAI,QAAQ;IAInC,sBAAsB,IAAI,QAAQ;IAc5B,cAAc,CAAC,KAAK,EAAE,aAAa;CAO1C;AAED,MAAM,MAAM,0BAA0B,GAAG,YAAY,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAExF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Readable } from 'stream';
3
2
  import type { Core } from '@strapi/types';
4
3
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/links.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAK1C;;GAEG;AACH,eAAO,MAAM,iBAAiB,WAAY,KAAK,MAAM,KAAG,QAiBvD,CAAC"}
1
+ {"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAK1C;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,IAAI,CAAC,MAAM,KAAG,QAiBvD,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Writable } from 'stream';
3
2
  import { WebSocket } from 'ws';
4
3
  import type { Struct, Utils } from '@strapi/types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/remote-destination/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/B,OAA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OAAO,CAAC;CAC3B;AAwBD,cAAM,+BAAgC,YAAW,oBAAoB;;IACnE,IAAI,SAAgC;IAEpC,IAAI,EAAE,YAAY,CAAiB;IAEnC,OAAO,EAAE,uCAAuC,CAAC;IAEjD,EAAE,EAAE,SAAS,GAAG,IAAI,CAAC;IAErB,UAAU,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAAG,IAAI,CAAC;IAEvD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B,KAAK,EAAG;SAAG,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE;KAAE,CAAC;gBAajE,OAAO,EAAE,uCAAuC;IAU5D,OAAO,CAAC,UAAU;IASZ,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IA4O/B,SAAS,CAAC,WAAW,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IA+D3D,KAAK;IAuBX,WAAW;IAIL,cAAc;IAOd,QAAQ;IAId,UAAU;IAQV,yBAAyB,IAAI,QAAQ;IAIrC,sBAAsB,IAAI,QAAQ;IAIlC,8BAA8B,IAAI,QAAQ;IAI1C,uBAAuB,IAAI,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;CAyFxD;AAED,eAAO,MAAM,qCAAqC,GAChD,SAAS,uCAAuC,oCAGjD,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Readable } from 'stream';
3
2
  import type { Struct, Utils } from '@strapi/types';
4
3
  import { WebSocket } from 'ws';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/remote-source/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAe,QAAQ,EAAY,MAAM,QAAQ,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,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AC;IACF,yHAAyH;IACzH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAKD,cAAM,0BAA2B,YAAW,eAAe;;IACzD,IAAI,SAA2B;IAE/B,IAAI,EAAE,YAAY,CAAY;IAE9B,OAAO,EAAE,kCAAkC,CAAC;IAE5C,EAAE,EAAE,SAAS,GAAG,IAAI,CAAC;IAErB,UAAU,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAAG,IAAI,CAAC;IAEvD,cAAc,EAAE,OAAO,CAAC,kCAAkC,CAAC,CAGzD;gBAEU,OAAO,EAAE,kCAAkC;IAWvD,OAAO,CAAC,EAAE,8BAA8B,GAAG,SAAS,CAAC;IA2ErD,wBAAwB,IAAI,YAAY,CAAC,QAAQ,CAAC;IAIlD,qBAAqB,IAAI,YAAY,CAAC,QAAQ,CAAC;IAIzC,sBAAsB,IAAI,OAAO,CAAC,QAAQ,CAAC;IAgSjD,6BAA6B,IAAI,YAAY,CAAC,QAAQ,CAAC;IAIjD,WAAW,IAAI,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAM9C,mBAAmB,CAAC,GAAG,EAAE,GAAG;IActB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IA+C/B,SAAS,CAAC,WAAW,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoD3D,KAAK;IAeL,UAAU;IAOV,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAwDhF;AAED,eAAO,MAAM,gCAAgC,GAAI,SAAS,kCAAkC,+BAE3F,CAAC"}
@@ -20,20 +20,20 @@ type Dispatch<T> = Omit<T, 'transferID' | 'uuid'>;
20
20
  export declare const createDispatcher: (ws: WebSocket, retryMessageOptions?: RetryMessageOptions, reportInfo?: (message: string) => void) => {
21
21
  readonly transferID: string | undefined;
22
22
  readonly transferKind: "push" | "pull" | undefined;
23
- setTransferProperties: (properties: Exclude<IDispatcherState['transfer'], undefined>) => void;
23
+ setTransferProperties: (properties: Exclude<IDispatcherState["transfer"], undefined>) => void;
24
24
  dispatch: <U = null>(message: Dispatch<Client.Message>, options?: IDispatchOptions) => Promise<U | null>;
25
- dispatchCommand: <U_1 extends "end" | "init" | "status">(payload: {
26
- command: U_1;
27
- } & ([Client.GetCommandParams<U_1>] extends [never] ? unknown : {
28
- params?: Client.GetCommandParams<U_1> | undefined;
25
+ dispatchCommand: <U extends Client.Command>(payload: {
26
+ command: U;
27
+ } & ([Client.GetCommandParams<U>] extends [never] ? unknown : {
28
+ params?: Client.GetCommandParams<U>;
29
29
  })) => Promise<null>;
30
- dispatchTransferAction: <T>(action: Client.Action['action']) => Promise<T | null>;
31
- dispatchTransferStep: <T_1, A extends "end" | "stream" | "start" = "end" | "stream" | "start", S extends "entities" | "links" | "assets" | "configuration" = "entities" | "links" | "assets" | "configuration">(payload: {
30
+ dispatchTransferAction: <T>(action: Client.Action["action"]) => Promise<T | null>;
31
+ dispatchTransferStep: <T, A extends Client.TransferPushMessage["action"] = "end" | "stream" | "start", S extends Client.TransferPushStep = "entities" | "links" | "assets" | "configuration">(payload: {
32
32
  step: S;
33
33
  action: A;
34
- } & (A extends 'stream' ? {
34
+ } & (A extends "stream" ? {
35
35
  data: Client.GetTransferPushStreamData<S>;
36
- } : unknown), dispatchOptions?: Omit<IDispatchOptions, 'attachTransfer'>) => Promise<T_1 | null>;
36
+ } : unknown), dispatchOptions?: Omit<IDispatchOptions, "attachTransfer">) => Promise<T | null>;
37
37
  };
38
38
  type WebsocketParams = ConstructorParameters<typeof WebSocket>;
39
39
  type Address = WebsocketParams[0];