@sap/xsodata 8.2.1 → 8.3.1

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 (120) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/index.js +2 -2
  3. package/lib/configuration.js +1 -1
  4. package/lib/db/connect.js +1 -1
  5. package/lib/db/dbSegment.js +68 -123
  6. package/lib/db/dbVersionChecks.js +2 -8
  7. package/lib/handlerConfiguration.js +2 -2
  8. package/lib/http/conditionalHttpHandler.js +27 -34
  9. package/lib/http/simpleHttpRequest.js +14 -18
  10. package/lib/http/simpleHttpResponse.js +9 -6
  11. package/lib/http/uriParser.js +9 -9
  12. package/lib/http/validator/httpRequestValidator.js +9 -9
  13. package/lib/model/annotationFactory.js +11 -11
  14. package/lib/model/association.js +3 -3
  15. package/lib/model/entityType.js +33 -67
  16. package/lib/model/metadataReader.js +31 -52
  17. package/lib/model/model.js +0 -1
  18. package/lib/model/validator/xsoDataConcurrencyTokenValidator.js +6 -6
  19. package/lib/model/xsodataReader.js +36 -28
  20. package/lib/processor/authorizationProcessor.js +22 -33
  21. package/lib/processor/batchProcessor.js +22 -33
  22. package/lib/processor/errorProcessor.js +4 -4
  23. package/lib/processor/exitProcessor.js +19 -19
  24. package/lib/processor/processor.js +9 -9
  25. package/lib/processor/resourceProcessor.js +31 -61
  26. package/lib/processor/resourceProcessorDelete.js +16 -16
  27. package/lib/processor/resourceProcessorDeleteLinks.js +25 -25
  28. package/lib/processor/resourceProcessorGet.js +5 -5
  29. package/lib/processor/resourceProcessorPost.js +43 -45
  30. package/lib/processor/resourceProcessorPut.js +35 -39
  31. package/lib/processor/resourceProcessorPutPostLinks.js +38 -39
  32. package/lib/security/securityContext.js +5 -5
  33. package/lib/serializer/atomSerializer.js +54 -55
  34. package/lib/serializer/atomXmlToJsonSerializer.js +32 -44
  35. package/lib/serializer/content.js +5 -5
  36. package/lib/serializer/json.js +31 -33
  37. package/lib/serializer/jsonSerializer.js +4 -4
  38. package/lib/serializer/metadataSerializer.js +32 -35
  39. package/lib/serializer/serializer.js +29 -43
  40. package/lib/serializer/serviceSerializer.js +19 -24
  41. package/lib/serializer/value.js +1 -2
  42. package/lib/serializer/xmlToJsonSerializer.js +18 -18
  43. package/lib/sql/createDeleteLinksStatements.js +10 -10
  44. package/lib/sql/createDeleteStatements.js +12 -12
  45. package/lib/sql/createGetStatements.js +49 -107
  46. package/lib/sql/createLinksSQLStatements_1_n.js +27 -27
  47. package/lib/sql/createPutPostLinksStatements.js +9 -9
  48. package/lib/sql/createPutStatements.js +0 -1
  49. package/lib/sql/dataCollectorDelete.js +9 -9
  50. package/lib/sql/dataCollectorDeleteLinks.js +3 -3
  51. package/lib/sql/dataCollectorGet.js +9 -17
  52. package/lib/sql/dataCollectorLinks.js +23 -27
  53. package/lib/sql/dataCollectorPost.js +20 -20
  54. package/lib/sql/dataCollectorPut.js +36 -36
  55. package/lib/sql/dataCollectorPutPostLinks.js +3 -3
  56. package/lib/sql/sqlStatement.js +81 -128
  57. package/lib/sql/sqlTools.js +3 -7
  58. package/lib/sql/statementProcessor.js +7 -14
  59. package/lib/uri/applyChecks.js +3 -3
  60. package/lib/uri/checks/checkAllowedMethod.js +3 -3
  61. package/lib/uri/checks/checkAllowedMethodForBatch.js +2 -2
  62. package/lib/uri/checks/checkAllowedMethodsForResourcePath.js +3 -3
  63. package/lib/uri/checks/checkFilterOnAggregatedColumn.js +5 -5
  64. package/lib/uri/checks/checkFilterOrderByOnGenKeyColumn.js +6 -6
  65. package/lib/uri/checks/checkGenKeyRestrictions.js +2 -2
  66. package/lib/uri/checks/checkModificationForbidden.js +3 -3
  67. package/lib/uri/checks/checkPostPutDeleteChecks.js +5 -5
  68. package/lib/uri/checks/checkSystemQueryOptions.js +10 -10
  69. package/lib/uri/checks.js +15 -15
  70. package/lib/uri/expandSelectTreeBuilder.js +12 -16
  71. package/lib/uri/oDataUriParser.js +20 -20
  72. package/lib/uri/queryParameterParser.js +25 -33
  73. package/lib/uri/resourcePathParser.js +47 -62
  74. package/lib/uri/uriType.js +4 -4
  75. package/lib/utils/associations.js +4 -4
  76. package/lib/utils/batch/batchExecutor.js +49 -51
  77. package/lib/utils/batch/batchObjects.js +10 -10
  78. package/lib/utils/batch/batchParser.js +27 -28
  79. package/lib/utils/batch/batchWriter.js +1 -1
  80. package/lib/utils/checkContentType.js +34 -39
  81. package/lib/utils/debugView.js +35 -36
  82. package/lib/utils/errors/applicationError.js +2 -2
  83. package/lib/utils/errors/debugInfo.js +2 -2
  84. package/lib/utils/errors/http/badRequest.js +2 -2
  85. package/lib/utils/errors/http/forbidden.js +2 -2
  86. package/lib/utils/errors/http/methodNotAllowed.js +2 -2
  87. package/lib/utils/errors/http/notAcceptable.js +2 -2
  88. package/lib/utils/errors/http/notFound.js +2 -2
  89. package/lib/utils/errors/http/notImplemented.js +2 -2
  90. package/lib/utils/errors/http/notModified.js +2 -2
  91. package/lib/utils/errors/http/notSupported.js +2 -2
  92. package/lib/utils/errors/http/preconditionFailed.js +2 -2
  93. package/lib/utils/errors/http/preconditionRequired.js +2 -2
  94. package/lib/utils/errors/http/unauthorized.js +2 -2
  95. package/lib/utils/errors/http/unsupportedMediaType.js +2 -2
  96. package/lib/utils/errors/httpError.js +2 -2
  97. package/lib/utils/errors/internalError.js +2 -2
  98. package/lib/utils/errors/modelFileError.js +2 -2
  99. package/lib/utils/errors/sqlError.js +2 -2
  100. package/lib/utils/errors/testError.js +2 -2
  101. package/lib/utils/errors/typeError.js +5 -5
  102. package/lib/utils/errors/xsODataError.js +1 -1
  103. package/lib/utils/logger.js +21 -32
  104. package/lib/utils/measurement.js +14 -13
  105. package/lib/utils/requestContext.js +2 -2
  106. package/lib/utils/stateMaschine.js +6 -6
  107. package/lib/utils/tableCleanup.js +3 -3
  108. package/lib/utils/typeConverter.js +21 -21
  109. package/lib/utils/typeConverters/converterTools.js +25 -331
  110. package/lib/utils/typeConverters/dbToJson.js +3 -3
  111. package/lib/utils/typeConverters/dbToUri.js +7 -7
  112. package/lib/utils/typeConverters/dbToXml.js +9 -9
  113. package/lib/utils/typeConverters/jsonToDb.js +20 -27
  114. package/lib/utils/typeConverters/uriToDb.js +45 -92
  115. package/lib/utils/typeConverters/xmlValueToJson.js +9 -13
  116. package/lib/utils/typedObjects.js +11 -79
  117. package/lib/utils/utils.js +20 -23
  118. package/lib/xsodata.js +37 -47
  119. package/package.json +9 -11
  120. package/.npmignore +0 -40
