@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,480 @@
1
+ import { randomUUID, createHash } from 'crypto';
2
+ import { Writable } from 'stream';
3
+ import { once } from 'lodash/fp';
4
+ import { trimTrailingSlash, connectToWebsocket, createDispatcher } from '../utils.mjs';
5
+ import { TRANSFER_PATH } from '../../remote/constants.mjs';
6
+ import { ProviderTransferError, ProviderValidationError } from '../../../errors/providers.mjs';
7
+ import { createTransferAssetStreamChunk, createTransferAssetStreamChunkLegacy, transferAssetStreamChunkByteLength } from '../../../utils/transfer-asset-chunk.mjs';
8
+
9
+ function _class_private_field_loose_base(receiver, privateKey) {
10
+ if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
11
+ throw new TypeError("attempted to use private field on non-instance");
12
+ }
13
+ return receiver;
14
+ }
15
+ var id = 0;
16
+ function _class_private_field_loose_key(name) {
17
+ return "__private_" + id++ + "_" + name;
18
+ }
19
+ const jsonLength = (obj)=>Buffer.byteLength(JSON.stringify(obj));
20
+ /**
21
+ * Default batching for entities / links / configuration over WebSocket push.
22
+ *
23
+ * Goals: (1) enough payload per round-trip to stay efficient on large transfers,
24
+ * (2) small enough per message that the remote can process and ack without multi-minute stalls,
25
+ * (3) bounded gap between engine progress and the wire (see item cap + age).
26
+ *
27
+ * These are fixed defaults (not tuned per dataset) so behavior is predictable everywhere.
28
+ */ const STREAM_STEP_MAX_BATCH_BYTES = 512 * 1024;
29
+ /** Caps parallel work per message and how far UI count can lead the network for tiny rows. */ const STREAM_STEP_MAX_BATCH_ITEMS = 100;
30
+ /**
31
+ * If the first row in the current batch has waited this long, flush before appending more.
32
+ * Helps mixed-size streams (e.g. occasional large rows) without relying on tiny byte caps alone.
33
+ */ const STREAM_STEP_MAX_BATCH_AGE_MS = 450;
34
+ var _diagnostics = /*#__PURE__*/ _class_private_field_loose_key("_diagnostics"), _checksumsEnabled = /*#__PURE__*/ _class_private_field_loose_key("_checksumsEnabled"), /**
35
+ * Wire format for asset chunks. `'base64'` is the compact default introduced in #23479; remotes
36
+ * that predate that PR do `Buffer.from(item.data.data)` directly and need the legacy
37
+ * `{ type: 'Buffer', data: number[] }` shape instead. Set by init negotiation.
38
+ */ _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");
39
+ class RemoteStrapiDestinationProvider {
40
+ resetStats() {
41
+ this.stats = {
42
+ assets: {
43
+ count: 0
44
+ },
45
+ entities: {
46
+ count: 0
47
+ },
48
+ links: {
49
+ count: 0
50
+ },
51
+ configuration: {
52
+ count: 0
53
+ }
54
+ };
55
+ }
56
+ async initTransfer() {
57
+ const { strategy, restore } = this.options;
58
+ const wantsChecksums = this.options.verifyChecksums === true;
59
+ const query = this.dispatcher?.dispatchCommand({
60
+ command: 'init',
61
+ params: {
62
+ options: {
63
+ strategy,
64
+ restore
65
+ },
66
+ transfer: 'push',
67
+ ...wantsChecksums ? {
68
+ checksums: true
69
+ } : {},
70
+ assetEncoding: 'base64'
71
+ }
72
+ });
73
+ const res = await query;
74
+ if (!res?.transferID) {
75
+ throw new ProviderTransferError('Init failed, invalid response from the server');
76
+ }
77
+ _class_private_field_loose_base(this, _checksumsEnabled)[_checksumsEnabled] = wantsChecksums && res.checksums === true;
78
+ if (wantsChecksums && res.checksums !== true) {
79
+ _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.');
80
+ }
81
+ // A remote that predates #23479 silently drops the `assetEncoding` field instead of echoing
82
+ // it. Falling back to the legacy Buffer JSON shape keeps small pushes working against those
83
+ // remotes; large pushes may still OOM the remote during `JSON.parse` because that shape
84
+ // allocates the full byte array — emit a warning so the user understands the trade-off.
85
+ if (res.assetEncoding === 'base64') {
86
+ _class_private_field_loose_base(this, _assetEncoding)[_assetEncoding] = 'base64';
87
+ } else {
88
+ _class_private_field_loose_base(this, _assetEncoding)[_assetEncoding] = 'legacy-buffer-json';
89
+ _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.');
90
+ }
91
+ this.resetStats();
92
+ return res.transferID;
93
+ }
94
+ async bootstrap(diagnostics) {
95
+ _class_private_field_loose_base(this, _diagnostics)[_diagnostics] = diagnostics;
96
+ const { url, auth } = this.options;
97
+ const validProtocols = [
98
+ 'https:',
99
+ 'http:'
100
+ ];
101
+ let ws;
102
+ if (!validProtocols.includes(url.protocol)) {
103
+ throw new ProviderValidationError(`Invalid protocol "${url.protocol}"`, {
104
+ check: 'url',
105
+ details: {
106
+ protocol: url.protocol,
107
+ validProtocols
108
+ }
109
+ });
110
+ }
111
+ const wsProtocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
112
+ const wsUrl = `${wsProtocol}//${url.host}${trimTrailingSlash(url.pathname)}${TRANSFER_PATH}/push`;
113
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo]('establishing websocket connection');
114
+ // No auth defined, trying public access for transfer
115
+ if (!auth) {
116
+ ws = await connectToWebsocket(wsUrl, undefined, _class_private_field_loose_base(this, _diagnostics)[_diagnostics]);
117
+ } else if (auth.type === 'token') {
118
+ const headers = {
119
+ Authorization: `Bearer ${auth.token}`
120
+ };
121
+ ws = await connectToWebsocket(wsUrl, {
122
+ headers
123
+ }, _class_private_field_loose_base(this, _diagnostics)[_diagnostics]);
124
+ } else {
125
+ throw new ProviderValidationError('Auth method not available', {
126
+ check: 'auth.type',
127
+ details: {
128
+ auth: auth.type
129
+ }
130
+ });
131
+ }
132
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo]('established websocket connection');
133
+ this.ws = ws;
134
+ const { retryMessageOptions } = this.options;
135
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo]('creating dispatcher');
136
+ this.dispatcher = createDispatcher(this.ws, retryMessageOptions, (message)=>_class_private_field_loose_base(this, _reportInfo)[_reportInfo](message));
137
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo]('created dispatcher');
138
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo]('initialize transfer');
139
+ this.transferID = await this.initTransfer();
140
+ _class_private_field_loose_base(this, _reportInfo)[_reportInfo](`initialized transfer ${this.transferID}`);
141
+ this.dispatcher.setTransferProperties({
142
+ id: this.transferID,
143
+ kind: 'push'
144
+ });
145
+ await this.dispatcher.dispatchTransferAction('bootstrap');
146
+ }
147
+ async close() {
148
+ // Gracefully close the remote transfer process
149
+ if (this.transferID && this.dispatcher) {
150
+ await this.dispatcher.dispatchTransferAction('close');
151
+ await this.dispatcher.dispatchCommand({
152
+ command: 'end',
153
+ params: {
154
+ transferID: this.transferID
155
+ }
156
+ });
157
+ }
158
+ await new Promise((resolve)=>{
159
+ const { ws } = this;
160
+ if (!ws || ws.CLOSED) {
161
+ resolve();
162
+ return;
163
+ }
164
+ ws.on('close', ()=>resolve()).close();
165
+ });
166
+ }
167
+ getMetadata() {
168
+ return this.dispatcher?.dispatchTransferAction('getMetadata') ?? null;
169
+ }
170
+ async beforeTransfer() {
171
+ this.options.onTransferPhase?.('Remote: waiting for server to clear data and prepare destination…');
172
+ await this.dispatcher?.dispatchTransferAction('beforeTransfer');
173
+ }
174
+ async rollback() {
175
+ await this.dispatcher?.dispatchTransferAction('rollback');
176
+ }
177
+ getSchemas() {
178
+ if (!this.dispatcher) {
179
+ return Promise.resolve(null);
180
+ }
181
+ return this.dispatcher.dispatchTransferAction('getSchemas');
182
+ }
183
+ createEntitiesWriteStream() {
184
+ return _class_private_field_loose_base(this, _writeStream)[_writeStream]('entities');
185
+ }
186
+ createLinksWriteStream() {
187
+ return _class_private_field_loose_base(this, _writeStream)[_writeStream]('links');
188
+ }
189
+ createConfigurationWriteStream() {
190
+ return _class_private_field_loose_base(this, _writeStream)[_writeStream]('configuration');
191
+ }
192
+ createAssetsWriteStream() {
193
+ let batch = [];
194
+ let hasStarted = false;
195
+ const verifyChecksums = _class_private_field_loose_base(this, _checksumsEnabled)[_checksumsEnabled];
196
+ const encodeAssetChunk = _class_private_field_loose_base(this, _assetEncoding)[_assetEncoding] === 'base64' ? createTransferAssetStreamChunk : createTransferAssetStreamChunkLegacy;
197
+ const batchSize = 1024 * 1024; // 1MB;
198
+ const batchLength = ()=>{
199
+ return batch.reduce((acc, chunk)=>acc + transferAssetStreamChunkByteLength(chunk), 0);
200
+ };
201
+ const startAssetsTransferOnce = _class_private_field_loose_base(this, _startStepOnce)[_startStepOnce]('assets');
202
+ const flush = async ()=>{
203
+ const streamError = await _class_private_field_loose_base(this, _streamStep)[_streamStep]('assets', batch);
204
+ batch = [];
205
+ return streamError;
206
+ };
207
+ const safePush = async (chunk)=>{
208
+ batch.push(chunk);
209
+ if (batchLength() >= batchSize) {
210
+ const streamError = await flush();
211
+ if (streamError) {
212
+ throw streamError;
213
+ }
214
+ }
215
+ };
216
+ return new Writable({
217
+ objectMode: true,
218
+ final: async (callback)=>{
219
+ if (batch.length > 0) {
220
+ await flush();
221
+ }
222
+ if (hasStarted) {
223
+ const { error: endStepError } = await _class_private_field_loose_base(this, _endStep)[_endStep]('assets');
224
+ if (endStepError) {
225
+ return callback(endStepError);
226
+ }
227
+ }
228
+ return callback(null);
229
+ },
230
+ async write (asset, _encoding, callback) {
231
+ const startError = await startAssetsTransferOnce();
232
+ if (startError) {
233
+ return callback(startError);
234
+ }
235
+ hasStarted = true;
236
+ const assetID = randomUUID();
237
+ const { filename, filepath, stats, stream, metadata } = asset;
238
+ const checksumHash = verifyChecksums ? createHash('sha256') : undefined;
239
+ try {
240
+ await safePush({
241
+ action: 'start',
242
+ assetID,
243
+ data: {
244
+ filename,
245
+ filepath,
246
+ stats,
247
+ metadata
248
+ }
249
+ });
250
+ for await (const chunk of stream){
251
+ checksumHash?.update(chunk);
252
+ await safePush(encodeAssetChunk(assetID, chunk));
253
+ }
254
+ await safePush({
255
+ action: 'end',
256
+ assetID,
257
+ ...checksumHash ? {
258
+ checksum: {
259
+ algorithm: 'sha256',
260
+ value: checksumHash.digest('hex')
261
+ }
262
+ } : {}
263
+ });
264
+ callback();
265
+ } catch (error) {
266
+ callback(error instanceof Error ? error : new Error(String(error)));
267
+ }
268
+ }
269
+ });
270
+ }
271
+ constructor(options){
272
+ Object.defineProperty(this, _startStepOnce, {
273
+ value: startStepOnce
274
+ });
275
+ Object.defineProperty(this, _startStep, {
276
+ value: startStep
277
+ });
278
+ Object.defineProperty(this, _endStep, {
279
+ value: endStep
280
+ });
281
+ Object.defineProperty(this, _streamStep, {
282
+ value: streamStep
283
+ });
284
+ Object.defineProperty(this, _writeStream, {
285
+ value: writeStream
286
+ });
287
+ Object.defineProperty(this, _reportInfo, {
288
+ value: reportInfo
289
+ });
290
+ Object.defineProperty(this, _reportWarning, {
291
+ value: reportWarning
292
+ });
293
+ Object.defineProperty(this, _diagnostics, {
294
+ writable: true,
295
+ value: void 0
296
+ });
297
+ Object.defineProperty(this, _checksumsEnabled, {
298
+ writable: true,
299
+ value: void 0
300
+ });
301
+ Object.defineProperty(this, _assetEncoding, {
302
+ writable: true,
303
+ value: void 0
304
+ });
305
+ this.name = 'destination::remote-strapi';
306
+ this.type = 'destination';
307
+ _class_private_field_loose_base(this, _checksumsEnabled)[_checksumsEnabled] = false;
308
+ _class_private_field_loose_base(this, _assetEncoding)[_assetEncoding] = 'base64';
309
+ this.options = options;
310
+ this.ws = null;
311
+ this.dispatcher = null;
312
+ this.transferID = null;
313
+ _class_private_field_loose_base(this, _checksumsEnabled)[_checksumsEnabled] = options.verifyChecksums === true;
314
+ this.resetStats();
315
+ }
316
+ }
317
+ function startStepOnce(stage) {
318
+ return once(()=>_class_private_field_loose_base(this, _startStep)[_startStep](stage));
319
+ }
320
+ async function startStep(step) {
321
+ try {
322
+ await this.dispatcher?.dispatchTransferStep({
323
+ action: 'start',
324
+ step
325
+ });
326
+ } catch (e) {
327
+ if (e instanceof Error) {
328
+ return e;
329
+ }
330
+ if (typeof e === 'string') {
331
+ return new ProviderTransferError(e);
332
+ }
333
+ return new ProviderTransferError('Unexpected error');
334
+ }
335
+ this.stats[step] = {
336
+ count: 0
337
+ };
338
+ return null;
339
+ }
340
+ async function endStep(step) {
341
+ try {
342
+ const res = await this.dispatcher?.dispatchTransferStep({
343
+ action: 'end',
344
+ step
345
+ });
346
+ return {
347
+ stats: res?.stats ?? null,
348
+ error: null
349
+ };
350
+ } catch (e) {
351
+ if (e instanceof Error) {
352
+ return {
353
+ stats: null,
354
+ error: e
355
+ };
356
+ }
357
+ if (typeof e === 'string') {
358
+ return {
359
+ stats: null,
360
+ error: new ProviderTransferError(e)
361
+ };
362
+ }
363
+ return {
364
+ stats: null,
365
+ error: new ProviderTransferError('Unexpected error')
366
+ };
367
+ }
368
+ }
369
+ async function streamStep(step, message) {
370
+ try {
371
+ if (step === 'assets') {
372
+ const assetMessage = message;
373
+ this.stats[step].count += assetMessage.filter((data)=>data.action === 'start').length;
374
+ } else {
375
+ this.stats[step].count += message.length;
376
+ }
377
+ await this.dispatcher?.dispatchTransferStep({
378
+ action: 'stream',
379
+ step,
380
+ data: message
381
+ });
382
+ } catch (e) {
383
+ if (e instanceof Error) {
384
+ return e;
385
+ }
386
+ if (typeof e === 'string') {
387
+ return new ProviderTransferError(e);
388
+ }
389
+ return new ProviderTransferError('Unexpected error');
390
+ }
391
+ return null;
392
+ }
393
+ function writeStream(step) {
394
+ const startTransferOnce = _class_private_field_loose_base(this, _startStepOnce)[_startStepOnce](step);
395
+ let batch = [];
396
+ let batchStartedAt = 0;
397
+ const batchLength = ()=>jsonLength(batch);
398
+ const flushBatch = async ()=>{
399
+ if (batch.length === 0) {
400
+ return null;
401
+ }
402
+ const payload = batch;
403
+ batch = [];
404
+ batchStartedAt = 0;
405
+ return _class_private_field_loose_base(this, _streamStep)[_streamStep](step, payload);
406
+ };
407
+ const shouldFlushBatchAfterPush = ()=>{
408
+ if (batch.length === 0) {
409
+ return false;
410
+ }
411
+ return batchLength() >= STREAM_STEP_MAX_BATCH_BYTES || batch.length >= STREAM_STEP_MAX_BATCH_ITEMS || Date.now() - batchStartedAt >= STREAM_STEP_MAX_BATCH_AGE_MS;
412
+ };
413
+ return new Writable({
414
+ objectMode: true,
415
+ final: async (callback)=>{
416
+ if (batch.length > 0) {
417
+ const streamError = await flushBatch();
418
+ if (streamError) {
419
+ return callback(streamError);
420
+ }
421
+ }
422
+ const { error, stats } = await _class_private_field_loose_base(this, _endStep)[_endStep](step);
423
+ const { count } = this.stats[step];
424
+ if (stats && (stats.started !== count || stats.finished !== count)) {
425
+ callback(new Error(`Data missing: sent ${this.stats[step].count} ${step}, received ${stats.started} and saved ${stats.finished} ${step}`));
426
+ }
427
+ callback(error);
428
+ },
429
+ async write (chunk, _encoding, callback) {
430
+ const startError = await startTransferOnce();
431
+ if (startError) {
432
+ return callback(startError);
433
+ }
434
+ // Flush a batch that has sat long enough before growing it further (bounded latency).
435
+ if (batch.length > 0 && Date.now() - batchStartedAt >= STREAM_STEP_MAX_BATCH_AGE_MS) {
436
+ const staleError = await flushBatch();
437
+ if (staleError) {
438
+ return callback(staleError);
439
+ }
440
+ }
441
+ batch.push(chunk);
442
+ if (batch.length === 1) {
443
+ batchStartedAt = Date.now();
444
+ }
445
+ if (shouldFlushBatchAfterPush()) {
446
+ const streamError = await flushBatch();
447
+ if (streamError) {
448
+ return callback(streamError);
449
+ }
450
+ }
451
+ callback();
452
+ }
453
+ });
454
+ }
455
+ function reportInfo(message) {
456
+ _class_private_field_loose_base(this, _diagnostics)[_diagnostics]?.report({
457
+ details: {
458
+ createdAt: new Date(),
459
+ message,
460
+ origin: 'remote-destination-provider'
461
+ },
462
+ kind: 'info'
463
+ });
464
+ }
465
+ function reportWarning(message) {
466
+ _class_private_field_loose_base(this, _diagnostics)[_diagnostics]?.report({
467
+ details: {
468
+ createdAt: new Date(),
469
+ message,
470
+ origin: 'remote-destination-provider'
471
+ },
472
+ kind: 'warning'
473
+ });
474
+ }
475
+ const createRemoteStrapiDestinationProvider = (options)=>{
476
+ return new RemoteStrapiDestinationProvider(options);
477
+ };
478
+
479
+ export { createRemoteStrapiDestinationProvider };
480
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","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,GAAAA,GAAgBC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AM,KAAK,CAAA,EAAG;AACtBiC,gBAAAA,cAAAA,GAAiBI,KAAKC,GAAG,EAAA;AAC3B,YAAA;AAEA,YAAA,IAAIF,yBAAAA,EAAAA,EAA6B;AAC/B,gBAAA,MAAM3C,cAAc,MAAMyC,UAAAA,EAAAA;AAC1B,gBAAA,IAAIzC,WAAAA,EAAa;AACf,oBAAA,OAAOM,QAAAA,CAASN,WAAAA,CAAAA;AAClB,gBAAA;AACF,YAAA;AAEAM,YAAAA,QAAAA,EAAAA;AACF,QAAA;AACF,KAAA,CAAA;AACF;AAEA,SAAA,WAAYtC,OAAe,EAAA;AACzB,IAAA,+BAAA,CAAA,IAAI,EAAC,YAAA,CAAA,CAAA,YAAA,CAAA,EAAciF,MAAAA,CAAO;QACxBhG,OAAAA,EAAS;AACPiG,YAAAA,SAAAA,EAAW,IAAIN,IAAAA,EAAAA;AACf5E,YAAAA,OAAAA;YACAmF,MAAAA,EAAQ;AACV,SAAA;QACAhF,IAAAA,EAAM;AACR,KAAA,CAAA;AACF;AAEA,SAAA,cAAeH,OAAe,EAAA;AAC5B,IAAA,+BAAA,CAAA,IAAI,EAAC,YAAA,CAAA,CAAA,YAAA,CAAA,EAAciF,MAAAA,CAAO;QACxBhG,OAAAA,EAAS;AACPiG,YAAAA,SAAAA,EAAW,IAAIN,IAAAA,EAAAA;AACf5E,YAAAA,OAAAA;YACAmF,MAAAA,EAAQ;AACV,SAAA;QACAhF,IAAAA,EAAM;AACR,KAAA,CAAA;AACF;AAsNK,MAAMiF,wCAAwC,CACnD3H,OAAAA,GAAAA;AAEA,IAAA,OAAO,IAAIX,+BAAAA,CAAgCW,OAAAA,CAAAA;AAC7C;;;;"}
@@ -1,9 +1,9 @@
1
- /// <reference types="node" />
2
- import { Readable, Writable } from 'stream';
1
+ import { Readable } from 'stream';
3
2
  import type { Struct, Utils } from '@strapi/types';
