@vuu-ui/vuu-data-remote 3.3.1 → 3.3.3
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 +7 -7
- package/src/VuuDataSource.js +9 -4
- package/types/VuuDataSource.d.ts +4 -3
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.3.
|
|
2
|
+
"version": "3.3.3",
|
|
3
3
|
"main": "./src/index.js",
|
|
4
4
|
"author": "heswell",
|
|
5
5
|
"license": "Apache-2.0",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"type-defs": "node ../../scripts/build-type-defs.mjs"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@vuu-ui/vuu-data-types": "3.3.
|
|
15
|
-
"@vuu-ui/vuu-table-types": "3.3.
|
|
16
|
-
"@vuu-ui/vuu-filter-types": "3.3.
|
|
17
|
-
"@vuu-ui/vuu-protocol-types": "3.3.
|
|
14
|
+
"@vuu-ui/vuu-data-types": "3.3.3",
|
|
15
|
+
"@vuu-ui/vuu-table-types": "3.3.3",
|
|
16
|
+
"@vuu-ui/vuu-filter-types": "3.3.3",
|
|
17
|
+
"@vuu-ui/vuu-protocol-types": "3.3.3"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@vuu-ui/vuu-filter-parser": "3.3.
|
|
21
|
-
"@vuu-ui/vuu-utils": "3.3.
|
|
20
|
+
"@vuu-ui/vuu-filter-parser": "3.3.3",
|
|
21
|
+
"@vuu-ui/vuu-utils": "3.3.3"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"README.md",
|
package/src/VuuDataSource.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseDataSource, Range, StaleUpdateError, combineFilters, constrainRange, debounce, isConfigChanged, isRpcSuccess, isSelectSuccessWithRowCount, isViewportMenusAction, isVisualLinksAction, itemsOrOrderChanged, logger, throttle, uuid } from "@vuu-ui/vuu-utils";
|
|
1
|
+
import { BaseDataSource, Range, StaleUpdateError, assertExpectedSessionTable, combineFilters, constrainRange, debounce, isConfigChanged, isRpcSuccess, isSelectSuccessWithRowCount, isViewportMenusAction, isVisualLinksAction, itemsOrOrderChanged, logger, sessionDataSourceConfig, throttle, uuid } from "@vuu-ui/vuu-utils";
|
|
2
2
|
import ConnectionManager from "./ConnectionManager.js";
|
|
3
3
|
import { isDataSourceConfigMessage } from "./data-source.js";
|
|
4
4
|
const { info: info, infoEnabled: infoEnabled } = logger("VuuDataSource");
|
|
@@ -25,18 +25,21 @@ class VuuDataSource extends BaseDataSource {
|
|
|
25
25
|
#menu;
|
|
26
26
|
#optimize = "throttle";
|
|
27
27
|
#selectedRowsCount = 0;
|
|
28
|
+
#session;
|
|
28
29
|
#sessionDataSource = void 0;
|
|
29
30
|
#sessionTableMessageColumn = void 0;
|
|
30
31
|
#status = "initialising";
|
|
31
32
|
#tableSchema;
|
|
33
|
+
isRemote = true;
|
|
32
34
|
table;
|
|
33
|
-
constructor({ sessionTableMessageColumn, ...props }){
|
|
35
|
+
constructor({ session, sessionTableMessageColumn, ...props }){
|
|
34
36
|
super(props);
|
|
35
37
|
const { bufferSize = 100, table, visualLink } = props;
|
|
36
38
|
if (!table) throw Error("RemoteDataSource constructor called without table");
|
|
37
39
|
this.bufferSize = bufferSize;
|
|
38
40
|
this.table = table;
|
|
39
41
|
this.#pendingVisualLink = visualLink;
|
|
42
|
+
this.#session = session;
|
|
40
43
|
this.#sessionTableMessageColumn = sessionTableMessageColumn;
|
|
41
44
|
this.rangeRequest = this.rawRangeRequest;
|
|
42
45
|
if (props.autosubscribeColumns) {
|
|
@@ -420,7 +423,7 @@ class VuuDataSource extends BaseDataSource {
|
|
|
420
423
|
async remoteProcedureCall() {
|
|
421
424
|
return Promise.reject();
|
|
422
425
|
}
|
|
423
|
-
async createSessionDataSource(copyOption, sessionType = "edit") {
|
|
426
|
+
async createSessionDataSource(copyOption, sessionType = "edit", overrides) {
|
|
424
427
|
const rpcResponse = await this?.rpcRequest?.({
|
|
425
428
|
type: "RPC_REQUEST",
|
|
426
429
|
rpcName: "createSessionTable",
|
|
@@ -431,8 +434,10 @@ class VuuDataSource extends BaseDataSource {
|
|
|
431
434
|
});
|
|
432
435
|
if (isRpcSuccess(rpcResponse)) {
|
|
433
436
|
const { table: sessionTable } = rpcResponse.data;
|
|
437
|
+
const effectiveOverrides = overrides ?? this.#session;
|
|
438
|
+
assertExpectedSessionTable(sessionTable, effectiveOverrides?.table);
|
|
434
439
|
return new VuuDataSource({
|
|
435
|
-
...this.config,
|
|
440
|
+
...sessionDataSourceConfig(this.config, effectiveOverrides?.columns),
|
|
436
441
|
table: sessionTable,
|
|
437
442
|
viewport: sessionTable.table
|
|
438
443
|
});
|
package/types/VuuDataSource.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CopyOption, DataSourceBase, SessionType, DataSourceCallbackMessage, DataSourceConstructorProps, DataSourceStatus, DataSourceSubscribeCallback, DataSourceSubscribeProps, DeleteRowMode, EditSessionMode, OptimizeStrategy, TableSchema, WithBaseFilter, WithFullConfig } from "@vuu-ui/vuu-data-types";
|
|
1
|
+
import type { CopyOption, DataSourceBase, SessionType, DataSourceCallbackMessage, DataSourceConstructorProps, DataSourceStatus, DataSourceSubscribeCallback, DataSourceSubscribeProps, DeleteRowMode, EditSessionMode, OptimizeStrategy, SessionDataSourceOverrides, TableSchema, WithBaseFilter, WithFullConfig } from "@vuu-ui/vuu-data-types";
|
|
2
2
|
import type { MenuRpcResponse } from "@vuu-ui/vuu-data-types";
|
|
3
3
|
import type { LinkDescriptorWithLabel, RpcResultError, RpcResultSuccess, SelectRequest, VuuGroupBy, VuuMenu, VuuRange, VuuRowDataItemType, VuuRpcMenuRequest, VuuRpcResponse, VuuRpcServiceRequest, VuuTable } from "@vuu-ui/vuu-protocol-types";
|
|
4
4
|
import { BaseDataSource, Range } from "@vuu-ui/vuu-utils";
|
|
@@ -8,8 +8,9 @@ export declare class VuuDataSource extends BaseDataSource implements DataSourceB
|
|
|
8
8
|
private bufferSize;
|
|
9
9
|
private server;
|
|
10
10
|
rangeRequest: RangeRequest;
|
|
11
|
+
readonly isRemote = true;
|
|
11
12
|
table: VuuTable;
|
|
12
|
-
constructor({ sessionTableMessageColumn, ...props }: DataSourceConstructorProps);
|
|
13
|
+
constructor({ session, sessionTableMessageColumn, ...props }: DataSourceConstructorProps);
|
|
13
14
|
subscribe(subscribeProps: DataSourceSubscribeProps, callback: DataSourceSubscribeCallback): Promise<void>;
|
|
14
15
|
handleMessageFromServer: (message: DataSourceCallbackMessage) => void;
|
|
15
16
|
handleSessionMessageFromServer: (msg: DataSourceCallbackMessage) => void;
|
|
@@ -57,7 +58,7 @@ export declare class VuuDataSource extends BaseDataSource implements DataSourceB
|
|
|
57
58
|
get visualLink(): LinkDescriptorWithLabel | undefined;
|
|
58
59
|
set visualLink(visualLink: LinkDescriptorWithLabel | undefined);
|
|
59
60
|
remoteProcedureCall<T extends VuuRpcResponse = VuuRpcResponse>(): Promise<T>;
|
|
60
|
-
createSessionDataSource(copyOption: CopyOption, sessionType?: SessionType): Promise<VuuDataSource | undefined>;
|
|
61
|
+
createSessionDataSource(copyOption: CopyOption, sessionType?: SessionType, overrides?: SessionDataSourceOverrides): Promise<VuuDataSource | undefined>;
|
|
61
62
|
beginEditSession(editSessionMode?: EditSessionMode): Promise<void>;
|
|
62
63
|
editCell(key: string, column: string, data: VuuRowDataItemType): Promise<RpcResultSuccess | RpcResultError | undefined>;
|
|
63
64
|
endEditSession(saveChanges?: boolean, force?: boolean): Promise<void>;
|