@abaplint/runtime 2.0.0 → 2.0.1

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.
@@ -20,6 +20,7 @@ exports.sy = new types_1.Structure({
20
20
  subrc: new types_1.Integer(),
21
21
  sysid: new types_1.Character({ length: 3 }).set("ABC"),
22
22
  tabix: new types_1.Integer(),
23
+ tzone: new types_1.Integer(),
23
24
  timlo: new types_1.Time(),
24
25
  uname: new types_1.Character({ length: 12 }).set("USERNAME"),
25
26
  uzeit: new types_1.Time(),
@@ -30,6 +30,9 @@ export interface DatabaseClient {
30
30
  disconnect(): Promise<void>;
31
31
  /*** execute any native SQL command */
32
32
  execute(sql: string): Promise<void>;
33
+ beginTransaction(): Promise<void>;
34
+ commit(): Promise<void>;
35
+ rollback(): Promise<void>;
33
36
  delete(options: DeleteDatabaseOptions): Promise<{
34
37
  subrc: number;
35
38
  dbcnt: number;
@@ -39,6 +39,7 @@ class ABAP {
39
39
  builtin.sy.get().subrc.set(0);
40
40
  builtin.sy.get().tabix.set(0);
41
41
  builtin.sy.get().index.set(0);
42
+ this.statements.getTime({ sy: builtin.sy });
42
43
  }
43
44
  }
44
45
  exports.ABAP = ABAP;
@@ -55,7 +55,7 @@ class OffsetLength {
55
55
  }
56
56
  if (this.length) {
57
57
  val = val.substr(0, this.length);
58
- if (this.isHex) {
58
+ if (this.isHex || this.obj instanceof types_1.Time) {
59
59
  val = val.padStart(this.length, "0");
60
60
  }
61
61
  }
@@ -1,7 +1,9 @@
1
+ import { Structure } from "../types";
1
2
  import { ICharacter } from "../types/_character";
2
3
  declare type options = {
3
4
  field?: ICharacter;
4
5
  stamp?: ICharacter;
6
+ sy?: Structure;
5
7
  };
6
8
  export declare function getTime(options?: options): void;
7
9
  export {};
@@ -9,14 +9,17 @@ function getTime(options) {
9
9
  const time = (d.getUTCHours() + "").padStart(2, "0") +
10
10
  (d.getUTCMinutes() + "").padStart(2, "0") +
11
11
  (d.getUTCSeconds() + "").padStart(2, "0");
12
- // @ts-ignore
13
- abap.builtin.sy.get().datlo.set(date);
14
- // @ts-ignore
15
- abap.builtin.sy.get().datum.set(date);
16
- // @ts-ignore
17
- abap.builtin.sy.get().timlo.set(time);
18
- // @ts-ignore
19
- abap.builtin.sy.get().uzeit.set(time);
12
+ if (options === undefined) {
13
+ options = {};
14
+ }
15
+ if ((options === null || options === void 0 ? void 0 : options.sy) === undefined) {
16
+ // @ts-ignore
17
+ options.sy = abap.builtin.sy;
18
+ }
19
+ options.sy.get().datlo.set(date);
20
+ options.sy.get().datum.set(date);
21
+ options.sy.get().timlo.set(time);
22
+ options.sy.get().uzeit.set(time);
20
23
  if (options === null || options === void 0 ? void 0 : options.field) {
21
24
  options.field.set(time);
22
25
  }
@@ -7,6 +7,7 @@ declare type options = {
7
7
  pad?: string;
8
8
  width?: number;
9
9
  decimals?: number;
10
+ align?: "left" | "right";
10
11
  };
11
12
  export declare function templateFormatting(source: ICharacter | INumeric, options: options): string;
12
13
  export {};
@@ -14,7 +14,12 @@ function templateFormatting(source, options) {
14
14
  text = text.substr(0, 2) + ":" + text.substr(2, 2) + ":" + text.substr(4, 2);
15
15
  }
16
16
  if (options.width && options.pad) {
17
- text = text.trimEnd().padEnd(options.width, options.pad);
17
+ if (options.align === "right") {
18
+ text = text.trimEnd().padStart(options.width, options.pad);
19
+ }
20
+ else {
21
+ text = text.trimEnd().padEnd(options.width, options.pad);
22
+ }
18
23
  }
19
24
  else if (options.width) {
20
25
  text = text.trimEnd().padEnd(options.width, " ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",