angular-odata 0.131.0 → 0.140.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.
Files changed (139) hide show
  1. package/fesm2022/angular-odata.mjs +276 -543
  2. package/fesm2022/angular-odata.mjs.map +1 -1
  3. package/index.d.ts +6403 -3
  4. package/package.json +3 -3
  5. package/schematics/apigen/angular/base.js +2 -6
  6. package/schematics/apigen/angular/base.js.map +1 -1
  7. package/schematics/apigen/angular/entity.js +1 -2
  8. package/schematics/apigen/angular/entity.js.map +1 -1
  9. package/schematics/apigen/index.js +2 -6
  10. package/schematics/apigen/index.js.map +1 -1
  11. package/schematics/apigen/metadata/csdl/csdl-annotation.js +1 -2
  12. package/schematics/apigen/metadata/csdl/csdl-annotation.js.map +1 -1
  13. package/schematics/apigen/metadata/csdl/csdl-entity-container.js.map +1 -1
  14. package/schematics/apigen/metadata/csdl/csdl-entity-set.js.map +1 -1
  15. package/schematics/apigen/metadata/csdl/csdl-enum-type.d.ts +1 -1
  16. package/schematics/apigen/metadata/csdl/csdl-enum-type.js +1 -1
  17. package/schematics/apigen/metadata/csdl/csdl-enum-type.js.map +1 -1
  18. package/schematics/apigen/metadata/csdl/csdl-function-action.d.ts +1 -1
  19. package/schematics/apigen/metadata/csdl/csdl-reference.js +1 -2
  20. package/schematics/apigen/metadata/csdl/csdl-reference.js.map +1 -1
  21. package/schematics/apigen/metadata/csdl/csdl-schema.js +1 -2
  22. package/schematics/apigen/metadata/csdl/csdl-schema.js.map +1 -1
  23. package/schematics/apigen/metadata/csdl/csdl-singleton.js.map +1 -1
  24. package/schematics/apigen/metadata/csdl/csdl-structural-property.d.ts +1 -1
  25. package/schematics/apigen/metadata/csdl/csdl-structural-property.js +2 -3
  26. package/schematics/apigen/metadata/csdl/csdl-structural-property.js.map +1 -1
  27. package/schematics/apigen/metadata/csdl/csdl-structured-type.d.ts +1 -1
  28. package/schematics/apigen/metadata/csdl/csdl-structured-type.js +1 -2
  29. package/schematics/apigen/metadata/csdl/csdl-structured-type.js.map +1 -1
  30. package/schematics/apigen/metadata/parser.js +1 -3
  31. package/schematics/apigen/metadata/parser.js.map +1 -1
  32. package/schematics/apigen/utils.js +2 -4
  33. package/schematics/apigen/utils.js.map +1 -1
  34. package/lib/annotations.d.ts +0 -75
  35. package/lib/api.d.ts +0 -107
  36. package/lib/cache/cache.d.ts +0 -104
  37. package/lib/cache/index.d.ts +0 -3
  38. package/lib/cache/memory.d.ts +0 -19
  39. package/lib/cache/storage.d.ts +0 -35
  40. package/lib/client.d.ts +0 -613
  41. package/lib/constants.d.ts +0 -70
  42. package/lib/helper.d.ts +0 -75
  43. package/lib/index.d.ts +0 -14
  44. package/lib/loaders.d.ts +0 -21
  45. package/lib/metadata/csdl/csdl-annotation.d.ts +0 -159
  46. package/lib/metadata/csdl/csdl-entity-container.d.ts +0 -31
  47. package/lib/metadata/csdl/csdl-entity-set.d.ts +0 -25
  48. package/lib/metadata/csdl/csdl-enum-type.d.ts +0 -37
  49. package/lib/metadata/csdl/csdl-function-action.d.ts +0 -148
  50. package/lib/metadata/csdl/csdl-navigation-property-binding.d.ts +0 -12
  51. package/lib/metadata/csdl/csdl-reference.d.ts +0 -53
  52. package/lib/metadata/csdl/csdl-schema.d.ts +0 -37
  53. package/lib/metadata/csdl/csdl-singleton.d.ts +0 -21
  54. package/lib/metadata/csdl/csdl-structural-property.d.ts +0 -86
  55. package/lib/metadata/csdl/csdl-structured-type.d.ts +0 -94
  56. package/lib/metadata/csdl/csdl-type-definition.d.ts +0 -25
  57. package/lib/metadata/index.d.ts +0 -2
  58. package/lib/metadata/metadata.d.ts +0 -23
  59. package/lib/metadata/parser.d.ts +0 -110
  60. package/lib/models/collection.d.ts +0 -183
  61. package/lib/models/index.d.ts +0 -3
  62. package/lib/models/model.d.ts +0 -176
  63. package/lib/models/options.d.ts +0 -368
  64. package/lib/module.d.ts +0 -19
  65. package/lib/options.d.ts +0 -101
  66. package/lib/resources/index.d.ts +0 -6
  67. package/lib/resources/options.d.ts +0 -18
  68. package/lib/resources/path/handlers.d.ts +0 -29
  69. package/lib/resources/path/index.d.ts +0 -2
  70. package/lib/resources/path/segments.d.ts +0 -54
  71. package/lib/resources/query/builder.d.ts +0 -103
  72. package/lib/resources/query/expressions/apply.d.ts +0 -125
  73. package/lib/resources/query/expressions/base.d.ts +0 -25
  74. package/lib/resources/query/expressions/compute.d.ts +0 -39
  75. package/lib/resources/query/expressions/count.d.ts +0 -58
  76. package/lib/resources/query/expressions/expand.d.ts +0 -69
  77. package/lib/resources/query/expressions/filter.d.ts +0 -77
  78. package/lib/resources/query/expressions/index.d.ts +0 -9
  79. package/lib/resources/query/expressions/orderby.d.ts +0 -55
  80. package/lib/resources/query/expressions/search.d.ts +0 -63
  81. package/lib/resources/query/expressions/select.d.ts +0 -34
  82. package/lib/resources/query/expressions/syntax.d.ts +0 -313
  83. package/lib/resources/query/handlers.d.ts +0 -270
  84. package/lib/resources/query/index.d.ts +0 -4
  85. package/lib/resources/query/options.d.ts +0 -60
  86. package/lib/resources/request.d.ts +0 -64
  87. package/lib/resources/resource.d.ts +0 -161
  88. package/lib/resources/response.d.ts +0 -82
  89. package/lib/resources/types/action.d.ts +0 -84
  90. package/lib/resources/types/batch.d.ts +0 -62
  91. package/lib/resources/types/count.d.ts +0 -20
  92. package/lib/resources/types/entity-set.d.ts +0 -79
  93. package/lib/resources/types/entity.d.ts +0 -54
  94. package/lib/resources/types/function.d.ts +0 -108
  95. package/lib/resources/types/index.d.ts +0 -14
  96. package/lib/resources/types/media.d.ts +0 -28
  97. package/lib/resources/types/metadata.d.ts +0 -13
  98. package/lib/resources/types/navigation-property.d.ts +0 -157
  99. package/lib/resources/types/options.d.ts +0 -32
  100. package/lib/resources/types/property.d.ts +0 -115
  101. package/lib/resources/types/reference.d.ts +0 -74
  102. package/lib/resources/types/singleton.d.ts +0 -87
  103. package/lib/resources/types/value.d.ts +0 -19
  104. package/lib/schema/annotation.d.ts +0 -28
  105. package/lib/schema/callable.d.ts +0 -41
  106. package/lib/schema/element.d.ts +0 -52
  107. package/lib/schema/entity-container.d.ts +0 -10
  108. package/lib/schema/entity-set.d.ts +0 -10
  109. package/lib/schema/enum-type.d.ts +0 -55
  110. package/lib/schema/index.d.ts +0 -8
  111. package/lib/schema/parsers/callable.d.ts +0 -47
  112. package/lib/schema/parsers/edm.d.ts +0 -4
  113. package/lib/schema/parsers/enum-type.d.ts +0 -56
  114. package/lib/schema/parsers/index.d.ts +0 -4
  115. package/lib/schema/parsers/structured-type.d.ts +0 -172
  116. package/lib/schema/schema.d.ts +0 -26
  117. package/lib/schema/singleton.d.ts +0 -10
  118. package/lib/schema/structured-type.d.ts +0 -152
  119. package/lib/services/base.d.ts +0 -20
  120. package/lib/services/entity-set.d.ts +0 -120
  121. package/lib/services/entity.d.ts +0 -11
  122. package/lib/services/factory.d.ts +0 -33
  123. package/lib/services/index.d.ts +0 -4
  124. package/lib/services/singleton.d.ts +0 -44
  125. package/lib/settings.d.ts +0 -26
  126. package/lib/types.d.ts +0 -285
  127. package/lib/utils/arraybuffers.d.ts +0 -4
  128. package/lib/utils/arrays.d.ts +0 -3
  129. package/lib/utils/dates.d.ts +0 -3
  130. package/lib/utils/durations.d.ts +0 -14
  131. package/lib/utils/enums.d.ts +0 -23
  132. package/lib/utils/http.d.ts +0 -22
  133. package/lib/utils/index.d.ts +0 -9
  134. package/lib/utils/objects.d.ts +0 -37
  135. package/lib/utils/odata.d.ts +0 -4
  136. package/lib/utils/strings.d.ts +0 -7
  137. package/lib/utils/types.d.ts +0 -11
  138. package/lib/utils/urls.d.ts +0 -4
  139. package/public-api.d.ts +0 -1
@@ -1,5 +1,5 @@
1
1
  import * as i1 from '@angular/common/http';
2
- import { HttpHeaders, HttpParams, HttpResponse, HttpErrorResponse, HttpEventType, HttpClientModule } from '@angular/common/http';
2
+ import { HttpHeaders, HttpParams, HttpResponse, HttpErrorResponse, HttpEventType } from '@angular/common/http';
3
3
  import { Subject, map as map$1, EMPTY, throwError, Observable, forkJoin, of, NEVER } from 'rxjs';
4
4
  import { map, expand, reduce, finalize, defaultIfEmpty, switchMap, catchError, tap, startWith } from 'rxjs/operators';
5
5
  import * as i0 from '@angular/core';
@@ -142,10 +142,7 @@ const HTTP11 = 'HTTP/1.1';
142
142
  const ACCEPT = 'Accept';
143
143
  const PREFER = 'Prefer';
144
144
  const CACHE_CONTROL = 'Cache-Control';
145
- const CACHE_CONTROL_HEADERS = [
146
- CACHE_CONTROL,
147
- CACHE_CONTROL.toLowerCase(),
148
- ];
145
+ const CACHE_CONTROL_HEADERS = [CACHE_CONTROL, CACHE_CONTROL.toLowerCase()];
149
146
  const ODATA_VERSION = 'OData-Version';
