@strapi/data-transfer 4.11.5 → 4.11.6

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 (169) hide show
  1. package/package.json +5 -5
  2. package/dist/engine/diagnostic.d.ts +0 -40
  3. package/dist/engine/diagnostic.js +0 -50
  4. package/dist/engine/diagnostic.js.map +0 -1
  5. package/dist/engine/errors.d.ts +0 -28
  6. package/dist/engine/errors.js +0 -29
  7. package/dist/engine/errors.js.map +0 -1
  8. package/dist/engine/index.d.ts +0 -62
  9. package/dist/engine/index.js +0 -644
  10. package/dist/engine/index.js.map +0 -1
  11. package/dist/engine/validation/index.d.ts +0 -2
  12. package/dist/engine/validation/index.js +0 -19
  13. package/dist/engine/validation/index.js.map +0 -1
  14. package/dist/engine/validation/provider.d.ts +0 -3
  15. package/dist/engine/validation/provider.js +0 -18
  16. package/dist/engine/validation/provider.js.map +0 -1
  17. package/dist/engine/validation/schemas/index.d.ts +0 -7
  18. package/dist/engine/validation/schemas/index.js +0 -70
  19. package/dist/engine/validation/schemas/index.js.map +0 -1
  20. package/dist/errors/base.d.ts +0 -8
  21. package/dist/errors/base.js +0 -13
  22. package/dist/errors/base.js.map +0 -1
  23. package/dist/errors/constants.d.ts +0 -3
  24. package/dist/errors/constants.js +0 -9
  25. package/dist/errors/constants.js.map +0 -1
  26. package/dist/errors/index.d.ts +0 -2
  27. package/dist/errors/index.js +0 -19
  28. package/dist/errors/index.js.map +0 -1
  29. package/dist/errors/providers.d.ts +0 -21
  30. package/dist/errors/providers.js +0 -32
  31. package/dist/errors/providers.js.map +0 -1
  32. package/dist/file/index.d.ts +0 -1
  33. package/dist/file/index.js +0 -28
  34. package/dist/file/index.js.map +0 -1
  35. package/dist/file/providers/destination/index.d.ts +0 -46
  36. package/dist/file/providers/destination/index.js +0 -175
  37. package/dist/file/providers/destination/index.js.map +0 -1
  38. package/dist/file/providers/destination/utils.d.ts +0 -9
  39. package/dist/file/providers/destination/utils.js +0 -62
  40. package/dist/file/providers/destination/utils.js.map +0 -1
  41. package/dist/file/providers/index.d.ts +0 -2
  42. package/dist/file/providers/index.js +0 -19
  43. package/dist/file/providers/index.js.map +0 -1
  44. package/dist/file/providers/source/index.d.ts +0 -40
  45. package/dist/file/providers/source/index.js +0 -230
  46. package/dist/file/providers/source/index.js.map +0 -1
  47. package/dist/file/providers/source/utils.d.ts +0 -37
  48. package/dist/file/providers/source/utils.js +0 -62
  49. package/dist/file/providers/source/utils.js.map +0 -1
  50. package/dist/index.d.ts +0 -4
  51. package/dist/index.js +0 -31
  52. package/dist/index.js.map +0 -1
  53. package/dist/strapi/index.d.ts +0 -3
  54. package/dist/strapi/index.js +0 -30
  55. package/dist/strapi/index.js.map +0 -1
  56. package/dist/strapi/providers/index.d.ts +0 -4
  57. package/dist/strapi/providers/index.js +0 -23
  58. package/dist/strapi/providers/index.js.map +0 -1
  59. package/dist/strapi/providers/local-destination/index.d.ts +0 -33
  60. package/dist/strapi/providers/local-destination/index.js +0 -225
  61. package/dist/strapi/providers/local-destination/index.js.map +0 -1
  62. package/dist/strapi/providers/local-destination/strategies/index.d.ts +0 -1
  63. package/dist/strapi/providers/local-destination/strategies/index.js +0 -28
  64. package/dist/strapi/providers/local-destination/strategies/index.js.map +0 -1
  65. package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts +0 -5
  66. package/dist/strapi/providers/local-destination/strategies/restore/configuration.js +0 -51
  67. package/dist/strapi/providers/local-destination/strategies/restore/configuration.js.map +0 -1
  68. package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts +0 -11
  69. package/dist/strapi/providers/local-destination/strategies/restore/entities.js +0 -103
  70. package/dist/strapi/providers/local-destination/strategies/restore/entities.js.map +0 -1
  71. package/dist/strapi/providers/local-destination/strategies/restore/index.d.ts +0 -32
  72. package/dist/strapi/providers/local-destination/strategies/restore/index.js +0 -107
  73. package/dist/strapi/providers/local-destination/strategies/restore/index.js.map +0 -1
  74. package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts +0 -4
  75. package/dist/strapi/providers/local-destination/strategies/restore/links.js +0 -32
  76. package/dist/strapi/providers/local-destination/strategies/restore/links.js.map +0 -1
  77. package/dist/strapi/providers/local-source/assets.d.ts +0 -5
  78. package/dist/strapi/providers/local-source/assets.js +0 -31
  79. package/dist/strapi/providers/local-source/assets.js.map +0 -1
  80. package/dist/strapi/providers/local-source/configuration.d.ts +0 -5
  81. package/dist/strapi/providers/local-source/configuration.js +0 -36
  82. package/dist/strapi/providers/local-source/configuration.js.map +0 -1
  83. package/dist/strapi/providers/local-source/entities.d.ts +0 -10
  84. package/dist/strapi/providers/local-source/entities.js +0 -85
  85. package/dist/strapi/providers/local-source/entities.js.map +0 -1
  86. package/dist/strapi/providers/local-source/index.d.ts +0 -26
  87. package/dist/strapi/providers/local-source/index.js +0 -98
  88. package/dist/strapi/providers/local-source/index.js.map +0 -1
  89. package/dist/strapi/providers/local-source/links.d.ts +0 -5
  90. package/dist/strapi/providers/local-source/links.js +0 -23
  91. package/dist/strapi/providers/local-source/links.js.map +0 -1
  92. package/dist/strapi/providers/remote-destination/index.d.ts +0 -39
  93. package/dist/strapi/providers/remote-destination/index.js +0 -269
  94. package/dist/strapi/providers/remote-destination/index.js.map +0 -1
  95. package/dist/strapi/providers/remote-source/index.d.ts +0 -39
  96. package/dist/strapi/providers/remote-source/index.js +0 -239
  97. package/dist/strapi/providers/remote-source/index.js.map +0 -1
  98. package/dist/strapi/providers/utils.d.ts +0 -39
  99. package/dist/strapi/providers/utils.js +0 -125
  100. package/dist/strapi/providers/utils.js.map +0 -1
  101. package/dist/strapi/queries/entity.d.ts +0 -20
  102. package/dist/strapi/queries/entity.js +0 -130
  103. package/dist/strapi/queries/entity.js.map +0 -1
  104. package/dist/strapi/queries/index.d.ts +0 -2
  105. package/dist/strapi/queries/index.js +0 -29
  106. package/dist/strapi/queries/index.js.map +0 -1
  107. package/dist/strapi/queries/link.d.ts +0 -7
  108. package/dist/strapi/queries/link.js +0 -215
  109. package/dist/strapi/queries/link.js.map +0 -1
  110. package/dist/strapi/remote/constants.d.ts +0 -4
  111. package/dist/strapi/remote/constants.js +0 -6
  112. package/dist/strapi/remote/constants.js.map +0 -1
  113. package/dist/strapi/remote/flows/default.d.ts +0 -3
  114. package/dist/strapi/remote/flows/default.js +0 -41
  115. package/dist/strapi/remote/flows/default.js.map +0 -1
  116. package/dist/strapi/remote/flows/index.d.ts +0 -18
  117. package/dist/strapi/remote/flows/index.js +0 -59
  118. package/dist/strapi/remote/flows/index.js.map +0 -1
  119. package/dist/strapi/remote/handlers/abstract.d.ts +0 -71
  120. package/dist/strapi/remote/handlers/abstract.js +0 -3
  121. package/dist/strapi/remote/handlers/abstract.js.map +0 -1
  122. package/dist/strapi/remote/handlers/constants.d.ts +0 -2
  123. package/dist/strapi/remote/handlers/constants.js +0 -5
  124. package/dist/strapi/remote/handlers/constants.js.map +0 -1
  125. package/dist/strapi/remote/handlers/index.d.ts +0 -3
  126. package/dist/strapi/remote/handlers/index.js +0 -10
  127. package/dist/strapi/remote/handlers/index.js.map +0 -1
  128. package/dist/strapi/remote/handlers/pull.d.ts +0 -22
  129. package/dist/strapi/remote/handlers/pull.js +0 -243
  130. package/dist/strapi/remote/handlers/pull.js.map +0 -1
  131. package/dist/strapi/remote/handlers/push.d.ts +0 -75
  132. package/dist/strapi/remote/handlers/push.js +0 -305
  133. package/dist/strapi/remote/handlers/push.js.map +0 -1
  134. package/dist/strapi/remote/handlers/utils.d.ts +0 -25
  135. package/dist/strapi/remote/handlers/utils.js +0 -200
  136. package/dist/strapi/remote/handlers/utils.js.map +0 -1
  137. package/dist/strapi/remote/index.d.ts +0 -2
  138. package/dist/strapi/remote/index.js +0 -29
  139. package/dist/strapi/remote/index.js.map +0 -1
  140. package/dist/utils/encryption/decrypt.d.ts +0 -11
  141. package/dist/utils/encryption/decrypt.js +0 -47
  142. package/dist/utils/encryption/decrypt.js.map +0 -1
  143. package/dist/utils/encryption/encrypt.d.ts +0 -11
  144. package/dist/utils/encryption/encrypt.js +0 -47
  145. package/dist/utils/encryption/encrypt.js.map +0 -1
  146. package/dist/utils/encryption/index.d.ts +0 -2
  147. package/dist/utils/encryption/index.js +0 -19
  148. package/dist/utils/encryption/index.js.map +0 -1
  149. package/dist/utils/index.d.ts +0 -6
  150. package/dist/utils/index.js +0 -33
  151. package/dist/utils/index.js.map +0 -1
  152. package/dist/utils/json.d.ts +0 -30
  153. package/dist/utils/json.js +0 -68
  154. package/dist/utils/json.js.map +0 -1
  155. package/dist/utils/middleware.d.ts +0 -2
  156. package/dist/utils/middleware.js +0 -14
  157. package/dist/utils/middleware.js.map +0 -1
  158. package/dist/utils/providers.d.ts +0 -2
  159. package/dist/utils/providers.js +0 -11
  160. package/dist/utils/providers.js.map +0 -1
  161. package/dist/utils/schema.d.ts +0 -6
  162. package/dist/utils/schema.js +0 -29
  163. package/dist/utils/schema.js.map +0 -1
  164. package/dist/utils/stream.d.ts +0 -27
  165. package/dist/utils/stream.js +0 -59
  166. package/dist/utils/stream.js.map +0 -1
  167. package/dist/utils/transaction.d.ts +0 -3
  168. package/dist/utils/transaction.js +0 -88
  169. package/dist/utils/transaction.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"links.js","sourceRoot":"","sources":["../../../../../../src/strapi/providers/local-destination/strategies/restore/links.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAClC,+DAAwE;AAExE,mDAA2D;AAEpD,MAAM,sBAAsB,GAAG,CACpC,KAAsD,EACtD,MAAqB,EACrB,WAAyB,EACzB,EAAE;IACF,OAAO,IAAI,iBAAQ,CAAC;QAClB,UAAU,EAAE,IAAI;QAChB,KAAK,CAAC,KAAK,CAAC,IAAW,EAAE,SAAS,EAAE,QAAQ;YAC1C,MAAM,WAAW,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;gBACtC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;gBAC7B,MAAM,KAAK,GAAG,IAAA,sBAAe,EAAC,MAAM,EAAE,GAAG,CAAC,CAAC;gBAE3C,oBAAoB;gBACpB,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC;gBAClD,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC;gBAEtD,IAAI;oBACF,MAAM,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;iBAC5B;gBAAC,OAAO,CAAC,EAAE;oBACV,IAAI,CAAC,YAAY,KAAK,EAAE;wBACtB,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;qBACpB;oBAED,OAAO,QAAQ,CACb,IAAI,iCAAqB,CACvB,8CAA8C,IAAI,CAAC,IAAI,QAAQ,CAChE,CACF,CAAC;iBACH;gBAED,QAAQ,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAlCW,QAAA,sBAAsB,0BAkCjC"}
