angular-odata 0.127.0 → 0.130.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 (294) hide show
  1. package/README.md +27 -244
  2. package/esm2022/lib/annotations.mjs +146 -0
  3. package/esm2022/lib/api.mjs +238 -173
  4. package/esm2022/lib/cache/cache.mjs +3 -1
  5. package/esm2022/lib/cache/memory.mjs +1 -1
  6. package/esm2022/lib/cache/storage.mjs +3 -1
  7. package/esm2022/lib/client.mjs +10 -47
  8. package/esm2022/lib/constants.mjs +4 -1
  9. package/esm2022/lib/helper.mjs +9 -1
  10. package/esm2022/lib/index.mjs +4 -1
  11. package/esm2022/lib/loaders.mjs +27 -17
  12. package/esm2022/lib/metadata/csdl/csdl-annotation.mjs +273 -0
  13. package/esm2022/lib/metadata/csdl/csdl-entity-container.mjs +59 -0
  14. package/esm2022/lib/metadata/csdl/csdl-entity-set.mjs +50 -0
  15. package/esm2022/lib/metadata/csdl/csdl-enum-type.mjs +74 -0
  16. package/esm2022/lib/metadata/csdl/csdl-function-action.mjs +204 -0
  17. package/esm2022/lib/metadata/csdl/csdl-navigation-property-binding.mjs +15 -0
  18. package/esm2022/lib/metadata/csdl/csdl-reference.mjs +76 -0
  19. package/esm2022/lib/metadata/csdl/csdl-schema.mjs +87 -0
  20. package/esm2022/lib/metadata/csdl/csdl-singleton.mjs +37 -0
  21. package/esm2022/lib/metadata/csdl/csdl-structural-property.mjs +145 -0
  22. package/esm2022/lib/metadata/csdl/csdl-structured-type.mjs +159 -0
  23. package/esm2022/lib/metadata/csdl/csdl-type-definition.mjs +46 -0
  24. package/esm2022/lib/metadata/index.mjs +3 -0
  25. package/esm2022/lib/metadata/metadata.mjs +41 -0
  26. package/esm2022/lib/metadata/parser.mjs +564 -0
  27. package/esm2022/lib/models/collection.mjs +115 -155
  28. package/esm2022/lib/models/model.mjs +71 -54
  29. package/esm2022/lib/models/options.mjs +194 -136
  30. package/esm2022/lib/module.mjs +7 -7
  31. package/esm2022/lib/options.mjs +57 -2
  32. package/esm2022/lib/resources/index.mjs +2 -2
  33. package/esm2022/lib/resources/options.mjs +66 -0
  34. package/esm2022/lib/resources/path/handlers.mjs +16 -4
  35. package/esm2022/lib/resources/path/segments.mjs +7 -4
  36. package/esm2022/lib/resources/query/builder.mjs +17 -8
  37. package/esm2022/lib/resources/query/expressions/apply.mjs +83 -14
  38. package/esm2022/lib/resources/query/expressions/base.mjs +2 -1
  39. package/esm2022/lib/resources/query/expressions/compute.mjs +3 -2
  40. package/esm2022/lib/resources/query/expressions/count.mjs +3 -1
  41. package/esm2022/lib/resources/query/expressions/expand.mjs +8 -1
  42. package/esm2022/lib/resources/query/expressions/filter.mjs +3 -1
  43. package/esm2022/lib/resources/query/expressions/orderby.mjs +4 -2
  44. package/esm2022/lib/resources/query/expressions/search.mjs +4 -1
  45. package/esm2022/lib/resources/query/expressions/select.mjs +8 -2
  46. package/esm2022/lib/resources/query/expressions/syntax.mjs +37 -7
  47. package/esm2022/lib/resources/query/handlers.mjs +4 -1
  48. package/esm2022/lib/resources/query/options.mjs +2 -1
  49. package/esm2022/lib/resources/request.mjs +19 -5
  50. package/esm2022/lib/resources/resource.mjs +115 -85
  51. package/esm2022/lib/resources/response.mjs +180 -0
  52. package/esm2022/lib/resources/types/action.mjs +31 -26
  53. package/esm2022/lib/resources/types/batch.mjs +7 -7
  54. package/esm2022/lib/resources/types/count.mjs +7 -7
  55. package/esm2022/lib/resources/types/entity-set.mjs +37 -24
  56. package/esm2022/lib/resources/types/entity.mjs +14 -11
  57. package/esm2022/lib/resources/types/function.mjs +28 -28
  58. package/esm2022/lib/resources/types/metadata.mjs +9 -5
  59. package/esm2022/lib/resources/types/navigation-property.mjs +36 -40
  60. package/esm2022/lib/resources/types/property.mjs +31 -59
  61. package/esm2022/lib/resources/types/reference.mjs +3 -4
  62. package/esm2022/lib/resources/types/singleton.mjs +11 -12
  63. package/esm2022/lib/resources/types/value.mjs +16 -12
  64. package/esm2022/lib/schema/annotation.mjs +8 -1
  65. package/esm2022/lib/schema/callable.mjs +13 -10
  66. package/esm2022/lib/schema/element.mjs +18 -9
  67. package/esm2022/lib/schema/entity-container.mjs +6 -2
  68. package/esm2022/lib/schema/entity-set.mjs +3 -1
  69. package/esm2022/lib/schema/enum-type.mjs +11 -11
  70. package/esm2022/lib/schema/index.mjs +2 -1
  71. package/esm2022/lib/schema/parsers/callable.mjs +23 -7
  72. package/esm2022/lib/schema/parsers/edm.mjs +6 -4
  73. package/esm2022/lib/schema/parsers/enum-type.mjs +48 -30
  74. package/esm2022/lib/schema/parsers/structured-type.mjs +61 -27
  75. package/esm2022/lib/schema/schema.mjs +25 -34
  76. package/esm2022/lib/schema/singleton.mjs +11 -0
  77. package/esm2022/lib/schema/structured-type.mjs +27 -25
  78. package/esm2022/lib/services/base.mjs +4 -1
  79. package/esm2022/lib/services/entity-set.mjs +18 -2
  80. package/esm2022/lib/services/entity.mjs +2 -2
  81. package/esm2022/lib/services/factory.mjs +16 -10
  82. package/esm2022/lib/services/singleton.mjs +9 -2
  83. package/esm2022/lib/settings.mjs +8 -99
  84. package/esm2022/lib/types.mjs +1 -1
  85. package/esm2022/lib/utils/arraybuffers.mjs +1 -1
  86. package/esm2022/lib/utils/dates.mjs +1 -1
  87. package/esm2022/lib/utils/durations.mjs +1 -1
  88. package/esm2022/lib/utils/enums.mjs +1 -1
  89. package/esm2022/lib/utils/http.mjs +1 -1
  90. package/esm2022/lib/utils/objects.mjs +1 -1
  91. package/esm2022/lib/utils/odata.mjs +1 -1
  92. package/esm2022/lib/utils/types.mjs +1 -1
  93. package/fesm2022/angular-odata.mjs +3476 -2075
  94. package/fesm2022/angular-odata.mjs.map +1 -1
  95. package/lib/{resources/responses/annotations.d.ts → annotations.d.ts} +2 -2
  96. package/lib/api.d.ts +29 -26
  97. package/lib/cache/memory.d.ts +1 -1
  98. package/lib/client.d.ts +0 -20
  99. package/lib/constants.d.ts +3 -0
  100. package/lib/index.d.ts +2 -0
  101. package/lib/loaders.d.ts +7 -1
  102. package/lib/metadata/csdl/csdl-annotation.d.ts +159 -0
  103. package/lib/metadata/csdl/csdl-entity-container.d.ts +31 -0
  104. package/lib/metadata/csdl/csdl-entity-set.d.ts +25 -0
  105. package/lib/metadata/csdl/csdl-enum-type.d.ts +37 -0
  106. package/lib/metadata/csdl/csdl-function-action.d.ts +148 -0
  107. package/lib/metadata/csdl/csdl-navigation-property-binding.d.ts +12 -0
  108. package/lib/metadata/csdl/csdl-reference.d.ts +53 -0
  109. package/lib/metadata/csdl/csdl-schema.d.ts +37 -0
  110. package/lib/metadata/csdl/csdl-singleton.d.ts +21 -0
  111. package/lib/metadata/csdl/csdl-structural-property.d.ts +86 -0
  112. package/lib/metadata/csdl/csdl-structured-type.d.ts +94 -0
  113. package/lib/metadata/csdl/csdl-type-definition.d.ts +25 -0
  114. package/lib/metadata/index.d.ts +2 -0
  115. package/lib/metadata/metadata.d.ts +23 -0
  116. package/lib/{resources/responses/metadata.d.ts → metadata/parser.d.ts} +19 -7
  117. package/lib/models/collection.d.ts +6 -4
  118. package/lib/models/model.d.ts +20 -27
  119. package/lib/models/options.d.ts +46 -25
  120. package/lib/resources/index.d.ts +1 -1
  121. package/lib/resources/{responses/options.d.ts → options.d.ts} +2 -2
  122. package/lib/resources/path/handlers.d.ts +4 -2
  123. package/lib/resources/path/segments.d.ts +6 -4
  124. package/lib/resources/query/builder.d.ts +3 -2
  125. package/lib/resources/query/expressions/apply.d.ts +37 -15
  126. package/lib/resources/query/expressions/base.d.ts +1 -1
  127. package/lib/resources/query/expressions/compute.d.ts +2 -2
  128. package/lib/resources/query/expressions/count.d.ts +1 -1
  129. package/lib/resources/query/expressions/expand.d.ts +3 -1
  130. package/lib/resources/query/expressions/filter.d.ts +1 -1
  131. package/lib/resources/query/expressions/orderby.d.ts +5 -4
  132. package/lib/resources/query/expressions/search.d.ts +1 -1
  133. package/lib/resources/query/expressions/select.d.ts +2 -1
  134. package/lib/resources/query/expressions/syntax.d.ts +8 -5
  135. package/lib/resources/query/options.d.ts +3 -3
  136. package/lib/resources/resource.d.ts +56 -16
  137. package/lib/resources/{responses/response.d.ts → response.d.ts} +17 -5
  138. package/lib/resources/types/action.d.ts +12 -10
  139. package/lib/resources/types/batch.d.ts +3 -2
  140. package/lib/resources/types/count.d.ts +1 -5
  141. package/lib/resources/types/entity-set.d.ts +25 -11
  142. package/lib/resources/types/entity.d.ts +8 -5
  143. package/lib/resources/types/function.d.ts +12 -12
  144. package/lib/resources/types/metadata.d.ts +1 -1
  145. package/lib/resources/types/navigation-property.d.ts +23 -8
  146. package/lib/resources/types/property.d.ts +27 -9
  147. package/lib/resources/types/reference.d.ts +2 -4
  148. package/lib/resources/types/singleton.d.ts +9 -7
  149. package/lib/resources/types/value.d.ts +2 -6
  150. package/lib/schema/callable.d.ts +5 -7
  151. package/lib/schema/element.d.ts +11 -4
  152. package/lib/schema/entity-container.d.ts +2 -0
  153. package/lib/schema/enum-type.d.ts +13 -16
  154. package/lib/schema/index.d.ts +1 -0
  155. package/lib/schema/parsers/callable.d.ts +7 -8
  156. package/lib/schema/parsers/enum-type.d.ts +16 -18
  157. package/lib/schema/parsers/structured-type.d.ts +11 -10
  158. package/lib/schema/schema.d.ts +6 -9
  159. package/lib/schema/singleton.d.ts +10 -0
  160. package/lib/schema/structured-type.d.ts +10 -10
  161. package/lib/services/entity-set.d.ts +11 -4
  162. package/lib/services/factory.d.ts +14 -2
  163. package/lib/services/singleton.d.ts +4 -2
  164. package/lib/settings.d.ts +0 -10
  165. package/lib/types.d.ts +32 -12
  166. package/lib/utils/enums.d.ts +12 -12
  167. package/lib/utils/http.d.ts +1 -1
  168. package/lib/utils/objects.d.ts +1 -1
  169. package/lib/utils/strings.d.ts +2 -2
  170. package/package.json +5 -1
  171. package/schematics/apigen/angular/api-config.d.ts +15 -0
  172. package/schematics/apigen/angular/api-config.js +40 -0
  173. package/schematics/apigen/angular/api-config.js.map +1 -0
  174. package/schematics/apigen/angular/base.d.ts +71 -0
  175. package/schematics/apigen/angular/base.js +240 -0
  176. package/schematics/apigen/angular/base.js.map +1 -0
  177. package/schematics/apigen/angular/entity.d.ts +24 -0
  178. package/schematics/apigen/angular/entity.js +77 -0
  179. package/schematics/apigen/angular/entity.js.map +1 -0
  180. package/schematics/apigen/angular/enum.d.ts +25 -0
  181. package/schematics/apigen/angular/enum.js +57 -0
  182. package/schematics/apigen/angular/enum.js.map +1 -0
  183. package/schematics/apigen/angular/import.d.ts +6 -0
  184. package/schematics/apigen/angular/import.js +18 -0
  185. package/schematics/apigen/angular/import.js.map +1 -0
  186. package/schematics/apigen/angular/module.d.ts +18 -0
  187. package/schematics/apigen/angular/module.js +41 -0
  188. package/schematics/apigen/angular/module.js.map +1 -0
  189. package/schematics/apigen/angular/service.d.ts +20 -0
  190. package/schematics/apigen/angular/service.js +77 -0
  191. package/schematics/apigen/angular/service.js.map +1 -0
  192. package/schematics/apigen/files/api-config/__fileName__.ts +11 -0
  193. package/schematics/apigen/files/entity/__fileName__.ts +7 -0
  194. package/schematics/apigen/files/entitycontainer-service/__fileName__.ts +18 -0
  195. package/schematics/apigen/files/entityset-service/__fileName__.ts +27 -0
  196. package/schematics/apigen/files/enum/__fileName__.ts +4 -0
  197. package/schematics/apigen/files/index/__fileName__.ts +2 -0
  198. package/schematics/apigen/files/metadata/metadata.json +1 -0
  199. package/schematics/apigen/files/module/__fileName__.ts +9 -0
  200. package/schematics/apigen/files/singleton-service/__fileName__.ts +18 -0
  201. package/schematics/apigen/index.d.ts +3 -0
  202. package/schematics/apigen/index.js +150 -0
  203. package/schematics/apigen/index.js.map +1 -0
  204. package/schematics/apigen/metadata/csdl/csdl-annotation.d.ts +153 -0
  205. package/schematics/apigen/metadata/csdl/csdl-annotation.js +228 -0
  206. package/schematics/apigen/metadata/csdl/csdl-annotation.js.map +1 -0
  207. package/schematics/apigen/metadata/csdl/csdl-entity-container.d.ts +29 -0
  208. package/schematics/apigen/metadata/csdl/csdl-entity-container.js +49 -0
  209. package/schematics/apigen/metadata/csdl/csdl-entity-container.js.map +1 -0
  210. package/schematics/apigen/metadata/csdl/csdl-entity-set.d.ts +23 -0
  211. package/schematics/apigen/metadata/csdl/csdl-entity-set.js +37 -0
  212. package/schematics/apigen/metadata/csdl/csdl-entity-set.js.map +1 -0
  213. package/schematics/apigen/metadata/csdl/csdl-enum-type.d.ts +34 -0
  214. package/schematics/apigen/metadata/csdl/csdl-enum-type.js +50 -0
  215. package/schematics/apigen/metadata/csdl/csdl-enum-type.js.map +1 -0
  216. package/schematics/apigen/metadata/csdl/csdl-function-action.d.ts +140 -0
  217. package/schematics/apigen/metadata/csdl/csdl-function-action.js +136 -0
  218. package/schematics/apigen/metadata/csdl/csdl-function-action.js.map +1 -0
  219. package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.d.ts +12 -0
  220. package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.js +17 -0
  221. package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.js.map +1 -0
  222. package/schematics/apigen/metadata/csdl/csdl-reference.d.ts +42 -0
  223. package/schematics/apigen/metadata/csdl/csdl-reference.js +53 -0
  224. package/schematics/apigen/metadata/csdl/csdl-reference.js.map +1 -0
  225. package/schematics/apigen/metadata/csdl/csdl-schema.d.ts +35 -0
  226. package/schematics/apigen/metadata/csdl/csdl-schema.js +63 -0
  227. package/schematics/apigen/metadata/csdl/csdl-schema.js.map +1 -0
  228. package/schematics/apigen/metadata/csdl/csdl-singleton.d.ts +21 -0
  229. package/schematics/apigen/metadata/csdl/csdl-singleton.js +33 -0
  230. package/schematics/apigen/metadata/csdl/csdl-singleton.js.map +1 -0
  231. package/schematics/apigen/metadata/csdl/csdl-structural-property.d.ts +79 -0
  232. package/schematics/apigen/metadata/csdl/csdl-structural-property.js +103 -0
  233. package/schematics/apigen/metadata/csdl/csdl-structural-property.js.map +1 -0
  234. package/schematics/apigen/metadata/csdl/csdl-structured-type.d.ts +83 -0
  235. package/schematics/apigen/metadata/csdl/csdl-structured-type.js +116 -0
  236. package/schematics/apigen/metadata/csdl/csdl-structured-type.js.map +1 -0
  237. package/schematics/apigen/metadata/csdl/csdl-type-definition.d.ts +25 -0
  238. package/schematics/apigen/metadata/csdl/csdl-type-definition.js +38 -0
  239. package/schematics/apigen/metadata/csdl/csdl-type-definition.js.map +1 -0
  240. package/schematics/apigen/metadata/index.d.ts +1 -0
  241. package/schematics/apigen/metadata/index.js +18 -0
  242. package/schematics/apigen/metadata/index.js.map +1 -0
  243. package/schematics/apigen/metadata/metadata.d.ts +21 -0
  244. package/schematics/apigen/metadata/metadata.js +36 -0
  245. package/schematics/apigen/metadata/metadata.js.map +1 -0
  246. package/schematics/apigen/metadata/parser.d.ts +110 -0
  247. package/schematics/apigen/metadata/parser.js +568 -0
  248. package/schematics/apigen/metadata/parser.js.map +1 -0
  249. package/schematics/apigen/schema.d.ts +9 -0
  250. package/schematics/apigen/schema.js +3 -0
  251. package/schematics/apigen/schema.js.map +1 -0
  252. package/schematics/apigen/schema.json +37 -0
  253. package/schematics/apigen/utils.d.ts +2 -0
  254. package/schematics/apigen/utils.js +99 -0
  255. package/schematics/apigen/utils.js.map +1 -0
  256. package/schematics/collection.json +14 -0
  257. package/schematics/ng-add/index.d.ts +2 -0
  258. package/schematics/ng-add/index.js +12 -0
  259. package/schematics/ng-add/index.js.map +1 -0
  260. package/schematics/random.d.ts +1 -0
  261. package/schematics/random.js +604 -0
  262. package/schematics/random.js.map +1 -0
  263. package/esm2022/lib/resources/responses/annotations.mjs +0 -140
  264. package/esm2022/lib/resources/responses/csdl/csdl-annotation.mjs +0 -33
  265. package/esm2022/lib/resources/responses/csdl/csdl-entity-container.mjs +0 -11
  266. package/esm2022/lib/resources/responses/csdl/csdl-entity-set.mjs +0 -9
  267. package/esm2022/lib/resources/responses/csdl/csdl-enum-type.mjs +0 -15
  268. package/esm2022/lib/resources/responses/csdl/csdl-function-action.mjs +0 -56
  269. package/esm2022/lib/resources/responses/csdl/csdl-navigation-property-binding.mjs +0 -7
  270. package/esm2022/lib/resources/responses/csdl/csdl-reference.mjs +0 -23
  271. package/esm2022/lib/resources/responses/csdl/csdl-schema.mjs +0 -18
  272. package/esm2022/lib/resources/responses/csdl/csdl-singleton.mjs +0 -8
  273. package/esm2022/lib/resources/responses/csdl/csdl-structural-property.mjs +0 -39
  274. package/esm2022/lib/resources/responses/csdl/csdl-structured-type.mjs +0 -34
  275. package/esm2022/lib/resources/responses/csdl/csdl-type-definition.mjs +0 -14
  276. package/esm2022/lib/resources/responses/index.mjs +0 -5
  277. package/esm2022/lib/resources/responses/metadata.mjs +0 -547
  278. package/esm2022/lib/resources/responses/options.mjs +0 -56
  279. package/esm2022/lib/resources/responses/response.mjs +0 -174
  280. package/esm2022/lib/resources/responses/types.mjs +0 -2
  281. package/lib/resources/responses/csdl/csdl-annotation.d.ts +0 -27
  282. package/lib/resources/responses/csdl/csdl-entity-container.d.ts +0 -12
  283. package/lib/resources/responses/csdl/csdl-entity-set.d.ts +0 -8
  284. package/lib/resources/responses/csdl/csdl-enum-type.d.ts +0 -12
  285. package/lib/resources/responses/csdl/csdl-function-action.d.ts +0 -49
  286. package/lib/resources/responses/csdl/csdl-navigation-property-binding.d.ts +0 -5
  287. package/lib/resources/responses/csdl/csdl-reference.d.ts +0 -18
  288. package/lib/resources/responses/csdl/csdl-schema.d.ts +0 -20
  289. package/lib/resources/responses/csdl/csdl-singleton.d.ts +0 -7
  290. package/lib/resources/responses/csdl/csdl-structural-property.d.ts +0 -31
  291. package/lib/resources/responses/csdl/csdl-structured-type.d.ts +0 -27
  292. package/lib/resources/responses/csdl/csdl-type-definition.d.ts +0 -11
  293. package/lib/resources/responses/index.d.ts +0 -4
  294. package/lib/resources/responses/types.d.ts +0 -13