4
3
  import { WebSocket } from 'ws';
5
- import type { IMetadata, ISourceProvider, ISourceProviderTransferResults, MaybePromise, ProviderType } from '../../../../types';
6
- import { Auth } from '../../../../types/remote/protocol';
4
+ import type { IMetadata, ISourceProvider, ISourceProviderTransferResults, MaybePromise, ProviderType, StageTotalsEstimate, TransferStage } from '../../../types';
5
+ import type { IDiagnosticReporter } from '../../../utils/diagnostic';
6
+ import { Auth } from '../../../types/remote/protocol';
7
7
  import { ILocalStrapiSourceProviderOptions } from '../local-source';
8
8
  import { createDispatcher } from '../utils';
9
9
  export interface IRemoteStrapiSourceProviderOptions extends ILocalStrapiSourceProviderOptions {
@@ -13,6 +13,10 @@ export interface IRemoteStrapiSourceProviderOptions extends ILocalStrapiSourcePr
13
13
  retryMessageTimeout: number;
14
14
  retryMessageMaxRetries: number;
15
15
  };
16
+ /** Max ms without forward progress on an asset (new remote chunk accepted or chunk fully handed to the asset stream). */
17
+ streamTimeout?: number;
18
+ /** Require per-asset checksum verification for transferred asset bytes. */
19
+ verifyChecksums?: boolean;
16
20
  }