package/CHANGELOG.md CHANGED
@@ -8,6 +8,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
8
8
 
9
9
  ## Unreleased
10
10
 
11
+ ## [8.3.1] - 2026-02-12
12
+
13
+ * FOSS related security updates
14
+
15
+ ## [8.3.0] - 2026-01-09
16
+
17
+ * FOSS related security updates
18
+ * Add support for node 24
19
+ * Batch responses additional CRLF fix
20
+
11
21
  ## [8.2.1] - 2025-03-21
12
22
 
13
23
  * FOSS related security updates
package/index.js CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
 
4
4
  //Includes
5
- var xsodata = require('./lib/xsodata');
6
- var configuration = require('./lib/configuration');
5
+ const xsodata = require('./lib/xsodata');
6
+ const configuration = require('./lib/configuration');
7
7
 
8
8
  //API
9
9
  module.exports.modes = configuration.modes;
@@ -148,6 +148,6 @@ exports.RequestOptions = function RequestOptions(init) {
148
148
 
149
149
  function check (target) {
150
150
  if ((target.mode !== exports.modes.development ) && (target.mode !== exports.modes.productive )) {
151
- throw('Invalid mode. See xsodata.modes for possible values.');
151
+ throw(new Error('Invalid mode. See xsodata.modes for possible values.'));
152
152
  }
153
153
  }
package/lib/db/connect.js CHANGED
@@ -93,7 +93,7 @@ function setHanaCloudContext(context, asyncDone) {
93
93
  }
94
94
 
95
95
  function isHanaCloudDb(context, version) {
96
- const regex = /^([0-9])+\..*$/;
96
+ const regex = /^(\d)+\..*$/;
97
97
  let result = version.match(regex);
98
98
 
99
99
  if (result && result[1]) {
@@ -28,6 +28,13 @@ exports.DBS_Navigation = 6; // expanded navigation || selected navigation
28
28
 
29
29
  exports.DbSegment = DbSegment;
30
30
 
31
+ const isSpecialCharacter = (createBy, createAt, modifyBy, modifyAt, property) => {
32
+ return (createBy && property === 'CREATED_BY') ||
33
+ (createAt && property === 'CREATED_AT') ||
34
+ (modifyBy && property === 'MODIFIED_BY') ||
35
+ (modifyAt && property === 'MODIFIED_AT');
36
+ };
37
+
31
38
  /**
32
39
  * Constructs a dbSegment. A dbSegment stores all information to load data from one actual database table
33
40
  *
@@ -189,9 +196,9 @@ DbSegment.prototype.isPrincipal = function () {
189
196
  * @returns {undefined|{key: string, value: string}}
190
197
  */
191
198
  DbSegment.prototype.getKeyValue = function (key) {
192
- for (let i = 0; i < this._KeyValues.length; i++) {
193
- if (this._KeyValues[i].name === key) {
194
- return this._KeyValues[i];
199
+ for (const keyValue of this._KeyValues) {
200
+ if (keyValue.name === key) {
201
+ return keyValue;
195
202
  }
196
203
  }
197
204
  return undefined;
@@ -211,23 +218,16 @@ DbSegment.prototype.hasKeyValues = function () {
211
218
  */
212
219
  DbSegment.prototype.setRecordFromPostPayload = function (context, record) {
213
220
  const converterArray = typeConverter.converterFunctions.jsonPayloadToDbName;
214
- // const converterArray1 = typeConverter.converterFunctions.uriPayloadToDbName;
215
221
  const supportNullable = context.gModel.isNullSupported();
216
-
217
222
  const createBy = this.entityType.getAddAdmindata('create', 'by');
218
223
  const createAt = this.entityType.getAddAdmindata('create', 'at');
219
224
  const modifyBy = this.entityType.getAddAdmindata('modify', 'by');
220
225
  const modifyAt = this.entityType.getAddAdmindata('modify', 'at');
221
-
222
226
  //Loop through the properties of the entityType.
223
- //Object.keys(this.entityType.propertiesMap).forEach(function (property) {
224
227
  for (let [key, prop] of Object.entries(this.entityType.propertiesMap)) {
225
228
  //Load property from record
226
229
  const value = record[key];
227
-
228
230
  let dbValue;
229
-
230
-
231
231
  if (value === undefined) {
232
232
  // Use columns default value
233
233
  if (prop.KIND === EntityType.entityKind.inputParameters) {
@@ -272,12 +272,9 @@ DbSegment.prototype.setRecordFromPostPayload = function (context, record) {
272
272
  const converter = converterArray[typeConverter.dbTypeNameToODataTypeName[dbType]];
273
273
  dbValue = converter(value, dbType);
274
274
  }
275
-
276
275
  this._recordMapFromPayload[key] = dbValue;
277
276
  this._recordNV.push({ name: key, value: dbValue });
278
277
  }
279
-
280
-
281
278
  //set KeyValues
282
279
  let max = this.entityType.keys.names.length;
283
280
  for (let i = 0; i < max; i++) {
@@ -310,7 +307,6 @@ DbSegment.prototype.setRecordFromPutPayload = function (context, record) {
310
307
  const modifyBy = this.entityType.getAddAdmindata('modify', 'by');
311
308
  const modifyAt = this.entityType.getAddAdmindata('modify', 'at');
312
309
 
313
-
314
310
  //Check if all required properties are send to server
315
311
  Object.keys(this.entityType.propertiesMap).forEach(function (property) {
316
312
  let dbValue;
@@ -336,10 +332,7 @@ DbSegment.prototype.setRecordFromPutPayload = function (context, record) {
336
332
 
337
333
  if (!(
338
334
  // skip special properties
339
- (createBy && property === 'CREATED_BY') ||
340
- (createAt && property === 'CREATED_AT') ||
341
- (modifyBy && property === 'MODIFIED_BY') ||
342
- (modifyAt && property === 'MODIFIED_AT') ||
335
+ isSpecialCharacter(createBy, createAt, modifyBy, modifyAt, property) ||
343
336
  // skip optional calc view parameters
344
337
  (this.entityType.propertiesMap[property] && this.entityType.propertiesMap[property].MANDATORY === 0)
345
338
  )) {
@@ -450,8 +443,8 @@ DbSegment.prototype.setLinks = function () {
450
443
  DbSegment.prototype.getQKeyProperties = function () {
451
444
  let ret = [];
452
445
 
453
- for (let i = 0; i < this.entityType.keys.names.length; i++) {
454
- ret.push(new sqlStatement.TableColumn(this._Alias, this.entityType.keys.names[i]));
446
+ for (const element of this.entityType.keys.names) {
447
+ ret.push(new sqlStatement.TableColumn(this._Alias, element));
455
448
  }
456
449
  return ret;
457
450
  };
@@ -534,8 +527,8 @@ DbSegment.prototype.validateInputParameters = function () {
534
527
  }
535
528
  }
536
529
 
537
- for (let i = 0; i < this._InputParams.length; i++) {
538
- let keyName = this._InputParams[i].key;
530
+ for (const element of this._InputParams) {
531
+ let keyName = element.key;
539
532
  if (!this.entityType.inputParameters[keyName]) {
540
533
  throw new InternalError('Inputparameter ' + keyName + ' unknown');
541
534
  }
@@ -545,13 +538,12 @@ DbSegment.prototype.validateInputParameters = function () {
545
538
  DbSegment.prototype.validateKeyParameters = function () {
546
539
  const keyNames = this.entityType.keyNamesOrdered;
547
540
 
548
- for (let i = 0; i < keyNames.length; i++) {
549
- const keyName = keyNames[i];
550
- const property = this.entityType.propertiesMap[keyName];
541
+ for (const element of keyNames) {
542
+ const property = this.entityType.propertiesMap[element];
551
543
 
552
544
  if (property.KIND !== EntityType.entityKind.inputParameters) {
553
- if (!this._InputParamsMap.has(keyName)) {
554
- throw new InternalError('Missing value for input parameter ' + keyName + '.');
545
+ if (!this._InputParamsMap.has(element)) {
546
+ throw new InternalError('Missing value for input parameter ' + element + '.');
555
547
  }
556
548
  }
557
549
  }
@@ -636,9 +628,9 @@ DbSegment.prototype.hasAliasedKeyPropertiesOnCalcView = function() {
636
628
  };
637
629
 
638
630
  DbSegment.prototype.getAliasedKeyPropertyOnCalcView = function(propertyName) {
639
- for (let i = 0; i < this._aliasedKeyPropertiesOnCalcView.length; i++) {
640
- if (this._aliasedKeyPropertiesOnCalcView[i].property === propertyName) {
641
- return this._aliasedKeyPropertiesOnCalcView[i];
631
+ for (const prop of this._aliasedKeyPropertiesOnCalcView) {
632
+ if (prop.property === propertyName) {
633
+ return prop;
642
634
  }
643
635
  }
644
636
  return null;
@@ -702,15 +694,13 @@ DbSegment.prototype.getKeyProperties0123ForOrderBy = function (noTable) {
702
694
 
703
695
  DbSegment.prototype.getKeyProperties0123ForOrderByCalcView = function (noTable) {
704
696
  let ret = [];
705
- let keyName;
706
697
  let property;
707
698
  let j = -1;
708
699
 
709
700
  let keyNames = this.entityType.keyNamesOrdered;
710
701
 
711
- for (let i = 0; i < keyNames.length; i++) {
702
+ for (const keyName of keyNames) {
712
703
 
713
- keyName = keyNames[i];
714
704
  property = this.entityType.propertiesMap[keyName];
715
705
 
716
706
  if (property.KIND !== EntityType.entityKind.inputParameters) {
@@ -765,8 +755,7 @@ DbSegment.prototype.getKeyPropertiesNotSelectedForCreate = function () {
765
755
  let propertiesMap = this.entityType.propertiesMap;
766
756
 
767
757
 
768
- for (let i = 0; i < keyNames.length; i++) {
769
- let keyName = keyNames[i];
758
+ for (const keyName of keyNames) {
770
759
  if ((this._getSortedSelectProperties().indexOf(keyName) === -1) && (this._SelectedNavigations.indexOf(keyName) === -1)) {
771
760
  let property = propertiesMap[keyName];
772
761
  let typeString = createPropertyTypeString(property, this.entityType);
@@ -782,11 +771,9 @@ DbSegment.prototype.getKeyPropertiesNotSelectedForCreate = function () {
782
771
  DbSegment.prototype.getPropertiesForCreate = function () {
783
772
  let ret = [];
784
773
 
785
- //let properties = this.entityType.properties;
786
774
  let properties = this._getSortedSelectProperties();
787
- for (let i = 0; i < properties.length; i++) {
788
- let property = this.entityType.propertiesMap[properties[i]];
789
-
775
+ for (const prop of properties) {
776
+ let property = this.entityType.propertiesMap[prop];
790
777
  ret.push(
791
778
  createSqlCreateProperty(property, this.entityType)
792
779
  );
@@ -823,9 +810,9 @@ DbSegment.prototype.getOverPropertiesForCreate = function () {
823
810
  properties.push(keyProp);
824
811
  }
825
812
 
826
- for (let i = 0; i < properties.length; i++) {
813
+ for (const property of properties) {
827
814
  ret.push(
828
- createSqlCreateProperty(properties[i], properties[i]._entityType)
815
+ createSqlCreateProperty(property, property._entityType)
829
816
  );
830
817
  }
831
818
  return ret;
@@ -856,24 +843,12 @@ function createPropertyTypeString(property, entityType) {
856
843
  checkLength(property);
857
844
  const scale = property.SCALE ? property.SCALE.toString() : 0;
858
845
  typeString += '(' + property.LENGTH.toString() + ',' + scale + ')';
859
- } else if (typeString === 'VARCHAR') {
860
- checkLength(property);
861
- typeString += '(' + property.LENGTH.toString() + ')';
862
- } else if (typeString === 'NVARCHAR') {
863
- checkLength(property);
864
- typeString += '(' + property.LENGTH.toString() + ')';
865
- } else if (typeString === 'ALPHANUM') {
866
- checkLength(property);
867
- typeString += '(' + property.LENGTH.toString() + ')';
868
- } else if (typeString === 'CHAR') {
846
+ } else if (typeString === 'VARCHAR' || typeString === 'NVARCHAR' ||
847
+ typeString === 'ALPHANUM' || typeString === 'CHAR' ||
848
+ typeString === 'NCHAR' || typeString === 'VARBINARY') {
849
+
869
850
  checkLength(property);
870
851
  typeString += '(' + property.LENGTH.toString() + ')';
871
- } else if (typeString === 'NCHAR') {
872
- checkLength(property);
873
- typeString += '(' + property.LENGTH.toString() + ')';
874
- } else if (typeString === 'VARBINARY') {
875
- checkLength(property);
876
- typeString += '(' + property.LENGTH.toString() + ')'; // ON
877
852
  } else if (typeString === 'SHORTTEXT') {
878
853
  typeString = 'NVARCHAR(10)';
879
854
  }
@@ -896,19 +871,19 @@ DbSegment.prototype.getPropertiesForSelectCollectInputParameters = function (noT
896
871
  let selectProperty;
897
872
  let propertyType;
898
873
 
899
- for (let i = 0; i < properties.length; i++) {
900
- property = this.entityType.propertiesMap[properties[i]];
874
+ for (const prop of properties) {
875
+ property = this.entityType.propertiesMap[prop];
901
876
  selectProperty = null;
902
877
 
903
878
  if (property.KIND === EntityType.entityKind.inputParameters) {
904
879
  let paramValue = this.getParameterValue(property.COLUMN_NAME);
905
- selectProperty = new sqlStatement.ParameterSelectProperty(noTable ? null : this._Alias, properties[i], null, paramValue);
880
+ selectProperty = new sqlStatement.ParameterSelectProperty(noTable ? null : this._Alias, prop, null, paramValue);
906
881
  selectProperty._property = property;
907
882
  selectProperty._dbType = property.aggregate ? null : property.DATA_TYPE_NAME;
908
883
  retInput.push(selectProperty);
909
884
  } else {
910
885
  propertyType = property.aggregate ? null : property.DATA_TYPE_NAME;
911
- selectProperty = new sqlStatement.SelectProperty(noTable ? null : this._Alias, properties[i], propertyType, null);
886
+ selectProperty = new sqlStatement.SelectProperty(noTable ? null : this._Alias, prop, propertyType, null);
912
887
  ret.push(selectProperty);
913
888
  }
914
889
  }
@@ -932,16 +907,16 @@ DbSegment.prototype.getPropertiesForSelect = function (noTable) {
932
907
  selectProperty,
933
908
  propertyType;
934
909
 
935
- for (let i = 0; i < properties.length; i++) {
936
- property = this.entityType.propertiesMap[properties[i]];
910
+ for (const prop of properties) {
911
+ property = this.entityType.propertiesMap[prop];
937
912
  selectProperty = null;
938
913
 
939
914
  if (property.KIND === EntityType.entityKind.inputParameters) {
940
915
  let paramValue = this.getParameterValue(property.COLUMN_NAME);
941
- selectProperty = new sqlStatement.ParameterSelectProperty(noTable ? null : this._Alias, properties[i], null, paramValue);
916
+ selectProperty = new sqlStatement.ParameterSelectProperty(noTable ? null : this._Alias, prop, null, paramValue);
942
917
  } else {
943
918
  propertyType = property.aggregate ? null : property.DATA_TYPE_NAME;
944
- selectProperty = new sqlStatement.SelectProperty(noTable ? null : this._Alias, properties[i], propertyType, null);
919
+ selectProperty = new sqlStatement.SelectProperty(noTable ? null : this._Alias, prop, propertyType, null);
945
920
  }
946
921
 
947
922
  ret.push(selectProperty);
@@ -961,11 +936,11 @@ DbSegment.prototype.getSelectFragmentsFromAllProperties = function (noTable) {
961
936
  let ret = [];
962
937
  let properties = this._getSortedSelectProperties();
963
938
 
964
- for (let i = 0; i < properties.length; i++) {
965
- const property = this.entityType.propertiesMap[properties[i]];
939
+ for (const prop of properties) {
940
+ const property = this.entityType.propertiesMap[prop];
966
941
  // this include property KIND === inputParameters
967
942
  const propertyType = property.aggregate ? null : property.DATA_TYPE_NAME;
968
- ret.push(new sqlStatement.SelectProperty(noTable ? null : this._Alias, properties[i], propertyType, null));
943
+ ret.push(new sqlStatement.SelectProperty(noTable ? null : this._Alias, prop, propertyType, null));
969
944
  }
970
945
  return ret;
971
946
  };
@@ -980,16 +955,16 @@ DbSegment.prototype.getSelectFragmentsForOverProperties = function (rId) {
980
955
  let over = this.getOver();
981
956
  let properties = [];
982
957
 
983
- for (let i = 0; i < over.principal.length; i++) {
984
- properties.push(over.principal[i]);
958
+ for (const property of over.principal) {
959
+ properties.push(property);
985
960
  }
986
961
 
987
- for (let i = 0; i < over.dependent.length; i++) {
988
- properties.push(over.dependent[i]);
962
+ for (const property of over.dependent) {
963
+ properties.push(property);
989
964
  }
990
965
 
991
- for (let i = 0; i < properties.length; i++) {
992
- selectProperty = new sqlStatement.SelectProperty(rId, properties[i], null);
966
+ for (const property of properties) {
967
+ selectProperty = new sqlStatement.SelectProperty(rId, property, null);
993
968
  ret.push(
994
969
  selectProperty
995
970
  );
@@ -1130,19 +1105,16 @@ function concatJoinProperties(selectedProps, joinProps, table) {
1130
1105
  DbSegment.prototype.getNavPropertiesForCreate = function () {
1131
1106
  let ret = [];
1132
1107
 
1133
- //let properties = this.entityType.properties;
1134
1108
  let properties = this._SelectedNavigations;
1135
- for (let i = 0; i < properties.length; i++) {
1136
- let navPropertyName = properties[i];
1137
-
1109
+ for (const navPropertyName of properties) {
1138
1110
  let navDbSeg = this._relevantNavigationSegments[navPropertyName];
1139
1111
  if (!navDbSeg) {
1140
1112
  continue;
1141
1113
  }
1142
1114
  let propertyNames = navDbSeg.getFrom().joinproperties;
1143
1115
 
1144
- for (let ii = 0; ii < propertyNames.length; ii++) {
1145
- let property = this.entityType.propertiesMap[propertyNames[ii]];
1116
+ for (const prop of propertyNames) {
1117
+ let property = this.entityType.propertiesMap[prop];
1146
1118
  let propertyName = property.COLUMN_NAME;
1147
1119
  if (this._getSortedSelectProperties().indexOf(propertyName) > -1) {
1148
1120
  continue;
@@ -1176,10 +1148,8 @@ DbSegment.prototype.getNavPropertiesForCreate = function () {
1176
1148
  DbSegment.prototype.getNavPropertiesForSelect = function (noTable) {
1177
1149
  let ret = [];
1178
1150
 
1179
- //let properties = this.entityType.properties;
1180
1151
  let properties = this._SelectedNavigations;
1181
- for (let i = 0; i < properties.length; i++) {
1182
- let navPropertyName = properties[i];
1152
+ for (const navPropertyName of properties) {
1183
1153
  if (this._getSortedSelectProperties().indexOf(navPropertyName) > -1) {
1184
1154
  continue;
1185
1155
  }
@@ -1190,15 +1160,15 @@ DbSegment.prototype.getNavPropertiesForSelect = function (noTable) {
1190
1160
  let propertyNames = navDbSeg.getFrom().joinproperties;
1191
1161
 
1192
1162
 
1193
- for (let ii = 0; ii < propertyNames.length; ii++) {
1194
- let property = this.entityType.propertiesMap[propertyNames[ii]];
1163
+ for (const prop of propertyNames) {
1164
+ let property = this.entityType.propertiesMap[prop];
1195
1165
  let propertyName = property.COLUMN_NAME;
1196
1166
  if (this._getSortedSelectProperties().indexOf(propertyName) > -1) {
1197
1167
  continue;
1198
1168
  }
1199
1169
 
1200
1170
  ret.push(
1201
- new sqlStatement.SelectProperty(noTable ? null : this._Alias, propertyNames[ii], null)
1171
+ new sqlStatement.SelectProperty(noTable ? null : this._Alias, prop, null)
1202
1172
  );
1203
1173
  }
1204
1174
  }
@@ -1214,13 +1184,11 @@ DbSegment.prototype.getNavPropertiesForSelect = function (noTable) {
1214
1184
  DbSegment.prototype.getNonKeyNonSelectedProperties4Expansion = function () {
1215
1185
  //
1216
1186
  let ret = [];
1217
- for (let i = 0; i < this._ExpandedNavigations.length; i++) {
1218
- let exp = this._relevantNavigationSegments[this._ExpandedNavigations[i]];
1187
+ for (const expandedNavigation of this._ExpandedNavigations) {
1188
+ let exp = this._relevantNavigationSegments[expandedNavigation];
1219
1189
  let from = exp._end.from;
1220
1190
 
1221
- for (let ii = 0; ii < from.joinproperties.length; ii++) {
1222
- let joinProperty = from.joinproperties[ii];
1223
-
1191
+ for (const joinProperty of from.joinproperties) {
1224
1192
  //Non Key
1225
1193
  if (this.entityType.keys.names.indexOf(joinProperty) === -1) {
1226
1194
  if (this._getSortedSelectProperties().indexOf(joinProperty) === -1) {
@@ -1241,14 +1209,9 @@ DbSegment.prototype.getNonKeyNonSelectedProperties4Expansion = function () {
1241
1209
  * @returns {sqlStatement.TableColumn[]}
1242
1210
  */
1243
1211
  DbSegment.prototype.getQNonKeyProperties = function () {
1244
-
1245
1212
  let ret = [];
1246
- let propertyName;
1247
-
1248
-
1249
- for (let i = 0; i < this._getSortedSelectProperties().length; i++) {
1250
- propertyName = this._getSortedSelectProperties()[i];
1251
1213
 
1214
+ for (const propertyName of this._getSortedSelectProperties()) {
1252
1215
  if (this.entityType.keys.names.indexOf(propertyName) === -1) {
1253
1216
  ret.push(new sqlStatement.TableColumn(this._Alias, propertyName));
1254
1217
  }
@@ -1265,13 +1228,10 @@ DbSegment.prototype.getQNonKeyProperties = function () {
1265
1228
  DbSegment.prototype.getQNonKeyPropertiesForSelect = function () {
1266
1229
  let ret = [];
1267
1230
  let propertiesMap = this.entityType.propertiesMap;
1268
- let propertyName;
1269
1231
  let property;
1270
1232
  let propertyType;
1271
1233
 
1272
- for (let i = 0; i < this._getSortedSelectProperties().length; i++) {
1273
- propertyName = this._getSortedSelectProperties()[i];
1274
-
1234
+ for (const propertyName of this._getSortedSelectProperties()) {
1275
1235
  if (this.entityType.keys.names.indexOf(propertyName) === -1) {
1276
1236
  property = propertiesMap[propertyName];
1277
1237
  propertyType = property.aggregate ? null : property.DATA_TYPE_NAME;
@@ -1314,12 +1274,12 @@ DbSegment.prototype.getQForeignKeyProperties = function () {
1314
1274
  */
1315
1275
  DbSegment.prototype.getQKeyWithValues = function (alias) {
1316
1276
  let ret = [];
1317
- for (let i = 0; i < this._KeyValues.length; i++) {
1318
- let etProperty = this.entityType.propertiesMap[this._KeyValues[i].name];
1277
+ for (const keyValue of this._KeyValues) {
1278
+ let etProperty = this.entityType.propertiesMap[keyValue.name];
1319
1279
  if (etProperty.KIND !== EntityType.entityKind.inputParameters) {
1320
1280
  ret.push({
1321
- key: new typedObjects.Property(this._KeyValues[i].name, alias ? alias : this._Alias, etProperty.DATA_TYPE_NAME),
1322
- value: this._KeyValues[i].value
1281
+ key: new typedObjects.Property(keyValue.name, alias ? alias : this._Alias, etProperty.DATA_TYPE_NAME),
1282
+ value: keyValue.value
1323
1283
  });
1324
1284
  }
1325
1285
  }
@@ -1329,11 +1289,11 @@ DbSegment.prototype.getQKeyWithValues = function (alias) {
1329
1289
  DbSegment.prototype.getQKeyWithValuesDB = function (alias) {
1330
1290
  let ret = [];
1331
1291
 
1332
- for (let i = 0; i < this._KeyValues.length; i++) {
1292
+ for (const keyValue of this._KeyValues) {
1333
1293
 
1334
1294
  ret.push({
1335
- key: new typedObjects.Property(this._KeyValues[i].name, alias ? alias : this._Alias, this._KeyValues[i].dbType), //OK
1336
- value: new typedObjects.DbValue(this._KeyValues[i].value, this._KeyValues[i].dbType) // Ok
1295
+ key: new typedObjects.Property(keyValue.name, alias ? alias : this._Alias, keyValue.dbType), //OK
1296
+ value: new typedObjects.DbValue(keyValue.value, keyValue.dbType) // Ok
1337
1297
  });
1338
1298
  }
1339
1299
  return ret;
@@ -1364,7 +1324,6 @@ DbSegment.prototype.getQForeignKeyWithValues = function (alias) {
1364
1324
 
1365
1325
  DbSegment.prototype.getOverPropertiesWithValues = function () {
1366
1326
  let ret = [], dbSeg, refDBSeg;
1367
- //var a = (alias ? alias : this._Alias);
1368
1327
 
1369
1328
  if (this.previousDBSegment) {
1370
1329
  refDBSeg = this.previousDBSegment;
@@ -1395,19 +1354,6 @@ DbSegment.prototype.getOverPropertiesWithValues = function () {
1395
1354
  return ret;
1396
1355
  };
1397
1356
 
1398
- /*
1399
- DbSegment.prototype.dump = function (logger, addText) {
1400
- let text = addText || 'DbSegment: ';
1401
- let filter = function (key, value) {
1402
- if (key === '__metadata' || key === 'previousDBSegment') {
1403
- return undefined;
1404
- }
1405
- return value;
1406
- };
1407
- logger.debug(text + JSON.stringify(this, filter, 4));
1408
- };
1409
- */
1410
-
1411
1357
  /**
1412
1358
  * Add a navigationDbSegment to the expand tree
1413
1359
  *
@@ -1542,7 +1488,6 @@ DbSegment.prototype.getRowsWithGenKey = function getRowsWithGenKey() {
1542
1488
  if (genKey) {
1543
1489
  if (!this._rowsWithGenKey) {
1544
1490
  this._rowsWithGenKey = this.sql.rows.map(function (row, index) {
1545
- // let cloneRow = xsODataUtils.clone(row);
1546
1491
  let cloneRow = {};
1547
1492
  for (let key of Object.keys(row)) {
1548
1493
  cloneRow[key] = row[key];
@@ -28,21 +28,15 @@ module.exports.shouldNotCleanTmpTables = (context) => {
28
28
  fixed in release 2.00.030.00 ---> 2.00.030.00.1522209842 HANA 2.0 SPS 03; revision SPS number 0
29
29
  */
30
30
 
31
- if ((utils.compareDBVersion(version, '1.00.122.16.1520578817', utils.SAME_3RD_SPS) === utils.VERSION_A_COVERS_VERSION_B) ||
31
+ return (utils.compareDBVersion(version, '1.00.122.16.1520578817', utils.SAME_3RD_SPS) === utils.VERSION_A_COVERS_VERSION_B) ||
32
32
  (utils.compareDBVersion(version, '1.00.123.00.0000000000', utils.SAME_2ND) === utils.VERSION_A_COVERS_VERSION_B) ||
33
33
  (utils.compareDBVersion(version, '1.01.000.00.0000000000', utils.SAME_1ST_HANA_REL) === utils.VERSION_A_COVERS_VERSION_B) ||
34
-
35
34
  (utils.compareDBVersion(version, '2.00.012.04.1517989041', utils.SAME_3RD_SPS) === utils.VERSION_A_COVERS_VERSION_B) ||
36
-
37
35
  (utils.compareDBVersion(version, '2.00.024.00.1520347815', utils.SAME_3RD_SPS) === utils.VERSION_A_COVERS_VERSION_B) ||
38
-
39
36
  (utils.compareDBVersion(version, '2.00.030.00.1522209842', utils.SAME_3RD_SPS) === utils.VERSION_A_COVERS_VERSION_B) ||
40
37
  (utils.compareDBVersion(version, '2.00.031.00.0000000000', utils.SAME_2ND) === utils.VERSION_A_COVERS_VERSION_B) ||
41
38
  (utils.compareDBVersion(version, '2.01.000.00.0000000000', utils.SAME_1ST_HANA_REL) === utils.VERSION_A_COVERS_VERSION_B) ||
42
- (utils.compareDBVersion(version, '3.00.000.00.0000000000', utils.NO_FIX_PART) === utils.VERSION_A_COVERS_VERSION_B)) {
39
+ (utils.compareDBVersion(version, '3.00.000.00.0000000000', utils.NO_FIX_PART) === utils.VERSION_A_COVERS_VERSION_B);
43
40
 
44
- return true;// skip cleanup
45
- }
46
- return false; // do cleanup
47
41
  };
48
42
 
@@ -4,8 +4,8 @@
4
4
  * @module configuration
5
5
  */
6
6
 
7
- var utils = require('./utils/utils');
8
- var configuration = require('./configuration');
7
+ const utils = require('./utils/utils');
8
+ const configuration = require('./configuration');
9
9
 
10
10
  /**
11
11
  * Holds the runtime configuration for the OData handler.