angular-odata 0.100.1 → 0.102.5
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/esm2020/lib/api.mjs +84 -64
- package/esm2020/lib/cache/cache.mjs +56 -4
- package/esm2020/lib/cache/memory.mjs +16 -6
- package/esm2020/lib/cache/storage.mjs +23 -4
- package/esm2020/lib/client.mjs +3 -3
- package/esm2020/lib/constants.mjs +2 -1
- package/esm2020/lib/models/collection.mjs +103 -43
- package/esm2020/lib/models/model.mjs +17 -4
- package/esm2020/lib/models/options.mjs +200 -122
- package/esm2020/lib/module.mjs +5 -5
- package/esm2020/lib/options.mjs +3 -8
- package/esm2020/lib/resources/query/builder.mjs +1 -1
- package/esm2020/lib/resources/query/expressions/compute.mjs +5 -5
- package/esm2020/lib/resources/query/expressions/expand.mjs +6 -6
- package/esm2020/lib/resources/query/expressions/filter.mjs +9 -9
- package/esm2020/lib/resources/query/expressions/index.mjs +3 -1
- package/esm2020/lib/resources/query/expressions/orderby.mjs +5 -5
- package/esm2020/lib/resources/query/expressions/search.mjs +3 -3
- package/esm2020/lib/resources/query/expressions/select.mjs +7 -7
- package/esm2020/lib/resources/query/expressions/syntax.mjs +1 -1
- package/esm2020/lib/resources/query/handlers.mjs +208 -22
- package/esm2020/lib/resources/query/options.mjs +16 -13
- package/esm2020/lib/resources/request.mjs +31 -36
- package/esm2020/lib/resources/resource.mjs +27 -11
- package/esm2020/lib/resources/responses/annotations.mjs +1 -1
- package/esm2020/lib/resources/responses/metadata.mjs +1 -1
- package/esm2020/lib/resources/responses/options.mjs +1 -1
- package/esm2020/lib/resources/responses/response.mjs +2 -2
- package/esm2020/lib/resources/types/batch.mjs +108 -97
- package/esm2020/lib/resources/types/navigation-property.mjs +5 -3
- package/esm2020/lib/resources/types/options.mjs +1 -1
- package/esm2020/lib/resources/types/property.mjs +4 -4
- package/esm2020/lib/schema/callable.mjs +3 -3
- package/esm2020/lib/schema/enum-type.mjs +13 -26
- package/esm2020/lib/schema/parsers/callable.mjs +15 -20
- package/esm2020/lib/schema/parsers/enum-type.mjs +35 -18
- package/esm2020/lib/schema/parsers/structured-type.mjs +132 -66
- package/esm2020/lib/schema/structured-type.mjs +31 -39
- package/esm2020/lib/services/base.mjs +1 -1
- package/esm2020/lib/services/factory.mjs +3 -3
- package/esm2020/lib/types.mjs +1 -1
- package/esm2020/lib/utils/arrays.mjs +10 -0
- package/esm2020/lib/utils/enums.mjs +3 -3
- package/esm2020/lib/utils/objects.mjs +11 -6
- package/esm2020/lib/utils/types.mjs +6 -7
- package/fesm2015/angular-odata.mjs +3451 -2918
- package/fesm2015/angular-odata.mjs.map +1 -1
- package/fesm2020/angular-odata.mjs +3454 -2919
- package/fesm2020/angular-odata.mjs.map +1 -1
- package/{angular-odata.d.ts → index.d.ts} +0 -0
- package/lib/api.d.ts +2 -4
- package/lib/cache/cache.d.ts +62 -1
- package/lib/cache/memory.d.ts +10 -0
- package/lib/cache/storage.d.ts +19 -0
- package/lib/constants.d.ts +1 -0
- package/lib/models/collection.d.ts +14 -9
- package/lib/models/model.d.ts +10 -7
- package/lib/models/options.d.ts +31 -22
- package/lib/options.d.ts +3 -7
- package/lib/resources/query/builder.d.ts +1 -1
- package/lib/resources/query/expressions/compute.d.ts +7 -6
- package/lib/resources/query/expressions/expand.d.ts +17 -32
- package/lib/resources/query/expressions/filter.d.ts +11 -10
- package/lib/resources/query/expressions/index.d.ts +2 -0
- package/lib/resources/query/expressions/orderby.d.ts +7 -6
- package/lib/resources/query/expressions/search.d.ts +5 -4
- package/lib/resources/query/expressions/select.d.ts +7 -6
- package/lib/resources/query/handlers.d.ts +158 -33
- package/lib/resources/query/options.d.ts +14 -12
- package/lib/resources/request.d.ts +2 -1
- package/lib/resources/resource.d.ts +7 -6
- package/lib/resources/responses/options.d.ts +2 -2
- package/lib/resources/types/batch.d.ts +8 -11
- package/lib/resources/types/options.d.ts +4 -2
- package/lib/schema/callable.d.ts +4 -4
- package/lib/schema/enum-type.d.ts +11 -23
- package/lib/schema/parsers/callable.d.ts +11 -10
- package/lib/schema/parsers/enum-type.d.ts +22 -14
- package/lib/schema/parsers/structured-type.d.ts +58 -14
- package/lib/schema/structured-type.d.ts +23 -23
- package/lib/services/base.d.ts +9 -9
- package/lib/types.d.ts +11 -13
- package/lib/utils/arrays.d.ts +3 -0
- package/lib/utils/enums.d.ts +2 -2
- package/lib/utils/objects.d.ts +1 -1
- package/lib/utils/strings.d.ts +1 -1
- package/lib/utils/types.d.ts +1 -1
- package/package.json +5 -5
|
@@ -17,6 +17,9 @@ export declare class SearchTerm implements Renderable {
|
|
|
17
17
|
}): string;
|
|
18
18
|
clone(): SearchTerm;
|
|
19
19
|
}
|
|
20
|
+
export declare type SearchExpressionBuilder<T> = {
|
|
21
|
+
e: (connector?: SearchConnector) => SearchExpression<T>;
|
|
22
|
+
};
|
|
20
23
|
export declare class SearchExpression<T> extends Expression<T> {
|
|
21
24
|
private _connector;
|
|
22
25
|
private _negated;
|
|
@@ -25,10 +28,8 @@ export declare class SearchExpression<T> extends Expression<T> {
|
|
|
25
28
|
connector?: SearchConnector;
|
|
26
29
|
negated?: boolean;
|
|
27
30
|
});
|
|
28
|
-
static
|
|
29
|
-
static search<T extends object>(opts: (builder:
|
|
30
|
-
e: (connector?: SearchConnector) => SearchExpression<T>;
|
|
31
|
-
}, current?: SearchExpression<T>) => SearchExpression<T>, current?: SearchExpression<T>): SearchExpression<T>;
|
|
31
|
+
static expression<T>(connector?: SearchConnector): SearchExpression<T>;
|
|
32
|
+
static search<T extends object>(opts: (builder: SearchExpressionBuilder<T>, current?: SearchExpression<T>) => SearchExpression<T>, current?: SearchExpression<T>): SearchExpression<T>;
|
|
32
33
|
private _add;
|
|
33
34
|
render({ aliases, escape, prefix, }?: {
|
|
34
35
|
aliases?: QueryCustomType[] | undefined;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { QueryCustomType } from '../builder';
|
|
2
2
|
import { Expression } from './base';
|
|
3
3
|
import { Renderable } from './syntax';
|
|
4
|
+
export declare type SelectExpressionBuilder<T> = {
|
|
5
|
+
t: T;
|
|
6
|
+
e: () => SelectExpression<T>;
|
|
7
|
+
};
|
|
4
8
|
export declare class SelectExpression<T> extends Expression<T> {
|
|
5
9
|
constructor({ children, }?: {
|
|
6
10
|
children?: Renderable[];
|
|
7
11
|
});
|
|
8
|
-
static
|
|
9
|
-
static
|
|
10
|
-
static select<T extends object>(
|
|
11
|
-
s: T;
|
|
12
|
-
e: () => SelectExpression<T>;
|
|
13
|
-
}, c?: SelectExpression<T>) => SelectExpression<T>, current?: SelectExpression<T>): SelectExpression<T>;
|
|
12
|
+
static expression<T>(): SelectExpression<T>;
|
|
13
|
+
static type<T extends object>(): T;
|
|
14
|
+
static select<T extends object>(opts: (builder: SelectExpressionBuilder<T>, current?: SelectExpression<T>) => SelectExpression<T>, current?: SelectExpression<T>): SelectExpression<T>;
|
|
14
15
|
render({ aliases, escape, prefix, }?: {
|
|
15
16
|
aliases?: QueryCustomType[] | undefined;
|
|
16
17
|
escape?: boolean | undefined;
|
|
@@ -1,34 +1,98 @@
|
|
|
1
1
|
import { QueryOptionNames } from '../../types';
|
|
2
2
|
import { Expand, Filter, OrderBy, Select, Transform } from './builder';
|
|
3
|
-
import { ComputeExpression,
|
|
4
|
-
import { ExpandExpression } from './expressions/expand';
|
|
5
|
-
import { SelectExpression } from './expressions/select';
|
|
3
|
+
import { ComputeExpression, ComputeExpressionBuilder, FilterExpression, FilterExpressionBuilder, OrderByExpression, OrderByExpressionBuilder, SearchExpression, SearchExpressionBuilder, ExpandExpression, ExpandExpressionBuilder, SelectExpression, SelectExpressionBuilder } from './expressions';
|
|
6
4
|
import type { ODataQueryArguments, ODataQueryOptions } from './options';
|
|
7
5
|
export declare class ODataQueryOptionHandler<T> {
|
|
8
6
|
private o;
|
|
9
7
|
private n;
|
|
10
8
|
constructor(o: Map<QueryOptionNames, any>, n: QueryOptionNames);
|
|
9
|
+
/**
|
|
10
|
+
* The name of the managed odata query option.
|
|
11
|
+
*/
|
|
11
12
|
get name(): QueryOptionNames;
|
|
13
|
+
/**
|
|
14
|
+
* Converts the managed odata query option to a json object.
|
|
15
|
+
* @returns {any}
|
|
16
|
+
*/
|
|
12
17
|
toJSON(): any;
|
|
18
|
+
/**
|
|
19
|
+
* Returns a boolean indicating if the managed odata query option is empty.
|
|
20
|
+
* @returns True if the managed odata query option is empty.
|
|
21
|
+
*/
|
|
13
22
|
empty(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Get or Set the value of the managed odata query option.
|
|
25
|
+
* @param v The value to set.
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
14
28
|
value(v?: any): any;
|
|
15
29
|
private assertArray;
|
|
30
|
+
/**
|
|
31
|
+
* Push value to the managed odata query option.
|
|
32
|
+
* @param value Value to push
|
|
33
|
+
*/
|
|
16
34
|
push(value: any): void;
|
|
35
|
+
/**
|
|
36
|
+
* Remove value from the managed odata query option.
|
|
37
|
+
* @param value Value to remove
|
|
38
|
+
*/
|
|
17
39
|
remove(value: any): void;
|
|
40
|
+
/**
|
|
41
|
+
* Return value at index of the managed odata query option.
|
|
42
|
+
* @param index Index of the value
|
|
43
|
+
* @returns The value
|
|
44
|
+
*/
|
|
18
45
|
at(index: number): any;
|
|
46
|
+
some(predicate: (value: any) => boolean): boolean;
|
|
47
|
+
every(predicate: (value: any) => boolean): boolean;
|
|
48
|
+
find(predicate: (value: any) => boolean): any;
|
|
19
49
|
private assertObject;
|
|
50
|
+
/**
|
|
51
|
+
* Set the value for path in the managed odata query option.
|
|
52
|
+
* @param path Path for set the value
|
|
53
|
+
* @param value Value to set
|
|
54
|
+
*/
|
|
20
55
|
set(path: string, value: any): void;
|
|
56
|
+
/**
|
|
57
|
+
* Get the value for path from the managed odata query option.
|
|
58
|
+
* @param path The path from get the value
|
|
59
|
+
* @param def Default if not found
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
21
62
|
get(path: string, def?: any): any;
|
|
63
|
+
/**
|
|
64
|
+
* Unset the value for path in the managed odata query option.
|
|
65
|
+
* @param path
|
|
66
|
+
*/
|
|
22
67
|
unset(path: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Test if the managed odata query option has the value.
|
|
70
|
+
* @param path The path fot test if the value is set
|
|
71
|
+
* @returns Boolean indicating if the value is set
|
|
72
|
+
*/
|
|
23
73
|
has(path: string): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Merge values from object into the managed odata query option.
|
|
76
|
+
* @param values Object to merge
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
24
79
|
assign(values: {
|
|
25
80
|
[attr: string]: any;
|
|
26
81
|
}): Object;
|
|
82
|
+
/**
|
|
83
|
+
* Clear the managed odata query option.
|
|
84
|
+
*/
|
|
27
85
|
clear(): void;
|
|
28
86
|
}
|
|
29
87
|
export declare class ODataQueryOptionsHandler<T> {
|
|
30
88
|
protected options: ODataQueryOptions<T>;
|
|
31
89
|
constructor(options: ODataQueryOptions<T>);
|
|
90
|
+
/**
|
|
91
|
+
* Create a raw odata value
|
|
92
|
+
* @param value The value to raw
|
|
93
|
+
* @returns The raw value
|
|
94
|
+
*/
|
|
95
|
+
raw(value: any): import("./builder").QueryCustomType;
|
|
32
96
|
/**
|
|
33
97
|
* Create a new odata alias parameter
|
|
34
98
|
* @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_ParameterAliases
|
|
@@ -37,72 +101,133 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
37
101
|
* @returns The alias
|
|
38
102
|
*/
|
|
39
103
|
alias(value: any, name?: string): import("./builder").QueryCustomType;
|
|
104
|
+
/**
|
|
105
|
+
* Create a duration odata value
|
|
106
|
+
* @param value The value to duration
|
|
107
|
+
* @returns The duration value
|
|
108
|
+
*/
|
|
109
|
+
duration(value: any): import("./builder").QueryCustomType;
|
|
110
|
+
/**
|
|
111
|
+
* Create a binary odata value
|
|
112
|
+
* @param value The value to binary
|
|
113
|
+
* @returns The binary value
|
|
114
|
+
*/
|
|
115
|
+
binary(value: any): import("./builder").QueryCustomType;
|
|
40
116
|
/**
|
|
41
117
|
* Normalize the given value to a valid odata value
|
|
42
118
|
* @param value The value to normalize
|
|
43
119
|
* @returns The normalized value
|
|
44
120
|
*/
|
|
45
121
|
normalize(value: any): any;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Build and return a handler for modifying the $select option.
|
|
124
|
+
* If opts is given then set te value as new value for $select.
|
|
125
|
+
* @param opts Select<T> value or builder function for SelectExpression<T>
|
|
126
|
+
*/
|
|
127
|
+
select(opts: SelectExpressionBuilder<T>): SelectExpression<T>;
|
|
50
128
|
select(opts: Select<T>): ODataQueryOptionHandler<T>;
|
|
51
129
|
select(): ODataQueryOptionHandler<T>;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Build and return a handler for modifying the $expand option.
|
|
132
|
+
* If opts is given then set te value as new value for $expand.
|
|
133
|
+
* @param opts Expand<T> value or builder function for ExpandExpression<T>
|
|
134
|
+
*/
|
|
135
|
+
expand(opts: ExpandExpressionBuilder<T>): ExpandExpression<T>;
|
|
56
136
|
expand(opts: Expand<T>): ODataQueryOptionHandler<T>;
|
|
57
137
|
expand(): ODataQueryOptionHandler<T>;
|
|
58
138
|
/**
|
|
139
|
+
* Build and return a handler for modifying the $compute option.
|
|
140
|
+
* If opts is given then set te value as new value for $compute.
|
|
59
141
|
* @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptioncompute
|
|
142
|
+
* @param opts string value or builder function for ComputeExpression<T>
|
|
60
143
|
*/
|
|
61
|
-
compute(opts: (builder:
|
|
62
|
-
s: T;
|
|
63
|
-
e: () => ComputeExpression<T>;
|
|
64
|
-
o: ODataOperators<T>;
|
|
65
|
-
f: ODataFunctions<T>;
|
|
66
|
-
}, current?: ComputeExpression<T>) => ComputeExpression<T>): ComputeExpression<T>;
|
|
144
|
+
compute(opts: (builder: ComputeExpressionBuilder<T>, current?: ComputeExpression<T>) => ComputeExpression<T>): ComputeExpression<T>;
|
|
67
145
|
compute(opts: string): ODataQueryOptionHandler<T>;
|
|
68
146
|
compute(): ODataQueryOptionHandler<T>;
|
|
69
147
|
/**
|
|
148
|
+
* Build and return a handler for modifying the $format option.
|
|
149
|
+
* If opts is given then set te value as new value for $format.
|
|
70
150
|
* @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptionformat
|
|
151
|
+
* @param opts string value for format
|
|
71
152
|
*/
|
|
72
153
|
format(opts: string): ODataQueryOptionHandler<T>;
|
|
73
154
|
format(): ODataQueryOptionHandler<T>;
|
|
155
|
+
/**
|
|
156
|
+
* Build and return a handler for modifying the $transform option.
|
|
157
|
+
* If opts is given then set te value as new value for $transform.
|
|
158
|
+
* @param opts string value for transform
|
|
159
|
+
*/
|
|
74
160
|
transform(opts: Transform<T>): ODataQueryOptionHandler<T>;
|
|
75
161
|
transform(): ODataQueryOptionHandler<T>;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Build and return a handler for modifying the $search option.
|
|
164
|
+
* If opts is given then set te value as new value for $search.
|
|
165
|
+
* @param opts string value or builder function for SearchExpression<T>
|
|
166
|
+
*/
|
|
167
|
+
search(opts: (builder: SearchExpressionBuilder<T>, current?: SearchExpression<T>) => SearchExpression<T>): SearchExpression<T>;
|
|
79
168
|
search(opts: string): ODataQueryOptionHandler<T>;
|
|
80
169
|
search(): ODataQueryOptionHandler<T>;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Build and return a handler for modifying the $filter option.
|
|
172
|
+
* If opts is given then set te value as new value for $filter.
|
|
173
|
+
* @param opts Filter<T> value or builder function for FilterExpression<T>
|
|
174
|
+
*/
|
|
175
|
+
filter(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>): FilterExpression<T>;
|
|
87
176
|
filter(opts: Filter<T>): ODataQueryOptionHandler<T>;
|
|
88
177
|
filter(): ODataQueryOptionHandler<T>;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
178
|
+
/**
|
|
179
|
+
* Build and return a handler for modifying the $orderby option.
|
|
180
|
+
* If opts is given then set te value as new value for $orderby.
|
|
181
|
+
* @param opts OrderBy<T> value or builder function for OrderByExpression<T>
|
|
182
|
+
*/
|
|
183
|
+
orderBy(opts: (builder: OrderByExpressionBuilder<T>, current?: OrderByExpression<T>) => OrderByExpression<T>): OrderByExpression<T>;
|
|
93
184
|
orderBy(opts: OrderBy<T>): ODataQueryOptionHandler<T>;
|
|
94
185
|
orderBy(): ODataQueryOptionHandler<T>;
|
|
186
|
+
/**
|
|
187
|
+
* Build and return a handler for modifying the $top option.
|
|
188
|
+
* If opts is given then set te value as new value for $top.
|
|
189
|
+
* @param opts number value
|
|
190
|
+
*/
|
|
95
191
|
top(opts: number): ODataQueryOptionHandler<T>;
|
|
96
192
|
top(): ODataQueryOptionHandler<T>;
|
|
193
|
+
/**
|
|
194
|
+
* Build and return a handler for modifying the $skip option.
|
|
195
|
+
* If opts is given then set te value as new value for $skip.
|
|
196
|
+
* @param opts number value
|
|
197
|
+
*/
|
|
97
198
|
skip(opts: number): ODataQueryOptionHandler<T>;
|
|
98
199
|
skip(): ODataQueryOptionHandler<T>;
|
|
200
|
+
/**
|
|
201
|
+
* Build and return a handler for modifying the $skiptoken option.
|
|
202
|
+
* If opts is given then set te value as new value for $skiptoken.
|
|
203
|
+
* @param opts string value
|
|
204
|
+
*/
|
|
99
205
|
skiptoken(opts: string): ODataQueryOptionHandler<T>;
|
|
100
206
|
skiptoken(): ODataQueryOptionHandler<T>;
|
|
207
|
+
/**
|
|
208
|
+
* Shortcut for set $top, $skip, $skiptoken.
|
|
209
|
+
* @param param0 skip or top or skiptoken
|
|
210
|
+
*/
|
|
101
211
|
paging({ skip, skiptoken, top, }?: {
|
|
102
|
-
skip?: number;
|
|
103
|
-
skiptoken?: string;
|
|
104
|
-
top?: number;
|
|
212
|
+
skip?: number | null;
|
|
213
|
+
skiptoken?: string | null;
|
|
214
|
+
top?: number | null;
|
|
105
215
|
}): void;
|
|
216
|
+
/**
|
|
217
|
+
* Shortcut for clear pagination by unset $top, $skip, $skiptoken.
|
|
218
|
+
*/
|
|
106
219
|
clearPaging(): void;
|
|
220
|
+
/**
|
|
221
|
+
* Shortcut for clear query.
|
|
222
|
+
*/
|
|
223
|
+
clear(): void;
|
|
224
|
+
/**
|
|
225
|
+
* Retrun the query.
|
|
226
|
+
*/
|
|
227
|
+
query(): ODataQueryArguments<T>;
|
|
228
|
+
/**
|
|
229
|
+
* Apply the given query options to the current query.
|
|
230
|
+
* @param query The query to be applied.
|
|
231
|
+
*/
|
|
107
232
|
apply(query: ODataQueryArguments<T>): void;
|
|
108
233
|
}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { QueryOptionNames } from '../../types';
|
|
2
2
|
import { Expand, Filter, OrderBy, Select, Transform } from './builder';
|
|
3
|
-
import { Expression, FilterExpression, OrderByExpression, SearchExpression } from './expressions';
|
|
3
|
+
import { ComputeExpression, Expression, FilterExpression, OrderByExpression, SearchExpression } from './expressions';
|
|
4
4
|
import { ExpandExpression } from './expressions/expand';
|
|
5
5
|
import { SelectExpression } from './expressions/select';
|
|
6
6
|
import { ODataQueryOptionHandler } from './handlers';
|
|
7
7
|
export declare type ODataQueryArguments<T> = {
|
|
8
|
-
[QueryOptionNames.select]?: Select<T> | SelectExpression<T
|
|
9
|
-
[QueryOptionNames.
|
|
10
|
-
[QueryOptionNames.
|
|
11
|
-
[QueryOptionNames.
|
|
12
|
-
[QueryOptionNames.
|
|
13
|
-
[QueryOptionNames.
|
|
14
|
-
[QueryOptionNames.
|
|
15
|
-
[QueryOptionNames.
|
|
16
|
-
[QueryOptionNames.
|
|
17
|
-
[QueryOptionNames.
|
|
18
|
-
[QueryOptionNames.format]?: string;
|
|
8
|
+
[QueryOptionNames.select]?: Select<T> | SelectExpression<T> | null;
|
|
9
|
+
[QueryOptionNames.expand]?: Expand<T> | ExpandExpression<T> | null;
|
|
10
|
+
[QueryOptionNames.compute]?: string | ComputeExpression<T> | null;
|
|
11
|
+
[QueryOptionNames.filter]?: Filter<T> | FilterExpression<T> | null;
|
|
12
|
+
[QueryOptionNames.search]?: string | SearchExpression<T> | null;
|
|
13
|
+
[QueryOptionNames.transform]?: Transform<T> | null;
|
|
14
|
+
[QueryOptionNames.orderBy]?: OrderBy<T> | OrderByExpression<T> | null;
|
|
15
|
+
[QueryOptionNames.top]?: number | null;
|
|
16
|
+
[QueryOptionNames.skip]?: number | null;
|
|
17
|
+
[QueryOptionNames.skiptoken]?: string | null;
|
|
18
|
+
[QueryOptionNames.format]?: string | null;
|
|
19
|
+
[QueryOptionNames.levels]?: number | 'max' | null;
|
|
20
|
+
[QueryOptionNames.count]?: boolean | null;
|
|
19
21
|
};
|
|
20
22
|
export declare class ODataQueryOptions<T> {
|
|
21
23
|
values: Map<QueryOptionNames, any>;
|
|
@@ -16,7 +16,6 @@ export declare class ODataRequest<T> {
|
|
|
16
16
|
private readonly _headers;
|
|
17
17
|
private readonly _params;
|
|
18
18
|
private readonly _path;
|
|
19
|
-
private readonly _queryBody;
|
|
20
19
|
constructor(init: {
|
|
21
20
|
method: string;
|
|
22
21
|
api: ODataApi;
|
|
@@ -45,6 +44,8 @@ export declare class ODataRequest<T> {
|
|
|
45
44
|
get pathWithParams(): string;
|
|
46
45
|
get url(): string;
|
|
47
46
|
get urlWithParams(): string;
|
|
47
|
+
get cacheKey(): string;
|
|
48
|
+
isQueryBody(): boolean;
|
|
48
49
|
isBatch(): boolean;
|
|
49
50
|
isFetch(): boolean;
|
|
50
51
|
isMutate(): boolean;
|
|
@@ -3,7 +3,7 @@ import { ODataApi } from '../api';
|
|
|
3
3
|
import { ODataCollection, ODataModel } from '../models';
|
|
4
4
|
import { ODataStructuredType } from '../schema';
|
|
5
5
|
import { ODataSchemaElement } from '../schema/element';
|
|
6
|
-
import {
|
|
6
|
+
import { ParserOptions, QueryOptionNames } from '../types';
|
|
7
7
|
import { ODataPathSegments, ODataPathSegmentsHandler } from './path';
|
|
8
8
|
import { ODataQueryOptions, ODataQueryOptionsHandler, QueryCustomType } from './query';
|
|
9
9
|
import { ODataEntitiesAnnotations, ODataEntityAnnotations } from './responses/index';
|
|
@@ -37,6 +37,7 @@ export declare class ODataResource<T> {
|
|
|
37
37
|
* @returns boolean The resource has key ?
|
|
38
38
|
*/
|
|
39
39
|
hasKey(): boolean;
|
|
40
|
+
hasEntityKey(): boolean;
|
|
40
41
|
clearKey(): void | undefined;
|
|
41
42
|
asModel<M extends ODataModel<T>>(entity?: Partial<T> | {
|
|
42
43
|
[name: string]: any;
|
|
@@ -60,9 +61,9 @@ export declare class ODataResource<T> {
|
|
|
60
61
|
toString(): string;
|
|
61
62
|
clone(): ODataResource<T>;
|
|
62
63
|
private __parser;
|
|
63
|
-
deserialize(value: any, options?:
|
|
64
|
-
serialize(value: any, options?:
|
|
65
|
-
encode(value: any, options?:
|
|
64
|
+
deserialize(value: any, options?: ParserOptions): any;
|
|
65
|
+
serialize(value: any, options?: ParserOptions): any;
|
|
66
|
+
encode(value: any, options?: ParserOptions): any;
|
|
66
67
|
toJSON(): {
|
|
67
68
|
segments: any[];
|
|
68
69
|
options: {};
|
|
@@ -76,13 +77,13 @@ export declare class ODataResource<T> {
|
|
|
76
77
|
* @param f Function context for handle the segments
|
|
77
78
|
* @returns ODataActionResource
|
|
78
79
|
*/
|
|
79
|
-
segment(f: (q: ODataPathSegmentsHandler<T>) => void): this;
|
|
80
|
+
segment(f: (q: ODataPathSegmentsHandler<T>, s?: ODataStructuredType<T>) => void): this;
|
|
80
81
|
/**
|
|
81
82
|
* Handle the query options of the resource
|
|
82
83
|
* Create an object handler for mutate the query options of the resource
|
|
83
84
|
* @param f Function context for handle the query options
|
|
84
85
|
*/
|
|
85
|
-
query(f: (q: ODataQueryOptionsHandler<T>) => void): this;
|
|
86
|
+
query(f: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): this;
|
|
86
87
|
static resolveKey<T>(value: any, schema?: ODataStructuredType<T>): EntityKey<T> | undefined;
|
|
87
88
|
protected resolveKey(value: any): EntityKey<T> | undefined;
|
|
88
89
|
protected request(method: string, options: ODataOptions & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ODataMetadataType, ODataVersion,
|
|
1
|
+
import { ODataMetadataType, ODataVersion, ParserOptions, ResponseOptions } from '../../types';
|
|
2
2
|
export declare class ODataResponseOptions implements ResponseOptions {
|
|
3
3
|
version: ODataVersion;
|
|
4
4
|
streaming?: boolean;
|
|
@@ -7,7 +7,7 @@ export declare class ODataResponseOptions implements ResponseOptions {
|
|
|
7
7
|
location?: string;
|
|
8
8
|
cacheability?: 'public' | 'private' | 'no-cache' | 'no-store';
|
|
9
9
|
maxAge?: number;
|
|
10
|
-
constructor(config:
|
|
10
|
+
constructor(config: ParserOptions);
|
|
11
11
|
get helper(): import("../../helper").ODataVersionHelper;
|
|
12
12
|
clone(): ODataResponseOptions;
|
|
13
13
|
setFeatures(features: string): void;
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
+
import { HttpErrorResponse, HttpResponseBase } from '@angular/common/http';
|
|
1
2
|
import { Observable, Subject } from 'rxjs';
|
|
2
3
|
import { ODataApi } from '../../api';
|
|
3
4
|
import { ODataRequest } from '../request';
|
|
4
5
|
import { ODataResource } from '../resource';
|
|
5
6
|
import { ODataResponse } from '../responses';
|
|
6
7
|
import { ODataOptions } from './options';
|
|
7
|
-
export declare class ODataBatchRequest<T> extends Subject<
|
|
8
|
+
export declare class ODataBatchRequest<T> extends Subject<HttpResponseBase> {
|
|
8
9
|
request: ODataRequest<any>;
|
|
9
10
|
constructor(request: ODataRequest<any>);
|
|
10
11
|
toString(): string;
|
|
11
|
-
onLoad(
|
|
12
|
-
|
|
13
|
-
message: string;
|
|
14
|
-
}): void;
|
|
15
|
-
onError(content: string[], status: {
|
|
16
|
-
code: number;
|
|
17
|
-
text: string;
|
|
18
|
-
}): void;
|
|
12
|
+
onLoad(response: HttpResponseBase): void;
|
|
13
|
+
onError(response: HttpErrorResponse): void;
|
|
19
14
|
}
|
|
20
15
|
/**
|
|
21
16
|
* OData Batch Resource
|
|
@@ -24,6 +19,8 @@ export declare class ODataBatchRequest<T> extends Subject<ODataResponse<T>> {
|
|
|
24
19
|
export declare class ODataBatchResource extends ODataResource<any> {
|
|
25
20
|
private _requests;
|
|
26
21
|
requests(): ODataRequest<any>[];
|
|
22
|
+
private _responses;
|
|
23
|
+
responses(): HttpResponseBase[] | null;
|
|
27
24
|
static factory(api: ODataApi): ODataBatchResource;
|
|
28
25
|
clone(): ODataBatchResource;
|
|
29
26
|
private storeRequester;
|
|
@@ -34,7 +31,7 @@ export declare class ODataBatchResource extends ODataResource<any> {
|
|
|
34
31
|
* @returns The result of execute the context
|
|
35
32
|
*/
|
|
36
33
|
add<R>(ctx: (batch: this) => Observable<R>): Observable<R>;
|
|
37
|
-
send(options?: ODataOptions):
|
|
34
|
+
send(options?: ODataOptions): Observable<null | ODataResponse<string>>;
|
|
38
35
|
/**
|
|
39
36
|
* Execute the batch request
|
|
40
37
|
* @param ctx The context for the request
|
|
@@ -44,5 +41,5 @@ export declare class ODataBatchResource extends ODataResource<any> {
|
|
|
44
41
|
exec<R>(ctx: (batch: this) => Observable<R>, options?: ODataOptions): Observable<R>;
|
|
45
42
|
body(): string;
|
|
46
43
|
static buildBody(batchBoundary: string, requests: ODataBatchRequest<any>[]): string;
|
|
47
|
-
static
|
|
44
|
+
static parseResponse(requests: ODataBatchRequest<any>[], response: ODataResponse<string>): HttpResponseBase[];
|
|
48
45
|
}
|
|
@@ -25,6 +25,8 @@ export declare type ODataPropertyOptions = ODataOptions & {
|
|
|
25
25
|
export declare type ODataNoneOptions = ODataOptions & {
|
|
26
26
|
responseType?: 'none';
|
|
27
27
|
};
|
|
28
|
-
export declare type ODataQueryArgumentsOptions<T> = ODataQueryArguments<T
|
|
28
|
+
export declare type ODataQueryArgumentsOptions<T> = ODataOptions & ODataQueryArguments<T>;
|
|
29
|
+
export declare type ODataActionOptions<T> = ODataQueryArgumentsOptions<T>;
|
|
30
|
+
export declare type ODataFunctionOptions<T> = ODataQueryArgumentsOptions<T> & {
|
|
29
31
|
alias?: boolean;
|
|
30
|
-
}
|
|
32
|
+
};
|
package/lib/schema/callable.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallableConfig,
|
|
1
|
+
import { CallableConfig, ParserOptions, Parser } from '../types';
|
|
2
2
|
import { ODataSchemaElement } from './element';
|
|
3
3
|
import { ODataCallableParser } from './parsers';
|
|
4
4
|
import { ODataSchema } from './schema';
|
|
@@ -18,21 +18,21 @@ export declare class ODataCallable<R> extends ODataSchemaElement {
|
|
|
18
18
|
* @param options Options for deserialization
|
|
19
19
|
* @returns Deserialized value
|
|
20
20
|
*/
|
|
21
|
-
deserialize(value: any, options?:
|
|
21
|
+
deserialize(value: any, options?: ParserOptions): any;
|
|
22
22
|
/**
|
|
23
23
|
* Serialize the given value for the callable.
|
|
24
24
|
* @param value Value to serialize
|
|
25
25
|
* @param options Options for serialization
|
|
26
26
|
* @returns Serialized value
|
|
27
27
|
*/
|
|
28
|
-
serialize(value: any, options?:
|
|
28
|
+
serialize(value: any, options?: ParserOptions): any;
|
|
29
29
|
/**
|
|
30
30
|
* Encode the given value for the callable.
|
|
31
31
|
* @param value Value to encode
|
|
32
32
|
* @param options Options for encoding
|
|
33
33
|
* @returns Encoded value
|
|
34
34
|
*/
|
|
35
|
-
encode(value: any, options?:
|
|
35
|
+
encode(value: any, options?: ParserOptions): any;
|
|
36
36
|
/**
|
|
37
37
|
* Returns the binding parameter of the callable.
|
|
38
38
|
* @returns The binding parameter of the callable.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { EnumTypeConfig,
|
|
1
|
+
import { EnumTypeConfig, ParserOptions } from '../types';
|
|
2
2
|
import { ODataSchemaElement } from './element';
|
|
3
3
|
import { ODataEnumTypeFieldParser, ODataEnumTypeParser } from './parsers';
|
|
4
4
|
import { ODataSchema } from './schema';
|
|
5
5
|
export declare class ODataEnumType<E> extends ODataSchemaElement {
|
|
6
6
|
parser: ODataEnumTypeParser<E>;
|
|
7
7
|
members: {
|
|
8
|
-
[name: string]:
|
|
8
|
+
[name: string]: E;
|
|
9
9
|
} | {
|
|
10
10
|
[value: number]: string;
|
|
11
11
|
};
|
|
@@ -15,50 +15,38 @@ export declare class ODataEnumType<E> extends ODataSchemaElement {
|
|
|
15
15
|
* Returns the fields of the enum type.
|
|
16
16
|
* @returns The fields of the enum type.
|
|
17
17
|
*/
|
|
18
|
-
fields(): ODataEnumTypeFieldParser[];
|
|
18
|
+
fields(value?: E): ODataEnumTypeFieldParser<E>[];
|
|
19
19
|
/**
|
|
20
|
-
* Find a field by name.
|
|
21
|
-
* @param
|
|
22
|
-
* @returns The field with the given name
|
|
20
|
+
* Find a field by name or value.
|
|
21
|
+
* @param enu The name or value of the field
|
|
22
|
+
* @returns The field with the given name or value
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Find a field by value.
|
|
27
|
-
* @param value The value of the field
|
|
28
|
-
* @returns The field with the given value
|
|
29
|
-
*/
|
|
30
|
-
findFieldByValue(value: number): ODataEnumTypeFieldParser | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Find a fields by flag.
|
|
33
|
-
* @param value The value of the field
|
|
34
|
-
* @returns The fields with the given flag
|
|
35
|
-
*/
|
|
36
|
-
findFieldsByValue(value: number): ODataEnumTypeFieldParser[];
|
|
24
|
+
field(enu: string | E): ODataEnumTypeFieldParser<E>;
|
|
37
25
|
/**
|
|
38
26
|
* Map the fields of the enum type.
|
|
39
27
|
* @param mapper Function that maps the value to the new value
|
|
40
28
|
* @returns The fields mapped by the mapper
|
|
41
29
|
*/
|
|
42
|
-
mapFields<T>(mapper: (field: ODataEnumTypeFieldParser) => T): T[];
|
|
30
|
+
mapFields<T>(mapper: (field: ODataEnumTypeFieldParser<E>) => T): T[];
|
|
43
31
|
/**
|
|
44
32
|
* Deseialize the given value from the enum type.
|
|
45
33
|
* @param value Value to deserialize
|
|
46
34
|
* @param options Options for deserialization
|
|
47
35
|
* @returns Deserialized value
|
|
48
36
|
*/
|
|
49
|
-
deserialize(value: any, options?:
|
|
37
|
+
deserialize(value: any, options?: ParserOptions): E;
|
|
50
38
|
/**
|
|
51
39
|
* Serialize the given value for the enum type.
|
|
52
40
|
* @param value Value to serialize
|
|
53
41
|
* @param options Options for serialization
|
|
54
42
|
* @returns Serialized value
|
|
55
43
|
*/
|
|
56
|
-
serialize(value: E, options?:
|
|
44
|
+
serialize(value: E, options?: ParserOptions): any;
|
|
57
45
|
/**
|
|
58
46
|
* Encode the given value for the enum type.
|
|
59
47
|
* @param value Value to encode
|
|
60
48
|
* @param options Options for encoding
|
|
61
49
|
* @returns Encoded value
|
|
62
50
|
*/
|
|
63
|
-
encode(value: E, options?:
|
|
51
|
+
encode(value: E, options?: ParserOptions): any;
|
|
64
52
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallableConfig,
|
|
1
|
+
import { CallableConfig, ParserOptions, Parameter, Parser } from '../../types';
|
|
2
2
|
import { ODataEnumTypeParser } from './enum-type';
|
|
3
3
|
import { ODataStructuredTypeParser } from './structured-type';
|
|
4
4
|
export declare class ODataParameterParser<T> {
|
|
@@ -7,19 +7,20 @@ export declare class ODataParameterParser<T> {
|
|
|
7
7
|
private parser;
|
|
8
8
|
collection?: boolean;
|
|
9
9
|
nullable?: boolean;
|
|
10
|
-
|
|
10
|
+
parserOptions?: ParserOptions;
|
|
11
11
|
constructor(name: string, parameter: Parameter);
|
|
12
|
-
serialize(value: T, options?:
|
|
13
|
-
encode(value: any, options?:
|
|
12
|
+
serialize(value: T, options?: ParserOptions): any;
|
|
13
|
+
encode(value: any, options?: ParserOptions): string;
|
|
14
14
|
configure({ parserForType, options, }: {
|
|
15
15
|
parserForType: (type: string) => Parser<any>;
|
|
16
|
-
options:
|
|
16
|
+
options: ParserOptions;
|
|
17
17
|
}): void;
|
|
18
18
|
isEdmType(): boolean;
|
|
19
19
|
isEnumType(): boolean;
|
|
20
20
|
enum(): ODataEnumTypeParser<T>;
|
|
21
21
|
isStructuredType(): boolean;
|
|
22
22
|
structured(): ODataStructuredTypeParser<T>;
|
|
23
|
+
field<F>(name: string): import("./structured-type").ODataStructuredTypeFieldParser<F>;
|
|
23
24
|
}
|
|
24
25
|
export declare class ODataCallableParser<R> implements Parser<R> {
|
|
25
26
|
name: string;
|
|
@@ -32,16 +33,16 @@ export declare class ODataCallableParser<R> implements Parser<R> {
|
|
|
32
33
|
parser: Parser<any>;
|
|
33
34
|
parameters: ODataParameterParser<any>[];
|
|
34
35
|
nonParenthesisForEmptyParameterFunction?: boolean;
|
|
35
|
-
|
|
36
|
+
parserOptions?: ParserOptions;
|
|
36
37
|
constructor(config: CallableConfig, namespace: string, alias?: string);
|
|
37
38
|
isTypeOf(type: string): boolean;
|
|
38
|
-
deserialize(value: any, options?:
|
|
39
|
-
serialize(params: any, options?:
|
|
40
|
-
encode(params: any, options?:
|
|
39
|
+
deserialize(value: any, options?: ParserOptions): R;
|
|
40
|
+
serialize(params: any, options?: ParserOptions): any;
|
|
41
|
+
encode(params: any, options?: ParserOptions): any;
|
|
41
42
|
configure({ nonParenthesisForEmptyParameterFunction, parserForType, options, }: {
|
|
42
43
|
nonParenthesisForEmptyParameterFunction: boolean;
|
|
43
44
|
parserForType: (type: string) => Parser<any>;
|
|
44
|
-
options:
|
|
45
|
+
options: ParserOptions;
|
|
45
46
|
}): void;
|
|
46
47
|
binding(): ODataParameterParser<any> | undefined;
|
|
47
48
|
}
|