@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.
Files changed (74) hide show
  1. package/build/src/binary_search.js +2 -2
  2. package/build/src/builtin/count_any_of.js +1 -1
  3. package/build/src/builtin/find.js +5 -6
  4. package/build/src/builtin/round.js +1 -1
  5. package/build/src/builtin/substring.js +2 -3
  6. package/build/src/builtin/substring_after.js +3 -3
  7. package/build/src/builtin/substring_before.js +2 -2
  8. package/build/src/compare/eq.d.ts +2 -2
  9. package/build/src/compare/eq.js +10 -0
  10. package/build/src/compare/gt.js +6 -0
  11. package/build/src/compare/initial.d.ts +2 -2
  12. package/build/src/compare/initial.js +3 -0
  13. package/build/src/expand_in.js +2 -3
  14. package/build/src/index.js +2 -2
  15. package/build/src/operators/add.d.ts +2 -2
  16. package/build/src/operators/add.js +11 -0
  17. package/build/src/operators/div.d.ts +1 -1
  18. package/build/src/operators/div.js +13 -3
  19. package/build/src/operators/divide.d.ts +2 -2
  20. package/build/src/operators/divide.js +13 -0
  21. package/build/src/operators/minus.d.ts +2 -2
  22. package/build/src/operators/minus.js +6 -1
  23. package/build/src/operators/mod.d.ts +1 -1
  24. package/build/src/operators/mod.js +6 -0
  25. package/build/src/operators/multiply.d.ts +2 -2
  26. package/build/src/operators/multiply.js +6 -1
  27. package/build/src/operators/power.d.ts +2 -2
  28. package/build/src/operators/power.js +5 -0
  29. package/build/src/statements/assign.js +1 -2
  30. package/build/src/statements/cast.js +3 -4
  31. package/build/src/statements/convert.js +3 -4
  32. package/build/src/statements/create_data.js +6 -6
  33. package/build/src/statements/delete_internal.js +36 -56
  34. package/build/src/statements/describe.js +1 -2
  35. package/build/src/statements/find.js +10 -11
  36. package/build/src/statements/get_time.js +3 -3
  37. package/build/src/statements/index.js +1 -1
  38. package/build/src/statements/insert_internal.js +7 -9
  39. package/build/src/statements/loop.js +56 -83
  40. package/build/src/statements/message.js +5 -6
  41. package/build/src/statements/move_corresponding.js +1 -2
  42. package/build/src/statements/open_cursor.js +1 -1
  43. package/build/src/statements/read_table.d.ts +2 -2
  44. package/build/src/statements/read_table.js +23 -21
  45. package/build/src/statements/replace.js +1 -1
  46. package/build/src/statements/select.js +4 -5
  47. package/build/src/statements/set_bit.js +1 -1
  48. package/build/src/statements/shift.js +10 -10
  49. package/build/src/statements/sort.js +4 -5
  50. package/build/src/statements/write.js +7 -8
  51. package/build/src/template_formatting.js +2 -2
  52. package/build/src/types/abap_object.js +2 -2
  53. package/build/src/types/character.js +5 -8
  54. package/build/src/types/data_reference.d.ts +3 -2
  55. package/build/src/types/data_reference.js +8 -12
  56. package/build/src/types/date.js +5 -5
  57. package/build/src/types/field_symbol.d.ts +1 -1
  58. package/build/src/types/field_symbol.js +7 -12
  59. package/build/src/types/float.js +5 -1
  60. package/build/src/types/hex.d.ts +4 -3
  61. package/build/src/types/hex.js +20 -6
  62. package/build/src/types/integer.js +5 -1
  63. package/build/src/types/integer8.d.ts +3 -3
  64. package/build/src/types/integer8.js +8 -5
  65. package/build/src/types/numc.js +4 -4
  66. package/build/src/types/packed.js +3 -3
  67. package/build/src/types/string.js +3 -3
  68. package/build/src/types/structure.js +4 -4
  69. package/build/src/types/table.js +9 -13
  70. package/build/src/types/time.js +5 -5
  71. package/build/src/types/utc_long.js +1 -1
  72. package/build/src/types/xstring.d.ts +3 -2
  73. package/build/src/types/xstring.js +16 -5
  74. package/package.json +1 -1
@@ -3,6 +3,7 @@ import { Integer } from "./integer";
3
3
  import { XString } from "./xstring";
4
4
  import { ICharacter } from "./_character";
5
5
  import { INumeric } from "./_numeric";
