@abaplint/transpiler-cli 2.13.82 → 2.13.83

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.
Files changed (2) hide show
  1. package/build/bundle.js +109 -10
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -112612,12 +112612,56 @@ exports.CollectTranspiler = CollectTranspiler;
112612
112612
 
112613
112613
  "use strict";
112614
112614
 
112615
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
112616
+ if (k2 === undefined) k2 = k;
112617
+ var desc = Object.getOwnPropertyDescriptor(m, k);
112618
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
112619
+ desc = { enumerable: true, get: function() { return m[k]; } };
112620
+ }
112621
+ Object.defineProperty(o, k2, desc);
112622
+ }) : (function(o, m, k, k2) {
112623
+ if (k2 === undefined) k2 = k;
112624
+ o[k2] = m[k];
112625
+ }));
112626
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
112627
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
112628
+ }) : function(o, v) {
112629
+ o["default"] = v;
112630
+ });
112631
+ var __importStar = (this && this.__importStar) || (function () {
112632
+ var ownKeys = function(o) {
112633
+ ownKeys = Object.getOwnPropertyNames || function (o) {
112634
+ var ar = [];
112635
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
112636
+ return ar;
112637
+ };
112638
+ return ownKeys(o);
112639
+ };
112640
+ return function (mod) {
112641
+ if (mod && mod.__esModule) return mod;
112642
+ var result = {};
112643
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
112644
+ __setModuleDefault(result, mod);
112645
+ return result;
112646
+ };
112647
+ })();
112615
112648
  Object.defineProperty(exports, "__esModule", ({ value: true }));
112616
112649
  exports.CommitTranspiler = void 0;
112650
+ const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
112617
112651
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
112652
+ const insert_database_1 = __webpack_require__(/*! ./insert_database */ "./node_modules/@abaplint/transpiler/build/src/statements/insert_database.js");
112618
112653
  class CommitTranspiler {
112619
112654
  transpile(node, traversal) {
112620
- return new chunk_1.Chunk().append("abap.statements.commit();", node, traversal);
112655
+ const options = [];
112656
+ const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
112657
+ if (connection) {
112658
+ options.push(`"connection": ${(0, insert_database_1.findConnection)(connection, traversal)}`);
112659
+ }
112660
+ else if (node.findTokenSequencePosition("AND", "WAIT")) {
112661
+ options.push(`"wait": true`);
112662
+ }
112663
+ const opt = options.length === 0 ? "" : `{${options.join(", ")}}`;
112664
+ return new chunk_1.Chunk().append(`await abap.statements.commit(${opt});`, node, traversal);
112621
112665
  }
112622
112666
  }
112623
112667
  exports.CommitTranspiler = CommitTranspiler;
@@ -115752,20 +115796,32 @@ class InsertDatabaseTranspiler {
115752
115796
  }
115753
115797
  const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
115754
115798
  if (connection) {
115755
- const con = findConnection(connection);
115756
- options.push(`"connection": "${con}"`);
115799
+ const con = findConnection(connection, traversal);
115800
+ options.push(`"connection": ${con}`);
115757
115801
  }
115758
115802
  return new chunk_1.Chunk(`await abap.statements.insertDatabase(${table.getCode()}, {${options.join(", ")}});`);
115759
115803
  }
115760
115804
  }
115761
115805
  exports.InsertDatabaseTranspiler = InsertDatabaseTranspiler;
