@camstack/server 1.2.227 → 1.2.229

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.
@@ -23,13 +23,15 @@ exports.describeMeshOrigin = describeMeshOrigin;
23
23
  exports.buildCoreCapService = buildCoreCapService;
24
24
  const system_1 = require("@camstack/system");
25
25
  const http_request_census_singleton_js_1 = require("./http-request-census.singleton.js");
26
+ const server_provided_caps_js_1 = require("./server-provided-caps.js");
26
27
  const trpc_context_js_1 = require("./trpc.context.js");
27
28
  const trpc_middleware_js_1 = require("./trpc.middleware.js");
28
29
  /**
29
30
  * appRouter namespaces that back the CORE API surface and must be
30
- * reachable cross-process. This is the core-router list from
31
- * `trpc.router.ts` (`buildCapabilityRouters`) minus the deliberate
32
- * exclusions below.
31
+ * reachable cross-process: every server-provided hub-service cap
32
+ * (`HUB_SERVICE_CAP_NAMES`, the single source shared with
33
+ * `buildServerProviders`) plus the hand-written core routers from
34
+ * `trpc.router.ts`, minus the deliberate exclusions below.
33
35
  *
34
36
  * Excluded on purpose:
35
37
  * - `auth` — issuing service / scoped tokens over the trusted mesh
@@ -40,12 +42,8 @@ const trpc_middleware_js_1 = require("./trpc.middleware.js");
40
42
  * request/reply, and the worker side fast-fails on them by design.
41
43
  */
42
44
  const CORE_NAMESPACES = new Set([
43
- // Service-backed cap routers (no addon provider).
44
- 'system',
45
- 'toast',
46
- 'integrations',
47
- 'nodes',
48
- 'addons',
45
+ // Service-backed cap routers (no addon provider) — derived, never copied.
46
+ ...server_provided_caps_js_1.HUB_SERVICE_CAP_NAMES.map(server_provided_caps_js_1.capNameToNamespace),
49
47
  // Hand-written single-impl core routers.
50
48
  'capabilities',
51
49
  'notifications',
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * The capabilities the SERVER provides — routers mounted from
4
+ * `buildServerProviders` (`trpc.router.ts`) rather than from an addon.
5
+ *
6
+ * One list, two consumers, so they cannot drift:
7
+ * - `buildServerProviders` is typed over {@link ServerProvidedCapName}: a
8
+ * factory added there without a name here, or a name here without a
9
+ * factory, is a compile error.
10
+ * - the `$core-caps` mesh bridge (`core-cap-bridge.ts`) derives its
11
+ * namespace set from {@link HUB_SERVICE_CAP_NAMES}. Before it did, the
12
+ * inference-timeout guard's first fingerprint failed on all three nodes
13
+ * with "no provider registered for cap server-management" — the server
14
+ * provided the cap, no addon did, and the bridge list had been copied by
15
+ * hand before the cap existed.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ADDON_BACKED_SERVER_CAP_NAMES = exports.HUB_SERVICE_CAP_NAMES = void 0;
19
+ exports.capNameToNamespace = capNameToNamespace;
20
+ /**
21
+ * Caps served by a hub SERVICE. No addon ever registers a provider for them,
22
+ * so a forked runner can reach them only over the `$core-caps` bridge.
23
+ */
24
+ exports.HUB_SERVICE_CAP_NAMES = [
25
+ 'network-quality',
26
+ 'system',
27
+ 'toast',
28
+ 'integrations',
29
+ 'nodes',
30
+ 'server-management',
31
+ 'addons',
32
+ ];
33
+ /**
34
+ * Caps whose server factory only WRAPS an addon singleton per request
35
+ * (`webrtc-session` injects the HTTP User-Agent the forked broker cannot
36
+ * see). A forked caller resolves these through the registry like any addon
37
+ * cap; a resolver miss means the addon is down, not that the bridge should
38
+ * answer — so they are deliberately NOT bridged.
39
+ */
40
+ exports.ADDON_BACKED_SERVER_CAP_NAMES = ['webrtc-session'];
41
+ /** kebab-case cap name → the camelCase appRouter namespace it is mounted as. */
42
+ function capNameToNamespace(capName) {
43
+ return capName.replace(/-([a-z])/g, (_m, c) => c.toUpperCase());
44
+ }
@@ -349,6 +349,9 @@ class MoleculerService {
349
349
  // multi-node addon cap is covered with no change here.
350
350
  isCoreServiceCap: (capName) => (0, core_cap_bridge_js_1.isCoreServiceCapName)(capName),
351
351
  logger: {
352
+ debug: (msg, meta) => logger.debug(msg, meta !== null && meta !== undefined
353
+ ? { meta: meta }
354
+ : undefined),
352
355
  warn: (msg, meta) => logger.warn(msg, meta !== null && meta !== undefined
353
356
  ? { meta: meta }
354
357
  : undefined),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.227",
3
+ "version": "1.2.229",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -78,5 +78,10 @@
78
78
  "vitest": "*",
79
79
  "@camstack/node-root": "*",
80
80
  "tsup": "^8.0.0"
81
+ },
82
+ "nx": {
83
+ "implicitDependencies": [
84
+ "@camstack/addon-benchmark"
85
+ ]
81
86
  }
82
87
  }