@abaplint/transpiler 2.3.120 → 2.3.122

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.
@@ -1,9 +1,10 @@
1
1
  import * as abaplint from "@abaplint/core";
2
+ import { ITranspilerOptions } from "../types";
2
3
  import { DatabaseSetupResult } from "./database_setup_result";
3
4
  export declare class DatabaseSetup {
4
5
  private readonly reg;
5
6
  constructor(reg: abaplint.IRegistry);
6
- run(): DatabaseSetupResult;
7
+ run(options?: ITranspilerOptions | undefined): DatabaseSetupResult;
7
8
  private buildInsert;
8
9
  private insertREPOSRC;
9
10
  private insertT000;
@@ -8,18 +8,18 @@ class DatabaseSetup {
8
8
  constructor(reg) {
9
9
  this.reg = reg;
10
10
  }
11
- run() {
11
+ run(options) {
12
12
  return {
13
13
  schemas: {
14
14
  sqlite: new sqlite_database_schema_1.SQLiteDatabaseSchema(this.reg).run(),
15
15
  hdb: ["todo"],
16
16
  pg: ["todo"],
17
17
  },
18
- insert: this.buildInsert(),
18
+ insert: this.buildInsert(options),
19
19
  };
20
20
  }
21
21
  ////////////////////
22
- buildInsert() {
22
+ buildInsert(options) {
23
23
  // note: avoid hitting maximum statement size by splitting into multiple statements
24
24
  const insert = [];
25
25
  // INSERT data
@@ -29,7 +29,9 @@ class DatabaseSetup {
29
29
  }
30
30
  else if (obj instanceof abaplint.Objects.Class
31
31
  || obj instanceof abaplint.Objects.Interface) {
32
- insert.push(this.insertREPOSRC(obj));
32
+ if ((options === null || options === void 0 ? void 0 : options.skipReposrc) !== true) {
33
+ insert.push(this.insertREPOSRC(obj));
34
+ }
33
35
  }
34
36
  }
35
37
  insert.push(this.insertT000());
@@ -19,7 +19,7 @@ class SQLCondTranspiler {
19
19
  const chain = (_a = c.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(abaplint.Expressions.FieldChain);
20
20
  if (chain) {
21
21
  const code = new field_chain_1.FieldChainTranspiler(true).transpile(chain, traversal).getCode();
22
- ret += `" + ${code} + "`;
22
+ ret += `" + (${code} === "" ? "1 = 1" : ${code}) + "`;
23
23
  }
24
24
  else {
25
25
  throw new Error("SQL Condition, transpiler todo, dyn cond, " + c.concatTokens());
@@ -34,7 +34,7 @@ class Transpiler {
34
34
  reg.parse();
35
35
  new keywords_1.Keywords((_a = this.options) === null || _a === void 0 ? void 0 : _a.keywords).handle(reg);
36
36
  this.validate(reg);
37
- const dbSetup = new db_1.DatabaseSetup(reg).run();
37
+ const dbSetup = new db_1.DatabaseSetup(reg).run(this.options);
38
38
  const output = {
39
39
  objects: [],
40
40
  unitTestScript: new unit_test_1.UnitTest().unitTestScript(reg, (_b = this.options) === null || _b === void 0 ? void 0 : _b.skip, (_c = this.options) === null || _c === void 0 ? void 0 : _c.only),
@@ -53,4 +53,6 @@ export interface ITranspilerOptions {
53
53
  extraSetup?: string;
54
54
  /** list of keywords to rename, if not supplied default will be used */
55
55
  keywords?: string[];
56
+ /** dont insert into REPOSRC */
57
+ skipReposrc?: boolean;
56
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.3.120",
3
+ "version": "2.3.122",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",