breeze-client 2.1.6 → 2.1.7-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 (378) hide show
  1. package/LICENSE +1 -1
  2. package/adapter-ajax-angularjs/{breeze-client-adapter-ajax-angularjs.d.ts → index.d.ts} +1 -0
  3. package/adapter-ajax-fetch/{breeze-client-adapter-ajax-fetch.d.ts → index.d.ts} +1 -0
  4. package/adapter-ajax-httpclient/{breeze-client-adapter-ajax-httpclient.d.ts → index.d.ts} +1 -0
  5. package/adapter-ajax-jquery/{breeze-client-adapter-ajax-jquery.d.ts → index.d.ts} +1 -0
  6. package/adapter-ajax-post/{breeze-client-adapter-ajax-post.d.ts → index.d.ts} +1 -0
  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/{esm5/adapter-data-service-odata/adapter-data-service-odata.js → esm2022/adapter-data-service-odata/adapter-data-service-odata.mjs} +138 -147
  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 +325 -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/{esm2015/src/entity-action.js → esm2022/src/entity-action.mjs} +25 -25
  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 +1024 -0
  65. package/esm2022/src/entity-state.mjs +107 -0
  66. package/esm2022/src/enum.mjs +143 -0
  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} +68 -69
  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} +30 -30
  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} +2126 -1577
  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 +20 -0
  114. package/src/config.d.ts +1 -1
  115. package/src/core.d.ts +1 -1
  116. package/src/entity-aspect.d.ts +1 -1
  117. package/src/entity-metadata.d.ts +8 -6
  118. package/src/entity-query.d.ts +18 -4
  119. package/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.metadata.json +0 -1
  120. package/adapter-ajax-angularjs/package.json +0 -13
  121. package/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.metadata.json +0 -1
  122. package/adapter-ajax-fetch/package.json +0 -13
  123. package/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.metadata.json +0 -1
  124. package/adapter-ajax-httpclient/package.json +0 -13
  125. package/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.metadata.json +0 -1
  126. package/adapter-ajax-jquery/package.json +0 -13
  127. package/adapter-ajax-post/breeze-client-adapter-ajax-post.metadata.json +0 -1
  128. package/adapter-ajax-post/package.json +0 -13
  129. package/adapter-data-service-odata/breeze-client-adapter-data-service-odata.metadata.json +0 -1
  130. package/adapter-data-service-odata/package.json +0 -13
  131. package/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.metadata.json +0 -1
  132. package/adapter-data-service-webapi/package.json +0 -13
  133. package/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.metadata.json +0 -1
  134. package/adapter-model-library-backing-store/package.json +0 -13
  135. package/adapter-model-library-ko/breeze-client-adapter-model-library-ko.metadata.json +0 -1
  136. package/adapter-model-library-ko/package.json +0 -13
  137. package/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.metadata.json +0 -1
  138. package/adapter-uri-builder-json/package.json +0 -13
  139. package/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.metadata.json +0 -1
  140. package/adapter-uri-builder-odata/package.json +0 -13
  141. package/breeze-client.d.ts +0 -8
  142. package/breeze-client.metadata.json +0 -1
  143. package/bundles/breeze-client-adapter-ajax-angularjs.umd.js +0 -190
  144. package/bundles/breeze-client-adapter-ajax-angularjs.umd.js.map +0 -1
  145. package/bundles/breeze-client-adapter-ajax-angularjs.umd.min.js +0 -2
  146. package/bundles/breeze-client-adapter-ajax-angularjs.umd.min.js.map +0 -1
  147. package/bundles/breeze-client-adapter-ajax-fetch.umd.js +0 -190
  148. package/bundles/breeze-client-adapter-ajax-fetch.umd.js.map +0 -1
  149. package/bundles/breeze-client-adapter-ajax-fetch.umd.min.js +0 -2
  150. package/bundles/breeze-client-adapter-ajax-fetch.umd.min.js.map +0 -1
  151. package/bundles/breeze-client-adapter-ajax-httpclient.umd.js +0 -195
  152. package/bundles/breeze-client-adapter-ajax-httpclient.umd.js.map +0 -1
  153. package/bundles/breeze-client-adapter-ajax-httpclient.umd.min.js +0 -2
  154. package/bundles/breeze-client-adapter-ajax-httpclient.umd.min.js.map +0 -1
  155. package/bundles/breeze-client-adapter-ajax-jquery.umd.js +0 -115
  156. package/bundles/breeze-client-adapter-ajax-jquery.umd.js.map +0 -1
  157. package/bundles/breeze-client-adapter-ajax-jquery.umd.min.js +0 -2
  158. package/bundles/breeze-client-adapter-ajax-jquery.umd.min.js.map +0 -1
  159. package/bundles/breeze-client-adapter-ajax-post.umd.js +0 -92
  160. package/bundles/breeze-client-adapter-ajax-post.umd.js.map +0 -1
  161. package/bundles/breeze-client-adapter-ajax-post.umd.min.js +0 -2
  162. package/bundles/breeze-client-adapter-ajax-post.umd.min.js.map +0 -1
  163. package/bundles/breeze-client-adapter-data-service-odata.umd.js +0 -747
  164. package/bundles/breeze-client-adapter-data-service-odata.umd.js.map +0 -1
  165. package/bundles/breeze-client-adapter-data-service-odata.umd.min.js +0 -16
  166. package/bundles/breeze-client-adapter-data-service-odata.umd.min.js.map +0 -1
  167. package/bundles/breeze-client-adapter-data-service-webapi.umd.js +0 -333
  168. package/bundles/breeze-client-adapter-data-service-webapi.umd.js.map +0 -1
  169. package/bundles/breeze-client-adapter-data-service-webapi.umd.min.js +0 -16
  170. package/bundles/breeze-client-adapter-data-service-webapi.umd.min.js.map +0 -1
  171. package/bundles/breeze-client-adapter-model-library-backing-store.umd.js +0 -280
  172. package/bundles/breeze-client-adapter-model-library-backing-store.umd.js.map +0 -1
  173. package/bundles/breeze-client-adapter-model-library-backing-store.umd.min.js +0 -2
  174. package/bundles/breeze-client-adapter-model-library-backing-store.umd.min.js.map +0 -1
  175. package/bundles/breeze-client-adapter-model-library-ko.umd.js +0 -252
  176. package/bundles/breeze-client-adapter-model-library-ko.umd.js.map +0 -1
  177. package/bundles/breeze-client-adapter-model-library-ko.umd.min.js +0 -2
  178. package/bundles/breeze-client-adapter-model-library-ko.umd.min.js.map +0 -1
  179. package/bundles/breeze-client-adapter-uri-builder-json.umd.js +0 -96
  180. package/bundles/breeze-client-adapter-uri-builder-json.umd.js.map +0 -1
  181. package/bundles/breeze-client-adapter-uri-builder-json.umd.min.js +0 -2
  182. package/bundles/breeze-client-adapter-uri-builder-json.umd.min.js.map +0 -1
  183. package/bundles/breeze-client-adapter-uri-builder-odata.umd.js +0 -262
  184. package/bundles/breeze-client-adapter-uri-builder-odata.umd.js.map +0 -1
  185. package/bundles/breeze-client-adapter-uri-builder-odata.umd.min.js +0 -2
  186. package/bundles/breeze-client-adapter-uri-builder-odata.umd.min.js.map +0 -1
  187. package/bundles/breeze-client-mixin-get-entity-graph.umd.js +0 -258
  188. package/bundles/breeze-client-mixin-get-entity-graph.umd.js.map +0 -1
  189. package/bundles/breeze-client-mixin-get-entity-graph.umd.min.js +0 -2
  190. package/bundles/breeze-client-mixin-get-entity-graph.umd.min.js.map +0 -1
  191. package/bundles/breeze-client-mixin-save-queuing.umd.js +0 -579
  192. package/bundles/breeze-client-mixin-save-queuing.umd.js.map +0 -1
  193. package/bundles/breeze-client-mixin-save-queuing.umd.min.js +0 -16
  194. package/bundles/breeze-client-mixin-save-queuing.umd.min.js.map +0 -1
  195. package/bundles/breeze-client.umd.js +0 -14181
  196. package/bundles/breeze-client.umd.js.map +0 -1
  197. package/bundles/breeze-client.umd.min.js +0 -16
  198. package/bundles/breeze-client.umd.min.js.map +0 -1
  199. package/esm2015/adapter-ajax-angularjs/adapter-ajax-angularjs.js +0 -130
  200. package/esm2015/adapter-ajax-angularjs/adapter-core.js +0 -49
  201. package/esm2015/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.js +0 -5
  202. package/esm2015/adapter-ajax-fetch/adapter-ajax-fetch.js +0 -130
  203. package/esm2015/adapter-ajax-fetch/adapter-core.js +0 -49
  204. package/esm2015/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.js +0 -5
  205. package/esm2015/adapter-ajax-httpclient/adapter-ajax-httpclient.js +0 -137
  206. package/esm2015/adapter-ajax-httpclient/adapter-core.js +0 -49
  207. package/esm2015/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.js +0 -5
  208. package/esm2015/adapter-ajax-jquery/adapter-ajax-jquery.js +0 -103
  209. package/esm2015/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.js +0 -5
  210. package/esm2015/adapter-ajax-post/adapter-ajax-post.js +0 -77
  211. package/esm2015/adapter-ajax-post/breeze-client-adapter-ajax-post.js +0 -5
  212. package/esm2015/adapter-data-service-odata/adapter-core.js +0 -49
  213. package/esm2015/adapter-data-service-odata/adapter-data-service-odata.js +0 -463
  214. package/esm2015/adapter-data-service-odata/breeze-client-adapter-data-service-odata.js +0 -5
  215. package/esm2015/adapter-data-service-webapi/adapter-data-service-webapi.js +0 -100
  216. package/esm2015/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.js +0 -5
  217. package/esm2015/adapter-model-library-backing-store/adapter-model-library-backing-store.js +0 -268
  218. package/esm2015/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.js +0 -5
  219. package/esm2015/adapter-model-library-ko/adapter-model-library-ko.js +0 -240
  220. package/esm2015/adapter-model-library-ko/breeze-client-adapter-model-library-ko.js +0 -5
  221. package/esm2015/adapter-uri-builder-json/adapter-core.js +0 -49
  222. package/esm2015/adapter-uri-builder-json/adapter-uri-builder-json.js +0 -36
  223. package/esm2015/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.js +0 -5
  224. package/esm2015/adapter-uri-builder-odata/adapter-core.js +0 -49
  225. package/esm2015/adapter-uri-builder-odata/adapter-uri-builder-odata.js +0 -192
  226. package/esm2015/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.js +0 -5
  227. package/esm2015/breeze-client.js +0 -9
  228. package/esm2015/index.js +0 -2
  229. package/esm2015/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.js +0 -5
  230. package/esm2015/mixin-get-entity-graph/mixin-get-entity-graph.js +0 -269
  231. package/esm2015/mixin-save-queuing/breeze-client-mixin-save-queuing.js +0 -5
  232. package/esm2015/mixin-save-queuing/mixin-save-queuing.js +0 -400
  233. package/esm2015/src/abstract-data-service-adapter.js +0 -296
  234. package/esm2015/src/array.js +0 -4
  235. package/esm2015/src/assert-param.js +0 -312
  236. package/esm2015/src/breeze.js +0 -85
  237. package/esm2015/src/complex-array.js +0 -119
  238. package/esm2015/src/config.js +0 -223
  239. package/esm2015/src/core.js +0 -714
  240. package/esm2015/src/csdl-metadata-parser.js +0 -385
  241. package/esm2015/src/data-service.js +0 -203
  242. package/esm2015/src/data-type.js +0 -503
  243. package/esm2015/src/default-property-interceptor.js +0 -460
  244. package/esm2015/src/entity-aspect.js +0 -804
  245. package/esm2015/src/entity-group.js +0 -187
  246. package/esm2015/src/entity-key.js +0 -116
  247. package/esm2015/src/entity-manager.js +0 -2094
  248. package/esm2015/src/entity-metadata.js +0 -2109
  249. package/esm2015/src/entity-query.js +0 -996
  250. package/esm2015/src/entity-state.js +0 -107
  251. package/esm2015/src/enum.js +0 -141
  252. package/esm2015/src/event.js +0 -256
  253. package/esm2015/src/interface-registry.js +0 -41
  254. package/esm2015/src/key-generator.js +0 -108
  255. package/esm2015/src/local-query-comparison-options.js +0 -65
  256. package/esm2015/src/mapping-context.js +0 -411
  257. package/esm2015/src/naming-convention.js +0 -88
  258. package/esm2015/src/observable-array.js +0 -185
  259. package/esm2015/src/predicate.js +0 -1242
  260. package/esm2015/src/primitive-array.js +0 -87
  261. package/esm2015/src/query-options.js +0 -152
  262. package/esm2015/src/relation-array.js +0 -175
  263. package/esm2015/src/save-options.js +0 -41
  264. package/esm2015/src/unattached-children-map.js +0 -58
  265. package/esm2015/src/validate.js +0 -991
  266. package/esm2015/src/validation-options.js +0 -64
  267. package/esm5/adapter-ajax-angularjs/adapter-ajax-angularjs.js +0 -132
  268. package/esm5/adapter-ajax-angularjs/adapter-core.js +0 -49
  269. package/esm5/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.js +0 -5
  270. package/esm5/adapter-ajax-fetch/adapter-ajax-fetch.js +0 -132
  271. package/esm5/adapter-ajax-fetch/adapter-core.js +0 -49
  272. package/esm5/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.js +0 -5
  273. package/esm5/adapter-ajax-httpclient/adapter-ajax-httpclient.js +0 -139
  274. package/esm5/adapter-ajax-httpclient/adapter-core.js +0 -49
  275. package/esm5/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.js +0 -5
  276. package/esm5/adapter-ajax-jquery/adapter-ajax-jquery.js +0 -105
  277. package/esm5/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.js +0 -5
  278. package/esm5/adapter-ajax-post/adapter-ajax-post.js +0 -81
  279. package/esm5/adapter-ajax-post/breeze-client-adapter-ajax-post.js +0 -5
  280. package/esm5/adapter-data-service-odata/adapter-core.js +0 -49
  281. package/esm5/adapter-data-service-odata/breeze-client-adapter-data-service-odata.js +0 -5
  282. package/esm5/adapter-data-service-webapi/adapter-data-service-webapi.js +0 -105
  283. package/esm5/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.js +0 -5
  284. package/esm5/adapter-model-library-backing-store/adapter-model-library-backing-store.js +0 -270
  285. package/esm5/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.js +0 -5
  286. package/esm5/adapter-model-library-ko/adapter-model-library-ko.js +0 -242
  287. package/esm5/adapter-model-library-ko/breeze-client-adapter-model-library-ko.js +0 -5
  288. package/esm5/adapter-uri-builder-json/adapter-core.js +0 -49
  289. package/esm5/adapter-uri-builder-json/adapter-uri-builder-json.js +0 -38
  290. package/esm5/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.js +0 -5
  291. package/esm5/adapter-uri-builder-odata/adapter-core.js +0 -49
  292. package/esm5/adapter-uri-builder-odata/adapter-uri-builder-odata.js +0 -197
  293. package/esm5/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.js +0 -5
  294. package/esm5/breeze-client.js +0 -9
  295. package/esm5/index.js +0 -2
  296. package/esm5/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.js +0 -5
  297. package/esm5/mixin-get-entity-graph/mixin-get-entity-graph.js +0 -269
  298. package/esm5/mixin-save-queuing/breeze-client-mixin-save-queuing.js +0 -5
  299. package/esm5/mixin-save-queuing/mixin-save-queuing.js +0 -412
  300. package/esm5/src/abstract-data-service-adapter.js +0 -302
  301. package/esm5/src/array.js +0 -4
  302. package/esm5/src/assert-param.js +0 -317
  303. package/esm5/src/breeze.js +0 -85
  304. package/esm5/src/complex-array.js +0 -119
  305. package/esm5/src/config.js +0 -228
  306. package/esm5/src/core.js +0 -722
  307. package/esm5/src/csdl-metadata-parser.js +0 -385
  308. package/esm5/src/data-service.js +0 -207
  309. package/esm5/src/data-type.js +0 -510
  310. package/esm5/src/default-property-interceptor.js +0 -460
  311. package/esm5/src/entity-action.js +0 -52
  312. package/esm5/src/entity-aspect.js +0 -810
  313. package/esm5/src/entity-group.js +0 -189
  314. package/esm5/src/entity-key.js +0 -118
  315. package/esm5/src/entity-manager.js +0 -2112
  316. package/esm5/src/entity-metadata.js +0 -2144
  317. package/esm5/src/entity-query.js +0 -1023
  318. package/esm5/src/entity-state.js +0 -114
  319. package/esm5/src/enum.js +0 -144
  320. package/esm5/src/event.js +0 -259
  321. package/esm5/src/interface-registry.js +0 -43
  322. package/esm5/src/key-generator.js +0 -111
  323. package/esm5/src/local-query-comparison-options.js +0 -67
  324. package/esm5/src/mapping-context.js +0 -413
  325. package/esm5/src/observable-array.js +0 -201
  326. package/esm5/src/predicate.js +0 -1307
  327. package/esm5/src/primitive-array.js +0 -87
  328. package/esm5/src/query-options.js +0 -167
  329. package/esm5/src/relation-array.js +0 -175
  330. package/esm5/src/save-options.js +0 -43
  331. package/esm5/src/unattached-children-map.js +0 -60
  332. package/esm5/src/validation-options.js +0 -66
  333. package/fesm2015/breeze-client-adapter-ajax-angularjs.js.map +0 -1
  334. package/fesm2015/breeze-client-adapter-ajax-fetch.js.map +0 -1
  335. package/fesm2015/breeze-client-adapter-ajax-httpclient.js.map +0 -1
  336. package/fesm2015/breeze-client-adapter-ajax-jquery.js.map +0 -1
  337. package/fesm2015/breeze-client-adapter-ajax-post.js.map +0 -1
  338. package/fesm2015/breeze-client-adapter-data-service-odata.js.map +0 -1
  339. package/fesm2015/breeze-client-adapter-data-service-webapi.js.map +0 -1
  340. package/fesm2015/breeze-client-adapter-model-library-backing-store.js.map +0 -1
  341. package/fesm2015/breeze-client-adapter-model-library-ko.js.map +0 -1
  342. package/fesm2015/breeze-client-adapter-uri-builder-json.js.map +0 -1
  343. package/fesm2015/breeze-client-adapter-uri-builder-odata.js.map +0 -1
  344. package/fesm2015/breeze-client-mixin-get-entity-graph.js.map +0 -1
  345. package/fesm2015/breeze-client-mixin-save-queuing.js.map +0 -1
  346. package/fesm2015/breeze-client.js.map +0 -1
  347. package/fesm5/breeze-client-adapter-ajax-angularjs.js +0 -186
  348. package/fesm5/breeze-client-adapter-ajax-angularjs.js.map +0 -1
  349. package/fesm5/breeze-client-adapter-ajax-fetch.js +0 -186
  350. package/fesm5/breeze-client-adapter-ajax-fetch.js.map +0 -1
  351. package/fesm5/breeze-client-adapter-ajax-httpclient.js +0 -193
  352. package/fesm5/breeze-client-adapter-ajax-httpclient.js.map +0 -1
  353. package/fesm5/breeze-client-adapter-ajax-jquery.js +0 -111
  354. package/fesm5/breeze-client-adapter-ajax-jquery.js.map +0 -1
  355. package/fesm5/breeze-client-adapter-ajax-post.js +0 -86
  356. package/fesm5/breeze-client-adapter-ajax-post.js.map +0 -1
  357. package/fesm5/breeze-client-adapter-data-service-odata.js +0 -523
  358. package/fesm5/breeze-client-adapter-data-service-odata.js.map +0 -1
  359. package/fesm5/breeze-client-adapter-data-service-webapi.js +0 -111
  360. package/fesm5/breeze-client-adapter-data-service-webapi.js.map +0 -1
  361. package/fesm5/breeze-client-adapter-model-library-backing-store.js +0 -276
  362. package/fesm5/breeze-client-adapter-model-library-backing-store.js.map +0 -1
  363. package/fesm5/breeze-client-adapter-model-library-ko.js +0 -248
  364. package/fesm5/breeze-client-adapter-model-library-ko.js.map +0 -1
  365. package/fesm5/breeze-client-adapter-uri-builder-json.js +0 -92
  366. package/fesm5/breeze-client-adapter-uri-builder-json.js.map +0 -1
  367. package/fesm5/breeze-client-adapter-uri-builder-odata.js +0 -250
  368. package/fesm5/breeze-client-adapter-uri-builder-odata.js.map +0 -1
  369. package/fesm5/breeze-client-mixin-get-entity-graph.js +0 -254
  370. package/fesm5/breeze-client-mixin-get-entity-graph.js.map +0 -1
  371. package/fesm5/breeze-client-mixin-save-queuing.js +0 -356
  372. package/fesm5/breeze-client-mixin-save-queuing.js.map +0 -1
  373. package/fesm5/breeze-client.js +0 -13903
  374. package/fesm5/breeze-client.js.map +0 -1
  375. package/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.metadata.json +0 -1
  376. package/mixin-get-entity-graph/package.json +0 -13
  377. package/mixin-save-queuing/breeze-client-mixin-save-queuing.metadata.json +0 -1
  378. 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) {
@@ -731,7 +732,7 @@ function isNumeric(n) {
731
732
  }
732
733
  // end of is Functions
733
734
  // string functions
734
- function stringStartsWith(str, prefix) {
735
+ function stringStartsWith$1(str, prefix) {
735
736
  // returns true for empty string or null prefix
736
737
  if ((!str))
737
738
  return false;
@@ -739,7 +740,7 @@ function stringStartsWith(str, prefix) {
739
740
  return true;
740
741
  return str.indexOf(prefix, 0) === 0;
741
742
  }
742
- function stringEndsWith(str, suffix) {
743
+ function stringEndsWith$1(str, suffix) {
743
744
  // returns true for empty string or null suffix
744
745
  if ((!str))
745
746
  return false;
@@ -829,8 +830,8 @@ const core = {
829
830
  isNumeric: isNumeric,
830
831
  identity: identity,
831
832
  noop: noop,
832
- stringStartsWith: stringStartsWith,
833
- stringEndsWith: stringEndsWith,
833
+ stringStartsWith: stringStartsWith$1,
834
+ stringEndsWith: stringEndsWith$1,
834
835
  formatString: formatString,
835
836
  titleCase: titleCaseSpace,
836
837
  toJson: toJson,
@@ -853,19 +854,23 @@ function isPrimitive(obj: any) {
853
854
 
854
855
  /** @hidden @internal */
855
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;
856
873
  constructor(v, name) {
857
- /** @hidden @internal */
858
- this._applyOne = function (instance) {
859
- if (this.v !== undefined) {
860
- instance[this.name] = this.v;
861
- }
862
- else {
863
- if (this.defaultValue !== undefined) {
864
- instance[this.name] = this.defaultValue;
865
- }
866
- }
867
- };
868
- this.MESSAGE_PREFIX = "The '%1' parameter ";
869
874
  this.v = v;
870
875
  this.name = name;
871
876
  this._contexts = [null];
@@ -1011,6 +1016,18 @@ class Param {
1011
1016
  }
1012
1017
  }
1013
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 ";
1014
1031
  }
1015
1032
  /** @hidden @internal */
1016
1033
  let assertParam = function (v, name) {
@@ -1139,6 +1156,8 @@ function throwConfigError(instance, message) {
1139
1156
  throw new Error(core.formatString("Error configuring an instance of '%1'. %2", (instance && instance._$typeName) || "object", message));
1140
1157
  }
1141
1158
  class ConfigParam {
1159
+ config;
1160
+ params;
1142
1161
  constructor(config) {
1143
1162
  if (typeof (config) !== "object") {
1144
1163
  throw new Error("Configuration parameter should be an object, instead it is a: " + typeof (config));
@@ -1194,6 +1213,18 @@ Class to support basic event publication and subscription semantics.
1194
1213
  @dynamic
1195
1214
  **/
1196
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;
1197
1228
  /**
1198
1229
  Constructor for an Event
1199
1230
  > salaryEvent = new BreezeEvent("salaryEvent", person);
@@ -1203,36 +1234,6 @@ class BreezeEvent {
1203
1234
  If omitted then subscriber notification failures will be ignored.
1204
1235
  **/
1205
1236
  constructor(name, publisher, defaultErrorCallback) {
1206
- /**
1207
- Unsubscribe from this event.
1208
- > // Assume order is a preexisting 'order' entity
1209
- > let token = order.entityAspect.propertyChanged.subscribe(function (pcEvent) {
1210
- > // do something
1211
- > });
1212
- > // sometime later
1213
- > order.entityAspect.propertyChanged.unsubscribe(token);
1214
- @param unsubKey - The value returned from the 'subscribe' method may be used to unsubscribe here.
1215
- @return Whether unsubscription occured. This will return false if already unsubscribed or if the key simply
1216
- cannot be found.
1217
- **/
1218
- this.unsubscribe = function (unsubKey) {
1219
- if (!this._subscribers)
1220
- return false;
1221
- let subs = this._subscribers;
1222
- let ix = core.arrayIndexOf(subs, function (s) {
1223
- return s.unsubKey === unsubKey;
1224
- });
1225
- if (ix !== -1) {
1226
- subs.splice(ix, 1);
1227
- if (subs.length === 0) {
1228
- this._subscribers = null;
1229
- }
1230
- return true;
1231
- }
1232
- else {
1233
- return false;
1234
- }
1235
- };
1236
1237
  assertParam(name, "eventName").isNonEmptyString().check();
1237
1238
  assertParam(publisher, "publisher").isObject().check();
1238
1239
  this.name = name;
@@ -1317,6 +1318,36 @@ class BreezeEvent {
1317
1318
  ++BreezeEvent.__nextUnsubKey;
1318
1319
  return unsubKey;
1319
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
+ };
1320
1351
  /** remove all subscribers */
1321
1352
  clear() {
1322
1353
  this._subscribers = null;
@@ -1381,42 +1412,42 @@ class BreezeEvent {
1381
1412
  // return ctor._isEnabled(getFullEventName(eventName), obj);
1382
1413
  return BreezeEvent._isEnabled(eventName, 3);
1383
1414
  }
1384
- }
1385
- /** @hidden @internal */
1386
- BreezeEvent.__eventNameMap = {};
1387
- /** @hidden @internal */
1388
- BreezeEvent.__nextUnsubKey = 1;
1389
- /** @hidden @internal */
1390
- BreezeEvent._isEnabled = function (eventName, obj) {
1391
- let isEnabled = null;
1392
- let ob = obj;
1393
- let eventMap = ob._$eventMap;
1394
- if (eventMap) {
1395
- isEnabled = eventMap[eventName];
1396
- }
1397
- if (isEnabled != null) {
1398
- if (typeof isEnabled === 'function') {
1399
- return !!isEnabled(obj);
1400
- }
1401
- else {
1402
- 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];
1403
1422
  }
1404
- }
1405
- else {
1406
- let parent = ob._getEventParent && ob._getEventParent();
1407
- if (parent) {
1408
- 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
+ }
1409
1430
  }
1410
1431
  else {
1411
- // default if not explicitly disabled.
1412
- 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
+ }
1413
1440
  }
1414
- }
1415
- };
1441
+ };
1442
+ }
1416
1443
  // legacy support - deliberately not typed
1417
1444
  core.Event = BreezeEvent;
1418
1445
 
1419
1446
  class InterfaceDef {
1447
+ name;
1448
+ defaultInstance;
1449
+ /** @hidden @internal */
1450
+ _implMap;
1420
1451
  constructor(name) {
1421
1452
  this.name = name;
1422
1453
  this.defaultInstance = undefined;
@@ -1442,18 +1473,23 @@ class InterfaceDef {
1442
1473
  }
1443
1474
  }
1444
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.
1445
1485
  constructor() {
1446
- this.functionRegistry = {};
1447
- this.typeRegistry = {};
1448
- this.objectRegistry = {};
1449
- this.stringifyPad = '';
1450
1486
  this.interfaceInitialized = new BreezeEvent("interfaceInitialized", this);
1451
1487
  if (this.noEval === undefined) {
1452
1488
  try {
1453
1489
  Error['x'] = Function('');
1454
1490
  this.noEval = false; // eval succeeded
1455
1491
  }
1456
- catch (_a) {
1492
+ catch {
1457
1493
  this.noEval = true; // eval failed, probably due to CSP
1458
1494
  }
1459
1495
  }
@@ -1651,6 +1687,24 @@ anytime a MetadataStore.fetchMetadata call occurs with a new dataService ( or se
1651
1687
 
1652
1688
  **/
1653
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;
1654
1708
  /** DataService constructor
1655
1709
  > var dataService = new DataService({
1656
1710
  > serviceName: altServiceName,
@@ -1668,7 +1722,7 @@ class DataService {
1668
1722
  @param config - A configuration object.
1669
1723
  **/
1670
1724
  constructor(config) {
1671
- updateWithConfig(this, config);
1725
+ updateWithConfig$1(this, config);
1672
1726
  }
1673
1727
  /**
1674
1728
  Returns a copy of this DataService with the specified properties applied.
@@ -1678,7 +1732,7 @@ class DataService {
1678
1732
  if (!config)
1679
1733
  return this;
1680
1734
  let result = new DataService(this);
1681
- return updateWithConfig(result, config);
1735
+ return updateWithConfig$1(result, config);
1682
1736
  }
1683
1737
  static resolve(dataServices) {
1684
1738
  // final defaults
@@ -1749,7 +1803,7 @@ class DataService {
1749
1803
  }
1750
1804
  }
1751
1805
  DataService.prototype._$typeName = "DataService";
1752
- function updateWithConfig(obj, dsConfig) {
1806
+ function updateWithConfig$1(obj, dsConfig) {
1753
1807
  if (dsConfig) {
1754
1808
  assertConfig(dsConfig)
1755
1809
  .whereParam("serviceName").isOptional()
@@ -1770,6 +1824,24 @@ A JsonResultsAdapter instance is used to provide custom extraction and parsing l
1770
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.
1771
1825
  **/
1772
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;
1773
1845
  /**
1774
1846
  JsonResultsAdapter constructor
1775
1847
 
@@ -1842,17 +1914,16 @@ const INT32_MIN = -2147483648;
1842
1914
  const INT32_MAX = 2147483647;
1843
1915
  const BYTE_MIN = 0;
1844
1916
  const BYTE_MAX = 255;
1845
- const ɵ0$1 = function (context) {
1846
- if (context.property) {
1847
- return context.property.resolveProperty("displayName") || context.propertyName || context.property.name;
1848
- }
1849
- else {
1850
- return "Value";
1851
- }
1852
- };
1853
1917
  // add common props and methods for every validator 'context' here.
1854
1918
  let rootContext = {
1855
- 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
+ }
1856
1927
  };
1857
1928
  /**
1858
1929
  Instances of the Validator class provide the logic to validate another object and provide a description of any errors
@@ -1990,6 +2061,13 @@ of additional properties that will be automatically added to this object if not
1990
2061
  @dynamic
1991
2062
  **/
1992
2063
  class Validator {
2064
+ /** @hidden @internal */
2065
+ _$typeName; // on proto
2066
+ name;
2067
+ valFn;
2068
+ context;
2069
+ currentContext;
2070
+ _baseContext;
1993
2071
  constructor(name, valFn, context) {
1994
2072
  // _baseContext is what will get serialized
1995
2073
  this._baseContext = context || {};
@@ -2138,491 +2216,491 @@ class Validator {
2138
2216
  static registerFactory(validatorFactory, name) {
2139
2217
  config.registerFunction(validatorFactory, "Validator." + name);
2140
2218
  }
2141
- }
2142
- /**
2143
- Map of standard error message templates keyed by validator name.
2144
- You can add to or modify this object to customize the template used for any validation error message.
2145
- @example
2146
- // v is this function is the value to be validated, in this case a "country" string.
2147
- var valFn = function (v) {
2148
- if (v == null) return true;
2149
- 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"
2150
2255
  };
2151
- var countryValidator = new Validator("countryIsUS", valFn, { displayName: "Country" });
2152
- Validator.messageTemplates.countryIsUS = "'%displayName%' must start with 'US'";
2153
- // This will have a similar effect to this
2154
- var countryValidator = new Validator("countryIsUS", valFn, {
2155
- displayName: "Country",
2156
- messageTemplate: "'%displayName%' must start with 'US'"
2157
- });
2158
- @property messageTemplates {Object}
2159
- @static
2160
- **/
2161
- Validator.messageTemplates = {
2162
- bool: "'%displayName%' must be a 'true' or 'false' value",
2163
- creditCard: "The %displayName% is not a valid credit card number",
2164
- date: "'%displayName%' must be a date",
2165
- duration: "'%displayName%' must be a ISO8601 duration string, such as 'P3H24M60S'",
2166
- emailAddress: "The %displayName% '%value%' is not a valid email address",
2167
- guid: "'%displayName%' must be a GUID",
2168
- integer: "'%displayName%' must be an integer",
2169
- integerRange: "'%displayName%' must be an integer between the values of %minValue% and %maxValue%",
2170
- maxLength: "'%displayName%' must be a string with %maxLength% characters or less",
2171
- number: "'%displayName%' must be a number",
2172
- phone: "The %displayName% '%value%' is not a valid phone number",
2173
- regularExpression: "The %displayName% '%value%' does not match '%expression%'",
2174
- required: "'%displayName%' is required",
2175
- string: "'%displayName%' must be a string",
2176
- stringLength: "'%displayName%' must be a string with between %minLength% and %maxLength% characters",
2177
- url: "The %displayName% '%value%' is not a valid url"
2178
- };
2179
- /**
2180
- Returns a standard 'required value' Validator
2181
- @example
2182
- // Assume em1 is a preexisting EntityManager.
2183
- var custType = em1.metadataStore.getEntityType("Customer");
2184
- var regionProperty - custType.getProperty("Region");
2185
- // Makes "Region" on Customer a required property.
2186
- regionProperty.validators.push(Validator.required());
2187
- // or to allow empty strings
2188
- regionProperty.validators.push(Validator.required({ allowEmptyStrings: true }););
2189
- @method required
2190
- @static
2191
- @param context {Object}
2192
- @param [context.allowEmptyStrings] {Boolean} If this parameter is omitted or false then empty strings do NOT pass validation.
2193
- @return {Validator} A new Validator
2194
- **/
2195
- Validator.required = function (context) {
2196
- let valFn = function (v, ctx) {
2197
- if (typeof v === "string") {
2198
- 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)
2199
2302
  return true;
2200
- return v.length > 0;
2201
- }
2202
- else {
2203
- return v != null;
2204
- }
2303
+ if (typeof (v) !== "string")
2304
+ return false;
2305
+ return v.length <= ctx.maxLength;
2306
+ };
2307
+ return new Validator("maxLength", valFn, context);
2205
2308
  };
2206
- return new Validator("required", valFn, context);
2207
- };
2208
- /**
2209
- Returns a standard maximum string length Validator; the maximum length must be specified
2210
- @example
2211
- // Assume em1 is a preexisting EntityManager.
2212
- var custType = em1.metadataStore.getEntityType("Customer");
2213
- var regionProperty - custType.getProperty("Region");
2214
- // Validates that the value of the Region property on Customer will be less than or equal to 5 characters.
2215
- regionProperty.validators.push(Validator.maxLength( {maxLength: 5}));
2216
- @method maxLength
2217
- @static
2218
- @param context {Object}
2219
- @param context.maxLength {Integer}
2220
- @return {Validator} A new Validator
2221
- **/
2222
- Validator.maxLength = function (context) {
2223
- let valFn = function (v, ctx) {
2224
- 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;
2225
2335
  return true;
2226
- if (typeof (v) !== "string")
2227
- return false;
2228
- return v.length <= ctx.maxLength;
2336
+ };
2337
+ return new Validator("stringLength", valFn, context);
2229
2338
  };
2230
- return new Validator("maxLength", valFn, context);
2231
- };
2232
- /**
2233
- Returns a standard string length Validator; both minimum and maximum lengths must be specified.
2234
- @example
2235
- // Assume em1 is a preexisting EntityManager.
2236
- var custType = em1.metadataStore.getEntityType("Customer");
2237
- var regionProperty - custType.getProperty("Region");
2238
- // Validates that the value of the Region property on Customer will be
2239
- // between 2 and 5 characters
2240
- regionProperty.validators.push(Validator.stringLength( {minLength: 2, maxLength: 5});
2241
- @method stringLength
2242
- @static
2243
- @param context {Object}
2244
- @param context.maxLength {Integer}
2245
- @param context.minLength {Integer}
2246
- @return {Validator} A new Validator
2247
- **/
2248
- Validator.stringLength = function (context) {
2249
- let valFn = function (v, ctx) {
2250
- if (v == null)
2251
- return true;
2252
- if (typeof (v) !== "string")
2253
- return false;
2254
- if (ctx.minLength != null && v.length < ctx.minLength)
2255
- return false;
2256
- if (ctx.maxLength != null && v.length > ctx.maxLength)
2257
- return false;
2258
- 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);
2259
2358
  };
2260
- return new Validator("stringLength", valFn, context);
2261
- };
2262
- /**
2263
- Returns a standard string dataType Validator.
2264
- @example
2265
- // Assume em1 is a preexisting EntityManager.
2266
- var custType = em1.metadataStore.getEntityType("Customer");
2267
- var regionProperty - custType.getProperty("Region");
2268
- // Validates that the value of the Region property on Customer is a string.
2269
- regionProperty.validators.push(Validator.string());
2270
- @method string
2271
- @static
2272
- @return {Validator} A new Validator
2273
- **/
2274
- Validator.string = function () {
2275
- let valFn = function (v) {
2276
- if (v == null)
2277
- return true;
2278
- 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);
2279
2378
  };
2280
- return new Validator("string", valFn);
2281
- };
2282
- /**
2283
- Returns a Guid data type Validator.
2284
- @example
2285
- // Assume em1 is a preexisting EntityManager.
2286
- var custType = em1.metadataStore.getEntityType("Customer");
2287
- var customerIdProperty - custType.getProperty("CustomerID");
2288
- // Validates that the value of the CustomerID property on Customer is a Guid.
2289
- customerIdProperty.validators.push(Validator.guid());
2290
- @method guid
2291
- @static
2292
- @return {Validator} A new Validator
2293
- **/
2294
- Validator.guid = function () {
2295
- let valFn = function (v) {
2296
- if (v == null)
2297
- return true;
2298
- 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);
2299
2398
  };
2300
- return new Validator("guid", valFn);
2301
- };
2302
- /**
2303
- Returns a ISO 8601 duration string Validator.
2304
- @example
2305
- // Assume em1 is a preexisting EntityManager.
2306
- var eventType = em1.metadataStore.getEntityType("Event");
2307
- var elapsedTimeProperty - eventType.getProperty("ElapsedTime");
2308
- // Validates that the value of the ElapsedTime property on Customer is a duration.
2309
- elapsedTimeProperty.validators.push(Validator.duration());
2310
- @method duration
2311
- @static
2312
- @return {Validator} A new Validator
2313
- **/
2314
- Validator.duration = function () {
2315
- let valFn = function (v) {
2316
- if (v == null)
2317
- return true;
2318
- 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);
2319
2422
  };
2320
- return new Validator("duration", valFn);
2321
- };
2322
- /**
2323
- Returns a standard numeric data type Validator.
2324
- @example
2325
- // Assume em1 is a preexisting EntityManager.
2326
- var orderType = em1.metadataStore.getEntityType("Order");
2327
- var freightProperty - orderType.getProperty("Freight");
2328
- // Validates that the value of the Freight property on Order is a number.
2329
- freightProperty.validators.push(Validator.number());
2330
- @method number
2331
- @static
2332
- @return {Validator} A new Validator
2333
- **/
2334
- // TODO: may need to have seperate logic for single.
2335
- Validator.number = function (context) {
2336
- let valFn = function (v, ctx) {
2337
- if (v == null)
2338
- return true;
2339
- if (typeof v === "string" && ctx && ctx.allowString) {
2340
- v = parseFloat(v);
2341
- }
2342
- 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);
2343
2447
  };
2344
- return new Validator("number", valFn, context);
2345
- };
2346
- Validator.double = Validator.number;
2347
- Validator.single = Validator.number;
2348
- /**
2349
- Returns a standard large integer data type - 64 bit - Validator.
2350
- @example
2351
- // Assume em1 is a preexisting EntityManager.
2352
- var orderType = em1.metadataStore.getEntityType("Order");
2353
- var freightProperty - orderType.getProperty("Freight");
2354
- // Validates that the value of the Freight property on Order is within the range of a 64 bit integer.
2355
- freightProperty.validators.push(Validator.int64());
2356
- @method int64
2357
- @static
2358
- @return {Validator} A new Validator
2359
- **/
2360
- Validator.integer = function (context) {
2361
- let valFn = function (v, ctx) {
2362
- if (v == null)
2363
- return true;
2364
- if (typeof v === "string" && ctx && ctx.allowString) {
2365
- v = parseInt(v, 10);
2366
- }
2367
- 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)();
2368
2462
  };
2369
- return new Validator("integer", valFn, context);
2370
- };
2371
- Validator.int64 = Validator.integer;
2372
- /**
2373
- Returns a standard 32 bit integer data type Validator.
2374
- @example
2375
- // Assume em1 is a preexisting EntityManager.
2376
- var orderType = em1.metadataStore.getEntityType("Order");
2377
- var freightProperty - orderType.getProperty("Freight");
2378
- freightProperty.validators.push(Validator.int32());
2379
- @method int32
2380
- @static
2381
- @return {Validator} A new Validator
2382
- **/
2383
- Validator.int32 = function (context) {
2384
- return intRangeValidatorCtor("int32", INT32_MIN, INT32_MAX, context)();
2385
- };
2386
- /**
2387
- Returns a standard 16 bit integer data type Validator.
2388
- @example
2389
- // Assume em1 is a preexisting EntityManager.
2390
- var orderType = em1.metadataStore.getEntityType("Order");
2391
- var freightProperty - orderType.getProperty("Freight");
2392
- // Validates that the value of the Freight property on Order is within the range of a 16 bit integer.
2393
- freightProperty.validators.push(Validator.int16());
2394
- @method int16
2395
- @static
2396
- @return {Validator} A new Validator
2397
- **/
2398
- Validator.int16 = function (context) {
2399
- return intRangeValidatorCtor("int16", INT16_MIN, INT16_MAX, context)();
2400
- };
2401
- /**
2402
- Returns a standard byte data type Validator. (This is a integer between 0 and 255 inclusive for js purposes).
2403
- @example
2404
- // Assume em1 is a preexisting EntityManager.
2405
- var orderType = em1.metadataStore.getEntityType("Order");
2406
- var freightProperty - orderType.getProperty("Freight");
2407
- // Validates that the value of the Freight property on Order is within the range of a 16 bit integer.
2408
- // Probably not a very good validation to place on the Freight property.
2409
- regionProperty.validators.push(Validator.byte());
2410
- @method byte
2411
- @static
2412
- @return {Validator} A new Validator
2413
- **/
2414
- Validator.byte = function (context) {
2415
- return intRangeValidatorCtor("byte", BYTE_MIN, BYTE_MAX, context)();
2416
- };
2417
- /**
2418
- Returns a standard boolean data type Validator.
2419
- @example
2420
- // Assume em1 is a preexisting EntityManager.
2421
- var productType = em1.metadataStore.getEntityType("Product");
2422
- var discontinuedProperty - productType.getProperty("Discontinued");
2423
- // Validates that the value of the Discontinued property on Product is a boolean
2424
- discontinuedProperty.validators.push(Validator.bool());
2425
- @method bool
2426
- @static
2427
- @return {Validator} A new Validator
2428
- **/
2429
- Validator.bool = function () {
2430
- let valFn = function (v) {
2431
- if (v == null)
2432
- return true;
2433
- 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)();
2434
2477
  };
2435
- return new Validator("bool", valFn);
2436
- };
2437
- Validator.none = function () {
2438
- let valFn = function (v) {
2439
- 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)();
2440
2493
  };
2441
- return new Validator("none", valFn);
2442
- };
2443
- /**
2444
- Returns a standard date data type Validator.
2445
- @example
2446
- // Assume em1 is a preexisting EntityManager.
2447
- var orderType = em1.metadataStore.getEntityType("Order");
2448
- var orderDateProperty - orderType.getProperty("OrderDate");
2449
- // Validates that the value of the OrderDate property on Order is a date
2450
- // Probably not a very good validation to place on the Freight property.
2451
- orderDateProperty.validators.push(Validator.date());
2452
- @method date
2453
- @static
2454
- @return {Validator} A new Validator
2455
- **/
2456
- Validator.date = function () {
2457
- let valFn = function (v) {
2458
- 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) {
2459
2516
  return true;
2460
- 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;
2461
2602
  try {
2462
- return !isNaN(Date.parse(v));
2463
- // old code
2464
- // return __isDate(new Date(v));
2603
+ let re = new RegExp(ctx.expression);
2604
+ return re.test(v);
2465
2605
  }
2466
2606
  catch (e) {
2467
- return false;
2607
+ throw new Error('Missing or invalid expression parameter to regExp validator');
2468
2608
  }
2469
2609
  }
2470
- else {
2471
- return core.isDate(v);
2472
- }
2610
+ return new Validator('regularExpression', valFn, context);
2473
2611
  };
2474
- return new Validator("date", valFn);
2475
- };
2476
- /**
2477
- Returns a credit card number validator
2478
- Performs a luhn algorithm checksum test for plausability
2479
- catches simple mistakes; only service knows for sure
2480
- @example
2481
- // Assume em is a preexisting EntityManager.
2482
- var personType = em.metadataStore.getEntityType("Person");
2483
- var creditCardProperty = personType.getProperty("creditCard");
2484
- // Validates that the value of the Person.creditCard property is credit card.
2485
- creditCardProperty.validators.push(Validator.creditCard());
2486
- @method creditCard
2487
- @static
2488
- @param [context] {Object} optional parameters to pass through to validation constructor
2489
- @return {Validator} A new Validator
2490
- **/
2491
- Validator.creditCard = function (context) {
2492
- function valFn(v) {
2493
- if (v == null || v === '')
2494
- return true;
2495
- if (typeof (v) !== 'string')
2496
- return false;
2497
- v = v.replace(/(\-|\s)/g, ""); // remove dashes and spaces
2498
- if (!v || /\D/.test(v))
2499
- return false; // all digits, not empty
2500
- return luhn(v);
2501
- }
2502
- return new Validator('creditCard', valFn, context);
2503
- };
2504
- /**
2505
- Returns a regular expression validator; the expression must be specified
2506
- @example
2507
- // Add validator to a property. Assume em is a preexisting EntityManager.
2508
- var customerType = em.metadataStore.getEntityType("Customer");
2509
- var regionProperty = customerType.getProperty("Region");
2510
- // Validates that the value of Customer.Region is 2 char uppercase alpha.
2511
- regionProperty.validators.push(Validator.regularExpression( {expression: '^[A-Z]{2}$'} );
2512
- @method regularExpression
2513
- @static
2514
- @param context {Object}
2515
- @param context.expression {String} String form of the regular expression to apply
2516
- @return {Validator} A new Validator
2517
- **/
2518
- Validator.regularExpression = function (context) {
2519
- function valFn(v, ctx) {
2520
- // do not invalidate if empty; use a separate required test
2521
- if (v == null || v === '')
2522
- return true;
2523
- if (typeof (v) !== 'string')
2524
- return false;
2525
- try {
2526
- let re = new RegExp(ctx.expression);
2527
- return re.test(v);
2528
- }
2529
- catch (e) {
2530
- throw new Error('Missing or invalid expression parameter to regExp validator');
2531
- }
2532
- }
2533
- return new Validator('regularExpression', valFn, context);
2534
- };
2535
- /**
2536
- Returns the email address validator
2537
- @example
2538
- // Assume em is a preexisting EntityManager.
2539
- var personType = em.metadataStore.getEntityType("Person");
2540
- var emailProperty = personType.getProperty("email");
2541
- // Validates that the value of the Person.email property is an email address.
2542
- emailProperty.validators.push(Validator.emailAddress());
2543
- @method emailAddress
2544
- @static
2545
- @param [context] {Object} optional parameters to pass through to validation constructor
2546
- @return {Validator} A new Validator
2547
- **/
2548
- Validator.emailAddress = function (context) {
2549
- // See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/EmailAttribute.cs
2550
- 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;
2551
- return makeRegExpValidator('emailAddress', reEmailAddress, null, context);
2552
- };
2553
- /**
2554
- Returns the phone validator
2555
- Provides basic assertions on the format and will help to eliminate most nonsense input
2556
- Matches:
2557
- International dialing prefix: {{}, +, 0, 0000} (with or without a trailing break character, if not '+': [-/. ])
2558
- > ((\+)|(0(\d+)?[-/.\s]))
2559
- Country code: {{}, 1, ..., 999} (with or without a trailing break character: [-/. ])
2560
- > [1-9]\d{,2}[-/.\s]?
2561
- Area code: {(0), ..., (000000), 0, ..., 000000} (with or without a trailing break character: [-/. ])
2562
- > ((\(\d{1,6}\)|\d{1,6})[-/.\s]?)?
2563
- Local: {0, ...}+ (with or without a trailing break character: [-/. ])
2564
- > (\d+[-/.\s]?)+\d+
2565
- @example
2566
- // Assume em is a preexisting EntityManager.
2567
- var customerType = em.metadataStore.getEntityType("Customer");
2568
- var phoneProperty = customerType.getProperty("phone");
2569
- // Validates that the value of the Customer.phone property is phone.
2570
- phoneProperty.validators.push(Validator.phone());
2571
- @method phone
2572
- @static
2573
- @param [context] {Object} optional parameters to pass through to validation constructor
2574
- @return {Validator} A new Validator
2575
- **/
2576
- Validator.phone = function (context) {
2577
- // See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/Expressions.cs
2578
- let rePhone = /^((\+|(0(\d+)?[-/.\s]?))[1-9]\d{0,2}[-/.\s]?)?((\(\d{1,6}\)|\d{1,6})[-/.\s]?)?(\d+[-/.\s]?)+\d+$/;
2579
- return makeRegExpValidator('phone', rePhone, null, context);
2580
- };
2581
- /**
2582
- Returns the URL (protocol required) validator
2583
- @example
2584
- // Assume em is a preexisting EntityManager.
2585
- var personType = em.metadataStore.getEntityType("Person");
2586
- var websiteProperty = personType.getProperty("website");
2587
- // Validates that the value of the Person.website property is a URL.
2588
- websiteProperty.validators.push(Validator.url());
2589
- @method url
2590
- @static
2591
- @param [context] {Object} optional parameters to pass through to validation constructor
2592
- @return {Validator} A new Validator
2593
- **/
2594
- Validator.url = function (context) {
2595
- //See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/UrlAttribute.cs
2596
- 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})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/;
2597
- return makeRegExpValidator('url', reUrlProtocolRequired, null, context);
2598
- };
2599
- /**
2600
- Creates a regular expression validator with a fixed expression.
2601
- Many of the stock validators are built with this factory method.
2602
- Their expressions are often derived from
2603
- https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions
2604
- You can try many of them at http://dataannotationsextensions.org/
2605
- @example
2606
- // Make a zipcode validator
2607
- function zipValidator = Validator.makeRegExpValidator(
2608
- "zipVal,
2609
- /^\d{5}([\-]\d{4})?$/,
2610
- "The %displayName% '%value%' is not a valid U.S. zipcode");
2611
- // Register it.
2612
- Validator.register(zipValidator);
2613
- // Add it to a data property. Assume em is a preexisting EntityManager.
2614
- var custType = em.metadataStore.getEntityType("Customer");
2615
- var zipProperty = custType.getProperty("PostalCode");
2616
- zipProperty.validators.push(zipValidator);
2617
- @method makeRegExpValidator
2618
- @static
2619
- @param validatorName {String} name of this validator
2620
- @param expression {String | RegExp} regular expression to apply
2621
- @param [defaultMessage] {String} default message for failed validations
2622
- @param [context] {Object} optional parameters to pass through to validation constructor
2623
- @return {Validator} A new Validator
2624
- **/
2625
- 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
+ }
2626
2704
  Validator.prototype._$typeName = "Validator";
