@abaplint/core 2.115.26 → 2.115.28
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/build/src/abap/5_syntax/expressions/select.js +30 -2
- package/build/src/cds/expressions/cds_condition.js +7 -4
- package/build/src/cds/expressions/cds_prefixed_name.js +1 -1
- package/build/src/cds/expressions/cds_select.js +1 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/modify_only_own_db_tables.js +2 -0
- package/package.json +4 -4
|
@@ -245,7 +245,7 @@ class Select {
|
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
static buildStructureType(fields, dbSources, scope) {
|
|
248
|
-
var _a, _b, _c;
|
|
248
|
+
var _a, _b, _c, _d, _e, _f;
|
|
249
249
|
if (fields.length === 1 && dbSources.length === 1) {
|
|
250
250
|
const dbType = (_a = dbSources[0]) === null || _a === void 0 ? void 0 : _a.parseType(scope.getRegistry());
|
|
251
251
|
if (dbType === undefined) {
|
|
@@ -286,8 +286,36 @@ class Select {
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
+
else if (dbSources.length === 1) {
|
|
290
|
+
const dbType = (_d = dbSources[0]) === null || _d === void 0 ? void 0 : _d.parseType(scope.getRegistry());
|
|
291
|
+
if (dbType === undefined) {
|
|
292
|
+
const name = ((_e = dbSources[0]) === null || _e === void 0 ? void 0 : _e.getName()) || "buildStructureTypeError";
|
|
293
|
+
if (scope.getRegistry().inErrorNamespace(name) === true) {
|
|
294
|
+
return new basic_1.UnknownType("Select, " + name + " not found");
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
return basic_1.VoidType.get((_f = dbSources[0]) === null || _f === void 0 ? void 0 : _f.getName());
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (!(dbType instanceof basic_1.StructureType)) {
|
|
301
|
+
return basic_1.VoidType.get("SELECT_todo14");
|
|
302
|
+
}
|
|
303
|
+
const allFieldsSimple = fields.every(f => isSimple.test(f.code));
|
|
304
|
+
if (allFieldsSimple === true) {
|
|
305
|
+
const components = [];
|
|
306
|
+
for (const field of fields) {
|
|
307
|
+
const type = dbType.getComponentByName(field.code);
|
|
308
|
+
if (type === undefined) {
|
|
309
|
+
return basic_1.VoidType.get("SELECT_todo9");
|
|
310
|
+
}
|
|
311
|
+
components.push({ name: field.as || field.code, type });
|
|
312
|
+
}
|
|
313
|
+
return new basic_1.StructureType(components);
|
|
314
|
+
}
|
|
315
|
+
return basic_1.VoidType.get("SELECT_todo12");
|
|
316
|
+
}
|
|
289
317
|
else {
|
|
290
|
-
return basic_1.VoidType.get("
|
|
318
|
+
return basic_1.VoidType.get("SELECT_todo13");
|
|
291
319
|
}
|
|
292
320
|
}
|
|
293
321
|
static buildTableType(fields, dbSources, scope) {
|
|
@@ -7,10 +7,13 @@ const cds_integer_1 = require("./cds_integer");
|
|
|
7
7
|
class CDSCondition extends combi_1.Expression {
|
|
8
8
|
getRunnable() {
|
|
9
9
|
const left = (0, combi_1.altPrio)(_1.CDSString, _1.CDSFunction, _1.CDSAggregate, _1.CDSPrefixedName);
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const nonLikeOperators = (0, combi_1.altPrio)("=", (0, combi_1.seq)("!", "="), (0, combi_1.seq)("<", ">"), (0, combi_1.seq)(">", "="), (0, combi_1.seq)("<", "="), "<", ">");
|
|
11
|
+
const likeOperators = (0, combi_1.altPrio)("LIKE", "NOT LIKE");
|
|
12
|
+
// Right side of comparison: simple values first, then parenthesized, then full arithmetic last.
|
|
13
|
+
// CDSArithmetics is last to avoid triggering CDSPrefixedName→CDSCondition→CDSArithmetics cycle.
|
|
14
|
+
const right = (0, combi_1.altPrio)(_1.CDSArithParen, left, cds_integer_1.CDSInteger, _1.CDSArithmetics);
|
|
15
|
+
// ESCAPE is only valid with LIKE/NOT LIKE, not with other comparison operators.
|
|
16
|
+
const compare = (0, combi_1.altPrio)((0, combi_1.seq)(likeOperators, right, (0, combi_1.opt)((0, combi_1.seq)("ESCAPE", _1.CDSString))), (0, combi_1.seq)(nonLikeOperators, right));
|
|
14
17
|
const is = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("INITIAL", "NULL"));
|
|
15
18
|
const between = (0, combi_1.seq)("BETWEEN", left, "AND", left);
|
|
16
19
|
const condition = (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), left, (0, combi_1.altPrio)(compare, is, between));
|
|
@@ -25,7 +25,7 @@ class CDSPrefixedName extends combi_1.Expression {
|
|
|
25
25
|
// The final segment may also be a string literal: #enum.'value'
|
|
26
26
|
// A segment may have a parameterized call: _Assoc( P_Key : value ) or _Assoc[filter]
|
|
27
27
|
const segment = (0, combi_1.seq)(".", (0, combi_1.altPrio)(cds_string_1.CDSString, cds_name_1.CDSName), (0, combi_1.opt)((0, combi_1.altPrio)(cds_parameters_select_1.CDSParametersSelect, cds_parameters_1.CDSParameters)), (0, combi_1.opt)(pathFilter));
|
|
28
|
-
return (0, combi_1.seq)(cds_name_1.CDSName, (0, combi_1.opt)((0, combi_1.altPrio)(cds_parameters_1.CDSParameters, cds_parameters_select_1.CDSParametersSelect)), (0, combi_1.opt)(pathFilter), (0, combi_1.
|
|
28
|
+
return (0, combi_1.seq)(cds_name_1.CDSName, (0, combi_1.opt)((0, combi_1.altPrio)(cds_parameters_1.CDSParameters, cds_parameters_select_1.CDSParametersSelect)), (0, combi_1.opt)(pathFilter), (0, combi_1.starPrio)(segment));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
exports.CDSPrefixedName = CDSPrefixedName;
|
|
@@ -11,7 +11,7 @@ class CDSSelect extends combi_1.Expression {
|
|
|
11
11
|
const distinct = (0, combi_1.str)("DISTINCT");
|
|
12
12
|
const elementList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.CDSElement)));
|
|
13
13
|
const elements = (0, combi_1.seq)((0, combi_1.str)("{"), (0, combi_1.altPrio)("*", elementList), (0, combi_1.str)("}"));
|
|
14
|
-
return (0, combi_1.seq)("SELECT", (0, combi_1.optPrio)(distinct), (0, combi_1.opt)((0, combi_1.
|
|
14
|
+
return (0, combi_1.seq)("SELECT", (0, combi_1.optPrio)(distinct), (0, combi_1.opt)((0, combi_1.altPrio)("*", fields)), "FROM", _1.CDSSource, (0, combi_1.star)(cds_join_1.CDSJoin), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSComposition, cds_association_1.CDSAssociation)), (0, combi_1.opt)(elements), (0, combi_1.optPrio)(_1.CDSWhere), (0, combi_1.optPrio)(_1.CDSGroupBy), (0, combi_1.optPrio)(_1.CDSHaving), (0, combi_1.optPrio)((0, combi_1.seq)("UNION", (0, combi_1.optPrio)("ALL"), CDSSelect)));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.CDSSelect = CDSSelect;
|
package/build/src/registry.js
CHANGED
|
@@ -26,6 +26,8 @@ class ModifyOnlyOwnDBTables {
|
|
|
26
26
|
key: "modify_only_own_db_tables",
|
|
27
27
|
title: "Modify only own DB tables",
|
|
28
28
|
shortDescription: `Modify only own DB tables`,
|
|
29
|
+
badExample: `DELETE FROM mara WHERE matnr = '123456'.`,
|
|
30
|
+
goodExample: `DELETE FROM yflight WHERE carrid = 'LH'.`,
|
|
29
31
|
extendedInformation: `https://docs.abapopenchecks.org/checks/26/`,
|
|
30
32
|
tags: [_irule_1.RuleTag.Security],
|
|
31
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.115.
|
|
3
|
+
"version": "2.115.28",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://abaplint.org",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.57.
|
|
53
|
+
"@microsoft/api-extractor": "^7.57.6",
|
|
54
54
|
"@types/chai": "^4.3.20",
|
|
55
55
|
"@types/mocha": "^10.0.10",
|
|
56
|
-
"@types/node": "^24.
|
|
56
|
+
"@types/node": "^24.11.0",
|
|
57
57
|
"chai": "^4.5.0",
|
|
58
58
|
"eslint": "^9.39.2",
|
|
59
59
|
"mocha": "^11.7.5",
|
|
60
|
-
"c8": "^
|
|
60
|
+
"c8": "^11.0.0",
|
|
61
61
|
"source-map-support": "^0.5.21",
|
|
62
62
|
"ts-json-schema-generator": "=2.4.0",
|
|
63
63
|
"typescript": "^5.9.3"
|