angular-odata 0.127.0 → 0.128.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 (274) hide show
  1. package/esm2022/lib/annotations.mjs +140 -0
  2. package/esm2022/lib/api.mjs +209 -164
  3. package/esm2022/lib/cache/cache.mjs +1 -1
  4. package/esm2022/lib/cache/memory.mjs +1 -1
  5. package/esm2022/lib/client.mjs +4 -44
  6. package/esm2022/lib/constants.mjs +4 -1
  7. package/esm2022/lib/index.mjs +3 -1
  8. package/esm2022/lib/loaders.mjs +23 -17
  9. package/esm2022/lib/metadata/csdl/csdl-annotation.mjs +95 -0
  10. package/esm2022/lib/metadata/csdl/csdl-entity-container.mjs +27 -0
  11. package/esm2022/lib/metadata/csdl/csdl-entity-set.mjs +24 -0
  12. package/esm2022/lib/metadata/csdl/csdl-enum-type.mjs +37 -0
  13. package/esm2022/lib/metadata/csdl/csdl-function-action.mjs +94 -0
  14. package/esm2022/lib/metadata/csdl/csdl-navigation-property-binding.mjs +7 -0
  15. package/esm2022/lib/metadata/csdl/csdl-reference.mjs +23 -0
  16. package/esm2022/lib/metadata/csdl/csdl-schema.mjs +39 -0
  17. package/esm2022/lib/metadata/csdl/csdl-singleton.mjs +15 -0
  18. package/esm2022/lib/metadata/csdl/csdl-structural-property.mjs +70 -0
  19. package/esm2022/lib/metadata/csdl/csdl-structured-type.mjs +92 -0
  20. package/esm2022/lib/metadata/csdl/csdl-type-definition.mjs +15 -0
  21. package/esm2022/lib/metadata/index.mjs +3 -0
  22. package/esm2022/lib/metadata/metadata.mjs +14 -0
  23. package/esm2022/lib/metadata/parser.mjs +563 -0
  24. package/esm2022/lib/models/collection.mjs +98 -140
  25. package/esm2022/lib/models/model.mjs +38 -45
  26. package/esm2022/lib/models/options.mjs +127 -117
  27. package/esm2022/lib/module.mjs +3 -3
  28. package/esm2022/lib/resources/index.mjs +2 -2
  29. package/esm2022/lib/resources/options.mjs +56 -0
  30. package/esm2022/lib/resources/path/handlers.mjs +14 -4
  31. package/esm2022/lib/resources/path/segments.mjs +6 -4
  32. package/esm2022/lib/resources/query/builder.mjs +5 -5
  33. package/esm2022/lib/resources/query/expressions/apply.mjs +81 -14
  34. package/esm2022/lib/resources/query/expressions/base.mjs +1 -1
  35. package/esm2022/lib/resources/query/expressions/compute.mjs +1 -1
  36. package/esm2022/lib/resources/query/expressions/count.mjs +1 -1
  37. package/esm2022/lib/resources/query/expressions/expand.mjs +1 -1
  38. package/esm2022/lib/resources/query/expressions/filter.mjs +1 -1
  39. package/esm2022/lib/resources/query/expressions/orderby.mjs +2 -2
  40. package/esm2022/lib/resources/query/expressions/search.mjs +1 -1
  41. package/esm2022/lib/resources/query/expressions/select.mjs +5 -1
  42. package/esm2022/lib/resources/query/expressions/syntax.mjs +18 -7
  43. package/esm2022/lib/resources/query/handlers.mjs +1 -1
  44. package/esm2022/lib/resources/query/options.mjs +1 -1
  45. package/esm2022/lib/resources/request.mjs +5 -5
  46. package/esm2022/lib/resources/resource.mjs +107 -82
  47. package/esm2022/lib/resources/response.mjs +174 -0
  48. package/esm2022/lib/resources/types/action.mjs +29 -26
  49. package/esm2022/lib/resources/types/batch.mjs +1 -1
  50. package/esm2022/lib/resources/types/count.mjs +7 -7
  51. package/esm2022/lib/resources/types/entity-set.mjs +37 -24
  52. package/esm2022/lib/resources/types/entity.mjs +14 -11
  53. package/esm2022/lib/resources/types/function.mjs +25 -28
  54. package/esm2022/lib/resources/types/metadata.mjs +9 -5
  55. package/esm2022/lib/resources/types/navigation-property.mjs +36 -30
  56. package/esm2022/lib/resources/types/property.mjs +31 -49
  57. package/esm2022/lib/resources/types/reference.mjs +3 -4
  58. package/esm2022/lib/resources/types/singleton.mjs +11 -7
  59. package/esm2022/lib/resources/types/value.mjs +16 -12
  60. package/esm2022/lib/schema/callable.mjs +10 -10
  61. package/esm2022/lib/schema/element.mjs +15 -9
  62. package/esm2022/lib/schema/entity-container.mjs +4 -2
  63. package/esm2022/lib/schema/enum-type.mjs +6 -7
  64. package/esm2022/lib/schema/index.mjs +2 -1
  65. package/esm2022/lib/schema/parsers/callable.mjs +10 -7
  66. package/esm2022/lib/schema/parsers/edm.mjs +6 -4
  67. package/esm2022/lib/schema/parsers/enum-type.mjs +10 -10
  68. package/esm2022/lib/schema/parsers/structured-type.mjs +19 -19
  69. package/esm2022/lib/schema/schema.mjs +18 -34
  70. package/esm2022/lib/schema/singleton.mjs +9 -0
  71. package/esm2022/lib/schema/structured-type.mjs +18 -23
  72. package/esm2022/lib/services/base.mjs +1 -1
  73. package/esm2022/lib/services/entity-set.mjs +12 -2
  74. package/esm2022/lib/services/entity.mjs +2 -2
  75. package/esm2022/lib/services/factory.mjs +18 -7
  76. package/esm2022/lib/services/singleton.mjs +8 -2
  77. package/esm2022/lib/settings.mjs +7 -99
  78. package/esm2022/lib/types.mjs +1 -1
  79. package/esm2022/lib/utils/http.mjs +1 -1
  80. package/fesm2022/angular-odata.mjs +2286 -1951
  81. package/fesm2022/angular-odata.mjs.map +1 -1
  82. package/lib/{resources/responses/annotations.d.ts → annotations.d.ts} +2 -2
  83. package/lib/api.d.ts +29 -26
  84. package/lib/cache/memory.d.ts +1 -1
  85. package/lib/client.d.ts +0 -20
  86. package/lib/constants.d.ts +3 -0
  87. package/lib/index.d.ts +1 -0
  88. package/lib/loaders.d.ts +7 -1
  89. package/lib/metadata/csdl/csdl-annotation.d.ts +123 -0
  90. package/lib/metadata/csdl/csdl-entity-container.d.ts +26 -0
  91. package/lib/metadata/csdl/csdl-entity-set.d.ts +20 -0
  92. package/lib/metadata/csdl/csdl-enum-type.d.ts +29 -0
  93. package/lib/metadata/csdl/csdl-function-action.d.ts +105 -0
  94. package/lib/metadata/csdl/csdl-navigation-property-binding.d.ts +8 -0
  95. package/lib/metadata/csdl/csdl-reference.d.ts +30 -0
  96. package/lib/metadata/csdl/csdl-schema.d.ts +34 -0
  97. package/lib/metadata/csdl/csdl-singleton.d.ts +16 -0
  98. package/lib/metadata/csdl/csdl-structural-property.d.ts +70 -0
  99. package/lib/metadata/csdl/csdl-structured-type.d.ts +73 -0
  100. package/lib/metadata/csdl/csdl-type-definition.d.ts +22 -0
  101. package/lib/metadata/index.d.ts +2 -0
  102. package/lib/metadata/metadata.d.ts +10 -0
  103. package/lib/{resources/responses/metadata.d.ts → metadata/parser.d.ts} +19 -7
  104. package/lib/models/collection.d.ts +4 -3
  105. package/lib/models/model.d.ts +15 -23
  106. package/lib/models/options.d.ts +37 -23
  107. package/lib/resources/index.d.ts +1 -1
  108. package/lib/resources/{responses/options.d.ts → options.d.ts} +2 -2
  109. package/lib/resources/path/handlers.d.ts +4 -2
  110. package/lib/resources/path/segments.d.ts +3 -1
  111. package/lib/resources/query/expressions/apply.d.ts +37 -15
  112. package/lib/resources/query/expressions/base.d.ts +1 -1
  113. package/lib/resources/query/expressions/compute.d.ts +2 -2
  114. package/lib/resources/query/expressions/count.d.ts +1 -1
  115. package/lib/resources/query/expressions/expand.d.ts +1 -1
  116. package/lib/resources/query/expressions/filter.d.ts +1 -1
  117. package/lib/resources/query/expressions/orderby.d.ts +5 -4
  118. package/lib/resources/query/expressions/search.d.ts +1 -1
  119. package/lib/resources/query/expressions/select.d.ts +2 -1
  120. package/lib/resources/query/expressions/syntax.d.ts +6 -3
  121. package/lib/resources/resource.d.ts +27 -15
  122. package/lib/resources/{responses/response.d.ts → response.d.ts} +17 -5
  123. package/lib/resources/types/action.d.ts +12 -10
  124. package/lib/resources/types/batch.d.ts +3 -2
  125. package/lib/resources/types/count.d.ts +1 -5
  126. package/lib/resources/types/entity-set.d.ts +13 -6
  127. package/lib/resources/types/entity.d.ts +3 -4
  128. package/lib/resources/types/function.d.ts +11 -11
  129. package/lib/resources/types/metadata.d.ts +1 -1
  130. package/lib/resources/types/navigation-property.d.ts +13 -7
  131. package/lib/resources/types/property.d.ts +15 -8
  132. package/lib/resources/types/reference.d.ts +2 -4
  133. package/lib/resources/types/singleton.d.ts +4 -6
  134. package/lib/resources/types/value.d.ts +2 -6
  135. package/lib/schema/callable.d.ts +5 -7
  136. package/lib/schema/element.d.ts +11 -4
  137. package/lib/schema/entity-container.d.ts +2 -0
  138. package/lib/schema/enum-type.d.ts +4 -7
  139. package/lib/schema/index.d.ts +1 -0
  140. package/lib/schema/parsers/callable.d.ts +7 -8
  141. package/lib/schema/parsers/enum-type.d.ts +2 -4
  142. package/lib/schema/parsers/structured-type.d.ts +6 -8
  143. package/lib/schema/schema.d.ts +6 -9
  144. package/lib/schema/singleton.d.ts +10 -0
  145. package/lib/schema/structured-type.d.ts +5 -8
  146. package/lib/services/entity-set.d.ts +7 -3
  147. package/lib/services/factory.d.ts +14 -2
  148. package/lib/services/singleton.d.ts +4 -2
  149. package/lib/settings.d.ts +0 -10
  150. package/lib/types.d.ts +12 -3
  151. package/package.json +5 -1
  152. package/schematics/apigen/angular/api-config.d.ts +15 -0
  153. package/schematics/apigen/angular/api-config.js +34 -0
  154. package/schematics/apigen/angular/api-config.js.map +1 -0
  155. package/schematics/apigen/angular/base.d.ts +51 -0
  156. package/schematics/apigen/angular/base.js +200 -0
  157. package/schematics/apigen/angular/base.js.map +1 -0
  158. package/schematics/apigen/angular/entity.d.ts +24 -0
  159. package/schematics/apigen/angular/entity.js +71 -0
  160. package/schematics/apigen/angular/entity.js.map +1 -0
  161. package/schematics/apigen/angular/enum.d.ts +25 -0
  162. package/schematics/apigen/angular/enum.js +56 -0
  163. package/schematics/apigen/angular/enum.js.map +1 -0
  164. package/schematics/apigen/angular/import.d.ts +6 -0
  165. package/schematics/apigen/angular/import.js +18 -0
  166. package/schematics/apigen/angular/import.js.map +1 -0
  167. package/schematics/apigen/angular/module.d.ts +18 -0
  168. package/schematics/apigen/angular/module.js +41 -0
  169. package/schematics/apigen/angular/module.js.map +1 -0
  170. package/schematics/apigen/angular/service.d.ts +20 -0
  171. package/schematics/apigen/angular/service.js +76 -0
  172. package/schematics/apigen/angular/service.js.map +1 -0
  173. package/schematics/apigen/files/api-config/__fileName__.ts +9 -0
  174. package/schematics/apigen/files/entity/__fileName__.ts +7 -0
  175. package/schematics/apigen/files/entitycontainer-service/__fileName__.ts +18 -0
  176. package/schematics/apigen/files/entityset-service/__fileName__.ts +27 -0
  177. package/schematics/apigen/files/enum/__fileName__.ts +4 -0
  178. package/schematics/apigen/files/index/__fileName__.ts +2 -0
  179. package/schematics/apigen/files/module/__fileName__.ts +9 -0
  180. package/schematics/apigen/files/singleton-service/__fileName__.ts +18 -0
  181. package/schematics/apigen/index.d.ts +3 -0
  182. package/schematics/apigen/index.js +106 -0
  183. package/schematics/apigen/index.js.map +1 -0
  184. package/schematics/apigen/metadata/csdl/csdl-annotation.d.ts +120 -0
  185. package/schematics/apigen/metadata/csdl/csdl-annotation.js +98 -0
  186. package/schematics/apigen/metadata/csdl/csdl-annotation.js.map +1 -0
  187. package/schematics/apigen/metadata/csdl/csdl-entity-container.d.ts +26 -0
  188. package/schematics/apigen/metadata/csdl/csdl-entity-container.js +30 -0
  189. package/schematics/apigen/metadata/csdl/csdl-entity-container.js.map +1 -0
  190. package/schematics/apigen/metadata/csdl/csdl-entity-set.d.ts +20 -0
  191. package/schematics/apigen/metadata/csdl/csdl-entity-set.js +26 -0
  192. package/schematics/apigen/metadata/csdl/csdl-entity-set.js.map +1 -0
  193. package/schematics/apigen/metadata/csdl/csdl-enum-type.d.ts +28 -0
  194. package/schematics/apigen/metadata/csdl/csdl-enum-type.js +33 -0
  195. package/schematics/apigen/metadata/csdl/csdl-enum-type.js.map +1 -0
  196. package/schematics/apigen/metadata/csdl/csdl-function-action.d.ts +103 -0
  197. package/schematics/apigen/metadata/csdl/csdl-function-action.js +84 -0
  198. package/schematics/apigen/metadata/csdl/csdl-function-action.js.map +1 -0
  199. package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.d.ts +8 -0
  200. package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.js +11 -0
  201. package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.js.map +1 -0
  202. package/schematics/apigen/metadata/csdl/csdl-reference.d.ts +30 -0
  203. package/schematics/apigen/metadata/csdl/csdl-reference.js +29 -0
  204. package/schematics/apigen/metadata/csdl/csdl-reference.js.map +1 -0
  205. package/schematics/apigen/metadata/csdl/csdl-schema.d.ts +32 -0
  206. package/schematics/apigen/metadata/csdl/csdl-schema.js +26 -0
  207. package/schematics/apigen/metadata/csdl/csdl-schema.js.map +1 -0
  208. package/schematics/apigen/metadata/csdl/csdl-singleton.d.ts +18 -0
  209. package/schematics/apigen/metadata/csdl/csdl-singleton.js +25 -0
  210. package/schematics/apigen/metadata/csdl/csdl-singleton.js.map +1 -0
  211. package/schematics/apigen/metadata/csdl/csdl-structural-property.d.ts +63 -0
  212. package/schematics/apigen/metadata/csdl/csdl-structural-property.js +50 -0
  213. package/schematics/apigen/metadata/csdl/csdl-structural-property.js.map +1 -0
  214. package/schematics/apigen/metadata/csdl/csdl-structured-type.d.ts +64 -0
  215. package/schematics/apigen/metadata/csdl/csdl-structured-type.js +71 -0
  216. package/schematics/apigen/metadata/csdl/csdl-structured-type.js.map +1 -0
  217. package/schematics/apigen/metadata/csdl/csdl-type-definition.d.ts +22 -0
  218. package/schematics/apigen/metadata/csdl/csdl-type-definition.js +19 -0
  219. package/schematics/apigen/metadata/csdl/csdl-type-definition.js.map +1 -0
  220. package/schematics/apigen/metadata/index.d.ts +1 -0
  221. package/schematics/apigen/metadata/index.js +18 -0
  222. package/schematics/apigen/metadata/index.js.map +1 -0
  223. package/schematics/apigen/metadata/metadata.d.ts +11 -0
  224. package/schematics/apigen/metadata/metadata.js +30 -0
  225. package/schematics/apigen/metadata/metadata.js.map +1 -0
  226. package/schematics/apigen/metadata/parser.d.ts +110 -0
  227. package/schematics/apigen/metadata/parser.js +568 -0
  228. package/schematics/apigen/metadata/parser.js.map +1 -0
  229. package/schematics/apigen/schema.d.ts +8 -0
  230. package/schematics/apigen/schema.js +3 -0
  231. package/schematics/apigen/schema.js.map +1 -0
  232. package/schematics/apigen/schema.json +36 -0
  233. package/schematics/apigen/utils.d.ts +1 -0
  234. package/schematics/apigen/utils.js +75 -0
  235. package/schematics/apigen/utils.js.map +1 -0
  236. package/schematics/collection.json +14 -0
  237. package/schematics/ng-add/index.d.ts +2 -0
  238. package/schematics/ng-add/index.js +13 -0
  239. package/schematics/ng-add/index.js.map +1 -0
  240. package/schematics/random.d.ts +1 -0
  241. package/schematics/random.js +604 -0
  242. package/schematics/random.js.map +1 -0
  243. package/esm2022/lib/resources/responses/annotations.mjs +0 -140
  244. package/esm2022/lib/resources/responses/csdl/csdl-annotation.mjs +0 -33
  245. package/esm2022/lib/resources/responses/csdl/csdl-entity-container.mjs +0 -11
  246. package/esm2022/lib/resources/responses/csdl/csdl-entity-set.mjs +0 -9
  247. package/esm2022/lib/resources/responses/csdl/csdl-enum-type.mjs +0 -15
  248. package/esm2022/lib/resources/responses/csdl/csdl-function-action.mjs +0 -56
  249. package/esm2022/lib/resources/responses/csdl/csdl-navigation-property-binding.mjs +0 -7
  250. package/esm2022/lib/resources/responses/csdl/csdl-reference.mjs +0 -23
  251. package/esm2022/lib/resources/responses/csdl/csdl-schema.mjs +0 -18
  252. package/esm2022/lib/resources/responses/csdl/csdl-singleton.mjs +0 -8
  253. package/esm2022/lib/resources/responses/csdl/csdl-structural-property.mjs +0 -39
  254. package/esm2022/lib/resources/responses/csdl/csdl-structured-type.mjs +0 -34
  255. package/esm2022/lib/resources/responses/csdl/csdl-type-definition.mjs +0 -14
  256. package/esm2022/lib/resources/responses/index.mjs +0 -5
  257. package/esm2022/lib/resources/responses/metadata.mjs +0 -547
  258. package/esm2022/lib/resources/responses/options.mjs +0 -56
  259. package/esm2022/lib/resources/responses/response.mjs +0 -174
  260. package/esm2022/lib/resources/responses/types.mjs +0 -2
  261. package/lib/resources/responses/csdl/csdl-annotation.d.ts +0 -27
  262. package/lib/resources/responses/csdl/csdl-entity-container.d.ts +0 -12
  263. package/lib/resources/responses/csdl/csdl-entity-set.d.ts +0 -8
  264. package/lib/resources/responses/csdl/csdl-enum-type.d.ts +0 -12
  265. package/lib/resources/responses/csdl/csdl-function-action.d.ts +0 -49
  266. package/lib/resources/responses/csdl/csdl-navigation-property-binding.d.ts +0 -5
  267. package/lib/resources/responses/csdl/csdl-reference.d.ts +0 -18
  268. package/lib/resources/responses/csdl/csdl-schema.d.ts +0 -20
  269. package/lib/resources/responses/csdl/csdl-singleton.d.ts +0 -7
  270. package/lib/resources/responses/csdl/csdl-structural-property.d.ts +0 -31
  271. package/lib/resources/responses/csdl/csdl-structured-type.d.ts +0 -27
  272. package/lib/resources/responses/csdl/csdl-type-definition.d.ts +0 -11
  273. package/lib/resources/responses/index.d.ts +0 -4
  274. package/lib/resources/responses/types.d.ts +0 -13
