@abaplint/runtime 2.10.45 → 2.10.47

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 (40) hide show
  1. package/build/src/clone.js +6 -24
  2. package/build/src/types/abap_object.d.ts +1 -0
  3. package/build/src/types/abap_object.js +5 -0
  4. package/build/src/types/character.d.ts +1 -0
  5. package/build/src/types/character.js +6 -0
  6. package/build/src/types/data_reference.d.ts +2 -1
  7. package/build/src/types/data_reference.js +5 -0
  8. package/build/src/types/date.d.ts +1 -0
  9. package/build/src/types/date.js +5 -0
  10. package/build/src/types/decfloat34.d.ts +1 -0
  11. package/build/src/types/decfloat34.js +5 -0
  12. package/build/src/types/field_symbol.d.ts +2 -1
  13. package/build/src/types/field_symbol.js +3 -0
  14. package/build/src/types/float.d.ts +1 -0
  15. package/build/src/types/float.js +5 -0
  16. package/build/src/types/hex.d.ts +1 -0
  17. package/build/src/types/hex.js +5 -0
  18. package/build/src/types/hex_uint8.d.ts +1 -0
  19. package/build/src/types/hex_uint8.js +5 -0
  20. package/build/src/types/integer.d.ts +1 -0
  21. package/build/src/types/integer.js +6 -0
  22. package/build/src/types/integer8.d.ts +1 -0
  23. package/build/src/types/integer8.js +6 -0
  24. package/build/src/types/numc.d.ts +1 -0
  25. package/build/src/types/numc.js +6 -0
  26. package/build/src/types/packed.d.ts +1 -0
  27. package/build/src/types/packed.js +5 -0
  28. package/build/src/types/string.d.ts +1 -0
  29. package/build/src/types/string.js +5 -0
  30. package/build/src/types/structure.d.ts +7 -2
  31. package/build/src/types/structure.js +11 -11
  32. package/build/src/types/table.d.ts +2 -0
  33. package/build/src/types/table.js +11 -0
  34. package/build/src/types/time.d.ts +1 -0
  35. package/build/src/types/time.js +5 -0
  36. package/build/src/types/utc_long.d.ts +1 -0
  37. package/build/src/types/utc_long.js +5 -0
  38. package/build/src/types/xstring.d.ts +1 -0
  39. package/build/src/types/xstring.js +5 -0
  40. package/package.json +1 -1
