@abaplint/runtime 2.13.84 → 2.13.86
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.
|
@@ -153,7 +153,11 @@ function createData(target, options) {
|
|
|
153
153
|
target.assign(new types_1.DecFloat34());
|
|
154
154
|
break;
|
|
155
155
|
default:
|
|
156
|
-
if (abap.DDIC[options.typeName.trimEnd()]) {
|
|
156
|
+
if (abap.DDIC[options.typeName.trimEnd()] && options.table) {
|
|
157
|
+
// static "TYPE STANDARD TABLE OF <ddic>", same as the dynamic name variant above
|
|
158
|
+
target.assign(new abap.types.Table(abap.DDIC[options.typeName.trimEnd()].type(), tableOptions));
|
|
159
|
+
}
|
|
160
|
+
else if (abap.DDIC[options.typeName.trimEnd()]) {
|
|
157
161
|
target.assign(abap.DDIC[options.typeName.trimEnd()].type().clone());
|
|
158
162
|
}
|
|
159
163
|
else if (options.typeName.includes("=>")) {
|
|
@@ -37,7 +37,7 @@ import { IRollbackOptions } from "./rollback";
|
|
|
37
37
|
import { setBit } from "./set_bit";
|
|
38
38
|
import { shift } from "./shift";
|
|
39
39
|
import { sort } from "./sort";
|
|
40
|
-
import {
|
|
40
|
+
import { IWaitOptions } from "./wait";
|
|
41
41
|
import { IOpenCursorDatabaseOptions } from "./open_cursor";
|
|
42
42
|
import { setHandler } from "./set_handler";
|
|
43
43
|
import { split } from "./split";
|
|
@@ -88,7 +88,6 @@ export declare class Statements {
|
|
|
88
88
|
sort: typeof sort;
|
|
89
89
|
split: typeof split;
|
|
90
90
|
translate: typeof translate;
|
|
91
|
-
wait: typeof wait;
|
|
92
91
|
receive: typeof receive;
|
|
93
92
|
callTransaction: typeof callTransaction;
|
|
94
93
|
private readonly context;
|
|
@@ -99,6 +98,7 @@ export declare class Statements {
|
|
|
99
98
|
closeCursor(cursor: INumeric): Promise<void>;
|
|
100
99
|
commit(options?: ICommitOptions): Promise<void>;
|
|
101
100
|
rollback(options?: IRollbackOptions): Promise<void>;
|
|
101
|
+
wait(options: IWaitOptions): Promise<void>;
|
|
102
102
|
deleteDatabase(table: string | ICharacter, options: IDeleteDatabaseOptions): Promise<void>;
|
|
103
103
|
insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): Promise<number | undefined>;
|
|
104
104
|
modifyDatabase(table: string | ICharacter, options: IModifyDatabaseOptions): Promise<void>;
|
|
@@ -91,7 +91,6 @@ class Statements {
|
|
|
91
91
|
sort = sort_1.sort;
|
|
92
92
|
split = split_1.split;
|
|
93
93
|
translate = translate_1.translate;
|
|
94
|
-
wait = wait_1.wait;
|
|
95
94
|
receive = receive_1.receive;
|
|
96
95
|
callTransaction = call_transaction_1.callTransaction;
|
|
97
96
|
context;
|
|
@@ -117,6 +116,9 @@ class Statements {
|
|
|
117
116
|
async rollback(options) {
|
|
118
117
|
return (0, rollback_1.rollback)(this.context, options);
|
|
119
118
|
}
|
|
119
|
+
async wait(options) {
|
|
120
|
+
return (0, wait_1.wait)(this.context, options);
|
|
121
|
+
}
|
|
120
122
|
async deleteDatabase(table, options) {
|
|
121
123
|
await (0, delete_database_1.deleteDatabase)(table, options, this.context);
|
|
122
124
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { INumeric } from "../types/_numeric";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { Context } from "../context";
|
|
3
|
+
export interface IWaitOptions {
|
|
4
|
+
/** UNTIL, the logical expression, if not supplied its the simple "WAIT UP TO" variant */
|
|
5
|
+
cond?: () => any;
|
|
6
|
+
/** UP TO sec SECONDS */
|
|
4
7
|
seconds?: INumeric;
|
|
5
|
-
}
|
|
8
|
+
}
|
|
9
|
+
export declare function wait(context: Context, options: IWaitOptions): Promise<void>;
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.wait = wait;
|
|
4
|
-
|
|
4
|
+
// WAIT ends the current database LUW when it interrupts the execution of the program,
|
|
5
|
+
// ie. all open database connections are committed, note that this is not a full COMMIT WORK,
|
|
6
|
+
// sy-subrc is owned by the WAIT statement itself
|
|
7
|
+
async function implicitCommit(context) {
|
|
8
|
+
for (const name of Object.keys(context.databaseConnections)) {
|
|
9
|
+
await context.databaseConnections[name].commit();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
async function wait(context, options) {
|
|
5
13
|
const timeout = options.seconds === undefined ? undefined : options.seconds.get() * 1000;
|
|
6
14
|
const deadline = timeout === undefined ? undefined : Date.now() + timeout;
|
|
15
|
+
if (options.cond === undefined) {
|
|
16
|
+
// "WAIT UP TO sec SECONDS", the execution is always interrupted and sy-subrc is always zero
|
|
17
|
+
await implicitCommit(context);
|
|
18
|
+
await new Promise(r => setTimeout(r, timeout));
|
|
19
|
+
abap.builtin.sy.get().subrc.set(0);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let interrupted = false;
|
|
7
23
|
while (true) {
|
|
8
24
|
if (options.cond() === true) {
|
|
9
25
|
abap.builtin.sy.get().subrc.set(0);
|
|
@@ -14,6 +30,12 @@ async function wait(options) {
|
|
|
14
30
|
abap.builtin.sy.get().subrc.set(8);
|
|
15
31
|
return;
|
|
16
32
|
}
|
|
33
|
+
if (interrupted === false) {
|
|
34
|
+
// the condition is not true, so the execution is about to be interrupted,
|
|
35
|
+
// commit before sleeping so the changes are visible to other sessions during the wait
|
|
36
|
+
interrupted = true;
|
|
37
|
+
await implicitCommit(context);
|
|
38
|
+
}
|
|
17
39
|
await new Promise(r => setTimeout(r, Math.min(500, remaining)));
|
|
18
40
|
}
|
|
19
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/runtime",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.86",
|
|
4
4
|
"description": "Transpiler - Runtime",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/mocha": "^10.0.10",
|
|
34
34
|
"@types/node": "^26.4.1",
|
|
35
35
|
"chai": "^6.2.2",
|
|
36
|
-
"mocha": "^12.0.
|
|
36
|
+
"mocha": "^12.0.1",
|
|
37
37
|
"source-map-support": "^0.5.21",
|
|
38
38
|
"typescript": "^6.0.3"
|
|
39
39
|
},
|