angular-odata 0.128.0 → 0.131.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/README.md +27 -244
- package/fesm2022/angular-odata.mjs +2320 -1118
- package/fesm2022/angular-odata.mjs.map +1 -1
- package/lib/api.d.ts +10 -11
- package/lib/cache/cache.d.ts +2 -2
- package/lib/cache/memory.d.ts +2 -2
- package/lib/cache/storage.d.ts +2 -2
- package/lib/index.d.ts +1 -0
- package/lib/loaders.d.ts +8 -8
- package/lib/metadata/csdl/csdl-annotation.d.ts +62 -26
- package/lib/metadata/csdl/csdl-entity-container.d.ts +8 -3
- package/lib/metadata/csdl/csdl-entity-set.d.ts +7 -2
- package/lib/metadata/csdl/csdl-enum-type.d.ts +11 -3
- package/lib/metadata/csdl/csdl-function-action.d.ts +54 -11
- package/lib/metadata/csdl/csdl-navigation-property-binding.d.ts +4 -0
- package/lib/metadata/csdl/csdl-reference.d.ts +26 -3
- package/lib/metadata/csdl/csdl-schema.d.ts +5 -2
- package/lib/metadata/csdl/csdl-singleton.d.ts +5 -0
- package/lib/metadata/csdl/csdl-structural-property.d.ts +19 -3
- package/lib/metadata/csdl/csdl-structured-type.d.ts +28 -7
- package/lib/metadata/csdl/csdl-type-definition.d.ts +3 -0
- package/lib/metadata/metadata.d.ts +16 -3
- package/lib/models/collection.d.ts +2 -1
- package/lib/models/model.d.ts +6 -5
- package/lib/models/options.d.ts +11 -4
- package/lib/module.d.ts +3 -3
- package/lib/options.d.ts +3 -3
- package/lib/resources/path/segments.d.ts +3 -3
- package/lib/resources/query/builder.d.ts +3 -2
- package/lib/resources/query/expressions/apply.d.ts +1 -1
- package/lib/resources/query/expressions/compute.d.ts +1 -1
- package/lib/resources/query/expressions/count.d.ts +1 -1
- package/lib/resources/query/expressions/expand.d.ts +5 -2
- package/lib/resources/query/expressions/filter.d.ts +2 -1
- package/lib/resources/query/expressions/orderby.d.ts +2 -1
- package/lib/resources/query/expressions/search.d.ts +2 -1
- package/lib/resources/query/expressions/select.d.ts +2 -1
- package/lib/resources/query/expressions/syntax.d.ts +2 -2
- package/lib/resources/query/handlers.d.ts +17 -5
- package/lib/resources/query/options.d.ts +3 -3
- package/lib/resources/resource.d.ts +36 -8
- package/lib/resources/types/action.d.ts +4 -4
- package/lib/resources/types/entity-set.d.ts +15 -8
- package/lib/resources/types/entity.d.ts +5 -1
- package/lib/resources/types/function.d.ts +4 -4
- package/lib/resources/types/navigation-property.d.ts +12 -3
- package/lib/resources/types/property.d.ts +14 -3
- package/lib/resources/types/singleton.d.ts +5 -1
- package/lib/schema/annotation.d.ts +3 -3
- package/lib/schema/callable.d.ts +3 -3
- package/lib/schema/element.d.ts +3 -3
- package/lib/schema/entity-container.d.ts +2 -2
- package/lib/schema/entity-set.d.ts +2 -2
- package/lib/schema/enum-type.d.ts +10 -10
- package/lib/schema/parsers/callable.d.ts +4 -4
- package/lib/schema/parsers/enum-type.d.ts +15 -15
- package/lib/schema/parsers/structured-type.d.ts +8 -5
- package/lib/schema/schema.d.ts +3 -3
- package/lib/schema/singleton.d.ts +2 -2
- package/lib/schema/structured-type.d.ts +7 -4
- package/lib/services/entity-set.d.ts +9 -6
- package/lib/services/entity.d.ts +1 -1
- package/lib/services/singleton.d.ts +1 -1
- package/lib/settings.d.ts +2 -2
- package/lib/types.d.ts +82 -69
- package/lib/utils/enums.d.ts +12 -12
- package/lib/utils/http.d.ts +1 -1
- package/lib/utils/objects.d.ts +1 -1
- package/lib/utils/odata.d.ts +2 -2
- package/lib/utils/strings.d.ts +2 -2
- package/package.json +3 -5
- package/schematics/apigen/angular/api-config.js +7 -1
- package/schematics/apigen/angular/api-config.js.map +1 -1
- package/schematics/apigen/angular/base.d.ts +22 -2
- package/schematics/apigen/angular/base.js +82 -42
- package/schematics/apigen/angular/base.js.map +1 -1
- package/schematics/apigen/angular/entity.js +7 -1
- package/schematics/apigen/angular/entity.js.map +1 -1
- package/schematics/apigen/angular/enum.js +1 -0
- package/schematics/apigen/angular/enum.js.map +1 -1
- package/schematics/apigen/angular/module.js.map +1 -1
- package/schematics/apigen/angular/service.js +3 -2
- package/schematics/apigen/angular/service.js.map +1 -1
- package/schematics/apigen/files/api-config/__fileName__.ts +8 -6
- package/schematics/apigen/files/entity/__fileName__.ts +2 -2
- package/schematics/apigen/files/entitycontainer-service/__fileName__.ts +1 -1
- package/schematics/apigen/files/entityset-service/__fileName__.ts +1 -1
- package/schematics/apigen/files/enum/__fileName__.ts +1 -1
- package/schematics/apigen/files/metadata/metadata.json +1 -0
- package/schematics/apigen/files/singleton-service/__fileName__.ts +1 -1
- package/schematics/apigen/index.js +56 -12
- package/schematics/apigen/index.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-annotation.d.ts +56 -23
- package/schematics/apigen/metadata/csdl/csdl-annotation.js +143 -13
- package/schematics/apigen/metadata/csdl/csdl-annotation.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-entity-container.d.ts +3 -0
- package/schematics/apigen/metadata/csdl/csdl-entity-container.js +19 -0
- package/schematics/apigen/metadata/csdl/csdl-entity-container.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-entity-set.d.ts +3 -0
- package/schematics/apigen/metadata/csdl/csdl-entity-set.js +11 -0
- package/schematics/apigen/metadata/csdl/csdl-entity-set.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-enum-type.d.ts +6 -0
- package/schematics/apigen/metadata/csdl/csdl-enum-type.js +17 -0
- package/schematics/apigen/metadata/csdl/csdl-enum-type.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-function-action.d.ts +37 -0
- package/schematics/apigen/metadata/csdl/csdl-function-action.js +52 -0
- package/schematics/apigen/metadata/csdl/csdl-function-action.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.d.ts +4 -0
- package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.js +6 -0
- package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-reference.d.ts +15 -3
- package/schematics/apigen/metadata/csdl/csdl-reference.js +26 -2
- package/schematics/apigen/metadata/csdl/csdl-reference.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-schema.d.ts +3 -0
- package/schematics/apigen/metadata/csdl/csdl-schema.js +37 -0
- package/schematics/apigen/metadata/csdl/csdl-schema.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-singleton.d.ts +3 -0
- package/schematics/apigen/metadata/csdl/csdl-singleton.js +8 -0
- package/schematics/apigen/metadata/csdl/csdl-singleton.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-structural-property.d.ts +16 -0
- package/schematics/apigen/metadata/csdl/csdl-structural-property.js +53 -0
- package/schematics/apigen/metadata/csdl/csdl-structural-property.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-structured-type.d.ts +22 -3
- package/schematics/apigen/metadata/csdl/csdl-structured-type.js +47 -2
- package/schematics/apigen/metadata/csdl/csdl-structured-type.js.map +1 -1
- package/schematics/apigen/metadata/csdl/csdl-type-definition.d.ts +3 -0
- package/schematics/apigen/metadata/csdl/csdl-type-definition.js +19 -0
- package/schematics/apigen/metadata/csdl/csdl-type-definition.js.map +1 -1
- package/schematics/apigen/metadata/metadata.d.ts +10 -0
- package/schematics/apigen/metadata/metadata.js +12 -6
- package/schematics/apigen/metadata/metadata.js.map +1 -1
- package/schematics/apigen/metadata/parser.js.map +1 -1
- package/schematics/apigen/schema.d.ts +2 -1
- package/schematics/apigen/schema.json +15 -14
- package/schematics/apigen/utils.d.ts +1 -0
- package/schematics/apigen/utils.js +25 -1
- package/schematics/apigen/utils.js.map +1 -1
- package/schematics/ng-add/index.js +1 -2
- package/schematics/ng-add/index.js.map +1 -1
- package/esm2022/angular-odata.mjs +0 -5
- package/esm2022/lib/annotations.mjs +0 -140
- package/esm2022/lib/api.mjs +0 -419
- package/esm2022/lib/cache/cache.mjs +0 -175
- package/esm2022/lib/cache/index.mjs +0 -4
- package/esm2022/lib/cache/memory.mjs +0 -30
- package/esm2022/lib/cache/storage.mjs +0 -55
- package/esm2022/lib/client.mjs +0 -212
- package/esm2022/lib/constants.mjs +0 -95
- package/esm2022/lib/helper.mjs +0 -280
- package/esm2022/lib/index.mjs +0 -21
- package/esm2022/lib/loaders.mjs +0 -39
- package/esm2022/lib/metadata/csdl/csdl-annotation.mjs +0 -95
- package/esm2022/lib/metadata/csdl/csdl-entity-container.mjs +0 -27
- package/esm2022/lib/metadata/csdl/csdl-entity-set.mjs +0 -24
- package/esm2022/lib/metadata/csdl/csdl-enum-type.mjs +0 -37
- package/esm2022/lib/metadata/csdl/csdl-function-action.mjs +0 -94
- package/esm2022/lib/metadata/csdl/csdl-navigation-property-binding.mjs +0 -7
- package/esm2022/lib/metadata/csdl/csdl-reference.mjs +0 -23
- package/esm2022/lib/metadata/csdl/csdl-schema.mjs +0 -39
- package/esm2022/lib/metadata/csdl/csdl-singleton.mjs +0 -15
- package/esm2022/lib/metadata/csdl/csdl-structural-property.mjs +0 -70
- package/esm2022/lib/metadata/csdl/csdl-structured-type.mjs +0 -92
- package/esm2022/lib/metadata/csdl/csdl-type-definition.mjs +0 -15
- package/esm2022/lib/metadata/index.mjs +0 -3
- package/esm2022/lib/metadata/metadata.mjs +0 -14
- package/esm2022/lib/metadata/parser.mjs +0 -563
- package/esm2022/lib/models/collection.mjs +0 -814
- package/esm2022/lib/models/index.mjs +0 -4
- package/esm2022/lib/models/model.mjs +0 -553
- package/esm2022/lib/models/options.mjs +0 -1179
- package/esm2022/lib/module.mjs +0 -55
- package/esm2022/lib/options.mjs +0 -36
- package/esm2022/lib/resources/index.mjs +0 -7
- package/esm2022/lib/resources/options.mjs +0 -56
- package/esm2022/lib/resources/path/handlers.mjs +0 -79
- package/esm2022/lib/resources/path/index.mjs +0 -3
- package/esm2022/lib/resources/path/segments.mjs +0 -148
- package/esm2022/lib/resources/query/builder.mjs +0 -636
- package/esm2022/lib/resources/query/expressions/apply.mjs +0 -236
- package/esm2022/lib/resources/query/expressions/base.mjs +0 -25
- package/esm2022/lib/resources/query/expressions/compute.mjs +0 -54
- package/esm2022/lib/resources/query/expressions/count.mjs +0 -116
- package/esm2022/lib/resources/query/expressions/expand.mjs +0 -147
- package/esm2022/lib/resources/query/expressions/filter.mjs +0 -178
- package/esm2022/lib/resources/query/expressions/index.mjs +0 -10
- package/esm2022/lib/resources/query/expressions/orderby.mjs +0 -79
- package/esm2022/lib/resources/query/expressions/search.mjs +0 -141
- package/esm2022/lib/resources/query/expressions/select.mjs +0 -47
- package/esm2022/lib/resources/query/expressions/syntax.mjs +0 -751
- package/esm2022/lib/resources/query/handlers.mjs +0 -420
- package/esm2022/lib/resources/query/index.mjs +0 -5
- package/esm2022/lib/resources/query/options.mjs +0 -139
- package/esm2022/lib/resources/request.mjs +0 -196
- package/esm2022/lib/resources/resource.mjs +0 -311
- package/esm2022/lib/resources/response.mjs +0 -174
- package/esm2022/lib/resources/types/action.mjs +0 -116
- package/esm2022/lib/resources/types/batch.mjs +0 -428
- package/esm2022/lib/resources/types/count.mjs +0 -33
- package/esm2022/lib/resources/types/entity-set.mjs +0 -131
- package/esm2022/lib/resources/types/entity.mjs +0 -112
- package/esm2022/lib/resources/types/function.mjs +0 -146
- package/esm2022/lib/resources/types/index.mjs +0 -15
- package/esm2022/lib/resources/types/media.mjs +0 -44
- package/esm2022/lib/resources/types/metadata.mjs +0 -35
- package/esm2022/lib/resources/types/navigation-property.mjs +0 -256
- package/esm2022/lib/resources/types/options.mjs +0 -2
- package/esm2022/lib/resources/types/property.mjs +0 -197
- package/esm2022/lib/resources/types/reference.mjs +0 -87
- package/esm2022/lib/resources/types/singleton.mjs +0 -130
- package/esm2022/lib/resources/types/value.mjs +0 -48
- package/esm2022/lib/schema/annotation.mjs +0 -37
- package/esm2022/lib/schema/callable.mjs +0 -66
- package/esm2022/lib/schema/element.mjs +0 -67
- package/esm2022/lib/schema/entity-container.mjs +0 -11
- package/esm2022/lib/schema/entity-set.mjs +0 -9
- package/esm2022/lib/schema/enum-type.mjs +0 -68
- package/esm2022/lib/schema/index.mjs +0 -9
- package/esm2022/lib/schema/parsers/callable.mjs +0 -110
- package/esm2022/lib/schema/parsers/edm.mjs +0 -101
- package/esm2022/lib/schema/parsers/enum-type.mjs +0 -130
- package/esm2022/lib/schema/parsers/index.mjs +0 -5
- package/esm2022/lib/schema/parsers/structured-type.mjs +0 -514
- package/esm2022/lib/schema/schema.mjs +0 -45
- package/esm2022/lib/schema/singleton.mjs +0 -9
- package/esm2022/lib/schema/structured-type.mjs +0 -213
- package/esm2022/lib/services/base.mjs +0 -29
- package/esm2022/lib/services/entity-set.mjs +0 -155
- package/esm2022/lib/services/entity.mjs +0 -12
- package/esm2022/lib/services/factory.mjs +0 -44
- package/esm2022/lib/services/index.mjs +0 -5
- package/esm2022/lib/services/singleton.mjs +0 -54
- package/esm2022/lib/settings.mjs +0 -112
- package/esm2022/lib/types.mjs +0 -118
- package/esm2022/lib/utils/arraybuffers.mjs +0 -46
- package/esm2022/lib/utils/arrays.mjs +0 -10
- package/esm2022/lib/utils/dates.mjs +0 -18
- package/esm2022/lib/utils/durations.mjs +0 -40
- package/esm2022/lib/utils/enums.mjs +0 -61
- package/esm2022/lib/utils/http.mjs +0 -95
- package/esm2022/lib/utils/index.mjs +0 -10
- package/esm2022/lib/utils/objects.mjs +0 -204
- package/esm2022/lib/utils/odata.mjs +0 -22
- package/esm2022/lib/utils/strings.mjs +0 -20
- package/esm2022/lib/utils/types.mjs +0 -136
- package/esm2022/lib/utils/urls.mjs +0 -24
- package/esm2022/public-api.mjs +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i1 from '@angular/common/http';
|
|
2
2
|
import { HttpHeaders, HttpParams, HttpResponse, HttpErrorResponse, HttpEventType, HttpClientModule } from '@angular/common/http';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Subject, map as map$1, EMPTY, throwError, Observable, forkJoin, of, NEVER } from 'rxjs';
|
|
4
|
+
import { map, expand, reduce, finalize, defaultIfEmpty, switchMap, catchError, tap, startWith } from 'rxjs/operators';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
6
|
import { EventEmitter, Injectable, InjectionToken, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
7
7
|
import { CommonModule } from '@angular/common';
|
|
@@ -219,205 +219,292 @@ const DESCRIPTION = /.*Description$/;
|
|
|
219
219
|
const LONG_DESCRIPTION = /.*LongDescription$/;
|
|
220
220
|
const OPTIONARL_PARAMETER = /.*OptionalParameter$/;
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
return
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Put some payload in the cache
|
|
282
|
-
* @param name The name for the entry
|
|
283
|
-
* @param payload The payload to store in the cache
|
|
284
|
-
* @param timeout The timeout for the entry
|
|
285
|
-
* @param scope The scope for the entry
|
|
286
|
-
* @param tags The tags for the entry
|
|
287
|
-
*/
|
|
288
|
-
put(name, payload, { timeout, scope, tags, } = {}) {
|
|
289
|
-
const entry = this.buildEntry(payload, { timeout, tags });
|
|
290
|
-
const key = this.buildKey([...(scope || []), name]);
|
|
291
|
-
this.entries.set(key, entry);
|
|
292
|
-
this.forget();
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Return the payload from the cache if it exists and is not expired
|
|
296
|
-
* @param name The name of the entry
|
|
297
|
-
* @param scope The scope of the entry
|
|
298
|
-
* @returns The payload of the entry
|
|
299
|
-
*/
|
|
300
|
-
get(name, { scope } = {}) {
|
|
301
|
-
const key = this.buildKey([...(scope || []), name]);
|
|
302
|
-
const entry = this.entries.get(key);
|
|
303
|
-
return entry !== undefined && !this.isExpired(entry)
|
|
304
|
-
? entry.payload
|
|
222
|
+
const COLLECTION = /Collection\(([\w\.]+)\)/;
|
|
223
|
+
const PROPERTY = /([\w\d\-_]+)\(([\'\w\d\-_=]+)\)/;
|
|
224
|
+
const EXPAND = /([\w\d\-_]+)\(([\w\d\,\(\)]+)\)/;
|
|
225
|
+
const ODataVersionBaseHelper = {
|
|
226
|
+
entity(data) {
|
|
227
|
+
return data;
|
|
228
|
+
},
|
|
229
|
+
entities(data) {
|
|
230
|
+
return data[this.VALUE];
|
|
231
|
+
},
|
|
232
|
+
property(data) {
|
|
233
|
+
return this.VALUE in data ? data[this.VALUE] : data;
|
|
234
|
+
},
|
|
235
|
+
functions(annots) {
|
|
236
|
+
const funcs = new Map();
|
|
237
|
+
[...annots.keys()]
|
|
238
|
+
.filter((key) => key.startsWith(this.ODATA_FUNCTION_PREFIX))
|
|
239
|
+
.forEach((key) => funcs.set(key.substring(this.ODATA_FUNCTION_PREFIX.length), annots.get(key)));
|
|
240
|
+
return funcs;
|
|
241
|
+
},
|
|
242
|
+
properties(annots) {
|
|
243
|
+
const props = new Map();
|
|
244
|
+
[...annots.keys()]
|
|
245
|
+
.filter((key) => key.indexOf(this.ODATA_ANNOTATION_PREFIX) > 0)
|
|
246
|
+
.forEach((key) => {
|
|
247
|
+
let name = key.substring(0, key.indexOf(this.ODATA_ANNOTATION_PREFIX));
|
|
248
|
+
let prop = props.has(name) ? props.get(name) : new Map();
|
|
249
|
+
prop.set(key.substring(key.indexOf(this.ODATA_ANNOTATION_PREFIX)), annots.get(key));
|
|
250
|
+
props.set(name, prop);
|
|
251
|
+
});
|
|
252
|
+
return props;
|
|
253
|
+
},
|
|
254
|
+
id(annots) {
|
|
255
|
+
return annots instanceof Map
|
|
256
|
+
? annots.get(this.ODATA_ID)
|
|
257
|
+
: annots[this.ODATA_ID];
|
|
258
|
+
},
|
|
259
|
+
etag(annots) {
|
|
260
|
+
return annots instanceof Map
|
|
261
|
+
? annots.get(this.ODATA_ETAG)
|
|
262
|
+
: annots[this.ODATA_ETAG];
|
|
263
|
+
},
|
|
264
|
+
type(annots) {
|
|
265
|
+
let type = annots instanceof Map
|
|
266
|
+
? annots.get(this.ODATA_TYPE)
|
|
267
|
+
: annots[this.ODATA_TYPE];
|
|
268
|
+
if (!type)
|
|
269
|
+
return undefined;
|
|
270
|
+
type = type.substring(1);
|
|
271
|
+
const matches = COLLECTION.exec(type);
|
|
272
|
+
if (matches)
|
|
273
|
+
return matches[1].indexOf('.') === -1 ? `Edm.${matches[1]}` : matches[1];
|
|
274
|
+
return type;
|
|
275
|
+
},
|
|
276
|
+
mediaEtag(annots) {
|
|
277
|
+
return annots.has(this.ODATA_MEDIA_ETAG)
|
|
278
|
+
? decodeURIComponent(annots.get(this.ODATA_MEDIA_ETAG))
|
|
305
279
|
: undefined;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
280
|
+
},
|
|
281
|
+
metadataEtag(annots) {
|
|
282
|
+
return annots.has(this.ODATA_METADATA_ETAG)
|
|
283
|
+
? decodeURIComponent(annots.get(this.ODATA_METADATA_ETAG))
|
|
284
|
+
: undefined;
|
|
285
|
+
},
|
|
286
|
+
count(annots) {
|
|
287
|
+
return annots.has(this.ODATA_COUNT)
|
|
288
|
+
? Number(annots.get(this.ODATA_COUNT))
|
|
289
|
+
: undefined;
|
|
290
|
+
},
|
|
291
|
+
annotations(value) {
|
|
292
|
+
const annots = new Map();
|
|
293
|
+
Object.entries(value)
|
|
294
|
+
.filter(([key]) => key.indexOf(this.ODATA_ANNOTATION_PREFIX) !== -1 ||
|
|
295
|
+
key.startsWith(this.ODATA_FUNCTION_PREFIX))
|
|
296
|
+
.forEach(([key, value]) => annots.set(key, value));
|
|
297
|
+
return annots;
|
|
298
|
+
},
|
|
299
|
+
attributes(value, metadata) {
|
|
300
|
+
return Object.entries(value)
|
|
301
|
+
.filter(([k]) => metadata === 'none' ||
|
|
302
|
+
(metadata === 'minimal' &&
|
|
303
|
+
(k.indexOf(this.ODATA_ANNOTATION_PREFIX) === -1 ||
|
|
304
|
+
k.startsWith(this.ODATA_ANNOTATION_PREFIX)) &&
|
|
305
|
+
!k.startsWith(this.ODATA_FUNCTION_PREFIX)) ||
|
|
306
|
+
(metadata === 'full' &&
|
|
307
|
+
k.indexOf(this.ODATA_ANNOTATION_PREFIX) === -1 &&
|
|
308
|
+
!k.startsWith(this.ODATA_FUNCTION_PREFIX)))
|
|
309
|
+
.reduce((acc, e) => ({ ...acc, [e[0]]: e[1] }), {});
|
|
310
|
+
},
|
|
311
|
+
nextLink(annots) {
|
|
312
|
+
return annots.has(this.ODATA_NEXTLINK)
|
|
313
|
+
? decodeURIComponent(annots.get(this.ODATA_NEXTLINK))
|
|
314
|
+
: undefined;
|
|
315
|
+
},
|
|
316
|
+
readLink(annots) {
|
|
317
|
+
return annots.has(this.ODATA_READLINK)
|
|
318
|
+
? decodeURIComponent(annots.get(this.ODATA_READLINK))
|
|
319
|
+
: undefined;
|
|
320
|
+
},
|
|
321
|
+
mediaReadLink(annots) {
|
|
322
|
+
return annots.has(this.ODATA_MEDIA_READLINK)
|
|
323
|
+
? decodeURIComponent(annots.get(this.ODATA_MEDIA_READLINK))
|
|
324
|
+
: undefined;
|
|
325
|
+
},
|
|
326
|
+
editLink(annots) {
|
|
327
|
+
return annots.has(this.ODATA_EDITLINK)
|
|
328
|
+
? decodeURIComponent(annots.get(this.ODATA_EDITLINK))
|
|
329
|
+
: undefined;
|
|
330
|
+
},
|
|
331
|
+
mediaEditLink(annots) {
|
|
332
|
+
return annots.has(this.ODATA_MEDIA_EDITLINK)
|
|
333
|
+
? decodeURIComponent(annots.get(this.ODATA_MEDIA_EDITLINK))
|
|
334
|
+
: undefined;
|
|
335
|
+
},
|
|
336
|
+
deltaLink(annots) {
|
|
337
|
+
return annots.has(this.ODATA_DELTALINK)
|
|
338
|
+
? decodeURIComponent(annots.get(this.ODATA_DELTALINK))
|
|
339
|
+
: undefined;
|
|
340
|
+
},
|
|
341
|
+
mediaContentType(annots) {
|
|
342
|
+
return annots.has(this.ODATA_MEDIA_CONTENTTYPE)
|
|
343
|
+
? decodeURIComponent(annots.get(this.ODATA_MEDIA_CONTENTTYPE))
|
|
344
|
+
: undefined;
|
|
345
|
+
},
|
|
346
|
+
};
|
|
347
|
+
const ODataHelper = {
|
|
348
|
+
//#region Version 4.0
|
|
349
|
+
[VERSION_4_0]: {
|
|
350
|
+
...ODataVersionBaseHelper,
|
|
351
|
+
VALUE: 'value',
|
|
352
|
+
ODATA_ANNOTATION_PREFIX: '@odata',
|
|
353
|
+
ODATA_FUNCTION_PREFIX: '#',
|
|
354
|
+
//odata.id: the ID of the entity
|
|
355
|
+
ODATA_ID: '@odata.id',
|
|
356
|
+
//odata.count: the total count of a collection of entities or collection of entity references, if requested.
|
|
357
|
+
ODATA_COUNT: '@odata.count',
|
|
358
|
+
//odata.context: the context URL for a collection, entity, primitive value, or service document.
|
|
359
|
+
ODATA_CONTEXT: '@odata.context',
|
|
360
|
+
//odata.etag: the ETag of the entity
|
|
361
|
+
ODATA_ETAG: '@odata.etag',
|
|
362
|
+
ODATA_METADATA_ETAG: '@odata.metadataEtag',
|
|
363
|
+
//odata.type: the type of the containing {[name: string]: any} or targeted property if the type of the {[name: string]: any} or targeted property cannot be heuristically determined
|
|
364
|
+
ODATA_TYPE: '@odata.type',
|
|
365
|
+
//odata.delta
|
|
366
|
+
ODATA_DELTA: '@odata.delta',
|
|
367
|
+
//odata.remove
|
|
368
|
+
ODATA_REMOVE: '@odata.remove',
|
|
369
|
+
//odata.nextLink: the next link of a collection with partial results
|
|
370
|
+
ODATA_NEXTLINK: '@odata.nextLink',
|
|
371
|
+
//odata.deltaLink: the delta link for obtaining changes to the result, if requested
|
|
372
|
+
ODATA_DELTALINK: '@odata.deltaLink',
|
|
373
|
+
//odata.readLink: the link used to read the entity, if the edit link cannot be used to read the entity
|
|
374
|
+
ODATA_READLINK: '@odata.readLink',
|
|
375
|
+
//odata.editLink: the link used to edit/update the entity, if the entity is updatable and the odata.id does not represent a URL that can be used to edit the entity
|
|
376
|
+
ODATA_EDITLINK: '@odata.editLink',
|
|
377
|
+
//odata.associationLink: the link used to describe the relationship between this entity and related entities
|
|
378
|
+
ODATA_ASSOCIATIONLINK: '@odata.associationLink',
|
|
379
|
+
//odata.navigationLink: the link used to retrieve the values of a navigation property
|
|
380
|
+
ODATA_NAVIGATIONLINK: '@odata.navigationLink',
|
|
381
|
+
//Media entities and stream properties may in addition contain the following annotations:
|
|
382
|
+
//odata.mediaEtag: the ETag of the stream, as appropriate
|
|
383
|
+
ODATA_MEDIA_ETAG: '@odata.mediaEtag',
|
|
384
|
+
//odata.mediaContentType: the content type of the stream
|
|
385
|
+
ODATA_MEDIA_CONTENTTYPE: '@odata.mediaContentType',
|
|
386
|
+
//odata.mediaReadLink: the link used to read the stream
|
|
387
|
+
ODATA_MEDIA_READLINK: '@odata.mediaReadLink',
|
|
388
|
+
//odata.mediaEditLink: the link used to edit/update the stream
|
|
389
|
+
ODATA_MEDIA_EDITLINK: '@odata.mediaEditLink',
|
|
390
|
+
//http://nb-mdp-dev01:57970/$metadata#recursos/$entity
|
|
391
|
+
//http://nb-mdp-dev01:57970/$metadata#categorias
|
|
392
|
+
//http://nb-mdp-dev01:57970/$metadata#juzgados
|
|
393
|
+
//http://nb-mdp-dev01:57970/$metadata#Collection(SIU.Recursos.RecursoEntry)
|
|
394
|
+
//http://nb-mdp-dev01:57970/$metadata#categorias/$entity
|
|
395
|
+
//http://nb-mdp-dev01:57970/$metadata#categorias(children(children(children(children(children(children(children(children(children(children()))))))))))/$entity
|
|
396
|
+
//http://nb-mdp-dev01:57970/$metadata#recursos/SIU.Documentos.Documento/$entity
|
|
397
|
+
//http://nb-mdp-dev01:57970/$metadata#SIU.Api.Infrastructure.Storage.Backend.SiuUrls
|
|
398
|
+
context(annots) {
|
|
399
|
+
let ctx = {};
|
|
400
|
+
const str = annots instanceof Map
|
|
401
|
+
? annots.get(this.ODATA_CONTEXT)
|
|
402
|
+
: annots[this.ODATA_CONTEXT];
|
|
403
|
+
if (typeof str === 'string') {
|
|
404
|
+
let index = str.indexOf('$metadata');
|
|
405
|
+
ctx.serviceRootUrl = str.substring(0, index);
|
|
406
|
+
index = str.indexOf('#');
|
|
407
|
+
ctx.metadataUrl = str.substring(0, index);
|
|
408
|
+
const parts = str.substring(index + 1).split('/');
|
|
409
|
+
const col = COLLECTION.exec(parts[0]);
|
|
410
|
+
if (col) {
|
|
411
|
+
ctx.type = col[1];
|
|
412
|
+
}
|
|
413
|
+
else if (parts[0].indexOf('.') !== -1) {
|
|
414
|
+
ctx.type = parts[0];
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
const property = parts[0].match(PROPERTY);
|
|
418
|
+
const expand = parts[0].match(EXPAND);
|
|
419
|
+
ctx.entity = parts[1] === '$entity';
|
|
420
|
+
if (property) {
|
|
421
|
+
ctx.entitySet = property[1];
|
|
422
|
+
ctx.key = property[2];
|
|
423
|
+
ctx.property = parts[1];
|
|
424
|
+
}
|
|
425
|
+
else if (expand) {
|
|
426
|
+
ctx.entitySet = expand[1];
|
|
427
|
+
ctx.expand = expand[2];
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
ctx.entitySet = parts[0];
|
|
431
|
+
}
|
|
432
|
+
}
|
|
321
433
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
return res$;
|
|
356
|
-
}
|
|
357
|
-
if (policy === 'cache-only') {
|
|
358
|
-
if (cached) {
|
|
359
|
-
return of(cached);
|
|
434
|
+
return ctx;
|
|
435
|
+
},
|
|
436
|
+
countParam() {
|
|
437
|
+
return { [$COUNT]: 'true' };
|
|
438
|
+
},
|
|
439
|
+
},
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region Version 3.0
|
|
442
|
+
[VERSION_3_0]: {
|
|
443
|
+
...ODataVersionBaseHelper,
|
|
444
|
+
ODATA_ANNOTATION_PREFIX: 'odata.',
|
|
445
|
+
ODATA_FUNCTION_PREFIX: '',
|
|
446
|
+
ODATA_ID: 'odata.id',
|
|
447
|
+
ODATA_DELTA: 'odata.delta',
|
|
448
|
+
ODATA_REMOVE: 'odata.remove',
|
|
449
|
+
ODATA_ETAG: 'odata.etag',
|
|
450
|
+
ODATA_CONTEXT: 'odata.metadata',
|
|
451
|
+
ODATA_NEXTLINK: 'odata.nextLink',
|
|
452
|
+
ODATA_TYPE: 'odata.type',
|
|
453
|
+
ODATA_COUNT: 'odata.count',
|
|
454
|
+
VALUE: 'value',
|
|
455
|
+
context(annots) {
|
|
456
|
+
let ctx = {};
|
|
457
|
+
const str = annots instanceof Map
|
|
458
|
+
? annots.get(this.ODATA_CONTEXT)
|
|
459
|
+
: annots[this.ODATA_CONTEXT];
|
|
460
|
+
if (typeof str === 'string') {
|
|
461
|
+
let index = str.indexOf('$metadata');
|
|
462
|
+
ctx.serviceRootUrl = str.substring(0, index);
|
|
463
|
+
index = str.indexOf('#');
|
|
464
|
+
ctx.metadataUrl = str.substring(0, index);
|
|
465
|
+
const parts = str.substring(index + 1).split('/');
|
|
466
|
+
ctx.entitySet = parts[0];
|
|
360
467
|
}
|
|
361
|
-
|
|
362
|
-
|
|
468
|
+
return ctx;
|
|
469
|
+
},
|
|
470
|
+
countParam() {
|
|
471
|
+
return { [$INLINECOUNT]: 'allpages' };
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
//#endregion
|
|
475
|
+
//#region Version 2.0
|
|
476
|
+
[VERSION_2_0]: {
|
|
477
|
+
...ODataVersionBaseHelper,
|
|
478
|
+
ODATA_ID: 'id',
|
|
479
|
+
ODATA_DELTA: 'delta',
|
|
480
|
+
ODATA_REMOVE: 'remove',
|
|
481
|
+
ODATA_ETAG: 'etag',
|
|
482
|
+
ODATA_ANNOTATION: '__metadata',
|
|
483
|
+
ODATA_NEXTLINK: '__next',
|
|
484
|
+
ODATA_COUNT: '__count',
|
|
485
|
+
ODATA_DEFERRED: '__deferred',
|
|
486
|
+
ODATA_TYPE: 'type',
|
|
487
|
+
VALUE: 'results',
|
|
488
|
+
annotations(value) {
|
|
489
|
+
const annots = new Map();
|
|
490
|
+
if (this.ODATA_ANNOTATION in value) {
|
|
491
|
+
Object.entries(value[this.ODATA_ANNOTATION]).forEach(([key, value]) => annots.set(key, value));
|
|
363
492
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
handleMutate(req, res$) {
|
|
380
|
-
const requests = req.isBatch()
|
|
381
|
-
? req.resource
|
|
382
|
-
.requests()
|
|
383
|
-
.filter((r) => r.isMutate())
|
|
384
|
-
: [req];
|
|
385
|
-
for (var r of requests) {
|
|
386
|
-
const scope = this.scope(r);
|
|
387
|
-
this.forget({ scope });
|
|
388
|
-
}
|
|
389
|
-
return res$;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
class ODataInMemoryCache extends ODataCache {
|
|
394
|
-
constructor({ timeout } = {}) {
|
|
395
|
-
super({ timeout });
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* Store the response in the cache
|
|
399
|
-
* @param req The request with the resource to store the response
|
|
400
|
-
* @param res The response to store in the cache
|
|
401
|
-
*/
|
|
402
|
-
putResponse(req, res) {
|
|
403
|
-
let scope = this.scope(req);
|
|
404
|
-
let tags = this.tags(res);
|
|
405
|
-
this.put(req.cacheKey, res, {
|
|
406
|
-
timeout: res.options.maxAge,
|
|
407
|
-
scope,
|
|
408
|
-
tags,
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Restore the response from the cache
|
|
413
|
-
* @param req The request with the resource to get the response
|
|
414
|
-
* @returns The response from the cache
|
|
415
|
-
*/
|
|
416
|
-
getResponse(req) {
|
|
417
|
-
let scope = this.scope(req);
|
|
418
|
-
return this.get(req.cacheKey, { scope });
|
|
419
|
-
}
|
|
420
|
-
}
|
|
493
|
+
return annots;
|
|
494
|
+
},
|
|
495
|
+
context(annots) {
|
|
496
|
+
let ctx = {};
|
|
497
|
+
return ctx;
|
|
498
|
+
},
|
|
499
|
+
attributes(value, metadata) {
|
|
500
|
+
return value;
|
|
501
|
+
},
|
|
502
|
+
countParam() {
|
|
503
|
+
return { [$INLINECOUNT]: 'allpages' };
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
//#endregion
|
|
507
|
+
};
|
|
421
508
|
|
|
422
509
|
const COMPARISON_OPERATORS = ['eq', 'ne', 'gt', 'ge', 'lt', 'le'];
|
|
423
510
|
const LOGICAL_OPERATORS = ['and', 'or', 'not'];
|
|
@@ -473,7 +560,7 @@ const isQueryCustomType = (value) => typeof value === 'object' &&
|
|
|
473
560
|
const isRawType = (value) => isQueryCustomType(value) &&
|
|
474
561
|
value.type === QueryCustomTypes.Raw;
|
|
475
562
|
const ITEM_ROOT = '';
|
|
476
|
-
function builder ({ select, search, skiptoken, format, top, skip, filter, transform, orderBy, key, count, expand, action, func, aliases, escape, } = {}) {
|
|
563
|
+
function builder ({ select, search, skiptoken, format, top, skip, filter, transform, compute, orderBy, key, count, expand, action, func, aliases, escape, } = {}) {
|
|
477
564
|
const [path, params] = buildPathAndQuery({
|
|
478
565
|
select,
|
|
479
566
|
search,
|
|
@@ -483,6 +570,7 @@ function builder ({ select, search, skiptoken, format, top, skip, filter, transf
|
|
|
483
570
|
skip,
|
|
484
571
|
filter,
|
|
485
572
|
transform,
|
|
573
|
+
compute,
|
|
486
574
|
orderBy,
|
|
487
575
|
key,
|
|
488
576
|
count,
|
|
@@ -494,7 +582,7 @@ function builder ({ select, search, skiptoken, format, top, skip, filter, transf
|
|
|
494
582
|
});
|
|
495
583
|
return buildUrl(path, params);
|
|
496
584
|
}
|
|
497
|
-
function buildPathAndQuery({ select, search, skiptoken, format, top, skip, filter, apply, transform, orderBy, key, count, expand, action, func, aliases, escape, } = {}) {
|
|
585
|
+
function buildPathAndQuery({ select, search, skiptoken, format, top, skip, filter, apply, transform, compute, orderBy, key, count, expand, action, func, aliases, escape, } = {}) {
|
|
498
586
|
let path = '';
|
|
499
587
|
aliases = aliases || [];
|
|
500
588
|
const query = {};
|
|
@@ -510,6 +598,14 @@ function buildPathAndQuery({ select, search, skiptoken, format, top, skip, filte
|
|
|
510
598
|
? select.join(',')
|
|
511
599
|
: select;
|
|
512
600
|
}
|
|
601
|
+
// Compute
|
|
602
|
+
if (compute) {
|
|
603
|
+
query.$compute = isRawType(compute)
|
|
604
|
+
? compute.value
|
|
605
|
+
: Array.isArray(compute)
|
|
606
|
+
? compute.join(',')
|
|
607
|
+
: compute;
|
|
608
|
+
}
|
|
513
609
|
// Search
|
|
514
610
|
if (search) {
|
|
515
611
|
query.$search = search;
|
|
@@ -1052,7 +1148,7 @@ function buildUrl(path, params) {
|
|
|
1052
1148
|
return queries.length ? `${path}?${queries.join('&')}` : path;
|
|
1053
1149
|
}
|
|
1054
1150
|
function parseNot(builtFilters) {
|
|
1055
|
-
return `not(${builtFilters.join(' and ')})`;
|
|
1151
|
+
return `not (${builtFilters.join(' and ')})`;
|
|
1056
1152
|
}
|
|
1057
1153
|
|
|
1058
1154
|
const ISO_REGEX = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/;
|
|
@@ -1669,6 +1765,7 @@ const Urls = {
|
|
|
1669
1765
|
};
|
|
1670
1766
|
|
|
1671
1767
|
class Expression {
|
|
1768
|
+
_children;
|
|
1672
1769
|
constructor({ children, } = {}) {
|
|
1673
1770
|
this._children = children || [];
|
|
1674
1771
|
}
|
|
@@ -1676,7 +1773,7 @@ class Expression {
|
|
|
1676
1773
|
return 'Expression';
|
|
1677
1774
|
}
|
|
1678
1775
|
children() {
|
|
1679
|
-
return this._children;
|
|
1776
|
+
return [...this._children];
|
|
1680
1777
|
}
|
|
1681
1778
|
length() {
|
|
1682
1779
|
return this._children.length;
|
|
@@ -1693,12 +1790,19 @@ class Expression {
|
|
|
1693
1790
|
}
|
|
1694
1791
|
|
|
1695
1792
|
class ODataAnnotation {
|
|
1793
|
+
term;
|
|
1794
|
+
string;
|
|
1795
|
+
bool;
|
|
1796
|
+
int;
|
|
1797
|
+
permissions;
|
|
1798
|
+
properties;
|
|
1696
1799
|
constructor(annot) {
|
|
1697
1800
|
this.term = annot.term;
|
|
1698
1801
|
Object.assign(this, annot);
|
|
1699
1802
|
}
|
|
1700
1803
|
}
|
|
1701
1804
|
class ODataAnnotatable {
|
|
1805
|
+
annotations;
|
|
1702
1806
|
constructor(config) {
|
|
1703
1807
|
this.annotations = (config.annotations || []).map((annot) => new ODataAnnotation(annot));
|
|
1704
1808
|
}
|
|
@@ -1730,6 +1834,8 @@ class ODataAnnotatable {
|
|
|
1730
1834
|
}
|
|
1731
1835
|
|
|
1732
1836
|
class ODataSchemaElement extends ODataAnnotatable {
|
|
1837
|
+
name;
|
|
1838
|
+
schema;
|
|
1733
1839
|
constructor(config, schema) {
|
|
1734
1840
|
super(config);
|
|
1735
1841
|
this.schema = schema;
|
|
@@ -1788,573 +1894,331 @@ class ODataSchemaElement extends ODataAnnotatable {
|
|
|
1788
1894
|
}
|
|
1789
1895
|
}
|
|
1790
1896
|
class ODataParserSchemaElement extends ODataSchemaElement {
|
|
1897
|
+
parser;
|
|
1791
1898
|
constructor(config, schema, parser) {
|
|
1792
1899
|
super(config, schema);
|
|
1793
1900
|
this.parser = parser;
|
|
1794
1901
|
}
|
|
1795
1902
|
}
|
|
1796
1903
|
|
|
1797
|
-
//https://github.com/niklasvh/base64-arraybuffer
|
|
1798
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
1799
|
-
// Use a lookup table to find the index.
|
|
1800
|
-
const lookup = new Uint8Array(256);
|
|
1801
|
-
for (var i = 0; i < chars.length; i++) {
|
|
1802
|
-
lookup[chars.charCodeAt(i)] = i;
|
|
1803
|
-
}
|
|
1804
|
-
const ArrayBuffers = {
|
|
1805
|
-
toArrayBuffer(v) {
|
|
1806
|
-
var bufferLength = v.length * 0.75, len = v.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
|
|
1807
|
-
if (v[v.length - 1] === '=') {
|
|
1808
|
-
bufferLength--;
|
|
1809
|
-
if (v[v.length - 2] === '=') {
|
|
1810
|
-
bufferLength--;
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);
|
|
1814
|
-
for (i = 0; i < len; i += 4) {
|
|
1815
|
-
encoded1 = lookup[v.charCodeAt(i)];
|
|
1816
|
-
encoded2 = lookup[v.charCodeAt(i + 1)];
|
|
1817
|
-
encoded3 = lookup[v.charCodeAt(i + 2)];
|
|
1818
|
-
encoded4 = lookup[v.charCodeAt(i + 3)];
|
|
1819
|
-
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
|
|
1820
|
-
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
|
|
1821
|
-
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
|
|
1822
|
-
}
|
|
1823
|
-
return arraybuffer;
|
|
1824
|
-
},
|
|
1825
|
-
toString(v) {
|
|
1826
|
-
var bytes = new Uint8Array(v), i, len = bytes.length, base64 = '';
|
|
1827
|
-
for (i = 0; i < len; i += 3) {
|
|
1828
|
-
base64 += chars[bytes[i] >> 2];
|
|
1829
|
-
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
|
1830
|
-
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
|
1831
|
-
base64 += chars[bytes[i + 2] & 63];
|
|
1832
|
-
}
|
|
1833
|
-
if (len % 3 === 2) {
|
|
1834
|
-
base64 = base64.substring(0, base64.length - 1) + '=';
|
|
1835
|
-
}
|
|
1836
|
-
else if (len % 3 === 1) {
|
|
1837
|
-
base64 = base64.substring(0, base64.length - 2) + '==';
|
|
1838
|
-
}
|
|
1839
|
-
return base64;
|
|
1840
|
-
},
|
|
1841
|
-
};
|
|
1842
|
-
|
|
1843
|
-
// Core EdmTypeParserBuilder
|
|
1844
|
-
const EdmParser = (_d, _s, _e) => ({
|
|
1845
|
-
deserialize(value, options) {
|
|
1846
|
-
return Array.isArray(value)
|
|
1847
|
-
? value.map((v) => _d(v, options))
|
|
1848
|
-
: _d(value, options);
|
|
1849
|
-
},
|
|
1850
|
-
serialize(value, options) {
|
|
1851
|
-
return Array.isArray(value)
|
|
1852
|
-
? value.map((v) => _s(v, options))
|
|
1853
|
-
: _s(value, options);
|
|
1854
|
-
},
|
|
1855
|
-
encode(value, options) {
|
|
1856
|
-
return Array.isArray(value)
|
|
1857
|
-
? value.map((v) => (!isRawType(v) ? _e(v, options) : v))
|
|
1858
|
-
: !isRawType(value)
|
|
1859
|
-
? _e(value, options)
|
|
1860
|
-
: value;
|
|
1861
|
-
},
|
|
1862
|
-
});
|
|
1863
|
-
const Identity = (v) => v;
|
|
1864
|
-
const toNumber = (v) => Number(v);
|
|
1865
|
-
const toString = (v) => v.toString();
|
|
1866
|
-
const toBoolean = (v) => Boolean(v);
|
|
1867
|
-
const toDate = (v) => new Date(v);
|
|
1868
|
-
const EDM_PARSERS = {
|
|
1869
|
-
//Edm.Guid 16-byte (128-bit) unique identifier
|
|
1870
|
-
[EdmType.Guid]: EdmParser(Identity, Identity, (v) => raw(v)),
|
|
1871
|
-
//Edm.Int16 Signed 16-bit integer
|
|
1872
|
-
[EdmType.Int16]: EdmParser(toNumber, toNumber, toNumber),
|
|
1873
|
-
//Edm.String Sequence of UTF-8 characters
|
|
1874
|
-
[EdmType.String]: EdmParser(toString, toString, toString),
|
|
1875
|
-
//Edm.Boolean Binary-valued logic
|
|
1876
|
-
[EdmType.Boolean]: EdmParser(toBoolean, toBoolean, toBoolean),
|
|
1877
|
-
//Edm.Byte Unsigned 8-bit integer
|
|
1878
|
-
[EdmType.Byte]: EdmParser(toNumber, toNumber, toNumber),
|
|
1879
|
-
//Edm.SByte Signed 8-bit integer
|
|
1880
|
-
[EdmType.SByte]: EdmParser(toNumber, toNumber, toNumber),
|
|
1881
|
-
//Edm.Int32 Signed 16-bit integer
|
|
1882
|
-
[EdmType.Int32]: EdmParser(toNumber, toNumber, toNumber),
|
|
1883
|
-
//Edm.Int64 Signed 16-bit integer
|
|
1884
|
-
[EdmType.Int64]: EdmParser(toNumber, toNumber, toNumber),
|
|
1885
|
-
//Edm.Date Date without a time-zone offset
|
|
1886
|
-
[EdmType.Date]: EdmParser((v) => new Date(`${v}T00:00:00.000Z`), (v) => toDate(v).toISOString().substring(0, 10), (v) => raw(toDate(v).toISOString().substring(0, 10))),
|
|
1887
|
-
//Edm.TimeOfDay Clock time 00:00-23:59:59.999999999999
|
|
1888
|
-
[EdmType.TimeOfDay]: EdmParser((v) => new Date(`1970-01-01T${v}Z`), (v) => toDate(v).toISOString().substring(11, 23), (v) => raw(toDate(v).toISOString().substring(11, 23))),
|
|
1889
|
-
//Edm.DateTimeOffset Date and time with a time-zone offset, no leap seconds
|
|
1890
|
-
[EdmType.DateTimeOffset]: EdmParser(toDate, (v) => toDate(v).toISOString(), (v) => raw(toDate(v).toISOString())),
|
|
1891
|
-
//Edm.Duration Signed duration in days, hours, minutes, and (sub)seconds
|
|
1892
|
-
[EdmType.Duration]: EdmParser((v) => Durations.toDuration(v), (v) => Durations.toString(v), (v) => raw(Durations.toString(v))),
|
|
1893
|
-
//Edm.Decimal Numeric values with fixed precision and scale
|
|
1894
|
-
[EdmType.Decimal]: EdmParser(toNumber, (v, o) => {
|
|
1895
|
-
if (o.ieee754Compatible) {
|
|
1896
|
-
let vstr = v.toPrecision(o.field.precision);
|
|
1897
|
-
if (typeof o.field.scale === 'number') {
|
|
1898
|
-
vstr = parseFloat(vstr).toFixed(o.field.scale);
|
|
1899
|
-
}
|
|
1900
|
-
return vstr;
|
|
1901
|
-
}
|
|
1902
|
-
return v;
|
|
1903
|
-
}, (v, o) => {
|
|
1904
|
-
if (o.ieee754Compatible) {
|
|
1905
|
-
let vstr = v.toPrecision(o.field.precision);
|
|
1906
|
-
if (typeof o.field.scale === 'number') {
|
|
1907
|
-
vstr = parseFloat(vstr).toFixed(o.field.scale);
|
|
1908
|
-
}
|
|
1909
|
-
return raw(vstr);
|
|
1910
|
-
}
|
|
1911
|
-
return v;
|
|
1912
|
-
}),
|
|
1913
|
-
//Edm.Double IEEE 754 binary64 floating-point number (15-17 decimal digits)
|
|
1914
|
-
[EdmType.Double]: EdmParser((v) => (v === 'INF' ? Infinity : v), (v) => (v === Infinity ? 'INF' : v), (v) => raw(v === Infinity ? 'INF' : v.toString())),
|
|
1915
|
-
//Edm.Single IEEE 754 binary32 floating-point number (6-9 decimal digits)
|
|
1916
|
-
[EdmType.Single]: EdmParser((v) => (v === 'INF' ? Infinity : v), (v) => (v === Infinity ? 'INF' : v), (v) => raw(v === Infinity ? 'INF' : v.toString())),
|
|
1917
|
-
//Edm.Binary Binary data
|
|
1918
|
-
[EdmType.Binary]: EdmParser((v) => ArrayBuffers.toArrayBuffer(v), (v) => ArrayBuffers.toString(v), (v) => raw(ArrayBuffers.toString(v))),
|
|
1919
|
-
};
|
|
1920
|
-
/*
|
|
1921
|
-
Edm.Stream Binary data stream
|
|
1922
|
-
Edm.Geography Abstract base type for all Geography types
|
|
1923
|
-
Edm.GeographyPoint A point in a round-earth coordinate system
|
|
1924
|
-
Edm.GeographyLineString Line string in a round-earth coordinate system
|
|
1925
|
-
Edm.GeographyPolygon Polygon in a round-earth coordinate system
|
|
1926
|
-
Edm.GeographyMultiPoint Collection of points in a round-earth coordinate system
|
|
1927
|
-
Edm.GeographyMultiLineString Collection of line strings in a round-earth coordinate system
|
|
1928
|
-
Edm.GeographyMultiPolygon Collection of polygons in a round-earth coordinate system
|
|
1929
|
-
Edm.GeographyCollection Collection of arbitrary Geography values
|
|
1930
|
-
Edm.Geometry Abstract base type for all Geometry types
|
|
1931
|
-
Edm.GeometryPoint Point in a flat-earth coordinate system
|
|
1932
|
-
Edm.GeometryLineString Line string in a flat-earth coordinate system
|
|
1933
|
-
Edm.GeometryPolygon Polygon in a flat-earth coordinate system
|
|
1934
|
-
Edm.GeometryMultiPoint Collection of points in a flat-earth coordinate system
|
|
1935
|
-
Edm.GeometryMultiLineString Collection of line strings in a flat-earth coordinate system
|
|
1936
|
-
Edm.GeometryMultiPolygon Collection of polygons in a flat-earth coordinate system
|
|
1937
|
-
Edm.GeometryCollection Collection of arbitrary Geometry values
|
|
1938
|
-
*/
|
|
1939
|
-
|
|
1940
|
-
class ODataEnumTypeFieldParser extends ODataAnnotatable {
|
|
1941
|
-
constructor(name, field) {
|
|
1942
|
-
super(field);
|
|
1943
|
-
this.name = name;
|
|
1944
|
-
this.value = field.value;
|
|
1945
|
-
}
|
|
1946
|
-
titleize(term) {
|
|
1947
|
-
return (term && this.annotatedValue(term)) || this.name;
|
|
1948
|
-
}
|
|
1949
|
-
}
|
|
1950
|
-
class ODataEnumTypeParser extends ODataAnnotatable {
|
|
1951
|
-
constructor(config, namespace, alias) {
|
|
1952
|
-
super(config);
|
|
1953
|
-
this.name = config.name;
|
|
1954
|
-
this.namespace = namespace;
|
|
1955
|
-
this.alias = alias;
|
|
1956
|
-
this.flags = config.flags;
|
|
1957
|
-
this.members = config.members;
|
|
1958
|
-
this._fields = Object.entries(config.fields).map(([name, f]) => new ODataEnumTypeFieldParser(name, f));
|
|
1959
|
-
}
|
|
1960
|
-
configure({ options }) {
|
|
1961
|
-
this.parserOptions = options;
|
|
1962
|
-
}
|
|
1963
|
-
isTypeOf(type) {
|
|
1964
|
-
var names = [`${this.namespace}.${this.name}`];
|
|
1965
|
-
if (this.alias)
|
|
1966
|
-
names.push(`${this.alias}.${this.name}`);
|
|
1967
|
-
return names.indexOf(type) !== -1;
|
|
1968
|
-
}
|
|
1969
|
-
fields(value) {
|
|
1970
|
-
return [
|
|
1971
|
-
...this._fields.filter((f) => value === undefined || Boolean(f.value & value)),
|
|
1972
|
-
];
|
|
1973
|
-
}
|
|
1974
|
-
field(nameValue) {
|
|
1975
|
-
let field = this.fields().find((f) => f.name === nameValue || f.value === nameValue);
|
|
1976
|
-
//Throw error if not found
|
|
1977
|
-
if (field === undefined)
|
|
1978
|
-
throw new Error(`${this.name} has no field named ${String(name)}`);
|
|
1979
|
-
return field;
|
|
1980
|
-
}
|
|
1981
|
-
/**
|
|
1982
|
-
* Map the fields of the enum type.
|
|
1983
|
-
* @param mapper Function that maps the value to the new value
|
|
1984
|
-
* @returns The fields mapped by the mapper
|
|
1985
|
-
*/
|
|
1986
|
-
mapFields(mapper) {
|
|
1987
|
-
return this.fields().map(mapper);
|
|
1988
|
-
}
|
|
1989
|
-
// Deserialize
|
|
1990
|
-
deserialize(value, options) {
|
|
1991
|
-
// string -> number
|
|
1992
|
-
const parserOptions = { ...this.parserOptions, ...options };
|
|
1993
|
-
if (this.flags) {
|
|
1994
|
-
return Enums.toValues(this.members, value).reduce((acc, v) => acc | v, 0);
|
|
1995
|
-
}
|
|
1996
|
-
else {
|
|
1997
|
-
return Enums.toValue(this.members, value);
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
// Serialize
|
|
2001
|
-
serialize(value, options) {
|
|
2002
|
-
// Enum are string | number
|
|
2003
|
-
// string | number -> string
|
|
2004
|
-
const parserOptions = { ...this.parserOptions, ...options };
|
|
2005
|
-
if (this.flags) {
|
|
2006
|
-
let names = Enums.toFlags(this.members, value);
|
|
2007
|
-
if (names.length === 0)
|
|
2008
|
-
names = [`${value}`];
|
|
2009
|
-
return !parserOptions?.stringAsEnum
|
|
2010
|
-
? `${this.namespace}.${this.name}'${names.join(', ')}'`
|
|
2011
|
-
: names.join(', ');
|
|
2012
|
-
}
|
|
2013
|
-
else {
|
|
2014
|
-
let name = Enums.toName(this.members, value);
|
|
2015
|
-
if (name === undefined)
|
|
2016
|
-
name = `${value}`;
|
|
2017
|
-
return !parserOptions?.stringAsEnum
|
|
2018
|
-
? `${this.namespace}.${this.name}'${name}'`
|
|
2019
|
-
: name;
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
//Encode
|
|
2023
|
-
encode(value, options) {
|
|
2024
|
-
const parserOptions = { ...this.parserOptions, ...options };
|
|
2025
|
-
const serialized = this.serialize(value, parserOptions);
|
|
2026
|
-
if (serialized === undefined)
|
|
2027
|
-
return undefined;
|
|
2028
|
-
return parserOptions?.stringAsEnum
|
|
2029
|
-
? raw(`'${serialized}'`)
|
|
2030
|
-
: raw(serialized);
|
|
2031
|
-
}
|
|
2032
|
-
// Json Schema
|
|
2033
|
-
toJsonSchema() {
|
|
2034
|
-
return this.flags
|
|
2035
|
-
? {
|
|
2036
|
-
title: this.name,
|
|
2037
|
-
type: JsonType.array,
|
|
2038
|
-
items: {
|
|
2039
|
-
type: JsonType.integer,
|
|
2040
|
-
},
|
|
2041
|
-
}
|
|
2042
|
-
: {
|
|
2043
|
-
type: JsonType.integer,
|
|
2044
|
-
enum: this._fields.map((f) => f.value),
|
|
2045
|
-
};
|
|
2046
|
-
}
|
|
2047
|
-
validate(member, { method, navigation = false, } = {}) {
|
|
2048
|
-
if (this.flags) {
|
|
2049
|
-
let members = Enums.toValues(this.members, member);
|
|
2050
|
-
return members.some((member) => !(member in this.members))
|
|
2051
|
-
? ['mismatch']
|
|
2052
|
-
: undefined;
|
|
2053
|
-
}
|
|
2054
|
-
else {
|
|
2055
|
-
return !(member in this.members) ? ['mismatch'] : undefined;
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
unpack(value) {
|
|
2059
|
-
return Enums.toValues(this.members, value);
|
|
2060
|
-
}
|
|
2061
|
-
pack(value) {
|
|
2062
|
-
return Enums.toValues(this.members, value).reduce((acc, v) => acc | v, 0);
|
|
2063
|
-
}
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
|
-
const COLLECTION = /Collection\(([\w\.]+)\)/;
|
|
2067
|
-
const PROPERTY = /([\w\d\-_]+)\(([\'\w\d\-_=]+)\)/;
|
|
2068
|
-
const EXPAND = /([\w\d\-_]+)\(([\w\d\,\(\)]+)\)/;
|
|
2069
|
-
const ODataVersionBaseHelper = {
|
|
2070
|
-
entity(data) {
|
|
2071
|
-
return data;
|
|
2072
|
-
},
|
|
2073
|
-
entities(data) {
|
|
2074
|
-
return data[this.VALUE];
|
|
2075
|
-
},
|
|
2076
|
-
property(data) {
|
|
2077
|
-
return this.VALUE in data ? data[this.VALUE] : data;
|
|
2078
|
-
},
|
|
2079
|
-
functions(annots) {
|
|
2080
|
-
const funcs = new Map();
|
|
2081
|
-
[...annots.keys()]
|
|
2082
|
-
.filter((key) => key.startsWith(this.ODATA_FUNCTION_PREFIX))
|
|
2083
|
-
.forEach((key) => funcs.set(key.substring(this.ODATA_FUNCTION_PREFIX.length), annots.get(key)));
|
|
2084
|
-
return funcs;
|
|
2085
|
-
},
|
|
2086
|
-
properties(annots) {
|
|
2087
|
-
const props = new Map();
|
|
2088
|
-
[...annots.keys()]
|
|
2089
|
-
.filter((key) => key.indexOf(this.ODATA_ANNOTATION_PREFIX) > 0)
|
|
2090
|
-
.forEach((key) => {
|
|
2091
|
-
let name = key.substring(0, key.indexOf(this.ODATA_ANNOTATION_PREFIX));
|
|
2092
|
-
let prop = props.has(name) ? props.get(name) : new Map();
|
|
2093
|
-
prop.set(key.substring(key.indexOf(this.ODATA_ANNOTATION_PREFIX)), annots.get(key));
|
|
2094
|
-
props.set(name, prop);
|
|
2095
|
-
});
|
|
2096
|
-
return props;
|
|
2097
|
-
},
|
|
2098
|
-
id(annots) {
|
|
2099
|
-
return annots instanceof Map
|
|
2100
|
-
? annots.get(this.ODATA_ID)
|
|
2101
|
-
: annots[this.ODATA_ID];
|
|
2102
|
-
},
|
|
2103
|
-
etag(annots) {
|
|
2104
|
-
return annots instanceof Map
|
|
2105
|
-
? annots.get(this.ODATA_ETAG)
|
|
2106
|
-
: annots[this.ODATA_ETAG];
|
|
2107
|
-
},
|
|
2108
|
-
type(annots) {
|
|
2109
|
-
let type = annots instanceof Map
|
|
2110
|
-
? annots.get(this.ODATA_TYPE)
|
|
2111
|
-
: annots[this.ODATA_TYPE];
|
|
2112
|
-
if (!type)
|
|
2113
|
-
return undefined;
|
|
2114
|
-
type = type.substring(1);
|
|
2115
|
-
const matches = COLLECTION.exec(type);
|
|
2116
|
-
if (matches)
|
|
2117
|
-
return matches[1].indexOf('.') === -1 ? `Edm.${matches[1]}` : matches[1];
|
|
2118
|
-
return type;
|
|
2119
|
-
},
|
|
2120
|
-
mediaEtag(annots) {
|
|
2121
|
-
return annots.has(this.ODATA_MEDIA_ETAG)
|
|
2122
|
-
? decodeURIComponent(annots.get(this.ODATA_MEDIA_ETAG))
|
|
2123
|
-
: undefined;
|
|
2124
|
-
},
|
|
2125
|
-
metadataEtag(annots) {
|
|
2126
|
-
return annots.has(this.ODATA_METADATA_ETAG)
|
|
2127
|
-
? decodeURIComponent(annots.get(this.ODATA_METADATA_ETAG))
|
|
2128
|
-
: undefined;
|
|
2129
|
-
},
|
|
2130
|
-
count(annots) {
|
|
2131
|
-
return annots.has(this.ODATA_COUNT)
|
|
2132
|
-
? Number(annots.get(this.ODATA_COUNT))
|
|
2133
|
-
: undefined;
|
|
2134
|
-
},
|
|
2135
|
-
annotations(value) {
|
|
2136
|
-
const annots = new Map();
|
|
2137
|
-
Object.entries(value)
|
|
2138
|
-
.filter(([key]) => key.indexOf(this.ODATA_ANNOTATION_PREFIX) !== -1 ||
|
|
2139
|
-
key.startsWith(this.ODATA_FUNCTION_PREFIX))
|
|
2140
|
-
.forEach(([key, value]) => annots.set(key, value));
|
|
2141
|
-
return annots;
|
|
2142
|
-
},
|
|
2143
|
-
attributes(value, metadata) {
|
|
2144
|
-
return Object.entries(value)
|
|
2145
|
-
.filter(([k]) => metadata === 'none' ||
|
|
2146
|
-
(metadata === 'minimal' &&
|
|
2147
|
-
(k.indexOf(this.ODATA_ANNOTATION_PREFIX) === -1 ||
|
|
2148
|
-
k.startsWith(this.ODATA_ANNOTATION_PREFIX)) &&
|
|
2149
|
-
!k.startsWith(this.ODATA_FUNCTION_PREFIX)) ||
|
|
2150
|
-
(metadata === 'full' &&
|
|
2151
|
-
k.indexOf(this.ODATA_ANNOTATION_PREFIX) === -1 &&
|
|
2152
|
-
!k.startsWith(this.ODATA_FUNCTION_PREFIX)))
|
|
2153
|
-
.reduce((acc, e) => ({ ...acc, [e[0]]: e[1] }), {});
|
|
2154
|
-
},
|
|
2155
|
-
nextLink(annots) {
|
|
2156
|
-
return annots.has(this.ODATA_NEXTLINK)
|
|
2157
|
-
? decodeURIComponent(annots.get(this.ODATA_NEXTLINK))
|
|
2158
|
-
: undefined;
|
|
2159
|
-
},
|
|
2160
|
-
readLink(annots) {
|
|
2161
|
-
return annots.has(this.ODATA_READLINK)
|
|
2162
|
-
? decodeURIComponent(annots.get(this.ODATA_READLINK))
|
|
2163
|
-
: undefined;
|
|
2164
|
-
},
|
|
2165
|
-
mediaReadLink(annots) {
|
|
2166
|
-
return annots.has(this.ODATA_MEDIA_READLINK)
|
|
2167
|
-
? decodeURIComponent(annots.get(this.ODATA_MEDIA_READLINK))
|
|
2168
|
-
: undefined;
|
|
2169
|
-
},
|
|
2170
|
-
editLink(annots) {
|
|
2171
|
-
return annots.has(this.ODATA_EDITLINK)
|
|
2172
|
-
? decodeURIComponent(annots.get(this.ODATA_EDITLINK))
|
|
2173
|
-
: undefined;
|
|
2174
|
-
},
|
|
2175
|
-
mediaEditLink(annots) {
|
|
2176
|
-
return annots.has(this.ODATA_MEDIA_EDITLINK)
|
|
2177
|
-
? decodeURIComponent(annots.get(this.ODATA_MEDIA_EDITLINK))
|
|
2178
|
-
: undefined;
|
|
2179
|
-
},
|
|
2180
|
-
deltaLink(annots) {
|
|
2181
|
-
return annots.has(this.ODATA_DELTALINK)
|
|
2182
|
-
? decodeURIComponent(annots.get(this.ODATA_DELTALINK))
|
|
2183
|
-
: undefined;
|
|
1904
|
+
//https://github.com/niklasvh/base64-arraybuffer
|
|
1905
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
1906
|
+
// Use a lookup table to find the index.
|
|
1907
|
+
const lookup = new Uint8Array(256);
|
|
1908
|
+
for (var i = 0; i < chars.length; i++) {
|
|
1909
|
+
lookup[chars.charCodeAt(i)] = i;
|
|
1910
|
+
}
|
|
1911
|
+
const ArrayBuffers = {
|
|
1912
|
+
toArrayBuffer(v) {
|
|
1913
|
+
var bufferLength = v.length * 0.75, len = v.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
|
|
1914
|
+
if (v[v.length - 1] === '=') {
|
|
1915
|
+
bufferLength--;
|
|
1916
|
+
if (v[v.length - 2] === '=') {
|
|
1917
|
+
bufferLength--;
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);
|
|
1921
|
+
for (i = 0; i < len; i += 4) {
|
|
1922
|
+
encoded1 = lookup[v.charCodeAt(i)];
|
|
1923
|
+
encoded2 = lookup[v.charCodeAt(i + 1)];
|
|
1924
|
+
encoded3 = lookup[v.charCodeAt(i + 2)];
|
|
1925
|
+
encoded4 = lookup[v.charCodeAt(i + 3)];
|
|
1926
|
+
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
|
|
1927
|
+
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
|
|
1928
|
+
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
|
|
1929
|
+
}
|
|
1930
|
+
return arraybuffer;
|
|
2184
1931
|
},
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
1932
|
+
toString(v) {
|
|
1933
|
+
var bytes = new Uint8Array(v), i, len = bytes.length, base64 = '';
|
|
1934
|
+
for (i = 0; i < len; i += 3) {
|
|
1935
|
+
base64 += chars[bytes[i] >> 2];
|
|
1936
|
+
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
|
1937
|
+
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
|
1938
|
+
base64 += chars[bytes[i + 2] & 63];
|
|
1939
|
+
}
|
|
1940
|
+
if (len % 3 === 2) {
|
|
1941
|
+
base64 = base64.substring(0, base64.length - 1) + '=';
|
|
1942
|
+
}
|
|
1943
|
+
else if (len % 3 === 1) {
|
|
1944
|
+
base64 = base64.substring(0, base64.length - 2) + '==';
|
|
1945
|
+
}
|
|
1946
|
+
return base64;
|
|
2189
1947
|
},
|
|
2190
1948
|
};
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
//odata.id: the ID of the entity
|
|
2199
|
-
ODATA_ID: '@odata.id',
|
|
2200
|
-
//odata.count: the total count of a collection of entities or collection of entity references, if requested.
|
|
2201
|
-
ODATA_COUNT: '@odata.count',
|
|
2202
|
-
//odata.context: the context URL for a collection, entity, primitive value, or service document.
|
|
2203
|
-
ODATA_CONTEXT: '@odata.context',
|
|
2204
|
-
//odata.etag: the ETag of the entity
|
|
2205
|
-
ODATA_ETAG: '@odata.etag',
|
|
2206
|
-
ODATA_METADATA_ETAG: '@odata.metadataEtag',
|
|
2207
|
-
//odata.type: the type of the containing {[name: string]: any} or targeted property if the type of the {[name: string]: any} or targeted property cannot be heuristically determined
|
|
2208
|
-
ODATA_TYPE: '@odata.type',
|
|
2209
|
-
//odata.nextLink: the next link of a collection with partial results
|
|
2210
|
-
ODATA_NEXTLINK: '@odata.nextLink',
|
|
2211
|
-
//odata.deltaLink: the delta link for obtaining changes to the result, if requested
|
|
2212
|
-
ODATA_DELTALINK: '@odata.deltaLink',
|
|
2213
|
-
//odata.readLink: the link used to read the entity, if the edit link cannot be used to read the entity
|
|
2214
|
-
ODATA_READLINK: '@odata.readLink',
|
|
2215
|
-
//odata.editLink: the link used to edit/update the entity, if the entity is updatable and the odata.id does not represent a URL that can be used to edit the entity
|
|
2216
|
-
ODATA_EDITLINK: '@odata.editLink',
|
|
2217
|
-
//odata.associationLink: the link used to describe the relationship between this entity and related entities
|
|
2218
|
-
ODATA_ASSOCIATIONLINK: '@odata.associationLink',
|
|
2219
|
-
//odata.navigationLink: the link used to retrieve the values of a navigation property
|
|
2220
|
-
ODATA_NAVIGATIONLINK: '@odata.navigationLink',
|
|
2221
|
-
//Media entities and stream properties may in addition contain the following annotations:
|
|
2222
|
-
//odata.mediaEtag: the ETag of the stream, as appropriate
|
|
2223
|
-
ODATA_MEDIA_ETAG: '@odata.mediaEtag',
|
|
2224
|
-
//odata.mediaContentType: the content type of the stream
|
|
2225
|
-
ODATA_MEDIA_CONTENTTYPE: '@odata.mediaContentType',
|
|
2226
|
-
//odata.mediaReadLink: the link used to read the stream
|
|
2227
|
-
ODATA_MEDIA_READLINK: '@odata.mediaReadLink',
|
|
2228
|
-
//odata.mediaEditLink: the link used to edit/update the stream
|
|
2229
|
-
ODATA_MEDIA_EDITLINK: '@odata.mediaEditLink',
|
|
2230
|
-
//http://nb-mdp-dev01:57970/$metadata#recursos/$entity
|
|
2231
|
-
//http://nb-mdp-dev01:57970/$metadata#categorias
|
|
2232
|
-
//http://nb-mdp-dev01:57970/$metadata#juzgados
|
|
2233
|
-
//http://nb-mdp-dev01:57970/$metadata#Collection(SIU.Recursos.RecursoEntry)
|
|
2234
|
-
//http://nb-mdp-dev01:57970/$metadata#categorias/$entity
|
|
2235
|
-
//http://nb-mdp-dev01:57970/$metadata#categorias(children(children(children(children(children(children(children(children(children(children()))))))))))/$entity
|
|
2236
|
-
//http://nb-mdp-dev01:57970/$metadata#recursos/SIU.Documentos.Documento/$entity
|
|
2237
|
-
//http://nb-mdp-dev01:57970/$metadata#SIU.Api.Infrastructure.Storage.Backend.SiuUrls
|
|
2238
|
-
context(annots) {
|
|
2239
|
-
let ctx = {};
|
|
2240
|
-
const str = annots instanceof Map
|
|
2241
|
-
? annots.get(this.ODATA_CONTEXT)
|
|
2242
|
-
: annots[this.ODATA_CONTEXT];
|
|
2243
|
-
if (typeof str === 'string') {
|
|
2244
|
-
let index = str.indexOf('$metadata');
|
|
2245
|
-
ctx.serviceRootUrl = str.substring(0, index);
|
|
2246
|
-
index = str.indexOf('#');
|
|
2247
|
-
ctx.metadataUrl = str.substring(0, index);
|
|
2248
|
-
const parts = str.substring(index + 1).split('/');
|
|
2249
|
-
const col = COLLECTION.exec(parts[0]);
|
|
2250
|
-
if (col) {
|
|
2251
|
-
ctx.type = col[1];
|
|
2252
|
-
}
|
|
2253
|
-
else if (parts[0].indexOf('.') !== -1) {
|
|
2254
|
-
ctx.type = parts[0];
|
|
2255
|
-
}
|
|
2256
|
-
else {
|
|
2257
|
-
const property = parts[0].match(PROPERTY);
|
|
2258
|
-
const expand = parts[0].match(EXPAND);
|
|
2259
|
-
ctx.entity = parts[1] === '$entity';
|
|
2260
|
-
if (property) {
|
|
2261
|
-
ctx.entitySet = property[1];
|
|
2262
|
-
ctx.key = property[2];
|
|
2263
|
-
ctx.property = parts[1];
|
|
2264
|
-
}
|
|
2265
|
-
else if (expand) {
|
|
2266
|
-
ctx.entitySet = expand[1];
|
|
2267
|
-
ctx.expand = expand[2];
|
|
2268
|
-
}
|
|
2269
|
-
else {
|
|
2270
|
-
ctx.entitySet = parts[0];
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
}
|
|
2274
|
-
return ctx;
|
|
2275
|
-
},
|
|
2276
|
-
countParam() {
|
|
2277
|
-
return { [$COUNT]: 'true' };
|
|
2278
|
-
},
|
|
1949
|
+
|
|
1950
|
+
// Core EdmTypeParserBuilder
|
|
1951
|
+
const EdmParser = (_d, _s, _e) => ({
|
|
1952
|
+
deserialize(value, options) {
|
|
1953
|
+
return Array.isArray(value)
|
|
1954
|
+
? value.map((v) => _d(v, options))
|
|
1955
|
+
: _d(value, options);
|
|
2279
1956
|
},
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
ODATA_ANNOTATION_PREFIX: 'odata.',
|
|
2285
|
-
ODATA_FUNCTION_PREFIX: '',
|
|
2286
|
-
ODATA_ID: 'odata.id',
|
|
2287
|
-
ODATA_ETAG: 'odata.etag',
|
|
2288
|
-
ODATA_CONTEXT: 'odata.metadata',
|
|
2289
|
-
ODATA_NEXTLINK: 'odata.nextLink',
|
|
2290
|
-
ODATA_TYPE: 'odata.type',
|
|
2291
|
-
ODATA_COUNT: 'odata.count',
|
|
2292
|
-
VALUE: 'value',
|
|
2293
|
-
context(annots) {
|
|
2294
|
-
let ctx = {};
|
|
2295
|
-
const str = annots instanceof Map
|
|
2296
|
-
? annots.get(this.ODATA_CONTEXT)
|
|
2297
|
-
: annots[this.ODATA_CONTEXT];
|
|
2298
|
-
if (typeof str === 'string') {
|
|
2299
|
-
let index = str.indexOf('$metadata');
|
|
2300
|
-
ctx.serviceRootUrl = str.substring(0, index);
|
|
2301
|
-
index = str.indexOf('#');
|
|
2302
|
-
ctx.metadataUrl = str.substring(0, index);
|
|
2303
|
-
const parts = str.substring(index + 1).split('/');
|
|
2304
|
-
ctx.entitySet = parts[0];
|
|
2305
|
-
}
|
|
2306
|
-
return ctx;
|
|
2307
|
-
},
|
|
2308
|
-
countParam() {
|
|
2309
|
-
return { [$INLINECOUNT]: 'allpages' };
|
|
2310
|
-
},
|
|
1957
|
+
serialize(value, options) {
|
|
1958
|
+
return Array.isArray(value)
|
|
1959
|
+
? value.map((v) => _s(v, options))
|
|
1960
|
+
: _s(value, options);
|
|
2311
1961
|
},
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
ODATA_ANNOTATION: '__metadata',
|
|
2319
|
-
ODATA_NEXTLINK: '__next',
|
|
2320
|
-
ODATA_COUNT: '__count',
|
|
2321
|
-
ODATA_DEFERRED: '__deferred',
|
|
2322
|
-
ODATA_TYPE: 'type',
|
|
2323
|
-
VALUE: 'results',
|
|
2324
|
-
annotations(value) {
|
|
2325
|
-
const annots = new Map();
|
|
2326
|
-
if (this.ODATA_ANNOTATION in value) {
|
|
2327
|
-
Object.entries(value[this.ODATA_ANNOTATION]).forEach(([key, value]) => annots.set(key, value));
|
|
2328
|
-
}
|
|
2329
|
-
return annots;
|
|
2330
|
-
},
|
|
2331
|
-
context(annots) {
|
|
2332
|
-
let ctx = {};
|
|
2333
|
-
return ctx;
|
|
2334
|
-
},
|
|
2335
|
-
attributes(value, metadata) {
|
|
2336
|
-
return value;
|
|
2337
|
-
},
|
|
2338
|
-
countParam() {
|
|
2339
|
-
return { [$INLINECOUNT]: 'allpages' };
|
|
2340
|
-
},
|
|
1962
|
+
encode(value, options) {
|
|
1963
|
+
return Array.isArray(value)
|
|
1964
|
+
? value.map((v) => (!isRawType(v) ? _e(v, options) : v))
|
|
1965
|
+
: !isRawType(value)
|
|
1966
|
+
? _e(value, options)
|
|
1967
|
+
: value;
|
|
2341
1968
|
},
|
|
2342
|
-
|
|
1969
|
+
});
|
|
1970
|
+
const Identity = (v) => v;
|
|
1971
|
+
const toNumber = (v) => Number(v);
|
|
1972
|
+
const toString = (v) => v.toString();
|
|
1973
|
+
const toBoolean = (v) => Boolean(v);
|
|
1974
|
+
const toDate = (v) => new Date(v);
|
|
1975
|
+
const EDM_PARSERS = {
|
|
1976
|
+
//Edm.Guid 16-byte (128-bit) unique identifier
|
|
1977
|
+
[EdmType.Guid]: EdmParser(Identity, Identity, (v) => raw(v)),
|
|
1978
|
+
//Edm.Int16 Signed 16-bit integer
|
|
1979
|
+
[EdmType.Int16]: EdmParser(toNumber, toNumber, toNumber),
|
|
1980
|
+
//Edm.String Sequence of UTF-8 characters
|
|
1981
|
+
[EdmType.String]: EdmParser(toString, toString, toString),
|
|
1982
|
+
//Edm.Boolean Binary-valued logic
|
|
1983
|
+
[EdmType.Boolean]: EdmParser(toBoolean, toBoolean, toBoolean),
|
|
1984
|
+
//Edm.Byte Unsigned 8-bit integer
|
|
1985
|
+
[EdmType.Byte]: EdmParser(toNumber, toNumber, toNumber),
|
|
1986
|
+
//Edm.SByte Signed 8-bit integer
|
|
1987
|
+
[EdmType.SByte]: EdmParser(toNumber, toNumber, toNumber),
|
|
1988
|
+
//Edm.Int32 Signed 16-bit integer
|
|
1989
|
+
[EdmType.Int32]: EdmParser(toNumber, toNumber, toNumber),
|
|
1990
|
+
//Edm.Int64 Signed 16-bit integer
|
|
1991
|
+
[EdmType.Int64]: EdmParser(toNumber, toNumber, toNumber),
|
|
1992
|
+
//Edm.Date Date without a time-zone offset
|
|
1993
|
+
[EdmType.Date]: EdmParser((v) => new Date(`${v}T00:00:00.000Z`), (v) => toDate(v).toISOString().substring(0, 10), (v) => raw(toDate(v).toISOString().substring(0, 10))),
|
|
1994
|
+
//Edm.TimeOfDay Clock time 00:00-23:59:59.999999999999
|
|
1995
|
+
[EdmType.TimeOfDay]: EdmParser((v) => new Date(`1970-01-01T${v}Z`), (v) => toDate(v).toISOString().substring(11, 23), (v) => raw(toDate(v).toISOString().substring(11, 23))),
|
|
1996
|
+
//Edm.DateTimeOffset Date and time with a time-zone offset, no leap seconds
|
|
1997
|
+
[EdmType.DateTimeOffset]: EdmParser(toDate, (v) => toDate(v).toISOString(), (v) => raw(toDate(v).toISOString())),
|
|
1998
|
+
//Edm.Duration Signed duration in days, hours, minutes, and (sub)seconds
|
|
1999
|
+
[EdmType.Duration]: EdmParser((v) => Durations.toDuration(v), (v) => Durations.toString(v), (v) => raw(Durations.toString(v))),
|
|
2000
|
+
//Edm.Decimal Numeric values with fixed precision and scale
|
|
2001
|
+
[EdmType.Decimal]: EdmParser(toNumber, (v, o) => {
|
|
2002
|
+
if (o.ieee754Compatible) {
|
|
2003
|
+
let vstr = v.toPrecision(o.field.precision);
|
|
2004
|
+
if (typeof o.field.scale === 'number') {
|
|
2005
|
+
vstr = parseFloat(vstr).toFixed(o.field.scale);
|
|
2006
|
+
}
|
|
2007
|
+
return vstr;
|
|
2008
|
+
}
|
|
2009
|
+
return v;
|
|
2010
|
+
}, (v, o) => {
|
|
2011
|
+
if (o.ieee754Compatible) {
|
|
2012
|
+
let vstr = v.toPrecision(o.field.precision);
|
|
2013
|
+
if (typeof o.field.scale === 'number') {
|
|
2014
|
+
vstr = parseFloat(vstr).toFixed(o.field.scale);
|
|
2015
|
+
}
|
|
2016
|
+
return raw(vstr);
|
|
2017
|
+
}
|
|
2018
|
+
return v;
|
|
2019
|
+
}),
|
|
2020
|
+
//Edm.Double IEEE 754 binary64 floating-point number (15-17 decimal digits)
|
|
2021
|
+
[EdmType.Double]: EdmParser((v) => (v === 'INF' ? Infinity : v), (v) => (v === Infinity ? 'INF' : v), (v) => raw(v === Infinity ? 'INF' : v.toString())),
|
|
2022
|
+
//Edm.Single IEEE 754 binary32 floating-point number (6-9 decimal digits)
|
|
2023
|
+
[EdmType.Single]: EdmParser((v) => (v === 'INF' ? Infinity : v), (v) => (v === Infinity ? 'INF' : v), (v) => raw(v === Infinity ? 'INF' : v.toString())),
|
|
2024
|
+
//Edm.Binary Binary data
|
|
2025
|
+
[EdmType.Binary]: EdmParser((v) => ArrayBuffers.toArrayBuffer(v), (v) => ArrayBuffers.toString(v), (v) => raw(ArrayBuffers.toString(v))),
|
|
2343
2026
|
};
|
|
2027
|
+
/*
|
|
2028
|
+
Edm.Stream Binary data stream
|
|
2029
|
+
Edm.Geography Abstract base type for all Geography types
|
|
2030
|
+
Edm.GeographyPoint A point in a round-earth coordinate system
|
|
2031
|
+
Edm.GeographyLineString Line string in a round-earth coordinate system
|
|
2032
|
+
Edm.GeographyPolygon Polygon in a round-earth coordinate system
|
|
2033
|
+
Edm.GeographyMultiPoint Collection of points in a round-earth coordinate system
|
|
2034
|
+
Edm.GeographyMultiLineString Collection of line strings in a round-earth coordinate system
|
|
2035
|
+
Edm.GeographyMultiPolygon Collection of polygons in a round-earth coordinate system
|
|
2036
|
+
Edm.GeographyCollection Collection of arbitrary Geography values
|
|
2037
|
+
Edm.Geometry Abstract base type for all Geometry types
|
|
2038
|
+
Edm.GeometryPoint Point in a flat-earth coordinate system
|
|
2039
|
+
Edm.GeometryLineString Line string in a flat-earth coordinate system
|
|
2040
|
+
Edm.GeometryPolygon Polygon in a flat-earth coordinate system
|
|
2041
|
+
Edm.GeometryMultiPoint Collection of points in a flat-earth coordinate system
|
|
2042
|
+
Edm.GeometryMultiLineString Collection of line strings in a flat-earth coordinate system
|
|
2043
|
+
Edm.GeometryMultiPolygon Collection of polygons in a flat-earth coordinate system
|
|
2044
|
+
Edm.GeometryCollection Collection of arbitrary Geometry values
|
|
2045
|
+
*/
|
|
2046
|
+
|
|
2047
|
+
class ODataEnumTypeFieldParser extends ODataAnnotatable {
|
|
2048
|
+
name;
|
|
2049
|
+
value;
|
|
2050
|
+
constructor(name, field) {
|
|
2051
|
+
super(field);
|
|
2052
|
+
this.name = name;
|
|
2053
|
+
this.value = field.value;
|
|
2054
|
+
}
|
|
2055
|
+
titleize(term) {
|
|
2056
|
+
return (term && this.annotatedValue(term)) || this.name;
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
class ODataEnumTypeParser extends ODataAnnotatable {
|
|
2060
|
+
name;
|
|
2061
|
+
namespace;
|
|
2062
|
+
alias;
|
|
2063
|
+
flags;
|
|
2064
|
+
members;
|
|
2065
|
+
_fields;
|
|
2066
|
+
parserOptions;
|
|
2067
|
+
constructor(config, namespace, alias) {
|
|
2068
|
+
super(config);
|
|
2069
|
+
this.name = config.name;
|
|
2070
|
+
this.namespace = namespace;
|
|
2071
|
+
this.alias = alias;
|
|
2072
|
+
this.flags = config.flags;
|
|
2073
|
+
this.members = config.members;
|
|
2074
|
+
this._fields = Object.entries(config.fields).map(([name, f]) => new ODataEnumTypeFieldParser(name, f));
|
|
2075
|
+
}
|
|
2076
|
+
configure({ options }) {
|
|
2077
|
+
this.parserOptions = options;
|
|
2078
|
+
}
|
|
2079
|
+
isTypeOf(type) {
|
|
2080
|
+
var names = [`${this.namespace}.${this.name}`];
|
|
2081
|
+
if (this.alias)
|
|
2082
|
+
names.push(`${this.alias}.${this.name}`);
|
|
2083
|
+
return names.indexOf(type) !== -1;
|
|
2084
|
+
}
|
|
2085
|
+
fields(namesValue) {
|
|
2086
|
+
if (namesValue === undefined)
|
|
2087
|
+
return [...this._fields];
|
|
2088
|
+
if (Array.isArray(namesValue))
|
|
2089
|
+
return [...this._fields.filter((f) => namesValue.includes(f.value))];
|
|
2090
|
+
if (typeof namesValue === 'number') {
|
|
2091
|
+
return [
|
|
2092
|
+
...this._fields.filter((f) => (this.flags && Boolean(f.value & namesValue)) ||
|
|
2093
|
+
f.value === namesValue),
|
|
2094
|
+
];
|
|
2095
|
+
}
|
|
2096
|
+
if (typeof namesValue === 'string') {
|
|
2097
|
+
const names = namesValue.split(',').map((o) => o.trim());
|
|
2098
|
+
return this._fields.filter((f) => names.includes(f.name));
|
|
2099
|
+
}
|
|
2100
|
+
return [];
|
|
2101
|
+
}
|
|
2102
|
+
field(nameValue) {
|
|
2103
|
+
const field = this.fields().find((f) => f.name === nameValue || f.value === nameValue);
|
|
2104
|
+
//Throw error if not found
|
|
2105
|
+
//if (field === undefined)
|
|
2106
|
+
// throw new Error(`${this.name} has no field for ${nameValue}`);
|
|
2107
|
+
return field;
|
|
2108
|
+
}
|
|
2109
|
+
/**
|
|
2110
|
+
* Map the fields of the enum type.
|
|
2111
|
+
* @param mapper Function that maps the value to the new value
|
|
2112
|
+
* @returns The fields mapped by the mapper
|
|
2113
|
+
*/
|
|
2114
|
+
mapFields(mapper) {
|
|
2115
|
+
return this.fields().map(mapper);
|
|
2116
|
+
}
|
|
2117
|
+
// Deserialize
|
|
2118
|
+
deserialize(value, options) {
|
|
2119
|
+
// string -> number
|
|
2120
|
+
const parserOptions = { ...this.parserOptions, ...options };
|
|
2121
|
+
if (this.flags) {
|
|
2122
|
+
return this.fields(value).reduce((acc, f) => acc | f.value, 0);
|
|
2123
|
+
}
|
|
2124
|
+
else {
|
|
2125
|
+
return this.field(value)?.value;
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
// Serialize
|
|
2129
|
+
serialize(value, options) {
|
|
2130
|
+
// Enum are string | number
|
|
2131
|
+
// string | number -> string
|
|
2132
|
+
const parserOptions = { ...this.parserOptions, ...options };
|
|
2133
|
+
if (this.flags) {
|
|
2134
|
+
let names = this.fields(value).map((f) => f.name);
|
|
2135
|
+
if (names.length === 0)
|
|
2136
|
+
names = [`${value}`];
|
|
2137
|
+
return !parserOptions?.stringAsEnum
|
|
2138
|
+
? `${this.namespace}.${this.name}'${names.join(', ')}'`
|
|
2139
|
+
: names.join(', ');
|
|
2140
|
+
}
|
|
2141
|
+
else {
|
|
2142
|
+
let name = this.field(value)?.name;
|
|
2143
|
+
if (name === undefined)
|
|
2144
|
+
name = `${value}`;
|
|
2145
|
+
return !parserOptions?.stringAsEnum
|
|
2146
|
+
? `${this.namespace}.${this.name}'${name}'`
|
|
2147
|
+
: name;
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
//Encode
|
|
2151
|
+
encode(value, options) {
|
|
2152
|
+
const parserOptions = { ...this.parserOptions, ...options };
|
|
2153
|
+
const serialized = this.serialize(value, parserOptions);
|
|
2154
|
+
if (serialized === undefined)
|
|
2155
|
+
return undefined;
|
|
2156
|
+
return parserOptions?.stringAsEnum
|
|
2157
|
+
? raw(`'${serialized}'`)
|
|
2158
|
+
: raw(serialized);
|
|
2159
|
+
}
|
|
2160
|
+
// Json Schema
|
|
2161
|
+
toJsonSchema() {
|
|
2162
|
+
return this.flags
|
|
2163
|
+
? {
|
|
2164
|
+
title: this.name,
|
|
2165
|
+
type: JsonType.array,
|
|
2166
|
+
items: {
|
|
2167
|
+
type: JsonType.integer,
|
|
2168
|
+
},
|
|
2169
|
+
}
|
|
2170
|
+
: {
|
|
2171
|
+
type: JsonType.integer,
|
|
2172
|
+
enum: this._fields.map((f) => f.value),
|
|
2173
|
+
};
|
|
2174
|
+
}
|
|
2175
|
+
validate(value, { method, navigation = false, } = {}) {
|
|
2176
|
+
if (this.flags) {
|
|
2177
|
+
let fields = this.fields(value);
|
|
2178
|
+
return value && fields.length === 0 ? ['mismatch'] : undefined;
|
|
2179
|
+
}
|
|
2180
|
+
else {
|
|
2181
|
+
return this.fields(value).length !== 1 ? ['mismatch'] : undefined;
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
unpack(value) {
|
|
2185
|
+
return this.fields(value).map((f) => f.value);
|
|
2186
|
+
}
|
|
2187
|
+
pack(value) {
|
|
2188
|
+
return this.fields(value).reduce((acc, v) => acc | v.value, 0);
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2344
2191
|
|
|
2345
2192
|
class ODataEntityTypeKey {
|
|
2193
|
+
name;
|
|
2194
|
+
alias;
|
|
2346
2195
|
constructor({ name, alias }) {
|
|
2347
2196
|
this.name = name;
|
|
2348
2197
|
this.alias = alias;
|
|
2349
2198
|
}
|
|
2350
2199
|
}
|
|
2351
2200
|
class ODataReferential {
|
|
2201
|
+
property;
|
|
2202
|
+
referencedProperty;
|
|
2352
2203
|
constructor({ property, referencedProperty, }) {
|
|
2353
2204
|
this.property = property;
|
|
2354
2205
|
this.referencedProperty = referencedProperty;
|
|
2355
2206
|
}
|
|
2356
2207
|
}
|
|
2357
2208
|
class ODataStructuredTypeFieldParser extends ODataAnnotatable {
|
|
2209
|
+
name;
|
|
2210
|
+
structured;
|
|
2211
|
+
type;
|
|
2212
|
+
parser;
|
|
2213
|
+
collection;
|
|
2214
|
+
navigation;
|
|
2215
|
+
nullable;
|
|
2216
|
+
default;
|
|
2217
|
+
maxLength;
|
|
2218
|
+
precision;
|
|
2219
|
+
scale;
|
|
2220
|
+
referentials;
|
|
2221
|
+
parserOptions;
|
|
2358
2222
|
constructor(name, structured, field) {
|
|
2359
2223
|
super(field);
|
|
2360
2224
|
this.name = name;
|
|
@@ -2543,9 +2407,9 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
|
|
|
2543
2407
|
}
|
|
2544
2408
|
//#endregion
|
|
2545
2409
|
isKey() {
|
|
2546
|
-
return
|
|
2410
|
+
return this.structured
|
|
2547
2411
|
.keys({ include_parents: true })
|
|
2548
|
-
|
|
2412
|
+
.some((k) => k.name === this.name);
|
|
2549
2413
|
}
|
|
2550
2414
|
hasReferentials() {
|
|
2551
2415
|
return this.referentials.length !== 0;
|
|
@@ -2576,10 +2440,18 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
|
|
|
2576
2440
|
}
|
|
2577
2441
|
}
|
|
2578
2442
|
class ODataStructuredTypeParser extends ODataAnnotatable {
|
|
2443
|
+
name;
|
|
2444
|
+
namespace;
|
|
2445
|
+
open;
|
|
2446
|
+
children = [];
|
|
2447
|
+
alias;
|
|
2448
|
+
base;
|
|
2449
|
+
parent;
|
|
2450
|
+
_keys;
|
|
2451
|
+
_fields = [];
|
|
2452
|
+
parserOptions;
|
|
2579
2453
|
constructor(config, namespace, alias) {
|
|
2580
2454
|
super(config);
|
|
2581
|
-
this.children = [];
|
|
2582
|
-
this._fields = [];
|
|
2583
2455
|
this.name = config.name;
|
|
2584
2456
|
this.base = config.base;
|
|
2585
2457
|
this.open = config.open || false;
|
|
@@ -2741,14 +2613,23 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
|
|
|
2741
2613
|
* @param include_etag Include the etag field
|
|
2742
2614
|
* @returns The picked fields
|
|
2743
2615
|
*/
|
|
2744
|
-
pick(attrs, { include_parents = true, include_navigation = false, include_etag = true, options, } = {}) {
|
|
2745
|
-
const parserOptions = options
|
|
2746
|
-
|
|
2616
|
+
pick(attrs, { include_id = true, include_key = true, include_parents = true, include_navigation = false, include_computed = false, include_etag = true, options, } = {}) {
|
|
2617
|
+
const parserOptions = options ?? this.parserOptions;
|
|
2618
|
+
let fields = this.fields({ include_parents, include_navigation });
|
|
2619
|
+
if (!include_key) {
|
|
2620
|
+
fields = fields.filter((f) => !f.isKey());
|
|
2621
|
+
}
|
|
2622
|
+
if (!include_computed) {
|
|
2623
|
+
fields = fields.filter((f) => !f.annotatedValue(COMPUTED) || (f.isKey() && include_key));
|
|
2624
|
+
}
|
|
2747
2625
|
return Object.keys(attrs)
|
|
2748
|
-
.filter((key) =>
|
|
2626
|
+
.filter((key) => fields.some((f) => f.name === key) ||
|
|
2749
2627
|
(key ==
|
|
2750
2628
|
ODataHelper[parserOptions?.version || DEFAULT_VERSION].ODATA_ETAG &&
|
|
2751
|
-
include_etag)
|
|
2629
|
+
include_etag) ||
|
|
2630
|
+
(key ==
|
|
2631
|
+
ODataHelper[parserOptions?.version || DEFAULT_VERSION].ODATA_ID &&
|
|
2632
|
+
include_id))
|
|
2752
2633
|
.reduce((acc, key) => Object.assign(acc, { [key]: attrs[key] }), {});
|
|
2753
2634
|
}
|
|
2754
2635
|
resolveKey(value, { resolve = true, single = true, } = {}) {
|
|
@@ -2850,6 +2731,12 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
|
|
|
2850
2731
|
}
|
|
2851
2732
|
|
|
2852
2733
|
class ODataParameterParser {
|
|
2734
|
+
name;
|
|
2735
|
+
type;
|
|
2736
|
+
parser;
|
|
2737
|
+
collection;
|
|
2738
|
+
nullable;
|
|
2739
|
+
parserOptions;
|
|
2853
2740
|
constructor(name, parameter) {
|
|
2854
2741
|
this.name = name;
|
|
2855
2742
|
this.type = parameter.type;
|
|
@@ -2900,6 +2787,13 @@ class ODataParameterParser {
|
|
|
2900
2787
|
}
|
|
2901
2788
|
}
|
|
2902
2789
|
class ODataCallableParser {
|
|
2790
|
+
name;
|
|
2791
|
+
namespace;
|
|
2792
|
+
alias;
|
|
2793
|
+
return;
|
|
2794
|
+
parser;
|
|
2795
|
+
parameters;
|
|
2796
|
+
parserOptions;
|
|
2903
2797
|
constructor(config, namespace, alias) {
|
|
2904
2798
|
this.name = config.name;
|
|
2905
2799
|
this.namespace = namespace;
|
|
@@ -2956,6 +2850,9 @@ class ODataCallableParser {
|
|
|
2956
2850
|
}
|
|
2957
2851
|
|
|
2958
2852
|
class ODataCallable extends ODataParserSchemaElement {
|
|
2853
|
+
entitySetPath;
|
|
2854
|
+
bound;
|
|
2855
|
+
composable;
|
|
2959
2856
|
constructor(config, schema) {
|
|
2960
2857
|
super(config, schema, new ODataCallableParser(config, schema.namespace, schema.alias));
|
|
2961
2858
|
this.entitySetPath = config.entitySetPath;
|
|
@@ -3020,6 +2917,8 @@ class ODataCallable extends ODataParserSchemaElement {
|
|
|
3020
2917
|
}
|
|
3021
2918
|
|
|
3022
2919
|
class ODataEntitySet extends ODataSchemaElement {
|
|
2920
|
+
entityType;
|
|
2921
|
+
service;
|
|
3023
2922
|
constructor(config, schema) {
|
|
3024
2923
|
super(config, schema);
|
|
3025
2924
|
this.entityType = config.entityType;
|
|
@@ -3028,6 +2927,8 @@ class ODataEntitySet extends ODataSchemaElement {
|
|
|
3028
2927
|
}
|
|
3029
2928
|
|
|
3030
2929
|
class ODataSingleton extends ODataSchemaElement {
|
|
2930
|
+
singletonType;
|
|
2931
|
+
service;
|
|
3031
2932
|
constructor(config, schema) {
|
|
3032
2933
|
super(config, schema);
|
|
3033
2934
|
this.singletonType = config.type;
|
|
@@ -3036,6 +2937,8 @@ class ODataSingleton extends ODataSchemaElement {
|
|
|
3036
2937
|
}
|
|
3037
2938
|
|
|
3038
2939
|
class ODataEntityContainer extends ODataSchemaElement {
|
|
2940
|
+
entitySets;
|
|
2941
|
+
singletons;
|
|
3039
2942
|
constructor(config, schema) {
|
|
3040
2943
|
super(config, schema);
|
|
3041
2944
|
this.entitySets = (config.entitySets ?? []).map((config) => new ODataEntitySet(config, schema));
|
|
@@ -3044,6 +2947,7 @@ class ODataEntityContainer extends ODataSchemaElement {
|
|
|
3044
2947
|
}
|
|
3045
2948
|
|
|
3046
2949
|
class ODataEnumType extends ODataParserSchemaElement {
|
|
2950
|
+
members;
|
|
3047
2951
|
constructor(config, schema) {
|
|
3048
2952
|
super(config, schema, new ODataEnumTypeParser(config, schema.namespace, schema.alias));
|
|
3049
2953
|
this.members = config.members;
|
|
@@ -3055,16 +2959,16 @@ class ODataEnumType extends ODataParserSchemaElement {
|
|
|
3055
2959
|
* Returns the fields of the enum type.
|
|
3056
2960
|
* @returns The fields of the enum type.
|
|
3057
2961
|
*/
|
|
3058
|
-
fields(
|
|
3059
|
-
return this.parser.fields(
|
|
2962
|
+
fields(namesValue) {
|
|
2963
|
+
return this.parser.fields(namesValue);
|
|
3060
2964
|
}
|
|
3061
2965
|
/**
|
|
3062
2966
|
* Find a field by name or value.
|
|
3063
2967
|
* @param enu The name or value of the field
|
|
3064
2968
|
* @returns The field with the given name or value
|
|
3065
2969
|
*/
|
|
3066
|
-
field(
|
|
3067
|
-
return this.parser.field(
|
|
2970
|
+
field(nameValue) {
|
|
2971
|
+
return this.parser.field(nameValue);
|
|
3068
2972
|
}
|
|
3069
2973
|
/**
|
|
3070
2974
|
* Map the fields of the enum type.
|
|
@@ -3110,9 +3014,13 @@ class ODataEnumType extends ODataParserSchemaElement {
|
|
|
3110
3014
|
}
|
|
3111
3015
|
|
|
3112
3016
|
class ODataStructuredType extends ODataParserSchemaElement {
|
|
3017
|
+
base;
|
|
3018
|
+
parent;
|
|
3019
|
+
children = [];
|
|
3020
|
+
model;
|
|
3021
|
+
collection;
|
|
3113
3022
|
constructor(config, schema) {
|
|
3114
3023
|
super(config, schema, new ODataStructuredTypeParser(config, schema.namespace, schema.alias));
|
|
3115
|
-
this.children = [];
|
|
3116
3024
|
this.base = config.base;
|
|
3117
3025
|
this.model = config.model;
|
|
3118
3026
|
this.collection = config.collection;
|
|
@@ -3234,10 +3142,13 @@ class ODataStructuredType extends ODataParserSchemaElement {
|
|
|
3234
3142
|
* @param include_etag Include the etag field
|
|
3235
3143
|
* @returns The picked fields
|
|
3236
3144
|
*/
|
|
3237
|
-
pick(attrs, { include_parents = true, include_navigation = false, include_etag = true, } = {}) {
|
|
3145
|
+
pick(attrs, { include_id = true, include_key = true, include_parents = true, include_navigation = false, include_computed = false, include_etag = true, } = {}) {
|
|
3238
3146
|
return this.parser.pick(attrs, {
|
|
3147
|
+
include_id,
|
|
3148
|
+
include_key,
|
|
3239
3149
|
include_etag,
|
|
3240
3150
|
include_navigation,
|
|
3151
|
+
include_computed,
|
|
3241
3152
|
include_parents,
|
|
3242
3153
|
options: this.api.options,
|
|
3243
3154
|
});
|
|
@@ -3321,6 +3232,13 @@ class ODataStructuredType extends ODataParserSchemaElement {
|
|
|
3321
3232
|
}
|
|
3322
3233
|
|
|
3323
3234
|
class ODataSchema extends ODataAnnotatable {
|
|
3235
|
+
api;
|
|
3236
|
+
namespace;
|
|
3237
|
+
alias;
|
|
3238
|
+
enums;
|
|
3239
|
+
entities;
|
|
3240
|
+
callables;
|
|
3241
|
+
containers;
|
|
3324
3242
|
constructor(config, api) {
|
|
3325
3243
|
super(config);
|
|
3326
3244
|
this.api = api;
|
|
@@ -3360,6 +3278,8 @@ class ODataSchema extends ODataAnnotatable {
|
|
|
3360
3278
|
}
|
|
3361
3279
|
|
|
3362
3280
|
class CountField {
|
|
3281
|
+
field;
|
|
3282
|
+
values;
|
|
3363
3283
|
constructor(field, values = {}) {
|
|
3364
3284
|
this.field = field;
|
|
3365
3285
|
this.values = values;
|
|
@@ -3433,7 +3353,7 @@ class CountExpression extends Expression {
|
|
|
3433
3353
|
return opts({
|
|
3434
3354
|
t: FieldFactory(),
|
|
3435
3355
|
e: () => new CountExpression(),
|
|
3436
|
-
}, current);
|
|
3356
|
+
}, current ?? new CountExpression());
|
|
3437
3357
|
}
|
|
3438
3358
|
_add(node) {
|
|
3439
3359
|
this._children.push(node);
|
|
@@ -3471,10 +3391,12 @@ class CountExpression extends Expression {
|
|
|
3471
3391
|
}
|
|
3472
3392
|
|
|
3473
3393
|
class FilterExpression extends Expression {
|
|
3394
|
+
_connector;
|
|
3395
|
+
_negated;
|
|
3474
3396
|
constructor({ children, connector, negated, } = {}) {
|
|
3475
3397
|
super({ children });
|
|
3476
|
-
this._connector = connector
|
|
3477
|
-
this._negated = negated
|
|
3398
|
+
this._connector = connector ?? 'and';
|
|
3399
|
+
this._negated = negated ?? false;
|
|
3478
3400
|
}
|
|
3479
3401
|
get [Symbol.toStringTag]() {
|
|
3480
3402
|
return 'FilterExpression';
|
|
@@ -3485,7 +3407,7 @@ class FilterExpression extends Expression {
|
|
|
3485
3407
|
t: FieldFactory(),
|
|
3486
3408
|
o: operators,
|
|
3487
3409
|
f: functions,
|
|
3488
|
-
}, current);
|
|
3410
|
+
}, current ?? new FilterExpression());
|
|
3489
3411
|
}
|
|
3490
3412
|
toJson() {
|
|
3491
3413
|
const json = super.toJson();
|
|
@@ -3643,9 +3565,13 @@ class FilterExpression extends Expression {
|
|
|
3643
3565
|
isof(left, type) {
|
|
3644
3566
|
return this._add(syntax.isof(left, type));
|
|
3645
3567
|
}
|
|
3568
|
+
combine(exp, connector = 'and') {
|
|
3569
|
+
return this._add(exp, connector);
|
|
3570
|
+
}
|
|
3646
3571
|
}
|
|
3647
3572
|
|
|
3648
3573
|
class SearchTerm {
|
|
3574
|
+
value;
|
|
3649
3575
|
constructor(value) {
|
|
3650
3576
|
this.value = value;
|
|
3651
3577
|
}
|
|
@@ -3675,10 +3601,12 @@ class SearchTerm {
|
|
|
3675
3601
|
}
|
|
3676
3602
|
}
|
|
3677
3603
|
class SearchExpression extends Expression {
|
|
3604
|
+
_connector;
|
|
3605
|
+
_negated;
|
|
3678
3606
|
constructor({ children, connector, negated, } = {}) {
|
|
3679
3607
|
super({ children });
|
|
3680
|
-
this._connector = connector
|
|
3681
|
-
this._negated = negated
|
|
3608
|
+
this._connector = connector ?? 'AND';
|
|
3609
|
+
this._negated = negated ?? false;
|
|
3682
3610
|
}
|
|
3683
3611
|
get [Symbol.toStringTag]() {
|
|
3684
3612
|
return 'SearchExpression';
|
|
@@ -3686,7 +3614,7 @@ class SearchExpression extends Expression {
|
|
|
3686
3614
|
static factory(opts, current) {
|
|
3687
3615
|
return opts({
|
|
3688
3616
|
e: (connector = 'AND') => new SearchExpression({ connector }),
|
|
3689
|
-
}, current);
|
|
3617
|
+
}, current ?? new SearchExpression());
|
|
3690
3618
|
}
|
|
3691
3619
|
_add(node, connector) {
|
|
3692
3620
|
if (connector !== undefined && this._connector !== connector) {
|
|
@@ -3781,13 +3709,18 @@ class SearchExpression extends Expression {
|
|
|
3781
3709
|
term(value) {
|
|
3782
3710
|
return this._add(new SearchTerm(value));
|
|
3783
3711
|
}
|
|
3712
|
+
combine(expression, connector = 'AND') {
|
|
3713
|
+
return this._add(expression, connector);
|
|
3714
|
+
}
|
|
3784
3715
|
}
|
|
3785
3716
|
|
|
3786
3717
|
class GroupByTransformations extends Expression {
|
|
3718
|
+
methods;
|
|
3719
|
+
aliases;
|
|
3787
3720
|
constructor({ children, methods, aliases, } = {}) {
|
|
3788
3721
|
super({ children });
|
|
3789
|
-
this.methods = methods
|
|
3790
|
-
this.aliases = aliases
|
|
3722
|
+
this.methods = methods ?? [];
|
|
3723
|
+
this.aliases = aliases ?? [];
|
|
3791
3724
|
}
|
|
3792
3725
|
get [Symbol.toStringTag]() {
|
|
3793
3726
|
return 'GroupByTransformations';
|
|
@@ -3862,7 +3795,7 @@ class ApplyExpression extends Expression {
|
|
|
3862
3795
|
return opts({
|
|
3863
3796
|
t: FieldFactory(),
|
|
3864
3797
|
e: () => new ApplyExpression(),
|
|
3865
|
-
}, current);
|
|
3798
|
+
}, current ?? new ApplyExpression());
|
|
3866
3799
|
}
|
|
3867
3800
|
toJson() {
|
|
3868
3801
|
const json = super.toJson();
|
|
@@ -3973,7 +3906,7 @@ class ApplyExpression extends Expression {
|
|
|
3973
3906
|
orderBy(
|
|
3974
3907
|
opts: (
|
|
3975
3908
|
builder: OrderByExpressionBuilder<T>,
|
|
3976
|
-
current
|
|
3909
|
+
current: OrderByExpression<T>
|
|
3977
3910
|
) => OrderByExpression<T>,
|
|
3978
3911
|
current?: OrderByExpression<T>
|
|
3979
3912
|
) {
|
|
@@ -3982,7 +3915,7 @@ class ApplyExpression extends Expression {
|
|
|
3982
3915
|
t: FieldFactory<Required<T>>(),
|
|
3983
3916
|
e: () => new OrderByExpression<T>(),
|
|
3984
3917
|
},
|
|
3985
|
-
current
|
|
3918
|
+
current ?? new OrderByExpression<T>()
|
|
3986
3919
|
) as OrderByExpression<T>;
|
|
3987
3920
|
return this._add(transformations.orderby(exp));
|
|
3988
3921
|
}
|
|
@@ -4016,6 +3949,8 @@ class ApplyExpression extends Expression {
|
|
|
4016
3949
|
}
|
|
4017
3950
|
|
|
4018
3951
|
class OrderByField {
|
|
3952
|
+
field;
|
|
3953
|
+
order;
|
|
4019
3954
|
constructor(field, order) {
|
|
4020
3955
|
this.field = field;
|
|
4021
3956
|
this.order = order;
|
|
@@ -4057,7 +3992,7 @@ class OrderByExpression extends Expression {
|
|
|
4057
3992
|
return opts({
|
|
4058
3993
|
t: FieldFactory(),
|
|
4059
3994
|
e: () => new OrderByExpression(),
|
|
4060
|
-
}, current);
|
|
3995
|
+
}, current ?? new OrderByExpression());
|
|
4061
3996
|
}
|
|
4062
3997
|
_add(node) {
|
|
4063
3998
|
this._children.push(node);
|
|
@@ -4089,6 +4024,9 @@ class OrderByExpression extends Expression {
|
|
|
4089
4024
|
descending(field) {
|
|
4090
4025
|
return this._add(new OrderByField(field, 'desc'));
|
|
4091
4026
|
}
|
|
4027
|
+
combine(expression) {
|
|
4028
|
+
return this._add(expression);
|
|
4029
|
+
}
|
|
4092
4030
|
}
|
|
4093
4031
|
|
|
4094
4032
|
class SelectExpression extends Expression {
|
|
@@ -4102,7 +4040,7 @@ class SelectExpression extends Expression {
|
|
|
4102
4040
|
return opts({
|
|
4103
4041
|
t: FieldFactory(),
|
|
4104
4042
|
e: () => new SelectExpression(),
|
|
4105
|
-
}, current);
|
|
4043
|
+
}, current ?? new SelectExpression());
|
|
4106
4044
|
}
|
|
4107
4045
|
toJson() {
|
|
4108
4046
|
const json = super.toJson();
|
|
@@ -4115,7 +4053,9 @@ class SelectExpression extends Expression {
|
|
|
4115
4053
|
}
|
|
4116
4054
|
render({ aliases, escape, prefix, parser, options, } = {}) {
|
|
4117
4055
|
return this._children
|
|
4118
|
-
.map((n) => n
|
|
4056
|
+
.map((n) => typeof n === 'string'
|
|
4057
|
+
? n
|
|
4058
|
+
: n.render({ aliases, escape, prefix, parser, options }))
|
|
4119
4059
|
.join(',');
|
|
4120
4060
|
}
|
|
4121
4061
|
clone() {
|
|
@@ -4134,9 +4074,14 @@ class SelectExpression extends Expression {
|
|
|
4134
4074
|
fields.forEach((f) => this._add(f));
|
|
4135
4075
|
return this;
|
|
4136
4076
|
}
|
|
4077
|
+
combine(expression) {
|
|
4078
|
+
return this._add(expression);
|
|
4079
|
+
}
|
|
4137
4080
|
}
|
|
4138
4081
|
|
|
4139
4082
|
class ExpandField {
|
|
4083
|
+
field;
|
|
4084
|
+
values;
|
|
4140
4085
|
constructor(field, values = {}) {
|
|
4141
4086
|
this.field = field;
|
|
4142
4087
|
this.values = values;
|
|
@@ -4157,6 +4102,7 @@ class ExpandField {
|
|
|
4157
4102
|
QueryOption.filter,
|
|
4158
4103
|
QueryOption.search,
|
|
4159
4104
|
QueryOption.orderBy,
|
|
4105
|
+
QueryOption.compute,
|
|
4160
4106
|
QueryOption.skip,
|
|
4161
4107
|
QueryOption.top,
|
|
4162
4108
|
QueryOption.count,
|
|
@@ -4212,6 +4158,9 @@ class ExpandField {
|
|
|
4212
4158
|
orderBy(opts) {
|
|
4213
4159
|
return this.option(QueryOption.orderBy, OrderByExpression.factory(opts, this.values[QueryOption.orderBy]));
|
|
4214
4160
|
}
|
|
4161
|
+
compute(opts) {
|
|
4162
|
+
return this.option(QueryOption.compute, ComputeExpression.factory(opts, this.values[QueryOption.compute]));
|
|
4163
|
+
}
|
|
4215
4164
|
skip(n) {
|
|
4216
4165
|
return this.option(QueryOption.skip, n);
|
|
4217
4166
|
}
|
|
@@ -4242,7 +4191,7 @@ class ExpandExpression extends Expression {
|
|
|
4242
4191
|
return opts({
|
|
4243
4192
|
t: FieldFactory(),
|
|
4244
4193
|
e: () => new ExpandExpression(),
|
|
4245
|
-
}, current);
|
|
4194
|
+
}, current ?? new ExpandExpression());
|
|
4246
4195
|
}
|
|
4247
4196
|
toJson() {
|
|
4248
4197
|
const json = super.toJson();
|
|
@@ -4273,6 +4222,9 @@ class ExpandExpression extends Expression {
|
|
|
4273
4222
|
opts(node);
|
|
4274
4223
|
return this._add(node);
|
|
4275
4224
|
}
|
|
4225
|
+
combine(expression) {
|
|
4226
|
+
return this._add(expression);
|
|
4227
|
+
}
|
|
4276
4228
|
}
|
|
4277
4229
|
|
|
4278
4230
|
const FieldFactory = (names = []) => new Proxy({ _names: names }, {
|
|
@@ -4413,6 +4365,10 @@ function encode(values, parser, options) {
|
|
|
4413
4365
|
return values;
|
|
4414
4366
|
}
|
|
4415
4367
|
class Function {
|
|
4368
|
+
name;
|
|
4369
|
+
values;
|
|
4370
|
+
normalize;
|
|
4371
|
+
escape;
|
|
4416
4372
|
constructor(name, values, normalize, escape = false) {
|
|
4417
4373
|
this.name = name;
|
|
4418
4374
|
this.values = values;
|
|
@@ -4599,6 +4555,9 @@ class ConditionalFunctions {
|
|
|
4599
4555
|
}
|
|
4600
4556
|
}
|
|
4601
4557
|
class Operator {
|
|
4558
|
+
op;
|
|
4559
|
+
values;
|
|
4560
|
+
normalize;
|
|
4602
4561
|
constructor(op, values, normalize) {
|
|
4603
4562
|
this.op = op;
|
|
4604
4563
|
this.values = values;
|
|
@@ -4718,6 +4677,7 @@ class ArithmeticOperators {
|
|
|
4718
4677
|
}
|
|
4719
4678
|
}
|
|
4720
4679
|
class Grouping {
|
|
4680
|
+
group;
|
|
4721
4681
|
constructor(group) {
|
|
4722
4682
|
this.group = group;
|
|
4723
4683
|
}
|
|
@@ -4758,6 +4718,9 @@ class GroupingOperators {
|
|
|
4758
4718
|
}
|
|
4759
4719
|
}
|
|
4760
4720
|
class Aggregate {
|
|
4721
|
+
value;
|
|
4722
|
+
method;
|
|
4723
|
+
alias;
|
|
4761
4724
|
constructor(value, method, alias) {
|
|
4762
4725
|
this.value = value;
|
|
4763
4726
|
this.method = method;
|
|
@@ -4794,6 +4757,8 @@ class Aggregate {
|
|
|
4794
4757
|
}
|
|
4795
4758
|
}
|
|
4796
4759
|
class GroupBy {
|
|
4760
|
+
properties;
|
|
4761
|
+
transformations;
|
|
4797
4762
|
constructor(properties, transformations) {
|
|
4798
4763
|
this.properties = properties;
|
|
4799
4764
|
this.transformations = transformations;
|
|
@@ -4885,6 +4850,9 @@ class Transformations {
|
|
|
4885
4850
|
}
|
|
4886
4851
|
}
|
|
4887
4852
|
class Type {
|
|
4853
|
+
name;
|
|
4854
|
+
type;
|
|
4855
|
+
value;
|
|
4888
4856
|
constructor(name, type, value) {
|
|
4889
4857
|
this.name = name;
|
|
4890
4858
|
this.type = type;
|
|
@@ -4928,6 +4896,9 @@ class Type {
|
|
|
4928
4896
|
}
|
|
4929
4897
|
}
|
|
4930
4898
|
class Lambda {
|
|
4899
|
+
op;
|
|
4900
|
+
values;
|
|
4901
|
+
alias;
|
|
4931
4902
|
constructor(op, values, alias) {
|
|
4932
4903
|
this.op = op;
|
|
4933
4904
|
this.values = values;
|
|
@@ -5016,9 +4987,10 @@ applyMixins(ODataSyntax, [
|
|
|
5016
4987
|
const syntax = new ODataSyntax();
|
|
5017
4988
|
|
|
5018
4989
|
class ComputeExpression extends Expression {
|
|
4990
|
+
names;
|
|
5019
4991
|
constructor({ children, names, } = {}) {
|
|
5020
4992
|
super({ children });
|
|
5021
|
-
this.names = names
|
|
4993
|
+
this.names = names ?? [];
|
|
5022
4994
|
}
|
|
5023
4995
|
get [Symbol.toStringTag]() {
|
|
5024
4996
|
return 'ComputeExpression';
|
|
@@ -5027,7 +4999,7 @@ class ComputeExpression extends Expression {
|
|
|
5027
4999
|
return opts({
|
|
5028
5000
|
t: FieldFactory(),
|
|
5029
5001
|
e: () => new ComputeExpression(),
|
|
5030
|
-
}, current);
|
|
5002
|
+
}, current ?? new ComputeExpression());
|
|
5031
5003
|
}
|
|
5032
5004
|
toJson() {
|
|
5033
5005
|
const json = super.toJson();
|
|
@@ -5042,7 +5014,7 @@ class ComputeExpression extends Expression {
|
|
|
5042
5014
|
});
|
|
5043
5015
|
}
|
|
5044
5016
|
render({ aliases, escape, prefix, parser, options, } = {}) {
|
|
5045
|
-
|
|
5017
|
+
const children = this._children.map((n) => n.render({ aliases, escape, prefix, parser, options }));
|
|
5046
5018
|
return this.names
|
|
5047
5019
|
.map((name, index) => `${children[index]} as ${name}`)
|
|
5048
5020
|
.join(',');
|
|
@@ -5068,6 +5040,8 @@ class ComputeExpression extends Expression {
|
|
|
5068
5040
|
}
|
|
5069
5041
|
|
|
5070
5042
|
class ODataQueryOptionHandler {
|
|
5043
|
+
o;
|
|
5044
|
+
n;
|
|
5071
5045
|
constructor(o, n) {
|
|
5072
5046
|
this.o = o;
|
|
5073
5047
|
this.n = n;
|
|
@@ -5223,6 +5197,7 @@ class ODataQueryOptionHandler {
|
|
|
5223
5197
|
}
|
|
5224
5198
|
}
|
|
5225
5199
|
class ODataQueryOptionsHandler {
|
|
5200
|
+
options;
|
|
5226
5201
|
constructor(options) {
|
|
5227
5202
|
this.options = options;
|
|
5228
5203
|
}
|
|
@@ -5471,6 +5446,116 @@ class ODataQueryOptionsHandler {
|
|
|
5471
5446
|
}
|
|
5472
5447
|
this.paging(options);
|
|
5473
5448
|
}
|
|
5449
|
+
/**
|
|
5450
|
+
* Combine the given query options with the current query.
|
|
5451
|
+
* @param options The query to be combined.
|
|
5452
|
+
*/
|
|
5453
|
+
combine(options) {
|
|
5454
|
+
if (options.select !== undefined) {
|
|
5455
|
+
if (options.select instanceof SelectExpression) {
|
|
5456
|
+
const current = this.options.expression(QueryOption.select);
|
|
5457
|
+
if (current === undefined) {
|
|
5458
|
+
this.options.expression(QueryOption.select, options.select);
|
|
5459
|
+
}
|
|
5460
|
+
else {
|
|
5461
|
+
current.combine(options.select);
|
|
5462
|
+
}
|
|
5463
|
+
}
|
|
5464
|
+
else if (options.select !== null) {
|
|
5465
|
+
const current = this.options.option(QueryOption.select);
|
|
5466
|
+
if (current === undefined) {
|
|
5467
|
+
this.options.option(QueryOption.select, options.select);
|
|
5468
|
+
}
|
|
5469
|
+
else {
|
|
5470
|
+
this.options.option(QueryOption.select, [current, options.select]);
|
|
5471
|
+
}
|
|
5472
|
+
}
|
|
5473
|
+
else {
|
|
5474
|
+
this.options.remove(QueryOption.select);
|
|
5475
|
+
}
|
|
5476
|
+
}
|
|
5477
|
+
if (options.expand !== undefined) {
|
|
5478
|
+
if (options.expand instanceof ExpandExpression) {
|
|
5479
|
+
const current = this.options.expression(QueryOption.expand);
|
|
5480
|
+
if (current === undefined) {
|
|
5481
|
+
this.options.expression(QueryOption.expand, options.expand);
|
|
5482
|
+
}
|
|
5483
|
+
else {
|
|
5484
|
+
current.combine(options.expand);
|
|
5485
|
+
}
|
|
5486
|
+
}
|
|
5487
|
+
else if (options.expand !== null) {
|
|
5488
|
+
const current = this.options.option(QueryOption.expand);
|
|
5489
|
+
if (current === undefined) {
|
|
5490
|
+
this.options.option(QueryOption.expand, options.expand);
|
|
5491
|
+
}
|
|
5492
|
+
}
|
|
5493
|
+
else {
|
|
5494
|
+
this.options.remove(QueryOption.expand);
|
|
5495
|
+
}
|
|
5496
|
+
}
|
|
5497
|
+
if (options.search !== undefined) {
|
|
5498
|
+
if (options.search instanceof SearchExpression) {
|
|
5499
|
+
const current = this.options.expression(QueryOption.search);
|
|
5500
|
+
if (current === undefined) {
|
|
5501
|
+
this.options.expression(QueryOption.search, options.search);
|
|
5502
|
+
}
|
|
5503
|
+
else {
|
|
5504
|
+
current.combine(options.search);
|
|
5505
|
+
}
|
|
5506
|
+
}
|
|
5507
|
+
else if (options.search !== null) {
|
|
5508
|
+
const current = this.options.option(QueryOption.search);
|
|
5509
|
+
if (current === undefined) {
|
|
5510
|
+
this.options.option(QueryOption.search, options.search);
|
|
5511
|
+
}
|
|
5512
|
+
}
|
|
5513
|
+
else {
|
|
5514
|
+
this.options.remove(QueryOption.search);
|
|
5515
|
+
}
|
|
5516
|
+
}
|
|
5517
|
+
if (options.filter !== undefined) {
|
|
5518
|
+
if (options.filter instanceof FilterExpression) {
|
|
5519
|
+
const current = this.options.expression(QueryOption.filter);
|
|
5520
|
+
if (current === undefined) {
|
|
5521
|
+
this.options.expression(QueryOption.filter, options.filter);
|
|
5522
|
+
}
|
|
5523
|
+
else {
|
|
5524
|
+
current.combine(options.filter);
|
|
5525
|
+
}
|
|
5526
|
+
}
|
|
5527
|
+
else if (options.filter !== null) {
|
|
5528
|
+
const current = this.options.option(QueryOption.filter);
|
|
5529
|
+
if (current === undefined) {
|
|
5530
|
+
this.options.option(QueryOption.filter, options.filter);
|
|
5531
|
+
}
|
|
5532
|
+
}
|
|
5533
|
+
else {
|
|
5534
|
+
this.options.remove(QueryOption.filter);
|
|
5535
|
+
}
|
|
5536
|
+
}
|
|
5537
|
+
if (options.orderBy !== undefined) {
|
|
5538
|
+
if (options.orderBy instanceof OrderByExpression) {
|
|
5539
|
+
const current = this.options.expression(QueryOption.orderBy);
|
|
5540
|
+
if (current === undefined) {
|
|
5541
|
+
this.options.expression(QueryOption.orderBy, options.orderBy);
|
|
5542
|
+
}
|
|
5543
|
+
else {
|
|
5544
|
+
current.combine(options.orderBy);
|
|
5545
|
+
}
|
|
5546
|
+
}
|
|
5547
|
+
else if (options.orderBy !== null) {
|
|
5548
|
+
const current = this.options.option(QueryOption.filter);
|
|
5549
|
+
if (current === undefined) {
|
|
5550
|
+
this.options.option(QueryOption.orderBy, options.orderBy);
|
|
5551
|
+
}
|
|
5552
|
+
}
|
|
5553
|
+
else {
|
|
5554
|
+
this.options.remove(QueryOption.orderBy);
|
|
5555
|
+
}
|
|
5556
|
+
}
|
|
5557
|
+
this.paging(options);
|
|
5558
|
+
}
|
|
5474
5559
|
toJson() {
|
|
5475
5560
|
return this.options.toJson();
|
|
5476
5561
|
}
|
|
@@ -5480,6 +5565,13 @@ class ODataQueryOptionsHandler {
|
|
|
5480
5565
|
toString({ escape, parser, } = {}) {
|
|
5481
5566
|
return this.options.toString({ escape, parser });
|
|
5482
5567
|
}
|
|
5568
|
+
pathAndParams({ escape, parser, options, } = {}) {
|
|
5569
|
+
return this.options.pathAndParams({
|
|
5570
|
+
escape,
|
|
5571
|
+
parser,
|
|
5572
|
+
options,
|
|
5573
|
+
});
|
|
5574
|
+
}
|
|
5483
5575
|
}
|
|
5484
5576
|
|
|
5485
5577
|
// Create a path and params tuple from the query options
|
|
@@ -5523,6 +5615,7 @@ const pathAndParamsFromQueryOptions = (values, { escape, parser, options, } = {}
|
|
|
5523
5615
|
return buildPathAndQuery({ ...queryOptions, aliases, escape });
|
|
5524
5616
|
};
|
|
5525
5617
|
class ODataQueryOptions {
|
|
5618
|
+
_values;
|
|
5526
5619
|
constructor(values) {
|
|
5527
5620
|
this._values = values ?? new Map();
|
|
5528
5621
|
}
|
|
@@ -5617,6 +5710,7 @@ class ODataQueryOptions {
|
|
|
5617
5710
|
}
|
|
5618
5711
|
|
|
5619
5712
|
class SegmentHandler {
|
|
5713
|
+
segment;
|
|
5620
5714
|
constructor(segment) {
|
|
5621
5715
|
this.segment = segment;
|
|
5622
5716
|
}
|
|
@@ -5667,6 +5761,7 @@ class SegmentHandler {
|
|
|
5667
5761
|
}
|
|
5668
5762
|
}
|
|
5669
5763
|
class ODataPathSegmentsHandler {
|
|
5764
|
+
segments;
|
|
5670
5765
|
constructor(segments) {
|
|
5671
5766
|
this.segments = segments;
|
|
5672
5767
|
}
|
|
@@ -5733,6 +5828,7 @@ const pathAndParamsFromSegments = (segments, { escape, parser, options, } = {})
|
|
|
5733
5828
|
return [result.paths.join(PATH_SEPARATOR), result.params];
|
|
5734
5829
|
};
|
|
5735
5830
|
class ODataPathSegments {
|
|
5831
|
+
_segments;
|
|
5736
5832
|
constructor(segments) {
|
|
5737
5833
|
this._segments = segments || [];
|
|
5738
5834
|
}
|
|
@@ -5837,6 +5933,20 @@ class ODataPathSegments {
|
|
|
5837
5933
|
}
|
|
5838
5934
|
|
|
5839
5935
|
class ODataRequest {
|
|
5936
|
+
api;
|
|
5937
|
+
observe;
|
|
5938
|
+
context;
|
|
5939
|
+
reportProgress;
|
|
5940
|
+
withCredentials;
|
|
5941
|
+
bodyQueryOptions;
|
|
5942
|
+
fetchPolicy;
|
|
5943
|
+
resource;
|
|
5944
|
+
_responseType;
|
|
5945
|
+
_method;
|
|
5946
|
+
_body;
|
|
5947
|
+
_headers;
|
|
5948
|
+
_params;
|
|
5949
|
+
_path;
|
|
5840
5950
|
constructor(init) {
|
|
5841
5951
|
this._method = init.method;
|
|
5842
5952
|
this.resource = init.resource;
|
|
@@ -6031,6 +6141,10 @@ class ODataRequest {
|
|
|
6031
6141
|
}
|
|
6032
6142
|
|
|
6033
6143
|
class ODataResource {
|
|
6144
|
+
// VARIABLES
|
|
6145
|
+
api;
|
|
6146
|
+
pathSegments;
|
|
6147
|
+
queryOptions;
|
|
6034
6148
|
constructor(api, { segments, query, } = {}) {
|
|
6035
6149
|
this.api = api;
|
|
6036
6150
|
this.pathSegments = segments ?? new ODataPathSegments();
|
|
@@ -6084,9 +6198,8 @@ class ODataResource {
|
|
|
6084
6198
|
clearKey() {
|
|
6085
6199
|
return this.pathSegments.last({ key: true })?.clearKey();
|
|
6086
6200
|
}
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
const reset = annots !== undefined;
|
|
6201
|
+
asModel(entity, { reset, annots, ModelType, } = {}) {
|
|
6202
|
+
reset ??= annots !== undefined;
|
|
6090
6203
|
let resource = this;
|
|
6091
6204
|
const type = annots?.type ?? this.incomingType();
|
|
6092
6205
|
if (type === undefined)
|
|
@@ -6100,8 +6213,8 @@ class ODataResource {
|
|
|
6100
6213
|
}
|
|
6101
6214
|
return new ModelType(entity, { resource, annots, reset });
|
|
6102
6215
|
}
|
|
6103
|
-
asCollection(entities, { annots, CollectionType, } = {}) {
|
|
6104
|
-
|
|
6216
|
+
asCollection(entities, { reset, annots, CollectionType, } = {}) {
|
|
6217
|
+
reset ??= annots !== undefined;
|
|
6105
6218
|
let resource = this;
|
|
6106
6219
|
const type = annots?.type ?? this.incomingType();
|
|
6107
6220
|
if (type === undefined)
|
|
@@ -6204,8 +6317,9 @@ class ODataResource {
|
|
|
6204
6317
|
}
|
|
6205
6318
|
deserialize(value, options) {
|
|
6206
6319
|
const resourceType = this.incomingType();
|
|
6320
|
+
const bindingType = this.bindingType();
|
|
6207
6321
|
const _d = (value, options) => {
|
|
6208
|
-
const parser = this.__parser(value, options, resourceType);
|
|
6322
|
+
const parser = this.__parser(value, options, resourceType, bindingType);
|
|
6209
6323
|
return parser !== undefined ? parser.deserialize(value, options) : value;
|
|
6210
6324
|
};
|
|
6211
6325
|
return Array.isArray(value)
|
|
@@ -6225,8 +6339,9 @@ class ODataResource {
|
|
|
6225
6339
|
}
|
|
6226
6340
|
encode(value, options) {
|
|
6227
6341
|
const resourceType = this.outgoingType();
|
|
6342
|
+
const bindingType = this.bindingType();
|
|
6228
6343
|
const _e = (value, options) => {
|
|
6229
|
-
const parser = this.__parser(value, options, resourceType);
|
|
6344
|
+
const parser = this.__parser(value, options, resourceType, bindingType);
|
|
6230
6345
|
return parser !== undefined ? parser.encode(value, options) : value;
|
|
6231
6346
|
};
|
|
6232
6347
|
return Array.isArray(value)
|
|
@@ -6353,12 +6468,14 @@ class ODataActionResource extends ODataResource {
|
|
|
6353
6468
|
static fromResource(resource, path) {
|
|
6354
6469
|
const baseType = resource.outgoingType();
|
|
6355
6470
|
const callable = resource.api.findCallable(path, baseType);
|
|
6471
|
+
const outgoingType = callable?.type();
|
|
6356
6472
|
const bindingType = callable?.binding()?.type;
|
|
6473
|
+
const incomingType = callable?.returnType();
|
|
6357
6474
|
const action = ODataActionResource.factory(resource.api, {
|
|
6358
6475
|
path,
|
|
6359
|
-
outgoingType
|
|
6360
|
-
|
|
6361
|
-
|
|
6476
|
+
outgoingType,
|
|
6477
|
+
bindingType,
|
|
6478
|
+
incomingType,
|
|
6362
6479
|
segments: resource.cloneSegments(),
|
|
6363
6480
|
});
|
|
6364
6481
|
// Switch entitySet to binding type if available
|
|
@@ -6457,6 +6574,9 @@ const Arrays = {
|
|
|
6457
6574
|
};
|
|
6458
6575
|
|
|
6459
6576
|
class ODataBatchRequest extends Subject {
|
|
6577
|
+
request;
|
|
6578
|
+
id;
|
|
6579
|
+
group;
|
|
6460
6580
|
constructor(request) {
|
|
6461
6581
|
super();
|
|
6462
6582
|
this.request = request;
|
|
@@ -6533,15 +6653,12 @@ class ODataBatchRequest extends Subject {
|
|
|
6533
6653
|
* https://www.odata.org/getting-started/advanced-tutorial/#batch
|
|
6534
6654
|
*/
|
|
6535
6655
|
class ODataBatchResource extends ODataResource {
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
// VARIABLES
|
|
6539
|
-
this._requests = [];
|
|
6540
|
-
this._responses = null;
|
|
6541
|
-
}
|
|
6656
|
+
// VARIABLES
|
|
6657
|
+
_requests = [];
|
|
6542
6658
|
requests() {
|
|
6543
6659
|
return this._requests.map((r) => r.request);
|
|
6544
6660
|
}
|
|
6661
|
+
_responses = null;
|
|
6545
6662
|
responses() {
|
|
6546
6663
|
return this._responses;
|
|
6547
6664
|
}
|
|
@@ -6924,11 +7041,14 @@ class ODataFunctionResource extends ODataResource {
|
|
|
6924
7041
|
static fromResource(resource, path) {
|
|
6925
7042
|
const baseType = resource.outgoingType();
|
|
6926
7043
|
const callable = resource.api.findCallable(path, baseType);
|
|
7044
|
+
const outgoingType = callable?.type();
|
|
6927
7045
|
const bindingType = callable?.binding()?.type;
|
|
7046
|
+
const incomingType = callable?.returnType();
|
|
6928
7047
|
const func = ODataFunctionResource.factory(resource.api, {
|
|
6929
7048
|
path,
|
|
6930
|
-
outgoingType
|
|
6931
|
-
|
|
7049
|
+
outgoingType,
|
|
7050
|
+
bindingType,
|
|
7051
|
+
incomingType,
|
|
6932
7052
|
segments: resource.cloneSegments(),
|
|
6933
7053
|
});
|
|
6934
7054
|
// Switch entitySet to binding type if available
|
|
@@ -7249,11 +7369,6 @@ class ODataPropertyResource extends ODataResource {
|
|
|
7249
7369
|
fetchEntity(options = {}) {
|
|
7250
7370
|
return this.fetch({ responseType: 'entity', ...options }).pipe(map(({ entity }) => entity));
|
|
7251
7371
|
}
|
|
7252
|
-
/**
|
|
7253
|
-
* Fetch the entity and return as model
|
|
7254
|
-
* @param options Options for the request
|
|
7255
|
-
* @returns The model
|
|
7256
|
-
*/
|
|
7257
7372
|
fetchModel(options = {}) {
|
|
7258
7373
|
return this.fetch({ responseType: 'entity', ...options }).pipe(map(({ entity, annots }) => entity
|
|
7259
7374
|
? this.asModel(entity, { annots, ModelType: options?.ModelType })
|
|
@@ -7267,11 +7382,6 @@ class ODataPropertyResource extends ODataResource {
|
|
|
7267
7382
|
fetchEntities(options = {}) {
|
|
7268
7383
|
return this.fetch({ responseType: 'entities', ...options }).pipe(map(({ entities }) => entities));
|
|
7269
7384
|
}
|
|
7270
|
-
/**
|
|
7271
|
-
* Fetch the entities and return as collection
|
|
7272
|
-
* @param options Options for the request
|
|
7273
|
-
* @returns The collection
|
|
7274
|
-
*/
|
|
7275
7385
|
fetchCollection(options = {}) {
|
|
7276
7386
|
return this.fetch({ responseType: 'entities', ...options }).pipe(map(({ entities, annots }) => entities
|
|
7277
7387
|
? this.asCollection(entities, {
|
|
@@ -7579,11 +7689,6 @@ class ODataNavigationPropertyResource extends ODataResource {
|
|
|
7579
7689
|
fetchEntity(options = {}) {
|
|
7580
7690
|
return this.fetch({ responseType: 'entity', ...options }).pipe(map(({ entity }) => entity));
|
|
7581
7691
|
}
|
|
7582
|
-
/**
|
|
7583
|
-
* Fetch the entity and return as model
|
|
7584
|
-
* @param options Options for the request
|
|
7585
|
-
* @returns The model
|
|
7586
|
-
*/
|
|
7587
7692
|
fetchModel(options = {}) {
|
|
7588
7693
|
return this.fetch({ responseType: 'entity', ...options }).pipe(map(({ entity, annots }) => entity
|
|
7589
7694
|
? this.asModel(entity, { annots, ModelType: options?.ModelType })
|
|
@@ -7597,11 +7702,6 @@ class ODataNavigationPropertyResource extends ODataResource {
|
|
|
7597
7702
|
fetchEntities(options = {}) {
|
|
7598
7703
|
return this.fetch({ responseType: 'entities', ...options }).pipe(map(({ entities }) => entities));
|
|
7599
7704
|
}
|
|
7600
|
-
/**
|
|
7601
|
-
* Fetch entities and return as collection
|
|
7602
|
-
* @param options Options for the request
|
|
7603
|
-
* @returns The collection
|
|
7604
|
-
*/
|
|
7605
7705
|
fetchCollection(options = {}) {
|
|
7606
7706
|
return this.fetch({ responseType: 'entities', ...options }).pipe(map(({ entities, annots }) => entities
|
|
7607
7707
|
? this.asCollection(entities, {
|
|
@@ -7879,45 +7979,88 @@ class ODataEntitySetResource extends ODataResource {
|
|
|
7879
7979
|
}
|
|
7880
7980
|
}
|
|
7881
7981
|
|
|
7882
|
-
class ODataMetadata {
|
|
7883
|
-
constructor(Version, References, Schemas) {
|
|
7884
|
-
this.Version = Version;
|
|
7885
|
-
this.References = References;
|
|
7886
|
-
this.Schemas = Schemas;
|
|
7887
|
-
}
|
|
7888
|
-
toConfig(base) {
|
|
7889
|
-
return Object.assign({
|
|
7890
|
-
version: this.Version,
|
|
7891
|
-
schemas: this.Schemas.map((s) => s.toConfig()),
|
|
7892
|
-
}, base ?? {});
|
|
7893
|
-
}
|
|
7894
|
-
}
|
|
7895
|
-
|
|
7896
7982
|
class CsdlAnnotable {
|
|
7983
|
+
Annotation;
|
|
7897
7984
|
constructor({ Annotation }) {
|
|
7898
7985
|
this.Annotation = Annotation?.map((a) => new CsdlAnnotation(a));
|
|
7899
7986
|
}
|
|
7987
|
+
toJson() {
|
|
7988
|
+
const json = {};
|
|
7989
|
+
if (Array.isArray(this.Annotation) && this.Annotation.length > 0) {
|
|
7990
|
+
json['Annotation'] = this.Annotation.map((a) => a.toJson());
|
|
7991
|
+
}
|
|
7992
|
+
return json;
|
|
7993
|
+
}
|
|
7994
|
+
toConfig() {
|
|
7995
|
+
const config = {};
|
|
7996
|
+
if (this.Annotation) {
|
|
7997
|
+
config['annotations'] = this.Annotation.map((a) => a.toConfig());
|
|
7998
|
+
}
|
|
7999
|
+
return config;
|
|
8000
|
+
}
|
|
7900
8001
|
}
|
|
7901
8002
|
class CsdlAnnotations extends CsdlAnnotable {
|
|
8003
|
+
schema;
|
|
8004
|
+
Target;
|
|
8005
|
+
Qualifier;
|
|
7902
8006
|
constructor(schema, { Target, Qualifier, Annotation, }) {
|
|
7903
8007
|
super({ Annotation });
|
|
7904
8008
|
this.schema = schema;
|
|
7905
8009
|
this.Target = Target;
|
|
7906
8010
|
this.Qualifier = Qualifier;
|
|
7907
8011
|
}
|
|
8012
|
+
toJson() {
|
|
8013
|
+
const json = {
|
|
8014
|
+
...super.toJson(),
|
|
8015
|
+
Target: this.Target,
|
|
8016
|
+
};
|
|
8017
|
+
if (this.Qualifier !== undefined) {
|
|
8018
|
+
json['Qualifier'] = this.Qualifier;
|
|
8019
|
+
}
|
|
8020
|
+
return json;
|
|
8021
|
+
}
|
|
7908
8022
|
toConfig() {
|
|
7909
8023
|
return (this.Annotation ?? []).map((a) => a.toConfig());
|
|
7910
8024
|
}
|
|
7911
8025
|
}
|
|
7912
8026
|
class CsdlAnnotation {
|
|
7913
|
-
|
|
8027
|
+
Term;
|
|
8028
|
+
String;
|
|
8029
|
+
Bool;
|
|
8030
|
+
Int;
|
|
8031
|
+
Collection;
|
|
8032
|
+
Record;
|
|
8033
|
+
EnumMember;
|
|
8034
|
+
constructor({ Term, String, Bool, Int, Collection, Record, EnumMember, }) {
|
|
7914
8035
|
this.Term = Term;
|
|
7915
8036
|
this.String = String;
|
|
7916
8037
|
this.Bool = Bool;
|
|
7917
8038
|
this.Int = Int;
|
|
7918
|
-
this.Collection = Collection;
|
|
7919
|
-
this.Record = Record;
|
|
7920
|
-
this.
|
|
8039
|
+
this.Collection = Collection?.map((a) => new CsdlCollection(a));
|
|
8040
|
+
this.Record = Record?.map((a) => new CsdlRecord(a));
|
|
8041
|
+
this.EnumMember = EnumMember?.map((a) => new CsdlEnumMember(a));
|
|
8042
|
+
}
|
|
8043
|
+
toJson() {
|
|
8044
|
+
const json = { Term: this.Term };
|
|
8045
|
+
if (this.String !== undefined) {
|
|
8046
|
+
json['String'] = this.String;
|
|
8047
|
+
}
|
|
8048
|
+
if (this.Bool !== undefined) {
|
|
8049
|
+
json['Bool'] = this.Bool;
|
|
8050
|
+
}
|
|
8051
|
+
if (this.Int !== undefined) {
|
|
8052
|
+
json['Int'] = this.Int;
|
|
8053
|
+
}
|
|
8054
|
+
if (Array.isArray(this.Collection) && this.Collection.length > 0) {
|
|
8055
|
+
json['Collection'] = this.Collection.map((m) => m.toJson());
|
|
8056
|
+
}
|
|
8057
|
+
if (Array.isArray(this.Record) && this.Record.length > 0) {
|
|
8058
|
+
json['Record'] = this.Record.map((m) => m.toJson());
|
|
8059
|
+
}
|
|
8060
|
+
if (Array.isArray(this.EnumMember) && this.EnumMember.length > 0) {
|
|
8061
|
+
json['EnumMember'] = this.EnumMember.map((m) => m.toJson());
|
|
8062
|
+
}
|
|
8063
|
+
return json;
|
|
7921
8064
|
}
|
|
7922
8065
|
toConfig() {
|
|
7923
8066
|
return {
|
|
@@ -7929,6 +8072,20 @@ class CsdlAnnotation {
|
|
|
7929
8072
|
}
|
|
7930
8073
|
}
|
|
7931
8074
|
class CsdlTerm {
|
|
8075
|
+
schema;
|
|
8076
|
+
Name;
|
|
8077
|
+
Type;
|
|
8078
|
+
BaseTerm;
|
|
8079
|
+
DefaultValue;
|
|
8080
|
+
AppliesTo;
|
|
8081
|
+
Nullable;
|
|
8082
|
+
MaxLength;
|
|
8083
|
+
Precision;
|
|
8084
|
+
Scale;
|
|
8085
|
+
SRID;
|
|
8086
|
+
String;
|
|
8087
|
+
Bool;
|
|
8088
|
+
Int;
|
|
7932
8089
|
constructor(schema, { Name, Type, BaseTerm, DefaultValue, AppliesTo, Nullable, MaxLength, Precision, Scale, SRID, String, Bool, Int, }) {
|
|
7933
8090
|
this.schema = schema;
|
|
7934
8091
|
this.Name = Name;
|
|
@@ -7945,72 +8102,240 @@ class CsdlTerm {
|
|
|
7945
8102
|
this.Bool = Bool;
|
|
7946
8103
|
this.Int = Int;
|
|
7947
8104
|
}
|
|
8105
|
+
toJson() {
|
|
8106
|
+
const json = { Name: this.Name, Type: this.Type };
|
|
8107
|
+
if (this.BaseTerm !== undefined) {
|
|
8108
|
+
json['BaseTerm'] = this.BaseTerm;
|
|
8109
|
+
}
|
|
8110
|
+
if (this.DefaultValue !== undefined) {
|
|
8111
|
+
json['DefaultValue'] = this.DefaultValue;
|
|
8112
|
+
}
|
|
8113
|
+
if (this.AppliesTo !== undefined) {
|
|
8114
|
+
json['AppliesTo'] = this.AppliesTo;
|
|
8115
|
+
}
|
|
8116
|
+
if (this.Nullable !== undefined) {
|
|
8117
|
+
json['Nullable'] = this.Nullable;
|
|
8118
|
+
}
|
|
8119
|
+
if (this.MaxLength !== undefined) {
|
|
8120
|
+
json['MaxLength'] = this.MaxLength;
|
|
8121
|
+
}
|
|
8122
|
+
if (this.Precision !== undefined) {
|
|
8123
|
+
json['Precision'] = this.Precision;
|
|
8124
|
+
}
|
|
8125
|
+
if (this.Scale !== undefined) {
|
|
8126
|
+
json['Scale'] = this.Scale;
|
|
8127
|
+
}
|
|
8128
|
+
if (this.SRID !== undefined) {
|
|
8129
|
+
json['SRID'] = this.SRID;
|
|
8130
|
+
}
|
|
8131
|
+
if (this.String !== undefined) {
|
|
8132
|
+
json['String'] = this.String;
|
|
8133
|
+
}
|
|
8134
|
+
if (this.Bool !== undefined) {
|
|
8135
|
+
json['Bool'] = this.Bool;
|
|
8136
|
+
}
|
|
8137
|
+
if (this.Int !== undefined) {
|
|
8138
|
+
json['Int'] = this.Int;
|
|
8139
|
+
}
|
|
8140
|
+
return json;
|
|
8141
|
+
}
|
|
7948
8142
|
}
|
|
7949
8143
|
class CsdlCollection {
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
8144
|
+
String;
|
|
8145
|
+
Record;
|
|
8146
|
+
PropertyPath;
|
|
8147
|
+
NavigationPropertyPath;
|
|
8148
|
+
constructor({ String, Record, PropertyPath, NavigationPropertyPath, }) {
|
|
8149
|
+
this.String = String?.map((a) => new CsdlString(a));
|
|
8150
|
+
this.Record = Record?.map((a) => new CsdlRecord(a));
|
|
8151
|
+
this.PropertyPath = PropertyPath?.map((a) => new CsdlPropertyPath(a));
|
|
8152
|
+
this.NavigationPropertyPath = NavigationPropertyPath?.map((a) => new CsdlNavigationPropertyPath(a));
|
|
8153
|
+
}
|
|
8154
|
+
toJson() {
|
|
8155
|
+
const json = {};
|
|
8156
|
+
if (Array.isArray(this.String) && this.String.length > 0) {
|
|
8157
|
+
json['String'] = this.String.map((s) => s.toJson());
|
|
8158
|
+
}
|
|
8159
|
+
if (Array.isArray(this.Record) && this.Record.length > 0) {
|
|
8160
|
+
json['Record'] = this.Record.map((r) => r.toJson());
|
|
8161
|
+
}
|
|
8162
|
+
if (Array.isArray(this.PropertyPath) && this.PropertyPath.length > 0) {
|
|
8163
|
+
json['PropertyPath'] = this.PropertyPath.map((p) => p.toJson());
|
|
8164
|
+
}
|
|
8165
|
+
if (Array.isArray(this.NavigationPropertyPath) &&
|
|
8166
|
+
this.NavigationPropertyPath.length > 0) {
|
|
8167
|
+
json['NavigationPropertyPath'] = this.NavigationPropertyPath.map((p) => p.toJson());
|
|
8168
|
+
}
|
|
8169
|
+
return json;
|
|
7955
8170
|
}
|
|
7956
8171
|
}
|
|
7957
8172
|
class CsdlRecord {
|
|
7958
|
-
|
|
7959
|
-
|
|
8173
|
+
PropertyValue;
|
|
8174
|
+
constructor({ PropertyValue }) {
|
|
8175
|
+
this.PropertyValue = PropertyValue?.map((a) => new CsdlPropertyValue(a));
|
|
8176
|
+
}
|
|
8177
|
+
toJson() {
|
|
8178
|
+
const json = {};
|
|
8179
|
+
if (Array.isArray(this.PropertyValue) && this.PropertyValue.length > 0) {
|
|
8180
|
+
json['PropertyValue'] = this.PropertyValue.map((p) => p.toJson());
|
|
8181
|
+
}
|
|
8182
|
+
return json;
|
|
7960
8183
|
}
|
|
7961
8184
|
}
|
|
7962
8185
|
class CsdlPropertyValue {
|
|
7963
|
-
|
|
8186
|
+
Name;
|
|
8187
|
+
String;
|
|
8188
|
+
Date;
|
|
8189
|
+
EnumMember;
|
|
8190
|
+
constructor({ Name, String, Date, EnumMember, }) {
|
|
7964
8191
|
this.Name = Name;
|
|
7965
8192
|
this.String = String;
|
|
7966
8193
|
this.Date = Date;
|
|
7967
|
-
this.
|
|
8194
|
+
this.EnumMember = EnumMember?.map((a) => new CsdlEnumMember(a));
|
|
8195
|
+
}
|
|
8196
|
+
toJson() {
|
|
8197
|
+
const json = { Name: this.Name };
|
|
8198
|
+
if (this.String !== undefined) {
|
|
8199
|
+
json['String'] = this.String;
|
|
8200
|
+
}
|
|
8201
|
+
if (this.Date !== undefined) {
|
|
8202
|
+
json['Date'] = this.Date;
|
|
8203
|
+
}
|
|
8204
|
+
if (Array.isArray(this.EnumMember) && this.EnumMember.length > 0) {
|
|
8205
|
+
json['EnumMember'] = this.EnumMember.map((m) => m.toJson());
|
|
8206
|
+
}
|
|
8207
|
+
return json;
|
|
7968
8208
|
}
|
|
7969
8209
|
}
|
|
7970
8210
|
class CsdlEnumMember {
|
|
8211
|
+
TextContent;
|
|
7971
8212
|
constructor({ TextContent }) {
|
|
7972
8213
|
this.TextContent = TextContent;
|
|
7973
8214
|
}
|
|
8215
|
+
toJson() {
|
|
8216
|
+
return {
|
|
8217
|
+
TextContent: this.TextContent,
|
|
8218
|
+
};
|
|
8219
|
+
}
|
|
7974
8220
|
}
|
|
7975
8221
|
class CsdlString {
|
|
8222
|
+
TextContent;
|
|
7976
8223
|
constructor({ TextContent }) {
|
|
7977
8224
|
this.TextContent = TextContent;
|
|
7978
8225
|
}
|
|
8226
|
+
toJson() {
|
|
8227
|
+
return {
|
|
8228
|
+
TextContent: this.TextContent,
|
|
8229
|
+
};
|
|
8230
|
+
}
|
|
7979
8231
|
}
|
|
7980
8232
|
class CsdlPropertyPath {
|
|
8233
|
+
TextContent;
|
|
7981
8234
|
constructor({ TextContent }) {
|
|
7982
8235
|
this.TextContent = TextContent;
|
|
7983
8236
|
}
|
|
8237
|
+
toJson() {
|
|
8238
|
+
return {
|
|
8239
|
+
TextContent: this.TextContent,
|
|
8240
|
+
};
|
|
8241
|
+
}
|
|
7984
8242
|
}
|
|
7985
8243
|
class CsdlNavigationPropertyPath {
|
|
8244
|
+
TextContent;
|
|
7986
8245
|
constructor({ TextContent }) {
|
|
7987
8246
|
this.TextContent = TextContent;
|
|
7988
8247
|
}
|
|
8248
|
+
toJson() {
|
|
8249
|
+
return {
|
|
8250
|
+
TextContent: this.TextContent,
|
|
8251
|
+
};
|
|
8252
|
+
}
|
|
7989
8253
|
}
|
|
7990
8254
|
|
|
7991
8255
|
class CsdlReference extends CsdlAnnotable {
|
|
7992
|
-
|
|
8256
|
+
Uri;
|
|
8257
|
+
Include;
|
|
8258
|
+
IncludeAnnotations;
|
|
8259
|
+
constructor({ Uri, Include, IncludeAnnotations, Annotation, }) {
|
|
7993
8260
|
super({ Annotation });
|
|
7994
8261
|
this.Uri = Uri;
|
|
7995
|
-
this.
|
|
8262
|
+
this.Include = Include?.map((i) => new CsdlInclude(i));
|
|
7996
8263
|
this.IncludeAnnotations = IncludeAnnotations?.map((i) => new CsdlIncludeAnnotations(i));
|
|
7997
8264
|
}
|
|
8265
|
+
toJson() {
|
|
8266
|
+
const json = { ...super.toJson(), Uri: this.Uri };
|
|
8267
|
+
if (Array.isArray(this.Include) && this.Include.length > 0) {
|
|
8268
|
+
json['Include'] = this.Include.map((i) => i.toJson());
|
|
8269
|
+
}
|
|
8270
|
+
if (Array.isArray(this.IncludeAnnotations) &&
|
|
8271
|
+
this.IncludeAnnotations.length > 0) {
|
|
8272
|
+
json['IncludeAnnotations'] = this.IncludeAnnotations.map((i) => i.toJson());
|
|
8273
|
+
}
|
|
8274
|
+
return json;
|
|
8275
|
+
}
|
|
8276
|
+
toConfig(base) {
|
|
8277
|
+
return {
|
|
8278
|
+
...super.toConfig(),
|
|
8279
|
+
uri: this.Uri,
|
|
8280
|
+
includes: this.Include?.map((i) => i.toConfig()),
|
|
8281
|
+
includeAnnotations: this.IncludeAnnotations?.map((i) => i.toConfig()),
|
|
8282
|
+
};
|
|
8283
|
+
}
|
|
7998
8284
|
}
|
|
7999
8285
|
class CsdlInclude {
|
|
8286
|
+
Namespace;
|
|
8287
|
+
Alias;
|
|
8000
8288
|
constructor({ Namespace, Alias }) {
|
|
8001
8289
|
this.Namespace = Namespace;
|
|
8002
8290
|
this.Alias = Alias;
|
|
8003
8291
|
}
|
|
8292
|
+
toJson() {
|
|
8293
|
+
return {
|
|
8294
|
+
Namespace: this.Namespace,
|
|
8295
|
+
Alias: this.Alias,
|
|
8296
|
+
};
|
|
8297
|
+
}
|
|
8298
|
+
toConfig() {
|
|
8299
|
+
return {
|
|
8300
|
+
namespace: this.Namespace,
|
|
8301
|
+
alias: this.Alias,
|
|
8302
|
+
};
|
|
8303
|
+
}
|
|
8004
8304
|
}
|
|
8005
8305
|
class CsdlIncludeAnnotations {
|
|
8306
|
+
TermNamespace;
|
|
8307
|
+
Qualifier;
|
|
8308
|
+
TargetNamespace;
|
|
8006
8309
|
constructor({ TermNamespace, Qualifier, TargetNamespace, }) {
|
|
8007
8310
|
this.TermNamespace = TermNamespace;
|
|
8008
8311
|
this.Qualifier = Qualifier;
|
|
8009
8312
|
this.TargetNamespace = TargetNamespace;
|
|
8010
8313
|
}
|
|
8314
|
+
toJson() {
|
|
8315
|
+
return {
|
|
8316
|
+
TermNamespace: this.TermNamespace,
|
|
8317
|
+
Qualifier: this.Qualifier,
|
|
8318
|
+
TargetNamespace: this.TargetNamespace,
|
|
8319
|
+
};
|
|
8320
|
+
}
|
|
8321
|
+
toConfig() {
|
|
8322
|
+
return {
|
|
8323
|
+
termNamespace: this.TermNamespace,
|
|
8324
|
+
qualifier: this.Qualifier,
|
|
8325
|
+
targetNamespace: this.TargetNamespace,
|
|
8326
|
+
};
|
|
8327
|
+
}
|
|
8011
8328
|
}
|
|
8012
8329
|
|
|
8013
8330
|
class CsdlTypeDefinition extends CsdlAnnotable {
|
|
8331
|
+
schema;
|
|
8332
|
+
Name;
|
|
8333
|
+
UnderlayingType;
|
|
8334
|
+
MaxLength;
|
|
8335
|
+
Precision;
|
|
8336
|
+
Scale;
|
|
8337
|
+
Unicode;
|
|
8338
|
+
SRID;
|
|
8014
8339
|
constructor(schema, { Name, UnderlayingType, MaxLength, Precision, Scale, Unicode, SRID, Annotation, }) {
|
|
8015
8340
|
super({ Annotation });
|
|
8016
8341
|
this.schema = schema;
|
|
@@ -8022,9 +8347,37 @@ class CsdlTypeDefinition extends CsdlAnnotable {
|
|
|
8022
8347
|
this.Unicode = Unicode;
|
|
8023
8348
|
this.SRID = SRID;
|
|
8024
8349
|
}
|
|
8350
|
+
toJson() {
|
|
8351
|
+
const json = {
|
|
8352
|
+
...super.toJson(),
|
|
8353
|
+
Name: this.Name,
|
|
8354
|
+
UnderlayingType: this.UnderlayingType,
|
|
8355
|
+
};
|
|
8356
|
+
if (this.MaxLength !== undefined) {
|
|
8357
|
+
json['MaxLength'] = this.MaxLength;
|
|
8358
|
+
}
|
|
8359
|
+
if (this.Precision !== undefined) {
|
|
8360
|
+
json['Precision'] = this.Precision;
|
|
8361
|
+
}
|
|
8362
|
+
if (this.Scale !== undefined) {
|
|
8363
|
+
json['Scale'] = this.Scale;
|
|
8364
|
+
}
|
|
8365
|
+
if (this.Unicode !== undefined) {
|
|
8366
|
+
json['Unicode'] = this.Unicode;
|
|
8367
|
+
}
|
|
8368
|
+
if (this.SRID !== undefined) {
|
|
8369
|
+
json['SRID'] = this.SRID;
|
|
8370
|
+
}
|
|
8371
|
+
return json;
|
|
8372
|
+
}
|
|
8025
8373
|
}
|
|
8026
8374
|
|
|
8027
8375
|
class CsdlEnumType extends CsdlAnnotable {
|
|
8376
|
+
schema;
|
|
8377
|
+
Name;
|
|
8378
|
+
Member;
|
|
8379
|
+
UnderlyingType;
|
|
8380
|
+
IsFlags;
|
|
8028
8381
|
constructor(schema, { Name, Member, UnderlyingType, IsFlags, Annotation, }) {
|
|
8029
8382
|
super({ Annotation });
|
|
8030
8383
|
this.schema = schema;
|
|
@@ -8033,34 +8386,70 @@ class CsdlEnumType extends CsdlAnnotable {
|
|
|
8033
8386
|
this.UnderlyingType = UnderlyingType;
|
|
8034
8387
|
this.IsFlags = IsFlags;
|
|
8035
8388
|
}
|
|
8389
|
+
toJson() {
|
|
8390
|
+
const json = {
|
|
8391
|
+
...super.toJson(),
|
|
8392
|
+
Name: this.Name,
|
|
8393
|
+
Member: this.Member.map((m) => m.toJson()),
|
|
8394
|
+
};
|
|
8395
|
+
if (this.UnderlyingType !== undefined) {
|
|
8396
|
+
json['UnderlyingType'] = this.UnderlyingType;
|
|
8397
|
+
}
|
|
8398
|
+
if (this.IsFlags !== undefined) {
|
|
8399
|
+
json['IsFlags'] = this.IsFlags;
|
|
8400
|
+
}
|
|
8401
|
+
return json;
|
|
8402
|
+
}
|
|
8403
|
+
name() {
|
|
8404
|
+
return `${this.Name}`;
|
|
8405
|
+
}
|
|
8406
|
+
namespace() {
|
|
8407
|
+
return `${this.schema.Namespace}`;
|
|
8408
|
+
}
|
|
8036
8409
|
fullName() {
|
|
8037
8410
|
return `${this.schema.Namespace}.${this.Name}`;
|
|
8038
8411
|
}
|
|
8039
|
-
toConfig() {
|
|
8412
|
+
toConfig(base) {
|
|
8040
8413
|
return {
|
|
8414
|
+
...super.toConfig(),
|
|
8041
8415
|
name: this.Name,
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8416
|
+
fields: this.Member.reduce((acc, m) => ({
|
|
8417
|
+
...acc,
|
|
8418
|
+
[m.Name]: m.toConfig(),
|
|
8419
|
+
}), {}),
|
|
8045
8420
|
flags: this.IsFlags,
|
|
8046
8421
|
};
|
|
8047
8422
|
}
|
|
8048
8423
|
}
|
|
8049
8424
|
class CsdlMember extends CsdlAnnotable {
|
|
8425
|
+
Name;
|
|
8426
|
+
Value;
|
|
8050
8427
|
constructor({ Name, Value, Annotation, }) {
|
|
8051
8428
|
super({ Annotation });
|
|
8052
8429
|
this.Name = Name;
|
|
8053
8430
|
this.Value = Value;
|
|
8054
8431
|
}
|
|
8055
|
-
|
|
8056
|
-
|
|
8432
|
+
toJson() {
|
|
8433
|
+
const json = { ...super.toJson(), Name: this.Name };
|
|
8434
|
+
if (this.Value !== undefined) {
|
|
8435
|
+
json['Value'] = this.Value;
|
|
8436
|
+
}
|
|
8437
|
+
return json;
|
|
8438
|
+
}
|
|
8439
|
+
toConfig(base) {
|
|
8440
|
+
const config = {
|
|
8441
|
+
...super.toConfig(),
|
|
8057
8442
|
value: this.Value,
|
|
8058
|
-
annotations: this.Annotation?.map((a) => a.toConfig()),
|
|
8059
8443
|
};
|
|
8444
|
+
return config;
|
|
8060
8445
|
}
|
|
8061
8446
|
}
|
|
8062
8447
|
|
|
8063
8448
|
class CsdlStructuralProperty extends CsdlAnnotable {
|
|
8449
|
+
Name;
|
|
8450
|
+
Type;
|
|
8451
|
+
Collection;
|
|
8452
|
+
Nullable;
|
|
8064
8453
|
constructor({ Name, Type, Nullable, Annotation, }) {
|
|
8065
8454
|
super({ Annotation });
|
|
8066
8455
|
this.Name = Name;
|
|
@@ -8068,8 +8457,22 @@ class CsdlStructuralProperty extends CsdlAnnotable {
|
|
|
8068
8457
|
this.Collection = Type.startsWith('Collection(');
|
|
8069
8458
|
this.Type = this.Collection ? Type.substring(11, Type.length - 1) : Type;
|
|
8070
8459
|
}
|
|
8460
|
+
toJson() {
|
|
8461
|
+
return {
|
|
8462
|
+
...super.toJson(),
|
|
8463
|
+
Name: this.Name,
|
|
8464
|
+
Type: this.Collection ? `Collection(${this.Type})` : this.Type,
|
|
8465
|
+
Nullable: this.Nullable,
|
|
8466
|
+
};
|
|
8467
|
+
}
|
|
8071
8468
|
}
|
|
8072
8469
|
class CsdlProperty extends CsdlStructuralProperty {
|
|
8470
|
+
MaxLength;
|
|
8471
|
+
Precision;
|
|
8472
|
+
Scale;
|
|
8473
|
+
Unicode;
|
|
8474
|
+
SRID;
|
|
8475
|
+
DefaultValue;
|
|
8073
8476
|
constructor({ Name, Type, Nullable, MaxLength, Precision, Scale, Unicode, SRID, DefaultValue, Annotation, }) {
|
|
8074
8477
|
super({ Name, Type, Nullable, Annotation });
|
|
8075
8478
|
this.MaxLength = MaxLength;
|
|
@@ -8079,8 +8482,31 @@ class CsdlProperty extends CsdlStructuralProperty {
|
|
|
8079
8482
|
this.SRID = SRID;
|
|
8080
8483
|
this.DefaultValue = DefaultValue;
|
|
8081
8484
|
}
|
|
8485
|
+
toJson() {
|
|
8486
|
+
const json = { ...super.toJson() };
|
|
8487
|
+
if (this.MaxLength !== undefined) {
|
|
8488
|
+
json['MaxLength'] = this.MaxLength;
|
|
8489
|
+
}
|
|
8490
|
+
if (this.Precision !== undefined) {
|
|
8491
|
+
json['Precision'] = this.Precision;
|
|
8492
|
+
}
|
|
8493
|
+
if (this.Scale !== undefined) {
|
|
8494
|
+
json['Scale'] = this.Scale;
|
|
8495
|
+
}
|
|
8496
|
+
if (this.Unicode !== undefined) {
|
|
8497
|
+
json['Unicode'] = this.Unicode;
|
|
8498
|
+
}
|
|
8499
|
+
if (this.SRID !== undefined) {
|
|
8500
|
+
json['SRID'] = this.SRID;
|
|
8501
|
+
}
|
|
8502
|
+
if (this.DefaultValue !== undefined) {
|
|
8503
|
+
json['DefaultValue'] = this.DefaultValue;
|
|
8504
|
+
}
|
|
8505
|
+
return json;
|
|
8506
|
+
}
|
|
8082
8507
|
toConfig() {
|
|
8083
8508
|
return {
|
|
8509
|
+
...super.toConfig(),
|
|
8084
8510
|
name: this.Name,
|
|
8085
8511
|
type: this.Type,
|
|
8086
8512
|
default: this.DefaultValue,
|
|
@@ -8090,11 +8516,14 @@ class CsdlProperty extends CsdlStructuralProperty {
|
|
|
8090
8516
|
navigation: false,
|
|
8091
8517
|
precision: this.Precision,
|
|
8092
8518
|
scale: this.Scale,
|
|
8093
|
-
annotations: this.Annotation?.map((a) => a.toConfig()),
|
|
8094
8519
|
};
|
|
8095
8520
|
}
|
|
8096
8521
|
}
|
|
8097
8522
|
class CsdlNavigationProperty extends CsdlStructuralProperty {
|
|
8523
|
+
Partner;
|
|
8524
|
+
ContainsTarget;
|
|
8525
|
+
ReferentialConstraints;
|
|
8526
|
+
OnDelete;
|
|
8098
8527
|
constructor({ Name, Type, Nullable, Partner, ContainsTarget, ReferentialConstraints, OnDelete, Annotation, }) {
|
|
8099
8528
|
super({ Name, Type, Nullable, Annotation });
|
|
8100
8529
|
this.Partner = Partner;
|
|
@@ -8102,14 +8531,31 @@ class CsdlNavigationProperty extends CsdlStructuralProperty {
|
|
|
8102
8531
|
this.ReferentialConstraints = ReferentialConstraints?.map((r) => new CsdlReferentialConstraint(r));
|
|
8103
8532
|
this.OnDelete = OnDelete ? new CsdlOnDelete(OnDelete) : undefined;
|
|
8104
8533
|
}
|
|
8534
|
+
toJson() {
|
|
8535
|
+
const json = { ...super.toJson() };
|
|
8536
|
+
if (this.Partner !== undefined) {
|
|
8537
|
+
json['Partner'] = this.Partner;
|
|
8538
|
+
}
|
|
8539
|
+
if (this.ContainsTarget !== undefined) {
|
|
8540
|
+
json['ContainsTarget'] = this.ContainsTarget;
|
|
8541
|
+
}
|
|
8542
|
+
if (Array.isArray(this.ReferentialConstraints) &&
|
|
8543
|
+
this.ReferentialConstraints.length > 0) {
|
|
8544
|
+
json['ReferentialConstraints'] = this.ReferentialConstraints.map((r) => r.toJson());
|
|
8545
|
+
}
|
|
8546
|
+
if (this.OnDelete !== undefined) {
|
|
8547
|
+
json['OnDelete'] = this.OnDelete;
|
|
8548
|
+
}
|
|
8549
|
+
return json;
|
|
8550
|
+
}
|
|
8105
8551
|
toConfig() {
|
|
8106
8552
|
return {
|
|
8553
|
+
...super.toConfig(),
|
|
8107
8554
|
name: this.Name,
|
|
8108
8555
|
type: this.Type,
|
|
8109
8556
|
collection: this.Collection,
|
|
8110
8557
|
nullable: this.Nullable,
|
|
8111
8558
|
navigation: true,
|
|
8112
|
-
annotations: this.Annotation?.map((a) => a.toConfig()),
|
|
8113
8559
|
referentials: this.ReferentialConstraints?.map((r) => ({
|
|
8114
8560
|
property: r.Property,
|
|
8115
8561
|
referencedProperty: r.ReferencedProperty,
|
|
@@ -8118,18 +8564,39 @@ class CsdlNavigationProperty extends CsdlStructuralProperty {
|
|
|
8118
8564
|
}
|
|
8119
8565
|
}
|
|
8120
8566
|
class CsdlReferentialConstraint {
|
|
8567
|
+
Property;
|
|
8568
|
+
ReferencedProperty;
|
|
8121
8569
|
constructor({ Property, ReferencedProperty, }) {
|
|
8122
8570
|
this.Property = Property;
|
|
8123
8571
|
this.ReferencedProperty = ReferencedProperty;
|
|
8124
8572
|
}
|
|
8573
|
+
toJson() {
|
|
8574
|
+
return {
|
|
8575
|
+
Property: this.Property,
|
|
8576
|
+
ReferencedProperty: this.ReferencedProperty,
|
|
8577
|
+
};
|
|
8578
|
+
}
|
|
8125
8579
|
}
|
|
8126
8580
|
class CsdlOnDelete {
|
|
8581
|
+
Action;
|
|
8127
8582
|
constructor({ Action }) {
|
|
8128
8583
|
this.Action = Action;
|
|
8129
8584
|
}
|
|
8585
|
+
toJson() {
|
|
8586
|
+
return {
|
|
8587
|
+
Action: this.Action,
|
|
8588
|
+
};
|
|
8589
|
+
}
|
|
8130
8590
|
}
|
|
8131
8591
|
|
|
8132
8592
|
class CsdlStructuredType extends CsdlAnnotable {
|
|
8593
|
+
schema;
|
|
8594
|
+
Name;
|
|
8595
|
+
Property;
|
|
8596
|
+
NavigationProperty;
|
|
8597
|
+
BaseType;
|
|
8598
|
+
OpenType;
|
|
8599
|
+
Abstract;
|
|
8133
8600
|
constructor(schema, { Name, Property, NavigationProperty, BaseType, OpenType, Abstract, Annotation, }) {
|
|
8134
8601
|
super({ Annotation });
|
|
8135
8602
|
this.schema = schema;
|
|
@@ -8140,6 +8607,32 @@ class CsdlStructuredType extends CsdlAnnotable {
|
|
|
8140
8607
|
this.OpenType = OpenType;
|
|
8141
8608
|
this.Abstract = Abstract;
|
|
8142
8609
|
}
|
|
8610
|
+
toJson() {
|
|
8611
|
+
const json = { ...super.toJson(), Name: this.Name };
|
|
8612
|
+
if (Array.isArray(this.Property) && this.Property.length > 0) {
|
|
8613
|
+
json['Property'] = this.Property.map((p) => p.toJson());
|
|
8614
|
+
}
|
|
8615
|
+
if (Array.isArray(this.NavigationProperty) &&
|
|
8616
|
+
this.NavigationProperty.length > 0) {
|
|
8617
|
+
json['NavigationProperty'] = this.NavigationProperty.map((n) => n.toJson());
|
|
8618
|
+
}
|
|
8619
|
+
if (this.BaseType !== undefined) {
|
|
8620
|
+
json['BaseType'] = this.BaseType;
|
|
8621
|
+
}
|
|
8622
|
+
if (this.OpenType !== undefined) {
|
|
8623
|
+
json['OpenType'] = this.OpenType;
|
|
8624
|
+
}
|
|
8625
|
+
if (this.Abstract !== undefined) {
|
|
8626
|
+
json['Abstract'] = this.Abstract;
|
|
8627
|
+
}
|
|
8628
|
+
return json;
|
|
8629
|
+
}
|
|
8630
|
+
name() {
|
|
8631
|
+
return `${this.Name}`;
|
|
8632
|
+
}
|
|
8633
|
+
namespace() {
|
|
8634
|
+
return `${this.schema.Namespace}`;
|
|
8635
|
+
}
|
|
8143
8636
|
fullName() {
|
|
8144
8637
|
return `${this.schema.Namespace}.${this.Name}`;
|
|
8145
8638
|
}
|
|
@@ -8156,13 +8649,19 @@ class CsdlComplexType extends CsdlStructuredType {
|
|
|
8156
8649
|
Annotation,
|
|
8157
8650
|
});
|
|
8158
8651
|
}
|
|
8159
|
-
|
|
8160
|
-
|
|
8652
|
+
toJson() {
|
|
8653
|
+
return {
|
|
8654
|
+
...super.toJson(),
|
|
8655
|
+
};
|
|
8656
|
+
}
|
|
8657
|
+
toConfig(base) {
|
|
8161
8658
|
return {
|
|
8659
|
+
...super.toConfig(),
|
|
8162
8660
|
name: this.Name,
|
|
8163
8661
|
base: this.BaseType,
|
|
8164
|
-
open: this.OpenType,
|
|
8165
|
-
|
|
8662
|
+
open: base?.open ?? this.OpenType,
|
|
8663
|
+
model: base?.model,
|
|
8664
|
+
collection: base?.collection,
|
|
8166
8665
|
fields: [
|
|
8167
8666
|
...(this.Property ?? []).map((t) => t.toConfig()),
|
|
8168
8667
|
...(this.NavigationProperty ?? []).map((t) => t.toConfig()),
|
|
@@ -8171,6 +8670,8 @@ class CsdlComplexType extends CsdlStructuredType {
|
|
|
8171
8670
|
}
|
|
8172
8671
|
}
|
|
8173
8672
|
class CsdlEntityType extends CsdlStructuredType {
|
|
8673
|
+
Key;
|
|
8674
|
+
HasStream;
|
|
8174
8675
|
constructor(schema, { Name, Key, Property, NavigationProperty, BaseType, OpenType, Abstract, HasStream, Annotation, }) {
|
|
8175
8676
|
super(schema, {
|
|
8176
8677
|
Name,
|
|
@@ -8184,12 +8685,24 @@ class CsdlEntityType extends CsdlStructuredType {
|
|
|
8184
8685
|
this.Key = Key ? new CsdlKey(Key) : undefined;
|
|
8185
8686
|
this.HasStream = HasStream;
|
|
8186
8687
|
}
|
|
8187
|
-
|
|
8688
|
+
toJson() {
|
|
8689
|
+
const json = { ...super.toJson() };
|
|
8690
|
+
if (this.Key !== undefined) {
|
|
8691
|
+
json['Key'] = this.Key.toJson();
|
|
8692
|
+
}
|
|
8693
|
+
if (this.HasStream !== undefined) {
|
|
8694
|
+
json['HasStream'] = this.HasStream;
|
|
8695
|
+
}
|
|
8696
|
+
return json;
|
|
8697
|
+
}
|
|
8698
|
+
toConfig(base) {
|
|
8188
8699
|
return {
|
|
8700
|
+
...super.toConfig(),
|
|
8189
8701
|
name: this.Name,
|
|
8190
8702
|
base: this.BaseType,
|
|
8191
|
-
open: this.OpenType,
|
|
8192
|
-
|
|
8703
|
+
open: base?.open ?? this.OpenType,
|
|
8704
|
+
model: base?.model,
|
|
8705
|
+
collection: base?.collection,
|
|
8193
8706
|
keys: this.Key?.toConfig(),
|
|
8194
8707
|
fields: [
|
|
8195
8708
|
...(this.Property ?? []).map((t) => t.toConfig()),
|
|
@@ -8199,18 +8712,32 @@ class CsdlEntityType extends CsdlStructuredType {
|
|
|
8199
8712
|
}
|
|
8200
8713
|
}
|
|
8201
8714
|
class CsdlKey {
|
|
8202
|
-
|
|
8203
|
-
|
|
8715
|
+
PropertyRef;
|
|
8716
|
+
constructor({ PropertyRef }) {
|
|
8717
|
+
this.PropertyRef = PropertyRef?.map((p) => new CsdlPropertyRef(p));
|
|
8718
|
+
}
|
|
8719
|
+
toJson() {
|
|
8720
|
+
return {
|
|
8721
|
+
PropertyRef: this.PropertyRef?.map((p) => p.toJson()),
|
|
8722
|
+
};
|
|
8204
8723
|
}
|
|
8205
8724
|
toConfig() {
|
|
8206
|
-
return this.
|
|
8725
|
+
return this.PropertyRef?.map((t) => t.toConfig());
|
|
8207
8726
|
}
|
|
8208
8727
|
}
|
|
8209
8728
|
class CsdlPropertyRef {
|
|
8729
|
+
Name;
|
|
8730
|
+
Alias;
|
|
8210
8731
|
constructor({ Name, Alias }) {
|
|
8211
8732
|
this.Name = Name;
|
|
8212
8733
|
this.Alias = Alias;
|
|
8213
8734
|
}
|
|
8735
|
+
toJson() {
|
|
8736
|
+
return {
|
|
8737
|
+
Name: this.Name,
|
|
8738
|
+
Alias: this.Alias,
|
|
8739
|
+
};
|
|
8740
|
+
}
|
|
8214
8741
|
toConfig() {
|
|
8215
8742
|
return {
|
|
8216
8743
|
name: this.Name,
|
|
@@ -8219,47 +8746,98 @@ class CsdlPropertyRef {
|
|
|
8219
8746
|
}
|
|
8220
8747
|
}
|
|
8221
8748
|
|
|
8749
|
+
const BINDING_PARAMETER_NAME = 'bindingParameter';
|
|
8222
8750
|
class CsdlCallable {
|
|
8223
|
-
|
|
8751
|
+
schema;
|
|
8752
|
+
Name;
|
|
8753
|
+
ReturnType;
|
|
8754
|
+
IsBound;
|
|
8755
|
+
EntitySetPath;
|
|
8756
|
+
Parameter;
|
|
8757
|
+
constructor(schema, { Name, ReturnType, IsBound, EntitySetPath, Parameter, }) {
|
|
8224
8758
|
this.schema = schema;
|
|
8225
8759
|
this.Name = Name;
|
|
8226
8760
|
this.ReturnType = ReturnType ? new CsdlReturnType(ReturnType) : undefined;
|
|
8227
8761
|
this.IsBound = IsBound;
|
|
8228
8762
|
this.EntitySetPath = EntitySetPath;
|
|
8229
|
-
this.
|
|
8763
|
+
this.Parameter = Parameter?.map((p) => new CsdlParameter(p));
|
|
8764
|
+
}
|
|
8765
|
+
toJson() {
|
|
8766
|
+
const json = {
|
|
8767
|
+
Name: this.Name,
|
|
8768
|
+
};
|
|
8769
|
+
if (this.ReturnType !== undefined) {
|
|
8770
|
+
json['ReturnType'] = this.ReturnType.toJson();
|
|
8771
|
+
}
|
|
8772
|
+
if (this.IsBound !== undefined) {
|
|
8773
|
+
json['IsBound'] = this.IsBound;
|
|
8774
|
+
}
|
|
8775
|
+
if (this.EntitySetPath !== undefined) {
|
|
8776
|
+
json['EntitySetPath'] = this.EntitySetPath;
|
|
8777
|
+
}
|
|
8778
|
+
if (Array.isArray(this.Parameter) && this.Parameter.length > 0) {
|
|
8779
|
+
json['Parameter'] = this.Parameter.map((p) => p.toJson());
|
|
8780
|
+
}
|
|
8781
|
+
return json;
|
|
8782
|
+
}
|
|
8783
|
+
name() {
|
|
8784
|
+
return `${this.Name}`;
|
|
8785
|
+
}
|
|
8786
|
+
namespace() {
|
|
8787
|
+
return `${this.schema.Namespace}`;
|
|
8788
|
+
}
|
|
8789
|
+
fullName() {
|
|
8790
|
+
return `${this.namespace()}.${this.Name}`;
|
|
8230
8791
|
}
|
|
8231
8792
|
}
|
|
8232
8793
|
class CsdlFunction extends CsdlCallable {
|
|
8233
|
-
|
|
8234
|
-
|
|
8794
|
+
IsComposable;
|
|
8795
|
+
constructor(schema, { Name, ReturnType, IsBound, EntitySetPath, IsComposable, Parameter, }) {
|
|
8796
|
+
super(schema, { Name, ReturnType, IsBound, EntitySetPath, Parameter });
|
|
8235
8797
|
this.IsComposable = IsComposable;
|
|
8236
8798
|
}
|
|
8237
|
-
|
|
8799
|
+
toJson() {
|
|
8800
|
+
return {
|
|
8801
|
+
...super.toJson(),
|
|
8802
|
+
IsComposable: this.IsComposable,
|
|
8803
|
+
};
|
|
8804
|
+
}
|
|
8805
|
+
toConfig(base) {
|
|
8238
8806
|
return {
|
|
8239
8807
|
name: this.Name,
|
|
8240
8808
|
entitySetPath: this.EntitySetPath,
|
|
8241
8809
|
bound: this.IsBound,
|
|
8242
8810
|
composable: this.IsComposable,
|
|
8243
|
-
parameters: this.
|
|
8811
|
+
parameters: this.Parameter?.map((p) => p.toConfig()),
|
|
8244
8812
|
return: this.ReturnType?.toConfig(),
|
|
8245
8813
|
};
|
|
8246
8814
|
}
|
|
8247
8815
|
}
|
|
8248
8816
|
class CsdlAction extends CsdlCallable {
|
|
8249
|
-
constructor(schema, { Name, ReturnType, IsBound, EntitySetPath,
|
|
8250
|
-
super(schema, { Name, ReturnType, IsBound, EntitySetPath,
|
|
8817
|
+
constructor(schema, { Name, ReturnType, IsBound, EntitySetPath, Parameter, }) {
|
|
8818
|
+
super(schema, { Name, ReturnType, IsBound, EntitySetPath, Parameter });
|
|
8251
8819
|
}
|
|
8252
|
-
|
|
8820
|
+
toJson() {
|
|
8821
|
+
return {
|
|
8822
|
+
...super.toJson(),
|
|
8823
|
+
};
|
|
8824
|
+
}
|
|
8825
|
+
toConfig(base) {
|
|
8253
8826
|
return {
|
|
8254
8827
|
name: this.Name,
|
|
8255
8828
|
entitySetPath: this.EntitySetPath,
|
|
8256
8829
|
bound: this.IsBound,
|
|
8257
|
-
parameters: this.
|
|
8830
|
+
parameters: this.Parameter?.map((p) => p.toConfig()),
|
|
8258
8831
|
return: this.ReturnType?.toConfig(),
|
|
8259
8832
|
};
|
|
8260
8833
|
}
|
|
8261
8834
|
}
|
|
8262
8835
|
class CsdlFunctionImport {
|
|
8836
|
+
container;
|
|
8837
|
+
Name;
|
|
8838
|
+
FunctionName;
|
|
8839
|
+
EntitySet;
|
|
8840
|
+
IncludeInServiceDocument;
|
|
8263
8841
|
constructor(container, { Name, FunctionName, EntitySet, IncludeInServiceDocument, }) {
|
|
8264
8842
|
this.container = container;
|
|
8265
8843
|
this.Name = Name;
|
|
@@ -8267,28 +8845,69 @@ class CsdlFunctionImport {
|
|
|
8267
8845
|
this.EntitySet = EntitySet;
|
|
8268
8846
|
this.IncludeInServiceDocument = IncludeInServiceDocument;
|
|
8269
8847
|
}
|
|
8848
|
+
toJson() {
|
|
8849
|
+
return {
|
|
8850
|
+
Name: this.Name,
|
|
8851
|
+
FunctionName: this.FunctionName,
|
|
8852
|
+
EntitySet: this.EntitySet,
|
|
8853
|
+
IncludeInServiceDocument: this.IncludeInServiceDocument,
|
|
8854
|
+
};
|
|
8855
|
+
}
|
|
8270
8856
|
}
|
|
8271
8857
|
class CsdlActionImport {
|
|
8858
|
+
container;
|
|
8859
|
+
Name;
|
|
8860
|
+
Action;
|
|
8861
|
+
EntitySet;
|
|
8272
8862
|
constructor(container, { Name, Action, EntitySet, }) {
|
|
8273
8863
|
this.container = container;
|
|
8274
8864
|
this.Name = Name;
|
|
8275
8865
|
this.Action = Action;
|
|
8276
8866
|
this.EntitySet = EntitySet;
|
|
8277
8867
|
}
|
|
8868
|
+
toJson() {
|
|
8869
|
+
return {
|
|
8870
|
+
Name: this.Name,
|
|
8871
|
+
Action: this.Action,
|
|
8872
|
+
EntitySet: this.EntitySet,
|
|
8873
|
+
};
|
|
8874
|
+
}
|
|
8278
8875
|
}
|
|
8279
8876
|
class CsdlParameter extends CsdlAnnotable {
|
|
8877
|
+
Name;
|
|
8878
|
+
Type;
|
|
8879
|
+
Collection;
|
|
8880
|
+
Nullable;
|
|
8881
|
+
MaxLength;
|
|
8882
|
+
Precision;
|
|
8883
|
+
Scale;
|
|
8884
|
+
SRID;
|
|
8280
8885
|
constructor({ Name, Type, Nullable, MaxLength, Precision, Scale, SRID, Annotation, }) {
|
|
8281
8886
|
super({ Annotation });
|
|
8282
8887
|
this.Name = Name;
|
|
8283
|
-
this.
|
|
8888
|
+
this.Collection = Type.startsWith('Collection(');
|
|
8889
|
+
this.Type = this.Collection ? Type.substring(11, Type.length - 1) : Type;
|
|
8284
8890
|
this.Nullable = Nullable;
|
|
8285
8891
|
this.MaxLength = MaxLength;
|
|
8286
8892
|
this.Precision = Precision;
|
|
8287
8893
|
this.Scale = Scale;
|
|
8288
8894
|
this.SRID = SRID;
|
|
8289
8895
|
}
|
|
8896
|
+
toJson() {
|
|
8897
|
+
return {
|
|
8898
|
+
...super.toJson(),
|
|
8899
|
+
Name: this.Name,
|
|
8900
|
+
Type: this.Collection ? `Collection(${this.Type})` : this.Type,
|
|
8901
|
+
Nullable: this.Nullable,
|
|
8902
|
+
MaxLength: this.MaxLength,
|
|
8903
|
+
Precision: this.Precision,
|
|
8904
|
+
Scale: this.Scale,
|
|
8905
|
+
SRID: this.SRID,
|
|
8906
|
+
};
|
|
8907
|
+
}
|
|
8290
8908
|
toConfig() {
|
|
8291
8909
|
return {
|
|
8910
|
+
...super.toConfig(),
|
|
8292
8911
|
type: this.Type,
|
|
8293
8912
|
nullable: this.Nullable,
|
|
8294
8913
|
collection: false,
|
|
@@ -8296,14 +8915,32 @@ class CsdlParameter extends CsdlAnnotable {
|
|
|
8296
8915
|
}
|
|
8297
8916
|
}
|
|
8298
8917
|
class CsdlReturnType {
|
|
8918
|
+
Type;
|
|
8919
|
+
Collection;
|
|
8920
|
+
Nullable;
|
|
8921
|
+
MaxLength;
|
|
8922
|
+
Precision;
|
|
8923
|
+
Scale;
|
|
8924
|
+
SRID;
|
|
8299
8925
|
constructor({ Type, Nullable, MaxLength, Precision, Scale, SRID, }) {
|
|
8300
|
-
this.
|
|
8926
|
+
this.Collection = Type.startsWith('Collection(');
|
|
8927
|
+
this.Type = this.Collection ? Type.substring(11, Type.length - 1) : Type;
|
|
8301
8928
|
this.Nullable = Nullable;
|
|
8302
8929
|
this.MaxLength = MaxLength;
|
|
8303
8930
|
this.Precision = Precision;
|
|
8304
8931
|
this.Scale = Scale;
|
|
8305
8932
|
this.SRID = SRID;
|
|
8306
8933
|
}
|
|
8934
|
+
toJson() {
|
|
8935
|
+
return {
|
|
8936
|
+
Type: this.Collection ? `Collection(${this.Type})` : this.Type,
|
|
8937
|
+
Nullable: this.Nullable,
|
|
8938
|
+
MaxLength: this.MaxLength,
|
|
8939
|
+
Precision: this.Precision,
|
|
8940
|
+
Scale: this.Scale,
|
|
8941
|
+
SRID: this.SRID,
|
|
8942
|
+
};
|
|
8943
|
+
}
|
|
8307
8944
|
toConfig() {
|
|
8308
8945
|
return {
|
|
8309
8946
|
type: this.Type,
|
|
@@ -8313,13 +8950,26 @@ class CsdlReturnType {
|
|
|
8313
8950
|
}
|
|
8314
8951
|
|
|
8315
8952
|
class CsdlNavigationPropertyBinding {
|
|
8953
|
+
Path;
|
|
8954
|
+
Target;
|
|
8316
8955
|
constructor({ Path, Target }) {
|
|
8317
8956
|
this.Path = Path;
|
|
8318
8957
|
this.Target = Target;
|
|
8319
8958
|
}
|
|
8959
|
+
toJson() {
|
|
8960
|
+
return {
|
|
8961
|
+
Path: this.Path,
|
|
8962
|
+
Target: this.Target,
|
|
8963
|
+
};
|
|
8964
|
+
}
|
|
8320
8965
|
}
|
|
8321
8966
|
|
|
8322
8967
|
class CsdlEntitySet extends CsdlAnnotable {
|
|
8968
|
+
container;
|
|
8969
|
+
Name;
|
|
8970
|
+
EntityType;
|
|
8971
|
+
NavigationPropertyBinding;
|
|
8972
|
+
IncludeInServiceDocument;
|
|
8323
8973
|
constructor(container, { Name, EntityType, NavigationPropertyBinding, IncludeInServiceDocument, Annotation, }) {
|
|
8324
8974
|
super({ Annotation });
|
|
8325
8975
|
this.container = container;
|
|
@@ -8328,20 +8978,45 @@ class CsdlEntitySet extends CsdlAnnotable {
|
|
|
8328
8978
|
this.NavigationPropertyBinding = NavigationPropertyBinding?.map((n) => new CsdlNavigationPropertyBinding(n));
|
|
8329
8979
|
this.IncludeInServiceDocument = IncludeInServiceDocument;
|
|
8330
8980
|
}
|
|
8981
|
+
toJson() {
|
|
8982
|
+
const json = {
|
|
8983
|
+
...super.toJson(),
|
|
8984
|
+
Name: this.Name,
|
|
8985
|
+
EntityType: this.EntityType,
|
|
8986
|
+
};
|
|
8987
|
+
if (Array.isArray(this.NavigationPropertyBinding) &&
|
|
8988
|
+
this.NavigationPropertyBinding.length > 0) {
|
|
8989
|
+
json['NavigationPropertyBinding'] = this.NavigationPropertyBinding.map((n) => n.toJson());
|
|
8990
|
+
}
|
|
8991
|
+
if (this.IncludeInServiceDocument !== undefined) {
|
|
8992
|
+
json['IncludeInServiceDocument'] = this.IncludeInServiceDocument;
|
|
8993
|
+
}
|
|
8994
|
+
return json;
|
|
8995
|
+
}
|
|
8996
|
+
name() {
|
|
8997
|
+
return `${this.Name}`;
|
|
8998
|
+
}
|
|
8999
|
+
namespace() {
|
|
9000
|
+
return `${this.container.namespace()}`;
|
|
9001
|
+
}
|
|
8331
9002
|
fullName() {
|
|
8332
|
-
return `${this.container.
|
|
9003
|
+
return `${this.container.namespace()}.${this.Name}`;
|
|
8333
9004
|
}
|
|
8334
9005
|
toConfig() {
|
|
8335
9006
|
return {
|
|
9007
|
+
...super.toConfig(),
|
|
8336
9008
|
name: this.Name,
|
|
8337
9009
|
entityType: this.EntityType,
|
|
8338
9010
|
service: {},
|
|
8339
|
-
annotations: this.Annotation?.map((t) => t.toConfig()),
|
|
8340
9011
|
};
|
|
8341
9012
|
}
|
|
8342
9013
|
}
|
|
8343
9014
|
|
|
8344
9015
|
class CsdlSingleton extends CsdlAnnotable {
|
|
9016
|
+
container;
|
|
9017
|
+
Name;
|
|
9018
|
+
Type;
|
|
9019
|
+
NavigationPropertyBindings;
|
|
8345
9020
|
constructor(container, { Name, Type, NavigationPropertyBindings, Annotation, }) {
|
|
8346
9021
|
super({ Annotation });
|
|
8347
9022
|
this.container = container;
|
|
@@ -8349,12 +9024,37 @@ class CsdlSingleton extends CsdlAnnotable {
|
|
|
8349
9024
|
this.Type = Type;
|
|
8350
9025
|
this.NavigationPropertyBindings = NavigationPropertyBindings?.map((n) => new CsdlNavigationPropertyBinding(n));
|
|
8351
9026
|
}
|
|
9027
|
+
toJson() {
|
|
9028
|
+
const json = {
|
|
9029
|
+
...super.toJson(),
|
|
9030
|
+
Name: this.Name,
|
|
9031
|
+
Type: this.Type,
|
|
9032
|
+
};
|
|
9033
|
+
if (Array.isArray(this.NavigationPropertyBindings) &&
|
|
9034
|
+
this.NavigationPropertyBindings.length > 0) {
|
|
9035
|
+
json['NavigationPropertyBindings'] = this.NavigationPropertyBindings.map((n) => n.toJson());
|
|
9036
|
+
}
|
|
9037
|
+
return json;
|
|
9038
|
+
}
|
|
9039
|
+
name() {
|
|
9040
|
+
return `${this.Name}`;
|
|
9041
|
+
}
|
|
9042
|
+
namespace() {
|
|
9043
|
+
return `${this.container.namespace()}`;
|
|
9044
|
+
}
|
|
8352
9045
|
fullName() {
|
|
8353
|
-
return `${this.container.
|
|
9046
|
+
return `${this.container.namespace()}.${this.Name}`;
|
|
8354
9047
|
}
|
|
8355
9048
|
}
|
|
8356
9049
|
|
|
8357
9050
|
class CsdlEntityContainer extends CsdlAnnotable {
|
|
9051
|
+
schema;
|
|
9052
|
+
Name;
|
|
9053
|
+
Extend;
|
|
9054
|
+
EntitySet;
|
|
9055
|
+
Singleton;
|
|
9056
|
+
FunctionImport;
|
|
9057
|
+
ActionImport;
|
|
8358
9058
|
constructor(schema, { Name, Extend, EntitySet, Singleton, FunctionImport, ActionImport, Annotation, }) {
|
|
8359
9059
|
super({ Annotation });
|
|
8360
9060
|
this.schema = schema;
|
|
@@ -8365,19 +9065,55 @@ class CsdlEntityContainer extends CsdlAnnotable {
|
|
|
8365
9065
|
this.FunctionImport = FunctionImport?.map((f) => new CsdlFunctionImport(this, f));
|
|
8366
9066
|
this.ActionImport = ActionImport?.map((a) => new CsdlActionImport(this, a));
|
|
8367
9067
|
}
|
|
8368
|
-
|
|
8369
|
-
|
|
9068
|
+
toJson() {
|
|
9069
|
+
const json = { ...super.toJson() };
|
|
9070
|
+
if (this.Extend !== undefined) {
|
|
9071
|
+
json['Extend'] = this.Extend;
|
|
9072
|
+
}
|
|
9073
|
+
if (Array.isArray(this.EntitySet) && this.EntitySet.length > 0) {
|
|
9074
|
+
json['EntitySet'] = this.EntitySet.map((a) => a.toJson());
|
|
9075
|
+
}
|
|
9076
|
+
if (Array.isArray(this.Singleton) && this.Singleton.length > 0) {
|
|
9077
|
+
json['Singleton'] = this.Singleton.map((a) => a.toJson());
|
|
9078
|
+
}
|
|
9079
|
+
if (Array.isArray(this.FunctionImport) && this.FunctionImport.length > 0) {
|
|
9080
|
+
json['FunctionImport'] = this.FunctionImport.map((a) => a.toJson());
|
|
9081
|
+
}
|
|
9082
|
+
if (Array.isArray(this.ActionImport) && this.ActionImport.length > 0) {
|
|
9083
|
+
json['ActionImport'] = this.ActionImport.map((a) => a.toJson());
|
|
9084
|
+
}
|
|
9085
|
+
return json;
|
|
9086
|
+
}
|
|
9087
|
+
name() {
|
|
9088
|
+
return `${this.Name}`;
|
|
8370
9089
|
}
|
|
8371
|
-
|
|
9090
|
+
namespace() {
|
|
9091
|
+
return `${this.schema.Namespace}`;
|
|
9092
|
+
}
|
|
9093
|
+
fullName() {
|
|
9094
|
+
return `${this.schema.Namespace}.${this.Name}`;
|
|
9095
|
+
}
|
|
9096
|
+
toConfig(base) {
|
|
8372
9097
|
return {
|
|
9098
|
+
...super.toConfig(),
|
|
8373
9099
|
name: this.Name,
|
|
8374
|
-
annotations: this.Annotation?.map((t) => t.toConfig()),
|
|
8375
9100
|
entitySets: this.EntitySet?.map((t) => t.toConfig()),
|
|
8376
9101
|
};
|
|
8377
9102
|
}
|
|
8378
9103
|
}
|
|
8379
9104
|
|
|
8380
9105
|
class CsdlSchema {
|
|
9106
|
+
Namespace;
|
|
9107
|
+
Alias;
|
|
9108
|
+
EnumType;
|
|
9109
|
+
ComplexType;
|
|
9110
|
+
EntityType;
|
|
9111
|
+
Function;
|
|
9112
|
+
Action;
|
|
9113
|
+
EntityContainer;
|
|
9114
|
+
TypeDefinition;
|
|
9115
|
+
Term;
|
|
9116
|
+
Annotations;
|
|
8381
9117
|
constructor({ Namespace, Alias, EnumType, ComplexType, EntityType, Function, Action, EntityContainer, TypeDefinition, Term, Annotations, }) {
|
|
8382
9118
|
this.Namespace = Namespace;
|
|
8383
9119
|
this.Alias = Alias;
|
|
@@ -8391,23 +9127,99 @@ class CsdlSchema {
|
|
|
8391
9127
|
this.Term = Term?.map((t) => new CsdlTerm(this, t));
|
|
8392
9128
|
this.Annotations = Annotations?.map((a) => new CsdlAnnotations(this, a));
|
|
8393
9129
|
}
|
|
8394
|
-
|
|
9130
|
+
toJson() {
|
|
9131
|
+
const json = {
|
|
9132
|
+
Namespace: this.Namespace,
|
|
9133
|
+
};
|
|
9134
|
+
if (this.Alias !== undefined) {
|
|
9135
|
+
json['Alias'] = this.Alias;
|
|
9136
|
+
}
|
|
9137
|
+
if (Array.isArray(this.EntityContainer) &&
|
|
9138
|
+
this.EntityContainer.length > 0) {
|
|
9139
|
+
json['EntityContainer'] = this.EntityContainer.map((a) => a.toJson());
|
|
9140
|
+
}
|
|
9141
|
+
if (Array.isArray(this.EntityType) && this.EntityType.length > 0) {
|
|
9142
|
+
json['EntityType'] = this.EntityType.map((a) => a.toJson());
|
|
9143
|
+
}
|
|
9144
|
+
if (Array.isArray(this.ComplexType) && this.ComplexType.length > 0) {
|
|
9145
|
+
json['ComplexType'] = this.ComplexType.map((a) => a.toJson());
|
|
9146
|
+
}
|
|
9147
|
+
if (Array.isArray(this.EnumType) && this.EnumType.length > 0) {
|
|
9148
|
+
json['EnumType'] = this.EnumType.map((a) => a.toJson());
|
|
9149
|
+
}
|
|
9150
|
+
if (Array.isArray(this.TypeDefinition) && this.TypeDefinition.length > 0) {
|
|
9151
|
+
json['TypeDefinition'] = this.TypeDefinition.map((a) => a.toJson());
|
|
9152
|
+
}
|
|
9153
|
+
if (Array.isArray(this.Term) && this.Term.length > 0) {
|
|
9154
|
+
json['Term'] = this.Term.map((a) => a.toJson());
|
|
9155
|
+
}
|
|
9156
|
+
if (Array.isArray(this.Annotations) && this.Annotations.length > 0) {
|
|
9157
|
+
json['Annotations'] = this.Annotations.map((a) => a.toJson());
|
|
9158
|
+
}
|
|
9159
|
+
if (Array.isArray(this.Action) && this.Action.length > 0) {
|
|
9160
|
+
json['Action'] = this.Action.map((a) => a.toJson());
|
|
9161
|
+
}
|
|
9162
|
+
if (Array.isArray(this.Function) && this.Function.length > 0) {
|
|
9163
|
+
json['Function'] = this.Function.map((a) => a.toJson());
|
|
9164
|
+
}
|
|
9165
|
+
return json;
|
|
9166
|
+
}
|
|
9167
|
+
toConfig(base) {
|
|
8395
9168
|
return {
|
|
8396
9169
|
namespace: this.Namespace,
|
|
8397
|
-
alias: this.Alias,
|
|
9170
|
+
alias: base?.alias ?? this.Alias,
|
|
8398
9171
|
annotations: this.Annotations?.map((t) => t.toConfig()),
|
|
8399
|
-
enums: this.
|
|
9172
|
+
enums: this.EnumType?.map((t) => t.toConfig(base?.enums?.find((cs) => cs.name === t.Name))),
|
|
8400
9173
|
entities: [
|
|
8401
|
-
...(this.ComplexType ?? []).map((t) => t.toConfig()),
|
|
8402
|
-
...(this.EntityType ?? []).map((t) => t.toConfig()),
|
|
9174
|
+
...(this.ComplexType ?? []).map((t) => t.toConfig(base?.entities?.find((cs) => cs.name === t.Name))),
|
|
9175
|
+
...(this.EntityType ?? []).map((t) => t.toConfig(base?.entities?.find((cs) => cs.name === t.Name))),
|
|
8403
9176
|
],
|
|
8404
9177
|
callables: [
|
|
8405
|
-
...(this.Function ?? []).map((t) => t.toConfig()),
|
|
8406
|
-
...(this.Action ?? []).map((t) => t.toConfig()),
|
|
9178
|
+
...(this.Function ?? []).map((t) => t.toConfig(base?.callables?.find((cs) => cs.name === t.Name))),
|
|
9179
|
+
...(this.Action ?? []).map((t) => t.toConfig(base?.callables?.find((cs) => cs.name === t.Name))),
|
|
8407
9180
|
],
|
|
8408
|
-
containers: this.EntityContainer?.map((t) => t.toConfig()),
|
|
9181
|
+
containers: this.EntityContainer?.map((t) => t.toConfig(base?.containers?.find((cs) => cs.name === t.Name))),
|
|
9182
|
+
};
|
|
9183
|
+
}
|
|
9184
|
+
}
|
|
9185
|
+
|
|
9186
|
+
class ODataMetadata {
|
|
9187
|
+
Version;
|
|
9188
|
+
References;
|
|
9189
|
+
Schemas;
|
|
9190
|
+
constructor(Version, References, Schemas) {
|
|
9191
|
+
this.Version = Version;
|
|
9192
|
+
this.References = References?.map((r) => new CsdlReference(r));
|
|
9193
|
+
this.Schemas = Schemas?.map((s) => new CsdlSchema(s));
|
|
9194
|
+
}
|
|
9195
|
+
toConfig(base) {
|
|
9196
|
+
return {
|
|
9197
|
+
...base,
|
|
9198
|
+
version: base?.version ?? this.Version,
|
|
9199
|
+
schemas: (this.Schemas ?? []).map((ms) => ms.toConfig(base?.schemas?.find((cs) => cs.namespace === ms.Namespace))),
|
|
9200
|
+
references: (this.References ?? []).map((mr) => mr.toConfig(base?.references?.find((cs) => cs.uri === mr.Uri))),
|
|
9201
|
+
};
|
|
9202
|
+
}
|
|
9203
|
+
toJson() {
|
|
9204
|
+
return {
|
|
9205
|
+
Version: this.Version,
|
|
9206
|
+
References: this.References.map((r) => r.toJson()),
|
|
9207
|
+
Schemas: this.Schemas.map((s) => s.toJson()),
|
|
8409
9208
|
};
|
|
8410
9209
|
}
|
|
9210
|
+
functions() {
|
|
9211
|
+
return this.Schemas.reduce((acc, s) => {
|
|
9212
|
+
return [...acc, ...(s.Function ?? [])];
|
|
9213
|
+
}, []);
|
|
9214
|
+
}
|
|
9215
|
+
actions() {
|
|
9216
|
+
return this.Schemas.reduce((acc, s) => {
|
|
9217
|
+
return [...acc, ...(s.Action ?? [])];
|
|
9218
|
+
}, []);
|
|
9219
|
+
}
|
|
9220
|
+
static fromJson(json) {
|
|
9221
|
+
return new ODataMetadata(json.Version, json.References, json.Schemas);
|
|
9222
|
+
}
|
|
8411
9223
|
}
|
|
8412
9224
|
|
|
8413
9225
|
var FieldType;
|
|
@@ -8416,6 +9228,8 @@ var FieldType;
|
|
|
8416
9228
|
FieldType[FieldType["TAG"] = 1] = "TAG";
|
|
8417
9229
|
})(FieldType || (FieldType = {}));
|
|
8418
9230
|
class Field {
|
|
9231
|
+
name;
|
|
9232
|
+
fieldType;
|
|
8419
9233
|
constructor(name, fieldType) {
|
|
8420
9234
|
this.name = name;
|
|
8421
9235
|
this.fieldType = fieldType;
|
|
@@ -8423,89 +9237,90 @@ class Field {
|
|
|
8423
9237
|
}
|
|
8424
9238
|
class ODataMetadataParser {
|
|
8425
9239
|
// TAGS
|
|
8426
|
-
static
|
|
8427
|
-
static
|
|
8428
|
-
static
|
|
8429
|
-
static
|
|
8430
|
-
static
|
|
8431
|
-
static
|
|
8432
|
-
static
|
|
8433
|
-
static
|
|
8434
|
-
static
|
|
8435
|
-
static
|
|
8436
|
-
static
|
|
8437
|
-
static
|
|
8438
|
-
static
|
|
8439
|
-
static
|
|
8440
|
-
static
|
|
8441
|
-
static
|
|
8442
|
-
static
|
|
8443
|
-
static
|
|
8444
|
-
static
|
|
8445
|
-
static
|
|
8446
|
-
static
|
|
8447
|
-
static
|
|
8448
|
-
static
|
|
8449
|
-
static
|
|
8450
|
-
static
|
|
8451
|
-
static
|
|
8452
|
-
static
|
|
8453
|
-
static
|
|
8454
|
-
static
|
|
8455
|
-
static
|
|
8456
|
-
static
|
|
8457
|
-
static
|
|
8458
|
-
static
|
|
8459
|
-
static
|
|
8460
|
-
static
|
|
8461
|
-
static
|
|
8462
|
-
static
|
|
9240
|
+
static TAG_EDMX = 'edmx:Edmx';
|
|
9241
|
+
static TAG_DATA_SERVICES = 'edmx:DataServices';
|
|
9242
|
+
static TAG_REFERENCE = 'edmx:Reference';
|
|
9243
|
+
static TAG_INCLUDE = 'edmx:Include';
|
|
9244
|
+
static TAG_INCLUDE_ANNOTATIONS = 'edmx:IncludeAnnotations';
|
|
9245
|
+
static TAG_TERM = 'Term';
|
|
9246
|
+
static TAG_ANNOTATIONS = 'Annotations';
|
|
9247
|
+
static TAG_ANNOTATION = 'Annotation';
|
|
9248
|
+
static TAG_SCHEMA = 'Schema';
|
|
9249
|
+
static TAG_ENUM_TYPE = 'EnumType';
|
|
9250
|
+
static TAG_MEMBER = 'Member';
|
|
9251
|
+
static TAG_COMPLEX_TYPE = 'ComplexType';
|
|
9252
|
+
static TAG_ENTITY_TYPE = 'EntityType';
|
|
9253
|
+
static TAG_PROPERTY = 'Property';
|
|
9254
|
+
static TAG_KEY = 'Key';
|
|
9255
|
+
static TAG_PROPERTY_REF = 'PropertyRef';
|
|
9256
|
+
static TAG_NAVIGATION_PROPERTY = 'NavigationProperty';
|
|
9257
|
+
static TAG_REFERENTIAL_CONSTRAINT = 'ReferentialConstraint';
|
|
9258
|
+
static TAG_ON_DELETE = 'OnDelete';
|
|
9259
|
+
static TAG_FUNCTION = 'Function';
|
|
9260
|
+
static TAG_RETURN_TYPE = 'ReturnType';
|
|
9261
|
+
static TAG_PARAMETER = 'Parameter';
|
|
9262
|
+
static TAG_ACTION = 'Action';
|
|
9263
|
+
static TAG_ENTITY_CONTAINER = 'EntityContainer';
|
|
9264
|
+
static TAG_ENTITY_SET = 'EntitySet';
|
|
9265
|
+
static TAG_SINGLETON = 'Singleton';
|
|
9266
|
+
static TAG_COLLECTION = 'Collection';
|
|
9267
|
+
static TAG_RECORD = 'Record';
|
|
9268
|
+
static TAG_STRING = 'String';
|
|
9269
|
+
static TAG_ENUM_MEMBER = 'EnumMember';
|
|
9270
|
+
static TAG_PROPERTY_VALUE = 'PropertyValue';
|
|
9271
|
+
static TAG_PROPERTY_PATH = 'PropertyPath';
|
|
9272
|
+
static TAG_NAVIGATION_PROPERTY_PATH = 'NavigationPropertyPath';
|
|
9273
|
+
static TAG_FUNCTION_IMPORT = 'FunctionImport';
|
|
9274
|
+
static TAG_ACTION_IMPORT = 'ActionImport';
|
|
9275
|
+
static TAG_NAVIGATION_PROPERTY_BINDING = 'NavigationPropertyBinding';
|
|
9276
|
+
static TAG_TYPE_DEFINITION = 'TypeDefinition';
|
|
8463
9277
|
// ATTRIBUTES
|
|
8464
|
-
static
|
|
8465
|
-
static
|
|
8466
|
-
static
|
|
8467
|
-
static
|
|
8468
|
-
static
|
|
8469
|
-
static
|
|
8470
|
-
static
|
|
8471
|
-
static
|
|
8472
|
-
static
|
|
8473
|
-
static
|
|
8474
|
-
static
|
|
8475
|
-
static
|
|
8476
|
-
static
|
|
8477
|
-
static
|
|
8478
|
-
static
|
|
8479
|
-
static
|
|
8480
|
-
static
|
|
8481
|
-
static
|
|
8482
|
-
static
|
|
8483
|
-
static
|
|
8484
|
-
static
|
|
8485
|
-
static
|
|
8486
|
-
static
|
|
8487
|
-
static
|
|
8488
|
-
static
|
|
8489
|
-
static
|
|
8490
|
-
static
|
|
8491
|
-
static
|
|
8492
|
-
static
|
|
8493
|
-
static
|
|
8494
|
-
static
|
|
8495
|
-
static
|
|
8496
|
-
static
|
|
8497
|
-
static
|
|
8498
|
-
static
|
|
8499
|
-
static
|
|
8500
|
-
static
|
|
8501
|
-
static
|
|
8502
|
-
static
|
|
8503
|
-
static
|
|
8504
|
-
static
|
|
8505
|
-
static
|
|
8506
|
-
static
|
|
8507
|
-
static
|
|
8508
|
-
static
|
|
9278
|
+
static ATTRIBUTE_VERSION = 'Version';
|
|
9279
|
+
static ATTRIBUTE_URI = 'Uri';
|
|
9280
|
+
static ATTRIBUTE_ALIAS = 'Alias';
|
|
9281
|
+
static ATTRIBUTE_NAMESPACE = 'Namespace';
|
|
9282
|
+
static ATTRIBUTE_TERM_NAMESPACE = 'TermNamespace';
|
|
9283
|
+
static ATTRIBUTE_QUALIFIER = 'Qualifier';
|
|
9284
|
+
static ATTRIBUTE_STRING = 'String';
|
|
9285
|
+
static ATTRIBUTE_DATE = 'Date';
|
|
9286
|
+
static ATTRIBUTE_BOOL = 'Bool';
|
|
9287
|
+
static ATTRIBUTE_INT = 'Int';
|
|
9288
|
+
static ATTRIBUTE_TARGET_NAMESPACE = 'TargetNamespace';
|
|
9289
|
+
static ATTRIBUTE_TERM = 'Term';
|
|
9290
|
+
static ATTRIBUTE_NAME = 'Name';
|
|
9291
|
+
static ATTRIBUTE_VALUE = 'Value';
|
|
9292
|
+
static ATTRIBUTE_BASE_TYPE = 'BaseType';
|
|
9293
|
+
static ATTRIBUTE_OPEN_TYPE = 'OpenType';
|
|
9294
|
+
static ATTRIBUTE_TYPE = 'Type';
|
|
9295
|
+
static ATTRIBUTE_NULLABLE = 'Nullable';
|
|
9296
|
+
static ATTRIBUTE_MAX_LENGTH = 'MaxLength';
|
|
9297
|
+
static ATTRIBUTE_PRECISION = 'Precision';
|
|
9298
|
+
static ATTRIBUTE_SCALE = 'Scale';
|
|
9299
|
+
static ATTRIBUTE_UNICODE = 'Unicode';
|
|
9300
|
+
static ATTRIBUTE_SRID = 'SRID';
|
|
9301
|
+
static ATTRIBUTE_DEFAULT_VALUE = 'DefaultValue';
|
|
9302
|
+
static ATTRIBUTE_PARTNER = 'Partner';
|
|
9303
|
+
static ATTRIBUTE_PROPERTY = 'Property';
|
|
9304
|
+
static ATTRIBUTE_REFERENCED_PROPERTY = 'ReferencedProperty';
|
|
9305
|
+
static ATTRIBUTE_HAS_STREAM = 'HasStream';
|
|
9306
|
+
static ATTRIBUTE_CONTAINS_TARGET = 'ContainsTarget';
|
|
9307
|
+
static ATTRIBUTE_IS_BOUND = 'IsBound';
|
|
9308
|
+
static ATTRIBUTE_ENTITY_SET_PATH = 'EntitySetPath';
|
|
9309
|
+
static ATTRIBUTE_IS_COMPOSABLE = 'IsComposable';
|
|
9310
|
+
static ATTRIBUTE_ENTITY_TYPE = 'EntityType';
|
|
9311
|
+
static ATTRIBUTE_PATH = 'Path';
|
|
9312
|
+
static ATTRIBUTE_TARGET = 'Target';
|
|
9313
|
+
static ATTRIBUTE_FUNCTION = 'Function';
|
|
9314
|
+
static ATTRIBUTE_ACTION = 'Action';
|
|
9315
|
+
static ATTRIBUTE_ENTITY_SET = 'EntitySet';
|
|
9316
|
+
static ATTRIBUTE_INCLUDE_IN_SERVICE_DOCUMENT = 'IncludeInServiceDocument';
|
|
9317
|
+
static ATTRIBUTE_ABSTRACT = 'Abstract';
|
|
9318
|
+
static ATTRIBUTE_UNDERLYING_TYPE = 'UnderlyingType';
|
|
9319
|
+
static ATTRIBUTE_IS_FLAGS = 'IsFlags';
|
|
9320
|
+
static ATTRIBUTE_EXTENDS = 'Extends';
|
|
9321
|
+
static ATTRIBUTE_BASE_TERM = 'BaseTerm';
|
|
9322
|
+
static ATTRIBUTE_APPLIES_TO = 'AppliesTo';
|
|
9323
|
+
document;
|
|
8509
9324
|
constructor(xml) {
|
|
8510
9325
|
try {
|
|
8511
9326
|
const parser = new DOMParser();
|
|
@@ -8523,7 +9338,7 @@ class ODataMetadataParser {
|
|
|
8523
9338
|
new Field(ODataMetadataParser.TAG_INCLUDE, FieldType.TAG),
|
|
8524
9339
|
new Field(ODataMetadataParser.TAG_INCLUDE_ANNOTATIONS, FieldType.TAG),
|
|
8525
9340
|
new Field(ODataMetadataParser.TAG_ANNOTATION, FieldType.TAG),
|
|
8526
|
-
])
|
|
9341
|
+
]);
|
|
8527
9342
|
const dataServices = this.document.documentElement.getElementsByTagName(ODataMetadataParser.TAG_DATA_SERVICES)[0];
|
|
8528
9343
|
const schemas = this.getObjects(dataServices, ODataMetadataParser.TAG_SCHEMA, [
|
|
8529
9344
|
new Field(ODataMetadataParser.ATTRIBUTE_NAMESPACE, FieldType.ATTRIBUTE),
|
|
@@ -8537,7 +9352,7 @@ class ODataMetadataParser {
|
|
|
8537
9352
|
new Field(ODataMetadataParser.TAG_TYPE_DEFINITION, FieldType.TAG),
|
|
8538
9353
|
new Field(ODataMetadataParser.TAG_TERM, FieldType.TAG),
|
|
8539
9354
|
new Field(ODataMetadataParser.TAG_ANNOTATIONS, FieldType.TAG),
|
|
8540
|
-
])
|
|
9355
|
+
]);
|
|
8541
9356
|
return new ODataMetadata(version, references, schemas);
|
|
8542
9357
|
}
|
|
8543
9358
|
checkVersion(document) {
|
|
@@ -9108,11 +9923,6 @@ class ODataSingletonResource extends ODataResource {
|
|
|
9108
9923
|
fetchEntity(options) {
|
|
9109
9924
|
return this.fetch(options).pipe(map(({ entity }) => entity));
|
|
9110
9925
|
}
|
|
9111
|
-
/**
|
|
9112
|
-
* Fetch an existing entity and return a model.
|
|
9113
|
-
* @param options The options for the request.
|
|
9114
|
-
* @returns Observable of the entity.
|
|
9115
|
-
*/
|
|
9116
9926
|
fetchModel(options) {
|
|
9117
9927
|
return this.fetch(options).pipe(map(({ entity, annots }) => entity
|
|
9118
9928
|
? this.asModel(entity, { annots, ModelType: options?.ModelType })
|
|
@@ -9121,6 +9931,9 @@ class ODataSingletonResource extends ODataResource {
|
|
|
9121
9931
|
}
|
|
9122
9932
|
|
|
9123
9933
|
class ODataAnnotations {
|
|
9934
|
+
helper;
|
|
9935
|
+
annotations;
|
|
9936
|
+
context;
|
|
9124
9937
|
constructor(helper, annotations = new Map(), context) {
|
|
9125
9938
|
this.helper = helper;
|
|
9126
9939
|
this.annotations = annotations;
|
|
@@ -9190,6 +10003,7 @@ class ODataEntityAnnotations extends ODataAnnotations {
|
|
|
9190
10003
|
get mediaContentType() {
|
|
9191
10004
|
return this.helper.mediaContentType(this.annotations);
|
|
9192
10005
|
}
|
|
10006
|
+
_properties;
|
|
9193
10007
|
get properties() {
|
|
9194
10008
|
if (this._properties === undefined) {
|
|
9195
10009
|
this._properties = this.helper.properties(this.annotations);
|
|
@@ -9202,6 +10016,7 @@ class ODataEntityAnnotations extends ODataAnnotations {
|
|
|
9202
10016
|
? new ODataEntitiesAnnotations(this.helper, props)
|
|
9203
10017
|
: new ODataEntityAnnotations(this.helper, props);
|
|
9204
10018
|
}
|
|
10019
|
+
_functions;
|
|
9205
10020
|
get functions() {
|
|
9206
10021
|
if (this._functions === undefined) {
|
|
9207
10022
|
this._functions = this.helper.functions(this.annotations);
|
|
@@ -9246,6 +10061,7 @@ class ODataEntitiesAnnotations extends ODataAnnotations {
|
|
|
9246
10061
|
let match = (this.nextLink || '').match(/[&?]{1}\$skiptoken=([\d\w\s'\-]+)/);
|
|
9247
10062
|
return match !== null ? match[1] : undefined;
|
|
9248
10063
|
}
|
|
10064
|
+
_functions;
|
|
9249
10065
|
get functions() {
|
|
9250
10066
|
if (this._functions === undefined) {
|
|
9251
10067
|
this._functions = this.helper.functions(this.annotations);
|
|
@@ -9261,6 +10077,16 @@ class ODataEntitiesAnnotations extends ODataAnnotations {
|
|
|
9261
10077
|
}
|
|
9262
10078
|
|
|
9263
10079
|
class ODataResponseOptions {
|
|
10080
|
+
version;
|
|
10081
|
+
streaming;
|
|
10082
|
+
// OData
|
|
10083
|
+
metadata;
|
|
10084
|
+
ieee754Compatible;
|
|
10085
|
+
// Location
|
|
10086
|
+
location;
|
|
10087
|
+
// Cache
|
|
10088
|
+
cacheability;
|
|
10089
|
+
maxAge;
|
|
9264
10090
|
constructor(config) {
|
|
9265
10091
|
this.version = config.version || DEFAULT_VERSION;
|
|
9266
10092
|
}
|
|
@@ -9318,6 +10144,8 @@ class ODataResponseOptions {
|
|
|
9318
10144
|
* OData Response
|
|
9319
10145
|
*/
|
|
9320
10146
|
class ODataResponse extends HttpResponse {
|
|
10147
|
+
api;
|
|
10148
|
+
resource;
|
|
9321
10149
|
constructor(init) {
|
|
9322
10150
|
super(init);
|
|
9323
10151
|
this.api = init.api;
|
|
@@ -9357,6 +10185,7 @@ class ODataResponse extends HttpResponse {
|
|
|
9357
10185
|
url: this.url,
|
|
9358
10186
|
};
|
|
9359
10187
|
}
|
|
10188
|
+
_options;
|
|
9360
10189
|
get options() {
|
|
9361
10190
|
if (this._options === undefined) {
|
|
9362
10191
|
this._options = new ODataResponseOptions(this.api.options.parserOptions);
|
|
@@ -9387,6 +10216,7 @@ class ODataResponse extends HttpResponse {
|
|
|
9387
10216
|
}
|
|
9388
10217
|
return this._options;
|
|
9389
10218
|
}
|
|
10219
|
+
_payload;
|
|
9390
10220
|
get payload() {
|
|
9391
10221
|
if (this._payload === undefined) {
|
|
9392
10222
|
this._payload =
|
|
@@ -9396,12 +10226,14 @@ class ODataResponse extends HttpResponse {
|
|
|
9396
10226
|
}
|
|
9397
10227
|
return this._payload;
|
|
9398
10228
|
}
|
|
10229
|
+
_context;
|
|
9399
10230
|
get context() {
|
|
9400
10231
|
if (this._context === undefined) {
|
|
9401
10232
|
this._context = this.options.helper.context(Types.isPlainObject(this.payload) ? this.payload : {});
|
|
9402
10233
|
}
|
|
9403
10234
|
return this._context;
|
|
9404
10235
|
}
|
|
10236
|
+
_annotations;
|
|
9405
10237
|
get annotations() {
|
|
9406
10238
|
if (this._annotations === undefined) {
|
|
9407
10239
|
const options = this.options;
|
|
@@ -9482,61 +10314,14 @@ class ODataResponse extends HttpResponse {
|
|
|
9482
10314
|
}
|
|
9483
10315
|
}
|
|
9484
10316
|
|
|
9485
|
-
class ODataInStorageCache extends ODataCache {
|
|
9486
|
-
constructor({ name, storage = sessionStorage, timeout, }) {
|
|
9487
|
-
super({ timeout });
|
|
9488
|
-
this.name = name;
|
|
9489
|
-
this.storage = storage;
|
|
9490
|
-
this.restore();
|
|
9491
|
-
window.addEventListener('beforeunload', () => this.store());
|
|
9492
|
-
}
|
|
9493
|
-
/**
|
|
9494
|
-
* Store the cache in the storage
|
|
9495
|
-
*/
|
|
9496
|
-
store() {
|
|
9497
|
-
this.storage.setItem(this.name, JSON.stringify(Array.from(this.entries.entries())));
|
|
9498
|
-
}
|
|
9499
|
-
/**
|
|
9500
|
-
* Restore the cache from the storage
|
|
9501
|
-
*/
|
|
9502
|
-
restore() {
|
|
9503
|
-
this.entries = new Map(JSON.parse(this.storage.getItem(this.name) || '[]'));
|
|
9504
|
-
}
|
|
9505
|
-
/**
|
|
9506
|
-
* Flush the cache and clean the storage
|
|
9507
|
-
*/
|
|
9508
|
-
flush() {
|
|
9509
|
-
super.flush();
|
|
9510
|
-
this.store();
|
|
9511
|
-
}
|
|
9512
|
-
/**
|
|
9513
|
-
* Store the response in the cache
|
|
9514
|
-
* @param req The request with the resource to store the response
|
|
9515
|
-
* @param res The response to store in the cache
|
|
9516
|
-
*/
|
|
9517
|
-
putResponse(req, res) {
|
|
9518
|
-
const scope = this.scope(req);
|
|
9519
|
-
const tags = this.tags(res);
|
|
9520
|
-
this.put(req.cacheKey, res.toJson(), {
|
|
9521
|
-
timeout: res.options.maxAge,
|
|
9522
|
-
scope,
|
|
9523
|
-
tags,
|
|
9524
|
-
});
|
|
9525
|
-
}
|
|
9526
|
-
/**
|
|
9527
|
-
* Restore the response from the cache
|
|
9528
|
-
* @param req The request with the resource to get the response
|
|
9529
|
-
* @returns The response from the cache
|
|
9530
|
-
*/
|
|
9531
|
-
getResponse(req) {
|
|
9532
|
-
const scope = this.scope(req);
|
|
9533
|
-
const data = this.get(req.cacheKey, { scope });
|
|
9534
|
-
return data !== undefined ? ODataResponse.fromJson(req, data) : undefined;
|
|
9535
|
-
}
|
|
9536
|
-
}
|
|
9537
|
-
|
|
9538
10317
|
class ODataCollection {
|
|
9539
|
-
static
|
|
10318
|
+
static model = null;
|
|
10319
|
+
_parent = null;
|
|
10320
|
+
_resource = null;
|
|
10321
|
+
_resources = [];
|
|
10322
|
+
_annotations;
|
|
10323
|
+
_entries = [];
|
|
10324
|
+
_model;
|
|
9540
10325
|
models() {
|
|
9541
10326
|
return this._entries
|
|
9542
10327
|
.filter((e) => e.state !== ODataModelState.Removed)
|
|
@@ -9545,12 +10330,9 @@ class ODataCollection {
|
|
|
9545
10330
|
get length() {
|
|
9546
10331
|
return this.models().length;
|
|
9547
10332
|
}
|
|
10333
|
+
//Events
|
|
10334
|
+
events$;
|
|
9548
10335
|
constructor(entities = [], { parent, resource, annots, model, reset = false, } = {}) {
|
|
9549
|
-
this._parent = null;
|
|
9550
|
-
this._resource = null;
|
|
9551
|
-
this._resources = [];
|
|
9552
|
-
this._entries = [];
|
|
9553
|
-
this._sortBy = null;
|
|
9554
10336
|
const Klass = this.constructor;
|
|
9555
10337
|
if (!model && Klass.model !== null)
|
|
9556
10338
|
model = Klass.model;
|
|
@@ -10316,19 +11098,20 @@ class ODataCollection {
|
|
|
10316
11098
|
result = 1;
|
|
10317
11099
|
else if (value1 == null && value2 == null)
|
|
10318
11100
|
result = 0;
|
|
10319
|
-
else if (typeof value1 == 'string' || value1 instanceof String)
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
11101
|
+
else if ((typeof value1 == 'string' || value1 instanceof String) &&
|
|
11102
|
+
value1.localeCompare &&
|
|
11103
|
+
value1 != value2)
|
|
11104
|
+
result = value1.localeCompare(value2);
|
|
11105
|
+
else if (value1 == value2)
|
|
11106
|
+
return by.length - 1 > index ? this._compare(e1, e2, by, index + 1) : 0;
|
|
11107
|
+
else if (by[index].comparator !== undefined)
|
|
11108
|
+
result = by[index].comparator(value1, value2);
|
|
10324
11109
|
else {
|
|
10325
11110
|
result = value1 < value2 ? -1 : 1;
|
|
10326
11111
|
}
|
|
10327
|
-
|
|
10328
|
-
return by.length - 1 > index ? this._compare(e1, e2, by, index + 1) : 0;
|
|
10329
|
-
}
|
|
10330
|
-
return (by[index].order || 1) * result;
|
|
11112
|
+
return (by[index].order ?? 1) * result;
|
|
10331
11113
|
}
|
|
11114
|
+
_sortBy = null;
|
|
10332
11115
|
isSorted() {
|
|
10333
11116
|
return this._sortBy !== null;
|
|
10334
11117
|
}
|
|
@@ -10342,6 +11125,18 @@ class ODataCollection {
|
|
|
10342
11125
|
}
|
|
10343
11126
|
|
|
10344
11127
|
class ODataModel {
|
|
11128
|
+
// Properties
|
|
11129
|
+
static options;
|
|
11130
|
+
static meta;
|
|
11131
|
+
// Parent
|
|
11132
|
+
_parent = null;
|
|
11133
|
+
_resource = null;
|
|
11134
|
+
_resources = [];
|
|
11135
|
+
_attributes = new Map();
|
|
11136
|
+
_annotations;
|
|
11137
|
+
_meta;
|
|
11138
|
+
// Events
|
|
11139
|
+
events$;
|
|
10345
11140
|
static buildMetaOptions({ config, structuredType, }) {
|
|
10346
11141
|
if (config === undefined) {
|
|
10347
11142
|
const fields = structuredType
|
|
@@ -10367,11 +11162,6 @@ class ODataModel {
|
|
|
10367
11162
|
return new ODataModelOptions({ config, structuredType });
|
|
10368
11163
|
}
|
|
10369
11164
|
constructor(data = {}, { parent, resource, annots, reset = false, } = {}) {
|
|
10370
|
-
// Parent
|
|
10371
|
-
this._parent = null;
|
|
10372
|
-
this._resource = null;
|
|
10373
|
-
this._resources = [];
|
|
10374
|
-
this._attributes = new Map();
|
|
10375
11165
|
const Klass = this.constructor;
|
|
10376
11166
|
if (Klass.meta === undefined)
|
|
10377
11167
|
throw new Error(`Model: Can't create model without metadata`);
|
|
@@ -10429,7 +11219,7 @@ class ODataModel {
|
|
|
10429
11219
|
return field.resourceFactory(resource);
|
|
10430
11220
|
}
|
|
10431
11221
|
attach(resource) {
|
|
10432
|
-
|
|
11222
|
+
this._meta.attach(this, resource);
|
|
10433
11223
|
}
|
|
10434
11224
|
//#endregion
|
|
10435
11225
|
schema() {
|
|
@@ -10460,6 +11250,8 @@ class ODataModel {
|
|
|
10460
11250
|
resolve,
|
|
10461
11251
|
});
|
|
10462
11252
|
}
|
|
11253
|
+
// Validation
|
|
11254
|
+
_errors;
|
|
10463
11255
|
validate({ method, navigation = false, } = {}) {
|
|
10464
11256
|
return this._meta.validate(this, { method, navigation });
|
|
10465
11257
|
}
|
|
@@ -10658,7 +11450,7 @@ class ODataModel {
|
|
|
10658
11450
|
*/
|
|
10659
11451
|
query(ctx) {
|
|
10660
11452
|
const resource = this.resource();
|
|
10661
|
-
return
|
|
11453
|
+
return resource ? this._meta.query(this, resource, ctx) : this;
|
|
10662
11454
|
}
|
|
10663
11455
|
/**
|
|
10664
11456
|
* Perform a check on the internal state of the model and return true if the model is changed.
|
|
@@ -10730,8 +11522,6 @@ class ODataModel {
|
|
|
10730
11522
|
return this._request(action.call(params, { responseType, ...options }), (resp) => resp);
|
|
10731
11523
|
}
|
|
10732
11524
|
}
|
|
10733
|
-
//#endregion
|
|
10734
|
-
// Cast
|
|
10735
11525
|
cast(type, ModelType) {
|
|
10736
11526
|
//: ODataModel<S> {
|
|
10737
11527
|
const resource = this.resource();
|
|
@@ -10783,6 +11573,23 @@ class ODataModel {
|
|
|
10783
11573
|
});
|
|
10784
11574
|
}
|
|
10785
11575
|
}
|
|
11576
|
+
/*
|
|
11577
|
+
getAttribute<P>(
|
|
11578
|
+
name: keyof T,
|
|
11579
|
+
): (P extends (infer U)[] ? ODataCollection<U, ODataModel<U> & ModelInterface<U>> :
|
|
11580
|
+
P extends ArrayBufferLike ? ArrayBuffer :
|
|
11581
|
+
P extends Date ? Date :
|
|
11582
|
+
P extends object ? ODataModel<P> & ModelInterface<P> : P ) | null;
|
|
11583
|
+
getAttribute<M extends ODataModel<keyof T>>(
|
|
11584
|
+
name: keyof T,
|
|
11585
|
+
): M | null;
|
|
11586
|
+
getAttribute<C extends ODataCollection<keyof T, ODataModel<keyof T>>>(
|
|
11587
|
+
name: keyof T,
|
|
11588
|
+
): C | null;
|
|
11589
|
+
getAttribute<P>(
|
|
11590
|
+
name: keyof T,
|
|
11591
|
+
) {
|
|
11592
|
+
*/
|
|
10786
11593
|
getAttribute(name) {
|
|
10787
11594
|
const field = this._meta.findField(name);
|
|
10788
11595
|
if (!field)
|
|
@@ -10903,6 +11710,10 @@ var ODataModelEventType;
|
|
|
10903
11710
|
ODataModelEventType["Attach"] = "attach";
|
|
10904
11711
|
})(ODataModelEventType || (ODataModelEventType = {}));
|
|
10905
11712
|
class ODataModelEvent {
|
|
11713
|
+
type;
|
|
11714
|
+
value;
|
|
11715
|
+
previous;
|
|
11716
|
+
options;
|
|
10906
11717
|
constructor(type, { model, collection, previous, value, attr, options, bubbles, chain, } = {}) {
|
|
10907
11718
|
this.type = type;
|
|
10908
11719
|
this.model = model;
|
|
@@ -10918,6 +11729,7 @@ class ODataModelEvent {
|
|
|
10918
11729
|
];
|
|
10919
11730
|
this.bubbles = bubbles ?? BUBBLES.indexOf(this.type) !== -1;
|
|
10920
11731
|
}
|
|
11732
|
+
chain;
|
|
10921
11733
|
push(model, attr) {
|
|
10922
11734
|
return new ODataModelEvent(this.type, {
|
|
10923
11735
|
model: this.model ?? (model instanceof ODataModel ? model : undefined),
|
|
@@ -10935,6 +11747,7 @@ class ODataModelEvent {
|
|
|
10935
11747
|
chain: [[model, attr], ...this.chain],
|
|
10936
11748
|
});
|
|
10937
11749
|
}
|
|
11750
|
+
bubbles;
|
|
10938
11751
|
stopPropagation() {
|
|
10939
11752
|
this.bubbles = false;
|
|
10940
11753
|
}
|
|
@@ -10956,11 +11769,15 @@ class ODataModelEvent {
|
|
|
10956
11769
|
: '')
|
|
10957
11770
|
.join('');
|
|
10958
11771
|
}
|
|
11772
|
+
//Reference to the model which the event was dispatched
|
|
11773
|
+
model;
|
|
10959
11774
|
//Identifies the current model for the event
|
|
10960
11775
|
get currentModel() {
|
|
10961
11776
|
const link = this.chain.find((c) => ODataModelOptions.isModel(c[0]));
|
|
10962
11777
|
return link !== undefined ? link[0] : undefined;
|
|
10963
11778
|
}
|
|
11779
|
+
//Reference to the collection which the event was dispatched
|
|
11780
|
+
collection;
|
|
10964
11781
|
//Identifies the current collection for the event
|
|
10965
11782
|
get currentCollection() {
|
|
10966
11783
|
const link = this.chain.find((c) => ODataModelOptions.isCollection(c[0]));
|
|
@@ -10970,6 +11787,8 @@ class ODataModelEvent {
|
|
|
10970
11787
|
}
|
|
10971
11788
|
}
|
|
10972
11789
|
class ODataModelEventEmitter extends EventEmitter {
|
|
11790
|
+
model;
|
|
11791
|
+
collection;
|
|
10973
11792
|
constructor({ model, collection, } = {}) {
|
|
10974
11793
|
super();
|
|
10975
11794
|
this.model = model;
|
|
@@ -11018,7 +11837,8 @@ var ODataModelState;
|
|
|
11018
11837
|
(function (ODataModelState) {
|
|
11019
11838
|
ODataModelState[ODataModelState["Added"] = 0] = "Added";
|
|
11020
11839
|
ODataModelState[ODataModelState["Removed"] = 1] = "Removed";
|
|
11021
|
-
ODataModelState[ODataModelState["
|
|
11840
|
+
ODataModelState[ODataModelState["Changed"] = 2] = "Changed";
|
|
11841
|
+
ODataModelState[ODataModelState["Unchanged"] = 3] = "Unchanged";
|
|
11022
11842
|
})(ODataModelState || (ODataModelState = {}));
|
|
11023
11843
|
function Model({ cid = CID_FIELD_NAME } = {}) {
|
|
11024
11844
|
return (constructor) => {
|
|
@@ -11043,6 +11863,24 @@ function ModelField({ name, ...options } = {}) {
|
|
|
11043
11863
|
};
|
|
11044
11864
|
}
|
|
11045
11865
|
class ODataModelField {
|
|
11866
|
+
name;
|
|
11867
|
+
field;
|
|
11868
|
+
parser;
|
|
11869
|
+
options;
|
|
11870
|
+
optionsForType;
|
|
11871
|
+
modelForType;
|
|
11872
|
+
collectionForType;
|
|
11873
|
+
enumForType;
|
|
11874
|
+
structuredForType;
|
|
11875
|
+
default;
|
|
11876
|
+
required;
|
|
11877
|
+
concurrency;
|
|
11878
|
+
maxLength;
|
|
11879
|
+
minLength;
|
|
11880
|
+
min;
|
|
11881
|
+
max;
|
|
11882
|
+
pattern;
|
|
11883
|
+
parserOptions;
|
|
11046
11884
|
constructor(options, { name, field, parser, ...opts }) {
|
|
11047
11885
|
this.options = options;
|
|
11048
11886
|
this.name = name;
|
|
@@ -11231,10 +12069,16 @@ class ODataModelField {
|
|
|
11231
12069
|
}
|
|
11232
12070
|
}
|
|
11233
12071
|
class ODataModelAttribute {
|
|
12072
|
+
_model;
|
|
12073
|
+
_field;
|
|
12074
|
+
state = ODataModelState.Unchanged;
|
|
12075
|
+
value;
|
|
12076
|
+
change;
|
|
12077
|
+
subscription;
|
|
12078
|
+
events$ = new ODataModelEventEmitter();
|
|
11234
12079
|
constructor(_model, _field) {
|
|
11235
12080
|
this._model = _model;
|
|
11236
12081
|
this._field = _field;
|
|
11237
|
-
this.events$ = new ODataModelEventEmitter();
|
|
11238
12082
|
}
|
|
11239
12083
|
get type() {
|
|
11240
12084
|
return this._field.type;
|
|
@@ -11261,7 +12105,7 @@ class ODataModelAttribute {
|
|
|
11261
12105
|
return this._field.field;
|
|
11262
12106
|
}
|
|
11263
12107
|
get() {
|
|
11264
|
-
return this.
|
|
12108
|
+
return this.state === ODataModelState.Changed ? this.change : this.value;
|
|
11265
12109
|
}
|
|
11266
12110
|
set(value, reset = false, reparent = false) {
|
|
11267
12111
|
const current = this.get();
|
|
@@ -11276,13 +12120,14 @@ class ODataModelAttribute {
|
|
|
11276
12120
|
: !Types.isEqual(current, value);
|
|
11277
12121
|
if (reset) {
|
|
11278
12122
|
this.value = value;
|
|
11279
|
-
this.
|
|
12123
|
+
this.state = ODataModelState.Unchanged;
|
|
11280
12124
|
}
|
|
11281
12125
|
else if (Types.isEqual(value, this.value)) {
|
|
11282
|
-
this.
|
|
12126
|
+
this.state = ODataModelState.Unchanged;
|
|
11283
12127
|
}
|
|
11284
12128
|
else if (changed) {
|
|
11285
12129
|
this.change = value;
|
|
12130
|
+
this.state = ODataModelState.Changed;
|
|
11286
12131
|
}
|
|
11287
12132
|
if (ODataModelOptions.isModel(value) ||
|
|
11288
12133
|
ODataModelOptions.isCollection(value)) {
|
|
@@ -11292,7 +12137,7 @@ class ODataModelAttribute {
|
|
|
11292
12137
|
}
|
|
11293
12138
|
isChanged({ include_navigation = false, } = {}) {
|
|
11294
12139
|
const current = this.get();
|
|
11295
|
-
return (this.
|
|
12140
|
+
return (this.state === ODataModelState.Changed ||
|
|
11296
12141
|
((ODataModelOptions.isModel(current) ||
|
|
11297
12142
|
ODataModelOptions.isCollection(current)) &&
|
|
11298
12143
|
current.hasChanged({ include_navigation })));
|
|
@@ -11301,7 +12146,7 @@ class ODataModelAttribute {
|
|
|
11301
12146
|
if (ODataModelOptions.isModel(this.change) ||
|
|
11302
12147
|
ODataModelOptions.isCollection(this.change))
|
|
11303
12148
|
this.unlink(this.change);
|
|
11304
|
-
this.
|
|
12149
|
+
this.state = ODataModelState.Unchanged;
|
|
11305
12150
|
if (ODataModelOptions.isModel(this.value) ||
|
|
11306
12151
|
ODataModelOptions.isCollection(this.value))
|
|
11307
12152
|
this.link(this.value);
|
|
@@ -11321,16 +12166,17 @@ class ODataModelAttribute {
|
|
|
11321
12166
|
}
|
|
11322
12167
|
}
|
|
11323
12168
|
class ODataModelOptions {
|
|
12169
|
+
name;
|
|
12170
|
+
cid;
|
|
12171
|
+
base;
|
|
12172
|
+
_fields = [];
|
|
12173
|
+
structuredType;
|
|
12174
|
+
entitySet;
|
|
12175
|
+
// Hierarchy
|
|
12176
|
+
parent;
|
|
12177
|
+
children = [];
|
|
12178
|
+
events$ = new ODataModelEventEmitter();
|
|
11324
12179
|
constructor({ config, structuredType, }) {
|
|
11325
|
-
this._fields = [];
|
|
11326
|
-
this.children = [];
|
|
11327
|
-
this.events$ = new ODataModelEventEmitter();
|
|
11328
|
-
this.tsToEdm = {
|
|
11329
|
-
string: EdmType.String,
|
|
11330
|
-
number: EdmType.Int32,
|
|
11331
|
-
bigint: EdmType.Int64,
|
|
11332
|
-
boolean: EdmType.Boolean,
|
|
11333
|
-
};
|
|
11334
12180
|
this.name = structuredType.name;
|
|
11335
12181
|
this.base = structuredType.base;
|
|
11336
12182
|
this.structuredType = structuredType;
|
|
@@ -11441,6 +12287,12 @@ class ODataModelOptions {
|
|
|
11441
12287
|
this._fields.push(modelField);
|
|
11442
12288
|
return modelField;
|
|
11443
12289
|
}
|
|
12290
|
+
tsToEdm = {
|
|
12291
|
+
string: EdmType.String,
|
|
12292
|
+
number: EdmType.Int32,
|
|
12293
|
+
bigint: EdmType.Int64,
|
|
12294
|
+
boolean: EdmType.Boolean,
|
|
12295
|
+
};
|
|
11444
12296
|
modelFieldFactory(self, name, type) {
|
|
11445
12297
|
const structuredFieldParser = this.structuredType.addField(name, {
|
|
11446
12298
|
type,
|
|
@@ -11694,8 +12546,7 @@ class ODataModelOptions {
|
|
|
11694
12546
|
hasChanged(self, { include_navigation = false } = {}) {
|
|
11695
12547
|
return [...self._attributes.values()]
|
|
11696
12548
|
.filter((attr) => !attr.navigation || include_navigation)
|
|
11697
|
-
.some((attr) => (
|
|
11698
|
-
attr.isChanged({ include_navigation }));
|
|
12549
|
+
.some((attr) => attr.isChanged({ include_navigation }));
|
|
11699
12550
|
}
|
|
11700
12551
|
hasKey(self) {
|
|
11701
12552
|
return this.resolveKey(self) !== undefined;
|
|
@@ -11908,7 +12759,9 @@ class ODataModelOptions {
|
|
|
11908
12759
|
if ((attr.navigation && value === null) ||
|
|
11909
12760
|
ODataModelOptions.isModel(value)) {
|
|
11910
12761
|
// Check for reference
|
|
11911
|
-
const referenced = this.resolveReferenced(self, attr
|
|
12762
|
+
const referenced = this.resolveReferenced(self, attr, {
|
|
12763
|
+
resolve: false,
|
|
12764
|
+
});
|
|
11912
12765
|
if (value !== null && referenced !== null && referenced !== undefined) {
|
|
11913
12766
|
value.assign(referenced, {
|
|
11914
12767
|
silent: true,
|
|
@@ -12018,7 +12871,9 @@ class ODataModelOptions {
|
|
|
12018
12871
|
// Resolve referentials
|
|
12019
12872
|
if (!ODataModelOptions.isCollection(attr.get())) {
|
|
12020
12873
|
const meta = this.api.optionsForType(modelField.type);
|
|
12021
|
-
const ref = meta?.resolveReferential(attr.get(), attr
|
|
12874
|
+
const ref = meta?.resolveReferential(attr.get(), attr, {
|
|
12875
|
+
resolve: false,
|
|
12876
|
+
});
|
|
12022
12877
|
if (ref !== null && ref !== undefined) {
|
|
12023
12878
|
Object.assign(self, ref);
|
|
12024
12879
|
}
|
|
@@ -12057,8 +12912,63 @@ class ODataModelOptions {
|
|
|
12057
12912
|
}
|
|
12058
12913
|
|
|
12059
12914
|
class ODataApiOptions {
|
|
12915
|
+
/**
|
|
12916
|
+
* Default OData version
|
|
12917
|
+
*/
|
|
12918
|
+
version;
|
|
12919
|
+
/**
|
|
12920
|
+
* Send enum as string in the request
|
|
12921
|
+
*/
|
|
12922
|
+
stringAsEnum;
|
|
12923
|
+
/**
|
|
12924
|
+
* Delete reference by path or by id
|
|
12925
|
+
*/
|
|
12926
|
+
deleteRefBy;
|
|
12927
|
+
/**
|
|
12928
|
+
* No use parenthesis for empty parameters functions
|
|
12929
|
+
*/
|
|
12930
|
+
nonParenthesisForEmptyParameterFunction;
|
|
12931
|
+
/**
|
|
12932
|
+
* Strip metadata from the response
|
|
12933
|
+
*/
|
|
12934
|
+
stripMetadata;
|
|
12935
|
+
/**
|
|
12936
|
+
* Use JSON Batch Format
|
|
12937
|
+
*/
|
|
12938
|
+
jsonBatchFormat;
|
|
12939
|
+
/**
|
|
12940
|
+
* Relative urls
|
|
12941
|
+
* http://docs.oasis-open.org/odata/odata-json-format/v4.0/cs01/odata-json-format-v4.0-cs01.html#_Toc365464682
|
|
12942
|
+
*/
|
|
12943
|
+
relativeUrls;
|
|
12944
|
+
/**
|
|
12945
|
+
* Cache fetch policy
|
|
12946
|
+
*/
|
|
12947
|
+
fetchPolicy;
|
|
12948
|
+
/**
|
|
12949
|
+
* Extra params to be sent in the request
|
|
12950
|
+
*/
|
|
12951
|
+
params;
|
|
12952
|
+
/**
|
|
12953
|
+
* Extra headers to be sent in the request
|
|
12954
|
+
*/
|
|
12955
|
+
headers;
|
|
12956
|
+
/**
|
|
12957
|
+
* Http request with credentials
|
|
12958
|
+
*/
|
|
12959
|
+
withCredentials;
|
|
12960
|
+
/**
|
|
12961
|
+
* Send query options in the request body
|
|
12962
|
+
*/
|
|
12963
|
+
bodyQueryOptions;
|
|
12964
|
+
/**
|
|
12965
|
+
* Customize accept header with OData options
|
|
12966
|
+
* @link http://docs.oasis-open.org/odata/odata-json-format/v4.01/odata-json-format-v4.01.html#sec_RequestingtheJSONFormat
|
|
12967
|
+
*/
|
|
12968
|
+
accept;
|
|
12969
|
+
etag = { ifMatch: true, ifNoneMatch: false };
|
|
12970
|
+
prefer;
|
|
12060
12971
|
constructor(config) {
|
|
12061
|
-
this.etag = { ifMatch: true, ifNoneMatch: false };
|
|
12062
12972
|
this.version = config.version || DEFAULT_VERSION;
|
|
12063
12973
|
this.stringAsEnum = config.stringAsEnum || false;
|
|
12064
12974
|
this.params = config.params || {};
|
|
@@ -12094,32 +13004,41 @@ class ODataApiOptions {
|
|
|
12094
13004
|
* Api abstraction for consuming OData services.
|
|
12095
13005
|
*/
|
|
12096
13006
|
class ODataApi {
|
|
13007
|
+
requester;
|
|
13008
|
+
serviceRootUrl;
|
|
13009
|
+
metadataUrl;
|
|
13010
|
+
name;
|
|
13011
|
+
version;
|
|
13012
|
+
default;
|
|
13013
|
+
creation;
|
|
13014
|
+
// Options
|
|
13015
|
+
options;
|
|
13016
|
+
// Cache
|
|
13017
|
+
cache;
|
|
13018
|
+
// Error Handler
|
|
13019
|
+
errorHandler;
|
|
13020
|
+
// Base Parsers
|
|
13021
|
+
parsers;
|
|
13022
|
+
// Schemas
|
|
13023
|
+
schemas;
|
|
12097
13024
|
constructor(config) {
|
|
12098
|
-
//# region Find by Type
|
|
12099
|
-
// Memoize
|
|
12100
|
-
this.memo = {
|
|
12101
|
-
enumTypes: new Map(),
|
|
12102
|
-
structuredTypes: new Map(),
|
|
12103
|
-
callables: new Map(),
|
|
12104
|
-
entitySets: new Map(),
|
|
12105
|
-
singletons: new Map(),
|
|
12106
|
-
parsers: new Map(),
|
|
12107
|
-
options: new Map(),
|
|
12108
|
-
};
|
|
12109
13025
|
this.serviceRootUrl = config.serviceRootUrl;
|
|
12110
|
-
if (this.serviceRootUrl.
|
|
13026
|
+
if (this.serviceRootUrl.includes('?'))
|
|
12111
13027
|
throw new Error("The 'serviceRootUrl' should not contain query string. Please use 'params' to add extra parameters");
|
|
12112
13028
|
if (!this.serviceRootUrl.endsWith('/'))
|
|
12113
13029
|
this.serviceRootUrl += '/';
|
|
12114
|
-
this.metadataUrl = `${this.serviceRootUrl}$metadata`;
|
|
13030
|
+
this.metadataUrl = config.metadataUrl ?? `${this.serviceRootUrl}$metadata`;
|
|
12115
13031
|
this.name = config.name;
|
|
12116
13032
|
this.version = config.version ?? DEFAULT_VERSION;
|
|
12117
13033
|
this.default = config.default ?? false;
|
|
12118
13034
|
this.creation = config.creation ?? new Date();
|
|
12119
|
-
this.options = new ODataApiOptions(
|
|
12120
|
-
|
|
13035
|
+
this.options = new ODataApiOptions({
|
|
13036
|
+
...config.options,
|
|
13037
|
+
version: this.version,
|
|
13038
|
+
});
|
|
13039
|
+
this.cache = config.cache;
|
|
12121
13040
|
this.errorHandler = config.errorHandler;
|
|
12122
|
-
this.parsers = new Map(Object.entries(config.parsers
|
|
13041
|
+
this.parsers = new Map(Object.entries(config.parsers ?? EDM_PARSERS));
|
|
12123
13042
|
this.schemas = (config.schemas ?? []).map((schema) => new ODataSchema(schema, this));
|
|
12124
13043
|
}
|
|
12125
13044
|
configure(settings = {}) {
|
|
@@ -12262,7 +13181,9 @@ class ODataApi {
|
|
|
12262
13181
|
if (options.observe === 'events') {
|
|
12263
13182
|
return res$;
|
|
12264
13183
|
}
|
|
12265
|
-
|
|
13184
|
+
if (this.cache !== undefined) {
|
|
13185
|
+
res$ = this.cache.handleRequest(req, res$);
|
|
13186
|
+
}
|
|
12266
13187
|
switch (options.observe || 'body') {
|
|
12267
13188
|
case 'body':
|
|
12268
13189
|
switch (options.responseType) {
|
|
@@ -12286,6 +13207,17 @@ class ODataApi {
|
|
|
12286
13207
|
throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);
|
|
12287
13208
|
}
|
|
12288
13209
|
}
|
|
13210
|
+
//# region Find by Type
|
|
13211
|
+
// Memoize
|
|
13212
|
+
memo = {
|
|
13213
|
+
enumTypes: new Map(),
|
|
13214
|
+
structuredTypes: new Map(),
|
|
13215
|
+
callables: new Map(),
|
|
13216
|
+
entitySets: new Map(),
|
|
13217
|
+
singletons: new Map(),
|
|
13218
|
+
parsers: new Map(),
|
|
13219
|
+
options: new Map(),
|
|
13220
|
+
};
|
|
12289
13221
|
createSchema(config) {
|
|
12290
13222
|
const schema = new ODataSchema(config, this);
|
|
12291
13223
|
schema.configure({
|
|
@@ -12433,7 +13365,7 @@ class ODataApi {
|
|
|
12433
13365
|
if (model === undefined)
|
|
12434
13366
|
model = this.createModel(structured);
|
|
12435
13367
|
const Collection = class extends ODataCollection {
|
|
12436
|
-
static
|
|
13368
|
+
static model = model;
|
|
12437
13369
|
};
|
|
12438
13370
|
structured.collection = Collection;
|
|
12439
13371
|
return Collection;
|
|
@@ -12500,6 +13432,7 @@ class ODataApi {
|
|
|
12500
13432
|
}
|
|
12501
13433
|
|
|
12502
13434
|
class ODataSettings {
|
|
13435
|
+
apis;
|
|
12503
13436
|
constructor(configs) {
|
|
12504
13437
|
this.apis = configs.map((config) => new ODataApi(config));
|
|
12505
13438
|
if (this.apis.length > 1) {
|
|
@@ -12613,6 +13546,7 @@ class ODataSettings {
|
|
|
12613
13546
|
class ODataConfigLoader {
|
|
12614
13547
|
}
|
|
12615
13548
|
class ODataConfigSyncLoader {
|
|
13549
|
+
passedConfigs;
|
|
12616
13550
|
constructor(passedConfigs) {
|
|
12617
13551
|
this.passedConfigs = passedConfigs;
|
|
12618
13552
|
}
|
|
@@ -12623,6 +13557,7 @@ class ODataConfigSyncLoader {
|
|
|
12623
13557
|
}
|
|
12624
13558
|
}
|
|
12625
13559
|
class ODataConfigAsyncLoader {
|
|
13560
|
+
configs$;
|
|
12626
13561
|
constructor(configs$) {
|
|
12627
13562
|
this.configs$ = configs$;
|
|
12628
13563
|
}
|
|
@@ -12635,6 +13570,8 @@ class ODataConfigAsyncLoader {
|
|
|
12635
13570
|
}
|
|
12636
13571
|
}
|
|
12637
13572
|
class ODataMetadataLoader {
|
|
13573
|
+
sources$;
|
|
13574
|
+
baseConfigs;
|
|
12638
13575
|
constructor(sources$, baseConfigs) {
|
|
12639
13576
|
this.sources$ = sources$;
|
|
12640
13577
|
this.baseConfigs = baseConfigs;
|
|
@@ -12661,6 +13598,9 @@ function addBody(options, body) {
|
|
|
12661
13598
|
};
|
|
12662
13599
|
}
|
|
12663
13600
|
class ODataClient {
|
|
13601
|
+
http;
|
|
13602
|
+
loader;
|
|
13603
|
+
settings;
|
|
12664
13604
|
constructor(http, loader) {
|
|
12665
13605
|
this.http = http;
|
|
12666
13606
|
this.loader = loader;
|
|
@@ -12845,14 +13785,17 @@ class ODataClient {
|
|
|
12845
13785
|
put(resource, body, options = {}) {
|
|
12846
13786
|
return this.request('PUT', resource, addBody(options, body));
|
|
12847
13787
|
}
|
|
12848
|
-
static
|
|
12849
|
-
static
|
|
13788
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataClient, deps: [{ token: i1.HttpClient }, { token: ODataConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
13789
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataClient });
|
|
12850
13790
|
}
|
|
12851
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
13791
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataClient, decorators: [{
|
|
12852
13792
|
type: Injectable
|
|
12853
13793
|
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: ODataConfigLoader }] });
|
|
12854
13794
|
|
|
12855
13795
|
class ODataBaseService {
|
|
13796
|
+
client;
|
|
13797
|
+
name;
|
|
13798
|
+
apiNameOrEntityType;
|
|
12856
13799
|
constructor(client, name, apiNameOrEntityType) {
|
|
12857
13800
|
this.client = client;
|
|
12858
13801
|
this.name = name;
|
|
@@ -12893,15 +13836,21 @@ class ODataEntityService extends ODataBaseService {
|
|
|
12893
13836
|
}
|
|
12894
13837
|
|
|
12895
13838
|
class ODataEntitySetService extends ODataEntityService {
|
|
12896
|
-
|
|
13839
|
+
static Model;
|
|
13840
|
+
static Collection;
|
|
13841
|
+
model(entity, reset) {
|
|
12897
13842
|
const Service = this.constructor;
|
|
12898
|
-
return this.entity().asModel(entity, {
|
|
13843
|
+
return this.entity().asModel((entity ?? {}), {
|
|
13844
|
+
reset,
|
|
12899
13845
|
ModelType: Service.Model,
|
|
12900
13846
|
});
|
|
12901
13847
|
}
|
|
12902
|
-
collection(entities) {
|
|
13848
|
+
collection(entities, reset) {
|
|
12903
13849
|
const Service = this.constructor;
|
|
12904
|
-
return this.entities().asCollection(entities, {
|
|
13850
|
+
return this.entities().asCollection((entities ?? []), {
|
|
13851
|
+
reset,
|
|
13852
|
+
CollectionType: Service.Collection,
|
|
13853
|
+
});
|
|
12905
13854
|
}
|
|
12906
13855
|
/**
|
|
12907
13856
|
* Get the entity set resource for this service.
|
|
@@ -13047,9 +13996,10 @@ class ODataEntitySetService extends ODataEntityService {
|
|
|
13047
13996
|
* www.odata.org/getting-started/advanced-tutorial/#singleton
|
|
13048
13997
|
*/
|
|
13049
13998
|
class ODataSingletonService extends ODataEntityService {
|
|
13999
|
+
static Model;
|
|
13050
14000
|
model(entity) {
|
|
13051
14001
|
const Service = this.constructor;
|
|
13052
|
-
return this.entity().asModel(entity, {
|
|
14002
|
+
return this.entity().asModel((entity ?? {}), {
|
|
13053
14003
|
ModelType: Service.Model,
|
|
13054
14004
|
});
|
|
13055
14005
|
}
|
|
@@ -13096,6 +14046,7 @@ class ODataSingletonService extends ODataEntityService {
|
|
|
13096
14046
|
}
|
|
13097
14047
|
|
|
13098
14048
|
class ODataServiceFactory {
|
|
14049
|
+
client;
|
|
13099
14050
|
constructor(client) {
|
|
13100
14051
|
this.client = client;
|
|
13101
14052
|
}
|
|
@@ -13106,11 +14057,8 @@ class ODataServiceFactory {
|
|
|
13106
14057
|
*/
|
|
13107
14058
|
entitySet(entitySetName, apiNameOrEntityType, options = {}) {
|
|
13108
14059
|
const Service = class extends ODataEntitySetService {
|
|
13109
|
-
|
|
13110
|
-
|
|
13111
|
-
this.Model = options?.Model;
|
|
13112
|
-
this.Collection = options?.Collection;
|
|
13113
|
-
}
|
|
14060
|
+
Model = options?.Model;
|
|
14061
|
+
Collection = options?.Collection;
|
|
13114
14062
|
};
|
|
13115
14063
|
return new Service(this.client, entitySetName, apiNameOrEntityType);
|
|
13116
14064
|
}
|
|
@@ -13120,17 +14068,14 @@ class ODataServiceFactory {
|
|
|
13120
14068
|
*/
|
|
13121
14069
|
singleton(singletonName, apiNameOrEntityType, options = {}) {
|
|
13122
14070
|
const Service = class extends ODataSingletonService {
|
|
13123
|
-
|
|
13124
|
-
super(...arguments);
|
|
13125
|
-
this.Model = options?.Model;
|
|
13126
|
-
}
|
|
14071
|
+
Model = options?.Model;
|
|
13127
14072
|
};
|
|
13128
14073
|
return new Service(this.client, singletonName, apiNameOrEntityType);
|
|
13129
14074
|
}
|
|
13130
|
-
static
|
|
13131
|
-
static
|
|
14075
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataServiceFactory, deps: [{ token: ODataClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
14076
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataServiceFactory });
|
|
13132
14077
|
}
|
|
13133
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
14078
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataServiceFactory, decorators: [{
|
|
13134
14079
|
type: Injectable
|
|
13135
14080
|
}], ctorParameters: () => [{ type: ODataClient }] });
|
|
13136
14081
|
|
|
@@ -13170,11 +14115,11 @@ class ODataModule {
|
|
|
13170
14115
|
],
|
|
13171
14116
|
};
|
|
13172
14117
|
}
|
|
13173
|
-
static
|
|
13174
|
-
static
|
|
13175
|
-
static
|
|
14118
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
14119
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.12", ngImport: i0, type: ODataModule, imports: [CommonModule, HttpClientModule] });
|
|
14120
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataModule, providers: [ODataClient, ODataServiceFactory], imports: [CommonModule, HttpClientModule] });
|
|
13176
14121
|
}
|
|
13177
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
14122
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataModule, decorators: [{
|
|
13178
14123
|
type: NgModule,
|
|
13179
14124
|
args: [{
|
|
13180
14125
|
imports: [CommonModule, HttpClientModule],
|
|
@@ -13182,6 +14127,263 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImpor
|
|
|
13182
14127
|
}]
|
|
13183
14128
|
}] });
|
|
13184
14129
|
|
|
14130
|
+
class ODataBaseCache {
|
|
14131
|
+
timeout;
|
|
14132
|
+
entries;
|
|
14133
|
+
constructor({ timeout = DEFAULT_TIMEOUT }) {
|
|
14134
|
+
this.timeout = timeout;
|
|
14135
|
+
this.entries = new Map();
|
|
14136
|
+
}
|
|
14137
|
+
/**
|
|
14138
|
+
* Using the resource on the request build an array of string to identify the scope of the request
|
|
14139
|
+
* @param req The request with the resource to build the scope
|
|
14140
|
+
* @returns Array of string to identify the scope of the request
|
|
14141
|
+
*/
|
|
14142
|
+
scope(req) {
|
|
14143
|
+
const segments = req.resource.cloneSegments();
|
|
14144
|
+
return segments.segments({ key: true }).reduce((acc, s) => {
|
|
14145
|
+
if (s.name === PathSegment.entitySet)
|
|
14146
|
+
acc = [...acc, s.path()];
|
|
14147
|
+
return acc;
|
|
14148
|
+
}, ['request']);
|
|
14149
|
+
}
|
|
14150
|
+
/**
|
|
14151
|
+
* Using the odata context on the response build an array of string to identify the tags of the response
|
|
14152
|
+
* @param res The response to build the tags
|
|
14153
|
+
* @returns Array of string to identify the tags of the response
|
|
14154
|
+
*/
|
|
14155
|
+
tags(res) {
|
|
14156
|
+
const tags = [];
|
|
14157
|
+
const context = res.context;
|
|
14158
|
+
if (context.entitySet) {
|
|
14159
|
+
tags.push(context.key
|
|
14160
|
+
? `${context.entitySet}(${context.key})`
|
|
14161
|
+
: context.entitySet);
|
|
14162
|
+
}
|
|
14163
|
+
if (context.type)
|
|
14164
|
+
tags.push(context.type);
|
|
14165
|
+
return tags;
|
|
14166
|
+
}
|
|
14167
|
+
/**
|
|
14168
|
+
* Build an entry from a payload and some options
|
|
14169
|
+
* @param payload The payload to store in the cache
|
|
14170
|
+
* @param timeout The timeout for the entry
|
|
14171
|
+
* @param tags The tags for the entry
|
|
14172
|
+
* @returns The entry to store in the cache
|
|
14173
|
+
*/
|
|
14174
|
+
buildEntry(payload, { timeout, tags }) {
|
|
14175
|
+
return {
|
|
14176
|
+
payload,
|
|
14177
|
+
lastRead: Date.now(),
|
|
14178
|
+
timeout: timeout || this.timeout,
|
|
14179
|
+
tags: tags || [],
|
|
14180
|
+
};
|
|
14181
|
+
}
|
|
14182
|
+
/**
|
|
14183
|
+
* Build a key from store an entry in the cache
|
|
14184
|
+
* @param names The names of the entry
|
|
14185
|
+
* @returns The key for the entry
|
|
14186
|
+
*/
|
|
14187
|
+
buildKey(names) {
|
|
14188
|
+
return names.join(CACHE_KEY_SEPARATOR);
|
|
14189
|
+
}
|
|
14190
|
+
/**
|
|
14191
|
+
* Put some payload in the cache
|
|
14192
|
+
* @param name The name for the entry
|
|
14193
|
+
* @param payload The payload to store in the cache
|
|
14194
|
+
* @param timeout The timeout for the entry
|
|
14195
|
+
* @param scope The scope for the entry
|
|
14196
|
+
* @param tags The tags for the entry
|
|
14197
|
+
*/
|
|
14198
|
+
put(name, payload, { timeout, scope, tags, } = {}) {
|
|
14199
|
+
const entry = this.buildEntry(payload, { timeout, tags });
|
|
14200
|
+
const key = this.buildKey([...(scope || []), name]);
|
|
14201
|
+
this.entries.set(key, entry);
|
|
14202
|
+
this.forget();
|
|
14203
|
+
}
|
|
14204
|
+
/**
|
|
14205
|
+
* Return the payload from the cache if it exists and is not expired
|
|
14206
|
+
* @param name The name of the entry
|
|
14207
|
+
* @param scope The scope of the entry
|
|
14208
|
+
* @returns The payload of the entry
|
|
14209
|
+
*/
|
|
14210
|
+
get(name, { scope } = {}) {
|
|
14211
|
+
const key = this.buildKey([...(scope || []), name]);
|
|
14212
|
+
const entry = this.entries.get(key);
|
|
14213
|
+
return entry !== undefined && !this.isExpired(entry)
|
|
14214
|
+
? entry.payload
|
|
14215
|
+
: undefined;
|
|
14216
|
+
}
|
|
14217
|
+
/**
|
|
14218
|
+
* Remove all cache entries that are matching with the given options
|
|
14219
|
+
* @param options The options to forget
|
|
14220
|
+
*/
|
|
14221
|
+
forget({ name, scope = [], tags = [], } = {}) {
|
|
14222
|
+
if (name !== undefined)
|
|
14223
|
+
scope.push(name);
|
|
14224
|
+
const key = scope.length > 0 ? this.buildKey(scope) : undefined;
|
|
14225
|
+
this.entries.forEach((entry, k) => {
|
|
14226
|
+
if (this.isExpired(entry) || // Expired
|
|
14227
|
+
(key !== undefined && k.startsWith(key)) || // Key
|
|
14228
|
+
(tags.length > 0 && tags.some((t) => entry.tags.indexOf(t) !== -1)) // Tags
|
|
14229
|
+
) {
|
|
14230
|
+
this.entries.delete(k);
|
|
14231
|
+
}
|
|
14232
|
+
});
|
|
14233
|
+
}
|
|
14234
|
+
/**
|
|
14235
|
+
* Remove all cache entries
|
|
14236
|
+
*/
|
|
14237
|
+
flush() {
|
|
14238
|
+
this.entries = new Map();
|
|
14239
|
+
}
|
|
14240
|
+
/**
|
|
14241
|
+
* Check if the entry is expired
|
|
14242
|
+
* @param entry The cache entry
|
|
14243
|
+
* @returns Boolean indicating if the entry is expired
|
|
14244
|
+
*/
|
|
14245
|
+
isExpired(entry) {
|
|
14246
|
+
return entry.lastRead < Date.now() - (entry.timeout || this.timeout) * 1000;
|
|
14247
|
+
}
|
|
14248
|
+
/**
|
|
14249
|
+
* Using the request, handle the fetching of the response
|
|
14250
|
+
* @param req The request to fetch
|
|
14251
|
+
* @param res$ Observable of the response
|
|
14252
|
+
* @returns
|
|
14253
|
+
*/
|
|
14254
|
+
handleRequest(req, res$) {
|
|
14255
|
+
return req.isFetch()
|
|
14256
|
+
? this.handleFetch(req, res$)
|
|
14257
|
+
: req.isMutate()
|
|
14258
|
+
? this.handleMutate(req, res$)
|
|
14259
|
+
: res$;
|
|
14260
|
+
}
|
|
14261
|
+
handleFetch(req, res$) {
|
|
14262
|
+
const policy = req.fetchPolicy;
|
|
14263
|
+
const cached = this.getResponse(req);
|
|
14264
|
+
if (policy === 'no-cache') {
|
|
14265
|
+
return res$;
|
|
14266
|
+
}
|
|
14267
|
+
if (policy === 'cache-only') {
|
|
14268
|
+
if (cached) {
|
|
14269
|
+
return of(cached);
|
|
14270
|
+
}
|
|
14271
|
+
else {
|
|
14272
|
+
return throwError(() => new Error('No Cached'));
|
|
14273
|
+
}
|
|
14274
|
+
}
|
|
14275
|
+
if (policy === 'cache-first' ||
|
|
14276
|
+
policy === 'cache-and-network' ||
|
|
14277
|
+
policy === 'network-only') {
|
|
14278
|
+
res$ = res$.pipe(tap((res) => {
|
|
14279
|
+
if (res.options.cacheability !== 'no-store')
|
|
14280
|
+
this.putResponse(req, res);
|
|
14281
|
+
}));
|
|
14282
|
+
}
|
|
14283
|
+
return cached !== undefined && policy !== 'network-only'
|
|
14284
|
+
? policy === 'cache-and-network'
|
|
14285
|
+
? res$.pipe(startWith(cached))
|
|
14286
|
+
: of(cached)
|
|
14287
|
+
: res$;
|
|
14288
|
+
}
|
|
14289
|
+
handleMutate(req, res$) {
|
|
14290
|
+
const requests = req.isBatch()
|
|
14291
|
+
? req.resource
|
|
14292
|
+
.requests()
|
|
14293
|
+
.filter((r) => r.isMutate())
|
|
14294
|
+
: [req];
|
|
14295
|
+
for (var r of requests) {
|
|
14296
|
+
const scope = this.scope(r);
|
|
14297
|
+
this.forget({ scope });
|
|
14298
|
+
}
|
|
14299
|
+
return res$;
|
|
14300
|
+
}
|
|
14301
|
+
}
|
|
14302
|
+
|
|
14303
|
+
class ODataInMemoryCache extends ODataBaseCache {
|
|
14304
|
+
constructor({ timeout } = {}) {
|
|
14305
|
+
super({ timeout });
|
|
14306
|
+
}
|
|
14307
|
+
/**
|
|
14308
|
+
* Store the response in the cache
|
|
14309
|
+
* @param req The request with the resource to store the response
|
|
14310
|
+
* @param res The response to store in the cache
|
|
14311
|
+
*/
|
|
14312
|
+
putResponse(req, res) {
|
|
14313
|
+
let scope = this.scope(req);
|
|
14314
|
+
let tags = this.tags(res);
|
|
14315
|
+
this.put(req.cacheKey, res, {
|
|
14316
|
+
timeout: res.options.maxAge,
|
|
14317
|
+
scope,
|
|
14318
|
+
tags,
|
|
14319
|
+
});
|
|
14320
|
+
}
|
|
14321
|
+
/**
|
|
14322
|
+
* Restore the response from the cache
|
|
14323
|
+
* @param req The request with the resource to get the response
|
|
14324
|
+
* @returns The response from the cache
|
|
14325
|
+
*/
|
|
14326
|
+
getResponse(req) {
|
|
14327
|
+
let scope = this.scope(req);
|
|
14328
|
+
return this.get(req.cacheKey, { scope });
|
|
14329
|
+
}
|
|
14330
|
+
}
|
|
14331
|
+
|
|
14332
|
+
class ODataInStorageCache extends ODataBaseCache {
|
|
14333
|
+
name;
|
|
14334
|
+
storage;
|
|
14335
|
+
constructor({ name, storage = sessionStorage, timeout, }) {
|
|
14336
|
+
super({ timeout });
|
|
14337
|
+
this.name = name;
|
|
14338
|
+
this.storage = storage;
|
|
14339
|
+
this.restore();
|
|
14340
|
+
window.addEventListener('beforeunload', () => this.store());
|
|
14341
|
+
}
|
|
14342
|
+
/**
|
|
14343
|
+
* Store the cache in the storage
|
|
14344
|
+
*/
|
|
14345
|
+
store() {
|
|
14346
|
+
this.storage.setItem(this.name, JSON.stringify(Array.from(this.entries.entries())));
|
|
14347
|
+
}
|
|
14348
|
+
/**
|
|
14349
|
+
* Restore the cache from the storage
|
|
14350
|
+
*/
|
|
14351
|
+
restore() {
|
|
14352
|
+
this.entries = new Map(JSON.parse(this.storage.getItem(this.name) || '[]'));
|
|
14353
|
+
}
|
|
14354
|
+
/**
|
|
14355
|
+
* Flush the cache and clean the storage
|
|
14356
|
+
*/
|
|
14357
|
+
flush() {
|
|
14358
|
+
super.flush();
|
|
14359
|
+
this.store();
|
|
14360
|
+
}
|
|
14361
|
+
/**
|
|
14362
|
+
* Store the response in the cache
|
|
14363
|
+
* @param req The request with the resource to store the response
|
|
14364
|
+
* @param res The response to store in the cache
|
|
14365
|
+
*/
|
|
14366
|
+
putResponse(req, res) {
|
|
14367
|
+
const scope = this.scope(req);
|
|
14368
|
+
const tags = this.tags(res);
|
|
14369
|
+
this.put(req.cacheKey, res.toJson(), {
|
|
14370
|
+
timeout: res.options.maxAge,
|
|
14371
|
+
scope,
|
|
14372
|
+
tags,
|
|
14373
|
+
});
|
|
14374
|
+
}
|
|
14375
|
+
/**
|
|
14376
|
+
* Restore the response from the cache
|
|
14377
|
+
* @param req The request with the resource to get the response
|
|
14378
|
+
* @returns The response from the cache
|
|
14379
|
+
*/
|
|
14380
|
+
getResponse(req) {
|
|
14381
|
+
const scope = this.scope(req);
|
|
14382
|
+
const data = this.get(req.cacheKey, { scope });
|
|
14383
|
+
return data !== undefined ? ODataResponse.fromJson(req, data) : undefined;
|
|
14384
|
+
}
|
|
14385
|
+
}
|
|
14386
|
+
|
|
13185
14387
|
/*
|
|
13186
14388
|
* Public API Surface of angular-odata
|
|
13187
14389
|
*/
|
|
@@ -13190,5 +14392,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImpor
|
|
|
13190
14392
|
* Generated bundle index. Do not edit.
|
|
13191
14393
|
*/
|
|
13192
14394
|
|
|
13193
|
-
export { Aggregate, ApplyExpression, ArithmeticFunctions, ArithmeticOperators, BUBBLES, CollectionFunctions, ComputeExpression, ConditionalFunctions, DateAndTimeFunctions, Dates, Durations, EDM_PARSERS, EdmType, Enums, ExpandExpression, ExpandField, Expression, FieldFactory, FilterExpression, Function, GeoFunctions, GroupBy, GroupByTransformations, Grouping, GroupingOperators, Http, INCLUDE_DEEP, INCLUDE_SHALLOW, ITEM_ROOT, JsonType, Lambda, LambdaOperators, LogicalOperators, Model, ModelField, NONE_PARSER, ODATA_CONFIG, OData, ODataActionResource, ODataApi, ODataBaseService, ODataBatchRequest, ODataBatchResource,
|
|
14395
|
+
export { Aggregate, ApplyExpression, ArithmeticFunctions, ArithmeticOperators, BUBBLES, CollectionFunctions, ComputeExpression, ConditionalFunctions, DateAndTimeFunctions, Dates, Durations, EDM_PARSERS, EdmType, Enums, ExpandExpression, ExpandField, Expression, FieldFactory, FilterExpression, Function, GeoFunctions, GroupBy, GroupByTransformations, Grouping, GroupingOperators, Http, INCLUDE_DEEP, INCLUDE_SHALLOW, ITEM_ROOT, JsonType, Lambda, LambdaOperators, LogicalOperators, Model, ModelField, NONE_PARSER, ODATA_CONFIG, OData, ODataActionResource, ODataAnnotations, ODataApi, ODataBaseCache, ODataBaseService, ODataBatchRequest, ODataBatchResource, ODataCallable, ODataCallableParser, ODataClient, ODataCollection, ODataConfigAsyncLoader, ODataConfigLoader, ODataConfigSyncLoader, ODataCountResource, ODataEntitiesAnnotations, ODataEntityAnnotations, ODataEntityContainer, ODataEntityResource, ODataEntitySet, ODataEntitySetResource, ODataEntitySetService, ODataEntityTypeKey, ODataEnumType, ODataEnumTypeFieldParser, ODataEnumTypeParser, ODataFunctionResource, ODataFunctions, ODataInMemoryCache, ODataInStorageCache, ODataMediaResource, ODataMetadata, ODataMetadataLoader, ODataMetadataParser, ODataMetadataResource, ODataModel, ODataModelAttribute, ODataModelEvent, ODataModelEventEmitter, ODataModelEventType, ODataModelField, ODataModelOptions, ODataModelState, ODataModule, ODataNavigationPropertyResource, ODataOperators, ODataParameterParser, ODataPathSegments, ODataPathSegmentsHandler, ODataPropertyAnnotations, ODataPropertyResource, ODataQueryOptionHandler, ODataQueryOptions, ODataQueryOptionsHandler, ODataReferenceResource, ODataReferential, ODataRequest, ODataResource, ODataResponse, ODataSchema, ODataServiceFactory, ODataSettings, ODataSingleton, ODataSingletonResource, ODataSingletonService, ODataStructuredType, ODataStructuredTypeFieldParser, ODataStructuredTypeParser, ODataSyntax, ODataTransformations, ODataValueResource, Objects, Operator, OrderByExpression, OrderByField, PathSegment, QueryCustomTypes, QueryOption, RenderableFactory, SearchExpression, SearchTerm, SegmentHandler, SelectExpression, StandardAggregateMethods, StringAndCollectionFunctions, StringFunctions, Strings, Transformations, Type, TypeFunctions, Types, Urls, alias, binary, buildPathAndQuery, createSyncLoader, duration, encode, functions, isQueryCustomType, isRawType, normalizeValue, operators, pathAndParamsFromQueryOptions, pathAndParamsFromSegments, provideODataClient, raw, render, resolve, syntax, transformations };
|
|
13194
14396
|
//# sourceMappingURL=angular-odata.mjs.map
|