@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.
- package/dist/engine/diagnostic.d.ts +10 -10
- package/dist/engine/diagnostic.js.map +1 -0
- package/dist/engine/errors.d.ts +2 -2
- package/dist/engine/errors.js.map +1 -0
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/validation/index.js.map +1 -0
- package/dist/engine/validation/provider.js.map +1 -0
- package/dist/engine/validation/schemas/index.js +29 -12
- package/dist/engine/validation/schemas/index.js.map +1 -0
- package/dist/errors/base.js.map +1 -0
- package/dist/errors/constants.d.ts +1 -1
- package/dist/errors/constants.js.map +1 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/providers.d.ts +2 -2
- package/dist/errors/providers.js.map +1 -0
- package/dist/file/index.js.map +1 -0
- package/dist/file/providers/destination/index.d.ts +1 -0
- package/dist/file/providers/destination/index.js +2 -1
- package/dist/file/providers/destination/index.js.map +1 -0
- package/dist/file/providers/destination/utils.d.ts +1 -1
- package/dist/file/providers/destination/utils.js +2 -1
- package/dist/file/providers/destination/utils.js.map +1 -0
- package/dist/file/providers/index.js.map +1 -0
- package/dist/file/providers/source/index.d.ts +1 -1
- package/dist/file/providers/source/index.js +34 -24
- package/dist/file/providers/source/index.js.map +1 -0
- package/dist/file/providers/source/utils.d.ts +37 -0
- package/dist/file/providers/source/utils.js +62 -0
- package/dist/file/providers/source/utils.js.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/strapi/index.js.map +1 -0
- package/dist/strapi/providers/index.js.map +1 -0
- package/dist/strapi/providers/local-destination/index.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/index.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/entities.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/index.d.ts +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/index.js.map +1 -0
- package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/links.js.map +1 -0
- package/dist/strapi/providers/local-source/assets.js.map +1 -0
- package/dist/strapi/providers/local-source/configuration.js.map +1 -0
- package/dist/strapi/providers/local-source/entities.js.map +1 -0
- package/dist/strapi/providers/local-source/index.d.ts +1 -1
- package/dist/strapi/providers/local-source/index.js.map +1 -0
- package/dist/strapi/providers/local-source/links.js.map +1 -0
- package/dist/strapi/providers/remote-destination/index.js +4 -19
- package/dist/strapi/providers/remote-destination/index.js.map +1 -0
- package/dist/strapi/providers/remote-source/index.js +3 -4
- package/dist/strapi/providers/remote-source/index.js.map +1 -0
- package/dist/strapi/providers/utils.d.ts +8 -3
- package/dist/strapi/providers/utils.js +22 -1
- package/dist/strapi/providers/utils.js.map +1 -0
- package/dist/strapi/queries/entity.js.map +1 -0
- package/dist/strapi/queries/index.js.map +1 -0
- package/dist/strapi/queries/link.js.map +1 -0
- package/dist/strapi/remote/constants.d.ts +2 -2
- package/dist/strapi/remote/constants.js.map +1 -0
- package/dist/strapi/remote/flows/default.js.map +1 -0
- package/dist/strapi/remote/flows/index.d.ts +1 -1
- package/dist/strapi/remote/flows/index.js.map +1 -0
- package/dist/strapi/remote/handlers/abstract.d.ts +1 -1
- package/dist/strapi/remote/handlers/abstract.js.map +1 -0
- package/dist/strapi/remote/handlers/constants.d.ts +1 -1
- package/dist/strapi/remote/handlers/constants.js.map +1 -0
- package/dist/strapi/remote/handlers/index.js.map +1 -0
- package/dist/strapi/remote/handlers/pull.d.ts +1 -1
- package/dist/strapi/remote/handlers/pull.js.map +1 -0
- package/dist/strapi/remote/handlers/push.d.ts +1 -1
- package/dist/strapi/remote/handlers/push.js.map +1 -0
- package/dist/strapi/remote/handlers/utils.d.ts +1 -1
- package/dist/strapi/remote/handlers/utils.js.map +1 -0
- package/dist/strapi/remote/index.js.map +1 -0
- package/dist/utils/encryption/decrypt.js.map +1 -0
- package/dist/utils/encryption/encrypt.js.map +1 -0
- package/dist/utils/encryption/index.js.map +1 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/json.d.ts +1 -1
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/providers.d.ts +1 -1
- package/dist/utils/providers.js.map +1 -0
- package/dist/utils/schema.js.map +1 -0
- package/dist/utils/stream.d.ts +1 -1
- package/dist/utils/stream.js.map +1 -0
- package/dist/utils/transaction.js.map +1 -0
- package/package.json +18 -17
- package/jest.config.js +0 -14
- package/lib/engine/diagnostic.d.ts +0 -40
- package/lib/engine/diagnostic.js +0 -50
- package/lib/engine/errors.d.ts +0 -28
- package/lib/engine/errors.js +0 -29
- package/lib/engine/index.d.ts +0 -44
- package/lib/engine/index.js +0 -506
- package/lib/engine/validation/index.d.ts +0 -2
- package/lib/engine/validation/index.js +0 -19
- package/lib/engine/validation/provider.d.ts +0 -3
- package/lib/engine/validation/provider.js +0 -18
- package/lib/engine/validation/schemas/index.d.ts +0 -7
- package/lib/engine/validation/schemas/index.js +0 -53
- package/lib/errors/base.d.ts +0 -8
- package/lib/errors/base.js +0 -13
- package/lib/errors/constants.d.ts +0 -3
- package/lib/errors/constants.js +0 -9
- package/lib/errors/index.d.ts +0 -2
- package/lib/errors/index.js +0 -19
- package/lib/errors/providers.d.ts +0 -21
- package/lib/errors/providers.js +0 -32
- package/lib/file/index.d.ts +0 -1
- package/lib/file/index.js +0 -28
- package/lib/file/providers/destination/index.d.ts +0 -45
- package/lib/file/providers/destination/index.js +0 -174
- package/lib/file/providers/destination/utils.d.ts +0 -9
- package/lib/file/providers/destination/utils.js +0 -61
- package/lib/file/providers/index.d.ts +0 -2
- package/lib/file/providers/index.js +0 -19
- package/lib/file/providers/source/index.d.ts +0 -40
- package/lib/file/providers/source/index.js +0 -220
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -31
- package/lib/strapi/index.d.ts +0 -3
- package/lib/strapi/index.js +0 -30
- package/lib/strapi/providers/index.d.ts +0 -3
- package/lib/strapi/providers/index.js +0 -22
- package/lib/strapi/providers/local-destination/index.d.ts +0 -34
- package/lib/strapi/providers/local-destination/index.js +0 -220
- package/lib/strapi/providers/local-destination/strategies/index.d.ts +0 -1
- package/lib/strapi/providers/local-destination/strategies/index.js +0 -28
- package/lib/strapi/providers/local-destination/strategies/restore/configuration.d.ts +0 -5
- package/lib/strapi/providers/local-destination/strategies/restore/configuration.js +0 -51
- package/lib/strapi/providers/local-destination/strategies/restore/entities.d.ts +0 -11
- package/lib/strapi/providers/local-destination/strategies/restore/entities.js +0 -103
- package/lib/strapi/providers/local-destination/strategies/restore/index.d.ts +0 -32
- package/lib/strapi/providers/local-destination/strategies/restore/index.js +0 -107
- package/lib/strapi/providers/local-destination/strategies/restore/links.d.ts +0 -4
- package/lib/strapi/providers/local-destination/strategies/restore/links.js +0 -32
- package/lib/strapi/providers/local-source/assets.d.ts +0 -5
- package/lib/strapi/providers/local-source/assets.js +0 -31
- package/lib/strapi/providers/local-source/configuration.d.ts +0 -5
- package/lib/strapi/providers/local-source/configuration.js +0 -36
- package/lib/strapi/providers/local-source/entities.d.ts +0 -10
- package/lib/strapi/providers/local-source/entities.js +0 -85
- package/lib/strapi/providers/local-source/index.d.ts +0 -27
- package/lib/strapi/providers/local-source/index.js +0 -98
- package/lib/strapi/providers/local-source/links.d.ts +0 -5
- package/lib/strapi/providers/local-source/links.js +0 -23
- package/lib/strapi/providers/remote-destination/index.d.ts +0 -37
- package/lib/strapi/providers/remote-destination/index.js +0 -284
- package/lib/strapi/providers/remote-destination/utils.d.ts +0 -31
- package/lib/strapi/providers/remote-destination/utils.js +0 -72
- package/lib/strapi/queries/entity.d.ts +0 -19
- package/lib/strapi/queries/entity.js +0 -130
- package/lib/strapi/queries/index.d.ts +0 -2
- package/lib/strapi/queries/index.js +0 -29
- package/lib/strapi/queries/link.d.ts +0 -6
- package/lib/strapi/queries/link.js +0 -215
- package/lib/strapi/remote/constants.d.ts +0 -2
- package/lib/strapi/remote/constants.js +0 -6
- package/lib/strapi/remote/controllers/index.d.ts +0 -1
- package/lib/strapi/remote/controllers/index.js +0 -18
- package/lib/strapi/remote/controllers/push.d.ts +0 -26
- package/lib/strapi/remote/controllers/push.js +0 -116
- package/lib/strapi/remote/flows/default.d.ts +0 -3
- package/lib/strapi/remote/flows/default.js +0 -41
- package/lib/strapi/remote/flows/index.d.ts +0 -18
- package/lib/strapi/remote/flows/index.js +0 -59
- package/lib/strapi/remote/handlers.d.ts +0 -10
- package/lib/strapi/remote/handlers.js +0 -285
- package/lib/strapi/remote/index.d.ts +0 -3
- package/lib/strapi/remote/index.js +0 -30
- package/lib/utils/encryption/decrypt.d.ts +0 -11
- package/lib/utils/encryption/decrypt.js +0 -47
- package/lib/utils/encryption/encrypt.d.ts +0 -11
- package/lib/utils/encryption/encrypt.js +0 -47
- package/lib/utils/encryption/index.d.ts +0 -2
- package/lib/utils/encryption/index.js +0 -19
- package/lib/utils/index.d.ts +0 -5
- package/lib/utils/index.js +0 -32
- package/lib/utils/json.d.ts +0 -30
- package/lib/utils/json.js +0 -68
- package/lib/utils/providers.d.ts +0 -2
- package/lib/utils/providers.js +0 -11
- package/lib/utils/schema.d.ts +0 -7
- package/lib/utils/schema.js +0 -29
- package/lib/utils/stream.d.ts +0 -27
- package/lib/utils/stream.js +0 -59
- package/lib/utils/transaction.d.ts +0 -3
- package/lib/utils/transaction.js +0 -88
package/lib/utils/stream.d.ts
DELETED
|
@@ -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 {};
|
package/lib/utils/stream.js
DELETED
|
@@ -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
|
package/lib/utils/transaction.js
DELETED
|
@@ -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
|