angular-odata 0.110.0 → 0.115.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/client.mjs +3 -3
- package/esm2020/lib/constants.mjs +10 -5
- package/esm2020/lib/models/collection.mjs +40 -20
- package/esm2020/lib/models/model.mjs +32 -8
- package/esm2020/lib/models/options.mjs +13 -15
- package/esm2020/lib/module.mjs +4 -4
- package/esm2020/lib/options.mjs +1 -1
- package/esm2020/lib/resources/query/expressions/count.mjs +89 -0
- package/esm2020/lib/resources/query/expressions/filter.mjs +5 -1
- package/esm2020/lib/resources/request.mjs +6 -1
- package/esm2020/lib/resources/resource.mjs +2 -2
- package/esm2020/lib/resources/responses/annotations.mjs +2 -2
- package/esm2020/lib/resources/responses/options.mjs +6 -1
- package/esm2020/lib/resources/responses/response.mjs +9 -5
- package/esm2020/lib/resources/types/entity-set.mjs +15 -15
- package/esm2020/lib/resources/types/navigation-property.mjs +21 -19
- package/esm2020/lib/resources/types/property.mjs +9 -4
- package/esm2020/lib/schema/parsers/edm.mjs +3 -3
- package/esm2020/lib/services/entity-set.mjs +4 -2
- package/esm2020/lib/services/factory.mjs +3 -3
- package/fesm2015/angular-odata.mjs +259 -101
- package/fesm2015/angular-odata.mjs.map +1 -1
- package/fesm2020/angular-odata.mjs +257 -99
- package/fesm2020/angular-odata.mjs.map +1 -1
- package/lib/constants.d.ts +5 -3
- package/lib/models/collection.d.ts +17 -2
- package/lib/models/model.d.ts +14 -2
- package/lib/models/options.d.ts +1 -0
- package/lib/options.d.ts +4 -0
- package/lib/resources/query/expressions/count.d.ts +44 -0
- package/lib/resources/query/expressions/filter.d.ts +5 -0
- package/lib/resources/resource.d.ts +1 -1
- package/lib/resources/responses/options.d.ts +1 -0
- package/lib/resources/types/entity-set.d.ts +5 -4
- package/lib/resources/types/navigation-property.d.ts +9 -9
- package/lib/services/entity-set.d.ts +6 -1
- package/package.json +1 -1
package/lib/constants.d.ts
CHANGED
|
@@ -10,20 +10,21 @@ export declare const $INLINECOUNT = "$inlinecount";
|
|
|
10
10
|
export declare const IF_MATCH_HEADER = "If-Match";
|
|
11
11
|
export declare const IF_NONE_MATCH_HEADER = "If-None-Match";
|
|
12
12
|
export declare const CONTENT_TYPE = "Content-Type";
|
|
13
|
-
export declare const CACHE_CONTROL = "Cache-Control";
|
|
14
13
|
export declare const HTTP11 = "HTTP/1.1";
|
|
15
14
|
export declare const ACCEPT = "Accept";
|
|
16
15
|
export declare const PREFER = "Prefer";
|
|
16
|
+
export declare const CACHE_CONTROL = "Cache-Control";
|
|
17
|
+
export declare const CACHE_CONTROL_HEADERS: string[];
|
|
17
18
|
export declare const ODATA_VERSION = "OData-Version";
|
|
18
19
|
export declare const ODATA_VERSION_HEADERS: string[];
|
|
19
|
-
export declare const ETAG_HEADER = "ETag";
|
|
20
|
-
export declare const ETAG_HEADERS: string[];
|
|
21
20
|
export declare const LOCATION_HEADER = "Location";
|
|
22
21
|
export declare const LOCATION_HEADERS: string[];
|
|
23
22
|
export declare const ODATA_ENTITYID = "OData-EntityId";
|
|
24
23
|
export declare const ODATA_ENTITYID_HEADERS: string[];
|
|
25
24
|
export declare const PREFERENCE_APPLIED = "Preference-Applied";
|
|
26
25
|
export declare const PREFERENCE_APPLIED_HEADERS: string[];
|
|
26
|
+
export declare const ETAG_HEADER = "ETag";
|
|
27
|
+
export declare const ETAG_HEADERS: string[];
|
|
27
28
|
export declare const RETRY_AFTER = "Retry-After";
|
|
28
29
|
export declare const RETRY_AFTER_HEADERS: string[];
|
|
29
30
|
export declare const APPLICATION_JSON = "application/json";
|
|
@@ -62,3 +63,4 @@ export declare const COMPUTED: RegExp;
|
|
|
62
63
|
export declare const OPTIMISTIC_CONCURRENCY: RegExp;
|
|
63
64
|
export declare const DESCRIPTION: RegExp;
|
|
64
65
|
export declare const LONG_DESCRIPTION: RegExp;
|
|
66
|
+
export declare const OPTIONARL_PARAMETER: RegExp;
|
|
@@ -11,6 +11,13 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
|
|
|
11
11
|
ODataModelField<any> | null
|
|
12
12
|
] | null;
|
|
13
13
|
_resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null;
|
|
14
|
+
_resources: {
|
|
15
|
+
parent: [
|
|
16
|
+
ODataModel<any> | ODataCollection<any, ODataModel<any>>,
|
|
17
|
+
ODataModelField<any> | null
|
|
18
|
+
] | null;
|
|
19
|
+
resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null;
|
|
20
|
+
}[];
|
|
14
21
|
_annotations: ODataEntitiesAnnotations<T>;
|
|
15
22
|
_entries: ODataModelEntry<T, M>[];
|
|
16
23
|
_model: typeof ODataModel;
|
|
@@ -28,6 +35,11 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
|
|
|
28
35
|
});
|
|
29
36
|
isParentOf(child: ODataModel<any> | ODataCollection<any, ODataModel<any>>): boolean;
|
|
30
37
|
resource(): ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>;
|
|
38
|
+
pushResource(resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>): void;
|
|
39
|
+
popResource(): {
|
|
40
|
+
parent: [ODataModel<any> | ODataCollection<any, ODataModel<any>>, ODataModelField<any> | null] | null;
|
|
41
|
+
resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null;
|
|
42
|
+
} | undefined;
|
|
31
43
|
attach(resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>): void;
|
|
32
44
|
asEntitySet<R>(func: (collection: this) => R): R;
|
|
33
45
|
annots(): ODataEntitiesAnnotations<T>;
|
|
@@ -56,12 +68,15 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
|
|
|
56
68
|
fetch({ withCount, ...options }?: ODataOptions & {
|
|
57
69
|
withCount?: boolean;
|
|
58
70
|
}): Observable<this>;
|
|
59
|
-
|
|
71
|
+
fetchAll({ withCount, ...options }?: ODataOptions & {
|
|
60
72
|
withCount?: boolean;
|
|
61
73
|
}): Observable<this>;
|
|
62
|
-
|
|
74
|
+
fetchMany(top: number, { withCount, ...options }?: ODataOptions & {
|
|
63
75
|
withCount?: boolean;
|
|
64
76
|
}): Observable<this>;
|
|
77
|
+
fetchOne({ withCount, ...options }?: ODataOptions & {
|
|
78
|
+
withCount?: boolean;
|
|
79
|
+
}): Observable<M | null>;
|
|
65
80
|
/**
|
|
66
81
|
* Save all models in the collection
|
|
67
82
|
* @param relModel The model is relationship
|
package/lib/models/model.d.ts
CHANGED
|
@@ -15,10 +15,17 @@ export declare class ODataModel<T> {
|
|
|
15
15
|
ODataModel<any> | ODataCollection<any, ODataModel<any>>,
|
|
16
16
|
ODataModelField<any> | null
|
|
17
17
|
] | null;
|
|
18
|
+
_resource: ODataResource<T> | null;
|
|
19
|
+
_resources: {
|
|
20
|
+
parent: [
|
|
21
|
+
ODataModel<any> | ODataCollection<any, ODataModel<any>>,
|
|
22
|
+
ODataModelField<any> | null
|
|
23
|
+
] | null;
|
|
24
|
+
resource: ODataResource<T> | null;
|
|
25
|
+
}[];
|
|
18
26
|
_attributes: Map<string, any>;
|
|
19
27
|
_changes: Map<string, any>;
|
|
20
28
|
_relations: Map<string, ODataModelRelation<any>>;
|
|
21
|
-
_resource: ODataResource<T> | null;
|
|
22
29
|
_annotations: ODataEntityAnnotations<T> | null;
|
|
23
30
|
_reset: boolean;
|
|
24
31
|
_reparent: boolean;
|
|
@@ -37,6 +44,11 @@ export declare class ODataModel<T> {
|
|
|
37
44
|
reset?: boolean;
|
|
38
45
|
});
|
|
39
46
|
resource(): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>;
|
|
47
|
+
pushResource(resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>): void;
|
|
48
|
+
popResource(): {
|
|
49
|
+
parent: [ODataModel<any> | ODataCollection<any, ODataModel<any>>, ODataModelField<any> | null] | null;
|
|
50
|
+
resource: ODataResource<T> | null;
|
|
51
|
+
} | undefined;
|
|
40
52
|
navigationProperty<N>(name: keyof T | string): ODataNavigationPropertyResource<N>;
|
|
41
53
|
property<N>(name: string): ODataPropertyResource<N>;
|
|
42
54
|
attach(resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>): void;
|
|
@@ -48,7 +60,6 @@ export declare class ODataModel<T> {
|
|
|
48
60
|
}): EntityKey<T> | {
|
|
49
61
|
[name: string]: any;
|
|
50
62
|
} | undefined;
|
|
51
|
-
isNew(): boolean;
|
|
52
63
|
isParentOf(child: ODataModel<any> | ODataCollection<any, ODataModel<any>>): boolean;
|
|
53
64
|
referential(field: ODataModelField<any>, { field_mapping, resolve, }?: {
|
|
54
65
|
field_mapping?: boolean;
|
|
@@ -144,6 +155,7 @@ export declare class ODataModel<T> {
|
|
|
144
155
|
hasChanged({ include_navigation, }?: {
|
|
145
156
|
include_navigation?: boolean;
|
|
146
157
|
}): boolean;
|
|
158
|
+
isNew(): boolean;
|
|
147
159
|
/**
|
|
148
160
|
* Create an execution context for a given function, where the model is bound to its entity endpoint
|
|
149
161
|
* @param ctx Context function
|
package/lib/models/options.d.ts
CHANGED
|
@@ -242,6 +242,7 @@ export declare class ODataModelOptions<T> {
|
|
|
242
242
|
hasChanged(self: ODataModel<T>, { include_navigation }?: {
|
|
243
243
|
include_navigation?: boolean;
|
|
244
244
|
}): boolean;
|
|
245
|
+
hasKey(self: ODataModel<T>): boolean;
|
|
245
246
|
asEntity<R, M extends ODataModel<T>>(self: M, func: (model: M) => R): R;
|
|
246
247
|
toEntity(self: ODataModel<T>, { client_id, include_navigation, include_concurrency, include_computed, include_key, include_non_field, changes_only, field_mapping, chain, }?: {
|
|
247
248
|
client_id?: boolean;
|
package/lib/options.d.ts
CHANGED
|
@@ -81,6 +81,10 @@ export declare class ODataApiOptions implements ApiOptions {
|
|
|
81
81
|
* @link http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398237
|
|
82
82
|
*/
|
|
83
83
|
includeAnnotations?: string;
|
|
84
|
+
/**
|
|
85
|
+
* @link https://devblogs.microsoft.com/odata/extension-omit-null-value-properties-in-asp-net-core-odata/
|
|
86
|
+
*/
|
|
87
|
+
omitNullValues?: boolean;
|
|
84
88
|
};
|
|
85
89
|
constructor(config: ApiOptions);
|
|
86
90
|
get parserOptions(): ParserOptions;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { QueryCustomType } from '../builder';
|
|
2
|
+
import { Expression } from './base';
|
|
3
|
+
import { FilterExpression, FilterExpressionBuilder } from './filter';
|
|
4
|
+
import { Renderable } from './syntax';
|
|
5
|
+
export declare class CountField<T extends object> implements Renderable {
|
|
6
|
+
protected field: any;
|
|
7
|
+
private values;
|
|
8
|
+
constructor(field: any, values?: {
|
|
9
|
+
[name: string]: any;
|
|
10
|
+
});
|
|
11
|
+
get [Symbol.toStringTag](): string;
|
|
12
|
+
toJSON(): {
|
|
13
|
+
field: any;
|
|
14
|
+
};
|
|
15
|
+
render({ aliases, escape, prefix, }: {
|
|
16
|
+
aliases?: QueryCustomType[];
|
|
17
|
+
escape?: boolean;
|
|
18
|
+
prefix?: string;
|
|
19
|
+
}): string;
|
|
20
|
+
filter(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>): any;
|
|
21
|
+
clone(): CountField<object>;
|
|
22
|
+
private option;
|
|
23
|
+
}
|
|
24
|
+
export declare type CountExpressionBuilder<T> = {
|
|
25
|
+
t: Readonly<Required<T>>;
|
|
26
|
+
e: () => CountExpression<T>;
|
|
27
|
+
};
|
|
28
|
+
export declare class CountExpression<T> extends Expression<T> {
|
|
29
|
+
constructor({ children, }?: {
|
|
30
|
+
children?: Renderable[];
|
|
31
|
+
});
|
|
32
|
+
static count<T extends object>(opts: (builder: CountExpressionBuilder<T>, current?: CountExpression<T>) => CountExpression<T>, current?: CountExpression<T>): CountExpression<T>;
|
|
33
|
+
private _add;
|
|
34
|
+
render({ aliases, escape, prefix, }?: {
|
|
35
|
+
aliases?: QueryCustomType[] | undefined;
|
|
36
|
+
escape?: boolean | undefined;
|
|
37
|
+
prefix?: string | undefined;
|
|
38
|
+
}): string;
|
|
39
|
+
clone(): CountExpression<unknown>;
|
|
40
|
+
field<F extends Object>(field: F[], opts?: (e: {
|
|
41
|
+
t: F;
|
|
42
|
+
f: CountField<F>;
|
|
43
|
+
}) => CountExpression<F>): CountExpression<F>;
|
|
44
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { QueryCustomType } from '../builder';
|
|
2
2
|
import { Expression } from './base';
|
|
3
|
+
import { CountExpression, CountField } from './count';
|
|
3
4
|
import { ODataFunctions, ODataOperators, Renderable } from './syntax';
|
|
4
5
|
export declare type FilterConnector = 'and' | 'or';
|
|
5
6
|
export declare type FilterExpressionBuilder<T> = {
|
|
@@ -53,6 +54,10 @@ export declare class FilterExpression<F> extends Expression<F> {
|
|
|
53
54
|
t: N;
|
|
54
55
|
e: (connector?: FilterConnector) => FilterExpression<N>;
|
|
55
56
|
}) => FilterExpression<N>, alias?: string): FilterExpression<F>;
|
|
57
|
+
count<N extends object>(left: N[], opts?: (e: {
|
|
58
|
+
t: N;
|
|
59
|
+
f: CountField<N>;
|
|
60
|
+
}) => CountExpression<N>): FilterExpression<F>;
|
|
56
61
|
isof(type: string): FilterExpression<F>;
|
|
57
62
|
isof(left: F, type: string): FilterExpression<F>;
|
|
58
63
|
}
|
|
@@ -41,7 +41,7 @@ export declare class ODataResource<T> {
|
|
|
41
41
|
clearKey(): void | undefined;
|
|
42
42
|
asModel<M extends ODataModel<T>>(entity?: Partial<T> | {
|
|
43
43
|
[name: string]: any;
|
|
44
|
-
}, { annots, reset }?: {
|
|
44
|
+
}, { annots, reset, }?: {
|
|
45
45
|
annots?: ODataEntityAnnotations<T>;
|
|
46
46
|
reset?: boolean;
|
|
47
47
|
}): M;
|
|
@@ -13,5 +13,6 @@ export declare class ODataResponseOptions implements ResponseOptions {
|
|
|
13
13
|
setFeatures(features: string): void;
|
|
14
14
|
setVersion(version: string): void;
|
|
15
15
|
setLocation(location: string): void;
|
|
16
|
+
setPreferenceApplied(preference: string): void;
|
|
16
17
|
setCache(cacheControl: string): void;
|
|
17
18
|
}
|
|
@@ -33,10 +33,11 @@ export declare class ODataEntitySetResource<T> extends ODataResource<T> {
|
|
|
33
33
|
withCount?: boolean;
|
|
34
34
|
bodyQueryOptions?: QueryOptionNames[];
|
|
35
35
|
}): Observable<ODataEntities<T>>;
|
|
36
|
-
|
|
36
|
+
fetchAll(options?: ODataOptions & {
|
|
37
|
+
withCount?: boolean;
|
|
37
38
|
bodyQueryOptions?: QueryOptionNames[];
|
|
38
39
|
}): Observable<{
|
|
39
|
-
|
|
40
|
+
entities: T[];
|
|
40
41
|
annots: ODataEntitiesAnnotations<T>;
|
|
41
42
|
}>;
|
|
42
43
|
fetchMany(top: number, options?: ODataOptions & {
|
|
@@ -46,11 +47,11 @@ export declare class ODataEntitySetResource<T> extends ODataResource<T> {
|
|
|
46
47
|
entities: T[];
|
|
47
48
|
annots: ODataEntitiesAnnotations<T>;
|
|
48
49
|
}>;
|
|
49
|
-
|
|
50
|
+
fetchOne(options?: ODataOptions & {
|
|
50
51
|
withCount?: boolean;
|
|
51
52
|
bodyQueryOptions?: QueryOptionNames[];
|
|
52
53
|
}): Observable<{
|
|
53
|
-
|
|
54
|
+
entity: T | null;
|
|
54
55
|
annots: ODataEntitiesAnnotations<T>;
|
|
55
56
|
}>;
|
|
56
57
|
fetchEntities(options?: ODataOptions & {
|
|
@@ -113,11 +113,16 @@ export declare class ODataNavigationPropertyResource<T> extends ODataResource<T>
|
|
|
113
113
|
withCount?: boolean;
|
|
114
114
|
bodyQueryOptions?: QueryOptionNames[];
|
|
115
115
|
}): Observable<C | null>;
|
|
116
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Fetch all entities
|
|
118
|
+
* @param options Options for the request
|
|
119
|
+
* @returns All entities
|
|
120
|
+
*/
|
|
121
|
+
fetchAll(options?: ODataOptions & {
|
|
117
122
|
withCount?: boolean;
|
|
118
123
|
bodyQueryOptions?: QueryOptionNames[];
|
|
119
124
|
}): Observable<{
|
|
120
|
-
|
|
125
|
+
entities: T[];
|
|
121
126
|
annots: ODataEntitiesAnnotations<T>;
|
|
122
127
|
}>;
|
|
123
128
|
fetchMany(top: number, options?: ODataOptions & {
|
|
@@ -127,16 +132,11 @@ export declare class ODataNavigationPropertyResource<T> extends ODataResource<T>
|
|
|
127
132
|
entities: T[];
|
|
128
133
|
annots: ODataEntitiesAnnotations<T>;
|
|
129
134
|
}>;
|
|
130
|
-
|
|
131
|
-
* Fetch all entities
|
|
132
|
-
* @param options Options for the request
|
|
133
|
-
* @returns All entities
|
|
134
|
-
*/
|
|
135
|
-
fetchAll(options?: ODataOptions & {
|
|
135
|
+
fetchOne(options?: ODataOptions & {
|
|
136
136
|
withCount?: boolean;
|
|
137
137
|
bodyQueryOptions?: QueryOptionNames[];
|
|
138
138
|
}): Observable<{
|
|
139
|
-
|
|
139
|
+
entity: T | null;
|
|
140
140
|
annots: ODataEntitiesAnnotations<T>;
|
|
141
141
|
}>;
|
|
142
142
|
}
|
|
@@ -28,7 +28,12 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
|
|
|
28
28
|
* @param options The options for the request.
|
|
29
29
|
*/
|
|
30
30
|
fetchAll(options?: ODataOptions): Observable<{
|
|
31
|
-
entities: T[];
|
|
31
|
+
entities: T[]; /**
|
|
32
|
+
* Delete an entity in the entity set.
|
|
33
|
+
* @param key The entity key.
|
|
34
|
+
* @param etag The etag for the entity.
|
|
35
|
+
* @param options The options for the request.
|
|
36
|
+
*/
|
|
32
37
|
annots: import("../resources").ODataEntitiesAnnotations<T>;
|
|
33
38
|
}>;
|
|
34
39
|
/**
|