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,988 +0,0 @@
1
- import { ErrorCallback } from './core';
2
- import { BreezeEvent } from './event';
3
- import { DataType } from './data-type';
4
- import { Entity, ComplexObject, StructuralObject } from './entity-aspect';
5
- import { EntityKey } from './entity-key';
6
- import { Validator } from './validate';
7
- import { BreezeEnum } from './enum';
8
- import { DataService } from './data-service';
9
- import { NamingConvention } from './naming-convention';
10
- import { LocalQueryComparisonOptions } from './local-query-comparison-options';
11
- export type EntityProperty = DataProperty | NavigationProperty;
12
- export type StructuralType = EntityType | ComplexType;
13
- /** @hidden @internal */
14
- export interface IStructuralTypeMap {
15
- [index: string]: StructuralType;
16
- }
17
- /** Keep track of constructors and initializers for StructuralTypes */
18
- interface CtorRecord {
19
- ctor: {
20
- new (): StructuralObject;
21
- };
22
- initFn?: Function | string;
23
- noTrackingFn?: Function;
24
- }
25
- /** @hidden @internal */
26
- export interface IMetadataJson {
27
- metadataVersion: string;
28
- name: string;
29
- namingConvention: string;
30
- localQueryComparisonOptions: string;
31
- dataServices: Object[];
32
- structuralTypes: Object[];
33
- resourceEntityTypeMap: Object[];
34
- incompleteTypeMap: Object[];
35
- }
36
- /** Configuration info to be passed to the [[MetadataStore]] constructor */
37
- export interface MetadataStoreConfig {
38
- /** The [[NamingConvention]] associated with this MetadataStore. */
39
- namingConvention?: NamingConvention;
40
- /** The [[LocalQueryComparisonOptions]] associated with this MetadataStore. */
41
- localQueryComparisonOptions?: LocalQueryComparisonOptions;
42
- serializerFn?: (prop: EntityProperty, val: any) => any;
43
- name?: string;
44
- }
45
- export interface MetadataFetchedEventArgs {
46
- metadataStore: MetadataStore;
47
- dataService: DataService | string;
48
- rawMetadata: any;
49
- }
50
- /**
51
- An instance of the MetadataStore contains all of the metadata about a collection of [[EntityType]]'s.
52
- MetadataStores may be shared across [[EntityManager]]'s. If an EntityManager is created without an
53
- explicit MetadataStore, the MetadataStore from the MetadataStore.defaultInstance property will be used.
54
- @dynamic
55
- **/
56
- export declare class MetadataStore {
57
- /** @hidden @internal */
58
- _$typeName: string;
59
- /** @hidden @internal */
60
- static __id: number;
61
- /** @hidden @internal */
62
- static ANONTYPE_PREFIX: string;
63
- /** The version of any MetadataStores created by this class */
64
- static metadataVersion: string;
65
- name: string;
66
- dataServices: DataService[];
67
- /** The [[NamingConvention]] associated with this MetadataStore. __Read Only__ */
68
- namingConvention: NamingConvention;
69
- /** The [[LocalQueryComparisonOptions]] associated with this MetadataStore. __Read Only__ */
70
- localQueryComparisonOptions: LocalQueryComparisonOptions;
71
- serializerFn?: (prop: EntityProperty, val: any) => any;
72
- /**
73
- An [[BreezeEvent]] that fires after a MetadataStore has completed fetching metadata from a remote service.
74
-
75
- @eventArgs -
76
- - metadataStore - The MetadataStore into which the metadata was fetched.
77
- - dataService - The [[DataService]] that metadata was fetched from.
78
- - rawMetadata - {Object} The raw metadata returned from the service. (It will have already been processed by this point).
79
- > let ms = myEntityManager.metadataStore;
80
- > ms.metadataFetched.subscribe(function(args) {
81
- > let metadataStore = args.metadataStore;
82
- > let dataService = args.dataService;
83
- > });
84
- @event
85
- **/
86
- metadataFetched: BreezeEvent<MetadataFetchedEventArgs>;
87
- /** @hidden @internal */
88
- _resourceEntityTypeMap: Record<string, string>;
89
- /** @hidden @internal */
90
- _entityTypeResourceMap: Record<string, string>;
91
- /** @hidden @internal key is qualified structuraltype name - value is structuralType. ( structural = entityType or complexType). */
92
- _structuralTypeMap: IStructuralTypeMap;
93
- /** @hidden @internal key is shortName, value is qualified name - does not need to be serialized. **/
94
- _shortNameMap: Record<string, string>;
95
- /** @hidden @internal key is either short or qual type name - value is ctor; **/
96
- _ctorRegistry: Record<string, CtorRecord>;
97
- /** @hidden @internal key is entityTypeName; value is array of nav props **/
98
- _incompleteTypeMap: Record<string, NavigationProperty[]>;
99
- /** @hidden @internal **/
100
- _incompleteComplexTypeMap: Record<string, DataProperty[]>;
101
- /** @hidden @internal { json: any, stype: StructuralType }[] | { entityType: EntityType, csdlEntityType: any }[] **/
102
- _deferredTypes: Record<string, any>;
103
- /** @hidden @internal **/
104
- _id: number;
105
- /**
106
- Constructs a new MetadataStore.
107
-
108
- > let ms = new MetadataStore();
109
-
110
- The store can then be associated with an EntityManager
111
- > let entityManager = new EntityManager( {
112
- > serviceName: "breeze/NorthwindIBModel",
113
- > metadataStore: ms
114
- > });
115
-
116
- or for an existing EntityManager
117
- > // Assume em1 is an existing EntityManager
118
- > em1.setProperties( { metadataStore: ms });
119
-
120
- @param config - Configuration settings .
121
- - namingConvention - (default=NamingConvention.defaultInstance) NamingConvention to be used in mapping property names
122
- between client and server. Uses the NamingConvention.defaultInstance if not specified.
123
- - localQueryComparisonOptions - (default=LocalQueryComparisonOptions.defaultInstance) The LocalQueryComparisonOptions to be
124
- used when performing "local queries" in order to match the semantics of queries against a remote service.
125
- - serializerFn - A function that is used to mediate the serialization of instances of this type.
126
- **/
127
- constructor(config?: MetadataStoreConfig);
128
- static normalizeTypeName: any;
129
- /**
130
- General purpose property set method
131
-
132
- > // assume em1 is an EntityManager containing a number of existing entities.
133
- > em1.metadataStore.setProperties( {
134
- > version: "6.1.3",
135
- > serializerFn: function(prop, value) {
136
- > return (prop.isUnmapped) ? undefined : value;
137
- > }
138
- > )};
139
- @param config - An object containing the selected properties and values to set.
140
- **/
141
- setProperties(config: MetadataStoreConfig): void;
142
- /**
143
- Adds a DataService to this MetadataStore. If a DataService with the same serviceName is already
144
- in the MetadataStore an exception will be thrown.
145
- @param dataService - The [[DataService]] to add
146
- @param shouldOverwrite - (default=false) Permit overwrite of existing DataService rather than throw exception
147
- **/
148
- addDataService(dataService: DataService, shouldOverwrite?: boolean): void;
149
- /** @hidden @internal */
150
- _getDataServiceIndex(serviceName: string): number;
151
- /**
152
- Adds an EntityType to this MetadataStore. No additional properties may be added to the EntityType after its has
153
- been added to the MetadataStore.
154
- @param structuralType - The EntityType or ComplexType to add
155
- **/
156
- addEntityType(stype: StructuralType | EntityTypeConfig | ComplexTypeConfig): void;
157
- /**
158
- Exports this MetadataStore to a serialized string appropriate for local storage. This operation is also called
159
- internally when exporting an EntityManager.
160
- > // assume ms is a previously created MetadataStore
161
- > let metadataAsString = ms.exportMetadata();
162
- > window.localStorage.setItem("metadata", metadataAsString);
163
- > // and later, usually in a different session imported
164
- > let metadataFromStorage = window.localStorage.getItem("metadata");
165
- > let newMetadataStore = new MetadataStore();
166
- > newMetadataStore.importMetadata(metadataFromStorage);
167
- @return A serialized version of this MetadataStore that may be stored locally and later restored.
168
- **/
169
- exportMetadata(): string;
170
- /**
171
- Imports a previously exported serialized MetadataStore into this MetadataStore.
172
-
173
- > // assume ms is a previously created MetadataStore
174
- > let metadataAsString = ms.exportMetadata();
175
- > window.localStorage.setItem("metadata", metadataAsString);
176
- > // and later, usually in a different session
177
- > let metadataFromStorage = window.localStorage.getItem("metadata");
178
- > let newMetadataStore = new MetadataStore();
179
- > newMetadataStore.importMetadata(metadataFromStorage);
180
- @param exportedMetadata - A previously exported MetadataStore.
181
- @param allowMerge - Allows custom metadata to be merged into existing metadata types.
182
- @return This MetadataStore.
183
- @chainable
184
- **/
185
- importMetadata(exportedMetadata: string | Object, allowMerge?: boolean): MetadataStore;
186
- /**
187
- Creates a new MetadataStore from a previously exported serialized MetadataStore
188
- > // assume ms is a previously created MetadataStore
189
- > let metadataAsString = ms.exportMetadata();
190
- > window.localStorage.setItem("metadata", metadataAsString);
191
- > // and later, usually in a different session
192
- > let metadataFromStorage = window.localStorage.getItem("metadata");
193
- > let newMetadataStore = MetadataStore.importMetadata(metadataFromStorage);
194
- @param exportedString - A previously exported MetadataStore.
195
- @return A new MetadataStore.
196
- **/
197
- static importMetadata(exportedString: string): MetadataStore;
198
- /**
199
- Returns whether Metadata has been retrieved for a specified service name.
200
- > // Assume em1 is an existing EntityManager.
201
- > if (!em1.metadataStore.hasMetadataFor("breeze/NorthwindIBModel"))) {
202
- > // do something interesting
203
- > }
204
- @param serviceName - The service name.
205
- @return Whether metadata has already been retrieved for the specified service name.
206
- **/
207
- hasMetadataFor(serviceName: string): boolean;
208
- /**
209
- Returns the DataService for a specified service name
210
- > // Assume em1 is an existing EntityManager.
211
- > let ds = em1.metadataStore.getDataService("breeze/NorthwindIBModel");
212
- > let adapterName = ds.adapterName; // may be null
213
- @param serviceName - The service name.
214
- @return The DataService with the specified name.
215
- **/
216
- getDataService(serviceName: string): DataService;
217
- /**
218
- Fetches the metadata for a specified 'service'. This method is automatically called
219
- internally by an EntityManager before its first query against a new service. __Async__
220
-
221
- Usually you will not actually process the results of a fetchMetadata call directly, but will instead
222
- ask for the metadata from the EntityManager after the fetchMetadata call returns.
223
- > let ms = new MetadataStore();
224
- > // or more commonly
225
- > // let ms = anEntityManager.metadataStore;
226
- > ms.fetchMetadata("breeze/NorthwindIBModel").then(function(rawMetadata) {
227
- > // do something with the metadata
228
- > }).catch(function(exception) {
229
- > // handle exception here
230
- > });
231
- @param dataService - Either a DataService or just the name of the DataService to fetch metadata for.
232
- @param callback - Function called on success.
233
- @param errorCallback - Function called on failure.
234
- @return Promise
235
- **/
236
- fetchMetadata(dataService: string | DataService, callback?: (schema: any) => void, errorCallback?: ErrorCallback): Promise<any>;
237
- /**
238
- Used to register a constructor for an EntityType that is not known via standard Metadata discovery;
239
- i.e. an unmapped type.
240
- @param entityCtor - The constructor function for the 'unmapped' type.
241
- @param interceptor - An interceptor function
242
- **/
243
- trackUnmappedType(entityCtor: any, interceptor: any): void;
244
- /**
245
- Provides a mechanism to register a 'custom' constructor to be used when creating new instances
246
- of the specified entity type. If this call is not made, a default constructor is created for
247
- the entity as needed.
248
- This call may be made before or after the corresponding EntityType has been discovered via
249
- Metadata discovery.
250
- > let Customer = function () {
251
- > this.miscData = "asdf";
252
- > };
253
- > Customer.prototype.doFoo() {
254
- > ...
255
- > }
256
- > // assume em1 is a preexisting EntityManager;
257
- > em1.metadataStore.registerEntityTypeCtor("Customer", Customer);
258
- > // any queries or EntityType.create calls from this point on will call the Customer constructor
259
- > // registered above.
260
- @param structuralTypeName - The name of the EntityType or ComplexType.
261
- @param aCtor - The constructor for this EntityType or ComplexType; may be null if all you want to do is set the next parameter.
262
- @param initFn - A function or the name of a function on the entity that is to be executed immediately after the entity has been created
263
- and populated with any initial values. Called with 'initFn(entity)'
264
- @param noTrackingFn - A function that is executed immediately after a noTracking entity has been created and whose return
265
- value will be used in place of the noTracking entity.
266
- **/
267
- registerEntityTypeCtor(structuralTypeName: string, aCtor?: any, initFn?: Function | string, noTrackingFn?: Function): void;
268
- /**
269
- Returns whether this MetadataStore contains any metadata yet.
270
- > // assume em1 is a preexisting EntityManager;
271
- > if (em1.metadataStore.isEmpty()) {
272
- > // do something interesting
273
- > }
274
- **/
275
- isEmpty(): boolean;
276
- /**
277
- Returns an [[EntityType]] or null given its name.
278
- > // assume em1 is a preexisting EntityManager
279
- > let odType = em1.metadataStore.getAsEntityType("OrderDetail");
280
-
281
- or to throw an error if the type is not found
282
- > let badType = em1.metadataStore.getAsEntityType("Foo", false);
283
- > // badType will not get set and an exception will be thrown.
284
- @param structuralTypeName - Either the fully qualified name or a short name may be used. If a short name is specified and multiple types share
285
- that same short name an exception will be thrown.
286
- @param okIfNotFound - (default=false) Whether to throw an error if the specified EntityType is not found.
287
- @return The EntityType. ComplexType or 'null' if not not found.
288
- **/
289
- getAsEntityType(typeName: string, okIfNotFound?: boolean): EntityType;
290
- /**
291
- Returns an [[EntityType]] or null given its name.
292
- > // assume em1 is a preexisting EntityManager
293
- > let locType = em1.metadataStore.getAsComplexType("Location");
294
-
295
- or to throw an error if the type is not found
296
- > let badType = em1.metadataStore.getAsComplexType("Foo", false);
297
- > // badType will not get set and an exception will be thrown.
298
- @param structuralTypeName - Either the fully qualified name or a short name may be used. If a short name is specified and multiple types share
299
- that same short name an exception will be thrown.
300
- @param okIfNotFound - (default=false) Whether to throw an error if the specified EntityType is not found.
301
- @return The EntityType. ComplexType or 'null' if not not found.
302
- **/
303
- getAsComplexType(typeName: string, okIfNotFound?: boolean): ComplexType;
304
- /**
305
- Returns an [[EntityType]] or a [[ComplexType]] given its name.
306
- @deprecated Replaced by getStructuralType but ... it is probably more usefull to call either getAsEntityType or getAsComplexType instead
307
- @param typeName - Either the fully qualified name or a short name may be used. If a short name is specified and multiple types share
308
- that same short name an exception will be thrown.
309
- @param okIfNotFound - (default=false) Whether to throw an error if the specified EntityType is not found.
310
- @return The EntityType. ComplexType or 'null' if not not found.
311
- **/
312
- getEntityType(typeName: string, okIfNotFound?: boolean): StructuralType;
313
- /**
314
- Returns an [[EntityType]] or a [[ComplexType]] given its name.
315
- > // assume em1 is a preexisting EntityManager
316
- > let odType = em1.metadataStore.getStructuralType("OrderDetail");
317
-
318
- or to throw an error if the type is not found
319
- > let badType = em1.metadataStore.getStructuralType("Foo", false);
320
- > // badType will not get set and an exception will be thrown.
321
- @deprecated Preferably use either getAsEntityType or getAsComplexType. Get
322
- @param typeName - Either the fully qualified name or a short name may be used. If a short name is specified and multiple types share
323
- that same short name an exception will be thrown.
324
- @param okIfNotFound - (default=false) Whether to throw an error if the specified EntityType is not found.
325
- @return The EntityType. ComplexType or 'null' if not not found.
326
- **/
327
- getStructuralType(typeName: string, okIfNotFound?: boolean): StructuralType;
328
- /** @hidden @internal */
329
- _getStructuralType(typeName: string, okIfNotFound?: boolean): StructuralType;
330
- /**
331
- Returns an array containing all of the [[EntityType]]s or [[ComplexType]]s in this MetadataStore.
332
- > // assume em1 is a preexisting EntityManager
333
- > let allTypes = em1.metadataStore.getEntityTypes();
334
- **/
335
- getEntityTypes(): StructuralType[];
336
- getIncompleteNavigationProperties(): any[];
337
- /**
338
- Returns a fully qualified entityTypeName for a specified resource name. The reverse of this operation
339
- can be obtained via the [[EntityType.defaultResourceName]] property
340
- **/
341
- getEntityTypeNameForResourceName(resourceName: string): string;
342
- /**
343
- Associates a resourceName with an entityType.
344
-
345
- This method is only needed in those cases where multiple resources return the same
346
- entityType. In this case Metadata discovery will only determine a single resource name for
347
- each entityType.
348
- @param resourceName - The resource name
349
- @param entityTypeOrName - If passing a string either the fully qualified name or a short name may be used. If a short name is specified and multiple types share
350
- that same short name an exception will be thrown. If the entityType has not yet been discovered then a fully qualified name must be used.
351
- **/
352
- setEntityTypeForResourceName(resourceName: string, entityTypeOrName: EntityType | string): void;
353
- /** __Dev Only__ - for use when creating a new MetadataParserAdapter */
354
- static parseTypeName(entityTypeName: string): {
355
- shortTypeName: string;
356
- namespace: string;
357
- typeName: string;
358
- };
359
- /** __Dev Only__ - for use when creating a new MetadataParserAdapter */
360
- static makeTypeHash(shortName: string, ns?: string): {
361
- shortTypeName: string;
362
- namespace: string;
363
- typeName: string;
364
- };
365
- /** @hidden @internal */
366
- _checkEntityType(entity: Entity): void;
367
- }
368
- /** Configuration info to be passed to the [[EntityType]] constructor */
369
- export interface EntityTypeConfig {
370
- shortName?: string;
371
- namespace?: string;
372
- baseTypeName?: string;
373
- isAbstract?: boolean;
374
- autoGeneratedKeyType?: AutoGeneratedKeyType;
375
- defaultResourceName?: string;
376
- dataProperties?: DataProperty[] | Object[] | Object;
377
- navigationProperties?: NavigationProperty[] | Object[] | Object;
378
- serializerFn?: (prop: EntityProperty, val: any) => any;
379
- custom?: any;
380
- }
381
- /** Configuration info to be passed to the [[EntityType.setProperties]] method */
382
- export interface EntityTypeSetConfig {
383
- autoGeneratedKeyType?: AutoGeneratedKeyType;
384
- defaultResourceName?: string;
385
- serializerFn?: (prop: EntityProperty, val: any) => any;
386
- custom?: any;
387
- }
388
- /** Container for all of the metadata about a specific type of Entity.
389
- **/
390
- export declare class EntityType {
391
- /** @hidden @internal */
392
- _$typeName: string;
393
- /** @hidden @internal */
394
- static __nextAnonIx: number;
395
- /** Always false for an EntityType. **/
396
- isComplexType: boolean;
397
- /** The [[MetadataStore]] that contains this EntityType. __Read Only__ **/
398
- metadataStore: MetadataStore;
399
- /** The DataProperties (see [[DataProperty]] associated with this EntityType. __Read Only__ **/
400
- dataProperties: DataProperty[];
401
- /** The NavigationProperties (see [[NavigationProperty]] associated with this EntityType. __Read Only__ **/
402
- navigationProperties: NavigationProperty[];
403
- /**
404
- The DataProperties associated with this EntityType that make up it's [[EntityKey]]. __Read Only__ **/
405
- keyProperties: DataProperty[];
406
- /** The DataProperties associated with this EntityType that are foreign key properties. __Read Only__ **/
407
- foreignKeyProperties: DataProperty[];
408
- inverseForeignKeyProperties: DataProperty[];
409
- /** The DataProperties associated with this EntityType that are concurrency properties. __Read Only__ **/
410
- concurrencyProperties: DataProperty[];
411
- /** The DataProperties for this EntityType that contain instances of a [[ComplexType]]. __Read Only__ **/
412
- complexProperties: DataProperty[];
413
- /** The DataProperties associated with this EntityType that are not mapped to any backend datastore. These are effectively free standing
414
- properties. __Read Only__ **/
415
- unmappedProperties: DataProperty[];
416
- /** The fully qualified name of this EntityType. __Read Only__ **/
417
- name: string;
418
- /** The short, unqualified, name for this EntityType. __Read Only__ **/
419
- shortName: string;
420
- /** The namespace for this EntityType. __Read Only__ **/
421
- namespace: string;
422
- /** The name of this EntityType's base EntityType (if any) */
423
- baseTypeName?: string;
424
- /** The base EntityType (if any) for this EntityType. __Read Only__ **/
425
- baseEntityType: EntityType;
426
- subtypes: EntityType[];
427
- /** Whether this EntityType is abstract. __Read Only__ **/
428
- isAbstract: boolean;
429
- /** Whether this EntityType is anonymous. Anonymous types will never be communicated to or from the server. They are purely for
430
- client side use and are given an automatically generated name. __Read Only__ **/
431
- isAnonymous: boolean;
432
- /** Whether this EntityType has been 'frozen'. EntityTypes become frozen after the first instance
433
- of that type has been created and attached to an EntityManager. */
434
- isFrozen: boolean;
435
- /** The [[AutoGeneratedKeyType]] for this EntityType. __Read Only__ **/
436
- autoGeneratedKeyType: AutoGeneratedKeyType;
437
- /** The default resource name associated with this EntityType. An EntityType may be queried via a variety of 'resource names' but this one
438
- is used as the default when no resource name is provided. This will occur when calling [[EntityAspect.loadNavigationProperty]]
439
- or when executing any [[EntityQuery]] that was created via an [[EntityKey]]. __Read Only__ **/
440
- defaultResourceName: string;
441
- /** A function that is used to customize the serialization of any EntityProperties of this type. */
442
- serializerFn?: (prop: EntityProperty, val: any) => any;
443
- /** A free form object that can be used to define any custom metadata for this EntityType. __Read Only__ **/
444
- custom?: any;
445
- /** The entity level validators associated with this EntityType. Validators can be added and
446
- removed from this collection. __Read Only__. **/
447
- validators: Validator[];
448
- warnings: any[];
449
- initFn: Function | string;
450
- noTrackingFn: Function;
451
- /** @hidden @internal */
452
- _extra: any;
453
- /** @hidden @internal */
454
- _ctor: {
455
- new (): StructuralObject;
456
- };
457
- /** @hidden @internal */
458
- _mappedPropertiesCount: number;
459
- /**
460
- @deprecated Use [[getCtor]] instead.
461
- */
462
- getEntityCtor: (forceRefresh?: boolean) => {
463
- new (): StructuralObject;
464
- };
465
- /** @hidden @internal */
466
- static qualifyTypeName: typeof qualifyTypeName;
467
- /** EntityType constructor
468
- > let entityType = new EntityType( {
469
- > shortName: "person",
470
- > namespace: "myAppNamespace"
471
- > });
472
- @param config - Configuration settings or a MetadataStore. If this parameter is just a MetadataStore
473
- then what will be created is an 'anonymous' type that will never be communicated to or from the server. It is purely for
474
- client side use and will be given an automatically generated name. Normally, however, you will use a configuration object.
475
- **/
476
- constructor(config: MetadataStore | EntityTypeConfig);
477
- /**
478
- General purpose property set method
479
- > // assume em1 is an EntityManager containing a number of existing entities.
480
- > let custType = em1.metadataStore.getEntityType("Customer");
481
- > custType.setProperties( {
482
- > autoGeneratedKeyType: AutoGeneratedKeyType.Identity;
483
- > defaultResourceName: "CustomersAndIncludedOrders"
484
- > )};
485
- @param config - a configuration object
486
- **/
487
- setProperties(config: EntityTypeSetConfig): void;
488
- /**
489
- Returns whether this type is a subtype of a specified type.
490
- **/
491
- isSubtypeOf(entityType: EntityType): boolean;
492
- /**
493
- Returns an array containing this type and any/all subtypes of this type down thru the hierarchy.
494
- **/
495
- getSelfAndSubtypes(): this[];
496
- getAllValidators(): Validator[];
497
- /**
498
- Adds a [[DataProperty]] or a [[NavigationProperty]] to this EntityType.
499
- > // assume myEntityType is a newly constructed EntityType.
500
- > myEntityType.addProperty(dataProperty1);
501
- > myEntityType.addProperty(dataProperty2);
502
- > myEntityType.addProperty(navigationProperty1);
503
- **/
504
- addProperty(property: EntityProperty): void;
505
- /** @hidden @internal */
506
- _updateFromBase(baseEntityType: EntityType): void;
507
- /** @hidden @internal */
508
- _addPropertyCore(property: EntityProperty, shouldResolve?: boolean): void;
509
- /**
510
- Create a new entity of this type.
511
- > // assume em1 is an EntityManager containing a number of existing entities.
512
- > let custType = em1.metadataStore.getAsEntityType("Customer");
513
- > let cust1 = custType.createEntity();
514
- > em1.addEntity(cust1);
515
- @param initialValues- Configuration object of the properties to set immediately after creation.
516
- @return The new entity.
517
- **/
518
- createEntity(initialValues?: any): any;
519
- /** @hidden @internal */
520
- _createInstanceCore(): StructuralObject;
521
- /** @hidden @internal */
522
- _initializeInstance(instance: any): void;
523
- /**
524
- Returns the constructor for this EntityType.
525
- @param forceRefresh - Whether to ignore any cached version of this constructor. (default == false)
526
- @return The constructor for this EntityType.
527
- **/
528
- getCtor(forceRefresh?: boolean): {
529
- new (): StructuralObject;
530
- };
531
- /** @hidden @internal */
532
- _setCtor(aCtor: {
533
- new (): StructuralObject;
534
- }, interceptor?: any): void;
535
- /**
536
- Adds either an entity or property level validator to this EntityType.
537
- > // assume em1 is an EntityManager containing a number of existing entities.
538
- > let custType = em1.metadataStore.getEntityType("Customer");
539
- > let countryProp = custType.getProperty("Country");
540
- > let valFn = function (v) {
541
- > if (v == null) return true;
542
- > return (core.stringStartsWith(v, "US"));
543
- > };
544
- > let countryValidator = new Validator("countryIsUS", valFn,
545
- > { displayName: "Country", messageTemplate: "'%displayName%' must start with 'US'" });
546
- > custType.addValidator(countryValidator, countryProp);
547
-
548
- This is the same as adding an entity level validator via the 'validators' property of DataProperty or NavigationProperty
549
- > countryProp.validators.push(countryValidator);
550
-
551
- Entity level validators can also be added by omitting the 'property' parameter.
552
- > custType.addValidator(someEntityLevelValidator);
553
-
554
- or
555
- > custType.validators.push(someEntityLevelValidator);
556
- @param validator - Validator to add.
557
- @param property - Property to add this validator to. If omitted, the validator is assumed to be an
558
- entity level validator and is added to the EntityType's 'validators'.
559
- **/
560
- addValidator(validator: Validator, property?: EntityProperty | string): void;
561
- /**
562
- Returns all of the properties ( dataProperties and navigationProperties) for this EntityType.
563
- > // assume em1 is an EntityManager containing a number of existing entities.
564
- > let custType = em1.metadataStore.getEntityType("Customer");
565
- > let arrayOfProps = custType.getProperties();
566
- @return An array of Data and Navigation properties.
567
- **/
568
- getProperties(): EntityProperty[];
569
- /**
570
- Returns all of the property names ( for both dataProperties and navigationProperties) for this EntityType.
571
- > // assume em1 is an EntityManager containing a number of existing entities.
572
- > let custType = em1.metadataStore.getEntityType("Customer");
573
- > let arrayOfPropNames = custType.getPropertyNames();
574
- **/
575
- getPropertyNames(): any[];
576
- /**
577
- Returns a data property with the specified name or null.
578
- > // assume em1 is an EntityManager containing a number of existing entities.
579
- > let custType = em1.metadataStore.getEntityType("Customer");
580
- > let customerNameDataProp = custType.getDataProperty("CustomerName");
581
- @return A DataProperty or null if not found.
582
- **/
583
- getDataProperty(propertyName: string): DataProperty;
584
- /**
585
- Returns a navigation property with the specified name or null.
586
- > // assume em1 is an EntityManager containing a number of existing entities.
587
- > let custType = em1.metadataStore.getEntityType("Customer");
588
- > let customerOrdersNavProp = custType.getDataProperty("Orders");
589
- @return A NavigationProperty or null if not found.
590
- **/
591
- getNavigationProperty(propertyName: string): NavigationProperty;
592
- /**
593
- Returns either a DataProperty or a NavigationProperty with the specified name or null.
594
-
595
- This method also accepts a '.' delimited property path and will return the 'property' at the
596
- end of the path.
597
- > let custType = em1.metadataStore.getEntityType("Customer");
598
- > let companyNameProp = custType.getProperty("CompanyName");
599
-
600
- This method can also walk a property path to return a property
601
- > let orderDetailType = em1.metadataStore.getEntityType("OrderDetail");
602
- > let companyNameProp2 = orderDetailType.getProperty("Order.Customer.CompanyName");
603
- > // companyNameProp === companyNameProp2
604
- @param [throwIfNotFound=false] {Boolean} Whether to throw an exception if not found.
605
- @return A DataProperty or NavigationProperty or null if not found.
606
- **/
607
- getProperty(propertyPath: string, throwIfNotFound?: boolean): EntityProperty;
608
- /** @hidden @internal */
609
- getPropertiesOnPath(propertyPath: string, useServerName: boolean | null, throwIfNotFound?: boolean): EntityProperty[];
610
- /** For use in pluggable adapters. */
611
- clientPropertyPathToServer(propertyPath: string, delimiter?: string): string;
612
- /** For use in pluggable adapters. */
613
- getEntityKeyFromRawEntity(rawEntity: any, rawValueFn: Function): EntityKey;
614
- /** @hidden @internal */
615
- _updateTargetFromRaw(target: StructuralObject, raw: any, rawValueFn: Function): void;
616
- /**
617
- Returns a string representation of this EntityType.
618
- **/
619
- toString(): string;
620
- toJSON(): Object;
621
- /** @hidden @internal */
622
- _updateNames(property: EntityProperty): void;
623
- /** @hidden @internal */
624
- _checkNavProperty(navigationProperty: NavigationProperty | string): NavigationProperty;
625
- /** @hidden @internal */
626
- _addDataProperty(dp: DataProperty): void;
627
- /** @hidden @internal */
628
- _addNavigationProperty(np: NavigationProperty): void;
629
- /** @hidden @internal */
630
- _updateCps(): void;
631
- /** @hidden @internal */
632
- _updateNps(): void;
633
- }
634
- export interface ComplexTypeConfig {
635
- shortName?: string;
636
- namespace?: string;
637
- dataProperties?: DataProperty[] | Object[] | Object;
638
- isComplexType?: boolean;
639
- custom?: any;
640
- }
641
- /** Container for all of the metadata about a specific type of Complex object.
642
- > let complexType = new ComplexType( {
643
- > shortName: "address",
644
- > namespace: "myAppNamespace"
645
- > });
646
- @param config - Configuration settings
647
- **/
648
- export declare class ComplexType {
649
- /** @hidden @internal */
650
- _$typeName: string;
651
- /** For polymorphic purpose only - always true here */
652
- isComplexType: boolean;
653
- /** The [[MetadataStore]] containing this ComplexType. */
654
- metadataStore: MetadataStore;
655
- /** The fully qualifed name of this ComplexType. __Read Only__ **/
656
- name: string;
657
- /** The short, unqualified, name for this ComplexType. __Read Only__ **/
658
- shortName: string;
659
- /** The namespace for this ComplexType. __Read Only__ **/
660
- namespace: string;
661
- /** The DataProperties (see [[DataProperty]] associated with this ComplexType. __Read Only__ */
662
- dataProperties: DataProperty[];
663
- /** The DataProperties for this ComplexType that contain instances of a [[ComplexType]]. __Read Only__ */
664
- complexProperties: DataProperty[];
665
- /**
666
- The entity level validators associated with this ComplexType. Validators can be added and
667
- removed from this collection. __Read Only__ **/
668
- validators: Validator[];
669
- /** For polymorphic purpose only - always empty here */
670
- concurrencyProperties: DataProperty[];
671
- /** The DataProperties associated with this ComplexType that are not mapped to any backend datastore. These are effectively free standing
672
- properties. __Read Only__ **/
673
- unmappedProperties: DataProperty[];
674
- navigationProperties: DataProperty[];
675
- keyProperties: DataProperty[];
676
- warnings: any[];
677
- serializerFn?: (prop: EntityProperty, val: any) => any;
678
- /** A free form object that can be used to define any custom metadata for this ComplexType. ***/
679
- custom?: any;
680
- /** @hidden @internal */
681
- _mappedPropertiesCount: number;
682
- /** @hidden @internal */
683
- _extra?: any;
684
- /** See [[EntityType.getCtor]] */
685
- getCtor: (forceRefresh?: boolean) => new () => StructuralObject;
686
- createInstance: (initialValues?: any) => any;
687
- /** See [EntityType.addValidator] */
688
- addValidator: (validator: Validator, property?: string | EntityProperty) => void;
689
- getProperty: (propertyPath: string, throwIfNotFound?: boolean) => EntityProperty;
690
- getPropertiesOnPath: (propertyPath: string, useServerName: boolean, throwIfNotFound?: boolean) => EntityProperty[];
691
- getPropertyNames: () => any[];
692
- /** @hidden @internal */
693
- _addPropertyCore: (property: EntityProperty, shouldResolve?: boolean) => void;
694
- /** @hidden @internal */
695
- _addDataProperty: (dp: DataProperty) => void;
696
- /** @hidden @internal */
697
- _updateNames: (property: EntityProperty) => void;
698
- /** @hidden @internal */
699
- _updateCps: () => void;
700
- /** @hidden @internal */
701
- _initializeInstance: (instance: any) => void;
702
- /** @hidden @internal */
703
- _updateTargetFromRaw: (target: StructuralObject, raw: any, rawValueFn: Function) => void;
704
- /** @hidden @internal */
705
- _setCtor: (aCtor: new () => StructuralObject, interceptor?: any) => void;
706
- constructor(config: ComplexTypeConfig);
707
- /**
708
- General purpose property set method
709
- > // assume em1 is an EntityManager
710
- > let addresstType = em1.metadataStore.getEntityType("Address");
711
- > addressType.setProperties( {
712
- > custom: { foo: 7, bar: "test" }
713
- > });
714
- @param config - Custom config object
715
- @param config.custom - {Object}
716
- **/
717
- setProperties(config: {
718
- custom?: any;
719
- }): void;
720
- getAllValidators(): Validator[];
721
- /** @hidden @internal */
722
- _createInstanceCore(parent: StructuralObject, parentProperty: DataProperty): ComplexObject;
723
- addProperty(dataProperty: DataProperty): void;
724
- getProperties(): EntityProperty[];
725
- toJSON(): Object;
726
- }
727
- export interface DataPropertyConfig {
728
- name?: string;
729
- nameOnServer?: string;
730
- dataType?: DataType | string | ComplexType;
731
- complexTypeName?: string;
732
- isNullable?: boolean;
733
- isScalar?: boolean;
734
- defaultValue?: any;
735
- isPartOfKey?: boolean;
736
- isUnmapped?: boolean;
737
- isSettable?: boolean;
738
- concurrencyMode?: string;
739
- maxLength?: number;
740
- validators?: Validator[];
741
- displayName?: string;
742
- enumType?: string;
743
- rawTypeName?: string;
744
- custom?: any;
745
- }
746
- /**
747
- A DataProperty describes the metadata for a single property of an [[EntityType]] that contains simple data.
748
-
749
- Instances of the DataProperty class are constructed automatically during Metadata retrieval. However it is also possible to construct them
750
- directly via the constructor.
751
- **/
752
- export declare class DataProperty {
753
- /** @hidden @internal */
754
- _$typeName: string;
755
- /** Is this a DataProperty? - always true here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
756
- isDataProperty: boolean;
757
- /** Is this a NavigationProperty? - always false here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
758
- isNavigationProperty: boolean;
759
- /** The name of this property. __Read Only__ **/
760
- name: string;
761
- /** The name of this property on the server. __Read Only__ **/
762
- nameOnServer: string;
763
- /** The [[DataType]] of this property. __Read Only__ */
764
- dataType: DataType | ComplexType;
765
- /** The name of the [[ComplexType]] associated with this property; may be null. __Read Only__ */
766
- complexTypeName: string;
767
- /** The [[ComplexType]] associated with this property; may be undefined. __Read Only__ */
768
- complexType?: ComplexType;
769
- /** Whether the contents of this property is an instance of a [[ComplexType]]. __Read Only__ */
770
- isComplexProperty: boolean;
771
- /** Whether this property is nullable. __Read Only__ */
772
- isNullable: boolean;
773
- /** Whether this property is scalar (i.e., returns a single value as opposed to an array). __Read Only__ */
774
- isScalar: boolean;
775
- /** The default value for this property. __Read Only__ */
776
- defaultValue: any;
777
- /** Whether this property is a 'key' property. __Read Only__ */
778
- isPartOfKey: boolean;
779
- /** Whether this property is an 'unmapped' property. __Read Only__ */
780
- isUnmapped: boolean;
781
- /** Whether this property is 'settable'. __Read Only__ */
782
- isSettable: boolean;
783
- concurrencyMode: string;
784
- /** The maximum length for the value of this property. Only meaningful for strings. __Read Only__ */
785
- maxLength?: number;
786
- /** The [[Validator]] instances that are associated with this property. Validators can be added and
787
- removed from this collection. __Read Only__ */
788
- validators: Validator[];
789
- /** The display name of this property. __Read Only__ */
790
- displayName: string;
791
- /** The full name of the enum type */
792
- enumType?: string;
793
- /** The raw type name of this property. will only be defined for properties with a DataType of 'Undefined' */
794
- rawTypeName?: string;
795
- /** A free form object that can be used to define any custom metadata for this DataProperty. __Read Only__ */
796
- custom?: any;
797
- inverseNavigationProperty?: NavigationProperty;
798
- /**
799
- The navigation property related to this property. Will only be set if this is a foreign key property. __Read Only__ */
800
- relatedNavigationProperty?: NavigationProperty;
801
- /** The parent type that this property belongs to - will be either a [[EntityType]] or a [[ComplexType]]. __Read Only__ */
802
- parentType: StructuralType;
803
- /** Property on the base type that this property is inherited from. Will be null if the property is not on the base type. __Read Only__ */
804
- baseProperty?: DataProperty;
805
- /** DataProperty constructor
806
- > let lastNameProp = new DataProperty( {
807
- > name: "lastName",
808
- > dataType: DataType.String,
809
- > isNullable: true,
810
- > maxLength: 20
811
- > });
812
- > // assuming personEntityType is a newly constructed EntityType
813
- > personEntityType.addProperty(lastNameProperty);
814
- @param config - A configuration Object or a DataProperty
815
- */
816
- constructor(config: DataPropertyConfig | DataProperty);
817
- static getRawValueFromServer(rawEntity: Object & Record<string, any>, dp: DataProperty): any;
818
- static getRawValueFromClient(rawEntity: Object & Record<string, any>, dp: DataProperty): any;
819
- resolveProperty(propName: string): any;
820
- formatName(): string;
821
- /**
822
- General purpose property set method
823
- > // assume em1 is an EntityManager
824
- > let prop = myEntityType.getProperty("myProperty");
825
- > prop.setProperties( {
826
- > custom: { foo: 7, bar: "test" }
827
- > });
828
- @param config - A configuration object.
829
- **/
830
- setProperties(config: {
831
- displayName?: string;
832
- custom?: Object;
833
- }): void;
834
- getAllValidators(): Validator[];
835
- toJSON(): Object;
836
- static fromJSON(json: any): DataProperty;
837
- }
838
- export interface NavigationPropertyConfig {
839
- name?: string;
840
- nameOnServer?: string;
841
- entityTypeName?: string;
842
- isScalar?: boolean;
843
- associationName?: string;
844
- foreignKeyNames?: string[];
845
- foreignKeyNamesOnServer?: string[];
846
- invForeignKeyNames?: string[];
847
- invForeignKeyNamesOnServer?: string[];
848
- validators?: Validator[];
849
- displayName?: string;
850
- custom?: any;
851
- }
852
- /** A NavigationProperty describes the metadata for a single property of an [[EntityType]] that return instances of other EntityTypes.
853
-
854
- Instances of the NavigationProperty class are constructed automatically during Metadata retrieval. However it is also possible to construct them
855
- directly via the constructor.
856
- **/
857
- export declare class NavigationProperty {
858
- /** @hidden @internal */
859
- _$typeName: string;
860
- /** Is this a DataProperty? - always false here
861
- Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
862
- isDataProperty: boolean;
863
- /** Is this a NavigationProperty? - always true here
864
- Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
865
- isNavigationProperty: boolean;
866
- formatName: () => string;
867
- getAllValidators: () => Validator[];
868
- resolveProperty: (propName: string) => any;
869
- /** The [[EntityType]] returned by this property. __Read Only__ */
870
- entityType: EntityType;
871
- /** The name of the [[EntityType]] returned by this property. __Read Only__ */
872
- entityTypeName: string;
873
- /** The [[EntityType]] that this property belongs to. ( same as entityType). __Read Only__ */
874
- parentType: EntityType;
875
- /** The [[EntityType]] that this property belongs to. ( same as entityType). __Read Only__ */
876
- parentEntityType: EntityType;
877
- /** Property on the base type that this property is inherited from. Will be null if the property is not on the base type. __Read Only__ */
878
- baseProperty?: NavigationProperty;
879
- /** The inverse of this NavigationProperty. The NavigationProperty that represents a navigation in the opposite direction
880
- to this NavigationProperty. May be undefined for a undirectional NavigationProperty. __Read Only__ */
881
- private _inverse?;
882
- /** The name of this property. __Read Only__ */
883
- name: string;
884
- /** The name of this property on the server. __Read Only__ */
885
- nameOnServer: string;
886
- /**
887
- Whether this property returns a single entity as opposed to an array of entities. __Read Only__ */
888
- isScalar: boolean;
889
- /** The name of the association to which that this property belongs. This associationName will be shared with this
890
- properties 'inverse'. __Read Only__ */
891
- associationName: string;
892
- /** The names of the foreign key DataProperties associated with this NavigationProperty. There will usually only be a single DataProperty associated
893
- with a Navigation property except in the case of entities with multipart keys. __Read Only__ */
894
- foreignKeyNames: string[];
895
- /** The server side names of the foreign key DataProperties associated with this NavigationProperty. There will usually only be a single DataProperty associated
896
- with a Navigation property except in the case of entities with multipart keys. __Read Only__ */
897
- foreignKeyNamesOnServer: string[];
898
- /** The names of the foreign key DataProperties at the other end of the relationship. __Read Only__ */
899
- invForeignKeyNames: string[];
900
- /** The server side names of the foreign key DataProperties at the other end of the relationship. __Read Only__ */
901
- invForeignKeyNamesOnServer: string[];
902
- /** The 'foreign key' DataProperties associated with this NavigationProperty. There will usually only be a single DataProperty associated
903
- with a Navigation property except in the case of entities with multipart keys. __Read Only__ */
904
- relatedDataProperties: DataProperty[];
905
- /** The [[Validator]] instances that are associated with this property. Validators can be added and
906
- removed from this collection. __Read Only__ */
907
- validators: Validator[];
908
- /** The display name of this property. __Read Only__ */
909
- displayName: string;
910
- isUnmapped: boolean;
911
- /** A free form object that can be used to define any custom metadata for this NavigationProperty. **/
912
- custom: any;
913
- /** NavigationProperty constructor
914
- > let homeAddressProp = new NavigationProperty( {
915
- > name: "homeAddress",
916
- > entityTypeName: "Address:#myNamespace",
917
- > isScalar: true,
918
- > associationName: "address_person",
919
- > foreignKeyNames: ["homeAddressId"]
920
- > });
921
- > let homeAddressIdProp = new DataProperty( {
922
- > name: "homeAddressId"
923
- > dataType: DataType.Integer
924
- > });
925
- > // assuming personEntityType is a newly constructed EntityType
926
- > personEntityType.addProperty(homeAddressProp);
927
- > personEntityType.addProperty(homeAddressIdProp);
928
- @param config - A configuration object.
929
- **/
930
- constructor(config: NavigationPropertyConfig);
931
- /**
932
- General purpose property set method
933
- > // assume myEntityType is an EntityType
934
- > let prop = myEntityType.getProperty("myProperty");
935
- > prop.setProperties( {
936
- > custom: { foo: 7, bar: "test" }
937
- > });
938
- @param config - A config object
939
- **/
940
- setProperties(config: {
941
- displayName?: string;
942
- foreignKeyNames?: string[];
943
- invForeignKeyNames?: string[];
944
- inverse?: NavigationProperty | string;
945
- custom?: any;
946
- }): void;
947
- /** The inverse of this NavigationProperty. The NavigationProperty that represents a navigation in the opposite direction
948
- to this NavigationProperty. May be undefined for a undirectional NavigationProperty. __Read Only__ */
949
- get inverse(): NavigationProperty | undefined;
950
- /** @hidden @internal */
951
- getInverse(): NavigationProperty | undefined;
952
- setInverse(inverseNp: NavigationProperty | string): void;
953
- toJSON(): Object;
954
- static fromJSON(json: any): NavigationProperty;
955
- /** @hidden @internal */
956
- _resolveNp(): void;
957
- }
958
- /**
959
- AutoGeneratedKeyType is an 'Enum' containing all of the valid states for an automatically generated key.
960
- **/
961
- export declare class AutoGeneratedKeyType extends BreezeEnum {
962
- /**
963
- This entity does not have an autogenerated key.
964
- The client must set the key before adding the entity to the EntityManager
965
- **/
966
- static None: AutoGeneratedKeyType;
967
- /**
968
- This entity's key is an Identity column and is set by the backend database.
969
- Keys for new entities will be temporary until the entities are saved at which point the keys will
970
- be converted to their 'real' versions.
971
- **/
972
- static Identity: AutoGeneratedKeyType;
973
- /**
974
- This entity's key is generated by a KeyGenerator and is set by the backend database.
975
- Keys for new entities will be temporary until the entities are saved at which point the keys will
976
- be converted to their 'real' versions.
977
- **/
978
- static KeyGenerator: AutoGeneratedKeyType;
979
- }
980
- /** @hidden @internal */
981
- declare module "./assert-param" {
982
- interface Param {
983
- isEntity(): Param;
984
- isEntityProperty(): Param;
985
- }
986
- }
987
- export declare function qualifyTypeName(shortName: string, ns?: string): string;
988
- export {};