@strapi/data-transfer 4.14.4 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/dist/commands/commander.d.ts +1 -0
  2. package/dist/commands/commander.d.ts.map +1 -0
  3. package/dist/commands/data-transfer.d.ts +2 -1
  4. package/dist/commands/data-transfer.d.ts.map +1 -0
  5. package/dist/commands/export/action.d.ts +1 -0
  6. package/dist/commands/export/action.d.ts.map +1 -0
  7. package/dist/commands/export/command.d.ts +1 -0
  8. package/dist/commands/export/command.d.ts.map +1 -0
  9. package/dist/commands/helpers.d.ts +1 -0
  10. package/dist/commands/helpers.d.ts.map +1 -0
  11. package/dist/commands/import/action.d.ts +1 -0
  12. package/dist/commands/import/action.d.ts.map +1 -0
  13. package/dist/commands/import/command.d.ts +1 -0
  14. package/dist/commands/import/command.d.ts.map +1 -0
  15. package/dist/commands/index.d.ts +1 -0
  16. package/dist/commands/index.d.ts.map +1 -0
  17. package/dist/commands/transfer/action.d.ts +1 -0
  18. package/dist/commands/transfer/action.d.ts.map +1 -0
  19. package/dist/commands/transfer/command.d.ts +1 -0
  20. package/dist/commands/transfer/command.d.ts.map +1 -0
  21. package/dist/engine/diagnostic.d.ts +1 -0
  22. package/dist/engine/diagnostic.d.ts.map +1 -0
  23. package/dist/engine/errors.d.ts +1 -0
  24. package/dist/engine/errors.d.ts.map +1 -0
  25. package/dist/engine/index.d.ts +1 -0
  26. package/dist/engine/index.d.ts.map +1 -0
  27. package/dist/engine/validation/index.d.ts +1 -0
  28. package/dist/engine/validation/index.d.ts.map +1 -0
  29. package/dist/engine/validation/provider.d.ts +1 -0
  30. package/dist/engine/validation/provider.d.ts.map +1 -0
  31. package/dist/engine/validation/schemas/index.d.ts +1 -0
  32. package/dist/engine/validation/schemas/index.d.ts.map +1 -0
  33. package/dist/errors/base.d.ts +1 -0
  34. package/dist/errors/base.d.ts.map +1 -0
  35. package/dist/errors/constants.d.ts +1 -0
  36. package/dist/errors/constants.d.ts.map +1 -0
  37. package/dist/errors/index.d.ts +1 -0
  38. package/dist/errors/index.d.ts.map +1 -0
  39. package/dist/errors/providers.d.ts +1 -0
  40. package/dist/errors/providers.d.ts.map +1 -0
  41. package/dist/file/index.d.ts +1 -0
  42. package/dist/file/index.d.ts.map +1 -0
  43. package/dist/file/providers/destination/index.d.ts +1 -0
  44. package/dist/file/providers/destination/index.d.ts.map +1 -0
  45. package/dist/file/providers/destination/utils.d.ts +1 -0
  46. package/dist/file/providers/destination/utils.d.ts.map +1 -0
  47. package/dist/file/providers/index.d.ts +1 -0
  48. package/dist/file/providers/index.d.ts.map +1 -0
  49. package/dist/file/providers/source/index.d.ts +1 -0
  50. package/dist/file/providers/source/index.d.ts.map +1 -0
  51. package/dist/file/providers/source/utils.d.ts +1 -0
  52. package/dist/file/providers/source/utils.d.ts.map +1 -0
  53. package/dist/index.d.ts +1 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +5242 -30
  56. package/dist/index.js.map +1 -1
  57. package/dist/index.mjs +5213 -0
  58. package/dist/index.mjs.map +1 -0
  59. package/dist/strapi/index.d.ts +1 -0
  60. package/dist/strapi/index.d.ts.map +1 -0
  61. package/dist/strapi/providers/index.d.ts +1 -0
  62. package/dist/strapi/providers/index.d.ts.map +1 -0
  63. package/dist/strapi/providers/local-destination/index.d.ts +1 -0
  64. package/dist/strapi/providers/local-destination/index.d.ts.map +1 -0
  65. package/dist/strapi/providers/local-destination/strategies/index.d.ts +1 -0
  66. package/dist/strapi/providers/local-destination/strategies/index.d.ts.map +1 -0
  67. package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts +1 -0
  68. package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts.map +1 -0
  69. package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts +1 -0
  70. package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts.map +1 -0
  71. package/dist/strapi/providers/local-destination/strategies/restore/index.d.ts +1 -0
  72. package/dist/strapi/providers/local-destination/strategies/restore/index.d.ts.map +1 -0
  73. package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts +1 -0
  74. package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts.map +1 -0
  75. package/dist/strapi/providers/local-source/assets.d.ts +1 -0
  76. package/dist/strapi/providers/local-source/assets.d.ts.map +1 -0
  77. package/dist/strapi/providers/local-source/configuration.d.ts +1 -0
  78. package/dist/strapi/providers/local-source/configuration.d.ts.map +1 -0
  79. package/dist/strapi/providers/local-source/entities.d.ts +1 -0
  80. package/dist/strapi/providers/local-source/entities.d.ts.map +1 -0
  81. package/dist/strapi/providers/local-source/index.d.ts +1 -0
  82. package/dist/strapi/providers/local-source/index.d.ts.map +1 -0
  83. package/dist/strapi/providers/local-source/links.d.ts +1 -0
  84. package/dist/strapi/providers/local-source/links.d.ts.map +1 -0
  85. package/dist/strapi/providers/remote-destination/index.d.ts +1 -0
  86. package/dist/strapi/providers/remote-destination/index.d.ts.map +1 -0
  87. package/dist/strapi/providers/remote-source/index.d.ts +1 -0
  88. package/dist/strapi/providers/remote-source/index.d.ts.map +1 -0
  89. package/dist/strapi/providers/utils.d.ts +1 -0
  90. package/dist/strapi/providers/utils.d.ts.map +1 -0
  91. package/dist/strapi/queries/entity.d.ts +1 -0
  92. package/dist/strapi/queries/entity.d.ts.map +1 -0
  93. package/dist/strapi/queries/index.d.ts +1 -0
  94. package/dist/strapi/queries/index.d.ts.map +1 -0
  95. package/dist/strapi/queries/link.d.ts +1 -0
  96. package/dist/strapi/queries/link.d.ts.map +1 -0
  97. package/dist/strapi/remote/constants.d.ts +1 -0
  98. package/dist/strapi/remote/constants.d.ts.map +1 -0
  99. package/dist/strapi/remote/flows/default.d.ts +1 -0
  100. package/dist/strapi/remote/flows/default.d.ts.map +1 -0
  101. package/dist/strapi/remote/flows/index.d.ts +1 -0
  102. package/dist/strapi/remote/flows/index.d.ts.map +1 -0
  103. package/dist/strapi/remote/handlers/abstract.d.ts +1 -0
  104. package/dist/strapi/remote/handlers/abstract.d.ts.map +1 -0
  105. package/dist/strapi/remote/handlers/constants.d.ts +1 -0
  106. package/dist/strapi/remote/handlers/constants.d.ts.map +1 -0
  107. package/dist/strapi/remote/handlers/index.d.ts +4 -3
  108. package/dist/strapi/remote/handlers/index.d.ts.map +1 -0
  109. package/dist/strapi/remote/handlers/pull.d.ts +1 -0
  110. package/dist/strapi/remote/handlers/pull.d.ts.map +1 -0
  111. package/dist/strapi/remote/handlers/push.d.ts +1 -0
  112. package/dist/strapi/remote/handlers/push.d.ts.map +1 -0
  113. package/dist/strapi/remote/handlers/utils.d.ts +1 -0
  114. package/dist/strapi/remote/handlers/utils.d.ts.map +1 -0
  115. package/dist/strapi/remote/index.d.ts +1 -0
  116. package/dist/strapi/remote/index.d.ts.map +1 -0
  117. package/dist/utils/components.d.ts +1 -0
  118. package/dist/utils/components.d.ts.map +1 -0
  119. package/dist/utils/encryption/decrypt.d.ts +1 -0
  120. package/dist/utils/encryption/decrypt.d.ts.map +1 -0
  121. package/dist/utils/encryption/encrypt.d.ts +1 -0
  122. package/dist/utils/encryption/encrypt.d.ts.map +1 -0
  123. package/dist/utils/encryption/index.d.ts +1 -0
  124. package/dist/utils/encryption/index.d.ts.map +1 -0
  125. package/dist/utils/index.d.ts +1 -0
  126. package/dist/utils/index.d.ts.map +1 -0
  127. package/dist/utils/json.d.ts +1 -0
  128. package/dist/utils/json.d.ts.map +1 -0
  129. package/dist/utils/middleware.d.ts +1 -0
  130. package/dist/utils/middleware.d.ts.map +1 -0
  131. package/dist/utils/providers.d.ts +1 -0
  132. package/dist/utils/providers.d.ts.map +1 -0
  133. package/dist/utils/schema.d.ts +1 -0
  134. package/dist/utils/schema.d.ts.map +1 -0
  135. package/dist/utils/stream.d.ts +1 -0
  136. package/dist/utils/stream.d.ts.map +1 -0
  137. package/dist/utils/transaction.d.ts +1 -0
  138. package/dist/utils/transaction.d.ts.map +1 -0
  139. package/package.json +19 -17
  140. package/dist/commands/commander.js +0 -138
  141. package/dist/commands/commander.js.map +0 -1
  142. package/dist/commands/data-transfer.js +0 -359
  143. package/dist/commands/data-transfer.js.map +0 -1
  144. package/dist/commands/export/action.js +0 -156
  145. package/dist/commands/export/action.js.map +0 -1
  146. package/dist/commands/export/command.js +0 -30
  147. package/dist/commands/export/command.js.map +0 -1
  148. package/dist/commands/helpers.js +0 -87
  149. package/dist/commands/helpers.js.map +0 -1
  150. package/dist/commands/import/action.js +0 -139
  151. package/dist/commands/import/action.js.map +0 -1
  152. package/dist/commands/import/command.js +0 -75
  153. package/dist/commands/import/command.js.map +0 -1
  154. package/dist/commands/index.js +0 -13
  155. package/dist/commands/index.js.map +0 -1
  156. package/dist/commands/transfer/action.js +0 -161
  157. package/dist/commands/transfer/action.js.map +0 -1
  158. package/dist/commands/transfer/command.js +0 -69
  159. package/dist/commands/transfer/command.js.map +0 -1
  160. package/dist/engine/diagnostic.js +0 -50
  161. package/dist/engine/diagnostic.js.map +0 -1
  162. package/dist/engine/errors.js +0 -29
  163. package/dist/engine/errors.js.map +0 -1
  164. package/dist/engine/index.js +0 -708
  165. package/dist/engine/index.js.map +0 -1
  166. package/dist/engine/validation/index.js +0 -19
  167. package/dist/engine/validation/index.js.map +0 -1
  168. package/dist/engine/validation/provider.js +0 -18
  169. package/dist/engine/validation/provider.js.map +0 -1
  170. package/dist/engine/validation/schemas/index.js +0 -70
  171. package/dist/engine/validation/schemas/index.js.map +0 -1
  172. package/dist/errors/base.js +0 -16
  173. package/dist/errors/base.js.map +0 -1
  174. package/dist/errors/constants.js +0 -9
  175. package/dist/errors/constants.js.map +0 -1
  176. package/dist/errors/index.js +0 -19
  177. package/dist/errors/index.js.map +0 -1
  178. package/dist/errors/providers.js +0 -32
  179. package/dist/errors/providers.js.map +0 -1
  180. package/dist/file/index.js +0 -28
  181. package/dist/file/index.js.map +0 -1
  182. package/dist/file/providers/destination/index.js +0 -177
  183. package/dist/file/providers/destination/index.js.map +0 -1
  184. package/dist/file/providers/destination/utils.js +0 -62
  185. package/dist/file/providers/destination/utils.js.map +0 -1
  186. package/dist/file/providers/index.js +0 -19
  187. package/dist/file/providers/index.js.map +0 -1
  188. package/dist/file/providers/source/index.js +0 -234
  189. package/dist/file/providers/source/index.js.map +0 -1
  190. package/dist/file/providers/source/utils.js +0 -62
  191. package/dist/file/providers/source/utils.js.map +0 -1
  192. package/dist/strapi/index.js +0 -30
  193. package/dist/strapi/index.js.map +0 -1
  194. package/dist/strapi/providers/index.js +0 -23
  195. package/dist/strapi/providers/index.js.map +0 -1
  196. package/dist/strapi/providers/local-destination/index.js +0 -360
  197. package/dist/strapi/providers/local-destination/index.js.map +0 -1
  198. package/dist/strapi/providers/local-destination/strategies/index.js +0 -28
  199. package/dist/strapi/providers/local-destination/strategies/index.js.map +0 -1
  200. package/dist/strapi/providers/local-destination/strategies/restore/configuration.js +0 -51
  201. package/dist/strapi/providers/local-destination/strategies/restore/configuration.js.map +0 -1
  202. package/dist/strapi/providers/local-destination/strategies/restore/entities.js +0 -106
  203. package/dist/strapi/providers/local-destination/strategies/restore/entities.js.map +0 -1
  204. package/dist/strapi/providers/local-destination/strategies/restore/index.js +0 -109
  205. package/dist/strapi/providers/local-destination/strategies/restore/index.js.map +0 -1
  206. package/dist/strapi/providers/local-destination/strategies/restore/links.js +0 -32
  207. package/dist/strapi/providers/local-destination/strategies/restore/links.js.map +0 -1
  208. package/dist/strapi/providers/local-source/assets.js +0 -102
  209. package/dist/strapi/providers/local-source/assets.js.map +0 -1
  210. package/dist/strapi/providers/local-source/configuration.js +0 -36
  211. package/dist/strapi/providers/local-source/configuration.js.map +0 -1
  212. package/dist/strapi/providers/local-source/entities.js +0 -85
  213. package/dist/strapi/providers/local-source/entities.js.map +0 -1
  214. package/dist/strapi/providers/local-source/index.js +0 -100
  215. package/dist/strapi/providers/local-source/index.js.map +0 -1
  216. package/dist/strapi/providers/local-source/links.js +0 -23
  217. package/dist/strapi/providers/local-source/links.js.map +0 -1
  218. package/dist/strapi/providers/remote-destination/index.js +0 -270
  219. package/dist/strapi/providers/remote-destination/index.js.map +0 -1
  220. package/dist/strapi/providers/remote-source/index.js +0 -239
  221. package/dist/strapi/providers/remote-source/index.js.map +0 -1
  222. package/dist/strapi/providers/utils.js +0 -138
  223. package/dist/strapi/providers/utils.js.map +0 -1
  224. package/dist/strapi/queries/entity.js +0 -130
  225. package/dist/strapi/queries/entity.js.map +0 -1
  226. package/dist/strapi/queries/index.js +0 -29
  227. package/dist/strapi/queries/index.js.map +0 -1
  228. package/dist/strapi/queries/link.js +0 -224
  229. package/dist/strapi/queries/link.js.map +0 -1
  230. package/dist/strapi/remote/constants.js +0 -6
  231. package/dist/strapi/remote/constants.js.map +0 -1
  232. package/dist/strapi/remote/flows/default.js +0 -41
  233. package/dist/strapi/remote/flows/default.js.map +0 -1
  234. package/dist/strapi/remote/flows/index.js +0 -59
  235. package/dist/strapi/remote/flows/index.js.map +0 -1
  236. package/dist/strapi/remote/handlers/abstract.js +0 -3
  237. package/dist/strapi/remote/handlers/abstract.js.map +0 -1
  238. package/dist/strapi/remote/handlers/constants.js +0 -5
  239. package/dist/strapi/remote/handlers/constants.js.map +0 -1
  240. package/dist/strapi/remote/handlers/index.js +0 -10
  241. package/dist/strapi/remote/handlers/index.js.map +0 -1
  242. package/dist/strapi/remote/handlers/pull.js +0 -243
  243. package/dist/strapi/remote/handlers/pull.js.map +0 -1
  244. package/dist/strapi/remote/handlers/push.js +0 -311
  245. package/dist/strapi/remote/handlers/push.js.map +0 -1
  246. package/dist/strapi/remote/handlers/utils.js +0 -298
  247. package/dist/strapi/remote/handlers/utils.js.map +0 -1
  248. package/dist/strapi/remote/index.js +0 -29
  249. package/dist/strapi/remote/index.js.map +0 -1
  250. package/dist/utils/components.js +0 -381
  251. package/dist/utils/components.js.map +0 -1
  252. package/dist/utils/encryption/decrypt.js +0 -47
  253. package/dist/utils/encryption/decrypt.js.map +0 -1
  254. package/dist/utils/encryption/encrypt.js +0 -47
  255. package/dist/utils/encryption/encrypt.js.map +0 -1
  256. package/dist/utils/encryption/index.js +0 -19
  257. package/dist/utils/encryption/index.js.map +0 -1
  258. package/dist/utils/index.js +0 -33
  259. package/dist/utils/index.js.map +0 -1
  260. package/dist/utils/json.js +0 -68
  261. package/dist/utils/json.js.map +0 -1
  262. package/dist/utils/middleware.js +0 -14
  263. package/dist/utils/middleware.js.map +0 -1
  264. package/dist/utils/providers.js +0 -11
  265. package/dist/utils/providers.js.map +0 -1
  266. package/dist/utils/schema.js +0 -29
  267. package/dist/utils/schema.js.map +0 -1
  268. package/dist/utils/stream.js +0 -59
  269. package/dist/utils/stream.js.map +0 -1
  270. package/dist/utils/transaction.js +0 -88
  271. package/dist/utils/transaction.js.map +0 -1
