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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnumTypeConfig, EnumTypeFieldConfig,
|
|
1
|
+
import { EnumTypeConfig, EnumTypeFieldConfig, ParserOptions, Parser } from '../../types';
|
|
2
2
|
import { ODataAnnotatable } from '../annotation';
|
|
3
3
|
export declare class ODataEnumTypeFieldParser extends ODataAnnotatable {
|
|
4
4
|
name: string;
|
|
@@ -18,7 +18,7 @@ export declare class ODataEnumTypeParser<T> extends ODataAnnotatable implements
|
|
|
18
18
|
};
|
|
19
19
|
fields: ODataEnumTypeFieldParser[];
|
|
20
20
|
stringAsEnum?: boolean;
|
|
21
|
-
|
|
21
|
+
parserOptions?: ParserOptions;
|
|
22
22
|
constructor(config: EnumTypeConfig<T>, namespace: string, alias?: string);
|
|
23
23
|
/**
|
|
24
24
|
* Create a nicer looking title.
|
|
@@ -27,14 +27,14 @@ export declare class ODataEnumTypeParser<T> extends ODataAnnotatable implements
|
|
|
27
27
|
* @returns The titleized string.
|
|
28
28
|
*/
|
|
29
29
|
ttitelize(term?: string | RegExp): string;
|
|
30
|
-
configure({ stringAsEnum, options }: {
|
|
30
|
+
configure({ stringAsEnum, options, }: {
|
|
31
31
|
stringAsEnum: boolean;
|
|
32
|
-
options:
|
|
32
|
+
options: ParserOptions;
|
|
33
33
|
}): void;
|
|
34
34
|
isTypeOf(type: string): boolean;
|
|
35
|
-
deserialize(value: string, options?:
|
|
36
|
-
serialize(value: T, options?:
|
|
37
|
-
encode(value: T, options?:
|
|
35
|
+
deserialize(value: string, options?: ParserOptions): T;
|
|
36
|
+
serialize(value: T, options?: ParserOptions): string | undefined;
|
|
37
|
+
encode(value: T, options?: ParserOptions): any;
|
|
38
38
|
toJsonSchema(): any;
|
|
39
39
|
validate(member: string | number, { method, navigation, }?: {
|
|
40
40
|
method?: 'create' | 'update' | 'modify';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ParserOptions, 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>;
|
|
@@ -46,7 +46,7 @@ export declare class ODataStructuredTypeFieldParser<T> extends ODataAnnotatable
|
|
|
46
46
|
precision?: number;
|
|
47
47
|
scale?: number;
|
|
48
48
|
referentials: ODataReferential[];
|
|
49
|
-
|
|
49
|
+
parserOptions?: ParserOptions;
|
|
50
50
|
constructor(name: string, structuredType: ODataStructuredTypeParser<any>, field: StructuredTypeFieldConfig);
|
|
51
51
|
validate(value: any, { method, navigation, }?: {
|
|
52
52
|
method?: 'create' | 'update' | 'modify';
|
|
@@ -57,13 +57,13 @@ 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?: ParserOptions): T;
|
|
61
61
|
private toJson;
|
|
62
|
-
serialize(value: T, options?:
|
|
63
|
-
encode(value: T, options?:
|
|
62
|
+
serialize(value: T, options?: ParserOptions): any;
|
|
63
|
+
encode(value: T, options?: ParserOptions): string;
|
|
64
64
|
configure({ parserForType, options, }: {
|
|
65
65
|
parserForType: (type: string) => Parser<any>;
|
|
66
|
-
options:
|
|
66
|
+
options: ParserOptions;
|
|
67
67
|
}): void;
|
|
68
68
|
toJsonSchema(options?: JsonSchemaOptions<T>): any;
|
|
69
69
|
isKey(): boolean;
|
|
@@ -84,7 +84,7 @@ export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable imple
|
|
|
84
84
|
parent?: ODataStructuredTypeParser<any>;
|
|
85
85
|
keys?: ODataEntityTypeKey[];
|
|
86
86
|
fields: ODataStructuredTypeFieldParser<any>[];
|
|
87
|
-
|
|
87
|
+
parserOptions?: ParserOptions;
|
|
88
88
|
constructor(config: StructuredTypeConfig<T>, namespace: string, alias?: string);
|
|
89
89
|
/**
|
|
90
90
|
* Create a nicer looking title.
|
|
@@ -97,12 +97,12 @@ 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?: ParserOptions): T;
|
|
101
|
+
serialize(value: T, options?: ParserOptions): any;
|
|
102
|
+
encode(value: T, options?: ParserOptions): any;
|
|
103
103
|
configure({ parserForType, options, }: {
|
|
104
104
|
parserForType: (type: string) => Parser<any>;
|
|
105
|
-
options:
|
|
105
|
+
options: ParserOptions;
|
|
106
106
|
}): void;
|
|
107
107
|
resolveKey(value: any): any;
|
|
108
108
|
defaults(): {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ODataCollection } from '../models';
|
|
2
2
|
import { ODataModel } from '../models/model';
|
|
3
|
-
import {
|
|
3
|
+
import { ParserOptions, 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?: ParserOptions): 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?: ParserOptions): 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?: ParserOptions): 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/services/base.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { ODataClient } from '../client';
|
|
3
|
-
import { ODataActionResource, ODataEntities, ODataEntity, ODataFunctionResource, ODataNavigationPropertyResource, ODataProperty, ODataQueryArgumentsOptions } from '../resources';
|
|
3
|
+
import { ODataActionOptions, ODataActionResource, ODataEntities, ODataEntity, ODataFunctionOptions, ODataFunctionResource, ODataNavigationPropertyResource, ODataProperty, ODataQueryArgumentsOptions } from '../resources';
|
|
4
4
|
export declare abstract class ODataBaseService {
|
|
5
5
|
protected client: ODataClient;
|
|
6
6
|
protected name: string;
|
|
7
7
|
protected apiNameOrEntityType?: string | undefined;
|
|
8
8
|
constructor(client: ODataClient, name: string, apiNameOrEntityType?: string | undefined);
|
|
9
9
|
get api(): import("angular-odata").ODataApi;
|
|
10
|
-
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entity', options?:
|
|
11
|
-
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entities', options?:
|
|
12
|
-
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'property', options?:
|
|
13
|
-
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'none', options?:
|
|
14
|
-
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entity', options?:
|
|
15
|
-
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entities', options?:
|
|
16
|
-
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'property', options?:
|
|
17
|
-
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'none', options?:
|
|
10
|
+
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entity', options?: ODataFunctionOptions<R>): Observable<ODataEntity<R>>;
|
|
11
|
+
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entities', options?: ODataFunctionOptions<R>): Observable<ODataEntities<R>>;
|
|
12
|
+
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'property', options?: ODataFunctionOptions<R>): Observable<ODataProperty<R>>;
|
|
13
|
+
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'none', options?: ODataFunctionOptions<R>): Observable<null>;
|
|
14
|
+
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entity', options?: ODataActionOptions<R>): Observable<ODataEntity<R>>;
|
|
15
|
+
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entities', options?: ODataActionOptions<R>): Observable<ODataEntities<R>>;
|
|
16
|
+
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'property', options?: ODataActionOptions<R>): Observable<ODataProperty<R>>;
|
|
17
|
+
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'none', options?: ODataActionOptions<R>): Observable<null>;
|
|
18
18
|
protected fetchNavigationProperty<S>(resource: ODataNavigationPropertyResource<S>, responseType: 'entity', options?: ODataQueryArgumentsOptions<S>): Observable<ODataEntity<S>>;
|
|
19
19
|
protected fetchNavigationProperty<S>(resource: ODataNavigationPropertyResource<S>, responseType: 'entities', options?: ODataQueryArgumentsOptions<S>): Observable<ODataEntities<S>>;
|
|
20
20
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ODataVersionHelper } from './helper';
|
|
2
1
|
import { Observable } from 'rxjs';
|
|
3
2
|
export declare type ODataVersion = '2.0' | '3.0' | '4.0';
|
|
4
3
|
export declare type FetchPolicy = 'cache-first' | 'cache-and-network' | 'network-only' | 'no-cache' | 'cache-only';
|
|
@@ -65,25 +64,24 @@ export interface ApiOptions {
|
|
|
65
64
|
deleteRefBy?: 'path' | 'id';
|
|
66
65
|
nonParenthesisForEmptyParameterFunction?: boolean;
|
|
67
66
|
}
|
|
68
|
-
export interface
|
|
67
|
+
export interface ParserOptions {
|
|
69
68
|
version?: ODataVersion;
|
|
70
|
-
helper: ODataVersionHelper;
|
|
71
69
|
exponentialDecimals?: boolean;
|
|
72
70
|
metadata?: ODataMetadataType;
|
|
73
71
|
ieee754Compatible?: boolean;
|
|
74
72
|
streaming?: boolean;
|
|
75
73
|
}
|
|
76
|
-
export interface ResponseOptions extends
|
|
74
|
+
export interface ResponseOptions extends ParserOptions {
|
|
77
75
|
cacheability?: CacheCacheability;
|
|
78
76
|
maxAge?: number;
|
|
79
77
|
}
|
|
80
|
-
export interface StructuredTypeFieldOptions extends
|
|
78
|
+
export interface StructuredTypeFieldOptions extends ParserOptions {
|
|
81
79
|
field: StructuredTypeFieldConfig;
|
|
82
80
|
}
|
|
83
81
|
export interface Parser<T> {
|
|
84
|
-
deserialize(value: any, options?:
|
|
85
|
-
serialize(value: any, options?:
|
|
86
|
-
encode(value: any, options?:
|
|
82
|
+
deserialize(value: any, options?: ParserOptions | StructuredTypeFieldOptions): T;
|
|
83
|
+
serialize(value: any, options?: ParserOptions | StructuredTypeFieldOptions): any;
|
|
84
|
+
encode(value: any, options?: ParserOptions | StructuredTypeFieldOptions): any;
|
|
87
85
|
}
|
|
88
86
|
export declare const NONE_PARSER: Parser<any>;
|
|
89
87
|
export interface Cache {
|
package/lib/utils/enums.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const Enums: {
|
|
2
2
|
names<E>(Enum: E): string[];
|
|
3
3
|
values<E_1>(Enum: E_1): number[];
|
|
4
|
-
toValue<E_2>(Enum: E_2, value: any): number;
|
|
4
|
+
toValue<E_2>(Enum: E_2, value: any): number | undefined;
|
|
5
5
|
toValues<E_3>(Enum: E_3, value: any): number[];
|
|
6
|
-
toName<E_4>(Enum: E_4, value: any): string;
|
|
6
|
+
toName<E_4>(Enum: E_4, value: any): string | undefined;
|
|
7
7
|
toNames<E_5>(Enum: E_5, value: any): string[];
|
|
8
8
|
};
|
package/lib/utils/objects.d.ts
CHANGED
package/lib/utils/strings.d.ts
CHANGED
package/lib/utils/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const Types: {
|
|
|
4
4
|
isPlainObject(value: any): boolean;
|
|
5
5
|
isFunction(value: any): boolean;
|
|
6
6
|
isArray(value: any): boolean;
|
|
7
|
+
isMap(value: any): boolean;
|
|
7
8
|
isEmpty(value: any): boolean;
|
|
8
9
|
isEqual(value1: any, value2: any): boolean;
|
|
9
10
|
clone(target: any): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angular-odata",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.102.0",
|
|
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": "
|
|
29
|
-
"@angular/core": "
|
|
28
|
+
"@angular/common": ">=13.0.0",
|
|
29
|
+
"@angular/core": ">=13.0.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"tslib": "^2.3.0"
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"esm2020": "esm2020/angular-odata.mjs",
|
|
37
37
|
"fesm2020": "fesm2020/angular-odata.mjs",
|
|
38
38
|
"fesm2015": "fesm2015/angular-odata.mjs",
|
|
39
|
-
"typings": "
|
|
39
|
+
"typings": "index.d.ts",
|
|
40
40
|
"exports": {
|
|
41
41
|
"./package.json": {
|
|
42
42
|
"default": "./package.json"
|
|
43
43
|
},
|
|
44
44
|
".": {
|
|
45
|
-
"types": "./
|
|
45
|
+
"types": "./index.d.ts",
|
|
46
46
|
"esm2020": "./esm2020/angular-odata.mjs",
|
|
47
47
|
"es2020": "./fesm2020/angular-odata.mjs",
|
|
48
48
|
"es2015": "./fesm2015/angular-odata.mjs",
|