@feasibleone/blong 1.16.1 → 1.18.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 +35 -0
- package/dist/model.js +10 -0
- package/dist/model.js.map +1 -0
- package/dist/types.d.ts +412 -127
- package/dist/types.js +22 -32
- package/dist/types.js.map +1 -1
- package/package.json +9 -6
- package/types.ts +298 -141
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
+
import { ChokidarOptions, FSWatcherEventMap } from 'chokidar';
|
|
3
4
|
import { SrvRecord } from 'dns';
|
|
4
5
|
import { EventEmitter } from 'events';
|
|
5
6
|
import { Socket, TcpNetConnectOpts } from 'net';
|
|
6
7
|
import Assert from 'node:assert';
|
|
7
|
-
import { Dirent } from 'node:fs';
|
|
8
|
+
import { Dirent, StatSyncFn } from 'node:fs';
|
|
8
9
|
import { Agent } from 'node:http';
|
|
9
10
|
import { Duplex } from 'node:stream';
|
|
10
11
|
import { Level, LogFn, Logger as PinoLogger } from 'pino';
|
|
@@ -17573,6 +17574,207 @@ declare namespace DeferredKeySelection {
|
|
|
17573
17574
|
}
|
|
17574
17575
|
export type AggregationQueryResult<TResult, TIntersectProps2 extends {}> = ArrayIfAlready<TResult, UnwrapArrayMember<TResult> extends DeferredKeySelection<infer TBase, infer TKeys, infer THasSelect, infer TAliasMapping, infer TSingle, infer TIntersectProps, infer TUnionProps> ? true extends THasSelect ? DeferredKeySelection<TBase, TKeys, THasSelect, TAliasMapping, TSingle, TIntersectProps & TIntersectProps2, TUnionProps> : DeferredKeySelection<{}, never, true, {}, false, TIntersectProps2> : TIntersectProps2>;
|
|
17575
17576
|
export type ResolveResult<S> = DeferredKeySelection.Resolve<S>;
|
|
17577
|
+
/**
|
|
17578
|
+
* Model system types.
|
|
17579
|
+
*
|
|
17580
|
+
* A ModelSpec describes one "subject.object" domain entity and drives:
|
|
17581
|
+
* - automatic Browse / New / Open / Report page generation
|
|
17582
|
+
* - schema enrichment (server OpenAPI merged with browser overlay)
|
|
17583
|
+
* - dropdown dependency tracking and caching
|
|
17584
|
+
*/
|
|
17585
|
+
/** {value, label} pair used in all dropdown and select widgets */
|
|
17586
|
+
export interface IDropdownOption {
|
|
17587
|
+
value: unknown;
|
|
17588
|
+
label: string;
|
|
17589
|
+
[key: string]: unknown;
|
|
17590
|
+
}
|
|
17591
|
+
/** Widget metadata overlay */
|
|
17592
|
+
export interface IWidgetOverride {
|
|
17593
|
+
type?: string;
|
|
17594
|
+
/** Named dropdown: 'rule.country', 'marine.species', etc. */
|
|
17595
|
+
dropdown?: string;
|
|
17596
|
+
options?: Array<{
|
|
17597
|
+
value: unknown;
|
|
17598
|
+
label: string;
|
|
17599
|
+
}>;
|
|
17600
|
+
keyValue?: boolean;
|
|
17601
|
+
fieldClass?: string;
|
|
17602
|
+
itemClassName?: string;
|
|
17603
|
+
label?: string;
|
|
17604
|
+
master?: Record<string, string>;
|
|
17605
|
+
parent?: string;
|
|
17606
|
+
autoSelect?: boolean;
|
|
17607
|
+
selectionMode?: "single" | "multiple";
|
|
17608
|
+
hidden?: string[];
|
|
17609
|
+
widgets?: string[];
|
|
17610
|
+
params?: Record<string, unknown>;
|
|
17611
|
+
[key: string]: unknown;
|
|
17612
|
+
}
|
|
17613
|
+
/** JSON Schema property overlay — the browser model adds/overrides field metadata */
|
|
17614
|
+
export interface IPropertyOverride {
|
|
17615
|
+
title?: string;
|
|
17616
|
+
type?: string;
|
|
17617
|
+
filter?: boolean;
|
|
17618
|
+
sort?: boolean;
|
|
17619
|
+
required?: boolean;
|
|
17620
|
+
default?: unknown;
|
|
17621
|
+
widget?: IWidgetOverride;
|
|
17622
|
+
validation?: unknown;
|
|
17623
|
+
properties?: Record<string, IPropertyOverride>;
|
|
17624
|
+
items?: {
|
|
17625
|
+
properties?: Record<string, IPropertyOverride>;
|
|
17626
|
+
};
|
|
17627
|
+
[key: string]: unknown;
|
|
17628
|
+
}
|
|
17629
|
+
/** Schema overlay — top-level properties map per subject.object */
|
|
17630
|
+
export interface ISchemaOverlay {
|
|
17631
|
+
properties?: Record<string, IPropertyOverride>;
|
|
17632
|
+
[key: string]: unknown;
|
|
17633
|
+
}
|
|
17634
|
+
/** Named card layout — a group of fields rendered as one collapsible card */
|
|
17635
|
+
export interface ICardOverride {
|
|
17636
|
+
className?: string;
|
|
17637
|
+
label?: string;
|
|
17638
|
+
title?: string;
|
|
17639
|
+
hidden?: boolean;
|
|
17640
|
+
widgets: Array<string | IInlineWidget>;
|
|
17641
|
+
}
|
|
17642
|
+
/** Inline widget descriptor (used inside card.widgets arrays) */
|
|
17643
|
+
export interface IInlineWidget {
|
|
17644
|
+
name: string;
|
|
17645
|
+
type: string;
|
|
17646
|
+
page?: string;
|
|
17647
|
+
params?: Record<string, unknown>;
|
|
17648
|
+
}
|
|
17649
|
+
/** Tab in the editor layout */
|
|
17650
|
+
export interface ILayoutTab {
|
|
17651
|
+
id: string;
|
|
17652
|
+
label?: string;
|
|
17653
|
+
icon?: string;
|
|
17654
|
+
widgets: Array<string | string[]>;
|
|
17655
|
+
}
|
|
17656
|
+
/** Permission names for each CRUD action */
|
|
17657
|
+
export interface IBrowserPermissions {
|
|
17658
|
+
browse: string;
|
|
17659
|
+
add: string;
|
|
17660
|
+
edit: string;
|
|
17661
|
+
delete: string;
|
|
17662
|
+
}
|
|
17663
|
+
/** Browse page configuration */
|
|
17664
|
+
export interface IBrowserConfig {
|
|
17665
|
+
title?: string;
|
|
17666
|
+
icon?: string;
|
|
17667
|
+
permission?: IBrowserPermissions;
|
|
17668
|
+
/** Column transformation applied to server fetch params */
|
|
17669
|
+
fetch?: (params: Record<string, unknown>) => Record<string, unknown>;
|
|
17670
|
+
/** Default filter applied on page open */
|
|
17671
|
+
filter?: Record<string, unknown>;
|
|
17672
|
+
/** Result set key to use from server response */
|
|
17673
|
+
resultSet?: string;
|
|
17674
|
+
/** Whether to show "Create" button */
|
|
17675
|
+
create?: Array<{
|
|
17676
|
+
title?: string;
|
|
17677
|
+
type?: string;
|
|
17678
|
+
permission?: string;
|
|
17679
|
+
}>;
|
|
17680
|
+
/** Extra toolbar buttons */
|
|
17681
|
+
toolbar?: unknown[];
|
|
17682
|
+
}
|
|
17683
|
+
/** Editor page configuration */
|
|
17684
|
+
export interface IEditorConfig {
|
|
17685
|
+
resultSet?: string;
|
|
17686
|
+
}
|
|
17687
|
+
/** Report page configuration */
|
|
17688
|
+
export interface IReportConfig {
|
|
17689
|
+
title?: string;
|
|
17690
|
+
permission?: string;
|
|
17691
|
+
}
|
|
17692
|
+
/** Method name overrides — defaults to semantic triple naming */
|
|
17693
|
+
export interface IMethodsConfig {
|
|
17694
|
+
find?: string;
|
|
17695
|
+
get?: string;
|
|
17696
|
+
add?: string;
|
|
17697
|
+
edit?: string;
|
|
17698
|
+
remove?: string;
|
|
17699
|
+
report?: string;
|
|
17700
|
+
}
|
|
17701
|
+
/**
|
|
17702
|
+
* ModelSpec — the browser-side description of one "subject.object" domain entity.
|
|
17703
|
+
*
|
|
17704
|
+
* Used by modelFactory() to auto-generate Browse/New/Open/Report pages.
|
|
17705
|
+
*/
|
|
17706
|
+
export interface IModelSpec {
|
|
17707
|
+
/** Namespace / subject, e.g. 'marine', 'rule' */
|
|
17708
|
+
subject: string;
|
|
17709
|
+
/** Entity name, e.g. 'coral', 'condition' */
|
|
17710
|
+
object: string;
|
|
17711
|
+
/** Human-readable title, e.g. 'Coral'. Defaults to capitalized object. */
|
|
17712
|
+
objectTitle?: string;
|
|
17713
|
+
/** Primary key field path, e.g. 'coralId'. Defaults to `${object}Id`. */
|
|
17714
|
+
keyField?: string;
|
|
17715
|
+
/** Name field path (dotted), e.g. 'coral.coralName'. Defaults to `${object}.${object}Name`. */
|
|
17716
|
+
nameField?: string;
|
|
17717
|
+
/** JSON Schema overlay merged on top of server OpenAPI schema */
|
|
17718
|
+
schema?: ISchemaOverlay;
|
|
17719
|
+
/** Named card layout definitions */
|
|
17720
|
+
cards?: Record<string, ICardOverride>;
|
|
17721
|
+
/** Browse page configuration */
|
|
17722
|
+
browser?: IBrowserConfig;
|
|
17723
|
+
/** Editor page configuration */
|
|
17724
|
+
editor?: IEditorConfig;
|
|
17725
|
+
/** Report page configuration */
|
|
17726
|
+
report?: IReportConfig;
|
|
17727
|
+
/** Tab layouts for editor */
|
|
17728
|
+
layouts?: {
|
|
17729
|
+
edit?: ILayoutTab[] | string[];
|
|
17730
|
+
[key: string]: unknown;
|
|
17731
|
+
};
|
|
17732
|
+
/** Method name overrides */
|
|
17733
|
+
methods?: IMethodsConfig;
|
|
17734
|
+
}
|
|
17735
|
+
/** Model spec as accepted by modelFactory — objectTitle/keyField/nameField are optional */
|
|
17736
|
+
export type IPartialModelSpec = IModelSpec;
|
|
17737
|
+
/** Fully resolved model spec — all defaults filled in */
|
|
17738
|
+
export interface IResolvedModelSpec extends Required<IModelSpec> {
|
|
17739
|
+
objectTitle: string;
|
|
17740
|
+
keyField: string;
|
|
17741
|
+
nameField: string;
|
|
17742
|
+
browser: Required<IBrowserConfig> & {
|
|
17743
|
+
permission: IBrowserPermissions;
|
|
17744
|
+
};
|
|
17745
|
+
editor: Required<IEditorConfig>;
|
|
17746
|
+
report: Required<IReportConfig>;
|
|
17747
|
+
methods: Required<IMethodsConfig>;
|
|
17748
|
+
}
|
|
17749
|
+
/** Mock OpenAPI document (minimal shape used by schemaFetcher) */
|
|
17750
|
+
export interface IMockOpenApiDoc {
|
|
17751
|
+
paths?: Record<string, Record<string, {
|
|
17752
|
+
operationId?: string;
|
|
17753
|
+
requestBody?: {
|
|
17754
|
+
content?: {
|
|
17755
|
+
"application/json"?: {
|
|
17756
|
+
schema?: Record<string, unknown>;
|
|
17757
|
+
};
|
|
17758
|
+
};
|
|
17759
|
+
};
|
|
17760
|
+
responses?: {
|
|
17761
|
+
"200"?: {
|
|
17762
|
+
content?: {
|
|
17763
|
+
"application/json"?: {
|
|
17764
|
+
schema?: Record<string, unknown>;
|
|
17765
|
+
};
|
|
17766
|
+
};
|
|
17767
|
+
};
|
|
17768
|
+
};
|
|
17769
|
+
}>>;
|
|
17770
|
+
"x-ui-customizations"?: Record<string, Record<string, unknown>>;
|
|
17771
|
+
}
|
|
17772
|
+
export interface IMock {
|
|
17773
|
+
/** Mock OpenAPI documents keyed by subject name */
|
|
17774
|
+
subjects?: Record<string, object[]>;
|
|
17775
|
+
/** Pre-populated dropdown data keyed by dropdown name */
|
|
17776
|
+
dropdowns?: Record<string, IDropdownOption[]>;
|
|
17777
|
+
}
|
|
17576
17778
|
export type ServerContext = {
|
|
17577
17779
|
queryBuilder?: Knex;
|
|
17578
17780
|
kcAdminClient?: KeycloakAdminClient;
|
|
@@ -17591,6 +17793,82 @@ export interface ILog {
|
|
|
17591
17793
|
logger: (level: Level, bindings: object) => ILogger;
|
|
17592
17794
|
child: PinoLogger["child"];
|
|
17593
17795
|
}
|
|
17796
|
+
/** A flat map of dotted-path → [prev, next] pairs that represent changed keys */
|
|
17797
|
+
export type ConfigDiff = Map<string, {
|
|
17798
|
+
prev: unknown;
|
|
17799
|
+
next: unknown;
|
|
17800
|
+
}>;
|
|
17801
|
+
/** Subscriber callback invoked after a successful reload */
|
|
17802
|
+
export type ConfigSubscriber = (diff: ConfigDiff, next: object, prev: object) => void | Promise<void>;
|
|
17803
|
+
/**
|
|
17804
|
+
* Mode used when the config proxy is queried during handler factory initialisation.
|
|
17805
|
+
*
|
|
17806
|
+
* - `'throw'` — throw immediately (default; keeps misuse from going unnoticed)
|
|
17807
|
+
* - `'collect'` — accumulate errors and return them from exitConfigFactoryPhase()
|
|
17808
|
+
* (useful in tests that explicitly verify the anti-pattern is caught)
|
|
17809
|
+
*/
|
|
17810
|
+
export type FactoryPhaseMode = "throw" | "collect";
|
|
17811
|
+
export interface IConfigRuntime {
|
|
17812
|
+
/** Current effective config, exposed as a live proxy */
|
|
17813
|
+
readonly snapshot: object;
|
|
17814
|
+
/** Raw (non-proxy) snapshot of the current effective config */
|
|
17815
|
+
readonly rawSnapshot: object;
|
|
17816
|
+
/** Load (or reload) config from all sources; returns the updated snapshot */
|
|
17817
|
+
load(params?: object): Promise<object>;
|
|
17818
|
+
/**
|
|
17819
|
+
* Reload config in-place. The backing store of the proxy is updated so all
|
|
17820
|
+
* existing proxy references automatically reflect the new values.
|
|
17821
|
+
* Returns the computed diff.
|
|
17822
|
+
*/
|
|
17823
|
+
reload(): Promise<ConfigDiff>;
|
|
17824
|
+
/** Compute the diff between two plain config objects without modifying state */
|
|
17825
|
+
diff(prev: object, next: object): ConfigDiff;
|
|
17826
|
+
/** Register a subscriber to be called after every successful reload */
|
|
17827
|
+
subscribe(fn: ConfigSubscriber): () => void;
|
|
17828
|
+
/** Enter the config factory phase */
|
|
17829
|
+
enterConfig(mode?: FactoryPhaseMode): void;
|
|
17830
|
+
/** Exit the config factory phase */
|
|
17831
|
+
exitConfig(): Error[];
|
|
17832
|
+
}
|
|
17833
|
+
export interface IWatcher extends EventEmitter<FSWatcherEventMap> {
|
|
17834
|
+
close(): Promise<void>;
|
|
17835
|
+
}
|
|
17836
|
+
export type HRTime = [
|
|
17837
|
+
number,
|
|
17838
|
+
number
|
|
17839
|
+
];
|
|
17840
|
+
export interface IPlatformApi {
|
|
17841
|
+
platform: "server" | "browser";
|
|
17842
|
+
loadConfig: (config: string | object) => Promise<{
|
|
17843
|
+
loadedConfig?: object;
|
|
17844
|
+
configRuntime?: IConfigRuntime;
|
|
17845
|
+
}>;
|
|
17846
|
+
readdir: (path: string) => Promise<Dirent[]>;
|
|
17847
|
+
scan: (...path: string[]) => Promise<Dirent[]>;
|
|
17848
|
+
existsSync: (path: string) => boolean;
|
|
17849
|
+
createRequire?: (path: string | URL) => NodeJS.Require;
|
|
17850
|
+
join: (...paths: string[]) => string;
|
|
17851
|
+
dirname: (path: string) => string;
|
|
17852
|
+
basename: (path: string, ext?: string) => string;
|
|
17853
|
+
relative: (from: string, to: string) => string;
|
|
17854
|
+
extname: (path: string) => string;
|
|
17855
|
+
resolve: (...paths: string[]) => string;
|
|
17856
|
+
readFileSync: (path: string, options?: {
|
|
17857
|
+
encoding: BufferEncoding;
|
|
17858
|
+
}) => string | Buffer;
|
|
17859
|
+
writeFileSync: (path: string, data: string | Buffer, options?: {
|
|
17860
|
+
encoding: BufferEncoding;
|
|
17861
|
+
}) => void;
|
|
17862
|
+
statSync: StatSyncFn;
|
|
17863
|
+
watch?: (path: string | string[], options?: ChokidarOptions) => IWatcher;
|
|
17864
|
+
timing: {
|
|
17865
|
+
diff: (time: HRTime, newTime: HRTime) => number;
|
|
17866
|
+
after: (milliseconds: number) => HRTime;
|
|
17867
|
+
now: (previous?: HRTime) => HRTime;
|
|
17868
|
+
isAfter: (time: HRTime, timeout: HRTime) => boolean;
|
|
17869
|
+
spare: (time: HRTime, latency?: number) => number;
|
|
17870
|
+
};
|
|
17871
|
+
}
|
|
17594
17872
|
export interface IErrorFactory {
|
|
17595
17873
|
get(type?: string): unknown;
|
|
17596
17874
|
fetch(type: string): object;
|
|
@@ -17674,6 +17952,9 @@ export interface IApiSchema {
|
|
|
17674
17952
|
}, source: string): Promise<Record<string, GatewaySchema>>;
|
|
17675
17953
|
generateFile(file: string): Promise<boolean>;
|
|
17676
17954
|
generateDir(dir: string, files: Dirent[]): Promise<boolean>;
|
|
17955
|
+
loadApi(locations: string | string[] | object | object[] | {
|
|
17956
|
+
assets: object;
|
|
17957
|
+
}, source: string): unknown;
|
|
17677
17958
|
}
|
|
17678
17959
|
export interface IGateway {
|
|
17679
17960
|
route: (validations: Record<string, GatewaySchema>, pkg: {
|
|
@@ -17687,36 +17968,32 @@ export interface IGateway {
|
|
|
17687
17968
|
export type Handlers = ((params: {
|
|
17688
17969
|
remote: unknown;
|
|
17689
17970
|
lib: object;
|
|
17690
|
-
port: object;
|
|
17971
|
+
port: object | undefined;
|
|
17691
17972
|
local: object;
|
|
17692
17973
|
literals: object[];
|
|
17693
17974
|
gateway: IGateway;
|
|
17975
|
+
apiSchema: IApiSchema;
|
|
17976
|
+
attachCheckpoint?: (meta: IMeta) => void;
|
|
17694
17977
|
}) => void)[];
|
|
17695
17978
|
export interface IRegistry {
|
|
17696
|
-
start: (configOverride
|
|
17979
|
+
start: (configOverride: object) => Promise<IRegistry>;
|
|
17697
17980
|
test: (tester?: unknown) => Promise<void>;
|
|
17698
17981
|
stop: () => Promise<IRegistry>;
|
|
17699
|
-
ports: Map<string,
|
|
17982
|
+
ports: Map<string, IAdapterRegistry>;
|
|
17700
17983
|
methods: Map<string, Handlers>;
|
|
17701
17984
|
modules: Map<string | symbol, IRegistry[]>;
|
|
17702
|
-
createPort: (id: string) => Promise<
|
|
17703
|
-
getPort: (id: string) =>
|
|
17704
|
-
replaceHandlers: (id: string, handlers:
|
|
17985
|
+
createPort: (id: string) => Promise<Adapter | undefined>;
|
|
17986
|
+
getPort: (id: string) => Adapter | undefined;
|
|
17987
|
+
replaceHandlers: (id: string, handlers: Handlers) => Promise<void>;
|
|
17705
17988
|
loadApi: (id: string, def: {
|
|
17706
17989
|
namespace: Record<string, string | string[]>;
|
|
17707
|
-
}, source
|
|
17990
|
+
}, source: string) => Promise<void>;
|
|
17708
17991
|
connected: () => Promise<boolean>;
|
|
17709
17992
|
}
|
|
17710
17993
|
export interface IApi {
|
|
17711
17994
|
id?: string;
|
|
17712
17995
|
type: typeof Type;
|
|
17713
|
-
adapter: (id: string) =>
|
|
17714
|
-
utError: IError;
|
|
17715
|
-
remote: IRemote;
|
|
17716
|
-
rpc: IRpcServer;
|
|
17717
|
-
local: ILocal;
|
|
17718
|
-
registry: IRegistry;
|
|
17719
|
-
}) => object;
|
|
17996
|
+
adapter: (id: string) => IAdapterRegistry | undefined;
|
|
17720
17997
|
utError: IError;
|
|
17721
17998
|
errors: IErrorFactory;
|
|
17722
17999
|
gateway: unknown;
|
|
@@ -17724,25 +18001,26 @@ export interface IApi {
|
|
|
17724
18001
|
rpc: IRpcServer;
|
|
17725
18002
|
local: ILocal;
|
|
17726
18003
|
registry: IRegistry;
|
|
17727
|
-
|
|
17728
|
-
|
|
17729
|
-
|
|
17730
|
-
|
|
17731
|
-
|
|
17732
|
-
|
|
17733
|
-
|
|
17734
|
-
|
|
17735
|
-
|
|
17736
|
-
|
|
17737
|
-
|
|
17738
|
-
|
|
17739
|
-
|
|
17740
|
-
|
|
17741
|
-
|
|
17742
|
-
|
|
17743
|
-
|
|
17744
|
-
|
|
17745
|
-
};
|
|
18004
|
+
register: (methods: object, namespace: string, id: string, pkg: {
|
|
18005
|
+
version: string;
|
|
18006
|
+
}) => void;
|
|
18007
|
+
unregister: (methods: string[], namespace: string) => void;
|
|
18008
|
+
subscribe: (methods: object, namespace: string, id: string, pkg: {
|
|
18009
|
+
version: string;
|
|
18010
|
+
}) => void;
|
|
18011
|
+
unsubscribe: (methods: string[], namespace: string) => void;
|
|
18012
|
+
dispatch: (...params: unknown[]) => boolean | Promise<unknown>;
|
|
18013
|
+
methodId: (name: string) => string;
|
|
18014
|
+
getPath: (name: string) => string;
|
|
18015
|
+
importMethod: (methodName: string, options?: object) => (...params: unknown[]) => Promise<unknown>;
|
|
18016
|
+
attachHandlers: (target: {
|
|
18017
|
+
importedMap?: Map<string, object>;
|
|
18018
|
+
imported: object;
|
|
18019
|
+
config: {
|
|
18020
|
+
namespace?: string | string[];
|
|
18021
|
+
};
|
|
18022
|
+
}, patterns: (string | RegExp)[] | string | RegExp, adapter?: boolean) => unknown;
|
|
18023
|
+
createLog: ILog["logger"];
|
|
17746
18024
|
attachCheckpoint?: (meta: IMeta) => void;
|
|
17747
18025
|
handlers?: (api: {
|
|
17748
18026
|
utError: IError;
|
|
@@ -17765,6 +18043,7 @@ export interface IErrorMap {
|
|
|
17765
18043
|
statusCode?: number;
|
|
17766
18044
|
};
|
|
17767
18045
|
}
|
|
18046
|
+
export type Adapter<T = Record<string, unknown>, C = Record<string, unknown>> = IAdapter<T, C> & Pick<Required<IAdapter<T, C>>, "init" | "start" | "stop" | "ready" | "config" | "imported" | "errors" | "error" | "findValidation" | "getConversion" | "dispatch">;
|
|
17768
18047
|
export interface IAdapter<T, C> {
|
|
17769
18048
|
validation?: TSchema;
|
|
17770
18049
|
config?: Config<T, C>;
|
|
@@ -17772,54 +18051,50 @@ export interface IAdapter<T, C> {
|
|
|
17772
18051
|
configBase?: string;
|
|
17773
18052
|
log?: ILogger;
|
|
17774
18053
|
errors?: Errors<IErrorMap>;
|
|
17775
|
-
imported?:
|
|
18054
|
+
imported?: Record<string, PortHandlerBound>;
|
|
18055
|
+
importedMap?: Map<string, IRemoteHandler>;
|
|
17776
18056
|
extends?: object | `adapter.${string}` | `orchestrator.${string}`;
|
|
17777
|
-
activeConfig
|
|
17778
|
-
init
|
|
17779
|
-
start
|
|
17780
|
-
ready
|
|
17781
|
-
stop
|
|
17782
|
-
|
|
17783
|
-
|
|
17784
|
-
|
|
17785
|
-
|
|
17786
|
-
|
|
17787
|
-
|
|
17788
|
-
|
|
17789
|
-
|
|
17790
|
-
|
|
17791
|
-
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
|
|
17797
|
-
|
|
17798
|
-
|
|
17799
|
-
|
|
17800
|
-
|
|
17801
|
-
getConversion?: (this: ReturnType<IAdapterFactory<T, C>>, $meta: IMeta, type: "send" | "receive") => {
|
|
18057
|
+
activeConfig?(this: Adapter<T, C>): Partial<Config<T, C>>;
|
|
18058
|
+
init?(this: Adapter<T, C>, ...config: unknown[]): Promise<unknown>;
|
|
18059
|
+
start?(this: Adapter<T, C>, ...params: unknown[]): Promise<unknown>;
|
|
18060
|
+
ready?(this: Adapter<T, C>): Promise<unknown>;
|
|
18061
|
+
stop?(this: Adapter<T, C>, ...params: unknown[]): Promise<unknown>;
|
|
18062
|
+
link?(this: Adapter<T, C>, patterns: (string | RegExp)[] | string | RegExp, target: object): Promise<{
|
|
18063
|
+
importedMap?: Map<string, object>;
|
|
18064
|
+
imported?: object;
|
|
18065
|
+
config?: {
|
|
18066
|
+
namespace?: string | string[];
|
|
18067
|
+
};
|
|
18068
|
+
}>;
|
|
18069
|
+
connected?(this: Adapter<T, C>): Promise<boolean>;
|
|
18070
|
+
error?(error: unknown, $meta: unknown): void;
|
|
18071
|
+
pack?(this: Adapter<T, C>, ...params: unknown[]): unknown;
|
|
18072
|
+
unpackSize?(this: Adapter<T, C>, ...params: unknown[]): unknown;
|
|
18073
|
+
unpack?(this: Adapter<T, C>, ...params: unknown[]): unknown;
|
|
18074
|
+
encode?(data: unknown, $meta: unknown, context: unknown, log: unknown): Promise<string | Buffer>;
|
|
18075
|
+
decode?(buff: string | Buffer, $meta: unknown, context: unknown, log: unknown): Promise<object[]>;
|
|
18076
|
+
request?(...params: unknown[]): Promise<unknown>;
|
|
18077
|
+
publish?(): Promise<unknown>;
|
|
18078
|
+
drain?(): void;
|
|
18079
|
+
findValidation?(this: Adapter<T, C>, $meta: unknown): (...params: unknown[]) => object;
|
|
18080
|
+
getConversion?(this: Adapter<T, C>, $meta: unknown, type: string): {
|
|
17802
18081
|
name: string;
|
|
17803
|
-
fn: () => object
|
|
18082
|
+
fn: (...params: unknown[]) => Promise<object>;
|
|
17804
18083
|
};
|
|
17805
|
-
findHandler
|
|
17806
|
-
handles
|
|
17807
|
-
forNamespaces
|
|
17808
|
-
methodPath
|
|
17809
|
-
dispatch
|
|
17810
|
-
exec
|
|
17811
|
-
bytesSent
|
|
17812
|
-
bytesReceived
|
|
17813
|
-
msgSent
|
|
17814
|
-
msgReceived
|
|
18084
|
+
findHandler?(this: Adapter<T, C>, name: string): () => unknown;
|
|
18085
|
+
handles?(this: Adapter<T, C>, name: string): boolean;
|
|
18086
|
+
forNamespaces?<U>(reducer: (prev: U, current: unknown) => U, initial: U): U;
|
|
18087
|
+
methodPath?(name: string): string;
|
|
18088
|
+
dispatch?(...params: unknown[]): Promise<unknown>;
|
|
18089
|
+
exec?(this: Adapter<T, C>, ...params: unknown[]): Promise<unknown>;
|
|
18090
|
+
bytesSent?(count: number): void;
|
|
18091
|
+
bytesReceived?(count: number): void;
|
|
18092
|
+
msgSent?(count: number): void;
|
|
18093
|
+
msgReceived?(count: number): void;
|
|
17815
18094
|
isConnected?: Promise<boolean>;
|
|
17816
|
-
event
|
|
17817
|
-
handle
|
|
17818
|
-
connect
|
|
17819
|
-
requests: unknown;
|
|
17820
|
-
waiting: unknown;
|
|
17821
|
-
buffer: unknown;
|
|
17822
|
-
}) => void;
|
|
18095
|
+
event?(name: string, params?: unknown): Promise<object>;
|
|
18096
|
+
handle?(...params: unknown[]): Promise<unknown>;
|
|
18097
|
+
connect?(what: unknown, context: unknown): void;
|
|
17823
18098
|
/**
|
|
17824
18099
|
* Optional lifecycle hook called when configuration changes.
|
|
17825
18100
|
* When present, the framework calls this instead of a full stop+start cycle.
|
|
@@ -17831,15 +18106,24 @@ export interface IAdapter<T, C> {
|
|
|
17831
18106
|
* @param next The full new effective config snapshot (via proxy)
|
|
17832
18107
|
* @param prev The full previous effective config snapshot
|
|
17833
18108
|
*/
|
|
17834
|
-
configChanged
|
|
17835
|
-
|
|
17836
|
-
|
|
17837
|
-
}>, next: object, prev: object) => Promise<void>;
|
|
18109
|
+
configChanged?(this: Adapter<T, C>, diff: unknown, next: unknown, prev?: unknown): Promise<void>;
|
|
18110
|
+
/** Allow arbitrary extra methods on adapter definitions (e.g. authenticate) */
|
|
18111
|
+
[key: string]: unknown;
|
|
17838
18112
|
}
|
|
17839
18113
|
export interface IAdapterFactory<T = Record<string, unknown>, C = Record<string, unknown>> {
|
|
17840
18114
|
config?: Config<T, C> | false;
|
|
17841
18115
|
(api: IApi): IAdapter<T, C>;
|
|
17842
18116
|
}
|
|
18117
|
+
export interface IAdapterRegistry {
|
|
18118
|
+
config: unknown;
|
|
18119
|
+
(api: {
|
|
18120
|
+
utError: IError;
|
|
18121
|
+
remote: IRemote;
|
|
18122
|
+
rpc: IRpcServer;
|
|
18123
|
+
local: ILocal;
|
|
18124
|
+
registry: IRegistry;
|
|
18125
|
+
}): Promise<Adapter>;
|
|
18126
|
+
}
|
|
17843
18127
|
export interface IMeta {
|
|
17844
18128
|
mtid?: "request" | "response" | "error" | "notification" | "discard" | "event";
|
|
17845
18129
|
request?: IMeta;
|
|
@@ -17851,7 +18135,7 @@ export interface IMeta {
|
|
|
17851
18135
|
expect?: string[] | string;
|
|
17852
18136
|
opcode?: string;
|
|
17853
18137
|
source?: string;
|
|
17854
|
-
forward?:
|
|
18138
|
+
forward?: Record<string, string>;
|
|
17855
18139
|
httpResponse?: {
|
|
17856
18140
|
type?: string;
|
|
17857
18141
|
redirect?: string;
|
|
@@ -17900,14 +18184,14 @@ export interface IMeta {
|
|
|
17900
18184
|
deviceId?: string | string[];
|
|
17901
18185
|
latitude?: string | string[];
|
|
17902
18186
|
longitude?: string | string[];
|
|
17903
|
-
conId?: number;
|
|
18187
|
+
conId?: string | number;
|
|
17904
18188
|
dispatch?: (msg?: object, $meta?: IMeta) => [
|
|
17905
18189
|
msg: object,
|
|
17906
18190
|
$meta: IMeta
|
|
17907
18191
|
] | boolean | void | Promise<boolean>;
|
|
17908
18192
|
reply?: unknown;
|
|
17909
|
-
timeout?:
|
|
17910
|
-
timer?: (name?: string, newTime?: HRTime |
|
|
18193
|
+
timeout?: HRTime;
|
|
18194
|
+
timer?: (name?: string, newTime?: HRTime | undefined) => {
|
|
17911
18195
|
[name: string]: number;
|
|
17912
18196
|
};
|
|
17913
18197
|
gateway?: object;
|
|
@@ -17920,24 +18204,20 @@ export interface IMeta {
|
|
|
17920
18204
|
timestamp: number;
|
|
17921
18205
|
}>;
|
|
17922
18206
|
}
|
|
17923
|
-
export type HRTime = [
|
|
17924
|
-
number,
|
|
17925
|
-
number
|
|
17926
|
-
];
|
|
17927
18207
|
export interface IContext {
|
|
17928
|
-
trace: number;
|
|
17929
18208
|
session?: {
|
|
17930
18209
|
[name: string]: unknown;
|
|
17931
18210
|
};
|
|
17932
|
-
conId?: string;
|
|
18211
|
+
conId?: string | number;
|
|
17933
18212
|
requests: Map<string, {
|
|
17934
18213
|
$meta: IMeta;
|
|
17935
|
-
end
|
|
18214
|
+
end?: (error: Error) => {
|
|
17936
18215
|
local: object;
|
|
17937
18216
|
literals: object[];
|
|
17938
18217
|
};
|
|
17939
18218
|
}>;
|
|
17940
18219
|
waiting: Set<(error: Error) => void>;
|
|
18220
|
+
buffer?: Buffer;
|
|
17941
18221
|
}
|
|
17942
18222
|
export interface ITypedError extends Error {
|
|
17943
18223
|
type: string;
|
|
@@ -17991,7 +18271,8 @@ export interface IModuleConfig<T extends TSchema = TNever> {
|
|
|
17991
18271
|
url: string;
|
|
17992
18272
|
config?: IActivationConfig<Partial<Static<T>> & Partial<Static<IBaseConfig>>>;
|
|
17993
18273
|
validation?: T;
|
|
17994
|
-
children?: (string | (() => Promise<object>))[] | ((layer: ModuleApi) => unknown)[]
|
|
18274
|
+
children?: (string | (() => Promise<object>))[] | ((layer: ModuleApi) => unknown)[] | Record<string, () => Promise<unknown>>;
|
|
18275
|
+
glob?: Record<string, () => Promise<object>>;
|
|
17995
18276
|
}
|
|
17996
18277
|
export interface ILogger {
|
|
17997
18278
|
trace?: LogFn;
|
|
@@ -18054,9 +18335,16 @@ export interface ILib {
|
|
|
18054
18335
|
name: string;
|
|
18055
18336
|
};
|
|
18056
18337
|
assert: typeof Assert | undefined;
|
|
18338
|
+
yaml: {
|
|
18339
|
+
parse: <T>(source: string, options?: unknown) => T;
|
|
18340
|
+
parseAllDocuments: <T>(source: string, options?: unknown) => T;
|
|
18341
|
+
parseDocument: <T>(source: string, options?: unknown) => T;
|
|
18342
|
+
stringify: (value: unknown, options?: unknown) => string;
|
|
18343
|
+
};
|
|
18057
18344
|
ulid: () => string;
|
|
18058
18345
|
uuid4: () => string;
|
|
18059
18346
|
uuid7: () => string;
|
|
18347
|
+
timing: IPlatformApi["timing"];
|
|
18060
18348
|
setProperty: (obj: Record<string, unknown>, path: string, value: unknown) => void;
|
|
18061
18349
|
merge<T, S1>(target: T, source: S1): T & S1;
|
|
18062
18350
|
merge<T, S1, S2>(target: T, source1: S1, source2: S2): T & S1 & S2;
|
|
@@ -18084,8 +18372,10 @@ export type ApiDefinition = (blong: IValidationProxy) => {
|
|
|
18084
18372
|
} | {
|
|
18085
18373
|
url: string;
|
|
18086
18374
|
};
|
|
18087
|
-
export type PortHandler<T, C> = <R>(this:
|
|
18088
|
-
export type PortHandlerBound = <T>(params:
|
|
18375
|
+
export type PortHandler<T, C> = <R>(this: Adapter<T, C>, params: object, $meta: IMeta, context?: IContext) => Promise<R> | R;
|
|
18376
|
+
export type PortHandlerBound = (<T>(params: object, $meta: IMeta, context?: IContext) => Promise<T> | T) & {
|
|
18377
|
+
[name: string]: PortHandlerBound;
|
|
18378
|
+
};
|
|
18089
18379
|
export type LibFn = <T>(...params: unknown[]) => T;
|
|
18090
18380
|
export interface IRemoteHandler {
|
|
18091
18381
|
[name: string]: PortHandlerBound;
|
|
@@ -18120,6 +18410,7 @@ export interface IHandlerProxy<T> {
|
|
|
18120
18410
|
};
|
|
18121
18411
|
};
|
|
18122
18412
|
};
|
|
18413
|
+
apiSchema: IApiSchema;
|
|
18123
18414
|
}
|
|
18124
18415
|
export type ImportProxyCallback<T, C> = (blong: IHandlerProxy<T>) => PortHandler<T, C> | IAdapterFactory<T, C> | Record<string, PortHandler<T, C>>;
|
|
18125
18416
|
export type Definition<T, C> = object | ImportProxyCallback<T, C> | ImportProxyCallback<T, C>[];
|
|
@@ -18147,11 +18438,11 @@ export declare abstract class Internal {
|
|
|
18147
18438
|
#private;
|
|
18148
18439
|
protected log?: ReturnType<ILog["logger"]>;
|
|
18149
18440
|
constructor(api?: {
|
|
18150
|
-
log
|
|
18441
|
+
log?: ILog;
|
|
18151
18442
|
});
|
|
18152
18443
|
protected merge: ILib["merge"];
|
|
18153
18444
|
stop(): Promise<unknown>;
|
|
18154
|
-
start(...
|
|
18445
|
+
start(..._args: unknown[]): Promise<unknown>;
|
|
18155
18446
|
}
|
|
18156
18447
|
export declare const handler: <T = Record<string, unknown>, C = AdapterContext>(definition: Definition<T, C>) => Definition<T, C>;
|
|
18157
18448
|
/**
|
|
@@ -18162,21 +18453,13 @@ export declare const handler: <T = Record<string, unknown>, C = AdapterContext>(
|
|
|
18162
18453
|
* The inner function should return a map whose keys are dot-notation method names
|
|
18163
18454
|
* (e.g. `'coral.browse'`) and values are async functions that return component
|
|
18164
18455
|
* metadata `{title, permission, icon, component: async () => ReactComponent}`.
|
|
18165
|
-
*
|
|
18166
|
-
* @example
|
|
18167
|
-
* ```ts
|
|
18168
|
-
* export default componentHandler(blong => function coralBrowse() {
|
|
18169
|
-
* return {
|
|
18170
|
-
* 'coral.browse': async () => ({
|
|
18171
|
-
* title: 'Browse Corals',
|
|
18172
|
-
* permission: 'marine.coral.browse',
|
|
18173
|
-
* component: async () => (await import('./CoralBrowse.js')).default,
|
|
18174
|
-
* }),
|
|
18175
|
-
* };
|
|
18176
|
-
* });
|
|
18177
|
-
* ```
|
|
18178
18456
|
*/
|
|
18179
|
-
export
|
|
18457
|
+
export interface IComponent {
|
|
18458
|
+
title?: string;
|
|
18459
|
+
permission?: string;
|
|
18460
|
+
icon?: string;
|
|
18461
|
+
component: (params?: Record<string, unknown>) => Promise<unknown>;
|
|
18462
|
+
}
|
|
18180
18463
|
/** Action definition for use with `defineActions`. */
|
|
18181
18464
|
export interface IActionDef {
|
|
18182
18465
|
title?: string;
|
|
@@ -18216,30 +18499,32 @@ export declare const defineActions: (actions: Record<string, IActionDef>) => ((_
|
|
|
18216
18499
|
export declare const library: <T = Record<string, unknown>>(definition: Lib<T>) => Lib<T>;
|
|
18217
18500
|
export declare const validation: (validation: ValidationDefinition) => ValidationDefinition;
|
|
18218
18501
|
export declare const api: (api: ApiDefinition) => ApiDefinition;
|
|
18502
|
+
export declare const model: <T extends IModelSpec>(definition: () => () => Promise<T>) => (() => () => Promise<T>);
|
|
18503
|
+
export declare const fixture: <T extends IMock>(definition: () => T) => (() => T);
|
|
18219
18504
|
export declare const validationHandlers: (handlers: Record<string, TFunction<[
|
|
18220
18505
|
ApiSchema
|
|
18221
18506
|
]>>) => ValidationDefinition;
|
|
18222
|
-
export declare const realm: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18223
|
-
export declare const server: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18224
|
-
export declare const browser: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18225
|
-
export declare const layer: (activation: Record<string, boolean | object>) => Record<string, boolean | object
|
|
18226
|
-
export declare const adapter: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C
|
|
18227
|
-
export declare const orchestrator: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C
|
|
18228
|
-
export type Kinds = "lib" | "validation" | "api" | "solution" | "server" | "browser" | "adapter" | "orchestrator" | "handler";
|
|
18229
|
-
export declare const kind: (what: {}) => Kinds
|
|
18507
|
+
export declare const realm: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18508
|
+
export declare const server: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18509
|
+
export declare const browser: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18510
|
+
export declare const layer: (activation: Record<string, boolean | object>) => Record<string, boolean | object> & {};
|
|
18511
|
+
export declare const adapter: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C> & {};
|
|
18512
|
+
export declare const orchestrator: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C> & {};
|
|
18513
|
+
export type Kinds = "lib" | "validation" | "api" | "solution" | "server" | "browser" | "adapter" | "orchestrator" | "handler" | "model" | "fixture" | "";
|
|
18514
|
+
export declare const kind: (what: {}) => Kinds;
|
|
18230
18515
|
declare const _default: {
|
|
18231
18516
|
handler: <T = Record<string, unknown>, C = AdapterContext>(definition: Definition<T, C>) => Definition<T, C>;
|
|
18232
|
-
componentHandler: <T = Record<string, unknown>, C = AdapterContext>(definition: Definition<T, C>) => Definition<T, C>;
|
|
18233
18517
|
defineActions: (actions: Record<string, IActionDef>) => ((_blong: unknown) => Record<string, () => IActionDef>);
|
|
18234
18518
|
library: <T = Record<string, unknown>>(definition: Lib<T>) => Lib<T>;
|
|
18235
18519
|
validation: (validation: ValidationDefinition) => ValidationDefinition;
|
|
18236
18520
|
api: (api: ApiDefinition) => ApiDefinition;
|
|
18237
|
-
realm: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18238
|
-
server: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18239
|
-
browser: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18240
|
-
adapter: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C
|
|
18241
|
-
orchestrator: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C
|
|
18242
|
-
|
|
18521
|
+
realm: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18522
|
+
server: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18523
|
+
browser: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18524
|
+
adapter: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C> & {};
|
|
18525
|
+
orchestrator: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C> & {};
|
|
18526
|
+
fixture: <T extends IMock>(definition: () => T) => (() => T);
|
|
18527
|
+
kind: (what: {}) => Kinds;
|
|
18243
18528
|
};
|
|
18244
18529
|
|
|
18245
18530
|
export {
|