@feasibleone/blong-gogo 1.24.0 → 1.25.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.
- package/CHANGELOG.md +24 -0
- package/bin/{blong-dev.ts → blong-watch.ts} +1 -1
- package/package.json +9 -8
- package/src/AdapterBase.ts +7 -6
- package/src/ApiSchema.ts +4 -2
- package/src/ConfigRuntime.test.ts +44 -25
- package/src/ConfigRuntime.ts +1 -1
- package/src/ErrorFactory.ts +1 -1
- package/src/Gateway.ts +6 -7
- package/src/GatewayClient.ts +1 -3
- package/src/Local.ts +21 -7
- package/src/Log.ts +6 -6
- package/src/Port.ts +4 -4
- package/src/Realm.ts +1 -1
- package/src/Remote.ts +1 -1
- package/src/ResolutionLocal.ts +3 -3
- package/src/RestFs.test.ts +45 -16
- package/src/RpcClient.ts +3 -2
- package/src/RpcServer.ts +16 -8
- package/src/Watch.ts +1 -5
- package/src/adapter/browser/http.ts +2 -2
- package/src/adapter/schema/schemaCrudBind.ts +174 -0
- package/src/adapter/schema/schemaProcedureBind.ts +129 -0
- package/src/adapter/schema/schemaProcedureSync.ts +37 -0
- package/src/adapter/schema/schemaTableSync.ts +112 -0
- package/src/adapter/server/github.ts +69 -67
- package/src/adapter/server/http.ts +3 -2
- package/src/adapter/server/k8s.ts +78 -38
- package/src/adapter/server/keycloak.ts +16 -10
- package/src/adapter/server/knex.ts +6 -4
- package/src/adapter/server/mongodb.ts +27 -10
- package/src/adapter/server/s3.ts +48 -18
- package/src/adapter/server/slack.ts +6 -7
- package/src/adapter/server/vault.ts +59 -32
- package/src/adapter/server/webhook.ts +22 -11
- package/src/busGateway.ts +16 -14
- package/src/chain.ts +1 -1
- package/src/codec/adapter/mle/ready.ts +2 -2
- package/src/codec/adapter/openapi/request.ts +1 -1
- package/src/codec/test/test/testLoginTokenCreate.ts +1 -1
- package/src/error.proxy.test.ts +7 -6
- package/src/globals.d.ts +2 -1
- package/src/handler.name.test.ts +12 -12
- package/src/jose.test.ts +1 -1
- package/src/jose.ts +7 -4
- package/src/jwt.ts +2 -4
- package/src/layerProxy.ts +2 -2
- package/src/load.ts +4 -3
- package/src/loadApi.ts +1 -1
- package/src/loadBrowser.ts +1 -0
- package/src/loadServer.ts +1 -0
- package/src/loop.ts +3 -3
- package/src/runServer.ts +6 -1
- package/src/tls.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.25.1](https://github.com/feasibleone/blong/compare/blong-gogo-v1.25.0...blong-gogo-v1.25.1) (2026-05-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* dependencies ([cc6ba83](https://github.com/feasibleone/blong/commit/cc6ba830a721dfb063f5331d44e26a97e28c7f9a))
|
|
9
|
+
* improve testing ([2b1d862](https://github.com/feasibleone/blong/commit/2b1d862fda71ed7910bc99f4bbbe11ef17be098c))
|
|
10
|
+
|
|
11
|
+
## [1.25.0](https://github.com/feasibleone/blong/compare/blong-gogo-v1.24.0...blong-gogo-v1.25.0) (2026-05-19)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* blong-dev ([8eb1aa4](https://github.com/feasibleone/blong/commit/8eb1aa4a8acb6a3dcdd52fb51582e0403efa4064))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* lint ([9fa11d1](https://github.com/feasibleone/blong/commit/9fa11d15495a801b63668cb0c8399bae5e9fd6e1))
|
|
22
|
+
* lint ([8cde9a7](https://github.com/feasibleone/blong/commit/8cde9a7b9d54d4556bf33b4f8f61d5c5597ca108))
|
|
23
|
+
* linting ([73ea70a](https://github.com/feasibleone/blong/commit/73ea70a36de49b9c5b0f15d945f52c0eee4cc98f))
|
|
24
|
+
* linting ([27102ca](https://github.com/feasibleone/blong/commit/27102ca91ddf21124439452486a086aa68fc8886))
|
|
25
|
+
* linting ([46d7549](https://github.com/feasibleone/blong/commit/46d7549477c6b863e09972e8c6903a38b5836a8e))
|
|
26
|
+
|
|
3
27
|
## [1.24.0](https://github.com/feasibleone/blong/compare/blong-gogo-v1.23.0...blong-gogo-v1.24.0) (2026-05-15)
|
|
4
28
|
|
|
5
29
|
|
|
@@ -9,7 +9,7 @@ const argv: {_: string[]} = minimist(process.argv.slice(2));
|
|
|
9
9
|
|
|
10
10
|
// The first positional arg is an optional file/folder target; the rest are intents.
|
|
11
11
|
const [maybeTarget, ...rest] = argv._;
|
|
12
|
-
const target = maybeTarget && existsSync(resolve(maybeTarget)) ? maybeTarget : undefined;
|
|
12
|
+
const target = maybeTarget && existsSync(resolve(maybeTarget)) ? resolve(maybeTarget) : undefined;
|
|
13
13
|
const intents = target ? rest : argv._;
|
|
14
14
|
|
|
15
15
|
await autoRun({cwd: process.cwd(), target, intents});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feasibleone/blong-gogo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/feasibleone/blong.git"
|
|
6
6
|
},
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"bin": {
|
|
16
16
|
"blong": "./bin/blong.ts",
|
|
17
|
-
"blong-
|
|
18
|
-
"blong-
|
|
17
|
+
"blong-gogo": "./bin/blong-gogo.sh",
|
|
18
|
+
"blong-watch": "./bin/blong-watch.ts"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@apidevtools/swagger-parser": "^12.1.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@feasibleone/blong-chain": "^1.0.0",
|
|
31
31
|
"@feasibleone/blong-config": "^1.0.0",
|
|
32
32
|
"@feasibleone/blong-kopi": "^1.0.0",
|
|
33
|
-
"@keycloak/keycloak-admin-client": "^26.
|
|
33
|
+
"@keycloak/keycloak-admin-client": "^26.6.2",
|
|
34
34
|
"@kubernetes/client-node": "^1.4.0",
|
|
35
35
|
"@octokit/rest": "^22.0.1",
|
|
36
36
|
"@sinclair/typebox-codegen": "^0.11.1",
|
|
@@ -77,14 +77,15 @@
|
|
|
77
77
|
"@types/node": "^24",
|
|
78
78
|
"playwright": "^1.58.2",
|
|
79
79
|
"tap": "^21.6.3",
|
|
80
|
-
"typescript": "^
|
|
80
|
+
"typescript": "^6.0.3",
|
|
81
|
+
"@feasibleone/blong-dev": "1.0.2"
|
|
81
82
|
},
|
|
82
83
|
"scripts": {
|
|
83
84
|
"browser-check": "node scripts/browser-compat-check.mjs",
|
|
84
85
|
"build": "true",
|
|
85
|
-
"ci-
|
|
86
|
+
"ci-coverage": "./run-coverage.sh",
|
|
87
|
+
"ci-lint": "blong-dev lint",
|
|
86
88
|
"ci-publish": "node ../../common/scripts/install-run-rush-pnpm.js publish --access public --provenance",
|
|
87
|
-
"ci-
|
|
88
|
-
"ci-coverage": "../common/run-coverage.sh report"
|
|
89
|
+
"ci-test": "blong-dev test"
|
|
89
90
|
}
|
|
90
91
|
}
|
package/src/AdapterBase.ts
CHANGED
|
@@ -177,13 +177,14 @@ export class AdapterBase<T, C extends IContext> implements AdapterHandlerContext
|
|
|
177
177
|
);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
error(error: ITypedError, $meta: IMeta):
|
|
180
|
+
error(error: ITypedError, $meta: IMeta): ITypedError {
|
|
181
181
|
if ($meta) error.method = $meta.method;
|
|
182
182
|
if (isExpectedError(error.type, $meta?.expect)) {
|
|
183
183
|
(this.log as {debug?: (...args: unknown[]) => void})?.debug?.(error);
|
|
184
|
-
return;
|
|
184
|
+
return error;
|
|
185
185
|
}
|
|
186
186
|
(this.log as {error?: (...args: unknown[]) => void})?.error?.(error);
|
|
187
|
+
return error;
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
findValidation(): unknown {
|
|
@@ -271,7 +272,7 @@ export class AdapterBase<T, C extends IContext> implements AdapterHandlerContext
|
|
|
271
272
|
return result;
|
|
272
273
|
}
|
|
273
274
|
|
|
274
|
-
drain(): void {}
|
|
275
|
+
async drain(): Promise<void> {}
|
|
275
276
|
|
|
276
277
|
findHandler(methodName: string): unknown {
|
|
277
278
|
methodName = this._methodId(methodName);
|
|
@@ -303,8 +304,8 @@ export class AdapterBase<T, C extends IContext> implements AdapterHandlerContext
|
|
|
303
304
|
const {req, pub} = this.forNamespaces(
|
|
304
305
|
(
|
|
305
306
|
prev: {
|
|
306
|
-
req: Record<string, (...args: unknown[]) => unknown
|
|
307
|
-
pub: Record<string, (...args: unknown[]) => unknown
|
|
307
|
+
req: Record<string, (...args: unknown[]) => Promise<unknown>>;
|
|
308
|
+
pub: Record<string, (...args: unknown[]) => Promise<unknown>>;
|
|
308
309
|
},
|
|
309
310
|
next,
|
|
310
311
|
) => {
|
|
@@ -318,7 +319,7 @@ export class AdapterBase<T, C extends IContext> implements AdapterHandlerContext
|
|
|
318
319
|
);
|
|
319
320
|
this._register(req, 'ports', this.config.id, this.config.pkg);
|
|
320
321
|
this._subscribe(pub, 'ports', this.config.id, this.config.pkg);
|
|
321
|
-
const {context, ...config} = this.config;
|
|
322
|
+
const {context: _, ...config} = this.config;
|
|
322
323
|
return this.event('start', {configBase: this.configBase, config});
|
|
323
324
|
}
|
|
324
325
|
|
package/src/ApiSchema.ts
CHANGED
|
@@ -256,7 +256,7 @@ export default handler(
|
|
|
256
256
|
.join('\n');
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
private _paramType(param:
|
|
259
|
+
private _paramType(param: object): string {
|
|
260
260
|
if (!('type' in param)) return 'unknown';
|
|
261
261
|
switch (param.type) {
|
|
262
262
|
case 'string':
|
|
@@ -294,7 +294,9 @@ export default handler(
|
|
|
294
294
|
public async generateFile(filename: string): Promise<boolean> {
|
|
295
295
|
if (this.#config.generate === false) return false;
|
|
296
296
|
if (this.#platform.statSync(filename).size !== 0) return false;
|
|
297
|
-
|
|
297
|
+
const content = this.#platform
|
|
298
|
+
.readFileSync(filename, {encoding: 'utf-8'})
|
|
299
|
+
.toString('utf-8');
|
|
298
300
|
if (content.includes('import unchanged from')) {
|
|
299
301
|
this.#generateFile.add(filename);
|
|
300
302
|
return false;
|
|
@@ -92,32 +92,34 @@ test('deepDiff — deeply nested multi-change', async t => {
|
|
|
92
92
|
|
|
93
93
|
test('createConfigProxy — reads current values', async t => {
|
|
94
94
|
const store = {db: {host: 'localhost', port: 5432}};
|
|
95
|
-
const {proxy} = createConfigProxy(store);
|
|
96
|
-
t.equal(
|
|
97
|
-
t.equal(
|
|
95
|
+
const {proxy}: {proxy: typeof store} = createConfigProxy(store);
|
|
96
|
+
t.equal(proxy.db.host, 'localhost');
|
|
97
|
+
t.equal(proxy.db.port, 5432);
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
test('createConfigProxy — reflects updated values after update()', async t => {
|
|
101
101
|
const store = {db: {host: 'localhost'}};
|
|
102
|
-
const {proxy, update}
|
|
102
|
+
const {proxy, update}: {proxy: typeof store; update: (newStore: typeof store) => void} =
|
|
103
|
+
createConfigProxy(store);
|
|
103
104
|
|
|
104
|
-
t.equal(
|
|
105
|
+
t.equal(proxy.db.host, 'localhost');
|
|
105
106
|
|
|
106
|
-
update({db: {host: '10.0.0.1'}}
|
|
107
|
+
update({db: {host: '10.0.0.1'}});
|
|
107
108
|
|
|
108
|
-
t.equal(
|
|
109
|
+
t.equal(proxy.db.host, '10.0.0.1', 'proxy reflects updated value');
|
|
109
110
|
});
|
|
110
111
|
|
|
111
112
|
test('createConfigProxy — proxy reference remains stable across updates', async t => {
|
|
112
113
|
const store = {a: 1};
|
|
113
|
-
const {proxy, update}
|
|
114
|
+
const {proxy, update}: {proxy: typeof store; update: (newStore: typeof store) => void} =
|
|
115
|
+
createConfigProxy(store);
|
|
114
116
|
|
|
115
117
|
const ref1 = proxy;
|
|
116
|
-
update({a: 2}
|
|
118
|
+
update({a: 2});
|
|
117
119
|
const ref2 = proxy;
|
|
118
120
|
|
|
119
121
|
t.equal(ref1, ref2, 'same proxy reference after update');
|
|
120
|
-
t.equal(
|
|
122
|
+
t.equal(ref1.a, 2, 'old reference reflects new value');
|
|
121
123
|
});
|
|
122
124
|
|
|
123
125
|
test('createConfigProxy — has/ownKeys/enumeration work correctly', async t => {
|
|
@@ -135,8 +137,8 @@ test('createConfigProxy — has/ownKeys/enumeration work correctly', async t =>
|
|
|
135
137
|
|
|
136
138
|
test('createConfigProxy — undefined properties return undefined', async t => {
|
|
137
139
|
const store = {a: 1};
|
|
138
|
-
const {proxy} = createConfigProxy(store);
|
|
139
|
-
t.equal(
|
|
140
|
+
const {proxy}: {proxy: {a: number; nonExistent?: unknown}} = createConfigProxy(store);
|
|
141
|
+
t.equal(proxy.nonExistent, undefined);
|
|
140
142
|
});
|
|
141
143
|
|
|
142
144
|
// ---------------------------------------------------------------------------
|
|
@@ -162,7 +164,13 @@ test('createConfigProxy — undefined properties return undefined', async t => {
|
|
|
162
164
|
|
|
163
165
|
test('partial destructuring — theme sub-object is a live proxy node that reflects current values after update', async t => {
|
|
164
166
|
const initialStore = {theme: {name: 'light', mode: 'day'}};
|
|
165
|
-
const {
|
|
167
|
+
const {
|
|
168
|
+
proxy,
|
|
169
|
+
update,
|
|
170
|
+
}: {
|
|
171
|
+
proxy: {theme: {name: string; mode: string}};
|
|
172
|
+
update: (newStore: typeof initialStore) => void;
|
|
173
|
+
} = createConfigProxy(initialStore);
|
|
166
174
|
|
|
167
175
|
// Simulate factory-time partial destructuring: extract the `theme` sub-object
|
|
168
176
|
// (as would happen in `handler(({ config: { theme } }) => ...)`)
|
|
@@ -179,12 +187,16 @@ test('partial destructuring — theme sub-object is a live proxy node that refle
|
|
|
179
187
|
// root `current` cell, so it reflects the new values after update() ---
|
|
180
188
|
t.equal(theme.name, 'dark', 'sub-proxy theme.name reflects update via path traversal');
|
|
181
189
|
t.equal(theme.mode, 'night', 'sub-proxy theme.mode reflects update via path traversal');
|
|
182
|
-
t.equal(
|
|
190
|
+
t.equal(proxy.theme.name, 'dark', 'root proxy.theme.name also reflects update');
|
|
183
191
|
});
|
|
184
192
|
|
|
185
193
|
test('full destructuring — scalar captured at factory time does NOT reflect later updates', async t => {
|
|
186
194
|
const initialStore = {theme: {name: 'light'}};
|
|
187
|
-
const {
|
|
195
|
+
const {
|
|
196
|
+
proxy,
|
|
197
|
+
update,
|
|
198
|
+
}: {proxy: {theme: {name: string}}; update: (newStore: typeof initialStore) => void} =
|
|
199
|
+
createConfigProxy(initialStore);
|
|
188
200
|
|
|
189
201
|
// Simulate the UNSAFE pattern: extract a leaf primitive at factory time
|
|
190
202
|
// (as would happen in `handler(({ config: { theme: { name } } }) => ...)`)
|
|
@@ -201,7 +213,7 @@ test('full destructuring — scalar captured at factory time does NOT reflect la
|
|
|
201
213
|
t.equal(capturedName, 'light', 'captured scalar is stale after config update');
|
|
202
214
|
|
|
203
215
|
// Root proxy reflects the new value
|
|
204
|
-
t.equal(
|
|
216
|
+
t.equal(proxy.theme.name, 'dark', 'root proxy reflects updated value');
|
|
205
217
|
|
|
206
218
|
// This proves: NEVER destructure leaf primitives at handler factory time.
|
|
207
219
|
t.not(
|
|
@@ -233,12 +245,19 @@ test('root proxy access — always reflects current values regardless of nesting
|
|
|
233
245
|
// ---------------------------------------------------------------------------
|
|
234
246
|
|
|
235
247
|
test('factory phase guard — throws on primitive read in default throw mode', async t => {
|
|
236
|
-
const {
|
|
237
|
-
|
|
248
|
+
const {
|
|
249
|
+
proxy,
|
|
250
|
+
enterConfig,
|
|
251
|
+
exitConfig,
|
|
252
|
+
}: {
|
|
253
|
+
proxy: {host: string; port: number};
|
|
254
|
+
enterConfig: (mode?: 'throw' | 'collect') => void;
|
|
255
|
+
exitConfig: () => Error[];
|
|
256
|
+
} = createConfigProxy({host: 'localhost', port: 5432});
|
|
238
257
|
|
|
239
258
|
enterConfig(); // default mode = 'throw'
|
|
240
259
|
t.throws(
|
|
241
|
-
() =>
|
|
260
|
+
() => proxy.host,
|
|
242
261
|
/anti-pattern/,
|
|
243
262
|
'reading a primitive during factory phase throws by default',
|
|
244
263
|
);
|
|
@@ -247,7 +266,7 @@ test('factory phase guard — throws on primitive read in default throw mode', a
|
|
|
247
266
|
|
|
248
267
|
test('factory phase guard — collects errors in collect mode without throwing', async t => {
|
|
249
268
|
const {proxy, enterConfig, exitConfig} = createConfigProxy({host: 'localhost', port: 5432});
|
|
250
|
-
const p = proxy as
|
|
269
|
+
const p = proxy as {host: string; port: number};
|
|
251
270
|
|
|
252
271
|
enterConfig('collect');
|
|
253
272
|
t.doesNotThrow(() => p.host, 'no throw in collect mode');
|
|
@@ -261,7 +280,7 @@ test('factory phase guard — collects errors in collect mode without throwing',
|
|
|
261
280
|
|
|
262
281
|
test('factory phase guard — sub-object read is NOT flagged (safe partial destructuring)', async t => {
|
|
263
282
|
const {proxy, enterConfig, exitConfig} = createConfigProxy({theme: {name: 'light'}});
|
|
264
|
-
const p = proxy as
|
|
283
|
+
const p = proxy as {theme: {name: string}};
|
|
265
284
|
|
|
266
285
|
enterConfig(); // throw mode
|
|
267
286
|
t.doesNotThrow(
|
|
@@ -273,7 +292,7 @@ test('factory phase guard — sub-object read is NOT flagged (safe partial destr
|
|
|
273
292
|
|
|
274
293
|
test('factory phase guard — undefined read is NOT flagged', async t => {
|
|
275
294
|
const {proxy, enterConfig, exitConfig} = createConfigProxy({a: 1});
|
|
276
|
-
const p = proxy as
|
|
295
|
+
const p = proxy as {a: number; nonExistent?: unknown};
|
|
277
296
|
|
|
278
297
|
enterConfig();
|
|
279
298
|
t.doesNotThrow(
|
|
@@ -285,7 +304,7 @@ test('factory phase guard — undefined read is NOT flagged', async t => {
|
|
|
285
304
|
|
|
286
305
|
test('factory phase guard — guard is inactive after exitConfigFactoryPhase', async t => {
|
|
287
306
|
const {proxy, enterConfig, exitConfig} = createConfigProxy({host: 'localhost'});
|
|
288
|
-
const p = proxy as
|
|
307
|
+
const p = proxy as {host: string};
|
|
289
308
|
|
|
290
309
|
enterConfig();
|
|
291
310
|
exitConfig(); // exit immediately
|
|
@@ -295,11 +314,11 @@ test('factory phase guard — guard is inactive after exitConfigFactoryPhase', a
|
|
|
295
314
|
|
|
296
315
|
test('factory phase guard — exitConfigFactoryPhase returns empty array in throw mode', async t => {
|
|
297
316
|
const {proxy, enterConfig, exitConfig} = createConfigProxy({host: 'localhost'});
|
|
298
|
-
const p = proxy as
|
|
317
|
+
const p = proxy as {host: string};
|
|
299
318
|
|
|
300
319
|
enterConfig(); // throw mode — errors are not collected
|
|
301
320
|
try {
|
|
302
|
-
p.host; // would throw
|
|
321
|
+
void p.host; // would throw
|
|
303
322
|
} catch (_) {
|
|
304
323
|
// expected
|
|
305
324
|
}
|
package/src/ConfigRuntime.ts
CHANGED
|
@@ -329,7 +329,7 @@ export default class ConfigRuntime implements IConfigRuntime {
|
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
/**
|
|
332
|
-
* Register a subscriber. Returns an unsubscribe function for clean
|
|
332
|
+
* Register a subscriber. Returns an unsubscribe function for clean tear-down.
|
|
333
333
|
*/
|
|
334
334
|
public subscribe(fn: ConfigSubscriber): () => void {
|
|
335
335
|
this.#subscribers.add(fn);
|
package/src/ErrorFactory.ts
CHANGED
package/src/Gateway.ts
CHANGED
|
@@ -47,7 +47,6 @@ const errorMap: IErrorMap = {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
declare module 'fastify' {
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
51
50
|
interface FastifyContextConfig {
|
|
52
51
|
auth: unknown;
|
|
53
52
|
mle?: unknown;
|
|
@@ -105,7 +104,7 @@ function operationParams(
|
|
|
105
104
|
Object.assign(result, request.body);
|
|
106
105
|
else if (parameter.schema?.properties)
|
|
107
106
|
Object.entries(parameter.schema.properties).forEach(
|
|
108
|
-
([name
|
|
107
|
+
([name]) => {
|
|
109
108
|
if (name in (request.body as Record<string, unknown>))
|
|
110
109
|
result[snakeToCamel(name)] = (
|
|
111
110
|
request.body as Record<string, unknown>
|
|
@@ -132,7 +131,7 @@ function operationParams(
|
|
|
132
131
|
if ('additionalProperties' in bodySchema && bodySchema.additionalProperties)
|
|
133
132
|
Object.assign(result, request.body);
|
|
134
133
|
else if (bodySchema.properties)
|
|
135
|
-
Object.entries(bodySchema.properties).forEach(([name
|
|
134
|
+
Object.entries(bodySchema.properties).forEach(([name]) => {
|
|
136
135
|
if (name in (request.body as Record<string, unknown>))
|
|
137
136
|
result[snakeToCamel(name)] = (request.body as Record<string, unknown>)[name];
|
|
138
137
|
});
|
|
@@ -351,7 +350,6 @@ export default class Gateway extends Internal implements IGateway {
|
|
|
351
350
|
}),
|
|
352
351
|
}
|
|
353
352
|
: undefined),
|
|
354
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
355
353
|
...('response' in value && value.response
|
|
356
354
|
? {response: {'2xx': value.response}}
|
|
357
355
|
: 'result' in value
|
|
@@ -391,7 +389,6 @@ export default class Gateway extends Internal implements IGateway {
|
|
|
391
389
|
},
|
|
392
390
|
}
|
|
393
391
|
: undefined),
|
|
394
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
395
392
|
security: [
|
|
396
393
|
value.auth === false
|
|
397
394
|
? {}
|
|
@@ -473,7 +470,7 @@ export default class Gateway extends Internal implements IGateway {
|
|
|
473
470
|
} else if (id == null) {
|
|
474
471
|
const pub = this.#local.get(pubName);
|
|
475
472
|
if (!pub) return notfound();
|
|
476
|
-
pub.method(params, meta).catch(
|
|
473
|
+
pub.method(params, meta).catch(() => {});
|
|
477
474
|
return {
|
|
478
475
|
jsonrpc: '2.0',
|
|
479
476
|
result: true,
|
|
@@ -500,7 +497,9 @@ export default class Gateway extends Internal implements IGateway {
|
|
|
500
497
|
httpResponse?: unknown;
|
|
501
498
|
[key: string]: unknown;
|
|
502
499
|
};
|
|
503
|
-
if (
|
|
500
|
+
if (
|
|
501
|
+
isExpectedError(typedError.type as string | undefined, resolvedExpect)
|
|
502
|
+
) {
|
|
504
503
|
request.log.debug(
|
|
505
504
|
{err: error, method: methodName},
|
|
506
505
|
'gateway expected error',
|
package/src/GatewayClient.ts
CHANGED
|
@@ -58,9 +58,7 @@ export default class GatewayClientImpl extends Remote implements IGatewayClient
|
|
|
58
58
|
|
|
59
59
|
public gateway(..._args: unknown[]): void {}
|
|
60
60
|
|
|
61
|
-
protected sender(
|
|
62
|
-
methodType: 'request' | 'publish',
|
|
63
|
-
): (...params: unknown[]) => Promise<unknown> {
|
|
61
|
+
protected sender(): (...params: unknown[]) => Promise<unknown> {
|
|
64
62
|
return async (...rest) => {
|
|
65
63
|
const {stream, ...$meta} = rest.pop() as IMeta;
|
|
66
64
|
const params = rest;
|
package/src/Local.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import {type ILocal, Internal} from '@feasibleone/blong/types';
|
|
2
2
|
|
|
3
3
|
export default class Local extends Internal implements ILocal {
|
|
4
|
-
#mapLocal: Record<string, {method: unknown}> = {};
|
|
4
|
+
#mapLocal: Record<string, {method: (...params: unknown[]) => Promise<unknown[]>}> = {};
|
|
5
5
|
|
|
6
|
-
private _localRegister(
|
|
6
|
+
private _localRegister(
|
|
7
|
+
namespace: string,
|
|
8
|
+
name: string,
|
|
9
|
+
method: (...params: unknown[]) => Promise<unknown[]>,
|
|
10
|
+
): void {
|
|
7
11
|
const local = this.#mapLocal[namespace + '.' + name];
|
|
8
12
|
if (local) {
|
|
9
13
|
local.method = method;
|
|
@@ -13,21 +17,31 @@ export default class Local extends Internal implements ILocal {
|
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
public register(
|
|
16
|
-
methods:
|
|
20
|
+
methods:
|
|
21
|
+
| Record<string, (...params: unknown[]) => Promise<unknown>>
|
|
22
|
+
| Array<(...params: unknown[]) => Promise<unknown>>,
|
|
17
23
|
namespace: string,
|
|
18
|
-
reply: boolean,
|
|
19
|
-
pkg: {version: string},
|
|
24
|
+
// reply: boolean,
|
|
25
|
+
// pkg: {version: string},
|
|
20
26
|
): void {
|
|
21
27
|
if (methods instanceof Array) {
|
|
22
28
|
methods.forEach(fn => {
|
|
23
29
|
if (fn instanceof Function && fn.name) {
|
|
24
|
-
this._localRegister(
|
|
30
|
+
this._localRegister(
|
|
31
|
+
namespace,
|
|
32
|
+
fn.name,
|
|
33
|
+
fn as (...params: unknown[]) => Promise<unknown[]>,
|
|
34
|
+
);
|
|
25
35
|
}
|
|
26
36
|
});
|
|
27
37
|
} else {
|
|
28
38
|
Object.keys(methods).forEach(key => {
|
|
29
39
|
if ((methods as Record<string, unknown>)[key] instanceof Function) {
|
|
30
|
-
this._localRegister(
|
|
40
|
+
this._localRegister(
|
|
41
|
+
namespace,
|
|
42
|
+
key,
|
|
43
|
+
methods[key].bind(methods) as (...params: unknown[]) => Promise<unknown[]>,
|
|
44
|
+
);
|
|
31
45
|
}
|
|
32
46
|
});
|
|
33
47
|
}
|
package/src/Log.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Internal, type ILog, type ILogger} from '@feasibleone/blong/types';
|
|
2
|
-
import {pino, type
|
|
2
|
+
import {pino, type LogFn, type Logger, type LoggerOptions} from 'pino';
|
|
3
3
|
import {monotonicFactory} from 'ulidx';
|
|
4
4
|
import type {CacacheTransportOptions} from './pino-cacache.js';
|
|
5
5
|
|
|
@@ -110,15 +110,15 @@ export default class Log extends Internal implements ILog {
|
|
|
110
110
|
switch (level) {
|
|
111
111
|
case 'trace':
|
|
112
112
|
result.trace = child.trace.bind(child);
|
|
113
|
-
case 'debug':
|
|
113
|
+
case 'debug':
|
|
114
114
|
result.debug = child.debug.bind(child);
|
|
115
|
-
case 'info':
|
|
115
|
+
case 'info':
|
|
116
116
|
result.info = child.info.bind(child);
|
|
117
|
-
case 'warn':
|
|
117
|
+
case 'warn':
|
|
118
118
|
result.warn = child.warn.bind(child);
|
|
119
|
-
case 'error':
|
|
119
|
+
case 'error':
|
|
120
120
|
result.error = child.error.bind(child);
|
|
121
|
-
case 'fatal':
|
|
121
|
+
case 'fatal':
|
|
122
122
|
result.fatal = child.fatal.bind(child);
|
|
123
123
|
}
|
|
124
124
|
return result as unknown as ILogger;
|
package/src/Port.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {Internal, type IAdapterFactory} from '@feasibleone/blong/types';
|
|
2
2
|
// import {Port as UtPort} from 'ut-port';
|
|
3
3
|
|
|
4
|
-
const UtPort = (
|
|
4
|
+
const UtPort = () =>
|
|
5
5
|
class Port extends Internal {
|
|
6
|
-
findHandler(
|
|
6
|
+
findHandler(_: string): unknown {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
9
|
};
|
|
@@ -13,9 +13,9 @@ export interface IPort {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export default class Port extends Internal {
|
|
16
|
-
public constructor(
|
|
16
|
+
public constructor() {
|
|
17
17
|
super();
|
|
18
|
-
const result = UtPort(
|
|
18
|
+
const result = UtPort();
|
|
19
19
|
const findHandler = result.prototype.findHandler;
|
|
20
20
|
result.prototype.findHandler = function (name: string) {
|
|
21
21
|
return findHandler.call(this, name.replaceAll('.', '').toLowerCase());
|
package/src/Realm.ts
CHANGED
package/src/Remote.ts
CHANGED
|
@@ -142,7 +142,7 @@ export default class Remote extends Internal implements IRemote {
|
|
|
142
142
|
if ($meta && $meta.timeout && $meta.retry) {
|
|
143
143
|
return startRetry(
|
|
144
144
|
() => method(...params),
|
|
145
|
-
$meta as {timeout?: number; retry?: number},
|
|
145
|
+
$meta as unknown as {timeout?: number; retry?: number},
|
|
146
146
|
);
|
|
147
147
|
} else {
|
|
148
148
|
return method(...params);
|
package/src/ResolutionLocal.ts
CHANGED
|
@@ -21,8 +21,8 @@ export default class ResolutionLocal extends Internal implements IResolution {
|
|
|
21
21
|
|
|
22
22
|
public async resolve(
|
|
23
23
|
service: string,
|
|
24
|
-
invalidate: boolean,
|
|
25
|
-
namespace: string,
|
|
24
|
+
// invalidate: boolean,
|
|
25
|
+
// namespace: string,
|
|
26
26
|
): ReturnType<IResolution['resolve']> {
|
|
27
27
|
return {
|
|
28
28
|
// hostname: `${service}-service.${this.#config.domain}`,
|
|
@@ -33,7 +33,7 @@ export default class ResolutionLocal extends Internal implements IResolution {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
public announce(
|
|
36
|
+
public announce(): void {}
|
|
37
37
|
|
|
38
38
|
public async start(): Promise<void> {}
|
|
39
39
|
|