angular-odata 0.80.0 → 0.99.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 (237) hide show
  1. package/README.md +69 -34
  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} +3 -3
  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} +1 -1
  7. package/{esm2015/lib/cache/storage.js → esm2020/lib/cache/storage.mjs} +2 -2
  8. package/esm2020/lib/client.mjs +271 -0
  9. package/{esm2015/lib/constants.js → esm2020/lib/constants.mjs} +8 -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} +7 -7
  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/base.mjs +20 -0
  24. package/esm2020/lib/resources/query/expressions/compute.mjs +38 -0
  25. package/esm2020/lib/resources/query/expressions/expand.mjs +57 -0
  26. package/esm2020/lib/resources/query/expressions/filter.mjs +154 -0
  27. package/esm2020/lib/resources/query/expressions/index.mjs +7 -0
  28. package/esm2020/lib/resources/query/expressions/orderby.mjs +54 -0
  29. package/esm2020/lib/resources/query/expressions/search.mjs +113 -0
  30. package/esm2020/lib/resources/query/expressions/select.mjs +32 -0
  31. package/esm2020/lib/resources/query/expressions/syntax.mjs +371 -0
  32. package/esm2020/lib/resources/query/handlers.mjs +188 -0
  33. package/esm2020/lib/resources/query/index.mjs +4 -0
  34. package/esm2020/lib/resources/query/options.mjs +103 -0
  35. package/esm2020/lib/resources/request.mjs +167 -0
  36. package/esm2020/lib/resources/resource.mjs +326 -0
  37. package/esm2020/lib/resources/responses/annotations.mjs +119 -0
  38. package/{esm2015/lib/resources/responses/csdl/csdl-annotation.js → esm2020/lib/resources/responses/csdl/csdl-annotation.mjs} +0 -0
  39. package/{esm2015/lib/resources/responses/csdl/csdl-entity-container.js → esm2020/lib/resources/responses/csdl/csdl-entity-container.mjs} +0 -0
  40. package/{esm2015/lib/resources/responses/csdl/csdl-entity-set.js → esm2020/lib/resources/responses/csdl/csdl-entity-set.mjs} +0 -0
  41. package/{esm2015/lib/resources/responses/csdl/csdl-enum-type.js → esm2020/lib/resources/responses/csdl/csdl-enum-type.mjs} +0 -0
  42. package/{esm2015/lib/resources/responses/csdl/csdl-function-action.js → esm2020/lib/resources/responses/csdl/csdl-function-action.mjs} +0 -0
  43. package/{esm2015/lib/resources/responses/csdl/csdl-navigation-property-binding.js → esm2020/lib/resources/responses/csdl/csdl-navigation-property-binding.mjs} +0 -0
  44. package/{esm2015/lib/resources/responses/csdl/csdl-reference.js → esm2020/lib/resources/responses/csdl/csdl-reference.mjs} +0 -0
  45. package/{esm2015/lib/resources/responses/csdl/csdl-schema.js → esm2020/lib/resources/responses/csdl/csdl-schema.mjs} +0 -0
  46. package/{esm2015/lib/resources/responses/csdl/csdl-singleton.js → esm2020/lib/resources/responses/csdl/csdl-singleton.mjs} +0 -0
  47. package/{esm2015/lib/resources/responses/csdl/csdl-structural-property.js → esm2020/lib/resources/responses/csdl/csdl-structural-property.mjs} +0 -0
  48. package/{esm2015/lib/resources/responses/csdl/csdl-structured-type.js → esm2020/lib/resources/responses/csdl/csdl-structured-type.mjs} +0 -0
  49. package/{esm2015/lib/resources/responses/csdl/csdl-type-definition.js → esm2020/lib/resources/responses/csdl/csdl-type-definition.mjs} +0 -0
  50. package/{esm2015/lib/resources/responses/index.js → esm2020/lib/resources/responses/index.mjs} +0 -0
  51. package/esm2020/lib/resources/responses/metadata.mjs +547 -0
  52. package/{esm2015/lib/resources/responses/options.js → esm2020/lib/resources/responses/options.mjs} +0 -0
  53. package/{esm2015/lib/resources/responses/response.js → esm2020/lib/resources/responses/response.mjs} +0 -0
  54. package/{esm2015/lib/resources/responses/types.js → esm2020/lib/resources/responses/types.mjs} +0 -0
  55. package/esm2020/lib/resources/types/action.mjs +101 -0
  56. package/esm2020/lib/resources/types/batch.mjs +309 -0
  57. package/esm2020/lib/resources/types/count.mjs +27 -0
  58. package/esm2020/lib/resources/types/entity-set.mjs +94 -0
  59. package/esm2020/lib/resources/types/entity.mjs +106 -0
  60. package/esm2020/lib/resources/types/function.mjs +137 -0
  61. package/{esm2015/lib/resources/types/index.js → esm2020/lib/resources/types/index.mjs} +0 -0
  62. package/esm2020/lib/resources/types/media.mjs +41 -0
  63. package/esm2020/lib/resources/types/metadata.mjs +30 -0
  64. package/esm2020/lib/resources/types/navigation-property.mjs +226 -0
  65. package/esm2020/lib/resources/types/options.mjs +2 -0
  66. package/esm2020/lib/resources/types/property.mjs +183 -0
  67. package/esm2020/lib/resources/types/reference.mjs +85 -0
  68. package/esm2020/lib/resources/types/singleton.mjs +126 -0
  69. package/esm2020/lib/resources/types/value.mjs +41 -0
  70. package/esm2020/lib/schema/annotation.mjs +37 -0
  71. package/esm2020/lib/schema/callable.mjs +62 -0
  72. package/esm2020/lib/schema/element.mjs +51 -0
  73. package/esm2020/lib/schema/entity-container.mjs +9 -0
  74. package/esm2020/lib/schema/entity-set.mjs +9 -0
  75. package/esm2020/lib/schema/enum-type.mjs +71 -0
  76. package/{esm2015/lib/schema/index.js → esm2020/lib/schema/index.mjs} +2 -1
  77. package/esm2020/lib/schema/parsers/callable.mjs +113 -0
  78. package/esm2020/lib/schema/parsers/edm.mjs +95 -0
  79. package/esm2020/lib/schema/parsers/enum-type.mjs +107 -0
  80. package/esm2020/lib/schema/parsers/index.mjs +5 -0
  81. package/esm2020/lib/schema/parsers/structured-type.mjs +412 -0
  82. package/esm2020/lib/schema/schema.mjs +61 -0
  83. package/esm2020/lib/schema/structured-type.mjs +198 -0
  84. package/esm2020/lib/services/base.mjs +29 -0
  85. package/esm2020/lib/services/entity-set.mjs +143 -0
  86. package/esm2020/lib/services/entity.mjs +12 -0
  87. package/{esm2015/lib/services/factory.js → esm2020/lib/services/factory.mjs} +3 -3
  88. package/{esm2015/lib/services/index.js → esm2020/lib/services/index.mjs} +0 -0
  89. package/esm2020/lib/services/singleton.mjs +48 -0
  90. package/{esm2015/lib/settings.js → esm2020/lib/settings.mjs} +1 -1
  91. package/{esm2015/lib/tokens.js → esm2020/lib/tokens.mjs} +0 -0
  92. package/esm2020/lib/types.mjs +37 -0
  93. package/esm2020/lib/utils/arraybuffers.mjs +46 -0
  94. package/{esm2015/lib/utils/dates.js → esm2020/lib/utils/dates.mjs} +0 -0
  95. package/esm2020/lib/utils/durations.mjs +40 -0
  96. package/{esm2015/lib/utils/enums.js → esm2020/lib/utils/enums.mjs} +0 -0
  97. package/esm2020/lib/utils/http.mjs +93 -0
  98. package/esm2020/lib/utils/index.mjs +10 -0
  99. package/esm2020/lib/utils/objects.mjs +195 -0
  100. package/esm2020/lib/utils/odata.mjs +22 -0
  101. package/esm2020/lib/utils/strings.mjs +20 -0
  102. package/esm2020/lib/utils/types.mjs +134 -0
  103. package/{esm2015/lib/utils/urls.js → esm2020/lib/utils/urls.mjs} +0 -0
  104. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  105. package/fesm2015/{angular-odata.js → angular-odata.mjs} +4508 -3427
  106. package/fesm2015/angular-odata.mjs.map +1 -0
  107. package/fesm2020/angular-odata.mjs +10510 -0
  108. package/fesm2020/angular-odata.mjs.map +1 -0
  109. package/lib/api.d.ts +14 -14
  110. package/lib/cache/cache.d.ts +2 -2
  111. package/lib/cache/storage.d.ts +1 -1
  112. package/lib/client.d.ts +60 -9
  113. package/lib/constants.d.ts +5 -2
  114. package/lib/index.d.ts +0 -1
  115. package/lib/models/collection.d.ts +30 -42
  116. package/lib/models/model.d.ts +37 -30
  117. package/lib/models/options.d.ts +30 -38
  118. package/lib/module.d.ts +1 -1
  119. package/lib/options.d.ts +47 -0
  120. package/lib/resources/index.d.ts +2 -3
  121. package/lib/resources/path/handlers.d.ts +27 -0
  122. package/lib/resources/path/index.d.ts +2 -0
  123. package/lib/resources/{path-segments.d.ts → path/segments.d.ts} +4 -16
  124. package/lib/resources/{builder.d.ts → query/builder.d.ts} +12 -7
  125. package/lib/resources/query/expressions/base.d.ts +19 -0
  126. package/lib/resources/query/expressions/compute.d.ts +26 -0
  127. package/lib/resources/query/expressions/expand.d.ts +40 -0
  128. package/lib/resources/query/expressions/filter.d.ts +58 -0
  129. package/lib/resources/query/expressions/index.d.ts +6 -0
  130. package/lib/resources/query/expressions/orderby.d.ts +37 -0
  131. package/lib/resources/query/expressions/search.d.ts +47 -0
  132. package/lib/resources/query/expressions/select.d.ts +21 -0
  133. package/lib/resources/query/expressions/syntax.d.ts +177 -0
  134. package/lib/resources/query/handlers.d.ts +104 -0
  135. package/lib/resources/query/index.d.ts +3 -0
  136. package/lib/resources/query/options.d.ts +38 -0
  137. package/lib/resources/request.d.ts +4 -3
  138. package/lib/resources/resource.d.ts +42 -48
  139. package/lib/resources/types/action.d.ts +14 -61
  140. package/lib/resources/types/batch.d.ts +16 -3
  141. package/lib/resources/types/count.d.ts +9 -17
  142. package/lib/resources/types/entity-set.d.ts +12 -51
  143. package/lib/resources/types/entity.d.ts +13 -31
  144. package/lib/resources/types/function.d.ts +13 -60
  145. package/lib/resources/types/media.d.ts +9 -8
  146. package/lib/resources/types/metadata.d.ts +3 -5
  147. package/lib/resources/types/navigation-property.d.ts +74 -65
  148. package/lib/resources/types/options.d.ts +1 -1
  149. package/lib/resources/types/property.d.ts +49 -57
  150. package/lib/resources/types/reference.d.ts +65 -9
  151. package/lib/resources/types/singleton.d.ts +53 -31
  152. package/lib/resources/types/value.d.ts +16 -7
  153. package/lib/schema/annotation.d.ts +18 -0
  154. package/lib/schema/callable.d.ts +4 -20
  155. package/lib/schema/element.d.ts +39 -0
  156. package/lib/schema/entity-container.d.ts +2 -12
  157. package/lib/schema/entity-set.d.ts +2 -18
  158. package/lib/schema/enum-type.d.ts +19 -25
  159. package/lib/schema/index.d.ts +1 -0
  160. package/lib/{parsers → schema/parsers}/callable.d.ts +2 -2
  161. package/lib/schema/parsers/edm.d.ts +4 -0
  162. package/lib/{parsers → schema/parsers}/enum-type.d.ts +12 -11
  163. package/lib/{parsers → schema/parsers}/index.d.ts +0 -0
  164. package/lib/{parsers → schema/parsers}/structured-type.d.ts +12 -12
  165. package/lib/schema/schema.d.ts +3 -10
  166. package/lib/schema/structured-type.d.ts +65 -27
  167. package/lib/services/base.d.ts +2 -2
  168. package/lib/services/entity-set.d.ts +5 -2
  169. package/lib/services/entity.d.ts +4 -1
  170. package/lib/services/singleton.d.ts +5 -2
  171. package/lib/settings.d.ts +5 -5
  172. package/lib/types.d.ts +1 -0
  173. package/lib/utils/arraybuffers.d.ts +4 -0
  174. package/lib/{parsers/edm.d.ts → utils/durations.d.ts} +3 -3
  175. package/lib/utils/http.d.ts +1 -0
  176. package/lib/utils/index.d.ts +1 -0
  177. package/lib/utils/objects.d.ts +1 -0
  178. package/lib/utils/strings.d.ts +1 -0
  179. package/lib/utils/types.d.ts +2 -0
  180. package/package.json +21 -8
  181. package/bundles/angular-odata.umd.js +0 -11048
  182. package/bundles/angular-odata.umd.js.map +0 -1
  183. package/esm2015/lib/api.js +0 -297
  184. package/esm2015/lib/client.js +0 -221
  185. package/esm2015/lib/helper.js +0 -271
  186. package/esm2015/lib/index.js +0 -21
  187. package/esm2015/lib/models/collection.js +0 -687
  188. package/esm2015/lib/models/model.js +0 -423
  189. package/esm2015/lib/models/options.js +0 -909
  190. package/esm2015/lib/options.js +0 -31
  191. package/esm2015/lib/parsers/callable.js +0 -107
  192. package/esm2015/lib/parsers/edm.js +0 -192
  193. package/esm2015/lib/parsers/enum-type.js +0 -102
  194. package/esm2015/lib/parsers/index.js +0 -5
  195. package/esm2015/lib/parsers/structured-type.js +0 -389
  196. package/esm2015/lib/resources/builder.js +0 -537
  197. package/esm2015/lib/resources/index.js +0 -8
  198. package/esm2015/lib/resources/path-segments.js +0 -156
  199. package/esm2015/lib/resources/query-options.js +0 -157
  200. package/esm2015/lib/resources/request.js +0 -149
  201. package/esm2015/lib/resources/resource.js +0 -337
  202. package/esm2015/lib/resources/responses/annotations.js +0 -121
  203. package/esm2015/lib/resources/responses/metadata.js +0 -548
  204. package/esm2015/lib/resources/types/action.js +0 -180
  205. package/esm2015/lib/resources/types/batch.js +0 -288
  206. package/esm2015/lib/resources/types/count.js +0 -55
  207. package/esm2015/lib/resources/types/entity-set.js +0 -169
  208. package/esm2015/lib/resources/types/entity.js +0 -170
  209. package/esm2015/lib/resources/types/function.js +0 -205
  210. package/esm2015/lib/resources/types/media.js +0 -47
  211. package/esm2015/lib/resources/types/metadata.js +0 -36
  212. package/esm2015/lib/resources/types/navigation-property.js +0 -232
  213. package/esm2015/lib/resources/types/options.js +0 -2
  214. package/esm2015/lib/resources/types/property.js +0 -195
  215. package/esm2015/lib/resources/types/reference.js +0 -50
  216. package/esm2015/lib/resources/types/singleton.js +0 -159
  217. package/esm2015/lib/resources/types/value.js +0 -30
  218. package/esm2015/lib/schema/annotation.js +0 -7
  219. package/esm2015/lib/schema/callable.js +0 -82
  220. package/esm2015/lib/schema/entity-container.js +0 -22
  221. package/esm2015/lib/schema/entity-set.js +0 -33
  222. package/esm2015/lib/schema/enum-type.js +0 -101
  223. package/esm2015/lib/schema/schema.js +0 -60
  224. package/esm2015/lib/schema/structured-type.js +0 -148
  225. package/esm2015/lib/services/base.js +0 -23
  226. package/esm2015/lib/services/entity-set.js +0 -143
  227. package/esm2015/lib/services/entity.js +0 -10
  228. package/esm2015/lib/services/singleton.js +0 -46
  229. package/esm2015/lib/types.js +0 -37
  230. package/esm2015/lib/utils/http.js +0 -89
  231. package/esm2015/lib/utils/index.js +0 -9
  232. package/esm2015/lib/utils/objects.js +0 -139
  233. package/esm2015/lib/utils/odata.js +0 -21
  234. package/esm2015/lib/utils/strings.js +0 -13
  235. package/esm2015/lib/utils/types.js +0 -103
  236. package/fesm2015/angular-odata.js.map +0 -1
  237. package/lib/resources/query-options.d.ts +0 -57
