@strapi/data-transfer 4.15.0 → 4.15.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.
- package/dist/commands/data-transfer.d.ts +2 -75
- package/dist/commands/data-transfer.d.ts.map +1 -1
- package/dist/index.js +22 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -24
- package/dist/index.mjs.map +1 -1
- package/dist/strapi/remote/handlers/push.d.ts.map +1 -1
- package/package.json +8 -7
package/dist/index.mjs
CHANGED
|
@@ -3500,30 +3500,28 @@ const createPushController = handlerControllerFactory((proto) => ({
|
|
|
3500
3500
|
return;
|
|
3501
3501
|
}
|
|
3502
3502
|
for (const item of payload) {
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
}
|
|
3526
|
-
});
|
|
3503
|
+
const { action: action2, assetID } = item;
|
|
3504
|
+
if (!assetsStream) {
|
|
3505
|
+
throw new Error("Stream not defined");
|
|
3506
|
+
}
|
|
3507
|
+
if (action2 === "start") {
|
|
3508
|
+
this.assets[assetID] = { ...item.data, stream: new PassThrough() };
|
|
3509
|
+
writeAsync(assetsStream, this.assets[assetID]);
|
|
3510
|
+
}
|
|
3511
|
+
if (action2 === "stream") {
|
|
3512
|
+
const rawBuffer = item.data;
|
|
3513
|
+
const chunk = Buffer.from(rawBuffer.data);
|
|
3514
|
+
await writeAsync(this.assets[assetID].stream, chunk);
|
|
3515
|
+
}
|
|
3516
|
+
if (action2 === "end") {
|
|
3517
|
+
await new Promise((resolve, reject2) => {
|
|
3518
|
+
const { stream: assetStream } = this.assets[assetID];
|
|
3519
|
+
assetStream.on("close", () => {
|
|
3520
|
+
delete this.assets[assetID];
|
|
3521
|
+
resolve();
|
|
3522
|
+
}).on("error", reject2).end();
|
|
3523
|
+
});
|
|
3524
|
+
}
|
|
3527
3525
|
}
|
|
3528
3526
|
},
|
|
3529
3527
|
onClose() {
|