angular-odata 0.110.0 → 0.120.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 +26 -19
- package/esm2020/lib/constants.mjs +10 -5
- package/esm2020/lib/index.mjs +2 -2
- package/esm2020/lib/loaders.mjs +33 -0
- package/esm2020/lib/models/collection.mjs +43 -22
- package/esm2020/lib/models/model.mjs +41 -9
- package/esm2020/lib/models/options.mjs +15 -15
- package/esm2020/lib/module.mjs +21 -17
- package/esm2020/lib/options.mjs +4 -3
- 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/action.mjs +12 -1
- package/esm2020/lib/resources/types/batch.mjs +133 -29
- package/esm2020/lib/resources/types/entity-set.mjs +15 -15
- package/esm2020/lib/resources/types/function.mjs +12 -1
- package/esm2020/lib/resources/types/navigation-property.mjs +21 -19
- package/esm2020/lib/resources/types/options.mjs +1 -1
- package/esm2020/lib/resources/types/property.mjs +7 -4
- package/esm2020/lib/schema/parsers/edm.mjs +3 -3
- package/esm2020/lib/schema/parsers/enum-type.mjs +1 -1
- package/esm2020/lib/schema/parsers/structured-type.mjs +1 -1
- package/esm2020/lib/services/entity-set.mjs +4 -2
- package/esm2020/lib/services/factory.mjs +3 -3
- package/esm2020/lib/settings.mjs +2 -2
- package/esm2020/lib/types.mjs +1 -1
- package/esm2020/lib/utils/enums.mjs +21 -21
- package/esm2020/lib/utils/strings.mjs +2 -2
- package/fesm2015/angular-odata.mjs +513 -182
- package/fesm2015/angular-odata.mjs.map +1 -1
- package/fesm2020/angular-odata.mjs +513 -180
- package/fesm2020/angular-odata.mjs.map +1 -1
- package/lib/client.d.ts +5 -2
- package/lib/constants.d.ts +5 -3
- package/lib/index.d.ts +1 -1
- package/lib/loaders.d.ts +15 -0
- package/lib/models/collection.d.ts +17 -2
- package/lib/models/model.d.ts +16 -4
- package/lib/models/options.d.ts +2 -1
- package/lib/module.d.ts +12 -6
- package/lib/options.d.ts +8 -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/action.d.ts +19 -2
- package/lib/resources/types/batch.d.ts +16 -5
- package/lib/resources/types/entity-set.d.ts +5 -4
- package/lib/resources/types/function.d.ts +17 -2
- package/lib/resources/types/navigation-property.d.ts +9 -9
- package/lib/resources/types/options.d.ts +0 -3
- package/lib/schema/parsers/structured-type.d.ts +1 -1
- package/lib/services/entity-set.d.ts +6 -1
- package/lib/settings.d.ts +1 -1
- package/lib/types.d.ts +1 -0
- package/lib/utils/enums.d.ts +18 -6
- package/lib/utils/strings.d.ts +4 -1
- package/package.json +1 -1
- package/esm2020/lib/tokens.mjs +0 -3
- package/lib/tokens.d.ts +0 -3
package/lib/client.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { HttpClient, HttpEvent } from '@angular/common/http';
|
|
|
2
2
|
import { Injector } from '@angular/core';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { ODataApi } from './api';
|
|
5
|
+
import { ODataConfigLoader } from './loaders';
|
|
5
6
|
import { ODataCollection, ODataModel } from './models/index';
|
|
6
7
|
import { ODataActionResource, ODataBatchResource, ODataEntityResource, ODataEntitySetResource, ODataFunctionResource, ODataMetadataResource, ODataNavigationPropertyResource, ODataOptions, ODataResource, ODataResponse, ODataSegment, ODataSingletonResource } from './resources/index';
|
|
7
8
|
import { ODataEntityService } from './services/entity';
|
|
@@ -9,9 +10,10 @@ import { ODataSettings } from './settings';
|
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
10
11
|
export declare class ODataClient {
|
|
11
12
|
private http;
|
|
12
|
-
private
|
|
13
|
+
private loader;
|
|
13
14
|
private injector;
|
|
14
|
-
|
|
15
|
+
settings?: ODataSettings;
|
|
16
|
+
constructor(http: HttpClient, loader: ODataConfigLoader, injector: Injector);
|
|
15
17
|
/**
|
|
16
18
|
* Resolve the api for the given value.
|
|
17
19
|
* Where value is: string type or an string name or an instance of resource.
|
|
@@ -19,6 +21,7 @@ export declare class ODataClient {
|
|
|
19
21
|
* @returns The api for the value.
|
|
20
22
|
*/
|
|
21
23
|
apiFor(value?: ODataResource<any> | string): ODataApi;
|
|
24
|
+
defaultApi(): ODataApi;
|
|
22
25
|
/**
|
|
23
26
|
* Resolve the parser for the given string type.
|
|
24
27
|
* @param type The string type of the parser.
|
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;
|
package/lib/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export * from './types';
|
|
|
2
2
|
export * from './settings';
|
|
3
3
|
export * from './api';
|
|
4
4
|
export * from './client';
|
|
5
|
-
export * from './tokens';
|
|
6
5
|
export * from './module';
|
|
6
|
+
export * from './loaders';
|
|
7
7
|
export * from './utils/index';
|
|
8
8
|
export * from './services/index';
|
|
9
9
|
export * from './schema/index';
|
package/lib/loaders.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ApiConfig } from './types';
|
|
3
|
+
export declare abstract class ODataConfigLoader {
|
|
4
|
+
abstract loadConfigs(): Observable<ApiConfig[]>;
|
|
5
|
+
}
|
|
6
|
+
export declare class ODataConfigSyncLoader implements ODataConfigLoader {
|
|
7
|
+
private readonly passedConfigs;
|
|
8
|
+
constructor(passedConfigs: ApiConfig | ApiConfig[]);
|
|
9
|
+
loadConfigs(): Observable<ApiConfig[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare class ODataConfigAsyncLoader implements ODataConfigLoader {
|
|
12
|
+
private readonly configs$;
|
|
13
|
+
constructor(configs$: Observable<ApiConfig> | Observable<ApiConfig>[] | Observable<ApiConfig[]>);
|
|
14
|
+
loadConfigs(): Observable<ApiConfig[]>;
|
|
15
|
+
}
|
|
@@ -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,14 +155,15 @@ 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
|
|
150
162
|
* @returns The result of the context
|
|
151
163
|
*/
|
|
152
164
|
asEntity<R>(ctx: (model: this) => R): R;
|
|
153
|
-
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>;
|
|
154
|
-
callAction<P, R>(name: string, params: P | null, responseType
|
|
165
|
+
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>;
|
|
166
|
+
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>;
|
|
155
167
|
cast<S>(type: string): ODataModel<S>;
|
|
156
168
|
fetchNavigationProperty<S>(name: keyof T | string, responseType: 'model' | 'collection', { ...options }?: {} & ODataQueryArgumentsOptions<S>): Observable<ODataModel<S> | ODataCollection<S, ODataModel<S>> | null>;
|
|
157
169
|
getValue<P>(name: keyof T | string, options?: ODataOptions): Observable<P | ODataModel<P> | ODataCollection<P, ODataModel<P>> | null>;
|
package/lib/models/options.d.ts
CHANGED
|
@@ -136,7 +136,7 @@ export declare class ODataModelField<F> {
|
|
|
136
136
|
[name: string]: any;
|
|
137
137
|
}[];
|
|
138
138
|
reset?: boolean;
|
|
139
|
-
}):
|
|
139
|
+
}): ODataCollection<F, ODataModel<F>>;
|
|
140
140
|
}
|
|
141
141
|
export declare type ODataModelRelation<T> = {
|
|
142
142
|
state: ODataModelState;
|
|
@@ -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/module.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import {
|
|
1
|
+
import { InjectionToken, ModuleWithProviders, Provider } from '@angular/core';
|
|
2
|
+
import { ODataConfigSyncLoader } from './loaders';
|
|
3
3
|
import { ApiConfig } from './types';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
|
-
import * as i1 from "@angular/common
|
|
6
|
-
|
|
5
|
+
import * as i1 from "@angular/common";
|
|
6
|
+
import * as i2 from "@angular/common/http";
|
|
7
|
+
export interface PassedInitialConfig {
|
|
8
|
+
config?: ApiConfig | ApiConfig[];
|
|
9
|
+
loader?: Provider;
|
|
10
|
+
}
|
|
11
|
+
export declare const ODATA_CONFIG: InjectionToken<ApiConfig>;
|
|
12
|
+
export declare function createSyncLoader(passedConfig: PassedInitialConfig): ODataConfigSyncLoader;
|
|
7
13
|
export declare class ODataModule {
|
|
8
|
-
static forRoot(
|
|
14
|
+
static forRoot(passedConfig: PassedInitialConfig): ModuleWithProviders<ODataModule>;
|
|
9
15
|
static ɵfac: i0.ɵɵFactoryDeclaration<ODataModule, never>;
|
|
10
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<ODataModule, never, [typeof i1.HttpClientModule], never>;
|
|
16
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ODataModule, never, [typeof i1.CommonModule, typeof i2.HttpClientModule], never>;
|
|
11
17
|
static ɵinj: i0.ɵɵInjectorDeclaration<ODataModule>;
|
|
12
18
|
}
|
package/lib/options.d.ts
CHANGED
|
@@ -20,6 +20,10 @@ export declare class ODataApiOptions implements ApiOptions {
|
|
|
20
20
|
* Strip metadata from the response
|
|
21
21
|
*/
|
|
22
22
|
stripMetadata: ODataMetadataType;
|
|
23
|
+
/**
|
|
24
|
+
* Use JSON Batch Format
|
|
25
|
+
*/
|
|
26
|
+
jsonBatchFormat: boolean;
|
|
23
27
|
/**
|
|
24
28
|
* Cache fetch policy
|
|
25
29
|
*/
|
|
@@ -81,6 +85,10 @@ export declare class ODataApiOptions implements ApiOptions {
|
|
|
81
85
|
* @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
86
|
*/
|
|
83
87
|
includeAnnotations?: string;
|
|
88
|
+
/**
|
|
89
|
+
* @link https://devblogs.microsoft.com/odata/extension-omit-null-value-properties-in-asp-net-core-odata/
|
|
90
|
+
*/
|
|
91
|
+
omitNullValues?: boolean;
|
|
84
92
|
};
|
|
85
93
|
constructor(config: ApiOptions);
|
|
86
94
|
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
|
}
|
|
@@ -6,7 +6,7 @@ import { ODataPathSegments } from '../path';
|
|
|
6
6
|
import { ODataQueryOptions } from '../query';
|
|
7
7
|
import { ODataResource } from '../resource';
|
|
8
8
|
import { ODataEntities, ODataEntity, ODataProperty } from '../responses';
|
|
9
|
-
import { ODataEntitiesOptions, ODataEntityOptions,
|
|
9
|
+
import { ODataEntitiesOptions, ODataEntityOptions, ODataOptions, ODataPropertyOptions } from './options';
|
|
10
10
|
export declare class ODataActionResource<P, R> extends ODataResource<R> {
|
|
11
11
|
static factory<P, R>(api: ODataApi, { path, schema, segments, query, }: {
|
|
12
12
|
path?: string;
|
|
@@ -26,7 +26,18 @@ export declare class ODataActionResource<P, R> extends ODataResource<R> {
|
|
|
26
26
|
call(params: P | null, options?: ODataEntityOptions): Observable<ODataEntity<R>>;
|
|
27
27
|
call(params: P | null, options?: ODataEntitiesOptions): Observable<ODataEntities<R>>;
|
|
28
28
|
call(params: P | null, options?: ODataPropertyOptions): Observable<ODataProperty<R>>;
|
|
29
|
-
call(params: P | null, options?:
|
|
29
|
+
call(params: P | null, options?: {
|
|
30
|
+
alias?: boolean;
|
|
31
|
+
responseType?: 'blob';
|
|
32
|
+
} & ODataOptions): Observable<Blob>;
|
|
33
|
+
call(params: P | null, options?: {
|
|
34
|
+
alias?: boolean;
|
|
35
|
+
responseType?: 'arraybuffer';
|
|
36
|
+
} & ODataOptions): Observable<ArrayBuffer>;
|
|
37
|
+
call(params: P | null, options?: {
|
|
38
|
+
alias?: boolean;
|
|
39
|
+
responseType?: 'none';
|
|
40
|
+
} & ODataOptions): Observable<null>;
|
|
30
41
|
/**
|
|
31
42
|
* Execute the action and return the result as a property
|
|
32
43
|
* @param params Parameters for the action
|
|
@@ -62,4 +73,10 @@ export declare class ODataActionResource<P, R> extends ODataResource<R> {
|
|
|
62
73
|
* @returns Observable of the result of the action
|
|
63
74
|
*/
|
|
64
75
|
callCollection<M extends ODataModel<R>, C extends ODataCollection<R, M>>(params: P | null, options?: ODataOptions): Observable<C | null>;
|
|
76
|
+
callArraybuffer(params: P | null, { alias, ...options }?: {
|
|
77
|
+
alias?: boolean;
|
|
78
|
+
} & ODataOptions): Observable<ArrayBuffer>;
|
|
79
|
+
callBlob(params: P | null, { alias, ...options }?: {
|
|
80
|
+
alias?: boolean;
|
|
81
|
+
} & ODataOptions): Observable<Blob>;
|
|
65
82
|
}
|
|
@@ -7,8 +7,14 @@ import { ODataResponse } from '../responses';
|
|
|
7
7
|
import { ODataOptions } from './options';
|
|
8
8
|
export declare class ODataBatchRequest<T> extends Subject<HttpResponseBase> {
|
|
9
9
|
request: ODataRequest<any>;
|
|
10
|
+
id: string;
|
|
11
|
+
group: string;
|
|
10
12
|
constructor(request: ODataRequest<any>);
|
|
11
13
|
toString(): string;
|
|
14
|
+
toLegacy(): string;
|
|
15
|
+
toJson(): {
|
|
16
|
+
[name: string]: any;
|
|
17
|
+
};
|
|
12
18
|
onLoad(response: HttpResponseBase): void;
|
|
13
19
|
onError(response: HttpErrorResponse): void;
|
|
14
20
|
}
|
|
@@ -30,16 +36,21 @@ export declare class ODataBatchResource extends ODataResource<any> {
|
|
|
30
36
|
* @param ctx The context for the request
|
|
31
37
|
* @returns The result of execute the context
|
|
32
38
|
*/
|
|
33
|
-
add<R>(ctx: (batch: this) =>
|
|
34
|
-
send(options?: ODataOptions): Observable<
|
|
39
|
+
add<R>(ctx: (batch: this) => R): R;
|
|
40
|
+
send(options?: ODataOptions): Observable<ODataResponse<any>>;
|
|
41
|
+
private sendJson;
|
|
42
|
+
private sendLegacy;
|
|
35
43
|
/**
|
|
36
44
|
* Execute the batch request
|
|
37
45
|
* @param ctx The context for the request
|
|
38
46
|
* @param options The options of the batch request
|
|
39
47
|
* @returns The result of execute the context
|
|
40
48
|
*/
|
|
41
|
-
exec<R>(ctx: (batch: this) =>
|
|
49
|
+
exec<R>(ctx: (batch: this) => R, options?: ODataOptions): Observable<[R, ODataResponse<string>]>;
|
|
42
50
|
body(): string;
|
|
43
|
-
|
|
44
|
-
static
|
|
51
|
+
json(): Object;
|
|
52
|
+
static buildLegacyBody(batchBoundary: string, requests: ODataBatchRequest<any>[]): string;
|
|
53
|
+
static buildJsonBody(requests: ODataBatchRequest<any>[]): Object;
|
|
54
|
+
static parseLegacyResponse(requests: ODataBatchRequest<any>[], response: ODataResponse<string>): HttpResponseBase[];
|
|
55
|
+
static parseJsonResponse(requests: ODataBatchRequest<any>[], response: ODataResponse<any>): HttpResponseBase[];
|
|
45
56
|
}
|
|
@@ -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 & {
|
|
@@ -7,7 +7,7 @@ import { ODataPathSegments } from '../path';
|
|
|
7
7
|
import { ODataQueryOptions } from '../query';
|
|
8
8
|
import { ODataResource } from '../resource';
|
|
9
9
|
import { ODataEntities, ODataEntity, ODataProperty } from '../responses';
|
|
10
|
-
import { ODataEntitiesOptions, ODataEntityOptions,
|
|
10
|
+
import { ODataEntitiesOptions, ODataEntityOptions, ODataOptions, ODataPropertyOptions } from './options';
|
|
11
11
|
export declare class ODataFunctionResource<P, R> extends ODataResource<R> {
|
|
12
12
|
static factory<P, R>(api: ODataApi, { path, schema, segments, query, }: {
|
|
13
13
|
path?: string;
|
|
@@ -42,7 +42,16 @@ export declare class ODataFunctionResource<P, R> extends ODataResource<R> {
|
|
|
42
42
|
} & ODataPropertyOptions): Observable<ODataProperty<R>>;
|
|
43
43
|
call(params: P | null, options?: {
|
|
44
44
|
alias?: boolean;
|
|
45
|
-
|
|
45
|
+
responseType?: 'blob';
|
|
46
|
+
} & ODataOptions): Observable<Blob>;
|
|
47
|
+
call(params: P | null, options?: {
|
|
48
|
+
alias?: boolean;
|
|
49
|
+
responseType?: 'arraybuffer';
|
|
50
|
+
} & ODataOptions): Observable<ArrayBuffer>;
|
|
51
|
+
call(params: P | null, options?: {
|
|
52
|
+
alias?: boolean;
|
|
53
|
+
responseType?: 'none';
|
|
54
|
+
} & ODataOptions): Observable<null>;
|
|
46
55
|
/**
|
|
47
56
|
* Execute the function with the given parameters and return the result as a property
|
|
48
57
|
* @param params Parameters to be sent to the function
|
|
@@ -93,4 +102,10 @@ export declare class ODataFunctionResource<P, R> extends ODataResource<R> {
|
|
|
93
102
|
callCollection<M extends ODataModel<R>, C extends ODataCollection<R, M>>(params: P | null, { alias, ...options }?: {
|
|
94
103
|
alias?: boolean;
|
|
95
104
|
} & ODataOptions): Observable<C | null>;
|
|
105
|
+
callArraybuffer(params: P | null, { alias, ...options }?: {
|
|
106
|
+
alias?: boolean;
|
|
107
|
+
} & ODataOptions): Observable<ArrayBuffer>;
|
|
108
|
+
callBlob(params: P | null, { alias, ...options }?: {
|
|
109
|
+
alias?: boolean;
|
|
110
|
+
} & ODataOptions): Observable<Blob>;
|
|
96
111
|
}
|
|
@@ -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
|
}
|
|
@@ -24,9 +24,6 @@ export declare type ODataEntitiesOptions = ODataOptions & {
|
|
|
24
24
|
export declare type ODataPropertyOptions = ODataOptions & {
|
|
25
25
|
responseType?: 'property';
|
|
26
26
|
};
|
|
27
|
-
export declare type ODataNoneOptions = ODataOptions & {
|
|
28
|
-
responseType?: 'none';
|
|
29
|
-
};
|
|
30
27
|
export declare type ODataQueryArgumentsOptions<T> = ODataOptions & ODataQueryArguments<T>;
|
|
31
28
|
export declare type ODataActionOptions<T> = ODataQueryArgumentsOptions<T>;
|
|
32
29
|
export declare type ODataFunctionOptions<T> = ODataQueryArgumentsOptions<T> & {
|
|
@@ -100,7 +100,7 @@ export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable imple
|
|
|
100
100
|
findChildParser(predicate: (p: ODataStructuredTypeParser<any>) => boolean): ODataStructuredTypeParser<any> | undefined;
|
|
101
101
|
childParser(predicate: (p: ODataStructuredTypeParser<any>) => boolean): Parser<any>;
|
|
102
102
|
deserialize(value: any, options?: ParserOptions): T;
|
|
103
|
-
serialize(value: T
|
|
103
|
+
serialize(value: Partial<T>, options?: ParserOptions): any;
|
|
104
104
|
encode(value: T, options?: ParserOptions): any;
|
|
105
105
|
configure({ options, parserForType, findOptionsForType, }: {
|
|
106
106
|
options: ParserOptions;
|
|
@@ -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
|
/**
|
package/lib/settings.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { ODataEntityService } from './services/entity';
|
|
|
7
7
|
import { ApiConfig, Parser } from './types';
|
|
8
8
|
export declare class ODataSettings {
|
|
9
9
|
apis: ODataApi[];
|
|
10
|
-
constructor(
|
|
10
|
+
constructor(configs: ApiConfig[]);
|
|
11
11
|
configure(settings: {
|
|
12
12
|
requester?: (request: ODataRequest<any>) => Observable<any>;
|
|
13
13
|
}): void;
|
package/lib/types.d.ts
CHANGED
package/lib/utils/enums.d.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
export declare const Enums: {
|
|
2
|
-
names<E
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
names<E extends {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}>(enums: E): string[];
|
|
5
|
+
values<E_1 extends {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}>(enums: E_1): number[];
|
|
8
|
+
toValue<E_2 extends {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}>(enums: E_2, value: any): number | undefined;
|
|
11
|
+
toValues<E_3 extends {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}>(enums: E_3, value: any): number[];
|
|
14
|
+
toName<E_4 extends {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}>(enums: E_4, value: any): string | undefined;
|
|
17
|
+
toNames<E_5 extends {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}>(enums: E_5, value: any): string[];
|
|
8
20
|
};
|
package/lib/utils/strings.d.ts
CHANGED
package/package.json
CHANGED
package/esm2020/lib/tokens.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
|
2
|
-
export const ODATA_CONFIGURATIONS = new InjectionToken('odata.configuraions');
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvYW5ndWxhci1vZGF0YS9zcmMvbGliL3Rva2Vucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRS9DLE1BQU0sQ0FBQyxNQUFNLG9CQUFvQixHQUFHLElBQUksY0FBYyxDQUNwRCxxQkFBcUIsQ0FDdEIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEFwaUNvbmZpZyB9IGZyb20gJy4vdHlwZXMnO1xuaW1wb3J0IHsgSW5qZWN0aW9uVG9rZW4gfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuZXhwb3J0IGNvbnN0IE9EQVRBX0NPTkZJR1VSQVRJT05TID0gbmV3IEluamVjdGlvblRva2VuPEFwaUNvbmZpZz4oXG4gICdvZGF0YS5jb25maWd1cmFpb25zJ1xuKTtcbiJdfQ==
|
package/lib/tokens.d.ts
DELETED