@@ -1,47 +1,28 @@
1
- import { EntityKey, ODataResource } from '../resource';
2
- import { Expand, Select } from '../builder';
3
- import { ODataEntity, ODataEntityAnnotations } from '../responses';
1
+ import { Observable } from 'rxjs';
2
+ import { ODataApi } from '../../api';
3
+ import { ODataModel } from '../../models';
4
+ import { ODataStructuredType } from '../../schema';
4
5
  import { QueryOptionNames } from '../../types';
6
+ import { ODataQueryOptions } from '../query';
7
+ import { ODataResource } from '../resource';
8
+ import { ODataEntity } from '../responses';
5
9
  import { ODataActionResource } from './action';
6
- import { ODataApi } from '../../api';
7
10
  import { ODataFunctionResource } from './function';
8
- import { ODataModel } from '../../models';
9
11
  import { ODataNavigationPropertyResource } from './navigation-property';
10
12
  import { ODataOptions } from './options';
11
- import { ODataPathSegments } from '../path-segments';
12
13
  import { ODataPropertyResource } from './property';
13
- import { ODataQueryOptions } from '../query-options';
14
- import { Observable } from 'rxjs';
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").ODataQueryArguments<T>): void;
44
- };
45
26
  protected post(attrs: Partial<T>, options?: ODataOptions): Observable<ODataEntity<T>>;
