angular-odata 0.165.3 → 0.166.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/fesm2022/angular-odata.mjs +231 -184
- package/fesm2022/angular-odata.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/apigen/angular/base.js +4 -4
- package/schematics/apigen/angular/base.js.map +1 -1
- package/schematics/metadata/parser/csdl/csdl-annotation.d.ts +3 -0
- package/schematics/metadata/parser/csdl/csdl-annotation.js +9 -1
- package/schematics/metadata/parser/csdl/csdl-annotation.js.map +1 -1
- package/types/angular-odata.d.ts +22 -33
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpHeaders, HttpParams, HttpResponse, HttpErrorResponse, HttpEventType, provideHttpClient, HttpClient } from '@angular/common/http';
|
|
2
|
-
import { Subject, defer, of, from, ReplaySubject, Subscription, race, EMPTY, throwError, Observable, forkJoin, NEVER, firstValueFrom, map as map$1 } from 'rxjs';
|
|
2
|
+
import { Subject, defer, of, from, ReplaySubject, Subscription, race, EMPTY, throwError, concat, Observable, forkJoin, NEVER, firstValueFrom, map as map$1 } from 'rxjs';
|
|
3
3
|
import { map, tap, catchError, switchMap, finalize, expand, reduce, defaultIfEmpty, startWith } from 'rxjs/operators';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
5
|
import { EventEmitter, Injectable, InjectionToken, provideAppInitializer, inject, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
@@ -256,14 +256,10 @@ const ODataVersionBaseHelper = {
|
|
|
256
256
|
return type;
|
|
257
257
|
},
|
|
258
258
|
mediaEtag(annots) {
|
|
259
|
-
return annots.
|
|
260
|
-
? decodeURIComponent(annots.get(this.ODATA_MEDIA_ETAG))
|
|
261
|
-
: undefined;
|
|
259
|
+
return annots.get(this.ODATA_MEDIA_ETAG);
|
|
262
260
|
},
|
|
263
261
|
metadataEtag(annots) {
|
|
264
|
-
return annots.
|
|
265
|
-
? decodeURIComponent(annots.get(this.ODATA_METADATA_ETAG))
|
|
266
|
-
: undefined;
|
|
262
|
+
return annots.get(this.ODATA_METADATA_ETAG);
|
|
267
263
|
},
|
|
268
264
|
count(annots) {
|
|
269
265
|
return annots.has(this.ODATA_COUNT) ? Number(annots.get(this.ODATA_COUNT)) : undefined;
|
|
@@ -289,39 +285,25 @@ const ODataVersionBaseHelper = {
|
|
|
289
285
|
.reduce((acc, e) => ({ ...acc, [e[0]]: e[1] }), {});
|
|
290
286
|
},
|
|
291
287
|
nextLink(annots) {
|
|
292
|
-
return annots.
|
|
293
|
-
? decodeURIComponent(annots.get(this.ODATA_NEXTLINK))
|
|
294
|
-
: undefined;
|
|
288
|
+
return annots.get(this.ODATA_NEXTLINK);
|
|
295
289
|
},
|
|
296
290
|
readLink(annots) {
|
|
297
|
-
return annots.
|
|
298
|
-
? decodeURIComponent(annots.get(this.ODATA_READLINK))
|
|
299
|
-
: undefined;
|
|
291
|
+
return annots.get(this.ODATA_READLINK);
|
|
300
292
|
},
|
|
301
293
|
mediaReadLink(annots) {
|
|
302
|
-
return annots.
|
|
303
|
-
? decodeURIComponent(annots.get(this.ODATA_MEDIA_READLINK))
|
|
304
|
-
: undefined;
|
|
294
|
+
return annots.get(this.ODATA_MEDIA_READLINK);
|
|
305
295
|
},
|
|
306
296
|
editLink(annots) {
|
|
307
|
-
return annots.
|
|
308
|
-
? decodeURIComponent(annots.get(this.ODATA_EDITLINK))
|
|
309
|
-
: undefined;
|
|
297
|
+
return annots.get(this.ODATA_EDITLINK);
|
|
310
298
|
},
|
|
311
299
|
mediaEditLink(annots) {
|
|
312
|
-
return annots.
|
|
313
|
-
? decodeURIComponent(annots.get(this.ODATA_MEDIA_EDITLINK))
|
|
314
|
-
: undefined;
|
|
300
|
+
return annots.get(this.ODATA_MEDIA_EDITLINK);
|
|
315
301
|
},
|
|
316
302
|
deltaLink(annots) {
|
|
317
|
-
return annots.
|
|
318
|
-
? decodeURIComponent(annots.get(this.ODATA_DELTALINK))
|
|
319
|
-
: undefined;
|
|
303
|
+
return annots.get(this.ODATA_DELTALINK);
|
|
320
304
|
},
|
|
321
305
|
mediaContentType(annots) {
|
|
322
|
-
return annots.
|
|
323
|
-
? decodeURIComponent(annots.get(this.ODATA_MEDIA_CONTENTTYPE))
|
|
324
|
-
: undefined;
|
|
306
|
+
return annots.get(this.ODATA_MEDIA_CONTENTTYPE);
|
|
325
307
|
},
|
|
326
308
|
};
|
|
327
309
|
const ODataHelper = {
|
|
@@ -367,14 +349,6 @@ const ODataHelper = {
|
|
|
367
349
|
ODATA_MEDIA_READLINK: '@odata.mediaReadLink',
|
|
368
350
|
//odata.mediaEditLink: the link used to edit/update the stream
|
|
369
351
|
ODATA_MEDIA_EDITLINK: '@odata.mediaEditLink',
|
|
370
|
-
//http://nb-mdp-dev01:57970/$metadata#recursos/$entity
|
|
371
|
-
//http://nb-mdp-dev01:57970/$metadata#categorias
|
|
372
|
-
//http://nb-mdp-dev01:57970/$metadata#juzgados
|
|
373
|
-
//http://nb-mdp-dev01:57970/$metadata#Collection(SIU.Recursos.RecursoEntry)
|
|
374
|
-
//http://nb-mdp-dev01:57970/$metadata#categorias/$entity
|
|
375
|
-
//http://nb-mdp-dev01:57970/$metadata#categorias(children(children(children(children(children(children(children(children(children(children()))))))))))/$entity
|
|
376
|
-
//http://nb-mdp-dev01:57970/$metadata#recursos/SIU.Documentos.Documento/$entity
|
|
377
|
-
//http://nb-mdp-dev01:57970/$metadata#SIU.Api.Infrastructure.Storage.Backend.SiuUrls
|
|
378
352
|
context(annots) {
|
|
379
353
|
let ctx = {};
|
|
380
354
|
const str = annots instanceof Map ? annots.get(this.ODATA_CONTEXT) : annots[this.ODATA_CONTEXT];
|
|
@@ -2256,17 +2230,18 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
|
|
|
2256
2230
|
return parser.deserialize(value, options);
|
|
2257
2231
|
}
|
|
2258
2232
|
deserialize(value, options) {
|
|
2259
|
-
const
|
|
2233
|
+
const fieldOptions = { field: this, ...this.parserOptions, ...options };
|
|
2260
2234
|
if (this.parser instanceof ODataStructuredTypeParser) {
|
|
2261
2235
|
const parser = this.parser;
|
|
2262
|
-
return Array.isArray(value)
|
|
2263
|
-
? value.map((v) => this.parse(parser, v,
|
|
2264
|
-
: this.parse(parser, value,
|
|
2236
|
+
return (this.collection && Array.isArray(value))
|
|
2237
|
+
? value.map((v) => this.parse(parser, v, fieldOptions))
|
|
2238
|
+
: this.parse(parser, value, fieldOptions);
|
|
2265
2239
|
}
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
}
|
|
2240
|
+
// Collection(EnumType | EdmType): parse each item of the JSON array
|
|
2241
|
+
if (this.collection && Array.isArray(value)) {
|
|
2242
|
+
return value.map((v) => this.parser.deserialize(v, fieldOptions));
|
|
2243
|
+
}
|
|
2244
|
+
return this.parser.deserialize(value, fieldOptions);
|
|
2270
2245
|
}
|
|
2271
2246
|
//#endregion
|
|
2272
2247
|
//#region Serialize
|
|
@@ -2280,26 +2255,26 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
|
|
|
2280
2255
|
return parser.serialize(value, options);
|
|
2281
2256
|
}
|
|
2282
2257
|
serialize(value, options) {
|
|
2283
|
-
const
|
|
2258
|
+
const fieldOptions = { field: this, ...this.parserOptions, ...options };
|
|
2284
2259
|
if (this.parser instanceof ODataStructuredTypeParser) {
|
|
2285
2260
|
const parser = this.parser;
|
|
2286
|
-
return Array.isArray(value)
|
|
2287
|
-
? value.map((v) => this.toJson(parser, v,
|
|
2288
|
-
: this.toJson(parser, value,
|
|
2261
|
+
return (this.collection && Array.isArray(value))
|
|
2262
|
+
? value.map((v) => this.toJson(parser, v, fieldOptions))
|
|
2263
|
+
: this.toJson(parser, value, fieldOptions);
|
|
2289
2264
|
}
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2265
|
+
if (this.collection && Array.isArray(value)) {
|
|
2266
|
+
return value.map((v) => this.parser.serialize(v, fieldOptions));
|
|
2267
|
+
}
|
|
2268
|
+
return this.parser.serialize(value, fieldOptions);
|
|
2294
2269
|
}
|
|
2295
2270
|
//#endregion
|
|
2296
2271
|
//#region Encode
|
|
2297
2272
|
encode(value, options) {
|
|
2298
|
-
const
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2273
|
+
const fieldOptions = { field: this, ...this.parserOptions, ...options };
|
|
2274
|
+
if (this.collection && Array.isArray(value)) {
|
|
2275
|
+
return value.map((v) => this.parser.encode(v, fieldOptions));
|
|
2276
|
+
}
|
|
2277
|
+
return this.parser.encode(value, fieldOptions);
|
|
2303
2278
|
}
|
|
2304
2279
|
//#endregion
|
|
2305
2280
|
configure({ options, optimisticConcurrency, parserForType, }) {
|
|
@@ -7262,6 +7237,52 @@ class ODataMediaResource extends ODataResource {
|
|
|
7262
7237
|
}
|
|
7263
7238
|
}
|
|
7264
7239
|
|
|
7240
|
+
/**
|
|
7241
|
+
* Internal request option. When set, a cache miss of a `cache-only` request
|
|
7242
|
+
* skips the api `errorHandler` and is passed straight to the caller.
|
|
7243
|
+
* Not part of the public API.
|
|
7244
|
+
*/
|
|
7245
|
+
const SILENT_CACHE_MISS = Symbol('angular-odata:silentCacheMiss');
|
|
7246
|
+
/**
|
|
7247
|
+
* Follow the next links of a paged collection and aggregate every page in one result.
|
|
7248
|
+
*
|
|
7249
|
+
* Every page gets its own clone of the resource, so concurrent pages never share state.
|
|
7250
|
+
* With `cache-and-network` (and a cache configured) the pages are walked twice:
|
|
7251
|
+
* first from the cache (emitted only when every page is cached), then from the network.
|
|
7252
|
+
* Every other fetch policy is applied page by page and emits one aggregated result.
|
|
7253
|
+
* @param resource The resource for the first page, with its paging already set
|
|
7254
|
+
* @param fetch Fetch one page of the given resource with the given options
|
|
7255
|
+
* @param options Options for the requests
|
|
7256
|
+
* @returns The aggregated entities and annotations
|
|
7257
|
+
*/
|
|
7258
|
+
function fetchPages(resource, fetch, options = {}) {
|
|
7259
|
+
const api = resource.api;
|
|
7260
|
+
const policy = options.fetchPolicy ?? api.options.fetchPolicy;
|
|
7261
|
+
if (api.cache === undefined || policy !== 'cache-and-network') {
|
|
7262
|
+
return walkPages(resource, fetch, options);
|
|
7263
|
+
}
|
|
7264
|
+
const cached$ = walkPages(resource, fetch, {
|
|
7265
|
+
...options,
|
|
7266
|
+
fetchPolicy: 'cache-only',
|
|
7267
|
+
[SILENT_CACHE_MISS]: true,
|
|
7268
|
+
}).pipe(catchError((error) => (api.isCacheMiss(error) ? EMPTY : throwError(() => error))));
|
|
7269
|
+
const network$ = walkPages(resource, fetch, { ...options, fetchPolicy: 'network-only' });
|
|
7270
|
+
return concat(cached$, network$);
|
|
7271
|
+
}
|
|
7272
|
+
function walkPages(resource, fetch, options) {
|
|
7273
|
+
const page = (res) => fetch(res, options).pipe(map((response) => ({ res, response })));
|
|
7274
|
+
return page(resource).pipe(expand(({ res, response: { annots } }) => {
|
|
7275
|
+
if (!(annots.skip || annots.skiptoken))
|
|
7276
|
+
return EMPTY;
|
|
7277
|
+
const next = res.clone();
|
|
7278
|
+
next.query((q) => q.paging(annots));
|
|
7279
|
+
return page(next);
|
|
7280
|
+
}), map(({ response: { entities, annots } }) => ({ entities: entities ?? [], annots })), reduce((acc, { entities, annots }) => ({
|
|
7281
|
+
entities: [...acc.entities, ...entities],
|
|
7282
|
+
annots: acc.annots.union(annots),
|
|
7283
|
+
})));
|
|
7284
|
+
}
|
|
7285
|
+
|
|
7265
7286
|
class ODataValueResource extends ODataResource {
|
|
7266
7287
|
//#region Factory
|
|
7267
7288
|
static factory(api, { segments, }) {
|
|
@@ -7445,17 +7466,9 @@ class ODataPropertyResource extends ODataResource {
|
|
|
7445
7466
|
})));
|
|
7446
7467
|
}
|
|
7447
7468
|
fetchMany(top, options) {
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
res.query((q) => q.paging(opts));
|
|
7452
|
-
}
|
|
7453
|
-
return res.fetch({ responseType: 'entities', ...options });
|
|
7454
|
-
};
|
|
7455
|
-
return fetch({ top }).pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
|
|
7456
|
-
entities: [...(acc.entities || []), ...(entities || [])],
|
|
7457
|
-
annots: acc.annots.union(annots),
|
|
7458
|
-
})));
|
|
7469
|
+
const res = this.clone();
|
|
7470
|
+
res.query((q) => q.paging({ top }));
|
|
7471
|
+
return fetchPages(res, (r, opts) => r.fetch({ responseType: 'entities', ...opts }), options);
|
|
7459
7472
|
}
|
|
7460
7473
|
/**
|
|
7461
7474
|
* Fetch all entities
|
|
@@ -7463,19 +7476,10 @@ class ODataPropertyResource extends ODataResource {
|
|
|
7463
7476
|
* @returns All entities
|
|
7464
7477
|
*/
|
|
7465
7478
|
fetchAll(options = {}) {
|
|
7466
|
-
|
|
7479
|
+
const res = this.clone();
|
|
7467
7480
|
// Clean Paging
|
|
7468
7481
|
res.query((q) => q.removePaging());
|
|
7469
|
-
|
|
7470
|
-
if (opts) {
|
|
7471
|
-
res.query((q) => q.paging(opts));
|
|
7472
|
-
}
|
|
7473
|
-
return res.fetch({ responseType: 'entities', ...options });
|
|
7474
|
-
};
|
|
7475
|
-
return fetch().pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
|
|
7476
|
-
entities: [...(acc.entities || []), ...(entities || [])],
|
|
7477
|
-
annots: acc.annots.union(annots),
|
|
7478
|
-
})));
|
|
7482
|
+
return fetchPages(res, (r, opts) => r.fetch({ responseType: 'entities', ...opts }), options);
|
|
7479
7483
|
}
|
|
7480
7484
|
}
|
|
7481
7485
|
|
|
@@ -7743,33 +7747,16 @@ class ODataNavigationPropertyResource extends ODataResource {
|
|
|
7743
7747
|
* @returns All entities
|
|
7744
7748
|
*/
|
|
7745
7749
|
fetchAll(options = {}) {
|
|
7746
|
-
|
|
7750
|
+
const res = this.clone();
|
|
7747
7751
|
// Clean Paging
|
|
7748
7752
|
res.query((q) => q.removePaging());
|
|
7749
|
-
|
|
7750
|
-
if (opts) {
|
|
7751
|
-
res.query((q) => q.paging(opts));
|
|
7752
|
-
}
|
|
7753
|
-
return res.fetch({ responseType: 'entities', ...options });
|
|
7754
|
-
};
|
|
7755
|
-
return fetch().pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
|
|
7756
|
-
entities: [...(acc.entities || []), ...(entities || [])],
|
|
7757
|
-
annots: acc.annots.union(annots),
|
|
7758
|
-
})));
|
|
7753
|
+
return fetchPages(res, (r, opts) => r.fetch({ responseType: 'entities', ...opts }), options);
|
|
7759
7754
|
}
|
|
7760
7755
|
//#endregion
|
|
7761
7756
|
fetchMany(top, options) {
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
res.query((q) => q.paging(opts));
|
|
7766
|
-
}
|
|
7767
|
-
return res.fetch({ responseType: 'entities', ...options });
|
|
7768
|
-
};
|
|
7769
|
-
return fetch({ top }).pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
|
|
7770
|
-
entities: [...(acc.entities || []), ...(entities || [])],
|
|
7771
|
-
annots: acc.annots.union(annots),
|
|
7772
|
-
})));
|
|
7757
|
+
const res = this.clone();
|
|
7758
|
+
res.query((q) => q.paging({ top }));
|
|
7759
|
+
return fetchPages(res, (r, opts) => r.fetch({ responseType: 'entities', ...opts }), options);
|
|
7773
7760
|
}
|
|
7774
7761
|
fetchOne(options) {
|
|
7775
7762
|
const res = this.clone();
|
|
@@ -7934,29 +7921,12 @@ class ODataEntitySetResource extends ODataResource {
|
|
|
7934
7921
|
const res = this.clone();
|
|
7935
7922
|
// Clean Paging
|
|
7936
7923
|
res.query((q) => q.removePaging());
|
|
7937
|
-
|
|
7938
|
-
if (opts) {
|
|
7939
|
-
res.query((q) => q.paging(opts));
|
|
7940
|
-
}
|
|
7941
|
-
return res.fetch(options);
|
|
7942
|
-
};
|
|
7943
|
-
return fetch().pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities ?? [], annots })), reduce((acc, { entities, annots }) => ({
|
|
7944
|
-
entities: [...(acc.entities ?? []), ...(entities ?? [])],
|
|
7945
|
-
annots: acc.annots.union(annots),
|
|
7946
|
-
})));
|
|
7924
|
+
return fetchPages(res, (r, opts) => r.fetch(opts), options);
|
|
7947
7925
|
}
|
|
7948
7926
|
fetchMany(top, options) {
|
|
7949
7927
|
const res = this.clone();
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
res.query((q) => q.paging(opts));
|
|
7953
|
-
}
|
|
7954
|
-
return res.fetch(options);
|
|
7955
|
-
};
|
|
7956
|
-
return fetch({ top }).pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities ?? [], annots })), reduce((acc, { entities, annots }) => ({
|
|
7957
|
-
entities: [...(acc.entities ?? []), ...(entities ?? [])],
|
|
7958
|
-
annots: acc.annots.union(annots),
|
|
7959
|
-
})));
|
|
7928
|
+
res.query((q) => q.paging({ top }));
|
|
7929
|
+
return fetchPages(res, (r, opts) => r.fetch(opts), options);
|
|
7960
7930
|
}
|
|
7961
7931
|
fetchOne(options) {
|
|
7962
7932
|
const res = this.clone();
|
|
@@ -10106,25 +10076,67 @@ class ODataEntityAnnotations extends ODataAnnotations {
|
|
|
10106
10076
|
return this.helper.etag(this.annotations);
|
|
10107
10077
|
}
|
|
10108
10078
|
get mediaEtag() {
|
|
10109
|
-
|
|
10079
|
+
const mediaEtag = this.helper.mediaEtag(this.annotations);
|
|
10080
|
+
try {
|
|
10081
|
+
return mediaEtag && decodeURIComponent(mediaEtag);
|
|
10082
|
+
}
|
|
10083
|
+
catch {
|
|
10084
|
+
return mediaEtag;
|
|
10085
|
+
}
|
|
10110
10086
|
}
|
|
10111
10087
|
get metadataEtag() {
|
|
10112
|
-
|
|
10088
|
+
const metadataEtag = this.helper.metadataEtag(this.annotations);
|
|
10089
|
+
try {
|
|
10090
|
+
return metadataEtag && decodeURIComponent(metadataEtag);
|
|
10091
|
+
}
|
|
10092
|
+
catch {
|
|
10093
|
+
return metadataEtag;
|
|
10094
|
+
}
|
|
10113
10095
|
}
|
|
10114
10096
|
get readLink() {
|
|
10115
|
-
|
|
10097
|
+
const readLink = this.helper.readLink(this.annotations);
|
|
10098
|
+
try {
|
|
10099
|
+
return readLink && decodeURIComponent(readLink);
|
|
10100
|
+
}
|
|
10101
|
+
catch {
|
|
10102
|
+
return readLink;
|
|
10103
|
+
}
|
|
10116
10104
|
}
|
|
10117
10105
|
get editLink() {
|
|
10118
|
-
|
|
10106
|
+
const editLink = this.helper.editLink(this.annotations);
|
|
10107
|
+
try {
|
|
10108
|
+
return editLink && decodeURIComponent(editLink);
|
|
10109
|
+
}
|
|
10110
|
+
catch {
|
|
10111
|
+
return editLink;
|
|
10112
|
+
}
|
|
10119
10113
|
}
|
|
10120
10114
|
get mediaReadLink() {
|
|
10121
|
-
|
|
10115
|
+
const mediaReadLink = this.helper.mediaReadLink(this.annotations);
|
|
10116
|
+
try {
|
|
10117
|
+
return mediaReadLink && decodeURIComponent(mediaReadLink);
|
|
10118
|
+
}
|
|
10119
|
+
catch {
|
|
10120
|
+
return mediaReadLink;
|
|
10121
|
+
}
|
|
10122
10122
|
}
|
|
10123
10123
|
get mediaEditLink() {
|
|
10124
|
-
|
|
10124
|
+
const mediaEditLink = this.helper.mediaEditLink(this.annotations);
|
|
10125
|
+
try {
|
|
10126
|
+
return mediaEditLink && decodeURIComponent(mediaEditLink);
|
|
10127
|
+
}
|
|
10128
|
+
catch {
|
|
10129
|
+
return mediaEditLink;
|
|
10130
|
+
}
|
|
10125
10131
|
}
|
|
10126
10132
|
get mediaContentType() {
|
|
10127
|
-
|
|
10133
|
+
const mediaContentType = this.helper.mediaContentType(this.annotations);
|
|
10134
|
+
try {
|
|
10135
|
+
return mediaContentType && decodeURIComponent(mediaContentType);
|
|
10136
|
+
}
|
|
10137
|
+
catch {
|
|
10138
|
+
return mediaContentType;
|
|
10139
|
+
}
|
|
10128
10140
|
}
|
|
10129
10141
|
_properties;
|
|
10130
10142
|
get properties() {
|
|
@@ -10161,28 +10173,54 @@ class ODataEntitiesAnnotations extends ODataAnnotations {
|
|
|
10161
10173
|
return this.helper.entities(data);
|
|
10162
10174
|
}
|
|
10163
10175
|
get readLink() {
|
|
10164
|
-
|
|
10176
|
+
const readLink = this.helper.readLink(this.annotations);
|
|
10177
|
+
try {
|
|
10178
|
+
return readLink && decodeURIComponent(readLink);
|
|
10179
|
+
}
|
|
10180
|
+
catch {
|
|
10181
|
+
return readLink;
|
|
10182
|
+
}
|
|
10165
10183
|
}
|
|
10166
10184
|
get count() {
|
|
10167
10185
|
return this.helper.count(this.annotations);
|
|
10168
10186
|
}
|
|
10169
10187
|
get nextLink() {
|
|
10170
|
-
|
|
10188
|
+
const nextLink = this.helper.nextLink(this.annotations);
|
|
10189
|
+
try {
|
|
10190
|
+
return nextLink && decodeURIComponent(nextLink);
|
|
10191
|
+
}
|
|
10192
|
+
catch {
|
|
10193
|
+
return nextLink;
|
|
10194
|
+
}
|
|
10171
10195
|
}
|
|
10172
10196
|
get deltaLink() {
|
|
10173
|
-
|
|
10197
|
+
const deltaLink = this.helper.deltaLink(this.annotations);
|
|
10198
|
+
try {
|
|
10199
|
+
return deltaLink && decodeURIComponent(deltaLink);
|
|
10200
|
+
}
|
|
10201
|
+
catch {
|
|
10202
|
+
return deltaLink;
|
|
10203
|
+
}
|
|
10174
10204
|
}
|
|
10175
10205
|
get top() {
|
|
10176
|
-
let match = (this.nextLink
|
|
10206
|
+
let match = (this.nextLink ?? '').match(/[?&](?:\$|%24)top=(\d+)/i);
|
|
10177
10207
|
return match !== null ? Number(match[1]) : undefined;
|
|
10178
10208
|
}
|
|
10179
10209
|
get skip() {
|
|
10180
|
-
let match = (this.nextLink
|
|
10210
|
+
let match = (this.nextLink ?? '').match(/[?&](?:\$|%24)skip=(\d+)/i);
|
|
10181
10211
|
return match !== null ? Number(match[1]) : undefined;
|
|
10182
10212
|
}
|
|
10183
10213
|
get skiptoken() {
|
|
10184
|
-
|
|
10185
|
-
|
|
10214
|
+
const nextLink = this.helper.nextLink(this.annotations);
|
|
10215
|
+
let match = (nextLink ?? '').match(/[?&](?:\$|%24)skiptoken=([^&#]*)/i);
|
|
10216
|
+
if (match === null)
|
|
10217
|
+
return undefined;
|
|
10218
|
+
try {
|
|
10219
|
+
return decodeURIComponent(match[1]);
|
|
10220
|
+
}
|
|
10221
|
+
catch {
|
|
10222
|
+
return match[1];
|
|
10223
|
+
}
|
|
10186
10224
|
}
|
|
10187
10225
|
_functions;
|
|
10188
10226
|
get functions() {
|
|
@@ -10469,7 +10507,7 @@ class ODataCollection {
|
|
|
10469
10507
|
_entries = [];
|
|
10470
10508
|
_model;
|
|
10471
10509
|
models() {
|
|
10472
|
-
return this._entries.filter((e) => e.state !== ODataModelState.
|
|
10510
|
+
return this._entries.filter((e) => e.state !== ODataModelState.Deleted).map((e) => e.model);
|
|
10473
10511
|
}
|
|
10474
10512
|
get length() {
|
|
10475
10513
|
return this.models().length;
|
|
@@ -10591,7 +10629,7 @@ class ODataCollection {
|
|
|
10591
10629
|
}
|
|
10592
10630
|
toEntities({ client_id = false, include_navigation = false, include_concurrency = false, include_computed = false, include_key = true, include_id = false, include_non_field = false, changes_only = false, field_mapping = false, chain = [], } = {}) {
|
|
10593
10631
|
return this._entries
|
|
10594
|
-
.filter(({ model, state }) => state !== ODataModelState.
|
|
10632
|
+
.filter(({ model, state }) => state !== ODataModelState.Deleted && chain.every((c) => c !== model))
|
|
10595
10633
|
.map(({ model, state }) => {
|
|
10596
10634
|
var changesOnly = changes_only && state !== ODataModelState.Added;
|
|
10597
10635
|
return model.toEntity({
|
|
@@ -10611,9 +10649,9 @@ class ODataCollection {
|
|
|
10611
10649
|
toJson() {
|
|
10612
10650
|
return this.toEntities(INCLUDE_DEEP);
|
|
10613
10651
|
}
|
|
10614
|
-
|
|
10652
|
+
isModified({ include_navigation } = {}) {
|
|
10615
10653
|
return (this._entries.some((e) => e.state !== ODataModelState.Unchanged) ||
|
|
10616
|
-
this.models().some((m) => m.
|
|
10654
|
+
this.models().some((m) => m.isModified({ include_navigation })));
|
|
10617
10655
|
}
|
|
10618
10656
|
clone() {
|
|
10619
10657
|
return new this.constructor(this.toEntities(INCLUDE_DEEP), {
|
|
@@ -10723,7 +10761,7 @@ class ODataCollection {
|
|
|
10723
10761
|
const toUpdateEntity = [];
|
|
10724
10762
|
const toUpdateContained = [];
|
|
10725
10763
|
this._entries.forEach(({ model, state }) => {
|
|
10726
|
-
if (state === ODataModelState.
|
|
10764
|
+
if (state === ODataModelState.Deleted) {
|
|
10727
10765
|
if (relModel) {
|
|
10728
10766
|
toDestroyEntity.push(model);
|
|
10729
10767
|
}
|
|
@@ -10745,7 +10783,7 @@ class ODataCollection {
|
|
|
10745
10783
|
toCreateContained.push(model);
|
|
10746
10784
|
}
|
|
10747
10785
|
}
|
|
10748
|
-
else if (model.
|
|
10786
|
+
else if (model.isModified()) {
|
|
10749
10787
|
toUpdateEntity.push(model);
|
|
10750
10788
|
}
|
|
10751
10789
|
});
|
|
@@ -10769,7 +10807,7 @@ class ODataCollection {
|
|
|
10769
10807
|
]).pipe(defaultIfEmpty(null));
|
|
10770
10808
|
return this._request(obs$, () => {
|
|
10771
10809
|
this._entries = this._entries
|
|
10772
|
-
.filter((entry) => entry.state !== ODataModelState.
|
|
10810
|
+
.filter((entry) => entry.state !== ODataModelState.Deleted)
|
|
10773
10811
|
.map((entry) => ({ ...entry, state: ODataModelState.Unchanged }));
|
|
10774
10812
|
return this.models();
|
|
10775
10813
|
});
|
|
@@ -10803,13 +10841,13 @@ class ODataCollection {
|
|
|
10803
10841
|
}
|
|
10804
10842
|
_addModel(model, { silent = false, reset = false, reparent = false, merge = false, position, } = {}) {
|
|
10805
10843
|
let entry = this._findEntry(model);
|
|
10806
|
-
if (entry !== undefined && entry.state !== ODataModelState.
|
|
10844
|
+
if (entry !== undefined && entry.state !== ODataModelState.Deleted) {
|
|
10807
10845
|
if (merge) {
|
|
10808
10846
|
entry.model.assign(model.toEntity(INCLUDE_DEEP));
|
|
10809
10847
|
}
|
|
10810
10848
|
return entry.model;
|
|
10811
10849
|
}
|
|
10812
|
-
if (entry !== undefined && entry.state === ODataModelState.
|
|
10850
|
+
if (entry !== undefined && entry.state === ODataModelState.Deleted) {
|
|
10813
10851
|
const index = this._entries.indexOf(entry);
|
|
10814
10852
|
this._entries.splice(index, 1);
|
|
10815
10853
|
}
|
|
@@ -10882,7 +10920,7 @@ class ODataCollection {
|
|
|
10882
10920
|
}
|
|
10883
10921
|
_removeModel(model, { silent = false, reset = false } = {}) {
|
|
10884
10922
|
const entry = this._findEntry(model);
|
|
10885
|
-
if (entry === undefined || entry.state === ODataModelState.
|
|
10923
|
+
if (entry === undefined || entry.state === ODataModelState.Deleted) {
|
|
10886
10924
|
return model;
|
|
10887
10925
|
}
|
|
10888
10926
|
// Now remove
|
|
@@ -10890,7 +10928,7 @@ class ODataCollection {
|
|
|
10890
10928
|
this._entries.splice(index, 1);
|
|
10891
10929
|
if (!(reset || entry.state === ODataModelState.Added)) {
|
|
10892
10930
|
// Move to end of array and mark as removed
|
|
10893
|
-
entry.state = ODataModelState.
|
|
10931
|
+
entry.state = ODataModelState.Deleted;
|
|
10894
10932
|
this._entries.push(entry);
|
|
10895
10933
|
}
|
|
10896
10934
|
// Trigger Event
|
|
@@ -10911,7 +10949,7 @@ class ODataCollection {
|
|
|
10911
10949
|
}
|
|
10912
10950
|
_moveModel(model, position) {
|
|
10913
10951
|
const entry = this._findEntry(model);
|
|
10914
|
-
if (entry === undefined || entry.state === ODataModelState.
|
|
10952
|
+
if (entry === undefined || entry.state === ODataModelState.Deleted) {
|
|
10915
10953
|
return model;
|
|
10916
10954
|
}
|
|
10917
10955
|
// Now remove
|
|
@@ -10972,7 +11010,7 @@ class ODataCollection {
|
|
|
10972
11010
|
const model = this.models()[index];
|
|
10973
11011
|
if (ODataModelOptions.isModel(model)) {
|
|
10974
11012
|
const entry = this._findEntry(model);
|
|
10975
|
-
if (entry.state === ODataModelState.Unchanged && entry.model.
|
|
11013
|
+
if (entry.state === ODataModelState.Unchanged && entry.model.isModified()) {
|
|
10976
11014
|
toChange = [entry];
|
|
10977
11015
|
}
|
|
10978
11016
|
path = pathArray.slice(1);
|
|
@@ -10981,8 +11019,8 @@ class ODataCollection {
|
|
|
10981
11019
|
}
|
|
10982
11020
|
else {
|
|
10983
11021
|
// Reset all
|
|
10984
|
-
toAdd = this._entries.filter((e) => e.state === ODataModelState.
|
|
10985
|
-
toChange = this._entries.filter((e) => e.state === ODataModelState.Unchanged && e.model.
|
|
11022
|
+
toAdd = this._entries.filter((e) => e.state === ODataModelState.Deleted);
|
|
11023
|
+
toChange = this._entries.filter((e) => e.state === ODataModelState.Unchanged && e.model.isModified());
|
|
10986
11024
|
toRemove = this._entries.filter((e) => e.state === ODataModelState.Added);
|
|
10987
11025
|
}
|
|
10988
11026
|
toRemove.forEach((entry) => {
|
|
@@ -11040,7 +11078,7 @@ class ODataCollection {
|
|
|
11040
11078
|
: obj;
|
|
11041
11079
|
entry.model.assign(entity, { add, merge, remove, reset, silent });
|
|
11042
11080
|
// Model Change?
|
|
11043
|
-
if (entry.model.
|
|
11081
|
+
if (entry.model.isModified())
|
|
11044
11082
|
toMerge.push(entry.model);
|
|
11045
11083
|
}
|
|
11046
11084
|
if (reset)
|
|
@@ -11280,6 +11318,7 @@ class ODataModel {
|
|
|
11280
11318
|
_resources = [];
|
|
11281
11319
|
_attributes = new Map();
|
|
11282
11320
|
_annotations;
|
|
11321
|
+
_state = ODataModelState.Detached;
|
|
11283
11322
|
_meta;
|
|
11284
11323
|
// Events
|
|
11285
11324
|
events$;
|
|
@@ -11574,8 +11613,8 @@ class ODataModel {
|
|
|
11574
11613
|
* @param include_navigation Check in navigation properties
|
|
11575
11614
|
* @returns true if the model has changed, false otherwise
|
|
11576
11615
|
*/
|
|
11577
|
-
|
|
11578
|
-
return this._meta.
|
|
11616
|
+
isModified({ include_navigation = false } = {}) {
|
|
11617
|
+
return this._meta.isModified(this, { include_navigation });
|
|
11579
11618
|
}
|
|
11580
11619
|
encode(name, options) {
|
|
11581
11620
|
const value = this[name];
|
|
@@ -11585,7 +11624,7 @@ class ODataModel {
|
|
|
11585
11624
|
return field ? field.encode(value, options) : value;
|
|
11586
11625
|
}
|
|
11587
11626
|
isNew() {
|
|
11588
|
-
return !this._meta.
|
|
11627
|
+
return !this._meta.isNew(this);
|
|
11589
11628
|
}
|
|
11590
11629
|
isCompoundKey() {
|
|
11591
11630
|
return this.schema().isCompoundKey();
|
|
@@ -11952,9 +11991,10 @@ const INCLUDE_DEEP = {
|
|
|
11952
11991
|
var ODataModelState;
|
|
11953
11992
|
(function (ODataModelState) {
|
|
11954
11993
|
ODataModelState[ODataModelState["Added"] = 0] = "Added";
|
|
11955
|
-
ODataModelState[ODataModelState["
|
|
11956
|
-
ODataModelState[ODataModelState["
|
|
11994
|
+
ODataModelState[ODataModelState["Deleted"] = 1] = "Deleted";
|
|
11995
|
+
ODataModelState[ODataModelState["Modified"] = 2] = "Modified";
|
|
11957
11996
|
ODataModelState[ODataModelState["Unchanged"] = 3] = "Unchanged";
|
|
11997
|
+
ODataModelState[ODataModelState["Detached"] = 4] = "Detached";
|
|
11958
11998
|
})(ODataModelState || (ODataModelState = {}));
|
|
11959
11999
|
function Model({ cid = CID_FIELD_NAME } = {}) {
|
|
11960
12000
|
return (constructor) => {
|
|
@@ -12191,13 +12231,13 @@ class ODataModelAttribute {
|
|
|
12191
12231
|
return this._field.isStructuredType();
|
|
12192
12232
|
}
|
|
12193
12233
|
get() {
|
|
12194
|
-
return this.state === ODataModelState.
|
|
12234
|
+
return this.state === ODataModelState.Modified ? this.change : this.value;
|
|
12195
12235
|
}
|
|
12196
12236
|
set(value, reset = false, reparent = false) {
|
|
12197
12237
|
const current = this.get();
|
|
12198
12238
|
if (ODataModelOptions.isModel(current) || ODataModelOptions.isCollection(current))
|
|
12199
12239
|
this.unlink(current);
|
|
12200
|
-
const
|
|
12240
|
+
const modified = ODataModelOptions.isModel(current) && ODataModelOptions.isModel(value)
|
|
12201
12241
|
? !current.equals(value)
|
|
12202
12242
|
: ODataModelOptions.isCollection(current) && ODataModelOptions.isCollection(value)
|
|
12203
12243
|
? !current.equals(value)
|
|
@@ -12209,20 +12249,20 @@ class ODataModelAttribute {
|
|
|
12209
12249
|
else if (Types.isEqual(value, this.value)) {
|
|
12210
12250
|
this.state = ODataModelState.Unchanged;
|
|
12211
12251
|
}
|
|
12212
|
-
else if (
|
|
12252
|
+
else if (modified) {
|
|
12213
12253
|
this.change = value;
|
|
12214
|
-
this.state = ODataModelState.
|
|
12254
|
+
this.state = current !== undefined ? ODataModelState.Modified : ODataModelState.Added;
|
|
12215
12255
|
}
|
|
12216
12256
|
if (ODataModelOptions.isModel(value) || ODataModelOptions.isCollection(value)) {
|
|
12217
12257
|
this.link(value, reparent);
|
|
12218
12258
|
}
|
|
12219
|
-
return
|
|
12259
|
+
return modified;
|
|
12220
12260
|
}
|
|
12221
|
-
|
|
12261
|
+
isModified({ include_navigation = false } = {}) {
|
|
12222
12262
|
const current = this.get();
|
|
12223
|
-
return (this.state
|
|
12263
|
+
return (this.state !== ODataModelState.Unchanged ||
|
|
12224
12264
|
((ODataModelOptions.isModel(current) || ODataModelOptions.isCollection(current)) &&
|
|
12225
|
-
current.
|
|
12265
|
+
current.isModified({
|
|
12226
12266
|
include_navigation,
|
|
12227
12267
|
})));
|
|
12228
12268
|
}
|
|
@@ -12619,12 +12659,12 @@ class ODataModelOptions {
|
|
|
12619
12659
|
}, {});
|
|
12620
12660
|
return !Types.isEmpty(defs) ? defs : undefined;
|
|
12621
12661
|
}
|
|
12622
|
-
|
|
12662
|
+
isModified(self, { include_navigation = false } = {}) {
|
|
12623
12663
|
return [...self._attributes.values()]
|
|
12624
12664
|
.filter((attr) => !attr.navigation || include_navigation)
|
|
12625
|
-
.some((attr) => attr.
|
|
12665
|
+
.some((attr) => attr.isModified({ include_navigation }));
|
|
12626
12666
|
}
|
|
12627
|
-
|
|
12667
|
+
isNew(self) {
|
|
12628
12668
|
return this.resolveKey(self) !== undefined;
|
|
12629
12669
|
}
|
|
12630
12670
|
withResource(self, resource, ctx) {
|
|
@@ -12658,7 +12698,7 @@ class ODataModelOptions {
|
|
|
12658
12698
|
(attr) => chain.every((c) => c !== attr.get()))
|
|
12659
12699
|
.filter(
|
|
12660
12700
|
// Changes only
|
|
12661
|
-
(attr) => !changes_only || (changes_only && attr.
|
|
12701
|
+
(attr) => !changes_only || (changes_only && attr.isModified({ include_navigation })))
|
|
12662
12702
|
.filter((attr) =>
|
|
12663
12703
|
// Navigation
|
|
12664
12704
|
(include_navigation && attr.navigation && attr.get() !== null) || !attr.navigation)
|
|
@@ -12702,7 +12742,7 @@ class ODataModelOptions {
|
|
|
12702
12742
|
else if (include_computed && computed) {
|
|
12703
12743
|
return Object.assign(acc, { [name]: value });
|
|
12704
12744
|
}
|
|
12705
|
-
else if (changes_only && attr.
|
|
12745
|
+
else if (changes_only && attr.isModified()) {
|
|
12706
12746
|
return Object.assign(acc, { [name]: value });
|
|
12707
12747
|
}
|
|
12708
12748
|
else if (!changes_only && !concurrency && !computed) {
|
|
@@ -12753,11 +12793,11 @@ class ODataModelOptions {
|
|
|
12753
12793
|
if (name !== undefined) {
|
|
12754
12794
|
// Reset value
|
|
12755
12795
|
const attribute = self._attributes.get(name);
|
|
12756
|
-
if (attribute !== undefined && attribute.
|
|
12796
|
+
if (attribute !== undefined && attribute.isModified({ include_navigation: true })) {
|
|
12757
12797
|
attribute.reset();
|
|
12758
12798
|
changes = [name];
|
|
12759
12799
|
}
|
|
12760
|
-
else if (attribute?.
|
|
12800
|
+
else if (attribute?.isModified()) {
|
|
12761
12801
|
attribute.reset();
|
|
12762
12802
|
changes = [name];
|
|
12763
12803
|
}
|
|
@@ -12767,7 +12807,7 @@ class ODataModelOptions {
|
|
|
12767
12807
|
changes = [...self._attributes.keys()];
|
|
12768
12808
|
//self._changes.clear();
|
|
12769
12809
|
self._attributes.forEach((attr, key) => {
|
|
12770
|
-
if (attr.
|
|
12810
|
+
if (attr.isModified({ include_navigation: true })) {
|
|
12771
12811
|
attr.reset();
|
|
12772
12812
|
changes.push(key);
|
|
12773
12813
|
}
|
|
@@ -12813,6 +12853,8 @@ class ODataModelOptions {
|
|
|
12813
12853
|
options: { changes },
|
|
12814
12854
|
});
|
|
12815
12855
|
}
|
|
12856
|
+
if (reset)
|
|
12857
|
+
self._state = ODataModelState.Unchanged;
|
|
12816
12858
|
return self;
|
|
12817
12859
|
}
|
|
12818
12860
|
static isModel(obj) {
|
|
@@ -12859,7 +12901,7 @@ class ODataModelOptions {
|
|
|
12859
12901
|
}
|
|
12860
12902
|
if (modelField === undefined)
|
|
12861
12903
|
throw new Error(`No field with name ${field}`);
|
|
12862
|
-
let
|
|
12904
|
+
let modified = false;
|
|
12863
12905
|
let attr = self._attributes.get(modelField.name);
|
|
12864
12906
|
// Ensures that the attribute exists
|
|
12865
12907
|
if (attr === undefined) {
|
|
@@ -12871,14 +12913,14 @@ class ODataModelOptions {
|
|
|
12871
12913
|
if (modelField.isStructuredType()) {
|
|
12872
12914
|
if (value === null) {
|
|
12873
12915
|
// New value is null
|
|
12874
|
-
|
|
12916
|
+
modified = attr.set(value, reset, reparent);
|
|
12875
12917
|
}
|
|
12876
12918
|
else if (ODataModelOptions.isCollection(current)) {
|
|
12877
12919
|
// Current is collection
|
|
12878
12920
|
const currentCollection = current;
|
|
12879
12921
|
if (ODataModelOptions.isCollection(value)) {
|
|
12880
12922
|
// New value is collection
|
|
12881
|
-
|
|
12923
|
+
modified = attr.set(value, reset, reparent);
|
|
12882
12924
|
}
|
|
12883
12925
|
else if (Types.isArray(value)) {
|
|
12884
12926
|
// New value is array
|
|
@@ -12891,7 +12933,7 @@ class ODataModelOptions {
|
|
|
12891
12933
|
reparent,
|
|
12892
12934
|
silent,
|
|
12893
12935
|
});
|
|
12894
|
-
|
|
12936
|
+
modified = currentCollection.isModified();
|
|
12895
12937
|
}
|
|
12896
12938
|
}
|
|
12897
12939
|
else if (ODataModelOptions.isModel(current)) {
|
|
@@ -12899,7 +12941,7 @@ class ODataModelOptions {
|
|
|
12899
12941
|
const currentModel = current;
|
|
12900
12942
|
if (ODataModelOptions.isModel(value)) {
|
|
12901
12943
|
// New value is model
|
|
12902
|
-
|
|
12944
|
+
modified = attr.set(value, reset, reparent);
|
|
12903
12945
|
}
|
|
12904
12946
|
else if (Types.isPlainObject(value)) {
|
|
12905
12947
|
currentModel._annotations = modelField.annotationsFactory(self.annots());
|
|
@@ -12911,13 +12953,13 @@ class ODataModelOptions {
|
|
|
12911
12953
|
reparent,
|
|
12912
12954
|
silent,
|
|
12913
12955
|
});
|
|
12914
|
-
|
|
12956
|
+
modified = currentModel.isModified();
|
|
12915
12957
|
}
|
|
12916
12958
|
}
|
|
12917
12959
|
else {
|
|
12918
12960
|
// Current is null or undefined
|
|
12919
12961
|
// create new model/collection for given value
|
|
12920
|
-
|
|
12962
|
+
modified = attr.set(ODataModelOptions.isCollection(value) || ODataModelOptions.isModel(value)
|
|
12921
12963
|
? value
|
|
12922
12964
|
: modelField.collection
|
|
12923
12965
|
? modelField.collectionFactory({
|
|
@@ -12945,9 +12987,9 @@ class ODataModelOptions {
|
|
|
12945
12987
|
}
|
|
12946
12988
|
}
|
|
12947
12989
|
else {
|
|
12948
|
-
|
|
12990
|
+
modified = attr.set(value, reset, reparent);
|
|
12949
12991
|
}
|
|
12950
|
-
if (!silent &&
|
|
12992
|
+
if (!silent && modified) {
|
|
12951
12993
|
self.events$.trigger(ODataModelEventType.Change, {
|
|
12952
12994
|
attr,
|
|
12953
12995
|
value,
|
|
@@ -12955,7 +12997,7 @@ class ODataModelOptions {
|
|
|
12955
12997
|
options: { key: modelField.isKey() },
|
|
12956
12998
|
});
|
|
12957
12999
|
}
|
|
12958
|
-
return
|
|
13000
|
+
return modified;
|
|
12959
13001
|
}
|
|
12960
13002
|
_link(self, attr) {
|
|
12961
13003
|
attr.events$.subscribe((event) => {
|
|
@@ -13321,8 +13363,13 @@ class ODataApi {
|
|
|
13321
13363
|
withCredentials: options.withCredentials,
|
|
13322
13364
|
});
|
|
13323
13365
|
let res$ = this.handleRequest(req);
|
|
13324
|
-
if (this.errorHandler !== undefined)
|
|
13325
|
-
|
|
13366
|
+
if (this.errorHandler !== undefined) {
|
|
13367
|
+
const errorHandler = this.errorHandler;
|
|
13368
|
+
const silentCacheMiss = options[SILENT_CACHE_MISS] === true;
|
|
13369
|
+
res$ = res$.pipe(catchError((error, caught) => silentCacheMiss && this.isCacheMiss(error)
|
|
13370
|
+
? throwError(() => error)
|
|
13371
|
+
: errorHandler(error, caught)));
|
|
13372
|
+
}
|
|
13326
13373
|
if (options.observe === 'events') {
|
|
13327
13374
|
return res$;
|
|
13328
13375
|
}
|