bazis 0.98.7 → 0.98.8

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.
@@ -154,6 +154,12 @@ export class HttpServer implements HostedService {
154
154
  if (this.options.securityHeaders !== false) {
155
155
  serverChain.push(securityHeaders(this.options.securityHeaders ?? {}));
156
156
  }
157
+ const serverMiddleware = this.collectServerMiddleware();
158
+ // A global correlation middleware wraps the error boundary, so error
159
+ // responses (401, 403, 500, a thrown NotFoundError) and the responses
160
+ // produced before routing (404, 405, 413, preflight, docs, health) carry
161
+ // the request id, and the error log line runs inside its request context.
162
+ serverChain.push(...serverMiddleware.filter(isCorrelationIdMiddleware));
157
163
  // Unexpected errors go to the application logger, like the access log.
158
164
  const errorLogger = this.resolver.tryResolve(LOGGER);
159
165
  serverChain.push(
@@ -164,13 +170,10 @@ export class HttpServer implements HostedService {
164
170
  onUnexpectedError: this.collectErrorHook(),
165
171
  }),
166
172
  );
167
- const serverMiddleware = this.collectServerMiddleware();
168
- // Responses produced before routing (404, 405, 413, preflight, docs,
169
- // health) still carry the correlation id of a global correlation middleware.
170
- this.shortCircuitChain = [...serverChain, ...serverMiddleware.filter(isCorrelationIdMiddleware)];
173
+ this.shortCircuitChain = [...serverChain];
171
174
  // A global `cors()` among the middleware answers preflights like `cors`.
172
175
  this.globalCors = this.options.cors || serverMiddleware.map(corsOptionsOf).find((options) => options !== undefined);
173
- serverChain.push(...serverMiddleware);
176
+ serverChain.push(...serverMiddleware.filter((middleware) => !isCorrelationIdMiddleware(middleware)));
174
177
 
175
178
  const builder = new RouterBuilder(
176
179
  serverChain,
@@ -232,7 +232,7 @@ export class CodexAppServerClient implements CodexClient {
232
232
  if (method === "account/updated") this.modelCache = undefined;
233
233
  }, () => { this.clearLogin(); this.modelCache = undefined; });
234
234
  const initialized = await client.request("initialize", {
235
- clientInfo: { name: "bazis", title: "Bazis", version: "0.98.7" }, capabilities: { experimentalApi: true },
235
+ clientInfo: { name: "bazis", title: "Bazis", version: "0.98.8" }, capabilities: { experimentalApi: true },
236
236
  }, 15_000, signal);
237
237
  if (resolve(text(initialized.codexHome, 4096)) !== this.paths.home) throw new CodexError("PROTOCOL_ERROR");
238
238
  client.notify("initialized");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bazis",
3
- "version": "0.98.7",
3
+ "version": "0.98.8",
4
4
  "description": "Modular backend framework for Bun in TypeScript: DI wired by codegen, HTTP, a PostgreSQL ORM, JWT, WebSocket, agents and a CLI.",
5
5
  "license": "MIT",
6
6
  "author": "Alexander Alenin",