@slickgrid-universal/odata 4.0.2 → 4.1.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/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/src/index.ts +3 -0
- package/src/interfaces/index.ts +3 -0
- package/src/interfaces/odataOption.interface.ts +57 -0
- package/src/interfaces/odataServiceApi.interface.ts +11 -0
- package/src/interfaces/odataSortingOption.interface.ts +6 -0
- package/src/services/grid-odata.service.ts +690 -0
- package/src/services/index.ts +2 -0
- package/src/services/odataQueryBuilder.service.ts +233 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slickgrid-universal/odata",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Grid OData Service to sync a grid with an OData backend server",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
|
-
"/dist"
|
|
28
|
+
"/dist",
|
|
29
|
+
"/src"
|
|
29
30
|
],
|
|
30
31
|
"license": "MIT",
|
|
31
32
|
"author": "Ghislain B.",
|
|
@@ -44,12 +45,12 @@
|
|
|
44
45
|
"not dead"
|
|
45
46
|
],
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@slickgrid-universal/common": "~4.0
|
|
48
|
-
"@slickgrid-universal/utils": "~4.0
|
|
48
|
+
"@slickgrid-universal/common": "~4.1.0",
|
|
49
|
+
"@slickgrid-universal/utils": "~4.1.0"
|
|
49
50
|
},
|
|
50
51
|
"funding": {
|
|
51
52
|
"type": "ko_fi",
|
|
52
53
|
"url": "https://ko-fi.com/ghiscoding"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "1cfc2658f5d70e66c096e5ea77d1827dd44e0292"
|
|
55
56
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { BackendServiceOption, CaseType } from '@slickgrid-universal/common';
|
|
2
|
+
|
|
3
|
+
export interface OdataOption extends BackendServiceOption {
|
|
4
|
+
/** What is the casing type to use? Typically that would be 1 of the following 2: camelCase or PascalCase */
|
|
5
|
+
caseType: CaseType;
|
|
6
|
+
|
|
7
|
+
/** Add the total count $inlinecount (OData v2) or $count (OData v4) to the OData query */
|
|
8
|
+
enableCount?: boolean;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Query fields using $select. The row identifier field is always added.
|
|
12
|
+
* E.g.: columns [{ field: 'date' }] results in $select=id,date
|
|
13
|
+
*/
|
|
14
|
+
enableSelect?: boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Query navigation fields (containing '/') using $expand.
|
|
18
|
+
* E.g.: with odata v4 and columns [{ field: 'date' }, { field: 'products/name' }] result in $select=id,date&$expand=products($select=name)
|
|
19
|
+
*/
|
|
20
|
+
enableExpand?: boolean;
|
|
21
|
+
|
|
22
|
+
/** How many rows to pull? */
|
|
23
|
+
top?: number;
|
|
24
|
+
|
|
25
|
+
/** How many rows to skip on the pagination? */
|
|
26
|
+
skip?: number;
|
|
27
|
+
|
|
28
|
+
/** (alias to "filter") Filter string (or array of string) that must be a valid OData string */
|
|
29
|
+
filter?: string | string[];
|
|
30
|
+
|
|
31
|
+
/** Filter string (or array of string) that must be a valid OData string */
|
|
32
|
+
filterBy?: any;
|
|
33
|
+
|
|
34
|
+
/** What is the separator between each filters? Typically "and", "or" */
|
|
35
|
+
filterBySeparator?: 'and' | 'or';
|
|
36
|
+
|
|
37
|
+
/** Filter queue */
|
|
38
|
+
filterQueue?: any[];
|
|
39
|
+
|
|
40
|
+
/** Sorting string (or array of string) that must be a valid OData string */
|
|
41
|
+
orderBy?: string | string[];
|
|
42
|
+
|
|
43
|
+
/** OData (or any other) version number (the query string is different between versions) */
|
|
44
|
+
version?: number;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* When false, searchTerms may be manipulated to be functional with certain filters eg: string only filters.
|
|
48
|
+
* When true, JSON.stringify is used on the searchTerms and used in the query "as-is". It is then the responsibility of the developer to sanitise the `searchTerms` property if necessary.
|
|
49
|
+
*/
|
|
50
|
+
useVerbatimSearchTerms?: boolean;
|
|
51
|
+
|
|
52
|
+
/** A callback which will extract and return the count from the data queried. Defaults to 'd.__count' for v2, '__count' for v3 and '@odata.count' for v4. */
|
|
53
|
+
countExtractor?: (response: any) => number;
|
|
54
|
+
|
|
55
|
+
/** A callback which will extract and return the dataset from the data queried. Defaults to 'd.results' for v2, 'results' for v3 and 'value' for v4. */
|
|
56
|
+
datasetExtractor?: (response: any) => number;
|
|
57
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BackendServiceApi } from '@slickgrid-universal/common';
|
|
2
|
+
import type { OdataOption } from './odataOption.interface';
|
|
3
|
+
import type { GridOdataService } from '../services/index';
|
|
4
|
+
|
|
5
|
+
export interface OdataServiceApi extends BackendServiceApi {
|
|
6
|
+
/** Backend Service Options */
|
|
7
|
+
options?: Partial<OdataOption>;
|
|
8
|
+
|
|
9
|
+
/** Backend Service instance (could be OData or GraphQL Service) */
|
|
10
|
+
service: GridOdataService;
|
|
11
|
+
}
|