@vuu-ui/vuu-data-test 4.0.0-alpha.2 → 4.0.0-alpha.21
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 +8 -0
- package/package.json +11 -9
- package/src/Table.js +5 -5
- package/src/TickingArrayDataSource.js +7 -2
- package/src/core/filter/PermissionFilter.js +60 -0
- package/src/core/filter/PermissionFilteredTable.js +59 -0
- package/src/core/module/ModuleContainer.js +8 -0
- package/src/core/module/VuuModule.js +57 -7
- package/src/core/table/TableContainer.js +1 -1
- package/src/core/user/CurrentUser.js +13 -0
- package/src/index.js +7 -0
- package/src/local-datasource-provider/LocalDatasourceProvider.js +64 -44
- package/src/module-admin/ModuleAdminModule.js +124 -0
- package/src/module-admin/index.js +3 -0
- package/src/module-admin/module-admin-schemas.js +95 -0
- package/src/module-admin/snapshot-projection.js +29 -0
- package/src/notifications/NotificationModule.js +131 -0
- package/src/notifications/NotificationsSchema.js +52 -0
- package/src/notifications/index.js +6 -0
- package/src/notifications/simulated/DismissNotificationRpcHandler.js +36 -0
- package/src/notifications/simulated/SimulatedNotificationsModule.js +18 -0
- package/src/notifications/simulated/SimulatedNotificationsProvider.js +151 -0
- package/src/notifications/simulated/notificationsModule.js +3 -0
- package/src/schemas.js +8 -2
- package/src/user-admin/UserAdminModule.js +567 -0
- package/src/user-admin/index.js +3 -0
- package/src/user-admin/initialSnapshot.js +461 -0
- package/src/user-admin/snapshot-projection.js +151 -0
- package/types/TickingArrayDataSource.d.ts +1 -1
- package/types/core/filter/PermissionFilter.d.ts +41 -0
- package/types/core/filter/PermissionFilteredTable.d.ts +24 -0
- package/types/core/module/ModuleContainer.d.ts +6 -3
- package/types/core/module/VuuModule.d.ts +22 -0
- package/types/core/table/TableContainer.d.ts +5 -5
- package/types/core/user/CurrentUser.d.ts +14 -0
- package/types/index.d.ts +7 -0
- package/types/local-datasource-provider/LocalDatasourceProvider.d.ts +18 -2
- package/types/module-admin/ModuleAdminModule.d.ts +32 -0
- package/types/module-admin/index.d.ts +4 -0
- package/types/module-admin/module-admin-schemas.d.ts +4 -0
- package/types/module-admin/snapshot-projection.d.ts +13 -0
- package/types/notifications/NotificationModule.d.ts +60 -0
- package/types/notifications/NotificationsSchema.d.ts +20 -0
- package/types/notifications/index.d.ts +6 -0
- package/types/notifications/simulated/DismissNotificationRpcHandler.d.ts +8 -0
- package/types/notifications/simulated/SimulatedNotificationsModule.d.ts +9 -0
- package/types/notifications/simulated/SimulatedNotificationsProvider.d.ts +21 -0
- package/types/notifications/simulated/notificationsModule.d.ts +5 -0
- package/types/schemas.d.ts +5 -3
- package/types/user-admin/UserAdminModule.d.ts +54 -0
- package/types/user-admin/index.d.ts +3 -0
- package/types/user-admin/initialSnapshot.d.ts +2 -0
- package/types/user-admin/snapshot-projection.d.ts +9 -0
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { VuuModule } from "./VuuModule";
|
|
1
|
+
import type { VuuModule } from "./VuuModule";
|
|
2
|
+
type RegisteredVuuModule = VuuModule<any>;
|
|
2
3
|
declare class ModuleContainer {
|
|
3
4
|
#private;
|
|
4
5
|
private constructor();
|
|
5
6
|
static get instance(): ModuleContainer;
|
|
6
|
-
register(module:
|
|
7
|
-
|
|
7
|
+
register(module: RegisteredVuuModule): void;
|
|
8
|
+
has(name: string): boolean;
|
|
9
|
+
get(name: string): RegisteredVuuModule;
|
|
8
10
|
get moduleNames(): MapIterator<string>;
|
|
9
11
|
}
|
|
10
12
|
declare const _default: ModuleContainer;
|
|
11
13
|
export default _default;
|
|
14
|
+
export declare const ensureVuuModule: <T extends RegisteredVuuModule>(module: T) => T;
|
|
@@ -2,6 +2,8 @@ import type { DataSourceBase, DataSourceConfig, DataSourceRowWithBigint, DataSou
|
|
|
2
2
|
import type { VuuMenu, VuuLink, LinkDescriptorWithLabel, VuuRpcMenuResponse, VuuCreateVisualLink, VuuRemoveVisualLink, VuuRpcServiceRequest, RpcResultSuccess, RpcResultError, VuuRpcMenuRequest } from "@vuu-ui/vuu-protocol-types";
|
|
3
3
|
import { Table } from "../../Table";
|
|
4
4
|
import { TickingArrayDataSource } from "../../TickingArrayDataSource";
|
|
5
|
+
import { type PermissionFunction } from "../filter/PermissionFilter";
|
|
6
|
+
import { type VuuModuleUser } from "../user/CurrentUser";
|
|
5
7
|
export interface IVuuModule<T extends string = string> {
|
|
6
8
|
createDataSource: (tableName: T, viewport?: string, config?: DataSourceConfig & {
|
|
7
9
|
session?: SessionDataSourceOverrides;
|
|
@@ -28,6 +30,12 @@ type Subscription = {
|
|
|
28
30
|
dataSource: DataSourceBase<DataSourceRowWithBigint>;
|
|
29
31
|
sessionTableName?: string;
|
|
30
32
|
sourceTableName?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The table viewed by this subscription. Where a permission filter applies,
|
|
35
|
+
* this will be a PermissionFilteredTable
|
|
36
|
+
*/
|
|
37
|
+
table: Table;
|
|
38
|
+
user: VuuModuleUser;
|
|
31
39
|
};
|
|
32
40
|
export declare abstract class VuuModule<T extends string = string> implements IVuuModule<T> {
|
|
33
41
|
#private;
|
|
@@ -38,6 +46,19 @@ export declare abstract class VuuModule<T extends string = string> implements IV
|
|
|
38
46
|
protected abstract menuServices?: Record<T, RpcMenuService[] | undefined> | undefined;
|
|
39
47
|
protected abstract services?: Record<T, RpcService[] | undefined> | undefined;
|
|
40
48
|
protected abstract visualLinks?: Record<T, VuuLink[] | undefined>;
|
|
49
|
+
protected get includeDefaultServices(): boolean;
|
|
50
|
+
protected beforeSessionSave(_sourceTable: Table, _sessionTable: Table): Promise<void>;
|
|
51
|
+
protected afterSessionSave(_sourceTable: Table, _sessionTable: Table): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Optional, per table. Restricts the rows visible to each viewport, based on
|
|
54
|
+
* the viewport (and the user who owns it).
|
|
55
|
+
*/
|
|
56
|
+
protected permissionFunctions?: Partial<Record<T, PermissionFunction>>;
|
|
57
|
+
/**
|
|
58
|
+
* Invoked before a dataSource is created. Can be used, for example, to
|
|
59
|
+
* lazily start a data provider.
|
|
60
|
+
*/
|
|
61
|
+
protected beforeCreateDataSource?(tableName: T): void;
|
|
41
62
|
getTableSchema(tableName: string): Record<T, Readonly<TableSchema>>[T];
|
|
42
63
|
getTableList(): string[];
|
|
43
64
|
protected handlePostSubscribeActivities: ({ clientViewportId, tableSchema, }: DataSourceSubscribedMessage) => void;
|
|
@@ -51,6 +72,7 @@ export declare abstract class VuuModule<T extends string = string> implements IV
|
|
|
51
72
|
createDataSource: (tableName: T, viewport?: string, config?: DataSourceConfig & {
|
|
52
73
|
session?: SessionDataSourceOverrides;
|
|
53
74
|
}) => DataSourceBase<DataSourceRowWithBigint>;
|
|
75
|
+
private createPermissionFilteredTable;
|
|
54
76
|
getServices(tableName: T): RpcService[];
|
|
55
77
|
getMenuServices(tableName: T): RpcMenuService[];
|
|
56
78
|
protected get sessionTableMap(): SessionTableMap;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
1
|
+
import type { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
2
2
|
import { Table } from "../../Table";
|
|
3
|
-
import { VuuRowDataItemType, VuuTable } from "@vuu-ui/vuu-protocol-types";
|
|
4
|
-
import { ColumnMap } from "@vuu-ui/vuu-utils";
|
|
5
|
-
import { UpdateGenerator } from "../../rowUpdates";
|
|
3
|
+
import type { VuuRowDataItemType, VuuTable } from "@vuu-ui/vuu-protocol-types";
|
|
4
|
+
import type { ColumnMap } from "@vuu-ui/vuu-utils";
|
|
5
|
+
import type { UpdateGenerator } from "../../rowUpdates";
|
|
6
6
|
declare class TableContainer {
|
|
7
7
|
#private;
|
|
8
8
|
private constructor();
|
|
9
9
|
static get instance(): TableContainer;
|
|
10
|
-
createTable: (schema: TableSchema, data
|
|
10
|
+
createTable: (schema: TableSchema, data?: Array<Array<VuuRowDataItemType | bigint>>, dataMap?: ColumnMap, updateGenerator?: UpdateGenerator) => Table;
|
|
11
11
|
createJoinTable(joinTable: VuuTable, { table: t1 }: VuuTable, { table: t2 }: VuuTable, joinColumn: string): Table;
|
|
12
12
|
addTable(table: Table): void;
|
|
13
13
|
getTable<T = Table>(tableName: string): NonNullable<T>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The user that owns a viewport, as seen by permission functions and
|
|
3
|
+
* rpc services.
|
|
4
|
+
*/
|
|
5
|
+
export interface VuuModuleUser {
|
|
6
|
+
authorizations: string[];
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const getCurrentUser: () => VuuModuleUser;
|
|
10
|
+
/**
|
|
11
|
+
* Applies to viewports created after the change. Pass undefined to restore
|
|
12
|
+
* the default user.
|
|
13
|
+
*/
|
|
14
|
+
export declare const setCurrentUser: (user?: string | VuuModuleUser) => void;
|
package/types/index.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
export * from "./ArrayProxy";
|
|
2
|
+
export * from "./core/filter/PermissionFilter";
|
|
3
|
+
export * from "./core/filter/PermissionFilteredTable";
|
|
2
4
|
export * from "./core/module/VuuModule";
|
|
5
|
+
export { ensureVuuModule } from "./core/module/ModuleContainer";
|
|
6
|
+
export * from "./core/user/CurrentUser";
|
|
3
7
|
export { default as tableContainer } from "./core/table/TableContainer";
|
|
4
8
|
export * from "./local-datasource-provider/LocalDatasourceProvider";
|
|
5
9
|
export * from "./makeSuggestions";
|
|
10
|
+
export * from "./notifications";
|
|
6
11
|
export * from "./schemas";
|
|
7
12
|
export * from "./simul";
|
|
8
13
|
export * from "./basket";
|
|
14
|
+
export * from "./module-admin";
|
|
15
|
+
export * from "./user-admin";
|
|
9
16
|
export { buildDataColumnMap, buildDataColumnMapFromSchema, Table, type TableEvents, } from "./Table";
|
|
10
17
|
export * from "./test";
|
|
11
18
|
export * from "./TickingArrayDataSource";
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
import { type LocalVuuServer } from "@vuu-ui/core";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
+
import type { VuuModule } from "../core/module/VuuModule";
|
|
4
|
+
/** Data context covering every VuuModule registered in the browser. */
|
|
5
|
+
export declare const LocalDataSourceProvider: ({ children }: {
|
|
3
6
|
children: ReactNode;
|
|
4
|
-
}) => import("react").JSX.Element;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export interface LocalVuuServerOptions {
|
|
9
|
+
/** Matches the `vuu.connectionId` of the modules this server serves. */
|
|
10
|
+
connectionId: string;
|
|
11
|
+
modules: VuuModule<any>[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Simulates a Vuu server in the browser, publishing the tables of the given
|
|
15
|
+
* modules. Module instances are resolved from this server, not by name from
|
|
16
|
+
* the global registry, so servers can each have their own instance of a
|
|
17
|
+
* module (e.g. NOTIFICATIONS). Pass the result to a local-mode `AuthenticationProvider` as one of
|
|
18
|
+
* its `localServers`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const createLocalVuuServer: ({ connectionId, modules, }: LocalVuuServerOptions) => LocalVuuServer;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ManagedModule } from "@heswell/module-admin/contracts";
|
|
2
|
+
import type { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
3
|
+
import { VuuModule, type RpcService } from "../core/module/VuuModule";
|
|
4
|
+
import { type Table } from "../Table";
|
|
5
|
+
import { type ModuleAdminTableName } from "./module-admin-schemas";
|
|
6
|
+
import { type ModuleAdminSnapshot } from "./snapshot-projection";
|
|
7
|
+
type ModuleAdminTables = Record<ModuleAdminTableName, Table>;
|
|
8
|
+
export declare const MODULE_ADMIN_INITIAL_SNAPSHOT: ModuleAdminSnapshot;
|
|
9
|
+
/**
|
|
10
|
+
* In-browser MODULE_DISCOVERY server. Supports the module admin RPCs from
|
|
11
|
+
* `@heswell/module-admin/contracts` on both tables; state is held in memory.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ModuleAdminModule extends VuuModule<ModuleAdminTableName> {
|
|
14
|
+
#private;
|
|
15
|
+
private readonly now;
|
|
16
|
+
constructor(snapshot?: ModuleAdminSnapshot, now?: () => number);
|
|
17
|
+
/** Current module state. */
|
|
18
|
+
get modules(): readonly ManagedModule[];
|
|
19
|
+
get menus(): {
|
|
20
|
+
modulePermissions: undefined;
|
|
21
|
+
modules: undefined;
|
|
22
|
+
};
|
|
23
|
+
protected get includeDefaultServices(): boolean;
|
|
24
|
+
get menuServices(): undefined;
|
|
25
|
+
get schemas(): Record<ModuleAdminTableName, Readonly<TableSchema>>;
|
|
26
|
+
private service;
|
|
27
|
+
get services(): Record<ModuleAdminTableName, RpcService[]>;
|
|
28
|
+
get tables(): ModuleAdminTables;
|
|
29
|
+
get visualLinks(): undefined;
|
|
30
|
+
}
|
|
31
|
+
export declare const moduleAdminModule: ModuleAdminModule;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ModuleAdminModule, MODULE_ADMIN_INITIAL_SNAPSHOT, moduleAdminModule, } from "./ModuleAdminModule";
|
|
2
|
+
export { MODULE_ADMIN_MODULE_NAME, MODULE_ADMIN_TABLE_SCHEMAS, type ModuleAdminTableName, } from "./module-admin-schemas";
|
|
3
|
+
export { projectModuleAdminSnapshot, reconcileModuleAdminTables, type ModuleAdminSnapshot, } from "./snapshot-projection";
|
|
4
|
+
export type { ManagedModule, ModuleAccessRole, ModuleConfig, ModuleDefinition, ModulePermissionRow, ModuleRow, } from "@heswell/module-admin/contracts";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
export declare const MODULE_ADMIN_MODULE_NAME = "MODULE_DISCOVERY";
|
|
3
|
+
export type ModuleAdminTableName = "modules" | "modulePermissions";
|
|
4
|
+
export declare const MODULE_ADMIN_TABLE_SCHEMAS: Readonly<Record<ModuleAdminTableName, Readonly<TableSchema>>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ManagedModule } from "@heswell/module-admin/contracts";
|
|
2
|
+
import type { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
+
import type { Table } from "../Table";
|
|
4
|
+
import type { ModuleAdminTableName } from "./module-admin-schemas";
|
|
5
|
+
type Row = Array<bigint | VuuRowDataItemType>;
|
|
6
|
+
type Tables = Record<ModuleAdminTableName, Table>;
|
|
7
|
+
export type ModuleAdminSnapshot = {
|
|
8
|
+
modules: readonly ManagedModule[];
|
|
9
|
+
};
|
|
10
|
+
export declare const projectModuleAdminSnapshot: (snapshot: ModuleAdminSnapshot, tables: Tables) => Record<ModuleAdminTableName, Row[]>;
|
|
11
|
+
/** Brings the tables into line with the snapshot, emitting row-level updates. */
|
|
12
|
+
export declare const reconcileModuleAdminTables: (snapshot: ModuleAdminSnapshot, tables: Tables) => void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
import type { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
+
import { type RpcService, VuuModule } from "../core/module/VuuModule";
|
|
4
|
+
import type { PermissionFunction } from "../core/filter/PermissionFilter";
|
|
5
|
+
import { type Table } from "../Table";
|
|
6
|
+
import { type ColumnDefinition } from "./NotificationsSchema";
|
|
7
|
+
export type NotificationsTableName = "notifications";
|
|
8
|
+
/**
|
|
9
|
+
* Source of notifications. Started when the first dataSource is
|
|
10
|
+
* created for the notifications table, or explicitly via module.start().
|
|
11
|
+
*/
|
|
12
|
+
export interface NotificationsProvider {
|
|
13
|
+
start: () => void;
|
|
14
|
+
stop: () => void;
|
|
15
|
+
}
|
|
16
|
+
export type NotificationsProviderFactory = (table: Table) => NotificationsProvider;
|
|
17
|
+
/**
|
|
18
|
+
* A notification to publish. Values are keyed by column name; columns not
|
|
19
|
+
* supplied are defaulted. `expiryTime` (epoch ms) schedules deletion of the row.
|
|
20
|
+
*/
|
|
21
|
+
export interface NotificationInput {
|
|
22
|
+
id?: string;
|
|
23
|
+
type?: string;
|
|
24
|
+
expiryTime?: number;
|
|
25
|
+
title?: string;
|
|
26
|
+
message?: string;
|
|
27
|
+
level?: string;
|
|
28
|
+
audience?: string;
|
|
29
|
+
[columnName: string]: VuuRowDataItemType | undefined;
|
|
30
|
+
}
|
|
31
|
+
export type NotificationsServiceFactory = (table: Table, module: NotificationModule) => RpcService[];
|
|
32
|
+
/**
|
|
33
|
+
* A generic Notifications module, exposing a single 'notifications' table.
|
|
34
|
+
* The source of notifications (provider), the rows visible to each user
|
|
35
|
+
* (permissionFunction) and any rpc services (serviceFactory) are supplied
|
|
36
|
+
* by the consumer. Any additional columns are appended to the generic
|
|
37
|
+
* notification columns (see NotificationsSchema).
|
|
38
|
+
*/
|
|
39
|
+
export declare class NotificationModule extends VuuModule<NotificationsTableName> {
|
|
40
|
+
#private;
|
|
41
|
+
static readonly NAME = "NOTIFICATIONS";
|
|
42
|
+
static readonly TABLE_NAME: "notifications";
|
|
43
|
+
constructor(providerFactory: NotificationsProviderFactory, permissionFunction: PermissionFunction, serviceFactory: NotificationsServiceFactory, ...additionalColumns: ColumnDefinition[]);
|
|
44
|
+
protected beforeCreateDataSource(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Inserts a notification row, as a server-side publisher would. Defaults:
|
|
47
|
+
* a random `id`, `type` "toast", `level` "INFO", `audience` "all" and
|
|
48
|
+
* empty strings for other string columns. Returns the row id.
|
|
49
|
+
*/
|
|
50
|
+
publish(notification?: NotificationInput): string;
|
|
51
|
+
get isRunning(): boolean;
|
|
52
|
+
start(): void;
|
|
53
|
+
stop(): void;
|
|
54
|
+
get menus(): undefined;
|
|
55
|
+
get menuServices(): undefined;
|
|
56
|
+
get schemas(): Record<"notifications", TableSchema>;
|
|
57
|
+
get services(): Record<"notifications", RpcService[]>;
|
|
58
|
+
get tables(): Record<"notifications", Table>;
|
|
59
|
+
get visualLinks(): undefined;
|
|
60
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SchemaColumn } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
/**
|
|
3
|
+
* Accepts either a SchemaColumn or a column definition in the Scala server
|
|
4
|
+
* 'name:Type' format, e.g. "source:String", "priority:Int".
|
|
5
|
+
*/
|
|
6
|
+
export type ColumnDefinition = SchemaColumn | string;
|
|
7
|
+
export declare const toColumn: (columnDefinition: ColumnDefinition) => SchemaColumn;
|
|
8
|
+
export declare const NotificationsSchema: {
|
|
9
|
+
Id: string;
|
|
10
|
+
Type: string;
|
|
11
|
+
ExpiryTime: string;
|
|
12
|
+
Title: string;
|
|
13
|
+
Message: string;
|
|
14
|
+
Level: string;
|
|
15
|
+
Audience: string;
|
|
16
|
+
/**
|
|
17
|
+
* The generic notification columns, plus any additional columns.
|
|
18
|
+
*/
|
|
19
|
+
allFrom: (...additionalColumns: ColumnDefinition[]) => SchemaColumn[];
|
|
20
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./NotificationModule";
|
|
2
|
+
export * from "./NotificationsSchema";
|
|
3
|
+
export * from "./simulated/DismissNotificationRpcHandler";
|
|
4
|
+
export * from "./simulated/SimulatedNotificationsModule";
|
|
5
|
+
export * from "./simulated/SimulatedNotificationsProvider";
|
|
6
|
+
export * from "./simulated/notificationsModule";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RpcService } from "../../core/module/VuuModule";
|
|
2
|
+
import type { Table } from "../../Table";
|
|
3
|
+
import type { NotificationModule } from "../NotificationModule";
|
|
4
|
+
/**
|
|
5
|
+
* Marks the notifications selected in the requesting viewport as dismissed
|
|
6
|
+
* by the user that owns the viewport.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DismissNotificationRpcHandler: (table: Table, module: NotificationModule) => RpcService[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NotificationModule } from "../NotificationModule";
|
|
2
|
+
export interface SimulatedNotificationsModuleOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Generate random notifications. When false, notifications are only
|
|
5
|
+
* created by calls to `publish`. Default true.
|
|
6
|
+
*/
|
|
7
|
+
simulate?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const SimulatedNotificationsModule: ({ simulate, }?: SimulatedNotificationsModuleOptions) => NotificationModule;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Table } from "../../Table";
|
|
2
|
+
import type { NotificationsProvider } from "../NotificationModule";
|
|
3
|
+
/**
|
|
4
|
+
* Minimal implementation of the subset of Java String.format used by
|
|
5
|
+
* the message templates: %d, %0nd and %%. Args are consumed in order.
|
|
6
|
+
*/
|
|
7
|
+
export declare const formatMessage: (format: string, ...args: number[]) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Generates random notifications. Seeds an initial set of notifications on
|
|
10
|
+
* start then, on each cycle, deletes expired notifications and adds a new
|
|
11
|
+
* notification if fewer than the maximum are active.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SimulatedNotificationsProvider implements NotificationsProvider {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(table: Table);
|
|
16
|
+
start(): void;
|
|
17
|
+
stop(): void;
|
|
18
|
+
runOnce: () => void;
|
|
19
|
+
private generateRandomNotification;
|
|
20
|
+
private toDataRow;
|
|
21
|
+
}
|
package/types/schemas.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
1
|
+
import type { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
2
2
|
import { type BasketsTableName } from "./basket/basket-schemas";
|
|
3
3
|
import { type SimulTableName } from "./simul/simul-schemas";
|
|
4
|
-
import { TestTableName } from "./test/TestModule";
|
|
5
|
-
|
|
4
|
+
import { type TestTableName } from "./test/TestModule";
|
|
5
|
+
import { type UserAdminTableName } from "@heswell/user-admin/contracts";
|
|
6
|
+
import { type ModuleAdminTableName } from "./module-admin";
|
|
7
|
+
export type VuuTableName = BasketsTableName | SimulTableName | TestTableName | UserAdminTableName | ModuleAdminTableName;
|
|
6
8
|
export declare const schemas: Record<VuuTableName, TableSchema>;
|
|
7
9
|
export declare const getAllSchemas: () => Record<VuuTableName, TableSchema>;
|
|
8
10
|
export declare const getSchema: (tableName: VuuTableName) => Readonly<TableSchema>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type UserAdminSnapshot, type UserAdminTableName } from "@heswell/user-admin/contracts";
|
|
2
|
+
import { InMemoryUserAdminStore } from "@heswell/user-admin/in-memory";
|
|
3
|
+
import type { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
4
|
+
import { VuuModule, type RpcService } from "../core/module/VuuModule";
|
|
5
|
+
import { Table } from "../Table";
|
|
6
|
+
type UserAdminTables = Record<UserAdminTableName, Table>;
|
|
7
|
+
export declare class UserAdminModule extends VuuModule<UserAdminTableName> {
|
|
8
|
+
#private;
|
|
9
|
+
readonly store: InMemoryUserAdminStore;
|
|
10
|
+
constructor(snapshot?: UserAdminSnapshot);
|
|
11
|
+
get schemas(): Record<UserAdminTableName, Readonly<TableSchema>>;
|
|
12
|
+
get tables(): UserAdminTables;
|
|
13
|
+
get menus(): {
|
|
14
|
+
clients: undefined;
|
|
15
|
+
group_roles: undefined;
|
|
16
|
+
groups: undefined;
|
|
17
|
+
roles: undefined;
|
|
18
|
+
user_group_roles: undefined;
|
|
19
|
+
user_groups: undefined;
|
|
20
|
+
users: undefined;
|
|
21
|
+
};
|
|
22
|
+
get visualLinks(): undefined;
|
|
23
|
+
get menuServices(): undefined;
|
|
24
|
+
get services(): Record<UserAdminTableName, RpcService[]>;
|
|
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("../TickingArrayDataSource").TickingArrayDataSource, sessionType?: import("@vuu-ui/vuu-data-types").SessionType): Table;
|
|
27
|
+
protected beforeSessionSave(sourceTable: Table, sessionTable: Table): Promise<void>;
|
|
28
|
+
protected afterSessionSave(sourceTable: Table, sessionTable: Table): Promise<void>;
|
|
29
|
+
private saveGroupsFromSession;
|
|
30
|
+
private saveGroupRoleAssignments;
|
|
31
|
+
private resolveGroupRoleAssignments;
|
|
32
|
+
private saveClientRolesFromSession;
|
|
33
|
+
private mutation;
|
|
34
|
+
private addUser;
|
|
35
|
+
private updateUser;
|
|
36
|
+
private deleteUser;
|
|
37
|
+
private addGroup;
|
|
38
|
+
private updateGroup;
|
|
39
|
+
private deleteGroup;
|
|
40
|
+
private addClient;
|
|
41
|
+
private updateClient;
|
|
42
|
+
private addRole;
|
|
43
|
+
private addClientRole;
|
|
44
|
+
private updateRole;
|
|
45
|
+
private assignGroupRole;
|
|
46
|
+
private removeGroupRole;
|
|
47
|
+
private assignUserToGroup;
|
|
48
|
+
private removeUserFromGroup;
|
|
49
|
+
private getUserModuleAccessOptions;
|
|
50
|
+
private setUserModuleAccess;
|
|
51
|
+
private assertUsernameIsUnique;
|
|
52
|
+
}
|
|
53
|
+
export declare const userAdminModule: UserAdminModule;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UserAdminSnapshot, UserAdminTableName } from "@heswell/user-admin/contracts";
|
|
2
|
+
import type { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
+
import type { Table } from "../Table";
|
|
4
|
+
type Row = Array<bigint | VuuRowDataItemType>;
|
|
5
|
+
type Tables = Record<UserAdminTableName, Table>;
|
|
6
|
+
export declare const resolveDisplayName: (name: string, configuredDisplayName?: string) => string;
|
|
7
|
+
export declare const projectUserAdminSnapshot: (snapshot: UserAdminSnapshot, tables: Tables) => Record<UserAdminTableName, Row[]>;
|
|
8
|
+
export declare const reconcileUserAdminTables: (snapshot: UserAdminSnapshot, tables: Tables) => void;
|
|
9
|
+
export {};
|