bazis 0.110.0 → 0.110.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.
@@ -15,6 +15,7 @@ import { grpcModule, type GrpcModuleOptions } from "../grpc";
15
15
  import { buildHttpOpenApiDocument } from "../http/OpenApi/openApiDocument";
16
16
  import { defaultAuthorizeChecks } from "../http/Authorization/metadata";
17
17
  import { KernelBuilder, Bazis, KernelError, type KernelOptions, type ValidatableConfig } from "../kernel";
18
+ import { reportBuildFailure } from "../kernel/Bazis";
18
19
  import { websocketModule, type WebSocketOptions } from "../websocket";
19
20
  import {
20
21
  isUiProfileAuthoringClass,
@@ -287,7 +288,14 @@ function normalizeAbsolutePath(path: string): string {
287
288
  */
288
289
  export async function runApp(root: BazisModuleRef, options: RunAppOptions = {}): Promise<number> {
289
290
  await loadBazisGeneratedRuntime();
290
- return Bazis.run(composeApp(root, options), options.kernel, (builder) => {
291
+ let app: BazisModuleRef;
292
+ try {
293
+ app = composeApp(root, options);
294
+ } catch (error) {
295
+ // Composing already reads routes and options: report its errors like the kernel build does.
296
+ return reportBuildFailure(error);
297
+ }
298
+ return Bazis.run(app, options.kernel, (builder) => {
291
299
  builder.useApplicationRoot(root);
292
300
  options.configure?.(builder);
293
301
  });
@@ -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.110.0" }, capabilities: { experimentalApi: true },
235
+ clientInfo: { name: "bazis", title: "Bazis", version: "0.110.1" }, 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");
@@ -47,17 +47,7 @@ export class Bazis {
47
47
  try {
48
48
  kernel = await builder.build();
49
49
  } catch (error) {
50
- if (screen !== undefined && !(error instanceof ShutdownTimeoutError)) {
51
- screen.failed(error, undefined, builder.report);
52
- process.exitCode = 1;
53
- return 1;
54
- }
55
- if (error instanceof DiError || error instanceof KernelError) {
56
- console.error(`[bazis] configuration error: ${redactSensitiveText(error.message)}`);
57
- process.exitCode = 1;
58
- return 1;
59
- }
60
- throw error;
50
+ return reportBuildFailure(error, screen, builder.report);
61
51
  }
62
52
 
63
53
  try {
@@ -96,3 +86,27 @@ export class Bazis {
96
86
  }
97
87
  }
98
88
  }
89
+
90
+ /**
91
+ * @internal How a start that failed before the kernel was built is reported:
92
+ * the startup screen on a terminal, otherwise one `[bazis] configuration error`
93
+ * line for DI and kernel errors. Returns exit code 1; anything else is rethrown.
94
+ * `runApp` uses it for errors found while it composes the application.
95
+ */
96
+ export function reportBuildFailure(
97
+ error: unknown,
98
+ screen: StartupScreen | undefined = startupScreenEnabled() ? new StartupScreen() : undefined,
99
+ report?: KernelBuilder["report"],
100
+ ): number {
101
+ if (screen !== undefined && !(error instanceof ShutdownTimeoutError)) {
102
+ screen.failed(error, undefined, report);
103
+ process.exitCode = 1;
104
+ return 1;
105
+ }
106
+ if (error instanceof DiError || error instanceof KernelError) {
107
+ console.error(`[bazis] configuration error: ${redactSensitiveText(error.message)}`);
108
+ process.exitCode = 1;
109
+ return 1;
110
+ }
111
+ throw error;
112
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bazis",
3
- "version": "0.110.0",
3
+ "version": "0.110.1",
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",