@heswell/vuu-data-engine-local 4.1.0 → 4.2.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/91.js +34 -8
- package/README.md +20 -0
- package/index.js +4 -1
- package/package.json +1 -1
- package/src/EngineDataSource.d.ts +1 -1
- package/src/Table.d.ts +25 -3
- package/src/basket/BasketModule.d.ts +1 -1
- package/src/core/module/VuuModule.d.ts +7 -6
- package/src/core/table/TableContainer.d.ts +27 -6
- package/src/index.d.ts +2 -2
- package/src/notifications/NotificationModule.d.ts +1 -1
- package/src/session-table-utils.d.ts +1 -1
- package/src/simul/SimulModule.d.ts +1 -1
- package/src/simul/reference-data/instruments-extended.d.ts +1 -1
- package/src/simul/reference-data/instruments.d.ts +1 -1
- package/src/simul/reference-data/orders.d.ts +1 -1
- package/src/test/TestModule.d.ts +1 -1
- package/src/user-admin/UserAdminModule.d.ts +1 -1
package/91.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { JoinTable, Table } from "@heswell/vuu-table";
|
|
2
2
|
import { EventEmitter } from "@vuu-ui/vuu-utils";
|
|
3
|
+
const defaultRangeLimits = new WeakMap();
|
|
4
|
+
const setDefaultRangeLimits = (table, rangeLimits)=>{
|
|
5
|
+
defaultRangeLimits.set(table, rangeLimits);
|
|
6
|
+
};
|
|
3
7
|
class Table_Table extends EventEmitter {
|
|
4
8
|
engineTable;
|
|
5
9
|
#dataMap;
|
|
10
|
+
#destroyed = false;
|
|
6
11
|
#indexOfKey;
|
|
12
|
+
#listener;
|
|
7
13
|
#updateColumnName;
|
|
8
14
|
constructor(schemaOrEngineTable, data = [], dataMap, updateGenerator){
|
|
9
15
|
super();
|
|
@@ -11,12 +17,13 @@ class Table_Table extends EventEmitter {
|
|
|
11
17
|
this.#dataMap = dataMap ?? this.engineTable.columnMap;
|
|
12
18
|
this.#indexOfKey = this.engineTable.indexOfKeyField;
|
|
13
19
|
for (const row of data)this.engineTable.insert(row);
|
|
14
|
-
this
|
|
20
|
+
this.#listener = {
|
|
15
21
|
onInsert: (_rowIdx, row)=>this.emit("insert", row),
|
|
16
22
|
onUpdate: (_rowIdx, row)=>this.emit("update", row, this.#updateColumnName),
|
|
17
23
|
onDelete: (_rowIdx, row)=>this.emit("delete", String(row[this.#indexOfKey])),
|
|
18
24
|
onClear: ()=>void 0
|
|
19
|
-
}
|
|
25
|
+
};
|
|
26
|
+
this.engineTable.addListener(this.#listener);
|
|
20
27
|
updateGenerator?.setTable(this);
|
|
21
28
|
updateGenerator?.setRange({
|
|
22
29
|
from: 0,
|
|
@@ -32,6 +39,18 @@ class Table_Table extends EventEmitter {
|
|
|
32
39
|
get schema() {
|
|
33
40
|
return this.engineTable.schema;
|
|
34
41
|
}
|
|
42
|
+
get rangeLimits() {
|
|
43
|
+
return this.schema.rangeLimits ?? defaultRangeLimits.get(this);
|
|
44
|
+
}
|
|
45
|
+
get destroyed() {
|
|
46
|
+
return this.#destroyed;
|
|
47
|
+
}
|
|
48
|
+
destroy() {
|
|
49
|
+
if (this.#destroyed) return;
|
|
50
|
+
this.#destroyed = true;
|
|
51
|
+
this.engineTable.removeListener(this.#listener);
|
|
52
|
+
if (this.engineTable instanceof JoinTable) this.engineTable.destroy();
|
|
53
|
+
}
|
|
35
54
|
get name() {
|
|
36
55
|
return this.engineTable.name;
|
|
37
56
|
}
|
|
@@ -100,7 +119,9 @@ const createJoinTable = (joinTable, table1, table2, joinColumn, joinTypeOrOption
|
|
|
100
119
|
rightColumn: joinColumn,
|
|
101
120
|
joinType
|
|
102
121
|
});
|
|
103
|
-
|
|
122
|
+
const table = new Table_Table(engineJoinTable);
|
|
123
|
+
setDefaultRangeLimits(table, DEFAULT_RANGE_LIMITS);
|
|
124
|
+
return table;
|
|
104
125
|
};
|
|
105
126
|
const buildJoinSchema = (joinTable, schema1, schema2, { columns, schema })=>{
|
|
106
127
|
const name = `${joinTable.module}:${joinTable.table}`;
|
|
@@ -133,10 +154,7 @@ const buildJoinSchema = (joinTable, schema1, schema2, { columns, schema })=>{
|
|
|
133
154
|
schema.columns.forEach(({ name: columnName, serverDataType }, i)=>{
|
|
134
155
|
if (serverDataType !== joinColumns[i].serverDataType) fail(`column ${columnName} is declared ${serverDataType} but is ${joinColumns[i].serverDataType} in the source table`);
|
|
135
156
|
});
|
|
136
|
-
return
|
|
137
|
-
...schema,
|
|
138
|
-
rangeLimits: schema.rangeLimits ?? DEFAULT_RANGE_LIMITS
|
|
139
|
-
};
|
|
157
|
+
return schema;
|
|
140
158
|
}
|
|
141
159
|
return {
|
|
142
160
|
key: schema1.key,
|
|
@@ -147,21 +165,27 @@ const buildJoinSchema = (joinTable, schema1, schema2, { columns, schema })=>{
|
|
|
147
165
|
};
|
|
148
166
|
class TableContainer {
|
|
149
167
|
#tables = new Map();
|
|
168
|
+
#created = new Set();
|
|
150
169
|
createTable = (schema, data = [], dataMap = buildDataColumnMapFromSchema(schema), updateGenerator)=>{
|
|
151
170
|
const table = createTable(schema, data, dataMap, updateGenerator);
|
|
152
171
|
this.addTable(table);
|
|
172
|
+
this.#created.add(table);
|
|
153
173
|
return table;
|
|
154
174
|
};
|
|
155
175
|
createJoinTable(joinTable, table1, table2, joinColumn, joinTypeOrOptions = "inner") {
|
|
156
176
|
const newTable = createJoinTable(joinTable, this.getTable(table1), this.getTable(table2), joinColumn, joinTypeOrOptions);
|
|
157
177
|
this.addTable(newTable);
|
|
178
|
+
this.#created.add(newTable);
|
|
158
179
|
return newTable;
|
|
159
180
|
}
|
|
160
181
|
addTable(table, as = table.schema.table) {
|
|
161
182
|
this.#tables.set(tableKey(as), table);
|
|
162
183
|
}
|
|
163
184
|
removeTable(table) {
|
|
164
|
-
|
|
185
|
+
const key = tableKey(table);
|
|
186
|
+
const found = this.#tables.get(key);
|
|
187
|
+
if (found) this.#created.delete(found);
|
|
188
|
+
return this.#tables.delete(key);
|
|
165
189
|
}
|
|
166
190
|
hasTable(table) {
|
|
167
191
|
return this.#tables.has(tableKey(table));
|
|
@@ -181,6 +205,8 @@ class TableContainer {
|
|
|
181
205
|
return Array.from(this.#tables.values());
|
|
182
206
|
}
|
|
183
207
|
clear() {
|
|
208
|
+
for (const table of this.#created)table.destroy();
|
|
209
|
+
this.#created.clear();
|
|
184
210
|
this.#tables.clear();
|
|
185
211
|
}
|
|
186
212
|
}
|
package/README.md
CHANGED
|
@@ -175,6 +175,26 @@ Column types come from the source tables; a column in both tables takes its valu
|
|
|
175
175
|
that differs from the source column, or a `schema` whose `table` or `key` does not match
|
|
176
176
|
(`joinTable`, `table1`'s key) throw an error naming the join table and the problem.
|
|
177
177
|
|
|
178
|
+
With `schema`, the join's `Table.schema` is exactly the declared schema (no keys added), so
|
|
179
|
+
it matches `getTableSchema` / TABLE_META_RESP and can be published as a module's
|
|
180
|
+
`schemas`. If the declared schema has no `rangeLimits`, the engine default
|
|
181
|
+
(`maxRangeEnd: 1_000_000`, `maxRangeWidth: 1_000`) still applies, exposed as
|
|
182
|
+
`table.rangeLimits` rather than added to the schema. Joins created without `schema`
|
|
183
|
+
(default or `columns`) generate a schema that includes those default `rangeLimits`.
|
|
184
|
+
|
|
185
|
+
`createJoinTable` returns a `JoinTableHandle` (`Table<JoinTable>`), whose `engineTable` is
|
|
186
|
+
typed as the `@heswell/vuu-table` `JoinTable`. Call `table.destroy()` to detach a join from
|
|
187
|
+
its source tables, after which source changes no longer propagate to it. `destroy()` is
|
|
188
|
+
available on every `Table` and is safe to call more than once. You rarely need to call it
|
|
189
|
+
yourself:
|
|
190
|
+
|
|
191
|
+
- `module.dispose()` (called by `engine.dispose()` for modules the engine owns) destroys the
|
|
192
|
+
join tables the module publishes.
|
|
193
|
+
- `tableContainer.clear()` (also called by `engine.dispose()`) destroys tables created by
|
|
194
|
+
that container's `createTable` / `createJoinTable`.
|
|
195
|
+
- `engine.unregister()` and `tableContainer.removeTable()` do not destroy tables, as they
|
|
196
|
+
may still be in use.
|
|
197
|
+
|
|
178
198
|
### Ranges
|
|
179
199
|
|
|
180
200
|
`subscribe({ range })`, `dataSource.range = …` and `setRange` accept a vuu-utils `Range` or
|
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JoinTable } from "@heswell/vuu-table";
|
|
1
2
|
import { Clock, EventEmitter, NULL_RANGE, Range, StaleUpdateError, assertExpectedSessionTable, filterAsQuery, isAddRowRpcRequest, isBeginEditSessionRpcRequest, isConfigChanged, isCreateSessionTableRpcRequest, isDeleteSelectedRowsRpcRequest, isEditCellRpcRequest, isEndEditSessionRpcRequest, isRpcSuccess, isTypeaheadRequest, isUndoRowChangeRpcRequest, metadataKeys, sessionDataSourceConfig, toSchemaColumn, uuid, vanillaConfig, withConfigDefaults } from "@vuu-ui/vuu-utils";
|
|
2
3
|
import { inMemoryDataEngine } from "@heswell/vuu-viewport";
|
|
3
4
|
import { parseFilter } from "@vuu-ui/vuu-filter-parser";
|
|
@@ -362,7 +363,8 @@ class EngineDataSource extends EventEmitter {
|
|
|
362
363
|
this.clientCallback = callback;
|
|
363
364
|
this.viewport = viewport;
|
|
364
365
|
this.#status = "subscribed";
|
|
365
|
-
|
|
366
|
+
const rangeLimits = this.#table.rangeLimits;
|
|
367
|
+
if (rangeLimits) this.#maxRangeEnd = rangeLimits.maxRangeEnd;
|
|
366
368
|
let config = this._config;
|
|
367
369
|
const hasConfigProps = aggregations || columns || filterSpec || groupBy || sort;
|
|
368
370
|
if (hasConfigProps) config = {
|
|
@@ -1160,6 +1162,7 @@ class VuuModule {
|
|
|
1160
1162
|
if (this.#engine === engine) this.#engine = void 0;
|
|
1161
1163
|
}
|
|
1162
1164
|
dispose() {
|
|
1165
|
+
for (const table of Object.values(this.tables))if (table.engineTable instanceof JoinTable) table.destroy();
|
|
1163
1166
|
this.#sessionTableMap = {};
|
|
1164
1167
|
this.#sessionSourceTableMap = {};
|
|
1165
1168
|
this.#sessionSnapshots.clear();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heswell/vuu-data-engine-local",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "In-browser Vuu server (VuuModule, tables, EngineDataSource) built on @heswell/vuu-table and @heswell/vuu-viewport",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -95,7 +95,7 @@ export declare class EngineDataSource extends EventEmitter<DataSourceEvents> imp
|
|
|
95
95
|
get size(): number;
|
|
96
96
|
get table(): import("@vuu-ui/vuu-data-types").TableSchemaTable;
|
|
97
97
|
/** The table backing this dataSource */
|
|
98
|
-
get dataTable(): Table
|
|
98
|
+
get dataTable(): Table<import("@heswell/vuu-table").Table>;
|
|
99
99
|
get columnMap(): ColumnMap;
|
|
100
100
|
/**
|
|
101
101
|
* Flat (ungrouped) rows can be resolved at any index. Grouped rows are
|
package/src/Table.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ import type { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
|
|
|
4
4
|
import { type ColumnMap, EventEmitter } from "@vuu-ui/vuu-utils";
|
|
5
5
|
import type { UpdateGenerator } from "./rowUpdates";
|
|
6
6
|
export type TableRow = Array<VuuRowDataItemType | bigint>;
|
|
7
|
+
export type RangeLimits = NonNullable<TableSchema["rangeLimits"]>;
|
|
8
|
+
/**
|
|
9
|
+
* @internal Range limits applied when the table's schema declares none,
|
|
10
|
+
* without adding them to the (exposed) schema.
|
|
11
|
+
*/
|
|
12
|
+
export declare const setDefaultRangeLimits: (table: Table<EngineTable>, rangeLimits: RangeLimits) => void;
|
|
7
13
|
export type TableEvents = {
|
|
8
14
|
delete: (key: string) => void;
|
|
9
15
|
insert: (row: TableRow) => void;
|
|
@@ -17,14 +23,30 @@ export type TableEvents = {
|
|
|
17
23
|
*
|
|
18
24
|
* Events are emitted from engine table listeners, so changes applied
|
|
19
25
|
* directly to the engine table (e.g. by a JoinTable) are also observed.
|
|
26
|
+
*
|
|
27
|
+
* `E` is the type of the engine table, `JoinTable` for tables created by
|
|
28
|
+
* `createJoinTable` (see `JoinTableHandle`).
|
|
20
29
|
*/
|
|
21
|
-
export declare class Table extends EventEmitter<TableEvents> {
|
|
30
|
+
export declare class Table<E extends EngineTable = EngineTable> extends EventEmitter<TableEvents> {
|
|
22
31
|
#private;
|
|
23
|
-
readonly engineTable:
|
|
24
|
-
constructor(schemaOrEngineTable: TableSchema |
|
|
32
|
+
readonly engineTable: E;
|
|
33
|
+
constructor(schemaOrEngineTable: TableSchema | E, data?: TableRow[], dataMap?: ColumnMap, updateGenerator?: UpdateGenerator);
|
|
25
34
|
get data(): TableRow[];
|
|
26
35
|
get map(): ColumnMap;
|
|
27
36
|
get schema(): TableSchema;
|
|
37
|
+
/**
|
|
38
|
+
* The range limits in effect: those of the schema if it declares any,
|
|
39
|
+
* otherwise any engine default (applied to join tables), else undefined
|
|
40
|
+
* (unlimited). Never added to `schema`.
|
|
41
|
+
*/
|
|
42
|
+
get rangeLimits(): RangeLimits | undefined;
|
|
43
|
+
get destroyed(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Release the table. For a join table this detaches the join from its
|
|
46
|
+
* source tables, so source changes no longer propagate. This table stops
|
|
47
|
+
* emitting events. Safe to call on any table, and more than once.
|
|
48
|
+
*/
|
|
49
|
+
destroy(): void;
|
|
28
50
|
get name(): string;
|
|
29
51
|
get rowCount(): number;
|
|
30
52
|
delete(key: string): void;
|
|
@@ -43,7 +43,7 @@ export declare class BasketModule extends VuuModule<BasketsTableName> {
|
|
|
43
43
|
priceStrategyType: undefined;
|
|
44
44
|
};
|
|
45
45
|
get menuServices(): Record<BasketsTableName, RpcMenuService[] | undefined> | undefined;
|
|
46
|
-
get tables(): Record<BasketsTableName, Table
|
|
46
|
+
get tables(): Record<BasketsTableName, Table<import("@heswell/vuu-table").Table>>;
|
|
47
47
|
get visualLinks(): {
|
|
48
48
|
basketConstituent: {
|
|
49
49
|
fromColumn: string;
|
|
@@ -55,8 +55,9 @@ export declare abstract class VuuModule<T extends string = string> implements IV
|
|
|
55
55
|
detachEngine(engine: LocalEngine): void;
|
|
56
56
|
/**
|
|
57
57
|
* Release resources (timers, providers). Called by `LocalEngine.dispose`
|
|
58
|
-
* for modules it owns.
|
|
59
|
-
*
|
|
58
|
+
* for modules it owns. Join tables published by the module are destroyed,
|
|
59
|
+
* detaching them from their source tables. Subclasses that start timers
|
|
60
|
+
* should override, calling super.dispose().
|
|
60
61
|
*/
|
|
61
62
|
dispose(): void;
|
|
62
63
|
protected abstract menus?: Record<T, VuuMenu | undefined> | undefined;
|
|
@@ -174,9 +175,9 @@ export declare abstract class VuuModule<T extends string = string> implements IV
|
|
|
174
175
|
private addRow;
|
|
175
176
|
private endEditSession;
|
|
176
177
|
private applyBulkEdits;
|
|
177
|
-
protected createSessionTable(sourceTable: Table, sessionTableName: string, editSessionMode: EditSessionMode | CopyOption, dataSource: ModuleDataSource, sessionType?: SessionType): Table
|
|
178
|
-
protected createSessionTableWithAllRows({ data, schema }: Table, _sessionTableName: string): Table
|
|
179
|
-
protected createEmptySessionTable({ schema }: Table, sessionTableName: string, sessionType?: SessionType): Table
|
|
180
|
-
protected createSessionTableFromSelectedRows({ data, map, schema }: Table, sessionTableName: string, dataSource: ModuleDataSource): Table
|
|
178
|
+
protected createSessionTable(sourceTable: Table, sessionTableName: string, editSessionMode: EditSessionMode | CopyOption, dataSource: ModuleDataSource, sessionType?: SessionType): Table<import("@heswell/vuu-table").Table>;
|
|
179
|
+
protected createSessionTableWithAllRows({ data, schema }: Table, _sessionTableName: string): Table<import("@heswell/vuu-table").Table>;
|
|
180
|
+
protected createEmptySessionTable({ schema }: Table, sessionTableName: string, sessionType?: SessionType): Table<import("@heswell/vuu-table").Table>;
|
|
181
|
+
protected createSessionTableFromSelectedRows({ data, map, schema }: Table, sessionTableName: string, dataSource: ModuleDataSource): Table<import("@heswell/vuu-table").Table>;
|
|
181
182
|
}
|
|
182
183
|
export {};
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { type JoinType } from "@heswell/vuu-table";
|
|
1
|
+
import { JoinTable, type JoinType } from "@heswell/vuu-table";
|
|
2
2
|
import type { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
3
3
|
import { Table } from "../../Table";
|
|
4
4
|
import type { VuuRowDataItemType, VuuTable } from "@vuu-ui/vuu-protocol-types";
|
|
5
5
|
import type { ColumnMap } from "@vuu-ui/vuu-utils";
|
|
6
6
|
import type { UpdateGenerator } from "../../rowUpdates";
|
|
7
|
+
/**
|
|
8
|
+
* A Table backed by an engine `JoinTable`, as returned by `createJoinTable`.
|
|
9
|
+
* `destroy()` detaches the join from its source tables.
|
|
10
|
+
*/
|
|
11
|
+
export type JoinTableHandle = Table<JoinTable>;
|
|
7
12
|
/**
|
|
8
13
|
* Create a table. The table is not registered anywhere; it belongs to
|
|
9
14
|
* whichever VuuModule returns it from `tables`.
|
|
10
15
|
*/
|
|
11
|
-
export declare const createTable: (schema: TableSchema, data?: Array<Array<VuuRowDataItemType | bigint>>, dataMap?: ColumnMap, updateGenerator?: UpdateGenerator) => Table
|
|
16
|
+
export declare const createTable: (schema: TableSchema, data?: Array<Array<VuuRowDataItemType | bigint>>, dataMap?: ColumnMap, updateGenerator?: UpdateGenerator) => Table<import("@heswell/vuu-table").Table>;
|
|
12
17
|
export interface CreateJoinTableOptions {
|
|
13
18
|
/** Defaults to "inner". */
|
|
14
19
|
joinType?: JoinType;
|
|
@@ -24,6 +29,9 @@ export interface CreateJoinTableOptions {
|
|
|
24
29
|
* return in TABLE_META_RESP. Its column order is preserved; every column
|
|
25
30
|
* must exist in one of the source tables, with the same serverDataType, and
|
|
26
31
|
* its key must be the key of table1. Cannot be combined with `columns`.
|
|
32
|
+
* The join's `schema` is exactly this schema; if it declares no
|
|
33
|
+
* `rangeLimits`, the engine default limits are applied without being added
|
|
34
|
+
* to the schema.
|
|
27
35
|
*/
|
|
28
36
|
schema?: TableSchema;
|
|
29
37
|
}
|
|
@@ -36,26 +44,34 @@ export interface CreateJoinTableOptions {
|
|
|
36
44
|
* The fifth argument is either a JoinType or a CreateJoinTableOptions, which
|
|
37
45
|
* can also control the columns (and their order) of the join table. Where a
|
|
38
46
|
* column exists in both tables, the value comes from table1.
|
|
47
|
+
*
|
|
48
|
+
* Call `destroy()` on the returned table to detach it from its source tables.
|
|
49
|
+
* Tables published by a module are destroyed when the module is disposed.
|
|
39
50
|
*/
|
|
40
|
-
export declare const createJoinTable: (joinTable: VuuTable, table1: Table, table2: Table, joinColumn: string, joinTypeOrOptions?: JoinType | CreateJoinTableOptions) =>
|
|
51
|
+
export declare const createJoinTable: (joinTable: VuuTable, table1: Table, table2: Table, joinColumn: string, joinTypeOrOptions?: JoinType | CreateJoinTableOptions) => JoinTableHandle;
|
|
41
52
|
/**
|
|
42
53
|
* Tables, keyed by `{module, table}`. Each LocalEngine owns one, populated
|
|
43
54
|
* from the tables of its registered modules. Tables created through
|
|
44
|
-
* `createTable` / `createJoinTable` are added to this container
|
|
55
|
+
* `createTable` / `createJoinTable` are added to this container, and are
|
|
56
|
+
* destroyed by `clear()`.
|
|
45
57
|
*/
|
|
46
58
|
export declare class TableContainer {
|
|
47
59
|
#private;
|
|
48
|
-
createTable: (schema: TableSchema, data?: Array<Array<VuuRowDataItemType | bigint>>, dataMap?: ColumnMap, updateGenerator?: UpdateGenerator) => Table
|
|
60
|
+
createTable: (schema: TableSchema, data?: Array<Array<VuuRowDataItemType | bigint>>, dataMap?: ColumnMap, updateGenerator?: UpdateGenerator) => Table<import("@heswell/vuu-table").Table>;
|
|
49
61
|
/**
|
|
50
62
|
* Create a join of two tables already in this container. Pass full
|
|
51
63
|
* `{module, table}` references; a bare name is accepted only if unique.
|
|
52
64
|
*/
|
|
53
|
-
createJoinTable(joinTable: VuuTable, table1: VuuTable | string, table2: VuuTable | string, joinColumn: string, joinTypeOrOptions?: JoinType | CreateJoinTableOptions):
|
|
65
|
+
createJoinTable(joinTable: VuuTable, table1: VuuTable | string, table2: VuuTable | string, joinColumn: string, joinTypeOrOptions?: JoinType | CreateJoinTableOptions): JoinTableHandle;
|
|
54
66
|
/**
|
|
55
67
|
* Add a table, keyed by `as` if given, otherwise by its schema's
|
|
56
68
|
* `{module, table}`.
|
|
57
69
|
*/
|
|
58
70
|
addTable(table: Table, as?: VuuTable): void;
|
|
71
|
+
/**
|
|
72
|
+
* Remove a table from the container. The table is not destroyed, it may
|
|
73
|
+
* still be in use elsewhere; call its `destroy()` if not.
|
|
74
|
+
*/
|
|
59
75
|
removeTable(table: VuuTable): boolean;
|
|
60
76
|
hasTable(table: VuuTable): boolean;
|
|
61
77
|
/**
|
|
@@ -66,5 +82,10 @@ export declare class TableContainer {
|
|
|
66
82
|
getTable(table: VuuTable | string): Table;
|
|
67
83
|
getTable<T>(table: VuuTable | string): T;
|
|
68
84
|
get tables(): Table[];
|
|
85
|
+
/**
|
|
86
|
+
* Remove every table, destroying those created by this container's
|
|
87
|
+
* `createTable` / `createJoinTable` (detaching join tables from their
|
|
88
|
+
* sources). Tables added with `addTable` are not destroyed.
|
|
89
|
+
*/
|
|
69
90
|
clear(): void;
|
|
70
91
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from "./core/module/VuuModule";
|
|
|
4
4
|
export * from "./core/module/edit-hooks";
|
|
5
5
|
export { type AnyVuuModule, createLocalEngine, ensureVuuModule, getDefaultEngine, LocalEngine, type LocalEngineOptions, resetDefaultEngine, } from "./core/engine/LocalEngine";
|
|
6
6
|
export * from "./core/user/CurrentUser";
|
|
7
|
-
export { type CreateJoinTableOptions, createJoinTable, createTable, TableContainer, } from "./core/table/TableContainer";
|
|
7
|
+
export { type CreateJoinTableOptions, createJoinTable, createTable, type JoinTableHandle, TableContainer, } from "./core/table/TableContainer";
|
|
8
8
|
export { tableContainer } from "./core/table/defaultTableContainer";
|
|
9
9
|
export { registerDemoModules, type DemoModules } from "./demo-modules";
|
|
10
10
|
export { BaseUpdateGenerator } from "./UpdateGenerator";
|
|
@@ -15,7 +15,7 @@ export * from "./simul";
|
|
|
15
15
|
export * from "./basket";
|
|
16
16
|
export * from "./module-admin";
|
|
17
17
|
export * from "./user-admin";
|
|
18
|
-
export { buildDataColumnMap, buildDataColumnMapFromSchema, Table, type TableEvents, } from "./Table";
|
|
18
|
+
export { buildDataColumnMap, buildDataColumnMapFromSchema, type RangeLimits, Table, type TableEvents, } from "./Table";
|
|
19
19
|
export * from "./test";
|
|
20
20
|
export * from "./EngineDataSource";
|
|
21
21
|
export * from "./ModuleDataSource";
|
|
@@ -35,6 +35,6 @@ export declare class NotificationModule extends VuuModule<NotificationsTableName
|
|
|
35
35
|
get menuServices(): undefined;
|
|
36
36
|
get schemas(): Record<"notifications", TableSchema>;
|
|
37
37
|
get services(): Record<"notifications", RpcService[]>;
|
|
38
|
-
get tables(): Record<"notifications", Table
|
|
38
|
+
get tables(): Record<"notifications", Table<import("@heswell/vuu-table").Table>>;
|
|
39
39
|
get visualLinks(): undefined;
|
|
40
40
|
}
|
|
@@ -2,5 +2,5 @@ import type { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
|
|
|
2
2
|
import { Table } from "./Table";
|
|
3
3
|
import type { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
4
4
|
export declare const sessionTableRow: (row: Array<bigint | VuuRowDataItemType>, schema: TableSchema) => (bigint | VuuRowDataItemType)[];
|
|
5
|
-
export declare const createSessionTableFromSelectedRows: (table: Table, selectedRowIds: string[]) => Table
|
|
5
|
+
export declare const createSessionTableFromSelectedRows: (table: Table, selectedRowIds: string[]) => Table<import("@heswell/vuu-table").Table>;
|
|
6
6
|
export declare const sessionTableSchema: (schema: TableSchema) => TableSchema;
|
|
@@ -24,7 +24,7 @@ export declare class SimulModule extends VuuModule<SimulTableName> {
|
|
|
24
24
|
get editServices(): undefined;
|
|
25
25
|
get menuServices(): Record<SimulTableName, RpcMenuService[] | undefined> | undefined;
|
|
26
26
|
get services(): Record<SimulTableName, RpcService[] | undefined> | undefined;
|
|
27
|
-
get tables(): Record<SimulTableName, Table
|
|
27
|
+
get tables(): Record<SimulTableName, Table<import("@heswell/vuu-table").Table>>;
|
|
28
28
|
get visualLinks(): Record<SimulTableName, VuuLink[] | undefined>;
|
|
29
29
|
cancelOrder: MenuServiceHandler;
|
|
30
30
|
startOrders: ServiceHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createInstrumentsExtendedTable: () => import("../..").Table
|
|
1
|
+
export declare const createInstrumentsExtendedTable: () => import("../..").Table<import("@heswell/vuu-table").Table>;
|
|
@@ -31,4 +31,4 @@ export declare const InstrumentColumnMap: {
|
|
|
31
31
|
};
|
|
32
32
|
export declare const getInstrumentsData: () => InstrumentsDataRow[];
|
|
33
33
|
export declare const getRic: (defaultRic: string) => string;
|
|
34
|
-
export declare const createInstrumentsTable: () => import("../..").Table
|
|
34
|
+
export declare const createInstrumentsTable: () => import("../..").Table<import("@heswell/vuu-table").Table>;
|
|
@@ -32,4 +32,4 @@ export declare const OrderColumnMap: {
|
|
|
32
32
|
readonly trader: 8;
|
|
33
33
|
};
|
|
34
34
|
export declare const getOrdersData: () => OrdersDataRow[];
|
|
35
|
-
export declare const createOrdersTable: () => import("../..").Table
|
|
35
|
+
export declare const createOrdersTable: () => import("../..").Table<import("@heswell/vuu-table").Table>;
|
package/src/test/TestModule.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ export declare class TestModule extends VuuModule<TestTableName> {
|
|
|
10
10
|
get services(): undefined;
|
|
11
11
|
get menuServices(): Record<TestTableName, RpcMenuService[] | undefined> | undefined;
|
|
12
12
|
get schemas(): Record<TestTableName, TableSchema>;
|
|
13
|
-
get tables(): Record<TestTableName, Table
|
|
13
|
+
get tables(): Record<TestTableName, Table<import("@heswell/vuu-table").Table>>;
|
|
14
14
|
get visualLinks(): undefined;
|
|
15
15
|
}
|
|
@@ -23,7 +23,7 @@ export declare class UserAdminModule extends VuuModule<UserAdminTableName> {
|
|
|
23
23
|
get menuServices(): undefined;
|
|
24
24
|
get services(): Record<UserAdminTableName, RpcService[]>;
|
|
25
25
|
reconcile(): Promise<void>;
|
|
26
|
-
protected createSessionTable(sourceTable: Table, sessionTableName: string, editSessionMode: import("@vuu-ui/vuu-data-types").EditSessionMode | import("@vuu-ui/vuu-data-types").CopyOption, dataSource: import("../ModuleDataSource").ModuleDataSource, sessionType?: import("@vuu-ui/vuu-data-types").SessionType): Table
|
|
26
|
+
protected createSessionTable(sourceTable: Table, sessionTableName: string, editSessionMode: import("@vuu-ui/vuu-data-types").EditSessionMode | import("@vuu-ui/vuu-data-types").CopyOption, dataSource: import("../ModuleDataSource").ModuleDataSource, sessionType?: import("@vuu-ui/vuu-data-types").SessionType): Table<import("@heswell/vuu-table").Table>;
|
|
27
27
|
protected beforeSessionSave(sourceTable: Table, sessionTable: Table): Promise<void>;
|
|
28
28
|
protected afterSessionSave(sourceTable: Table, sessionTable: Table): Promise<void>;
|
|
29
29
|
private saveGroupsFromSession;
|