angular-odata 0.99.2 → 0.100.1
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 +2 -2
- package/esm2020/lib/client.mjs +3 -3
- package/esm2020/lib/helper.mjs +91 -86
- package/esm2020/lib/models/collection.mjs +35 -46
- package/esm2020/lib/models/model.mjs +36 -40
- package/esm2020/lib/models/options.mjs +53 -36
- package/esm2020/lib/module.mjs +4 -4
- package/esm2020/lib/options.mjs +4 -3
- package/esm2020/lib/resources/query/builder.mjs +5 -7
- package/esm2020/lib/resources/query/expressions/base.mjs +1 -1
- package/esm2020/lib/resources/query/expressions/compute.mjs +13 -6
- package/esm2020/lib/resources/query/expressions/expand.mjs +77 -13
- package/esm2020/lib/resources/query/expressions/filter.mjs +11 -5
- package/esm2020/lib/resources/query/expressions/orderby.mjs +11 -3
- package/esm2020/lib/resources/query/expressions/search.mjs +15 -3
- package/esm2020/lib/resources/query/expressions/select.mjs +10 -5
- package/esm2020/lib/resources/query/expressions/syntax.mjs +42 -9
- package/esm2020/lib/resources/query/handlers.mjs +41 -30
- package/esm2020/lib/resources/query/options.mjs +47 -44
- package/esm2020/lib/resources/resource.mjs +22 -61
- package/esm2020/lib/resources/responses/annotations.mjs +6 -6
- package/esm2020/lib/resources/responses/options.mjs +1 -2
- package/esm2020/lib/resources/responses/response.mjs +3 -3
- package/esm2020/lib/resources/types/entity-set.mjs +1 -1
- package/esm2020/lib/resources/types/entity.mjs +3 -3
- package/esm2020/lib/resources/types/function.mjs +9 -1
- package/esm2020/lib/schema/callable.mjs +6 -2
- package/esm2020/lib/schema/enum-type.mjs +10 -2
- package/esm2020/lib/schema/parsers/callable.mjs +3 -2
- package/esm2020/lib/schema/parsers/enum-type.mjs +6 -5
- package/esm2020/lib/schema/parsers/structured-type.mjs +5 -5
- package/esm2020/lib/schema/structured-type.mjs +4 -9
- package/esm2020/lib/services/entity-set.mjs +6 -6
- package/esm2020/lib/services/factory.mjs +3 -3
- package/esm2020/lib/types.mjs +2 -1
- package/esm2020/lib/utils/objects.mjs +5 -1
- package/esm2020/lib/utils/urls.mjs +2 -2
- package/fesm2015/angular-odata.mjs +642 -498
- package/fesm2015/angular-odata.mjs.map +1 -1
- package/fesm2020/angular-odata.mjs +642 -502
- package/fesm2020/angular-odata.mjs.map +1 -1
- package/lib/helper.d.ts +28 -57
- package/lib/models/collection.d.ts +4 -2
- package/lib/models/model.d.ts +3 -9
- package/lib/models/options.d.ts +13 -11
- package/lib/options.d.ts +4 -4
- package/lib/resources/query/builder.d.ts +2 -1
- package/lib/resources/query/expressions/base.d.ts +1 -0
- package/lib/resources/query/expressions/compute.d.ts +3 -2
- package/lib/resources/query/expressions/expand.d.ts +40 -12
- package/lib/resources/query/expressions/filter.d.ts +22 -21
- package/lib/resources/query/expressions/orderby.d.ts +4 -2
- package/lib/resources/query/expressions/search.d.ts +5 -2
- package/lib/resources/query/expressions/select.d.ts +3 -2
- package/lib/resources/query/expressions/syntax.d.ts +12 -2
- package/lib/resources/query/handlers.d.ts +19 -15
- package/lib/resources/query/options.d.ts +15 -15
- package/lib/resources/resource.d.ts +1 -0
- package/lib/resources/responses/annotations.d.ts +12 -18
- package/lib/resources/responses/options.d.ts +2 -3
- package/lib/resources/responses/response.d.ts +1 -3
- package/lib/resources/types/entity-set.d.ts +1 -1
- package/lib/resources/types/function.d.ts +3 -0
- package/lib/schema/callable.d.ts +4 -4
- package/lib/schema/enum-type.d.ts +10 -4
- package/lib/schema/parsers/callable.d.ts +9 -7
- package/lib/schema/parsers/enum-type.d.ts +7 -5
- package/lib/schema/parsers/structured-type.d.ts +7 -7
- package/lib/schema/structured-type.d.ts +4 -4
- package/lib/types.d.ts +6 -5
- package/package.json +3 -3
|
@@ -7,9 +7,7 @@ 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
|
-
[name: string]: any;
|
|
12
|
-
}, n: QueryOptionNames);
|
|
10
|
+
constructor(o: Map<QueryOptionNames, any>, n: QueryOptionNames);
|
|
13
11
|
get name(): QueryOptionNames;
|
|
14
12
|
toJSON(): any;
|
|
15
13
|
empty(): boolean;
|
|
@@ -39,27 +37,33 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
39
37
|
* @returns The alias
|
|
40
38
|
*/
|
|
41
39
|
alias(value: any, name?: string): import("./builder").QueryCustomType;
|
|
42
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Normalize the given value to a valid odata value
|
|
42
|
+
* @param value The value to normalize
|
|
43
|
+
* @returns The normalized value
|
|
44
|
+
*/
|
|
45
|
+
normalize(value: any): any;
|
|
46
|
+
select(opts: (builder: {
|
|
43
47
|
s: T;
|
|
44
48
|
e: () => SelectExpression<T>;
|
|
45
|
-
}) => SelectExpression<T>): SelectExpression<T>;
|
|
49
|
+
}, current?: SelectExpression<T>) => SelectExpression<T>): SelectExpression<T>;
|
|
46
50
|
select(opts: Select<T>): ODataQueryOptionHandler<T>;
|
|
47
51
|
select(): ODataQueryOptionHandler<T>;
|
|
48
|
-
expand(opts: (
|
|
52
|
+
expand(opts: (builder: {
|
|
49
53
|
s: T;
|
|
50
54
|
e: () => ExpandExpression<T>;
|
|
51
|
-
}) => ExpandExpression<T>): ExpandExpression<T>;
|
|
55
|
+
}, current?: ExpandExpression<T>) => ExpandExpression<T>): ExpandExpression<T>;
|
|
52
56
|
expand(opts: Expand<T>): ODataQueryOptionHandler<T>;
|
|
53
57
|
expand(): ODataQueryOptionHandler<T>;
|
|
54
58
|
/**
|
|
55
59
|
* @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptioncompute
|
|
56
60
|
*/
|
|
57
|
-
compute(opts: (
|
|
61
|
+
compute(opts: (builder: {
|
|
58
62
|
s: T;
|
|
59
63
|
e: () => ComputeExpression<T>;
|
|
60
64
|
o: ODataOperators<T>;
|
|
61
65
|
f: ODataFunctions<T>;
|
|
62
|
-
}) => ComputeExpression<T>): ComputeExpression<T>;
|
|
66
|
+
}, current?: ComputeExpression<T>) => ComputeExpression<T>): ComputeExpression<T>;
|
|
63
67
|
compute(opts: string): ODataQueryOptionHandler<T>;
|
|
64
68
|
compute(): ODataQueryOptionHandler<T>;
|
|
65
69
|
/**
|
|
@@ -69,23 +73,23 @@ export declare class ODataQueryOptionsHandler<T> {
|
|
|
69
73
|
format(): ODataQueryOptionHandler<T>;
|
|
70
74
|
transform(opts: Transform<T>): ODataQueryOptionHandler<T>;
|
|
71
75
|
transform(): ODataQueryOptionHandler<T>;
|
|
72
|
-
search(opts: (
|
|
76
|
+
search(opts: (builder: {
|
|
73
77
|
e: (connector: SearchConnector) => SearchExpression<T>;
|
|
74
|
-
}) => SearchExpression<T>): SearchExpression<T>;
|
|
78
|
+
}, current?: SearchExpression<T>) => SearchExpression<T>): SearchExpression<T>;
|
|
75
79
|
search(opts: string): ODataQueryOptionHandler<T>;
|
|
76
80
|
search(): ODataQueryOptionHandler<T>;
|
|
77
|
-
filter(opts: (
|
|
81
|
+
filter(opts: (builder: {
|
|
78
82
|
s: T;
|
|
79
83
|
e: (connector?: FilterConnector) => FilterExpression<T>;
|
|
80
84
|
o: ODataOperators<T>;
|
|
81
85
|
f: ODataFunctions<T>;
|
|
82
|
-
}) => FilterExpression<T>): FilterExpression<T>;
|
|
86
|
+
}, current?: FilterExpression<T>) => FilterExpression<T>): FilterExpression<T>;
|
|
83
87
|
filter(opts: Filter<T>): ODataQueryOptionHandler<T>;
|
|
84
88
|
filter(): ODataQueryOptionHandler<T>;
|
|
85
|
-
orderBy(opts: (
|
|
89
|
+
orderBy(opts: (builder: {
|
|
86
90
|
s: T;
|
|
87
91
|
e: () => OrderByExpression<T>;
|
|
88
|
-
}) => OrderByExpression<T>): OrderByExpression<T>;
|
|
92
|
+
}, current?: OrderByExpression<T>) => OrderByExpression<T>): OrderByExpression<T>;
|
|
89
93
|
orderBy(opts: OrderBy<T>): ODataQueryOptionHandler<T>;
|
|
90
94
|
orderBy(): ODataQueryOptionHandler<T>;
|
|
91
95
|
top(opts: number): ODataQueryOptionHandler<T>;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { QueryOptionNames } from '../../types';
|
|
2
2
|
import { Expand, Filter, OrderBy, Select, Transform } from './builder';
|
|
3
|
-
import { Expression } from './expressions';
|
|
3
|
+
import { Expression, FilterExpression, OrderByExpression, SearchExpression } from './expressions';
|
|
4
|
+
import { ExpandExpression } from './expressions/expand';
|
|
5
|
+
import { SelectExpression } from './expressions/select';
|
|
4
6
|
import { ODataQueryOptionHandler } from './handlers';
|
|
5
7
|
export declare type ODataQueryArguments<T> = {
|
|
6
|
-
[QueryOptionNames.select]?: Select<T>;
|
|
7
|
-
[QueryOptionNames.filter]?: Filter<T>;
|
|
8
|
-
[QueryOptionNames.search]?: string
|
|
8
|
+
[QueryOptionNames.select]?: Select<T> | SelectExpression<T>;
|
|
9
|
+
[QueryOptionNames.filter]?: Filter<T> | FilterExpression<T>;
|
|
10
|
+
[QueryOptionNames.search]?: string | SearchExpression<T>;
|
|
9
11
|
[QueryOptionNames.compute]?: string;
|
|
10
12
|
[QueryOptionNames.transform]?: Transform<T>;
|
|
11
|
-
[QueryOptionNames.orderBy]?: OrderBy<T>;
|
|
13
|
+
[QueryOptionNames.orderBy]?: OrderBy<T> | OrderByExpression<T>;
|
|
12
14
|
[QueryOptionNames.top]?: number;
|
|
13
15
|
[QueryOptionNames.skip]?: number;
|
|
14
16
|
[QueryOptionNames.skiptoken]?: string;
|
|
15
|
-
[QueryOptionNames.expand]?: Expand<T>;
|
|
17
|
+
[QueryOptionNames.expand]?: Expand<T> | ExpandExpression<T>;
|
|
16
18
|
[QueryOptionNames.format]?: string;
|
|
17
19
|
};
|
|
18
20
|
export declare class ODataQueryOptions<T> {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
constructor(options?: {
|
|
21
|
+
values: Map<QueryOptionNames, any>;
|
|
22
|
+
constructor(values?: Map<QueryOptionNames, any> | {
|
|
23
23
|
[name: string]: any;
|
|
24
24
|
});
|
|
25
25
|
pathAndParams(escape?: boolean): [string, {
|
|
@@ -29,10 +29,10 @@ export declare class ODataQueryOptions<T> {
|
|
|
29
29
|
toJSON(): {};
|
|
30
30
|
toQueryArguments(): ODataQueryArguments<T>;
|
|
31
31
|
clone<O>(): ODataQueryOptions<O>;
|
|
32
|
-
expression(
|
|
33
|
-
option<O>(
|
|
34
|
-
has(
|
|
35
|
-
remove(...
|
|
36
|
-
keep(...
|
|
32
|
+
expression(key: QueryOptionNames, exp?: Expression<T>): any;
|
|
33
|
+
option<O>(key: QueryOptionNames, opts?: O): ODataQueryOptionHandler<O>;
|
|
34
|
+
has(key: QueryOptionNames): boolean;
|
|
35
|
+
remove(...keys: QueryOptionNames[]): void;
|
|
36
|
+
keep(...keys: QueryOptionNames[]): void;
|
|
37
37
|
clear(): void;
|
|
38
38
|
}
|
|
@@ -59,6 +59,7 @@ export declare class ODataResource<T> {
|
|
|
59
59
|
endpointUrl(params?: boolean): string;
|
|
60
60
|
toString(): string;
|
|
61
61
|
clone(): ODataResource<T>;
|
|
62
|
+
private __parser;
|
|
62
63
|
deserialize(value: any, options?: OptionsHelper): any;
|
|
63
64
|
serialize(value: any, options?: OptionsHelper): any;
|
|
64
65
|
encode(value: any, options?: OptionsHelper): any;
|
|
@@ -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,14 +1,13 @@
|
|
|
1
|
-
import { ODataMetadataType, ODataVersion,
|
|
1
|
+
import { ODataMetadataType, ODataVersion, OptionsHelper, ResponseOptions } from '../../types';
|
|
2
2
|
export declare class ODataResponseOptions implements ResponseOptions {
|
|
3
3
|
version: ODataVersion;
|
|
4
4
|
streaming?: boolean;
|
|
5
5
|
metadata?: ODataMetadataType;
|
|
6
|
-
stringAsEnum?: boolean;
|
|
7
6
|
ieee754Compatible?: boolean;
|
|
8
7
|
location?: string;
|
|
9
8
|
cacheability?: 'public' | 'private' | 'no-cache' | 'no-store';
|
|
10
9
|
maxAge?: number;
|
|
11
|
-
constructor(config:
|
|
10
|
+
constructor(config: OptionsHelper);
|
|
12
11
|
get helper(): import("../../helper").ODataVersionHelper;
|
|
13
12
|
clone(): ODataResponseOptions;
|
|
14
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
|
|
@@ -40,7 +40,7 @@ export declare class ODataEntitySetResource<T> extends ODataResource<T> {
|
|
|
40
40
|
fetchCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(options?: ODataOptions & {
|
|
41
41
|
withCount?: boolean;
|
|
42
42
|
bodyQueryOptions?: QueryOptionNames[];
|
|
43
|
-
}): Observable<
|
|
43
|
+
}): Observable<C | null>;
|
|
44
44
|
fetchAll(options?: ODataOptions & {
|
|
45
45
|
bodyQueryOptions?: QueryOptionNames[];
|
|
46
46
|
}): Observable<T[]>;
|
|
@@ -18,6 +18,9 @@ export declare class ODataFunctionResource<P, R> extends ODataResource<R> {
|
|
|
18
18
|
static fromResource<P, R>(resource: ODataResource<any>, path: string): ODataFunctionResource<P, R>;
|
|
19
19
|
clone(): ODataFunctionResource<P, R>;
|
|
20
20
|
returnType(): string | undefined;
|
|
21
|
+
pathAndParams(escape?: boolean): [string, {
|
|
22
|
+
[name: string]: any;
|
|
23
|
+
}];
|
|
21
24
|
parameters(params: P | null, { alias }?: {
|
|
22
25
|
alias?: boolean;
|
|
23
26
|
}): ODataFunctionResource<P, R>;
|
package/lib/schema/callable.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallableConfig,
|
|
1
|
+
import { CallableConfig, OptionsHelper, 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?: OptionsHelper): 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?: OptionsHelper): 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?: OptionsHelper): 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, OptionsHelper } from '../types';
|
|
2
2
|
import { ODataSchemaElement } from './element';
|
|
3
3
|
import { ODataEnumTypeFieldParser, ODataEnumTypeParser } from './parsers';
|
|
4
4
|
import { ODataSchema } from './schema';
|
|
@@ -28,6 +28,12 @@ export declare class ODataEnumType<E> extends ODataSchemaElement {
|
|
|
28
28
|
* @returns The field with the given value
|
|
29
29
|
*/
|
|
30
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[];
|
|
31
37
|
/**
|
|
32
38
|
* Map the fields of the enum type.
|
|
33
39
|
* @param mapper Function that maps the value to the new value
|
|
@@ -40,19 +46,19 @@ export declare class ODataEnumType<E> extends ODataSchemaElement {
|
|
|
40
46
|
* @param options Options for deserialization
|
|
41
47
|
* @returns Deserialized value
|
|
42
48
|
*/
|
|
43
|
-
deserialize(value: any, options?:
|
|
49
|
+
deserialize(value: any, options?: OptionsHelper): E;
|
|
44
50
|
/**
|
|
45
51
|
* Serialize the given value for the enum type.
|
|
46
52
|
* @param value Value to serialize
|
|
47
53
|
* @param options Options for serialization
|
|
48
54
|
* @returns Serialized value
|
|
49
55
|
*/
|
|
50
|
-
serialize(value: E, options?:
|
|
56
|
+
serialize(value: E, options?: OptionsHelper): any;
|
|
51
57
|
/**
|
|
52
58
|
* Encode the given value for the enum type.
|
|
53
59
|
* @param value Value to encode
|
|
54
60
|
* @param options Options for encoding
|
|
55
61
|
* @returns Encoded value
|
|
56
62
|
*/
|
|
57
|
-
encode(value: E, options?:
|
|
63
|
+
encode(value: E, options?: OptionsHelper): any;
|
|
58
64
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallableConfig,
|
|
1
|
+
import { CallableConfig, OptionsHelper, 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> {
|
|
@@ -9,8 +9,8 @@ export declare class ODataParameterParser<T> {
|
|
|
9
9
|
nullable?: boolean;
|
|
10
10
|
optionsHelper?: OptionsHelper;
|
|
11
11
|
constructor(name: string, parameter: Parameter);
|
|
12
|
-
serialize(value: T, options?:
|
|
13
|
-
encode(value: any, options?:
|
|
12
|
+
serialize(value: T, options?: OptionsHelper): any;
|
|
13
|
+
encode(value: any, options?: OptionsHelper): string;
|
|
14
14
|
configure({ parserForType, options, }: {
|
|
15
15
|
parserForType: (type: string) => Parser<any>;
|
|
16
16
|
options: OptionsHelper;
|
|
@@ -31,13 +31,15 @@ export declare class ODataCallableParser<R> implements Parser<R> {
|
|
|
31
31
|
};
|
|
32
32
|
parser: Parser<any>;
|
|
33
33
|
parameters: ODataParameterParser<any>[];
|
|
34
|
+
nonParenthesisForEmptyParameterFunction?: boolean;
|
|
34
35
|
optionsHelper?: OptionsHelper;
|
|
35
36
|
constructor(config: CallableConfig, namespace: string, alias?: string);
|
|
36
37
|
isTypeOf(type: string): boolean;
|
|
37
|
-
deserialize(value: any, options?:
|
|
38
|
-
serialize(params: any, options?:
|
|
39
|
-
encode(params: any, options?:
|
|
40
|
-
configure({ parserForType, options, }: {
|
|
38
|
+
deserialize(value: any, options?: OptionsHelper): R;
|
|
39
|
+
serialize(params: any, options?: OptionsHelper): any;
|
|
40
|
+
encode(params: any, options?: OptionsHelper): any;
|
|
41
|
+
configure({ nonParenthesisForEmptyParameterFunction, parserForType, options, }: {
|
|
42
|
+
nonParenthesisForEmptyParameterFunction: boolean;
|
|
41
43
|
parserForType: (type: string) => Parser<any>;
|
|
42
44
|
options: OptionsHelper;
|
|
43
45
|
}): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnumTypeConfig, EnumTypeFieldConfig,
|
|
1
|
+
import { EnumTypeConfig, EnumTypeFieldConfig, OptionsHelper, Parser } from '../../types';
|
|
2
2
|
import { ODataAnnotatable } from '../annotation';
|
|
3
3
|
export declare class ODataEnumTypeFieldParser extends ODataAnnotatable {
|
|
4
4
|
name: string;
|
|
@@ -17,6 +17,7 @@ export declare class ODataEnumTypeParser<T> extends ODataAnnotatable implements
|
|
|
17
17
|
[value: number]: string;
|
|
18
18
|
};
|
|
19
19
|
fields: ODataEnumTypeFieldParser[];
|
|
20
|
+
stringAsEnum?: boolean;
|
|
20
21
|
optionsHelper?: OptionsHelper;
|
|
21
22
|
constructor(config: EnumTypeConfig<T>, namespace: string, alias?: string);
|
|
22
23
|
/**
|
|
@@ -26,13 +27,14 @@ export declare class ODataEnumTypeParser<T> extends ODataAnnotatable implements
|
|
|
26
27
|
* @returns The titleized string.
|
|
27
28
|
*/
|
|
28
29
|
ttitelize(term?: string | RegExp): string;
|
|
29
|
-
configure({ options }: {
|
|
30
|
+
configure({ stringAsEnum, options }: {
|
|
31
|
+
stringAsEnum: boolean;
|
|
30
32
|
options: OptionsHelper;
|
|
31
33
|
}): void;
|
|
32
34
|
isTypeOf(type: string): boolean;
|
|
33
|
-
deserialize(value: string, options?:
|
|
34
|
-
serialize(value: T, options?:
|
|
35
|
-
encode(value: T, options?:
|
|
35
|
+
deserialize(value: string, options?: OptionsHelper): T;
|
|
36
|
+
serialize(value: T, options?: OptionsHelper): string;
|
|
37
|
+
encode(value: T, options?: OptionsHelper): any;
|
|
36
38
|
toJsonSchema(): any;
|
|
37
39
|
validate(member: string | number, { method, navigation, }?: {
|
|
38
40
|
method?: 'create' | 'update' | 'modify';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OptionsHelper, Parser, StructuredTypeConfig, StructuredTypeFieldConfig } from '../../types';
|
|
2
2
|
import { ODataAnnotatable } from '../annotation';
|
|
3
3
|
import { ODataEnumTypeParser } from './enum-type';
|
|
4
4
|
declare type JsonSchemaSelect<T> = Array<keyof T>;
|
|
@@ -57,10 +57,10 @@ export declare class ODataStructuredTypeFieldParser<T> extends ODataAnnotatable
|
|
|
57
57
|
[name: string]: any;
|
|
58
58
|
}[] | string[] | undefined;
|
|
59
59
|
private parse;
|
|
60
|
-
deserialize(value: any, options?:
|
|
60
|
+
deserialize(value: any, options?: OptionsHelper): T;
|
|
61
61
|
private toJson;
|
|
62
|
-
serialize(value: T, options?:
|
|
63
|
-
encode(value: T, options?:
|
|
62
|
+
serialize(value: T, options?: OptionsHelper): any;
|
|
63
|
+
encode(value: T, options?: OptionsHelper): string;
|
|
64
64
|
configure({ parserForType, options, }: {
|
|
65
65
|
parserForType: (type: string) => Parser<any>;
|
|
66
66
|
options: OptionsHelper;
|
|
@@ -97,9 +97,9 @@ export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable imple
|
|
|
97
97
|
isSubtypeOf(type: string): boolean;
|
|
98
98
|
findChildParser(predicate: (p: ODataStructuredTypeParser<any>) => boolean): ODataStructuredTypeParser<any> | undefined;
|
|
99
99
|
childParser(predicate: (p: ODataStructuredTypeParser<any>) => boolean): Parser<any>;
|
|
100
|
-
deserialize(value: any, options?:
|
|
101
|
-
serialize(value: T, options?:
|
|
102
|
-
encode(value: T, options?:
|
|
100
|
+
deserialize(value: any, options?: OptionsHelper): T;
|
|
101
|
+
serialize(value: T, options?: OptionsHelper): any;
|
|
102
|
+
encode(value: T, options?: OptionsHelper): any;
|
|
103
103
|
configure({ parserForType, options, }: {
|
|
104
104
|
parserForType: (type: string) => Parser<any>;
|
|
105
105
|
options: OptionsHelper;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ODataCollection } from '../models';
|
|
2
2
|
import { ODataModel } from '../models/model';
|
|
3
|
-
import {
|
|
3
|
+
import { OptionsHelper, StructuredTypeConfig } from '../types';
|
|
4
4
|
import { ODataSchemaElement } from './element';
|
|
5
5
|
import { JsonSchemaOptions, ODataEntityTypeKey, ODataStructuredTypeFieldParser, ODataStructuredTypeParser } from './parsers';
|
|
6
6
|
import { ODataSchema } from './schema';
|
|
@@ -96,21 +96,21 @@ export declare class ODataStructuredType<T> extends ODataSchemaElement {
|
|
|
96
96
|
* @param options Options for deserialization
|
|
97
97
|
* @returns Deserialized value
|
|
98
98
|
*/
|
|
99
|
-
deserialize(value: any, options?:
|
|
99
|
+
deserialize(value: any, options?: OptionsHelper): T;
|
|
100
100
|
/**
|
|
101
101
|
* Serialize the given value for the structured type.
|
|
102
102
|
* @param value Value to serialize
|
|
103
103
|
* @param options Options for serialization
|
|
104
104
|
* @returns Serialized value
|
|
105
105
|
*/
|
|
106
|
-
serialize(value: T, options?:
|
|
106
|
+
serialize(value: T, options?: OptionsHelper): any;
|
|
107
107
|
/**
|
|
108
108
|
* Encode the given value for the structured type.
|
|
109
109
|
* @param value Value to encode
|
|
110
110
|
* @param options Options for encoding
|
|
111
111
|
* @returns Encoded value
|
|
112
112
|
*/
|
|
113
|
-
encode(value: T, options?:
|
|
113
|
+
encode(value: T, options?: OptionsHelper): any;
|
|
114
114
|
/**
|
|
115
115
|
* Resolve the key of the structured type for the given value.
|
|
116
116
|
* @param attrs Attributes of the value
|
package/lib/types.d.ts
CHANGED
|
@@ -30,13 +30,11 @@ export declare enum QueryOptionNames {
|
|
|
30
30
|
skip = "skip",
|
|
31
31
|
skiptoken = "skiptoken",
|
|
32
32
|
format = "format",
|
|
33
|
+
levels = "levels",
|
|
33
34
|
count = "count"
|
|
34
35
|
}
|
|
35
|
-
export interface
|
|
36
|
+
export interface ApiOptions {
|
|
36
37
|
version?: ODataVersion;
|
|
37
|
-
stringAsEnum?: boolean;
|
|
38
|
-
}
|
|
39
|
-
export interface ApiOptions extends Options {
|
|
40
38
|
params?: {
|
|
41
39
|
[param: string]: string | string[];
|
|
42
40
|
};
|
|
@@ -63,9 +61,12 @@ export interface ApiOptions extends Options {
|
|
|
63
61
|
stripMetadata?: ODataMetadataType;
|
|
64
62
|
fetchPolicy?: FetchPolicy;
|
|
65
63
|
bodyQueryOptions?: QueryOptionNames[];
|
|
64
|
+
stringAsEnum?: boolean;
|
|
66
65
|
deleteRefBy?: 'path' | 'id';
|
|
66
|
+
nonParenthesisForEmptyParameterFunction?: boolean;
|
|
67
67
|
}
|
|
68
|
-
export interface OptionsHelper
|
|
68
|
+
export interface OptionsHelper {
|
|
69
|
+
version?: ODataVersion;
|
|
69
70
|
helper: ODataVersionHelper;
|
|
70
71
|
exponentialDecimals?: boolean;
|
|
71
72
|
metadata?: ODataMetadataType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angular-odata",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.100.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Client side OData typescript library for Angular",
|
|
6
6
|
"repository": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"homepage": "https://github.com/diegomvh/angular-odata",
|
|
26
26
|
"private": false,
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@angular/common": "^13.
|
|
29
|
-
"@angular/core": "^13.
|
|
28
|
+
"@angular/common": "^13.3.0",
|
|
29
|
+
"@angular/core": "^13.3.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"tslib": "^2.3.0"
|