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
@@ -0,0 +1,191 @@
1
+ import type { BaseAdapter } from './config.js';
2
+ import { MappingContext } from '../query/mapping-context.js';
3
+ import { EntityQuery } from '../query/entity-query.js';
4
+ import { MetadataStore } from '../metadata/entity-metadata.js';
5
+ import { JsonResultsAdapter, DataService } from '../metadata/data-service.js';
6
+ import { Entity } from '../entity/entity-aspect.js';
7
+ import { SaveContext, SaveBundle, QueryResult, SaveResult, HttpResponse } from '../manager/entity-manager.js';
8
+ export { InterfaceRegistry } from './config.js';
9
+ /** Adapter names for the deprecated `config.initializeAdapterInstances`. Each is the name of a previously registered adapter. */
10
+ export interface InterfaceRegistryConfig {
11
+ /** e.g. `'fetch'` */
12
+ ajax?: string;
13
+ /** e.g. `'backingStore'` */
14
+ modelLibrary?: string;
15
+ /** e.g. `'webApi'` */
16
+ dataService?: string;
17
+ /** e.g. `'json'` */
18
+ uriBuilder?: string;
19
+ }
20
+ /** DataServiceAdapter Ajax request configuration */
21
+ export interface AjaxConfig {
22
+ /** The request URL, without `params`: `{serviceName}/Metadata`, the save URL, or the query URL the {@link UriBuilderAdapter} built. */
23
+ url: string;
24
+ /** GET, POST, etc. */
25
+ type?: string;
26
+ /** json, etc. */
27
+ dataType?: string;
28
+ /** The `Content-Type` of the request body. The fetch transport sends it only for a request with a body (not GET or HEAD), defaulting to `application/json`. */
29
+ contentType?: string;
30
+ /** Not used by Breeze's own transport. Set to `true` for the deprecated `useJsonp` option, for a registered ajax adapter that acts on it. */
31
+ crossDomain?: string | boolean;
32
+ /** Additional request headers, merged over the `Content-Type` header. Breeze's own adapters do not set any. */
33
+ headers?: {};
34
+ /** The request body. A string is sent as it is; anything else is sent as `JSON.stringify(data)`. Ignored for GET and HEAD. */
35
+ data?: any;
36
+ /** Query-string parameters to append to `url`: the values given to {@link EntityQuery.withParameters}. A `Date` is sent as its ISO string. */
37
+ params?: {};
38
+ /** Called with the response when the request succeeds: a 2xx status and a body that parses as JSON. */
39
+ success: (res: HttpResponse) => void;
40
+ /** Called with the response when the request fails: a non-2xx status, a body that cannot be read, or no response at all (status 0). */
41
+ error: (res: (HttpResponse | Error)) => void;
42
+ }
43
+ /** Request sent by AjaxAdapter.
44
+ @deprecated Part of the ajax adapter contract, which Breeze 3 no longer needs. */
45
+ export interface AjaxRequest {
46
+ /** AjaxAdapter that initiated the request */
47
+ adapter: AjaxAdapter;
48
+ /** Request configuration */
49
+ config: RequestInit;
50
+ /** config from the DataServiceAdapter that called the AjaxAdapter */
51
+ dsaConfig: AjaxConfig;
52
+ /** Function called on response error */
53
+ error: (status: number, statusText: string, body: string | null, response: Response | null, errorThrown: any) => void;
54
+ /** Function called on response success */
55
+ success: (data: any, statusText: string, response: Response) => void;
56
+ }
57
+ /**
58
+ * A fetch-compatible function. This is the seam for supplying your own transport:
59
+ * add auth headers, retry, request signing, route through a framework HTTP client
60
+ * (Angular's HttpClient, so requests pass through its interceptors), or stub it in
61
+ * tests. Defaults to `globalThis.fetch`.
62
+ */
63
+ export type BreezeFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
64
+ /** Handles AJAX requests to server.
65
+ @deprecated Breeze 3 needs no ajax adapter: requests go through `config.fetch`. Set it with
66
+ `configureBreeze({ fetch })`. */
67
+ export interface AjaxAdapter extends BaseAdapter {
68
+ /** Function that performs the ajax request and calls the success or error function */
69
+ ajax(config: AjaxConfig): void;
70
+ /** Container for headers to be added to each request */
71
+ defaultSettings: {
72
+ /** Headers to add to every request, by name. */
73
+ headers?: {
74
+ [name: string]: string;
75
+ };
76
+ };
77
+ /** Function to allow manipulating the request before sending */
78
+ requestInterceptor?: (req: AjaxRequest) => void;
79
+ }
80
+ /** Adapts breeze change-tracking to the UI framework */
81
+ export interface ModelLibraryAdapter extends BaseAdapter {
82
+ /** Returns the names of the properties on an instance of an entity or complex type that the model library would track. Breeze calls it on a new instance of the type's constructor when it prepares the constructor, and adds any names the metadata does not know as unmapped properties. */
83
+ getTrackablePropertyNames: (entity: any) => string[];
84
+ /** Prepares the prototype of an entity or complex type constructor for tracking - for the backing store, adding `getProperty`, `setProperty` and a property accessor for each mapped property. Called when Breeze first sets up a type's constructor, and again when a property is added to a type whose prototype has already been prepared. */
85
+ initializeEntityPrototype(proto: Object): void;
86
+ /** Starts tracking one new entity or complex object - for the backing store, moving its initial values into the backing store and giving each unset property its default value. Called once per instance, when its `EntityAspect` or `ComplexAspect` is created. Despite the parameter's name, Breeze passes the constructor's prototype as the second argument. */
87
+ startTracking(entity: any, entityCtor: Function): void;
88
+ /** Optional. The stored value of a property, without creating anything that reading it would
89
+ create - the backing store builds a collection navigation's array on first read. Breeze
90
+ falls back to `getProperty` for an adapter that does not implement this, which simply
91
+ means the array is created as it always was. */
92
+ peekProperty?(entity: any, propertyName: string): any;
93
+ /** Optional. Called with the {@link EntityType} or {@link ComplexType} to create a constructor for a type that has none registered. Without it, Breeze creates an empty constructor. */
94
+ createCtor?: Function;
95
+ }
96
+ /** Reshapes data moving between breeze and server */
97
+ export interface DataServiceAdapter extends BaseAdapter {
98
+ /**
99
+ Fetches the metadata for a service and imports it into the `MetadataStore`. Called by
100
+ `MetadataStore.fetchMetadata`, and before the first query to a service that has server metadata.
101
+ Resolves with the raw metadata, or with a string saying why there is none (for example, that
102
+ another request already fetched it). Rejects with the server error if the request fails.
103
+ */
104
+ fetchMetadata(metadataStore: MetadataStore, dataService: DataService): Promise<any>;
105
+ /**
106
+ Sends the query in `mappingContext` to the server. Resolves with the raw results, the inline count
107
+ if one was asked for, and the `httpResponse`; Breeze then merges the results into the cache
108
+ through the {@link JsonResultsAdapter}.
109
+ */
110
+ executeQuery(mappingContext: MappingContext): Promise<QueryResult>;
111
+ /**
112
+ Sends the entities in `saveBundle` to the server and resolves with the saved entities and any
113
+ key mappings. Called by `EntityManager.saveChanges`. Rejects with the server error, including
114
+ any per-entity errors, if the save fails.
115
+ */
116
+ saveChanges(saveContext: SaveContext, saveBundle: SaveBundle): Promise<SaveResult>;
117
+ /**
118
+ The constructor of the {@link ChangeRequestInterceptor} the adapter creates for each save, to let
119
+ an application change each entity's save request and the finished array of requests without
120
+ writing its own adapter. Defaults to a no-op interceptor.
121
+ */
122
+ changeRequestInterceptor: ChangeRequestInterceptorCtor;
123
+ /**
124
+ The {@link JsonResultsAdapter} used to read this adapter's query and save results, unless the
125
+ {@link DataService} names one of its own.
126
+ */
127
+ jsonResultsAdapter: JsonResultsAdapter;
128
+ }
129
+ /** Function called by AjaxAdapter before sending request.
130
+ @deprecated Wrap the fetch function instead - see `configureBreeze({ fetch })`. */
131
+ export interface AjaxRequestInterceptor {
132
+ (req: AjaxRequest): void;
133
+ /** Whether to remove the interceptor after it is called */
134
+ oneTime: boolean;
135
+ }
136
+ /** Builds URI for performing queries. Serializes the EntityQuery according to the URI syntax. */
137
+ export interface UriBuilderAdapter extends BaseAdapter {
138
+ /** Returns the URL for the query, relative to the service: its resource name followed by the query in this adapter's syntax. Breeze qualifies it with the service name, and sends the query's `withParameters` values separately, as request params. */
139
+ buildUri(query: EntityQuery, metadataStore: MetadataStore): string;
140
+ }
141
+ /**
142
+ The constructor a {@link DataServiceAdapter} calls to create a {@link ChangeRequestInterceptor}
143
+ for one save. Assign your own to the adapter's `changeRequestInterceptor` property.
144
+ */
145
+ export interface ChangeRequestInterceptorCtor {
146
+ /** Creates the interceptor for one save, given that save's context and the bundle about to be sent. */
147
+ new (saveContext: SaveContext, saveBundle: SaveBundle): ChangeRequestInterceptor;
148
+ }
149
+ /** Allows manipulating data in DataServiceAdapter before sending to server */
150
+ export interface ChangeRequestInterceptor {
151
+ /** Whether to intercept only one save. If set, the adapter goes back to its no-op interceptor after creating this one. */
152
+ oneTime?: boolean;
153
+ /**
154
+ Prepare and return the save data for an entity change-set.
155
+
156
+ The adapter calls this method for each entity in the change-set,
157
+ after it has prepared a "change request" for that object.
158
+
159
+ The method can do anything to the request but it must return a valid, non-null request.
160
+ @example
161
+ this.getRequest = function (request, entity, index) {
162
+ // alter the request that the adapter prepared for this entity
163
+ // based on the entity, saveContext, and saveBundle
164
+ // e.g., add a custom header or prune the originalValuesMap
165
+ return request;
166
+ };
167
+ @param request {Object} The object representing the adapter's request to save this entity.
168
+ @param entity {Entity} The entity-to-be-save as it is in cache
169
+ @param index {Integer} The zero-based index of this entity in the change-set array
170
+ @returns {Function} The potentially revised request.
171
+ */
172
+ getRequest(request: any, entity: Entity, index: number): any;
173
+ /**
174
+ Last chance to change anything about the 'requests' array
175
+ after it has been built with requests for all of the entities-to-be-saved.
176
+
177
+ The 'requests' array is the same as 'saveBundle.entities' in many implementations
178
+
179
+ This method can do anything to the array including add and remove requests.
180
+ It's up to you to ensure that server will accept the requests array data as valid.
181
+
182
+ Returned value is ignored.
183
+ @example
184
+ this.done = function (requests) {
185
+ // alter the array of requests representing the entire change-set
186
+ // based on the saveContext and saveBundle
187
+ };
188
+ @param requests {Array of Object} The adapter's array of request for this changeset.
189
+ */
190
+ done(requests: Object[]): void;
191
+ }
@@ -0,0 +1,5 @@
1
+ // InterfaceRegistry - and config.interfaceRegistry and config.initializeAdapterInstances with it -
2
+ // is defined in config.ts: every adapter lookup needs it, and a bundler may drop this module,
3
+ // which holds only types. See "sideEffects" in CHANGES-DEV.md.
4
+ export { InterfaceRegistry } from './config.js';
5
+ //# sourceMappingURL=interface-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface-registry.js","sourceRoot":"","sources":["../../src/config/interface-registry.ts"],"names":[],"mappings":"AAQA,mGAAmG;AACnG,8FAA8F;AAC9F,+DAA+D;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC","sourcesContent":["import type { BaseAdapter } from './config.js';\r\nimport { MappingContext } from '../query/mapping-context.js';\r\nimport { EntityQuery } from '../query/entity-query.js';\r\nimport { MetadataStore } from '../metadata/entity-metadata.js';\r\nimport { JsonResultsAdapter, DataService } from '../metadata/data-service.js';\r\nimport { Entity } from '../entity/entity-aspect.js';\r\nimport { SaveContext, SaveBundle, QueryResult, SaveResult, HttpResponse } from '../manager/entity-manager.js';\r\n\r\n// InterfaceRegistry - and config.interfaceRegistry and config.initializeAdapterInstances with it -\r\n// is defined in config.ts: every adapter lookup needs it, and a bundler may drop this module,\r\n// which holds only types. See \"sideEffects\" in CHANGES-DEV.md.\r\nexport { InterfaceRegistry } from './config.js';\r\n\r\n/** Adapter names for the deprecated `config.initializeAdapterInstances`. Each is the name of a previously registered adapter. */\r\nexport interface InterfaceRegistryConfig {\r\n /** e.g. `'fetch'` */\r\n ajax?: string;\r\n /** e.g. `'backingStore'` */\r\n modelLibrary?: string;\r\n /** e.g. `'webApi'` */\r\n dataService?: string;\r\n /** e.g. `'json'` */\r\n uriBuilder?: string;\r\n}\r\n\r\n/** DataServiceAdapter Ajax request configuration */\r\nexport interface AjaxConfig {\r\n /** The request URL, without `params`: `{serviceName}/Metadata`, the save URL, or the query URL the {@link UriBuilderAdapter} built. */\r\n url: string;\r\n /** GET, POST, etc. */\r\n type?: string;\r\n /** json, etc. */\r\n dataType?: string;\r\n /** The `Content-Type` of the request body. The fetch transport sends it only for a request with a body (not GET or HEAD), defaulting to `application/json`. */\r\n contentType?: string;\r\n /** Not used by Breeze's own transport. Set to `true` for the deprecated `useJsonp` option, for a registered ajax adapter that acts on it. */\r\n crossDomain?: string | boolean;\r\n /** Additional request headers, merged over the `Content-Type` header. Breeze's own adapters do not set any. */\r\n headers?: {};\r\n /** The request body. A string is sent as it is; anything else is sent as `JSON.stringify(data)`. Ignored for GET and HEAD. */\r\n data?: any;\r\n /** Query-string parameters to append to `url`: the values given to {@link EntityQuery.withParameters}. A `Date` is sent as its ISO string. */\r\n params?: {};\r\n /** Called with the response when the request succeeds: a 2xx status and a body that parses as JSON. */\r\n success: (res: HttpResponse) => void;\r\n /** Called with the response when the request fails: a non-2xx status, a body that cannot be read, or no response at all (status 0). */\r\n error: (res: (HttpResponse | Error)) => void;\r\n}\r\n\r\n/** Request sent by AjaxAdapter.\r\n @deprecated Part of the ajax adapter contract, which Breeze 3 no longer needs. */\r\nexport interface AjaxRequest {\r\n /** AjaxAdapter that initiated the request */\r\n adapter: AjaxAdapter;\r\n /** Request configuration */\r\n config: RequestInit;\r\n /** config from the DataServiceAdapter that called the AjaxAdapter */\r\n dsaConfig: AjaxConfig;\r\n /** Function called on response error */\r\n error: (status: number, statusText: string, body: string | null, response: Response | null, errorThrown: any) => void;\r\n /** Function called on response success */\r\n success: (data: any, statusText: string, response: Response) => void;\r\n}\r\n\r\n/**\r\n * A fetch-compatible function. This is the seam for supplying your own transport:\r\n * add auth headers, retry, request signing, route through a framework HTTP client\r\n * (Angular's HttpClient, so requests pass through its interceptors), or stub it in\r\n * tests. Defaults to `globalThis.fetch`.\r\n */\r\nexport type BreezeFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;\r\n\r\n/** Handles AJAX requests to server.\r\n @deprecated Breeze 3 needs no ajax adapter: requests go through `config.fetch`. Set it with\r\n `configureBreeze({ fetch })`. */\r\nexport interface AjaxAdapter extends BaseAdapter {\r\n /** Function that performs the ajax request and calls the success or error function */\r\n ajax(config: AjaxConfig): void;\r\n /** Container for headers to be added to each request */\r\n defaultSettings: {\r\n /** Headers to add to every request, by name. */\r\n headers?: { [name: string]: string }\r\n };\r\n /** Function to allow manipulating the request before sending */\r\n requestInterceptor?: (req: AjaxRequest) => void;\r\n}\r\n\r\n/** Adapts breeze change-tracking to the UI framework */\r\nexport interface ModelLibraryAdapter extends BaseAdapter {\r\n /** Returns the names of the properties on an instance of an entity or complex type that the model library would track. Breeze calls it on a new instance of the type's constructor when it prepares the constructor, and adds any names the metadata does not know as unmapped properties. */\r\n getTrackablePropertyNames: (entity: any) => string[];\r\n /** Prepares the prototype of an entity or complex type constructor for tracking - for the backing store, adding `getProperty`, `setProperty` and a property accessor for each mapped property. Called when Breeze first sets up a type's constructor, and again when a property is added to a type whose prototype has already been prepared. */\r\n initializeEntityPrototype(proto: Object): void;\r\n /** Starts tracking one new entity or complex object - for the backing store, moving its initial values into the backing store and giving each unset property its default value. Called once per instance, when its `EntityAspect` or `ComplexAspect` is created. Despite the parameter's name, Breeze passes the constructor's prototype as the second argument. */\r\n startTracking(entity: any, entityCtor: Function): void;\r\n /** Optional. The stored value of a property, without creating anything that reading it would\r\n create - the backing store builds a collection navigation's array on first read. Breeze\r\n falls back to `getProperty` for an adapter that does not implement this, which simply\r\n means the array is created as it always was. */\r\n peekProperty?(entity: any, propertyName: string): any;\r\n /** Optional. Called with the {@link EntityType} or {@link ComplexType} to create a constructor for a type that has none registered. Without it, Breeze creates an empty constructor. */\r\n createCtor?: Function;\r\n}\r\n\r\n/** Reshapes data moving between breeze and server */\r\nexport interface DataServiceAdapter extends BaseAdapter {\r\n /**\r\n Fetches the metadata for a service and imports it into the `MetadataStore`. Called by\r\n `MetadataStore.fetchMetadata`, and before the first query to a service that has server metadata.\r\n Resolves with the raw metadata, or with a string saying why there is none (for example, that\r\n another request already fetched it). Rejects with the server error if the request fails.\r\n */\r\n fetchMetadata(metadataStore: MetadataStore, dataService: DataService): Promise<any>; // result of Promise is either rawMetadata or a string explaining why not.\r\n /**\r\n Sends the query in `mappingContext` to the server. Resolves with the raw results, the inline count\r\n if one was asked for, and the `httpResponse`; Breeze then merges the results into the cache\r\n through the {@link JsonResultsAdapter}.\r\n */\r\n executeQuery(mappingContext: MappingContext): Promise<QueryResult>; // result of executeQuery will get passed to JsonResultsAdapter extractResults method\r\n /**\r\n Sends the entities in `saveBundle` to the server and resolves with the saved entities and any\r\n key mappings. Called by `EntityManager.saveChanges`. Rejects with the server error, including\r\n any per-entity errors, if the save fails.\r\n */\r\n saveChanges(saveContext: SaveContext, saveBundle: SaveBundle): Promise<SaveResult>;\r\n /**\r\n The constructor of the {@link ChangeRequestInterceptor} the adapter creates for each save, to let\r\n an application change each entity's save request and the finished array of requests without\r\n writing its own adapter. Defaults to a no-op interceptor.\r\n */\r\n changeRequestInterceptor: ChangeRequestInterceptorCtor;\r\n /**\r\n The {@link JsonResultsAdapter} used to read this adapter's query and save results, unless the\r\n {@link DataService} names one of its own.\r\n */\r\n jsonResultsAdapter: JsonResultsAdapter;\r\n}\r\n\r\n/** Function called by AjaxAdapter before sending request.\r\n @deprecated Wrap the fetch function instead - see `configureBreeze({ fetch })`. */\r\nexport interface AjaxRequestInterceptor {\r\n (req: AjaxRequest) : void;\r\n /** Whether to remove the interceptor after it is called */\r\n oneTime: boolean;\r\n}\r\n\r\n/** Builds URI for performing queries. Serializes the EntityQuery according to the URI syntax. */\r\nexport interface UriBuilderAdapter extends BaseAdapter {\r\n /** Returns the URL for the query, relative to the service: its resource name followed by the query in this adapter's syntax. Breeze qualifies it with the service name, and sends the query's `withParameters` values separately, as request params. */\r\n buildUri(query: EntityQuery, metadataStore: MetadataStore): string;\r\n}\r\n\r\n// -----------------------------------\r\n\r\n/**\r\nThe constructor a {@link DataServiceAdapter} calls to create a {@link ChangeRequestInterceptor}\r\nfor one save. Assign your own to the adapter's `changeRequestInterceptor` property.\r\n*/\r\nexport interface ChangeRequestInterceptorCtor {\r\n /** Creates the interceptor for one save, given that save's context and the bundle about to be sent. */\r\n new (saveContext: SaveContext, saveBundle: SaveBundle): ChangeRequestInterceptor;\r\n}\r\n\r\n/** Allows manipulating data in DataServiceAdapter before sending to server */\r\nexport interface ChangeRequestInterceptor {\r\n /** Whether to intercept only one save. If set, the adapter goes back to its no-op interceptor after creating this one. */\r\n oneTime?: boolean;\r\n /**\r\n Prepare and return the save data for an entity change-set.\r\n \r\n The adapter calls this method for each entity in the change-set,\r\n after it has prepared a \"change request\" for that object.\r\n \r\n The method can do anything to the request but it must return a valid, non-null request.\r\n @example\r\n this.getRequest = function (request, entity, index) {\r\n // alter the request that the adapter prepared for this entity\r\n // based on the entity, saveContext, and saveBundle\r\n // e.g., add a custom header or prune the originalValuesMap\r\n return request;\r\n };\r\n @param request {Object} The object representing the adapter's request to save this entity.\r\n @param entity {Entity} The entity-to-be-save as it is in cache\r\n @param index {Integer} The zero-based index of this entity in the change-set array\r\n @returns {Function} The potentially revised request.\r\n */\r\n getRequest(request: any, entity: Entity, index: number): any;\r\n\r\n /**\r\n Last chance to change anything about the 'requests' array\r\n after it has been built with requests for all of the entities-to-be-saved.\r\n \r\n The 'requests' array is the same as 'saveBundle.entities' in many implementations\r\n \r\n This method can do anything to the array including add and remove requests.\r\n It's up to you to ensure that server will accept the requests array data as valid.\r\n \r\n Returned value is ignored.\r\n @example\r\n this.done = function (requests) {\r\n // alter the array of requests representing the entire change-set\r\n // based on the saveContext and saveBundle\r\n };\r\n @param requests {Array of Object} The adapter's array of request for this changeset.\r\n */\r\n done(requests: Object[]): void;\r\n}"]}
@@ -1,60 +1,52 @@
1
- import { BreezeEnum } from './enum';
2
- /** @hidden @internal */
3
- export interface IParamContext {
4
- typeName?: string;
5
- type?: Function;
6
- prevContext?: IParamContext;
7
- msg?: string | ((context: IParamContext, v: any) => string);
8
- mustNotBeEmpty?: boolean;
9
- enumType?: BreezeEnum;
10
- propertyName?: string;
11
- allowNull?: boolean;
12
- fn?(context: IParamContext, v: any): boolean;
13
- }
14
- /** @hidden @internal */
15
- export interface IConfigParam {
16
- config: any;
17
- params: Param[];
18
- whereParam: (propName: string) => Param;
19
- }
20
- /** @hidden @internal */
21
- export declare class Param {
22
- v: any;
23
- name: string;
24
- defaultValue: any;
25
- parent: IConfigParam;
26
- /** @hidden @internal */
27
- _context: IParamContext;
28
- /** @hidden @internal */
29
- _contexts: IParamContext[];
30
- constructor(v: any, name: string);
31
- isObject(): Param;
32
- isBoolean(): Param;
33
- isString(): Param;
34
- isNumber(): Param;
35
- isFunction(): Param;
36
- isNonEmptyString(): Param;
37
- isTypeOf(typeName: string): Param;
38
- isInstanceOf(type: Function, typeName?: string): Param;
39
- hasProperty(propertyName: string): Param;
40
- isEnumOf(enumType: any): Param;
41
- isRequired(allowNull?: boolean): Param;
42
- isOptional(): Param;
43
- isNonEmptyArray(): Param;
44
- isArray(mustNotBeEmpty?: boolean): Param;
45
- or(): this;
46
- check(defaultValue?: any): any;
47
- /** @hidden @internal */
48
- _addContext(context: IParamContext): Param;
49
- getMessage(): string;
50
- withDefault(defaultValue: any): this;
51
- whereParam(propName: string): Param;
52
- applyAll(instance: any, checkOnly?: boolean): void;
53
- /** @hidden @internal */
54
- _applyOne: (this: Param, instance: any) => void;
55
- MESSAGE_PREFIX: string;
56
- }
57
- /** @hidden @internal */
58
- export declare let assertParam: (v: any, name: string) => Param;
59
- /** @hidden @internal */
60
- export declare let assertConfig: (config: Object) => IConfigParam;
1
+ import { BreezeEnum } from './enum.js';
2
+ /** @hidden */
3
+ export interface IParamContext {
4
+ typeName?: string;
5
+ type?: Function;
6
+ prevContext?: IParamContext;
7
+ msg?: string | ((context: IParamContext, v: any) => string);
8
+ mustNotBeEmpty?: boolean;
9
+ enumType?: BreezeEnum;
10
+ propertyName?: string;
11
+ allowNull?: boolean;
12
+ fn?(context: IParamContext, v: any): boolean;
13
+ }
14
+ /** @hidden */
15
+ export interface IConfigParam {
16
+ config: any;
17
+ params: Param[];
18
+ whereParam: (propName: string) => Param;
19
+ }
20
+ /** @hidden */
21
+ export declare class Param {
22
+ v: any;
23
+ name: string;
24
+ defaultValue: any;
25
+ parent: IConfigParam;
26
+ constructor(v: any, name: string);
27
+ isObject(): Param;
28
+ isBoolean(): Param;
29
+ isString(): Param;
30
+ isNumber(): Param;
31
+ isFunction(): Param;
32
+ isNonEmptyString(): Param;
33
+ isTypeOf(typeName: string): Param;
34
+ isInstanceOf(type: Function, typeName?: string): Param;
35
+ hasProperty(propertyName: string): Param;
36
+ isEnumOf(enumType: any): Param;
37
+ isRequired(allowNull?: boolean): Param;
38
+ isOptional(): Param;
39
+ isNonEmptyArray(): Param;
40
+ isArray(mustNotBeEmpty?: boolean): Param;
41
+ or(): this;
42
+ check(defaultValue?: any): any;
43
+ getMessage(): string;
44
+ withDefault(defaultValue: any): this;
45
+ whereParam(propName: string): Param;
46
+ applyAll(instance: any, checkOnly?: boolean): void;
47
+ MESSAGE_PREFIX: string;
48
+ }
49
+ /** @hidden */
50
+ export declare let assertParam: (v: any, name: string) => Param;
51
+ /** @hidden */
52
+ export declare let assertConfig: (config: Object) => IConfigParam;