breeze-client 2.1.5 → 2.1.6-mjs

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 (384) hide show
  1. package/adapter-ajax-angularjs/{breeze-client-adapter-ajax-angularjs.d.ts → index.d.ts} +1 -0
  2. package/adapter-ajax-fetch/{breeze-client-adapter-ajax-fetch.d.ts → index.d.ts} +1 -0
  3. package/adapter-ajax-httpclient/{breeze-client-adapter-ajax-httpclient.d.ts → index.d.ts} +1 -0
  4. package/adapter-ajax-jquery/{breeze-client-adapter-ajax-jquery.d.ts → index.d.ts} +1 -0
  5. package/adapter-ajax-post/{breeze-client-adapter-ajax-post.d.ts → index.d.ts} +1 -0
  6. package/adapter-data-service-odata/adapter-data-service-odata.d.ts +0 -1
  7. package/adapter-data-service-odata/{breeze-client-adapter-data-service-odata.d.ts → index.d.ts} +1 -0
  8. package/adapter-data-service-webapi/{breeze-client-adapter-data-service-webapi.d.ts → index.d.ts} +1 -0
  9. package/adapter-model-library-backing-store/{breeze-client-adapter-model-library-backing-store.d.ts → index.d.ts} +1 -0
  10. package/adapter-model-library-ko/{breeze-client-adapter-model-library-ko.d.ts → index.d.ts} +1 -0
  11. package/adapter-uri-builder-json/{breeze-client-adapter-uri-builder-json.d.ts → index.d.ts} +1 -0
  12. package/adapter-uri-builder-odata/{breeze-client-adapter-uri-builder-odata.d.ts → index.d.ts} +1 -0
  13. package/esm2022/adapter-ajax-angularjs/adapter-ajax-angularjs.mjs +135 -0
  14. package/esm2022/adapter-ajax-angularjs/adapter-core.mjs +49 -0
  15. package/esm2022/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.mjs +5 -0
  16. package/esm2022/adapter-ajax-fetch/adapter-ajax-fetch.mjs +135 -0
  17. package/esm2022/adapter-ajax-fetch/adapter-core.mjs +49 -0
  18. package/esm2022/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.mjs +5 -0
  19. package/esm2022/adapter-ajax-httpclient/adapter-ajax-httpclient.mjs +139 -0
  20. package/esm2022/adapter-ajax-httpclient/adapter-core.mjs +49 -0
  21. package/esm2022/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.mjs +5 -0
  22. package/esm2022/adapter-ajax-jquery/adapter-ajax-jquery.mjs +107 -0
  23. package/esm2022/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.mjs +5 -0
  24. package/esm2022/adapter-ajax-post/adapter-ajax-post.mjs +77 -0
  25. package/esm2022/adapter-ajax-post/breeze-client-adapter-ajax-post.mjs +5 -0
  26. package/esm2022/adapter-data-service-odata/adapter-core.mjs +49 -0
  27. package/esm2022/adapter-data-service-odata/adapter-data-service-odata.mjs +461 -0
  28. package/esm2022/adapter-data-service-odata/breeze-client-adapter-data-service-odata.mjs +5 -0
  29. package/esm2022/adapter-data-service-webapi/adapter-data-service-webapi.mjs +100 -0
  30. package/esm2022/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.mjs +5 -0
  31. package/esm2022/adapter-model-library-backing-store/adapter-model-library-backing-store.mjs +269 -0
  32. package/esm2022/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.mjs +5 -0
  33. package/esm2022/adapter-model-library-ko/adapter-model-library-ko.mjs +241 -0
  34. package/esm2022/adapter-model-library-ko/breeze-client-adapter-model-library-ko.mjs +5 -0
  35. package/esm2022/adapter-uri-builder-json/adapter-core.mjs +49 -0
  36. package/esm2022/adapter-uri-builder-json/adapter-uri-builder-json.mjs +37 -0
  37. package/esm2022/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.mjs +5 -0
  38. package/esm2022/adapter-uri-builder-odata/adapter-core.mjs +49 -0
  39. package/esm2022/adapter-uri-builder-odata/adapter-uri-builder-odata.mjs +191 -0
  40. package/esm2022/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.mjs +5 -0
  41. package/esm2022/breeze-client.mjs +5 -0
  42. package/esm2022/index.mjs +2 -0
  43. package/esm2022/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.mjs +5 -0
  44. package/esm2022/mixin-get-entity-graph/mixin-get-entity-graph.mjs +269 -0
  45. package/esm2022/mixin-save-queuing/breeze-client-mixin-save-queuing.mjs +5 -0
  46. package/esm2022/mixin-save-queuing/mixin-save-queuing.mjs +421 -0
  47. package/esm2022/src/abstract-data-service-adapter.mjs +294 -0
  48. package/esm2022/src/array.mjs +4 -0
  49. package/esm2022/src/assert-param.mjs +330 -0
  50. package/esm2022/src/breeze.mjs +85 -0
  51. package/esm2022/src/complex-array.mjs +117 -0
  52. package/esm2022/src/config.mjs +232 -0
  53. package/esm2022/src/core.mjs +712 -0
  54. package/esm2022/src/csdl-metadata-parser.mjs +385 -0
  55. package/esm2022/src/data-service.mjs +239 -0
  56. package/esm2022/src/data-type.mjs +507 -0
  57. package/esm2022/src/default-property-interceptor.mjs +460 -0
  58. package/esm2022/src/entity-action.mjs +45 -0
  59. package/esm2022/src/entity-aspect.mjs +897 -0
  60. package/esm2022/src/entity-group.mjs +192 -0
  61. package/esm2022/src/entity-key.mjs +127 -0
  62. package/esm2022/src/entity-manager.mjs +2183 -0
  63. package/esm2022/src/entity-metadata.mjs +2242 -0
  64. package/esm2022/src/entity-query.mjs +1005 -0
  65. package/esm2022/src/entity-state.mjs +107 -0
  66. package/{esm2015/src/enum.js → esm2022/src/enum.mjs} +3 -1
  67. package/esm2022/src/event.mjs +264 -0
  68. package/esm2022/src/interface-registry.mjs +39 -0
  69. package/esm2022/src/key-generator.mjs +110 -0
  70. package/esm2022/src/local-query-comparison-options.mjs +75 -0
  71. package/esm2022/src/mapping-context.mjs +422 -0
  72. package/{esm5/src/naming-convention.js → esm2022/src/naming-convention.mjs} +35 -29
  73. package/esm2022/src/observable-array.mjs +183 -0
  74. package/esm2022/src/predicate.mjs +1259 -0
  75. package/esm2022/src/primitive-array.mjs +85 -0
  76. package/esm2022/src/query-options.mjs +160 -0
  77. package/esm2022/src/relation-array.mjs +173 -0
  78. package/esm2022/src/save-options.mjs +51 -0
  79. package/esm2022/src/unattached-children-map.mjs +56 -0
  80. package/{esm5/src/validate.js → esm2022/src/validate.mjs} +116 -110
  81. package/esm2022/src/validation-options.mjs +78 -0
  82. package/{fesm2015/breeze-client-adapter-ajax-angularjs.js → fesm2022/breeze-client-adapter-ajax-angularjs.mjs} +6 -1
  83. package/fesm2022/breeze-client-adapter-ajax-angularjs.mjs.map +1 -0
  84. package/{fesm2015/breeze-client-adapter-ajax-fetch.js → fesm2022/breeze-client-adapter-ajax-fetch.mjs} +9 -4
  85. package/fesm2022/breeze-client-adapter-ajax-fetch.mjs.map +1 -0
  86. package/{fesm2015/breeze-client-adapter-ajax-httpclient.js → fesm2022/breeze-client-adapter-ajax-httpclient.mjs} +6 -4
  87. package/fesm2022/breeze-client-adapter-ajax-httpclient.mjs.map +1 -0
  88. package/{fesm2015/breeze-client-adapter-ajax-jquery.js → fesm2022/breeze-client-adapter-ajax-jquery.mjs} +6 -2
  89. package/fesm2022/breeze-client-adapter-ajax-jquery.mjs.map +1 -0
  90. package/{fesm2015/breeze-client-adapter-ajax-post.js → fesm2022/breeze-client-adapter-ajax-post.mjs} +1 -1
  91. package/fesm2022/breeze-client-adapter-ajax-post.mjs.map +1 -0
  92. package/{fesm2015/breeze-client-adapter-data-service-odata.js → fesm2022/breeze-client-adapter-data-service-odata.mjs} +70 -67
  93. package/fesm2022/breeze-client-adapter-data-service-odata.mjs.map +1 -0
  94. package/{fesm2015/breeze-client-adapter-data-service-webapi.js → fesm2022/breeze-client-adapter-data-service-webapi.mjs} +36 -29
  95. package/fesm2022/breeze-client-adapter-data-service-webapi.mjs.map +1 -0
  96. package/{fesm2015/breeze-client-adapter-model-library-backing-store.js → fesm2022/breeze-client-adapter-model-library-backing-store.mjs} +14 -13
  97. package/fesm2022/breeze-client-adapter-model-library-backing-store.mjs.map +1 -0
  98. package/{fesm2015/breeze-client-adapter-model-library-ko.js → fesm2022/breeze-client-adapter-model-library-ko.mjs} +14 -13
  99. package/fesm2022/breeze-client-adapter-model-library-ko.mjs.map +1 -0
  100. package/{fesm2015/breeze-client-adapter-uri-builder-json.js → fesm2022/breeze-client-adapter-uri-builder-json.mjs} +9 -8
  101. package/fesm2022/breeze-client-adapter-uri-builder-json.mjs.map +1 -0
  102. package/{fesm2015/breeze-client-adapter-uri-builder-odata.js → fesm2022/breeze-client-adapter-uri-builder-odata.mjs} +86 -86
  103. package/fesm2022/breeze-client-adapter-uri-builder-odata.mjs.map +1 -0
  104. package/{fesm2015/breeze-client-mixin-get-entity-graph.js → fesm2022/breeze-client-mixin-get-entity-graph.mjs} +1 -1
  105. package/fesm2022/breeze-client-mixin-get-entity-graph.mjs.map +1 -0
  106. package/{fesm2015/breeze-client-mixin-save-queuing.js → fesm2022/breeze-client-mixin-save-queuing.mjs} +23 -2
  107. package/fesm2022/breeze-client-mixin-save-queuing.mjs.map +1 -0
  108. package/{fesm2015/breeze-client.js → fesm2022/breeze-client.mjs} +2122 -1540
  109. package/fesm2022/breeze-client.mjs.map +1 -0
  110. package/mixin-get-entity-graph/{breeze-client-mixin-get-entity-graph.d.ts → index.d.ts} +1 -0
  111. package/mixin-save-queuing/{breeze-client-mixin-save-queuing.d.ts → index.d.ts} +1 -0
  112. package/package.json +93 -11
  113. package/src/abstract-data-service-adapter.d.ts +0 -1
  114. package/src/config.d.ts +1 -1
  115. package/src/core.d.ts +1 -1
  116. package/src/data-type.d.ts +5 -0
  117. package/src/entity-aspect.d.ts +6 -6
  118. package/src/entity-manager.d.ts +4 -4
  119. package/src/entity-metadata.d.ts +45 -33
  120. package/src/entity-query.d.ts +1 -1
  121. package/src/entity-state.d.ts +4 -0
  122. package/src/mapping-context.d.ts +1 -1
  123. package/src/predicate.d.ts +4 -7
  124. package/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.metadata.json +0 -1
  125. package/adapter-ajax-angularjs/package.json +0 -13
  126. package/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.metadata.json +0 -1
  127. package/adapter-ajax-fetch/package.json +0 -13
  128. package/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.metadata.json +0 -1
  129. package/adapter-ajax-httpclient/package.json +0 -13
  130. package/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.metadata.json +0 -1
  131. package/adapter-ajax-jquery/package.json +0 -13
  132. package/adapter-ajax-post/breeze-client-adapter-ajax-post.metadata.json +0 -1
  133. package/adapter-ajax-post/package.json +0 -13
  134. package/adapter-data-service-odata/breeze-client-adapter-data-service-odata.metadata.json +0 -1
  135. package/adapter-data-service-odata/package.json +0 -13
  136. package/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.metadata.json +0 -1
  137. package/adapter-data-service-webapi/package.json +0 -13
  138. package/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.metadata.json +0 -1
  139. package/adapter-model-library-backing-store/package.json +0 -13
  140. package/adapter-model-library-ko/breeze-client-adapter-model-library-ko.metadata.json +0 -1
  141. package/adapter-model-library-ko/package.json +0 -13
  142. package/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.metadata.json +0 -1
  143. package/adapter-uri-builder-json/package.json +0 -13
  144. package/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.metadata.json +0 -1
  145. package/adapter-uri-builder-odata/package.json +0 -13
  146. package/breeze-client.d.ts +0 -8
  147. package/breeze-client.metadata.json +0 -1
  148. package/bundles/breeze-client-adapter-ajax-angularjs.umd.js +0 -190
  149. package/bundles/breeze-client-adapter-ajax-angularjs.umd.js.map +0 -1
  150. package/bundles/breeze-client-adapter-ajax-angularjs.umd.min.js +0 -2
  151. package/bundles/breeze-client-adapter-ajax-angularjs.umd.min.js.map +0 -1
  152. package/bundles/breeze-client-adapter-ajax-fetch.umd.js +0 -190
  153. package/bundles/breeze-client-adapter-ajax-fetch.umd.js.map +0 -1
  154. package/bundles/breeze-client-adapter-ajax-fetch.umd.min.js +0 -2
  155. package/bundles/breeze-client-adapter-ajax-fetch.umd.min.js.map +0 -1
  156. package/bundles/breeze-client-adapter-ajax-httpclient.umd.js +0 -195
  157. package/bundles/breeze-client-adapter-ajax-httpclient.umd.js.map +0 -1
  158. package/bundles/breeze-client-adapter-ajax-httpclient.umd.min.js +0 -2
  159. package/bundles/breeze-client-adapter-ajax-httpclient.umd.min.js.map +0 -1
  160. package/bundles/breeze-client-adapter-ajax-jquery.umd.js +0 -115
  161. package/bundles/breeze-client-adapter-ajax-jquery.umd.js.map +0 -1
  162. package/bundles/breeze-client-adapter-ajax-jquery.umd.min.js +0 -2
  163. package/bundles/breeze-client-adapter-ajax-jquery.umd.min.js.map +0 -1
  164. package/bundles/breeze-client-adapter-ajax-post.umd.js +0 -92
  165. package/bundles/breeze-client-adapter-ajax-post.umd.js.map +0 -1
  166. package/bundles/breeze-client-adapter-ajax-post.umd.min.js +0 -2
  167. package/bundles/breeze-client-adapter-ajax-post.umd.min.js.map +0 -1
  168. package/bundles/breeze-client-adapter-data-service-odata.umd.js +0 -743
  169. package/bundles/breeze-client-adapter-data-service-odata.umd.js.map +0 -1
  170. package/bundles/breeze-client-adapter-data-service-odata.umd.min.js +0 -16
  171. package/bundles/breeze-client-adapter-data-service-odata.umd.min.js.map +0 -1
  172. package/bundles/breeze-client-adapter-data-service-webapi.umd.js +0 -326
  173. package/bundles/breeze-client-adapter-data-service-webapi.umd.js.map +0 -1
  174. package/bundles/breeze-client-adapter-data-service-webapi.umd.min.js +0 -16
  175. package/bundles/breeze-client-adapter-data-service-webapi.umd.min.js.map +0 -1
  176. package/bundles/breeze-client-adapter-model-library-backing-store.umd.js +0 -280
  177. package/bundles/breeze-client-adapter-model-library-backing-store.umd.js.map +0 -1
  178. package/bundles/breeze-client-adapter-model-library-backing-store.umd.min.js +0 -2
  179. package/bundles/breeze-client-adapter-model-library-backing-store.umd.min.js.map +0 -1
  180. package/bundles/breeze-client-adapter-model-library-ko.umd.js +0 -252
  181. package/bundles/breeze-client-adapter-model-library-ko.umd.js.map +0 -1
  182. package/bundles/breeze-client-adapter-model-library-ko.umd.min.js +0 -2
  183. package/bundles/breeze-client-adapter-model-library-ko.umd.min.js.map +0 -1
  184. package/bundles/breeze-client-adapter-uri-builder-json.umd.js +0 -96
  185. package/bundles/breeze-client-adapter-uri-builder-json.umd.js.map +0 -1
  186. package/bundles/breeze-client-adapter-uri-builder-json.umd.min.js +0 -2
  187. package/bundles/breeze-client-adapter-uri-builder-json.umd.min.js.map +0 -1
  188. package/bundles/breeze-client-adapter-uri-builder-odata.umd.js +0 -262
  189. package/bundles/breeze-client-adapter-uri-builder-odata.umd.js.map +0 -1
  190. package/bundles/breeze-client-adapter-uri-builder-odata.umd.min.js +0 -2
  191. package/bundles/breeze-client-adapter-uri-builder-odata.umd.min.js.map +0 -1
  192. package/bundles/breeze-client-mixin-get-entity-graph.umd.js +0 -258
  193. package/bundles/breeze-client-mixin-get-entity-graph.umd.js.map +0 -1
  194. package/bundles/breeze-client-mixin-get-entity-graph.umd.min.js +0 -2
  195. package/bundles/breeze-client-mixin-get-entity-graph.umd.min.js.map +0 -1
  196. package/bundles/breeze-client-mixin-save-queuing.umd.js +0 -579
  197. package/bundles/breeze-client-mixin-save-queuing.umd.js.map +0 -1
  198. package/bundles/breeze-client-mixin-save-queuing.umd.min.js +0 -16
  199. package/bundles/breeze-client-mixin-save-queuing.umd.min.js.map +0 -1
  200. package/bundles/breeze-client.umd.js +0 -14098
  201. package/bundles/breeze-client.umd.js.map +0 -1
  202. package/bundles/breeze-client.umd.min.js +0 -16
  203. package/bundles/breeze-client.umd.min.js.map +0 -1
  204. package/esm2015/adapter-ajax-angularjs/adapter-ajax-angularjs.js +0 -130
  205. package/esm2015/adapter-ajax-angularjs/adapter-core.js +0 -49
  206. package/esm2015/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.js +0 -5
  207. package/esm2015/adapter-ajax-fetch/adapter-ajax-fetch.js +0 -130
  208. package/esm2015/adapter-ajax-fetch/adapter-core.js +0 -49
  209. package/esm2015/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.js +0 -5
  210. package/esm2015/adapter-ajax-httpclient/adapter-ajax-httpclient.js +0 -137
  211. package/esm2015/adapter-ajax-httpclient/adapter-core.js +0 -49
  212. package/esm2015/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.js +0 -5
  213. package/esm2015/adapter-ajax-jquery/adapter-ajax-jquery.js +0 -103
  214. package/esm2015/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.js +0 -5
  215. package/esm2015/adapter-ajax-post/adapter-ajax-post.js +0 -77
  216. package/esm2015/adapter-ajax-post/breeze-client-adapter-ajax-post.js +0 -5
  217. package/esm2015/adapter-data-service-odata/adapter-core.js +0 -49
  218. package/esm2015/adapter-data-service-odata/adapter-data-service-odata.js +0 -459
  219. package/esm2015/adapter-data-service-odata/breeze-client-adapter-data-service-odata.js +0 -5
  220. package/esm2015/adapter-data-service-webapi/adapter-data-service-webapi.js +0 -93
  221. package/esm2015/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.js +0 -5
  222. package/esm2015/adapter-model-library-backing-store/adapter-model-library-backing-store.js +0 -268
  223. package/esm2015/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.js +0 -5
  224. package/esm2015/adapter-model-library-ko/adapter-model-library-ko.js +0 -240
  225. package/esm2015/adapter-model-library-ko/breeze-client-adapter-model-library-ko.js +0 -5
  226. package/esm2015/adapter-uri-builder-json/adapter-core.js +0 -49
  227. package/esm2015/adapter-uri-builder-json/adapter-uri-builder-json.js +0 -36
  228. package/esm2015/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.js +0 -5
  229. package/esm2015/adapter-uri-builder-odata/adapter-core.js +0 -49
  230. package/esm2015/adapter-uri-builder-odata/adapter-uri-builder-odata.js +0 -192
  231. package/esm2015/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.js +0 -5
  232. package/esm2015/breeze-client.js +0 -9
  233. package/esm2015/index.js +0 -2
  234. package/esm2015/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.js +0 -5
  235. package/esm2015/mixin-get-entity-graph/mixin-get-entity-graph.js +0 -269
  236. package/esm2015/mixin-save-queuing/breeze-client-mixin-save-queuing.js +0 -5
  237. package/esm2015/mixin-save-queuing/mixin-save-queuing.js +0 -400
  238. package/esm2015/src/abstract-data-service-adapter.js +0 -296
  239. package/esm2015/src/array.js +0 -4
  240. package/esm2015/src/assert-param.js +0 -312
  241. package/esm2015/src/breeze.js +0 -85
  242. package/esm2015/src/complex-array.js +0 -119
  243. package/esm2015/src/config.js +0 -223
  244. package/esm2015/src/core.js +0 -709
  245. package/esm2015/src/csdl-metadata-parser.js +0 -385
  246. package/esm2015/src/data-service.js +0 -203
  247. package/esm2015/src/data-type.js +0 -444
  248. package/esm2015/src/default-property-interceptor.js +0 -460
  249. package/esm2015/src/entity-action.js +0 -45
  250. package/esm2015/src/entity-aspect.js +0 -806
  251. package/esm2015/src/entity-group.js +0 -187
  252. package/esm2015/src/entity-key.js +0 -116
  253. package/esm2015/src/entity-manager.js +0 -2094
  254. package/esm2015/src/entity-metadata.js +0 -2109
  255. package/esm2015/src/entity-query.js +0 -996
  256. package/esm2015/src/entity-state.js +0 -99
  257. package/esm2015/src/event.js +0 -256
  258. package/esm2015/src/interface-registry.js +0 -41
  259. package/esm2015/src/key-generator.js +0 -108
  260. package/esm2015/src/local-query-comparison-options.js +0 -65
  261. package/esm2015/src/mapping-context.js +0 -405
  262. package/esm2015/src/naming-convention.js +0 -88
  263. package/esm2015/src/observable-array.js +0 -185
  264. package/esm2015/src/predicate.js +0 -1235
  265. package/esm2015/src/primitive-array.js +0 -87
  266. package/esm2015/src/query-options.js +0 -152
  267. package/esm2015/src/relation-array.js +0 -175
  268. package/esm2015/src/save-options.js +0 -41
  269. package/esm2015/src/unattached-children-map.js +0 -58
  270. package/esm2015/src/validate.js +0 -991
  271. package/esm2015/src/validation-options.js +0 -64
  272. package/esm5/adapter-ajax-angularjs/adapter-ajax-angularjs.js +0 -132
  273. package/esm5/adapter-ajax-angularjs/adapter-core.js +0 -49
  274. package/esm5/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.js +0 -5
  275. package/esm5/adapter-ajax-fetch/adapter-ajax-fetch.js +0 -132
  276. package/esm5/adapter-ajax-fetch/adapter-core.js +0 -49
  277. package/esm5/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.js +0 -5
  278. package/esm5/adapter-ajax-httpclient/adapter-ajax-httpclient.js +0 -139
  279. package/esm5/adapter-ajax-httpclient/adapter-core.js +0 -49
  280. package/esm5/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.js +0 -5
  281. package/esm5/adapter-ajax-jquery/adapter-ajax-jquery.js +0 -105
  282. package/esm5/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.js +0 -5
  283. package/esm5/adapter-ajax-post/adapter-ajax-post.js +0 -81
  284. package/esm5/adapter-ajax-post/breeze-client-adapter-ajax-post.js +0 -5
  285. package/esm5/adapter-data-service-odata/adapter-core.js +0 -49
  286. package/esm5/adapter-data-service-odata/adapter-data-service-odata.js +0 -466
  287. package/esm5/adapter-data-service-odata/breeze-client-adapter-data-service-odata.js +0 -5
  288. package/esm5/adapter-data-service-webapi/adapter-data-service-webapi.js +0 -98
  289. package/esm5/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.js +0 -5
  290. package/esm5/adapter-model-library-backing-store/adapter-model-library-backing-store.js +0 -270
  291. package/esm5/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.js +0 -5
  292. package/esm5/adapter-model-library-ko/adapter-model-library-ko.js +0 -242
  293. package/esm5/adapter-model-library-ko/breeze-client-adapter-model-library-ko.js +0 -5
  294. package/esm5/adapter-uri-builder-json/adapter-core.js +0 -49
  295. package/esm5/adapter-uri-builder-json/adapter-uri-builder-json.js +0 -38
  296. package/esm5/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.js +0 -5
  297. package/esm5/adapter-uri-builder-odata/adapter-core.js +0 -49
  298. package/esm5/adapter-uri-builder-odata/adapter-uri-builder-odata.js +0 -197
  299. package/esm5/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.js +0 -5
  300. package/esm5/breeze-client.js +0 -9
  301. package/esm5/index.js +0 -2
  302. package/esm5/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.js +0 -5
  303. package/esm5/mixin-get-entity-graph/mixin-get-entity-graph.js +0 -269
  304. package/esm5/mixin-save-queuing/breeze-client-mixin-save-queuing.js +0 -5
  305. package/esm5/mixin-save-queuing/mixin-save-queuing.js +0 -412
  306. package/esm5/src/abstract-data-service-adapter.js +0 -302
  307. package/esm5/src/array.js +0 -4
  308. package/esm5/src/assert-param.js +0 -317
  309. package/esm5/src/breeze.js +0 -85
  310. package/esm5/src/complex-array.js +0 -119
  311. package/esm5/src/config.js +0 -228
  312. package/esm5/src/core.js +0 -717
  313. package/esm5/src/csdl-metadata-parser.js +0 -385
  314. package/esm5/src/data-service.js +0 -207
  315. package/esm5/src/data-type.js +0 -451
  316. package/esm5/src/default-property-interceptor.js +0 -460
  317. package/esm5/src/entity-action.js +0 -52
  318. package/esm5/src/entity-aspect.js +0 -812
  319. package/esm5/src/entity-group.js +0 -189
  320. package/esm5/src/entity-key.js +0 -118
  321. package/esm5/src/entity-manager.js +0 -2112
  322. package/esm5/src/entity-metadata.js +0 -2144
  323. package/esm5/src/entity-query.js +0 -1023
  324. package/esm5/src/entity-state.js +0 -106
  325. package/esm5/src/enum.js +0 -144
  326. package/esm5/src/event.js +0 -259
  327. package/esm5/src/interface-registry.js +0 -43
  328. package/esm5/src/key-generator.js +0 -111
  329. package/esm5/src/local-query-comparison-options.js +0 -67
  330. package/esm5/src/mapping-context.js +0 -407
  331. package/esm5/src/observable-array.js +0 -201
  332. package/esm5/src/predicate.js +0 -1300
  333. package/esm5/src/primitive-array.js +0 -87
  334. package/esm5/src/query-options.js +0 -167
  335. package/esm5/src/relation-array.js +0 -175
  336. package/esm5/src/save-options.js +0 -43
  337. package/esm5/src/unattached-children-map.js +0 -60
  338. package/esm5/src/validation-options.js +0 -66
  339. package/fesm2015/breeze-client-adapter-ajax-angularjs.js.map +0 -1
  340. package/fesm2015/breeze-client-adapter-ajax-fetch.js.map +0 -1
  341. package/fesm2015/breeze-client-adapter-ajax-httpclient.js.map +0 -1
  342. package/fesm2015/breeze-client-adapter-ajax-jquery.js.map +0 -1
  343. package/fesm2015/breeze-client-adapter-ajax-post.js.map +0 -1
  344. package/fesm2015/breeze-client-adapter-data-service-odata.js.map +0 -1
  345. package/fesm2015/breeze-client-adapter-data-service-webapi.js.map +0 -1
  346. package/fesm2015/breeze-client-adapter-model-library-backing-store.js.map +0 -1
  347. package/fesm2015/breeze-client-adapter-model-library-ko.js.map +0 -1
  348. package/fesm2015/breeze-client-adapter-uri-builder-json.js.map +0 -1
  349. package/fesm2015/breeze-client-adapter-uri-builder-odata.js.map +0 -1
  350. package/fesm2015/breeze-client-mixin-get-entity-graph.js.map +0 -1
  351. package/fesm2015/breeze-client-mixin-save-queuing.js.map +0 -1
  352. package/fesm2015/breeze-client.js.map +0 -1
  353. package/fesm5/breeze-client-adapter-ajax-angularjs.js +0 -186
  354. package/fesm5/breeze-client-adapter-ajax-angularjs.js.map +0 -1
  355. package/fesm5/breeze-client-adapter-ajax-fetch.js +0 -186
  356. package/fesm5/breeze-client-adapter-ajax-fetch.js.map +0 -1
  357. package/fesm5/breeze-client-adapter-ajax-httpclient.js +0 -193
  358. package/fesm5/breeze-client-adapter-ajax-httpclient.js.map +0 -1
  359. package/fesm5/breeze-client-adapter-ajax-jquery.js +0 -111
  360. package/fesm5/breeze-client-adapter-ajax-jquery.js.map +0 -1
  361. package/fesm5/breeze-client-adapter-ajax-post.js +0 -86
  362. package/fesm5/breeze-client-adapter-ajax-post.js.map +0 -1
  363. package/fesm5/breeze-client-adapter-data-service-odata.js +0 -519
  364. package/fesm5/breeze-client-adapter-data-service-odata.js.map +0 -1
  365. package/fesm5/breeze-client-adapter-data-service-webapi.js +0 -104
  366. package/fesm5/breeze-client-adapter-data-service-webapi.js.map +0 -1
  367. package/fesm5/breeze-client-adapter-model-library-backing-store.js +0 -276
  368. package/fesm5/breeze-client-adapter-model-library-backing-store.js.map +0 -1
  369. package/fesm5/breeze-client-adapter-model-library-ko.js +0 -248
  370. package/fesm5/breeze-client-adapter-model-library-ko.js.map +0 -1
  371. package/fesm5/breeze-client-adapter-uri-builder-json.js +0 -92
  372. package/fesm5/breeze-client-adapter-uri-builder-json.js.map +0 -1
  373. package/fesm5/breeze-client-adapter-uri-builder-odata.js +0 -250
  374. package/fesm5/breeze-client-adapter-uri-builder-odata.js.map +0 -1
  375. package/fesm5/breeze-client-mixin-get-entity-graph.js +0 -254
  376. package/fesm5/breeze-client-mixin-get-entity-graph.js.map +0 -1
  377. package/fesm5/breeze-client-mixin-save-queuing.js +0 -356
  378. package/fesm5/breeze-client-mixin-save-queuing.js.map +0 -1
  379. package/fesm5/breeze-client.js +0 -13820
  380. package/fesm5/breeze-client.js.map +0 -1
  381. package/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.metadata.json +0 -1
  382. package/mixin-get-entity-graph/package.json +0 -13
  383. package/mixin-save-queuing/breeze-client-mixin-save-queuing.metadata.json +0 -1
  384. package/mixin-save-queuing/package.json +0 -13
