@abaplint/runtime 2.10.59 → 2.10.61
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/statements/create_data.js +9 -10
- package/build/src/statements/delete_internal.js +3 -0
- package/build/src/statements/insert_internal.js +1 -2
- package/build/src/statements/select.js +2 -3
- package/build/src/types/character.js +5 -1
- package/build/src/types/integer.js +5 -5
- package/build/src/types/numc.js +12 -3
- package/build/src/types/structure.js +1 -5
- package/build/src/types/table.js +12 -13
- package/package.json +2 -2
- package/build/src/clone.d.ts +0 -1
- package/build/src/clone.js +0 -28
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createData = createData;
|
|
4
|
-
const clone_1 = require("../clone");
|
|
5
4
|
const throw_error_1 = require("../throw_error");
|
|
6
5
|
const types_1 = require("../types");
|
|
7
6
|
function createData(target, options) {
|
|
@@ -24,7 +23,7 @@ function createData(target, options) {
|
|
|
24
23
|
// @ts-ignore
|
|
25
24
|
if (abap.DDIC[options.name.trimEnd()]) {
|
|
26
25
|
// @ts-ignore
|
|
27
|
-
target.assign(
|
|
26
|
+
target.assign(abap.DDIC[options.name.trimEnd()].type.clone());
|
|
28
27
|
}
|
|
29
28
|
else if (options.name.includes("=>")) {
|
|
30
29
|
const [className, typeName] = options.name.trimEnd().toUpperCase().split("=>");
|
|
@@ -37,7 +36,7 @@ function createData(target, options) {
|
|
|
37
36
|
(0, throw_error_1.throwError)("CX_SY_CREATE_DATA_ERROR");
|
|
38
37
|
}
|
|
39
38
|
// @ts-ignore
|
|
40
|
-
target.assign(
|
|
39
|
+
target.assign(abap.Classes[className][typeName.toLowerCase()].clone());
|
|
41
40
|
}
|
|
42
41
|
else if (options.name.startsWith("\\TYPE=%")) {
|
|
43
42
|
// currently, only the runtime knows the references to the anonymous types
|
|
@@ -89,7 +88,7 @@ function createData(target, options) {
|
|
|
89
88
|
}
|
|
90
89
|
if (options.typeLineOf === true) {
|
|
91
90
|
// @ts-ignore
|
|
92
|
-
target.assign(
|
|
91
|
+
target.assign(target.getPointer().getRowType().clone());
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
else if (options?.typeName) {
|
|
@@ -162,7 +161,7 @@ function createData(target, options) {
|
|
|
162
161
|
// @ts-ignore
|
|
163
162
|
if (abap.DDIC[options.typeName.trimEnd()]) {
|
|
164
163
|
// @ts-ignore
|
|
165
|
-
target.assign(
|
|
164
|
+
target.assign(abap.DDIC[options.typeName.trimEnd()].type.clone());
|
|
166
165
|
}
|
|
167
166
|
else if (options.typeName.includes("=>")) {
|
|
168
167
|
const [className, typeName] = options.typeName.toUpperCase().split("=>");
|
|
@@ -175,7 +174,7 @@ function createData(target, options) {
|
|
|
175
174
|
(0, throw_error_1.throwError)("CX_SY_CREATE_DATA_ERROR");
|
|
176
175
|
}
|
|
177
176
|
// @ts-ignore
|
|
178
|
-
target.assign(
|
|
177
|
+
target.assign(abap.Classes[className][typeName.toLowerCase().trimEnd()].clone());
|
|
179
178
|
}
|
|
180
179
|
else {
|
|
181
180
|
throw "CREATE DATA, unknown type " + options.typeName;
|
|
@@ -183,22 +182,22 @@ function createData(target, options) {
|
|
|
183
182
|
}
|
|
184
183
|
}
|
|
185
184
|
else if (options?.type) {
|
|
186
|
-
target.assign(
|
|
185
|
+
target.assign(options.type.clone());
|
|
187
186
|
}
|
|
188
187
|
else if (options?.likeLineOf) {
|
|
189
188
|
if (options.likeLineOf instanceof types_1.FieldSymbol) {
|
|
190
189
|
options.likeLineOf = options.likeLineOf.getPointer();
|
|
191
190
|
}
|
|
192
|
-
target.assign(
|
|
191
|
+
target.assign(options.likeLineOf.getRowType().clone());
|
|
193
192
|
}
|
|
194
193
|
else if (options?.like) {
|
|
195
194
|
if (options.like instanceof types_1.FieldSymbol) {
|
|
196
195
|
options.like = options.like.getPointer();
|
|
197
196
|
}
|
|
198
|
-
target.assign(
|
|
197
|
+
target.assign(options.like.clone());
|
|
199
198
|
}
|
|
200
199
|
else {
|
|
201
|
-
target.assign(
|
|
200
|
+
target.assign(target.getType()?.clone());
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
203
|
//# sourceMappingURL=create_data.js.map
|
|
@@ -18,6 +18,9 @@ async function deleteInternal(target, options) {
|
|
|
18
18
|
&& options?.fromValue === undefined
|
|
19
19
|
&& options?.from === undefined
|
|
20
20
|
&& options?.to === undefined) {
|
|
21
|
+
if (options.index.get() === 0) {
|
|
22
|
+
throw new Error("TABLE_INVALID_INDEX");
|
|
23
|
+
}
|
|
21
24
|
if (target.array()[options.index.get() - 1] === undefined) {
|
|
22
25
|
// @ts-ignore
|
|
23
26
|
abap.builtin.sy.get().subrc.set(4);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.insertInternal = insertInternal;
|
|
4
|
-
const clone_1 = require("../clone");
|
|
5
4
|
const compare_1 = require("../compare");
|
|
6
5
|
const types_1 = require("../types");
|
|
7
6
|
const read_table_1 = require("./read_table");
|
|
@@ -71,7 +70,7 @@ function insertInternal(options) {
|
|
|
71
70
|
}
|
|
72
71
|
let data = options.data;
|
|
73
72
|
if (typeof data === "string") {
|
|
74
|
-
const tmp =
|
|
73
|
+
const tmp = options.table.getRowType().clone();
|
|
75
74
|
tmp.set(data);
|
|
76
75
|
data = tmp;
|
|
77
76
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.select = select;
|
|
4
4
|
exports.rowsToTarget = rowsToTarget;
|
|
5
|
-
const clone_1 = require("../clone");
|
|
6
5
|
const types_1 = require("../types");
|
|
7
6
|
async function select(target, input, runtimeOptions, context) {
|
|
8
7
|
const { rows: rows } = await context.defaultDB().select(input);
|
|
@@ -47,14 +46,14 @@ function rowsToTarget(target, rows) {
|
|
|
47
46
|
if (rows[0][column] === null || target.get()[column] === undefined) {
|
|
48
47
|
continue;
|
|
49
48
|
}
|
|
50
|
-
result[column] =
|
|
49
|
+
result[column] = target.get()[column].clone().set(rows[0][column]);
|
|
51
50
|
}
|
|
52
51
|
// @ts-ignore
|
|
53
52
|
abap.statements.moveCorresponding(new types_1.Structure(result), target);
|
|
54
53
|
}
|
|
55
54
|
else if (target instanceof types_1.Table || target instanceof types_1.HashedTable) {
|
|
56
55
|
for (const row of rows) {
|
|
57
|
-
const targetRow =
|
|
56
|
+
const targetRow = target.getRowType().clone();
|
|
58
57
|
if (targetRow instanceof types_1.Structure) {
|
|
59
58
|
for (let columnName in row) {
|
|
60
59
|
columnName = columnName.toLowerCase();
|
|
@@ -7,6 +7,7 @@ const field_symbol_1 = require("./field_symbol");
|
|
|
7
7
|
const structure_1 = require("./structure");
|
|
8
8
|
const integer_1 = require("./integer");
|
|
9
9
|
const TRIMREGEX = / *$/;
|
|
10
|
+
const initialValues = {};
|
|
10
11
|
class Character {
|
|
11
12
|
constructor(length, extra) {
|
|
12
13
|
this.constant = false;
|
|
@@ -79,7 +80,10 @@ class Character {
|
|
|
79
80
|
return this.length;
|
|
80
81
|
}
|
|
81
82
|
clear() {
|
|
82
|
-
|
|
83
|
+
if (initialValues[this.length] === undefined) {
|
|
84
|
+
initialValues[this.length] = " ".repeat(this.length);
|
|
85
|
+
}
|
|
86
|
+
this.value = initialValues[this.length];
|
|
83
87
|
}
|
|
84
88
|
get() {
|
|
85
89
|
return this.value;
|
|
@@ -17,11 +17,11 @@ function toInteger(value, exception = true) {
|
|
|
17
17
|
if (value.endsWith("-")) {
|
|
18
18
|
value = "-" + value.substring(0, value.length - 1);
|
|
19
19
|
}
|
|
20
|
-
if (
|
|
21
|
-
value
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (exception === true) {
|
|
20
|
+
if (exports.DIGITS.test(value) === false) {
|
|
21
|
+
if (value.trim().length === 0) {
|
|
22
|
+
value = "0";
|
|
23
|
+
}
|
|
24
|
+
else if (exception === true) {
|
|
25
25
|
(0, throw_error_1.throwError)("CX_SY_CONVERSION_NO_NUMBER");
|
|
26
26
|
}
|
|
27
27
|
else {
|
package/build/src/types/numc.js
CHANGED
|
@@ -4,6 +4,8 @@ exports.Numc = void 0;
|
|
|
4
4
|
const _parse_1 = require("../operators/_parse");
|
|
5
5
|
const throw_error_1 = require("../throw_error");
|
|
6
6
|
const float_1 = require("./float");
|
|
7
|
+
const initialValues = {};
|
|
8
|
+
const regexCharacters = /[a-zA-Z]/g;
|
|
7
9
|
class Numc {
|
|
8
10
|
constructor(input) {
|
|
9
11
|
this.length = input?.length ? input?.length : 1;
|
|
@@ -20,11 +22,15 @@ class Numc {
|
|
|
20
22
|
return this.qualifiedName;
|
|
21
23
|
}
|
|
22
24
|
set(value, raw = false) {
|
|
23
|
-
if (
|
|
25
|
+
if (value instanceof Numc && value.getLength() === this.length) {
|
|
26
|
+
this.value = value.get();
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
else if (typeof value === "number") {
|
|
24
30
|
this.value = Math.trunc(value) + "";
|
|
25
31
|
}
|
|
26
32
|
else if (typeof value === "string") {
|
|
27
|
-
value = value.trim().replace(
|
|
33
|
+
value = value.trim().replace(regexCharacters, "");
|
|
28
34
|
if (value === "") {
|
|
29
35
|
this.clear();
|
|
30
36
|
}
|
|
@@ -54,7 +60,10 @@ class Numc {
|
|
|
54
60
|
return this.length;
|
|
55
61
|
}
|
|
56
62
|
clear() {
|
|
57
|
-
|
|
63
|
+
if (initialValues[this.length] === undefined) {
|
|
64
|
+
initialValues[this.length] = "0".repeat(this.length);
|
|
65
|
+
}
|
|
66
|
+
this.value = initialValues[this.length];
|
|
58
67
|
}
|
|
59
68
|
get() {
|
|
60
69
|
return this.value;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Structure = void 0;
|
|
4
|
-
const clone_1 = require("../clone");
|
|
5
4
|
const field_symbol_1 = require("./field_symbol");
|
|
6
5
|
const table_1 = require("./table");
|
|
7
6
|
const _parse_1 = require("../operators/_parse");
|
|
@@ -18,9 +17,6 @@ class Structure {
|
|
|
18
17
|
clone() {
|
|
19
18
|
const newValues = {};
|
|
20
19
|
for (const key in this.value) {
|
|
21
|
-
if (this.value[key] === undefined) {
|
|
22
|
-
throw new Error("Structure, clone: value is undefined, field " + key);
|
|
23
|
-
}
|
|
24
20
|
newValues[key] = this.value[key].clone();
|
|
25
21
|
}
|
|
26
22
|
const n = new Structure(newValues, this.qualifiedName, this.ddicName, this.suffix, this.asInclude);
|
|
@@ -61,7 +57,7 @@ class Structure {
|
|
|
61
57
|
for (let i = 0; i < keys1.length; i++) {
|
|
62
58
|
const key1 = keys1[i];
|
|
63
59
|
const key2 = keys2[i];
|
|
64
|
-
this.value[key2].set(
|
|
60
|
+
this.value[key2].set(obj[key1].clone());
|
|
65
61
|
}
|
|
66
62
|
}
|
|
67
63
|
else {
|
package/build/src/types/table.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.Table = exports.HashedTable = exports.TableFactory = exports.LoopControl
|
|
|
4
4
|
const integer_1 = require("./integer");
|
|
5
5
|
const abap_object_1 = require("./abap_object");
|
|
6
6
|
const string_1 = require("./string");
|
|
7
|
-
const clone_1 = require("../clone");
|
|
8
7
|
const structure_1 = require("./structure");
|
|
9
8
|
const field_symbol_1 = require("./field_symbol");
|
|
10
9
|
const data_reference_1 = require("./data_reference");
|
|
@@ -73,7 +72,7 @@ class HashedTable {
|
|
|
73
72
|
this.options = options;
|
|
74
73
|
this.isStructured = rowType instanceof structure_1.Structure;
|
|
75
74
|
if (options?.withHeader === true) {
|
|
76
|
-
this.header =
|
|
75
|
+
this.header = this.rowType.clone();
|
|
77
76
|
}
|
|
78
77
|
this.qualifiedName = qualifiedName?.toUpperCase();
|
|
79
78
|
}
|
|
@@ -152,7 +151,7 @@ class HashedTable {
|
|
|
152
151
|
let val = data[k.toLowerCase()];
|
|
153
152
|
// convert to correct type, eg Chars have specific length, or rounding,
|
|
154
153
|
if (k === "TABLE_LINE") {
|
|
155
|
-
const row =
|
|
154
|
+
const row = tableRowType.clone();
|
|
156
155
|
row.set(val.get());
|
|
157
156
|
val = row.get();
|
|
158
157
|
}
|
|
@@ -179,7 +178,7 @@ class HashedTable {
|
|
|
179
178
|
}
|
|
180
179
|
else {
|
|
181
180
|
// convert
|
|
182
|
-
const row =
|
|
181
|
+
const row = field.clone();
|
|
183
182
|
row.set(val.get());
|
|
184
183
|
val = row.get();
|
|
185
184
|
}
|
|
@@ -274,23 +273,23 @@ class HashedTable {
|
|
|
274
273
|
cloneRow(item) {
|
|
275
274
|
// make sure to do conversion if needed
|
|
276
275
|
if (typeof item === "number") {
|
|
277
|
-
const tmp =
|
|
276
|
+
const tmp = this.getRowType().clone();
|
|
278
277
|
tmp.set(new integer_1.Integer().set(item));
|
|
279
278
|
return tmp;
|
|
280
279
|
}
|
|
281
280
|
else if (typeof item === "string") {
|
|
282
|
-
const tmp =
|
|
281
|
+
const tmp = this.getRowType().clone();
|
|
283
282
|
tmp.set(new string_1.String().set(item));
|
|
284
283
|
return tmp;
|
|
285
284
|
// @ts-ignore
|
|
286
285
|
}
|
|
287
286
|
else if (this.isStructured === true && item.getQualifiedName && this.rowType.getQualifiedName && item.getQualifiedName() !== "" && item.getQualifiedName() === this.rowType.getQualifiedName()) {
|
|
288
287
|
// types match, so no need to do conversions, just clone the item
|
|
289
|
-
const val =
|
|
288
|
+
const val = item.clone();
|
|
290
289
|
return val;
|
|
291
290
|
}
|
|
292
291
|
else {
|
|
293
|
-
const tmp =
|
|
292
|
+
const tmp = this.getRowType().clone();
|
|
294
293
|
tmp.set(item);
|
|
295
294
|
return tmp;
|
|
296
295
|
}
|
|
@@ -306,7 +305,7 @@ class Table {
|
|
|
306
305
|
this.options = options;
|
|
307
306
|
this.isStructured = rowType instanceof structure_1.Structure;
|
|
308
307
|
if (options?.withHeader === true) {
|
|
309
|
-
this.header =
|
|
308
|
+
this.header = this.rowType.clone();
|
|
310
309
|
}
|
|
311
310
|
this.qualifiedName = qualifiedName?.toUpperCase();
|
|
312
311
|
}
|
|
@@ -492,23 +491,23 @@ class Table {
|
|
|
492
491
|
cloneRow(item) {
|
|
493
492
|
// make sure to do conversion if needed
|
|
494
493
|
if (typeof item === "number") {
|
|
495
|
-
const tmp =
|
|
494
|
+
const tmp = this.getRowType().clone();
|
|
496
495
|
tmp.set(new integer_1.Integer().set(item));
|
|
497
496
|
return tmp;
|
|
498
497
|
}
|
|
499
498
|
else if (typeof item === "string") {
|
|
500
|
-
const tmp =
|
|
499
|
+
const tmp = this.getRowType().clone();
|
|
501
500
|
tmp.set(new string_1.String().set(item));
|
|
502
501
|
return tmp;
|
|
503
502
|
// @ts-ignore
|
|
504
503
|
}
|
|
505
504
|
else if (this.isStructured === true && item.getQualifiedName && this.rowType.getQualifiedName && item.getQualifiedName() !== "" && item.getQualifiedName() === this.rowType.getQualifiedName()) {
|
|
506
505
|
// types match, so no need to do conversions, just clone the item
|
|
507
|
-
const val =
|
|
506
|
+
const val = item.clone();
|
|
508
507
|
return val;
|
|
509
508
|
}
|
|
510
509
|
else {
|
|
511
|
-
const tmp =
|
|
510
|
+
const tmp = this.getRowType().clone();
|
|
512
511
|
tmp.set(item);
|
|
513
512
|
return tmp;
|
|
514
513
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/runtime",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.61",
|
|
4
4
|
"description": "Transpiler - Runtime",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@types/chai": "^4.3.20",
|
|
33
33
|
"@types/mocha": "^10.0.10",
|
|
34
34
|
"chai": "^4.5.0",
|
|
35
|
-
"mocha": "^11.
|
|
35
|
+
"mocha": "^11.7.1",
|
|
36
36
|
"source-map-support": "^0.5.21",
|
|
37
37
|
"typescript": "^5.8.3"
|
|
38
38
|
},
|
package/build/src/clone.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function clone<T>(obj: T): T;
|
package/build/src/clone.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clone = clone;
|
|
4
|
-
function clone(obj) {
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
return obj.clone();
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
if (obj.clone) {
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
return obj.clone();
|
|
11
|
-
}
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
const copy = new obj.constructor();
|
|
14
|
-
for (const attr in obj) {
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
17
|
-
if (obj.hasOwnProperty(attr)) {
|
|
18
|
-
if ("object" !== typeof obj[attr] || obj[attr] === null) {
|
|
19
|
-
copy[attr] = obj[attr];
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
copy[attr] = clone(obj[attr]);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return copy;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=clone.js.map
|