115762
- function findConnection(connection) {
115806
+ function findConnection(connection, traversal) {
115807
+ const dynamic = connection.findDirectExpression(abaplint.Expressions.Dynamic);
115808
+ if (dynamic) {
115809
+ const field = dynamic.findFirstExpression(abaplint.Expressions.FieldChain);
115810
+ if (field === undefined) {
115811
+ throw new Error("findConnection: dynamic connection name not found");
115812
+ }
115813
+ const value = traversal.traverse(field).getCode();
115814
+ return `${value}.get().trimEnd().toUpperCase()`;
115815
+ }
115763
115816
  let con = connection.getLastToken().getStr().toUpperCase();
115817
+ if (con.startsWith("'") && con.endsWith("'")) {
115818
+ con = con.substring(1, con.length - 1).replace(/''/g, "'");
115819
+ }
115764
115820
  if (con === "DEFAULT_") {
115765
115821
  // todo, workaround for replacing of keywords,
115766
115822
  con = "DEFAULT";
115767
115823
  }
115768
- return con;
115824
+ return JSON.stringify(con);
115769
115825
  }
115770
115826
  //# sourceMappingURL=insert_database.js.map
115771
115827
 
@@ -117170,8 +117226,8 @@ class OpenCursorTranspiler {
117170
117226
  const options = [];
117171
117227
  const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
117172
117228
  if (connection) {
117173
- const con = (0, insert_database_1.findConnection)(connection);
117174
- options.push(`"connection": "${con}"`);
117229
+ const con = (0, insert_database_1.findConnection)(connection, traversal);
117230
+ options.push(`"connection": ${con}`);
117175
117231
  }
117176
117232
  return new chunk_1.Chunk().append(`await abap.statements.openCursor(${target}, "${select}", {${options.join(", ")}});`, node, traversal);
117177
117233
  }
@@ -118331,12 +118387,53 @@ exports.ReturnTranspiler = ReturnTranspiler;
118331
118387
 
118332
118388
  "use strict";
118333
118389
 
118390
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
118391
+ if (k2 === undefined) k2 = k;
118392
+ var desc = Object.getOwnPropertyDescriptor(m, k);
118393
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
118394
+ desc = { enumerable: true, get: function() { return m[k]; } };
118395
+ }
118396
+ Object.defineProperty(o, k2, desc);
118397
+ }) : (function(o, m, k, k2) {
118398
+ if (k2 === undefined) k2 = k;
118399
+ o[k2] = m[k];
118400
+ }));
118401
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
118402
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
118403
+ }) : function(o, v) {
118404
+ o["default"] = v;
118405
+ });
118406
+ var __importStar = (this && this.__importStar) || (function () {
118407
+ var ownKeys = function(o) {
118408
+ ownKeys = Object.getOwnPropertyNames || function (o) {
118409
+ var ar = [];
118410
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
118411
+ return ar;
118412
+ };
118413
+ return ownKeys(o);
118414
+ };
118415
+ return function (mod) {
118416
+ if (mod && mod.__esModule) return mod;
118417
+ var result = {};
118418
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
118419
+ __setModuleDefault(result, mod);
118420
+ return result;
118421
+ };
118422
+ })();
118334
118423
  Object.defineProperty(exports, "__esModule", ({ value: true }));
118335
118424
  exports.RollbackTranspiler = void 0;
118425
+ const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
118336
118426
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
118427
+ const insert_database_1 = __webpack_require__(/*! ./insert_database */ "./node_modules/@abaplint/transpiler/build/src/statements/insert_database.js");
118337
118428
  class RollbackTranspiler {
118338
118429
  transpile(node, traversal) {
118339
- return new chunk_1.Chunk().append("abap.statements.rollback();", node, traversal);
118430
+ const options = [];
118431
+ const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
118432
+ if (connection) {
118433
+ options.push(`"connection": ${(0, insert_database_1.findConnection)(connection, traversal)}`);
118434
+ }
118435
+ const opt = options.length === 0 ? "" : `{${options.join(", ")}}`;
118436
+ return new chunk_1.Chunk().append(`await abap.statements.rollback(${opt});`, node, traversal);
118340
118437
  }
118341
118438
  }
118342
118439
  exports.RollbackTranspiler = RollbackTranspiler;
@@ -121171,11 +121268,13 @@ class ClassImplementationTranspiler {
121171
121268
  ret += traversal.setValues(attr.identifier, name);
121172
121269
  }
121173
121270
  for (const alias of cdef.getAliases()) {
121174
- const isStatic = staticAttributes.some(s => s.prefix.replace("$", "~") + s.identifier.getName() === alias.getComponent());
121271
+ // note: the component is the raw source casing, so compare case insensitive
121272
+ const component = alias.getComponent().toLowerCase();
121273
+ const isStatic = staticAttributes.some(s => (s.prefix.replace("$", "~") + s.identifier.getName()).toLowerCase() === component);
121175
121274
  if (isStatic === false) {
121176
121275
  continue;
121177
121276
  }
121178
- ret += traversal_1.Traversal.escapeNamespace(clasName) + "." + alias.getName().toLowerCase() + " = " + traversal_1.Traversal.escapeNamespace(clasName) + "." + traversal_1.Traversal.escapeNamespace(alias.getComponent().replace("~", "$")) + ";\n";
121277
+ ret += traversal_1.Traversal.escapeNamespace(clasName) + "." + alias.getName().toLowerCase() + " = " + traversal_1.Traversal.escapeNamespace(clasName) + "." + traversal_1.Traversal.escapeNamespace(component.replace("~", "$")) + ";\n";
121179
121278
  }
121180
121279
  for (const e of cdef.getEvents()) {
121181
121280
  if (e.isStatic() === false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.13.82",
3
+ "version": "2.13.83",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -28,7 +28,7 @@
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
30
  "@abaplint/core": "^2.120.45",
31
- "@abaplint/transpiler": "^2.13.82",
31
+ "@abaplint/transpiler": "^2.13.83",
32
32
  "@types/glob": "^9.0.0",
33
33
  "@types/node": "^26.4.1",
34
34
  "@types/progress": "^2.0.7",