@strapi/data-transfer 0.0.0-experimental.62ce06180fe9a772eaeb3d43d238b26644f39f7c → 0.0.0-experimental.6340da17068c3bed7fb006e7bcc554c71129e282

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 (395) hide show
  1. package/LICENSE +19 -4
  2. package/dist/directory/index.d.ts +2 -0
  3. package/dist/directory/index.d.ts.map +1 -0
  4. package/dist/directory/index.js +8 -0
  5. package/dist/directory/index.js.map +1 -0
  6. package/dist/directory/index.mjs +3 -0
  7. package/dist/directory/index.mjs.map +1 -0
  8. package/dist/directory/providers/destination/index.d.ts +38 -0
  9. package/dist/directory/providers/destination/index.d.ts.map +1 -0
  10. package/dist/directory/providers/destination/index.js +184 -0
  11. package/dist/directory/providers/destination/index.js.map +1 -0
  12. package/dist/directory/providers/destination/index.mjs +177 -0
  13. package/dist/directory/providers/destination/index.mjs.map +1 -0
  14. package/dist/directory/providers/destination/utils.d.ts +8 -0
  15. package/dist/directory/providers/destination/utils.d.ts.map +1 -0
  16. package/dist/directory/providers/destination/utils.js +62 -0
  17. package/dist/directory/providers/destination/utils.js.map +1 -0
  18. package/dist/directory/providers/destination/utils.mjs +56 -0
  19. package/dist/directory/providers/destination/utils.mjs.map +1 -0
  20. package/dist/directory/providers/index.d.ts +3 -0
  21. package/dist/directory/providers/index.d.ts.map +1 -0
  22. package/dist/directory/providers/index.js +10 -0
  23. package/dist/directory/providers/index.js.map +1 -0
  24. package/dist/directory/providers/index.mjs +3 -0
  25. package/dist/directory/providers/index.mjs.map +1 -0
  26. package/dist/directory/providers/source/index.d.ts +27 -0
  27. package/dist/directory/providers/source/index.d.ts.map +1 -0
  28. package/dist/directory/providers/source/index.js +266 -0
  29. package/dist/directory/providers/source/index.js.map +1 -0
  30. package/dist/directory/providers/source/index.mjs +259 -0
  31. package/dist/directory/providers/source/index.mjs.map +1 -0
  32. package/dist/engine/errors.js +39 -0
  33. package/dist/engine/errors.js.map +1 -0
  34. package/dist/engine/errors.mjs +34 -0
  35. package/dist/engine/errors.mjs.map +1 -0
  36. package/dist/engine/index.d.ts +2 -3
  37. package/dist/engine/index.d.ts.map +1 -1
  38. package/dist/engine/index.js +922 -0
  39. package/dist/engine/index.js.map +1 -0
  40. package/dist/engine/index.mjs +917 -0
  41. package/dist/engine/index.mjs.map +1 -0
  42. package/dist/engine/validation/provider.d.ts +2 -2
  43. package/dist/engine/validation/provider.d.ts.map +1 -1
  44. package/dist/engine/validation/provider.js +19 -0
  45. package/dist/engine/validation/provider.js.map +1 -0
  46. package/dist/engine/validation/provider.mjs +17 -0
  47. package/dist/engine/validation/provider.mjs.map +1 -0
  48. package/dist/engine/validation/schemas/index.d.ts.map +1 -1
  49. package/dist/engine/validation/schemas/index.js +59 -0
  50. package/dist/engine/validation/schemas/index.js.map +1 -0
  51. package/dist/engine/validation/schemas/index.mjs +57 -0
  52. package/dist/engine/validation/schemas/index.mjs.map +1 -0
  53. package/dist/errors/base.js +13 -0
  54. package/dist/errors/base.js.map +1 -0
  55. package/dist/errors/base.mjs +11 -0
  56. package/dist/errors/base.mjs.map +1 -0
  57. package/dist/errors/constants.d.ts +1 -1
  58. package/dist/errors/constants.d.ts.map +1 -1
  59. package/dist/errors/constants.js +9 -0
  60. package/dist/errors/constants.js.map +1 -0
  61. package/dist/errors/constants.mjs +7 -0
  62. package/dist/errors/constants.mjs.map +1 -0
  63. package/dist/errors/providers.d.ts +1 -1
  64. package/dist/errors/providers.d.ts.map +1 -1
  65. package/dist/errors/providers.js +41 -0
  66. package/dist/errors/providers.js.map +1 -0
  67. package/dist/errors/providers.mjs +36 -0
  68. package/dist/errors/providers.mjs.map +1 -0
  69. package/dist/file/index.js +8 -0
  70. package/dist/file/index.js.map +1 -0
  71. package/dist/file/index.mjs +3 -0
  72. package/dist/file/index.mjs.map +1 -0
  73. package/dist/file/providers/destination/index.d.ts +3 -5
  74. package/dist/file/providers/destination/index.d.ts.map +1 -1
  75. package/dist/file/providers/destination/index.js +254 -0
  76. package/dist/file/providers/destination/index.js.map +1 -0
  77. package/dist/file/providers/destination/index.mjs +246 -0
  78. package/dist/file/providers/destination/index.mjs.map +1 -0
  79. package/dist/file/providers/destination/utils.d.ts +0 -1
  80. package/dist/file/providers/destination/utils.d.ts.map +1 -1
  81. package/dist/file/providers/destination/utils.js +63 -0
  82. package/dist/file/providers/destination/utils.js.map +1 -0
  83. package/dist/file/providers/destination/utils.mjs +60 -0
  84. package/dist/file/providers/destination/utils.mjs.map +1 -0
  85. package/dist/file/providers/index.js +10 -0
  86. package/dist/file/providers/index.js.map +1 -0
  87. package/dist/file/providers/index.mjs +3 -0
  88. package/dist/file/providers/index.mjs.map +1 -0
  89. package/dist/file/providers/source/index.d.ts +3 -3
  90. package/dist/file/providers/source/index.d.ts.map +1 -1
  91. package/dist/file/providers/source/index.js +336 -0
  92. package/dist/file/providers/source/index.js.map +1 -0
  93. package/dist/file/providers/source/index.mjs +328 -0
  94. package/dist/file/providers/source/index.mjs.map +1 -0
  95. package/dist/file/providers/source/utils.d.ts.map +1 -1
  96. package/dist/file/providers/source/utils.js +60 -0
  97. package/dist/file/providers/source/utils.js.map +1 -0
  98. package/dist/file/providers/source/utils.mjs +52 -0
  99. package/dist/file/providers/source/utils.mjs.map +1 -0
  100. package/dist/index.d.ts +1 -0
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +15 -4408
  103. package/dist/index.js.map +1 -1
  104. package/dist/index.mjs +10 -4382
  105. package/dist/index.mjs.map +1 -1
  106. package/dist/strapi/index.js +12 -0
  107. package/dist/strapi/index.js.map +1 -0
  108. package/dist/strapi/index.mjs +7 -0
  109. package/dist/strapi/index.mjs.map +1 -0
  110. package/dist/strapi/providers/index.js +18 -0
  111. package/dist/strapi/providers/index.js.map +1 -0
  112. package/dist/strapi/providers/index.mjs +8 -0
  113. package/dist/strapi/providers/index.mjs.map +1 -0
  114. package/dist/strapi/providers/local-destination/assets-destination-writable.d.ts +26 -0
  115. package/dist/strapi/providers/local-destination/assets-destination-writable.d.ts.map +1 -0
  116. package/dist/strapi/providers/local-destination/assets-destination-writable.js +125 -0
  117. package/dist/strapi/providers/local-destination/assets-destination-writable.js.map +1 -0
  118. package/dist/strapi/providers/local-destination/assets-destination-writable.mjs +123 -0
  119. package/dist/strapi/providers/local-destination/assets-destination-writable.mjs.map +1 -0
  120. package/dist/strapi/providers/local-destination/index.d.ts +5 -3
  121. package/dist/strapi/providers/local-destination/index.d.ts.map +1 -1
  122. package/dist/strapi/providers/local-destination/index.js +362 -0
  123. package/dist/strapi/providers/local-destination/index.js.map +1 -0
  124. package/dist/strapi/providers/local-destination/index.mjs +335 -0
  125. package/dist/strapi/providers/local-destination/index.mjs.map +1 -0
  126. package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts +1 -2
  127. package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts.map +1 -1
  128. package/dist/strapi/providers/local-destination/strategies/restore/configuration.js +58 -0
  129. package/dist/strapi/providers/local-destination/strategies/restore/configuration.js.map +1 -0
  130. package/dist/strapi/providers/local-destination/strategies/restore/configuration.mjs +51 -0
  131. package/dist/strapi/providers/local-destination/strategies/restore/configuration.mjs.map +1 -0
  132. package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts +1 -2
  133. package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts.map +1 -1
  134. package/dist/strapi/providers/local-destination/strategies/restore/entities.js +54 -0
  135. package/dist/strapi/providers/local-destination/strategies/restore/entities.js.map +1 -0
  136. package/dist/strapi/providers/local-destination/strategies/restore/entities.mjs +52 -0
  137. package/dist/strapi/providers/local-destination/strategies/restore/entities.mjs.map +1 -0
  138. package/dist/strapi/providers/local-destination/strategies/restore/index.d.ts.map +1 -1
  139. package/dist/strapi/providers/local-destination/strategies/restore/index.js +124 -0
  140. package/dist/strapi/providers/local-destination/strategies/restore/index.js.map +1 -0
  141. package/dist/strapi/providers/local-destination/strategies/restore/index.mjs +120 -0
  142. package/dist/strapi/providers/local-destination/strategies/restore/index.mjs.map +1 -0
  143. package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts +1 -2
  144. package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts.map +1 -1
  145. package/dist/strapi/providers/local-destination/strategies/restore/links.js +79 -0
  146. package/dist/strapi/providers/local-destination/strategies/restore/links.js.map +1 -0
  147. package/dist/strapi/providers/local-destination/strategies/restore/links.mjs +77 -0
  148. package/dist/strapi/providers/local-destination/strategies/restore/links.mjs.map +1 -0
  149. package/dist/strapi/providers/local-source/assets.d.ts +8 -2
  150. package/dist/strapi/providers/local-source/assets.d.ts.map +1 -1
  151. package/dist/strapi/providers/local-source/assets.js +151 -0
  152. package/dist/strapi/providers/local-source/assets.js.map +1 -0
  153. package/dist/strapi/providers/local-source/assets.mjs +147 -0
  154. package/dist/strapi/providers/local-source/assets.mjs.map +1 -0
  155. package/dist/strapi/providers/local-source/configuration.d.ts +0 -1
  156. package/dist/strapi/providers/local-source/configuration.d.ts.map +1 -1
  157. package/dist/strapi/providers/local-source/configuration.js +47 -0
  158. package/dist/strapi/providers/local-source/configuration.js.map +1 -0
  159. package/dist/strapi/providers/local-source/configuration.mjs +45 -0
  160. package/dist/strapi/providers/local-source/configuration.mjs.map +1 -0
  161. package/dist/strapi/providers/local-source/entities.d.ts +3 -2
  162. package/dist/strapi/providers/local-source/entities.d.ts.map +1 -1
  163. package/dist/strapi/providers/local-source/entities.js +66 -0
  164. package/dist/strapi/providers/local-source/entities.js.map +1 -0
  165. package/dist/strapi/providers/local-source/entities.mjs +63 -0
  166. package/dist/strapi/providers/local-source/entities.mjs.map +1 -0
  167. package/dist/strapi/providers/local-source/estimate-asset-totals.d.ts +11 -0
  168. package/dist/strapi/providers/local-source/estimate-asset-totals.d.ts.map +1 -0
  169. package/dist/strapi/providers/local-source/estimate-asset-totals.js +130 -0
  170. package/dist/strapi/providers/local-source/estimate-asset-totals.js.map +1 -0
  171. package/dist/strapi/providers/local-source/estimate-asset-totals.mjs +128 -0
  172. package/dist/strapi/providers/local-source/estimate-asset-totals.mjs.map +1 -0
  173. package/dist/strapi/providers/local-source/index.d.ts +6 -4
  174. package/dist/strapi/providers/local-source/index.d.ts.map +1 -1
  175. package/dist/strapi/providers/local-source/index.js +186 -0
  176. package/dist/strapi/providers/local-source/index.js.map +1 -0
  177. package/dist/strapi/providers/local-source/index.mjs +183 -0
  178. package/dist/strapi/providers/local-source/index.mjs.map +1 -0
  179. package/dist/strapi/providers/local-source/links.d.ts +0 -1
  180. package/dist/strapi/providers/local-source/links.d.ts.map +1 -1
  181. package/dist/strapi/providers/local-source/links.js +26 -0
  182. package/dist/strapi/providers/local-source/links.js.map +1 -0
  183. package/dist/strapi/providers/local-source/links.mjs +24 -0
  184. package/dist/strapi/providers/local-source/links.mjs.map +1 -0
  185. package/dist/strapi/providers/remote-destination/index.d.ts +13 -5
  186. package/dist/strapi/providers/remote-destination/index.d.ts.map +1 -1
  187. package/dist/strapi/providers/remote-destination/index.js +482 -0
  188. package/dist/strapi/providers/remote-destination/index.js.map +1 -0
  189. package/dist/strapi/providers/remote-destination/index.mjs +480 -0
  190. package/dist/strapi/providers/remote-destination/index.mjs.map +1 -0
  191. package/dist/strapi/providers/remote-source/index.d.ts +11 -6
  192. package/dist/strapi/providers/remote-source/index.d.ts.map +1 -1
  193. package/dist/strapi/providers/remote-source/index.js +538 -0
  194. package/dist/strapi/providers/remote-source/index.js.map +1 -0
  195. package/dist/strapi/providers/remote-source/index.mjs +536 -0
  196. package/dist/strapi/providers/remote-source/index.mjs.map +1 -0
  197. package/dist/strapi/providers/utils.d.ts +22 -16
  198. package/dist/strapi/providers/utils.d.ts.map +1 -1
  199. package/dist/strapi/providers/utils.js +178 -0
  200. package/dist/strapi/providers/utils.js.map +1 -0
  201. package/dist/strapi/providers/utils.mjs +174 -0
  202. package/dist/strapi/providers/utils.mjs.map +1 -0
  203. package/dist/strapi/queries/entity.d.ts.map +1 -1
  204. package/dist/strapi/queries/entity.js +125 -0
  205. package/dist/strapi/queries/entity.js.map +1 -0
  206. package/dist/strapi/queries/entity.mjs +123 -0
  207. package/dist/strapi/queries/entity.mjs.map +1 -0
  208. package/dist/strapi/queries/index.js +10 -0
  209. package/dist/strapi/queries/index.js.map +1 -0
  210. package/dist/strapi/queries/index.mjs +5 -0
  211. package/dist/strapi/queries/index.mjs.map +1 -0
  212. package/dist/strapi/queries/link.d.ts +1 -1
  213. package/dist/strapi/queries/link.d.ts.map +1 -1
  214. package/dist/strapi/queries/link.js +298 -0
  215. package/dist/strapi/queries/link.js.map +1 -0
  216. package/dist/strapi/queries/link.mjs +295 -0
  217. package/dist/strapi/queries/link.mjs.map +1 -0
  218. package/dist/strapi/remote/constants.d.ts.map +1 -1
  219. package/dist/strapi/remote/constants.js +11 -0
  220. package/dist/strapi/remote/constants.js.map +1 -0
  221. package/dist/strapi/remote/constants.mjs +8 -0
  222. package/dist/strapi/remote/constants.mjs.map +1 -0
  223. package/dist/strapi/remote/flows/default.d.ts.map +1 -1
  224. package/dist/strapi/remote/flows/default.js +43 -0
  225. package/dist/strapi/remote/flows/default.js.map +1 -0
  226. package/dist/strapi/remote/flows/default.mjs +41 -0
  227. package/dist/strapi/remote/flows/default.mjs.map +1 -0
  228. package/dist/strapi/remote/flows/index.d.ts +1 -1
  229. package/dist/strapi/remote/flows/index.d.ts.map +1 -1
  230. package/dist/strapi/remote/flows/index.js +54 -0
  231. package/dist/strapi/remote/flows/index.js.map +1 -0
  232. package/dist/strapi/remote/flows/index.mjs +52 -0
  233. package/dist/strapi/remote/flows/index.mjs.map +1 -0
  234. package/dist/strapi/remote/handlers/abstract.d.ts +4 -1
  235. package/dist/strapi/remote/handlers/abstract.d.ts.map +1 -1
  236. package/dist/strapi/remote/handlers/constants.js +10 -0
  237. package/dist/strapi/remote/handlers/constants.js.map +1 -0
  238. package/dist/strapi/remote/handlers/constants.mjs +8 -0
  239. package/dist/strapi/remote/handlers/constants.mjs.map +1 -0
  240. package/dist/strapi/remote/handlers/index.js +12 -0
  241. package/dist/strapi/remote/handlers/index.js.map +1 -0
  242. package/dist/strapi/remote/handlers/index.mjs +4 -0
  243. package/dist/strapi/remote/handlers/index.mjs.map +1 -0
  244. package/dist/strapi/remote/handlers/pull.d.ts +2 -3
  245. package/dist/strapi/remote/handlers/pull.d.ts.map +1 -1
  246. package/dist/strapi/remote/handlers/pull.js +369 -0
  247. package/dist/strapi/remote/handlers/pull.js.map +1 -0
  248. package/dist/strapi/remote/handlers/pull.mjs +367 -0
  249. package/dist/strapi/remote/handlers/pull.mjs.map +1 -0
  250. package/dist/strapi/remote/handlers/push.d.ts +16 -5
  251. package/dist/strapi/remote/handlers/push.d.ts.map +1 -1
  252. package/dist/strapi/remote/handlers/push.js +454 -0
  253. package/dist/strapi/remote/handlers/push.js.map +1 -0
  254. package/dist/strapi/remote/handlers/push.mjs +452 -0
  255. package/dist/strapi/remote/handlers/push.mjs.map +1 -0
  256. package/dist/strapi/remote/handlers/utils.d.ts +1 -2
  257. package/dist/strapi/remote/handlers/utils.d.ts.map +1 -1
  258. package/dist/strapi/remote/handlers/utils.js +318 -0
  259. package/dist/strapi/remote/handlers/utils.js.map +1 -0
  260. package/dist/strapi/remote/handlers/utils.mjs +312 -0
  261. package/dist/strapi/remote/handlers/utils.mjs.map +1 -0
  262. package/dist/strapi/remote/index.js +10 -0
  263. package/dist/strapi/remote/index.js.map +1 -0
  264. package/dist/strapi/remote/index.mjs +5 -0
  265. package/dist/strapi/remote/index.mjs.map +1 -0
  266. package/dist/strapi/utils/project-settings-logos.d.ts +29 -0
  267. package/dist/strapi/utils/project-settings-logos.d.ts.map +1 -0
  268. package/dist/strapi/utils/project-settings-logos.js +174 -0
  269. package/dist/strapi/utils/project-settings-logos.js.map +1 -0
  270. package/dist/strapi/utils/project-settings-logos.mjs +169 -0
  271. package/dist/strapi/utils/project-settings-logos.mjs.map +1 -0
  272. package/dist/types/common-entities.d.ts +149 -0
  273. package/dist/types/common-entities.d.ts.map +1 -0
  274. package/dist/types/encryption.d.ts +13 -0
  275. package/dist/types/encryption.d.ts.map +1 -0
  276. package/dist/types/index.d.ts +7 -0
  277. package/dist/types/index.d.ts.map +1 -0
  278. package/dist/types/providers.d.ts +49 -0
  279. package/dist/types/providers.d.ts.map +1 -0
  280. package/dist/types/remote/index.d.ts +2 -0
  281. package/dist/types/remote/index.d.ts.map +1 -0
  282. package/dist/types/remote/protocol/auth.d.ts +5 -0
  283. package/dist/types/remote/protocol/auth.d.ts.map +1 -0
  284. package/dist/types/remote/protocol/client/commands.d.ts +37 -0
  285. package/dist/types/remote/protocol/client/commands.d.ts.map +1 -0
  286. package/dist/types/remote/protocol/client/index.d.ts +9 -0
  287. package/dist/types/remote/protocol/client/index.d.ts.map +1 -0
  288. package/dist/types/remote/protocol/client/transfer/action.d.ts +5 -0
  289. package/dist/types/remote/protocol/client/transfer/action.d.ts.map +1 -0
  290. package/dist/types/remote/protocol/client/transfer/index.d.ts +12 -0
  291. package/dist/types/remote/protocol/client/transfer/index.d.ts.map +1 -0
  292. package/dist/types/remote/protocol/client/transfer/pull.d.ts +25 -0
  293. package/dist/types/remote/protocol/client/transfer/pull.d.ts.map +1 -0
  294. package/dist/types/remote/protocol/client/transfer/push.d.ts +29 -0
  295. package/dist/types/remote/protocol/client/transfer/push.d.ts.map +1 -0
  296. package/dist/types/remote/protocol/client/transfer/utils.d.ts +47 -0
  297. package/dist/types/remote/protocol/client/transfer/utils.d.ts.map +1 -0
  298. package/dist/types/remote/protocol/index.d.ts +4 -0
  299. package/dist/types/remote/protocol/index.d.ts.map +1 -0
  300. package/dist/types/remote/protocol/server/error.d.ts +18 -0
  301. package/dist/types/remote/protocol/server/error.d.ts.map +1 -0
  302. package/dist/types/remote/protocol/server/index.d.ts +3 -0
  303. package/dist/types/remote/protocol/server/index.d.ts.map +1 -0
  304. package/dist/types/remote/protocol/server/messaging.d.ts +37 -0
  305. package/dist/types/remote/protocol/server/messaging.d.ts.map +1 -0
  306. package/dist/types/transfer-engine.d.ts +148 -0
  307. package/dist/types/transfer-engine.d.ts.map +1 -0
  308. package/dist/types/utils.d.ts +82 -0
  309. package/dist/types/utils.d.ts.map +1 -0
  310. package/dist/utils/components.d.ts +23 -3
  311. package/dist/utils/components.d.ts.map +1 -1
  312. package/dist/utils/components.js +230 -0
  313. package/dist/utils/components.js.map +1 -0
  314. package/dist/utils/components.mjs +219 -0
  315. package/dist/utils/components.mjs.map +1 -0
  316. package/dist/{engine → utils}/diagnostic.d.ts +1 -0
  317. package/dist/utils/diagnostic.d.ts.map +1 -0
  318. package/dist/utils/diagnostic.js +51 -0
  319. package/dist/utils/diagnostic.js.map +1 -0
  320. package/dist/utils/diagnostic.mjs +49 -0
  321. package/dist/utils/diagnostic.mjs.map +1 -0
  322. package/dist/utils/encryption/decrypt.d.ts +6 -5
  323. package/dist/utils/encryption/decrypt.d.ts.map +1 -1
  324. package/dist/utils/encryption/decrypt.js +47 -0
  325. package/dist/utils/encryption/decrypt.js.map +1 -0
  326. package/dist/utils/encryption/decrypt.mjs +45 -0
  327. package/dist/utils/encryption/decrypt.mjs.map +1 -0
  328. package/dist/utils/encryption/encrypt.d.ts +6 -5
  329. package/dist/utils/encryption/encrypt.d.ts.map +1 -1
  330. package/dist/utils/encryption/encrypt.js +47 -0
  331. package/dist/utils/encryption/encrypt.js.map +1 -0
  332. package/dist/utils/encryption/encrypt.mjs +45 -0
  333. package/dist/utils/encryption/encrypt.mjs.map +1 -0
  334. package/dist/utils/encryption/index.js +10 -0
  335. package/dist/utils/encryption/index.js.map +1 -0
  336. package/dist/utils/encryption/index.mjs +3 -0
  337. package/dist/utils/encryption/index.mjs.map +1 -0
  338. package/dist/utils/index.d.ts +3 -0
  339. package/dist/utils/index.d.ts.map +1 -1
  340. package/dist/utils/index.js +28 -0
  341. package/dist/utils/index.js.map +1 -0
  342. package/dist/utils/index.mjs +17 -0
  343. package/dist/utils/index.mjs.map +1 -0
  344. package/dist/utils/json.d.ts.map +1 -1
  345. package/dist/utils/json.js +96 -0
  346. package/dist/utils/json.js.map +1 -0
  347. package/dist/utils/json.mjs +94 -0
  348. package/dist/utils/json.mjs.map +1 -0
  349. package/dist/utils/middleware.d.ts +1 -1
  350. package/dist/utils/middleware.d.ts.map +1 -1
  351. package/dist/utils/middleware.js +14 -0
  352. package/dist/utils/middleware.js.map +1 -0
  353. package/dist/utils/middleware.mjs +12 -0
  354. package/dist/utils/middleware.mjs.map +1 -0
  355. package/dist/utils/providers.js +12 -0
  356. package/dist/utils/providers.js.map +1 -0
  357. package/dist/utils/providers.mjs +10 -0
  358. package/dist/utils/providers.mjs.map +1 -0
  359. package/dist/utils/schema.d.ts.map +1 -1
  360. package/dist/utils/schema.js +32 -0
  361. package/dist/utils/schema.js.map +1 -0
  362. package/dist/utils/schema.mjs +29 -0
  363. package/dist/utils/schema.mjs.map +1 -0
  364. package/dist/utils/stream.d.ts +0 -1
  365. package/dist/utils/stream.d.ts.map +1 -1
  366. package/dist/utils/stream.js +96 -0
  367. package/dist/utils/stream.js.map +1 -0
  368. package/dist/utils/stream.mjs +92 -0
  369. package/dist/utils/stream.mjs.map +1 -0
  370. package/dist/utils/transaction.d.ts +1 -1
  371. package/dist/utils/transaction.d.ts.map +1 -1
  372. package/dist/utils/transaction.js +93 -0
  373. package/dist/utils/transaction.js.map +1 -0
  374. package/dist/utils/transaction.mjs +91 -0
  375. package/dist/utils/transaction.mjs.map +1 -0
  376. package/dist/utils/transfer-asset-chunk.d.ts +61 -0
  377. package/dist/utils/transfer-asset-chunk.d.ts.map +1 -0
  378. package/dist/utils/transfer-asset-chunk.js +118 -0
  379. package/dist/utils/transfer-asset-chunk.js.map +1 -0
  380. package/dist/utils/transfer-asset-chunk.mjs +112 -0
  381. package/dist/utils/transfer-asset-chunk.mjs.map +1 -0
  382. package/dist/utils/transfer-websocket-json.d.ts +24 -0
  383. package/dist/utils/transfer-websocket-json.d.ts.map +1 -0
  384. package/dist/utils/transfer-websocket-json.js +67 -0
  385. package/dist/utils/transfer-websocket-json.js.map +1 -0
  386. package/dist/utils/transfer-websocket-json.mjs +63 -0
  387. package/dist/utils/transfer-websocket-json.mjs.map +1 -0
  388. package/dist/utils/writable-async-write.d.ts +16 -0
  389. package/dist/utils/writable-async-write.d.ts.map +1 -0
  390. package/dist/utils/writable-async-write.js +61 -0
  391. package/dist/utils/writable-async-write.js.map +1 -0
  392. package/dist/utils/writable-async-write.mjs +59 -0
  393. package/dist/utils/writable-async-write.mjs.map +1 -0
  394. package/package.json +40 -26
  395. package/dist/engine/diagnostic.d.ts.map +0 -1
