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.
- package/LICENSE +1 -1
- package/README.md +83 -63
- package/adapters/abstract-data-service-adapter.d.ts +120 -0
- package/adapters/abstract-data-service-adapter.js +395 -0
- package/adapters/abstract-data-service-adapter.js.map +1 -0
- package/adapters/adapter-ajax-fetch.d.ts +12 -0
- package/adapters/adapter-ajax-fetch.js +13 -0
- package/adapters/adapter-ajax-fetch.js.map +1 -0
- package/{adapter-ajax-post → adapters}/adapter-ajax-post.d.ts +40 -36
- package/{fesm2022/breeze-client-adapter-ajax-post.mjs → adapters/adapter-ajax-post.js} +80 -82
- package/adapters/adapter-ajax-post.js.map +1 -0
- package/{adapter-ajax-fetch → adapters}/adapter-core.d.ts +4 -4
- package/{fesm2022/breeze-client-adapter-uri-builder-json.mjs → adapters/adapter-core.js} +48 -91
- package/adapters/adapter-core.js.map +1 -0
- package/adapters/adapter-data-service-webapi.d.ts +9 -0
- package/{fesm2022/breeze-client-adapter-data-service-webapi.mjs → adapters/adapter-data-service-webapi.js} +105 -107
- package/adapters/adapter-data-service-webapi.js.map +1 -0
- package/adapters/adapter-model-library-backing-store.d.ts +32 -0
- package/adapters/adapter-model-library-backing-store.js +321 -0
- package/adapters/adapter-model-library-backing-store.js.map +1 -0
- package/adapters/adapter-uri-builder-json.d.ts +11 -0
- package/adapters/adapter-uri-builder-json.js +40 -0
- package/adapters/adapter-uri-builder-json.js.map +1 -0
- package/adapters/http.d.ts +52 -0
- package/adapters/http.js +202 -0
- package/adapters/http.js.map +1 -0
- package/angular/adapter-angular-httpclient.d.ts +21 -0
- package/angular/adapter-angular-httpclient.js +70 -0
- package/angular/adapter-angular-httpclient.js.map +1 -0
- package/breeze.d.ts +215 -0
- package/breeze.js +141 -0
- package/breeze.js.map +1 -0
- package/config/config.d.ts +212 -0
- package/config/config.js +392 -0
- package/config/config.js.map +1 -0
- package/config/configure.d.ts +66 -0
- package/config/configure.js +46 -0
- package/config/configure.js.map +1 -0
- package/config/default-adapters.d.ts +1 -0
- package/config/default-adapters.js +40 -0
- package/config/default-adapters.js.map +1 -0
- package/config/interface-registry.d.ts +191 -0
- package/config/interface-registry.js +5 -0
- package/config/interface-registry.js.map +1 -0
- package/{src → core}/assert-param.d.ts +52 -60
- package/core/assert-param.js +390 -0
- package/core/assert-param.js.map +1 -0
- package/core/core.d.ts +285 -0
- package/core/core.js +772 -0
- package/core/core.js.map +1 -0
- package/core/enum.d.ts +116 -0
- package/core/enum.js +167 -0
- package/core/enum.js.map +1 -0
- package/core/event.d.ts +169 -0
- package/core/event.js +338 -0
- package/core/event.js.map +1 -0
- package/entity/array.d.ts +3 -0
- package/entity/array.js +4 -0
- package/entity/array.js.map +1 -0
- package/entity/complex-array.d.ts +17 -0
- package/entity/complex-array.js +104 -0
- package/entity/complex-array.js.map +1 -0
- package/entity/default-property-interceptor.d.ts +1 -0
- package/entity/default-property-interceptor.js +496 -0
- package/entity/default-property-interceptor.js.map +1 -0
- package/{src → entity}/entity-action.d.ts +36 -42
- package/entity/entity-action.js +45 -0
- package/entity/entity-action.js.map +1 -0
- package/entity/entity-aspect.d.ts +457 -0
- package/entity/entity-aspect.js +1262 -0
- package/entity/entity-aspect.js.map +1 -0
- package/entity/entity-base.d.ts +55 -0
- package/entity/entity-base.js +41 -0
- package/entity/entity-base.js.map +1 -0
- package/entity/entity-group.d.ts +1 -0
- package/entity/entity-group.js +224 -0
- package/entity/entity-group.js.map +1 -0
- package/entity/entity-key.d.ts +95 -0
- package/entity/entity-key.js +189 -0
- package/entity/entity-key.js.map +1 -0
- package/{src → entity}/entity-state.d.ts +112 -84
- package/entity/entity-state.js +135 -0
- package/entity/entity-state.js.map +1 -0
- package/entity/key-generator.d.ts +57 -0
- package/entity/key-generator.js +155 -0
- package/entity/key-generator.js.map +1 -0
- package/entity/observable-array.d.ts +25 -0
- package/entity/observable-array.js +230 -0
- package/entity/observable-array.js.map +1 -0
- package/entity/primitive-array.d.ts +12 -0
- package/entity/primitive-array.js +71 -0
- package/entity/primitive-array.js.map +1 -0
- package/entity/relation-array.d.ts +24 -0
- package/entity/relation-array.js +176 -0
- package/entity/relation-array.js.map +1 -0
- package/entity/unattached-children-map.d.ts +1 -0
- package/entity/unattached-children-map.js +105 -0
- package/entity/unattached-children-map.js.map +1 -0
- package/generate-entity-classes.js +1176 -0
- package/manager/entity-manager.d.ts +801 -0
- package/manager/entity-manager.js +2395 -0
- package/manager/entity-manager.js.map +1 -0
- package/{src → manager}/save-options.d.ts +48 -42
- package/manager/save-options.js +51 -0
- package/manager/save-options.js.map +1 -0
- package/{src → metadata}/data-service.d.ts +229 -184
- package/metadata/data-service.js +246 -0
- package/metadata/data-service.js.map +1 -0
- package/metadata/data-type.d.ts +122 -0
- package/metadata/data-type.js +465 -0
- package/metadata/data-type.js.map +1 -0
- package/metadata/entity-metadata.d.ts +1193 -0
- package/metadata/entity-metadata.js +2502 -0
- package/metadata/entity-metadata.js.map +1 -0
- package/{src → metadata}/local-query-comparison-options.d.ts +65 -59
- package/metadata/local-query-comparison-options.js +69 -0
- package/metadata/local-query-comparison-options.js.map +1 -0
- package/{src → metadata}/naming-convention.d.ts +75 -72
- package/metadata/naming-convention.js +97 -0
- package/metadata/naming-convention.js.map +1 -0
- package/mixins/mixin-get-entity-graph.d.ts +63 -0
- package/{fesm2022/breeze-client-mixin-get-entity-graph.mjs → mixins/mixin-get-entity-graph.js} +331 -253
- package/mixins/mixin-get-entity-graph.js.map +1 -0
- package/mixins/mixin-save-queuing.d.ts +98 -0
- package/{fesm2022/breeze-client-mixin-save-queuing.mjs → mixins/mixin-save-queuing.js} +493 -365
- package/mixins/mixin-save-queuing.js.map +1 -0
- package/package.json +63 -94
- package/query/entity-query.d.ts +521 -0
- package/query/entity-query.js +1149 -0
- package/query/entity-query.js.map +1 -0
- package/{src → query}/mapping-context.d.ts +44 -46
- package/query/mapping-context.js +412 -0
- package/query/mapping-context.js.map +1 -0
- package/query/predicate.d.ts +394 -0
- package/query/predicate.js +1294 -0
- package/query/predicate.js.map +1 -0
- package/query/property-path.d.ts +252 -0
- package/query/property-path.js +2 -0
- package/query/property-path.js.map +1 -0
- package/{src → query}/query-options.d.ts +143 -119
- package/query/query-options.js +180 -0
- package/query/query-options.js.map +1 -0
- package/rxjs/breeze-rxjs.d.ts +72 -0
- package/rxjs/breeze-rxjs.js +117 -0
- package/rxjs/breeze-rxjs.js.map +1 -0
- package/validation/validate.d.ts +583 -0
- package/validation/validate.js +961 -0
- package/validation/validate.js.map +1 -0
- package/{src → validation}/validation-options.d.ts +67 -63
- package/validation/validation-options.js +70 -0
- package/validation/validation-options.js.map +1 -0
- package/adapter-ajax-angularjs/adapter-ajax-angularjs.d.ts +0 -17
- package/adapter-ajax-angularjs/adapter-core.d.ts +0 -4
- package/adapter-ajax-angularjs/index.d.ts +0 -5
- package/adapter-ajax-fetch/adapter-ajax-fetch.d.ts +0 -18
- package/adapter-ajax-fetch/index.d.ts +0 -5
- package/adapter-ajax-httpclient/adapter-ajax-httpclient.d.ts +0 -13
- package/adapter-ajax-httpclient/adapter-core.d.ts +0 -4
- package/adapter-ajax-httpclient/index.d.ts +0 -5
- package/adapter-ajax-jquery/adapter-ajax-jquery.d.ts +0 -15
- package/adapter-ajax-jquery/index.d.ts +0 -5
- package/adapter-ajax-post/index.d.ts +0 -5
- package/adapter-data-service-odata/adapter-core.d.ts +0 -4
- package/adapter-data-service-odata/adapter-data-service-odata.d.ts +0 -17
- package/adapter-data-service-odata/index.d.ts +0 -5
- package/adapter-data-service-webapi/adapter-data-service-webapi.d.ts +0 -15
- package/adapter-data-service-webapi/index.d.ts +0 -5
- package/adapter-model-library-backing-store/adapter-model-library-backing-store.d.ts +0 -10
- package/adapter-model-library-backing-store/index.d.ts +0 -5
- package/adapter-model-library-ko/adapter-model-library-ko.d.ts +0 -10
- package/adapter-model-library-ko/index.d.ts +0 -5
- package/adapter-uri-builder-json/adapter-core.d.ts +0 -4
- package/adapter-uri-builder-json/adapter-uri-builder-json.d.ts +0 -8
- package/adapter-uri-builder-json/index.d.ts +0 -5
- package/adapter-uri-builder-odata/adapter-core.d.ts +0 -4
- package/adapter-uri-builder-odata/adapter-uri-builder-odata.d.ts +0 -8
- package/adapter-uri-builder-odata/index.d.ts +0 -5
- package/esm2022/adapter-ajax-angularjs/adapter-ajax-angularjs.mjs +0 -135
- package/esm2022/adapter-ajax-angularjs/adapter-core.mjs +0 -49
- package/esm2022/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.mjs +0 -5
- package/esm2022/adapter-ajax-fetch/adapter-ajax-fetch.mjs +0 -135
- package/esm2022/adapter-ajax-fetch/adapter-core.mjs +0 -49
- package/esm2022/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.mjs +0 -5
- package/esm2022/adapter-ajax-httpclient/adapter-ajax-httpclient.mjs +0 -139
- package/esm2022/adapter-ajax-httpclient/adapter-core.mjs +0 -49
- package/esm2022/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.mjs +0 -5
- package/esm2022/adapter-ajax-jquery/adapter-ajax-jquery.mjs +0 -107
- package/esm2022/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.mjs +0 -5
- package/esm2022/adapter-ajax-post/adapter-ajax-post.mjs +0 -77
- package/esm2022/adapter-ajax-post/breeze-client-adapter-ajax-post.mjs +0 -5
- package/esm2022/adapter-data-service-odata/adapter-core.mjs +0 -49
- package/esm2022/adapter-data-service-odata/adapter-data-service-odata.mjs +0 -461
- package/esm2022/adapter-data-service-odata/breeze-client-adapter-data-service-odata.mjs +0 -5
- package/esm2022/adapter-data-service-webapi/adapter-data-service-webapi.mjs +0 -100
- package/esm2022/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.mjs +0 -5
- package/esm2022/adapter-model-library-backing-store/adapter-model-library-backing-store.mjs +0 -269
- package/esm2022/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.mjs +0 -5
- package/esm2022/adapter-model-library-ko/adapter-model-library-ko.mjs +0 -241
- package/esm2022/adapter-model-library-ko/breeze-client-adapter-model-library-ko.mjs +0 -5
- package/esm2022/adapter-uri-builder-json/adapter-core.mjs +0 -49
- package/esm2022/adapter-uri-builder-json/adapter-uri-builder-json.mjs +0 -37
- package/esm2022/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.mjs +0 -5
- package/esm2022/adapter-uri-builder-odata/adapter-core.mjs +0 -49
- package/esm2022/adapter-uri-builder-odata/adapter-uri-builder-odata.mjs +0 -191
- package/esm2022/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.mjs +0 -5
- package/esm2022/breeze-client.mjs +0 -5
- package/esm2022/index.mjs +0 -2
- package/esm2022/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.mjs +0 -5
- package/esm2022/mixin-get-entity-graph/mixin-get-entity-graph.mjs +0 -269
- package/esm2022/mixin-save-queuing/breeze-client-mixin-save-queuing.mjs +0 -5
- package/esm2022/mixin-save-queuing/mixin-save-queuing.mjs +0 -421
- package/esm2022/src/abstract-data-service-adapter.mjs +0 -325
- package/esm2022/src/array.mjs +0 -4
- package/esm2022/src/assert-param.mjs +0 -330
- package/esm2022/src/breeze.mjs +0 -85
- package/esm2022/src/complex-array.mjs +0 -117
- package/esm2022/src/config.mjs +0 -232
- package/esm2022/src/core.mjs +0 -712
- package/esm2022/src/csdl-metadata-parser.mjs +0 -385
- package/esm2022/src/data-service.mjs +0 -221
- package/esm2022/src/data-type.mjs +0 -510
- package/esm2022/src/default-property-interceptor.mjs +0 -460
- package/esm2022/src/entity-action.mjs +0 -45
- package/esm2022/src/entity-aspect.mjs +0 -897
- package/esm2022/src/entity-group.mjs +0 -192
- package/esm2022/src/entity-key.mjs +0 -125
- package/esm2022/src/entity-manager.mjs +0 -2163
- package/esm2022/src/entity-metadata.mjs +0 -2242
- package/esm2022/src/entity-query.mjs +0 -1024
- package/esm2022/src/entity-state.mjs +0 -107
- package/esm2022/src/enum.mjs +0 -143
- package/esm2022/src/event.mjs +0 -264
- package/esm2022/src/interface-registry.mjs +0 -39
- package/esm2022/src/key-generator.mjs +0 -110
- package/esm2022/src/local-query-comparison-options.mjs +0 -65
- package/esm2022/src/mapping-context.mjs +0 -411
- package/esm2022/src/naming-convention.mjs +0 -92
- package/esm2022/src/observable-array.mjs +0 -183
- package/esm2022/src/predicate.mjs +0 -1259
- package/esm2022/src/primitive-array.mjs +0 -85
- package/esm2022/src/query-options.mjs +0 -152
- package/esm2022/src/relation-array.mjs +0 -173
- package/esm2022/src/save-options.mjs +0 -41
- package/esm2022/src/unattached-children-map.mjs +0 -56
- package/esm2022/src/validate.mjs +0 -995
- package/esm2022/src/validation-options.mjs +0 -64
- package/fesm2022/breeze-client-adapter-ajax-angularjs.mjs +0 -190
- package/fesm2022/breeze-client-adapter-ajax-angularjs.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-fetch.mjs +0 -190
- package/fesm2022/breeze-client-adapter-ajax-fetch.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-httpclient.mjs +0 -194
- package/fesm2022/breeze-client-adapter-ajax-httpclient.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-jquery.mjs +0 -114
- package/fesm2022/breeze-client-adapter-ajax-jquery.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-post.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-data-service-odata.mjs +0 -516
- package/fesm2022/breeze-client-adapter-data-service-odata.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-data-service-webapi.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-model-library-backing-store.mjs +0 -276
- package/fesm2022/breeze-client-adapter-model-library-backing-store.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-model-library-ko.mjs +0 -248
- package/fesm2022/breeze-client-adapter-model-library-ko.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-uri-builder-json.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-uri-builder-odata.mjs +0 -246
- package/fesm2022/breeze-client-adapter-uri-builder-odata.mjs.map +0 -1
- package/fesm2022/breeze-client-mixin-get-entity-graph.mjs.map +0 -1
- package/fesm2022/breeze-client-mixin-save-queuing.mjs.map +0 -1
- package/fesm2022/breeze-client.mjs +0 -14144
- package/fesm2022/breeze-client.mjs.map +0 -1
- package/index.d.ts +0 -1
- package/mixin-get-entity-graph/index.d.ts +0 -5
- package/mixin-get-entity-graph/mixin-get-entity-graph.d.ts +0 -31
- package/mixin-save-queuing/index.d.ts +0 -5
- package/mixin-save-queuing/mixin-save-queuing.d.ts +0 -32
- package/src/abstract-data-service-adapter.d.ts +0 -84
- package/src/array.d.ts +0 -3
- package/src/breeze.d.ts +0 -139
- package/src/complex-array.d.ts +0 -13
- package/src/config.d.ts +0 -104
- package/src/core.d.ts +0 -164
- package/src/csdl-metadata-parser.d.ts +0 -7
- package/src/data-type.d.ts +0 -89
- package/src/default-property-interceptor.d.ts +0 -4
- package/src/entity-aspect.d.ts +0 -332
- package/src/entity-group.d.ts +0 -28
- package/src/entity-key.d.ts +0 -77
- package/src/entity-manager.d.ts +0 -680
- package/src/entity-metadata.d.ts +0 -988
- package/src/entity-query.d.ts +0 -444
- package/src/enum.d.ts +0 -100
- package/src/event.d.ts +0 -142
- package/src/interface-registry.d.ts +0 -150
- package/src/key-generator.d.ts +0 -12
- package/src/observable-array.d.ts +0 -52
- package/src/predicate.d.ts +0 -376
- package/src/primitive-array.d.ts +0 -7
- package/src/relation-array.d.ts +0 -18
- package/src/unattached-children-map.d.ts +0 -19
- 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
|
+
}
|