2627
2705
  // register all validators
2628
2706
  Error['x'] = core.objectForEach(Validator, function (key, value) {
@@ -2709,7 +2787,14 @@ function makeRegExpValidator(validatorName, expression, defaultMessage, context)
2709
2787
  };
2710
2788
  return new Validator(validatorName, valFn, context);
2711
2789
  }
2712
- 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 () {
2713
2798
  let luhnArr = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9];
2714
2799
  return function (str) {
2715
2800
  let counter = 0;
@@ -2724,15 +2809,7 @@ const ɵ1 = function () {
2724
2809
  }
2725
2810
  return (counter % 10 === 0);
2726
2811
  };
2727
- };
2728
- // http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers#JavaScript
2729
- // function luhn(a: string, b: number, c: number, d: number, e: number) {
2730
- // for (d = +a[b = a.length - 1], e = 0; b--; ) {
2731
- // c = +a[b], d += ++e % 2 ? 2 * c % 10 + (c > 4) : c;
2732
- // }
2733
- // return !(d % 10);
2734
- // };
2735
- let luhn = (ɵ1)();
2812
+ })();
2736
2813
  /**
2737
2814
  A ValidationError is used to describe a failed validation.
2738
2815
 
@@ -2748,6 +2825,13 @@ Constructs a new ValidationError
2748
2825
  @param [key] {String} An optional key used to define a key for this error. One will be created automatically if not provided here.
2749
2826
  **/
