angular-odata 0.102.0 → 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 +83 -63
- package/esm2020/lib/cache/cache.mjs +1 -1
- package/esm2020/lib/cache/memory.mjs +1 -1
- package/esm2020/lib/cache/storage.mjs +1 -1
- package/esm2020/lib/models/collection.mjs +3 -3
- package/esm2020/lib/models/model.mjs +1 -1
- package/esm2020/lib/models/options.mjs +37 -19
- 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/handlers.mjs +2 -4
- package/esm2020/lib/resources/query/options.mjs +2 -3
- package/esm2020/lib/resources/request.mjs +22 -16
- package/esm2020/lib/resources/resource.mjs +1 -1
- package/esm2020/lib/resources/types/navigation-property.mjs +2 -2
- package/esm2020/lib/resources/types/property.mjs +4 -4
- package/esm2020/lib/schema/enum-type.mjs +9 -25
- package/esm2020/lib/schema/parsers/callable.mjs +6 -1
- package/esm2020/lib/schema/parsers/enum-type.mjs +23 -3
- package/esm2020/lib/schema/parsers/structured-type.mjs +120 -42
- package/esm2020/lib/schema/structured-type.mjs +26 -38
- package/esm2020/lib/types.mjs +1 -1
- package/esm2020/lib/utils/objects.mjs +2 -2
- package/esm2020/lib/utils/types.mjs +2 -7
- package/fesm2015/angular-odata.mjs +361 -250
- package/fesm2015/angular-odata.mjs.map +1 -1
- package/fesm2020/angular-odata.mjs +356 -243
- package/fesm2020/angular-odata.mjs.map +1 -1
- package/lib/api.d.ts +2 -4
- package/lib/models/collection.d.ts +2 -1
- package/lib/models/options.d.ts +9 -6
- 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 +7 -30
- package/lib/schema/enum-type.d.ts +7 -19
- package/lib/schema/parsers/callable.d.ts +1 -0
- package/lib/schema/parsers/enum-type.d.ts +18 -10
- package/lib/schema/parsers/structured-type.d.ts +47 -3
- package/lib/schema/structured-type.d.ts +19 -19
- package/lib/types.d.ts +5 -5
- package/lib/utils/types.d.ts +0 -1
- package/package.json +1 -1
package/lib/api.d.ts
CHANGED
|
@@ -20,9 +20,7 @@ export declare class ODataApi {
|
|
|
20
20
|
options: ODataApiOptions;
|
|
21
21
|
cache: ODataCache;
|
|
22
22
|
errorHandler?: (error: any, caught: Observable<any>) => Observable<never>;
|
|
23
|
-
parsers:
|
|
24
|
-
[type: string]: Parser<any>;
|
|
25
|
-
};
|
|
23
|
+
parsers: Map<string, Parser<any>>;
|
|
26
24
|
schemas: ODataSchema[];
|
|
27
25
|
constructor(config: ApiConfig);
|
|
28
26
|
configure(settings?: {
|
|
@@ -96,5 +94,5 @@ export declare class ODataApi {
|
|
|
96
94
|
findCollectionByName(name: string): typeof ODataCollection | undefined;
|
|
97
95
|
findServiceByName(name: string): typeof ODataEntityService | undefined;
|
|
98
96
|
parserForType<T>(type: string, bindingType?: string): Parser<T>;
|
|
99
|
-
findOptionsForType<T>(type: string): ODataModelOptions<T> | undefined;
|
|
97
|
+
findOptionsForType<T>(type: string): ODataModelOptions<any> | ODataModelOptions<T> | undefined;
|
|
100
98
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from '@angular/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { ODataActionOptions, ODataEntitiesAnnotations, ODataEntitySetResource, ODataFunctionOptions, ODataNavigationPropertyResource, ODataOptions, ODataPropertyResource, ODataQueryOptionsHandler, ODataResource } from '../resources';
|
|
4
|
+
import { ODataStructuredType } from '../schema/structured-type';
|
|
4
5
|
import { ODataModel } from './model';
|
|
5
6
|
import { ODataModelEntry, ODataModelEvent, ODataModelField } from './options';
|
|
6
7
|
export declare class ODataCollection<T, M extends ODataModel<T>> implements Iterable<M> {
|
|
@@ -103,7 +104,7 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
|
|
|
103
104
|
reparent?: boolean;
|
|
104
105
|
silent?: boolean;
|
|
105
106
|
}): void;
|
|
106
|
-
query(func: (q: ODataQueryOptionsHandler<T>) => void): this;
|
|
107
|
+
query(func: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): this;
|
|
107
108
|
callFunction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataFunctionOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
|
|
108
109
|
callAction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataActionOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
|
|
109
110
|
private _unlink;
|
package/lib/models/options.d.ts
CHANGED
|
@@ -174,9 +174,9 @@ export declare class ODataModelOptions<T> {
|
|
|
174
174
|
findOptionsForType: (type: string) => ODataModelOptions<any> | undefined;
|
|
175
175
|
options: ParserOptions;
|
|
176
176
|
}): void;
|
|
177
|
-
fields({ include_navigation, include_parents, }
|
|
178
|
-
include_parents
|
|
179
|
-
include_navigation
|
|
177
|
+
fields({ include_navigation, include_parents, }: {
|
|
178
|
+
include_parents: boolean;
|
|
179
|
+
include_navigation: boolean;
|
|
180
180
|
}): ODataModelField<any>[];
|
|
181
181
|
field<F>(name: keyof T | string): ODataModelField<F>;
|
|
182
182
|
attach<R>(self: ODataModel<T>, resource: ODataEntityResource<R> | ODataNavigationPropertyResource<R> | ODataPropertyResource<R> | ODataSingletonResource<R>): void;
|
|
@@ -199,25 +199,28 @@ export declare class ODataModelOptions<T> {
|
|
|
199
199
|
query(self: ODataModel<T>, resource: ODataEntityResource<T> | ODataPropertyResource<T> | ODataNavigationPropertyResource<T> | ODataSingletonResource<T>, func: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): ODataModel<T>;
|
|
200
200
|
resolveKey(value: ODataModel<T> | T | {
|
|
201
201
|
[name: string]: any;
|
|
202
|
-
}, { field_mapping, resolve, }?: {
|
|
202
|
+
}, { field_mapping, resolve, single, }?: {
|
|
203
203
|
field_mapping?: boolean;
|
|
204
204
|
resolve?: boolean;
|
|
205
|
+
single?: boolean;
|
|
205
206
|
}): EntityKey<T> | {
|
|
206
207
|
[name: string]: any;
|
|
207
208
|
} | undefined;
|
|
208
209
|
resolveReferential(value: ODataModel<T> | T | {
|
|
209
210
|
[name: string]: any;
|
|
210
|
-
} | null, field: ODataModelField<any>, { field_mapping, resolve, }?: {
|
|
211
|
+
} | null, field: ODataModelField<any>, { field_mapping, resolve, single, }?: {
|
|
211
212
|
field_mapping?: boolean;
|
|
212
213
|
resolve?: boolean;
|
|
214
|
+
single?: boolean;
|
|
213
215
|
}): {
|
|
214
216
|
[name: string]: any;
|
|
215
217
|
} | null | undefined;
|
|
216
218
|
resolveReferenced(value: ODataModel<T> | T | {
|
|
217
219
|
[name: string]: any;
|
|
218
|
-
} | null, field: ODataModelField<any>, { field_mapping, resolve, }?: {
|
|
220
|
+
} | null, field: ODataModelField<any>, { field_mapping, resolve, single, }?: {
|
|
219
221
|
field_mapping?: boolean;
|
|
220
222
|
resolve?: boolean;
|
|
223
|
+
single?: boolean;
|
|
221
224
|
}): {
|
|
222
225
|
[name: string]: any;
|
|
223
226
|
} | null | undefined;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type { QueryCustomType } from '../builder';
|
|
2
2
|
import { Expression } from './base';
|
|
3
3
|
import { ODataFunctions, ODataOperators, Renderable } from './syntax';
|
|
4
|
+
export declare type ComputeExpressionBuilder<T> = {
|
|
5
|
+
t: T;
|
|
6
|
+
e: () => ComputeExpression<T>;
|
|
7
|
+
};
|
|
4
8
|
export declare class ComputeExpression<T> extends Expression<T> {
|
|
5
9
|
names: string[];
|
|
6
10
|
constructor({ children, names, }?: {
|
|
7
11
|
children?: Renderable[];
|
|
8
12
|
names?: string[];
|
|
9
13
|
});
|
|
10
|
-
static
|
|
11
|
-
static
|
|
12
|
-
static compute<T extends object>(opts: (builder:
|
|
13
|
-
s: T;
|
|
14
|
-
e: () => ComputeExpression<T>;
|
|
15
|
-
}, current?: ComputeExpression<T>) => ComputeExpression<T>, current?: ComputeExpression<T>): ComputeExpression<T>;
|
|
14
|
+
static expression<T>(): ComputeExpression<T>;
|
|
15
|
+
static type<T extends object>(): T;
|
|
16
|
+
static compute<T extends object>(opts: (builder: ComputeExpressionBuilder<T>, current?: ComputeExpression<T>) => ComputeExpression<T>, current?: ComputeExpression<T>): ComputeExpression<T>;
|
|
16
17
|
render({ aliases, escape, prefix, }?: {
|
|
17
18
|
aliases?: QueryCustomType[] | undefined;
|
|
18
19
|
escape?: boolean | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { QueryCustomType } from '../builder';
|
|
2
2
|
import { Expression } from './base';
|
|
3
|
-
import {
|
|
4
|
-
import { OrderByExpression } from './orderby';
|
|
5
|
-
import {
|
|
6
|
-
import { SelectExpression } from './select';
|
|
7
|
-
import {
|
|
3
|
+
import { FilterExpression, FilterExpressionBuilder } from './filter';
|
|
4
|
+
import { OrderByExpression, OrderByExpressionBuilder } from './orderby';
|
|
5
|
+
import { SearchExpression, SearchExpressionBuilder } from './search';
|
|
6
|
+
import { SelectExpression, SelectExpressionBuilder } from './select';
|
|
7
|
+
import { Renderable } from './syntax';
|
|
8
8
|
export declare class ExpandField<T> implements Renderable {
|
|
9
9
|
protected field: any;
|
|
10
10
|
private values;
|
|
@@ -21,42 +21,27 @@ export declare class ExpandField<T> implements Renderable {
|
|
|
21
21
|
prefix?: string;
|
|
22
22
|
}): string;
|
|
23
23
|
clone(): ExpandField<unknown>;
|
|
24
|
-
select<T extends object>(opts: (builder:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
s: T;
|
|
30
|
-
e: () => ExpandExpression<T>;
|
|
31
|
-
}, current?: ExpandExpression<T>) => ExpandExpression<T>): any;
|
|
32
|
-
filter<T extends object>(opts: (builder: {
|
|
33
|
-
s: T;
|
|
34
|
-
e: (connector?: FilterConnector) => FilterExpression<T>;
|
|
35
|
-
o: ODataOperators<T>;
|
|
36
|
-
f: ODataFunctions<T>;
|
|
37
|
-
}, current?: FilterExpression<T>) => FilterExpression<T>): any;
|
|
38
|
-
search<T extends object>(opts: (builder: {
|
|
39
|
-
e: (connector?: SearchConnector) => SearchExpression<T>;
|
|
40
|
-
}) => SearchExpression<T>): any;
|
|
41
|
-
orderBy<T extends object>(opts: (builder: {
|
|
42
|
-
s: T;
|
|
43
|
-
e: () => OrderByExpression<T>;
|
|
44
|
-
}, current?: OrderByExpression<T>) => OrderByExpression<T>): any;
|
|
24
|
+
select<T extends object>(opts: (builder: SelectExpressionBuilder<T>, current?: SelectExpression<T>) => SelectExpression<T>): SelectExpression<T>;
|
|
25
|
+
expand<T extends object>(opts: (builder: ExpandExpressionBuilder<T>, current?: ExpandExpression<T>) => ExpandExpression<T>): any;
|
|
26
|
+
filter<T extends object>(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>): any;
|
|
27
|
+
search<T extends object>(opts: (builder: SearchExpressionBuilder<T>) => SearchExpression<T>): any;
|
|
28
|
+
orderBy<T extends object>(opts: (builder: OrderByExpressionBuilder<T>, current?: OrderByExpression<T>) => OrderByExpression<T>): any;
|
|
45
29
|
skip(n: number): any;
|
|
46
30
|
top(n: number): any;
|
|
47
31
|
levels(n: number | 'max'): any;
|
|
48
32
|
private option;
|
|
49
33
|
}
|
|
34
|
+
export declare type ExpandExpressionBuilder<T> = {
|
|
35
|
+
t: T;
|
|
36
|
+
e: () => ExpandExpression<T>;
|
|
37
|
+
};
|
|
50
38
|
export declare class ExpandExpression<T> extends Expression<T> {
|
|
51
39
|
constructor({ children, }?: {
|
|
52
40
|
children?: Renderable[];
|
|
53
41
|
});
|
|
54
|
-
static
|
|
55
|
-
static
|
|
56
|
-
static expand<T extends object>(opts: (builder:
|
|
57
|
-
s: T;
|
|
58
|
-
e: () => ExpandExpression<T>;
|
|
59
|
-
}, current?: ExpandExpression<T>) => ExpandExpression<T>, current?: ExpandExpression<T>): ExpandExpression<T>;
|
|
42
|
+
static expression<T>(): ExpandExpression<T>;
|
|
43
|
+
static type<T extends object>(): T;
|
|
44
|
+
static expand<T extends object>(opts: (builder: ExpandExpressionBuilder<T>, current?: ExpandExpression<T>) => ExpandExpression<T>, current?: ExpandExpression<T>): ExpandExpression<T>;
|
|
60
45
|
render({ aliases, escape, prefix, }?: {
|
|
61
46
|
aliases?: QueryCustomType[] | undefined;
|
|
62
47
|
escape?: boolean | undefined;
|
|
@@ -2,6 +2,12 @@ import type { QueryCustomType } from '../builder';
|
|
|
2
2
|
import { Expression } from './base';
|
|
3
3
|
import { ODataFunctions, ODataOperators, Renderable } from './syntax';
|
|
4
4
|
export declare type FilterConnector = 'and' | 'or';
|
|
5
|
+
export declare type FilterExpressionBuilder<T> = {
|
|
6
|
+
t: T;
|
|
7
|
+
e: (connector?: FilterConnector) => FilterExpression<T>;
|
|
8
|
+
o: ODataOperators<T>;
|
|
9
|
+
f: ODataFunctions<T>;
|
|
10
|
+
};
|
|
5
11
|
export declare class FilterExpression<F> extends Expression<F> {
|
|
6
12
|
private _connector;
|
|
7
13
|
private _negated;
|
|
@@ -10,14 +16,9 @@ export declare class FilterExpression<F> extends Expression<F> {
|
|
|
10
16
|
connector?: FilterConnector;
|
|
11
17
|
negated?: boolean;
|
|
12
18
|
});
|
|
13
|
-
static
|
|
14
|
-
static
|
|
15
|
-
static filter<T extends object>(opts: (builder:
|
|
16
|
-
s: T;
|
|
17
|
-
e: (connector?: FilterConnector) => FilterExpression<T>;
|
|
18
|
-
o: ODataOperators<T>;
|
|
19
|
-
f: ODataFunctions<T>;
|
|
20
|
-
}, current?: FilterExpression<T>) => FilterExpression<T>, current?: FilterExpression<T>): FilterExpression<T>;
|
|
19
|
+
static type<T extends object>(): T;
|
|
20
|
+
static expression<T>(connector?: FilterConnector): FilterExpression<T>;
|
|
21
|
+
static filter<T extends object>(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>, current?: FilterExpression<T>): FilterExpression<T>;
|
|
21
22
|
toJSON(): {
|
|
22
23
|
children: any[];
|
|
23
24
|
connector: FilterConnector;
|
|
@@ -47,11 +48,11 @@ export declare class FilterExpression<F> extends Expression<F> {
|
|
|
47
48
|
startsWith(left: any, right: any, normalize?: boolean): FilterExpression<F>;
|
|
48
49
|
endsWith(left: any, right: any, normalize?: boolean): FilterExpression<F>;
|
|
49
50
|
any<N extends object>(left: N[], opts: (e: {
|
|
50
|
-
s: N;
|
|
51
51
|
e: (connector?: FilterConnector) => FilterExpression<N>;
|
|
52
|
+
t: N;
|
|
52
53
|
}) => FilterExpression<N>, alias?: string): FilterExpression<F>;
|
|
53
54
|
all<N extends object>(left: N[], opts: (e: {
|
|
54
|
-
|
|
55
|
+
t: N;
|
|
55
56
|
e: (connector?: FilterConnector) => FilterExpression<N>;
|
|
56
57
|
}) => FilterExpression<N>, alias?: string): FilterExpression<F>;
|
|
57
58
|
isof(type: string): FilterExpression<F>;
|
|
@@ -17,16 +17,17 @@ export declare class OrderByField implements Renderable {
|
|
|
17
17
|
}): string;
|
|
18
18
|
clone(): OrderByField;
|
|
19
19
|
}
|
|
20
|
+
export declare type OrderByExpressionBuilder<T> = {
|
|
21
|
+
t: T;
|
|
22
|
+
e: () => OrderByExpression<T>;
|
|
23
|
+
};
|
|
20
24
|
export declare class OrderByExpression<T> extends Expression<T> {
|
|
21
25
|
constructor({ children, }?: {
|
|
22
26
|
children?: Renderable[];
|
|
23
27
|
});
|
|
24
|
-
static
|
|
25
|
-
static
|
|
26
|
-
static orderBy<T extends object>(opts: (builder:
|
|
27
|
-
s: T;
|
|
28
|
-
e: () => OrderByExpression<T>;
|
|
29
|
-
}, current?: OrderByExpression<T>) => OrderByExpression<T>, current?: OrderByExpression<T>): OrderByExpression<T>;
|
|
28
|
+
static expression<T>(): OrderByExpression<T>;
|
|
29
|
+
static type<T extends object>(): T;
|
|
30
|
+
static orderBy<T extends object>(opts: (builder: OrderByExpressionBuilder<T>, current?: OrderByExpression<T>) => OrderByExpression<T>, current?: OrderByExpression<T>): OrderByExpression<T>;
|
|
30
31
|
private _add;
|
|
31
32
|
render({ aliases, escape, prefix, }?: {
|
|
32
33
|
aliases?: QueryCustomType[] | undefined;
|
|
@@ -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,8 +1,6 @@
|
|
|
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;
|
|
@@ -126,10 +124,7 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
126
124
|
* If opts is given then set te value as new value for $select.
|
|
127
125
|
* @param opts Select<T> value or builder function for SelectExpression<T>
|
|
128
126
|
*/
|
|
129
|
-
select(opts:
|
|
130
|
-
s: T;
|
|
131
|
-
e: () => SelectExpression<T>;
|
|
132
|
-
}, current?: SelectExpression<T>) => SelectExpression<T>): SelectExpression<T>;
|
|
127
|
+
select(opts: SelectExpressionBuilder<T>): SelectExpression<T>;
|
|
133
128
|
select(opts: Select<T>): ODataQueryOptionHandler<T>;
|
|
134
129
|
select(): ODataQueryOptionHandler<T>;
|
|
135
130
|
/**
|
|
@@ -137,10 +132,7 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
137
132
|
* If opts is given then set te value as new value for $expand.
|
|
138
133
|
* @param opts Expand<T> value or builder function for ExpandExpression<T>
|
|
139
134
|
*/
|
|
140
|
-
expand(opts:
|
|
141
|
-
s: T;
|
|
142
|
-
e: () => ExpandExpression<T>;
|
|
143
|
-
}, current?: ExpandExpression<T>) => ExpandExpression<T>): ExpandExpression<T>;
|
|
135
|
+
expand(opts: ExpandExpressionBuilder<T>): ExpandExpression<T>;
|
|
144
136
|
expand(opts: Expand<T>): ODataQueryOptionHandler<T>;
|
|
145
137
|
expand(): ODataQueryOptionHandler<T>;
|
|
146
138
|
/**
|
|
@@ -149,12 +141,7 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
149
141
|
* @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptioncompute
|
|
150
142
|
* @param opts string value or builder function for ComputeExpression<T>
|
|
151
143
|
*/
|
|
152
|
-
compute(opts: (builder:
|
|
153
|
-
s: T;
|
|
154
|
-
e: () => ComputeExpression<T>;
|
|
155
|
-
o: ODataOperators<T>;
|
|
156
|
-
f: ODataFunctions<T>;
|
|
157
|
-
}, current?: ComputeExpression<T>) => ComputeExpression<T>): ComputeExpression<T>;
|
|
144
|
+
compute(opts: (builder: ComputeExpressionBuilder<T>, current?: ComputeExpression<T>) => ComputeExpression<T>): ComputeExpression<T>;
|
|
158
145
|
compute(opts: string): ODataQueryOptionHandler<T>;
|
|
159
146
|
compute(): ODataQueryOptionHandler<T>;
|
|
160
147
|
/**
|
|
@@ -177,9 +164,7 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
177
164
|
* If opts is given then set te value as new value for $search.
|
|
178
165
|
* @param opts string value or builder function for SearchExpression<T>
|
|
179
166
|
*/
|
|
180
|
-
search(opts: (builder:
|
|
181
|
-
e: (connector: SearchConnector) => SearchExpression<T>;
|
|
182
|
-
}, current?: SearchExpression<T>) => SearchExpression<T>): SearchExpression<T>;
|
|
167
|
+
search(opts: (builder: SearchExpressionBuilder<T>, current?: SearchExpression<T>) => SearchExpression<T>): SearchExpression<T>;
|
|
183
168
|
search(opts: string): ODataQueryOptionHandler<T>;
|
|
184
169
|
search(): ODataQueryOptionHandler<T>;
|
|
185
170
|
/**
|
|
@@ -187,12 +172,7 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
187
172
|
* If opts is given then set te value as new value for $filter.
|
|
188
173
|
* @param opts Filter<T> value or builder function for FilterExpression<T>
|
|
189
174
|
*/
|
|
190
|
-
filter(opts: (builder:
|
|
191
|
-
s: T;
|
|
192
|
-
e: (connector?: FilterConnector) => FilterExpression<T>;
|
|
193
|
-
o: ODataOperators<T>;
|
|
194
|
-
f: ODataFunctions<T>;
|
|
195
|
-
}, current?: FilterExpression<T>) => FilterExpression<T>): FilterExpression<T>;
|
|
175
|
+
filter(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>): FilterExpression<T>;
|
|
196
176
|
filter(opts: Filter<T>): ODataQueryOptionHandler<T>;
|
|
197
177
|
filter(): ODataQueryOptionHandler<T>;
|
|
198
178
|
/**
|
|
@@ -200,10 +180,7 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
200
180
|
* If opts is given then set te value as new value for $orderby.
|
|
201
181
|
* @param opts OrderBy<T> value or builder function for OrderByExpression<T>
|
|
202
182
|
*/
|
|
203
|
-
orderBy(opts: (builder:
|
|
204
|
-
s: T;
|
|
205
|
-
e: () => OrderByExpression<T>;
|
|
206
|
-
}, current?: OrderByExpression<T>) => OrderByExpression<T>): OrderByExpression<T>;
|
|
183
|
+
orderBy(opts: (builder: OrderByExpressionBuilder<T>, current?: OrderByExpression<T>) => OrderByExpression<T>): OrderByExpression<T>;
|
|
207
184
|
orderBy(opts: OrderBy<T>): ODataQueryOptionHandler<T>;
|
|
208
185
|
orderBy(): ODataQueryOptionHandler<T>;
|
|
209
186
|
/**
|
|
@@ -5,7 +5,7 @@ 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,31 +15,19 @@ 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
|
|
@@ -20,6 +20,7 @@ export declare class ODataParameterParser<T> {
|
|
|
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;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { EnumTypeConfig, EnumTypeFieldConfig, ParserOptions, Parser } from '../../types';
|
|
2
2
|
import { ODataAnnotatable } from '../annotation';
|
|
3
|
-
export declare class ODataEnumTypeFieldParser extends ODataAnnotatable {
|
|
3
|
+
export declare class ODataEnumTypeFieldParser<E> extends ODataAnnotatable {
|
|
4
4
|
name: string;
|
|
5
|
-
value:
|
|
6
|
-
constructor(name: string, field: EnumTypeFieldConfig);
|
|
5
|
+
value: E;
|
|
6
|
+
constructor(name: string, field: EnumTypeFieldConfig<E>);
|
|
7
7
|
titleize(term?: string | RegExp): string;
|
|
8
8
|
}
|
|
9
|
-
export declare class ODataEnumTypeParser<
|
|
9
|
+
export declare class ODataEnumTypeParser<E> extends ODataAnnotatable implements Parser<E> {
|
|
10
10
|
name: string;
|
|
11
11
|
namespace: string;
|
|
12
12
|
alias?: string;
|
|
13
13
|
flags?: boolean;
|
|
14
14
|
members: {
|
|
15
|
-
[name: string]:
|
|
15
|
+
[name: string]: E;
|
|
16
16
|
} | {
|
|
17
17
|
[value: number]: string;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
private _fields;
|
|
20
20
|
stringAsEnum?: boolean;
|
|
21
21
|
parserOptions?: ParserOptions;
|
|
22
|
-
constructor(config: EnumTypeConfig<
|
|
22
|
+
constructor(config: EnumTypeConfig<E>, namespace: string, alias?: string);
|
|
23
23
|
/**
|
|
24
24
|
* Create a nicer looking title.
|
|
25
25
|
* Titleize is meant for creating pretty output.
|
|
@@ -32,9 +32,17 @@ export declare class ODataEnumTypeParser<T> extends ODataAnnotatable implements
|
|
|
32
32
|
options: ParserOptions;
|
|
33
33
|
}): void;
|
|
34
34
|
isTypeOf(type: string): boolean;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
fields(value?: E): ODataEnumTypeFieldParser<E>[];
|
|
36
|
+
field(nameValue: string | E): ODataEnumTypeFieldParser<E>;
|
|
37
|
+
/**
|
|
38
|
+
* Map the fields of the enum type.
|
|
39
|
+
* @param mapper Function that maps the value to the new value
|
|
40
|
+
* @returns The fields mapped by the mapper
|
|
41
|
+
*/
|
|
42
|
+
mapFields<R>(mapper: (field: ODataEnumTypeFieldParser<E>) => R): R[];
|
|
43
|
+
deserialize(value: string, options?: ParserOptions): E;
|
|
44
|
+
serialize(value: E, options?: ParserOptions): string | undefined;
|
|
45
|
+
encode(value: E, options?: ParserOptions): any;
|
|
38
46
|
toJsonSchema(): any;
|
|
39
47
|
validate(member: string | number, { method, navigation, }?: {
|
|
40
48
|
method?: 'create' | 'update' | 'modify';
|
|
@@ -73,6 +73,7 @@ export declare class ODataStructuredTypeFieldParser<T> extends ODataAnnotatable
|
|
|
73
73
|
enum(): ODataEnumTypeParser<T>;
|
|
74
74
|
isStructuredType(): boolean;
|
|
75
75
|
structured(): ODataStructuredTypeParser<T>;
|
|
76
|
+
field<F>(name: string): ODataStructuredTypeFieldParser<F>;
|
|
76
77
|
}
|
|
77
78
|
export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable implements Parser<T> {
|
|
78
79
|
name: string;
|
|
@@ -82,8 +83,8 @@ export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable imple
|
|
|
82
83
|
alias?: string;
|
|
83
84
|
base?: string;
|
|
84
85
|
parent?: ODataStructuredTypeParser<any>;
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
private _keys?;
|
|
87
|
+
private _fields;
|
|
87
88
|
parserOptions?: ParserOptions;
|
|
88
89
|
constructor(config: StructuredTypeConfig<T>, namespace: string, alias?: string);
|
|
89
90
|
/**
|
|
@@ -104,7 +105,50 @@ export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable imple
|
|
|
104
105
|
parserForType: (type: string) => Parser<any>;
|
|
105
106
|
options: ParserOptions;
|
|
106
107
|
}): void;
|
|
107
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Returns all fields of the structured type.
|
|
110
|
+
* @param include_navigation Include navigation properties in the result.
|
|
111
|
+
* @param include_parents Include the parent types in the result.
|
|
112
|
+
* @returns All fields of the structured type.
|
|
113
|
+
*/
|
|
114
|
+
fields({ include_navigation, include_parents, }: {
|
|
115
|
+
include_parents: boolean;
|
|
116
|
+
include_navigation: boolean;
|
|
117
|
+
}): ODataStructuredTypeFieldParser<any>[];
|
|
118
|
+
/**
|
|
119
|
+
* Returns the keys of the structured type.
|
|
120
|
+
* @param include_parents Include the parent fields
|
|
121
|
+
* @returns The keys of the structured type
|
|
122
|
+
*/
|
|
123
|
+
keys({ include_parents, }: {
|
|
124
|
+
include_parents: boolean;
|
|
125
|
+
}): ODataEntityTypeKey[];
|
|
126
|
+
/**
|
|
127
|
+
* Find the field parser for the given field name.
|
|
128
|
+
* @param name Name of the field
|
|
129
|
+
* @returns The field parser
|
|
130
|
+
*/
|
|
131
|
+
field<F>(name: keyof T): ODataStructuredTypeFieldParser<F>;
|
|
132
|
+
/**
|
|
133
|
+
* Picks the fields from attributes.
|
|
134
|
+
* @param attrs
|
|
135
|
+
* @param include_parents Include the parent fields
|
|
136
|
+
* @param include_navigation Include the navigation fields
|
|
137
|
+
* @param include_etag Include the etag field
|
|
138
|
+
* @returns The picked fields
|
|
139
|
+
*/
|
|
140
|
+
pick(attrs: {
|
|
141
|
+
[name: string]: any;
|
|
142
|
+
}, { include_parents, include_navigation, include_etag, options, }?: {
|
|
143
|
+
include_parents?: boolean;
|
|
144
|
+
include_navigation?: boolean;
|
|
145
|
+
include_etag?: boolean;
|
|
146
|
+
options?: ParserOptions;
|
|
147
|
+
}): Partial<T>;
|
|
148
|
+
resolveKey(value: any, { resolve, single, }?: {
|
|
149
|
+
resolve?: boolean;
|
|
150
|
+
single?: boolean;
|
|
151
|
+
}): any;
|
|
108
152
|
defaults(): {
|
|
109
153
|
[name: string]: any;
|
|
110
154
|
};
|
|
@@ -44,7 +44,7 @@ export declare class ODataStructuredType<T> extends ODataSchemaElement {
|
|
|
44
44
|
* @param name Name of the field
|
|
45
45
|
* @returns The field parser
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
field<F>(name: keyof T): ODataStructuredTypeFieldParser<F>;
|
|
48
48
|
/**
|
|
49
49
|
* Find a parent schema of the structured type.
|
|
50
50
|
* @param predicate Function for evaluate the schemas in the hierarchy.
|
|
@@ -57,24 +57,6 @@ export declare class ODataStructuredType<T> extends ODataSchemaElement {
|
|
|
57
57
|
* @returns The schema of the field
|
|
58
58
|
*/
|
|
59
59
|
findSchemaForField<E>(field: ODataStructuredTypeFieldParser<any>): ODataStructuredType<E>;
|
|
60
|
-
/**
|
|
61
|
-
* Returns all fields of the structured type.
|
|
62
|
-
* @param include_navigation Include navigation properties in the result.
|
|
63
|
-
* @param include_parents Include the parent types in the result.
|
|
64
|
-
* @returns All fields of the structured type.
|
|
65
|
-
*/
|
|
66
|
-
fields({ include_navigation, include_parents, }: {
|
|
67
|
-
include_parents: boolean;
|
|
68
|
-
include_navigation: boolean;
|
|
69
|
-
}): ODataStructuredTypeFieldParser<any>[];
|
|
70
|
-
/**
|
|
71
|
-
* Returns the keys of the structured type.
|
|
72
|
-
* @param include_parents Include the parent fields
|
|
73
|
-
* @returns The keys of the structured type
|
|
74
|
-
*/
|
|
75
|
-
keys({ include_parents, }?: {
|
|
76
|
-
include_parents?: boolean;
|
|
77
|
-
}): ODataEntityTypeKey[];
|
|
78
60
|
/**
|
|
79
61
|
* Picks the fields from attributes.
|
|
80
62
|
* @param attrs
|
|
@@ -111,6 +93,24 @@ export declare class ODataStructuredType<T> extends ODataSchemaElement {
|
|
|
111
93
|
* @returns Encoded value
|
|
112
94
|
*/
|
|
113
95
|
encode(value: T, options?: ParserOptions): any;
|
|
96
|
+
/**
|
|
97
|
+
* Returns all fields of the structured type.
|
|
98
|
+
* @param include_navigation Include navigation properties in the result.
|
|
99
|
+
* @param include_parents Include the parent types in the result.
|
|
100
|
+
* @returns All fields of the structured type.
|
|
101
|
+
*/
|
|
102
|
+
fields({ include_navigation, include_parents, }: {
|
|
103
|
+
include_parents: boolean;
|
|
104
|
+
include_navigation: boolean;
|
|
105
|
+
}): ODataStructuredTypeFieldParser<any>[];
|
|
106
|
+
/**
|
|
107
|
+
* Returns the keys of the structured type.
|
|
108
|
+
* @param include_parents Include the parent fields
|
|
109
|
+
* @returns The keys of the structured type
|
|
110
|
+
*/
|
|
111
|
+
keys({ include_parents, }?: {
|
|
112
|
+
include_parents?: boolean;
|
|
113
|
+
}): ODataEntityTypeKey[];
|
|
114
114
|
/**
|
|
115
115
|
* Resolve the key of the structured type for the given value.
|
|
116
116
|
* @param attrs Attributes of the value
|