@teamscala/service-boot 0.23.341 → 0.23.342

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/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "name": "@teamscala/service-boot",
8
8
  "type": "module",
9
- "version": "0.23.341",
9
+ "version": "0.23.342",
10
10
  "sideEffects": false,
11
11
  "files": [
12
12
  "src"
@@ -46,7 +46,7 @@ export declare const publicAssessmentRouter: {
46
46
  }, undefined>, import("@orpc/contract").Schema<{
47
47
  readonly error: "Assessment not found";
48
48
  } | {
49
- readonly error?: undefined;
49
+ error?: undefined;
50
50
  success: true;
51
51
  responseId: any;
52
52
  reportUrl: string;
@@ -56,7 +56,7 @@ export declare const publicAssessmentRouter: {
56
56
  }, {
57
57
  readonly error: "Assessment not found";
58
58
  } | {
59
- readonly error?: undefined;
59
+ error?: undefined;
60
60
  success: true;
61
61
  responseId: any;
62
62
  reportUrl: string;
@@ -17,7 +17,6 @@
17
17
  import type { Hono } from "hono";
18
18
  import type { ServiceInstallConfig } from "./load-service-install-row.ts";
19
19
  import type { RenderModeLiteral } from "./page-route-shell-types.ts";
20
- import { registerPageServerClient } from "./register-page-server-client.ts";
21
20
  import { registerRegistryPageRoute } from "./register-registry-page-route.ts";
22
21
  import type { RendererComponentEntry } from "./types.ts";
23
22
  import type { CreatePageHandler } from "./types.ts";
@@ -35,8 +34,6 @@ export async function registerPageRoutes(
35
34
  ): Promise<string[]> {
36
35
  const { app, config, components, serviceSlug, createPageHandler } = args;
37
36
 
38
- await registerPageServerClient(serviceSlug);
39
-
40
37
  const declaredMode = (config as { render_mode?: string }).render_mode;
41
38
  const renderMode: RenderModeLiteral =
42
39
  declaredMode === "portal"
@@ -54,6 +54,7 @@ import { registerPageRoutes } from "./register-page-routes.ts";
54
54
  import { runBootHookList } from "./run-boot-hook-list.ts";
55
55
  import { buildClientAssets } from "./build-client-assets.ts";
56
56
  import { discoverBlocks } from "./discover-blocks.ts";
57
+ import { registerPageServerClient } from "./register-page-server-client.ts";
57
58
  import { swapApp } from "./mutable-app-ref.ts";
58
59
  import type { CreatePageHandler } from "./types.ts";
59
60
 
@@ -247,16 +248,6 @@ export async function buildMinimalApp(
247
248
  preloadServerPackages(serverPackages),
248
249
  );
249
250
  const ttlPromise = runStep("init-gate-ttls", () => initGateTtls());
250
- const discoverPromise = runStep("discover-blocks", () =>
251
- discoverBlocks(blockPackages),
252
- );
253
- // Attach an immediate rejection sink: discoverPromise is fired here but
254
- // awaited much later (after the gate chain + mounts). If discoverBlocks
255
- // rejects during that overlap window, the rejection would surface as an
256
- // unhandledRejection before the await below can catch it. The sink is a
257
- // no-op — the real error still propagates at the `await discoverPromise`
258
- // site because each consumer of a rejected promise receives the rejection.
259
- discoverPromise.catch(() => {});
260
251
 
261
252
  // Public access endpoints — MUST be registered before the auth gate (Hono
262
253
  // dispatches middleware + handlers in registration order; the content-gate
@@ -305,6 +296,21 @@ export async function buildMinimalApp(
305
296
  await runStep("mount-orpc-router", () => mountOrpcRouter(app, serviceSlug));
306
297
  }
307
298
 
299
+ // Register the in-process ORPC server client BEFORE discoverBlocks — it
300
+ // calls getServerClient() which needs the client set here. Must follow
301
+ // mount-orpc-router (which builds the router getAppRouter uses).
302
+ // Previously ran inside register-page-routes (too late — discoverBlocks
303
+ // fired before it, hitting the empty-router fallback).
304
+ await runStep("register-page-server-client", () =>
305
+ registerPageServerClient(serviceSlug),
306
+ );
307
+
308
+ // NOW fire discoverBlocks (getServerClient is set). Awaited below before
309
+ // register-page-routes consumes the result.
310
+ const discoverPromise = runStep("discover-blocks", () =>
311
+ discoverBlocks(blockPackages),
312
+ );
313
+
308
314
  const wsRouteCount = await runStep("register-ws-routes", () =>
309
315
  registerWsRoutes(app, config, mountRegistry, serviceSlug),
310
316
  );