angular-odata 0.78.1 → 0.95.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 +133 -62
- package/{esm2015/angular-odata.js → esm2020/angular-odata.mjs} +0 -0
- package/esm2020/lib/api.mjs +303 -0
- package/{esm2015/lib/cache/cache.js → esm2020/lib/cache/cache.mjs} +12 -5
- package/{esm2015/lib/cache/index.js → esm2020/lib/cache/index.mjs} +0 -0
- package/{esm2015/lib/cache/memory.js → esm2020/lib/cache/memory.mjs} +0 -0
- package/{esm2015/lib/cache/storage.js → esm2020/lib/cache/storage.mjs} +1 -1
- package/esm2020/lib/client.mjs +271 -0
- package/{esm2015/lib/constants.js → esm2020/lib/constants.mjs} +9 -3
- package/esm2020/lib/helper.mjs +268 -0
- package/esm2020/lib/index.mjs +19 -0
- package/esm2020/lib/models/collection.mjs +741 -0
- package/{esm2015/lib/models/index.js → esm2020/lib/models/index.mjs} +0 -0
- package/esm2020/lib/models/model.mjs +453 -0
- package/esm2020/lib/models/options.mjs +945 -0
- package/{esm2015/lib/module.js → esm2020/lib/module.mjs} +6 -6
- package/esm2020/lib/options.mjs +32 -0
- package/esm2020/lib/resources/index.mjs +7 -0
- package/esm2020/lib/resources/path/handlers.mjs +69 -0
- package/esm2020/lib/resources/path/index.mjs +3 -0
- package/esm2020/lib/resources/path/segments.mjs +124 -0
- package/esm2020/lib/resources/query/builder.mjs +590 -0
- package/esm2020/lib/resources/query/expressions.mjs +207 -0
- package/esm2020/lib/resources/query/handlers.mjs +186 -0
- package/esm2020/lib/resources/query/index.mjs +4 -0
- package/esm2020/lib/resources/query/options.mjs +103 -0
- package/esm2020/lib/resources/query/syntax.mjs +406 -0
- package/esm2020/lib/resources/request.mjs +167 -0
- package/esm2020/lib/resources/resource.mjs +326 -0
- package/esm2020/lib/resources/responses/annotations.mjs +119 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-annotation.js → esm2020/lib/resources/responses/csdl/csdl-annotation.mjs} +0 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-entity-container.js → esm2020/lib/resources/responses/csdl/csdl-entity-container.mjs} +0 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-entity-set.js → esm2020/lib/resources/responses/csdl/csdl-entity-set.mjs} +0 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-enum-type.js → esm2020/lib/resources/responses/csdl/csdl-enum-type.mjs} +0 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-function-action.js → esm2020/lib/resources/responses/csdl/csdl-function-action.mjs} +0 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-navigation-property-binding.js → esm2020/lib/resources/responses/csdl/csdl-navigation-property-binding.mjs} +0 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-reference.js → esm2020/lib/resources/responses/csdl/csdl-reference.mjs} +0 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-schema.js → esm2020/lib/resources/responses/csdl/csdl-schema.mjs} +0 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-singleton.js → esm2020/lib/resources/responses/csdl/csdl-singleton.mjs} +0 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-structural-property.js → esm2020/lib/resources/responses/csdl/csdl-structural-property.mjs} +0 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-structured-type.js → esm2020/lib/resources/responses/csdl/csdl-structured-type.mjs} +0 -0
- package/{esm2015/lib/resources/responses/csdl/csdl-type-definition.js → esm2020/lib/resources/responses/csdl/csdl-type-definition.mjs} +0 -0
- package/{esm2015/lib/resources/responses/index.js → esm2020/lib/resources/responses/index.mjs} +0 -0
- package/esm2020/lib/resources/responses/metadata.mjs +547 -0
- package/{esm2015/lib/resources/responses/options.js → esm2020/lib/resources/responses/options.mjs} +1 -1
- package/esm2020/lib/resources/responses/response.mjs +170 -0
- package/{esm2015/lib/resources/responses/types.js → esm2020/lib/resources/responses/types.mjs} +1 -1
- package/esm2020/lib/resources/types/action.mjs +101 -0
- package/esm2020/lib/resources/types/batch.mjs +288 -0
- package/esm2020/lib/resources/types/count.mjs +27 -0
- package/esm2020/lib/resources/types/entity-set.mjs +94 -0
- package/esm2020/lib/resources/types/entity.mjs +106 -0
- package/esm2020/lib/resources/types/function.mjs +137 -0
- package/{esm2015/lib/resources/types/index.js → esm2020/lib/resources/types/index.mjs} +0 -0
- package/esm2020/lib/resources/types/media.mjs +41 -0
- package/esm2020/lib/resources/types/metadata.mjs +30 -0
- package/esm2020/lib/resources/types/navigation-property.mjs +226 -0
- package/esm2020/lib/resources/types/options.mjs +2 -0
- package/esm2020/lib/resources/types/property.mjs +183 -0
- package/esm2020/lib/resources/types/reference.mjs +85 -0
- package/esm2020/lib/resources/types/singleton.mjs +126 -0
- package/esm2020/lib/resources/types/value.mjs +41 -0
- package/esm2020/lib/schema/annotation.mjs +37 -0
- package/esm2020/lib/schema/callable.mjs +62 -0
- package/esm2020/lib/schema/element.mjs +51 -0
- package/esm2020/lib/schema/entity-container.mjs +9 -0
- package/esm2020/lib/schema/entity-set.mjs +9 -0
- package/esm2020/lib/schema/enum-type.mjs +71 -0
- package/{esm2015/lib/schema/index.js → esm2020/lib/schema/index.mjs} +2 -1
- package/esm2020/lib/schema/parsers/callable.mjs +113 -0
- package/esm2020/lib/schema/parsers/edm.mjs +95 -0
- package/esm2020/lib/schema/parsers/enum-type.mjs +107 -0
- package/esm2020/lib/schema/parsers/index.mjs +5 -0
- package/esm2020/lib/schema/parsers/structured-type.mjs +412 -0
- package/esm2020/lib/schema/schema.mjs +61 -0
- package/esm2020/lib/schema/structured-type.mjs +198 -0
- package/esm2020/lib/services/base.mjs +29 -0
- package/esm2020/lib/services/entity-set.mjs +143 -0
- package/esm2020/lib/services/entity.mjs +12 -0
- package/{esm2015/lib/services/factory.js → esm2020/lib/services/factory.mjs} +3 -3
- package/{esm2015/lib/services/index.js → esm2020/lib/services/index.mjs} +0 -0
- package/esm2020/lib/services/singleton.mjs +48 -0
- package/{esm2015/lib/settings.js → esm2020/lib/settings.mjs} +1 -1
- package/{esm2015/lib/tokens.js → esm2020/lib/tokens.mjs} +0 -0
- package/esm2020/lib/types.mjs +37 -0
- package/esm2020/lib/utils/arraybuffers.mjs +46 -0
- package/{esm2015/lib/utils/dates.js → esm2020/lib/utils/dates.mjs} +0 -0
- package/esm2020/lib/utils/durations.mjs +40 -0
- package/{esm2015/lib/utils/enums.js → esm2020/lib/utils/enums.mjs} +0 -0
- package/esm2020/lib/utils/http.mjs +93 -0
- package/esm2020/lib/utils/index.mjs +10 -0
- package/esm2020/lib/utils/objects.mjs +195 -0
- package/esm2020/lib/utils/odata.mjs +22 -0
- package/esm2020/lib/utils/strings.mjs +20 -0
- package/esm2020/lib/utils/types.mjs +134 -0
- package/{esm2015/lib/utils/urls.js → esm2020/lib/utils/urls.mjs} +0 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/fesm2015/{angular-odata.js → angular-odata.mjs} +5068 -3943
- package/fesm2015/angular-odata.mjs.map +1 -0
- package/fesm2020/angular-odata.mjs +10274 -0
- package/fesm2020/angular-odata.mjs.map +1 -0
- package/lib/api.d.ts +17 -16
- package/lib/cache/cache.d.ts +2 -2
- package/lib/client.d.ts +93 -18
- package/lib/constants.d.ts +6 -2
- package/lib/helper.d.ts +3 -3
- package/lib/index.d.ts +0 -1
- package/lib/models/collection.d.ts +36 -47
- package/lib/models/model.d.ts +47 -40
- package/lib/models/options.d.ts +53 -52
- package/lib/options.d.ts +50 -2
- package/lib/resources/index.d.ts +2 -3
- package/lib/resources/path/handlers.d.ts +27 -0
- package/lib/resources/path/index.d.ts +2 -0
- package/lib/resources/{path-segments.d.ts → path/segments.d.ts} +4 -16
- package/lib/resources/{builder.d.ts → query/builder.d.ts} +12 -7
- package/lib/resources/query/expressions.d.ts +63 -0
- package/lib/resources/query/handlers.d.ts +89 -0
- package/lib/resources/query/index.d.ts +3 -0
- package/lib/resources/query/options.d.ts +38 -0
- package/lib/resources/query/syntax.d.ts +175 -0
- package/lib/resources/request.d.ts +8 -6
- package/lib/resources/resource.d.ts +49 -55
- package/lib/resources/responses/metadata.d.ts +1 -1
- package/lib/resources/responses/types.d.ts +1 -1
- package/lib/resources/types/action.d.ts +55 -69
- package/lib/resources/types/batch.d.ts +13 -8
- package/lib/resources/types/count.d.ts +16 -19
- package/lib/resources/types/entity-set.d.ts +24 -62
- package/lib/resources/types/entity.d.ts +35 -43
- package/lib/resources/types/function.d.ts +63 -71
- package/lib/resources/types/media.d.ts +20 -22
- package/lib/resources/types/metadata.d.ts +5 -7
- package/lib/resources/types/navigation-property.d.ts +100 -85
- package/lib/resources/types/options.d.ts +8 -8
- package/lib/resources/types/property.d.ts +63 -73
- package/lib/resources/types/reference.d.ts +72 -16
- package/lib/resources/types/singleton.d.ts +75 -43
- package/lib/resources/types/value.d.ts +18 -9
- package/lib/schema/annotation.d.ts +18 -0
- package/lib/schema/callable.d.ts +27 -11
- package/lib/schema/element.d.ts +39 -0
- package/lib/schema/entity-container.d.ts +3 -8
- package/lib/schema/entity-set.d.ts +3 -9
- package/lib/schema/enum-type.d.ts +41 -14
- package/lib/schema/index.d.ts +1 -0
- package/lib/{parsers → schema/parsers}/callable.d.ts +2 -2
- package/lib/schema/parsers/edm.d.ts +4 -0
- package/lib/{parsers → schema/parsers}/enum-type.d.ts +13 -7
- package/lib/{parsers → schema/parsers}/index.d.ts +0 -0
- package/lib/{parsers → schema/parsers}/structured-type.d.ts +14 -9
- package/lib/schema/schema.d.ts +6 -8
- package/lib/schema/structured-type.d.ts +97 -18
- package/lib/services/base.d.ts +12 -12
- package/lib/services/entity-set.d.ts +15 -12
- package/lib/services/entity.d.ts +4 -1
- package/lib/services/singleton.d.ts +6 -3
- package/lib/settings.d.ts +4 -4
- package/lib/types.d.ts +7 -3
- package/lib/utils/arraybuffers.d.ts +4 -0
- package/lib/{parsers/edm.d.ts → utils/durations.d.ts} +3 -3
- package/lib/utils/http.d.ts +9 -0
- package/lib/utils/index.d.ts +5 -2
- package/lib/utils/objects.d.ts +1 -1
- package/lib/utils/strings.d.ts +4 -0
- package/lib/utils/types.d.ts +2 -0
- package/package.json +21 -8
- package/bundles/angular-odata.umd.js +0 -10756
- package/bundles/angular-odata.umd.js.map +0 -1
- package/esm2015/lib/api.js +0 -251
- package/esm2015/lib/client.js +0 -197
- package/esm2015/lib/helper.js +0 -269
- package/esm2015/lib/index.js +0 -21
- package/esm2015/lib/models/collection.js +0 -660
- package/esm2015/lib/models/model.js +0 -421
- package/esm2015/lib/models/options.js +0 -889
- package/esm2015/lib/options.js +0 -31
- package/esm2015/lib/parsers/callable.js +0 -110
- package/esm2015/lib/parsers/edm.js +0 -310
- package/esm2015/lib/parsers/enum-type.js +0 -97
- package/esm2015/lib/parsers/index.js +0 -5
- package/esm2015/lib/parsers/structured-type.js +0 -394
- package/esm2015/lib/resources/builder.js +0 -537
- package/esm2015/lib/resources/index.js +0 -8
- package/esm2015/lib/resources/path-segments.js +0 -156
- package/esm2015/lib/resources/query-options.js +0 -157
- package/esm2015/lib/resources/request.js +0 -141
- package/esm2015/lib/resources/resource.js +0 -328
- package/esm2015/lib/resources/responses/annotations.js +0 -121
- package/esm2015/lib/resources/responses/metadata.js +0 -548
- package/esm2015/lib/resources/responses/response.js +0 -170
- package/esm2015/lib/resources/types/action.js +0 -146
- package/esm2015/lib/resources/types/batch.js +0 -330
- package/esm2015/lib/resources/types/count.js +0 -50
- package/esm2015/lib/resources/types/entity-set.js +0 -164
- package/esm2015/lib/resources/types/entity.js +0 -158
- package/esm2015/lib/resources/types/function.js +0 -166
- package/esm2015/lib/resources/types/media.js +0 -46
- package/esm2015/lib/resources/types/metadata.js +0 -36
- package/esm2015/lib/resources/types/navigation-property.js +0 -214
- package/esm2015/lib/resources/types/options.js +0 -2
- package/esm2015/lib/resources/types/property.js +0 -190
- package/esm2015/lib/resources/types/reference.js +0 -50
- package/esm2015/lib/resources/types/singleton.js +0 -147
- package/esm2015/lib/resources/types/value.js +0 -30
- package/esm2015/lib/schema/annotation.js +0 -7
- package/esm2015/lib/schema/callable.js +0 -50
- package/esm2015/lib/schema/entity-container.js +0 -17
- package/esm2015/lib/schema/entity-set.js +0 -23
- package/esm2015/lib/schema/enum-type.js +0 -68
- package/esm2015/lib/schema/schema.js +0 -55
- package/esm2015/lib/schema/structured-type.js +0 -107
- package/esm2015/lib/services/base.js +0 -23
- package/esm2015/lib/services/entity-set.js +0 -143
- package/esm2015/lib/services/entity.js +0 -10
- package/esm2015/lib/services/singleton.js +0 -46
- package/esm2015/lib/types.js +0 -37
- package/esm2015/lib/utils/http.js +0 -59
- package/esm2015/lib/utils/index.js +0 -7
- package/esm2015/lib/utils/objects.js +0 -140
- package/esm2015/lib/utils/odata.js +0 -21
- package/esm2015/lib/utils/types.js +0 -103
- package/fesm2015/angular-odata.js.map +0 -1
- package/lib/resources/query-options.d.ts +0 -57
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ODataCollection } from '../models';
|
|
2
2
|
import { ODataModel } from '../models/model';
|
|
3
|
-
import { JsonSchemaOptions, ODataEntityTypeKey, ODataStructuredTypeFieldParser, ODataStructuredTypeParser } from '../parsers';
|
|
4
3
|
import { Options, StructuredTypeConfig } from '../types';
|
|
5
|
-
import {
|
|
4
|
+
import { ODataSchemaElement } from './element';
|
|
5
|
+
import { JsonSchemaOptions, ODataEntityTypeKey, ODataStructuredTypeFieldParser, ODataStructuredTypeParser } from './parsers';
|
|
6
6
|
import { ODataSchema } from './schema';
|
|
7
|
-
export declare class ODataStructuredType<T> {
|
|
8
|
-
name: string;
|
|
9
|
-
schema: ODataSchema;
|
|
7
|
+
export declare class ODataStructuredType<T> extends ODataSchemaElement {
|
|
10
8
|
base?: string;
|
|
11
9
|
open: boolean;
|
|
12
10
|
parent?: ODataStructuredType<any>;
|
|
@@ -14,47 +12,128 @@ export declare class ODataStructuredType<T> {
|
|
|
14
12
|
model?: typeof ODataModel;
|
|
15
13
|
collection?: typeof ODataCollection;
|
|
16
14
|
parser: ODataStructuredTypeParser<T>;
|
|
17
|
-
annotations: ODataAnnotation[];
|
|
18
15
|
constructor(config: StructuredTypeConfig<T>, schema: ODataSchema);
|
|
19
|
-
get api(): import("angular-odata").ODataApi;
|
|
20
16
|
configure({ parserForType, findOptionsForType, }: {
|
|
21
17
|
parserForType: (type: string) => any;
|
|
22
18
|
findOptionsForType: (type: string) => any;
|
|
23
19
|
}): void;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Returns a boolean indicating if the structured type is a sub type of the given type.
|
|
22
|
+
* @param type String representation of the type
|
|
23
|
+
* @returns True if the callable is type of the given type
|
|
24
|
+
*/
|
|
25
|
+
isSubtypeOf(schema: ODataStructuredType<any>): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Returns a boolean indicating if the structured type has a simple key.
|
|
28
|
+
* @returns True if the structured type has a simple key
|
|
29
|
+
*/
|
|
28
30
|
isSimpleKey(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Returns a boolean indicating if the structured type has a compound key.
|
|
33
|
+
* @returns True if the structured type has a compound key.
|
|
34
|
+
*/
|
|
29
35
|
isCompoundKey(): boolean;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Find the field parser for the given field name.
|
|
38
|
+
* @param name Name of the field
|
|
39
|
+
* @returns The field parser
|
|
40
|
+
*/
|
|
41
|
+
findFieldByName<F>(name: keyof T): ODataStructuredTypeFieldParser<F> | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Find a parent schema of the structured type.
|
|
44
|
+
* @param predicate Function for evaluate the schemas in the hierarchy.
|
|
45
|
+
* @returns The schema that matches the predicate.
|
|
46
|
+
*/
|
|
47
|
+
findParentSchema(predicate: (p: ODataStructuredType<any>) => boolean): ODataStructuredType<any> | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Find a parent schema of the structured type for the given field.
|
|
50
|
+
* @param field Field that belongs to the structured type
|
|
51
|
+
* @returns The schema of the field
|
|
52
|
+
*/
|
|
53
|
+
findSchemaForField<E>(field: ODataStructuredTypeFieldParser<any>): ODataStructuredType<E>;
|
|
54
|
+
/**
|
|
55
|
+
* Returns all fields of the structured type.
|
|
56
|
+
* @param include_navigation Include navigation properties in the result.
|
|
57
|
+
* @param include_parents Include the parent types in the result.
|
|
58
|
+
* @returns All fields of the structured type.
|
|
59
|
+
*/
|
|
60
|
+
fields({ include_navigation, include_parents, }: {
|
|
61
|
+
include_parents: boolean;
|
|
62
|
+
include_navigation: boolean;
|
|
35
63
|
}): ODataStructuredTypeFieldParser<any>[];
|
|
64
|
+
/**
|
|
65
|
+
* Returns the keys of the structured type.
|
|
66
|
+
* @param include_parents Include the parent fields
|
|
67
|
+
* @returns The keys of the structured type
|
|
68
|
+
*/
|
|
36
69
|
keys({ include_parents, }?: {
|
|
37
70
|
include_parents?: boolean;
|
|
38
71
|
}): ODataEntityTypeKey[];
|
|
39
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Picks the fields from attributes.
|
|
74
|
+
* @param attrs
|
|
75
|
+
* @param include_parents Include the parent fields
|
|
76
|
+
* @param include_navigation Include the navigation fields
|
|
77
|
+
* @param include_etag Include the etag field
|
|
78
|
+
* @returns The picked fields
|
|
79
|
+
*/
|
|
80
|
+
pick(attrs: {
|
|
40
81
|
[name: string]: any;
|
|
41
82
|
}, { include_parents, include_navigation, include_etag, }?: {
|
|
42
83
|
include_parents?: boolean;
|
|
43
84
|
include_navigation?: boolean;
|
|
44
85
|
include_etag?: boolean;
|
|
45
86
|
}): Partial<T>;
|
|
87
|
+
/**
|
|
88
|
+
* Deseialize the given value from the structured type.
|
|
89
|
+
* @param value Value to deserialize
|
|
90
|
+
* @param options Options for deserialization
|
|
91
|
+
* @returns Deserialized value
|
|
92
|
+
*/
|
|
46
93
|
deserialize(value: any, options?: Options): T;
|
|
94
|
+
/**
|
|
95
|
+
* Serialize the given value for the structured type.
|
|
96
|
+
* @param value Value to serialize
|
|
97
|
+
* @param options Options for serialization
|
|
98
|
+
* @returns Serialized value
|
|
99
|
+
*/
|
|
47
100
|
serialize(value: T, options?: Options): any;
|
|
101
|
+
/**
|
|
102
|
+
* Encode the given value for the structured type.
|
|
103
|
+
* @param value Value to encode
|
|
104
|
+
* @param options Options for encoding
|
|
105
|
+
* @returns Encoded value
|
|
106
|
+
*/
|
|
48
107
|
encode(value: T, options?: Options): any;
|
|
108
|
+
/**
|
|
109
|
+
* Resolve the key of the structured type for the given value.
|
|
110
|
+
* @param attrs Attributes of the value
|
|
111
|
+
* @returns Resolved key
|
|
112
|
+
*/
|
|
49
113
|
resolveKey(attrs: T | {
|
|
50
114
|
[name: string]: any;
|
|
51
115
|
}): any;
|
|
116
|
+
/**
|
|
117
|
+
* Returns the defaults values for the structured type.
|
|
118
|
+
* @returns Default values for the structured type
|
|
119
|
+
*/
|
|
52
120
|
defaults(): {
|
|
53
121
|
[name: string]: any;
|
|
54
122
|
};
|
|
123
|
+
/**
|
|
124
|
+
* Convert the structured type to json schema
|
|
125
|
+
* @param options Options for json schema
|
|
126
|
+
* @returns Json Schema
|
|
127
|
+
*/
|
|
55
128
|
toJsonSchema(options?: JsonSchemaOptions<T>): any;
|
|
129
|
+
/**
|
|
130
|
+
* Validate the given value against the structured type.
|
|
131
|
+
* @param attrs Attributes of the value
|
|
132
|
+
* @param method Method to use for the process validation
|
|
133
|
+
* @returns Object with the errors
|
|
134
|
+
*/
|
|
56
135
|
validate(attrs: Partial<T>, { method, navigation, }?: {
|
|
57
|
-
method?: 'create' | 'update' | '
|
|
136
|
+
method?: 'create' | 'update' | 'modify';
|
|
58
137
|
navigation?: boolean;
|
|
59
138
|
}): {
|
|
60
139
|
[name: string]: any;
|
package/lib/services/base.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { ODataActionResource, ODataFunctionResource, ODataNavigationPropertyResource, ODataEntity, ODataEntities, ODataProperty, HttpQueryOptions } from '../resources';
|
|
2
|
-
import { ODataClient } from '../client';
|
|
3
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
import { ODataClient } from '../client';
|
|
3
|
+
import { ODataActionResource, ODataEntities, ODataEntity, ODataFunctionResource, ODataNavigationPropertyResource, ODataProperty, ODataQueryArgumentsOptions } from '../resources';
|
|
4
4
|
export declare abstract class ODataBaseService {
|
|
5
5
|
protected client: ODataClient;
|
|
6
6
|
protected name: string;
|
|
7
7
|
protected apiNameOrEntityType?: string | undefined;
|
|
8
8
|
constructor(client: ODataClient, name: string, apiNameOrEntityType?: string | undefined);
|
|
9
9
|
get api(): import("angular-odata").ODataApi;
|
|
10
|
-
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entity', options?:
|
|
11
|
-
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entities', options?:
|
|
12
|
-
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'property', options?:
|
|
13
|
-
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'none', options?:
|
|
14
|
-
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entity', options?:
|
|
15
|
-
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entities', options?:
|
|
16
|
-
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'property', options?:
|
|
17
|
-
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'none', options?:
|
|
18
|
-
protected fetchNavigationProperty<S>(resource: ODataNavigationPropertyResource<S>, responseType: 'entity', options?:
|
|
19
|
-
protected fetchNavigationProperty<S>(resource: ODataNavigationPropertyResource<S>, responseType: 'entities', options?:
|
|
10
|
+
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entity', options?: ODataQueryArgumentsOptions<R>): Observable<ODataEntity<R>>;
|
|
11
|
+
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entities', options?: ODataQueryArgumentsOptions<R>): Observable<ODataEntities<R>>;
|
|
12
|
+
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'property', options?: ODataQueryArgumentsOptions<R>): Observable<ODataProperty<R>>;
|
|
13
|
+
protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'none', options?: ODataQueryArgumentsOptions<R>): Observable<null>;
|
|
14
|
+
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entity', options?: ODataQueryArgumentsOptions<R>): Observable<ODataEntity<R>>;
|
|
15
|
+
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entities', options?: ODataQueryArgumentsOptions<R>): Observable<ODataEntities<R>>;
|
|
16
|
+
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'property', options?: ODataQueryArgumentsOptions<R>): Observable<ODataProperty<R>>;
|
|
17
|
+
protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'none', options?: ODataQueryArgumentsOptions<R>): Observable<null>;
|
|
18
|
+
protected fetchNavigationProperty<S>(resource: ODataNavigationPropertyResource<S>, responseType: 'entity', options?: ODataQueryArgumentsOptions<S>): Observable<ODataEntity<S>>;
|
|
19
|
+
protected fetchNavigationProperty<S>(resource: ODataNavigationPropertyResource<S>, responseType: 'entities', options?: ODataQueryArgumentsOptions<S>): Observable<ODataEntities<S>>;
|
|
20
20
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
2
|
import { ODataCollection } from '../models/collection';
|
|
3
3
|
import { ODataModel } from '../models/model';
|
|
4
|
-
import {
|
|
4
|
+
import { EntityKey, ODataEntities, ODataEntity, ODataEntityResource, ODataEntitySetResource, ODataOptions } from '../resources';
|
|
5
5
|
import { ODataEntityService } from './entity';
|
|
6
6
|
export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
|
|
7
7
|
/**
|
|
@@ -19,18 +19,21 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
|
|
|
19
19
|
*/
|
|
20
20
|
attach<M extends ODataModel<T>>(model: M): void;
|
|
21
21
|
attach<C extends ODataCollection<T, ODataModel<T>>>(model: C): void;
|
|
22
|
+
/**
|
|
23
|
+
* The schema for the entity set.
|
|
24
|
+
*/
|
|
22
25
|
get entitySetSchema(): import("angular-odata").ODataEntitySet | undefined;
|
|
23
26
|
/**
|
|
24
27
|
* Get all entities from the entity set.
|
|
25
28
|
* @param options The options for the request.
|
|
26
29
|
*/
|
|
27
|
-
fetchAll(options?:
|
|
30
|
+
fetchAll(options?: ODataOptions): Observable<T[]>;
|
|
28
31
|
/**
|
|
29
32
|
* Get entities from the entity set.
|
|
30
33
|
* @param withCount Get the count of the entities.
|
|
31
34
|
* @param options The options for the request.
|
|
32
35
|
*/
|
|
33
|
-
fetchMany(options?:
|
|
36
|
+
fetchMany(options?: ODataOptions & {
|
|
34
37
|
withCount?: boolean;
|
|
35
38
|
}): Observable<ODataEntities<T>>;
|
|
36
39
|
/**
|
|
@@ -39,7 +42,7 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
|
|
|
39
42
|
* @param etag The etag for the entity.
|
|
40
43
|
* @param options The options for the request.
|
|
41
44
|
*/
|
|
42
|
-
fetchOne(key: EntityKey<T>, options?:
|
|
45
|
+
fetchOne(key: EntityKey<T>, options?: ODataOptions & {
|
|
43
46
|
etag?: string;
|
|
44
47
|
}): Observable<ODataEntity<T>>;
|
|
45
48
|
/**
|
|
@@ -47,7 +50,7 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
|
|
|
47
50
|
* @param attrs The attributes for the entity.
|
|
48
51
|
* @param options The options for the request.
|
|
49
52
|
*/
|
|
50
|
-
create(attrs: Partial<T>, options?:
|
|
53
|
+
create(attrs: Partial<T>, options?: ODataOptions): Observable<ODataEntity<T>>;
|
|
51
54
|
/**
|
|
52
55
|
* Update an entity in the entity set.
|
|
53
56
|
* @param key The entity key.
|
|
@@ -55,7 +58,7 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
|
|
|
55
58
|
* @param etag The etag for the entity.
|
|
56
59
|
* @param options The options for the request.
|
|
57
60
|
*/
|
|
58
|
-
update(key: EntityKey<T>, attrs: Partial<T>, options?:
|
|
61
|
+
update(key: EntityKey<T>, attrs: Partial<T>, options?: ODataOptions & {
|
|
59
62
|
etag?: string;
|
|
60
63
|
}): Observable<ODataEntity<T>>;
|
|
61
64
|
/**
|
|
@@ -65,7 +68,7 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
|
|
|
65
68
|
* @param etag The etag for the entity.
|
|
66
69
|
* @param options The options for the request.
|
|
67
70
|
*/
|
|
68
|
-
|
|
71
|
+
modify(key: EntityKey<T>, attrs: Partial<T>, options?: ODataOptions & {
|
|
69
72
|
etag?: string;
|
|
70
73
|
}): Observable<ODataEntity<T>>;
|
|
71
74
|
/**
|
|
@@ -74,7 +77,7 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
|
|
|
74
77
|
* @param etag The etag for the entity.
|
|
75
78
|
* @param options The options for the request.
|
|
76
79
|
*/
|
|
77
|
-
destroy(key: EntityKey<T>, options?:
|
|
80
|
+
destroy(key: EntityKey<T>, options?: ODataOptions & {
|
|
78
81
|
etag?: string;
|
|
79
82
|
}): Observable<any>;
|
|
80
83
|
/**
|
|
@@ -86,7 +89,7 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
|
|
|
86
89
|
*/
|
|
87
90
|
fetchOrCreate(key: EntityKey<T>, attrs: Partial<T>, { etag, ...options }?: {
|
|
88
91
|
etag?: string;
|
|
89
|
-
} &
|
|
92
|
+
} & ODataOptions): Observable<ODataEntity<T>>;
|
|
90
93
|
/**
|
|
91
94
|
* Save an entity in the entity set.
|
|
92
95
|
* @param attrs The attributes for the entity.
|
|
@@ -96,6 +99,6 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
|
|
|
96
99
|
*/
|
|
97
100
|
save(attrs: Partial<T>, { etag, method, ...options }?: {
|
|
98
101
|
etag?: string;
|
|
99
|
-
method?: 'create' | 'update' | '
|
|
100
|
-
} &
|
|
102
|
+
method?: 'create' | 'update' | 'modify';
|
|
103
|
+
} & ODataOptions): Observable<ODataEntity<T>>;
|
|
101
104
|
}
|
package/lib/services/entity.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { EntityKey, ODataResource } from '../resources';
|
|
2
1
|
import { ODataModel } from '../models/model';
|
|
2
|
+
import { EntityKey, ODataResource } from '../resources';
|
|
3
3
|
import { ODataBaseService } from './base';
|
|
4
4
|
export declare abstract class ODataEntityService<T> extends ODataBaseService {
|
|
5
5
|
abstract entity(key?: EntityKey<T>): ODataResource<T>;
|
|
6
6
|
abstract attach<M extends ODataModel<T>>(value: M): void;
|
|
7
|
+
/**
|
|
8
|
+
* The schema for the structured type.
|
|
9
|
+
*/
|
|
7
10
|
get structuredTypeSchema(): import("angular-odata").ODataStructuredType<T> | undefined;
|
|
8
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import type { ODataModel } from '../models/model';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ODataEntity, ODataOptions, ODataSingletonResource } from '../resources';
|
|
4
4
|
import { ODataEntityService } from './entity';
|
|
5
5
|
/**
|
|
6
6
|
* OData Singleton Service
|
|
@@ -17,6 +17,9 @@ export declare class ODataSingletonService<T> extends ODataEntityService<T> {
|
|
|
17
17
|
* @param model The model to attach.
|
|
18
18
|
*/
|
|
19
19
|
attach<M extends ODataModel<T>>(model: M): void;
|
|
20
|
+
/**
|
|
21
|
+
* The schema for the singleton.
|
|
22
|
+
*/
|
|
20
23
|
get singletonSchema(): import("angular-odata").ODataEntitySet | undefined;
|
|
21
24
|
/**
|
|
22
25
|
* Update the singleton entity
|
|
@@ -24,7 +27,7 @@ export declare class ODataSingletonService<T> extends ODataEntityService<T> {
|
|
|
24
27
|
* @param etag The etag for the entity.
|
|
25
28
|
* @param options The options for the request.
|
|
26
29
|
*/
|
|
27
|
-
update(attrs: Partial<T>, options?:
|
|
30
|
+
update(attrs: Partial<T>, options?: ODataOptions & {
|
|
28
31
|
etag?: string;
|
|
29
32
|
}): Observable<ODataEntity<T>>;
|
|
30
33
|
/**
|
|
@@ -33,7 +36,7 @@ export declare class ODataSingletonService<T> extends ODataEntityService<T> {
|
|
|
33
36
|
* @param etag The etag for the entity.
|
|
34
37
|
* @param options The options for the request.
|
|
35
38
|
*/
|
|
36
|
-
patch(attrs: Partial<T>, options?:
|
|
39
|
+
patch(attrs: Partial<T>, options?: ODataOptions & {
|
|
37
40
|
etag?: string;
|
|
38
41
|
}): Observable<ODataEntity<T>>;
|
|
39
42
|
}
|
package/lib/settings.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ApiConfig, Parser } from './types';
|
|
2
|
-
import { ODataApi } from './api';
|
|
3
|
-
import { ODataCallable, ODataEntitySet, ODataEnumType, ODataStructuredType } from './schema';
|
|
4
|
-
import { ODataRequest } from './resources';
|
|
5
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
import { ODataApi } from './api';
|
|
6
3
|
import { ODataCollection, ODataModel } from './models';
|
|
4
|
+
import { ODataRequest } from './resources';
|
|
5
|
+
import { ODataCallable, ODataEntitySet, ODataEnumType, ODataStructuredType } from './schema';
|
|
7
6
|
import { ODataEntityService } from './services/entity';
|
|
7
|
+
import { ApiConfig, Parser } from './types';
|
|
8
8
|
export declare class ODataSettings {
|
|
9
9
|
apis: ODataApi[];
|
|
10
10
|
constructor(...configs: ApiConfig[]);
|
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
1
|
import { ODataVersionHelper } from './helper';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
3
|
export declare type ODataVersion = '2.0' | '3.0' | '4.0';
|
|
4
4
|
export declare type FetchPolicy = 'cache-first' | 'cache-and-network' | 'network-only' | 'no-cache' | 'cache-only';
|
|
5
5
|
export declare type ODataMetadataType = 'minimal' | 'full' | 'none';
|
|
@@ -45,8 +45,10 @@ export interface ApiOptions extends Options {
|
|
|
45
45
|
};
|
|
46
46
|
withCredentials?: boolean;
|
|
47
47
|
accept?: {
|
|
48
|
+
exponentialDecimals?: boolean;
|
|
48
49
|
metadata?: ODataMetadataType;
|
|
49
50
|
ieee754Compatible?: boolean;
|
|
51
|
+
streaming?: boolean;
|
|
50
52
|
};
|
|
51
53
|
etag?: {
|
|
52
54
|
ifMatch?: boolean;
|
|
@@ -61,9 +63,11 @@ export interface ApiOptions extends Options {
|
|
|
61
63
|
stripMetadata?: ODataMetadataType;
|
|
62
64
|
fetchPolicy?: FetchPolicy;
|
|
63
65
|
bodyQueryOptions?: QueryOptionNames[];
|
|
66
|
+
deleteRefBy?: 'path' | 'id';
|
|
64
67
|
}
|
|
65
68
|
export interface OptionsHelper extends Options {
|
|
66
69
|
helper: ODataVersionHelper;
|
|
70
|
+
exponentialDecimals?: boolean;
|
|
67
71
|
metadata?: ODataMetadataType;
|
|
68
72
|
ieee754Compatible?: boolean;
|
|
69
73
|
streaming?: boolean;
|
|
@@ -77,8 +81,8 @@ export interface StructuredTypeFieldOptions extends OptionsHelper {
|
|
|
77
81
|
}
|
|
78
82
|
export interface Parser<T> {
|
|
79
83
|
deserialize(value: any, options?: OptionsHelper | StructuredTypeFieldOptions): T;
|
|
80
|
-
serialize(value:
|
|
81
|
-
encode(value:
|
|
84
|
+
serialize(value: any, options?: OptionsHelper | StructuredTypeFieldOptions): any;
|
|
85
|
+
encode(value: any, options?: OptionsHelper | StructuredTypeFieldOptions): any;
|
|
82
86
|
}
|
|
83
87
|
export declare const NONE_PARSER: Parser<any>;
|
|
84
88
|
export interface Cache {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Parser } from '../types';
|
|
2
1
|
export declare type Duration = {
|
|
3
2
|
sign?: 1 | -1;
|
|
4
3
|
years?: number;
|
|
@@ -9,6 +8,7 @@ export declare type Duration = {
|
|
|
9
8
|
minutes?: number;
|
|
10
9
|
seconds?: number;
|
|
11
10
|
};
|
|
12
|
-
export declare const
|
|
13
|
-
|
|
11
|
+
export declare const Durations: {
|
|
12
|
+
toDuration(v: string): Duration;
|
|
13
|
+
toString(v: Duration): string;
|
|
14
14
|
};
|
package/lib/utils/http.d.ts
CHANGED
|
@@ -7,7 +7,16 @@ export declare const Http: {
|
|
|
7
7
|
[param: string]: string | string[];
|
|
8
8
|
})[]): HttpParams;
|
|
9
9
|
splitHttpParams(params: HttpParams, keys: string[]): [HttpParams, HttpParams];
|
|
10
|
+
withoutHttpParams(params: HttpParams, keys: string[]): HttpParams;
|
|
10
11
|
resolveHeaderKey(headers: HttpHeaders | {
|
|
11
12
|
[param: string]: string | string[];
|
|
12
13
|
}, options: string[]): string | undefined;
|
|
14
|
+
headerValue(header: string): string;
|
|
15
|
+
parseResponseStatus(statusLine: string): {
|
|
16
|
+
status: string;
|
|
17
|
+
code: number;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
boundaryDelimiter(contentType: string): string;
|
|
21
|
+
boundaryEnd(boundaryDelimiter: string): string;
|
|
13
22
|
};
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './dates';
|
|
2
|
+
export * from './durations';
|
|
2
3
|
export * from './enums';
|
|
3
|
-
export * from './
|
|
4
|
+
export * from './http';
|
|
4
5
|
export * from './objects';
|
|
6
|
+
export * from './odata';
|
|
7
|
+
export * from './strings';
|
|
8
|
+
export * from './types';
|
|
5
9
|
export * from './urls';
|
|
6
|
-
export * from './http';
|
package/lib/utils/objects.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ export declare const Objects: {
|
|
|
16
16
|
}): {
|
|
17
17
|
[attr: string]: any;
|
|
18
18
|
};
|
|
19
|
-
uniqueId: (str?: string) => string;
|
|
20
19
|
resolveKey(key: any, { single }?: {
|
|
21
20
|
single?: boolean | undefined;
|
|
22
21
|
}): any;
|
|
22
|
+
clone(target: any, map?: WeakMap<object, any> | undefined): any;
|
|
23
23
|
};
|
package/lib/utils/types.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export declare const Types: {
|
|
2
|
+
rawType(value: any): string;
|
|
2
3
|
isObject(value: any): boolean;
|
|
3
4
|
isPlainObject(value: any): boolean;
|
|
4
5
|
isFunction(value: any): boolean;
|
|
5
6
|
isArray(value: any): boolean;
|
|
6
7
|
isEmpty(value: any): boolean;
|
|
7
8
|
isEqual(value1: any, value2: any): boolean;
|
|
9
|
+
clone(target: any): any;
|
|
8
10
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angular-odata",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.95.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Client side OData typescript library for Angular",
|
|
6
6
|
"repository": {
|
|
@@ -25,17 +25,30 @@
|
|
|
25
25
|
"homepage": "https://github.com/diegomvh/angular-odata",
|
|
26
26
|
"private": false,
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@angular/common": "^
|
|
29
|
-
"@angular/core": "^
|
|
28
|
+
"@angular/common": "^13.1.0",
|
|
29
|
+
"@angular/core": "^13.1.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"tslib": "^2.3.0"
|
|
33
33
|
},
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"fesm2015": "fesm2015/angular-odata.
|
|
34
|
+
"module": "fesm2015/angular-odata.mjs",
|
|
35
|
+
"es2020": "fesm2020/angular-odata.mjs",
|
|
36
|
+
"esm2020": "esm2020/angular-odata.mjs",
|
|
37
|
+
"fesm2020": "fesm2020/angular-odata.mjs",
|
|
38
|
+
"fesm2015": "fesm2015/angular-odata.mjs",
|
|
39
39
|
"typings": "angular-odata.d.ts",
|
|
40
|
+
"exports": {
|
|
41
|
+
"./package.json": {
|
|
42
|
+
"default": "./package.json"
|
|
43
|
+
},
|
|
44
|
+
".": {
|
|
45
|
+
"types": "./angular-odata.d.ts",
|
|
46
|
+
"esm2020": "./esm2020/angular-odata.mjs",
|
|
47
|
+
"es2020": "./fesm2020/angular-odata.mjs",
|
|
48
|
+
"es2015": "./fesm2015/angular-odata.mjs",
|
|
49
|
+
"node": "./fesm2015/angular-odata.mjs",
|
|
50
|
+
"default": "./fesm2020/angular-odata.mjs"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
40
53
|
"sideEffects": false
|
|
41
54
|
}
|