@supacloud/elysia 0.42.0 → 0.42.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/README.md +1 -1
- package/dist/bun-aot.js +27 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -6
- package/dist/worker.d.ts +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -144,7 +144,7 @@ network listener. It is included in the normal `bun test` discovery.
|
|
|
144
144
|
A configured `errorMapper` retains precedence. Capacity errors thrown later
|
|
145
145
|
by application code are not automatically treated as admission failures.
|
|
146
146
|
The transport-neutral registry exports `PendingWorkCapacityError` from
|
|
147
|
-
`@supacloud/app/
|
|
147
|
+
`@supacloud/app/pending-work`; it remains a `RangeError` subclass.
|
|
148
148
|
|
|
149
149
|
### Not Yet Proven by This Suite
|
|
150
150
|
|
package/dist/bun-aot.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Elysia as Elysia4, setupTypebox, Validator as Validator2 } from "elysia";
|
|
3
3
|
import { requireFeatureRequestContext } from "@supacloud/app";
|
|
4
4
|
import { composeAspects as composeApplicationAspects, invokeAspect, freezeAspectData } from "@supacloud/app/execution";
|
|
5
|
-
import { PendingWorkRegistry as PendingWorkRegistry2, PendingWorkTimeoutError, PendingWorkCapacityError } from "@supacloud/app/
|
|
5
|
+
import { PendingWorkRegistry as PendingWorkRegistry2, PendingWorkTimeoutError, PendingWorkCapacityError } from "@supacloud/app/pending-work";
|
|
6
6
|
import { commandFailureMetadata as commandFailureMetadata3, decodeCommandPreview } from "@supacloud/contracts";
|
|
7
7
|
|
|
8
8
|
// src/command-errors.ts
|
|
@@ -1690,7 +1690,7 @@ function cloneValue(value) {
|
|
|
1690
1690
|
return structuredClone(value);
|
|
1691
1691
|
}
|
|
1692
1692
|
// src/worker.ts
|
|
1693
|
-
import { PendingWorkRegistry } from "@supacloud/app/
|
|
1693
|
+
import { PendingWorkRegistry } from "@supacloud/app/pending-work";
|
|
1694
1694
|
function createRabbitMqQueuePort(options) {
|
|
1695
1695
|
if (!options.channel || typeof options.channel.consume !== "function" || typeof options.channel.ack !== "function" || typeof options.channel.nack !== "function" || !/^[A-Za-z0-9_.:-]{1,255}$/.test(options.queue)) {
|
|
1696
1696
|
throw new TypeError("RabbitMQ queue port options are invalid");
|
|
@@ -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.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia, type AnyElysia, type Context, type StatusMap } from "elysia";
|
|
2
2
|
import type { CommandRuntimeAudit, CommandRuntimeAuthorizer, CommandRuntimeGovernance, CommandRuntimeInvocation, CommandRuntimeMiddleware } from "@supacloud/app";
|
|
3
|
-
import { PendingWorkRegistry } from "@supacloud/app/
|
|
3
|
+
import { PendingWorkRegistry } from "@supacloud/app/pending-work";
|
|
4
4
|
import { type CommandPreview, type ErrorMetadata } from "@supacloud/contracts";
|
|
5
5
|
import { type HttpPolicyRegistry } from "./http-policy";
|
|
6
6
|
export { HttpPolicyConfigurationError } from "./http-policy";
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Elysia as Elysia4, setupTypebox, Validator as Validator2 } from "elysia";
|
|
3
3
|
import { requireFeatureRequestContext } from "@supacloud/app";
|
|
4
4
|
import { composeAspects as composeApplicationAspects, invokeAspect, freezeAspectData } from "@supacloud/app/execution";
|
|
5
|
-
import { PendingWorkRegistry as PendingWorkRegistry2, PendingWorkTimeoutError, PendingWorkCapacityError } from "@supacloud/app/
|
|
5
|
+
import { PendingWorkRegistry as PendingWorkRegistry2, PendingWorkTimeoutError, PendingWorkCapacityError } from "@supacloud/app/pending-work";
|
|
6
6
|
import { commandFailureMetadata as commandFailureMetadata3, decodeCommandPreview } from "@supacloud/contracts";
|
|
7
7
|
|
|
8
8
|
// src/command-errors.ts
|
|
@@ -1690,7 +1690,7 @@ function cloneValue(value) {
|
|
|
1690
1690
|
return structuredClone(value);
|
|
1691
1691
|
}
|
|
1692
1692
|
// src/worker.ts
|
|
1693
|
-
import { PendingWorkRegistry } from "@supacloud/app/
|
|
1693
|
+
import { PendingWorkRegistry } from "@supacloud/app/pending-work";
|
|
1694
1694
|
function createRabbitMqQueuePort(options) {
|
|
1695
1695
|
if (!options.channel || typeof options.channel.consume !== "function" || typeof options.channel.ack !== "function" || typeof options.channel.nack !== "function" || !/^[A-Za-z0-9_.:-]{1,255}$/.test(options.queue)) {
|
|
1696
1696
|
throw new TypeError("RabbitMQ queue port options are invalid");
|
|
@@ -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/worker.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PendingWorkRegistry } from "@supacloud/app/
|
|
1
|
+
import { PendingWorkRegistry } from "@supacloud/app/pending-work";
|
|
2
2
|
import { type CompiledJob, type CompiledModule, type ExecutionObserver, type JobExecutor } from "./index";
|
|
3
3
|
export type WorkerState = "idle" | "starting" | "running" | "stopping" | "stopped";
|
|
4
4
|
/** The transport-specific claim is mapped to this small execution contract. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/elysia",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.2",
|
|
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,15 +56,15 @@
|
|
|
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",
|
|
63
63
|
"typebox": "1.4.3"
|
|
64
64
|
},
|
|
65
65
|
"overrides": {
|
|
66
|
-
"@supacloud/delivery": "0.
|
|
67
|
-
"@supacloud/contracts": "0.16.
|
|
66
|
+
"@supacloud/delivery": "0.27.0",
|
|
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.
|
|
78
|
-
"@supacloud/delivery": "0.
|
|
79
|
-
"@supacloud/db": "0.
|
|
77
|
+
"@supacloud/compiler": "0.62.1",
|
|
78
|
+
"@supacloud/delivery": "0.27.0",
|
|
79
|
+
"@supacloud/db": "0.24.2",
|
|
80
80
|
"@types/bun": "^1.4.4",
|
|
81
81
|
"elysia": "2.0.0-rc.1",
|
|
82
82
|
"typescript": "7.1.0-beta"
|