breeze-client 2.2.1 → 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 +62 -93
  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
package/core/core.d.ts ADDED
@@ -0,0 +1,285 @@
1
+ /** The success callback accepted by the deprecated callback form of the async methods.
2
+ @deprecated Await the returned promise instead of passing callbacks. */
3
+ export interface Callback {
4
+ (data: any): void;
5
+ }
6
+ type Predicate<T> = (i: T) => boolean;
7
+ declare function objectForEach(obj: Object, kvFn: (key: string, val: any) => any): void;
8
+ declare function objectMap(obj: Object, kvFn?: (key: string, val: any) => any): any[];
9
+ declare function objectFirst(obj: Object, kvPredicate: (key: string, val: any) => boolean): {
10
+ /** The property's name. */
11
+ key: string;
12
+ /** The property's value. */
13
+ value: any;
14
+ } | null;
15
+ declare function isSettable(obj: Object, propertyName: string): boolean;
16
+ declare function getPropDescriptor(obj: Object, propertyName: string): PropertyDescriptor | undefined;
17
+ /** can be used like: persons.filter(propEq("firstName", "John")) */
18
+ declare function propEq(propertyName: string, value: any): (obj: Object) => boolean;
19
+ /** can be used like: persons.filter(propEq("firstName", "FirstName", "John")) */
20
+ declare function propsEq(property1Name: string, property2Name: string, value: any): (obj: Object) => boolean;
21
+ /** can be used like persons.map(pluck("firstName")) */
22
+ declare function pluck(propertyName: any): (obj: Object) => any;
23
+ /** Return an array of property values from source */
24
+ declare function getOwnPropertyValues(source: Object): any[];
25
+ /** Copy properties from source to target. Returns target. */
26
+ declare function extend(target: Object, source?: Object, propNames?: string[]): Object;
27
+ /** Copy properties from defaults iff undefined on target. Returns target. */
28
+ declare function updateWithDefaults(target: Object, defaults: Object): any;
29
+ /** Set ctor.defaultInstance to an instance of ctor with properties from target.
30
+ We want to insure that the object returned by ctor.defaultInstance is always immutable
31
+ Use 'target' as the primary template for the ctor.defaultInstance;
32
+ Use current 'ctor.defaultInstance' as the template for any missing properties
33
+ creates a new instance for ctor.defaultInstance
34
+ returns target unchanged */
35
+ declare function setAsDefault(target: Object, ctor: {
36
+ new (...args: any[]): any;
37
+ defaultInstance?: any;
38
+ }): any;
39
+ /**
40
+ 'source' is an object that will be transformed into another
41
+ 'template' is a map where the
42
+ keys: are the keys to return
43
+ if a key contains ','s then the key is treated as a delimited string with first of the
44
+ keys being the key to return and the others all valid aliases for this key
45
+ 'values' are either
46
+ 1) the 'default' value of the key
47
+ 2) a function that takes in the source value and should return the value to set
48
+ The value from the source is then set on the target,
49
+ after first passing thru the fn, if provided, UNLESS:
50
+ 1) it is the default value
51
+ 2) it is undefined ( nulls WILL be set)
52
+ 'target' is optional
53
+ - if it exists then properties of the target will be set ( overwritten if the exist)
54
+ - if it does not exist then a new object will be created as filled.
55
+ 'target is returned.
56
+ */
57
+ declare function toJson(source: Object, template: Object, target?: Object): Object;
58
+ /** Replacer function for toJSONSafe, when serializing entities. Excludes entityAspect and other internal properties. */
59
+ declare function toJSONSafeReplacer(prop: string, val: any): any;
60
+ /** Safely perform toJSON logic on objects with cycles. */
61
+ declare function toJSONSafe(obj: any, replacer?: (prop: string, value: any) => any): any;
62
+ /** Resolves the values of a list of properties by checking each property in multiple sources until a value is found. */
63
+ declare function resolveProperties(sources: Object[], propertyNames: string[]): any;
64
+ declare function toArray(item: any): any[];
65
+ /** a version of Array.map that doesn't require an array, i.e. works on arrays and scalars. */
66
+ declare function map<T>(items: T | T[], fn: (v: T, ix?: number) => any, includeNull?: boolean): any | any[];
67
+ /** Return first element matching predicate */
68
+ declare function arrayFirst<T>(array: T[], predicate: Predicate<any>): T;
69
+ /** Return index of first element matching predicate */
70
+ declare function arrayIndexOf<T>(array: T[], predicate: Predicate<any>): number;
71
+ /** Add item if not already in array */
72
+ declare function arrayAddItemUnique<T>(array: T[], item: T): void;
73
+ /** Remove items from the array
74
+ * @param array
75
+ * @param predicateOrItem - item to remove, or function to determine matching item
76
+ * @param shouldRemoveMultiple - true to keep removing after first match, false otherwise
77
+ */
78
+ declare function arrayRemoveItem<T>(array: T[], predicateOrItem: T | Predicate<T>, shouldRemoveMultiple?: boolean): boolean;
79
+ /** Combine array elements using the callback. Returns array with length == min(a1.length, a2.length) */
80
+ declare function arrayZip(a1: any[], a2: any[], callback: (x1: any, x2: any) => any): any[];
81
+ declare function arrayEquals(a1: any[], a2: any[], equalsFn?: (x1: any, x2: any) => boolean): boolean;
82
+ /** Returns the array stored under key, creating it if absent. */
83
+ declare function getMapArray<K, V>(map: Map<K, V[]>, key: K): V[];
84
+ /** Execute fn while obj has tempValue for property */
85
+ declare function using(obj: Object, property: string, tempValue: any, fn: () => any): any;
86
+ /** Call state = startFn(), call fn(), call endFn(state) */
87
+ declare function wrapExecution(startFn: () => any, endFn: (state: any) => any, fn: () => any): any;
88
+ /** Remember & return the value of fn() when it was called with its current args */
89
+ declare function memoize(fn: any): any;
90
+ declare function durationToSeconds(duration: string): number;
91
+ declare function noop(): void;
92
+ declare function identity(x: any): any;
93
+ declare function isDate(o: any): boolean;
94
+ declare function isDateString(s: string): boolean;
95
+ declare function isFunction(o: any): boolean;
96
+ declare function isGuid(value: any): boolean;
97
+ declare function isDuration(value: any): boolean;
98
+ declare function isEmpty(obj: any): boolean;
99
+ /**
100
+ * Replaces `%1`, `%2`, ... in `str` with the arguments that follow it.
101
+ *
102
+ * formatString("a %1 and a %2", "cat", "dog") // "a cat and a dog"
103
+ *
104
+ * It declared rest parameters and then read `arguments` anyway, and compiled a fresh `RegExp`
105
+ * on every call to bound the placeholder to the number of arguments given - so `%3` with two
106
+ * arguments was left in place rather than replaced. One shared pattern does the same thing:
107
+ * a placeholder with no argument for it is left alone here too.
108
+ * @hidden
109
+ */
110
+ export declare function formatString(str: string, ...params: any[]): string;
111
+ /** @hidden */
112
+ export declare function arrayFlatMap<T, U>(arr: T[], mapFn: (arg: T) => U[]): U[];
113
+ /**
114
+ * A version 4 UUID.
115
+ *
116
+ * `crypto.randomUUID()` where it exists, which is everywhere Breeze supports except a browser
117
+ * outside a secure context - it is unavailable over plain HTTP. It is both properly random and
118
+ * about 30x faster than building one out of `Math.random()`, which matters because this is what
119
+ * names a new entity with a Guid key.
120
+ *
121
+ * The fallback is the old implementation. `Math.random()` is not a cryptographic source, so the
122
+ * values it produces are unique enough for a client-side temporary key and should not be relied
123
+ * on for anything else.
124
+ * @hidden
125
+ */
126
+ export declare function getUuid(): string;
127
+ /** @hidden */
128
+ export declare function stringStartsWith(str: string, prefix: string): boolean;
129
+ /** @hidden */
130
+ export declare function stringEndsWith(str: string, suffix: string): boolean;
131
+ /** Utility functions that Breeze 2.x exposed as `breeze.core`, kept for code written against 2.x.
132
+ Several now just call a JavaScript built-in; those are marked deprecated and name it. */
133
+ export declare const core: {
134
+ /** @deprecated Use `Object.hasOwn(obj, key)`, which this now calls. */
135
+ hasOwnProperty: (obj: Object, key: string) => boolean;
136
+ /** The values of an object's own enumerable properties. `Object.values(obj)`, except that null
137
+ or undefined gives `[]`. */
138
+ getOwnPropertyValues: typeof getOwnPropertyValues;
139
+ /** The descriptor of `propertyName` on `obj` or, failing that, on the nearest prototype that
140
+ has it; `undefined` if none does. Unlike `Object.getOwnPropertyDescriptor`, it searches the
141
+ prototype chain. */
142
+ getPropertyDescriptor: typeof getPropDescriptor;
143
+ /** Calls `kvFn(key, value)` for each of an object's own enumerable properties. Does nothing for
144
+ null or undefined. */
145
+ objectForEach: typeof objectForEach;
146
+ /** The first of an object's own enumerable properties for which `kvPredicate(key, value)` is
147
+ true, as `{ key, value }`; `null` if there is none. */
148
+ objectFirst: typeof objectFirst;
149
+ /** Calls `kvFn(key, value)` for each of an object's own enumerable properties and returns the
150
+ results, leaving out any that are `undefined`. Without `kvFn`, returns the values. */
151
+ objectMap: typeof objectMap;
152
+ /** Copies properties from `source` onto `target` and returns `target`: all of `source`'s own
153
+ enumerable properties, or only `propNames` when given. A shallow copy, like `Object.assign`. */
154
+ extend: typeof extend;
155
+ /** A predicate that is true for an object whose `propertyName` is `=== value`:
156
+ `people.filter(core.propEq('firstName', 'John'))`. */
157
+ propEq: typeof propEq;
158
+ /** A predicate that is true for an object whose `property1Name` or `property2Name` is
159
+ `=== value`. */
160
+ propsEq: typeof propsEq;
161
+ /** A function that returns an object's `propertyName`: `people.map(core.pluck('firstName'))`. */
162
+ pluck: typeof pluck;
163
+ /** `Array.prototype.map` that also takes a single value, which it passes to `fn` and returns
164
+ the result of. Null or undefined is returned as is. With `includeNull` false, an element
165
+ whose result is null or undefined is left as a hole in the returned array. */
166
+ map: typeof map;
167
+ /** An object with each of `propertyNames` taken from the first of `sources` in which it is not
168
+ `undefined`. Breeze uses it to combine a query's settings with its manager's and the
169
+ defaults, in {@link QueryOptions.resolve} and {@link DataService.resolve}. */
170
+ resolveProperties: typeof resolveProperties;
171
+ /** Creates an instance of `ctor` from `target`, fills in whatever it leaves unset from the
172
+ current `ctor.defaultInstance`, and makes that the new `ctor.defaultInstance`. Returns
173
+ `target`. The `setAsDefault()` methods of {@link QueryOptions}, {@link SaveOptions},
174
+ {@link NamingConvention} and {@link LocalQueryComparisonOptions} are built on it. */
175
+ setAsDefault: typeof setAsDefault;
176
+ /** Copies each property of `defaults` onto `target` where `target`'s is `undefined`, and
177
+ returns `target`. */
178
+ updateWithDefaults: typeof updateWithDefaults;
179
+ /** The array stored in `map` under `key`, after storing an empty one there if there was none. */
180
+ getMapArray: typeof getMapArray;
181
+ /** `[]` for null or undefined, the array itself for an array, and `[item]` for anything else. */
182
+ toArray: typeof toArray;
183
+ /** Whether two arrays have the same length and equal elements, compared with `===` or with
184
+ `equalsFn` if given. An element that is itself an array is compared element by element, with
185
+ `===`. False if either array is null or undefined. */
186
+ arrayEquals: typeof arrayEquals;
187
+ /** @deprecated Use `arr.slice(start, end)`, or `Array.prototype.slice.call(arrayLike)` for
188
+ an arguments object. That is what this now does. */
189
+ arraySlice: (ar: any[], start?: number, end?: number) => any[];
190
+ /** The first element for which `predicate` is true, or `null`. Like `Array.prototype.find`,
191
+ except for returning `null` rather than `undefined`. */
192
+ arrayFirst: typeof arrayFirst;
193
+ /** The index of the first element for which `predicate` is true, or -1. The same as
194
+ `Array.prototype.findIndex`. */
195
+ arrayIndexOf: typeof arrayIndexOf;
196
+ /** Removes from `array`, in place, either `predicateOrItem` itself or the elements that
197
+ `predicateOrItem`, a function, matches. Removes only the last match unless
198
+ `shouldRemoveMultiple` is true. Returns whether anything was removed. */
199
+ arrayRemoveItem: typeof arrayRemoveItem;
200
+ /** Combines the elements of two arrays pairwise with `callback`. The result is as long as the
201
+ shorter array. */
202
+ arrayZip: typeof arrayZip;
203
+ /** Pushes `item` onto `array` unless the array already holds it. */
204
+ arrayAddItemUnique: typeof arrayAddItemUnique;
205
+ /** @deprecated Use `arr.flatMap(fn)`, which this now calls. */
206
+ arrayFlatMap: typeof arrayFlatMap;
207
+ /** Sets `obj[property]` to `tempValue`, calls `fn`, then restores the original value, deleting
208
+ the property if it had none, whether or not `fn` throws. Returns what `fn` returns. */
209
+ using: typeof using;
210
+ /** Calls `startFn()`, then `fn()`, then `endFn(state)` with what `startFn` returned, whether or
211
+ not `fn` throws. If it throws and the state is an object, the error is set on `state.error`
212
+ first. Returns what `fn` returns. */
213
+ wrapExecution: typeof wrapExecution;
214
+ /** Wraps `fn` so that it runs once for each distinct set of arguments and afterwards returns
215
+ the stored result. Arguments are keyed by value, objects by their `JSON.stringify`. The
216
+ results are stored on `fn` itself and never released. */
217
+ memoize: typeof memoize;
218
+ /** @deprecated Use `crypto.randomUUID()`. This calls it where it exists and falls back to a
219
+ `Math.random()` implementation in a browser outside a secure context, where it does not. */
220
+ getUuid: typeof getUuid;
221
+ /** Converts an ISO 8601 duration such as `PT1H30M` to seconds, counting a year as 360 days and
222
+ a month as 30. Throws for a string that is not a duration. */
223
+ durationToSeconds: typeof durationToSeconds;
224
+ /** Whether `obj[propertyName]` can be assigned: true if no object on the prototype chain
225
+ defines it, or if its descriptor is writable or has a setter. */
226
+ isSettable: typeof isSettable;
227
+ /** Whether `o` is a `Date` holding a valid time - not an Invalid Date. */
228
+ isDate: typeof isDate;
229
+ /** Whether `s` is an ISO 8601 date-time with a time zone, such as `2024-05-01T10:30:00Z` or
230
+ `2024-05-01T10:30:00.5+02:00`. A string with no time zone, or a date with no time, is not. */
231
+ isDateString: typeof isDateString;
232
+ /** Whether `value` is a string in GUID form: 8-4-4-4-12 hexadecimal digits. */
233
+ isGuid: typeof isGuid;
234
+ /** Whether `value` is a string that looks like an ISO 8601 duration, such as `PT1H`. A quick
235
+ check of its shape, not a full parse - see {@link core.durationToSeconds}. */
236
+ isDuration: typeof isDuration;
237
+ /** Whether `o` is an ordinary function. False for async and generator functions: it checks
238
+ `Object.prototype.toString`, which names those differently. */
239
+ isFunction: typeof isFunction;
240
+ /** Whether `obj` is null, undefined, or has no own enumerable properties. */
241
+ isEmpty: typeof isEmpty;
242
+ /** Returns its argument. */
243
+ identity: typeof identity;
244
+ /** Does nothing. */
245
+ noop: typeof noop;
246
+ /** @deprecated Use `str.startsWith(prefix)`. Not quite the same: this answers `false` for a
247
+ null string and `true` for a null prefix, where the built-in throws and compares against
248
+ the text "null" respectively. Guard the null yourself. */
249
+ stringStartsWith: typeof stringStartsWith;
250
+ /** @deprecated Use `str.endsWith(suffix)`, with the same caveat about nulls as
251
+ {@link core.stringStartsWith}. */
252
+ stringEndsWith: typeof stringEndsWith;
253
+ /** Replaces `%1`, `%2`, ... in `str` with the arguments that follow it:
254
+ `formatString('a %1 and a %2', 'cat', 'dog')` is `'a cat and a dog'`. */
255
+ formatString: typeof formatString;
256
+ /** Copies properties of `source` to `target`, a new object by default, as `template` directs,
257
+ and returns `target`. Each key of `template` names a property to copy; a key such as `'a,b'`
258
+ also accepts `b` as another name for `a`. The template's value is the property's default: a
259
+ property equal to it (by `==`), `undefined`, or an empty array is left out. If the
260
+ template's value is a function, it converts the property's value instead, and a
261
+ {@link BreezeEnum} is written as its name. Breeze's metadata classes build their `toJSON`
262
+ output with it. */
263
+ toJson: typeof toJson;
264
+ /** A copy of `obj` that `JSON.stringify` can serialize even when the object graph has cycles: a
265
+ reference back to an object already being copied is left out. Uses an object's own `toJSON`
266
+ when it has one, leaves out functions, and passes each property through `replacer` when
267
+ given, leaving out any it returns `undefined` for. */
268
+ toJSONSafe: typeof toJSONSafe;
269
+ /** A `replacer` for {@link core.toJSONSafe} that leaves out an entity's Breeze members -
270
+ `entityAspect`, `complexAspect`, `entityType`, `complexType`, `getProperty`, `setProperty`
271
+ and `constructor` - and any property whose name starts with `_` or `$`. Breeze serializes
272
+ unmapped property values with it. */
273
+ toJSONSafeReplacer: typeof toJSONSafeReplacer;
274
+ /** Text that Breeze uses in its error messages. */
275
+ strings: {
276
+ /** Advice appended to errors about a query whose entity type Breeze cannot determine. */
277
+ TO_TYPE: string;
278
+ };
279
+ };
280
+ /** The failure callback accepted by the deprecated callback form of the async methods.
281
+ @deprecated Await the returned promise instead of passing callbacks. */
282
+ export interface ErrorCallback {
283
+ (error: any): void;
284
+ }
285
+ export {};