@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
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
-
var m = o[Symbol.asyncIterator], i;
|
|
5
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
6
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
7
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
|
-
};
|
|
9
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
3
|
exports.deleteInternal = void 0;
|
|
11
4
|
const types_1 = require("../types");
|
|
12
5
|
const compare_1 = require("../compare");
|
|
13
6
|
const loop_1 = require("./loop");
|
|
14
7
|
async function deleteInternal(target, options) {
|
|
15
|
-
var _a, e_1, _b, _c;
|
|
16
8
|
let index = 0;
|
|
17
9
|
if (target instanceof types_1.FieldSymbol) {
|
|
18
10
|
target = target.getPointer();
|
|
@@ -20,12 +12,12 @@ async function deleteInternal(target, options) {
|
|
|
20
12
|
throw new Error("deleteInternal, FS not assigned");
|
|
21
13
|
}
|
|
22
14
|
}
|
|
23
|
-
if (
|
|
24
|
-
&&
|
|
25
|
-
&&
|
|
26
|
-
&&
|
|
27
|
-
&&
|
|
28
|
-
&&
|
|
15
|
+
if (options?.index
|
|
16
|
+
&& options?.where === undefined
|
|
17
|
+
&& options?.adjacent === undefined
|
|
18
|
+
&& options?.fromValue === undefined
|
|
19
|
+
&& options?.from === undefined
|
|
20
|
+
&& options?.to === undefined) {
|
|
29
21
|
if (target.array()[options.index.get() - 1] === undefined) {
|
|
30
22
|
// @ts-ignore
|
|
31
23
|
abap.builtin.sy.get().subrc.set(4);
|
|
@@ -38,8 +30,8 @@ async function deleteInternal(target, options) {
|
|
|
38
30
|
return;
|
|
39
31
|
}
|
|
40
32
|
}
|
|
41
|
-
if (options
|
|
42
|
-
if (
|
|
33
|
+
if (options?.to) {
|
|
34
|
+
if (options?.from !== undefined || options?.where !== undefined) {
|
|
43
35
|
throw "DeleteInternalTodo";
|
|
44
36
|
}
|
|
45
37
|
for (let i = 0; i < options.to.get(); i++) {
|
|
@@ -47,7 +39,7 @@ async function deleteInternal(target, options) {
|
|
|
47
39
|
}
|
|
48
40
|
return;
|
|
49
41
|
}
|
|
50
|
-
if (
|
|
42
|
+
if (options?.adjacent === true) {
|
|
51
43
|
if (target instanceof types_1.HashedTable) {
|
|
52
44
|
throw new Error("delete adjacent, hashed table");
|
|
53
45
|
}
|
|
@@ -55,7 +47,7 @@ async function deleteInternal(target, options) {
|
|
|
55
47
|
for (let index = array.length - 1; index > 0; index--) {
|
|
56
48
|
const prev = array[index - 1];
|
|
57
49
|
const i = array[index];
|
|
58
|
-
if (options
|
|
50
|
+
if (options?.comparing) {
|
|
59
51
|
let match = false;
|
|
60
52
|
for (const compareField of options.comparing) {
|
|
61
53
|
match = (0, compare_1.eq)(prev.get()[compareField], i.get()[compareField]);
|
|
@@ -73,53 +65,41 @@ async function deleteInternal(target, options) {
|
|
|
73
65
|
}
|
|
74
66
|
return;
|
|
75
67
|
}
|
|
76
|
-
if (target instanceof types_1.HashedTable &&
|
|
68
|
+
if (target instanceof types_1.HashedTable && options?.fromValue) {
|
|
77
69
|
target.deleteFrom(options.fromValue);
|
|
78
70
|
return;
|
|
79
71
|
}
|
|
80
72
|
// @ts-ignore
|
|
81
73
|
const originalTabix = abap.builtin.sy.get().tabix.get();
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
target.deleteFrom(i);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
target.deleteIndex(index);
|
|
97
|
-
}
|
|
74
|
+
for await (const i of (0, loop_1.loop)(target)) {
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
index = abap.builtin.sy.get().tabix.get() - 1;
|
|
77
|
+
if (options?.where) {
|
|
78
|
+
const row = i instanceof types_1.Structure ? i.get() : { table_line: i };
|
|
79
|
+
if (options.where(row) === true) {
|
|
80
|
+
if (target instanceof types_1.HashedTable) {
|
|
81
|
+
target.deleteFrom(i);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
target.deleteIndex(index);
|
|
98
85
|
}
|
|
99
|
-
}
|
|
100
|
-
else if ((options === null || options === void 0 ? void 0 : options.index) && options.index.get() === index) {
|
|
101
|
-
target.deleteIndex(options.index.get() - 1);
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
else if ((options === null || options === void 0 ? void 0 : options.fromValue) && (0, compare_1.eq)(options.fromValue, i)) {
|
|
105
|
-
target.deleteIndex(index);
|
|
106
|
-
}
|
|
107
|
-
else if ((options === null || options === void 0 ? void 0 : options.from) && options.from.get() <= index + 1) {
|
|
108
|
-
target.deleteIndex(index);
|
|
109
|
-
}
|
|
110
|
-
else if (options === undefined && originalTabix === index + 1) {
|
|
111
|
-
// short form, "DELETE tab"
|
|
112
|
-
target.deleteIndex(index);
|
|
113
|
-
break;
|
|
114
86
|
}
|
|
115
87
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
88
|
+
else if (options?.index && options.index.get() === index) {
|
|
89
|
+
target.deleteIndex(options.index.get() - 1);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
else if (options?.fromValue && (0, compare_1.eq)(options.fromValue, i)) {
|
|
93
|
+
target.deleteIndex(index);
|
|
94
|
+
}
|
|
95
|
+
else if (options?.from && options.from.get() <= index + 1) {
|
|
96
|
+
target.deleteIndex(index);
|
|
97
|
+
}
|
|
98
|
+
else if (options === undefined && originalTabix === index + 1) {
|
|
99
|
+
// short form, "DELETE tab"
|
|
100
|
+
target.deleteIndex(index);
|
|
101
|
+
break;
|
|
121
102
|
}
|
|
122
|
-
finally { if (e_1) throw e_1.error; }
|
|
123
103
|
}
|
|
124
104
|
}
|
|
125
105
|
exports.deleteInternal = deleteInternal;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.describe = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
function describe(input) {
|
|
6
|
-
var _a;
|
|
7
6
|
// console.dir(input);
|
|
8
7
|
if (input.type) {
|
|
9
8
|
if (input.field instanceof types_1.FieldSymbol) {
|
|
@@ -87,7 +86,7 @@ function describe(input) {
|
|
|
87
86
|
if (input.table) {
|
|
88
87
|
// @ts-ignore
|
|
89
88
|
abap.builtin.sy.get().tfill.set(input.table.getArrayLength());
|
|
90
|
-
|
|
89
|
+
input.lines?.set(input.table.getArrayLength());
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
exports.describe = describe;
|
|
@@ -4,8 +4,7 @@ exports.find = void 0;
|
|
|
4
4
|
const abap_regex_1 = require("../abap_regex");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
function find(input, options) {
|
|
7
|
-
|
|
8
|
-
let sectionOffset = (_a = options.sectionOffset) === null || _a === void 0 ? void 0 : _a.get();
|
|
7
|
+
let sectionOffset = options.sectionOffset?.get();
|
|
9
8
|
if (sectionOffset && options.byteMode) {
|
|
10
9
|
sectionOffset = sectionOffset * 2;
|
|
11
10
|
}
|
|
@@ -76,7 +75,7 @@ function find(input, options) {
|
|
|
76
75
|
let temp;
|
|
77
76
|
// eslint-disable-next-line no-cond-assign
|
|
78
77
|
while (temp = s.exec(blah.get())) {
|
|
79
|
-
matches.push(
|
|
78
|
+
matches.push({ ...temp, line });
|
|
80
79
|
if (options.first === true) {
|
|
81
80
|
break;
|
|
82
81
|
}
|
|
@@ -157,7 +156,7 @@ function find(input, options) {
|
|
|
157
156
|
// @ts-ignore
|
|
158
157
|
abap.builtin.sy.get().subrc.set(0);
|
|
159
158
|
}
|
|
160
|
-
if (
|
|
159
|
+
if (matches[0]?.index !== undefined) {
|
|
161
160
|
let val = matches[0].index;
|
|
162
161
|
if (sectionOffset) {
|
|
163
162
|
val += sectionOffset;
|
|
@@ -165,19 +164,19 @@ function find(input, options) {
|
|
|
165
164
|
if (options.byteMode) {
|
|
166
165
|
val = val / 2;
|
|
167
166
|
}
|
|
168
|
-
|
|
167
|
+
options.offset?.set(val);
|
|
169
168
|
}
|
|
170
|
-
if (options
|
|
171
|
-
|
|
169
|
+
if (options?.count) {
|
|
170
|
+
options.count?.set(matches.length);
|
|
172
171
|
}
|
|
173
172
|
else {
|
|
174
|
-
|
|
173
|
+
options.count?.clear();
|
|
175
174
|
}
|
|
176
|
-
if (
|
|
177
|
-
|
|
175
|
+
if (options?.length && matches && matches[0]) {
|
|
176
|
+
options.length?.set(matches[0][0].length);
|
|
178
177
|
}
|
|
179
178
|
else {
|
|
180
|
-
|
|
179
|
+
options.length?.clear();
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
182
|
exports.find = find;
|
|
@@ -12,7 +12,7 @@ function getTime(options) {
|
|
|
12
12
|
if (options === undefined) {
|
|
13
13
|
options = {};
|
|
14
14
|
}
|
|
15
|
-
if (
|
|
15
|
+
if (options?.sy === undefined) {
|
|
16
16
|
// @ts-ignore
|
|
17
17
|
options.sy = abap.builtin.sy;
|
|
18
18
|
}
|
|
@@ -20,10 +20,10 @@ function getTime(options) {
|
|
|
20
20
|
options.sy.get().datum.set(date);
|
|
21
21
|
options.sy.get().timlo.set(time);
|
|
22
22
|
options.sy.get().uzeit.set(time);
|
|
23
|
-
if (options
|
|
23
|
+
if (options?.field) {
|
|
24
24
|
options.field.set(time);
|
|
25
25
|
}
|
|
26
|
-
if (options
|
|
26
|
+
if (options?.stamp) {
|
|
27
27
|
options.stamp.set(date + time);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -164,7 +164,7 @@ class Statements {
|
|
|
164
164
|
target.set(num);
|
|
165
165
|
}
|
|
166
166
|
async fetchNextCursor(cursor, target, packageSize) {
|
|
167
|
-
await (0, fetch_next_cursor_1.fetchNextCursor)(this.context, cursor.get(), target,
|
|
167
|
+
await (0, fetch_next_cursor_1.fetchNextCursor)(this.context, cursor.get(), target, packageSize?.get() || 0);
|
|
168
168
|
}
|
|
169
169
|
async closeCursor(cursor) {
|
|
170
170
|
await (0, close_cursor_1.closeCursor)(this.context, cursor.get());
|
|
@@ -7,7 +7,6 @@ const types_1 = require("../types");
|
|
|
7
7
|
const read_table_1 = require("./read_table");
|
|
8
8
|
const sort_1 = require("./sort");
|
|
9
9
|
function insertInternal(options) {
|
|
10
|
-
var _a, _b, _c, _d, _e;
|
|
11
10
|
if (options.table instanceof types_1.FieldSymbol) {
|
|
12
11
|
if (options.table.getPointer() === undefined) {
|
|
13
12
|
throw new Error("GETWA_NOT_ASSIGNED");
|
|
@@ -21,16 +20,15 @@ function insertInternal(options) {
|
|
|
21
20
|
options.data = options.data.getPointer();
|
|
22
21
|
}
|
|
23
22
|
const tableOptions = options.table.getOptions();
|
|
24
|
-
let isSorted =
|
|
25
|
-
||
|
|
23
|
+
let isSorted = tableOptions?.primaryKey?.type === types_1.TableAccessType.sorted
|
|
24
|
+
|| tableOptions?.primaryKey?.type === types_1.TableAccessType.hashed;
|
|
26
25
|
if (options.table instanceof types_1.HashedTable) {
|
|
27
26
|
isSorted = false;
|
|
28
27
|
}
|
|
29
28
|
else if (isSorted) {
|
|
30
29
|
const insert = options.data instanceof types_1.Structure ? options.data.get() : { table_line: options.data };
|
|
31
30
|
let compare = (row) => {
|
|
32
|
-
|
|
33
|
-
for (const key of ((_a = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.primaryKey) === null || _a === void 0 ? void 0 : _a.keyFields) || []) {
|
|
31
|
+
for (const key of tableOptions?.primaryKey?.keyFields || []) {
|
|
34
32
|
if (key.includes("-")) {
|
|
35
33
|
const [first, second] = key.split("-");
|
|
36
34
|
if ((0, compare_1.ne)(row[first.toLowerCase()].get()[second.toLowerCase()], insert[first.toLowerCase()].get()[second.toLowerCase()])) {
|
|
@@ -45,10 +43,10 @@ function insertInternal(options) {
|
|
|
45
43
|
}
|
|
46
44
|
return true;
|
|
47
45
|
};
|
|
48
|
-
if (
|
|
46
|
+
if (tableOptions.primaryKey?.isUnique === true) {
|
|
49
47
|
const withKeyValue = [];
|
|
50
48
|
let binary = false;
|
|
51
|
-
const data = options
|
|
49
|
+
const data = options?.data;
|
|
52
50
|
if (data instanceof types_1.Structure) {
|
|
53
51
|
const fieldName = tableOptions.primaryKey.keyFields[0].toLowerCase();
|
|
54
52
|
if (fieldName !== "table_line" && fieldName.includes("-") === false) {
|
|
@@ -140,10 +138,10 @@ function insertInternal(options) {
|
|
|
140
138
|
abap.builtin.sy.get().subrc.set(0);
|
|
141
139
|
if (isSorted && !(options.table instanceof types_1.HashedTable)) {
|
|
142
140
|
// slow, but works for now
|
|
143
|
-
let by =
|
|
141
|
+
let by = tableOptions?.primaryKey?.keyFields?.map(f => {
|
|
144
142
|
return { component: f.toLowerCase() };
|
|
145
143
|
});
|
|
146
|
-
if (
|
|
144
|
+
if (by?.length === 1 && by[0].component === "table_line") {
|
|
147
145
|
by = [];
|
|
148
146
|
}
|
|
149
147
|
if (by && by.length > 0) {
|
|
@@ -1,29 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
-
var m = o[Symbol.asyncIterator], i;
|
|
5
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
6
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
7
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
|
-
};
|
|
9
|
-
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
10
|
-
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
|
11
|
-
var i, p;
|
|
12
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
13
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
14
|
-
};
|
|
15
|
-
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
16
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
17
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
18
|
-
return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
19
|
-
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
20
|
-
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
21
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
22
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
23
|
-
function fulfill(value) { resume("next", value); }
|
|
24
|
-
function reject(value) { resume("throw", value); }
|
|
25
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
26
|
-
};
|
|
27
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
3
|
exports.loop = void 0;
|
|
29
4
|
const binary_search_1 = require("../binary_search");
|
|
@@ -48,70 +23,68 @@ function determineFromTo(array, topEquals, key) {
|
|
|
48
23
|
to: to,
|
|
49
24
|
};
|
|
50
25
|
}
|
|
51
|
-
function loop(table, options) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
26
|
+
async function* loop(table, options) {
|
|
27
|
+
if (table === undefined) {
|
|
28
|
+
throw new Error("LOOP at undefined");
|
|
29
|
+
}
|
|
30
|
+
else if (table instanceof types_1.FieldSymbol) {
|
|
31
|
+
const pnt = table.getPointer();
|
|
32
|
+
if (pnt === undefined) {
|
|
33
|
+
throw new Error("GETWA_NOT_ASSIGNED");
|
|
55
34
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
35
|
+
yield* loop(pnt, options);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const length = table.getArrayLength();
|
|
39
|
+
if (length === 0) {
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
abap.builtin.sy.get().subrc.set(4);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let loopFrom = options?.from && options?.from.get() > 0 ? options.from.get() - 1 : 0;
|
|
45
|
+
let loopTo = options?.to && options.to.get() < length ? options.to.get() : length;
|
|
46
|
+
let array = [];
|
|
47
|
+
if (options?.usingKey && options.usingKey !== undefined && options.usingKey !== "primary_key") {
|
|
48
|
+
array = table.getSecondaryIndex(options.usingKey);
|
|
49
|
+
const { from, to } = determineFromTo(array, options.topEquals, table.getKeyByName(options.usingKey));
|
|
50
|
+
loopFrom = Math.max(loopFrom, from) - 1;
|
|
51
|
+
loopTo = Math.min(loopTo, to);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
array = table.array();
|
|
55
|
+
}
|
|
56
|
+
const loopController = table.startLoop(loopFrom, loopTo, array);
|
|
57
|
+
let entered = false;
|
|
58
|
+
try {
|
|
59
|
+
const isStructured = array[0] instanceof types_1.Structure;
|
|
60
|
+
while (loopController.index < loopController.loopTo) {
|
|
61
|
+
if (loopController.index > array.length) {
|
|
62
|
+
break;
|
|
60
63
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
abap.builtin.sy.get().subrc.set(4);
|
|
68
|
-
return yield __await(void 0);
|
|
69
|
-
}
|
|
70
|
-
let loopFrom = (options === null || options === void 0 ? void 0 : options.from) && (options === null || options === void 0 ? void 0 : options.from.get()) > 0 ? options.from.get() - 1 : 0;
|
|
71
|
-
let loopTo = (options === null || options === void 0 ? void 0 : options.to) && options.to.get() < length ? options.to.get() : length;
|
|
72
|
-
let array = [];
|
|
73
|
-
if ((options === null || options === void 0 ? void 0 : options.usingKey) && options.usingKey !== undefined && options.usingKey !== "primary_key") {
|
|
74
|
-
array = table.getSecondaryIndex(options.usingKey);
|
|
75
|
-
const { from, to } = determineFromTo(array, options.topEquals, table.getKeyByName(options.usingKey));
|
|
76
|
-
loopFrom = Math.max(loopFrom, from) - 1;
|
|
77
|
-
loopTo = Math.min(loopTo, to);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
array = table.array();
|
|
81
|
-
}
|
|
82
|
-
const loopController = table.startLoop(loopFrom, loopTo, array);
|
|
83
|
-
let entered = false;
|
|
84
|
-
try {
|
|
85
|
-
const isStructured = array[0] instanceof types_1.Structure;
|
|
86
|
-
while (loopController.index < loopController.loopTo) {
|
|
87
|
-
if (loopController.index > array.length) {
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
const current = array[loopController.index];
|
|
91
|
-
if (options === null || options === void 0 ? void 0 : options.where) {
|
|
92
|
-
const row = isStructured ? current.get() : { table_line: current };
|
|
93
|
-
if ((yield __await(options.where(row))) === false) {
|
|
94
|
-
loopController.index++;
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
// @ts-ignore
|
|
99
|
-
abap.builtin.sy.get().tabix.set(loopController.index + 1);
|
|
100
|
-
entered = true;
|
|
101
|
-
yield yield __await(current);
|
|
102
|
-
loopController.index++;
|
|
103
|
-
if ((options === null || options === void 0 ? void 0 : options.to) === undefined && (options === null || options === void 0 ? void 0 : options.usingKey) === undefined) {
|
|
104
|
-
// extra rows might have been inserted inside the loop
|
|
105
|
-
loopController.loopTo = array.length;
|
|
64
|
+
const current = array[loopController.index];
|
|
65
|
+
if (options?.where) {
|
|
66
|
+
const row = isStructured ? current.get() : { table_line: current };
|
|
67
|
+
if (await options.where(row) === false) {
|
|
68
|
+
loopController.index++;
|
|
69
|
+
continue;
|
|
106
70
|
}
|
|
107
71
|
}
|
|
108
|
-
}
|
|
109
|
-
finally {
|
|
110
|
-
table.unregisterLoop(loopController);
|
|
111
72
|
// @ts-ignore
|
|
112
|
-
abap.builtin.sy.get().
|
|
73
|
+
abap.builtin.sy.get().tabix.set(loopController.index + 1);
|
|
74
|
+
entered = true;
|
|
75
|
+
yield current;
|
|
76
|
+
loopController.index++;
|
|
77
|
+
if (options?.to === undefined && options?.usingKey === undefined) {
|
|
78
|
+
// extra rows might have been inserted inside the loop
|
|
79
|
+
loopController.loopTo = array.length;
|
|
80
|
+
}
|
|
113
81
|
}
|
|
114
|
-
}
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
table.unregisterLoop(loopController);
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
abap.builtin.sy.get().subrc.set(entered ? 0 : 4);
|
|
87
|
+
}
|
|
115
88
|
}
|
|
116
89
|
exports.loop = loop;
|
|
117
90
|
//# sourceMappingURL=loop.js.map
|
|
@@ -25,7 +25,6 @@ function replace(text, w) {
|
|
|
25
25
|
return text.trim();
|
|
26
26
|
}
|
|
27
27
|
async function findText(context, arbgb, msgnr, msgty) {
|
|
28
|
-
var _a;
|
|
29
28
|
let text = undefined;
|
|
30
29
|
if (arbgb && msgnr) {
|
|
31
30
|
try {
|
|
@@ -36,17 +35,17 @@ async function findText(context, arbgb, msgnr, msgty) {
|
|
|
36
35
|
text = result[0]["text"];
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
|
-
catch
|
|
38
|
+
catch {
|
|
40
39
|
// use fallback text
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
if (text === undefined) {
|
|
44
43
|
// @ts-ignore
|
|
45
|
-
text =
|
|
44
|
+
text = abap.MSAG[arbgb?.trimEnd().toUpperCase()]?.[msgnr];
|
|
46
45
|
}
|
|
47
46
|
if (text === undefined) {
|
|
48
47
|
// fallback
|
|
49
|
-
text = msgty + ":" +
|
|
48
|
+
text = msgty + ":" + arbgb?.trim() + ":" + msgnr + " &1 &2 &3 &4";
|
|
50
49
|
}
|
|
51
50
|
return text;
|
|
52
51
|
}
|
|
@@ -59,12 +58,12 @@ class MessageStatement {
|
|
|
59
58
|
if (arbgb !== undefined && typeof arbgb !== "string") {
|
|
60
59
|
arbgb = arbgb.get();
|
|
61
60
|
}
|
|
62
|
-
arbgb = arbgb
|
|
61
|
+
arbgb = arbgb?.toUpperCase();
|
|
63
62
|
let msgty = options.type;
|
|
64
63
|
if (msgty !== undefined && typeof msgty !== "string") {
|
|
65
64
|
msgty = msgty.get();
|
|
66
65
|
}
|
|
67
|
-
msgty = msgty
|
|
66
|
+
msgty = msgty?.toUpperCase();
|
|
68
67
|
// @ts-ignore
|
|
69
68
|
abap.builtin.sy.get().msgid.set(arbgb || "");
|
|
70
69
|
let msgnr = options.number;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.moveCorresponding = void 0;
|
|
4
4
|
function moveCorresponding(source, target) {
|
|
5
|
-
var _a;
|
|
6
5
|
for (const n in source.get()) {
|
|
7
|
-
|
|
6
|
+
target.get()[n]?.set(source.get()[n]);
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
9
|
exports.moveCorresponding = moveCorresponding;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.openCursor = void 0;
|
|
4
4
|
async function openCursor(context, select, options) {
|
|
5
5
|
let db = context.defaultDB();
|
|
6
|
-
if (options
|
|
6
|
+
if (options?.connection) {
|
|
7
7
|
db = context.databaseConnections[options.connection];
|
|
8
8
|
}
|
|
9
9
|
const callbacks = await db.openCursor({ select: select });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DataReference, FieldSymbol, HashedTable, Structure, Table } from "../types";
|
|
1
|
+
import { DataReference, FieldSymbol, HashedTable, Integer8, Structure, Table } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
4
|
export interface IReadTableOptions {
|
|
5
|
-
index?: INumeric | FieldSymbol | number;
|
|
5
|
+
index?: INumeric | Integer8 | FieldSymbol | number;
|
|
6
6
|
into?: INumeric | ICharacter | Structure | Table | DataReference;
|
|
7
7
|
from?: INumeric | ICharacter | Structure | Table | DataReference;
|
|
8
8
|
referenceInto?: DataReference;
|