breeze-client 2.2.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +83 -63
  3. package/adapters/abstract-data-service-adapter.d.ts +120 -0
  4. package/adapters/abstract-data-service-adapter.js +395 -0
  5. package/adapters/abstract-data-service-adapter.js.map +1 -0
  6. package/adapters/adapter-ajax-fetch.d.ts +12 -0
  7. package/adapters/adapter-ajax-fetch.js +13 -0
  8. package/adapters/adapter-ajax-fetch.js.map +1 -0
  9. package/{adapter-ajax-post → adapters}/adapter-ajax-post.d.ts +40 -36
  10. package/{fesm2022/breeze-client-adapter-ajax-post.mjs → adapters/adapter-ajax-post.js} +80 -82
  11. package/adapters/adapter-ajax-post.js.map +1 -0
  12. package/{adapter-ajax-fetch → adapters}/adapter-core.d.ts +4 -4
  13. package/{fesm2022/breeze-client-adapter-uri-builder-json.mjs → adapters/adapter-core.js} +48 -91
  14. package/adapters/adapter-core.js.map +1 -0
  15. package/adapters/adapter-data-service-webapi.d.ts +9 -0
  16. package/{fesm2022/breeze-client-adapter-data-service-webapi.mjs → adapters/adapter-data-service-webapi.js} +105 -107
  17. package/adapters/adapter-data-service-webapi.js.map +1 -0
  18. package/adapters/adapter-model-library-backing-store.d.ts +32 -0
  19. package/adapters/adapter-model-library-backing-store.js +321 -0
  20. package/adapters/adapter-model-library-backing-store.js.map +1 -0
  21. package/adapters/adapter-uri-builder-json.d.ts +11 -0
  22. package/adapters/adapter-uri-builder-json.js +40 -0
  23. package/adapters/adapter-uri-builder-json.js.map +1 -0
  24. package/adapters/http.d.ts +52 -0
  25. package/adapters/http.js +202 -0
  26. package/adapters/http.js.map +1 -0
  27. package/angular/adapter-angular-httpclient.d.ts +21 -0
  28. package/angular/adapter-angular-httpclient.js +70 -0
  29. package/angular/adapter-angular-httpclient.js.map +1 -0
  30. package/breeze.d.ts +215 -0
  31. package/breeze.js +141 -0
  32. package/breeze.js.map +1 -0
  33. package/config/config.d.ts +212 -0
  34. package/config/config.js +392 -0
  35. package/config/config.js.map +1 -0
  36. package/config/configure.d.ts +66 -0
  37. package/config/configure.js +46 -0
  38. package/config/configure.js.map +1 -0
  39. package/config/default-adapters.d.ts +1 -0
  40. package/config/default-adapters.js +40 -0
  41. package/config/default-adapters.js.map +1 -0
  42. package/config/interface-registry.d.ts +191 -0
  43. package/config/interface-registry.js +5 -0
  44. package/config/interface-registry.js.map +1 -0
  45. package/{src → core}/assert-param.d.ts +52 -60
  46. package/core/assert-param.js +390 -0
  47. package/core/assert-param.js.map +1 -0
  48. package/core/core.d.ts +285 -0
  49. package/core/core.js +772 -0
  50. package/core/core.js.map +1 -0
  51. package/core/enum.d.ts +116 -0
  52. package/core/enum.js +167 -0
  53. package/core/enum.js.map +1 -0
  54. package/core/event.d.ts +169 -0
  55. package/core/event.js +338 -0
  56. package/core/event.js.map +1 -0
  57. package/entity/array.d.ts +3 -0
  58. package/entity/array.js +4 -0
  59. package/entity/array.js.map +1 -0
  60. package/entity/complex-array.d.ts +17 -0
  61. package/entity/complex-array.js +104 -0
  62. package/entity/complex-array.js.map +1 -0
  63. package/entity/default-property-interceptor.d.ts +1 -0
  64. package/entity/default-property-interceptor.js +496 -0
  65. package/entity/default-property-interceptor.js.map +1 -0
  66. package/{src → entity}/entity-action.d.ts +36 -42
  67. package/entity/entity-action.js +45 -0
  68. package/entity/entity-action.js.map +1 -0
  69. package/entity/entity-aspect.d.ts +457 -0
  70. package/entity/entity-aspect.js +1262 -0
  71. package/entity/entity-aspect.js.map +1 -0
  72. package/entity/entity-base.d.ts +55 -0
  73. package/entity/entity-base.js +41 -0
  74. package/entity/entity-base.js.map +1 -0
  75. package/entity/entity-group.d.ts +1 -0
  76. package/entity/entity-group.js +224 -0
  77. package/entity/entity-group.js.map +1 -0
  78. package/entity/entity-key.d.ts +95 -0
  79. package/entity/entity-key.js +189 -0
  80. package/entity/entity-key.js.map +1 -0
  81. package/{src → entity}/entity-state.d.ts +112 -84
  82. package/entity/entity-state.js +135 -0
  83. package/entity/entity-state.js.map +1 -0
  84. package/entity/key-generator.d.ts +57 -0
  85. package/entity/key-generator.js +155 -0
  86. package/entity/key-generator.js.map +1 -0
  87. package/entity/observable-array.d.ts +25 -0
  88. package/entity/observable-array.js +230 -0
  89. package/entity/observable-array.js.map +1 -0
  90. package/entity/primitive-array.d.ts +12 -0
  91. package/entity/primitive-array.js +71 -0
  92. package/entity/primitive-array.js.map +1 -0
  93. package/entity/relation-array.d.ts +24 -0
  94. package/entity/relation-array.js +176 -0
  95. package/entity/relation-array.js.map +1 -0
  96. package/entity/unattached-children-map.d.ts +1 -0
  97. package/entity/unattached-children-map.js +105 -0
  98. package/entity/unattached-children-map.js.map +1 -0
  99. package/generate-entity-classes.js +1176 -0
  100. package/manager/entity-manager.d.ts +801 -0
  101. package/manager/entity-manager.js +2395 -0
  102. package/manager/entity-manager.js.map +1 -0
  103. package/{src → manager}/save-options.d.ts +48 -42
  104. package/manager/save-options.js +51 -0
  105. package/manager/save-options.js.map +1 -0
  106. package/{src → metadata}/data-service.d.ts +229 -184
  107. package/metadata/data-service.js +246 -0
  108. package/metadata/data-service.js.map +1 -0
  109. package/metadata/data-type.d.ts +122 -0
  110. package/metadata/data-type.js +465 -0
  111. package/metadata/data-type.js.map +1 -0
  112. package/metadata/entity-metadata.d.ts +1193 -0
  113. package/metadata/entity-metadata.js +2502 -0
  114. package/metadata/entity-metadata.js.map +1 -0
  115. package/{src → metadata}/local-query-comparison-options.d.ts +65 -59
  116. package/metadata/local-query-comparison-options.js +69 -0
  117. package/metadata/local-query-comparison-options.js.map +1 -0
  118. package/{src → metadata}/naming-convention.d.ts +75 -72
  119. package/metadata/naming-convention.js +97 -0
  120. package/metadata/naming-convention.js.map +1 -0
  121. package/mixins/mixin-get-entity-graph.d.ts +63 -0
  122. package/{fesm2022/breeze-client-mixin-get-entity-graph.mjs → mixins/mixin-get-entity-graph.js} +331 -253
  123. package/mixins/mixin-get-entity-graph.js.map +1 -0
  124. package/mixins/mixin-save-queuing.d.ts +98 -0
  125. package/{fesm2022/breeze-client-mixin-save-queuing.mjs → mixins/mixin-save-queuing.js} +493 -365
  126. package/mixins/mixin-save-queuing.js.map +1 -0
  127. package/package.json +63 -94
  128. package/query/entity-query.d.ts +521 -0
  129. package/query/entity-query.js +1149 -0
  130. package/query/entity-query.js.map +1 -0
  131. package/{src → query}/mapping-context.d.ts +44 -46
  132. package/query/mapping-context.js +412 -0
  133. package/query/mapping-context.js.map +1 -0
  134. package/query/predicate.d.ts +394 -0
  135. package/query/predicate.js +1294 -0
  136. package/query/predicate.js.map +1 -0
  137. package/query/property-path.d.ts +252 -0
  138. package/query/property-path.js +2 -0
  139. package/query/property-path.js.map +1 -0
  140. package/{src → query}/query-options.d.ts +143 -119
  141. package/query/query-options.js +180 -0
  142. package/query/query-options.js.map +1 -0
  143. package/rxjs/breeze-rxjs.d.ts +72 -0
  144. package/rxjs/breeze-rxjs.js +117 -0
  145. package/rxjs/breeze-rxjs.js.map +1 -0
  146. package/validation/validate.d.ts +583 -0
  147. package/validation/validate.js +961 -0
  148. package/validation/validate.js.map +1 -0
  149. package/{src → validation}/validation-options.d.ts +67 -63
  150. package/validation/validation-options.js +70 -0
  151. package/validation/validation-options.js.map +1 -0
  152. package/adapter-ajax-angularjs/adapter-ajax-angularjs.d.ts +0 -17
  153. package/adapter-ajax-angularjs/adapter-core.d.ts +0 -4
  154. package/adapter-ajax-angularjs/index.d.ts +0 -5
  155. package/adapter-ajax-fetch/adapter-ajax-fetch.d.ts +0 -18
  156. package/adapter-ajax-fetch/index.d.ts +0 -5
  157. package/adapter-ajax-httpclient/adapter-ajax-httpclient.d.ts +0 -13
  158. package/adapter-ajax-httpclient/adapter-core.d.ts +0 -4
  159. package/adapter-ajax-httpclient/index.d.ts +0 -5
  160. package/adapter-ajax-jquery/adapter-ajax-jquery.d.ts +0 -15
  161. package/adapter-ajax-jquery/index.d.ts +0 -5
  162. package/adapter-ajax-post/index.d.ts +0 -5
  163. package/adapter-data-service-odata/adapter-core.d.ts +0 -4
  164. package/adapter-data-service-odata/adapter-data-service-odata.d.ts +0 -17
  165. package/adapter-data-service-odata/index.d.ts +0 -5
  166. package/adapter-data-service-webapi/adapter-data-service-webapi.d.ts +0 -15
  167. package/adapter-data-service-webapi/index.d.ts +0 -5
  168. package/adapter-model-library-backing-store/adapter-model-library-backing-store.d.ts +0 -10
  169. package/adapter-model-library-backing-store/index.d.ts +0 -5
  170. package/adapter-model-library-ko/adapter-model-library-ko.d.ts +0 -10
  171. package/adapter-model-library-ko/index.d.ts +0 -5
  172. package/adapter-uri-builder-json/adapter-core.d.ts +0 -4
  173. package/adapter-uri-builder-json/adapter-uri-builder-json.d.ts +0 -8
  174. package/adapter-uri-builder-json/index.d.ts +0 -5
  175. package/adapter-uri-builder-odata/adapter-core.d.ts +0 -4
  176. package/adapter-uri-builder-odata/adapter-uri-builder-odata.d.ts +0 -8
  177. package/adapter-uri-builder-odata/index.d.ts +0 -5
  178. package/esm2022/adapter-ajax-angularjs/adapter-ajax-angularjs.mjs +0 -135
  179. package/esm2022/adapter-ajax-angularjs/adapter-core.mjs +0 -49
  180. package/esm2022/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.mjs +0 -5
  181. package/esm2022/adapter-ajax-fetch/adapter-ajax-fetch.mjs +0 -135
  182. package/esm2022/adapter-ajax-fetch/adapter-core.mjs +0 -49
  183. package/esm2022/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.mjs +0 -5
  184. package/esm2022/adapter-ajax-httpclient/adapter-ajax-httpclient.mjs +0 -139
  185. package/esm2022/adapter-ajax-httpclient/adapter-core.mjs +0 -49
  186. package/esm2022/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.mjs +0 -5
  187. package/esm2022/adapter-ajax-jquery/adapter-ajax-jquery.mjs +0 -107
  188. package/esm2022/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.mjs +0 -5
  189. package/esm2022/adapter-ajax-post/adapter-ajax-post.mjs +0 -77
  190. package/esm2022/adapter-ajax-post/breeze-client-adapter-ajax-post.mjs +0 -5
  191. package/esm2022/adapter-data-service-odata/adapter-core.mjs +0 -49
  192. package/esm2022/adapter-data-service-odata/adapter-data-service-odata.mjs +0 -461
  193. package/esm2022/adapter-data-service-odata/breeze-client-adapter-data-service-odata.mjs +0 -5
  194. package/esm2022/adapter-data-service-webapi/adapter-data-service-webapi.mjs +0 -100
  195. package/esm2022/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.mjs +0 -5
  196. package/esm2022/adapter-model-library-backing-store/adapter-model-library-backing-store.mjs +0 -269
  197. package/esm2022/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.mjs +0 -5
  198. package/esm2022/adapter-model-library-ko/adapter-model-library-ko.mjs +0 -241
  199. package/esm2022/adapter-model-library-ko/breeze-client-adapter-model-library-ko.mjs +0 -5
  200. package/esm2022/adapter-uri-builder-json/adapter-core.mjs +0 -49
  201. package/esm2022/adapter-uri-builder-json/adapter-uri-builder-json.mjs +0 -37
  202. package/esm2022/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.mjs +0 -5
  203. package/esm2022/adapter-uri-builder-odata/adapter-core.mjs +0 -49
  204. package/esm2022/adapter-uri-builder-odata/adapter-uri-builder-odata.mjs +0 -191
  205. package/esm2022/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.mjs +0 -5
  206. package/esm2022/breeze-client.mjs +0 -5
  207. package/esm2022/index.mjs +0 -2
  208. package/esm2022/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.mjs +0 -5
  209. package/esm2022/mixin-get-entity-graph/mixin-get-entity-graph.mjs +0 -269
  210. package/esm2022/mixin-save-queuing/breeze-client-mixin-save-queuing.mjs +0 -5
  211. package/esm2022/mixin-save-queuing/mixin-save-queuing.mjs +0 -421
  212. package/esm2022/src/abstract-data-service-adapter.mjs +0 -325
  213. package/esm2022/src/array.mjs +0 -4
  214. package/esm2022/src/assert-param.mjs +0 -330
  215. package/esm2022/src/breeze.mjs +0 -85
  216. package/esm2022/src/complex-array.mjs +0 -117
  217. package/esm2022/src/config.mjs +0 -232
  218. package/esm2022/src/core.mjs +0 -712
  219. package/esm2022/src/csdl-metadata-parser.mjs +0 -385
  220. package/esm2022/src/data-service.mjs +0 -221
  221. package/esm2022/src/data-type.mjs +0 -510
  222. package/esm2022/src/default-property-interceptor.mjs +0 -460
  223. package/esm2022/src/entity-action.mjs +0 -45
  224. package/esm2022/src/entity-aspect.mjs +0 -897
  225. package/esm2022/src/entity-group.mjs +0 -192
  226. package/esm2022/src/entity-key.mjs +0 -125
  227. package/esm2022/src/entity-manager.mjs +0 -2163
  228. package/esm2022/src/entity-metadata.mjs +0 -2242
  229. package/esm2022/src/entity-query.mjs +0 -1024
  230. package/esm2022/src/entity-state.mjs +0 -107
  231. package/esm2022/src/enum.mjs +0 -143
  232. package/esm2022/src/event.mjs +0 -264
  233. package/esm2022/src/interface-registry.mjs +0 -39
  234. package/esm2022/src/key-generator.mjs +0 -110
  235. package/esm2022/src/local-query-comparison-options.mjs +0 -65
  236. package/esm2022/src/mapping-context.mjs +0 -411
  237. package/esm2022/src/naming-convention.mjs +0 -92
  238. package/esm2022/src/observable-array.mjs +0 -183
  239. package/esm2022/src/predicate.mjs +0 -1259
  240. package/esm2022/src/primitive-array.mjs +0 -85
  241. package/esm2022/src/query-options.mjs +0 -152
  242. package/esm2022/src/relation-array.mjs +0 -173
  243. package/esm2022/src/save-options.mjs +0 -41
  244. package/esm2022/src/unattached-children-map.mjs +0 -56
  245. package/esm2022/src/validate.mjs +0 -995
  246. package/esm2022/src/validation-options.mjs +0 -64
  247. package/fesm2022/breeze-client-adapter-ajax-angularjs.mjs +0 -190
  248. package/fesm2022/breeze-client-adapter-ajax-angularjs.mjs.map +0 -1
  249. package/fesm2022/breeze-client-adapter-ajax-fetch.mjs +0 -190
  250. package/fesm2022/breeze-client-adapter-ajax-fetch.mjs.map +0 -1
  251. package/fesm2022/breeze-client-adapter-ajax-httpclient.mjs +0 -194
  252. package/fesm2022/breeze-client-adapter-ajax-httpclient.mjs.map +0 -1
  253. package/fesm2022/breeze-client-adapter-ajax-jquery.mjs +0 -114
  254. package/fesm2022/breeze-client-adapter-ajax-jquery.mjs.map +0 -1
  255. package/fesm2022/breeze-client-adapter-ajax-post.mjs.map +0 -1
  256. package/fesm2022/breeze-client-adapter-data-service-odata.mjs +0 -516
  257. package/fesm2022/breeze-client-adapter-data-service-odata.mjs.map +0 -1
  258. package/fesm2022/breeze-client-adapter-data-service-webapi.mjs.map +0 -1
  259. package/fesm2022/breeze-client-adapter-model-library-backing-store.mjs +0 -276
  260. package/fesm2022/breeze-client-adapter-model-library-backing-store.mjs.map +0 -1
  261. package/fesm2022/breeze-client-adapter-model-library-ko.mjs +0 -248
  262. package/fesm2022/breeze-client-adapter-model-library-ko.mjs.map +0 -1
  263. package/fesm2022/breeze-client-adapter-uri-builder-json.mjs.map +0 -1
  264. package/fesm2022/breeze-client-adapter-uri-builder-odata.mjs +0 -246
  265. package/fesm2022/breeze-client-adapter-uri-builder-odata.mjs.map +0 -1
  266. package/fesm2022/breeze-client-mixin-get-entity-graph.mjs.map +0 -1
  267. package/fesm2022/breeze-client-mixin-save-queuing.mjs.map +0 -1
  268. package/fesm2022/breeze-client.mjs +0 -14144
  269. package/fesm2022/breeze-client.mjs.map +0 -1
  270. package/index.d.ts +0 -1
  271. package/mixin-get-entity-graph/index.d.ts +0 -5
  272. package/mixin-get-entity-graph/mixin-get-entity-graph.d.ts +0 -31
  273. package/mixin-save-queuing/index.d.ts +0 -5
  274. package/mixin-save-queuing/mixin-save-queuing.d.ts +0 -32
  275. package/src/abstract-data-service-adapter.d.ts +0 -84
  276. package/src/array.d.ts +0 -3
  277. package/src/breeze.d.ts +0 -139
  278. package/src/complex-array.d.ts +0 -13
  279. package/src/config.d.ts +0 -104
  280. package/src/core.d.ts +0 -164
  281. package/src/csdl-metadata-parser.d.ts +0 -7
  282. package/src/data-type.d.ts +0 -89
  283. package/src/default-property-interceptor.d.ts +0 -4
  284. package/src/entity-aspect.d.ts +0 -332
  285. package/src/entity-group.d.ts +0 -28
  286. package/src/entity-key.d.ts +0 -77
  287. package/src/entity-manager.d.ts +0 -680
  288. package/src/entity-metadata.d.ts +0 -988
  289. package/src/entity-query.d.ts +0 -444
  290. package/src/enum.d.ts +0 -100
  291. package/src/event.d.ts +0 -142
  292. package/src/interface-registry.d.ts +0 -150
  293. package/src/key-generator.d.ts +0 -12
  294. package/src/observable-array.d.ts +0 -52
  295. package/src/predicate.d.ts +0 -376
  296. package/src/primitive-array.d.ts +0 -7
  297. package/src/relation-array.d.ts +0 -18
  298. package/src/unattached-children-map.d.ts +0 -19
  299. package/src/validate.d.ts +0 -650
