@byelabel/utils
Advanced tools
@@ -447,8 +447,8 @@ "use strict"; | ||
| if (callback && (0, validator_1.isFunction)(callback)) { | ||
| const _d = yield callback(params), { events, stream } = _d, result = __rest(_d, ["events", "stream"]); | ||
| const _d = yield callback(params), { events } = _d, result = __rest(_d, ["events"]); | ||
| if ((_b = message.properties) === null || _b === void 0 ? void 0 : _b.replyTo) { | ||
| const correlationId = (_c = message.properties) === null || _c === void 0 ? void 0 : _c.correlationId; | ||
| // streaming reply: pipe a Readable straight into the chunk protocol | ||
| if (stream && (0, validator_1.isFunction)(stream.pipe)) { | ||
| yield sendReadableStream(message.properties.replyTo, stream, { | ||
| // streaming reply: payload itself is a Readable — pipe it straight into the chunk protocol | ||
| if (result.payload && (0, validator_1.isFunction)(result.payload.pipe)) { | ||
| yield sendReadableStream(message.properties.replyTo, result.payload, { | ||
| replyTo: message.properties.replyTo, | ||
@@ -799,4 +799,4 @@ correlationId, | ||
| return new Promise((resolve) => { | ||
| events_1.default.emit(name, params.data, (error, payload, events, stream) => { | ||
| resolve({ error, payload, events, stream }); | ||
| events_1.default.emit(name, params.data, (error, payload, events) => { | ||
| resolve({ error, payload, events }); | ||
| }); | ||
@@ -803,0 +803,0 @@ }); |
+1
-1
| { | ||
| "name": "@byelabel/utils", | ||
| "version": "2.3.0", | ||
| "version": "2.3.1", | ||
| "description": "ByeLabel Utilities", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
+3
-3
@@ -349,8 +349,8 @@ # @byelabel/utils | ||
| await rabbit.receiveMessage('file', async (params) => { | ||
| return { stream: fs.createReadStream(`/storage/${params.id}.pdf`) }; | ||
| return { payload: fs.createReadStream(`/storage/${params.id}.pdf`) }; | ||
| }); | ||
| // via the eventEmitter (the reply callback's 4th arg is the stream) | ||
| // via the eventEmitter — payload can be a regular value or a Readable | ||
| eventEmitter.on('file.download', (params, reply) => { | ||
| reply(null, null, undefined, fs.createReadStream(`/storage/${params.id}.pdf`)); | ||
| reply(null, fs.createReadStream(`/storage/${params.id}.pdf`)); | ||
| }); | ||
@@ -357,0 +357,0 @@ |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 3 instances in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 3 instances in 1 package
195472
0