6
+ import { Integer8 } from "./integer8";
6
7
  export declare class Hex implements ICharacter {
7
8
  private value;
8
9
  private readonly length;
@@ -12,12 +13,12 @@ export declare class Hex implements ICharacter {
12
13
  qualifiedName?: string;
13
14
  });
14
15
  getQualifiedName(): string | undefined;
15
- set(value: ICharacter | INumeric | string | number | Integer | Float): this;
16
+ set(value: ICharacter | INumeric | string | number | Integer | Integer8 | Float): Hex;
16
17
  getLength(): number;
17
18
  clear(): void;
18
19
  get(): string;
19
20
  getOffset(input: {
20
- offset?: number | INumeric | Hex;
21
- length?: number | INumeric | Hex;
21
+ offset?: number | INumeric | Hex | Integer8;
22
+ length?: number | INumeric | Hex | Integer8;
22
23
  }): XString;
23
24
  }
@@ -5,10 +5,11 @@ const _parse_1 = require("../operators/_parse");
5
5
  const float_1 = require("./float");
6
6
  const xstring_1 = require("./xstring");
7
7
  const throw_error_1 = require("../throw_error");
8
+ const integer8_1 = require("./integer8");
8
9
  class Hex {
9
10
  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;
11
+ this.length = input?.length ? input?.length : 1;
12
+ this.qualifiedName = input?.qualifiedName;
12
13
  this.clear();
13
14
  }
14
15
  getQualifiedName() {
@@ -32,6 +33,9 @@ class Hex {
32
33
  }
33
34
  this.value = this.value.padStart(this.length * 2, "0");
34
35
  }