2750
2827
  class ValidationError {
2828
+ validator;
2829
+ key;
2830
+ context;
2831
+ errorMessage;
2832
+ property; // IProperty
2833
+ propertyName;
2834
+ isServerError;
2751
2835
  constructor(validator, context, errorMessage, key) {
2752
2836
  // Error is with isInstanceOf(Validator)
2753
2837
  assertParam(validator, "validator").isOptional().isInstanceOf(Validator).check();
@@ -2829,6 +2913,131 @@ DataType is an 'Enum' containing all of the supported data types.
2829
2913
  @dynamic
2830
2914
  **/
2831
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
+ });
2832
3041
  static getComparableFn(dataType) {
2833
3042
  if (dataType && dataType.normalize) {
2834
3043
  return dataType.normalize;
@@ -2949,127 +3158,6 @@ class DataType extends BreezeEnum {
2949
3158
  };
2950
3159
  }
2951
3160
  }
2952
- DataType.parseDateFromServer = (value) => DataType.parseDateAsUTC(value);
2953
- DataType.String = new DataType({
2954
- defaultValue: "",
2955
- parse: coerceToString,
2956
- fmtOData: fmtString,
2957
- getNext: getNextString
2958
- });
2959
- DataType.Int64 = new DataType({
2960
- defaultValue: 0,
2961
- isNumeric: true,
2962
- isInteger: true,
2963
- quoteJsonOData: true,
2964
- parse: coerceToInt,
2965
- fmtOData: makeFloatFmt("L"),
2966
- getNext: getNextNumber
2967
- });
2968
- DataType.Int32 = new DataType({
2969
- defaultValue: 0,
2970
- isNumeric: true,
2971
- isInteger: true,
2972
- parse: coerceToInt,
2973
- fmtOData: fmtInt,
2974
- getNext: getNextNumber
2975
- });
2976
- DataType.Int16 = new DataType({
2977
- defaultValue: 0,
2978
- isNumeric: true,
2979
- isInteger: true,
2980
- parse: coerceToInt,
2981
- fmtOData: fmtInt,
2982
- getNext: getNextNumber
2983
- });
2984
- DataType.Byte = new DataType({
2985
- defaultValue: 0,
2986
- isNumeric: true,
2987
- isInteger: true,
2988
- parse: coerceToInt,
2989
- fmtOData: fmtInt
2990
- });
2991
- DataType.Decimal = new DataType({
2992
- defaultValue: 0,
2993
- isNumeric: true,
2994
- quoteJsonOData: true,
2995
- isFloat: true,
2996
- parse: coerceToFloat,
2997
- fmtOData: makeFloatFmt("m"),
2998
- getNext: getNextNumber
2999
- });
3000
- DataType.Double = new DataType({
3001
- defaultValue: 0,
3002
- isNumeric: true,
3003
- isFloat: true,
3004
- parse: coerceToFloat,
3005
- fmtOData: makeFloatFmt("d"),
3006
- getNext: getNextNumber
3007
- });
3008
- DataType.Single = new DataType({
3009
- defaultValue: 0,
3010
- isNumeric: true,
3011
- isFloat: true,
3012
- parse: coerceToFloat,
3013
- fmtOData: makeFloatFmt("f"),
3014
- getNext: getNextNumber
3015
- });
3016
- DataType.DateOnly = new DataType({
3017
- defaultValue: new Date(1900, 0, 1),
3018
- isDate: true,
3019
- parse: coerceToDateOnly,
3020
- parseRawValue: parseRawDateOnly,
3021
- normalize: function (value) { return value && value.getTime && (new Date(value.getYear(), value.getMonth(), value.getDate())).getTime(); },
3022
- fmtOData: fmtDateOnly,
3023
- getNext: getNextDateTime,
3024
- getConcurrencyValue: getConcurrencyDateTime
3025
- });
3026
- DataType.DateTime = new DataType({
3027
- defaultValue: new Date(1900, 0, 1),
3028
- isDate: true,
3029
- parse: coerceToDate,
3030
- parseRawValue: parseRawDate,
3031
- normalize: function (value) { return value && value.getTime && value.getTime(); },
3032
- fmtOData: fmtDateTime,
3033
- getNext: getNextDateTime,
3034
- getConcurrencyValue: getConcurrencyDateTime
3035
- });
3036
- DataType.DateTimeOffset = new DataType({
3037
- defaultValue: new Date(1900, 0, 1),
3038
- isDate: true,
3039
- parse: coerceToDate,
3040
- parseRawValue: parseRawDate,
3041
- normalize: function (value) { return value && value.getTime && value.getTime(); },
3042
- fmtOData: fmtDateTimeOffset,
3043
- getNext: getNextDateTime,
3044
- getConcurrencyValue: getConcurrencyDateTime
3045
- });
3046
- DataType.Time = new DataType({
3047
- defaultValue: "PT0S",
3048
- fmtOData: fmtTime,
3049
- parseRawValue: DataType.parseTimeFromServer
3050
- });
3051
- DataType.Boolean = new DataType({
3052
- defaultValue: false,
3053
- parse: coerceToBool,
3054
- fmtOData: fmtBoolean
3055
- });
3056
- DataType.Guid = new DataType({
3057
- defaultValue: "00000000-0000-0000-0000-000000000000",
3058
- parse: coerceToGuid,
3059
- fmtOData: fmtGuid,
3060
- getNext: getNextGuid,
3061
- parseRawValue: function (val) { return val.toLowerCase(); },
3062
- getConcurrencyValue: core.getUuid
3063
- });
3064
- DataType.Binary = new DataType({
3065
- defaultValue: null,
3066
- fmtOData: fmtBinary,
3067
- parseRawValue: parseRawBinary
3068
- });
3069
- DataType.Undefined = new DataType({
3070
- defaultValue: undefined,
3071
- fmtOData: fmtUndefined
3072
- });
3073
3161
  DataType.prototype._$typeName = "DataType";
3074
3162
  Error['x'] = DataType._resetConstants();
3075
3163
  Error['x'] = DataType.resolveSymbols();
@@ -3327,6 +3415,16 @@ function parseRawBinary(val) {
3327
3415
  EntityState is an 'Enum' containing all of the valid states for an 'Entity'.
3328
3416
  **/
3329
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();
3330
3428
  /**
3331
3429
  Returns whether an entityState instance is EntityState.Unchanged.
3332
3430
  > var es = anEntity.entityAspect.entityState;
@@ -3416,16 +3514,6 @@ class EntityState extends BreezeEnum {
3416
3514
  this === EntityState.Deleted;
3417
3515
  }
3418
3516
  }
3419
- /** The 'Unchanged' state. **/
3420
- EntityState.Unchanged = new EntityState();
3421
- /** The 'Added' state. **/
3422
- EntityState.Added = new EntityState();
3423
- /** The 'Modified' state. **/
3424
- EntityState.Modified = new EntityState();
3425
- /** The 'Deleted' state. **/
3426
- EntityState.Deleted = new EntityState();
3427
- /** The 'Detached' state. **/
3428
- EntityState.Detached = new EntityState();
3429
3517
  EntityState.prototype._$typeName = "EntityState";
3430
3518
  Error['x'] = EntityState.resolveSymbols();
3431
3519
 
@@ -3433,6 +3521,30 @@ Error['x'] = EntityState.resolveSymbols();
3433
3521
 
3434
3522
  */
3435
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 });
3436
3548
  /** Is this an 'attach' operation? ( Attach, AttachOnQuery or AttachOnImport) */
3437
3549
  isAttach() {
3438
3550
  return !!this._isAttach;
@@ -3446,30 +3558,6 @@ class EntityAction extends BreezeEnum {
3446
3558
  return !!this._isModification;
3447
3559
  }
3448
3560
  }
3449
- /** Entity was attached via an AttachEntity call. */
3450
- EntityAction.Attach = new EntityAction({ _isAttach: true });
3451
- /** Entity was attached as a result of a query. */
3452
- EntityAction.AttachOnQuery = new EntityAction({ _isAttach: true });
3453
- /** Entity was attached as a result of an import. */
3454
- EntityAction.AttachOnImport = new EntityAction({ _isAttach: true });
3455
- /** Entity was detached */
3456
- EntityAction.Detach = new EntityAction({ _isDetach: true });
3457
- /** Properties on the entity were merged as a result of a query. */
3458
- EntityAction.MergeOnQuery = new EntityAction({ _isModification: true });
3459
- /** Properties on the entity were merged as a result of an import. */
3460
- EntityAction.MergeOnImport = new EntityAction({ _isModification: true });
3461
- /** Properties on the entity were merged as a result of a save */
3462
- EntityAction.MergeOnSave = new EntityAction({ _isModification: true });
3463
- /** A property on the entity was changed. */
3464
- EntityAction.PropertyChange = new EntityAction({ _isModification: true });
3465
- /** The EntityState of the entity was changed. */
3466
- EntityAction.EntityStateChange = new EntityAction();
3467
- /** AcceptChanges was called on the entity, or its entityState was set to Unmodified. */
3468
- EntityAction.AcceptChanges = new EntityAction();
3469
- /** RejectChanges was called on the entity. */
3470
- EntityAction.RejectChanges = new EntityAction({ _isModification: true });
3471
- /** The EntityManager was cleared. All entities detached. */
3472
- EntityAction.Clear = new EntityAction({ _isDetach: true });
3473
3561
  EntityAction.prototype._$typeName = "EntityAction";
3474
3562
  Error['x'] = EntityAction.resolveSymbols();
3475
3563
 
@@ -3479,6 +3567,19 @@ An EntityKey is an object that represents the unique identity of an entity. Ent
3479
3567
 
3480
3568
  **/
3481
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;
3482
3583
  /**
3483
3584
  Constructs a new EntityKey. Each entity within an EntityManager will have a unique EntityKey.
3484
3585
  > // assume em1 is an EntityManager containing a number of existing entities.
@@ -3581,8 +3682,6 @@ class EntityKey {
3581
3682
  return keyValues.join(EntityKey.ENTITY_KEY_DELIMITER);
3582
3683
  }
3583
3684
  }
3584
- /** @hidden @internal */
3585
- EntityKey.ENTITY_KEY_DELIMITER = ":::";
3586
3685
  EntityKey.prototype._$typeName = "EntityKey";
3587
3686
 
3588
3687
  /**
@@ -3592,53 +3691,69 @@ MergeStrategy is an 'Enum' that determines how entities are merged into an Entit
3592
3691
  @static
3593
3692
  **/
3594
3693
  class MergeStrategy extends BreezeEnum {
3595
- }
3596
- /**
3597
- MergeStrategy.PreserveChanges updates the cached entity with the incoming values unless the cached entity is in a changed
3598
- state (added, modified, deleted) in which case the incoming values are ignored. The updated cached entity’s EntityState will
3599
- remain [[EntityState.Unchanged]] unless you’re importing entities in which case the new EntityState will
3600
- be that of the imported entities.
3601
- **/
3602
- MergeStrategy.PreserveChanges = new MergeStrategy();
3603
- /**
3604
- MergeStrategy.OverwriteChanges always updates the cached entity with incoming values even if the entity is in
3605
- a changed state (added, modified, deleted). After the merge, the pending changes are lost.
3606
- The new EntityState will be [[EntityState/Unchanged]] unless you’re importing entities
3607
- in which case the new EntityState will be that of the imported entities.
3608
- **/
3609
- MergeStrategy.OverwriteChanges = new MergeStrategy();
3610
- /**
3611
- 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.
3612
- This is the fastest merge strategy but your existing cached data will remain “stale”.
3613
- **/
3614
- MergeStrategy.SkipMerge = new MergeStrategy();
3615
- /**
3616
- Disallowed is used to throw an exception if there is an incoming entity with the same key as an entity already in the cache.
3617
- Use this strategy when you want to be sure that the incoming entity is not already in cache.
3618
- This is the default strategy for EntityManager.attachEntity.
3619
- **/
3620
- MergeStrategy.Disallowed = new MergeStrategy();
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();
3719
+ }
3621
3720
  MergeStrategy.prototype._$typeName = "MergeStrategy";
3622
3721
  Error['x'] = MergeStrategy.resolveSymbols();
3623
3722
  /**
3624
3723
  FetchStrategy is an 'Enum' that determines how and where entities are retrieved from as a result of a query.
3625
3724
  **/
3626
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();
3627
3734
  }
3628
- /**
3629
- FromServer is used to tell the query to execute the query against a remote data source on the server.
3630
- **/
3631
- FetchStrategy.FromServer = new FetchStrategy();
3632
- /**
3633
- FromLocalCache is used to tell the query to execute the query against a local EntityManager instead of going to a remote server.
3634
- **/
3635
- FetchStrategy.FromLocalCache = new FetchStrategy();
3636
3735
  FetchStrategy.prototype._$typeName = "FetchStrategy";
3637
3736
  Error['x'] = FetchStrategy.resolveSymbols();
3638
3737
  /**
3639
3738
  A QueryOptions instance is used to specify the 'options' under which a query will occur.
3640
3739
  **/
3641
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
+ });
3642
3757
  /**
3643
3758
  QueryOptions constructor
3644
3759
  > var newQo = new QueryOptions( { mergeStrategy: MergeStrategy.OverwriteChanges });
@@ -3724,14 +3839,6 @@ class QueryOptions {
3724
3839
  return obj;
3725
3840
  }
3726
3841
  }
3727
- /**
3728
- The default instance for use whenever QueryOptions are not specified.
3729
- **/
3730
- QueryOptions.defaultInstance = new QueryOptions({
3731
- fetchStrategy: FetchStrategy.FromServer,
3732
- mergeStrategy: MergeStrategy.PreserveChanges,
3733
- includeDeleted: false
3734
- });
3735
3842
  QueryOptions.prototype._$typeName = "QueryOptions";
3736
3843
 
3737
3844
  /**
@@ -4128,6 +4235,7 @@ function updateAliasMap(aliasMap, opStr, op) {
4128
4235
  @hidden @internal
4129
4236
  */
