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.
Files changed (224) hide show
  1. package/README.md +133 -62
  2. package/{esm2015/angular-odata.js → esm2020/angular-odata.mjs} +0 -0
  3. package/esm2020/lib/api.mjs +303 -0
  4. package/{esm2015/lib/cache/cache.js → esm2020/lib/cache/cache.mjs} +12 -5
  5. package/{esm2015/lib/cache/index.js → esm2020/lib/cache/index.mjs} +0 -0
  6. package/{esm2015/lib/cache/memory.js → esm2020/lib/cache/memory.mjs} +0 -0
  7. package/{esm2015/lib/cache/storage.js → esm2020/lib/cache/storage.mjs} +1 -1
  8. package/esm2020/lib/client.mjs +271 -0
  9. package/{esm2015/lib/constants.js → esm2020/lib/constants.mjs} +9 -3
  10. package/esm2020/lib/helper.mjs +268 -0
  11. package/esm2020/lib/index.mjs +19 -0
  12. package/esm2020/lib/models/collection.mjs +741 -0
  13. package/{esm2015/lib/models/index.js → esm2020/lib/models/index.mjs} +0 -0
  14. package/esm2020/lib/models/model.mjs +453 -0
  15. package/esm2020/lib/models/options.mjs +945 -0
  16. package/{esm2015/lib/module.js → esm2020/lib/module.mjs} +6 -6
  17. package/esm2020/lib/options.mjs +32 -0
  18. package/esm2020/lib/resources/index.mjs +7 -0
  19. package/esm2020/lib/resources/path/handlers.mjs +69 -0
  20. package/esm2020/lib/resources/path/index.mjs +3 -0
  21. package/esm2020/lib/resources/path/segments.mjs +124 -0
  22. package/esm2020/lib/resources/query/builder.mjs +590 -0
  23. package/esm2020/lib/resources/query/expressions.mjs +207 -0
  24. package/esm2020/lib/resources/query/handlers.mjs +186 -0
  25. package/esm2020/lib/resources/query/index.mjs +4 -0
  26. package/esm2020/lib/resources/query/options.mjs +103 -0
  27. package/esm2020/lib/resources/query/syntax.mjs +406 -0
  28. package/esm2020/lib/resources/request.mjs +167 -0
  29. package/esm2020/lib/resources/resource.mjs +326 -0
  30. package/esm2020/lib/resources/responses/annotations.mjs +119 -0
  31. package/{esm2015/lib/resources/responses/csdl/csdl-annotation.js → esm2020/lib/resources/responses/csdl/csdl-annotation.mjs} +0 -0
  32. package/{esm2015/lib/resources/responses/csdl/csdl-entity-container.js → esm2020/lib/resources/responses/csdl/csdl-entity-container.mjs} +0 -0
  33. package/{esm2015/lib/resources/responses/csdl/csdl-entity-set.js → esm2020/lib/resources/responses/csdl/csdl-entity-set.mjs} +0 -0
  34. package/{esm2015/lib/resources/responses/csdl/csdl-enum-type.js → esm2020/lib/resources/responses/csdl/csdl-enum-type.mjs} +0 -0
  35. package/{esm2015/lib/resources/responses/csdl/csdl-function-action.js → esm2020/lib/resources/responses/csdl/csdl-function-action.mjs} +0 -0
  36. package/{esm2015/lib/resources/responses/csdl/csdl-navigation-property-binding.js → esm2020/lib/resources/responses/csdl/csdl-navigation-property-binding.mjs} +0 -0
  37. package/{esm2015/lib/resources/responses/csdl/csdl-reference.js → esm2020/lib/resources/responses/csdl/csdl-reference.mjs} +0 -0
  38. package/{esm2015/lib/resources/responses/csdl/csdl-schema.js → esm2020/lib/resources/responses/csdl/csdl-schema.mjs} +0 -0
  39. package/{esm2015/lib/resources/responses/csdl/csdl-singleton.js → esm2020/lib/resources/responses/csdl/csdl-singleton.mjs} +0 -0
  40. package/{esm2015/lib/resources/responses/csdl/csdl-structural-property.js → esm2020/lib/resources/responses/csdl/csdl-structural-property.mjs} +0 -0
  41. package/{esm2015/lib/resources/responses/csdl/csdl-structured-type.js → esm2020/lib/resources/responses/csdl/csdl-structured-type.mjs} +0 -0
  42. package/{esm2015/lib/resources/responses/csdl/csdl-type-definition.js → esm2020/lib/resources/responses/csdl/csdl-type-definition.mjs} +0 -0
  43. package/{esm2015/lib/resources/responses/index.js → esm2020/lib/resources/responses/index.mjs} +0 -0
  44. package/esm2020/lib/resources/responses/metadata.mjs +547 -0
  45. package/{esm2015/lib/resources/responses/options.js → esm2020/lib/resources/responses/options.mjs} +1 -1
  46. package/esm2020/lib/resources/responses/response.mjs +170 -0
  47. package/{esm2015/lib/resources/responses/types.js → esm2020/lib/resources/responses/types.mjs} +1 -1
  48. package/esm2020/lib/resources/types/action.mjs +101 -0
  49. package/esm2020/lib/resources/types/batch.mjs +288 -0
  50. package/esm2020/lib/resources/types/count.mjs +27 -0
  51. package/esm2020/lib/resources/types/entity-set.mjs +94 -0
  52. package/esm2020/lib/resources/types/entity.mjs +106 -0
  53. package/esm2020/lib/resources/types/function.mjs +137 -0
  54. package/{esm2015/lib/resources/types/index.js → esm2020/lib/resources/types/index.mjs} +0 -0
  55. package/esm2020/lib/resources/types/media.mjs +41 -0
  56. package/esm2020/lib/resources/types/metadata.mjs +30 -0
  57. package/esm2020/lib/resources/types/navigation-property.mjs +226 -0
  58. package/esm2020/lib/resources/types/options.mjs +2 -0
  59. package/esm2020/lib/resources/types/property.mjs +183 -0
  60. package/esm2020/lib/resources/types/reference.mjs +85 -0
  61. package/esm2020/lib/resources/types/singleton.mjs +126 -0
  62. package/esm2020/lib/resources/types/value.mjs +41 -0
  63. package/esm2020/lib/schema/annotation.mjs +37 -0
  64. package/esm2020/lib/schema/callable.mjs +62 -0
  65. package/esm2020/lib/schema/element.mjs +51 -0
  66. package/esm2020/lib/schema/entity-container.mjs +9 -0
  67. package/esm2020/lib/schema/entity-set.mjs +9 -0
  68. package/esm2020/lib/schema/enum-type.mjs +71 -0
  69. package/{esm2015/lib/schema/index.js → esm2020/lib/schema/index.mjs} +2 -1
  70. package/esm2020/lib/schema/parsers/callable.mjs +113 -0
  71. package/esm2020/lib/schema/parsers/edm.mjs +95 -0
  72. package/esm2020/lib/schema/parsers/enum-type.mjs +107 -0
  73. package/esm2020/lib/schema/parsers/index.mjs +5 -0
  74. package/esm2020/lib/schema/parsers/structured-type.mjs +412 -0
  75. package/esm2020/lib/schema/schema.mjs +61 -0
  76. package/esm2020/lib/schema/structured-type.mjs +198 -0
  77. package/esm2020/lib/services/base.mjs +29 -0
  78. package/esm2020/lib/services/entity-set.mjs +143 -0
  79. package/esm2020/lib/services/entity.mjs +12 -0
  80. package/{esm2015/lib/services/factory.js → esm2020/lib/services/factory.mjs} +3 -3
  81. package/{esm2015/lib/services/index.js → esm2020/lib/services/index.mjs} +0 -0
  82. package/esm2020/lib/services/singleton.mjs +48 -0
  83. package/{esm2015/lib/settings.js → esm2020/lib/settings.mjs} +1 -1
  84. package/{esm2015/lib/tokens.js → esm2020/lib/tokens.mjs} +0 -0
  85. package/esm2020/lib/types.mjs +37 -0
  86. package/esm2020/lib/utils/arraybuffers.mjs +46 -0
  87. package/{esm2015/lib/utils/dates.js → esm2020/lib/utils/dates.mjs} +0 -0
  88. package/esm2020/lib/utils/durations.mjs +40 -0
  89. package/{esm2015/lib/utils/enums.js → esm2020/lib/utils/enums.mjs} +0 -0
  90. package/esm2020/lib/utils/http.mjs +93 -0
  91. package/esm2020/lib/utils/index.mjs +10 -0
  92. package/esm2020/lib/utils/objects.mjs +195 -0
  93. package/esm2020/lib/utils/odata.mjs +22 -0
  94. package/esm2020/lib/utils/strings.mjs +20 -0
  95. package/esm2020/lib/utils/types.mjs +134 -0
  96. package/{esm2015/lib/utils/urls.js → esm2020/lib/utils/urls.mjs} +0 -0
  97. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  98. package/fesm2015/{angular-odata.js → angular-odata.mjs} +5068 -3943
  99. package/fesm2015/angular-odata.mjs.map +1 -0
  100. package/fesm2020/angular-odata.mjs +10274 -0
  101. package/fesm2020/angular-odata.mjs.map +1 -0
  102. package/lib/api.d.ts +17 -16
  103. package/lib/cache/cache.d.ts +2 -2
  104. package/lib/client.d.ts +93 -18
  105. package/lib/constants.d.ts +6 -2
  106. package/lib/helper.d.ts +3 -3
  107. package/lib/index.d.ts +0 -1
  108. package/lib/models/collection.d.ts +36 -47
  109. package/lib/models/model.d.ts +47 -40
  110. package/lib/models/options.d.ts +53 -52
  111. package/lib/options.d.ts +50 -2
  112. package/lib/resources/index.d.ts +2 -3
  113. package/lib/resources/path/handlers.d.ts +27 -0
  114. package/lib/resources/path/index.d.ts +2 -0
  115. package/lib/resources/{path-segments.d.ts → path/segments.d.ts} +4 -16
  116. package/lib/resources/{builder.d.ts → query/builder.d.ts} +12 -7
  117. package/lib/resources/query/expressions.d.ts +63 -0
  118. package/lib/resources/query/handlers.d.ts +89 -0
  119. package/lib/resources/query/index.d.ts +3 -0
  120. package/lib/resources/query/options.d.ts +38 -0
  121. package/lib/resources/query/syntax.d.ts +175 -0
  122. package/lib/resources/request.d.ts +8 -6
  123. package/lib/resources/resource.d.ts +49 -55
  124. package/lib/resources/responses/metadata.d.ts +1 -1
  125. package/lib/resources/responses/types.d.ts +1 -1
  126. package/lib/resources/types/action.d.ts +55 -69
  127. package/lib/resources/types/batch.d.ts +13 -8
  128. package/lib/resources/types/count.d.ts +16 -19
  129. package/lib/resources/types/entity-set.d.ts +24 -62
  130. package/lib/resources/types/entity.d.ts +35 -43
  131. package/lib/resources/types/function.d.ts +63 -71
  132. package/lib/resources/types/media.d.ts +20 -22
  133. package/lib/resources/types/metadata.d.ts +5 -7
  134. package/lib/resources/types/navigation-property.d.ts +100 -85
  135. package/lib/resources/types/options.d.ts +8 -8
  136. package/lib/resources/types/property.d.ts +63 -73
  137. package/lib/resources/types/reference.d.ts +72 -16
  138. package/lib/resources/types/singleton.d.ts +75 -43
  139. package/lib/resources/types/value.d.ts +18 -9
  140. package/lib/schema/annotation.d.ts +18 -0
  141. package/lib/schema/callable.d.ts +27 -11
  142. package/lib/schema/element.d.ts +39 -0
  143. package/lib/schema/entity-container.d.ts +3 -8
  144. package/lib/schema/entity-set.d.ts +3 -9
  145. package/lib/schema/enum-type.d.ts +41 -14
  146. package/lib/schema/index.d.ts +1 -0
  147. package/lib/{parsers → schema/parsers}/callable.d.ts +2 -2
  148. package/lib/schema/parsers/edm.d.ts +4 -0
  149. package/lib/{parsers → schema/parsers}/enum-type.d.ts +13 -7
  150. package/lib/{parsers → schema/parsers}/index.d.ts +0 -0
  151. package/lib/{parsers → schema/parsers}/structured-type.d.ts +14 -9
  152. package/lib/schema/schema.d.ts +6 -8
  153. package/lib/schema/structured-type.d.ts +97 -18
  154. package/lib/services/base.d.ts +12 -12
  155. package/lib/services/entity-set.d.ts +15 -12
  156. package/lib/services/entity.d.ts +4 -1
  157. package/lib/services/singleton.d.ts +6 -3
  158. package/lib/settings.d.ts +4 -4
  159. package/lib/types.d.ts +7 -3
  160. package/lib/utils/arraybuffers.d.ts +4 -0
  161. package/lib/{parsers/edm.d.ts → utils/durations.d.ts} +3 -3
  162. package/lib/utils/http.d.ts +9 -0
  163. package/lib/utils/index.d.ts +5 -2
  164. package/lib/utils/objects.d.ts +1 -1
  165. package/lib/utils/strings.d.ts +4 -0
  166. package/lib/utils/types.d.ts +2 -0
  167. package/package.json +21 -8
  168. package/bundles/angular-odata.umd.js +0 -10756
  169. package/bundles/angular-odata.umd.js.map +0 -1
  170. package/esm2015/lib/api.js +0 -251
  171. package/esm2015/lib/client.js +0 -197
  172. package/esm2015/lib/helper.js +0 -269
  173. package/esm2015/lib/index.js +0 -21
  174. package/esm2015/lib/models/collection.js +0 -660
  175. package/esm2015/lib/models/model.js +0 -421
  176. package/esm2015/lib/models/options.js +0 -889
  177. package/esm2015/lib/options.js +0 -31
  178. package/esm2015/lib/parsers/callable.js +0 -110
  179. package/esm2015/lib/parsers/edm.js +0 -310
  180. package/esm2015/lib/parsers/enum-type.js +0 -97
  181. package/esm2015/lib/parsers/index.js +0 -5
  182. package/esm2015/lib/parsers/structured-type.js +0 -394
  183. package/esm2015/lib/resources/builder.js +0 -537
  184. package/esm2015/lib/resources/index.js +0 -8
  185. package/esm2015/lib/resources/path-segments.js +0 -156
  186. package/esm2015/lib/resources/query-options.js +0 -157
  187. package/esm2015/lib/resources/request.js +0 -141
  188. package/esm2015/lib/resources/resource.js +0 -328
  189. package/esm2015/lib/resources/responses/annotations.js +0 -121
  190. package/esm2015/lib/resources/responses/metadata.js +0 -548
  191. package/esm2015/lib/resources/responses/response.js +0 -170
  192. package/esm2015/lib/resources/types/action.js +0 -146
  193. package/esm2015/lib/resources/types/batch.js +0 -330
  194. package/esm2015/lib/resources/types/count.js +0 -50
  195. package/esm2015/lib/resources/types/entity-set.js +0 -164
  196. package/esm2015/lib/resources/types/entity.js +0 -158
  197. package/esm2015/lib/resources/types/function.js +0 -166
  198. package/esm2015/lib/resources/types/media.js +0 -46
  199. package/esm2015/lib/resources/types/metadata.js +0 -36
  200. package/esm2015/lib/resources/types/navigation-property.js +0 -214
  201. package/esm2015/lib/resources/types/options.js +0 -2
  202. package/esm2015/lib/resources/types/property.js +0 -190
  203. package/esm2015/lib/resources/types/reference.js +0 -50
  204. package/esm2015/lib/resources/types/singleton.js +0 -147
  205. package/esm2015/lib/resources/types/value.js +0 -30
  206. package/esm2015/lib/schema/annotation.js +0 -7
  207. package/esm2015/lib/schema/callable.js +0 -50
  208. package/esm2015/lib/schema/entity-container.js +0 -17
  209. package/esm2015/lib/schema/entity-set.js +0 -23
  210. package/esm2015/lib/schema/enum-type.js +0 -68
  211. package/esm2015/lib/schema/schema.js +0 -55
  212. package/esm2015/lib/schema/structured-type.js +0 -107
  213. package/esm2015/lib/services/base.js +0 -23
  214. package/esm2015/lib/services/entity-set.js +0 -143
  215. package/esm2015/lib/services/entity.js +0 -10
  216. package/esm2015/lib/services/singleton.js +0 -46
  217. package/esm2015/lib/types.js +0 -37
  218. package/esm2015/lib/utils/http.js +0 -59
  219. package/esm2015/lib/utils/index.js +0 -7
  220. package/esm2015/lib/utils/objects.js +0 -140
  221. package/esm2015/lib/utils/odata.js +0 -21
  222. package/esm2015/lib/utils/types.js +0 -103
  223. package/fesm2015/angular-odata.js.map +0 -1
  224. package/lib/resources/query-options.d.ts +0 -57
