@abaplint/runtime 2.0.9 → 2.0.12
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/README.md +2 -2
- package/build/src/builtin/substring_after.d.ts +2 -1
- package/build/src/builtin/substring_after.js +14 -2
- package/build/src/db/db.d.ts +2 -0
- package/build/src/statements/cast.d.ts +2 -0
- package/build/src/statements/cast.js +36 -0
- package/build/src/statements/index.d.ts +2 -0
- package/build/src/statements/index.js +2 -0
- package/build/src/statements/select.js +2 -0
- package/build/src/types/abap_object.d.ts +5 -1
- package/build/src/types/abap_object.js +6 -2
- package/package.json +39 -39
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# @abaplint/runtime
|
|
2
|
-
|
|
1
|
+
# @abaplint/runtime
|
|
2
|
+
|
|
3
3
|
Runtime
|
|
@@ -4,8 +4,20 @@ exports.substring_after = void 0;
|
|
|
4
4
|
const string_1 = require("../types/string");
|
|
5
5
|
function substring_after(input) {
|
|
6
6
|
const val = typeof input.val === "string" ? input.val : input.val.get();
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
let reg = "";
|
|
8
|
+
if (typeof input.regex === "string") {
|
|
9
|
+
reg = input.regex;
|
|
10
|
+
}
|
|
11
|
+
else if (input === null || input === void 0 ? void 0 : input.regex) {
|
|
12
|
+
reg = input.regex.get();
|
|
13
|
+
}
|
|
14
|
+
else if (typeof input.sub === "string") {
|
|
15
|
+
reg = input.sub;
|
|
16
|
+
}
|
|
17
|
+
else if (input === null || input === void 0 ? void 0 : input.sub) {
|
|
18
|
+
reg = input.sub.get();
|
|
19
|
+
}
|
|
20
|
+
const r = new RegExp(reg + "(.*)");
|
|
9
21
|
const res = val.match(r);
|
|
10
22
|
let ret = "";
|
|
11
23
|
if (res && res[1]) {
|
package/build/src/db/db.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface InsertDatabaseOptions {
|
|
|
15
15
|
export interface SelectDatabaseOptions {
|
|
16
16
|
/** select statement, in ABAP SQL syntax */
|
|
17
17
|
select: string;
|
|
18
|
+
/** list of primary key fields, in lower case, if known */
|
|
19
|
+
primaryKey?: string[];
|
|
18
20
|
}
|
|
19
21
|
export declare type DatabaseValue = number | string | Uint8Array | null;
|
|
20
22
|
export declare type DatabaseRow = {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cast = void 0;
|
|
4
|
+
const compare_1 = require("../compare");
|
|
5
|
+
// todo, field symbols as input?
|
|
6
|
+
// todo, local classes?
|
|
7
|
+
async function cast(target, source) {
|
|
8
|
+
var _a;
|
|
9
|
+
if ((0, compare_1.initial)(source)) {
|
|
10
|
+
target.clear();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const targetName = (_a = target.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
14
|
+
if ((targetName === null || targetName === void 0 ? void 0 : targetName.startsWith("IF_")) === false
|
|
15
|
+
&& (targetName === null || targetName === void 0 ? void 0 : targetName.startsWith("ZIF_")) === false) { // todo, interfaces are also classes but not inherited
|
|
16
|
+
// using "instanceof" is probably wrong in some cases,
|
|
17
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
if (abap.Classes[targetName] && source instanceof abap.Classes[targetName] === false) {
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
if (abap.Classes["CX_SY_MOVE_CAST_ERROR"] !== undefined) {
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
throw new abap.Classes["CX_SY_MOVE_CAST_ERROR"]();
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
throw "Global class CX_SY_MOVE_CAST_ERROR not found";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// throw cx_sy_move_cast_error if incompatible
|
|
31
|
+
// check with javascript instanceof?
|
|
32
|
+
// handling interfaces?
|
|
33
|
+
target.set(source);
|
|
34
|
+
}
|
|
35
|
+
exports.cast = cast;
|
|
36
|
+
//# sourceMappingURL=cast.js.map
|
|
@@ -10,6 +10,7 @@ import { createData } from "./create_data";
|
|
|
10
10
|
import { deleteInternal } from "./delete_internal";
|
|
11
11
|
import { describe } from "./describe";
|
|
12
12
|
import { find } from "./find";
|
|
13
|
+
import { cast } from "./cast";
|
|
13
14
|
import { getBit } from "./get_bit";
|
|
14
15
|
import { getRunTime } from "./get_run_time";
|
|
15
16
|
import { getTime } from "./get_time";
|
|
@@ -41,6 +42,7 @@ export declare class Statements {
|
|
|
41
42
|
append: typeof append;
|
|
42
43
|
assert: typeof assert;
|
|
43
44
|
assign: typeof assign;
|
|
45
|
+
cast: typeof cast;
|
|
44
46
|
clear: typeof clear;
|
|
45
47
|
commit: typeof commit;
|
|
46
48
|
concatenate: typeof concatenate;
|
|
@@ -13,6 +13,7 @@ const create_data_1 = require("./create_data");
|
|
|
13
13
|
const delete_internal_1 = require("./delete_internal");
|
|
14
14
|
const describe_1 = require("./describe");
|
|
15
15
|
const find_1 = require("./find");
|
|
16
|
+
const cast_1 = require("./cast");
|
|
16
17
|
const get_bit_1 = require("./get_bit");
|
|
17
18
|
const get_run_time_1 = require("./get_run_time");
|
|
18
19
|
const get_time_1 = require("./get_time");
|
|
@@ -43,6 +44,7 @@ class Statements {
|
|
|
43
44
|
this.append = append_1.append;
|
|
44
45
|
this.assert = assert_1.assert;
|
|
45
46
|
this.assign = assign_1.assign;
|
|
47
|
+
this.cast = cast_1.cast;
|
|
46
48
|
this.clear = clear_1.clear;
|
|
47
49
|
this.commit = commit_1.commit;
|
|
48
50
|
this.concatenate = concatenate_1.concatenate;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export declare class ABAPObject {
|
|
2
2
|
private value;
|
|
3
|
-
|
|
3
|
+
private readonly qualifiedName;
|
|
4
|
+
constructor(input?: {
|
|
5
|
+
qualifiedName?: string;
|
|
6
|
+
});
|
|
4
7
|
get(): any;
|
|
5
8
|
clear(): void;
|
|
9
|
+
getQualifiedName(): string | undefined;
|
|
6
10
|
set(value: ABAPObject | any): void;
|
|
7
11
|
}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ABAPObject = void 0;
|
|
4
4
|
class ABAPObject {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.
|
|
5
|
+
constructor(input) {
|
|
6
|
+
this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
|
|
7
|
+
this.clear();
|
|
7
8
|
}
|
|
8
9
|
get() {
|
|
9
10
|
return this.value;
|
|
@@ -11,6 +12,9 @@ class ABAPObject {
|
|
|
11
12
|
clear() {
|
|
12
13
|
this.value = undefined;
|
|
13
14
|
}
|
|
15
|
+
getQualifiedName() {
|
|
16
|
+
return this.qualifiedName;
|
|
17
|
+
}
|
|
14
18
|
set(value) {
|
|
15
19
|
if (value instanceof ABAPObject) {
|
|
16
20
|
this.value = value.get();
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@abaplint/runtime",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "Transpiler - Runtime",
|
|
5
|
-
"main": "build/src/index.js",
|
|
6
|
-
"typings": "build/src/index.d.ts",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/abaplint/transpiler.git"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"compile": "tsc",
|
|
13
|
-
"publish:major": "npm --no-git-tag-version version major && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
14
|
-
"publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
15
|
-
"publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
16
|
-
"test": "npm run compile && mocha"
|
|
17
|
-
},
|
|
18
|
-
"mocha": {
|
|
19
|
-
"recursive": true,
|
|
20
|
-
"reporter": "progress",
|
|
21
|
-
"spec": "build/test/**/*.js",
|
|
22
|
-
"require": "source-map-support/register"
|
|
23
|
-
},
|
|
24
|
-
"keywords": [
|
|
25
|
-
"ABAP",
|
|
26
|
-
"abaplint"
|
|
27
|
-
],
|
|
28
|
-
"author": "abaplint",
|
|
29
|
-
"license": "MIT",
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/chai": "^4.3.1",
|
|
32
|
-
"@types/mocha": "^9.1.
|
|
33
|
-
"@types/sql.js": "^1.4.3",
|
|
34
|
-
"chai": "^4.3.6",
|
|
35
|
-
"mocha": "^9.2.2",
|
|
36
|
-
"source-map-support": "^0.5.21",
|
|
37
|
-
"typescript": "^4.6.3"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@abaplint/runtime",
|
|
3
|
+
"version": "2.0.12",
|
|
4
|
+
"description": "Transpiler - Runtime",
|
|
5
|
+
"main": "build/src/index.js",
|
|
6
|
+
"typings": "build/src/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/abaplint/transpiler.git"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"compile": "tsc",
|
|
13
|
+
"publish:major": "npm --no-git-tag-version version major && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
14
|
+
"publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
15
|
+
"publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
16
|
+
"test": "npm run compile && mocha"
|
|
17
|
+
},
|
|
18
|
+
"mocha": {
|
|
19
|
+
"recursive": true,
|
|
20
|
+
"reporter": "progress",
|
|
21
|
+
"spec": "build/test/**/*.js",
|
|
22
|
+
"require": "source-map-support/register"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"ABAP",
|
|
26
|
+
"abaplint"
|
|
27
|
+
],
|
|
28
|
+
"author": "abaplint",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/chai": "^4.3.1",
|
|
32
|
+
"@types/mocha": "^9.1.1",
|
|
33
|
+
"@types/sql.js": "^1.4.3",
|
|
34
|
+
"chai": "^4.3.6",
|
|
35
|
+
"mocha": "^9.2.2",
|
|
36
|
+
"source-map-support": "^0.5.21",
|
|
37
|
+
"typescript": "^4.6.3"
|
|
38
|
+
}
|
|
39
|
+
}
|