@@ -1,360 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.createLocalStrapiDestinationProvider = exports.DEFAULT_CONFLICT_STRATEGY = exports.VALID_CONFLICT_STRATEGIES = void 0;
30
- const stream_1 = require("stream");
31
- const path_1 = __importDefault(require("path"));
32
- const fse = __importStar(require("fs-extra"));
33
- const strategies_1 = require("./strategies");
34
- const utils = __importStar(require("../../../utils"));
35
- const providers_1 = require("../../../errors/providers");
36
- const providers_2 = require("../../../utils/providers");
37
- exports.VALID_CONFLICT_STRATEGIES = ['restore'];
38
- exports.DEFAULT_CONFLICT_STRATEGY = 'restore';
39
- class LocalStrapiDestinationProvider {
40
- name = 'destination::local-strapi';
41
- type = 'destination';
42
- options;
43
- strapi;
44
- transaction;
45
- uploadsBackupDirectoryName;
46
- /**
47
- * The entities mapper is used to map old entities to their new IDs
48
- */
49
- #entitiesMapper;
50
- constructor(options) {
51
- this.options = options;
52
- this.#entitiesMapper = {};
53
- this.uploadsBackupDirectoryName = `uploads_backup_${Date.now()}`;
54
- }
55
- async bootstrap() {
56
- this.#validateOptions();
57
- this.strapi = await this.options.getStrapi();
58
- if (!this.strapi) {
59
- throw new providers_1.ProviderInitializationError('Could not access local strapi');
60
- }
61
- this.transaction = utils.transaction.createTransaction(this.strapi);
62
- }
63
- // TODO: either move this to restore strategy, or restore strategy should given access to these instead of repeating the logic possibly in a different way
64
- #areAssetsIncluded = () => {
65
- return this.options.restore?.assets;
66
- };
67
- #isContentTypeIncluded = (type) => {
68
- const notIncluded = this.options.restore?.entities?.include &&
69
- !this.options.restore?.entities?.include?.includes(type);
70
- const excluded = this.options.restore?.entities?.exclude &&
71
- this.options.restore?.entities.exclude.includes(type);
72
- return !excluded && !notIncluded;
73
- };
74
- async close() {
75
- const { autoDestroy } = this.options;
76
- this.transaction?.end();
77
- // Basically `!== false` but more deterministic
78
- if (autoDestroy === undefined || autoDestroy === true) {
79
- await this.strapi?.destroy();
80
- }
81
- }
82
- #validateOptions() {
83
- if (!exports.VALID_CONFLICT_STRATEGIES.includes(this.options.strategy)) {
84
- throw new providers_1.ProviderValidationError(`Invalid strategy ${this.options.strategy}`, {
85
- check: 'strategy',
86
- strategy: this.options.strategy,
87
- validStrategies: exports.VALID_CONFLICT_STRATEGIES,
88
- });
89
- }
90
- // require restore options when using restore
91
- if (this.options.strategy === 'restore' && !this.options.restore) {
92
- throw new providers_1.ProviderValidationError('Missing restore options');
93
- }
94
- }
95
- async #deleteFromRestoreOptions() {
96
- (0, providers_2.assertValidStrapi)(this.strapi);
97
- if (!this.options.restore) {
98
- throw new providers_1.ProviderValidationError('Missing restore options');
99
- }
100
- return strategies_1.restore.deleteRecords(this.strapi, this.options.restore);
101
- }
102
- async #deleteAllAssets(trx) {
103
- (0, providers_2.assertValidStrapi)(this.strapi);
104
- // if we're not restoring files, don't touch the files
105
- if (!this.#areAssetsIncluded()) {
106
- return;
107
- }
108
- const stream = this.strapi.db
109
- // Create a query builder instance (default type is 'select')
110
- .queryBuilder('plugin::upload.file')
111
- // Fetch all columns
112
- .select('*')
113
- // Attach the transaction
114
- .transacting(trx)
115
- // Get a readable stream
116
- .stream();
117
- // TODO use bulk delete when exists in providers
118
- for await (const file of stream) {
119
- await this.strapi.plugin('upload').provider.delete(file);
120
- if (file.formats) {
121
- for (const fileFormat of Object.values(file.formats)) {
122
- await this.strapi.plugin('upload').provider.delete(fileFormat);
123
- }
124
- }
125
- }
126
- }
127
- async rollback() {
128
- await this.transaction?.rollback();
129
- }
130
- async beforeTransfer() {
131
- if (!this.strapi) {
132
- throw new Error('Strapi instance not found');
133
- }
134
- await this.transaction?.attach(async (trx) => {
135
- try {
136
- if (this.options.strategy === 'restore') {
137
- await this.#handleAssetsBackup();
138
- await this.#deleteAllAssets(trx);
139
- await this.#deleteFromRestoreOptions();
140
- }
141
- }
142
- catch (error) {
143
- throw new Error(`restore failed ${error}`);
144
- }
145
- });
146
- }
147
- getMetadata() {
148
- (0, providers_2.assertValidStrapi)(this.strapi, 'Not able to get Schemas');
149
- const strapiVersion = this.strapi.config.get('info.strapi');
150
- const createdAt = new Date().toISOString();
151
- return {
152
- createdAt,
153
- strapi: {
154
- version: strapiVersion,
155
- },
156
- };
157
- }
158
- getSchemas() {
159
- (0, providers_2.assertValidStrapi)(this.strapi, 'Not able to get Schemas');
160
- const schemas = {
161
- ...this.strapi.contentTypes,
162
- ...this.strapi.components,
163
- };
164
- return utils.schema.mapSchemasValues(schemas);
165
- }
166
- createEntitiesWriteStream() {
167
- (0, providers_2.assertValidStrapi)(this.strapi, 'Not able to import entities');
168
- const { strategy } = this.options;
169
- const updateMappingTable = (type, oldID, newID) => {
170
- if (!this.#entitiesMapper[type]) {
171
- this.#entitiesMapper[type] = {};
172
- }
173
- Object.assign(this.#entitiesMapper[type], { [oldID]: newID });
174
- };
175
- if (strategy === 'restore') {
176
- return strategies_1.restore.createEntitiesWriteStream({
177
- strapi: this.strapi,
178
- updateMappingTable,
179
- transaction: this.transaction,
180
- });
181
- }
182
- throw new providers_1.ProviderValidationError(`Invalid strategy ${this.options.strategy}`, {
183
- check: 'strategy',
184
- strategy: this.options.strategy,
185
- validStrategies: exports.VALID_CONFLICT_STRATEGIES,
186
- });
187
- }
188
- async #handleAssetsBackup() {
189
- (0, providers_2.assertValidStrapi)(this.strapi, 'Not able to create the assets backup');
190
- // if we're not restoring assets, don't back them up because they won't be touched
191
- if (!this.#areAssetsIncluded()) {
192
- return;
193
- }
194
- if (this.strapi.config.get('plugin.upload').provider === 'local') {
195
- const assetsDirectory = path_1.default.join(this.strapi.dirs.static.public, 'uploads');
196
- const backupDirectory = path_1.default.join(this.strapi.dirs.static.public, this.uploadsBackupDirectoryName);
197
- try {
198
- // Check access before attempting to do anything
199
- await fse.access(assetsDirectory,
200
- // eslint-disable-next-line no-bitwise
201
- fse.constants.W_OK | fse.constants.R_OK | fse.constants.F_OK);
202
- // eslint-disable-next-line no-bitwise
203
- await fse.access(path_1.default.join(assetsDirectory, '..'), fse.constants.W_OK | fse.constants.R_OK);
204
- await fse.move(assetsDirectory, backupDirectory);
205
- await fse.mkdir(assetsDirectory);
206
- // Create a .gitkeep file to ensure the directory is not empty
207
- await fse.outputFile(path_1.default.join(assetsDirectory, '.gitkeep'), '');
208
- }
209
- catch (err) {
210
- throw new providers_1.ProviderTransferError('The backup folder for the assets could not be created inside the public folder. Please ensure Strapi has write permissions on the public directory', {
211
- code: 'ASSETS_DIRECTORY_ERR',
212
- });
213
- }
214
- return backupDirectory;
215
- }
216
- }
217
- async #removeAssetsBackup() {
218
- (0, providers_2.assertValidStrapi)(this.strapi, 'Not able to remove Assets');
219
- // if we're not restoring assets, don't back them up because they won't be touched
220
- if (!this.#areAssetsIncluded()) {
221
- return;
222
- }
223
- // TODO: this should catch all thrown errors and bubble it up to engine so it can be reported as a non-fatal diagnostic message telling the user they may need to manually delete assets
224
- if (this.strapi.config.get('plugin.upload').provider === 'local') {
225
- (0, providers_2.assertValidStrapi)(this.strapi);
226
- const backupDirectory = path_1.default.join(this.strapi.dirs.static.public, this.uploadsBackupDirectoryName);
227
- await fse.rm(backupDirectory, { recursive: true, force: true });
228
- }
229
- }
230
- // TODO: Move this logic to the restore strategy
231
- async createAssetsWriteStream() {
232
- (0, providers_2.assertValidStrapi)(this.strapi, 'Not able to stream Assets');
233
- if (!this.#areAssetsIncluded()) {
234
- throw new providers_1.ProviderTransferError('Attempting to transfer assets when they are not included');
235
- }
236
- const removeAssetsBackup = this.#removeAssetsBackup.bind(this);
237
- const strapi = this.strapi;
238
- const transaction = this.transaction;
239
- const backupDirectory = this.uploadsBackupDirectoryName;
240
- const restoreMediaEntitiesContent = this.#isContentTypeIncluded('plugin::upload.file');
241
- return new stream_1.Writable({
242
- objectMode: true,
243
- async final(next) {
244
- // Delete the backup folder
245
- await removeAssetsBackup();
246
- next();
247
- },
248
- async write(chunk, _encoding, callback) {
249
- await transaction?.attach(async () => {
250
- // TODO: Remove this logic in V5
251
- if (!chunk.metadata) {
252
- // If metadata does not exist is because it is an old backup file
253
- const assetsDirectory = path_1.default.join(strapi.dirs.static.public, 'uploads');
254
- const entryPath = path_1.default.join(assetsDirectory, chunk.filename);
255
- const writableStream = fse.createWriteStream(entryPath);
256
- chunk.stream
257
- .pipe(writableStream)
258
- .on('close', () => {
259
- callback(null);
260
- })
261
- .on('error', async (error) => {
262
- const errorMessage = error.code === 'ENOSPC'
263
- ? " Your server doesn't have space to proceed with the import. "
264
- : ' ';
265
- try {
266
- await fse.rm(assetsDirectory, { recursive: true, force: true });
267
- this.destroy(new providers_1.ProviderTransferError(`There was an error during the transfer process.${errorMessage}The original files have been restored to ${assetsDirectory}`));
268
- }
269
- catch (err) {
270
- throw new providers_1.ProviderTransferError(`There was an error doing the rollback process. The original files are in ${backupDirectory}, but we failed to restore them to ${assetsDirectory}`);
271
- }
272
- finally {
273
- callback(error);
274
- }
275
- });
276
- return;
277
- }
278
- const uploadData = {
279
- ...chunk.metadata,
280
- stream: stream_1.Readable.from(chunk.stream),
281
- buffer: chunk?.buffer,
282
- };
283
- const provider = strapi.config.get('plugin.upload').provider;
284
- try {
285
- await strapi.plugin('upload').provider.uploadStream(uploadData);
286
- // if we're not supposed to transfer the associated entities, stop here
287
- if (!restoreMediaEntitiesContent) {
288
- return callback();
289
- }
290
- // Files formats are stored within the parent file entity
291
- if (uploadData?.type) {
292
- const entry = await strapi.db.query('plugin::upload.file').findOne({
293
- where: { hash: uploadData.mainHash },
294
- });
295
- const specificFormat = entry?.formats?.[uploadData.type];
296
- if (specificFormat) {
297
- specificFormat.url = uploadData.url;
298
- }
299
- await strapi.db.query('plugin::upload.file').update({
300
- where: { hash: uploadData.mainHash },
301
- data: {
302
- formats: entry.formats,
303
- provider,
304
- },
305
- });
306
- return callback();
307
- }
308
- const entry = await strapi.db.query('plugin::upload.file').findOne({
309
- where: { hash: uploadData.hash },
310
- });
311
- entry.url = uploadData.url;
312
- await strapi.db.query('plugin::upload.file').update({
313
- where: { hash: uploadData.hash },
314
- data: {
315
- url: entry.url,
316
- provider,
317
- },
318
- });
319
- callback();
320
- }
321
- catch (error) {
322
- callback(new Error(`Error while uploading asset ${chunk.filename} ${error}`));
323
- }
324
- });
325
- },
326
- });
327
- }
328
- async createConfigurationWriteStream() {
329
- (0, providers_2.assertValidStrapi)(this.strapi, 'Not able to stream Configurations');
330
- const { strategy } = this.options;
331
- if (strategy === 'restore') {
332
- return strategies_1.restore.createConfigurationWriteStream(this.strapi, this.transaction);
333
- }
334
- throw new providers_1.ProviderValidationError(`Invalid strategy ${strategy}`, {
335
- check: 'strategy',
336
- strategy,
337
- validStrategies: exports.VALID_CONFLICT_STRATEGIES,
338
- });
339
- }
340
- async createLinksWriteStream() {
341
- if (!this.strapi) {
342
- throw new Error('Not able to stream links. Strapi instance not found');
343
- }
344
- const { strategy } = this.options;
345
- const mapID = (uid, id) => this.#entitiesMapper[uid]?.[id];
346
- if (strategy === 'restore') {
347
- return strategies_1.restore.createLinksWriteStream(mapID, this.strapi, this.transaction);
348
- }
349
- throw new providers_1.ProviderValidationError(`Invalid strategy ${strategy}`, {
350
- check: 'strategy',
351
- strategy,
352
- validStrategies: exports.VALID_CONFLICT_STRATEGIES,
353
- });
354
- }
355
- }
356
- const createLocalStrapiDestinationProvider = (options) => {
357
- return new LocalStrapiDestinationProvider(options);
358
- };
359
- exports.createLocalStrapiDestinationProvider = createLocalStrapiDestinationProvider;
360
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strapi/providers/local-destination/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA4C;AAC5C,gDAAwB;AACxB,8CAAgC;AAYhC,6CAAuC;AACvC,sDAAwC;AACxC,yDAImC;AACnC,wDAA6D;AAEhD,QAAA,yBAAyB,GAAG,CAAC,SAAS,CAAC,CAAC;AACxC,QAAA,yBAAyB,GAAG,SAAS,CAAC;AAUnD,MAAM,8BAA8B;IAClC,IAAI,GAAG,2BAA2B,CAAC;IAEnC,IAAI,GAAiB,aAAa,CAAC;IAEnC,OAAO,CAAyC;IAEhD,MAAM,CAAgB;IAEtB,WA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AC,CAAC;AACrD,CAAC,CAAC;AAJW,QAAA,oCAAoC,wCAI/C"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.restore = void 0;
27
- exports.restore = __importStar(require("./restore"));
28
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/strapi/providers/local-destination/strategies/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAqC"}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createConfigurationWriteStream = exports.restoreConfigs = void 0;
7
- const stream_1 = require("stream");
8
- const fp_1 = require("lodash/fp");
9
- const chalk_1 = __importDefault(require("chalk"));
10
- const providers_1 = require("../../../../../errors/providers");
11
- const omitInvalidCreationAttributes = (0, fp_1.omit)(['id']);
12
- const restoreCoreStore = async (strapi, values) => {
13
- const data = omitInvalidCreationAttributes(values);
14
- return strapi.db.query('strapi::core-store').create({
15
- data: {
16
- ...data,
17
- value: JSON.stringify(data.value),
18
- },
19
- });
20
- };
21
- const restoreWebhooks = async (strapi, values) => {
22
- const data = omitInvalidCreationAttributes(values);
23
- return strapi.db.query('webhook').create({ data });
24
- };
25
- const restoreConfigs = async (strapi, config) => {
26
- if (config.type === 'core-store') {
27
- return restoreCoreStore(strapi, config.value);
28
- }
29
- if (config.type === 'webhook') {
30
- return restoreWebhooks(strapi, config.value);
31
- }
32
- };
33
- exports.restoreConfigs = restoreConfigs;
34
- const createConfigurationWriteStream = async (strapi, transaction) => {
35
- return new stream_1.Writable({
36
- objectMode: true,
37
- async write(config, _encoding, callback) {
38
- await transaction?.attach(async () => {
39
- try {
40
- await (0, exports.restoreConfigs)(strapi, config);
41
- }
42
- catch (error) {
43
- return callback(new providers_1.ProviderTransferError(`Failed to import ${chalk_1.default.yellowBright(config.type)} (${chalk_1.default.greenBright(config.value.id)}`));
44
- }
45
- callback();
46
- });
47
- },
48
- });
49
- };
50
- exports.createConfigurationWriteStream = createConfigurationWriteStream;
51
- //# sourceMappingURL=configuration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/configuration.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAkC;AAClC,kCAAiC;AACjC,kDAA0B;AAE1B,+DAAwE;AAGxE,MAAM,6BAA6B,GAAG,IAAA,SAAI,EAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAEnD,MAAM,gBAAgB,GAAG,KAAK,EAAgC,MAAoB,EAAE,MAAS,EAAE,EAAE;IAC/F,MAAM,IAAI,GAAG,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAA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,CAAC,WAAW,CACvE,MAAM,CAAC,KAAK,CAAC,EAAE,CAChB,EAAE,CACJ,CACF,CAAC;iBACH;gBACD,QAAQ,EAAE,CAAC;YACb,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AA3BW,QAAA,8BAA8B,kCA2BzC"}
@@ -1,106 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.createEntitiesWriteStream = void 0;
27
- const stream_1 = require("stream");
28
- const fp_1 = require("lodash/fp");
29
- const providers_1 = require("../../../../../errors/providers");
30
- const utils_1 = require("../../../../../utils");
31
- const queries = __importStar(require("../../../../queries"));
32
- const createEntitiesWriteStream = (options) => {
33
- const { strapi, updateMappingTable, transaction } = options;
34
- const query = queries.entity.createEntityQuery(strapi);
35
- return new stream_1.Writable({
36
- objectMode: true,
37
- async write(entity, _encoding, callback) {
38
- await transaction?.attach(async () => {
39
- const { type, id, data } = entity;
40
- const { create, getDeepPopulateComponentLikeQuery } = query(type);
41
- const contentType = strapi.getModel(type);
42
- let cType = contentType;
43
- /**
44
- * Resolve the component UID of an entity's attribute based
45
- * on a given path (components & dynamic zones only)
46
- */
47
- const resolveType = (paths) => {
48
- let value = data;
49
- for (const path of paths) {
50
- value = (0, fp_1.get)(path, value);
51
- // Needed when the value of cType should be computed
52
- // based on the next value (eg: dynamic zones)
53
- if (typeof cType === 'function') {
54
- cType = cType(value);
55
- }
56
- if (path in cType.attributes) {
57
- const attribute = cType.attributes[path];
58
- if (attribute.type === 'component') {
59
- cType = strapi.getModel(attribute.component);
60
- }
61
- if (attribute.type === 'dynamiczone') {
62
- cType = ({ __component }) => strapi.getModel(__component);
63
- }
64
- }
65
- }
66
- if ('uid' in cType) {
67
- return cType.uid;
68
- }
69
- return undefined;
70
- };
71
- try {
72
- const created = await create({
73
- data,
74
- populate: getDeepPopulateComponentLikeQuery(contentType, { select: 'id' }),
75
- select: 'id',
76
- });
77
- // Compute differences between original & new entities
78
- const diffs = utils_1.json.diff(data, created);
79
- updateMappingTable(type, id, created.id);
80
- // For each difference found on an ID attribute,
81
- // update the mapping the table accordingly
82
- diffs.forEach((diff) => {
83
- if (diff.kind === 'modified' && (0, fp_1.last)(diff.path) === 'id') {
84
- const target = resolveType(diff.path);
85
- // If no type is found for the given path, then ignore the diff
86
- if (!target) {
87
- return;
88
- }
89
- const [oldID, newID] = diff.values;
90
- updateMappingTable(target, oldID, newID);
91
- }
92
- });
93
- }
94
- catch (e) {
95
- if (e instanceof Error) {
96
- return callback(e);
97
- }
98
- return callback(new providers_1.ProviderTransferError(`Failed to create "${type}" (${id})`));
99
- }
100
- return callback(null);
101
- });
102
- },
103
- });
104
- };
105
- exports.createEntitiesWriteStream = createEntitiesWriteStream;
106
- //# sourceMappingURL=entities.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/entities.ts"],"names":[],"mappings":";;;;;;;;;;;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