@abaplint/runtime 2.7.139 → 2.7.140
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.
|
@@ -34,6 +34,7 @@ function readTable(table, options) {
|
|
|
34
34
|
let found = undefined;
|
|
35
35
|
let foundIndex = 0;
|
|
36
36
|
let binarySubrc = undefined;
|
|
37
|
+
// console.dir(options);
|
|
37
38
|
if (table instanceof types_1.FieldSymbol) {
|
|
38
39
|
if (table.getPointer() === undefined) {
|
|
39
40
|
throw new Error("GETWA_NOT_ASSIGNED");
|
|
@@ -104,6 +105,29 @@ function readTable(table, options) {
|
|
|
104
105
|
found = searchResult.found;
|
|
105
106
|
foundIndex = 0;
|
|
106
107
|
}
|
|
108
|
+
else if ((options === null || options === void 0 ? void 0 : options.keyName) && options.withKey && options.withKeySimple) {
|
|
109
|
+
const arr = table.getSecondaryIndex(options.keyName);
|
|
110
|
+
const keyInformation = table.getKeyByName(options.keyName);
|
|
111
|
+
const firstKeyName = keyInformation === null || keyInformation === void 0 ? void 0 : keyInformation.keyFields[0];
|
|
112
|
+
if (firstKeyName === undefined) {
|
|
113
|
+
throw new Error("readTable, first key name not found");
|
|
114
|
+
}
|
|
115
|
+
// console.dir("SEC:");
|
|
116
|
+
const firstValue = options.withKeySimple[firstKeyName.toLowerCase()];
|
|
117
|
+
if (firstValue === undefined) {
|
|
118
|
+
// fallback
|
|
119
|
+
return readTable(table, Object.assign(Object.assign({}, options), { withKeySimple: undefined }));
|
|
120
|
+
}
|
|
121
|
+
const startIndex = (0, binary_search_1.binarySearchFrom)(arr, 0, arr.length, firstKeyName.toLowerCase(), firstValue) - 1;
|
|
122
|
+
// console.dir("startindex: " + startIndex);
|
|
123
|
+
if (startIndex >= 0) {
|
|
124
|
+
// todo: early exit if not found
|
|
125
|
+
const searchResult = searchWithKey(arr, options.withKey, startIndex, options.usesTableLine);
|
|
126
|
+
// console.dir(searchResult);
|
|
127
|
+
found = searchResult.found;
|
|
128
|
+
foundIndex = searchResult.foundIndex;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
107
131
|
else if (((options === null || options === void 0 ? void 0 : options.binarySearch) === true || (options === null || options === void 0 ? void 0 : options.withTableKey) === true)
|
|
108
132
|
&& options.withKeyValue
|
|
109
133
|
&& ((options === null || options === void 0 ? void 0 : options.binarySearch) === true || ((_b = table.getOptions().primaryKey) === null || _b === void 0 ? void 0 : _b.type) !== types_1.TableAccessType.standard)
|
|
@@ -112,6 +136,7 @@ function readTable(table, options) {
|
|
|
112
136
|
const first = options.withKeyValue[0];
|
|
113
137
|
const arr = table.array();
|
|
114
138
|
const startIndex = (0, binary_search_1.binarySearchFromRow)(arr, 0, arr.length - 1, first.key, first.value, options.usesTableLine);
|
|
139
|
+
// todo: early exit if not found
|
|
115
140
|
const searchResult = searchWithKey(arr, options.withKey, startIndex, options.usesTableLine);
|
|
116
141
|
found = searchResult.found;
|
|
117
142
|
foundIndex = searchResult.foundIndex;
|
package/build/src/types/table.js
CHANGED
|
@@ -88,7 +88,7 @@ class HashedTable {
|
|
|
88
88
|
if (secondary === undefined) {
|
|
89
89
|
throw `Table, secondary key "${name}" not found`;
|
|
90
90
|
}
|
|
91
|
-
// note, array() already is a copy, so it
|
|
91
|
+
// note, array() already is a copy, so it can be used,
|
|
92
92
|
const copy = this.array();
|
|
93
93
|
(0, sort_1.sort)(copy, { by: secondary.keyFields.map(k => { return { component: k.toLowerCase() }; }) });
|
|
94
94
|
this.secondaryIndexes[name.toUpperCase()] = copy;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/runtime",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.140",
|
|
4
4
|
"description": "Transpiler - Runtime",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/chai": "^4.3.11",
|
|
33
33
|
"@types/mocha": "^10.0.6",
|
|
34
|
-
"chai": "^4.
|
|
34
|
+
"chai": "^4.4.0",
|
|
35
35
|
"mocha": "^10.2.0",
|
|
36
36
|
"source-map-support": "^0.5.21",
|
|
37
37
|
"typescript": "^5.3.3"
|