angular-odata 0.124.0 → 0.126.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/README.md +2 -2
- package/esm2022/lib/api.mjs +3 -2
- package/esm2022/lib/cache/storage.mjs +3 -3
- package/esm2022/lib/client.mjs +3 -3
- package/esm2022/lib/constants.mjs +2 -1
- package/esm2022/lib/helper.mjs +2 -2
- package/esm2022/lib/models/collection.mjs +147 -193
- package/esm2022/lib/models/model.mjs +141 -119
- package/esm2022/lib/models/options.mjs +115 -88
- package/esm2022/lib/resources/path/segments.mjs +13 -7
- package/esm2022/lib/resources/query/expressions/base.mjs +8 -3
- package/esm2022/lib/resources/query/expressions/compute.mjs +19 -4
- package/esm2022/lib/resources/query/expressions/count.mjs +24 -7
- package/esm2022/lib/resources/query/expressions/expand.mjs +30 -8
- package/esm2022/lib/resources/query/expressions/filter.mjs +29 -12
- package/esm2022/lib/resources/query/expressions/orderby.mjs +31 -8
- package/esm2022/lib/resources/query/expressions/search.mjs +30 -11
- package/esm2022/lib/resources/query/expressions/select.mjs +16 -4
- package/esm2022/lib/resources/query/expressions/syntax.mjs +185 -31
- package/esm2022/lib/resources/query/handlers.mjs +2 -2
- package/esm2022/lib/resources/query/index.mjs +2 -1
- package/esm2022/lib/resources/query/options.mjs +22 -12
- package/esm2022/lib/resources/request.mjs +4 -3
- package/esm2022/lib/resources/resource.mjs +39 -15
- package/esm2022/lib/resources/responses/annotations.mjs +1 -1
- package/esm2022/lib/resources/responses/response.mjs +3 -3
- package/esm2022/lib/resources/types/batch.mjs +2 -2
- package/esm2022/lib/resources/types/count.mjs +7 -4
- package/esm2022/lib/resources/types/entity-set.mjs +2 -1
- package/esm2022/lib/resources/types/entity.mjs +5 -5
- package/esm2022/lib/resources/types/function.mjs +1 -9
- package/esm2022/lib/resources/types/navigation-property.mjs +3 -2
- package/esm2022/lib/resources/types/options.mjs +1 -1
- package/esm2022/lib/resources/types/property.mjs +11 -3
- package/esm2022/lib/schema/parsers/structured-type.mjs +5 -4
- package/esm2022/lib/schema/structured-type.mjs +13 -2
- package/esm2022/lib/utils/enums.mjs +1 -1
- package/fesm2022/angular-odata.mjs +3873 -3536
- package/fesm2022/angular-odata.mjs.map +1 -1
- package/lib/api.d.ts +2 -2
- package/lib/client.d.ts +1 -1
- package/lib/constants.d.ts +1 -0
- package/lib/helper.d.ts +10 -10
- package/lib/models/collection.d.ts +18 -20
- package/lib/models/model.d.ts +14 -13
- package/lib/models/options.d.ts +38 -13
- package/lib/resources/path/segments.d.ts +8 -11
- package/lib/resources/query/expressions/base.d.ts +6 -3
- package/lib/resources/query/expressions/compute.d.ts +13 -2
- package/lib/resources/query/expressions/count.d.ts +15 -4
- package/lib/resources/query/expressions/expand.d.ts +15 -4
- package/lib/resources/query/expressions/filter.d.ts +15 -4
- package/lib/resources/query/expressions/orderby.d.ts +16 -4
- package/lib/resources/query/expressions/search.d.ts +14 -5
- package/lib/resources/query/expressions/select.d.ts +11 -2
- package/lib/resources/query/expressions/syntax.d.ts +65 -16
- package/lib/resources/query/handlers.d.ts +1 -1
- package/lib/resources/query/index.d.ts +1 -0
- package/lib/resources/query/options.d.ts +4 -3
- package/lib/resources/request.d.ts +3 -2
- package/lib/resources/resource.d.ts +10 -5
- package/lib/resources/responses/annotations.d.ts +9 -9
- package/lib/resources/responses/response.d.ts +2 -2
- package/lib/resources/types/count.d.ts +5 -1
- package/lib/resources/types/function.d.ts +0 -3
- package/lib/resources/types/options.d.ts +2 -1
- package/lib/resources/types/property.d.ts +2 -0
- package/lib/schema/parsers/structured-type.d.ts +1 -0
- package/lib/schema/structured-type.d.ts +2 -1
- package/lib/utils/enums.d.ts +7 -7
- package/package.json +1 -1
package/lib/api.d.ts
CHANGED
|
@@ -26,13 +26,13 @@ export declare class ODataApi {
|
|
|
26
26
|
configure(settings?: {
|
|
27
27
|
requester?: (request: ODataRequest<any>) => Observable<any>;
|
|
28
28
|
}): void;
|
|
29
|
-
|
|
29
|
+
fromJson<P, R>(json: {
|
|
30
30
|
segments: ODataSegment[];
|
|
31
31
|
options: {
|
|
32
32
|
[name: string]: any;
|
|
33
33
|
};
|
|
34
34
|
}): ODataActionResource<P, R> | ODataFunctionResource<P, R>;
|
|
35
|
-
|
|
35
|
+
fromJson<E>(json: {
|
|
36
36
|
segments: ODataSegment[];
|
|
37
37
|
options: {
|
|
38
38
|
[name: string]: any;
|
package/lib/client.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export declare class ODataClient {
|
|
|
81
81
|
modelByName(name: string): typeof ODataModel;
|
|
82
82
|
collectionByName(name: string): typeof ODataCollection;
|
|
83
83
|
serviceByName(name: string): ODataEntityService<any> | undefined;
|
|
84
|
-
|
|
84
|
+
fromJson<E>(json: {
|
|
85
85
|
segments: ODataSegment[];
|
|
86
86
|
options: {
|
|
87
87
|
[name: string]: any;
|
package/lib/constants.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export declare const NEWLINE = "\r\n";
|
|
|
59
59
|
export declare const NEWLINE_REGEXP: RegExp;
|
|
60
60
|
export declare const CACHE_KEY_SEPARATOR = ":";
|
|
61
61
|
export declare const CID_FIELD_NAME = "_cid";
|
|
62
|
+
export declare const EVENT_SPLITTER: RegExp;
|
|
62
63
|
export declare const COMPUTED: RegExp;
|
|
63
64
|
export declare const OPTIMISTIC_CONCURRENCY: RegExp;
|
|
64
65
|
export declare const DESCRIPTION: RegExp;
|
package/lib/helper.d.ts
CHANGED
|
@@ -26,31 +26,31 @@ export interface ODataVersionHelper {
|
|
|
26
26
|
ODATA_DEFERRED: string;
|
|
27
27
|
ODATA_ANNOTATION: string;
|
|
28
28
|
entity(value: {
|
|
29
|
-
[
|
|
29
|
+
[name: string]: any;
|
|
30
30
|
}): any;
|
|
31
31
|
entities(value: {
|
|
32
|
-
[
|
|
32
|
+
[name: string]: any;
|
|
33
33
|
}): any;
|
|
34
34
|
property(value: {
|
|
35
|
-
[
|
|
35
|
+
[name: string]: any;
|
|
36
36
|
}): any;
|
|
37
37
|
annotations(value: {
|
|
38
|
-
[
|
|
38
|
+
[name: string]: any;
|
|
39
39
|
}): Map<string, any>;
|
|
40
40
|
attributes(value: {
|
|
41
|
-
[
|
|
41
|
+
[name: string]: any;
|
|
42
42
|
}, metadata: ODataMetadataType): any;
|
|
43
43
|
context(annots: Map<string, any> | {
|
|
44
|
-
[
|
|
44
|
+
[name: string]: any;
|
|
45
45
|
}): ODataContext;
|
|
46
46
|
id(annots: Map<string, any> | {
|
|
47
|
-
[
|
|
47
|
+
[name: string]: any;
|
|
48
48
|
}): string | undefined;
|
|
49
49
|
etag(annots: Map<string, any> | {
|
|
50
|
-
[
|
|
50
|
+
[name: string]: any;
|
|
51
51
|
}): string | undefined;
|
|
52
52
|
type(annots: Map<string, any> | {
|
|
53
|
-
[
|
|
53
|
+
[name: string]: any;
|
|
54
54
|
}): string | undefined;
|
|
55
55
|
count(annots: Map<string, any>): number | undefined;
|
|
56
56
|
functions(annots: Map<string, any>): Map<string, any>;
|
|
@@ -65,7 +65,7 @@ export interface ODataVersionHelper {
|
|
|
65
65
|
mediaContentType(annots: Map<string, any>): string | undefined;
|
|
66
66
|
deltaLink(annots: Map<string, any>): string | undefined;
|
|
67
67
|
countParam(): {
|
|
68
|
-
[
|
|
68
|
+
[name: string]: string;
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
export declare const ODataHelper: {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { EventEmitter } from '@angular/core';
|
|
2
1
|
import { Observable } from 'rxjs';
|
|
3
2
|
import { ODataActionOptions, ODataEntitiesAnnotations, ODataEntitySetResource, ODataFunctionOptions, ODataNavigationPropertyResource, ODataOptions, ODataPropertyResource, ODataQueryOptionsHandler, ODataResource } from '../resources';
|
|
4
3
|
import { ODataStructuredType } from '../schema/structured-type';
|
|
5
4
|
import { ODataModel } from './model';
|
|
6
|
-
import { ModelFieldOptions, ODataModelEntry,
|
|
5
|
+
import { ModelFieldOptions, ODataModelEntry, ODataModelEventEmitter, ODataModelField } from './options';
|
|
7
6
|
export declare class ODataCollection<T, M extends ODataModel<T>> implements Iterable<M> {
|
|
8
7
|
static model: typeof ODataModel | null;
|
|
9
8
|
_parent: [
|
|
@@ -23,34 +22,35 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
|
|
|
23
22
|
_model: typeof ODataModel;
|
|
24
23
|
models(): M[];
|
|
25
24
|
get length(): number;
|
|
26
|
-
events$:
|
|
25
|
+
events$: ODataModelEventEmitter<T>;
|
|
27
26
|
constructor(entities?: Partial<T>[] | {
|
|
28
27
|
[name: string]: any;
|
|
29
28
|
}[], { parent, resource, annots, model, reset, }?: {
|
|
30
29
|
parent?: [ODataModel<any>, ODataModelField<any>];
|
|
31
|
-
resource?: ODataResource<T
|
|
30
|
+
resource?: ODataResource<T> | null;
|
|
32
31
|
annots?: ODataEntitiesAnnotations<T>;
|
|
33
32
|
model?: typeof ODataModel;
|
|
34
33
|
reset?: boolean;
|
|
35
34
|
});
|
|
36
35
|
isParentOf(child: ODataModel<any> | ODataCollection<any, ODataModel<any>>): boolean;
|
|
37
|
-
resource(): ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T
|
|
38
|
-
pushResource(resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>): void;
|
|
36
|
+
resource(): ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null;
|
|
37
|
+
pushResource(resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null): void;
|
|
39
38
|
popResource(): {
|
|
40
39
|
parent: [ODataModel<any> | ODataCollection<any, ODataModel<any>>, ODataModelField<any> | null] | null;
|
|
41
40
|
resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null;
|
|
42
41
|
} | undefined;
|
|
43
42
|
attach(resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>): void;
|
|
44
|
-
withResource<R>(resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T
|
|
43
|
+
withResource<R>(resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null, ctx: (collection: this) => R): R;
|
|
45
44
|
asEntitySet<R>(ctx: (collection: this) => R): R;
|
|
46
45
|
annots(): ODataEntitiesAnnotations<T>;
|
|
47
46
|
private modelFactory;
|
|
48
|
-
toEntities({ client_id, include_navigation, include_concurrency, include_computed, include_key, include_non_field, changes_only, field_mapping, chain, }?: {
|
|
47
|
+
toEntities({ client_id, include_navigation, include_concurrency, include_computed, include_key, include_id, include_non_field, changes_only, field_mapping, chain, }?: {
|
|
49
48
|
client_id?: boolean;
|
|
50
49
|
include_navigation?: boolean;
|
|
51
50
|
include_concurrency?: boolean;
|
|
52
51
|
include_computed?: boolean;
|
|
53
52
|
include_key?: boolean;
|
|
53
|
+
include_id?: boolean;
|
|
54
54
|
include_non_field?: boolean;
|
|
55
55
|
changes_only?: boolean;
|
|
56
56
|
field_mapping?: boolean;
|
|
@@ -58,7 +58,7 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
|
|
|
58
58
|
}): (Partial<T> | {
|
|
59
59
|
[name: string]: any;
|
|
60
60
|
})[];
|
|
61
|
-
|
|
61
|
+
toJson(): (Partial<T> | {
|
|
62
62
|
[name: string]: any;
|
|
63
63
|
})[];
|
|
64
64
|
hasChanged({ include_navigation }?: {
|
|
@@ -94,20 +94,21 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
|
|
|
94
94
|
}): Observable<this>;
|
|
95
95
|
private addReference;
|
|
96
96
|
private _addModel;
|
|
97
|
-
|
|
98
|
-
add(model: M, { silent, reparent, server, merge, position, }?: {
|
|
97
|
+
add(model: M, { silent, reparent, server, merge, position, reset, }?: {
|
|
99
98
|
silent?: boolean;
|
|
100
99
|
reparent?: boolean;
|
|
101
100
|
server?: boolean;
|
|
102
101
|
merge?: boolean;
|
|
103
102
|
position?: number;
|
|
103
|
+
reset?: boolean;
|
|
104
104
|
}): Observable<M>;
|
|
105
105
|
private removeReference;
|
|
106
106
|
private _removeModel;
|
|
107
107
|
private removeModel;
|
|
108
|
-
remove(model: M, { silent, server, }?: {
|
|
108
|
+
remove(model: M, { silent, server, reset, }?: {
|
|
109
109
|
silent?: boolean;
|
|
110
110
|
server?: boolean;
|
|
111
|
+
reset?: boolean;
|
|
111
112
|
}): Observable<M>;
|
|
112
113
|
private _moveModel;
|
|
113
114
|
create(attrs?: T, { silent, server, }?: {
|
|
@@ -134,19 +135,17 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
|
|
|
134
135
|
silent?: boolean;
|
|
135
136
|
}): void;
|
|
136
137
|
query(ctx: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): this;
|
|
137
|
-
callFunction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none',
|
|
138
|
-
callAction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none',
|
|
138
|
+
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>;
|
|
139
|
+
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>;
|
|
139
140
|
private _unlink;
|
|
140
141
|
private _link;
|
|
141
142
|
private _findEntry;
|
|
142
143
|
equals(other: ODataCollection<T, ODataModel<T>>): boolean;
|
|
143
144
|
get [Symbol.toStringTag](): string;
|
|
144
|
-
[Symbol.iterator]():
|
|
145
|
-
next(): IteratorResult<M>;
|
|
146
|
-
};
|
|
145
|
+
[Symbol.iterator](): Iterator<M, any, undefined>;
|
|
147
146
|
filter(predicate: (value: M, index: number, array: M[]) => unknown, thisArg?: any): M[];
|
|
148
147
|
map<U>(callbackfn: (value: M, index: number, array: M[]) => U, thisArg?: any): U[];
|
|
149
|
-
find(predicate: (value: M, index: number, obj: M[]) => unknown
|
|
148
|
+
find(predicate: (value: M, index: number, obj: M[]) => unknown): M | undefined;
|
|
150
149
|
reduce<U>(callbackfn: (previousValue: U, currentValue: M, currentIndex: number, array: M[]) => U, initialValue: U): U;
|
|
151
150
|
first(): M | undefined;
|
|
152
151
|
last(): M | undefined;
|
|
@@ -154,10 +153,9 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
|
|
|
154
153
|
prev(model: M): M | undefined;
|
|
155
154
|
every(predicate: (m: M, index: number) => boolean): boolean;
|
|
156
155
|
some(predicate: (m: M, index: number) => boolean): boolean;
|
|
157
|
-
|
|
156
|
+
includes(model: M, start?: number): boolean;
|
|
158
157
|
indexOf(model: M): number;
|
|
159
158
|
isEmpty(): boolean;
|
|
160
|
-
private _bisect;
|
|
161
159
|
private _compare;
|
|
162
160
|
_sortBy: {
|
|
163
161
|
field: string | keyof T;
|
package/lib/models/model.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { EventEmitter } from '@angular/core';
|
|
2
1
|
import { Observable } from 'rxjs';
|
|
3
2
|
import { EntityKey, ODataActionOptions, ODataEntityAnnotations, ODataEntityResource, ODataFunctionOptions, ODataNavigationPropertyResource, ODataOptions, ODataPropertyResource, ODataQueryArgumentsOptions, ODataQueryOptionsHandler, ODataResource, ODataSingletonResource } from '../resources';
|
|
4
3
|
import { ODataStructuredType } from '../schema';
|
|
5
4
|
import { ODataCollection } from './collection';
|
|
6
|
-
import { ModelOptions,
|
|
5
|
+
import { ModelOptions, ODataModelField, ODataModelOptions, ODataModelAttribute, ODataModelEventEmitter } from './options';
|
|
7
6
|
import { ParserOptions } from '../types';
|
|
8
7
|
export declare class ODataModel<T> {
|
|
9
8
|
static options: ModelOptions;
|
|
@@ -30,7 +29,7 @@ export declare class ODataModel<T> {
|
|
|
30
29
|
_reparent: boolean;
|
|
31
30
|
_silent: boolean;
|
|
32
31
|
_meta: ODataModelOptions<any>;
|
|
33
|
-
events$:
|
|
32
|
+
events$: ODataModelEventEmitter<T>;
|
|
34
33
|
constructor(data?: Partial<T> | {
|
|
35
34
|
[name: string]: any;
|
|
36
35
|
}, { parent, resource, annots, reset, }?: {
|
|
@@ -38,12 +37,12 @@ export declare class ODataModel<T> {
|
|
|
38
37
|
ODataModel<any> | ODataCollection<any, ODataModel<any>>,
|
|
39
38
|
ODataModelField<any> | null
|
|
40
39
|
];
|
|
41
|
-
resource?: ODataResource<T
|
|
40
|
+
resource?: ODataResource<T> | null;
|
|
42
41
|
annots?: ODataEntityAnnotations<T>;
|
|
43
42
|
reset?: boolean;
|
|
44
43
|
});
|
|
45
|
-
resource(): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T
|
|
46
|
-
pushResource(resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>): void;
|
|
44
|
+
resource(): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> | null;
|
|
45
|
+
pushResource(resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> | null): void;
|
|
47
46
|
popResource(): {
|
|
48
47
|
parent: [ODataModel<any> | ODataCollection<any, ODataModel<any>>, ODataModelField<any> | null] | null;
|
|
49
48
|
resource: ODataResource<T> | null;
|
|
@@ -74,7 +73,7 @@ export declare class ODataModel<T> {
|
|
|
74
73
|
[name: string]: any;
|
|
75
74
|
} | null | undefined;
|
|
76
75
|
_errors?: {
|
|
77
|
-
[
|
|
76
|
+
[name: string]: any;
|
|
78
77
|
};
|
|
79
78
|
validate({ method, navigation, }?: {
|
|
80
79
|
method?: 'create' | 'update' | 'modify';
|
|
@@ -87,12 +86,13 @@ export declare class ODataModel<T> {
|
|
|
87
86
|
navigation?: boolean;
|
|
88
87
|
}): boolean;
|
|
89
88
|
defaults(): any;
|
|
90
|
-
toEntity({ client_id, include_navigation, include_concurrency, include_computed, include_key, include_non_field, changes_only, field_mapping, chain, }?: {
|
|
89
|
+
toEntity({ client_id, include_navigation, include_concurrency, include_computed, include_key, include_id, include_non_field, changes_only, field_mapping, chain, }?: {
|
|
91
90
|
client_id?: boolean;
|
|
92
91
|
include_navigation?: boolean;
|
|
93
92
|
include_concurrency?: boolean;
|
|
94
93
|
include_computed?: boolean;
|
|
95
94
|
include_key?: boolean;
|
|
95
|
+
include_id?: boolean;
|
|
96
96
|
include_non_field?: boolean;
|
|
97
97
|
changes_only?: boolean;
|
|
98
98
|
field_mapping?: boolean;
|
|
@@ -100,7 +100,7 @@ export declare class ODataModel<T> {
|
|
|
100
100
|
}): T | {
|
|
101
101
|
[name: string]: any;
|
|
102
102
|
};
|
|
103
|
-
|
|
103
|
+
toJson(): T | {
|
|
104
104
|
[name: string]: any;
|
|
105
105
|
};
|
|
106
106
|
set(path: string | string[], value: any, { type }?: {
|
|
@@ -158,13 +158,14 @@ export declare class ODataModel<T> {
|
|
|
158
158
|
* @returns The result of the context
|
|
159
159
|
*/
|
|
160
160
|
asEntity<R>(ctx: (model: this) => R): R;
|
|
161
|
-
callFunction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none' | 'blob' | 'arraybuffer',
|
|
161
|
+
callFunction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none' | 'blob' | 'arraybuffer', options?: ODataFunctionOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null | Blob | ArrayBuffer>;
|
|
162
162
|
callAction<P, R>(name: string, params: P | null, responseType?: 'property' | 'model' | 'collection' | 'none' | 'blob' | 'arraybuffer', { ...options }?: {} & ODataActionOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null | Blob | ArrayBuffer>;
|
|
163
163
|
cast<S>(type: string): ODataModel<S>;
|
|
164
|
-
fetchNavigationProperty<S>(name: keyof T | string, responseType: 'model' | 'collection',
|
|
165
|
-
|
|
164
|
+
fetchNavigationProperty<S>(name: keyof T | string, responseType: 'model' | 'collection', options?: ODataQueryArgumentsOptions<S>): Observable<ODataModel<S> | ODataCollection<S, ODataModel<S>> | null>;
|
|
165
|
+
fetchAttribute<P>(name: keyof T | string, options?: ODataQueryArgumentsOptions<P>): Observable<P | ODataModel<P> | ODataCollection<P, ODataModel<P>> | null>;
|
|
166
|
+
getAttribute<P>(name: keyof T | string): P | ODataModel<P> | ODataCollection<P, ODataModel<P>> | null | undefined;
|
|
167
|
+
setAttribute<N>(name: keyof T | string, model: ODataModel<N> | ODataCollection<N, ODataModel<N>> | null, options?: ODataOptions): Observable<this>;
|
|
166
168
|
setReference<N>(name: keyof T | string, model: ODataModel<N> | ODataCollection<N, ODataModel<N>> | null, options?: ODataOptions): Observable<this>;
|
|
167
|
-
getReference<P>(name: keyof T | string): ODataModel<P> | ODataCollection<P, ODataModel<P>> | null;
|
|
168
169
|
get [Symbol.toStringTag](): string;
|
|
169
170
|
equals(other: ODataModel<T>): boolean;
|
|
170
171
|
collection(): ODataCollection<T, ODataModel<T>> | undefined;
|
package/lib/models/options.d.ts
CHANGED
|
@@ -18,42 +18,66 @@ export declare enum ODataModelEventType {
|
|
|
18
18
|
Attach = "attach"
|
|
19
19
|
}
|
|
20
20
|
export declare class ODataModelEvent<T> {
|
|
21
|
-
|
|
21
|
+
type: ODataModelEventType | string;
|
|
22
22
|
value?: any;
|
|
23
23
|
previous?: any;
|
|
24
24
|
options?: any;
|
|
25
|
-
constructor(
|
|
25
|
+
constructor(type: ODataModelEventType | string, { model, collection, previous, value, attr, options, bubbles, chain, }?: {
|
|
26
26
|
model?: ODataModel<T>;
|
|
27
27
|
collection?: ODataCollection<T, ODataModel<T>>;
|
|
28
28
|
attr?: ODataModelAttribute<any> | number;
|
|
29
29
|
previous?: any;
|
|
30
30
|
value?: any;
|
|
31
31
|
options?: any;
|
|
32
|
+
bubbles?: boolean;
|
|
33
|
+
chain?: [
|
|
34
|
+
ODataModel<any> | ODataCollection<any, ODataModel<any>>,
|
|
35
|
+
ODataModelAttribute<any> | number | null
|
|
36
|
+
][];
|
|
32
37
|
});
|
|
33
|
-
bubbling: boolean;
|
|
34
|
-
stopPropagation(): void;
|
|
35
38
|
chain: [
|
|
36
39
|
ODataModel<any> | ODataCollection<any, ODataModel<any>>,
|
|
37
40
|
ODataModelAttribute<any> | number | null
|
|
38
41
|
][];
|
|
39
42
|
push(model: ODataModel<any> | ODataCollection<any, ODataModel<any>>, attr: ODataModelAttribute<any> | number): ODataModelEvent<T>;
|
|
43
|
+
bubbles: boolean;
|
|
44
|
+
stopPropagation(): void;
|
|
40
45
|
visited(model: ODataModel<any> | ODataCollection<any, ODataModel<any>>): boolean;
|
|
46
|
+
canContinueWith(self: ODataModel<T> | ODataCollection<T, ODataModel<T>>): boolean;
|
|
41
47
|
get path(): string;
|
|
42
48
|
model?: ODataModel<T>;
|
|
43
49
|
get currentModel(): ODataModel<any> | undefined;
|
|
44
50
|
collection?: ODataCollection<T, ODataModel<T>>;
|
|
45
51
|
get currentCollection(): ODataCollection<any, ODataModel<any>> | undefined;
|
|
46
52
|
}
|
|
47
|
-
export declare
|
|
53
|
+
export declare class ODataModelEventEmitter<T> extends EventEmitter<ODataModelEvent<T>> {
|
|
54
|
+
model?: ODataModel<T>;
|
|
55
|
+
collection?: ODataCollection<T, ODataModel<T>>;
|
|
56
|
+
constructor({ model, collection, }?: {
|
|
57
|
+
model?: ODataModel<T>;
|
|
58
|
+
collection?: ODataCollection<T, ODataModel<T>>;
|
|
59
|
+
});
|
|
60
|
+
trigger(type: ODataModelEventType | string, { collection, previous, value, attr, options, bubbles, }?: {
|
|
61
|
+
collection?: ODataCollection<T, ODataModel<T>>;
|
|
62
|
+
attr?: ODataModelAttribute<any> | number;
|
|
63
|
+
previous?: any;
|
|
64
|
+
value?: any;
|
|
65
|
+
options?: any;
|
|
66
|
+
bubbles?: boolean;
|
|
67
|
+
}): void;
|
|
68
|
+
}
|
|
69
|
+
export declare const BUBBLES: (ODataModelEventType | string)[];
|
|
48
70
|
export declare const INCLUDE_SHALLOW: {
|
|
49
71
|
include_concurrency: boolean;
|
|
50
72
|
include_computed: boolean;
|
|
51
73
|
include_key: boolean;
|
|
74
|
+
include_id: boolean;
|
|
52
75
|
};
|
|
53
76
|
export declare const INCLUDE_DEEP: {
|
|
54
77
|
include_concurrency: boolean;
|
|
55
78
|
include_computed: boolean;
|
|
56
79
|
include_key: boolean;
|
|
80
|
+
include_id: boolean;
|
|
57
81
|
include_navigation: boolean;
|
|
58
82
|
include_non_field: boolean;
|
|
59
83
|
};
|
|
@@ -154,7 +178,7 @@ export declare class ODataModelAttribute<T> {
|
|
|
154
178
|
private value?;
|
|
155
179
|
private change?;
|
|
156
180
|
private subscription?;
|
|
157
|
-
events$:
|
|
181
|
+
events$: ODataModelEventEmitter<T>;
|
|
158
182
|
constructor(_model: ODataModel<any>, _field: ODataModelField<T>);
|
|
159
183
|
get navigation(): boolean;
|
|
160
184
|
get computed(): boolean | undefined;
|
|
@@ -190,6 +214,7 @@ export declare class ODataModelOptions<T> {
|
|
|
190
214
|
entitySet?: ODataEntitySet;
|
|
191
215
|
parent?: ODataModelOptions<any>;
|
|
192
216
|
children: ODataModelOptions<any>[];
|
|
217
|
+
events$: ODataModelEventEmitter<T>;
|
|
193
218
|
constructor({ options, schema, }: {
|
|
194
219
|
options: ModelOptions;
|
|
195
220
|
schema: ODataStructuredType<T>;
|
|
@@ -225,16 +250,15 @@ export declare class ODataModelOptions<T> {
|
|
|
225
250
|
ODataModel<any> | ODataCollection<any, ODataModel<any>>,
|
|
226
251
|
ODataModelField<any> | null
|
|
227
252
|
][];
|
|
228
|
-
static resource<T>(child: ODataModel<T> | ODataCollection<T, ODataModel<T>>): ODataResource<T
|
|
229
|
-
collectionResourceFactory(query?: ODataQueryOptions<T>): ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> |
|
|
230
|
-
modelResourceFactory(query?: ODataQueryOptions<T>): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> |
|
|
231
|
-
entityResource(self: ODataModel<T>): ODataResource<T>;
|
|
253
|
+
static resource<T>(child: ODataModel<T> | ODataCollection<T, ODataModel<T>>): ODataResource<T> | null;
|
|
254
|
+
collectionResourceFactory(query?: ODataQueryOptions<T>): ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null;
|
|
255
|
+
modelResourceFactory(query?: ODataQueryOptions<T>): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> | null;
|
|
232
256
|
bind(self: ODataModel<T>, { parent, resource, annots, }?: {
|
|
233
257
|
parent?: [
|
|
234
258
|
ODataModel<any> | ODataCollection<any, ODataModel<any>>,
|
|
235
259
|
ODataModelField<any> | null
|
|
236
260
|
];
|
|
237
|
-
resource?: ODataResource<T
|
|
261
|
+
resource?: ODataResource<T> | null;
|
|
238
262
|
annots?: ODataEntityAnnotations<T>;
|
|
239
263
|
}): void;
|
|
240
264
|
query(self: ODataModel<T>, resource: ODataEntityResource<T> | ODataPropertyResource<T> | ODataNavigationPropertyResource<T> | ODataSingletonResource<T>, func: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): ODataModel<T>;
|
|
@@ -278,14 +302,15 @@ export declare class ODataModelOptions<T> {
|
|
|
278
302
|
include_navigation?: boolean;
|
|
279
303
|
}): boolean;
|
|
280
304
|
hasKey(self: ODataModel<T>): boolean;
|
|
281
|
-
withResource<R, M extends ODataModel<T>>(self: M, resource: ODataEntityResource<T> | ODataPropertyResource<T> | ODataNavigationPropertyResource<T> | ODataSingletonResource<T
|
|
305
|
+
withResource<R, M extends ODataModel<T>>(self: M, resource: ODataEntityResource<T> | ODataPropertyResource<T> | ODataNavigationPropertyResource<T> | ODataSingletonResource<T> | null, ctx: (model: M) => R): R;
|
|
282
306
|
asEntity<R, M extends ODataModel<T>>(self: M, ctx: (model: M) => R): R;
|
|
283
|
-
toEntity(self: ODataModel<T>, { client_id, include_navigation, include_concurrency, include_computed, include_key, include_non_field, changes_only, field_mapping, chain, }?: {
|
|
307
|
+
toEntity(self: ODataModel<T>, { client_id, include_navigation, include_concurrency, include_computed, include_key, include_id, include_non_field, changes_only, field_mapping, chain, }?: {
|
|
284
308
|
client_id?: boolean;
|
|
285
309
|
include_navigation?: boolean;
|
|
286
310
|
include_concurrency?: boolean;
|
|
287
311
|
include_computed?: boolean;
|
|
288
312
|
include_key?: boolean;
|
|
313
|
+
include_id?: boolean;
|
|
289
314
|
include_non_field?: boolean;
|
|
290
315
|
changes_only?: boolean;
|
|
291
316
|
field_mapping?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Parser, PathSegment } from '../../types';
|
|
1
|
+
import { Parser, ParserOptions, PathSegment } from '../../types';
|
|
2
2
|
import { EntityKey } from '../resource';
|
|
3
3
|
import { SegmentHandler } from './handlers';
|
|
4
4
|
export type ODataSegment = {
|
|
@@ -11,24 +11,21 @@ export type ODataSegment = {
|
|
|
11
11
|
export declare class ODataPathSegments {
|
|
12
12
|
private _segments;
|
|
13
13
|
constructor(segments?: ODataSegment[]);
|
|
14
|
-
pathAndParams({ escape, parser, }?: {
|
|
14
|
+
pathAndParams({ escape, parser, options, }?: {
|
|
15
15
|
escape?: boolean;
|
|
16
16
|
parser?: Parser<any>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
];
|
|
17
|
+
options?: ParserOptions;
|
|
18
|
+
}): [string, {
|
|
19
|
+
[name: string]: any;
|
|
20
|
+
}];
|
|
23
21
|
types({ key }?: {
|
|
24
22
|
key?: boolean;
|
|
25
23
|
}): string[];
|
|
26
24
|
keys(values?: (EntityKey<any> | undefined)[]): (EntityKey<any> | undefined)[];
|
|
27
|
-
toString({ escape
|
|
25
|
+
toString({ escape }?: {
|
|
28
26
|
escape?: boolean;
|
|
29
|
-
parser?: Parser<any>;
|
|
30
27
|
}): string;
|
|
31
|
-
|
|
28
|
+
toJson(): any[];
|
|
32
29
|
clone(): ODataPathSegments;
|
|
33
30
|
find(predicate: (segment: ODataSegment) => boolean): ODataSegment | undefined;
|
|
34
31
|
segments({ key }?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Parser } from '../../../types';
|
|
1
|
+
import { Parser, ParserOptions } from '../../../types';
|
|
2
2
|
import type { QueryCustomType } from '../builder';
|
|
3
3
|
import { Renderable } from './syntax';
|
|
4
4
|
export declare abstract class Expression<T> implements Renderable {
|
|
@@ -7,16 +7,19 @@ export declare abstract class Expression<T> implements Renderable {
|
|
|
7
7
|
children?: Renderable[];
|
|
8
8
|
});
|
|
9
9
|
get [Symbol.toStringTag](): string;
|
|
10
|
-
abstract render({ aliases, escape, prefix, parser, }: {
|
|
10
|
+
abstract render({ aliases, escape, prefix, parser, options, }: {
|
|
11
11
|
aliases?: QueryCustomType[];
|
|
12
12
|
escape?: boolean;
|
|
13
13
|
prefix?: string;
|
|
14
14
|
parser?: Parser<T>;
|
|
15
|
+
options?: ParserOptions;
|
|
15
16
|
}): string;
|
|
16
17
|
abstract clone(): Expression<T>;
|
|
17
18
|
children(): Renderable[];
|
|
18
19
|
length(): number;
|
|
19
|
-
|
|
20
|
+
toJson(): {
|
|
21
|
+
$type: string;
|
|
20
22
|
children: any[];
|
|
21
23
|
};
|
|
24
|
+
resolve(parser: any): any;
|
|
22
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Parser } from '../../../types';
|
|
1
|
+
import { Parser, ParserOptions } from '../../../types';
|
|
2
2
|
import type { QueryCustomType } from '../builder';
|
|
3
3
|
import { Expression } from './base';
|
|
4
4
|
import { ODataFunctions, ODataOperators, Renderable } from './syntax';
|
|
@@ -12,12 +12,23 @@ export declare class ComputeExpression<T> extends Expression<T> {
|
|
|
12
12
|
children?: Renderable[];
|
|
13
13
|
names?: string[];
|
|
14
14
|
});
|
|
15
|
+
get [Symbol.toStringTag](): string;
|
|
15
16
|
static compute<T>(opts: (builder: ComputeExpressionBuilder<T>, current?: ComputeExpression<T>) => ComputeExpression<T>, current?: ComputeExpression<T>): ComputeExpression<T>;
|
|
16
|
-
|
|
17
|
+
toJson(): {
|
|
18
|
+
$type: string;
|
|
19
|
+
children: any[];
|
|
20
|
+
} & {
|
|
21
|
+
names: string[];
|
|
22
|
+
};
|
|
23
|
+
static fromJson<T>(json: {
|
|
24
|
+
[name: string]: any;
|
|
25
|
+
}): ComputeExpression<T>;
|
|
26
|
+
render({ aliases, escape, prefix, parser, options, }?: {
|
|
17
27
|
aliases?: QueryCustomType[];
|
|
18
28
|
escape?: boolean;
|
|
19
29
|
prefix?: string;
|
|
20
30
|
parser?: Parser<T>;
|
|
31
|
+
options?: ParserOptions;
|
|
21
32
|
}): string;
|
|
22
33
|
clone(): ComputeExpression<T>;
|
|
23
34
|
private _add;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Parser } from '../../../types';
|
|
1
|
+
import { Parser, ParserOptions } from '../../../types';
|
|
2
2
|
import type { QueryCustomType } from '../builder';
|
|
3
3
|
import { Expression } from './base';
|
|
4
4
|
import { FilterExpression, FilterExpressionBuilder } from './filter';
|
|
@@ -10,17 +10,19 @@ export declare class CountField<T> implements Renderable {
|
|
|
10
10
|
[name: string]: any;
|
|
11
11
|
});
|
|
12
12
|
get [Symbol.toStringTag](): string;
|
|
13
|
-
|
|
13
|
+
toJson(): {
|
|
14
14
|
field: any;
|
|
15
15
|
};
|
|
16
|
-
render({ aliases, escape, prefix, parser, }: {
|
|
16
|
+
render({ aliases, escape, prefix, parser, options, }: {
|
|
17
17
|
aliases?: QueryCustomType[];
|
|
18
18
|
escape?: boolean;
|
|
19
19
|
prefix?: string;
|
|
20
20
|
parser?: Parser<T>;
|
|
21
|
+
options?: ParserOptions;
|
|
21
22
|
}): string;
|
|
22
23
|
filter(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>): any;
|
|
23
24
|
clone(): CountField<T>;
|
|
25
|
+
resolve(parser: any): any;
|
|
24
26
|
private option;
|
|
25
27
|
}
|
|
26
28
|
export type CountExpressionBuilder<T> = {
|
|
@@ -31,13 +33,22 @@ export declare class CountExpression<T> extends Expression<T> {
|
|
|
31
33
|
constructor({ children, }?: {
|
|
32
34
|
children?: Renderable[];
|
|
33
35
|
});
|
|
36
|
+
get [Symbol.toStringTag](): string;
|
|
34
37
|
static count<T>(opts: (builder: CountExpressionBuilder<T>, current?: CountExpression<T>) => CountExpression<T>, current?: CountExpression<T>): CountExpression<T>;
|
|
35
38
|
private _add;
|
|
36
|
-
|
|
39
|
+
toJson(): {
|
|
40
|
+
$type: string;
|
|
41
|
+
children: any[];
|
|
42
|
+
};
|
|
43
|
+
static fromJson<T>(json: {
|
|
44
|
+
[name: string]: any;
|
|
45
|
+
}): CountExpression<T>;
|
|
46
|
+
render({ aliases, escape, prefix, parser, options, }?: {
|
|
37
47
|
aliases?: QueryCustomType[];
|
|
38
48
|
escape?: boolean;
|
|
39
49
|
prefix?: string;
|
|
40
50
|
parser?: Parser<T>;
|
|
51
|
+
options?: ParserOptions;
|
|
41
52
|
}): string;
|
|
42
53
|
clone(): CountExpression<T>;
|
|
43
54
|
field<F>(field: F[], opts?: (e: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Parser } from '../../../types';
|
|
1
|
+
import { Parser, ParserOptions } from '../../../types';
|
|
2
2
|
import type { QueryCustomType, Unpacked } from '../builder';
|
|
3
3
|
import { Expression } from './base';
|
|
4
4
|
import { FilterExpression, FilterExpressionBuilder } from './filter';
|
|
@@ -13,16 +13,18 @@ export declare class ExpandField<T> implements Renderable {
|
|
|
13
13
|
[name: string]: any;
|
|
14
14
|
});
|
|
15
15
|
get [Symbol.toStringTag](): string;
|
|
16
|
-
|
|
16
|
+
toJson(): {
|
|
17
17
|
field: any;
|
|
18
18
|
};
|
|
19
|
-
render({ aliases, escape, prefix, parser, }: {
|
|
19
|
+
render({ aliases, escape, prefix, parser, options, }: {
|
|
20
20
|
aliases?: QueryCustomType[];
|
|
21
21
|
escape?: boolean;
|
|
22
22
|
prefix?: string;
|
|
23
23
|
parser?: Parser<T>;
|
|
24
|
+
options?: ParserOptions;
|
|
24
25
|
}): string;
|
|
25
26
|
clone(): ExpandField<T>;
|
|
27
|
+
resolve(parser: any): any;
|
|
26
28
|
select<T>(opts: (builder: SelectExpressionBuilder<T>, current?: SelectExpression<T>) => SelectExpression<T>): SelectExpression<T>;
|
|
27
29
|
expand<T>(opts: (builder: ExpandExpressionBuilder<T>, current?: ExpandExpression<T>) => ExpandExpression<T>): ExpandExpression<T>;
|
|
28
30
|
filter<T>(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>): FilterExpression<T>;
|
|
@@ -42,12 +44,21 @@ export declare class ExpandExpression<T> extends Expression<T> {
|
|
|
42
44
|
constructor({ children, }?: {
|
|
43
45
|
children?: Renderable[];
|
|
44
46
|
});
|
|
47
|
+
get [Symbol.toStringTag](): string;
|
|
45
48
|
static expand<T>(opts: (builder: ExpandExpressionBuilder<T>, current?: ExpandExpression<T>) => ExpandExpression<T>, current?: ExpandExpression<T>): ExpandExpression<T>;
|
|
46
|
-
|
|
49
|
+
toJson(): {
|
|
50
|
+
$type: string;
|
|
51
|
+
children: any[];
|
|
52
|
+
};
|
|
53
|
+
static fromJson<T>(json: {
|
|
54
|
+
[name: string]: any;
|
|
55
|
+
}): ExpandExpression<T>;
|
|
56
|
+
render({ aliases, escape, prefix, parser, options, }?: {
|
|
47
57
|
aliases?: QueryCustomType[];
|
|
48
58
|
escape?: boolean;
|
|
49
59
|
prefix?: string;
|
|
50
60
|
parser?: Parser<T>;
|
|
61
|
+
options?: ParserOptions;
|
|
51
62
|
}): string;
|
|
52
63
|
clone(): ExpandExpression<T>;
|
|
53
64
|
private _add;
|