@feasibleone/blong 1.22.0 → 1.24.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 +34 -0
- package/package.json +3 -3
- package/types.ts +194 -35
- package/dist/knex.js +0 -7
- package/dist/knex.js.map +0 -1
- package/dist/model.js +0 -2
- package/dist/model.js.map +0 -1
- package/dist/types.d.ts +0 -20102
- package/dist/types.js +0 -67
- package/dist/types.js.map +0 -1
- package/dist/widget.js +0 -2
- package/dist/widget.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.24.0](https://github.com/feasibleone/blong/compare/blong-v1.23.0...blong-v1.24.0) (2026-08-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* master-detail handling ([03c5bbd](https://github.com/feasibleone/blong/commit/03c5bbd9401a82a9427577e7611f2622aadee4e5))
|
|
9
|
+
* redis adapter and blong-gateway ([c28a68f](https://github.com/feasibleone/blong/commit/c28a68f5f9cfc2398771cca05c4366efc147eb6e))
|
|
10
|
+
* resolve some AI agent frictions ([13ca27f](https://github.com/feasibleone/blong/commit/13ca27f09f0271a25ea7ad45a2ce3f73bf6710e0))
|
|
11
|
+
* resolve some AI agent frictions and improve the framework features ([23b6986](https://github.com/feasibleone/blong/commit/23b69863b458e97f1dad249fcdeec5e182a69b74))
|
|
12
|
+
|
|
13
|
+
## [1.23.0](https://github.com/feasibleone/blong/compare/blong-v1.22.0...blong-v1.23.0) (2026-07-14)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* blong-mock, blong-server ([756caca](https://github.com/feasibleone/blong/commit/756cacab712db6792bf1b93830fc1d833b396f8d))
|
|
19
|
+
* check access credentials ([e6af405](https://github.com/feasibleone/blong/commit/e6af405c43921cb9c553db9c4986b7fe56154724))
|
|
20
|
+
* core.resource merging ([371d3e2](https://github.com/feasibleone/blong/commit/371d3e2b3f519dfd59ca4fd480bc33317992afcd))
|
|
21
|
+
* implement subjectObjectSchema ([8ca3282](https://github.com/feasibleone/blong/commit/8ca32829277b9816eb5e43ce708d2f1d0cc3ef28))
|
|
22
|
+
* manifest concept ([ed3c038](https://github.com/feasibleone/blong/commit/ed3c038352644d2d8f828b3cb69cbea718e7084b))
|
|
23
|
+
* object schema ([688d5d2](https://github.com/feasibleone/blong/commit/688d5d2a4a895c8feba7b898da03c46b3a3f3292))
|
|
24
|
+
* schema helpers and constraints ([8409257](https://github.com/feasibleone/blong/commit/84092571f6b327c1166ef142f70cb7d91b013eaf))
|
|
25
|
+
* seed ([5c76603](https://github.com/feasibleone/blong/commit/5c7660392bc1197638810e864bfd47ce1218b2e5))
|
|
26
|
+
* support expressions in the configuration ([843bb58](https://github.com/feasibleone/blong/commit/843bb58c97456d85eac573874c90755bdb68bc95))
|
|
27
|
+
* useBlong ([affdd67](https://github.com/feasibleone/blong/commit/affdd676db3338266d60155604e3bc9024078b5e))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* build ([de22713](https://github.com/feasibleone/blong/commit/de2271393350945b8d793ca0ec89670465bba085))
|
|
33
|
+
* core.resource merging ([f191055](https://github.com/feasibleone/blong/commit/f1910558ce0f369f556911c4c0f6397b8003fd33))
|
|
34
|
+
* full stack alignment for CRUD ([8795e08](https://github.com/feasibleone/blong/commit/8795e087182402ac28c3ea03c6bee27319069625))
|
|
35
|
+
* Playwright, Storybook and realm DRY ([4302512](https://github.com/feasibleone/blong/commit/43025123e613ef43e0ac5b83ab00fbc0cabfccf2))
|
|
36
|
+
|
|
3
37
|
## [1.22.0](https://github.com/feasibleone/blong/compare/blong-v1.21.0...blong-v1.22.0) (2026-05-25)
|
|
4
38
|
|
|
5
39
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feasibleone/blong",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "API and DRY focused RAD framework https://feasibleone.github.io/blong-docs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"blong",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"bson": "^7.2.0",
|
|
41
41
|
"chokidar": "^5.0.0",
|
|
42
42
|
"dts-bundle-generator": "^9.5.1",
|
|
43
|
-
"knex": "^3.
|
|
43
|
+
"knex": "^3.2.10",
|
|
44
44
|
"mongodb": "^7.1.0",
|
|
45
45
|
"node-vault": "^0.10.10",
|
|
46
46
|
"openapi-types": "^12.1.3",
|
|
47
47
|
"react": "^19.1.0",
|
|
48
48
|
"tarn": "^3.0.2",
|
|
49
49
|
"typescript": "^6.0.3",
|
|
50
|
-
"@feasibleone/blong-dev": "1.0
|
|
50
|
+
"@feasibleone/blong-dev": "1.2.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "heft build --clean;dts-bundle-generator --config dts-gen.config.json",
|
package/types.ts
CHANGED
|
@@ -19,9 +19,12 @@ import {
|
|
|
19
19
|
type TIntersect,
|
|
20
20
|
type TNever,
|
|
21
21
|
type TNumber,
|
|
22
|
+
type TNumberOptions,
|
|
22
23
|
type TObject,
|
|
23
24
|
type TSchema,
|
|
25
|
+
type TSchemaOptions,
|
|
24
26
|
type TString,
|
|
27
|
+
type TStringOptions,
|
|
25
28
|
type TUnknown,
|
|
26
29
|
} from 'typebox';
|
|
27
30
|
// import type {client} from 'node-vault';
|
|
@@ -65,6 +68,12 @@ export type ServerContext = {
|
|
|
65
68
|
// s3?: S3Client;
|
|
66
69
|
slack?: IncomingWebhook;
|
|
67
70
|
// vault?: client;
|
|
71
|
+
/** Live redis client shared with derived adapters. */
|
|
72
|
+
redis?: {
|
|
73
|
+
status: string;
|
|
74
|
+
connect(): Promise<unknown>;
|
|
75
|
+
quit(): Promise<unknown>;
|
|
76
|
+
};
|
|
68
77
|
};
|
|
69
78
|
|
|
70
79
|
export type BrowserContext = {
|
|
@@ -132,11 +141,38 @@ export interface IWatcher extends EventEmitter<FSWatcherEventMap> {
|
|
|
132
141
|
|
|
133
142
|
export type HRTime = [number, number];
|
|
134
143
|
|
|
144
|
+
type BaseConfig = {
|
|
145
|
+
name: string;
|
|
146
|
+
pkg: {name: string; version: string};
|
|
147
|
+
children: unknown[];
|
|
148
|
+
url: string;
|
|
149
|
+
base: string;
|
|
150
|
+
server: {
|
|
151
|
+
load: {logLevel: Parameters<ILog['logger']>[0]};
|
|
152
|
+
realm: {logLevel: Parameters<ILog['logger']>[0]};
|
|
153
|
+
};
|
|
154
|
+
browser: {
|
|
155
|
+
load: {logLevel: Parameters<ILog['logger']>[0]};
|
|
156
|
+
realm: {logLevel: Parameters<ILog['logger']>[0]};
|
|
157
|
+
};
|
|
158
|
+
kopi?: {realm?: unknown};
|
|
159
|
+
watch?: {configs?: object};
|
|
160
|
+
configs?: object;
|
|
161
|
+
configNames: string[];
|
|
162
|
+
};
|
|
163
|
+
|
|
135
164
|
export interface IPlatformApi {
|
|
136
165
|
platform: 'server' | 'browser';
|
|
137
166
|
loadConfig: (
|
|
138
|
-
|
|
139
|
-
|
|
167
|
+
baseConfig: BaseConfig,
|
|
168
|
+
parentConfig: string | object,
|
|
169
|
+
loadedConfigs: object[],
|
|
170
|
+
) => Promise<{
|
|
171
|
+
loadedConfig: BaseConfig & {
|
|
172
|
+
[key: string]: unknown;
|
|
173
|
+
};
|
|
174
|
+
configRuntime?: IConfigRuntime;
|
|
175
|
+
}>;
|
|
140
176
|
readdir: (path: string) => Promise<Dirent[]>;
|
|
141
177
|
scan: (...path: string[]) => Promise<Dirent[]>;
|
|
142
178
|
existsSync: (path: string) => boolean;
|
|
@@ -163,6 +199,7 @@ export interface IPlatformApi {
|
|
|
163
199
|
spare: (time: HRTime, latency?: number) => number;
|
|
164
200
|
};
|
|
165
201
|
configs: string[];
|
|
202
|
+
context: Record<string, unknown>;
|
|
166
203
|
}
|
|
167
204
|
|
|
168
205
|
export interface IErrorFactory {
|
|
@@ -263,6 +300,12 @@ export interface IApiSchema {
|
|
|
263
300
|
): unknown;
|
|
264
301
|
}
|
|
265
302
|
|
|
303
|
+
export interface IObjectSchema {
|
|
304
|
+
[subject: string]: {
|
|
305
|
+
[object: string]: TObject;
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
266
309
|
export interface IGateway {
|
|
267
310
|
route: (
|
|
268
311
|
validations: Record<string, GatewaySchema>,
|
|
@@ -291,6 +334,7 @@ export interface IRegistry {
|
|
|
291
334
|
ports: Map<string, IAdapterRegistry>;
|
|
292
335
|
methods: Map<string, Handlers>;
|
|
293
336
|
modules: Map<string | symbol, IRegistry[]>;
|
|
337
|
+
objectSchema: IObjectSchema;
|
|
294
338
|
createPort: (id: string) => Promise<Adapter | undefined>;
|
|
295
339
|
getPort: (id: string) => Adapter | undefined;
|
|
296
340
|
replaceHandlers: (id: string, handlers: Handlers) => Promise<void>;
|
|
@@ -304,9 +348,31 @@ export interface IRegistry {
|
|
|
304
348
|
connected: () => Promise<boolean>;
|
|
305
349
|
}
|
|
306
350
|
|
|
351
|
+
type BlongType = typeof Type & {
|
|
352
|
+
increment: () => TSchema;
|
|
353
|
+
integerNull: (options?: TNumberOptions) => TSchema;
|
|
354
|
+
integerNotNull: (options?: TNumberOptions) => TSchema;
|
|
355
|
+
bigIntNull: (options?: TNumberOptions) => TSchema;
|
|
356
|
+
bigIntNotNull: (options?: TNumberOptions) => TSchema;
|
|
357
|
+
stringNull: (options?: TStringOptions) => TSchema;
|
|
358
|
+
stringNotNull: (options?: TStringOptions) => TSchema;
|
|
359
|
+
numberNull: (options?: TNumberOptions) => TSchema;
|
|
360
|
+
numberNotNull: (options?: TNumberOptions) => TSchema;
|
|
361
|
+
booleanNull: (options?: TSchemaOptions) => TSchema;
|
|
362
|
+
booleanNotNull: (options?: TSchemaOptions) => TSchema;
|
|
363
|
+
dateNull: () => TSchema;
|
|
364
|
+
dateNotNull: () => TSchema;
|
|
365
|
+
dateTimeNull: () => TSchema;
|
|
366
|
+
dateTimeNotNull: () => TSchema;
|
|
367
|
+
ulid: () => TSchema;
|
|
368
|
+
uuid: () => TSchema;
|
|
369
|
+
uidNull: () => TSchema;
|
|
370
|
+
uidNotNull: () => TSchema;
|
|
371
|
+
};
|
|
372
|
+
|
|
307
373
|
export interface IApi {
|
|
308
374
|
id?: string;
|
|
309
|
-
type:
|
|
375
|
+
type: BlongType;
|
|
310
376
|
adapter: (id: string) => IAdapterRegistry | undefined;
|
|
311
377
|
utError: IError;
|
|
312
378
|
errors: IErrorFactory;
|
|
@@ -315,6 +381,7 @@ export interface IApi {
|
|
|
315
381
|
rpc: IRpcServer;
|
|
316
382
|
local: ILocal;
|
|
317
383
|
registry: IRegistry;
|
|
384
|
+
schema: IObjectSchema;
|
|
318
385
|
register: (
|
|
319
386
|
methods:
|
|
320
387
|
| Record<string, (...params: unknown[]) => Promise<unknown>>
|
|
@@ -349,9 +416,16 @@ export interface IApi {
|
|
|
349
416
|
patterns: (string | RegExp)[] | string | RegExp,
|
|
350
417
|
adapter?: boolean,
|
|
351
418
|
) => unknown;
|
|
419
|
+
attach: (target: object, patterns: (string | RegExp)[] | string | RegExp) => Promise<object>;
|
|
352
420
|
createLog: ILog['logger'];
|
|
353
421
|
attachCheckpoint?: (meta: IMeta) => void;
|
|
354
|
-
handlers?: (api: {
|
|
422
|
+
handlers?: (api: {
|
|
423
|
+
utError: IError;
|
|
424
|
+
remote: IRemote;
|
|
425
|
+
type: BlongType;
|
|
426
|
+
schema: IObjectSchema;
|
|
427
|
+
manifest?: IManifest;
|
|
428
|
+
}) => {
|
|
355
429
|
extends?:
|
|
356
430
|
| string
|
|
357
431
|
| ((api: {
|
|
@@ -360,8 +434,13 @@ export interface IApi {
|
|
|
360
434
|
rpc: IRpcServer;
|
|
361
435
|
local: ILocal;
|
|
362
436
|
registry: IRegistry;
|
|
437
|
+
schema: IObjectSchema;
|
|
438
|
+
manifest?: IManifest;
|
|
363
439
|
}) => object);
|
|
364
440
|
};
|
|
441
|
+
render: (what: object[] | object) => object;
|
|
442
|
+
platform: IPlatformApi;
|
|
443
|
+
manifest?: IManifest;
|
|
365
444
|
}
|
|
366
445
|
|
|
367
446
|
export interface IErrorMap {
|
|
@@ -388,6 +467,7 @@ export type Adapter<T = Record<string, unknown>, C = Record<string, unknown>> =
|
|
|
388
467
|
| 'findValidation'
|
|
389
468
|
| 'getConversion'
|
|
390
469
|
| 'dispatch'
|
|
470
|
+
| 'platform'
|
|
391
471
|
>;
|
|
392
472
|
export interface IAdapter<T, C> {
|
|
393
473
|
validation?: TSchema;
|
|
@@ -399,20 +479,17 @@ export interface IAdapter<T, C> {
|
|
|
399
479
|
imported?: Record<string, PortHandlerBound>;
|
|
400
480
|
importedMap?: Map<string, IRemoteHandler>;
|
|
401
481
|
extends?: object | `adapter.${string}` | `orchestrator.${string}`;
|
|
482
|
+
platform?: IPlatformApi;
|
|
402
483
|
activeConfig?(this: Adapter<T, C>): Partial<Config<T, C>>;
|
|
403
484
|
init?(this: Adapter<T, C>, ...config: unknown[]): Promise<unknown>;
|
|
404
485
|
start?(this: Adapter<T, C>, ...params: unknown[]): Promise<unknown>;
|
|
405
486
|
ready?(this: Adapter<T, C>): Promise<unknown>;
|
|
406
487
|
stop?(this: Adapter<T, C>, ...params: unknown[]): Promise<unknown>;
|
|
407
|
-
|
|
488
|
+
attach?<R extends object>(
|
|
408
489
|
this: Adapter<T, C>,
|
|
409
490
|
patterns: (string | RegExp)[] | string | RegExp,
|
|
410
|
-
target
|
|
411
|
-
): Promise<
|
|
412
|
-
importedMap?: Map<string, object>;
|
|
413
|
-
imported?: object;
|
|
414
|
-
config?: {namespace?: string | string[]};
|
|
415
|
-
}>;
|
|
491
|
+
target?: R,
|
|
492
|
+
): Promise<R>;
|
|
416
493
|
connected?(this: Adapter<T, C>): Promise<boolean>;
|
|
417
494
|
error?(error: unknown, $meta: unknown): void;
|
|
418
495
|
pack?(this: Adapter<T, C>, ...params: unknown[]): unknown;
|
|
@@ -487,6 +564,8 @@ export interface IAdapterRegistry {
|
|
|
487
564
|
rpc: IRpcServer;
|
|
488
565
|
local: ILocal;
|
|
489
566
|
registry: IRegistry;
|
|
567
|
+
schema: IObjectSchema;
|
|
568
|
+
manifest?: IManifest;
|
|
490
569
|
}): Promise<Adapter>;
|
|
491
570
|
}
|
|
492
571
|
|
|
@@ -605,18 +684,28 @@ export type Errors<T> = {
|
|
|
605
684
|
|
|
606
685
|
export interface IBaseConfig extends TObject<{
|
|
607
686
|
watch: TObject<{
|
|
608
|
-
test
|
|
687
|
+
test?: TArray<TString>;
|
|
609
688
|
}>;
|
|
610
689
|
remote: TObject<{
|
|
611
|
-
canSkipSocket
|
|
690
|
+
canSkipSocket?: TBoolean;
|
|
612
691
|
}>;
|
|
613
|
-
adapter: TBoolean;
|
|
614
|
-
orchestrator: TBoolean;
|
|
615
|
-
test: TBoolean;
|
|
616
|
-
error: TBoolean;
|
|
692
|
+
adapter: TBoolean | TObject;
|
|
693
|
+
orchestrator: TBoolean | TObject;
|
|
694
|
+
test: TBoolean | TObject;
|
|
695
|
+
error: TBoolean | TObject;
|
|
617
696
|
gateway: TBoolean | TObject;
|
|
618
|
-
sim: TBoolean;
|
|
619
|
-
resolution: TBoolean;
|
|
697
|
+
sim: TBoolean | TObject;
|
|
698
|
+
resolution: TBoolean | TObject;
|
|
699
|
+
log: TBoolean | TObject;
|
|
700
|
+
apiSchema: TBoolean | TObject;
|
|
701
|
+
registry: TBoolean | TObject;
|
|
702
|
+
port: TBoolean | TObject;
|
|
703
|
+
codec: TBoolean | TObject;
|
|
704
|
+
local: TBoolean | TObject;
|
|
705
|
+
rpcServer: TBoolean | TObject;
|
|
706
|
+
restFs: TBoolean | TObject;
|
|
707
|
+
systemDebug: TBoolean | TObject;
|
|
708
|
+
apiGateway: TBoolean | TObject;
|
|
620
709
|
}> {
|
|
621
710
|
additionalProperties: false;
|
|
622
711
|
}
|
|
@@ -650,6 +739,27 @@ export interface ILogger {
|
|
|
650
739
|
warn?: LogFn;
|
|
651
740
|
error?: LogFn;
|
|
652
741
|
fatal?: LogFn;
|
|
742
|
+
/**
|
|
743
|
+
* Wrap a long-running promise and report progress on this logger.
|
|
744
|
+
*
|
|
745
|
+
* Once the operation runs past `thresholdMs`, a snapshot (from `getProgress`)
|
|
746
|
+
* is logged every `intervalMs` at the given `level` (default 'warn'), followed
|
|
747
|
+
* by a completion line. Delegates to the shared `withProgress` helper from
|
|
748
|
+
* `@feasibleone/blong-lib`.
|
|
749
|
+
*
|
|
750
|
+
* @example
|
|
751
|
+
* await runtime.log.progress('schema sync', syncPromise, {getProgress: () => ({done: 1, total: 2})});
|
|
752
|
+
*/
|
|
753
|
+
progress?: <T>(
|
|
754
|
+
label: string,
|
|
755
|
+
promise: Promise<T>,
|
|
756
|
+
options?: {
|
|
757
|
+
getProgress?: () => string | object;
|
|
758
|
+
thresholdMs?: number;
|
|
759
|
+
intervalMs?: number;
|
|
760
|
+
level?: 'info' | 'warn';
|
|
761
|
+
},
|
|
762
|
+
) => Promise<T>;
|
|
653
763
|
}
|
|
654
764
|
|
|
655
765
|
export interface IStep {
|
|
@@ -692,6 +802,10 @@ export type GatewaySchema = (
|
|
|
692
802
|
subject?: string;
|
|
693
803
|
destination?: string;
|
|
694
804
|
operation?: OpenAPIV3_1.OperationObject | OpenAPIV2.OperationObject;
|
|
805
|
+
/** Metering metadata threaded into the Fastify route config by Gateway.ts. */
|
|
806
|
+
bundle?: string;
|
|
807
|
+
creditCost?: number;
|
|
808
|
+
meter?: boolean;
|
|
695
809
|
};
|
|
696
810
|
|
|
697
811
|
export type SchemaObject = OpenAPIV3_1.SchemaObject | OpenAPIV2.SchemaObject;
|
|
@@ -725,8 +839,25 @@ export type ChainStep =
|
|
|
725
839
|
|
|
726
840
|
export type CheckpointFn = (this: IMeta, name: string, data?: unknown) => void;
|
|
727
841
|
|
|
842
|
+
/**
|
|
843
|
+
* Manifest — a shared mutable object passed to the `load` function that allows
|
|
844
|
+
* platforms to share information such as effective ports, URLs, or other
|
|
845
|
+
* runtime-resolved values across components.
|
|
846
|
+
*
|
|
847
|
+
* Properties are typically Promises (created via `Promise.withResolvers()`) that
|
|
848
|
+
* are resolved when one platform finishes a startup step (e.g. listening on a
|
|
849
|
+
* random port), and awaited by another platform or adapter during its own
|
|
850
|
+
* initialisation (e.g. constructing a backend URL from the effective port).
|
|
851
|
+
*
|
|
852
|
+
* Manifest properties can also be provided via CLI args using the
|
|
853
|
+
* `--manifest.<key>=<value>` syntax.
|
|
854
|
+
*/
|
|
855
|
+
export interface IManifest {
|
|
856
|
+
[key: string]: unknown;
|
|
857
|
+
}
|
|
858
|
+
|
|
728
859
|
export interface ILib {
|
|
729
|
-
type:
|
|
860
|
+
type: BlongType;
|
|
730
861
|
error: <T>(errors: T) => Record<keyof T, (params?: unknown, $meta?: IMeta) => ITypedError>;
|
|
731
862
|
rename: <T extends object>(object: T, name: string) => T & {name: string};
|
|
732
863
|
/**
|
|
@@ -773,26 +904,44 @@ export interface ILib {
|
|
|
773
904
|
merge<T, S1, S2>(target: T, source1: S1, source2: S2): T & S1 & S2;
|
|
774
905
|
merge<T, S1, S2, S3>(target: T, source1: S1, source2: S2, source3: S3): T & S1 & S2 & S3;
|
|
775
906
|
merge<T>(...args: unknown[]): T;
|
|
907
|
+
mergeWithSymbols<T, S1>(target: T, source: S1): T & S1;
|
|
908
|
+
render: (what: object[] | object) => object;
|
|
909
|
+
crockfordEncode: (data: Uint8Array) => string;
|
|
910
|
+
crockfordDecode: (data: string) => Uint8Array;
|
|
911
|
+
withProgress: <T>(
|
|
912
|
+
log: {info?: LogFn; warn?: LogFn} | undefined,
|
|
913
|
+
label: string,
|
|
914
|
+
promise: Promise<T>,
|
|
915
|
+
options?: {
|
|
916
|
+
getProgress?: () => string | object;
|
|
917
|
+
thresholdMs?: number;
|
|
918
|
+
intervalMs?: number;
|
|
919
|
+
level?: 'info' | 'warn';
|
|
920
|
+
},
|
|
921
|
+
) => Promise<T>;
|
|
776
922
|
}
|
|
777
923
|
|
|
778
924
|
export type ValidationFn = () => GatewaySchema;
|
|
779
|
-
export interface IValidationProxy {
|
|
925
|
+
export interface IValidationProxy<T> {
|
|
780
926
|
type: typeof Type;
|
|
781
927
|
handler: {
|
|
782
928
|
[name: string]: ValidationFn;
|
|
783
|
-
};
|
|
929
|
+
} & IRemoteHandler;
|
|
784
930
|
lib: ILib & {
|
|
785
931
|
[name: string]: TSchema;
|
|
786
932
|
};
|
|
787
933
|
error: {
|
|
788
934
|
[name: string]: (...params: unknown[]) => ITypedError;
|
|
789
935
|
};
|
|
936
|
+
/** Collected object schemas accumulated so far; later `schema()` exports can reference earlier ones. */
|
|
937
|
+
schema: IObjectSchema;
|
|
938
|
+
config: T;
|
|
790
939
|
}
|
|
791
|
-
export type ValidationDefinition = (
|
|
792
|
-
blong: IValidationProxy
|
|
793
|
-
) => Record<string, ValidationFn | TSchema> | ValidationFn | ValidationFn[]
|
|
940
|
+
export type ValidationDefinition<T> = (
|
|
941
|
+
blong: IValidationProxy<T>,
|
|
942
|
+
) => Promise<Record<string, ValidationFn | TSchema> | ValidationFn | ValidationFn[]>;
|
|
794
943
|
|
|
795
|
-
export type ApiDefinition = (blong: IValidationProxy) =>
|
|
944
|
+
export type ApiDefinition<T> = (blong: IValidationProxy<T>) =>
|
|
796
945
|
| {
|
|
797
946
|
namespace:
|
|
798
947
|
| string[]
|
|
@@ -838,6 +987,8 @@ export interface IHandlerProxy<T> {
|
|
|
838
987
|
errors: {
|
|
839
988
|
[name: string]: (...params: unknown[]) => ITypedError;
|
|
840
989
|
};
|
|
990
|
+
/** Collected object schemas from all registered `schema()` exports. */
|
|
991
|
+
schema: IObjectSchema;
|
|
841
992
|
utBus: {
|
|
842
993
|
info: () => {encrypt: object; sign: object};
|
|
843
994
|
};
|
|
@@ -859,8 +1010,8 @@ export type ModuleApi = {
|
|
|
859
1010
|
config: Record<string, unknown>;
|
|
860
1011
|
parent: IAdapterFactory;
|
|
861
1012
|
error: (errors: object) => ModuleApi;
|
|
862
|
-
validation: (
|
|
863
|
-
method: ValidationDefinition | ValidationDefinition[],
|
|
1013
|
+
validation: <T>(
|
|
1014
|
+
method: ValidationDefinition<T> | ValidationDefinition<T>[],
|
|
864
1015
|
namespace?: string,
|
|
865
1016
|
) => ModuleApi;
|
|
866
1017
|
sequence: (fn: () => Sequence) => ModuleApi;
|
|
@@ -873,7 +1024,10 @@ export type ModuleApi = {
|
|
|
873
1024
|
};
|
|
874
1025
|
|
|
875
1026
|
export interface SolutionFactory<T extends TSchema = TNever> {
|
|
876
|
-
(definition: {
|
|
1027
|
+
(definition: {
|
|
1028
|
+
type: typeof Type;
|
|
1029
|
+
manifest?: IManifest;
|
|
1030
|
+
}): IModuleConfig<T> | Promise<IModuleConfig<T>>;
|
|
877
1031
|
}
|
|
878
1032
|
|
|
879
1033
|
const Kind: symbol = Symbol.for('blong:kind');
|
|
@@ -921,9 +1075,13 @@ export interface IComponent {
|
|
|
921
1075
|
|
|
922
1076
|
export const library = <T = Record<string, unknown>>(definition: Lib<T>): Lib<T> =>
|
|
923
1077
|
Object.defineProperty(definition, Kind, {value: 'lib'});
|
|
924
|
-
export const validation =
|
|
925
|
-
|
|
926
|
-
|
|
1078
|
+
export const validation = <T = Record<string, unknown>>(
|
|
1079
|
+
validation: ValidationDefinition<T>,
|
|
1080
|
+
): ValidationDefinition<T> => Object.defineProperty(validation, Kind, {value: 'validation'});
|
|
1081
|
+
export const schema = <T = Record<string, unknown>>(
|
|
1082
|
+
schema: ValidationDefinition<T>,
|
|
1083
|
+
): ValidationDefinition<T> => Object.defineProperty(schema, Kind, {value: 'schema'});
|
|
1084
|
+
export const api = <T = Record<string, unknown>>(api: ApiDefinition<T>): ApiDefinition<T> =>
|
|
927
1085
|
Object.defineProperty(api, Kind, {value: 'api'});
|
|
928
1086
|
export const model = <T extends IModelSpec>(
|
|
929
1087
|
definition: () => () => Promise<T>,
|
|
@@ -931,10 +1089,10 @@ export const model = <T extends IModelSpec>(
|
|
|
931
1089
|
export const fixture = <T extends IMock>(definition: () => T): (() => T) =>
|
|
932
1090
|
Object.defineProperty(definition, Kind, {value: 'fixture'});
|
|
933
1091
|
|
|
934
|
-
export const validationHandlers: (
|
|
1092
|
+
export const validationHandlers: <T>(
|
|
935
1093
|
handlers: Record<string, TFunction<[ApiSchema]>>,
|
|
936
|
-
) => ValidationDefinition = handlers =>
|
|
937
|
-
validation(() =>
|
|
1094
|
+
) => ValidationDefinition<T> = handlers =>
|
|
1095
|
+
validation(async () =>
|
|
938
1096
|
Object.fromEntries(
|
|
939
1097
|
Object.entries(handlers).map(([name, handler]) => [
|
|
940
1098
|
name,
|
|
@@ -989,6 +1147,7 @@ export const orchestrator = <T, C = AdapterContext>(
|
|
|
989
1147
|
export type Kinds =
|
|
990
1148
|
| 'lib'
|
|
991
1149
|
| 'validation'
|
|
1150
|
+
| 'schema'
|
|
992
1151
|
| 'api'
|
|
993
1152
|
| 'solution'
|
|
994
1153
|
| 'server'
|
package/dist/knex.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Bundled Knex TypeScript Declaration File
|
|
2
|
-
// Generated from: https://github.com/knex/knex/blob/master/types/index.d.ts
|
|
3
|
-
// All transitive dependencies have been replaced with suitable alternatives or unknown types
|
|
4
|
-
// TypeScript Version: 4.1+
|
|
5
|
-
export default knex;
|
|
6
|
-
export { Knex };
|
|
7
|
-
//# sourceMappingURL=knex.js.map
|
package/dist/knex.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"knex.js","sourceRoot":"","sources":["../knex.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,4EAA4E;AAC5E,6FAA6F;AAC7F,2BAA2B;AAy/F3B,eAAe,IAAI,CAAC;AACpB,OAAO,EAAC,IAAI,EAAC,CAAC"}
|
package/dist/model.js
DELETED
package/dist/model.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../model.ts"],"names":[],"mappings":""}
|