4130
4237
  class PassthruPredicate extends Predicate {
4238
+ value;
4131
4239
  constructor(value) {
4132
4240
  super();
4133
4241
  this.value = value;
@@ -4139,6 +4247,7 @@ Error['x'] = PassthruPredicate.prototype._initialize('passthruPredicate');
4139
4247
  @hidden
4140
4248
  */
4141
4249
  class UnaryPredicate extends Predicate {
4250
+ pred;
4142
4251
  constructor(op, ...args) {
4143
4252
  super();
4144
4253
  this.op = this._resolveOp(op);
@@ -4156,6 +4265,10 @@ Error['x'] = UnaryPredicate.prototype._initialize('unaryPredicate', {
4156
4265
  @hidden
4157
4266
  */
4158
4267
  class BinaryPredicate extends Predicate {
4268
+ expr1Source;
4269
+ expr2Source;
4270
+ expr1;
4271
+ expr2;
4159
4272
  constructor(op, expr1, expr2) {
4160
4273
  super();
4161
4274
  // 5 public props op, expr1Source, expr2Source, expr1, expr2
@@ -4224,6 +4337,7 @@ Error['x'] = BinaryPredicate.prototype._initialize('binaryPredicate', {
4224
4337
  @hidden
4225
4338
  */
4226
4339
  class AndOrPredicate extends Predicate {
4340
+ preds;
4227
4341
  constructor(op, preds) {
4228
4342
  super();
4229
4343
  this.op = this._resolveOp(op);
@@ -4259,6 +4373,10 @@ Error['x'] = AndOrPredicate.prototype._initialize("andOrPredicate", {
4259
4373
  @hidden
4260
4374
  */
4261
4375
  class AnyAllPredicate extends Predicate {
4376
+ /** @internal */
4377
+ expr;
4378
+ exprSource;
4379
+ pred;
4262
4380
  // 4 public props: op, exprSource, expr, pred
4263
4381
  constructor(op, expr, pred) {
4264
4382
  super();
@@ -4282,6 +4400,9 @@ Error['x'] = AnyAllPredicate.prototype._initialize("anyAllPredicate", {
4282
4400
  });
4283
4401
  /** @hidden */
4284
4402
  class PredicateExpression {
4403
+ visitorMethodName;
4404
+ visit; // TODO
4405
+ dataType;
4285
4406
  constructor(visitorMethodName) {
4286
4407
  this.visitorMethodName = visitorMethodName;
4287
4408
  // give expressions the Predicate prototype method
@@ -4297,6 +4418,8 @@ class PredicateExpression {
4297
4418
  @hidden
4298
4419
  */
4299
4420
  class LitExpr extends PredicateExpression {
4421
+ value;
4422
+ hasExplicitDataType;
4300
4423
  // 2 public props: value, dataType
4301
4424
  constructor(value, dataType, hasExplicitDataType) {
4302
4425
  super("litExpr");
@@ -4345,6 +4468,7 @@ function resolveDataType(dataType) {
4345
4468
  @hidden
4346
4469
  */
4347
4470
  class PropExpr extends PredicateExpression {
4471
+ propertyPath;
4348
4472
  // two public props: propertyPath, dateType
4349
4473
  constructor(propertyPath) {
4350
4474
  super('propExpr');
@@ -4378,6 +4502,9 @@ class PropExpr extends PredicateExpression {
4378
4502
  @hidden @dynamic
4379
4503
  */
4380
4504
  class FnExpr extends PredicateExpression {
4505
+ fnName;
4506
+ exprs;
4507
+ localFn; // TODO:
4381
4508
  constructor(fnName, exprs) {
4382
4509
  super('fnExpr');
4383
4510
  // 4 public props: fnName, exprs, localFn, dataType
@@ -4401,109 +4528,109 @@ class FnExpr extends PredicateExpression {
4401
4528
  expr._validate(entityType, usesNameOnServer);
4402
4529
  });
4403
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
+ };
4404
4633
  }
4405
- FnExpr._funcMap = {
4406
- toupper: {
4407
- fn: function (source) {
4408
- return source.toUpperCase();
4409
- }, dataType: DataType.String
4410
- },
4411
- tolower: {
4412
- fn: function (source) {
4413
- return source.toLowerCase();
4414
- }, dataType: DataType.String
4415
- },
4416
- substring: {
4417
- fn: function (source, pos, length) {
4418
- return source.substring(pos, length);
4419
- }, dataType: DataType.String
4420
- },
4421
- substringof: {
4422
- fn: function (find, source) {
4423
- return source.indexOf(find) >= 0;
4424
- }, dataType: DataType.Boolean
4425
- },
4426
- length: {
4427
- fn: function (source) {
4428
- return source.length;
4429
- }, dataType: DataType.Int32
4430
- },
4431
- trim: {
4432
- fn: function (source) {
4433
- return source.trim();
4434
- }, dataType: DataType.String
4435
- },
4436
- concat: {
4437
- fn: function (s1, s2) {
4438
- return s1.concat(s2);
4439
- }, dataType: DataType.String
4440
- },
4441
- replace: {
4442
- fn: function (source, find, replace) {
4443
- return source.replace(find, replace);
4444
- }, dataType: DataType.String
4445
- },
4446
- startswith: {
4447
- fn: function (source, find) {
4448
- return core.stringStartsWith(source, find);
4449
- }, dataType: DataType.Boolean
4450
- },
4451
- endswith: {
4452
- fn: function (source, find) {
4453
- return core.stringEndsWith(source, find);
4454
- }, dataType: DataType.Boolean
4455
- },
4456
- indexof: {
4457
- fn: function (source, find) {
4458
- return source.indexOf(find);
4459
- }, dataType: DataType.Int32
4460
- },
4461
- round: {
4462
- fn: function (source) {
4463
- return Math.round(source);
4464
- }, dataType: DataType.Int32
4465
- },
4466
- ceiling: {
4467
- fn: function (source) {
4468
- return Math.ceil(source);
4469
- }, dataType: DataType.Int32
4470
- },
4471
- floor: {
4472
- fn: function (source) {
4473
- return Math.floor(source);
4474
- }, dataType: DataType.Int32
4475
- },
4476
- second: {
4477
- fn: function (source) {
4478
- return source.getSeconds();
4479
- }, dataType: DataType.Int32
4480
- },
4481
- minute: {
4482
- fn: function (source) {
4483
- return source.getMinutes();
4484
- }, dataType: DataType.Int32
4485
- },
4486
- hour: {
4487
- fn: function (source) {
4488
- return source.getHours();
4489
- }, dataType: DataType.Int32
4490
- },
4491
- day: {
4492
- fn: function (source) {
4493
- return source.getDate();
4494
- }, dataType: DataType.Int32
4495
- },
4496
- month: {
4497
- fn: function (source) {
4498
- return source.getMonth() + 1;
4499
- }, dataType: DataType.Int32
4500
- },
4501
- year: {
4502
- fn: function (source) {
4503
- return source.getFullYear();
4504
- }, dataType: DataType.Int32
4505
- }
4506
- };
4507
4634
  // TODO: add dataTypes for the args next - will help to infer other dataTypes.
4508
4635
  let RX_IDENTIFIER = /^[a-z_][\w.$]*$/i;
4509
4636
  // comma delimited expressions ignoring commas inside of both single and double quotes.
@@ -4633,104 +4760,103 @@ function parseFnExpr(source, parts, tokens, exprContext) {
4633
4760
  throw e;
4634
4761
  }
4635
4762
  }
4636
- const ɵ0$2 = function () {
4637
- throw new Error("Cannot execute an PassthruPredicate expression against the local cache: " + this.value);
4638
- }, ɵ1$1 = function (context) {
4639
- let predFn = this.pred.visit(context);
4640
- switch (this.op.key) {
4641
- case "not":
4642
- return function (entity) {
4643
- return !predFn(entity);
4644
- };
4645
- default:
4646
- throw new Error("Invalid unary operator:" + this.op.key);
4647
- }
4648
- }, ɵ2 = function (context) {
4649
- let expr1Fn = this.expr1.visit(context);
4650
- let expr2Fn = this.expr2.visit(context);
4651
- let dataType = this.expr1.dataType || this.expr2.dataType;
4652
- let lqco = context.entityType.metadataStore.localQueryComparisonOptions;
4653
- let predFn = getBinaryPredicateFn(this, dataType, lqco);
4654
- if (predFn == null) {
4655
- throw new Error("Invalid binaryPredicate operator:" + this.op.key);
4656
- }
4657
- return function (entity) {
4658
- return predFn(expr1Fn(entity), expr2Fn(entity));
4659
- };
4660
- }, ɵ3 = function (context) {
4661
- let predFns = this.preds.map((pred) => {
4662
- return pred.visit(context);
4663
- });
4664
- switch (this.op.key) {
4665
- 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) {
4666
4836
  return function (entity) {
4667
- let result = predFns.reduce(function (prev, cur) {
4668
- return prev && cur(entity);
4669
- }, true);
4670
- return result;
4837
+ return entity.getProperty(propertyPath);
4671
4838
  };
4672
- case "or":
4839
+ }
4840
+ else {
4673
4841
  return function (entity) {
4674
- let result = predFns.reduce(function (prev, cur) {
4675
- return prev || cur(entity);
4676
- }, false);
4677
- return result;
4842
+ return EntityAspect.getPropertyPathValue(entity, properties);
4678
4843
  };
4679
- default:
4680
- throw new Error("Invalid boolean operator:" + this.op.key);
4681
- }
4682
- }, ɵ4 = function (context) {
4683
- let exprFn = this.expr.visit(context);
4684
- let newContext = core.extend({}, context);
4685
- newContext.entityType = this.expr.dataType;
4686
- let predFn = this.pred.visit(newContext);
4687
- let anyAllPredFn = getAnyAllPredicateFn(this.op);
4688
- return function (entity) {
4689
- return anyAllPredFn(exprFn(entity), predFn);
4690
- };
4691
- }, ɵ5 = function () {
4692
- let value = this.value;
4693
- return function (entity) {
4694
- return value;
4695
- };
4696
- }, ɵ6 = function () {
4697
- let propertyPath = this.propertyPath;
4698
- let properties = propertyPath.split('.');
4699
- if (properties.length === 1) {
4700
- return function (entity) {
4701
- return entity.getProperty(propertyPath);
4702
- };
4703
- }
4704
- 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;
4705
4851
  return function (entity) {
4706
- 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;
4707
4858
  };
4708
4859
  }
4709
- }, ɵ7 = function (context) {
4710
- let exprFns = this.exprs.map(function (expr) {
4711
- return expr.visit(context);
4712
- });
4713
- let that = this;
4714
- return function (entity) {
4715
- let values = exprFns.map(function (exprFn) {
4716
- let value = exprFn(entity);
4717
- return value;
4718
- });
4719
- let result = that.localFn.apply(null, values);
4720
- return result;
4721
- };
4722
- };
4723
- // toFunctionVisitor
4724
- let toFunctionVisitor = {
4725
- isExtended: false,
4726
- passthruPredicate: ɵ0$2,
4727
- unaryPredicate: ɵ1$1,
4728
- binaryPredicate: ɵ2,
4729
- andOrPredicate: ɵ3,
4730
- anyAllPredicate: ɵ4,
4731
- litExpr: ɵ5,
4732
- propExpr: ɵ6,
4733
- fnExpr: ɵ7
4734
4860
  };
4735
4861
  function getAnyAllPredicateFn(op) {
4736
4862
  switch (op.key) {
@@ -4797,12 +4923,12 @@ function getBinaryPredicateFn(binaryPredicate, dataType, lqco) {
4797
4923
  break;
4798
4924
  case 'startswith':
4799
4925
  predFn = function (v1, v2) {
4800
- return stringStartsWith$1(v1, v2, lqco);
4926
+ return stringStartsWith(v1, v2, lqco);
4801
4927
  };
4802
4928
  break;
4803
4929
  case 'endswith':
4804
4930
  predFn = function (v1, v2) {
4805
- return stringEndsWith$1(v1, v2, lqco);
4931
+ return stringEndsWith(v1, v2, lqco);
4806
4932
  };
4807
4933
  break;
4808
4934
  case 'contains':
@@ -4838,14 +4964,14 @@ function stringEquals(a, b, lqco) {
4838
4964
  }
4839
4965
  return a === b;
4840
4966
  }
4841
- function stringStartsWith$1(a, b, lqco) {
4967
+ function stringStartsWith(a, b, lqco) {
4842
4968
  if (!lqco.isCaseSensitive) {
4843
4969
  a = (a || "").toLowerCase();
4844
4970
  b = (b || "").toLowerCase();
4845
4971
  }
4846
4972
  return core.stringStartsWith(a, b);
4847
4973
  }
4848
- function stringEndsWith$1(a, b, lqco) {
4974
+ function stringEndsWith(a, b, lqco) {
4849
4975
  if (!lqco.isCaseSensitive) {
4850
4976
  a = (a || "").toLowerCase();
4851
4977
  b = (b || "").toLowerCase();
@@ -4859,94 +4985,93 @@ function stringContains(a, b, lqco) {
4859
4985
  }
4860
4986
  return a.indexOf(b) >= 0;
4861
4987
  }
4862
- const ɵ8 = function () {
4863
- return this.value;
4864
- }, ɵ9 = function (context) {
4865
- let predVal = this.pred.visit(context);
4866
- let json = {};
4867
- json[this.op.key] = predVal;
4868
- return json;
4869
- }, ɵ10 = function (context) {
4870
- let expr1Val = this.expr1.visit(context);
4871
- let expr2Val = this.expr2.visit(context);
4872
- let json = {};
4873
- if (this.expr2 instanceof PropExpr) {
4874
- expr2Val = { value: expr2Val, isProperty: true };
4875
- }
4876
- if (this.op.key === "eq") {
4877
- json[expr1Val] = expr2Val;
4878
- }
4879
- else {
4988
+ // toJSONVisitor
4989
+ let toJSONVisitor = {
4990
+ passthruPredicate: function () {
4991
+ return this.value;
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 = {};
4880
5042
  let value = {};
4881
- json[expr1Val] = value;
4882
- value[this.op.key] = expr2Val;
4883
- }
4884
- return json;
4885
- }, ɵ11 = function (context) {
4886
- let predVals = this.preds.map(function (pred) {
4887
- return pred.visit(context);
4888
- });
4889
- if (!predVals || !predVals.length) {
4890
- return {};
4891
- }
4892
- let json;
4893
- // normalizeAnd clauses if possible.
4894
- // passthru predicate will appear as string and their 'ands' can't be 'normalized'
4895
- if (this.op.key === 'and' && predVals.length === 2 && !predVals.some((v) => v.or || typeof (v) === 'string')) {
4896
- // normalize 'and' clauses - will return null if can't be combined.
4897
- json = predVals.reduce(combine);
4898
- }
4899
- if (json == null) {
4900
- json = {};
4901
- json[this.op.key] = predVals;
4902
- }
4903
- return json;
4904
- }, ɵ12 = function (context) {
4905
- let exprVal = this.expr.visit(context);
4906
- let newContext = core.extend({}, context);
4907
- newContext.entityType = this.expr.dataType;
4908
- let predVal = this.pred.visit(newContext);
4909
- let json = {};
4910
- let value = {};
4911
- value[this.op.key] = predVal;
4912
- json[exprVal] = value;
4913
- return json;
4914
- }, ɵ13 = function (context) {
4915
- // special handling for DateOnly because it serializes improperly
4916
- const value = (this.dataType === DataType.DateOnly) ? DataType.toDateOnlyString(this.value) : this.value;
4917
- if (this.hasExplicitDataType || context.useExplicitDataType) {
4918
- return { value: value, dataType: this.dataType.name };
4919
- }
4920
- else {
4921
- return value;
4922
- }
4923
- }, ɵ14 = function (context) {
4924
- if (context.toNameOnServer) {
4925
- if (!context.entityType) {
4926
- console.warn(`No EntityType for propertyPath "${this.propertyPath}". ${core.strings.TO_TYPE}`);
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 {
4927
5066
  return this.propertyPath;
4928
5067
  }
4929
- return context.entityType.clientPropertyPathToServer(this.propertyPath);
4930
- }
4931
- else {
4932
- 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(",") + ")";
4933
5074
  }
4934
- }, ɵ15 = function (context) {
4935
- let exprVals = this.exprs.map(function (expr) {
4936
- return expr.visit(context);
4937
- });
4938
- return this.fnName + "(" + exprVals.join(",") + ")";
4939
- };
4940
- // toJSONVisitor
4941
- let toJSONVisitor = {
4942
- passthruPredicate: ɵ8,
4943
- unaryPredicate: ɵ9,
4944
- binaryPredicate: ɵ10,
4945
- andOrPredicate: ɵ11,
4946
- anyAllPredicate: ɵ12,
4947
- litExpr: ɵ13,
4948
- propExpr: ɵ14,
4949
- fnExpr: ɵ15
4950
5075
  };
4951
5076
  function combine(j1, j2) {
4952
5077
  let ok = Object.keys(j2).every(function (key) {
@@ -5004,6 +5129,7 @@ class EntityQuery {
5004
5129
  this.parameters = {};
5005
5130
  this.inlineCountEnabled = false;
5006
5131
  this.noTrackingEnabled = false;
5132
+ this.usePostEnabled = false;
5007
5133
  // default is to get queryOptions and dataService from the entityManager.
5008
5134
  // this.queryOptions = new QueryOptions();
5009
5135
  // this.dataService = new DataService();
@@ -5273,7 +5399,7 @@ class EntityQuery {
5273
5399
  return clone(this, "parameters", parameters);
5274
5400
  }
5275
5401
  /**
5276
- Returns a query with the 'inlineCount' capability either enabled or disabled. With 'inlineCount' enabled, an additional 'inlineCount' property
5402
+ Returns a query with the `inlineCount` capability either enabled or disabled. With `inlineCount` enabled, an additional 'inlineCount' property
5277
5403
  will be returned with the query results that will contain the number of entities that would have been returned by this
5278
5404
  query with only the 'where'/'filter' clauses applied, i.e. without any 'skip'/'take' operators applied. For local queries this clause is ignored.
5279
5405
  > let query = new EntityQuery("Customers")
@@ -5281,7 +5407,7 @@ class EntityQuery {
5281
5407
  > .orderBy("CompanyName")
5282
5408
  > .inlineCount(true);
5283
5409
 
5284
- will return the first 20 customers as well as a count of all of the customers in the remote store.
5410
+ will return the first 20 customers as well as a count of _all_ of the customers in the remote store.
5285
5411
  @param enabled - (default = true) Whether or not inlineCount capability should be enabled. If this parameter is omitted, true is assumed.
5286
5412
  **/
5287
5413
  inlineCount(enabled) {
@@ -5295,7 +5421,7 @@ class EntityQuery {
5295
5421
  return clone(this, "usesNameOnServer", usesNameOnServer);
5296
5422
  }
5297
5423
  /**
5298
- Returns a query with the 'noTracking' capability either enabled or disabled. With 'noTracking' enabled, the results of this query
5424
+ Returns a query with the `noTracking` capability either enabled or disabled. With `noTracking` enabled, the results of this query
5299
5425
  will not be coerced into entities but will instead look like raw javascript projections. i.e. simple javascript objects.
5300
5426
  > let query = new EntityQuery("Customers")
5301
5427
  > .take(20)
@@ -5309,6 +5435,22 @@ class EntityQuery {
5309
5435
  return clone(this, "noTrackingEnabled", enabled);
5310
5436
  }
5311
5437
  /**
5438
+ Returns a query with the `usePost` capability either enabled or disabled. With `usePost` enabled, the query is sent
5439
+ as a POST request (instead of GET) and the query expression will be sent as JSON in the body of the post.
5440
+ Note that the server must be able to parse the body of the request; otherwise the query expression will be ignored.
5441
+ > let query = new EntityQuery("Customers")
5442
+ > .where("companyId", "eq", 1)
5443
+ > .usePost(true);
5444
+ results in a POST request to `{host}/{path}/Customers`
5445
+ with body `{"where": {"companyId":{"eq":1}}}`
5446
+ @param enabled - (default = true) Whether or not usePost should be enabled. If this parameter is omitted, true is assumed.
5447
+ **/
5448
+ usePost(enabled) {
5449
+ assertParam(enabled, "enabled").isBoolean().isOptional().check();
5450
+ enabled = (enabled === undefined) ? true : !!enabled;
5451
+ return clone(this, "usePostEnabled", enabled);
5452
+ }
5453
+ /**
5312
5454
  Returns a copy of this EntityQuery with the specified [[EntityManager]], [[DataService]],
5313
5455
  [[JsonResultsAdapter]], [[MergeStrategy]] or [[FetchStrategy]] applied.
5314
5456
  > // 'using' can be used to return a new query with a specified EntityManager.
@@ -5501,6 +5643,28 @@ class EntityQuery {
5501
5643
  q = q.where(pred).toType(entityKey.entityType);
5502
5644
  return q;
5503
5645
  }
5646
+ /**
5647
+ Creates an EntityQuery for the specified entity and [[NavigationProperty]].
5648
+ > // 'employee' is a previously queried employee
5649
+ > let ordersNavProp = employee.entityType.getProperty("Orders");
5650
+ > let query = EntityQuery.fromEntityNavigation(employee, ordersNavProp);
5651
+
5652
+ will return a query for the "Orders" of the specified 'employee'.
5653
+ @param entity - The Entity whose navigation property will be queried.
5654
+ @param navigationProperty - The [[NavigationProperty]] or name of the NavigationProperty to be queried.
5655
+ **/
5656
+ static fromEntityNavigation = function (entity, navigationProperty) {
5657
+ assertParam(entity, "entity").isEntity().check();
5658
+ let navProperty = entity.entityType._checkNavProperty(navigationProperty);
5659
+ let q = new EntityQuery(navProperty.entityType.defaultResourceName);
5660
+ let pred = buildNavigationPredicate(entity, navProperty);
5661
+ if (pred == null) {
5662
+ throw new Error("Unable to create a NavigationQuery for navigationProperty: " + navProperty.name);
5663
+ }
5664
+ q = q.where(pred);
5665
+ let em = entity.entityAspect.entityManager;
5666
+ return em ? q.using(em) : q;
5667
+ };
5504
5668
  // protected methods
5505
5669
  /** @hidden @internal */
5506
5670
  _getFromEntityType(metadataStore, throwErrorIfNotFound) {
@@ -5572,28 +5736,6 @@ class EntityQuery {
5572
5736
  return ds.uriBuilder.buildUri(this, em.metadataStore);
5573
5737
  }
5574
5738
  }
5575
- /**
5576
- Creates an EntityQuery for the specified entity and [[NavigationProperty]].
5577
- > // 'employee' is a previously queried employee
5578
- > let ordersNavProp = employee.entityType.getProperty("Orders");
5579
- > let query = EntityQuery.fromEntityNavigation(employee, ordersNavProp);
5580
-
5581
- will return a query for the "Orders" of the specified 'employee'.
5582
- @param entity - The Entity whose navigation property will be queried.
5583
- @param navigationProperty - The [[NavigationProperty]] or name of the NavigationProperty to be queried.
5584
- **/
5585
- EntityQuery.fromEntityNavigation = function (entity, navigationProperty) {
5586
- assertParam(entity, "entity").isEntity().check();
5587
- let navProperty = entity.entityType._checkNavProperty(navigationProperty);
5588
- let q = new EntityQuery(navProperty.entityType.defaultResourceName);
5589
- let pred = buildNavigationPredicate(entity, navProperty);
5590
- if (pred == null) {
5591
- throw new Error("Unable to create a NavigationQuery for navigationProperty: " + navProperty.name);
5592
- }
5593
- q = q.where(pred);
5594
- let em = entity.entityAspect.entityManager;
5595
- return em ? q.using(em) : q;
5596
- };
5597
5739
  EntityQuery.prototype._$typeName = "EntityQuery";
5598
5740
  // private functions
5599
5741
  function fromJSON(eq, json) {
@@ -5620,6 +5762,7 @@ function fromJSON(eq, json) {
5620
5762
  },
5621
5763
  "inlineCountEnabled,inlineCount": false,
5622
5764
  "noTrackingEnabled,noTracking": false,
5765
+ "usePostEnabled,usePost": false,
5623
5766
  queryOptions: function (v) {
5624
5767
  return v ? QueryOptions.fromJSON(v) : undefined;
5625
5768
  }
@@ -5644,6 +5787,7 @@ function clone(eq, propName, value) {
5644
5787
  "expandClause",
5645
5788
  "inlineCountEnabled",
5646
5789
  "noTrackingEnabled",
5790
+ "usePostEnabled",
5647
5791
  "usesNameOnServer",
5648
5792
  "queryOptions",
5649
5793
  "entityManager",
@@ -5733,33 +5877,33 @@ FilterQueryOp is an 'Enum' containing all of the valid [[Predicate]]
5733
5877
  filter operators for an [[EntityQuery]].
5734
5878
  **/
5735
5879
  class FilterQueryOp extends BreezeEnum {
5880
+ /** Aliases: "eq", "==" **/
5881
+ static Equals = new FilterQueryOp({ operator: "eq" });
5882
+ /** Aliases: "ne", "!=" **/
5883
+ static NotEquals = new FilterQueryOp({ operator: "ne" });
5884
+ /** Aliases: "gt", ">" **/
5885
+ static GreaterThan = new FilterQueryOp({ operator: "gt" });
5886
+ /** Aliases: "lt", "<" **/
5887
+ static LessThan = new FilterQueryOp({ operator: "lt" });
5888
+ /** Aliases: "ge", ">=" **/
5889
+ static GreaterThanOrEqual = new FilterQueryOp({ operator: "ge" });
5890
+ /** Aliases: "le", "<=" **/
5891
+ static LessThanOrEqual = new FilterQueryOp({ operator: "le" });
5892
+ /** String operation: Is a string a substring of another string. Aliases: "substringof" **/
5893
+ static Contains = new FilterQueryOp({ operator: "contains" });
5894
+ /** No aliases */
5895
+ static StartsWith = new FilterQueryOp({ operator: "startswith" });
5896
+ /** No aliases */
5897
+ static EndsWith = new FilterQueryOp({ operator: "endswith" });
5898
+ /** Aliases: "some" **/
5899
+ static Any = new FilterQueryOp({ operator: "any" });
5900
+ /** Aliases: "every" **/
5901
+ static All = new FilterQueryOp({ operator: "all" });
5902
+ /** No aliases */
5903
+ static In = new FilterQueryOp({ operator: "in" });
5904
+ /** No aliases */
5905
+ static IsTypeOf = new FilterQueryOp({ operator: "isof" });
5736
5906
  }
5737
- /** Aliases: "eq", "==" **/
5738
- FilterQueryOp.Equals = new FilterQueryOp({ operator: "eq" });
5739
- /** Aliases: "ne", "!=" **/
5740
- FilterQueryOp.NotEquals = new FilterQueryOp({ operator: "ne" });
5741
- /** Aliases: "gt", ">" **/
5742
- FilterQueryOp.GreaterThan = new FilterQueryOp({ operator: "gt" });
5743
- /** Aliases: "lt", "<" **/
5744
- FilterQueryOp.LessThan = new FilterQueryOp({ operator: "lt" });
5745
- /** Aliases: "ge", ">=" **/
5746
- FilterQueryOp.GreaterThanOrEqual = new FilterQueryOp({ operator: "ge" });
5747
- /** Aliases: "le", "<=" **/
5748
- FilterQueryOp.LessThanOrEqual = new FilterQueryOp({ operator: "le" });
5749
- /** String operation: Is a string a substring of another string. Aliases: "substringof" **/
5750
- FilterQueryOp.Contains = new FilterQueryOp({ operator: "contains" });
5751
- /** No aliases */
5752
- FilterQueryOp.StartsWith = new FilterQueryOp({ operator: "startswith" });
5753
- /** No aliases */
5754
- FilterQueryOp.EndsWith = new FilterQueryOp({ operator: "endswith" });
5755
- /** Aliases: "some" **/
5756
- FilterQueryOp.Any = new FilterQueryOp({ operator: "any" });
5757
- /** Aliases: "every" **/
5758
- FilterQueryOp.All = new FilterQueryOp({ operator: "all" });
5759
- /** No aliases */
5760
- FilterQueryOp.In = new FilterQueryOp({ operator: "in" });
5761
- /** No aliases */
5762
- FilterQueryOp.IsTypeOf = new FilterQueryOp({ operator: "isof" });
5763
5907
  FilterQueryOp.prototype._$typeName = "FilterQueryOp";
5764
5908
  Error['x'] = FilterQueryOp.resolveSymbols();
5765
5909
  /**
@@ -5767,10 +5911,10 @@ Error['x'] = FilterQueryOp.resolveSymbols();
5767
5911
  operators for an [[EntityQuery]].
5768
5912
  **/
5769
5913
  class BooleanQueryOp extends BreezeEnum {
5914
+ static And = new BooleanQueryOp({ operator: "and" });
5915
+ static Or = new BooleanQueryOp({ operator: "or" });
5916
+ static Not = new BooleanQueryOp({ operator: "not" });
5770
5917
  }
5771
- BooleanQueryOp.And = new BooleanQueryOp({ operator: "and" });
5772
- BooleanQueryOp.Or = new BooleanQueryOp({ operator: "or" });
5773
- BooleanQueryOp.Not = new BooleanQueryOp({ operator: "not" });
5774
5918
  BooleanQueryOp.prototype._$typeName = "BooleanQueryOp";
5775
5919
  Error['x'] = BooleanQueryOp.resolveSymbols();
5776
5920
  /** For use by breeze plugin authors only. The class is used in most [[IUriBuilderAdapter]] implementations
@@ -5791,6 +5935,8 @@ or
5791
5935
  > let obc = new OrderByClause("Company.CompanyName, LastName", true);
5792
5936
  */
5793
5937
  class OrderByClause {
5938
+ /** @hidden @internal */
5939
+ items;
5794
5940
  constructor(propertyPaths, isDesc) {
5795
5941
  if (propertyPaths.length === 0) {
5796
5942
  throw new Error("OrderByClause cannot be empty");
@@ -5837,6 +5983,9 @@ class OrderByClause {
5837
5983
  }
5838
5984
  /** @hidden @internal */
5839
5985
  class OrderByItem {
5986
+ propertyPath;
5987
+ isDesc;
5988
+ lastProperty;
5840
5989
  constructor(propertyPath, isDesc) {
5841
5990
  if (!(typeof propertyPath === 'string')) {
5842
5991
  throw new Error("propertyPath is not a string");
@@ -5912,6 +6061,9 @@ class OrderByItem {
5912
6061
  @hidden
5913
6062
  **/
5914
6063
  class SelectClause {
6064
+ propertyPaths;
6065
+ /** @hidden @internal */
6066
+ _pathNames;
5915
6067
  constructor(propertyPaths) {
5916
6068
  this.propertyPaths = propertyPaths;
5917
6069
  this._pathNames = propertyPaths.map(function (pp) {
@@ -5947,6 +6099,7 @@ class SelectClause {
5947
6099
  @hidden
5948
6100
  **/
5949
6101
  class ExpandClause {
6102
+ propertyPaths;
5950
6103
  constructor(propertyPaths) {
5951
6104
  this.propertyPaths = propertyPaths;
5952
6105
  }
@@ -5972,53 +6125,96 @@ a query, import or [[EntityManager.createEntity]] call.
5972
6125
 
5973
6126
  **/
5974
6127
  class EntityAspect {
6128
+ /** The Entity that this aspect is associated with. __Read Only__ **/
6129
+ entity;
6130
+ /** The [[EntityManager]] that contains this entity. __Read Only__ **/
6131
+ entityManager;
6132
+ /** @hidden @internal */
6133
+ entityGroup;
6134
+ /** The [[EntityState]] of this entity. __Read Only__ **/
6135
+ entityState;
6136
+ /** Whether this entity is in the process of being saved. __Read Only__ */
6137
+ isBeingSaved;
6138
+ /** The 'original values' of this entity where they are different from the 'current values'.
6139
+ This is a map where the key is a property name and the value is the 'original value' of the property. */
6140
+ originalValues;
6141
+ /** Whether this entity has any validation errors. __Read Only__ */
6142
+ hasValidationErrors;
6143
+ /** Whether this entity has a temporary [[EntityKey]]. */
6144
+ hasTempKey;
6145
+ /** Whether this entity was created by being loaded from the database */
6146
+ wasLoaded;
6147
+ /** Extra metadata about this entity such as the entity's etag.
6148
+ You may extend this object with your own metadata information.
6149
+ Breeze (de)serializes this object when importing/exporting the entity. **/
6150
+ extraMetadata;
6151
+ /**
6152
+ A [[BreezeEvent]] that fires whenever any of the validation errors on this entity change.
6153
+ Note that this might be the removal of an error when some data on the entity is fixed.
6154
+ @eventArgs -
6155
+ - entity - The entity on which the validation errors are being added or removed.
6156
+ - added - An array containing any newly added [[ValidationError]]s
6157
+ - removed - An array containing any newly removed [[ValidationError]]s. This is those
6158
+ errors that have been 'fixed'.
6159
+
6160
+ > // assume order is an order entity attached to an EntityManager.
6161
+ > order.entityAspect.validationErrorsChanged.subscribe(
6162
+ > function (validationChangeArgs) {
6163
+ > // this code will be executed anytime a property value changes on the 'order' entity.
6164
+ > var entity == validationChangeArgs.entity; // Note: entity === order
6165
+ > var errorsAdded = validationChangeArgs.added;
6166
+ > var errorsCleared = validationChangeArgs.removed;
6167
+ > });
6168
+ @event
6169
+ **/
6170
+ validationErrorsChanged;
6171
+ /**
6172
+ A [[BreezeEvent]] that fires whenever a value of one of this entity's properties change.
6173
+ @eventArgs -
6174
+ - entity - The entity whose property has changed.
6175
+ - property - The [[DataProperty]] that changed.
6176
+ - propertyName - The name of the property that changed. This value will be 'null' for operations that replace the entire entity. This includes
6177
+ 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"
6178
+ for any properties of a complex type.
6179
+ - oldValue - The old value of this property before the change.
6180
+ - newValue - The new value of this property after the change.
6181
+ - parent - The immediate parent object for the changed property. This will be a ComplexType instance as opposed to an Entity
6182
+ for any complex type or nested complex type properties.
6183
+
6184
+ > // assume order is an order entity attached to an EntityManager.
6185
+ > order.entityAspect.propertyChanged.subscribe(
6186
+ > function (propertyChangedArgs) {
6187
+ > // this code will be executed anytime a property value changes on the 'order' entity.
6188
+ > var entity = propertyChangedArgs.entity; // Note: entity === order
6189
+ > var propertyNameChanged = propertyChangedArgs.propertyName;
6190
+ > var oldValue = propertyChangedArgs.oldValue;
6191
+ > var newValue = propertyChangedArgs.newValue;
6192
+ > });
6193
+ @event
6194
+ **/
6195
+ propertyChanged;
6196
+ /** @hidden @internal */
6197
+ _validationErrors;
6198
+ /** @hidden @internal */
6199
+ _pendingValidationResult;
6200
+ /** @hidden @internal */
6201
+ _entityKey;
6202
+ /** @hidden @internal */
6203
+ _loadedNps;
6204
+ /** @hidden @internal */
6205
+ _initialized;
6206
+ /** @hidden @internal */
6207
+ _inProcess; // used in defaultPropertyInterceptor for temp storage.
6208
+ /** @hidden @internal */
6209
+ _inProcessEntity; // used in EntityManager
6210
+ /** @hidden @internal */
6211
+ static _nullInstance = new EntityAspect(); // TODO: determine if this works
5975
6212
  /** @hidden @internal */
5976
6213
  constructor(entity) {
5977
6214
  // if called without new
5978
6215
  // if (!(this instanceof EntityAspect)) {
5979
6216
  // return new EntityAspect(entity);
5980
6217
  // }
5981
- /**
5982
- Sets the entity to an EntityState of 'Unchanged'. This is also the equivalent of calling [[EntityAspect.acceptChanges]].
5983
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
5984
- > // assume order is an order entity attached to an EntityManager.
5985
- > order.entityAspect.setUnchanged();
5986
- > // The 'order' entity will now be in an 'Unchanged' state with any changes committed.
5987
- **/
5988
- this.setUnchanged = function () {
5989
- return this.setEntityState(EntityState.Unchanged);
5990
- };
5991
- /**
5992
- Sets the entity to an EntityState of 'Modified'. This can also be achieved by changing the value of any property on an 'Unchanged' entity.
5993
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
5994
- > // assume order is an order entity attached to an EntityManager.
5995
- > order.entityAspect.setModified();
5996
- > // The 'order' entity will now be in a 'Modified' state.
5997
- **/
5998
- this.setModified = function () {
5999
- return this.setEntityState(EntityState.Modified);
6000
- };
6001
- /**
6002
- Sets the entity to an EntityState of 'Deleted'. This both marks the entity as being scheduled for deletion during the next 'Save' call
6003
- but also removes the entity from all of its related entities. If the current entityState is 'Added', then `setDeleted()` will mark it 'Detached'
6004
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
6005
- > // assume order is an order entity attached to an EntityManager.
6006
- > order.entityAspect.setDeleted();
6007
- > // The 'order' entity will now be in a 'Deleted' state and it will no longer have any 'related' entities.
6008
- **/
6009
- this.setDeleted = function () {
6010
- return this.setEntityState(EntityState.Deleted);
6011
- };
6012
- /**
6013
- 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.
6014
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
6015
- > // assume order is an order entity attached to an EntityManager.
6016
- > order.entityAspect.setDetached();
6017
- > // The 'order' entity will now be in a 'Detached' state and it will no longer have any 'related' entities.
6018
- **/
6019
- this.setDetached = function () {
6020
- return this.setEntityState(EntityState.Detached);
6021
- };
6022
6218
  this.entity = entity;
6023
6219
  // TODO: keep public or not?
6024
6220
  this.entityGroup = undefined;
@@ -6179,6 +6375,47 @@ class EntityAspect {
6179
6375
  return this.setEntityState(EntityState.Added);
6180
6376
  }
6181
6377
  /**
6378
+ Sets the entity to an EntityState of 'Unchanged'. This is also the equivalent of calling [[EntityAspect.acceptChanges]].
6379
+ The same operation can be performed by calling [[EntityAspect.setEntityState]].
6380
+ > // assume order is an order entity attached to an EntityManager.
6381
+ > order.entityAspect.setUnchanged();
6382
+ > // The 'order' entity will now be in an 'Unchanged' state with any changes committed.
6383
+ **/
6384
+ setUnchanged = function () {
6385
+ return this.setEntityState(EntityState.Unchanged);
6386
+ };
6387
+ /**
6388
+ Sets the entity to an EntityState of 'Modified'. This can also be achieved by changing the value of any property on an 'Unchanged' entity.
6389
+ The same operation can be performed by calling [[EntityAspect.setEntityState]].
6390
+ > // assume order is an order entity attached to an EntityManager.
6391
+ > order.entityAspect.setModified();
6392
+ > // The 'order' entity will now be in a 'Modified' state.
6393
+ **/
6394
+ setModified = function () {
6395
+ return this.setEntityState(EntityState.Modified);
6396
+ };
6397
+ /**
6398
+ Sets the entity to an EntityState of 'Deleted'. This both marks the entity as being scheduled for deletion during the next 'Save' call
6399
+ but also removes the entity from all of its related entities. If the current entityState is 'Added', then `setDeleted()` will mark it 'Detached'
6400
+ The same operation can be performed by calling [[EntityAspect.setEntityState]].
6401
+ > // assume order is an order entity attached to an EntityManager.
6402
+ > order.entityAspect.setDeleted();
6403
+ > // The 'order' entity will now be in a 'Deleted' state and it will no longer have any 'related' entities.
6404
+ **/
6405
+ setDeleted = function () {
6406
+ return this.setEntityState(EntityState.Deleted);
6407
+ };
6408
+ /**
6409
+ 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.
6410
+ The same operation can be performed by calling [[EntityAspect.setEntityState]].
6411
+ > // assume order is an order entity attached to an EntityManager.
6412
+ > order.entityAspect.setDetached();
6413
+ > // The 'order' entity will now be in a 'Detached' state and it will no longer have any 'related' entities.
6414
+ **/
6415
+ setDetached = function () {
6416
+ return this.setEntityState(EntityState.Detached);
6417
+ };
6418
+ /**
6182
6419
  Sets the entity to the specified EntityState. See also 'setUnchanged', 'setModified', 'setDetached', etc.
6183
6420
  > // assume order is an order entity attached to an EntityManager.
6184
6421
  > order.entityAspect.setEntityState(EntityState.Unchanged);
@@ -6195,12 +6432,12 @@ class EntityAspect {
6195
6432
  let em = this.entityManager;
6196
6433
  let needsSave = true;
6197
6434
  if (entityState === EntityState.Unchanged) {
6198
- clearOriginalValues(entity);
6435
+ clearOriginalValues$1(entity);
6199
6436
  delete this.hasTempKey;
6200
6437
  needsSave = false;
6201
6438
  }
6202
6439
  else if (entityState === EntityState.Added) {
6203
- clearOriginalValues(entity);
6440
+ clearOriginalValues$1(entity);
6204
6441
  // TODO: more to do here... like regenerating key ???
6205
6442
  }
6206
6443
  else if (entityState === EntityState.Deleted) {
@@ -6541,8 +6778,6 @@ class EntityAspect {
6541
6778
  }
6542
6779
  }
6543
6780
  }
6544
- /** @hidden @internal */
6545
- EntityAspect._nullInstance = new EntityAspect(); // TODO: determine if this works
6546
6781
  BreezeEvent.bubbleEvent(EntityAspect.prototype, function () {
6547
6782
  return this.entityManager;
6548
6783
  });
@@ -6676,6 +6911,17 @@ entity via either a query, import or EntityManager.createEntity call.
6676
6911
  > // aCustomer === aspect.parent;
6677
6912
  **/
6678
6913
  class ComplexAspect {
6914
+ /** The complex object that this aspect is associated with. __Read Only__ */
6915
+ complexObject;
6916
+ /** The 'original values' of this complex object where they are different from the 'current values'.
6917
+ This is a map where the key is a property name and the value is the 'original value' of the property.
6918
+ __Read Only__ */
6919
+ originalValues;
6920
+ /** The parent object that to which this aspect belongs; this will either be an entity or another complex object. __Read Only__ */
6921
+ parent;
6922
+ /** The [[DataProperty]] on the 'parent' that contains this complex object. __Read Only__ */
6923
+ parentProperty;
6924
+ extraMetadata;
6679
6925
  /** You will rarely, if ever, create a ComplexAspect directly. */
6680
6926
  constructor(complexObject, parent, parentProperty) {
6681
6927
  if (!complexObject) {
@@ -6735,18 +6981,18 @@ class ComplexAspect {
6735
6981
  return aspect.getPropertyPath(this.parentProperty.name + "." + propName);
6736
6982
  }
6737
6983
  }
6738
- function clearOriginalValues(target) {
6984
+ function clearOriginalValues$1(target) {
6739
6985
  let aspect = target.entityAspect || target.complexAspect;
6740
6986
  aspect.originalValues = {};
6741
6987
  let stype = target.entityType || target.complexType;
6742
6988
  stype.complexProperties.forEach(function (cp) {
6743
6989
  let cos = target.getProperty(cp.name);
6744
6990
  if (cp.isScalar) {
6745
- clearOriginalValues(cos);
6991
+ clearOriginalValues$1(cos);
6746
6992
  }
6747
6993
  else {
6748
6994
  cos._acceptChanges();
6749
- cos.forEach(clearOriginalValues);
6995
+ cos.forEach(clearOriginalValues$1);
6750
6996
  }
6751
6997
  });
6752
6998
  }
@@ -6759,6 +7005,14 @@ The default NamingConvention does not perform any translation, it simply passes
6759
7005
  @dynamic
6760
7006
  **/
6761
7007
  class NamingConvention {
7008
+ /** @hidden @internal */
7009
+ _$typeName;
7010
+ /** The name of this NamingConvention. __Read Only__ */
7011
+ name;
7012
+ /** Function that takes a server property name add converts it into a client side property name. __Read Only__ */
7013
+ serverPropertyNameToClient;
7014
+ /** Function that takes a client property name add converts it into a server side property name. __Read Only__ */
7015
+ clientPropertyNameToServer;
6762
7016
  /**
6763
7017
  NamingConvention constructor
6764
7018
  > // A naming convention that converts the first character of every property name to uppercase on the server
@@ -6786,6 +7040,38 @@ class NamingConvention {
6786
7040
  config._storeObject(this, "NamingConvention", this.name);
6787
7041
  }
6788
7042
  /**
7043
+
7044
+
7045
+ /**
7046
+ A noop naming convention - This is the default unless another is specified.
7047
+ **/
7048
+ static none = new NamingConvention({
7049
+ name: "noChange",
7050
+ serverPropertyNameToClient: (serverPropertyName) => {
7051
+ return serverPropertyName;
7052
+ },
7053
+ clientPropertyNameToServer: (clientPropertyName) => {
7054
+ return clientPropertyName;
7055
+ }
7056
+ });
7057
+ /**
7058
+ The "camelCase" naming convention - This implementation only lowercases the first character of the server property name
7059
+ but leaves the rest of the property name intact. If a more complicated version is needed then one should be created via the ctor.
7060
+ **/
7061
+ static camelCase = new NamingConvention({
7062
+ name: "camelCase",
7063
+ serverPropertyNameToClient: (serverPropertyName) => {
7064
+ return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);
7065
+ },
7066
+ clientPropertyNameToServer: (clientPropertyName) => {
7067
+ return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);
7068
+ }
7069
+ });
7070
+ /**
7071
+ The default value whenever NamingConventions are not specified.
7072
+ **/
7073
+ static defaultInstance = new NamingConvention(NamingConvention.none);
7074
+ /**
6789
7075
  Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
6790
7076
  The current instance is returned unchanged.
6791
7077
  > var namingConv = new NamingConvention({
@@ -6798,42 +7084,10 @@ class NamingConvention {
6798
7084
  > });
6799
7085
  > namingConv.setAsDefault();
6800
7086
  **/
6801
- setAsDefault() {
6802
- return core.setAsDefault(this, NamingConvention);
6803
- }
6804
- }
6805
- /**
6806
-
6807
-
6808
- /**
6809
- A noop naming convention - This is the default unless another is specified.
6810
- **/
6811
- NamingConvention.none = new NamingConvention({
6812
- name: "noChange",
6813
- serverPropertyNameToClient: (serverPropertyName) => {
6814
- return serverPropertyName;
6815
- },
6816
- clientPropertyNameToServer: (clientPropertyName) => {
6817
- return clientPropertyName;
6818
- }
6819
- });
6820
- /**
6821
- The "camelCase" naming convention - This implementation only lowercases the first character of the server property name
6822
- but leaves the rest of the property name intact. If a more complicated version is needed then one should be created via the ctor.
6823
- **/
6824
- NamingConvention.camelCase = new NamingConvention({
6825
- name: "camelCase",
6826
- serverPropertyNameToClient: (serverPropertyName) => {
6827
- return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);
6828
- },
6829
- clientPropertyNameToServer: (clientPropertyName) => {
6830
- return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);
7087
+ setAsDefault() {
7088
+ return core.setAsDefault(this, NamingConvention);
6831
7089
  }
6832
- });
6833
- /**
6834
- The default value whenever NamingConventions are not specified.
6835
- **/
6836
- NamingConvention.defaultInstance = new NamingConvention(NamingConvention.none);
7090
+ }
6837
7091
  NamingConvention.prototype._$typeName = "NamingConvention";
6838
7092
 
6839
7093
  const RX_COLLECTION = /Collection\((.*)\)/;
@@ -7226,6 +7480,16 @@ The default LocalQueryComparisonOptions stipulates 'caseInsensitive" queries wit
7226
7480
  length strings.
7227
7481
  **/
7228
7482
  class LocalQueryComparisonOptions {
7483
+ /** @hidden @internal */
7484
+ _$typeName; // on prototype
7485
+ /** The name for this instance. */
7486
+ name;
7487
+ /** Whether predicates that involve strings will be interpreted in a "caseSensitive" manner. (default = false). */
7488
+ isCaseSensitive;
7489
+ /* Whether or not to enforce the ANSI SQL standard
7490
+ of padding strings of unequal lengths before comparison with spaces. Note that per the standard, padding only occurs with equality and
7491
+ inequality predicates, and not with operations like 'startsWith', 'endsWith' or 'contains'. Default is true. */
7492
+ usesSql92CompliantStringComparison;
7229
7493
  /**
7230
7494
  LocalQueryComparisonOptions constructor
7231
7495
  > // create a 'caseSensitive - non SQL' instance.
@@ -7253,6 +7517,18 @@ class LocalQueryComparisonOptions {
7253
7517
  config._storeObject(this, "LocalQueryComparisonOptions", this.name);
7254
7518
  }
7255
7519
  /**
7520
+ Case insensitive SQL compliant options - this is also the default unless otherwise changed.
7521
+ **/
7522
+ static caseInsensitiveSQL = new LocalQueryComparisonOptions({
7523
+ name: "caseInsensitiveSQL",
7524
+ isCaseSensitive: false,
7525
+ usesSql92CompliantStringComparison: true
7526
+ });
7527
+ /**
7528
+ The default value whenever LocalQueryComparisonOptions are not specified. By default this is 'caseInsensitiveSQL'.
7529
+ **/
7530
+ static defaultInstance = new LocalQueryComparisonOptions(LocalQueryComparisonOptions.caseInsensitiveSQL);
7531
+ /**
7256
7532
  Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
7257
7533
  The current instance is returned unchanged.
7258
7534
  > var lqco = new LocalQueryComparisonOptions({
@@ -7265,18 +7541,6 @@ class LocalQueryComparisonOptions {
7265
7541
  return core.setAsDefault(this, LocalQueryComparisonOptions);
7266
7542
  }
7267
7543
  }
7268
- /**
7269
- Case insensitive SQL compliant options - this is also the default unless otherwise changed.
7270
- **/
7271
- LocalQueryComparisonOptions.caseInsensitiveSQL = new LocalQueryComparisonOptions({
7272
- name: "caseInsensitiveSQL",
7273
- isCaseSensitive: false,
7274
- usesSql92CompliantStringComparison: true
7275
- });
7276
- /**
7277
- The default value whenever LocalQueryComparisonOptions are not specified. By default this is 'caseInsensitiveSQL'.
7278
- **/
7279
- LocalQueryComparisonOptions.defaultInstance = new LocalQueryComparisonOptions(LocalQueryComparisonOptions.caseInsensitiveSQL);
7280
7544
  LocalQueryComparisonOptions.prototype._$typeName = "LocalQueryComparisonOptions";
7281
7545
 
7282
7546
  /** @hidden @internal */
@@ -7740,6 +8004,52 @@ explicit MetadataStore, the MetadataStore from the MetadataStore.defaultInstance
7740
8004
  @dynamic
7741
8005
  **/
7742
8006
  class MetadataStore {
8007
+ /** @hidden @internal */
8008
+ static __id = 0;
8009
+ /** @hidden @internal */
8010
+ static ANONTYPE_PREFIX = "_IB_";
8011
+ /** The version of any MetadataStores created by this class */
8012
+ static metadataVersion = '1.0.5';
8013
+ name;
8014
+ dataServices;
8015
+ /** The [[NamingConvention]] associated with this MetadataStore. __Read Only__ */
8016
+ namingConvention;
8017
+ /** The [[LocalQueryComparisonOptions]] associated with this MetadataStore. __Read Only__ */
8018
+ localQueryComparisonOptions;
8019
+ serializerFn;
8020
+ /**
8021
+ An [[BreezeEvent]] that fires after a MetadataStore has completed fetching metadata from a remote service.
8022
+
8023
+ @eventArgs -
8024
+ - metadataStore - The MetadataStore into which the metadata was fetched.
8025
+ - dataService - The [[DataService]] that metadata was fetched from.
8026
+ - rawMetadata - {Object} The raw metadata returned from the service. (It will have already been processed by this point).
8027
+ > let ms = myEntityManager.metadataStore;
8028
+ > ms.metadataFetched.subscribe(function(args) {
8029
+ > let metadataStore = args.metadataStore;
8030
+ > let dataService = args.dataService;
8031
+ > });
8032
+ @event
8033
+ **/
8034
+ metadataFetched;
8035
+ /** @hidden @internal */
8036
+ _resourceEntityTypeMap;
8037
+ /** @hidden @internal */
8038
+ _entityTypeResourceMap;
8039
+ /** @hidden @internal key is qualified structuraltype name - value is structuralType. ( structural = entityType or complexType). */
8040
+ _structuralTypeMap;
8041
+ /** @hidden @internal key is shortName, value is qualified name - does not need to be serialized. **/
8042
+ _shortNameMap;
8043
+ /** @hidden @internal key is either short or qual type name - value is ctor; **/
8044
+ _ctorRegistry;
8045
+ /** @hidden @internal key is entityTypeName; value is array of nav props **/
8046
+ _incompleteTypeMap;
8047
+ /** @hidden @internal **/
8048
+ _incompleteComplexTypeMap;
8049
+ /** @hidden @internal { json: any, stype: StructuralType }[] | { entityType: EntityType, csdlEntityType: any }[] **/
8050
+ _deferredTypes;
8051
+ /** @hidden @internal **/
8052
+ _id;
7743
8053
  /**
7744
8054
  Constructs a new MetadataStore.
7745
8055
 
@@ -7779,6 +8089,10 @@ class MetadataStore {
7779
8089
  this._id = MetadataStore.__id++;
7780
8090
  this.metadataFetched = new BreezeEvent("metadataFetched", this);
7781
8091
  }
8092
+ // needs to be made avail to dataService.xxx files
8093
+ static normalizeTypeName = core.memoize(function (rawTypeName) {
8094
+ return rawTypeName && MetadataStore.parseTypeName(rawTypeName).typeName;
8095
+ });
7782
8096
  // for debugging use the line below instead.
7783
8097
  //ctor.normalizeTypeName = function (rawTypeName) { return parseTypeName(rawTypeName).typeName; };
7784
8098
  /**
@@ -8309,16 +8623,6 @@ class MetadataStore {
8309
8623
  }
8310
8624
  }
8311
8625
  }
8312
- /** @hidden @internal */
8313
- MetadataStore.__id = 0;
8314
- /** @hidden @internal */
8315
- MetadataStore.ANONTYPE_PREFIX = "_IB_";
8316
- /** The version of any MetadataStores created by this class */
8317
- MetadataStore.metadataVersion = '1.0.5';
8318
- // needs to be made avail to dataService.xxx files
8319
- MetadataStore.normalizeTypeName = core.memoize(function (rawTypeName) {
8320
- return rawTypeName && MetadataStore.parseTypeName(rawTypeName).typeName;
8321
- });
8322
8626
  MetadataStore.prototype._$typeName = "MetadataStore";
8323
8627
  BreezeEvent.bubbleEvent(MetadataStore.prototype);
8324
8628
  function getTypesFromMap(typeMap) {
@@ -8437,6 +8741,76 @@ function getQualifiedTypeName(metadataStore, structTypeName, throwIfNotFound) {
8437
8741
  /** Container for all of the metadata about a specific type of Entity.
8438
8742
  **/
8439
8743
  class EntityType {
8744
+ /** @hidden @internal */
8745
+ static __nextAnonIx = 0;
8746
+ /** Always false for an EntityType. **/
8747
+ isComplexType = false;
8748
+ /** The [[MetadataStore]] that contains this EntityType. __Read Only__ **/
8749
+ metadataStore;
8750
+ /** The DataProperties (see [[DataProperty]] associated with this EntityType. __Read Only__ **/
8751
+ dataProperties;
8752
+ /** The NavigationProperties (see [[NavigationProperty]] associated with this EntityType. __Read Only__ **/
8753
+ navigationProperties;
8754
+ /**
8755
+ The DataProperties associated with this EntityType that make up it's [[EntityKey]]. __Read Only__ **/
8756
+ keyProperties;
8757
+ /** The DataProperties associated with this EntityType that are foreign key properties. __Read Only__ **/
8758
+ foreignKeyProperties;
8759
+ inverseForeignKeyProperties;
8760
+ /** The DataProperties associated with this EntityType that are concurrency properties. __Read Only__ **/
8761
+ concurrencyProperties;
8762
+ /** The DataProperties for this EntityType that contain instances of a [[ComplexType]]. __Read Only__ **/
8763
+ complexProperties;
8764
+ /** The DataProperties associated with this EntityType that are not mapped to any backend datastore. These are effectively free standing
8765
+ properties. __Read Only__ **/
8766
+ unmappedProperties;
8767
+ /** The fully qualified name of this EntityType. __Read Only__ **/
8768
+ name;
8769
+ /** The short, unqualified, name for this EntityType. __Read Only__ **/
8770
+ shortName;
8771
+ /** The namespace for this EntityType. __Read Only__ **/
8772
+ namespace;
8773
+ /** The name of this EntityType's base EntityType (if any) */
8774
+ baseTypeName;
8775
+ /** The base EntityType (if any) for this EntityType. __Read Only__ **/
8776
+ baseEntityType;
8777
+ subtypes;
8778
+ /** Whether this EntityType is abstract. __Read Only__ **/
8779
+ isAbstract;
8780
+ /** Whether this EntityType is anonymous. Anonymous types will never be communicated to or from the server. They are purely for
8781
+ client side use and are given an automatically generated name. __Read Only__ **/
8782
+ isAnonymous;
8783
+ /** Whether this EntityType has been 'frozen'. EntityTypes become frozen after the first instance
8784
+ of that type has been created and attached to an EntityManager. */
8785
+ isFrozen;
8786
+ /** The [[AutoGeneratedKeyType]] for this EntityType. __Read Only__ **/
8787
+ autoGeneratedKeyType;
8788
+ /** The default resource name associated with this EntityType. An EntityType may be queried via a variety of 'resource names' but this one
8789
+ is used as the default when no resource name is provided. This will occur when calling [[EntityAspect.loadNavigationProperty]]
8790
+ or when executing any [[EntityQuery]] that was created via an [[EntityKey]]. __Read Only__ **/
8791
+ defaultResourceName;
8792
+ /** A function that is used to customize the serialization of any EntityProperties of this type. */
8793
+ serializerFn;
8794
+ /** A free form object that can be used to define any custom metadata for this EntityType. __Read Only__ **/
8795
+ custom;
8796
+ /** The entity level validators associated with this EntityType. Validators can be added and
8797
+ removed from this collection. __Read Only__. **/
8798
+ validators;
8799
+ warnings;
8800
+ initFn;
8801
+ noTrackingFn;
8802
+ /** @hidden @internal */
8803
+ _extra;
8804
+ /** @hidden @internal */
8805
+ _ctor;
8806
+ /** @hidden @internal */
8807
+ _mappedPropertiesCount;
8808
+ /**
8809
+ @deprecated Use [[getCtor]] instead.
8810
+ */
8811
+ getEntityCtor = this.getCtor;
8812
+ /** @hidden @internal */
8813
+ static qualifyTypeName = qualifyTypeName;
8440
8814
  /** EntityType constructor
8441
8815
  > let entityType = new EntityType( {
8442
8816
  > shortName: "person",
@@ -8447,12 +8821,6 @@ class EntityType {
8447
8821
  client side use and will be given an automatically generated name. Normally, however, you will use a configuration object.
8448
8822
  **/
8449
8823
  constructor(config) {
8450
- /** Always false for an EntityType. **/
8451
- this.isComplexType = false;
8452
- /**
8453
- @deprecated Use [[getCtor]] instead.
8454
- */
8455
- this.getEntityCtor = this.getCtor;
8456
8824
  if (arguments.length > 1) {
8457
8825
  throw new Error("The EntityType ctor has a single argument that is either a 'MetadataStore' or a configuration object.");
8458
8826
  }
@@ -9104,10 +9472,6 @@ class EntityType {
9104
9472
  delete incompleteTypeMap[this.name];
9105
9473
  }
9106
9474
  }
9107
- /** @hidden @internal */
9108
- EntityType.__nextAnonIx = 0;
9109
- /** @hidden @internal */
9110
- EntityType.qualifyTypeName = qualifyTypeName;
9111
9475
  EntityType.prototype._$typeName = "EntityType";
9112
9476
  function getRawValueFromConfig(rawEntity, dp) {
9113
9477
  // 'true' fork can happen if an initializer contains an actaul instance of an already created complex object.
@@ -9246,33 +9610,66 @@ function calcUnmappedProperties(stype, instance) {
9246
9610
  @param config - Configuration settings
9247
9611
  **/
9248
9612
  class ComplexType {
9613
+ /** For polymorphic purpose only - always true here */
9614
+ isComplexType = true;
9615
+ /** The [[MetadataStore]] containing this ComplexType. */
9616
+ metadataStore;
9617
+ /** The fully qualifed name of this ComplexType. __Read Only__ **/
9618
+ name;
9619
+ /** The short, unqualified, name for this ComplexType. __Read Only__ **/
9620
+ shortName;
9621
+ /** The namespace for this ComplexType. __Read Only__ **/
9622
+ namespace;
9623
+ /** The DataProperties (see [[DataProperty]] associated with this ComplexType. __Read Only__ */
9624
+ dataProperties;
9625
+ /** The DataProperties for this ComplexType that contain instances of a [[ComplexType]]. __Read Only__ */
9626
+ complexProperties;
9627
+ /**
9628
+ The entity level validators associated with this ComplexType. Validators can be added and
9629
+ removed from this collection. __Read Only__ **/
9630
+ validators;
9631
+ /** For polymorphic purpose only - always empty here */
9632
+ concurrencyProperties;
9633
+ /** The DataProperties associated with this ComplexType that are not mapped to any backend datastore. These are effectively free standing
9634
+ properties. __Read Only__ **/
9635
+ unmappedProperties;
9636
+ // keyProperties and navigationProperties are not used on complexTypes - but here to allow sharing of code between EntityType and ComplexType.
9637
+ navigationProperties;
9638
+ // and may be used later to enforce uniqueness on arrays of complextypes.
9639
+ keyProperties;
9640
+ warnings;
9641
+ serializerFn;
9642
+ /** A free form object that can be used to define any custom metadata for this ComplexType. ***/
9643
+ custom;
9644
+ /** @hidden @internal */
9645
+ _mappedPropertiesCount;
9646
+ /** @hidden @internal */
9647
+ _extra;
9648
+ // copy entityType methods onto complexType
9649
+ /** See [[EntityType.getCtor]] */
9650
+ getCtor = EntityType.prototype.getCtor;
9651
+ // note the name change.
9652
+ createInstance = EntityType.prototype.createEntity;
9653
+ /** See [EntityType.addValidator] */
9654
+ addValidator = EntityType.prototype.addValidator;
9655
+ getProperty = EntityType.prototype.getProperty;
9656
+ getPropertiesOnPath = EntityType.prototype.getPropertiesOnPath;
9657
+ getPropertyNames = EntityType.prototype.getPropertyNames;
9658
+ /** @hidden @internal */
9659
+ _addPropertyCore = EntityType.prototype._addPropertyCore;
9660
+ /** @hidden @internal */
9661
+ _addDataProperty = EntityType.prototype._addDataProperty;
9662
+ /** @hidden @internal */
9663
+ _updateNames = EntityType.prototype._updateNames;
9664
+ /** @hidden @internal */
9665
+ _updateCps = EntityType.prototype._updateCps;
9666
+ /** @hidden @internal */
9667
+ _initializeInstance = EntityType.prototype._initializeInstance;
9668
+ /** @hidden @internal */
9669
+ _updateTargetFromRaw = EntityType.prototype._updateTargetFromRaw;
9670
+ /** @hidden @internal */
9671
+ _setCtor = EntityType.prototype._setCtor;
9249
9672
  constructor(config) {
9250
- /** For polymorphic purpose only - always true here */
9251
- this.isComplexType = true;
9252
- // copy entityType methods onto complexType
9253
- /** See [[EntityType.getCtor]] */
9254
- this.getCtor = EntityType.prototype.getCtor;
9255
- // note the name change.
9256
- this.createInstance = EntityType.prototype.createEntity;
9257
- /** See [EntityType.addValidator] */
9258
- this.addValidator = EntityType.prototype.addValidator;
9259
- this.getProperty = EntityType.prototype.getProperty;
9260
- this.getPropertiesOnPath = EntityType.prototype.getPropertiesOnPath;
9261
- this.getPropertyNames = EntityType.prototype.getPropertyNames;
9262
- /** @hidden @internal */
9263
- this._addPropertyCore = EntityType.prototype._addPropertyCore;
9264
- /** @hidden @internal */
9265
- this._addDataProperty = EntityType.prototype._addDataProperty;
9266
- /** @hidden @internal */
9267
- this._updateNames = EntityType.prototype._updateNames;
9268
- /** @hidden @internal */
9269
- this._updateCps = EntityType.prototype._updateCps;
9270
- /** @hidden @internal */
9271
- this._initializeInstance = EntityType.prototype._initializeInstance;
9272
- /** @hidden @internal */
9273
- this._updateTargetFromRaw = EntityType.prototype._updateTargetFromRaw;
9274
- /** @hidden @internal */
9275
- this._setCtor = EntityType.prototype._setCtor;
9276
9673
  if (arguments.length > 1) {
9277
9674
  throw new Error("The ComplexType ctor has a single argument that is a configuration object.");
9278
9675
  }
@@ -9353,6 +9750,10 @@ Instances of the DataProperty class are constructed automatically during Metadat
9353
9750
  directly via the constructor.
9354
9751
  **/
9355
9752
  class DataProperty {
9753
+ /** Is this a DataProperty? - always true here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9754
+ isDataProperty = true;
9755
+ /** Is this a NavigationProperty? - always false here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9756
+ isNavigationProperty = false;
9356
9757
  /** DataProperty constructor
9357
9758
  > let lastNameProp = new DataProperty( {
9358
9759
  > name: "lastName",
@@ -9365,10 +9766,6 @@ class DataProperty {
9365
9766
  @param config - A configuration Object or a DataProperty
9366
9767
  */
9367
9768
  constructor(config) {
9368
- /** Is this a DataProperty? - always true here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9369
- this.isDataProperty = true;
9370
- /** Is this a NavigationProperty? - always false here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9371
- this.isNavigationProperty = false;
9372
9769
  assertConfig(config)
9373
9770
  .whereParam("name").isString().isOptional()
9374
9771
  .whereParam("nameOnServer").isString().isOptional()
@@ -9532,6 +9929,15 @@ Instances of the NavigationProperty class are constructed automatically during M
9532
9929
  directly via the constructor.
9533
9930
  **/
9534
9931
  class NavigationProperty {
9932
+ /** Is this a DataProperty? - always false here
9933
+ Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9934
+ isDataProperty = false;
9935
+ /** Is this a NavigationProperty? - always true here
9936
+ Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9937
+ isNavigationProperty = true;
9938
+ formatName = DataProperty.prototype.formatName;
9939
+ getAllValidators = DataProperty.prototype.getAllValidators;
9940
+ resolveProperty = DataProperty.prototype.resolveProperty;
9535
9941
  /** NavigationProperty constructor
9536
9942
  > let homeAddressProp = new NavigationProperty( {
9537
9943
  > name: "homeAddress",
@@ -9550,15 +9956,6 @@ class NavigationProperty {
9550
9956
  @param config - A configuration object.
9551
9957
  **/
9552
9958
  constructor(config) {
9553
- /** Is this a DataProperty? - always false here
9554
- Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9555
- this.isDataProperty = false;
9556
- /** Is this a NavigationProperty? - always true here
9557
- Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
9558
- this.isNavigationProperty = true;
9559
- this.formatName = DataProperty.prototype.formatName;
9560
- this.getAllValidators = DataProperty.prototype.getAllValidators;
9561
- this.resolveProperty = DataProperty.prototype.resolveProperty;
9562
9959
  assertConfig(config)
9563
9960
  .whereParam("name").isString().isOptional()
9564
9961
  .whereParam("nameOnServer").isString().isOptional()
@@ -9750,24 +10147,24 @@ function resolveRelated(np) {
9750
10147
  AutoGeneratedKeyType is an 'Enum' containing all of the valid states for an automatically generated key.
9751
10148
  **/
9752
10149
  class AutoGeneratedKeyType extends BreezeEnum {
10150
+ /**
10151
+ This entity does not have an autogenerated key.
10152
+ The client must set the key before adding the entity to the EntityManager
10153
+ **/
10154
+ static None = new AutoGeneratedKeyType();
10155
+ /**
10156
+ This entity's key is an Identity column and is set by the backend database.
10157
+ Keys for new entities will be temporary until the entities are saved at which point the keys will
10158
+ be converted to their 'real' versions.
10159
+ **/
10160
+ static Identity = new AutoGeneratedKeyType();
10161
+ /**
10162
+ This entity's key is generated by a KeyGenerator and is set by the backend database.
10163
+ Keys for new entities will be temporary until the entities are saved at which point the keys will
10164
+ be converted to their 'real' versions.
10165
+ **/
10166
+ static KeyGenerator = new AutoGeneratedKeyType();
9753
10167
  }
9754
- /**
9755
- This entity does not have an autogenerated key.
9756
- The client must set the key before adding the entity to the EntityManager
9757
- **/
9758
- AutoGeneratedKeyType.None = new AutoGeneratedKeyType();
9759
- /**
9760
- This entity's key is an Identity column and is set by the backend database.
9761
- Keys for new entities will be temporary until the entities are saved at which point the keys will
9762
- be converted to their 'real' versions.
9763
- **/
9764
- AutoGeneratedKeyType.Identity = new AutoGeneratedKeyType();
9765
- /**
9766
- This entity's key is generated by a KeyGenerator and is set by the backend database.
9767
- Keys for new entities will be temporary until the entities are saved at which point the keys will
9768
- be converted to their 'real' versions.
9769
- **/
9770
- AutoGeneratedKeyType.KeyGenerator = new AutoGeneratedKeyType();
9771
10168
  AutoGeneratedKeyType.prototype._$typeName = "AutoGeneratedKeyType";
9772
10169
  Error['x'] = AutoGeneratedKeyType.resolveSymbols();
9773
10170
  let proto = Param.prototype;
@@ -9833,41 +10230,6 @@ function addProperties(entityType, propObj, ctor) {
9833
10230
  @hidden
9834
10231
  */
9835
10232
  class AbstractDataServiceAdapter {
9836
- constructor() {
9837
- /**
9838
- Returns a constructor function for a "ChangeRequestInterceptor"
9839
- that can tweak the saveBundle both as it is built and when it is completed
9840
- by a concrete DataServiceAdapater.
9841
-
9842
- Initialized with a default, no-op implementation that developers can replace with a
9843
- substantive implementation that changes the individual entity change requests
9844
- or aspects of the entire 'saveBundle' without having to write their own DataService adapters.
9845
- > let adapter = breeze.config.getAdapterInstance('dataService');
9846
- > adapter.changeRequestInterceptor = function (saveContext, saveBundle) {
9847
- > this.getRequest = function (request, entity, index) {
9848
- > // alter the request that the adapter prepared for this entity
9849
- > // based on the entity, saveContext, and saveBundle
9850
- > // e.g., add a custom header or prune the originalValuesMap
9851
- > return request;
9852
- > };
9853
- > this.done = function (requests) {
9854
- > // alter the array of requests representing the entire change-set
9855
- > // based on the saveContext and saveBundle
9856
- > };
9857
- > }
9858
-
9859
- @param saveContext - The BreezeJS "context" for the save operation.
9860
- @param saveBundle - Contains the array of entities-to-be-saved (AKA, the entity change-set).
9861
- @return Constructor for a "ChangeRequestInterceptor".
9862
- **/
9863
- this.changeRequestInterceptor = DefaultChangeRequestInterceptor;
9864
- this.jsonResultsAdapter = new JsonResultsAdapter({
9865
- name: "noop",
9866
- visitNode: function ( /* node, mappingContext, nodeContext */) {
9867
- return {};
9868
- }
9869
- });
9870
- }
9871
10233
  // TODO use interface
9872
10234
  checkForRecomposition(interfaceInitializedArgs) {
9873
10235
  if (interfaceInitializedArgs.interfaceName === "ajax" && interfaceInitializedArgs.isDefault) {
@@ -9918,51 +10280,82 @@ class AbstractDataServiceAdapter {
9918
10280
  });
9919
10281
  return promise;
9920
10282
  }
10283
+ /** Execute the query in the mappingContext using the ajaxImpl. */
9921
10284
  executeQuery(mappingContext) {
9922
10285
  mappingContext.adapter = this;
10286
+ const usePost = mappingContext.query.usePostEnabled;
10287
+ const params = usePost ? this._makeQueryPostParams(mappingContext) : this._makeQueryGetParams(mappingContext);
9923
10288
  let promise = new Promise((resolve, reject) => {
9924
- let url = mappingContext.getUrl();
9925
- let params = {
9926
- type: "GET",
9927
- url: url,
9928
- params: mappingContext.query.parameters,
9929
- dataType: 'json',
9930
- success: function (httpResponse) {
9931
- let data = httpResponse.data;
9932
- try {
9933
- let rData;
9934
- let results = data && (data.results || data.Results);
9935
- if (results) {
9936
- rData = { results: results, inlineCount: data.inlineCount || data.InlineCount,
9937
- httpResponse: httpResponse, query: mappingContext.query };
9938
- }
9939
- else {
9940
- rData = { results: data, httpResponse: httpResponse, query: mappingContext.query };
9941
- }
9942
- resolve(rData);
10289
+ params.success = function (httpResponse) {
10290
+ let data = httpResponse.data;
10291
+ try {
10292
+ let rData;
10293
+ let results = data && (data.results || data.Results);
10294
+ if (results) {
10295
+ rData = { results: results, inlineCount: data.inlineCount || data.InlineCount,
10296
+ httpResponse: httpResponse, query: mappingContext.query };
9943
10297
  }
9944
- catch (e) {
9945
- if (e instanceof Error) {
9946
- reject(e);
9947
- }
9948
- else {
9949
- handleHttpError(reject, httpResponse);
9950
- }
10298
+ else {
10299
+ rData = { results: data, httpResponse: httpResponse, query: mappingContext.query };
9951
10300
  }
9952
- },
9953
- error: function (httpResponse) {
9954
- handleHttpError(reject, httpResponse);
9955
- },
9956
- crossDomain: false
10301
+ resolve(rData);
10302
+ }
10303
+ catch (e) {
10304
+ if (e instanceof Error) {
10305
+ reject(e);
10306
+ }
10307
+ else {
10308
+ handleHttpError(reject, httpResponse);
10309
+ }
10310
+ }
10311
+ };
10312
+ params.error = function (httpResponse) {
10313
+ handleHttpError(reject, httpResponse);
9957
10314
  };
9958
- if (mappingContext.dataService.useJsonp) {
9959
- params.dataType = 'jsonp';
9960
- params.crossDomain = true;
9961
- }
9962
10315
  this.ajaxImpl.ajax(params);
9963
10316
  });
9964
10317
  return promise;
9965
10318
  }
10319
+ /** Set up ajax parameters for query GET. This puts the query into the request querystring in either JSON or OData-style syntax, depending upon the UriBuilder. */
10320
+ _makeQueryGetParams(mappingContext) {
10321
+ const url = mappingContext.getUrl();
10322
+ const params = {
10323
+ type: "GET",
10324
+ url: url,
10325
+ params: mappingContext.query.parameters,
10326
+ dataType: 'json',
10327
+ crossDomain: false,
10328
+ };
10329
+ if (mappingContext.dataService.useJsonp) {
10330
+ params.dataType = 'jsonp';
10331
+ params.crossDomain = true;
10332
+ }
10333
+ return params;
10334
+ }
10335
+ /** Set up ajax parameters for query POST. This put the query into the request body as JSON. */
10336
+ _makeQueryPostParams(mappingContext) {
10337
+ const entityQuery = mappingContext.query;
10338
+ const metadataStore = mappingContext.entityManager.metadataStore;
10339
+ const url = mappingContext.dataService.qualifyUrl(entityQuery.resourceName);
10340
+ let entityType = entityQuery._getFromEntityType(metadataStore, false);
10341
+ if (!entityType) {
10342
+ entityType = new EntityType(metadataStore);
10343
+ }
10344
+ const json = entityQuery.toJSONExt({ entityType: entityType, toNameOnServer: true });
10345
+ json.from = undefined;
10346
+ json.queryOptions = undefined;
10347
+ const params = {
10348
+ type: "POST",
10349
+ url: url,
10350
+ params: mappingContext.query.parameters,
10351
+ dataType: 'json',
10352
+ processData: false,
10353
+ contentType: "application/json; charset=UTF-8",
10354
+ data: JSON.stringify(json),
10355
+ crossDomain: false,
10356
+ };
10357
+ return params;
10358
+ }
9966
10359
  saveChanges(saveContext, saveBundle) {
9967
10360
  let adapter = saveContext.adapter = this;
9968
10361
  let saveBundleSer = adapter._prepareSaveBundle(saveContext, saveBundle);
@@ -10002,6 +10395,33 @@ class AbstractDataServiceAdapter {
10002
10395
  // The implementor should call _createChangeRequestInterceptor
10003
10396
  throw new Error("Need a concrete implementation of _prepareSaveBundle");
10004
10397
  }
10398
+ /**
10399
+ Returns a constructor function for a "ChangeRequestInterceptor"
10400
+ that can tweak the saveBundle both as it is built and when it is completed
10401
+ by a concrete DataServiceAdapater.
10402
+
10403
+ Initialized with a default, no-op implementation that developers can replace with a
10404
+ substantive implementation that changes the individual entity change requests
10405
+ or aspects of the entire 'saveBundle' without having to write their own DataService adapters.
10406
+ > let adapter = breeze.config.getAdapterInstance('dataService');
10407
+ > adapter.changeRequestInterceptor = function (saveContext, saveBundle) {
10408
+ > this.getRequest = function (request, entity, index) {
10409
+ > // alter the request that the adapter prepared for this entity
10410
+ > // based on the entity, saveContext, and saveBundle
10411
+ > // e.g., add a custom header or prune the originalValuesMap
10412
+ > return request;
10413
+ > };
10414
+ > this.done = function (requests) {
10415
+ > // alter the array of requests representing the entire change-set
10416
+ > // based on the saveContext and saveBundle
10417
+ > };
10418
+ > }
10419
+
10420
+ @param saveContext - The BreezeJS "context" for the save operation.
10421
+ @param saveBundle - Contains the array of entities-to-be-saved (AKA, the entity change-set).
10422
+ @return Constructor for a "ChangeRequestInterceptor".
10423
+ **/
10424
+ changeRequestInterceptor = DefaultChangeRequestInterceptor;
10005
10425
  /** @hidden @internal */
10006
10426
  _createChangeRequestInterceptor(saveContext, saveBundle) {
10007
10427
  let adapter = saveContext.adapter;
@@ -10039,6 +10459,12 @@ class AbstractDataServiceAdapter {
10039
10459
  "Likely did not or could not reach server. Is the server running?";
10040
10460
  }
10041
10461
  }
10462
+ jsonResultsAdapter = new JsonResultsAdapter({
10463
+ name: "noop",
10464
+ visitNode: function ( /* node, mappingContext, nodeContext */) {
10465
+ return {};
10466
+ }
10467
+ });
10042
10468
  }
10043
10469
  function handleHttpError(reject, httpResponse, messagePrefix) {
10044
10470
  let err = createError(httpResponse);
@@ -10125,6 +10551,20 @@ A ValidationOptions instance is used to specify the conditions under which valid
10125
10551
 
10126
10552
  */
10127
10553
  class ValidationOptions {
10554
+ /** @hidden @internal */
10555
+ _$typeName; // on proto
10556
+ /** Whether entity and property level validation should occur when entities are attached to the EntityManager
10557
+ other than via a query. (default = true) __Read Only__ */
10558
+ validateOnAttach;
10559
+ /** Whether entity and property level validation should occur before entities are saved.
10560
+ A failed validation will force the save to fail early. (default = true) __Read Only__ */
10561
+ validateOnSave;
10562
+ /** Whether entity and property level validation should occur after entities are queried from a remote server.
10563
+ (default = false) __Read Only__ **/
10564
+ validateOnQuery;
10565
+ /** Whether property level validation should occur after entities are modified.
10566
+ (default = true) __Read Only__ **/
10567
+ validateOnPropertyChange;
10128
10568
  /**
10129
10569
  ValidationOptions constructor
10130
10570
  > var newVo = new ValidationOptions( { validateOnSave: false, validateOnAttach: false });
@@ -10133,7 +10573,7 @@ class ValidationOptions {
10133
10573
  @param config - A configuration object.
10134
10574
  **/
10135
10575
  constructor(config) {
10136
- updateWithConfig$1(this, config);
10576
+ updateWithConfig(this, config);
10137
10577
  }
10138
10578
  /**
10139
10579
  Returns a copy of this ValidationOptions with changes to the specified config properties.
@@ -10146,7 +10586,7 @@ class ValidationOptions {
10146
10586
  if (!config)
10147
10587
  return this;
10148
10588
  let result = new ValidationOptions(this);
10149
- updateWithConfig$1(result, config);
10589
+ updateWithConfig(result, config);
10150
10590
  return result;
10151
10591
  }
10152
10592
  /**
@@ -10159,18 +10599,18 @@ class ValidationOptions {
10159
10599
  setAsDefault() {
10160
10600
  return core.setAsDefault(this, ValidationOptions);
10161
10601
  }
10602
+ /**
10603
+ The default instance for use whenever ValidationOptions are not specified.
10604
+ **/
10605
+ static defaultInstance = new ValidationOptions({
10606
+ validateOnAttach: true,
10607
+ validateOnSave: true,
10608
+ validateOnQuery: false,
10609
+ validateOnPropertyChange: true
10610
+ });
10162
10611
  }
10163
- /**
10164
- The default instance for use whenever ValidationOptions are not specified.
10165
- **/
10166
- ValidationOptions.defaultInstance = new ValidationOptions({
10167
- validateOnAttach: true,
10168
- validateOnSave: true,
10169
- validateOnQuery: false,
10170
- validateOnPropertyChange: true
10171
- });
10172
10612
  ValidationOptions.prototype._$typeName = "ValidationOptions";
10173
- function updateWithConfig$1(options, config) {
10613
+ function updateWithConfig(options, config) {
10174
10614
  if (config) {
10175
10615
  assertConfig(config)
10176
10616
  .whereParam("validateOnAttach").isBoolean().isOptional()
@@ -10186,6 +10626,18 @@ function updateWithConfig$1(options, config) {
10186
10626
  A SaveOptions instance is used to specify the 'options' under which a save will occur.
10187
10627
  **/
10188
10628
  class SaveOptions {
10629
+ /** @hidden @internal */
10630
+ _$typeName; // on proto
10631
+ /** Resource name to be used during the save - this defaults to "SaveChanges". __Read Only__ */
10632
+ resourceName;
10633
+ /** The DataService to be used for this save. __Read Only__ */
10634
+ dataService;
10635
+ /** Whether multiple saves can be in-flight at the same time. The default is false. __Read Only__ */
10636
+ allowConcurrentSaves;
10637
+ /** Free form value that will be sent to the server during the save. __Read Only__ */
10638
+ tag;
10639
+ /** The default value whenever SaveOptions are not specified. */
10640
+ static defaultInstance = new SaveOptions({ allowConcurrentSaves: false });
10189
10641
  constructor(config) {
10190
10642
  SaveOptions._updateWithConfig(this, config);
10191
10643
  }
@@ -10216,14 +10668,14 @@ class SaveOptions {
10216
10668
  return obj;
10217
10669
  }
10218
10670
  }
10219
- /** The default value whenever SaveOptions are not specified. */
10220
- SaveOptions.defaultInstance = new SaveOptions({ allowConcurrentSaves: false });
10221
10671
  SaveOptions.prototype._$typeName = "SaveOptions";
10222
10672
 
10223
10673
  /*
10224
10674
  @class KeyGenerator
10225
10675
  */
10226
10676
  class KeyGenerator {
10677
+ /** @hidden @internal */
10678
+ _tempIdMap;
10227
10679
  constructor() {
10228
10680
  // key is dataProperty.name + || + entityType.name, value is propEntry
10229
10681
  // propEntry = { entityType, propertyName, keyMap }
@@ -10328,6 +10780,11 @@ config.registerType(KeyGenerator, "KeyGenerator");
10328
10780
 
10329
10781
  /** @hidden @internal */
10330
10782
  class EntityGroup {
10783
+ entityManager;
10784
+ entityType;
10785
+ _indexMap;
10786
+ _entities;
10787
+ _emptyIndexes;
10331
10788
  constructor(entityManager, entityType) {
10332
10789
  this.entityManager = entityManager;
10333
10790
  this.entityType = entityType;
@@ -10515,8 +10972,19 @@ For use by breeze plugin authors only. The class is for use in building a [[IDat
10515
10972
  @hidden
10516
10973
  */
10517
10974
  class MappingContext {
10975
+ /** @hidden @internal */
10976
+ _$typeName; // on prototype
10977
+ rawValueFn = DataProperty.getRawValueFromServer; // think about passing this in later.
10978
+ dataService;
10979
+ query;
10980
+ entityManager;
10981
+ mergeOptions;
10982
+ adapter; // assigned in the AbstractDataServiceAdapter.
10983
+ refMap; // TODO
10984
+ deferredFns; // TODO
10985
+ jsonResultsAdapter;
10986
+ metadataStore;
10518
10987
  constructor(config) {
10519
- this.rawValueFn = DataProperty.getRawValueFromServer; // think about passing this in later.
10520
10988
  core.extend(this, config, [
10521
10989
  "query", "entityManager", "dataService", "mergeOptions"
10522
10990
  ]);
@@ -10739,7 +11207,7 @@ function mergeEntity(mc, node, meta) {
10739
11207
  targetEntity.entityAspect.extraMetadata = meta.extraMetadata;
10740
11208
  }
10741
11209
  targetEntity.entityAspect.entityState = EntityState.Unchanged;
10742
- clearOriginalValues$1(targetEntity);
11210
+ clearOriginalValues(targetEntity);
10743
11211
  // propertyName not specified because multiple props EntityChangedEventArgs
10744
11212
  targetEntity.entityAspect.propertyChanged.publish({ entity: targetEntity, propertyName: null });
10745
11213
  let action = isSaving ? EntityAction.MergeOnSave : EntityAction.MergeOnQuery;
@@ -10773,18 +11241,18 @@ function mergeEntity(mc, node, meta) {
10773
11241
  return targetEntity;
10774
11242
  }
10775
11243
  // copied from entityAspect
10776
- function clearOriginalValues$1(target) {
11244
+ function clearOriginalValues(target) {
10777
11245
  let aspect = target.entityAspect || target.complexAspect;
10778
11246
  aspect.originalValues = {};
10779
11247
  let stype = target.entityType || target.complexType;
10780
11248
  stype.complexProperties.forEach(function (cp) {
10781
11249
  let cos = target.getProperty(cp.name);
10782
11250
  if (cp.isScalar) {
10783
- clearOriginalValues$1(cos);
11251
+ clearOriginalValues(cos);
10784
11252
  }
10785
11253
  else {
10786
11254
  cos._acceptChanges();
10787
- cos.forEach(clearOriginalValues$1);
11255
+ cos.forEach(clearOriginalValues);
10788
11256
  }
10789
11257
  });
10790
11258
  }
@@ -10916,10 +11384,8 @@ function updateRelatedEntityInCollection(mc, relatedEntity, relatedEntities, tar
10916
11384
  /** @hidden @internal */
10917
11385
  // Represents entities not yet attached to navigationProperties.
10918
11386
  class UnattachedChildrenMap {
10919
- constructor() {
10920
- // key is EntityKey.toString(), value is array of { navigationProperty, children }
10921
- this.map = {};
10922
- }
11387
+ // key is EntityKey.toString(), value is array of { navigationProperty, children }
11388
+ map = {};
10923
11389
  addChild(parentEntityKey, navigationProperty, child) {
10924
11390
  let tuple = this.getTuple(parentEntityKey, navigationProperty);
10925
11391
  if (!tuple) {
@@ -10974,6 +11440,100 @@ class UnattachedChildrenMap {
10974
11440
  Instances of the EntityManager contain and manage collections of entities, either retrieved from a backend datastore or created on the client.
10975
11441
  **/
10976
11442
  class EntityManager {
11443
+ /** @hidden @internal */
11444
+ _$typeName; // actually defined on prototype
11445
+ /** The service name associated with this EntityManager. __Read Only__ **/
11446
+ serviceName;
11447
+ /** The DataService associated with this EntityManager. __Read Only__ **/
11448
+ dataService;
11449
+ /** The [[QueryOptions]] associated with this EntityManager. __Read Only__ **/
11450
+ queryOptions;
11451
+ /** The [[SaveOptions]] associated with this EntityManager. __Read Only__ **/
11452
+ saveOptions;
11453
+ /** The [[ValidationOptions]] associated with this EntityManager. __Read Only__ **/
11454
+ validationOptions;
11455
+ /** The [[KeyGenerator]] associated with this EntityManager. __Read Only__ **/
11456
+ keyGenerator;
11457
+ /** The [[KeyGenerator]] constructor associated with this EntityManager. __Read Only__ **/
11458
+ keyGeneratorCtor; // TODO: review this
11459
+ /** The [[MetadataStore]] associated with this EntityManager. __Read Only__ **/
11460
+ metadataStore;
11461
+ isLoading;
11462
+ isRejectingChanges;
11463
+ // events
11464
+ /**
11465
+ A [[BreezeEvent]] that fires whenever a change to any entity in this EntityManager occurs. __Read Only__
11466
+
11467
+ @eventArgs -
11468
+ - entityAction - The [[EntityAction]] that occured.
11469
+ - entity - The entity that changed. If this is null, then all entities in the entityManager were affected.
11470
+ - args - Additional information about this event. This will differ based on the entityAction.
11471
+
11472
+ > let em = new EntityManager( {serviceName: "breeze/NorthwindIBModel" });
11473
+ > em.entityChanged.subscribe(function(changeArgs) {
11474
+ > // This code will be executed any time any entity within the entityManager
11475
+ > // is added, modified, deleted or detached for any reason.
11476
+ > let action = changeArgs.entityAction;
11477
+ > let entity = changeArgs.entity;
11478
+ > // .. do something to this entity when it is changed.
11479
+ > });
11480
+ > });
11481
+ @event
11482
+ **/
11483
+ entityChanged;
11484
+ /**
11485
+ An [[BreezeEvent]] that fires whenever validationErrors change for any entity in this EntityManager. __Read Only__
11486
+ @eventArgs -
11487
+ - entity - The entity on which the validation errors have been added or removed.
11488
+ - added - An array containing any newly added [[ValidationError]]s
11489
+ - removed - An array containing any newly removed [[ValidationError]]s. This is those errors that have been 'fixed'
11490
+
11491
+ > let em = new EntityManager( {serviceName: "breeze/NorthwindIBModel" });
11492
+ > em.validationErrorsChanged.subscribe(function(changeArgs) {
11493
+ > // This code will be executed any time any entity within the entityManager experiences a change to its validationErrors collection.
11494
+ > function (validationChangeArgs) {
11495
+ > let entity == validationChangeArgs.entity;
11496
+ > let errorsAdded = validationChangeArgs.added;
11497
+ > let errorsCleared = validationChangeArgs.removed;
11498
+ > // ... do something interesting with the order.
11499
+ > });
11500
+ > });
11501
+ > });
11502
+ @event
11503
+ **/
11504
+ validationErrorsChanged;
11505
+ /**
11506
+ A [[BreezeEvent]] that fires whenever an EntityManager transitions to or from having changes. __Read Only__
11507
+ @eventArgs -
11508
+ - entityManager - The EntityManager whose 'hasChanges' status has changed.
11509
+ - hasChanges - Whether or not this EntityManager has changes.
11510
+
11511
+ > let em = new EntityManager( {serviceName: "breeze/NorthwindIBModel" });
11512
+ > em.hasChangesChanged.subscribe(function(args) {
11513
+ > let hasChangesChanged = args.hasChanges;
11514
+ > let entityManager = args.entityManager;
11515
+ > });
11516
+ > });
11517
+ @event
11518
+ **/
11519
+ hasChangesChanged;
11520
+ /** @hidden @internal */
11521
+ _pendingPubs; // TODO: refine later
11522
+ /** @hidden @internal */
11523
+ _hasChangesAction; // TODO refine later
11524
+ /** @hidden @internal */
11525
+ _hasChanges;
11526
+ /** @hidden @internal */
11527
+ _entityGroupMap;
11528
+ /** @hidden @internal */
11529
+ _unattachedChildrenMap;
11530
+ /** @hidden @internal */
11531
+ _inKeyFixup;
11532
+ helper = {
11533
+ unwrapInstance: unwrapInstance,
11534
+ unwrapOriginalValues: unwrapOriginalValues,
11535
+ unwrapChangedValues: unwrapChangedValues
11536
+ };
10977
11537
  /**
10978
11538
  EntityManager constructor.
10979
11539
 
@@ -11012,11 +11572,6 @@ class EntityManager {
11012
11572
  @param emConfig - Configuration settings or a service name.
11013
11573
  **/
11014
11574
  constructor(emConfig) {
11015
- this.helper = {
11016
- unwrapInstance: unwrapInstance,
11017
- unwrapOriginalValues: unwrapOriginalValues,
11018
- unwrapChangedValues: unwrapChangedValues
11019
- };
11020
11575
  if (arguments.length > 1) {
11021
11576
  throw new Error("The EntityManager ctor has a single optional argument that is either a 'serviceName' or a configuration object.");
11022
11577
  }
@@ -13046,12 +13601,10 @@ function getSerializerFn(stype) {
13046
13601
 
13047
13602
  /** Registers adapters used by Breeze */
13048
13603
  class InterfaceRegistry {
13049
- constructor() {
13050
- this.ajax = new InterfaceDef("ajax");
13051
- this.modelLibrary = new InterfaceDef("modelLibrary");
13052
- this.dataService = new InterfaceDef("dataService");
13053
- this.uriBuilder = new InterfaceDef("uriBuilder");
13054
- }
13604
+ ajax = new InterfaceDef("ajax");
13605
+ modelLibrary = new InterfaceDef("modelLibrary");
13606
+ dataService = new InterfaceDef("dataService");
13607
+ uriBuilder = new InterfaceDef("uriBuilder");
13055
13608
  }
13056
13609
  config.interfaceRegistry = new InterfaceRegistry();
13057
13610
  config._interfaceRegistry = config.interfaceRegistry;
@@ -13082,119 +13635,118 @@ config.initializeAdapterInstances = function (irConfig) {
13082
13635
  return core.objectMap(config, this.initializeAdapterInstance);
13083
13636
  };
13084
13637
 
13085
- const ɵ0$3 = function (...args) {
13086
- if (this._inProgress) {
13087
- return -1;
13088
- }
13089
- let goodAdds = this._getGoodAdds(args);
13090
- if (!goodAdds.length) {
13091
- return this.length;
13092
- }
13093
- this._beforeChange();
13094
- let result;
13095
- let objPrototype = Object.getPrototypeOf(this);
13096
- if (objPrototype.push) {
13097
- result = objPrototype.push.apply(this, goodAdds);
13098
- }
13099
- else {
13100
- result = Array.prototype.push.apply(this, goodAdds);
13101
- }
13102
- processAdds(this, goodAdds);
13103
- return result;
13104
- }, ɵ1$2 = function (...args) {
13105
- if (this._inProgress) {
13106
- return -1;
13107
- }
13108
- let goodAdds = args;
13109
- this._beforeChange();
13110
- let result;
13111
- let objPrototype = Object.getPrototypeOf(this);
13112
- if (objPrototype.push) {
13113
- result = objPrototype.push.apply(this, goodAdds);
13114
- }
13115
- else {
13116
- result = Array.prototype.push.apply(this, goodAdds);
13117
- }
13118
- processAdds(this, goodAdds);
13119
- return result;
13120
- }, ɵ2$1 = function (...args) {
13121
- let goodAdds = this._getGoodAdds(args);
13122
- if (!goodAdds.length) {
13123
- return this.length;
13124
- }
13125
- this._beforeChange();
13126
- let result;
13127
- let objPrototype = Object.getPrototypeOf(this);
13128
- if (objPrototype.unshift) {
13129
- result = objPrototype.unshift.apply(this, goodAdds);
13130
- }
13131
- else {
13132
- result = Array.prototype.unshift.apply(this, goodAdds);
13133
- }
13134
- processAdds(this, goodAdds);
13135
- return result;
13136
- }, ɵ3$1 = function () {
13137
- this._beforeChange();
13138
- let result;
13139
- let objPrototype = Object.getPrototypeOf(this);
13140
- if (objPrototype.pop) {
13141
- result = objPrototype.pop.apply(this);
13142
- }
13143
- else {
13144
- result = Array.prototype.pop.apply(this);
13145
- }
13146
- processRemoves(this, [result]);
13147
- return result;
13148
- }, ɵ4$1 = function () {
13149
- this._beforeChange();
13150
- let result;
13151
- let objPrototype = Object.getPrototypeOf(this);
13152
- if (objPrototype.shift) {
13153
- result = objPrototype.shift.apply(this);
13154
- }
13155
- else {
13156
- result = Array.prototype.shift.apply(this);
13157
- }
13158
- processRemoves(this, [result]);
13159
- return result;
13160
- }, ɵ5$1 = function (...args) {
13161
- let goodAdds = this._getGoodAdds(core.arraySlice(args, 2));
13162
- let newArgs = core.arraySlice(args, 0, 2).concat(goodAdds);
13163
- this._beforeChange();
13164
- let result;
13165
- let objPrototype = Object.getPrototypeOf(this);
13166
- if (objPrototype.splice) {
13167
- result = objPrototype.splice.apply(this, newArgs);
13168
- }
13169
- else {
13170
- result = Array.prototype.splice.apply(this, newArgs);
13171
- }
13172
- processRemoves(this, result);
13173
- if (goodAdds.length) {
13174
- processAdds(this, goodAdds);
13175
- }
13176
- return result;
13177
- }, ɵ6$1 = function () {
13178
- return this.parent.entityAspect || this.parent.complexAspect.getEntityAspect();
13179
- }, ɵ7$1 = function () {
13180
- return this.getEntityAspect();
13181
- }, ɵ8$1 = function () {
13182
- let em = this.getEntityAspect().entityManager;
13183
- return em && em._pendingPubs;
13184
- }, ɵ9$1 = function () {
13185
- // default is to do nothing
13186
- };
13187
13638
  let mixin = {
13188
- push: ɵ0$3,
13189
- _push: ɵ1$2,
13190
- unshift: ɵ2$1,
13191
- pop: ɵ3$1,
13192
- shift: ɵ4$1,
13193
- splice: ɵ5$1,
13194
- getEntityAspect: ɵ6$1,
13195
- _getEventParent: ɵ7$1,
13196
- _getPendingPubs: ɵ8$1,
13197
- _beforeChange: ɵ9$1
13639
+ push: function (...args) {
13640
+ if (this._inProgress) {
13641
+ return -1;
13642
+ }
13643
+ let goodAdds = this._getGoodAdds(args);
13644
+ if (!goodAdds.length) {
13645
+ return this.length;
13646
+ }
13647
+ this._beforeChange();
13648
+ let result;
13649
+ let objPrototype = Object.getPrototypeOf(this);
13650
+ if (objPrototype.push) {
13651
+ result = objPrototype.push.apply(this, goodAdds);
13652
+ }
13653
+ else {
13654
+ result = Array.prototype.push.apply(this, goodAdds);
13655
+ }
13656
+ processAdds$2(this, goodAdds);
13657
+ return result;
13658
+ },
13659
+ _push: function (...args) {
13660
+ if (this._inProgress) {
13661
+ return -1;
13662
+ }
13663
+ let goodAdds = args;
13664
+ this._beforeChange();
13665
+ let result;
13666
+ let objPrototype = Object.getPrototypeOf(this);
13667
+ if (objPrototype.push) {
13668
+ result = objPrototype.push.apply(this, goodAdds);
13669
+ }
13670
+ else {
13671
+ result = Array.prototype.push.apply(this, goodAdds);
13672
+ }
13673
+ processAdds$2(this, goodAdds);
13674
+ return result;
13675
+ },
13676
+ unshift: function (...args) {
13677
+ let goodAdds = this._getGoodAdds(args);
13678
+ if (!goodAdds.length) {
13679
+ return this.length;
13680
+ }
13681
+ this._beforeChange();
13682
+ let result;
13683
+ let objPrototype = Object.getPrototypeOf(this);
13684
+ if (objPrototype.unshift) {
13685
+ result = objPrototype.unshift.apply(this, goodAdds);
13686
+ }
13687
+ else {
13688
+ result = Array.prototype.unshift.apply(this, goodAdds);
13689
+ }
13690
+ processAdds$2(this, goodAdds);
13691
+ return result;
13692
+ },
13693
+ pop: function () {
13694
+ this._beforeChange();
13695
+ let result;
13696
+ let objPrototype = Object.getPrototypeOf(this);
13697
+ if (objPrototype.pop) {
13698
+ result = objPrototype.pop.apply(this);
13699
+ }
13700
+ else {
13701
+ result = Array.prototype.pop.apply(this);
13702
+ }
13703
+ processRemoves$2(this, [result]);
13704
+ return result;
13705
+ },
13706
+ shift: function () {
13707
+ this._beforeChange();
13708
+ let result;
13709
+ let objPrototype = Object.getPrototypeOf(this);
13710
+ if (objPrototype.shift) {
13711
+ result = objPrototype.shift.apply(this);
13712
+ }
13713
+ else {
13714
+ result = Array.prototype.shift.apply(this);
13715
+ }
13716
+ processRemoves$2(this, [result]);
13717
+ return result;
13718
+ },
13719
+ splice: function (...args) {
13720
+ let goodAdds = this._getGoodAdds(core.arraySlice(args, 2));
13721
+ let newArgs = core.arraySlice(args, 0, 2).concat(goodAdds);
13722
+ this._beforeChange();
13723
+ let result;
13724
+ let objPrototype = Object.getPrototypeOf(this);
13725
+ if (objPrototype.splice) {
13726
+ result = objPrototype.splice.apply(this, newArgs);
13727
+ }
13728
+ else {
13729
+ result = Array.prototype.splice.apply(this, newArgs);
13730
+ }
13731
+ processRemoves$2(this, result);
13732
+ if (goodAdds.length) {
13733
+ processAdds$2(this, goodAdds);
13734
+ }
13735
+ return result;
13736
+ },
13737
+ getEntityAspect: function () {
13738
+ return this.parent.entityAspect || this.parent.complexAspect.getEntityAspect();
13739
+ },
13740
+ _getEventParent: function () {
13741
+ return this.getEntityAspect();
13742
+ },
13743
+ _getPendingPubs: function () {
13744
+ let em = this.getEntityAspect().entityManager;
13745
+ return em && em._pendingPubs;
13746
+ },
13747
+ _beforeChange: function () {
13748
+ // default is to do nothing
13749
+ }
13198
13750
  };
13199
13751
  function updateEntityState(obsArray) {
13200
13752
  let entityAspect = obsArray.getEntityAspect();
@@ -13227,14 +13779,14 @@ function initializeParent(obsArray, parent, parentProperty) {
13227
13779
  obsArray.parent = parent;
13228
13780
  obsArray.parentProperty = parentProperty;
13229
13781
  }
13230
- function processAdds(obsArray, adds) {
13782
+ function processAdds$2(obsArray, adds) {
13231
13783
  obsArray._processAdds(adds);
13232
13784
  // this is referencing the name of the method on the complexArray not the name of the event
13233
13785
  //var args = { added: adds };
13234
13786
  //args[obsArray._typeName] = obsArray;
13235
13787
  publish(obsArray, "arrayChanged", { array: obsArray, added: adds });
13236
13788
  }
13237
- function processRemoves(obsArray, removes) {
13789
+ function processRemoves$2(obsArray, removes) {
13238
13790
  obsArray._processRemoves(removes);
13239
13791
  // this is referencing the name of the method on the array not the name of the event
13240
13792
  publish(obsArray, "arrayChanged", { array: obsArray, removed: removes });
@@ -13265,23 +13817,6 @@ const observableArray = {
13265
13817
  initializeParent: initializeParent
13266
13818
  };
13267
13819
 
13268
- const ɵ0$4 = function (callback, errorCallback) {
13269
- let parent = this.parentEntity;
13270
- let query = EntityQuery.fromEntityNavigation(this.parentEntity, this.navigationProperty);
13271
- let em = parent.entityAspect.entityManager;
13272
- return em.executeQuery(query, callback, errorCallback);
13273
- }, ɵ1$3 = function () {
13274
- return this.parentEntity.entityAspect;
13275
- }, ɵ2$2 = function () {
13276
- let em = this.parentEntity.entityAspect.entityManager;
13277
- return em && em._pendingPubs;
13278
- }, ɵ3$2 = function (adds) {
13279
- return getGoodAdds(this, adds);
13280
- }, ɵ4$2 = function (adds) {
13281
- processAdds$1(this, adds);
13282
- }, ɵ5$2 = function (removes) {
13283
- processRemoves$1(this, removes);
13284
- };
13285
13820
  let relationArrayMixin = {
13286
13821
  /**
13287
13822
  Relation arrays are not actually classes, they are objects that mimic arrays. A relation array is collection of
@@ -13318,15 +13853,31 @@ let relationArrayMixin = {
13318
13853
  @param [errorCallback] {Function}
13319
13854
  @return {Promise}
13320
13855
  **/
13321
- load: ɵ0$4,
13322
- _getEventParent: ɵ1$3,
13323
- _getPendingPubs: ɵ2$2,
13856
+ load: function (callback, errorCallback) {
13857
+ let parent = this.parentEntity;
13858
+ let query = EntityQuery.fromEntityNavigation(this.parentEntity, this.navigationProperty);
13859
+ let em = parent.entityAspect.entityManager;
13860
+ return em.executeQuery(query, callback, errorCallback);
13861
+ },
13862
+ _getEventParent: function () {
13863
+ return this.parentEntity.entityAspect;
13864
+ },
13865
+ _getPendingPubs: function () {
13866
+ let em = this.parentEntity.entityAspect.entityManager;
13867
+ return em && em._pendingPubs;
13868
+ },
13324
13869
  // virtual impls
13325
- _getGoodAdds: ɵ3$2,
13326
- _processAdds: ɵ4$2,
13327
- _processRemoves: ɵ5$2
13870
+ _getGoodAdds: function (adds) {
13871
+ return getGoodAdds$1(this, adds);
13872
+ },
13873
+ _processAdds: function (adds) {
13874
+ processAdds$1(this, adds);
13875
+ },
13876
+ _processRemoves: function (removes) {
13877
+ processRemoves$1(this, removes);
13878
+ }
13328
13879
  };
13329
- function getGoodAdds(relationArray, adds) {
13880
+ function getGoodAdds$1(relationArray, adds) {
13330
13881
  let goodAdds = checkForDups(relationArray, adds);
13331
13882
  if (!goodAdds.length) {
13332
13883
  return goodAdds;
@@ -13434,28 +13985,6 @@ function makeRelationArray(arr, parentEntity, navigationProperty) {
13434
13985
  return core.extend(arrX, relationArrayMixin);
13435
13986
  }
13436
13987
 
13437
- const ɵ0$5 = function (adds) {
13438
- return getGoodAdds$1(this, adds);
13439
- }, ɵ1$4 = function () {
13440
- observableArray.updateEntityState(this);
13441
- }, ɵ2$3 = function (adds) {
13442
- processAdds$2(this, adds);
13443
- }, ɵ3$3 = function (removes) {
13444
- processRemoves$2(this, removes);
13445
- }, ɵ4$3 = function () {
13446
- if (!this._origValues)
13447
- return;
13448
- let that = this;
13449
- this.forEach(function (co) {
13450
- clearAspect(co, that);
13451
- });
13452
- this.length = 0;
13453
- this._origValues.forEach(function (co) {
13454
- that.push(co);
13455
- });
13456
- }, ɵ5$3 = function () {
13457
- this._origValues = null;
13458
- };
13459
13988
  let complexArrayMixin = {
13460
13989
  // complexArray will have the following props
13461
13990
  // parent
@@ -13490,22 +14019,43 @@ let complexArrayMixin = {
13490
14019
  @readOnly
13491
14020
  **/
13492
14021
  // virtual impls
13493
- _getGoodAdds: ɵ0$5,
13494
- _beforeChange: ɵ1$4,
13495
- _processAdds: ɵ2$3,
13496
- _processRemoves: ɵ3$3,
13497
- _rejectChanges: ɵ4$3,
13498
- _acceptChanges: ɵ5$3
14022
+ _getGoodAdds: function (adds) {
14023
+ return getGoodAdds(this, adds);
14024
+ },
14025
+ _beforeChange: function () {
14026
+ observableArray.updateEntityState(this);
14027
+ },
14028
+ _processAdds: function (adds) {
14029
+ processAdds(this, adds);
14030
+ },
14031
+ _processRemoves: function (removes) {
14032
+ processRemoves(this, removes);
14033
+ },
14034
+ _rejectChanges: function () {
14035
+ if (!this._origValues)
14036
+ return;
14037
+ let that = this;
14038
+ this.forEach(function (co) {
14039
+ clearAspect(co, that);
14040
+ });
14041
+ this.length = 0;
14042
+ this._origValues.forEach(function (co) {
14043
+ that.push(co);
14044
+ });
14045
+ },
14046
+ _acceptChanges: function () {
14047
+ this._origValues = null;
14048
+ }
13499
14049
  };
13500
14050
  // local functions
13501
- function getGoodAdds$1(complexArray, adds) {
14051
+ function getGoodAdds(complexArray, adds) {
13502
14052
  // remove any that are already added here
13503
14053
  return adds.filter(function (a) {
13504
14054
  // return a.parent !== complexArray.parent; // TODO: check if this is actually a bug in original breezejs ???
13505
14055
  return a.complexAspect == null || a.complexAspect.parent !== complexArray.parent;
13506
14056
  });
13507
14057
  }
13508
- function processAdds$2(complexArray, adds) {
14058
+ function processAdds(complexArray, adds) {
13509
14059
  adds.forEach(function (a) {
13510
14060
  // if (a.parent != null) { // TODO: check if this is actually a bug in original breezejs ???
13511
14061
  if (a.complexAspect && a.complexAspect.parent != null) {
@@ -13514,7 +14064,7 @@ function processAdds$2(complexArray, adds) {
13514
14064
  setAspect(a, complexArray);
13515
14065
  });
13516
14066
  }
13517
- function processRemoves$2(complexArray, removes) {
14067
+ function processRemoves(complexArray, removes) {
13518
14068
  removes.forEach(function (a) {
13519
14069
  clearAspect(a, complexArray);
13520
14070
  });
@@ -13549,28 +14099,6 @@ function makeComplexArray(arr, parent, parentProperty) {
13549
14099
  return core.extend(arrX, complexArrayMixin);
13550
14100
  }
13551
14101
 
13552
- const ɵ0$6 = function (adds) {
13553
- return adds;
13554
- }, ɵ1$5 = function () {
13555
- let entityAspect = this.getEntityAspect();
13556
- if (entityAspect.entityState.isUnchanged()) {
13557
- entityAspect.setModified();
13558
- }
13559
- if (entityAspect.entityState.isModified() && !this._origValues) {
13560
- this._origValues = this.slice(0);
13561
- }
13562
- }, ɵ2$4 = function (adds) {
13563
- // nothing needed
13564
- }, ɵ3$4 = function (removes) {
13565
- // nothing needed;
13566
- }, ɵ4$4 = function () {
13567
- if (!this._origValues)
13568
- return;
13569
- this.length = 0;
13570
- Array.prototype.push.apply(this, this._origValues);
13571
- }, ɵ5$4 = function () {
13572
- this._origValues = null;
13573
- };
13574
14102
  // TODO: mixin impl is not very typesafe
13575
14103
  // Not needed
13576
14104
  // interface IPrimitiveArray extends IObservableArray {
@@ -13612,12 +14140,33 @@ let primitiveArrayMixin = {
13612
14140
  @readOnly
13613
14141
  **/
13614
14142
  // virtual impls
13615
- _getGoodAdds: ɵ0$6,
13616
- _beforeChange: ɵ1$5,
13617
- _processAdds: ɵ2$4,
13618
- _processRemoves: ɵ3$4,
13619
- _rejectChanges: ɵ4$4,
13620
- _acceptChanges: ɵ5$4
14143
+ _getGoodAdds: function (adds) {
14144
+ return adds;
14145
+ },
14146
+ _beforeChange: function () {
14147
+ let entityAspect = this.getEntityAspect();
14148
+ if (entityAspect.entityState.isUnchanged()) {
14149
+ entityAspect.setModified();
14150
+ }
14151
+ if (entityAspect.entityState.isModified() && !this._origValues) {
14152
+ this._origValues = this.slice(0);
14153
+ }
14154
+ },
14155
+ _processAdds: function (adds) {
14156
+ // nothing needed
14157
+ },
14158
+ _processRemoves: function (removes) {
14159
+ // nothing needed;
14160
+ },
14161
+ _rejectChanges: function () {
14162
+ if (!this._origValues)
14163
+ return;
14164
+ this.length = 0;
14165
+ Array.prototype.push.apply(this, this._origValues);
14166
+ },
14167
+ _acceptChanges: function () {
14168
+ this._origValues = null;
14169
+ }
13621
14170
  };
13622
14171
  // local functions
13623
14172
  /** For use by breeze plugin authors only. The class is for use in building a [[IModelLibraryAdapter]] implementation.
@@ -13692,5 +14241,5 @@ if (win) {
13692
14241
  * Generated bundle index. Do not edit.
13693
14242
  */
13694
14243
 
13695
- 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 };
13696
- //# sourceMappingURL=breeze-client.js.map
14244
+ 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 };
14245
+ //# sourceMappingURL=breeze-client.mjs.map