@sap/xsodata 8.3.0 → 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.
- package/CHANGELOG.md +4 -0
- package/index.js +2 -2
- package/lib/configuration.js +1 -1
- package/lib/db/connect.js +1 -1
- package/lib/db/dbSegment.js +68 -123
- package/lib/db/dbVersionChecks.js +2 -8
- package/lib/handlerConfiguration.js +2 -2
- package/lib/http/conditionalHttpHandler.js +27 -34
- package/lib/http/simpleHttpRequest.js +14 -18
- package/lib/http/simpleHttpResponse.js +4 -4
- package/lib/http/uriParser.js +9 -9
- package/lib/http/validator/httpRequestValidator.js +9 -9
- package/lib/model/annotationFactory.js +11 -11
- package/lib/model/association.js +3 -3
- package/lib/model/entityType.js +33 -67
- package/lib/model/metadataReader.js +31 -52
- package/lib/model/model.js +0 -1
- package/lib/model/validator/xsoDataConcurrencyTokenValidator.js +6 -6
- package/lib/model/xsodataReader.js +36 -28
- package/lib/processor/authorizationProcessor.js +22 -33
- package/lib/processor/batchProcessor.js +22 -33
- package/lib/processor/errorProcessor.js +4 -4
- package/lib/processor/exitProcessor.js +19 -19
- package/lib/processor/processor.js +9 -9
- package/lib/processor/resourceProcessor.js +31 -61
- package/lib/processor/resourceProcessorDelete.js +16 -16
- package/lib/processor/resourceProcessorDeleteLinks.js +25 -25
- package/lib/processor/resourceProcessorGet.js +5 -5
- package/lib/processor/resourceProcessorPost.js +43 -45
- package/lib/processor/resourceProcessorPut.js +35 -39
- package/lib/processor/resourceProcessorPutPostLinks.js +38 -39
- package/lib/security/securityContext.js +5 -5
- package/lib/serializer/atomSerializer.js +54 -55
- package/lib/serializer/atomXmlToJsonSerializer.js +32 -44
- package/lib/serializer/content.js +5 -5
- package/lib/serializer/json.js +31 -33
- package/lib/serializer/jsonSerializer.js +4 -4
- package/lib/serializer/metadataSerializer.js +32 -35
- package/lib/serializer/serializer.js +29 -43
- package/lib/serializer/serviceSerializer.js +19 -24
- package/lib/serializer/value.js +1 -2
- package/lib/serializer/xmlToJsonSerializer.js +18 -18
- package/lib/sql/createDeleteLinksStatements.js +10 -10
- package/lib/sql/createDeleteStatements.js +12 -12
- package/lib/sql/createGetStatements.js +49 -107
- package/lib/sql/createLinksSQLStatements_1_n.js +27 -27
- package/lib/sql/createPutPostLinksStatements.js +9 -9
- package/lib/sql/createPutStatements.js +0 -1
- package/lib/sql/dataCollectorDelete.js +9 -9
- package/lib/sql/dataCollectorDeleteLinks.js +3 -3
- package/lib/sql/dataCollectorGet.js +9 -17
- package/lib/sql/dataCollectorLinks.js +23 -27
- package/lib/sql/dataCollectorPost.js +20 -20
- package/lib/sql/dataCollectorPut.js +36 -36
- package/lib/sql/dataCollectorPutPostLinks.js +3 -3
- package/lib/sql/sqlStatement.js +81 -128
- package/lib/sql/sqlTools.js +3 -7
- package/lib/sql/statementProcessor.js +7 -14
- package/lib/uri/applyChecks.js +3 -3
- package/lib/uri/checks/checkAllowedMethod.js +3 -3
- package/lib/uri/checks/checkAllowedMethodForBatch.js +2 -2
- package/lib/uri/checks/checkAllowedMethodsForResourcePath.js +3 -3
- package/lib/uri/checks/checkFilterOnAggregatedColumn.js +5 -5
- package/lib/uri/checks/checkFilterOrderByOnGenKeyColumn.js +6 -6
- package/lib/uri/checks/checkGenKeyRestrictions.js +2 -2
- package/lib/uri/checks/checkModificationForbidden.js +3 -3
- package/lib/uri/checks/checkPostPutDeleteChecks.js +5 -5
- package/lib/uri/checks/checkSystemQueryOptions.js +10 -10
- package/lib/uri/checks.js +15 -15
- package/lib/uri/expandSelectTreeBuilder.js +12 -16
- package/lib/uri/oDataUriParser.js +20 -20
- package/lib/uri/queryParameterParser.js +25 -33
- package/lib/uri/resourcePathParser.js +47 -62
- package/lib/uri/uriType.js +4 -4
- package/lib/utils/associations.js +4 -4
- package/lib/utils/batch/batchExecutor.js +49 -51
- package/lib/utils/batch/batchObjects.js +10 -10
- package/lib/utils/batch/batchParser.js +27 -28
- package/lib/utils/batch/batchWriter.js +1 -1
- package/lib/utils/checkContentType.js +34 -39
- package/lib/utils/debugView.js +35 -36
- package/lib/utils/errors/applicationError.js +2 -2
- package/lib/utils/errors/debugInfo.js +2 -2
- package/lib/utils/errors/http/badRequest.js +2 -2
- package/lib/utils/errors/http/forbidden.js +2 -2
- package/lib/utils/errors/http/methodNotAllowed.js +2 -2
- package/lib/utils/errors/http/notAcceptable.js +2 -2
- package/lib/utils/errors/http/notFound.js +2 -2
- package/lib/utils/errors/http/notImplemented.js +2 -2
- package/lib/utils/errors/http/notModified.js +2 -2
- package/lib/utils/errors/http/notSupported.js +2 -2
- package/lib/utils/errors/http/preconditionFailed.js +2 -2
- package/lib/utils/errors/http/preconditionRequired.js +2 -2
- package/lib/utils/errors/http/unauthorized.js +2 -2
- package/lib/utils/errors/http/unsupportedMediaType.js +2 -2
- package/lib/utils/errors/httpError.js +2 -2
- package/lib/utils/errors/internalError.js +2 -2
- package/lib/utils/errors/modelFileError.js +2 -2
- package/lib/utils/errors/sqlError.js +2 -2
- package/lib/utils/errors/testError.js +2 -2
- package/lib/utils/errors/typeError.js +5 -5
- package/lib/utils/errors/xsODataError.js +1 -1
- package/lib/utils/logger.js +21 -32
- package/lib/utils/measurement.js +14 -13
- package/lib/utils/requestContext.js +2 -2
- package/lib/utils/stateMaschine.js +6 -6
- package/lib/utils/tableCleanup.js +3 -3
- package/lib/utils/typeConverter.js +21 -21
- package/lib/utils/typeConverters/converterTools.js +25 -331
- package/lib/utils/typeConverters/dbToJson.js +3 -3
- package/lib/utils/typeConverters/dbToUri.js +7 -7
- package/lib/utils/typeConverters/dbToXml.js +9 -9
- package/lib/utils/typeConverters/jsonToDb.js +20 -27
- package/lib/utils/typeConverters/uriToDb.js +45 -92
- package/lib/utils/typeConverters/xmlValueToJson.js +9 -13
- package/lib/utils/typedObjects.js +11 -79
- package/lib/utils/utils.js +20 -23
- package/lib/xsodata.js +37 -47
- package/package.json +3 -5
- package/.npmignore +0 -40
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
//Includes
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const xsodata = require('./lib/xsodata');
|
|
6
|
+
const configuration = require('./lib/configuration');
|
|
7
7
|
|
|
8
8
|
//API
|
|
9
9
|
module.exports.modes = configuration.modes;
|
package/lib/configuration.js
CHANGED
|
@@ -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
package/lib/db/dbSegment.js
CHANGED
|
@@ -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 (
|
|
193
|
-
if (
|
|
194
|
-
return
|
|
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
|
|
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 (
|
|
454
|
-
ret.push(new sqlStatement.TableColumn(this._Alias,
|
|
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 (
|
|
538
|
-
let keyName =
|
|
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 (
|
|
549
|
-
const
|
|
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(
|
|
554
|
-
throw new InternalError('Missing value for input parameter ' +
|
|
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 (
|
|
640
|
-
if (
|
|
641
|
-
return
|
|
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 (
|
|
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 (
|
|
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 (
|
|
788
|
-
let property = this.entityType.propertiesMap[
|
|
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 (
|
|
813
|
+
for (const property of properties) {
|
|
827
814
|
ret.push(
|
|
828
|
-
createSqlCreateProperty(
|
|
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
|
-
|
|
861
|
-
typeString
|
|
862
|
-
|
|
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 (
|
|
900
|
-
property = this.entityType.propertiesMap[
|
|
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,
|
|
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,
|
|
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 (
|
|
936
|
-
property = this.entityType.propertiesMap[
|
|
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,
|
|
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,
|
|
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 (
|
|
965
|
-
const property = this.entityType.propertiesMap[
|
|
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,
|
|
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 (
|
|
984
|
-
properties.push(
|
|
958
|
+
for (const property of over.principal) {
|
|
959
|
+
properties.push(property);
|
|
985
960
|
}
|
|
986
961
|
|
|
987
|
-
for (
|
|
988
|
-
properties.push(
|
|
962
|
+
for (const property of over.dependent) {
|
|
963
|
+
properties.push(property);
|
|
989
964
|
}
|
|
990
965
|
|
|
991
|
-
for (
|
|
992
|
-
selectProperty = new sqlStatement.SelectProperty(rId,
|
|
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 (
|
|
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 (
|
|
1145
|
-
let property = this.entityType.propertiesMap[
|
|
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 (
|
|
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 (
|
|
1194
|
-
let property = this.entityType.propertiesMap[
|
|
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,
|
|
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 (
|
|
1218
|
-
let exp = this._relevantNavigationSegments[
|
|
1187
|
+
for (const expandedNavigation of this._ExpandedNavigations) {
|
|
1188
|
+
let exp = this._relevantNavigationSegments[expandedNavigation];
|
|
1219
1189
|
let from = exp._end.from;
|
|
1220
1190
|
|
|
1221
|
-
for (
|
|
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 (
|
|
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 (
|
|
1318
|
-
let etProperty = this.entityType.propertiesMap[
|
|
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(
|
|
1322
|
-
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 (
|
|
1292
|
+
for (const keyValue of this._KeyValues) {
|
|
1333
1293
|
|
|
1334
1294
|
ret.push({
|
|
1335
|
-
key: new typedObjects.Property(
|
|
1336
|
-
value: new typedObjects.DbValue(
|
|
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
|
-
|
|
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
|
-
|
|
8
|
-
|
|
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.
|