@abaplint/transpiler 2.1.25 → 2.1.26

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.
@@ -5,6 +5,8 @@ export declare class DatabaseSetup {
5
5
  constructor(reg: abaplint.IRegistry);
6
6
  run(): DatabaseSetupResult;
7
7
  private buildInsert;
8
- private t000Insert;
9
- private messageClass;
8
+ private insertREPOSRC;
9
+ private insertT000;
10
+ private insertT100;
11
+ private escape;
10
12
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DatabaseSetup = void 0;
4
+ /* eslint-disable max-len */
4
5
  const abaplint = require("@abaplint/core");
5
6
  const sqlite_database_schema_1 = require("./sqlite_database_schema");
6
7
  class DatabaseSetup {
@@ -23,37 +24,56 @@ class DatabaseSetup {
23
24
  // INSERT data
24
25
  for (const obj of this.reg.getObjects()) {
25
26
  if (obj instanceof abaplint.Objects.MessageClass) {
26
- insert += this.messageClass(obj);
27
+ insert += this.insertT100(obj);
28
+ }
29
+ else if (obj instanceof abaplint.Objects.Class
30
+ || obj instanceof abaplint.Objects.Interface) {
31
+ insert += this.insertREPOSRC(obj);
27
32
  }
28
33
  }
29
- insert += this.t000Insert();
34
+ insert += this.insertT000();
30
35
  return insert;
31
36
  }
32
- t000Insert() {
33
- const obj = this.reg.getObject("TABL", "T000");
34
- if (obj === undefined) {
37
+ insertREPOSRC(obj) {
38
+ var _a;
39
+ if (this.reg.getObject("TABL", "REPOSRC") === undefined) {
40
+ return "";
41
+ }
42
+ const name = obj.getName().toUpperCase();
43
+ const raw = (_a = obj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getRaw();
44
+ if (raw === undefined) {
35
45
  return "";
36
46
  }
37
- const type = obj.parseType(this.reg);
38
- if (type instanceof abaplint.BasicTypes.StructureType && type.getComponents().length === 3) {
47
+ return `INSERT INTO reposrc ('PROGNAME', 'DATA') VALUES ('${name}', '${this.escape(raw)}');\n`;
48
+ }
49
+ insertT000() {
50
+ const tabl = this.reg.getObject("TABL", "T000");
51
+ if (tabl === undefined) {
52
+ return "";
53
+ }
54
+ const type = tabl.parseType(this.reg);
55
+ if (type instanceof abaplint.BasicTypes.StructureType && type.getComponents().length >= 3) {
39
56
  // todo, this should take the client number from the settings
40
- return `INSERT INTO t000 VALUES ('123', '', '');\n`;
57
+ return `INSERT INTO t000 ('MANDT', 'CCCATEGORY', 'CCNOCLIIND') VALUES ('123', '', '');\n`;
41
58
  }
42
59
  else {
43
60
  return "";
44
61
  }
45
62
  }
46
- messageClass(msag) {
63
+ insertT100(msag) {
47
64
  // ignore if T100 is unknown
48
65
  if (this.reg.getObject("TABL", "T100") === undefined) {
49
66
  return "";
50
67
  }
51
68
  let ret = "";
52
69
  for (const m of msag.getMessages()) {
53
- ret += `INSERT INTO t100 VALUES ('E', '${msag.getName()}', '${m.getNumber()}', '${m.getMessage().replace(/\'/g, "''")}');\n`;
70
+ ret += `INSERT INTO t100 ('SPRSL', 'ARBGB', 'MSGNR', 'TEXT') VALUES ('E', '${msag.getName()}', '${m.getNumber()}', '${this.escape(m.getMessage())}');\n`;
54
71
  }
55
72
  return ret;
56
73
  }
74
+ escape(value) {
75
+ return value.replace(/\'/g, "''");
76
+ }
57
77
  }
58
78
  exports.DatabaseSetup = DatabaseSetup;
59
79
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.1.25",
3
+ "version": "2.1.26",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",