@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const util = require('util');
|
|
3
|
+
const InternalError = require('./internalError');
|
|
4
4
|
|
|
5
|
-
module.exports =
|
|
5
|
+
module.exports = XsODataTypeError;
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Error during type convertion
|
|
@@ -11,10 +11,10 @@ module.exports = TypeError;
|
|
|
11
11
|
* @param information
|
|
12
12
|
* @constructor
|
|
13
13
|
*/
|
|
14
|
-
function
|
|
14
|
+
function XsODataTypeError(message, context, information) {
|
|
15
15
|
InternalError.call(this, message, context);
|
|
16
16
|
this.message = message;
|
|
17
17
|
this.information = information;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
util.inherits(
|
|
20
|
+
util.inherits(XsODataTypeError, InternalError);
|
package/lib/utils/logger.js
CHANGED
|
@@ -55,18 +55,16 @@ let XSODATA_LOG_SQL_DATA = process.env.XSODATA_LOG_SQL_DATA || 0;
|
|
|
55
55
|
let XSODATA_LOG_SQL_DATA_VALUE_SIZE = process.env.XSODATA_LOG_SQL_DATA_VALUE_SIZE || 20;
|
|
56
56
|
let XSODATA_LOG_SQL_DATA_ARRAY_SIZE = process.env.XSODATA_LOG_SQL_DATA_ARRAY_SIZE || 30;
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var logLevels = {
|
|
58
|
+
//XSODATA_LOG_LEVEL = 0
|
|
59
|
+
//XSODATA_LOG_REQUEST_TIME = 1
|
|
60
|
+
//XSODATA_FORCE_LOG_LONG_REQUEST = 1
|
|
61
|
+
//XSODATA_LOG_SQL_COMMAND = 0
|
|
62
|
+
//XSODATA_LOG_SQL_TIME = 0
|
|
63
|
+
//XSODATA_FORCE_LOG_LONG_SQL = 2
|
|
64
|
+
//XSODATA_LOG_SQL_PARAMETERS = 0
|
|
65
|
+
//XSODATA_LOG_SQL_DATA = 0
|
|
66
|
+
|
|
67
|
+
const logLevels = {
|
|
70
68
|
"error": 0,
|
|
71
69
|
"warn": 1,
|
|
72
70
|
"info": 2,
|
|
@@ -84,7 +82,7 @@ function printSqlData(array) {
|
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
if (typeof value === 'string' && value.length > XSODATA_LOG_SQL_DATA_VALUE_SIZE) {
|
|
87
|
-
ret += value.
|
|
85
|
+
ret += value.substring(0, XSODATA_LOG_SQL_DATA_VALUE_SIZE) + '.LEN:' + value.length;
|
|
88
86
|
continue;
|
|
89
87
|
}
|
|
90
88
|
if (Array.isArray(value) && value.length > XSODATA_LOG_SQL_DATA_ARRAY_SIZE) {
|
|
@@ -116,7 +114,7 @@ function printSqlParameters(array) {
|
|
|
116
114
|
}
|
|
117
115
|
|
|
118
116
|
if (typeof value === 'string' && value.length > XSODATA_LOG_SQL_PARAM_VALUE_SIZE) {
|
|
119
|
-
ret += value.
|
|
117
|
+
ret += value.substring(0, XSODATA_LOG_SQL_PARAM_VALUE_SIZE) + '<' + value.length + '>';
|
|
120
118
|
continue;
|
|
121
119
|
}
|
|
122
120
|
if (Array.isArray(value) && value.length > XSODATA_LOG_SQL_PARAM_ARRAY_SIZE) {
|
|
@@ -136,8 +134,8 @@ function printSqlParameters(array) {
|
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
//Code
|
|
139
|
-
|
|
140
|
-
}
|
|
137
|
+
class EmptyLogger {
|
|
138
|
+
}
|
|
141
139
|
|
|
142
140
|
EmptyLogger.prototype.cloneWithContext = function () {
|
|
143
141
|
return new EmptyLogger();
|
|
@@ -160,8 +158,6 @@ function Logger(logger, context) {
|
|
|
160
158
|
this.logger = logger || new EmptyLogger();
|
|
161
159
|
this.context = context || { callId: 0, uniqueNetworkRequestID: 0, uniqueRequestID: 0 };
|
|
162
160
|
this.info('Logger', 'Logger created for request');
|
|
163
|
-
//this.XSODATA_LOG_SQL_TIME = XSODATA_LOG_SQL_TIME;
|
|
164
|
-
//this.XSODATA_LOG_REQUEST_TIME = XSODATA_LOG_REQUEST_TIME;
|
|
165
161
|
}
|
|
166
162
|
|
|
167
163
|
Logger.prototype.cloneWithContext = function (context) {
|
|
@@ -257,14 +253,14 @@ Logger.prototype.getStartTimeSql = function () {
|
|
|
257
253
|
return null;
|
|
258
254
|
};
|
|
259
255
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
};
|
|
256
|
+
const padZeroMS = (value) => {
|
|
257
|
+
while (value.length < 6) {
|
|
258
|
+
value = '0' + value;
|
|
259
|
+
}
|
|
260
|
+
return value;
|
|
261
|
+
};
|
|
267
262
|
|
|
263
|
+
Logger.prototype.logSqlTime = function (text, startTime, sql) {
|
|
268
264
|
if (startTime) {
|
|
269
265
|
const hrtime = process.hrtime(startTime);
|
|
270
266
|
const ms = padZeroMS('' + Math.round(hrtime[1] / 1000));
|
|
@@ -288,13 +284,6 @@ Logger.prototype.getStartTimeRequest = function () {
|
|
|
288
284
|
|
|
289
285
|
|
|
290
286
|
Logger.prototype.logRequestTime = function (text, startTime, url) {
|
|
291
|
-
const padZeroMS = (value) => {
|
|
292
|
-
while (value.length < 6) {
|
|
293
|
-
value = '0' + value;
|
|
294
|
-
}
|
|
295
|
-
return value;
|
|
296
|
-
};
|
|
297
|
-
|
|
298
287
|
if (startTime) {
|
|
299
288
|
const hrtime = process.hrtime(startTime);
|
|
300
289
|
const ms = padZeroMS('' + Math.round(hrtime[1] / 1000));
|
package/lib/utils/measurement.js
CHANGED
|
@@ -44,7 +44,7 @@ Measurement.prototype.counterStop = function () {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
Measurement.prototype.newChild = function (name) {
|
|
47
|
-
|
|
47
|
+
const child = new Measurement(name);
|
|
48
48
|
this.children.push(child);
|
|
49
49
|
|
|
50
50
|
return child;
|
|
@@ -81,7 +81,7 @@ Measurement.getRunningMeasurement = function () {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
Measurement.removeFromStack = function (measure) {
|
|
84
|
-
|
|
84
|
+
let index = -1;
|
|
85
85
|
// search for the given measurement, based on "name"
|
|
86
86
|
Measurement.stack.forEach(function (value, i) {
|
|
87
87
|
if (value.name === measure.name) {
|
|
@@ -100,8 +100,8 @@ Measurement.measureAsync = function (fn, name) {
|
|
|
100
100
|
return function (contextOuter, asyncDone) {
|
|
101
101
|
// get the parent measurement, within which the current measurement will run (as a child)
|
|
102
102
|
// e.g. ODataHandler.processRequest is the parent of all waterfall's functions (e.g. db.connect)
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
const parent = Measurement.getRunningMeasurement();
|
|
104
|
+
const child = parent.newChild(name);
|
|
105
105
|
child.counterStart();
|
|
106
106
|
fn(contextOuter, function (err, context) {
|
|
107
107
|
child.counterStop();
|
|
@@ -118,14 +118,14 @@ Measurement.measureAsync = function (fn, name) {
|
|
|
118
118
|
};
|
|
119
119
|
|
|
120
120
|
Measurement.measureSync = function (fn /** args .., name*/) {
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
const args = Array.prototype.slice.call(arguments, 1, arguments.length - 1);
|
|
122
|
+
let res;
|
|
123
123
|
|
|
124
124
|
if (Measurement.isActive()) {
|
|
125
|
-
|
|
125
|
+
const name = arguments[arguments.length - 1];
|
|
126
126
|
// <-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
const parent = Measurement.getRunningMeasurement();
|
|
128
|
+
const child = parent.newChild(name);
|
|
129
129
|
child.counterStart();
|
|
130
130
|
// =
|
|
131
131
|
res = fn.apply(null, args);
|
|
@@ -140,14 +140,15 @@ Measurement.measureSync = function (fn /** args .., name*/) {
|
|
|
140
140
|
|
|
141
141
|
// when the function to be called has a callback
|
|
142
142
|
Measurement.measureWithCB = function (fn /** args, .., cb, name */) {
|
|
143
|
-
|
|
143
|
+
let args = Array.prototype.slice.call(arguments, 1, arguments.length - 2),
|
|
144
144
|
cb = arguments[arguments.length - 2];
|
|
145
145
|
args = args.concat(wrapCB);
|
|
146
|
+
let child;
|
|
146
147
|
|
|
147
148
|
if (Measurement.isActive()) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
const name = arguments[arguments.length - 1];
|
|
150
|
+
const parent = Measurement.getRunningMeasurement();
|
|
151
|
+
child = parent.newChild(name);
|
|
151
152
|
child.counterStart();
|
|
152
153
|
}
|
|
153
154
|
return fn.apply(null, args); // the counter implicitly stops
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const configuration = require('./../configuration');
|
|
3
|
+
const Logger = require('./../utils/logger');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Contains the context for a http request-response cycle
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/* jshint ignore:start */
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const EventEmitter = require("events").EventEmitter;
|
|
5
|
+
const utils = require("util");
|
|
6
6
|
|
|
7
7
|
module.exports = StateMaschine;
|
|
8
8
|
|
|
@@ -38,7 +38,7 @@ function handleError(error) {
|
|
|
38
38
|
*@param {string} stateName Name of state to set
|
|
39
39
|
*/
|
|
40
40
|
function setCurrentState(stateName) {
|
|
41
|
-
|
|
41
|
+
const state = this._context.states[stateName];
|
|
42
42
|
|
|
43
43
|
if (!state) {
|
|
44
44
|
throw new Error("State '" + stateName + "' does not exist");
|
|
@@ -143,8 +143,8 @@ StateMaschine.prototype.setFinal = function setFinal() {
|
|
|
143
143
|
*/
|
|
144
144
|
StateMaschine.prototype.next = function next(stateName, arg1) {
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
let resetCurrentState = false;
|
|
147
|
+
const currentStateTemp = this._currentState;
|
|
148
148
|
|
|
149
149
|
this._arg1 = arg1;
|
|
150
150
|
|
|
@@ -177,7 +177,7 @@ StateMaschine.prototype.next = function next(stateName, arg1) {
|
|
|
177
177
|
} catch (error) {
|
|
178
178
|
|
|
179
179
|
if (resetCurrentState === true) {
|
|
180
|
-
|
|
180
|
+
const lastState = this.getHistory().pop();
|
|
181
181
|
setCurrentState.call(this, lastState.name);
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const connect = require('../db/connect');
|
|
4
|
+
const statementProcessor = require('./../sql/statementProcessor');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Assert existing temp table statements. If there are still existing temp table
|
|
@@ -11,7 +11,7 @@ var statementProcessor = require('./../sql/statementProcessor');
|
|
|
11
11
|
* @param {Next} next The callback to be called when finish processing
|
|
12
12
|
*/
|
|
13
13
|
exports.assertCleanTempTables = function assertCleanTempTables(context, next) {
|
|
14
|
-
|
|
14
|
+
let statements, statementStr;
|
|
15
15
|
|
|
16
16
|
context.logger.info('xsodata', 'assertCleanTempTables');
|
|
17
17
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
//Include
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const dbToJson = require('./typeConverters/dbToJson').dbToJson;
|
|
5
|
+
const dbToXml = require('./typeConverters/dbToXml').dbToXml;
|
|
6
|
+
const dbToUri = require('./typeConverters/dbToUri').dbToUri;
|
|
7
|
+
const jsonToDb = require('./typeConverters/jsonToDb').jsonToDb;
|
|
8
|
+
const uriToDb = require('./typeConverters/uriToDb').uriToDb;
|
|
9
|
+
const xmlValueToOdataJson = require('./typeConverters/xmlValueToJson').xmlValueToODataJson;
|
|
10
|
+
const XsODataTypeError = require("./errors/typeError");
|
|
11
11
|
|
|
12
12
|
exports.converterFunctions = {
|
|
13
13
|
dbNameToUri: dbToUri,
|
|
@@ -19,7 +19,7 @@ exports.converterFunctions = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
exports.serializeDbValueToUriLiteral = function (value, propertyInfo) {
|
|
22
|
-
|
|
22
|
+
const dbTypeName = propertyInfo.DATA_TYPE_NAME;
|
|
23
23
|
return exports.converterFunctions.dbNameToUri[dbTypeName](value);
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -30,22 +30,22 @@ exports.serializeDbValueToUriLiteral = function (value, propertyInfo) {
|
|
|
30
30
|
* value like the and MUST HAVE .DATA_TYPE_NAME field which contains the
|
|
31
31
|
* db field declaration like "NVARCHAR"
|
|
32
32
|
*
|
|
33
|
-
* @throws {
|
|
33
|
+
* @throws {XsODataTypeError} Throws XsODataTypeError on invalid value
|
|
34
34
|
* @param value {String | Number} Value to convert
|
|
35
35
|
* @param propertyInfo {Object} Metadata object describing value parameter
|
|
36
36
|
* @returns {string|number|boolean} Corresponding DbJson value
|
|
37
37
|
*/
|
|
38
38
|
exports.serializeXmlValueToODataJsonValue = function (value, propertyInfo) {
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const dbTypeName = propertyInfo.DATA_TYPE_NAME;
|
|
41
|
+
const edmTypeName = dbTypeNameToODataTypeName[dbTypeName];
|
|
42
42
|
|
|
43
43
|
/*jshint eqnull:true */
|
|
44
44
|
if(edmTypeName == null){
|
|
45
|
-
throw new
|
|
45
|
+
throw new XsODataTypeError("Can not find edm type for db type name " + dbTypeName, propertyInfo);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
const convert = exports.converterFunctions.xmlValueToODataJson[edmTypeName];
|
|
49
49
|
if(typeof convert !== 'function'){
|
|
50
50
|
throw new Error("Converter function for "+edmTypeName+"(dbTypeName: "+dbTypeName+") could not be found!");
|
|
51
51
|
}
|
|
@@ -69,7 +69,7 @@ exports.oDataTypeIDs = [ //order is important
|
|
|
69
69
|
'Edm.Guid' // 11
|
|
70
70
|
];
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
const conversionODataTypeNameToODataTypeID = {
|
|
73
73
|
'Edm.Time': 0,
|
|
74
74
|
'Edm.DateTime': 1,
|
|
75
75
|
'Edm.Byte': 2,
|
|
@@ -85,7 +85,7 @@ var conversionODataTypeNameToODataTypeID = {
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
const dbTypeNameToODataTypeName = {
|
|
89
89
|
'DATE': 'Edm.DateTime',
|
|
90
90
|
'DAYDATE': 'Edm.DateTime',
|
|
91
91
|
'TIME': 'Edm.Time',
|
|
@@ -119,16 +119,16 @@ exports.dbTypeNameToODataTypeName = dbTypeNameToODataTypeName;
|
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
function oDataTypeNameToODataTypeID(oDataTypeName) {
|
|
122
|
-
|
|
122
|
+
const tmp = conversionODataTypeNameToODataTypeID[oDataTypeName];
|
|
123
123
|
if (tmp !== undefined) {
|
|
124
124
|
return tmp;
|
|
125
125
|
}
|
|
126
|
-
throw new
|
|
126
|
+
throw new XsODataTypeError('invalid ODataType name: ' + oDataTypeName);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
const _to_ID = oDataTypeNameToODataTypeID;
|
|
131
|
+
const conversionDbTypeNameToODataTypeID = {
|
|
132
132
|
'DATE': _to_ID('Edm.DateTime'),
|
|
133
133
|
'DAYDATE': _to_ID('Edm.DateTime'), // new
|
|
134
134
|
'TIME': _to_ID('Edm.Time'),
|
|
@@ -160,12 +160,12 @@ var conversionDbTypeNameToODataTypeID = {
|
|
|
160
160
|
|
|
161
161
|
function dbTypeNameToODataTypeID(dbTypeName) { //TYPE_ID seem is not unique
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
const tmp = conversionDbTypeNameToODataTypeID[dbTypeName];
|
|
164
164
|
|
|
165
165
|
if (tmp !== undefined) {
|
|
166
166
|
return tmp;
|
|
167
167
|
}
|
|
168
|
-
throw new
|
|
168
|
+
throw new XsODataTypeError('invalid dbTypeName name: ' + dbTypeName);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
exports.dbTypeNameToODataTypeID = dbTypeNameToODataTypeID;
|