@abaplint/runtime 2.7.164 → 2.8.0

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.
Files changed (51) hide show
  1. package/build/src/binary_search.js +2 -2
  2. package/build/src/builtin/abs.js +5 -0
  3. package/build/src/builtin/count_any_of.js +1 -1
  4. package/build/src/builtin/find.js +5 -6
  5. package/build/src/builtin/round.js +1 -1
  6. package/build/src/builtin/substring.js +2 -3
  7. package/build/src/builtin/substring_after.js +3 -3
  8. package/build/src/builtin/substring_before.js +2 -2
  9. package/build/src/builtin/trunc.js +5 -0
  10. package/build/src/expand_in.js +2 -3
  11. package/build/src/index.js +2 -2
  12. package/build/src/statements/assign.js +1 -2
  13. package/build/src/statements/cast.js +3 -4
  14. package/build/src/statements/convert.js +3 -4
  15. package/build/src/statements/create_data.js +6 -6
  16. package/build/src/statements/delete_internal.js +36 -56
  17. package/build/src/statements/describe.js +1 -2
  18. package/build/src/statements/find.js +10 -11
  19. package/build/src/statements/get_time.js +3 -3
  20. package/build/src/statements/index.js +1 -1
  21. package/build/src/statements/insert_internal.js +7 -9
  22. package/build/src/statements/loop.js +56 -83
  23. package/build/src/statements/message.js +5 -6
  24. package/build/src/statements/move_corresponding.js +1 -2
  25. package/build/src/statements/open_cursor.js +1 -1
  26. package/build/src/statements/read_table.js +20 -21
  27. package/build/src/statements/replace.js +1 -1
  28. package/build/src/statements/select.js +4 -5
  29. package/build/src/statements/set_bit.js +1 -1
  30. package/build/src/statements/shift.js +10 -10
  31. package/build/src/statements/sort.js +4 -5
  32. package/build/src/statements/write.js +7 -8
  33. package/build/src/template_formatting.js +2 -2
  34. package/build/src/types/abap_object.js +2 -2
  35. package/build/src/types/character.js +5 -8
  36. package/build/src/types/data_reference.js +8 -12
  37. package/build/src/types/date.js +5 -5
  38. package/build/src/types/field_symbol.js +7 -12
  39. package/build/src/types/float.js +1 -1
  40. package/build/src/types/hex.js +4 -4
  41. package/build/src/types/integer.js +1 -1
  42. package/build/src/types/integer8.js +1 -1
  43. package/build/src/types/numc.js +4 -4
  44. package/build/src/types/packed.js +3 -3
  45. package/build/src/types/string.js +3 -3
  46. package/build/src/types/structure.js +4 -4
  47. package/build/src/types/table.js +9 -13
  48. package/build/src/types/time.js +5 -5
  49. package/build/src/types/utc_long.js +1 -1
  50. package/build/src/types/xstring.js +3 -3
  51. package/package.json +2 -2
@@ -58,16 +58,13 @@ class Character {
58
58
  return this;
59
59
  }
60
60
  getQualifiedName() {
61
- var _a;
62
- return (_a = this.extra) === null || _a === void 0 ? void 0 : _a.qualifiedName;
61
+ return this.extra?.qualifiedName;
63
62
  }
64
63
  getConversionExit() {
65
- var _a;
66
- return (_a = this.extra) === null || _a === void 0 ? void 0 : _a.conversionExit;
64
+ return this.extra?.conversionExit;
67
65
  }