@@ -1,4 +1,4 @@
1
- import { AnnotationConfig } from '../types';
1
+ import { AnnotationConfig, Parser } from '../types';
2
2
  import { ODataAnnotatable } from './annotation';
3
3
  import { ODataSchema } from './schema';
4
4
  export declare class ODataSchemaElement extends ODataAnnotatable {
@@ -29,17 +29,24 @@ export declare class ODataSchemaElement extends ODataAnnotatable {
29
29
  * @param type String representation of the type
30
30
  * @returns True if the callable is type of the given type
31
31
  */
32
- isTypeOf(type: string): boolean;
32
+ isTypeOf(element: ODataSchemaElement): boolean;
33
33
  /**
34
34
  * Returns a boolean indicating if the structured type is a subtype of the given type.
35
35
  * @param type String representation of the type
36
36
  * @returns True if the callable is type of the given type
37
37
  */
38
- isSubtypeOf(schema: ODataSchemaElement): boolean;
38
+ isSubtypeOf(element: ODataSchemaElement): boolean;
39
39
  /**
40
40
  * Returns a boolean indicating if the structured type is a supertype of the given type.
41
41
  * @param type String representation of the type
42
42
  * @returns True if the callable is type of the given type
43
43
  */
44
- isSupertypeOf(schema: ODataSchemaElement): boolean;
44
+ isSupertypeOf(element: ODataSchemaElement): boolean;
45
+ }
46
+ export declare class ODataParserSchemaElement<E, P extends Parser<E>> extends ODataSchemaElement {
47
+ parser: P;
48
+ constructor(config: {
49
+ annotations?: AnnotationConfig[];
50
+ name: string;
51
+ }, schema: ODataSchema, parser: P);
45
52
  }
@@ -2,7 +2,9 @@ import { EntityContainerConfig } from '../types';
2
2
  import { ODataSchemaElement } from './element';
3
3
  import { ODataEntitySet } from './entity-set';
4
4
  import { ODataSchema } from './schema';
5
+ import { ODataSingleton } from './singleton';
5
6
  export declare class ODataEntityContainer extends ODataSchemaElement {
6
7
  entitySets: ODataEntitySet[];
8
+ singletons: ODataSingleton[];
7
9
  constructor(config: EntityContainerConfig, schema: ODataSchema);
8
10
  }
@@ -1,19 +1,16 @@
1
- import { EnumTypeConfig, Parser, ParserOptions } from '../types';
2
- import { ODataSchemaElement } from './element';
1
+ import { EnumTypeConfig, ParserOptions } from '../types';
2
+ import { ODataParserSchemaElement } from './element';
3
3
  import { ODataEnumTypeFieldParser, ODataEnumTypeParser } from './parsers';
4
4
  import { ODataSchema } from './schema';
5
- export declare class ODataEnumType<E> extends ODataSchemaElement {
6
- parser: ODataEnumTypeParser<E>;
5
+ export declare class ODataEnumType<E> extends ODataParserSchemaElement<E, ODataEnumTypeParser<E>> {
7
6
  members: {
8
7
  [name: string]: E;
9
8
  } | {
10
9
  [value: number]: string;
11
10
  };
12
11
  constructor(config: EnumTypeConfig<E>, schema: ODataSchema);
13
- configure({ options, parserForType, findOptionsForType, }: {
12
+ configure({ options }: {
14
13
  options: ParserOptions;
15
- parserForType: (type: string) => Parser<any>;
16
- findOptionsForType: (type: string) => any;
17
14
  }): void;
18
15
  /**
19
16
  * Returns the fields of the enum type.
@@ -4,4 +4,5 @@ export * from './callable';
4
4
  export * from './enum-type';
5
5
  export * from './structured-type';
6
6
  export * from './entity-set';
7
+ export * from './singleton';
7
8
  export * from './parsers';
@@ -1,4 +1,4 @@
1
- import { CallableConfig, ParserOptions, Parameter, Parser } from '../../types';
1
+ import { CallableConfig, ParserOptions, ParameterConfig, Parser } from '../../types';
2
2
  import { ODataEnumTypeParser } from './enum-type';
3
3
  import { ODataStructuredTypeParser } from './structured-type';
4
4
  export declare class ODataParameterParser<T> {
@@ -8,19 +8,18 @@ export declare class ODataParameterParser<T> {
8
8
  collection?: boolean;
9
9
  nullable?: boolean;
10
10
  parserOptions?: ParserOptions;
11
- constructor(name: string, parameter: Parameter);
11
+ constructor(name: string, parameter: ParameterConfig);
12
12
  serialize(value: T, options?: ParserOptions): any;
13
13
  encode(value: any, options?: ParserOptions): string;
14
- configure({ options, parserForType, findOptionsForType, }: {
14
+ configure({ options, parserForType, }: {
15
15
  options: ParserOptions;
16
16
  parserForType: (type: string) => Parser<any>;
17
- findOptionsForType: (type: string) => any;
18
17
  }): void;
19
18
  isEdmType(): boolean;
20
19
  isEnumType(): boolean;
21
- enum(): ODataEnumTypeParser<T>;
20
+ enumType(): ODataEnumTypeParser<T>;
22
21
  isStructuredType(): boolean;
23
- structured(): ODataStructuredTypeParser<T>;
22
+ structuredType(): ODataStructuredTypeParser<T>;
24
23
  field<F>(name: string): import("./structured-type").ODataStructuredTypeFieldParser<F>;
25
24
  }
26
25
  export declare class ODataCallableParser<R> implements Parser<R> {
@@ -39,10 +38,10 @@ export declare class ODataCallableParser<R> implements Parser<R> {
39
38
  deserialize(value: any, options?: ParserOptions): R;
40
39
  serialize(params: any, options?: ParserOptions): any;
41
40
  encode(params: any, options?: ParserOptions): any;
42
- configure({ options, parserForType, findOptionsForType, }: {
41
+ configure({ options, parserForType, }: {
43
42
  options: ParserOptions;
44
43
  parserForType: (type: string) => Parser<any>;
45
- findOptionsForType: (type: string) => any;
46
44
  }): void;
47
45
  binding(): ODataParameterParser<any> | undefined;
46
+ returnType(): string | undefined;
48
47
  }
@@ -1,4 +1,4 @@
1
- import { EnumTypeConfig, EnumTypeFieldConfig, ParserOptions, Parser, FieldParser, JsonType } from '../../types';
1
+ import { EnumTypeConfig, EnumTypeFieldConfig, ParserOptions, FieldParser, JsonType } from '../../types';
2
2
  import { ODataAnnotatable } from '../annotation';
3
3
  export declare class ODataEnumTypeFieldParser<E> extends ODataAnnotatable {
4
4
  name: string;
@@ -19,10 +19,8 @@ export declare class ODataEnumTypeParser<E> extends ODataAnnotatable implements
19
19
  private _fields;
20
20
  parserOptions?: ParserOptions;
21
21
  constructor(config: EnumTypeConfig<E>, namespace: string, alias?: string);
22
- configure({ options, parserForType, findOptionsForType, }: {
22
+ configure({ options }: {
23
23
  options: ParserOptions;
24
- parserForType: (type: string) => Parser<any>;
25
- findOptionsForType: (type: string) => any;
26
24
  }): void;
27
25
  isTypeOf(type: string): boolean;
28
26
  fields(value?: E): ODataEnumTypeFieldParser<E>[];
@@ -35,7 +35,7 @@ export declare class ODataReferential {
35
35
  }
36
36
  export declare class ODataStructuredTypeFieldParser<T> extends ODataAnnotatable implements FieldParser<T> {
37
37
  name: string;
38
- private structuredType;
38
+ private structured;
39
39
  type: string | EdmType;
40
40
  private parser;
41
41
  collection: boolean;
@@ -47,7 +47,7 @@ export declare class ODataStructuredTypeFieldParser<T> extends ODataAnnotatable
47
47
  scale?: number | 'variable';
48
48
  referentials: ODataReferential[];
49
49
  parserOptions?: ParserOptions;
50
- constructor(name: string, structuredType: ODataStructuredTypeParser<any>, field: StructuredTypeFieldConfig);
50
+ constructor(name: string, structured: ODataStructuredTypeParser<any>, field: StructuredTypeFieldConfig);
51
51
  validate(value: any, { method, navigation, }?: {
52
52
  method?: 'create' | 'update' | 'modify';
53
53
  navigation?: boolean;
@@ -61,19 +61,18 @@ export declare class ODataStructuredTypeFieldParser<T> extends ODataAnnotatable
61
61
  private toJson;
62
62
  serialize(value: T, options?: ParserOptions): any;
63
63
  encode(value: T, options?: ParserOptions): string;
64
- configure({ options, parserForType, findOptionsForType, }: {
64
+ configure({ options, parserForType, }: {
65
65
  options: ParserOptions;
66
66
  parserForType: (type: string) => Parser<any>;
67
- findOptionsForType: (type: string) => any;
68
67
  }): void;
69
68
  toJsonSchema(options?: JsonSchemaOptions<T>): any;
70
69
  isKey(): boolean;
71
70
  hasReferentials(): boolean;
72
71
  isEdmType(): boolean;
73
72
  isEnumType(): boolean;
74
- enum(): ODataEnumTypeParser<T>;
73
+ enumType(): ODataEnumTypeParser<T>;
75
74
  isStructuredType(): boolean;
76
- structured(): ODataStructuredTypeParser<T>;
75
+ structuredType(): ODataStructuredTypeParser<T>;
77
76
  field<F>(name: string): ODataStructuredTypeFieldParser<F>;
78
77
  }
79
78
  export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable implements Parser<T> {
@@ -105,10 +104,9 @@ export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable imple
105
104
  deserialize(value: any, options?: ParserOptions): T;
106
105
  serialize(value: Partial<T>, options?: ParserOptions): any;
107
106
  encode(value: T, options?: ParserOptions): any;
108
- configure({ options, parserForType, findOptionsForType, }: {
107
+ configure({ options, parserForType, }: {
109
108
  options: ParserOptions;
110
109
  parserForType: (type: string) => Parser<any>;
111
- findOptionsForType: (type: string) => any;
112
110
  }): void;
113
111
  /**
114
112
  * Returns all fields of the structured type.
@@ -1,10 +1,11 @@
1
1
  import { ODataApi } from '../api';
2
- import { Parser, ParserOptions, SchemaConfig } from '../types';
2
+ import { ParserOptions, SchemaConfig, StructuredTypeConfig } from '../types';
3
3
  import { ODataAnnotatable } from './annotation';
4
4
  import { ODataCallable } from './callable';
5
5
  import { ODataEntityContainer } from './entity-container';
6
6
  import { ODataEntitySet } from './entity-set';
7
7
  import { ODataEnumType } from './enum-type';
8
+ import { ODataSingleton } from './singleton';
8
9
  import { ODataStructuredType } from './structured-type';
9
10
  export declare class ODataSchema extends ODataAnnotatable {
10
11
  api: ODataApi;
@@ -15,15 +16,11 @@ export declare class ODataSchema extends ODataAnnotatable {
15
16
  callables: ODataCallable<any>[];
16
17
  containers: ODataEntityContainer[];
17
18
  constructor(config: SchemaConfig, api: ODataApi);
18
- isNamespaceOf(type: string): boolean | "" | undefined;
19
+ isNamespaceOf(type: string): boolean;
19
20
  get entitySets(): ODataEntitySet[];
20
- findEnumTypeForType<T>(type: string): ODataEnumType<T> | undefined;
21
- findStructuredTypeForType<T>(type: string): ODataStructuredType<T> | undefined;
22
- findCallableForType<T>(type: string, bindingType?: string): ODataCallable<T> | undefined;
23
- findEntitySetForType(type: string): ODataEntitySet | undefined;
24
- configure({ options, parserForType, findOptionsForType, }: {
21
+ get singletons(): ODataSingleton[];
22
+ createStructuredType<T>(config: StructuredTypeConfig<T>): ODataStructuredType<T>;
23
+ configure({ options }: {
25
24
  options: ParserOptions;
26
- parserForType: (type: string) => Parser<any>;
27
- findOptionsForType: (type: string) => any;
28
25
  }): void;
29
26
  }
@@ -0,0 +1,10 @@
1
+ import { SingletonConfig } from '../types';
2
+ import { ODataSchemaElement } from './element';
3
+ import { ODataSchema } from './schema';
4
+ export declare class ODataSingleton extends ODataSchemaElement {
5
+ singletonType: string;
6
+ service: {
7
+ new (...params: any[]): any;
8
+ };
9
+ constructor(config: SingletonConfig, schema: ODataSchema);
10
+ }
@@ -1,21 +1,18 @@
1
- import { ODataCollection } from '../models';
1
+ import { ODataCollection } from '../models/collection';
2
2
  import { ODataModel } from '../models/model';
3
- import { Parser, ParserOptions, StructuredTypeConfig, StructuredTypeFieldConfig } from '../types';
4
- import { ODataSchemaElement } from './element';
3
+ import { ParserOptions, StructuredTypeConfig, StructuredTypeFieldConfig } from '../types';
4
+ import { ODataParserSchemaElement } from './element';
5
5
  import { JsonSchemaOptions, ODataEntityTypeKey, ODataStructuredTypeFieldParser, ODataStructuredTypeParser } from './parsers';
6
6
  import { ODataSchema } from './schema';
7
- export declare class ODataStructuredType<T> extends ODataSchemaElement {
7
+ export declare class ODataStructuredType<T> extends ODataParserSchemaElement<T, ODataStructuredTypeParser<T>> {
8
8
  base?: string;
9
9
  parent?: ODataStructuredType<any>;
10
10
  children: ODataStructuredType<any>[];
11
11
  model?: typeof ODataModel;
12
12
  collection?: typeof ODataCollection;
13
- parser: ODataStructuredTypeParser<T>;
14
13
  constructor(config: StructuredTypeConfig<T>, schema: ODataSchema);
15
- configure({ options, parserForType, findOptionsForType, }: {
14
+ configure({ options }: {
16
15
  options: ParserOptions;
17
- parserForType: (type: string) => Parser<any>;
18
- findOptionsForType: (type: string) => any;
19
16
  }): void;
20
17
  /**
21
18
  * Returns a boolean indicating if the structured type is a subtype of the given type.
@@ -4,6 +4,10 @@ import { ODataModel } from '../models/model';
4
4
  import { EntityKey, ODataEntity, ODataEntityResource, ODataEntitySetResource, ODataOptions } from '../resources';
5
5
  import { ODataEntityService } from './entity';
6
6
  export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
7
+ static Model?: typeof ODataModel;
8
+ static Collection?: typeof ODataCollection;
9
+ model(entity?: Partial<T>): ODataModel<T>;
10
+ collection(entities?: Partial<T>[]): ODataCollection<T, ODataModel<T>>;
7
11
  /**
8
12
  * Get the entity set resource for this service.
9
13
  */
@@ -29,7 +33,7 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
29
33
  */
30
34
  fetchAll(options?: ODataOptions): Observable<{
31
35
  entities: T[];
32
- annots: import("../resources").ODataEntitiesAnnotations<T>;
36
+ annots: import("../annotations").ODataEntitiesAnnotations<T>;
33
37
  }>;
34
38
  /**
35
39
  * Get entities from the entity set.
@@ -40,7 +44,7 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
40
44
  withCount?: boolean;
41
45
  }): Observable<{
42
46
  entities: T[];
43
- annots: import("../resources").ODataEntitiesAnnotations<T>;
47
+ annots: import("../annotations").ODataEntitiesAnnotations<T>;
44
48
  }>;
45
49
  /**
46
50
  * Get an entity from the entity set.
@@ -52,7 +56,7 @@ export declare class ODataEntitySetService<T> extends ODataEntityService<T> {
52
56
  etag?: string;
53
57
  }): Observable<{
54
58
  entity: T | null;
55
- annots: import("../resources").ODataEntitiesAnnotations<T>;
59
+ annots: import("../annotations").ODataEntitiesAnnotations<T>;
56
60
  }>;
57
61
  /**
58
62
  * Create an entity in the entity set.
@@ -1,6 +1,7 @@
1
1
  import { ODataClient } from '../client';
2
2
  import { ODataEntitySetService } from './entity-set';
3
3
  import { ODataSingletonService } from './singleton';
4
+ import { ODataCollection, ODataModel } from '../models';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare class ODataServiceFactory {
6
7
  protected client: ODataClient;
@@ -10,12 +11,23 @@ export declare class ODataServiceFactory {
10
11
  * @param entitySetName Name of the entity set.
11
12
  * @param apiNameOrEntityType Name of the API or the type of the entity.
12
13
  */
13
- entitySet<T>(entitySetName: string, apiNameOrEntityType?: string): ODataEntitySetService<T>;
14
+ entitySet<T>(entitySetName: string, apiNameOrEntityType?: string, options?: {
15
+ Model?: {
16
+ new (...params: any[]): ODataModel<T>;
17
+ };
18
+ Collection?: {
19
+ new (...params: any[]): ODataCollection<T, ODataModel<T>>;
20
+ };
21
+ }): ODataEntitySetService<T>;
14
22
  /** Factory method to create a singleton service.
15
23
  * @param singletonName Name of the singleton.
16
24
  * @param apiNameOrEntityType Name of the API or the type of the entity.
17
25
  */
18
- singleton<T>(singletonName: string, apiNameOrEntityType?: string): ODataSingletonService<T>;
26
+ singleton<T>(singletonName: string, apiNameOrEntityType?: string, options?: {
27
+ Model?: {
28
+ new (...params: any[]): ODataModel<T>;
29
+ };
30
+ }): ODataSingletonService<T>;
19
31
  static ɵfac: i0.ɵɵFactoryDeclaration<ODataServiceFactory, never>;
20
32
  static ɵprov: i0.ɵɵInjectableDeclaration<ODataServiceFactory>;
21
33
  }
@@ -1,12 +1,14 @@
1
1
  import { Observable } from 'rxjs';
2
- import type { ODataModel } from '../models/model';
3
- import type { ODataEntity, ODataOptions, ODataSingletonResource } from '../resources';
2
+ import { ODataModel } from '../models/model';
3
+ import { ODataEntity, ODataOptions, ODataSingletonResource } from '../resources';
4
4
  import { ODataEntityService } from './entity';
5
5
  /**
6
6
  * OData Singleton Service
7
7
  * www.odata.org/getting-started/advanced-tutorial/#singleton
8
8
  */
9
9
  export declare class ODataSingletonService<T> extends ODataEntityService<T> {
10
+ static Model?: typeof ODataModel;
11
+ model(entity?: Partial<T>): ODataModel<T>;
10
12
  /**
11
13
  * Get the entity resource for this service.
12
14
  * @param key The entity key.
package/lib/settings.d.ts CHANGED
@@ -3,7 +3,6 @@ import { ODataApi } from './api';
3
3
  import { ODataCollection, ODataModel } from './models';
4
4
  import { ODataRequest } from './resources';
5
5
  import { ODataCallable, ODataEntitySet, ODataEnumType, ODataStructuredType } from './schema';
6
- import { ODataEntityService } from './services/entity';
7
6
  import { ApiConfig, EdmType, Parser } from './types';
8
7
  export declare class ODataSettings {
9
8
  apis: ODataApi[];
@@ -24,13 +23,4 @@ export declare class ODataSettings {
24
23
  parserForType<T>(type: string | EdmType): Parser<T>;
25
24
  modelForType(type: string): typeof ODataModel;
26
25
  collectionForType(type: string): typeof ODataCollection;
27
- serviceForType(type: string): typeof ODataEntityService;
28
- serviceForEntityType(type: string): typeof ODataEntityService;
29
- enumTypeByName<T>(name: string): ODataEnumType<T>;
30
- structuredTypeByName<T>(name: string): ODataStructuredType<T>;
31
- callableByName<T>(name: string, bindingType?: string): ODataCallable<T>;
32
- entitySetByName(name: string): ODataEntitySet;
33
- modelByName(name: string): typeof ODataModel;
34
- collectionByName(name: string): typeof ODataCollection;
35
- serviceByName(name: string): typeof ODataEntityService;
36
26
  }
package/lib/types.d.ts CHANGED
@@ -180,6 +180,7 @@ export type EntityContainerConfig = {
180
180
  name: string;
181
181
  annotations?: AnnotationConfig[];
182
182
  entitySets?: EntitySetConfig[];
183
+ singletons?: SingletonConfig[];
183
184
  };
184
185
  export type EnumTypeFieldConfig<E> = {
185
186
  value: E;
@@ -231,11 +232,11 @@ export type StructuredTypeConfig<T> = {
231
232
  name: string;
232
233
  alias?: string;
233
234
  }[];
234
- fields: {
235
+ fields?: {
235
236
  [P in keyof T]?: StructuredTypeFieldConfig;
236
237
  };
237
238
  };
238
- export type Parameter = {
239
+ export type ParameterConfig = {
239
240
  type: string;
240
241
  nullable?: boolean;
241
242
  collection?: boolean;
@@ -246,7 +247,7 @@ export type CallableConfig = {
246
247
  bound?: boolean;
247
248
  composable?: boolean;
248
249
  parameters?: {
249
- [name: string]: Parameter;
250
+ [name: string]: ParameterConfig;
250
251
  };
251
252
  return?: {
252
253
  type: string;
@@ -261,3 +262,11 @@ export type EntitySetConfig = {
261
262
  };
262
263
  annotations?: AnnotationConfig[];
263
264
  };
265
+ export type SingletonConfig = {
266
+ name: string;
267
+ type: string;
268
+ service: {
269
+ new (...params: any[]): any;
270
+ };
271
+ annotations?: AnnotationConfig[];
272
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-odata",
3
- "version": "0.127.0",
3
+ "version": "0.128.0",
4
4
  "license": "MIT",
5
5
  "description": "Client side OData typescript library for Angular",
6
6
  "repository": {
@@ -28,6 +28,10 @@
28
28
  "@angular/common": ">=14.0.0",
29
29
  "@angular/core": ">=14.0.0"
30
30
  },
31
+ "schematics": "./schematics/collection.json",
32
+ "ng-add": {
33
+ "save": "dependencies"
34
+ },
31
35
  "dependencies": {
32
36
  "tslib": "^2.3.0"
33
37
  },
@@ -0,0 +1,15 @@
1
+ import { Base } from './base';
2
+ import { Source } from '@angular-devkit/schematics';
3
+ import { Schema as ApiGenSchema } from '../schema';
4
+ export declare class ApiConfig extends Base {
5
+ constructor(options: ApiGenSchema);
6
+ template(): Source;
7
+ variables(): {
8
+ [name: string]: any;
9
+ };
10
+ name(): string;
11
+ fileName(): string;
12
+ directory(): string;
13
+ fullName(): string;
14
+ importTypes(): string[];
15
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiConfig = void 0;
4
+ const core_1 = require("@angular-devkit/core");
5
+ const base_1 = require("./base");
6
+ const schematics_1 = require("@angular-devkit/schematics");
7
+ class ApiConfig extends base_1.Base {
8
+ constructor(options) {
9
+ super(options);
10
+ }
11
+ template() {
12
+ return (0, schematics_1.url)('./files/api-config');
13
+ }
14
+ variables() {
15
+ return Object.assign({}, this.options);
16
+ }
17
+ name() {
18
+ return core_1.strings.classify(this.options.name) + 'Config';
19
+ }
20
+ fileName() {
21
+ return core_1.strings.dasherize(this.options.name) + '.config';
22
+ }
23
+ directory() {
24
+ return '';
25
+ }
26
+ fullName() {
27
+ return this.name();
28
+ }
29
+ importTypes() {
30
+ return [];
31
+ }
32
+ }
33
+ exports.ApiConfig = ApiConfig;
34
+ //# sourceMappingURL=api-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-config.js","sourceRoot":"","sources":["../../../../../projects/angular-odata/schematics/apigen/angular/api-config.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,iCAA8B;AAC9B,2DAAyD;AAGzD,MAAa,SAAU,SAAQ,WAAI;IACjC,YAAY,OAAqB;QAC/B,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IACe,QAAQ;QACtB,OAAO,IAAA,gBAAG,EAAC,oBAAoB,CAAC,CAAC;IACnC,CAAC;IACe,SAAS;QACvB,yBAAY,IAAI,CAAC,OAAO,EAAG;IAC7B,CAAC;IACe,IAAI;QAClB,OAAO,cAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IACxD,CAAC;IACe,QAAQ;QACtB,OAAO,cAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IAC1D,CAAC;IACe,SAAS;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IACe,QAAQ;QACtB,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IACe,WAAW;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAzBD,8BAyBC"}
@@ -0,0 +1,51 @@
1
+ import { Import } from './import';
2
+ import { Source } from '@angular-devkit/schematics';
3
+ import { Schema as ApiGenSchema } from '../schema';
4
+ import { CsdlCallable, CsdlParameter } from '../metadata/csdl/csdl-function-action';
5
+ export declare class Callable {
6
+ protected callable: CsdlCallable;
7
+ constructor(callable: CsdlCallable);
8
+ name(): string;
9
+ isBound(): boolean | undefined;
10
+ bindingParameter(): CsdlParameter | undefined;
11
+ parameters(): CsdlParameter[];
12
+ returnType(): import("../metadata/csdl/csdl-function-action").CsdlReturnType | undefined;
13
+ fullName(): string;
14
+ resourceFunction(): string;
15
+ callableFunction(): string;
16
+ }
17
+ export declare abstract class Base {
18
+ protected options: ApiGenSchema;
19
+ constructor(options: ApiGenSchema);
20
+ abstract name(): string;
21
+ abstract fileName(): string;
22
+ abstract fullName(): string;
23
+ abstract directory(): string;
24
+ abstract importTypes(): string[];
25
+ abstract template(): Source;
26
+ abstract variables(): {
27
+ [name: string]: any;
28
+ };
29
+ path(): string;
30
+ imports(): Import[];
31
+ importedName?: string;
32
+ cleanImportedNames(): void;
33
+ protected dependencies: [string, Base][];
34
+ addDependency(renderable: Base): void;
35
+ addDependencies(renderables: Base[]): void;
36
+ protected callables: Callable[];
37
+ addCallable(callable: Callable): void;
38
+ addCallables(callables: Callable[]): void;
39
+ }
40
+ export declare class Index extends Base {
41
+ constructor(options: ApiGenSchema);
42
+ template(): Source;
43
+ variables(): {
44
+ [name: string]: any;
45
+ };
46
+ name(): string;
47
+ fileName(): string;
48
+ directory(): string;
49
+ fullName(): string;
50
+ importTypes(): string[];
51
+ }