150
147
  const ODATA_VERSION_HEADERS = [
151
148
  ODATA_VERSION,
@@ -153,20 +150,11 @@ const ODATA_VERSION_HEADERS = [
153
150
  'dataserviceversion',
154
151
  ];
155
152
  const LOCATION_HEADER = 'Location';
156
- const LOCATION_HEADERS = [
157
- LOCATION_HEADER,
158
- LOCATION_HEADER.toLowerCase(),
159
- ];
153
+ const LOCATION_HEADERS = [LOCATION_HEADER, LOCATION_HEADER.toLowerCase()];
160
154
  const ODATA_ENTITYID = 'OData-EntityId';
161
- const ODATA_ENTITYID_HEADERS = [
162
- ODATA_ENTITYID,
163
- ODATA_ENTITYID.toLowerCase(),
164
- ];
155
+ const ODATA_ENTITYID_HEADERS = [ODATA_ENTITYID, ODATA_ENTITYID.toLowerCase()];
165
156
  const PREFERENCE_APPLIED = 'Preference-Applied';
166
- const PREFERENCE_APPLIED_HEADERS = [
167
- PREFERENCE_APPLIED,
168
- PREFERENCE_APPLIED.toLowerCase(),
169
- ];
157
+ const PREFERENCE_APPLIED_HEADERS = [PREFERENCE_APPLIED, PREFERENCE_APPLIED.toLowerCase()];
170
158
  const ETAG_HEADER = 'ETag';
171
159
  const ETAG_HEADERS = [ETAG_HEADER, ETAG_HEADER.toLowerCase()];
172
160
  const RETRY_AFTER = 'Retry-After';
@@ -252,19 +240,13 @@ const ODataVersionBaseHelper = {
252
240
  return props;
253
241
  },
254
242
  id(annots) {
255
- return annots instanceof Map
256
- ? annots.get(this.ODATA_ID)
257
- : annots[this.ODATA_ID];
243
+ return annots instanceof Map ? annots.get(this.ODATA_ID) : annots[this.ODATA_ID];
258
244
  },
259
245
  etag(annots) {
260
- return annots instanceof Map
261
- ? annots.get(this.ODATA_ETAG)
262
- : annots[this.ODATA_ETAG];
246
+ return annots instanceof Map ? annots.get(this.ODATA_ETAG) : annots[this.ODATA_ETAG];
263
247
  },
264
248
  type(annots) {
265
- let type = annots instanceof Map
266
- ? annots.get(this.ODATA_TYPE)
267
- : annots[this.ODATA_TYPE];
249
+ let type = annots instanceof Map ? annots.get(this.ODATA_TYPE) : annots[this.ODATA_TYPE];
268
250
  if (!type)
269
251
  return undefined;
270
252
  type = type.substring(1);
@@ -284,9 +266,7 @@ const ODataVersionBaseHelper = {
284
266
  : undefined;
285
267
  },
286
268
  count(annots) {
287
- return annots.has(this.ODATA_COUNT)
288
- ? Number(annots.get(this.ODATA_COUNT))
289
- : undefined;
269
+ return annots.has(this.ODATA_COUNT) ? Number(annots.get(this.ODATA_COUNT)) : undefined;
290
270
  },
291
271
  annotations(value) {
292
272
  const annots = new Map();
@@ -397,9 +377,7 @@ const ODataHelper = {
397
377
  //http://nb-mdp-dev01:57970/$metadata#SIU.Api.Infrastructure.Storage.Backend.SiuUrls
398
378
  context(annots) {
399
379
  let ctx = {};
400
- const str = annots instanceof Map
401
- ? annots.get(this.ODATA_CONTEXT)
402
- : annots[this.ODATA_CONTEXT];
380
+ const str = annots instanceof Map ? annots.get(this.ODATA_CONTEXT) : annots[this.ODATA_CONTEXT];
403
381
  if (typeof str === 'string') {
404
382
  let index = str.indexOf('$metadata');
405
383
  ctx.serviceRootUrl = str.substring(0, index);
@@ -454,9 +432,7 @@ const ODataHelper = {
454
432
  VALUE: 'value',
455
433
  context(annots) {
456
434
  let ctx = {};
457
- const str = annots instanceof Map
458
- ? annots.get(this.ODATA_CONTEXT)
459
- : annots[this.ODATA_CONTEXT];
435
+ const str = annots instanceof Map ? annots.get(this.ODATA_CONTEXT) : annots[this.ODATA_CONTEXT];
460
436
  if (typeof str === 'string') {
461
437
  let index = str.indexOf('$metadata');
462
438
  ctx.serviceRootUrl = str.substring(0, index);
@@ -554,11 +530,8 @@ const binary = (value) => ({
554
530
  type: QueryCustomTypes.Binary,
555
531
  value,
556
532
  });
557
- const isQueryCustomType = (value) => typeof value === 'object' &&
558
- 'type' in value &&
559
- value.type in QueryCustomTypes;
560
- const isRawType = (value) => isQueryCustomType(value) &&
561
- value.type === QueryCustomTypes.Raw;
533
+ const isQueryCustomType = (value) => typeof value === 'object' && 'type' in value && value.type in QueryCustomTypes;
534
+ const isRawType = (value) => isQueryCustomType(value) && value.type === QueryCustomTypes.Raw;
562
535
  const ITEM_ROOT = '';
563
536
  function builder ({ select, search, skiptoken, format, top, skip, filter, transform, compute, orderBy, key, count, expand, action, func, aliases, escape, } = {}) {
564
537
  const [path, params] = buildPathAndQuery({
@@ -732,14 +705,10 @@ function buildFilter(filters = {}, { aliases, propPrefix, escape, }) {
732
705
  propName = propPrefix;
733
706
  }
734
707
  else if (INDEXOF_REGEX.test(filterKey)) {
735
- propName = filterKey.replace(INDEXOF_REGEX, (_, $1) => $1.trim() === ITEM_ROOT
736
- ? `(${propPrefix})`
737
- : `(${propPrefix}/${$1.trim()})`);
708
+ propName = filterKey.replace(INDEXOF_REGEX, (_, $1) => $1.trim() === ITEM_ROOT ? `(${propPrefix})` : `(${propPrefix}/${$1.trim()})`);
738
709
  }
739
710
  else if (FUNCTION_REGEX.test(filterKey)) {
740
- propName = filterKey.replace(FUNCTION_REGEX, (_, $1) => $1.trim() === ITEM_ROOT
741
- ? `(${propPrefix})`
742
- : `(${propPrefix}/${$1.trim()})`);
711
+ propName = filterKey.replace(FUNCTION_REGEX, (_, $1) => $1.trim() === ITEM_ROOT ? `(${propPrefix})` : `(${propPrefix}/${$1.trim()})`);
743
712
  }
744
713
  else {
745
714
  propName = `${propPrefix}/${filterKey}`;
@@ -762,7 +731,7 @@ function buildFilter(filters = {}, { aliases, propPrefix, escape, }) {
762
731
  const builtFilters = value
763
732
  .map((v) => buildFilter(v, { aliases, propPrefix, escape }))
764
733
  .filter((f) => f)
765
- .map((f) => LOGICAL_OPERATORS.indexOf(op) !== -1 ? `(${f})` : f);
734
+ .map((f) => (LOGICAL_OPERATORS.indexOf(op) !== -1 ? `(${f})` : f));
766
735
  if (builtFilters.length) {
767
736
  if (LOGICAL_OPERATORS.indexOf(op) !== -1) {
768
737
  if (builtFilters.length) {
@@ -933,7 +902,7 @@ function escapeIllegalChars(string) {
933
902
  string = string.replace(/'/g, "''");
934
903
  return string;
935
904
  }
936
- function normalizeValue(value, { aliases, escape = false, } = {}) {
905
+ function normalizeValue(value, { aliases, escape = false } = {}) {
937
906
  if (typeof value === 'string') {
938
907
  return escape ? `'${escapeIllegalChars(value)}'` : `'${value}'`;
939
908
  }
@@ -944,9 +913,7 @@ function normalizeValue(value, { aliases, escape = false, } = {}) {
944
913
  return value;
945
914
  }
946
915
  else if (Array.isArray(value)) {
947
- return `[${value
948
- .map((d) => normalizeValue(d, { aliases, escape }))
949
- .join(',')}]`;
916
+ return `[${value.map((d) => normalizeValue(d, { aliases, escape })).join(',')}]`;
950
917
  }
951
918
  else if (value === null) {
952
919
  return value;
@@ -977,7 +944,7 @@ function normalizeValue(value, { aliases, escape = false, } = {}) {
977
944
  }
978
945
  return value;
979
946
  }
980
- function buildExpand(expands, { aliases, escape = false, }) {
947
+ function buildExpand(expands, { aliases, escape = false }) {
981
948
  if (isRawType(expands)) {
982
949
  return expands.value;
983
950
  }
@@ -1037,7 +1004,10 @@ function buildExpand(expands, { aliases, escape = false, }) {
1037
1004
  value = value.value;
1038
1005
  break;
1039
1006
  default:
1040
- value = buildExpand(expands[key], { aliases, escape });
1007
+ value = buildExpand(expands[key], {
1008
+ aliases,
1009
+ escape,
1010
+ });
1041
1011
  }
1042
1012
  return `$${key.toLowerCase()}=${value}`;
1043
1013
  })
@@ -1054,7 +1024,7 @@ function buildExpand(expands, { aliases, escape = false, }) {
1054
1024
  }
1055
1025
  return '';
1056
1026
  }
1057
- function buildTransforms(transforms, { aliases, escape = false, }) {
1027
+ function buildTransforms(transforms, { aliases, escape = false }) {
1058
1028
  // Wrap single object an array for simplified processing
1059
1029
  const transformsArray = Array.isArray(transforms) ? transforms : [transforms];
1060
1030
  const transformsResult = transformsArray.reduce((result, transform) => {
@@ -1104,7 +1074,7 @@ function buildAggregate(aggregate) {
1104
1074
  })
1105
1075
  .join(',');
1106
1076
  }
1107
- function buildGroupBy(groupBy, { aliases, escape = false, }) {
1077
+ function buildGroupBy(groupBy, { aliases, escape = false }) {
1108
1078
  if (!groupBy.properties) {
1109
1079
  throw new Error(`'properties' property required for groupBy`);
1110
1080
  }
@@ -1120,9 +1090,7 @@ function buildOrderBy(orderBy, prefix = '') {
1120
1090
  }
1121
1091
  else if (Array.isArray(orderBy)) {
1122
1092
  return orderBy
1123
- .map((value) => Array.isArray(value) &&
1124
- value.length === 2 &&
1125
- ['asc', 'desc'].indexOf(value[1]) !== -1
1093
+ .map((value) => Array.isArray(value) && value.length === 2 && ['asc', 'desc'].indexOf(value[1]) !== -1
1126
1094
  ? value.join(' ')
1127
1095
  : value)
1128
1096
  .map((v) => `${prefix}${v}`)
@@ -1136,11 +1104,9 @@ function buildOrderBy(orderBy, prefix = '') {
1136
1104
  }
1137
1105
  return `${prefix}${orderBy}`;
1138
1106
  }
1139
- function buildApply(apply, { aliases, escape = false, }) {
1107
+ function buildApply(apply, { aliases, escape = false }) {
1140
1108
  const applyArray = Array.isArray(apply) ? apply : [apply];
1141
- return applyArray
1142
- .map((v) => normalizeValue(v, { aliases, escape }))
1143
- .join('/');
1109
+ return applyArray.map((v) => normalizeValue(v, { aliases, escape })).join('/');
1144
1110
  }
1145
1111
  function buildUrl(path, params) {
1146
1112
  // This can be refactored using URL API. But IE does not support it.
@@ -1178,15 +1144,7 @@ const Durations = {
1178
1144
  }
1179
1145
  let duration = {};
1180
1146
  duration.sign = matches[1] === '-' ? -1 : 1;
1181
- return [
1182
- 'years',
1183
- 'months',
1184
- 'weeks',
1185
- 'days',
1186
- 'hours',
1187
- 'minutes',
1188
- 'seconds',
1189
- ].reduce((acc, name, index) => {
1147
+ return ['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds'].reduce((acc, name, index) => {
1190
1148
  const v = parseFloat(matches[index + 2]);
1191
1149
  if (!Number.isNaN(v))
1192
1150
  acc[name] = v;
@@ -1262,9 +1220,7 @@ const Enums = {
1262
1220
  value = value.split(',').map((o) => o.trim());
1263
1221
  }
1264
1222
  if (Array.isArray(value) && value.every((v) => v in enums)) {
1265
- return value
1266
- .filter((v) => enums[v])
1267
- .map((v) => this.toName(enums, v));
1223
+ return value.filter((v) => enums[v]).map((v) => this.toName(enums, v));
1268
1224
  }
1269
1225
  return [];
1270
1226
  },
@@ -1310,8 +1266,7 @@ const Types = {
1310
1266
  (Types.isMap(value) && !value.size) ||
1311
1267
  (Types.isArray(value) && !value.length) ||
1312
1268
  (Types.isFunction(value.isEmpty) && value.isEmpty()) ||
1313
- (Types.isArray(value) &&
1314
- value.every((v) => Types.isEmpty(v))) ||
1269
+ (Types.isArray(value) && value.every((v) => Types.isEmpty(v))) ||
1315
1270
  (Types.isPlainObject(value) &&
1316
1271
  !Object.keys(value).filter((k) => value.hasOwnProperty(k)).length));
1317
1272
  },
@@ -1522,7 +1477,7 @@ const Objects = {
1522
1477
  // Check if path is string or array. Regex : ensure that we do not have '.' and brackets.
1523
1478
  const pathArray = (Types.isArray(path) ? path : path.match(/([^[.\]])+/g));
1524
1479
  // Find value if exist return otherwise return undefined value;
1525
- return (pathArray.reduce((prevObj, key) => prevObj && prevObj[key], obj) || def);
1480
+ return pathArray.reduce((prevObj, key) => prevObj && prevObj[key], obj) || def;
1526
1481
  },
1527
1482
  unset(obj, path) {
1528
1483
  // Check if path is string or array. Regex : ensure that we do not have '.' and brackets.
@@ -1563,8 +1518,7 @@ const Objects = {
1563
1518
  const val1 = object1[key];
1564
1519
  const val2 = object2[key];
1565
1520
  const areObjects = Types.isPlainObject(val1) && Types.isPlainObject(val2);
1566
- if ((areObjects && !Objects.equal(val1, val2)) ||
1567
- (!areObjects && val1 !== val2)) {
1521
+ if ((areObjects && !Objects.equal(val1, val2)) || (!areObjects && val1 !== val2)) {
1568
1522
  return false;
1569
1523
  }
1570
1524
  }
@@ -1729,7 +1683,7 @@ function now() {
1729
1683
  return (glast = time > last ? time : last + 1);
1730
1684
  }
1731
1685
  const Strings = {
1732
- uniqueId({ prefix, suffix, } = {}) {
1686
+ uniqueId({ prefix, suffix } = {}) {
1733
1687
  return (prefix ? prefix : '') + now().toString(36) + (suffix ? suffix : '');
1734
1688
  },
1735
1689
  titleCase(text) {
@@ -1739,6 +1693,16 @@ const Strings = {
1739
1693
  .map((p) => p.charAt(0).toUpperCase() + p.slice(1))
1740
1694
  .join(' ');
1741
1695
  },
1696
+ hashCode(text) {
1697
+ if (!text || text.length === 0) {
1698
+ return 0;
1699
+ }
1700
+ let hash = 0;
1701
+ for (let i = 0; i < text.length; i++) {
1702
+ hash = Math.imul(hash, 31) + text.charCodeAt(i);
1703
+ }
1704
+ return hash;
1705
+ },
1742
1706
  };
1743
1707
 
1744
1708
  const Urls = {
@@ -1787,6 +1751,15 @@ class Expression {
1787
1751
  resolve(parser) {
1788
1752
  return parser;
1789
1753
  }
1754
+ toString() {
1755
+ return this.render({
1756
+ aliases: [],
1757
+ escape: true,
1758
+ prefix: '',
1759
+ parser: undefined,
1760
+ options: {},
1761
+ });
1762
+ }
1790
1763
  }
1791
1764
 
1792
1765
  class ODataAnnotation {
@@ -1950,14 +1923,10 @@ const ArrayBuffers = {
1950
1923
  // Core EdmTypeParserBuilder
1951
1924
  const EdmParser = (_d, _s, _e) => ({
1952
1925
  deserialize(value, options) {
1953
- return Array.isArray(value)
1954
- ? value.map((v) => _d(v, options))
1955
- : _d(value, options);
1926
+ return Array.isArray(value) ? value.map((v) => _d(v, options)) : _d(value, options);
1956
1927
  },
1957
1928
  serialize(value, options) {
1958
- return Array.isArray(value)
1959
- ? value.map((v) => _s(v, options))
1960
- : _s(value, options);
1929
+ return Array.isArray(value) ? value.map((v) => _s(v, options)) : _s(value, options);
1961
1930
  },
1962
1931
  encode(value, options) {
1963
1932
  return Array.isArray(value)
@@ -2089,8 +2058,7 @@ class ODataEnumTypeParser extends ODataAnnotatable {
2089
2058
  return [...this._fields.filter((f) => namesValue.includes(f.value))];
2090
2059
  if (typeof namesValue === 'number') {
2091
2060
  return [
2092
- ...this._fields.filter((f) => (this.flags && Boolean(f.value & namesValue)) ||
2093
- f.value === namesValue),
2061
+ ...this._fields.filter((f) => (this.flags && Boolean(f.value & namesValue)) || f.value === namesValue),
2094
2062
  ];
2095
2063
  }
2096
2064
  if (typeof namesValue === 'string') {
@@ -2142,9 +2110,7 @@ class ODataEnumTypeParser extends ODataAnnotatable {
2142
2110
  let name = this.field(value)?.name;
2143
2111
  if (name === undefined)
2144
2112
  name = `${value}`;
2145
- return !parserOptions?.stringAsEnum
2146
- ? `${this.namespace}.${this.name}'${name}'`
2147
- : name;
2113
+ return !parserOptions?.stringAsEnum ? `${this.namespace}.${this.name}'${name}'` : name;
2148
2114
  }
2149
2115
  }
2150
2116
  //Encode
@@ -2153,9 +2119,7 @@ class ODataEnumTypeParser extends ODataAnnotatable {
2153
2119
  const serialized = this.serialize(value, parserOptions);
2154
2120
  if (serialized === undefined)
2155
2121
  return undefined;
2156
- return parserOptions?.stringAsEnum
2157
- ? raw(`'${serialized}'`)
2158
- : raw(serialized);
2122
+ return parserOptions?.stringAsEnum ? raw(`'${serialized}'`) : raw(serialized);
2159
2123
  }
2160
2124
  // Json Schema
2161
2125
  toJsonSchema() {
@@ -2200,7 +2164,7 @@ class ODataEntityTypeKey {
2200
2164
  class ODataReferential {
2201
2165
  property;
2202
2166
  referencedProperty;
2203
- constructor({ property, referencedProperty, }) {
2167
+ constructor({ property, referencedProperty }) {
2204
2168
  this.property = property;
2205
2169
  this.referencedProperty = referencedProperty;
2206
2170
  }
@@ -2239,16 +2203,13 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
2239
2203
  if (this.collection && Array.isArray(value)) {
2240
2204
  errors = value.map((v) => this.validate(v, { method, navigation }));
2241
2205
  }
2242
- else if ((this.isStructuredType() &&
2243
- typeof value === 'object' &&
2244
- value !== null) ||
2206
+ else if ((this.isStructuredType() && typeof value === 'object' && value !== null) ||
2245
2207
  (this.navigation && value !== undefined)) {
2246
2208
  errors =
2247
2209
  this.structuredType().validate(value, { method, navigation }) ||
2248
2210
  {};
2249
2211
  }
2250
- else if (this.isEnumType() &&
2251
- (typeof value === 'string' || typeof value === 'number')) {
2212
+ else if (this.isEnumType() && (typeof value === 'string' || typeof value === 'number')) {
2252
2213
  errors = this.enumType().validate(value, { method, navigation });
2253
2214
  }
2254
2215
  else {
@@ -2275,9 +2236,7 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
2275
2236
  ? ODataHelper[options?.version || DEFAULT_VERSION].type(value)
2276
2237
  : undefined;
2277
2238
  if (type !== undefined) {
2278
- return parser
2279
- .childParser((c) => c.isTypeOf(type))
2280
- .deserialize(value, options);
2239
+ return parser.childParser((c) => c.isTypeOf(type)).deserialize(value, options);
2281
2240
  }
2282
2241
  return parser.deserialize(value, options);
2283
2242
  }
@@ -2301,9 +2260,7 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
2301
2260
  ? ODataHelper[options?.version || DEFAULT_VERSION].type(value)
2302
2261
  : undefined;
2303
2262
  if (type !== undefined) {
2304
- return parser
2305
- .childParser((c) => c.isTypeOf(type))
2306
- .serialize(value, options);
2263
+ return parser.childParser((c) => c.isTypeOf(type)).serialize(value, options);
2307
2264
  }
2308
2265
  return parser.serialize(value, options);
2309
2266
  }
@@ -2407,9 +2364,7 @@ class ODataStructuredTypeFieldParser extends ODataAnnotatable {
2407
2364
  }
2408
2365
  //#endregion
2409
2366
  isKey() {
2410
- return this.structured
2411
- .keys({ include_parents: true })
2412
- .some((k) => k.name === this.name);
2367
+ return this.structured.keys({ include_parents: true }).some((k) => k.name === this.name);
2413
2368
  }
2414
2369
  hasReferentials() {
2415
2370
  return this.referentials.length !== 0;
@@ -2489,7 +2444,7 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
2489
2444
  return false;
2490
2445
  }
2491
2446
  isSupertypeOf(type) {
2492
- return (this.isTypeOf(type) || this.children.some((c) => c.isSupertypeOf(type)));
2447
+ return this.isTypeOf(type) || this.children.some((c) => c.isSupertypeOf(type));
2493
2448
  }
2494
2449
  isOpenType() {
2495
2450
  return this.open;
@@ -2514,9 +2469,7 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
2514
2469
  const fields = this.fields({
2515
2470
  include_navigation: true,
2516
2471
  include_parents: true,
2517
- }).filter((f) => f.name in value &&
2518
- value[f.name] !== undefined &&
2519
- value[f.name] !== null);
2472
+ }).filter((f) => f.name in value && value[f.name] !== undefined && value[f.name] !== null);
2520
2473
  return {
2521
2474
  ...value,
2522
2475
  ...fields.reduce((acc, f) => ({
@@ -2531,9 +2484,7 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
2531
2484
  const fields = this.fields({
2532
2485
  include_navigation: true,
2533
2486
  include_parents: true,
2534
- }).filter((f) => f.name in value &&
2535
- value[f.name] !== undefined &&
2536
- value[f.name] !== null);
2487
+ }).filter((f) => f.name in value && value[f.name] !== undefined && value[f.name] !== null);
2537
2488
  return {
2538
2489
  ...value,
2539
2490
  ...fields.reduce((acc, f) => ({
@@ -2575,7 +2526,7 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
2575
2526
  * @param include_parents Include the parent fields
2576
2527
  * @returns The keys of the structured type
2577
2528
  */
2578
- keys({ include_parents, }) {
2529
+ keys({ include_parents }) {
2579
2530
  return [
2580
2531
  ...(include_parents && this.parent !== undefined
2581
2532
  ? this.parent.keys({ include_parents })
@@ -2584,8 +2535,7 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
2584
2535
  ];
2585
2536
  }
2586
2537
  isEntityType() {
2587
- return (this._keys !== undefined ||
2588
- (this.parent !== undefined && this.parent.isEntityType()));
2538
+ return this._keys !== undefined || (this.parent !== undefined && this.parent.isEntityType());
2589
2539
  }
2590
2540
  isComplexType() {
2591
2541
  return !this.isEntityType();
@@ -2624,15 +2574,12 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
2624
2574
  }
2625
2575
  return Object.keys(attrs)
2626
2576
  .filter((key) => fields.some((f) => f.name === key) ||
2627
- (key ==
2628
- ODataHelper[parserOptions?.version || DEFAULT_VERSION].ODATA_ETAG &&
2577
+ (key == ODataHelper[parserOptions?.version || DEFAULT_VERSION].ODATA_ETAG &&
2629
2578
  include_etag) ||
2630
- (key ==
2631
- ODataHelper[parserOptions?.version || DEFAULT_VERSION].ODATA_ID &&
2632
- include_id))
2579
+ (key == ODataHelper[parserOptions?.version || DEFAULT_VERSION].ODATA_ID && include_id))
2633
2580
  .reduce((acc, key) => Object.assign(acc, { [key]: attrs[key] }), {});
2634
2581
  }
2635
- resolveKey(value, { resolve = true, single = true, } = {}) {
2582
+ resolveKey(value, { resolve = true, single = true } = {}) {
2636
2583
  const keyTypes = this.keys({ include_parents: true });
2637
2584
  const key = new Map();
2638
2585
  for (var kt of keyTypes) {
@@ -2647,9 +2594,7 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
2647
2594
  .find((f) => f.name === name);
2648
2595
  if (field !== undefined) {
2649
2596
  v = Types.isPlainObject(v) ? v[field.name] : v;
2650
- structured = field.isStructuredType()
2651
- ? field.structuredType()
2652
- : undefined;
2597
+ structured = field.isStructuredType() ? field.structuredType() : undefined;
2653
2598
  }
2654
2599
  }
2655
2600
  if (field !== undefined && v !== undefined) {
@@ -2658,9 +2603,7 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
2658
2603
  }
2659
2604
  if (key.size === 0)
2660
2605
  return undefined;
2661
- return resolve
2662
- ? Objects.resolveKey(key, { single })
2663
- : Object.fromEntries(key);
2606
+ return resolve ? Objects.resolveKey(key, { single }) : Object.fromEntries(key);
2664
2607
  }
2665
2608
  defaults() {
2666
2609
  let fields = this.fields({
@@ -2669,9 +2612,7 @@ class ODataStructuredTypeParser extends ODataAnnotatable {
2669
2612
  }).filter((f) => f.default !== undefined || f.isStructuredType());
2670
2613
  return {
2671
2614
  ...fields.reduce((acc, f) => {
2672
- let value = f.isStructuredType()
2673
- ? f.structuredType().defaults()
2674
- : f.default;
2615
+ let value = f.isStructuredType() ? f.structuredType().defaults() : f.default;
2675
2616
  return Types.isEmpty(value) ? acc : { ...acc, [f.name]: value };
2676
2617
  }, {}),
2677
2618
  };
@@ -3055,8 +2996,7 @@ class ODataStructuredType extends ODataParserSchemaElement {
3055
2996
  * @returns True if the callable is type of the given type
3056
2997
  */
3057
2998
  isSubtypeOf(schema) {
3058
- return (super.isSubtypeOf(schema) ||
3059
- (this.parent !== undefined && this.parent.isSubtypeOf(schema)));
2999
+ return (super.isSubtypeOf(schema) || (this.parent !== undefined && this.parent.isSubtypeOf(schema)));
3060
3000
  }
3061
3001
  /**
3062
3002
  * Returns a boolean indicating if the structured type is a supertype of the given type.
@@ -3064,8 +3004,7 @@ class ODataStructuredType extends ODataParserSchemaElement {
3064
3004
  * @returns True if the callable is type of the given type
3065
3005
  */
3066
3006
  isSupertypeOf(schema) {
3067
- return (super.isSupertypeOf(schema) ||
3068
- this.children.some((c) => c.isSupertypeOf(schema)));
3007
+ return super.isSupertypeOf(schema) || this.children.some((c) => c.isSupertypeOf(schema));
3069
3008
  }
3070
3009
  /**
3071
3010
  * Returns a boolean indicating if the structured type has a simple key.
@@ -3130,9 +3069,8 @@ class ODataStructuredType extends ODataParserSchemaElement {
3130
3069
  * @returns The schema of the field
3131
3070
  */
3132
3071
  findParentSchemaForField(field) {
3133
- return this.findParentSchema((p) => p
3134
- .fields({ include_parents: false, include_navigation: true })
3135
- .find((f) => f === field) !== undefined);
3072
+ return this.findParentSchema((p) => p.fields({ include_parents: false, include_navigation: true }).find((f) => f === field) !==
3073
+ undefined);
3136
3074
  }
3137
3075
  /**
3138
3076
  * Picks the fields from attributes.
@@ -3250,8 +3188,7 @@ class ODataSchema extends ODataAnnotatable {
3250
3188
  this.containers = (config.containers ?? []).map((config) => new ODataEntityContainer(config, this));
3251
3189
  }
3252
3190
  isNamespaceOf(type) {
3253
- return (type.startsWith(this.namespace) ??
3254
- (this.alias && type.startsWith(this.alias)));
3191
+ return type.startsWith(this.namespace) ?? (this.alias && type.startsWith(this.alias));
3255
3192
  }
3256
3193
  get entitySets() {
3257
3194
  return this.containers.reduce((acc, container) => [...acc, ...container.entitySets], []);
@@ -3293,10 +3230,7 @@ class CountField {
3293
3230
  };
3294
3231
  }
3295
3232
  render({ aliases, escape, prefix, parser, options, }) {
3296
- const params = [
3297
- QueryOption.filter,
3298
- QueryOption.search,
3299
- ]
3233
+ const params = [QueryOption.filter, QueryOption.search]
3300
3234
  .filter((key) => !Types.isEmpty(this.values[key]))
3301
3235
  .reduce((acc, key) => {
3302
3236
  let value = this.values[key];
@@ -3482,9 +3416,7 @@ class FilterExpression extends Expression {
3482
3416
  this._children = [...this._children, ...node.children()];
3483
3417
  }
3484
3418
  else {
3485
- this._children.push(node instanceof FilterExpression && !node.negated()
3486
- ? syntax.group(node)
3487
- : node);
3419
+ this._children.push(node instanceof FilterExpression && !node.negated() ? syntax.group(node) : node);
3488
3420
  }
3489
3421
  return this;
3490
3422
  }
@@ -3653,9 +3585,7 @@ class SearchExpression extends Expression {
3653
3585
  this._children = [...this._children, ...node.children()];
3654
3586
  }
3655
3587
  else {
3656
- this._children.push(node instanceof SearchExpression && !node.negated()
3657
- ? syntax.group(node)
3658
- : node);
3588
+ this._children.push(node instanceof SearchExpression && !node.negated() ? syntax.group(node) : node);
3659
3589
  }
3660
3590
  return this;
3661
3591
  }
@@ -3740,9 +3670,7 @@ class GroupByTransformations extends Expression {
3740
3670
  });
3741
3671
  }
3742
3672
  render({ aliases, escape, prefix, parser, options, } = {}) {
3743
- const children = this._children.map((n) => typeof n !== 'string'
3744
- ? n.render({ aliases, escape, prefix, parser, options })
3745
- : n);
3673
+ const children = this._children.map((n) => typeof n !== 'string' ? n.render({ aliases, escape, prefix, parser, options }) : n);
3746
3674
  return `aggregate(${children
3747
3675
  .map((child, index) => !child
3748
3676
  ? `${this.methods[index]} as ${this.aliases[index]}`
@@ -3751,7 +3679,7 @@ class GroupByTransformations extends Expression {
3751
3679
  }
3752
3680
  clone() {
3753
3681
  return new GroupByTransformations({
3754
- children: this._children.map((c) => typeof c !== 'string' ? c.clone() : c),
3682
+ children: this._children.map((c) => (typeof c !== 'string' ? c.clone() : c)),
3755
3683
  methods: this.methods,
3756
3684
  aliases: this.aliases,
3757
3685
  });
@@ -4053,9 +3981,7 @@ class SelectExpression extends Expression {
4053
3981
  }
4054
3982
  render({ aliases, escape, prefix, parser, options, } = {}) {
4055
3983
  return this._children
4056
- .map((n) => typeof n === 'string'
4057
- ? n
4058
- : n.render({ aliases, escape, prefix, parser, options }))
3984
+ .map((n) => typeof n === 'string' ? n : n.render({ aliases, escape, prefix, parser, options }))
4059
3985
  .join(',');
4060
3986
  }
4061
3987
  clone() {
@@ -4217,10 +4143,17 @@ class ExpandExpression extends Expression {
4217
4143
  return this;
4218
4144
  }
4219
4145
  field(field, opts) {
4220
- let node = new ExpandField(field);
4146
+ // Find ExpandField by fieldKey or create a new one if not found
4147
+ let fieldKey = field.toString();
4148
+ let node = this._children.find((n) => n.toString() === fieldKey);
4149
+ if (node === undefined) {
4150
+ // If not found, create a new ExpandField
4151
+ node = new ExpandField(field);
4152
+ this._add(node);
4153
+ }
4221
4154
  if (opts !== undefined)
4222
4155
  opts(node);
4223
- return this._add(node);
4156
+ return this;
4224
4157
  }
4225
4158
  combine(expression) {
4226
4159
  return this._add(expression);
@@ -4251,18 +4184,18 @@ const FieldFactory = (names = []) => new Proxy({ _names: names }, {
4251
4184
  names: names,
4252
4185
  });
4253
4186
  }
4187
+ else if (key === 'toString') {
4188
+ return () => names.join('.');
4189
+ }
4254
4190
  else if (key === 'resolve') {
4255
- return (parser) => names.reduce((acc, name) => typeof name === 'string'
4256
- ? acc?.field(name)
4257
- : name?.resolve(parser), parser);
4191
+ return (parser) => names.reduce((acc, name) => typeof name === 'string' ? acc?.field(name) : name?.resolve(parser), parser);
4258
4192
  }
4259
4193
  else {
4260
4194
  return FieldFactory([...names, key]);
4261
4195
  }
4262
4196
  },
4263
4197
  has(target, key) {
4264
- return (['toJson', 'isField', 'clone', 'render', 'resolve'].includes(key) ||
4265
- key in target);
4198
+ return ['toJson', 'isField', 'clone', 'render', 'resolve'].includes(key) || key in target;
4266
4199
  },
4267
4200
  });
4268
4201
  const RenderableFactory = (value) => {
@@ -4311,8 +4244,7 @@ const RenderableFactory = (value) => {
4311
4244
  function applyMixins(derivedCtor, constructors) {
4312
4245
  constructors.forEach((baseCtor) => {
4313
4246
  Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
4314
- Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||
4315
- Object.create(null));
4247
+ Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null));
4316
4248
  });
4317
4249
  });
4318
4250
  }
@@ -4382,7 +4314,7 @@ class Function {
4382
4314
  return {
4383
4315
  $type: Types.rawType(this),
4384
4316
  name: this.name,
4385
- values: this.values.map((v) => Types.isObject(v) && 'toJson' in v ? v.toJson() : v),
4317
+ values: this.values.map((v) => (Types.isObject(v) && 'toJson' in v ? v.toJson() : v)),
4386
4318
  normalize: this.normalize,
4387
4319
  };
4388
4320
  }
@@ -4527,9 +4459,7 @@ class ArithmeticFunctions {
4527
4459
  class TypeFunctions {
4528
4460
  cast(left, type) {
4529
4461
  return FieldFactory([
4530
- type !== undefined
4531
- ? new Type('cast', type, left)
4532
- : new Type('cast', left),
4462
+ type !== undefined ? new Type('cast', type, left) : new Type('cast', left),
4533
4463
  ]);
4534
4464
  }
4535
4465
  isof(left, type) {
@@ -4570,7 +4500,7 @@ class Operator {
4570
4500
  return {
4571
4501
  $type: Types.rawType(this),
4572
4502
  op: this.op,
4573
- values: this.values.map((v) => Types.isObject(v) && 'toJson' in v ? v.toJson() : v),
4503
+ values: this.values.map((v) => (Types.isObject(v) && 'toJson' in v ? v.toJson() : v)),
4574
4504
  normalize: this.normalize,
4575
4505
  };
4576
4506
  }
@@ -4879,17 +4809,14 @@ class Type {
4879
4809
  let [left, right] = encode([this.value], parser, options);
4880
4810
  value = render(left, { aliases, escape, prefix, parser, options });
4881
4811
  }
4882
- return value
4883
- ? `${this.name}(${value}, '${this.type}')`
4884
- : `${this.name}('${this.type}')`;
4812
+ return value ? `${this.name}(${value}, '${this.type}')` : `${this.name}('${this.type}')`;
4885
4813
  }
4886
4814
  clone() {
4887
4815
  return new Type(this.name, this.type, Objects.clone(this.value));
4888
4816
  }
4889
4817
  resolve(parser) {
4890
4818
  parser =
4891
- parser instanceof ODataStructuredTypeFieldParser &&
4892
- parser.isStructuredType()
4819
+ parser instanceof ODataStructuredTypeFieldParser && parser.isStructuredType()
4893
4820
  ? parser.structuredType()
4894
4821
  : parser;
4895
4822
  return parser?.findChildParser((p) => p.isTypeOf(this.type));
@@ -4911,7 +4838,7 @@ class Lambda {
4911
4838
  return {
4912
4839
  $type: Types.rawType(this),
4913
4840
  op: this.op,
4914
- values: this.values.map((v) => Types.isObject(v) && 'toJson' in v ? v.toJson() : v),
4841
+ values: this.values.map((v) => (Types.isObject(v) && 'toJson' in v ? v.toJson() : v)),
4915
4842
  alias: this.alias,
4916
4843
  };
4917
4844
  }
@@ -4979,11 +4906,7 @@ applyMixins(ODataTransformations, [Transformations]);
4979
4906
  const transformations = new ODataTransformations();
4980
4907
  class ODataSyntax {
4981
4908
  }
4982
- applyMixins(ODataSyntax, [
4983
- ODataOperators,
4984
- ODataFunctions,
4985
- ODataTransformations,
4986
- ]);
4909
+ applyMixins(ODataSyntax, [ODataOperators, ODataFunctions, ODataTransformations]);
4987
4910
  const syntax = new ODataSyntax();
4988
4911
 
4989
4912
  class ComputeExpression extends Expression {
@@ -5015,9 +4938,7 @@ class ComputeExpression extends Expression {
5015
4938
  }
5016
4939
  render({ aliases, escape, prefix, parser, options, } = {}) {
5017
4940
  const children = this._children.map((n) => n.render({ aliases, escape, prefix, parser, options }));
5018
- return this.names
5019
- .map((name, index) => `${children[index]} as ${name}`)
5020
- .join(',');
4941
+ return this.names.map((name, index) => `${children[index]} as ${name}`).join(',');
5021
4942
  }
5022
4943
  clone() {
5023
4944
  return new ComputeExpression({
@@ -5098,8 +5019,7 @@ class ODataQueryOptionHandler {
5098
5019
  remove(value) {
5099
5020
  this.o.set(this.n, this.assertArray().filter((v) => v !== value));
5100
5021
  // If only one and not is array... down to value
5101
- if (this.o.get(this.n).length === 1 &&
5102
- !Types.isArray(this.o.get(this.n)[0]))
5022
+ if (this.o.get(this.n).length === 1 && !Types.isArray(this.o.get(this.n)[0]))
5103
5023
  this.o.set(this.n, this.o.get(this.n)[0]);
5104
5024
  }
5105
5025
  /**
@@ -5122,8 +5042,7 @@ class ODataQueryOptionHandler {
5122
5042
  //#endregion
5123
5043
  //#region HashMap Value
5124
5044
  assertObject(create) {
5125
- if (!Types.isArray(this.o.get(this.n)) &&
5126
- Types.isPlainObject(this.o.get(this.n))) {
5045
+ if (!Types.isArray(this.o.get(this.n)) && Types.isPlainObject(this.o.get(this.n))) {
5127
5046
  return this.o.get(this.n);
5128
5047
  }
5129
5048
  let arr = this.assertArray();
@@ -5191,7 +5110,7 @@ class ODataQueryOptionHandler {
5191
5110
  clear() {
5192
5111
  this.o.delete(this.n);
5193
5112
  }
5194
- toString({ escape, parser, } = {}) {
5113
+ toString({ escape, parser } = {}) {
5195
5114
  const [_, params] = pathAndParamsFromQueryOptions(new Map([[this.n, this.o.get(this.n)]]), { escape, parser });
5196
5115
  return params[`$${this.n}`];
5197
5116
  }
@@ -5562,7 +5481,7 @@ class ODataQueryOptionsHandler {
5562
5481
  fromJson(json) {
5563
5482
  this.options.fromJson(json);
5564
5483
  }
5565
- toString({ escape, parser, } = {}) {
5484
+ toString({ escape, parser } = {}) {
5566
5485
  return this.options.toString({ escape, parser });
5567
5486
  }
5568
5487
  pathAndParams({ escape, parser, options, } = {}) {
@@ -5597,8 +5516,7 @@ const pathAndParamsFromQueryOptions = (values, { escape, parser, options, } = {}
5597
5516
  .reduce((acc, key) => {
5598
5517
  let value = values.get(key);
5599
5518
  if (Types.rawType(value).endsWith('Expression') ||
5600
- (Types.isArray(value) &&
5601
- value.some((v) => Types.rawType(v).endsWith('Expression')))) {
5519
+ (Types.isArray(value) && value.some((v) => Types.rawType(v).endsWith('Expression')))) {
5602
5520
  value = Types.isArray(value)
5603
5521
  ? value.map((v) => Types.rawType(v).endsWith('Expression')
5604
5522
  ? raw(v.render({ aliases, escape, parser, options }))
@@ -5626,7 +5544,7 @@ class ODataQueryOptions {
5626
5544
  options,
5627
5545
  });
5628
5546
  }
5629
- toString({ escape, parser, } = {}) {
5547
+ toString({ escape, parser } = {}) {
5630
5548
  const [path, params] = this.pathAndParams({ escape, parser });
5631
5549
  return (path +
5632
5550
  Object.entries(params)
@@ -5800,8 +5718,7 @@ function pathSegmentsBuilder(segment, escape = false, parser, options) {
5800
5718
  path = path.slice(1);
5801
5719
  }
5802
5720
  // HACK: Remove parenthesis
5803
- if (path.endsWith('()') &&
5804
- options?.nonParenthesisForEmptyParameterFunction) {
5721
+ if (path.endsWith('()') && options?.nonParenthesisForEmptyParameterFunction) {
5805
5722
  path = path.substring(0, path.length - 2);
5806
5723
  }
5807
5724
  return [path, params];
@@ -5904,11 +5821,7 @@ class ODataPathSegments {
5904
5821
  segments({ key = false } = {}) {
5905
5822
  let segments = [...this._segments];
5906
5823
  if (key)
5907
- segments = segments.filter((s) => [
5908
- PathSegment.entitySet,
5909
- PathSegment.navigationProperty,
5910
- PathSegment.property,
5911
- ].indexOf(s.name) !== -1);
5824
+ segments = segments.filter((s) => [PathSegment.entitySet, PathSegment.navigationProperty, PathSegment.property].indexOf(s.name) !== -1);
5912
5825
  return segments.map((s) => new SegmentHandler(s));
5913
5826
  }
5914
5827
  first({ key = false } = {}) {
@@ -5961,9 +5874,7 @@ class ODataRequest {
5961
5874
  if (this._body !== null)
5962
5875
  this._body = this.resource.serialize(this._body, init.parserOptions);
5963
5876
  this.withCredentials =
5964
- init.withCredentials === undefined
5965
- ? this.api.options.withCredentials
5966
- : init.withCredentials;
5877
+ init.withCredentials === undefined ? this.api.options.withCredentials : init.withCredentials;
5967
5878
  this.fetchPolicy = init.fetchPolicy || this.api.options.fetchPolicy;
5968
5879
  this.bodyQueryOptions = [
5969
5880
  ...(this.api.options.bodyQueryOptions || []),
@@ -5975,11 +5886,9 @@ class ODataRequest {
5975
5886
  //#region Headers
5976
5887
  const customHeaders = {};
5977
5888
  if (typeof init.etag === 'string') {
5978
- if (this.api.options.etag.ifMatch &&
5979
- ['PUT', 'PATCH', 'DELETE'].indexOf(this._method) !== -1)
5889
+ if (this.api.options.etag.ifMatch && ['PUT', 'PATCH', 'DELETE'].indexOf(this._method) !== -1)
5980
5890
  customHeaders[IF_MATCH_HEADER] = init.etag;
5981
- else if (this.api.options.etag.ifNoneMatch &&
5982
- ['GET'].indexOf(this._method) !== -1)
5891
+ else if (this.api.options.etag.ifNoneMatch && ['GET'].indexOf(this._method) !== -1)
5983
5892
  customHeaders[IF_NONE_MATCH_HEADER] = init.etag;
5984
5893
  }
5985
5894
  const accept = [];
@@ -6007,20 +5916,17 @@ class ODataRequest {
6007
5916
  ['POST', 'PUT', 'PATCH'].indexOf(this._method) !== -1)
6008
5917
  prefer.push(`return=${this.api.options.prefer?.return}`);
6009
5918
  // MaxPageSize
6010
- if (this.api.options.prefer?.maxPageSize !== undefined &&
6011
- ['GET'].indexOf(this._method) !== -1)
5919
+ if (this.api.options.prefer?.maxPageSize !== undefined && ['GET'].indexOf(this._method) !== -1)
6012
5920
  prefer.push(`odata.maxpagesize=${this.api.options.prefer?.maxPageSize}`);
6013
5921
  // Annotations
6014
5922
  if (this.api.options.prefer?.includeAnnotations !== undefined &&
6015
5923
  ['GET'].indexOf(this._method) !== -1)
6016
5924
  prefer.push(`odata.include-annotations=${this.api.options.prefer?.includeAnnotations}`);
6017
5925
  // Omit Null Values
6018
- if (this.api.options.prefer?.omitNullValues === true &&
6019
- ['GET'].indexOf(this._method) !== -1)
5926
+ if (this.api.options.prefer?.omitNullValues === true && ['GET'].indexOf(this._method) !== -1)
6020
5927
  prefer.push(`omit-values=nulls`);
6021
5928
  // Continue on Error
6022
- if (this.api.options.prefer?.continueOnError === true &&
6023
- ['POST'].indexOf(this._method) !== -1)
5929
+ if (this.api.options.prefer?.continueOnError === true && ['POST'].indexOf(this._method) !== -1)
6024
5930
  prefer.push(`odata.continue-on-error`);
6025
5931
  if (prefer.length > 0)
6026
5932
  customHeaders[PREFER] = prefer;
@@ -6028,8 +5934,7 @@ class ODataRequest {
6028
5934
  //#endregion
6029
5935
  //#region Params
6030
5936
  const customParams = {};
6031
- if (['POST', 'PUT', 'PATCH'].indexOf(this._method) !== -1 &&
6032
- '$select' in resourceParams) {
5937
+ if (['POST', 'PUT', 'PATCH'].indexOf(this._method) !== -1 && '$select' in resourceParams) {
6033
5938
  customParams['$select'] = resourceParams['$select'];
6034
5939
  }
6035
5940
  if (['POST'].indexOf(this._method) !== -1 && '$expand' in resourceParams) {
@@ -6041,13 +5946,7 @@ class ODataRequest {
6041
5946
  const params = Http.mergeHttpParams(this.api.options.params, customParams, init.params || {});
6042
5947
  this._params =
6043
5948
  this._responseType === 'entity'
6044
- ? Http.withoutHttpParams(params, [
6045
- '$filter',
6046
- '$orderby',
6047
- '$count',
6048
- '$skip',
6049
- '$top',
6050
- ])
5949
+ ? Http.withoutHttpParams(params, ['$filter', '$orderby', '$count', '$skip', '$top'])
6051
5950
  : params;
6052
5951
  //#endregion
6053
5952
  }
@@ -6109,9 +6008,7 @@ class ODataRequest {
6109
6008
  : this._headers;
6110
6009
  }
6111
6010
  get pathWithParams() {
6112
- return this.params.keys().length > 0
6113
- ? `${this.path}?${this.params}`
6114
- : this.path;
6011
+ return this.params.keys().length > 0 ? `${this.path}?${this.params}` : this.path;
6115
6012
  }
6116
6013
  get url() {
6117
6014
  return `${this.api.serviceRootUrl}${this.path}`;
@@ -6120,9 +6017,7 @@ class ODataRequest {
6120
6017
  return `${this.api.serviceRootUrl}${this.pathWithParams}`;
6121
6018
  }
6122
6019
  get cacheKey() {
6123
- return this._params.keys().length > 0
6124
- ? `${this._path}?${this._params}`
6125
- : this._path;
6020
+ return this._params.keys().length > 0 ? `${this._path}?${this._params}` : this._path;
6126
6021
  }
6127
6022
  isQueryBody() {
6128
6023
  return (this._method === 'GET' &&
@@ -6322,9 +6217,7 @@ class ODataResource {
6322
6217
  const parser = this.__parser(value, options, resourceType, bindingType);
6323
6218
  return parser !== undefined ? parser.deserialize(value, options) : value;
6324
6219
  };
6325
- return Array.isArray(value)
6326
- ? value.map((v) => _d(v, options))
6327
- : _d(value, options);
6220
+ return Array.isArray(value) ? value.map((v) => _d(v, options)) : _d(value, options);
6328
6221
  }
6329
6222
  serialize(value, options) {
6330
6223
  const resourceType = this.outgoingType();
@@ -6333,9 +6226,7 @@ class ODataResource {
6333
6226
  const parser = this.__parser(value, options, resourceType, bindingType);
6334
6227
  return parser !== undefined ? parser.serialize(value, options) : value;
6335
6228
  };
6336
- return Array.isArray(value)
6337
- ? value.map((v) => _s(v, options))
6338
- : _s(value, options);
6229
+ return Array.isArray(value) ? value.map((v) => _s(v, options)) : _s(value, options);
6339
6230
  }
6340
6231
  encode(value, options) {
6341
6232
  const resourceType = this.outgoingType();
@@ -6344,9 +6235,7 @@ class ODataResource {
6344
6235
  const parser = this.__parser(value, options, resourceType, bindingType);
6345
6236
  return parser !== undefined ? parser.encode(value, options) : value;
6346
6237
  };
6347
- return Array.isArray(value)
6348
- ? value.map((v) => _e(v, options))
6349
- : _e(value, options);
6238
+ return Array.isArray(value) ? value.map((v) => _e(v, options)) : _e(value, options);
6350
6239
  }
6351
6240
  toJson() {
6352
6241
  return {
@@ -6523,9 +6412,7 @@ class ODataActionResource extends ODataResource {
6523
6412
  * @returns Observable of the result of the action
6524
6413
  */
6525
6414
  callModel(params, options = {}) {
6526
- return this.call(params, { responseType: 'entity', ...options }).pipe(map(({ entity, annots }) => entity
6527
- ? this.asModel(entity, { annots, ModelType: options?.ModelType })
6528
- : null));
6415
+ return this.call(params, { responseType: 'entity', ...options }).pipe(map(({ entity, annots }) => entity ? this.asModel(entity, { annots, ModelType: options?.ModelType }) : null));
6529
6416
  }
6530
6417
  /**
6531
6418
  * Execute the action and return the result as a entities
@@ -6600,9 +6487,7 @@ class ODataBatchRequest extends Subject {
6600
6487
  let headers = this.request.headers;
6601
6488
  res = [
6602
6489
  ...res,
6603
- ...headers
6604
- .keys()
6605
- .map((key) => `${key}: ${(headers.getAll(key) || []).join(',')}`),
6490
+ ...headers.keys().map((key) => `${key}: ${(headers.getAll(key) || []).join(',')}`),
6606
6491
  ];
6607
6492
  }
6608
6493
  if (this.request.method === 'GET' || this.request.method === 'DELETE') {
@@ -6617,9 +6502,7 @@ class ODataBatchRequest extends Subject {
6617
6502
  let res = {
6618
6503
  id: this.id,
6619
6504
  method: this.request.method,
6620
- url: relativeUrls
6621
- ? this.request.pathWithParams
6622
- : this.request.urlWithParams,
6505
+ url: relativeUrls ? this.request.pathWithParams : this.request.urlWithParams,
6623
6506
  //'atomicityGroup': this.group
6624
6507
  //"dependsOn": ["g1", "g2", "r2"]
6625
6508
  };
@@ -7122,7 +7005,7 @@ class ODataFunctionResource extends ODataResource {
7122
7005
  responseType: 'entity',
7123
7006
  alias,
7124
7007
  ...options,
7125
- }).pipe(map(({ entity, annots }) => entity ? this.asModel(entity, { annots, ModelType }) : null));
7008
+ }).pipe(map(({ entity, annots }) => (entity ? this.asModel(entity, { annots, ModelType }) : null)));
7126
7009
  }
7127
7010
  /**
7128
7011
  * Execute the function with the given parameters and return the result as a entities
@@ -7150,9 +7033,7 @@ class ODataFunctionResource extends ODataResource {
7150
7033
  responseType: 'entities',
7151
7034
  alias,
7152
7035
  ...options,
7153
- }).pipe(map(({ entities, annots }) => entities
7154
- ? this.asCollection(entities, { annots, CollectionType })
7155
- : null));
7036
+ }).pipe(map(({ entities, annots }) => entities ? this.asCollection(entities, { annots, CollectionType }) : null));
7156
7037
  }
7157
7038
  //#endregion
7158
7039
  callArraybuffer(params, { alias, ...options } = {}) {
@@ -7217,9 +7098,7 @@ class ODataValueResource extends ODataResource {
7217
7098
  }
7218
7099
  static fromResource(resource) {
7219
7100
  const baseType = resource.outgoingType();
7220
- let baseSchema = baseType !== undefined
7221
- ? resource.api.structuredType(baseType)
7222
- : undefined;
7101
+ let baseSchema = baseType !== undefined ? resource.api.structuredType(baseType) : undefined;
7223
7102
  const value = ODataValueResource.factory(resource.api, {
7224
7103
  segments: resource.cloneSegments(),
7225
7104
  });
@@ -7266,17 +7145,12 @@ class ODataPropertyResource extends ODataResource {
7266
7145
  }
7267
7146
  static fromResource(resource, path) {
7268
7147
  const baseType = resource.outgoingType();
7269
- let baseSchema = baseType !== undefined
7270
- ? resource.api.structuredType(baseType)
7271
- : undefined;
7148
+ let baseSchema = baseType !== undefined ? resource.api.structuredType(baseType) : undefined;
7272
7149
  let fieldType;
7273
7150
  if (baseSchema !== undefined) {
7274
7151
  const field = baseSchema.field(path);
7275
7152
  fieldType = field?.type;
7276
- baseSchema =
7277
- field !== undefined
7278
- ? baseSchema.findParentSchemaForField(field)
7279
- : undefined;
7153
+ baseSchema = field !== undefined ? baseSchema.findParentSchemaForField(field) : undefined;
7280
7154
  }
7281
7155
  const property = ODataPropertyResource.factory(resource.api, {
7282
7156
  path,
@@ -7370,9 +7244,7 @@ class ODataPropertyResource extends ODataResource {
7370
7244
  return this.fetch({ responseType: 'entity', ...options }).pipe(map(({ entity }) => entity));
7371
7245
  }
7372
7246
  fetchModel(options = {}) {
7373
- return this.fetch({ responseType: 'entity', ...options }).pipe(map(({ entity, annots }) => entity
7374
- ? this.asModel(entity, { annots, ModelType: options?.ModelType })
7375
- : null));
7247
+ return this.fetch({ responseType: 'entity', ...options }).pipe(map(({ entity, annots }) => entity ? this.asModel(entity, { annots, ModelType: options?.ModelType }) : null));
7376
7248
  }
7377
7249
  /**
7378
7250
  * Fetch the entities
@@ -7406,7 +7278,7 @@ class ODataPropertyResource extends ODataResource {
7406
7278
  }
7407
7279
  return res.fetch({ responseType: 'entities', ...options });
7408
7280
  };
7409
- return fetch({ top }).pipe(expand(({ annots }) => annots.skip || annots.skiptoken ? fetch(annots) : EMPTY), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
7281
+ return fetch({ top }).pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
7410
7282
  entities: [...(acc.entities || []), ...(entities || [])],
7411
7283
  annots: acc.annots.union(annots),
7412
7284
  })));
@@ -7426,7 +7298,7 @@ class ODataPropertyResource extends ODataResource {
7426
7298
  }
7427
7299
  return res.fetch({ responseType: 'entities', ...options });
7428
7300
  };
7429
- return fetch().pipe(expand(({ annots }) => annots.skip || annots.skiptoken ? fetch(annots) : EMPTY), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
7301
+ return fetch().pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
7430
7302
  entities: [...(acc.entities || []), ...(entities || [])],
7431
7303
  annots: acc.annots.union(annots),
7432
7304
  })));
@@ -7535,17 +7407,12 @@ class ODataNavigationPropertyResource extends ODataResource {
7535
7407
  }
7536
7408
  static fromResource(resource, path) {
7537
7409
  const baseType = resource.outgoingType();
7538
- let baseSchema = baseType !== undefined
7539
- ? resource.api.structuredType(baseType)
7540
- : undefined;
7410
+ let baseSchema = baseType !== undefined ? resource.api.structuredType(baseType) : undefined;
7541
7411
  let fieldType;
7542
7412
  if (baseSchema !== undefined) {
7543
7413
  const field = baseSchema.field(path);
7544
7414
  fieldType = field?.type;
7545
- baseSchema =
7546
- field !== undefined
7547
- ? baseSchema.findParentSchemaForField(field)
7548
- : undefined;
7415
+ baseSchema = field !== undefined ? baseSchema.findParentSchemaForField(field) : undefined;
7549
7416
  }
7550
7417
  const navigation = ODataNavigationPropertyResource.factory(resource.api, {
7551
7418
  path,
@@ -7612,9 +7479,7 @@ class ODataNavigationPropertyResource extends ODataResource {
7612
7479
  const thisType = this.incomingType();
7613
7480
  const baseSchema = thisType !== undefined ? this.api.structuredType(thisType) : undefined;
7614
7481
  const castSchema = this.api.findStructuredType(type);
7615
- if (castSchema !== undefined &&
7616
- baseSchema !== undefined &&
7617
- !castSchema.isSubtypeOf(baseSchema))
7482
+ if (castSchema !== undefined && baseSchema !== undefined && !castSchema.isSubtypeOf(baseSchema))
7618
7483
  throw new Error(`Cannot cast to ${type}`);
7619
7484
  const segments = this.cloneSegments();
7620
7485
  segments.add(PathSegment.type, type).incomingType(type);
@@ -7690,9 +7555,7 @@ class ODataNavigationPropertyResource extends ODataResource {
7690
7555
  return this.fetch({ responseType: 'entity', ...options }).pipe(map(({ entity }) => entity));
7691
7556
  }
7692
7557
  fetchModel(options = {}) {
7693
- return this.fetch({ responseType: 'entity', ...options }).pipe(map(({ entity, annots }) => entity
7694
- ? this.asModel(entity, { annots, ModelType: options?.ModelType })
7695
- : null));
7558
+ return this.fetch({ responseType: 'entity', ...options }).pipe(map(({ entity, annots }) => entity ? this.asModel(entity, { annots, ModelType: options?.ModelType }) : null));
7696
7559
  }
7697
7560
  /**
7698
7561
  * Fetch entities
@@ -7725,7 +7588,7 @@ class ODataNavigationPropertyResource extends ODataResource {
7725
7588
  }
7726
7589
  return res.fetch({ responseType: 'entities', ...options });
7727
7590
  };
7728
- return fetch().pipe(expand(({ annots }) => annots.skip || annots.skiptoken ? fetch(annots) : EMPTY), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
7591
+ return fetch().pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
7729
7592
  entities: [...(acc.entities || []), ...(entities || [])],
7730
7593
  annots: acc.annots.union(annots),
7731
7594
  })));
@@ -7739,7 +7602,7 @@ class ODataNavigationPropertyResource extends ODataResource {
7739
7602
  }
7740
7603
  return res.fetch({ responseType: 'entities', ...options });
7741
7604
  };
7742
- return fetch({ top }).pipe(expand(({ annots }) => annots.skip || annots.skiptoken ? fetch(annots) : EMPTY), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
7605
+ return fetch({ top }).pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities || [], annots })), reduce((acc, { entities, annots }) => ({
7743
7606
  entities: [...(acc.entities || []), ...(entities || [])],
7744
7607
  annots: acc.annots.union(annots),
7745
7608
  })));
@@ -7801,9 +7664,7 @@ class ODataEntityResource extends ODataResource {
7801
7664
  const baseSchema = thisType !== undefined ? this.api.structuredType(thisType) : undefined;
7802
7665
  // Downcast
7803
7666
  const castSchema = baseSchema?.findChildSchema((s) => s.type() === type);
7804
- if (castSchema !== undefined &&
7805
- baseSchema !== undefined &&
7806
- !castSchema.isSubtypeOf(baseSchema))
7667
+ if (castSchema !== undefined && baseSchema !== undefined && !castSchema.isSubtypeOf(baseSchema))
7807
7668
  throw new Error(`cast: Cannot cast to ${type}`);
7808
7669
  const segments = this.cloneSegments();
7809
7670
  segments.add(PathSegment.type, type).incomingType(type);
@@ -7851,9 +7712,7 @@ class ODataEntityResource extends ODataResource {
7851
7712
  return this.fetch(options).pipe(map(({ entity }) => entity));
7852
7713
  }
7853
7714
  fetchModel(options) {
7854
- return this.fetch(options).pipe(map(({ entity, annots }) => entity
7855
- ? this.asModel(entity, { annots, ModelType: options?.ModelType })
7856
- : null));
7715
+ return this.fetch(options).pipe(map(({ entity, annots }) => entity ? this.asModel(entity, { annots, ModelType: options?.ModelType }) : null));
7857
7716
  }
7858
7717
  }
7859
7718
 
@@ -7904,9 +7763,7 @@ class ODataEntitySetResource extends ODataResource {
7904
7763
  const thisType = this.incomingType();
7905
7764
  const baseSchema = thisType !== undefined ? this.api.structuredType(thisType) : undefined;
7906
7765
  const castSchema = this.api.findStructuredType(type);
7907
- if (castSchema !== undefined &&
7908
- baseSchema !== undefined &&
7909
- !castSchema.isSubtypeOf(baseSchema))
7766
+ if (castSchema !== undefined && baseSchema !== undefined && !castSchema.isSubtypeOf(baseSchema))
7910
7767
  throw new Error(`cast: Cannot cast to ${type}`);
7911
7768
  const segments = this.cloneSegments();
7912
7769
  segments.add(PathSegment.type, type).incomingType(type);
@@ -7940,7 +7797,7 @@ class ODataEntitySetResource extends ODataResource {
7940
7797
  }
7941
7798
  return res.fetch(options);
7942
7799
  };
7943
- return fetch().pipe(expand(({ annots }) => annots.skip || annots.skiptoken ? fetch(annots) : EMPTY), map(({ entities, annots }) => ({ entities: entities ?? [], annots })), reduce((acc, { entities, annots }) => ({
7800
+ return fetch().pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities ?? [], annots })), reduce((acc, { entities, annots }) => ({
7944
7801
  entities: [...(acc.entities ?? []), ...(entities ?? [])],
7945
7802
  annots: acc.annots.union(annots),
7946
7803
  })));
@@ -7953,7 +7810,7 @@ class ODataEntitySetResource extends ODataResource {
7953
7810
  }
7954
7811
  return res.fetch(options);
7955
7812
  };
7956
- return fetch({ top }).pipe(expand(({ annots }) => annots.skip || annots.skiptoken ? fetch(annots) : EMPTY), map(({ entities, annots }) => ({ entities: entities ?? [], annots })), reduce((acc, { entities, annots }) => ({
7813
+ return fetch({ top }).pipe(expand(({ annots }) => (annots.skip || annots.skiptoken ? fetch(annots) : EMPTY)), map(({ entities, annots }) => ({ entities: entities ?? [], annots })), reduce((acc, { entities, annots }) => ({
7957
7814
  entities: [...(acc.entities ?? []), ...(entities ?? [])],
7958
7815
  annots: acc.annots.union(annots),
7959
7816
  })));
@@ -8162,8 +8019,7 @@ class CsdlCollection {
8162
8019
  if (Array.isArray(this.PropertyPath) && this.PropertyPath.length > 0) {
8163
8020
  json['PropertyPath'] = this.PropertyPath.map((p) => p.toJson());
8164
8021
  }
8165
- if (Array.isArray(this.NavigationPropertyPath) &&
8166
- this.NavigationPropertyPath.length > 0) {
8022
+ if (Array.isArray(this.NavigationPropertyPath) && this.NavigationPropertyPath.length > 0) {
8167
8023
  json['NavigationPropertyPath'] = this.NavigationPropertyPath.map((p) => p.toJson());
8168
8024
  }
8169
8025
  return json;
@@ -8267,8 +8123,7 @@ class CsdlReference extends CsdlAnnotable {
8267
8123
  if (Array.isArray(this.Include) && this.Include.length > 0) {
8268
8124
  json['Include'] = this.Include.map((i) => i.toJson());
8269
8125
  }
8270
- if (Array.isArray(this.IncludeAnnotations) &&
8271
- this.IncludeAnnotations.length > 0) {
8126
+ if (Array.isArray(this.IncludeAnnotations) && this.IncludeAnnotations.length > 0) {
8272
8127
  json['IncludeAnnotations'] = this.IncludeAnnotations.map((i) => i.toJson());
8273
8128
  }
8274
8129
  return json;
@@ -8424,7 +8279,7 @@ class CsdlEnumType extends CsdlAnnotable {
8424
8279
  class CsdlMember extends CsdlAnnotable {
8425
8280
  Name;
8426
8281
  Value;
8427
- constructor({ Name, Value, Annotation, }) {
8282
+ constructor({ Name, Value, Annotation }) {
8428
8283
  super({ Annotation });
8429
8284
  this.Name = Name;
8430
8285
  this.Value = Value;
@@ -8539,8 +8394,7 @@ class CsdlNavigationProperty extends CsdlStructuralProperty {
8539
8394
  if (this.ContainsTarget !== undefined) {
8540
8395
  json['ContainsTarget'] = this.ContainsTarget;
8541
8396
  }
8542
- if (Array.isArray(this.ReferentialConstraints) &&
8543
- this.ReferentialConstraints.length > 0) {
8397
+ if (Array.isArray(this.ReferentialConstraints) && this.ReferentialConstraints.length > 0) {
8544
8398
  json['ReferentialConstraints'] = this.ReferentialConstraints.map((r) => r.toJson());
8545
8399
  }
8546
8400
  if (this.OnDelete !== undefined) {
@@ -8566,7 +8420,7 @@ class CsdlNavigationProperty extends CsdlStructuralProperty {
8566
8420
  class CsdlReferentialConstraint {
8567
8421
  Property;
8568
8422
  ReferencedProperty;
8569
- constructor({ Property, ReferencedProperty, }) {
8423
+ constructor({ Property, ReferencedProperty }) {
8570
8424
  this.Property = Property;
8571
8425
  this.ReferencedProperty = ReferencedProperty;
8572
8426
  }
@@ -8612,8 +8466,7 @@ class CsdlStructuredType extends CsdlAnnotable {
8612
8466
  if (Array.isArray(this.Property) && this.Property.length > 0) {
8613
8467
  json['Property'] = this.Property.map((p) => p.toJson());
8614
8468
  }
8615
- if (Array.isArray(this.NavigationProperty) &&
8616
- this.NavigationProperty.length > 0) {
8469
+ if (Array.isArray(this.NavigationProperty) && this.NavigationProperty.length > 0) {
8617
8470
  json['NavigationProperty'] = this.NavigationProperty.map((n) => n.toJson());
8618
8471
  }
8619
8472
  if (this.BaseType !== undefined) {
@@ -9134,8 +8987,7 @@ class CsdlSchema {
9134
8987
  if (this.Alias !== undefined) {
9135
8988
  json['Alias'] = this.Alias;
9136
8989
  }
9137
- if (Array.isArray(this.EntityContainer) &&
9138
- this.EntityContainer.length > 0) {
8990
+ if (Array.isArray(this.EntityContainer) && this.EntityContainer.length > 0) {
9139
8991
  json['EntityContainer'] = this.EntityContainer.map((a) => a.toJson());
9140
8992
  }
9141
8993
  if (Array.isArray(this.EntityType) && this.EntityType.length > 0) {
@@ -9769,9 +9621,7 @@ class ODataMetadataParser {
9769
9621
  }
9770
9622
  getAttributeValue(attributes, attributeName) {
9771
9623
  const attribute = attributes.getNamedItem(attributeName);
9772
- return attribute !== null && attribute.nodeValue
9773
- ? attribute.nodeValue
9774
- : undefined;
9624
+ return attribute !== null && attribute.nodeValue ? attribute.nodeValue : undefined;
9775
9625
  }
9776
9626
  propertyValueToNumber(attributeValue) {
9777
9627
  return attributeValue !== undefined ? Number(attributeValue) : undefined;
@@ -9924,9 +9774,7 @@ class ODataSingletonResource extends ODataResource {
9924
9774
  return this.fetch(options).pipe(map(({ entity }) => entity));
9925
9775
  }
9926
9776
  fetchModel(options) {
9927
- return this.fetch(options).pipe(map(({ entity, annots }) => entity
9928
- ? this.asModel(entity, { annots, ModelType: options?.ModelType })
9929
- : null));
9777
+ return this.fetch(options).pipe(map(({ entity, annots }) => entity ? this.asModel(entity, { annots, ModelType: options?.ModelType }) : null));
9930
9778
  }
9931
9779
  }
9932
9780
 
@@ -10220,9 +10068,7 @@ class ODataResponse extends HttpResponse {
10220
10068
  get payload() {
10221
10069
  if (this._payload === undefined) {
10222
10070
  this._payload =
10223
- this.body && this.options.version === '2.0'
10224
- ? this.body['d']
10225
- : this.body;
10071
+ this.body && this.options.version === '2.0' ? this.body['d'] : this.body;
10226
10072
  }
10227
10073
  return this._payload;
10228
10074
  }
@@ -10323,9 +10169,7 @@ class ODataCollection {
10323
10169
  _entries = [];
10324
10170
  _model;
10325
10171
  models() {
10326
- return this._entries
10327
- .filter((e) => e.state !== ODataModelState.Removed)
10328
- .map((e) => e.model);
10172
+ return this._entries.filter((e) => e.state !== ODataModelState.Removed).map((e) => e.model);
10329
10173
  }
10330
10174
  get length() {
10331
10175
  return this.models().length;
@@ -10360,8 +10204,7 @@ class ODataCollection {
10360
10204
  this.assign(entities, { reset });
10361
10205
  }
10362
10206
  isParentOf(child) {
10363
- return (child !== this &&
10364
- ODataModelOptions.chain(child).some((p) => p[0] === this));
10207
+ return child !== this && ODataModelOptions.chain(child).some((p) => p[0] === this);
10365
10208
  }
10366
10209
  resource() {
10367
10210
  return ODataModelOptions.resource(this);
@@ -10469,8 +10312,8 @@ class ODataCollection {
10469
10312
  }
10470
10313
  clone() {
10471
10314
  return new this.constructor(this.toEntities(INCLUDE_DEEP), {
10472
- resource: this.resource(),
10473
- annots: this.annots(),
10315
+ resource: this.resource()?.clone(),
10316
+ annots: this.annots().clone(),
10474
10317
  });
10475
10318
  }
10476
10319
  _request(obs$, mapCallback) {
@@ -10523,7 +10366,7 @@ class ODataCollection {
10523
10366
  const resource = this.resource();
10524
10367
  if (!resource)
10525
10368
  return throwError(() => new Error('fetchMany: Resource is null'));
10526
- resource.query((q) => remove || this.length == 0 ? q.skip().clear() : q.skip(this.length));
10369
+ resource.query((q) => (remove || this.length == 0 ? q.skip().clear() : q.skip(this.length)));
10527
10370
  const obs$ = resource.fetchMany(top, { withCount, ...options });
10528
10371
  return this._request(obs$, ({ entities, annots }) => {
10529
10372
  this._annotations = annots;
@@ -10541,7 +10384,7 @@ class ODataCollection {
10541
10384
  const resource = this.resource();
10542
10385
  if (!resource)
10543
10386
  return throwError(() => new Error('fetchOne: Resource is null'));
10544
- resource.query((q) => remove || this.length == 0 ? q.skip().clear() : q.skip(this.length));
10387
+ resource.query((q) => (remove || this.length == 0 ? q.skip().clear() : q.skip(this.length)));
10545
10388
  const obs$ = resource.fetchOne({ withCount, ...options });
10546
10389
  return this._request(obs$, ({ entity, annots }) => {
10547
10390
  this._annotations = annots;
@@ -10731,7 +10574,7 @@ class ODataCollection {
10731
10574
  return of(model);
10732
10575
  }
10733
10576
  }
10734
- _removeModel(model, { silent = false, reset = false, } = {}) {
10577
+ _removeModel(model, { silent = false, reset = false } = {}) {
10735
10578
  const entry = this._findEntry(model);
10736
10579
  if (entry === undefined || entry.state === ODataModelState.Removed) {
10737
10580
  return model;
@@ -10771,7 +10614,7 @@ class ODataCollection {
10771
10614
  this._entries.splice(position, 0, entry);
10772
10615
  return entry.model;
10773
10616
  }
10774
- create(attrs = {}, { silent = false, server = true, } = {}) {
10617
+ create(attrs = {}, { silent = false, server = true } = {}) {
10775
10618
  const model = this.modelFactory(attrs);
10776
10619
  return (model.isValid() && server ? model.save() : of(model)).pipe(switchMap((model) => this.add(model, { silent, server })), map(() => model));
10777
10620
  }
@@ -10811,7 +10654,7 @@ class ODataCollection {
10811
10654
  }
10812
10655
  return value !== undefined;
10813
10656
  }
10814
- reset({ path, silent = false, } = {}) {
10657
+ reset({ path, silent = false } = {}) {
10815
10658
  let toAdd = [];
10816
10659
  let toChange = [];
10817
10660
  let toRemove = [];
@@ -10823,8 +10666,7 @@ class ODataCollection {
10823
10666
  const model = this.models()[index];
10824
10667
  if (ODataModelOptions.isModel(model)) {
10825
10668
  const entry = this._findEntry(model);
10826
- if (entry.state === ODataModelState.Unchanged &&
10827
- entry.model.hasChanged()) {
10669
+ if (entry.state === ODataModelState.Unchanged && entry.model.hasChanged()) {
10828
10670
  toChange = [entry];
10829
10671
  }
10830
10672
  path = pathArray.slice(1);
@@ -10847,8 +10689,7 @@ class ODataCollection {
10847
10689
  entry.model.reset({ path, silent });
10848
10690
  entry.state = ODataModelState.Unchanged;
10849
10691
  });
10850
- if (!silent &&
10851
- (toAdd.length > 0 || toRemove.length > 0 || toChange.length > 0)) {
10692
+ if (!silent && (toAdd.length > 0 || toRemove.length > 0 || toChange.length > 0)) {
10852
10693
  this.events$.trigger(ODataModelEventType.Reset, {
10853
10694
  options: {
10854
10695
  added: toAdd.map((e) => e.model),
@@ -10923,8 +10764,7 @@ class ODataCollection {
10923
10764
  models.forEach((m, i) => this._moveModel(m, i));
10924
10765
  this.events$.trigger(ODataModelEventType.Sort);
10925
10766
  }
10926
- if (!silent &&
10927
- (toAdd.length > 0 || toRemove.length > 0 || toMerge.length > 0)) {
10767
+ if (!silent && (toAdd.length > 0 || toRemove.length > 0 || toMerge.length > 0)) {
10928
10768
  this.events$.trigger(reset ? ODataModelEventType.Reset : ODataModelEventType.Update, {
10929
10769
  options: {
10930
10770
  added: toAdd,
@@ -10992,8 +10832,7 @@ class ODataCollection {
10992
10832
  if (event.type === ODataModelEventType.Destroy) {
10993
10833
  this._removeModel(entry.model, { reset: true });
10994
10834
  }
10995
- else if (event.type === ODataModelEventType.Change &&
10996
- event.options?.key) {
10835
+ else if (event.type === ODataModelEventType.Change && event.options?.key) {
10997
10836
  entry.key = entry.model.key();
10998
10837
  }
10999
10838
  }
@@ -11083,12 +10922,8 @@ class ODataCollection {
11083
10922
  }
11084
10923
  //#region Sort
11085
10924
  _compare(e1, e2, by, index) {
11086
- const m1 = ODataModelOptions.isModel(e1)
11087
- ? e1
11088
- : e1.model;
11089
- const m2 = ODataModelOptions.isModel(e2)
11090
- ? e2
11091
- : e2.model;
10925
+ const m1 = ODataModelOptions.isModel(e1) ? e1 : e1.model;
10926
+ const m2 = ODataModelOptions.isModel(e2) ? e2 : e2.model;
11092
10927
  const value1 = m1.get(by[index].field);
11093
10928
  const value2 = m2.get(by[index].field);
11094
10929
  let result = 0;
@@ -11235,16 +11070,15 @@ class ODataModel {
11235
11070
  return this._meta.isOpenType();
11236
11071
  }
11237
11072
  isParentOf(child) {
11238
- return (child !== this &&
11239
- ODataModelOptions.chain(child).some((p) => p[0] === this));
11073
+ return child !== this && ODataModelOptions.chain(child).some((p) => p[0] === this);
11240
11074
  }
11241
- referential(attr, { field_mapping = false, resolve = true, } = {}) {
11075
+ referential(attr, { field_mapping = false, resolve = true } = {}) {
11242
11076
  return this._meta.resolveReferential(this, attr, {
11243
11077
  field_mapping,
11244
11078
  resolve,
11245
11079
  });
11246
11080
  }
11247
- referenced(attr, { field_mapping = false, resolve = true, } = {}) {
11081
+ referenced(attr, { field_mapping = false, resolve = true } = {}) {
11248
11082
  return this._meta.resolveReferenced(this, attr, {
11249
11083
  field_mapping,
11250
11084
  resolve,
@@ -11301,8 +11135,7 @@ class ODataModel {
11301
11135
  if (pathArray.length === 0)
11302
11136
  return undefined;
11303
11137
  const value = this._meta.get(this, pathArray[0]);
11304
- if (pathArray.length > 1 &&
11305
- (value instanceof ODataModel || value instanceof ODataCollection)) {
11138
+ if (pathArray.length > 1 && (value instanceof ODataModel || value instanceof ODataCollection)) {
11306
11139
  return value.get(pathArray.slice(1));
11307
11140
  }
11308
11141
  return value;
@@ -11312,22 +11145,16 @@ class ODataModel {
11312
11145
  if (pathArray.length === 0)
11313
11146
  return false;
11314
11147
  const value = this._meta.get(this, pathArray[0]);
11315
- if (pathArray.length > 1 &&
11316
- (value instanceof ODataModel || value instanceof ODataCollection)) {
11148
+ if (pathArray.length > 1 && (value instanceof ODataModel || value instanceof ODataCollection)) {
11317
11149
  return value.has(pathArray.slice(1));
11318
11150
  }
11319
11151
  return value !== undefined;
11320
11152
  }
11321
- reset({ path, silent = false, } = {}) {
11322
- const pathArray = (path === undefined
11323
- ? []
11324
- : Types.isArray(path)
11325
- ? path
11326
- : path.match(/([^[.\]])+/g));
11153
+ reset({ path, silent = false } = {}) {
11154
+ const pathArray = (path === undefined ? [] : Types.isArray(path) ? path : path.match(/([^[.\]])+/g));
11327
11155
  const name = pathArray[0];
11328
11156
  const value = name !== undefined ? this[name] : undefined;
11329
- if (ODataModelOptions.isModel(value) ||
11330
- ODataModelOptions.isCollection(value)) {
11157
+ if (ODataModelOptions.isModel(value) || ODataModelOptions.isCollection(value)) {
11331
11158
  value.reset({ path: pathArray.slice(1), silent });
11332
11159
  }
11333
11160
  else {
@@ -11352,8 +11179,8 @@ class ODataModel {
11352
11179
  }
11353
11180
  clone() {
11354
11181
  return new this.constructor(this.toEntity(INCLUDE_DEEP), {
11355
- resource: this.resource(),
11356
- annots: this.annots(),
11182
+ resource: this.resource()?.clone(),
11183
+ annots: this.annots().clone(),
11357
11184
  });
11358
11185
  }
11359
11186
  _request(obs$, mapCallback) {
@@ -11399,8 +11226,7 @@ class ODataModel {
11399
11226
  (method === 'update' || method === 'modify') &&
11400
11227
  !resource.hasKey())
11401
11228
  return throwError(() => new Error('save: Update/Patch require entity key'));
11402
- if (resource instanceof ODataNavigationPropertyResource ||
11403
- method === 'create')
11229
+ if (resource instanceof ODataNavigationPropertyResource || method === 'create')
11404
11230
  resource.clearKey();
11405
11231
  if (validate && !this.isValid({ method, navigation })) {
11406
11232
  return throwError(() => new Error('save: Validation errors'));
@@ -11457,7 +11283,7 @@ class ODataModel {
11457
11283
  * @param include_navigation Check in navigation properties
11458
11284
  * @returns true if the model has changed, false otherwise
11459
11285
  */
11460
- hasChanged({ include_navigation = false, } = {}) {
11286
+ hasChanged({ include_navigation = false } = {}) {
11461
11287
  return this._meta.hasChanged(this, { include_navigation });
11462
11288
  }
11463
11289
  encode(name, options) {
@@ -11527,9 +11353,7 @@ class ODataModel {
11527
11353
  const resource = this.resource();
11528
11354
  if (!(resource instanceof ODataEntityResource))
11529
11355
  throw new Error(`cast: Can't cast to derived model without ODataEntityResource`);
11530
- return resource
11531
- .cast(type)
11532
- .asModel(this.toEntity(INCLUDE_DEEP), {
11356
+ return resource.cast(type).asModel(this.toEntity(INCLUDE_DEEP), {
11533
11357
  annots: this.annots(),
11534
11358
  ModelType,
11535
11359
  });
@@ -11600,13 +11424,8 @@ class ODataModel {
11600
11424
  model = field.collectionFactory({ parent: this });
11601
11425
  }
11602
11426
  else {
11603
- const ref = field.navigation
11604
- ? this.referenced(field)
11605
- : undefined;
11606
- model =
11607
- ref === null
11608
- ? null
11609
- : field.modelFactory({ parent: this, value: ref });
11427
+ const ref = field.navigation ? this.referenced(field) : undefined;
11428
+ model = ref === null ? null : field.modelFactory({ parent: this, value: ref });
11610
11429
  }
11611
11430
  this[name] = model;
11612
11431
  }
@@ -11617,7 +11436,10 @@ class ODataModel {
11617
11436
  const etag = this.annots().etag;
11618
11437
  let obs$ = NEVER;
11619
11438
  if (model instanceof ODataModel) {
11620
- obs$ = reference.set(model.asEntity((e) => e.resource()), { etag, ...options });
11439
+ obs$ = reference.set(model.asEntity((e) => e.resource()), {
11440
+ etag,
11441
+ ...options,
11442
+ });
11621
11443
  }
11622
11444
  else if (model instanceof ODataCollection) {
11623
11445
  obs$ = forkJoin(model
@@ -11634,7 +11456,10 @@ class ODataModel {
11634
11456
  const etag = this.annots().etag;
11635
11457
  let obs$ = NEVER;
11636
11458
  if (model instanceof ODataModel) {
11637
- obs$ = reference.set(model.asEntity((e) => e.resource()), { etag, ...options });
11459
+ obs$ = reference.set(model.asEntity((e) => e.resource()), {
11460
+ etag,
11461
+ ...options,
11462
+ });
11638
11463
  }
11639
11464
  else if (model instanceof ODataCollection) {
11640
11465
  obs$ = forkJoin(model
@@ -11658,16 +11483,12 @@ class ODataModel {
11658
11483
  const meta = this._meta;
11659
11484
  const thisCid = this[meta.cid];
11660
11485
  const otherCid = other[meta.cid];
11661
- if (thisCid !== undefined &&
11662
- otherCid !== undefined &&
11663
- Types.isEqual(thisCid, otherCid))
11486
+ if (thisCid !== undefined && otherCid !== undefined && Types.isEqual(thisCid, otherCid))
11664
11487
  return true;
11665
11488
  if (meta.isEntityType()) {
11666
11489
  const thisKey = this.key();
11667
11490
  const otherKey = other.key();
11668
- if (thisKey !== undefined &&
11669
- otherKey !== undefined &&
11670
- Types.isEqual(thisKey, otherKey))
11491
+ if (thisKey !== undefined && otherKey !== undefined && Types.isEqual(thisKey, otherKey))
11671
11492
  return true;
11672
11493
  }
11673
11494
  else if (meta.isComplexType()) {
@@ -11681,8 +11502,7 @@ class ODataModel {
11681
11502
  //#endregion
11682
11503
  //#region Collection Tools
11683
11504
  collection() {
11684
- return this._parent !== null &&
11685
- ODataModelOptions.isCollection(this._parent[0])
11505
+ return this._parent !== null && ODataModelOptions.isCollection(this._parent[0])
11686
11506
  ? this._parent[0]
11687
11507
  : undefined;
11688
11508
  }
@@ -11752,8 +11572,7 @@ class ODataModelEvent {
11752
11572
  this.bubbles = false;
11753
11573
  }
11754
11574
  visited(model) {
11755
- return (this.chain.some((c) => c[0] === model) &&
11756
- this.chain[this.chain.length - 1][0] !== model);
11575
+ return this.chain.some((c) => c[0] === model) && this.chain[this.chain.length - 1][0] !== model;
11757
11576
  }
11758
11577
  canContinueWith(self) {
11759
11578
  return this.bubbles && !this.visited(self);
@@ -11781,9 +11600,7 @@ class ODataModelEvent {
11781
11600
  //Identifies the current collection for the event
11782
11601
  get currentCollection() {
11783
11602
  const link = this.chain.find((c) => ODataModelOptions.isCollection(c[0]));
11784
- return link !== undefined
11785
- ? link[0]
11786
- : undefined;
11603
+ return link !== undefined ? link[0] : undefined;
11787
11604
  }
11788
11605
  }
11789
11606
  class ODataModelEventEmitter extends EventEmitter {
@@ -11932,9 +11749,7 @@ class ODataModelField {
11932
11749
  return this.parser.isStructuredType();
11933
11750
  }
11934
11751
  structuredType() {
11935
- const structuredType = this.structuredForType
11936
- ? this.structuredForType(this.type)
11937
- : undefined;
11752
+ const structuredType = this.structuredForType ? this.structuredForType(this.type) : undefined;
11938
11753
  //Throw error if not found
11939
11754
  if (!structuredType)
11940
11755
  throw new Error(`Could not find structured type for ${this.parser.type}`);
@@ -11955,9 +11770,7 @@ class ODataModelField {
11955
11770
  return !value.isValid({ method, navigation }) ? value._errors : undefined;
11956
11771
  }
11957
11772
  else if (ODataModelOptions.isCollection(value)) {
11958
- return value
11959
- .models()
11960
- .some((m) => !m.isValid({ method, navigation }))
11773
+ return value.models().some((m) => !m.isValid({ method, navigation }))
11961
11774
  ? value.models().map((m) => m._errors)
11962
11775
  : undefined;
11963
11776
  }
@@ -11980,31 +11793,21 @@ class ODataModelField {
11980
11793
  value.length < this.minLength) {
11981
11794
  errors['push'](`minlength`);
11982
11795
  }
11983
- if (this.min !== undefined &&
11984
- typeof value === 'number' &&
11985
- value < this.min) {
11796
+ if (this.min !== undefined && typeof value === 'number' && value < this.min) {
11986
11797
  errors['push'](`min`);
11987
11798
  }
11988
- if (this.max !== undefined &&
11989
- typeof value === 'number' &&
11990
- value > this.max) {
11799
+ if (this.max !== undefined && typeof value === 'number' && value > this.max) {
11991
11800
  errors['push'](`max`);
11992
11801
  }
11993
- if (this.pattern !== undefined &&
11994
- typeof value === 'string' &&
11995
- !this.pattern.test(value)) {
11802
+ if (this.pattern !== undefined && typeof value === 'string' && !this.pattern.test(value)) {
11996
11803
  errors['push'](`pattern`);
11997
11804
  }
11998
11805
  return !Types.isEmpty(errors) ? errors : undefined;
11999
11806
  }
12000
11807
  }
12001
11808
  defaults() {
12002
- const meta = this.optionsForType
12003
- ? this.optionsForType(this.type)
12004
- : undefined;
12005
- return this.isStructuredType() && meta !== undefined
12006
- ? meta.defaults()
12007
- : this.default;
11809
+ const meta = this.optionsForType ? this.optionsForType(this.type) : undefined;
11810
+ return this.isStructuredType() && meta !== undefined ? meta.defaults() : this.default;
12008
11811
  }
12009
11812
  deserialize(value, options) {
12010
11813
  const parserOptions = options ?? this.parserOptions;
@@ -12056,9 +11859,7 @@ class ODataModelField {
12056
11859
  collectionFactory({ parent, value, reset, }) {
12057
11860
  // Collection Factory
12058
11861
  const annots = this.annotationsFactory(parent.annots());
12059
- const Collection = this.collectionForType
12060
- ? this.collectionForType(this.type)
12061
- : undefined;
11862
+ const Collection = this.collectionForType ? this.collectionForType(this.type) : undefined;
12062
11863
  if (Collection === undefined)
12063
11864
  throw Error(`No Collection type for ${this.name}`);
12064
11865
  return new Collection((value || []), {
@@ -12109,13 +11910,11 @@ class ODataModelAttribute {
12109
11910
  }
12110
11911
  set(value, reset = false, reparent = false) {
12111
11912
  const current = this.get();
12112
- if (ODataModelOptions.isModel(current) ||
12113
- ODataModelOptions.isCollection(current))
11913
+ if (ODataModelOptions.isModel(current) || ODataModelOptions.isCollection(current))
12114
11914
  this.unlink(current);
12115
11915
  const changed = ODataModelOptions.isModel(current) && ODataModelOptions.isModel(value)
12116
11916
  ? !current.equals(value)
12117
- : ODataModelOptions.isCollection(current) &&
12118
- ODataModelOptions.isCollection(value)
11917
+ : ODataModelOptions.isCollection(current) && ODataModelOptions.isCollection(value)
12119
11918
  ? !current.equals(value)
12120
11919
  : !Types.isEqual(current, value);
12121
11920
  if (reset) {
@@ -12129,26 +11928,24 @@ class ODataModelAttribute {
12129
11928
  this.change = value;
12130
11929
  this.state = ODataModelState.Changed;
12131
11930
  }
12132
- if (ODataModelOptions.isModel(value) ||
12133
- ODataModelOptions.isCollection(value)) {
11931
+ if (ODataModelOptions.isModel(value) || ODataModelOptions.isCollection(value)) {
12134
11932
  this.link(value, reparent);
12135
11933
  }
12136
11934
  return changed;
12137
11935
  }
12138
- isChanged({ include_navigation = false, } = {}) {
11936
+ isChanged({ include_navigation = false } = {}) {
12139
11937
  const current = this.get();
12140
11938
  return (this.state === ODataModelState.Changed ||
12141
- ((ODataModelOptions.isModel(current) ||
12142
- ODataModelOptions.isCollection(current)) &&
12143
- current.hasChanged({ include_navigation })));
11939
+ ((ODataModelOptions.isModel(current) || ODataModelOptions.isCollection(current)) &&
11940
+ current.hasChanged({
11941
+ include_navigation,
11942
+ })));
12144
11943
  }
12145
11944
  reset() {
12146
- if (ODataModelOptions.isModel(this.change) ||
12147
- ODataModelOptions.isCollection(this.change))
11945
+ if (ODataModelOptions.isModel(this.change) || ODataModelOptions.isCollection(this.change))
12148
11946
  this.unlink(this.change);
12149
11947
  this.state = ODataModelState.Unchanged;
12150
- if (ODataModelOptions.isModel(this.value) ||
12151
- ODataModelOptions.isCollection(this.value))
11948
+ if (ODataModelOptions.isModel(this.value) || ODataModelOptions.isCollection(this.value))
12152
11949
  this.link(this.value);
12153
11950
  }
12154
11951
  link(value, reparent = false) {
@@ -12234,8 +12031,7 @@ class ODataModelOptions {
12234
12031
  this.entitySet = this.api.findEntitySetForEntityType(this.type());
12235
12032
  let concurrencyFields = [];
12236
12033
  if (this.entitySet !== undefined) {
12237
- concurrencyFields =
12238
- this.entitySet.annotatedValue(OPTIMISTIC_CONCURRENCY) || [];
12034
+ concurrencyFields = this.entitySet.annotatedValue(OPTIMISTIC_CONCURRENCY) || [];
12239
12035
  }
12240
12036
  this._fields.forEach((field) => {
12241
12037
  const concurrency = concurrencyFields.indexOf(field.field) !== -1;
@@ -12355,8 +12151,7 @@ class ODataModelOptions {
12355
12151
  resource = resource || model._resource;
12356
12152
  if (resource === null)
12357
12153
  break;
12358
- if (ODataModelOptions.isModel(model) &&
12359
- (prevField === null || prevField.collection)) {
12154
+ if (ODataModelOptions.isModel(model) && (prevField === null || prevField.collection)) {
12360
12155
  const m = model;
12361
12156
  // Resolve subtype if collection not is from field
12362
12157
  // FIXME
@@ -12418,8 +12213,7 @@ class ODataModelOptions {
12418
12213
  this.attach(self, resource);
12419
12214
  }
12420
12215
  // Annotations
12421
- self._annotations =
12422
- annots ?? new ODataEntityAnnotations(ODataHelper[DEFAULT_VERSION]);
12216
+ self._annotations = annots ?? new ODataEntityAnnotations(ODataHelper[DEFAULT_VERSION]);
12423
12217
  // Fields
12424
12218
  this.fields({
12425
12219
  include_navigation: true,
@@ -12451,10 +12245,7 @@ class ODataModelOptions {
12451
12245
  .fields({ include_navigation: false, include_parents: true })
12452
12246
  .find((field) => field.field === name);
12453
12247
  if (field !== undefined) {
12454
- v =
12455
- Types.isPlainObject(v) || ODataModelOptions.isModel(v)
12456
- ? v[field.name]
12457
- : v;
12248
+ v = Types.isPlainObject(v) || ODataModelOptions.isModel(v) ? v[field.name] : v;
12458
12249
  options = this.api.optionsForType(field.type);
12459
12250
  }
12460
12251
  }
@@ -12467,9 +12258,7 @@ class ODataModelOptions {
12467
12258
  }
12468
12259
  if (key.size === 0)
12469
12260
  return undefined;
12470
- return resolve
12471
- ? Objects.resolveKey(key, { single })
12472
- : Object.fromEntries(key);
12261
+ return resolve ? Objects.resolveKey(key, { single }) : Object.fromEntries(key);
12473
12262
  }
12474
12263
  resolveReferential(value, attr, { field_mapping = false, resolve = true, single = false, } = {}) {
12475
12264
  const referential = new Map();
@@ -12490,9 +12279,7 @@ class ODataModelOptions {
12490
12279
  return undefined;
12491
12280
  if (referential.size === 1 && Array.from(referential.values())[0] === null)
12492
12281
  return null;
12493
- return resolve
12494
- ? Objects.resolveKey(referential, { single })
12495
- : Object.fromEntries(referential);
12282
+ return resolve ? Objects.resolveKey(referential, { single }) : Object.fromEntries(referential);
12496
12283
  }
12497
12284
  resolveReferenced(value, attr, { field_mapping = false, resolve = true, single = false, } = {}) {
12498
12285
  const referenced = new Map();
@@ -12514,9 +12301,7 @@ class ODataModelOptions {
12514
12301
  return undefined;
12515
12302
  if (referenced.size === 1 && Array.from(referenced.values())[0] === null)
12516
12303
  return null;
12517
- return resolve
12518
- ? Objects.resolveKey(referenced, { single })
12519
- : Object.fromEntries(referenced);
12304
+ return resolve ? Objects.resolveKey(referenced, { single }) : Object.fromEntries(referenced);
12520
12305
  }
12521
12306
  validate(self, { method, navigation = false, } = {}) {
12522
12307
  const errors = this.fields({
@@ -12525,9 +12310,7 @@ class ODataModelOptions {
12525
12310
  }).reduce((acc, field) => {
12526
12311
  const value = self[field.name];
12527
12312
  const errs = field.validate(value, { method });
12528
- return errs !== undefined
12529
- ? Object.assign(acc, { [field.name]: errs })
12530
- : acc;
12313
+ return errs !== undefined ? Object.assign(acc, { [field.name]: errs }) : acc;
12531
12314
  }, {});
12532
12315
  return !Types.isEmpty(errors) ? errors : undefined;
12533
12316
  }
@@ -12537,9 +12320,7 @@ class ODataModelOptions {
12537
12320
  include_parents: true,
12538
12321
  }).reduce((acc, field) => {
12539
12322
  const value = field.defaults();
12540
- return value !== undefined
12541
- ? Object.assign(acc, { [field.name]: value })
12542
- : acc;
12323
+ return value !== undefined ? Object.assign(acc, { [field.name]: value }) : acc;
12543
12324
  }, {});
12544
12325
  return !Types.isEmpty(defs) ? defs : undefined;
12545
12326
  }
@@ -12571,9 +12352,7 @@ class ODataModelOptions {
12571
12352
  asEntity(self, ctx) {
12572
12353
  // Clone query from him or parent
12573
12354
  let query = self._resource?.cloneQuery();
12574
- if (query === undefined &&
12575
- self._parent &&
12576
- self._parent[0] instanceof ODataCollection)
12355
+ if (query === undefined && self._parent && self._parent[0] instanceof ODataCollection)
12577
12356
  query = self._parent[0]._resource?.cloneQuery();
12578
12357
  // Build new resource
12579
12358
  const resource = this.modelResourceFactory(query);
@@ -12586,12 +12365,10 @@ class ODataModelOptions {
12586
12365
  (attr) => chain.every((c) => c !== attr.get()))
12587
12366
  .filter(
12588
12367
  // Changes only
12589
- (attr) => !changes_only ||
12590
- (changes_only && attr.isChanged({ include_navigation })))
12368
+ (attr) => !changes_only || (changes_only && attr.isChanged({ include_navigation })))
12591
12369
  .filter((attr) =>
12592
12370
  // Navigation
12593
- (include_navigation && attr.navigation && attr.get() !== null) ||
12594
- !attr.navigation)
12371
+ (include_navigation && attr.navigation && attr.get() !== null) || !attr.navigation)
12595
12372
  .reduce((acc, attr) => {
12596
12373
  const name = field_mapping ? attr.fieldName : attr.name;
12597
12374
  let value = attr.get();
@@ -12673,10 +12450,8 @@ class ODataModelOptions {
12673
12450
  self._parent[1] !== null &&
12674
12451
  this.api.optionsForType(self._parent[1].type) !== self._meta) ||
12675
12452
  (ODataModelOptions.isCollection(self._parent[0]) &&
12676
- self._parent[0]._model
12677
- .meta !== self._meta))) {
12678
- entity[this.api.options.helper.ODATA_TYPE] =
12679
- `#${this.structuredType.type()}`;
12453
+ self._parent[0]._model.meta !== self._meta))) {
12454
+ entity[this.api.options.helper.ODATA_TYPE] = `#${this.structuredType.type()}`;
12680
12455
  }
12681
12456
  return entity;
12682
12457
  }
@@ -12685,8 +12460,7 @@ class ODataModelOptions {
12685
12460
  if (name !== undefined) {
12686
12461
  // Reset value
12687
12462
  const attribute = self._attributes.get(name);
12688
- if (attribute !== undefined &&
12689
- attribute.isChanged({ include_navigation: true })) {
12463
+ if (attribute !== undefined && attribute.isChanged({ include_navigation: true })) {
12690
12464
  attribute.reset();
12691
12465
  changes = [name];
12692
12466
  }
@@ -12742,7 +12516,9 @@ class ODataModelOptions {
12742
12516
  }
12743
12517
  });
12744
12518
  if (!silent && changes.length > 0) {
12745
- self.events$.trigger(reset ? ODataModelEventType.Reset : ODataModelEventType.Update, { options: { changes } });
12519
+ self.events$.trigger(reset ? ODataModelEventType.Reset : ODataModelEventType.Update, {
12520
+ options: { changes },
12521
+ });
12746
12522
  }
12747
12523
  return self;
12748
12524
  }
@@ -12756,8 +12532,7 @@ class ODataModelOptions {
12756
12532
  const attr = self._attributes.get(field instanceof ODataModelField ? field.name : field);
12757
12533
  if (attr !== undefined) {
12758
12534
  const value = attr.get();
12759
- if ((attr.navigation && value === null) ||
12760
- ODataModelOptions.isModel(value)) {
12535
+ if ((attr.navigation && value === null) || ODataModelOptions.isModel(value)) {
12761
12536
  // Check for reference
12762
12537
  const referenced = this.resolveReferenced(self, attr, {
12763
12538
  resolve: false,
@@ -12778,18 +12553,14 @@ class ODataModelOptions {
12778
12553
  }
12779
12554
  return value;
12780
12555
  }
12781
- else if (typeof field === 'string' &&
12782
- !field.startsWith('_') &&
12783
- !field.endsWith('$')) {
12556
+ else if (typeof field === 'string' && !field.startsWith('_') && !field.endsWith('$')) {
12784
12557
  return self[field];
12785
12558
  }
12786
12559
  return undefined;
12787
12560
  }
12788
12561
  set(self, field, value, { add, merge, remove, reset, reparent, silent, type, } = {}) {
12789
12562
  let modelField = field instanceof ODataModelField ? field : this.findField(field);
12790
- if (modelField === undefined &&
12791
- this.isOpenType() &&
12792
- typeof field === 'string') {
12563
+ if (modelField === undefined && this.isOpenType() && typeof field === 'string') {
12793
12564
  type = type ?? this.tsToEdm[typeof value] ?? EdmType.String;
12794
12565
  modelField = this.modelFieldFactory(self, field, type);
12795
12566
  }
@@ -12853,8 +12624,7 @@ class ODataModelOptions {
12853
12624
  else {
12854
12625
  // Current is null or undefined
12855
12626
  // create new model/collection for given value
12856
- changed = attr.set(ODataModelOptions.isCollection(value) ||
12857
- ODataModelOptions.isModel(value)
12627
+ changed = attr.set(ODataModelOptions.isCollection(value) || ODataModelOptions.isModel(value)
12858
12628
  ? value
12859
12629
  : modelField.collection
12860
12630
  ? modelField.collectionFactory({
@@ -12896,9 +12666,7 @@ class ODataModelOptions {
12896
12666
  attr.events$.subscribe((event) => {
12897
12667
  if (event.canContinueWith(self)) {
12898
12668
  if (event.model === attr.get()) {
12899
- if (event.type === ODataModelEventType.Change &&
12900
- attr.navigation &&
12901
- event.options?.key) {
12669
+ if (event.type === ODataModelEventType.Change && attr.navigation && event.options?.key) {
12902
12670
  const ref = attr.get().referential(attr);
12903
12671
  if (ref !== null && ref !== undefined) {
12904
12672
  Object.assign(self, ref);
@@ -13173,9 +12941,7 @@ class ODataApi {
13173
12941
  withCredentials: options.withCredentials,
13174
12942
  });
13175
12943
  let res$ = this.requester !== undefined ? this.requester(req) : NEVER;
13176
- res$ = res$.pipe(map((res) => res.type === HttpEventType.Response
13177
- ? ODataResponse.fromHttpResponse(req, res)
13178
- : res));
12944
+ res$ = res$.pipe(map((res) => res.type === HttpEventType.Response ? ODataResponse.fromHttpResponse(req, res) : res));
13179
12945
  if (this.errorHandler !== undefined)
13180
12946
  res$ = res$.pipe(catchError(this.errorHandler));
13181
12947
  if (options.observe === 'events') {
@@ -13232,9 +12998,7 @@ class ODataApi {
13232
12998
  return undefined;
13233
12999
  if (schemas.length === 1)
13234
13000
  return schemas[0];
13235
- return schemas
13236
- .sort((s1, s2) => s1.namespace.length - s2.namespace.length)
13237
- .pop();
13001
+ return schemas.sort((s1, s2) => s1.namespace.length - s2.namespace.length).pop();
13238
13002
  }
13239
13003
  //#region EnumTypes
13240
13004
  findEnumType(value) {
@@ -13255,8 +13019,7 @@ class ODataApi {
13255
13019
  }
13256
13020
  const structuredTypes = this.schemas.reduce((acc, schema) => [...acc, ...schema.entities], []);
13257
13021
  let structuredType = structuredTypes.find((e) => e.type() === value);
13258
- structuredType =
13259
- structuredType ?? structuredTypes.find((e) => e.name === value);
13022
+ structuredType = structuredType ?? structuredTypes.find((e) => e.name === value);
13260
13023
  this.memo.structuredTypes.set(value, structuredType);
13261
13024
  return structuredType;
13262
13025
  }
@@ -13267,9 +13030,7 @@ class ODataApi {
13267
13030
  if (this.memo.callables.has(key)) {
13268
13031
  return this.memo.callables.get(key);
13269
13032
  }
13270
- const bindingStructuredType = bindingType !== undefined
13271
- ? this.findStructuredType(bindingType)
13272
- : undefined;
13033
+ const bindingStructuredType = bindingType !== undefined ? this.findStructuredType(bindingType) : undefined;
13273
13034
  const callables = this.schemas.reduce((acc, schema) => [...acc, ...schema.callables], []);
13274
13035
  let callable = callables.find((c) => {
13275
13036
  const isCallableType = c.type() == value;
@@ -13474,9 +13235,7 @@ class ODataSettings {
13474
13235
  }
13475
13236
  //#region Configs shortcuts
13476
13237
  enumTypeForType(type) {
13477
- let values = this.apis
13478
- .map((api) => api.findEnumType(type))
13479
- .filter((e) => e);
13238
+ let values = this.apis.map((api) => api.findEnumType(type)).filter((e) => e);
13480
13239
  if (values.length === 0)
13481
13240
  throw Error(`No Enum for type ${type} was found`);
13482
13241
  if (values.length > 1)
@@ -13484,9 +13243,7 @@ class ODataSettings {
13484
13243
  return values[0];
13485
13244
  }
13486
13245
  structuredTypeForType(type) {
13487
- let values = this.apis
13488
- .map((api) => api.findStructuredType(type))
13489
- .filter((e) => e);
13246
+ let values = this.apis.map((api) => api.findStructuredType(type)).filter((e) => e);
13490
13247
  if (values.length === 0)
13491
13248
  throw Error(`No Structured for type ${type} was found`);
13492
13249
  if (values.length > 1)
@@ -13494,9 +13251,7 @@ class ODataSettings {
13494
13251
  return values[0];
13495
13252
  }
13496
13253
  callableForType(type, bindingType) {
13497
- let values = this.apis
13498
- .map((api) => api.findCallable(type, bindingType))
13499
- .filter((e) => e);
13254
+ let values = this.apis.map((api) => api.findCallable(type, bindingType)).filter((e) => e);
13500
13255
  if (values.length === 0)
13501
13256
  throw Error(`No Callable for type ${type} was found`);
13502
13257
  if (values.length > 1)
@@ -13504,9 +13259,7 @@ class ODataSettings {
13504
13259
  return values[0];
13505
13260
  }
13506
13261
  entitySetForType(type) {
13507
- let values = this.apis
13508
- .map((api) => api.findEntitySet(type))
13509
- .filter((e) => e);
13262
+ let values = this.apis.map((api) => api.findEntitySet(type)).filter((e) => e);
13510
13263
  if (values.length === 0)
13511
13264
  throw Error(`No EntitySet for type ${type} was found`);
13512
13265
  if (values.length > 1)
@@ -13514,9 +13267,7 @@ class ODataSettings {
13514
13267
  return values[0];
13515
13268
  }
13516
13269
  parserForType(type) {
13517
- let values = this.apis
13518
- .map((api) => api.parserForType(type))
13519
- .filter((e) => e);
13270
+ let values = this.apis.map((api) => api.parserForType(type)).filter((e) => e);
13520
13271
  if (values.length === 0)
13521
13272
  throw Error(`No Parser for type ${type} was found`);
13522
13273
  if (!type.startsWith('Edm.') && values.length > 1)
@@ -13532,9 +13283,7 @@ class ODataSettings {
13532
13283
  return values[0];
13533
13284
  }
13534
13285
  collectionForType(type) {
13535
- let values = this.apis
13536
- .map((api) => api.findCollection(type))
13537
- .filter((e) => e);
13286
+ let values = this.apis.map((api) => api.findCollection(type)).filter((e) => e);
13538
13287
  if (values.length === 0)
13539
13288
  throw Error(`No Collection for type ${type} was found`);
13540
13289
  if (values.length > 1)
@@ -13551,9 +13300,7 @@ class ODataConfigSyncLoader {
13551
13300
  this.passedConfigs = passedConfigs;
13552
13301
  }
13553
13302
  loadConfigs() {
13554
- return Array.isArray(this.passedConfigs)
13555
- ? of(this.passedConfigs)
13556
- : of([this.passedConfigs]);
13303
+ return Array.isArray(this.passedConfigs) ? of(this.passedConfigs) : of([this.passedConfigs]);
13557
13304
  }
13558
13305
  }
13559
13306
  class ODataConfigAsyncLoader {
@@ -13564,9 +13311,7 @@ class ODataConfigAsyncLoader {
13564
13311
  loadConfigs() {
13565
13312
  return Array.isArray(this.configs$)
13566
13313
  ? forkJoin(this.configs$)
13567
- : this.configs$.pipe(map$1((value) => Array.isArray(value)
13568
- ? value
13569
- : [value]));
13314
+ : this.configs$.pipe(map$1((value) => Array.isArray(value) ? value : [value]));
13570
13315
  }
13571
13316
  }
13572
13317
  class ODataMetadataLoader {
@@ -13577,9 +13322,7 @@ class ODataMetadataLoader {
13577
13322
  this.baseConfigs = baseConfigs;
13578
13323
  }
13579
13324
  loadConfigs() {
13580
- const configs = Array.isArray(this.baseConfigs)
13581
- ? this.baseConfigs
13582
- : [this.baseConfigs];
13325
+ const configs = Array.isArray(this.baseConfigs) ? this.baseConfigs : [this.baseConfigs];
13583
13326
  return this.sources$.pipe(map$1((source) => (Array.isArray(source) ? source : [source]).map((m, i) => new ODataMetadataParser(m).metadata().toConfig(configs[i] ?? {}))));
13584
13327
  }
13585
13328
  }
@@ -13632,9 +13375,7 @@ class ODataClient {
13632
13375
  if (value instanceof ODataResource)
13633
13376
  api = this.settings.findApiForTypes(value.types());
13634
13377
  else if (typeof value === 'string')
13635
- api =
13636
- this.settings.findApiByName(value) ||
13637
- this.settings.findApiForType(value);
13378
+ api = this.settings.findApiByName(value) || this.settings.findApiForType(value);
13638
13379
  return api ?? this.settings.defaultApi();
13639
13380
  }
13640
13381
  defaultApi() {
@@ -13785,10 +13526,10 @@ class ODataClient {
13785
13526
  put(resource, body, options = {}) {
13786
13527
  return this.request('PUT', resource, addBody(options, body));
13787
13528
  }
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 });
13529
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataClient, deps: [{ token: i1.HttpClient }, { token: ODataConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
13530
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataClient });
13790
13531
  }
13791
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataClient, decorators: [{
13532
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataClient, decorators: [{
13792
13533
  type: Injectable
13793
13534
  }], ctorParameters: () => [{ type: i1.HttpClient }, { type: ODataConfigLoader }] });
13794
13535
 
@@ -14072,10 +13813,10 @@ class ODataServiceFactory {
14072
13813
  };
14073
13814
  return new Service(this.client, singletonName, apiNameOrEntityType);
14074
13815
  }
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 });
13816
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataServiceFactory, deps: [{ token: ODataClient }], target: i0.ɵɵFactoryTarget.Injectable });
13817
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataServiceFactory });
14077
13818
  }
14078
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataServiceFactory, decorators: [{
13819
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataServiceFactory, decorators: [{
14079
13820
  type: Injectable
14080
13821
  }], ctorParameters: () => [{ type: ODataClient }] });
14081
13822
 
@@ -14115,14 +13856,14 @@ class ODataModule {
14115
13856
  ],
14116
13857
  };
14117
13858
  }
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] });
13859
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
13860
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.2", ngImport: i0, type: ODataModule, imports: [CommonModule] });
13861
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataModule, providers: [ODataClient, ODataServiceFactory], imports: [CommonModule] });
14121
13862
  }
14122
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.12", ngImport: i0, type: ODataModule, decorators: [{
13863
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataModule, decorators: [{
14123
13864
  type: NgModule,
14124
13865
  args: [{
14125
- imports: [CommonModule, HttpClientModule],
13866
+ imports: [CommonModule],
14126
13867
  providers: [ODataClient, ODataServiceFactory],
14127
13868
  }]
14128
13869
  }] });
@@ -14156,9 +13897,7 @@ class ODataBaseCache {
14156
13897
  const tags = [];
14157
13898
  const context = res.context;
14158
13899
  if (context.entitySet) {
14159
- tags.push(context.key
14160
- ? `${context.entitySet}(${context.key})`
14161
- : context.entitySet);
13900
+ tags.push(context.key ? `${context.entitySet}(${context.key})` : context.entitySet);
14162
13901
  }
14163
13902
  if (context.type)
14164
13903
  tags.push(context.type);
@@ -14195,7 +13934,7 @@ class ODataBaseCache {
14195
13934
  * @param scope The scope for the entry
14196
13935
  * @param tags The tags for the entry
14197
13936
  */
14198
- put(name, payload, { timeout, scope, tags, } = {}) {
13937
+ put(name, payload, { timeout, scope, tags } = {}) {
14199
13938
  const entry = this.buildEntry(payload, { timeout, tags });
14200
13939
  const key = this.buildKey([...(scope || []), name]);
14201
13940
  this.entries.set(key, entry);
@@ -14210,9 +13949,7 @@ class ODataBaseCache {
14210
13949
  get(name, { scope } = {}) {
14211
13950
  const key = this.buildKey([...(scope || []), name]);
14212
13951
  const entry = this.entries.get(key);
14213
- return entry !== undefined && !this.isExpired(entry)
14214
- ? entry.payload
14215
- : undefined;
13952
+ return entry !== undefined && !this.isExpired(entry) ? entry.payload : undefined;
14216
13953
  }
14217
13954
  /**
14218
13955
  * Remove all cache entries that are matching with the given options
@@ -14272,9 +14009,7 @@ class ODataBaseCache {
14272
14009
  return throwError(() => new Error('No Cached'));
14273
14010
  }
14274
14011
  }
14275
- if (policy === 'cache-first' ||
14276
- policy === 'cache-and-network' ||
14277
- policy === 'network-only') {
14012
+ if (policy === 'cache-first' || policy === 'cache-and-network' || policy === 'network-only') {
14278
14013
  res$ = res$.pipe(tap((res) => {
14279
14014
  if (res.options.cacheability !== 'no-store')
14280
14015
  this.putResponse(req, res);
@@ -14288,9 +14023,7 @@ class ODataBaseCache {
14288
14023
  }
14289
14024
  handleMutate(req, res$) {
14290
14025
  const requests = req.isBatch()
14291
- ? req.resource
14292
- .requests()
14293
- .filter((r) => r.isMutate())
14026
+ ? req.resource.requests().filter((r) => r.isMutate())
14294
14027
  : [req];
14295
14028
  for (var r of requests) {
14296
14029
  const scope = this.scope(r);