@heswell/vuu-data-engine-local 2.1.0 → 3.0.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/README.md +159 -25
- package/index.js +3771 -3318
- package/legacy.js +8 -0
- package/package.json +8 -2
- package/src/EngineDataSource.d.ts +13 -3
- package/src/ModuleDataSource.d.ts +3 -3
- package/src/UpdateGenerator.d.ts +12 -0
- package/src/basket/BasketModule.d.ts +12 -2
- package/src/basket/index.d.ts +1 -1
- package/src/core/engine/LocalEngine.d.ts +62 -0
- package/src/core/filter/PermissionFilter.d.ts +2 -2
- package/src/core/module/VuuModule.d.ts +68 -1
- package/src/core/module/edit-hooks.d.ts +135 -0
- package/src/core/table/TableContainer.d.ts +35 -11
- package/src/core/table/defaultTableContainer.d.ts +6 -0
- package/src/data-utils.d.ts +7 -0
- package/src/demo-modules.d.ts +18 -0
- package/src/index.d.ts +7 -2
- package/src/legacy.d.ts +11 -0
- package/src/local-datasource-provider/LocalDatasourceProvider.d.ts +18 -7
- package/src/local-datasource-provider/createDataSourceProvider.d.ts +12 -0
- package/src/module-admin/ModuleAdminModule.d.ts +0 -1
- package/src/module-admin/index.d.ts +1 -1
- package/src/notifications/NotificationModule.d.ts +1 -0
- package/src/notifications/index.d.ts +0 -1
- package/src/simul/SimulModule.d.ts +9 -1
- package/src/simul/index.d.ts +1 -1
- package/src/simul/reference-data/instrument-prices.d.ts +2 -2
- package/src/simul/reference-data/instruments-extended.d.ts +1 -1
- package/src/simul/reference-data/instruments.d.ts +2 -3
- package/src/simul/reference-data/orders.d.ts +2 -3
- package/src/simul/reference-data/parent-child-orders.d.ts +15 -4
- package/src/simul/reference-data/prices.d.ts +18 -6
- package/src/test/TestModule.d.ts +2 -3
- package/src/user-admin/UserAdminModule.d.ts +0 -1
- package/src/user-admin/index.d.ts +1 -1
- package/src/basket/reference-data/prices.d.ts +0 -24
- package/src/core/module/ModuleContainer.d.ts +0 -15
- package/src/notifications/simulated/notificationsModule.d.ts +0 -5
|
@@ -1,18 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { LocalVuuServer } from "@vuu-ui/core";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
-
import type
|
|
4
|
-
/**
|
|
5
|
-
|
|
3
|
+
import { type AnyVuuModule, LocalEngine } from "../core/engine/LocalEngine";
|
|
4
|
+
/**
|
|
5
|
+
* Data context covering every VuuModule registered with the default engine.
|
|
6
|
+
* @deprecated use `engine.DataSourceProvider` (see `createLocalEngine`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const LocalDataSourceProvider: ({ children, }: {
|
|
6
9
|
children: ReactNode;
|
|
7
10
|
}) => import("react").JSX.Element;
|
|
8
11
|
export interface LocalVuuServerOptions {
|
|
9
12
|
/** Matches the `vuu.connectionId` of the modules this server serves. */
|
|
10
13
|
connectionId: string;
|
|
11
|
-
modules:
|
|
14
|
+
modules: AnyVuuModule[];
|
|
15
|
+
/**
|
|
16
|
+
* The engine to register the modules with. Defaults to a new, isolated
|
|
17
|
+
* engine, so each server publishes only its own modules.
|
|
18
|
+
*/
|
|
19
|
+
engine?: LocalEngine;
|
|
12
20
|
}
|
|
13
21
|
/**
|
|
14
22
|
* Simulates a Vuu server in the browser, publishing the tables of the given
|
|
15
23
|
* modules. Pass the result to a local-mode `AuthenticationProvider` as one of
|
|
16
|
-
* its `localServers`.
|
|
24
|
+
* its `localServers`. The returned `engine` can be disposed when the server
|
|
25
|
+
* is no longer needed.
|
|
17
26
|
*/
|
|
18
|
-
export declare const createLocalVuuServer: ({ connectionId, modules, }: LocalVuuServerOptions) => LocalVuuServer
|
|
27
|
+
export declare const createLocalVuuServer: ({ connectionId, modules, engine, }: LocalVuuServerOptions) => LocalVuuServer & {
|
|
28
|
+
engine: LocalEngine;
|
|
29
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { LocalEngine } from "../core/engine/LocalEngine";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a Provider that installs both legacy and core data contexts,
|
|
5
|
+
* backed by the VuuModules registered with `engine`. Modules are resolved
|
|
6
|
+
* when used, so modules registered later are visible too.
|
|
7
|
+
*/
|
|
8
|
+
export declare const createDataSourceProvider: (engine: LocalEngine) => (({ children }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}) => ReactNode) | (({ children }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}) => import("react").JSX.Element);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ModuleAdminModule, MODULE_ADMIN_INITIAL_SNAPSHOT,
|
|
1
|
+
export { ModuleAdminModule, MODULE_ADMIN_INITIAL_SNAPSHOT, } from "./ModuleAdminModule";
|
|
2
2
|
export { MODULE_ADMIN_MODULE_NAME, MODULE_ADMIN_TABLE_SCHEMAS, type ModuleAdminTableName, } from "./module-admin-schemas";
|
|
3
3
|
export { projectModuleAdminSnapshot, reconcileModuleAdminTables, type ModuleAdminSnapshot, } from "./snapshot-projection";
|
|
4
4
|
export type { ManagedModule, ModuleConfig, } from "@heswell/module-admin/contracts";
|
|
@@ -29,6 +29,7 @@ export declare class NotificationModule extends VuuModule<NotificationsTableName
|
|
|
29
29
|
protected beforeCreateDataSource(): void;
|
|
30
30
|
get isRunning(): boolean;
|
|
31
31
|
start(): void;
|
|
32
|
+
dispose(): void;
|
|
32
33
|
stop(): void;
|
|
33
34
|
get menus(): undefined;
|
|
34
35
|
get menuServices(): undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { VuuLink, VuuMenu } from "@vuu-ui/vuu-protocol-types";
|
|
2
2
|
import { type MenuServiceHandler, type RpcMenuService, type RpcService, type ServiceHandler, VuuModule } from "../core/module/VuuModule";
|
|
3
3
|
import type { Table } from "../Table";
|
|
4
|
+
import { type PricesTable } from "./reference-data/prices";
|
|
4
5
|
import { type SimulTableName } from "./simul-schemas";
|
|
5
6
|
/**
|
|
6
7
|
* This is an example of how we might extend the built-in VuuModule to
|
|
@@ -9,7 +10,15 @@ import { type SimulTableName } from "./simul-schemas";
|
|
|
9
10
|
*/
|
|
10
11
|
export declare class SimulModule extends VuuModule<SimulTableName> {
|
|
11
12
|
#private;
|
|
13
|
+
/**
|
|
14
|
+
* Each instance generates its own tables. Prices start ticking when the
|
|
15
|
+
* first dataSource is created; call `dispose` to stop all timers.
|
|
16
|
+
*/
|
|
12
17
|
constructor();
|
|
18
|
+
protected beforeCreateDataSource(): void;
|
|
19
|
+
/** The prices table and its update generator, e.g. to share with BasketModule. */
|
|
20
|
+
get prices(): PricesTable;
|
|
21
|
+
dispose(): void;
|
|
13
22
|
get menus(): Record<SimulTableName, VuuMenu | undefined> | undefined;
|
|
14
23
|
get schemas(): Readonly<Record<SimulTableName, Readonly<import("@vuu-ui/vuu-data-types").TableSchema>>>;
|
|
15
24
|
get editServices(): undefined;
|
|
@@ -21,4 +30,3 @@ export declare class SimulModule extends VuuModule<SimulTableName> {
|
|
|
21
30
|
startOrders: ServiceHandler;
|
|
22
31
|
stopOrders: ServiceHandler;
|
|
23
32
|
}
|
|
24
|
-
export declare const simulModule: SimulModule;
|
package/src/simul/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { type SimulTableName, isSimulTable, schemas as simulSchemas, } from "./simul-schemas";
|
|
2
|
-
export {
|
|
2
|
+
export { SimulModule } from "./SimulModule";
|
|
@@ -56,5 +56,5 @@ export declare const InstrumentPricesColumnMap: {
|
|
|
56
56
|
vuuCreatedTimestamp: number;
|
|
57
57
|
vuuUpdatedTimestamp: number;
|
|
58
58
|
};
|
|
59
|
-
declare const
|
|
60
|
-
export {
|
|
59
|
+
export declare const getInstrumentPrices: () => InstrumentPricesDataRow[];
|
|
60
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const createInstrumentsExtendedTable: () => import("../..").Table;
|
|
@@ -29,7 +29,6 @@ export declare const InstrumentColumnMap: {
|
|
|
29
29
|
readonly vuuUpdatedTimestamp: 8;
|
|
30
30
|
readonly vuuMsg: 9;
|
|
31
31
|
};
|
|
32
|
-
declare const
|
|
32
|
+
export declare const getInstrumentsData: () => InstrumentsDataRow[];
|
|
33
33
|
export declare const getRic: (defaultRic: string) => string;
|
|
34
|
-
export declare const
|
|
35
|
-
export { instrumentsData };
|
|
34
|
+
export declare const createInstrumentsTable: () => import("../..").Table;
|
|
@@ -31,6 +31,5 @@ export declare const OrderColumnMap: {
|
|
|
31
31
|
readonly side: 7;
|
|
32
32
|
readonly trader: 8;
|
|
33
33
|
};
|
|
34
|
-
declare const
|
|
35
|
-
export declare const
|
|
36
|
-
export { ordersData };
|
|
34
|
+
export declare const getOrdersData: () => OrdersDataRow[];
|
|
35
|
+
export declare const createOrdersTable: () => import("../..").Table;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { Table } from "../../Table";
|
|
2
|
+
/**
|
|
3
|
+
* Generated parent and child orders. Each instance has its own tables
|
|
4
|
+
* and (optional) timer generating new orders.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ParentChildOrders {
|
|
7
|
+
#private;
|
|
8
|
+
readonly parentOrdersTable: Table;
|
|
9
|
+
readonly childOrdersTable: Table;
|
|
10
|
+
constructor();
|
|
11
|
+
get isGenerating(): boolean;
|
|
12
|
+
startGeneratingNewOrders(): void;
|
|
13
|
+
stopGeneratingNewOrders(): void;
|
|
14
|
+
createParentAndChildOrders(): void;
|
|
15
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type Table } from "../../Table";
|
|
2
|
+
import { BaseUpdateGenerator } from "../../UpdateGenerator";
|
|
1
3
|
type ask = number;
|
|
2
4
|
type askSize = number;
|
|
3
5
|
type bid = number;
|
|
@@ -26,9 +28,19 @@ export type PricesDataRow = [
|
|
|
26
28
|
created,
|
|
27
29
|
vuuMsg
|
|
28
30
|
];
|
|
29
|
-
declare const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
export declare const getPricesData: () => PricesDataRow[];
|
|
32
|
+
export type PricesTableOptions = {
|
|
33
|
+
/**
|
|
34
|
+
* Start ticking prices immediately. Default false, call
|
|
35
|
+
* `updateGenerator.start()`.
|
|
36
|
+
*/
|
|
37
|
+
autoStart?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type PricesTable = {
|
|
40
|
+
table: Table;
|
|
41
|
+
updateGenerator?: BaseUpdateGenerator;
|
|
42
|
+
};
|
|
43
|
+
export declare const createPricesTable: ({ autoStart, }?: PricesTableOptions) => PricesTable & {
|
|
44
|
+
updateGenerator: BaseUpdateGenerator;
|
|
45
|
+
};
|
|
46
|
+
export {};
|
package/src/test/TestModule.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { type RpcMenuService, VuuModule } from "../core/module/VuuModule";
|
|
|
2
2
|
import { type Table } from "../Table";
|
|
3
3
|
import type { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
4
4
|
export type TestTableName = "TestDates" | "TwoHundredColumns" | "LinkParent" | "LinkChild" | "ChartTable" | "MaxScrollEndTable" | "TestEditEmpty" | "TestEdit";
|
|
5
|
-
declare
|
|
5
|
+
export declare const testSchemas: Record<TestTableName, TableSchema>;
|
|
6
|
+
export declare class TestModule extends VuuModule<TestTableName> {
|
|
6
7
|
#private;
|
|
7
8
|
constructor();
|
|
8
9
|
get menus(): undefined;
|
|
@@ -12,5 +13,3 @@ declare class TestModule extends VuuModule<TestTableName> {
|
|
|
12
13
|
get tables(): Record<TestTableName, Table>;
|
|
13
14
|
get visualLinks(): undefined;
|
|
14
15
|
}
|
|
15
|
-
export declare const testModule: TestModule;
|
|
16
|
-
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { UserAdminModule
|
|
1
|
+
export { UserAdminModule } from "./UserAdminModule";
|
|
2
2
|
export { USER_ADMIN_INITIAL_SNAPSHOT } from "./initialSnapshot";
|
|
3
3
|
export { projectUserAdminSnapshot, reconcileUserAdminTables, } from "./snapshot-projection";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export type ask = number;
|
|
2
|
-
export type askSize = number;
|
|
3
|
-
export type bid = number;
|
|
4
|
-
export type bidSize = number;
|
|
5
|
-
export type close = number;
|
|
6
|
-
export type last = number;
|
|
7
|
-
export type open = number;
|
|
8
|
-
export type phase = "C";
|
|
9
|
-
export type ric = string;
|
|
10
|
-
export type scenario = "close";
|
|
11
|
-
export type PricesDataRow = [
|
|
12
|
-
ask,
|
|
13
|
-
askSize,
|
|
14
|
-
bid,
|
|
15
|
-
bidSize,
|
|
16
|
-
close,
|
|
17
|
-
last,
|
|
18
|
-
open,
|
|
19
|
-
phase,
|
|
20
|
-
ric,
|
|
21
|
-
scenario
|
|
22
|
-
];
|
|
23
|
-
declare const pricesTable: import("../..").Table;
|
|
24
|
-
export default pricesTable;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { VuuModule } from "./VuuModule";
|
|
2
|
-
type RegisteredVuuModule = VuuModule<any>;
|
|
3
|
-
declare class ModuleContainer {
|
|
4
|
-
#private;
|
|
5
|
-
private constructor();
|
|
6
|
-
static get instance(): ModuleContainer;
|
|
7
|
-
register(module: RegisteredVuuModule): void;
|
|
8
|
-
unregister(name: string): boolean;
|
|
9
|
-
has(name: string): boolean;
|
|
10
|
-
get(name: string): RegisteredVuuModule;
|
|
11
|
-
get moduleNames(): MapIterator<string>;
|
|
12
|
-
}
|
|
13
|
-
declare const _default: ModuleContainer;
|
|
14
|
-
export default _default;
|
|
15
|
-
export declare const ensureVuuModule: <T extends RegisteredVuuModule>(module: T) => T;
|