@@ -1,71 +1,103 @@
1
1
  import { Observable } from 'rxjs';
2
- import { Expand, Select } from '../builder';
3
- import { ODataPathSegments } from '../path-segments';
4
- import { ODataQueryOptions } from '../query-options';
5
- import { EntityKey, ODataResource } from '../resource';
6
- import { ODataNavigationPropertyResource } from './navigation-property';
7
- import { ODataPropertyResource } from './property';
8
- import { ODataActionResource } from './action';
9
- import { ODataFunctionResource } from './function';
10
- import { HttpOptions } from './options';
11
- import { ODataEntity, ODataEntityAnnotations } from '../responses';
12
- import { ODataModel } from '../../models';
13
2
  import { ODataApi } from '../../api';
3
+ import { ODataModel } from '../../models';
4
+ import { ODataStructuredType } from '../../schema';
14
5
  import { QueryOptionNames } from '../../types';
6
+ import { ODataQueryOptions } from '../query';
7
+ import { ODataResource } from '../resource';
8
+ import { ODataEntity } from '../responses';
9
+ import { ODataActionResource } from './action';
10
+ import { ODataFunctionResource } from './function';
11
+ import { ODataNavigationPropertyResource } from './navigation-property';
12
+ import { ODataOptions } from './options';
13
+ import { ODataPropertyResource } from './property';
15
14
  export declare class ODataSingletonResource<T> extends ODataResource<T> {
16
- static factory<R>(api: ODataApi, path: string, type: string | undefined, segments: ODataPathSegments, options: ODataQueryOptions): ODataSingletonResource<R>;
17
- clone(): ODataSingletonResource<T>;
18
- schema(): import("angular-odata").ODataStructuredType<T> | undefined;
19
- asModel<M extends ODataModel<T>>(entity: Partial<T> | {
20
- [name: string]: any;
21
- }, { annots, reset }?: {
22
- annots?: ODataEntityAnnotations;
23
- reset?: boolean;
24
- }): M;
15
+ static factory<S>(api: ODataApi, { path, schema, query, }: {
16
+ path: string;
17
+ schema?: ODataStructuredType<S>;
18
+ query?: ODataQueryOptions<S>;
19
+ }): ODataSingletonResource<S>;
25
20
  key(value: any): ODataSingletonResource<T>;
26
21
  keys(values: any[]): ODataSingletonResource<T>;
27
22
  navigationProperty<N>(path: string): ODataNavigationPropertyResource<N>;
28
23
  property<P>(path: string): ODataPropertyResource<P>;
29
24
  action<P, R>(path: string): ODataActionResource<P, R>;
30
25
  function<P, R>(path: string): ODataFunctionResource<P, R>;
31
- select(opts: Select<T>): ODataSingletonResource<T>;
32
- expand(opts: Expand<T>): ODataSingletonResource<T>;
33
- format(opts: string): ODataSingletonResource<T>;
34
- get segment(): {
35
- singleton(): import("../path-segments").SegmentHandler;
36
- keys(values?: (EntityKey<T> | undefined)[] | undefined): (EntityKey<any> | undefined)[];
37
- };
38
- get query(): {
39
- select(opts?: Select<T> | undefined): import("../query-options").OptionHandler<Select<T>>;
40
- expand(opts?: Expand<T> | undefined): import("../query-options").OptionHandler<Expand<T>>;
41
- compute(opts?: string | undefined): import("../query-options").OptionHandler<string>;
42
- format(opts?: string | undefined): import("../query-options").OptionHandler<string>;
43
- apply(query: import("../query-options").QueryArguments<T>): void;
44
- };
45
- get(options?: HttpOptions & {
26
+ protected post(attrs: Partial<T>, options?: ODataOptions): Observable<ODataEntity<T>>;
27
+ protected put(attrs: Partial<T>, options?: ODataOptions & {
28
+ etag?: string;
29
+ }): Observable<ODataEntity<T>>;
30
+ protected patch(attrs: Partial<T>, options?: ODataOptions & {
31
+ etag?: string;
32
+ }): Observable<ODataEntity<T>>;
33
+ protected delete(options?: ODataOptions & {
34
+ etag?: string;
35
+ }): Observable<any>;
36
+ protected get(options?: ODataOptions & {
46
37
  etag?: string;
47
38
  bodyQueryOptions?: QueryOptionNames[];
48
39
  }): Observable<ODataEntity<T>>;
49
- post(attrs: Partial<T>, options?: HttpOptions): Observable<ODataEntity<T>>;
50
- put(attrs: Partial<T>, options?: HttpOptions & {
40
+ /**
41
+ * Creates a new entity.
42
+ * @param attrs The entity attributes to create.
43
+ * @param options The options for the request.
44
+ * @returns The created entity with the annotations.
45
+ */
46
+ create(attrs: Partial<T>, options?: ODataOptions): Observable<ODataEntity<T>>;
47
+ /**
48
+ * Updates an existing entity.
49
+ * @param attrs The entity attributes to update.
50
+ * @param options The options for the request.
51
+ * @returns The updated entity with the annotations.
52
+ */
53
+ update(attrs: Partial<T>, options?: ODataOptions & {
51
54
  etag?: string;
52
55
  }): Observable<ODataEntity<T>>;
53
- patch(attrs: Partial<T>, options?: HttpOptions & {
56
+ /**
57
+ * Modifies an existing entity.
58
+ * @param attrs The entity attributes to modify.
59
+ * @param options The options for the request.
60
+ * @returns The modified entity with the annotations.
61
+ */
62
+ modify(attrs: Partial<T>, options?: ODataOptions & {
54
63
  etag?: string;
55
64
  }): Observable<ODataEntity<T>>;
56
- delete(options?: HttpOptions & {
65
+ /**
66
+ * Delete an existing entity.
67
+ * @param options The options for the request.
68
+ * @returns Observable of the deleted entity.
69
+ */
70
+ destroy(options?: ODataOptions & {
57
71
  etag?: string;
58
72
  }): Observable<any>;
59
- fetch(options?: HttpOptions & {
73
+ /**
74
+ * Fetch an existing entity.
75
+ * @param options The options for the request.
76
+ * @param etag The etag to use for the request.
77
+ * @returns Observable of the entity with the annotations.
78
+ */
79
+ fetch(options?: ODataOptions & {
60
80
  etag?: string;
61
81
  bodyQueryOptions?: QueryOptionNames[];
62
82
  }): Observable<ODataEntity<T>>;
63
- fetchEntity(options?: HttpOptions & {
83
+ /**
84
+ * Fetch an existing entity.
85
+ * @param options The options for the request.
86
+ * @param etag The etag to use for the request.
87
+ * @returns Observable of the entity.
88
+ */
89
+ fetchEntity(options?: ODataOptions & {
64
90
  etag?: string;
65
91
  bodyQueryOptions?: QueryOptionNames[];
66
92
  }): Observable<T | null>;
67
- fetchModel(options?: HttpOptions & {
93
+ /**
94
+ * Fetch an existing entity and return a model.
95
+ * @param options The options for the request.
96
+ * @param etag The etag to use for the request.
97
+ * @returns Observable of the entity.
98
+ */
99
+ fetchModel<M extends ODataModel<T>>(options?: ODataOptions & {
68
100
  etag?: string;
69
101
  bodyQueryOptions?: QueryOptionNames[];
70
- }): Observable<ODataModel<T> | null>;
102
+ }): Observable<M | null>;
71
103
  }
@@ -1,13 +1,22 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ODataResource } from '../resource';
3
- import { ODataPathSegments } from '../path-segments';
4
- import { ODataQueryOptions } from '../query-options';
5
- import { HttpOptions } from './options';
6
2
  import { ODataApi } from '../../api';
3
+ import { ODataStructuredType } from '../../schema/structured-type';
4
+ import { ODataPathSegments } from '../path';
5
+ import { ODataQueryOptions } from '../query';
6
+ import { ODataResource } from '../resource';
7
+ import { ODataOptions } from './options';
7
8
  export declare class ODataValueResource<T> extends ODataResource<T> {
8
- static factory<V>(api: ODataApi, type: string | undefined, segments: ODataPathSegments, options: ODataQueryOptions): ODataValueResource<V>;
9
- clone(): ODataValueResource<T>;
10
- schema(): undefined;
11
- get(options?: HttpOptions): Observable<T>;
12
- fetch(options?: HttpOptions): Observable<T>;
9
+ static factory<V>(api: ODataApi, { type, schema, segments, query, }: {
10
+ type?: string;
11
+ schema?: ODataStructuredType<V>;
12
+ segments: ODataPathSegments;
13
+ query?: ODataQueryOptions<V>;
14
+ }): ODataValueResource<V>;
15
+ protected get(options?: ODataOptions): Observable<T>;
16
+ /**
17
+ * Fetch the value of the resource.
18
+ * @param options OData options.
19
+ * @returns Observable of the value.
20
+ */
21
+ fetch(options?: ODataOptions): Observable<T>;
13
22
  }
@@ -8,3 +8,21 @@ export declare class ODataAnnotation {
8
8
  properties?: string[];
9
9
  constructor(annot: AnnotationConfig);
10
10
  }
11
+ export declare class ODataAnnotatable {
12
+ annotations: ODataAnnotation[];
13
+ constructor(config: {
14
+ annotations?: AnnotationConfig[];
15
+ });
16
+ /**
17
+ * Find an annotation inside the annotatable.
18
+ * @param predicate Function that returns true if the annotation match.
19
+ * @returns The annotation that matches the predicate.
20
+ */
21
+ findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
22
+ /**
23
+ * Find an annotation inside the annotatable and return its value.
24
+ * @param term The term of the annotation to find.
25
+ * @returns The value of the annotation.
26
+ */
27
+ annotatedValue<T>(term: string | RegExp): T | undefined;
28
+ }
@@ -1,25 +1,41 @@
1
- import { Parser, CallableConfig, Options } from '../types';
1
+ import { CallableConfig, Options, Parser } from '../types';
2
+ import { ODataSchemaElement } from './element';
3
+ import { ODataCallableParser } from './parsers';
2
4
  import { ODataSchema } from './schema';
3
- import { ODataCallableParser } from '../parsers';
4
- export declare class ODataCallable<R> {
5
- schema: ODataSchema;
6
- name: string;
5
+ export declare class ODataCallable<R> extends ODataSchemaElement {
7
6
  entitySetPath?: string;
8
7
  bound?: boolean;
9
8
  composable?: boolean;
10
9
  parser: ODataCallableParser<R>;
11
10
  constructor(config: CallableConfig, schema: ODataSchema);
12
11
  path(): string;
13
- type({ alias }?: {
14
- alias?: boolean;
15
- }): string;
16
- isTypeOf(type: string): boolean;
17
- get api(): import("angular-odata").ODataApi;
18
12
  configure({ parserForType, }: {
19
13
  parserForType: (type: string) => Parser<any>;
20
14
  }): void;
15
+ /**
16
+ * Deseialize the given value from the callable.
17
+ * @param value Value to deserialize
18
+ * @param options Options for deserialization
19
+ * @returns Deserialized value
20
+ */
21
21
  deserialize(value: any, options?: Options): any;
22
+ /**
23
+ * Serialize the given value for the callable.
24
+ * @param value Value to serialize
25
+ * @param options Options for serialization
26
+ * @returns Serialized value
27
+ */
22
28
  serialize(value: any, options?: Options): any;
29
+ /**
30
+ * Encode the given value for the callable.
31
+ * @param value Value to encode
32
+ * @param options Options for encoding
33
+ * @returns Encoded value
34
+ */
23
35
  encode(value: any, options?: Options): any;
24
- binding(): import("../parsers").ODataParameterParser<any> | undefined;
36
+ /**
37
+ * Returns the binding parameter of the callable.
38
+ * @returns The binding parameter of the callable.
39
+ */
40
+ binding(): import("./parsers").ODataParameterParser<any> | undefined;
25
41
  }
@@ -0,0 +1,39 @@
1
+ import { AnnotationConfig } from '../types';
2
+ import { ODataAnnotatable } from './annotation';
3
+ import { ODataSchema } from './schema';
4
+ export declare class ODataSchemaElement extends ODataAnnotatable {
5
+ name: string;
6
+ schema: ODataSchema;
7
+ constructor(config: {
8
+ annotations?: AnnotationConfig[];
9
+ name: string;
10
+ }, schema: ODataSchema);
11
+ get api(): import("angular-odata").ODataApi;
12
+ /**
13
+ * Create a nicer looking title.
14
+ * Titleize is meant for creating pretty output.
15
+ * @param term The term of the annotation to find.
16
+ * @returns The titleized string.
17
+ */
18
+ titleize(term?: string | RegExp): string;
19
+ /**
20
+ * Returns a full type of the structured type including the namespace/alias.
21
+ * @param alias Use the alias of the namespace instead of the namespace.
22
+ * @returns The string representation of the type.
23
+ */
24
+ type({ alias }?: {
25
+ alias?: boolean;
26
+ }): string;
27
+ /**
28
+ * Returns a boolean indicating if the structured type is of the given type.
29
+ * @param type String representation of the type
30
+ * @returns True if the callable is type of the given type
31
+ */
32
+ isTypeOf(type: string): boolean;
33
+ /**
34
+ * Returns a boolean indicating if the structured type is a sub type of the given type.
35
+ * @param type String representation of the type
36
+ * @returns True if the callable is type of the given type
37
+ */
38
+ isSubtypeOf(schema: ODataSchemaElement): boolean;
39
+ }
@@ -1,13 +1,8 @@
1
- import { ODataSchema } from './schema';
2
1
  import { EntityContainerConfig } from '../types';
2
+ import { ODataSchemaElement } from './element';
3
3
  import { ODataEntitySet } from './entity-set';
4
- import { ODataAnnotation } from './annotation';
5
- export declare class ODataEntityContainer {
6
- schema: ODataSchema;
7
- name: string;
8
- annotations: ODataAnnotation[];
4
+ import { ODataSchema } from './schema';
5
+ export declare class ODataEntityContainer extends ODataSchemaElement {
9
6
  entitySets: ODataEntitySet[];
10
7
  constructor(config: EntityContainerConfig, schema: ODataSchema);
11
- get api(): import("angular-odata").ODataApi;
12
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
13
8
  }
@@ -1,16 +1,10 @@
1
- import { ODataSchema } from './schema';
2
1
  import { EntitySetConfig } from '../types';
3
- import { ODataAnnotation } from './annotation';
4
- export declare class ODataEntitySet {
5
- schema: ODataSchema;
6
- name: string;
2
+ import { ODataSchemaElement } from './element';
3
+ import { ODataSchema } from './schema';
4
+ export declare class ODataEntitySet extends ODataSchemaElement {
7
5
  entityType: string;
8
6
  service: {
9
7
  new (...params: any[]): any;
10
8
  };
11
- annotations: ODataAnnotation[];
12
9
  constructor(config: EntitySetConfig, schema: ODataSchema);
13
- isTypeOf(type: string): boolean;
14
- get api(): import("angular-odata").ODataApi;
15
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
16
10
  }
@@ -1,31 +1,58 @@
1
- import { ODataSchema } from './schema';
2
- import { ODataEnumTypeFieldParser, ODataEnumTypeParser } from '../parsers';
3
1
  import { EnumTypeConfig, Options } from '../types';
4
- import { ODataAnnotation } from './annotation';
5
- export declare class ODataEnumType<E> {
6
- schema: ODataSchema;
7
- name: string;
2
+ import { ODataSchemaElement } from './element';
3
+ import { ODataEnumTypeFieldParser, ODataEnumTypeParser } from './parsers';
4
+ import { ODataSchema } from './schema';
5
+ export declare class ODataEnumType<E> extends ODataSchemaElement {
8
6
  parser: ODataEnumTypeParser<E>;
9
7
  members: {
10
8
  [name: string]: number;
11
9
  } | {
12
10
  [value: number]: string;
13
11
  };
14
- annotations: ODataAnnotation[];
15
12
  constructor(config: EnumTypeConfig<E>, schema: ODataSchema);
16
- type({ alias }?: {
17
- alias?: boolean;
18
- }): string;
19
- isTypeOf(type: string): boolean;
20
- get api(): import("angular-odata").ODataApi;
21
13
  configure(): void;
22
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
14
+ /**
15
+ * Returns the fields of the enum type.
16
+ * @returns The fields of the enum type.
17
+ */
23
18
  fields(): ODataEnumTypeFieldParser[];
19
+ /**
20
+ * Find a field by name.
21
+ * @param name The name of the field
22
+ * @returns The field with the given name
23
+ */
24
24
  findFieldByName(name: string): ODataEnumTypeFieldParser | undefined;
25
+ /**
26
+ * Find a field by value.
27
+ * @param value The value of the field
28
+ * @returns The field with the given value
29
+ */
25
30
  findFieldByValue(value: number): ODataEnumTypeFieldParser | undefined;
26
- fieldTitle(value: number | string, pattern?: RegExp): string;
31
+ /**
32
+ * Map the fields of the enum type.
33
+ * @param mapper Function that maps the value to the new value
34
+ * @returns The fields mapped by the mapper
35
+ */
27
36
  mapFields<T>(mapper: (field: ODataEnumTypeFieldParser) => T): T[];
37
+ /**
38
+ * Deseialize the given value from the enum type.
39
+ * @param value Value to deserialize
40
+ * @param options Options for deserialization
41
+ * @returns Deserialized value
42
+ */
28
43
  deserialize(value: any, options?: Options): E;
44
+ /**
45
+ * Serialize the given value for the enum type.
46
+ * @param value Value to serialize
47
+ * @param options Options for serialization
48
+ * @returns Serialized value
49
+ */
29
50
  serialize(value: E, options?: Options): any;
51
+ /**
52
+ * Encode the given value for the enum type.
53
+ * @param value Value to encode
54
+ * @param options Options for encoding
55
+ * @returns Encoded value
56
+ */
30
57
  encode(value: E, options?: Options): any;
31
58
  }
@@ -4,3 +4,4 @@ export * from './callable';
4
4
  export * from './enum-type';
5
5
  export * from './structured-type';
6
6
  export * from './entity-set';
7
+ export * from './parsers';
@@ -1,4 +1,4 @@
1
- import { Parser, Parameter, CallableConfig, OptionsHelper, Options } from '../types';
1
+ import { CallableConfig, Options, OptionsHelper, Parameter, Parser } from '../../types';
2
2
  import { ODataEnumTypeParser } from './enum-type';
3
3
  import { ODataStructuredTypeParser } from './structured-type';
4
4
  export declare class ODataParameterParser<T> {
@@ -27,7 +27,7 @@ export declare class ODataCallableParser<R> implements Parser<R> {
27
27
  alias?: string;
28
28
  return?: {
29
29
  type: string;
30
- callable?: boolean;
30
+ collection?: boolean;
31
31
  };
32
32
  parser: Parser<any>;
33
33
  parameters: ODataParameterParser<any>[];
@@ -0,0 +1,4 @@
1
+ import { Parser } from '../../types';
2
+ export declare const EDM_PARSERS: {
3
+ [type: string]: Parser<any>;
4
+ };
@@ -1,13 +1,12 @@
1
- import { ODataAnnotation } from '../schema/annotation';
2
- import { EnumTypeConfig, Parser, OptionsHelper, EnumTypeFieldConfig, Options } from '../types';
3
- export declare class ODataEnumTypeFieldParser {
1
+ import { EnumTypeConfig, EnumTypeFieldConfig, Options, OptionsHelper, Parser } from '../../types';
2
+ import { ODataAnnotatable } from '../annotation';
3
+ export declare class ODataEnumTypeFieldParser extends ODataAnnotatable {
4
4
  name: string;
5
5
  value: number;
6
- annotations: ODataAnnotation[];
7
6
  constructor(name: string, field: EnumTypeFieldConfig);
8
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
7
+ titleize(term?: string | RegExp): string;
9
8
  }
10
- export declare class ODataEnumTypeParser<T> implements Parser<T> {
9
+ export declare class ODataEnumTypeParser<T> extends ODataAnnotatable implements Parser<T> {
11
10
  name: string;
12
11
  namespace: string;
13
12
  alias?: string;
@@ -20,6 +19,13 @@ export declare class ODataEnumTypeParser<T> implements Parser<T> {
20
19
  fields: ODataEnumTypeFieldParser[];
21
20
  optionsHelper?: OptionsHelper;
22
21
  constructor(config: EnumTypeConfig<T>, namespace: string, alias?: string);
22
+ /**
23
+ * Create a nicer looking title.
24
+ * Titleize is meant for creating pretty output.
25
+ * @param term The term of the annotation to find.
26
+ * @returns The titleized string.
27
+ */
28
+ ttitelize(term?: string | RegExp): string;
23
29
  configure({ options }: {
24
30
  options: OptionsHelper;
25
31
  }): void;
@@ -29,7 +35,7 @@ export declare class ODataEnumTypeParser<T> implements Parser<T> {
29
35
  encode(value: T, options?: Options): any;
30
36
  toJsonSchema(): any;
31
37
  validate(member: string | number, { method, navigation, }?: {
32
- method?: 'create' | 'update' | 'patch';
38
+ method?: 'create' | 'update' | 'modify';
33
39
  navigation?: boolean;
34
40
  }): string[] | undefined;
35
41
  }
File without changes
@@ -1,6 +1,6 @@
1
- import { Parser, StructuredTypeFieldConfig, StructuredTypeConfig, OptionsHelper, Options } from '../types';
1
+ import { Options, OptionsHelper, Parser, StructuredTypeConfig, StructuredTypeFieldConfig } from '../../types';
2
+ import { ODataAnnotatable } from '../annotation';
2
3
  import { ODataEnumTypeParser } from './enum-type';
3
- import { ODataAnnotation } from '../schema/annotation';
4
4
  declare type JsonSchemaSelect<T> = Array<keyof T>;
5
5
  declare type JsonSchemaCustom<T> = {
6
6
  [P in keyof T]?: (schema: any, field: ODataStructuredTypeFieldParser<T[P]>) => any;
@@ -33,7 +33,7 @@ export declare class ODataReferential {
33
33
  referencedProperty: string;
34
34
  });
35
35
  }
36
- export declare class ODataStructuredTypeFieldParser<T> implements Parser<T> {
36
+ export declare class ODataStructuredTypeFieldParser<T> extends ODataAnnotatable implements Parser<T> {
37
37
  name: string;
38
38
  private structuredType;
39
39
  type: string;
@@ -46,12 +46,10 @@ export declare class ODataStructuredTypeFieldParser<T> implements Parser<T> {
46
46
  precision?: number;
47
47
  scale?: number;
48
48
  referentials: ODataReferential[];
49
- annotations: ODataAnnotation[];
50
49
  optionsHelper?: OptionsHelper;
51
50
  constructor(name: string, structuredType: ODataStructuredTypeParser<any>, field: StructuredTypeFieldConfig);
52
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
53
51
  validate(value: any, { method, navigation, }?: {
54
- method?: 'create' | 'update' | 'patch';
52
+ method?: 'create' | 'update' | 'modify';
55
53
  navigation?: boolean;
56
54
  }): {
57
55
  [name: string]: any;
@@ -76,7 +74,7 @@ export declare class ODataStructuredTypeFieldParser<T> implements Parser<T> {
76
74
  isStructuredType(): boolean;
77
75
  structured(): ODataStructuredTypeParser<T>;
78
76
  }
79
- export declare class ODataStructuredTypeParser<T> implements Parser<T> {
77
+ export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable implements Parser<T> {
80
78
  name: string;
81
79
  namespace: string;
82
80
  open: boolean;
@@ -88,8 +86,15 @@ export declare class ODataStructuredTypeParser<T> implements Parser<T> {
88
86
  fields: ODataStructuredTypeFieldParser<any>[];
89
87
  optionsHelper?: OptionsHelper;
90
88
  constructor(config: StructuredTypeConfig<T>, namespace: string, alias?: string);
89
+ /**
90
+ * Create a nicer looking title.
91
+ * Titleize is meant for creating pretty output.
92
+ * @param term The term of the annotation to find.
93
+ * @returns The titleized string.
94
+ */
95
+ titleize(term?: string | RegExp): string;
91
96
  isTypeOf(type: string): boolean;
92
- typeFor(name: string): string | undefined;
97
+ isSubtypeOf(type: string): boolean;
93
98
  findChildParser(predicate: (p: ODataStructuredTypeParser<any>) => boolean): ODataStructuredTypeParser<any> | undefined;
94
99
  childParser(predicate: (p: ODataStructuredTypeParser<any>) => boolean): Parser<any>;
95
100
  deserialize(value: any, options?: Options): T;
@@ -106,7 +111,7 @@ export declare class ODataStructuredTypeParser<T> implements Parser<T> {
106
111
  toJsonSchema(options?: JsonSchemaOptions<T>): any;
107
112
  validate(attrs: any, { method, navigation, }?: {
108
113
  create?: boolean;
109
- method?: 'create' | 'update' | 'patch';
114
+ method?: 'create' | 'update' | 'modify';
110
115
  navigation?: boolean;
111
116
  }): {
112
117
  [name: string]: any;
@@ -1,12 +1,12 @@
1
- import { ODataStructuredType } from './structured-type';
1
+ import { ODataApi } from '../api';
2
+ import { Parser, SchemaConfig } from '../types';
3
+ import { ODataAnnotatable } from './annotation';
2
4
  import { ODataCallable } from './callable';
3
5
  import { ODataEntityContainer } from './entity-container';
4
- import { ODataEnumType } from './enum-type';
5
- import { ODataApi } from '../api';
6
- import { SchemaConfig, Parser } from '../types';
7
6
  import { ODataEntitySet } from './entity-set';
8
- import { ODataAnnotation } from './annotation';
9
- export declare class ODataSchema {
7
+ import { ODataEnumType } from './enum-type';
8
+ import { ODataStructuredType } from './structured-type';
9
+ export declare class ODataSchema extends ODataAnnotatable {
10
10
  api: ODataApi;
11
11
  namespace: string;
12
12
  alias?: string;
@@ -14,11 +14,9 @@ export declare class ODataSchema {
14
14
  entities: ODataStructuredType<any>[];
15
15
  callables: ODataCallable<any>[];
16
16
  containers: ODataEntityContainer[];
17
- annotations: ODataAnnotation[];
18
17
  constructor(config: SchemaConfig, api: ODataApi);
19
18
  isNamespaceOf(type: string): boolean | "" | undefined;
20
19
  get entitySets(): ODataEntitySet[];
21
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
22
20
  findEnumTypeForType<T>(type: string): ODataEnumType<T> | undefined;
23
21
  findStructuredTypeForType<T>(type: string): ODataStructuredType<T> | undefined;
24
22
  findCallableForType<T>(type: string, bindingType?: string): ODataCallable<T> | undefined;