@strapi/data-transfer 4.10.0-beta.0 → 4.10.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 (189) hide show
  1. package/dist/engine/diagnostic.d.ts +10 -10
  2. package/dist/engine/diagnostic.js.map +1 -0
  3. package/dist/engine/errors.d.ts +2 -2
  4. package/dist/engine/errors.js.map +1 -0
  5. package/dist/engine/index.d.ts +1 -1
  6. package/dist/engine/index.js.map +1 -0
  7. package/dist/engine/validation/index.js.map +1 -0
  8. package/dist/engine/validation/provider.js.map +1 -0
  9. package/dist/engine/validation/schemas/index.js +29 -12
  10. package/dist/engine/validation/schemas/index.js.map +1 -0
  11. package/dist/errors/base.js.map +1 -0
  12. package/dist/errors/constants.d.ts +1 -1
  13. package/dist/errors/constants.js.map +1 -0
  14. package/dist/errors/index.js.map +1 -0
  15. package/dist/errors/providers.d.ts +2 -2
  16. package/dist/errors/providers.js.map +1 -0
  17. package/dist/file/index.js.map +1 -0
  18. package/dist/file/providers/destination/index.d.ts +1 -0
  19. package/dist/file/providers/destination/index.js +2 -1
  20. package/dist/file/providers/destination/index.js.map +1 -0
  21. package/dist/file/providers/destination/utils.d.ts +1 -1
  22. package/dist/file/providers/destination/utils.js +2 -1
  23. package/dist/file/providers/destination/utils.js.map +1 -0
  24. package/dist/file/providers/index.js.map +1 -0
  25. package/dist/file/providers/source/index.d.ts +1 -1
  26. package/dist/file/providers/source/index.js +34 -24
  27. package/dist/file/providers/source/index.js.map +1 -0
  28. package/dist/file/providers/source/utils.d.ts +37 -0
  29. package/dist/file/providers/source/utils.js +62 -0
  30. package/dist/file/providers/source/utils.js.map +1 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/strapi/index.js.map +1 -0
  33. package/dist/strapi/providers/index.js.map +1 -0
  34. package/dist/strapi/providers/local-destination/index.js.map +1 -0
  35. package/dist/strapi/providers/local-destination/strategies/index.js.map +1 -0
  36. package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts +1 -1
  37. package/dist/strapi/providers/local-destination/strategies/restore/configuration.js.map +1 -0
  38. package/dist/strapi/providers/local-destination/strategies/restore/entities.js.map +1 -0
  39. package/dist/strapi/providers/local-destination/strategies/restore/index.d.ts +1 -1
  40. package/dist/strapi/providers/local-destination/strategies/restore/index.js.map +1 -0
  41. package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts +1 -1
  42. package/dist/strapi/providers/local-destination/strategies/restore/links.js.map +1 -0
  43. package/dist/strapi/providers/local-source/assets.js.map +1 -0
  44. package/dist/strapi/providers/local-source/configuration.js.map +1 -0
  45. package/dist/strapi/providers/local-source/entities.js.map +1 -0
  46. package/dist/strapi/providers/local-source/index.d.ts +1 -1
  47. package/dist/strapi/providers/local-source/index.js.map +1 -0
  48. package/dist/strapi/providers/local-source/links.js.map +1 -0
  49. package/dist/strapi/providers/remote-destination/index.js +4 -19
  50. package/dist/strapi/providers/remote-destination/index.js.map +1 -0
  51. package/dist/strapi/providers/remote-source/index.js +3 -4
  52. package/dist/strapi/providers/remote-source/index.js.map +1 -0
  53. package/dist/strapi/providers/utils.d.ts +8 -3
  54. package/dist/strapi/providers/utils.js +22 -1
  55. package/dist/strapi/providers/utils.js.map +1 -0
  56. package/dist/strapi/queries/entity.js.map +1 -0
  57. package/dist/strapi/queries/index.js.map +1 -0
  58. package/dist/strapi/queries/link.js.map +1 -0
  59. package/dist/strapi/remote/constants.d.ts +2 -2
  60. package/dist/strapi/remote/constants.js.map +1 -0
  61. package/dist/strapi/remote/flows/default.js.map +1 -0
  62. package/dist/strapi/remote/flows/index.d.ts +1 -1
  63. package/dist/strapi/remote/flows/index.js.map +1 -0
  64. package/dist/strapi/remote/handlers/abstract.d.ts +1 -1
  65. package/dist/strapi/remote/handlers/abstract.js.map +1 -0
  66. package/dist/strapi/remote/handlers/constants.d.ts +1 -1
  67. package/dist/strapi/remote/handlers/constants.js.map +1 -0
  68. package/dist/strapi/remote/handlers/index.js.map +1 -0
  69. package/dist/strapi/remote/handlers/pull.d.ts +1 -1
  70. package/dist/strapi/remote/handlers/pull.js.map +1 -0
  71. package/dist/strapi/remote/handlers/push.d.ts +1 -1
  72. package/dist/strapi/remote/handlers/push.js.map +1 -0
  73. package/dist/strapi/remote/handlers/utils.d.ts +1 -1
  74. package/dist/strapi/remote/handlers/utils.js.map +1 -0
  75. package/dist/strapi/remote/index.js.map +1 -0
  76. package/dist/utils/encryption/decrypt.js.map +1 -0
  77. package/dist/utils/encryption/encrypt.js.map +1 -0
  78. package/dist/utils/encryption/index.js.map +1 -0
  79. package/dist/utils/index.js.map +1 -0
  80. package/dist/utils/json.d.ts +1 -1
  81. package/dist/utils/json.js.map +1 -0
  82. package/dist/utils/providers.d.ts +1 -1
  83. package/dist/utils/providers.js.map +1 -0
  84. package/dist/utils/schema.js.map +1 -0
  85. package/dist/utils/stream.d.ts +1 -1
  86. package/dist/utils/stream.js.map +1 -0
  87. package/dist/utils/transaction.js.map +1 -0
  88. package/package.json +18 -17
  89. package/jest.config.js +0 -14
  90. package/lib/engine/diagnostic.d.ts +0 -40
  91. package/lib/engine/diagnostic.js +0 -50
  92. package/lib/engine/errors.d.ts +0 -28
  93. package/lib/engine/errors.js +0 -29
  94. package/lib/engine/index.d.ts +0 -44
  95. package/lib/engine/index.js +0 -506
  96. package/lib/engine/validation/index.d.ts +0 -2
  97. package/lib/engine/validation/index.js +0 -19
  98. package/lib/engine/validation/provider.d.ts +0 -3
  99. package/lib/engine/validation/provider.js +0 -18
  100. package/lib/engine/validation/schemas/index.d.ts +0 -7
  101. package/lib/engine/validation/schemas/index.js +0 -53
  102. package/lib/errors/base.d.ts +0 -8
  103. package/lib/errors/base.js +0 -13
  104. package/lib/errors/constants.d.ts +0 -3
  105. package/lib/errors/constants.js +0 -9
  106. package/lib/errors/index.d.ts +0 -2
  107. package/lib/errors/index.js +0 -19
  108. package/lib/errors/providers.d.ts +0 -21
  109. package/lib/errors/providers.js +0 -32
  110. package/lib/file/index.d.ts +0 -1
  111. package/lib/file/index.js +0 -28
  112. package/lib/file/providers/destination/index.d.ts +0 -45
  113. package/lib/file/providers/destination/index.js +0 -174
  114. package/lib/file/providers/destination/utils.d.ts +0 -9
  115. package/lib/file/providers/destination/utils.js +0 -61
  116. package/lib/file/providers/index.d.ts +0 -2
  117. package/lib/file/providers/index.js +0 -19
  118. package/lib/file/providers/source/index.d.ts +0 -40
  119. package/lib/file/providers/source/index.js +0 -220
  120. package/lib/index.d.ts +0 -4
  121. package/lib/index.js +0 -31
  122. package/lib/strapi/index.d.ts +0 -3
  123. package/lib/strapi/index.js +0 -30
  124. package/lib/strapi/providers/index.d.ts +0 -3
  125. package/lib/strapi/providers/index.js +0 -22
  126. package/lib/strapi/providers/local-destination/index.d.ts +0 -34
  127. package/lib/strapi/providers/local-destination/index.js +0 -220
  128. package/lib/strapi/providers/local-destination/strategies/index.d.ts +0 -1
  129. package/lib/strapi/providers/local-destination/strategies/index.js +0 -28
  130. package/lib/strapi/providers/local-destination/strategies/restore/configuration.d.ts +0 -5
  131. package/lib/strapi/providers/local-destination/strategies/restore/configuration.js +0 -51
  132. package/lib/strapi/providers/local-destination/strategies/restore/entities.d.ts +0 -11
  133. package/lib/strapi/providers/local-destination/strategies/restore/entities.js +0 -103
  134. package/lib/strapi/providers/local-destination/strategies/restore/index.d.ts +0 -32
  135. package/lib/strapi/providers/local-destination/strategies/restore/index.js +0 -107
  136. package/lib/strapi/providers/local-destination/strategies/restore/links.d.ts +0 -4
  137. package/lib/strapi/providers/local-destination/strategies/restore/links.js +0 -32
  138. package/lib/strapi/providers/local-source/assets.d.ts +0 -5
  139. package/lib/strapi/providers/local-source/assets.js +0 -31
  140. package/lib/strapi/providers/local-source/configuration.d.ts +0 -5
  141. package/lib/strapi/providers/local-source/configuration.js +0 -36
  142. package/lib/strapi/providers/local-source/entities.d.ts +0 -10
  143. package/lib/strapi/providers/local-source/entities.js +0 -85
  144. package/lib/strapi/providers/local-source/index.d.ts +0 -27
  145. package/lib/strapi/providers/local-source/index.js +0 -98
  146. package/lib/strapi/providers/local-source/links.d.ts +0 -5
  147. package/lib/strapi/providers/local-source/links.js +0 -23
  148. package/lib/strapi/providers/remote-destination/index.d.ts +0 -37
  149. package/lib/strapi/providers/remote-destination/index.js +0 -284
  150. package/lib/strapi/providers/remote-destination/utils.d.ts +0 -31
  151. package/lib/strapi/providers/remote-destination/utils.js +0 -72
  152. package/lib/strapi/queries/entity.d.ts +0 -19
  153. package/lib/strapi/queries/entity.js +0 -130
  154. package/lib/strapi/queries/index.d.ts +0 -2
  155. package/lib/strapi/queries/index.js +0 -29
  156. package/lib/strapi/queries/link.d.ts +0 -6
  157. package/lib/strapi/queries/link.js +0 -215
  158. package/lib/strapi/remote/constants.d.ts +0 -2
  159. package/lib/strapi/remote/constants.js +0 -6
  160. package/lib/strapi/remote/controllers/index.d.ts +0 -1
  161. package/lib/strapi/remote/controllers/index.js +0 -18
  162. package/lib/strapi/remote/controllers/push.d.ts +0 -26
  163. package/lib/strapi/remote/controllers/push.js +0 -116
  164. package/lib/strapi/remote/flows/default.d.ts +0 -3
  165. package/lib/strapi/remote/flows/default.js +0 -41
  166. package/lib/strapi/remote/flows/index.d.ts +0 -18
  167. package/lib/strapi/remote/flows/index.js +0 -59
  168. package/lib/strapi/remote/handlers.d.ts +0 -10
  169. package/lib/strapi/remote/handlers.js +0 -285
  170. package/lib/strapi/remote/index.d.ts +0 -3
  171. package/lib/strapi/remote/index.js +0 -30
  172. package/lib/utils/encryption/decrypt.d.ts +0 -11
  173. package/lib/utils/encryption/decrypt.js +0 -47
  174. package/lib/utils/encryption/encrypt.d.ts +0 -11
  175. package/lib/utils/encryption/encrypt.js +0 -47
  176. package/lib/utils/encryption/index.d.ts +0 -2
  177. package/lib/utils/encryption/index.js +0 -19
  178. package/lib/utils/index.d.ts +0 -5
  179. package/lib/utils/index.js +0 -32
  180. package/lib/utils/json.d.ts +0 -30
  181. package/lib/utils/json.js +0 -68
  182. package/lib/utils/providers.d.ts +0 -2
  183. package/lib/utils/providers.js +0 -11
  184. package/lib/utils/schema.d.ts +0 -7
  185. package/lib/utils/schema.js +0 -29
  186. package/lib/utils/stream.d.ts +0 -27
  187. package/lib/utils/stream.js +0 -59
  188. package/lib/utils/transaction.d.ts +0 -3
  189. package/lib/utils/transaction.js +0 -88
