angular-odata 0.115.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/index.mjs +2 -2
- package/esm2020/lib/loaders.mjs +33 -0
- package/esm2020/lib/models/collection.mjs +4 -3
- package/esm2020/lib/models/model.mjs +10 -2
- package/esm2020/lib/models/options.mjs +3 -1
- package/esm2020/lib/module.mjs +21 -17
- package/esm2020/lib/options.mjs +4 -3
- package/esm2020/lib/resources/responses/annotations.mjs +1 -1
- package/esm2020/lib/resources/types/action.mjs +12 -1
- package/esm2020/lib/resources/types/batch.mjs +133 -29
- package/esm2020/lib/resources/types/function.mjs +12 -1
- package/esm2020/lib/resources/types/navigation-property.mjs +1 -1
- package/esm2020/lib/resources/types/options.mjs +1 -1
- package/esm2020/lib/resources/types/property.mjs +2 -4
- package/esm2020/lib/schema/parsers/enum-type.mjs +1 -1
- package/esm2020/lib/schema/parsers/structured-type.mjs +1 -1
- 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 +268 -95
- package/fesm2015/angular-odata.mjs.map +1 -1
- package/fesm2020/angular-odata.mjs +270 -95
- package/fesm2020/angular-odata.mjs.map +1 -1
- package/lib/client.d.ts +5 -2
- package/lib/index.d.ts +1 -1
- package/lib/loaders.d.ts +15 -0
- package/lib/models/model.d.ts +2 -2
- package/lib/models/options.d.ts +1 -1
- package/lib/module.d.ts +12 -6
- package/lib/options.d.ts +4 -0
- package/lib/resources/types/action.d.ts +19 -2
- package/lib/resources/types/batch.d.ts +16 -5
- package/lib/resources/types/function.d.ts +17 -2
- package/lib/resources/types/options.d.ts +0 -3
- package/lib/schema/parsers/structured-type.d.ts +1 -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/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
|
+
}
|
package/lib/models/model.d.ts
CHANGED
|
@@ -162,8 +162,8 @@ export declare class ODataModel<T> {
|
|
|
162
162
|
* @returns The result of the context
|
|
163
163
|
*/
|
|
164
164
|
asEntity<R>(ctx: (model: this) => R): R;
|
|
165
|
-
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>;
|
|
166
|
-
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>;
|
|
167
167
|
cast<S>(type: string): ODataModel<S>;
|
|
168
168
|
fetchNavigationProperty<S>(name: keyof T | string, responseType: 'model' | 'collection', { ...options }?: {} & ODataQueryArgumentsOptions<S>): Observable<ODataModel<S> | ODataCollection<S, ODataModel<S>> | null>;
|
|
169
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;
|
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
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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;
|
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