68
66
  getDDICName() {
69
- var _a;
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 === null || input === void 0 ? void 0 : input.offset;
87
+ let offset = input?.offset;
91
88
  if (offset) {
92
89
  offset = (0, _parse_1.parse)(offset);
93
90
  }
94
- let length = input === null || input === void 0 ? void 0 : input.length;
91
+ let length = input?.length;
95
92
  if (length) {
96
93
  length = (0, _parse_1.parse)(length);
97
94
  }
@@ -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 (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.get();
37
+ return this.pointer?.get();
39
38
  }
40
39
  array() {
41
- var _a;
42
40
  // @ts-ignore
43
- return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.array();
41
+ return this.pointer?.array();
44
42
  }
45
43
  getArrayLength() {
46
- var _a;
47
44
  // @ts-ignore
48
- return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.getArrayLength();
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 (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.set(value);
65
+ return this.pointer?.set(value);
70
66
  }
71
67
  return this;
72
68
  }
73
69
  getOffset(input) {
74
- if (input === null || input === void 0 ? void 0 : input.offset) {
70
+ if (input?.offset) {
75
71
  input.offset = (0, _parse_1.parse)(input.offset);
76
72
  }
77
- if (input === null || input === void 0 ? void 0 : input.length) {
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 === null || input === void 0 ? void 0 : input.offset) {
78
+ if (input?.offset) {
83
79
  ret = ret.substr(input.offset);
84
80
  }
85
- if ((input === null || input === void 0 ? void 0 : input.length) !== undefined) {
81
+ if (input?.length !== undefined) {
86
82
  ret = ret.substr(0, input.length);
87
83
  }
88
84
  const r = new string_1.String();
@@ -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 === null || input === void 0 ? void 0 : input.qualifiedName;
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 === null || input === void 0 ? void 0 : input.offset) {
52
+ if (input?.offset) {
53
53
  input.offset = (0, _parse_1.parse)(input.offset);
54
54
  }
55
- if (input === null || input === void 0 ? void 0 : input.length) {
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 === null || input === void 0 ? void 0 : input.offset) {
59
+ if (input?.offset) {
60
60
  // @ts-ignore
61
61
  ret = ret.substr(input.offset);
62
62
  }
63
- if ((input === null || input === void 0 ? void 0 : input.length) !== undefined) {
63
+ if (input?.length !== undefined) {
64
64
  // @ts-ignore
65
65
  ret = ret.substr(0, input.length);
66
66
  }
@@ -45,11 +45,9 @@ class FieldSymbol {
45
45
  }
46
46
  ///////////////
47
47
  clear() {
48
- var _a;
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((_a = this.pointer) === null || _a === void 0 ? void 0 : _a.get(), "utf16le").toString("hex"));
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((_b = this.pointer) === null || _b === void 0 ? void 0 : _b.get(), "hex").toString("utf16le"));
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 (_c = this.pointer) === null || _c === void 0 ? void 0 : _c.get();
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 (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.array();
85
+ return this.pointer?.array();
89
86
  }
90
87
  getArrayLength() {
91
- var _a;
92
88
  // @ts-ignore
93
- return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.getArrayLength();
89
+ return this.pointer?.getArrayLength();
94
90
  }
95
91
  set(value) {
96
- var _a;
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) {
@@ -21,7 +21,7 @@ function getNumberParts(x: number) {
21
21
  class Float {
22
22
  constructor(input) {
23
23
  this.value = 0;
24
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
24
+ this.qualifiedName = input?.qualifiedName;
25
25
  }
26
26
  getQualifiedName() {
27
27
  return this.qualifiedName;
@@ -7,8 +7,8 @@ const xstring_1 = require("./xstring");
7
7
  const throw_error_1 = require("../throw_error");
8
8
  class Hex {
9
9
  constructor(input) {
10
- this.length = (input === null || input === void 0 ? void 0 : input.length) ? input === null || input === void 0 ? void 0 : input.length : 1;
11
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
10
+ this.length = input?.length ? input?.length : 1;
11
+ this.qualifiedName = input?.qualifiedName;
12
12
  this.clear();
13
13
  }
14
14
  getQualifiedName() {
@@ -67,11 +67,11 @@ class Hex {
67
67
  return this.value;
68
68
  }
69
69
  getOffset(input) {
70
- let offset = input === null || input === void 0 ? void 0 : input.offset;
70
+ let offset = input?.offset;
71
71
  if (offset) {
72
72
  offset = (0, _parse_1.parse)(offset);
73
73
  }
74
- let length = input === null || input === void 0 ? void 0 : input.length;
74
+ let length = input?.length;
75
75
  if (length) {
76
76
  length = (0, _parse_1.parse)(length);
77
77
  }
@@ -30,7 +30,7 @@ class Integer {
30
30
  constructor(input) {
31
31
  this.constant = false;
32
32
  this.value = 0;
33
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
33
+ this.qualifiedName = input?.qualifiedName;
34
34
  }
35
35
  getQualifiedName() {
36
36
  return this.qualifiedName;
@@ -9,7 +9,7 @@ const digits = new RegExp(/^\s*-?\+?\d+\.?\d* *$/i);
9
9
  class Integer8 {
10
10
  constructor(input) {
11
11
  this.value = 0;
12
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
12
+ this.qualifiedName = input?.qualifiedName;
13
13
  }
14
14
  getQualifiedName() {
15
15
  return this.qualifiedName;
@@ -6,8 +6,8 @@ const throw_error_1 = require("../throw_error");
6
6
  const float_1 = require("./float");
7
7
  class Numc {
8
8
  constructor(input) {
9
- this.length = (input === null || input === void 0 ? void 0 : input.length) ? input === null || input === void 0 ? void 0 : input.length : 1;
10
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
9
+ this.length = input?.length ? input?.length : 1;
10
+ this.qualifiedName = input?.qualifiedName;
11
11
  this.clear();
12
12
  }
13
13
  getQualifiedName() {
@@ -48,11 +48,11 @@ class Numc {
48
48
  return this.value;
49
49
  }
50
50
  getOffset(input) {
51
- let offset = input === null || input === void 0 ? void 0 : input.offset;
51
+ let offset = input?.offset;
52
52
  if (offset) {
53
53
  offset = (0, _parse_1.parse)(offset);
54
54
  }
55
- let length = input === null || input === void 0 ? void 0 : input.length;
55
+ let length = input?.length;
56
56
  if (length) {
57
57
  length = (0, _parse_1.parse)(length);
58
58
  }
@@ -8,14 +8,14 @@ class Packed {
8
8
  constructor(input) {
9
9
  this.value = 0;
10
10
  this.length = 666;
11
- if (input === null || input === void 0 ? void 0 : input.length) {
11
+ if (input?.length) {
12
12
  this.length = input.length;
13
13
  }
14
14
  this.decimals = 0;
15
- if (input === null || input === void 0 ? void 0 : input.decimals) {
15
+ if (input?.decimals) {
16
16
  this.decimals = input.decimals;
17
17
  }
18
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
18
+ this.qualifiedName = input?.qualifiedName;
19
19
  }
20
20
  getQualifiedName() {
21
21
  return this.qualifiedName;
@@ -12,7 +12,7 @@ const float_1 = require("./float");
12
12
  class String {
13
13
  constructor(input) {
14
14
  this.value = "";
15
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
15
+ this.qualifiedName = input?.qualifiedName;
16
16
  }
17
17
  getQualifiedName() {
18
18
  return this.qualifiedName;
@@ -63,11 +63,11 @@ class String {
63
63
  return this.value;
64
64
  }
65
65
  getOffset(input) {
66
- let offset = input === null || input === void 0 ? void 0 : input.offset;
66
+ let offset = input?.offset;
67
67
  if (offset) {
68
68
  offset = (0, _parse_1.parse)(offset);
69
69
  }
70
- let length = input === null || input === void 0 ? void 0 : input.length;
70
+ let length = input?.length;
71
71
  if (length) {
72
72
  length = (0, _parse_1.parse)(length);
73
73
  }
@@ -10,8 +10,8 @@ const throw_error_1 = require("../throw_error");
10
10
  class Structure {
11
11
  constructor(fields, qualifiedName, ddicName, suffix, asInclude) {
12
12
  this.value = fields;
13
- this.qualifiedName = qualifiedName === null || qualifiedName === void 0 ? void 0 : qualifiedName.toUpperCase();
14
- this.ddicName = ddicName === null || ddicName === void 0 ? void 0 : ddicName.toUpperCase();
13
+ this.qualifiedName = qualifiedName?.toUpperCase();
14
+ this.ddicName = ddicName?.toUpperCase();
15
15
  this.suffix = suffix;
16
16
  this.asInclude = asInclude;
17
17
  }
@@ -97,11 +97,11 @@ class Structure {
97
97
  return val;
98
98
  }
99
99
  getOffset(input) {
100
- let offset = input === null || input === void 0 ? void 0 : input.offset;
100
+ let offset = input?.offset;
101
101
  if (offset) {
102
102
  offset = (0, _parse_1.parse)(offset);
103
103
  }
104
- let length = input === null || input === void 0 ? void 0 : input.length;
104
+ let length = input?.length;
105
105
  if (length) {
106
106
  length = (0, _parse_1.parse)(length);
107
107
  }
@@ -36,7 +36,6 @@ class LoopController {
36
36
  exports.LoopController = LoopController;
37
37
  class TableFactory {
38
38
  static construct(rowType, options, qualifiedName) {
39
- var _a;
40
39
  if (options === undefined) {
41
40
  options = {
42
41
  primaryKey: {
@@ -49,7 +48,7 @@ class TableFactory {
49
48
  withHeader: false,
50
49
  };
51
50
  }
52
- if (((_a = options.primaryKey) === null || _a === void 0 ? void 0 : _a.type) === TableAccessType.hashed) {
51
+ if (options.primaryKey?.type === TableAccessType.hashed) {
53
52
  return new HashedTable(rowType, options, qualifiedName);
54
53
  }
55
54
  else {
@@ -71,17 +70,16 @@ class HashedTable {
71
70
  this.rowType = rowType;
72
71
  this.options = options;
73
72
  this.options = options;
74
- if ((options === null || options === void 0 ? void 0 : options.withHeader) === true) {
73
+ if (options?.withHeader === true) {
75
74
  this.header = (0, clone_1.clone)(this.rowType);
76
75
  }
77
- this.qualifiedName = qualifiedName === null || qualifiedName === void 0 ? void 0 : qualifiedName.toUpperCase();
76
+ this.qualifiedName = qualifiedName?.toUpperCase();
78
77
  }
79
78
  getArrayLength() {
80
79
  return Object.keys(this.value).length;
81
80
  }
82
81
  getKeyByName(name) {
83
- var _a, _b;
84
- return (_b = (_a = this.getOptions()) === null || _a === void 0 ? void 0 : _a.secondary) === null || _b === void 0 ? void 0 : _b.find(s => s.name.toUpperCase() === name.toUpperCase());
82
+ return this.getOptions()?.secondary?.find(s => s.name.toUpperCase() === name.toUpperCase());
85
83
  }
86
84
  getSecondaryIndex(name) {
87
85
  if (this.secondaryIndexes[name.toUpperCase()]) {
@@ -287,17 +285,16 @@ class Table {
287
285
  this.rowType = rowType;
288
286
  this.options = options;
289
287
  this.isStructured = rowType instanceof structure_1.Structure;
290
- if ((options === null || options === void 0 ? void 0 : options.withHeader) === true) {
288
+ if (options?.withHeader === true) {
291
289
  this.header = (0, clone_1.clone)(this.rowType);
292
290
  }
293
- this.qualifiedName = qualifiedName === null || qualifiedName === void 0 ? void 0 : qualifiedName.toUpperCase();
291
+ this.qualifiedName = qualifiedName?.toUpperCase();
294
292
  }
295
293
  getArrayLength() {
296
294
  return this.value.length;
297
295
  }
298
296
  getKeyByName(name) {
299
- var _a, _b;
300
- return (_b = (_a = this.getOptions()) === null || _a === void 0 ? void 0 : _a.secondary) === null || _b === void 0 ? void 0 : _b.find(s => s.name.toUpperCase() === name.toUpperCase());
297
+ return this.getOptions()?.secondary?.find(s => s.name.toUpperCase() === name.toUpperCase());
301
298
  }
302
299
  getSecondaryIndex(name) {
303
300
  if (this.secondaryIndexes[name.toUpperCase()]) {
@@ -338,10 +335,9 @@ class Table {
338
335
  this.secondaryIndexes = {};
339
336
  }
340
337
  set(tab) {
341
- var _a, _b;
342
338
  this.secondaryIndexes = {};
343
- if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.withHeader) === true) {
344
- (_b = this.header) === null || _b === void 0 ? void 0 : _b.set(tab);
339
+ if (this.options?.withHeader === true) {
340
+ this.header?.set(tab);
345
341
  }
346
342
  else {
347
343
  if (!(tab instanceof Table) && !(tab instanceof field_symbol_1.FieldSymbol)) {
@@ -7,7 +7,7 @@ const _parse_1 = require("../operators/_parse");
7
7
  class Time {
8
8
  constructor(input) {
9
9
  this.clear();
10
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
10
+ this.qualifiedName = input?.qualifiedName;
11
11
  }
12
12
  getQualifiedName() {
13
13
  return this.qualifiedName;
@@ -50,18 +50,18 @@ class Time {
50
50
  return hours * 3600 + minutes * 60 + seconds;
51
51
  }
52
52
  getOffset(input) {
53
- if (input === null || input === void 0 ? void 0 : input.offset) {
53
+ if (input?.offset) {
54
54
  input.offset = (0, _parse_1.parse)(input.offset);
55
55
  }
56
- if (input === null || input === void 0 ? void 0 : input.length) {
56
+ if (input?.length) {
57
57
  input.length = (0, _parse_1.parse)(input.length);
58
58
  }
59
59
  let ret = this.value;
60
- if (input === null || input === void 0 ? void 0 : input.offset) {
60
+ if (input?.offset) {
61
61
  // @ts-ignore
62
62
  ret = ret.substr(input.offset);
63
63
  }
64
- if ((input === null || input === void 0 ? void 0 : input.length) !== undefined) {
64
+ if (input?.length !== undefined) {
65
65
  // @ts-ignore
66
66
  ret = ret.substr(0, input.length);
67
67
  }
@@ -4,7 +4,7 @@ exports.UTCLong = void 0;
4
4
  class UTCLong {
5
5
  constructor(input) {
6
6
  this.clear();
7
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
7
+ this.qualifiedName = input?.qualifiedName;
8
8
  }
9
9
  getQualifiedName() {
10
10
  return this.qualifiedName;
@@ -8,7 +8,7 @@ const throw_error_1 = require("../throw_error");
8
8
  class XString {
9
9
  constructor(input) {
10
10
  this.value = "";
11
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
11
+ this.qualifiedName = input?.qualifiedName;
12
12
  }
13
13
  getQualifiedName() {
14
14
  return this.qualifiedName;
@@ -52,11 +52,11 @@ class XString {
52
52
  return this.value;
53
53
  }
54
54
  getOffset(input) {
55
- let offset = input === null || input === void 0 ? void 0 : input.offset;
55
+ let offset = input?.offset;
56
56
  if (offset) {
57
57
  offset = (0, _parse_1.parse)(offset);
58
58
  }
59
- let length = input === null || input === void 0 ? void 0 : input.length;
59
+ let length = input?.length;
60
60
  if (length) {
61
61
  length = (0, _parse_1.parse)(length);
62
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.7.164",
3
+ "version": "2.8.0",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -37,6 +37,6 @@
37
37
  "typescript": "^5.3.3"
38
38
  },
39
39
  "dependencies": {
40
- "temporal-polyfill": "^0.2.2"
40
+ "temporal-polyfill": "^0.2.3"
41
41
  }
42
42
  }