@feasibleone/blong 1.17.0 → 1.18.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 +21 -0
- package/dist/model.js +0 -8
- package/dist/model.js.map +1 -1
- package/dist/types.d.ts +436 -100
- package/dist/types.js +18 -7
- package/dist/types.js.map +1 -1
- package/dist/widget.js +2 -0
- package/dist/widget.js.map +1 -0
- package/package.json +4 -1
- package/types.ts +166 -101
package/dist/types.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { Dirent, StatSyncFn } from 'node:fs';
|
|
|
9
9
|
import { Agent } from 'node:http';
|
|
10
10
|
import { Duplex } from 'node:stream';
|
|
11
11
|
import { Level, LogFn, Logger as PinoLogger } from 'pino';
|
|
12
|
+
import React$1 from 'react';
|
|
12
13
|
import { Readable, Writable } from 'stream';
|
|
13
14
|
import { ConnectionOptions as ConnectionOptions_2, TLSSocket, TLSSocketOptions } from 'tls';
|
|
14
15
|
import { Static, TArray, TBoolean, TFunction, TNever, TNumber, TObject, TSchema, TString, TUnknown, Type } from 'typebox';
|
|
@@ -17574,6 +17575,335 @@ declare namespace DeferredKeySelection {
|
|
|
17574
17575
|
}
|
|
17575
17576
|
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>;
|
|
17576
17577
|
export type ResolveResult<S> = DeferredKeySelection.Resolve<S>;
|
|
17578
|
+
/** All supported widget types */
|
|
17579
|
+
export type WidgetType = "input" | "mask" | "text" | "textArea" | "password" | "number" | "integer" | "currency" | "percent" | "boolean" | "checkbox" | "switch" | "date" | "time" | "dateTime" | "dateRange" | "dropdown" | "dropdownTree" | "select" | "selectTable" | "multiSelect" | "multiSelectTree" | "multiSelectPanel" | "multiSelectTreeTable" | "chips" | "file" | "image" | "imageUpload" | "autocomplete" | "table" | "navigator" | "json" | "code" | "divider" | "label" | "link" | "custom";
|
|
17580
|
+
/** Base widget configuration (stored in schema x-widget) */
|
|
17581
|
+
export interface IWidgetConfig {
|
|
17582
|
+
type: WidgetType;
|
|
17583
|
+
/** For dropdown/multiSelect — action name to fetch options */
|
|
17584
|
+
fetch?: string;
|
|
17585
|
+
/** Named dropdown key — loads options via portal.dropdown.list */
|
|
17586
|
+
dropdown?: string;
|
|
17587
|
+
/** Options list for static select/multiSelect/select/tree widgets.
|
|
17588
|
+
* Flat options use `{value, label}`. TreeNode-style options use `{key, label, children}`. */
|
|
17589
|
+
options?: Array<{
|
|
17590
|
+
value?: unknown;
|
|
17591
|
+
label?: string;
|
|
17592
|
+
icon?: string;
|
|
17593
|
+
key?: string | number;
|
|
17594
|
+
children?: unknown[];
|
|
17595
|
+
[extra: string]: unknown;
|
|
17596
|
+
}>;
|
|
17597
|
+
/** Parent field name for cascaded dropdowns/tables (supports '$.selected.field' or just 'field') */
|
|
17598
|
+
parent?: string;
|
|
17599
|
+
/** Key mapping for cascaded table filtering: {ownKey: parentKey} */
|
|
17600
|
+
master?: Record<string, string>;
|
|
17601
|
+
/** Auto-select first filtered row when parent selection changes */
|
|
17602
|
+
autoSelect?: boolean;
|
|
17603
|
+
/** Copy-to-clipboard icon (input widget) */
|
|
17604
|
+
copy?: boolean;
|
|
17605
|
+
/** Mask pattern (mask widget) */
|
|
17606
|
+
mask?: string;
|
|
17607
|
+
/** Column definitions for table widget */
|
|
17608
|
+
columns?: string[] | Record<string, IFieldConfig>;
|
|
17609
|
+
/** Pivot config for static or dynamic pivots */
|
|
17610
|
+
pivot?: IPivotConfig;
|
|
17611
|
+
/** Field names to hide in table (used as implicit keys) */
|
|
17612
|
+
hidden?: string[];
|
|
17613
|
+
/** Selection mode for table widget */
|
|
17614
|
+
selectionMode?: "single" | "multiple";
|
|
17615
|
+
/** Label shown inside the widget (e.g. as table toolbar title instead of field label) */
|
|
17616
|
+
label?: string;
|
|
17617
|
+
/** Label field name in fetched options */
|
|
17618
|
+
labelField?: string;
|
|
17619
|
+
/** Value field name in fetched options */
|
|
17620
|
+
valueField?: string;
|
|
17621
|
+
/** Render this widget in read-only display mode regardless of card/form edit-ability */
|
|
17622
|
+
readOnly?: boolean;
|
|
17623
|
+
/** Custom component type (for 'custom' type) */
|
|
17624
|
+
component?: React$1.ComponentType<IWidgetProps>;
|
|
17625
|
+
/** Table action permissions */
|
|
17626
|
+
actions?: {
|
|
17627
|
+
allowAdd?: boolean;
|
|
17628
|
+
allowDelete?: boolean;
|
|
17629
|
+
allowEdit?: boolean;
|
|
17630
|
+
allowSelect?: boolean;
|
|
17631
|
+
};
|
|
17632
|
+
/** Whether to show the inline editor directly inside the cell (boolean/dropdown) */
|
|
17633
|
+
inlineEdit?: boolean;
|
|
17634
|
+
/** Accepted file types (file/imageUpload widgets) */
|
|
17635
|
+
accept?: string;
|
|
17636
|
+
/** Maximum file size in bytes (file/image widgets) */
|
|
17637
|
+
maxSize?: number;
|
|
17638
|
+
/** Base URL prefix for image display (image/imageUpload widgets) */
|
|
17639
|
+
basePath?: string;
|
|
17640
|
+
/** Exclude boundary times (dateRange widget: end = 23:59:59 instead of 00:00:00 next day) */
|
|
17641
|
+
exclusive?: boolean;
|
|
17642
|
+
/** Show time-only pickers (dateRange/time widget) */
|
|
17643
|
+
timeOnly?: boolean;
|
|
17644
|
+
/**
|
|
17645
|
+
* Action name to load list data from the server (table + navigator widgets).
|
|
17646
|
+
* When set, the widget manages its own data loading, pagination, search, and
|
|
17647
|
+
* sort independently of the react-hook-form value.
|
|
17648
|
+
*/
|
|
17649
|
+
listAction?: string;
|
|
17650
|
+
/** Static params merged into every `listAction` call */
|
|
17651
|
+
listParams?: Record<string, unknown>;
|
|
17652
|
+
/**
|
|
17653
|
+
* Property name in the `listAction` response that contains the rows array.
|
|
17654
|
+
* Defaults to `'items'`. Set to `''` to use the response directly as an array.
|
|
17655
|
+
*/
|
|
17656
|
+
resultSet?: string;
|
|
17657
|
+
/** Initial rows per page for listAction mode (default 25) */
|
|
17658
|
+
pageSize?: number;
|
|
17659
|
+
/**
|
|
17660
|
+
* Primary key field name in row data — used for template resolution (`${id}`)
|
|
17661
|
+
* and for the DataTable `dataKey`. Defaults to `'id'`.
|
|
17662
|
+
*/
|
|
17663
|
+
keyField?: string;
|
|
17664
|
+
/** Parent key field for navigator tree building (default 'parentId') */
|
|
17665
|
+
parentField?: string;
|
|
17666
|
+
/**
|
|
17667
|
+
* Custom toolbar buttons (left side). Support `${id}`, `${current}`, `${selected}`,
|
|
17668
|
+
* and `${current.field}` template resolution and `enabled: 'current' | 'selected'`.
|
|
17669
|
+
*/
|
|
17670
|
+
toolbar?: IWidgetToolbarButton[];
|
|
17671
|
+
/** Custom toolbar buttons (right side) */
|
|
17672
|
+
toolbarRight?: IWidgetToolbarButton[];
|
|
17673
|
+
}
|
|
17674
|
+
/**
|
|
17675
|
+
* Toolbar button for widget-level toolbars (table, navigator).
|
|
17676
|
+
* Similar to IToolbarButton but scoped to widget-level row context.
|
|
17677
|
+
*/
|
|
17678
|
+
export interface IWidgetToolbarButton {
|
|
17679
|
+
label?: string;
|
|
17680
|
+
icon?: string;
|
|
17681
|
+
/** Direct RPC method name called via dispatch */
|
|
17682
|
+
method?: string;
|
|
17683
|
+
permission?: string;
|
|
17684
|
+
/** Confirmation dialog message before invoking */
|
|
17685
|
+
confirm?: string;
|
|
17686
|
+
/** Enabled condition based on current row selection */
|
|
17687
|
+
enabled?: boolean | "current" | "selected";
|
|
17688
|
+
/**
|
|
17689
|
+
* Params passed to the method. Supports template strings:
|
|
17690
|
+
* `${id}` → keyField value, `${current}` → current row,
|
|
17691
|
+
* `${selected}` → selected rows array, `${current.field}` → field of current row.
|
|
17692
|
+
*/
|
|
17693
|
+
params?: Record<string, unknown> | string;
|
|
17694
|
+
/** Success hint text shown as overlay near the button after the action completes */
|
|
17695
|
+
successHint?: string;
|
|
17696
|
+
}
|
|
17697
|
+
/** Pivot config for table widget */
|
|
17698
|
+
export interface IPivotConfig {
|
|
17699
|
+
/** Static pivot: fixed row examples */
|
|
17700
|
+
examples?: Record<string, unknown>[];
|
|
17701
|
+
/** Dynamic pivot: field name of the dropdown whose options feed the rows */
|
|
17702
|
+
dropdown?: string;
|
|
17703
|
+
/** Key mapping from examples/options to data array */
|
|
17704
|
+
join: {
|
|
17705
|
+
example?: string;
|
|
17706
|
+
option?: string;
|
|
17707
|
+
item: string;
|
|
17708
|
+
};
|
|
17709
|
+
}
|
|
17710
|
+
/** Object entry in a card's widget list — renders the named array field as a table, showing only the specified columns */
|
|
17711
|
+
export interface ICardWidgetEntry {
|
|
17712
|
+
/** Field name from the schema (must be a table/array field) */
|
|
17713
|
+
name: string;
|
|
17714
|
+
/** Unique render key (allows showing the same field multiple times with different column subsets) */
|
|
17715
|
+
id: string;
|
|
17716
|
+
/** Column names from the field's items.properties to display */
|
|
17717
|
+
widgets: string[];
|
|
17718
|
+
}
|
|
17719
|
+
/** Field configuration within a card */
|
|
17720
|
+
export interface IFieldConfig {
|
|
17721
|
+
title?: string;
|
|
17722
|
+
widget?: Partial<IWidgetConfig>;
|
|
17723
|
+
readOnly?: boolean;
|
|
17724
|
+
hidden?: boolean;
|
|
17725
|
+
required?: boolean;
|
|
17726
|
+
}
|
|
17727
|
+
/** Card configuration */
|
|
17728
|
+
export interface ICardConfig {
|
|
17729
|
+
label?: string;
|
|
17730
|
+
/** Field list for this card (preferred alias: widgets) */
|
|
17731
|
+
fields?: Record<string, IFieldConfig> | string[];
|
|
17732
|
+
/** Alias for fields — supports plain field names or ICardWidgetEntry objects for column-subset table views */
|
|
17733
|
+
widgets?: (string | ICardWidgetEntry)[];
|
|
17734
|
+
className?: string;
|
|
17735
|
+
readOnly?: boolean;
|
|
17736
|
+
collapsible?: boolean;
|
|
17737
|
+
loading?: boolean;
|
|
17738
|
+
/** When true: card is not shown visually; fields render as hidden inputs */
|
|
17739
|
+
hidden?: boolean;
|
|
17740
|
+
/** Permission key required to display this card. If set and no checkPermission
|
|
17741
|
+
* callback is provided (or it returns false), the card is not rendered. */
|
|
17742
|
+
permission?: string;
|
|
17743
|
+
/** Watch path for reactive cards (e.g. '$.selected.personTable') */
|
|
17744
|
+
watch?: string;
|
|
17745
|
+
/** Match condition to show polymorphic detail cards */
|
|
17746
|
+
match?: Record<string, unknown>;
|
|
17747
|
+
/** Parent table path for master-detail */
|
|
17748
|
+
parent?: string;
|
|
17749
|
+
/** Master-detail key mapping */
|
|
17750
|
+
master?: Record<string, string>;
|
|
17751
|
+
autoSelect?: boolean;
|
|
17752
|
+
}
|
|
17753
|
+
/** Props that every widget component receives */
|
|
17754
|
+
export interface IWidgetProps {
|
|
17755
|
+
/** Field id — forwarded to the inner control for label/id association (same value as name) */
|
|
17756
|
+
id?: string;
|
|
17757
|
+
name: string;
|
|
17758
|
+
schema: IEnrichedFieldSchema;
|
|
17759
|
+
value: unknown;
|
|
17760
|
+
onChange: (value: unknown) => void;
|
|
17761
|
+
onBlur: () => void;
|
|
17762
|
+
error?: {
|
|
17763
|
+
message?: string;
|
|
17764
|
+
};
|
|
17765
|
+
readOnly?: boolean;
|
|
17766
|
+
loading?: boolean;
|
|
17767
|
+
disabled?: boolean;
|
|
17768
|
+
/** All current form values — enables inter-widget reactivity (cascaded dropdowns etc.) */
|
|
17769
|
+
formValues?: Record<string, unknown>;
|
|
17770
|
+
/**
|
|
17771
|
+
* Called by table widgets when a row is selected (selectionMode: 'single').
|
|
17772
|
+
* Passes null when the selection is cleared.
|
|
17773
|
+
*/
|
|
17774
|
+
onSelect?: (name: string, selection: {
|
|
17775
|
+
row: Record<string, unknown>;
|
|
17776
|
+
index: number;
|
|
17777
|
+
} | null) => void;
|
|
17778
|
+
/** Dropdown option maps — keyed by dropdown name, each value is the options array.
|
|
17779
|
+
* Passed to TableWidget so column-level dropdown schemas can resolve their options. */
|
|
17780
|
+
dropdowns?: Record<string, unknown[]>;
|
|
17781
|
+
}
|
|
17782
|
+
/** Widget registry interface */
|
|
17783
|
+
export interface IWidgetRegistry {
|
|
17784
|
+
register(type: string, component: React$1.ComponentType<IWidgetProps>): void;
|
|
17785
|
+
get(type: string): React$1.ComponentType<IWidgetProps> | undefined;
|
|
17786
|
+
list(): string[];
|
|
17787
|
+
}
|
|
17788
|
+
/** Enriched field schema — normalized JSON Schema with widget config */
|
|
17789
|
+
export interface IEnrichedFieldSchema {
|
|
17790
|
+
title?: string;
|
|
17791
|
+
type?: string;
|
|
17792
|
+
/** JSON Schema format (e.g. 'date', 'date-time', 'email') */
|
|
17793
|
+
format?: string;
|
|
17794
|
+
description?: string;
|
|
17795
|
+
/** Placeholder text for input widgets */
|
|
17796
|
+
placeholder?: string;
|
|
17797
|
+
minLength?: number;
|
|
17798
|
+
maxLength?: number;
|
|
17799
|
+
minimum?: number;
|
|
17800
|
+
maximum?: number;
|
|
17801
|
+
pattern?: string;
|
|
17802
|
+
enum?: unknown[];
|
|
17803
|
+
readOnly?: boolean;
|
|
17804
|
+
required?: boolean;
|
|
17805
|
+
/** Normalized widget config */
|
|
17806
|
+
widget?: IWidgetConfig;
|
|
17807
|
+
/** Nested object properties — for composite/grouped fields accessed via dot-notation paths */
|
|
17808
|
+
properties?: Record<string, IEnrichedFieldSchema>;
|
|
17809
|
+
/** JSON Schema items — describes the shape of array-field rows (used by TableWidget) */
|
|
17810
|
+
items?: {
|
|
17811
|
+
properties?: Record<string, IEnrichedFieldSchema | Record<string, unknown>>;
|
|
17812
|
+
};
|
|
17813
|
+
/** Include field in filter panel */
|
|
17814
|
+
"x-filter"?: boolean;
|
|
17815
|
+
/** Enable inline column filtering (shows filter row in DataTable) */
|
|
17816
|
+
"x-filterable"?: boolean;
|
|
17817
|
+
/** Enable column sorting */
|
|
17818
|
+
"x-sort"?: boolean;
|
|
17819
|
+
/** Action method name — renders the field cell as a clickable link */
|
|
17820
|
+
action?: string;
|
|
17821
|
+
/** Card names to show this field in */
|
|
17822
|
+
"x-cards"?: string[];
|
|
17823
|
+
/** Raw x-widget extension from OpenAPI */
|
|
17824
|
+
"x-widget"?: Partial<IWidgetConfig>;
|
|
17825
|
+
/** Field name */
|
|
17826
|
+
name?: string;
|
|
17827
|
+
}
|
|
17828
|
+
/** Enriched object schema — normalized JSON Schema for an entity */
|
|
17829
|
+
export interface IEnrichedSchema {
|
|
17830
|
+
title?: string;
|
|
17831
|
+
description?: string;
|
|
17832
|
+
properties?: Record<string, IEnrichedFieldSchema>;
|
|
17833
|
+
required?: string[];
|
|
17834
|
+
/** Schema name (e.g. 'model.tree') */
|
|
17835
|
+
name?: string;
|
|
17836
|
+
}
|
|
17837
|
+
/** Extended action reference — action name plus static params override */
|
|
17838
|
+
export interface IActionRef {
|
|
17839
|
+
name: string;
|
|
17840
|
+
params?: Record<string, unknown>;
|
|
17841
|
+
}
|
|
17842
|
+
/** Toolbar button configuration */
|
|
17843
|
+
export interface IToolbarButton {
|
|
17844
|
+
label?: string;
|
|
17845
|
+
icon?: string;
|
|
17846
|
+
/** Action name (string) or extended ref */
|
|
17847
|
+
action?: string | IActionRef;
|
|
17848
|
+
/** Direct RPC method name (bypass action registry) */
|
|
17849
|
+
method?: string;
|
|
17850
|
+
permission?: string;
|
|
17851
|
+
/** Trigger form submit before invoking */
|
|
17852
|
+
submit?: boolean;
|
|
17853
|
+
/** Confirmation dialog message before invoking */
|
|
17854
|
+
confirm?: string;
|
|
17855
|
+
/** Enabled condition */
|
|
17856
|
+
enabled?: boolean | "dirty" | "clean" | "current" | "selected";
|
|
17857
|
+
visible?: boolean;
|
|
17858
|
+
align?: "left" | "right";
|
|
17859
|
+
/** Split-button sub-items */
|
|
17860
|
+
menu?: IToolbarButton[];
|
|
17861
|
+
/** Extra params passed to the action/method on invocation.
|
|
17862
|
+
* May be a plain object or a string template using `${field}`, `${current}`,
|
|
17863
|
+
* `${selected}` and `${current.field}` syntax for row-context interpolation. */
|
|
17864
|
+
params?: Record<string, unknown> | string;
|
|
17865
|
+
/** Success hint text shown in an overlay near the button after the action completes */
|
|
17866
|
+
successHint?: string;
|
|
17867
|
+
}
|
|
17868
|
+
export type LayoutRow = string | (string | string[])[];
|
|
17869
|
+
export type FlatLayoutConfig = LayoutRow[];
|
|
17870
|
+
/** A single tab/step item in a tab or steps layout */
|
|
17871
|
+
export interface ILayoutTabItem {
|
|
17872
|
+
id: string;
|
|
17873
|
+
label?: string;
|
|
17874
|
+
icon?: string;
|
|
17875
|
+
/** Card names shown in this tab/step. A string is a single-card deck; a string[] is a
|
|
17876
|
+
* multi-card deck where all cards are stacked vertically in the same grid column. */
|
|
17877
|
+
widgets: (string | string[])[];
|
|
17878
|
+
/** Optional React component rendered in place of cards (e.g. Explorer) */
|
|
17879
|
+
component?: React$1.ComponentType;
|
|
17880
|
+
}
|
|
17881
|
+
/** Tab or steps layout (object form) */
|
|
17882
|
+
export interface ITabLayoutConfig {
|
|
17883
|
+
orientation?: "top" | "left" | "bottom" | "right";
|
|
17884
|
+
type?: "steps";
|
|
17885
|
+
items: ILayoutTabItem[];
|
|
17886
|
+
}
|
|
17887
|
+
/** A single panel in a split layout */
|
|
17888
|
+
export interface ISplitLayoutPanel {
|
|
17889
|
+
/** Panel size as percentage (default auto-distributed) */
|
|
17890
|
+
size?: number;
|
|
17891
|
+
/** Minimum size in pixels */
|
|
17892
|
+
minSize?: number;
|
|
17893
|
+
/** Card names rendered in this panel (stacked vertically) */
|
|
17894
|
+
cards: string[];
|
|
17895
|
+
}
|
|
17896
|
+
/**
|
|
17897
|
+
* Split layout — renders cards in resizable side-by-side panels using a Splitter.
|
|
17898
|
+
* Ideal for navigator + table + details explorer-style layouts.
|
|
17899
|
+
*/
|
|
17900
|
+
export interface ISplitLayoutConfig {
|
|
17901
|
+
type: "split";
|
|
17902
|
+
/** Panel orientation: 'horizontal' (default) = side by side, 'vertical' = top/bottom */
|
|
17903
|
+
orientation?: "horizontal" | "vertical";
|
|
17904
|
+
panels: ISplitLayoutPanel[];
|
|
17905
|
+
}
|
|
17906
|
+
export type LayoutConfig = FlatLayoutConfig | ITabLayoutConfig | ISplitLayoutConfig;
|
|
17577
17907
|
/**
|
|
17578
17908
|
* Model system types.
|
|
17579
17909
|
*
|
|
@@ -17665,20 +17995,22 @@ export interface IBrowserConfig {
|
|
|
17665
17995
|
title?: string;
|
|
17666
17996
|
icon?: string;
|
|
17667
17997
|
permission?: IBrowserPermissions;
|
|
17668
|
-
/** Column transformation applied to server fetch params */
|
|
17669
|
-
fetch?: (params: Record<string, unknown>) => Record<string, unknown>;
|
|
17670
17998
|
/** Default filter applied on page open */
|
|
17671
17999
|
filter?: Record<string, unknown>;
|
|
17672
18000
|
/** Result set key to use from server response */
|
|
17673
18001
|
resultSet?: string;
|
|
18002
|
+
/** Extra toolbar buttons */
|
|
18003
|
+
toolbar?: IToolbarButton[];
|
|
18004
|
+
}
|
|
18005
|
+
export interface IBrowserConfigOptional {
|
|
18006
|
+
/** Column transformation applied to server fetch params */
|
|
18007
|
+
fetch?: (params: Record<string, unknown>) => Record<string, unknown>;
|
|
17674
18008
|
/** Whether to show "Create" button */
|
|
17675
18009
|
create?: Array<{
|
|
17676
18010
|
title?: string;
|
|
17677
18011
|
type?: string;
|
|
17678
18012
|
permission?: string;
|
|
17679
18013
|
}>;
|
|
17680
|
-
/** Extra toolbar buttons */
|
|
17681
|
-
toolbar?: unknown[];
|
|
17682
18014
|
}
|
|
17683
18015
|
/** Editor page configuration */
|
|
17684
18016
|
export interface IEditorConfig {
|
|
@@ -17717,18 +18049,15 @@ export interface IModelSpec {
|
|
|
17717
18049
|
/** JSON Schema overlay merged on top of server OpenAPI schema */
|
|
17718
18050
|
schema?: ISchemaOverlay;
|
|
17719
18051
|
/** Named card layout definitions */
|
|
17720
|
-
cards?: Record<string,
|
|
18052
|
+
cards?: Record<string, ICardConfig>;
|
|
17721
18053
|
/** Browse page configuration */
|
|
17722
|
-
browser?: IBrowserConfig;
|
|
18054
|
+
browser?: IBrowserConfig & IBrowserConfigOptional;
|
|
17723
18055
|
/** Editor page configuration */
|
|
17724
18056
|
editor?: IEditorConfig;
|
|
17725
18057
|
/** Report page configuration */
|
|
17726
18058
|
report?: IReportConfig;
|
|
17727
18059
|
/** Tab layouts for editor */
|
|
17728
|
-
layouts?:
|
|
17729
|
-
edit?: ILayoutTab[] | string[];
|
|
17730
|
-
[key: string]: unknown;
|
|
17731
|
-
};
|
|
18060
|
+
layouts?: Record<string, LayoutConfig>;
|
|
17732
18061
|
/** Method name overrides */
|
|
17733
18062
|
methods?: IMethodsConfig;
|
|
17734
18063
|
}
|
|
@@ -17739,9 +18068,7 @@ export interface IResolvedModelSpec extends Required<IModelSpec> {
|
|
|
17739
18068
|
objectTitle: string;
|
|
17740
18069
|
keyField: string;
|
|
17741
18070
|
nameField: string;
|
|
17742
|
-
browser: Required<IBrowserConfig> &
|
|
17743
|
-
permission: IBrowserPermissions;
|
|
17744
|
-
};
|
|
18071
|
+
browser: Required<IBrowserConfig> & IBrowserConfigOptional;
|
|
17745
18072
|
editor: Required<IEditorConfig>;
|
|
17746
18073
|
report: Required<IReportConfig>;
|
|
17747
18074
|
methods: Required<IMethodsConfig>;
|
|
@@ -17801,7 +18128,7 @@ export type ConfigDiff = Map<string, {
|
|
|
17801
18128
|
/** Subscriber callback invoked after a successful reload */
|
|
17802
18129
|
export type ConfigSubscriber = (diff: ConfigDiff, next: object, prev: object) => void | Promise<void>;
|
|
17803
18130
|
/**
|
|
17804
|
-
* Mode used when the config proxy is queried during handler factory
|
|
18131
|
+
* Mode used when the config proxy is queried during handler factory initialization.
|
|
17805
18132
|
*
|
|
17806
18133
|
* - `'throw'` — throw immediately (default; keeps misuse from going unnoticed)
|
|
17807
18134
|
* - `'collect'` — accumulate errors and return them from exitConfigFactoryPhase()
|
|
@@ -17868,6 +18195,7 @@ export interface IPlatformApi {
|
|
|
17868
18195
|
isAfter: (time: HRTime, timeout: HRTime) => boolean;
|
|
17869
18196
|
spare: (time: HRTime, latency?: number) => number;
|
|
17870
18197
|
};
|
|
18198
|
+
configs: string[];
|
|
17871
18199
|
}
|
|
17872
18200
|
export interface IErrorFactory {
|
|
17873
18201
|
get(type?: string): unknown;
|
|
@@ -17968,37 +18296,32 @@ export interface IGateway {
|
|
|
17968
18296
|
export type Handlers = ((params: {
|
|
17969
18297
|
remote: unknown;
|
|
17970
18298
|
lib: object;
|
|
17971
|
-
port: object;
|
|
18299
|
+
port: object | undefined;
|
|
17972
18300
|
local: object;
|
|
17973
18301
|
literals: object[];
|
|
17974
18302
|
gateway: IGateway;
|
|
17975
18303
|
apiSchema: IApiSchema;
|
|
18304
|
+
attachCheckpoint?: (meta: IMeta) => void;
|
|
17976
18305
|
}) => void)[];
|
|
17977
18306
|
export interface IRegistry {
|
|
17978
|
-
start: (configOverride
|
|
18307
|
+
start: (configOverride: object) => Promise<IRegistry>;
|
|
17979
18308
|
test: (tester?: unknown) => Promise<void>;
|
|
17980
18309
|
stop: () => Promise<IRegistry>;
|
|
17981
|
-
ports: Map<string,
|
|
18310
|
+
ports: Map<string, IAdapterRegistry>;
|
|
17982
18311
|
methods: Map<string, Handlers>;
|
|
17983
18312
|
modules: Map<string | symbol, IRegistry[]>;
|
|
17984
|
-
createPort: (id: string) => Promise<
|
|
17985
|
-
getPort: (id: string) =>
|
|
17986
|
-
replaceHandlers: (id: string, handlers:
|
|
18313
|
+
createPort: (id: string) => Promise<Adapter | undefined>;
|
|
18314
|
+
getPort: (id: string) => Adapter | undefined;
|
|
18315
|
+
replaceHandlers: (id: string, handlers: Handlers) => Promise<void>;
|
|
17987
18316
|
loadApi: (id: string, def: {
|
|
17988
18317
|
namespace: Record<string, string | string[]>;
|
|
17989
|
-
}, source
|
|
18318
|
+
}, source: string) => Promise<void>;
|
|
17990
18319
|
connected: () => Promise<boolean>;
|
|
17991
18320
|
}
|
|
17992
18321
|
export interface IApi {
|
|
17993
18322
|
id?: string;
|
|
17994
18323
|
type: typeof Type;
|
|
17995
|
-
adapter: (id: string) =>
|
|
17996
|
-
utError: IError;
|
|
17997
|
-
remote: IRemote;
|
|
17998
|
-
rpc: IRpcServer;
|
|
17999
|
-
local: ILocal;
|
|
18000
|
-
registry: IRegistry;
|
|
18001
|
-
}) => object;
|
|
18324
|
+
adapter: (id: string) => IAdapterRegistry | undefined;
|
|
18002
18325
|
utError: IError;
|
|
18003
18326
|
errors: IErrorFactory;
|
|
18004
18327
|
gateway: unknown;
|
|
@@ -18018,7 +18341,13 @@ export interface IApi {
|
|
|
18018
18341
|
methodId: (name: string) => string;
|
|
18019
18342
|
getPath: (name: string) => string;
|
|
18020
18343
|
importMethod: (methodName: string, options?: object) => (...params: unknown[]) => Promise<unknown>;
|
|
18021
|
-
attachHandlers: (target:
|
|
18344
|
+
attachHandlers: (target: {
|
|
18345
|
+
importedMap?: Map<string, object>;
|
|
18346
|
+
imported: object;
|
|
18347
|
+
config: {
|
|
18348
|
+
namespace?: string | string[];
|
|
18349
|
+
};
|
|
18350
|
+
}, patterns: (string | RegExp)[] | string | RegExp, adapter?: boolean) => unknown;
|
|
18022
18351
|
createLog: ILog["logger"];
|
|
18023
18352
|
attachCheckpoint?: (meta: IMeta) => void;
|
|
18024
18353
|
handlers?: (api: {
|
|
@@ -18042,6 +18371,7 @@ export interface IErrorMap {
|
|
|
18042
18371
|
statusCode?: number;
|
|
18043
18372
|
};
|
|
18044
18373
|
}
|
|
18374
|
+
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">;
|
|
18045
18375
|
export interface IAdapter<T, C> {
|
|
18046
18376
|
validation?: TSchema;
|
|
18047
18377
|
config?: Config<T, C>;
|
|
@@ -18049,55 +18379,50 @@ export interface IAdapter<T, C> {
|
|
|
18049
18379
|
configBase?: string;
|
|
18050
18380
|
log?: ILogger;
|
|
18051
18381
|
errors?: Errors<IErrorMap>;
|
|
18052
|
-
imported?:
|
|
18382
|
+
imported?: Record<string, PortHandlerBound>;
|
|
18053
18383
|
importedMap?: Map<string, IRemoteHandler>;
|
|
18054
18384
|
extends?: object | `adapter.${string}` | `orchestrator.${string}`;
|
|
18055
|
-
activeConfig
|
|
18056
|
-
init
|
|
18057
|
-
start
|
|
18058
|
-
ready
|
|
18059
|
-
stop
|
|
18060
|
-
|
|
18061
|
-
|
|
18062
|
-
|
|
18063
|
-
|
|
18064
|
-
|
|
18065
|
-
|
|
18066
|
-
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
|
|
18070
|
-
|
|
18071
|
-
|
|
18072
|
-
|
|
18073
|
-
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18079
|
-
getConversion?: (this: ReturnType<IAdapterFactory<T, C>>, $meta: IMeta, type: "send" | "receive") => {
|
|
18385
|
+
activeConfig?(this: Adapter<T, C>): Partial<Config<T, C>>;
|
|
18386
|
+
init?(this: Adapter<T, C>, ...config: unknown[]): Promise<unknown>;
|
|
18387
|
+
start?(this: Adapter<T, C>, ...params: unknown[]): Promise<unknown>;
|
|
18388
|
+
ready?(this: Adapter<T, C>): Promise<unknown>;
|
|
18389
|
+
stop?(this: Adapter<T, C>, ...params: unknown[]): Promise<unknown>;
|
|
18390
|
+
link?(this: Adapter<T, C>, patterns: (string | RegExp)[] | string | RegExp, target: object): Promise<{
|
|
18391
|
+
importedMap?: Map<string, object>;
|
|
18392
|
+
imported?: object;
|
|
18393
|
+
config?: {
|
|
18394
|
+
namespace?: string | string[];
|
|
18395
|
+
};
|
|
18396
|
+
}>;
|
|
18397
|
+
connected?(this: Adapter<T, C>): Promise<boolean>;
|
|
18398
|
+
error?(error: unknown, $meta: unknown): void;
|
|
18399
|
+
pack?(this: Adapter<T, C>, ...params: unknown[]): unknown;
|
|
18400
|
+
unpackSize?(this: Adapter<T, C>, ...params: unknown[]): unknown;
|
|
18401
|
+
unpack?(this: Adapter<T, C>, ...params: unknown[]): unknown;
|
|
18402
|
+
encode?(data: unknown, $meta: unknown, context: unknown, log: unknown): Promise<string | Buffer>;
|
|
18403
|
+
decode?(buff: string | Buffer, $meta: unknown, context: unknown, log: unknown): Promise<object[]>;
|
|
18404
|
+
request?(...params: unknown[]): Promise<unknown>;
|
|
18405
|
+
publish?(): Promise<unknown>;
|
|
18406
|
+
drain?(): void;
|
|
18407
|
+
findValidation?(this: Adapter<T, C>, $meta: unknown): (...params: unknown[]) => object;
|
|
18408
|
+
getConversion?(this: Adapter<T, C>, $meta: unknown, type: string): {
|
|
18080
18409
|
name: string;
|
|
18081
|
-
fn: () => object
|
|
18410
|
+
fn: (...params: unknown[]) => Promise<object>;
|
|
18082
18411
|
};
|
|
18083
|
-
findHandler
|
|
18084
|
-
handles
|
|
18085
|
-
forNamespaces
|
|
18086
|
-
methodPath
|
|
18087
|
-
dispatch
|
|
18088
|
-
exec
|
|
18089
|
-
bytesSent
|
|
18090
|
-
bytesReceived
|
|
18091
|
-
msgSent
|
|
18092
|
-
msgReceived
|
|
18412
|
+
findHandler?(this: Adapter<T, C>, name: string): () => unknown;
|
|
18413
|
+
handles?(this: Adapter<T, C>, name: string): boolean;
|
|
18414
|
+
forNamespaces?<U>(reducer: (prev: U, current: unknown) => U, initial: U): U;
|
|
18415
|
+
methodPath?(name: string): string;
|
|
18416
|
+
dispatch?(...params: unknown[]): Promise<unknown>;
|
|
18417
|
+
exec?(this: Adapter<T, C>, ...params: unknown[]): Promise<unknown>;
|
|
18418
|
+
bytesSent?(count: number): void;
|
|
18419
|
+
bytesReceived?(count: number): void;
|
|
18420
|
+
msgSent?(count: number): void;
|
|
18421
|
+
msgReceived?(count: number): void;
|
|
18093
18422
|
isConnected?: Promise<boolean>;
|
|
18094
|
-
event
|
|
18095
|
-
handle
|
|
18096
|
-
connect
|
|
18097
|
-
requests: unknown;
|
|
18098
|
-
waiting: unknown;
|
|
18099
|
-
buffer: unknown;
|
|
18100
|
-
}) => void;
|
|
18423
|
+
event?(name: string, params?: unknown): Promise<object>;
|
|
18424
|
+
handle?(...params: unknown[]): Promise<unknown>;
|
|
18425
|
+
connect?(what: unknown, context: unknown): void;
|
|
18101
18426
|
/**
|
|
18102
18427
|
* Optional lifecycle hook called when configuration changes.
|
|
18103
18428
|
* When present, the framework calls this instead of a full stop+start cycle.
|
|
@@ -18109,15 +18434,24 @@ export interface IAdapter<T, C> {
|
|
|
18109
18434
|
* @param next The full new effective config snapshot (via proxy)
|
|
18110
18435
|
* @param prev The full previous effective config snapshot
|
|
18111
18436
|
*/
|
|
18112
|
-
configChanged
|
|
18113
|
-
|
|
18114
|
-
|
|
18115
|
-
}>, next: object, prev: object) => Promise<void>;
|
|
18437
|
+
configChanged?(this: Adapter<T, C>, diff: unknown, next: unknown, prev?: unknown): Promise<void>;
|
|
18438
|
+
/** Allow arbitrary extra methods on adapter definitions (e.g. authenticate) */
|
|
18439
|
+
[key: string]: unknown;
|
|
18116
18440
|
}
|
|
18117
18441
|
export interface IAdapterFactory<T = Record<string, unknown>, C = Record<string, unknown>> {
|
|
18118
18442
|
config?: Config<T, C> | false;
|
|
18119
18443
|
(api: IApi): IAdapter<T, C>;
|
|
18120
18444
|
}
|
|
18445
|
+
export interface IAdapterRegistry {
|
|
18446
|
+
config: unknown;
|
|
18447
|
+
(api: {
|
|
18448
|
+
utError: IError;
|
|
18449
|
+
remote: IRemote;
|
|
18450
|
+
rpc: IRpcServer;
|
|
18451
|
+
local: ILocal;
|
|
18452
|
+
registry: IRegistry;
|
|
18453
|
+
}): Promise<Adapter>;
|
|
18454
|
+
}
|
|
18121
18455
|
export interface IMeta {
|
|
18122
18456
|
mtid?: "request" | "response" | "error" | "notification" | "discard" | "event";
|
|
18123
18457
|
request?: IMeta;
|
|
@@ -18129,7 +18463,7 @@ export interface IMeta {
|
|
|
18129
18463
|
expect?: string[] | string;
|
|
18130
18464
|
opcode?: string;
|
|
18131
18465
|
source?: string;
|
|
18132
|
-
forward?:
|
|
18466
|
+
forward?: Record<string, string>;
|
|
18133
18467
|
httpResponse?: {
|
|
18134
18468
|
type?: string;
|
|
18135
18469
|
redirect?: string;
|
|
@@ -18178,14 +18512,14 @@ export interface IMeta {
|
|
|
18178
18512
|
deviceId?: string | string[];
|
|
18179
18513
|
latitude?: string | string[];
|
|
18180
18514
|
longitude?: string | string[];
|
|
18181
|
-
conId?: number;
|
|
18515
|
+
conId?: string | number;
|
|
18182
18516
|
dispatch?: (msg?: object, $meta?: IMeta) => [
|
|
18183
18517
|
msg: object,
|
|
18184
18518
|
$meta: IMeta
|
|
18185
18519
|
] | boolean | void | Promise<boolean>;
|
|
18186
18520
|
reply?: unknown;
|
|
18187
|
-
timeout?:
|
|
18188
|
-
timer?: (name?: string, newTime?: HRTime |
|
|
18521
|
+
timeout?: HRTime;
|
|
18522
|
+
timer?: (name?: string, newTime?: HRTime | undefined) => {
|
|
18189
18523
|
[name: string]: number;
|
|
18190
18524
|
};
|
|
18191
18525
|
gateway?: object;
|
|
@@ -18199,19 +18533,19 @@ export interface IMeta {
|
|
|
18199
18533
|
}>;
|
|
18200
18534
|
}
|
|
18201
18535
|
export interface IContext {
|
|
18202
|
-
trace: number;
|
|
18203
18536
|
session?: {
|
|
18204
18537
|
[name: string]: unknown;
|
|
18205
18538
|
};
|
|
18206
|
-
conId?: string;
|
|
18539
|
+
conId?: string | number;
|
|
18207
18540
|
requests: Map<string, {
|
|
18208
18541
|
$meta: IMeta;
|
|
18209
|
-
end
|
|
18542
|
+
end?: (error: Error) => {
|
|
18210
18543
|
local: object;
|
|
18211
18544
|
literals: object[];
|
|
18212
18545
|
};
|
|
18213
18546
|
}>;
|
|
18214
18547
|
waiting: Set<(error: Error) => void>;
|
|
18548
|
+
buffer?: Buffer;
|
|
18215
18549
|
}
|
|
18216
18550
|
export interface ITypedError extends Error {
|
|
18217
18551
|
type: string;
|
|
@@ -18265,7 +18599,7 @@ export interface IModuleConfig<T extends TSchema = TNever> {
|
|
|
18265
18599
|
url: string;
|
|
18266
18600
|
config?: IActivationConfig<Partial<Static<T>> & Partial<Static<IBaseConfig>>>;
|
|
18267
18601
|
validation?: T;
|
|
18268
|
-
children?: (string | (() => Promise<object>))[] | ((layer: ModuleApi) => unknown)[]
|
|
18602
|
+
children?: (string | (() => Promise<object>))[] | ((layer: ModuleApi) => unknown)[] | Record<string, () => Promise<unknown>>;
|
|
18269
18603
|
glob?: Record<string, () => Promise<object>>;
|
|
18270
18604
|
}
|
|
18271
18605
|
export interface ILogger {
|
|
@@ -18366,8 +18700,10 @@ export type ApiDefinition = (blong: IValidationProxy) => {
|
|
|
18366
18700
|
} | {
|
|
18367
18701
|
url: string;
|
|
18368
18702
|
};
|
|
18369
|
-
export type PortHandler<T, C> = <R>(this:
|
|
18370
|
-
export type PortHandlerBound = <T>(params:
|
|
18703
|
+
export type PortHandler<T, C> = <R>(this: Adapter<T, C>, params: object, $meta: IMeta, context?: IContext) => Promise<R> | R;
|
|
18704
|
+
export type PortHandlerBound = (<T>(params: object, $meta: IMeta, context?: IContext) => Promise<T> | T) & {
|
|
18705
|
+
[name: string]: PortHandlerBound;
|
|
18706
|
+
};
|
|
18371
18707
|
export type LibFn = <T>(...params: unknown[]) => T;
|
|
18372
18708
|
export interface IRemoteHandler {
|
|
18373
18709
|
[name: string]: PortHandlerBound;
|
|
@@ -18430,11 +18766,11 @@ export declare abstract class Internal {
|
|
|
18430
18766
|
#private;
|
|
18431
18767
|
protected log?: ReturnType<ILog["logger"]>;
|
|
18432
18768
|
constructor(api?: {
|
|
18433
|
-
log
|
|
18769
|
+
log?: ILog;
|
|
18434
18770
|
});
|
|
18435
18771
|
protected merge: ILib["merge"];
|
|
18436
18772
|
stop(): Promise<unknown>;
|
|
18437
|
-
start(...
|
|
18773
|
+
start(..._args: unknown[]): Promise<unknown>;
|
|
18438
18774
|
}
|
|
18439
18775
|
export declare const handler: <T = Record<string, unknown>, C = AdapterContext>(definition: Definition<T, C>) => Definition<T, C>;
|
|
18440
18776
|
/**
|
|
@@ -18496,12 +18832,12 @@ export declare const fixture: <T extends IMock>(definition: () => T) => (() => T
|
|
|
18496
18832
|
export declare const validationHandlers: (handlers: Record<string, TFunction<[
|
|
18497
18833
|
ApiSchema
|
|
18498
18834
|
]>>) => ValidationDefinition;
|
|
18499
|
-
export declare const realm: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18500
|
-
export declare const server: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18501
|
-
export declare const browser: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18502
|
-
export declare const layer: (activation: Record<string, boolean | object>) => Record<string, boolean | object
|
|
18503
|
-
export declare const adapter: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C
|
|
18504
|
-
export declare const orchestrator: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C
|
|
18835
|
+
export declare const realm: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18836
|
+
export declare const server: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18837
|
+
export declare const browser: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18838
|
+
export declare const layer: (activation: Record<string, boolean | object>) => Record<string, boolean | object> & {};
|
|
18839
|
+
export declare const adapter: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C> & {};
|
|
18840
|
+
export declare const orchestrator: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C> & {};
|
|
18505
18841
|
export type Kinds = "lib" | "validation" | "api" | "solution" | "server" | "browser" | "adapter" | "orchestrator" | "handler" | "model" | "fixture" | "";
|
|
18506
18842
|
export declare const kind: (what: {}) => Kinds;
|
|
18507
18843
|
declare const _default: {
|
|
@@ -18510,11 +18846,11 @@ declare const _default: {
|
|
|
18510
18846
|
library: <T = Record<string, unknown>>(definition: Lib<T>) => Lib<T>;
|
|
18511
18847
|
validation: (validation: ValidationDefinition) => ValidationDefinition;
|
|
18512
18848
|
api: (api: ApiDefinition) => ApiDefinition;
|
|
18513
|
-
realm: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18514
|
-
server: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18515
|
-
browser: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T
|
|
18516
|
-
adapter: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C
|
|
18517
|
-
orchestrator: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C
|
|
18849
|
+
realm: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18850
|
+
server: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18851
|
+
browser: <T extends TObject>(definition: SolutionFactory<T>) => SolutionFactory<T> & {};
|
|
18852
|
+
adapter: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C> & {};
|
|
18853
|
+
orchestrator: <T, C = AdapterContext>(definition: IAdapterFactory<T, C>) => IAdapterFactory<T, C> & {};
|
|
18518
18854
|
fixture: <T extends IMock>(definition: () => T) => (() => T);
|
|
18519
18855
|
kind: (what: {}) => Kinds;
|
|
18520
18856
|
};
|