@@ -0,0 +1,482 @@
1
+ 'use strict';
2
+
3
+ var crypto = require('crypto');
4
+ var stream = require('stream');
5
+ var fp = require('lodash/fp');
6
+ var utils = require('../utils.js');
7
+ var constants = require('../../remote/constants.js');
8
+ var providers = require('../../../errors/providers.js');
9
+ var transferAssetChunk = require('../../../utils/transfer-asset-chunk.js');
10
+
11
+ function _class_private_field_loose_base(receiver, privateKey) {
12
+ if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
13
+ throw new TypeError("attempted to use private field on non-instance");
14
+ }
15
+ return receiver;
16
+ }
17
+ var id = 0;
18
+ function _class_private_field_loose_key(name) {
19
+ return "__private_" + id++ + "_" + name;
20
+ }
21
+ const jsonLength = (obj)=>Buffer.byteLength(JSON.stringify(obj));
22
+ /**
23
+ * Default batching for entities / links / configuration over WebSocket push.
24
+ *
25
+ * Goals: (1) enough payload per round-trip to stay efficient on large transfers,
26
+ * (2) small enough per message that the remote can process and ack without multi-minute stalls,
27
+ * (3) bounded gap between engine progress and the wire (see item cap + age).
28
+ *
29
+ * These are fixed defaults (not tuned per dataset) so behavior is predictable everywhere.
30
+ */ const STREAM_STEP_MAX_BATCH_BYTES = 512 * 1024;
31
+ /** Caps parallel work per message and how far UI count can lead the network for tiny rows. */ const STREAM_STEP_MAX_BATCH_ITEMS = 100;
32
+ /**
33
+ * If the first row in the current batch has waited this long, flush before appending more.
34
+ * Helps mixed-size streams (e.g. occasional large rows) without relying on tiny byte caps alone.
35
+ */ const STREAM_STEP_MAX_BATCH_AGE_MS = 450;
36
+ var _diagnostics = /*#__PURE__*/ _class_private_field_loose_key("_diagnostics"), _checksumsEnabled = /*#__PURE__*/ _class_private_field_loose_key("_checksumsEnabled"), /**
37
+ * Wire format for asset chunks. `'base64'` is the compact default introduced in #23479; remotes
38
+ * that predate that PR do `Buffer.from(item.data.data)` directly and need the legacy
39
+ * `{ type: 'Buffer', data: number[] }` shape instead. Set by init negotiation.
40
+ */ _assetEncoding = /*#__PURE__*/ _class_private_field_loose_key("_assetEncoding"), _startStepOnce = /*#__PURE__*/ _class_private_field_loose_key("_startStepOnce"), _startStep = /*#__PURE__*/ _class_private_field_loose_key("_startStep"), _endStep = /*#__PURE__*/ _class_private_field_loose_key("_endStep"), _streamStep = /*#__PURE__*/ _class_private_field_loose_key("_streamStep"), _writeStream = /*#__PURE__*/ _class_private_field_loose_key("_writeStream"), _reportInfo = /*#__PURE__*/ _class_private_field_loose_key("_reportInfo"), _reportWarning = /*#__PURE__*/ _class_private_field_loose_key("_reportWarning");
41
+ class RemoteStrapiDestinationProvider {
42
+ resetStats() {
43
+ this.stats = {
44
+ assets: {
45
+ count: 0
46
+ },
47
+ entities: {
48
+ count: 0
49
+ },
50
+ links: {
51
+ count: 0
52
+ },
53
+ configuration: {
54
+ count: 0
55
+ }
56
+ };
57
+ }
58
+ async initTransfer() {
59
+ const { strategy, restore } = this.options;
60
+ const wantsChecksums = this.options.verifyChecksums === true;
61
+ const query = this.dispatcher?.dispatchCommand({
62
+ command: 'init',
63
+ params: {
64
+ options: {
65
+ strategy,
66
+ restore
67
+ },
68
+ transfer: 'push',
69
+ ...wantsChecksums ? {
70
+ checksums: true
71
+ } : {},
72
+ assetEncoding: 'base64'
73
+ }
74
+ });
75
+ const res = await query;
76
+ if (!res?.transferID) {
77
+ throw new providers.ProviderTransferError('Init failed, invalid response from the server');
78
+ }
79
+ _class_private_field_loose_base(this, _checksumsEnabled)[_checksumsEnabled] = wantsChecksums && res.checksums === true;
80
+ if (wantsChecksums && res.checksums !== true) {
81
+ _class_private_field_loose_base(this, _reportWarning)[_reportWarning]('[Data transfer][push] Checksums were requested but the remote does not support checksum negotiation; continuing without checksum validation.');
82
+ }
83
+ // A remote that predates #23479 silently drops the `assetEncoding` field instead of echoing
84
+ // it. Falling back to the legacy Buffer JSON shape keeps small pushes working against those
85
+ // remotes; large pushes may still OOM the remote during `JSON.parse` because that shape
86
+ // allocates the full byte array — emit a warning so the user understands the trade-off.
87
+ if (res.assetEncoding === 'base64') {
88
+ _class_private_field_loose_base(this, _assetEncoding)[_assetEncoding] = 'base64';
89
+ } else {
90
+ _class_private_field_loose_base(this, _assetEncoding)[_assetEncoding] = 'legacy-buffer-json';
91
+ _class_private_field_loose_base(this, _reportWarning)[_reportWarning]('[Data transfer][push] Remote does not support the compact base64 asset-chunk format; ' + 'falling back to legacy Buffer JSON. Large files may cause out-of-memory errors on the remote — ' + 'upgrade the remote Strapi to pick up PR #23479 to use the memory-bounded wire format.');
92
+ }
93
+ this.resetStats();
94
+ return res.transferID;
95
+ }
96
+ async bootstrap(diagnostics) {
97
+ _class_private_field_loose_base(this, _diagnostics)[_diagnostics] = diagnostics;
98
+ const { url, auth } = this.options;
99
+ const validProtocols = [
100
+ 'https:',
101
+ 'http:'
102
+ ];
103
+ let ws;
104
+ if (!validProtocols.includes(url.protocol)) {
105
+ throw new providers.ProviderValidationError(`Invalid protocol "${url.protocol}"`, {
106
+ check: 'url',
107
+ details: {
108
+ protocol: url.protocol,
109
+ validProtocols
110
+ }
111
+ });
112
+ }
113
+ const wsProtocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
114
+ const wsUrl = `${wsProtocol}//${url.host}${utils.trimTrailingSlash(url.pathname)}${constants.TRANSFER_PATH}/push`;
115
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo]('establishing websocket connection');
116
+ // No auth defined, trying public access for transfer
117
+ if (!auth) {
118
+ ws = await utils.connectToWebsocket(wsUrl, undefined, _class_private_field_loose_base(this, _diagnostics)[_diagnostics]);
119
+ } else if (auth.type === 'token') {
120
+ const headers = {
121
+ Authorization: `Bearer ${auth.token}`
122
+ };
123
+ ws = await utils.connectToWebsocket(wsUrl, {
124
+ headers
125
+ }, _class_private_field_loose_base(this, _diagnostics)[_diagnostics]);
126
+ } else {
127
+ throw new providers.ProviderValidationError('Auth method not available', {
128
+ check: 'auth.type',
129
+ details: {
130
+ auth: auth.type
131
+ }
132
+ });
133
+ }
134
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo]('established websocket connection');
135
+ this.ws = ws;
136
+ const { retryMessageOptions } = this.options;
137
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo]('creating dispatcher');
138
+ this.dispatcher = utils.createDispatcher(this.ws, retryMessageOptions, (message)=>_class_private_field_loose_base(this, _reportInfo)[_reportInfo](message));
139
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo]('created dispatcher');
140
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo]('initialize transfer');
141
+ this.transferID = await this.initTransfer();
142
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo](`initialized transfer ${this.transferID}`);
143
+ this.dispatcher.setTransferProperties({
144
+ id: this.transferID,
145
+ kind: 'push'
146
+ });
147
+ await this.dispatcher.dispatchTransferAction('bootstrap');
148
+ }
149
+ async close() {
150
+ // Gracefully close the remote transfer process
151
+ if (this.transferID && this.dispatcher) {
152
+ await this.dispatcher.dispatchTransferAction('close');
153
+ await this.dispatcher.dispatchCommand({
154
+ command: 'end',
155
+ params: {
156
+ transferID: this.transferID
157
+ }
158
+ });
159
+ }
160
+ await new Promise((resolve)=>{
161
+ const { ws } = this;
162
+ if (!ws || ws.CLOSED) {
163
+ resolve();
164
+ return;
165
+ }
166
+ ws.on('close', ()=>resolve()).close();
167
+ });
168
+ }
169
+ getMetadata() {
170
+ return this.dispatcher?.dispatchTransferAction('getMetadata') ?? null;
171
+ }
172
+ async beforeTransfer() {
173
+ this.options.onTransferPhase?.('Remote: waiting for server to clear data and prepare destination…');
174
+ await this.dispatcher?.dispatchTransferAction('beforeTransfer');
175
+ }
176
+ async rollback() {
177
+ await this.dispatcher?.dispatchTransferAction('rollback');
178
+ }
179
+ getSchemas() {
180
+ if (!this.dispatcher) {
181
+ return Promise.resolve(null);
182
+ }
183
+ return this.dispatcher.dispatchTransferAction('getSchemas');
184
+ }
185
+ createEntitiesWriteStream() {
186
+ return _class_private_field_loose_base(this, _writeStream)[_writeStream]('entities');
187
+ }
188
+ createLinksWriteStream() {
189
+ return _class_private_field_loose_base(this, _writeStream)[_writeStream]('links');
190
+ }
191
+ createConfigurationWriteStream() {
192
+ return _class_private_field_loose_base(this, _writeStream)[_writeStream]('configuration');
193
+ }
194
+ createAssetsWriteStream() {
195
+ let batch = [];
196
+ let hasStarted = false;
197
+ const verifyChecksums = _class_private_field_loose_base(this, _checksumsEnabled)[_checksumsEnabled];
198
+ const encodeAssetChunk = _class_private_field_loose_base(this, _assetEncoding)[_assetEncoding] === 'base64' ? transferAssetChunk.createTransferAssetStreamChunk : transferAssetChunk.createTransferAssetStreamChunkLegacy;
199
+ const batchSize = 1024 * 1024; // 1MB;
200
+ const batchLength = ()=>{
201
+ return batch.reduce((acc, chunk)=>acc + transferAssetChunk.transferAssetStreamChunkByteLength(chunk), 0);
202
+ };
203
+ const startAssetsTransferOnce = _class_private_field_loose_base(this, _startStepOnce)[_startStepOnce]('assets');
204
+ const flush = async ()=>{
205
+ const streamError = await _class_private_field_loose_base(this, _streamStep)[_streamStep]('assets', batch);
206
+ batch = [];
207
+ return streamError;
208
+ };
209
+ const safePush = async (chunk)=>{
210
+ batch.push(chunk);
211
+ if (batchLength() >= batchSize) {
212
+ const streamError = await flush();
213
+ if (streamError) {
214
+ throw streamError;
215
+ }
216
+ }
217
+ };
218
+ return new stream.Writable({
219
+ objectMode: true,
220
+ final: async (callback)=>{
221
+ if (batch.length > 0) {
222
+ await flush();
223
+ }
224
+ if (hasStarted) {
225
+ const { error: endStepError } = await _class_private_field_loose_base(this, _endStep)[_endStep]('assets');
226
+ if (endStepError) {
227
+ return callback(endStepError);
228
+ }
229
+ }
230
+ return callback(null);
231
+ },
232
+ async write (asset, _encoding, callback) {
233
+ const startError = await startAssetsTransferOnce();
234
+ if (startError) {
235
+ return callback(startError);
236
+ }
237
+ hasStarted = true;
238
+ const assetID = crypto.randomUUID();
239
+ const { filename, filepath, stats, stream, metadata } = asset;
240
+ const checksumHash = verifyChecksums ? crypto.createHash('sha256') : undefined;
241
+ try {
242
+ await safePush({
243
+ action: 'start',
244
+ assetID,
245
+ data: {
246
+ filename,
247
+ filepath,
248
+ stats,
249
+ metadata
250
+ }
251
+ });
252
+ for await (const chunk of stream){
253
+ checksumHash?.update(chunk);
254
+ await safePush(encodeAssetChunk(assetID, chunk));
255
+ }
256
+ await safePush({
257
+ action: 'end',
258
+ assetID,
259
+ ...checksumHash ? {
260
+ checksum: {
261
+ algorithm: 'sha256',
262
+ value: checksumHash.digest('hex')
263
+ }
264
+ } : {}
265
+ });
266
+ callback();
267
+ } catch (error) {
268
+ callback(error instanceof Error ? error : new Error(String(error)));
269
+ }
270
+ }
271
+ });
272
+ }
273
+ constructor(options){
274
+ Object.defineProperty(this, _startStepOnce, {
275
+ value: startStepOnce
276
+ });
277
+ Object.defineProperty(this, _startStep, {
278
+ value: startStep
279
+ });
280
+ Object.defineProperty(this, _endStep, {
281
+ value: endStep
282
+ });
283
+ Object.defineProperty(this, _streamStep, {
284
+ value: streamStep
285
+ });
286
+ Object.defineProperty(this, _writeStream, {
287
+ value: writeStream
288
+ });
289
+ Object.defineProperty(this, _reportInfo, {
290
+ value: reportInfo
291
+ });
292
+ Object.defineProperty(this, _reportWarning, {
293
+ value: reportWarning
294
+ });
295
+ Object.defineProperty(this, _diagnostics, {
296
+ writable: true,
297
+ value: void 0
298
+ });
299
+ Object.defineProperty(this, _checksumsEnabled, {
300
+ writable: true,
301
+ value: void 0
302
+ });
303
+ Object.defineProperty(this, _assetEncoding, {
304
+ writable: true,
305
+ value: void 0
306
+ });
307
+ this.name = 'destination::remote-strapi';
308
+ this.type = 'destination';
309
+ _class_private_field_loose_base(this, _checksumsEnabled)[_checksumsEnabled] = false;
310
+ _class_private_field_loose_base(this, _assetEncoding)[_assetEncoding] = 'base64';
311
+ this.options = options;
312
+ this.ws = null;
313
+ this.dispatcher = null;
314
+ this.transferID = null;
315
+ _class_private_field_loose_base(this, _checksumsEnabled)[_checksumsEnabled] = options.verifyChecksums === true;
316
+ this.resetStats();
317
+ }
318
+ }
319
+ function startStepOnce(stage) {
320
+ return fp.once(()=>_class_private_field_loose_base(this, _startStep)[_startStep](stage));
321
+ }
322
+ async function startStep(step) {
323
+ try {
324
+ await this.dispatcher?.dispatchTransferStep({
325
+ action: 'start',
326
+ step
327
+ });
328
+ } catch (e) {
329
+ if (e instanceof Error) {
330
+ return e;
331
+ }
332
+ if (typeof e === 'string') {
333
+ return new providers.ProviderTransferError(e);
334
+ }
335
+ return new providers.ProviderTransferError('Unexpected error');
336
+ }
337
+ this.stats[step] = {
338
+ count: 0
339
+ };
340
+ return null;
341
+ }
342
+ async function endStep(step) {
343
+ try {
344
+ const res = await this.dispatcher?.dispatchTransferStep({
345
+ action: 'end',
346
+ step
347
+ });
348
+ return {
349
+ stats: res?.stats ?? null,
350
+ error: null
351
+ };
352
+ } catch (e) {
353
+ if (e instanceof Error) {
354
+ return {
355
+ stats: null,
356
+ error: e
357
+ };
358
+ }
359
+ if (typeof e === 'string') {
360
+ return {
361
+ stats: null,
362
+ error: new providers.ProviderTransferError(e)
363
+ };
364
+ }
365
+ return {
366
+ stats: null,
367
+ error: new providers.ProviderTransferError('Unexpected error')
368
+ };
369
+ }
370
+ }
371
+ async function streamStep(step, message) {
372
+ try {
373
+ if (step === 'assets') {
374
+ const assetMessage = message;
375
+ this.stats[step].count += assetMessage.filter((data)=>data.action === 'start').length;
376
+ } else {
377
+ this.stats[step].count += message.length;
378
+ }
379
+ await this.dispatcher?.dispatchTransferStep({
380
+ action: 'stream',
381
+ step,
382
+ data: message
383
+ });
384
+ } catch (e) {
385
+ if (e instanceof Error) {
386
+ return e;
387
+ }
388
+ if (typeof e === 'string') {
389
+ return new providers.ProviderTransferError(e);
390
+ }
391
+ return new providers.ProviderTransferError('Unexpected error');
392
+ }
393
+ return null;
394
+ }
395
+ function writeStream(step) {
396
+ const startTransferOnce = _class_private_field_loose_base(this, _startStepOnce)[_startStepOnce](step);
397
+ let batch = [];
398
+ let batchStartedAt = 0;
399
+ const batchLength = ()=>jsonLength(batch);
400
+ const flushBatch = async ()=>{
401
+ if (batch.length === 0) {
402
+ return null;
403
+ }
404
+ const payload = batch;
405
+ batch = [];
406
+ batchStartedAt = 0;
407
+ return _class_private_field_loose_base(this, _streamStep)[_streamStep](step, payload);
408
+ };
409
+ const shouldFlushBatchAfterPush = ()=>{
410
+ if (batch.length === 0) {
411
+ return false;
412
+ }
413
+ return batchLength() >= STREAM_STEP_MAX_BATCH_BYTES || batch.length >= STREAM_STEP_MAX_BATCH_ITEMS || Date.now() - batchStartedAt >= STREAM_STEP_MAX_BATCH_AGE_MS;
414
+ };
415
+ return new stream.Writable({
416
+ objectMode: true,
417
+ final: async (callback)=>{
418
+ if (batch.length > 0) {
419
+ const streamError = await flushBatch();
420
+ if (streamError) {
421
+ return callback(streamError);
422
+ }
423
+ }
424
+ const { error, stats } = await _class_private_field_loose_base(this, _endStep)[_endStep](step);
425
+ const { count } = this.stats[step];
426
+ if (stats && (stats.started !== count || stats.finished !== count)) {
427
+ callback(new Error(`Data missing: sent ${this.stats[step].count} ${step}, received ${stats.started} and saved ${stats.finished} ${step}`));
428
+ }
429
+ callback(error);
430
+ },
431
+ async write (chunk, _encoding, callback) {
432
+ const startError = await startTransferOnce();
433
+ if (startError) {
434
+ return callback(startError);
435
+ }
436
+ // Flush a batch that has sat long enough before growing it further (bounded latency).
437
+ if (batch.length > 0 && Date.now() - batchStartedAt >= STREAM_STEP_MAX_BATCH_AGE_MS) {
438
+ const staleError = await flushBatch();
439
+ if (staleError) {
440
+ return callback(staleError);
441
+ }
442
+ }
443
+ batch.push(chunk);
444
+ if (batch.length === 1) {
445
+ batchStartedAt = Date.now();
446
+ }
447
+ if (shouldFlushBatchAfterPush()) {
448
+ const streamError = await flushBatch();
449
+ if (streamError) {
450
+ return callback(streamError);
451
+ }
452
+ }
453
+ callback();
454
+ }
455
+ });
456
+ }
457
+ function reportInfo(message) {
458
+ _class_private_field_loose_base(this, _diagnostics)[_diagnostics]?.report({
459
+ details: {
460
+ createdAt: new Date(),
461
+ message,
462
+ origin: 'remote-destination-provider'
463
+ },
464
+ kind: 'info'
465
+ });
466
+ }
467
+ function reportWarning(message) {
468
+ _class_private_field_loose_base(this, _diagnostics)[_diagnostics]?.report({
469
+ details: {
470
+ createdAt: new Date(),
471
+ message,
472
+ origin: 'remote-destination-provider'
473
+ },
474
+ kind: 'warning'
475
+ });
476
+ }
477
+ const createRemoteStrapiDestinationProvider = (options)=>{
478
+ return new RemoteStrapiDestinationProvider(options);
479
+ };
480
+
481
+ exports.createRemoteStrapiDestinationProvider = createRemoteStrapiDestinationProvider;
482
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/strapi/providers/remote-destination/index.ts"],"sourcesContent":["import { createHash, randomUUID } from 'crypto';\nimport { Writable } from 'stream';\nimport { WebSocket } from 'ws';\nimport { once } from 'lodash/fp';\nimport type { Struct, Utils } from '@strapi/types';\n\nimport { createDispatcher, connectToWebsocket, trimTrailingSlash } from '../utils';\n\nimport type {\n IDestinationProvider,\n IMetadata,\n ProviderType,\n IAsset,\n TransferStage,\n Protocol,\n} from '../../../types';\nimport type { IDiagnosticReporter } from '../../../utils/diagnostic';\nimport type { Client, Server, Auth } from '../../../types/remote/protocol';\nimport type { ILocalStrapiDestinationProviderOptions } from '../local-destination';\nimport { TRANSFER_PATH } from '../../remote/constants';\nimport { ProviderTransferError, ProviderValidationError } from '../../../errors/providers';\nimport {\n createTransferAssetStreamChunk,\n createTransferAssetStreamChunkLegacy,\n transferAssetStreamChunkByteLength,\n} from '../../../utils/transfer-asset-chunk';\n\nexport interface IRemoteStrapiDestinationProviderOptions\n extends Pick<ILocalStrapiDestinationProviderOptions, 'restore' | 'strategy' | 'onTransferPhase'> {\n url: URL; // the url of the remote Strapi admin\n auth?: Auth.ITransferTokenAuth;\n retryMessageOptions?: {\n retryMessageTimeout: number; // milliseconds to wait for a response from a message\n retryMessageMaxRetries: number; // max number of retries for a message before aborting transfer\n };\n /** Include per-asset stream checksums and require peers to validate on receive. */\n verifyChecksums?: boolean;\n}\n\nconst jsonLength = (obj: object) => Buffer.byteLength(JSON.stringify(obj));\n\n/**\n * Default batching for entities / links / configuration over WebSocket push.\n *\n * Goals: (1) enough payload per round-trip to stay efficient on large transfers,\n * (2) small enough per message that the remote can process and ack without multi-minute stalls,\n * (3) bounded gap between engine progress and the wire (see item cap + age).\n *\n * These are fixed defaults (not tuned per dataset) so behavior is predictable everywhere.\n */\nconst STREAM_STEP_MAX_BATCH_BYTES = 512 * 1024;\n\n/** Caps parallel work per message and how far UI count can lead the network for tiny rows. */\nconst STREAM_STEP_MAX_BATCH_ITEMS = 100;\n\n/**\n * If the first row in the current batch has waited this long, flush before appending more.\n * Helps mixed-size streams (e.g. occasional large rows) without relying on tiny byte caps alone.\n */\nconst STREAM_STEP_MAX_BATCH_AGE_MS = 450;\n\nclass RemoteStrapiDestinationProvider implements IDestinationProvider {\n name = 'destination::remote-strapi';\n\n type: ProviderType = 'destination';\n\n options: IRemoteStrapiDestinationProviderOptions;\n\n ws: WebSocket | null;\n\n dispatcher: ReturnType<typeof createDispatcher> | null;\n\n transferID: string | null;\n\n stats!: { [TStage in Exclude<TransferStage, 'schemas'>]: { count: number } };\n\n #diagnostics?: IDiagnosticReporter;\n\n #checksumsEnabled = false;\n\n /**\n * Wire format for asset chunks. `'base64'` is the compact default introduced in #23479; remotes\n * that predate that PR do `Buffer.from(item.data.data)` directly and need the legacy\n * `{ type: 'Buffer', data: number[] }` shape instead. Set by init negotiation.\n */\n #assetEncoding: 'base64' | 'legacy-buffer-json' = 'base64';\n\n constructor(options: IRemoteStrapiDestinationProviderOptions) {\n this.options = options;\n this.ws = null;\n this.dispatcher = null;\n this.transferID = null;\n this.#checksumsEnabled = options.verifyChecksums === true;\n\n this.resetStats();\n }\n\n private resetStats() {\n this.stats = {\n assets: { count: 0 },\n entities: { count: 0 },\n links: { count: 0 },\n configuration: { count: 0 },\n };\n }\n\n async initTransfer(): Promise<string> {\n const { strategy, restore } = this.options;\n const wantsChecksums = this.options.verifyChecksums === true;\n\n const query = this.dispatcher?.dispatchCommand({\n command: 'init',\n params: {\n options: { strategy, restore },\n transfer: 'push',\n ...(wantsChecksums ? { checksums: true } : {}),\n assetEncoding: 'base64',\n },\n });\n\n const res = (await query) as\n | (Server.Payload<Server.InitMessage> & {\n checksums?: boolean;\n assetEncoding?: 'base64';\n })\n | null;\n if (!res?.transferID) {\n throw new ProviderTransferError('Init failed, invalid response from the server');\n }\n this.#checksumsEnabled = wantsChecksums && res.checksums === true;\n if (wantsChecksums && res.checksums !== true) {\n this.#reportWarning(\n '[Data transfer][push] Checksums were requested but the remote does not support checksum negotiation; continuing without checksum validation.'\n );\n }\n\n // A remote that predates #23479 silently drops the `assetEncoding` field instead of echoing\n // it. Falling back to the legacy Buffer JSON shape keeps small pushes working against those\n // remotes; large pushes may still OOM the remote during `JSON.parse` because that shape\n // allocates the full byte array — emit a warning so the user understands the trade-off.\n if (res.assetEncoding === 'base64') {\n this.#assetEncoding = 'base64';\n } else {\n this.#assetEncoding = 'legacy-buffer-json';\n this.#reportWarning(\n '[Data transfer][push] Remote does not support the compact base64 asset-chunk format; ' +\n 'falling back to legacy Buffer JSON. Large files may cause out-of-memory errors on the remote — ' +\n 'upgrade the remote Strapi to pick up PR #23479 to use the memory-bounded wire format.'\n );\n }\n\n this.resetStats();\n\n return res.transferID;\n }\n\n #startStepOnce(stage: Client.TransferPushStep) {\n return once(() => this.#startStep(stage));\n }\n\n async #startStep<T extends Client.TransferPushStep>(step: T) {\n try {\n await this.dispatcher?.dispatchTransferStep({ action: 'start', step });\n } catch (e) {\n if (e instanceof Error) {\n return e;\n }\n\n if (typeof e === 'string') {\n return new ProviderTransferError(e);\n }\n\n return new ProviderTransferError('Unexpected error');\n }\n\n this.stats[step] = { count: 0 };\n\n return null;\n }\n\n async #endStep<T extends Client.TransferPushStep>(step: T) {\n try {\n const res = await this.dispatcher?.dispatchTransferStep<{\n ok: boolean;\n stats: Protocol.Client.Stats;\n }>({\n action: 'end',\n step,\n });\n\n return { stats: res?.stats ?? null, error: null };\n } catch (e) {\n if (e instanceof Error) {\n return { stats: null, error: e };\n }\n\n if (typeof e === 'string') {\n return { stats: null, error: new ProviderTransferError(e) };\n }\n\n return { stats: null, error: new ProviderTransferError('Unexpected error') };\n }\n }\n\n async #streamStep<T extends Client.TransferPushStep>(\n step: T,\n message: Client.GetTransferPushStreamData<T>\n ) {\n try {\n if (step === 'assets') {\n const assetMessage = message as Protocol.Client.TransferAssetFlow[];\n this.stats[step].count += assetMessage.filter((data) => data.action === 'start').length;\n } else {\n this.stats[step].count += message.length;\n }\n\n await this.dispatcher?.dispatchTransferStep({ action: 'stream', step, data: message });\n } catch (e) {\n if (e instanceof Error) {\n return e;\n }\n\n if (typeof e === 'string') {\n return new ProviderTransferError(e);\n }\n\n return new ProviderTransferError('Unexpected error');\n }\n\n return null;\n }\n\n #writeStream(step: Exclude<Client.TransferPushStep, 'assets'>): Writable {\n type Step = typeof step;\n\n const startTransferOnce = this.#startStepOnce(step);\n\n let batch = [] as Client.GetTransferPushStreamData<Step>;\n let batchStartedAt = 0;\n\n const batchLength = () => jsonLength(batch);\n\n const flushBatch = async (): Promise<Error | null> => {\n if (batch.length === 0) {\n return null;\n }\n const payload = batch;\n batch = [];\n batchStartedAt = 0;\n return this.#streamStep(step, payload);\n };\n\n const shouldFlushBatchAfterPush = () => {\n if (batch.length === 0) {\n return false;\n }\n return (\n batchLength() >= STREAM_STEP_MAX_BATCH_BYTES ||\n batch.length >= STREAM_STEP_MAX_BATCH_ITEMS ||\n Date.now() - batchStartedAt >= STREAM_STEP_MAX_BATCH_AGE_MS\n );\n };\n\n return new Writable({\n objectMode: true,\n\n final: async (callback) => {\n if (batch.length > 0) {\n const streamError = await flushBatch();\n\n if (streamError) {\n return callback(streamError);\n }\n }\n const { error, stats } = await this.#endStep(step);\n\n const { count } = this.stats[step];\n\n if (stats && (stats.started !== count || stats.finished !== count)) {\n callback(\n new Error(\n `Data missing: sent ${this.stats[step].count} ${step}, received ${stats.started} and saved ${stats.finished} ${step}`\n )\n );\n }\n\n callback(error);\n },\n\n async write(chunk, _encoding, callback) {\n const startError = await startTransferOnce();\n if (startError) {\n return callback(startError);\n }\n\n // Flush a batch that has sat long enough before growing it further (bounded latency).\n if (batch.length > 0 && Date.now() - batchStartedAt >= STREAM_STEP_MAX_BATCH_AGE_MS) {\n const staleError = await flushBatch();\n if (staleError) {\n return callback(staleError);\n }\n }\n\n batch.push(chunk);\n if (batch.length === 1) {\n batchStartedAt = Date.now();\n }\n\n if (shouldFlushBatchAfterPush()) {\n const streamError = await flushBatch();\n if (streamError) {\n return callback(streamError);\n }\n }\n\n callback();\n },\n });\n }\n\n #reportInfo(message: string) {\n this.#diagnostics?.report({\n details: {\n createdAt: new Date(),\n message,\n origin: 'remote-destination-provider',\n },\n kind: 'info',\n });\n }\n\n #reportWarning(message: string) {\n this.#diagnostics?.report({\n details: {\n createdAt: new Date(),\n message,\n origin: 'remote-destination-provider',\n },\n kind: 'warning',\n });\n }\n\n async bootstrap(diagnostics?: IDiagnosticReporter): Promise<void> {\n this.#diagnostics = diagnostics;\n const { url, auth } = this.options;\n const validProtocols = ['https:', 'http:'];\n\n let ws: WebSocket;\n\n if (!validProtocols.includes(url.protocol)) {\n throw new ProviderValidationError(`Invalid protocol \"${url.protocol}\"`, {\n check: 'url',\n details: {\n protocol: url.protocol,\n validProtocols,\n },\n });\n }\n const wsProtocol = url.protocol === 'https:' ? 'wss:' : 'ws:';\n const wsUrl = `${wsProtocol}//${url.host}${trimTrailingSlash(\n url.pathname\n )}${TRANSFER_PATH}/push`;\n\n this.#reportInfo('establishing websocket connection');\n // No auth defined, trying public access for transfer\n if (!auth) {\n ws = await connectToWebsocket(wsUrl, undefined, this.#diagnostics);\n }\n\n // Common token auth, this should be the main auth method\n else if (auth.type === 'token') {\n const headers = { Authorization: `Bearer ${auth.token}` };\n ws = await connectToWebsocket(wsUrl, { headers }, this.#diagnostics);\n }\n\n // Invalid auth method provided\n else {\n throw new ProviderValidationError('Auth method not available', {\n check: 'auth.type',\n details: {\n auth: auth.type,\n },\n });\n }\n\n this.#reportInfo('established websocket connection');\n\n this.ws = ws;\n const { retryMessageOptions } = this.options;\n\n this.#reportInfo('creating dispatcher');\n this.dispatcher = createDispatcher(this.ws, retryMessageOptions, (message: string) =>\n this.#reportInfo(message)\n );\n this.#reportInfo('created dispatcher');\n\n this.#reportInfo('initialize transfer');\n this.transferID = await this.initTransfer();\n this.#reportInfo(`initialized transfer ${this.transferID}`);\n\n this.dispatcher.setTransferProperties({ id: this.transferID, kind: 'push' });\n\n await this.dispatcher.dispatchTransferAction('bootstrap');\n }\n\n async close() {\n // Gracefully close the remote transfer process\n if (this.transferID && this.dispatcher) {\n await this.dispatcher.dispatchTransferAction('close');\n\n await this.dispatcher.dispatchCommand({\n command: 'end',\n params: { transferID: this.transferID },\n });\n }\n\n await new Promise<void>((resolve) => {\n const { ws } = this;\n\n if (!ws || ws.CLOSED) {\n resolve();\n return;\n }\n\n ws.on('close', () => resolve()).close();\n });\n }\n\n getMetadata() {\n return this.dispatcher?.dispatchTransferAction<IMetadata>('getMetadata') ?? null;\n }\n\n async beforeTransfer() {\n this.options.onTransferPhase?.(\n 'Remote: waiting for server to clear data and prepare destination…'\n );\n await this.dispatcher?.dispatchTransferAction('beforeTransfer');\n }\n\n async rollback() {\n await this.dispatcher?.dispatchTransferAction('rollback');\n }\n\n getSchemas() {\n if (!this.dispatcher) {\n return Promise.resolve(null);\n }\n\n return this.dispatcher.dispatchTransferAction<Utils.String.Dict<Struct.Schema>>('getSchemas');\n }\n\n createEntitiesWriteStream(): Writable {\n return this.#writeStream('entities');\n }\n\n createLinksWriteStream(): Writable {\n return this.#writeStream('links');\n }\n\n createConfigurationWriteStream(): Writable {\n return this.#writeStream('configuration');\n }\n\n createAssetsWriteStream(): Writable | Promise<Writable> {\n let batch: Client.TransferAssetFlow[] = [];\n let hasStarted = false;\n const verifyChecksums = this.#checksumsEnabled;\n const encodeAssetChunk =\n this.#assetEncoding === 'base64'\n ? createTransferAssetStreamChunk\n : createTransferAssetStreamChunkLegacy;\n\n const batchSize = 1024 * 1024; // 1MB;\n const batchLength = () => {\n return batch.reduce((acc, chunk) => acc + transferAssetStreamChunkByteLength(chunk), 0);\n };\n const startAssetsTransferOnce = this.#startStepOnce('assets');\n\n const flush = async () => {\n const streamError = await this.#streamStep('assets', batch);\n batch = [];\n return streamError;\n };\n\n const safePush = async (chunk: Client.TransferAssetFlow) => {\n batch.push(chunk);\n\n if (batchLength() >= batchSize) {\n const streamError = await flush();\n if (streamError) {\n throw streamError;\n }\n }\n };\n\n return new Writable({\n objectMode: true,\n final: async (callback) => {\n if (batch.length > 0) {\n await flush();\n }\n\n if (hasStarted) {\n const { error: endStepError } = await this.#endStep('assets');\n\n if (endStepError) {\n return callback(endStepError);\n }\n }\n\n return callback(null);\n },\n\n async write(asset: IAsset, _encoding, callback) {\n const startError = await startAssetsTransferOnce();\n if (startError) {\n return callback(startError);\n }\n\n hasStarted = true;\n\n const assetID = randomUUID();\n const { filename, filepath, stats, stream, metadata } = asset;\n const checksumHash = verifyChecksums ? createHash('sha256') : undefined;\n\n try {\n await safePush({\n action: 'start',\n assetID,\n data: { filename, filepath, stats, metadata },\n });\n\n for await (const chunk of stream) {\n checksumHash?.update(chunk);\n await safePush(encodeAssetChunk(assetID, chunk));\n }\n\n await safePush({\n action: 'end',\n assetID,\n ...(checksumHash\n ? { checksum: { algorithm: 'sha256' as const, value: checksumHash.digest('hex') } }\n : {}),\n });\n\n callback();\n } catch (error) {\n callback(error instanceof Error ? error : new Error(String(error)));\n }\n },\n });\n }\n}\n\nexport const createRemoteStrapiDestinationProvider = (\n options: IRemoteStrapiDestinationProviderOptions\n) => {\n return new RemoteStrapiDestinationProvider(options);\n};\n"],"names":["jsonLength","obj","Buffer","byteLength","JSON","stringify","STREAM_STEP_MAX_BATCH_BYTES","STREAM_STEP_MAX_BATCH_ITEMS","STREAM_STEP_MAX_BATCH_AGE_MS","RemoteStrapiDestinationProvider","resetStats","stats","assets","count","entities","links","configuration","initTransfer","strategy","restore","options","wantsChecksums","verifyChecksums","query","dispatcher","dispatchCommand","command","params","transfer","checksums","assetEncoding","res","transferID","ProviderTransferError","bootstrap","diagnostics","url","auth","validProtocols","ws","includes","protocol","ProviderValidationError","check","details","wsProtocol","wsUrl","host","trimTrailingSlash","pathname","TRANSFER_PATH","connectToWebsocket","undefined","type","headers","Authorization","token","retryMessageOptions","createDispatcher","message","setTransferProperties","id","kind","dispatchTransferAction","close","Promise","resolve","CLOSED","on","getMetadata","beforeTransfer","onTransferPhase","rollback","getSchemas","createEntitiesWriteStream","createLinksWriteStream","createConfigurationWriteStream","createAssetsWriteStream","batch","hasStarted","encodeAssetChunk","createTransferAssetStreamChunk","createTransferAssetStreamChunkLegacy","batchSize","batchLength","reduce","acc","chunk","transferAssetStreamChunkByteLength","startAssetsTransferOnce","flush","streamError","safePush","push","Writable","objectMode","final","callback","length","error","endStepError","write","asset","_encoding","startError","assetID","randomUUID","filename","filepath","stream","metadata","checksumHash","createHash","action","data","update","checksum","algorithm","value","digest","Error","String","name","stage","once","step","dispatchTransferStep","e","assetMessage","filter","startTransferOnce","batchStartedAt","flushBatch","payload","shouldFlushBatchAfterPush","Date","now","started","finished","staleError","report","createdAt","origin","createRemoteStrapiDestinationProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuCA,MAAMA,UAAAA,GAAa,CAACC,GAAA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