@getstrata/bootstrap 2.2.49 → 2.2.50

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @getstrata/bootstrap changelog
2
2
 
3
+ ## 2.2.50
4
+
5
+ - Report an unsuccessful graceful drain when an admitted HTTP-only response aborts during shutdown, after waiting for outstanding application work. Preserve pre-shutdown disconnect handling and normal WebSocket shutdown.
6
+ - Retain the documented mixed HTTP/WebSocket reporting limitation and upstream Bun asynchronous-pipelining truncation limitation; no lossless native-assets support is claimed.
7
+ - Align the core peer requirement with 2.2.50.
8
+
3
9
  ## 2.2.49
4
10
 
5
11
  - Supply the real shared conditional cache operation to API and web module contexts, preserving tags, ETags, invalidation and error recovery.
@@ -74,9 +74,16 @@ function convertAppRoutesToBunRoutes(routes, cors = {}, onRequest, track) {
74
74
  function createWebServer(options) {
75
75
  if (options.lifecycle?.isShuttingDown)
76
76
  throw new Error("Cannot start HTTP during shutdown.");
77
+ let abortedDuringShutdown = 0;
77
78
  const onRequest = (request, server) => {
78
79
  if (options.lifecycle?.isShuttingDown)
79
80
  return new Response("Service Unavailable", { status: 503 });
81
+ if (options.lifecycle && !options.native?.websocket) {
82
+ request.signal.addEventListener("abort", () => {
83
+ if (options.lifecycle?.isShuttingDown)
84
+ abortedDuringShutdown++;
85
+ }, { once: true });
86
+ }
80
87
  return options.onRequest?.(request, server);
81
88
  };
82
89
  for (const field of ["fetch", "routes", "port", "unix"])
@@ -153,6 +160,9 @@ function createWebServer(options) {
153
160
  lifecycle.register(`${name}:drain`, async () => {
154
161
  await draining;
155
162
  await Promise.allSettled([...active]);
163
+ if (abortedDuringShutdown > 0) {
164
+ throw new Error(`${abortedDuringShutdown} admitted HTTP request(s) aborted during shutdown; response completion is unconfirmed.`);
165
+ }
156
166
  }, "drain");
157
167
  lifecycle.register(`${name}:force`, () => server.stop(true), "force");
158
168
  }
package/dist/index.js CHANGED
@@ -2161,9 +2161,16 @@ function convertAppRoutesToBunRoutes(routes, cors = {}, onRequest, track) {
2161
2161
  function createWebServer(options) {
2162
2162
  if (options.lifecycle?.isShuttingDown)
2163
2163
  throw new Error("Cannot start HTTP during shutdown.");
2164
+ let abortedDuringShutdown = 0;
2164
2165
  const onRequest = (request, server) => {
2165
2166
  if (options.lifecycle?.isShuttingDown)
2166
2167
  return new Response("Service Unavailable", { status: 503 });
2168
+ if (options.lifecycle && !options.native?.websocket) {
2169
+ request.signal.addEventListener("abort", () => {
2170
+ if (options.lifecycle?.isShuttingDown)
2171
+ abortedDuringShutdown++;
2172
+ }, { once: true });
2173
+ }
2167
2174
  return options.onRequest?.(request, server);
2168
2175
  };
2169
2176
  for (const field of ["fetch", "routes", "port", "unix"])
@@ -2240,6 +2247,9 @@ function createWebServer(options) {
2240
2247
  lifecycle.register(`${name}:drain`, async () => {
2241
2248
  await draining;
2242
2249
  await Promise.allSettled([...active]);
2250
+ if (abortedDuringShutdown > 0) {
2251
+ throw new Error(`${abortedDuringShutdown} admitted HTTP request(s) aborted during shutdown; response completion is unconfirmed.`);
2252
+ }
2243
2253
  }, "drain");
2244
2254
  lifecycle.register(`${name}:force`, () => server.stop(true), "force");
2245
2255
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getstrata/bootstrap",
3
- "version": "2.2.49",
3
+ "version": "2.2.50",
4
4
  "description": "Strata application bootstrap: HttpKernel, DI, web session helpers",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -190,7 +190,7 @@
190
190
  "access": "public"
191
191
  },
192
192
  "peerDependencies": {
193
- "@getstrata/core": "^2.2.49",
193
+ "@getstrata/core": "^2.2.50",
194
194
  "typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
195
195
  },
196
196
  "engines": {