@@ -1,27 +0,0 @@
1
- /// <reference types="node" />
2
- import { Transform, Readable } from 'stream';
3
- declare type TransformOptions = ConstructorParameters<typeof Transform>[0];
4
- /**
5
- * Create a filter stream that discard chunks which doesn't satisfies the given predicate
6
- *
7
- * @param predicate - A filter predicate, takes a stream data chunk as parameter and returns a boolean value
8
- * @param options - Transform stream options
9
- */
10
- export declare const filter: <T>(predicate: (value: T) => boolean | Promise<boolean>, options?: TransformOptions) => Transform;
11
- /**
12
- * Create a map stream that transform chunks using the given predicate
13
- *
14
- * @param predicate - A map predicate, takes a stream data chunk as parameter and returns a mapped value
15
- * @param options - Transform stream options
16
- */
17
- export declare const map: <T, U = T>(predicate: (value: T) => U | Promise<U>, options?: TransformOptions) => Transform;
18
- /**
19
- * Collect every chunks from a Readable stream.
20
- *
21
- * @param stream - The redable stream to collect data from
22
- * @param options.destroy - If set to true, it automatically calls `destroy()` on the given stream upon receiving the 'end' event
23
- */
24
- export declare const collect: <T = unknown>(stream: Readable, options?: {
25
- destroy: boolean;
26
- }) => Promise<T[]>;
27
- export {};
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.collect = exports.map = exports.filter = void 0;
4
- const stream_1 = require("stream");
5
- /**
6
- * Create a filter stream that discard chunks which doesn't satisfies the given predicate
7
- *
8
- * @param predicate - A filter predicate, takes a stream data chunk as parameter and returns a boolean value
9
- * @param options - Transform stream options
10
- */
11
- const filter = (predicate, options = { objectMode: true }) => {
12
- return new stream_1.Transform({
13
- ...options,
14
- async transform(chunk, _encoding, callback) {
15
- const keep = await predicate(chunk);
16
- callback(null, keep ? chunk : undefined);
17
- },
18
- });
19
- };
20
- exports.filter = filter;
21
- /**
22
- * Create a map stream that transform chunks using the given predicate
23
- *
24
- * @param predicate - A map predicate, takes a stream data chunk as parameter and returns a mapped value
25
- * @param options - Transform stream options
26
- */
27
- const map = (predicate, options = { objectMode: true }) => {
28
- return new stream_1.Transform({
29
- ...options,
30
- async transform(chunk, _encoding, callback) {
31
- const mappedValue = await predicate(chunk);
32
- callback(null, mappedValue);
33
- },
34
- });
35
- };
36
- exports.map = map;
37
- /**
38
- * Collect every chunks from a Readable stream.
39
- *
40
- * @param stream - The redable stream to collect data from
41
- * @param options.destroy - If set to true, it automatically calls `destroy()` on the given stream upon receiving the 'end' event
42
- */
43
- const collect = (stream, options = { destroy: true }) => {
44
- const chunks = [];
45
- return new Promise((resolve, reject) => {
46
- stream
47
- .on('close', () => resolve(chunks))
48
- .on('error', reject)
49
- .on('data', (chunk) => chunks.push(chunk))
50
- .on('end', () => {
51
- if (options.destroy) {
52
- stream.destroy();
53
- }
54
- resolve(chunks);
55
- });
56
- });
57
- };
58
- exports.collect = collect;
59
- //# sourceMappingURL=stream.js.map
@@ -1,3 +0,0 @@
1
- import { Strapi } from '@strapi/strapi';
2
- import { Transaction } from '../../types/utils';
3
- export declare const createTransaction: (strapi: Strapi) => Transaction;
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createTransaction = void 0;
4
- const events_1 = require("events");
5
- const crypto_1 = require("crypto");
6
- const createTransaction = (strapi) => {
7
- const fns = [];
8
- let done = false;
9
- let resume = null;
10
- const e = new events_1.EventEmitter();
11
- e.on('spawn', (uuid, cb) => {
12
- fns.push({ fn: cb, uuid });
13
- resume?.();
14
- });
15
- e.on('close', () => {
16
- e.removeAllListeners('rollback');
17
- e.removeAllListeners('spawn');
18
- done = true;
19
- resume?.();
20
- });
21
- strapi.db.transaction(async ({ trx, rollback }) => {
22
- e.once('rollback', async () => {
23
- e.removeAllListeners('close');
24
- e.removeAllListeners('spawn');
25
- try {
26
- await rollback();
27
- e.emit('rollback_completed');
28
- }
29
- catch {
30
- e.emit('rollback_failed');
31
- }
32
- finally {
33
- done = true;
34
- resume?.();
35
- }
36
- });
37
- while (!done) {
38
- while (fns.length) {
39
- const item = fns.shift();
40
- if (item) {
41
- const { fn, uuid } = item;
42
- try {
43
- const res = await fn(trx);
44
- e.emit(uuid, { data: res });
45
- }
46
- catch (error) {
47
- e.emit(uuid, { error });
48
- }
49
- }
50
- }
51
- if (!done && !fns.length) {
52
- // eslint-disable-next-line @typescript-eslint/no-loop-func
53
- await new Promise((resolve) => {
54
- resume = resolve;
55
- });
56
- }
57
- }
58
- });
59
- return {
60
- async attach(callback) {
61
- const uuid = (0, crypto_1.randomUUID)();
62
- e.emit('spawn', uuid, callback);
63
- return new Promise((resolve, reject) => {
64
- e.on(uuid, ({ data, error }) => {
65
- if (data) {
66
- resolve(data);
67
- }
68
- if (error) {
69
- reject(error);
70
- }
71
- resolve(undefined);
72
- });
73
- });
74
- },
75
- end() {
76
- return e.emit('close');
77
- },
78
- rollback() {
79
- return new Promise((resolve) => {
80
- e.emit('rollback');
81
- e.once('rollback_failed', () => resolve(false));
82
- e.once('rollback_completed', () => resolve(true));
83
- });
84
- },
85
- };
86
- };
87
- exports.createTransaction = createTransaction;
88
- //# sourceMappingURL=transaction.js.map