@abaplint/runtime 2.10.47 → 2.10.49
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.
- package/build/src/character_factory.d.ts +5 -0
- package/build/src/character_factory.js +15 -0
- package/build/src/index.d.ts +3 -1
- package/build/src/index.js +3 -1
- package/build/src/integer_factory.d.ts +1 -1
- package/build/src/integer_factory.js +4 -4
- package/build/src/statements/index.d.ts +0 -2
- package/build/src/statements/index.js +0 -2
- package/build/src/statements/insert_internal.js +1 -1
- package/build/src/statements/read_table.js +4 -3
- package/build/src/types/_character.d.ts +1 -0
- package/build/src/types/_numeric.d.ts +1 -0
- package/build/src/types/data_reference.js +1 -4
- package/build/src/types/integer.js +13 -2
- package/build/src/types/table.d.ts +1 -1
- package/build/src/types/table.js +7 -2
- package/package.json +1 -1
- package/build/src/statements/clear.d.ts +0 -4
- package/build/src/statements/clear.js +0 -7
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CharacterFactory = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
class CharacterFactory {
|
|
6
|
+
static get(length, value) {
|
|
7
|
+
if (CharacterFactory.map[value] === undefined) {
|
|
8
|
+
CharacterFactory.map[value] = new types_1.Character(length).set(value).setConstant();
|
|
9
|
+
}
|
|
10
|
+
return CharacterFactory.map[value];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.CharacterFactory = CharacterFactory;
|
|
14
|
+
CharacterFactory.map = {};
|
|
15
|
+
//# sourceMappingURL=character_factory.js.map
|
package/build/src/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { MemoryConsole } from "./console/memory_console";
|
|
|
16
16
|
import { buildDbTableName } from "./prefix";
|
|
17
17
|
import { IntegerFactory } from "./integer_factory";
|
|
18
18
|
import { dynamicCallLookup } from "./dynamic_call_lookup";
|
|
19
|
+
import { CharacterFactory } from "./character_factory";
|
|
19
20
|
export { RFC, types, DB, MemoryConsole };
|
|
20
21
|
export type RuntimeDatabaseOptions = {
|
|
21
22
|
schemaPrefix?: string;
|
|
@@ -66,8 +67,9 @@ export declare class ABAP {
|
|
|
66
67
|
expandDynamic: typeof expandDynamic;
|
|
67
68
|
buildDbTableName: typeof buildDbTableName;
|
|
68
69
|
ClassicError: typeof ClassicError;
|
|
69
|
-
IntegerFactory: typeof IntegerFactory;
|
|
70
70
|
dynamicCallLookup: typeof dynamicCallLookup;
|
|
71
|
+
IntegerFactory: typeof IntegerFactory;
|
|
72
|
+
CharacterFactory: typeof CharacterFactory;
|
|
71
73
|
readonly context: Context;
|
|
72
74
|
readonly dbo: RuntimeDatabaseOptions;
|
|
73
75
|
constructor(input?: RuntimeOptions);
|
package/build/src/index.js
CHANGED
|
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "MemoryConsole", { enumerable: true, get: functio
|
|
|
23
23
|
const prefix_1 = require("./prefix");
|
|
24
24
|
const integer_factory_1 = require("./integer_factory");
|
|
25
25
|
const dynamic_call_lookup_1 = require("./dynamic_call_lookup");
|
|
26
|
+
const character_factory_1 = require("./character_factory");
|
|
26
27
|
class ABAP {
|
|
27
28
|
constructor(input) {
|
|
28
29
|
// global objects
|
|
@@ -46,8 +47,9 @@ class ABAP {
|
|
|
46
47
|
this.expandDynamic = expand_dynamic_1.expandDynamic;
|
|
47
48
|
this.buildDbTableName = prefix_1.buildDbTableName;
|
|
48
49
|
this.ClassicError = classic_error_1.ClassicError;
|
|
49
|
-
this.IntegerFactory = integer_factory_1.IntegerFactory;
|
|
50
50
|
this.dynamicCallLookup = dynamic_call_lookup_1.dynamicCallLookup;
|
|
51
|
+
this.IntegerFactory = integer_factory_1.IntegerFactory;
|
|
52
|
+
this.CharacterFactory = character_factory_1.CharacterFactory;
|
|
51
53
|
this.context = new context_1.Context();
|
|
52
54
|
this.console = input?.console ? input?.console : new standard_out_console_1.StandardOutConsole();
|
|
53
55
|
this.context.console = this.console;
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IntegerFactory = void 0;
|
|
4
4
|
const types_1 = require("./types");
|
|
5
5
|
class IntegerFactory {
|
|
6
|
-
static get(
|
|
7
|
-
if (IntegerFactory.map[
|
|
8
|
-
IntegerFactory.map[
|
|
6
|
+
static get(value) {
|
|
7
|
+
if (IntegerFactory.map[value] === undefined) {
|
|
8
|
+
IntegerFactory.map[value] = new types_1.Integer().set(value).setConstant();
|
|
9
9
|
}
|
|
10
|
-
return IntegerFactory.map[
|
|
10
|
+
return IntegerFactory.map[value];
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.IntegerFactory = IntegerFactory;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { append } from "./append";
|
|
2
2
|
import { assert } from "./assert";
|
|
3
3
|
import { assign } from "./assign";
|
|
4
|
-
import { clear } from "./clear";
|
|
5
4
|
import { commit } from "./commit";
|
|
6
5
|
import { concatenate } from "./concatenate";
|
|
7
6
|
import { condense } from "./condense";
|
|
@@ -56,7 +55,6 @@ export declare class Statements {
|
|
|
56
55
|
assert: typeof assert;
|
|
57
56
|
assign: typeof assign;
|
|
58
57
|
cast: typeof cast;
|
|
59
|
-
clear: typeof clear;
|
|
60
58
|
collect: typeof collect;
|
|
61
59
|
commit: typeof commit;
|
|
62
60
|
concatenate: typeof concatenate;
|
|
@@ -4,7 +4,6 @@ exports.Statements = void 0;
|
|
|
4
4
|
const append_1 = require("./append");
|
|
5
5
|
const assert_1 = require("./assert");
|
|
6
6
|
const assign_1 = require("./assign");
|
|
7
|
-
const clear_1 = require("./clear");
|
|
8
7
|
const commit_1 = require("./commit");
|
|
9
8
|
const concatenate_1 = require("./concatenate");
|
|
10
9
|
const condense_1 = require("./condense");
|
|
@@ -61,7 +60,6 @@ class Statements {
|
|
|
61
60
|
this.assert = assert_1.assert;
|
|
62
61
|
this.assign = assign_1.assign;
|
|
63
62
|
this.cast = cast_1.cast;
|
|
64
|
-
this.clear = clear_1.clear;
|
|
65
63
|
this.collect = collect_1.collect;
|
|
66
64
|
this.commit = commit_1.commit;
|
|
67
65
|
this.concatenate = concatenate_1.concatenate;
|
|
@@ -13,7 +13,7 @@ function insertInternal(options) {
|
|
|
13
13
|
}
|
|
14
14
|
options.table = options.table.getPointer();
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
if (options.data instanceof types_1.FieldSymbol) {
|
|
17
17
|
if (options.data.getPointer() === undefined) {
|
|
18
18
|
throw new Error("GETWA_NOT_ASSIGNED");
|
|
19
19
|
}
|
|
@@ -73,7 +73,8 @@ function readTable(table, options) {
|
|
|
73
73
|
if (table.getPointer() === undefined) {
|
|
74
74
|
throw new Error("GETWA_NOT_ASSIGNED");
|
|
75
75
|
}
|
|
76
|
-
return readTable(table.getPointer(), options);
|
|
76
|
+
// return readTable(table.getPointer(), options);
|
|
77
|
+
table = table.getPointer();
|
|
77
78
|
}
|
|
78
79
|
// check if it is a primary index read specified with WITH KEY instead of WITH TABLE KEY
|
|
79
80
|
if (options?.withTableKey === undefined
|
|
@@ -257,8 +258,8 @@ function readTable(table, options) {
|
|
|
257
258
|
if (binarySubrc) {
|
|
258
259
|
subrc = binarySubrc;
|
|
259
260
|
}
|
|
260
|
-
else if (
|
|
261
|
-
&&
|
|
261
|
+
else if (subrc === 4
|
|
262
|
+
&& (options?.binarySearch === true || options?.keyName !== undefined)) {
|
|
262
263
|
subrc = 8;
|
|
263
264
|
}
|
|
264
265
|
// @ts-ignore
|
|
@@ -8,6 +8,8 @@ const hex_1 = require("./hex");
|
|
|
8
8
|
const xstring_1 = require("./xstring");
|
|
9
9
|
const integer8_1 = require("./integer8");
|
|
10
10
|
const hex_uint8_1 = require("./hex_uint8");
|
|
11
|
+
const character_1 = require("./character");
|
|
12
|
+
const string_1 = require("./string");
|
|
11
13
|
exports.DIGITS = new RegExp(/^\s*-?\+?\d+\.?\d* *$/i);
|
|
12
14
|
exports.MAX_INTEGER = 2147483647;
|
|
13
15
|
exports.MIN_INTEGER = -2147483648;
|
|
@@ -54,8 +56,14 @@ class Integer {
|
|
|
54
56
|
if (typeof value === "number") {
|
|
55
57
|
this.value = Math.round(value);
|
|
56
58
|
}
|
|
57
|
-
else if (
|
|
58
|
-
this.value
|
|
59
|
+
else if (value instanceof Integer) {
|
|
60
|
+
this.set(value.get());
|
|
61
|
+
}
|
|
62
|
+
else if (value instanceof character_1.Character) {
|
|
63
|
+
this.value = toInteger(value.get());
|
|
64
|
+
}
|
|
65
|
+
else if (value instanceof string_1.String) {
|
|
66
|
+
this.value = toInteger(value.get());
|
|
59
67
|
}
|
|
60
68
|
else if (value instanceof integer8_1.Integer8) {
|
|
61
69
|
this.set(Number(value.get()));
|
|
@@ -75,6 +83,9 @@ class Integer {
|
|
|
75
83
|
}
|
|
76
84
|
this.set(num);
|
|
77
85
|
}
|
|
86
|
+
else if (typeof value === "string") {
|
|
87
|
+
this.value = toInteger(value);
|
|
88
|
+
}
|
|
78
89
|
else {
|
|
79
90
|
this.set(value.get());
|
|
80
91
|
}
|
|
@@ -55,7 +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():
|
|
58
|
+
clone(): HashedTable;
|
|
59
59
|
getArrayLength(): number;
|
|
60
60
|
getKeyByName(name: string): ITableKey | undefined;
|
|
61
61
|
getSecondaryIndex(name: string): any[];
|
package/build/src/types/table.js
CHANGED
|
@@ -78,7 +78,11 @@ class HashedTable {
|
|
|
78
78
|
this.qualifiedName = qualifiedName?.toUpperCase();
|
|
79
79
|
}
|
|
80
80
|
clone() {
|
|
81
|
-
|
|
81
|
+
const copy = new HashedTable(this.rowType, this.options, this.qualifiedName);
|
|
82
|
+
for (const hash in this.value) {
|
|
83
|
+
copy.value[hash] = this.value[hash].clone();
|
|
84
|
+
}
|
|
85
|
+
return copy;
|
|
82
86
|
}
|
|
83
87
|
getArrayLength() {
|
|
84
88
|
return Object.keys(this.value).length;
|
|
@@ -143,6 +147,7 @@ class HashedTable {
|
|
|
143
147
|
buildHashFromSimple(data) {
|
|
144
148
|
let hash = "";
|
|
145
149
|
const tableRowType = this.getRowType();
|
|
150
|
+
const isStructured = tableRowType instanceof structure_1.Structure;
|
|
146
151
|
for (const k of this.options.primaryKey.keyFields) {
|
|
147
152
|
let val = data[k.toLowerCase()];
|
|
148
153
|
// convert to correct type, eg Chars have specific length, or rounding,
|
|
@@ -151,7 +156,7 @@ class HashedTable {
|
|
|
151
156
|
row.set(val.get());
|
|
152
157
|
val = row.get();
|
|
153
158
|
}
|
|
154
|
-
else if (
|
|
159
|
+
else if (isStructured === true) {
|
|
155
160
|
const field = tableRowType.get()[k.toLowerCase()];
|
|
156
161
|
// if types match, there is no need to clone
|
|
157
162
|
if (field instanceof string_1.String && val instanceof string_1.String) {
|
package/package.json
CHANGED