breeze-client 2.1.6-mjs → 2.1.7
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/adapter-ajax-angularjs/{index.d.ts → breeze-client-adapter-ajax-angularjs.d.ts} +0 -1
- package/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.metadata.json +1 -0
- package/adapter-ajax-angularjs/package.json +13 -0
- package/adapter-ajax-fetch/{index.d.ts → breeze-client-adapter-ajax-fetch.d.ts} +0 -1
- package/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.metadata.json +1 -0
- package/adapter-ajax-fetch/package.json +13 -0
- package/adapter-ajax-httpclient/{index.d.ts → breeze-client-adapter-ajax-httpclient.d.ts} +0 -1
- package/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.metadata.json +1 -0
- package/adapter-ajax-httpclient/package.json +13 -0
- package/adapter-ajax-jquery/{index.d.ts → breeze-client-adapter-ajax-jquery.d.ts} +0 -1
- package/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.metadata.json +1 -0
- package/adapter-ajax-jquery/package.json +13 -0
- package/adapter-ajax-post/{index.d.ts → breeze-client-adapter-ajax-post.d.ts} +0 -1
- package/adapter-ajax-post/breeze-client-adapter-ajax-post.metadata.json +1 -0
- package/adapter-ajax-post/package.json +13 -0
- package/adapter-data-service-odata/{index.d.ts → breeze-client-adapter-data-service-odata.d.ts} +0 -1
- package/adapter-data-service-odata/breeze-client-adapter-data-service-odata.metadata.json +1 -0
- package/adapter-data-service-odata/package.json +13 -0
- package/adapter-data-service-webapi/{index.d.ts → breeze-client-adapter-data-service-webapi.d.ts} +0 -1
- package/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.metadata.json +1 -0
- package/adapter-data-service-webapi/package.json +13 -0
- package/adapter-model-library-backing-store/{index.d.ts → breeze-client-adapter-model-library-backing-store.d.ts} +0 -1
- package/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.metadata.json +1 -0
- package/adapter-model-library-backing-store/package.json +13 -0
- package/adapter-model-library-ko/{index.d.ts → breeze-client-adapter-model-library-ko.d.ts} +0 -1
- package/adapter-model-library-ko/breeze-client-adapter-model-library-ko.metadata.json +1 -0
- package/adapter-model-library-ko/package.json +13 -0
- package/adapter-uri-builder-json/{index.d.ts → breeze-client-adapter-uri-builder-json.d.ts} +0 -1
- package/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.metadata.json +1 -0
- package/adapter-uri-builder-json/package.json +13 -0
- package/adapter-uri-builder-odata/{index.d.ts → breeze-client-adapter-uri-builder-odata.d.ts} +0 -1
- package/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.metadata.json +1 -0
- package/adapter-uri-builder-odata/package.json +13 -0
- package/breeze-client.d.ts +8 -0
- package/breeze-client.metadata.json +1 -0
- package/bundles/breeze-client-adapter-ajax-angularjs.umd.js +190 -0
- package/bundles/breeze-client-adapter-ajax-angularjs.umd.js.map +1 -0
- package/bundles/breeze-client-adapter-ajax-angularjs.umd.min.js +2 -0
- package/bundles/breeze-client-adapter-ajax-angularjs.umd.min.js.map +1 -0
- package/bundles/breeze-client-adapter-ajax-fetch.umd.js +190 -0
- package/bundles/breeze-client-adapter-ajax-fetch.umd.js.map +1 -0
- package/bundles/breeze-client-adapter-ajax-fetch.umd.min.js +2 -0
- package/bundles/breeze-client-adapter-ajax-fetch.umd.min.js.map +1 -0
- package/bundles/breeze-client-adapter-ajax-httpclient.umd.js +195 -0
- package/bundles/breeze-client-adapter-ajax-httpclient.umd.js.map +1 -0
- package/bundles/breeze-client-adapter-ajax-httpclient.umd.min.js +2 -0
- package/bundles/breeze-client-adapter-ajax-httpclient.umd.min.js.map +1 -0
- package/bundles/breeze-client-adapter-ajax-jquery.umd.js +115 -0
- package/bundles/breeze-client-adapter-ajax-jquery.umd.js.map +1 -0
- package/bundles/breeze-client-adapter-ajax-jquery.umd.min.js +2 -0
- package/bundles/breeze-client-adapter-ajax-jquery.umd.min.js.map +1 -0
- package/bundles/breeze-client-adapter-ajax-post.umd.js +92 -0
- package/bundles/breeze-client-adapter-ajax-post.umd.js.map +1 -0
- package/bundles/breeze-client-adapter-ajax-post.umd.min.js +2 -0
- package/bundles/breeze-client-adapter-ajax-post.umd.min.js.map +1 -0
- package/bundles/breeze-client-adapter-data-service-odata.umd.js +747 -0
- package/bundles/breeze-client-adapter-data-service-odata.umd.js.map +1 -0
- package/bundles/breeze-client-adapter-data-service-odata.umd.min.js +16 -0
- package/bundles/breeze-client-adapter-data-service-odata.umd.min.js.map +1 -0
- package/bundles/breeze-client-adapter-data-service-webapi.umd.js +333 -0
- package/bundles/breeze-client-adapter-data-service-webapi.umd.js.map +1 -0
- package/bundles/breeze-client-adapter-data-service-webapi.umd.min.js +16 -0
- package/bundles/breeze-client-adapter-data-service-webapi.umd.min.js.map +1 -0
- package/bundles/breeze-client-adapter-model-library-backing-store.umd.js +280 -0
- package/bundles/breeze-client-adapter-model-library-backing-store.umd.js.map +1 -0
- package/bundles/breeze-client-adapter-model-library-backing-store.umd.min.js +2 -0
- package/bundles/breeze-client-adapter-model-library-backing-store.umd.min.js.map +1 -0
- package/bundles/breeze-client-adapter-model-library-ko.umd.js +252 -0
- package/bundles/breeze-client-adapter-model-library-ko.umd.js.map +1 -0
- package/bundles/breeze-client-adapter-model-library-ko.umd.min.js +2 -0
- package/bundles/breeze-client-adapter-model-library-ko.umd.min.js.map +1 -0
- package/bundles/breeze-client-adapter-uri-builder-json.umd.js +96 -0
- package/bundles/breeze-client-adapter-uri-builder-json.umd.js.map +1 -0
- package/bundles/breeze-client-adapter-uri-builder-json.umd.min.js +2 -0
- package/bundles/breeze-client-adapter-uri-builder-json.umd.min.js.map +1 -0
- package/bundles/breeze-client-adapter-uri-builder-odata.umd.js +262 -0
- package/bundles/breeze-client-adapter-uri-builder-odata.umd.js.map +1 -0
- package/bundles/breeze-client-adapter-uri-builder-odata.umd.min.js +2 -0
- package/bundles/breeze-client-adapter-uri-builder-odata.umd.min.js.map +1 -0
- package/bundles/breeze-client-mixin-get-entity-graph.umd.js +258 -0
- package/bundles/breeze-client-mixin-get-entity-graph.umd.js.map +1 -0
- package/bundles/breeze-client-mixin-get-entity-graph.umd.min.js +2 -0
- package/bundles/breeze-client-mixin-get-entity-graph.umd.min.js.map +1 -0
- package/bundles/breeze-client-mixin-save-queuing.umd.js +579 -0
- package/bundles/breeze-client-mixin-save-queuing.umd.js.map +1 -0
- package/bundles/breeze-client-mixin-save-queuing.umd.min.js +16 -0
- package/bundles/breeze-client-mixin-save-queuing.umd.min.js.map +1 -0
- package/bundles/breeze-client.umd.js +14231 -0
- package/bundles/breeze-client.umd.js.map +1 -0
- package/bundles/breeze-client.umd.min.js +16 -0
- package/bundles/breeze-client.umd.min.js.map +1 -0
- package/esm2015/adapter-ajax-angularjs/adapter-ajax-angularjs.js +130 -0
- package/esm2015/adapter-ajax-angularjs/adapter-core.js +49 -0
- package/esm2015/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.js +5 -0
- package/esm2015/adapter-ajax-fetch/adapter-ajax-fetch.js +130 -0
- package/esm2015/adapter-ajax-fetch/adapter-core.js +49 -0
- package/esm2015/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.js +5 -0
- package/esm2015/adapter-ajax-httpclient/adapter-ajax-httpclient.js +137 -0
- package/esm2015/adapter-ajax-httpclient/adapter-core.js +49 -0
- package/esm2015/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.js +5 -0
- package/esm2015/adapter-ajax-jquery/adapter-ajax-jquery.js +103 -0
- package/esm2015/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.js +5 -0
- package/esm2015/adapter-ajax-post/adapter-ajax-post.js +77 -0
- package/esm2015/adapter-ajax-post/breeze-client-adapter-ajax-post.js +5 -0
- package/esm2015/adapter-data-service-odata/adapter-core.js +49 -0
- package/esm2015/adapter-data-service-odata/adapter-data-service-odata.js +463 -0
- package/esm2015/adapter-data-service-odata/breeze-client-adapter-data-service-odata.js +5 -0
- package/esm2015/adapter-data-service-webapi/adapter-data-service-webapi.js +100 -0
- package/esm2015/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.js +5 -0
- package/esm2015/adapter-model-library-backing-store/adapter-model-library-backing-store.js +268 -0
- package/esm2015/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.js +5 -0
- package/esm2015/adapter-model-library-ko/adapter-model-library-ko.js +240 -0
- package/esm2015/adapter-model-library-ko/breeze-client-adapter-model-library-ko.js +5 -0
- package/esm2015/adapter-uri-builder-json/adapter-core.js +49 -0
- package/esm2015/adapter-uri-builder-json/adapter-uri-builder-json.js +36 -0
- package/esm2015/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.js +5 -0
- package/esm2015/adapter-uri-builder-odata/adapter-core.js +49 -0
- package/esm2015/adapter-uri-builder-odata/adapter-uri-builder-odata.js +192 -0
- package/esm2015/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.js +5 -0
- package/esm2015/breeze-client.js +9 -0
- package/esm2015/index.js +2 -0
- package/esm2015/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.js +5 -0
- package/esm2015/mixin-get-entity-graph/mixin-get-entity-graph.js +269 -0
- package/esm2015/mixin-save-queuing/breeze-client-mixin-save-queuing.js +5 -0
- package/esm2015/mixin-save-queuing/mixin-save-queuing.js +400 -0
- package/esm2015/src/abstract-data-service-adapter.js +327 -0
- package/esm2015/src/array.js +4 -0
- package/esm2015/src/assert-param.js +312 -0
- package/esm2015/src/breeze.js +85 -0
- package/esm2015/src/complex-array.js +119 -0
- package/esm2015/src/config.js +223 -0
- package/esm2015/src/core.js +714 -0
- package/esm2015/src/csdl-metadata-parser.js +385 -0
- package/esm2015/src/data-service.js +203 -0
- package/esm2015/src/data-type.js +503 -0
- package/esm2015/src/default-property-interceptor.js +460 -0
- package/{esm2022/src/entity-action.mjs → esm2015/src/entity-action.js} +25 -25
- package/esm2015/src/entity-aspect.js +804 -0
- package/esm2015/src/entity-group.js +187 -0
- package/esm2015/src/entity-key.js +116 -0
- package/esm2015/src/entity-manager.js +2094 -0
- package/esm2015/src/entity-metadata.js +2109 -0
- package/esm2015/src/entity-query.js +1015 -0
- package/esm2015/src/entity-state.js +107 -0
- package/esm2015/src/enum.js +141 -0
- package/esm2015/src/event.js +256 -0
- package/esm2015/src/interface-registry.js +41 -0
- package/esm2015/src/key-generator.js +108 -0
- package/esm2015/src/local-query-comparison-options.js +65 -0
- package/esm2015/src/mapping-context.js +411 -0
- package/esm2015/src/naming-convention.js +88 -0
- package/esm2015/src/observable-array.js +185 -0
- package/esm2015/src/predicate.js +1242 -0
- package/esm2015/src/primitive-array.js +87 -0
- package/esm2015/src/query-options.js +152 -0
- package/esm2015/src/relation-array.js +175 -0
- package/esm2015/src/save-options.js +41 -0
- package/esm2015/src/unattached-children-map.js +58 -0
- package/esm2015/src/validate.js +991 -0
- package/esm2015/src/validation-options.js +64 -0
- package/esm5/adapter-ajax-angularjs/adapter-ajax-angularjs.js +132 -0
- package/esm5/adapter-ajax-angularjs/adapter-core.js +49 -0
- package/esm5/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.js +5 -0
- package/esm5/adapter-ajax-fetch/adapter-ajax-fetch.js +132 -0
- package/esm5/adapter-ajax-fetch/adapter-core.js +49 -0
- package/esm5/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.js +5 -0
- package/esm5/adapter-ajax-httpclient/adapter-ajax-httpclient.js +139 -0
- package/esm5/adapter-ajax-httpclient/adapter-core.js +49 -0
- package/esm5/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.js +5 -0
- package/esm5/adapter-ajax-jquery/adapter-ajax-jquery.js +105 -0
- package/esm5/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.js +5 -0
- package/esm5/adapter-ajax-post/adapter-ajax-post.js +81 -0
- package/esm5/adapter-ajax-post/breeze-client-adapter-ajax-post.js +5 -0
- package/esm5/adapter-data-service-odata/adapter-core.js +49 -0
- package/{esm2022/adapter-data-service-odata/adapter-data-service-odata.mjs → esm5/adapter-data-service-odata/adapter-data-service-odata.js} +147 -138
- package/esm5/adapter-data-service-odata/breeze-client-adapter-data-service-odata.js +5 -0
- package/esm5/adapter-data-service-webapi/adapter-data-service-webapi.js +105 -0
- package/esm5/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.js +5 -0
- package/esm5/adapter-model-library-backing-store/adapter-model-library-backing-store.js +270 -0
- package/esm5/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.js +5 -0
- package/esm5/adapter-model-library-ko/adapter-model-library-ko.js +242 -0
- package/esm5/adapter-model-library-ko/breeze-client-adapter-model-library-ko.js +5 -0
- package/esm5/adapter-uri-builder-json/adapter-core.js +49 -0
- package/esm5/adapter-uri-builder-json/adapter-uri-builder-json.js +38 -0
- package/esm5/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.js +5 -0
- package/esm5/adapter-uri-builder-odata/adapter-core.js +49 -0
- package/esm5/adapter-uri-builder-odata/adapter-uri-builder-odata.js +197 -0
- package/esm5/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.js +5 -0
- package/esm5/breeze-client.js +9 -0
- package/esm5/index.js +2 -0
- package/esm5/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.js +5 -0
- package/esm5/mixin-get-entity-graph/mixin-get-entity-graph.js +269 -0
- package/esm5/mixin-save-queuing/breeze-client-mixin-save-queuing.js +5 -0
- package/esm5/mixin-save-queuing/mixin-save-queuing.js +412 -0
- package/esm5/src/abstract-data-service-adapter.js +333 -0
- package/esm5/src/array.js +4 -0
- package/esm5/src/assert-param.js +317 -0
- package/esm5/src/breeze.js +85 -0
- package/esm5/src/complex-array.js +119 -0
- package/esm5/src/config.js +228 -0
- package/esm5/src/core.js +722 -0
- package/esm5/src/csdl-metadata-parser.js +385 -0
- package/esm5/src/data-service.js +207 -0
- package/esm5/src/data-type.js +510 -0
- package/esm5/src/default-property-interceptor.js +460 -0
- package/esm5/src/entity-action.js +52 -0
- package/esm5/src/entity-aspect.js +810 -0
- package/esm5/src/entity-group.js +189 -0
- package/esm5/src/entity-key.js +118 -0
- package/esm5/src/entity-manager.js +2112 -0
- package/esm5/src/entity-metadata.js +2144 -0
- package/esm5/src/entity-query.js +1042 -0
- package/esm5/src/entity-state.js +114 -0
- package/esm5/src/enum.js +144 -0
- package/esm5/src/event.js +259 -0
- package/esm5/src/interface-registry.js +43 -0
- package/esm5/src/key-generator.js +111 -0
- package/esm5/src/local-query-comparison-options.js +67 -0
- package/esm5/src/mapping-context.js +413 -0
- package/{esm2022/src/naming-convention.mjs → esm5/src/naming-convention.js} +29 -35
- package/esm5/src/observable-array.js +201 -0
- package/esm5/src/predicate.js +1307 -0
- package/esm5/src/primitive-array.js +87 -0
- package/esm5/src/query-options.js +167 -0
- package/esm5/src/relation-array.js +175 -0
- package/esm5/src/save-options.js +43 -0
- package/esm5/src/unattached-children-map.js +60 -0
- package/{esm2022/src/validate.mjs → esm5/src/validate.js} +110 -116
- package/esm5/src/validation-options.js +66 -0
- package/{fesm2022/breeze-client-adapter-ajax-angularjs.mjs → fesm2015/breeze-client-adapter-ajax-angularjs.js} +1 -6
- package/fesm2015/breeze-client-adapter-ajax-angularjs.js.map +1 -0
- package/{fesm2022/breeze-client-adapter-ajax-fetch.mjs → fesm2015/breeze-client-adapter-ajax-fetch.js} +4 -9
- package/fesm2015/breeze-client-adapter-ajax-fetch.js.map +1 -0
- package/{fesm2022/breeze-client-adapter-ajax-httpclient.mjs → fesm2015/breeze-client-adapter-ajax-httpclient.js} +4 -6
- package/fesm2015/breeze-client-adapter-ajax-httpclient.js.map +1 -0
- package/{fesm2022/breeze-client-adapter-ajax-jquery.mjs → fesm2015/breeze-client-adapter-ajax-jquery.js} +2 -6
- package/fesm2015/breeze-client-adapter-ajax-jquery.js.map +1 -0
- package/{fesm2022/breeze-client-adapter-ajax-post.mjs → fesm2015/breeze-client-adapter-ajax-post.js} +1 -1
- package/fesm2015/breeze-client-adapter-ajax-post.js.map +1 -0
- package/{fesm2022/breeze-client-adapter-data-service-odata.mjs → fesm2015/breeze-client-adapter-data-service-odata.js} +69 -68
- package/fesm2015/breeze-client-adapter-data-service-odata.js.map +1 -0
- package/{fesm2022/breeze-client-adapter-data-service-webapi.mjs → fesm2015/breeze-client-adapter-data-service-webapi.js} +30 -30
- package/fesm2015/breeze-client-adapter-data-service-webapi.js.map +1 -0
- package/{fesm2022/breeze-client-adapter-model-library-backing-store.mjs → fesm2015/breeze-client-adapter-model-library-backing-store.js} +13 -14
- package/fesm2015/breeze-client-adapter-model-library-backing-store.js.map +1 -0
- package/{fesm2022/breeze-client-adapter-model-library-ko.mjs → fesm2015/breeze-client-adapter-model-library-ko.js} +13 -14
- package/fesm2015/breeze-client-adapter-model-library-ko.js.map +1 -0
- package/{fesm2022/breeze-client-adapter-uri-builder-json.mjs → fesm2015/breeze-client-adapter-uri-builder-json.js} +8 -9
- package/fesm2015/breeze-client-adapter-uri-builder-json.js.map +1 -0
- package/{fesm2022/breeze-client-adapter-uri-builder-odata.mjs → fesm2015/breeze-client-adapter-uri-builder-odata.js} +86 -86
- package/fesm2015/breeze-client-adapter-uri-builder-odata.js.map +1 -0
- package/{fesm2022/breeze-client-mixin-get-entity-graph.mjs → fesm2015/breeze-client-mixin-get-entity-graph.js} +1 -1
- package/fesm2015/breeze-client-mixin-get-entity-graph.js.map +1 -0
- package/{fesm2022/breeze-client-mixin-save-queuing.mjs → fesm2015/breeze-client-mixin-save-queuing.js} +2 -23
- package/fesm2015/breeze-client-mixin-save-queuing.js.map +1 -0
- package/{fesm2022/breeze-client.mjs → fesm2015/breeze-client.js} +1624 -2073
- package/fesm2015/breeze-client.js.map +1 -0
- package/fesm5/breeze-client-adapter-ajax-angularjs.js +186 -0
- package/fesm5/breeze-client-adapter-ajax-angularjs.js.map +1 -0
- package/fesm5/breeze-client-adapter-ajax-fetch.js +186 -0
- package/fesm5/breeze-client-adapter-ajax-fetch.js.map +1 -0
- package/fesm5/breeze-client-adapter-ajax-httpclient.js +193 -0
- package/fesm5/breeze-client-adapter-ajax-httpclient.js.map +1 -0
- package/fesm5/breeze-client-adapter-ajax-jquery.js +111 -0
- package/fesm5/breeze-client-adapter-ajax-jquery.js.map +1 -0
- package/fesm5/breeze-client-adapter-ajax-post.js +86 -0
- package/fesm5/breeze-client-adapter-ajax-post.js.map +1 -0
- package/fesm5/breeze-client-adapter-data-service-odata.js +523 -0
- package/fesm5/breeze-client-adapter-data-service-odata.js.map +1 -0
- package/fesm5/breeze-client-adapter-data-service-webapi.js +111 -0
- package/fesm5/breeze-client-adapter-data-service-webapi.js.map +1 -0
- package/fesm5/breeze-client-adapter-model-library-backing-store.js +276 -0
- package/fesm5/breeze-client-adapter-model-library-backing-store.js.map +1 -0
- package/fesm5/breeze-client-adapter-model-library-ko.js +248 -0
- package/fesm5/breeze-client-adapter-model-library-ko.js.map +1 -0
- package/fesm5/breeze-client-adapter-uri-builder-json.js +92 -0
- package/fesm5/breeze-client-adapter-uri-builder-json.js.map +1 -0
- package/fesm5/breeze-client-adapter-uri-builder-odata.js +250 -0
- package/fesm5/breeze-client-adapter-uri-builder-odata.js.map +1 -0
- package/fesm5/breeze-client-mixin-get-entity-graph.js +254 -0
- package/fesm5/breeze-client-mixin-get-entity-graph.js.map +1 -0
- package/fesm5/breeze-client-mixin-save-queuing.js +356 -0
- package/fesm5/breeze-client-mixin-save-queuing.js.map +1 -0
- package/fesm5/breeze-client.js +13953 -0
- package/fesm5/breeze-client.js.map +1 -0
- package/mixin-get-entity-graph/{index.d.ts → breeze-client-mixin-get-entity-graph.d.ts} +0 -1
- package/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.metadata.json +1 -0
- package/mixin-get-entity-graph/package.json +13 -0
- package/mixin-save-queuing/{index.d.ts → breeze-client-mixin-save-queuing.d.ts} +0 -1
- package/mixin-save-queuing/breeze-client-mixin-save-queuing.metadata.json +1 -0
- package/mixin-save-queuing/package.json +13 -0
- package/package.json +11 -93
- package/src/abstract-data-service-adapter.d.ts +20 -0
- package/src/config.d.ts +1 -1
- package/src/core.d.ts +1 -1
- package/src/entity-aspect.d.ts +1 -1
- package/src/entity-metadata.d.ts +6 -8
- package/src/entity-query.d.ts +18 -4
- 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/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 -294
- 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 -239
- package/esm2022/src/data-type.mjs +0 -507
- package/esm2022/src/default-property-interceptor.mjs +0 -460
- package/esm2022/src/entity-aspect.mjs +0 -897
- package/esm2022/src/entity-group.mjs +0 -192
- package/esm2022/src/entity-key.mjs +0 -127
- package/esm2022/src/entity-manager.mjs +0 -2183
- package/esm2022/src/entity-metadata.mjs +0 -2242
- package/esm2022/src/entity-query.mjs +0 -1005
- 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 -75
- package/esm2022/src/mapping-context.mjs +0 -422
- 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 -160
- package/esm2022/src/relation-array.mjs +0 -173
- package/esm2022/src/save-options.mjs +0 -51
- package/esm2022/src/unattached-children-map.mjs +0 -56
- package/esm2022/src/validation-options.mjs +0 -78
- package/fesm2022/breeze-client-adapter-ajax-angularjs.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-fetch.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-httpclient.mjs.map +0 -1
- 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.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.map +0 -1
- 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.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.map +0 -1
|
@@ -47,8 +47,6 @@ Note that we have Error['x'] = ... in some places in the code to prevent Terser
|
|
|
47
47
|
@dynamic
|
|
48
48
|
*/
|
|
49
49
|
class BreezeEnum {
|
|
50
|
-
/** @hidden @internal */
|
|
51
|
-
static _resolvedNamesAndSymbols;
|
|
52
50
|
/** */
|
|
53
51
|
constructor(propertiesObj) {
|
|
54
52
|
if (propertiesObj) {
|
|
@@ -144,14 +142,15 @@ class BreezeEnum {
|
|
|
144
142
|
/** See if this comment will make it into .d.ts */
|
|
145
143
|
let hasOwnProperty = uncurry(Object.prototype.hasOwnProperty);
|
|
146
144
|
let arraySlice = uncurry(Array.prototype.slice);
|
|
147
|
-
|
|
145
|
+
const ɵ0 = function () {
|
|
148
146
|
try {
|
|
149
147
|
return !!(Object.getPrototypeOf && Object.defineProperty({}, 'x', {}));
|
|
150
148
|
}
|
|
151
149
|
catch (e) {
|
|
152
150
|
return false;
|
|
153
151
|
}
|
|
154
|
-
}
|
|
152
|
+
};
|
|
153
|
+
let isES5Supported = ɵ0();
|
|
155
154
|
// iterate over object
|
|
156
155
|
function objectForEach(obj, kvFn) {
|
|
157
156
|
for (let key in obj) {
|
|
@@ -732,7 +731,7 @@ function isNumeric(n) {
|
|
|
732
731
|
}
|
|
733
732
|
// end of is Functions
|
|
734
733
|
// string functions
|
|
735
|
-
function stringStartsWith
|
|
734
|
+
function stringStartsWith(str, prefix) {
|
|
736
735
|
// returns true for empty string or null prefix
|
|
737
736
|
if ((!str))
|
|
738
737
|
return false;
|
|
@@ -740,7 +739,7 @@ function stringStartsWith$1(str, prefix) {
|
|
|
740
739
|
return true;
|
|
741
740
|
return str.indexOf(prefix, 0) === 0;
|
|
742
741
|
}
|
|
743
|
-
function stringEndsWith
|
|
742
|
+
function stringEndsWith(str, suffix) {
|
|
744
743
|
// returns true for empty string or null suffix
|
|
745
744
|
if ((!str))
|
|
746
745
|
return false;
|
|
@@ -830,8 +829,8 @@ const core = {
|
|
|
830
829
|
isNumeric: isNumeric,
|
|
831
830
|
identity: identity,
|
|
832
831
|
noop: noop,
|
|
833
|
-
stringStartsWith: stringStartsWith
|
|
834
|
-
stringEndsWith: stringEndsWith
|
|
832
|
+
stringStartsWith: stringStartsWith,
|
|
833
|
+
stringEndsWith: stringEndsWith,
|
|
835
834
|
formatString: formatString,
|
|
836
835
|
titleCase: titleCaseSpace,
|
|
837
836
|
toJson: toJson,
|
|
@@ -854,23 +853,19 @@ function isPrimitive(obj: any) {
|
|
|
854
853
|
|
|
855
854
|
/** @hidden @internal */
|
|
856
855
|
class Param {
|
|
857
|
-
// The %1 parameter
|
|
858
|
-
// is required
|
|
859
|
-
// must be a %2
|
|
860
|
-
// must be an instance of %2
|
|
861
|
-
// must be an instance of the %2 enumeration
|
|
862
|
-
// must have a %2 property
|
|
863
|
-
// must be an array where each element
|
|
864
|
-
// is optional or
|
|
865
|
-
v;
|
|
866
|
-
name;
|
|
867
|
-
defaultValue;
|
|
868
|
-
parent;
|
|
869
|
-
/** @hidden @internal */
|
|
870
|
-
_context;
|
|
871
|
-
/** @hidden @internal */
|
|
872
|
-
_contexts;
|
|
873
856
|
constructor(v, name) {
|
|
857
|
+
/** @hidden @internal */
|
|
858
|
+
this._applyOne = function (instance) {
|
|
859
|
+
if (this.v !== undefined) {
|
|
860
|
+
instance[this.name] = this.v;
|
|
861
|
+
}
|
|
862
|
+
else {
|
|
863
|
+
if (this.defaultValue !== undefined) {
|
|
864
|
+
instance[this.name] = this.defaultValue;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
this.MESSAGE_PREFIX = "The '%1' parameter ";
|
|
874
869
|
this.v = v;
|
|
875
870
|
this.name = name;
|
|
876
871
|
this._contexts = [null];
|
|
@@ -1016,18 +1011,6 @@ class Param {
|
|
|
1016
1011
|
}
|
|
1017
1012
|
}
|
|
1018
1013
|
}
|
|
1019
|
-
/** @hidden @internal */
|
|
1020
|
-
_applyOne = function (instance) {
|
|
1021
|
-
if (this.v !== undefined) {
|
|
1022
|
-
instance[this.name] = this.v;
|
|
1023
|
-
}
|
|
1024
|
-
else {
|
|
1025
|
-
if (this.defaultValue !== undefined) {
|
|
1026
|
-
instance[this.name] = this.defaultValue;
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
};
|
|
1030
|
-
MESSAGE_PREFIX = "The '%1' parameter ";
|
|
1031
1014
|
}
|
|
1032
1015
|
/** @hidden @internal */
|
|
1033
1016
|
let assertParam = function (v, name) {
|
|
@@ -1156,8 +1139,6 @@ function throwConfigError(instance, message) {
|
|
|
1156
1139
|
throw new Error(core.formatString("Error configuring an instance of '%1'. %2", (instance && instance._$typeName) || "object", message));
|
|
1157
1140
|
}
|
|
1158
1141
|
class ConfigParam {
|
|
1159
|
-
config;
|
|
1160
|
-
params;
|
|
1161
1142
|
constructor(config) {
|
|
1162
1143
|
if (typeof (config) !== "object") {
|
|
1163
1144
|
throw new Error("Configuration parameter should be an object, instead it is a: " + typeof (config));
|
|
@@ -1213,18 +1194,6 @@ Class to support basic event publication and subscription semantics.
|
|
|
1213
1194
|
@dynamic
|
|
1214
1195
|
**/
|
|
1215
1196
|
class BreezeEvent {
|
|
1216
|
-
/** @hidden @internal */
|
|
1217
|
-
static __eventNameMap = {};
|
|
1218
|
-
/** @hidden @internal */
|
|
1219
|
-
static __nextUnsubKey = 1;
|
|
1220
|
-
/** The name of this Event */
|
|
1221
|
-
name;
|
|
1222
|
-
/** The object doing the publication. i.e. the object to which this event is attached. */
|
|
1223
|
-
publisher;
|
|
1224
|
-
/** @hidden @internal */
|
|
1225
|
-
_subscribers;
|
|
1226
|
-
/** @hidden @internal */
|
|
1227
|
-
_defaultErrorCallback;
|
|
1228
1197
|
/**
|
|
1229
1198
|
Constructor for an Event
|
|
1230
1199
|
> salaryEvent = new BreezeEvent("salaryEvent", person);
|
|
@@ -1234,6 +1203,36 @@ class BreezeEvent {
|
|
|
1234
1203
|
If omitted then subscriber notification failures will be ignored.
|
|
1235
1204
|
**/
|
|
1236
1205
|
constructor(name, publisher, defaultErrorCallback) {
|
|
1206
|
+
/**
|
|
1207
|
+
Unsubscribe from this event.
|
|
1208
|
+
> // Assume order is a preexisting 'order' entity
|
|
1209
|
+
> let token = order.entityAspect.propertyChanged.subscribe(function (pcEvent) {
|
|
1210
|
+
> // do something
|
|
1211
|
+
> });
|
|
1212
|
+
> // sometime later
|
|
1213
|
+
> order.entityAspect.propertyChanged.unsubscribe(token);
|
|
1214
|
+
@param unsubKey - The value returned from the 'subscribe' method may be used to unsubscribe here.
|
|
1215
|
+
@return Whether unsubscription occured. This will return false if already unsubscribed or if the key simply
|
|
1216
|
+
cannot be found.
|
|
1217
|
+
**/
|
|
1218
|
+
this.unsubscribe = function (unsubKey) {
|
|
1219
|
+
if (!this._subscribers)
|
|
1220
|
+
return false;
|
|
1221
|
+
let subs = this._subscribers;
|
|
1222
|
+
let ix = core.arrayIndexOf(subs, function (s) {
|
|
1223
|
+
return s.unsubKey === unsubKey;
|
|
1224
|
+
});
|
|
1225
|
+
if (ix !== -1) {
|
|
1226
|
+
subs.splice(ix, 1);
|
|
1227
|
+
if (subs.length === 0) {
|
|
1228
|
+
this._subscribers = null;
|
|
1229
|
+
}
|
|
1230
|
+
return true;
|
|
1231
|
+
}
|
|
1232
|
+
else {
|
|
1233
|
+
return false;
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1237
1236
|
assertParam(name, "eventName").isNonEmptyString().check();
|
|
1238
1237
|
assertParam(publisher, "publisher").isObject().check();
|
|
1239
1238
|
this.name = name;
|
|
@@ -1318,36 +1317,6 @@ class BreezeEvent {
|
|
|
1318
1317
|
++BreezeEvent.__nextUnsubKey;
|
|
1319
1318
|
return unsubKey;
|
|
1320
1319
|
}
|
|
1321
|
-
/**
|
|
1322
|
-
Unsubscribe from this event.
|
|
1323
|
-
> // Assume order is a preexisting 'order' entity
|
|
1324
|
-
> let token = order.entityAspect.propertyChanged.subscribe(function (pcEvent) {
|
|
1325
|
-
> // do something
|
|
1326
|
-
> });
|
|
1327
|
-
> // sometime later
|
|
1328
|
-
> order.entityAspect.propertyChanged.unsubscribe(token);
|
|
1329
|
-
@param unsubKey - The value returned from the 'subscribe' method may be used to unsubscribe here.
|
|
1330
|
-
@return Whether unsubscription occured. This will return false if already unsubscribed or if the key simply
|
|
1331
|
-
cannot be found.
|
|
1332
|
-
**/
|
|
1333
|
-
unsubscribe = function (unsubKey) {
|
|
1334
|
-
if (!this._subscribers)
|
|
1335
|
-
return false;
|
|
1336
|
-
let subs = this._subscribers;
|
|
1337
|
-
let ix = core.arrayIndexOf(subs, function (s) {
|
|
1338
|
-
return s.unsubKey === unsubKey;
|
|
1339
|
-
});
|
|
1340
|
-
if (ix !== -1) {
|
|
1341
|
-
subs.splice(ix, 1);
|
|
1342
|
-
if (subs.length === 0) {
|
|
1343
|
-
this._subscribers = null;
|
|
1344
|
-
}
|
|
1345
|
-
return true;
|
|
1346
|
-
}
|
|
1347
|
-
else {
|
|
1348
|
-
return false;
|
|
1349
|
-
}
|
|
1350
|
-
};
|
|
1351
1320
|
/** remove all subscribers */
|
|
1352
1321
|
clear() {
|
|
1353
1322
|
this._subscribers = null;
|
|
@@ -1412,42 +1381,42 @@ class BreezeEvent {
|
|
|
1412
1381
|
// return ctor._isEnabled(getFullEventName(eventName), obj);
|
|
1413
1382
|
return BreezeEvent._isEnabled(eventName, 3);
|
|
1414
1383
|
}
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1384
|
+
}
|
|
1385
|
+
/** @hidden @internal */
|
|
1386
|
+
BreezeEvent.__eventNameMap = {};
|
|
1387
|
+
/** @hidden @internal */
|
|
1388
|
+
BreezeEvent.__nextUnsubKey = 1;
|
|
1389
|
+
/** @hidden @internal */
|
|
1390
|
+
BreezeEvent._isEnabled = function (eventName, obj) {
|
|
1391
|
+
let isEnabled = null;
|
|
1392
|
+
let ob = obj;
|
|
1393
|
+
let eventMap = ob._$eventMap;
|
|
1394
|
+
if (eventMap) {
|
|
1395
|
+
isEnabled = eventMap[eventName];
|
|
1396
|
+
}
|
|
1397
|
+
if (isEnabled != null) {
|
|
1398
|
+
if (typeof isEnabled === 'function') {
|
|
1399
|
+
return !!isEnabled(obj);
|
|
1422
1400
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1401
|
+
else {
|
|
1402
|
+
return !!isEnabled;
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
else {
|
|
1406
|
+
let parent = ob._getEventParent && ob._getEventParent();
|
|
1407
|
+
if (parent) {
|
|
1408
|
+
return !!this._isEnabled(eventName, parent);
|
|
1430
1409
|
}
|
|
1431
1410
|
else {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
return !!this._isEnabled(eventName, parent);
|
|
1435
|
-
}
|
|
1436
|
-
else {
|
|
1437
|
-
// default if not explicitly disabled.
|
|
1438
|
-
return true;
|
|
1439
|
-
}
|
|
1411
|
+
// default if not explicitly disabled.
|
|
1412
|
+
return true;
|
|
1440
1413
|
}
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1443
1416
|
// legacy support - deliberately not typed
|
|
1444
1417
|
core.Event = BreezeEvent;
|
|
1445
1418
|
|
|
1446
1419
|
class InterfaceDef {
|
|
1447
|
-
name;
|
|
1448
|
-
defaultInstance;
|
|
1449
|
-
/** @hidden @internal */
|
|
1450
|
-
_implMap;
|
|
1451
1420
|
constructor(name) {
|
|
1452
1421
|
this.name = name;
|
|
1453
1422
|
this.defaultInstance = undefined;
|
|
@@ -1473,23 +1442,18 @@ class InterfaceDef {
|
|
|
1473
1442
|
}
|
|
1474
1443
|
}
|
|
1475
1444
|
class BreezeConfig {
|
|
1476
|
-
functionRegistry = {};
|
|
1477
|
-
typeRegistry = {};
|
|
1478
|
-
objectRegistry = {};
|
|
1479
|
-
interfaceInitialized;
|
|
1480
|
-
stringifyPad = '';
|
|
1481
|
-
/** whether to prohibit eval() and Function() in breeze code */
|
|
1482
|
-
noEval;
|
|
1483
|
-
/** @hidden @internal */
|
|
1484
|
-
_interfaceRegistry; // will be set in adapter-interfaces. untyped here to avoid circularity issues.
|
|
1485
1445
|
constructor() {
|
|
1446
|
+
this.functionRegistry = {};
|
|
1447
|
+
this.typeRegistry = {};
|
|
1448
|
+
this.objectRegistry = {};
|
|
1449
|
+
this.stringifyPad = '';
|
|
1486
1450
|
this.interfaceInitialized = new BreezeEvent("interfaceInitialized", this);
|
|
1487
1451
|
if (this.noEval === undefined) {
|
|
1488
1452
|
try {
|
|
1489
1453
|
Error['x'] = Function('');
|
|
1490
1454
|
this.noEval = false; // eval succeeded
|
|
1491
1455
|
}
|
|
1492
|
-
catch {
|
|
1456
|
+
catch (_a) {
|
|
1493
1457
|
this.noEval = true; // eval failed, probably due to CSP
|
|
1494
1458
|
}
|
|
1495
1459
|
}
|
|
@@ -1687,24 +1651,6 @@ anytime a MetadataStore.fetchMetadata call occurs with a new dataService ( or se
|
|
|
1687
1651
|
|
|
1688
1652
|
**/
|
|
1689
1653
|
class DataService {
|
|
1690
|
-
/** @hidden @internal */
|
|
1691
|
-
_$typeName; // actually put on prototype.
|
|
1692
|
-
/** The serviceName for this DataService. __Read Only__ **/
|
|
1693
|
-
serviceName;
|
|
1694
|
-
/** The adapter name for the [[IDataServiceAdapter]] to be used with this service. __Read Only__ **/
|
|
1695
|
-
adapterName;
|
|
1696
|
-
/** The [[IDataServiceAdapter]] implementation instance associated with this EntityManager. __Read Only__ **/
|
|
1697
|
-
adapterInstance;
|
|
1698
|
-
/** The adapter name for the [[IUriBuilderAdapter]] to be used with this service. __Read Only__ **/
|
|
1699
|
-
uriBuilderName;
|
|
1700
|
-
/** The [[IUriBuilderAdapter]] implementation instance associated with this EntityManager. __Read Only__ **/
|
|
1701
|
-
uriBuilder;
|
|
1702
|
-
/** Whether the server can provide metadata for this service. __Read Only__ **/
|
|
1703
|
-
hasServerMetadata;
|
|
1704
|
-
/** The [[JsonResultsAdapter]] used to process the results of any query against this DataService. __Read Only__ **/
|
|
1705
|
-
jsonResultsAdapter;
|
|
1706
|
-
/** Whether to use JSONP when performing a 'GET' request against this service. __Read Only__ **/
|
|
1707
|
-
useJsonp;
|
|
1708
1654
|
/** DataService constructor
|
|
1709
1655
|
> var dataService = new DataService({
|
|
1710
1656
|
> serviceName: altServiceName,
|
|
@@ -1722,7 +1668,7 @@ class DataService {
|
|
|
1722
1668
|
@param config - A configuration object.
|
|
1723
1669
|
**/
|
|
1724
1670
|
constructor(config) {
|
|
1725
|
-
updateWithConfig
|
|
1671
|
+
updateWithConfig(this, config);
|
|
1726
1672
|
}
|
|
1727
1673
|
/**
|
|
1728
1674
|
Returns a copy of this DataService with the specified properties applied.
|
|
@@ -1732,7 +1678,7 @@ class DataService {
|
|
|
1732
1678
|
if (!config)
|
|
1733
1679
|
return this;
|
|
1734
1680
|
let result = new DataService(this);
|
|
1735
|
-
return updateWithConfig
|
|
1681
|
+
return updateWithConfig(result, config);
|
|
1736
1682
|
}
|
|
1737
1683
|
static resolve(dataServices) {
|
|
1738
1684
|
// final defaults
|
|
@@ -1803,7 +1749,7 @@ class DataService {
|
|
|
1803
1749
|
}
|
|
1804
1750
|
}
|
|
1805
1751
|
DataService.prototype._$typeName = "DataService";
|
|
1806
|
-
function updateWithConfig
|
|
1752
|
+
function updateWithConfig(obj, dsConfig) {
|
|
1807
1753
|
if (dsConfig) {
|
|
1808
1754
|
assertConfig(dsConfig)
|
|
1809
1755
|
.whereParam("serviceName").isOptional()
|
|
@@ -1824,24 +1770,6 @@ A JsonResultsAdapter instance is used to provide custom extraction and parsing l
|
|
|
1824
1770
|
This facility makes it possible for breeze to talk to virtually any web service and return objects that will be first class 'breeze' citizens.
|
|
1825
1771
|
**/
|
|
1826
1772
|
class JsonResultsAdapter {
|
|
1827
|
-
/** @hidden @internal */
|
|
1828
|
-
_$typeName; // actually put on prototype.
|
|
1829
|
-
/** The name of this adapter. This name is used to uniquely identify and locate this instance when an 'exported' JsonResultsAdapter is later imported. */
|
|
1830
|
-
name;
|
|
1831
|
-
/** A Function that is called once per query operation to extract the 'payload' from any json received over the wire.
|
|
1832
|
-
This method has a default implementation which simply returns the "results" property from any json returned as a result of executing the query. */
|
|
1833
|
-
extractResults; // TODO - refine
|
|
1834
|
-
/** A function that is called once per save operation to extract the entities from any json received over the wire. Must return an array.
|
|
1835
|
-
This method has a default implementation which simply returns the "entities" property from any json returned as a result of executing the save. */
|
|
1836
|
-
extractSaveResults;
|
|
1837
|
-
/** A function that is called once per save operation to extract the key mappings from any json received over the wire. Must return an array.
|
|
1838
|
-
This method has a default implementation which simply returns the "keyMappings" property from any json returned as a result of executing the save. */
|
|
1839
|
-
extractKeyMappings;
|
|
1840
|
-
/** A function that is called once per save operation to extract any deleted keys from any json received over the wire. Must return an array.
|
|
1841
|
-
This method has a default implementation which is to simply returns the "deletedKeys" property from any json returned as a result of executing the save. */
|
|
1842
|
-
extractDeletedKeys; // TODO: refine
|
|
1843
|
-
/** A visitor method that will be called on each node of the returned payload. */
|
|
1844
|
-
visitNode;
|
|
1845
1773
|
/**
|
|
1846
1774
|
JsonResultsAdapter constructor
|
|
1847
1775
|
|
|
@@ -1914,16 +1842,17 @@ const INT32_MIN = -2147483648;
|
|
|
1914
1842
|
const INT32_MAX = 2147483647;
|
|
1915
1843
|
const BYTE_MIN = 0;
|
|
1916
1844
|
const BYTE_MAX = 255;
|
|
1845
|
+
const ɵ0$1 = function (context) {
|
|
1846
|
+
if (context.property) {
|
|
1847
|
+
return context.property.resolveProperty("displayName") || context.propertyName || context.property.name;
|
|
1848
|
+
}
|
|
1849
|
+
else {
|
|
1850
|
+
return "Value";
|
|
1851
|
+
}
|
|
1852
|
+
};
|
|
1917
1853
|
// add common props and methods for every validator 'context' here.
|
|
1918
1854
|
let rootContext = {
|
|
1919
|
-
displayName:
|
|
1920
|
-
if (context.property) {
|
|
1921
|
-
return context.property.resolveProperty("displayName") || context.propertyName || context.property.name;
|
|
1922
|
-
}
|
|
1923
|
-
else {
|
|
1924
|
-
return "Value";
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1855
|
+
displayName: ɵ0$1
|
|
1927
1856
|
};
|
|
1928
1857
|
/**
|
|
1929
1858
|
Instances of the Validator class provide the logic to validate another object and provide a description of any errors
|
|
@@ -2061,13 +1990,6 @@ of additional properties that will be automatically added to this object if not
|
|
|
2061
1990
|
@dynamic
|
|
2062
1991
|
**/
|
|
2063
1992
|
class Validator {
|
|
2064
|
-
/** @hidden @internal */
|
|
2065
|
-
_$typeName; // on proto
|
|
2066
|
-
name;
|
|
2067
|
-
valFn;
|
|
2068
|
-
context;
|
|
2069
|
-
currentContext;
|
|
2070
|
-
_baseContext;
|
|
2071
1993
|
constructor(name, valFn, context) {
|
|
2072
1994
|
// _baseContext is what will get serialized
|
|
2073
1995
|
this._baseContext = context || {};
|
|
@@ -2216,491 +2138,491 @@ class Validator {
|
|
|
2216
2138
|
static registerFactory(validatorFactory, name) {
|
|
2217
2139
|
config.registerFunction(validatorFactory, "Validator." + name);
|
|
2218
2140
|
}
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
var countryValidator = new Validator("countryIsUS", valFn, { displayName: "Country" });
|
|
2229
|
-
Validator.messageTemplates.countryIsUS = "'%displayName%' must start with 'US'";
|
|
2230
|
-
// This will have a similar effect to this
|
|
2231
|
-
var countryValidator = new Validator("countryIsUS", valFn, {
|
|
2232
|
-
displayName: "Country",
|
|
2233
|
-
messageTemplate: "'%displayName%' must start with 'US'"
|
|
2234
|
-
});
|
|
2235
|
-
@property messageTemplates {Object}
|
|
2236
|
-
@static
|
|
2237
|
-
**/
|
|
2238
|
-
static messageTemplates = {
|
|
2239
|
-
bool: "'%displayName%' must be a 'true' or 'false' value",
|
|
2240
|
-
creditCard: "The %displayName% is not a valid credit card number",
|
|
2241
|
-
date: "'%displayName%' must be a date",
|
|
2242
|
-
duration: "'%displayName%' must be a ISO8601 duration string, such as 'P3H24M60S'",
|
|
2243
|
-
emailAddress: "The %displayName% '%value%' is not a valid email address",
|
|
2244
|
-
guid: "'%displayName%' must be a GUID",
|
|
2245
|
-
integer: "'%displayName%' must be an integer",
|
|
2246
|
-
integerRange: "'%displayName%' must be an integer between the values of %minValue% and %maxValue%",
|
|
2247
|
-
maxLength: "'%displayName%' must be a string with %maxLength% characters or less",
|
|
2248
|
-
number: "'%displayName%' must be a number",
|
|
2249
|
-
phone: "The %displayName% '%value%' is not a valid phone number",
|
|
2250
|
-
regularExpression: "The %displayName% '%value%' does not match '%expression%'",
|
|
2251
|
-
required: "'%displayName%' is required",
|
|
2252
|
-
string: "'%displayName%' must be a string",
|
|
2253
|
-
stringLength: "'%displayName%' must be a string with between %minLength% and %maxLength% characters",
|
|
2254
|
-
url: "The %displayName% '%value%' is not a valid url"
|
|
2255
|
-
};
|
|
2256
|
-
/**
|
|
2257
|
-
Returns a standard 'required value' Validator
|
|
2258
|
-
@example
|
|
2259
|
-
// Assume em1 is a preexisting EntityManager.
|
|
2260
|
-
var custType = em1.metadataStore.getEntityType("Customer");
|
|
2261
|
-
var regionProperty - custType.getProperty("Region");
|
|
2262
|
-
// Makes "Region" on Customer a required property.
|
|
2263
|
-
regionProperty.validators.push(Validator.required());
|
|
2264
|
-
// or to allow empty strings
|
|
2265
|
-
regionProperty.validators.push(Validator.required({ allowEmptyStrings: true }););
|
|
2266
|
-
@method required
|
|
2267
|
-
@static
|
|
2268
|
-
@param context {Object}
|
|
2269
|
-
@param [context.allowEmptyStrings] {Boolean} If this parameter is omitted or false then empty strings do NOT pass validation.
|
|
2270
|
-
@return {Validator} A new Validator
|
|
2271
|
-
**/
|
|
2272
|
-
static required = function (context) {
|
|
2273
|
-
let valFn = function (v, ctx) {
|
|
2274
|
-
if (typeof v === "string") {
|
|
2275
|
-
if (ctx && ctx.allowEmptyStrings)
|
|
2276
|
-
return true;
|
|
2277
|
-
return v.length > 0;
|
|
2278
|
-
}
|
|
2279
|
-
else {
|
|
2280
|
-
return v != null;
|
|
2281
|
-
}
|
|
2282
|
-
};
|
|
2283
|
-
return new Validator("required", valFn, context);
|
|
2141
|
+
}
|
|
2142
|
+
/**
|
|
2143
|
+
Map of standard error message templates keyed by validator name.
|
|
2144
|
+
You can add to or modify this object to customize the template used for any validation error message.
|
|
2145
|
+
@example
|
|
2146
|
+
// v is this function is the value to be validated, in this case a "country" string.
|
|
2147
|
+
var valFn = function (v) {
|
|
2148
|
+
if (v == null) return true;
|
|
2149
|
+
return (core.stringStartsWith(v, "US"));
|
|
2284
2150
|
};
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2151
|
+
var countryValidator = new Validator("countryIsUS", valFn, { displayName: "Country" });
|
|
2152
|
+
Validator.messageTemplates.countryIsUS = "'%displayName%' must start with 'US'";
|
|
2153
|
+
// This will have a similar effect to this
|
|
2154
|
+
var countryValidator = new Validator("countryIsUS", valFn, {
|
|
2155
|
+
displayName: "Country",
|
|
2156
|
+
messageTemplate: "'%displayName%' must start with 'US'"
|
|
2157
|
+
});
|
|
2158
|
+
@property messageTemplates {Object}
|
|
2159
|
+
@static
|
|
2160
|
+
**/
|
|
2161
|
+
Validator.messageTemplates = {
|
|
2162
|
+
bool: "'%displayName%' must be a 'true' or 'false' value",
|
|
2163
|
+
creditCard: "The %displayName% is not a valid credit card number",
|
|
2164
|
+
date: "'%displayName%' must be a date",
|
|
2165
|
+
duration: "'%displayName%' must be a ISO8601 duration string, such as 'P3H24M60S'",
|
|
2166
|
+
emailAddress: "The %displayName% '%value%' is not a valid email address",
|
|
2167
|
+
guid: "'%displayName%' must be a GUID",
|
|
2168
|
+
integer: "'%displayName%' must be an integer",
|
|
2169
|
+
integerRange: "'%displayName%' must be an integer between the values of %minValue% and %maxValue%",
|
|
2170
|
+
maxLength: "'%displayName%' must be a string with %maxLength% characters or less",
|
|
2171
|
+
number: "'%displayName%' must be a number",
|
|
2172
|
+
phone: "The %displayName% '%value%' is not a valid phone number",
|
|
2173
|
+
regularExpression: "The %displayName% '%value%' does not match '%expression%'",
|
|
2174
|
+
required: "'%displayName%' is required",
|
|
2175
|
+
string: "'%displayName%' must be a string",
|
|
2176
|
+
stringLength: "'%displayName%' must be a string with between %minLength% and %maxLength% characters",
|
|
2177
|
+
url: "The %displayName% '%value%' is not a valid url"
|
|
2178
|
+
};
|
|
2179
|
+
/**
|
|
2180
|
+
Returns a standard 'required value' Validator
|
|
2181
|
+
@example
|
|
2182
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2183
|
+
var custType = em1.metadataStore.getEntityType("Customer");
|
|
2184
|
+
var regionProperty - custType.getProperty("Region");
|
|
2185
|
+
// Makes "Region" on Customer a required property.
|
|
2186
|
+
regionProperty.validators.push(Validator.required());
|
|
2187
|
+
// or to allow empty strings
|
|
2188
|
+
regionProperty.validators.push(Validator.required({ allowEmptyStrings: true }););
|
|
2189
|
+
@method required
|
|
2190
|
+
@static
|
|
2191
|
+
@param context {Object}
|
|
2192
|
+
@param [context.allowEmptyStrings] {Boolean} If this parameter is omitted or false then empty strings do NOT pass validation.
|
|
2193
|
+
@return {Validator} A new Validator
|
|
2194
|
+
**/
|
|
2195
|
+
Validator.required = function (context) {
|
|
2196
|
+
let valFn = function (v, ctx) {
|
|
2197
|
+
if (typeof v === "string") {
|
|
2198
|
+
if (ctx && ctx.allowEmptyStrings)
|
|
2302
2199
|
return true;
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2200
|
+
return v.length > 0;
|
|
2201
|
+
}
|
|
2202
|
+
else {
|
|
2203
|
+
return v != null;
|
|
2204
|
+
}
|
|
2308
2205
|
};
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
return true;
|
|
2329
|
-
if (typeof (v) !== "string")
|
|
2330
|
-
return false;
|
|
2331
|
-
if (ctx.minLength != null && v.length < ctx.minLength)
|
|
2332
|
-
return false;
|
|
2333
|
-
if (ctx.maxLength != null && v.length > ctx.maxLength)
|
|
2334
|
-
return false;
|
|
2206
|
+
return new Validator("required", valFn, context);
|
|
2207
|
+
};
|
|
2208
|
+
/**
|
|
2209
|
+
Returns a standard maximum string length Validator; the maximum length must be specified
|
|
2210
|
+
@example
|
|
2211
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2212
|
+
var custType = em1.metadataStore.getEntityType("Customer");
|
|
2213
|
+
var regionProperty - custType.getProperty("Region");
|
|
2214
|
+
// Validates that the value of the Region property on Customer will be less than or equal to 5 characters.
|
|
2215
|
+
regionProperty.validators.push(Validator.maxLength( {maxLength: 5}));
|
|
2216
|
+
@method maxLength
|
|
2217
|
+
@static
|
|
2218
|
+
@param context {Object}
|
|
2219
|
+
@param context.maxLength {Integer}
|
|
2220
|
+
@return {Validator} A new Validator
|
|
2221
|
+
**/
|
|
2222
|
+
Validator.maxLength = function (context) {
|
|
2223
|
+
let valFn = function (v, ctx) {
|
|
2224
|
+
if (v == null)
|
|
2335
2225
|
return true;
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
/**
|
|
2340
|
-
Returns a standard string dataType Validator.
|
|
2341
|
-
@example
|
|
2342
|
-
// Assume em1 is a preexisting EntityManager.
|
|
2343
|
-
var custType = em1.metadataStore.getEntityType("Customer");
|
|
2344
|
-
var regionProperty - custType.getProperty("Region");
|
|
2345
|
-
// Validates that the value of the Region property on Customer is a string.
|
|
2346
|
-
regionProperty.validators.push(Validator.string());
|
|
2347
|
-
@method string
|
|
2348
|
-
@static
|
|
2349
|
-
@return {Validator} A new Validator
|
|
2350
|
-
**/
|
|
2351
|
-
static string = function () {
|
|
2352
|
-
let valFn = function (v) {
|
|
2353
|
-
if (v == null)
|
|
2354
|
-
return true;
|
|
2355
|
-
return (typeof v === "string");
|
|
2356
|
-
};
|
|
2357
|
-
return new Validator("string", valFn);
|
|
2358
|
-
};
|
|
2359
|
-
/**
|
|
2360
|
-
Returns a Guid data type Validator.
|
|
2361
|
-
@example
|
|
2362
|
-
// Assume em1 is a preexisting EntityManager.
|
|
2363
|
-
var custType = em1.metadataStore.getEntityType("Customer");
|
|
2364
|
-
var customerIdProperty - custType.getProperty("CustomerID");
|
|
2365
|
-
// Validates that the value of the CustomerID property on Customer is a Guid.
|
|
2366
|
-
customerIdProperty.validators.push(Validator.guid());
|
|
2367
|
-
@method guid
|
|
2368
|
-
@static
|
|
2369
|
-
@return {Validator} A new Validator
|
|
2370
|
-
**/
|
|
2371
|
-
static guid = function () {
|
|
2372
|
-
let valFn = function (v) {
|
|
2373
|
-
if (v == null)
|
|
2374
|
-
return true;
|
|
2375
|
-
return core.isGuid(v);
|
|
2376
|
-
};
|
|
2377
|
-
return new Validator("guid", valFn);
|
|
2378
|
-
};
|
|
2379
|
-
/**
|
|
2380
|
-
Returns a ISO 8601 duration string Validator.
|
|
2381
|
-
@example
|
|
2382
|
-
// Assume em1 is a preexisting EntityManager.
|
|
2383
|
-
var eventType = em1.metadataStore.getEntityType("Event");
|
|
2384
|
-
var elapsedTimeProperty - eventType.getProperty("ElapsedTime");
|
|
2385
|
-
// Validates that the value of the ElapsedTime property on Customer is a duration.
|
|
2386
|
-
elapsedTimeProperty.validators.push(Validator.duration());
|
|
2387
|
-
@method duration
|
|
2388
|
-
@static
|
|
2389
|
-
@return {Validator} A new Validator
|
|
2390
|
-
**/
|
|
2391
|
-
static duration = function () {
|
|
2392
|
-
let valFn = function (v) {
|
|
2393
|
-
if (v == null)
|
|
2394
|
-
return true;
|
|
2395
|
-
return core.isDuration(v);
|
|
2396
|
-
};
|
|
2397
|
-
return new Validator("duration", valFn);
|
|
2398
|
-
};
|
|
2399
|
-
/**
|
|
2400
|
-
Returns a standard numeric data type Validator.
|
|
2401
|
-
@example
|
|
2402
|
-
// Assume em1 is a preexisting EntityManager.
|
|
2403
|
-
var orderType = em1.metadataStore.getEntityType("Order");
|
|
2404
|
-
var freightProperty - orderType.getProperty("Freight");
|
|
2405
|
-
// Validates that the value of the Freight property on Order is a number.
|
|
2406
|
-
freightProperty.validators.push(Validator.number());
|
|
2407
|
-
@method number
|
|
2408
|
-
@static
|
|
2409
|
-
@return {Validator} A new Validator
|
|
2410
|
-
**/
|
|
2411
|
-
// TODO: may need to have seperate logic for single.
|
|
2412
|
-
static number = function (context) {
|
|
2413
|
-
let valFn = function (v, ctx) {
|
|
2414
|
-
if (v == null)
|
|
2415
|
-
return true;
|
|
2416
|
-
if (typeof v === "string" && ctx && ctx.allowString) {
|
|
2417
|
-
v = parseFloat(v);
|
|
2418
|
-
}
|
|
2419
|
-
return (typeof v === "number" && !isNaN(v));
|
|
2420
|
-
};
|
|
2421
|
-
return new Validator("number", valFn, context);
|
|
2226
|
+
if (typeof (v) !== "string")
|
|
2227
|
+
return false;
|
|
2228
|
+
return v.length <= ctx.maxLength;
|
|
2422
2229
|
};
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
return
|
|
2445
|
-
|
|
2446
|
-
|
|
2230
|
+
return new Validator("maxLength", valFn, context);
|
|
2231
|
+
};
|
|
2232
|
+
/**
|
|
2233
|
+
Returns a standard string length Validator; both minimum and maximum lengths must be specified.
|
|
2234
|
+
@example
|
|
2235
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2236
|
+
var custType = em1.metadataStore.getEntityType("Customer");
|
|
2237
|
+
var regionProperty - custType.getProperty("Region");
|
|
2238
|
+
// Validates that the value of the Region property on Customer will be
|
|
2239
|
+
// between 2 and 5 characters
|
|
2240
|
+
regionProperty.validators.push(Validator.stringLength( {minLength: 2, maxLength: 5});
|
|
2241
|
+
@method stringLength
|
|
2242
|
+
@static
|
|
2243
|
+
@param context {Object}
|
|
2244
|
+
@param context.maxLength {Integer}
|
|
2245
|
+
@param context.minLength {Integer}
|
|
2246
|
+
@return {Validator} A new Validator
|
|
2247
|
+
**/
|
|
2248
|
+
Validator.stringLength = function (context) {
|
|
2249
|
+
let valFn = function (v, ctx) {
|
|
2250
|
+
if (v == null)
|
|
2251
|
+
return true;
|
|
2252
|
+
if (typeof (v) !== "string")
|
|
2253
|
+
return false;
|
|
2254
|
+
if (ctx.minLength != null && v.length < ctx.minLength)
|
|
2255
|
+
return false;
|
|
2256
|
+
if (ctx.maxLength != null && v.length > ctx.maxLength)
|
|
2257
|
+
return false;
|
|
2258
|
+
return true;
|
|
2447
2259
|
};
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2260
|
+
return new Validator("stringLength", valFn, context);
|
|
2261
|
+
};
|
|
2262
|
+
/**
|
|
2263
|
+
Returns a standard string dataType Validator.
|
|
2264
|
+
@example
|
|
2265
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2266
|
+
var custType = em1.metadataStore.getEntityType("Customer");
|
|
2267
|
+
var regionProperty - custType.getProperty("Region");
|
|
2268
|
+
// Validates that the value of the Region property on Customer is a string.
|
|
2269
|
+
regionProperty.validators.push(Validator.string());
|
|
2270
|
+
@method string
|
|
2271
|
+
@static
|
|
2272
|
+
@return {Validator} A new Validator
|
|
2273
|
+
**/
|
|
2274
|
+
Validator.string = function () {
|
|
2275
|
+
let valFn = function (v) {
|
|
2276
|
+
if (v == null)
|
|
2277
|
+
return true;
|
|
2278
|
+
return (typeof v === "string");
|
|
2462
2279
|
};
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2280
|
+
return new Validator("string", valFn);
|
|
2281
|
+
};
|
|
2282
|
+
/**
|
|
2283
|
+
Returns a Guid data type Validator.
|
|
2284
|
+
@example
|
|
2285
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2286
|
+
var custType = em1.metadataStore.getEntityType("Customer");
|
|
2287
|
+
var customerIdProperty - custType.getProperty("CustomerID");
|
|
2288
|
+
// Validates that the value of the CustomerID property on Customer is a Guid.
|
|
2289
|
+
customerIdProperty.validators.push(Validator.guid());
|
|
2290
|
+
@method guid
|
|
2291
|
+
@static
|
|
2292
|
+
@return {Validator} A new Validator
|
|
2293
|
+
**/
|
|
2294
|
+
Validator.guid = function () {
|
|
2295
|
+
let valFn = function (v) {
|
|
2296
|
+
if (v == null)
|
|
2297
|
+
return true;
|
|
2298
|
+
return core.isGuid(v);
|
|
2477
2299
|
};
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2300
|
+
return new Validator("guid", valFn);
|
|
2301
|
+
};
|
|
2302
|
+
/**
|
|
2303
|
+
Returns a ISO 8601 duration string Validator.
|
|
2304
|
+
@example
|
|
2305
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2306
|
+
var eventType = em1.metadataStore.getEntityType("Event");
|
|
2307
|
+
var elapsedTimeProperty - eventType.getProperty("ElapsedTime");
|
|
2308
|
+
// Validates that the value of the ElapsedTime property on Customer is a duration.
|
|
2309
|
+
elapsedTimeProperty.validators.push(Validator.duration());
|
|
2310
|
+
@method duration
|
|
2311
|
+
@static
|
|
2312
|
+
@return {Validator} A new Validator
|
|
2313
|
+
**/
|
|
2314
|
+
Validator.duration = function () {
|
|
2315
|
+
let valFn = function (v) {
|
|
2316
|
+
if (v == null)
|
|
2317
|
+
return true;
|
|
2318
|
+
return core.isDuration(v);
|
|
2493
2319
|
};
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2320
|
+
return new Validator("duration", valFn);
|
|
2321
|
+
};
|
|
2322
|
+
/**
|
|
2323
|
+
Returns a standard numeric data type Validator.
|
|
2324
|
+
@example
|
|
2325
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2326
|
+
var orderType = em1.metadataStore.getEntityType("Order");
|
|
2327
|
+
var freightProperty - orderType.getProperty("Freight");
|
|
2328
|
+
// Validates that the value of the Freight property on Order is a number.
|
|
2329
|
+
freightProperty.validators.push(Validator.number());
|
|
2330
|
+
@method number
|
|
2331
|
+
@static
|
|
2332
|
+
@return {Validator} A new Validator
|
|
2333
|
+
**/
|
|
2334
|
+
// TODO: may need to have seperate logic for single.
|
|
2335
|
+
Validator.number = function (context) {
|
|
2336
|
+
let valFn = function (v, ctx) {
|
|
2337
|
+
if (v == null)
|
|
2338
|
+
return true;
|
|
2339
|
+
if (typeof v === "string" && ctx && ctx.allowString) {
|
|
2340
|
+
v = parseFloat(v);
|
|
2341
|
+
}
|
|
2342
|
+
return (typeof v === "number" && !isNaN(v));
|
|
2513
2343
|
};
|
|
2514
|
-
|
|
2515
|
-
|
|
2344
|
+
return new Validator("number", valFn, context);
|
|
2345
|
+
};
|
|
2346
|
+
Validator.double = Validator.number;
|
|
2347
|
+
Validator.single = Validator.number;
|
|
2348
|
+
/**
|
|
2349
|
+
Returns a standard large integer data type - 64 bit - Validator.
|
|
2350
|
+
@example
|
|
2351
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2352
|
+
var orderType = em1.metadataStore.getEntityType("Order");
|
|
2353
|
+
var freightProperty - orderType.getProperty("Freight");
|
|
2354
|
+
// Validates that the value of the Freight property on Order is within the range of a 64 bit integer.
|
|
2355
|
+
freightProperty.validators.push(Validator.int64());
|
|
2356
|
+
@method int64
|
|
2357
|
+
@static
|
|
2358
|
+
@return {Validator} A new Validator
|
|
2359
|
+
**/
|
|
2360
|
+
Validator.integer = function (context) {
|
|
2361
|
+
let valFn = function (v, ctx) {
|
|
2362
|
+
if (v == null)
|
|
2516
2363
|
return true;
|
|
2517
|
-
|
|
2518
|
-
|
|
2364
|
+
if (typeof v === "string" && ctx && ctx.allowString) {
|
|
2365
|
+
v = parseInt(v, 10);
|
|
2366
|
+
}
|
|
2367
|
+
return (typeof v === "number") && (!isNaN(v)) && Math.floor(v) === v;
|
|
2519
2368
|
};
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2369
|
+
return new Validator("integer", valFn, context);
|
|
2370
|
+
};
|
|
2371
|
+
Validator.int64 = Validator.integer;
|
|
2372
|
+
/**
|
|
2373
|
+
Returns a standard 32 bit integer data type Validator.
|
|
2374
|
+
@example
|
|
2375
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2376
|
+
var orderType = em1.metadataStore.getEntityType("Order");
|
|
2377
|
+
var freightProperty - orderType.getProperty("Freight");
|
|
2378
|
+
freightProperty.validators.push(Validator.int32());
|
|
2379
|
+
@method int32
|
|
2380
|
+
@static
|
|
2381
|
+
@return {Validator} A new Validator
|
|
2382
|
+
**/
|
|
2383
|
+
Validator.int32 = function (context) {
|
|
2384
|
+
return intRangeValidatorCtor("int32", INT32_MIN, INT32_MAX, context)();
|
|
2385
|
+
};
|
|
2386
|
+
/**
|
|
2387
|
+
Returns a standard 16 bit integer data type Validator.
|
|
2388
|
+
@example
|
|
2389
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2390
|
+
var orderType = em1.metadataStore.getEntityType("Order");
|
|
2391
|
+
var freightProperty - orderType.getProperty("Freight");
|
|
2392
|
+
// Validates that the value of the Freight property on Order is within the range of a 16 bit integer.
|
|
2393
|
+
freightProperty.validators.push(Validator.int16());
|
|
2394
|
+
@method int16
|
|
2395
|
+
@static
|
|
2396
|
+
@return {Validator} A new Validator
|
|
2397
|
+
**/
|
|
2398
|
+
Validator.int16 = function (context) {
|
|
2399
|
+
return intRangeValidatorCtor("int16", INT16_MIN, INT16_MAX, context)();
|
|
2400
|
+
};
|
|
2401
|
+
/**
|
|
2402
|
+
Returns a standard byte data type Validator. (This is a integer between 0 and 255 inclusive for js purposes).
|
|
2403
|
+
@example
|
|
2404
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2405
|
+
var orderType = em1.metadataStore.getEntityType("Order");
|
|
2406
|
+
var freightProperty - orderType.getProperty("Freight");
|
|
2407
|
+
// Validates that the value of the Freight property on Order is within the range of a 16 bit integer.
|
|
2408
|
+
// Probably not a very good validation to place on the Freight property.
|
|
2409
|
+
regionProperty.validators.push(Validator.byte());
|
|
2410
|
+
@method byte
|
|
2411
|
+
@static
|
|
2412
|
+
@return {Validator} A new Validator
|
|
2413
|
+
**/
|
|
2414
|
+
Validator.byte = function (context) {
|
|
2415
|
+
return intRangeValidatorCtor("byte", BYTE_MIN, BYTE_MAX, context)();
|
|
2416
|
+
};
|
|
2417
|
+
/**
|
|
2418
|
+
Returns a standard boolean data type Validator.
|
|
2419
|
+
@example
|
|
2420
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2421
|
+
var productType = em1.metadataStore.getEntityType("Product");
|
|
2422
|
+
var discontinuedProperty - productType.getProperty("Discontinued");
|
|
2423
|
+
// Validates that the value of the Discontinued property on Product is a boolean
|
|
2424
|
+
discontinuedProperty.validators.push(Validator.bool());
|
|
2425
|
+
@method bool
|
|
2426
|
+
@static
|
|
2427
|
+
@return {Validator} A new Validator
|
|
2428
|
+
**/
|
|
2429
|
+
Validator.bool = function () {
|
|
2430
|
+
let valFn = function (v) {
|
|
2431
|
+
if (v == null)
|
|
2432
|
+
return true;
|
|
2433
|
+
return (v === true) || (v === false);
|
|
2552
2434
|
};
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
// Assume em is a preexisting EntityManager.
|
|
2559
|
-
var personType = em.metadataStore.getEntityType("Person");
|
|
2560
|
-
var creditCardProperty = personType.getProperty("creditCard");
|
|
2561
|
-
// Validates that the value of the Person.creditCard property is credit card.
|
|
2562
|
-
creditCardProperty.validators.push(Validator.creditCard());
|
|
2563
|
-
@method creditCard
|
|
2564
|
-
@static
|
|
2565
|
-
@param [context] {Object} optional parameters to pass through to validation constructor
|
|
2566
|
-
@return {Validator} A new Validator
|
|
2567
|
-
**/
|
|
2568
|
-
static creditCard = function (context) {
|
|
2569
|
-
function valFn(v) {
|
|
2570
|
-
if (v == null || v === '')
|
|
2571
|
-
return true;
|
|
2572
|
-
if (typeof (v) !== 'string')
|
|
2573
|
-
return false;
|
|
2574
|
-
v = v.replace(/(\-|\s)/g, ""); // remove dashes and spaces
|
|
2575
|
-
if (!v || /\D/.test(v))
|
|
2576
|
-
return false; // all digits, not empty
|
|
2577
|
-
return luhn(v);
|
|
2578
|
-
}
|
|
2579
|
-
return new Validator('creditCard', valFn, context);
|
|
2435
|
+
return new Validator("bool", valFn);
|
|
2436
|
+
};
|
|
2437
|
+
Validator.none = function () {
|
|
2438
|
+
let valFn = function (v) {
|
|
2439
|
+
return true;
|
|
2580
2440
|
};
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
return false;
|
|
2441
|
+
return new Validator("none", valFn);
|
|
2442
|
+
};
|
|
2443
|
+
/**
|
|
2444
|
+
Returns a standard date data type Validator.
|
|
2445
|
+
@example
|
|
2446
|
+
// Assume em1 is a preexisting EntityManager.
|
|
2447
|
+
var orderType = em1.metadataStore.getEntityType("Order");
|
|
2448
|
+
var orderDateProperty - orderType.getProperty("OrderDate");
|
|
2449
|
+
// Validates that the value of the OrderDate property on Order is a date
|
|
2450
|
+
// Probably not a very good validation to place on the Freight property.
|
|
2451
|
+
orderDateProperty.validators.push(Validator.date());
|
|
2452
|
+
@method date
|
|
2453
|
+
@static
|
|
2454
|
+
@return {Validator} A new Validator
|
|
2455
|
+
**/
|
|
2456
|
+
Validator.date = function () {
|
|
2457
|
+
let valFn = function (v) {
|
|
2458
|
+
if (v == null)
|
|
2459
|
+
return true;
|
|
2460
|
+
if (typeof v === "string") {
|
|
2602
2461
|
try {
|
|
2603
|
-
|
|
2604
|
-
|
|
2462
|
+
return !isNaN(Date.parse(v));
|
|
2463
|
+
// old code
|
|
2464
|
+
// return __isDate(new Date(v));
|
|
2605
2465
|
}
|
|
2606
2466
|
catch (e) {
|
|
2607
|
-
|
|
2467
|
+
return false;
|
|
2608
2468
|
}
|
|
2609
2469
|
}
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
Returns the email address validator
|
|
2614
|
-
@example
|
|
2615
|
-
// Assume em is a preexisting EntityManager.
|
|
2616
|
-
var personType = em.metadataStore.getEntityType("Person");
|
|
2617
|
-
var emailProperty = personType.getProperty("email");
|
|
2618
|
-
// Validates that the value of the Person.email property is an email address.
|
|
2619
|
-
emailProperty.validators.push(Validator.emailAddress());
|
|
2620
|
-
@method emailAddress
|
|
2621
|
-
@static
|
|
2622
|
-
@param [context] {Object} optional parameters to pass through to validation constructor
|
|
2623
|
-
@return {Validator} A new Validator
|
|
2624
|
-
**/
|
|
2625
|
-
static emailAddress = function (context) {
|
|
2626
|
-
// See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/EmailAttribute.cs
|
|
2627
|
-
let reEmailAddress = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
|
|
2628
|
-
return makeRegExpValidator('emailAddress', reEmailAddress, null, context);
|
|
2629
|
-
};
|
|
2630
|
-
/**
|
|
2631
|
-
Returns the phone validator
|
|
2632
|
-
Provides basic assertions on the format and will help to eliminate most nonsense input
|
|
2633
|
-
Matches:
|
|
2634
|
-
International dialing prefix: {{}, +, 0, 0000} (with or without a trailing break character, if not '+': [-/. ])
|
|
2635
|
-
> ((\+)|(0(\d+)?[-/.\s]))
|
|
2636
|
-
Country code: {{}, 1, ..., 999} (with or without a trailing break character: [-/. ])
|
|
2637
|
-
> [1-9]\d{,2}[-/.\s]?
|
|
2638
|
-
Area code: {(0), ..., (000000), 0, ..., 000000} (with or without a trailing break character: [-/. ])
|
|
2639
|
-
> ((\(\d{1,6}\)|\d{1,6})[-/.\s]?)?
|
|
2640
|
-
Local: {0, ...}+ (with or without a trailing break character: [-/. ])
|
|
2641
|
-
> (\d+[-/.\s]?)+\d+
|
|
2642
|
-
@example
|
|
2643
|
-
// Assume em is a preexisting EntityManager.
|
|
2644
|
-
var customerType = em.metadataStore.getEntityType("Customer");
|
|
2645
|
-
var phoneProperty = customerType.getProperty("phone");
|
|
2646
|
-
// Validates that the value of the Customer.phone property is phone.
|
|
2647
|
-
phoneProperty.validators.push(Validator.phone());
|
|
2648
|
-
@method phone
|
|
2649
|
-
@static
|
|
2650
|
-
@param [context] {Object} optional parameters to pass through to validation constructor
|
|
2651
|
-
@return {Validator} A new Validator
|
|
2652
|
-
**/
|
|
2653
|
-
static phone = function (context) {
|
|
2654
|
-
// See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/Expressions.cs
|
|
2655
|
-
let rePhone = /^((\+|(0(\d+)?[-/.\s]?))[1-9]\d{0,2}[-/.\s]?)?((\(\d{1,6}\)|\d{1,6})[-/.\s]?)?(\d+[-/.\s]?)+\d+$/;
|
|
2656
|
-
return makeRegExpValidator('phone', rePhone, null, context);
|
|
2657
|
-
};
|
|
2658
|
-
/**
|
|
2659
|
-
Returns the URL (protocol required) validator
|
|
2660
|
-
@example
|
|
2661
|
-
// Assume em is a preexisting EntityManager.
|
|
2662
|
-
var personType = em.metadataStore.getEntityType("Person");
|
|
2663
|
-
var websiteProperty = personType.getProperty("website");
|
|
2664
|
-
// Validates that the value of the Person.website property is a URL.
|
|
2665
|
-
websiteProperty.validators.push(Validator.url());
|
|
2666
|
-
@method url
|
|
2667
|
-
@static
|
|
2668
|
-
@param [context] {Object} optional parameters to pass through to validation constructor
|
|
2669
|
-
@return {Validator} A new Validator
|
|
2670
|
-
**/
|
|
2671
|
-
static url = function (context) {
|
|
2672
|
-
//See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/UrlAttribute.cs
|
|
2673
|
-
let reUrlProtocolRequired = /^(https?|ftp):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|([a-zA-Z][\-a-zA-Z0-9]*)|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/;
|
|
2674
|
-
return makeRegExpValidator('url', reUrlProtocolRequired, null, context);
|
|
2470
|
+
else {
|
|
2471
|
+
return core.isDate(v);
|
|
2472
|
+
}
|
|
2675
2473
|
};
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
}
|
|
2474
|
+
return new Validator("date", valFn);
|
|
2475
|
+
};
|
|
2476
|
+
/**
|
|
2477
|
+
Returns a credit card number validator
|
|
2478
|
+
Performs a luhn algorithm checksum test for plausability
|
|
2479
|
+
catches simple mistakes; only service knows for sure
|
|
2480
|
+
@example
|
|
2481
|
+
// Assume em is a preexisting EntityManager.
|
|
2482
|
+
var personType = em.metadataStore.getEntityType("Person");
|
|
2483
|
+
var creditCardProperty = personType.getProperty("creditCard");
|
|
2484
|
+
// Validates that the value of the Person.creditCard property is credit card.
|
|
2485
|
+
creditCardProperty.validators.push(Validator.creditCard());
|
|
2486
|
+
@method creditCard
|
|
2487
|
+
@static
|
|
2488
|
+
@param [context] {Object} optional parameters to pass through to validation constructor
|
|
2489
|
+
@return {Validator} A new Validator
|
|
2490
|
+
**/
|
|
2491
|
+
Validator.creditCard = function (context) {
|
|
2492
|
+
function valFn(v) {
|
|
2493
|
+
if (v == null || v === '')
|
|
2494
|
+
return true;
|
|
2495
|
+
if (typeof (v) !== 'string')
|
|
2496
|
+
return false;
|
|
2497
|
+
v = v.replace(/(\-|\s)/g, ""); // remove dashes and spaces
|
|
2498
|
+
if (!v || /\D/.test(v))
|
|
2499
|
+
return false; // all digits, not empty
|
|
2500
|
+
return luhn(v);
|
|
2501
|
+
}
|
|
2502
|
+
return new Validator('creditCard', valFn, context);
|
|
2503
|
+
};
|
|
2504
|
+
/**
|
|
2505
|
+
Returns a regular expression validator; the expression must be specified
|
|
2506
|
+
@example
|
|
2507
|
+
// Add validator to a property. Assume em is a preexisting EntityManager.
|
|
2508
|
+
var customerType = em.metadataStore.getEntityType("Customer");
|
|
2509
|
+
var regionProperty = customerType.getProperty("Region");
|
|
2510
|
+
// Validates that the value of Customer.Region is 2 char uppercase alpha.
|
|
2511
|
+
regionProperty.validators.push(Validator.regularExpression( {expression: '^[A-Z]{2}$'} );
|
|
2512
|
+
@method regularExpression
|
|
2513
|
+
@static
|
|
2514
|
+
@param context {Object}
|
|
2515
|
+
@param context.expression {String} String form of the regular expression to apply
|
|
2516
|
+
@return {Validator} A new Validator
|
|
2517
|
+
**/
|
|
2518
|
+
Validator.regularExpression = function (context) {
|
|
2519
|
+
function valFn(v, ctx) {
|
|
2520
|
+
// do not invalidate if empty; use a separate required test
|
|
2521
|
+
if (v == null || v === '')
|
|
2522
|
+
return true;
|
|
2523
|
+
if (typeof (v) !== 'string')
|
|
2524
|
+
return false;
|
|
2525
|
+
try {
|
|
2526
|
+
let re = new RegExp(ctx.expression);
|
|
2527
|
+
return re.test(v);
|
|
2528
|
+
}
|
|
2529
|
+
catch (e) {
|
|
2530
|
+
throw new Error('Missing or invalid expression parameter to regExp validator');
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
return new Validator('regularExpression', valFn, context);
|
|
2534
|
+
};
|
|
2535
|
+
/**
|
|
2536
|
+
Returns the email address validator
|
|
2537
|
+
@example
|
|
2538
|
+
// Assume em is a preexisting EntityManager.
|
|
2539
|
+
var personType = em.metadataStore.getEntityType("Person");
|
|
2540
|
+
var emailProperty = personType.getProperty("email");
|
|
2541
|
+
// Validates that the value of the Person.email property is an email address.
|
|
2542
|
+
emailProperty.validators.push(Validator.emailAddress());
|
|
2543
|
+
@method emailAddress
|
|
2544
|
+
@static
|
|
2545
|
+
@param [context] {Object} optional parameters to pass through to validation constructor
|
|
2546
|
+
@return {Validator} A new Validator
|
|
2547
|
+
**/
|
|
2548
|
+
Validator.emailAddress = function (context) {
|
|
2549
|
+
// See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/EmailAttribute.cs
|
|
2550
|
+
let reEmailAddress = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
|
|
2551
|
+
return makeRegExpValidator('emailAddress', reEmailAddress, null, context);
|
|
2552
|
+
};
|
|
2553
|
+
/**
|
|
2554
|
+
Returns the phone validator
|
|
2555
|
+
Provides basic assertions on the format and will help to eliminate most nonsense input
|
|
2556
|
+
Matches:
|
|
2557
|
+
International dialing prefix: {{}, +, 0, 0000} (with or without a trailing break character, if not '+': [-/. ])
|
|
2558
|
+
> ((\+)|(0(\d+)?[-/.\s]))
|
|
2559
|
+
Country code: {{}, 1, ..., 999} (with or without a trailing break character: [-/. ])
|
|
2560
|
+
> [1-9]\d{,2}[-/.\s]?
|
|
2561
|
+
Area code: {(0), ..., (000000), 0, ..., 000000} (with or without a trailing break character: [-/. ])
|
|
2562
|
+
> ((\(\d{1,6}\)|\d{1,6})[-/.\s]?)?
|
|
2563
|
+
Local: {0, ...}+ (with or without a trailing break character: [-/. ])
|
|
2564
|
+
> (\d+[-/.\s]?)+\d+
|
|
2565
|
+
@example
|
|
2566
|
+
// Assume em is a preexisting EntityManager.
|
|
2567
|
+
var customerType = em.metadataStore.getEntityType("Customer");
|
|
2568
|
+
var phoneProperty = customerType.getProperty("phone");
|
|
2569
|
+
// Validates that the value of the Customer.phone property is phone.
|
|
2570
|
+
phoneProperty.validators.push(Validator.phone());
|
|
2571
|
+
@method phone
|
|
2572
|
+
@static
|
|
2573
|
+
@param [context] {Object} optional parameters to pass through to validation constructor
|
|
2574
|
+
@return {Validator} A new Validator
|
|
2575
|
+
**/
|
|
2576
|
+
Validator.phone = function (context) {
|
|
2577
|
+
// See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/Expressions.cs
|
|
2578
|
+
let rePhone = /^((\+|(0(\d+)?[-/.\s]?))[1-9]\d{0,2}[-/.\s]?)?((\(\d{1,6}\)|\d{1,6})[-/.\s]?)?(\d+[-/.\s]?)+\d+$/;
|
|
2579
|
+
return makeRegExpValidator('phone', rePhone, null, context);
|
|
2580
|
+
};
|
|
2581
|
+
/**
|
|
2582
|
+
Returns the URL (protocol required) validator
|
|
2583
|
+
@example
|
|
2584
|
+
// Assume em is a preexisting EntityManager.
|
|
2585
|
+
var personType = em.metadataStore.getEntityType("Person");
|
|
2586
|
+
var websiteProperty = personType.getProperty("website");
|
|
2587
|
+
// Validates that the value of the Person.website property is a URL.
|
|
2588
|
+
websiteProperty.validators.push(Validator.url());
|
|
2589
|
+
@method url
|
|
2590
|
+
@static
|
|
2591
|
+
@param [context] {Object} optional parameters to pass through to validation constructor
|
|
2592
|
+
@return {Validator} A new Validator
|
|
2593
|
+
**/
|
|
2594
|
+
Validator.url = function (context) {
|
|
2595
|
+
//See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/UrlAttribute.cs
|
|
2596
|
+
let reUrlProtocolRequired = /^(https?|ftp):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|([a-zA-Z][\-a-zA-Z0-9]*)|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-fA-F]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/;
|
|
2597
|
+
return makeRegExpValidator('url', reUrlProtocolRequired, null, context);
|
|
2598
|
+
};
|
|
2599
|
+
/**
|
|
2600
|
+
Creates a regular expression validator with a fixed expression.
|
|
2601
|
+
Many of the stock validators are built with this factory method.
|
|
2602
|
+
Their expressions are often derived from
|
|
2603
|
+
https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions
|
|
2604
|
+
You can try many of them at http://dataannotationsextensions.org/
|
|
2605
|
+
@example
|
|
2606
|
+
// Make a zipcode validator
|
|
2607
|
+
function zipValidator = Validator.makeRegExpValidator(
|
|
2608
|
+
"zipVal,
|
|
2609
|
+
/^\d{5}([\-]\d{4})?$/,
|
|
2610
|
+
"The %displayName% '%value%' is not a valid U.S. zipcode");
|
|
2611
|
+
// Register it.
|
|
2612
|
+
Validator.register(zipValidator);
|
|
2613
|
+
// Add it to a data property. Assume em is a preexisting EntityManager.
|
|
2614
|
+
var custType = em.metadataStore.getEntityType("Customer");
|
|
2615
|
+
var zipProperty = custType.getProperty("PostalCode");
|
|
2616
|
+
zipProperty.validators.push(zipValidator);
|
|
2617
|
+
@method makeRegExpValidator
|
|
2618
|
+
@static
|
|
2619
|
+
@param validatorName {String} name of this validator
|
|
2620
|
+
@param expression {String | RegExp} regular expression to apply
|
|
2621
|
+
@param [defaultMessage] {String} default message for failed validations
|
|
2622
|
+
@param [context] {Object} optional parameters to pass through to validation constructor
|
|
2623
|
+
@return {Validator} A new Validator
|
|
2624
|
+
**/
|
|
2625
|
+
Validator.makeRegExpValidator = makeRegExpValidator;
|
|
2704
2626
|
Validator.prototype._$typeName = "Validator";
|
|
2705
2627
|
// register all validators
|
|
2706
2628
|
Error['x'] = core.objectForEach(Validator, function (key, value) {
|
|
@@ -2787,14 +2709,7 @@ function makeRegExpValidator(validatorName, expression, defaultMessage, context)
|
|
|
2787
2709
|
};
|
|
2788
2710
|
return new Validator(validatorName, valFn, context);
|
|
2789
2711
|
}
|
|
2790
|
-
|
|
2791
|
-
// function luhn(a: string, b: number, c: number, d: number, e: number) {
|
|
2792
|
-
// for (d = +a[b = a.length - 1], e = 0; b--; ) {
|
|
2793
|
-
// c = +a[b], d += ++e % 2 ? 2 * c % 10 + (c > 4) : c;
|
|
2794
|
-
// }
|
|
2795
|
-
// return !(d % 10);
|
|
2796
|
-
// };
|
|
2797
|
-
let luhn = (function () {
|
|
2712
|
+
const ɵ1 = function () {
|
|
2798
2713
|
let luhnArr = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9];
|
|
2799
2714
|
return function (str) {
|
|
2800
2715
|
let counter = 0;
|
|
@@ -2809,7 +2724,15 @@ let luhn = (function () {
|
|
|
2809
2724
|
}
|
|
2810
2725
|
return (counter % 10 === 0);
|
|
2811
2726
|
};
|
|
2812
|
-
}
|
|
2727
|
+
};
|
|
2728
|
+
// http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers#JavaScript
|
|
2729
|
+
// function luhn(a: string, b: number, c: number, d: number, e: number) {
|
|
2730
|
+
// for (d = +a[b = a.length - 1], e = 0; b--; ) {
|
|
2731
|
+
// c = +a[b], d += ++e % 2 ? 2 * c % 10 + (c > 4) : c;
|
|
2732
|
+
// }
|
|
2733
|
+
// return !(d % 10);
|
|
2734
|
+
// };
|
|
2735
|
+
let luhn = (ɵ1)();
|
|
2813
2736
|
/**
|
|
2814
2737
|
A ValidationError is used to describe a failed validation.
|
|
2815
2738
|
|
|
@@ -2825,13 +2748,6 @@ Constructs a new ValidationError
|
|
|
2825
2748
|
@param [key] {String} An optional key used to define a key for this error. One will be created automatically if not provided here.
|
|
2826
2749
|
**/
|
|
2827
2750
|
class ValidationError {
|
|
2828
|
-
validator;
|
|
2829
|
-
key;
|
|
2830
|
-
context;
|
|
2831
|
-
errorMessage;
|
|
2832
|
-
property; // IProperty
|
|
2833
|
-
propertyName;
|
|
2834
|
-
isServerError;
|
|
2835
2751
|
constructor(validator, context, errorMessage, key) {
|
|
2836
2752
|
// Error is with isInstanceOf(Validator)
|
|
2837
2753
|
assertParam(validator, "validator").isOptional().isInstanceOf(Validator).check();
|
|
@@ -2913,131 +2829,6 @@ DataType is an 'Enum' containing all of the supported data types.
|
|
|
2913
2829
|
@dynamic
|
|
2914
2830
|
**/
|
|
2915
2831
|
class DataType extends BreezeEnum {
|
|
2916
|
-
static parseDateFromServer = (value) => DataType.parseDateAsUTC(value);
|
|
2917
|
-
// same effect as above but doesn't give right TSDOC.
|
|
2918
|
-
// static parseDateFromServer = DataType.parseDateAsUTC;
|
|
2919
|
-
/** @hidden @internal */
|
|
2920
|
-
static constants;
|
|
2921
|
-
static String = new DataType({
|
|
2922
|
-
defaultValue: "",
|
|
2923
|
-
parse: coerceToString,
|
|
2924
|
-
fmtOData: fmtString,
|
|
2925
|
-
getNext: getNextString
|
|
2926
|
-
});
|
|
2927
|
-
static Int64 = new DataType({
|
|
2928
|
-
defaultValue: 0,
|
|
2929
|
-
isNumeric: true,
|
|
2930
|
-
isInteger: true,
|
|
2931
|
-
quoteJsonOData: true,
|
|
2932
|
-
parse: coerceToInt,
|
|
2933
|
-
fmtOData: makeFloatFmt("L"),
|
|
2934
|
-
getNext: getNextNumber
|
|
2935
|
-
});
|
|
2936
|
-
static Int32 = new DataType({
|
|
2937
|
-
defaultValue: 0,
|
|
2938
|
-
isNumeric: true,
|
|
2939
|
-
isInteger: true,
|
|
2940
|
-
parse: coerceToInt,
|
|
2941
|
-
fmtOData: fmtInt,
|
|
2942
|
-
getNext: getNextNumber
|
|
2943
|
-
});
|
|
2944
|
-
static Int16 = new DataType({
|
|
2945
|
-
defaultValue: 0,
|
|
2946
|
-
isNumeric: true,
|
|
2947
|
-
isInteger: true,
|
|
2948
|
-
parse: coerceToInt,
|
|
2949
|
-
fmtOData: fmtInt,
|
|
2950
|
-
getNext: getNextNumber
|
|
2951
|
-
});
|
|
2952
|
-
static Byte = new DataType({
|
|
2953
|
-
defaultValue: 0,
|
|
2954
|
-
isNumeric: true,
|
|
2955
|
-
isInteger: true,
|
|
2956
|
-
parse: coerceToInt,
|
|
2957
|
-
fmtOData: fmtInt
|
|
2958
|
-
});
|
|
2959
|
-
static Decimal = new DataType({
|
|
2960
|
-
defaultValue: 0,
|
|
2961
|
-
isNumeric: true,
|
|
2962
|
-
quoteJsonOData: true,
|
|
2963
|
-
isFloat: true,
|
|
2964
|
-
parse: coerceToFloat,
|
|
2965
|
-
fmtOData: makeFloatFmt("m"),
|
|
2966
|
-
getNext: getNextNumber
|
|
2967
|
-
});
|
|
2968
|
-
static Double = new DataType({
|
|
2969
|
-
defaultValue: 0,
|
|
2970
|
-
isNumeric: true,
|
|
2971
|
-
isFloat: true,
|
|
2972
|
-
parse: coerceToFloat,
|
|
2973
|
-
fmtOData: makeFloatFmt("d"),
|
|
2974
|
-
getNext: getNextNumber
|
|
2975
|
-
});
|
|
2976
|
-
static Single = new DataType({
|
|
2977
|
-
defaultValue: 0,
|
|
2978
|
-
isNumeric: true,
|
|
2979
|
-
isFloat: true,
|
|
2980
|
-
parse: coerceToFloat,
|
|
2981
|
-
fmtOData: makeFloatFmt("f"),
|
|
2982
|
-
getNext: getNextNumber
|
|
2983
|
-
});
|
|
2984
|
-
static DateOnly = new DataType({
|
|
2985
|
-
defaultValue: new Date(1900, 0, 1),
|
|
2986
|
-
isDate: true,
|
|
2987
|
-
parse: coerceToDateOnly,
|
|
2988
|
-
parseRawValue: parseRawDateOnly,
|
|
2989
|
-
normalize: function (value) { return value && value.getTime && (new Date(value.getYear(), value.getMonth(), value.getDate())).getTime(); },
|
|
2990
|
-
fmtOData: fmtDateOnly,
|
|
2991
|
-
getNext: getNextDateTime,
|
|
2992
|
-
getConcurrencyValue: getConcurrencyDateTime
|
|
2993
|
-
});
|
|
2994
|
-
static DateTime = new DataType({
|
|
2995
|
-
defaultValue: new Date(1900, 0, 1),
|
|
2996
|
-
isDate: true,
|
|
2997
|
-
parse: coerceToDate,
|
|
2998
|
-
parseRawValue: parseRawDate,
|
|
2999
|
-
normalize: function (value) { return value && value.getTime && value.getTime(); },
|
|
3000
|
-
fmtOData: fmtDateTime,
|
|
3001
|
-
getNext: getNextDateTime,
|
|
3002
|
-
getConcurrencyValue: getConcurrencyDateTime
|
|
3003
|
-
});
|
|
3004
|
-
static DateTimeOffset = new DataType({
|
|
3005
|
-
defaultValue: new Date(1900, 0, 1),
|
|
3006
|
-
isDate: true,
|
|
3007
|
-
parse: coerceToDate,
|
|
3008
|
-
parseRawValue: parseRawDate,
|
|
3009
|
-
normalize: function (value) { return value && value.getTime && value.getTime(); },
|
|
3010
|
-
fmtOData: fmtDateTimeOffset,
|
|
3011
|
-
getNext: getNextDateTime,
|
|
3012
|
-
getConcurrencyValue: getConcurrencyDateTime
|
|
3013
|
-
});
|
|
3014
|
-
static Time = new DataType({
|
|
3015
|
-
defaultValue: "PT0S",
|
|
3016
|
-
fmtOData: fmtTime,
|
|
3017
|
-
parseRawValue: DataType.parseTimeFromServer
|
|
3018
|
-
});
|
|
3019
|
-
static Boolean = new DataType({
|
|
3020
|
-
defaultValue: false,
|
|
3021
|
-
parse: coerceToBool,
|
|
3022
|
-
fmtOData: fmtBoolean
|
|
3023
|
-
});
|
|
3024
|
-
static Guid = new DataType({
|
|
3025
|
-
defaultValue: "00000000-0000-0000-0000-000000000000",
|
|
3026
|
-
parse: coerceToGuid,
|
|
3027
|
-
fmtOData: fmtGuid,
|
|
3028
|
-
getNext: getNextGuid,
|
|
3029
|
-
parseRawValue: function (val) { return val.toLowerCase(); },
|
|
3030
|
-
getConcurrencyValue: core.getUuid
|
|
3031
|
-
});
|
|
3032
|
-
static Binary = new DataType({
|
|
3033
|
-
defaultValue: null,
|
|
3034
|
-
fmtOData: fmtBinary,
|
|
3035
|
-
parseRawValue: parseRawBinary
|
|
3036
|
-
});
|
|
3037
|
-
static Undefined = new DataType({
|
|
3038
|
-
defaultValue: undefined,
|
|
3039
|
-
fmtOData: fmtUndefined
|
|
3040
|
-
});
|
|
3041
2832
|
static getComparableFn(dataType) {
|
|
3042
2833
|
if (dataType && dataType.normalize) {
|
|
3043
2834
|
return dataType.normalize;
|
|
@@ -3158,6 +2949,127 @@ class DataType extends BreezeEnum {
|
|
|
3158
2949
|
};
|
|
3159
2950
|
}
|
|
3160
2951
|
}
|
|
2952
|
+
DataType.parseDateFromServer = (value) => DataType.parseDateAsUTC(value);
|
|
2953
|
+
DataType.String = new DataType({
|
|
2954
|
+
defaultValue: "",
|
|
2955
|
+
parse: coerceToString,
|
|
2956
|
+
fmtOData: fmtString,
|
|
2957
|
+
getNext: getNextString
|
|
2958
|
+
});
|
|
2959
|
+
DataType.Int64 = new DataType({
|
|
2960
|
+
defaultValue: 0,
|
|
2961
|
+
isNumeric: true,
|
|
2962
|
+
isInteger: true,
|
|
2963
|
+
quoteJsonOData: true,
|
|
2964
|
+
parse: coerceToInt,
|
|
2965
|
+
fmtOData: makeFloatFmt("L"),
|
|
2966
|
+
getNext: getNextNumber
|
|
2967
|
+
});
|
|
2968
|
+
DataType.Int32 = new DataType({
|
|
2969
|
+
defaultValue: 0,
|
|
2970
|
+
isNumeric: true,
|
|
2971
|
+
isInteger: true,
|
|
2972
|
+
parse: coerceToInt,
|
|
2973
|
+
fmtOData: fmtInt,
|
|
2974
|
+
getNext: getNextNumber
|
|
2975
|
+
});
|
|
2976
|
+
DataType.Int16 = new DataType({
|
|
2977
|
+
defaultValue: 0,
|
|
2978
|
+
isNumeric: true,
|
|
2979
|
+
isInteger: true,
|
|
2980
|
+
parse: coerceToInt,
|
|
2981
|
+
fmtOData: fmtInt,
|
|
2982
|
+
getNext: getNextNumber
|
|
2983
|
+
});
|
|
2984
|
+
DataType.Byte = new DataType({
|
|
2985
|
+
defaultValue: 0,
|
|
2986
|
+
isNumeric: true,
|
|
2987
|
+
isInteger: true,
|
|
2988
|
+
parse: coerceToInt,
|
|
2989
|
+
fmtOData: fmtInt
|
|
2990
|
+
});
|
|
2991
|
+
DataType.Decimal = new DataType({
|
|
2992
|
+
defaultValue: 0,
|
|
2993
|
+
isNumeric: true,
|
|
2994
|
+
quoteJsonOData: true,
|
|
2995
|
+
isFloat: true,
|
|
2996
|
+
parse: coerceToFloat,
|
|
2997
|
+
fmtOData: makeFloatFmt("m"),
|
|
2998
|
+
getNext: getNextNumber
|
|
2999
|
+
});
|
|
3000
|
+
DataType.Double = new DataType({
|
|
3001
|
+
defaultValue: 0,
|
|
3002
|
+
isNumeric: true,
|
|
3003
|
+
isFloat: true,
|
|
3004
|
+
parse: coerceToFloat,
|
|
3005
|
+
fmtOData: makeFloatFmt("d"),
|
|
3006
|
+
getNext: getNextNumber
|
|
3007
|
+
});
|
|
3008
|
+
DataType.Single = new DataType({
|
|
3009
|
+
defaultValue: 0,
|
|
3010
|
+
isNumeric: true,
|
|
3011
|
+
isFloat: true,
|
|
3012
|
+
parse: coerceToFloat,
|
|
3013
|
+
fmtOData: makeFloatFmt("f"),
|
|
3014
|
+
getNext: getNextNumber
|
|
3015
|
+
});
|
|
3016
|
+
DataType.DateOnly = new DataType({
|
|
3017
|
+
defaultValue: new Date(1900, 0, 1),
|
|
3018
|
+
isDate: true,
|
|
3019
|
+
parse: coerceToDateOnly,
|
|
3020
|
+
parseRawValue: parseRawDateOnly,
|
|
3021
|
+
normalize: function (value) { return value && value.getTime && (new Date(value.getYear(), value.getMonth(), value.getDate())).getTime(); },
|
|
3022
|
+
fmtOData: fmtDateOnly,
|
|
3023
|
+
getNext: getNextDateTime,
|
|
3024
|
+
getConcurrencyValue: getConcurrencyDateTime
|
|
3025
|
+
});
|
|
3026
|
+
DataType.DateTime = new DataType({
|
|
3027
|
+
defaultValue: new Date(1900, 0, 1),
|
|
3028
|
+
isDate: true,
|
|
3029
|
+
parse: coerceToDate,
|
|
3030
|
+
parseRawValue: parseRawDate,
|
|
3031
|
+
normalize: function (value) { return value && value.getTime && value.getTime(); },
|
|
3032
|
+
fmtOData: fmtDateTime,
|
|
3033
|
+
getNext: getNextDateTime,
|
|
3034
|
+
getConcurrencyValue: getConcurrencyDateTime
|
|
3035
|
+
});
|
|
3036
|
+
DataType.DateTimeOffset = new DataType({
|
|
3037
|
+
defaultValue: new Date(1900, 0, 1),
|
|
3038
|
+
isDate: true,
|
|
3039
|
+
parse: coerceToDate,
|
|
3040
|
+
parseRawValue: parseRawDate,
|
|
3041
|
+
normalize: function (value) { return value && value.getTime && value.getTime(); },
|
|
3042
|
+
fmtOData: fmtDateTimeOffset,
|
|
3043
|
+
getNext: getNextDateTime,
|
|
3044
|
+
getConcurrencyValue: getConcurrencyDateTime
|
|
3045
|
+
});
|
|
3046
|
+
DataType.Time = new DataType({
|
|
3047
|
+
defaultValue: "PT0S",
|
|
3048
|
+
fmtOData: fmtTime,
|
|
3049
|
+
parseRawValue: DataType.parseTimeFromServer
|
|
3050
|
+
});
|
|
3051
|
+
DataType.Boolean = new DataType({
|
|
3052
|
+
defaultValue: false,
|
|
3053
|
+
parse: coerceToBool,
|
|
3054
|
+
fmtOData: fmtBoolean
|
|
3055
|
+
});
|
|
3056
|
+
DataType.Guid = new DataType({
|
|
3057
|
+
defaultValue: "00000000-0000-0000-0000-000000000000",
|
|
3058
|
+
parse: coerceToGuid,
|
|
3059
|
+
fmtOData: fmtGuid,
|
|
3060
|
+
getNext: getNextGuid,
|
|
3061
|
+
parseRawValue: function (val) { return val.toLowerCase(); },
|
|
3062
|
+
getConcurrencyValue: core.getUuid
|
|
3063
|
+
});
|
|
3064
|
+
DataType.Binary = new DataType({
|
|
3065
|
+
defaultValue: null,
|
|
3066
|
+
fmtOData: fmtBinary,
|
|
3067
|
+
parseRawValue: parseRawBinary
|
|
3068
|
+
});
|
|
3069
|
+
DataType.Undefined = new DataType({
|
|
3070
|
+
defaultValue: undefined,
|
|
3071
|
+
fmtOData: fmtUndefined
|
|
3072
|
+
});
|
|
3161
3073
|
DataType.prototype._$typeName = "DataType";
|
|
3162
3074
|
Error['x'] = DataType._resetConstants();
|
|
3163
3075
|
Error['x'] = DataType.resolveSymbols();
|
|
@@ -3415,16 +3327,6 @@ function parseRawBinary(val) {
|
|
|
3415
3327
|
EntityState is an 'Enum' containing all of the valid states for an 'Entity'.
|
|
3416
3328
|
**/
|
|
3417
3329
|
class EntityState extends BreezeEnum {
|
|
3418
|
-
/** The 'Unchanged' state. **/
|
|
3419
|
-
static Unchanged = new EntityState();
|
|
3420
|
-
/** The 'Added' state. **/
|
|
3421
|
-
static Added = new EntityState();
|
|
3422
|
-
/** The 'Modified' state. **/
|
|
3423
|
-
static Modified = new EntityState();
|
|
3424
|
-
/** The 'Deleted' state. **/
|
|
3425
|
-
static Deleted = new EntityState();
|
|
3426
|
-
/** The 'Detached' state. **/
|
|
3427
|
-
static Detached = new EntityState();
|
|
3428
3330
|
/**
|
|
3429
3331
|
Returns whether an entityState instance is EntityState.Unchanged.
|
|
3430
3332
|
> var es = anEntity.entityAspect.entityState;
|
|
@@ -3514,6 +3416,16 @@ class EntityState extends BreezeEnum {
|
|
|
3514
3416
|
this === EntityState.Deleted;
|
|
3515
3417
|
}
|
|
3516
3418
|
}
|
|
3419
|
+
/** The 'Unchanged' state. **/
|
|
3420
|
+
EntityState.Unchanged = new EntityState();
|
|
3421
|
+
/** The 'Added' state. **/
|
|
3422
|
+
EntityState.Added = new EntityState();
|
|
3423
|
+
/** The 'Modified' state. **/
|
|
3424
|
+
EntityState.Modified = new EntityState();
|
|
3425
|
+
/** The 'Deleted' state. **/
|
|
3426
|
+
EntityState.Deleted = new EntityState();
|
|
3427
|
+
/** The 'Detached' state. **/
|
|
3428
|
+
EntityState.Detached = new EntityState();
|
|
3517
3429
|
EntityState.prototype._$typeName = "EntityState";
|
|
3518
3430
|
Error['x'] = EntityState.resolveSymbols();
|
|
3519
3431
|
|
|
@@ -3521,30 +3433,6 @@ Error['x'] = EntityState.resolveSymbols();
|
|
|
3521
3433
|
|
|
3522
3434
|
*/
|
|
3523
3435
|
class EntityAction extends BreezeEnum {
|
|
3524
|
-
/** Entity was attached via an AttachEntity call. */
|
|
3525
|
-
static Attach = new EntityAction({ _isAttach: true });
|
|
3526
|
-
/** Entity was attached as a result of a query. */
|
|
3527
|
-
static AttachOnQuery = new EntityAction({ _isAttach: true });
|
|
3528
|
-
/** Entity was attached as a result of an import. */
|
|
3529
|
-
static AttachOnImport = new EntityAction({ _isAttach: true });
|
|
3530
|
-
/** Entity was detached */
|
|
3531
|
-
static Detach = new EntityAction({ _isDetach: true });
|
|
3532
|
-
/** Properties on the entity were merged as a result of a query. */
|
|
3533
|
-
static MergeOnQuery = new EntityAction({ _isModification: true });
|
|
3534
|
-
/** Properties on the entity were merged as a result of an import. */
|
|
3535
|
-
static MergeOnImport = new EntityAction({ _isModification: true });
|
|
3536
|
-
/** Properties on the entity were merged as a result of a save */
|
|
3537
|
-
static MergeOnSave = new EntityAction({ _isModification: true });
|
|
3538
|
-
/** A property on the entity was changed. */
|
|
3539
|
-
static PropertyChange = new EntityAction({ _isModification: true });
|
|
3540
|
-
/** The EntityState of the entity was changed. */
|
|
3541
|
-
static EntityStateChange = new EntityAction();
|
|
3542
|
-
/** AcceptChanges was called on the entity, or its entityState was set to Unmodified. */
|
|
3543
|
-
static AcceptChanges = new EntityAction();
|
|
3544
|
-
/** RejectChanges was called on the entity. */
|
|
3545
|
-
static RejectChanges = new EntityAction({ _isModification: true });
|
|
3546
|
-
/** The EntityManager was cleared. All entities detached. */
|
|
3547
|
-
static Clear = new EntityAction({ _isDetach: true });
|
|
3548
3436
|
/** Is this an 'attach' operation? ( Attach, AttachOnQuery or AttachOnImport) */
|
|
3549
3437
|
isAttach() {
|
|
3550
3438
|
return !!this._isAttach;
|
|
@@ -3558,6 +3446,30 @@ class EntityAction extends BreezeEnum {
|
|
|
3558
3446
|
return !!this._isModification;
|
|
3559
3447
|
}
|
|
3560
3448
|
}
|
|
3449
|
+
/** Entity was attached via an AttachEntity call. */
|
|
3450
|
+
EntityAction.Attach = new EntityAction({ _isAttach: true });
|
|
3451
|
+
/** Entity was attached as a result of a query. */
|
|
3452
|
+
EntityAction.AttachOnQuery = new EntityAction({ _isAttach: true });
|
|
3453
|
+
/** Entity was attached as a result of an import. */
|
|
3454
|
+
EntityAction.AttachOnImport = new EntityAction({ _isAttach: true });
|
|
3455
|
+
/** Entity was detached */
|
|
3456
|
+
EntityAction.Detach = new EntityAction({ _isDetach: true });
|
|
3457
|
+
/** Properties on the entity were merged as a result of a query. */
|
|
3458
|
+
EntityAction.MergeOnQuery = new EntityAction({ _isModification: true });
|
|
3459
|
+
/** Properties on the entity were merged as a result of an import. */
|
|
3460
|
+
EntityAction.MergeOnImport = new EntityAction({ _isModification: true });
|
|
3461
|
+
/** Properties on the entity were merged as a result of a save */
|
|
3462
|
+
EntityAction.MergeOnSave = new EntityAction({ _isModification: true });
|
|
3463
|
+
/** A property on the entity was changed. */
|
|
3464
|
+
EntityAction.PropertyChange = new EntityAction({ _isModification: true });
|
|
3465
|
+
/** The EntityState of the entity was changed. */
|
|
3466
|
+
EntityAction.EntityStateChange = new EntityAction();
|
|
3467
|
+
/** AcceptChanges was called on the entity, or its entityState was set to Unmodified. */
|
|
3468
|
+
EntityAction.AcceptChanges = new EntityAction();
|
|
3469
|
+
/** RejectChanges was called on the entity. */
|
|
3470
|
+
EntityAction.RejectChanges = new EntityAction({ _isModification: true });
|
|
3471
|
+
/** The EntityManager was cleared. All entities detached. */
|
|
3472
|
+
EntityAction.Clear = new EntityAction({ _isDetach: true });
|
|
3561
3473
|
EntityAction.prototype._$typeName = "EntityAction";
|
|
3562
3474
|
Error['x'] = EntityAction.resolveSymbols();
|
|
3563
3475
|
|
|
@@ -3567,19 +3479,6 @@ An EntityKey is an object that represents the unique identity of an entity. Ent
|
|
|
3567
3479
|
|
|
3568
3480
|
**/
|
|
3569
3481
|
class EntityKey {
|
|
3570
|
-
/** @hidden @internal */
|
|
3571
|
-
_$typeName; // actually placed on prototype
|
|
3572
|
-
/** @hidden @internal */
|
|
3573
|
-
static ENTITY_KEY_DELIMITER = ":::";
|
|
3574
|
-
/** The 'EntityType' that this is a key for. __Read Only__ */
|
|
3575
|
-
entityType;
|
|
3576
|
-
/** An array of the values for this key. This will usually only have a single element,
|
|
3577
|
-
unless the entity type has a multipart key. __Read Only__ */
|
|
3578
|
-
values;
|
|
3579
|
-
/** @hidden @internal */
|
|
3580
|
-
_keyInGroup;
|
|
3581
|
-
/** @hidden @internal */
|
|
3582
|
-
_subtypes;
|
|
3583
3482
|
/**
|
|
3584
3483
|
Constructs a new EntityKey. Each entity within an EntityManager will have a unique EntityKey.
|
|
3585
3484
|
> // assume em1 is an EntityManager containing a number of existing entities.
|
|
@@ -3682,6 +3581,8 @@ class EntityKey {
|
|
|
3682
3581
|
return keyValues.join(EntityKey.ENTITY_KEY_DELIMITER);
|
|
3683
3582
|
}
|
|
3684
3583
|
}
|
|
3584
|
+
/** @hidden @internal */
|
|
3585
|
+
EntityKey.ENTITY_KEY_DELIMITER = ":::";
|
|
3685
3586
|
EntityKey.prototype._$typeName = "EntityKey";
|
|
3686
3587
|
|
|
3687
3588
|
/**
|
|
@@ -3691,69 +3592,53 @@ MergeStrategy is an 'Enum' that determines how entities are merged into an Entit
|
|
|
3691
3592
|
@static
|
|
3692
3593
|
**/
|
|
3693
3594
|
class MergeStrategy extends BreezeEnum {
|
|
3694
|
-
/**
|
|
3695
|
-
MergeStrategy.PreserveChanges updates the cached entity with the incoming values unless the cached entity is in a changed
|
|
3696
|
-
state (added, modified, deleted) in which case the incoming values are ignored. The updated cached entity’s EntityState will
|
|
3697
|
-
remain [[EntityState.Unchanged]] unless you’re importing entities in which case the new EntityState will
|
|
3698
|
-
be that of the imported entities.
|
|
3699
|
-
**/
|
|
3700
|
-
static PreserveChanges = new MergeStrategy();
|
|
3701
|
-
/**
|
|
3702
|
-
MergeStrategy.OverwriteChanges always updates the cached entity with incoming values even if the entity is in
|
|
3703
|
-
a changed state (added, modified, deleted). After the merge, the pending changes are lost.
|
|
3704
|
-
The new EntityState will be [[EntityState/Unchanged]] unless you’re importing entities
|
|
3705
|
-
in which case the new EntityState will be that of the imported entities.
|
|
3706
|
-
**/
|
|
3707
|
-
static OverwriteChanges = new MergeStrategy();
|
|
3708
|
-
/**
|
|
3709
|
-
SkipMerge is used to ignore incoming values. Adds the incoming entity to the cache only if there is no cached entity with the same key.
|
|
3710
|
-
This is the fastest merge strategy but your existing cached data will remain “stale”.
|
|
3711
|
-
**/
|
|
3712
|
-
static SkipMerge = new MergeStrategy();
|
|
3713
|
-
/**
|
|
3714
|
-
Disallowed is used to throw an exception if there is an incoming entity with the same key as an entity already in the cache.
|
|
3715
|
-
Use this strategy when you want to be sure that the incoming entity is not already in cache.
|
|
3716
|
-
This is the default strategy for EntityManager.attachEntity.
|
|
3717
|
-
**/
|
|
3718
|
-
static Disallowed = new MergeStrategy();
|
|
3719
3595
|
}
|
|
3596
|
+
/**
|
|
3597
|
+
MergeStrategy.PreserveChanges updates the cached entity with the incoming values unless the cached entity is in a changed
|
|
3598
|
+
state (added, modified, deleted) in which case the incoming values are ignored. The updated cached entity’s EntityState will
|
|
3599
|
+
remain [[EntityState.Unchanged]] unless you’re importing entities in which case the new EntityState will
|
|
3600
|
+
be that of the imported entities.
|
|
3601
|
+
**/
|
|
3602
|
+
MergeStrategy.PreserveChanges = new MergeStrategy();
|
|
3603
|
+
/**
|
|
3604
|
+
MergeStrategy.OverwriteChanges always updates the cached entity with incoming values even if the entity is in
|
|
3605
|
+
a changed state (added, modified, deleted). After the merge, the pending changes are lost.
|
|
3606
|
+
The new EntityState will be [[EntityState/Unchanged]] unless you’re importing entities
|
|
3607
|
+
in which case the new EntityState will be that of the imported entities.
|
|
3608
|
+
**/
|
|
3609
|
+
MergeStrategy.OverwriteChanges = new MergeStrategy();
|
|
3610
|
+
/**
|
|
3611
|
+
SkipMerge is used to ignore incoming values. Adds the incoming entity to the cache only if there is no cached entity with the same key.
|
|
3612
|
+
This is the fastest merge strategy but your existing cached data will remain “stale”.
|
|
3613
|
+
**/
|
|
3614
|
+
MergeStrategy.SkipMerge = new MergeStrategy();
|
|
3615
|
+
/**
|
|
3616
|
+
Disallowed is used to throw an exception if there is an incoming entity with the same key as an entity already in the cache.
|
|
3617
|
+
Use this strategy when you want to be sure that the incoming entity is not already in cache.
|
|
3618
|
+
This is the default strategy for EntityManager.attachEntity.
|
|
3619
|
+
**/
|
|
3620
|
+
MergeStrategy.Disallowed = new MergeStrategy();
|
|
3720
3621
|
MergeStrategy.prototype._$typeName = "MergeStrategy";
|
|
3721
3622
|
Error['x'] = MergeStrategy.resolveSymbols();
|
|
3722
3623
|
/**
|
|
3723
3624
|
FetchStrategy is an 'Enum' that determines how and where entities are retrieved from as a result of a query.
|
|
3724
3625
|
**/
|
|
3725
3626
|
class FetchStrategy extends BreezeEnum {
|
|
3726
|
-
/**
|
|
3727
|
-
FromServer is used to tell the query to execute the query against a remote data source on the server.
|
|
3728
|
-
**/
|
|
3729
|
-
static FromServer = new FetchStrategy();
|
|
3730
|
-
/**
|
|
3731
|
-
FromLocalCache is used to tell the query to execute the query against a local EntityManager instead of going to a remote server.
|
|
3732
|
-
**/
|
|
3733
|
-
static FromLocalCache = new FetchStrategy();
|
|
3734
3627
|
}
|
|
3628
|
+
/**
|
|
3629
|
+
FromServer is used to tell the query to execute the query against a remote data source on the server.
|
|
3630
|
+
**/
|
|
3631
|
+
FetchStrategy.FromServer = new FetchStrategy();
|
|
3632
|
+
/**
|
|
3633
|
+
FromLocalCache is used to tell the query to execute the query against a local EntityManager instead of going to a remote server.
|
|
3634
|
+
**/
|
|
3635
|
+
FetchStrategy.FromLocalCache = new FetchStrategy();
|
|
3735
3636
|
FetchStrategy.prototype._$typeName = "FetchStrategy";
|
|
3736
3637
|
Error['x'] = FetchStrategy.resolveSymbols();
|
|
3737
3638
|
/**
|
|
3738
3639
|
A QueryOptions instance is used to specify the 'options' under which a query will occur.
|
|
3739
3640
|
**/
|
|
3740
3641
|
class QueryOptions {
|
|
3741
|
-
/** @hidden @internal */
|
|
3742
|
-
_$typeName;
|
|
3743
|
-
/** The [[FetchStrategy]] to use with any queries. __Read Only__ */
|
|
3744
|
-
fetchStrategy;
|
|
3745
|
-
/** The [[MergeStrategy]] to use with any queries. __Read Only__ */
|
|
3746
|
-
mergeStrategy;
|
|
3747
|
-
/** Whether to include cached deleted entities in a query result (false by default). __Read Only__ */
|
|
3748
|
-
includeDeleted;
|
|
3749
|
-
/**
|
|
3750
|
-
The default instance for use whenever QueryOptions are not specified.
|
|
3751
|
-
**/
|
|
3752
|
-
static defaultInstance = new QueryOptions({
|
|
3753
|
-
fetchStrategy: FetchStrategy.FromServer,
|
|
3754
|
-
mergeStrategy: MergeStrategy.PreserveChanges,
|
|
3755
|
-
includeDeleted: false
|
|
3756
|
-
});
|
|
3757
3642
|
/**
|
|
3758
3643
|
QueryOptions constructor
|
|
3759
3644
|
> var newQo = new QueryOptions( { mergeStrategy: MergeStrategy.OverwriteChanges });
|
|
@@ -3839,6 +3724,14 @@ class QueryOptions {
|
|
|
3839
3724
|
return obj;
|
|
3840
3725
|
}
|
|
3841
3726
|
}
|
|
3727
|
+
/**
|
|
3728
|
+
The default instance for use whenever QueryOptions are not specified.
|
|
3729
|
+
**/
|
|
3730
|
+
QueryOptions.defaultInstance = new QueryOptions({
|
|
3731
|
+
fetchStrategy: FetchStrategy.FromServer,
|
|
3732
|
+
mergeStrategy: MergeStrategy.PreserveChanges,
|
|
3733
|
+
includeDeleted: false
|
|
3734
|
+
});
|
|
3842
3735
|
QueryOptions.prototype._$typeName = "QueryOptions";
|
|
3843
3736
|
|
|
3844
3737
|
/**
|
|
@@ -4235,7 +4128,6 @@ function updateAliasMap(aliasMap, opStr, op) {
|
|
|
4235
4128
|
@hidden @internal
|
|
4236
4129
|
*/
|
|
4237
4130
|
class PassthruPredicate extends Predicate {
|
|
4238
|
-
value;
|
|
4239
4131
|
constructor(value) {
|
|
4240
4132
|
super();
|
|
4241
4133
|
this.value = value;
|
|
@@ -4247,7 +4139,6 @@ Error['x'] = PassthruPredicate.prototype._initialize('passthruPredicate');
|
|
|
4247
4139
|
@hidden
|
|
4248
4140
|
*/
|
|
4249
4141
|
class UnaryPredicate extends Predicate {
|
|
4250
|
-
pred;
|
|
4251
4142
|
constructor(op, ...args) {
|
|
4252
4143
|
super();
|
|
4253
4144
|
this.op = this._resolveOp(op);
|
|
@@ -4265,10 +4156,6 @@ Error['x'] = UnaryPredicate.prototype._initialize('unaryPredicate', {
|
|
|
4265
4156
|
@hidden
|
|
4266
4157
|
*/
|
|
4267
4158
|
class BinaryPredicate extends Predicate {
|
|
4268
|
-
expr1Source;
|
|
4269
|
-
expr2Source;
|
|
4270
|
-
expr1;
|
|
4271
|
-
expr2;
|
|
4272
4159
|
constructor(op, expr1, expr2) {
|
|
4273
4160
|
super();
|
|
4274
4161
|
// 5 public props op, expr1Source, expr2Source, expr1, expr2
|
|
@@ -4337,7 +4224,6 @@ Error['x'] = BinaryPredicate.prototype._initialize('binaryPredicate', {
|
|
|
4337
4224
|
@hidden
|
|
4338
4225
|
*/
|
|
4339
4226
|
class AndOrPredicate extends Predicate {
|
|
4340
|
-
preds;
|
|
4341
4227
|
constructor(op, preds) {
|
|
4342
4228
|
super();
|
|
4343
4229
|
this.op = this._resolveOp(op);
|
|
@@ -4373,10 +4259,6 @@ Error['x'] = AndOrPredicate.prototype._initialize("andOrPredicate", {
|
|
|
4373
4259
|
@hidden
|
|
4374
4260
|
*/
|
|
4375
4261
|
class AnyAllPredicate extends Predicate {
|
|
4376
|
-
/** @internal */
|
|
4377
|
-
expr;
|
|
4378
|
-
exprSource;
|
|
4379
|
-
pred;
|
|
4380
4262
|
// 4 public props: op, exprSource, expr, pred
|
|
4381
4263
|
constructor(op, expr, pred) {
|
|
4382
4264
|
super();
|
|
@@ -4400,9 +4282,6 @@ Error['x'] = AnyAllPredicate.prototype._initialize("anyAllPredicate", {
|
|
|
4400
4282
|
});
|
|
4401
4283
|
/** @hidden */
|
|
4402
4284
|
class PredicateExpression {
|
|
4403
|
-
visitorMethodName;
|
|
4404
|
-
visit; // TODO
|
|
4405
|
-
dataType;
|
|
4406
4285
|
constructor(visitorMethodName) {
|
|
4407
4286
|
this.visitorMethodName = visitorMethodName;
|
|
4408
4287
|
// give expressions the Predicate prototype method
|
|
@@ -4418,8 +4297,6 @@ class PredicateExpression {
|
|
|
4418
4297
|
@hidden
|
|
4419
4298
|
*/
|
|
4420
4299
|
class LitExpr extends PredicateExpression {
|
|
4421
|
-
value;
|
|
4422
|
-
hasExplicitDataType;
|
|
4423
4300
|
// 2 public props: value, dataType
|
|
4424
4301
|
constructor(value, dataType, hasExplicitDataType) {
|
|
4425
4302
|
super("litExpr");
|
|
@@ -4468,7 +4345,6 @@ function resolveDataType(dataType) {
|
|
|
4468
4345
|
@hidden
|
|
4469
4346
|
*/
|
|
4470
4347
|
class PropExpr extends PredicateExpression {
|
|
4471
|
-
propertyPath;
|
|
4472
4348
|
// two public props: propertyPath, dateType
|
|
4473
4349
|
constructor(propertyPath) {
|
|
4474
4350
|
super('propExpr');
|
|
@@ -4502,9 +4378,6 @@ class PropExpr extends PredicateExpression {
|
|
|
4502
4378
|
@hidden @dynamic
|
|
4503
4379
|
*/
|
|
4504
4380
|
class FnExpr extends PredicateExpression {
|
|
4505
|
-
fnName;
|
|
4506
|
-
exprs;
|
|
4507
|
-
localFn; // TODO:
|
|
4508
4381
|
constructor(fnName, exprs) {
|
|
4509
4382
|
super('fnExpr');
|
|
4510
4383
|
// 4 public props: fnName, exprs, localFn, dataType
|
|
@@ -4528,109 +4401,109 @@ class FnExpr extends PredicateExpression {
|
|
|
4528
4401
|
expr._validate(entityType, usesNameOnServer);
|
|
4529
4402
|
});
|
|
4530
4403
|
}
|
|
4531
|
-
static _funcMap = {
|
|
4532
|
-
toupper: {
|
|
4533
|
-
fn: function (source) {
|
|
4534
|
-
return source.toUpperCase();
|
|
4535
|
-
}, dataType: DataType.String
|
|
4536
|
-
},
|
|
4537
|
-
tolower: {
|
|
4538
|
-
fn: function (source) {
|
|
4539
|
-
return source.toLowerCase();
|
|
4540
|
-
}, dataType: DataType.String
|
|
4541
|
-
},
|
|
4542
|
-
substring: {
|
|
4543
|
-
fn: function (source, pos, length) {
|
|
4544
|
-
return source.substring(pos, length);
|
|
4545
|
-
}, dataType: DataType.String
|
|
4546
|
-
},
|
|
4547
|
-
substringof: {
|
|
4548
|
-
fn: function (find, source) {
|
|
4549
|
-
return source.indexOf(find) >= 0;
|
|
4550
|
-
}, dataType: DataType.Boolean
|
|
4551
|
-
},
|
|
4552
|
-
length: {
|
|
4553
|
-
fn: function (source) {
|
|
4554
|
-
return source.length;
|
|
4555
|
-
}, dataType: DataType.Int32
|
|
4556
|
-
},
|
|
4557
|
-
trim: {
|
|
4558
|
-
fn: function (source) {
|
|
4559
|
-
return source.trim();
|
|
4560
|
-
}, dataType: DataType.String
|
|
4561
|
-
},
|
|
4562
|
-
concat: {
|
|
4563
|
-
fn: function (s1, s2) {
|
|
4564
|
-
return s1.concat(s2);
|
|
4565
|
-
}, dataType: DataType.String
|
|
4566
|
-
},
|
|
4567
|
-
replace: {
|
|
4568
|
-
fn: function (source, find, replace) {
|
|
4569
|
-
return source.replace(find, replace);
|
|
4570
|
-
}, dataType: DataType.String
|
|
4571
|
-
},
|
|
4572
|
-
startswith: {
|
|
4573
|
-
fn: function (source, find) {
|
|
4574
|
-
return core.stringStartsWith(source, find);
|
|
4575
|
-
}, dataType: DataType.Boolean
|
|
4576
|
-
},
|
|
4577
|
-
endswith: {
|
|
4578
|
-
fn: function (source, find) {
|
|
4579
|
-
return core.stringEndsWith(source, find);
|
|
4580
|
-
}, dataType: DataType.Boolean
|
|
4581
|
-
},
|
|
4582
|
-
indexof: {
|
|
4583
|
-
fn: function (source, find) {
|
|
4584
|
-
return source.indexOf(find);
|
|
4585
|
-
}, dataType: DataType.Int32
|
|
4586
|
-
},
|
|
4587
|
-
round: {
|
|
4588
|
-
fn: function (source) {
|
|
4589
|
-
return Math.round(source);
|
|
4590
|
-
}, dataType: DataType.Int32
|
|
4591
|
-
},
|
|
4592
|
-
ceiling: {
|
|
4593
|
-
fn: function (source) {
|
|
4594
|
-
return Math.ceil(source);
|
|
4595
|
-
}, dataType: DataType.Int32
|
|
4596
|
-
},
|
|
4597
|
-
floor: {
|
|
4598
|
-
fn: function (source) {
|
|
4599
|
-
return Math.floor(source);
|
|
4600
|
-
}, dataType: DataType.Int32
|
|
4601
|
-
},
|
|
4602
|
-
second: {
|
|
4603
|
-
fn: function (source) {
|
|
4604
|
-
return source.getSeconds();
|
|
4605
|
-
}, dataType: DataType.Int32
|
|
4606
|
-
},
|
|
4607
|
-
minute: {
|
|
4608
|
-
fn: function (source) {
|
|
4609
|
-
return source.getMinutes();
|
|
4610
|
-
}, dataType: DataType.Int32
|
|
4611
|
-
},
|
|
4612
|
-
hour: {
|
|
4613
|
-
fn: function (source) {
|
|
4614
|
-
return source.getHours();
|
|
4615
|
-
}, dataType: DataType.Int32
|
|
4616
|
-
},
|
|
4617
|
-
day: {
|
|
4618
|
-
fn: function (source) {
|
|
4619
|
-
return source.getDate();
|
|
4620
|
-
}, dataType: DataType.Int32
|
|
4621
|
-
},
|
|
4622
|
-
month: {
|
|
4623
|
-
fn: function (source) {
|
|
4624
|
-
return source.getMonth() + 1;
|
|
4625
|
-
}, dataType: DataType.Int32
|
|
4626
|
-
},
|
|
4627
|
-
year: {
|
|
4628
|
-
fn: function (source) {
|
|
4629
|
-
return source.getFullYear();
|
|
4630
|
-
}, dataType: DataType.Int32
|
|
4631
|
-
}
|
|
4632
|
-
};
|
|
4633
4404
|
}
|
|
4405
|
+
FnExpr._funcMap = {
|
|
4406
|
+
toupper: {
|
|
4407
|
+
fn: function (source) {
|
|
4408
|
+
return source.toUpperCase();
|
|
4409
|
+
}, dataType: DataType.String
|
|
4410
|
+
},
|
|
4411
|
+
tolower: {
|
|
4412
|
+
fn: function (source) {
|
|
4413
|
+
return source.toLowerCase();
|
|
4414
|
+
}, dataType: DataType.String
|
|
4415
|
+
},
|
|
4416
|
+
substring: {
|
|
4417
|
+
fn: function (source, pos, length) {
|
|
4418
|
+
return source.substring(pos, length);
|
|
4419
|
+
}, dataType: DataType.String
|
|
4420
|
+
},
|
|
4421
|
+
substringof: {
|
|
4422
|
+
fn: function (find, source) {
|
|
4423
|
+
return source.indexOf(find) >= 0;
|
|
4424
|
+
}, dataType: DataType.Boolean
|
|
4425
|
+
},
|
|
4426
|
+
length: {
|
|
4427
|
+
fn: function (source) {
|
|
4428
|
+
return source.length;
|
|
4429
|
+
}, dataType: DataType.Int32
|
|
4430
|
+
},
|
|
4431
|
+
trim: {
|
|
4432
|
+
fn: function (source) {
|
|
4433
|
+
return source.trim();
|
|
4434
|
+
}, dataType: DataType.String
|
|
4435
|
+
},
|
|
4436
|
+
concat: {
|
|
4437
|
+
fn: function (s1, s2) {
|
|
4438
|
+
return s1.concat(s2);
|
|
4439
|
+
}, dataType: DataType.String
|
|
4440
|
+
},
|
|
4441
|
+
replace: {
|
|
4442
|
+
fn: function (source, find, replace) {
|
|
4443
|
+
return source.replace(find, replace);
|
|
4444
|
+
}, dataType: DataType.String
|
|
4445
|
+
},
|
|
4446
|
+
startswith: {
|
|
4447
|
+
fn: function (source, find) {
|
|
4448
|
+
return core.stringStartsWith(source, find);
|
|
4449
|
+
}, dataType: DataType.Boolean
|
|
4450
|
+
},
|
|
4451
|
+
endswith: {
|
|
4452
|
+
fn: function (source, find) {
|
|
4453
|
+
return core.stringEndsWith(source, find);
|
|
4454
|
+
}, dataType: DataType.Boolean
|
|
4455
|
+
},
|
|
4456
|
+
indexof: {
|
|
4457
|
+
fn: function (source, find) {
|
|
4458
|
+
return source.indexOf(find);
|
|
4459
|
+
}, dataType: DataType.Int32
|
|
4460
|
+
},
|
|
4461
|
+
round: {
|
|
4462
|
+
fn: function (source) {
|
|
4463
|
+
return Math.round(source);
|
|
4464
|
+
}, dataType: DataType.Int32
|
|
4465
|
+
},
|
|
4466
|
+
ceiling: {
|
|
4467
|
+
fn: function (source) {
|
|
4468
|
+
return Math.ceil(source);
|
|
4469
|
+
}, dataType: DataType.Int32
|
|
4470
|
+
},
|
|
4471
|
+
floor: {
|
|
4472
|
+
fn: function (source) {
|
|
4473
|
+
return Math.floor(source);
|
|
4474
|
+
}, dataType: DataType.Int32
|
|
4475
|
+
},
|
|
4476
|
+
second: {
|
|
4477
|
+
fn: function (source) {
|
|
4478
|
+
return source.getSeconds();
|
|
4479
|
+
}, dataType: DataType.Int32
|
|
4480
|
+
},
|
|
4481
|
+
minute: {
|
|
4482
|
+
fn: function (source) {
|
|
4483
|
+
return source.getMinutes();
|
|
4484
|
+
}, dataType: DataType.Int32
|
|
4485
|
+
},
|
|
4486
|
+
hour: {
|
|
4487
|
+
fn: function (source) {
|
|
4488
|
+
return source.getHours();
|
|
4489
|
+
}, dataType: DataType.Int32
|
|
4490
|
+
},
|
|
4491
|
+
day: {
|
|
4492
|
+
fn: function (source) {
|
|
4493
|
+
return source.getDate();
|
|
4494
|
+
}, dataType: DataType.Int32
|
|
4495
|
+
},
|
|
4496
|
+
month: {
|
|
4497
|
+
fn: function (source) {
|
|
4498
|
+
return source.getMonth() + 1;
|
|
4499
|
+
}, dataType: DataType.Int32
|
|
4500
|
+
},
|
|
4501
|
+
year: {
|
|
4502
|
+
fn: function (source) {
|
|
4503
|
+
return source.getFullYear();
|
|
4504
|
+
}, dataType: DataType.Int32
|
|
4505
|
+
}
|
|
4506
|
+
};
|
|
4634
4507
|
// TODO: add dataTypes for the args next - will help to infer other dataTypes.
|
|
4635
4508
|
let RX_IDENTIFIER = /^[a-z_][\w.$]*$/i;
|
|
4636
4509
|
// comma delimited expressions ignoring commas inside of both single and double quotes.
|
|
@@ -4760,103 +4633,104 @@ function parseFnExpr(source, parts, tokens, exprContext) {
|
|
|
4760
4633
|
throw e;
|
|
4761
4634
|
}
|
|
4762
4635
|
}
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
unaryPredicate: function (context) {
|
|
4770
|
-
let predFn = this.pred.visit(context);
|
|
4771
|
-
switch (this.op.key) {
|
|
4772
|
-
case "not":
|
|
4773
|
-
return function (entity) {
|
|
4774
|
-
return !predFn(entity);
|
|
4775
|
-
};
|
|
4776
|
-
default:
|
|
4777
|
-
throw new Error("Invalid unary operator:" + this.op.key);
|
|
4778
|
-
}
|
|
4779
|
-
},
|
|
4780
|
-
binaryPredicate: function (context) {
|
|
4781
|
-
let expr1Fn = this.expr1.visit(context);
|
|
4782
|
-
let expr2Fn = this.expr2.visit(context);
|
|
4783
|
-
let dataType = this.expr1.dataType || this.expr2.dataType;
|
|
4784
|
-
let lqco = context.entityType.metadataStore.localQueryComparisonOptions;
|
|
4785
|
-
let predFn = getBinaryPredicateFn(this, dataType, lqco);
|
|
4786
|
-
if (predFn == null) {
|
|
4787
|
-
throw new Error("Invalid binaryPredicate operator:" + this.op.key);
|
|
4788
|
-
}
|
|
4789
|
-
return function (entity) {
|
|
4790
|
-
return predFn(expr1Fn(entity), expr2Fn(entity));
|
|
4791
|
-
};
|
|
4792
|
-
},
|
|
4793
|
-
andOrPredicate: function (context) {
|
|
4794
|
-
let predFns = this.preds.map((pred) => {
|
|
4795
|
-
return pred.visit(context);
|
|
4796
|
-
});
|
|
4797
|
-
switch (this.op.key) {
|
|
4798
|
-
case "and":
|
|
4799
|
-
return function (entity) {
|
|
4800
|
-
let result = predFns.reduce(function (prev, cur) {
|
|
4801
|
-
return prev && cur(entity);
|
|
4802
|
-
}, true);
|
|
4803
|
-
return result;
|
|
4804
|
-
};
|
|
4805
|
-
case "or":
|
|
4806
|
-
return function (entity) {
|
|
4807
|
-
let result = predFns.reduce(function (prev, cur) {
|
|
4808
|
-
return prev || cur(entity);
|
|
4809
|
-
}, false);
|
|
4810
|
-
return result;
|
|
4811
|
-
};
|
|
4812
|
-
default:
|
|
4813
|
-
throw new Error("Invalid boolean operator:" + this.op.key);
|
|
4814
|
-
}
|
|
4815
|
-
},
|
|
4816
|
-
anyAllPredicate: function (context) {
|
|
4817
|
-
let exprFn = this.expr.visit(context);
|
|
4818
|
-
let newContext = core.extend({}, context);
|
|
4819
|
-
newContext.entityType = this.expr.dataType;
|
|
4820
|
-
let predFn = this.pred.visit(newContext);
|
|
4821
|
-
let anyAllPredFn = getAnyAllPredicateFn(this.op);
|
|
4822
|
-
return function (entity) {
|
|
4823
|
-
return anyAllPredFn(exprFn(entity), predFn);
|
|
4824
|
-
};
|
|
4825
|
-
},
|
|
4826
|
-
litExpr: function () {
|
|
4827
|
-
let value = this.value;
|
|
4828
|
-
return function (entity) {
|
|
4829
|
-
return value;
|
|
4830
|
-
};
|
|
4831
|
-
},
|
|
4832
|
-
propExpr: function () {
|
|
4833
|
-
let propertyPath = this.propertyPath;
|
|
4834
|
-
let properties = propertyPath.split('.');
|
|
4835
|
-
if (properties.length === 1) {
|
|
4636
|
+
const ɵ0$2 = function () {
|
|
4637
|
+
throw new Error("Cannot execute an PassthruPredicate expression against the local cache: " + this.value);
|
|
4638
|
+
}, ɵ1$1 = function (context) {
|
|
4639
|
+
let predFn = this.pred.visit(context);
|
|
4640
|
+
switch (this.op.key) {
|
|
4641
|
+
case "not":
|
|
4836
4642
|
return function (entity) {
|
|
4837
|
-
return entity
|
|
4643
|
+
return !predFn(entity);
|
|
4838
4644
|
};
|
|
4839
|
-
|
|
4840
|
-
|
|
4645
|
+
default:
|
|
4646
|
+
throw new Error("Invalid unary operator:" + this.op.key);
|
|
4647
|
+
}
|
|
4648
|
+
}, ɵ2 = function (context) {
|
|
4649
|
+
let expr1Fn = this.expr1.visit(context);
|
|
4650
|
+
let expr2Fn = this.expr2.visit(context);
|
|
4651
|
+
let dataType = this.expr1.dataType || this.expr2.dataType;
|
|
4652
|
+
let lqco = context.entityType.metadataStore.localQueryComparisonOptions;
|
|
4653
|
+
let predFn = getBinaryPredicateFn(this, dataType, lqco);
|
|
4654
|
+
if (predFn == null) {
|
|
4655
|
+
throw new Error("Invalid binaryPredicate operator:" + this.op.key);
|
|
4656
|
+
}
|
|
4657
|
+
return function (entity) {
|
|
4658
|
+
return predFn(expr1Fn(entity), expr2Fn(entity));
|
|
4659
|
+
};
|
|
4660
|
+
}, ɵ3 = function (context) {
|
|
4661
|
+
let predFns = this.preds.map((pred) => {
|
|
4662
|
+
return pred.visit(context);
|
|
4663
|
+
});
|
|
4664
|
+
switch (this.op.key) {
|
|
4665
|
+
case "and":
|
|
4841
4666
|
return function (entity) {
|
|
4842
|
-
|
|
4667
|
+
let result = predFns.reduce(function (prev, cur) {
|
|
4668
|
+
return prev && cur(entity);
|
|
4669
|
+
}, true);
|
|
4670
|
+
return result;
|
|
4843
4671
|
};
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4672
|
+
case "or":
|
|
4673
|
+
return function (entity) {
|
|
4674
|
+
let result = predFns.reduce(function (prev, cur) {
|
|
4675
|
+
return prev || cur(entity);
|
|
4676
|
+
}, false);
|
|
4677
|
+
return result;
|
|
4678
|
+
};
|
|
4679
|
+
default:
|
|
4680
|
+
throw new Error("Invalid boolean operator:" + this.op.key);
|
|
4681
|
+
}
|
|
4682
|
+
}, ɵ4 = function (context) {
|
|
4683
|
+
let exprFn = this.expr.visit(context);
|
|
4684
|
+
let newContext = core.extend({}, context);
|
|
4685
|
+
newContext.entityType = this.expr.dataType;
|
|
4686
|
+
let predFn = this.pred.visit(newContext);
|
|
4687
|
+
let anyAllPredFn = getAnyAllPredicateFn(this.op);
|
|
4688
|
+
return function (entity) {
|
|
4689
|
+
return anyAllPredFn(exprFn(entity), predFn);
|
|
4690
|
+
};
|
|
4691
|
+
}, ɵ5 = function () {
|
|
4692
|
+
let value = this.value;
|
|
4693
|
+
return function (entity) {
|
|
4694
|
+
return value;
|
|
4695
|
+
};
|
|
4696
|
+
}, ɵ6 = function () {
|
|
4697
|
+
let propertyPath = this.propertyPath;
|
|
4698
|
+
let properties = propertyPath.split('.');
|
|
4699
|
+
if (properties.length === 1) {
|
|
4851
4700
|
return function (entity) {
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
return
|
|
4701
|
+
return entity.getProperty(propertyPath);
|
|
4702
|
+
};
|
|
4703
|
+
}
|
|
4704
|
+
else {
|
|
4705
|
+
return function (entity) {
|
|
4706
|
+
return EntityAspect.getPropertyPathValue(entity, properties);
|
|
4858
4707
|
};
|
|
4859
4708
|
}
|
|
4709
|
+
}, ɵ7 = function (context) {
|
|
4710
|
+
let exprFns = this.exprs.map(function (expr) {
|
|
4711
|
+
return expr.visit(context);
|
|
4712
|
+
});
|
|
4713
|
+
let that = this;
|
|
4714
|
+
return function (entity) {
|
|
4715
|
+
let values = exprFns.map(function (exprFn) {
|
|
4716
|
+
let value = exprFn(entity);
|
|
4717
|
+
return value;
|
|
4718
|
+
});
|
|
4719
|
+
let result = that.localFn.apply(null, values);
|
|
4720
|
+
return result;
|
|
4721
|
+
};
|
|
4722
|
+
};
|
|
4723
|
+
// toFunctionVisitor
|
|
4724
|
+
let toFunctionVisitor = {
|
|
4725
|
+
isExtended: false,
|
|
4726
|
+
passthruPredicate: ɵ0$2,
|
|
4727
|
+
unaryPredicate: ɵ1$1,
|
|
4728
|
+
binaryPredicate: ɵ2,
|
|
4729
|
+
andOrPredicate: ɵ3,
|
|
4730
|
+
anyAllPredicate: ɵ4,
|
|
4731
|
+
litExpr: ɵ5,
|
|
4732
|
+
propExpr: ɵ6,
|
|
4733
|
+
fnExpr: ɵ7
|
|
4860
4734
|
};
|
|
4861
4735
|
function getAnyAllPredicateFn(op) {
|
|
4862
4736
|
switch (op.key) {
|
|
@@ -4923,12 +4797,12 @@ function getBinaryPredicateFn(binaryPredicate, dataType, lqco) {
|
|
|
4923
4797
|
break;
|
|
4924
4798
|
case 'startswith':
|
|
4925
4799
|
predFn = function (v1, v2) {
|
|
4926
|
-
return stringStartsWith(v1, v2, lqco);
|
|
4800
|
+
return stringStartsWith$1(v1, v2, lqco);
|
|
4927
4801
|
};
|
|
4928
4802
|
break;
|
|
4929
4803
|
case 'endswith':
|
|
4930
4804
|
predFn = function (v1, v2) {
|
|
4931
|
-
return stringEndsWith(v1, v2, lqco);
|
|
4805
|
+
return stringEndsWith$1(v1, v2, lqco);
|
|
4932
4806
|
};
|
|
4933
4807
|
break;
|
|
4934
4808
|
case 'contains':
|
|
@@ -4964,14 +4838,14 @@ function stringEquals(a, b, lqco) {
|
|
|
4964
4838
|
}
|
|
4965
4839
|
return a === b;
|
|
4966
4840
|
}
|
|
4967
|
-
function stringStartsWith(a, b, lqco) {
|
|
4841
|
+
function stringStartsWith$1(a, b, lqco) {
|
|
4968
4842
|
if (!lqco.isCaseSensitive) {
|
|
4969
4843
|
a = (a || "").toLowerCase();
|
|
4970
4844
|
b = (b || "").toLowerCase();
|
|
4971
4845
|
}
|
|
4972
4846
|
return core.stringStartsWith(a, b);
|
|
4973
4847
|
}
|
|
4974
|
-
function stringEndsWith(a, b, lqco) {
|
|
4848
|
+
function stringEndsWith$1(a, b, lqco) {
|
|
4975
4849
|
if (!lqco.isCaseSensitive) {
|
|
4976
4850
|
a = (a || "").toLowerCase();
|
|
4977
4851
|
b = (b || "").toLowerCase();
|
|
@@ -4985,93 +4859,94 @@ function stringContains(a, b, lqco) {
|
|
|
4985
4859
|
}
|
|
4986
4860
|
return a.indexOf(b) >= 0;
|
|
4987
4861
|
}
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
}
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
}
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
if (this.op.key === "eq") {
|
|
5007
|
-
json[expr1Val] = expr2Val;
|
|
5008
|
-
}
|
|
5009
|
-
else {
|
|
5010
|
-
let value = {};
|
|
5011
|
-
json[expr1Val] = value;
|
|
5012
|
-
value[this.op.key] = expr2Val;
|
|
5013
|
-
}
|
|
5014
|
-
return json;
|
|
5015
|
-
},
|
|
5016
|
-
andOrPredicate: function (context) {
|
|
5017
|
-
let predVals = this.preds.map(function (pred) {
|
|
5018
|
-
return pred.visit(context);
|
|
5019
|
-
});
|
|
5020
|
-
if (!predVals || !predVals.length) {
|
|
5021
|
-
return {};
|
|
5022
|
-
}
|
|
5023
|
-
let json;
|
|
5024
|
-
// normalizeAnd clauses if possible.
|
|
5025
|
-
// passthru predicate will appear as string and their 'ands' can't be 'normalized'
|
|
5026
|
-
if (this.op.key === 'and' && predVals.length === 2 && !predVals.some((v) => v.or || typeof (v) === 'string')) {
|
|
5027
|
-
// normalize 'and' clauses - will return null if can't be combined.
|
|
5028
|
-
json = predVals.reduce(combine);
|
|
5029
|
-
}
|
|
5030
|
-
if (json == null) {
|
|
5031
|
-
json = {};
|
|
5032
|
-
json[this.op.key] = predVals;
|
|
5033
|
-
}
|
|
5034
|
-
return json;
|
|
5035
|
-
},
|
|
5036
|
-
anyAllPredicate: function (context) {
|
|
5037
|
-
let exprVal = this.expr.visit(context);
|
|
5038
|
-
let newContext = core.extend({}, context);
|
|
5039
|
-
newContext.entityType = this.expr.dataType;
|
|
5040
|
-
let predVal = this.pred.visit(newContext);
|
|
5041
|
-
let json = {};
|
|
4862
|
+
const ɵ8 = function () {
|
|
4863
|
+
return this.value;
|
|
4864
|
+
}, ɵ9 = function (context) {
|
|
4865
|
+
let predVal = this.pred.visit(context);
|
|
4866
|
+
let json = {};
|
|
4867
|
+
json[this.op.key] = predVal;
|
|
4868
|
+
return json;
|
|
4869
|
+
}, ɵ10 = function (context) {
|
|
4870
|
+
let expr1Val = this.expr1.visit(context);
|
|
4871
|
+
let expr2Val = this.expr2.visit(context);
|
|
4872
|
+
let json = {};
|
|
4873
|
+
if (this.expr2 instanceof PropExpr) {
|
|
4874
|
+
expr2Val = { value: expr2Val, isProperty: true };
|
|
4875
|
+
}
|
|
4876
|
+
if (this.op.key === "eq") {
|
|
4877
|
+
json[expr1Val] = expr2Val;
|
|
4878
|
+
}
|
|
4879
|
+
else {
|
|
5042
4880
|
let value = {};
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
}
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
if
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
4881
|
+
json[expr1Val] = value;
|
|
4882
|
+
value[this.op.key] = expr2Val;
|
|
4883
|
+
}
|
|
4884
|
+
return json;
|
|
4885
|
+
}, ɵ11 = function (context) {
|
|
4886
|
+
let predVals = this.preds.map(function (pred) {
|
|
4887
|
+
return pred.visit(context);
|
|
4888
|
+
});
|
|
4889
|
+
if (!predVals || !predVals.length) {
|
|
4890
|
+
return {};
|
|
4891
|
+
}
|
|
4892
|
+
let json;
|
|
4893
|
+
// normalizeAnd clauses if possible.
|
|
4894
|
+
// passthru predicate will appear as string and their 'ands' can't be 'normalized'
|
|
4895
|
+
if (this.op.key === 'and' && predVals.length === 2 && !predVals.some((v) => v.or || typeof (v) === 'string')) {
|
|
4896
|
+
// normalize 'and' clauses - will return null if can't be combined.
|
|
4897
|
+
json = predVals.reduce(combine);
|
|
4898
|
+
}
|
|
4899
|
+
if (json == null) {
|
|
4900
|
+
json = {};
|
|
4901
|
+
json[this.op.key] = predVals;
|
|
4902
|
+
}
|
|
4903
|
+
return json;
|
|
4904
|
+
}, ɵ12 = function (context) {
|
|
4905
|
+
let exprVal = this.expr.visit(context);
|
|
4906
|
+
let newContext = core.extend({}, context);
|
|
4907
|
+
newContext.entityType = this.expr.dataType;
|
|
4908
|
+
let predVal = this.pred.visit(newContext);
|
|
4909
|
+
let json = {};
|
|
4910
|
+
let value = {};
|
|
4911
|
+
value[this.op.key] = predVal;
|
|
4912
|
+
json[exprVal] = value;
|
|
4913
|
+
return json;
|
|
4914
|
+
}, ɵ13 = function (context) {
|
|
4915
|
+
// special handling for DateOnly because it serializes improperly
|
|
4916
|
+
const value = (this.dataType === DataType.DateOnly) ? DataType.toDateOnlyString(this.value) : this.value;
|
|
4917
|
+
if (this.hasExplicitDataType || context.useExplicitDataType) {
|
|
4918
|
+
return { value: value, dataType: this.dataType.name };
|
|
4919
|
+
}
|
|
4920
|
+
else {
|
|
4921
|
+
return value;
|
|
4922
|
+
}
|
|
4923
|
+
}, ɵ14 = function (context) {
|
|
4924
|
+
if (context.toNameOnServer) {
|
|
4925
|
+
if (!context.entityType) {
|
|
4926
|
+
console.warn(`No EntityType for propertyPath "${this.propertyPath}". ${core.strings.TO_TYPE}`);
|
|
5066
4927
|
return this.propertyPath;
|
|
5067
4928
|
}
|
|
5068
|
-
|
|
5069
|
-
fnExpr: function (context) {
|
|
5070
|
-
let exprVals = this.exprs.map(function (expr) {
|
|
5071
|
-
return expr.visit(context);
|
|
5072
|
-
});
|
|
5073
|
-
return this.fnName + "(" + exprVals.join(",") + ")";
|
|
4929
|
+
return context.entityType.clientPropertyPathToServer(this.propertyPath);
|
|
5074
4930
|
}
|
|
4931
|
+
else {
|
|
4932
|
+
return this.propertyPath;
|
|
4933
|
+
}
|
|
4934
|
+
}, ɵ15 = function (context) {
|
|
4935
|
+
let exprVals = this.exprs.map(function (expr) {
|
|
4936
|
+
return expr.visit(context);
|
|
4937
|
+
});
|
|
4938
|
+
return this.fnName + "(" + exprVals.join(",") + ")";
|
|
4939
|
+
};
|
|
4940
|
+
// toJSONVisitor
|
|
4941
|
+
let toJSONVisitor = {
|
|
4942
|
+
passthruPredicate: ɵ8,
|
|
4943
|
+
unaryPredicate: ɵ9,
|
|
4944
|
+
binaryPredicate: ɵ10,
|
|
4945
|
+
andOrPredicate: ɵ11,
|
|
4946
|
+
anyAllPredicate: ɵ12,
|
|
4947
|
+
litExpr: ɵ13,
|
|
4948
|
+
propExpr: ɵ14,
|
|
4949
|
+
fnExpr: ɵ15
|
|
5075
4950
|
};
|
|
5076
4951
|
function combine(j1, j2) {
|
|
5077
4952
|
let ok = Object.keys(j2).every(function (key) {
|
|
@@ -5129,6 +5004,7 @@ class EntityQuery {
|
|
|
5129
5004
|
this.parameters = {};
|
|
5130
5005
|
this.inlineCountEnabled = false;
|
|
5131
5006
|
this.noTrackingEnabled = false;
|
|
5007
|
+
this.usePostEnabled = false;
|
|
5132
5008
|
// default is to get queryOptions and dataService from the entityManager.
|
|
5133
5009
|
// this.queryOptions = new QueryOptions();
|
|
5134
5010
|
// this.dataService = new DataService();
|
|
@@ -5398,7 +5274,7 @@ class EntityQuery {
|
|
|
5398
5274
|
return clone(this, "parameters", parameters);
|
|
5399
5275
|
}
|
|
5400
5276
|
/**
|
|
5401
|
-
Returns a query with the
|
|
5277
|
+
Returns a query with the `inlineCount` capability either enabled or disabled. With `inlineCount` enabled, an additional 'inlineCount' property
|
|
5402
5278
|
will be returned with the query results that will contain the number of entities that would have been returned by this
|
|
5403
5279
|
query with only the 'where'/'filter' clauses applied, i.e. without any 'skip'/'take' operators applied. For local queries this clause is ignored.
|
|
5404
5280
|
> let query = new EntityQuery("Customers")
|
|
@@ -5406,7 +5282,7 @@ class EntityQuery {
|
|
|
5406
5282
|
> .orderBy("CompanyName")
|
|
5407
5283
|
> .inlineCount(true);
|
|
5408
5284
|
|
|
5409
|
-
will return the first 20 customers as well as a count of
|
|
5285
|
+
will return the first 20 customers as well as a count of _all_ of the customers in the remote store.
|
|
5410
5286
|
@param enabled - (default = true) Whether or not inlineCount capability should be enabled. If this parameter is omitted, true is assumed.
|
|
5411
5287
|
**/
|
|
5412
5288
|
inlineCount(enabled) {
|
|
@@ -5420,7 +5296,7 @@ class EntityQuery {
|
|
|
5420
5296
|
return clone(this, "usesNameOnServer", usesNameOnServer);
|
|
5421
5297
|
}
|
|
5422
5298
|
/**
|
|
5423
|
-
Returns a query with the
|
|
5299
|
+
Returns a query with the `noTracking` capability either enabled or disabled. With `noTracking` enabled, the results of this query
|
|
5424
5300
|
will not be coerced into entities but will instead look like raw javascript projections. i.e. simple javascript objects.
|
|
5425
5301
|
> let query = new EntityQuery("Customers")
|
|
5426
5302
|
> .take(20)
|
|
@@ -5434,6 +5310,22 @@ class EntityQuery {
|
|
|
5434
5310
|
return clone(this, "noTrackingEnabled", enabled);
|
|
5435
5311
|
}
|
|
5436
5312
|
/**
|
|
5313
|
+
Returns a query with the `usePost` capability either enabled or disabled. With `usePost` enabled, the query is sent
|
|
5314
|
+
as a POST request (instead of GET) and the query expression will be sent as JSON in the body of the post.
|
|
5315
|
+
Note that the server must be able to parse the body of the request; otherwise the query expression will be ignored.
|
|
5316
|
+
> let query = new EntityQuery("Customers")
|
|
5317
|
+
> .where("companyId", "eq", 1)
|
|
5318
|
+
> .usePost(true);
|
|
5319
|
+
results in a POST request to `{host}/{path}/Customers`
|
|
5320
|
+
with body `{"where": {"companyId":{"eq":1}}}`
|
|
5321
|
+
@param enabled - (default = true) Whether or not usePost should be enabled. If this parameter is omitted, true is assumed.
|
|
5322
|
+
**/
|
|
5323
|
+
usePost(enabled) {
|
|
5324
|
+
assertParam(enabled, "enabled").isBoolean().isOptional().check();
|
|
5325
|
+
enabled = (enabled === undefined) ? true : !!enabled;
|
|
5326
|
+
return clone(this, "usePostEnabled", enabled);
|
|
5327
|
+
}
|
|
5328
|
+
/**
|
|
5437
5329
|
Returns a copy of this EntityQuery with the specified [[EntityManager]], [[DataService]],
|
|
5438
5330
|
[[JsonResultsAdapter]], [[MergeStrategy]] or [[FetchStrategy]] applied.
|
|
5439
5331
|
> // 'using' can be used to return a new query with a specified EntityManager.
|
|
@@ -5626,28 +5518,6 @@ class EntityQuery {
|
|
|
5626
5518
|
q = q.where(pred).toType(entityKey.entityType);
|
|
5627
5519
|
return q;
|
|
5628
5520
|
}
|
|
5629
|
-
/**
|
|
5630
|
-
Creates an EntityQuery for the specified entity and [[NavigationProperty]].
|
|
5631
|
-
> // 'employee' is a previously queried employee
|
|
5632
|
-
> let ordersNavProp = employee.entityType.getProperty("Orders");
|
|
5633
|
-
> let query = EntityQuery.fromEntityNavigation(employee, ordersNavProp);
|
|
5634
|
-
|
|
5635
|
-
will return a query for the "Orders" of the specified 'employee'.
|
|
5636
|
-
@param entity - The Entity whose navigation property will be queried.
|
|
5637
|
-
@param navigationProperty - The [[NavigationProperty]] or name of the NavigationProperty to be queried.
|
|
5638
|
-
**/
|
|
5639
|
-
static fromEntityNavigation = function (entity, navigationProperty) {
|
|
5640
|
-
assertParam(entity, "entity").isEntity().check();
|
|
5641
|
-
let navProperty = entity.entityType._checkNavProperty(navigationProperty);
|
|
5642
|
-
let q = new EntityQuery(navProperty.entityType.defaultResourceName);
|
|
5643
|
-
let pred = buildNavigationPredicate(entity, navProperty);
|
|
5644
|
-
if (pred == null) {
|
|
5645
|
-
throw new Error("Unable to create a NavigationQuery for navigationProperty: " + navProperty.name);
|
|
5646
|
-
}
|
|
5647
|
-
q = q.where(pred);
|
|
5648
|
-
let em = entity.entityAspect.entityManager;
|
|
5649
|
-
return em ? q.using(em) : q;
|
|
5650
|
-
};
|
|
5651
5521
|
// protected methods
|
|
5652
5522
|
/** @hidden @internal */
|
|
5653
5523
|
_getFromEntityType(metadataStore, throwErrorIfNotFound) {
|
|
@@ -5719,6 +5589,28 @@ class EntityQuery {
|
|
|
5719
5589
|
return ds.uriBuilder.buildUri(this, em.metadataStore);
|
|
5720
5590
|
}
|
|
5721
5591
|
}
|
|
5592
|
+
/**
|
|
5593
|
+
Creates an EntityQuery for the specified entity and [[NavigationProperty]].
|
|
5594
|
+
> // 'employee' is a previously queried employee
|
|
5595
|
+
> let ordersNavProp = employee.entityType.getProperty("Orders");
|
|
5596
|
+
> let query = EntityQuery.fromEntityNavigation(employee, ordersNavProp);
|
|
5597
|
+
|
|
5598
|
+
will return a query for the "Orders" of the specified 'employee'.
|
|
5599
|
+
@param entity - The Entity whose navigation property will be queried.
|
|
5600
|
+
@param navigationProperty - The [[NavigationProperty]] or name of the NavigationProperty to be queried.
|
|
5601
|
+
**/
|
|
5602
|
+
EntityQuery.fromEntityNavigation = function (entity, navigationProperty) {
|
|
5603
|
+
assertParam(entity, "entity").isEntity().check();
|
|
5604
|
+
let navProperty = entity.entityType._checkNavProperty(navigationProperty);
|
|
5605
|
+
let q = new EntityQuery(navProperty.entityType.defaultResourceName);
|
|
5606
|
+
let pred = buildNavigationPredicate(entity, navProperty);
|
|
5607
|
+
if (pred == null) {
|
|
5608
|
+
throw new Error("Unable to create a NavigationQuery for navigationProperty: " + navProperty.name);
|
|
5609
|
+
}
|
|
5610
|
+
q = q.where(pred);
|
|
5611
|
+
let em = entity.entityAspect.entityManager;
|
|
5612
|
+
return em ? q.using(em) : q;
|
|
5613
|
+
};
|
|
5722
5614
|
EntityQuery.prototype._$typeName = "EntityQuery";
|
|
5723
5615
|
// private functions
|
|
5724
5616
|
function fromJSON(eq, json) {
|
|
@@ -5745,6 +5637,7 @@ function fromJSON(eq, json) {
|
|
|
5745
5637
|
},
|
|
5746
5638
|
"inlineCountEnabled,inlineCount": false,
|
|
5747
5639
|
"noTrackingEnabled,noTracking": false,
|
|
5640
|
+
"usePostEnabled,usePost": false,
|
|
5748
5641
|
queryOptions: function (v) {
|
|
5749
5642
|
return v ? QueryOptions.fromJSON(v) : undefined;
|
|
5750
5643
|
}
|
|
@@ -5769,6 +5662,7 @@ function clone(eq, propName, value) {
|
|
|
5769
5662
|
"expandClause",
|
|
5770
5663
|
"inlineCountEnabled",
|
|
5771
5664
|
"noTrackingEnabled",
|
|
5665
|
+
"usePostEnabled",
|
|
5772
5666
|
"usesNameOnServer",
|
|
5773
5667
|
"queryOptions",
|
|
5774
5668
|
"entityManager",
|
|
@@ -5858,33 +5752,33 @@ FilterQueryOp is an 'Enum' containing all of the valid [[Predicate]]
|
|
|
5858
5752
|
filter operators for an [[EntityQuery]].
|
|
5859
5753
|
**/
|
|
5860
5754
|
class FilterQueryOp extends BreezeEnum {
|
|
5861
|
-
/** Aliases: "eq", "==" **/
|
|
5862
|
-
static Equals = new FilterQueryOp({ operator: "eq" });
|
|
5863
|
-
/** Aliases: "ne", "!=" **/
|
|
5864
|
-
static NotEquals = new FilterQueryOp({ operator: "ne" });
|
|
5865
|
-
/** Aliases: "gt", ">" **/
|
|
5866
|
-
static GreaterThan = new FilterQueryOp({ operator: "gt" });
|
|
5867
|
-
/** Aliases: "lt", "<" **/
|
|
5868
|
-
static LessThan = new FilterQueryOp({ operator: "lt" });
|
|
5869
|
-
/** Aliases: "ge", ">=" **/
|
|
5870
|
-
static GreaterThanOrEqual = new FilterQueryOp({ operator: "ge" });
|
|
5871
|
-
/** Aliases: "le", "<=" **/
|
|
5872
|
-
static LessThanOrEqual = new FilterQueryOp({ operator: "le" });
|
|
5873
|
-
/** String operation: Is a string a substring of another string. Aliases: "substringof" **/
|
|
5874
|
-
static Contains = new FilterQueryOp({ operator: "contains" });
|
|
5875
|
-
/** No aliases */
|
|
5876
|
-
static StartsWith = new FilterQueryOp({ operator: "startswith" });
|
|
5877
|
-
/** No aliases */
|
|
5878
|
-
static EndsWith = new FilterQueryOp({ operator: "endswith" });
|
|
5879
|
-
/** Aliases: "some" **/
|
|
5880
|
-
static Any = new FilterQueryOp({ operator: "any" });
|
|
5881
|
-
/** Aliases: "every" **/
|
|
5882
|
-
static All = new FilterQueryOp({ operator: "all" });
|
|
5883
|
-
/** No aliases */
|
|
5884
|
-
static In = new FilterQueryOp({ operator: "in" });
|
|
5885
|
-
/** No aliases */
|
|
5886
|
-
static IsTypeOf = new FilterQueryOp({ operator: "isof" });
|
|
5887
5755
|
}
|
|
5756
|
+
/** Aliases: "eq", "==" **/
|
|
5757
|
+
FilterQueryOp.Equals = new FilterQueryOp({ operator: "eq" });
|
|
5758
|
+
/** Aliases: "ne", "!=" **/
|
|
5759
|
+
FilterQueryOp.NotEquals = new FilterQueryOp({ operator: "ne" });
|
|
5760
|
+
/** Aliases: "gt", ">" **/
|
|
5761
|
+
FilterQueryOp.GreaterThan = new FilterQueryOp({ operator: "gt" });
|
|
5762
|
+
/** Aliases: "lt", "<" **/
|
|
5763
|
+
FilterQueryOp.LessThan = new FilterQueryOp({ operator: "lt" });
|
|
5764
|
+
/** Aliases: "ge", ">=" **/
|
|
5765
|
+
FilterQueryOp.GreaterThanOrEqual = new FilterQueryOp({ operator: "ge" });
|
|
5766
|
+
/** Aliases: "le", "<=" **/
|
|
5767
|
+
FilterQueryOp.LessThanOrEqual = new FilterQueryOp({ operator: "le" });
|
|
5768
|
+
/** String operation: Is a string a substring of another string. Aliases: "substringof" **/
|
|
5769
|
+
FilterQueryOp.Contains = new FilterQueryOp({ operator: "contains" });
|
|
5770
|
+
/** No aliases */
|
|
5771
|
+
FilterQueryOp.StartsWith = new FilterQueryOp({ operator: "startswith" });
|
|
5772
|
+
/** No aliases */
|
|
5773
|
+
FilterQueryOp.EndsWith = new FilterQueryOp({ operator: "endswith" });
|
|
5774
|
+
/** Aliases: "some" **/
|
|
5775
|
+
FilterQueryOp.Any = new FilterQueryOp({ operator: "any" });
|
|
5776
|
+
/** Aliases: "every" **/
|
|
5777
|
+
FilterQueryOp.All = new FilterQueryOp({ operator: "all" });
|
|
5778
|
+
/** No aliases */
|
|
5779
|
+
FilterQueryOp.In = new FilterQueryOp({ operator: "in" });
|
|
5780
|
+
/** No aliases */
|
|
5781
|
+
FilterQueryOp.IsTypeOf = new FilterQueryOp({ operator: "isof" });
|
|
5888
5782
|
FilterQueryOp.prototype._$typeName = "FilterQueryOp";
|
|
5889
5783
|
Error['x'] = FilterQueryOp.resolveSymbols();
|
|
5890
5784
|
/**
|
|
@@ -5892,10 +5786,10 @@ Error['x'] = FilterQueryOp.resolveSymbols();
|
|
|
5892
5786
|
operators for an [[EntityQuery]].
|
|
5893
5787
|
**/
|
|
5894
5788
|
class BooleanQueryOp extends BreezeEnum {
|
|
5895
|
-
static And = new BooleanQueryOp({ operator: "and" });
|
|
5896
|
-
static Or = new BooleanQueryOp({ operator: "or" });
|
|
5897
|
-
static Not = new BooleanQueryOp({ operator: "not" });
|
|
5898
5789
|
}
|
|
5790
|
+
BooleanQueryOp.And = new BooleanQueryOp({ operator: "and" });
|
|
5791
|
+
BooleanQueryOp.Or = new BooleanQueryOp({ operator: "or" });
|
|
5792
|
+
BooleanQueryOp.Not = new BooleanQueryOp({ operator: "not" });
|
|
5899
5793
|
BooleanQueryOp.prototype._$typeName = "BooleanQueryOp";
|
|
5900
5794
|
Error['x'] = BooleanQueryOp.resolveSymbols();
|
|
5901
5795
|
/** For use by breeze plugin authors only. The class is used in most [[IUriBuilderAdapter]] implementations
|
|
@@ -5916,8 +5810,6 @@ or
|
|
|
5916
5810
|
> let obc = new OrderByClause("Company.CompanyName, LastName", true);
|
|
5917
5811
|
*/
|
|
5918
5812
|
class OrderByClause {
|
|
5919
|
-
/** @hidden @internal */
|
|
5920
|
-
items;
|
|
5921
5813
|
constructor(propertyPaths, isDesc) {
|
|
5922
5814
|
if (propertyPaths.length === 0) {
|
|
5923
5815
|
throw new Error("OrderByClause cannot be empty");
|
|
@@ -5964,9 +5856,6 @@ class OrderByClause {
|
|
|
5964
5856
|
}
|
|
5965
5857
|
/** @hidden @internal */
|
|
5966
5858
|
class OrderByItem {
|
|
5967
|
-
propertyPath;
|
|
5968
|
-
isDesc;
|
|
5969
|
-
lastProperty;
|
|
5970
5859
|
constructor(propertyPath, isDesc) {
|
|
5971
5860
|
if (!(typeof propertyPath === 'string')) {
|
|
5972
5861
|
throw new Error("propertyPath is not a string");
|
|
@@ -6042,9 +5931,6 @@ class OrderByItem {
|
|
|
6042
5931
|
@hidden
|
|
6043
5932
|
**/
|
|
6044
5933
|
class SelectClause {
|
|
6045
|
-
propertyPaths;
|
|
6046
|
-
/** @hidden @internal */
|
|
6047
|
-
_pathNames;
|
|
6048
5934
|
constructor(propertyPaths) {
|
|
6049
5935
|
this.propertyPaths = propertyPaths;
|
|
6050
5936
|
this._pathNames = propertyPaths.map(function (pp) {
|
|
@@ -6080,7 +5966,6 @@ class SelectClause {
|
|
|
6080
5966
|
@hidden
|
|
6081
5967
|
**/
|
|
6082
5968
|
class ExpandClause {
|
|
6083
|
-
propertyPaths;
|
|
6084
5969
|
constructor(propertyPaths) {
|
|
6085
5970
|
this.propertyPaths = propertyPaths;
|
|
6086
5971
|
}
|
|
@@ -6106,96 +5991,53 @@ a query, import or [[EntityManager.createEntity]] call.
|
|
|
6106
5991
|
|
|
6107
5992
|
**/
|
|
6108
5993
|
class EntityAspect {
|
|
6109
|
-
/** The Entity that this aspect is associated with. __Read Only__ **/
|
|
6110
|
-
entity;
|
|
6111
|
-
/** The [[EntityManager]] that contains this entity. __Read Only__ **/
|
|
6112
|
-
entityManager;
|
|
6113
|
-
/** @hidden @internal */
|
|
6114
|
-
entityGroup;
|
|
6115
|
-
/** The [[EntityState]] of this entity. __Read Only__ **/
|
|
6116
|
-
entityState;
|
|
6117
|
-
/** Whether this entity is in the process of being saved. __Read Only__ */
|
|
6118
|
-
isBeingSaved;
|
|
6119
|
-
/** The 'original values' of this entity where they are different from the 'current values'.
|
|
6120
|
-
This is a map where the key is a property name and the value is the 'original value' of the property. */
|
|
6121
|
-
originalValues;
|
|
6122
|
-
/** Whether this entity has any validation errors. __Read Only__ */
|
|
6123
|
-
hasValidationErrors;
|
|
6124
|
-
/** Whether this entity has a temporary [[EntityKey]]. */
|
|
6125
|
-
hasTempKey;
|
|
6126
|
-
/** Whether this entity was created by being loaded from the database */
|
|
6127
|
-
wasLoaded;
|
|
6128
|
-
/** Extra metadata about this entity such as the entity's etag.
|
|
6129
|
-
You may extend this object with your own metadata information.
|
|
6130
|
-
Breeze (de)serializes this object when importing/exporting the entity. **/
|
|
6131
|
-
extraMetadata;
|
|
6132
|
-
/**
|
|
6133
|
-
A [[BreezeEvent]] that fires whenever any of the validation errors on this entity change.
|
|
6134
|
-
Note that this might be the removal of an error when some data on the entity is fixed.
|
|
6135
|
-
@eventArgs -
|
|
6136
|
-
- entity - The entity on which the validation errors are being added or removed.
|
|
6137
|
-
- added - An array containing any newly added [[ValidationError]]s
|
|
6138
|
-
- removed - An array containing any newly removed [[ValidationError]]s. This is those
|
|
6139
|
-
errors that have been 'fixed'.
|
|
6140
|
-
|
|
6141
|
-
> // assume order is an order entity attached to an EntityManager.
|
|
6142
|
-
> order.entityAspect.validationErrorsChanged.subscribe(
|
|
6143
|
-
> function (validationChangeArgs) {
|
|
6144
|
-
> // this code will be executed anytime a property value changes on the 'order' entity.
|
|
6145
|
-
> var entity == validationChangeArgs.entity; // Note: entity === order
|
|
6146
|
-
> var errorsAdded = validationChangeArgs.added;
|
|
6147
|
-
> var errorsCleared = validationChangeArgs.removed;
|
|
6148
|
-
> });
|
|
6149
|
-
@event
|
|
6150
|
-
**/
|
|
6151
|
-
validationErrorsChanged;
|
|
6152
|
-
/**
|
|
6153
|
-
A [[BreezeEvent]] that fires whenever a value of one of this entity's properties change.
|
|
6154
|
-
@eventArgs -
|
|
6155
|
-
- entity - The entity whose property has changed.
|
|
6156
|
-
- property - The [[DataProperty]] that changed.
|
|
6157
|
-
- propertyName - The name of the property that changed. This value will be 'null' for operations that replace the entire entity. This includes
|
|
6158
|
-
queries, imports and saves that require a merge. The remaining parameters will not exist in this case either. This will actually be a "property path"
|
|
6159
|
-
for any properties of a complex type.
|
|
6160
|
-
- oldValue - The old value of this property before the change.
|
|
6161
|
-
- newValue - The new value of this property after the change.
|
|
6162
|
-
- parent - The immediate parent object for the changed property. This will be a ComplexType instance as opposed to an Entity
|
|
6163
|
-
for any complex type or nested complex type properties.
|
|
6164
|
-
|
|
6165
|
-
> // assume order is an order entity attached to an EntityManager.
|
|
6166
|
-
> order.entityAspect.propertyChanged.subscribe(
|
|
6167
|
-
> function (propertyChangedArgs) {
|
|
6168
|
-
> // this code will be executed anytime a property value changes on the 'order' entity.
|
|
6169
|
-
> var entity = propertyChangedArgs.entity; // Note: entity === order
|
|
6170
|
-
> var propertyNameChanged = propertyChangedArgs.propertyName;
|
|
6171
|
-
> var oldValue = propertyChangedArgs.oldValue;
|
|
6172
|
-
> var newValue = propertyChangedArgs.newValue;
|
|
6173
|
-
> });
|
|
6174
|
-
@event
|
|
6175
|
-
**/
|
|
6176
|
-
propertyChanged;
|
|
6177
|
-
/** @hidden @internal */
|
|
6178
|
-
_validationErrors;
|
|
6179
|
-
/** @hidden @internal */
|
|
6180
|
-
_pendingValidationResult;
|
|
6181
|
-
/** @hidden @internal */
|
|
6182
|
-
_entityKey;
|
|
6183
|
-
/** @hidden @internal */
|
|
6184
|
-
_loadedNps;
|
|
6185
|
-
/** @hidden @internal */
|
|
6186
|
-
_initialized;
|
|
6187
|
-
/** @hidden @internal */
|
|
6188
|
-
_inProcess; // used in defaultPropertyInterceptor for temp storage.
|
|
6189
|
-
/** @hidden @internal */
|
|
6190
|
-
_inProcessEntity; // used in EntityManager
|
|
6191
|
-
/** @hidden @internal */
|
|
6192
|
-
static _nullInstance = new EntityAspect(); // TODO: determine if this works
|
|
6193
5994
|
/** @hidden @internal */
|
|
6194
5995
|
constructor(entity) {
|
|
6195
5996
|
// if called without new
|
|
6196
5997
|
// if (!(this instanceof EntityAspect)) {
|
|
6197
5998
|
// return new EntityAspect(entity);
|
|
6198
5999
|
// }
|
|
6000
|
+
/**
|
|
6001
|
+
Sets the entity to an EntityState of 'Unchanged'. This is also the equivalent of calling [[EntityAspect.acceptChanges]].
|
|
6002
|
+
The same operation can be performed by calling [[EntityAspect.setEntityState]].
|
|
6003
|
+
> // assume order is an order entity attached to an EntityManager.
|
|
6004
|
+
> order.entityAspect.setUnchanged();
|
|
6005
|
+
> // The 'order' entity will now be in an 'Unchanged' state with any changes committed.
|
|
6006
|
+
**/
|
|
6007
|
+
this.setUnchanged = function () {
|
|
6008
|
+
return this.setEntityState(EntityState.Unchanged);
|
|
6009
|
+
};
|
|
6010
|
+
/**
|
|
6011
|
+
Sets the entity to an EntityState of 'Modified'. This can also be achieved by changing the value of any property on an 'Unchanged' entity.
|
|
6012
|
+
The same operation can be performed by calling [[EntityAspect.setEntityState]].
|
|
6013
|
+
> // assume order is an order entity attached to an EntityManager.
|
|
6014
|
+
> order.entityAspect.setModified();
|
|
6015
|
+
> // The 'order' entity will now be in a 'Modified' state.
|
|
6016
|
+
**/
|
|
6017
|
+
this.setModified = function () {
|
|
6018
|
+
return this.setEntityState(EntityState.Modified);
|
|
6019
|
+
};
|
|
6020
|
+
/**
|
|
6021
|
+
Sets the entity to an EntityState of 'Deleted'. This both marks the entity as being scheduled for deletion during the next 'Save' call
|
|
6022
|
+
but also removes the entity from all of its related entities. If the current entityState is 'Added', then `setDeleted()` will mark it 'Detached'
|
|
6023
|
+
The same operation can be performed by calling [[EntityAspect.setEntityState]].
|
|
6024
|
+
> // assume order is an order entity attached to an EntityManager.
|
|
6025
|
+
> order.entityAspect.setDeleted();
|
|
6026
|
+
> // The 'order' entity will now be in a 'Deleted' state and it will no longer have any 'related' entities.
|
|
6027
|
+
**/
|
|
6028
|
+
this.setDeleted = function () {
|
|
6029
|
+
return this.setEntityState(EntityState.Deleted);
|
|
6030
|
+
};
|
|
6031
|
+
/**
|
|
6032
|
+
Sets the entity to an EntityState of 'Detached'. This removes the entity from all of its related entities, but does NOT change the EntityState of any existing entities.
|
|
6033
|
+
The same operation can be performed by calling [[EntityAspect.setEntityState]].
|
|
6034
|
+
> // assume order is an order entity attached to an EntityManager.
|
|
6035
|
+
> order.entityAspect.setDetached();
|
|
6036
|
+
> // The 'order' entity will now be in a 'Detached' state and it will no longer have any 'related' entities.
|
|
6037
|
+
**/
|
|
6038
|
+
this.setDetached = function () {
|
|
6039
|
+
return this.setEntityState(EntityState.Detached);
|
|
6040
|
+
};
|
|
6199
6041
|
this.entity = entity;
|
|
6200
6042
|
// TODO: keep public or not?
|
|
6201
6043
|
this.entityGroup = undefined;
|
|
@@ -6356,47 +6198,6 @@ class EntityAspect {
|
|
|
6356
6198
|
return this.setEntityState(EntityState.Added);
|
|
6357
6199
|
}
|
|
6358
6200
|
/**
|
|
6359
|
-
Sets the entity to an EntityState of 'Unchanged'. This is also the equivalent of calling [[EntityAspect.acceptChanges]].
|
|
6360
|
-
The same operation can be performed by calling [[EntityAspect.setEntityState]].
|
|
6361
|
-
> // assume order is an order entity attached to an EntityManager.
|
|
6362
|
-
> order.entityAspect.setUnchanged();
|
|
6363
|
-
> // The 'order' entity will now be in an 'Unchanged' state with any changes committed.
|
|
6364
|
-
**/
|
|
6365
|
-
setUnchanged = function () {
|
|
6366
|
-
return this.setEntityState(EntityState.Unchanged);
|
|
6367
|
-
};
|
|
6368
|
-
/**
|
|
6369
|
-
Sets the entity to an EntityState of 'Modified'. This can also be achieved by changing the value of any property on an 'Unchanged' entity.
|
|
6370
|
-
The same operation can be performed by calling [[EntityAspect.setEntityState]].
|
|
6371
|
-
> // assume order is an order entity attached to an EntityManager.
|
|
6372
|
-
> order.entityAspect.setModified();
|
|
6373
|
-
> // The 'order' entity will now be in a 'Modified' state.
|
|
6374
|
-
**/
|
|
6375
|
-
setModified = function () {
|
|
6376
|
-
return this.setEntityState(EntityState.Modified);
|
|
6377
|
-
};
|
|
6378
|
-
/**
|
|
6379
|
-
Sets the entity to an EntityState of 'Deleted'. This both marks the entity as being scheduled for deletion during the next 'Save' call
|
|
6380
|
-
but also removes the entity from all of its related entities. If the current entityState is 'Added', then `setDeleted()` will mark it 'Detached'
|
|
6381
|
-
The same operation can be performed by calling [[EntityAspect.setEntityState]].
|
|
6382
|
-
> // assume order is an order entity attached to an EntityManager.
|
|
6383
|
-
> order.entityAspect.setDeleted();
|
|
6384
|
-
> // The 'order' entity will now be in a 'Deleted' state and it will no longer have any 'related' entities.
|
|
6385
|
-
**/
|
|
6386
|
-
setDeleted = function () {
|
|
6387
|
-
return this.setEntityState(EntityState.Deleted);
|
|
6388
|
-
};
|
|
6389
|
-
/**
|
|
6390
|
-
Sets the entity to an EntityState of 'Detached'. This removes the entity from all of its related entities, but does NOT change the EntityState of any existing entities.
|
|
6391
|
-
The same operation can be performed by calling [[EntityAspect.setEntityState]].
|
|
6392
|
-
> // assume order is an order entity attached to an EntityManager.
|
|
6393
|
-
> order.entityAspect.setDetached();
|
|
6394
|
-
> // The 'order' entity will now be in a 'Detached' state and it will no longer have any 'related' entities.
|
|
6395
|
-
**/
|
|
6396
|
-
setDetached = function () {
|
|
6397
|
-
return this.setEntityState(EntityState.Detached);
|
|
6398
|
-
};
|
|
6399
|
-
/**
|
|
6400
6201
|
Sets the entity to the specified EntityState. See also 'setUnchanged', 'setModified', 'setDetached', etc.
|
|
6401
6202
|
> // assume order is an order entity attached to an EntityManager.
|
|
6402
6203
|
> order.entityAspect.setEntityState(EntityState.Unchanged);
|
|
@@ -6413,12 +6214,12 @@ class EntityAspect {
|
|
|
6413
6214
|
let em = this.entityManager;
|
|
6414
6215
|
let needsSave = true;
|
|
6415
6216
|
if (entityState === EntityState.Unchanged) {
|
|
6416
|
-
clearOriginalValues
|
|
6217
|
+
clearOriginalValues(entity);
|
|
6417
6218
|
delete this.hasTempKey;
|
|
6418
6219
|
needsSave = false;
|
|
6419
6220
|
}
|
|
6420
6221
|
else if (entityState === EntityState.Added) {
|
|
6421
|
-
clearOriginalValues
|
|
6222
|
+
clearOriginalValues(entity);
|
|
6422
6223
|
// TODO: more to do here... like regenerating key ???
|
|
6423
6224
|
}
|
|
6424
6225
|
else if (entityState === EntityState.Deleted) {
|
|
@@ -6759,6 +6560,8 @@ class EntityAspect {
|
|
|
6759
6560
|
}
|
|
6760
6561
|
}
|
|
6761
6562
|
}
|
|
6563
|
+
/** @hidden @internal */
|
|
6564
|
+
EntityAspect._nullInstance = new EntityAspect(); // TODO: determine if this works
|
|
6762
6565
|
BreezeEvent.bubbleEvent(EntityAspect.prototype, function () {
|
|
6763
6566
|
return this.entityManager;
|
|
6764
6567
|
});
|
|
@@ -6892,17 +6695,6 @@ entity via either a query, import or EntityManager.createEntity call.
|
|
|
6892
6695
|
> // aCustomer === aspect.parent;
|
|
6893
6696
|
**/
|
|
6894
6697
|
class ComplexAspect {
|
|
6895
|
-
/** The complex object that this aspect is associated with. __Read Only__ */
|
|
6896
|
-
complexObject;
|
|
6897
|
-
/** The 'original values' of this complex object where they are different from the 'current values'.
|
|
6898
|
-
This is a map where the key is a property name and the value is the 'original value' of the property.
|
|
6899
|
-
__Read Only__ */
|
|
6900
|
-
originalValues;
|
|
6901
|
-
/** The parent object that to which this aspect belongs; this will either be an entity or another complex object. __Read Only__ */
|
|
6902
|
-
parent;
|
|
6903
|
-
/** The [[DataProperty]] on the 'parent' that contains this complex object. __Read Only__ */
|
|
6904
|
-
parentProperty;
|
|
6905
|
-
extraMetadata;
|
|
6906
6698
|
/** You will rarely, if ever, create a ComplexAspect directly. */
|
|
6907
6699
|
constructor(complexObject, parent, parentProperty) {
|
|
6908
6700
|
if (!complexObject) {
|
|
@@ -6962,18 +6754,18 @@ class ComplexAspect {
|
|
|
6962
6754
|
return aspect.getPropertyPath(this.parentProperty.name + "." + propName);
|
|
6963
6755
|
}
|
|
6964
6756
|
}
|
|
6965
|
-
function clearOriginalValues
|
|
6757
|
+
function clearOriginalValues(target) {
|
|
6966
6758
|
let aspect = target.entityAspect || target.complexAspect;
|
|
6967
6759
|
aspect.originalValues = {};
|
|
6968
6760
|
let stype = target.entityType || target.complexType;
|
|
6969
6761
|
stype.complexProperties.forEach(function (cp) {
|
|
6970
6762
|
let cos = target.getProperty(cp.name);
|
|
6971
6763
|
if (cp.isScalar) {
|
|
6972
|
-
clearOriginalValues
|
|
6764
|
+
clearOriginalValues(cos);
|
|
6973
6765
|
}
|
|
6974
6766
|
else {
|
|
6975
6767
|
cos._acceptChanges();
|
|
6976
|
-
cos.forEach(clearOriginalValues
|
|
6768
|
+
cos.forEach(clearOriginalValues);
|
|
6977
6769
|
}
|
|
6978
6770
|
});
|
|
6979
6771
|
}
|
|
@@ -6986,14 +6778,6 @@ The default NamingConvention does not perform any translation, it simply passes
|
|
|
6986
6778
|
@dynamic
|
|
6987
6779
|
**/
|
|
6988
6780
|
class NamingConvention {
|
|
6989
|
-
/** @hidden @internal */
|
|
6990
|
-
_$typeName;
|
|
6991
|
-
/** The name of this NamingConvention. __Read Only__ */
|
|
6992
|
-
name;
|
|
6993
|
-
/** Function that takes a server property name add converts it into a client side property name. __Read Only__ */
|
|
6994
|
-
serverPropertyNameToClient;
|
|
6995
|
-
/** Function that takes a client property name add converts it into a server side property name. __Read Only__ */
|
|
6996
|
-
clientPropertyNameToServer;
|
|
6997
6781
|
/**
|
|
6998
6782
|
NamingConvention constructor
|
|
6999
6783
|
> // A naming convention that converts the first character of every property name to uppercase on the server
|
|
@@ -7021,38 +6805,6 @@ class NamingConvention {
|
|
|
7021
6805
|
config._storeObject(this, "NamingConvention", this.name);
|
|
7022
6806
|
}
|
|
7023
6807
|
/**
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
/**
|
|
7027
|
-
A noop naming convention - This is the default unless another is specified.
|
|
7028
|
-
**/
|
|
7029
|
-
static none = new NamingConvention({
|
|
7030
|
-
name: "noChange",
|
|
7031
|
-
serverPropertyNameToClient: (serverPropertyName) => {
|
|
7032
|
-
return serverPropertyName;
|
|
7033
|
-
},
|
|
7034
|
-
clientPropertyNameToServer: (clientPropertyName) => {
|
|
7035
|
-
return clientPropertyName;
|
|
7036
|
-
}
|
|
7037
|
-
});
|
|
7038
|
-
/**
|
|
7039
|
-
The "camelCase" naming convention - This implementation only lowercases the first character of the server property name
|
|
7040
|
-
but leaves the rest of the property name intact. If a more complicated version is needed then one should be created via the ctor.
|
|
7041
|
-
**/
|
|
7042
|
-
static camelCase = new NamingConvention({
|
|
7043
|
-
name: "camelCase",
|
|
7044
|
-
serverPropertyNameToClient: (serverPropertyName) => {
|
|
7045
|
-
return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);
|
|
7046
|
-
},
|
|
7047
|
-
clientPropertyNameToServer: (clientPropertyName) => {
|
|
7048
|
-
return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);
|
|
7049
|
-
}
|
|
7050
|
-
});
|
|
7051
|
-
/**
|
|
7052
|
-
The default value whenever NamingConventions are not specified.
|
|
7053
|
-
**/
|
|
7054
|
-
static defaultInstance = new NamingConvention(NamingConvention.none);
|
|
7055
|
-
/**
|
|
7056
6808
|
Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
|
|
7057
6809
|
The current instance is returned unchanged.
|
|
7058
6810
|
> var namingConv = new NamingConvention({
|
|
@@ -7068,7 +6820,39 @@ class NamingConvention {
|
|
|
7068
6820
|
setAsDefault() {
|
|
7069
6821
|
return core.setAsDefault(this, NamingConvention);
|
|
7070
6822
|
}
|
|
7071
|
-
}
|
|
6823
|
+
}
|
|
6824
|
+
/**
|
|
6825
|
+
|
|
6826
|
+
|
|
6827
|
+
/**
|
|
6828
|
+
A noop naming convention - This is the default unless another is specified.
|
|
6829
|
+
**/
|
|
6830
|
+
NamingConvention.none = new NamingConvention({
|
|
6831
|
+
name: "noChange",
|
|
6832
|
+
serverPropertyNameToClient: (serverPropertyName) => {
|
|
6833
|
+
return serverPropertyName;
|
|
6834
|
+
},
|
|
6835
|
+
clientPropertyNameToServer: (clientPropertyName) => {
|
|
6836
|
+
return clientPropertyName;
|
|
6837
|
+
}
|
|
6838
|
+
});
|
|
6839
|
+
/**
|
|
6840
|
+
The "camelCase" naming convention - This implementation only lowercases the first character of the server property name
|
|
6841
|
+
but leaves the rest of the property name intact. If a more complicated version is needed then one should be created via the ctor.
|
|
6842
|
+
**/
|
|
6843
|
+
NamingConvention.camelCase = new NamingConvention({
|
|
6844
|
+
name: "camelCase",
|
|
6845
|
+
serverPropertyNameToClient: (serverPropertyName) => {
|
|
6846
|
+
return serverPropertyName.substr(0, 1).toLowerCase() + serverPropertyName.substr(1);
|
|
6847
|
+
},
|
|
6848
|
+
clientPropertyNameToServer: (clientPropertyName) => {
|
|
6849
|
+
return clientPropertyName.substr(0, 1).toUpperCase() + clientPropertyName.substr(1);
|
|
6850
|
+
}
|
|
6851
|
+
});
|
|
6852
|
+
/**
|
|
6853
|
+
The default value whenever NamingConventions are not specified.
|
|
6854
|
+
**/
|
|
6855
|
+
NamingConvention.defaultInstance = new NamingConvention(NamingConvention.none);
|
|
7072
6856
|
NamingConvention.prototype._$typeName = "NamingConvention";
|
|
7073
6857
|
|
|
7074
6858
|
const RX_COLLECTION = /Collection\((.*)\)/;
|
|
@@ -7461,16 +7245,6 @@ The default LocalQueryComparisonOptions stipulates 'caseInsensitive" queries wit
|
|
|
7461
7245
|
length strings.
|
|
7462
7246
|
**/
|
|
7463
7247
|
class LocalQueryComparisonOptions {
|
|
7464
|
-
/** @hidden @internal */
|
|
7465
|
-
_$typeName; // on prototype
|
|
7466
|
-
/** The name for this instance. */
|
|
7467
|
-
name;
|
|
7468
|
-
/** Whether predicates that involve strings will be interpreted in a "caseSensitive" manner. (default = false). */
|
|
7469
|
-
isCaseSensitive;
|
|
7470
|
-
/* Whether or not to enforce the ANSI SQL standard
|
|
7471
|
-
of padding strings of unequal lengths before comparison with spaces. Note that per the standard, padding only occurs with equality and
|
|
7472
|
-
inequality predicates, and not with operations like 'startsWith', 'endsWith' or 'contains'. Default is true. */
|
|
7473
|
-
usesSql92CompliantStringComparison;
|
|
7474
7248
|
/**
|
|
7475
7249
|
LocalQueryComparisonOptions constructor
|
|
7476
7250
|
> // create a 'caseSensitive - non SQL' instance.
|
|
@@ -7498,18 +7272,6 @@ class LocalQueryComparisonOptions {
|
|
|
7498
7272
|
config._storeObject(this, "LocalQueryComparisonOptions", this.name);
|
|
7499
7273
|
}
|
|
7500
7274
|
/**
|
|
7501
|
-
Case insensitive SQL compliant options - this is also the default unless otherwise changed.
|
|
7502
|
-
**/
|
|
7503
|
-
static caseInsensitiveSQL = new LocalQueryComparisonOptions({
|
|
7504
|
-
name: "caseInsensitiveSQL",
|
|
7505
|
-
isCaseSensitive: false,
|
|
7506
|
-
usesSql92CompliantStringComparison: true
|
|
7507
|
-
});
|
|
7508
|
-
/**
|
|
7509
|
-
The default value whenever LocalQueryComparisonOptions are not specified. By default this is 'caseInsensitiveSQL'.
|
|
7510
|
-
**/
|
|
7511
|
-
static defaultInstance = new LocalQueryComparisonOptions(LocalQueryComparisonOptions.caseInsensitiveSQL);
|
|
7512
|
-
/**
|
|
7513
7275
|
Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
|
|
7514
7276
|
The current instance is returned unchanged.
|
|
7515
7277
|
> var lqco = new LocalQueryComparisonOptions({
|
|
@@ -7522,6 +7284,18 @@ class LocalQueryComparisonOptions {
|
|
|
7522
7284
|
return core.setAsDefault(this, LocalQueryComparisonOptions);
|
|
7523
7285
|
}
|
|
7524
7286
|
}
|
|
7287
|
+
/**
|
|
7288
|
+
Case insensitive SQL compliant options - this is also the default unless otherwise changed.
|
|
7289
|
+
**/
|
|
7290
|
+
LocalQueryComparisonOptions.caseInsensitiveSQL = new LocalQueryComparisonOptions({
|
|
7291
|
+
name: "caseInsensitiveSQL",
|
|
7292
|
+
isCaseSensitive: false,
|
|
7293
|
+
usesSql92CompliantStringComparison: true
|
|
7294
|
+
});
|
|
7295
|
+
/**
|
|
7296
|
+
The default value whenever LocalQueryComparisonOptions are not specified. By default this is 'caseInsensitiveSQL'.
|
|
7297
|
+
**/
|
|
7298
|
+
LocalQueryComparisonOptions.defaultInstance = new LocalQueryComparisonOptions(LocalQueryComparisonOptions.caseInsensitiveSQL);
|
|
7525
7299
|
LocalQueryComparisonOptions.prototype._$typeName = "LocalQueryComparisonOptions";
|
|
7526
7300
|
|
|
7527
7301
|
/** @hidden @internal */
|
|
@@ -7985,52 +7759,6 @@ explicit MetadataStore, the MetadataStore from the MetadataStore.defaultInstance
|
|
|
7985
7759
|
@dynamic
|
|
7986
7760
|
**/
|
|
7987
7761
|
class MetadataStore {
|
|
7988
|
-
/** @hidden @internal */
|
|
7989
|
-
static __id = 0;
|
|
7990
|
-
/** @hidden @internal */
|
|
7991
|
-
static ANONTYPE_PREFIX = "_IB_";
|
|
7992
|
-
/** The version of any MetadataStores created by this class */
|
|
7993
|
-
static metadataVersion = '1.0.5';
|
|
7994
|
-
name;
|
|
7995
|
-
dataServices;
|
|
7996
|
-
/** The [[NamingConvention]] associated with this MetadataStore. __Read Only__ */
|
|
7997
|
-
namingConvention;
|
|
7998
|
-
/** The [[LocalQueryComparisonOptions]] associated with this MetadataStore. __Read Only__ */
|
|
7999
|
-
localQueryComparisonOptions;
|
|
8000
|
-
serializerFn;
|
|
8001
|
-
/**
|
|
8002
|
-
An [[BreezeEvent]] that fires after a MetadataStore has completed fetching metadata from a remote service.
|
|
8003
|
-
|
|
8004
|
-
@eventArgs -
|
|
8005
|
-
- metadataStore - The MetadataStore into which the metadata was fetched.
|
|
8006
|
-
- dataService - The [[DataService]] that metadata was fetched from.
|
|
8007
|
-
- rawMetadata - {Object} The raw metadata returned from the service. (It will have already been processed by this point).
|
|
8008
|
-
> let ms = myEntityManager.metadataStore;
|
|
8009
|
-
> ms.metadataFetched.subscribe(function(args) {
|
|
8010
|
-
> let metadataStore = args.metadataStore;
|
|
8011
|
-
> let dataService = args.dataService;
|
|
8012
|
-
> });
|
|
8013
|
-
@event
|
|
8014
|
-
**/
|
|
8015
|
-
metadataFetched;
|
|
8016
|
-
/** @hidden @internal */
|
|
8017
|
-
_resourceEntityTypeMap;
|
|
8018
|
-
/** @hidden @internal */
|
|
8019
|
-
_entityTypeResourceMap;
|
|
8020
|
-
/** @hidden @internal key is qualified structuraltype name - value is structuralType. ( structural = entityType or complexType). */
|
|
8021
|
-
_structuralTypeMap;
|
|
8022
|
-
/** @hidden @internal key is shortName, value is qualified name - does not need to be serialized. **/
|
|
8023
|
-
_shortNameMap;
|
|
8024
|
-
/** @hidden @internal key is either short or qual type name - value is ctor; **/
|
|
8025
|
-
_ctorRegistry;
|
|
8026
|
-
/** @hidden @internal key is entityTypeName; value is array of nav props **/
|
|
8027
|
-
_incompleteTypeMap;
|
|
8028
|
-
/** @hidden @internal **/
|
|
8029
|
-
_incompleteComplexTypeMap;
|
|
8030
|
-
/** @hidden @internal { json: any, stype: StructuralType }[] | { entityType: EntityType, csdlEntityType: any }[] **/
|
|
8031
|
-
_deferredTypes;
|
|
8032
|
-
/** @hidden @internal **/
|
|
8033
|
-
_id;
|
|
8034
7762
|
/**
|
|
8035
7763
|
Constructs a new MetadataStore.
|
|
8036
7764
|
|
|
@@ -8070,10 +7798,6 @@ class MetadataStore {
|
|
|
8070
7798
|
this._id = MetadataStore.__id++;
|
|
8071
7799
|
this.metadataFetched = new BreezeEvent("metadataFetched", this);
|
|
8072
7800
|
}
|
|
8073
|
-
// needs to be made avail to dataService.xxx files
|
|
8074
|
-
static normalizeTypeName = core.memoize(function (rawTypeName) {
|
|
8075
|
-
return rawTypeName && MetadataStore.parseTypeName(rawTypeName).typeName;
|
|
8076
|
-
});
|
|
8077
7801
|
// for debugging use the line below instead.
|
|
8078
7802
|
//ctor.normalizeTypeName = function (rawTypeName) { return parseTypeName(rawTypeName).typeName; };
|
|
8079
7803
|
/**
|
|
@@ -8604,6 +8328,16 @@ class MetadataStore {
|
|
|
8604
8328
|
}
|
|
8605
8329
|
}
|
|
8606
8330
|
}
|
|
8331
|
+
/** @hidden @internal */
|
|
8332
|
+
MetadataStore.__id = 0;
|
|
8333
|
+
/** @hidden @internal */
|
|
8334
|
+
MetadataStore.ANONTYPE_PREFIX = "_IB_";
|
|
8335
|
+
/** The version of any MetadataStores created by this class */
|
|
8336
|
+
MetadataStore.metadataVersion = '1.0.5';
|
|
8337
|
+
// needs to be made avail to dataService.xxx files
|
|
8338
|
+
MetadataStore.normalizeTypeName = core.memoize(function (rawTypeName) {
|
|
8339
|
+
return rawTypeName && MetadataStore.parseTypeName(rawTypeName).typeName;
|
|
8340
|
+
});
|
|
8607
8341
|
MetadataStore.prototype._$typeName = "MetadataStore";
|
|
8608
8342
|
BreezeEvent.bubbleEvent(MetadataStore.prototype);
|
|
8609
8343
|
function getTypesFromMap(typeMap) {
|
|
@@ -8722,76 +8456,6 @@ function getQualifiedTypeName(metadataStore, structTypeName, throwIfNotFound) {
|
|
|
8722
8456
|
/** Container for all of the metadata about a specific type of Entity.
|
|
8723
8457
|
**/
|
|
8724
8458
|
class EntityType {
|
|
8725
|
-
/** @hidden @internal */
|
|
8726
|
-
static __nextAnonIx = 0;
|
|
8727
|
-
/** Always false for an EntityType. **/
|
|
8728
|
-
isComplexType = false;
|
|
8729
|
-
/** The [[MetadataStore]] that contains this EntityType. __Read Only__ **/
|
|
8730
|
-
metadataStore;
|
|
8731
|
-
/** The DataProperties (see [[DataProperty]] associated with this EntityType. __Read Only__ **/
|
|
8732
|
-
dataProperties;
|
|
8733
|
-
/** The NavigationProperties (see [[NavigationProperty]] associated with this EntityType. __Read Only__ **/
|
|
8734
|
-
navigationProperties;
|
|
8735
|
-
/**
|
|
8736
|
-
The DataProperties associated with this EntityType that make up it's [[EntityKey]]. __Read Only__ **/
|
|
8737
|
-
keyProperties;
|
|
8738
|
-
/** The DataProperties associated with this EntityType that are foreign key properties. __Read Only__ **/
|
|
8739
|
-
foreignKeyProperties;
|
|
8740
|
-
inverseForeignKeyProperties;
|
|
8741
|
-
/** The DataProperties associated with this EntityType that are concurrency properties. __Read Only__ **/
|
|
8742
|
-
concurrencyProperties;
|
|
8743
|
-
/** The DataProperties for this EntityType that contain instances of a [[ComplexType]]. __Read Only__ **/
|
|
8744
|
-
complexProperties;
|
|
8745
|
-
/** The DataProperties associated with this EntityType that are not mapped to any backend datastore. These are effectively free standing
|
|
8746
|
-
properties. __Read Only__ **/
|
|
8747
|
-
unmappedProperties;
|
|
8748
|
-
/** The fully qualified name of this EntityType. __Read Only__ **/
|
|
8749
|
-
name;
|
|
8750
|
-
/** The short, unqualified, name for this EntityType. __Read Only__ **/
|
|
8751
|
-
shortName;
|
|
8752
|
-
/** The namespace for this EntityType. __Read Only__ **/
|
|
8753
|
-
namespace;
|
|
8754
|
-
/** The name of this EntityType's base EntityType (if any) */
|
|
8755
|
-
baseTypeName;
|
|
8756
|
-
/** The base EntityType (if any) for this EntityType. __Read Only__ **/
|
|
8757
|
-
baseEntityType;
|
|
8758
|
-
subtypes;
|
|
8759
|
-
/** Whether this EntityType is abstract. __Read Only__ **/
|
|
8760
|
-
isAbstract;
|
|
8761
|
-
/** Whether this EntityType is anonymous. Anonymous types will never be communicated to or from the server. They are purely for
|
|
8762
|
-
client side use and are given an automatically generated name. __Read Only__ **/
|
|
8763
|
-
isAnonymous;
|
|
8764
|
-
/** Whether this EntityType has been 'frozen'. EntityTypes become frozen after the first instance
|
|
8765
|
-
of that type has been created and attached to an EntityManager. */
|
|
8766
|
-
isFrozen;
|
|
8767
|
-
/** The [[AutoGeneratedKeyType]] for this EntityType. __Read Only__ **/
|
|
8768
|
-
autoGeneratedKeyType;
|
|
8769
|
-
/** The default resource name associated with this EntityType. An EntityType may be queried via a variety of 'resource names' but this one
|
|
8770
|
-
is used as the default when no resource name is provided. This will occur when calling [[EntityAspect.loadNavigationProperty]]
|
|
8771
|
-
or when executing any [[EntityQuery]] that was created via an [[EntityKey]]. __Read Only__ **/
|
|
8772
|
-
defaultResourceName;
|
|
8773
|
-
/** A function that is used to customize the serialization of any EntityProperties of this type. */
|
|
8774
|
-
serializerFn;
|
|
8775
|
-
/** A free form object that can be used to define any custom metadata for this EntityType. __Read Only__ **/
|
|
8776
|
-
custom;
|
|
8777
|
-
/** The entity level validators associated with this EntityType. Validators can be added and
|
|
8778
|
-
removed from this collection. __Read Only__. **/
|
|
8779
|
-
validators;
|
|
8780
|
-
warnings;
|
|
8781
|
-
initFn;
|
|
8782
|
-
noTrackingFn;
|
|
8783
|
-
/** @hidden @internal */
|
|
8784
|
-
_extra;
|
|
8785
|
-
/** @hidden @internal */
|
|
8786
|
-
_ctor;
|
|
8787
|
-
/** @hidden @internal */
|
|
8788
|
-
_mappedPropertiesCount;
|
|
8789
|
-
/**
|
|
8790
|
-
@deprecated Use [[getCtor]] instead.
|
|
8791
|
-
*/
|
|
8792
|
-
getEntityCtor = this.getCtor;
|
|
8793
|
-
/** @hidden @internal */
|
|
8794
|
-
static qualifyTypeName = qualifyTypeName;
|
|
8795
8459
|
/** EntityType constructor
|
|
8796
8460
|
> let entityType = new EntityType( {
|
|
8797
8461
|
> shortName: "person",
|
|
@@ -8802,6 +8466,12 @@ class EntityType {
|
|
|
8802
8466
|
client side use and will be given an automatically generated name. Normally, however, you will use a configuration object.
|
|
8803
8467
|
**/
|
|
8804
8468
|
constructor(config) {
|
|
8469
|
+
/** Always false for an EntityType. **/
|
|
8470
|
+
this.isComplexType = false;
|
|
8471
|
+
/**
|
|
8472
|
+
@deprecated Use [[getCtor]] instead.
|
|
8473
|
+
*/
|
|
8474
|
+
this.getEntityCtor = this.getCtor;
|
|
8805
8475
|
if (arguments.length > 1) {
|
|
8806
8476
|
throw new Error("The EntityType ctor has a single argument that is either a 'MetadataStore' or a configuration object.");
|
|
8807
8477
|
}
|
|
@@ -9453,6 +9123,10 @@ class EntityType {
|
|
|
9453
9123
|
delete incompleteTypeMap[this.name];
|
|
9454
9124
|
}
|
|
9455
9125
|
}
|
|
9126
|
+
/** @hidden @internal */
|
|
9127
|
+
EntityType.__nextAnonIx = 0;
|
|
9128
|
+
/** @hidden @internal */
|
|
9129
|
+
EntityType.qualifyTypeName = qualifyTypeName;
|
|
9456
9130
|
EntityType.prototype._$typeName = "EntityType";
|
|
9457
9131
|
function getRawValueFromConfig(rawEntity, dp) {
|
|
9458
9132
|
// 'true' fork can happen if an initializer contains an actaul instance of an already created complex object.
|
|
@@ -9591,66 +9265,33 @@ function calcUnmappedProperties(stype, instance) {
|
|
|
9591
9265
|
@param config - Configuration settings
|
|
9592
9266
|
**/
|
|
9593
9267
|
class ComplexType {
|
|
9594
|
-
/** For polymorphic purpose only - always true here */
|
|
9595
|
-
isComplexType = true;
|
|
9596
|
-
/** The [[MetadataStore]] containing this ComplexType. */
|
|
9597
|
-
metadataStore;
|
|
9598
|
-
/** The fully qualifed name of this ComplexType. __Read Only__ **/
|
|
9599
|
-
name;
|
|
9600
|
-
/** The short, unqualified, name for this ComplexType. __Read Only__ **/
|
|
9601
|
-
shortName;
|
|
9602
|
-
/** The namespace for this ComplexType. __Read Only__ **/
|
|
9603
|
-
namespace;
|
|
9604
|
-
/** The DataProperties (see [[DataProperty]] associated with this ComplexType. __Read Only__ */
|
|
9605
|
-
dataProperties;
|
|
9606
|
-
/** The DataProperties for this ComplexType that contain instances of a [[ComplexType]]. __Read Only__ */
|
|
9607
|
-
complexProperties;
|
|
9608
|
-
/**
|
|
9609
|
-
The entity level validators associated with this ComplexType. Validators can be added and
|
|
9610
|
-
removed from this collection. __Read Only__ **/
|
|
9611
|
-
validators;
|
|
9612
|
-
/** For polymorphic purpose only - always empty here */
|
|
9613
|
-
concurrencyProperties;
|
|
9614
|
-
/** The DataProperties associated with this ComplexType that are not mapped to any backend datastore. These are effectively free standing
|
|
9615
|
-
properties. __Read Only__ **/
|
|
9616
|
-
unmappedProperties;
|
|
9617
|
-
// keyProperties and navigationProperties are not used on complexTypes - but here to allow sharing of code between EntityType and ComplexType.
|
|
9618
|
-
navigationProperties;
|
|
9619
|
-
// and may be used later to enforce uniqueness on arrays of complextypes.
|
|
9620
|
-
keyProperties;
|
|
9621
|
-
warnings;
|
|
9622
|
-
serializerFn;
|
|
9623
|
-
/** A free form object that can be used to define any custom metadata for this ComplexType. ***/
|
|
9624
|
-
custom;
|
|
9625
|
-
/** @hidden @internal */
|
|
9626
|
-
_mappedPropertiesCount;
|
|
9627
|
-
/** @hidden @internal */
|
|
9628
|
-
_extra;
|
|
9629
|
-
// copy entityType methods onto complexType
|
|
9630
|
-
/** See [[EntityType.getCtor]] */
|
|
9631
|
-
getCtor = EntityType.prototype.getCtor;
|
|
9632
|
-
// note the name change.
|
|
9633
|
-
createInstance = EntityType.prototype.createEntity;
|
|
9634
|
-
/** See [EntityType.addValidator] */
|
|
9635
|
-
addValidator = EntityType.prototype.addValidator;
|
|
9636
|
-
getProperty = EntityType.prototype.getProperty;
|
|
9637
|
-
getPropertiesOnPath = EntityType.prototype.getPropertiesOnPath;
|
|
9638
|
-
getPropertyNames = EntityType.prototype.getPropertyNames;
|
|
9639
|
-
/** @hidden @internal */
|
|
9640
|
-
_addPropertyCore = EntityType.prototype._addPropertyCore;
|
|
9641
|
-
/** @hidden @internal */
|
|
9642
|
-
_addDataProperty = EntityType.prototype._addDataProperty;
|
|
9643
|
-
/** @hidden @internal */
|
|
9644
|
-
_updateNames = EntityType.prototype._updateNames;
|
|
9645
|
-
/** @hidden @internal */
|
|
9646
|
-
_updateCps = EntityType.prototype._updateCps;
|
|
9647
|
-
/** @hidden @internal */
|
|
9648
|
-
_initializeInstance = EntityType.prototype._initializeInstance;
|
|
9649
|
-
/** @hidden @internal */
|
|
9650
|
-
_updateTargetFromRaw = EntityType.prototype._updateTargetFromRaw;
|
|
9651
|
-
/** @hidden @internal */
|
|
9652
|
-
_setCtor = EntityType.prototype._setCtor;
|
|
9653
9268
|
constructor(config) {
|
|
9269
|
+
/** For polymorphic purpose only - always true here */
|
|
9270
|
+
this.isComplexType = true;
|
|
9271
|
+
// copy entityType methods onto complexType
|
|
9272
|
+
/** See [[EntityType.getCtor]] */
|
|
9273
|
+
this.getCtor = EntityType.prototype.getCtor;
|
|
9274
|
+
// note the name change.
|
|
9275
|
+
this.createInstance = EntityType.prototype.createEntity;
|
|
9276
|
+
/** See [EntityType.addValidator] */
|
|
9277
|
+
this.addValidator = EntityType.prototype.addValidator;
|
|
9278
|
+
this.getProperty = EntityType.prototype.getProperty;
|
|
9279
|
+
this.getPropertiesOnPath = EntityType.prototype.getPropertiesOnPath;
|
|
9280
|
+
this.getPropertyNames = EntityType.prototype.getPropertyNames;
|
|
9281
|
+
/** @hidden @internal */
|
|
9282
|
+
this._addPropertyCore = EntityType.prototype._addPropertyCore;
|
|
9283
|
+
/** @hidden @internal */
|
|
9284
|
+
this._addDataProperty = EntityType.prototype._addDataProperty;
|
|
9285
|
+
/** @hidden @internal */
|
|
9286
|
+
this._updateNames = EntityType.prototype._updateNames;
|
|
9287
|
+
/** @hidden @internal */
|
|
9288
|
+
this._updateCps = EntityType.prototype._updateCps;
|
|
9289
|
+
/** @hidden @internal */
|
|
9290
|
+
this._initializeInstance = EntityType.prototype._initializeInstance;
|
|
9291
|
+
/** @hidden @internal */
|
|
9292
|
+
this._updateTargetFromRaw = EntityType.prototype._updateTargetFromRaw;
|
|
9293
|
+
/** @hidden @internal */
|
|
9294
|
+
this._setCtor = EntityType.prototype._setCtor;
|
|
9654
9295
|
if (arguments.length > 1) {
|
|
9655
9296
|
throw new Error("The ComplexType ctor has a single argument that is a configuration object.");
|
|
9656
9297
|
}
|
|
@@ -9731,10 +9372,6 @@ Instances of the DataProperty class are constructed automatically during Metadat
|
|
|
9731
9372
|
directly via the constructor.
|
|
9732
9373
|
**/
|
|
9733
9374
|
class DataProperty {
|
|
9734
|
-
/** Is this a DataProperty? - always true here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
|
|
9735
|
-
isDataProperty = true;
|
|
9736
|
-
/** Is this a NavigationProperty? - always false here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
|
|
9737
|
-
isNavigationProperty = false;
|
|
9738
9375
|
/** DataProperty constructor
|
|
9739
9376
|
> let lastNameProp = new DataProperty( {
|
|
9740
9377
|
> name: "lastName",
|
|
@@ -9747,6 +9384,10 @@ class DataProperty {
|
|
|
9747
9384
|
@param config - A configuration Object or a DataProperty
|
|
9748
9385
|
*/
|
|
9749
9386
|
constructor(config) {
|
|
9387
|
+
/** Is this a DataProperty? - always true here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
|
|
9388
|
+
this.isDataProperty = true;
|
|
9389
|
+
/** Is this a NavigationProperty? - always false here. Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
|
|
9390
|
+
this.isNavigationProperty = false;
|
|
9750
9391
|
assertConfig(config)
|
|
9751
9392
|
.whereParam("name").isString().isOptional()
|
|
9752
9393
|
.whereParam("nameOnServer").isString().isOptional()
|
|
@@ -9910,15 +9551,6 @@ Instances of the NavigationProperty class are constructed automatically during M
|
|
|
9910
9551
|
directly via the constructor.
|
|
9911
9552
|
**/
|
|
9912
9553
|
class NavigationProperty {
|
|
9913
|
-
/** Is this a DataProperty? - always false here
|
|
9914
|
-
Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
|
|
9915
|
-
isDataProperty = false;
|
|
9916
|
-
/** Is this a NavigationProperty? - always true here
|
|
9917
|
-
Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
|
|
9918
|
-
isNavigationProperty = true;
|
|
9919
|
-
formatName = DataProperty.prototype.formatName;
|
|
9920
|
-
getAllValidators = DataProperty.prototype.getAllValidators;
|
|
9921
|
-
resolveProperty = DataProperty.prototype.resolveProperty;
|
|
9922
9554
|
/** NavigationProperty constructor
|
|
9923
9555
|
> let homeAddressProp = new NavigationProperty( {
|
|
9924
9556
|
> name: "homeAddress",
|
|
@@ -9937,6 +9569,15 @@ class NavigationProperty {
|
|
|
9937
9569
|
@param config - A configuration object.
|
|
9938
9570
|
**/
|
|
9939
9571
|
constructor(config) {
|
|
9572
|
+
/** Is this a DataProperty? - always false here
|
|
9573
|
+
Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
|
|
9574
|
+
this.isDataProperty = false;
|
|
9575
|
+
/** Is this a NavigationProperty? - always true here
|
|
9576
|
+
Allows polymorphic treatment of DataProperties and NavigationProperties. __Read Only__ */
|
|
9577
|
+
this.isNavigationProperty = true;
|
|
9578
|
+
this.formatName = DataProperty.prototype.formatName;
|
|
9579
|
+
this.getAllValidators = DataProperty.prototype.getAllValidators;
|
|
9580
|
+
this.resolveProperty = DataProperty.prototype.resolveProperty;
|
|
9940
9581
|
assertConfig(config)
|
|
9941
9582
|
.whereParam("name").isString().isOptional()
|
|
9942
9583
|
.whereParam("nameOnServer").isString().isOptional()
|
|
@@ -10128,24 +9769,24 @@ function resolveRelated(np) {
|
|
|
10128
9769
|
AutoGeneratedKeyType is an 'Enum' containing all of the valid states for an automatically generated key.
|
|
10129
9770
|
**/
|
|
10130
9771
|
class AutoGeneratedKeyType extends BreezeEnum {
|
|
10131
|
-
/**
|
|
10132
|
-
This entity does not have an autogenerated key.
|
|
10133
|
-
The client must set the key before adding the entity to the EntityManager
|
|
10134
|
-
**/
|
|
10135
|
-
static None = new AutoGeneratedKeyType();
|
|
10136
|
-
/**
|
|
10137
|
-
This entity's key is an Identity column and is set by the backend database.
|
|
10138
|
-
Keys for new entities will be temporary until the entities are saved at which point the keys will
|
|
10139
|
-
be converted to their 'real' versions.
|
|
10140
|
-
**/
|
|
10141
|
-
static Identity = new AutoGeneratedKeyType();
|
|
10142
|
-
/**
|
|
10143
|
-
This entity's key is generated by a KeyGenerator and is set by the backend database.
|
|
10144
|
-
Keys for new entities will be temporary until the entities are saved at which point the keys will
|
|
10145
|
-
be converted to their 'real' versions.
|
|
10146
|
-
**/
|
|
10147
|
-
static KeyGenerator = new AutoGeneratedKeyType();
|
|
10148
9772
|
}
|
|
9773
|
+
/**
|
|
9774
|
+
This entity does not have an autogenerated key.
|
|
9775
|
+
The client must set the key before adding the entity to the EntityManager
|
|
9776
|
+
**/
|
|
9777
|
+
AutoGeneratedKeyType.None = new AutoGeneratedKeyType();
|
|
9778
|
+
/**
|
|
9779
|
+
This entity's key is an Identity column and is set by the backend database.
|
|
9780
|
+
Keys for new entities will be temporary until the entities are saved at which point the keys will
|
|
9781
|
+
be converted to their 'real' versions.
|
|
9782
|
+
**/
|
|
9783
|
+
AutoGeneratedKeyType.Identity = new AutoGeneratedKeyType();
|
|
9784
|
+
/**
|
|
9785
|
+
This entity's key is generated by a KeyGenerator and is set by the backend database.
|
|
9786
|
+
Keys for new entities will be temporary until the entities are saved at which point the keys will
|
|
9787
|
+
be converted to their 'real' versions.
|
|
9788
|
+
**/
|
|
9789
|
+
AutoGeneratedKeyType.KeyGenerator = new AutoGeneratedKeyType();
|
|
10149
9790
|
AutoGeneratedKeyType.prototype._$typeName = "AutoGeneratedKeyType";
|
|
10150
9791
|
Error['x'] = AutoGeneratedKeyType.resolveSymbols();
|
|
10151
9792
|
let proto = Param.prototype;
|
|
@@ -10211,6 +9852,41 @@ function addProperties(entityType, propObj, ctor) {
|
|
|
10211
9852
|
@hidden
|
|
10212
9853
|
*/
|
|
10213
9854
|
class AbstractDataServiceAdapter {
|
|
9855
|
+
constructor() {
|
|
9856
|
+
/**
|
|
9857
|
+
Returns a constructor function for a "ChangeRequestInterceptor"
|
|
9858
|
+
that can tweak the saveBundle both as it is built and when it is completed
|
|
9859
|
+
by a concrete DataServiceAdapater.
|
|
9860
|
+
|
|
9861
|
+
Initialized with a default, no-op implementation that developers can replace with a
|
|
9862
|
+
substantive implementation that changes the individual entity change requests
|
|
9863
|
+
or aspects of the entire 'saveBundle' without having to write their own DataService adapters.
|
|
9864
|
+
> let adapter = breeze.config.getAdapterInstance('dataService');
|
|
9865
|
+
> adapter.changeRequestInterceptor = function (saveContext, saveBundle) {
|
|
9866
|
+
> this.getRequest = function (request, entity, index) {
|
|
9867
|
+
> // alter the request that the adapter prepared for this entity
|
|
9868
|
+
> // based on the entity, saveContext, and saveBundle
|
|
9869
|
+
> // e.g., add a custom header or prune the originalValuesMap
|
|
9870
|
+
> return request;
|
|
9871
|
+
> };
|
|
9872
|
+
> this.done = function (requests) {
|
|
9873
|
+
> // alter the array of requests representing the entire change-set
|
|
9874
|
+
> // based on the saveContext and saveBundle
|
|
9875
|
+
> };
|
|
9876
|
+
> }
|
|
9877
|
+
|
|
9878
|
+
@param saveContext - The BreezeJS "context" for the save operation.
|
|
9879
|
+
@param saveBundle - Contains the array of entities-to-be-saved (AKA, the entity change-set).
|
|
9880
|
+
@return Constructor for a "ChangeRequestInterceptor".
|
|
9881
|
+
**/
|
|
9882
|
+
this.changeRequestInterceptor = DefaultChangeRequestInterceptor;
|
|
9883
|
+
this.jsonResultsAdapter = new JsonResultsAdapter({
|
|
9884
|
+
name: "noop",
|
|
9885
|
+
visitNode: function ( /* node, mappingContext, nodeContext */) {
|
|
9886
|
+
return {};
|
|
9887
|
+
}
|
|
9888
|
+
});
|
|
9889
|
+
}
|
|
10214
9890
|
// TODO use interface
|
|
10215
9891
|
checkForRecomposition(interfaceInitializedArgs) {
|
|
10216
9892
|
if (interfaceInitializedArgs.interfaceName === "ajax" && interfaceInitializedArgs.isDefault) {
|
|
@@ -10261,51 +9937,82 @@ class AbstractDataServiceAdapter {
|
|
|
10261
9937
|
});
|
|
10262
9938
|
return promise;
|
|
10263
9939
|
}
|
|
9940
|
+
/** Execute the query in the mappingContext using the ajaxImpl. */
|
|
10264
9941
|
executeQuery(mappingContext) {
|
|
10265
9942
|
mappingContext.adapter = this;
|
|
9943
|
+
const usePost = mappingContext.query.usePostEnabled;
|
|
9944
|
+
const params = usePost ? this._makeQueryPostParams(mappingContext) : this._makeQueryGetParams(mappingContext);
|
|
10266
9945
|
let promise = new Promise((resolve, reject) => {
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
try {
|
|
10276
|
-
let rData;
|
|
10277
|
-
let results = data && (data.results || data.Results);
|
|
10278
|
-
if (results) {
|
|
10279
|
-
rData = { results: results, inlineCount: data.inlineCount || data.InlineCount,
|
|
10280
|
-
httpResponse: httpResponse, query: mappingContext.query };
|
|
10281
|
-
}
|
|
10282
|
-
else {
|
|
10283
|
-
rData = { results: data, httpResponse: httpResponse, query: mappingContext.query };
|
|
10284
|
-
}
|
|
10285
|
-
resolve(rData);
|
|
9946
|
+
params.success = function (httpResponse) {
|
|
9947
|
+
let data = httpResponse.data;
|
|
9948
|
+
try {
|
|
9949
|
+
let rData;
|
|
9950
|
+
let results = data && (data.results || data.Results);
|
|
9951
|
+
if (results) {
|
|
9952
|
+
rData = { results: results, inlineCount: data.inlineCount || data.InlineCount,
|
|
9953
|
+
httpResponse: httpResponse, query: mappingContext.query };
|
|
10286
9954
|
}
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
reject(e);
|
|
10290
|
-
}
|
|
10291
|
-
else {
|
|
10292
|
-
handleHttpError(reject, httpResponse);
|
|
10293
|
-
}
|
|
9955
|
+
else {
|
|
9956
|
+
rData = { results: data, httpResponse: httpResponse, query: mappingContext.query };
|
|
10294
9957
|
}
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
9958
|
+
resolve(rData);
|
|
9959
|
+
}
|
|
9960
|
+
catch (e) {
|
|
9961
|
+
if (e instanceof Error) {
|
|
9962
|
+
reject(e);
|
|
9963
|
+
}
|
|
9964
|
+
else {
|
|
9965
|
+
handleHttpError(reject, httpResponse);
|
|
9966
|
+
}
|
|
9967
|
+
}
|
|
9968
|
+
};
|
|
9969
|
+
params.error = function (httpResponse) {
|
|
9970
|
+
handleHttpError(reject, httpResponse);
|
|
10300
9971
|
};
|
|
10301
|
-
if (mappingContext.dataService.useJsonp) {
|
|
10302
|
-
params.dataType = 'jsonp';
|
|
10303
|
-
params.crossDomain = true;
|
|
10304
|
-
}
|
|
10305
9972
|
this.ajaxImpl.ajax(params);
|
|
10306
9973
|
});
|
|
10307
9974
|
return promise;
|
|
10308
9975
|
}
|
|
9976
|
+
/** Set up ajax parameters for query GET. This puts the query into the request querystring in either JSON or OData-style syntax, depending upon the UriBuilder. */
|
|
9977
|
+
_makeQueryGetParams(mappingContext) {
|
|
9978
|
+
const url = mappingContext.getUrl();
|
|
9979
|
+
const params = {
|
|
9980
|
+
type: "GET",
|
|
9981
|
+
url: url,
|
|
9982
|
+
params: mappingContext.query.parameters,
|
|
9983
|
+
dataType: 'json',
|
|
9984
|
+
crossDomain: false,
|
|
9985
|
+
};
|
|
9986
|
+
if (mappingContext.dataService.useJsonp) {
|
|
9987
|
+
params.dataType = 'jsonp';
|
|
9988
|
+
params.crossDomain = true;
|
|
9989
|
+
}
|
|
9990
|
+
return params;
|
|
9991
|
+
}
|
|
9992
|
+
/** Set up ajax parameters for query POST. This put the query into the request body as JSON. */
|
|
9993
|
+
_makeQueryPostParams(mappingContext) {
|
|
9994
|
+
const entityQuery = mappingContext.query;
|
|
9995
|
+
const metadataStore = mappingContext.entityManager.metadataStore;
|
|
9996
|
+
const url = mappingContext.dataService.qualifyUrl(entityQuery.resourceName);
|
|
9997
|
+
let entityType = entityQuery._getFromEntityType(metadataStore, false);
|
|
9998
|
+
if (!entityType) {
|
|
9999
|
+
entityType = new EntityType(metadataStore);
|
|
10000
|
+
}
|
|
10001
|
+
const json = entityQuery.toJSONExt({ entityType: entityType, toNameOnServer: true });
|
|
10002
|
+
json.from = undefined;
|
|
10003
|
+
json.queryOptions = undefined;
|
|
10004
|
+
const params = {
|
|
10005
|
+
type: "POST",
|
|
10006
|
+
url: url,
|
|
10007
|
+
params: mappingContext.query.parameters,
|
|
10008
|
+
dataType: 'json',
|
|
10009
|
+
processData: false,
|
|
10010
|
+
contentType: "application/json; charset=UTF-8",
|
|
10011
|
+
data: JSON.stringify(json),
|
|
10012
|
+
crossDomain: false,
|
|
10013
|
+
};
|
|
10014
|
+
return params;
|
|
10015
|
+
}
|
|
10309
10016
|
saveChanges(saveContext, saveBundle) {
|
|
10310
10017
|
let adapter = saveContext.adapter = this;
|
|
10311
10018
|
let saveBundleSer = adapter._prepareSaveBundle(saveContext, saveBundle);
|
|
@@ -10345,33 +10052,6 @@ class AbstractDataServiceAdapter {
|
|
|
10345
10052
|
// The implementor should call _createChangeRequestInterceptor
|
|
10346
10053
|
throw new Error("Need a concrete implementation of _prepareSaveBundle");
|
|
10347
10054
|
}
|
|
10348
|
-
/**
|
|
10349
|
-
Returns a constructor function for a "ChangeRequestInterceptor"
|
|
10350
|
-
that can tweak the saveBundle both as it is built and when it is completed
|
|
10351
|
-
by a concrete DataServiceAdapater.
|
|
10352
|
-
|
|
10353
|
-
Initialized with a default, no-op implementation that developers can replace with a
|
|
10354
|
-
substantive implementation that changes the individual entity change requests
|
|
10355
|
-
or aspects of the entire 'saveBundle' without having to write their own DataService adapters.
|
|
10356
|
-
> let adapter = breeze.config.getAdapterInstance('dataService');
|
|
10357
|
-
> adapter.changeRequestInterceptor = function (saveContext, saveBundle) {
|
|
10358
|
-
> this.getRequest = function (request, entity, index) {
|
|
10359
|
-
> // alter the request that the adapter prepared for this entity
|
|
10360
|
-
> // based on the entity, saveContext, and saveBundle
|
|
10361
|
-
> // e.g., add a custom header or prune the originalValuesMap
|
|
10362
|
-
> return request;
|
|
10363
|
-
> };
|
|
10364
|
-
> this.done = function (requests) {
|
|
10365
|
-
> // alter the array of requests representing the entire change-set
|
|
10366
|
-
> // based on the saveContext and saveBundle
|
|
10367
|
-
> };
|
|
10368
|
-
> }
|
|
10369
|
-
|
|
10370
|
-
@param saveContext - The BreezeJS "context" for the save operation.
|
|
10371
|
-
@param saveBundle - Contains the array of entities-to-be-saved (AKA, the entity change-set).
|
|
10372
|
-
@return Constructor for a "ChangeRequestInterceptor".
|
|
10373
|
-
**/
|
|
10374
|
-
changeRequestInterceptor = DefaultChangeRequestInterceptor;
|
|
10375
10055
|
/** @hidden @internal */
|
|
10376
10056
|
_createChangeRequestInterceptor(saveContext, saveBundle) {
|
|
10377
10057
|
let adapter = saveContext.adapter;
|
|
@@ -10409,12 +10089,6 @@ class AbstractDataServiceAdapter {
|
|
|
10409
10089
|
"Likely did not or could not reach server. Is the server running?";
|
|
10410
10090
|
}
|
|
10411
10091
|
}
|
|
10412
|
-
jsonResultsAdapter = new JsonResultsAdapter({
|
|
10413
|
-
name: "noop",
|
|
10414
|
-
visitNode: function ( /* node, mappingContext, nodeContext */) {
|
|
10415
|
-
return {};
|
|
10416
|
-
}
|
|
10417
|
-
});
|
|
10418
10092
|
}
|
|
10419
10093
|
function handleHttpError(reject, httpResponse, messagePrefix) {
|
|
10420
10094
|
let err = createError(httpResponse);
|
|
@@ -10501,20 +10175,6 @@ A ValidationOptions instance is used to specify the conditions under which valid
|
|
|
10501
10175
|
|
|
10502
10176
|
*/
|
|
10503
10177
|
class ValidationOptions {
|
|
10504
|
-
/** @hidden @internal */
|
|
10505
|
-
_$typeName; // on proto
|
|
10506
|
-
/** Whether entity and property level validation should occur when entities are attached to the EntityManager
|
|
10507
|
-
other than via a query. (default = true) __Read Only__ */
|
|
10508
|
-
validateOnAttach;
|
|
10509
|
-
/** Whether entity and property level validation should occur before entities are saved.
|
|
10510
|
-
A failed validation will force the save to fail early. (default = true) __Read Only__ */
|
|
10511
|
-
validateOnSave;
|
|
10512
|
-
/** Whether entity and property level validation should occur after entities are queried from a remote server.
|
|
10513
|
-
(default = false) __Read Only__ **/
|
|
10514
|
-
validateOnQuery;
|
|
10515
|
-
/** Whether property level validation should occur after entities are modified.
|
|
10516
|
-
(default = true) __Read Only__ **/
|
|
10517
|
-
validateOnPropertyChange;
|
|
10518
10178
|
/**
|
|
10519
10179
|
ValidationOptions constructor
|
|
10520
10180
|
> var newVo = new ValidationOptions( { validateOnSave: false, validateOnAttach: false });
|
|
@@ -10523,7 +10183,7 @@ class ValidationOptions {
|
|
|
10523
10183
|
@param config - A configuration object.
|
|
10524
10184
|
**/
|
|
10525
10185
|
constructor(config) {
|
|
10526
|
-
updateWithConfig(this, config);
|
|
10186
|
+
updateWithConfig$1(this, config);
|
|
10527
10187
|
}
|
|
10528
10188
|
/**
|
|
10529
10189
|
Returns a copy of this ValidationOptions with changes to the specified config properties.
|
|
@@ -10536,7 +10196,7 @@ class ValidationOptions {
|
|
|
10536
10196
|
if (!config)
|
|
10537
10197
|
return this;
|
|
10538
10198
|
let result = new ValidationOptions(this);
|
|
10539
|
-
updateWithConfig(result, config);
|
|
10199
|
+
updateWithConfig$1(result, config);
|
|
10540
10200
|
return result;
|
|
10541
10201
|
}
|
|
10542
10202
|
/**
|
|
@@ -10549,18 +10209,18 @@ class ValidationOptions {
|
|
|
10549
10209
|
setAsDefault() {
|
|
10550
10210
|
return core.setAsDefault(this, ValidationOptions);
|
|
10551
10211
|
}
|
|
10552
|
-
/**
|
|
10553
|
-
The default instance for use whenever ValidationOptions are not specified.
|
|
10554
|
-
**/
|
|
10555
|
-
static defaultInstance = new ValidationOptions({
|
|
10556
|
-
validateOnAttach: true,
|
|
10557
|
-
validateOnSave: true,
|
|
10558
|
-
validateOnQuery: false,
|
|
10559
|
-
validateOnPropertyChange: true
|
|
10560
|
-
});
|
|
10561
10212
|
}
|
|
10213
|
+
/**
|
|
10214
|
+
The default instance for use whenever ValidationOptions are not specified.
|
|
10215
|
+
**/
|
|
10216
|
+
ValidationOptions.defaultInstance = new ValidationOptions({
|
|
10217
|
+
validateOnAttach: true,
|
|
10218
|
+
validateOnSave: true,
|
|
10219
|
+
validateOnQuery: false,
|
|
10220
|
+
validateOnPropertyChange: true
|
|
10221
|
+
});
|
|
10562
10222
|
ValidationOptions.prototype._$typeName = "ValidationOptions";
|
|
10563
|
-
function updateWithConfig(options, config) {
|
|
10223
|
+
function updateWithConfig$1(options, config) {
|
|
10564
10224
|
if (config) {
|
|
10565
10225
|
assertConfig(config)
|
|
10566
10226
|
.whereParam("validateOnAttach").isBoolean().isOptional()
|
|
@@ -10576,18 +10236,6 @@ function updateWithConfig(options, config) {
|
|
|
10576
10236
|
A SaveOptions instance is used to specify the 'options' under which a save will occur.
|
|
10577
10237
|
**/
|
|
10578
10238
|
class SaveOptions {
|
|
10579
|
-
/** @hidden @internal */
|
|
10580
|
-
_$typeName; // on proto
|
|
10581
|
-
/** Resource name to be used during the save - this defaults to "SaveChanges". __Read Only__ */
|
|
10582
|
-
resourceName;
|
|
10583
|
-
/** The DataService to be used for this save. __Read Only__ */
|
|
10584
|
-
dataService;
|
|
10585
|
-
/** Whether multiple saves can be in-flight at the same time. The default is false. __Read Only__ */
|
|
10586
|
-
allowConcurrentSaves;
|
|
10587
|
-
/** Free form value that will be sent to the server during the save. __Read Only__ */
|
|
10588
|
-
tag;
|
|
10589
|
-
/** The default value whenever SaveOptions are not specified. */
|
|
10590
|
-
static defaultInstance = new SaveOptions({ allowConcurrentSaves: false });
|
|
10591
10239
|
constructor(config) {
|
|
10592
10240
|
SaveOptions._updateWithConfig(this, config);
|
|
10593
10241
|
}
|
|
@@ -10618,14 +10266,14 @@ class SaveOptions {
|
|
|
10618
10266
|
return obj;
|
|
10619
10267
|
}
|
|
10620
10268
|
}
|
|
10269
|
+
/** The default value whenever SaveOptions are not specified. */
|
|
10270
|
+
SaveOptions.defaultInstance = new SaveOptions({ allowConcurrentSaves: false });
|
|
10621
10271
|
SaveOptions.prototype._$typeName = "SaveOptions";
|
|
10622
10272
|
|
|
10623
10273
|
/*
|
|
10624
10274
|
@class KeyGenerator
|
|
10625
10275
|
*/
|
|
10626
10276
|
class KeyGenerator {
|
|
10627
|
-
/** @hidden @internal */
|
|
10628
|
-
_tempIdMap;
|
|
10629
10277
|
constructor() {
|
|
10630
10278
|
// key is dataProperty.name + || + entityType.name, value is propEntry
|
|
10631
10279
|
// propEntry = { entityType, propertyName, keyMap }
|
|
@@ -10730,11 +10378,6 @@ config.registerType(KeyGenerator, "KeyGenerator");
|
|
|
10730
10378
|
|
|
10731
10379
|
/** @hidden @internal */
|
|
10732
10380
|
class EntityGroup {
|
|
10733
|
-
entityManager;
|
|
10734
|
-
entityType;
|
|
10735
|
-
_indexMap;
|
|
10736
|
-
_entities;
|
|
10737
|
-
_emptyIndexes;
|
|
10738
10381
|
constructor(entityManager, entityType) {
|
|
10739
10382
|
this.entityManager = entityManager;
|
|
10740
10383
|
this.entityType = entityType;
|
|
@@ -10922,19 +10565,8 @@ For use by breeze plugin authors only. The class is for use in building a [[IDat
|
|
|
10922
10565
|
@hidden
|
|
10923
10566
|
*/
|
|
10924
10567
|
class MappingContext {
|
|
10925
|
-
/** @hidden @internal */
|
|
10926
|
-
_$typeName; // on prototype
|
|
10927
|
-
rawValueFn = DataProperty.getRawValueFromServer; // think about passing this in later.
|
|
10928
|
-
dataService;
|
|
10929
|
-
query;
|
|
10930
|
-
entityManager;
|
|
10931
|
-
mergeOptions;
|
|
10932
|
-
adapter; // assigned in the AbstractDataServiceAdapter.
|
|
10933
|
-
refMap; // TODO
|
|
10934
|
-
deferredFns; // TODO
|
|
10935
|
-
jsonResultsAdapter;
|
|
10936
|
-
metadataStore;
|
|
10937
10568
|
constructor(config) {
|
|
10569
|
+
this.rawValueFn = DataProperty.getRawValueFromServer; // think about passing this in later.
|
|
10938
10570
|
core.extend(this, config, [
|
|
10939
10571
|
"query", "entityManager", "dataService", "mergeOptions"
|
|
10940
10572
|
]);
|
|
@@ -11157,7 +10789,7 @@ function mergeEntity(mc, node, meta) {
|
|
|
11157
10789
|
targetEntity.entityAspect.extraMetadata = meta.extraMetadata;
|
|
11158
10790
|
}
|
|
11159
10791
|
targetEntity.entityAspect.entityState = EntityState.Unchanged;
|
|
11160
|
-
clearOriginalValues(targetEntity);
|
|
10792
|
+
clearOriginalValues$1(targetEntity);
|
|
11161
10793
|
// propertyName not specified because multiple props EntityChangedEventArgs
|
|
11162
10794
|
targetEntity.entityAspect.propertyChanged.publish({ entity: targetEntity, propertyName: null });
|
|
11163
10795
|
let action = isSaving ? EntityAction.MergeOnSave : EntityAction.MergeOnQuery;
|
|
@@ -11191,18 +10823,18 @@ function mergeEntity(mc, node, meta) {
|
|
|
11191
10823
|
return targetEntity;
|
|
11192
10824
|
}
|
|
11193
10825
|
// copied from entityAspect
|
|
11194
|
-
function clearOriginalValues(target) {
|
|
10826
|
+
function clearOriginalValues$1(target) {
|
|
11195
10827
|
let aspect = target.entityAspect || target.complexAspect;
|
|
11196
10828
|
aspect.originalValues = {};
|
|
11197
10829
|
let stype = target.entityType || target.complexType;
|
|
11198
10830
|
stype.complexProperties.forEach(function (cp) {
|
|
11199
10831
|
let cos = target.getProperty(cp.name);
|
|
11200
10832
|
if (cp.isScalar) {
|
|
11201
|
-
clearOriginalValues(cos);
|
|
10833
|
+
clearOriginalValues$1(cos);
|
|
11202
10834
|
}
|
|
11203
10835
|
else {
|
|
11204
10836
|
cos._acceptChanges();
|
|
11205
|
-
cos.forEach(clearOriginalValues);
|
|
10837
|
+
cos.forEach(clearOriginalValues$1);
|
|
11206
10838
|
}
|
|
11207
10839
|
});
|
|
11208
10840
|
}
|
|
@@ -11334,8 +10966,10 @@ function updateRelatedEntityInCollection(mc, relatedEntity, relatedEntities, tar
|
|
|
11334
10966
|
/** @hidden @internal */
|
|
11335
10967
|
// Represents entities not yet attached to navigationProperties.
|
|
11336
10968
|
class UnattachedChildrenMap {
|
|
11337
|
-
|
|
11338
|
-
|
|
10969
|
+
constructor() {
|
|
10970
|
+
// key is EntityKey.toString(), value is array of { navigationProperty, children }
|
|
10971
|
+
this.map = {};
|
|
10972
|
+
}
|
|
11339
10973
|
addChild(parentEntityKey, navigationProperty, child) {
|
|
11340
10974
|
let tuple = this.getTuple(parentEntityKey, navigationProperty);
|
|
11341
10975
|
if (!tuple) {
|
|
@@ -11390,100 +11024,6 @@ class UnattachedChildrenMap {
|
|
|
11390
11024
|
Instances of the EntityManager contain and manage collections of entities, either retrieved from a backend datastore or created on the client.
|
|
11391
11025
|
**/
|
|
11392
11026
|
class EntityManager {
|
|
11393
|
-
/** @hidden @internal */
|
|
11394
|
-
_$typeName; // actually defined on prototype
|
|
11395
|
-
/** The service name associated with this EntityManager. __Read Only__ **/
|
|
11396
|
-
serviceName;
|
|
11397
|
-
/** The DataService associated with this EntityManager. __Read Only__ **/
|
|
11398
|
-
dataService;
|
|
11399
|
-
/** The [[QueryOptions]] associated with this EntityManager. __Read Only__ **/
|
|
11400
|
-
queryOptions;
|
|
11401
|
-
/** The [[SaveOptions]] associated with this EntityManager. __Read Only__ **/
|
|
11402
|
-
saveOptions;
|
|
11403
|
-
/** The [[ValidationOptions]] associated with this EntityManager. __Read Only__ **/
|
|
11404
|
-
validationOptions;
|
|
11405
|
-
/** The [[KeyGenerator]] associated with this EntityManager. __Read Only__ **/
|
|
11406
|
-
keyGenerator;
|
|
11407
|
-
/** The [[KeyGenerator]] constructor associated with this EntityManager. __Read Only__ **/
|
|
11408
|
-
keyGeneratorCtor; // TODO: review this
|
|
11409
|
-
/** The [[MetadataStore]] associated with this EntityManager. __Read Only__ **/
|
|
11410
|
-
metadataStore;
|
|
11411
|
-
isLoading;
|
|
11412
|
-
isRejectingChanges;
|
|
11413
|
-
// events
|
|
11414
|
-
/**
|
|
11415
|
-
A [[BreezeEvent]] that fires whenever a change to any entity in this EntityManager occurs. __Read Only__
|
|
11416
|
-
|
|
11417
|
-
@eventArgs -
|
|
11418
|
-
- entityAction - The [[EntityAction]] that occured.
|
|
11419
|
-
- entity - The entity that changed. If this is null, then all entities in the entityManager were affected.
|
|
11420
|
-
- args - Additional information about this event. This will differ based on the entityAction.
|
|
11421
|
-
|
|
11422
|
-
> let em = new EntityManager( {serviceName: "breeze/NorthwindIBModel" });
|
|
11423
|
-
> em.entityChanged.subscribe(function(changeArgs) {
|
|
11424
|
-
> // This code will be executed any time any entity within the entityManager
|
|
11425
|
-
> // is added, modified, deleted or detached for any reason.
|
|
11426
|
-
> let action = changeArgs.entityAction;
|
|
11427
|
-
> let entity = changeArgs.entity;
|
|
11428
|
-
> // .. do something to this entity when it is changed.
|
|
11429
|
-
> });
|
|
11430
|
-
> });
|
|
11431
|
-
@event
|
|
11432
|
-
**/
|
|
11433
|
-
entityChanged;
|
|
11434
|
-
/**
|
|
11435
|
-
An [[BreezeEvent]] that fires whenever validationErrors change for any entity in this EntityManager. __Read Only__
|
|
11436
|
-
@eventArgs -
|
|
11437
|
-
- entity - The entity on which the validation errors have been added or removed.
|
|
11438
|
-
- added - An array containing any newly added [[ValidationError]]s
|
|
11439
|
-
- removed - An array containing any newly removed [[ValidationError]]s. This is those errors that have been 'fixed'
|
|
11440
|
-
|
|
11441
|
-
> let em = new EntityManager( {serviceName: "breeze/NorthwindIBModel" });
|
|
11442
|
-
> em.validationErrorsChanged.subscribe(function(changeArgs) {
|
|
11443
|
-
> // This code will be executed any time any entity within the entityManager experiences a change to its validationErrors collection.
|
|
11444
|
-
> function (validationChangeArgs) {
|
|
11445
|
-
> let entity == validationChangeArgs.entity;
|
|
11446
|
-
> let errorsAdded = validationChangeArgs.added;
|
|
11447
|
-
> let errorsCleared = validationChangeArgs.removed;
|
|
11448
|
-
> // ... do something interesting with the order.
|
|
11449
|
-
> });
|
|
11450
|
-
> });
|
|
11451
|
-
> });
|
|
11452
|
-
@event
|
|
11453
|
-
**/
|
|
11454
|
-
validationErrorsChanged;
|
|
11455
|
-
/**
|
|
11456
|
-
A [[BreezeEvent]] that fires whenever an EntityManager transitions to or from having changes. __Read Only__
|
|
11457
|
-
@eventArgs -
|
|
11458
|
-
- entityManager - The EntityManager whose 'hasChanges' status has changed.
|
|
11459
|
-
- hasChanges - Whether or not this EntityManager has changes.
|
|
11460
|
-
|
|
11461
|
-
> let em = new EntityManager( {serviceName: "breeze/NorthwindIBModel" });
|
|
11462
|
-
> em.hasChangesChanged.subscribe(function(args) {
|
|
11463
|
-
> let hasChangesChanged = args.hasChanges;
|
|
11464
|
-
> let entityManager = args.entityManager;
|
|
11465
|
-
> });
|
|
11466
|
-
> });
|
|
11467
|
-
@event
|
|
11468
|
-
**/
|
|
11469
|
-
hasChangesChanged;
|
|
11470
|
-
/** @hidden @internal */
|
|
11471
|
-
_pendingPubs; // TODO: refine later
|
|
11472
|
-
/** @hidden @internal */
|
|
11473
|
-
_hasChangesAction; // TODO refine later
|
|
11474
|
-
/** @hidden @internal */
|
|
11475
|
-
_hasChanges;
|
|
11476
|
-
/** @hidden @internal */
|
|
11477
|
-
_entityGroupMap;
|
|
11478
|
-
/** @hidden @internal */
|
|
11479
|
-
_unattachedChildrenMap;
|
|
11480
|
-
/** @hidden @internal */
|
|
11481
|
-
_inKeyFixup;
|
|
11482
|
-
helper = {
|
|
11483
|
-
unwrapInstance: unwrapInstance,
|
|
11484
|
-
unwrapOriginalValues: unwrapOriginalValues,
|
|
11485
|
-
unwrapChangedValues: unwrapChangedValues
|
|
11486
|
-
};
|
|
11487
11027
|
/**
|
|
11488
11028
|
EntityManager constructor.
|
|
11489
11029
|
|
|
@@ -11522,6 +11062,11 @@ class EntityManager {
|
|
|
11522
11062
|
@param emConfig - Configuration settings or a service name.
|
|
11523
11063
|
**/
|
|
11524
11064
|
constructor(emConfig) {
|
|
11065
|
+
this.helper = {
|
|
11066
|
+
unwrapInstance: unwrapInstance,
|
|
11067
|
+
unwrapOriginalValues: unwrapOriginalValues,
|
|
11068
|
+
unwrapChangedValues: unwrapChangedValues
|
|
11069
|
+
};
|
|
11525
11070
|
if (arguments.length > 1) {
|
|
11526
11071
|
throw new Error("The EntityManager ctor has a single optional argument that is either a 'serviceName' or a configuration object.");
|
|
11527
11072
|
}
|
|
@@ -13551,10 +13096,12 @@ function getSerializerFn(stype) {
|
|
|
13551
13096
|
|
|
13552
13097
|
/** Registers adapters used by Breeze */
|
|
13553
13098
|
class InterfaceRegistry {
|
|
13554
|
-
|
|
13555
|
-
|
|
13556
|
-
|
|
13557
|
-
|
|
13099
|
+
constructor() {
|
|
13100
|
+
this.ajax = new InterfaceDef("ajax");
|
|
13101
|
+
this.modelLibrary = new InterfaceDef("modelLibrary");
|
|
13102
|
+
this.dataService = new InterfaceDef("dataService");
|
|
13103
|
+
this.uriBuilder = new InterfaceDef("uriBuilder");
|
|
13104
|
+
}
|
|
13558
13105
|
}
|
|
13559
13106
|
config.interfaceRegistry = new InterfaceRegistry();
|
|
13560
13107
|
config._interfaceRegistry = config.interfaceRegistry;
|
|
@@ -13585,118 +13132,119 @@ config.initializeAdapterInstances = function (irConfig) {
|
|
|
13585
13132
|
return core.objectMap(config, this.initializeAdapterInstance);
|
|
13586
13133
|
};
|
|
13587
13134
|
|
|
13588
|
-
|
|
13589
|
-
|
|
13590
|
-
|
|
13591
|
-
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
|
|
13597
|
-
|
|
13598
|
-
|
|
13599
|
-
|
|
13600
|
-
|
|
13601
|
-
|
|
13602
|
-
|
|
13603
|
-
|
|
13604
|
-
|
|
13605
|
-
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
if (objPrototype.push) {
|
|
13618
|
-
result = objPrototype.push.apply(this, goodAdds);
|
|
13619
|
-
}
|
|
13620
|
-
else {
|
|
13621
|
-
result = Array.prototype.push.apply(this, goodAdds);
|
|
13622
|
-
}
|
|
13623
|
-
processAdds$2(this, goodAdds);
|
|
13624
|
-
return result;
|
|
13625
|
-
},
|
|
13626
|
-
unshift: function (...args) {
|
|
13627
|
-
let goodAdds = this._getGoodAdds(args);
|
|
13628
|
-
if (!goodAdds.length) {
|
|
13629
|
-
return this.length;
|
|
13630
|
-
}
|
|
13631
|
-
this._beforeChange();
|
|
13632
|
-
let result;
|
|
13633
|
-
let objPrototype = Object.getPrototypeOf(this);
|
|
13634
|
-
if (objPrototype.unshift) {
|
|
13635
|
-
result = objPrototype.unshift.apply(this, goodAdds);
|
|
13636
|
-
}
|
|
13637
|
-
else {
|
|
13638
|
-
result = Array.prototype.unshift.apply(this, goodAdds);
|
|
13639
|
-
}
|
|
13640
|
-
processAdds$2(this, goodAdds);
|
|
13641
|
-
return result;
|
|
13642
|
-
},
|
|
13643
|
-
pop: function () {
|
|
13644
|
-
this._beforeChange();
|
|
13645
|
-
let result;
|
|
13646
|
-
let objPrototype = Object.getPrototypeOf(this);
|
|
13647
|
-
if (objPrototype.pop) {
|
|
13648
|
-
result = objPrototype.pop.apply(this);
|
|
13649
|
-
}
|
|
13650
|
-
else {
|
|
13651
|
-
result = Array.prototype.pop.apply(this);
|
|
13652
|
-
}
|
|
13653
|
-
processRemoves$2(this, [result]);
|
|
13654
|
-
return result;
|
|
13655
|
-
},
|
|
13656
|
-
shift: function () {
|
|
13657
|
-
this._beforeChange();
|
|
13658
|
-
let result;
|
|
13659
|
-
let objPrototype = Object.getPrototypeOf(this);
|
|
13660
|
-
if (objPrototype.shift) {
|
|
13661
|
-
result = objPrototype.shift.apply(this);
|
|
13662
|
-
}
|
|
13663
|
-
else {
|
|
13664
|
-
result = Array.prototype.shift.apply(this);
|
|
13665
|
-
}
|
|
13666
|
-
processRemoves$2(this, [result]);
|
|
13667
|
-
return result;
|
|
13668
|
-
},
|
|
13669
|
-
splice: function (...args) {
|
|
13670
|
-
let goodAdds = this._getGoodAdds(core.arraySlice(args, 2));
|
|
13671
|
-
let newArgs = core.arraySlice(args, 0, 2).concat(goodAdds);
|
|
13672
|
-
this._beforeChange();
|
|
13673
|
-
let result;
|
|
13674
|
-
let objPrototype = Object.getPrototypeOf(this);
|
|
13675
|
-
if (objPrototype.splice) {
|
|
13676
|
-
result = objPrototype.splice.apply(this, newArgs);
|
|
13677
|
-
}
|
|
13678
|
-
else {
|
|
13679
|
-
result = Array.prototype.splice.apply(this, newArgs);
|
|
13680
|
-
}
|
|
13681
|
-
processRemoves$2(this, result);
|
|
13682
|
-
if (goodAdds.length) {
|
|
13683
|
-
processAdds$2(this, goodAdds);
|
|
13684
|
-
}
|
|
13685
|
-
return result;
|
|
13686
|
-
},
|
|
13687
|
-
getEntityAspect: function () {
|
|
13688
|
-
return this.parent.entityAspect || this.parent.complexAspect.getEntityAspect();
|
|
13689
|
-
},
|
|
13690
|
-
_getEventParent: function () {
|
|
13691
|
-
return this.getEntityAspect();
|
|
13692
|
-
},
|
|
13693
|
-
_getPendingPubs: function () {
|
|
13694
|
-
let em = this.getEntityAspect().entityManager;
|
|
13695
|
-
return em && em._pendingPubs;
|
|
13696
|
-
},
|
|
13697
|
-
_beforeChange: function () {
|
|
13698
|
-
// default is to do nothing
|
|
13135
|
+
const ɵ0$3 = function (...args) {
|
|
13136
|
+
if (this._inProgress) {
|
|
13137
|
+
return -1;
|
|
13138
|
+
}
|
|
13139
|
+
let goodAdds = this._getGoodAdds(args);
|
|
13140
|
+
if (!goodAdds.length) {
|
|
13141
|
+
return this.length;
|
|
13142
|
+
}
|
|
13143
|
+
this._beforeChange();
|
|
13144
|
+
let result;
|
|
13145
|
+
let objPrototype = Object.getPrototypeOf(this);
|
|
13146
|
+
if (objPrototype.push) {
|
|
13147
|
+
result = objPrototype.push.apply(this, goodAdds);
|
|
13148
|
+
}
|
|
13149
|
+
else {
|
|
13150
|
+
result = Array.prototype.push.apply(this, goodAdds);
|
|
13151
|
+
}
|
|
13152
|
+
processAdds(this, goodAdds);
|
|
13153
|
+
return result;
|
|
13154
|
+
}, ɵ1$2 = function (...args) {
|
|
13155
|
+
if (this._inProgress) {
|
|
13156
|
+
return -1;
|
|
13157
|
+
}
|
|
13158
|
+
let goodAdds = args;
|
|
13159
|
+
this._beforeChange();
|
|
13160
|
+
let result;
|
|
13161
|
+
let objPrototype = Object.getPrototypeOf(this);
|
|
13162
|
+
if (objPrototype.push) {
|
|
13163
|
+
result = objPrototype.push.apply(this, goodAdds);
|
|
13699
13164
|
}
|
|
13165
|
+
else {
|
|
13166
|
+
result = Array.prototype.push.apply(this, goodAdds);
|
|
13167
|
+
}
|
|
13168
|
+
processAdds(this, goodAdds);
|
|
13169
|
+
return result;
|
|
13170
|
+
}, ɵ2$1 = function (...args) {
|
|
13171
|
+
let goodAdds = this._getGoodAdds(args);
|
|
13172
|
+
if (!goodAdds.length) {
|
|
13173
|
+
return this.length;
|
|
13174
|
+
}
|
|
13175
|
+
this._beforeChange();
|
|
13176
|
+
let result;
|
|
13177
|
+
let objPrototype = Object.getPrototypeOf(this);
|
|
13178
|
+
if (objPrototype.unshift) {
|
|
13179
|
+
result = objPrototype.unshift.apply(this, goodAdds);
|
|
13180
|
+
}
|
|
13181
|
+
else {
|
|
13182
|
+
result = Array.prototype.unshift.apply(this, goodAdds);
|
|
13183
|
+
}
|
|
13184
|
+
processAdds(this, goodAdds);
|
|
13185
|
+
return result;
|
|
13186
|
+
}, ɵ3$1 = function () {
|
|
13187
|
+
this._beforeChange();
|
|
13188
|
+
let result;
|
|
13189
|
+
let objPrototype = Object.getPrototypeOf(this);
|
|
13190
|
+
if (objPrototype.pop) {
|
|
13191
|
+
result = objPrototype.pop.apply(this);
|
|
13192
|
+
}
|
|
13193
|
+
else {
|
|
13194
|
+
result = Array.prototype.pop.apply(this);
|
|
13195
|
+
}
|
|
13196
|
+
processRemoves(this, [result]);
|
|
13197
|
+
return result;
|
|
13198
|
+
}, ɵ4$1 = function () {
|
|
13199
|
+
this._beforeChange();
|
|
13200
|
+
let result;
|
|
13201
|
+
let objPrototype = Object.getPrototypeOf(this);
|
|
13202
|
+
if (objPrototype.shift) {
|
|
13203
|
+
result = objPrototype.shift.apply(this);
|
|
13204
|
+
}
|
|
13205
|
+
else {
|
|
13206
|
+
result = Array.prototype.shift.apply(this);
|
|
13207
|
+
}
|
|
13208
|
+
processRemoves(this, [result]);
|
|
13209
|
+
return result;
|
|
13210
|
+
}, ɵ5$1 = function (...args) {
|
|
13211
|
+
let goodAdds = this._getGoodAdds(core.arraySlice(args, 2));
|
|
13212
|
+
let newArgs = core.arraySlice(args, 0, 2).concat(goodAdds);
|
|
13213
|
+
this._beforeChange();
|
|
13214
|
+
let result;
|
|
13215
|
+
let objPrototype = Object.getPrototypeOf(this);
|
|
13216
|
+
if (objPrototype.splice) {
|
|
13217
|
+
result = objPrototype.splice.apply(this, newArgs);
|
|
13218
|
+
}
|
|
13219
|
+
else {
|
|
13220
|
+
result = Array.prototype.splice.apply(this, newArgs);
|
|
13221
|
+
}
|
|
13222
|
+
processRemoves(this, result);
|
|
13223
|
+
if (goodAdds.length) {
|
|
13224
|
+
processAdds(this, goodAdds);
|
|
13225
|
+
}
|
|
13226
|
+
return result;
|
|
13227
|
+
}, ɵ6$1 = function () {
|
|
13228
|
+
return this.parent.entityAspect || this.parent.complexAspect.getEntityAspect();
|
|
13229
|
+
}, ɵ7$1 = function () {
|
|
13230
|
+
return this.getEntityAspect();
|
|
13231
|
+
}, ɵ8$1 = function () {
|
|
13232
|
+
let em = this.getEntityAspect().entityManager;
|
|
13233
|
+
return em && em._pendingPubs;
|
|
13234
|
+
}, ɵ9$1 = function () {
|
|
13235
|
+
// default is to do nothing
|
|
13236
|
+
};
|
|
13237
|
+
let mixin = {
|
|
13238
|
+
push: ɵ0$3,
|
|
13239
|
+
_push: ɵ1$2,
|
|
13240
|
+
unshift: ɵ2$1,
|
|
13241
|
+
pop: ɵ3$1,
|
|
13242
|
+
shift: ɵ4$1,
|
|
13243
|
+
splice: ɵ5$1,
|
|
13244
|
+
getEntityAspect: ɵ6$1,
|
|
13245
|
+
_getEventParent: ɵ7$1,
|
|
13246
|
+
_getPendingPubs: ɵ8$1,
|
|
13247
|
+
_beforeChange: ɵ9$1
|
|
13700
13248
|
};
|
|
13701
13249
|
function updateEntityState(obsArray) {
|
|
13702
13250
|
let entityAspect = obsArray.getEntityAspect();
|
|
@@ -13729,14 +13277,14 @@ function initializeParent(obsArray, parent, parentProperty) {
|
|
|
13729
13277
|
obsArray.parent = parent;
|
|
13730
13278
|
obsArray.parentProperty = parentProperty;
|
|
13731
13279
|
}
|
|
13732
|
-
function processAdds
|
|
13280
|
+
function processAdds(obsArray, adds) {
|
|
13733
13281
|
obsArray._processAdds(adds);
|
|
13734
13282
|
// this is referencing the name of the method on the complexArray not the name of the event
|
|
13735
13283
|
//var args = { added: adds };
|
|
13736
13284
|
//args[obsArray._typeName] = obsArray;
|
|
13737
13285
|
publish(obsArray, "arrayChanged", { array: obsArray, added: adds });
|
|
13738
13286
|
}
|
|
13739
|
-
function processRemoves
|
|
13287
|
+
function processRemoves(obsArray, removes) {
|
|
13740
13288
|
obsArray._processRemoves(removes);
|
|
13741
13289
|
// this is referencing the name of the method on the array not the name of the event
|
|
13742
13290
|
publish(obsArray, "arrayChanged", { array: obsArray, removed: removes });
|
|
@@ -13767,6 +13315,23 @@ const observableArray = {
|
|
|
13767
13315
|
initializeParent: initializeParent
|
|
13768
13316
|
};
|
|
13769
13317
|
|
|
13318
|
+
const ɵ0$4 = function (callback, errorCallback) {
|
|
13319
|
+
let parent = this.parentEntity;
|
|
13320
|
+
let query = EntityQuery.fromEntityNavigation(this.parentEntity, this.navigationProperty);
|
|
13321
|
+
let em = parent.entityAspect.entityManager;
|
|
13322
|
+
return em.executeQuery(query, callback, errorCallback);
|
|
13323
|
+
}, ɵ1$3 = function () {
|
|
13324
|
+
return this.parentEntity.entityAspect;
|
|
13325
|
+
}, ɵ2$2 = function () {
|
|
13326
|
+
let em = this.parentEntity.entityAspect.entityManager;
|
|
13327
|
+
return em && em._pendingPubs;
|
|
13328
|
+
}, ɵ3$2 = function (adds) {
|
|
13329
|
+
return getGoodAdds(this, adds);
|
|
13330
|
+
}, ɵ4$2 = function (adds) {
|
|
13331
|
+
processAdds$1(this, adds);
|
|
13332
|
+
}, ɵ5$2 = function (removes) {
|
|
13333
|
+
processRemoves$1(this, removes);
|
|
13334
|
+
};
|
|
13770
13335
|
let relationArrayMixin = {
|
|
13771
13336
|
/**
|
|
13772
13337
|
Relation arrays are not actually classes, they are objects that mimic arrays. A relation array is collection of
|
|
@@ -13803,31 +13368,15 @@ let relationArrayMixin = {
|
|
|
13803
13368
|
@param [errorCallback] {Function}
|
|
13804
13369
|
@return {Promise}
|
|
13805
13370
|
**/
|
|
13806
|
-
load:
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
let em = parent.entityAspect.entityManager;
|
|
13810
|
-
return em.executeQuery(query, callback, errorCallback);
|
|
13811
|
-
},
|
|
13812
|
-
_getEventParent: function () {
|
|
13813
|
-
return this.parentEntity.entityAspect;
|
|
13814
|
-
},
|
|
13815
|
-
_getPendingPubs: function () {
|
|
13816
|
-
let em = this.parentEntity.entityAspect.entityManager;
|
|
13817
|
-
return em && em._pendingPubs;
|
|
13818
|
-
},
|
|
13371
|
+
load: ɵ0$4,
|
|
13372
|
+
_getEventParent: ɵ1$3,
|
|
13373
|
+
_getPendingPubs: ɵ2$2,
|
|
13819
13374
|
// virtual impls
|
|
13820
|
-
_getGoodAdds:
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
_processAdds: function (adds) {
|
|
13824
|
-
processAdds$1(this, adds);
|
|
13825
|
-
},
|
|
13826
|
-
_processRemoves: function (removes) {
|
|
13827
|
-
processRemoves$1(this, removes);
|
|
13828
|
-
}
|
|
13375
|
+
_getGoodAdds: ɵ3$2,
|
|
13376
|
+
_processAdds: ɵ4$2,
|
|
13377
|
+
_processRemoves: ɵ5$2
|
|
13829
13378
|
};
|
|
13830
|
-
function getGoodAdds
|
|
13379
|
+
function getGoodAdds(relationArray, adds) {
|
|
13831
13380
|
let goodAdds = checkForDups(relationArray, adds);
|
|
13832
13381
|
if (!goodAdds.length) {
|
|
13833
13382
|
return goodAdds;
|
|
@@ -13935,6 +13484,28 @@ function makeRelationArray(arr, parentEntity, navigationProperty) {
|
|
|
13935
13484
|
return core.extend(arrX, relationArrayMixin);
|
|
13936
13485
|
}
|
|
13937
13486
|
|
|
13487
|
+
const ɵ0$5 = function (adds) {
|
|
13488
|
+
return getGoodAdds$1(this, adds);
|
|
13489
|
+
}, ɵ1$4 = function () {
|
|
13490
|
+
observableArray.updateEntityState(this);
|
|
13491
|
+
}, ɵ2$3 = function (adds) {
|
|
13492
|
+
processAdds$2(this, adds);
|
|
13493
|
+
}, ɵ3$3 = function (removes) {
|
|
13494
|
+
processRemoves$2(this, removes);
|
|
13495
|
+
}, ɵ4$3 = function () {
|
|
13496
|
+
if (!this._origValues)
|
|
13497
|
+
return;
|
|
13498
|
+
let that = this;
|
|
13499
|
+
this.forEach(function (co) {
|
|
13500
|
+
clearAspect(co, that);
|
|
13501
|
+
});
|
|
13502
|
+
this.length = 0;
|
|
13503
|
+
this._origValues.forEach(function (co) {
|
|
13504
|
+
that.push(co);
|
|
13505
|
+
});
|
|
13506
|
+
}, ɵ5$3 = function () {
|
|
13507
|
+
this._origValues = null;
|
|
13508
|
+
};
|
|
13938
13509
|
let complexArrayMixin = {
|
|
13939
13510
|
// complexArray will have the following props
|
|
13940
13511
|
// parent
|
|
@@ -13969,43 +13540,22 @@ let complexArrayMixin = {
|
|
|
13969
13540
|
@readOnly
|
|
13970
13541
|
**/
|
|
13971
13542
|
// virtual impls
|
|
13972
|
-
_getGoodAdds:
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
_processAdds: function (adds) {
|
|
13979
|
-
processAdds(this, adds);
|
|
13980
|
-
},
|
|
13981
|
-
_processRemoves: function (removes) {
|
|
13982
|
-
processRemoves(this, removes);
|
|
13983
|
-
},
|
|
13984
|
-
_rejectChanges: function () {
|
|
13985
|
-
if (!this._origValues)
|
|
13986
|
-
return;
|
|
13987
|
-
let that = this;
|
|
13988
|
-
this.forEach(function (co) {
|
|
13989
|
-
clearAspect(co, that);
|
|
13990
|
-
});
|
|
13991
|
-
this.length = 0;
|
|
13992
|
-
this._origValues.forEach(function (co) {
|
|
13993
|
-
that.push(co);
|
|
13994
|
-
});
|
|
13995
|
-
},
|
|
13996
|
-
_acceptChanges: function () {
|
|
13997
|
-
this._origValues = null;
|
|
13998
|
-
}
|
|
13543
|
+
_getGoodAdds: ɵ0$5,
|
|
13544
|
+
_beforeChange: ɵ1$4,
|
|
13545
|
+
_processAdds: ɵ2$3,
|
|
13546
|
+
_processRemoves: ɵ3$3,
|
|
13547
|
+
_rejectChanges: ɵ4$3,
|
|
13548
|
+
_acceptChanges: ɵ5$3
|
|
13999
13549
|
};
|
|
14000
13550
|
// local functions
|
|
14001
|
-
function getGoodAdds(complexArray, adds) {
|
|
13551
|
+
function getGoodAdds$1(complexArray, adds) {
|
|
14002
13552
|
// remove any that are already added here
|
|
14003
13553
|
return adds.filter(function (a) {
|
|
14004
13554
|
// return a.parent !== complexArray.parent; // TODO: check if this is actually a bug in original breezejs ???
|
|
14005
13555
|
return a.complexAspect == null || a.complexAspect.parent !== complexArray.parent;
|
|
14006
13556
|
});
|
|
14007
13557
|
}
|
|
14008
|
-
function processAdds(complexArray, adds) {
|
|
13558
|
+
function processAdds$2(complexArray, adds) {
|
|
14009
13559
|
adds.forEach(function (a) {
|
|
14010
13560
|
// if (a.parent != null) { // TODO: check if this is actually a bug in original breezejs ???
|
|
14011
13561
|
if (a.complexAspect && a.complexAspect.parent != null) {
|
|
@@ -14014,7 +13564,7 @@ function processAdds(complexArray, adds) {
|
|
|
14014
13564
|
setAspect(a, complexArray);
|
|
14015
13565
|
});
|
|
14016
13566
|
}
|
|
14017
|
-
function processRemoves(complexArray, removes) {
|
|
13567
|
+
function processRemoves$2(complexArray, removes) {
|
|
14018
13568
|
removes.forEach(function (a) {
|
|
14019
13569
|
clearAspect(a, complexArray);
|
|
14020
13570
|
});
|
|
@@ -14049,6 +13599,28 @@ function makeComplexArray(arr, parent, parentProperty) {
|
|
|
14049
13599
|
return core.extend(arrX, complexArrayMixin);
|
|
14050
13600
|
}
|
|
14051
13601
|
|
|
13602
|
+
const ɵ0$6 = function (adds) {
|
|
13603
|
+
return adds;
|
|
13604
|
+
}, ɵ1$5 = function () {
|
|
13605
|
+
let entityAspect = this.getEntityAspect();
|
|
13606
|
+
if (entityAspect.entityState.isUnchanged()) {
|
|
13607
|
+
entityAspect.setModified();
|
|
13608
|
+
}
|
|
13609
|
+
if (entityAspect.entityState.isModified() && !this._origValues) {
|
|
13610
|
+
this._origValues = this.slice(0);
|
|
13611
|
+
}
|
|
13612
|
+
}, ɵ2$4 = function (adds) {
|
|
13613
|
+
// nothing needed
|
|
13614
|
+
}, ɵ3$4 = function (removes) {
|
|
13615
|
+
// nothing needed;
|
|
13616
|
+
}, ɵ4$4 = function () {
|
|
13617
|
+
if (!this._origValues)
|
|
13618
|
+
return;
|
|
13619
|
+
this.length = 0;
|
|
13620
|
+
Array.prototype.push.apply(this, this._origValues);
|
|
13621
|
+
}, ɵ5$4 = function () {
|
|
13622
|
+
this._origValues = null;
|
|
13623
|
+
};
|
|
14052
13624
|
// TODO: mixin impl is not very typesafe
|
|
14053
13625
|
// Not needed
|
|
14054
13626
|
// interface IPrimitiveArray extends IObservableArray {
|
|
@@ -14090,33 +13662,12 @@ let primitiveArrayMixin = {
|
|
|
14090
13662
|
@readOnly
|
|
14091
13663
|
**/
|
|
14092
13664
|
// virtual impls
|
|
14093
|
-
_getGoodAdds:
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
entityAspect.setModified();
|
|
14100
|
-
}
|
|
14101
|
-
if (entityAspect.entityState.isModified() && !this._origValues) {
|
|
14102
|
-
this._origValues = this.slice(0);
|
|
14103
|
-
}
|
|
14104
|
-
},
|
|
14105
|
-
_processAdds: function (adds) {
|
|
14106
|
-
// nothing needed
|
|
14107
|
-
},
|
|
14108
|
-
_processRemoves: function (removes) {
|
|
14109
|
-
// nothing needed;
|
|
14110
|
-
},
|
|
14111
|
-
_rejectChanges: function () {
|
|
14112
|
-
if (!this._origValues)
|
|
14113
|
-
return;
|
|
14114
|
-
this.length = 0;
|
|
14115
|
-
Array.prototype.push.apply(this, this._origValues);
|
|
14116
|
-
},
|
|
14117
|
-
_acceptChanges: function () {
|
|
14118
|
-
this._origValues = null;
|
|
14119
|
-
}
|
|
13665
|
+
_getGoodAdds: ɵ0$6,
|
|
13666
|
+
_beforeChange: ɵ1$5,
|
|
13667
|
+
_processAdds: ɵ2$4,
|
|
13668
|
+
_processRemoves: ɵ3$4,
|
|
13669
|
+
_rejectChanges: ɵ4$4,
|
|
13670
|
+
_acceptChanges: ɵ5$4
|
|
14120
13671
|
};
|
|
14121
13672
|
// local functions
|
|
14122
13673
|
/** For use by breeze plugin authors only. The class is for use in building a [[IModelLibraryAdapter]] implementation.
|
|
@@ -14191,5 +13742,5 @@ if (win) {
|
|
|
14191
13742
|
* Generated bundle index. Do not edit.
|
|
14192
13743
|
*/
|
|
14193
13744
|
|
|
14194
|
-
export { AbstractDataServiceAdapter, AndOrPredicate, AnyAllPredicate, AutoGeneratedKeyType, BinaryPredicate, BreezeConfig, BreezeEnum, BreezeEvent, ComplexAspect, ComplexType, DataProperty, DataService, DataType, EntityAction, EntityAspect, EntityKey, EntityManager, EntityQuery, EntityState, EntityType, ExpandClause, FetchStrategy, FilterQueryOp, FnExpr, InterfaceRegistry, JsonResultsAdapter, KeyGenerator, LitExpr, LocalQueryComparisonOptions, MappingContext, MergeStrategy, MetadataStore, NamingConvention, NavigationProperty, OrderByClause, Predicate, PropExpr, QueryOptions, SaveOptions, SelectClause, UnaryPredicate, ValidationError, ValidationOptions, Validator, assertConfig, assertParam, breeze, config, core, makeComplexArray, makePrimitiveArray, makeRelationArray };
|
|
14195
|
-
//# sourceMappingURL=breeze-client.
|
|
13745
|
+
export { AbstractDataServiceAdapter, AndOrPredicate, AnyAllPredicate, AutoGeneratedKeyType, BinaryPredicate, BreezeConfig, BreezeEnum, BreezeEvent, ComplexAspect, ComplexType, DataProperty, DataService, DataType, EntityAction, EntityAspect, EntityKey, EntityManager, EntityQuery, EntityState, EntityType, ExpandClause, FetchStrategy, FilterQueryOp, FnExpr, InterfaceRegistry, JsonResultsAdapter, KeyGenerator, LitExpr, LocalQueryComparisonOptions, MappingContext, MergeStrategy, MetadataStore, NamingConvention, NavigationProperty, OrderByClause, Predicate, PropExpr, QueryOptions, SaveOptions, SelectClause, UnaryPredicate, ValidationError, ValidationOptions, Validator, assertConfig, assertParam, breeze, config, core, makeComplexArray, makePrimitiveArray, makeRelationArray, PredicateExpression as ɵa, Param as ɵb, qualifyTypeName as ɵc, BooleanQueryOp as ɵd };
|
|
13746
|
+
//# sourceMappingURL=breeze-client.js.map
|