36
+ else if (value instanceof integer8_1.Integer8) {
37
+ return this.set(Number(value.get()));
38
+ }
35
39
  else {
36
40
  let v = value.get();
37
41
  if (value instanceof float_1.Float) {
@@ -67,13 +71,23 @@ class Hex {
67
71
  return this.value;
68
72
  }
69
73
  getOffset(input) {
70
- let offset = input === null || input === void 0 ? void 0 : input.offset;
74
+ let offset = input?.offset;
71
75
  if (offset) {
72
- offset = (0, _parse_1.parse)(offset);
76
+ if (offset instanceof integer8_1.Integer8) {
77
+ offset = Number(offset.get());
78
+ }
79
+ else {
80
+ offset = (0, _parse_1.parse)(offset);
81
+ }
73
82
  }
74
- let length = input === null || input === void 0 ? void 0 : input.length;
83
+ let length = input?.length;
75
84
  if (length) {
76
- length = (0, _parse_1.parse)(length);
85
+ if (length instanceof integer8_1.Integer8) {
86
+ length = Number(length.get());
87
+ }
88
+ else {
89
+ length = (0, _parse_1.parse)(length);
90
+ }
77
91
  }
78
92
  if ((offset && offset * 2 > this.value.length)
79
93
  || (length && length * 2 > this.value.length)
@@ -5,6 +5,7 @@ const throw_error_1 = require("../throw_error");
5
5
  const float_1 = require("./float");
6
6
  const hex_1 = require("./hex");
7
7
  const xstring_1 = require("./xstring");
8
+ const integer8_1 = require("./integer8");
8
9
  exports.DIGITS = new RegExp(/^\s*-?\+?\d+\.?\d* *$/i);
9
10
  exports.MAX_INTEGER = 2147483647;
10
11
  exports.MIN_INTEGER = -2147483648;
@@ -30,7 +31,7 @@ class Integer {
30
31
  constructor(input) {
31
32
  this.constant = false;
32
33
  this.value = 0;
33
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
34
+ this.qualifiedName = input?.qualifiedName;
34
35
  }
35
36
  getQualifiedName() {
36
37
  return this.qualifiedName;
@@ -49,6 +50,9 @@ class Integer {
49
50
  else if (typeof value === "string") {
50
51
  this.value = toInteger(value);
51
52
  }
53
+ else if (value instanceof integer8_1.Integer8) {
54
+ this.set(Number(value.get()));
55
+ }
52
56
  else if (value instanceof float_1.Float) {
53
57
  this.set(Math.round(value.getRaw()));
54
58
  }
@@ -3,14 +3,14 @@ import { Hex } from "./hex";
3
3
  import { ICharacter } from "./_character";
4
4
  import { INumeric } from "./_numeric";
5
5
  import { Integer } from "./integer";
6
- export declare class Integer8 implements INumeric {
6
+ export declare class Integer8 {
7
7
  private value;
8
8
  private readonly qualifiedName;
9
9
  constructor(input?: {
10
10
  qualifiedName?: string;
11
11
  });
12
12
  getQualifiedName(): string | undefined;
13
- set(value: INumeric | ICharacter | Hex | string | number | Integer8 | Integer | Float): this;
13
+ set(value: INumeric | ICharacter | Hex | string | number | bigint | Integer8 | Integer | Float): this;
14
14
  clear(): void;
15
- get(): number;
15
+ get(): bigint;
16
16
  }
@@ -8,15 +8,18 @@ const xstring_1 = require("./xstring");
8
8
  const digits = new RegExp(/^\s*-?\+?\d+\.?\d* *$/i);
9
9
  class Integer8 {
10
10
  constructor(input) {
11
- this.value = 0;
12
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
11
+ this.value = 0n;
12
+ this.qualifiedName = input?.qualifiedName;
13
13
  }
14
14
  getQualifiedName() {
15
15
  return this.qualifiedName;
16
16
  }
17
17
  set(value) {
18
18
  if (typeof value === "number") {
19
- this.value = Math.round(value);
19
+ this.value = BigInt(value);
20
+ }
21
+ else if (typeof value === "bigint") {
22
+ this.value = value;
20
23
  }
21
24
  else if (typeof value === "string") {
22
25
  if (value.endsWith("-")) {
@@ -28,7 +31,7 @@ class Integer8 {
28
31
  else if (digits.test(value) === false) {
29
32
  (0, throw_error_1.throwError)("CX_SY_CONVERSION_NO_NUMBER");
30
33
  }
31
- this.value = parseInt(value, 10);
34
+ this.value = BigInt(value);
32
35
  }
33
36
  else if (value instanceof float_1.Float) {
34
37
  this.set(Math.round(value.getRaw()));
@@ -50,7 +53,7 @@ class Integer8 {
50
53
  return this;
51
54
  }
52
55
  clear() {
53
- this.value = 0;
56
+ this.value = 0n;
54
57
  }
55
58
  get() {
56
59
  return this.value;
@@ -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;
@@ -1,6 +1,7 @@
1
1
  import { Hex } from "./hex";
2
2
  import { ICharacter } from "./_character";
3
3
  import { INumeric } from "./_numeric";
4
+ import { Integer8 } from "./integer8";
4
5
  export declare class XString implements ICharacter {
5
6
  private value;
6
7
  private readonly qualifiedName;
@@ -12,7 +13,7 @@ export declare class XString implements ICharacter {
12
13
  clear(): void;
13
14
  get(): string;
14
15
  getOffset(input: {
15
- offset?: number | INumeric | Hex;
16
- length?: number | INumeric | Hex;
16
+ offset?: number | INumeric | Hex | Integer8;
17
+ length?: number | INumeric | Hex | Integer8;
17
18
  }): XString;
18
19
  }
@@ -5,10 +5,11 @@ const _parse_1 = require("../operators/_parse");
5
5
  const float_1 = require("./float");
6
6
  const character_1 = require("./character");
7
7
  const throw_error_1 = require("../throw_error");
8
+ const integer8_1 = require("./integer8");
8
9
  class XString {
9
10
  constructor(input) {
10
11
  this.value = "";
11
- this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
12
+ this.qualifiedName = input?.qualifiedName;
12
13
  }
13
14
  getQualifiedName() {
14
15
  return this.qualifiedName;
@@ -52,13 +53,23 @@ class XString {
52
53
  return this.value;
53
54
  }
54
55
  getOffset(input) {
55
- let offset = input === null || input === void 0 ? void 0 : input.offset;
56
+ let offset = input?.offset;
56
57
  if (offset) {
57
- offset = (0, _parse_1.parse)(offset);
58
+ if (offset instanceof integer8_1.Integer8) {
59
+ offset = Number(offset.get());
60
+ }
61
+ else {
62
+ offset = (0, _parse_1.parse)(offset);
63
+ }
58
64
  }
59
- let length = input === null || input === void 0 ? void 0 : input.length;
65
+ let length = input?.length;
60
66
  if (length) {
61
- length = (0, _parse_1.parse)(length);
67
+ if (length instanceof integer8_1.Integer8) {
68
+ length = Number(length.get());
69
+ }
70
+ else {
71
+ length = (0, _parse_1.parse)(length);
72
+ }
62
73
  }
63
74
  if ((offset && offset * 2 > this.value.length)
64
75
  || (length && length * 2 > this.value.length)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.7.165",
3
+ "version": "2.8.1",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",