@abaplint/runtime 2.0.5 → 2.0.8
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/db/db.d.ts +1 -0
- package/build/src/statements/index.d.ts +2 -1
- package/build/src/statements/replace.js +7 -2
- package/build/src/statements/select.d.ts +2 -1
- package/build/src/statements/select.js +4 -3
- package/build/src/statements/shift.d.ts +1 -0
- package/build/src/statements/shift.js +9 -3
- package/package.json +2 -2
package/build/src/db/db.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ import { ICharacter } from "../types/_character";
|
|
|
36
36
|
import { FieldSymbol, Structure, Table } from "../types";
|
|
37
37
|
import { INumeric } from "../types/_numeric";
|
|
38
38
|
import { ICallFunctionOptions } from "./call_function";
|
|
39
|
+
import { SelectDatabaseOptions } from "../db/db";
|
|
39
40
|
export declare class Statements {
|
|
40
41
|
append: typeof append;
|
|
41
42
|
assert: typeof assert;
|
|
@@ -70,7 +71,7 @@ export declare class Statements {
|
|
|
70
71
|
insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): Promise<number>;
|
|
71
72
|
message(options: IMessageOptions): Promise<void>;
|
|
72
73
|
modifyDatabase(table: string | ICharacter, options: IModifyDatabaseOptions): Promise<void>;
|
|
73
|
-
select(target: Structure | Table | FieldSymbol, select:
|
|
74
|
+
select(target: Structure | Table | FieldSymbol, select: SelectDatabaseOptions): Promise<void>;
|
|
74
75
|
updateDatabase(table: string | ICharacter, options: IUpdateDatabaseOptions): Promise<number>;
|
|
75
76
|
callFunction(options: ICallFunctionOptions): Promise<void>;
|
|
76
77
|
write(source: INumeric | ICharacter | FieldSymbol | string | number, options?: IWriteOptions): void;
|
|
@@ -27,8 +27,13 @@ function replace(input) {
|
|
|
27
27
|
replace = input.with.get();
|
|
28
28
|
}
|
|
29
29
|
if (input.all === true) {
|
|
30
|
-
|
|
31
|
-
temp = temp.replace(
|
|
30
|
+
if (input.regex) {
|
|
31
|
+
temp = temp.replace(new RegExp(input.regex.get(), "g"), replace);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
while (temp.replace(search, replace) !== temp) {
|
|
35
|
+
temp = temp.replace(search, replace);
|
|
36
|
+
}
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
39
|
else {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Context } from "../context";
|
|
2
|
+
import { SelectDatabaseOptions } from "../db/db";
|
|
2
3
|
import { FieldSymbol, Structure, Table } from "../types";
|
|
3
4
|
export declare class SelectDatabase {
|
|
4
5
|
private readonly context;
|
|
5
6
|
constructor(context: Context);
|
|
6
|
-
select(target: Structure | Table | FieldSymbol,
|
|
7
|
+
select(target: Structure | Table | FieldSymbol, input: SelectDatabaseOptions): Promise<void>;
|
|
7
8
|
}
|
|
@@ -7,9 +7,9 @@ class SelectDatabase {
|
|
|
7
7
|
constructor(context) {
|
|
8
8
|
this.context = context;
|
|
9
9
|
}
|
|
10
|
-
async select(target,
|
|
10
|
+
async select(target, input) {
|
|
11
11
|
var _a;
|
|
12
|
-
const { rows: rows } = await this.context.defaultDB().select(
|
|
12
|
+
const { rows: rows } = await this.context.defaultDB().select(input);
|
|
13
13
|
if (target instanceof types_1.FieldSymbol) {
|
|
14
14
|
if (target.isAssigned() === false) {
|
|
15
15
|
throw "select, fs not assigned";
|
|
@@ -33,7 +33,8 @@ class SelectDatabase {
|
|
|
33
33
|
else if (target instanceof types_1.Table) {
|
|
34
34
|
for (const row of rows) {
|
|
35
35
|
const targetRow = (0, clone_1.clone)(target.getRowType());
|
|
36
|
-
for (
|
|
36
|
+
for (let columnName in row) {
|
|
37
|
+
columnName = columnName.toLowerCase();
|
|
37
38
|
// todo, non structured table = table with simple rows
|
|
38
39
|
// @ts-ignore
|
|
39
40
|
(_a = targetRow.get()[columnName]) === null || _a === void 0 ? void 0 : _a.set(row[columnName]);
|
|
@@ -2,6 +2,7 @@ import { ICharacter } from "../types/_character";
|
|
|
2
2
|
import { INumeric } from "../types/_numeric";
|
|
3
3
|
export interface IShiftOptions {
|
|
4
4
|
deletingLeading?: string | ICharacter;
|
|
5
|
+
deletingTrailing?: string | ICharacter;
|
|
5
6
|
places?: INumeric;
|
|
6
7
|
to?: ICharacter | string;
|
|
7
8
|
direction?: "LEFT" | "RIGHT";
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shift = void 0;
|
|
4
4
|
function shift(target, options) {
|
|
5
|
-
if ((options === null || options === void 0 ? void 0 : options.direction) === "RIGHT") {
|
|
6
|
-
throw "SHIFT, RIGHT todo";
|
|
7
|
-
}
|
|
8
5
|
if ((options === null || options === void 0 ? void 0 : options.mode) === "BYTE") {
|
|
9
6
|
shift_byte_mode(target, options);
|
|
10
7
|
}
|
|
@@ -25,6 +22,15 @@ function shift_character_mode(target, options) {
|
|
|
25
22
|
value = value.substr(1);
|
|
26
23
|
}
|
|
27
24
|
}
|
|
25
|
+
else if (options === null || options === void 0 ? void 0 : options.deletingTrailing) {
|
|
26
|
+
let trailing = options.deletingTrailing;
|
|
27
|
+
if (typeof trailing !== "string") {
|
|
28
|
+
trailing = trailing.get();
|
|
29
|
+
}
|
|
30
|
+
if (value.endsWith(trailing)) {
|
|
31
|
+
value = " ".repeat(trailing.length) + value.substring(0, value.length - trailing.length);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
28
34
|
else if (options === null || options === void 0 ? void 0 : options.places) {
|
|
29
35
|
const p = options.places.get();
|
|
30
36
|
if (options.circular) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/runtime",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Transpiler - Runtime",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"author": "abaplint",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@types/chai": "^4.3.
|
|
31
|
+
"@types/chai": "^4.3.1",
|
|
32
32
|
"@types/mocha": "^9.1.0",
|
|
33
33
|
"@types/sql.js": "^1.4.3",
|
|
34
34
|
"chai": "^4.3.6",
|