@sap/cds 5.7.5 → 5.8.2
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 +97 -0
- package/app/fiori/routes.js +1 -1
- package/bin/deploy/to-hana/cfUtil.js +251 -138
- package/bin/deploy/to-hana/gitUtil.js +55 -0
- package/bin/deploy/to-hana/hana.js +92 -93
- package/bin/deploy/to-hana/hdiDeployUtil.js +42 -27
- package/bin/deploy/to-hana/index.js +14 -13
- package/bin/mtx/in-cds.js +1 -0
- package/bin/serve.js +1 -1
- package/bin/version.js +1 -0
- package/lib/compile/cdsc.js +0 -6
- package/lib/compile/resolve.js +1 -1
- package/lib/compile/to/srvinfo.js +1 -1
- package/lib/core/classes.js +21 -1
- package/lib/env/index.js +3 -2
- package/lib/env/requires.js +4 -0
- package/lib/i18n/localize.js +5 -8
- package/lib/index.js +1 -0
- package/lib/log/errors.js +1 -1
- package/lib/log/format/kibana.js +3 -3
- package/lib/ql/SELECT.js +2 -2
- package/lib/req/cds-context.js +1 -1
- package/lib/req/context.js +1 -1
- package/lib/serve/Transaction.js +9 -5
- package/lib/serve/index.js +13 -21
- package/lib/utils/tests.js +90 -66
- package/libx/_runtime/audit/generic/personal/modification.js +0 -8
- package/libx/_runtime/auth/index.js +7 -6
- package/libx/_runtime/auth/strategies/dwc.js +43 -0
- package/libx/_runtime/auth/utils.js +24 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +1 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js +11 -32
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/create.js +12 -5
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/delete.js +7 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/error.js +24 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/read.js +43 -38
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/request.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/update.js +11 -5
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/boundToCQN.js +1 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/deleteToCQN.js +0 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/expandToCQN.js +1 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/orderByToCQN.js +9 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/readToCQN.js +17 -30
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/utils.js +12 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/AbstractEdmStructuredType.js +2 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ResourcePathParser.js +23 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriHelper.js +7 -6
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriTokenizer.js +2 -5
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/PrimitiveValueDecoder.js +19 -47
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/ValueConverter.js +4 -11
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/ResourceJsonDeserializer.js +7 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/CommandExecutor.js +0 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ConditionalRequestControlCommand.js +0 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ContextURLFactory.js +2 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ErrorJsonSerializer.js +2 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/TrustedResourceJsonSerializer.js +2 -5
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/validator/ConditionalRequestValidator.js +6 -6
- package/libx/_runtime/cds-services/adapter/odata-v4/to.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/data.js +1 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/handlerUtils.js +41 -17
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/request.js +1 -17
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/result.js +60 -18
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/stream.js +47 -10
- package/libx/_runtime/cds-services/adapter/rest/Rest.js +22 -1
- package/libx/_runtime/cds-services/adapter/rest/handlers/read.js +8 -3
- package/libx/_runtime/cds-services/adapter/rest/utils/parse-url.js +3 -0
- package/libx/_runtime/cds-services/services/utils/columns.js +5 -1
- package/libx/_runtime/cds-services/services/utils/compareJson.js +15 -16
- package/libx/_runtime/cds-services/services/utils/differ.js +2 -8
- package/libx/_runtime/common/aspects/Association.js +16 -0
- package/libx/_runtime/common/composition/data.js +28 -37
- package/libx/_runtime/common/composition/delete.js +107 -58
- package/libx/_runtime/common/composition/index.js +3 -3
- package/libx/_runtime/common/composition/insert.js +14 -27
- package/libx/_runtime/common/composition/tree.js +1 -1
- package/libx/_runtime/common/composition/update.js +39 -34
- package/libx/_runtime/common/error/frontend.js +19 -5
- package/libx/_runtime/common/generic/auth.js +20 -85
- package/libx/_runtime/common/generic/crud.js +22 -1
- package/libx/_runtime/common/i18n/messages.properties +2 -1
- package/libx/_runtime/common/utils/cqn.js +2 -6
- package/libx/_runtime/common/utils/cqn2cqn4sql.js +95 -122
- package/libx/_runtime/common/utils/csn.js +29 -6
- package/libx/_runtime/common/utils/foreignKeyPropagations.js +21 -1
- package/libx/_runtime/common/utils/keys.js +2 -1
- package/libx/_runtime/common/utils/path.js +1 -1
- package/libx/_runtime/common/utils/resolveView.js +12 -4
- package/libx/_runtime/common/utils/rewriteAsterisks.js +27 -13
- package/libx/_runtime/common/utils/search2cqn4sql.js +11 -6
- package/libx/_runtime/common/utils/structured.js +10 -4
- package/libx/_runtime/common/utils/vcap.js +27 -10
- package/libx/_runtime/db/data-conversion/post-processing.js +20 -13
- package/libx/_runtime/db/expand/expand-v2.js +21 -12
- package/libx/_runtime/db/expand/expandCQNToJoin.js +67 -26
- package/libx/_runtime/db/expand/index.js +3 -0
- package/libx/_runtime/db/generic/create.js +0 -10
- package/libx/_runtime/db/generic/index.js +3 -0
- package/libx/_runtime/db/generic/read.js +2 -24
- package/libx/_runtime/db/generic/rewrite.js +1 -3
- package/libx/_runtime/db/generic/update.js +1 -1
- package/libx/_runtime/db/query/delete.js +10 -4
- package/libx/_runtime/db/query/insert.js +3 -4
- package/libx/_runtime/db/query/read.js +4 -1
- package/libx/_runtime/db/query/update.js +5 -5
- package/libx/_runtime/db/sql-builder/ExpressionBuilder.js +9 -2
- package/libx/_runtime/db/sql-builder/FunctionBuilder.js +3 -0
- package/libx/_runtime/db/sql-builder/SelectBuilder.js +7 -3
- package/libx/_runtime/db/sql-builder/index.js +3 -0
- package/libx/_runtime/db/utils/columns.js +5 -2
- package/libx/_runtime/db/utils/deep.js +16 -14
- package/libx/_runtime/db/utils/generateAliases.js +56 -6
- package/libx/_runtime/fiori/generic/before.js +73 -49
- package/libx/_runtime/fiori/generic/edit.js +14 -18
- package/libx/_runtime/fiori/generic/patch.js +8 -11
- package/libx/_runtime/fiori/generic/read.js +20 -19
- package/libx/_runtime/fiori/generic/readOverDraft.js +1 -4
- package/libx/_runtime/fiori/utils/handler.js +1 -11
- package/libx/_runtime/hana/Service.js +1 -1
- package/libx/_runtime/hana/conversion.js +12 -1
- package/libx/_runtime/hana/dynatrace.js +11 -5
- package/libx/_runtime/hana/execute.js +132 -19
- package/libx/_runtime/hana/search.js +3 -3
- package/libx/_runtime/hana/search2cqn4sql.js +23 -25
- package/libx/_runtime/hana/searchToContains.js +1 -1
- package/libx/_runtime/messaging/AMQPWebhookMessaging.js +1 -1
- package/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +0 -1
- package/libx/_runtime/messaging/enterprise-messaging.js +1 -0
- package/libx/_runtime/messaging/file-based.js +3 -1
- package/libx/_runtime/messaging/service.js +4 -1
- package/libx/_runtime/remote/utils/client.js +41 -24
- package/libx/_runtime/remote/utils/data.js +54 -12
- package/libx/_runtime/sqlite/Service.js +1 -1
- package/libx/_runtime/sqlite/conversion.js +10 -0
- package/libx/_runtime/types/api.js +2 -2
- package/libx/gql/resolvers/crud/update.js +8 -5
- package/libx/gql/resolvers/parse/ast/enrich.js +1 -0
- package/libx/odata/afterburner.js +29 -6
- package/libx/odata/cqn2odata.js +9 -0
- package/libx/odata/grammar.pegjs +49 -21
- package/libx/odata/index.js +2 -2
- package/libx/odata/parser.js +1 -1
- package/libx/odata/utils.js +2 -2
- package/libx/rest/RestAdapter.js +29 -1
- package/libx/rest/middleware/auth.js +1 -3
- package/libx/rest/middleware/parse.js +1 -0
- package/package.json +1 -1
- package/server.js +1 -1
- package/bin/deploy/to-hana/logger.js +0 -27
- package/bin/deploy/to-hana/runCommand.js +0 -113
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/selectHelper.js +0 -37
- package/libx/_runtime/common/utils/auth.js +0 -16
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
module.exports = runCommand;
|
|
2
|
-
|
|
3
|
-
const cp = require('child_process');
|
|
4
|
-
const { nullLogger } = require('./logger');
|
|
5
|
-
const term = require('../../utils/term');
|
|
6
|
-
|
|
7
|
-
const IS_DEBUG = process.env.DEBUG;
|
|
8
|
-
const TIMEOUT = 2 * 60 * 1000; // 2min
|
|
9
|
-
|
|
10
|
-
function _removeColorCodes(chunk) {
|
|
11
|
-
// eslint-disable-next-line no-control-regex
|
|
12
|
-
return chunk.replace(/\x1b\[[;\d]*m/g, '');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// start kill timer, reset everytime a chunk arrives
|
|
16
|
-
function _startTimer(oldTimer, spawnedProcess, timeOut) {
|
|
17
|
-
clearTimeout(oldTimer);
|
|
18
|
-
|
|
19
|
-
return setTimeout(() => {
|
|
20
|
-
spawnedProcess.kill();
|
|
21
|
-
}, timeOut);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function _getTimeKey(cmd, args = []) {
|
|
25
|
-
return `[cds.deploy] - ${cmd} ${args.join(' ')}`;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _validate(cmd, cmdArgs = []) {
|
|
29
|
-
// validate input
|
|
30
|
-
if (/[|&;]+/g.exec(cmd)) {
|
|
31
|
-
throw new Error(`[cds.deploy] - Command ${cmd} contains at least one bad character (|, &, or ;) which might be used to concatenate commands.`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
cmdArgs.forEach((arg) => {
|
|
35
|
-
if (/[|&;]+/g.exec(arg)) {
|
|
36
|
-
throw new Error(`[cds.deploy] - Argument ${arg} contains at least one bad character (|, &, or ;) which might be used to concatenate commands.`);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function runCommand(cmd, cmdArgs = [], logger = nullLogger, options = {}, timeOut = TIMEOUT) {
|
|
42
|
-
|
|
43
|
-
_validate(cmd, cmdArgs);
|
|
44
|
-
|
|
45
|
-
return new Promise((resolve, reject) => {
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
|
|
49
|
-
if (IS_DEBUG) {
|
|
50
|
-
logger.time(_getTimeKey(cmd, cmdArgs));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
logger.log();
|
|
54
|
-
logger.log(`[cds.deploy] - Running '${term.as(term.codes.bold, cmd + ' ' + cmdArgs.join(' '))}' with options ${JSON.stringify(options)}`);
|
|
55
|
-
|
|
56
|
-
const spawnOptions = { ...options, cwd: process.env._TEST_CWD || process.cwd() };
|
|
57
|
-
spawnOptions.env = Object.assign (process.env, {CF_COLOR:logger.isTTY()}, options.env)
|
|
58
|
-
|
|
59
|
-
const spawnedProcess = cp.spawn(cmd, cmdArgs, spawnOptions);
|
|
60
|
-
let spawnTimer = _startTimer(null, spawnedProcess, timeOut);
|
|
61
|
-
|
|
62
|
-
let stdout = '';
|
|
63
|
-
let stderr = '';
|
|
64
|
-
|
|
65
|
-
if (!options.stdio) {
|
|
66
|
-
spawnedProcess.stdout.on('data', (data) => {
|
|
67
|
-
spawnTimer = _startTimer(spawnTimer, spawnedProcess, timeOut);
|
|
68
|
-
const chunk = data.toString();
|
|
69
|
-
stdout = stdout + chunk;
|
|
70
|
-
logger.write(chunk);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
spawnedProcess.stderr.on('data', (data) => {
|
|
74
|
-
spawnTimer = _startTimer(spawnTimer, spawnedProcess, timeOut);
|
|
75
|
-
const chunk = data.toString();
|
|
76
|
-
stderr = stderr + chunk;
|
|
77
|
-
logger.write(chunk);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
spawnedProcess.on('error', (err) => {
|
|
82
|
-
reject(err);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
spawnedProcess.on('close', (code, signal) => {
|
|
86
|
-
clearTimeout(spawnTimer);
|
|
87
|
-
|
|
88
|
-
if (IS_DEBUG) {
|
|
89
|
-
logger.timeEnd(_getTimeKey(cmd, cmdArgs));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (!signal) {
|
|
93
|
-
// exited normally
|
|
94
|
-
stdout = _removeColorCodes(stdout);
|
|
95
|
-
stderr = _removeColorCodes(stderr);
|
|
96
|
-
resolve({ code, stdout, stderr });
|
|
97
|
-
} else {
|
|
98
|
-
// sigterm if timer kills spawned process
|
|
99
|
-
const spawnError = new Error(`[cds.deploy] - Failed with signal '${signal}' and code ${code}`);
|
|
100
|
-
spawnError.args = cmdArgs;
|
|
101
|
-
spawnError.options = options;
|
|
102
|
-
spawnError.stdout = stdout;
|
|
103
|
-
spawnError.stderr = stderr;
|
|
104
|
-
spawnError.signal = signal;
|
|
105
|
-
reject(spawnError);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
} catch (err) {
|
|
109
|
-
reject(err);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const { getFeatureNotSupportedError } = require('../../../util/errors')
|
|
2
|
-
const { deepCopyArray } = require('../../../../common/utils/copy')
|
|
3
|
-
const cds = require('../../../../cds')
|
|
4
|
-
const { cqn2cqn4sql } = require('../../../../common/utils/cqn2cqn4sql')
|
|
5
|
-
|
|
6
|
-
const isNavigation = pathSegments => {
|
|
7
|
-
return pathSegments.length > 1 && pathSegments[1].getKind().startsWith('NAVIGATION')
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const isViewWithParams = target => {
|
|
11
|
-
return target.params && Object.keys(target.params).length > 0
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const getValidationQuery = (ref, model) => {
|
|
15
|
-
const refQuery = deepCopyArray(ref.slice(0, ref.length - 1))
|
|
16
|
-
const cqn = cds.ql.SELECT.from({ ref: refQuery }).columns({
|
|
17
|
-
val: 1,
|
|
18
|
-
as: 'validationQuery'
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
return cqn2cqn4sql(cqn, model)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const isPathSupported = (supported, pathSegments) => {
|
|
25
|
-
for (const segment of pathSegments) {
|
|
26
|
-
if (!supported[segment.getKind()]) {
|
|
27
|
-
throw getFeatureNotSupportedError(`Request parameter "${segment.getKind()}"`)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
module.exports = {
|
|
33
|
-
isNavigation,
|
|
34
|
-
isViewWithParams,
|
|
35
|
-
isPathSupported,
|
|
36
|
-
getValidationQuery
|
|
37
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const UNAUTHORIZED = { statusCode: 401, code: '401', message: 'Unauthorized' }
|
|
2
|
-
const FORBIDDEN = { statusCode: 403, code: '403', message: 'Forbidden' }
|
|
3
|
-
|
|
4
|
-
const getRequiresAsArray = definition => {
|
|
5
|
-
if (!definition['@requires']) {
|
|
6
|
-
return []
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
return Array.isArray(definition['@requires']) ? definition['@requires'] : [definition['@requires']]
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
module.exports = {
|
|
13
|
-
UNAUTHORIZED,
|
|
14
|
-
FORBIDDEN,
|
|
15
|
-
getRequiresAsArray
|
|
16
|
-
}
|