@@ -1,28 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.clone = clone;
4
- const types_1 = require("./types");
5
4
  function clone(obj) {
6
- if (null == obj || "object" != typeof obj) {
7
- return obj;
8
- }
9
- if (obj instanceof types_1.ABAPObject) {
10
- const n = new types_1.ABAPObject();
11
- n.set(obj.get());
12
- // @ts-ignore
13
- return n;
14
- }
15
- else if (obj instanceof types_1.DataReference) {
16
- const n = new types_1.DataReference(obj.getType());
17
- n.assign(obj.getPointer());
18
- // @ts-ignore
19
- return n;
20
- }
21
- else if (obj instanceof types_1.HexUInt8) {
22
- const n = new types_1.HexUInt8({ length: obj.getLength(), qualifiedName: obj.getQualifiedName() });
23
- n.set(obj.get());
5
+ // @ts-ignore
6
+ return obj.clone();
7
+ // @ts-ignore
8
+ if (obj.clone) {
24
9
  // @ts-ignore
25
- return n;
10
+ return obj.clone();
26
11
  }
27
12
  // @ts-ignore
28
13
  const copy = new obj.constructor();
@@ -30,7 +15,7 @@ function clone(obj) {
30
15
  // @ts-ignore
31
16
  // eslint-disable-next-line no-prototype-builtins
32
17
  if (obj.hasOwnProperty(attr)) {
33
- if ("object" !== typeof obj[attr]) {
18
+ if ("object" !== typeof obj[attr] || obj[attr] === null) {
34
19
  copy[attr] = obj[attr];
35
20
  }
36
21
  else {
@@ -38,9 +23,6 @@ function clone(obj) {
38
23
  }
39
24
  }
40
25
  }
41
- if (copy["constant"]) {
42
- copy["constant"] = false;
43
- }
44
26
  return copy;
45
27
  }
46
28
  //# sourceMappingURL=clone.js.map
@@ -6,6 +6,7 @@ export declare class ABAPObject {
6
6
  qualifiedName?: string;
7
7
  RTTIName?: string;
8
8
  });
9
+ clone(): ABAPObject;
9
10
  get(): any;
10
11
  clear(): void;
11
12
  getQualifiedName(): string | undefined;
@@ -8,6 +8,11 @@ class ABAPObject {
8
8
  this.RTTIName = input?.RTTIName;
9
9
  this.clear();
10
10
  }
11
+ clone() {
12
+ const n = new ABAPObject({ qualifiedName: this.qualifiedName, RTTIName: this.RTTIName });
13
+ n.value = this.value;
14
+ return n;
15
+ }
11
16
  get() {
12
17
  return this.value;
13
18
  }
@@ -11,6 +11,7 @@ export declare class Character implements ICharacter {
11
11
  private readonly length;
12
12
  private readonly extra;
13
13
  constructor(length?: number, extra?: AbstractTypeData);
14
+ clone(): Character;
14
15
  setConstant(): this;
15
16
  set(value: ICharacter | string | Structure | FieldSymbol | Integer): this;
16
17
  getQualifiedName(): string | undefined;
@@ -20,6 +20,12 @@ class Character {
20
20
  this.extra = extra;
21
21
  this.clear();
22
22
  }
23
+ clone() {
24
+ const n = new Character(this.length, this.extra);
25
+ // set without trigger checks and padding
26
+ n.value = this.value;
27
+ return n;
28
+ }
23
29
  setConstant() {
24
30
  this.constant = true;
25
31
  return this;
@@ -12,6 +12,7 @@ export declare class DataReference {
12
12
  private pointer;
13
13
  private readonly type;
14
14
  constructor(type: PointerType);
15
+ clone(): DataReference;
15
16
  getType(): PointerType;
16
17
  assign(pointer: PointerType): void;
17
18
  unassign(): void;
@@ -21,7 +22,7 @@ export declare class DataReference {
21
22
  get(): any;
22
23
  array(): any;
23
24
  getArrayLength(): any;
24
- set(value: any): void | Integer8 | Float | ABAPObject | this | Table | Structure;
25
+ set(value: any): void | Integer8 | Float | Table | ABAPObject | Structure | this;
25
26
  getOffset(input: {
26
27
  offset?: number | INumeric | Hex;
27
28
  length?: number | INumeric | Hex;
@@ -9,6 +9,11 @@ class DataReference {
9
9
  this.pointer = undefined;
10
10
  this.type = type;
11
11
  }
12
+ clone() {
13
+ const n = new DataReference(this.type);
14
+ n.pointer = this.pointer;
15
+ return n;
16
+ }
12
17
  getType() {
13
18
  return this.type;
14
19
  }
@@ -8,6 +8,7 @@ export declare class Date implements ICharacter {
8
8
  constructor(input?: {
9
9
  qualifiedName?: string;
10
10
  });
11
+ clone(): Date;
11
12
  getQualifiedName(): string | undefined;
12
13
  set(value: INumeric | ICharacter | Hex | string | number): this;
13
14
  clear(): void;
@@ -10,6 +10,11 @@ class Date {
10
10
  this.clear();
11
11
  this.qualifiedName = input?.qualifiedName;
12
12
  }
13
+ clone() {
14
+ const n = new Date({ qualifiedName: this.qualifiedName });
15
+ n.value = this.value;
16
+ return n;
17
+ }
13
18
  getQualifiedName() {
14
19
  return this.qualifiedName;
15
20
  }
@@ -4,6 +4,7 @@ import { INumeric } from "./_numeric";
4
4
  export declare class DecFloat34 {
5
5
  private value;
6
6
  constructor();
7
+ clone(): DecFloat34;
7
8
  set(value: INumeric | ICharacter | Hex | string | number): this;
8
9
  clear(): void;
9
10
  getRaw(): number;
@@ -8,6 +8,11 @@ class DecFloat34 {
8
8
  constructor() {
9
9
  this.value = 0;
10
10
  }
11
+ clone() {
12
+ const n = new DecFloat34();
13
+ n.value = this.value;
14
+ return n;
15
+ }
11
16
  set(value) {
12
17
  if (typeof value === "number") {
13
18
  this.value = value;
@@ -11,13 +11,14 @@ export declare class FieldSymbol {
11
11
  private casting;
12
12
  private readonly type;
13
13
  constructor(type?: PointerType);
14
+ clone(): void;
14
15
  getQualifiedName(): any;
15
16
  assign(pointer: PointerType): void;
16
17
  setCasting(): void;
17
18
  unassign(): void;
18
19
  isAssigned(): boolean;
19
20
  getPointer(): any;
20
- dereference(): INumeric | ICharacter | import("./integer8").Integer8 | Float | ABAPObject | Table | Structure | undefined;
21
+ dereference(): INumeric | ICharacter | import("./integer8").Integer8 | Float | Table | ABAPObject | Structure | undefined;
21
22
  clear(): void | Structure | undefined;
22
23
  get(): any;
23
24
  appendInitial(): import("./table").TableRowType | undefined;
@@ -13,6 +13,9 @@ class FieldSymbol {
13
13
  this.casting = false;
14
14
  this.type = type;
15
15
  }
16
+ clone() {
17
+ throw new Error("FieldSymbol cannot be cloned");
18
+ }
16
19
  getQualifiedName() {
17
20
  // @ts-ignore
18
21
  return this.type.getQualifiedName();
@@ -7,6 +7,7 @@ export declare class Float {
7
7
  constructor(input?: {
8
8
  qualifiedName?: string;
9
9
  });
10
+ clone(): Float;
10
11
  getQualifiedName(): string | undefined;
11
12
  set(value: INumeric | ICharacter | Hex | string | number): this;
12
13
  clear(): void;
@@ -24,6 +24,11 @@ class Float {
24
24
  this.value = 0;
25
25
  this.qualifiedName = input?.qualifiedName;
26
26
  }
27
+ clone() {
28
+ const n = new Float({ qualifiedName: this.qualifiedName });
29
+ n.value = this.value;
30
+ return n;
31
+ }
27
32
  getQualifiedName() {
28
33
  return this.qualifiedName;
29
34
  }
@@ -12,6 +12,7 @@ export declare class Hex implements ICharacter {
12
12
  length?: number;
13
13
  qualifiedName?: string;
14
14
  });
15
+ clone(): Hex;
15
16
  getQualifiedName(): string | undefined;
16
17
  set(value: ICharacter | INumeric | string | number | Integer | Integer8 | Float | Hex | XString): Hex;
17
18
  getLength(): number;
@@ -13,6 +13,11 @@ class Hex {
13
13
  this.qualifiedName = input?.qualifiedName;
14
14
  this.clear();
15
15
  }
16
+ clone() {
17
+ const n = new Hex({ length: this.length, qualifiedName: this.qualifiedName });
18
+ n.value = this.value;
19
+ return n;
20
+ }
16
21
  getQualifiedName() {
17
22
  return this.qualifiedName;
18
23
  }
@@ -14,6 +14,7 @@ export declare class HexUInt8 implements ICharacter {
14
14
  qualifiedName?: string;
15
15
  });
16
16
  getQualifiedName(): string | undefined;
17
+ clone(): HexUInt8;
17
18
  setOffset(offset: number, value: number): void;
18
19
  getOffsetRaw(offset: number): number;
19
20
  set(value: ICharacter | INumeric | string | number | Integer | Integer8 | Float | Hex | XString): HexUInt8;
@@ -22,6 +22,11 @@ class HexUInt8 {
22
22
  getQualifiedName() {
23
23
  return this.qualifiedName;
24
24
  }
25
+ clone() {
26
+ const n = new HexUInt8({ length: this.length, qualifiedName: this.qualifiedName });
27
+ n.value = this.value.slice(0);
28
+ return n;
29
+ }
25
30
  setOffset(offset, value) {
26
31
  // caller must validate offset
27
32
  this.value[offset] = value;
@@ -14,6 +14,7 @@ export declare class Integer implements INumeric {
14
14
  qualifiedName?: string;
15
15
  });
16
16
  getQualifiedName(): string | undefined;
17
+ clone(): Integer;
17
18
  setConstant(): this;
18
19
  set(value: INumeric | ICharacter | Hex | string | number | Integer | Float): this;
19
20
  clear(): void;
@@ -37,6 +37,12 @@ class Integer {
37
37
  getQualifiedName() {
38
38
  return this.qualifiedName;
39
39
  }
40
+ clone() {
41
+ const n = new Integer({ qualifiedName: this.qualifiedName });
42
+ // set without trigger checks and padding
43
+ n.value = this.value;
44
+ return n;
45
+ }
40
46
  setConstant() {
41
47
  this.constant = true;
42
48
  return this;
@@ -9,6 +9,7 @@ export declare class Integer8 {
9
9
  constructor(input?: {
10
10
  qualifiedName?: string;
11
11
  });
12
+ clone(): Integer8;
12
13
  getQualifiedName(): string | undefined;
13
14
  set(value: INumeric | ICharacter | Hex | string | number | bigint | Integer8 | Integer | Float): this;
14
15
  clear(): void;
@@ -15,6 +15,12 @@ class Integer8 {
15
15
  this.value = 0n;
16
16
  this.qualifiedName = input?.qualifiedName;
17
17
  }
18
+ clone() {
19
+ const n = new Integer8({ qualifiedName: this.qualifiedName });
20
+ // set without trigger checks and padding
21
+ n.value = this.value;
22
+ return n;
23
+ }
18
24
  getQualifiedName() {
19
25
  return this.qualifiedName;
20
26
  }
@@ -9,6 +9,7 @@ export declare class Numc implements ICharacter {
9
9
  length?: number;
10
10
  qualifiedName?: string;
11
11
  });
12
+ clone(): Numc;
12
13
  getQualifiedName(): string | undefined;
13
14
  set(value: INumeric | ICharacter | Hex | string | number, raw?: boolean): this;
14
15
  getLength(): number;
@@ -10,6 +10,12 @@ class Numc {
10
10
  this.qualifiedName = input?.qualifiedName;
11
11
  this.clear();
12
12
  }
13
+ clone() {
14
+ const n = new Numc({ length: this.length, qualifiedName: this.qualifiedName });
15
+ // set without trigger checks and padding
16
+ n.value = this.value;
17
+ return n;
18
+ }
13
19
  getQualifiedName() {
14
20
  return this.qualifiedName;
15
21
  }
@@ -9,6 +9,7 @@ export declare class Packed implements INumeric {
9
9
  decimals?: number;
10
10
  qualifiedName?: string;
11
11
  });
12
+ clone(): Packed;
12
13
  getQualifiedName(): string | undefined;
13
14
  private round;
14
15
  set(value: INumeric | number | string): this;
@@ -18,6 +18,11 @@ class Packed {
18
18
  }
19
19
  this.qualifiedName = input?.qualifiedName;
20
20
  }
21
+ clone() {
22
+ const n = new Packed({ length: this.length, decimals: this.decimals, qualifiedName: this.qualifiedName });
23
+ n.value = this.value;
24
+ return n;
25
+ }
21
26
  getQualifiedName() {
22
27
  return this.qualifiedName;
23
28
  }
@@ -8,6 +8,7 @@ export declare class String implements ICharacter {
8
8
  constructor(input?: {
9
9
  qualifiedName?: string;
10
10
  });
11
+ clone(): String;
11
12
  getQualifiedName(): string | undefined;
12
13
  set(value: ICharacter | string | number | FieldSymbol): String;
13
14
  clear(): void;
@@ -14,6 +14,11 @@ class String {
14
14
  this.value = "";
15
15
  this.qualifiedName = input?.qualifiedName;
16
16
  }
17
+ clone() {
18
+ const n = new String({ qualifiedName: this.qualifiedName });
19
+ n.value = this.value;
20
+ return n;
21
+ }
17
22
  getQualifiedName() {
18
23
  return this.qualifiedName;
19
24
  }
@@ -10,7 +10,10 @@ export declare class Structure {
10
10
  private readonly ddicName;
11
11
  private readonly suffix;
12
12
  private readonly asInclude;
13
- constructor(fields: any, qualifiedName?: string, ddicName?: string, suffix?: any, asInclude?: any);
13
+ constructor(fields: {
14
+ [key: string]: any;
15
+ }, qualifiedName?: string, ddicName?: string, suffix?: any, asInclude?: any);
16
+ clone(): Structure;
14
17
  clear(): this;
15
18
  getDDICName(): string | undefined;
16
19
  getRenamingSuffix(): {
@@ -22,7 +25,9 @@ export declare class Structure {
22
25
  getQualifiedName(): string | undefined;
23
26
  set(input: Structure | string | INumeric | Table | ICharacter | FieldSymbol | undefined): this | undefined;
24
27
  private setCharacter;
25
- get(): any;
28
+ get(): {
29
+ [key: string]: any;
30
+ };
26
31
  getCharacter(): string;
27
32
  getOffset(input: {
28
33
  offset?: number | INumeric | Hex;
@@ -15,9 +15,19 @@ class Structure {
15
15
  this.suffix = suffix;
16
16
  this.asInclude = asInclude;
17
17
  }
18
+ clone() {
19
+ const newValues = {};
20
+ for (const key in this.value) {
21
+ if (this.value[key] === undefined) {
22
+ throw new Error("Structure, clone: value is undefined, field " + key);
23
+ }
24
+ newValues[key] = this.value[key].clone();
25
+ }
26
+ const n = new Structure(newValues, this.qualifiedName, this.ddicName, this.suffix, this.asInclude);
27
+ return n;
28
+ }
18
29
  clear() {
19
30
  for (const f in this.value) {
20
- // @ts-ignore
21
31
  this.value[f].clear();
22
32
  }
23
33
  return this;
@@ -48,21 +58,11 @@ class Structure {
48
58
  const obj = input.get();
49
59
  const keys1 = Object.keys(obj);
50
60
  const keys2 = Object.keys(this.value);
51
- /*
52
- console.dir(keys1);
53
- console.dir(keys2);
54
- */
55
61
  for (let i = 0; i < keys1.length; i++) {
56
62
  const key1 = keys1[i];
57
63
  const key2 = keys2[i];
58
64
  this.value[key2].set((0, clone_1.clone)(obj[key1]));
59
65
  }
60
- /*
61
- for (const f in obj) {
62
- // @ts-ignore
63
- this.value[f].set(clone(obj[f]));
64
- }
65
- */
66
66
  }
67
67
  else {
68
68
  this.setCharacter(input);
@@ -55,6 +55,7 @@ export declare class HashedTable implements ITable {
55
55
  private readonly isStructured;
56
56
  private secondaryIndexes;
57
57
  constructor(rowType: TableRowType, options: ITableOptions, qualifiedName?: string);
58
+ clone(): void;
58
59
  getArrayLength(): number;
59
60
  getKeyByName(name: string): ITableKey | undefined;
60
61
  getSecondaryIndex(name: string): any[];
@@ -92,6 +93,7 @@ export declare class Table implements ITable {
92
93
  private readonly isStructured;
93
94
  private secondaryIndexes;
94
95
  constructor(rowType: TableRowType, options: ITableOptions, qualifiedName?: string);
96
+ clone(): Table;
95
97
  getArrayLength(): number;
96
98
  getKeyByName(name: string): ITableKey | undefined;
97
99
  getSecondaryIndex(name: string): TableRowType[];
@@ -77,6 +77,9 @@ class HashedTable {
77
77
  }
78
78
  this.qualifiedName = qualifiedName?.toUpperCase();
79
79
  }
80
+ clone() {
81
+ throw new Error("HashedTable, clone not implemented");
82
+ }
80
83
  getArrayLength() {
81
84
  return Object.keys(this.value).length;
82
85
  }
@@ -302,6 +305,14 @@ class Table {
302
305
  }
303
306
  this.qualifiedName = qualifiedName?.toUpperCase();
304
307
  }
308
+ clone() {
309
+ const copy = new Table(this.rowType, this.options, this.qualifiedName);
310
+ for (const val of this.value) {
311
+ // @ts-ignore
312
+ copy.value.push(val.clone());
313
+ }
314
+ return copy;
315
+ }
305
316
  getArrayLength() {
306
317
  return this.value.length;
307
318
  }
@@ -8,6 +8,7 @@ export declare class Time implements ICharacter {
8
8
  constructor(input?: {
9
9
  qualifiedName?: string;
10
10
  });
11
+ clone(): Time;
11
12
  getQualifiedName(): string | undefined;
12
13
  set(value: INumeric | ICharacter | Hex | string | number): this;
13
14
  clear(): void;
@@ -9,6 +9,11 @@ class Time {
9
9
  this.clear();
10
10
  this.qualifiedName = input?.qualifiedName;
11
11
  }
12
+ clone() {
13
+ const n = new Time({ qualifiedName: this.qualifiedName });
14
+ n.value = this.value;
15
+ return n;
16
+ }
12
17
  getQualifiedName() {
13
18
  return this.qualifiedName;
14
19
  }
@@ -7,6 +7,7 @@ export declare class UTCLong implements ICharacter {
7
7
  constructor(input?: {
8
8
  qualifiedName?: string;
9
9
  });
10
+ clone(): UTCLong;
10
11
  getQualifiedName(): string | undefined;
11
12
  getOffset(_input: {
12
13
  offset?: number | undefined;
@@ -6,6 +6,11 @@ class UTCLong {
6
6
  this.clear();
7
7
  this.qualifiedName = input?.qualifiedName;
8
8
  }
9
+ clone() {
10
+ const n = new UTCLong({ qualifiedName: this.qualifiedName });
11
+ n.value = this.value;
12
+ return n;
13
+ }
9
14
  getQualifiedName() {
10
15
  return this.qualifiedName;
11
16
  }
@@ -8,6 +8,7 @@ export declare class XString implements ICharacter {
8
8
  constructor(input?: {
9
9
  qualifiedName?: string;
10
10
  });
11
+ clone(): XString;
11
12
  getQualifiedName(): string | undefined;
12
13
  set(value: ICharacter | INumeric | string | number): this;
13
14
  clear(): void;
@@ -11,6 +11,11 @@ class XString {
11
11
  this.value = "";
12
12
  this.qualifiedName = input?.qualifiedName;
13
13
  }
14
+ clone() {
15
+ const n = new XString({ qualifiedName: this.qualifiedName });
16
+ n.value = this.value;
17
+ return n;
18
+ }
14
19
  getQualifiedName() {
15
20
  return this.qualifiedName;
16
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.10.45",
3
+ "version": "2.10.47",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",