angular-odata 0.124.0 → 0.125.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/esm2022/lib/constants.mjs +2 -1
- package/esm2022/lib/helper.mjs +2 -2
- package/esm2022/lib/models/collection.mjs +78 -91
- package/esm2022/lib/models/model.mjs +123 -97
- package/esm2022/lib/models/options.mjs +66 -46
- package/esm2022/lib/resources/query/expressions/count.mjs +1 -1
- package/esm2022/lib/resources/query/expressions/expand.mjs +1 -1
- package/esm2022/lib/resources/query/expressions/syntax.mjs +11 -2
- package/esm2022/lib/resources/responses/annotations.mjs +1 -1
- package/esm2022/lib/resources/responses/response.mjs +1 -1
- package/esm2022/lib/utils/enums.mjs +1 -1
- package/fesm2022/angular-odata.mjs +273 -228
- package/fesm2022/angular-odata.mjs.map +1 -1
- package/lib/constants.d.ts +1 -0
- package/lib/helper.d.ts +10 -10
- package/lib/models/collection.d.ts +4 -5
- package/lib/models/model.d.ts +8 -8
- package/lib/models/options.d.ts +28 -6
- package/lib/resources/responses/annotations.d.ts +9 -9
- package/lib/utils/enums.d.ts +7 -7
- package/package.json +1 -1
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,7 +22,7 @@ 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, }?: {
|
|
@@ -134,8 +133,8 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
|
|
|
134
133
|
silent?: boolean;
|
|
135
134
|
}): void;
|
|
136
135
|
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',
|
|
136
|
+
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>;
|
|
137
|
+
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
138
|
private _unlink;
|
|
140
139
|
private _link;
|
|
141
140
|
private _findEntry;
|
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, }?: {
|
|
@@ -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';
|
|
@@ -158,13 +157,14 @@ export declare class ODataModel<T> {
|
|
|
158
157
|
* @returns The result of the context
|
|
159
158
|
*/
|
|
160
159
|
asEntity<R>(ctx: (model: this) => R): R;
|
|
161
|
-
callFunction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none' | 'blob' | 'arraybuffer',
|
|
160
|
+
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
161
|
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
162
|
cast<S>(type: string): ODataModel<S>;
|
|
164
|
-
fetchNavigationProperty<S>(name: keyof T | string, responseType: 'model' | 'collection',
|
|
165
|
-
|
|
163
|
+
fetchNavigationProperty<S>(name: keyof T | string, responseType: 'model' | 'collection', options?: ODataQueryArgumentsOptions<S>): Observable<ODataModel<S> | ODataCollection<S, ODataModel<S>> | null>;
|
|
164
|
+
fetchAttribute<P>(name: keyof T | string, options?: ODataQueryArgumentsOptions<P>): Observable<P | ODataModel<P> | ODataCollection<P, ODataModel<P>> | null>;
|
|
165
|
+
getAttribute<P>(name: keyof T | string): P | ODataModel<P> | ODataCollection<P, ODataModel<P>> | null | undefined;
|
|
166
|
+
setAttribute<N>(name: keyof T | string, model: ODataModel<N> | ODataCollection<N, ODataModel<N>> | null, options?: ODataOptions): Observable<this>;
|
|
166
167
|
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
168
|
get [Symbol.toStringTag](): string;
|
|
169
169
|
equals(other: ODataModel<T>): boolean;
|
|
170
170
|
collection(): ODataCollection<T, ODataModel<T>> | undefined;
|
package/lib/models/options.d.ts
CHANGED
|
@@ -18,33 +18,54 @@ export declare enum ODataModelEventType {
|
|
|
18
18
|
Attach = "attach"
|
|
19
19
|
}
|
|
20
20
|
export declare class ODataModelEvent<T> {
|
|
21
|
-
name: ODataModelEventType;
|
|
21
|
+
name: ODataModelEventType | string;
|
|
22
22
|
value?: any;
|
|
23
23
|
previous?: any;
|
|
24
24
|
options?: any;
|
|
25
|
-
constructor(name: ODataModelEventType, { model, collection, previous, value, attr, options, }?: {
|
|
25
|
+
constructor(name: ODataModelEventType | string, { model, collection, previous, value, attr, options, bubbly, 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
|
+
bubbly?: 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
|
+
bubbly: 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, bubbly, }?: {
|
|
61
|
+
collection?: ODataCollection<T, ODataModel<T>>;
|
|
62
|
+
attr?: ODataModelAttribute<any> | number;
|
|
63
|
+
previous?: any;
|
|
64
|
+
value?: any;
|
|
65
|
+
options?: any;
|
|
66
|
+
bubbly?: boolean;
|
|
67
|
+
}): void;
|
|
68
|
+
}
|
|
48
69
|
export declare const INCLUDE_SHALLOW: {
|
|
49
70
|
include_concurrency: boolean;
|
|
50
71
|
include_computed: boolean;
|
|
@@ -154,7 +175,7 @@ export declare class ODataModelAttribute<T> {
|
|
|
154
175
|
private value?;
|
|
155
176
|
private change?;
|
|
156
177
|
private subscription?;
|
|
157
|
-
events$:
|
|
178
|
+
events$: ODataModelEventEmitter<T>;
|
|
158
179
|
constructor(_model: ODataModel<any>, _field: ODataModelField<T>);
|
|
159
180
|
get navigation(): boolean;
|
|
160
181
|
get computed(): boolean | undefined;
|
|
@@ -190,6 +211,7 @@ export declare class ODataModelOptions<T> {
|
|
|
190
211
|
entitySet?: ODataEntitySet;
|
|
191
212
|
parent?: ODataModelOptions<any>;
|
|
192
213
|
children: ODataModelOptions<any>[];
|
|
214
|
+
events$: ODataModelEventEmitter<T>;
|
|
193
215
|
constructor({ options, schema, }: {
|
|
194
216
|
options: ModelOptions;
|
|
195
217
|
schema: ODataStructuredType<T>;
|
|
@@ -6,33 +6,33 @@ export declare abstract class ODataAnnotations<T> {
|
|
|
6
6
|
protected context?: ODataContext | undefined;
|
|
7
7
|
constructor(helper: ODataVersionHelper, annotations?: Map<string, any>, context?: ODataContext | undefined);
|
|
8
8
|
attributes(data: {
|
|
9
|
-
[
|
|
9
|
+
[name: string]: any;
|
|
10
10
|
}, metadata: ODataMetadataType): Partial<T>;
|
|
11
11
|
update(data: {
|
|
12
|
-
[
|
|
12
|
+
[name: string]: any;
|
|
13
13
|
}): void;
|
|
14
14
|
get entitySet(): string | undefined;
|
|
15
15
|
get type(): string | undefined;
|
|
16
16
|
abstract union(other: ODataAnnotations<any>): ODataAnnotations<any>;
|
|
17
17
|
abstract clone(): ODataAnnotations<any>;
|
|
18
18
|
abstract data(data: {
|
|
19
|
-
[
|
|
19
|
+
[name: string]: any;
|
|
20
20
|
}): {
|
|
21
|
-
[
|
|
21
|
+
[name: string]: any;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
export declare class ODataPropertyAnnotations<T> extends ODataAnnotations<T> {
|
|
25
25
|
union(other: ODataPropertyAnnotations<any>): ODataPropertyAnnotations<any>;
|
|
26
26
|
clone(): ODataPropertyAnnotations<any>;
|
|
27
27
|
data(data: {
|
|
28
|
-
[
|
|
28
|
+
[name: string]: any;
|
|
29
29
|
}): any;
|
|
30
30
|
}
|
|
31
31
|
export declare class ODataEntityAnnotations<T> extends ODataAnnotations<T> {
|
|
32
32
|
union(other: ODataEntityAnnotations<any>): ODataEntityAnnotations<any>;
|
|
33
33
|
clone(): ODataEntityAnnotations<any>;
|
|
34
34
|
data(data: {
|
|
35
|
-
[
|
|
35
|
+
[name: string]: any;
|
|
36
36
|
}): any;
|
|
37
37
|
get id(): string | undefined;
|
|
38
38
|
get etag(): string | undefined;
|
|
@@ -49,7 +49,7 @@ export declare class ODataEntityAnnotations<T> extends ODataAnnotations<T> {
|
|
|
49
49
|
property<F>(name: keyof T, type: 'single'): ODataEntityAnnotations<F>;
|
|
50
50
|
private _functions?;
|
|
51
51
|
get functions(): {
|
|
52
|
-
[
|
|
52
|
+
[name: string]: any;
|
|
53
53
|
};
|
|
54
54
|
function(name: string): any;
|
|
55
55
|
}
|
|
@@ -57,7 +57,7 @@ export declare class ODataEntitiesAnnotations<T> extends ODataAnnotations<T> {
|
|
|
57
57
|
union(other: ODataEntitiesAnnotations<any>): ODataEntitiesAnnotations<any>;
|
|
58
58
|
clone(): ODataEntitiesAnnotations<any>;
|
|
59
59
|
data(data: {
|
|
60
|
-
[
|
|
60
|
+
[name: string]: any;
|
|
61
61
|
}): any;
|
|
62
62
|
get readLink(): string | undefined;
|
|
63
63
|
get count(): number | undefined;
|
|
@@ -68,7 +68,7 @@ export declare class ODataEntitiesAnnotations<T> extends ODataAnnotations<T> {
|
|
|
68
68
|
get skiptoken(): string | undefined;
|
|
69
69
|
private _functions?;
|
|
70
70
|
get functions(): {
|
|
71
|
-
[
|
|
71
|
+
[name: string]: any;
|
|
72
72
|
};
|
|
73
73
|
function(name: string): any;
|
|
74
74
|
}
|
package/lib/utils/enums.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export declare const Enums: {
|
|
2
2
|
names<E extends {
|
|
3
|
-
[
|
|
3
|
+
[name: string]: any;
|
|
4
4
|
}>(enums: E): string[];
|
|
5
5
|
values<E_1 extends {
|
|
6
|
-
[
|
|
6
|
+
[name: string]: any;
|
|
7
7
|
}>(enums: E_1): number[];
|
|
8
8
|
toValue<E_2 extends {
|
|
9
|
-
[
|
|
9
|
+
[name: string]: any;
|
|
10
10
|
}>(enums: E_2, value: any): number | undefined;
|
|
11
11
|
toValues<E_3 extends {
|
|
12
|
-
[
|
|
12
|
+
[name: string]: any;
|
|
13
13
|
}>(enums: E_3, value: any): number[];
|
|
14
14
|
toName<E_4 extends {
|
|
15
|
-
[
|
|
15
|
+
[name: string]: any;
|
|
16
16
|
}>(enums: E_4, value: any): string | undefined;
|
|
17
17
|
toNames<E_5 extends {
|
|
18
|
-
[
|
|
18
|
+
[name: string]: any;
|
|
19
19
|
}>(enums: E_5, value: any): string[];
|
|
20
20
|
toFlags<E_6 extends {
|
|
21
|
-
[
|
|
21
|
+
[name: string]: any;
|
|
22
22
|
}>(enums: E_6, value: any): string[];
|
|
23
23
|
};
|