46
27
  protected put(attrs: Partial<T>, options?: ODataOptions & {
47
28
  etag?: string;
@@ -56,24 +37,65 @@ export declare class ODataSingletonResource<T> extends ODataResource<T> {
56
37
  etag?: string;
57
38
  bodyQueryOptions?: QueryOptionNames[];
58
39
  }): Observable<ODataEntity<T>>;
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
+ */
59
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
+ */
60
53
  update(attrs: Partial<T>, options?: ODataOptions & {
61
54
  etag?: string;
62
55
  }): Observable<ODataEntity<T>>;
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
+ */
63
62
  modify(attrs: Partial<T>, options?: ODataOptions & {
64
63
  etag?: string;
65
64
  }): Observable<ODataEntity<T>>;
65
+ /**
66
+ * Delete an existing entity.
67
+ * @param options The options for the request.
68
+ * @returns Observable of the deleted entity.
69
+ */
66
70
  destroy(options?: ODataOptions & {
67
71
  etag?: string;
68
72
  }): Observable<any>;
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
+ */
69
79
  fetch(options?: ODataOptions & {
70
80
  etag?: string;
71
81
  bodyQueryOptions?: QueryOptionNames[];
72
82
  }): Observable<ODataEntity<T>>;
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
+ */
73
89
  fetchEntity(options?: ODataOptions & {
74
90
  etag?: string;
75
91
  bodyQueryOptions?: QueryOptionNames[];
76
92
  }): Observable<T | null>;
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
+ */
77
99
  fetchModel<M extends ODataModel<T>>(options?: ODataOptions & {
78
100
  etag?: string;
79
101
  bodyQueryOptions?: QueryOptionNames[];
@@ -1,13 +1,22 @@
1
+ import { Observable } from 'rxjs';
1
2
  import { ODataApi } from '../../api';
2
- import { ODataOptions } from './options';
3
- import { ODataPathSegments } from '../path-segments';
4
- import { ODataQueryOptions } from '../query-options';
3
+ import { ODataStructuredType } from '../../schema/structured-type';
4
+ import { ODataPathSegments } from '../path';
5
+ import { ODataQueryOptions } from '../query';
5
6
  import { ODataResource } from '../resource';
6
- import { Observable } from 'rxjs';
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;
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>;
11
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
+ */
12
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,30 +1,14 @@
1
1
  import { CallableConfig, Options, Parser } from '../types';
2
- import { ODataCallableParser } from '../parsers';
2
+ import { ODataSchemaElement } from './element';
3
+ import { ODataCallableParser } from './parsers';
3
4
  import { ODataSchema } from './schema';
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
- /**
14
- * Returns a full type of the callable including the namespace/alias.
15
- * @param alias Use the alias of the namespace instead of the namespace.
16
- * @returns The string representation of the type.
17
- */
18
- type({ alias }?: {
19
- alias?: boolean;
20
- }): string;
21
- /**
22
- * Returns a boolean indicating if the callable is of the given type.
23
- * @param type String representation of the type
24
- * @returns True if the callable is type of the given type
25
- */
26
- isTypeOf(type: string): boolean;
27
- get api(): import("angular-odata").ODataApi;
28
12
  configure({ parserForType, }: {
29
13
  parserForType: (type: string) => Parser<any>;
30
14
  }): void;
@@ -53,5 +37,5 @@ export declare class ODataCallable<R> {
53
37
  * Returns the binding parameter of the callable.
54
38
  * @returns The binding parameter of the callable.
55
39
  */
56
- binding(): import("../parsers").ODataParameterParser<any> | undefined;
40
+ binding(): import("./parsers").ODataParameterParser<any> | undefined;
57
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,18 +1,8 @@
1
1
  import { EntityContainerConfig } from '../types';
2
- import { ODataAnnotation } from './annotation';
2
+ import { ODataSchemaElement } from './element';
3
3
  import { ODataEntitySet } from './entity-set';
4
4
  import { ODataSchema } from './schema';
5
- export declare class ODataEntityContainer {
6
- schema: ODataSchema;
7
- name: string;
8
- annotations: ODataAnnotation[];
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
- /**
13
- * Find an annotation inside the entity container.
14
- * @param predicate Function that returns true if the annotation match.
15
- * @returns The annotation that matches the predicate.
16
- */
17
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
18
8
  }
@@ -1,26 +1,10 @@
1
1
  import { EntitySetConfig } from '../types';
2
- import { ODataAnnotation } from './annotation';
2
+ import { ODataSchemaElement } from './element';
3
3
  import { ODataSchema } from './schema';
4
- export declare class ODataEntitySet {
5
- schema: ODataSchema;
6
- name: string;
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
- /**
14
- * Returns a boolean indicating if the entity set is of the given type.
15
- * @param type String representation of the type
16
- * @returns True if the callable is type of the given type
17
- */
18
- isTypeOf(type: string): boolean;
19
- get api(): import("angular-odata").ODataApi;
20
- /**
21
- * Find an annotation inside the entity set.
22
- * @param predicate Function that returns true if the annotation match.
23
- * @returns The annotation that matches the predicate.
24
- */
25
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
26
10
  }
@@ -1,44 +1,38 @@
1
1
  import { EnumTypeConfig, Options } from '../types';
2
- import { ODataEnumTypeFieldParser, ODataEnumTypeParser } from '../parsers';
3
- import { ODataAnnotation } from './annotation';
2
+ import { ODataSchemaElement } from './element';
3
+ import { ODataEnumTypeFieldParser, ODataEnumTypeParser } from './parsers';
4
4
  import { ODataSchema } from './schema';
5
- export declare class ODataEnumType<E> {
6
- schema: ODataSchema;
7
- name: string;
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);
13
+ configure(): void;
16
14
  /**
17
- * Returns a full type of the enum type including the namespace/alias.
18
- * @param alias Use the alias of the namespace instead of the namespace.
19
- * @returns The string representation of the type.
15
+ * Returns the fields of the enum type.
16
+ * @returns The fields of the enum type.
20
17
  */
21
- type({ alias }?: {
22
- alias?: boolean;
23
- }): string;
18
+ fields(): ODataEnumTypeFieldParser[];
24
19
  /**
25
- * Returns a boolean indicating if the enum type is of the given type.
26
- * @param type String representation of the type
27
- * @returns True if the callable is type of the given type
20
+ * Find a field by name.
21
+ * @param name The name of the field
22
+ * @returns The field with the given name
28
23
  */
29
- isTypeOf(type: string): boolean;
30
- get api(): import("angular-odata").ODataApi;
31
- configure(): void;
24
+ findFieldByName(name: string): ODataEnumTypeFieldParser | undefined;
32
25
  /**
33
- * Find an annotation inside the enum type.
34
- * @param predicate Function that returns true if the annotation match.
35
- * @returns The annotation that matches the predicate.
26
+ * Find a field by value.
27
+ * @param value The value of the field
28
+ * @returns The field with the given value
36
29
  */
37
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
38
- fields(): ODataEnumTypeFieldParser[];
39
- findFieldByName(name: string): ODataEnumTypeFieldParser | undefined;
40
30
  findFieldByValue(value: number): ODataEnumTypeFieldParser | undefined;
41
- 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
+ */
42
36
  mapFields<T>(mapper: (field: ODataEnumTypeFieldParser) => T): T[];
43
37
  /**
44
38
  * Deseialize the given value from the enum type.
@@ -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 { CallableConfig, Options, OptionsHelper, Parameter, Parser } 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,18 +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
- /**
9
- * Find an annotation inside the enum field.
10
- * @param predicate Function that returns true if the annotation match.
11
- * @returns The annotation that matches the predicate.
12
- */
13
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
7
+ titleize(term?: string | RegExp): string;
14
8
  }
15
- export declare class ODataEnumTypeParser<T> implements Parser<T> {
9
+ export declare class ODataEnumTypeParser<T> extends ODataAnnotatable implements Parser<T> {
16
10
  name: string;
17
11
  namespace: string;
18
12
  alias?: string;
@@ -25,6 +19,13 @@ export declare class ODataEnumTypeParser<T> implements Parser<T> {
25
19
  fields: ODataEnumTypeFieldParser[];
26
20
  optionsHelper?: OptionsHelper;
27
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;
28
29
  configure({ options }: {
29
30
  options: OptionsHelper;
30
31
  }): void;
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,15 +46,8 @@ 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
- /**
53
- * Find an annotation inside the structured field type.
54
- * @param predicate Function that returns true if the annotation match.
55
- * @returns The annotation that matches the predicate.
56
- */
57
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
58
51
  validate(value: any, { method, navigation, }?: {
59
52
  method?: 'create' | 'update' | 'modify';
60
53
  navigation?: boolean;
@@ -81,7 +74,7 @@ export declare class ODataStructuredTypeFieldParser<T> implements Parser<T> {
81
74
  isStructuredType(): boolean;
82
75
  structured(): ODataStructuredTypeParser<T>;
83
76
  }
84
- export declare class ODataStructuredTypeParser<T> implements Parser<T> {
77
+ export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable implements Parser<T> {
85
78
  name: string;
86
79
  namespace: string;
87
80
  open: boolean;
@@ -93,8 +86,15 @@ export declare class ODataStructuredTypeParser<T> implements Parser<T> {
93
86
  fields: ODataStructuredTypeFieldParser<any>[];
94
87
  optionsHelper?: OptionsHelper;
95
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;
96
96
  isTypeOf(type: string): boolean;
97
- typeFor(name: string): string | undefined;
97
+ isSubtypeOf(type: string): boolean;
98
98
  findChildParser(predicate: (p: ODataStructuredTypeParser<any>) => boolean): ODataStructuredTypeParser<any> | undefined;
99
99
  childParser(predicate: (p: ODataStructuredTypeParser<any>) => boolean): Parser<any>;
100
100
  deserialize(value: any, options?: Options): T;
@@ -1,12 +1,12 @@
1
- import { Parser, SchemaConfig } from '../types';
2
- import { ODataAnnotation } from './annotation';
3
1
  import { ODataApi } from '../api';
2
+ import { Parser, SchemaConfig } from '../types';
3
+ import { ODataAnnotatable } from './annotation';
4
4
  import { ODataCallable } from './callable';
5
5
  import { ODataEntityContainer } from './entity-container';
6
6
  import { ODataEntitySet } from './entity-set';
7
7
  import { ODataEnumType } from './enum-type';
8
8
  import { ODataStructuredType } from './structured-type';
9
- export declare class ODataSchema {
9
+ export declare class ODataSchema extends ODataAnnotatable {
10
10
  api: ODataApi;
11
11
  namespace: string;
12
12
  alias?: string;
@@ -14,16 +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
- /**
22
- * Find an annotation inside the schema.
23
- * @param predicate Function that returns true if the annotation match.
24
- * @returns The annotation that matches the predicate.
25
- */
26
- findAnnotation(predicate: (annot: ODataAnnotation) => boolean): ODataAnnotation | undefined;
27
20
  findEnumTypeForType<T>(type: string): ODataEnumType<T> | undefined;
28
21
  findStructuredTypeForType<T>(type: string): ODataStructuredType<T> | undefined;
29
22
  findCallableForType<T>(type: string, bindingType?: string): ODataCallable<T> | undefined;