angular-odata 0.120.0 → 0.121.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 +4 -2
- package/esm2020/lib/api.mjs +7 -7
- package/esm2020/lib/cache/cache.mjs +3 -3
- package/esm2020/lib/client.mjs +14 -15
- package/esm2020/lib/models/collection.mjs +76 -46
- package/esm2020/lib/models/model.mjs +26 -8
- package/esm2020/lib/models/options.mjs +97 -39
- package/esm2020/lib/module.mjs +4 -4
- package/esm2020/lib/options.mjs +1 -1
- package/esm2020/lib/resources/path/handlers.mjs +8 -8
- package/esm2020/lib/resources/path/segments.mjs +6 -6
- package/esm2020/lib/resources/query/builder.mjs +1 -1
- package/esm2020/lib/resources/query/expressions/count.mjs +5 -5
- package/esm2020/lib/resources/query/expressions/expand.mjs +18 -18
- package/esm2020/lib/resources/query/handlers.mjs +45 -45
- package/esm2020/lib/resources/query/options.mjs +27 -27
- package/esm2020/lib/resources/request.mjs +1 -1
- package/esm2020/lib/resources/resource.mjs +11 -9
- package/esm2020/lib/resources/types/action.mjs +5 -7
- package/esm2020/lib/resources/types/batch.mjs +3 -3
- package/esm2020/lib/resources/types/count.mjs +4 -4
- package/esm2020/lib/resources/types/entity-set.mjs +5 -7
- package/esm2020/lib/resources/types/entity.mjs +5 -5
- package/esm2020/lib/resources/types/function.mjs +5 -7
- package/esm2020/lib/resources/types/media.mjs +3 -3
- package/esm2020/lib/resources/types/metadata.mjs +3 -3
- package/esm2020/lib/resources/types/navigation-property.mjs +7 -9
- package/esm2020/lib/resources/types/property.mjs +5 -7
- package/esm2020/lib/resources/types/reference.mjs +3 -3
- package/esm2020/lib/resources/types/singleton.mjs +4 -4
- package/esm2020/lib/resources/types/value.mjs +3 -3
- package/esm2020/lib/schema/parsers/edm.mjs +18 -17
- package/esm2020/lib/schema/parsers/enum-type.mjs +1 -1
- package/esm2020/lib/schema/parsers/structured-type.mjs +31 -19
- package/esm2020/lib/schema/structured-type.mjs +7 -1
- package/esm2020/lib/services/factory.mjs +3 -3
- package/esm2020/lib/settings.mjs +1 -1
- package/esm2020/lib/types.mjs +101 -32
- package/esm2020/lib/utils/enums.mjs +2 -2
- package/fesm2015/angular-odata.mjs +510 -328
- package/fesm2015/angular-odata.mjs.map +1 -1
- package/fesm2020/angular-odata.mjs +510 -326
- package/fesm2020/angular-odata.mjs.map +1 -1
- package/lib/api.d.ts +3 -3
- package/lib/client.d.ts +4 -6
- package/lib/models/collection.d.ts +21 -13
- package/lib/models/model.d.ts +8 -3
- package/lib/models/options.d.ts +19 -6
- package/lib/options.d.ts +2 -2
- package/lib/resources/path/handlers.d.ts +2 -2
- package/lib/resources/path/segments.d.ts +2 -2
- package/lib/resources/query/builder.d.ts +4 -1
- package/lib/resources/query/handlers.d.ts +3 -3
- package/lib/resources/query/options.d.ts +21 -21
- package/lib/resources/request.d.ts +4 -4
- package/lib/resources/resource.d.ts +4 -6
- package/lib/resources/types/entity-set.d.ts +8 -8
- package/lib/resources/types/entity.d.ts +5 -5
- package/lib/resources/types/navigation-property.d.ts +11 -11
- package/lib/resources/types/property.d.ts +4 -4
- package/lib/resources/types/reference.d.ts +5 -5
- package/lib/resources/types/singleton.d.ts +5 -5
- package/lib/schema/parsers/edm.d.ts +2 -2
- package/lib/schema/parsers/enum-type.d.ts +2 -2
- package/lib/schema/parsers/structured-type.d.ts +7 -6
- package/lib/schema/structured-type.d.ts +3 -1
- package/lib/services/entity-set.d.ts +1 -6
- package/lib/settings.d.ts +2 -2
- package/lib/types.d.ts +45 -3
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
import { ODataApi } from '../../api';
|
|
3
3
|
import { ODataCollection, ODataModel } from '../../models';
|
|
4
4
|
import { ODataStructuredType } from '../../schema';
|
|
5
|
-
import {
|
|
5
|
+
import { QueryOption } from '../../types';
|
|
6
6
|
import { ODataPathSegments } from '../path';
|
|
7
7
|
import { ODataQueryOptions } from '../query';
|
|
8
8
|
import { ODataResource } from '../resource';
|
|
@@ -68,14 +68,14 @@ export declare class ODataPropertyResource<T> extends ODataResource<T> {
|
|
|
68
68
|
}): Observable<C | null>;
|
|
69
69
|
fetchOne(options?: ODataOptions & {
|
|
70
70
|
withCount?: boolean;
|
|
71
|
-
bodyQueryOptions?:
|
|
71
|
+
bodyQueryOptions?: QueryOption[];
|
|
72
72
|
}): Observable<{
|
|
73
73
|
entity: T | null;
|
|
74
74
|
annots: ODataEntitiesAnnotations<T>;
|
|
75
75
|
}>;
|
|
76
76
|
fetchMany(top: number, options?: ODataOptions & {
|
|
77
77
|
withCount?: boolean;
|
|
78
|
-
bodyQueryOptions?:
|
|
78
|
+
bodyQueryOptions?: QueryOption[];
|
|
79
79
|
}): Observable<{
|
|
80
80
|
entities: T[];
|
|
81
81
|
annots: ODataEntitiesAnnotations<T>;
|
|
@@ -87,7 +87,7 @@ export declare class ODataPropertyResource<T> extends ODataResource<T> {
|
|
|
87
87
|
*/
|
|
88
88
|
fetchAll(options?: ODataOptions & {
|
|
89
89
|
withCount?: boolean;
|
|
90
|
-
bodyQueryOptions?:
|
|
90
|
+
bodyQueryOptions?: QueryOption[];
|
|
91
91
|
}): Observable<{
|
|
92
92
|
entities: T[];
|
|
93
93
|
annots: ODataEntitiesAnnotations<T>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { ODataApi } from '../../api';
|
|
3
|
-
import {
|
|
3
|
+
import { QueryOption } from '../../types';
|
|
4
4
|
import { ODataPathSegments } from '../path';
|
|
5
5
|
import { ODataQueryOptions } from '../query';
|
|
6
6
|
import { ODataResource } from '../resource';
|
|
@@ -52,10 +52,10 @@ export declare class ODataReferenceResource<T> extends ODataResource<T> {
|
|
|
52
52
|
* @return An observable of the entity or entities with annotations
|
|
53
53
|
*/
|
|
54
54
|
fetch(options?: ODataEntityOptions & {
|
|
55
|
-
bodyQueryOptions?:
|
|
55
|
+
bodyQueryOptions?: QueryOption[];
|
|
56
56
|
}): Observable<ODataEntity<T>>;
|
|
57
57
|
fetch(options?: ODataEntitiesOptions & {
|
|
58
|
-
bodyQueryOptions?:
|
|
58
|
+
bodyQueryOptions?: QueryOption[];
|
|
59
59
|
}): Observable<ODataEntities<T>>;
|
|
60
60
|
/**
|
|
61
61
|
* Fetch the entity
|
|
@@ -63,7 +63,7 @@ export declare class ODataReferenceResource<T> extends ODataResource<T> {
|
|
|
63
63
|
* @returns The entity
|
|
64
64
|
*/
|
|
65
65
|
fetchEntity(options?: ODataOptions & {
|
|
66
|
-
bodyQueryOptions?:
|
|
66
|
+
bodyQueryOptions?: QueryOption[];
|
|
67
67
|
}): Observable<T | null>;
|
|
68
68
|
/**
|
|
69
69
|
* Fetch entities
|
|
@@ -71,6 +71,6 @@ export declare class ODataReferenceResource<T> extends ODataResource<T> {
|
|
|
71
71
|
* @returns The entities
|
|
72
72
|
*/
|
|
73
73
|
fetchEntities(options?: ODataOptions & {
|
|
74
|
-
bodyQueryOptions?:
|
|
74
|
+
bodyQueryOptions?: QueryOption[];
|
|
75
75
|
}): Observable<T[] | null>;
|
|
76
76
|
}
|
|
@@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
import { ODataApi } from '../../api';
|
|
3
3
|
import { ODataModel } from '../../models';
|
|
4
4
|
import { ODataStructuredType } from '../../schema';
|
|
5
|
-
import {
|
|
5
|
+
import { QueryOption } from '../../types';
|
|
6
6
|
import { ODataQueryOptions } from '../query';
|
|
7
7
|
import { ODataResource } from '../resource';
|
|
8
8
|
import { ODataEntity } from '../responses';
|
|
@@ -29,7 +29,7 @@ export declare class ODataSingletonResource<T> extends ODataResource<T> {
|
|
|
29
29
|
protected patch(attrs: Partial<T>, options?: ODataOptions): Observable<any>;
|
|
30
30
|
protected delete(options?: ODataOptions): Observable<any>;
|
|
31
31
|
protected get(options?: ODataOptions & {
|
|
32
|
-
bodyQueryOptions?:
|
|
32
|
+
bodyQueryOptions?: QueryOption[];
|
|
33
33
|
}): Observable<any>;
|
|
34
34
|
/**
|
|
35
35
|
* Creates a new entity.
|
|
@@ -64,7 +64,7 @@ export declare class ODataSingletonResource<T> extends ODataResource<T> {
|
|
|
64
64
|
* @returns Observable of the entity with the annotations.
|
|
65
65
|
*/
|
|
66
66
|
fetch(options?: ODataOptions & {
|
|
67
|
-
bodyQueryOptions?:
|
|
67
|
+
bodyQueryOptions?: QueryOption[];
|
|
68
68
|
}): Observable<ODataEntity<T>>;
|
|
69
69
|
/**
|
|
70
70
|
* Fetch an existing entity.
|
|
@@ -72,7 +72,7 @@ export declare class ODataSingletonResource<T> extends ODataResource<T> {
|
|
|
72
72
|
* @returns Observable of the entity.
|
|
73
73
|
*/
|
|
74
74
|
fetchEntity(options?: ODataOptions & {
|
|
75
|
-
bodyQueryOptions?:
|
|
75
|
+
bodyQueryOptions?: QueryOption[];
|
|
76
76
|
}): Observable<T | null>;
|
|
77
77
|
/**
|
|
78
78
|
* Fetch an existing entity and return a model.
|
|
@@ -80,6 +80,6 @@ export declare class ODataSingletonResource<T> extends ODataResource<T> {
|
|
|
80
80
|
* @returns Observable of the entity.
|
|
81
81
|
*/
|
|
82
82
|
fetchModel<M extends ODataModel<T>>(options?: ODataOptions & {
|
|
83
|
-
bodyQueryOptions?:
|
|
83
|
+
bodyQueryOptions?: QueryOption[];
|
|
84
84
|
}): Observable<M | null>;
|
|
85
85
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnumTypeConfig, EnumTypeFieldConfig, ParserOptions, Parser } from '../../types';
|
|
1
|
+
import { EnumTypeConfig, EnumTypeFieldConfig, ParserOptions, Parser, FieldParser } from '../../types';
|
|
2
2
|
import { ODataAnnotatable } from '../annotation';
|
|
3
3
|
export declare class ODataEnumTypeFieldParser<E> extends ODataAnnotatable {
|
|
4
4
|
name: string;
|
|
@@ -6,7 +6,7 @@ export declare class ODataEnumTypeFieldParser<E> extends ODataAnnotatable {
|
|
|
6
6
|
constructor(name: string, field: EnumTypeFieldConfig<E>);
|
|
7
7
|
titleize(term?: string | RegExp): string;
|
|
8
8
|
}
|
|
9
|
-
export declare class ODataEnumTypeParser<E> extends ODataAnnotatable implements
|
|
9
|
+
export declare class ODataEnumTypeParser<E> extends ODataAnnotatable implements FieldParser<E> {
|
|
10
10
|
name: string;
|
|
11
11
|
namespace: string;
|
|
12
12
|
alias?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParserOptions, Parser, StructuredTypeConfig, StructuredTypeFieldConfig } from '../../types';
|
|
1
|
+
import { ParserOptions, Parser, StructuredTypeConfig, StructuredTypeFieldConfig, FieldParser, EdmType } from '../../types';
|
|
2
2
|
import { ODataAnnotatable } from '../annotation';
|
|
3
3
|
import { ODataEnumTypeParser } from './enum-type';
|
|
4
4
|
declare type JsonSchemaSelect<T> = Array<keyof T>;
|
|
@@ -33,16 +33,16 @@ export declare class ODataReferential {
|
|
|
33
33
|
referencedProperty: string;
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
export declare class ODataStructuredTypeFieldParser<T> extends ODataAnnotatable implements
|
|
36
|
+
export declare class ODataStructuredTypeFieldParser<T> extends ODataAnnotatable implements FieldParser<T> {
|
|
37
37
|
name: string;
|
|
38
38
|
private structuredType;
|
|
39
|
-
type: string;
|
|
39
|
+
type: string | EdmType;
|
|
40
40
|
private parser;
|
|
41
|
-
default?: any;
|
|
42
|
-
maxLength?: number;
|
|
43
41
|
collection: boolean;
|
|
44
|
-
nullable: boolean;
|
|
45
42
|
navigation: boolean;
|
|
43
|
+
nullable?: boolean;
|
|
44
|
+
default?: any;
|
|
45
|
+
maxLength?: number;
|
|
46
46
|
precision?: number;
|
|
47
47
|
scale?: number | 'variable';
|
|
48
48
|
referentials: ODataReferential[];
|
|
@@ -88,6 +88,7 @@ export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable imple
|
|
|
88
88
|
private _fields;
|
|
89
89
|
parserOptions?: ParserOptions;
|
|
90
90
|
constructor(config: StructuredTypeConfig<T>, namespace: string, alias?: string);
|
|
91
|
+
addField<F>(name: string, config: StructuredTypeFieldConfig): ODataStructuredTypeFieldParser<F>;
|
|
91
92
|
/**
|
|
92
93
|
* Create a nicer looking title.
|
|
93
94
|
* Titleize is meant for creating pretty output.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ODataCollection } from '../models';
|
|
2
2
|
import { ODataModel } from '../models/model';
|
|
3
|
-
import { Parser, ParserOptions, StructuredTypeConfig } from '../types';
|
|
3
|
+
import { Parser, ParserOptions, StructuredTypeConfig, StructuredTypeFieldConfig } from '../types';
|
|
4
4
|
import { ODataSchemaElement } from './element';
|
|
5
5
|
import { JsonSchemaOptions, ODataEntityTypeKey, ODataStructuredTypeFieldParser, ODataStructuredTypeParser } from './parsers';
|
|
6
6
|
import { ODataSchema } from './schema';
|
|
@@ -40,12 +40,14 @@ export declare class ODataStructuredType<T> extends ODataSchemaElement {
|
|
|
40
40
|
* @returns True if the structured type has a compound key.
|
|
41
41
|
*/
|
|
42
42
|
isCompoundKey(): boolean;
|
|
43
|
+
isOpenType(): boolean;
|
|
43
44
|
/**
|
|
44
45
|
* Find the field parser for the given field name.
|
|
45
46
|
* @param name Name of the field
|
|
46
47
|
* @returns The field parser
|
|
47
48
|
*/
|
|
48
49
|
field<F>(name: keyof T): ODataStructuredTypeFieldParser<F>;
|
|
50
|
+
addField<F>(name: string, config: StructuredTypeFieldConfig): ODataStructuredTypeFieldParser<F>;
|
|
49
51
|
/**
|
|
50
52
|
* Find a parent schema of the structured type.
|
|
51
53
|
* @param predicate Function for evaluate the schemas in the hierarchy.
|
|
@@ -28,12 +28,7 @@ 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[];
|
|
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
|
-
*/
|
|
31
|
+
entities: T[];
|
|
37
32
|
annots: import("../resources").ODataEntitiesAnnotations<T>;
|
|
38
33
|
}>;
|
|
39
34
|
/**
|
package/lib/settings.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ODataCollection, ODataModel } from './models';
|
|
|
4
4
|
import { ODataRequest } from './resources';
|
|
5
5
|
import { ODataCallable, ODataEntitySet, ODataEnumType, ODataStructuredType } from './schema';
|
|
6
6
|
import { ODataEntityService } from './services/entity';
|
|
7
|
-
import { ApiConfig, Parser } from './types';
|
|
7
|
+
import { ApiConfig, EdmType, Parser } from './types';
|
|
8
8
|
export declare class ODataSettings {
|
|
9
9
|
apis: ODataApi[];
|
|
10
10
|
constructor(configs: ApiConfig[]);
|
|
@@ -21,7 +21,7 @@ export declare class ODataSettings {
|
|
|
21
21
|
structuredTypeForType<T>(type: string): ODataStructuredType<T>;
|
|
22
22
|
callableForType<T>(type: string, bindingType?: string): ODataCallable<T>;
|
|
23
23
|
entitySetForType(type: string): ODataEntitySet;
|
|
24
|
-
parserForType<T>(type: string): Parser<T>;
|
|
24
|
+
parserForType<T>(type: string | EdmType): Parser<T>;
|
|
25
25
|
modelForType(type: string): typeof ODataModel;
|
|
26
26
|
collectionForType(type: string): typeof ODataCollection;
|
|
27
27
|
serviceForType(type: string): typeof ODataEntityService;
|
package/lib/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare type ODataVersion = '2.0' | '3.0' | '4.0';
|
|
|
3
3
|
export declare type FetchPolicy = 'cache-first' | 'cache-and-network' | 'network-only' | 'no-cache' | 'cache-only';
|
|
4
4
|
export declare type ODataMetadataType = 'minimal' | 'full' | 'none';
|
|
5
5
|
export declare type CacheCacheability = 'public' | 'private' | 'no-cache' | 'no-store';
|
|
6
|
-
export declare enum
|
|
6
|
+
export declare enum PathSegment {
|
|
7
7
|
batch = "batch",
|
|
8
8
|
metadata = "metadata",
|
|
9
9
|
entitySet = "entitySet",
|
|
@@ -17,7 +17,7 @@ export declare enum PathSegmentNames {
|
|
|
17
17
|
function = "function",
|
|
18
18
|
action = "action"
|
|
19
19
|
}
|
|
20
|
-
export declare enum
|
|
20
|
+
export declare enum QueryOption {
|
|
21
21
|
select = "select",
|
|
22
22
|
expand = "expand",
|
|
23
23
|
compute = "compute",
|
|
@@ -32,6 +32,41 @@ export declare enum QueryOptionNames {
|
|
|
32
32
|
levels = "levels",
|
|
33
33
|
count = "count"
|
|
34
34
|
}
|
|
35
|
+
export declare enum EdmType {
|
|
36
|
+
Guid = "Edm.Guid",
|
|
37
|
+
Int16 = "Edm.Int16",
|
|
38
|
+
String = "Edm.String",
|
|
39
|
+
Boolean = "Edm.Boolean",
|
|
40
|
+
Byte = "Edm.Byte",
|
|
41
|
+
SByte = "Edm.SByte",
|
|
42
|
+
Int32 = "Edm.Int32",
|
|
43
|
+
Int64 = "Edm.Int64",
|
|
44
|
+
Date = "Edm.Date",
|
|
45
|
+
TimeOfDay = "Edm.TimeOfDay",
|
|
46
|
+
DateTimeOffset = "Edm.DateTimeOffset",
|
|
47
|
+
Duration = "Edm.Duration",
|
|
48
|
+
Decimal = "Edm.Decimal",
|
|
49
|
+
Double = "Edm.Double",
|
|
50
|
+
Single = "Edm.Single",
|
|
51
|
+
Binary = "Edm.Binary",
|
|
52
|
+
Stream = "Edm.Stream",
|
|
53
|
+
Geography = "Edm.Geography",
|
|
54
|
+
GeographyPoint = "Edm.GeographyPoint",
|
|
55
|
+
GeographyLineString = "Edm.GeographyLineString",
|
|
56
|
+
GeographyPolygon = "Edm.GeographyPolygon",
|
|
57
|
+
GeographyMultiPoint = "Edm.GeographyMultiPoint",
|
|
58
|
+
GeographyMultiLineString = "Edm.GeographyMultiLineString",
|
|
59
|
+
GeographyMultiPolygon = "Edm.GeographyMultiPolygon",
|
|
60
|
+
GeographyCollection = "Edm.GeographyCollection",
|
|
61
|
+
Geometry = "Edm.Geometry",
|
|
62
|
+
GeometryPoint = "Edm.GeometryPoint",
|
|
63
|
+
GeometryLineString = "Edm.GeometryLineString",
|
|
64
|
+
GeometryPolygon = "Edm.GeometryPolygon",
|
|
65
|
+
GeometryMultiPoint = "Edm.GeometryMultiPoint",
|
|
66
|
+
GeometryMultiLineString = "Edm.GeometryMultiLineString",
|
|
67
|
+
GeometryMultiPolygon = "Edm.GeometryMultiPolygon",
|
|
68
|
+
GeometryCollection = "Edm.GeometryCollection"
|
|
69
|
+
}
|
|
35
70
|
export interface ApiOptions {
|
|
36
71
|
version?: ODataVersion;
|
|
37
72
|
params?: {
|
|
@@ -59,7 +94,7 @@ export interface ApiOptions {
|
|
|
59
94
|
};
|
|
60
95
|
stripMetadata?: ODataMetadataType;
|
|
61
96
|
fetchPolicy?: FetchPolicy;
|
|
62
|
-
bodyQueryOptions?:
|
|
97
|
+
bodyQueryOptions?: QueryOption[];
|
|
63
98
|
stringAsEnum?: boolean;
|
|
64
99
|
deleteRefBy?: 'path' | 'id';
|
|
65
100
|
nonParenthesisForEmptyParameterFunction?: boolean;
|
|
@@ -87,6 +122,13 @@ export interface Parser<T> {
|
|
|
87
122
|
serialize(value: any, options?: ParserOptions | StructuredTypeFieldOptions): any;
|
|
88
123
|
encode(value: any, options?: ParserOptions | StructuredTypeFieldOptions): any;
|
|
89
124
|
}
|
|
125
|
+
export interface FieldParser<T> extends Parser<T> {
|
|
126
|
+
nullable?: boolean;
|
|
127
|
+
default?: any;
|
|
128
|
+
maxLength?: number;
|
|
129
|
+
precision?: number;
|
|
130
|
+
scale?: number | 'variable';
|
|
131
|
+
}
|
|
90
132
|
export declare const NONE_PARSER: Parser<any>;
|
|
91
133
|
export interface Cache {
|
|
92
134
|
put<T>(key: string, payload: T, ...opts: any[]): void;
|