@@ -47,6 +47,8 @@ Note that we have Error['x'] = ... in some places in the code to prevent Terser
47
47
  @dynamic
48
48
  */
49
49
  class BreezeEnum {
50
+ /** @hidden @internal */
51
+ static _resolvedNamesAndSymbols;
50
52
  /** */
51
53
  constructor(propertiesObj) {
52
54
  if (propertiesObj) {
@@ -142,15 +144,14 @@ class BreezeEnum {
142
144
  /** See if this comment will make it into .d.ts */
143
145
  let hasOwnProperty = uncurry(Object.prototype.hasOwnProperty);
144
146
  let arraySlice = uncurry(Array.prototype.slice);
145
- const ɵ0 = function () {
147
+ let isES5Supported = function () {
146
148
  try {
147
149
  return !!(Object.getPrototypeOf && Object.defineProperty({}, 'x', {}));
148
150
  }
149
151
  catch (e) {
150
152
  return false;
151
153
  }
152
- };
153
- let isES5Supported = ɵ0();
154
+ }();
154
155
  // iterate over object
155
156
  function objectForEach(obj, kvFn) {
156
157
  for (let key in obj) {
@@ -639,20 +640,23 @@ function memoize(fn) {
639
640
  fn.memoize[hash] = fn.apply(this, args);
640
641
  };
641
642
  }
643
+ const uuidrex = /[xy]/g;
642
644
  function getUuid() {
643
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
645
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(uuidrex, function (c) {
644
646
  // tslint:disable-next-line
645
647
  let r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
646
648
  return v.toString(16);
647
649
  });
648
650
  }
651
+ const durationrex = /^P((\d+Y)?(\d+M)?(\d+D)?)?(T(\d+H)?(\d+M)?(\d+S)?)?$/;
652
+ const lettersrex = /[A-Za-z]+/g;
649
653
  function durationToSeconds(duration) {
650
654
  // basic algorithm from https://github.com/nezasa/iso8601-js-period
651
655
  if (typeof duration !== "string")
652
656
  throw new Error("Invalid ISO8601 duration '" + duration + "'");
653
657
  // regex splits as follows - grp0, grp1, y, m, d, grp2, h, m, s
654
658
  // 0 1 2 3 4 5 6 7 8
655
- let struct = /^P((\d+Y)?(\d+M)?(\d+D)?)?(T(\d+H)?(\d+M)?(\d+S)?)?$/.exec(duration);
659
+ let struct = durationrex.exec(duration);
656
660
  if (!struct)
657
661
  throw new Error("Invalid ISO8601 duration '" + duration + "'");
658
662
  let ymdhmsIndexes = [2, 3, 4, 6, 7, 8]; // -> grp1,y,m,d,grp2,h,m,s
@@ -666,7 +670,7 @@ function durationToSeconds(duration) {
666
670
  for (let i = 0; i < 6; i++) {
667
671
  let digit = struct[ymdhmsIndexes[i]];
668
672
  // remove letters, replace by 0 if not defined
669
- digit = (digit ? +digit.replace(/[A-Za-z]+/g, '') : 0);
673
+ digit = (digit ? +digit.replace(lettersrex, '') : 0);
670
674
  seconds += digit * factors[i];
671
675
  }
672
676
  return seconds;
@@ -690,10 +694,10 @@ function classof(o) {
690
694
  function isDate(o) {
691
695
  return classof(o) === "date" && !isNaN(o.getTime());
692
696
  }
697
+ const isdaterex = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/;
693
698
  function isDateString(s) {
694
699
  // let rx = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
695
- let rx = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/;
696
- return (typeof s === "string") && rx.test(s);
700
+ return (typeof s === "string") && isdaterex.test(s);
697
701
  }
698
702
  function isFunction(o) {
699
703
  return classof(o) === "function";
@@ -704,11 +708,13 @@ function isFunction(o) {
704
708
  // function isObject(o: any) {
705
709
  // return (typeof o === "object");
706
710
  // }
711
+ const isguidrex = /^[a-fA-F\d]{8}-(?:[a-fA-F\d]{4}-){3}[a-fA-F\d]{12}$/;
707
712
  function isGuid(value) {
708
- return (typeof value === "string") && /[a-fA-F\d]{8}-(?:[a-fA-F\d]{4}-){3}[a-fA-F\d]{12}/.test(value);
713
+ return (typeof value === "string") && isguidrex.test(value);
709
714
  }
715
+ const isdurationrex = /^(-|)?P[T]?[\d\.,\-]+[YMDTHS]/;
710
716
  function isDuration(value) {
711
- return (typeof value === "string") && /^(-|)?P[T]?[\d\.,\-]+[YMDTHS]/.test(value);
717
+ return (typeof value === "string") && isdurationrex.test(value);
712
718
  }
713
719
  function isEmpty(obj) {
714
720
  if (obj === null || obj === undefined) {
@@ -726,7 +732,7 @@ function isNumeric(n) {
726
732
  }
727
733
  // end of is Functions
728
734
  // string functions
729
- function stringStartsWith(str, prefix) {
735
+ function stringStartsWith$1(str, prefix) {
730
736
  // returns true for empty string or null prefix
731
737
  if ((!str))
732
738
  return false;
@@ -734,7 +740,7 @@ function stringStartsWith(str, prefix) {
734
740
  return true;
735
741
  return str.indexOf(prefix, 0) === 0;
736
742
  }
737
- function stringEndsWith(str, suffix) {
743
+ function stringEndsWith$1(str, suffix) {
738
744
  // returns true for empty string or null suffix
739
745
  if ((!str))
740
746
  return false;
@@ -753,7 +759,7 @@ function formatString(str, ...params) {
753
759
  }
754
760
  // See http://stackoverflow.com/questions/7225407/convert-camelcasetext-to-camel-case-text
755
761
  /** Change text to title case with spaces, e.g. 'myPropertyName12' to 'My Property Name 12' */
756
- let camelEdges = /([A-Z](?=[A-Z][a-z])|[^A-Z](?=[A-Z])|[a-zA-Z](?=[^a-zA-Z]))/g;
762
+ const camelEdges = /([A-Z](?=[A-Z][a-z])|[^A-Z](?=[A-Z])|[a-zA-Z](?=[^a-zA-Z]))/g;
757
763
  function titleCaseSpace(text) {
758
764
  text = text.replace(camelEdges, '$1 ');
759
765
  text = text.charAt(0).toUpperCase() + text.slice(1);
@@ -824,8 +830,8 @@ const core = {
824
830
  isNumeric: isNumeric,
825
831
  identity: identity,
826
832
  noop: noop,
827
- stringStartsWith: stringStartsWith,
828
- stringEndsWith: stringEndsWith,
833
+ stringStartsWith: stringStartsWith$1,
834
+ stringEndsWith: stringEndsWith$1,
829
835
  formatString: formatString,
830
836
  titleCase: titleCaseSpace,
831
837
  toJson: toJson,
@@ -848,19 +854,23 @@ function isPrimitive(obj: any) {
848
854
 
849
855
  /** @hidden @internal */
850
856
  class Param {
857
+ // The %1 parameter
858
+ // is required
859
+ // must be a %2
860
+ // must be an instance of %2
861
+ // must be an instance of the %2 enumeration
862
+ // must have a %2 property
863
+ // must be an array where each element
864
+ // is optional or
865
+ v;
866
+ name;
867
+ defaultValue;
868
+ parent;
869
+ /** @hidden @internal */
870
+ _context;
871
+ /** @hidden @internal */
872
+ _contexts;
851
873
  constructor(v, name) {
852
- /** @hidden @internal */
853
- this._applyOne = function (instance) {
854
- if (this.v !== undefined) {
855
- instance[this.name] = this.v;
856
- }
857
- else {
858
- if (this.defaultValue !== undefined) {
859
- instance[this.name] = this.defaultValue;
860
- }
861
- }
862
- };
863
- this.MESSAGE_PREFIX = "The '%1' parameter ";
864
874
  this.v = v;
865
875
  this.name = name;
866
876
  this._contexts = [null];
@@ -1006,6 +1016,18 @@ class Param {
1006
1016
  }
1007
1017
  }
1008
1018
  }
1019
+ /** @hidden @internal */
1020
+ _applyOne = function (instance) {
1021
+ if (this.v !== undefined) {
1022
+ instance[this.name] = this.v;
1023
+ }
1024
+ else {
1025
+ if (this.defaultValue !== undefined) {
1026
+ instance[this.name] = this.defaultValue;
1027
+ }
1028
+ }
1029
+ };
1030
+ MESSAGE_PREFIX = "The '%1' parameter ";
1009
1031
  }
1010
1032
  /** @hidden @internal */
1011
1033
  let assertParam = function (v, name) {
@@ -1134,6 +1156,8 @@ function throwConfigError(instance, message) {
1134
1156
  throw new Error(core.formatString("Error configuring an instance of '%1'. %2", (instance && instance._$typeName) || "object", message));
1135
1157
  }
1136
1158
  class ConfigParam {
1159
+ config;
1160
+ params;
1137
1161
  constructor(config) {
1138
1162
  if (typeof (config) !== "object") {
1139
1163
  throw new Error("Configuration parameter should be an object, instead it is a: " + typeof (config));
@@ -1189,6 +1213,18 @@ Class to support basic event publication and subscription semantics.
1189
1213
  @dynamic
1190
1214
  **/
1191
1215
  class BreezeEvent {
1216
+ /** @hidden @internal */
1217
+ static __eventNameMap = {};
1218
+ /** @hidden @internal */
1219
+ static __nextUnsubKey = 1;
1220
+ /** The name of this Event */
1221
+ name;
1222
+ /** The object doing the publication. i.e. the object to which this event is attached. */
1223
+ publisher;
1224
+ /** @hidden @internal */
1225
+ _subscribers;
1226
+ /** @hidden @internal */
1227
+ _defaultErrorCallback;
1192
1228
  /**
1193
1229
  Constructor for an Event
1194
1230
  > salaryEvent = new BreezeEvent("salaryEvent", person);
@@ -1198,36 +1234,6 @@ class BreezeEvent {
1198
1234
  If omitted then subscriber notification failures will be ignored.
1199
1235
  **/
1200
1236
  constructor(name, publisher, defaultErrorCallback) {
1201
- /**
1202
- Unsubscribe from this event.
1203
- > // Assume order is a preexisting 'order' entity
1204
- > let token = order.entityAspect.propertyChanged.subscribe(function (pcEvent) {
1205
- > // do something
1206
- > });
1207
- > // sometime later
1208
- > order.entityAspect.propertyChanged.unsubscribe(token);
1209
- @param unsubKey - The value returned from the 'subscribe' method may be used to unsubscribe here.
1210
- @return Whether unsubscription occured. This will return false if already unsubscribed or if the key simply
1211
- cannot be found.
1212
- **/
1213
- this.unsubscribe = function (unsubKey) {
1214
- if (!this._subscribers)
1215
- return false;
1216
- let subs = this._subscribers;
1217
- let ix = core.arrayIndexOf(subs, function (s) {
1218
- return s.unsubKey === unsubKey;
1219
- });
1220
- if (ix !== -1) {
1221
- subs.splice(ix, 1);
1222
- if (subs.length === 0) {
1223
- this._subscribers = null;
1224
- }
1225
- return true;
1226
- }
1227
- else {
1228
- return false;
1229
- }
1230
- };
1231
1237
  assertParam(name, "eventName").isNonEmptyString().check();
1232
1238
  assertParam(publisher, "publisher").isObject().check();
1233
1239
  this.name = name;
@@ -1312,6 +1318,36 @@ class BreezeEvent {
1312
1318
  ++BreezeEvent.__nextUnsubKey;
1313
1319
  return unsubKey;
1314
1320
  }
1321
+ /**
1322
+ Unsubscribe from this event.
1323
+ > // Assume order is a preexisting 'order' entity
1324
+ > let token = order.entityAspect.propertyChanged.subscribe(function (pcEvent) {
1325
+ > // do something
1326
+ > });
1327
+ > // sometime later
1328
+ > order.entityAspect.propertyChanged.unsubscribe(token);
1329
+ @param unsubKey - The value returned from the 'subscribe' method may be used to unsubscribe here.
1330
+ @return Whether unsubscription occured. This will return false if already unsubscribed or if the key simply
1331
+ cannot be found.
1332
+ **/
1333
+ unsubscribe = function (unsubKey) {
1334
+ if (!this._subscribers)
1335
+ return false;
1336
+ let subs = this._subscribers;
1337
+ let ix = core.arrayIndexOf(subs, function (s) {
1338
+ return s.unsubKey === unsubKey;
1339
+ });
1340
+ if (ix !== -1) {
1341
+ subs.splice(ix, 1);
1342
+ if (subs.length === 0) {
1343
+ this._subscribers = null;
1344
+ }
1345
+ return true;
1346
+ }
1347
+ else {
1348
+ return false;
1349
+ }
1350
+ };
1315
1351
  /** remove all subscribers */
1316
1352
  clear() {
1317
1353
  this._subscribers = null;
@@ -1376,42 +1412,42 @@ class BreezeEvent {
1376
1412
  // return ctor._isEnabled(getFullEventName(eventName), obj);
1377
1413
  return BreezeEvent._isEnabled(eventName, 3);
1378
1414
  }
1379
- }
1380
- /** @hidden @internal */
1381
- BreezeEvent.__eventNameMap = {};
1382
- /** @hidden @internal */
1383
- BreezeEvent.__nextUnsubKey = 1;
1384
- /** @hidden @internal */
1385
- BreezeEvent._isEnabled = function (eventName, obj) {
1386
- let isEnabled = null;
1387
- let ob = obj;
1388
- let eventMap = ob._$eventMap;
1389
- if (eventMap) {
1390
- isEnabled = eventMap[eventName];
1391
- }
1392
- if (isEnabled != null) {
1393
- if (typeof isEnabled === 'function') {
1394
- return !!isEnabled(obj);
1395
- }
1396
- else {
1397
- return !!isEnabled;
1415
+ /** @hidden @internal */
1416
+ static _isEnabled = function (eventName, obj) {
1417
+ let isEnabled = null;
1418
+ let ob = obj;
1419
+ let eventMap = ob._$eventMap;
1420
+ if (eventMap) {
1421
+ isEnabled = eventMap[eventName];
1398
1422
  }
1399
- }
1400
- else {
1401
- let parent = ob._getEventParent && ob._getEventParent();
1402
- if (parent) {
1403
- return !!this._isEnabled(eventName, parent);
1423
+ if (isEnabled != null) {
1424
+ if (typeof isEnabled === 'function') {
1425
+ return !!isEnabled(obj);
1426
+ }
1427
+ else {
1428
+ return !!isEnabled;
1429
+ }
1404
1430
  }
1405
1431
  else {
1406
- // default if not explicitly disabled.
1407
- return true;
1432
+ let parent = ob._getEventParent && ob._getEventParent();
1433
+ if (parent) {
1434
+ return !!this._isEnabled(eventName, parent);
1435
+ }
1436
+ else {
1437
+ // default if not explicitly disabled.
1438
+ return true;
1439
+ }
1408
1440
  }
1409
- }
1410
- };
1441
+ };
1442
+ }
1411
1443
  // legacy support - deliberately not typed
1412
1444
  core.Event = BreezeEvent;
1413
1445
 
1414
1446
  class InterfaceDef {
1447
+ name;
1448
+ defaultInstance;
1449
+ /** @hidden @internal */
1450
+ _implMap;
1415
1451
  constructor(name) {
1416
1452
  this.name = name;
1417
1453
  this.defaultInstance = undefined;
@@ -1437,18 +1473,23 @@ class InterfaceDef {
1437
1473
  }
1438
1474
  }
1439
1475
  class BreezeConfig {
1476
+ functionRegistry = {};
1477
+ typeRegistry = {};
1478
+ objectRegistry = {};
1479
+ interfaceInitialized;
1480
+ stringifyPad = '';
1481
+ /** whether to prohibit eval() and Function() in breeze code */
1482
+ noEval;
1483
+ /** @hidden @internal */
1484
+ _interfaceRegistry; // will be set in adapter-interfaces. untyped here to avoid circularity issues.
1440
1485
  constructor() {
1441
- this.functionRegistry = {};
1442
- this.typeRegistry = {};
1443
- this.objectRegistry = {};
1444
- this.stringifyPad = '';
1445
1486
  this.interfaceInitialized = new BreezeEvent("interfaceInitialized", this);
1446
1487
  if (this.noEval === undefined) {
1447
1488
  try {
1448
1489
  Error['x'] = Function('');
1449
1490
  this.noEval = false; // eval succeeded
1450
1491
  }
1451
- catch (_a) {
1492
+ catch {
1452
1493
  this.noEval = true; // eval failed, probably due to CSP
1453
1494
  }
1454
1495
  }
@@ -1646,6 +1687,24 @@ anytime a MetadataStore.fetchMetadata call occurs with a new dataService ( or se
1646
1687
 
1647
1688
  **/
1648
1689
  class DataService {
1690
+ /** @hidden @internal */
1691
+ _$typeName; // actually put on prototype.
1692
+ /** The serviceName for this DataService. __Read Only__ **/
1693
+ serviceName;
1694
+ /** The adapter name for the [[IDataServiceAdapter]] to be used with this service. __Read Only__ **/
1695
+ adapterName;
1696
+ /** The [[IDataServiceAdapter]] implementation instance associated with this EntityManager. __Read Only__ **/
1697
+ adapterInstance;
1698
+ /** The adapter name for the [[IUriBuilderAdapter]] to be used with this service. __Read Only__ **/
1699
+ uriBuilderName;
1700
+ /** The [[IUriBuilderAdapter]] implementation instance associated with this EntityManager. __Read Only__ **/
1701
+ uriBuilder;
1702
+ /** Whether the server can provide metadata for this service. __Read Only__ **/
1703
+ hasServerMetadata;
1704
+ /** The [[JsonResultsAdapter]] used to process the results of any query against this DataService. __Read Only__ **/
1705
+ jsonResultsAdapter;
1706
+ /** Whether to use JSONP when performing a 'GET' request against this service. __Read Only__ **/
1707
+ useJsonp;
1649
1708
  /** DataService constructor
1650
1709
  > var dataService = new DataService({
1651
1710
  > serviceName: altServiceName,
@@ -1663,7 +1722,7 @@ class DataService {
1663
1722
  @param config - A configuration object.
1664
1723
  **/
1665
1724
  constructor(config) {
1666
- updateWithConfig(this, config);
1725
+ updateWithConfig$1(this, config);
1667
1726
  }
1668
1727
  /**
1669
1728
  Returns a copy of this DataService with the specified properties applied.
@@ -1673,7 +1732,7 @@ class DataService {
1673
1732
  if (!config)
1674
1733
  return this;
1675
1734
  let result = new DataService(this);
1676
- return updateWithConfig(result, config);
1735
+ return updateWithConfig$1(result, config);
1677
1736
  }
1678
1737
  static resolve(dataServices) {
1679
1738
  // final defaults
@@ -1744,7 +1803,7 @@ class DataService {
1744
1803
  }
1745
1804
  }
1746
1805
  DataService.prototype._$typeName = "DataService";
1747
- function updateWithConfig(obj, dsConfig) {
1806
+ function updateWithConfig$1(obj, dsConfig) {
1748
1807
  if (dsConfig) {
1749
1808
  assertConfig(dsConfig)
1750
1809
  .whereParam("serviceName").isOptional()
@@ -1765,6 +1824,24 @@ A JsonResultsAdapter instance is used to provide custom extraction and parsing l
1765
1824
  This facility makes it possible for breeze to talk to virtually any web service and return objects that will be first class 'breeze' citizens.
1766
1825
  **/
1767
1826
  class JsonResultsAdapter {
1827
+ /** @hidden @internal */
1828
+ _$typeName; // actually put on prototype.
1829
+ /** The name of this adapter. This name is used to uniquely identify and locate this instance when an 'exported' JsonResultsAdapter is later imported. */
1830
+ name;
1831
+ /** A Function that is called once per query operation to extract the 'payload' from any json received over the wire.
1832
+ This method has a default implementation which simply returns the "results" property from any json returned as a result of executing the query. */
1833
+ extractResults; // TODO - refine
1834
+ /** A function that is called once per save operation to extract the entities from any json received over the wire. Must return an array.
1835
+ This method has a default implementation which simply returns the "entities" property from any json returned as a result of executing the save. */
1836
+ extractSaveResults;
1837
+ /** A function that is called once per save operation to extract the key mappings from any json received over the wire. Must return an array.
1838
+ This method has a default implementation which simply returns the "keyMappings" property from any json returned as a result of executing the save. */
1839
+ extractKeyMappings;
1840
+ /** A function that is called once per save operation to extract any deleted keys from any json received over the wire. Must return an array.
1841
+ This method has a default implementation which is to simply returns the "deletedKeys" property from any json returned as a result of executing the save. */
1842
+ extractDeletedKeys; // TODO: refine
1843
+ /** A visitor method that will be called on each node of the returned payload. */
1844
+ visitNode;
1768
1845
  /**
1769
1846
  JsonResultsAdapter constructor
1770
1847
 
@@ -1837,17 +1914,16 @@ const INT32_MIN = -2147483648;
1837
1914
  const INT32_MAX = 2147483647;
1838
1915
  const BYTE_MIN = 0;
1839
1916
  const BYTE_MAX = 255;
1840
- const ɵ0$1 = function (context) {
1841
- if (context.property) {
1842
- return context.property.resolveProperty("displayName") || context.propertyName || context.property.name;
1843
- }
1844
- else {
1845
- return "Value";
1846
- }
1847
- };
1848
1917
  // add common props and methods for every validator 'context' here.
1849
1918
  let rootContext = {
1850
- displayName: ɵ0$1
1919
+ displayName: function (context) {
1920
+ if (context.property) {
1921
+ return context.property.resolveProperty("displayName") || context.propertyName || context.property.name;
1922
+ }
1923
+ else {
1924
+ return "Value";
1925
+ }
1926
+ }
1851
1927
  };
1852
1928
  /**
1853
1929
  Instances of the Validator class provide the logic to validate another object and provide a description of any errors
@@ -1985,6 +2061,13 @@ of additional properties that will be automatically added to this object if not
1985
2061
  @dynamic
1986
2062
  **/
1987
2063
  class Validator {
2064
+ /** @hidden @internal */
2065
+ _$typeName; // on proto
2066
+ name;
2067
+ valFn;
2068
+ context;
2069
+ currentContext;
2070
+ _baseContext;
1988
2071
  constructor(name, valFn, context) {
1989
2072
  // _baseContext is what will get serialized
1990
2073
  this._baseContext = context || {};
@@ -2133,491 +2216,491 @@ class Validator {
2133
2216
  static registerFactory(validatorFactory, name) {
2134
2217
  config.registerFunction(validatorFactory, "Validator." + name);
2135
2218
  }
2136
- }
2137
- /**
2138
- Map of standard error message templates keyed by validator name.
2139
- You can add to or modify this object to customize the template used for any validation error message.
2140
- @example
2141
- // v is this function is the value to be validated, in this case a "country" string.
2142
- var valFn = function (v) {
2143
- if (v == null) return true;
2144
- return (core.stringStartsWith(v, "US"));
2219
+ /**
2220
+ Map of standard error message templates keyed by validator name.
2221
+ You can add to or modify this object to customize the template used for any validation error message.
2222
+ @example
2223
+ // v is this function is the value to be validated, in this case a "country" string.
2224
+ var valFn = function (v) {
2225
+ if (v == null) return true;
2226
+ return (core.stringStartsWith(v, "US"));
2227
+ };
2228
+ var countryValidator = new Validator("countryIsUS", valFn, { displayName: "Country" });
2229
+ Validator.messageTemplates.countryIsUS = "'%displayName%' must start with 'US'";
2230
+ // This will have a similar effect to this
2231
+ var countryValidator = new Validator("countryIsUS", valFn, {
2232
+ displayName: "Country",
2233
+ messageTemplate: "'%displayName%' must start with 'US'"
2234
+ });
2235
+ @property messageTemplates {Object}
2236
+ @static
2237
+ **/
2238
+ static messageTemplates = {
2239
+ bool: "'%displayName%' must be a 'true' or 'false' value",
2240
+ creditCard: "The %displayName% is not a valid credit card number",
2241
+ date: "'%displayName%' must be a date",
2242
+ duration: "'%displayName%' must be a ISO8601 duration string, such as 'P3H24M60S'",
2243
+ emailAddress: "The %displayName% '%value%' is not a valid email address",
2244
+ guid: "'%displayName%' must be a GUID",
2245
+ integer: "'%displayName%' must be an integer",
2246
+ integerRange: "'%displayName%' must be an integer between the values of %minValue% and %maxValue%",
2247
+ maxLength: "'%displayName%' must be a string with %maxLength% characters or less",
2248
+ number: "'%displayName%' must be a number",
2249
+ phone: "The %displayName% '%value%' is not a valid phone number",
2250
+ regularExpression: "The %displayName% '%value%' does not match '%expression%'",
2251
+ required: "'%displayName%' is required",
2252
+ string: "'%displayName%' must be a string",
2253
+ stringLength: "'%displayName%' must be a string with between %minLength% and %maxLength% characters",
2254
+ url: "The %displayName% '%value%' is not a valid url"
2145
2255
  };
2146
- var countryValidator = new Validator("countryIsUS", valFn, { displayName: "Country" });
2147
- Validator.messageTemplates.countryIsUS = "'%displayName%' must start with 'US'";
2148
- // This will have a similar effect to this
2149
- var countryValidator = new Validator("countryIsUS", valFn, {
2150
- displayName: "Country",
2151
- messageTemplate: "'%displayName%' must start with 'US'"
2152
- });
2153
- @property messageTemplates {Object}
2154
- @static
2155
- **/
2156
- Validator.messageTemplates = {
2157
- bool: "'%displayName%' must be a 'true' or 'false' value",
2158
- creditCard: "The %displayName% is not a valid credit card number",
2159
- date: "'%displayName%' must be a date",
2160
- duration: "'%displayName%' must be a ISO8601 duration string, such as 'P3H24M60S'",
2161
- emailAddress: "The %displayName% '%value%' is not a valid email address",
2162
- guid: "'%displayName%' must be a GUID",
2163
- integer: "'%displayName%' must be an integer",
2164
- integerRange: "'%displayName%' must be an integer between the values of %minValue% and %maxValue%",
2165
- maxLength: "'%displayName%' must be a string with %maxLength% characters or less",
2166
- number: "'%displayName%' must be a number",
2167
- phone: "The %displayName% '%value%' is not a valid phone number",
2168
- regularExpression: "The %displayName% '%value%' does not match '%expression%'",
2169
- required: "'%displayName%' is required",
2170
- string: "'%displayName%' must be a string",
2171
- stringLength: "'%displayName%' must be a string with between %minLength% and %maxLength% characters",
2172
- url: "The %displayName% '%value%' is not a valid url"
2173
- };
2174
- /**
2175
- Returns a standard 'required value' Validator
2176
- @example
2177
- // Assume em1 is a preexisting EntityManager.
2178
- var custType = em1.metadataStore.getEntityType("Customer");
2179
- var regionProperty - custType.getProperty("Region");
2180
- // Makes "Region" on Customer a required property.
2181
- regionProperty.validators.push(Validator.required());
2182
- // or to allow empty strings
2183
- regionProperty.validators.push(Validator.required({ allowEmptyStrings: true }););
2184
- @method required
2185
- @static
2186
- @param context {Object}
2187
- @param [context.allowEmptyStrings] {Boolean} If this parameter is omitted or false then empty strings do NOT pass validation.
2188
- @return {Validator} A new Validator
2189
- **/
2190
- Validator.required = function (context) {
2191
- let valFn = function (v, ctx) {
2192
- if (typeof v === "string") {
2193
- if (ctx && ctx.allowEmptyStrings)
2256
+ /**
2257
+ Returns a standard 'required value' Validator
2258
+ @example
2259
+ // Assume em1 is a preexisting EntityManager.
2260
+ var custType = em1.metadataStore.getEntityType("Customer");
2261
+ var regionProperty - custType.getProperty("Region");
2262
+ // Makes "Region" on Customer a required property.
2263
+ regionProperty.validators.push(Validator.required());
2264
+ // or to allow empty strings
2265
+ regionProperty.validators.push(Validator.required({ allowEmptyStrings: true }););
2266
+ @method required
2267
+ @static
2268
+ @param context {Object}
2269
+ @param [context.allowEmptyStrings] {Boolean} If this parameter is omitted or false then empty strings do NOT pass validation.
2270
+ @return {Validator} A new Validator
2271
+ **/
2272
+ static required = function (context) {
2273
+ let valFn = function (v, ctx) {
2274
+ if (typeof v === "string") {
2275
+ if (ctx && ctx.allowEmptyStrings)
2276
+ return true;
2277
+ return v.length > 0;
2278
+ }
2279
+ else {
2280
+ return v != null;
2281
+ }
2282
+ };
2283
+ return new Validator("required", valFn, context);
2284
+ };
2285
+ /**
2286
+ Returns a standard maximum string length Validator; the maximum length must be specified
2287
+ @example
2288
+ // Assume em1 is a preexisting EntityManager.
2289
+ var custType = em1.metadataStore.getEntityType("Customer");
2290
+ var regionProperty - custType.getProperty("Region");
2291
+ // Validates that the value of the Region property on Customer will be less than or equal to 5 characters.
2292
+ regionProperty.validators.push(Validator.maxLength( {maxLength: 5}));
2293
+ @method maxLength
2294
+ @static
2295
+ @param context {Object}
2296
+ @param context.maxLength {Integer}
2297
+ @return {Validator} A new Validator
2298
+ **/
2299
+ static maxLength = function (context) {
2300
+ let valFn = function (v, ctx) {
2301
+ if (v == null)
2194
2302
  return true;
2195
- return v.length > 0;
2196
- }
2197
- else {
2198
- return v != null;
2199
- }
2303
+ if (typeof (v) !== "string")
2304
+ return false;
2305
+ return v.length <= ctx.maxLength;
2306
+ };
2307
+ return new Validator("maxLength", valFn, context);
2200
2308
  };
2201
- return new Validator("required", valFn, context);
2202
- };
2203
- /**
2204
- Returns a standard maximum string length Validator; the maximum length must be specified
2205
- @example
2206
- // Assume em1 is a preexisting EntityManager.
2207
- var custType = em1.metadataStore.getEntityType("Customer");
2208
- var regionProperty - custType.getProperty("Region");
2209
- // Validates that the value of the Region property on Customer will be less than or equal to 5 characters.
2210
- regionProperty.validators.push(Validator.maxLength( {maxLength: 5}));
2211
- @method maxLength
2212
- @static
2213
- @param context {Object}
2214
- @param context.maxLength {Integer}
2215
- @return {Validator} A new Validator
2216
- **/
2217
- Validator.maxLength = function (context) {
2218
- let valFn = function (v, ctx) {
2219
- if (v == null)
2309
+ /**
2310
+ Returns a standard string length Validator; both minimum and maximum lengths must be specified.
2311
+ @example
2312
+ // Assume em1 is a preexisting EntityManager.
2313
+ var custType = em1.metadataStore.getEntityType("Customer");
2314
+ var regionProperty - custType.getProperty("Region");
2315
+ // Validates that the value of the Region property on Customer will be
2316
+ // between 2 and 5 characters
2317
+ regionProperty.validators.push(Validator.stringLength( {minLength: 2, maxLength: 5});
2318
+ @method stringLength
2319
+ @static
2320
+ @param context {Object}
2321
+ @param context.maxLength {Integer}
2322
+ @param context.minLength {Integer}
2323
+ @return {Validator} A new Validator
2324
+ **/
2325
+ static stringLength = function (context) {
2326
+ let valFn = function (v, ctx) {
2327
+ if (v == null)
2328
+ return true;
2329
+ if (typeof (v) !== "string")
2330
+ return false;
2331
+ if (ctx.minLength != null && v.length < ctx.minLength)
2332
+ return false;
2333
+ if (ctx.maxLength != null && v.length > ctx.maxLength)
2334
+ return false;
2220
2335
  return true;
2221
- if (typeof (v) !== "string")
2222
- return false;
2223
- return v.length <= ctx.maxLength;
2336
+ };
2337
+ return new Validator("stringLength", valFn, context);
2224
2338
  };
2225
- return new Validator("maxLength", valFn, context);
2226
- };
2227
- /**
2228
- Returns a standard string length Validator; both minimum and maximum lengths must be specified.
2229
- @example
2230
- // Assume em1 is a preexisting EntityManager.
2231
- var custType = em1.metadataStore.getEntityType("Customer");
2232
- var regionProperty - custType.getProperty("Region");
2233
- // Validates that the value of the Region property on Customer will be
2234
- // between 2 and 5 characters
2235
- regionProperty.validators.push(Validator.stringLength( {minLength: 2, maxLength: 5});
2236
- @method stringLength
2237
- @static
2238
- @param context {Object}
2239
- @param context.maxLength {Integer}
2240
- @param context.minLength {Integer}
2241
- @return {Validator} A new Validator
2242
- **/
2243
- Validator.stringLength = function (context) {
2244
- let valFn = function (v, ctx) {
2245
- if (v == null)
2246
- return true;
2247
- if (typeof (v) !== "string")
2248
- return false;
2249
- if (ctx.minLength != null && v.length < ctx.minLength)
2250
- return false;
2251
- if (ctx.maxLength != null && v.length > ctx.maxLength)
2252
- return false;
2253
- return true;
2339
+ /**
2340
+ Returns a standard string dataType Validator.
2341
+ @example
2342
+ // Assume em1 is a preexisting EntityManager.
2343
+ var custType = em1.metadataStore.getEntityType("Customer");
2344
+ var regionProperty - custType.getProperty("Region");
2345
+ // Validates that the value of the Region property on Customer is a string.
2346
+ regionProperty.validators.push(Validator.string());
2347
+ @method string
2348
+ @static
2349
+ @return {Validator} A new Validator
2350
+ **/
2351
+ static string = function () {
2352
+ let valFn = function (v) {
2353
+ if (v == null)
2354
+ return true;
2355
+ return (typeof v === "string");
2356
+ };
2357
+ return new Validator("string", valFn);
2254
2358
  };
2255
- return new Validator("stringLength", valFn, context);
2256
- };
2257
- /**
2258
- Returns a standard string dataType Validator.
2259
- @example
2260
- // Assume em1 is a preexisting EntityManager.
2261
- var custType = em1.metadataStore.getEntityType("Customer");
2262
- var regionProperty - custType.getProperty("Region");
2263
- // Validates that the value of the Region property on Customer is a string.
2264
- regionProperty.validators.push(Validator.string());
2265
- @method string
2266
- @static
2267
- @return {Validator} A new Validator
2268
- **/
2269
- Validator.string = function () {
2270
- let valFn = function (v) {
2271
- if (v == null)
2272
- return true;
2273
- return (typeof v === "string");
2359
+ /**
2360
+ Returns a Guid data type Validator.
2361
+ @example
2362
+ // Assume em1 is a preexisting EntityManager.
2363
+ var custType = em1.metadataStore.getEntityType("Customer");
2364
+ var customerIdProperty - custType.getProperty("CustomerID");
2365
+ // Validates that the value of the CustomerID property on Customer is a Guid.
2366
+ customerIdProperty.validators.push(Validator.guid());
2367
+ @method guid
2368
+ @static
2369
+ @return {Validator} A new Validator
2370
+ **/
2371
+ static guid = function () {
2372
+ let valFn = function (v) {
2373
+ if (v == null)
2374
+ return true;
2375
+ return core.isGuid(v);
2376
+ };
2377
+ return new Validator("guid", valFn);
2274
2378
  };
2275
- return new Validator("string", valFn);
2276
- };
2277
- /**
2278
- Returns a Guid data type Validator.
2279
- @example
2280
- // Assume em1 is a preexisting EntityManager.
2281
- var custType = em1.metadataStore.getEntityType("Customer");
2282
- var customerIdProperty - custType.getProperty("CustomerID");
2283
- // Validates that the value of the CustomerID property on Customer is a Guid.
2284
- customerIdProperty.validators.push(Validator.guid());
2285
- @method guid
2286
- @static
2287
- @return {Validator} A new Validator
2288
- **/
2289
- Validator.guid = function () {
2290
- let valFn = function (v) {
2291
- if (v == null)
2292
- return true;
2293
- return core.isGuid(v);
2379
+ /**
2380
+ Returns a ISO 8601 duration string Validator.
2381
+ @example
2382
+ // Assume em1 is a preexisting EntityManager.
2383
+ var eventType = em1.metadataStore.getEntityType("Event");
2384
+ var elapsedTimeProperty - eventType.getProperty("ElapsedTime");
2385
+ // Validates that the value of the ElapsedTime property on Customer is a duration.
2386
+ elapsedTimeProperty.validators.push(Validator.duration());
2387
+ @method duration
2388
+ @static
2389
+ @return {Validator} A new Validator
2390
+ **/
2391
+ static duration = function () {
2392
+ let valFn = function (v) {
2393
+ if (v == null)
2394
+ return true;
2395
+ return core.isDuration(v);
2396
+ };
2397
+ return new Validator("duration", valFn);
2294
2398
  };
2295
- return new Validator("guid", valFn);
2296
- };
2297
- /**
2298
- Returns a ISO 8601 duration string Validator.
2299
- @example
2300
- // Assume em1 is a preexisting EntityManager.
2301
- var eventType = em1.metadataStore.getEntityType("Event");
2302
- var elapsedTimeProperty - eventType.getProperty("ElapsedTime");
2303
- // Validates that the value of the ElapsedTime property on Customer is a duration.
2304
- elapsedTimeProperty.validators.push(Validator.duration());
2305
- @method duration
2306
- @static
2307
- @return {Validator} A new Validator
2308
- **/
2309
- Validator.duration = function () {
2310
- let valFn = function (v) {
2311
- if (v == null)
2312
- return true;
2313
- return core.isDuration(v);
2399
+ /**
2400
+ Returns a standard numeric data type Validator.
2401
+ @example
2402
+ // Assume em1 is a preexisting EntityManager.
2403
+ var orderType = em1.metadataStore.getEntityType("Order");
2404
+ var freightProperty - orderType.getProperty("Freight");
2405
+ // Validates that the value of the Freight property on Order is a number.
2406
+ freightProperty.validators.push(Validator.number());
2407
+ @method number
2408
+ @static
2409
+ @return {Validator} A new Validator
2410
+ **/
2411
+ // TODO: may need to have seperate logic for single.
2412
+ static number = function (context) {
2413
+ let valFn = function (v, ctx) {
2414
+ if (v == null)
2415
+ return true;
2416
+ if (typeof v === "string" && ctx && ctx.allowString) {
2417
+ v = parseFloat(v);
2418
+ }
2419
+ return (typeof v === "number" && !isNaN(v));
2420
+ };
2421
+ return new Validator("number", valFn, context);
2314
2422
  };
2315
- return new Validator("duration", valFn);
2316
- };
2317
- /**
2318
- Returns a standard numeric data type Validator.
2319
- @example
2320
- // Assume em1 is a preexisting EntityManager.
2321
- var orderType = em1.metadataStore.getEntityType("Order");
2322
- var freightProperty - orderType.getProperty("Freight");
2323
- // Validates that the value of the Freight property on Order is a number.
2324
- freightProperty.validators.push(Validator.number());
2325
- @method number
2326
- @static
2327
- @return {Validator} A new Validator
2328
- **/
2329
- // TODO: may need to have seperate logic for single.
2330
- Validator.number = function (context) {
2331
- let valFn = function (v, ctx) {
2332
- if (v == null)
2333
- return true;
2334
- if (typeof v === "string" && ctx && ctx.allowString) {
2335
- v = parseFloat(v);
2336
- }
2337
- return (typeof v === "number" && !isNaN(v));
2423
+ static double = Validator.number;
2424
+ static single = Validator.number;
2425
+ /**
2426
+ Returns a standard large integer data type - 64 bit - Validator.
2427
+ @example
2428
+ // Assume em1 is a preexisting EntityManager.
2429
+ var orderType = em1.metadataStore.getEntityType("Order");
2430
+ var freightProperty - orderType.getProperty("Freight");
2431
+ // Validates that the value of the Freight property on Order is within the range of a 64 bit integer.
2432
+ freightProperty.validators.push(Validator.int64());
2433
+ @method int64
2434
+ @static
2435
+ @return {Validator} A new Validator
2436
+ **/
2437
+ static integer = function (context) {
2438
+ let valFn = function (v, ctx) {
2439
+ if (v == null)
2440
+ return true;
2441
+ if (typeof v === "string" && ctx && ctx.allowString) {
2442
+ v = parseInt(v, 10);
2443
+ }
2444
+ return (typeof v === "number") && (!isNaN(v)) && Math.floor(v) === v;
2445
+ };
2446
+ return new Validator("integer", valFn, context);
2338
2447
  };
2339
- return new Validator("number", valFn, context);
2340
- };
2341
- Validator.double = Validator.number;
2342
- Validator.single = Validator.number;
2343
- /**
2344
- Returns a standard large integer data type - 64 bit - Validator.
2345
- @example
2346
- // Assume em1 is a preexisting EntityManager.
2347
- var orderType = em1.metadataStore.getEntityType("Order");
2348
- var freightProperty - orderType.getProperty("Freight");
2349
- // Validates that the value of the Freight property on Order is within the range of a 64 bit integer.
2350
- freightProperty.validators.push(Validator.int64());
2351
- @method int64
2352
- @static
2353
- @return {Validator} A new Validator
2354
- **/
2355
- Validator.integer = function (context) {
2356
- let valFn = function (v, ctx) {
2357
- if (v == null)
2358
- return true;
2359
- if (typeof v === "string" && ctx && ctx.allowString) {
2360
- v = parseInt(v, 10);
2361
- }
2362
- return (typeof v === "number") && (!isNaN(v)) && Math.floor(v) === v;
2448
+ static int64 = Validator.integer;
2449
+ /**
2450
+ Returns a standard 32 bit integer data type Validator.
2451
+ @example
2452
+ // Assume em1 is a preexisting EntityManager.
2453
+ var orderType = em1.metadataStore.getEntityType("Order");
2454
+ var freightProperty - orderType.getProperty("Freight");
2455
+ freightProperty.validators.push(Validator.int32());
2456
+ @method int32
2457
+ @static
2458
+ @return {Validator} A new Validator
2459
+ **/
2460
+ static int32 = function (context) {
2461
+ return intRangeValidatorCtor("int32", INT32_MIN, INT32_MAX, context)();
2363
2462
  };
2364
- return new Validator("integer", valFn, context);
2365
- };
2366
- Validator.int64 = Validator.integer;
2367
- /**
2368
- Returns a standard 32 bit integer data type Validator.
2369
- @example
2370
- // Assume em1 is a preexisting EntityManager.
2371
- var orderType = em1.metadataStore.getEntityType("Order");
2372
- var freightProperty - orderType.getProperty("Freight");
2373
- freightProperty.validators.push(Validator.int32());
2374
- @method int32
2375
- @static
2376
- @return {Validator} A new Validator
2377
- **/
2378
- Validator.int32 = function (context) {
2379
- return intRangeValidatorCtor("int32", INT32_MIN, INT32_MAX, context)();
2380
- };
2381
- /**
2382
- Returns a standard 16 bit integer data type Validator.
2383
- @example
2384
- // Assume em1 is a preexisting EntityManager.
2385
- var orderType = em1.metadataStore.getEntityType("Order");
2386
- var freightProperty - orderType.getProperty("Freight");
2387
- // Validates that the value of the Freight property on Order is within the range of a 16 bit integer.
2388
- freightProperty.validators.push(Validator.int16());
2389
- @method int16
2390
- @static
2391
- @return {Validator} A new Validator
2392
- **/
2393
- Validator.int16 = function (context) {
2394
- return intRangeValidatorCtor("int16", INT16_MIN, INT16_MAX, context)();
2395
- };
2396
- /**
2397
- Returns a standard byte data type Validator. (This is a integer between 0 and 255 inclusive for js purposes).
2398
- @example
2399
- // Assume em1 is a preexisting EntityManager.
2400
- var orderType = em1.metadataStore.getEntityType("Order");
2401
- var freightProperty - orderType.getProperty("Freight");
2402
- // Validates that the value of the Freight property on Order is within the range of a 16 bit integer.
2403
- // Probably not a very good validation to place on the Freight property.
2404
- regionProperty.validators.push(Validator.byte());
2405
- @method byte
2406
- @static
2407
- @return {Validator} A new Validator
2408
- **/
2409
- Validator.byte = function (context) {
2410
- return intRangeValidatorCtor("byte", BYTE_MIN, BYTE_MAX, context)();
2411
- };
2412
- /**
2413
- Returns a standard boolean data type Validator.
2414
- @example
2415
- // Assume em1 is a preexisting EntityManager.
2416
- var productType = em1.metadataStore.getEntityType("Product");
2417
- var discontinuedProperty - productType.getProperty("Discontinued");
2418
- // Validates that the value of the Discontinued property on Product is a boolean
2419
- discontinuedProperty.validators.push(Validator.bool());
2420
- @method bool
2421
- @static
2422
- @return {Validator} A new Validator
2423
- **/
2424
- Validator.bool = function () {
2425
- let valFn = function (v) {
2426
- if (v == null)
2427
- return true;
2428
- return (v === true) || (v === false);
2463
+ /**
2464
+ Returns a standard 16 bit integer data type Validator.
2465
+ @example
2466
+ // Assume em1 is a preexisting EntityManager.
2467
+ var orderType = em1.metadataStore.getEntityType("Order");
2468
+ var freightProperty - orderType.getProperty("Freight");
2469
+ // Validates that the value of the Freight property on Order is within the range of a 16 bit integer.
2470
+ freightProperty.validators.push(Validator.int16());
2471
+ @method int16
2472
+ @static
2473
+ @return {Validator} A new Validator
2474
+ **/
2475
+ static int16 = function (context) {
2476
+ return intRangeValidatorCtor("int16", INT16_MIN, INT16_MAX, context)();
2429
2477
  };
2430
- return new Validator("bool", valFn);
2431
- };
2432
- Validator.none = function () {
2433
- let valFn = function (v) {
2434
- return true;
2478
+ /**
2479
+ Returns a standard byte data type Validator. (This is a integer between 0 and 255 inclusive for js purposes).
2480
+ @example
2481
+ // Assume em1 is a preexisting EntityManager.
2482
+ var orderType = em1.metadataStore.getEntityType("Order");
2483
+ var freightProperty - orderType.getProperty("Freight");
2484
+ // Validates that the value of the Freight property on Order is within the range of a 16 bit integer.
2485
+ // Probably not a very good validation to place on the Freight property.
2486
+ regionProperty.validators.push(Validator.byte());
2487
+ @method byte
2488
+ @static
2489
+ @return {Validator} A new Validator
2490
+ **/
2491
+ static byte = function (context) {
2492
+ return intRangeValidatorCtor("byte", BYTE_MIN, BYTE_MAX, context)();
2435
2493
  };
2436
- return new Validator("none", valFn);
2437
- };
2438
- /**
2439
- Returns a standard date data type Validator.
2440
- @example
2441
- // Assume em1 is a preexisting EntityManager.
2442
- var orderType = em1.metadataStore.getEntityType("Order");
2443
- var orderDateProperty - orderType.getProperty("OrderDate");
2444
- // Validates that the value of the OrderDate property on Order is a date
2445
- // Probably not a very good validation to place on the Freight property.
2446
- orderDateProperty.validators.push(Validator.date());
2447
- @method date
2448
- @static
2449
- @return {Validator} A new Validator
2450
- **/
2451
- Validator.date = function () {
2452
- let valFn = function (v) {
2453
- if (v == null)
2494
+ /**
2495
+ Returns a standard boolean data type Validator.
2496
+ @example
2497
+ // Assume em1 is a preexisting EntityManager.
2498
+ var productType = em1.metadataStore.getEntityType("Product");
2499
+ var discontinuedProperty - productType.getProperty("Discontinued");
2500
+ // Validates that the value of the Discontinued property on Product is a boolean
2501
+ discontinuedProperty.validators.push(Validator.bool());
2502
+ @method bool
2503
+ @static
2504
+ @return {Validator} A new Validator
2505
+ **/
2506
+ static bool = function () {
2507
+ let valFn = function (v) {
2508
+ if (v == null)
2509
+ return true;
2510
+ return (v === true) || (v === false);
2511
+ };
2512
+ return new Validator("bool", valFn);
2513
+ };
2514
+ static none = function () {
2515
+ let valFn = function (v) {
2454
2516
  return true;
2455
- if (typeof v === "string") {
2517
+ };
2518
+ return new Validator("none", valFn);
2519
+ };
2520
+ /**
2521
+ Returns a standard date data type Validator.
2522
+ @example
2523
+ // Assume em1 is a preexisting EntityManager.
2524
+ var orderType = em1.metadataStore.getEntityType("Order");
2525
+ var orderDateProperty - orderType.getProperty("OrderDate");
2526
+ // Validates that the value of the OrderDate property on Order is a date
2527
+ // Probably not a very good validation to place on the Freight property.
2528
+ orderDateProperty.validators.push(Validator.date());
2529
+ @method date
2530
+ @static
2531
+ @return {Validator} A new Validator
2532
+ **/
2533
+ static date = function () {
2534
+ let valFn = function (v) {
2535
+ if (v == null)
2536
+ return true;
2537
+ if (typeof v === "string") {
2538
+ try {
2539
+ return !isNaN(Date.parse(v));
2540
+ // old code
2541
+ // return __isDate(new Date(v));
2542
+ }
2543
+ catch (e) {
2544
+ return false;
2545
+ }
2546
+ }
2547
+ else {
2548
+ return core.isDate(v);
2549
+ }
2550
+ };
2551
+ return new Validator("date", valFn);
2552
+ };
2553
+ /**
2554
+ Returns a credit card number validator
2555
+ Performs a luhn algorithm checksum test for plausability
2556
+ catches simple mistakes; only service knows for sure
2557
+ @example
2558
+ // Assume em is a preexisting EntityManager.
2559
+ var personType = em.metadataStore.getEntityType("Person");
2560
+ var creditCardProperty = personType.getProperty("creditCard");
2561
+ // Validates that the value of the Person.creditCard property is credit card.
2562
+ creditCardProperty.validators.push(Validator.creditCard());
2563
+ @method creditCard
2564
+ @static
2565
+ @param [context] {Object} optional parameters to pass through to validation constructor
2566
+ @return {Validator} A new Validator
2567
+ **/
2568
+ static creditCard = function (context) {
2569
+ function valFn(v) {
2570
+ if (v == null || v === '')
2571
+ return true;
2572
+ if (typeof (v) !== 'string')
2573
+ return false;
2574
+ v = v.replace(/(\-|\s)/g, ""); // remove dashes and spaces
2575
+ if (!v || /\D/.test(v))
2576
+ return false; // all digits, not empty
2577
+ return luhn(v);
2578
+ }
2579
+ return new Validator('creditCard', valFn, context);
2580
+ };
2581
+ /**
2582
+ Returns a regular expression validator; the expression must be specified
2583
+ @example
2584
+ // Add validator to a property. Assume em is a preexisting EntityManager.
2585
+ var customerType = em.metadataStore.getEntityType("Customer");
2586
+ var regionProperty = customerType.getProperty("Region");
2587
+ // Validates that the value of Customer.Region is 2 char uppercase alpha.
2588
+ regionProperty.validators.push(Validator.regularExpression( {expression: '^[A-Z]{2}$'} );
2589
+ @method regularExpression
2590
+ @static
2591
+ @param context {Object}
2592
+ @param context.expression {String} String form of the regular expression to apply
2593
+ @return {Validator} A new Validator
2594
+ **/
2595
+ static regularExpression = function (context) {
2596
+ function valFn(v, ctx) {
2597
+ // do not invalidate if empty; use a separate required test
2598
+ if (v == null || v === '')
2599
+ return true;
2600
+ if (typeof (v) !== 'string')
2601
+ return false;
2456
2602
  try {
2457
- return !isNaN(Date.parse(v));
2458
- // old code
2459
- // return __isDate(new Date(v));
2603
+ let re = new RegExp(ctx.expression);
2604
+ return re.test(v);
2460
2605
  }
2461
2606
  catch (e) {
2462
- return false;
2607
+ throw new Error('Missing or invalid expression parameter to regExp validator');
2463
2608
  }
2464
2609
  }
2465
- else {
2466
- return core.isDate(v);
2467
- }
2610
+ return new Validator('regularExpression', valFn, context);
2468
2611
  };
2469
- return new Validator("date", valFn);
2470
- };
2471
- /**
2472
- Returns a credit card number validator
2473
- Performs a luhn algorithm checksum test for plausability
2474
- catches simple mistakes; only service knows for sure
2475
- @example
2476
- // Assume em is a preexisting EntityManager.
2477
- var personType = em.metadataStore.getEntityType("Person");
2478
- var creditCardProperty = personType.getProperty("creditCard");
2479
- // Validates that the value of the Person.creditCard property is credit card.
2480
- creditCardProperty.validators.push(Validator.creditCard());
2481
- @method creditCard
2482
- @static
2483
- @param [context] {Object} optional parameters to pass through to validation constructor
2484
- @return {Validator} A new Validator
2485
- **/
2486
- Validator.creditCard = function (context) {
2487
- function valFn(v) {
2488
- if (v == null || v === '')
2489
- return true;
2490
- if (typeof (v) !== 'string')
2491
- return false;
2492
- v = v.replace(/(\-|\s)/g, ""); // remove dashes and spaces
2493
- if (!v || /\D/.test(v))
2494
- return false; // all digits, not empty
2495
- return luhn(v);
2496
- }
2497
- return new Validator('creditCard', valFn, context);
2498
- };
2499
- /**
2500
- Returns a regular expression validator; the expression must be specified
2501
- @example
2502
- // Add validator to a property. Assume em is a preexisting EntityManager.
2503
- var customerType = em.metadataStore.getEntityType("Customer");
2504
- var regionProperty = customerType.getProperty("Region");
2505
- // Validates that the value of Customer.Region is 2 char uppercase alpha.
2506
- regionProperty.validators.push(Validator.regularExpression( {expression: '^[A-Z]{2}$'} );
2507
- @method regularExpression
2508
- @static
2509
- @param context {Object}
2510
- @param context.expression {String} String form of the regular expression to apply
2511
- @return {Validator} A new Validator
2512
- **/
2513
- Validator.regularExpression = function (context) {
2514
- function valFn(v, ctx) {
2515
- // do not invalidate if empty; use a separate required test
2516
- if (v == null || v === '')
2517
- return true;
2518
- if (typeof (v) !== 'string')
2519
- return false;
2520
- try {
2521
- let re = new RegExp(ctx.expression);
2522
- return re.test(v);
2523
- }
2524
- catch (e) {
2525
- throw new Error('Missing or invalid expression parameter to regExp validator');
2526
- }
2527
- }
2528
- return new Validator('regularExpression', valFn, context);
2529
- };
2530
- /**
2531
- Returns the email address validator
2532
- @example
2533
- // Assume em is a preexisting EntityManager.
2534
- var personType = em.metadataStore.getEntityType("Person");
2535
- var emailProperty = personType.getProperty("email");
2536
- // Validates that the value of the Person.email property is an email address.
2537
- emailProperty.validators.push(Validator.emailAddress());
2538
- @method emailAddress
2539
- @static
2540
- @param [context] {Object} optional parameters to pass through to validation constructor
2541
- @return {Validator} A new Validator
2542
- **/
2543
- Validator.emailAddress = function (context) {
2544
- // See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/EmailAttribute.cs
2545
- let reEmailAddress = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
2546
- return makeRegExpValidator('emailAddress', reEmailAddress, null, context);
2547
- };
2548
- /**
2549
- Returns the phone validator
2550
- Provides basic assertions on the format and will help to eliminate most nonsense input
2551
- Matches:
2552
- International dialing prefix: {{}, +, 0, 0000} (with or without a trailing break character, if not '+': [-/. ])
2553
- > ((\+)|(0(\d+)?[-/.\s]))
2554
- Country code: {{}, 1, ..., 999} (with or without a trailing break character: [-/. ])
2555
- > [1-9]\d{,2}[-/.\s]?
2556
- Area code: {(0), ..., (000000), 0, ..., 000000} (with or without a trailing break character: [-/. ])
2557
- > ((\(\d{1,6}\)|\d{1,6})[-/.\s]?)?
2558
- Local: {0, ...}+ (with or without a trailing break character: [-/. ])
2559
- > (\d+[-/.\s]?)+\d+
2560
- @example
2561
- // Assume em is a preexisting EntityManager.
2562
- var customerType = em.metadataStore.getEntityType("Customer");
2563
- var phoneProperty = customerType.getProperty("phone");
2564
- // Validates that the value of the Customer.phone property is phone.
2565
- phoneProperty.validators.push(Validator.phone());
2566
- @method phone
2567
- @static
2568
- @param [context] {Object} optional parameters to pass through to validation constructor
2569
- @return {Validator} A new Validator
2570
- **/
2571
- Validator.phone = function (context) {
2572
- // See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/Expressions.cs
2573
- let rePhone = /^((\+|(0(\d+)?[-/.\s]?))[1-9]\d{0,2}[-/.\s]?)?((\(\d{1,6}\)|\d{1,6})[-/.\s]?)?(\d+[-/.\s]?)+\d+$/;
2574
- return makeRegExpValidator('phone', rePhone, null, context);
2575
- };
2576
- /**
2577
- Returns the URL (protocol required) validator
2578
- @example
2579
- // Assume em is a preexisting EntityManager.
2580
- var personType = em.metadataStore.getEntityType("Person");
2581
- var websiteProperty = personType.getProperty("website");
2582
- // Validates that the value of the Person.website property is a URL.
2583
- websiteProperty.validators.push(Validator.url());
2584
- @method url
2585
- @static
2586
- @param [context] {Object} optional parameters to pass through to validation constructor
2587
- @return {Validator} A new Validator
2588
- **/
2589
- Validator.url = function (context) {
2590
- //See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/UrlAttribute.cs
2591
- let reUrlProtocolRequired = /^(https?|ftp):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|([a-zA-Z][\-a-zA-Z0-9]*)|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/;
2592
- return makeRegExpValidator('url', reUrlProtocolRequired, null, context);
2593
- };
2594
- /**
2595
- Creates a regular expression validator with a fixed expression.
2596
- Many of the stock validators are built with this factory method.
2597
- Their expressions are often derived from
2598
- https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions
2599
- You can try many of them at http://dataannotationsextensions.org/
2600
- @example
2601
- // Make a zipcode validator
2602
- function zipValidator = Validator.makeRegExpValidator(
2603
- "zipVal,
2604
- /^\d{5}([\-]\d{4})?$/,
2605
- "The %displayName% '%value%' is not a valid U.S. zipcode");
2606
- // Register it.
2607
- Validator.register(zipValidator);
2608
- // Add it to a data property. Assume em is a preexisting EntityManager.
2609
- var custType = em.metadataStore.getEntityType("Customer");
2610
- var zipProperty = custType.getProperty("PostalCode");
2611
- zipProperty.validators.push(zipValidator);
2612
- @method makeRegExpValidator
2613
- @static
2614
- @param validatorName {String} name of this validator
2615
- @param expression {String | RegExp} regular expression to apply
2616
- @param [defaultMessage] {String} default message for failed validations
2617
- @param [context] {Object} optional parameters to pass through to validation constructor
2618
- @return {Validator} A new Validator
2619
- **/
2620
- Validator.makeRegExpValidator = makeRegExpValidator;
2612
+ /**
2613
+ Returns the email address validator
2614
+ @example
2615
+ // Assume em is a preexisting EntityManager.
2616
+ var personType = em.metadataStore.getEntityType("Person");
2617
+ var emailProperty = personType.getProperty("email");
2618
+ // Validates that the value of the Person.email property is an email address.
2619
+ emailProperty.validators.push(Validator.emailAddress());
2620
+ @method emailAddress
2621
+ @static
2622
+ @param [context] {Object} optional parameters to pass through to validation constructor
2623
+ @return {Validator} A new Validator
2624
+ **/
2625
+ static emailAddress = function (context) {
2626
+ // See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/EmailAttribute.cs
2627
+ let reEmailAddress = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
2628
+ return makeRegExpValidator('emailAddress', reEmailAddress, null, context);
2629
+ };
2630
+ /**
2631
+ Returns the phone validator
2632
+ Provides basic assertions on the format and will help to eliminate most nonsense input
2633
+ Matches:
2634
+ International dialing prefix: {{}, +, 0, 0000} (with or without a trailing break character, if not '+': [-/. ])
2635
+ > ((\+)|(0(\d+)?[-/.\s]))
2636
+ Country code: {{}, 1, ..., 999} (with or without a trailing break character: [-/. ])
2637
+ > [1-9]\d{,2}[-/.\s]?
2638
+ Area code: {(0), ..., (000000), 0, ..., 000000} (with or without a trailing break character: [-/. ])
2639
+ > ((\(\d{1,6}\)|\d{1,6})[-/.\s]?)?
2640
+ Local: {0, ...}+ (with or without a trailing break character: [-/. ])
2641
+ > (\d+[-/.\s]?)+\d+
2642
+ @example
2643
+ // Assume em is a preexisting EntityManager.
2644
+ var customerType = em.metadataStore.getEntityType("Customer");
2645
+ var phoneProperty = customerType.getProperty("phone");
2646
+ // Validates that the value of the Customer.phone property is phone.
2647
+ phoneProperty.validators.push(Validator.phone());
2648
+ @method phone
2649
+ @static
2650
+ @param [context] {Object} optional parameters to pass through to validation constructor
2651
+ @return {Validator} A new Validator
2652
+ **/
2653
+ static phone = function (context) {
2654
+ // See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/Expressions.cs
2655
+ let rePhone = /^((\+|(0(\d+)?[-/.\s]?))[1-9]\d{0,2}[-/.\s]?)?((\(\d{1,6}\)|\d{1,6})[-/.\s]?)?(\d+[-/.\s]?)+\d+$/;
2656
+ return makeRegExpValidator('phone', rePhone, null, context);
2657
+ };
2658
+ /**
2659
+ Returns the URL (protocol required) validator
2660
+ @example
2661
+ // Assume em is a preexisting EntityManager.
2662
+ var personType = em.metadataStore.getEntityType("Person");
2663
+ var websiteProperty = personType.getProperty("website");
2664
+ // Validates that the value of the Person.website property is a URL.
2665
+ websiteProperty.validators.push(Validator.url());
2666
+ @method url
2667
+ @static
2668
+ @param [context] {Object} optional parameters to pass through to validation constructor
2669
+ @return {Validator} A new Validator
2670
+ **/
2671
+ static url = function (context) {
2672
+ //See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/UrlAttribute.cs
2673
+ let reUrlProtocolRequired = /^(https?|ftp):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|([a-zA-Z][\-a-zA-Z0-9]*)|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/;
2674
+ return makeRegExpValidator('url', reUrlProtocolRequired, null, context);
2675
+ };
2676
+ /**
2677
+ Creates a regular expression validator with a fixed expression.
2678
+ Many of the stock validators are built with this factory method.
2679
+ Their expressions are often derived from
2680
+ https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions
2681
+ You can try many of them at http://dataannotationsextensions.org/
2682
+ @example
2683
+ // Make a zipcode validator
2684
+ function zipValidator = Validator.makeRegExpValidator(
2685
+ "zipVal,
2686
+ /^\d{5}([\-]\d{4})?$/,
2687
+ "The %displayName% '%value%' is not a valid U.S. zipcode");
2688
+ // Register it.
2689
+ Validator.register(zipValidator);
2690
+ // Add it to a data property. Assume em is a preexisting EntityManager.
2691
+ var custType = em.metadataStore.getEntityType("Customer");
2692
+ var zipProperty = custType.getProperty("PostalCode");
2693
+ zipProperty.validators.push(zipValidator);
2694
+ @method makeRegExpValidator
2695
+ @static
2696
+ @param validatorName {String} name of this validator
2697
+ @param expression {String | RegExp} regular expression to apply
2698
+ @param [defaultMessage] {String} default message for failed validations
2699
+ @param [context] {Object} optional parameters to pass through to validation constructor
2700
+ @return {Validator} A new Validator
2701
+ **/
2702
+ static makeRegExpValidator = makeRegExpValidator;
2703
+ }
2621
2704
  Validator.prototype._$typeName = "Validator";
2622
2705
  // register all validators
2623
2706
  Error['x'] = core.objectForEach(Validator, function (key, value) {
@@ -2704,7 +2787,14 @@ function makeRegExpValidator(validatorName, expression, defaultMessage, context)
2704
2787
  };
2705
2788
  return new Validator(validatorName, valFn, context);
2706
2789
  }
2707
- const ɵ1 = function () {
2790
+ // http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers#JavaScript
2791
+ // function luhn(a: string, b: number, c: number, d: number, e: number) {
2792
+ // for (d = +a[b = a.length - 1], e = 0; b--; ) {
2793
+ // c = +a[b], d += ++e % 2 ? 2 * c % 10 + (c > 4) : c;
2794
+ // }
2795
+ // return !(d % 10);
2796
+ // };
2797
+ let luhn = (function () {
2708
2798
  let luhnArr = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9];
2709
2799
  return function (str) {
2710
2800
  let counter = 0;
@@ -2719,15 +2809,7 @@ const ɵ1 = function () {
2719
2809
  }
2720
2810
  return (counter % 10 === 0);
2721
2811
  };
2722
- };
2723
- // http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers#JavaScript
2724
- // function luhn(a: string, b: number, c: number, d: number, e: number) {
2725
- // for (d = +a[b = a.length - 1], e = 0; b--; ) {
2726
- // c = +a[b], d += ++e % 2 ? 2 * c % 10 + (c > 4) : c;
2727
- // }
2728
- // return !(d % 10);
2729
- // };
2730
- let luhn = (ɵ1)();
2812
+ })();
2731
2813
  /**
2732
2814
  A ValidationError is used to describe a failed validation.
2733
2815
 
@@ -2743,6 +2825,13 @@ Constructs a new ValidationError
2743
2825
  @param [key] {String} An optional key used to define a key for this error. One will be created automatically if not provided here.
2744
2826
  **/
2745
2827
  class ValidationError {
2828
+ validator;
2829
+ key;
2830
+ context;
2831
+ errorMessage;
2832
+ property; // IProperty
2833
+ propertyName;
2834
+ isServerError;
2746
2835
  constructor(validator, context, errorMessage, key) {
2747
2836
  // Error is with isInstanceOf(Validator)
2748
2837
  assertParam(validator, "validator").isOptional().isInstanceOf(Validator).check();
@@ -2824,6 +2913,131 @@ DataType is an 'Enum' containing all of the supported data types.
2824
2913
  @dynamic
2825
2914
  **/
2826
2915
  class DataType extends BreezeEnum {
2916
+ static parseDateFromServer = (value) => DataType.parseDateAsUTC(value);
2917
+ // same effect as above but doesn't give right TSDOC.
2918
+ // static parseDateFromServer = DataType.parseDateAsUTC;
2919
+ /** @hidden @internal */
2920
+ static constants;
2921
+ static String = new DataType({
2922
+ defaultValue: "",
2923
+ parse: coerceToString,
2924
+ fmtOData: fmtString,
2925
+ getNext: getNextString
2926
+ });
2927
+ static Int64 = new DataType({
2928
+ defaultValue: 0,
2929
+ isNumeric: true,
2930
+ isInteger: true,
2931
+ quoteJsonOData: true,
2932
+ parse: coerceToInt,
2933
+ fmtOData: makeFloatFmt("L"),
2934
+ getNext: getNextNumber
2935
+ });
2936
+ static Int32 = new DataType({
2937
+ defaultValue: 0,
2938
+ isNumeric: true,
2939
+ isInteger: true,
2940
+ parse: coerceToInt,
2941
+ fmtOData: fmtInt,
2942
+ getNext: getNextNumber
2943
+ });
2944
+ static Int16 = new DataType({
2945
+ defaultValue: 0,
2946
+ isNumeric: true,
2947
+ isInteger: true,
2948
+ parse: coerceToInt,
2949
+ fmtOData: fmtInt,
2950
+ getNext: getNextNumber
2951
+ });
2952
+ static Byte = new DataType({
2953
+ defaultValue: 0,
2954
+ isNumeric: true,
2955
+ isInteger: true,
2956
+ parse: coerceToInt,
2957
+ fmtOData: fmtInt
2958
+ });
2959
+ static Decimal = new DataType({
2960
+ defaultValue: 0,
2961
+ isNumeric: true,
2962
+ quoteJsonOData: true,
2963
+ isFloat: true,
2964
+ parse: coerceToFloat,
2965
+ fmtOData: makeFloatFmt("m"),
2966
+ getNext: getNextNumber
2967
+ });
2968
+ static Double = new DataType({
2969
+ defaultValue: 0,
2970
+ isNumeric: true,
2971
+ isFloat: true,
2972
+ parse: coerceToFloat,
2973
+ fmtOData: makeFloatFmt("d"),
2974
+ getNext: getNextNumber
2975
+ });
2976
+ static Single = new DataType({
2977
+ defaultValue: 0,
2978
+ isNumeric: true,
2979
+ isFloat: true,
2980
+ parse: coerceToFloat,
2981
+ fmtOData: makeFloatFmt("f"),
2982
+ getNext: getNextNumber
2983
+ });
2984
+ static DateOnly = new DataType({
2985
+ defaultValue: new Date(1900, 0, 1),
2986
+ isDate: true,
2987
+ parse: coerceToDateOnly,
2988
+ parseRawValue: parseRawDateOnly,
2989
+ normalize: function (value) { return value && value.getTime && (new Date(value.getYear(), value.getMonth(), value.getDate())).getTime(); },
2990
+ fmtOData: fmtDateOnly,
2991
+ getNext: getNextDateTime,
2992
+ getConcurrencyValue: getConcurrencyDateTime
2993
+ });
2994
+ static DateTime = new DataType({
2995
+ defaultValue: new Date(1900, 0, 1),
2996
+ isDate: true,
2997
+ parse: coerceToDate,
2998
+ parseRawValue: parseRawDate,
2999
+ normalize: function (value) { return value && value.getTime && value.getTime(); },
3000
+ fmtOData: fmtDateTime,
3001
+ getNext: getNextDateTime,
3002
+ getConcurrencyValue: getConcurrencyDateTime
3003
+ });
3004
+ static DateTimeOffset = new DataType({
3005
+ defaultValue: new Date(1900, 0, 1),
3006
+ isDate: true,
3007
+ parse: coerceToDate,
3008
+ parseRawValue: parseRawDate,
3009
+ normalize: function (value) { return value && value.getTime && value.getTime(); },
3010
+ fmtOData: fmtDateTimeOffset,
3011
+ getNext: getNextDateTime,
3012
+ getConcurrencyValue: getConcurrencyDateTime
3013
+ });
3014
+ static Time = new DataType({
3015
+ defaultValue: "PT0S",
3016
+ fmtOData: fmtTime,
3017
+ parseRawValue: DataType.parseTimeFromServer
3018
+ });
3019
+ static Boolean = new DataType({
3020
+ defaultValue: false,
3021
+ parse: coerceToBool,
3022
+ fmtOData: fmtBoolean
3023
+ });
3024
+ static Guid = new DataType({
3025
+ defaultValue: "00000000-0000-0000-0000-000000000000",
3026
+ parse: coerceToGuid,
3027
+ fmtOData: fmtGuid,
3028
+ getNext: getNextGuid,
3029
+ parseRawValue: function (val) { return val.toLowerCase(); },
3030
+ getConcurrencyValue: core.getUuid
3031
+ });
3032
+ static Binary = new DataType({
3033
+ defaultValue: null,
3034
+ fmtOData: fmtBinary,
3035
+ parseRawValue: parseRawBinary
3036
+ });
3037
+ static Undefined = new DataType({
3038
+ defaultValue: undefined,
3039
+ fmtOData: fmtUndefined
3040
+ });
2827
3041
  static getComparableFn(dataType) {
2828
3042
  if (dataType && dataType.normalize) {
2829
3043
  return dataType.normalize;
@@ -2906,6 +3120,21 @@ class DataType extends BreezeEnum {
2906
3120
  source = new Date(Date.parse(source));
2907
3121
  return source;
2908
3122
  }
3123
+ /** Parse as UTC then shift to local time */
3124
+ static parseDateAsLocal(source) {
3125
+ var dt = DataType.parseDateAsUTC(source);
3126
+ if (core.isDate(dt)) {
3127
+ dt = new Date(dt.getTime() + dt.getTimezoneOffset() * 60000);
3128
+ }
3129
+ return dt;
3130
+ }
3131
+ ;
3132
+ /** if val is a Date, return a date-only string e.g. '2023-12-31' */
3133
+ static toDateOnlyString(val) {
3134
+ // DateOnly types should not have time component, but JSON.stringify makes a full ISO string.
3135
+ // We convert it to string here to prevent that, and shift the time zone because toISOString converts to UTC.
3136
+ return val && val.getTime && new Date(val.getTime() - val.getTimezoneOffset() * 60000).toISOString().substring(0, 10) || val;
3137
+ }
2909
3138
  /** Returns a raw value converted to the specified DataType */
2910
3139
  static parseRawValue(val, dataType) {
2911
3140
  // undefined values will be the default for most unmapped properties EXCEPT when they are set
@@ -2929,117 +3158,6 @@ class DataType extends BreezeEnum {
2929
3158
  };
2930
3159
  }
2931
3160
  }
2932
- DataType.parseDateFromServer = (value) => DataType.parseDateAsUTC(value);
2933
- DataType.String = new DataType({
2934
- defaultValue: "",
2935
- parse: coerceToString,
2936
- fmtOData: fmtString,
2937
- getNext: getNextString
2938
- });
2939
- DataType.Int64 = new DataType({
2940
- defaultValue: 0,
2941
- isNumeric: true,
2942
- isInteger: true,
2943
- quoteJsonOData: true,
2944
- parse: coerceToInt,
2945
- fmtOData: makeFloatFmt("L"),
2946
- getNext: getNextNumber
2947
- });
2948
- DataType.Int32 = new DataType({
2949
- defaultValue: 0,
2950
- isNumeric: true,
2951
- isInteger: true,
2952
- parse: coerceToInt,
2953
- fmtOData: fmtInt,
2954
- getNext: getNextNumber
2955
- });
2956
- DataType.Int16 = new DataType({
2957
- defaultValue: 0,
2958
- isNumeric: true,
2959
- isInteger: true,
2960
- parse: coerceToInt,
2961
- fmtOData: fmtInt,
2962
- getNext: getNextNumber
2963
- });
2964
- DataType.Byte = new DataType({
2965
- defaultValue: 0,
2966
- isNumeric: true,
2967
- isInteger: true,
2968
- parse: coerceToInt,
2969
- fmtOData: fmtInt
2970
- });
2971
- DataType.Decimal = new DataType({
2972
- defaultValue: 0,
2973
- isNumeric: true,
2974
- quoteJsonOData: true,
2975
- isFloat: true,
2976
- parse: coerceToFloat,
2977
- fmtOData: makeFloatFmt("m"),
2978
- getNext: getNextNumber
2979
- });
2980
- DataType.Double = new DataType({
2981
- defaultValue: 0,
2982
- isNumeric: true,
2983
- isFloat: true,
2984
- parse: coerceToFloat,
2985
- fmtOData: makeFloatFmt("d"),
2986
- getNext: getNextNumber
2987
- });
2988
- DataType.Single = new DataType({
2989
- defaultValue: 0,
2990
- isNumeric: true,
2991
- isFloat: true,
2992
- parse: coerceToFloat,
2993
- fmtOData: makeFloatFmt("f"),
2994
- getNext: getNextNumber
2995
- });
2996
- DataType.DateTime = new DataType({
2997
- defaultValue: new Date(1900, 0, 1),
2998
- isDate: true,
2999
- parse: coerceToDate,
3000
- parseRawValue: parseRawDate,
3001
- normalize: function (value) { return value && value.getTime && value.getTime(); },
3002
- fmtOData: fmtDateTime,
3003
- getNext: getNextDateTime,
3004
- getConcurrencyValue: getConcurrencyDateTime
3005
- });
3006
- DataType.DateTimeOffset = new DataType({
3007
- defaultValue: new Date(1900, 0, 1),
3008
- isDate: true,
3009
- parse: coerceToDate,
3010
- parseRawValue: parseRawDate,
3011
- normalize: function (value) { return value && value.getTime && value.getTime(); },
3012
- fmtOData: fmtDateTimeOffset,
3013
- getNext: getNextDateTime,
3014
- getConcurrencyValue: getConcurrencyDateTime
3015
- });
3016
- DataType.Time = new DataType({
3017
- defaultValue: "PT0S",
3018
- fmtOData: fmtTime,
3019
- parseRawValue: DataType.parseTimeFromServer
3020
- });
3021
- DataType.Boolean = new DataType({
3022
- defaultValue: false,
3023
- parse: coerceToBool,
3024
- fmtOData: fmtBoolean
3025
- });
3026
- DataType.Guid = new DataType({
3027
- defaultValue: "00000000-0000-0000-0000-000000000000",
3028
- parse: coerceToGuid,
3029
- fmtOData: fmtGuid,
3030
- getNext: getNextGuid,
3031
- parseRawValue: function (val) { return val.toLowerCase(); },
3032
- getConcurrencyValue: core.getUuid
3033
- });
3034
- DataType.Binary = new DataType({
3035
- defaultValue: null,
3036
- fmtOData: fmtBinary,
3037
- parseRawValue: parseRawBinary
3038
- });
3039
- DataType.Undefined = new DataType({
3040
- defaultValue: undefined,
3041
- fmtOData: fmtUndefined
3042
- });
3043
3161
  DataType.prototype._$typeName = "DataType";
3044
3162
  Error['x'] = DataType._resetConstants();
3045
3163
  Error['x'] = DataType.resolveSymbols();
@@ -3136,13 +3254,27 @@ function coerceToFloat(source, sourceTypeName) {
3136
3254
  }
3137
3255
  return source;
3138
3256
  }
3139
- function coerceToDate(source, sourceTypeName) {
3257
+ function coerceToDate(source, sourceTypeName) {
3258
+ let val;
3259
+ if (sourceTypeName === "string") {
3260
+ let src = source.trim();
3261
+ if (src === "")
3262
+ return null;
3263
+ val = new Date(Date.parse(src));
3264
+ return core.isDate(val) ? val : source;
3265
+ }
3266
+ else if (sourceTypeName === "number") {
3267
+ val = new Date(source);
3268
+ return core.isDate(val) ? val : source;
3269
+ }
3270
+ return source;
3271
+ }
3272
+ /** Trim off time portion before parse if source is string */
3273
+ function coerceToDateOnly(source, sourceTypeName) {
3140
3274
  let val;
3141
3275
  if (sourceTypeName === "string") {
3142
3276
  let src = source.trim();
3143
- if (src === "")
3144
- return null;
3145
- val = new Date(Date.parse(src));
3277
+ val = DataType.parseDateAsLocal(val);
3146
3278
  return core.isDate(val) ? val : source;
3147
3279
  }
3148
3280
  else if (sourceTypeName === "number") {
@@ -3192,6 +3324,16 @@ function fmtDateTime(val) {
3192
3324
  throwError("'%1' is not a valid dateTime", val);
3193
3325
  }
3194
3326
  }
3327
+ function fmtDateOnly(val) {
3328
+ if (val == null)
3329
+ return null;
3330
+ try {
3331
+ return "date'" + val.toISOString().substring(0, 10) + "'";
3332
+ }
3333
+ catch (e) {
3334
+ throwError("'%1' is not a valid dateTime", val);
3335
+ }
3336
+ }
3195
3337
  function fmtDateTimeOffset(val) {
3196
3338
  if (val == null)
3197
3339
  return null;
@@ -3247,6 +3389,16 @@ function parseRawDate(val) {
3247
3389
  }
3248
3390
  return val;
3249
3391
  }
3392
+ /** Trim off time portion before parse */
3393
+ function parseRawDateOnly(val) {
3394
+ if (typeof val === 'string') {
3395
+ if (val.length > 10) {
3396
+ val = val.substring(0, 10);
3397
+ }
3398
+ val = DataType.parseDateAsLocal(val);
3399
+ }
3400
+ return val;
3401
+ }
3250
3402
  function parseRawBinary(val) {
3251
3403
  if (val && val.$value !== undefined) {
3252
3404
  val = val.$value; // this will be a byte[] encoded as a string
@@ -3263,6 +3415,16 @@ function parseRawBinary(val) {
3263
3415
  EntityState is an 'Enum' containing all of the valid states for an 'Entity'.
3264
3416
  **/
3265
3417
  class EntityState extends BreezeEnum {
3418
+ /** The 'Unchanged' state. **/
3419
+ static Unchanged = new EntityState();
3420
+ /** The 'Added' state. **/
3421
+ static Added = new EntityState();
3422
+ /** The 'Modified' state. **/
3423
+ static Modified = new EntityState();
3424
+ /** The 'Deleted' state. **/
3425
+ static Deleted = new EntityState();
3426
+ /** The 'Detached' state. **/
3427
+ static Detached = new EntityState();
3266
3428
  /**
3267
3429
  Returns whether an entityState instance is EntityState.Unchanged.
3268
3430
  > var es = anEntity.entityAspect.entityState;
@@ -3320,6 +3482,10 @@ class EntityState extends BreezeEnum {
3320
3482
  isDetached() {
3321
3483
  return this === EntityState.Detached;
3322
3484
  }
3485
+ /** Return true if EntityState is Deleted or Detached */
3486
+ isDeletedOrDetached() {
3487
+ return this === EntityState.Detached || this === EntityState.Detached;
3488
+ }
3323
3489
  /**
3324
3490
  Returns whether an entityState instance is EntityState.Unchanged or EntityState.Modified.
3325
3491
  > var es = anEntity.entityAspect.entityState;
@@ -3331,6 +3497,10 @@ class EntityState extends BreezeEnum {
3331
3497
  isUnchangedOrModified() {
3332
3498
  return this === EntityState.Unchanged || this === EntityState.Modified;
3333
3499
  }
3500
+ /** Return true if EntityStatis is Added or Modified */
3501
+ isAddedOrModified() {
3502
+ return this === EntityState.Added || this === EntityState.Modified;
3503
+ }
3334
3504
  /** Returns whether an entityState instance is EntityState.Added or EntityState.Modified or EntityState.Deleted.
3335
3505
  > var es = anEntity.entityAspect.entityState;
3336
3506
  > return es.isAddedModifiedOrDeleted();
@@ -3344,16 +3514,6 @@ class EntityState extends BreezeEnum {
3344
3514
  this === EntityState.Deleted;
3345
3515
  }
3346
3516
  }
3347
- /** The 'Unchanged' state. **/
3348
- EntityState.Unchanged = new EntityState();
3349
- /** The 'Added' state. **/
3350
- EntityState.Added = new EntityState();
3351
- /** The 'Modified' state. **/
3352
- EntityState.Modified = new EntityState();
3353
- /** The 'Deleted' state. **/
3354
- EntityState.Deleted = new EntityState();
3355
- /** The 'Detached' state. **/
3356
- EntityState.Detached = new EntityState();
3357
3517
  EntityState.prototype._$typeName = "EntityState";
3358
3518
  Error['x'] = EntityState.resolveSymbols();
3359
3519
 
@@ -3361,6 +3521,30 @@ Error['x'] = EntityState.resolveSymbols();
3361
3521
 
3362
3522
  */
3363
3523
  class EntityAction extends BreezeEnum {
3524
+ /** Entity was attached via an AttachEntity call. */
3525
+ static Attach = new EntityAction({ _isAttach: true });
3526
+ /** Entity was attached as a result of a query. */
3527
+ static AttachOnQuery = new EntityAction({ _isAttach: true });
3528
+ /** Entity was attached as a result of an import. */
3529
+ static AttachOnImport = new EntityAction({ _isAttach: true });
3530
+ /** Entity was detached */
3531
+ static Detach = new EntityAction({ _isDetach: true });
3532
+ /** Properties on the entity were merged as a result of a query. */
3533
+ static MergeOnQuery = new EntityAction({ _isModification: true });
3534
+ /** Properties on the entity were merged as a result of an import. */
3535
+ static MergeOnImport = new EntityAction({ _isModification: true });
3536
+ /** Properties on the entity were merged as a result of a save */
3537
+ static MergeOnSave = new EntityAction({ _isModification: true });
3538
+ /** A property on the entity was changed. */
3539
+ static PropertyChange = new EntityAction({ _isModification: true });
3540
+ /** The EntityState of the entity was changed. */
3541
+ static EntityStateChange = new EntityAction();
3542
+ /** AcceptChanges was called on the entity, or its entityState was set to Unmodified. */
3543
+ static AcceptChanges = new EntityAction();
3544
+ /** RejectChanges was called on the entity. */
3545
+ static RejectChanges = new EntityAction({ _isModification: true });
3546
+ /** The EntityManager was cleared. All entities detached. */
3547
+ static Clear = new EntityAction({ _isDetach: true });
3364
3548
  /** Is this an 'attach' operation? ( Attach, AttachOnQuery or AttachOnImport) */
3365
3549
  isAttach() {
3366
3550
  return !!this._isAttach;
@@ -3374,30 +3558,6 @@ class EntityAction extends BreezeEnum {
3374
3558
  return !!this._isModification;
3375
3559
  }
3376
3560
  }
3377
- /** Entity was attached via an AttachEntity call. */
3378
- EntityAction.Attach = new EntityAction({ _isAttach: true });
3379
- /** Entity was attached as a result of a query. */
3380
- EntityAction.AttachOnQuery = new EntityAction({ _isAttach: true });
3381
- /** Entity was attached as a result of an import. */
3382
- EntityAction.AttachOnImport = new EntityAction({ _isAttach: true });
3383
- /** Entity was detached */
3384
- EntityAction.Detach = new EntityAction({ _isDetach: true });
3385
- /** Properties on the entity were merged as a result of a query. */
3386
- EntityAction.MergeOnQuery = new EntityAction({ _isModification: true });
3387
- /** Properties on the entity were merged as a result of an import. */
3388
- EntityAction.MergeOnImport = new EntityAction({ _isModification: true });
3389
- /** Properties on the entity were merged as a result of a save */
3390
- EntityAction.MergeOnSave = new EntityAction({ _isModification: true });
3391
- /** A property on the entity was changed. */
3392
- EntityAction.PropertyChange = new EntityAction({ _isModification: true });
3393
- /** The EntityState of the entity was changed. */
3394
- EntityAction.EntityStateChange = new EntityAction();
3395
- /** AcceptChanges was called on the entity, or its entityState was set to Unmodified. */
3396
- EntityAction.AcceptChanges = new EntityAction();
3397
- /** RejectChanges was called on the entity. */
3398
- EntityAction.RejectChanges = new EntityAction({ _isModification: true });
3399
- /** The EntityManager was cleared. All entities detached. */
3400
- EntityAction.Clear = new EntityAction({ _isDetach: true });
3401
3561
  EntityAction.prototype._$typeName = "EntityAction";
3402
3562
  Error['x'] = EntityAction.resolveSymbols();
3403
3563
 
@@ -3407,6 +3567,19 @@ An EntityKey is an object that represents the unique identity of an entity. Ent
3407
3567
 
3408
3568
  **/
3409
3569
  class EntityKey {
3570
+ /** @hidden @internal */
3571
+ _$typeName; // actually placed on prototype
3572
+ /** @hidden @internal */
3573
+ static ENTITY_KEY_DELIMITER = ":::";
3574
+ /** The 'EntityType' that this is a key for. __Read Only__ */
3575
+ entityType;
3576
+ /** An array of the values for this key. This will usually only have a single element,
3577
+ unless the entity type has a multipart key. __Read Only__ */
3578
+ values;
3579
+ /** @hidden @internal */
3580
+ _keyInGroup;
3581
+ /** @hidden @internal */
3582
+ _subtypes;
3410
3583
  /**
3411
3584
  Constructs a new EntityKey. Each entity within an EntityManager will have a unique EntityKey.
3412
3585
  > // assume em1 is an EntityManager containing a number of existing entities.
@@ -3509,8 +3682,6 @@ class EntityKey {
3509
3682
  return keyValues.join(EntityKey.ENTITY_KEY_DELIMITER);
3510
3683
  }
3511
3684
  }
3512
- /** @hidden @internal */
3513
- EntityKey.ENTITY_KEY_DELIMITER = ":::";
3514
3685
  EntityKey.prototype._$typeName = "EntityKey";
3515
3686
 
3516
3687
  /**
@@ -3520,53 +3691,69 @@ MergeStrategy is an 'Enum' that determines how entities are merged into an Entit
3520
3691
  @static
3521
3692
  **/
3522
3693
  class MergeStrategy extends BreezeEnum {
3694
+ /**
3695
+ MergeStrategy.PreserveChanges updates the cached entity with the incoming values unless the cached entity is in a changed
3696
+ state (added, modified, deleted) in which case the incoming values are ignored. The updated cached entity’s EntityState will
3697
+ remain [[EntityState.Unchanged]] unless you’re importing entities in which case the new EntityState will
3698
+ be that of the imported entities.
3699
+ **/
3700
+ static PreserveChanges = new MergeStrategy();
3701
+ /**
3702
+ MergeStrategy.OverwriteChanges always updates the cached entity with incoming values even if the entity is in
3703
+ a changed state (added, modified, deleted). After the merge, the pending changes are lost.
3704
+ The new EntityState will be [[EntityState/Unchanged]] unless you’re importing entities
3705
+ in which case the new EntityState will be that of the imported entities.
3706
+ **/
3707
+ static OverwriteChanges = new MergeStrategy();
3708
+ /**
3709
+ SkipMerge is used to ignore incoming values. Adds the incoming entity to the cache only if there is no cached entity with the same key.
3710
+ This is the fastest merge strategy but your existing cached data will remain “stale”.
3711
+ **/
3712
+ static SkipMerge = new MergeStrategy();
3713
+ /**
3714
+ Disallowed is used to throw an exception if there is an incoming entity with the same key as an entity already in the cache.
3715
+ Use this strategy when you want to be sure that the incoming entity is not already in cache.
3716
+ This is the default strategy for EntityManager.attachEntity.
3717
+ **/
3718
+ static Disallowed = new MergeStrategy();
3523
3719
  }
3524
- /**
3525
- MergeStrategy.PreserveChanges updates the cached entity with the incoming values unless the cached entity is in a changed
3526
- state (added, modified, deleted) in which case the incoming values are ignored. The updated cached entity’s EntityState will
3527
- remain [[EntityState.Unchanged]] unless you’re importing entities in which case the new EntityState will
3528
- be that of the imported entities.
3529
- **/
3530
- MergeStrategy.PreserveChanges = new MergeStrategy();
3531
- /**
3532
- MergeStrategy.OverwriteChanges always updates the cached entity with incoming values even if the entity is in
3533
- a changed state (added, modified, deleted). After the merge, the pending changes are lost.
3534
- The new EntityState will be [[EntityState/Unchanged]] unless you’re importing entities
3535
- in which case the new EntityState will be that of the imported entities.
3536
- **/
3537
- MergeStrategy.OverwriteChanges = new MergeStrategy();
3538
- /**
3539
- SkipMerge is used to ignore incoming values. Adds the incoming entity to the cache only if there is no cached entity with the same key.
3540
- This is the fastest merge strategy but your existing cached data will remain “stale”.
3541
- **/
3542
- MergeStrategy.SkipMerge = new MergeStrategy();
3543
- /**
3544
- Disallowed is used to throw an exception if there is an incoming entity with the same key as an entity already in the cache.
3545
- Use this strategy when you want to be sure that the incoming entity is not already in cache.
3546
- This is the default strategy for EntityManager.attachEntity.
3547
- **/
3548
- MergeStrategy.Disallowed = new MergeStrategy();
3549
3720
  MergeStrategy.prototype._$typeName = "MergeStrategy";
3550
3721
  Error['x'] = MergeStrategy.resolveSymbols();
3551
3722
  /**
3552
3723
  FetchStrategy is an 'Enum' that determines how and where entities are retrieved from as a result of a query.
3553
3724
  **/
3554
3725
  class FetchStrategy extends BreezeEnum {
3726
+ /**
3727
+ FromServer is used to tell the query to execute the query against a remote data source on the server.
3728
+ **/
3729
+ static FromServer = new FetchStrategy();
3730
+ /**
3731
+ FromLocalCache is used to tell the query to execute the query against a local EntityManager instead of going to a remote server.
3732
+ **/
3733
+ static FromLocalCache = new FetchStrategy();
3555
3734
  }
3556
- /**
3557
- FromServer is used to tell the query to execute the query against a remote data source on the server.
3558
- **/
3559
- FetchStrategy.FromServer = new FetchStrategy();
3560
- /**
3561
- FromLocalCache is used to tell the query to execute the query against a local EntityManager instead of going to a remote server.
3562
- **/
3563
- FetchStrategy.FromLocalCache = new FetchStrategy();
3564
3735
  FetchStrategy.prototype._$typeName = "FetchStrategy";
3565
3736
  Error['x'] = FetchStrategy.resolveSymbols();
3566
3737
  /**
3567
3738
  A QueryOptions instance is used to specify the 'options' under which a query will occur.
3568
3739
  **/
3569
3740
  class QueryOptions {
3741
+ /** @hidden @internal */
3742
+ _$typeName;
3743
+ /** The [[FetchStrategy]] to use with any queries. __Read Only__ */
3744
+ fetchStrategy;
3745
+ /** The [[MergeStrategy]] to use with any queries. __Read Only__ */
3746
+ mergeStrategy;
3747
+ /** Whether to include cached deleted entities in a query result (false by default). __Read Only__ */
3748
+ includeDeleted;
3749
+ /**
3750
+ The default instance for use whenever QueryOptions are not specified.
3751
+ **/
3752
+ static defaultInstance = new QueryOptions({
3753
+ fetchStrategy: FetchStrategy.FromServer,
3754
+ mergeStrategy: MergeStrategy.PreserveChanges,
3755
+ includeDeleted: false
3756
+ });
3570
3757
  /**
3571
3758
  QueryOptions constructor
3572
3759
  > var newQo = new QueryOptions( { mergeStrategy: MergeStrategy.OverwriteChanges });
@@ -3652,14 +3839,6 @@ class QueryOptions {
3652
3839
  return obj;
3653
3840
  }
3654
3841
  }
3655
- /**
3656
- The default instance for use whenever QueryOptions are not specified.
3657
- **/
3658
- QueryOptions.defaultInstance = new QueryOptions({
3659
- fetchStrategy: FetchStrategy.FromServer,
3660
- mergeStrategy: MergeStrategy.PreserveChanges,
3661
- includeDeleted: false
3662
- });
3663
3842
  QueryOptions.prototype._$typeName = "QueryOptions";
3664
3843
 
3665
3844
  /**
@@ -4056,6 +4235,7 @@ function updateAliasMap(aliasMap, opStr, op) {
4056
4235
  @hidden @internal
4057
4236
  */
4058
4237
  class PassthruPredicate extends Predicate {
4238
+ value;
4059
4239
  constructor(value) {
4060
4240
  super();
4061
4241
  this.value = value;
@@ -4067,6 +4247,7 @@ Error['x'] = PassthruPredicate.prototype._initialize('passthruPredicate');
4067
4247
  @hidden
4068
4248
  */
4069
4249
  class UnaryPredicate extends Predicate {
4250
+ pred;
4070
4251
  constructor(op, ...args) {
4071
4252
  super();
4072
4253
  this.op = this._resolveOp(op);
@@ -4084,6 +4265,10 @@ Error['x'] = UnaryPredicate.prototype._initialize('unaryPredicate', {
4084
4265
  @hidden
4085
4266
  */
4086
4267
  class BinaryPredicate extends Predicate {
4268
+ expr1Source;
4269
+ expr2Source;
4270
+ expr1;
4271
+ expr2;
4087
4272
  constructor(op, expr1, expr2) {
4088
4273
  super();
4089
4274
  // 5 public props op, expr1Source, expr2Source, expr1, expr2
@@ -4118,10 +4303,10 @@ class BinaryPredicate extends Predicate {
4118
4303
  }
4119
4304
  Error['x'] = BinaryPredicate.prototype._initialize('binaryPredicate', {
4120
4305
  'eq': {
4121
- aliases: ["==", "equals"]
4306
+ aliases: ["==", "equals", "equal"]
4122
4307
  },
4123
4308
  'ne': {
4124
- aliases: ["!=", "~=", "notequals"]
4309
+ aliases: ["!=", "~=", "notequals", "notequal"]
4125
4310
  },
4126
4311
  'lt': {
4127
4312
  aliases: ["<", "lessthan"]
@@ -4152,6 +4337,7 @@ Error['x'] = BinaryPredicate.prototype._initialize('binaryPredicate', {
4152
4337
  @hidden
4153
4338
  */
4154
4339
  class AndOrPredicate extends Predicate {
4340
+ preds;
4155
4341
  constructor(op, preds) {
4156
4342
  super();
4157
4343
  this.op = this._resolveOp(op);
@@ -4187,6 +4373,10 @@ Error['x'] = AndOrPredicate.prototype._initialize("andOrPredicate", {
4187
4373
  @hidden
4188
4374
  */
4189
4375
  class AnyAllPredicate extends Predicate {
4376
+ /** @internal */
4377
+ expr;
4378
+ exprSource;
4379
+ pred;
4190
4380
  // 4 public props: op, exprSource, expr, pred
4191
4381
  constructor(op, expr, pred) {
4192
4382
  super();
@@ -4210,6 +4400,9 @@ Error['x'] = AnyAllPredicate.prototype._initialize("anyAllPredicate", {
4210
4400
  });
4211
4401
  /** @hidden */
4212
4402
  class PredicateExpression {
4403
+ visitorMethodName;
4404
+ visit; // TODO
4405
+ dataType;
4213
4406
  constructor(visitorMethodName) {
4214
4407
  this.visitorMethodName = visitorMethodName;
4215
4408
  // give expressions the Predicate prototype method
@@ -4225,6 +4418,8 @@ class PredicateExpression {
4225
4418
  @hidden
4226
4419
  */
4227
4420
  class LitExpr extends PredicateExpression {
4421
+ value;
4422
+ hasExplicitDataType;
4228
4423
  // 2 public props: value, dataType
4229
4424
  constructor(value, dataType, hasExplicitDataType) {
4230
4425
  super("litExpr");
@@ -4273,6 +4468,7 @@ function resolveDataType(dataType) {
4273
4468
  @hidden
4274
4469
  */
4275
4470
  class PropExpr extends PredicateExpression {
4471
+ propertyPath;
4276
4472
  // two public props: propertyPath, dateType
4277
4473
  constructor(propertyPath) {
4278
4474
  super('propExpr');
@@ -4306,6 +4502,9 @@ class PropExpr extends PredicateExpression {
4306
4502
  @hidden @dynamic
4307
4503
  */
4308
4504
  class FnExpr extends PredicateExpression {
4505
+ fnName;
4506
+ exprs;
4507
+ localFn; // TODO:
4309
4508
  constructor(fnName, exprs) {
4310
4509
  super('fnExpr');
4311
4510
  // 4 public props: fnName, exprs, localFn, dataType
@@ -4329,104 +4528,109 @@ class FnExpr extends PredicateExpression {
4329
4528
  expr._validate(entityType, usesNameOnServer);
4330
4529
  });
4331
4530
  }
4531
+ static _funcMap = {
4532
+ toupper: {
4533
+ fn: function (source) {
4534
+ return source.toUpperCase();
4535
+ }, dataType: DataType.String
4536
+ },
4537
+ tolower: {
4538
+ fn: function (source) {
4539
+ return source.toLowerCase();
4540
+ }, dataType: DataType.String
4541
+ },
4542
+ substring: {
4543
+ fn: function (source, pos, length) {
4544
+ return source.substring(pos, length);
4545
+ }, dataType: DataType.String
4546
+ },
4547
+ substringof: {
4548
+ fn: function (find, source) {
4549
+ return source.indexOf(find) >= 0;
4550
+ }, dataType: DataType.Boolean
4551
+ },
4552
+ length: {
4553
+ fn: function (source) {
4554
+ return source.length;
4555
+ }, dataType: DataType.Int32
4556
+ },
4557
+ trim: {
4558
+ fn: function (source) {
4559
+ return source.trim();
4560
+ }, dataType: DataType.String
4561
+ },
4562
+ concat: {
4563
+ fn: function (s1, s2) {
4564
+ return s1.concat(s2);
4565
+ }, dataType: DataType.String
4566
+ },
4567
+ replace: {
4568
+ fn: function (source, find, replace) {
4569
+ return source.replace(find, replace);
4570
+ }, dataType: DataType.String
4571
+ },
4572
+ startswith: {
4573
+ fn: function (source, find) {
4574
+ return core.stringStartsWith(source, find);
4575
+ }, dataType: DataType.Boolean
4576
+ },
4577
+ endswith: {
4578
+ fn: function (source, find) {
4579
+ return core.stringEndsWith(source, find);
4580
+ }, dataType: DataType.Boolean
4581
+ },
4582
+ indexof: {
4583
+ fn: function (source, find) {
4584
+ return source.indexOf(find);
4585
+ }, dataType: DataType.Int32
4586
+ },
4587
+ round: {
4588
+ fn: function (source) {
4589
+ return Math.round(source);
4590
+ }, dataType: DataType.Int32
4591
+ },
4592
+ ceiling: {
4593
+ fn: function (source) {
4594
+ return Math.ceil(source);
4595
+ }, dataType: DataType.Int32
4596
+ },
4597
+ floor: {
4598
+ fn: function (source) {
4599
+ return Math.floor(source);
4600
+ }, dataType: DataType.Int32
4601
+ },
4602
+ second: {
4603
+ fn: function (source) {
4604
+ return source.getSeconds();
4605
+ }, dataType: DataType.Int32
4606
+ },
4607
+ minute: {
4608
+ fn: function (source) {
4609
+ return source.getMinutes();
4610
+ }, dataType: DataType.Int32
4611
+ },
4612
+ hour: {
4613
+ fn: function (source) {
4614
+ return source.getHours();
4615
+ }, dataType: DataType.Int32
4616
+ },
4617
+ day: {
4618
+ fn: function (source) {
4619
+ return source.getDate();
4620
+ }, dataType: DataType.Int32
4621
+ },
4622
+ month: {
4623
+ fn: function (source) {
4624
+ return source.getMonth() + 1;
4625
+ }, dataType: DataType.Int32
4626
+ },
4627
+ year: {
4628
+ fn: function (source) {
4629
+ return source.getFullYear();
4630
+ }, dataType: DataType.Int32
4631
+ }
4632
+ };
4332
4633
  }
4333
- FnExpr._funcMap = {
4334
- toupper: {
4335
- fn: function (source) {
4336
- return source.toUpperCase();
4337
- }, dataType: DataType.String
4338
- },
4339
- tolower: {
4340
- fn: function (source) {
4341
- return source.toLowerCase();
4342
- }, dataType: DataType.String
4343
- },
4344
- substring: {
4345
- fn: function (source, pos, length) {
4346
- return source.substring(pos, length);
4347
- }, dataType: DataType.String
4348
- },
4349
- substringof: {
4350
- fn: function (find, source) {
4351
- return source.indexOf(find) >= 0;
4352
- }, dataType: DataType.Boolean
4353
- },
4354
- length: {
4355
- fn: function (source) {
4356
- return source.length;
4357
- }, dataType: DataType.Int32
4358
- },
4359
- trim: {
4360
- fn: function (source) {
4361
- return source.trim();
4362
- }, dataType: DataType.String
4363
- },
4364
- concat: {
4365
- fn: function (s1, s2) {
4366
- return s1.concat(s2);
4367
- }, dataType: DataType.String
4368
- },
4369
- replace: {
4370
- fn: function (source, find, replace) {
4371
- return source.replace(find, replace);
4372
- }, dataType: DataType.String
4373
- },
4374
- startswith: {
4375
- fn: function (source, find) {
4376
- return core.stringStartsWith(source, find);
4377
- }, dataType: DataType.Boolean
4378
- },
4379
- endswith: {
4380
- fn: function (source, find) {
4381
- return core.stringEndsWith(source, find);
4382
- }, dataType: DataType.Boolean
4383
- },
4384
- indexof: {
4385
- fn: function (source, find) {
4386
- return source.indexOf(find);
4387
- }, dataType: DataType.Int32
4388
- },
4389
- round: {
4390
- fn: function (source) {
4391
- return Math.round(source);
4392
- }, dataType: DataType.Int32
4393
- },
4394
- ceiling: {
4395
- fn: function (source) {
4396
- return Math.ceil(source);
4397
- }, dataType: DataType.Int32
4398
- },
4399
- floor: {
4400
- fn: function (source) {
4401
- return Math.floor(source);
4402
- }, dataType: DataType.Int32
4403
- },
4404
- second: {
4405
- fn: function (source) {
4406
- return source.getSeconds();
4407
- }, dataType: DataType.Int32
4408
- },
4409
- minute: {
4410
- fn: function (source) {
4411
- return source.getMinutes();
4412
- }, dataType: DataType.Int32
4413
- },
4414
- day: {
4415
- fn: function (source) {
4416
- return source.getDate();
4417
- }, dataType: DataType.Int32
4418
- },
4419
- month: {
4420
- fn: function (source) {
4421
- return source.getMonth() + 1;
4422
- }, dataType: DataType.Int32
4423
- },
4424
- year: {
4425
- fn: function (source) {
4426
- return source.getFullYear();
4427
- }, dataType: DataType.Int32
4428
- }
4429
- };
4430
4634
  // TODO: add dataTypes for the args next - will help to infer other dataTypes.
4431
4635
  let RX_IDENTIFIER = /^[a-z_][\w.$]*$/i;
4432
4636
  // comma delimited expressions ignoring commas inside of both single and double quotes.
@@ -4556,104 +4760,103 @@ function parseFnExpr(source, parts, tokens, exprContext) {
4556
4760
  throw e;
4557
4761
  }
4558
4762
  }
4559
- const ɵ0$2 = function () {
4560
- throw new Error("Cannot execute an PassthruPredicate expression against the local cache: " + this.value);
4561
- }, ɵ1$1 = function (context) {
4562
- let predFn = this.pred.visit(context);
4563
- switch (this.op.key) {
4564
- case "not":
4565
- return function (entity) {
4566
- return !predFn(entity);
4567
- };
4568
- default:
4569
- throw new Error("Invalid unary operator:" + this.op.key);
4570
- }
4571
- }, ɵ2 = function (context) {
4572
- let expr1Fn = this.expr1.visit(context);
4573
- let expr2Fn = this.expr2.visit(context);
4574
- let dataType = this.expr1.dataType || this.expr2.dataType;
4575
- let lqco = context.entityType.metadataStore.localQueryComparisonOptions;
4576
- let predFn = getBinaryPredicateFn(this, dataType, lqco);
4577
- if (predFn == null) {
4578
- throw new Error("Invalid binaryPredicate operator:" + this.op.key);
4579
- }
4580
- return function (entity) {
4581
- return predFn(expr1Fn(entity), expr2Fn(entity));
4582
- };
4583
- }, ɵ3 = function (context) {
4584
- let predFns = this.preds.map((pred) => {
4585
- return pred.visit(context);
4586
- });
4587
- switch (this.op.key) {
4588
- case "and":
4763
+ // toFunctionVisitor
4764
+ let toFunctionVisitor = {
4765
+ isExtended: false,
4766
+ passthruPredicate: function () {
4767
+ throw new Error("Cannot execute an PassthruPredicate expression against the local cache: " + this.value);
4768
+ },
4769
+ unaryPredicate: function (context) {
4770
+ let predFn = this.pred.visit(context);
4771
+ switch (this.op.key) {
4772
+ case "not":
4773
+ return function (entity) {
4774
+ return !predFn(entity);
4775
+ };
4776
+ default:
4777
+ throw new Error("Invalid unary operator:" + this.op.key);
4778
+ }
4779
+ },
4780
+ binaryPredicate: function (context) {
4781
+ let expr1Fn = this.expr1.visit(context);
4782
+ let expr2Fn = this.expr2.visit(context);
4783
+ let dataType = this.expr1.dataType || this.expr2.dataType;
4784
+ let lqco = context.entityType.metadataStore.localQueryComparisonOptions;
4785
+ let predFn = getBinaryPredicateFn(this, dataType, lqco);
4786
+ if (predFn == null) {
4787
+ throw new Error("Invalid binaryPredicate operator:" + this.op.key);
4788
+ }
4789
+ return function (entity) {
4790
+ return predFn(expr1Fn(entity), expr2Fn(entity));
4791
+ };
4792
+ },
4793
+ andOrPredicate: function (context) {
4794
+ let predFns = this.preds.map((pred) => {
4795
+ return pred.visit(context);
4796
+ });
4797
+ switch (this.op.key) {
4798
+ case "and":
4799
+ return function (entity) {
4800
+ let result = predFns.reduce(function (prev, cur) {
4801
+ return prev && cur(entity);
4802
+ }, true);
4803
+ return result;
4804
+ };
4805
+ case "or":
4806
+ return function (entity) {
4807
+ let result = predFns.reduce(function (prev, cur) {
4808
+ return prev || cur(entity);
4809
+ }, false);
4810
+ return result;
4811
+ };
4812
+ default:
4813
+ throw new Error("Invalid boolean operator:" + this.op.key);
4814
+ }
4815
+ },
4816
+ anyAllPredicate: function (context) {
4817
+ let exprFn = this.expr.visit(context);
4818
+ let newContext = core.extend({}, context);
4819
+ newContext.entityType = this.expr.dataType;
4820
+ let predFn = this.pred.visit(newContext);
4821
+ let anyAllPredFn = getAnyAllPredicateFn(this.op);
4822
+ return function (entity) {
4823
+ return anyAllPredFn(exprFn(entity), predFn);
4824
+ };
4825
+ },
4826
+ litExpr: function () {
4827
+ let value = this.value;
4828
+ return function (entity) {
4829
+ return value;
4830
+ };
4831
+ },
4832
+ propExpr: function () {
4833
+ let propertyPath = this.propertyPath;
4834
+ let properties = propertyPath.split('.');
4835
+ if (properties.length === 1) {
4589
4836
  return function (entity) {
4590
- let result = predFns.reduce(function (prev, cur) {
4591
- return prev && cur(entity);
4592
- }, true);
4593
- return result;
4837
+ return entity.getProperty(propertyPath);
4594
4838
  };
4595
- case "or":
4839
+ }
4840
+ else {
4596
4841
  return function (entity) {
4597
- let result = predFns.reduce(function (prev, cur) {
4598
- return prev || cur(entity);
4599
- }, false);
4600
- return result;
4842
+ return EntityAspect.getPropertyPathValue(entity, properties);
4601
4843
  };
4602
- default:
4603
- throw new Error("Invalid boolean operator:" + this.op.key);
4604
- }
4605
- }, ɵ4 = function (context) {
4606
- let exprFn = this.expr.visit(context);
4607
- let newContext = core.extend({}, context);
4608
- newContext.entityType = this.expr.dataType;
4609
- let predFn = this.pred.visit(newContext);
4610
- let anyAllPredFn = getAnyAllPredicateFn(this.op);
4611
- return function (entity) {
4612
- return anyAllPredFn(exprFn(entity), predFn);
4613
- };
4614
- }, ɵ5 = function () {
4615
- let value = this.value;
4616
- return function (entity) {
4617
- return value;
4618
- };
4619
- }, ɵ6 = function () {
4620
- let propertyPath = this.propertyPath;
4621
- let properties = propertyPath.split('.');
4622
- if (properties.length === 1) {
4623
- return function (entity) {
4624
- return entity.getProperty(propertyPath);
4625
- };
4626
- }
4627
- else {
4844
+ }
4845
+ },
4846
+ fnExpr: function (context) {
4847
+ let exprFns = this.exprs.map(function (expr) {
4848
+ return expr.visit(context);
4849
+ });
4850
+ let that = this;
4628
4851
  return function (entity) {
4629
- return EntityAspect.getPropertyPathValue(entity, properties);
4852
+ let values = exprFns.map(function (exprFn) {
4853
+ let value = exprFn(entity);
4854
+ return value;
4855
+ });
4856
+ let result = that.localFn.apply(null, values);
4857
+ return result;
4630
4858
  };
4631
4859
  }
4632
- }, ɵ7 = function (context) {
4633
- let exprFns = this.exprs.map(function (expr) {
4634
- return expr.visit(context);
4635
- });
4636
- let that = this;
4637
- return function (entity) {
4638
- let values = exprFns.map(function (exprFn) {
4639
- let value = exprFn(entity);
4640
- return value;
4641
- });
4642
- let result = that.localFn.apply(null, values);
4643
- return result;
4644
- };
4645
- };
4646
- // toFunctionVisitor
4647
- let toFunctionVisitor = {
4648
- isExtended: false,
4649
- passthruPredicate: ɵ0$2,
4650
- unaryPredicate: ɵ1$1,
4651
- binaryPredicate: ɵ2,
4652
- andOrPredicate: ɵ3,
4653
- anyAllPredicate: ɵ4,
4654
- litExpr: ɵ5,
4655
- propExpr: ɵ6,
4656
- fnExpr: ɵ7
4657
4860
  };
4658
4861
  function getAnyAllPredicateFn(op) {
4659
4862
  switch (op.key) {
@@ -4720,12 +4923,12 @@ function getBinaryPredicateFn(binaryPredicate, dataType, lqco) {
4720
4923
  break;
4721
4924
  case 'startswith':
4722
4925
  predFn = function (v1, v2) {
4723
- return stringStartsWith$1(v1, v2, lqco);
4926
+ return stringStartsWith(v1, v2, lqco);
4724
4927
  };
4725
4928
  break;
4726
4929
  case 'endswith':
4727
4930
  predFn = function (v1, v2) {
4728
- return stringEndsWith$1(v1, v2, lqco);
4931
+ return stringEndsWith(v1, v2, lqco);
4729
4932
  };
4730
4933
  break;
4731
4934
  case 'contains':
@@ -4761,14 +4964,14 @@ function stringEquals(a, b, lqco) {
4761
4964
  }
4762
4965
  return a === b;
4763
4966
  }
4764
- function stringStartsWith$1(a, b, lqco) {
4967
+ function stringStartsWith(a, b, lqco) {
4765
4968
  if (!lqco.isCaseSensitive) {
4766
4969
  a = (a || "").toLowerCase();
4767
4970
  b = (b || "").toLowerCase();
4768
4971
  }
4769
4972
  return core.stringStartsWith(a, b);
4770
4973
  }
4771
- function stringEndsWith$1(a, b, lqco) {
4974
+ function stringEndsWith(a, b, lqco) {
4772
4975
  if (!lqco.isCaseSensitive) {
4773
4976
  a = (a || "").toLowerCase();
4774
4977
  b = (b || "").toLowerCase();
@@ -4782,92 +4985,93 @@ function stringContains(a, b, lqco) {
4782
4985
  }
4783
4986
  return a.indexOf(b) >= 0;
4784
4987
  }
4785
- const ɵ8 = function () {
4786
- return this.value;
4787
- }, ɵ9 = function (context) {
4788
- let predVal = this.pred.visit(context);
4789
- let json = {};
4790
- json[this.op.key] = predVal;
4791
- return json;
4792
- }, ɵ10 = function (context) {
4793
- let expr1Val = this.expr1.visit(context);
4794
- let expr2Val = this.expr2.visit(context);
4795
- let json = {};
4796
- if (this.expr2 instanceof PropExpr) {
4797
- expr2Val = { value: expr2Val, isProperty: true };
4798
- }
4799
- if (this.op.key === "eq") {
4800
- json[expr1Val] = expr2Val;
4801
- }
4802
- else {
4803
- let value = {};
4804
- json[expr1Val] = value;
4805
- value[this.op.key] = expr2Val;
4806
- }
4807
- return json;
4808
- }, ɵ11 = function (context) {
4809
- let predVals = this.preds.map(function (pred) {
4810
- return pred.visit(context);
4811
- });
4812
- if (!predVals || !predVals.length) {
4813
- return {};
4814
- }
4815
- let json;
4816
- // normalizeAnd clauses if possible.
4817
- // passthru predicate will appear as string and their 'ands' can't be 'normalized'
4818
- if (this.op.key === 'and' && predVals.length === 2 && !predVals.some((v) => v.or || typeof (v) === 'string')) {
4819
- // normalize 'and' clauses - will return null if can't be combined.
4820
- json = predVals.reduce(combine);
4821
- }
4822
- if (json == null) {
4823
- json = {};
4824
- json[this.op.key] = predVals;
4825
- }
4826
- return json;
4827
- }, ɵ12 = function (context) {
4828
- let exprVal = this.expr.visit(context);
4829
- let newContext = core.extend({}, context);
4830
- newContext.entityType = this.expr.dataType;
4831
- let predVal = this.pred.visit(newContext);
4832
- let json = {};
4833
- let value = {};
4834
- value[this.op.key] = predVal;
4835
- json[exprVal] = value;
4836
- return json;
4837
- }, ɵ13 = function (context) {
4838
- if (this.hasExplicitDataType || context.useExplicitDataType) {
4839
- return { value: this.value, dataType: this.dataType.name };
4840
- }
4841
- else {
4988
+ // toJSONVisitor
4989
+ let toJSONVisitor = {
4990
+ passthruPredicate: function () {
4842
4991
  return this.value;
4843
- }
4844
- }, ɵ14 = function (context) {
4845
- if (context.toNameOnServer) {
4846
- if (!context.entityType) {
4847
- console.warn(`No EntityType for propertyPath "${this.propertyPath}". ${core.strings.TO_TYPE}`);
4992
+ },
4993
+ unaryPredicate: function (context) {
4994
+ let predVal = this.pred.visit(context);
4995
+ let json = {};
4996
+ json[this.op.key] = predVal;
4997
+ return json;
4998
+ },
4999
+ binaryPredicate: function (context) {
5000
+ let expr1Val = this.expr1.visit(context);
5001
+ let expr2Val = this.expr2.visit(context);
5002
+ let json = {};
5003
+ if (this.expr2 instanceof PropExpr) {
5004
+ expr2Val = { value: expr2Val, isProperty: true };
5005
+ }
5006
+ if (this.op.key === "eq") {
5007
+ json[expr1Val] = expr2Val;
5008
+ }
5009
+ else {
5010
+ let value = {};
5011
+ json[expr1Val] = value;
5012
+ value[this.op.key] = expr2Val;
5013
+ }
5014
+ return json;
5015
+ },
5016
+ andOrPredicate: function (context) {
5017
+ let predVals = this.preds.map(function (pred) {
5018
+ return pred.visit(context);
5019
+ });
5020
+ if (!predVals || !predVals.length) {
5021
+ return {};
5022
+ }
5023
+ let json;
5024
+ // normalizeAnd clauses if possible.
5025
+ // passthru predicate will appear as string and their 'ands' can't be 'normalized'
5026
+ if (this.op.key === 'and' && predVals.length === 2 && !predVals.some((v) => v.or || typeof (v) === 'string')) {
5027
+ // normalize 'and' clauses - will return null if can't be combined.
5028
+ json = predVals.reduce(combine);
5029
+ }
5030
+ if (json == null) {
5031
+ json = {};
5032
+ json[this.op.key] = predVals;
5033
+ }
5034
+ return json;
5035
+ },
5036
+ anyAllPredicate: function (context) {
5037
+ let exprVal = this.expr.visit(context);
5038
+ let newContext = core.extend({}, context);
5039
+ newContext.entityType = this.expr.dataType;
5040
+ let predVal = this.pred.visit(newContext);
5041
+ let json = {};
5042
+ let value = {};
5043
+ value[this.op.key] = predVal;
5044
+ json[exprVal] = value;
5045
+ return json;
5046
+ },
5047
+ litExpr: function (context) {
5048
+ // special handling for DateOnly because it serializes improperly
5049
+ const value = (this.dataType === DataType.DateOnly) ? DataType.toDateOnlyString(this.value) : this.value;
5050
+ if (this.hasExplicitDataType || context.useExplicitDataType) {
5051
+ return { value: value, dataType: this.dataType.name };
5052
+ }
5053
+ else {
5054
+ return value;
5055
+ }
5056
+ },
5057
+ propExpr: function (context) {
5058
+ if (context.toNameOnServer) {
5059
+ if (!context.entityType) {
5060
+ console.warn(`No EntityType for propertyPath "${this.propertyPath}". ${core.strings.TO_TYPE}`);
5061
+ return this.propertyPath;
5062
+ }
5063
+ return context.entityType.clientPropertyPathToServer(this.propertyPath);
5064
+ }
5065
+ else {
4848
5066
  return this.propertyPath;
4849
5067
  }
4850
- return context.entityType.clientPropertyPathToServer(this.propertyPath);
4851
- }
4852
- else {
4853
- return this.propertyPath;
5068
+ },
5069
+ fnExpr: function (context) {
5070
+ let exprVals = this.exprs.map(function (expr) {
5071
+ return expr.visit(context);
5072
+ });
5073
+ return this.fnName + "(" + exprVals.join(",") + ")";
4854
5074
  }
4855
- }, ɵ15 = function (context) {
4856
- let exprVals = this.exprs.map(function (expr) {
4857
- return expr.visit(context);
4858
- });
4859
- return this.fnName + "(" + exprVals.join(",") + ")";
4860
- };
4861
- // toJSONVisitor
4862
- let toJSONVisitor = {
4863
- passthruPredicate: ɵ8,
4864
- unaryPredicate: ɵ9,
4865
- binaryPredicate: ɵ10,
4866
- andOrPredicate: ɵ11,
4867
- anyAllPredicate: ɵ12,
4868
- litExpr: ɵ13,
4869
- propExpr: ɵ14,
4870
- fnExpr: ɵ15
4871
5075
  };
4872
5076
  function combine(j1, j2) {
4873
5077
  let ok = Object.keys(j2).every(function (key) {
@@ -5422,6 +5626,28 @@ class EntityQuery {
5422
5626
  q = q.where(pred).toType(entityKey.entityType);
5423
5627
  return q;
5424
5628
  }
5629
+ /**
5630
+ Creates an EntityQuery for the specified entity and [[NavigationProperty]].
5631
+ > // 'employee' is a previously queried employee
5632
+ > let ordersNavProp = employee.entityType.getProperty("Orders");
5633
+ > let query = EntityQuery.fromEntityNavigation(employee, ordersNavProp);
5634
+
5635
+ will return a query for the "Orders" of the specified 'employee'.
5636
+ @param entity - The Entity whose navigation property will be queried.
5637
+ @param navigationProperty - The [[NavigationProperty]] or name of the NavigationProperty to be queried.
5638
+ **/
5639
+ static fromEntityNavigation = function (entity, navigationProperty) {
5640
+ assertParam(entity, "entity").isEntity().check();
5641
+ let navProperty = entity.entityType._checkNavProperty(navigationProperty);
5642
+ let q = new EntityQuery(navProperty.entityType.defaultResourceName);
5643
+ let pred = buildNavigationPredicate(entity, navProperty);
5644
+ if (pred == null) {
5645
+ throw new Error("Unable to create a NavigationQuery for navigationProperty: " + navProperty.name);
5646
+ }
5647
+ q = q.where(pred);
5648
+ let em = entity.entityAspect.entityManager;
5649
+ return em ? q.using(em) : q;
5650
+ };
5425
5651
  // protected methods
5426
5652
  /** @hidden @internal */
5427
5653
  _getFromEntityType(metadataStore, throwErrorIfNotFound) {
@@ -5493,28 +5719,6 @@ class EntityQuery {
5493
5719
  return ds.uriBuilder.buildUri(this, em.metadataStore);
5494
5720
  }
5495
5721
  }
5496
- /**
5497
- Creates an EntityQuery for the specified entity and [[NavigationProperty]].
5498
- > // 'employee' is a previously queried employee
5499
- > let ordersNavProp = employee.entityType.getProperty("Orders");
5500
- > let query = EntityQuery.fromEntityNavigation(employee, ordersNavProp);
5501
-
5502
- will return a query for the "Orders" of the specified 'employee'.
5503
- @param entity - The Entity whose navigation property will be queried.
5504
- @param navigationProperty - The [[NavigationProperty]] or name of the NavigationProperty to be queried.
5505
- **/
5506
- EntityQuery.fromEntityNavigation = function (entity, navigationProperty) {
5507
- assertParam(entity, "entity").isEntity().check();
5508
- let navProperty = entity.entityType._checkNavProperty(navigationProperty);
5509
- let q = new EntityQuery(navProperty.entityType.defaultResourceName);
5510
- let pred = buildNavigationPredicate(entity, navProperty);
5511
- if (pred == null) {
5512
- throw new Error("Unable to create a NavigationQuery for navigationProperty: " + navProperty.name);
5513
- }
5514
- q = q.where(pred);
5515
- let em = entity.entityAspect.entityManager;
5516
- return em ? q.using(em) : q;
5517
- };
5518
5722
  EntityQuery.prototype._$typeName = "EntityQuery";
5519
5723
  // private functions
5520
5724
  function fromJSON(eq, json) {
@@ -5654,33 +5858,33 @@ FilterQueryOp is an 'Enum' containing all of the valid [[Predicate]]
5654
5858
  filter operators for an [[EntityQuery]].
5655
5859
  **/
5656
5860
  class FilterQueryOp extends BreezeEnum {
5861
+ /** Aliases: "eq", "==" **/
5862
+ static Equals = new FilterQueryOp({ operator: "eq" });
5863
+ /** Aliases: "ne", "!=" **/
5864
+ static NotEquals = new FilterQueryOp({ operator: "ne" });
5865
+ /** Aliases: "gt", ">" **/
5866
+ static GreaterThan = new FilterQueryOp({ operator: "gt" });
5867
+ /** Aliases: "lt", "<" **/
5868
+ static LessThan = new FilterQueryOp({ operator: "lt" });
5869
+ /** Aliases: "ge", ">=" **/
5870
+ static GreaterThanOrEqual = new FilterQueryOp({ operator: "ge" });
5871
+ /** Aliases: "le", "<=" **/
5872
+ static LessThanOrEqual = new FilterQueryOp({ operator: "le" });
5873
+ /** String operation: Is a string a substring of another string. Aliases: "substringof" **/
5874
+ static Contains = new FilterQueryOp({ operator: "contains" });
5875
+ /** No aliases */
5876
+ static StartsWith = new FilterQueryOp({ operator: "startswith" });
5877
+ /** No aliases */
5878
+ static EndsWith = new FilterQueryOp({ operator: "endswith" });
5879
+ /** Aliases: "some" **/
5880
+ static Any = new FilterQueryOp({ operator: "any" });
5881
+ /** Aliases: "every" **/
5882
+ static All = new FilterQueryOp({ operator: "all" });
5883
+ /** No aliases */
5884
+ static In = new FilterQueryOp({ operator: "in" });
5885
+ /** No aliases */
5886
+ static IsTypeOf = new FilterQueryOp({ operator: "isof" });
5657
5887
  }
5658
- /** Aliases: "eq", "==" **/
5659
- FilterQueryOp.Equals = new FilterQueryOp({ operator: "eq" });
5660
- /** Aliases: "ne", "!=" **/
5661
- FilterQueryOp.NotEquals = new FilterQueryOp({ operator: "ne" });
5662
- /** Aliases: "gt", ">" **/
5663
- FilterQueryOp.GreaterThan = new FilterQueryOp({ operator: "gt" });
5664
- /** Aliases: "lt", "<" **/
5665
- FilterQueryOp.LessThan = new FilterQueryOp({ operator: "lt" });
5666
- /** Aliases: "ge", ">=" **/
5667
- FilterQueryOp.GreaterThanOrEqual = new FilterQueryOp({ operator: "ge" });
5668
- /** Aliases: "le", "<=" **/
5669
- FilterQueryOp.LessThanOrEqual = new FilterQueryOp({ operator: "le" });
5670
- /** String operation: Is a string a substring of another string. Aliases: "substringof" **/
5671
- FilterQueryOp.Contains = new FilterQueryOp({ operator: "contains" });
5672
- /** No aliases */
5673
- FilterQueryOp.StartsWith = new FilterQueryOp({ operator: "startswith" });
5674
- /** No aliases */
5675
- FilterQueryOp.EndsWith = new FilterQueryOp({ operator: "endswith" });
5676
- /** Aliases: "some" **/
5677
- FilterQueryOp.Any = new FilterQueryOp({ operator: "any" });
5678
- /** Aliases: "every" **/
5679
- FilterQueryOp.All = new FilterQueryOp({ operator: "all" });
5680
- /** No aliases */
5681
- FilterQueryOp.In = new FilterQueryOp({ operator: "in" });
5682
- /** No aliases */
5683
- FilterQueryOp.IsTypeOf = new FilterQueryOp({ operator: "isof" });
5684
5888
  FilterQueryOp.prototype._$typeName = "FilterQueryOp";
5685
5889
  Error['x'] = FilterQueryOp.resolveSymbols();
5686
5890
  /**
@@ -5688,10 +5892,10 @@ Error['x'] = FilterQueryOp.resolveSymbols();
5688
5892
  operators for an [[EntityQuery]].
5689
5893
  **/
5690
5894
  class BooleanQueryOp extends BreezeEnum {
5895
+ static And = new BooleanQueryOp({ operator: "and" });
5896
+ static Or = new BooleanQueryOp({ operator: "or" });
5897
+ static Not = new BooleanQueryOp({ operator: "not" });
5691
5898
  }
5692
- BooleanQueryOp.And = new BooleanQueryOp({ operator: "and" });
5693
- BooleanQueryOp.Or = new BooleanQueryOp({ operator: "or" });
5694
- BooleanQueryOp.Not = new BooleanQueryOp({ operator: "not" });
5695
5899
  BooleanQueryOp.prototype._$typeName = "BooleanQueryOp";
5696
5900
  Error['x'] = BooleanQueryOp.resolveSymbols();
5697
5901
  /** For use by breeze plugin authors only. The class is used in most [[IUriBuilderAdapter]] implementations
@@ -5712,6 +5916,8 @@ or
5712
5916
  > let obc = new OrderByClause("Company.CompanyName, LastName", true);
5713
5917
  */
5714
5918
  class OrderByClause {
5919
+ /** @hidden @internal */
5920
+ items;
5715
5921
  constructor(propertyPaths, isDesc) {
5716
5922
  if (propertyPaths.length === 0) {
5717
5923
  throw new Error("OrderByClause cannot be empty");
@@ -5758,6 +5964,9 @@ class OrderByClause {
5758
5964
  }
5759
5965
  /** @hidden @internal */
5760
5966
  class OrderByItem {
5967
+ propertyPath;
5968
+ isDesc;
5969
+ lastProperty;
5761
5970
  constructor(propertyPath, isDesc) {
5762
5971
  if (!(typeof propertyPath === 'string')) {
5763
5972
  throw new Error("propertyPath is not a string");
@@ -5833,6 +6042,9 @@ class OrderByItem {
5833
6042
  @hidden
5834
6043
  **/
5835
6044
  class SelectClause {
6045
+ propertyPaths;
6046
+ /** @hidden @internal */
6047
+ _pathNames;
5836
6048
  constructor(propertyPaths) {
5837
6049
  this.propertyPaths = propertyPaths;
5838
6050
  this._pathNames = propertyPaths.map(function (pp) {
@@ -5868,6 +6080,7 @@ class SelectClause {
5868
6080
  @hidden
5869
6081
  **/
5870
6082
  class ExpandClause {
6083
+ propertyPaths;
5871
6084
  constructor(propertyPaths) {
5872
6085
  this.propertyPaths = propertyPaths;
5873
6086
  }
@@ -5893,53 +6106,96 @@ a query, import or [[EntityManager.createEntity]] call.
5893
6106
 
5894
6107
  **/
5895
6108
  class EntityAspect {
6109
+ /** The Entity that this aspect is associated with. __Read Only__ **/
6110
+ entity;
6111
+ /** The [[EntityManager]] that contains this entity. __Read Only__ **/
6112
+ entityManager;
6113
+ /** @hidden @internal */
6114
+ entityGroup;
6115
+ /** The [[EntityState]] of this entity. __Read Only__ **/
6116
+ entityState;
6117
+ /** Whether this entity is in the process of being saved. __Read Only__ */
6118
+ isBeingSaved;
6119
+ /** The 'original values' of this entity where they are different from the 'current values'.
6120
+ This is a map where the key is a property name and the value is the 'original value' of the property. */
6121
+ originalValues;
6122
+ /** Whether this entity has any validation errors. __Read Only__ */
6123
+ hasValidationErrors;
6124
+ /** Whether this entity has a temporary [[EntityKey]]. */
6125
+ hasTempKey;
6126
+ /** Whether this entity was created by being loaded from the database */
6127
+ wasLoaded;
6128
+ /** Extra metadata about this entity such as the entity's etag.
6129
+ You may extend this object with your own metadata information.
6130
+ Breeze (de)serializes this object when importing/exporting the entity. **/
6131
+ extraMetadata;
6132
+ /**
6133
+ A [[BreezeEvent]] that fires whenever any of the validation errors on this entity change.
6134
+ Note that this might be the removal of an error when some data on the entity is fixed.
6135
+ @eventArgs -
6136
+ - entity - The entity on which the validation errors are being added or removed.
6137
+ - added - An array containing any newly added [[ValidationError]]s
6138
+ - removed - An array containing any newly removed [[ValidationError]]s. This is those
6139
+ errors that have been 'fixed'.
6140
+
6141
+ > // assume order is an order entity attached to an EntityManager.
6142
+ > order.entityAspect.validationErrorsChanged.subscribe(
6143
+ > function (validationChangeArgs) {
6144
+ > // this code will be executed anytime a property value changes on the 'order' entity.
6145
+ > var entity == validationChangeArgs.entity; // Note: entity === order
6146
+ > var errorsAdded = validationChangeArgs.added;
6147
+ > var errorsCleared = validationChangeArgs.removed;
6148
+ > });
6149
+ @event
6150
+ **/
6151
+ validationErrorsChanged;
6152
+ /**
6153
+ A [[BreezeEvent]] that fires whenever a value of one of this entity's properties change.
6154
+ @eventArgs -
6155
+ - entity - The entity whose property has changed.
6156
+ - property - The [[DataProperty]] that changed.
6157
+ - propertyName - The name of the property that changed. This value will be 'null' for operations that replace the entire entity. This includes
6158
+ queries, imports and saves that require a merge. The remaining parameters will not exist in this case either. This will actually be a "property path"
6159
+ for any properties of a complex type.
6160
+ - oldValue - The old value of this property before the change.
6161
+ - newValue - The new value of this property after the change.
6162
+ - parent - The immediate parent object for the changed property. This will be a ComplexType instance as opposed to an Entity
6163
+ for any complex type or nested complex type properties.
6164
+
6165
+ > // assume order is an order entity attached to an EntityManager.
6166
+ > order.entityAspect.propertyChanged.subscribe(
6167
+ > function (propertyChangedArgs) {
6168
+ > // this code will be executed anytime a property value changes on the 'order' entity.
6169
+ > var entity = propertyChangedArgs.entity; // Note: entity === order
6170
+ > var propertyNameChanged = propertyChangedArgs.propertyName;
6171
+ > var oldValue = propertyChangedArgs.oldValue;
6172
+ > var newValue = propertyChangedArgs.newValue;
6173
+ > });
6174
+ @event
6175
+ **/
6176
+ propertyChanged;
6177
+ /** @hidden @internal */
6178
+ _validationErrors;
6179
+ /** @hidden @internal */
6180
+ _pendingValidationResult;
6181
+ /** @hidden @internal */
6182
+ _entityKey;
6183
+ /** @hidden @internal */
6184
+ _loadedNps;
6185
+ /** @hidden @internal */
6186
+ _initialized;
6187
+ /** @hidden @internal */
6188
+ _inProcess; // used in defaultPropertyInterceptor for temp storage.
6189
+ /** @hidden @internal */
6190
+ _inProcessEntity; // used in EntityManager
6191
+ /** @hidden @internal */
6192
+ static _nullInstance = new EntityAspect(); // TODO: determine if this works
5896
6193
  /** @hidden @internal */
5897
6194
  constructor(entity) {
5898
6195
  // if called without new
5899
6196
  // if (!(this instanceof EntityAspect)) {
5900
6197
  // return new EntityAspect(entity);
5901
6198
  // }
5902
- /**
5903
- Sets the entity to an EntityState of 'Unchanged'. This is also the equivalent of calling [[EntityAspect.acceptChanges]].
5904
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
5905
- > // assume order is an order entity attached to an EntityManager.
5906
- > order.entityAspect.setUnchanged();
5907
- > // The 'order' entity will now be in an 'Unchanged' state with any changes committed.
5908
- **/
5909
- this.setUnchanged = function () {
5910
- return this.setEntityState(EntityState.Unchanged);
5911
- };
5912
- /**
5913
- Sets the entity to an EntityState of 'Modified'. This can also be achieved by changing the value of any property on an 'Unchanged' entity.
5914
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
5915
- > // assume order is an order entity attached to an EntityManager.
5916
- > order.entityAspect.setModified();
5917
- > // The 'order' entity will now be in a 'Modified' state.
5918
- **/
5919
- this.setModified = function () {
5920
- return this.setEntityState(EntityState.Modified);
5921
- };
5922
- /**
5923
- Sets the entity to an EntityState of 'Deleted'. This both marks the entity as being scheduled for deletion during the next 'Save' call
5924
- but also removes the entity from all of its related entities.
5925
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
5926
- > // assume order is an order entity attached to an EntityManager.
5927
- > order.entityAspect.setDeleted();
5928
- > // The 'order' entity will now be in a 'Deleted' state and it will no longer have any 'related' entities.
5929
- **/
5930
- this.setDeleted = function () {
5931
- return this.setEntityState(EntityState.Deleted);
5932
- };
5933
- /**
5934
- Sets the entity to an EntityState of 'Detached'. This removes the entity from all of its related entities, but does NOT change the EntityState of any existing entities.
5935
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
5936
- > // assume order is an order entity attached to an EntityManager.
5937
- > order.entityAspect.setDetached();
5938
- > // The 'order' entity will now be in a 'Detached' state and it will no longer have any 'related' entities.
5939
- **/
5940
- this.setDetached = function () {
5941
- return this.setEntityState(EntityState.Detached);
5942
- };
5943
6199
  this.entity = entity;
5944
6200
  // TODO: keep public or not?
5945
6201
  this.entityGroup = undefined;
@@ -5955,13 +6211,11 @@ class EntityAspect {
5955
6211
  this.propertyChanged = new BreezeEvent("propertyChanged", this);
5956
6212
  // in case this is the NULL entityAspect. - used with ComplexAspects that have no parent.
5957
6213
  if (entity != null) {
5958
- // remove properties that should be on prototype but placed on class by Babel
5959
- if (!entity.entityType) {
6214
+ // remove properties that should be on prototype but placed on instance by Babel
6215
+ if (entity.hasOwnProperty('entityType')) {
6216
+ // throw new Error("Entity instance has entityType property; should only be on prototype");
5960
6217
  delete (entity.entityType);
5961
6218
  }
5962
- if (!entity.entityAspect) {
5963
- delete (entity.entityAspect);
5964
- }
5965
6219
  entity.entityAspect = this;
5966
6220
  // entityType should already be on the entity from 'watch'
5967
6221
  let entityType = entity.entityType || entity._$entityType;
@@ -5974,7 +6228,7 @@ class EntityAspect {
5974
6228
  throw new Error("Metadata for this entityType has not yet been resolved: " + typeName);
5975
6229
  }
5976
6230
  }
5977
- let entityCtor = entityType.getEntityCtor();
6231
+ let entityCtor = entityType.getCtor();
5978
6232
  config.interfaceRegistry.modelLibrary.getDefaultInstance().startTracking(entity, entityCtor.prototype);
5979
6233
  }
5980
6234
  }
@@ -6102,6 +6356,47 @@ class EntityAspect {
6102
6356
  return this.setEntityState(EntityState.Added);
6103
6357
  }
6104
6358
  /**
6359
+ Sets the entity to an EntityState of 'Unchanged'. This is also the equivalent of calling [[EntityAspect.acceptChanges]].
6360
+ The same operation can be performed by calling [[EntityAspect.setEntityState]].
6361
+ > // assume order is an order entity attached to an EntityManager.
6362
+ > order.entityAspect.setUnchanged();
6363
+ > // The 'order' entity will now be in an 'Unchanged' state with any changes committed.
6364
+ **/
6365
+ setUnchanged = function () {
6366
+ return this.setEntityState(EntityState.Unchanged);
6367
+ };
6368
+ /**
6369
+ Sets the entity to an EntityState of 'Modified'. This can also be achieved by changing the value of any property on an 'Unchanged' entity.
6370
+ The same operation can be performed by calling [[EntityAspect.setEntityState]].
6371
+ > // assume order is an order entity attached to an EntityManager.
6372
+ > order.entityAspect.setModified();
6373
+ > // The 'order' entity will now be in a 'Modified' state.
6374
+ **/
6375
+ setModified = function () {
6376
+ return this.setEntityState(EntityState.Modified);
6377
+ };
6378
+ /**
6379
+ Sets the entity to an EntityState of 'Deleted'. This both marks the entity as being scheduled for deletion during the next 'Save' call
6380
+ but also removes the entity from all of its related entities. If the current entityState is 'Added', then `setDeleted()` will mark it 'Detached'
6381
+ The same operation can be performed by calling [[EntityAspect.setEntityState]].
6382
+ > // assume order is an order entity attached to an EntityManager.
6383
+ > order.entityAspect.setDeleted();
6384
+ > // The 'order' entity will now be in a 'Deleted' state and it will no longer have any 'related' entities.
6385
+ **/
6386
+ setDeleted = function () {
6387
+ return this.setEntityState(EntityState.Deleted);
6388
+ };
6389
+ /**
6390
+ Sets the entity to an EntityState of 'Detached'. This removes the entity from all of its related entities, but does NOT change the EntityState of any existing entities.
6391
+ The same operation can be performed by calling [[EntityAspect.setEntityState]].
6392
+ > // assume order is an order entity attached to an EntityManager.
6393
+ > order.entityAspect.setDetached();
6394
+ > // The 'order' entity will now be in a 'Detached' state and it will no longer have any 'related' entities.
6395
+ **/
6396
+ setDetached = function () {
6397
+ return this.setEntityState(EntityState.Detached);
6398
+ };
6399
+ /**
6105
6400
  Sets the entity to the specified EntityState. See also 'setUnchanged', 'setModified', 'setDetached', etc.
6106
6401
  > // assume order is an order entity attached to an EntityManager.
6107
6402
  > order.entityAspect.setEntityState(EntityState.Unchanged);
@@ -6118,12 +6413,12 @@ class EntityAspect {
6118
6413
  let em = this.entityManager;
6119
6414
  let needsSave = true;
6120
6415
  if (entityState === EntityState.Unchanged) {
6121
- clearOriginalValues(entity);
6416
+ clearOriginalValues$1(entity);
6122
6417
  delete this.hasTempKey;
6123
6418
  needsSave = false;
6124
6419
  }
6125
6420
  else if (entityState === EntityState.Added) {
6126
- clearOriginalValues(entity);
6421
+ clearOriginalValues$1(entity);
6127
6422
  // TODO: more to do here... like regenerating key ???
6128
6423
  }
6129
6424
  else if (entityState === EntityState.Deleted) {
@@ -6464,8 +6759,6 @@ class EntityAspect {
6464
6759
  }
6465
6760
  }
6466
6761
  }
6467
- /** @hidden @internal */
6468
- EntityAspect._nullInstance = new EntityAspect(); // TODO: determine if this works
6469
6762
  BreezeEvent.bubbleEvent(EntityAspect.prototype, function () {
6470
6763
  return this.entityManager;
6471
6764
  });
@@ -6599,6 +6892,17 @@ entity via either a query, import or EntityManager.createEntity call.
6599
6892
  > // aCustomer === aspect.parent;
6600
6893
  **/
6601
6894
  class ComplexAspect {
6895
+ /** The complex object that this aspect is associated with. __Read Only__ */
6896
+ complexObject;
6897
+ /** The 'original values' of this complex object where they are different from the 'current values'.
6898
+ This is a map where the key is a property name and the value is the 'original value' of the property.
6899
+ __Read Only__ */
6900
+ originalValues;
6901
+ /** The parent object that to which this aspect belongs; this will either be an entity or another complex object. __Read Only__ */
6902
+ parent;
6903
+ /** The [[DataProperty]] on the 'parent' that contains this complex object. __Read Only__ */
6904
+ parentProperty;
6905
+ extraMetadata;
6602
6906
  /** You will rarely, if ever, create a ComplexAspect directly. */
6603
6907
  constructor(complexObject, parent, parentProperty) {
6604
6908
  if (!complexObject) {
@@ -6658,18 +6962,18 @@ class ComplexAspect {
6658
6962
  return aspect.getPropertyPath(this.parentProperty.name + "." + propName);
6659
6963
  }
6660
6964
  }
6661
- function clearOriginalValues(target) {
6965
+ function clearOriginalValues$1(target) {
6662
6966
  let aspect = target.entityAspect || target.complexAspect;
6663
6967
  aspect.originalValues = {};
6664
6968
  let stype = target.entityType || target.complexType;
6665
6969
  stype.complexProperties.forEach(function (cp) {
6666
6970
  let cos = target.getProperty(cp.name);
6667
6971
  if (cp.isScalar) {
6668
- clearOriginalValues(cos);
6972
+ clearOriginalValues$1(cos);
6669
6973
  }
6670
6974
  else {
6671
6975
  cos._acceptChanges();
6672
- cos.forEach(clearOriginalValues);
6976
+ cos.forEach(clearOriginalValues$1);
6673
6977
  }
6674
6978
  });
6675
6979
  }
@@ -6682,6 +6986,14 @@ The default NamingConvention does not perform any translation, it simply passes
6682
6986
  @dynamic
6683
6987
  **/
6684
6988
  class NamingConvention {
6989
+ /** @hidden @internal */
6990
+ _$typeName;
6991
+ /** The name of this NamingConvention. __Read Only__ */
6992
+ name;
6993
+ /** Function that takes a server property name add converts it into a client side property name. __Read Only__ */
6994
+ serverPropertyNameToClient;
6995
+ /** Function that takes a client property name add converts it into a server side property name. __Read Only__ */
6996
+ clientPropertyNameToServer;
6685
6997
  /**
6686
6998
  NamingConvention constructor
6687
6999
  > // A naming convention that converts the first character of every property name to uppercase on the server
@@ -6709,6 +7021,38 @@ class NamingConvention {
6709
7021
  config._storeObject(this, "NamingConvention", this.name);
6710
7022
  }
6711
7023
  /**
7024
+
7025
+
7026
+ /**
7027
+ A noop naming convention - This is the default unless another is specified.
7028
+ **/
7029
+ static none = new NamingConvention({
7030
+ name: "noChange",
7031
+ serverPropertyNameToClient: (serverPropertyName) => {
7032
+ return serverPropertyName;
7033
+ },
7034
+ clientPropertyNameToServer: (clientPropertyName) => {
7035
+ return clientPropertyName;
7036
+ }
7037
+ });
7038
+ /**
7039
+ The "camelCase" naming convention - This implementation only lowercases the first character of the server property name
7040
+ but leaves the rest of the property name intact. If a more complicated version is needed then one should be created via the ctor.
7041
+ **/
7042
+ static camelCase = new NamingConvention({
7043
+ name: "camelCase",
7044
+ serverPropertyNameToClient: (serverPropertyName) => {
7045
+ return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);
7046
+ },
7047
+ clientPropertyNameToServer: (clientPropertyName) => {
7048
+ return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);
7049
+ }
7050
+ });
7051
+ /**
7052
+ The default value whenever NamingConventions are not specified.
7053
+ **/
7054
+ static defaultInstance = new NamingConvention(NamingConvention.none);
7055
+ /**
6712
7056
  Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
6713
7057
  The current instance is returned unchanged.
6714
7058
  > var namingConv = new NamingConvention({
@@ -6725,38 +7069,6 @@ class NamingConvention {
6725
7069
  return core.setAsDefault(this, NamingConvention);
6726
7070
  }
6727
7071
  }
6728
- /**
6729
-
6730
-
6731
- /**
6732
- A noop naming convention - This is the default unless another is specified.
6733
- **/
6734
- NamingConvention.none = new NamingConvention({
6735
- name: "noChange",
6736
- serverPropertyNameToClient: (serverPropertyName) => {
6737
- return serverPropertyName;
6738
- },
6739
- clientPropertyNameToServer: (clientPropertyName) => {
6740
- return clientPropertyName;
6741
- }
6742
- });
6743
- /**
6744
- The "camelCase" naming convention - This implementation only lowercases the first character of the server property name
6745
- but leaves the rest of the property name intact. If a more complicated version is needed then one should be created via the ctor.
6746
- **/
6747
- NamingConvention.camelCase = new NamingConvention({
6748
- name: "camelCase",
6749
- serverPropertyNameToClient: (serverPropertyName) => {
6750
- return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);
6751
- },
6752
- clientPropertyNameToServer: (clientPropertyName) => {
6753
- return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);
6754
- }
6755
- });
6756
- /**
6757
- The default value whenever NamingConventions are not specified.
6758
- **/
6759
- NamingConvention.defaultInstance = new NamingConvention(NamingConvention.none);
6760
7072
  NamingConvention.prototype._$typeName = "NamingConvention";
6761
7073
 
6762
7074
  const RX_COLLECTION = /Collection\((.*)\)/;
@@ -7149,6 +7461,16 @@ The default LocalQueryComparisonOptions stipulates 'caseInsensitive" queries wit
7149
7461
  length strings.
7150
7462
  **/
7151
7463
  class LocalQueryComparisonOptions {
7464
+ /** @hidden @internal */
7465
+ _$typeName; // on prototype
7466
+ /** The name for this instance. */
7467
+ name;
7468
+ /** Whether predicates that involve strings will be interpreted in a "caseSensitive" manner. (default = false). */
7469
+ isCaseSensitive;
7470
+ /* Whether or not to enforce the ANSI SQL standard
7471
+ of padding strings of unequal lengths before comparison with spaces. Note that per the standard, padding only occurs with equality and
7472
+ inequality predicates, and not with operations like 'startsWith', 'endsWith' or 'contains'. Default is true. */
7473
+ usesSql92CompliantStringComparison;
7152
7474
  /**
7153
7475
  LocalQueryComparisonOptions constructor
7154
7476
  > // create a 'caseSensitive - non SQL' instance.
@@ -7176,6 +7498,18 @@ class LocalQueryComparisonOptions {
7176
7498
  config._storeObject(this, "LocalQueryComparisonOptions", this.name);
7177
7499
  }
7178
7500
  /**
7501
+ Case insensitive SQL compliant options - this is also the default unless otherwise changed.
7502
+ **/
7503
+ static caseInsensitiveSQL = new LocalQueryComparisonOptions({
7504
+ name: "caseInsensitiveSQL",
7505
+ isCaseSensitive: false,
7506
+ usesSql92CompliantStringComparison: true
7507
+ });
7508
+ /**
7509
+ The default value whenever LocalQueryComparisonOptions are not specified. By default this is 'caseInsensitiveSQL'.
7510
+ **/
7511
+ static defaultInstance = new LocalQueryComparisonOptions(LocalQueryComparisonOptions.caseInsensitiveSQL);
7512
+ /**
7179
7513
  Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
7180
7514
  The current instance is returned unchanged.
7181
7515
  > var lqco = new LocalQueryComparisonOptions({
@@ -7188,18 +7522,6 @@ class LocalQueryComparisonOptions {
7188
7522
  return core.setAsDefault(this, LocalQueryComparisonOptions);
7189
7523
  }
7190
7524
  }
7191
- /**
7192
- Case insensitive SQL compliant options - this is also the default unless otherwise changed.
7193
- **/
7194
- LocalQueryComparisonOptions.caseInsensitiveSQL = new LocalQueryComparisonOptions({
7195
- name: "caseInsensitiveSQL",
7196
- isCaseSensitive: false,
7197
- usesSql92CompliantStringComparison: true
7198
- });
7199
- /**
7200
- The default value whenever LocalQueryComparisonOptions are not specified. By default this is 'caseInsensitiveSQL'.
7201
- **/
7202
- LocalQueryComparisonOptions.defaultInstance = new LocalQueryComparisonOptions(LocalQueryComparisonOptions.caseInsensitiveSQL);
7203
7525
  LocalQueryComparisonOptions.prototype._$typeName = "LocalQueryComparisonOptions";
7204
7526
 
7205
7527
  /** @hidden @internal */
@@ -7663,6 +7985,52 @@ explicit MetadataStore, the MetadataStore from the MetadataStore.defaultInstance
7663
7985
  @dynamic
7664
7986
  **/
7665
7987
  class MetadataStore {
7988
+ /** @hidden @internal */
7989
+ static __id = 0;
7990
+ /** @hidden @internal */
7991
+ static ANONTYPE_PREFIX = "_IB_";
7992
+ /** The version of any MetadataStores created by this class */
7993
+ static metadataVersion = '1.0.5';
7994
+ name;
7995
+ dataServices;
7996
+ /** The [[NamingConvention]] associated with this MetadataStore. __Read Only__ */
7997
+ namingConvention;
7998
+ /** The [[LocalQueryComparisonOptions]] associated with this MetadataStore. __Read Only__ */
7999
+ localQueryComparisonOptions;
8000
+ serializerFn;
8001
+ /**
8002
+ An [[BreezeEvent]] that fires after a MetadataStore has completed fetching metadata from a remote service.
8003
+
8004
+ @eventArgs -
8005
+ - metadataStore - The MetadataStore into which the metadata was fetched.
8006
+ - dataService - The [[DataService]] that metadata was fetched from.
8007
+ - rawMetadata - {Object} The raw metadata returned from the service. (It will have already been processed by this point).
8008
+ > let ms = myEntityManager.metadataStore;
8009
+ > ms.metadataFetched.subscribe(function(args) {
8010
+ > let metadataStore = args.metadataStore;
8011
+ > let dataService = args.dataService;
8012
+ > });
8013
+ @event
8014
+ **/
8015
+ metadataFetched;
8016
+ /** @hidden @internal */
8017
+ _resourceEntityTypeMap;
8018
+ /** @hidden @internal */
8019
+ _entityTypeResourceMap;
8020
+ /** @hidden @internal key is qualified structuraltype name - value is structuralType. ( structural = entityType or complexType). */
8021
+ _structuralTypeMap;
8022
+ /** @hidden @internal key is shortName, value is qualified name - does not need to be serialized. **/
8023
+ _shortNameMap;
8024
+ /** @hidden @internal key is either short or qual type name - value is ctor; **/
8025
+ _ctorRegistry;
8026
+ /** @hidden @internal key is entityTypeName; value is array of nav props **/
8027
+ _incompleteTypeMap;
8028
+ /** @hidden @internal **/
8029
+ _incompleteComplexTypeMap;
8030
+ /** @hidden @internal { json: any, stype: StructuralType }[] | { entityType: EntityType, csdlEntityType: any }[] **/
8031
+ _deferredTypes;
8032
+ /** @hidden @internal **/
8033
+ _id;
7666
8034
  /**
7667
8035
  Constructs a new MetadataStore.
7668
8036
 
@@ -7702,6 +8070,10 @@ class MetadataStore {
7702
8070
  this._id = MetadataStore.__id++;
7703
8071
  this.metadataFetched = new BreezeEvent("metadataFetched", this);
7704
8072
  }
8073
+ // needs to be made avail to dataService.xxx files
8074
+ static normalizeTypeName = core.memoize(function (rawTypeName) {
8075
+ return rawTypeName && MetadataStore.parseTypeName(rawTypeName).typeName;
8076
+ });
7705
8077
  // for debugging use the line below instead.
7706
8078
  //ctor.normalizeTypeName = function (rawTypeName) { return parseTypeName(rawTypeName).typeName; };
7707
8079
  /**
@@ -8232,16 +8604,6 @@ class MetadataStore {
8232
8604
  }
8233
8605
  }
8234
8606
  }
8235
- /** @hidden @internal */
8236
- MetadataStore.__id = 0;
8237
- /** @hidden @internal */
8238
- MetadataStore.ANONTYPE_PREFIX = "_IB_";
8239
- /** The version of any MetadataStores created by this class */
8240
- MetadataStore.metadataVersion = '1.0.5';
8241
- // needs to be made avail to dataService.xxx files
8242
- MetadataStore.normalizeTypeName = core.memoize(function (rawTypeName) {
8243
- return rawTypeName && MetadataStore.parseTypeName(rawTypeName).typeName;
8244
- });
8245
8607
  MetadataStore.prototype._$typeName = "MetadataStore";
8246
8608
  BreezeEvent.bubbleEvent(MetadataStore.prototype);
8247
8609
  function getTypesFromMap(typeMap) {
@@ -8360,6 +8722,76 @@ function getQualifiedTypeName(metadataStore, structTypeName, throwIfNotFound) {
8360
8722
  /** Container for all of the metadata about a specific type of Entity.
8361
8723
  **/
8362
8724
  class EntityType {
8725
+ /** @hidden @internal */
8726
+ static __nextAnonIx = 0;
8727
+ /** Always false for an EntityType. **/
8728
+ isComplexType = false;
8729
+ /** The [[MetadataStore]] that contains this EntityType. __Read Only__ **/
8730
+ metadataStore;
8731
+ /** The DataProperties (see [[DataProperty]] associated with this EntityType. __Read Only__ **/
8732
+ dataProperties;
8733
+ /** The NavigationProperties (see [[NavigationProperty]] associated with this EntityType. __Read Only__ **/
8734
+ navigationProperties;
8735
+ /**
8736
+ The DataProperties associated with this EntityType that make up it's [[EntityKey]]. __Read Only__ **/
8737
+ keyProperties;
8738
+ /** The DataProperties associated with this EntityType that are foreign key properties. __Read Only__ **/
8739
+ foreignKeyProperties;
8740
+ inverseForeignKeyProperties;
8741
+ /** The DataProperties associated with this EntityType that are concurrency properties. __Read Only__ **/
8742
+ concurrencyProperties;
8743
+ /** The DataProperties for this EntityType that contain instances of a [[ComplexType]]. __Read Only__ **/
8744
+ complexProperties;
8745
+ /** The DataProperties associated with this EntityType that are not mapped to any backend datastore. These are effectively free standing
8746
+ properties. __Read Only__ **/
8747
+ unmappedProperties;
8748
+ /** The fully qualified name of this EntityType. __Read Only__ **/
8749
+ name;
8750
+ /** The short, unqualified, name for this EntityType. __Read Only__ **/
8751
+ shortName;
8752
+ /** The namespace for this EntityType. __Read Only__ **/
8753
+ namespace;
8754
+ /** The name of this EntityType's base EntityType (if any) */
8755
+ baseTypeName;
8756
+ /** The base EntityType (if any) for this EntityType. __Read Only__ **/
8757
+ baseEntityType;
8758
+ subtypes;
8759
+ /** Whether this EntityType is abstract. __Read Only__ **/
8760
+ isAbstract;
8761
+ /** Whether this EntityType is anonymous. Anonymous types will never be communicated to or from the server. They are purely for
8762
+ client side use and are given an automatically generated name. __Read Only__ **/
8763
+ isAnonymous;
8764
+ /** Whether this EntityType has been 'frozen'. EntityTypes become frozen after the first instance
8765
+ of that type has been created and attached to an EntityManager. */
8766
+ isFrozen;
8767
+ /** The [[AutoGeneratedKeyType]] for this EntityType. __Read Only__ **/
8768
+ autoGeneratedKeyType;
8769
+ /** The default resource name associated with this EntityType. An EntityType may be queried via a variety of 'resource names' but this one
8770
+ is used as the default when no resource name is provided. This will occur when calling [[EntityAspect.loadNavigationProperty]]
8771
+ or when executing any [[EntityQuery]] that was created via an [[EntityKey]]. __Read Only__ **/
8772
+ defaultResourceName;
8773
+ /** A function that is used to customize the serialization of any EntityProperties of this type. */
8774
+ serializerFn;
8775
+ /** A free form object that can be used to define any custom metadata for this EntityType. __Read Only__ **/
8776
+ custom;
8777
+ /** The entity level validators associated with this EntityType. Validators can be added and
8778
+ removed from this collection. __Read Only__. **/
8779
+ validators;
8780
+ warnings;
8781
+ initFn;
8782
+ noTrackingFn;
8783
+ /** @hidden @internal */
8784
+ _extra;
8785
+ /** @hidden @internal */
8786
+ _ctor;
8787
+ /** @hidden @internal */
8788
+ _mappedPropertiesCount;
8789
+ /**
8790
+ @deprecated Use [[getCtor]] instead.
8791
+ */
8792
+ getEntityCtor = this.getCtor;
8793
+ /** @hidden @internal */
8794
+ static qualifyTypeName = qualifyTypeName;
8363
8795
  /** EntityType constructor
8364
8796
  > let entityType = new EntityType( {
8365
8797
  > shortName: "person",
@@ -8370,12 +8802,6 @@ class EntityType {
8370
8802
  client side use and will be given an automatically generated name. Normally, however, you will use a configuration object.
8371
8803
  **/
8372
8804
  constructor(config) {
8373
- /** Always false for an EntityType. **/
8374
- this.isComplexType = false;
8375
- /**
8376
- @deprecated Use [[getCtor]] instead.
8377
- */
8378
- this.getEntityCtor = this.getCtor;
8379
8805
  if (arguments.length > 1) {
8380
8806
  throw new Error("The EntityType ctor has a single argument that is either a 'MetadataStore' or a configuration object.");
8381
8807
  }
@@ -9027,10 +9453,6 @@ class EntityType {
9027
9453
  delete incompleteTypeMap[this.name];
9028
9454
  }
9029
9455
  }
9030
- /** @hidden @internal */
9031
- EntityType.__nextAnonIx = 0;
9032
- /** @hidden @internal */
9033
- EntityType.qualifyTypeName = qualifyTypeName;
9034
9456
  EntityType.prototype._$typeName = "EntityType";
9035
9457
  function getRawValueFromConfig(rawEntity, dp) {
9036
9458
  // 'true' fork can happen if an initializer contains an actaul instance of an already created complex object.
@@ -9169,33 +9591,66 @@ function calcUnmappedProperties(stype, instance) {
9169
9591
  @param config - Configuration settings
9170
9592
  **/
9171
9593
  class ComplexType {
9594
+ /** For polymorphic purpose only - always true here */
9595
+ isComplexType = true;
9596
+ /** The [[MetadataStore]] containing this ComplexType. */
9597
+ metadataStore;
9598
+ /** The fully qualifed name of this ComplexType. __Read Only__ **/
9599
+ name;
9600
+ /** The short, unqualified, name for this ComplexType. __Read Only__ **/
9601
+ shortName;
9602
+ /** The namespace for this ComplexType. __Read Only__ **/
9603
+ namespace;
9604
+ /** The DataProperties (see [[DataProperty]] associated with this ComplexType. __Read Only__ */
9605
+ dataProperties;
9606
+ /** The DataProperties for this ComplexType that contain instances of a [[ComplexType]]. __Read Only__ */
9607
+ complexProperties;
9608
+ /**
9609
+ The entity level validators associated with this ComplexType. Validators can be added and
9610
+ removed from this collection. __Read Only__ **/
9611
+ validators;
9612
+ /** For polymorphic purpose only - always empty here */
9613
+ concurrencyProperties;
9614
+ /** The DataProperties associated with this ComplexType that are not mapped to any backend datastore. These are effectively free standing
9615
+ properties. __Read Only__ **/
9616
+ unmappedProperties;
9617
+ // keyProperties and navigationProperties are not used on complexTypes - but here to allow sharing of code between EntityType and ComplexType.
9618
+ navigationProperties;
9619
+ // and may be used later to enforce uniqueness on arrays of complextypes.
9620
+ keyProperties;
9621
+ warnings;
9622
+ serializerFn;
9623
+ /** A free form object that can be used to define any custom metadata for this ComplexType. ***/
9624
+ custom;
9625
+ /** @hidden @internal */
9626
+ _mappedPropertiesCount;
9627
+ /** @hidden @internal */
9628
+ _extra;
9629
+ // copy entityType methods onto complexType
9630
+ /** See [[EntityType.getCtor]] */
9631
+ getCtor = EntityType.prototype.getCtor;
9632
+ // note the name change.
9633
+ createInstance = EntityType.prototype.createEntity;
9634
+ /** See [EntityType.addValidator] */
9635
+ addValidator = EntityType.prototype.addValidator;
9636
+ getProperty = EntityType.prototype.getProperty;
9637
+ getPropertiesOnPath = EntityType.prototype.getPropertiesOnPath;
9638
+ getPropertyNames = EntityType.prototype.getPropertyNames;
9639
+ /** @hidden @internal */
9640
+ _addPropertyCore = EntityType.prototype._addPropertyCore;
9641
+ /** @hidden @internal */
9642
+ _addDataProperty = EntityType.prototype._addDataProperty;
9643
+ /** @hidden @internal */
9644
+ _updateNames = EntityType.prototype._updateNames;
9645
+ /** @hidden @internal */
9646
+ _updateCps = EntityType.prototype._updateCps;
9647
+ /** @hidden @internal */
9648
+ _initializeInstance = EntityType.prototype._initializeInstance;
9649
+ /** @hidden @internal */
9650
+ _updateTargetFromRaw = EntityType.prototype._updateTargetFromRaw;
9651
+ /** @hidden @internal */
9652
+ _setCtor = EntityType.prototype._setCtor;
9172
9653
  constructor(config) {
9173
- /** For polymorphic purpose only - always true here */
9174
- this.isComplexType = true;
9175
- // copy entityType methods onto complexType
9176
- /** See [[EntityType.getCtor]] */
9177
- this.getCtor = EntityType.prototype.getCtor;
9178
- // note the name change.
9179
- this.createInstance = EntityType.prototype.createEntity;
9180
- /** See [EntityType.addValidator] */
9181
- this.addValidator = EntityType.prototype.addValidator;
9182
- this.getProperty = EntityType.prototype.getProperty;
9183
- this.getPropertiesOnPath = EntityType.prototype.getPropertiesOnPath;
9184
- this.getPropertyNames = EntityType.prototype.getPropertyNames;
9185
- /** @hidden @internal */
9186
- this._addPropertyCore = EntityType.prototype._addPropertyCore;
9187
- /** @hidden @internal */
9188
- this._addDataProperty = EntityType.prototype._addDataProperty;
9189
- /** @hidden @internal */
9190
- this._updateNames = EntityType.prototype._updateNames;
9191
- /** @hidden @internal */
9192
- this._updateCps = EntityType.prototype._updateCps;
9193
- /** @hidden @internal */
9194
- this._initializeInstance = EntityType.prototype._initializeInstance;
9195
- /** @hidden @internal */
9196
- this._updateTargetFromRaw = EntityType.prototype._updateTargetFromRaw;
9197
- /** @hidden @internal */
9198
- this._setCtor = EntityType.prototype._setCtor;
9199
9654
  if (arguments.length > 1) {
9200
9655
  throw new Error("The ComplexType ctor has a single argument that is a configuration object.");
9201
9656
  }
@@ -9276,6 +9731,10 @@ Instances of the DataProperty class are constructed automatically during Metadat
9276
9731
  directly via the constructor.
9277
9732
  **/
9278
9733
  class DataProperty {
9734
+ /** Is this a DataProperty? - always true here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9735
+ isDataProperty = true;
9736
+ /** Is this a NavigationProperty? - always false here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9737
+ isNavigationProperty = false;
9279
9738
  /** DataProperty constructor
9280
9739
  > let lastNameProp = new DataProperty( {
9281
9740
  > name: "lastName",
@@ -9288,10 +9747,6 @@ class DataProperty {
9288
9747
  @param config - A configuration Object or a DataProperty
9289
9748
  */
9290
9749
  constructor(config) {
9291
- /** Is this a DataProperty? - always true here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9292
- this.isDataProperty = true;
9293
- /** Is this a NavigationProperty? - always false here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9294
- this.isNavigationProperty = false;
9295
9750
  assertConfig(config)
9296
9751
  .whereParam("name").isString().isOptional()
9297
9752
  .whereParam("nameOnServer").isString().isOptional()
@@ -9455,6 +9910,15 @@ Instances of the NavigationProperty class are constructed automatically during M
9455
9910
  directly via the constructor.
9456
9911
  **/
9457
9912
  class NavigationProperty {
9913
+ /** Is this a DataProperty? - always false here
9914
+ Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9915
+ isDataProperty = false;
9916
+ /** Is this a NavigationProperty? - always true here
9917
+ Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9918
+ isNavigationProperty = true;
9919
+ formatName = DataProperty.prototype.formatName;
9920
+ getAllValidators = DataProperty.prototype.getAllValidators;
9921
+ resolveProperty = DataProperty.prototype.resolveProperty;
9458
9922
  /** NavigationProperty constructor
9459
9923
  > let homeAddressProp = new NavigationProperty( {
9460
9924
  > name: "homeAddress",
@@ -9473,15 +9937,6 @@ class NavigationProperty {
9473
9937
  @param config - A configuration object.
9474
9938
  **/
9475
9939
  constructor(config) {
9476
- /** Is this a DataProperty? - always false here
9477
- Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9478
- this.isDataProperty = false;
9479
- /** Is this a NavigationProperty? - always true here
9480
- Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9481
- this.isNavigationProperty = true;
9482
- this.formatName = DataProperty.prototype.formatName;
9483
- this.getAllValidators = DataProperty.prototype.getAllValidators;
9484
- this.resolveProperty = DataProperty.prototype.resolveProperty;
9485
9940
  assertConfig(config)
9486
9941
  .whereParam("name").isString().isOptional()
9487
9942
  .whereParam("nameOnServer").isString().isOptional()
@@ -9673,24 +10128,24 @@ function resolveRelated(np) {
9673
10128
  AutoGeneratedKeyType is an 'Enum' containing all of the valid states for an automatically generated key.
9674
10129
  **/
9675
10130
  class AutoGeneratedKeyType extends BreezeEnum {
10131
+ /**
10132
+ This entity does not have an autogenerated key.
10133
+ The client must set the key before adding the entity to the EntityManager
10134
+ **/
10135
+ static None = new AutoGeneratedKeyType();
10136
+ /**
10137
+ This entity's key is an Identity column and is set by the backend database.
10138
+ Keys for new entities will be temporary until the entities are saved at which point the keys will
10139
+ be converted to their 'real' versions.
10140
+ **/
10141
+ static Identity = new AutoGeneratedKeyType();
10142
+ /**
10143
+ This entity's key is generated by a KeyGenerator and is set by the backend database.
10144
+ Keys for new entities will be temporary until the entities are saved at which point the keys will
10145
+ be converted to their 'real' versions.
10146
+ **/
10147
+ static KeyGenerator = new AutoGeneratedKeyType();
9676
10148
  }
9677
- /**
9678
- This entity does not have an autogenerated key.
9679
- The client must set the key before adding the entity to the EntityManager
9680
- **/
9681
- AutoGeneratedKeyType.None = new AutoGeneratedKeyType();
9682
- /**
9683
- This entity's key is an Identity column and is set by the backend database.
9684
- Keys for new entities will be temporary until the entities are saved at which point the keys will
9685
- be converted to their 'real' versions.
9686
- **/
9687
- AutoGeneratedKeyType.Identity = new AutoGeneratedKeyType();
9688
- /**
9689
- This entity's key is generated by a KeyGenerator and is set by the backend database.
9690
- Keys for new entities will be temporary until the entities are saved at which point the keys will
9691
- be converted to their 'real' versions.
9692
- **/
9693
- AutoGeneratedKeyType.KeyGenerator = new AutoGeneratedKeyType();
9694
10149
  AutoGeneratedKeyType.prototype._$typeName = "AutoGeneratedKeyType";
9695
10150
  Error['x'] = AutoGeneratedKeyType.resolveSymbols();
9696
10151
  let proto = Param.prototype;
@@ -9756,41 +10211,6 @@ function addProperties(entityType, propObj, ctor) {
9756
10211
  @hidden
9757
10212
  */
9758
10213
  class AbstractDataServiceAdapter {
9759
- constructor() {
9760
- /**
9761
- Returns a constructor function for a "ChangeRequestInterceptor"
9762
- that can tweak the saveBundle both as it is built and when it is completed
9763
- by a concrete DataServiceAdapater.
9764
-
9765
- Initialized with a default, no-op implementation that developers can replace with a
9766
- substantive implementation that changes the individual entity change requests
9767
- or aspects of the entire 'saveBundle' without having to write their own DataService adapters.
9768
- > let adapter = breeze.config.getAdapterInstance('dataService');
9769
- > adapter.changeRequestInterceptor = function (saveContext, saveBundle) {
9770
- > this.getRequest = function (request, entity, index) {
9771
- > // alter the request that the adapter prepared for this entity
9772
- > // based on the entity, saveContext, and saveBundle
9773
- > // e.g., add a custom header or prune the originalValuesMap
9774
- > return request;
9775
- > };
9776
- > this.done = function (requests) {
9777
- > // alter the array of requests representing the entire change-set
9778
- > // based on the saveContext and saveBundle
9779
- > };
9780
- > }
9781
-
9782
- @param saveContext - The BreezeJS "context" for the save operation.
9783
- @param saveBundle - Contains the array of entities-to-be-saved (AKA, the entity change-set).
9784
- @return Constructor for a "ChangeRequestInterceptor".
9785
- **/
9786
- this.changeRequestInterceptor = DefaultChangeRequestInterceptor;
9787
- this.jsonResultsAdapter = new JsonResultsAdapter({
9788
- name: "noop",
9789
- visitNode: function ( /* node, mappingContext, nodeContext */) {
9790
- return {};
9791
- }
9792
- });
9793
- }
9794
10214
  // TODO use interface
9795
10215
  checkForRecomposition(interfaceInitializedArgs) {
9796
10216
  if (interfaceInitializedArgs.interfaceName === "ajax" && interfaceInitializedArgs.isDefault) {
@@ -9925,6 +10345,33 @@ class AbstractDataServiceAdapter {
9925
10345
  // The implementor should call _createChangeRequestInterceptor
9926
10346
  throw new Error("Need a concrete implementation of _prepareSaveBundle");
9927
10347
  }
10348
+ /**
10349
+ Returns a constructor function for a "ChangeRequestInterceptor"
10350
+ that can tweak the saveBundle both as it is built and when it is completed
10351
+ by a concrete DataServiceAdapater.
10352
+
10353
+ Initialized with a default, no-op implementation that developers can replace with a
10354
+ substantive implementation that changes the individual entity change requests
10355
+ or aspects of the entire 'saveBundle' without having to write their own DataService adapters.
10356
+ > let adapter = breeze.config.getAdapterInstance('dataService');
10357
+ > adapter.changeRequestInterceptor = function (saveContext, saveBundle) {
10358
+ > this.getRequest = function (request, entity, index) {
10359
+ > // alter the request that the adapter prepared for this entity
10360
+ > // based on the entity, saveContext, and saveBundle
10361
+ > // e.g., add a custom header or prune the originalValuesMap
10362
+ > return request;
10363
+ > };
10364
+ > this.done = function (requests) {
10365
+ > // alter the array of requests representing the entire change-set
10366
+ > // based on the saveContext and saveBundle
10367
+ > };
10368
+ > }
10369
+
10370
+ @param saveContext - The BreezeJS "context" for the save operation.
10371
+ @param saveBundle - Contains the array of entities-to-be-saved (AKA, the entity change-set).
10372
+ @return Constructor for a "ChangeRequestInterceptor".
10373
+ **/
10374
+ changeRequestInterceptor = DefaultChangeRequestInterceptor;
9928
10375
  /** @hidden @internal */
9929
10376
  _createChangeRequestInterceptor(saveContext, saveBundle) {
9930
10377
  let adapter = saveContext.adapter;
@@ -9962,6 +10409,12 @@ class AbstractDataServiceAdapter {
9962
10409
  "Likely did not or could not reach server. Is the server running?";
9963
10410
  }
9964
10411
  }
10412
+ jsonResultsAdapter = new JsonResultsAdapter({
10413
+ name: "noop",
10414
+ visitNode: function ( /* node, mappingContext, nodeContext */) {
10415
+ return {};
10416
+ }
10417
+ });
9965
10418
  }
9966
10419
  function handleHttpError(reject, httpResponse, messagePrefix) {
9967
10420
  let err = createError(httpResponse);
@@ -10048,6 +10501,20 @@ A ValidationOptions instance is used to specify the conditions under which valid
10048
10501
 
10049
10502
  */
10050
10503
  class ValidationOptions {
10504
+ /** @hidden @internal */
10505
+ _$typeName; // on proto
10506
+ /** Whether entity and property level validation should occur when entities are attached to the EntityManager
10507
+ other than via a query. (default = true) __Read Only__ */
10508
+ validateOnAttach;
10509
+ /** Whether entity and property level validation should occur before entities are saved.
10510
+ A failed validation will force the save to fail early. (default = true) __Read Only__ */
10511
+ validateOnSave;
10512
+ /** Whether entity and property level validation should occur after entities are queried from a remote server.
10513
+ (default = false) __Read Only__ **/
10514
+ validateOnQuery;
10515
+ /** Whether property level validation should occur after entities are modified.
10516
+ (default = true) __Read Only__ **/
10517
+ validateOnPropertyChange;
10051
10518
  /**
10052
10519
  ValidationOptions constructor
10053
10520
  > var newVo = new ValidationOptions( { validateOnSave: false, validateOnAttach: false });
@@ -10056,7 +10523,7 @@ class ValidationOptions {
10056
10523
  @param config - A configuration object.
10057
10524
  **/
10058
10525
  constructor(config) {
10059
- updateWithConfig$1(this, config);
10526
+ updateWithConfig(this, config);
10060
10527
  }
10061
10528
  /**
10062
10529
  Returns a copy of this ValidationOptions with changes to the specified config properties.
@@ -10069,7 +10536,7 @@ class ValidationOptions {
10069
10536
  if (!config)
10070
10537
  return this;
10071
10538
  let result = new ValidationOptions(this);
10072
- updateWithConfig$1(result, config);
10539
+ updateWithConfig(result, config);
10073
10540
  return result;
10074
10541
  }
10075
10542
  /**
@@ -10082,18 +10549,18 @@ class ValidationOptions {
10082
10549
  setAsDefault() {
10083
10550
  return core.setAsDefault(this, ValidationOptions);
10084
10551
  }
10552
+ /**
10553
+ The default instance for use whenever ValidationOptions are not specified.
10554
+ **/
10555
+ static defaultInstance = new ValidationOptions({
10556
+ validateOnAttach: true,
10557
+ validateOnSave: true,
10558
+ validateOnQuery: false,
10559
+ validateOnPropertyChange: true
10560
+ });
10085
10561
  }
10086
- /**
10087
- The default instance for use whenever ValidationOptions are not specified.
10088
- **/
10089
- ValidationOptions.defaultInstance = new ValidationOptions({
10090
- validateOnAttach: true,
10091
- validateOnSave: true,
10092
- validateOnQuery: false,
10093
- validateOnPropertyChange: true
10094
- });
10095
10562
  ValidationOptions.prototype._$typeName = "ValidationOptions";
10096
- function updateWithConfig$1(options, config) {
10563
+ function updateWithConfig(options, config) {
10097
10564
  if (config) {
10098
10565
  assertConfig(config)
10099
10566
  .whereParam("validateOnAttach").isBoolean().isOptional()
@@ -10109,6 +10576,18 @@ function updateWithConfig$1(options, config) {
10109
10576
  A SaveOptions instance is used to specify the 'options' under which a save will occur.
10110
10577
  **/
10111
10578
  class SaveOptions {
10579
+ /** @hidden @internal */
10580
+ _$typeName; // on proto
10581
+ /** Resource name to be used during the save - this defaults to "SaveChanges". __Read Only__ */
10582
+ resourceName;
10583
+ /** The DataService to be used for this save. __Read Only__ */
10584
+ dataService;
10585
+ /** Whether multiple saves can be in-flight at the same time. The default is false. __Read Only__ */
10586
+ allowConcurrentSaves;
10587
+ /** Free form value that will be sent to the server during the save. __Read Only__ */
10588
+ tag;
10589
+ /** The default value whenever SaveOptions are not specified. */
10590
+ static defaultInstance = new SaveOptions({ allowConcurrentSaves: false });
10112
10591
  constructor(config) {
10113
10592
  SaveOptions._updateWithConfig(this, config);
10114
10593
  }
@@ -10139,14 +10618,14 @@ class SaveOptions {
10139
10618
  return obj;
10140
10619
  }
10141
10620
  }
10142
- /** The default value whenever SaveOptions are not specified. */
10143
- SaveOptions.defaultInstance = new SaveOptions({ allowConcurrentSaves: false });
10144
10621
  SaveOptions.prototype._$typeName = "SaveOptions";
10145
10622
 
10146
10623
  /*
10147
10624
  @class KeyGenerator
10148
10625
  */
10149
10626
  class KeyGenerator {
10627
+ /** @hidden @internal */
10628
+ _tempIdMap;
10150
10629
  constructor() {
10151
10630
  // key is dataProperty.name + || + entityType.name, value is propEntry
10152
10631
  // propEntry = { entityType, propertyName, keyMap }
@@ -10251,6 +10730,11 @@ config.registerType(KeyGenerator, "KeyGenerator");
10251
10730
 
10252
10731
  /** @hidden @internal */
10253
10732
  class EntityGroup {
10733
+ entityManager;
10734
+ entityType;
10735
+ _indexMap;
10736
+ _entities;
10737
+ _emptyIndexes;
10254
10738
  constructor(entityManager, entityType) {
10255
10739
  this.entityManager = entityManager;
10256
10740
  this.entityType = entityType;
@@ -10438,8 +10922,19 @@ For use by breeze plugin authors only. The class is for use in building a [[IDat
10438
10922
  @hidden
10439
10923
  */
10440
10924
  class MappingContext {
10925
+ /** @hidden @internal */
10926
+ _$typeName; // on prototype
10927
+ rawValueFn = DataProperty.getRawValueFromServer; // think about passing this in later.
10928
+ dataService;
10929
+ query;
10930
+ entityManager;
10931
+ mergeOptions;
10932
+ adapter; // assigned in the AbstractDataServiceAdapter.
10933
+ refMap; // TODO
10934
+ deferredFns; // TODO
10935
+ jsonResultsAdapter;
10936
+ metadataStore;
10441
10937
  constructor(config) {
10442
- this.rawValueFn = DataProperty.getRawValueFromServer; // think about passing this in later.
10443
10938
  core.extend(this, config, [
10444
10939
  "query", "entityManager", "dataService", "mergeOptions"
10445
10940
  ]);
@@ -10472,7 +10967,7 @@ class MappingContext {
10472
10967
  let jra = this.jsonResultsAdapter;
10473
10968
  nodeContext = nodeContext || {};
10474
10969
  let that = this;
10475
- return core.map(nodes, function (node) {
10970
+ let result = core.map(nodes, function (node) {
10476
10971
  if (query == null && node.entityAspect) {
10477
10972
  // don't bother merging a result from a save that was not returned from the server.
10478
10973
  if (node.entityAspect.entityState.isDeleted()) {
@@ -10490,6 +10985,11 @@ class MappingContext {
10490
10985
  }
10491
10986
  return processMeta(that, node, meta);
10492
10987
  }, this.mergeOptions.includeDeleted);
10988
+ if (result.filter && !this.mergeOptions.includeDeleted) {
10989
+ // result may have deleted entities because related nodes were processed
10990
+ result = result.filter((x) => x && (!x.entityAspect || !x.entityAspect.entityState.isDeleted()));
10991
+ }
10992
+ return result;
10493
10993
  }
10494
10994
  processDeferred() {
10495
10995
  if (this.deferredFns.length > 0) {
@@ -10657,7 +11157,7 @@ function mergeEntity(mc, node, meta) {
10657
11157
  targetEntity.entityAspect.extraMetadata = meta.extraMetadata;
10658
11158
  }
10659
11159
  targetEntity.entityAspect.entityState = EntityState.Unchanged;
10660
- clearOriginalValues$1(targetEntity);
11160
+ clearOriginalValues(targetEntity);
10661
11161
  // propertyName not specified because multiple props EntityChangedEventArgs
10662
11162
  targetEntity.entityAspect.propertyChanged.publish({ entity: targetEntity, propertyName: null });
10663
11163
  let action = isSaving ? EntityAction.MergeOnSave : EntityAction.MergeOnQuery;
@@ -10669,10 +11169,11 @@ function mergeEntity(mc, node, meta) {
10669
11169
  }
10670
11170
  }
10671
11171
  else {
11172
+ // process targetEntity (even if deleted) to ensure related nodes are handled
11173
+ updateEntityNoMerge(mc, targetEntity, node);
10672
11174
  if (targetEntityState === EntityState.Deleted && !mc.mergeOptions.includeDeleted) {
10673
11175
  return null;
10674
11176
  }
10675
- updateEntityNoMerge(mc, targetEntity, node);
10676
11177
  }
10677
11178
  }
10678
11179
  }
@@ -10690,18 +11191,18 @@ function mergeEntity(mc, node, meta) {
10690
11191
  return targetEntity;
10691
11192
  }
10692
11193
  // copied from entityAspect
10693
- function clearOriginalValues$1(target) {
11194
+ function clearOriginalValues(target) {
10694
11195
  let aspect = target.entityAspect || target.complexAspect;
10695
11196
  aspect.originalValues = {};
10696
11197
  let stype = target.entityType || target.complexType;
10697
11198
  stype.complexProperties.forEach(function (cp) {
10698
11199
  let cos = target.getProperty(cp.name);
10699
11200
  if (cp.isScalar) {
10700
- clearOriginalValues$1(cos);
11201
+ clearOriginalValues(cos);
10701
11202
  }
10702
11203
  else {
10703
11204
  cos._acceptChanges();
10704
- cos.forEach(clearOriginalValues$1);
11205
+ cos.forEach(clearOriginalValues);
10705
11206
  }
10706
11207
  });
10707
11208
  }
@@ -10833,10 +11334,8 @@ function updateRelatedEntityInCollection(mc, relatedEntity, relatedEntities, tar
10833
11334
  /** @hidden @internal */
10834
11335
  // Represents entities not yet attached to navigationProperties.
10835
11336
  class UnattachedChildrenMap {
10836
- constructor() {
10837
- // key is EntityKey.toString(), value is array of { navigationProperty, children }
10838
- this.map = {};
10839
- }
11337
+ // key is EntityKey.toString(), value is array of { navigationProperty, children }
11338
+ map = {};
10840
11339
  addChild(parentEntityKey, navigationProperty, child) {
10841
11340
  let tuple = this.getTuple(parentEntityKey, navigationProperty);
10842
11341
  if (!tuple) {
@@ -10891,6 +11390,100 @@ class UnattachedChildrenMap {
10891
11390
  Instances of the EntityManager contain and manage collections of entities, either retrieved from a backend datastore or created on the client.
10892
11391
  **/
10893
11392
  class EntityManager {
11393
+ /** @hidden @internal */
11394
+ _$typeName; // actually defined on prototype
11395
+ /** The service name associated with this EntityManager. __Read Only__ **/
11396
+ serviceName;
11397
+ /** The DataService associated with this EntityManager. __Read Only__ **/
11398
+ dataService;
11399
+ /** The [[QueryOptions]] associated with this EntityManager. __Read Only__ **/
11400
+ queryOptions;
11401
+ /** The [[SaveOptions]] associated with this EntityManager. __Read Only__ **/
11402
+ saveOptions;
11403
+ /** The [[ValidationOptions]] associated with this EntityManager. __Read Only__ **/
11404
+ validationOptions;
11405
+ /** The [[KeyGenerator]] associated with this EntityManager. __Read Only__ **/
11406
+ keyGenerator;
11407
+ /** The [[KeyGenerator]] constructor associated with this EntityManager. __Read Only__ **/
11408
+ keyGeneratorCtor; // TODO: review this
11409
+ /** The [[MetadataStore]] associated with this EntityManager. __Read Only__ **/
11410
+ metadataStore;
11411
+ isLoading;
11412
+ isRejectingChanges;
11413
+ // events
11414
+ /**
11415
+ A [[BreezeEvent]] that fires whenever a change to any entity in this EntityManager occurs. __Read Only__
11416
+
11417
+ @eventArgs -
11418
+ - entityAction - The [[EntityAction]] that occured.
11419
+ - entity - The entity that changed. If this is null, then all entities in the entityManager were affected.
11420
+ - args - Additional information about this event. This will differ based on the entityAction.
11421
+
11422
+ > let em = new EntityManager( {serviceName: "breeze/NorthwindIBModel" });
11423
+ > em.entityChanged.subscribe(function(changeArgs) {
11424
+ > // This code will be executed any time any entity within the entityManager
11425
+ > // is added, modified, deleted or detached for any reason.
11426
+ > let action = changeArgs.entityAction;
11427
+ > let entity = changeArgs.entity;
11428
+ > // .. do something to this entity when it is changed.
11429
+ > });
11430
+ > });
11431
+ @event
11432
+ **/
11433
+ entityChanged;
11434
+ /**
11435
+ An [[BreezeEvent]] that fires whenever validationErrors change for any entity in this EntityManager. __Read Only__
11436
+ @eventArgs -
11437
+ - entity - The entity on which the validation errors have been added or removed.
11438
+ - added - An array containing any newly added [[ValidationError]]s
11439
+ - removed - An array containing any newly removed [[ValidationError]]s. This is those errors that have been 'fixed'
11440
+
11441
+ > let em = new EntityManager( {serviceName: "breeze/NorthwindIBModel" });
11442
+ > em.validationErrorsChanged.subscribe(function(changeArgs) {
11443
+ > // This code will be executed any time any entity within the entityManager experiences a change to its validationErrors collection.
11444
+ > function (validationChangeArgs) {
11445
+ > let entity == validationChangeArgs.entity;
11446
+ > let errorsAdded = validationChangeArgs.added;
11447
+ > let errorsCleared = validationChangeArgs.removed;
11448
+ > // ... do something interesting with the order.
11449
+ > });
11450
+ > });
11451
+ > });
11452
+ @event
11453
+ **/
11454
+ validationErrorsChanged;
11455
+ /**
11456
+ A [[BreezeEvent]] that fires whenever an EntityManager transitions to or from having changes. __Read Only__
11457
+ @eventArgs -
11458
+ - entityManager - The EntityManager whose 'hasChanges' status has changed.
11459
+ - hasChanges - Whether or not this EntityManager has changes.
11460
+
11461
+ > let em = new EntityManager( {serviceName: "breeze/NorthwindIBModel" });
11462
+ > em.hasChangesChanged.subscribe(function(args) {
11463
+ > let hasChangesChanged = args.hasChanges;
11464
+ > let entityManager = args.entityManager;
11465
+ > });
11466
+ > });
11467
+ @event
11468
+ **/
11469
+ hasChangesChanged;
11470
+ /** @hidden @internal */
11471
+ _pendingPubs; // TODO: refine later
11472
+ /** @hidden @internal */
11473
+ _hasChangesAction; // TODO refine later
11474
+ /** @hidden @internal */
11475
+ _hasChanges;
11476
+ /** @hidden @internal */
11477
+ _entityGroupMap;
11478
+ /** @hidden @internal */
11479
+ _unattachedChildrenMap;
11480
+ /** @hidden @internal */
11481
+ _inKeyFixup;
11482
+ helper = {
11483
+ unwrapInstance: unwrapInstance,
11484
+ unwrapOriginalValues: unwrapOriginalValues,
11485
+ unwrapChangedValues: unwrapChangedValues
11486
+ };
10894
11487
  /**
10895
11488
  EntityManager constructor.
10896
11489
 
@@ -10929,11 +11522,6 @@ class EntityManager {
10929
11522
  @param emConfig - Configuration settings or a service name.
10930
11523
  **/
10931
11524
  constructor(emConfig) {
10932
- this.helper = {
10933
- unwrapInstance: unwrapInstance,
10934
- unwrapOriginalValues: unwrapOriginalValues,
10935
- unwrapChangedValues: unwrapChangedValues
10936
- };
10937
11525
  if (arguments.length > 1) {
10938
11526
  throw new Error("The EntityManager ctor has a single optional argument that is either a 'serviceName' or a configuration object.");
10939
11527
  }
@@ -12963,12 +13551,10 @@ function getSerializerFn(stype) {
12963
13551
 
12964
13552
  /** Registers adapters used by Breeze */
12965
13553
  class InterfaceRegistry {
12966
- constructor() {
12967
- this.ajax = new InterfaceDef("ajax");
12968
- this.modelLibrary = new InterfaceDef("modelLibrary");
12969
- this.dataService = new InterfaceDef("dataService");
12970
- this.uriBuilder = new InterfaceDef("uriBuilder");
12971
- }
13554
+ ajax = new InterfaceDef("ajax");
13555
+ modelLibrary = new InterfaceDef("modelLibrary");
13556
+ dataService = new InterfaceDef("dataService");
13557
+ uriBuilder = new InterfaceDef("uriBuilder");
12972
13558
  }
12973
13559
  config.interfaceRegistry = new InterfaceRegistry();
12974
13560
  config._interfaceRegistry = config.interfaceRegistry;
@@ -12999,119 +13585,118 @@ config.initializeAdapterInstances = function (irConfig) {
12999
13585
  return core.objectMap(config, this.initializeAdapterInstance);
13000
13586
  };
13001
13587
 
13002
- const ɵ0$3 = function (...args) {
13003
- if (this._inProgress) {
13004
- return -1;
13005
- }
13006
- let goodAdds = this._getGoodAdds(args);
13007
- if (!goodAdds.length) {
13008
- return this.length;
13009
- }
13010
- this._beforeChange();
13011
- let result;
13012
- let objPrototype = Object.getPrototypeOf(this);
13013
- if (objPrototype.push) {
13014
- result = objPrototype.push.apply(this, goodAdds);
13015
- }
13016
- else {
13017
- result = Array.prototype.push.apply(this, goodAdds);
13018
- }
13019
- processAdds(this, goodAdds);
13020
- return result;
13021
- }, ɵ1$2 = function (...args) {
13022
- if (this._inProgress) {
13023
- return -1;
13024
- }
13025
- let goodAdds = args;
13026
- this._beforeChange();
13027
- let result;
13028
- let objPrototype = Object.getPrototypeOf(this);
13029
- if (objPrototype.push) {
13030
- result = objPrototype.push.apply(this, goodAdds);
13031
- }
13032
- else {
13033
- result = Array.prototype.push.apply(this, goodAdds);
13034
- }
13035
- processAdds(this, goodAdds);
13036
- return result;
13037
- }, ɵ2$1 = function (...args) {
13038
- let goodAdds = this._getGoodAdds(args);
13039
- if (!goodAdds.length) {
13040
- return this.length;
13041
- }
13042
- this._beforeChange();
13043
- let result;
13044
- let objPrototype = Object.getPrototypeOf(this);
13045
- if (objPrototype.unshift) {
13046
- result = objPrototype.unshift.apply(this, goodAdds);
13047
- }
13048
- else {
13049
- result = Array.prototype.unshift.apply(this, goodAdds);
13050
- }
13051
- processAdds(this, goodAdds);
13052
- return result;
13053
- }, ɵ3$1 = function () {
13054
- this._beforeChange();
13055
- let result;
13056
- let objPrototype = Object.getPrototypeOf(this);
13057
- if (objPrototype.pop) {
13058
- result = objPrototype.pop.apply(this);
13059
- }
13060
- else {
13061
- result = Array.prototype.pop.apply(this);
13062
- }
13063
- processRemoves(this, [result]);
13064
- return result;
13065
- }, ɵ4$1 = function () {
13066
- this._beforeChange();
13067
- let result;
13068
- let objPrototype = Object.getPrototypeOf(this);
13069
- if (objPrototype.shift) {
13070
- result = objPrototype.shift.apply(this);
13071
- }
13072
- else {
13073
- result = Array.prototype.shift.apply(this);
13074
- }
13075
- processRemoves(this, [result]);
13076
- return result;
13077
- }, ɵ5$1 = function (...args) {
13078
- let goodAdds = this._getGoodAdds(core.arraySlice(args, 2));
13079
- let newArgs = core.arraySlice(args, 0, 2).concat(goodAdds);
13080
- this._beforeChange();
13081
- let result;
13082
- let objPrototype = Object.getPrototypeOf(this);
13083
- if (objPrototype.splice) {
13084
- result = objPrototype.splice.apply(this, newArgs);
13085
- }
13086
- else {
13087
- result = Array.prototype.splice.apply(this, newArgs);
13088
- }
13089
- processRemoves(this, result);
13090
- if (goodAdds.length) {
13091
- processAdds(this, goodAdds);
13092
- }
13093
- return result;
13094
- }, ɵ6$1 = function () {
13095
- return this.parent.entityAspect || this.parent.complexAspect.getEntityAspect();
13096
- }, ɵ7$1 = function () {
13097
- return this.getEntityAspect();
13098
- }, ɵ8$1 = function () {
13099
- let em = this.getEntityAspect().entityManager;
13100
- return em && em._pendingPubs;
13101
- }, ɵ9$1 = function () {
13102
- // default is to do nothing
13103
- };
13104
13588
  let mixin = {
13105
- push: ɵ0$3,
13106
- _push: ɵ1$2,
13107
- unshift: ɵ2$1,
13108
- pop: ɵ3$1,
13109
- shift: ɵ4$1,
13110
- splice: ɵ5$1,
13111
- getEntityAspect: ɵ6$1,
13112
- _getEventParent: ɵ7$1,
13113
- _getPendingPubs: ɵ8$1,
13114
- _beforeChange: ɵ9$1
13589
+ push: function (...args) {
13590
+ if (this._inProgress) {
13591
+ return -1;
13592
+ }
13593
+ let goodAdds = this._getGoodAdds(args);
13594
+ if (!goodAdds.length) {
13595
+ return this.length;
13596
+ }
13597
+ this._beforeChange();
13598
+ let result;
13599
+ let objPrototype = Object.getPrototypeOf(this);
13600
+ if (objPrototype.push) {
13601
+ result = objPrototype.push.apply(this, goodAdds);
13602
+ }
13603
+ else {
13604
+ result = Array.prototype.push.apply(this, goodAdds);
13605
+ }
13606
+ processAdds$2(this, goodAdds);
13607
+ return result;
13608
+ },
13609
+ _push: function (...args) {
13610
+ if (this._inProgress) {
13611
+ return -1;
13612
+ }
13613
+ let goodAdds = args;
13614
+ this._beforeChange();
13615
+ let result;
13616
+ let objPrototype = Object.getPrototypeOf(this);
13617
+ if (objPrototype.push) {
13618
+ result = objPrototype.push.apply(this, goodAdds);
13619
+ }
13620
+ else {
13621
+ result = Array.prototype.push.apply(this, goodAdds);
13622
+ }
13623
+ processAdds$2(this, goodAdds);
13624
+ return result;
13625
+ },
13626
+ unshift: function (...args) {
13627
+ let goodAdds = this._getGoodAdds(args);
13628
+ if (!goodAdds.length) {
13629
+ return this.length;
13630
+ }
13631
+ this._beforeChange();
13632
+ let result;
13633
+ let objPrototype = Object.getPrototypeOf(this);
13634
+ if (objPrototype.unshift) {
13635
+ result = objPrototype.unshift.apply(this, goodAdds);
13636
+ }
13637
+ else {
13638
+ result = Array.prototype.unshift.apply(this, goodAdds);
13639
+ }
13640
+ processAdds$2(this, goodAdds);
13641
+ return result;
13642
+ },
13643
+ pop: function () {
13644
+ this._beforeChange();
13645
+ let result;
13646
+ let objPrototype = Object.getPrototypeOf(this);
13647
+ if (objPrototype.pop) {
13648
+ result = objPrototype.pop.apply(this);
13649
+ }
13650
+ else {
13651
+ result = Array.prototype.pop.apply(this);
13652
+ }
13653
+ processRemoves$2(this, [result]);
13654
+ return result;
13655
+ },
13656
+ shift: function () {
13657
+ this._beforeChange();
13658
+ let result;
13659
+ let objPrototype = Object.getPrototypeOf(this);
13660
+ if (objPrototype.shift) {
13661
+ result = objPrototype.shift.apply(this);
13662
+ }
13663
+ else {
13664
+ result = Array.prototype.shift.apply(this);
13665
+ }
13666
+ processRemoves$2(this, [result]);
13667
+ return result;
13668
+ },
13669
+ splice: function (...args) {
13670
+ let goodAdds = this._getGoodAdds(core.arraySlice(args, 2));
13671
+ let newArgs = core.arraySlice(args, 0, 2).concat(goodAdds);
13672
+ this._beforeChange();
13673
+ let result;
13674
+ let objPrototype = Object.getPrototypeOf(this);
13675
+ if (objPrototype.splice) {
13676
+ result = objPrototype.splice.apply(this, newArgs);
13677
+ }
13678
+ else {
13679
+ result = Array.prototype.splice.apply(this, newArgs);
13680
+ }
13681
+ processRemoves$2(this, result);
13682
+ if (goodAdds.length) {
13683
+ processAdds$2(this, goodAdds);
13684
+ }
13685
+ return result;
13686
+ },
13687
+ getEntityAspect: function () {
13688
+ return this.parent.entityAspect || this.parent.complexAspect.getEntityAspect();
13689
+ },
13690
+ _getEventParent: function () {
13691
+ return this.getEntityAspect();
13692
+ },
13693
+ _getPendingPubs: function () {
13694
+ let em = this.getEntityAspect().entityManager;
13695
+ return em && em._pendingPubs;
13696
+ },
13697
+ _beforeChange: function () {
13698
+ // default is to do nothing
13699
+ }
13115
13700
  };
13116
13701
  function updateEntityState(obsArray) {
13117
13702
  let entityAspect = obsArray.getEntityAspect();
@@ -13144,14 +13729,14 @@ function initializeParent(obsArray, parent, parentProperty) {
13144
13729
  obsArray.parent = parent;
13145
13730
  obsArray.parentProperty = parentProperty;
13146
13731
  }
13147
- function processAdds(obsArray, adds) {
13732
+ function processAdds$2(obsArray, adds) {
13148
13733
  obsArray._processAdds(adds);
13149
13734
  // this is referencing the name of the method on the complexArray not the name of the event
13150
13735
  //var args = { added: adds };
13151
13736
  //args[obsArray._typeName] = obsArray;
13152
13737
  publish(obsArray, "arrayChanged", { array: obsArray, added: adds });
13153
13738
  }
13154
- function processRemoves(obsArray, removes) {
13739
+ function processRemoves$2(obsArray, removes) {
13155
13740
  obsArray._processRemoves(removes);
13156
13741
  // this is referencing the name of the method on the array not the name of the event
13157
13742
  publish(obsArray, "arrayChanged", { array: obsArray, removed: removes });
@@ -13182,23 +13767,6 @@ const observableArray = {
13182
13767
  initializeParent: initializeParent
13183
13768
  };
13184
13769
 
13185
- const ɵ0$4 = function (callback, errorCallback) {
13186
- let parent = this.parentEntity;
13187
- let query = EntityQuery.fromEntityNavigation(this.parentEntity, this.navigationProperty);
13188
- let em = parent.entityAspect.entityManager;
13189
- return em.executeQuery(query, callback, errorCallback);
13190
- }, ɵ1$3 = function () {
13191
- return this.parentEntity.entityAspect;
13192
- }, ɵ2$2 = function () {
13193
- let em = this.parentEntity.entityAspect.entityManager;
13194
- return em && em._pendingPubs;
13195
- }, ɵ3$2 = function (adds) {
13196
- return getGoodAdds(this, adds);
13197
- }, ɵ4$2 = function (adds) {
13198
- processAdds$1(this, adds);
13199
- }, ɵ5$2 = function (removes) {
13200
- processRemoves$1(this, removes);
13201
- };
13202
13770
  let relationArrayMixin = {
13203
13771
  /**
13204
13772
  Relation arrays are not actually classes, they are objects that mimic arrays. A relation array is collection of
@@ -13235,15 +13803,31 @@ let relationArrayMixin = {
13235
13803
  @param [errorCallback] {Function}
13236
13804
  @return {Promise}
13237
13805
  **/
13238
- load: ɵ0$4,
13239
- _getEventParent: ɵ1$3,
13240
- _getPendingPubs: ɵ2$2,
13806
+ load: function (callback, errorCallback) {
13807
+ let parent = this.parentEntity;
13808
+ let query = EntityQuery.fromEntityNavigation(this.parentEntity, this.navigationProperty);
13809
+ let em = parent.entityAspect.entityManager;
13810
+ return em.executeQuery(query, callback, errorCallback);
13811
+ },
13812
+ _getEventParent: function () {
13813
+ return this.parentEntity.entityAspect;
13814
+ },
13815
+ _getPendingPubs: function () {
13816
+ let em = this.parentEntity.entityAspect.entityManager;
13817
+ return em && em._pendingPubs;
13818
+ },
13241
13819
  // virtual impls
13242
- _getGoodAdds: ɵ3$2,
13243
- _processAdds: ɵ4$2,
13244
- _processRemoves: ɵ5$2
13820
+ _getGoodAdds: function (adds) {
13821
+ return getGoodAdds$1(this, adds);
13822
+ },
13823
+ _processAdds: function (adds) {
13824
+ processAdds$1(this, adds);
13825
+ },
13826
+ _processRemoves: function (removes) {
13827
+ processRemoves$1(this, removes);
13828
+ }
13245
13829
  };
13246
- function getGoodAdds(relationArray, adds) {
13830
+ function getGoodAdds$1(relationArray, adds) {
13247
13831
  let goodAdds = checkForDups(relationArray, adds);
13248
13832
  if (!goodAdds.length) {
13249
13833
  return goodAdds;
@@ -13351,28 +13935,6 @@ function makeRelationArray(arr, parentEntity, navigationProperty) {
13351
13935
  return core.extend(arrX, relationArrayMixin);
13352
13936
  }
13353
13937
 
13354
- const ɵ0$5 = function (adds) {
13355
- return getGoodAdds$1(this, adds);
13356
- }, ɵ1$4 = function () {
13357
- observableArray.updateEntityState(this);
13358
- }, ɵ2$3 = function (adds) {
13359
- processAdds$2(this, adds);
13360
- }, ɵ3$3 = function (removes) {
13361
- processRemoves$2(this, removes);
13362
- }, ɵ4$3 = function () {
13363
- if (!this._origValues)
13364
- return;
13365
- let that = this;
13366
- this.forEach(function (co) {
13367
- clearAspect(co, that);
13368
- });
13369
- this.length = 0;
13370
- this._origValues.forEach(function (co) {
13371
- that.push(co);
13372
- });
13373
- }, ɵ5$3 = function () {
13374
- this._origValues = null;
13375
- };
13376
13938
  let complexArrayMixin = {
13377
13939
  // complexArray will have the following props
13378
13940
  // parent
@@ -13407,22 +13969,43 @@ let complexArrayMixin = {
13407
13969
  @readOnly
13408
13970
  **/
13409
13971
  // virtual impls
13410
- _getGoodAdds: ɵ0$5,
13411
- _beforeChange: ɵ1$4,
13412
- _processAdds: ɵ2$3,
13413
- _processRemoves: ɵ3$3,
13414
- _rejectChanges: ɵ4$3,
13415
- _acceptChanges: ɵ5$3
13972
+ _getGoodAdds: function (adds) {
13973
+ return getGoodAdds(this, adds);
13974
+ },
13975
+ _beforeChange: function () {
13976
+ observableArray.updateEntityState(this);
13977
+ },
13978
+ _processAdds: function (adds) {
13979
+ processAdds(this, adds);
13980
+ },
13981
+ _processRemoves: function (removes) {
13982
+ processRemoves(this, removes);
13983
+ },
13984
+ _rejectChanges: function () {
13985
+ if (!this._origValues)
13986
+ return;
13987
+ let that = this;
13988
+ this.forEach(function (co) {
13989
+ clearAspect(co, that);
13990
+ });
13991
+ this.length = 0;
13992
+ this._origValues.forEach(function (co) {
13993
+ that.push(co);
13994
+ });
13995
+ },
13996
+ _acceptChanges: function () {
13997
+ this._origValues = null;
13998
+ }
13416
13999
  };
13417
14000
  // local functions
13418
- function getGoodAdds$1(complexArray, adds) {
14001
+ function getGoodAdds(complexArray, adds) {
13419
14002
  // remove any that are already added here
13420
14003
  return adds.filter(function (a) {
13421
14004
  // return a.parent !== complexArray.parent; // TODO: check if this is actually a bug in original breezejs ???
13422
14005
  return a.complexAspect == null || a.complexAspect.parent !== complexArray.parent;
13423
14006
  });
13424
14007
  }
13425
- function processAdds$2(complexArray, adds) {
14008
+ function processAdds(complexArray, adds) {
13426
14009
  adds.forEach(function (a) {
13427
14010
  // if (a.parent != null) { // TODO: check if this is actually a bug in original breezejs ???
13428
14011
  if (a.complexAspect && a.complexAspect.parent != null) {
@@ -13431,7 +14014,7 @@ function processAdds$2(complexArray, adds) {
13431
14014
  setAspect(a, complexArray);
13432
14015
  });
13433
14016
  }
13434
- function processRemoves$2(complexArray, removes) {
14017
+ function processRemoves(complexArray, removes) {
13435
14018
  removes.forEach(function (a) {
13436
14019
  clearAspect(a, complexArray);
13437
14020
  });
@@ -13466,28 +14049,6 @@ function makeComplexArray(arr, parent, parentProperty) {
13466
14049
  return core.extend(arrX, complexArrayMixin);
13467
14050
  }
13468
14051
 
13469
- const ɵ0$6 = function (adds) {
13470
- return adds;
13471
- }, ɵ1$5 = function () {
13472
- let entityAspect = this.getEntityAspect();
13473
- if (entityAspect.entityState.isUnchanged()) {
13474
- entityAspect.setModified();
13475
- }
13476
- if (entityAspect.entityState.isModified() && !this._origValues) {
13477
- this._origValues = this.slice(0);
13478
- }
13479
- }, ɵ2$4 = function (adds) {
13480
- // nothing needed
13481
- }, ɵ3$4 = function (removes) {
13482
- // nothing needed;
13483
- }, ɵ4$4 = function () {
13484
- if (!this._origValues)
13485
- return;
13486
- this.length = 0;
13487
- Array.prototype.push.apply(this, this._origValues);
13488
- }, ɵ5$4 = function () {
13489
- this._origValues = null;
13490
- };
13491
14052
  // TODO: mixin impl is not very typesafe
13492
14053
  // Not needed
13493
14054
  // interface IPrimitiveArray extends IObservableArray {
@@ -13529,12 +14090,33 @@ let primitiveArrayMixin = {
13529
14090
  @readOnly
13530
14091
  **/
13531
14092
  // virtual impls
13532
- _getGoodAdds: ɵ0$6,
13533
- _beforeChange: ɵ1$5,
13534
- _processAdds: ɵ2$4,
13535
- _processRemoves: ɵ3$4,
13536
- _rejectChanges: ɵ4$4,
13537
- _acceptChanges: ɵ5$4
14093
+ _getGoodAdds: function (adds) {
14094
+ return adds;
14095
+ },
14096
+ _beforeChange: function () {
14097
+ let entityAspect = this.getEntityAspect();
14098
+ if (entityAspect.entityState.isUnchanged()) {
14099
+ entityAspect.setModified();
14100
+ }
14101
+ if (entityAspect.entityState.isModified() && !this._origValues) {
14102
+ this._origValues = this.slice(0);
14103
+ }
14104
+ },
14105
+ _processAdds: function (adds) {
14106
+ // nothing needed
14107
+ },
14108
+ _processRemoves: function (removes) {
14109
+ // nothing needed;
14110
+ },
14111
+ _rejectChanges: function () {
14112
+ if (!this._origValues)
14113
+ return;
14114
+ this.length = 0;
14115
+ Array.prototype.push.apply(this, this._origValues);
14116
+ },
14117
+ _acceptChanges: function () {
14118
+ this._origValues = null;
14119
+ }
13538
14120
  };
13539
14121
  // local functions
13540
14122
  /** For use by breeze plugin authors only. The class is for use in building a [[IModelLibraryAdapter]] implementation.
@@ -13609,5 +14191,5 @@ if (win) {
13609
14191
  * Generated bundle index. Do not edit.
13610
14192
  */
13611
14193
 
13612
- export { AbstractDataServiceAdapter, AndOrPredicate, AnyAllPredicate, AutoGeneratedKeyType, BinaryPredicate, BreezeConfig, BreezeEnum, BreezeEvent, ComplexAspect, ComplexType, DataProperty, DataService, DataType, EntityAction, EntityAspect, EntityKey, EntityManager, EntityQuery, EntityState, EntityType, ExpandClause, FetchStrategy, FilterQueryOp, FnExpr, InterfaceRegistry, JsonResultsAdapter, KeyGenerator, LitExpr, LocalQueryComparisonOptions, MappingContext, MergeStrategy, MetadataStore, NamingConvention, NavigationProperty, OrderByClause, Predicate, PropExpr, QueryOptions, SaveOptions, SelectClause, UnaryPredicate, ValidationError, ValidationOptions, Validator, assertConfig, assertParam, breeze, config, core, makeComplexArray, makePrimitiveArray, makeRelationArray, PredicateExpression as ɵa, Param as ɵb, qualifyTypeName as ɵc, BooleanQueryOp as ɵd };
13613
- //# sourceMappingURL=breeze-client.js.map
14194
+ export { AbstractDataServiceAdapter, AndOrPredicate, AnyAllPredicate, AutoGeneratedKeyType, BinaryPredicate, BreezeConfig, BreezeEnum, BreezeEvent, ComplexAspect, ComplexType, DataProperty, DataService, DataType, EntityAction, EntityAspect, EntityKey, EntityManager, EntityQuery, EntityState, EntityType, ExpandClause, FetchStrategy, FilterQueryOp, FnExpr, InterfaceRegistry, JsonResultsAdapter, KeyGenerator, LitExpr, LocalQueryComparisonOptions, MappingContext, MergeStrategy, MetadataStore, NamingConvention, NavigationProperty, OrderByClause, Predicate, PropExpr, QueryOptions, SaveOptions, SelectClause, UnaryPredicate, ValidationError, ValidationOptions, Validator, assertConfig, assertParam, breeze, config, core, makeComplexArray, makePrimitiveArray, makeRelationArray };
14195
+ //# sourceMappingURL=breeze-client.mjs.map