@strapi/data-transfer 4.14.0-alpha.0 → 4.14.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/commands/commander.d.ts +35 -0
- package/dist/commands/commander.js +138 -0
- package/dist/commands/commander.js.map +1 -0
- package/dist/commands/data-transfer.d.ts +135 -0
- package/dist/commands/data-transfer.js +359 -0
- package/dist/commands/data-transfer.js.map +1 -0
- package/dist/commands/export/action.d.ts +20 -0
- package/dist/commands/export/action.js +156 -0
- package/dist/commands/export/action.js.map +1 -0
- package/dist/commands/export/command.d.ts +8 -0
- package/dist/commands/export/command.js +30 -0
- package/dist/commands/export/command.js.map +1 -0
- package/dist/commands/helpers.d.ts +30 -0
- package/dist/commands/helpers.js +87 -0
- package/dist/commands/helpers.js.map +1 -0
- package/dist/commands/import/action.d.ts +19 -0
- package/dist/commands/import/action.js +139 -0
- package/dist/commands/import/action.js.map +1 -0
- package/dist/commands/import/command.d.ts +8 -0
- package/dist/commands/import/command.js +75 -0
- package/dist/commands/import/command.js.map +1 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.js +13 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/transfer/action.d.ts +18 -0
- package/dist/commands/transfer/action.js +161 -0
- package/dist/commands/transfer/action.js.map +1 -0
- package/dist/commands/transfer/command.d.ts +8 -0
- package/dist/commands/transfer/command.js +69 -0
- package/dist/commands/transfer/command.js.map +1 -0
- package/dist/engine/index.d.ts +2 -1
- package/dist/engine/index.js +330 -297
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/validation/schemas/index.js.map +1 -1
- package/dist/errors/base.js +3 -0
- package/dist/errors/base.js.map +1 -1
- package/dist/file/providers/destination/index.js +51 -55
- package/dist/file/providers/destination/index.js.map +1 -1
- package/dist/file/providers/source/index.d.ts +1 -1
- package/dist/file/providers/source/index.js +111 -119
- package/dist/file/providers/source/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/strapi/providers/local-destination/index.d.ts +4 -3
- package/dist/strapi/providers/local-destination/index.js +120 -125
- package/dist/strapi/providers/local-destination/index.js.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts +3 -2
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.js.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts +2 -2
- package/dist/strapi/providers/local-destination/strategies/restore/entities.js +5 -2
- package/dist/strapi/providers/local-destination/strategies/restore/entities.js.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/index.d.ts +2 -2
- package/dist/strapi/providers/local-destination/strategies/restore/index.js.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts +2 -1
- package/dist/strapi/providers/local-destination/strategies/restore/links.js.map +1 -1
- package/dist/strapi/providers/local-source/assets.d.ts +2 -1
- package/dist/strapi/providers/local-source/assets.js +1 -1
- package/dist/strapi/providers/local-source/assets.js.map +1 -1
- package/dist/strapi/providers/local-source/configuration.d.ts +2 -1
- package/dist/strapi/providers/local-source/configuration.js.map +1 -1
- package/dist/strapi/providers/local-source/entities.d.ts +2 -1
- package/dist/strapi/providers/local-source/entities.js.map +1 -1
- package/dist/strapi/providers/local-source/index.d.ts +4 -3
- package/dist/strapi/providers/local-source/index.js +5 -3
- package/dist/strapi/providers/local-source/index.js.map +1 -1
- package/dist/strapi/providers/local-source/links.d.ts +2 -1
- package/dist/strapi/providers/local-source/links.js.map +1 -1
- package/dist/strapi/providers/remote-destination/index.d.ts +1 -1
- package/dist/strapi/providers/remote-destination/index.js +95 -94
- package/dist/strapi/providers/remote-destination/index.js.map +1 -1
- package/dist/strapi/providers/remote-source/index.d.ts +1 -1
- package/dist/strapi/providers/remote-source/index.js +93 -93
- package/dist/strapi/providers/remote-source/index.js.map +1 -1
- package/dist/strapi/providers/utils.d.ts +2 -2
- package/dist/strapi/queries/entity.d.ts +2 -1
- package/dist/strapi/queries/entity.js +4 -4
- package/dist/strapi/queries/entity.js.map +1 -1
- package/dist/strapi/queries/link.d.ts +2 -1
- package/dist/strapi/queries/link.js +13 -4
- package/dist/strapi/queries/link.js.map +1 -1
- package/dist/strapi/remote/handlers/pull.js.map +1 -1
- package/dist/strapi/remote/handlers/push.js.map +1 -1
- package/dist/utils/components.d.ts +22 -0
- package/dist/utils/components.js +381 -0
- package/dist/utils/components.js.map +1 -0
- package/dist/utils/providers.d.ts +2 -1
- package/dist/utils/providers.js.map +1 -1
- package/dist/utils/schema.d.ts +1 -1
- package/dist/utils/transaction.d.ts +2 -2
- package/dist/utils/transaction.js.map +1 -1
- package/package.json +17 -10
|
@@ -37,9 +37,11 @@ const createLocalStrapiSourceProvider = (options) => {
|
|
|
37
37
|
};
|
|
38
38
|
exports.createLocalStrapiSourceProvider = createLocalStrapiSourceProvider;
|
|
39
39
|
class LocalStrapiSourceProvider {
|
|
40
|
+
name = 'source::local-strapi';
|
|
41
|
+
type = 'source';
|
|
42
|
+
options;
|
|
43
|
+
strapi;
|
|
40
44
|
constructor(options) {
|
|
41
|
-
this.name = 'source::local-strapi';
|
|
42
|
-
this.type = 'source';
|
|
43
45
|
this.options = options;
|
|
44
46
|
}
|
|
45
47
|
async bootstrap() {
|
|
@@ -77,7 +79,7 @@ class LocalStrapiSourceProvider {
|
|
|
77
79
|
}
|
|
78
80
|
createConfigurationReadStream() {
|
|
79
81
|
(0, providers_1.assertValidStrapi)(this.strapi, 'Not able to stream configuration');
|
|
80
|
-
return (0, configuration_1.createConfigurationStream)(strapi);
|
|
82
|
+
return (0, configuration_1.createConfigurationStream)(this.strapi);
|
|
81
83
|
}
|
|
82
84
|
getSchemas() {
|
|
83
85
|
(0, providers_1.assertValidStrapi)(this.strapi, 'Not able to get Schemas');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;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type { LoadedStrapi } from '@strapi/types';
|
|
2
3
|
/**
|
|
3
4
|
* Create a Readable which will stream all the links from a Strapi instance
|
|
4
5
|
*/
|
|
5
|
-
export declare const createLinksStream: (strapi:
|
|
6
|
+
export declare const createLinksStream: (strapi: LoadedStrapi) => Readable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.js","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/links.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;
|
|
1
|
+
{"version":3,"file":"links.js","sourceRoot":"","sources":["../../../../src/strapi/providers/local-source/links.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAIlC,6CAAqD;AAErD;;GAEG;AACI,MAAM,iBAAiB,GAAG,CAAC,MAAoB,EAAY,EAAE;IAClE,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,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Writable } from 'stream';
|
|
3
3
|
import { WebSocket } from 'ws';
|
|
4
|
-
import type { Schema, Utils } from '@strapi/
|
|
4
|
+
import type { Schema, Utils } from '@strapi/types';
|
|
5
5
|
import { createDispatcher } from '../utils';
|
|
6
6
|
import type { IDestinationProvider, IMetadata, ProviderType } from '../../../../types';
|
|
7
7
|
import type { Auth } from '../../../../types/remote/protocol';
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var _RemoteStrapiDestinationProvider_instances, _RemoteStrapiDestinationProvider_startStepOnce, _RemoteStrapiDestinationProvider_startStep, _RemoteStrapiDestinationProvider_endStep, _RemoteStrapiDestinationProvider_streamStep, _RemoteStrapiDestinationProvider_writeStream;
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.createRemoteStrapiDestinationProvider = void 0;
|
|
10
4
|
const crypto_1 = require("crypto");
|
|
@@ -15,10 +9,13 @@ const constants_1 = require("../../remote/constants");
|
|
|
15
9
|
const providers_1 = require("../../../errors/providers");
|
|
16
10
|
const jsonLength = (obj) => Buffer.byteLength(JSON.stringify(obj));
|
|
17
11
|
class RemoteStrapiDestinationProvider {
|
|
12
|
+
name = 'destination::remote-strapi';
|
|
13
|
+
type = 'destination';
|
|
14
|
+
options;
|
|
15
|
+
ws;
|
|
16
|
+
dispatcher;
|
|
17
|
+
transferID;
|
|
18
18
|
constructor(options) {
|
|
19
|
-
_RemoteStrapiDestinationProvider_instances.add(this);
|
|
20
|
-
this.name = 'destination::remote-strapi';
|
|
21
|
-
this.type = 'destination';
|
|
22
19
|
this.options = options;
|
|
23
20
|
this.ws = null;
|
|
24
21
|
this.dispatcher = null;
|
|
@@ -36,6 +33,89 @@ class RemoteStrapiDestinationProvider {
|
|
|
36
33
|
}
|
|
37
34
|
return res.transferID;
|
|
38
35
|
}
|
|
36
|
+
#startStepOnce(stage) {
|
|
37
|
+
return (0, fp_1.once)(() => this.#startStep(stage));
|
|
38
|
+
}
|
|
39
|
+
async #startStep(step) {
|
|
40
|
+
try {
|
|
41
|
+
await this.dispatcher?.dispatchTransferStep({ action: 'start', step });
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
if (e instanceof Error) {
|
|
45
|
+
return e;
|
|
46
|
+
}
|
|
47
|
+
if (typeof e === 'string') {
|
|
48
|
+
return new providers_1.ProviderTransferError(e);
|
|
49
|
+
}
|
|
50
|
+
return new providers_1.ProviderTransferError('Unexpected error');
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
async #endStep(step) {
|
|
55
|
+
try {
|
|
56
|
+
await this.dispatcher?.dispatchTransferStep({ action: 'end', step });
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
if (e instanceof Error) {
|
|
60
|
+
return e;
|
|
61
|
+
}
|
|
62
|
+
if (typeof e === 'string') {
|
|
63
|
+
return new providers_1.ProviderTransferError(e);
|
|
64
|
+
}
|
|
65
|
+
return new providers_1.ProviderTransferError('Unexpected error');
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
async #streamStep(step, data) {
|
|
70
|
+
try {
|
|
71
|
+
await this.dispatcher?.dispatchTransferStep({ action: 'stream', step, data });
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
if (e instanceof Error) {
|
|
75
|
+
return e;
|
|
76
|
+
}
|
|
77
|
+
if (typeof e === 'string') {
|
|
78
|
+
return new providers_1.ProviderTransferError(e);
|
|
79
|
+
}
|
|
80
|
+
return new providers_1.ProviderTransferError('Unexpected error');
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
#writeStream(step) {
|
|
85
|
+
const batchSize = 1024 * 1024; // 1MB;
|
|
86
|
+
const startTransferOnce = this.#startStepOnce(step);
|
|
87
|
+
let batch = [];
|
|
88
|
+
const batchLength = () => jsonLength(batch);
|
|
89
|
+
return new stream_1.Writable({
|
|
90
|
+
objectMode: true,
|
|
91
|
+
final: async (callback) => {
|
|
92
|
+
if (batch.length > 0) {
|
|
93
|
+
const streamError = await this.#streamStep(step, batch);
|
|
94
|
+
batch = [];
|
|
95
|
+
if (streamError) {
|
|
96
|
+
return callback(streamError);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const e = await this.#endStep(step);
|
|
100
|
+
callback(e);
|
|
101
|
+
},
|
|
102
|
+
write: async (chunk, _encoding, callback) => {
|
|
103
|
+
const startError = await startTransferOnce();
|
|
104
|
+
if (startError) {
|
|
105
|
+
return callback(startError);
|
|
106
|
+
}
|
|
107
|
+
batch.push(chunk);
|
|
108
|
+
if (batchLength() >= batchSize) {
|
|
109
|
+
const streamError = await this.#streamStep(step, batch);
|
|
110
|
+
batch = [];
|
|
111
|
+
if (streamError) {
|
|
112
|
+
return callback(streamError);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
callback();
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
}
|
|
39
119
|
async bootstrap() {
|
|
40
120
|
const { url, auth } = this.options;
|
|
41
121
|
const validProtocols = ['https:', 'http:'];
|
|
@@ -110,13 +190,13 @@ class RemoteStrapiDestinationProvider {
|
|
|
110
190
|
return this.dispatcher.dispatchTransferAction('getSchemas');
|
|
111
191
|
}
|
|
112
192
|
createEntitiesWriteStream() {
|
|
113
|
-
return
|
|
193
|
+
return this.#writeStream('entities');
|
|
114
194
|
}
|
|
115
195
|
createLinksWriteStream() {
|
|
116
|
-
return
|
|
196
|
+
return this.#writeStream('links');
|
|
117
197
|
}
|
|
118
198
|
createConfigurationWriteStream() {
|
|
119
|
-
return
|
|
199
|
+
return this.#writeStream('configuration');
|
|
120
200
|
}
|
|
121
201
|
createAssetsWriteStream() {
|
|
122
202
|
let batch = [];
|
|
@@ -125,9 +205,9 @@ class RemoteStrapiDestinationProvider {
|
|
|
125
205
|
const batchLength = () => {
|
|
126
206
|
return batch.reduce((acc, chunk) => (chunk.action === 'stream' ? acc + chunk.data.byteLength : acc), 0);
|
|
127
207
|
};
|
|
128
|
-
const startAssetsTransferOnce =
|
|
208
|
+
const startAssetsTransferOnce = this.#startStepOnce('assets');
|
|
129
209
|
const flush = async () => {
|
|
130
|
-
const streamError = await
|
|
210
|
+
const streamError = await this.#streamStep('assets', batch);
|
|
131
211
|
batch = [];
|
|
132
212
|
return streamError;
|
|
133
213
|
};
|
|
@@ -147,7 +227,7 @@ class RemoteStrapiDestinationProvider {
|
|
|
147
227
|
await flush();
|
|
148
228
|
}
|
|
149
229
|
if (hasStarted) {
|
|
150
|
-
const endStepError = await
|
|
230
|
+
const endStepError = await this.#endStep('assets');
|
|
151
231
|
if (endStepError) {
|
|
152
232
|
return callback(endStepError);
|
|
153
233
|
}
|
|
@@ -183,85 +263,6 @@ class RemoteStrapiDestinationProvider {
|
|
|
183
263
|
});
|
|
184
264
|
}
|
|
185
265
|
}
|
|
186
|
-
_RemoteStrapiDestinationProvider_instances = new WeakSet(), _RemoteStrapiDestinationProvider_startStepOnce = function _RemoteStrapiDestinationProvider_startStepOnce(stage) {
|
|
187
|
-
return (0, fp_1.once)(() => __classPrivateFieldGet(this, _RemoteStrapiDestinationProvider_instances, "m", _RemoteStrapiDestinationProvider_startStep).call(this, stage));
|
|
188
|
-
}, _RemoteStrapiDestinationProvider_startStep = async function _RemoteStrapiDestinationProvider_startStep(step) {
|
|
189
|
-
try {
|
|
190
|
-
await this.dispatcher?.dispatchTransferStep({ action: 'start', step });
|
|
191
|
-
}
|
|
192
|
-
catch (e) {
|
|
193
|
-
if (e instanceof Error) {
|
|
194
|
-
return e;
|
|
195
|
-
}
|
|
196
|
-
if (typeof e === 'string') {
|
|
197
|
-
return new providers_1.ProviderTransferError(e);
|
|
198
|
-
}
|
|
199
|
-
return new providers_1.ProviderTransferError('Unexpected error');
|
|
200
|
-
}
|
|
201
|
-
return null;
|
|
202
|
-
}, _RemoteStrapiDestinationProvider_endStep = async function _RemoteStrapiDestinationProvider_endStep(step) {
|
|
203
|
-
try {
|
|
204
|
-
await this.dispatcher?.dispatchTransferStep({ action: 'end', step });
|
|
205
|
-
}
|
|
206
|
-
catch (e) {
|
|
207
|
-
if (e instanceof Error) {
|
|
208
|
-
return e;
|
|
209
|
-
}
|
|
210
|
-
if (typeof e === 'string') {
|
|
211
|
-
return new providers_1.ProviderTransferError(e);
|
|
212
|
-
}
|
|
213
|
-
return new providers_1.ProviderTransferError('Unexpected error');
|
|
214
|
-
}
|
|
215
|
-
return null;
|
|
216
|
-
}, _RemoteStrapiDestinationProvider_streamStep = async function _RemoteStrapiDestinationProvider_streamStep(step, data) {
|
|
217
|
-
try {
|
|
218
|
-
await this.dispatcher?.dispatchTransferStep({ action: 'stream', step, data });
|
|
219
|
-
}
|
|
220
|
-
catch (e) {
|
|
221
|
-
if (e instanceof Error) {
|
|
222
|
-
return e;
|
|
223
|
-
}
|
|
224
|
-
if (typeof e === 'string') {
|
|
225
|
-
return new providers_1.ProviderTransferError(e);
|
|
226
|
-
}
|
|
227
|
-
return new providers_1.ProviderTransferError('Unexpected error');
|
|
228
|
-
}
|
|
229
|
-
return null;
|
|
230
|
-
}, _RemoteStrapiDestinationProvider_writeStream = function _RemoteStrapiDestinationProvider_writeStream(step) {
|
|
231
|
-
const batchSize = 1024 * 1024; // 1MB;
|
|
232
|
-
const startTransferOnce = __classPrivateFieldGet(this, _RemoteStrapiDestinationProvider_instances, "m", _RemoteStrapiDestinationProvider_startStepOnce).call(this, step);
|
|
233
|
-
let batch = [];
|
|
234
|
-
const batchLength = () => jsonLength(batch);
|
|
235
|
-
return new stream_1.Writable({
|
|
236
|
-
objectMode: true,
|
|
237
|
-
final: async (callback) => {
|
|
238
|
-
if (batch.length > 0) {
|
|
239
|
-
const streamError = await __classPrivateFieldGet(this, _RemoteStrapiDestinationProvider_instances, "m", _RemoteStrapiDestinationProvider_streamStep).call(this, step, batch);
|
|
240
|
-
batch = [];
|
|
241
|
-
if (streamError) {
|
|
242
|
-
return callback(streamError);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
const e = await __classPrivateFieldGet(this, _RemoteStrapiDestinationProvider_instances, "m", _RemoteStrapiDestinationProvider_endStep).call(this, step);
|
|
246
|
-
callback(e);
|
|
247
|
-
},
|
|
248
|
-
write: async (chunk, _encoding, callback) => {
|
|
249
|
-
const startError = await startTransferOnce();
|
|
250
|
-
if (startError) {
|
|
251
|
-
return callback(startError);
|
|
252
|
-
}
|
|
253
|
-
batch.push(chunk);
|
|
254
|
-
if (batchLength() >= batchSize) {
|
|
255
|
-
const streamError = await __classPrivateFieldGet(this, _RemoteStrapiDestinationProvider_instances, "m", _RemoteStrapiDestinationProvider_streamStep).call(this, step, batch);
|
|
256
|
-
batch = [];
|
|
257
|
-
if (streamError) {
|
|
258
|
-
return callback(streamError);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
callback();
|
|
262
|
-
},
|
|
263
|
-
});
|
|
264
|
-
};
|
|
265
266
|
const createRemoteStrapiDestinationProvider = (options) => {
|
|
266
267
|
return new RemoteStrapiDestinationProvider(options);
|
|
267
268
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strapi/providers/remote-destination/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strapi/providers/remote-destination/index.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AACpC,mCAAkC;AAElC,kCAAiC;AAGjC,oCAAmF;AAKnF,sDAAuD;AACvD,yDAA2F;AAY3F,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,MAAM,CAAC,U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oBACF,MAAM,QAAQ,CAAC;wBACb,MAAM,EAAE,OAAO;wBACf,OAAO;wBACP,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;qBAC9C,CAAC,CAAC;oBAEH,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE;wBAChC,MAAM,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;qBAC5D;oBAED,MAAM,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;oBAE3C,QAAQ,EAAE,CAAC;iBACZ;gBAAC,OAAO,KAAK,EAAE;oBACd,IAAI,KAAK,YAAY,KAAK,EAAE;wBAC1B,QAAQ,CAAC,KAAK,CAAC,CAAC;qBACjB;iBACF;YACH,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAEM,MAAM,qCAAqC,GAAG,CACnD,OAAgD,EAChD,EAAE;IACF,OAAO,IAAI,+BAA+B,CAAC,OAAO,CAAC,CAAC;AACtD,CAAC,CAAC;AAJW,QAAA,qCAAqC,yCAIhD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Readable, Writable } from 'stream';
|
|
3
|
-
import type { Schema, Utils } from '@strapi/
|
|
3
|
+
import type { Schema, Utils } from '@strapi/types';
|
|
4
4
|
import { WebSocket } from 'ws';
|
|
5
5
|
import type { IMetadata, ISourceProvider, ISourceProviderTransferResults, MaybePromise, ProviderType } from '../../../../types';
|
|
6
6
|
import { Auth } from '../../../../types/remote/protocol';
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var _RemoteStrapiSourceProvider_instances, _RemoteStrapiSourceProvider_createStageReadStream, _RemoteStrapiSourceProvider_startStep, _RemoteStrapiSourceProvider_respond, _RemoteStrapiSourceProvider_endStep;
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.createRemoteStrapiSourceProvider = void 0;
|
|
10
4
|
const stream_1 = require("stream");
|
|
@@ -13,33 +7,75 @@ const providers_1 = require("../../../errors/providers");
|
|
|
13
7
|
const constants_1 = require("../../remote/constants");
|
|
14
8
|
const utils_1 = require("../utils");
|
|
15
9
|
class RemoteStrapiSourceProvider {
|
|
10
|
+
name = 'source::remote-strapi';
|
|
11
|
+
type = 'source';
|
|
12
|
+
options;
|
|
13
|
+
ws;
|
|
14
|
+
dispatcher;
|
|
16
15
|
constructor(options) {
|
|
17
|
-
_RemoteStrapiSourceProvider_instances.add(this);
|
|
18
|
-
this.name = 'source::remote-strapi';
|
|
19
|
-
this.type = 'source';
|
|
20
|
-
this.writeAsync = (stream, data) => {
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
stream.write(data, (error) => {
|
|
23
|
-
if (error) {
|
|
24
|
-
reject(error);
|
|
25
|
-
}
|
|
26
|
-
resolve();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
16
|
this.options = options;
|
|
31
17
|
this.ws = null;
|
|
32
18
|
this.dispatcher = null;
|
|
33
19
|
}
|
|
20
|
+
results;
|
|
21
|
+
async #createStageReadStream(stage) {
|
|
22
|
+
const startResult = await this.#startStep(stage);
|
|
23
|
+
if (startResult instanceof Error) {
|
|
24
|
+
throw startResult;
|
|
25
|
+
}
|
|
26
|
+
const { id: processID } = startResult;
|
|
27
|
+
const stream = new stream_1.PassThrough({ objectMode: true });
|
|
28
|
+
const listener = async (raw) => {
|
|
29
|
+
const parsed = JSON.parse(raw.toString());
|
|
30
|
+
// If not a message related to our transfer process, ignore it
|
|
31
|
+
if (!parsed.uuid || parsed?.data?.type !== 'transfer' || parsed?.data?.id !== processID) {
|
|
32
|
+
this.ws?.once('message', listener);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const { uuid, data: message } = parsed;
|
|
36
|
+
const { ended, error, data } = message;
|
|
37
|
+
if (ended) {
|
|
38
|
+
await this.#respond(uuid);
|
|
39
|
+
await this.#endStep(stage);
|
|
40
|
+
stream.end();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (error) {
|
|
44
|
+
await this.#respond(uuid);
|
|
45
|
+
await this.#endStep(stage);
|
|
46
|
+
stream.destroy(error);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// if we get a single items instead of a batch
|
|
50
|
+
// TODO V5: in v5 only allow array
|
|
51
|
+
for (const item of (0, fp_1.castArray)(data)) {
|
|
52
|
+
stream.push(item);
|
|
53
|
+
}
|
|
54
|
+
this.ws?.once('message', listener);
|
|
55
|
+
await this.#respond(uuid);
|
|
56
|
+
};
|
|
57
|
+
this.ws?.once('message', listener);
|
|
58
|
+
return stream;
|
|
59
|
+
}
|
|
34
60
|
createEntitiesReadStream() {
|
|
35
|
-
return
|
|
61
|
+
return this.#createStageReadStream('entities');
|
|
36
62
|
}
|
|
37
63
|
createLinksReadStream() {
|
|
38
|
-
return
|
|
64
|
+
return this.#createStageReadStream('links');
|
|
39
65
|
}
|
|
66
|
+
writeAsync = (stream, data) => {
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
stream.write(data, (error) => {
|
|
69
|
+
if (error) {
|
|
70
|
+
reject(error);
|
|
71
|
+
}
|
|
72
|
+
resolve();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
40
76
|
async createAssetsReadStream() {
|
|
41
77
|
const assets = {};
|
|
42
|
-
const stream = await
|
|
78
|
+
const stream = await this.#createStageReadStream('assets');
|
|
43
79
|
const pass = new stream_1.PassThrough({ objectMode: true });
|
|
44
80
|
stream
|
|
45
81
|
.on('data', async (payload) => {
|
|
@@ -80,7 +116,7 @@ class RemoteStrapiSourceProvider {
|
|
|
80
116
|
return pass;
|
|
81
117
|
}
|
|
82
118
|
createConfigurationReadStream() {
|
|
83
|
-
return
|
|
119
|
+
return this.#createStageReadStream('configuration');
|
|
84
120
|
}
|
|
85
121
|
async getMetadata() {
|
|
86
122
|
const metadata = await this.dispatcher?.dispatchTransferAction('getMetadata');
|
|
@@ -154,84 +190,48 @@ class RemoteStrapiSourceProvider {
|
|
|
154
190
|
const schemas = (await this.dispatcher?.dispatchTransferAction('getSchemas')) ?? null;
|
|
155
191
|
return schemas;
|
|
156
192
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (startResult instanceof Error) {
|
|
161
|
-
throw startResult;
|
|
162
|
-
}
|
|
163
|
-
const { id: processID } = startResult;
|
|
164
|
-
const stream = new stream_1.PassThrough({ objectMode: true });
|
|
165
|
-
const listener = async (raw) => {
|
|
166
|
-
const parsed = JSON.parse(raw.toString());
|
|
167
|
-
// If not a message related to our transfer process, ignore it
|
|
168
|
-
if (!parsed.uuid || parsed?.data?.type !== 'transfer' || parsed?.data?.id !== processID) {
|
|
169
|
-
this.ws?.once('message', listener);
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
const { uuid, data: message } = parsed;
|
|
173
|
-
const { ended, error, data } = message;
|
|
174
|
-
if (ended) {
|
|
175
|
-
await __classPrivateFieldGet(this, _RemoteStrapiSourceProvider_instances, "m", _RemoteStrapiSourceProvider_respond).call(this, uuid);
|
|
176
|
-
await __classPrivateFieldGet(this, _RemoteStrapiSourceProvider_instances, "m", _RemoteStrapiSourceProvider_endStep).call(this, stage);
|
|
177
|
-
stream.end();
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
if (error) {
|
|
181
|
-
await __classPrivateFieldGet(this, _RemoteStrapiSourceProvider_instances, "m", _RemoteStrapiSourceProvider_respond).call(this, uuid);
|
|
182
|
-
await __classPrivateFieldGet(this, _RemoteStrapiSourceProvider_instances, "m", _RemoteStrapiSourceProvider_endStep).call(this, stage);
|
|
183
|
-
stream.destroy(error);
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
// if we get a single items instead of a batch
|
|
187
|
-
// TODO V5: in v5 only allow array
|
|
188
|
-
for (const item of (0, fp_1.castArray)(data)) {
|
|
189
|
-
stream.push(item);
|
|
190
|
-
}
|
|
191
|
-
this.ws?.once('message', listener);
|
|
192
|
-
await __classPrivateFieldGet(this, _RemoteStrapiSourceProvider_instances, "m", _RemoteStrapiSourceProvider_respond).call(this, uuid);
|
|
193
|
-
};
|
|
194
|
-
this.ws?.once('message', listener);
|
|
195
|
-
return stream;
|
|
196
|
-
}, _RemoteStrapiSourceProvider_startStep = async function _RemoteStrapiSourceProvider_startStep(step) {
|
|
197
|
-
try {
|
|
198
|
-
return await this.dispatcher?.dispatchTransferStep({ action: 'start', step });
|
|
199
|
-
}
|
|
200
|
-
catch (e) {
|
|
201
|
-
if (e instanceof Error) {
|
|
202
|
-
return e;
|
|
203
|
-
}
|
|
204
|
-
if (typeof e === 'string') {
|
|
205
|
-
return new providers_1.ProviderTransferError(e);
|
|
193
|
+
async #startStep(step) {
|
|
194
|
+
try {
|
|
195
|
+
return await this.dispatcher?.dispatchTransferStep({ action: 'start', step });
|
|
206
196
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return new Promise((resolve, reject) => {
|
|
211
|
-
this.ws?.send(JSON.stringify({ uuid }), (e) => {
|
|
212
|
-
if (e) {
|
|
213
|
-
reject(e);
|
|
197
|
+
catch (e) {
|
|
198
|
+
if (e instanceof Error) {
|
|
199
|
+
return e;
|
|
214
200
|
}
|
|
215
|
-
|
|
216
|
-
|
|
201
|
+
if (typeof e === 'string') {
|
|
202
|
+
return new providers_1.ProviderTransferError(e);
|
|
217
203
|
}
|
|
204
|
+
return new providers_1.ProviderTransferError('Unexpected error');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
async #respond(uuid) {
|
|
208
|
+
return new Promise((resolve, reject) => {
|
|
209
|
+
this.ws?.send(JSON.stringify({ uuid }), (e) => {
|
|
210
|
+
if (e) {
|
|
211
|
+
reject(e);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
resolve(e);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
218
217
|
});
|
|
219
|
-
});
|
|
220
|
-
}, _RemoteStrapiSourceProvider_endStep = async function _RemoteStrapiSourceProvider_endStep(step) {
|
|
221
|
-
try {
|
|
222
|
-
await this.dispatcher?.dispatchTransferStep({ action: 'end', step });
|
|
223
218
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
219
|
+
async #endStep(step) {
|
|
220
|
+
try {
|
|
221
|
+
await this.dispatcher?.dispatchTransferStep({ action: 'end', step });
|
|
227
222
|
}
|
|
228
|
-
|
|
229
|
-
|
|
223
|
+
catch (e) {
|
|
224
|
+
if (e instanceof Error) {
|
|
225
|
+
return e;
|
|
226
|
+
}
|
|
227
|
+
if (typeof e === 'string') {
|
|
228
|
+
return new providers_1.ProviderTransferError(e);
|
|
229
|
+
}
|
|
230
|
+
return new providers_1.ProviderTransferError('Unexpected error');
|
|
230
231
|
}
|
|
231
|
-
return
|
|
232
|
+
return null;
|
|
232
233
|
}
|
|
233
|
-
|
|
234
|
-
};
|
|
234
|
+
}
|
|
235
235
|
const createRemoteStrapiSourceProvider = (options) => {
|
|
236
236
|
return new RemoteStrapiSourceProvider(options);
|
|
237
237
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strapi/providers/remote-source/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":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AgC,oCAE3C"}
|
|
@@ -15,7 +15,7 @@ export declare const createDispatcher: (ws: WebSocket, retryMessageOptions?: {
|
|
|
15
15
|
retryMessageTimeout: number;
|
|
16
16
|
}) => {
|
|
17
17
|
readonly transferID: string | undefined;
|
|
18
|
-
readonly transferKind:
|
|
18
|
+
readonly transferKind: any;
|
|
19
19
|
setTransferProperties: (properties: Exclude<IDispatcherState['transfer'], undefined>) => void;
|
|
20
20
|
dispatch: <U = null>(message: Dispatch<Client.Message>, options?: IDispatchOptions) => Promise<U | null>;
|
|
21
21
|
dispatchCommand: <U_1 extends "end" | "init" | "status">(payload: {
|
|
@@ -24,7 +24,7 @@ export declare const createDispatcher: (ws: WebSocket, retryMessageOptions?: {
|
|
|
24
24
|
params?: Client.GetCommandParams<U_1> | undefined;
|
|
25
25
|
})) => Promise<null>;
|
|
26
26
|
dispatchTransferAction: <T>(action: Client.Action['action']) => Promise<T | null>;
|
|
27
|
-
dispatchTransferStep: <T_1, A extends "
|
|
27
|
+
dispatchTransferStep: <T_1, A extends "end" | "start" | "stream" = "end" | "start" | "stream", S extends "entities" | "links" | "assets" | "configuration" = "entities" | "links" | "assets" | "configuration">(payload: {
|
|
28
28
|
step: S;
|
|
29
29
|
action: A;
|
|
30
30
|
} & (A extends "stream" ? {
|