@feasibleone/blong-gogo 1.19.1 → 1.21.0

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.21.0](https://github.com/feasibleone/blong/compare/blong-gogo-v1.20.0...blong-gogo-v1.21.0) (2026-05-12)
4
+
5
+
6
+ ### Features
7
+
8
+ * **blong-int-adapter:** expand mysql/mongodb/kafka integration test coverage ([#143](https://github.com/feasibleone/blong/issues/143)) ([b4bb9dd](https://github.com/feasibleone/blong/commit/b4bb9dd130ed9adcb6f4f28d57534f69b174321f))
9
+
10
+ ## [1.20.0](https://github.com/feasibleone/blong/compare/blong-gogo-v1.19.1...blong-gogo-v1.20.0) (2026-05-11)
11
+
12
+
13
+ ### Features
14
+
15
+ * add runtime introspection endpoints for development troubleshooting ([#144](https://github.com/feasibleone/blong/issues/144)) ([81d665c](https://github.com/feasibleone/blong/commit/81d665c3d09bdd767ee78e824d4e529fed5f00d5))
16
+
3
17
  ## [1.19.1](https://github.com/feasibleone/blong/compare/blong-gogo-v1.19.0...blong-gogo-v1.19.1) (2026-05-09)
4
18
 
5
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feasibleone/blong-gogo",
3
- "version": "1.19.1",
3
+ "version": "1.21.0",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/feasibleone/blong.git"
6
6
  },
@@ -0,0 +1,118 @@
1
+ import type {IConfigRuntime, IGateway, ILog, IRegistry} from '@feasibleone/blong/types';
2
+ import {Internal} from '@feasibleone/blong/types';
3
+ import type {FastifyInstance} from 'fastify';
4
+ import fp from 'fastify-plugin';
5
+
6
+ interface IConfig {
7
+ enabled: boolean;
8
+ routePrefix: string;
9
+ auth: false | 'jwt';
10
+ }
11
+
12
+ interface IGatewayWithPlugins extends IGateway {
13
+ registerPlugin(plugin: unknown, options?: unknown): void;
14
+ }
15
+
16
+ interface IRpcServerWithInfo {
17
+ info(): object;
18
+ }
19
+
20
+ // The api object is captured by reference so that configRuntime — which is set
21
+ // on it after infra items are constructed (load.ts) — is visible at request time.
22
+ interface IApiRef {
23
+ log?: ILog;
24
+ gateway?: IGatewayWithPlugins;
25
+ registry?: IRegistry;
26
+ rpcServer?: IRpcServerWithInfo;
27
+ configRuntime?: IConfigRuntime;
28
+ }
29
+
30
+ export default class SystemDebug extends Internal {
31
+ #config: IConfig = {
32
+ enabled: false,
33
+ routePrefix: '/api/sys',
34
+ auth: false,
35
+ };
36
+
37
+ #apiRef: IApiRef;
38
+
39
+ public constructor(config: IConfig, apiRef: IApiRef) {
40
+ super({log: apiRef.log});
41
+ this.merge(this.#config, config);
42
+ this.#apiRef = apiRef;
43
+ }
44
+
45
+ public async init(): Promise<void> {
46
+ if (!this.#config.enabled || !this.#apiRef.gateway) return;
47
+
48
+ this.log?.warn?.(
49
+ 'systemDebug is enabled — introspection endpoints are active; do not enable in production',
50
+ );
51
+
52
+ const apiRef = this.#apiRef;
53
+ const prefix = this.#config.routePrefix;
54
+ const authConfig = this.#config.auth;
55
+
56
+ const plugin = fp(
57
+ async (server: FastifyInstance) => {
58
+ // GET /api/sys/config — effective runtime configuration snapshot
59
+ server.route({
60
+ method: 'GET',
61
+ url: `${prefix}/config`,
62
+ config: {auth: authConfig},
63
+ handler: async () => apiRef.configRuntime?.rawSnapshot ?? {},
64
+ });
65
+
66
+ // GET /api/sys/ports — registered adapter/orchestrator port definitions
67
+ server.route({
68
+ method: 'GET',
69
+ url: `${prefix}/ports`,
70
+ config: {auth: authConfig},
71
+ handler: async () => ({
72
+ ports: Array.from(apiRef.registry?.ports.keys() ?? []),
73
+ }),
74
+ });
75
+
76
+ // GET /api/sys/methods — registered handler method groups with handler counts
77
+ server.route({
78
+ method: 'GET',
79
+ url: `${prefix}/methods`,
80
+ config: {auth: authConfig},
81
+ handler: async () => ({
82
+ methods: Array.from(apiRef.registry?.methods.entries() ?? []).map(
83
+ ([name, handlers]) => ({
84
+ name,
85
+ handlerCount: handlers.length,
86
+ }),
87
+ ),
88
+ }),
89
+ });
90
+
91
+ // GET /api/sys/modules — registered realm modules.
92
+ // Symbol keys (used internally for system-tagged infrastructure items)
93
+ // are excluded because they are not JSON-serialisable.
94
+ server.route({
95
+ method: 'GET',
96
+ url: `${prefix}/modules`,
97
+ config: {auth: authConfig},
98
+ handler: async () => ({
99
+ modules: Array.from(apiRef.registry?.modules.keys() ?? []).filter(
100
+ (k): k is string => typeof k === 'string',
101
+ ),
102
+ }),
103
+ });
104
+
105
+ // GET /api/sys/rpc — internal RPC server address info
106
+ server.route({
107
+ method: 'GET',
108
+ url: `${prefix}/rpc`,
109
+ config: {auth: authConfig},
110
+ handler: async () => apiRef.rpcServer?.info() ?? {},
111
+ });
112
+ },
113
+ {name: 'system-debug'},
114
+ );
115
+
116
+ apiRef.gateway!.registerPlugin(plugin);
117
+ }
118
+ }
package/src/Watch.ts CHANGED
@@ -294,7 +294,10 @@ export default class Watch extends Internal implements IWatch {
294
294
  ? (await import(this.#config.enabled ? filename + '?' + Date.now() : filename))
295
295
  .default
296
296
  : ((await directory![filename]()) as {default: unknown}).default;
297
- if (!item) this.log?.error?.('Error loading ' + filename);
297
+ if (!item) {
298
+ this.log?.error?.('Error loading ' + filename);
299
+ continue;
300
+ }
298
301
  const expectedName = this.#platform.basename(
299
302
  filename,
300
303
  this.#platform.extname(filename),
package/src/load.ts CHANGED
@@ -375,6 +375,7 @@ export default async function loadRealm<T extends TSchema>(
375
375
  rpcServer: {},
376
376
  gateway: {},
377
377
  restFs: {},
378
+ systemDebug: {},
378
379
  });
379
380
  items = topoSort([
380
381
  {
@@ -464,6 +465,11 @@ export default async function loadRealm<T extends TSchema>(
464
465
  deps: ['log', 'gateway'],
465
466
  load: () => import('./RestFs.ts'),
466
467
  },
468
+ {
469
+ name: 'systemDebug',
470
+ deps: ['log', 'gateway', 'registry', 'rpcServer'],
471
+ load: () => import('./SystemDebug.ts'),
472
+ },
467
473
  {
468
474
  name: 'registry',
469
475
  deps: [