@supacloud/elysia 0.42.0 → 0.42.1
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/bun-aot.js +25 -4
- package/dist/index.js +25 -4
- package/package.json +5 -5
package/dist/bun-aot.js
CHANGED
|
@@ -1705,10 +1705,15 @@ function createRabbitMqQueuePort(options) {
|
|
|
1705
1705
|
const deliveries = new Map;
|
|
1706
1706
|
let consumer;
|
|
1707
1707
|
let starting;
|
|
1708
|
+
let closing;
|
|
1708
1709
|
let closed = false;
|
|
1709
1710
|
const deliver = (message) => {
|
|
1710
1711
|
if (message === null)
|
|
1711
1712
|
return;
|
|
1713
|
+
if (closed) {
|
|
1714
|
+
options.channel.nack(message, false, true);
|
|
1715
|
+
return;
|
|
1716
|
+
}
|
|
1712
1717
|
const id = String(message.fields.deliveryTag);
|
|
1713
1718
|
let payload;
|
|
1714
1719
|
try {
|
|
@@ -1730,10 +1735,17 @@ function createRabbitMqQueuePort(options) {
|
|
|
1730
1735
|
throw new Error("RABBITMQ_QUEUE_CLOSED");
|
|
1731
1736
|
if (!starting) {
|
|
1732
1737
|
starting = Promise.resolve(options.channel.prefetch(prefetch)).then(() => options.channel.consume(options.queue, deliver, { noAck: false })).then((value) => {
|
|
1738
|
+
if (closed) {
|
|
1739
|
+
return Promise.resolve(options.channel.cancel(value.consumerTag)).then(() => {
|
|
1740
|
+
return;
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1733
1743
|
consumer = value;
|
|
1734
1744
|
});
|
|
1735
1745
|
}
|
|
1736
1746
|
await starting;
|
|
1747
|
+
if (closed)
|
|
1748
|
+
throw new Error("RABBITMQ_QUEUE_CLOSED");
|
|
1737
1749
|
};
|
|
1738
1750
|
const receive = async () => {
|
|
1739
1751
|
await start();
|
|
@@ -1770,13 +1782,22 @@ function createRabbitMqQueuePort(options) {
|
|
|
1770
1782
|
options.channel.nack(message, false, failure?.deadLetter !== true);
|
|
1771
1783
|
},
|
|
1772
1784
|
async close() {
|
|
1785
|
+
if (closing)
|
|
1786
|
+
return closing;
|
|
1773
1787
|
closed = true;
|
|
1774
1788
|
for (const resolve of pending.splice(0))
|
|
1775
1789
|
resolve(null);
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1790
|
+
const inFlight = starting;
|
|
1791
|
+
closing = (async () => {
|
|
1792
|
+
try {
|
|
1793
|
+
await inFlight;
|
|
1794
|
+
} catch {}
|
|
1795
|
+
if (consumer)
|
|
1796
|
+
await options.channel.cancel(consumer.consumerTag);
|
|
1797
|
+
consumer = undefined;
|
|
1798
|
+
starting = undefined;
|
|
1799
|
+
})();
|
|
1800
|
+
return closing;
|
|
1780
1801
|
}
|
|
1781
1802
|
};
|
|
1782
1803
|
}
|
package/dist/index.js
CHANGED
|
@@ -1705,10 +1705,15 @@ function createRabbitMqQueuePort(options) {
|
|
|
1705
1705
|
const deliveries = new Map;
|
|
1706
1706
|
let consumer;
|
|
1707
1707
|
let starting;
|
|
1708
|
+
let closing;
|
|
1708
1709
|
let closed = false;
|
|
1709
1710
|
const deliver = (message) => {
|
|
1710
1711
|
if (message === null)
|
|
1711
1712
|
return;
|
|
1713
|
+
if (closed) {
|
|
1714
|
+
options.channel.nack(message, false, true);
|
|
1715
|
+
return;
|
|
1716
|
+
}
|
|
1712
1717
|
const id = String(message.fields.deliveryTag);
|
|
1713
1718
|
let payload;
|
|
1714
1719
|
try {
|
|
@@ -1730,10 +1735,17 @@ function createRabbitMqQueuePort(options) {
|
|
|
1730
1735
|
throw new Error("RABBITMQ_QUEUE_CLOSED");
|
|
1731
1736
|
if (!starting) {
|
|
1732
1737
|
starting = Promise.resolve(options.channel.prefetch(prefetch)).then(() => options.channel.consume(options.queue, deliver, { noAck: false })).then((value) => {
|
|
1738
|
+
if (closed) {
|
|
1739
|
+
return Promise.resolve(options.channel.cancel(value.consumerTag)).then(() => {
|
|
1740
|
+
return;
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1733
1743
|
consumer = value;
|
|
1734
1744
|
});
|
|
1735
1745
|
}
|
|
1736
1746
|
await starting;
|
|
1747
|
+
if (closed)
|
|
1748
|
+
throw new Error("RABBITMQ_QUEUE_CLOSED");
|
|
1737
1749
|
};
|
|
1738
1750
|
const receive = async () => {
|
|
1739
1751
|
await start();
|
|
@@ -1770,13 +1782,22 @@ function createRabbitMqQueuePort(options) {
|
|
|
1770
1782
|
options.channel.nack(message, false, failure?.deadLetter !== true);
|
|
1771
1783
|
},
|
|
1772
1784
|
async close() {
|
|
1785
|
+
if (closing)
|
|
1786
|
+
return closing;
|
|
1773
1787
|
closed = true;
|
|
1774
1788
|
for (const resolve of pending.splice(0))
|
|
1775
1789
|
resolve(null);
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1790
|
+
const inFlight = starting;
|
|
1791
|
+
closing = (async () => {
|
|
1792
|
+
try {
|
|
1793
|
+
await inFlight;
|
|
1794
|
+
} catch {}
|
|
1795
|
+
if (consumer)
|
|
1796
|
+
await options.channel.cancel(consumer.consumerTag);
|
|
1797
|
+
consumer = undefined;
|
|
1798
|
+
starting = undefined;
|
|
1799
|
+
})();
|
|
1800
|
+
return closing;
|
|
1780
1801
|
}
|
|
1781
1802
|
};
|
|
1782
1803
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/elysia",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"description": "Elysia runtime adapter for SupaCloud compiled modules: application/request scopes, route registration and validation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@supacloud/app": "0.39.1",
|
|
58
58
|
"@supacloud/commands": "0.12.0",
|
|
59
|
-
"@supacloud/contracts": "0.16.
|
|
59
|
+
"@supacloud/contracts": "0.16.1",
|
|
60
60
|
"effect": "4.0.5",
|
|
61
61
|
"exact-mirror": "1.2.6",
|
|
62
62
|
"jose": "^6.2.13",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"overrides": {
|
|
66
66
|
"@supacloud/delivery": "0.26.0",
|
|
67
|
-
"@supacloud/contracts": "0.16.
|
|
67
|
+
"@supacloud/contracts": "0.16.1",
|
|
68
68
|
"@supacloud/commands": "0.12.0",
|
|
69
69
|
"@graphql-tools/utils": "^12.0.4",
|
|
70
70
|
"deepmerge-ts": "8.0.2",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"elysia": "2.0.0-rc.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@supacloud/compiler": "0.
|
|
77
|
+
"@supacloud/compiler": "0.60.0",
|
|
78
78
|
"@supacloud/delivery": "0.26.0",
|
|
79
|
-
"@supacloud/db": "0.
|
|
79
|
+
"@supacloud/db": "0.24.0",
|
|
80
80
|
"@types/bun": "^1.4.4",
|
|
81
81
|
"elysia": "2.0.0-rc.1",
|
|
82
82
|
"typescript": "7.1.0-beta"
|