Skip to content

Commit 4549c7e

Browse files
committed
Make code ES2022-compatible
1 parent 7299aba commit 4549c7e

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"test": "tests"
4646
},
4747
"engines": {
48-
"node": ">=10.3.0"
48+
"node": ">=18.0.0"
4949
},
5050
"scripts": {
5151
"pretest": "npm run build",
@@ -96,4 +96,4 @@
9696
"better-sqlite3": "^11.3.0",
9797
"md5": "^2.3.0"
9898
}
99-
}
99+
}

src/EventDispatcher.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,14 @@ export class EventDispatcher implements IEventDispatcher {
146146
if (!isEventSet(events) || events.length === 0)
147147
throw new Error('dispatch requires a non-empty array of events');
148148

149-
const { promise, resolve, reject } = Promise.withResolvers<IEventSet>();
149+
// const { promise, resolve, reject } = Promise.withResolvers<IEventSet>();
150+
let resolve!: (value: IEventSet | PromiseLike<IEventSet>) => void;
151+
let reject!: (reason?: any) => void;
152+
const promise = new Promise<IEventSet>((res, rej) => {
153+
resolve = res;
154+
reject = rej;
155+
});
156+
150157
const envelope: EventBatchEnvelope = {
151158
data: events.map(event => ({
152159
event,

src/rabbitmq/RabbitMqGateway.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class RabbitMqGateway {
144144
async #stopConsuming() {
145145
this.#logger?.info(`${this.#appId}: Stopping all consumers...`);
146146

147-
const cancellations = this.#queueConsumers.entries().map(async ([queueName, { channel, consumerTag }]) => {
147+
const cancellations = [...this.#queueConsumers.entries()].map(async ([queueName, { channel, consumerTag }]) => {
148148
this.#logger?.debug(`${this.#appId}: Cancelling consumer "${consumerTag}" for queue "${queueName}"`);
149149
try {
150150
await channel.cancel(consumerTag);

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"sourceMap": true,
77
"alwaysStrict": false,
88
"outDir": "./dist",
9-
"target": "ESNext",
9+
"target": "ES2022",
1010
"declaration": true,
1111
"declarationDir": "./types",
1212
"allowSyntheticDefaultImports": true,

0 commit comments

Comments
 (0)