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,128 +1,143 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ODataModel, ODataCollection } from '../../models';
3
2
  import { ODataApi } from '../../api';
4
- import { EntityKey, ODataResource } from '../resource';
5
- import { Expand, Select, Transform, Filter, OrderBy } from '../builder';
6
- import { ODataEntities, ODataEntitiesAnnotations, ODataEntity, ODataEntityAnnotations } from '../responses';
7
- import { ODataQueryOptions } from '../query-options';
8
- import { ODataPathSegments } from '../path-segments';
9
- import { ODataReferenceResource } from './reference';
3
+ import { ODataCollection, ODataModel } from '../../models';
4
+ import { ODataStructuredType } from '../../schema';
5
+ import { QueryOptionNames } from '../../types';
6
+ import { ODataPathSegments } from '../path';
7
+ import { ODataQueryOptions } from '../query';
8
+ import { ODataResource } from '../resource';
9
+ import { ODataEntities, ODataEntity } from '../responses';
10
10
  import { ODataCountResource } from './count';
11
- import { ODataPropertyResource } from './property';
12
- import { HttpEntityOptions, HttpEntitiesOptions, HttpOptions } from './options';
13
11
  import { ODataMediaResource } from './media';
14
- import { QueryOptionNames } from '../../types';
12
+ import { ODataEntitiesOptions, ODataEntityOptions, ODataOptions } from './options';
13
+ import { ODataPropertyResource } from './property';
14
+ import { ODataReferenceResource } from './reference';
15
15
  /**
16
16
  * OData Navigation Property Resource
17
17
  * https://www.odata.org/getting-started/advanced-tutorial/#containment
18
18
  * https://www.odata.org/getting-started/advanced-tutorial/#derived
19
19
  */
