@vuu-ui/vuu-data-test 3.3.1 → 3.3.2
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.3.
|
|
2
|
+
"version": "3.3.2",
|
|
3
3
|
"main": "./src/index.js",
|
|
4
4
|
"author": "heswell",
|
|
5
5
|
"license": "Apache-2.0",
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"type-defs": "node ../../scripts/build-type-defs.mjs"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@vuu-ui/vuu-data-local": "3.3.
|
|
13
|
-
"@vuu-ui/vuu-utils": "3.3.
|
|
12
|
+
"@vuu-ui/vuu-data-local": "3.3.2",
|
|
13
|
+
"@vuu-ui/vuu-utils": "3.3.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@vuu-ui/vuu-protocol-types": "3.3.
|
|
17
|
-
"@vuu-ui/vuu-data-types": "3.3.
|
|
18
|
-
"@vuu-ui/vuu-table-types": "3.3.
|
|
16
|
+
"@vuu-ui/vuu-protocol-types": "3.3.2",
|
|
17
|
+
"@vuu-ui/vuu-data-types": "3.3.2",
|
|
18
|
+
"@vuu-ui/vuu-table-types": "3.3.2"
|
|
19
19
|
},
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"files": [
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { ArrayDataSource } from "@vuu-ui/vuu-data-local";
|
|
2
|
-
import { StaleUpdateError, isRpcSuccess, isTypeaheadRequest } from "@vuu-ui/vuu-utils";
|
|
2
|
+
import { StaleUpdateError, assertExpectedSessionTable, isRpcSuccess, isTypeaheadRequest, sessionDataSourceConfig } from "@vuu-ui/vuu-utils";
|
|
3
3
|
import { makeSuggestions } from "./makeSuggestions.js";
|
|
4
4
|
class TickingArrayDataSource extends ArrayDataSource {
|
|
5
5
|
#menuRpcServices;
|
|
6
6
|
#pendingVisualLink;
|
|
7
7
|
#rpcMenuServices;
|
|
8
8
|
#rpcServices;
|
|
9
|
+
#session;
|
|
9
10
|
#sourceTableDataSource;
|
|
10
11
|
#table;
|
|
11
12
|
#selectionLinkSubscribers;
|
|
12
13
|
#visualLinkService;
|
|
13
14
|
#getVisualLinks;
|
|
14
15
|
#vuuModule;
|
|
15
|
-
constructor({ data, getVisualLinks, rpcServices, rpcMenuServices, table, menu, visualLink, visualLinkService, vuuModule, ...arrayDataSourceProps }){
|
|
16
|
+
constructor({ data, getVisualLinks, rpcServices, rpcMenuServices, session, table, menu, visualLink, visualLinkService, vuuModule, ...arrayDataSourceProps }){
|
|
16
17
|
if (void 0 === data && void 0 === table) throw Error("TickingArrayDataSource must be constructed with data");
|
|
17
18
|
super({
|
|
18
19
|
...arrayDataSourceProps,
|
|
@@ -23,6 +24,7 @@ class TickingArrayDataSource extends ArrayDataSource {
|
|
|
23
24
|
this.#rpcMenuServices = rpcMenuServices;
|
|
24
25
|
this.#pendingVisualLink = visualLink;
|
|
25
26
|
this.#rpcServices = rpcServices;
|
|
27
|
+
this.#session = session;
|
|
26
28
|
this.#table = table;
|
|
27
29
|
this.#visualLinkService = visualLinkService;
|
|
28
30
|
this.#getVisualLinks = getVisualLinks;
|
|
@@ -63,7 +65,7 @@ class TickingArrayDataSource extends ArrayDataSource {
|
|
|
63
65
|
isSessionDataSourceOf(dataSource) {
|
|
64
66
|
return this.#sourceTableDataSource === dataSource;
|
|
65
67
|
}
|
|
66
|
-
async createSessionDataSource(copyOption, sessionType = "edit") {
|
|
68
|
+
async createSessionDataSource(copyOption, sessionType = "edit", overrides) {
|
|
67
69
|
const rpcResponse = await this?.rpcRequest?.({
|
|
68
70
|
type: "RPC_REQUEST",
|
|
69
71
|
rpcName: "createSessionTable",
|
|
@@ -74,10 +76,13 @@ class TickingArrayDataSource extends ArrayDataSource {
|
|
|
74
76
|
});
|
|
75
77
|
if (isRpcSuccess(rpcResponse)) {
|
|
76
78
|
const { table: sessionTable } = rpcResponse.data;
|
|
77
|
-
const
|
|
79
|
+
const effectiveOverrides = overrides ?? this.#session;
|
|
80
|
+
assertExpectedSessionTable(sessionTable, effectiveOverrides?.table);
|
|
81
|
+
const sessionConfig = sessionDataSourceConfig(this.config, effectiveOverrides?.columns);
|
|
82
|
+
const baseColumns = sessionConfig.columns.includes("vuuAction") ? sessionConfig.columns : sessionConfig.columns.concat("vuuAction");
|
|
78
83
|
const columns = "import" !== sessionType || baseColumns.includes("vuuRowNum") ? baseColumns : baseColumns.concat("vuuRowNum");
|
|
79
84
|
const sessionDataSource = this.#vuuModule?.createDataSource(sessionTable.table, sessionTable.table, {
|
|
80
|
-
...
|
|
85
|
+
...sessionConfig,
|
|
81
86
|
columns
|
|
82
87
|
});
|
|
83
88
|
if (sessionDataSource instanceof TickingArrayDataSource) sessionDataSource.#sourceTableDataSource = this;
|
|
@@ -85,7 +90,7 @@ class TickingArrayDataSource extends ArrayDataSource {
|
|
|
85
90
|
}
|
|
86
91
|
throw Error(`[TickingArrayDataSource] createSessionDataSource ${rpcResponse?.errorMessage}`);
|
|
87
92
|
}
|
|
88
|
-
async beginEditSession(editSessionMode = "all-rows") {
|
|
93
|
+
async beginEditSession(editSessionMode = "all-rows", overrides) {
|
|
89
94
|
const rpcResponse = await this?.rpcRequest?.({
|
|
90
95
|
type: "RPC_REQUEST",
|
|
91
96
|
rpcName: "beginEditSession",
|
|
@@ -95,8 +100,10 @@ class TickingArrayDataSource extends ArrayDataSource {
|
|
|
95
100
|
});
|
|
96
101
|
if (isRpcSuccess(rpcResponse)) {
|
|
97
102
|
const { table: sessionTable } = rpcResponse.data;
|
|
103
|
+
const effectiveOverrides = overrides ?? this.#session;
|
|
104
|
+
assertExpectedSessionTable(sessionTable, effectiveOverrides?.table);
|
|
98
105
|
const sessionDataSource = this.#vuuModule?.createDataSource(sessionTable.table, sessionTable.table, {
|
|
99
|
-
...this.config
|
|
106
|
+
...sessionDataSourceConfig(this.config, effectiveOverrides?.columns)
|
|
100
107
|
});
|
|
101
108
|
if (sessionDataSource instanceof TickingArrayDataSource) sessionDataSource.#sourceTableDataSource = this;
|
|
102
109
|
return sessionDataSource;
|
|
@@ -23,12 +23,13 @@ const serverAPI = {
|
|
|
23
23
|
};
|
|
24
24
|
const getServerAPI = async ()=>serverAPI;
|
|
25
25
|
class VuuDataSource {
|
|
26
|
-
constructor({ aggregations, columns, filterSpec, groupBy, sort, table, viewport, visualLink }){
|
|
26
|
+
constructor({ aggregations, columns, filterSpec, groupBy, session, sort, table, viewport, visualLink }){
|
|
27
27
|
const config = {
|
|
28
28
|
aggregations,
|
|
29
29
|
columns,
|
|
30
30
|
filterSpec,
|
|
31
31
|
groupBy,
|
|
32
|
+
session,
|
|
32
33
|
sort,
|
|
33
34
|
visualLink
|
|
34
35
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ArrayDataSource, type ArrayDataSourceConstructorProps } from "@vuu-ui/vuu-data-local";
|
|
2
|
-
import type { DataSourceBase, DataSource, DataSourceRowWithBigint, DataSourceSubscribeCallback, DataSourceSubscribeProps, DataSourceVisualLinkCreatedMessage, DeleteRowMode, CopyOption, EditSessionMode, SessionType } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
import type { DataSourceBase, DataSource, DataSourceRowWithBigint, DataSourceSubscribeCallback, DataSourceSubscribeProps, DataSourceVisualLinkCreatedMessage, DeleteRowMode, CopyOption, EditSessionMode, SessionDataSourceOverrides, SessionType } from "@vuu-ui/vuu-data-types";
|
|
3
3
|
import type { LinkDescriptorWithLabel, RpcResultError, RpcResultSuccess, VuuCreateVisualLink, VuuMenu, VuuRemoveVisualLink, VuuRowDataItemType, VuuRpcMenuRequest, VuuRpcMenuResponse, VuuRpcServiceRequest } from "@vuu-ui/vuu-protocol-types";
|
|
4
4
|
import type { IVuuModule, RpcMenuService, RpcService } from "./core/module/VuuModule";
|
|
5
5
|
import type { Table } from "./Table";
|
|
@@ -16,7 +16,7 @@ export interface TickingArrayDataSourceConstructorProps extends Omit<ArrayDataSo
|
|
|
16
16
|
}
|
|
17
17
|
export declare class TickingArrayDataSource extends ArrayDataSource {
|
|
18
18
|
#private;
|
|
19
|
-
constructor({ data, getVisualLinks, rpcServices, rpcMenuServices, table, menu, visualLink, visualLinkService, vuuModule, ...arrayDataSourceProps }: TickingArrayDataSourceConstructorProps);
|
|
19
|
+
constructor({ data, getVisualLinks, rpcServices, rpcMenuServices, session, table, menu, visualLink, visualLinkService, vuuModule, ...arrayDataSourceProps }: TickingArrayDataSourceConstructorProps);
|
|
20
20
|
updateRowWithSessionCheck: (row: Array<bigint | VuuRowDataItemType>, columnName?: string, sessionId?: string) => void;
|
|
21
21
|
subscribe(subscribeProps: DataSourceSubscribeProps, callback: DataSourceSubscribeCallback): Promise<void>;
|
|
22
22
|
unsubscribe(): void;
|
|
@@ -24,8 +24,8 @@ export declare class TickingArrayDataSource extends ArrayDataSource {
|
|
|
24
24
|
get links(): LinkDescriptorWithLabel[] | undefined;
|
|
25
25
|
getSelectedRowIds(): string[];
|
|
26
26
|
isSessionDataSourceOf(dataSource: DataSource): boolean;
|
|
27
|
-
createSessionDataSource(copyOption: CopyOption, sessionType?: SessionType): Promise<DataSourceBase<DataSourceRowWithBigint> | undefined>;
|
|
28
|
-
beginEditSession(editSessionMode?: EditSessionMode): Promise<DataSourceBase<DataSourceRowWithBigint> | undefined>;
|
|
27
|
+
createSessionDataSource(copyOption: CopyOption, sessionType?: SessionType, overrides?: SessionDataSourceOverrides): Promise<DataSourceBase<DataSourceRowWithBigint> | undefined>;
|
|
28
|
+
beginEditSession(editSessionMode?: EditSessionMode, overrides?: SessionDataSourceOverrides): Promise<DataSourceBase<DataSourceRowWithBigint> | undefined>;
|
|
29
29
|
editCell(key: string, column: string, data: VuuRowDataItemType): Promise<RpcResultSuccess | RpcResultError>;
|
|
30
30
|
addRow: (rowData?: Record<string, VuuRowDataItemType>) => Promise<true | string>;
|
|
31
31
|
deleteRow: (key: string, mode?: DeleteRowMode) => Promise<true | string>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { DataSourceBase, DataSourceConfig, DataSourceRowWithBigint, DataSourceSubscribedMessage, DataSourceVisualLinkCreatedMessage, EditSessionMode, CopyOption, SessionType, TableSchema } from "@vuu-ui/vuu-data-types";
|
|
1
|
+
import type { DataSourceBase, DataSourceConfig, DataSourceRowWithBigint, DataSourceSubscribedMessage, DataSourceVisualLinkCreatedMessage, EditSessionMode, CopyOption, SessionDataSourceOverrides, SessionType, TableSchema } from "@vuu-ui/vuu-data-types";
|
|
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
5
|
export interface IVuuModule<T extends string = string> {
|
|
6
|
-
createDataSource: (tableName: T, viewport?: string, config?: DataSourceConfig
|
|
6
|
+
createDataSource: (tableName: T, viewport?: string, config?: DataSourceConfig & {
|
|
7
|
+
session?: SessionDataSourceOverrides;
|
|
8
|
+
}) => DataSourceBase<DataSourceRowWithBigint>;
|
|
7
9
|
}
|
|
8
10
|
export type SessionTableMap = Record<string, Table>;
|
|
9
11
|
export type ServiceHandler = (rpcRequest: VuuRpcServiceRequest) => Promise<RpcResultSuccess | RpcResultError>;
|
|
@@ -46,7 +48,9 @@ export declare abstract class VuuModule<T extends string = string> implements IV
|
|
|
46
48
|
getLinks: (subscriptionMap: Map<string, Subscription[]>, vuuLinks: VuuLink[]) => LinkDescriptorWithLabel[];
|
|
47
49
|
visualLinkService: (message: VuuCreateVisualLink | VuuRemoveVisualLink) => Promise<DataSourceVisualLinkCreatedMessage | void>;
|
|
48
50
|
getVisualLinks: (tableName: string) => LinkDescriptorWithLabel[] | undefined;
|
|
49
|
-
createDataSource: (tableName: T, viewport?: string, config?: DataSourceConfig
|
|
51
|
+
createDataSource: (tableName: T, viewport?: string, config?: DataSourceConfig & {
|
|
52
|
+
session?: SessionDataSourceOverrides;
|
|
53
|
+
}) => DataSourceBase<DataSourceRowWithBigint>;
|
|
50
54
|
getServices(tableName: T): RpcService[];
|
|
51
55
|
getMenuServices(tableName: T): RpcMenuService[];
|
|
52
56
|
protected get sessionTableMap(): SessionTableMap;
|