breeze-client 2.2.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +83 -63
- package/adapters/abstract-data-service-adapter.d.ts +120 -0
- package/adapters/abstract-data-service-adapter.js +395 -0
- package/adapters/abstract-data-service-adapter.js.map +1 -0
- package/adapters/adapter-ajax-fetch.d.ts +12 -0
- package/adapters/adapter-ajax-fetch.js +13 -0
- package/adapters/adapter-ajax-fetch.js.map +1 -0
- package/{adapter-ajax-post → adapters}/adapter-ajax-post.d.ts +40 -36
- package/{fesm2022/breeze-client-adapter-ajax-post.mjs → adapters/adapter-ajax-post.js} +80 -82
- package/adapters/adapter-ajax-post.js.map +1 -0
- package/{adapter-ajax-fetch → adapters}/adapter-core.d.ts +4 -4
- package/{fesm2022/breeze-client-adapter-uri-builder-json.mjs → adapters/adapter-core.js} +48 -91
- package/adapters/adapter-core.js.map +1 -0
- package/adapters/adapter-data-service-webapi.d.ts +9 -0
- package/{fesm2022/breeze-client-adapter-data-service-webapi.mjs → adapters/adapter-data-service-webapi.js} +105 -107
- package/adapters/adapter-data-service-webapi.js.map +1 -0
- package/adapters/adapter-model-library-backing-store.d.ts +32 -0
- package/adapters/adapter-model-library-backing-store.js +321 -0
- package/adapters/adapter-model-library-backing-store.js.map +1 -0
- package/adapters/adapter-uri-builder-json.d.ts +11 -0
- package/adapters/adapter-uri-builder-json.js +40 -0
- package/adapters/adapter-uri-builder-json.js.map +1 -0
- package/adapters/http.d.ts +52 -0
- package/adapters/http.js +202 -0
- package/adapters/http.js.map +1 -0
- package/angular/adapter-angular-httpclient.d.ts +21 -0
- package/angular/adapter-angular-httpclient.js +70 -0
- package/angular/adapter-angular-httpclient.js.map +1 -0
- package/breeze.d.ts +215 -0
- package/breeze.js +141 -0
- package/breeze.js.map +1 -0
- package/config/config.d.ts +212 -0
- package/config/config.js +392 -0
- package/config/config.js.map +1 -0
- package/config/configure.d.ts +66 -0
- package/config/configure.js +46 -0
- package/config/configure.js.map +1 -0
- package/config/default-adapters.d.ts +1 -0
- package/config/default-adapters.js +40 -0
- package/config/default-adapters.js.map +1 -0
- package/config/interface-registry.d.ts +191 -0
- package/config/interface-registry.js +5 -0
- package/config/interface-registry.js.map +1 -0
- package/{src → core}/assert-param.d.ts +52 -60
- package/core/assert-param.js +390 -0
- package/core/assert-param.js.map +1 -0
- package/core/core.d.ts +285 -0
- package/core/core.js +772 -0
- package/core/core.js.map +1 -0
- package/core/enum.d.ts +116 -0
- package/core/enum.js +167 -0
- package/core/enum.js.map +1 -0
- package/core/event.d.ts +169 -0
- package/core/event.js +338 -0
- package/core/event.js.map +1 -0
- package/entity/array.d.ts +3 -0
- package/entity/array.js +4 -0
- package/entity/array.js.map +1 -0
- package/entity/complex-array.d.ts +17 -0
- package/entity/complex-array.js +104 -0
- package/entity/complex-array.js.map +1 -0
- package/entity/default-property-interceptor.d.ts +1 -0
- package/entity/default-property-interceptor.js +496 -0
- package/entity/default-property-interceptor.js.map +1 -0
- package/{src → entity}/entity-action.d.ts +36 -42
- package/entity/entity-action.js +45 -0
- package/entity/entity-action.js.map +1 -0
- package/entity/entity-aspect.d.ts +457 -0
- package/entity/entity-aspect.js +1262 -0
- package/entity/entity-aspect.js.map +1 -0
- package/entity/entity-base.d.ts +55 -0
- package/entity/entity-base.js +41 -0
- package/entity/entity-base.js.map +1 -0
- package/entity/entity-group.d.ts +1 -0
- package/entity/entity-group.js +224 -0
- package/entity/entity-group.js.map +1 -0
- package/entity/entity-key.d.ts +95 -0
- package/entity/entity-key.js +189 -0
- package/entity/entity-key.js.map +1 -0
- package/{src → entity}/entity-state.d.ts +112 -84
- package/entity/entity-state.js +135 -0
- package/entity/entity-state.js.map +1 -0
- package/entity/key-generator.d.ts +57 -0
- package/entity/key-generator.js +155 -0
- package/entity/key-generator.js.map +1 -0
- package/entity/observable-array.d.ts +25 -0
- package/entity/observable-array.js +230 -0
- package/entity/observable-array.js.map +1 -0
- package/entity/primitive-array.d.ts +12 -0
- package/entity/primitive-array.js +71 -0
- package/entity/primitive-array.js.map +1 -0
- package/entity/relation-array.d.ts +24 -0
- package/entity/relation-array.js +176 -0
- package/entity/relation-array.js.map +1 -0
- package/entity/unattached-children-map.d.ts +1 -0
- package/entity/unattached-children-map.js +105 -0
- package/entity/unattached-children-map.js.map +1 -0
- package/generate-entity-classes.js +1176 -0
- package/manager/entity-manager.d.ts +801 -0
- package/manager/entity-manager.js +2395 -0
- package/manager/entity-manager.js.map +1 -0
- package/{src → manager}/save-options.d.ts +48 -42
- package/manager/save-options.js +51 -0
- package/manager/save-options.js.map +1 -0
- package/{src → metadata}/data-service.d.ts +229 -184
- package/metadata/data-service.js +246 -0
- package/metadata/data-service.js.map +1 -0
- package/metadata/data-type.d.ts +122 -0
- package/metadata/data-type.js +465 -0
- package/metadata/data-type.js.map +1 -0
- package/metadata/entity-metadata.d.ts +1193 -0
- package/metadata/entity-metadata.js +2502 -0
- package/metadata/entity-metadata.js.map +1 -0
- package/{src → metadata}/local-query-comparison-options.d.ts +65 -59
- package/metadata/local-query-comparison-options.js +69 -0
- package/metadata/local-query-comparison-options.js.map +1 -0
- package/{src → metadata}/naming-convention.d.ts +75 -72
- package/metadata/naming-convention.js +97 -0
- package/metadata/naming-convention.js.map +1 -0
- package/mixins/mixin-get-entity-graph.d.ts +63 -0
- package/{fesm2022/breeze-client-mixin-get-entity-graph.mjs → mixins/mixin-get-entity-graph.js} +331 -253
- package/mixins/mixin-get-entity-graph.js.map +1 -0
- package/mixins/mixin-save-queuing.d.ts +98 -0
- package/{fesm2022/breeze-client-mixin-save-queuing.mjs → mixins/mixin-save-queuing.js} +493 -365
- package/mixins/mixin-save-queuing.js.map +1 -0
- package/package.json +63 -94
- package/query/entity-query.d.ts +521 -0
- package/query/entity-query.js +1149 -0
- package/query/entity-query.js.map +1 -0
- package/{src → query}/mapping-context.d.ts +44 -46
- package/query/mapping-context.js +412 -0
- package/query/mapping-context.js.map +1 -0
- package/query/predicate.d.ts +394 -0
- package/query/predicate.js +1294 -0
- package/query/predicate.js.map +1 -0
- package/query/property-path.d.ts +252 -0
- package/query/property-path.js +2 -0
- package/query/property-path.js.map +1 -0
- package/{src → query}/query-options.d.ts +143 -119
- package/query/query-options.js +180 -0
- package/query/query-options.js.map +1 -0
- package/rxjs/breeze-rxjs.d.ts +72 -0
- package/rxjs/breeze-rxjs.js +117 -0
- package/rxjs/breeze-rxjs.js.map +1 -0
- package/validation/validate.d.ts +583 -0
- package/validation/validate.js +961 -0
- package/validation/validate.js.map +1 -0
- package/{src → validation}/validation-options.d.ts +67 -63
- package/validation/validation-options.js +70 -0
- package/validation/validation-options.js.map +1 -0
- package/adapter-ajax-angularjs/adapter-ajax-angularjs.d.ts +0 -17
- package/adapter-ajax-angularjs/adapter-core.d.ts +0 -4
- package/adapter-ajax-angularjs/index.d.ts +0 -5
- package/adapter-ajax-fetch/adapter-ajax-fetch.d.ts +0 -18
- package/adapter-ajax-fetch/index.d.ts +0 -5
- package/adapter-ajax-httpclient/adapter-ajax-httpclient.d.ts +0 -13
- package/adapter-ajax-httpclient/adapter-core.d.ts +0 -4
- package/adapter-ajax-httpclient/index.d.ts +0 -5
- package/adapter-ajax-jquery/adapter-ajax-jquery.d.ts +0 -15
- package/adapter-ajax-jquery/index.d.ts +0 -5
- package/adapter-ajax-post/index.d.ts +0 -5
- package/adapter-data-service-odata/adapter-core.d.ts +0 -4
- package/adapter-data-service-odata/adapter-data-service-odata.d.ts +0 -17
- package/adapter-data-service-odata/index.d.ts +0 -5
- package/adapter-data-service-webapi/adapter-data-service-webapi.d.ts +0 -15
- package/adapter-data-service-webapi/index.d.ts +0 -5
- package/adapter-model-library-backing-store/adapter-model-library-backing-store.d.ts +0 -10
- package/adapter-model-library-backing-store/index.d.ts +0 -5
- package/adapter-model-library-ko/adapter-model-library-ko.d.ts +0 -10
- package/adapter-model-library-ko/index.d.ts +0 -5
- package/adapter-uri-builder-json/adapter-core.d.ts +0 -4
- package/adapter-uri-builder-json/adapter-uri-builder-json.d.ts +0 -8
- package/adapter-uri-builder-json/index.d.ts +0 -5
- package/adapter-uri-builder-odata/adapter-core.d.ts +0 -4
- package/adapter-uri-builder-odata/adapter-uri-builder-odata.d.ts +0 -8
- package/adapter-uri-builder-odata/index.d.ts +0 -5
- package/esm2022/adapter-ajax-angularjs/adapter-ajax-angularjs.mjs +0 -135
- package/esm2022/adapter-ajax-angularjs/adapter-core.mjs +0 -49
- package/esm2022/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.mjs +0 -5
- package/esm2022/adapter-ajax-fetch/adapter-ajax-fetch.mjs +0 -135
- package/esm2022/adapter-ajax-fetch/adapter-core.mjs +0 -49
- package/esm2022/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.mjs +0 -5
- package/esm2022/adapter-ajax-httpclient/adapter-ajax-httpclient.mjs +0 -139
- package/esm2022/adapter-ajax-httpclient/adapter-core.mjs +0 -49
- package/esm2022/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.mjs +0 -5
- package/esm2022/adapter-ajax-jquery/adapter-ajax-jquery.mjs +0 -107
- package/esm2022/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.mjs +0 -5
- package/esm2022/adapter-ajax-post/adapter-ajax-post.mjs +0 -77
- package/esm2022/adapter-ajax-post/breeze-client-adapter-ajax-post.mjs +0 -5
- package/esm2022/adapter-data-service-odata/adapter-core.mjs +0 -49
- package/esm2022/adapter-data-service-odata/adapter-data-service-odata.mjs +0 -461
- package/esm2022/adapter-data-service-odata/breeze-client-adapter-data-service-odata.mjs +0 -5
- package/esm2022/adapter-data-service-webapi/adapter-data-service-webapi.mjs +0 -100
- package/esm2022/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.mjs +0 -5
- package/esm2022/adapter-model-library-backing-store/adapter-model-library-backing-store.mjs +0 -269
- package/esm2022/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.mjs +0 -5
- package/esm2022/adapter-model-library-ko/adapter-model-library-ko.mjs +0 -241
- package/esm2022/adapter-model-library-ko/breeze-client-adapter-model-library-ko.mjs +0 -5
- package/esm2022/adapter-uri-builder-json/adapter-core.mjs +0 -49
- package/esm2022/adapter-uri-builder-json/adapter-uri-builder-json.mjs +0 -37
- package/esm2022/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.mjs +0 -5
- package/esm2022/adapter-uri-builder-odata/adapter-core.mjs +0 -49
- package/esm2022/adapter-uri-builder-odata/adapter-uri-builder-odata.mjs +0 -191
- package/esm2022/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.mjs +0 -5
- package/esm2022/breeze-client.mjs +0 -5
- package/esm2022/index.mjs +0 -2
- package/esm2022/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.mjs +0 -5
- package/esm2022/mixin-get-entity-graph/mixin-get-entity-graph.mjs +0 -269
- package/esm2022/mixin-save-queuing/breeze-client-mixin-save-queuing.mjs +0 -5
- package/esm2022/mixin-save-queuing/mixin-save-queuing.mjs +0 -421
- package/esm2022/src/abstract-data-service-adapter.mjs +0 -325
- package/esm2022/src/array.mjs +0 -4
- package/esm2022/src/assert-param.mjs +0 -330
- package/esm2022/src/breeze.mjs +0 -85
- package/esm2022/src/complex-array.mjs +0 -117
- package/esm2022/src/config.mjs +0 -232
- package/esm2022/src/core.mjs +0 -712
- package/esm2022/src/csdl-metadata-parser.mjs +0 -385
- package/esm2022/src/data-service.mjs +0 -221
- package/esm2022/src/data-type.mjs +0 -510
- package/esm2022/src/default-property-interceptor.mjs +0 -460
- package/esm2022/src/entity-action.mjs +0 -45
- package/esm2022/src/entity-aspect.mjs +0 -897
- package/esm2022/src/entity-group.mjs +0 -192
- package/esm2022/src/entity-key.mjs +0 -125
- package/esm2022/src/entity-manager.mjs +0 -2163
- package/esm2022/src/entity-metadata.mjs +0 -2242
- package/esm2022/src/entity-query.mjs +0 -1024
- package/esm2022/src/entity-state.mjs +0 -107
- package/esm2022/src/enum.mjs +0 -143
- package/esm2022/src/event.mjs +0 -264
- package/esm2022/src/interface-registry.mjs +0 -39
- package/esm2022/src/key-generator.mjs +0 -110
- package/esm2022/src/local-query-comparison-options.mjs +0 -65
- package/esm2022/src/mapping-context.mjs +0 -411
- package/esm2022/src/naming-convention.mjs +0 -92
- package/esm2022/src/observable-array.mjs +0 -183
- package/esm2022/src/predicate.mjs +0 -1259
- package/esm2022/src/primitive-array.mjs +0 -85
- package/esm2022/src/query-options.mjs +0 -152
- package/esm2022/src/relation-array.mjs +0 -173
- package/esm2022/src/save-options.mjs +0 -41
- package/esm2022/src/unattached-children-map.mjs +0 -56
- package/esm2022/src/validate.mjs +0 -995
- package/esm2022/src/validation-options.mjs +0 -64
- package/fesm2022/breeze-client-adapter-ajax-angularjs.mjs +0 -190
- package/fesm2022/breeze-client-adapter-ajax-angularjs.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-fetch.mjs +0 -190
- package/fesm2022/breeze-client-adapter-ajax-fetch.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-httpclient.mjs +0 -194
- package/fesm2022/breeze-client-adapter-ajax-httpclient.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-jquery.mjs +0 -114
- package/fesm2022/breeze-client-adapter-ajax-jquery.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-post.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-data-service-odata.mjs +0 -516
- package/fesm2022/breeze-client-adapter-data-service-odata.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-data-service-webapi.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-model-library-backing-store.mjs +0 -276
- package/fesm2022/breeze-client-adapter-model-library-backing-store.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-model-library-ko.mjs +0 -248
- package/fesm2022/breeze-client-adapter-model-library-ko.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-uri-builder-json.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-uri-builder-odata.mjs +0 -246
- package/fesm2022/breeze-client-adapter-uri-builder-odata.mjs.map +0 -1
- package/fesm2022/breeze-client-mixin-get-entity-graph.mjs.map +0 -1
- package/fesm2022/breeze-client-mixin-save-queuing.mjs.map +0 -1
- package/fesm2022/breeze-client.mjs +0 -14144
- package/fesm2022/breeze-client.mjs.map +0 -1
- package/index.d.ts +0 -1
- package/mixin-get-entity-graph/index.d.ts +0 -5
- package/mixin-get-entity-graph/mixin-get-entity-graph.d.ts +0 -31
- package/mixin-save-queuing/index.d.ts +0 -5
- package/mixin-save-queuing/mixin-save-queuing.d.ts +0 -32
- package/src/abstract-data-service-adapter.d.ts +0 -84
- package/src/array.d.ts +0 -3
- package/src/breeze.d.ts +0 -139
- package/src/complex-array.d.ts +0 -13
- package/src/config.d.ts +0 -104
- package/src/core.d.ts +0 -164
- package/src/csdl-metadata-parser.d.ts +0 -7
- package/src/data-type.d.ts +0 -89
- package/src/default-property-interceptor.d.ts +0 -4
- package/src/entity-aspect.d.ts +0 -332
- package/src/entity-group.d.ts +0 -28
- package/src/entity-key.d.ts +0 -77
- package/src/entity-manager.d.ts +0 -680
- package/src/entity-metadata.d.ts +0 -988
- package/src/entity-query.d.ts +0 -444
- package/src/enum.d.ts +0 -100
- package/src/event.d.ts +0 -142
- package/src/interface-registry.d.ts +0 -150
- package/src/key-generator.d.ts +0 -12
- package/src/observable-array.d.ts +0 -52
- package/src/predicate.d.ts +0 -376
- package/src/primitive-array.d.ts +0 -7
- package/src/relation-array.d.ts +0 -18
- package/src/unattached-children-map.d.ts +0 -19
- package/src/validate.d.ts +0 -650
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/validation/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CA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nimport { assertParam } from '../core/assert-param.js';\r\nimport { config } from '../config/config.js';\r\nimport { NavigationProperty, DataProperty } from '../metadata/entity-metadata.js';\r\nimport { Entity } from '../entity/entity-aspect.js';\r\n\r\nexport const INT16_MIN = -32768;\r\nexport const INT16_MAX = 32767;\r\n\r\nexport const INT32_MIN = -2147483648;\r\nexport const INT32_MAX = 2147483647;\r\n\r\nexport const BYTE_MIN = 0;\r\nexport const BYTE_MAX = 255;\r\n\r\n/** The entity and property being validated. The {@link ValidationMessageContext} passed to a {@link ValidationFn} extends it with the validator's settings. */\r\nexport interface ValidationContext {\r\n /** The entity whose property is being validated. Set when Breeze validates a property of an entity; an entity-level validator gets the entity as its value instead. */\r\n entity?: Entity;\r\n /** The {@link DataProperty} or {@link NavigationProperty} being validated. Set when Breeze validates a property. */\r\n property?: DataProperty | NavigationProperty;\r\n /** The name of the property being validated: a property path, such as `address.city`, for a property of a complex object. */\r\n propertyName?: string;\r\n /** The value that failed validation, so that a message template can show it as `%value%`. Set by {@link Validator.validate} when validation fails. */\r\n value?: any;\r\n}\r\n\r\n/** Used by Validator to compose messages */\r\nexport interface ValidationMessageContext extends ValidationContext {\r\n /** The name of the validator. Set by the {@link Validator} constructor. */\r\n name?: string;\r\n /** The name to show for the property in messages, as `%displayName%`. When it is not set, Breeze uses the property's `displayName`, or else `propertyName`, or `\"Value\"` when there is no property. */\r\n displayName?: string;\r\n /** The error message template. Each `%token%` is replaced with the context property of that name, calling it with the context if it is a function. Defaults to the entry for the validator's name in {@link Validator.messageTemplates}. */\r\n messageTemplate?: string;\r\n /** A message to use instead of `messageTemplate`: a string, or a function that returns one from the context. */\r\n message?: string | ((vc: ValidationContext) => string);\r\n /** Marks the validator as async when its function returns a promise without being declared\r\n `async`, which Breeze cannot see. An `async` function needs no marking. See {@link Validator.isAsync}. */\r\n isAsync?: boolean;\r\n /** For an async validator, aborted when its result will no longer be used - another run of the\r\n same check started, or the entity was detached. Pass it on to `fetch` to cancel the request. */\r\n signal?: AbortSignal;\r\n [key:string]: any;\r\n}\r\n\r\n/** Function called to validate an entity or property. Breeze always passes a context: the\r\nvalidator's own, with its settings, extended for each call with the entity and property being\r\nvalidated - so a validator reads its settings from it, as `ctx.min`.\r\n\r\nIt may return a promise, for a check that has to ask a server - see {@link Validator.isAsync}. */\r\nexport interface ValidationFn {\r\n (value: any, context: ValidationMessageContext): boolean | Promise<boolean>;\r\n}\r\n\r\n/** An `async` function - which Breeze can recognize before calling it, unlike one that merely returns a promise. */\r\nfunction isAsyncFunction(fn: Function) {\r\n return Object.prototype.toString.call(fn) === '[object AsyncFunction]';\r\n}\r\n\r\nfunction isThenable(value: any): value is PromiseLike<any> {\r\n return value != null && typeof value.then === 'function';\r\n}\r\n\r\n// add common props and methods for every validator 'context' here.\r\nlet rootContext = {\r\n displayName: function (context: ValidationContext) {\r\n if (context.property) {\r\n return context.property.resolveProperty(\"displayName\") || context.propertyName || context.property.name;\r\n } else {\r\n return \"Value\";\r\n }\r\n }\r\n};\r\n\r\n/**\r\nInstances of the Validator class provide the logic to validate another object and provide a description of any errors\r\nencountered during the validation process. They are typically associated with a 'validators' property on the following types: {@link EntityType},\r\n{@link DataProperty} or {@link NavigationProperty}.\r\n\r\nProperty-level validators normally arrive with the metadata. The Breeze server sends a\r\n`validators` array for each data property - for example `required` for a non-nullable\r\nproperty, `maxLength` for a string with a maximum length, and a data-type validator such as\r\n`int32` or `date`. They are not inferred on the client, so metadata written by hand has\r\nnone unless you add them.\r\n\r\nTo write your own, construct one with a name, a validation function and a context. Several\r\nbasic \"Validator\" construction methods are also provided as static methods to this class. These methods\r\nprovide a simpler syntax for creating basic validations.\r\n\r\nMany of these stock validators are inspired by and implemented to conform to the validators defined at\r\nhttp://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.aspx\r\n\r\nSometimes a custom validator will be required.\r\n@example\r\nMost validators will be 'property' level validators, like this.\r\n@example\r\n // v in this function is the value to be validated, in this case a \"country\" string.\r\n const valFn = (v: string | null) => v == null || v.startsWith(\"US\");\r\n const countryValidator = new Validator(\"countryIsUS\", valFn, {\r\n displayName: \"Country\",\r\n messageTemplate: \"'%displayName%' must start with 'US'\"\r\n });\r\n\r\n // Now plug it into Breeze.\r\n // Assume em1 is a preexisting EntityManager.\r\n const custType = em1.metadataStore.getAsEntityType(\"Customer\");\r\n const countryProp = custType.getProperty(\"country\");\r\n // Note that validator is added to a 'DataProperty' validators collection.\r\n countryProp.validators.push(countryValidator);\r\nEntity level validators are also possible\r\n@example\r\n function isValidZipCode(value: string) {\r\n const re = /^\\d{5}([\\-]\\d{4})?$/;\r\n return re.test(value);\r\n }\r\n\r\n // the value in this case will be a Customer entity\r\n const valFn = (cust: Customer) => {\r\n // This validator only validates US Zip Codes.\r\n if (cust.country === \"USA\") {\r\n return isValidZipCode(cust.postalCode);\r\n }\r\n return true;\r\n };\r\n const zipCodeValidator = new Validator(\"zipCodeValidator\", valFn,\r\n { messageTemplate: \"For the US, this is not a valid PostalCode\" });\r\n\r\n // Now plug it into Breeze.\r\n // Assume em1 is a preexisting EntityManager.\r\n const custType = em1.metadataStore.getAsEntityType(\"Customer\");\r\n // Note that validator is added to an 'EntityType' validators collection.\r\n custType.validators.push(zipCodeValidator);\r\nWhat is commonly needed is a way of creating a parameterized function that will itself\r\nreturn a new Validator. This requires the use of a 'context' object.\r\n@example\r\n // create a function that will take in a config object\r\n // and will return a validator\r\n const numericRangeValidator = (context: { min?: number, max?: number }) => {\r\n const valFn = (v: any, ctx: ValidationMessageContext) => {\r\n if (v == null) return true;\r\n if (typeof v !== \"number\") return false;\r\n if (ctx.min != null && v < ctx.min) return false;\r\n if (ctx.max != null && v > ctx.max) return false;\r\n return true;\r\n };\r\n // The last parameter below is the 'context' object that will be passed into the 'ctx' parameter above\r\n // when this validator executes. Several other properties, such as displayName will get added to this object as well.\r\n return new Validator(\"numericRange\", valFn, {\r\n messageTemplate: \"'%displayName%' must be a number between the values of %min% and %max%\",\r\n min: context.min,\r\n max: context.max\r\n });\r\n };\r\n // Assume that freightProperty is a DataEntityProperty that describes numeric values.\r\n // register the validator\r\n freightProperty.validators.push(numericRangeValidator({ min: 100, max: 500 }));\r\n\r\nBreeze substitutes context values and functions for the tokens in the messageTemplate when preparing the runtime error message;\r\n'displayName' is a pre-defined context function that is always available.\r\n\r\nPlease note that Breeze substitutes the empty string for falsey parameters. That usually works in your favor.\r\nSometimes it doesn't as when the 'min' value is zero in which case the message text would have a hole\r\nwhere the 'min' value goes, saying: \"... an integer between the values of and ...\". That is not what you want.\r\n\r\nTo avoid this effect, you may can bake certain of the context values into the 'messageTemplate' itself\r\nas shown in this revision to the pertinent part of the previous example:\r\n@example\r\n // ... as before\r\n // ... but bake the min/max values into the message template.\r\n const template = core.formatString(\r\n \"'%displayName%' must be a number between the values of %1 and %2\",\r\n context.min, context.max);\r\n return new Validator(\"numericRange\", valFn, {\r\n messageTemplate: template,\r\n min: context.min,\r\n max: context.max\r\n });\r\n\r\n@param name {String} The name of this validator.\r\n@param validatorFn {Function} A function to perform validation.\r\n\r\nvalidatorFn(value, context)\r\n@param validatorFn.value {Object} Value to be validated\r\n@param validatorFn.context {Object} The same context object passed into the constructor with the following additional properties if not\r\notherwise specified.\r\n@param validatorFn.context.value {Object} The value being validated.\r\n@param validatorFn.context.name {String} The name of the validator being executed.\r\n@param validatorFn.context.displayName {String} This will be either the value of the property's 'displayName' property or\r\nthe value of its 'name' property or the string 'Value'\r\n@param validatorFn.context.messageTemplate {String} This will either be the value of Validator.messageTemplates[ {this validators name}] or null. Validator.messageTemplates\r\nis an object that is keyed by validator name and that can be added to in order to 'register' your own message for a given validator.\r\nThe following property can also be specified for any validator to force a specific errorMessage string\r\n@param [validatorFn.context.message] {String} If this property is set it will be used instead of the 'messageTemplate' property when an\r\nerror message is generated.\r\n\r\n@param [context] {Object} A free form object whose properties will made available during the validation and error message creation process.\r\nThis object will be passed into the Validator's validation function whenever 'validate' is called. See above for a description\r\nof additional properties that will be automatically added to this object if not otherwise specified.\r\n*/\r\nexport class Validator {\r\n /** @hidden @internal */\r\n declare _$typeName: string; // on proto\r\n\r\n /** The name of this validator, such as `required` or `maxLength`. It picks the default message template and forms part of each {@link ValidationError}'s key. __Read Only__ */\r\n declare name: string;\r\n /** The function that performs the validation. It returns `true` if the value is valid. __Read Only__ */\r\n declare valFn: ValidationFn;\r\n /** The context this validator was created with, plus `name`, `messageTemplate` and a `displayName` function. It is passed to `valFn` and used to compose error messages. __Read Only__ */\r\n declare context: ValidationMessageContext;\r\n /** The context of the most recent call to {@link Validator.validate}: `context` extended with any additional context passed to it. {@link Validator.getMessage} reads it. After a validation that passed, it is `context` again. __Read Only__ */\r\n declare currentContext: ValidationMessageContext;\r\n declare private _baseContext: ValidationMessageContext;\r\n /**\r\n Whether this validator's function returns a promise: an `async` function, or one created with\r\n `isAsync: true` in its context. Breeze runs an async validator only when it can wait for the\r\n answer - when an entity is saved, and from {@link EntityAspect.validateEntityAsync} and\r\n {@link EntityAspect.validatePropertyAsync}. It does not run on a property change, an attach or\r\n a query, where nothing could wait for it; editing the property clears its error instead, as it\r\n clears the server's. __Read Only__\r\n */\r\n declare isAsync: boolean;\r\n\r\n /** Creates a validator. See the class description for examples.\r\n @param name - The validator's name. Also the default `key` of the errors it produces.\r\n @param valFn - The function that validates: called with the value (or, for an entity-level\r\n validator, the entity) and the context, it returns whether the value is valid.\r\n @param context - Settings for the validator and its messages, such as `displayName` and\r\n `messageTemplate`. They are available to `valFn` and to the error message template.\r\n */\r\n constructor(name: string, valFn: ValidationFn, context?: ValidationMessageContext) {\r\n // _baseContext is what will get serialized\r\n this._baseContext = context || {} as ValidationMessageContext;\r\n this._baseContext.name = name;\r\n context = core.extend(Object.create(rootContext), this._baseContext) as ValidationMessageContext;\r\n context.messageTemplate = context.messageTemplate || Validator.messageTemplates[name];\r\n this.name = name;\r\n this.valFn = valFn;\r\n this.context = context;\r\n this.isAsync = isAsyncFunction(valFn) || !!context.isAsync;\r\n }\r\n\r\n /**\r\n Run this validator against the specified value. This method will usually be called internally either\r\n automatically by an property change, entity attach, query or save operation, or manually as a result of\r\n a validateEntity call on the EntityAspect. The resulting ValidationResults are available via the\r\n EntityAspect.getValidationErrors method.\r\n\r\n However, you can also call a validator directly either for testing purposes or some other reason if needed.\r\n @example\r\n // using one of the predefined validators\r\n const validator = Validator.maxLength({ maxLength: 5, displayName: \"City\" });\r\n // null, because \"asdf\".length <= 5\r\n const noError = validator.validate(\"asdf\");\r\n const result = validator.validate(\"adasdfasdf\");\r\n // extract all of the properties of the 'result'\r\n const errMsg = result.errorMessage;\r\n const context = result.context;\r\n const sameValidator = result.validator;\r\n @param value {Object} Value to validate\r\n @param additionalContext {Object} Any additional contextual information that the Validator\r\n can make use of.\r\n @returns {ValidationError|null} A ValidationError if validation fails, null otherwise\r\n */\r\n validate(value: any, additionalContext?: ValidationMessageContext) {\r\n if (this.isAsync) {\r\n throw new Error(\"'\" + this.name + \"' is an async validator: call validateAsync(), which returns a promise, rather than validate().\");\r\n }\r\n let currentContext: ValidationMessageContext; // { value?: Object };\r\n if (additionalContext) {\r\n currentContext = core.extend(Object.create(this.context), additionalContext) as ValidationMessageContext;\r\n } else {\r\n currentContext = this.context;\r\n }\r\n this.currentContext = currentContext;\r\n\r\n try {\r\n const result = this.valFn(value, currentContext);\r\n if (isThenable(result)) {\r\n // A promise is truthy, so this validator would have passed every value. It is async\r\n // without saying so: treat it as async from now on, and ignore this answer.\r\n this.isAsync = true;\r\n result.then(undefined, () => { /* ignored, as the result is */ });\r\n console.warn(\"Breeze: validator '\" + this.name + \"' returned a promise, so it is async. Declare its function \" +\r\n \"'async', or pass { isAsync: true } in its context, so that it is only run where the answer can be awaited.\");\r\n this.currentContext = this.context;\r\n return null;\r\n }\r\n if (result) {\r\n // Drop the per-call context on success. It names the entity being validated, and a\r\n // Validator lives on a DataProperty, so on an EntityType, so on the MetadataStore -\r\n // the longest-lived object there is, and shared between managers. Holding it pins that\r\n // entity, and everything its navigation properties reach, for the life of the store.\r\n // Nothing asks for a message after a validation that passed; `this.context` keeps\r\n // getMessage() answering, without naming a subject.\r\n this.currentContext = this.context;\r\n return null;\r\n } else {\r\n currentContext.value = value;\r\n return new ValidationError(this, currentContext, this._formatMessage(currentContext));\r\n }\r\n } catch (e) {\r\n return new ValidationError(this, currentContext, \"Exception occured while executing this validator: \" + this.name);\r\n }\r\n }\r\n\r\n\r\n /**\r\n Runs this validator, sync or async, and resolves with a {@link ValidationError} if the value is\r\n invalid, or null. Each call has a context of its own, so calls may overlap; unlike\r\n {@link Validator.validate}, it does not set {@link Validator.currentContext}.\r\n ```ts\r\n const ve = await Validator.maxLength({ maxLength: 5 }).validateAsync(\"adasdfasdf\");\r\n ```\r\n A function that throws or rejects gives an error, as it does in `validate`.\r\n @param value - The value to validate.\r\n @param additionalContext - Anything else the validator can use, such as the entity and property.\r\n */\r\n async validateAsync(value: any, additionalContext?: ValidationMessageContext): Promise<ValidationError | null> {\r\n const context = (additionalContext\r\n ? core.extend(Object.create(this.context), additionalContext)\r\n : Object.create(this.context)) as ValidationMessageContext;\r\n try {\r\n if (await this.valFn(value, context)) return null;\r\n context.value = value;\r\n return new ValidationError(this, context, this._formatMessage(context));\r\n } catch (e) {\r\n return new ValidationError(this, context, \"Exception occured while executing this validator: \" + this.name);\r\n }\r\n }\r\n\r\n // context.value is not avail unless validate was called first.\r\n\r\n /**\r\n Returns the message generated by the most recent execution of this Validator.\r\n @example\r\n const v0 = Validator.maxLength({ maxLength: 5, displayName: \"City\" });\r\n v0.validate(\"adasdfasdf\");\r\n const errMessage = v0.getMessage();\r\n @returns {String}\r\n */\r\n getMessage() {\r\n return this._formatMessage(this.currentContext);\r\n }\r\n\r\n /** @hidden @internal */\r\n _formatMessage(context: ValidationMessageContext) {\r\n try {\r\n let message = context.message;\r\n if (message) {\r\n if (typeof (message) === \"function\") {\r\n return message(context);\r\n } else {\r\n return message;\r\n }\r\n } else if (context.messageTemplate) {\r\n return formatTemplate(context.messageTemplate, context);\r\n } else {\r\n return \"invalid value: \" + (this.name || \"{unnamed validator}\");\r\n }\r\n } catch (e) {\r\n return \"Unable to format error message\" + e.toString();\r\n }\r\n }\r\n\r\n /**\r\n Returns the serializable form of this validator: its `name` plus the context it was created with,\r\n such as `{ name: \"maxLength\", maxLength: 50 }`. Breeze uses it when it exports metadata;\r\n {@link Validator.fromJSON} reads it back through the factory registered under that name.\r\n */\r\n toJSON() {\r\n return this._baseContext;\r\n }\r\n\r\n /**\r\n Creates a validator instance from a JSON object or an array of instances from an array of JSON objects.\r\n @param json {Object} JSON object that represents the serialized version of a validator.\r\n */\r\n public static fromJSON(json: any): any {\r\n if (Array.isArray(json)) {\r\n return json.map(function (js) {\r\n return Validator.fromJSON(js);\r\n });\r\n }\r\n if (json instanceof Validator) {\r\n return json;\r\n }\r\n let validatorName = \"Validator.\" + json.name;\r\n let fn = config.getRegisteredFunction(validatorName);\r\n if (!fn) {\r\n throw new Error(\"Unable to locate a validator named:\" + json.name);\r\n }\r\n return fn(json);\r\n }\r\n\r\n /**\r\n Register a validator instance so that any deserialized metadata can reference it.\r\n @param validator {Validator} Validator to register.\r\n */\r\n public static register(validator: Validator) {\r\n config.registerFunction(function () {\r\n return validator;\r\n }, \"Validator.\" + validator.name);\r\n }\r\n\r\n /**\r\n Register a validator factory so that any deserialized metadata can reference it.\r\n @param validatorFactory {Function} A function that optionally takes a context property and returns a Validator instance.\r\n @param name {String} The name of the validator.\r\n */\r\n public static registerFactory(validatorFactory: (options?: any) => Validator, name: string) {\r\n config.registerFunction(validatorFactory, \"Validator.\" + name);\r\n }\r\n\r\n /**\r\n Map of standard error message templates keyed by validator name.\r\n You can add to or modify this object to customize the template used for any validation error message.\r\n @example\r\n // v in this function is the value to be validated, in this case a \"country\" string.\r\n const valFn = (v: string | null) => v == null || v.startsWith(\"US\");\r\n const countryValidator = new Validator(\"countryIsUS\", valFn, { displayName: \"Country\" });\r\n Validator.messageTemplates.countryIsUS = \"'%displayName%' must start with 'US'\";\r\n // This will have a similar effect to this\r\n const countryValidator2 = new Validator(\"countryIsUS\", valFn, {\r\n displayName: \"Country\",\r\n messageTemplate: \"'%displayName%' must start with 'US'\"\r\n });\r\n @property messageTemplates {Object}\r\n */\r\n public static messageTemplates: Record<string, any> = {\r\n bool: \"'%displayName%' must be a 'true' or 'false' value\",\r\n creditCard: \"The %displayName% is not a valid credit card number\",\r\n date: \"'%displayName%' must be a date\",\r\n duration: \"'%displayName%' must be a ISO8601 duration string, such as 'P3H24M60S'\",\r\n emailAddress: \"The %displayName% '%value%' is not a valid email address\",\r\n guid: \"'%displayName%' must be a GUID\",\r\n integer: \"'%displayName%' must be an integer\",\r\n integerRange: \"'%displayName%' must be an integer between the values of %minValue% and %maxValue%\",\r\n maxLength: \"'%displayName%' must be a string with %maxLength% characters or less\",\r\n number: \"'%displayName%' must be a number\",\r\n phone: \"The %displayName% '%value%' is not a valid phone number\",\r\n regularExpression: \"The %displayName% '%value%' does not match '%expression%'\",\r\n required: \"'%displayName%' is required\",\r\n string: \"'%displayName%' must be a string\",\r\n stringLength: \"'%displayName%' must be a string with between %minLength% and %maxLength% characters\",\r\n url: \"The %displayName% '%value%' is not a valid url\"\r\n };\r\n\r\n /**\r\n Returns a standard 'required value' Validator\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const custType = em1.metadataStore.getAsEntityType(\"Customer\");\r\n const regionProperty = custType.getProperty(\"region\");\r\n // Makes \"region\" on Customer a required property.\r\n regionProperty.validators.push(Validator.required());\r\n // or to allow empty strings\r\n regionProperty.validators.push(Validator.required({ allowEmptyStrings: true }));\r\n @param context - An object with `allowEmptyStrings` (boolean) - If this parameter is omitted or false then empty strings do NOT pass validation.\r\n @returns {Validator} A new Validator\r\n */\r\n public static required = function(context?: any) {\r\n let valFn = function (v: any, ctx: any) {\r\n if (typeof v === \"string\") {\r\n if (ctx && ctx.allowEmptyStrings) return true;\r\n return v.length > 0;\r\n } else {\r\n return v != null;\r\n }\r\n };\r\n return new Validator(\"required\", valFn, context);\r\n };\r\n\r\n /**\r\n Returns a standard maximum string length Validator; the maximum length must be specified\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const custType = em1.metadataStore.getAsEntityType(\"Customer\");\r\n const regionProperty = custType.getProperty(\"region\");\r\n // Validates that the value of the region property on Customer will be less than or equal to 5 characters.\r\n regionProperty.validators.push(Validator.maxLength({ maxLength: 5 }));\r\n @param context - An object with `maxLength` (number).\r\n @returns {Validator} A new Validator\r\n */\r\n public static maxLength = function(context: any) {\r\n let valFn = function (v: any, ctx: any) {\r\n if (v == null) return true;\r\n if (typeof (v) !== \"string\") return false;\r\n return v.length <= ctx.maxLength;\r\n };\r\n return new Validator(\"maxLength\", valFn, context);\r\n };\r\n\r\n /**\r\n Returns a standard string length Validator; both minimum and maximum lengths must be specified.\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const custType = em1.metadataStore.getAsEntityType(\"Customer\");\r\n const regionProperty = custType.getProperty(\"region\");\r\n // Validates that the value of the region property on Customer will be\r\n // between 2 and 5 characters\r\n regionProperty.validators.push(Validator.stringLength({ minLength: 2, maxLength: 5 }));\r\n @param context - An object with `maxLength` (number); `minLength` (number).\r\n @returns {Validator} A new Validator\r\n */\r\n public static stringLength = function (context: any) {\r\n let valFn = function (v: any, ctx: any) {\r\n if (v == null) return true;\r\n if (typeof (v) !== \"string\") return false;\r\n if (ctx.minLength != null && v.length < ctx.minLength) return false;\r\n if (ctx.maxLength != null && v.length > ctx.maxLength) return false;\r\n return true;\r\n };\r\n return new Validator(\"stringLength\", valFn, context);\r\n };\r\n\r\n /**\r\n Returns a standard string dataType Validator.\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const custType = em1.metadataStore.getAsEntityType(\"Customer\");\r\n const regionProperty = custType.getProperty(\"region\");\r\n // Validates that the value of the region property on Customer is a string.\r\n regionProperty.validators.push(Validator.string());\r\n @returns {Validator} A new Validator\r\n */\r\n public static string = function () {\r\n let valFn = function (v: any) {\r\n if (v == null) return true;\r\n return (typeof v === \"string\");\r\n };\r\n return new Validator(\"string\", valFn);\r\n };\r\n\r\n /**\r\n Returns a Guid data type Validator.\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const custType = em1.metadataStore.getAsEntityType(\"Customer\");\r\n const customerIdProperty = custType.getProperty(\"customerID\");\r\n // Validates that the value of the customerID property on Customer is a Guid.\r\n customerIdProperty.validators.push(Validator.guid());\r\n @returns {Validator} A new Validator\r\n */\r\n public static guid = function () {\r\n let valFn = function (v: any) {\r\n if (v == null) return true;\r\n return core.isGuid(v);\r\n };\r\n return new Validator(\"guid\", valFn);\r\n };\r\n\r\n /**\r\n Returns a ISO 8601 duration string Validator.\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const timeLimitType = em1.metadataStore.getAsEntityType(\"TimeLimit\");\r\n const maxTimeProperty = timeLimitType.getProperty(\"maxTime\");\r\n // Validates that the value of the maxTime property on TimeLimit is a duration.\r\n maxTimeProperty.validators.push(Validator.duration());\r\n @returns {Validator} A new Validator\r\n */\r\n public static duration = function () {\r\n let valFn = function (v: any) {\r\n if (v == null) return true;\r\n return core.isDuration(v);\r\n };\r\n return new Validator(\"duration\", valFn);\r\n };\r\n\r\n /**\r\n Returns a standard numeric data type Validator.\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const orderType = em1.metadataStore.getAsEntityType(\"Order\");\r\n const freightProperty = orderType.getProperty(\"freight\");\r\n // Validates that the value of the freight property on Order is a number.\r\n freightProperty.validators.push(Validator.number());\r\n @returns {Validator} A new Validator\r\n */\r\n\r\n // TODO: may need to have seperate logic for single.\r\n public static number = function(context?: any) {\r\n let valFn = function (v: any, ctx: any) {\r\n if (v == null) return true;\r\n if (typeof v === \"string\" && ctx && ctx.allowString) {\r\n v = parseFloat(v);\r\n }\r\n return (typeof v === \"number\" && !isNaN(v));\r\n };\r\n return new Validator(\"number\", valFn, context);\r\n };\r\n /** Another name for {@link Validator.number}, registered as `double` so that metadata naming it imports. The validator it returns is named `number`. */\r\n public static double = Validator.number;\r\n /** Another name for {@link Validator.number}, registered as `single` so that metadata naming it imports. The validator it returns is named `number`. */\r\n public static single = Validator.number;\r\n\r\n /**\r\n Returns a standard large integer data type - 64 bit - Validator.\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const orderType = em1.metadataStore.getAsEntityType(\"Order\");\r\n const freightProperty = orderType.getProperty(\"freight\");\r\n // Validates that the value of the freight property on Order is within the range of a 64 bit integer.\r\n freightProperty.validators.push(Validator.int64());\r\n @returns {Validator} A new Validator\r\n */\r\n public static integer = function(context?: any) {\r\n let valFn = function (v: any, ctx: any) {\r\n if (v == null) return true;\r\n if (typeof v === \"string\" && ctx && ctx.allowString) {\r\n v = parseInt(v, 10);\r\n }\r\n return (typeof v === \"number\") && (!isNaN(v)) && Math.floor(v) === v;\r\n };\r\n return new Validator(\"integer\", valFn, context);\r\n };\r\n /** Another name for {@link Validator.integer}, and the data-type validator for {@link DataType.Int64}: it checks that the value is a whole number, with no range check. The validator it returns is named `integer`. */\r\n public static int64 = Validator.integer;\r\n\r\n /**\r\n Returns a standard 32 bit integer data type Validator.\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const orderType = em1.metadataStore.getAsEntityType(\"Order\");\r\n const freightProperty = orderType.getProperty(\"freight\");\r\n freightProperty.validators.push(Validator.int32());\r\n @returns {Validator} A new Validator\r\n */\r\n public static int32 = function(context?: any) {\r\n return intRangeValidatorCtor(\"int32\", INT32_MIN, INT32_MAX, context)();\r\n };\r\n\r\n /**\r\n Returns a standard 16 bit integer data type Validator.\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const orderType = em1.metadataStore.getAsEntityType(\"Order\");\r\n const freightProperty = orderType.getProperty(\"freight\");\r\n // Validates that the value of the freight property on Order is within the range of a 16 bit integer.\r\n freightProperty.validators.push(Validator.int16());\r\n @returns {Validator} A new Validator\r\n */\r\n public static int16 = function(context?: any) {\r\n return intRangeValidatorCtor(\"int16\", INT16_MIN, INT16_MAX, context)();\r\n };\r\n\r\n /**\r\n Returns a standard byte data type Validator. (This is a integer between 0 and 255 inclusive for js purposes).\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const orderType = em1.metadataStore.getAsEntityType(\"Order\");\r\n const freightProperty = orderType.getProperty(\"freight\");\r\n // Validates that the value of the freight property on Order is a byte: an integer from 0 to 255.\r\n // Probably not a very good validation to place on the freight property.\r\n freightProperty.validators.push(Validator.byte());\r\n @returns {Validator} A new Validator\r\n */\r\n public static byte = function(context?: any) {\r\n return intRangeValidatorCtor(\"byte\", BYTE_MIN, BYTE_MAX, context)();\r\n };\r\n\r\n /**\r\n Returns a standard boolean data type Validator.\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const productType = em1.metadataStore.getAsEntityType(\"Product\");\r\n const discontinuedProperty = productType.getProperty(\"isDiscontinued\");\r\n // Validates that the value of the isDiscontinued property on Product is a boolean\r\n discontinuedProperty.validators.push(Validator.bool());\r\n @returns {Validator} A new Validator\r\n */\r\n public static bool = function() {\r\n let valFn = function (v: any) {\r\n if (v == null) return true;\r\n return (v === true) || (v === false);\r\n };\r\n return new Validator(\"bool\", valFn);\r\n };\r\n\r\n /** Returns a Validator named `none` that accepts every value. It is the data-type validator for {@link DataType.Binary} and {@link DataType.Undefined}. */\r\n public static none = function() {\r\n let valFn = function (v: any) {\r\n return true;\r\n };\r\n return new Validator(\"none\", valFn);\r\n };\r\n\r\n /**\r\n Returns a standard date data type Validator.\r\n @example\r\n // Assume em1 is a preexisting EntityManager.\r\n const orderType = em1.metadataStore.getAsEntityType(\"Order\");\r\n const orderDateProperty = orderType.getProperty(\"orderDate\");\r\n // Validates that the value of the orderDate property on Order is a date\r\n orderDateProperty.validators.push(Validator.date());\r\n @returns {Validator} A new Validator\r\n */\r\n public static date = function() {\r\n let valFn = function (v: any) {\r\n if (v == null) return true;\r\n if (typeof v === \"string\") {\r\n try {\r\n return !isNaN(Date.parse(v));\r\n // old code\r\n // return __isDate(new Date(v));\r\n } catch (e) {\r\n return false;\r\n }\r\n } else {\r\n return core.isDate(v);\r\n }\r\n };\r\n return new Validator(\"date\", valFn);\r\n };\r\n\r\n /**\r\n Returns a credit card number validator\r\n Performs a luhn algorithm checksum test for plausability\r\n catches simple mistakes; only service knows for sure\r\n @example\r\n // Assume em is a preexisting EntityManager.\r\n const personType = em.metadataStore.getAsEntityType(\"Person\");\r\n const creditCardProperty = personType.getProperty(\"creditCard\");\r\n // Validates that the value of the Person.creditCard property is credit card.\r\n creditCardProperty.validators.push(Validator.creditCard());\r\n @param [context] {Object} optional parameters to pass through to validation constructor\r\n @returns {Validator} A new Validator\r\n */\r\n public static creditCard = function(context?: any) {\r\n function valFn(v: any) {\r\n if (v == null || v === '') return true;\r\n if (typeof (v) !== 'string') return false;\r\n v = v.replace(/(\\-|\\s)/g, \"\"); // remove dashes and spaces\r\n if (!v || /\\D/.test(v)) return false; // all digits, not empty\r\n return luhn(v);\r\n }\r\n return new Validator('creditCard', valFn, context);\r\n };\r\n\r\n\r\n /**\r\n Returns a regular expression validator; the expression must be specified\r\n @example\r\n // Add validator to a property. Assume em is a preexisting EntityManager.\r\n const customerType = em.metadataStore.getAsEntityType(\"Customer\");\r\n const regionProperty = customerType.getProperty(\"region\");\r\n // Validates that the value of Customer.region is 2 char uppercase alpha.\r\n regionProperty.validators.push(Validator.regularExpression({ expression: '^[A-Z]{2}$' }));\r\n @param context - An object with `expression` (string) - String form of the regular expression to apply.\r\n @returns {Validator} A new Validator\r\n */\r\n public static regularExpression = function(context?: any) {\r\n function valFn(v: any, ctx: any) {\r\n // do not invalidate if empty; use a separate required test\r\n if (v == null || v === '') return true;\r\n if (typeof (v) !== 'string') return false;\r\n try {\r\n let re = new RegExp(ctx.expression);\r\n return re.test(v);\r\n } catch (e) {\r\n throw new Error('Missing or invalid expression parameter to regExp validator');\r\n }\r\n }\r\n return new Validator('regularExpression', valFn, context);\r\n };\r\n\r\n /**\r\n Returns the email address validator\r\n @example\r\n // Assume em is a preexisting EntityManager.\r\n const userType = em.metadataStore.getAsEntityType(\"User\");\r\n const emailProperty = userType.getProperty(\"email\");\r\n // Validates that the value of the User.email property is an email address.\r\n emailProperty.validators.push(Validator.emailAddress());\r\n @param [context] {Object} optional parameters to pass through to validation constructor\r\n @returns {Validator} A new Validator\r\n */\r\n public static emailAddress = function(context?: any) {\r\n // See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/EmailAttribute.cs\r\n 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;\r\n return makeRegExpValidator('emailAddress', reEmailAddress, null, context);\r\n };\r\n\r\n /**\r\n Returns the phone validator\r\n Provides basic assertions on the format and will help to eliminate most nonsense input\r\n Matches:\r\n International dialing prefix: one of nothing, `+`, `0` or `0000` (with or without a trailing break character, if not '+': [-/. ])\r\n ```ts\r\n ((\\+)|(0(\\d+)?[-/.\\s]))\r\n ```\r\n Country code: nothing, or `1` to `999` (with or without a trailing break character: [-/. ])\r\n ```ts\r\n [1-9]\\d{,2}[-/.\\s]?\r\n ```\r\n Area code: `(0)` to `(000000)`, or `0` to `000000` (with or without a trailing break character: [-/. ])\r\n ```ts\r\n ((\\(\\d{1,6}\\)|\\d{1,6})[-/.\\s]?)?\r\n ```\r\n Local: one or more digits (with or without a trailing break character: [-/. ])\r\n ```ts\r\n (\\d+[-/.\\s]?)+\\d+\r\n ```\r\n @example\r\n // Assume em is a preexisting EntityManager.\r\n const customerType = em.metadataStore.getAsEntityType(\"Customer\");\r\n const phoneProperty = customerType.getProperty(\"phone\");\r\n // Validates that the value of the Customer.phone property is phone.\r\n phoneProperty.validators.push(Validator.phone());\r\n @param [context] {Object} optional parameters to pass through to validation constructor\r\n @returns {Validator} A new Validator\r\n */\r\n public static phone = function (context?: any) {\r\n // See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/Expressions.cs\r\n let rePhone = /^((\\+|(0(\\d+)?[-/.\\s]?))[1-9]\\d{0,2}[-/.\\s]?)?((\\(\\d{1,6}\\)|\\d{1,6})[-/.\\s]?)?(\\d+[-/.\\s]?)+\\d+$/;\r\n return makeRegExpValidator('phone', rePhone, null, context);\r\n };\r\n\r\n /**\r\n Returns the URL (protocol required) validator\r\n @example\r\n // Assume em is a preexisting EntityManager.\r\n const supplierType = em.metadataStore.getAsEntityType(\"Supplier\");\r\n const homePageProperty = supplierType.getProperty(\"homePage\");\r\n // Validates that the value of the Supplier.homePage property is a URL.\r\n homePageProperty.validators.push(Validator.url());\r\n @param [context] {Object} optional parameters to pass through to validation constructor\r\n @returns {Validator} A new Validator\r\n */\r\n public static url = function (context?: any) {\r\n //See https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/UrlAttribute.cs\r\n 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})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/;\r\n return makeRegExpValidator('url', reUrlProtocolRequired, null, context);\r\n };\r\n\r\n /**\r\n Creates a regular expression validator with a fixed expression.\r\n Many of the stock validators are built with this factory method.\r\n Their expressions are often derived from\r\n https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions\r\n You can try many of them at http://dataannotationsextensions.org/\r\n @example\r\n // Make a zipcode validator\r\n const zipValidator = Validator.makeRegExpValidator(\r\n \"zipVal\",\r\n /^\\d{5}([\\-]\\d{4})?$/,\r\n \"The %displayName% '%value%' is not a valid U.S. zipcode\");\r\n // Register it.\r\n Validator.register(zipValidator);\r\n // Add it to a data property. Assume em is a preexisting EntityManager.\r\n const custType = em.metadataStore.getAsEntityType(\"Customer\");\r\n const zipProperty = custType.getProperty(\"postalCode\");\r\n zipProperty.validators.push(zipValidator);\r\n @param validatorName {String} name of this validator\r\n @param expression {String | RegExp} regular expression to apply\r\n @param [defaultMessage] {String} default message for failed validations\r\n @param [context] {Object} optional parameters to pass through to validation constructor\r\n @returns {Validator} A new Validator\r\n */\r\n public static makeRegExpValidator = makeRegExpValidator;\r\n\r\n}\r\nValidator.prototype._$typeName = \"Validator\";\r\n\r\n// register all validators\r\ncore.objectForEach(Validator, function (key: string, value: any) {\r\n if (typeof (value) !== \"function\") {\r\n return;\r\n }\r\n if (key === \"fromJSON\" || key === \"register\" ||\r\n key === \"registerFactory\" || key === \"makeRegExpValidator\") {\r\n return;\r\n }\r\n\r\n config.registerFunction(value, \"Validator.\" + key);\r\n});\r\n\r\nfunction formatTemplate(template: string, vars: Object, ownPropertiesOnly: boolean = false) {\r\n if (!vars) return template;\r\n return template.replace(/%([^%]+)%/g, function (_, key) {\r\n let valOrFn: any;\r\n if (ownPropertiesOnly) {\r\n valOrFn = vars.hasOwnProperty(key) ? (vars as Record<string, any>)[key] : '';\r\n } else {\r\n valOrFn = (vars as Record<string, any>)[key];\r\n }\r\n if (valOrFn != null) {\r\n if (core.isFunction(valOrFn)) {\r\n return valOrFn(vars);\r\n } else {\r\n return valOrFn;\r\n }\r\n } else {\r\n return \"\";\r\n }\r\n });\r\n}\r\n\r\nfunction intRangeValidatorCtor(validatorName: string, minValue: number, maxValue: number, context: any) {\r\n context = context || {};\r\n if (minValue !== undefined) { context.min = minValue; }\r\n if (maxValue !== undefined) { context.max = maxValue; }\r\n let templateExists = context.messageTemplate || Validator.messageTemplates[validatorName];\r\n if (!templateExists) {\r\n Validator.messageTemplates[validatorName] = core.formatString(\"'%displayName%' must be an integer between the values of %1 and %2\",\r\n minValue, maxValue);\r\n }\r\n return function () {\r\n let valFn = function (v: any, ctx: any) {\r\n if (v == null) return true;\r\n if (typeof v === \"string\" && ctx && ctx.allowString) {\r\n v = parseInt(v, 0);\r\n }\r\n if ((typeof v === \"number\") && (!isNaN(v)) && Math.floor(v) === v) {\r\n if (minValue != null && v < minValue) {\r\n return false;\r\n }\r\n if (maxValue != null && v > maxValue) {\r\n return false;\r\n }\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n };\r\n return new Validator(validatorName, valFn, context);\r\n };\r\n}\r\n\r\nexport function makeRegExpValidator(validatorName: string, expression: RegExp, defaultMessage?: string | null, context?: any) {\r\n if (defaultMessage) {\r\n Validator.messageTemplates[validatorName] = defaultMessage;\r\n }\r\n let re = (typeof (expression) === 'string') ? new RegExp(expression) : expression;\r\n let valFn = function (v: any) {\r\n // do not invalidate if empty; use a separate required test\r\n if (v == null || v === '') return true;\r\n if (typeof (v) !== 'string') return false;\r\n return re.test(v);\r\n };\r\n return new Validator(validatorName, valFn, context);\r\n}\r\n\r\n// http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers#JavaScript\r\n\r\n// function luhn(a: string, b: number, c: number, d: number, e: number) {\r\n// for (d = +a[b = a.length - 1], e = 0; b--; ) {\r\n// c = +a[b], d += ++e % 2 ? 2 * c % 10 + (c > 4) : c;\r\n// }\r\n// return !(d % 10);\r\n// };\r\n\r\nlet luhn = (function() {\r\n let luhnArr = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9];\r\n return function(str: string) \t{\r\n let counter = 0;\r\n let incNum: number;\r\n let odd = false;\r\n let temp = String(str).replace(/[^\\d]/g, \"\");\r\n if ( temp.length === 0) return false;\r\n for (let i = temp.length - 1; i >= 0; --i) {\r\n incNum = parseInt(temp.charAt(i), 10);\r\n counter += (odd = !odd) ? incNum : luhnArr[incNum];\r\n }\r\n return (counter % 10 === 0);\r\n };\r\n})();\r\n\r\n/**\r\nDescribes one failed validation: which validator failed, on which property, and the message to\r\nshow. An entity's current errors are in {@link EntityAspect.getValidationErrors}. The errors a\r\nserver reports for a failed save are added there too, with {@link ValidationError.isServerError} set.\r\n*/\r\nexport class ValidationError {\r\n /** The {@link Validator} that produced this error. `undefined` for an error from the server or one created without a validator. __Read Only__ */\r\n validator?: Validator;\r\n /** The key that identifies this error among an entity's validation errors: the validator's name (or the error name), then `:` and the property name if there is one. Adding an error with the same key replaces the old one. __Read Only__ */\r\n key: string;\r\n /** The context the error was created with - for a validator, its context when it ran, which for a property error includes `entity`, `property`, `propertyName` and `value`. __Read Only__ */\r\n context: any;\r\n /** The error message. __Read Only__ */\r\n errorMessage: string;\r\n /** The {@link DataProperty} or {@link NavigationProperty} this error is about, or `undefined` for an entity-level error. __Read Only__ */\r\n property: any; // IProperty\r\n /** The name of the property this error is about - a property path, such as `address.city`, for a property of a complex object - or `undefined` for an entity-level error. __Read Only__ */\r\n propertyName?: string;\r\n /** Whether this error came from the server in a failed save. Server errors do not block a save, and are cleared when the property is changed or the entity is saved again. __Read Only__ */\r\n isServerError: boolean;\r\n\r\n /**\r\n Creates a validation error. Applications usually add one with\r\n {@link EntityAspect.addValidationError} after creating it here.\r\n @param validator - The Validator that found the error, or `null` for an error found some other way.\r\n @param context - The context to record with the error: for a property, its `entity`, `property`,\r\n `propertyName` and `value`.\r\n @param errorMessage - The message to show.\r\n @param key - Identifies the error among the entity's errors. If not given, it is built from the\r\n validator's name - or, without a validator, the error message - and the property name; see\r\n {@link ValidationError.getKey}.\r\n */\r\n constructor(validator: Validator | null, context: ValidationContext, errorMessage: string, key?: string) {\r\n // Error is with isInstanceOf(Validator)\r\n assertParam(validator, \"validator\").isOptional().isInstanceOf(Validator).check();\r\n assertParam(errorMessage, \"errorMessage\").isNonEmptyString().check();\r\n assertParam(key, \"key\").isOptional().isNonEmptyString().check();\r\n this.validator = validator || undefined;\r\n context = context || {};\r\n this.context = context;\r\n this.errorMessage = errorMessage;\r\n\r\n this.property = context.property;\r\n this.propertyName = context.propertyName || (context.property && context.property.name);\r\n\r\n if (key) {\r\n this.key = key;\r\n } else {\r\n this.key = ValidationError.getKey(validator || errorMessage, this.propertyName);\r\n }\r\n this.isServerError = false;\r\n }\r\n\r\n /**\r\n Composes a ValidationError 'key' given a validator or an errorName and an optional propertyName\r\n @param validatorOrErrorName - A Validator, or an \"error name\" if no validator is available.\r\n @param [propertyName] A property name\r\n @returns {String} A ValidationError 'key'\r\n */\r\n public static getKey(validatorOrErrorName: Validator | string, propertyName?: string) {\r\n let name = (typeof validatorOrErrorName === 'string') ? validatorOrErrorName : validatorOrErrorName.name;\r\n return name + (propertyName ? \":\" + propertyName : \"\");\r\n }\r\n\r\n}\r\n\r\n\r\n"]}
|
|
@@ -1,63 +1,67 @@
|
|
|
1
|
-
/** Configuration info to be passed to the
|
|
2
|
-
export interface ValidationOptionsConfig {
|
|
3
|
-
/** Whether entity and property level validation should occur when entities are attached to the EntityManager
|
|
4
|
-
other than via a query. (default = true) */
|
|
5
|
-
validateOnAttach?: boolean;
|
|
6
|
-
/** Whether entity and property level validation should occur before entities are saved.
|
|
7
|
-
A failed validation will force the save to fail early. (default = true) */
|
|
8
|
-
validateOnSave?: boolean;
|
|
9
|
-
/** Whether entity and property level validation should occur after entities are queried from a remote server.
|
|
10
|
-
(default = false)
|
|
11
|
-
validateOnQuery?: boolean;
|
|
12
|
-
/** Whether property level validation should occur after entities are modified.
|
|
13
|
-
(default = true)
|
|
14
|
-
validateOnPropertyChange?: boolean;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
A ValidationOptions instance is used to specify the conditions under which validation will be executed.
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
export declare class ValidationOptions implements ValidationOptionsConfig {
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
ValidationOptions
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
@param config - A configuration object.
|
|
41
|
-
|
|
42
|
-
constructor(config?: ValidationOptionsConfig);
|
|
43
|
-
/**
|
|
44
|
-
Returns a copy of this ValidationOptions with changes to the specified config properties.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
/** Configuration info to be passed to the {@link ValidationOptions} constructor */
|
|
2
|
+
export interface ValidationOptionsConfig {
|
|
3
|
+
/** Whether entity and property level validation should occur when entities are attached to the EntityManager
|
|
4
|
+
other than via a query. (default = true) */
|
|
5
|
+
validateOnAttach?: boolean;
|
|
6
|
+
/** Whether entity and property level validation should occur before entities are saved.
|
|
7
|
+
A failed validation will force the save to fail early. (default = true) */
|
|
8
|
+
validateOnSave?: boolean;
|
|
9
|
+
/** Whether entity and property level validation should occur after entities are queried from a remote server.
|
|
10
|
+
(default = false) */
|
|
11
|
+
validateOnQuery?: boolean;
|
|
12
|
+
/** Whether property level validation should occur after entities are modified.
|
|
13
|
+
(default = true) */
|
|
14
|
+
validateOnPropertyChange?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
A ValidationOptions instance is used to specify the conditions under which validation will be executed.
|
|
18
|
+
|
|
19
|
+
*/
|
|
20
|
+
export declare class ValidationOptions implements ValidationOptionsConfig {
|
|
21
|
+
/** Whether entity and property level validation should occur when entities are attached to the EntityManager
|
|
22
|
+
other than via a query. (default = true) __Read Only__ */
|
|
23
|
+
validateOnAttach: boolean;
|
|
24
|
+
/** Whether entity and property level validation should occur before entities are saved.
|
|
25
|
+
A failed validation will force the save to fail early. (default = true) __Read Only__ */
|
|
26
|
+
validateOnSave: boolean;
|
|
27
|
+
/** Whether entity and property level validation should occur after entities are queried from a remote server.
|
|
28
|
+
(default = false) __Read Only__ */
|
|
29
|
+
validateOnQuery: boolean;
|
|
30
|
+
/** Whether property level validation should occur after entities are modified.
|
|
31
|
+
(default = true) __Read Only__ */
|
|
32
|
+
validateOnPropertyChange: boolean;
|
|
33
|
+
/**
|
|
34
|
+
ValidationOptions constructor
|
|
35
|
+
```ts
|
|
36
|
+
var newVo = new ValidationOptions( { validateOnSave: false, validateOnAttach: false });
|
|
37
|
+
// assume em1 is a preexisting EntityManager
|
|
38
|
+
em1.setProperties( { validationOptions: newVo });
|
|
39
|
+
```
|
|
40
|
+
@param config - A configuration object.
|
|
41
|
+
*/
|
|
42
|
+
constructor(config?: ValidationOptionsConfig);
|
|
43
|
+
/**
|
|
44
|
+
Returns a copy of this ValidationOptions with changes to the specified config properties.
|
|
45
|
+
```ts
|
|
46
|
+
var validationOptions = new ValidationOptions();
|
|
47
|
+
var newOptions = validationOptions.using( { validateOnQuery: true, validateOnSave: false} );
|
|
48
|
+
```
|
|
49
|
+
@param config - A configuration object
|
|
50
|
+
@returns A new ValidationOptions instance.
|
|
51
|
+
*/
|
|
52
|
+
using(config: ValidationOptionsConfig): ValidationOptions;
|
|
53
|
+
/**
|
|
54
|
+
Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
|
|
55
|
+
The current instance is returned unchanged.
|
|
56
|
+
```ts
|
|
57
|
+
var validationOptions = new ValidationOptions()
|
|
58
|
+
var newOptions = validationOptions.using( { validateOnQuery: true, validateOnSave: false} );
|
|
59
|
+
var newOptions.setAsDefault();
|
|
60
|
+
```
|
|
61
|
+
*/
|
|
62
|
+
setAsDefault(): any;
|
|
63
|
+
/**
|
|
64
|
+
The default instance for use whenever ValidationOptions are not specified.
|
|
65
|
+
*/
|
|
66
|
+
static defaultInstance: ValidationOptions;
|
|
67
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { core } from '../core/core.js';
|
|
2
|
+
import { assertConfig } from '../core/assert-param.js';
|
|
3
|
+
/**
|
|
4
|
+
A ValidationOptions instance is used to specify the conditions under which validation will be executed.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
export class ValidationOptions {
|
|
8
|
+
/**
|
|
9
|
+
ValidationOptions constructor
|
|
10
|
+
```ts
|
|
11
|
+
var newVo = new ValidationOptions( { validateOnSave: false, validateOnAttach: false });
|
|
12
|
+
// assume em1 is a preexisting EntityManager
|
|
13
|
+
em1.setProperties( { validationOptions: newVo });
|
|
14
|
+
```
|
|
15
|
+
@param config - A configuration object.
|
|
16
|
+
*/
|
|
17
|
+
constructor(config) {
|
|
18
|
+
updateWithConfig(this, config);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
Returns a copy of this ValidationOptions with changes to the specified config properties.
|
|
22
|
+
```ts
|
|
23
|
+
var validationOptions = new ValidationOptions();
|
|
24
|
+
var newOptions = validationOptions.using( { validateOnQuery: true, validateOnSave: false} );
|
|
25
|
+
```
|
|
26
|
+
@param config - A configuration object
|
|
27
|
+
@returns A new ValidationOptions instance.
|
|
28
|
+
*/
|
|
29
|
+
using(config) {
|
|
30
|
+
if (!config)
|
|
31
|
+
return this;
|
|
32
|
+
let result = new ValidationOptions(this);
|
|
33
|
+
updateWithConfig(result, config);
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
|
|
38
|
+
The current instance is returned unchanged.
|
|
39
|
+
```ts
|
|
40
|
+
var validationOptions = new ValidationOptions()
|
|
41
|
+
var newOptions = validationOptions.using( { validateOnQuery: true, validateOnSave: false} );
|
|
42
|
+
var newOptions.setAsDefault();
|
|
43
|
+
```
|
|
44
|
+
*/
|
|
45
|
+
setAsDefault() {
|
|
46
|
+
return core.setAsDefault(this, ValidationOptions);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
The default instance for use whenever ValidationOptions are not specified.
|
|
50
|
+
*/
|
|
51
|
+
static defaultInstance = new ValidationOptions({
|
|
52
|
+
validateOnAttach: true,
|
|
53
|
+
validateOnSave: true,
|
|
54
|
+
validateOnQuery: false,
|
|
55
|
+
validateOnPropertyChange: true
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
ValidationOptions.prototype._$typeName = "ValidationOptions";
|
|
59
|
+
function updateWithConfig(options, config) {
|
|
60
|
+
if (config) {
|
|
61
|
+
assertConfig(config)
|
|
62
|
+
.whereParam("validateOnAttach").isBoolean().isOptional()
|
|
63
|
+
.whereParam("validateOnSave").isBoolean().isOptional()
|
|
64
|
+
.whereParam("validateOnQuery").isBoolean().isOptional()
|
|
65
|
+
.whereParam("validateOnPropertyChange").isBoolean().isOptional()
|
|
66
|
+
.applyAll(options);
|
|
67
|
+
}
|
|
68
|
+
return options;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=validation-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-options.js","sourceRoot":"","sources":["../../src/validation/validation-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAG,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAkBvD;;;EAGE;AACF,MAAM,OAAO,iBAAiB;IAkB5B;;;;;;;;MAQE;IACF,YAAY,MAAgC;QAC1C,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IAGD;;;;;;;;MAQE;IACF,KAAK,CAAC,MAA+B;QACnC,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACzB,IAAI,MAAM,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACzC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;;;MAQE;IACF,YAAY;QACV,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IACpD,CAAC;IAED;;MAEE;IACF,MAAM,CAAC,eAAe,GAAG,IAAI,iBAAiB,CAAC;QAC7C,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,KAAK;QACtB,wBAAwB,EAAE,IAAI;KAC/B,CAAC,CAAC;;AAEL,iBAAiB,CAAC,SAAS,CAAC,UAAU,GAAG,mBAAmB,CAAC;AAE7D,SAAS,gBAAgB,CAAC,OAA0B,EAAE,MAAgC;IACpF,IAAI,MAAM,EAAE,CAAC;QACX,YAAY,CAAC,MAAM,CAAC;aACf,UAAU,CAAC,kBAAkB,CAAC,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE;aACvD,UAAU,CAAC,gBAAgB,CAAC,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE;aACrD,UAAU,CAAC,iBAAiB,CAAC,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE;aACtD,UAAU,CAAC,0BAA0B,CAAC,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE;aAC/D,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { core } from '../core/core.js';\r\nimport { assertConfig } from '../core/assert-param.js';\r\n\r\n/** Configuration info to be passed to the {@link ValidationOptions} constructor */\r\nexport interface ValidationOptionsConfig {\r\n /** Whether entity and property level validation should occur when entities are attached to the EntityManager \r\n other than via a query. (default = true) */\r\n validateOnAttach?: boolean;\r\n /** Whether entity and property level validation should occur before entities are saved. \r\n A failed validation will force the save to fail early. (default = true) */\r\n validateOnSave?: boolean;\r\n /** Whether entity and property level validation should occur after entities are queried from a remote server.\r\n (default = false) */\r\n validateOnQuery?: boolean;\r\n /** Whether property level validation should occur after entities are modified.\r\n (default = true) */\r\n validateOnPropertyChange?: boolean;\r\n}\r\n\r\n/**\r\nA ValidationOptions instance is used to specify the conditions under which validation will be executed.\r\n\r\n*/\r\nexport class ValidationOptions implements ValidationOptionsConfig {\r\n /** @hidden @internal */\r\n declare _$typeName: string; // on proto\r\n /** Whether entity and property level validation should occur when entities are attached to the EntityManager \r\n other than via a query. (default = true) __Read Only__ */\r\n declare validateOnAttach: boolean;\r\n /** Whether entity and property level validation should occur before entities are saved. \r\n A failed validation will force the save to fail early. (default = true) __Read Only__ */\r\n declare validateOnSave: boolean;\r\n /** Whether entity and property level validation should occur after entities are queried from a remote server.\r\n (default = false) __Read Only__ */\r\n declare validateOnQuery: boolean;\r\n /** Whether property level validation should occur after entities are modified.\r\n (default = true) __Read Only__ */\r\n declare validateOnPropertyChange: boolean;\r\n\r\n\r\n\r\n /** \r\n ValidationOptions constructor\r\n ```ts\r\n var newVo = new ValidationOptions( { validateOnSave: false, validateOnAttach: false });\r\n // assume em1 is a preexisting EntityManager\r\n em1.setProperties( { validationOptions: newVo });\r\n ```\r\n @param config - A configuration object.\r\n */\r\n constructor(config?: ValidationOptionsConfig) {\r\n updateWithConfig(this, config);\r\n }\r\n\r\n\r\n /**\r\n Returns a copy of this ValidationOptions with changes to the specified config properties.\r\n ```ts\r\n var validationOptions = new ValidationOptions();\r\n var newOptions = validationOptions.using( { validateOnQuery: true, validateOnSave: false} );\r\n ```\r\n @param config - A configuration object\r\n @returns A new ValidationOptions instance.\r\n */\r\n using(config: ValidationOptionsConfig) {\r\n if (!config) return this;\r\n let result = new ValidationOptions(this);\r\n updateWithConfig(result, config);\r\n return result;\r\n }\r\n\r\n /**\r\n Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.\r\n The current instance is returned unchanged.\r\n ```ts\r\n var validationOptions = new ValidationOptions()\r\n var newOptions = validationOptions.using( { validateOnQuery: true, validateOnSave: false} );\r\n var newOptions.setAsDefault();\r\n ```\r\n */\r\n setAsDefault() {\r\n return core.setAsDefault(this, ValidationOptions);\r\n }\r\n\r\n /**\r\n The default instance for use whenever ValidationOptions are not specified.\r\n */\r\n static defaultInstance = new ValidationOptions({\r\n validateOnAttach: true,\r\n validateOnSave: true,\r\n validateOnQuery: false,\r\n validateOnPropertyChange: true\r\n });\r\n}\r\nValidationOptions.prototype._$typeName = \"ValidationOptions\";\r\n\r\nfunction updateWithConfig(options: ValidationOptions, config?: ValidationOptionsConfig) {\r\n if (config) {\r\n assertConfig(config)\r\n .whereParam(\"validateOnAttach\").isBoolean().isOptional()\r\n .whereParam(\"validateOnSave\").isBoolean().isOptional()\r\n .whereParam(\"validateOnQuery\").isBoolean().isOptional()\r\n .whereParam(\"validateOnPropertyChange\").isBoolean().isOptional()\r\n .applyAll(options);\r\n }\r\n return options;\r\n}\r\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AjaxAdapter, AjaxRequestInterceptor, BreezeConfig } from 'breeze-client';
|
|
2
|
-
export declare class AjaxAngularjsAdapter implements AjaxAdapter {
|
|
3
|
-
name: string;
|
|
4
|
-
defaultSettings: {
|
|
5
|
-
headers?: {
|
|
6
|
-
[name: string]: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
requestInterceptor?: AjaxRequestInterceptor;
|
|
10
|
-
$http: any;
|
|
11
|
-
$rootScope: any;
|
|
12
|
-
constructor();
|
|
13
|
-
static register(breezeConfig?: BreezeConfig): AjaxAngularjsAdapter;
|
|
14
|
-
initialize(): void;
|
|
15
|
-
setHttp(http: any): void;
|
|
16
|
-
ajax(config: any): void;
|
|
17
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AjaxAdapter, AjaxConfig, AjaxRequestInterceptor, BreezeConfig } from 'breeze-client';
|
|
2
|
-
/** Breeze AJAX adapter using fetch API
|
|
3
|
-
* See https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
|
|
4
|
-
*/
|
|
5
|
-
export declare class AjaxFetchAdapter implements AjaxAdapter {
|
|
6
|
-
static adapterName: string;
|
|
7
|
-
name: string;
|
|
8
|
-
defaultSettings: {
|
|
9
|
-
headers?: {
|
|
10
|
-
[name: string]: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
requestInterceptor?: AjaxRequestInterceptor;
|
|
14
|
-
constructor();
|
|
15
|
-
static register(breezeConfig?: BreezeConfig): AjaxFetchAdapter;
|
|
16
|
-
initialize(): void;
|
|
17
|
-
ajax(config: AjaxConfig): void;
|
|
18
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from "@angular/common/http";
|
|
2
|
-
import { AjaxConfig, BreezeConfig, AjaxRequestInterceptor, AjaxAdapter } from "breeze-client";
|
|
3
|
-
export declare class AjaxHttpClientAdapter implements AjaxAdapter {
|
|
4
|
-
http: HttpClient;
|
|
5
|
-
static adapterName: string;
|
|
6
|
-
name: string;
|
|
7
|
-
defaultSettings: {};
|
|
8
|
-
requestInterceptor: AjaxRequestInterceptor;
|
|
9
|
-
constructor(http: HttpClient);
|
|
10
|
-
static register(http: HttpClient, breezeConfig?: BreezeConfig): AjaxHttpClientAdapter;
|
|
11
|
-
initialize(): void;
|
|
12
|
-
ajax(config: AjaxConfig): void;
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AjaxAdapter, AjaxConfig, AjaxRequestInterceptor, BreezeConfig } from 'breeze-client';
|
|
2
|
-
export declare class AjaxJQueryAdapter implements AjaxAdapter {
|
|
3
|
-
name: string;
|
|
4
|
-
defaultSettings: {
|
|
5
|
-
headers?: {
|
|
6
|
-
[name: string]: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
requestInterceptor?: AjaxRequestInterceptor;
|
|
10
|
-
jQuery: any;
|
|
11
|
-
constructor();
|
|
12
|
-
static register(breezeConfig?: BreezeConfig): AjaxJQueryAdapter;
|
|
13
|
-
initialize(): void;
|
|
14
|
-
ajax(config: AjaxConfig): void;
|
|
15
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as breeze from 'breeze-client';
|
|
2
|
-
/** @hidden */
|
|
3
|
-
export declare class DataServiceODataAdapter extends breeze.AbstractDataServiceAdapter {
|
|
4
|
-
relativeUrl: boolean | ((ds: breeze.DataService, url: string) => string);
|
|
5
|
-
headers: {
|
|
6
|
-
DataServiceVersion: string;
|
|
7
|
-
};
|
|
8
|
-
constructor();
|
|
9
|
-
static register(config?: breeze.BreezeConfig): DataServiceODataAdapter;
|
|
10
|
-
initialize(): void;
|
|
11
|
-
fetchMetadata(metadataStore: breeze.MetadataStore, dataService: breeze.DataService): Promise<unknown>;
|
|
12
|
-
executeQuery(mappingContext: breeze.MappingContext): Promise<breeze.QueryResult>;
|
|
13
|
-
saveChanges(odataSaveContext: breeze.SaveContext, saveBundle: breeze.SaveBundle): Promise<breeze.SaveResult>;
|
|
14
|
-
jsonResultsAdapter: breeze.JsonResultsAdapter;
|
|
15
|
-
getAbsoluteUrl(dataService: breeze.DataService, url: string): string;
|
|
16
|
-
getRoutePrefix(dataService: breeze.DataService): any;
|
|
17
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as breeze from 'breeze-client';
|
|
2
|
-
/** @hidden */
|
|
3
|
-
export declare class DataServiceWebApiAdapter extends breeze.AbstractDataServiceAdapter {
|
|
4
|
-
constructor();
|
|
5
|
-
static register(config?: breeze.BreezeConfig): DataServiceWebApiAdapter;
|
|
6
|
-
/** @hidden @internal */
|
|
7
|
-
_prepareSaveBundle(saveContext: breeze.SaveContext, saveBundle: breeze.SaveBundle): any;
|
|
8
|
-
/** @hidden @internal */
|
|
9
|
-
_prepareSaveResult(saveContext: breeze.SaveContext, data: any): {
|
|
10
|
-
entities: any;
|
|
11
|
-
keyMappings: breeze.KeyMapping[];
|
|
12
|
-
deletedKeys: any[];
|
|
13
|
-
};
|
|
14
|
-
jsonResultsAdapter: breeze.JsonResultsAdapter;
|
|
15
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as breeze from 'breeze-client';
|
|
2
|
-
export declare class ModelLibraryBackingStoreAdapter implements breeze.ModelLibraryAdapter {
|
|
3
|
-
name: string;
|
|
4
|
-
constructor();
|
|
5
|
-
static register(config?: breeze.BreezeConfig): ModelLibraryBackingStoreAdapter;
|
|
6
|
-
initialize(): void;
|
|
7
|
-
getTrackablePropertyNames(entity: breeze.Entity): string[];
|
|
8
|
-
initializeEntityPrototype(proto: any): void;
|
|
9
|
-
startTracking(entity: breeze.StructuralObject, proto: any): void;
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as breeze from 'breeze-client';
|
|
2
|
-
export declare class ModelLibraryKnockoutAdapter implements breeze.ModelLibraryAdapter {
|
|
3
|
-
name: string;
|
|
4
|
-
constructor();
|
|
5
|
-
static register(config?: breeze.BreezeConfig): ModelLibraryKnockoutAdapter;
|
|
6
|
-
initialize(): void;
|
|
7
|
-
getTrackablePropertyNames(entity: any): string[];
|
|
8
|
-
initializeEntityPrototype(proto: any): void;
|
|
9
|
-
startTracking(entity: any, proto: any): void;
|
|
10
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as breeze from 'breeze-client';
|
|
2
|
-
export declare class UriBuilderJsonAdapter implements breeze.UriBuilderAdapter {
|
|
3
|
-
name: string;
|
|
4
|
-
constructor();
|
|
5
|
-
static register(config?: breeze.BreezeConfig): UriBuilderJsonAdapter;
|
|
6
|
-
initialize(): void;
|
|
7
|
-
buildUri(entityQuery: breeze.EntityQuery, metadataStore: breeze.MetadataStore): string;
|
|
8
|
-
}
|