@abaplint/runtime 2.7.165 → 2.8.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/build/src/binary_search.js +2 -2
- package/build/src/builtin/count_any_of.js +1 -1
- package/build/src/builtin/find.js +5 -6
- package/build/src/builtin/round.js +1 -1
- package/build/src/builtin/substring.js +2 -3
- package/build/src/builtin/substring_after.js +3 -3
- package/build/src/builtin/substring_before.js +2 -2
- package/build/src/compare/eq.d.ts +2 -2
- package/build/src/compare/eq.js +10 -0
- package/build/src/compare/gt.js +6 -0
- package/build/src/compare/initial.d.ts +2 -2
- package/build/src/compare/initial.js +3 -0
- package/build/src/expand_in.js +2 -3
- package/build/src/index.js +2 -2
- package/build/src/operators/add.d.ts +2 -2
- package/build/src/operators/add.js +11 -0
- package/build/src/operators/div.d.ts +1 -1
- package/build/src/operators/div.js +13 -3
- package/build/src/operators/divide.d.ts +2 -2
- package/build/src/operators/divide.js +13 -0
- package/build/src/operators/minus.d.ts +2 -2
- package/build/src/operators/minus.js +6 -1
- package/build/src/operators/mod.d.ts +1 -1
- package/build/src/operators/mod.js +6 -0
- package/build/src/operators/multiply.d.ts +2 -2
- package/build/src/operators/multiply.js +6 -1
- package/build/src/operators/power.d.ts +2 -2
- package/build/src/operators/power.js +5 -0
- package/build/src/statements/assign.js +1 -2
- package/build/src/statements/cast.js +3 -4
- package/build/src/statements/convert.js +3 -4
- package/build/src/statements/create_data.js +6 -6
- package/build/src/statements/delete_internal.js +36 -56
- package/build/src/statements/describe.js +1 -2
- package/build/src/statements/find.js +10 -11
- package/build/src/statements/get_time.js +3 -3
- package/build/src/statements/index.js +1 -1
- package/build/src/statements/insert_internal.js +7 -9
- package/build/src/statements/loop.js +56 -83
- package/build/src/statements/message.js +5 -6
- package/build/src/statements/move_corresponding.js +1 -2
- package/build/src/statements/open_cursor.js +1 -1
- package/build/src/statements/read_table.d.ts +2 -2
- package/build/src/statements/read_table.js +23 -21
- package/build/src/statements/replace.js +1 -1
- package/build/src/statements/select.js +4 -5
- package/build/src/statements/set_bit.js +1 -1
- package/build/src/statements/shift.js +10 -10
- package/build/src/statements/sort.js +4 -5
- package/build/src/statements/write.js +7 -8
- package/build/src/template_formatting.js +2 -2
- package/build/src/types/abap_object.js +2 -2
- package/build/src/types/character.js +5 -8
- package/build/src/types/data_reference.d.ts +3 -2
- package/build/src/types/data_reference.js +8 -12
- package/build/src/types/date.js +5 -5
- package/build/src/types/field_symbol.d.ts +1 -1
- package/build/src/types/field_symbol.js +7 -12
- package/build/src/types/float.js +5 -1
- package/build/src/types/hex.d.ts +4 -3
- package/build/src/types/hex.js +20 -6
- package/build/src/types/integer.js +5 -1
- package/build/src/types/integer8.d.ts +3 -3
- package/build/src/types/integer8.js +8 -5
- package/build/src/types/numc.js +4 -4
- package/build/src/types/packed.js +3 -3
- package/build/src/types/string.js +3 -3
- package/build/src/types/structure.js +4 -4
- package/build/src/types/table.js +9 -13
- package/build/src/types/time.js +5 -5
- package/build/src/types/utc_long.js +1 -1
- package/build/src/types/xstring.d.ts +3 -2
- package/build/src/types/xstring.js +16 -5
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ function searchWithKeyEarlyExit(arr, withKey, startIndex = 0, usesTableLine, fir
|
|
|
14
14
|
row = a.get();
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
row = isStructured ?
|
|
17
|
+
row = isStructured ? { table_line: a, ...a.get() } : { table_line: a };
|
|
18
18
|
}
|
|
19
19
|
if (withKey(row) === true) {
|
|
20
20
|
return {
|
|
@@ -49,7 +49,7 @@ function searchWithKey(arr, withKey, startIndex = 0, usesTableLine) {
|
|
|
49
49
|
row = a.get();
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
|
-
row = isStructured ?
|
|
52
|
+
row = isStructured ? { table_line: a, ...a.get() } : { table_line: a };
|
|
53
53
|
}
|
|
54
54
|
if (withKey(row) === true) {
|
|
55
55
|
return {
|
|
@@ -65,7 +65,6 @@ function searchWithKey(arr, withKey, startIndex = 0, usesTableLine) {
|
|
|
65
65
|
}
|
|
66
66
|
/////////////////
|
|
67
67
|
function readTable(table, options) {
|
|
68
|
-
var _a, _b, _c, _d, _e;
|
|
69
68
|
let found = undefined;
|
|
70
69
|
let foundIndex = 0;
|
|
71
70
|
let binarySubrc = undefined;
|
|
@@ -77,9 +76,9 @@ function readTable(table, options) {
|
|
|
77
76
|
return readTable(table.getPointer(), options);
|
|
78
77
|
}
|
|
79
78
|
// check if it is a primary index read specified with WITH KEY instead of WITH TABLE KEY
|
|
80
|
-
if (
|
|
81
|
-
&&
|
|
82
|
-
&& (
|
|
79
|
+
if (options?.withTableKey === undefined
|
|
80
|
+
&& options?.withKeySimple
|
|
81
|
+
&& (table.getOptions().primaryKey?.keyFields || []).length > 0) {
|
|
83
82
|
if (table instanceof types_1.HashedTable) {
|
|
84
83
|
// hashed tables requires all fields for fast lookup
|
|
85
84
|
const fields = new Set(table.getOptions().primaryKey.keyFields);
|
|
@@ -104,7 +103,7 @@ function readTable(table, options) {
|
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
|
-
if (options
|
|
106
|
+
if (options?.index) {
|
|
108
107
|
if (table instanceof types_1.HashedTable) {
|
|
109
108
|
throw new Error("Hashed table, READ INDEX not possible");
|
|
110
109
|
}
|
|
@@ -120,6 +119,9 @@ function readTable(table, options) {
|
|
|
120
119
|
if (index instanceof types_1.Float || index instanceof types_1.DecFloat34) {
|
|
121
120
|
index = index.getRaw();
|
|
122
121
|
}
|
|
122
|
+
else if (index instanceof types_1.Integer8) {
|
|
123
|
+
index = Number(index.get());
|
|
124
|
+
}
|
|
123
125
|
else {
|
|
124
126
|
index = index.get();
|
|
125
127
|
}
|
|
@@ -129,21 +131,21 @@ function readTable(table, options) {
|
|
|
129
131
|
foundIndex = index;
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
|
-
else if (table instanceof types_1.HashedTable &&
|
|
134
|
+
else if (table instanceof types_1.HashedTable && options?.withTableKey === true && options.withKeySimple) {
|
|
133
135
|
const hash = table.buildHashFromSimple(options.withKeySimple);
|
|
134
136
|
found = table.read(hash);
|
|
135
137
|
foundIndex = 0;
|
|
136
138
|
}
|
|
137
|
-
else if (table instanceof types_1.HashedTable &&
|
|
139
|
+
else if (table instanceof types_1.HashedTable && options?.withKey) {
|
|
138
140
|
// this is slow..
|
|
139
|
-
const searchResult = searchWithKey(table.array(), options.withKey, 0, options
|
|
141
|
+
const searchResult = searchWithKey(table.array(), options.withKey, 0, options?.usesTableLine);
|
|
140
142
|
found = searchResult.found;
|
|
141
143
|
foundIndex = 0;
|
|
142
144
|
}
|
|
143
|
-
else if (
|
|
145
|
+
else if (options?.keyName && options.withKey && options.withKeySimple) {
|
|
144
146
|
const arr = table.getSecondaryIndex(options.keyName);
|
|
145
147
|
const keyInformation = table.getKeyByName(options.keyName);
|
|
146
|
-
const firstKeyName = keyInformation
|
|
148
|
+
const firstKeyName = keyInformation?.keyFields[0];
|
|
147
149
|
if (firstKeyName === undefined) {
|
|
148
150
|
throw new Error("readTable, first key name not found");
|
|
149
151
|
}
|
|
@@ -151,7 +153,7 @@ function readTable(table, options) {
|
|
|
151
153
|
const firstValue = options.withKeySimple[firstKeyName.toLowerCase()];
|
|
152
154
|
if (firstValue === undefined) {
|
|
153
155
|
// fallback
|
|
154
|
-
return readTable(table,
|
|
156
|
+
return readTable(table, { ...options, withKeySimple: undefined });
|
|
155
157
|
}
|
|
156
158
|
const startIndex = (0, binary_search_1.binarySearchFrom)(arr, 0, arr.length, firstKeyName.toLowerCase(), firstValue) - 1;
|
|
157
159
|
// console.dir("startindex: " + startIndex);
|
|
@@ -162,9 +164,9 @@ function readTable(table, options) {
|
|
|
162
164
|
foundIndex = searchResult.foundIndex;
|
|
163
165
|
}
|
|
164
166
|
}
|
|
165
|
-
else if ((
|
|
167
|
+
else if ((options?.binarySearch === true || options?.withTableKey === true)
|
|
166
168
|
&& options.withKeyValue
|
|
167
|
-
&& (
|
|
169
|
+
&& (options?.binarySearch === true || table.getOptions().primaryKey?.type !== types_1.TableAccessType.standard)
|
|
168
170
|
&& options.withKey) {
|
|
169
171
|
// note: it currently only uses the first key field for binary search, todo
|
|
170
172
|
const first = options.withKeyValue[0];
|
|
@@ -190,7 +192,7 @@ function readTable(table, options) {
|
|
|
190
192
|
row = last.get();
|
|
191
193
|
}
|
|
192
194
|
else {
|
|
193
|
-
row = isStructured ?
|
|
195
|
+
row = isStructured ? { table_line: last, ...last.get() } : { table_line: last };
|
|
194
196
|
}
|
|
195
197
|
if ((0, compare_1.ge)(first.value, first.key(row))) {
|
|
196
198
|
binarySubrc = 8;
|
|
@@ -198,20 +200,20 @@ function readTable(table, options) {
|
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
|
-
else if (options
|
|
203
|
+
else if (options?.withKey) {
|
|
202
204
|
const arr = table.array();
|
|
203
205
|
const searchResult = searchWithKey(arr, options.withKey, 0, options.usesTableLine);
|
|
204
206
|
found = searchResult.found;
|
|
205
207
|
foundIndex = searchResult.foundIndex;
|
|
206
208
|
}
|
|
207
|
-
else if (options
|
|
209
|
+
else if (options?.from) {
|
|
208
210
|
if (options.from instanceof types_1.FieldSymbol) {
|
|
209
211
|
options.from = options.from.getPointer();
|
|
210
212
|
}
|
|
211
213
|
if (table instanceof types_1.Table && options.from instanceof types_1.Structure) {
|
|
212
214
|
// todo: optimize if the primary key is sorted
|
|
213
215
|
const arr = table.array();
|
|
214
|
-
const keys =
|
|
216
|
+
const keys = table.getOptions()?.primaryKey?.keyFields;
|
|
215
217
|
const isStructured = arr[0] instanceof types_1.Structure;
|
|
216
218
|
if (keys !== undefined && isStructured === true) {
|
|
217
219
|
// console.dir(keys);
|
|
@@ -239,7 +241,7 @@ function readTable(table, options) {
|
|
|
239
241
|
if (found === undefined) {
|
|
240
242
|
foundIndex = 0;
|
|
241
243
|
}
|
|
242
|
-
if (found === undefined &&
|
|
244
|
+
if (found === undefined && table.getOptions().primaryKey?.type === types_1.TableAccessType.sorted) {
|
|
243
245
|
binarySubrc = 8;
|
|
244
246
|
}
|
|
245
247
|
}
|
|
@@ -250,7 +252,7 @@ function readTable(table, options) {
|
|
|
250
252
|
if (binarySubrc) {
|
|
251
253
|
subrc = binarySubrc;
|
|
252
254
|
}
|
|
253
|
-
else if ((
|
|
255
|
+
else if ((options?.binarySearch === true || options?.keyName !== undefined)
|
|
254
256
|
&& subrc === 4) {
|
|
255
257
|
subrc = 8;
|
|
256
258
|
}
|
|
@@ -7,7 +7,7 @@ const concatenate_1 = require("./concatenate");
|
|
|
7
7
|
function replace(input) {
|
|
8
8
|
if (input.target instanceof types_1.Table) {
|
|
9
9
|
for (const row of input.target.array()) {
|
|
10
|
-
replace(
|
|
10
|
+
replace({ ...input, target: row });
|
|
11
11
|
}
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
@@ -12,12 +12,12 @@ async function select(target, input, runtimeOptions, context) {
|
|
|
12
12
|
// @ts-ignore
|
|
13
13
|
target = target.getPointer();
|
|
14
14
|
}
|
|
15
|
-
if (
|
|
15
|
+
if (runtimeOptions?.appending !== true) {
|
|
16
16
|
if (Array.isArray(target)) {
|
|
17
17
|
target.forEach(f => f.clear());
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
|
-
target
|
|
20
|
+
target?.clear();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
if (rows.length === 0) {
|
|
@@ -41,7 +41,6 @@ async function select(target, input, runtimeOptions, context) {
|
|
|
41
41
|
}
|
|
42
42
|
exports.select = select;
|
|
43
43
|
function rowsToTarget(target, rows) {
|
|
44
|
-
var _a, _b;
|
|
45
44
|
if (target instanceof types_1.Structure) {
|
|
46
45
|
const result = {};
|
|
47
46
|
for (const column in rows[0]) {
|
|
@@ -60,11 +59,11 @@ function rowsToTarget(target, rows) {
|
|
|
60
59
|
for (let columnName in row) {
|
|
61
60
|
columnName = columnName.toLowerCase();
|
|
62
61
|
if (row[columnName] === null) {
|
|
63
|
-
|
|
62
|
+
targetRow.get()[columnName]?.clear();
|
|
64
63
|
continue;
|
|
65
64
|
}
|
|
66
65
|
// @ts-ignore
|
|
67
|
-
|
|
66
|
+
targetRow.get()[columnName]?.set(row[columnName]);
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
else {
|
|
@@ -29,7 +29,7 @@ function setBit(number, hex, val) {
|
|
|
29
29
|
}
|
|
30
30
|
let bits = parseInt(byte, 16);
|
|
31
31
|
const bitMask = 1 << 8 - (number.get() - (byteNum - 1) * 8);
|
|
32
|
-
if (
|
|
32
|
+
if (val?.get() === 0 || val?.get() === "0") {
|
|
33
33
|
bits = bits &= ~bitMask;
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
@@ -4,7 +4,7 @@ exports.shift = void 0;
|
|
|
4
4
|
const compare_1 = require("../compare");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
function shift(target, options) {
|
|
7
|
-
if (
|
|
7
|
+
if (options?.mode === "BYTE") {
|
|
8
8
|
shift_byte_mode(target, options);
|
|
9
9
|
}
|
|
10
10
|
else {
|
|
@@ -14,7 +14,7 @@ function shift(target, options) {
|
|
|
14
14
|
exports.shift = shift;
|
|
15
15
|
function shift_character_mode(target, options) {
|
|
16
16
|
let value = target.get();
|
|
17
|
-
if (options
|
|
17
|
+
if (options?.deletingLeading) {
|
|
18
18
|
let leading = options.deletingLeading;
|
|
19
19
|
if (typeof leading !== "string") {
|
|
20
20
|
leading = leading.get();
|
|
@@ -24,7 +24,7 @@ function shift_character_mode(target, options) {
|
|
|
24
24
|
value = value.substr(1);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
else if (options
|
|
27
|
+
else if (options?.deletingTrailing) {
|
|
28
28
|
let trailing = options.deletingTrailing;
|
|
29
29
|
if (typeof trailing !== "string") {
|
|
30
30
|
trailing = trailing.get();
|
|
@@ -35,7 +35,7 @@ function shift_character_mode(target, options) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
else if (options
|
|
38
|
+
else if (options?.places) {
|
|
39
39
|
const p = options.places.get();
|
|
40
40
|
if (options.circular) {
|
|
41
41
|
value = value.substr(p) + value.substr(0, p);
|
|
@@ -49,7 +49,7 @@ function shift_character_mode(target, options) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
else if (options
|
|
52
|
+
else if (options?.to) {
|
|
53
53
|
let to = "";
|
|
54
54
|
if (typeof options.to === "string") {
|
|
55
55
|
to = options.to;
|
|
@@ -62,7 +62,7 @@ function shift_character_mode(target, options) {
|
|
|
62
62
|
value = value.substr(index);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
else if (options
|
|
65
|
+
else if (options?.circular) {
|
|
66
66
|
if (options.direction === "RIGHT") {
|
|
67
67
|
value = value.substring(value.length - 1, value.length) + value.substring(0, value.length - 1);
|
|
68
68
|
}
|
|
@@ -82,7 +82,7 @@ function shift_character_mode(target, options) {
|
|
|
82
82
|
}
|
|
83
83
|
function shift_byte_mode(target, options) {
|
|
84
84
|
let value = target.get();
|
|
85
|
-
if (options
|
|
85
|
+
if (options?.deletingLeading) {
|
|
86
86
|
let leading = options.deletingLeading;
|
|
87
87
|
if (typeof leading !== "string") {
|
|
88
88
|
leading = leading.get();
|
|
@@ -92,7 +92,7 @@ function shift_byte_mode(target, options) {
|
|
|
92
92
|
value = value.substr(2);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
else if (options
|
|
95
|
+
else if (options?.places) {
|
|
96
96
|
const p = options.places.get() * 2;
|
|
97
97
|
if (options.circular) {
|
|
98
98
|
value = value.substr(p) + value.substr(0, p);
|
|
@@ -101,7 +101,7 @@ function shift_byte_mode(target, options) {
|
|
|
101
101
|
value = value.substr(p);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
else if (options
|
|
104
|
+
else if (options?.to) {
|
|
105
105
|
let to = "";
|
|
106
106
|
if (typeof options.to === "string") {
|
|
107
107
|
to = options.to;
|
|
@@ -114,7 +114,7 @@ function shift_byte_mode(target, options) {
|
|
|
114
114
|
value = value.substr(index);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
else if (options
|
|
117
|
+
else if (options?.circular) {
|
|
118
118
|
value = value.substr(2) + value.substr(0, 2);
|
|
119
119
|
}
|
|
120
120
|
else {
|
|
@@ -43,7 +43,6 @@ function compare(a, b, input) {
|
|
|
43
43
|
}
|
|
44
44
|
function sort(input, options) {
|
|
45
45
|
// console.dir(input);
|
|
46
|
-
var _a, _b;
|
|
47
46
|
if (input instanceof types_1.FieldSymbol) {
|
|
48
47
|
const pnt = input.getPointer();
|
|
49
48
|
if (pnt === undefined) {
|
|
@@ -52,15 +51,15 @@ function sort(input, options) {
|
|
|
52
51
|
sort(pnt, options);
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
55
|
-
else if (
|
|
54
|
+
else if (options?.skipSortedCheck !== true
|
|
56
55
|
&& input instanceof types_1.Table
|
|
57
|
-
&&
|
|
56
|
+
&& input.getOptions()?.primaryKey?.type === types_1.TableAccessType.sorted) {
|
|
58
57
|
throw new Error("SORT called on sorted table");
|
|
59
58
|
}
|
|
60
59
|
if (input instanceof types_1.HashedTable) {
|
|
61
60
|
throw new Error("Sort hashed table, ugh?");
|
|
62
61
|
}
|
|
63
|
-
if (options
|
|
62
|
+
if (options?.by) {
|
|
64
63
|
if (options.by.length === 0) {
|
|
65
64
|
throw "SortByLengthZero";
|
|
66
65
|
}
|
|
@@ -75,7 +74,7 @@ function sort(input, options) {
|
|
|
75
74
|
});
|
|
76
75
|
}
|
|
77
76
|
else {
|
|
78
|
-
const descending =
|
|
77
|
+
const descending = options?.descending === true;
|
|
79
78
|
input.sort((a, b) => {
|
|
80
79
|
if ((0, compare_1.eq)(a, b)) {
|
|
81
80
|
return 0;
|
|
@@ -8,13 +8,12 @@ class WriteStatement {
|
|
|
8
8
|
this.context = context;
|
|
9
9
|
}
|
|
10
10
|
write(source, options) {
|
|
11
|
-
var _a, _b;
|
|
12
11
|
let right = false;
|
|
13
|
-
if (
|
|
12
|
+
if (options?.skipLine === true) {
|
|
14
13
|
this.context.console.add("\n");
|
|
15
14
|
}
|
|
16
15
|
else {
|
|
17
|
-
if (
|
|
16
|
+
if (options?.newLine === true && this.context.console.isEmpty() === false) {
|
|
18
17
|
this.context.console.add("\n");
|
|
19
18
|
}
|
|
20
19
|
let result = "";
|
|
@@ -23,10 +22,10 @@ class WriteStatement {
|
|
|
23
22
|
}
|
|
24
23
|
else if (source instanceof types_1.Structure) {
|
|
25
24
|
const obj = source.getCharacter();
|
|
26
|
-
this.write(obj,
|
|
25
|
+
this.write(obj, { ...options });
|
|
27
26
|
}
|
|
28
27
|
else if (source instanceof types_1.Float) {
|
|
29
|
-
if (
|
|
28
|
+
if (options?.exponent?.get() === 0) {
|
|
30
29
|
const tens = source.getRaw().toFixed(0).length - 1;
|
|
31
30
|
if (options.noSign === true && source.getRaw() < 0) {
|
|
32
31
|
result = source.getRaw().toFixed(17 - tens).replace(".", ",");
|
|
@@ -43,7 +42,7 @@ class WriteStatement {
|
|
|
43
42
|
else if (source instanceof types_1.Packed) {
|
|
44
43
|
let num = source.get();
|
|
45
44
|
let decimals = source.getDecimals();
|
|
46
|
-
if (NO_DEICMAL_CURRENCIES.includes(
|
|
45
|
+
if (NO_DEICMAL_CURRENCIES.includes(options?.currency?.get().trimEnd() || "")) {
|
|
47
46
|
// todo, more work needed here,
|
|
48
47
|
num = num * 100;
|
|
49
48
|
decimals = 0;
|
|
@@ -54,10 +53,10 @@ class WriteStatement {
|
|
|
54
53
|
else {
|
|
55
54
|
result = source.get().toString();
|
|
56
55
|
}
|
|
57
|
-
if (
|
|
56
|
+
if (options?.noSign === true) {
|
|
58
57
|
result = result.replace("-", "");
|
|
59
58
|
}
|
|
60
|
-
if (options
|
|
59
|
+
if (options?.target) {
|
|
61
60
|
if (right === true) {
|
|
62
61
|
const len = options.target.get().length;
|
|
63
62
|
options.target.set(" ".repeat(len - result.length) + result);
|
|
@@ -30,7 +30,7 @@ function templateFormatting(source, options) {
|
|
|
30
30
|
}
|
|
31
31
|
else if (source instanceof types_1.Float) {
|
|
32
32
|
const raw = source.getRaw();
|
|
33
|
-
if (
|
|
33
|
+
if (options?.style === "scientific") {
|
|
34
34
|
text = raw.toExponential().toUpperCase();
|
|
35
35
|
text = text.replace(/([+-])(\d)$/, "$10$2");
|
|
36
36
|
}
|
|
@@ -42,7 +42,7 @@ function templateFormatting(source, options) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
else if (source instanceof types_1.Packed) {
|
|
45
|
-
if (options
|
|
45
|
+
if (options?.decimals) {
|
|
46
46
|
text = source.get().toFixed(options.decimals);
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
@@ -4,8 +4,8 @@ exports.ABAPObject = void 0;
|
|
|
4
4
|
const field_symbol_1 = require("./field_symbol");
|
|
5
5
|
class ABAPObject {
|
|
6
6
|
constructor(input) {
|
|
7
|
-
this.qualifiedName = input
|
|
8
|
-
this.RTTIName = input
|
|
7
|
+
this.qualifiedName = input?.qualifiedName;
|
|
8
|
+
this.RTTIName = input?.RTTIName;
|
|
9
9
|
this.clear();
|
|
10
10
|
}
|
|
11
11
|
get() {
|
|
@@ -58,16 +58,13 @@ class Character {
|
|
|
58
58
|
return this;
|
|
59
59
|
}
|
|
60
60
|
getQualifiedName() {
|
|
61
|
-
|
|
62
|
-
return (_a = this.extra) === null || _a === void 0 ? void 0 : _a.qualifiedName;
|
|
61
|
+
return this.extra?.qualifiedName;
|
|
63
62
|
}
|
|
64
63
|
getConversionExit() {
|
|
65
|
-
|
|
66
|
-
return (_a = this.extra) === null || _a === void 0 ? void 0 : _a.conversionExit;
|
|
64
|
+
return this.extra?.conversionExit;
|
|
67
65
|
}
|
|
68
66
|
getDDICName() {
|
|
69
|
-
|
|
70
|
-
return (_a = this.extra) === null || _a === void 0 ? void 0 : _a.ddicName;
|
|
67
|
+
return this.extra?.ddicName;
|
|
71
68
|
}
|
|
72
69
|
getLength() {
|
|
73
70
|
return this.length;
|
|
@@ -87,11 +84,11 @@ class Character {
|
|
|
87
84
|
}
|
|
88
85
|
}
|
|
89
86
|
getOffset(input) {
|
|
90
|
-
let offset = input
|
|
87
|
+
let offset = input?.offset;
|
|
91
88
|
if (offset) {
|
|
92
89
|
offset = (0, _parse_1.parse)(offset);
|
|
93
90
|
}
|
|
94
|
-
let length = input
|
|
91
|
+
let length = input?.length;
|
|
95
92
|
if (length) {
|
|
96
93
|
length = (0, _parse_1.parse)(length);
|
|
97
94
|
}
|
|
@@ -6,7 +6,8 @@ import { String } from "./string";
|
|
|
6
6
|
import { Structure } from "./structure";
|
|
7
7
|
import { Float } from "./float";
|
|
8
8
|
import { Hex } from "./hex";
|
|
9
|
-
|
|
9
|
+
import { Integer8 } from "./integer8";
|
|
10
|
+
type PointerType = INumeric | Table | ICharacter | ABAPObject | Integer8 | undefined | Structure | Float;
|
|
10
11
|
export declare class DataReference {
|
|
11
12
|
private pointer;
|
|
12
13
|
private readonly type;
|
|
@@ -20,7 +21,7 @@ export declare class DataReference {
|
|
|
20
21
|
get(): any;
|
|
21
22
|
array(): any;
|
|
22
23
|
getArrayLength(): any;
|
|
23
|
-
set(value: any): void | Float | ABAPObject | this | Table | Structure;
|
|
24
|
+
set(value: any): void | Float | Integer8 | ABAPObject | this | Table | Structure;
|
|
24
25
|
getOffset(input: {
|
|
25
26
|
offset?: number | INumeric | Hex;
|
|
26
27
|
length?: number | INumeric | Hex;
|
|
@@ -30,25 +30,21 @@ class DataReference {
|
|
|
30
30
|
// return this.pointer?.clear();
|
|
31
31
|
}
|
|
32
32
|
get() {
|
|
33
|
-
var _a;
|
|
34
33
|
if (this.pointer === this) {
|
|
35
34
|
throw "Cyclic data reference";
|
|
36
35
|
}
|
|
37
36
|
// @ts-ignore
|
|
38
|
-
return
|
|
37
|
+
return this.pointer?.get();
|
|
39
38
|
}
|
|
40
39
|
array() {
|
|
41
|
-
var _a;
|
|
42
40
|
// @ts-ignore
|
|
43
|
-
return
|
|
41
|
+
return this.pointer?.array();
|
|
44
42
|
}
|
|
45
43
|
getArrayLength() {
|
|
46
|
-
var _a;
|
|
47
44
|
// @ts-ignore
|
|
48
|
-
return
|
|
45
|
+
return this.pointer?.getArrayLength();
|
|
49
46
|
}
|
|
50
47
|
set(value) {
|
|
51
|
-
var _a;
|
|
52
48
|
if (value instanceof DataReference) {
|
|
53
49
|
this.pointer = value.getPointer();
|
|
54
50
|
return this;
|
|
@@ -66,23 +62,23 @@ class DataReference {
|
|
|
66
62
|
}
|
|
67
63
|
}
|
|
68
64
|
else {
|
|
69
|
-
return
|
|
65
|
+
return this.pointer?.set(value);
|
|
70
66
|
}
|
|
71
67
|
return this;
|
|
72
68
|
}
|
|
73
69
|
getOffset(input) {
|
|
74
|
-
if (input
|
|
70
|
+
if (input?.offset) {
|
|
75
71
|
input.offset = (0, _parse_1.parse)(input.offset);
|
|
76
72
|
}
|
|
77
|
-
if (input
|
|
73
|
+
if (input?.length) {
|
|
78
74
|
input.length = (0, _parse_1.parse)(input.length);
|
|
79
75
|
}
|
|
80
76
|
// Assuming we're interested in Strings here, for now...
|
|
81
77
|
let ret = this.get();
|
|
82
|
-
if (input
|
|
78
|
+
if (input?.offset) {
|
|
83
79
|
ret = ret.substr(input.offset);
|
|
84
80
|
}
|
|
85
|
-
if (
|
|
81
|
+
if (input?.length !== undefined) {
|
|
86
82
|
ret = ret.substr(0, input.length);
|
|
87
83
|
}
|
|
88
84
|
const r = new string_1.String();
|
package/build/src/types/date.js
CHANGED
|
@@ -8,7 +8,7 @@ const _parse_1 = require("../operators/_parse");
|
|
|
8
8
|
class Date {
|
|
9
9
|
constructor(input) {
|
|
10
10
|
this.clear();
|
|
11
|
-
this.qualifiedName = input
|
|
11
|
+
this.qualifiedName = input?.qualifiedName;
|
|
12
12
|
}
|
|
13
13
|
getQualifiedName() {
|
|
14
14
|
return this.qualifiedName;
|
|
@@ -49,18 +49,18 @@ class Date {
|
|
|
49
49
|
return (0, _date_helper_1.getNumberFromDate)(this.value);
|
|
50
50
|
}
|
|
51
51
|
getOffset(input) {
|
|
52
|
-
if (input
|
|
52
|
+
if (input?.offset) {
|
|
53
53
|
input.offset = (0, _parse_1.parse)(input.offset);
|
|
54
54
|
}
|
|
55
|
-
if (input
|
|
55
|
+
if (input?.length) {
|
|
56
56
|
input.length = (0, _parse_1.parse)(input.length);
|
|
57
57
|
}
|
|
58
58
|
let ret = this.value;
|
|
59
|
-
if (input
|
|
59
|
+
if (input?.offset) {
|
|
60
60
|
// @ts-ignore
|
|
61
61
|
ret = ret.substr(input.offset);
|
|
62
62
|
}
|
|
63
|
-
if (
|
|
63
|
+
if (input?.length !== undefined) {
|
|
64
64
|
// @ts-ignore
|
|
65
65
|
ret = ret.substr(0, input.length);
|
|
66
66
|
}
|
|
@@ -17,7 +17,7 @@ export declare class FieldSymbol {
|
|
|
17
17
|
unassign(): void;
|
|
18
18
|
isAssigned(): boolean;
|
|
19
19
|
getPointer(): any;
|
|
20
|
-
dereference(): INumeric | Float |
|
|
20
|
+
dereference(): INumeric | ICharacter | Float | import("./integer8").Integer8 | ABAPObject | Table | Structure | undefined;
|
|
21
21
|
clear(): void | Structure | undefined;
|
|
22
22
|
get(): any;
|
|
23
23
|
appendInitial(): import("./table").TableRowType | undefined;
|
|
@@ -45,11 +45,9 @@ class FieldSymbol {
|
|
|
45
45
|
}
|
|
46
46
|
///////////////
|
|
47
47
|
clear() {
|
|
48
|
-
|
|
49
|
-
return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.clear();
|
|
48
|
+
return this.pointer?.clear();
|
|
50
49
|
}
|
|
51
50
|
get() {
|
|
52
|
-
var _a, _b, _c;
|
|
53
51
|
if (this.casting) {
|
|
54
52
|
if (this.type instanceof hex_1.Hex) {
|
|
55
53
|
const pt = this.pointer;
|
|
@@ -61,19 +59,19 @@ class FieldSymbol {
|
|
|
61
59
|
}
|
|
62
60
|
else {
|
|
63
61
|
// @ts-ignore
|
|
64
|
-
const ret = new string_1.String().set(Buffer.from(
|
|
62
|
+
const ret = new string_1.String().set(Buffer.from(this.pointer?.get(), "utf16le").toString("hex"));
|
|
65
63
|
return ret.get();
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
else {
|
|
69
67
|
// @ts-ignore
|
|
70
|
-
const ret = new string_1.String().set(Buffer.from(
|
|
68
|
+
const ret = new string_1.String().set(Buffer.from(this.pointer?.get(), "hex").toString("utf16le"));
|
|
71
69
|
return ret.get();
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
72
|
else {
|
|
75
73
|
// @ts-ignore
|
|
76
|
-
return
|
|
74
|
+
return this.pointer?.get();
|
|
77
75
|
}
|
|
78
76
|
}
|
|
79
77
|
appendInitial() {
|
|
@@ -83,18 +81,15 @@ class FieldSymbol {
|
|
|
83
81
|
return undefined;
|
|
84
82
|
}
|
|
85
83
|
array() {
|
|
86
|
-
var _a;
|
|
87
84
|
// @ts-ignore
|
|
88
|
-
return
|
|
85
|
+
return this.pointer?.array();
|
|
89
86
|
}
|
|
90
87
|
getArrayLength() {
|
|
91
|
-
var _a;
|
|
92
88
|
// @ts-ignore
|
|
93
|
-
return
|
|
89
|
+
return this.pointer?.getArrayLength();
|
|
94
90
|
}
|
|
95
91
|
set(value) {
|
|
96
|
-
|
|
97
|
-
(_a = this.pointer) === null || _a === void 0 ? void 0 : _a.set(value);
|
|
92
|
+
this.pointer?.set(value);
|
|
98
93
|
return this;
|
|
99
94
|
}
|
|
100
95
|
getOffset(input) {
|
package/build/src/types/float.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Float = void 0;
|
|
4
4
|
const hex_1 = require("./hex");
|
|
5
5
|
const xstring_1 = require("./xstring");
|
|
6
|
+
const integer8_1 = require("./integer8");
|
|
6
7
|
/*
|
|
7
8
|
function getNumberParts(x: number) {
|
|
8
9
|
if(isNaN(x)) {
|
|
@@ -21,7 +22,7 @@ function getNumberParts(x: number) {
|
|
|
21
22
|
class Float {
|
|
22
23
|
constructor(input) {
|
|
23
24
|
this.value = 0;
|
|
24
|
-
this.qualifiedName = input
|
|
25
|
+
this.qualifiedName = input?.qualifiedName;
|
|
25
26
|
}
|
|
26
27
|
getQualifiedName() {
|
|
27
28
|
return this.qualifiedName;
|
|
@@ -36,6 +37,9 @@ class Float {
|
|
|
36
37
|
else if (typeof value === "string") {
|
|
37
38
|
this.value = parseFloat(value);
|
|
38
39
|
}
|
|
40
|
+
else if (value instanceof integer8_1.Integer8) {
|
|
41
|
+
this.value = Number(value.get());
|
|
42
|
+
}
|
|
39
43
|
else if (value instanceof Float) {
|
|
40
44
|
this.value = value.getRaw();
|
|
41
45
|
}
|