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
package/lib/api.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ApiConfig, Parser } from './types';
3
- import { ODataSchema, ODataEnumType, ODataCallable, ODataEntitySet, ODataStructuredType } from './schema/index';
4
- import { ODataModel, ODataCollection, ODataModelOptions } from './models/index';
5
- import { ODataBatchResource, ODataMetadataResource, ODataEntitySetResource, ODataSingletonResource, ODataFunctionResource, ODataActionResource, ODataEntityResource, ODataSegment, ODataNavigationPropertyResource, ODataRequest } from './resources/index';
6
2
  import { ODataCache } from './cache/index';
3
+ import { ODataCollection, ODataModel, ODataModelOptions } from './models/index';
7
4
  import { ODataApiOptions } from './options';
5
+ import { ODataActionResource, ODataBatchResource, ODataEntityResource, ODataEntitySetResource, ODataFunctionResource, ODataMetadataResource, ODataNavigationPropertyResource, ODataRequest, ODataSegment, ODataSingletonResource } from './resources/index';
6
+ import { ODataCallable, ODataEntitySet, ODataEnumType, ODataSchema, ODataStructuredType } from './schema';
8
7
  import { ODataEntityService } from './services/entity';
8
+ import { ApiConfig, Parser } from './types';
9
9
  /**
10
10
  * Api abstraction for consuming OData services.
11
11
  */