@@ -1,10 +1,12 @@
1
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 { EdmType, Parser, ParserOptions } from '../types';
2
+ import { EntityKey, ODataQueryOptions, ODataQueryOptionsHandler, ODataResource, ODataSingletonResource } from '../resources';
3
+ import { ODataEntityResource, ODataEntitySetResource, ODataNavigationPropertyResource, ODataPropertyResource } from '../resources';
4
+ import { ODataEntitySet, ODataEnumType, ODataStructuredType, ODataStructuredTypeFieldParser } from '../schema';
5
+ import { EdmType, ParserOptions } from '../types';
5
6
  import { ODataCollection } from './collection';
6
7
  import { ODataModel } from './model';
7
8
  import { EventEmitter } from '@angular/core';
9
+ import { ODataEntitiesAnnotations, ODataEntityAnnotations } from '../annotations';
8
10
  export declare enum ODataModelEventType {
9
11
  Change = "change",
10
12
  Reset = "reset",
@@ -40,7 +42,7 @@ export declare class ODataModelEvent<T> {
40
42
  ODataModel<any> | ODataCollection<any, ODataModel<any>>,
41
43
  ODataModelAttribute<any> | number | null
42
44
  ][];
43
- push(model: ODataModel<any> | ODataCollection<any, ODataModel<any>>, attr: ODataModelAttribute<any> | number): ODataModelEvent<T>;
45
+ push(model: ODataModel<any> | ODataCollection<any, ODataModel<any>>, attr: ODataModelAttribute<any> | number): ODataModelEvent<any>;
44
46
  bubbles: boolean;
45
47
  stopPropagation(): void;
46
48
  visited(model: ODataModel<any> | ODataCollection<any, ODataModel<any>>): boolean;
@@ -85,8 +87,12 @@ export declare const INCLUDE_DEEP: {
85
87
  export declare enum ODataModelState {
86
88
  Added = 0,
87
89
  Removed = 1,
88
- Unchanged = 2
90
+ Changed = 2,
91
+ Unchanged = 3
89
92
  }
93
+ export type ModelInterface<T> = {
94
+ [P in keyof T]: T[P] extends (infer U)[] ? ODataCollection<U, ODataModel<U> & ModelInterface<U>> : T[P] extends object ? ODataModel<T[P]> & ModelInterface<T[P]> : T[P];
95
+ };
90
96
  export type ModelOptions = {
91
97
  cid?: string;
92
98
  fields: Map<string, ModelFieldOptions>;
@@ -105,7 +111,9 @@ export type ModelFieldOptions = {
105
111
  };
106
112
  export declare function Model({ cid }?: {
107
113
  cid?: string;
108
- }): <T extends new (...args: any[]) => {}>(constructor: T) => T;
114
+ }): <T extends {
115
+ new (...args: any[]): {};
116
+ }>(constructor: T) => T;
109
117
  export declare function ModelField({ name, ...options }?: {
110
118
  name?: string;
111
119
  } & ModelFieldOptions): (target: any, key: string) => void;
@@ -119,7 +127,11 @@ export declare class ODataModelField<F> {
119
127
  field: string;
120
128
  parser: ODataStructuredTypeFieldParser<F>;
121
129
  options: ODataModelOptions<any>;
122
- meta?: ODataModelOptions<any>;
130
+ optionsForType?: (type: string) => ODataModelOptions<any> | undefined;
131
+ modelForType?: (t: string) => typeof ODataModel<any> | undefined;
132
+ collectionForType?: (t: string) => typeof ODataCollection<any, ODataModel<any>> | undefined;
133
+ enumForType?: (t: string) => ODataEnumType<F> | undefined;
134
+ structuredForType?: (t: string) => ODataStructuredType<F> | undefined;
123
135
  default?: any;
124
136
  required: boolean;
125
137
  concurrency: boolean;
@@ -130,13 +142,16 @@ export declare class ODataModelField<F> {
130
142
  pattern?: RegExp;
131
143
  parserOptions?: ParserOptions;
132
144
  constructor(options: ODataModelOptions<any>, { name, field, parser, ...opts }: ODataModelFieldOptions<F>);
133
- get api(): import("angular-odata").ODataApi;
134
145
  get type(): string;
135
146
  get navigation(): boolean;
136
147
  get collection(): boolean;
137
148
  annotatedValue<T>(term: string | RegExp): T | undefined;
138
- configure({ findOptionsForType, concurrency, options, }: {
139
- findOptionsForType: (type: string) => ODataModelOptions<any> | undefined;
149
+ configure({ optionsForType, modelForType, collectionForType, enumForType, structuredForType, concurrency, options, }: {
150
+ optionsForType: (type: string) => ODataModelOptions<any> | undefined;
151
+ modelForType: (t: string) => typeof ODataModel<any> | undefined;
152
+ collectionForType: (t: string) => typeof ODataCollection<any, any> | undefined;
153
+ enumForType: (t: string) => ODataEnumType<any> | undefined;
154
+ structuredForType: (t: string) => ODataStructuredType<any> | undefined;
140
155
  concurrency: boolean;
141
156
  options: ParserOptions;
142
157
  }): void;
@@ -144,9 +159,9 @@ export declare class ODataModelField<F> {
144
159
  hasReferentials(): boolean;
145
160
  get referentials(): import("../schema").ODataReferential[];
146
161
  isStructuredType(): boolean;
147
- structured(): ODataStructuredType<F>;
162
+ structuredType(): ODataStructuredType<F>;
148
163
  isEnumType(): boolean;
149
- enum(): import("../schema").ODataEnumType<F>;
164
+ enumType(): ODataEnumType<F>;
150
165
  validate(value: any, { method, navigation, }?: {
151
166
  method?: 'create' | 'update' | 'modify';
152
167
  navigation?: boolean;
@@ -157,7 +172,6 @@ export declare class ODataModelField<F> {
157
172
  encode(value: F, options?: ParserOptions): any;
158
173
  resourceFactory<T, F>(base: ODataResource<T>): ODataNavigationPropertyResource<F> | ODataPropertyResource<F>;
159
174
  annotationsFactory<T, F>(base: ODataEntityAnnotations<T>): ODataEntityAnnotations<F> | ODataEntitiesAnnotations<F>;
160
- schemaFactory<T, F>(base: ODataStructuredType<T>): ODataStructuredType<F> | undefined;
161
175
  modelFactory<F>({ parent, value, reset, }: {
162
176
  parent: ODataModel<any>;
163
177
  value?: Partial<F> | {
@@ -176,17 +190,18 @@ export declare class ODataModelField<F> {
176
190
  export declare class ODataModelAttribute<T> {
177
191
  private _model;
178
192
  private _field;
193
+ private state;
179
194
  private value?;
180
195
  private change?;
181
196
  private subscription?;
182
197
  events$: ODataModelEventEmitter<T>;
183
198
  constructor(_model: ODataModel<any>, _field: ODataModelField<T>);
199
+ get type(): string;
184
200
  get navigation(): boolean;
185
201
  get computed(): boolean | undefined;
186
202
  get concurrency(): boolean;
187
203
  get referentials(): import("../schema").ODataReferential[];
188
204
  get options(): ODataModelOptions<any>;
189
- get meta(): ODataModelOptions<any> | undefined;
190
205
  get name(): string;
191
206
  get fieldName(): string;
192
207
  get(): T | ODataModel<T> | ODataCollection<T, ODataModel<T>> | null | undefined;
@@ -211,14 +226,14 @@ export declare class ODataModelOptions<T> {
211
226
  cid: string;
212
227
  base?: string;
213
228
  private _fields;
214
- schema: ODataStructuredType<T>;
229
+ structuredType: ODataStructuredType<T>;
215
230
  entitySet?: ODataEntitySet;
216
231
  parent?: ODataModelOptions<any>;
217
232
  children: ODataModelOptions<any>[];
218
233
  events$: ODataModelEventEmitter<T>;
219
- constructor({ options, schema, }: {
220
- options: ModelOptions;
221
- schema: ODataStructuredType<T>;
234
+ constructor({ config, structuredType, }: {
235
+ config: ModelOptions;
236
+ structuredType: ODataStructuredType<T>;
222
237
  });
223
238
  get api(): import("angular-odata").ODataApi;
224
239
  type({ alias }?: {
@@ -232,17 +247,17 @@ export declare class ODataModelOptions<T> {
232
247
  [name: string]: any;
233
248
  }): boolean;
234
249
  findChildOptions(predicate: (options: ODataModelOptions<any>) => boolean): ODataModelOptions<any> | undefined;
235
- configure({ options, parserForType, findOptionsForType, }: {
250
+ configure({ options }: {
236
251
  options: ParserOptions;
237
- parserForType: (type: string) => Parser<any>;
238
- findOptionsForType: (type: string) => ODataModelOptions<any> | undefined;
239
252
  }): void;
240
253
  fields({ include_navigation, include_parents, }: {
241
254
  include_parents: boolean;
242
255
  include_navigation: boolean;
243
256
  }): ODataModelField<any>[];
244
257
  field<F>(name: keyof T | string): ODataModelField<F>;
245
- findField<F>(name: keyof T | string): ODataModelField<F> | undefined;
258
+ findField<F>(name: keyof T | string, { reset }?: {
259
+ reset?: boolean;
260
+ }): ODataModelField<F> | undefined;
246
261
  addField<F>(name: string, options: ModelFieldOptions): ODataModelField<F>;
247
262
  tsToEdm: Record<string, EdmType>;
248
263
  private modelFieldFactory;
@@ -332,7 +347,7 @@ export declare class ODataModelOptions<T> {
332
347
  reset?: boolean;
333
348
  reparent?: boolean;
334
349
  silent?: boolean;
335
- }): void;
350
+ }): ODataModel<T>;
336
351
  static isModel(obj: any): boolean;
337
352
  static isCollection(obj: any): boolean;
338
353
  get<F>(self: ODataModel<T>, field: ODataModelField<F> | string): F | ODataModel<F> | ODataCollection<F, ODataModel<F>> | null | undefined;
@@ -340,8 +355,14 @@ export declare class ODataModelOptions<T> {
340
355
  [name: string]: any;
341
356
  } | {
342
357
  [name: string]: any;
343
- }[] | ODataModel<F> | ODataCollection<F, ODataModel<F>> | null, { type }?: {
344
- type?: string;
358
+ }[] | ODataModel<F> | ODataCollection<F, ODataModel<F>> | null, { add, merge, remove, reset, reparent, silent, type, }?: {
359
+ add?: boolean;
360
+ merge?: boolean;
361
+ remove?: boolean;
362
+ reset?: boolean;
363
+ reparent?: boolean;
364
+ silent?: boolean;
365
+ type?: EdmType | string;
345
366
  }): boolean;
346
367
  private _link;
347
368
  }
@@ -3,4 +3,4 @@ export * from './path';
3
3
  export * from './request';
4
4
  export * from './resource';
5
5
  export * from './types';
6
- export * from './responses';
6
+ export * from './response';
@@ -1,4 +1,4 @@
1
- import { ODataMetadataType, ODataVersion, ParserOptions, ResponseOptions } from '../../types';
1
+ import { ODataMetadataType, ODataVersion, ParserOptions, ResponseOptions } from '../types';
2
2
  export declare class ODataResponseOptions implements ResponseOptions {
3
3
  version: ODataVersion;
4
4
  streaming?: boolean;
@@ -8,7 +8,7 @@ export declare class ODataResponseOptions implements ResponseOptions {
8
8
  cacheability?: 'public' | 'private' | 'no-cache' | 'no-store';
9
9
  maxAge?: number;
10
10
  constructor(config: ParserOptions);
11
- get helper(): import("../../helper").ODataVersionHelper;
11
+ get helper(): import("../helper").ODataVersionHelper;
12
12
  clone(): ODataResponseOptions;
13
13
  setFeatures(features: string): void;
14
14
  setVersion(version: string): void;
@@ -1,11 +1,13 @@
1
1
  import { PathSegment } from '../../types';
2
2
  import { EntityKey } from '../resource';
3
- import type { ODataPathSegments, ODataSegment } from './segments';
3
+ import { ODataPathSegments, ODataSegment } from './segments';
4
4
  export declare class SegmentHandler {
5
5
  private segment;
6
6
  constructor(segment: ODataSegment);
7
7
  get name(): PathSegment;
8
- type(value?: string): string | undefined;
8
+ outgoingType(value?: string): string | undefined;
9
+ incomingType(value?: string): string | undefined;
10
+ bindingType(value?: string): string | undefined;
9
11
  path(value?: string): string;
10
12
  key<T>(value?: EntityKey<T>): EntityKey<T>;
11
13
  hasKey(): boolean;
@@ -4,14 +4,16 @@ import { SegmentHandler } from './handlers';
4
4
  export type ODataSegment = {
5
5
  name: PathSegment;
6
6
  path: string;
7
- type?: string;
7
+ outgoingType?: string;
8
+ incomingType?: string;
9
+ bindingType?: string;
8
10
  key?: any;
9
11
  parameters?: any;
10
12
  };
11
13
  export declare const pathAndParamsFromSegments: (segments: ODataSegment[], { escape, parser, options, }?: {
12
- escape?: boolean | undefined;
13
- parser?: Parser<any> | undefined;
14
- options?: ParserOptions | undefined;
14
+ escape?: boolean;
15
+ parser?: Parser<any>;
16
+ options?: ParserOptions;
15
17
  }) => [string, {
16
18
  [name: string]: any;
17
19
  }];
@@ -75,6 +75,7 @@ export type QueryOptions<T> = ExpandOptions<T> & {
75
75
  } | {
76
76
  [name: string]: any;
77
77
  }[];
78
+ compute: string;
78
79
  skip: number;
79
80
  skiptoken: string;
80
81
  key: string | number | {
@@ -92,8 +93,8 @@ export type QueryOptions<T> = ExpandOptions<T> & {
92
93
  escape: boolean;
93
94
  };
94
95
  export declare const ITEM_ROOT = "";
95
- export default function <T>({ select, search, skiptoken, format, top, skip, filter, transform, orderBy, key, count, expand, action, func, aliases, escape, }?: Partial<QueryOptions<T>>): string;
96
- export declare function buildPathAndQuery<T>({ select, search, skiptoken, format, top, skip, filter, apply, transform, orderBy, key, count, expand, action, func, aliases, escape, }?: Partial<QueryOptions<T>>): [string, {
96
+ export default function <T>({ select, search, skiptoken, format, top, skip, filter, transform, compute, orderBy, key, count, expand, action, func, aliases, escape, }?: Partial<QueryOptions<T>>): string;
97
+ export declare function buildPathAndQuery<T>({ select, search, skiptoken, format, top, skip, filter, apply, transform, compute, orderBy, key, count, expand, action, func, aliases, escape, }?: Partial<QueryOptions<T>>): [string, {
97
98
  [name: string]: any;
98
99
  }];
99
100
  export declare function normalizeValue(value: Value, { aliases, escape, }?: {
@@ -1,21 +1,44 @@
1
1
  import { Parser, ParserOptions } from '../../../types';
2
- import type { QueryCustomType } from '../builder';
2
+ import { QueryCustomType } from '../builder';
3
3
  import { Expression } from './base';
4
4
  import { FilterConnector, FilterExpression } from './filter';
5
5
  import { SearchConnector, SearchExpression } from './search';
6
6
  import { ODataFunctions, ODataOperators, Renderable, AggregateMethod } from './syntax';
7
- declare class GroupByTransformations<T> implements Renderable {
8
- render({ aliases, escape, prefix, parser, options, }: {
9
- aliases?: QueryCustomType[] | undefined;
10
- escape?: boolean | undefined;
11
- prefix?: string | undefined;
12
- parser?: Parser<any> | undefined;
13
- options?: ParserOptions | undefined;
7
+ export declare class GroupByTransformations<T> extends Expression<T> {
8
+ protected methods: (AggregateMethod | string)[];
9
+ protected aliases: string[];
10
+ constructor({ children, methods, aliases, }?: {
11
+ children?: Renderable[];
12
+ methods?: (AggregateMethod | string)[];
13
+ aliases?: string[];
14
+ });
15
+ get [Symbol.toStringTag](): string;
16
+ toJson(): {
17
+ $type: string;
18
+ children: any[];
19
+ } & {
20
+ methods: string[];
21
+ aliases: string[];
22
+ };
23
+ static fromJson<T>(json: {
24
+ [name: string]: any;
25
+ }): GroupByTransformations<T>;
26
+ render({ aliases, escape, prefix, parser, options, }?: {
27
+ aliases?: QueryCustomType[];
28
+ escape?: boolean;
29
+ prefix?: string;
30
+ parser?: Parser<T>;
31
+ options?: ParserOptions;
14
32
  }): string;
15
- toString(): string;
16
- toJson(): void;
17
- clone(): void;
18
- resolve(parser: any): void;
33
+ clone(): GroupByTransformations<T>;
34
+ private _add;
35
+ aggregate(value: any, method: AggregateMethod | string, alias: string): GroupByTransformations<T>;
36
+ sum(value: any, alias: string): GroupByTransformations<T>;
37
+ min(value: any, alias: string): GroupByTransformations<T>;
38
+ max(value: any, alias: string): GroupByTransformations<T>;
39
+ average(value: any, alias: string): GroupByTransformations<T>;
40
+ countdistinct(value: any, alias: string): GroupByTransformations<T>;
41
+ count(alias: string): GroupByTransformations<T>;
19
42
  }
20
43
  export type ApplyExpressionBuilder<T> = {
21
44
  t: Required<T>;
@@ -84,7 +107,7 @@ export declare class ApplyExpression<T> extends Expression<T> {
84
107
  e: (connector?: FilterConnector) => FilterExpression<T>;
85
108
  o: ODataOperators<T>;
86
109
  f: ODataFunctions<T>;
87
- }) => FilterExpression<T>): ApplyExpression<any>;
110
+ }) => FilterExpression<T>): ApplyExpression<T>;
88
111
  expand(opts: (e: {
89
112
  o: ODataOperators<T>;
90
113
  f: ODataFunctions<T>;
@@ -94,10 +117,9 @@ export declare class ApplyExpression<T> extends Expression<T> {
94
117
  e: (connector?: SearchConnector) => SearchExpression<T>;
95
118
  o: ODataOperators<T>;
96
119
  f: ODataFunctions<T>;
97
- }) => SearchExpression<T>): ApplyExpression<any>;
120
+ }) => SearchExpression<T>): ApplyExpression<T>;
98
121
  compute(opts: (e: {
99
122
  o: ODataOperators<T>;
100
123
  f: ODataFunctions<T>;
101
124
  }) => Renderable): ApplyExpression<T>;
102
125
  }
103
- export {};
@@ -1,5 +1,5 @@
1
1
  import { Parser, ParserOptions } from '../../../types';
2
- import type { QueryCustomType } from '../builder';
2
+ import { QueryCustomType } from '../builder';
3
3
  import { Renderable } from './syntax';
4
4
  export declare abstract class Expression<T> implements Renderable {
5
5
  protected _children: Renderable[];
@@ -1,5 +1,5 @@
1
1
  import { Parser, ParserOptions } from '../../../types';
2
- import type { QueryCustomType } from '../builder';
2
+ import { QueryCustomType } from '../builder';
3
3
  import { Expression } from './base';
4
4
  import { ODataFunctions, ODataOperators, Renderable } from './syntax';
5
5
  export type ComputeExpressionBuilder<T> = {
@@ -7,7 +7,7 @@ export type ComputeExpressionBuilder<T> = {
7
7
  e: () => ComputeExpression<T>;
8
8
  };
9
9
  export declare class ComputeExpression<T> extends Expression<T> {
10
- names: string[];
10
+ protected names: string[];
11
11
  constructor({ children, names, }?: {
12
12
  children?: Renderable[];
13
13
  names?: string[];
@@ -1,5 +1,5 @@
1
1
  import { Parser, ParserOptions } from '../../../types';
2
- import type { QueryCustomType } from '../builder';
2
+ import { QueryCustomType } from '../builder';
3
3
  import { Expression } from './base';
4
4
  import { FilterExpression, FilterExpressionBuilder } from './filter';
5
5
  import { Renderable } from './syntax';
@@ -1,6 +1,7 @@
1
1
  import { Parser, ParserOptions } from '../../../types';
2
- import type { QueryCustomType, Unpacked } from '../builder';
2
+ import { QueryCustomType, Unpacked } from '../builder';
3
3
  import { Expression } from './base';
4
+ import { ComputeExpression, ComputeExpressionBuilder } from './compute';
4
5
  import { FilterExpression, FilterExpressionBuilder } from './filter';
5
6
  import { OrderByExpression, OrderByExpressionBuilder } from './orderby';
6
7
  import { SearchExpression, SearchExpressionBuilder } from './search';
@@ -30,6 +31,7 @@ export declare class ExpandField<T> implements Renderable {
30
31
  filter(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>): FilterExpression<T>;
31
32
  search(opts: (builder: SearchExpressionBuilder<T>) => SearchExpression<T>): SearchExpression<T>;
32
33
  orderBy(opts: (builder: OrderByExpressionBuilder<T>, current?: OrderByExpression<T>) => OrderByExpression<T>): OrderByExpression<T>;
34
+ compute(opts: (builder: ComputeExpressionBuilder<T>, current?: ComputeExpression<T>) => ComputeExpression<T>): ComputeExpression<T>;
33
35
  skip(n: number): number;
34
36
  top(n: number): number;
35
37
  levels(n: number | 'max'): number | "max";
@@ -1,5 +1,5 @@
1
1
  import { Parser, ParserOptions } from '../../../types';
2
- import type { QueryCustomType } from '../builder';
2
+ import { QueryCustomType } from '../builder';
3
3
  import { Expression } from './base';
4
4
  import { CountExpression, CountField } from './count';
5
5
  import { Normalize, ODataFunctions, ODataOperators, Renderable } from './syntax';
@@ -1,16 +1,17 @@
1
1
  import { Parser, ParserOptions } from '../../../types';
2
- import type { QueryCustomType } from '../builder';
2
+ import { QueryCustomType } from '../builder';
3
3
  import { Expression } from './base';
4
4
  import { Renderable } from './syntax';
5
+ export type OrderAttribute = 'asc' | 'desc';
5
6
  export declare class OrderByField implements Renderable {
6
7
  protected field: Renderable;
7
- protected order: 'asc' | 'desc';
8
- constructor(field: Renderable, order: 'asc' | 'desc');
8
+ protected order: OrderAttribute;
9
+ constructor(field: Renderable, order: OrderAttribute);
9
10
  get [Symbol.toStringTag](): string;
10
11
  toJson(): {
11
12
  $type: string;
12
13
  field: any;
13
- order: "asc" | "desc";
14
+ order: OrderAttribute;
14
15
  };
15
16
  render({ aliases, escape, prefix, parser, options, }: {
16
17
  aliases?: QueryCustomType[];
@@ -1,5 +1,5 @@
1
1
  import { Parser, ParserOptions } from '../../../types';
2
- import type { QueryCustomType } from '../builder';
2
+ import { QueryCustomType } from '../builder';
3
3
  import { Expression } from './base';
4
4
  import { Renderable } from './syntax';
5
5
  export type SearchConnector = 'AND' | 'OR';
@@ -1,5 +1,5 @@
1
1
  import { Parser, ParserOptions } from '../../../types';
2
- import type { QueryCustomType } from '../builder';
2
+ import { QueryCustomType } from '../builder';
3
3
  import { Expression } from './base';
4
4
  import { Renderable } from './syntax';
5
5
  export type SelectExpressionBuilder<T> = {
@@ -29,4 +29,5 @@ export declare class SelectExpression<T> extends Expression<T> {
29
29
  clone(): SelectExpression<T>;
30
30
  private _add;
31
31
  field(field: any): SelectExpression<T>;
32
+ fields(...fields: any[]): SelectExpression<T>;
32
33
  }
@@ -1,5 +1,5 @@
1
1
  import { Parser, ParserOptions } from '../../../types';
2
- import type { QueryCustomType } from '../builder';
2
+ import { QueryCustomType } from '../builder';
3
3
  export type Normalize = 'all' | 'right' | 'left' | 'none';
4
4
  export interface Renderable {
5
5
  render({ aliases, escape, prefix, parser, options, }: {
@@ -231,14 +231,17 @@ export declare class Transformations<T> {
231
231
  bottomSum(value: number, field: Renderable, normalize?: Normalize): Function<T>;
232
232
  bottomPercent(value: number, field: Renderable, normalize?: Normalize): Function<T>;
233
233
  identity(): Function<T>;
234
- search(left: any, normalize?: Normalize): Function<T>;
235
- filter(left: any, normalize?: Normalize): Function<T>;
234
+ search(value: any, normalize?: Normalize): Function<T>;
235
+ filter(value: any, normalize?: Normalize): Function<T>;
236
+ skip(value: number, normalize?: Normalize): Function<T>;
237
+ top(value: number, normalize?: Normalize): Function<T>;
238
+ orderby(value: any, normalize?: Normalize): Function<T>;
236
239
  }
237
240
  export declare class Type<T> implements Renderable {
238
241
  protected name: string;
239
242
  protected type: string;
240
- protected value?: any;
241
- constructor(name: string, type: string, value?: any);
243
+ protected value?: any | undefined;
244
+ constructor(name: string, type: string, value?: any | undefined);
242
245
  get [Symbol.toStringTag](): string;
243
246
  toJson(): {
244
247
  $type: string;
@@ -22,9 +22,9 @@ export type ODataQueryArguments<T> = {
22
22
  [QueryOption.count]?: boolean | null;
23
23
  };
24
24
  export declare const pathAndParamsFromQueryOptions: <T>(values: Map<QueryOption, any>, { escape, parser, options, }?: {
25
- escape?: boolean | undefined;
26
- parser?: Parser<T> | undefined;
27
- options?: ParserOptions | undefined;
25
+ escape?: boolean;
26
+ parser?: Parser<T>;
27
+ options?: ParserOptions;
28
28
  }) => [string, {
29
29
  [name: string]: any;
30
30
  }];
@@ -1,53 +1,88 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { ODataApi } from '../api';
3
- import { ODataCollection, ODataModel } from '../models';
3
+ import { ModelInterface, ODataCollection, ODataModel } from '../models';
4
4
  import { ODataStructuredType } from '../schema';
5
- import { ODataSchemaElement } from '../schema/element';
6
- import { ParserOptions, QueryOption } from '../types';
5
+ import { ParserOptions, QueryOption, StructuredTypeFieldConfig } from '../types';
7
6
  import { ODataPathSegments, ODataPathSegmentsHandler } from './path';
8
- import { ODataQueryOptions, ODataQueryOptionsHandler, QueryCustomType } from './query';
9
- import { ODataEntitiesAnnotations, ODataEntityAnnotations } from './responses/index';
7
+ import { ODataQueryOptions, ODataQueryOptionsHandler } from './query';
8
+ import { ApplyExpression, ApplyExpressionBuilder, QueryCustomType } from './query';
10
9
  import { ODataOptions } from './types';
10
+ import { ODataEntitiesAnnotations, ODataEntityAnnotations } from '../annotations';
11
11
  export type EntityKey<T> = {
12
12
  readonly [P in keyof T]?: T[P];
13
13
  } | QueryCustomType | string | number;
14
14
  export declare class ODataResource<T> {
15
15
  api: ODataApi;
16
- schema?: ODataSchemaElement;
17
16
  protected pathSegments: ODataPathSegments;
18
17
  protected queryOptions: ODataQueryOptions<T>;
19
- constructor(api: ODataApi, { segments, query, schema, }?: {
18
+ constructor(api: ODataApi, { segments, query, }?: {
20
19
  segments?: ODataPathSegments;
21
20
  query?: ODataQueryOptions<T>;
22
- schema?: ODataSchemaElement;
23
21
  });
24
22
  /**
25
- * @returns string The type of the resource
23
+ * @returns string The outgoing type of the resource
26
24
  */
27
- type(): string | undefined;
25
+ outgoingType(): string | undefined;
28
26
  /**
29
- * @returns string The type of the return
27
+ * @returns string The incoming type of the resource
30
28
  */
31
- returnType(): string | undefined;
29
+ incomingType(): string | undefined;
30
+ /**
31
+ * @returns string The binding type of the resource
32
+ */
33
+ bindingType(): string | undefined;
32
34
  /**
33
35
  * @returns string All covered types of the resource
34
36
  */
35
37
  types(): string[];
38
+ callable(): import("../schema").ODataCallable<T> | undefined;
39
+ enumType(): import("../schema").ODataEnumType<T> | undefined;
40
+ structuredType(): ODataStructuredType<T> | undefined;
36
41
  /**
37
42
  * @returns boolean The resource has key ?
38
43
  */
39
44
  hasKey(): boolean;
40
45
  hasEntityKey(): boolean;
41
46
  clearKey(): void | undefined;
47
+ asModel(entity?: Partial<T> | {
48
+ [name: string]: any;
49
+ }): ODataModel<T> & ModelInterface<T>;
50
+ asModel(entity: Partial<T> | {
51
+ [name: string]: any;
52
+ }, { reset, annots, ModelType, }: {
53
+ reset?: boolean;
54
+ annots?: ODataEntityAnnotations<T>;
55
+ ModelType?: typeof ODataModel;
56
+ }): ODataModel<T> & ModelInterface<T>;
42
57
  asModel<M extends ODataModel<T>>(entity?: Partial<T> | {
43
58
  [name: string]: any;
44
- }, { annots }?: {
59
+ }): M;
60
+ asModel<M extends ODataModel<T>>(entity: Partial<T> | {
61
+ [name: string]: any;
62
+ }, { reset, annots, ModelType, }: {
63
+ reset?: boolean;
45
64
  annots?: ODataEntityAnnotations<T>;
65
+ ModelType?: typeof ODataModel;
46
66
  }): M;
67
+ asCollection(entities?: Partial<T>[] | {
68
+ [name: string]: any;
69
+ }[]): ODataCollection<T, ODataModel<T> & ModelInterface<T>>;
70
+ asCollection(entities: Partial<T>[] | {
71
+ [name: string]: any;
72
+ }[], { reset, annots, CollectionType, }: {
73
+ reset?: boolean;
74
+ annots?: ODataEntitiesAnnotations<T>;
75
+ CollectionType?: typeof ODataCollection;
76
+ }): ODataCollection<T, ODataModel<T> & ModelInterface<T>>;
47
77
  asCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(entities?: Partial<T>[] | {
48
78
  [name: string]: any;
49
- }[], { annots }?: {
79
+ }[]): C;
80
+ asCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(entities: Partial<T>[] | {
81
+ [name: string]: any;
82
+ }[], { reset, annots, CollectionType, }: {
83
+ reset?: boolean;
50
84
  annots?: ODataEntitiesAnnotations<T>;
85
+ CollectionType?: typeof ODataCollection;
51
86
  }): C;
52
87
  isTypeOf(other: ODataResource<any>): boolean;
53
88
  isSubtypeOf(other: ODataResource<any>): boolean;
@@ -66,8 +101,7 @@ export declare class ODataResource<T> {
66
101
  escape?: boolean;
67
102
  }): string;
68
103
  clone(): ODataResource<T>;
69
- private __serializeParser;
70
- private __deserializeParser;
104
+ private __parser;
71
105
  deserialize(value: any, options?: ParserOptions): any;
72
106
  serialize(value: any, options?: ParserOptions): any;
73
107
  encode(value: any, options?: ParserOptions): any;
@@ -91,6 +125,12 @@ export declare class ODataResource<T> {
91
125
  * @param f Function context for handle the query options
92
126
  */
93
127
  query(f: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): this;
128
+ transform<R>(opts: (builder: ApplyExpressionBuilder<T>, current?: ApplyExpression<T>) => ApplyExpression<T>, { type, fields, }?: {
129
+ type?: string;
130
+ fields?: {
131
+ [name: string]: StructuredTypeFieldConfig;
132
+ };
133
+ }): ODataResource<R>;
94
134
  static resolveKey<T>(value: any, schema?: ODataStructuredType<T>): EntityKey<T> | undefined;
95
135
  protected resolveKey(value: any): EntityKey<T> | undefined;
96
136
  protected get(options?: ODataOptions & {
@@ -1,10 +1,22 @@
1
1
  import { HttpHeaders, HttpResponse } from '@angular/common/http';
2
- import { ODataResource } from '../resource';
3
- import { ODataEntities, ODataEntity, ODataProperty } from './types';
4
- import { ODataApi } from '../../api';
5
- import { ODataRequest } from '../request';
2
+ import { ODataEntityAnnotations, ODataEntitiesAnnotations, ODataPropertyAnnotations } from '../annotations';
3
+ import { ODataResource } from './resource';
4
+ import { ODataApi } from '../api';
5
+ import { ODataRequest } from './request';
6
+ import { ODataContext } from '../helper';
6
7
  import { ODataResponseOptions } from './options';
7
- import { ODataContext } from '../../helper';
8
+ export type ODataEntity<T> = {
9
+ entity: T | null;
10
+ annots: ODataEntityAnnotations<T>;
11
+ };
12
+ export type ODataEntities<T> = {
13
+ entities: T[] | null;
14
+ annots: ODataEntitiesAnnotations<T>;
15
+ };
16
+ export type ODataProperty<T> = {
17
+ property: T | null;
18
+ annots: ODataPropertyAnnotations<T>;
19
+ };
8
20
  /**
9
21
  * OData Response
10
22
  */