@strapi/data-transfer 4.8.1 → 4.8.2
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.
|
@@ -141,13 +141,17 @@ class RemoteStrapiDestinationProvider {
|
|
|
141
141
|
};
|
|
142
142
|
const startAssetsTransferOnce = __classPrivateFieldGet(this, _RemoteStrapiDestinationProvider_instances, "m", _RemoteStrapiDestinationProvider_startStepOnce).call(this, 'assets');
|
|
143
143
|
const flush = async () => {
|
|
144
|
-
await __classPrivateFieldGet(this, _RemoteStrapiDestinationProvider_instances, "m", _RemoteStrapiDestinationProvider_streamStep).call(this, 'assets', batch);
|
|
144
|
+
const streamError = await __classPrivateFieldGet(this, _RemoteStrapiDestinationProvider_instances, "m", _RemoteStrapiDestinationProvider_streamStep).call(this, 'assets', batch);
|
|
145
145
|
batch = [];
|
|
146
|
+
return streamError;
|
|
146
147
|
};
|
|
147
148
|
const safePush = async (chunk) => {
|
|
148
149
|
batch.push(chunk);
|
|
149
150
|
if (batchLength() >= batchSize) {
|
|
150
|
-
await flush();
|
|
151
|
+
const streamError = await flush();
|
|
152
|
+
if (streamError) {
|
|
153
|
+
throw streamError;
|
|
154
|
+
}
|
|
151
155
|
}
|
|
152
156
|
};
|
|
153
157
|
return new stream_1.Writable({
|
|
@@ -173,12 +177,23 @@ class RemoteStrapiDestinationProvider {
|
|
|
173
177
|
hasStarted = true;
|
|
174
178
|
const assetID = (0, uuid_1.v4)();
|
|
175
179
|
const { filename, filepath, stats, stream } = asset;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
try {
|
|
181
|
+
await safePush({
|
|
182
|
+
action: 'start',
|
|
183
|
+
assetID,
|
|
184
|
+
data: { filename, filepath, stats },
|
|
185
|
+
});
|
|
186
|
+
for await (const chunk of stream) {
|
|
187
|
+
await safePush({ action: 'stream', assetID, data: chunk });
|
|
188
|
+
}
|
|
189
|
+
await safePush({ action: 'end', assetID });
|
|
190
|
+
callback();
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
if (error instanceof Error) {
|
|
194
|
+
callback(error);
|
|
195
|
+
}
|
|
179
196
|
}
|
|
180
|
-
await safePush({ action: 'end', assetID });
|
|
181
|
-
callback();
|
|
182
197
|
},
|
|
183
198
|
});
|
|
184
199
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/data-transfer",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.2",
|
|
4
4
|
"description": "Data transfer capabilities for Strapi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"lib": "./lib"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@strapi/logger": "4.8.
|
|
43
|
-
"@strapi/strapi": "4.8.
|
|
42
|
+
"@strapi/logger": "4.8.2",
|
|
43
|
+
"@strapi/strapi": "4.8.2",
|
|
44
44
|
"chalk": "4.1.2",
|
|
45
45
|
"fs-extra": "10.0.0",
|
|
46
46
|
"lodash": "4.17.21",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"node": ">=14.19.1 <=18.x.x",
|
|
75
75
|
"npm": ">=6.0.0"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "cc73bed97b19d44f7c7999ab44f1a4288590d7ab"
|
|
78
78
|
}
|