@abaplint/transpiler-cli 2.13.81 → 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.
- package/build/bundle.js +121 -14
- 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
|
-
|
|
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;
|
|
@@ -113315,12 +113359,19 @@ class DataTranspiler {
|
|
|
113315
113359
|
value = "\n" + traversal_1.Traversal.prefixVariable(found.getName().toLowerCase()) + ".set(\"" + enumDefault + "\");";
|
|
113316
113360
|
}
|
|
113317
113361
|
}
|
|
113362
|
+
let packedDecimals;
|
|
113363
|
+
if (found.getType() instanceof abaplint.BasicTypes.PackedType) {
|
|
113364
|
+
const decimals = node.findFirstExpression(abaplint.Expressions.Decimals)?.findFirstExpression(abaplint.Expressions.Integer);
|
|
113365
|
+
if (decimals) {
|
|
113366
|
+
packedDecimals = parseInt(decimals.concatTokens(), 10);
|
|
113367
|
+
}
|
|
113368
|
+
}
|
|
113318
113369
|
this.variableName = traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(found.getName().toLowerCase()));
|
|
113319
113370
|
this.loopScoped = traversal.isInsideLoop(node);
|
|
113320
113371
|
const ret = new chunk_1.Chunk()
|
|
113321
113372
|
.appendString(this.loopScoped === true ? "var " : "let ")
|
|
113322
113373
|
.appendString(this.variableName)
|
|
113323
|
-
.appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType()))
|
|
113374
|
+
.appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType(), { packedDecimals }))
|
|
113324
113375
|
.appendString(";")
|
|
113325
113376
|
.appendString(value);
|
|
113326
113377
|
if (this.loopScoped === true && this.skipLoopScoping === false) {
|
|
@@ -115745,20 +115796,32 @@ class InsertDatabaseTranspiler {
|
|
|
115745
115796
|
}
|
|
115746
115797
|
const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
|
|
115747
115798
|
if (connection) {
|
|
115748
|
-
const con = findConnection(connection);
|
|
115749
|
-
options.push(`"connection":
|
|
115799
|
+
const con = findConnection(connection, traversal);
|
|
115800
|
+
options.push(`"connection": ${con}`);
|
|
115750
115801
|
}
|
|
115751
115802
|
return new chunk_1.Chunk(`await abap.statements.insertDatabase(${table.getCode()}, {${options.join(", ")}});`);
|
|
115752
115803
|
}
|
|
115753
115804
|
}
|
|
115754
115805
|
exports.InsertDatabaseTranspiler = InsertDatabaseTranspiler;
|
|
115755
|
-
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
|
+
}
|
|
115756
115816
|
let con = connection.getLastToken().getStr().toUpperCase();
|
|
115817
|
+
if (con.startsWith("'") && con.endsWith("'")) {
|
|
115818
|
+
con = con.substring(1, con.length - 1).replace(/''/g, "'");
|
|
115819
|
+
}
|
|
115757
115820
|
if (con === "DEFAULT_") {
|
|
115758
115821
|
// todo, workaround for replacing of keywords,
|
|
115759
115822
|
con = "DEFAULT";
|
|
115760
115823
|
}
|
|
115761
|
-
return con;
|
|
115824
|
+
return JSON.stringify(con);
|
|
115762
115825
|
}
|
|
115763
115826
|
//# sourceMappingURL=insert_database.js.map
|
|
115764
115827
|
|
|
@@ -117163,8 +117226,8 @@ class OpenCursorTranspiler {
|
|
|
117163
117226
|
const options = [];
|
|
117164
117227
|
const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
|
|
117165
117228
|
if (connection) {
|
|
117166
|
-
const con = (0, insert_database_1.findConnection)(connection);
|
|
117167
|
-
options.push(`"connection":
|
|
117229
|
+
const con = (0, insert_database_1.findConnection)(connection, traversal);
|
|
117230
|
+
options.push(`"connection": ${con}`);
|
|
117168
117231
|
}
|
|
117169
117232
|
return new chunk_1.Chunk().append(`await abap.statements.openCursor(${target}, "${select}", {${options.join(", ")}});`, node, traversal);
|
|
117170
117233
|
}
|
|
@@ -118324,12 +118387,53 @@ exports.ReturnTranspiler = ReturnTranspiler;
|
|
|
118324
118387
|
|
|
118325
118388
|
"use strict";
|
|
118326
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
|
+
})();
|
|
118327
118423
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
118328
118424
|
exports.RollbackTranspiler = void 0;
|
|
118425
|
+
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
118329
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");
|
|
118330
118428
|
class RollbackTranspiler {
|
|
118331
118429
|
transpile(node, traversal) {
|
|
118332
|
-
|
|
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);
|
|
118333
118437
|
}
|
|
118334
118438
|
}
|
|
118335
118439
|
exports.RollbackTranspiler = RollbackTranspiler;
|
|
@@ -121164,11 +121268,13 @@ class ClassImplementationTranspiler {
|
|
|
121164
121268
|
ret += traversal.setValues(attr.identifier, name);
|
|
121165
121269
|
}
|
|
121166
121270
|
for (const alias of cdef.getAliases()) {
|
|
121167
|
-
|
|
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);
|
|
121168
121274
|
if (isStatic === false) {
|
|
121169
121275
|
continue;
|
|
121170
121276
|
}
|
|
121171
|
-
ret += traversal_1.Traversal.escapeNamespace(clasName) + "." + alias.getName().toLowerCase() + " = " + traversal_1.Traversal.escapeNamespace(clasName) + "." + traversal_1.Traversal.escapeNamespace(
|
|
121277
|
+
ret += traversal_1.Traversal.escapeNamespace(clasName) + "." + alias.getName().toLowerCase() + " = " + traversal_1.Traversal.escapeNamespace(clasName) + "." + traversal_1.Traversal.escapeNamespace(component.replace("~", "$")) + ";\n";
|
|
121172
121278
|
}
|
|
121173
121279
|
for (const e of cdef.getEvents()) {
|
|
121174
121280
|
if (e.isStatic() === false) {
|
|
@@ -122571,7 +122677,7 @@ class TranspileTypes {
|
|
|
122571
122677
|
// return singleton,
|
|
122572
122678
|
return "(() => { let _t; return () => (_t ??= " + this.toType(type) + "); })()";
|
|
122573
122679
|
}
|
|
122574
|
-
static toType(type) {
|
|
122680
|
+
static toType(type, options) {
|
|
122575
122681
|
let resolved = "";
|
|
122576
122682
|
let extra = "";
|
|
122577
122683
|
if (type instanceof abaplint.BasicTypes.ObjectReferenceType
|
|
@@ -122694,11 +122800,12 @@ class TranspileTypes {
|
|
|
122694
122800
|
}
|
|
122695
122801
|
else if (type instanceof abaplint.BasicTypes.PackedType) {
|
|
122696
122802
|
resolved = "Packed";
|
|
122803
|
+
const decimals = options?.packedDecimals ?? type.getDecimals();
|
|
122697
122804
|
if (type.getQualifiedName()) {
|
|
122698
|
-
extra = "{length: " + type.getLength() + ", decimals: " +
|
|
122805
|
+
extra = "{length: " + type.getLength() + ", decimals: " + decimals + ", qualifiedName: \"" + type.getQualifiedName() + "\"}";
|
|
122699
122806
|
}
|
|
122700
122807
|
else {
|
|
122701
|
-
extra = "{length: " + type.getLength() + ", decimals: " +
|
|
122808
|
+
extra = "{length: " + type.getLength() + ", decimals: " + decimals + "}";
|
|
122702
122809
|
}
|
|
122703
122810
|
}
|
|
122704
122811
|
else if (type instanceof abaplint.BasicTypes.NumericGenericType) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.13.
|
|
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.
|
|
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",
|