breeze-client 2.2.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +83 -63
- package/adapters/abstract-data-service-adapter.d.ts +120 -0
- package/adapters/abstract-data-service-adapter.js +395 -0
- package/adapters/abstract-data-service-adapter.js.map +1 -0
- package/adapters/adapter-ajax-fetch.d.ts +12 -0
- package/adapters/adapter-ajax-fetch.js +13 -0
- package/adapters/adapter-ajax-fetch.js.map +1 -0
- package/{adapter-ajax-post → adapters}/adapter-ajax-post.d.ts +40 -36
- package/{fesm2022/breeze-client-adapter-ajax-post.mjs → adapters/adapter-ajax-post.js} +80 -82
- package/adapters/adapter-ajax-post.js.map +1 -0
- package/{adapter-ajax-fetch → adapters}/adapter-core.d.ts +4 -4
- package/{fesm2022/breeze-client-adapter-uri-builder-json.mjs → adapters/adapter-core.js} +48 -91
- package/adapters/adapter-core.js.map +1 -0
- package/adapters/adapter-data-service-webapi.d.ts +9 -0
- package/{fesm2022/breeze-client-adapter-data-service-webapi.mjs → adapters/adapter-data-service-webapi.js} +105 -107
- package/adapters/adapter-data-service-webapi.js.map +1 -0
- package/adapters/adapter-model-library-backing-store.d.ts +32 -0
- package/adapters/adapter-model-library-backing-store.js +321 -0
- package/adapters/adapter-model-library-backing-store.js.map +1 -0
- package/adapters/adapter-uri-builder-json.d.ts +11 -0
- package/adapters/adapter-uri-builder-json.js +40 -0
- package/adapters/adapter-uri-builder-json.js.map +1 -0
- package/adapters/http.d.ts +52 -0
- package/adapters/http.js +202 -0
- package/adapters/http.js.map +1 -0
- package/angular/adapter-angular-httpclient.d.ts +21 -0
- package/angular/adapter-angular-httpclient.js +70 -0
- package/angular/adapter-angular-httpclient.js.map +1 -0
- package/breeze.d.ts +215 -0
- package/breeze.js +141 -0
- package/breeze.js.map +1 -0
- package/config/config.d.ts +212 -0
- package/config/config.js +392 -0
- package/config/config.js.map +1 -0
- package/config/configure.d.ts +66 -0
- package/config/configure.js +46 -0
- package/config/configure.js.map +1 -0
- package/config/default-adapters.d.ts +1 -0
- package/config/default-adapters.js +40 -0
- package/config/default-adapters.js.map +1 -0
- package/config/interface-registry.d.ts +191 -0
- package/config/interface-registry.js +5 -0
- package/config/interface-registry.js.map +1 -0
- package/{src → core}/assert-param.d.ts +52 -60
- package/core/assert-param.js +390 -0
- package/core/assert-param.js.map +1 -0
- package/core/core.d.ts +285 -0
- package/core/core.js +772 -0
- package/core/core.js.map +1 -0
- package/core/enum.d.ts +116 -0
- package/core/enum.js +167 -0
- package/core/enum.js.map +1 -0
- package/core/event.d.ts +169 -0
- package/core/event.js +338 -0
- package/core/event.js.map +1 -0
- package/entity/array.d.ts +3 -0
- package/entity/array.js +4 -0
- package/entity/array.js.map +1 -0
- package/entity/complex-array.d.ts +17 -0
- package/entity/complex-array.js +104 -0
- package/entity/complex-array.js.map +1 -0
- package/entity/default-property-interceptor.d.ts +1 -0
- package/entity/default-property-interceptor.js +496 -0
- package/entity/default-property-interceptor.js.map +1 -0
- package/{src → entity}/entity-action.d.ts +36 -42
- package/entity/entity-action.js +45 -0
- package/entity/entity-action.js.map +1 -0
- package/entity/entity-aspect.d.ts +457 -0
- package/entity/entity-aspect.js +1262 -0
- package/entity/entity-aspect.js.map +1 -0
- package/entity/entity-base.d.ts +55 -0
- package/entity/entity-base.js +41 -0
- package/entity/entity-base.js.map +1 -0
- package/entity/entity-group.d.ts +1 -0
- package/entity/entity-group.js +224 -0
- package/entity/entity-group.js.map +1 -0
- package/entity/entity-key.d.ts +95 -0
- package/entity/entity-key.js +189 -0
- package/entity/entity-key.js.map +1 -0
- package/{src → entity}/entity-state.d.ts +112 -84
- package/entity/entity-state.js +135 -0
- package/entity/entity-state.js.map +1 -0
- package/entity/key-generator.d.ts +57 -0
- package/entity/key-generator.js +155 -0
- package/entity/key-generator.js.map +1 -0
- package/entity/observable-array.d.ts +25 -0
- package/entity/observable-array.js +230 -0
- package/entity/observable-array.js.map +1 -0
- package/entity/primitive-array.d.ts +12 -0
- package/entity/primitive-array.js +71 -0
- package/entity/primitive-array.js.map +1 -0
- package/entity/relation-array.d.ts +24 -0
- package/entity/relation-array.js +176 -0
- package/entity/relation-array.js.map +1 -0
- package/entity/unattached-children-map.d.ts +1 -0
- package/entity/unattached-children-map.js +105 -0
- package/entity/unattached-children-map.js.map +1 -0
- package/generate-entity-classes.js +1176 -0
- package/manager/entity-manager.d.ts +801 -0
- package/manager/entity-manager.js +2395 -0
- package/manager/entity-manager.js.map +1 -0
- package/{src → manager}/save-options.d.ts +48 -42
- package/manager/save-options.js +51 -0
- package/manager/save-options.js.map +1 -0
- package/{src → metadata}/data-service.d.ts +229 -184
- package/metadata/data-service.js +246 -0
- package/metadata/data-service.js.map +1 -0
- package/metadata/data-type.d.ts +122 -0
- package/metadata/data-type.js +465 -0
- package/metadata/data-type.js.map +1 -0
- package/metadata/entity-metadata.d.ts +1193 -0
- package/metadata/entity-metadata.js +2502 -0
- package/metadata/entity-metadata.js.map +1 -0
- package/{src → metadata}/local-query-comparison-options.d.ts +65 -59
- package/metadata/local-query-comparison-options.js +69 -0
- package/metadata/local-query-comparison-options.js.map +1 -0
- package/{src → metadata}/naming-convention.d.ts +75 -72
- package/metadata/naming-convention.js +97 -0
- package/metadata/naming-convention.js.map +1 -0
- package/mixins/mixin-get-entity-graph.d.ts +63 -0
- package/{fesm2022/breeze-client-mixin-get-entity-graph.mjs → mixins/mixin-get-entity-graph.js} +331 -253
- package/mixins/mixin-get-entity-graph.js.map +1 -0
- package/mixins/mixin-save-queuing.d.ts +98 -0
- package/{fesm2022/breeze-client-mixin-save-queuing.mjs → mixins/mixin-save-queuing.js} +493 -365
- package/mixins/mixin-save-queuing.js.map +1 -0
- package/package.json +62 -93
- package/query/entity-query.d.ts +521 -0
- package/query/entity-query.js +1149 -0
- package/query/entity-query.js.map +1 -0
- package/{src → query}/mapping-context.d.ts +44 -46
- package/query/mapping-context.js +412 -0
- package/query/mapping-context.js.map +1 -0
- package/query/predicate.d.ts +394 -0
- package/query/predicate.js +1294 -0
- package/query/predicate.js.map +1 -0
- package/query/property-path.d.ts +252 -0
- package/query/property-path.js +2 -0
- package/query/property-path.js.map +1 -0
- package/{src → query}/query-options.d.ts +143 -119
- package/query/query-options.js +180 -0
- package/query/query-options.js.map +1 -0
- package/rxjs/breeze-rxjs.d.ts +72 -0
- package/rxjs/breeze-rxjs.js +117 -0
- package/rxjs/breeze-rxjs.js.map +1 -0
- package/validation/validate.d.ts +583 -0
- package/validation/validate.js +961 -0
- package/validation/validate.js.map +1 -0
- package/{src → validation}/validation-options.d.ts +67 -63
- package/validation/validation-options.js +70 -0
- package/validation/validation-options.js.map +1 -0
- package/adapter-ajax-angularjs/adapter-ajax-angularjs.d.ts +0 -17
- package/adapter-ajax-angularjs/adapter-core.d.ts +0 -4
- package/adapter-ajax-angularjs/index.d.ts +0 -5
- package/adapter-ajax-fetch/adapter-ajax-fetch.d.ts +0 -18
- package/adapter-ajax-fetch/index.d.ts +0 -5
- package/adapter-ajax-httpclient/adapter-ajax-httpclient.d.ts +0 -13
- package/adapter-ajax-httpclient/adapter-core.d.ts +0 -4
- package/adapter-ajax-httpclient/index.d.ts +0 -5
- package/adapter-ajax-jquery/adapter-ajax-jquery.d.ts +0 -15
- package/adapter-ajax-jquery/index.d.ts +0 -5
- package/adapter-ajax-post/index.d.ts +0 -5
- package/adapter-data-service-odata/adapter-core.d.ts +0 -4
- package/adapter-data-service-odata/adapter-data-service-odata.d.ts +0 -17
- package/adapter-data-service-odata/index.d.ts +0 -5
- package/adapter-data-service-webapi/adapter-data-service-webapi.d.ts +0 -15
- package/adapter-data-service-webapi/index.d.ts +0 -5
- package/adapter-model-library-backing-store/adapter-model-library-backing-store.d.ts +0 -10
- package/adapter-model-library-backing-store/index.d.ts +0 -5
- package/adapter-model-library-ko/adapter-model-library-ko.d.ts +0 -10
- package/adapter-model-library-ko/index.d.ts +0 -5
- package/adapter-uri-builder-json/adapter-core.d.ts +0 -4
- package/adapter-uri-builder-json/adapter-uri-builder-json.d.ts +0 -8
- package/adapter-uri-builder-json/index.d.ts +0 -5
- package/adapter-uri-builder-odata/adapter-core.d.ts +0 -4
- package/adapter-uri-builder-odata/adapter-uri-builder-odata.d.ts +0 -8
- package/adapter-uri-builder-odata/index.d.ts +0 -5
- package/esm2022/adapter-ajax-angularjs/adapter-ajax-angularjs.mjs +0 -135
- package/esm2022/adapter-ajax-angularjs/adapter-core.mjs +0 -49
- package/esm2022/adapter-ajax-angularjs/breeze-client-adapter-ajax-angularjs.mjs +0 -5
- package/esm2022/adapter-ajax-fetch/adapter-ajax-fetch.mjs +0 -135
- package/esm2022/adapter-ajax-fetch/adapter-core.mjs +0 -49
- package/esm2022/adapter-ajax-fetch/breeze-client-adapter-ajax-fetch.mjs +0 -5
- package/esm2022/adapter-ajax-httpclient/adapter-ajax-httpclient.mjs +0 -139
- package/esm2022/adapter-ajax-httpclient/adapter-core.mjs +0 -49
- package/esm2022/adapter-ajax-httpclient/breeze-client-adapter-ajax-httpclient.mjs +0 -5
- package/esm2022/adapter-ajax-jquery/adapter-ajax-jquery.mjs +0 -107
- package/esm2022/adapter-ajax-jquery/breeze-client-adapter-ajax-jquery.mjs +0 -5
- package/esm2022/adapter-ajax-post/adapter-ajax-post.mjs +0 -77
- package/esm2022/adapter-ajax-post/breeze-client-adapter-ajax-post.mjs +0 -5
- package/esm2022/adapter-data-service-odata/adapter-core.mjs +0 -49
- package/esm2022/adapter-data-service-odata/adapter-data-service-odata.mjs +0 -461
- package/esm2022/adapter-data-service-odata/breeze-client-adapter-data-service-odata.mjs +0 -5
- package/esm2022/adapter-data-service-webapi/adapter-data-service-webapi.mjs +0 -100
- package/esm2022/adapter-data-service-webapi/breeze-client-adapter-data-service-webapi.mjs +0 -5
- package/esm2022/adapter-model-library-backing-store/adapter-model-library-backing-store.mjs +0 -269
- package/esm2022/adapter-model-library-backing-store/breeze-client-adapter-model-library-backing-store.mjs +0 -5
- package/esm2022/adapter-model-library-ko/adapter-model-library-ko.mjs +0 -241
- package/esm2022/adapter-model-library-ko/breeze-client-adapter-model-library-ko.mjs +0 -5
- package/esm2022/adapter-uri-builder-json/adapter-core.mjs +0 -49
- package/esm2022/adapter-uri-builder-json/adapter-uri-builder-json.mjs +0 -37
- package/esm2022/adapter-uri-builder-json/breeze-client-adapter-uri-builder-json.mjs +0 -5
- package/esm2022/adapter-uri-builder-odata/adapter-core.mjs +0 -49
- package/esm2022/adapter-uri-builder-odata/adapter-uri-builder-odata.mjs +0 -191
- package/esm2022/adapter-uri-builder-odata/breeze-client-adapter-uri-builder-odata.mjs +0 -5
- package/esm2022/breeze-client.mjs +0 -5
- package/esm2022/index.mjs +0 -2
- package/esm2022/mixin-get-entity-graph/breeze-client-mixin-get-entity-graph.mjs +0 -5
- package/esm2022/mixin-get-entity-graph/mixin-get-entity-graph.mjs +0 -269
- package/esm2022/mixin-save-queuing/breeze-client-mixin-save-queuing.mjs +0 -5
- package/esm2022/mixin-save-queuing/mixin-save-queuing.mjs +0 -421
- package/esm2022/src/abstract-data-service-adapter.mjs +0 -325
- package/esm2022/src/array.mjs +0 -4
- package/esm2022/src/assert-param.mjs +0 -330
- package/esm2022/src/breeze.mjs +0 -85
- package/esm2022/src/complex-array.mjs +0 -117
- package/esm2022/src/config.mjs +0 -232
- package/esm2022/src/core.mjs +0 -712
- package/esm2022/src/csdl-metadata-parser.mjs +0 -385
- package/esm2022/src/data-service.mjs +0 -221
- package/esm2022/src/data-type.mjs +0 -510
- package/esm2022/src/default-property-interceptor.mjs +0 -460
- package/esm2022/src/entity-action.mjs +0 -45
- package/esm2022/src/entity-aspect.mjs +0 -897
- package/esm2022/src/entity-group.mjs +0 -192
- package/esm2022/src/entity-key.mjs +0 -125
- package/esm2022/src/entity-manager.mjs +0 -2163
- package/esm2022/src/entity-metadata.mjs +0 -2242
- package/esm2022/src/entity-query.mjs +0 -1024
- package/esm2022/src/entity-state.mjs +0 -107
- package/esm2022/src/enum.mjs +0 -143
- package/esm2022/src/event.mjs +0 -264
- package/esm2022/src/interface-registry.mjs +0 -39
- package/esm2022/src/key-generator.mjs +0 -110
- package/esm2022/src/local-query-comparison-options.mjs +0 -65
- package/esm2022/src/mapping-context.mjs +0 -411
- package/esm2022/src/naming-convention.mjs +0 -92
- package/esm2022/src/observable-array.mjs +0 -183
- package/esm2022/src/predicate.mjs +0 -1259
- package/esm2022/src/primitive-array.mjs +0 -85
- package/esm2022/src/query-options.mjs +0 -152
- package/esm2022/src/relation-array.mjs +0 -173
- package/esm2022/src/save-options.mjs +0 -41
- package/esm2022/src/unattached-children-map.mjs +0 -56
- package/esm2022/src/validate.mjs +0 -995
- package/esm2022/src/validation-options.mjs +0 -64
- package/fesm2022/breeze-client-adapter-ajax-angularjs.mjs +0 -190
- package/fesm2022/breeze-client-adapter-ajax-angularjs.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-fetch.mjs +0 -190
- package/fesm2022/breeze-client-adapter-ajax-fetch.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-httpclient.mjs +0 -194
- package/fesm2022/breeze-client-adapter-ajax-httpclient.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-jquery.mjs +0 -114
- package/fesm2022/breeze-client-adapter-ajax-jquery.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-ajax-post.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-data-service-odata.mjs +0 -516
- package/fesm2022/breeze-client-adapter-data-service-odata.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-data-service-webapi.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-model-library-backing-store.mjs +0 -276
- package/fesm2022/breeze-client-adapter-model-library-backing-store.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-model-library-ko.mjs +0 -248
- package/fesm2022/breeze-client-adapter-model-library-ko.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-uri-builder-json.mjs.map +0 -1
- package/fesm2022/breeze-client-adapter-uri-builder-odata.mjs +0 -246
- package/fesm2022/breeze-client-adapter-uri-builder-odata.mjs.map +0 -1
- package/fesm2022/breeze-client-mixin-get-entity-graph.mjs.map +0 -1
- package/fesm2022/breeze-client-mixin-save-queuing.mjs.map +0 -1
- package/fesm2022/breeze-client.mjs +0 -14144
- package/fesm2022/breeze-client.mjs.map +0 -1
- package/index.d.ts +0 -1
- package/mixin-get-entity-graph/index.d.ts +0 -5
- package/mixin-get-entity-graph/mixin-get-entity-graph.d.ts +0 -31
- package/mixin-save-queuing/index.d.ts +0 -5
- package/mixin-save-queuing/mixin-save-queuing.d.ts +0 -32
- package/src/abstract-data-service-adapter.d.ts +0 -84
- package/src/array.d.ts +0 -3
- package/src/breeze.d.ts +0 -139
- package/src/complex-array.d.ts +0 -13
- package/src/config.d.ts +0 -104
- package/src/core.d.ts +0 -164
- package/src/csdl-metadata-parser.d.ts +0 -7
- package/src/data-type.d.ts +0 -89
- package/src/default-property-interceptor.d.ts +0 -4
- package/src/entity-aspect.d.ts +0 -332
- package/src/entity-group.d.ts +0 -28
- package/src/entity-key.d.ts +0 -77
- package/src/entity-manager.d.ts +0 -680
- package/src/entity-metadata.d.ts +0 -988
- package/src/entity-query.d.ts +0 -444
- package/src/enum.d.ts +0 -100
- package/src/event.d.ts +0 -142
- package/src/interface-registry.d.ts +0 -150
- package/src/key-generator.d.ts +0 -12
- package/src/observable-array.d.ts +0 -52
- package/src/predicate.d.ts +0 -376
- package/src/primitive-array.d.ts +0 -7
- package/src/relation-array.d.ts +0 -18
- package/src/unattached-children-map.d.ts +0 -19
- package/src/validate.d.ts +0 -650
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { core } from '../core/core.js';
|
|
2
|
+
import { assertConfig } from '../core/assert-param.js';
|
|
3
|
+
import { DataService } from '../metadata/data-service.js';
|
|
4
|
+
/**
|
|
5
|
+
A SaveOptions instance is used to specify the 'options' under which a save will occur.
|
|
6
|
+
*/
|
|
7
|
+
export class SaveOptions {
|
|
8
|
+
/** The default value whenever SaveOptions are not specified. */
|
|
9
|
+
static defaultInstance = new SaveOptions({ allowConcurrentSaves: false });
|
|
10
|
+
/** Creates save options from a {@link SaveOptionsConfig}. Passed to {@link EntityManager.saveChanges},
|
|
11
|
+
they are used for that save in place of the manager's {@link EntityManager.saveOptions} - as a
|
|
12
|
+
whole, not merged with them setting by setting.
|
|
13
|
+
```ts
|
|
14
|
+
const so = new SaveOptions({ allowConcurrentSaves: true });
|
|
15
|
+
em.saveChanges(null, so);
|
|
16
|
+
```
|
|
17
|
+
*/
|
|
18
|
+
constructor(config) {
|
|
19
|
+
SaveOptions._updateWithConfig(this, config);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
Sets the 'defaultInstance' by creating a copy of the current 'defaultInstance' and then applying all of the properties of the current instance.
|
|
23
|
+
The current instance is returned unchanged.
|
|
24
|
+
*/
|
|
25
|
+
setAsDefault() {
|
|
26
|
+
return core.setAsDefault(this, SaveOptions);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
Returns a copy of this SaveOptions with the specified config options applied.
|
|
30
|
+
```ts
|
|
31
|
+
var saveOptions = em1.saveOptions.using( {resourceName: "anotherResource" });
|
|
32
|
+
```
|
|
33
|
+
*/
|
|
34
|
+
using(config) {
|
|
35
|
+
return SaveOptions._updateWithConfig(this, config);
|
|
36
|
+
}
|
|
37
|
+
/** @hidden @internal */
|
|
38
|
+
static _updateWithConfig(obj, config) {
|
|
39
|
+
if (config) {
|
|
40
|
+
assertConfig(config)
|
|
41
|
+
.whereParam("resourceName").isOptional().isString()
|
|
42
|
+
.whereParam("dataService").isOptional().isInstanceOf(DataService)
|
|
43
|
+
.whereParam("allowConcurrentSaves").isBoolean().isOptional()
|
|
44
|
+
.whereParam("tag").isOptional()
|
|
45
|
+
.applyAll(obj);
|
|
46
|
+
}
|
|
47
|
+
return obj;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
SaveOptions.prototype._$typeName = "SaveOptions";
|
|
51
|
+
//# sourceMappingURL=save-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-options.js","sourceRoot":"","sources":["../../src/manager/save-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAc1D;;EAEE;AACF,MAAM,OAAO,WAAW;IAYtB,gEAAgE;IAChE,MAAM,CAAC,eAAe,GAAG,IAAI,WAAW,CAAC,EAAE,oBAAoB,EAAE,KAAK,EAAC,CAAC,CAAC;IAEzE;;;;;;;MAOE;IACF,YAAY,MAA0B;QACpC,WAAW,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAGD;;;MAGE;IACF,YAAY;QACV,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;MAKE;IACF,KAAK,CAAC,MAAyB;QAC7B,OAAO,WAAW,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAED,wBAAwB;IAChB,MAAM,CAAC,iBAAiB,CAAC,GAAgB,EAAE,MAA0B;QAC3E,IAAI,MAAM,EAAE,CAAC;YACX,YAAY,CAAC,MAAM,CAAC;iBACf,UAAU,CAAC,cAAc,CAAC,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE;iBAClD,UAAU,CAAC,aAAa,CAAC,CAAC,UAAU,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC;iBAChE,UAAU,CAAC,sBAAsB,CAAC,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE;iBAC3D,UAAU,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE;iBAC9B,QAAQ,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;;AAGH,WAAW,CAAC,SAAS,CAAC,UAAU,GAAG,aAAa,CAAC","sourcesContent":["import { core } from '../core/core.js';\r\nimport { assertConfig } from '../core/assert-param.js';\r\nimport { DataService } from '../metadata/data-service.js';\r\n\r\n/** Configuration info to be passed to the {@link SaveOptions} constructor */\r\nexport interface SaveOptionsConfig {\r\n /** Resource name to be used during the save - this defaults to \"SaveChanges\" */\r\n resourceName?: string;\r\n /** The DataService to be used for this save. */\r\n dataService?: DataService;\r\n /** Whether multiple saves can be in-flight at the same time. The default is false. */\r\n allowConcurrentSaves?: boolean;\r\n /** Free form value that will be sent to the server during the save. */\r\n tag?: any;\r\n}\r\n\r\n/**\r\nA SaveOptions instance is used to specify the 'options' under which a save will occur.\r\n*/\r\nexport class SaveOptions {\r\n /** @hidden @internal */\r\n declare _$typeName: string; // on proto\r\n /** Resource name to be used during the save - this defaults to \"SaveChanges\". __Read Only__ */\r\n declare resourceName: string;\r\n /** The DataService to be used for this save. __Read Only__ */\r\n declare dataService: DataService;\r\n /** Whether multiple saves can be in-flight at the same time. The default is false. __Read Only__ */\r\n declare allowConcurrentSaves: boolean;\r\n /** Free form value that will be sent to the server during the save. __Read Only__ */\r\n declare tag: any;\r\n\r\n /** The default value whenever SaveOptions are not specified. */\r\n static defaultInstance = new SaveOptions({ allowConcurrentSaves: false});\r\n\r\n /** Creates save options from a {@link SaveOptionsConfig}. Passed to {@link EntityManager.saveChanges},\r\n they are used for that save in place of the manager's {@link EntityManager.saveOptions} - as a\r\n whole, not merged with them setting by setting.\r\n ```ts\r\n const so = new SaveOptions({ allowConcurrentSaves: true });\r\n em.saveChanges(null, so);\r\n ```\r\n */\r\n constructor(config?: SaveOptionsConfig) {\r\n SaveOptions._updateWithConfig(this, config);\r\n }\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 */\r\n setAsDefault() {\r\n return core.setAsDefault(this, SaveOptions);\r\n }\r\n\r\n /**\r\n Returns a copy of this SaveOptions with the specified config options applied.\r\n ```ts\r\n var saveOptions = em1.saveOptions.using( {resourceName: \"anotherResource\" });\r\n ```\r\n */\r\n using(config: SaveOptionsConfig) {\r\n return SaveOptions._updateWithConfig(this, config);\r\n }\r\n\r\n /** @hidden @internal */\r\n private static _updateWithConfig(obj: SaveOptions, config?: SaveOptionsConfig) {\r\n if (config) {\r\n assertConfig(config)\r\n .whereParam(\"resourceName\").isOptional().isString()\r\n .whereParam(\"dataService\").isOptional().isInstanceOf(DataService)\r\n .whereParam(\"allowConcurrentSaves\").isBoolean().isOptional()\r\n .whereParam(\"tag\").isOptional()\r\n .applyAll(obj);\r\n }\r\n return obj;\r\n }\r\n\r\n}\r\nSaveOptions.prototype._$typeName = \"SaveOptions\";\r\n\r\n\r\n\r\n"]}
|
|
@@ -1,184 +1,229 @@
|
|
|
1
|
-
import { EntityType, NavigationProperty } from './entity-metadata';
|
|
2
|
-
import { DataServiceAdapter, UriBuilderAdapter } from '
|
|
3
|
-
import { KeyMapping } from '
|
|
4
|
-
import { MappingContext } from '
|
|
5
|
-
/** Configuration info to be passed to the
|
|
6
|
-
export interface DataServiceConfig {
|
|
7
|
-
/** The serviceName for this DataService.
|
|
8
|
-
serviceName?: string;
|
|
9
|
-
/** The adapter name for the
|
|
10
|
-
adapterName?: string;
|
|
11
|
-
/** The adapter name for the
|
|
12
|
-
uriBuilderName?: string;
|
|
13
|
-
/** Whether the server can provide metadata for this service.
|
|
14
|
-
hasServerMetadata?: boolean;
|
|
15
|
-
/** The
|
|
16
|
-
jsonResultsAdapter?: JsonResultsAdapter;
|
|
17
|
-
/** Whether to use JSONP when performing a 'GET' request against this service.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
serviceName
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
*/
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
1
|
+
import { EntityType, NavigationProperty } from './entity-metadata.js';
|
|
2
|
+
import { DataServiceAdapter, UriBuilderAdapter } from '../config/interface-registry.js';
|
|
3
|
+
import { KeyMapping } from '../manager/entity-manager.js';
|
|
4
|
+
import { MappingContext } from '../query/mapping-context.js';
|
|
5
|
+
/** Configuration info to be passed to the {@link DataService} constructor */
|
|
6
|
+
export interface DataServiceConfig {
|
|
7
|
+
/** The serviceName for this DataService. */
|
|
8
|
+
serviceName?: string;
|
|
9
|
+
/** The adapter name for the {@link DataServiceAdapter} to be used with this service. */
|
|
10
|
+
adapterName?: string;
|
|
11
|
+
/** The adapter name for the {@link UriBuilderAdapter} to be used with this service. */
|
|
12
|
+
uriBuilderName?: string;
|
|
13
|
+
/** Whether the server can provide metadata for this service. */
|
|
14
|
+
hasServerMetadata?: boolean;
|
|
15
|
+
/** The {@link JsonResultsAdapter} used to process the results of any query against this DataService. */
|
|
16
|
+
jsonResultsAdapter?: JsonResultsAdapter;
|
|
17
|
+
/** Whether to use JSONP when performing a 'GET' request against this service.
|
|
18
|
+
@deprecated No effect on Breeze's own transport, which has no JSONP support. Kept because it is
|
|
19
|
+
part of a serialized DataService, and because a registered (deprecated) ajax adapter can still
|
|
20
|
+
act on the dataType and crossDomain settings it produces. */
|
|
21
|
+
useJsonp?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
A DataService instance is used to encapsulate the details of a single 'service'; this includes a serviceName, a dataService adapterInstance,
|
|
25
|
+
and whether the service has server side metadata.
|
|
26
|
+
|
|
27
|
+
You can construct an EntityManager with either a serviceName or a DataService instance, if you use a serviceName then a DataService
|
|
28
|
+
is constructed for you. (It can also be set via the EntityManager.setProperties method).
|
|
29
|
+
|
|
30
|
+
The same applies to the MetadataStore.fetchMetadata method, i.e. it takes either a serviceName or a DataService instance.
|
|
31
|
+
|
|
32
|
+
Each metadataStore contains a list of DataServices, each accessible via its ‘serviceName’.
|
|
33
|
+
( see MetadataStore.getDataService and MetadataStore.addDataService). The ‘addDataService’ method is called internally
|
|
34
|
+
anytime a MetadataStore.fetchMetadata call occurs with a new dataService ( or service name).
|
|
35
|
+
|
|
36
|
+
*/
|
|
37
|
+
export declare class DataService {
|
|
38
|
+
/** The serviceName for this DataService. __Read Only__ */
|
|
39
|
+
serviceName: string;
|
|
40
|
+
/** The adapter name for the {@link DataServiceAdapter} to be used with this service. __Read Only__ */
|
|
41
|
+
adapterName: string;
|
|
42
|
+
/** The {@link DataServiceAdapter} implementation instance associated with this EntityManager. __Read Only__ */
|
|
43
|
+
adapterInstance?: DataServiceAdapter;
|
|
44
|
+
/** The adapter name for the {@link UriBuilderAdapter} to be used with this service. __Read Only__ */
|
|
45
|
+
uriBuilderName: string;
|
|
46
|
+
/** The {@link UriBuilderAdapter} implementation instance associated with this EntityManager. __Read Only__ */
|
|
47
|
+
uriBuilder?: UriBuilderAdapter;
|
|
48
|
+
/** Whether the server can provide metadata for this service. __Read Only__ */
|
|
49
|
+
hasServerMetadata: boolean;
|
|
50
|
+
/** The {@link JsonResultsAdapter} used to process the results of any query against this DataService. __Read Only__ */
|
|
51
|
+
jsonResultsAdapter: JsonResultsAdapter;
|
|
52
|
+
/** Whether to use JSONP when performing a 'GET' request against this service. __Read Only__
|
|
53
|
+
@deprecated No effect on Breeze's own transport, which has no JSONP support. Kept because it is
|
|
54
|
+
part of a serialized DataService, and because a registered (deprecated) ajax adapter can still
|
|
55
|
+
act on the dataType and crossDomain settings it produces. */
|
|
56
|
+
useJsonp: boolean;
|
|
57
|
+
/** DataService constructor
|
|
58
|
+
```ts
|
|
59
|
+
var dataService = new DataService({
|
|
60
|
+
serviceName: altServiceName,
|
|
61
|
+
hasServerMetadata: false
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
var metadataStore = new MetadataStore({
|
|
67
|
+
namingConvention: NamingConvention.camelCase
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
return new EntityManager({
|
|
73
|
+
dataService: dataService,
|
|
74
|
+
metadataStore: metadataStore
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
@param config - A configuration object.
|
|
78
|
+
*/
|
|
79
|
+
constructor(config?: DataServiceConfig);
|
|
80
|
+
/**
|
|
81
|
+
Returns a copy of this DataService with the specified properties applied.
|
|
82
|
+
@param config - The configuration object to apply to create a new DataService.
|
|
83
|
+
*/
|
|
84
|
+
using(config: DataServiceConfig): DataService;
|
|
85
|
+
/**
|
|
86
|
+
Combines several DataServices into one, taking each property from the first of them that has it
|
|
87
|
+
set, and filling in the adapters: the named ones, or the defaults. Breeze uses it to combine a
|
|
88
|
+
query's or save's own DataService with the EntityManager's before each request; applications do
|
|
89
|
+
not normally need it.
|
|
90
|
+
@param dataServices - The DataServices to combine, most specific first. Entries may be null or
|
|
91
|
+
undefined. The array is modified.
|
|
92
|
+
@throws if none of them has a `serviceName`.
|
|
93
|
+
*/
|
|
94
|
+
static resolve(dataServices: DataService[]): DataService;
|
|
95
|
+
/**
|
|
96
|
+
Returns the serializable form of this DataService: `serviceName`, `adapterName`,
|
|
97
|
+
`uriBuilderName`, `hasServerMetadata`, `useJsonp` and the `name` of its `jsonResultsAdapter`,
|
|
98
|
+
leaving out any that are not set. `JSON.stringify` calls it when `MetadataStore.exportMetadata`
|
|
99
|
+
and `EntityManager.exportEntities` serialize their DataServices; {@link DataService.fromJSON}
|
|
100
|
+
reads it back.
|
|
101
|
+
*/
|
|
102
|
+
toJSON(): Object;
|
|
103
|
+
/**
|
|
104
|
+
Creates a DataService from the output of {@link DataService.toJSON}. Used when importing metadata
|
|
105
|
+
and exported entities. The `jsonResultsAdapter` name is looked up among the
|
|
106
|
+
{@link JsonResultsAdapter}s created so far, so create a custom one before importing.
|
|
107
|
+
@param json - A serialized DataService. Its `jsonResultsAdapter` property is replaced.
|
|
108
|
+
@throws if the named `jsonResultsAdapter` does not exist.
|
|
109
|
+
*/
|
|
110
|
+
static fromJSON(json: any): DataService;
|
|
111
|
+
/**
|
|
112
|
+
Returns a url for this dataService with the specified suffix. This method handles dataService names either
|
|
113
|
+
with or without trailing '/'s. If the suffix starts with "http" then it will be returned as-is.
|
|
114
|
+
@param suffix {String} The resulting url.
|
|
115
|
+
@returns {a Url string}
|
|
116
|
+
*/
|
|
117
|
+
qualifyUrl(suffix: string): string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
What a {@link JsonResultsAdapter}'s `visitNode` returns for one node of a query or save result,
|
|
121
|
+
telling Breeze how to treat it. Every property is optional; returning `{}` (or nothing) treats the
|
|
122
|
+
node as plain data.
|
|
123
|
+
*/
|
|
124
|
+
export interface NodeMeta {
|
|
125
|
+
/** The type of entity or complex object this node is, or its name. When set, Breeze materializes the node as an entity of that type and merges it into the cache (unless the query is `noTracking`); a complex type is mapped without merging. For a top-level query result with no type, Breeze uses the query's result type. */
|
|
126
|
+
entityType?: EntityType;
|
|
127
|
+
/** An id for this node, such as a Json.NET `$id`, that other nodes can refer to with `nodeRefId`. */
|
|
128
|
+
nodeId?: string;
|
|
129
|
+
/** The `nodeId` of another node that this node stands for, such as a Json.NET `$ref`. Breeze returns the entity or object read from that node in its place. */
|
|
130
|
+
nodeRefId?: string;
|
|
131
|
+
/** Whether to skip this node. A skipped property is left off the object that holds it; a skipped top-level node is dropped from the results (or is `null` there, when the query includes deleted entities). */
|
|
132
|
+
ignore?: boolean;
|
|
133
|
+
/** Whether to keep the node exactly as the server sent it, without mapping its property names to the client's or visiting what it contains. Ignored for a top-level node that has an `entityType`, which is merged as an entity. */
|
|
134
|
+
passThru?: boolean;
|
|
135
|
+
/** Anything else about the node to keep. Breeze stores it on the entity's `entityAspect.extraMetadata`. */
|
|
136
|
+
extraMetadata?: any;
|
|
137
|
+
/** Use this object in place of the node that was visited. */
|
|
138
|
+
node?: any;
|
|
139
|
+
}
|
|
140
|
+
/** Where a node passed to a {@link JsonResultsAdapter}'s `visitNode` sits in the result. */
|
|
141
|
+
export interface NodeContext {
|
|
142
|
+
/** `"root"` for a top-level result, `"navProp"` or `"navPropItem"` for the value or an item of a navigation property, and `"anonProp"` or `"anonPropItem"` for the value or an item of a property of a plain (non-entity) object. */
|
|
143
|
+
nodeType: string;
|
|
144
|
+
/** For an `"anonProp"` or `"anonPropItem"` node, the client name of the property that holds it. */
|
|
145
|
+
propertyName?: string;
|
|
146
|
+
/** For a `"navProp"` or `"navPropItem"` node, the navigation property that holds it. */
|
|
147
|
+
navigationProperty?: NavigationProperty;
|
|
148
|
+
}
|
|
149
|
+
/** Configuration info to be passed to the {@link JsonResultsAdapter} constructor */
|
|
150
|
+
export interface JsonResultsAdapterConfig {
|
|
151
|
+
/** The name of this adapter. This name is used to uniquely identify and locate this instance when an 'exported' JsonResultsAdapter is later imported. */
|
|
152
|
+
name: string;
|
|
153
|
+
/** A Function that is called once per query operation to extract the 'payload' from any json received over the wire.
|
|
154
|
+
This method has a default implementation which to simply return the "results" property from any json returned as a result of executing the query.
|
|
155
|
+
*/
|
|
156
|
+
extractResults?: Function;
|
|
157
|
+
/** A function that is called once per save operation to extract the entities from any json received over the wire. Must return an array.
|
|
158
|
+
This method has a default implementation which simply returns the "entities" property from any json returned as a result of executing the save. */
|
|
159
|
+
extractSaveResults?: Function;
|
|
160
|
+
/** 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.
|
|
161
|
+
This method has a default implementation which simply returns the "keyMappings" property from any json returned as a result of executing the save. */
|
|
162
|
+
extractKeyMappings?: (data: {}) => KeyMapping[];
|
|
163
|
+
/** 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.
|
|
164
|
+
This method has a default implementation which simply returns an empty array. */
|
|
165
|
+
extractDeletedKeys?: (data: {}) => any[];
|
|
166
|
+
/** A visitor method that will be called on each node of the returned payload. Required.
|
|
167
|
+
Breeze always passes all three arguments. Returning nothing is the same as returning `{}`. */
|
|
168
|
+
visitNode: (node: any, mappingContext: MappingContext, nodeContext: NodeContext) => NodeMeta | null | void;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
A JsonResultsAdapter instance is used to provide custom extraction and parsing logic on the json results returned by any web service.
|
|
172
|
+
This facility makes it possible for breeze to talk to virtually any web service and return objects that will be first class 'breeze' citizens.
|
|
173
|
+
*/
|
|
174
|
+
export declare class JsonResultsAdapter {
|
|
175
|
+
/** The name of this adapter. This name is used to uniquely identify and locate this instance when an 'exported' JsonResultsAdapter is later imported. */
|
|
176
|
+
name: string;
|
|
177
|
+
/** A Function that is called once per query operation to extract the 'payload' from any json received over the wire.
|
|
178
|
+
This method has a default implementation which simply returns the "results" property from any json returned as a result of executing the query. */
|
|
179
|
+
extractResults: Function;
|
|
180
|
+
/** A function that is called once per save operation to extract the entities from any json received over the wire. Must return an array.
|
|
181
|
+
This method has a default implementation which simply returns the "entities" property from any json returned as a result of executing the save. */
|
|
182
|
+
extractSaveResults: Function;
|
|
183
|
+
/** 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.
|
|
184
|
+
This method has a default implementation which simply returns the "keyMappings" property from any json returned as a result of executing the save. */
|
|
185
|
+
extractKeyMappings: (data: {}) => KeyMapping[];
|
|
186
|
+
/** 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.
|
|
187
|
+
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. */
|
|
188
|
+
extractDeletedKeys?: (data: {}) => any[];
|
|
189
|
+
/** A visitor method that will be called on each node of the returned payload. */
|
|
190
|
+
visitNode: Function;
|
|
191
|
+
/**
|
|
192
|
+
JsonResultsAdapter constructor
|
|
193
|
+
|
|
194
|
+
@example
|
|
195
|
+
//
|
|
196
|
+
var jsonResultsAdapter = new JsonResultsAdapter({
|
|
197
|
+
name: "test1e",
|
|
198
|
+
extractResults: function(json) {
|
|
199
|
+
return json.results;
|
|
200
|
+
},
|
|
201
|
+
visitNode: function(node, mappingContext, nodeContext) {
|
|
202
|
+
var entityType = normalizeTypeName(node.$type);
|
|
203
|
+
var propertyName = nodeContext.propertyName;
|
|
204
|
+
var ignore = propertyName && propertyName.substr(0, 1) === "$";
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
entityType: entityType,
|
|
208
|
+
nodeId: node.$id,
|
|
209
|
+
nodeRefId: node.$ref,
|
|
210
|
+
ignore: ignore,
|
|
211
|
+
passThru: false // default
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
var dataService = new DataService( {
|
|
217
|
+
serviceName: "breeze/foo",
|
|
218
|
+
jsonResultsAdapter: jsonResultsAdapter
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
var entityManager = new EntityManager( {
|
|
222
|
+
dataService: dataService
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
@param jsConfig - A configuration object.
|
|
226
|
+
|
|
227
|
+
*/
|
|
228
|
+
constructor(jsConfig: JsonResultsAdapterConfig);
|
|
229
|
+
}
|