@@ -1,5 +0,0 @@
1
- import { Duplex } from 'stream';
2
- /**
3
- * Generate and consume assets streams in order to stream each file individually
4
- */
5
- export declare const createAssetsStream: (strapi: Strapi.Strapi) => Duplex;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAssetsStream = void 0;
4
- const path_1 = require("path");
5
- const fs_extra_1 = require("fs-extra");
6
- const stream_1 = require("stream");
7
- const IGNORED_FILES = ['.gitkeep'];
8
- /**
9
- * Generate and consume assets streams in order to stream each file individually
10
- */
11
- const createAssetsStream = (strapi) => {
12
- const assetsDirectory = (0, path_1.join)(strapi.dirs.static.public, 'uploads');
13
- const generator = async function* () {
14
- const files = await (0, fs_extra_1.readdir)(assetsDirectory);
15
- const validFiles = files.filter((file) => !IGNORED_FILES.includes(file));
16
- for (const filename of validFiles) {
17
- const filepath = (0, path_1.join)(assetsDirectory, filename);
18
- const stats = await (0, fs_extra_1.stat)(filepath);
19
- const stream = (0, fs_extra_1.createReadStream)(filepath);
20
- yield {
21
- filename,
22
- filepath,
23
- stream,
24
- stats: { size: stats.size },
25
- };
26
- }
27
- };
28
- return stream_1.Duplex.from(generator());
29
- };
30
- exports.createAssetsStream = createAssetsStream;
31
- //# sourceMappingURL=assets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assets.js","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/assets.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,uCAA2D;AAC3D,mCAAgC;AAIhC,MAAM,aAAa,GAAG,CAAC,UAAU,CAAC,CAAC;AAEnC;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAU,EAAE;IAClE,MAAM,eAAe,GAAG,IAAA,WAAI,EAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAEnE,MAAM,SAAS,GAAuC,KAAK,SAAS,CAAC;QACnE,MAAM,KAAK,GAAG,MAAM,IAAA,kBAAO,EAAC,eAAe,CAAC,CAAC;QAC7C,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAEzE,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;YACjC,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;YACjD,MAAM,KAAK,GAAG,MAAM,IAAA,eAAI,EAAC,QAAQ,CAAC,CAAC;YACnC,MAAM,MAAM,GAAG,IAAA,2BAAgB,EAAC,QAAQ,CAAC,CAAC;YAE1C,MAAM;gBACJ,QAAQ;gBACR,QAAQ;gBACR,MAAM;gBACN,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;aAC5B,CAAC;SACH;IACH,CAAC,CAAC;IAEF,OAAO,eAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;AAClC,CAAC,CAAC;AAtBW,QAAA,kBAAkB,sBAsB7B"}
@@ -1,5 +0,0 @@
1
- import { Readable } from 'stream';
2
- /**
3
- * Create a readable stream that export the Strapi app configuration
4
- */
5
- export declare const createConfigurationStream: (strapi: Strapi.Strapi) => Readable;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createConfigurationStream = void 0;
4
- const stream_chain_1 = require("stream-chain");
5
- const stream_1 = require("stream");
6
- const fp_1 = require("lodash/fp");
7
- /**
8
- * Create a readable stream that export the Strapi app configuration
9
- */
10
- const createConfigurationStream = (strapi) => {
11
- return stream_1.Readable.from((async function* configurationGenerator() {
12
- // Core Store
13
- const coreStoreStream = (0, stream_chain_1.chain)([
14
- strapi.db.queryBuilder('strapi::core-store').stream(),
15
- (data) => (0, fp_1.set)('value', JSON.parse(data.value), data),
16
- wrapConfigurationItem('core-store'),
17
- ]);
18
- // Webhook
19
- const webhooksStream = (0, stream_chain_1.chain)([
20
- strapi.db.queryBuilder('webhook').stream(),
21
- wrapConfigurationItem('webhook'),
22
- ]);
23
- const streams = [coreStoreStream, webhooksStream];
24
- for (const stream of streams) {
25
- for await (const item of stream) {
26
- yield item;
27
- }
28
- }
29
- })());
30
- };
31
- exports.createConfigurationStream = createConfigurationStream;
32
- const wrapConfigurationItem = (type) => (value) => ({
33
- type,
34
- value,
35
- });
36
- //# sourceMappingURL=configuration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/configuration.ts"],"names":[],"mappings":";;;AAAA,+CAAqC;AACrC,mCAAkC;AAClC,kCAAgC;AAIhC;;GAEG;AACI,MAAM,yBAAyB,GAAG,CAAC,MAAqB,EAAY,EAAE;IAC3E,OAAO,iBAAQ,CAAC,IAAI,CAClB,CAAC,KAAK,SAAS,CAAC,CAAC,sBAAsB;QACrC,aAAa;QACb,MAAM,eAAe,GAAG,IAAA,oBAAK,EAAC;YAC5B,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,MAAM,EAAE;YACrD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,QAAG,EAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;YACpD,qBAAqB,CAAC,YAAY,CAAC;SACpC,CAAC,CAAC;QAEH,UAAU;QACV,MAAM,cAAc,GAAG,IAAA,oBAAK,EAAC;YAC3B,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE;YAC1C,qBAAqB,CAAC,SAAS,CAAC;SACjC,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;QAElD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,MAAM,EAAE;gBAC/B,MAAM,IAAI,CAAC;aACZ;SACF;IACH,CAAC,CAAC,EAAE,CACL,CAAC;AACJ,CAAC,CAAC;AAzBW,QAAA,yBAAyB,6BAyBpC;AAEF,MAAM,qBAAqB,GAAG,CAAC,IAA8B,EAAE,EAAE,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC;IACrF,IAAI;IACJ,KAAK;CACN,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- import { Readable, PassThrough } from 'stream';
2
- /**
3
- * Generate and consume content-types streams in order to stream each entity individually
4
- */
5
- export declare const createEntitiesStream: (strapi: Strapi.Strapi) => Readable;
6
- /**
7
- * Create an entity transform stream which convert the output of
8
- * the multi-content-types stream to the transfer entity format
9
- */
10
- export declare const createEntitiesTransformStream: () => PassThrough;
@@ -1,85 +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.createEntitiesTransformStream = exports.createEntitiesStream = void 0;
27
- const stream_1 = require("stream");
28
- const shared = __importStar(require("../../queries"));
29
- /**
30
- * Generate and consume content-types streams in order to stream each entity individually
31
- */
32
- const createEntitiesStream = (strapi) => {
33
- const contentTypes = Object.values(strapi.contentTypes);
34
- async function* contentTypeStreamGenerator() {
35
- for (const contentType of contentTypes) {
36
- const query = shared.entity.createEntityQuery(strapi).call(null, contentType.uid);
37
- const stream = strapi.db
38
- // Create a query builder instance (default type is 'select')
39
- .queryBuilder(contentType.uid)
40
- // Fetch all columns
41
- .select('*')
42
- // Apply the populate
43
- .populate(query.deepPopulateComponentLikeQuery)
44
- // Get a readable stream
45
- .stream();
46
- yield { contentType, stream };
47
- }
48
- }
49
- return stream_1.Readable.from((async function* entitiesGenerator() {
50
- for await (const { stream, contentType } of contentTypeStreamGenerator()) {
51
- try {
52
- for await (const entity of stream) {
53
- yield { entity, contentType };
54
- }
55
- }
56
- catch {
57
- // ignore
58
- }
59
- finally {
60
- stream.destroy();
61
- }
62
- }
63
- })());
64
- };
65
- exports.createEntitiesStream = createEntitiesStream;
66
- /**
67
- * Create an entity transform stream which convert the output of
68
- * the multi-content-types stream to the transfer entity format
69
- */
70
- const createEntitiesTransformStream = () => {
71
- return new stream_1.PassThrough({
72
- objectMode: true,
73
- transform(data, _encoding, callback) {
74
- const { entity, contentType } = data;
75
- const { id, ...attributes } = entity;
76
- callback(null, {
77
- type: contentType.uid,
78
- id,
79
- data: attributes,
80
- });
81
- },
82
- });
83
- };
84
- exports.createEntitiesTransformStream = createEntitiesTransformStream;
85
- //# sourceMappingURL=entities.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/entities.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,mCAA+C;AAC/C,sDAAwC;AAGxC;;GAEG;AACI,MAAM,oBAAoB,GAAG,CAAC,MAAqB,EAAY,EAAE;IACtE,MAAM,YAAY,GAAyB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAE9E,KAAK,SAAS,CAAC,CAAC,0BAA0B;QACxC,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;YACtC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;YAElF,MAAM,MAAM,GAAa,MAAM,CAAC,EAAE;gBAChC,6DAA6D;iBAC5D,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC;gBAC9B,oBAAoB;iBACnB,MAAM,CAAC,GAAG,CAAC;gBACZ,qBAAqB;iBACpB,QAAQ,CAAC,KAAK,CAAC,8BAA8B,CAAC;gBAC/C,wBAAwB;iBACvB,MAAM,EAAE,CAAC;YAEZ,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;SAC/B;IACH,CAAC;IAED,OAAO,iBAAQ,CAAC,IAAI,CAClB,CAAC,KAAK,SAAS,CAAC,CAAC,iBAAiB;QAIhC,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,0BAA0B,EAAE,EAAE;YACxE,IAAI;gBACF,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,MAAM,EAAE;oBACjC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;iBAC/B;aACF;YAAC,MAAM;gBACN,SAAS;aACV;oBAAS;gBACR,MAAM,CAAC,OAAO,EAAE,CAAC;aAClB;SACF;IACH,CAAC,CAAC,EAAE,CACL,CAAC;AACJ,CAAC,CAAC;AAvCW,QAAA,oBAAoB,wBAuC/B;AAEF;;;GAGG;AACI,MAAM,6BAA6B,GAAG,GAAgB,EAAE;IAC7D,OAAO,IAAI,oBAAW,CAAC;QACrB,UAAU,EAAE,IAAI;QAChB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ;YACjC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;YACrC,MAAM,EAAE,EAAE,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAC;YAErC,QAAQ,CAAC,IAAI,EAAE;gBACb,IAAI,EAAE,WAAW,CAAC,GAAG;gBACrB,EAAE;gBACF,IAAI,EAAE,UAAU;aACjB,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAdW,QAAA,6BAA6B,iCAcxC"}
@@ -1,26 +0,0 @@
1
- /// <reference types="node" />
2
- import { Readable } from 'stream';
3
- import type { IMetadata, ISourceProvider, ProviderType } from '../../../../types';
4
- export interface ILocalStrapiSourceProviderOptions {
5
- getStrapi(): Strapi.Strapi | Promise<Strapi.Strapi>;
6
- autoDestroy?: boolean;
7
- }
8
- export declare const createLocalStrapiSourceProvider: (options: ILocalStrapiSourceProviderOptions) => LocalStrapiSourceProvider;
9
- declare class LocalStrapiSourceProvider implements ISourceProvider {
10
- name: string;
11
- type: ProviderType;
12
- options: ILocalStrapiSourceProviderOptions;
13
- strapi?: Strapi.Strapi;
14
- constructor(options: ILocalStrapiSourceProviderOptions);
15
- bootstrap(): Promise<void>;
16
- close(): Promise<void>;
17
- getMetadata(): IMetadata;
18
- createEntitiesReadStream(): Promise<Readable>;
19
- createLinksReadStream(): Readable;
20
- createConfigurationReadStream(): Readable;
21
- getSchemas(): import("@strapi/strapi/lib/types/utils/string").Dict<import("@strapi/strapi/lib/types/core/schemas").Schema>;
22
- createSchemasReadStream(): Readable;
23
- createAssetsReadStream(): Readable;
24
- }
25
- export type ILocalStrapiSourceProvider = InstanceType<typeof LocalStrapiSourceProvider>;
26
- export {};
@@ -1,98 +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.createLocalStrapiSourceProvider = void 0;
27
- const stream_chain_1 = require("stream-chain");
28
- const stream_1 = require("stream");
29
- const entities_1 = require("./entities");
30
- const links_1 = require("./links");
31
- const configuration_1 = require("./configuration");
32
- const assets_1 = require("./assets");
33
- const utils = __importStar(require("../../../utils"));
34
- const providers_1 = require("../../../utils/providers");
35
- const createLocalStrapiSourceProvider = (options) => {
36
- return new LocalStrapiSourceProvider(options);
37
- };
38
- exports.createLocalStrapiSourceProvider = createLocalStrapiSourceProvider;
39
- class LocalStrapiSourceProvider {
40
- constructor(options) {
41
- this.name = 'source::local-strapi';
42
- this.type = 'source';
43
- this.options = options;
44
- }
45
- async bootstrap() {
46
- this.strapi = await this.options.getStrapi();
47
- }
48
- async close() {
49
- const { autoDestroy } = this.options;
50
- // Basically `!== false` but more deterministic
51
- if (autoDestroy === undefined || autoDestroy === true) {
52
- await this.strapi?.destroy();
53
- }
54
- }
55
- getMetadata() {
56
- const strapiVersion = strapi.config.get('info.strapi');
57
- const createdAt = new Date().toISOString();
58
- return {
59
- createdAt,
60
- strapi: {
61
- version: strapiVersion,
62
- },
63
- };
64
- }
65
- async createEntitiesReadStream() {
66
- (0, providers_1.assertValidStrapi)(this.strapi, 'Not able to stream entities');
67
- return (0, stream_chain_1.chain)([
68
- // Entities stream
69
- (0, entities_1.createEntitiesStream)(this.strapi),
70
- // Transform stream
71
- (0, entities_1.createEntitiesTransformStream)(),
72
- ]);
73
- }
74
- createLinksReadStream() {
75
- (0, providers_1.assertValidStrapi)(this.strapi, 'Not able to stream links');
76
- return (0, links_1.createLinksStream)(this.strapi);
77
- }
78
- createConfigurationReadStream() {
79
- (0, providers_1.assertValidStrapi)(this.strapi, 'Not able to stream configuration');
80
- return (0, configuration_1.createConfigurationStream)(strapi);
81
- }
82
- getSchemas() {
83
- (0, providers_1.assertValidStrapi)(this.strapi, 'Not able to get Schemas');
84
- const schemas = {
85
- ...this.strapi.contentTypes,
86
- ...this.strapi.components,
87
- };
88
- return utils.schema.mapSchemasValues(schemas);
89
- }
90
- createSchemasReadStream() {
91
- return stream_1.Readable.from(Object.values(this.getSchemas()));
92
- }
93
- createAssetsReadStream() {
94
- (0, providers_1.assertValidStrapi)(this.strapi, 'Not able to stream assets');
95
- return (0, assets_1.createAssetsStream)(this.strapi);
96
- }
97
- }
98
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqC;AACrC,mCAAkC;AAGlC,yCAAiF;AACjF,mCAA4C;AAC5C,mDAA4D;AAC5D,qCAA8C;AAC9C,sDAAwC;AACxC,wDAA6D;AAQtD,MAAM,+BAA+B,GAAG,CAAC,OAA0C,EAAE,EAAE;IAC5F,OAAO,IAAI,yBAAyB,CAAC,OAAO,CAAC,CAAC;AAChD,CAAC,CAAC;AAFW,QAAA,+BAA+B,mCAE1C;AAEF,MAAM,yBAAyB;IAS7B,YAAY,OAA0C;QARtD,SAAI,GAAG,sBAAsB,CAAC;QAE9B,SAAI,GAAiB,QAAQ,CAAC;QAO5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,SAAS;QACb,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAErC,+CAA+C;QAC/C,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,IAAI,EAAE;YACrD,MAAM,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;SAC9B;IACH,CAAC;IAED,WAAW;QACT,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACvD,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAE3C,OAAO;YACL,SAAS;YACT,MAAM,EAAE;gBACN,OAAO,EAAE,aAAa;aACvB;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,wBAAwB;QAC5B,IAAA,6BAAiB,EAAC,IAAI,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;QAE9D,OAAO,IAAA,oBAAK,EAAC;YACX,kBAAkB;YAClB,IAAA,+BAAoB,EAAC,IAAI,CAAC,MAAM,CAAC;YAEjC,mBAAmB;YACnB,IAAA,wCAA6B,GAAE;SAChC,CAAC,CAAC;IACL,CAAC;IAED,qBAAqB;QACnB,IAAA,6BAAiB,EAAC,IAAI,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;QAE3D,OAAO,IAAA,yBAAiB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,6BAA6B;QAC3B,IAAA,6BAAiB,EAAC,IAAI,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAC;QAEnE,OAAO,IAAA,yCAAyB,EAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAED,UAAU;QACR,IAAA,6BAAiB,EAAC,IAAI,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;QAE1D,MAAM,OAAO,GAAG;YACd,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY;YAC3B,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU;SAC1B,CAAC;QAEF,OAAO,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAED,uBAAuB;QACrB,OAAO,iBAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,sBAAsB;QACpB,IAAA,6BAAiB,EAAC,IAAI,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;QAE5D,OAAO,IAAA,2BAAkB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;CACF"}
@@ -1,5 +0,0 @@
1
- import { Readable } from 'stream';
2
- /**
3
- * Create a Readable which will stream all the links from a Strapi instance
4
- */
5
- export declare const createLinksStream: (strapi: Strapi.Strapi) => Readable;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLinksStream = void 0;
4
- const stream_1 = require("stream");
5
- const link_1 = require("../../queries/link");
6
- /**
7
- * Create a Readable which will stream all the links from a Strapi instance
8
- */
9
- const createLinksStream = (strapi) => {
10
- const uids = [...Object.keys(strapi.contentTypes), ...Object.keys(strapi.components)];
11
- // Async generator stream that returns every link from a Strapi instance
12
- return stream_1.Readable.from((async function* linkGenerator() {
13
- const query = (0, link_1.createLinkQuery)(strapi);
14
- for (const uid of uids) {
15
- const generator = query().generateAll(uid);
16
- for await (const link of generator) {
17
- yield link;
18
- }
19
- }
20
- })());
21
- };
22
- exports.createLinksStream = createLinksStream;
23
- //# sourceMappingURL=links.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"links.js","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/links.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAGlC,6CAAqD;AAErD;;GAEG;AACI,MAAM,iBAAiB,GAAG,CAAC,MAAqB,EAAY,EAAE;IACnE,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAa,CAAC;IAElG,wEAAwE;IACxE,OAAO,iBAAQ,CAAC,IAAI,CAClB,CAAC,KAAK,SAAS,CAAC,CAAC,aAAa;QAC5B,MAAM,KAAK,GAAG,IAAA,sBAAe,EAAC,MAAM,CAAC,CAAC;QAEtC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,MAAM,SAAS,GAAG,KAAK,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YAE3C,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,SAAS,EAAE;gBAClC,MAAM,IAAI,CAAC;aACZ;SACF;IACH,CAAC,CAAC,EAAE,CACL,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,iBAAiB,qBAiB5B"}
@@ -1,39 +0,0 @@
1
- /// <reference types="node" />
2
- import { WebSocket } from 'ws';
3
- import { Writable } from 'stream';
4
- import type { Schema, Utils } from '@strapi/strapi';
5
- import { createDispatcher } from '../utils';
6
- import type { IDestinationProvider, IMetadata, ProviderType } from '../../../../types';
7
- import type { Auth } from '../../../../types/remote/protocol';
8
- import type { ILocalStrapiDestinationProviderOptions } from '../local-destination';
9
- export interface IRemoteStrapiDestinationProviderOptions extends Pick<ILocalStrapiDestinationProviderOptions, 'restore' | 'strategy'> {
10
- url: URL;
11
- auth?: Auth.ITransferTokenAuth;
12
- retryMessageOptions?: {
13
- retryMessageTimeout: number;
14
- retryMessageMaxRetries: number;
15
- };
16
- }
17
- declare class RemoteStrapiDestinationProvider implements IDestinationProvider {
18
- #private;
19
- name: string;
20
- type: ProviderType;
21
- options: IRemoteStrapiDestinationProviderOptions;
22
- ws: WebSocket | null;
23
- dispatcher: ReturnType<typeof createDispatcher> | null;
24
- transferID: string | null;
25
- constructor(options: IRemoteStrapiDestinationProviderOptions);
26
- initTransfer(): Promise<string>;
27
- bootstrap(): Promise<void>;
28
- close(): Promise<void>;
29
- getMetadata(): Promise<IMetadata | null> | null;
30
- beforeTransfer(): Promise<void>;
31
- rollback(): Promise<void>;
32
- getSchemas(): Promise<Utils.String.Dict<Schema.Schema> | null>;
33
- createEntitiesWriteStream(): Writable;
34
- createLinksWriteStream(): Writable;
35
- createConfigurationWriteStream(): Writable;
36
- createAssetsWriteStream(): Writable | Promise<Writable>;
37
- }
38
- export declare const createRemoteStrapiDestinationProvider: (options: IRemoteStrapiDestinationProviderOptions) => RemoteStrapiDestinationProvider;
39
- export {};