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,394 @@
1
+ import { EntityType, StructuralType } from '../metadata/entity-metadata.js';
2
+ import { QueryOp } from './entity-query.js';
3
+ import type { FilterQueryOp, RecursiveArray } from './entity-query.js';
4
+ import { DataType } from '../metadata/data-type.js';
5
+ import { Entity } from '../entity/entity-aspect.js';
6
+ import type { CollectionElement, CollectionPath, FilterOpFor, FilterValueFor, FunctionExpressionPath, NoInferFrom, PropertyPath, PropertyValue, QuantifierOp, WhereObject } from './property-path.js';
7
+ export interface Op {
8
+ key: string;
9
+ aliases?: string[];
10
+ isFunction?: boolean;
11
+ }
12
+ /** For use by breeze plugin authors only. The class is for use in building a {@link UriBuilderAdapter} implementation.
13
+ @adapter (see {@link UriBuilderAdapter})
14
+ @hidden
15
+ */
16
+ export interface Visitor {
17
+ }
18
+ /** For use by breeze plugin authors only. The class is for use in building a {@link UriBuilderAdapter} implementation.
19
+ @adapter (see {@link UriBuilderAdapter})
20
+ @hidden
21
+ */
22
+ export interface VisitContext {
23
+ entityType?: EntityType;
24
+ toNameOnServer?: boolean;
25
+ useExplicitDataType?: boolean;
26
+ visitor?: Visitor;
27
+ }
28
+ /** For use by breeze plugin authors only. The class is for use in building a {@link UriBuilderAdapter} implementation.
29
+ @adapter (see {@link UriBuilderAdapter})
30
+ @hidden
31
+ */
32
+ export interface ExpressionContext {
33
+ entityType?: EntityType;
34
+ usesNameOnServer?: boolean;
35
+ dataType?: DataType | string;
36
+ isRHS?: boolean;
37
+ isFnArg?: boolean;
38
+ }
39
+ /**
40
+ Builds {@link Predicate}s checked against one entity type - what {@link Predicate.for} returns.
41
+
42
+ Each Predicate it produces is a `Predicate<T>`, so combining them with `and`, `or` and `not` is
43
+ checked too, and an {@link EntityQuery} for another type will not accept them.
44
+ */
45
+ export interface TypedPredicateFactory<T> {
46
+ /** A path only known at run time, or a query function, neither of which can be checked.
47
+ ```ts
48
+ const p = Predicate.for(Customer);
49
+ const byColumn = p(userChosenColumn, "eq", value); // userChosenColumn: string
50
+ const byFunction = p("toLower(companyName)", "startsWith", "c");
51
+ ```
52
+ */
53
+ <P extends string>(property: P extends FunctionExpressionPath ? P : (string extends P ? P : never), operator: string | FilterQueryOp, value: any): Predicate<T>;
54
+ <P extends string>(collection: string extends P ? P : never, quantifier: string | FilterQueryOp, property: string, operator: string | FilterQueryOp, value: any): Predicate<T>;
55
+ /** A property, an operator that suits its type, and a matching value.
56
+ ```ts
57
+ const p = Predicate.for(Order);
58
+ const pred = p("freight", "gt", 100);
59
+ const viaNavigation = p("customer.companyName", "startsWith", "A");
60
+ ```
61
+ */
62
+ <P extends PropertyPath<T>, O extends FilterOpFor<PropertyValue<T, P>>>(property: P, operator: O, value: FilterValueFor<T, PropertyValue<T, P>, O>): Predicate<T>;
63
+ /** `any` or `all` over a collection, filtered by a Predicate built for the element type.
64
+ ```ts
65
+ const pd = Predicate.for(OrderDetail);
66
+ const pred = Predicate.for(Order)("orderDetails", "any", pd("unitPrice", ">", 20));
67
+ ```
68
+ */
69
+ <P extends CollectionPath<T>>(collection: P, quantifier: QuantifierOp | FilterQueryOp, predicate: Predicate<CollectionElement<T, P>>): Predicate<T>;
70
+ /** `any` or `all` over a collection, then a filter on the element type.
71
+ ```ts
72
+ const p = Predicate.for(Customer);
73
+ const pred = p("orders", "all", "freight", "lt", 100);
74
+ ```
75
+ */
76
+ <P extends CollectionPath<T>, P2 extends PropertyPath<CollectionElement<T, P>>, O2 extends FilterOpFor<PropertyValue<CollectionElement<T, P>, P2>>>(collection: P, quantifier: QuantifierOp, property: P2, operator: O2, value: FilterValueFor<CollectionElement<T, P>, PropertyValue<CollectionElement<T, P>, P2>, O2>): Predicate<T>;
77
+ /** The object form, checked in full.
78
+ ```ts
79
+ const p = Predicate.for(Customer);
80
+ const pred = p({ city: "London", companyName: { startsWith: "A" } });
81
+ ```
82
+ */
83
+ (predicate: WhereObject<T>): Predicate<T>;
84
+ }
85
+ /**
86
+ Used to define a 'where' predicate for an {@link EntityQuery}. Predicates are immutable, which means that any
87
+ method that would modify a Predicate actually returns a new Predicate.
88
+ ```ts
89
+ const p = Predicate.for(Order);
90
+ const p1 = p("freight", ">", 100);
91
+ const p2 = p1.and(p("shipCity", "startsWith", "C"));
92
+ const query = EntityQuery.from(Order).where(p2);
93
+ ```
94
+ */
95
+ export declare class Predicate<T = any> {
96
+ /**
97
+ Never set: it is here only so that a `Predicate<Order>` and a `Predicate<Customer>` are different
98
+ types. It is public because a private member reaches the published .d.ts without its type, which
99
+ would lose the distinction.
100
+ @hidden
101
+ */
102
+ readonly _$predicateFor?: T;
103
+ /** The operator of this predicate. Its `key` is, for example, `eq` or `gt` for a comparison, `and` or `or` for a composite, `not`, or `any` or `all`. `undefined` for a pass-through predicate made from a raw filter string. __Read Only__ */
104
+ op: Op;
105
+ /** The name of the visitor method that handles this kind of predicate, such as `binaryPredicate` or `andOrPredicate`. Used by Breeze when it serializes or evaluates a predicate; applications do not normally need it. __Read Only__ */
106
+ visitorMethodName: string;
107
+ /**
108
+ Predicate constructor. The compiler checks nothing it is given; for that, build the Predicate with
109
+ {@link Predicate.for} or {@link Predicate.create} and a type argument instead.
110
+ ```ts
111
+ const p1 = new Predicate("companyName", "startsWith", "B");
112
+ const query = EntityQuery.from(Customer).where(p1);
113
+ ```
114
+
115
+ or
116
+ ```ts
117
+ const p2 = new Predicate("region", FilterQueryOp.Equals, null);
118
+ const query = EntityQuery.from(Customer).where(p2);
119
+ ```
120
+ @param args - `property, operator, value`, in that order:
121
+ - **property**: A property name, a nested property name or an expression involving a property name.
122
+ - **operator**: the filter query operator.
123
+ - **value**: This will be treated as either a property expression or a literal depending on context. In general,
124
+ if the value can be interpreted as a property expression it will be, otherwise it will be treated as a literal.
125
+ In most cases this works well, but you can also force the interpretation by making the value argument itself an object with a 'value'
126
+ property and an 'isLiteral' property set to either true or false. Breeze also tries to infer the dataType of any
127
+ literal based on context, if this fails you can force this inference by making the value argument an object with a
128
+ 'value' property and a 'dataType' property set to one of the breeze.DataType enumeration instances.
129
+ */
130
+ constructor(...args: any[]);
131
+ static create<T = any>(predicate: Predicate<T>): Predicate<T>;
132
+ static create(rawFilterString: string): Predicate;
133
+ static create(anArray: RecursiveArray<string | number | FilterQueryOp | Predicate>): Predicate;
134
+ static create<P extends string>(property: P extends FunctionExpressionPath ? P : (string extends P ? P : never), operator: string | FilterQueryOp, value: any): Predicate;
135
+ static create<P extends string>(collection: string extends P ? P : never, quantifier: string | FilterQueryOp, property: string, operator: string | FilterQueryOp, value: any): Predicate;
136
+ static create(property: string, filterop: string, property2: string, filterop2: string, property3: string, filterop3: string, value: any): Predicate;
137
+ /** Checks the property path against `T`. The operator and the value are not tied to that
138
+ property: supplying `T` stops TypeScript inferring the rest from the path. Use the object form,
139
+ or {@link Predicate.for}, to have them checked too.
140
+ ```ts
141
+ const p = Predicate.create<Customer>("companyName", "startsWith", "C");
142
+ ```
143
+ */
144
+ static create<T = any>(property: PropertyPath<NoInferFrom<T>> | FunctionExpressionPath, operator: string | FilterQueryOp, value: any): Predicate<T>;
145
+ /** `any` or `all` over a collection, filtered by a Predicate built for the element type.
146
+ ```ts
147
+ const pd = Predicate.for(OrderDetail);
148
+ const p = Predicate.create<Order>("orderDetails", "any", pd("unitPrice", ">", 20));
149
+ ```
150
+ */
151
+ static create<T = any>(collection: CollectionPath<NoInferFrom<T>>, quantifier: QuantifierOp | FilterQueryOp, predicate: Predicate): Predicate<T>;
152
+ /** Checks the collection path against `T`.
153
+ ```ts
154
+ const p = Predicate.create<Customer>("orders", "any", "freight", ">", 100);
155
+ ```
156
+ */
157
+ static create<T = any>(collection: CollectionPath<NoInferFrom<T>>, quantifier: QuantifierOp | FilterQueryOp, property: string, operator: string | FilterQueryOp, value: any): Predicate<T>;
158
+ /** The object form, checked in full against `T`.
159
+ ```ts
160
+ const p = Predicate.create<Order>({ freight: { gt: 100 }, shipCity: { startsWith: "C" } });
161
+ ```
162
+ */
163
+ static create<T = any>(predicate: WhereObject<NoInferFrom<T>>): Predicate<T>;
164
+ /**
165
+ Creates a 'composite' Predicate by 'and'ing a set of specified Predicates together.
166
+ ```ts
167
+ const p = Predicate.for(Order);
168
+ const dt = new Date(1988, 9, 12);
169
+ const p1 = p("orderDate", "ne", dt);
170
+ const p2 = p("shipCity", "startsWith", "C");
171
+ const p3 = p("freight", ">", 100);
172
+ const newPred = Predicate.and(p1, p2, p3);
173
+ ```
174
+
175
+ or
176
+ ```ts
177
+ const preds = [p1, p2, p3];
178
+ const newPred = Predicate.and(preds);
179
+ ```
180
+ @param predicates - multiple Predicates or an array of Predicates.
181
+ Any null or undefined values passed in will be automatically filtered out before constructing the composite predicate.
182
+ */
183
+ static and<T = any>(...predicates: (Predicate<T> | null | undefined)[]): Predicate<T>;
184
+ static and<T = any>(predicates: (Predicate<T> | null | undefined)[]): Predicate<T>;
185
+ /**
186
+ Creates a 'composite' Predicate by 'or'ing a set of specified Predicates together.
187
+ ```ts
188
+ const p = Predicate.for(Order);
189
+ const dt = new Date(1988, 9, 12);
190
+ const p1 = p("orderDate", "ne", dt);
191
+ const p2 = p("shipCity", "startsWith", "C");
192
+ const p3 = p("freight", ">", 100);
193
+ const newPred = Predicate.or(p1, p2, p3);
194
+ ```
195
+
196
+ or
197
+ ```ts
198
+ const preds = [p1, p2, p3];
199
+ const newPred = Predicate.or(preds);
200
+ ```
201
+ @param predicates - multiple Predicates or an array of Predicates.
202
+ Any null or undefined values passed in will be automatically filtered out before constructing the composite predicate.
203
+ */
204
+ static or<T = any>(...predicates: (Predicate<T> | null | undefined)[]): Predicate<T>;
205
+ static or<T = any>(predicates: (Predicate<T> | null | undefined)[]): Predicate<T>;
206
+ /**
207
+ Creates a 'composite' Predicate by 'negating' a specified predicate.
208
+ ```ts
209
+ const p1 = Predicate.create<Order>({ freight: { gt: 100 } });
210
+ const not_p1 = Predicate.not(p1);
211
+ ```
212
+
213
+ This can also be accomplished using the 'instance' version of the 'not' method
214
+ ```ts
215
+ const not_p1 = p1.not();
216
+ ```
217
+
218
+ Both of which would be the same as
219
+ ```ts
220
+ const not_p1 = Predicate.create<Order>({ freight: { le: 100 } });
221
+ ```
222
+ */
223
+ static not<T = any>(pred: Predicate<T>): Predicate<T>;
224
+ /**
225
+ Builds Predicates checked against one entity type.
226
+ ```ts
227
+ const p = Predicate.for(Customer);
228
+ const pred = p("companyName", "startsWith", "C").and(p("city", "eq", "Vienna"));
229
+ ```
230
+
231
+ A standalone Predicate has no query to take an entity type from, so on its own
232
+ {@link Predicate.create} cannot check anything. Naming the type supplies what is missing, the
233
+ same way {@link EntityQuery.from} does for a query - and from a constructor rather than a type
234
+ argument, so the type is written once.
235
+
236
+ The constructor is read for its type only; nothing about it is kept. The predicates are ordinary
237
+ Predicates at run time, typed `Predicate<U>`, so that what they are combined with, and the query
238
+ they are used in, is checked too. The constructor does not have to be registered with a MetadataStore for this - though
239
+ if it is not, nothing validates the path against the metadata either, exactly as before.
240
+ @param ctor - The entity class to check property paths against.
241
+ @returns A factory that builds Predicates for that type.
242
+ */
243
+ static for<U extends Entity>(ctor: new () => U): TypedPredicateFactory<U>;
244
+ /**
245
+ Adds functions that predicates can call, such as `toupper` in `Predicate.create<Customer>("toupper(companyName)", "==", "ACME")`,
246
+ or replaces existing ones. Each entry maps a function name to `fn`, which evaluates it in local
247
+ queries, and the {@link DataType} it returns. A server query sends the call by name, so the
248
+ server must support the function too.
249
+ ```ts
250
+ Predicate.extendFuncMap({
251
+ initial: { fn: (s: string) => s.charAt(0), dataType: DataType.String }
252
+ });
253
+ ```
254
+ @param funcMap - The functions to add, keyed by name. Write names in lower case: Breeze lower-cases a
255
+ function name when it parses a predicate.
256
+ */
257
+ static extendFuncMap(funcMap: {
258
+ [key: string]: {
259
+ fn: (...args: any[]) => any;
260
+ dataType: DataType;
261
+ };
262
+ }): void;
263
+ and(...predicates: (Predicate<T> | null | undefined)[]): Predicate<T>;
264
+ and(predicates: (Predicate<T> | null | undefined)[]): Predicate<T>;
265
+ and(predicate: WhereObject<T>): Predicate<T>;
266
+ and<O extends string>(property: PropertyPath<T>, operator: string extends O ? O : never, value: any): Predicate<T>;
267
+ and<P extends string>(property: P extends FunctionExpressionPath ? P : (string extends P ? P : never), operator: string | FilterQueryOp, value: any): Predicate<T>;
268
+ and<P extends string>(collection: string extends P ? P : never, quantifier: string | FilterQueryOp, property: string, operator: string | FilterQueryOp, value: any): Predicate<T>;
269
+ and<P extends CollectionPath<T>>(collection: P, quantifier: QuantifierOp | FilterQueryOp, predicate: Predicate<CollectionElement<T, P>>): Predicate<T>;
270
+ and<P extends PropertyPath<T>, O extends FilterOpFor<PropertyValue<T, P>>>(property: P, operator: O, value: FilterValueFor<T, PropertyValue<T, P>, O>): Predicate<T>;
271
+ and<P extends CollectionPath<T>, P2 extends PropertyPath<CollectionElement<T, P>>, O2 extends FilterOpFor<PropertyValue<CollectionElement<T, P>, P2>>>(collection: P, quantifier: QuantifierOp, property: P2, operator: O2, value: FilterValueFor<CollectionElement<T, P>, PropertyValue<CollectionElement<T, P>, P2>, O2>): Predicate<T>;
272
+ or(...predicates: (Predicate<T> | null | undefined)[]): Predicate<T>;
273
+ or(predicates: (Predicate<T> | null | undefined)[]): Predicate<T>;
274
+ or(predicate: WhereObject<T>): Predicate<T>;
275
+ or<O extends string>(property: PropertyPath<T>, operator: string extends O ? O : never, value: any): Predicate<T>;
276
+ or<P extends string>(property: P extends FunctionExpressionPath ? P : (string extends P ? P : never), operator: string | FilterQueryOp, value: any): Predicate<T>;
277
+ or<P extends string>(collection: string extends P ? P : never, quantifier: string | FilterQueryOp, property: string, operator: string | FilterQueryOp, value: any): Predicate<T>;
278
+ or<P extends CollectionPath<T>>(collection: P, quantifier: QuantifierOp | FilterQueryOp, predicate: Predicate<CollectionElement<T, P>>): Predicate<T>;
279
+ or<P extends PropertyPath<T>, O extends FilterOpFor<PropertyValue<T, P>>>(property: P, operator: O, value: FilterValueFor<T, PropertyValue<T, P>, O>): Predicate<T>;
280
+ or<P extends CollectionPath<T>, P2 extends PropertyPath<CollectionElement<T, P>>, O2 extends FilterOpFor<PropertyValue<CollectionElement<T, P>, P2>>>(collection: P, quantifier: QuantifierOp, property: P2, operator: O2, value: FilterValueFor<CollectionElement<T, P>, PropertyValue<CollectionElement<T, P>, P2>, O2>): Predicate<T>;
281
+ /**
282
+ Returns the 'negated' version of this Predicate
283
+ ```ts
284
+ const p1 = Predicate.create<Order>({ freight: { gt: 100 } });
285
+ const not_p1 = p1.not();
286
+ ```
287
+
288
+ This can also be accomplished using the 'static' version of the 'not' method
289
+ ```ts
290
+ const not_p1 = Predicate.not(p1);
291
+ ```
292
+
293
+ which would be the same as
294
+ ```ts
295
+ const not_p1 = Predicate.create<Order>({ freight: { le: 100 } });
296
+ ```
297
+ */
298
+ not(): Predicate<T>;
299
+ /**
300
+ Returns this predicate in Breeze's JSON query syntax, with property paths as written - the object
301
+ form that {@link Predicate.create} and {@link EntityQuery.where} also accept, such as
302
+ `{ freight: { gt: 100 } }`. `JSON.stringify` calls it.
303
+ */
304
+ toJSON(): any;
305
+ /** Returns this predicate as a JSON string: `JSON.stringify` of {@link Predicate.toJSON}. Useful for logging and debugging. */
306
+ toString(): string;
307
+ }
308
+ /** For use by breeze plugin authors only. The class is for use in building a {@link UriBuilderAdapter} implementation.
309
+ @adapter (see {@link UriBuilderAdapter})
310
+ @hidden
311
+ */
312
+ export declare class UnaryPredicate extends Predicate {
313
+ pred: Predicate;
314
+ constructor(op: string | QueryOp, ...args: any[]);
315
+ _validate(entityType: EntityType, usesNameOnServer?: boolean): void;
316
+ }
317
+ /** For use by breeze plugin authors only. The class is for use in building a {@link UriBuilderAdapter} implementation.
318
+ @adapter (see {@link UriBuilderAdapter})
319
+ @hidden
320
+ */
321
+ export declare class BinaryPredicate extends Predicate {
322
+ expr1Source: any;
323
+ expr2Source: any;
324
+ expr1?: PredicateExpression;
325
+ expr2?: PredicateExpression;
326
+ constructor(op: string | QueryOp, expr1: any, expr2: any);
327
+ _validate(entityType: EntityType, usesNameOnServer?: boolean): void;
328
+ }
329
+ /** For use by breeze plugin authors only. The class is for use in building a {@link UriBuilderAdapter} implementation.
330
+ @adapter (see {@link UriBuilderAdapter})
331
+ @hidden
332
+ */
333
+ export declare class AndOrPredicate extends Predicate {
334
+ preds: Predicate[];
335
+ constructor(op: string | QueryOp, preds: any[]);
336
+ _validate(entityType: EntityType, usesNameOnServer?: boolean): void;
337
+ }
338
+ /** For use by breeze plugin authors only. The class is for use in building a {@link UriBuilderAdapter} implementation.
339
+ @adapter (see {@link UriBuilderAdapter})
340
+ @hidden
341
+ */
342
+ export declare class AnyAllPredicate extends Predicate {
343
+ exprSource: string;
344
+ pred: Predicate;
345
+ constructor(op: string | QueryOp, expr: string, pred: any);
346
+ _validate(entityType: EntityType, usesNameOnServer: boolean): void;
347
+ }
348
+ /** @hidden */
349
+ export declare class PredicateExpression {
350
+ visitorMethodName: string;
351
+ visit: Function;
352
+ dataType?: DataType | StructuralType;
353
+ constructor(visitorMethodName: string);
354
+ _validate(entityType: EntityType | undefined, usesNameOnServer?: boolean): void;
355
+ }
356
+ /** For use by breeze plugin authors only. The class is for use in building a {@link UriBuilderAdapter} implementation.
357
+ @adapter (see {@link UriBuilderAdapter})
358
+ @hidden
359
+ */
360
+ export declare class LitExpr extends PredicateExpression {
361
+ value: any;
362
+ /** Narrows the optional dataType on PredicateExpression: a LitExpr always has one,
363
+ because the constructor falls back to DataType.fromValue when none is supplied. */
364
+ dataType: DataType;
365
+ hasExplicitDataType: boolean;
366
+ constructor(value: any, dataType: string | DataType | undefined, hasExplicitDataType?: boolean);
367
+ toString(): string;
368
+ }
369
+ /** For use by breeze plugin authors only. The class is for use in building a {@link UriBuilderAdapter} implementation.
370
+ @adapter (see {@link UriBuilderAdapter})
371
+ @hidden
372
+ */
373
+ export declare class PropExpr extends PredicateExpression {
374
+ propertyPath: string;
375
+ constructor(propertyPath: string);
376
+ toString(): string;
377
+ _validate(entityType: EntityType | undefined, usesNameOnServer?: boolean): void;
378
+ }
379
+ /** For use by breeze plugin authors only. The class is for use in building a {@link UriBuilderAdapter} implementation.
380
+ @adapter (see {@link UriBuilderAdapter})
381
+ @hidden
382
+ */
383
+ export declare class FnExpr extends PredicateExpression {
384
+ fnName: string;
385
+ exprs: PredicateExpression[];
386
+ localFn: any;
387
+ constructor(fnName: string, exprs: PredicateExpression[]);
388
+ toString(): string;
389
+ _validate(entityType: EntityType | undefined, usesNameOnServer?: boolean): void;
390
+ static _funcMap: Map<string, {
391
+ fn: (...args: any[]) => any;
392
+ dataType: DataType;
393
+ }>;
394
+ }