gcf-common-lib 0.23.29 → 0.23.30
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/package.json +1 -1
- package/src/index.js +6 -1
- package/src/index.ts +7 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -103,7 +103,12 @@ class GcfCommon {
|
|
|
103
103
|
return (0, utils_1.withAmqpCh)((ch) => __awaiter(this, void 0, void 0, function* () {
|
|
104
104
|
const payload = Buffer.from(JSON.stringify(json !== null && json !== void 0 ? json : {}));
|
|
105
105
|
yield ch.assertQueue(queue, this.amqpOptions.assertOptions);
|
|
106
|
-
ch.sendToQueue(queue, payload, this.amqpOptions.publishOptions)
|
|
106
|
+
yield new Promise((resolve, reject) => ch.sendToQueue(queue, payload, this.amqpOptions.publishOptions, (err, ok) => {
|
|
107
|
+
if (err)
|
|
108
|
+
reject(err);
|
|
109
|
+
else
|
|
110
|
+
resolve(ok);
|
|
111
|
+
}));
|
|
107
112
|
}), this.amqpOptions.url);
|
|
108
113
|
}
|
|
109
114
|
});
|
package/src/index.ts
CHANGED
|
@@ -87,7 +87,13 @@ export class GcfCommon {
|
|
|
87
87
|
return withAmqpCh(async ch => {
|
|
88
88
|
const payload = Buffer.from(JSON.stringify(json ?? {}));
|
|
89
89
|
await ch.assertQueue(queue, this.amqpOptions.assertOptions);
|
|
90
|
-
|
|
90
|
+
|
|
91
|
+
await new Promise((resolve, reject) =>
|
|
92
|
+
ch.sendToQueue(queue, payload, this.amqpOptions.publishOptions, (err, ok) => {
|
|
93
|
+
if (err) reject(err); else resolve(ok);
|
|
94
|
+
}),
|
|
95
|
+
);
|
|
96
|
+
|
|
91
97
|
}, this.amqpOptions.url as string);
|
|
92
98
|
}
|
|
93
99
|
}
|