17
21
  declare class RemoteStrapiSourceProvider implements ISourceProvider {
18
22
  #private;
@@ -21,19 +25,20 @@ declare class RemoteStrapiSourceProvider implements ISourceProvider {
21
25
  options: IRemoteStrapiSourceProviderOptions;
22
26
  ws: WebSocket | null;
23
27
  dispatcher: ReturnType<typeof createDispatcher> | null;
28
+ defaultOptions: Partial<IRemoteStrapiSourceProviderOptions>;
24
29
  constructor(options: IRemoteStrapiSourceProviderOptions);
25
30
  results?: ISourceProviderTransferResults | undefined;
26
31
  createEntitiesReadStream(): MaybePromise<Readable>;
27
32
  createLinksReadStream(): MaybePromise<Readable>;
28
- writeAsync: <T>(stream: Writable, data: T) => Promise<void>;
29
33
  createAssetsReadStream(): Promise<Readable>;
30
34
  createConfigurationReadStream(): MaybePromise<Readable>;
31
35
  getMetadata(): Promise<IMetadata | null>;
32
36
  assertValidProtocol(url: URL): void;
33
37
  initTransfer(): Promise<string>;
34
- bootstrap(): Promise<void>;
38
+ bootstrap(diagnostics?: IDiagnosticReporter): Promise<void>;
35
39
  close(): Promise<void>;
36
40
  getSchemas(): Promise<Utils.String.Dict<Struct.Schema> | null>;
41
+ getStageTotals(stage: TransferStage): Promise<StageTotalsEstimate | null>;
37
42
  }
38
43
  export declare const createRemoteStrapiSourceProvider: (options: IRemoteStrapiSourceProviderOptions) => RemoteStrapiSourceProvider;
39
44
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/strapi/providers/remote-source/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAe,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAG/B,OAAO,KAAK,EAEV,SAAS,EACT,eAAe,EACf,8BAA8B,EAC9B,YAAY,EAEZ,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAkB,IAAI,EAAE,MAAM,mCAAmC,CAAC;AAGzE,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAyC,MAAM,UAAU,CAAC;AAEnF,MAAM,WAAW,kCAAmC,SAAQ,iCAAiC;IAC3F,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC;IAC/B,mBAAmB,CAAC,EAAE;QACpB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,sBAAsB,EAAE,MAAM,CAAC;KAChC,CAAC;CACH;AAED,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;gBAE3C,OAAO,EAAE,kCAAkC;IAMvD,OAAO,CA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