20
20
  export declare class ODataNavigationPropertyResource<T> extends ODataResource<T> {
21
- static factory<E>(api: ODataApi, path: string, type: string | undefined, segments: ODataPathSegments, options: ODataQueryOptions): ODataNavigationPropertyResource<E>;
22
- clone(): ODataNavigationPropertyResource<T>;
23
- schema(): import("angular-odata").ODataStructuredType<T> | undefined;
24
- asModel<M extends ODataModel<T>>(entity: Partial<T> | {
25
- [name: string]: any;
26
- }, { annots, reset }?: {
27
- annots?: ODataEntityAnnotations;
28
- reset?: boolean;
29
- }): M;
30
- asCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(entities: Partial<T>[] | {
31
- [name: string]: any;
32
- }[], { annots, reset, }?: {
33
- annots?: ODataEntitiesAnnotations;
34
- reset?: boolean;
35
- }): C;
21
+ static factory<N>(api: ODataApi, { path, type, schema, segments, query, }: {
22
+ path: string;
23
+ type?: string;
24
+ schema?: ODataStructuredType<N>;
25
+ segments: ODataPathSegments;
26
+ query?: ODataQueryOptions<N>;
27
+ }): ODataNavigationPropertyResource<N>;
28
+ static fromResource<N>(resource: ODataResource<any>, path: string): ODataNavigationPropertyResource<N>;
36
29
  key(value: any): ODataNavigationPropertyResource<T>;
37
30
  keys(values: any[]): ODataNavigationPropertyResource<T>;
38
- media(): ODataMediaResource<T>;
39
- reference(): ODataReferenceResource;
31
+ media(): ODataMediaResource;
32
+ reference(): ODataReferenceResource<T>;
40
33
  navigationProperty<N>(path: string): ODataNavigationPropertyResource<N>;
41
34
  property<P>(path: string): ODataPropertyResource<P>;
42
- count(): ODataCountResource;
35
+ count(): ODataCountResource<T>;
43
36
  cast<C>(type: string): ODataNavigationPropertyResource<C>;
44
- select(opts: Select<T>): ODataNavigationPropertyResource<T>;
45
- expand(opts: Expand<T>): ODataNavigationPropertyResource<T>;
46
- transform(opts: Transform<T>): ODataNavigationPropertyResource<T>;
47
- search(opts: string): ODataNavigationPropertyResource<T>;
48
- filter(opts: Filter): ODataNavigationPropertyResource<T>;
49
- orderBy(opts: OrderBy<T>): ODataNavigationPropertyResource<T>;
50
- format(opts: string): ODataNavigationPropertyResource<T>;
51
- top(opts: number): ODataNavigationPropertyResource<T>;
52
- skip(opts: number): ODataNavigationPropertyResource<T>;
53
- skiptoken(opts: string): ODataNavigationPropertyResource<T>;
54
- get segment(): {
55
- entitySet(): import("../path-segments").SegmentHandler;
56
- singleton(): import("../path-segments").SegmentHandler;
57
- navigationProperty(): import("../path-segments").SegmentHandler;
58
- keys(values?: (EntityKey<T> | undefined)[] | undefined): (EntityKey<any> | undefined)[];
59
- };
60
- /**
61
- * Handle query options of the navigation property
62
- * @returns Handler for mutate the query of the navigation property
63
- */
64
- get query(): {
65
- select(opts?: Select<T> | undefined): import("../query-options").OptionHandler<Select<T>>;
66
- expand(opts?: Expand<T> | undefined): import("../query-options").OptionHandler<Expand<T>>;
67
- compute(opts?: string | undefined): import("../query-options").OptionHandler<string>;
68
- transform(opts?: Transform<T> | undefined): import("../query-options").OptionHandler<Transform<T>>;
69
- search(opts?: string | undefined): import("../query-options").OptionHandler<string>;
70
- filter(opts?: Filter | undefined): import("../query-options").OptionHandler<Filter>;
71
- orderBy(opts?: OrderBy<T> | undefined): import("../query-options").OptionHandler<OrderBy<T>>;
72
- format(opts?: string | undefined): import("../query-options").OptionHandler<string>;
73
- top(opts?: number | undefined): import("../query-options").OptionHandler<number>;
74
- skip(opts?: number | undefined): import("../query-options").OptionHandler<number>;
75
- skiptoken(opts?: string | undefined): import("../query-options").OptionHandler<string>;
76
- paging({ skip, skiptoken, top, }?: {
77
- skip?: number | undefined;
78
- skiptoken?: string | undefined;
79
- top?: number | undefined;
80
- }): void;
81
- clearPaging(): void;
82
- apply(query: import("../query-options").QueryArguments<T>): void;
83
- };
84
- get(options: HttpEntityOptions & {
37
+ protected post(attrs: Partial<T>, options?: ODataOptions): Observable<ODataEntity<T>>;
38
+ protected put(attrs: Partial<T>, options?: ODataOptions & {
85
39
  etag?: string;
86
- bodyQueryOptions?: QueryOptionNames[];
87
40
  }): Observable<ODataEntity<T>>;
88
- get(options: HttpEntitiesOptions & {
41
+ protected patch(attrs: Partial<T>, options?: ODataOptions & {
42
+ etag?: string;
43
+ }): Observable<ODataEntity<T>>;
44
+ protected delete(options?: ODataOptions & {
45
+ etag?: string;
46
+ }): Observable<any>;
47
+ protected get(options?: ODataEntityOptions & ODataEntitiesOptions & {
89
48
  etag?: string;
90
49
  bodyQueryOptions?: QueryOptionNames[];
91
- }): Observable<ODataEntities<T>>;
92
- post(attrs: Partial<T>, options?: HttpOptions): Observable<ODataEntity<T>>;
93
- put(attrs: Partial<T>, options?: HttpOptions & {
50
+ }): Observable<any>;
51
+ /**
52
+ * Create a new entity
53
+ * @param attrs The entity attributes
54
+ * @param options Options for the request
55
+ * @returns The created entity with the annotations
56
+ */
57
+ create(attrs: Partial<T>, options?: ODataOptions): Observable<ODataEntity<T>>;
58
+ /**
59
+ * Update an existing entity
60
+ * @param attrs The entity attributes
61
+ * @param options Options for the request
62
+ * @param etag The etag of the entity
63
+ * @returns The updated entity with the annotations
64
+ */
65
+ update(attrs: Partial<T>, options?: ODataOptions & {
94
66
  etag?: string;
95
67
  }): Observable<ODataEntity<T>>;
96
- patch(attrs: Partial<T>, options?: HttpOptions & {
68
+ /**
69
+ * Modify an existing entity
70
+ * @param attrs The entity attributes
71
+ * @param options Options for the request
72
+ * @param etag The etag of the entity
73
+ * @returns The modified entity with the annotations
74
+ */
75
+ modify(attrs: Partial<T>, options?: ODataOptions & {
97
76
  etag?: string;
98
77
  }): Observable<ODataEntity<T>>;
99
- delete(options?: HttpOptions & {
78
+ /**
79
+ * Delete an existing entity
80
+ * @param options Options for the request
81
+ * @param etag The etag of the entity
82
+ * @returns An observable of the destroy
83
+ */
84
+ destroy(options?: ODataOptions & {
100
85
  etag?: string;
101
86
  }): Observable<any>;
102
- fetch(options?: HttpEntityOptions & {
87
+ /**
88
+ * Fetch entity / entities
89
+ * @param options Options for the request
90
+ * @return An observable of the entity or entities with annotations
91
+ */
92
+ fetch(options?: ODataEntityOptions & {
103
93
  etag?: string;
104
94
  bodyQueryOptions?: QueryOptionNames[];
105
95
  }): Observable<ODataEntity<T>>;
106
- fetch(options?: HttpEntitiesOptions & {
96
+ fetch(options?: ODataEntitiesOptions & {
107
97
  etag?: string;
108
98
  bodyQueryOptions?: QueryOptionNames[];
109
99
  }): Observable<ODataEntities<T>>;
110
- fetchEntity(options?: HttpOptions & {
100
+ /**
101
+ * Fetch the entity
102
+ * @param options Options for the request
103
+ * @returns The entity
104
+ */
105
+ fetchEntity(options?: ODataOptions & {
111
106
  etag?: string;
112
107
  bodyQueryOptions?: QueryOptionNames[];
113
108
  }): Observable<T | null>;
114
- fetchModel(options?: HttpOptions & {
109
+ /**
110
+ * Fetch the entity and return as model
111
+ * @param options Options for the request
112
+ * @returns The model
113
+ */
114
+ fetchModel<M extends ODataModel<T>>(options?: ODataOptions & {
115
115
  etag?: string;
116
116
  bodyQueryOptions?: QueryOptionNames[];
117
- }): Observable<ODataModel<T> | null>;
118
- fetchEntities(options?: HttpOptions & {
117
+ }): Observable<M | null>;
118
+ /**
119
+ * Fetch entities
120
+ * @param options Options for the request
121
+ * @returns The entities
122
+ */
123
+ fetchEntities(options?: ODataOptions & {
119
124
  bodyQueryOptions?: QueryOptionNames[];
120
125
  }): Observable<T[] | null>;
121
- fetchCollection(options?: HttpOptions & {
126
+ /**
127
+ * Fetch entities and return as collection
128
+ * @param options Options for the request
129
+ * @returns The collection
130
+ */
131
+ fetchCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(options?: ODataOptions & {
122
132
  withCount?: boolean;
123
133
  bodyQueryOptions?: QueryOptionNames[];
124
- }): Observable<ODataCollection<T, ODataModel<T>> | null>;
125
- fetchAll(options?: HttpOptions & {
134
+ }): Observable<C | null>;
135
+ /**
136
+ * Fetch all entities
137
+ * @param options Options for the request
138
+ * @returns All entities
139
+ */
140
+ fetchAll(options?: ODataOptions & {
126
141
  bodyQueryOptions?: QueryOptionNames[];
127
142
  }): Observable<T[]>;
128
143
  }
@@ -1,7 +1,7 @@
1
1
  import { HttpHeaders, HttpParams } from '@angular/common/http';
2
2
  import { FetchPolicy } from '../../types';
3
- import { QueryArguments } from '../query-options';
4
- export declare type HttpOptions = {
3
+ import { ODataQueryArguments } from '../query';
4
+ export declare type ODataOptions = {
5
5
  headers?: HttpHeaders | {
6
6
  [header: string]: string | string[];
7
7
  };
@@ -12,19 +12,19 @@ export declare type HttpOptions = {
12
12
  withCredentials?: boolean;
13
13
  fetchPolicy?: FetchPolicy;
14
14
  };
15
- export declare type HttpEntityOptions = HttpOptions & {
15
+ export declare type ODataEntityOptions = ODataOptions & {
16
16
  responseType?: 'entity';
17
17
  };
18
- export declare type HttpEntitiesOptions = HttpOptions & {
18
+ export declare type ODataEntitiesOptions = ODataOptions & {
19
19
  responseType?: 'entities';
20
20
  withCount?: boolean;
21
21
  };
22
- export declare type HttpPropertyOptions = HttpOptions & {
22
+ export declare type ODataPropertyOptions = ODataOptions & {
23
23
  responseType?: 'property';
24
24
  };
25
- export declare type HttpNoneOptions = HttpOptions & {
25
+ export declare type ODataNoneOptions = ODataOptions & {
26
26
  responseType?: 'none';
27
27
  };
28
- export declare type HttpQueryOptions<T> = QueryArguments<T> & {
28
+ export declare type ODataQueryArgumentsOptions<T> = ODataQueryArguments<T> & {
29
29
  alias?: boolean;
30
- } & HttpOptions;
30
+ } & ODataOptions;
@@ -1,91 +1,81 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ODataValueResource } from './value';
3
- import { EntityKey, ODataResource } from '../resource';
4
- import { ODataQueryOptions } from '../query-options';
5
- import { ODataPathSegments } from '../path-segments';
6
- import { HttpPropertyOptions, HttpEntitiesOptions, HttpEntityOptions, HttpOptions } from './options';
7
- import { ODataProperty, ODataEntities, ODataEntity, ODataEntityAnnotations, ODataEntitiesAnnotations } from '../responses';
8
- import { ODataModel, ODataCollection } from '../../models';
9
2
  import { ODataApi } from '../../api';
10
- import { Expand, Filter, OrderBy, Select, Transform } from '../builder';
3
+ import { ODataCollection, ODataModel } from '../../models';
4
+ import { ODataStructuredType } from '../../schema';
5
+ import { ODataPathSegments } from '../path';
6
+ import { ODataQueryOptions } from '../query';
7
+ import { ODataResource } from '../resource';
8
+ import { ODataEntities, ODataEntity, ODataProperty } from '../responses';
9
+ import { ODataEntitiesOptions, ODataEntityOptions, ODataOptions, ODataPropertyOptions } from './options';
10
+ import { ODataValueResource } from './value';
11
11
  export declare class ODataPropertyResource<T> extends ODataResource<T> {
12
- static factory<P>(api: ODataApi, path: string, type: string | undefined, segments: ODataPathSegments, options: ODataQueryOptions): ODataPropertyResource<P>;
13
- clone(): ODataPropertyResource<T>;
14
- schema(): import("angular-odata").ODataStructuredType<T> | undefined;
15
- asModel<M extends ODataModel<T>>(entity: Partial<T> | {
16
- [name: string]: any;
17
- }, { annots, reset }?: {
18
- annots?: ODataEntityAnnotations;
19
- reset?: boolean;
20
- }): M;
21
- asCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(entities: Partial<T>[] | {
22
- [name: string]: any;
23
- }[], { annots, reset, }?: {
24
- annots?: ODataEntitiesAnnotations;
25
- reset?: boolean;
26
- }): C;
12
+ static factory<P>(api: ODataApi, { path, type, schema, segments, query, }: {
13
+ path: string;
14
+ type?: string;
15
+ schema?: ODataStructuredType<P>;
16
+ segments: ODataPathSegments;
17
+ query?: ODataQueryOptions<P>;
18
+ }): ODataPropertyResource<P>;
19
+ static fromResource<N>(resource: ODataResource<any>, path: string): ODataPropertyResource<N>;
27
20
  key(value: any): ODataPropertyResource<T>;
28
21
  keys(values: any[]): ODataPropertyResource<T>;
29
22
  value(): ODataValueResource<T>;
30
23
  property<P>(path: string): ODataPropertyResource<P>;
31
- select(opts: Select<T>): ODataPropertyResource<T>;
32
- expand(opts: Expand<T>): ODataPropertyResource<T>;
33
- transform(opts: Transform<T>): ODataPropertyResource<T>;
34
- search(opts: string): ODataPropertyResource<T>;
35
- filter(opts: Filter): ODataPropertyResource<T>;
36
- orderBy(opts: OrderBy<T>): ODataPropertyResource<T>;
37
- format(opts: string): ODataPropertyResource<T>;
38
- top(opts: number): ODataPropertyResource<T>;
39
- skip(opts: number): ODataPropertyResource<T>;
40
- skiptoken(opts: string): ODataPropertyResource<T>;
41
- get segment(): {
42
- entitySet(): import("../path-segments").SegmentHandler;
43
- singleton(): import("../path-segments").SegmentHandler;
44
- property(): import("../path-segments").SegmentHandler;
45
- keys(values?: (EntityKey<any> | undefined)[] | undefined): (EntityKey<any> | undefined)[];
46
- };
47
- get query(): {
48
- select(opts?: Select<T> | undefined): import("../query-options").OptionHandler<Select<T>>;
49
- expand(opts?: Expand<T> | undefined): import("../query-options").OptionHandler<Expand<T>>;
50
- compute(opts?: string | undefined): import("../query-options").OptionHandler<string>;
51
- transform(opts?: Transform<T> | undefined): import("../query-options").OptionHandler<Transform<T>>;
52
- search(opts?: string | undefined): import("../query-options").OptionHandler<string>;
53
- filter(opts?: Filter | undefined): import("../query-options").OptionHandler<Filter>;
54
- orderBy(opts?: OrderBy<T> | undefined): import("../query-options").OptionHandler<OrderBy<T>>;
55
- format(opts?: string | undefined): import("../query-options").OptionHandler<string>;
56
- top(opts?: number | undefined): import("../query-options").OptionHandler<number>;
57
- skip(opts?: number | undefined): import("../query-options").OptionHandler<number>;
58
- skiptoken(opts?: string | undefined): import("../query-options").OptionHandler<string>;
59
- paging({ skip, skiptoken, top, }?: {
60
- skip?: number | undefined;
61
- skiptoken?: string | undefined;
62
- top?: number | undefined;
63
- }): void;
64
- clearPaging(): void;
65
- apply(query: import("../query-options").QueryArguments<T>): void;
66
- };
67
- get(options: HttpEntityOptions): Observable<ODataEntity<T>>;
68
- get(options: HttpEntitiesOptions): Observable<ODataEntities<T>>;
69
- get(options: HttpPropertyOptions): Observable<ODataProperty<T>>;
70
- fetch(options?: HttpEntityOptions & {
24
+ protected get(options: ODataEntityOptions & ODataEntitiesOptions & ODataPropertyOptions): Observable<any>;
25
+ /**
26
+ * Fetch the property
27
+ * @param options Options for the request
28
+ * @return The entity / entities / property value
29
+ */
30
+ fetch(options?: ODataEntityOptions & {
71
31
  etag?: string;
72
32
  }): Observable<ODataEntity<T>>;
73
- fetch(options?: HttpEntitiesOptions): Observable<ODataEntities<T>>;
74
- fetch(options?: HttpPropertyOptions): Observable<ODataProperty<T>>;
75
- fetchProperty(options?: HttpOptions & {
33
+ fetch(options?: ODataEntitiesOptions): Observable<ODataEntities<T>>;
34
+ fetch(options?: ODataPropertyOptions): Observable<ODataProperty<T>>;
35
+ /**
36
+ * Fetch the property value
37
+ * @param options Options for the request
38
+ * @returns The property value
39
+ */
40
+ fetchProperty(options?: ODataOptions & {
76
41
  etag?: string;
77
42
  }): Observable<T | null>;
78
- fetchEntity(options?: HttpOptions & {
43
+ /**
44
+ * Fetch the entity
45
+ * @param options Options for the request
46
+ * @returns The entity
47
+ */
48
+ fetchEntity(options?: ODataOptions & {
79
49
  etag?: string;
80
50
  }): Observable<T | null>;
81
- fetchModel(options?: HttpOptions & {
51
+ /**
52
+ * Fetch the entity and return as model
53
+ * @param options Options for the request
54
+ * @returns The model
55
+ */
56
+ fetchModel<M extends ODataModel<T>>(options?: ODataOptions & {
82
57
  etag?: string;
83
- }): Observable<ODataModel<T> | null>;
84
- fetchEntities(options?: HttpOptions & {
58
+ }): Observable<M | null>;
59
+ /**
60
+ * Fetch the entities
61
+ * @param options Options for the request
62
+ * @returns The entities
63
+ */
64
+ fetchEntities(options?: ODataOptions & {
85
65
  withCount?: boolean;
86
66
  }): Observable<T[] | null>;
87
- fetchCollection(options?: HttpOptions & {
67
+ /**
68
+ * Fetch the entities and return as collection
69
+ * @param options Options for the request
70
+ * @returns The collection
71
+ */
72
+ fetchCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(options?: ODataOptions & {
88
73
  withCount?: boolean;
89
- }): Observable<ODataCollection<T, ODataModel<T>> | null>;
90
- fetchAll(options?: HttpOptions): Observable<T[]>;
74
+ }): Observable<C | null>;
75
+ /**
76
+ * Fetch all entities
77
+ * @param options Options for the request
78
+ * @returns All entities
79
+ */
80
+ fetchAll(options?: ODataOptions): Observable<T[]>;
91
81
  }
@@ -1,28 +1,84 @@
1
1
  import { Observable } from 'rxjs';
2
+ import { ODataApi } from '../../api';
3
+ import { QueryOptionNames } from '../../types';
4
+ import { ODataPathSegments } from '../path';
5
+ import { ODataQueryOptions } from '../query';
2
6
  import { ODataResource } from '../resource';
3
- import { ODataPathSegments } from '../path-segments';
4
- import { ODataQueryOptions } from '../query-options';
7
+ import { ODataEntities, ODataEntity } from '../responses/types';
5
8
  import { ODataEntityResource } from './entity';
6
- import { HttpOptions } from './options';
7
- import { ODataApi } from '../../api';
8
- export declare class ODataReferenceResource extends ODataResource<any> {
9
- static factory<P>(api: ODataApi, segments: ODataPathSegments, options: ODataQueryOptions): ODataReferenceResource;
10
- clone(): ODataReferenceResource;
11
- schema(): undefined;
12
- post(target: ODataEntityResource<any>, options?: HttpOptions): Observable<any>;
13
- put(target: ODataEntityResource<any>, options?: HttpOptions & {
9
+ import { ODataEntitiesOptions, ODataEntityOptions, ODataOptions } from './options';
10
+ export declare class ODataReferenceResource<T> extends ODataResource<T> {
11
+ static factory<P>(api: ODataApi, { segments, query, }: {
12
+ segments: ODataPathSegments;
13
+ query?: ODataQueryOptions<P>;
14
+ }): ODataReferenceResource<P>;
15
+ protected post(target: ODataEntityResource<any>, options?: ODataOptions): Observable<any>;
16
+ protected put(target: ODataEntityResource<any>, options?: ODataOptions & {
14
17
  etag?: string;
15
18
  }): Observable<any>;
16
- delete({ etag, target, ...options }?: {
19
+ protected delete({ etag, target, ...options }?: {
17
20
  etag?: string;
18
21
  target?: ODataEntityResource<any>;
19
- } & HttpOptions): Observable<any>;
20
- add(target: ODataEntityResource<any>, options?: HttpOptions): Observable<any>;
21
- remove(target?: ODataEntityResource<any>, options?: HttpOptions): Observable<any>;
22
- set(target: ODataEntityResource<any>, options?: HttpOptions & {
22
+ } & ODataOptions): Observable<any>;
23
+ /**
24
+ * Add the given target to the collection.
25
+ * @param target The target resource
26
+ * @param options Options for the request
27
+ * @returns Observable of the response
28
+ */
29
+ add(target: ODataEntityResource<any>, options?: ODataOptions): Observable<any>;
30
+ /**
31
+ * Remove the given target from the collection.
32
+ * @param target The target resource
33
+ * @param options Options for the request
34
+ * @returns Observable of the response
35
+ */
36
+ remove(target?: ODataEntityResource<any>, options?: ODataOptions): Observable<any>;
37
+ /**
38
+ * Set the reference to the given target.
39
+ * @param target The target resource
40
+ * @param options Options for the request
41
+ * @returns Observable of the response
42
+ */
43
+ set(target: ODataEntityResource<any>, options?: ODataOptions & {
23
44
  etag?: string;
24
45
  }): Observable<any>;
25
- unset(options?: HttpOptions & {
46
+ /**
47
+ * Unset the reference to the given target.
48
+ * @param options Options for the request.
49
+ * @returns Observable of the response
50
+ */
51
+ unset(options?: ODataOptions & {
26
52
  etag?: string;
27
53
  }): Observable<any>;
54
+ /**
55
+ * Fetch entity / entities
56
+ * @param options Options for the request
57
+ * @return An observable of the entity or entities with annotations
58
+ */
59
+ fetch(options?: ODataEntityOptions & {
60
+ etag?: string;
61
+ bodyQueryOptions?: QueryOptionNames[];
62
+ }): Observable<ODataEntity<T>>;
63
+ fetch(options?: ODataEntitiesOptions & {
64
+ etag?: string;
65
+ bodyQueryOptions?: QueryOptionNames[];
66
+ }): Observable<ODataEntities<T>>;
67
+ /**
68
+ * Fetch the entity
69
+ * @param options Options for the request
70
+ * @returns The entity
71
+ */
72
+ fetchEntity(options?: ODataOptions & {
73
+ etag?: string;
74
+ bodyQueryOptions?: QueryOptionNames[];
75
+ }): Observable<T | null>;
76
+ /**
77
+ * Fetch entities
78
+ * @param options Options for the request
79
+ * @returns The entities
80
+ */
81
+ fetchEntities(options?: ODataOptions & {
82
+ bodyQueryOptions?: QueryOptionNames[];
83
+ }): Observable<T[] | null>;
28
84
  }