@@ -52,28 +52,28 @@ export declare class ODataApi {
52
52
  batch(): ODataBatchResource;
53
53
  /**
54
54
  * Build a singleton resource.
55
- * @param name Name of the singleton
55
+ * @param path Name of the singleton
56
56
  * @returns
57
57
  */
58
- singleton<T>(name: string): ODataSingletonResource<T>;
58
+ singleton<T>(path: string): ODataSingletonResource<T>;
59
59
  /**
60
60
  * Build an entity set resource.
61
- * @param name Name of the entity set
61
+ * @param path Name of the entity set
62
62
  * @returns
63
63
  */
64
- entitySet<T>(name: string): ODataEntitySetResource<T>;
64
+ entitySet<T>(path: string): ODataEntitySetResource<T>;
65
65
  /**
66
66
  * Unbound Action
67
- * @param {string} name?
67
+ * @param {string} path?
68
68
  * @returns ODataActionResource
69
69
  */
70
- action<P, R>(name: string): ODataActionResource<P, R>;
70
+ action<P, R>(path: string): ODataActionResource<P, R>;
71
71
  /**
72
72
  * Unbound Function
73
- * @param {string} name?
73
+ * @param {string} path?
74
74
  * @returns ODataFunctionResource
75
75
  */
76
- function<P, R>(name: string): ODataFunctionResource<P, R>;
76
+ function<P, R>(path: string): ODataFunctionResource<P, R>;
77
77
  request(req: ODataRequest<any>): Observable<any>;
78
78
  private memo;
79
79
  private findSchemaForType;
@@ -82,9 +82,9 @@ export declare class ODataApi {
82
82
  findCallableForType<T>(type: string, bindingType?: string): ODataCallable<T> | undefined;
83
83
  findEntitySetForType(type: string): ODataEntitySet | undefined;
84
84
  findModelForType(type: string): typeof ODataModel | undefined;
85
- modelForType(type?: string): typeof ODataModel;
85
+ modelForType(type: string): typeof ODataModel;
86
86
  findCollectionForType(type: string): typeof ODataCollection | undefined;
87
- collectionForType(type?: string): typeof ODataCollection;
87
+ collectionForType(type: string): typeof ODataCollection;
88
88
  findServiceForType(type: string): typeof ODataEntityService | undefined;
89
89
  findEntitySetForEntityType(entityType: string): ODataEntitySet | undefined;
90
90
  findServiceForEntityType(entityType: string): typeof ODataEntityService | undefined;
@@ -1,6 +1,6 @@
1
- import { Cache } from '../types';
2
- import { ODataRequest, ODataResponse } from '../resources';
3
1
  import { Observable } from 'rxjs';
2
+ import { ODataRequest, ODataResponse } from '../resources';
3
+ import { Cache } from '../types';
4
4
  export interface ODataCacheEntry<T> {
5
5
  payload: T;
6
6
  lastRead: number;
@@ -1,5 +1,5 @@
1
- import { ODataCache } from './cache';
2
1
  import { ODataRequest, ODataResponse } from '../resources';
2
+ import { ODataCache } from './cache';
3
3
  export declare class ODataInStorageCache extends ODataCache {
4
4
  name: string;
5
5
  storage: Storage;
package/lib/client.d.ts CHANGED
@@ -1,33 +1,84 @@
1
1
  import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
2
2
  import { Injector } from '@angular/core';
3
- import { ODataActionResource, ODataBatchResource, ODataEntityResource, ODataEntitySetResource, ODataFunctionResource, ODataMetadataResource, ODataNavigationPropertyResource, ODataResource, ODataResponse, ODataSegment, ODataSingletonResource } from './resources/index';
4
- import { ODataCollection, ODataModel } from './models/index';
3
+ import { Observable } from 'rxjs';
5
4
  import { ODataApi } from './api';
5
+ import { ODataCollection, ODataModel } from './models/index';
6
+ import { ODataActionResource, ODataBatchResource, ODataEntityResource, ODataEntitySetResource, ODataFunctionResource, ODataMetadataResource, ODataNavigationPropertyResource, ODataResource, ODataResponse, ODataSegment, ODataSingletonResource } from './resources/index';
6
7
  import { ODataEntityService } from './services/entity';
7
8
  import { ODataSettings } from './settings';
8
- import { Observable } from 'rxjs';
9
9
  import * as i0 from "@angular/core";
10
10
  export declare class ODataClient {
11
11
  private http;
12
12
  private settings;
13
13
  private injector;
14
14
  constructor(http: HttpClient, settings: ODataSettings, injector: Injector);
15
+ /**
16
+ * Resolve the api for the given value.
17
+ * Where value is: string type or an string name or an instance of resource.
18
+ * @param value The value to resolve.
19
+ * @returns The api for the value.
20
+ */
15
21
  apiFor(value?: ODataResource<any> | string): ODataApi;
22
+ /**
23
+ * Resolve the parser for the given string type.
24
+ * @param type The string type of the parser.
25
+ * @returns The parser for the given type.
26
+ */
16
27
  parserForType<T>(type: string): import("angular-odata").Parser<T>;
28
+ /**
29
+ * Resolve the enum type for the given string type.
30
+ * @param type The string type of the enum type.
31
+ * @returns The enum type for the given type.
32
+ */
17
33
  enumTypeForType<T>(type: string): import("angular-odata").ODataEnumType<T>;
18
- enumTypeByName<T>(name: string): import("angular-odata").ODataEnumType<T>;
34
+ /**
35
+ * Resolve the structured type for the given string type.
36
+ * @param type The string type of the structured type.
37
+ * @returns The structured type for the given type.
38
+ */
19
39
  structuredTypeForType<T>(type: string): import("angular-odata").ODataStructuredType<T>;
20
- structuredTypeByName<T>(name: string): import("angular-odata").ODataStructuredType<T>;
40
+ /**
41
+ * Resolve the callable for the given string type.
42
+ * @param type The string type of the callable.
43
+ * @returns The callable for the given type.
44
+ */
21
45
  callableForType<T>(type: string): import("angular-odata").ODataCallable<T>;
22
- callableByName<T>(name: string): import("angular-odata").ODataCallable<T>;
46
+ /**
47
+ * Resolve the entity set for the given string type.
48
+ * @param type The string type of the entity set.
49
+ * @returns The entity set for the given type.
50
+ */
23
51
  entitySetForType(type: string): import("angular-odata").ODataEntitySet;
24
- entitySetByName(name: string): import("angular-odata").ODataEntitySet;
52
+ /**
53
+ * Resolve the model for the given string type.
54
+ * @param type The string type of the model.
55
+ * @returns The model for the given type.
56
+ */
25
57
  modelForType(type: string): typeof ODataModel;
26
- modelByName(name: string): typeof ODataModel;
58
+ /**
59
+ * Resolve the collection for the given string type.
60
+ * @param type The string type of the collection.
61
+ * @returns The collection for the given type.
62
+ */
27
63
  collectionForType(type: string): typeof ODataCollection;
28
- collectionByName(name: string): typeof ODataCollection;
64
+ /**
65
+ * Resolve the service for the given string type.
66
+ * @param type The string type of the service.
67
+ * @returns The service for the given type.
68
+ */
29
69
  serviceForType(type: string): ODataEntityService<any>;
70
+ /**
71
+ * Resolve the service for the given string entity type.
72
+ * @param type The string entity type binding to the service.
73
+ * @returns The service for the given entity type.
74
+ */
30
75
  serviceForEntityType(type: string): ODataEntityService<any>;
76
+ enumTypeByName<T>(name: string): import("angular-odata").ODataEnumType<T>;
77
+ structuredTypeByName<T>(name: string): import("angular-odata").ODataStructuredType<T>;
78
+ callableByName<T>(name: string): import("angular-odata").ODataCallable<T>;
79
+ entitySetByName(name: string): import("angular-odata").ODataEntitySet;
80
+ modelByName(name: string): typeof ODataModel;
81
+ collectionByName(name: string): typeof ODataCollection;
31
82
  serviceByName(name: string): ODataEntityService<any>;
32
83
  fromJSON<E>(json: {
33
84
  segments: ODataSegment[];
@@ -56,5 +56,8 @@ export declare const ODATA_ALIAS_PREFIX = "@";
56
56
  export declare const NEWLINE = "\r\n";
57
57
  export declare const NEWLINE_REGEXP: RegExp;
58
58
  export declare const CACHE_KEY_SEPARATOR = ":";
59
- export declare const COMPUTED = "Org.OData.Core.V1.Computed";
60
- export declare const OPTIMISTIC_CONCURRENCY = "Org.OData.Core.V1.OptimisticConcurrency";
59
+ export declare const CID_FIELD_NAME = "_cid";
60
+ export declare const COMPUTED: RegExp;
61
+ export declare const OPTIMISTIC_CONCURRENCY: RegExp;
62
+ export declare const DESCRIPTION: RegExp;
63
+ export declare const LONG_DESCRIPTION: RegExp;
package/lib/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export * from './tokens';
6
6
  export * from './module';
7
7
  export * from './utils/index';
8
8
  export * from './services/index';
9
- export * from './parsers/index';
10
9
  export * from './schema/index';
11
10
  export * from './models/index';
12
11
  export * from './resources/index';
@@ -1,15 +1,15 @@
1
- import { Observable } from 'rxjs';
2
- import { ODataEntitiesAnnotations, ODataOptions, Select, Expand, OptionHandler, Transform, Filter, OrderBy, ODataQueryArguments, ODataQueryArgumentsOptions } from '../resources/index';
3
1
  import { EventEmitter } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import { ODataEntitiesAnnotations, ODataEntitySetResource, ODataNavigationPropertyResource, ODataOptions, ODataPropertyResource, ODataQueryArgumentsOptions, ODataQueryOptionsHandler, ODataResource } from '../resources';
4
4
  import { ODataModel } from './model';
5
- import { ODataCollectionResource, ODataModelEvent, ODataModelField, ODataModelEntry } from './options';
5
+ import { ODataModelEntry, ODataModelEvent, ODataModelField } from './options';
6
6
  export declare class ODataCollection<T, M extends ODataModel<T>> implements Iterable<M> {
7
7
  static model: typeof ODataModel | null;
8
8
  _parent: [
9
9
  ODataModel<any> | ODataCollection<any, ODataModel<any>>,
10
10
  ODataModelField<any> | null
11
11
  ] | null;
12
- _resource?: ODataCollectionResource<T>;
12
+ _resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null;
13
13
  _annotations: ODataEntitiesAnnotations;
14
14
  _entries: ODataModelEntry<T, M>[];
15
15
  _model: typeof ODataModel;
@@ -20,15 +20,15 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
20
20
  [name: string]: any;
21
21
  }[], { parent, resource, annots, model, reset, }?: {
22
22
  parent?: [ODataModel<any>, ODataModelField<any>];
23
- resource?: ODataCollectionResource<T>;
23
+ resource?: ODataResource<T>;
24
24
  annots?: ODataEntitiesAnnotations;
25
25
  model?: typeof ODataModel;
26
26
  reset?: boolean;
27
27
  });
28
28
  isParentOf(child: ODataModel<any> | ODataCollection<any, ODataModel<any>>): boolean;
29
- resource(): ODataCollectionResource<T>;
30
- attach(resource: ODataCollectionResource<T>): void;
31
- asEntitySet<R>(func: (collection: this) => Observable<R>): Observable<R>;
29
+ resource(): ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>;
30
+ attach(resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>): void;
31
+ asEntitySet<R>(func: (collection: this) => R): R;
32
32
  annots(): ODataEntitiesAnnotations;
33
33
  private modelFactory;
34
34
  toEntities({ client_id, include_navigation, include_concurrency, include_computed, include_key, include_non_field, changes_only, field_mapping, chain, }?: {
@@ -44,6 +44,9 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
44
44
  }): (T | {
45
45
  [name: string]: any;
46
46
  })[];
47
+ toJSON(): (T | {
48
+ [name: string]: any;
49
+ })[];
47
50
  hasChanged({ include_navigation }?: {
48
51
  include_navigation?: boolean;
49
52
  }): boolean;
@@ -64,22 +67,16 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
64
67
  }): Observable<this>;
65
68
  private addReference;
66
69
  private _addModel;
67
- protected addModel(model: M, { silent, reset, position, }?: {
68
- silent?: boolean;
69
- reset?: boolean;
70
- position?: number;
71
- }): void;
72
- add(model: M, { silent, server, position, }?: {
70
+ private addModel;
71
+ add(model: M, { silent, reparent, server, position, }?: {
73
72
  silent?: boolean;
73
+ reparent?: boolean;
74
74
  server?: boolean;
75
75
  position?: number;
76
76
  }): Observable<this>;
77
77
  private removeReference;
78
78
  private _removeModel;
79
- protected removeModel(model: M, { silent, reset, }?: {
80
- silent?: boolean;
81
- reset?: boolean;
82
- }): void;
79
+ private removeModel;
83
80
  remove(model: M, { silent, server, }?: {
84
81
  silent?: boolean;
85
82
  server?: boolean;
@@ -89,7 +86,7 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
89
86
  server?: boolean;
90
87
  }): Observable<M>;
91
88
  set(path: string | string[], value: any): any;
92
- get(path: number): M;
89
+ get(path: number): M | undefined;
93
90
  get(path: string | string[]): any;
94
91
  reset({ path, silent, }?: {
95
92
  path?: string | string[];
@@ -97,31 +94,14 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
97
94
  }): void;
98
95
  assign(objects: Partial<T>[] | {
99
96
  [name: string]: any;
100
- }[] | M[], { reset, silent, }?: {
97
+ }[] | M[], { reset, reparent, silent, }?: {
101
98
  reset?: boolean;
99
+ reparent?: boolean;
102
100
  silent?: boolean;
103
101
  }): void;
104
- query(func: (q: {
105
- select(opts?: Select<T>): OptionHandler<Select<T>>;
106
- expand(opts?: Expand<T>): OptionHandler<Expand<T>>;
107
- transform(opts?: Transform<T>): OptionHandler<Transform<T>>;
108
- search(opts?: string): OptionHandler<string>;
109
- filter(opts?: Filter): OptionHandler<Filter>;
110
- orderBy(opts?: OrderBy<T>): OptionHandler<OrderBy<T>>;
111
- format(opts?: string): OptionHandler<string>;
112
- top(opts?: number): OptionHandler<number>;
113
- skip(opts?: number): OptionHandler<number>;
114
- skiptoken(opts?: string): OptionHandler<string>;
115
- paging({ skip, skiptoken, top, }: {
116
- skip?: number;
117
- skiptoken?: string;
118
- top?: number;
119
- }): void;
120
- clearPaging(): void;
121
- apply(query: ODataQueryArguments<T>): void;
122
- }) => void): void;
123
- protected callFunction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataQueryArgumentsOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
124
- protected callAction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataQueryArgumentsOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
102
+ query(func: (q: ODataQueryOptionsHandler<T>) => void): this;
103
+ callFunction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataQueryArgumentsOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
104
+ callAction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataQueryArgumentsOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
125
105
  private _unsubscribe;
126
106
  private _subscribe;
127
107
  private _findEntry;
@@ -130,8 +110,16 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
130
110
  [Symbol.iterator](): {
131
111
  next(): IteratorResult<M>;
132
112
  };
113
+ filter(predicate: (m: M, index: number) => boolean): M[];
114
+ find(predicate: (m: M, index: number) => boolean): M | undefined;
115
+ first(): M | undefined;
116
+ last(): M | undefined;
117
+ next(model: M): M | undefined;
118
+ prev(model: M): M | undefined;
119
+ every(predicate: (m: M, index: number) => boolean): boolean;
120
+ some(predicate: (m: M, index: number) => boolean): boolean;
133
121
  contains(model: M): boolean;
134
- filter(predicate: (m: M) => boolean): M[];
122
+ indexOf(model: M): number;
135
123
  private _bisect;
136
124
  private _compare;
137
125
  _sortBy: {
@@ -1,13 +1,16 @@
1
1
  import { EventEmitter } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
- import { ODataNavigationPropertyResource, ODataPropertyResource, ODataOptions, ODataEntityAnnotations, Select, Expand, EntityKey, OptionHandler, ODataQueryArguments, ODataQueryArgumentsOptions } from '../resources/index';
4
- import { ODataCollection } from './collection';
3
+ import { EntityKey, ODataEntityAnnotations, ODataEntityResource, ODataNavigationPropertyResource, ODataOptions, ODataPropertyResource, ODataQueryArgumentsOptions, ODataQueryOptionsHandler, ODataResource, ODataSingletonResource } from '../resources';
5
4
  import { ODataStructuredType } from '../schema';
6
- import { ModelOptions, ODataModelEvent, ODataModelOptions, ODataModelRelation, ODataModelResource, ODataModelField } from './options';
5
+ import { ODataCollection } from './collection';
6
+ import { ModelOptions, ODataModelEvent, ODataModelField, ODataModelOptions, ODataModelRelation } from './options';
7
7
  export declare class ODataModel<T> {
8
8
  static options: ModelOptions;
9
9
  static meta: ODataModelOptions<any>;
10
- static buildMeta<T>(options: ModelOptions, schema: ODataStructuredType<T>): void;
10
+ static buildMeta<T>({ options, schema, }: {
11
+ options?: ModelOptions;
12
+ schema: ODataStructuredType<T>;
13
+ }): void;
11
14
  _parent: [
12
15
  ODataModel<any> | ODataCollection<any, ODataModel<any>>,
13
16
  ODataModelField<any> | null
@@ -21,9 +24,10 @@ export declare class ODataModel<T> {
21
24
  _relations: {
22
25
  [name: string]: ODataModelRelation<any>;
23
26
  };
24
- _resource?: ODataModelResource<T>;
27
+ _resource: ODataResource<T> | null;
25
28
  _annotations: ODataEntityAnnotations;
26
- _resetting: boolean;
29
+ _reset: boolean;
30
+ _reparent: boolean;
27
31
  _silent: boolean;
28
32
  _meta: ODataModelOptions<T>;
29
33
  events$: EventEmitter<ODataModelEvent<T>>;
@@ -34,16 +38,14 @@ export declare class ODataModel<T> {
34
38
  ODataModel<any> | ODataCollection<any, ODataModel<any>>,
35
39
  ODataModelField<any> | null
36
40
  ];
37
- resource?: ODataModelResource<T>;
41
+ resource?: ODataResource<T>;
38
42
  annots?: ODataEntityAnnotations;
39
43
  reset?: boolean;
40
44
  });
41
- get [Symbol.toStringTag](): string;
42
- equals(other: ODataModel<T>): boolean;
43
- resource(): ODataModelResource<T>;
44
- navigationProperty<N>(name: string): ODataNavigationPropertyResource<N>;
45
+ resource(): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>;
46
+ navigationProperty<N>(name: keyof T | string): ODataNavigationPropertyResource<N>;
45
47
  property<N>(name: string): ODataPropertyResource<N>;
46
- attach(resource: ODataModelResource<T>): void;
48
+ attach(resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>): void;
47
49
  schema(): ODataStructuredType<T>;
48
50
  annots(): ODataEntityAnnotations;
49
51
  key({ field_mapping, resolve, }?: {
@@ -69,7 +71,7 @@ export declare class ODataModel<T> {
69
71
  _errors?: {
70
72
  [key: string]: any;
71
73
  };
72
- protected validate({ method, navigation, }?: {
74
+ validate({ method, navigation, }?: {
73
75
  method?: 'create' | 'update' | 'modify';
74
76
  navigation?: boolean;
75
77
  }): {
@@ -79,7 +81,7 @@ export declare class ODataModel<T> {
79
81
  method?: 'create' | 'update' | 'modify';
80
82
  navigation?: boolean;
81
83
  }): boolean;
82
- protected defaults(): {
84
+ defaults(): {
83
85
  [name: string]: any;
84
86
  };
85
87
  toEntity({ client_id, include_navigation, include_concurrency, include_computed, include_key, include_non_field, changes_only, field_mapping, chain, }?: {
@@ -95,6 +97,9 @@ export declare class ODataModel<T> {
95
97
  }): T | {
96
98
  [name: string]: any;
97
99
  };
100
+ toJSON(): T | {
101
+ [name: string]: any;
102
+ };
98
103
  attributes({ changes_only, include_concurrency, include_computed, include_non_field, field_mapping, }?: {
99
104
  changes_only?: boolean;
100
105
  include_concurrency?: boolean;
@@ -112,8 +117,9 @@ export declare class ODataModel<T> {
112
117
  }): void;
113
118
  assign(entity: Partial<T> | {
114
119
  [name: string]: any;
115
- }, { reset, silent, }?: {
120
+ }, { reset, reparent, silent, }?: {
116
121
  reset?: boolean;
122
+ reparent?: boolean;
117
123
  silent?: boolean;
118
124
  }): void;
119
125
  clone<M extends ODataModel<T>>(): M;
@@ -134,12 +140,7 @@ export declare class ODataModel<T> {
134
140
  * Create an execution context for change the internal query of a resource
135
141
  * @param func Function to execute
136
142
  */
137
- query(func: (q: {
138
- select(opts?: Select<T>): OptionHandler<Select<T>>;
139
- expand(opts?: Expand<T>): OptionHandler<Expand<T>>;
140
- format(opts?: string): OptionHandler<string>;
141
- apply(query: ODataQueryArguments<T>): void;
142
- }) => void): void;
143
+ query(func: (q: ODataQueryOptionsHandler<T>) => void): this;
143
144
  /**
144
145
  * Perform a check on the internal state of the model and return true if the model is changed.
145
146
  * @param include_navigation Check in navigation properties
@@ -151,14 +152,20 @@ export declare class ODataModel<T> {
151
152
  /**
152
153
  * Create an execution context for a given function, where the model is bound to its entity endpoint
153
154
  * @param ctx Context function
154
- * @returns Observable of R
155
+ * @returns The result of the context
155
156
  */
156
- asEntity<R>(ctx: (model: this) => Observable<R>): Observable<R>;
157
- protected callFunction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataQueryArgumentsOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
158
- protected callAction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataQueryArgumentsOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
159
- protected cast<S>(type: string): ODataModel<S>;
160
- protected fetchNavigationProperty<S>(name: string, responseType: 'model' | 'collection', { ...options }?: {} & ODataQueryArgumentsOptions<S>): Observable<ODataModel<S> | ODataCollection<S, ODataModel<S>> | null>;
161
- protected getValue<P>(name: string, options?: ODataOptions): Observable<P | ODataModel<P> | ODataCollection<P, ODataModel<P>> | null>;
162
- protected setReference<P>(name: string, model: ODataModel<P> | ODataCollection<P, ODataModel<P>> | null, options?: ODataOptions): Observable<this>;
163
- protected getReference<P>(name: string): ODataModel<P> | ODataCollection<P, ODataModel<P>>;
157
+ asEntity<R>(ctx: (model: this) => R): R;
158
+ callFunction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataQueryArgumentsOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
159
+ callAction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataQueryArgumentsOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
160
+ cast<S>(type: string): ODataModel<S>;
161
+ fetchNavigationProperty<S>(name: keyof T | string, responseType: 'model' | 'collection', { ...options }?: {} & ODataQueryArgumentsOptions<S>): Observable<ODataModel<S> | ODataCollection<S, ODataModel<S>> | null>;
162
+ getValue<P>(name: keyof T | string, options?: ODataOptions): Observable<P | ODataModel<P> | ODataCollection<P, ODataModel<P>> | null>;
163
+ setReference<N>(name: keyof T | string, model: ODataModel<N> | ODataCollection<N, ODataModel<N>> | null, options?: ODataOptions): Observable<this>;
164
+ getReference<P>(name: keyof T | string): ODataModel<P> | ODataCollection<P, ODataModel<P>>;
165
+ equals(other: ODataModel<T>): boolean;
166
+ get [Symbol.toStringTag](): string;
167
+ collection(): ODataCollection<T, ODataModel<T>> | undefined;
168
+ next(): ODataModel<T> | undefined;
169
+ prev(): ODataModel<T> | undefined;
164
170
  }
171
+ export declare const RESERVED_FIELD_NAMES: string[];
@@ -1,13 +1,9 @@
1
- import { Observable, Subscription } from 'rxjs';
2
- import { ODataStructuredTypeFieldParser } from '../parsers';
3
- import { Expand, ODataEntitiesAnnotations, ODataEntityAnnotations, ODataEntityResource, ODataEntitySetResource, ODataNavigationPropertyResource, ODataPropertyResource, EntityKey, ODataResource, ODataSingletonResource, OptionHandler, ODataQueryArguments, Select } from '../resources';
4
- import { ODataEntitySet, ODataStructuredType } from '../schema';
5
- import { Options } from '../types';
1
+ import { Subscription } from 'rxjs';
2
+ import { EntityKey, ODataEntitiesAnnotations, ODataEntityAnnotations, ODataEntityResource, ODataEntitySetResource, ODataNavigationPropertyResource, ODataPropertyResource, ODataQueryOptions, ODataQueryOptionsHandler, ODataResource, ODataSingletonResource } from '../resources';
3
+ import { ODataEntitySet, ODataStructuredType, ODataStructuredTypeFieldParser } from '../schema';
4
+ import { Options, OptionsHelper } from '../types';
6
5
  import type { ODataCollection } from './collection';
7
6
  import type { ODataModel } from './model';
8
- export declare const CID = "_cid";
9
- export declare type ODataModelResource<T> = ODataEntityResource<T> | ODataSingletonResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>;
10
- export declare type ODataCollectionResource<T> = ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>;
11
7
  export declare type ODataModelEventType = 'change' | 'reset' | 'update' | 'destroy' | 'add' | 'remove' | 'invalid' | 'request' | 'sync' | 'attach';
12
8
  export declare class ODataModelEvent<T> {
13
9
  name: ODataModelEventType;
@@ -100,18 +96,19 @@ export declare class ODataModelField<F> {
100
96
  get type(): string;
101
97
  get navigation(): boolean;
102
98
  get collection(): boolean;
103
- get computed(): boolean;
104
- configure({ findOptionsForType, concurrency, }: {
99
+ annotatedValue<T>(term: string | RegExp): T | undefined;
100
+ configure({ findOptionsForType, concurrency, options, }: {
105
101
  findOptionsForType: (type: string) => ODataModelOptions<any> | undefined;
106
102
  concurrency: boolean;
103
+ options: OptionsHelper;
107
104
  }): void;
108
105
  isKey(): boolean;
109
106
  hasReferentials(): boolean;
110
- get referentials(): import("../parsers").ODataReferential[];
107
+ get referentials(): import("../schema").ODataReferential[];
111
108
  isStructuredType(): boolean;
112
- structured(): ODataStructuredType<F> | undefined;
109
+ structured(): ODataStructuredType<F>;
113
110
  isEnumType(): boolean;
114
- enum(): import("../schema").ODataEnumType<F> | undefined;
111
+ enum(): import("../schema").ODataEnumType<F>;
115
112
  validate(value: any, { method, navigation, }?: {
116
113
  method?: 'create' | 'update' | 'modify';
117
114
  navigation?: boolean;
@@ -120,9 +117,9 @@ export declare class ODataModelField<F> {
120
117
  deserialize(value: any, options?: Options): F;
121
118
  serialize(value: F, options?: Options): any;
122
119
  encode(value: F, options?: Options): any;
123
- resourceFactory<T, F>(resource: ODataModelResource<T>): ODataNavigationPropertyResource<F> | ODataPropertyResource<F>;
124
- annotationsFactory(annots: ODataEntityAnnotations): ODataEntityAnnotations | ODataEntitiesAnnotations;
125
- schemaFactory<T, F>(schema: ODataStructuredType<T>): ODataStructuredType<F> | undefined;
120
+ resourceFactory<T, F>(base: ODataResource<T>): ODataNavigationPropertyResource<F> | ODataPropertyResource<F>;
121
+ annotationsFactory(base: ODataEntityAnnotations): ODataEntityAnnotations | ODataEntitiesAnnotations;
122
+ schemaFactory<T, F>(base: ODataStructuredType<T>): ODataStructuredType<F> | undefined;
126
123
  modelCollectionFactory<T, F>({ parent, value, reset, }: {
127
124
  parent: ODataModel<any>;
128
125
  value?: F | F[] | {
@@ -157,47 +154,41 @@ export declare class ODataModelOptions<T> {
157
154
  entitySet?: ODataEntitySet;
158
155
  parent?: ODataModelOptions<any>;
159
156
  children: ODataModelOptions<any>[];
160
- constructor(options: ModelOptions, schema: ODataStructuredType<T>);
157
+ constructor({ options, schema, }: {
158
+ options: ModelOptions;
159
+ schema: ODataStructuredType<T>;
160
+ });
161
161
  get api(): import("angular-odata").ODataApi;
162
162
  type(): string;
163
163
  isTypeOf(type: string): boolean;
164
164
  findChildOptions(predicate: (options: ODataModelOptions<any>) => boolean): ODataModelOptions<any> | undefined;
165
- configure({ findOptionsForType, }: {
165
+ configure({ findOptionsForType, options, }: {
166
166
  findOptionsForType: (type: string) => ODataModelOptions<any> | undefined;
167
+ options: OptionsHelper;
167
168
  }): void;
168
169
  fields({ include_navigation, include_parents, }?: {
169
170
  include_parents?: boolean;
170
171
  include_navigation?: boolean;
171
172
  }): ODataModelField<any>[];
172
- field(name: keyof T | string): ODataModelField<any> | undefined;
173
- attach(self: ODataModel<T>, resource: ODataModelResource<T>): void;
173
+ field<F>(name: keyof T | string): ODataModelField<any>;
174
+ attach(self: ODataModel<T>, resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>): void;
174
175
  static chain(child: ODataModel<any> | ODataCollection<any, ODataModel<any>>): [
175
176
  ODataModel<any> | ODataCollection<any, ODataModel<any>>,
176
177
  ODataModelField<any> | null
177
178
  ][];
178
- static resource<T>(child: ODataModel<T> | ODataCollection<T, ODataModel<T>>): ODataModelResource<T> | ODataCollectionResource<T>;
179
- collectionResourceFactory({ baseResource, }?: {
180
- baseResource?: ODataResource<T>;
181
- }): ODataCollectionResource<T>;
182
- modelResourceFactory({ baseResource, }?: {
183
- fromSet?: boolean;
184
- baseResource?: ODataResource<T>;
185
- }): ODataModelResource<T>;
186
- entityResource(self: ODataModel<T>): ODataModelResource<T>;
179
+ static resource<T>(child: ODataModel<T> | ODataCollection<T, ODataModel<T>>): ODataResource<T> | ODataResource<T>;
180
+ collectionResourceFactory(query?: ODataQueryOptions<T>): ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | undefined;
181
+ modelResourceFactory(query?: ODataQueryOptions<T>): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> | undefined;
182
+ entityResource(self: ODataModel<T>): ODataResource<T>;
187
183
  bind(self: ODataModel<T>, { parent, resource, annots, }?: {
188
184
  parent?: [
189
185
  ODataModel<any> | ODataCollection<any, ODataModel<any>>,
190
186
  ODataModelField<any> | null
191
187
  ];
192
- resource?: ODataModelResource<T>;
188
+ resource?: ODataResource<T>;
193
189
  annots?: ODataEntityAnnotations;
194
190
  }): void;
195
- query(self: ODataModel<T>, resource: ODataModelResource<T>, func: (q: {
196
- select(opts?: Select<T>): OptionHandler<Select<T>>;
197
- expand(opts?: Expand<T>): OptionHandler<Expand<T>>;
198
- format(opts?: string): OptionHandler<string>;
199
- apply(query: ODataQueryArguments<T>): void;
200
- }) => void): void;
191
+ query(self: ODataModel<T>, resource: ODataEntityResource<T> | ODataPropertyResource<T> | ODataNavigationPropertyResource<T> | ODataSingletonResource<T>, func: (q: ODataQueryOptionsHandler<T>) => void): ODataModel<T>;
201
192
  resolveKey(value: ODataModel<T> | T | {
202
193
  [name: string]: any;
203
194
  }, { field_mapping, resolve, }?: {
@@ -234,7 +225,7 @@ export declare class ODataModelOptions<T> {
234
225
  hasChanged(self: ODataModel<T>, { include_navigation }?: {
235
226
  include_navigation?: boolean;
236
227
  }): boolean;
237
- asEntity<R, M extends ODataModel<T>>(self: M, func: (model: M) => Observable<R>): Observable<R>;
228
+ asEntity<R, M extends ODataModel<T>>(self: M, func: (model: M) => R): R;
238
229
  toEntity(self: ODataModel<T>, { client_id, include_navigation, include_concurrency, include_computed, include_key, include_non_field, changes_only, field_mapping, chain, }?: {
239
230
  client_id?: boolean;
240
231
  include_navigation?: boolean;
@@ -263,8 +254,9 @@ export declare class ODataModelOptions<T> {
263
254
  }): void;
264
255
  assign(self: ODataModel<T>, entity: Partial<T> | {
265
256
  [name: string]: any;
266
- }, { reset, silent, }?: {
257
+ }, { reset, reparent, silent, }?: {
267
258
  reset?: boolean;
259
+ reparent?: boolean;
268
260
  silent?: boolean;
269
261
  }): void;
270
262
  static isModel(obj: any): boolean;
package/lib/module.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ModuleWithProviders } from '@angular/core';
2
- import { ApiConfig } from './types';
3
2
  import { ODataSettings } from './settings';
3
+ import { ApiConfig } from './types';
4
4
  import * as i0 from "@angular/core";
5
5
  import * as i1 from "@angular/common/http";
6
6
  export declare function createSettings(configs: ApiConfig[]): ODataSettings;