@genesislcap/grid-pro 14.358.0 → 14.360.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/dist/custom-elements.json +204 -13
- package/dist/dts/datasource/base.types.d.ts +20 -1
- package/dist/dts/datasource/base.types.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.datasource.d.ts +47 -1
- package/dist/dts/datasource/server-side.datasource.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.resource-reqrep.d.ts +78 -0
- package/dist/dts/datasource/server-side.resource-reqrep.d.ts.map +1 -1
- package/dist/esm/datasource/server-side.datasource.js +143 -3
- package/dist/esm/datasource/server-side.resource-reqrep.js +154 -36
- package/dist/grid-pro.api.json +62 -0
- package/dist/grid-pro.d.ts +46 -0
- package/docs/api/grid-pro.gridproserversidedatasource.md +38 -0
- package/docs/api/grid-pro.gridproserversidedatasource.pollingdatasource.md +14 -0
- package/docs/api/grid-pro.gridproserversidedatasource.serializer.md +14 -0
- package/docs/api-report.md.api.md +7 -0
- package/package.json +13 -13
|
@@ -11098,6 +11098,20 @@
|
|
|
11098
11098
|
"description": "A Genesis Datasource element, for server-side | SSRM-compatible data fetching and used exclusively by the GridPro element.",
|
|
11099
11099
|
"name": "GridProServerSideDatasource",
|
|
11100
11100
|
"members": [
|
|
11101
|
+
{
|
|
11102
|
+
"kind": "field",
|
|
11103
|
+
"name": "serializer",
|
|
11104
|
+
"type": {
|
|
11105
|
+
"text": "JSONSerializer"
|
|
11106
|
+
}
|
|
11107
|
+
},
|
|
11108
|
+
{
|
|
11109
|
+
"kind": "field",
|
|
11110
|
+
"name": "pollingDatasource",
|
|
11111
|
+
"type": {
|
|
11112
|
+
"text": "Datasource"
|
|
11113
|
+
}
|
|
11114
|
+
},
|
|
11101
11115
|
{
|
|
11102
11116
|
"kind": "field",
|
|
11103
11117
|
"name": "zeroBasedViewNumber",
|
|
@@ -13755,6 +13769,87 @@
|
|
|
13755
13769
|
"text": "(existingParams?: any) => Promise<RequestServerResult>"
|
|
13756
13770
|
}
|
|
13757
13771
|
},
|
|
13772
|
+
{
|
|
13773
|
+
"kind": "field",
|
|
13774
|
+
"name": "createReqRepStreamFunc",
|
|
13775
|
+
"type": {
|
|
13776
|
+
"text": "(params?: any) => Promise<{\n stream: SocketObservable<RequestServerResult>;\n datasource: any;\n }> | undefined"
|
|
13777
|
+
},
|
|
13778
|
+
"privacy": "private",
|
|
13779
|
+
"description": "Function to create a polling stream with a separate datasource instance."
|
|
13780
|
+
},
|
|
13781
|
+
{
|
|
13782
|
+
"kind": "field",
|
|
13783
|
+
"name": "reqRepPollingStream",
|
|
13784
|
+
"type": {
|
|
13785
|
+
"text": "SocketObservable<RequestServerResult> | undefined"
|
|
13786
|
+
},
|
|
13787
|
+
"privacy": "private",
|
|
13788
|
+
"description": "The active polling stream observable."
|
|
13789
|
+
},
|
|
13790
|
+
{
|
|
13791
|
+
"kind": "field",
|
|
13792
|
+
"name": "reqRepPollingSubscription",
|
|
13793
|
+
"type": {
|
|
13794
|
+
"text": "SocketSubscription | undefined"
|
|
13795
|
+
},
|
|
13796
|
+
"privacy": "private",
|
|
13797
|
+
"description": "Subscription to the polling stream."
|
|
13798
|
+
},
|
|
13799
|
+
{
|
|
13800
|
+
"kind": "field",
|
|
13801
|
+
"name": "reqRepPollingDatasource",
|
|
13802
|
+
"type": {
|
|
13803
|
+
"text": "any | undefined"
|
|
13804
|
+
},
|
|
13805
|
+
"privacy": "private",
|
|
13806
|
+
"description": "Separate datasource instance used exclusively for polling."
|
|
13807
|
+
},
|
|
13808
|
+
{
|
|
13809
|
+
"kind": "field",
|
|
13810
|
+
"name": "usePolling",
|
|
13811
|
+
"type": {
|
|
13812
|
+
"text": "boolean"
|
|
13813
|
+
},
|
|
13814
|
+
"privacy": "private",
|
|
13815
|
+
"description": "Whether polling is enabled for this datasource."
|
|
13816
|
+
},
|
|
13817
|
+
{
|
|
13818
|
+
"kind": "field",
|
|
13819
|
+
"name": "onPollingUpdate",
|
|
13820
|
+
"type": {
|
|
13821
|
+
"text": "(result: RequestServerResult) => void | undefined"
|
|
13822
|
+
},
|
|
13823
|
+
"privacy": "private",
|
|
13824
|
+
"description": "Callback to apply polling updates at the parent datasource level."
|
|
13825
|
+
},
|
|
13826
|
+
{
|
|
13827
|
+
"kind": "field",
|
|
13828
|
+
"name": "resetPreviousPollResult",
|
|
13829
|
+
"type": {
|
|
13830
|
+
"text": "() => void | undefined"
|
|
13831
|
+
},
|
|
13832
|
+
"privacy": "private",
|
|
13833
|
+
"description": "Callback to reset the previous poll comparison state."
|
|
13834
|
+
},
|
|
13835
|
+
{
|
|
13836
|
+
"kind": "field",
|
|
13837
|
+
"name": "currentStreamParams",
|
|
13838
|
+
"type": {
|
|
13839
|
+
"text": "RequestParams | undefined"
|
|
13840
|
+
},
|
|
13841
|
+
"privacy": "private",
|
|
13842
|
+
"description": "Current request parameters used for the active polling stream."
|
|
13843
|
+
},
|
|
13844
|
+
{
|
|
13845
|
+
"kind": "field",
|
|
13846
|
+
"name": "debouncedCreateStream",
|
|
13847
|
+
"type": {
|
|
13848
|
+
"text": "ReturnType<typeof debounce>"
|
|
13849
|
+
},
|
|
13850
|
+
"privacy": "private",
|
|
13851
|
+
"description": "Debounced function for creating polling streams."
|
|
13852
|
+
},
|
|
13758
13853
|
{
|
|
13759
13854
|
"kind": "field",
|
|
13760
13855
|
"name": "discoveredTotalRowCount",
|
|
@@ -13794,6 +13889,81 @@
|
|
|
13794
13889
|
"module": "src/datasource/server-side.resource-base.ts"
|
|
13795
13890
|
}
|
|
13796
13891
|
},
|
|
13892
|
+
{
|
|
13893
|
+
"kind": "method",
|
|
13894
|
+
"name": "updatePaginationParams",
|
|
13895
|
+
"privacy": "private",
|
|
13896
|
+
"return": {
|
|
13897
|
+
"type": {
|
|
13898
|
+
"text": "void"
|
|
13899
|
+
}
|
|
13900
|
+
},
|
|
13901
|
+
"parameters": [
|
|
13902
|
+
{
|
|
13903
|
+
"name": "params",
|
|
13904
|
+
"type": {
|
|
13905
|
+
"text": "IServerSideGetRowsParams"
|
|
13906
|
+
}
|
|
13907
|
+
},
|
|
13908
|
+
{
|
|
13909
|
+
"name": "effectivePagingMode",
|
|
13910
|
+
"type": {
|
|
13911
|
+
"text": "PagingMode"
|
|
13912
|
+
}
|
|
13913
|
+
}
|
|
13914
|
+
],
|
|
13915
|
+
"description": "Update pagination params based on paging mode"
|
|
13916
|
+
},
|
|
13917
|
+
{
|
|
13918
|
+
"kind": "method",
|
|
13919
|
+
"name": "determineIsLastView",
|
|
13920
|
+
"privacy": "private",
|
|
13921
|
+
"return": {
|
|
13922
|
+
"type": {
|
|
13923
|
+
"text": "Promise<boolean>"
|
|
13924
|
+
}
|
|
13925
|
+
},
|
|
13926
|
+
"parameters": [
|
|
13927
|
+
{
|
|
13928
|
+
"name": "requestResult",
|
|
13929
|
+
"type": {
|
|
13930
|
+
"text": "RequestServerResult"
|
|
13931
|
+
}
|
|
13932
|
+
},
|
|
13933
|
+
{
|
|
13934
|
+
"name": "requestParams",
|
|
13935
|
+
"type": {
|
|
13936
|
+
"text": "RequestParams"
|
|
13937
|
+
}
|
|
13938
|
+
},
|
|
13939
|
+
{
|
|
13940
|
+
"name": "effectivePagingMode",
|
|
13941
|
+
"type": {
|
|
13942
|
+
"text": "PagingMode"
|
|
13943
|
+
}
|
|
13944
|
+
}
|
|
13945
|
+
],
|
|
13946
|
+
"description": "Determine if this is the last view/page"
|
|
13947
|
+
},
|
|
13948
|
+
{
|
|
13949
|
+
"kind": "method",
|
|
13950
|
+
"name": "schedulePollingStream",
|
|
13951
|
+
"privacy": "private",
|
|
13952
|
+
"return": {
|
|
13953
|
+
"type": {
|
|
13954
|
+
"text": "void"
|
|
13955
|
+
}
|
|
13956
|
+
},
|
|
13957
|
+
"parameters": [
|
|
13958
|
+
{
|
|
13959
|
+
"name": "requestParams",
|
|
13960
|
+
"type": {
|
|
13961
|
+
"text": "RequestParams"
|
|
13962
|
+
}
|
|
13963
|
+
}
|
|
13964
|
+
],
|
|
13965
|
+
"description": "Schedules polling stream creation if enabled."
|
|
13966
|
+
},
|
|
13797
13967
|
{
|
|
13798
13968
|
"kind": "method",
|
|
13799
13969
|
"name": "applyServerSideData",
|
|
@@ -13903,6 +14073,40 @@
|
|
|
13903
14073
|
"module": "src/datasource/server-side.resource-base.ts"
|
|
13904
14074
|
}
|
|
13905
14075
|
},
|
|
14076
|
+
{
|
|
14077
|
+
"kind": "method",
|
|
14078
|
+
"name": "destroy",
|
|
14079
|
+
"return": {
|
|
14080
|
+
"type": {
|
|
14081
|
+
"text": "void"
|
|
14082
|
+
}
|
|
14083
|
+
},
|
|
14084
|
+
"inheritedFrom": {
|
|
14085
|
+
"name": "BaseServerSideDatasource",
|
|
14086
|
+
"module": "src/datasource/server-side.resource-base.ts"
|
|
14087
|
+
}
|
|
14088
|
+
},
|
|
14089
|
+
{
|
|
14090
|
+
"kind": "method",
|
|
14091
|
+
"name": "createPollingStream",
|
|
14092
|
+
"privacy": "private",
|
|
14093
|
+
"parameters": [
|
|
14094
|
+
{
|
|
14095
|
+
"name": "requestParams",
|
|
14096
|
+
"type": {
|
|
14097
|
+
"text": "RequestParams"
|
|
14098
|
+
},
|
|
14099
|
+
"description": "The request parameters for the current view"
|
|
14100
|
+
}
|
|
14101
|
+
],
|
|
14102
|
+
"description": "Creates a polling stream for the currently loaded data."
|
|
14103
|
+
},
|
|
14104
|
+
{
|
|
14105
|
+
"kind": "method",
|
|
14106
|
+
"name": "destroyPollingStream",
|
|
14107
|
+
"privacy": "private",
|
|
14108
|
+
"description": "Destroys the current polling stream and associated datasource."
|
|
14109
|
+
},
|
|
13906
14110
|
{
|
|
13907
14111
|
"kind": "method",
|
|
13908
14112
|
"name": "buildRequestDetails",
|
|
@@ -14275,19 +14479,6 @@
|
|
|
14275
14479
|
"module": "src/datasource/server-side.resource-base.ts"
|
|
14276
14480
|
}
|
|
14277
14481
|
},
|
|
14278
|
-
{
|
|
14279
|
-
"kind": "method",
|
|
14280
|
-
"name": "destroy",
|
|
14281
|
-
"return": {
|
|
14282
|
-
"type": {
|
|
14283
|
-
"text": "void"
|
|
14284
|
-
}
|
|
14285
|
-
},
|
|
14286
|
-
"inheritedFrom": {
|
|
14287
|
-
"name": "BaseServerSideDatasource",
|
|
14288
|
-
"module": "src/datasource/server-side.resource-base.ts"
|
|
14289
|
-
}
|
|
14290
|
-
},
|
|
14291
14482
|
{
|
|
14292
14483
|
"kind": "method",
|
|
14293
14484
|
"name": "updateResourceParams",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SocketObservable, FilteredDataServerResult, MetadataDetail, RequestServerResult, DataserverParams, RequestParams } from '@genesislcap/foundation-comms';
|
|
1
|
+
import { SocketObservable, FilteredDataServerResult, MetadataDetail, RequestServerResult, DataserverParams, RequestParams, Datasource } from '@genesislcap/foundation-comms';
|
|
2
2
|
import { PagingMode } from './datasource.types';
|
|
3
3
|
/**
|
|
4
4
|
* Type definition for configuration options used for streams.
|
|
@@ -9,6 +9,24 @@ import { PagingMode } from './datasource.types';
|
|
|
9
9
|
export type ServerSideDatasourceOptions = {
|
|
10
10
|
createDataserverStreamFunc?: (existingParams?: any) => Promise<SocketObservable<FilteredDataServerResult>>;
|
|
11
11
|
createReqRepRequestFunc?: (existingParams?: any) => Promise<RequestServerResult>;
|
|
12
|
+
/**
|
|
13
|
+
* Function to create a polling stream for REQUEST_SERVER resources.
|
|
14
|
+
* @remarks Returns both the stream and the datasource instance for proper lifecycle management.
|
|
15
|
+
*/
|
|
16
|
+
createReqRepStreamFunc?: (params?: any) => Promise<{
|
|
17
|
+
stream: SocketObservable<RequestServerResult>;
|
|
18
|
+
datasource: Datasource;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Callback function invoked when a polling update is received.
|
|
22
|
+
* @remarks Used by REQUEST_SERVER resources to apply updates via applyServerSideTransaction.
|
|
23
|
+
*/
|
|
24
|
+
onPollingUpdateFunc?: (result: RequestServerResult) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Callback function to reset the previous poll result comparison state.
|
|
27
|
+
* @remarks Called when the polling stream is destroyed or recreated with new parameters.
|
|
28
|
+
*/
|
|
29
|
+
resetPreviousPollResultFunc?: () => void;
|
|
12
30
|
reloadResourceDataFunc?: (params: any) => Promise<void>;
|
|
13
31
|
errorHandlerFunc?: (message: string, type: string) => void;
|
|
14
32
|
resourceName: string;
|
|
@@ -22,6 +40,7 @@ export type ServerSideDatasourceOptions = {
|
|
|
22
40
|
zeroBasedViewNumber?: boolean;
|
|
23
41
|
pagingMode?: PagingMode | undefined;
|
|
24
42
|
criteriaOnlyRequest?: boolean;
|
|
43
|
+
usePolling?: boolean;
|
|
25
44
|
};
|
|
26
45
|
/**
|
|
27
46
|
* Base datasource error event names.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.types.d.ts","sourceRoot":"","sources":["../../../src/datasource/base.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,
|
|
1
|
+
{"version":3,"file":"base.types.d.ts","sourceRoot":"","sources":["../../../src/datasource/base.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,0BAA0B,CAAC,EAAE,CAC3B,cAAc,CAAC,EAAE,GAAG,KACjB,OAAO,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC,CAAC;IACzD,uBAAuB,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACjF;;;OAGG;IACH,sBAAsB,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC;QACjD,MAAM,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;QAC9C,UAAU,EAAE,UAAU,CAAC;KACxB,CAAC,CAAC;IACH;;;OAGG;IACH,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D;;;OAGG;IACH,2BAA2B,CAAC,EAAE,MAAM,IAAI,CAAC;IACzC,sBAAsB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,gBAAgB,GAAG,aAAa,CAAC;IAClD,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACxC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IAEnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EACA,YAAY,GACZ,qBAAqB,GACrB,eAAe,GACf,UAAU,GACV,QAAQ,GACR,UAAU,GACV,SAAS,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC,8BAA8B,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DatasourceOptions } from '@genesislcap/foundation-comms';
|
|
1
|
+
import { Datasource, DatasourceOptions } from '@genesislcap/foundation-comms';
|
|
2
|
+
import { JSONSerializer } from '@genesislcap/foundation-utils';
|
|
2
3
|
import { GridProBaseDatasource } from './base.datasource';
|
|
3
4
|
import { PagingMode } from './datasource.types';
|
|
4
5
|
declare const GridProServerSideDatasource_base: (new (...args: any[]) => {
|
|
@@ -378,6 +379,8 @@ declare const GridProServerSideDatasource_base: (new (...args: any[]) => {
|
|
|
378
379
|
* @beta
|
|
379
380
|
*/
|
|
380
381
|
export declare class GridProServerSideDatasource extends GridProServerSideDatasource_base {
|
|
382
|
+
serializer: JSONSerializer;
|
|
383
|
+
pollingDatasource: Datasource;
|
|
381
384
|
/**
|
|
382
385
|
* The starting VIEW_NUMBER of the data to be fetched.
|
|
383
386
|
* @remarks The VIEW_NUMBER isincremented by the grid as the user scrolls or changes pages.
|
|
@@ -429,6 +432,49 @@ export declare class GridProServerSideDatasource extends GridProServerSideDataso
|
|
|
429
432
|
private clearRowData;
|
|
430
433
|
private getResourceIndexes;
|
|
431
434
|
private createReqRepRequest;
|
|
435
|
+
/**
|
|
436
|
+
* Creates a polling stream for REQUEST_SERVER resources.
|
|
437
|
+
* @remarks
|
|
438
|
+
* Creates a separate `Datasource` instance configured to poll all currently loaded rows
|
|
439
|
+
* (from offset 0 to current offset + maxRows). This enables change detection across all
|
|
440
|
+
* loaded data, not just the current page.
|
|
441
|
+
*
|
|
442
|
+
* The separate datasource instance has built-in polling logic (pollingInterval, pollTriggerEvents)
|
|
443
|
+
* and manages its own lifecycle independently of the snapshot datasource.
|
|
444
|
+
* @param existingParams - The current request parameters (includes OFFSET, MAX_ROWS, etc.)
|
|
445
|
+
* @returns Object containing the polling stream and the datasource instance
|
|
446
|
+
* @internal
|
|
447
|
+
*/
|
|
448
|
+
private createReqRepStream;
|
|
449
|
+
/**
|
|
450
|
+
* Stores the previous poll result for comparison (poll N vs poll N-1).
|
|
451
|
+
* @remarks
|
|
452
|
+
* This enables efficient change detection by comparing consecutive polls instead of
|
|
453
|
+
* maintaining the entire dataset in memory. Only stores the last poll result.
|
|
454
|
+
* @internal
|
|
455
|
+
*/
|
|
456
|
+
private previousPollResult;
|
|
457
|
+
/**
|
|
458
|
+
* Resets the previous poll result comparison state.
|
|
459
|
+
* @remarks
|
|
460
|
+
* Called when the polling stream is destroyed or recreated with new parameters
|
|
461
|
+
* (e.g., user scrolls to a different page, or filters/sorting changes).
|
|
462
|
+
* @internal
|
|
463
|
+
*/
|
|
464
|
+
resetPreviousPollResult(): void;
|
|
465
|
+
/**
|
|
466
|
+
* Applies polling updates for REQUEST_SERVER resources in SSRM.
|
|
467
|
+
* @remarks
|
|
468
|
+
* Compares the current poll result (poll N) with the previous poll result (poll N-1)
|
|
469
|
+
* to detect inserts, updates, and deletes. Changes are applied to the grid using
|
|
470
|
+
* `applyServerSideTransaction` to avoid interfering with SSRM's cache management.
|
|
471
|
+
*
|
|
472
|
+
* The first poll is stored without applying changes (nothing to compare yet).
|
|
473
|
+
* Subsequent polls are compared to detect changes efficiently.
|
|
474
|
+
* @param result - The polling result from the REQUEST_SERVER resource
|
|
475
|
+
* @internal
|
|
476
|
+
*/
|
|
477
|
+
private applyReqRepPollingUpdate;
|
|
432
478
|
private createDataserverStream;
|
|
433
479
|
private getAgColumnDefs;
|
|
434
480
|
applyTransaction(transaction: any): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-side.datasource.d.ts","sourceRoot":"","sources":["../../../src/datasource/server-side.datasource.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EAYlB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"server-side.datasource.d.ts","sourceRoot":"","sources":["../../../src/datasource/server-side.datasource.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,UAAU,EACV,iBAAiB,EAYlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,cAAc,EAGf,MAAM,+BAA+B,CAAC;AAUvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;;;;;;;kBAsD7B,CAAC;;;;;;;;8BAkCV,CAAC,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA+BO,CAAC;4IAQpB,CAAC;wFAGiB,CAAC;+IAQK,CAAC;2FAEL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA+B3B,CAAJ;;;;;;;;;;;;;;;;;;;;;;;mBAwEc,CAAC;;;;;;;;;;;;;6BAmBX,CAAJ;8BAAuE,CAAC;kBAE1D,CAAC;;oBAET,CAAV;;sBAI+B,CAAC;oBACC,CAAC;;;;;;;;gDAYJ,CAAC;;;;;;;;;;;;;;;;;;uBAcb,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EA8GhB,CAAC;yBAA8E,CAAC;UACvC,GAAG;WACnB,GAAG;;gBAIwB,GAAG;;;;;;;WAM0C,GACnG;YAAiD,GAAG;;;;;;;;;;;oBA6BhC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4Lm5B,CAAC;cAA6F,CAAC;eAA8F,CAAC;gBAA+F,CAAC;;;;;;;;;;;;;;SAAulC,CAAC;;;iBAA+E,CAAC;;AAxkBj3E;;;;;;;;;GASG;AACH,qBAGa,2BAA4B,SAAQ,gCAAqC;IACpE,UAAU,EAAG,cAAc,CAAC;IAChC,iBAAiB,EAAG,UAAU,CAAC;IAC3C;;;OAGG;IAC6D,mBAAmB,UAAS;IAE5F;;;OAGG;IACmD,WAAW,UAAS;IAE1E;;;;;;OAMG;IACiC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IAE3D,OAAO,EAAE,GAAG,CAAM;IAE9B,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,cAAc,CAA8D;IACpF,OAAO,CAAC,iBAAiB,CAAqB;IAC9C,OAAO,CAAC,uBAAuB,CAA6B;IAE5D,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAOtD,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAaxD,iBAAiB;IAUjB,oBAAoB;IAUX,SAAS,IAAI,IAAI;IAO1B;;;;OAIG;IACG,kBAAkB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsCnE;;;OAGG;IACH,OAAO,CAAC,mCAAmC;IAc3C;;;OAGG;IACH,OAAO,CAAC,oCAAoC;IAWtC,IAAI;IAgIV,mBAAmB,CAAC,KAAK,EAAE,GAAG;IAMf,OAAO;IAmBP,OAAO;IAKtB,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,kBAAkB;YAUZ,mBAAmB;IAKjC;;;;;;;;;;;;OAYG;YACW,kBAAkB;IA+BhC;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB,CAA+B;IAEzD;;;;;;OAMG;IACI,uBAAuB;IAK9B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,wBAAwB;YAqElB,sBAAsB;YAoDtB,eAAe;IAmBpB,gBAAgB,CAAC,WAAW,EAAE,GAAG,GAAG,GAAG;IAIvC,QAAQ;CAGlB"}
|
|
@@ -8,10 +8,65 @@ import { BaseServerSideDatasource } from './server-side.resource-base';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class ReqRepServerSideDatasource extends BaseServerSideDatasource implements IServerSideDatasource {
|
|
10
10
|
createReqRepRequestFunc: (existingParams?: any) => Promise<RequestServerResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Function to create a polling stream with a separate datasource instance.
|
|
13
|
+
* @remarks Optional - only set when polling is enabled (!isSnapshot && !disablePolling).
|
|
14
|
+
*/
|
|
15
|
+
private createReqRepStreamFunc?;
|
|
16
|
+
/**
|
|
17
|
+
* The active polling stream observable.
|
|
18
|
+
*/
|
|
19
|
+
private reqRepPollingStream?;
|
|
20
|
+
/**
|
|
21
|
+
* Subscription to the polling stream.
|
|
22
|
+
*/
|
|
23
|
+
private reqRepPollingSubscription?;
|
|
24
|
+
/**
|
|
25
|
+
* Separate datasource instance used exclusively for polling.
|
|
26
|
+
* @remarks Maintains its own lifecycle independent of the snapshot datasource.
|
|
27
|
+
*/
|
|
28
|
+
private reqRepPollingDatasource?;
|
|
29
|
+
/**
|
|
30
|
+
* Whether polling is enabled for this datasource.
|
|
31
|
+
*/
|
|
32
|
+
private usePolling;
|
|
33
|
+
/**
|
|
34
|
+
* Callback to apply polling updates at the parent datasource level.
|
|
35
|
+
*/
|
|
36
|
+
private onPollingUpdate?;
|
|
37
|
+
/**
|
|
38
|
+
* Callback to reset the previous poll comparison state.
|
|
39
|
+
*/
|
|
40
|
+
private resetPreviousPollResult?;
|
|
41
|
+
/**
|
|
42
|
+
* Current request parameters used for the active polling stream.
|
|
43
|
+
* @remarks Used to detect if parameters changed (user scrolled away).
|
|
44
|
+
*/
|
|
45
|
+
private currentStreamParams?;
|
|
46
|
+
/**
|
|
47
|
+
* Debounced function for creating polling streams.
|
|
48
|
+
* @remarks Prevents excessive stream recreation during rapid scrolling.
|
|
49
|
+
*/
|
|
50
|
+
private debouncedCreateStream;
|
|
11
51
|
private discoveredTotalRowCount;
|
|
12
52
|
private currentNextOffset;
|
|
13
53
|
constructor(options: ServerSideDatasourceOptions);
|
|
14
54
|
getRows(params: IServerSideGetRowsParams): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Update pagination params based on paging mode
|
|
57
|
+
*/
|
|
58
|
+
private updatePaginationParams;
|
|
59
|
+
/**
|
|
60
|
+
* Determine if this is the last view/page
|
|
61
|
+
*/
|
|
62
|
+
private determineIsLastView;
|
|
63
|
+
/**
|
|
64
|
+
* Schedules polling stream creation if enabled.
|
|
65
|
+
* @remarks
|
|
66
|
+
* Destroys any existing stream and schedules a new one after the user stops scrolling (debounced).
|
|
67
|
+
* This prevents excessive stream recreation during rapid scrolling.
|
|
68
|
+
*/
|
|
69
|
+
private schedulePollingStream;
|
|
15
70
|
private applyServerSideData;
|
|
16
71
|
protected getCorrectRowCount(params: IServerSideGetRowsParams): number;
|
|
17
72
|
private handleCurrentStreamLoad;
|
|
@@ -21,6 +76,29 @@ export declare class ReqRepServerSideDatasource extends BaseServerSideDatasource
|
|
|
21
76
|
*/
|
|
22
77
|
protected setupSorting(params: IServerSideGetRowsParams): Promise<void>;
|
|
23
78
|
refreshDatasource(params: DatasourceOptions): Promise<void>;
|
|
79
|
+
destroy(): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Creates a polling stream for the currently loaded data.
|
|
82
|
+
* @remarks
|
|
83
|
+
* This method creates a separate datasource instance that polls all currently loaded rows
|
|
84
|
+
* (from offset 0 to current offset + maxRows). The polling results are sent to the parent
|
|
85
|
+
* datasource via the `onPollingUpdate` callback for change detection and grid updates.
|
|
86
|
+
*
|
|
87
|
+
* The stream will only apply updates if the request params haven't changed (user hasn't
|
|
88
|
+
* scrolled away or changed filters/sorting).
|
|
89
|
+
* @param requestParams - The request parameters for the current view
|
|
90
|
+
*/
|
|
91
|
+
private createPollingStream;
|
|
92
|
+
/**
|
|
93
|
+
* Destroys the current polling stream and associated datasource.
|
|
94
|
+
* @remarks
|
|
95
|
+
* Cleans up the polling subscription, destroys the separate polling datasource instance,
|
|
96
|
+
* and resets the previous poll comparison state. Called when:
|
|
97
|
+
* - User scrolls to a new page
|
|
98
|
+
* - Filters or sorting changes
|
|
99
|
+
* - The datasource is being destroyed
|
|
100
|
+
*/
|
|
101
|
+
private destroyPollingStream;
|
|
24
102
|
private buildRequestDetails;
|
|
25
103
|
}
|
|
26
104
|
//# sourceMappingURL=server-side.resource-reqrep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-side.resource-reqrep.d.ts","sourceRoot":"","sources":["../../../src/datasource/server-side.resource-reqrep.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,mBAAmB,EAInB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"server-side.resource-reqrep.d.ts","sourceRoot":"","sources":["../../../src/datasource/server-side.resource-reqrep.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,mBAAmB,EAInB,iBAAiB,EAGlB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAOvE;;;GAGG;AACH,qBAAa,0BACX,SAAQ,wBACR,YAAW,qBAAqB;IAEhC,uBAAuB,EAAE,CAAC,cAAc,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEhF;;;OAGG;IACH,OAAO,CAAC,sBAAsB,CAAC,CAG5B;IAEH;;OAEG;IACH,OAAO,CAAC,mBAAmB,CAAC,CAAwC;IAEpE;;OAEG;IACH,OAAO,CAAC,yBAAyB,CAAC,CAAqB;IAEvD;;;OAGG;IACH,OAAO,CAAC,uBAAuB,CAAC,CAAM;IAEtC;;OAEG;IACH,OAAO,CAAC,UAAU,CAAU;IAE5B;;OAEG;IACH,OAAO,CAAC,eAAe,CAAC,CAAwC;IAEhE;;OAEG;IACH,OAAO,CAAC,uBAAuB,CAAC,CAAa;IAE7C;;;OAGG;IACH,OAAO,CAAC,mBAAmB,CAAC,CAAgB;IAE5C;;;OAGG;IACH,OAAO,CAAC,qBAAqB,CAA8B;IAG3D,OAAO,CAAC,uBAAuB,CAAuB;IACtD,OAAO,CAAC,iBAAiB,CAAa;gBAE1B,OAAO,EAAE,2BAA2B;IA6B1C,OAAO,CAAC,MAAM,EAAE,wBAAwB;IAmC9C;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA2B9B;;OAEG;YACW,mBAAmB;IAsCjC;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,mBAAmB;IAsF3B,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,wBAAwB,GAAG,MAAM;IA0BtE,OAAO,CAAC,uBAAuB;IAoB/B;;;OAGG;cACa,YAAY,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BvE,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB3D,OAAO;IAUb;;;;;;;;;;OAUG;YACW,mBAAmB;IAkCjC;;;;;;;;OAQG;IACH,OAAO,CAAC,oBAAoB;IAqB5B,OAAO,CAAC,mBAAmB;CAoB5B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter, __decorate } from "tslib";
|
|
2
|
-
import { dataServerResultFilter, MessageType, normaliseCriteria, ResourceType, toFieldMetadata, } from '@genesislcap/foundation-comms';
|
|
3
|
-
import { LifecycleMixin, insertDocumentCSSRule } from '@genesislcap/foundation-utils';
|
|
2
|
+
import { dataServerResultFilter, Datasource, MessageType, normaliseCriteria, ResourceType, toFieldMetadata, } from '@genesislcap/foundation-comms';
|
|
3
|
+
import { JSONSerializer, LifecycleMixin, insertDocumentCSSRule, } from '@genesislcap/foundation-utils';
|
|
4
4
|
import { attr, customElement, DOM, observable } from '@microsoft/fast-element';
|
|
5
5
|
import { gridProGenesisDatasourceEventNames } from '../grid-pro-genesis-datasource';
|
|
6
6
|
import { datasourceEventNames, } from '../grid-pro-genesis-datasource/datasource-events.types';
|
|
@@ -80,6 +80,14 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
80
80
|
this.liveUpdates = false;
|
|
81
81
|
this.request = {};
|
|
82
82
|
this.sortIndicatorCSSDestroy = null;
|
|
83
|
+
/**
|
|
84
|
+
* Stores the previous poll result for comparison (poll N vs poll N-1).
|
|
85
|
+
* @remarks
|
|
86
|
+
* This enables efficient change detection by comparing consecutive polls instead of
|
|
87
|
+
* maintaining the entire dataset in memory. Only stores the last poll result.
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
this.previousPollResult = new Map();
|
|
83
91
|
}
|
|
84
92
|
resourceNameChanged(oldValue, newValue) {
|
|
85
93
|
if (!oldValue || oldValue === newValue)
|
|
@@ -232,8 +240,16 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
232
240
|
metadata: fieldMetadata,
|
|
233
241
|
});
|
|
234
242
|
if (this.isRequestServer) {
|
|
243
|
+
// Enable polling if not in snapshot mode and polling is not disabled
|
|
244
|
+
const usePolling = !this.isSnapshot && !this.disablePolling;
|
|
235
245
|
this.ssrmDatasource = new ReqRepServerSideDatasource({
|
|
236
246
|
createReqRepRequestFunc: this.createReqRepRequest.bind(this),
|
|
247
|
+
createReqRepStreamFunc: usePolling ? this.createReqRepStream.bind(this) : undefined,
|
|
248
|
+
onPollingUpdateFunc: usePolling ? this.applyReqRepPollingUpdate.bind(this) : undefined,
|
|
249
|
+
resetPreviousPollResultFunc: usePolling
|
|
250
|
+
? this.resetPreviousPollResult.bind(this)
|
|
251
|
+
: undefined,
|
|
252
|
+
usePolling: usePolling,
|
|
237
253
|
reloadResourceDataFunc: this.reloadResourceData.bind(this),
|
|
238
254
|
errorHandlerFunc: this.handleErrors.bind(this),
|
|
239
255
|
resourceName: this.resourceName,
|
|
@@ -287,13 +303,14 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
287
303
|
}
|
|
288
304
|
destroy() {
|
|
289
305
|
return __awaiter(this, void 0, void 0, function* () {
|
|
290
|
-
var _a;
|
|
306
|
+
var _a, _b;
|
|
291
307
|
this.datasource.destroy();
|
|
292
308
|
(_a = this.liveUpdatesStream) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
293
309
|
this.liveUpdatesStream = undefined;
|
|
294
310
|
this.clearRowData();
|
|
295
311
|
if (this.ssrmDatasource) {
|
|
296
312
|
yield this.ssrmDatasource.destroy();
|
|
313
|
+
(_b = this.pollingDatasource) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
297
314
|
this.ssrmDatasource = undefined;
|
|
298
315
|
}
|
|
299
316
|
// Remove custom sort indicator styling
|
|
@@ -337,6 +354,123 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
337
354
|
return reqRep;
|
|
338
355
|
});
|
|
339
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Creates a polling stream for REQUEST_SERVER resources.
|
|
359
|
+
* @remarks
|
|
360
|
+
* Creates a separate `Datasource` instance configured to poll all currently loaded rows
|
|
361
|
+
* (from offset 0 to current offset + maxRows). This enables change detection across all
|
|
362
|
+
* loaded data, not just the current page.
|
|
363
|
+
*
|
|
364
|
+
* The separate datasource instance has built-in polling logic (pollingInterval, pollTriggerEvents)
|
|
365
|
+
* and manages its own lifecycle independently of the snapshot datasource.
|
|
366
|
+
* @param existingParams - The current request parameters (includes OFFSET, MAX_ROWS, etc.)
|
|
367
|
+
* @returns Object containing the polling stream and the datasource instance
|
|
368
|
+
* @internal
|
|
369
|
+
*/
|
|
370
|
+
createReqRepStream() {
|
|
371
|
+
return __awaiter(this, arguments, void 0, function* (existingParams = null) {
|
|
372
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
373
|
+
const currentOffset = (_b = (_a = existingParams === null || existingParams === void 0 ? void 0 : existingParams.DETAILS) === null || _a === void 0 ? void 0 : _a.OFFSET) !== null && _b !== void 0 ? _b : 0;
|
|
374
|
+
const baseMaxRows = (_d = (_c = existingParams === null || existingParams === void 0 ? void 0 : existingParams.DETAILS) === null || _c === void 0 ? void 0 : _c.MAX_ROWS) !== null && _d !== void 0 ? _d : this.maxRows;
|
|
375
|
+
const totalRowsToFetch = baseMaxRows + currentOffset;
|
|
376
|
+
const datasourceOptions = Object.assign(Object.assign({}, this.datasourceOptions()), { criteria: (_f = (_e = existingParams === null || existingParams === void 0 ? void 0 : existingParams.DETAILS) === null || _e === void 0 ? void 0 : _e.CRITERIA_MATCH) !== null && _f !== void 0 ? _f : this.criteria, maxRows: totalRowsToFetch, orderBy: (_h = (_g = existingParams === null || existingParams === void 0 ? void 0 : existingParams.DETAILS) === null || _g === void 0 ? void 0 : _g.ORDER_BY) !== null && _h !== void 0 ? _h : this.orderBy });
|
|
377
|
+
logger.debug('Creating polling datasource for all loaded rows:', {
|
|
378
|
+
currentOffset,
|
|
379
|
+
baseMaxRows,
|
|
380
|
+
totalRowsToFetch,
|
|
381
|
+
});
|
|
382
|
+
// Initialize the polling datasource
|
|
383
|
+
const initOK = yield this.pollingDatasource.init(datasourceOptions, true, true);
|
|
384
|
+
if (!initOK) {
|
|
385
|
+
logger.error('Polling datasource init failed');
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
return { stream: this.pollingDatasource.stream, datasource: this.pollingDatasource };
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Resets the previous poll result comparison state.
|
|
393
|
+
* @remarks
|
|
394
|
+
* Called when the polling stream is destroyed or recreated with new parameters
|
|
395
|
+
* (e.g., user scrolls to a different page, or filters/sorting changes).
|
|
396
|
+
* @internal
|
|
397
|
+
*/
|
|
398
|
+
resetPreviousPollResult() {
|
|
399
|
+
this.previousPollResult.clear();
|
|
400
|
+
logger.debug('Previous poll result cleared');
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Applies polling updates for REQUEST_SERVER resources in SSRM.
|
|
404
|
+
* @remarks
|
|
405
|
+
* Compares the current poll result (poll N) with the previous poll result (poll N-1)
|
|
406
|
+
* to detect inserts, updates, and deletes. Changes are applied to the grid using
|
|
407
|
+
* `applyServerSideTransaction` to avoid interfering with SSRM's cache management.
|
|
408
|
+
*
|
|
409
|
+
* The first poll is stored without applying changes (nothing to compare yet).
|
|
410
|
+
* Subsequent polls are compared to detect changes efficiently.
|
|
411
|
+
* @param result - The polling result from the REQUEST_SERVER resource
|
|
412
|
+
* @internal
|
|
413
|
+
*/
|
|
414
|
+
applyReqRepPollingUpdate(result) {
|
|
415
|
+
var _a;
|
|
416
|
+
if (!this.ssrmDatasource || !result.REPLY) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
const polledData = result.REPLY;
|
|
420
|
+
if (!Array.isArray(polledData) || !((_a = result.MESSAGE_TYPE) === null || _a === void 0 ? void 0 : _a.startsWith('REP_'))) {
|
|
421
|
+
logger.error('received invalid RequestServerResult for polling update', result);
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
if (this.previousPollResult.size === 0) {
|
|
425
|
+
polledData.forEach((row) => {
|
|
426
|
+
this.previousPollResult.set(row[this.rowId], row);
|
|
427
|
+
});
|
|
428
|
+
logger.debug('First poll result stored for future comparison', {
|
|
429
|
+
rowCount: this.previousPollResult.size,
|
|
430
|
+
});
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const currentPollMap = new Map();
|
|
434
|
+
polledData.forEach((row) => {
|
|
435
|
+
currentPollMap.set(row[this.rowId], row);
|
|
436
|
+
});
|
|
437
|
+
const rowsToUpdate = [];
|
|
438
|
+
const rowsToInsert = [];
|
|
439
|
+
const rowsToDelete = [];
|
|
440
|
+
polledData.forEach((row) => {
|
|
441
|
+
const rowId = row[this.rowId];
|
|
442
|
+
if (this.previousPollResult.has(rowId)) {
|
|
443
|
+
const previousRow = this.previousPollResult.get(rowId);
|
|
444
|
+
if (this.serializer.serialize(previousRow) !== this.serializer.serialize(row)) {
|
|
445
|
+
rowsToUpdate.push(row);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
rowsToInsert.push(row);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
this.previousPollResult.forEach((previousRow, rowId) => {
|
|
453
|
+
if (!currentPollMap.has(rowId)) {
|
|
454
|
+
rowsToDelete.push(previousRow);
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
if (rowsToUpdate.length > 0 || rowsToDelete.length > 0 || rowsToInsert.length > 0) {
|
|
458
|
+
this.previousPollResult = currentPollMap;
|
|
459
|
+
logger.debug('Applying reqRep polling update via applyServerSideTransaction:', {
|
|
460
|
+
added: rowsToInsert.length,
|
|
461
|
+
updated: rowsToUpdate.length,
|
|
462
|
+
removed: rowsToDelete.length,
|
|
463
|
+
totalInPoll: currentPollMap.size,
|
|
464
|
+
});
|
|
465
|
+
this.$emit(datasourceEventNames.applyServerSideTransaction, {
|
|
466
|
+
transaction: {
|
|
467
|
+
add: rowsToInsert,
|
|
468
|
+
update: rowsToUpdate,
|
|
469
|
+
remove: rowsToDelete,
|
|
470
|
+
},
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
340
474
|
createDataserverStream() {
|
|
341
475
|
return __awaiter(this, arguments, void 0, function* (existingParams = null) {
|
|
342
476
|
if (this.liveUpdates) {
|
|
@@ -399,6 +533,12 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
399
533
|
throw new Error('loadMore() method is not supported for server-side datasource');
|
|
400
534
|
}
|
|
401
535
|
};
|
|
536
|
+
__decorate([
|
|
537
|
+
JSONSerializer
|
|
538
|
+
], GridProServerSideDatasource.prototype, "serializer", void 0);
|
|
539
|
+
__decorate([
|
|
540
|
+
Datasource
|
|
541
|
+
], GridProServerSideDatasource.prototype, "pollingDatasource", void 0);
|
|
402
542
|
__decorate([
|
|
403
543
|
attr({ mode: 'boolean', attribute: 'zero-based-view-number' })
|
|
404
544
|
], GridProServerSideDatasource.prototype, "zeroBasedViewNumber", void 0);
|
|
@@ -1,36 +1,46 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { MessageType, } from '@genesislcap/foundation-comms';
|
|
3
|
+
import debounce from 'lodash.debounce';
|
|
3
4
|
import { logger } from '../utils';
|
|
4
5
|
import { BaseServerSideDatasource } from './server-side.resource-base';
|
|
6
|
+
/**
|
|
7
|
+
* Debounce time for stream creation after user stops scrolling (in ms)
|
|
8
|
+
*/
|
|
9
|
+
const POLLING_STREAM_DEBOUNCE_MS = 300;
|
|
5
10
|
/**
|
|
6
11
|
* The REQUEST_SERVER IServerSideDatasource implementation, used for SSRM (Server-Side Row Model) in the grid.
|
|
7
12
|
* @beta
|
|
8
13
|
*/
|
|
9
14
|
export class ReqRepServerSideDatasource extends BaseServerSideDatasource {
|
|
10
15
|
constructor(options) {
|
|
11
|
-
var _a, _b, _c, _d;
|
|
16
|
+
var _a, _b, _c, _d, _e;
|
|
12
17
|
super(options);
|
|
13
18
|
// Track the total discovered row count when we reach the last page
|
|
14
19
|
this.discoveredTotalRowCount = null;
|
|
15
20
|
this.currentNextOffset = 0;
|
|
16
21
|
this.createReqRepRequestFunc = options.createReqRepRequestFunc;
|
|
22
|
+
this.createReqRepStreamFunc = options.createReqRepStreamFunc;
|
|
23
|
+
this.onPollingUpdate = options.onPollingUpdateFunc;
|
|
24
|
+
this.resetPreviousPollResult = options.resetPreviousPollResultFunc;
|
|
25
|
+
this.usePolling = (_a = options.usePolling) !== null && _a !== void 0 ? _a : false;
|
|
26
|
+
// Initialize debounced stream creation function
|
|
27
|
+
this.debouncedCreateStream = debounce((params) => this.createPollingStream(params), POLLING_STREAM_DEBOUNCE_MS);
|
|
17
28
|
const effectivePagingMode = this.getEffectivePagingMode();
|
|
18
29
|
// Initialize based on paging mode
|
|
19
30
|
if (effectivePagingMode === 'viewBased') {
|
|
20
|
-
if (!((
|
|
31
|
+
if (!((_c = (_b = options.resourceParams) === null || _b === void 0 ? void 0 : _b.DETAILS) === null || _c === void 0 ? void 0 : _c.VIEW_NUMBER)) {
|
|
21
32
|
this.resourceParams.DETAILS.VIEW_NUMBER = this.zeroBasedViewNumber ? 0 : 1;
|
|
22
33
|
}
|
|
23
34
|
}
|
|
24
35
|
else {
|
|
25
36
|
// offsetBased
|
|
26
|
-
if (!((
|
|
37
|
+
if (!((_e = (_d = options.resourceParams) === null || _d === void 0 ? void 0 : _d.DETAILS) === null || _e === void 0 ? void 0 : _e.OFFSET)) {
|
|
27
38
|
this.resourceParams.DETAILS.OFFSET = 0;
|
|
28
39
|
}
|
|
29
40
|
}
|
|
30
41
|
}
|
|
31
42
|
getRows(params) {
|
|
32
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
var _a;
|
|
34
44
|
// Use custom filtering and sorting setup for req-rep
|
|
35
45
|
yield this.setupFiltering(params);
|
|
36
46
|
yield this.setupSorting(params);
|
|
@@ -39,38 +49,55 @@ export class ReqRepServerSideDatasource extends BaseServerSideDatasource {
|
|
|
39
49
|
return;
|
|
40
50
|
}
|
|
41
51
|
const effectivePagingMode = this.getEffectivePagingMode();
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (this.pagination) {
|
|
45
|
-
this.resourceParams.DETAILS.VIEW_NUMBER = this.getPageNumber(params.request.startRow, this.maxRows, undefined, // Don't pass maxView as totalRecords since it's not a valid total count
|
|
46
|
-
this.zeroBasedViewNumber);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
this.resourceParams.DETAILS.VIEW_NUMBER += 1;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
// offsetBased
|
|
55
|
-
if (this.currentNextOffset > 0 && this.currentNextOffset !== params.request.startRow) {
|
|
56
|
-
this.resourceParams.DETAILS.OFFSET = this.currentNextOffset;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
this.resourceParams.DETAILS.OFFSET = params.request.startRow;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
52
|
+
// Update pagination params based on paging mode
|
|
53
|
+
this.updatePaginationParams(params, effectivePagingMode);
|
|
62
54
|
const requestParams = {
|
|
63
55
|
DETAILS: this.buildRequestDetails(effectivePagingMode),
|
|
64
56
|
};
|
|
65
57
|
const requestResult = yield this.createReqRepRequestFunc(requestParams);
|
|
66
|
-
//
|
|
58
|
+
// Determine if this is the last view/page
|
|
59
|
+
const isLastView = yield this.determineIsLastView(requestResult, requestParams, effectivePagingMode);
|
|
60
|
+
// Apply the result to the grid
|
|
61
|
+
this.applyServerSideData(params, requestResult, isLastView);
|
|
62
|
+
// If polling enabled, schedule stream creation after user stops scrolling
|
|
63
|
+
this.schedulePollingStream(requestParams);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Update pagination params based on paging mode
|
|
68
|
+
*/
|
|
69
|
+
updatePaginationParams(params, effectivePagingMode) {
|
|
70
|
+
if (effectivePagingMode === 'viewBased') {
|
|
71
|
+
if (this.currentSequenceId !== null && this.currentSequenceId >= 0 && this.moreRows) {
|
|
72
|
+
if (this.pagination) {
|
|
73
|
+
this.resourceParams.DETAILS.VIEW_NUMBER = this.getPageNumber(params.request.startRow, this.maxRows, undefined, // Don't pass maxView as totalRecords since it's not a valid total count
|
|
74
|
+
this.zeroBasedViewNumber);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.resourceParams.DETAILS.VIEW_NUMBER += 1;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// offsetBased
|
|
83
|
+
if (this.currentNextOffset > 0 && this.currentNextOffset !== params.request.startRow) {
|
|
84
|
+
this.resourceParams.DETAILS.OFFSET = this.currentNextOffset;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.resourceParams.DETAILS.OFFSET = params.request.startRow;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Determine if this is the last view/page
|
|
93
|
+
*/
|
|
94
|
+
determineIsLastView(requestResult, requestParams, effectivePagingMode) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
var _a;
|
|
67
97
|
const hasMoreRowsInResult = 'MORE_ROWS' in requestResult;
|
|
68
98
|
let isLastView = false;
|
|
69
|
-
// Fall back to the existing logic for backwards compatibility
|
|
70
99
|
if (effectivePagingMode === 'viewBased') {
|
|
71
|
-
// Massive limitation on the GSF. It should return -1 if it's already the last view/record (but it doesn't, next will have 0 rows then the NEXT_VIEW=-1).
|
|
72
100
|
if (hasMoreRowsInResult) {
|
|
73
|
-
// Only works with GSF 8.14+
|
|
74
101
|
isLastView = !requestResult.MORE_ROWS;
|
|
75
102
|
}
|
|
76
103
|
else if (requestResult.NEXT_VIEW !== -1) {
|
|
@@ -80,7 +107,7 @@ export class ReqRepServerSideDatasource extends BaseServerSideDatasource {
|
|
|
80
107
|
}
|
|
81
108
|
}
|
|
82
109
|
else {
|
|
83
|
-
// offsetBased
|
|
110
|
+
// offsetBased
|
|
84
111
|
isLastView = hasMoreRowsInResult && !requestResult.MORE_ROWS;
|
|
85
112
|
if ('NEXT_OFFSET' in requestResult && requestResult.NEXT_OFFSET !== -1) {
|
|
86
113
|
this.currentNextOffset = requestResult.NEXT_OFFSET;
|
|
@@ -89,13 +116,21 @@ export class ReqRepServerSideDatasource extends BaseServerSideDatasource {
|
|
|
89
116
|
this.currentNextOffset = 0;
|
|
90
117
|
}
|
|
91
118
|
}
|
|
92
|
-
|
|
93
|
-
if (applyResult) {
|
|
94
|
-
this.applyServerSideData(params, requestResult, isLastView);
|
|
95
|
-
applyResult = false;
|
|
96
|
-
}
|
|
119
|
+
return isLastView;
|
|
97
120
|
});
|
|
98
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Schedules polling stream creation if enabled.
|
|
124
|
+
* @remarks
|
|
125
|
+
* Destroys any existing stream and schedules a new one after the user stops scrolling (debounced).
|
|
126
|
+
* This prevents excessive stream recreation during rapid scrolling.
|
|
127
|
+
*/
|
|
128
|
+
schedulePollingStream(requestParams) {
|
|
129
|
+
if (this.usePolling && this.createReqRepStreamFunc) {
|
|
130
|
+
this.destroyPollingStream();
|
|
131
|
+
this.debouncedCreateStream(requestParams);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
99
134
|
applyServerSideData(params, result, isLastView) {
|
|
100
135
|
var _a, _b;
|
|
101
136
|
const messageType = result.MESSAGE_TYPE;
|
|
@@ -248,15 +283,98 @@ export class ReqRepServerSideDatasource extends BaseServerSideDatasource {
|
|
|
248
283
|
refreshDatasource: { get: () => super.refreshDatasource }
|
|
249
284
|
});
|
|
250
285
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
|
-
|
|
286
|
+
this.destroyPollingStream();
|
|
287
|
+
if (this.debouncedCreateStream) {
|
|
288
|
+
this.debouncedCreateStream.cancel();
|
|
289
|
+
}
|
|
252
290
|
this.discoveredTotalRowCount = null;
|
|
253
291
|
this.currentNextOffset = 0;
|
|
254
|
-
// Reset pagination parameters to start from beginning
|
|
255
292
|
this.resourceParams.DETAILS.VIEW_NUMBER = this.zeroBasedViewNumber ? 0 : 1;
|
|
256
293
|
this.resourceParams.DETAILS.OFFSET = 0;
|
|
257
294
|
yield _super.refreshDatasource.call(this, params);
|
|
258
295
|
});
|
|
259
296
|
}
|
|
297
|
+
destroy() {
|
|
298
|
+
const _super = Object.create(null, {
|
|
299
|
+
destroy: { get: () => super.destroy }
|
|
300
|
+
});
|
|
301
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
302
|
+
this.destroyPollingStream();
|
|
303
|
+
if (this.debouncedCreateStream) {
|
|
304
|
+
this.debouncedCreateStream.cancel();
|
|
305
|
+
}
|
|
306
|
+
yield _super.destroy.call(this);
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Creates a polling stream for the currently loaded data.
|
|
311
|
+
* @remarks
|
|
312
|
+
* This method creates a separate datasource instance that polls all currently loaded rows
|
|
313
|
+
* (from offset 0 to current offset + maxRows). The polling results are sent to the parent
|
|
314
|
+
* datasource via the `onPollingUpdate` callback for change detection and grid updates.
|
|
315
|
+
*
|
|
316
|
+
* The stream will only apply updates if the request params haven't changed (user hasn't
|
|
317
|
+
* scrolled away or changed filters/sorting).
|
|
318
|
+
* @param requestParams - The request parameters for the current view
|
|
319
|
+
*/
|
|
320
|
+
createPollingStream(requestParams) {
|
|
321
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
322
|
+
try {
|
|
323
|
+
this.destroyPollingStream();
|
|
324
|
+
this.currentStreamParams = requestParams;
|
|
325
|
+
const { stream, datasource } = yield this.createReqRepStreamFunc(requestParams);
|
|
326
|
+
this.reqRepPollingStream = stream;
|
|
327
|
+
this.reqRepPollingDatasource = datasource;
|
|
328
|
+
this.reqRepPollingSubscription = this.reqRepPollingStream.subscribe({
|
|
329
|
+
next: (result) => {
|
|
330
|
+
if (this.currentStreamParams &&
|
|
331
|
+
JSON.stringify(this.currentStreamParams) === JSON.stringify(requestParams)) {
|
|
332
|
+
if (this.onPollingUpdate) {
|
|
333
|
+
this.onPollingUpdate(result);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
error: (error) => {
|
|
338
|
+
var _a;
|
|
339
|
+
logger.error('Polling stream error:', error);
|
|
340
|
+
if (this.errorHandlerFunc) {
|
|
341
|
+
this.errorHandlerFunc(((_a = error === null || error === void 0 ? void 0 : error.receivedMessage) === null || _a === void 0 ? void 0 : _a.ERROR) || (error === null || error === void 0 ? void 0 : error.message), 'stream');
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
logger.debug('Polling stream created for params:', requestParams);
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
logger.error('Failed to create polling stream:', error);
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Destroys the current polling stream and associated datasource.
|
|
354
|
+
* @remarks
|
|
355
|
+
* Cleans up the polling subscription, destroys the separate polling datasource instance,
|
|
356
|
+
* and resets the previous poll comparison state. Called when:
|
|
357
|
+
* - User scrolls to a new page
|
|
358
|
+
* - Filters or sorting changes
|
|
359
|
+
* - The datasource is being destroyed
|
|
360
|
+
*/
|
|
361
|
+
destroyPollingStream() {
|
|
362
|
+
if (this.reqRepPollingSubscription) {
|
|
363
|
+
this.reqRepPollingSubscription.unsubscribe();
|
|
364
|
+
this.reqRepPollingSubscription = undefined;
|
|
365
|
+
logger.debug('Polling subscription destroyed');
|
|
366
|
+
}
|
|
367
|
+
if (this.reqRepPollingDatasource) {
|
|
368
|
+
this.reqRepPollingDatasource.destroy();
|
|
369
|
+
this.reqRepPollingDatasource = undefined;
|
|
370
|
+
logger.debug('Polling datasource destroyed');
|
|
371
|
+
}
|
|
372
|
+
this.reqRepPollingStream = undefined;
|
|
373
|
+
this.currentStreamParams = undefined;
|
|
374
|
+
if (this.resetPreviousPollResult) {
|
|
375
|
+
this.resetPreviousPollResult();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
260
378
|
buildRequestDetails(effectivePagingMode) {
|
|
261
379
|
const baseDetails = {
|
|
262
380
|
CRITERIA_MATCH: this.resourceParams.DETAILS.CRITERIA_MATCH,
|
package/dist/grid-pro.api.json
CHANGED
|
@@ -16462,6 +16462,37 @@
|
|
|
16462
16462
|
"isProtected": false,
|
|
16463
16463
|
"isAbstract": false
|
|
16464
16464
|
},
|
|
16465
|
+
{
|
|
16466
|
+
"kind": "Property",
|
|
16467
|
+
"canonicalReference": "@genesislcap/grid-pro!GridProServerSideDatasource#pollingDatasource:member",
|
|
16468
|
+
"docComment": "",
|
|
16469
|
+
"excerptTokens": [
|
|
16470
|
+
{
|
|
16471
|
+
"kind": "Content",
|
|
16472
|
+
"text": "pollingDatasource: "
|
|
16473
|
+
},
|
|
16474
|
+
{
|
|
16475
|
+
"kind": "Reference",
|
|
16476
|
+
"text": "Datasource",
|
|
16477
|
+
"canonicalReference": "@genesislcap/foundation-comms!Datasource:interface"
|
|
16478
|
+
},
|
|
16479
|
+
{
|
|
16480
|
+
"kind": "Content",
|
|
16481
|
+
"text": ";"
|
|
16482
|
+
}
|
|
16483
|
+
],
|
|
16484
|
+
"isReadonly": false,
|
|
16485
|
+
"isOptional": false,
|
|
16486
|
+
"releaseTag": "Beta",
|
|
16487
|
+
"name": "pollingDatasource",
|
|
16488
|
+
"propertyTypeTokenRange": {
|
|
16489
|
+
"startIndex": 1,
|
|
16490
|
+
"endIndex": 2
|
|
16491
|
+
},
|
|
16492
|
+
"isStatic": false,
|
|
16493
|
+
"isProtected": false,
|
|
16494
|
+
"isAbstract": false
|
|
16495
|
+
},
|
|
16465
16496
|
{
|
|
16466
16497
|
"kind": "Method",
|
|
16467
16498
|
"canonicalReference": "@genesislcap/grid-pro!GridProServerSideDatasource#reloadResourceData:member(1)",
|
|
@@ -16646,6 +16677,37 @@
|
|
|
16646
16677
|
"isAbstract": false,
|
|
16647
16678
|
"name": "restart"
|
|
16648
16679
|
},
|
|
16680
|
+
{
|
|
16681
|
+
"kind": "Property",
|
|
16682
|
+
"canonicalReference": "@genesislcap/grid-pro!GridProServerSideDatasource#serializer:member",
|
|
16683
|
+
"docComment": "",
|
|
16684
|
+
"excerptTokens": [
|
|
16685
|
+
{
|
|
16686
|
+
"kind": "Content",
|
|
16687
|
+
"text": "serializer: "
|
|
16688
|
+
},
|
|
16689
|
+
{
|
|
16690
|
+
"kind": "Reference",
|
|
16691
|
+
"text": "JSONSerializer",
|
|
16692
|
+
"canonicalReference": "@genesislcap/foundation-utils!JSONSerializer:interface"
|
|
16693
|
+
},
|
|
16694
|
+
{
|
|
16695
|
+
"kind": "Content",
|
|
16696
|
+
"text": ";"
|
|
16697
|
+
}
|
|
16698
|
+
],
|
|
16699
|
+
"isReadonly": false,
|
|
16700
|
+
"isOptional": false,
|
|
16701
|
+
"releaseTag": "Beta",
|
|
16702
|
+
"name": "serializer",
|
|
16703
|
+
"propertyTypeTokenRange": {
|
|
16704
|
+
"startIndex": 1,
|
|
16705
|
+
"endIndex": 2
|
|
16706
|
+
},
|
|
16707
|
+
"isStatic": false,
|
|
16708
|
+
"isProtected": false,
|
|
16709
|
+
"isAbstract": false
|
|
16710
|
+
},
|
|
16649
16711
|
{
|
|
16650
16712
|
"kind": "Property",
|
|
16651
16713
|
"canonicalReference": "@genesislcap/grid-pro!GridProServerSideDatasource#zeroBasedViewNumber:member",
|
package/dist/grid-pro.d.ts
CHANGED
|
@@ -95,6 +95,7 @@ import { IStatusPanelParams } from 'ag-grid-community';
|
|
|
95
95
|
import { ITooltipComp } from '@ag-grid-community/core';
|
|
96
96
|
import { ITooltipParams } from '@ag-grid-community/core';
|
|
97
97
|
import { ITooltipParams as ITooltipParams_2 } from 'ag-grid-community';
|
|
98
|
+
import { JSONSerializer } from '@genesislcap/foundation-utils';
|
|
98
99
|
import { KeyCreatorParams } from '@ag-grid-community/core';
|
|
99
100
|
import { KeyCreatorParams as KeyCreatorParams_2 } from 'ag-grid-community';
|
|
100
101
|
import { KVStorage } from '@genesislcap/foundation-comms';
|
|
@@ -3760,6 +3761,8 @@ export declare enum GridProRendererTypes {
|
|
|
3760
3761
|
* @beta
|
|
3761
3762
|
*/
|
|
3762
3763
|
export declare class GridProServerSideDatasource extends GridProServerSideDatasource_base {
|
|
3764
|
+
serializer: JSONSerializer;
|
|
3765
|
+
pollingDatasource: Datasource;
|
|
3763
3766
|
/**
|
|
3764
3767
|
* The starting VIEW_NUMBER of the data to be fetched.
|
|
3765
3768
|
* @remarks The VIEW_NUMBER isincremented by the grid as the user scrolls or changes pages.
|
|
@@ -3811,6 +3814,49 @@ export declare class GridProServerSideDatasource extends GridProServerSideDataso
|
|
|
3811
3814
|
private clearRowData;
|
|
3812
3815
|
private getResourceIndexes;
|
|
3813
3816
|
private createReqRepRequest;
|
|
3817
|
+
/**
|
|
3818
|
+
* Creates a polling stream for REQUEST_SERVER resources.
|
|
3819
|
+
* @remarks
|
|
3820
|
+
* Creates a separate `Datasource` instance configured to poll all currently loaded rows
|
|
3821
|
+
* (from offset 0 to current offset + maxRows). This enables change detection across all
|
|
3822
|
+
* loaded data, not just the current page.
|
|
3823
|
+
*
|
|
3824
|
+
* The separate datasource instance has built-in polling logic (pollingInterval, pollTriggerEvents)
|
|
3825
|
+
* and manages its own lifecycle independently of the snapshot datasource.
|
|
3826
|
+
* @param existingParams - The current request parameters (includes OFFSET, MAX_ROWS, etc.)
|
|
3827
|
+
* @returns Object containing the polling stream and the datasource instance
|
|
3828
|
+
* @internal
|
|
3829
|
+
*/
|
|
3830
|
+
private createReqRepStream;
|
|
3831
|
+
/**
|
|
3832
|
+
* Stores the previous poll result for comparison (poll N vs poll N-1).
|
|
3833
|
+
* @remarks
|
|
3834
|
+
* This enables efficient change detection by comparing consecutive polls instead of
|
|
3835
|
+
* maintaining the entire dataset in memory. Only stores the last poll result.
|
|
3836
|
+
* @internal
|
|
3837
|
+
*/
|
|
3838
|
+
private previousPollResult;
|
|
3839
|
+
/**
|
|
3840
|
+
* Resets the previous poll result comparison state.
|
|
3841
|
+
* @remarks
|
|
3842
|
+
* Called when the polling stream is destroyed or recreated with new parameters
|
|
3843
|
+
* (e.g., user scrolls to a different page, or filters/sorting changes).
|
|
3844
|
+
* @internal
|
|
3845
|
+
*/
|
|
3846
|
+
resetPreviousPollResult(): void;
|
|
3847
|
+
/**
|
|
3848
|
+
* Applies polling updates for REQUEST_SERVER resources in SSRM.
|
|
3849
|
+
* @remarks
|
|
3850
|
+
* Compares the current poll result (poll N) with the previous poll result (poll N-1)
|
|
3851
|
+
* to detect inserts, updates, and deletes. Changes are applied to the grid using
|
|
3852
|
+
* `applyServerSideTransaction` to avoid interfering with SSRM's cache management.
|
|
3853
|
+
*
|
|
3854
|
+
* The first poll is stored without applying changes (nothing to compare yet).
|
|
3855
|
+
* Subsequent polls are compared to detect changes efficiently.
|
|
3856
|
+
* @param result - The polling result from the REQUEST_SERVER resource
|
|
3857
|
+
* @internal
|
|
3858
|
+
*/
|
|
3859
|
+
private applyReqRepPollingUpdate;
|
|
3814
3860
|
private createDataserverStream;
|
|
3815
3861
|
private getAgColumnDefs;
|
|
3816
3862
|
applyTransaction(transaction: any): any;
|
|
@@ -82,6 +82,25 @@ boolean
|
|
|
82
82
|
**_(BETA)_** The paging mode to use for data fetching.
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
</td></tr>
|
|
86
|
+
<tr><td>
|
|
87
|
+
|
|
88
|
+
[pollingDatasource](./grid-pro.gridproserversidedatasource.pollingdatasource.md)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
</td><td>
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
</td><td>
|
|
95
|
+
|
|
96
|
+
Datasource
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
</td><td>
|
|
100
|
+
|
|
101
|
+
**_(BETA)_**
|
|
102
|
+
|
|
103
|
+
|
|
85
104
|
</td></tr>
|
|
86
105
|
<tr><td>
|
|
87
106
|
|
|
@@ -101,6 +120,25 @@ any
|
|
|
101
120
|
**_(BETA)_**
|
|
102
121
|
|
|
103
122
|
|
|
123
|
+
</td></tr>
|
|
124
|
+
<tr><td>
|
|
125
|
+
|
|
126
|
+
[serializer](./grid-pro.gridproserversidedatasource.serializer.md)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
</td><td>
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
</td><td>
|
|
133
|
+
|
|
134
|
+
JSONSerializer
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
</td><td>
|
|
138
|
+
|
|
139
|
+
**_(BETA)_**
|
|
140
|
+
|
|
141
|
+
|
|
104
142
|
</td></tr>
|
|
105
143
|
<tr><td>
|
|
106
144
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/grid-pro](./grid-pro.md) > [GridProServerSideDatasource](./grid-pro.gridproserversidedatasource.md) > [pollingDatasource](./grid-pro.gridproserversidedatasource.pollingdatasource.md)
|
|
4
|
+
|
|
5
|
+
## GridProServerSideDatasource.pollingDatasource property
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
**Signature:**
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
pollingDatasource: Datasource;
|
|
14
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/grid-pro](./grid-pro.md) > [GridProServerSideDatasource](./grid-pro.gridproserversidedatasource.md) > [serializer](./grid-pro.gridproserversidedatasource.serializer.md)
|
|
4
|
+
|
|
5
|
+
## GridProServerSideDatasource.serializer property
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
**Signature:**
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
serializer: JSONSerializer;
|
|
14
|
+
```
|
|
@@ -101,6 +101,7 @@ import { IStatusPanelParams } from 'ag-grid-community';
|
|
|
101
101
|
import { ITooltipComp } from '@ag-grid-community/core';
|
|
102
102
|
import { ITooltipParams } from '@ag-grid-community/core';
|
|
103
103
|
import { ITooltipParams as ITooltipParams_2 } from 'ag-grid-community';
|
|
104
|
+
import { JSONSerializer } from '@genesislcap/foundation-utils';
|
|
104
105
|
import { KeyCreatorParams } from '@ag-grid-community/core';
|
|
105
106
|
import { KeyCreatorParams as KeyCreatorParams_2 } from 'ag-grid-community';
|
|
106
107
|
import { KVStorage } from '@genesislcap/foundation-comms';
|
|
@@ -1393,13 +1394,19 @@ export class GridProServerSideDatasource extends GridProServerSideDatasource_bas
|
|
|
1393
1394
|
// (undocumented)
|
|
1394
1395
|
onPaginationChanged(event: any): void;
|
|
1395
1396
|
pagingMode: PagingMode | undefined;
|
|
1397
|
+
// (undocumented)
|
|
1398
|
+
pollingDatasource: Datasource;
|
|
1396
1399
|
reloadResourceData(params?: DatasourceOptions): Promise<void>;
|
|
1397
1400
|
// (undocumented)
|
|
1398
1401
|
request: any;
|
|
1402
|
+
// @internal
|
|
1403
|
+
resetPreviousPollResult(): void;
|
|
1399
1404
|
// (undocumented)
|
|
1400
1405
|
resourceNameChanged(oldValue: string, newValue: string): void;
|
|
1401
1406
|
// (undocumented)
|
|
1402
1407
|
restart(): Promise<void>;
|
|
1408
|
+
// (undocumented)
|
|
1409
|
+
serializer: JSONSerializer;
|
|
1403
1410
|
zeroBasedViewNumber: boolean;
|
|
1404
1411
|
}
|
|
1405
1412
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/grid-pro",
|
|
3
3
|
"description": "Genesis Foundation AG Grid",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.360.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@genesislcap/foundation-testing": "14.
|
|
42
|
-
"@genesislcap/genx": "14.
|
|
43
|
-
"@genesislcap/rollup-builder": "14.
|
|
44
|
-
"@genesislcap/ts-builder": "14.
|
|
45
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
46
|
-
"@genesislcap/vite-builder": "14.
|
|
47
|
-
"@genesislcap/webpack-builder": "14.
|
|
41
|
+
"@genesislcap/foundation-testing": "14.360.0",
|
|
42
|
+
"@genesislcap/genx": "14.360.0",
|
|
43
|
+
"@genesislcap/rollup-builder": "14.360.0",
|
|
44
|
+
"@genesislcap/ts-builder": "14.360.0",
|
|
45
|
+
"@genesislcap/uvu-playwright-builder": "14.360.0",
|
|
46
|
+
"@genesislcap/vite-builder": "14.360.0",
|
|
47
|
+
"@genesislcap/webpack-builder": "14.360.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@genesislcap/foundation-comms": "14.
|
|
51
|
-
"@genesislcap/foundation-logger": "14.
|
|
52
|
-
"@genesislcap/foundation-ui": "14.
|
|
53
|
-
"@genesislcap/foundation-utils": "14.
|
|
50
|
+
"@genesislcap/foundation-comms": "14.360.0",
|
|
51
|
+
"@genesislcap/foundation-logger": "14.360.0",
|
|
52
|
+
"@genesislcap/foundation-ui": "14.360.0",
|
|
53
|
+
"@genesislcap/foundation-utils": "14.360.0",
|
|
54
54
|
"@microsoft/fast-colors": "5.3.1",
|
|
55
55
|
"@microsoft/fast-components": "2.30.6",
|
|
56
56
|
"@microsoft/fast-element": "1.14.0",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
79
|
"customElements": "dist/custom-elements.json",
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "5864d7cbaaefef81025068e4025c4d2be89054dd"
|
|
81
81
|
}
|