breeze-client 2.2.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +62 -93
- 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
|
@@ -1,59 +1,65 @@
|
|
|
1
|
-
/** Configuration info to be passed to the
|
|
2
|
-
export interface LocalQueryComparisonOptionsConfig {
|
|
3
|
-
/** The name of this collection of configuration settings. */
|
|
4
|
-
name?: string;
|
|
5
|
-
/** Whether predicates that involve strings will be interpreted in a "caseSensitive" manner. Default is 'false'. */
|
|
6
|
-
isCaseSensitive?: boolean;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
name
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
static
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
/** Configuration info to be passed to the {@link LocalQueryComparisonOptions} constructor. */
|
|
2
|
+
export interface LocalQueryComparisonOptionsConfig {
|
|
3
|
+
/** The name of this collection of configuration settings. */
|
|
4
|
+
name?: string;
|
|
5
|
+
/** Whether predicates that involve strings will be interpreted in a "caseSensitive" manner. Default is 'false'. */
|
|
6
|
+
isCaseSensitive?: boolean;
|
|
7
|
+
/** Whether or not to enforce the ANSI SQL standard
|
|
8
|
+
of padding strings of unequal lengths before comparison with spaces. Note that per the standard, padding only occurs with equality and
|
|
9
|
+
inequality predicates, and not with operations like 'startsWith', 'endsWith' or 'contains'. Default is true. */
|
|
10
|
+
usesSql92CompliantStringComparison?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
A LocalQueryComparisonOptions instance is used to specify the "comparison rules" used when performing "local queries" in order
|
|
14
|
+
to match the semantics of these same queries when executed against a remote service. These options should be set based on the
|
|
15
|
+
manner in which your remote service interprets certain comparison operations.
|
|
16
|
+
|
|
17
|
+
The default LocalQueryComparisonOptions stipulates 'caseInsensitive" queries with ANSI SQL rules regarding comparisons of unequal
|
|
18
|
+
length strings.
|
|
19
|
+
*/
|
|
20
|
+
export declare class LocalQueryComparisonOptions {
|
|
21
|
+
/** The name for this instance. */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Whether predicates that involve strings will be interpreted in a "caseSensitive" manner. (default = false). */
|
|
24
|
+
isCaseSensitive: boolean;
|
|
25
|
+
/** Whether `==` and `!=` comparisons of strings ignore leading and trailing spaces, to match a SQL server's comparison of strings of unequal length. `startsWith`, `endsWith` and `contains` are unaffected. (default = true). */
|
|
26
|
+
usesSql92CompliantStringComparison: boolean;
|
|
27
|
+
/**
|
|
28
|
+
LocalQueryComparisonOptions constructor
|
|
29
|
+
```ts
|
|
30
|
+
// create a 'caseSensitive - non SQL' instance.
|
|
31
|
+
var lqco = new LocalQueryComparisonOptions({
|
|
32
|
+
name: "caseSensitive-nonSQL"
|
|
33
|
+
isCaseSensitive: true;
|
|
34
|
+
usesSql92CompliantStringComparison: false;
|
|
35
|
+
});
|
|
36
|
+
// either apply it globally
|
|
37
|
+
lqco.setAsDefault();
|
|
38
|
+
// or to a specific MetadataStore
|
|
39
|
+
var ms = new MetadataStore({ localQueryComparisonOptions: lqco });
|
|
40
|
+
var em = new EntityManager( { metadataStore: ms });
|
|
41
|
+
```
|
|
42
|
+
@param lqcoConfig - A configuration object.
|
|
43
|
+
*/
|
|
44
|
+
constructor(lqcoConfig: LocalQueryComparisonOptionsConfig);
|
|
45
|
+
/**
|
|
46
|
+
Case insensitive SQL compliant options - this is also the default unless otherwise changed.
|
|
47
|
+
*/
|
|
48
|
+
static caseInsensitiveSQL: LocalQueryComparisonOptions;
|
|
49
|
+
/**
|
|
50
|
+
The default value whenever LocalQueryComparisonOptions are not specified. By default this is 'caseInsensitiveSQL'.
|
|
51
|
+
*/
|
|
52
|
+
static defaultInstance: LocalQueryComparisonOptions;
|
|
53
|
+
/**
|
|
54
|
+
Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
|
|
55
|
+
The current instance is returned unchanged.
|
|
56
|
+
```ts
|
|
57
|
+
var lqco = new LocalQueryComparisonOptions({
|
|
58
|
+
isCaseSensitive: false;
|
|
59
|
+
usesSql92CompliantStringComparison: true;
|
|
60
|
+
});
|
|
61
|
+
lqco.setAsDefault();
|
|
62
|
+
```
|
|
63
|
+
*/
|
|
64
|
+
setAsDefault(): any;
|
|
65
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { core, getUuid } from '../core/core.js';
|
|
2
|
+
import { assertConfig } from '../core/assert-param.js';
|
|
3
|
+
import { config } from '../config/config.js';
|
|
4
|
+
/**
|
|
5
|
+
A LocalQueryComparisonOptions instance is used to specify the "comparison rules" used when performing "local queries" in order
|
|
6
|
+
to match the semantics of these same queries when executed against a remote service. These options should be set based on the
|
|
7
|
+
manner in which your remote service interprets certain comparison operations.
|
|
8
|
+
|
|
9
|
+
The default LocalQueryComparisonOptions stipulates 'caseInsensitive" queries with ANSI SQL rules regarding comparisons of unequal
|
|
10
|
+
length strings.
|
|
11
|
+
*/
|
|
12
|
+
export class LocalQueryComparisonOptions {
|
|
13
|
+
/**
|
|
14
|
+
LocalQueryComparisonOptions constructor
|
|
15
|
+
```ts
|
|
16
|
+
// create a 'caseSensitive - non SQL' instance.
|
|
17
|
+
var lqco = new LocalQueryComparisonOptions({
|
|
18
|
+
name: "caseSensitive-nonSQL"
|
|
19
|
+
isCaseSensitive: true;
|
|
20
|
+
usesSql92CompliantStringComparison: false;
|
|
21
|
+
});
|
|
22
|
+
// either apply it globally
|
|
23
|
+
lqco.setAsDefault();
|
|
24
|
+
// or to a specific MetadataStore
|
|
25
|
+
var ms = new MetadataStore({ localQueryComparisonOptions: lqco });
|
|
26
|
+
var em = new EntityManager( { metadataStore: ms });
|
|
27
|
+
```
|
|
28
|
+
@param lqcoConfig - A configuration object.
|
|
29
|
+
*/
|
|
30
|
+
constructor(lqcoConfig) {
|
|
31
|
+
assertConfig(lqcoConfig || {})
|
|
32
|
+
.whereParam("name").isOptional().isString()
|
|
33
|
+
.whereParam("isCaseSensitive").isOptional().isBoolean().withDefault(false)
|
|
34
|
+
.whereParam("usesSql92CompliantStringComparison").isOptional().isBoolean().withDefault(true)
|
|
35
|
+
.applyAll(this);
|
|
36
|
+
if (!this.name) {
|
|
37
|
+
this.name = getUuid();
|
|
38
|
+
}
|
|
39
|
+
config._storeObject(this, "LocalQueryComparisonOptions", this.name);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
Case insensitive SQL compliant options - this is also the default unless otherwise changed.
|
|
43
|
+
*/
|
|
44
|
+
static caseInsensitiveSQL = new LocalQueryComparisonOptions({
|
|
45
|
+
name: "caseInsensitiveSQL",
|
|
46
|
+
isCaseSensitive: false,
|
|
47
|
+
usesSql92CompliantStringComparison: true
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
The default value whenever LocalQueryComparisonOptions are not specified. By default this is 'caseInsensitiveSQL'.
|
|
51
|
+
*/
|
|
52
|
+
static defaultInstance = new LocalQueryComparisonOptions(LocalQueryComparisonOptions.caseInsensitiveSQL);
|
|
53
|
+
/**
|
|
54
|
+
Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
|
|
55
|
+
The current instance is returned unchanged.
|
|
56
|
+
```ts
|
|
57
|
+
var lqco = new LocalQueryComparisonOptions({
|
|
58
|
+
isCaseSensitive: false;
|
|
59
|
+
usesSql92CompliantStringComparison: true;
|
|
60
|
+
});
|
|
61
|
+
lqco.setAsDefault();
|
|
62
|
+
```
|
|
63
|
+
*/
|
|
64
|
+
setAsDefault() {
|
|
65
|
+
return core.setAsDefault(this, LocalQueryComparisonOptions);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
LocalQueryComparisonOptions.prototype._$typeName = "LocalQueryComparisonOptions";
|
|
69
|
+
//# sourceMappingURL=local-query-comparison-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-query-comparison-options.js","sourceRoot":"","sources":["../../src/metadata/local-query-comparison-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAe7C;;;;;;;EAOE;AACF,MAAM,OAAO,2BAA2B;IAatC;;;;;;;;;;;;;;;;MAgBE;IACF,YAAY,UAA6C;QACvD,YAAY,CAAC,UAAU,IAAI,EAAE,CAAC;aACzB,UAAU,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE;aAC1C,UAAU,CAAC,iBAAiB,CAAC,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC;aACzE,UAAU,CAAC,oCAAoC,CAAC,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC;aAC3F,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,CAAC;QACxB,CAAC;QACD,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,6BAA6B,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC;IAED;;MAEE;IACF,MAAM,CAAC,kBAAkB,GAAG,IAAI,2BAA2B,CAAC;QAC1D,IAAI,EAAE,oBAAoB;QAC1B,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,IAAI;KACzC,CAAC,CAAC;IAEH;;MAEE;IACF,MAAM,CAAC,eAAe,GAAG,IAAI,2BAA2B,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,CAAC;IAEzG;;;;;;;;;;MAUE;IACF,YAAY;QACV,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,2BAA2B,CAAC,CAAC;IAC9D,CAAC;;AAGH,2BAA2B,CAAC,SAAS,CAAC,UAAU,GAAG,6BAA6B,CAAC","sourcesContent":["import { core, getUuid } from '../core/core.js';\r\nimport { assertConfig } from '../core/assert-param.js';\r\nimport { config } from '../config/config.js';\r\n\r\n\r\n/** Configuration info to be passed to the {@link LocalQueryComparisonOptions} constructor. */\r\nexport interface LocalQueryComparisonOptionsConfig {\r\n /** The name of this collection of configuration settings. */\r\n name?: string;\r\n /** Whether predicates that involve strings will be interpreted in a \"caseSensitive\" manner. Default is 'false'. */\r\n isCaseSensitive?: boolean;\r\n /** Whether or not to enforce the ANSI SQL standard\r\n of padding strings of unequal lengths before comparison with spaces. Note that per the standard, padding only occurs with equality and\r\n inequality predicates, and not with operations like 'startsWith', 'endsWith' or 'contains'. Default is true. */\r\n usesSql92CompliantStringComparison?: boolean;\r\n}\r\n\r\n/**\r\nA LocalQueryComparisonOptions instance is used to specify the \"comparison rules\" used when performing \"local queries\" in order\r\nto match the semantics of these same queries when executed against a remote service. These options should be set based on the\r\nmanner in which your remote service interprets certain comparison operations.\r\n\r\nThe default LocalQueryComparisonOptions stipulates 'caseInsensitive\" queries with ANSI SQL rules regarding comparisons of unequal\r\nlength strings.\r\n*/\r\nexport class LocalQueryComparisonOptions {\r\n /** @hidden @internal */\r\n declare _$typeName: string; // on prototype\r\n /** The name for this instance. */\r\n declare name: string;\r\n /** Whether predicates that involve strings will be interpreted in a \"caseSensitive\" manner. (default = false). */\r\n declare isCaseSensitive: boolean;\r\n /** Whether `==` and `!=` comparisons of strings ignore leading and trailing spaces, to match a SQL server's comparison of strings of unequal length. `startsWith`, `endsWith` and `contains` are unaffected. (default = true). */\r\n /* Whether or not to enforce the ANSI SQL standard\r\n of padding strings of unequal lengths before comparison with spaces. Note that per the standard, padding only occurs with equality and\r\n inequality predicates, and not with operations like 'startsWith', 'endsWith' or 'contains'. Default is true. */\r\n declare usesSql92CompliantStringComparison: boolean;\r\n\r\n /**\r\n LocalQueryComparisonOptions constructor\r\n ```ts\r\n // create a 'caseSensitive - non SQL' instance.\r\n var lqco = new LocalQueryComparisonOptions({\r\n name: \"caseSensitive-nonSQL\"\r\n isCaseSensitive: true;\r\n usesSql92CompliantStringComparison: false;\r\n });\r\n // either apply it globally\r\n lqco.setAsDefault();\r\n // or to a specific MetadataStore\r\n var ms = new MetadataStore({ localQueryComparisonOptions: lqco });\r\n var em = new EntityManager( { metadataStore: ms });\r\n ```\r\n @param lqcoConfig - A configuration object.\r\n */\r\n constructor(lqcoConfig: LocalQueryComparisonOptionsConfig) {\r\n assertConfig(lqcoConfig || {})\r\n .whereParam(\"name\").isOptional().isString()\r\n .whereParam(\"isCaseSensitive\").isOptional().isBoolean().withDefault(false)\r\n .whereParam(\"usesSql92CompliantStringComparison\").isOptional().isBoolean().withDefault(true)\r\n .applyAll(this);\r\n if (!this.name) {\r\n this.name = getUuid();\r\n }\r\n config._storeObject(this, \"LocalQueryComparisonOptions\", this.name);\r\n }\r\n\r\n /**\r\n Case insensitive SQL compliant options - this is also the default unless otherwise changed.\r\n */\r\n static caseInsensitiveSQL = new LocalQueryComparisonOptions({\r\n name: \"caseInsensitiveSQL\",\r\n isCaseSensitive: false,\r\n usesSql92CompliantStringComparison: true\r\n });\r\n\r\n /**\r\n The default value whenever LocalQueryComparisonOptions are not specified. By default this is 'caseInsensitiveSQL'.\r\n */\r\n static defaultInstance = new LocalQueryComparisonOptions(LocalQueryComparisonOptions.caseInsensitiveSQL);\r\n\r\n /**\r\n Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.\r\n The current instance is returned unchanged.\r\n ```ts\r\n var lqco = new LocalQueryComparisonOptions({\r\n isCaseSensitive: false;\r\n usesSql92CompliantStringComparison: true;\r\n });\r\n lqco.setAsDefault();\r\n ```\r\n */\r\n setAsDefault() {\r\n return core.setAsDefault(this, LocalQueryComparisonOptions);\r\n }\r\n\r\n}\r\nLocalQueryComparisonOptions.prototype._$typeName = \"LocalQueryComparisonOptions\";\r\n"]}
|
|
@@ -1,72 +1,75 @@
|
|
|
1
|
-
/** Configuration info to be passed to the
|
|
2
|
-
export interface NamingConventionConfig {
|
|
3
|
-
/** The name of this NamingConvention */
|
|
4
|
-
name?: string;
|
|
5
|
-
/** Function that takes a server property name add converts it into a client side property name. */
|
|
6
|
-
serverPropertyNameToClient?: (nm: string, context?: any) => string;
|
|
7
|
-
/** Function that takes a client property name add converts it into a server side property name. */
|
|
8
|
-
clientPropertyNameToServer?: (nm: string, context?: any) => string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
A NamingConvention instance is used to specify the naming conventions under which a MetadataStore
|
|
12
|
-
will translate property names between the server and the javascript client.
|
|
13
|
-
|
|
14
|
-
The default NamingConvention does not perform any translation, it simply passes property names thru unchanged.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
name
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
static none: NamingConvention;
|
|
49
|
-
/**
|
|
50
|
-
The "camelCase" naming convention - This implementation only lowercases the first character of the server property name
|
|
51
|
-
but leaves the rest of the property name intact. If a more complicated version is needed then one should be created via the ctor.
|
|
52
|
-
|
|
53
|
-
static camelCase: NamingConvention;
|
|
54
|
-
/**
|
|
55
|
-
The default value whenever NamingConventions are not specified.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
setAsDefault()
|
|
72
|
-
|
|
1
|
+
/** Configuration info to be passed to the {@link NamingConvention} constructor */
|
|
2
|
+
export interface NamingConventionConfig {
|
|
3
|
+
/** The name of this NamingConvention */
|
|
4
|
+
name?: string;
|
|
5
|
+
/** Function that takes a server property name add converts it into a client side property name. */
|
|
6
|
+
serverPropertyNameToClient?: (nm: string, context?: any) => string;
|
|
7
|
+
/** Function that takes a client property name add converts it into a server side property name. */
|
|
8
|
+
clientPropertyNameToServer?: (nm: string, context?: any) => string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
A NamingConvention instance is used to specify the naming conventions under which a MetadataStore
|
|
12
|
+
will translate property names between the server and the javascript client.
|
|
13
|
+
|
|
14
|
+
The default NamingConvention does not perform any translation, it simply passes property names thru unchanged.
|
|
15
|
+
*/
|
|
16
|
+
export declare class NamingConvention {
|
|
17
|
+
/** The name of this NamingConvention. __Read Only__ */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Function that takes a server property name add converts it into a client side property name. __Read Only__ */
|
|
20
|
+
serverPropertyNameToClient: (nm: string, context?: any) => string;
|
|
21
|
+
/** Function that takes a client property name add converts it into a server side property name. __Read Only__ */
|
|
22
|
+
clientPropertyNameToServer: (nm: string, context?: any) => string;
|
|
23
|
+
/**
|
|
24
|
+
NamingConvention constructor
|
|
25
|
+
```ts
|
|
26
|
+
// A naming convention that converts the first character of every property name to uppercase on the server
|
|
27
|
+
// and lowercase on the client.
|
|
28
|
+
var namingConv = new NamingConvention({
|
|
29
|
+
serverPropertyNameToClient: function(serverPropertyName) {
|
|
30
|
+
return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);
|
|
31
|
+
},
|
|
32
|
+
clientPropertyNameToServer: function(clientPropertyName) {
|
|
33
|
+
return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var ms = new MetadataStore({ namingConvention: namingConv });
|
|
37
|
+
var em = new EntityManager( { metadataStore: ms });
|
|
38
|
+
```
|
|
39
|
+
*/
|
|
40
|
+
constructor(ncConfig: NamingConventionConfig);
|
|
41
|
+
/**
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
A no-op naming convention: client property names are the server property names. Set it with
|
|
46
|
+
`NamingConvention.none.setAsDefault()` for a server that already sends the names the client should use.
|
|
47
|
+
*/
|
|
48
|
+
static none: NamingConvention;
|
|
49
|
+
/**
|
|
50
|
+
The "camelCase" naming convention - This implementation only lowercases the first character of the server property name
|
|
51
|
+
but leaves the rest of the property name intact. If a more complicated version is needed then one should be created via the ctor.
|
|
52
|
+
*/
|
|
53
|
+
static camelCase: NamingConvention;
|
|
54
|
+
/**
|
|
55
|
+
The default value whenever NamingConventions are not specified: `camelCase`, which suits a .NET
|
|
56
|
+
server. (2.x defaulted to `none`.)
|
|
57
|
+
*/
|
|
58
|
+
static defaultInstance: NamingConvention;
|
|
59
|
+
/**
|
|
60
|
+
Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
|
|
61
|
+
The current instance is returned unchanged.
|
|
62
|
+
```ts
|
|
63
|
+
var namingConv = new NamingConvention({
|
|
64
|
+
serverPropertyNameToClient: function(serverPropertyName) {
|
|
65
|
+
return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);
|
|
66
|
+
},
|
|
67
|
+
clientPropertyNameToServer: function(clientPropertyName) {
|
|
68
|
+
return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
namingConv.setAsDefault();
|
|
72
|
+
```
|
|
73
|
+
*/
|
|
74
|
+
setAsDefault(): any;
|
|
75
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { assertConfig } from '../core/assert-param.js';
|
|
2
|
+
import { core, getUuid } from '../core/core.js';
|
|
3
|
+
import { config } from '../config/config.js';
|
|
4
|
+
/**
|
|
5
|
+
A NamingConvention instance is used to specify the naming conventions under which a MetadataStore
|
|
6
|
+
will translate property names between the server and the javascript client.
|
|
7
|
+
|
|
8
|
+
The default NamingConvention does not perform any translation, it simply passes property names thru unchanged.
|
|
9
|
+
*/
|
|
10
|
+
export class NamingConvention {
|
|
11
|
+
/** Function that takes a server property name add converts it into a client side property name. __Read Only__ */
|
|
12
|
+
serverPropertyNameToClient;
|
|
13
|
+
/** Function that takes a client property name add converts it into a server side property name. __Read Only__ */
|
|
14
|
+
clientPropertyNameToServer;
|
|
15
|
+
/**
|
|
16
|
+
NamingConvention constructor
|
|
17
|
+
```ts
|
|
18
|
+
// A naming convention that converts the first character of every property name to uppercase on the server
|
|
19
|
+
// and lowercase on the client.
|
|
20
|
+
var namingConv = new NamingConvention({
|
|
21
|
+
serverPropertyNameToClient: function(serverPropertyName) {
|
|
22
|
+
return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);
|
|
23
|
+
},
|
|
24
|
+
clientPropertyNameToServer: function(clientPropertyName) {
|
|
25
|
+
return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
var ms = new MetadataStore({ namingConvention: namingConv });
|
|
29
|
+
var em = new EntityManager( { metadataStore: ms });
|
|
30
|
+
```
|
|
31
|
+
*/
|
|
32
|
+
constructor(ncConfig) {
|
|
33
|
+
assertConfig(ncConfig || {})
|
|
34
|
+
.whereParam("name").isOptional().isString()
|
|
35
|
+
.whereParam("serverPropertyNameToClient").isFunction()
|
|
36
|
+
.whereParam("clientPropertyNameToServer").isFunction()
|
|
37
|
+
.applyAll(this);
|
|
38
|
+
if (!this.name) {
|
|
39
|
+
this.name = getUuid();
|
|
40
|
+
}
|
|
41
|
+
config._storeObject(this, "NamingConvention", this.name);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
A no-op naming convention: client property names are the server property names. Set it with
|
|
48
|
+
`NamingConvention.none.setAsDefault()` for a server that already sends the names the client should use.
|
|
49
|
+
*/
|
|
50
|
+
static none = new NamingConvention({
|
|
51
|
+
name: "noChange",
|
|
52
|
+
serverPropertyNameToClient: (serverPropertyName) => {
|
|
53
|
+
return serverPropertyName;
|
|
54
|
+
},
|
|
55
|
+
clientPropertyNameToServer: (clientPropertyName) => {
|
|
56
|
+
return clientPropertyName;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
The "camelCase" naming convention - This implementation only lowercases the first character of the server property name
|
|
61
|
+
but leaves the rest of the property name intact. If a more complicated version is needed then one should be created via the ctor.
|
|
62
|
+
*/
|
|
63
|
+
static camelCase = new NamingConvention({
|
|
64
|
+
name: "camelCase",
|
|
65
|
+
serverPropertyNameToClient: (serverPropertyName) => {
|
|
66
|
+
return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);
|
|
67
|
+
},
|
|
68
|
+
clientPropertyNameToServer: (clientPropertyName) => {
|
|
69
|
+
return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
The default value whenever NamingConventions are not specified: `camelCase`, which suits a .NET
|
|
74
|
+
server. (2.x defaulted to `none`.)
|
|
75
|
+
*/
|
|
76
|
+
static defaultInstance = new NamingConvention(NamingConvention.camelCase);
|
|
77
|
+
/**
|
|
78
|
+
Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
|
|
79
|
+
The current instance is returned unchanged.
|
|
80
|
+
```ts
|
|
81
|
+
var namingConv = new NamingConvention({
|
|
82
|
+
serverPropertyNameToClient: function(serverPropertyName) {
|
|
83
|
+
return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);
|
|
84
|
+
},
|
|
85
|
+
clientPropertyNameToServer: function(clientPropertyName) {
|
|
86
|
+
return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
namingConv.setAsDefault();
|
|
90
|
+
```
|
|
91
|
+
*/
|
|
92
|
+
setAsDefault() {
|
|
93
|
+
return core.setAsDefault(this, NamingConvention);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
NamingConvention.prototype._$typeName = "NamingConvention";
|
|
97
|
+
//# sourceMappingURL=naming-convention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming-convention.js","sourceRoot":"","sources":["../../src/metadata/naming-convention.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAc7C;;;;;EAKE;AACF,MAAM,OAAO,gBAAgB;IAK3B,kHAAkH;IAClH,0BAA0B,CAAwC;IAClE,iHAAiH;IACjH,0BAA0B,CAAwC;IAElE;;;;;;;;;;;;;;;;MAgBE;IACF,YAAY,QAAgC;QAC1C,YAAY,CAAC,QAAQ,IAAI,EAAE,CAAC;aACvB,UAAU,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE;aAC1C,UAAU,CAAC,4BAA4B,CAAC,CAAC,UAAU,EAAE;aACrD,UAAU,CAAC,4BAA4B,CAAC,CAAC,UAAU,EAAE;aACrD,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,CAAC;QACxB,CAAC;QACD,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;MAME;IACF,MAAM,CAAC,IAAI,GAAG,IAAI,gBAAgB,CAAC;QACjC,IAAI,EAAE,UAAU;QAChB,0BAA0B,EAAE,CAAC,kBAAkB,EAAE,EAAE;YACjD,OAAO,kBAAkB,CAAC;QAC5B,CAAC;QACD,0BAA0B,EAAE,CAAC,kBAAkB,EAAE,EAAE;YACjD,OAAO,kBAAkB,CAAC;QAC5B,CAAC;KACF,CAAC,CAAC;IAEH;;;MAGE;IACF,MAAM,CAAC,SAAS,GAAG,IAAI,gBAAgB,CAAC;QACtC,IAAI,EAAE,WAAW;QACjB,0BAA0B,EAAE,CAAC,kBAAkB,EAAE,EAAE;YACjD,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACtF,CAAC;QACD,0BAA0B,EAAE,CAAC,kBAAkB,EAAE,EAAE;YACjD,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACtF,CAAC;KACF,CAAC,CAAC;IAEH;;;MAGE;IACF,MAAM,CAAC,eAAe,GAAG,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAE1E;;;;;;;;;;;;;;MAcE;IACF,YAAY;QACV,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACnD,CAAC;;AAIH,gBAAgB,CAAC,SAAS,CAAC,UAAU,GAAG,kBAAkB,CAAC","sourcesContent":["import { assertConfig } from '../core/assert-param.js';\r\nimport { core, getUuid } from '../core/core.js';\r\nimport { config } from '../config/config.js';\r\n\r\n// TODO: strongly type context object passed to naming convention converter fns.\r\n\r\n/** Configuration info to be passed to the {@link NamingConvention} constructor */\r\nexport interface NamingConventionConfig {\r\n /** The name of this NamingConvention */\r\n name?: string;\r\n /** Function that takes a server property name add converts it into a client side property name. */\r\n serverPropertyNameToClient?: (nm: string, context?: any) => string;\r\n /** Function that takes a client property name add converts it into a server side property name. */\r\n clientPropertyNameToServer?: (nm: string, context?: any) => string;\r\n}\r\n\r\n/**\r\nA NamingConvention instance is used to specify the naming conventions under which a MetadataStore\r\nwill translate property names between the server and the javascript client.\r\n\r\nThe default NamingConvention does not perform any translation, it simply passes property names thru unchanged.\r\n*/\r\nexport class NamingConvention {\r\n /** @hidden @internal */\r\n declare _$typeName: string;\r\n /** The name of this NamingConvention. __Read Only__ */\r\n declare name: string;\r\n /** Function that takes a server property name add converts it into a client side property name. __Read Only__ */\r\n serverPropertyNameToClient: (nm: string, context?: any) => string;\r\n /** Function that takes a client property name add converts it into a server side property name. __Read Only__ */\r\n clientPropertyNameToServer: (nm: string, context?: any) => string;\r\n\r\n /**\r\n NamingConvention constructor\r\n ```ts\r\n // A naming convention that converts the first character of every property name to uppercase on the server\r\n // and lowercase on the client.\r\n var namingConv = new NamingConvention({\r\n serverPropertyNameToClient: function(serverPropertyName) {\r\n return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);\r\n },\r\n clientPropertyNameToServer: function(clientPropertyName) {\r\n return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);\r\n } \r\n });\r\n var ms = new MetadataStore({ namingConvention: namingConv });\r\n var em = new EntityManager( { metadataStore: ms });\r\n ```\r\n */\r\n constructor(ncConfig: NamingConventionConfig ) {\r\n assertConfig(ncConfig || {})\r\n .whereParam(\"name\").isOptional().isString()\r\n .whereParam(\"serverPropertyNameToClient\").isFunction()\r\n .whereParam(\"clientPropertyNameToServer\").isFunction()\r\n .applyAll(this);\r\n if (!this.name) {\r\n this.name = getUuid();\r\n }\r\n config._storeObject(this, \"NamingConvention\", this.name);\r\n }\r\n\r\n /**\r\n\r\n\r\n /**\r\n A no-op naming convention: client property names are the server property names. Set it with\r\n `NamingConvention.none.setAsDefault()` for a server that already sends the names the client should use.\r\n */\r\n static none = new NamingConvention({\r\n name: \"noChange\",\r\n serverPropertyNameToClient: (serverPropertyName) => {\r\n return serverPropertyName;\r\n },\r\n clientPropertyNameToServer: (clientPropertyName) => {\r\n return clientPropertyName;\r\n }\r\n });\r\n\r\n /**\r\n The \"camelCase\" naming convention - This implementation only lowercases the first character of the server property name\r\n but leaves the rest of the property name intact. If a more complicated version is needed then one should be created via the ctor.\r\n */\r\n static camelCase = new NamingConvention({\r\n name: \"camelCase\",\r\n serverPropertyNameToClient: (serverPropertyName) => {\r\n return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);\r\n },\r\n clientPropertyNameToServer: (clientPropertyName) => {\r\n return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);\r\n }\r\n });\r\n\r\n /**\r\n The default value whenever NamingConventions are not specified: `camelCase`, which suits a .NET\r\n server. (2.x defaulted to `none`.)\r\n */\r\n static defaultInstance = new NamingConvention(NamingConvention.camelCase);\r\n\r\n /**\r\n Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.\r\n The current instance is returned unchanged.\r\n ```ts\r\n var namingConv = new NamingConvention({\r\n serverPropertyNameToClient: function(serverPropertyName) {\r\n return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);\r\n },\r\n clientPropertyNameToServer: function(clientPropertyName) {\r\n return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);\r\n } \r\n });\r\n namingConv.setAsDefault();\r\n ```\r\n */\r\n setAsDefault() {\r\n return core.setAsDefault(this, NamingConvention);\r\n }\r\n\r\n}\r\n\r\nNamingConvention.prototype._$typeName = \"NamingConvention\";\r\n\r\n\r\n\r\n\r\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Entity, EntityManager, EntityQuery, ExpandClause } from '../breeze.js';
|
|
2
|
+
/**
|
|
3
|
+
* An {@link EntityManager} with `getEntityGraph`, which returns entities together with everything
|
|
4
|
+
* an expand path reaches from them in the cache, including deleted entities. Importing
|
|
5
|
+
* `breeze-client/mixin-get-entity-graph` adds the method to every manager, but changes the
|
|
6
|
+
* prototype rather than the `EntityManager` type, so cast to this type to call it:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import 'breeze-client/mixin-get-entity-graph';
|
|
10
|
+
* import type { HasEntityGraph } from 'breeze-client/mixin-get-entity-graph';
|
|
11
|
+
*
|
|
12
|
+
* const graph = (em as HasEntityGraph).getEntityGraph(customer, 'orders.orderDetails');
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export interface HasEntityGraph extends EntityManager {
|
|
16
|
+
/**
|
|
17
|
+
Get related entities of root entity (or root entities) as specified by expand.
|
|
18
|
+
@example
|
|
19
|
+
const graph = (em as HasEntityGraph).getEntityGraph(customer, 'orders.orderDetails');
|
|
20
|
+
// the customer, all of its orders, and their details - including deleted ones
|
|
21
|
+
@param roots {Entity|Array of Entity} The root entity or root entities.
|
|
22
|
+
@param expand {String|Array of String|Object} an expand string, a query expand clause, or array of string paths
|
|
23
|
+
@returns {Array of Entity} root entities and their related entities, including deleted entities. Duplicates are removed and entity order is indeterminate.
|
|
24
|
+
*/
|
|
25
|
+
getEntityGraph(roots: Entity | Array<Entity>, expand: string | Array<string> | ExpandClause): Array<Entity>;
|
|
26
|
+
/**
|
|
27
|
+
Execute query locally and return both the query results and their related entities as specified by the optional expand parameter or the query's expand clause.
|
|
28
|
+
@example
|
|
29
|
+
const query = EntityQuery.from(Customer)
|
|
30
|
+
.where('companyName', 'startsWith', 'Alfred')
|
|
31
|
+
.expand('orders.orderDetails');
|
|
32
|
+
const graph = (em as HasEntityGraph).getEntityGraph(query);
|
|
33
|
+
// the 'Alfred' customers, their orders, and their details - including deleted ones
|
|
34
|
+
@param query {EntityQuery} A query to be executed against the manager's local cache.
|
|
35
|
+
@param [expand] {String|Array of String|Object} an expand string, a query expand clause, or array of string paths
|
|
36
|
+
@returns {Array of Entity} local queried root entities and their related entities, including deleted entities. Duplicates are removed and entity order is indeterminate.
|
|
37
|
+
*/
|
|
38
|
+
getEntityGraph(query: EntityQuery, expand?: string | Array<string> | ExpandClause): Array<Entity>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Adds `getEntityGraph` to `EntityManager.prototype`.
|
|
42
|
+
*
|
|
43
|
+
* Importing this module calls it, so an application only needs the import:
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* import 'breeze-client/mixin-get-entity-graph';
|
|
47
|
+
* import type { HasEntityGraph } from 'breeze-client/mixin-get-entity-graph';
|
|
48
|
+
*
|
|
49
|
+
* const graph = (em as HasEntityGraph).getEntityGraph(customer, 'orders.orderDetails');
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* Calling it yourself is for a bundler aggressive enough to drop a module imported only for its
|
|
53
|
+
* effect. This is the one module in the package that `sideEffects` in package.json names for
|
|
54
|
+
* that reason.
|
|
55
|
+
*
|
|
56
|
+
* @param emclass - Accepted for backwards compatibility and not used: the method always goes on
|
|
57
|
+
* `EntityManager.prototype`. Adding it twice is a no-op.
|
|
58
|
+
*
|
|
59
|
+
* @see {@link HasEntityGraph} for the method it adds.
|
|
60
|
+
*/
|
|
61
|
+
export declare function mixinEntityGraph(emclass: {
|
|
62
|
+
new (): EntityManager;
|
|
63
|
+
}): void;
|