@abaplint/runtime 2.7.45 → 2.7.46

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.
@@ -43,15 +43,28 @@ function readTable(table, options) {
43
43
  if ((options === null || options === void 0 ? void 0 : options.withTableKey) === undefined
44
44
  && (options === null || options === void 0 ? void 0 : options.withKeySimple)
45
45
  && (((_a = table.getOptions().primaryKey) === null || _a === void 0 ? void 0 : _a.keyFields) || []).length > 0) {
46
- const firstKeyField = table.getOptions().primaryKey.keyFields[0];
47
- let useKey = false;
48
- for (const name in options.withKeySimple) {
49
- if (firstKeyField === name.toUpperCase()) {
50
- useKey = true;
46
+ if (table instanceof types_1.HashedTable) {
47
+ // hashed tables requires all fields for fast lookup
48
+ const fields = new Set(table.getOptions().primaryKey.keyFields);
49
+ for (const name in options.withKeySimple) {
50
+ fields.delete(name.toUpperCase());
51
+ }
52
+ if (fields.size === 0) {
53
+ options.withTableKey = true;
51
54
  }
52
55
  }
53
- if (useKey === true) {
54
- options.withTableKey = true;
56
+ else {
57
+ // while sorted just needs the first key field
58
+ const firstKeyField = table.getOptions().primaryKey.keyFields[0];
59
+ let useKey = false;
60
+ for (const name in options.withKeySimple) {
61
+ if (firstKeyField === name.toUpperCase()) {
62
+ useKey = true;
63
+ }
64
+ }
65
+ if (useKey === true) {
66
+ options.withTableKey = true;
67
+ }
55
68
  }
56
69
  }
57
70
  if (options === null || options === void 0 ? void 0 : options.index) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.7.45",
3
+ "version": "2.7.46",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",