@@ -1,89 +0,0 @@
1
- import { BreezeEnum } from './enum';
2
- import { Validator } from './validate';
3
- /**
4
- DataType is an 'Enum' containing all of the supported data types.
5
- @dynamic
6
- **/
7
- export declare class DataType extends BreezeEnum {
8
- /** The default value of this DataType. __Read Only__ **/
9
- defaultValue?: any;
10
- /** Whether this is a 'numeric' DataType. __Read Only__ **/
11
- isNumeric?: boolean;
12
- /** Whether this is an 'integer' DataType. __Read Only__ **/
13
- isInteger?: boolean;
14
- /** Whether to quote the json value when formatting this DataType for OData. */
15
- quoteJsonOData?: boolean;
16
- /** The constructor function to create a [[Validator]] to be used in validating instances of this DataType. */
17
- validatorCtor?(context?: any): Validator;
18
- /**
19
- Optional function to normalize a data value for comparison, if its value cannot be used directly.
20
- Note that this will be called each time a property is changed, so make it fast.
21
- @return value appropriate for this DataType
22
- **/
23
- normalize?(value: any): any;
24
- /**
25
- Optional function to convert a raw (server) value from string to this DataType.
26
- @return value appropriate for this DataType
27
- **/
28
- parseRawValue?(value: any): any;
29
- /**
30
- Optional function to convert a value from string to this DataType. Note that this will be called each time a property is changed, so make it fast.
31
- @return value appropriate for this DataType
32
- **/
33
- parse?(source: any, sourceTypeName: string): any;
34
- /**
35
- Optional function to format this DataType for OData queries.
36
- @return value appropriate for OData query
37
- **/
38
- fmtOData?(value: any): any;
39
- /**
40
- Optional function to get the next value for key generation, if this datatype is used as a key. Uses an internal table of previous values.
41
- @return value appropriate for this DataType
42
- **/
43
- getNext?(): any;
44
- /**
45
- Optional function to get the next value when the datatype is used as a concurrency property.
46
- @param previousValue
47
- @return the next concurrency value, which may be a function of the previousValue.
48
- **/
49
- getConcurrencyValue?(previousValue?: any): any;
50
- static parseDateFromServer: (value: any) => any;
51
- /** @hidden @internal */
52
- static constants: {
53
- stringPrefix: string;
54
- nextNumber: number;
55
- nextNumberIncrement: number;
56
- };
57
- static String: DataType;
58
- static Int64: DataType;
59
- static Int32: DataType;
60
- static Int16: DataType;
61
- static Byte: DataType;
62
- static Decimal: DataType;
63
- static Double: DataType;
64
- static Single: DataType;
65
- static DateOnly: DataType;
66
- static DateTime: DataType;
67
- static DateTimeOffset: DataType;
68
- static Time: DataType;
69
- static Boolean: DataType;
70
- static Guid: DataType;
71
- static Binary: DataType;
72
- static Undefined: DataType;
73
- static getComparableFn(dataType?: DataType): (value: any) => any;
74
- /** Returns the DataType for a specified EDM type name.
75
- **/
76
- static fromEdmDataType(typeName: string): DataType;
77
- /** Returns the DataType for a specified input. */
78
- static fromValue(val: any): DataType;
79
- static parseTimeFromServer(source: any): any;
80
- static parseDateAsUTC(source: any): any;
81
- /** Parse as UTC then shift to local time */
82
- static parseDateAsLocal(source: string): any;
83
- /** if val is a Date, return a date-only string e.g. '2023-12-31' */
84
- static toDateOnlyString(val: any): any;
85
- /** Returns a raw value converted to the specified DataType */
86
- static parseRawValue(val: any, dataType?: DataType): any;
87
- /** @hidden @internal */
88
- static _resetConstants(): void;
89
- }
@@ -1,4 +0,0 @@
1
- import { EntityProperty } from './entity-metadata';
2
- import { StructuralObject } from './entity-aspect';
3
- /** @hidden @internal */
4
- export declare function defaultPropertyInterceptor(this: StructuralObject, property: EntityProperty, newValue: any, rawAccessorFn: Function): void;
@@ -1,332 +0,0 @@
1
- import { BreezeEvent } from './event';
2
- import { EntityState } from './entity-state';
3
- import { EntityType, ComplexType, DataProperty, NavigationProperty, EntityProperty } from './entity-metadata';
4
- import { EntityKey } from './entity-key';
5
- import { EntityGroup } from './entity-group';
6
- import { EntityManager, QueryResult, QueryErrorCallback, QuerySuccessCallback } from './entity-manager';
7
- import { ValidationError } from './validate';
8
- export interface Entity {
9
- entityAspect: EntityAspect;
10
- entityType: EntityType;
11
- /** Get the property with the given name */
12
- getProperty?(prop: string): any;
13
- /** Set the property with the given name */
14
- setProperty?(prop: any, value: any): void;
15
- /** @hidden @internal */
16
- prototype?: {
17
- _$typeName: string;
18
- };
19
- /** @hidden @internal */
20
- _$entityType?: EntityType;
21
- }
22
- export interface ComplexObject {
23
- complexAspect: ComplexAspect;
24
- complexType: ComplexType;
25
- getProperty?(prop: string): any;
26
- setProperty?(prop: any, value: any): void;
27
- /** @hidden @internal */
28
- prototype?: {
29
- _$typeName: string;
30
- };
31
- }
32
- export type StructuralObject = Entity | ComplexObject;
33
- export interface PropertyChangedEventArgs {
34
- entity: Entity;
35
- propertyName: string | null;
36
- parent?: StructuralObject;
37
- property?: EntityProperty;
38
- oldValue?: any;
39
- newValue?: any;
40
- }
41
- export interface ValidationErrorsChangedEventArgs {
42
- entity: Entity;
43
- added: ValidationError[];
44
- removed: ValidationError[];
45
- }
46
- /**
47
- An EntityAspect instance is associated with every attached entity and is accessed via the entity's 'entityAspect' property.
48
-
49
- The EntityAspect itself provides properties to determine and modify the EntityState of the entity and has methods
50
- that provide a variety of services including validation and change tracking.
51
-
52
- An EntityAspect will almost never need to be constructed directly. You will usually get an EntityAspect by accessing
53
- an entities 'entityAspect' property. This property will be automatically attached when an entity is created via either
54
- a query, import or [[EntityManager.createEntity]] call.
55
- > // assume order is an order entity attached to an EntityManager.
56
- > var aspect = order.entityAspect;
57
- > var currentState = aspect.entityState;
58
-
59
- **/
60
- export declare class EntityAspect {
61
- /** The Entity that this aspect is associated with. __Read Only__ **/
62
- entity?: Entity;
63
- /** The [[EntityManager]] that contains this entity. __Read Only__ **/
64
- entityManager?: EntityManager;
65
- /** @hidden @internal */
66
- entityGroup?: EntityGroup;
67
- /** The [[EntityState]] of this entity. __Read Only__ **/
68
- entityState: EntityState;
69
- /** Whether this entity is in the process of being saved. __Read Only__ */
70
- isBeingSaved: boolean;
71
- /** The 'original values' of this entity where they are different from the 'current values'.
72
- This is a map where the key is a property name and the value is the 'original value' of the property. */
73
- originalValues: Record<string, any>;
74
- /** Whether this entity has any validation errors. __Read Only__ */
75
- hasValidationErrors: boolean;
76
- /** Whether this entity has a temporary [[EntityKey]]. */
77
- hasTempKey: boolean;
78
- /** Whether this entity was created by being loaded from the database */
79
- wasLoaded?: boolean;
80
- /** Extra metadata about this entity such as the entity's etag.
81
- You may extend this object with your own metadata information.
82
- Breeze (de)serializes this object when importing/exporting the entity. **/
83
- extraMetadata?: any;
84
- /**
85
- A [[BreezeEvent]] that fires whenever any of the validation errors on this entity change.
86
- Note that this might be the removal of an error when some data on the entity is fixed.
87
- @eventArgs -
88
- - entity - The entity on which the validation errors are being added or removed.
89
- - added - An array containing any newly added [[ValidationError]]s
90
- - removed - An array containing any newly removed [[ValidationError]]s. This is those
91
- errors that have been 'fixed'.
92
-
93
- > // assume order is an order entity attached to an EntityManager.
94
- > order.entityAspect.validationErrorsChanged.subscribe(
95
- > function (validationChangeArgs) {
96
- > // this code will be executed anytime a property value changes on the 'order' entity.
97
- > var entity == validationChangeArgs.entity; // Note: entity === order
98
- > var errorsAdded = validationChangeArgs.added;
99
- > var errorsCleared = validationChangeArgs.removed;
100
- > });
101
- @event
102
- **/
103
- validationErrorsChanged: BreezeEvent<ValidationErrorsChangedEventArgs>;
104
- /**
105
- A [[BreezeEvent]] that fires whenever a value of one of this entity's properties change.
106
- @eventArgs -
107
- - entity - The entity whose property has changed.
108
- - property - The [[DataProperty]] that changed.
109
- - propertyName - The name of the property that changed. This value will be 'null' for operations that replace the entire entity. This includes
110
- 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"
111
- for any properties of a complex type.
112
- - oldValue - The old value of this property before the change.
113
- - newValue - The new value of this property after the change.
114
- - parent - The immediate parent object for the changed property. This will be a ComplexType instance as opposed to an Entity
115
- for any complex type or nested complex type properties.
116
-
117
- > // assume order is an order entity attached to an EntityManager.
118
- > order.entityAspect.propertyChanged.subscribe(
119
- > function (propertyChangedArgs) {
120
- > // this code will be executed anytime a property value changes on the 'order' entity.
121
- > var entity = propertyChangedArgs.entity; // Note: entity === order
122
- > var propertyNameChanged = propertyChangedArgs.propertyName;
123
- > var oldValue = propertyChangedArgs.oldValue;
124
- > var newValue = propertyChangedArgs.newValue;
125
- > });
126
- @event
127
- **/
128
- propertyChanged: BreezeEvent<PropertyChangedEventArgs>;
129
- /** @hidden @internal */
130
- _validationErrors: {
131
- [index: string]: ValidationError;
132
- };
133
- /** @hidden @internal */
134
- _pendingValidationResult: any;
135
- /** @hidden @internal */
136
- _entityKey: EntityKey;
137
- /** @hidden @internal */
138
- _loadedNps: any[];
139
- /** @hidden @internal */
140
- _initialized?: boolean;
141
- /** @hidden @internal */
142
- _inProcess: any[];
143
- /** @hidden @internal */
144
- _inProcessEntity?: Entity;
145
- /** @hidden @internal */
146
- static _nullInstance: EntityAspect;
147
- /** @hidden @internal */
148
- constructor(entity?: Entity);
149
- /** @hidden */
150
- static isEntity(obj: StructuralObject): obj is Entity;
151
- /**
152
- Returns the value of a specified 'property path' for a specified entity.
153
-
154
- The propertyPath can be either a string delimited with '.' or a string array.
155
- **/
156
- static getPropertyPathValue(obj: Entity, propertyPath: string | string[]): any;
157
- /**
158
- Returns the [[EntityKey]] for this Entity.
159
- > // assume order is an order entity attached to an EntityManager.
160
- > var entityKey = order.entityAspect.getKey();
161
- @param forceRefresh - (boolean=false) Forces the recalculation of the key. This should normally be unnecessary.
162
- @return The [[EntityKey]] associated with this Entity.
163
- **/
164
- getKey(forceRefresh?: boolean): EntityKey;
165
- /**
166
- Returns the entity to an [[EntityState]] of 'Unchanged' by committing all changes made since the entity was last queried
167
- had 'acceptChanges' called on it.
168
- > // assume order is an order entity attached to an EntityManager.
169
- > order.entityAspect.acceptChanges();
170
- > // The 'order' entity will now be in an 'Unchanged' state with any changes committed.
171
- **/
172
- acceptChanges(): void;
173
- /**
174
- Returns the entity to an [[EntityState]] of 'Unchanged' by rejecting all changes made to it since the entity was last queried
175
- had 'rejectChanges' called on it.
176
- > // assume order is an order entity attached to an EntityManager.
177
- > order.entityAspect.rejectChanges();
178
- > // The 'order' entity will now be in an 'Unchanged' state with any changes rejected.
179
- **/
180
- rejectChanges(): void;
181
- /** @hidden @internal */
182
- getPropertyPath(propName: string): string;
183
- /**
184
- Sets the entity to an EntityState of 'Added'. This is NOT the equivalent of calling [[EntityManager.addEntity]]
185
- because no key generation will occur for autogenerated keys as a result of this operation. As a result this operation can be problematic
186
- unless you are certain that the entity being marked 'Added' does not already exist in the database and does not have an autogenerated key.
187
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
188
- > // assume order is an order entity attached to an EntityManager.
189
- > order.entityAspect.setAdded();
190
- > // The 'order' entity will now be in an 'Added' state.
191
- **/
192
- setAdded(): boolean;
193
- /**
194
- Sets the entity to an EntityState of 'Unchanged'. This is also the equivalent of calling [[EntityAspect.acceptChanges]].
195
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
196
- > // assume order is an order entity attached to an EntityManager.
197
- > order.entityAspect.setUnchanged();
198
- > // The 'order' entity will now be in an 'Unchanged' state with any changes committed.
199
- **/
200
- setUnchanged: () => any;
201
- /**
202
- Sets the entity to an EntityState of 'Modified'. This can also be achieved by changing the value of any property on an 'Unchanged' entity.
203
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
204
- > // assume order is an order entity attached to an EntityManager.
205
- > order.entityAspect.setModified();
206
- > // The 'order' entity will now be in a 'Modified' state.
207
- **/
208
- setModified: () => any;
209
- /**
210
- Sets the entity to an EntityState of 'Deleted'. This both marks the entity as being scheduled for deletion during the next 'Save' call
211
- but also removes the entity from all of its related entities. If the current entityState is 'Added', then `setDeleted()` will mark it 'Detached'
212
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
213
- > // assume order is an order entity attached to an EntityManager.
214
- > order.entityAspect.setDeleted();
215
- > // The 'order' entity will now be in a 'Deleted' state and it will no longer have any 'related' entities.
216
- **/
217
- setDeleted: () => any;
218
- /**
219
- 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.
220
- The same operation can be performed by calling [[EntityAspect.setEntityState]].
221
- > // assume order is an order entity attached to an EntityManager.
222
- > order.entityAspect.setDetached();
223
- > // The 'order' entity will now be in a 'Detached' state and it will no longer have any 'related' entities.
224
- **/
225
- setDetached: () => any;
226
- /**
227
- Sets the entity to the specified EntityState. See also 'setUnchanged', 'setModified', 'setDetached', etc.
228
- > // assume order is an order entity attached to an EntityManager.
229
- > order.entityAspect.setEntityState(EntityState.Unchanged);
230
- > // The 'order' entity will now be in a 'Unchanged' state.
231
- **/
232
- setEntityState(entityState: EntityState): boolean;
233
- loadNavigationProperty(navigationProperty: string, callback?: QuerySuccessCallback, errorCallback?: QueryErrorCallback): Promise<QueryResult>;
234
- loadNavigationProperty(navigationProperty: NavigationProperty, callback?: QuerySuccessCallback, errorCallback?: QueryErrorCallback): Promise<QueryResult>;
235
- /**
236
- Marks this navigationProperty on this entity as already having been loaded.
237
- > emp.entityAspect.markNavigationPropertyAsLoaded("Orders");
238
- @param navigationProperty - The NavigationProperty or name of NavigationProperty to 'load'.
239
- **/
240
- markNavigationPropertyAsLoaded(navigationProperty: NavigationProperty | string): void;
241
- isNavigationPropertyLoaded(navigationProperty: string): boolean;
242
- isNavigationPropertyLoaded(navigationProperty: NavigationProperty): boolean;
243
- /** @hidden @internal */
244
- _markAsLoaded(navPropName: string): void;
245
- /**
246
- Performs validation on the entity, any errors encountered during the validation are available via the
247
- [[EntityAspect.getValidationErrors]] method. Validating an entity means executing
248
- all of the validators on both the entity itself as well as those on each of its properties.
249
- > // assume order is an order entity attached to an EntityManager.
250
- > var isOk = order.entityAspect.validateEntity();
251
- > // isOk will be 'true' if there are no errors on the entity.
252
- > if (!isOk) {
253
- > var errors = order.entityAspect.getValidationErrors();
254
- > }
255
- @return Whether the entity passed validation.
256
- **/
257
- validateEntity(): boolean;
258
- validateProperty(property: string, context?: any): boolean;
259
- validateProperty(property: DataProperty, context?: any): boolean;
260
- validateProperty(property: NavigationProperty, context?: any): boolean;
261
- getValidationErrors(): ValidationError[];
262
- getValidationErrors(property: string): ValidationError[];
263
- getValidationErrors(property: EntityProperty): ValidationError[];
264
- /**
265
- Adds a validation error.
266
- **/
267
- addValidationError(validationError: ValidationError): void;
268
- removeValidationError(validationError: ValidationError): void;
269
- removeValidationError(validationKey: string): void;
270
- /**
271
- Removes all of the validation errors for a specified entity
272
- **/
273
- clearValidationErrors(): void;
274
- /**
275
- Returns an [[EntityKey]] for the entity pointed to by the specified scalar NavigationProperty.
276
- This only returns an EntityKey if the current entity is a 'child' entity along the specified NavigationProperty.
277
- i.e. has a single parent.
278
-
279
- @param navigationProperty - The [[NavigationProperty]] ( pointing to a parent).
280
- @returns Either a parent EntityKey if this is a 'child' entity or null;
281
- */
282
- getParentKey(navigationProperty: NavigationProperty): EntityKey;
283
- /**
284
- Returns the value of a specified DataProperty or NavigationProperty or 'property path'.
285
- **/
286
- getPropertyValue(property: string | DataProperty | NavigationProperty): any;
287
- /** @hidden @internal */
288
- _checkOperation(operationName: string): this;
289
- /** @hidden @internal */
290
- _detach(): void;
291
- /** @hidden @internal */
292
- _validateProperty(value: any, context: any): boolean;
293
- /** @hidden @internal */
294
- _processValidationOpAndPublish(validationFn: any): void;
295
- /** @hidden @internal */
296
- _addValidationError(validationError: any): void;
297
- /** @hidden @internal */
298
- _removeValidationError(key: string): void;
299
- }
300
- /**
301
- An ComplexAspect instance is associated with every complex object instance and is accessed via the complex object's 'complexAspect' property.
302
-
303
- The ComplexAspect itself provides properties to determine the parent object, parent property and original values for the complex object.
304
-
305
- A ComplexAspect will almost never need to be constructed directly. You will usually get an ComplexAspect by accessing
306
- an entities 'complexAspect' property. This property will be automatically attached when an complex object is created as part of an
307
- entity via either a query, import or EntityManager.createEntity call.
308
- > // assume address is a complex property on the 'Customer' type
309
- > var aspect = aCustomer.address.complexAspect;
310
- > // aCustomer === aspect.parent;
311
- **/
312
- export declare class ComplexAspect {
313
- /** The complex object that this aspect is associated with. __Read Only__ */
314
- complexObject: ComplexObject;
315
- /** The 'original values' of this complex object where they are different from the 'current values'.
316
- This is a map where the key is a property name and the value is the 'original value' of the property.
317
- __Read Only__ */
318
- originalValues: Record<string, any>;
319
- /** The parent object that to which this aspect belongs; this will either be an entity or another complex object. __Read Only__ */
320
- parent?: StructuralObject;
321
- /** The [[DataProperty]] on the 'parent' that contains this complex object. __Read Only__ */
322
- parentProperty?: DataProperty;
323
- extraMetadata?: any;
324
- /** You will rarely, if ever, create a ComplexAspect directly. */
325
- constructor(complexObject: ComplexObject, parent: StructuralObject, parentProperty: DataProperty);
326
- /**
327
- Returns the EntityAspect for the top level entity that contains this complex object.
328
- **/
329
- getEntityAspect(): any;
330
- /** @hidden @internal */
331
- getPropertyPath(propName: string): any;
332
- }
@@ -1,28 +0,0 @@
1
- import { Entity } from './entity-aspect';
2
- import { EntityType, DataProperty } from './entity-metadata';
3
- import { EntityKey } from './entity-key';
4
- import { EntityState } from './entity-state';
5
- import { EntityManager } from './entity-manager';
6
- import { MergeStrategy } from './query-options';
7
- /** @hidden @internal */
8
- export declare class EntityGroup {
9
- entityManager: EntityManager;
10
- entityType: EntityType;
11
- _indexMap: {
12
- [index: string]: number;
13
- };
14
- _entities: (Entity | null)[];
15
- _emptyIndexes: number[];
16
- constructor(entityManager: EntityManager, entityType: EntityType);
17
- attachEntity(entity: Entity, entityState: EntityState, mergeStrategy?: MergeStrategy): Entity;
18
- detachEntity(entity: Entity): Entity;
19
- findEntityByKey(entityKey: EntityKey): Entity;
20
- hasChanges(): boolean;
21
- getChanges(): Entity[];
22
- getEntities(entityStates: EntityState[]): Entity[];
23
- _checkOperation(operationName: string): this;
24
- _clear(): void;
25
- _updateFkVal(fkProp: DataProperty, oldValue: any, newValue: any): void;
26
- _fixupKey(tempValue: any, realValue: any): void;
27
- _replaceKey(oldKey: EntityKey, newKey: EntityKey): void;
28
- }
@@ -1,77 +0,0 @@
1
- import { EntityType, MetadataStore } from './entity-metadata';
2
- /**
3
- An EntityKey is an object that represents the unique identity of an entity. EntityKey's are immutable.
4
-
5
-
6
- **/
7
- export declare class EntityKey {
8
- /** @hidden @internal */
9
- _$typeName: string;
10
- /** @hidden @internal */
11
- static ENTITY_KEY_DELIMITER: string;
12
- /** The 'EntityType' that this is a key for. __Read Only__ */
13
- entityType: EntityType;
14
- /** An array of the values for this key. This will usually only have a single element,
15
- unless the entity type has a multipart key. __Read Only__ */
16
- values: any[];
17
- /** @hidden @internal */
18
- _keyInGroup: string;
19
- /** @hidden @internal */
20
- _subtypes: EntityType[];
21
- /**
22
- Constructs a new EntityKey. Each entity within an EntityManager will have a unique EntityKey.
23
- > // assume em1 is an EntityManager containing a number of existing entities.
24
- > var empType = em1.metadataStore.getEntityType("Employee");
25
- > var entityKey = new EntityKey(empType, 1);
26
-
27
- EntityKey's may also be found by calling EntityAspect.getKey()
28
- > // assume employee1 is an existing Employee entity
29
- > var empKey = employee1.entityAspect.getKey();
30
-
31
- Multipart keys are created by passing an array as the 'keyValues' parameter
32
- > var empTerrType = em1.metadataStore.getEntityType("EmployeeTerritory");
33
- > var empTerrKey = new EntityKey(empTerrType, [ 1, 77]);
34
- > // The order of the properties in the 'keyValues' array must be the same as that
35
- > // returned by empTerrType.keyProperties
36
- @param entityType - The [[EntityType]] of the entity.
37
- @param keyValues - A single value or an array of values.
38
- */
39
- constructor(entityType: EntityType, keyValues: any);
40
- toJSON(): {
41
- entityType: string;
42
- values: any[];
43
- };
44
- static fromJSON(json: any, metadataStore: MetadataStore): EntityKey;
45
- /**
46
- Used to compare EntityKeys are determine if they refer to the same Entity.
47
- There is also an static version of 'equals' with the same functionality.
48
-
49
- > // assume em1 is an EntityManager containing a number of existing entities.
50
- > var empType = em1.metadataStore.getEntityType("Employee");
51
- > var empKey1 = new EntityKey(empType, 1);
52
- > // assume employee1 is an existing Employee entity
53
- > var empKey2 = employee1.entityAspect.getKey();
54
- > if (empKey1.equals(empKey2)) {
55
- > // do something ...
56
- > }
57
- **/
58
- equals(entityKey: EntityKey): boolean;
59
- toString(altEntityType?: EntityType): string;
60
- /**
61
- Used to compare EntityKeys are determine if they refer to the same Entity.
62
- There is also an instance version of 'equals' with the same functionality.
63
- > // assume em1 is an EntityManager containing a number of existing entities.
64
- > var empType = em1.metadataStore.getEntityType("Employee");
65
- > var empKey1 = new EntityKey(empType, 1);
66
- > // assume employee1 is an existing Employee entity
67
- > var empKey2 = employee1.entityAspect.getKey();
68
- > if (EntityKey.equals(empKey1, empKey2)) {
69
- > // do something ...
70
- > }
71
- **/
72
- static equals(k1: EntityKey, k2: EntityKey): boolean;
73
- /** @hidden @internal */
74
- _isEmpty(): boolean;
75
- /** hidden */
76
- static createKeyString(keyValues: any[]): string;
77
- }