angular-odata 0.159.0 → 0.161.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/angular-odata.mjs +112 -70
- package/fesm2022/angular-odata.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/apigen/angular/base.js +7 -7
- package/schematics/apigen/angular/base.js.map +1 -1
- package/schematics/apigen/angular/entity.js.map +1 -1
- package/schematics/apigen/angular/model.js.map +1 -1
- package/schematics/apigen/angular/package.js.map +1 -1
- package/schematics/metadata/index.js +2 -4
- package/schematics/metadata/index.js.map +1 -1
- package/types/angular-odata.d.ts +52 -39
|
@@ -1779,11 +1779,13 @@ class ODataAnnotation {
|
|
|
1779
1779
|
string;
|
|
1780
1780
|
bool;
|
|
1781
1781
|
int;
|
|
1782
|
-
|
|
1783
|
-
properties;
|
|
1782
|
+
values;
|
|
1784
1783
|
constructor(annot) {
|
|
1785
1784
|
this.term = annot.term;
|
|
1786
|
-
|
|
1785
|
+
this.string = annot.string;
|
|
1786
|
+
this.bool = annot.bool;
|
|
1787
|
+
this.int = annot.int;
|
|
1788
|
+
this.values = annot.values;
|
|
1787
1789
|
}
|
|
1788
1790
|
}
|
|
1789
1791
|
class ODataAnnotatable {
|
|
@@ -1813,8 +1815,7 @@ class ODataAnnotatable {
|
|
|
1813
1815
|
return (annot.string ||
|
|
1814
1816
|
annot.bool ||
|
|
1815
1817
|
annot.int ||
|
|
1816
|
-
annot.
|
|
1817
|
-
annot.properties);
|
|
1818
|
+
annot.values);
|
|
1818
1819
|
}
|
|
1819
1820
|
}
|
|
1820
1821
|
|
|
@@ -2152,9 +2153,9 @@ class ODataEnumTypeParser extends ODataAnnotatable {
|
|
|
2152
2153
|
}
|
|
2153
2154
|
return schema;
|
|
2154
2155
|
}
|
|
2155
|
-
validate(value, { method, navigation = false, }
|
|
2156
|
+
validate(value, { method, navigation = false, }) {
|
|
2156
2157
|
if (this.flags) {
|
|
2157
|
-
|
|
2158
|
+
const fields = this.fields(value);
|
|
2158
2159
|
return value && fields.length === 0 ? ['mismatch'] : undefined;
|
|
2159
2160
|
}
|
|
2160
2161
|
else {
|
|
@@ -2194,6 +2195,7 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
|
|
|
2194
2195
|
navigation;
|
|
2195
2196
|
nullable;
|
|
2196
2197
|
default;
|
|
2198
|
+
optimisticConcurrency = false;
|
|
2197
2199
|
maxLength;
|
|
2198
2200
|
precision;
|
|
2199
2201
|
scale;
|
|
@@ -2214,7 +2216,7 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
|
|
|
2214
2216
|
this.precision = field.precision;
|
|
2215
2217
|
this.scale = field.scale;
|
|
2216
2218
|
}
|
|
2217
|
-
validate(value, { method, navigation = false, }
|
|
2219
|
+
validate(value, { method, navigation = false, }) {
|
|
2218
2220
|
let errors;
|
|
2219
2221
|
if (this.collection && Array.isArray(value)) {
|
|
2220
2222
|
errors = value.map((v) => this.validate(v, { method, navigation }));
|
|
@@ -2230,12 +2232,8 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
|
|
|
2230
2232
|
}
|
|
2231
2233
|
else {
|
|
2232
2234
|
// IsEdmType
|
|
2233
|
-
const computed = this.annotatedValue(COMPUTED);
|
|
2234
2235
|
errors = [];
|
|
2235
|
-
if (!this.nullable
|
|
2236
|
-
(value === null || (value === undefined && method !== 'modify')) && // Is null or undefined without patch?
|
|
2237
|
-
!(computed && method === 'create') // Not (Is Computed field and create) ?
|
|
2238
|
-
) {
|
|
2236
|
+
if (method !== 'modify' && value == null && !(this.nullable || this.isComputed())) {
|
|
2239
2237
|
errors.push(`required`);
|
|
2240
2238
|
}
|
|
2241
2239
|
if (this.maxLength !== undefined &&
|
|
@@ -2303,12 +2301,13 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
|
|
|
2303
2301
|
});
|
|
2304
2302
|
}
|
|
2305
2303
|
//#endregion
|
|
2306
|
-
configure({ options, parserForType, }) {
|
|
2304
|
+
configure({ options, optimisticConcurrency, parserForType, }) {
|
|
2307
2305
|
this.parserOptions = options;
|
|
2308
2306
|
this.parser = parserForType(this.type);
|
|
2309
|
-
if (
|
|
2307
|
+
if (optimisticConcurrency !== undefined)
|
|
2308
|
+
this.optimisticConcurrency = optimisticConcurrency;
|
|
2309
|
+
if (this.default !== undefined)
|
|
2310
2310
|
this.default = this.deserialize(this.default, options);
|
|
2311
|
-
}
|
|
2312
2311
|
}
|
|
2313
2312
|
//#region Json Schema
|
|
2314
2313
|
// https://json-schema.org/
|
|
@@ -2385,6 +2384,12 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
|
|
|
2385
2384
|
isKey() {
|
|
2386
2385
|
return this.structured.keys({ include_parents: true }).some((k) => k.name === this.name);
|
|
2387
2386
|
}
|
|
2387
|
+
isComputed() {
|
|
2388
|
+
return this.annotatedValue(COMPUTED);
|
|
2389
|
+
}
|
|
2390
|
+
isOptimisticConcurrency() {
|
|
2391
|
+
return this.optimisticConcurrency;
|
|
2392
|
+
}
|
|
2388
2393
|
hasReferentials() {
|
|
2389
2394
|
return this.referentials.length !== 0;
|
|
2390
2395
|
}
|
|
@@ -2517,14 +2522,18 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
|
|
|
2517
2522
|
const parserOptions = { ...this.parserOptions, ...options };
|
|
2518
2523
|
return raw(JSON.stringify(this.serialize(value, parserOptions)));
|
|
2519
2524
|
}
|
|
2520
|
-
configure({ options, parserForType, }) {
|
|
2525
|
+
configure({ options, entitySet, parserForType, }) {
|
|
2521
2526
|
this.parserOptions = options;
|
|
2522
2527
|
if (this.base !== undefined) {
|
|
2523
2528
|
this.parent = parserForType(this.base);
|
|
2524
2529
|
if (this.parent !== undefined)
|
|
2525
2530
|
this.parent.children.push(this);
|
|
2526
2531
|
}
|
|
2527
|
-
|
|
2532
|
+
const optimisticConcurrencyFields = entitySet?.annotatedValue(OPTIMISTIC_CONCURRENCY) ?? [];
|
|
2533
|
+
this._fields.forEach((field) => {
|
|
2534
|
+
const optimisticConcurrency = optimisticConcurrencyFields.indexOf(field.name) !== -1;
|
|
2535
|
+
field.configure({ options, optimisticConcurrency, parserForType });
|
|
2536
|
+
});
|
|
2528
2537
|
}
|
|
2529
2538
|
/**
|
|
2530
2539
|
* Returns all fields of the structured type.
|
|
@@ -2676,7 +2685,7 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
|
|
|
2676
2685
|
}
|
|
2677
2686
|
return schema;
|
|
2678
2687
|
}
|
|
2679
|
-
validate(attrs, { method, navigation = false, }
|
|
2688
|
+
validate(attrs, { method, navigation = false, }) {
|
|
2680
2689
|
const errors = {};
|
|
2681
2690
|
const fields = this.fields({
|
|
2682
2691
|
include_navigation: true,
|
|
@@ -2994,8 +3003,10 @@ class ODataStructuredType extends ODataParserSchemaElement {
|
|
|
2994
3003
|
if (this.parent !== undefined)
|
|
2995
3004
|
this.parent.children.push(this);
|
|
2996
3005
|
}
|
|
3006
|
+
const entitySet = this.api.findEntitySetForEntityType(this.type()) ?? this.api.findEntitySetForEntityType(this.type({ alias: true }));
|
|
2997
3007
|
this.parser.configure({
|
|
2998
3008
|
options,
|
|
3009
|
+
entitySet,
|
|
2999
3010
|
parserForType: (t) => this.api.parserForType(t),
|
|
3000
3011
|
});
|
|
3001
3012
|
if (this.model !== undefined) {
|
|
@@ -3179,7 +3190,7 @@ class ODataStructuredType extends ODataParserSchemaElement {
|
|
|
3179
3190
|
* @param method Method to use for the process validation
|
|
3180
3191
|
* @returns Object with the errors
|
|
3181
3192
|
*/
|
|
3182
|
-
validate(attrs, { method, navigation = false, }
|
|
3193
|
+
validate(attrs, { method, navigation = false, }) {
|
|
3183
3194
|
return this.parser.validate(attrs, { method, navigation });
|
|
3184
3195
|
}
|
|
3185
3196
|
}
|
|
@@ -5987,7 +5998,8 @@ class ODataRequest {
|
|
|
5987
5998
|
if (apiOptions.prefer?.maxPageSize !== undefined && ['GET'].indexOf(this._method) !== -1)
|
|
5988
5999
|
prefer.push(`odata.maxpagesize=${apiOptions.prefer?.maxPageSize}`);
|
|
5989
6000
|
// Annotations
|
|
5990
|
-
if (apiOptions.prefer?.includeAnnotations !== undefined &&
|
|
6001
|
+
if (apiOptions.prefer?.includeAnnotations !== undefined &&
|
|
6002
|
+
['GET'].indexOf(this._method) !== -1)
|
|
5991
6003
|
prefer.push(`odata.include-annotations=${apiOptions.prefer?.includeAnnotations}`);
|
|
5992
6004
|
// Omit Null Values
|
|
5993
6005
|
if (apiOptions.prefer?.omitNullValues === true && ['GET'].indexOf(this._method) !== -1)
|
|
@@ -7985,11 +7997,22 @@ class CsdlAnnotation {
|
|
|
7985
7997
|
return json;
|
|
7986
7998
|
}
|
|
7987
7999
|
toConfig() {
|
|
8000
|
+
var items = undefined;
|
|
8001
|
+
if (Array.isArray(this.Collection) && this.Collection.length > 0) {
|
|
8002
|
+
items = this.Collection.map((m) => m.toConfig()).flat();
|
|
8003
|
+
}
|
|
8004
|
+
else if (Array.isArray(this.Record) && this.Record.length > 0) {
|
|
8005
|
+
items = this.Record.map((m) => m.toConfig()).flat();
|
|
8006
|
+
}
|
|
8007
|
+
else if (Array.isArray(this.EnumMember) && this.EnumMember.length > 0) {
|
|
8008
|
+
items = this.EnumMember.map((m) => m.toConfig());
|
|
8009
|
+
}
|
|
7988
8010
|
return {
|
|
7989
8011
|
term: this.Term,
|
|
7990
8012
|
string: this.String,
|
|
7991
8013
|
bool: this.Bool,
|
|
7992
8014
|
int: this.Int,
|
|
8015
|
+
values: items,
|
|
7993
8016
|
};
|
|
7994
8017
|
}
|
|
7995
8018
|
}
|
|
@@ -8089,6 +8112,21 @@ class CsdlCollection {
|
|
|
8089
8112
|
}
|
|
8090
8113
|
return json;
|
|
8091
8114
|
}
|
|
8115
|
+
toConfig() {
|
|
8116
|
+
if (Array.isArray(this.String) && this.String.length > 0) {
|
|
8117
|
+
return this.String.map((s) => s.toConfig());
|
|
8118
|
+
}
|
|
8119
|
+
if (Array.isArray(this.Record) && this.Record.length > 0) {
|
|
8120
|
+
return this.Record.map((r) => r.toConfig()).flat();
|
|
8121
|
+
}
|
|
8122
|
+
if (Array.isArray(this.PropertyPath) && this.PropertyPath.length > 0) {
|
|
8123
|
+
return this.PropertyPath.map((p) => p.toConfig());
|
|
8124
|
+
}
|
|
8125
|
+
if (Array.isArray(this.NavigationPropertyPath) && this.NavigationPropertyPath.length > 0) {
|
|
8126
|
+
return this.NavigationPropertyPath.map((p) => p.toConfig());
|
|
8127
|
+
}
|
|
8128
|
+
return [];
|
|
8129
|
+
}
|
|
8092
8130
|
}
|
|
8093
8131
|
class CsdlRecord {
|
|
8094
8132
|
PropertyValue;
|
|
@@ -8102,6 +8140,12 @@ class CsdlRecord {
|
|
|
8102
8140
|
}
|
|
8103
8141
|
return json;
|
|
8104
8142
|
}
|
|
8143
|
+
toConfig() {
|
|
8144
|
+
if (Array.isArray(this.PropertyValue) && this.PropertyValue.length > 0) {
|
|
8145
|
+
return this.PropertyValue.map((p) => p.toConfig());
|
|
8146
|
+
}
|
|
8147
|
+
return [];
|
|
8148
|
+
}
|
|
8105
8149
|
}
|
|
8106
8150
|
class CsdlPropertyValue {
|
|
8107
8151
|
Name;
|
|
@@ -8127,6 +8171,19 @@ class CsdlPropertyValue {
|
|
|
8127
8171
|
}
|
|
8128
8172
|
return json;
|
|
8129
8173
|
}
|
|
8174
|
+
toConfig() {
|
|
8175
|
+
const config = { name: this.Name };
|
|
8176
|
+
if (this.String !== undefined) {
|
|
8177
|
+
config['string'] = this.String;
|
|
8178
|
+
}
|
|
8179
|
+
if (this.Date !== undefined) {
|
|
8180
|
+
config['date'] = this.Date;
|
|
8181
|
+
}
|
|
8182
|
+
if (Array.isArray(this.EnumMember) && this.EnumMember.length > 0) {
|
|
8183
|
+
config['enumMembers'] = this.EnumMember.map((m) => m.toConfig());
|
|
8184
|
+
}
|
|
8185
|
+
return config;
|
|
8186
|
+
}
|
|
8130
8187
|
}
|
|
8131
8188
|
class CsdlEnumMember {
|
|
8132
8189
|
TextContent;
|
|
@@ -8138,6 +8195,9 @@ class CsdlEnumMember {
|
|
|
8138
8195
|
TextContent: this.TextContent,
|
|
8139
8196
|
};
|
|
8140
8197
|
}
|
|
8198
|
+
toConfig() {
|
|
8199
|
+
return this.TextContent;
|
|
8200
|
+
}
|
|
8141
8201
|
}
|
|
8142
8202
|
class CsdlString {
|
|
8143
8203
|
TextContent;
|
|
@@ -8149,6 +8209,9 @@ class CsdlString {
|
|
|
8149
8209
|
TextContent: this.TextContent,
|
|
8150
8210
|
};
|
|
8151
8211
|
}
|
|
8212
|
+
toConfig() {
|
|
8213
|
+
return this.TextContent;
|
|
8214
|
+
}
|
|
8152
8215
|
}
|
|
8153
8216
|
class CsdlPropertyPath {
|
|
8154
8217
|
TextContent;
|
|
@@ -8160,6 +8223,9 @@ class CsdlPropertyPath {
|
|
|
8160
8223
|
TextContent: this.TextContent,
|
|
8161
8224
|
};
|
|
8162
8225
|
}
|
|
8226
|
+
toConfig() {
|
|
8227
|
+
return this.TextContent;
|
|
8228
|
+
}
|
|
8163
8229
|
}
|
|
8164
8230
|
class CsdlNavigationPropertyPath {
|
|
8165
8231
|
TextContent;
|
|
@@ -8171,6 +8237,9 @@ class CsdlNavigationPropertyPath {
|
|
|
8171
8237
|
TextContent: this.TextContent,
|
|
8172
8238
|
};
|
|
8173
8239
|
}
|
|
8240
|
+
toConfig() {
|
|
8241
|
+
return this.TextContent;
|
|
8242
|
+
}
|
|
8174
8243
|
}
|
|
8175
8244
|
|
|
8176
8245
|
class CsdlReference extends CsdlAnnotable {
|
|
@@ -9085,7 +9154,7 @@ class CsdlSchema {
|
|
|
9085
9154
|
return {
|
|
9086
9155
|
namespace: this.Namespace,
|
|
9087
9156
|
alias: base?.alias ?? this.Alias,
|
|
9088
|
-
annotations: this.Annotations?.
|
|
9157
|
+
annotations: this.Annotations?.flatMap((t) => t.toConfig()),
|
|
9089
9158
|
enums: this.EnumType?.map((t) => t.toConfig(base?.enums?.find((cs) => cs.name === t.Name))),
|
|
9090
9159
|
entities: [
|
|
9091
9160
|
...(this.ComplexType ?? []).map((t) => t.toConfig(base?.entities?.find((cs) => cs.name === t.Name))),
|
|
@@ -10691,7 +10760,7 @@ class ODataCollection {
|
|
|
10691
10760
|
}
|
|
10692
10761
|
create(attrs = {}, { silent = false, server = true } = {}) {
|
|
10693
10762
|
const model = this.modelFactory(attrs);
|
|
10694
|
-
return (model.isValid() && server ? model.save() : of(model)).pipe(switchMap((model) => this.add(model, { silent, server })), map(() => model));
|
|
10763
|
+
return (model.isValid({ method: 'create' }) && server ? model.save() : of(model)).pipe(switchMap((model) => this.add(model, { silent, server })), map(() => model));
|
|
10695
10764
|
}
|
|
10696
10765
|
set(path, value, {}) {
|
|
10697
10766
|
const pathArray = (Types.isArray(path) ? path : path.match(/([^[.\]])+/g));
|
|
@@ -11145,10 +11214,10 @@ class ODataModel {
|
|
|
11145
11214
|
}
|
|
11146
11215
|
// Validation
|
|
11147
11216
|
_errors;
|
|
11148
|
-
validate({ method, navigation = false, }
|
|
11217
|
+
validate({ method, navigation = false, }) {
|
|
11149
11218
|
return this._meta.validate(this, { method, navigation });
|
|
11150
11219
|
}
|
|
11151
|
-
isValid({ method, navigation = false, }
|
|
11220
|
+
isValid({ method, navigation = false, }) {
|
|
11152
11221
|
this._errors = this.validate({ method, navigation });
|
|
11153
11222
|
if (this._errors !== undefined)
|
|
11154
11223
|
this.events$.trigger(ODataModelEventType.Invalid, {
|
|
@@ -11750,9 +11819,6 @@ class ODataModelField {
|
|
|
11750
11819
|
parser;
|
|
11751
11820
|
options;
|
|
11752
11821
|
default;
|
|
11753
|
-
required;
|
|
11754
|
-
concurrency;
|
|
11755
|
-
maxLength;
|
|
11756
11822
|
minLength;
|
|
11757
11823
|
min;
|
|
11758
11824
|
max;
|
|
@@ -11764,9 +11830,6 @@ class ODataModelField {
|
|
|
11764
11830
|
this.field = field;
|
|
11765
11831
|
this.parser = parser;
|
|
11766
11832
|
this.default = opts.default || parser.default;
|
|
11767
|
-
this.required = Boolean(opts.required || !parser.nullable);
|
|
11768
|
-
this.concurrency = Boolean(opts.concurrency);
|
|
11769
|
-
this.maxLength = opts.maxLength || parser.maxLength;
|
|
11770
11833
|
this.minLength = opts.minLength;
|
|
11771
11834
|
this.min = opts.min;
|
|
11772
11835
|
this.max = opts.max;
|
|
@@ -11784,16 +11847,20 @@ class ODataModelField {
|
|
|
11784
11847
|
annotatedValue(term) {
|
|
11785
11848
|
return this.parser.annotatedValue(term);
|
|
11786
11849
|
}
|
|
11787
|
-
configure({
|
|
11850
|
+
configure({ options }) {
|
|
11788
11851
|
this.parserOptions = options;
|
|
11789
|
-
if (concurrency)
|
|
11790
|
-
this.concurrency = concurrency;
|
|
11791
11852
|
if (this.default !== undefined)
|
|
11792
11853
|
this.default = this.deserialize(this.default, options);
|
|
11793
11854
|
}
|
|
11794
11855
|
isKey() {
|
|
11795
11856
|
return this.parser.isKey();
|
|
11796
11857
|
}
|
|
11858
|
+
isComputed() {
|
|
11859
|
+
return this.parser.isComputed();
|
|
11860
|
+
}
|
|
11861
|
+
isOptimisticConcurrency() {
|
|
11862
|
+
return this.parser.isOptimisticConcurrency();
|
|
11863
|
+
}
|
|
11797
11864
|
hasReferentials() {
|
|
11798
11865
|
return this.parser.hasReferentials();
|
|
11799
11866
|
}
|
|
@@ -11823,7 +11890,7 @@ class ODataModelField {
|
|
|
11823
11890
|
throw new Error(`Could not find enum type for ${this.parser.type}`);
|
|
11824
11891
|
return enumType;
|
|
11825
11892
|
}
|
|
11826
|
-
validate(value, { method, navigation = false, }
|
|
11893
|
+
validate(value, { method, navigation = false, }) {
|
|
11827
11894
|
if (ODataModelOptions.isModel(value)) {
|
|
11828
11895
|
return !value.isValid({ method, navigation }) ? value._errors : undefined;
|
|
11829
11896
|
}
|
|
@@ -11833,21 +11900,7 @@ class ODataModelField {
|
|
|
11833
11900
|
: undefined;
|
|
11834
11901
|
}
|
|
11835
11902
|
else {
|
|
11836
|
-
const computed = this.annotatedValue(COMPUTED);
|
|
11837
11903
|
const errors = this.parser?.validate(value, { method, navigation }) ?? [];
|
|
11838
|
-
if (this.required &&
|
|
11839
|
-
(value === null || (value === undefined && method !== 'modify')) && // Is null or undefined without patch?
|
|
11840
|
-
!(computed && method === 'create') // Not (Is Computed field and create) ?
|
|
11841
|
-
) {
|
|
11842
|
-
if (errors.indexOf('required') === -1)
|
|
11843
|
-
errors.push(`required`);
|
|
11844
|
-
}
|
|
11845
|
-
if (this.maxLength !== undefined &&
|
|
11846
|
-
typeof value === 'string' &&
|
|
11847
|
-
value.length > this.maxLength) {
|
|
11848
|
-
if (errors.indexOf('maxlength') === -1)
|
|
11849
|
-
errors.push(`maxlength`);
|
|
11850
|
-
}
|
|
11851
11904
|
if (this.minLength !== undefined &&
|
|
11852
11905
|
typeof value === 'string' &&
|
|
11853
11906
|
value.length < this.minLength) {
|
|
@@ -11951,11 +12004,11 @@ class ODataModelAttribute {
|
|
|
11951
12004
|
get navigation() {
|
|
11952
12005
|
return this._field.navigation;
|
|
11953
12006
|
}
|
|
11954
|
-
|
|
11955
|
-
return this._field.
|
|
12007
|
+
isComputed() {
|
|
12008
|
+
return this._field.isComputed();
|
|
11956
12009
|
}
|
|
11957
|
-
|
|
11958
|
-
return
|
|
12010
|
+
isOptimisticConcurrency() {
|
|
12011
|
+
return this._field.isOptimisticConcurrency();
|
|
11959
12012
|
}
|
|
11960
12013
|
get referentials() {
|
|
11961
12014
|
return this._field.referentials;
|
|
@@ -12125,17 +12178,7 @@ class ODataModelOptions {
|
|
|
12125
12178
|
this.parent.children.push(this);
|
|
12126
12179
|
}
|
|
12127
12180
|
this.entitySet = this.api.findEntitySetForEntityType(this.type());
|
|
12128
|
-
|
|
12129
|
-
if (this.entitySet !== undefined) {
|
|
12130
|
-
concurrencyFields = this.entitySet.annotatedValue(OPTIMISTIC_CONCURRENCY) ?? [];
|
|
12131
|
-
}
|
|
12132
|
-
this._fields.forEach((field) => {
|
|
12133
|
-
const concurrency = concurrencyFields.indexOf(field.field) !== -1;
|
|
12134
|
-
field.configure({
|
|
12135
|
-
concurrency,
|
|
12136
|
-
options,
|
|
12137
|
-
});
|
|
12138
|
-
});
|
|
12181
|
+
this._fields.forEach((field) => field.configure({ options, }));
|
|
12139
12182
|
}
|
|
12140
12183
|
fields({ include_navigation, include_parents, }) {
|
|
12141
12184
|
return [
|
|
@@ -12193,8 +12236,7 @@ class ODataModelOptions {
|
|
|
12193
12236
|
parser: structuredFieldParser,
|
|
12194
12237
|
});
|
|
12195
12238
|
modelField.configure({
|
|
12196
|
-
options: this.api.options
|
|
12197
|
-
concurrency: false,
|
|
12239
|
+
options: this.api.options
|
|
12198
12240
|
});
|
|
12199
12241
|
Object.defineProperty(self, modelField.name, {
|
|
12200
12242
|
configurable: true,
|
|
@@ -12391,7 +12433,7 @@ class ODataModelOptions {
|
|
|
12391
12433
|
return null;
|
|
12392
12434
|
return resolve ? Objects.resolveKey(referenced, { single }) : Object.fromEntries(referenced);
|
|
12393
12435
|
}
|
|
12394
|
-
validate(self, { method, navigation = false, }
|
|
12436
|
+
validate(self, { method, navigation = false, }) {
|
|
12395
12437
|
const errors = this.fields({
|
|
12396
12438
|
include_parents: true,
|
|
12397
12439
|
include_navigation: navigation,
|
|
@@ -12458,9 +12500,9 @@ class ODataModelOptions {
|
|
|
12458
12500
|
.reduce((acc, attr) => {
|
|
12459
12501
|
const name = field_mapping ? attr.fieldName : attr.name;
|
|
12460
12502
|
let value = attr.get();
|
|
12461
|
-
const computed = attr.
|
|
12503
|
+
const computed = attr.isComputed();
|
|
12462
12504
|
const navigation = attr.navigation;
|
|
12463
|
-
const concurrency = attr.
|
|
12505
|
+
const concurrency = attr.isOptimisticConcurrency();
|
|
12464
12506
|
if (ODataModelOptions.isModel(value)) {
|
|
12465
12507
|
value = value.toEntity({
|
|
12466
12508
|
client_id,
|
|
@@ -12977,7 +13019,7 @@ class ODataApi {
|
|
|
12977
13019
|
});
|
|
12978
13020
|
return true;
|
|
12979
13021
|
}
|
|
12980
|
-
populate({ schemas, references, models, collections
|
|
13022
|
+
populate({ schemas, references, models, collections }) {
|
|
12981
13023
|
const odataSchemas = (schemas ?? []).map((schema) => new ODataSchema(schema, this));
|
|
12982
13024
|
//TODO: Merge duplicates
|
|
12983
13025
|
this.schemas = [...this.schemas, ...odataSchemas];
|