angular-odata 0.100.0 → 0.102.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/esm2020/lib/api.mjs +65 -55
- 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/helper.mjs +91 -86
- package/esm2020/lib/models/collection.mjs +103 -43
- package/esm2020/lib/models/model.mjs +20 -7
- package/esm2020/lib/models/options.mjs +200 -133
- package/esm2020/lib/module.mjs +5 -5
- package/esm2020/lib/options.mjs +3 -8
- package/esm2020/lib/resources/query/builder.mjs +2 -2
- package/esm2020/lib/resources/query/expressions/syntax.mjs +1 -1
- package/esm2020/lib/resources/query/handlers.mjs +233 -34
- package/esm2020/lib/resources/query/options.mjs +45 -35
- package/esm2020/lib/resources/request.mjs +24 -35
- package/esm2020/lib/resources/resource.mjs +27 -11
- package/esm2020/lib/resources/responses/annotations.mjs +6 -6
- 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 +4 -4
- package/esm2020/lib/resources/types/batch.mjs +108 -97
- package/esm2020/lib/resources/types/function.mjs +3 -2
- package/esm2020/lib/resources/types/navigation-property.mjs +4 -2
- package/esm2020/lib/resources/types/options.mjs +1 -1
- package/esm2020/lib/schema/callable.mjs +3 -3
- package/esm2020/lib/schema/enum-type.mjs +5 -2
- package/esm2020/lib/schema/parsers/callable.mjs +10 -20
- package/esm2020/lib/schema/parsers/enum-type.mjs +13 -16
- package/esm2020/lib/schema/parsers/structured-type.mjs +15 -27
- package/esm2020/lib/schema/structured-type.mjs +10 -11
- 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 +10 -5
- package/esm2020/lib/utils/types.mjs +5 -1
- package/esm2020/lib/utils/urls.mjs +2 -2
- package/fesm2015/angular-odata.mjs +3343 -2886
- package/fesm2015/angular-odata.mjs.map +1 -1
- package/fesm2020/angular-odata.mjs +3336 -2879
- package/fesm2020/angular-odata.mjs.map +1 -1
- package/{angular-odata.d.ts → index.d.ts} +0 -0
- 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/helper.d.ts +28 -57
- package/lib/models/collection.d.ts +12 -8
- package/lib/models/model.d.ts +13 -16
- package/lib/models/options.d.ts +22 -16
- package/lib/options.d.ts +3 -7
- package/lib/resources/query/builder.d.ts +2 -2
- package/lib/resources/query/handlers.d.ts +158 -6
- package/lib/resources/query/options.d.ts +21 -21
- package/lib/resources/request.d.ts +2 -1
- package/lib/resources/resource.d.ts +7 -6
- package/lib/resources/responses/annotations.d.ts +12 -18
- package/lib/resources/responses/options.d.ts +2 -2
- package/lib/resources/responses/response.d.ts +1 -3
- 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 +4 -4
- package/lib/schema/parsers/callable.d.ts +10 -10
- package/lib/schema/parsers/enum-type.d.ts +7 -7
- package/lib/schema/parsers/structured-type.d.ts +11 -11
- package/lib/schema/structured-type.d.ts +4 -4
- package/lib/services/base.d.ts +9 -9
- package/lib/types.d.ts +6 -8
- 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 -0
- package/package.json +5 -5
|
@@ -7,30 +7,94 @@ import type { ODataQueryArguments, ODataQueryOptions } from './options';
|
|
|
7
7
|
export declare class ODataQueryOptionHandler<T> {
|
|
8
8
|
private o;
|
|
9
9
|
private n;
|
|
10
|
-
constructor(o:
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
constructor(o: Map<QueryOptionNames, any>, n: QueryOptionNames);
|
|
11
|
+
/**
|
|
12
|
+
* The name of the managed odata query option.
|
|
13
|
+
*/
|
|
13
14
|
get name(): QueryOptionNames;
|
|
15
|
+
/**
|
|
16
|
+
* Converts the managed odata query option to a json object.
|
|
17
|
+
* @returns {any}
|
|
18
|
+
*/
|
|
14
19
|
toJSON(): any;
|
|
20
|
+
/**
|
|
21
|
+
* Returns a boolean indicating if the managed odata query option is empty.
|
|
22
|
+
* @returns True if the managed odata query option is empty.
|
|
23
|
+
*/
|
|
15
24
|
empty(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Get or Set the value of the managed odata query option.
|
|
27
|
+
* @param v The value to set.
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
16
30
|
value(v?: any): any;
|
|
17
31
|
private assertArray;
|
|
32
|
+
/**
|
|
33
|
+
* Push value to the managed odata query option.
|
|
34
|
+
* @param value Value to push
|
|
35
|
+
*/
|
|
18
36
|
push(value: any): void;
|
|
37
|
+
/**
|
|
38
|
+
* Remove value from the managed odata query option.
|
|
39
|
+
* @param value Value to remove
|
|
40
|
+
*/
|
|
19
41
|
remove(value: any): void;
|
|
42
|
+
/**
|
|
43
|
+
* Return value at index of the managed odata query option.
|
|
44
|
+
* @param index Index of the value
|
|
45
|
+
* @returns The value
|
|
46
|
+
*/
|
|
20
47
|
at(index: number): any;
|
|
48
|
+
some(predicate: (value: any) => boolean): boolean;
|
|
49
|
+
every(predicate: (value: any) => boolean): boolean;
|
|
50
|
+
find(predicate: (value: any) => boolean): any;
|
|
21
51
|
private assertObject;
|
|
52
|
+
/**
|
|
53
|
+
* Set the value for path in the managed odata query option.
|
|
54
|
+
* @param path Path for set the value
|
|
55
|
+
* @param value Value to set
|
|
56
|
+
*/
|
|
22
57
|
set(path: string, value: any): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get the value for path from the managed odata query option.
|
|
60
|
+
* @param path The path from get the value
|
|
61
|
+
* @param def Default if not found
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
23
64
|
get(path: string, def?: any): any;
|
|
65
|
+
/**
|
|
66
|
+
* Unset the value for path in the managed odata query option.
|
|
67
|
+
* @param path
|
|
68
|
+
*/
|
|
24
69
|
unset(path: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Test if the managed odata query option has the value.
|
|
72
|
+
* @param path The path fot test if the value is set
|
|
73
|
+
* @returns Boolean indicating if the value is set
|
|
74
|
+
*/
|
|
25
75
|
has(path: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Merge values from object into the managed odata query option.
|
|
78
|
+
* @param values Object to merge
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
26
81
|
assign(values: {
|
|
27
82
|
[attr: string]: any;
|
|
28
83
|
}): Object;
|
|
84
|
+
/**
|
|
85
|
+
* Clear the managed odata query option.
|
|
86
|
+
*/
|
|
29
87
|
clear(): void;
|
|
30
88
|
}
|
|
31
89
|
export declare class ODataQueryOptionsHandler<T> {
|
|
32
90
|
protected options: ODataQueryOptions<T>;
|
|
33
91
|
constructor(options: ODataQueryOptions<T>);
|
|
92
|
+
/**
|
|
93
|
+
* Create a raw odata value
|
|
94
|
+
* @param value The value to raw
|
|
95
|
+
* @returns The raw value
|
|
96
|
+
*/
|
|
97
|
+
raw(value: any): import("./builder").QueryCustomType;
|
|
34
98
|
/**
|
|
35
99
|
* Create a new odata alias parameter
|
|
36
100
|
* @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_ParameterAliases
|
|
@@ -39,12 +103,40 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
39
103
|
* @returns The alias
|
|
40
104
|
*/
|
|
41
105
|
alias(value: any, name?: string): import("./builder").QueryCustomType;
|
|
106
|
+
/**
|
|
107
|
+
* Create a duration odata value
|
|
108
|
+
* @param value The value to duration
|
|
109
|
+
* @returns The duration value
|
|
110
|
+
*/
|
|
111
|
+
duration(value: any): import("./builder").QueryCustomType;
|
|
112
|
+
/**
|
|
113
|
+
* Create a binary odata value
|
|
114
|
+
* @param value The value to binary
|
|
115
|
+
* @returns The binary value
|
|
116
|
+
*/
|
|
117
|
+
binary(value: any): import("./builder").QueryCustomType;
|
|
118
|
+
/**
|
|
119
|
+
* Normalize the given value to a valid odata value
|
|
120
|
+
* @param value The value to normalize
|
|
121
|
+
* @returns The normalized value
|
|
122
|
+
*/
|
|
123
|
+
normalize(value: any): any;
|
|
124
|
+
/**
|
|
125
|
+
* Build and return a handler for modifying the $select option.
|
|
126
|
+
* If opts is given then set te value as new value for $select.
|
|
127
|
+
* @param opts Select<T> value or builder function for SelectExpression<T>
|
|
128
|
+
*/
|
|
42
129
|
select(opts: (builder: {
|
|
43
130
|
s: T;
|
|
44
131
|
e: () => SelectExpression<T>;
|
|
45
132
|
}, current?: SelectExpression<T>) => SelectExpression<T>): SelectExpression<T>;
|
|
46
133
|
select(opts: Select<T>): ODataQueryOptionHandler<T>;
|
|
47
134
|
select(): ODataQueryOptionHandler<T>;
|
|
135
|
+
/**
|
|
136
|
+
* Build and return a handler for modifying the $expand option.
|
|
137
|
+
* If opts is given then set te value as new value for $expand.
|
|
138
|
+
* @param opts Expand<T> value or builder function for ExpandExpression<T>
|
|
139
|
+
*/
|
|
48
140
|
expand(opts: (builder: {
|
|
49
141
|
s: T;
|
|
50
142
|
e: () => ExpandExpression<T>;
|
|
@@ -52,7 +144,10 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
52
144
|
expand(opts: Expand<T>): ODataQueryOptionHandler<T>;
|
|
53
145
|
expand(): ODataQueryOptionHandler<T>;
|
|
54
146
|
/**
|
|
147
|
+
* Build and return a handler for modifying the $compute option.
|
|
148
|
+
* If opts is given then set te value as new value for $compute.
|
|
55
149
|
* @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptioncompute
|
|
150
|
+
* @param opts string value or builder function for ComputeExpression<T>
|
|
56
151
|
*/
|
|
57
152
|
compute(opts: (builder: {
|
|
58
153
|
s: T;
|
|
@@ -63,17 +158,35 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
63
158
|
compute(opts: string): ODataQueryOptionHandler<T>;
|
|
64
159
|
compute(): ODataQueryOptionHandler<T>;
|
|
65
160
|
/**
|
|
161
|
+
* Build and return a handler for modifying the $format option.
|
|
162
|
+
* If opts is given then set te value as new value for $format.
|
|
66
163
|
* @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptionformat
|
|
164
|
+
* @param opts string value for format
|
|
67
165
|
*/
|
|
68
166
|
format(opts: string): ODataQueryOptionHandler<T>;
|
|
69
167
|
format(): ODataQueryOptionHandler<T>;
|
|
168
|
+
/**
|
|
169
|
+
* Build and return a handler for modifying the $transform option.
|
|
170
|
+
* If opts is given then set te value as new value for $transform.
|
|
171
|
+
* @param opts string value for transform
|
|
172
|
+
*/
|
|
70
173
|
transform(opts: Transform<T>): ODataQueryOptionHandler<T>;
|
|
71
174
|
transform(): ODataQueryOptionHandler<T>;
|
|
175
|
+
/**
|
|
176
|
+
* Build and return a handler for modifying the $search option.
|
|
177
|
+
* If opts is given then set te value as new value for $search.
|
|
178
|
+
* @param opts string value or builder function for SearchExpression<T>
|
|
179
|
+
*/
|
|
72
180
|
search(opts: (builder: {
|
|
73
181
|
e: (connector: SearchConnector) => SearchExpression<T>;
|
|
74
182
|
}, current?: SearchExpression<T>) => SearchExpression<T>): SearchExpression<T>;
|
|
75
183
|
search(opts: string): ODataQueryOptionHandler<T>;
|
|
76
184
|
search(): ODataQueryOptionHandler<T>;
|
|
185
|
+
/**
|
|
186
|
+
* Build and return a handler for modifying the $filter option.
|
|
187
|
+
* If opts is given then set te value as new value for $filter.
|
|
188
|
+
* @param opts Filter<T> value or builder function for FilterExpression<T>
|
|
189
|
+
*/
|
|
77
190
|
filter(opts: (builder: {
|
|
78
191
|
s: T;
|
|
79
192
|
e: (connector?: FilterConnector) => FilterExpression<T>;
|
|
@@ -82,23 +195,62 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
82
195
|
}, current?: FilterExpression<T>) => FilterExpression<T>): FilterExpression<T>;
|
|
83
196
|
filter(opts: Filter<T>): ODataQueryOptionHandler<T>;
|
|
84
197
|
filter(): ODataQueryOptionHandler<T>;
|
|
198
|
+
/**
|
|
199
|
+
* Build and return a handler for modifying the $orderby option.
|
|
200
|
+
* If opts is given then set te value as new value for $orderby.
|
|
201
|
+
* @param opts OrderBy<T> value or builder function for OrderByExpression<T>
|
|
202
|
+
*/
|
|
85
203
|
orderBy(opts: (builder: {
|
|
86
204
|
s: T;
|
|
87
205
|
e: () => OrderByExpression<T>;
|
|
88
206
|
}, current?: OrderByExpression<T>) => OrderByExpression<T>): OrderByExpression<T>;
|
|
89
207
|
orderBy(opts: OrderBy<T>): ODataQueryOptionHandler<T>;
|
|
90
208
|
orderBy(): ODataQueryOptionHandler<T>;
|
|
209
|
+
/**
|
|
210
|
+
* Build and return a handler for modifying the $top option.
|
|
211
|
+
* If opts is given then set te value as new value for $top.
|
|
212
|
+
* @param opts number value
|
|
213
|
+
*/
|
|
91
214
|
top(opts: number): ODataQueryOptionHandler<T>;
|
|
92
215
|
top(): ODataQueryOptionHandler<T>;
|
|
216
|
+
/**
|
|
217
|
+
* Build and return a handler for modifying the $skip option.
|
|
218
|
+
* If opts is given then set te value as new value for $skip.
|
|
219
|
+
* @param opts number value
|
|
220
|
+
*/
|
|
93
221
|
skip(opts: number): ODataQueryOptionHandler<T>;
|
|
94
222
|
skip(): ODataQueryOptionHandler<T>;
|
|
223
|
+
/**
|
|
224
|
+
* Build and return a handler for modifying the $skiptoken option.
|
|
225
|
+
* If opts is given then set te value as new value for $skiptoken.
|
|
226
|
+
* @param opts string value
|
|
227
|
+
*/
|
|
95
228
|
skiptoken(opts: string): ODataQueryOptionHandler<T>;
|
|
96
229
|
skiptoken(): ODataQueryOptionHandler<T>;
|
|
230
|
+
/**
|
|
231
|
+
* Shortcut for set $top, $skip, $skiptoken.
|
|
232
|
+
* @param param0 skip or top or skiptoken
|
|
233
|
+
*/
|
|
97
234
|
paging({ skip, skiptoken, top, }?: {
|
|
98
|
-
skip?: number;
|
|
99
|
-
skiptoken?: string;
|
|
100
|
-
top?: number;
|
|
235
|
+
skip?: number | null;
|
|
236
|
+
skiptoken?: string | null;
|
|
237
|
+
top?: number | null;
|
|
101
238
|
}): void;
|
|
239
|
+
/**
|
|
240
|
+
* Shortcut for clear pagination by unset $top, $skip, $skiptoken.
|
|
241
|
+
*/
|
|
102
242
|
clearPaging(): void;
|
|
243
|
+
/**
|
|
244
|
+
* Shortcut for clear query.
|
|
245
|
+
*/
|
|
246
|
+
clear(): void;
|
|
247
|
+
/**
|
|
248
|
+
* Retrun the query.
|
|
249
|
+
*/
|
|
250
|
+
query(): ODataQueryArguments<T>;
|
|
251
|
+
/**
|
|
252
|
+
* Apply the given query options to the current query.
|
|
253
|
+
* @param query The query to be applied.
|
|
254
|
+
*/
|
|
103
255
|
apply(query: ODataQueryArguments<T>): void;
|
|
104
256
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
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
|
-
values:
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
constructor(options?: {
|
|
23
|
+
values: Map<QueryOptionNames, any>;
|
|
24
|
+
constructor(values?: Map<QueryOptionNames, any> | {
|
|
25
25
|
[name: string]: any;
|
|
26
26
|
});
|
|
27
27
|
pathAndParams(escape?: boolean): [string, {
|
|
@@ -31,10 +31,10 @@ export declare class ODataQueryOptions<T> {
|
|
|
31
31
|
toJSON(): {};
|
|
32
32
|
toQueryArguments(): ODataQueryArguments<T>;
|
|
33
33
|
clone<O>(): ODataQueryOptions<O>;
|
|
34
|
-
expression(
|
|
35
|
-
option<O>(
|
|
36
|
-
has(
|
|
37
|
-
remove(...
|
|
38
|
-
keep(...
|
|
34
|
+
expression(key: QueryOptionNames, exp?: Expression<T>): any;
|
|
35
|
+
option<O>(key: QueryOptionNames, opts?: O): ODataQueryOptionHandler<O>;
|
|
36
|
+
has(key: QueryOptionNames): boolean;
|
|
37
|
+
remove(...keys: QueryOptionNames[]): void;
|
|
38
|
+
keep(...keys: QueryOptionNames[]): void;
|
|
39
39
|
clear(): void;
|
|
40
40
|
}
|
|
@@ -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 & {
|
|
@@ -2,35 +2,31 @@ import { ODataContext, ODataVersionHelper } from '../../helper';
|
|
|
2
2
|
import { ODataMetadataType } from '../../types';
|
|
3
3
|
export declare abstract class ODataAnnotations {
|
|
4
4
|
helper: ODataVersionHelper;
|
|
5
|
-
protected annotations:
|
|
6
|
-
[annot: string]: any;
|
|
7
|
-
};
|
|
5
|
+
protected annotations: Map<string, any>;
|
|
8
6
|
protected context?: ODataContext | undefined;
|
|
9
|
-
constructor(helper: ODataVersionHelper, annotations?:
|
|
10
|
-
[annot: string]: any;
|
|
11
|
-
}, context?: ODataContext | undefined);
|
|
7
|
+
constructor(helper: ODataVersionHelper, annotations?: Map<string, any>, context?: ODataContext | undefined);
|
|
12
8
|
attributes<T>(data: {
|
|
13
|
-
[
|
|
9
|
+
[key: string]: any;
|
|
14
10
|
}, metadata: ODataMetadataType): T;
|
|
15
11
|
get entitySet(): string | undefined;
|
|
16
12
|
get type(): string | undefined;
|
|
17
13
|
abstract clone(): ODataAnnotations;
|
|
18
14
|
abstract data(data: {
|
|
19
|
-
[
|
|
15
|
+
[key: string]: any;
|
|
20
16
|
}): {
|
|
21
|
-
[
|
|
17
|
+
[key: string]: any;
|
|
22
18
|
};
|
|
23
19
|
}
|
|
24
20
|
export declare class ODataPropertyAnnotations extends ODataAnnotations {
|
|
25
21
|
clone(): ODataPropertyAnnotations;
|
|
26
22
|
data(data: {
|
|
27
|
-
[
|
|
23
|
+
[key: string]: any;
|
|
28
24
|
}): any;
|
|
29
25
|
}
|
|
30
26
|
export declare class ODataEntityAnnotations extends ODataAnnotations {
|
|
31
27
|
clone(): ODataEntityAnnotations;
|
|
32
28
|
data(data: {
|
|
33
|
-
[
|
|
29
|
+
[key: string]: any;
|
|
34
30
|
}): any;
|
|
35
31
|
get id(): string | undefined;
|
|
36
32
|
get etag(): string | undefined;
|
|
@@ -42,20 +38,18 @@ export declare class ODataEntityAnnotations extends ODataAnnotations {
|
|
|
42
38
|
get mediaEditLink(): string | undefined;
|
|
43
39
|
get mediaContentType(): string | undefined;
|
|
44
40
|
private _properties?;
|
|
45
|
-
get properties():
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
property(name: string): any;
|
|
41
|
+
get properties(): Map<string, Map<string, any>>;
|
|
42
|
+
property(name: string): Map<string, any> | undefined;
|
|
49
43
|
private _functions?;
|
|
50
44
|
get functions(): {
|
|
51
|
-
[
|
|
45
|
+
[key: string]: any;
|
|
52
46
|
};
|
|
53
47
|
function(name: string): any;
|
|
54
48
|
}
|
|
55
49
|
export declare class ODataEntitiesAnnotations extends ODataAnnotations {
|
|
56
50
|
clone(): ODataEntitiesAnnotations;
|
|
57
51
|
data(data: {
|
|
58
|
-
[
|
|
52
|
+
[key: string]: any;
|
|
59
53
|
}): any;
|
|
60
54
|
get readLink(): string | undefined;
|
|
61
55
|
get count(): number | undefined;
|
|
@@ -66,7 +60,7 @@ export declare class ODataEntitiesAnnotations extends ODataAnnotations {
|
|
|
66
60
|
get skiptoken(): string | undefined;
|
|
67
61
|
private _functions?;
|
|
68
62
|
get functions(): {
|
|
69
|
-
[
|
|
63
|
+
[key: string]: any;
|
|
70
64
|
};
|
|
71
65
|
function(name: string): any;
|
|
72
66
|
}
|
|
@@ -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;
|
|
@@ -46,9 +46,7 @@ export declare class ODataResponse<T> extends HttpResponse<T> {
|
|
|
46
46
|
private _context?;
|
|
47
47
|
get context(): ODataContext;
|
|
48
48
|
private _annotations?;
|
|
49
|
-
get annotations():
|
|
50
|
-
[name: string]: any;
|
|
51
|
-
};
|
|
49
|
+
get annotations(): Map<string, any>;
|
|
52
50
|
/**
|
|
53
51
|
* Handle the response body as an entity
|
|
54
52
|
* @returns
|
|
@@ -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,4 +1,4 @@
|
|
|
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';
|
|
@@ -46,19 +46,19 @@ export declare class ODataEnumType<E> extends ODataSchemaElement {
|
|
|
46
46
|
* @param options Options for deserialization
|
|
47
47
|
* @returns Deserialized value
|
|
48
48
|
*/
|
|
49
|
-
deserialize(value: any, options?:
|
|
49
|
+
deserialize(value: any, options?: ParserOptions): E;
|
|
50
50
|
/**
|
|
51
51
|
* Serialize the given value for the enum type.
|
|
52
52
|
* @param value Value to serialize
|
|
53
53
|
* @param options Options for serialization
|
|
54
54
|
* @returns Serialized value
|
|
55
55
|
*/
|
|
56
|
-
serialize(value: E, options?:
|
|
56
|
+
serialize(value: E, options?: ParserOptions): any;
|
|
57
57
|
/**
|
|
58
58
|
* Encode the given value for the enum type.
|
|
59
59
|
* @param value Value to encode
|
|
60
60
|
* @param options Options for encoding
|
|
61
61
|
* @returns Encoded value
|
|
62
62
|
*/
|
|
63
|
-
encode(value: E, options?:
|
|
63
|
+
encode(value: E, options?: ParserOptions): any;
|
|
64
64
|
}
|
|
@@ -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,13 +7,13 @@ 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;
|
|
@@ -32,16 +32,16 @@ export declare class ODataCallableParser<R> implements Parser<R> {
|
|
|
32
32
|
parser: Parser<any>;
|
|
33
33
|
parameters: ODataParameterParser<any>[];
|
|
34
34
|
nonParenthesisForEmptyParameterFunction?: boolean;
|
|
35
|
-
|
|
35
|
+
parserOptions?: ParserOptions;
|
|
36
36
|
constructor(config: CallableConfig, namespace: string, alias?: string);
|
|
37
37
|
isTypeOf(type: string): boolean;
|
|
38
|
-
deserialize(value: any, options?:
|
|
39
|
-
serialize(params: any, options?:
|
|
40
|
-
encode(params: any, options?:
|
|
38
|
+
deserialize(value: any, options?: ParserOptions): R;
|
|
39
|
+
serialize(params: any, options?: ParserOptions): any;
|
|
40
|
+
encode(params: any, options?: ParserOptions): any;
|
|
41
41
|
configure({ nonParenthesisForEmptyParameterFunction, parserForType, options, }: {
|
|
42
42
|
nonParenthesisForEmptyParameterFunction: boolean;
|
|
43
43
|
parserForType: (type: string) => Parser<any>;
|
|
44
|
-
options:
|
|
44
|
+
options: ParserOptions;
|
|
45
45
|
}): void;
|
|
46
46
|
binding(): ODataParameterParser<any> | undefined;
|
|
47
47
|
}
|