@abaplint/transpiler-cli 2.5.47 → 2.5.49
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 +146 -15
- package/package.json +2 -2
package/build/bundle.js
CHANGED
|
@@ -68271,6 +68271,8 @@ __exportStar(__webpack_require__(/*! ./source_field_symbol */ "./node_modules/@a
|
|
|
68271
68271
|
__exportStar(__webpack_require__(/*! ./source_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field.js"), exports);
|
|
68272
68272
|
__exportStar(__webpack_require__(/*! ./source */ "./node_modules/@abaplint/transpiler/build/src/expressions/source.js"), exports);
|
|
68273
68273
|
__exportStar(__webpack_require__(/*! ./sql_cond */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_cond.js"), exports);
|
|
68274
|
+
__exportStar(__webpack_require__(/*! ./sql_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field.js"), exports);
|
|
68275
|
+
__exportStar(__webpack_require__(/*! ./sql_from_source */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from_source.js"), exports);
|
|
68274
68276
|
__exportStar(__webpack_require__(/*! ./sql_from */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from.js"), exports);
|
|
68275
68277
|
__exportStar(__webpack_require__(/*! ./sql_join */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_join.js"), exports);
|
|
68276
68278
|
__exportStar(__webpack_require__(/*! ./sql_source_simple */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_source_simple.js"), exports);
|
|
@@ -69082,6 +69084,7 @@ const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@aba
|
|
|
69082
69084
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
69083
69085
|
const simple_source3_1 = __webpack_require__(/*! ./simple_source3 */ "./node_modules/@abaplint/transpiler/build/src/expressions/simple_source3.js");
|
|
69084
69086
|
const field_chain_1 = __webpack_require__(/*! ./field_chain */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_chain.js");
|
|
69087
|
+
const sql_field_name_1 = __webpack_require__(/*! ./sql_field_name */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field_name.js");
|
|
69085
69088
|
class SQLCondTranspiler {
|
|
69086
69089
|
transpile(node, traversal) {
|
|
69087
69090
|
var _a;
|
|
@@ -69134,11 +69137,15 @@ class SQLCondTranspiler {
|
|
|
69134
69137
|
if (c.getChildren().length !== 3) {
|
|
69135
69138
|
return this.basicConditionNew(c, traversal, filename);
|
|
69136
69139
|
}
|
|
69137
|
-
|
|
69140
|
+
let fieldName = undefined;
|
|
69141
|
+
const fieldNameExpression = c.findDirectExpression(abaplint.Expressions.SQLFieldName);
|
|
69142
|
+
if (fieldNameExpression) {
|
|
69143
|
+
fieldName = new sql_field_name_1.SQLFieldNameTranspiler().transpile(fieldNameExpression, traversal).getCode();
|
|
69144
|
+
}
|
|
69138
69145
|
const operator = c.findDirectExpression(abaplint.Expressions.SQLCompareOperator);
|
|
69139
69146
|
const source = c.findDirectExpression(abaplint.Expressions.SQLSource);
|
|
69140
69147
|
if (fieldName && source && operator === undefined && c.findDirectTokenByText("LIKE")) {
|
|
69141
|
-
ret += fieldName
|
|
69148
|
+
ret += fieldName + " LIKE ";
|
|
69142
69149
|
ret += this.sqlSource(source, traversal, filename);
|
|
69143
69150
|
return ret;
|
|
69144
69151
|
}
|
|
@@ -69152,7 +69159,7 @@ class SQLCondTranspiler {
|
|
|
69152
69159
|
else if (op.toUpperCase() === "NE") {
|
|
69153
69160
|
op = "<>";
|
|
69154
69161
|
}
|
|
69155
|
-
ret += fieldName
|
|
69162
|
+
ret += fieldName + " " + op + " ";
|
|
69156
69163
|
ret += this.sqlSource(source, traversal, filename);
|
|
69157
69164
|
return ret;
|
|
69158
69165
|
}
|
|
@@ -69193,8 +69200,9 @@ class SQLCondTranspiler {
|
|
|
69193
69200
|
if (ret !== "") {
|
|
69194
69201
|
ret += " ";
|
|
69195
69202
|
}
|
|
69196
|
-
if (child.get() instanceof abaplint.Expressions.SQLFieldName
|
|
69197
|
-
|
|
69203
|
+
if (child.get() instanceof abaplint.Expressions.SQLFieldName
|
|
69204
|
+
&& child instanceof abaplint.Nodes.ExpressionNode) {
|
|
69205
|
+
ret += new sql_field_name_1.SQLFieldNameTranspiler().transpile(child, traversal).getCode();
|
|
69198
69206
|
}
|
|
69199
69207
|
else if (child.get() instanceof abaplint.Expressions.SQLSource
|
|
69200
69208
|
&& child instanceof abaplint.Nodes.ExpressionNode) {
|
|
@@ -69212,6 +69220,69 @@ exports.SQLCondTranspiler = SQLCondTranspiler;
|
|
|
69212
69220
|
|
|
69213
69221
|
/***/ }),
|
|
69214
69222
|
|
|
69223
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field.js":
|
|
69224
|
+
/*!******************************************************************************!*\
|
|
69225
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/sql_field.js ***!
|
|
69226
|
+
\******************************************************************************/
|
|
69227
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
69228
|
+
|
|
69229
|
+
"use strict";
|
|
69230
|
+
|
|
69231
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
69232
|
+
exports.SQLFieldTranspiler = void 0;
|
|
69233
|
+
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
69234
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
69235
|
+
const sql_field_name_1 = __webpack_require__(/*! ./sql_field_name */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field_name.js");
|
|
69236
|
+
class SQLFieldTranspiler {
|
|
69237
|
+
transpile(node, traversal) {
|
|
69238
|
+
const chunk = new chunk_1.Chunk();
|
|
69239
|
+
for (const c of node.getChildren()) {
|
|
69240
|
+
if (c instanceof abaplint.Nodes.TokenNode) {
|
|
69241
|
+
// keywords
|
|
69242
|
+
chunk.appendString(c.concatTokens() + " ");
|
|
69243
|
+
}
|
|
69244
|
+
else if (c.get() instanceof abaplint.Expressions.SQLFieldName) {
|
|
69245
|
+
chunk.appendChunk(new sql_field_name_1.SQLFieldNameTranspiler().transpile(c, traversal));
|
|
69246
|
+
}
|
|
69247
|
+
else {
|
|
69248
|
+
chunk.appendString(c.concatTokens() + " ");
|
|
69249
|
+
}
|
|
69250
|
+
}
|
|
69251
|
+
return chunk;
|
|
69252
|
+
}
|
|
69253
|
+
}
|
|
69254
|
+
exports.SQLFieldTranspiler = SQLFieldTranspiler;
|
|
69255
|
+
//# sourceMappingURL=sql_field.js.map
|
|
69256
|
+
|
|
69257
|
+
/***/ }),
|
|
69258
|
+
|
|
69259
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field_name.js":
|
|
69260
|
+
/*!***********************************************************************************!*\
|
|
69261
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/sql_field_name.js ***!
|
|
69262
|
+
\***********************************************************************************/
|
|
69263
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
69264
|
+
|
|
69265
|
+
"use strict";
|
|
69266
|
+
|
|
69267
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
69268
|
+
exports.SQLFieldNameTranspiler = void 0;
|
|
69269
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
69270
|
+
class SQLFieldNameTranspiler {
|
|
69271
|
+
transpile(node, _traversal) {
|
|
69272
|
+
const chunk = new chunk_1.Chunk();
|
|
69273
|
+
let concat = node.concatTokens();
|
|
69274
|
+
if (concat.includes("~") && concat.split("~")[0].includes("/")) {
|
|
69275
|
+
concat = "'" + concat.replace("~", "'~");
|
|
69276
|
+
}
|
|
69277
|
+
chunk.appendString(concat);
|
|
69278
|
+
return chunk;
|
|
69279
|
+
}
|
|
69280
|
+
}
|
|
69281
|
+
exports.SQLFieldNameTranspiler = SQLFieldNameTranspiler;
|
|
69282
|
+
//# sourceMappingURL=sql_field_name.js.map
|
|
69283
|
+
|
|
69284
|
+
/***/ }),
|
|
69285
|
+
|
|
69215
69286
|
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from.js":
|
|
69216
69287
|
/*!*****************************************************************************!*\
|
|
69217
69288
|
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/sql_from.js ***!
|
|
@@ -69225,19 +69296,32 @@ exports.SQLFromTranspiler = void 0;
|
|
|
69225
69296
|
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
69226
69297
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
69227
69298
|
const sql_join_1 = __webpack_require__(/*! ./sql_join */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_join.js");
|
|
69299
|
+
const sql_from_source_1 = __webpack_require__(/*! ./sql_from_source */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from_source.js");
|
|
69228
69300
|
class SQLFromTranspiler {
|
|
69229
69301
|
transpile(node, traversal) {
|
|
69230
69302
|
const chunk = new chunk_1.Chunk();
|
|
69231
69303
|
for (const c of node.getChildren()) {
|
|
69232
69304
|
if (c instanceof abaplint.Nodes.TokenNode) {
|
|
69305
|
+
// keywords
|
|
69233
69306
|
chunk.appendString(c.concatTokens() + " ");
|
|
69234
69307
|
}
|
|
69235
69308
|
else if (c.get() instanceof abaplint.Expressions.SQLJoin) {
|
|
69236
69309
|
chunk.appendChunk(new sql_join_1.SQLJoinTranspiler().transpile(c, traversal));
|
|
69237
69310
|
chunk.appendString(" ");
|
|
69238
69311
|
}
|
|
69312
|
+
else if (c.get() instanceof abaplint.Expressions.SQLFromSource) {
|
|
69313
|
+
chunk.appendChunk(new sql_from_source_1.SQLFromSourceTranspiler().transpile(c, traversal));
|
|
69314
|
+
}
|
|
69239
69315
|
else {
|
|
69240
|
-
|
|
69316
|
+
if (c.findFirstExpression(abaplint.Expressions.Dynamic)) {
|
|
69317
|
+
chunk.appendString(c.concatTokens() + " ");
|
|
69318
|
+
}
|
|
69319
|
+
else if (c.concatTokens().includes("/")) {
|
|
69320
|
+
chunk.appendString("'" + c.concatTokens() + "' ");
|
|
69321
|
+
}
|
|
69322
|
+
else {
|
|
69323
|
+
chunk.appendString(c.concatTokens() + " ");
|
|
69324
|
+
}
|
|
69241
69325
|
}
|
|
69242
69326
|
}
|
|
69243
69327
|
return chunk;
|
|
@@ -69248,6 +69332,41 @@ exports.SQLFromTranspiler = SQLFromTranspiler;
|
|
|
69248
69332
|
|
|
69249
69333
|
/***/ }),
|
|
69250
69334
|
|
|
69335
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from_source.js":
|
|
69336
|
+
/*!************************************************************************************!*\
|
|
69337
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/sql_from_source.js ***!
|
|
69338
|
+
\************************************************************************************/
|
|
69339
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
69340
|
+
|
|
69341
|
+
"use strict";
|
|
69342
|
+
|
|
69343
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
69344
|
+
exports.SQLFromSourceTranspiler = void 0;
|
|
69345
|
+
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
69346
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
69347
|
+
class SQLFromSourceTranspiler {
|
|
69348
|
+
transpile(node, _traversal) {
|
|
69349
|
+
const chunk = new chunk_1.Chunk();
|
|
69350
|
+
for (const c of node.getChildren()) {
|
|
69351
|
+
if (c instanceof abaplint.Nodes.TokenNode) {
|
|
69352
|
+
// keywords
|
|
69353
|
+
chunk.appendString(c.concatTokens() + " ");
|
|
69354
|
+
}
|
|
69355
|
+
else if (c.get() instanceof abaplint.Expressions.DatabaseTable && c.concatTokens().includes("/")) {
|
|
69356
|
+
chunk.appendString("'" + c.concatTokens() + "' ");
|
|
69357
|
+
}
|
|
69358
|
+
else {
|
|
69359
|
+
chunk.appendString(c.concatTokens() + " ");
|
|
69360
|
+
}
|
|
69361
|
+
}
|
|
69362
|
+
return chunk;
|
|
69363
|
+
}
|
|
69364
|
+
}
|
|
69365
|
+
exports.SQLFromSourceTranspiler = SQLFromSourceTranspiler;
|
|
69366
|
+
//# sourceMappingURL=sql_from_source.js.map
|
|
69367
|
+
|
|
69368
|
+
/***/ }),
|
|
69369
|
+
|
|
69251
69370
|
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_join.js":
|
|
69252
69371
|
/*!*****************************************************************************!*\
|
|
69253
69372
|
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/sql_join.js ***!
|
|
@@ -69261,16 +69380,21 @@ exports.SQLJoinTranspiler = void 0;
|
|
|
69261
69380
|
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
69262
69381
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
69263
69382
|
const sql_cond_1 = __webpack_require__(/*! ./sql_cond */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_cond.js");
|
|
69383
|
+
const sql_from_source_1 = __webpack_require__(/*! ./sql_from_source */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from_source.js");
|
|
69264
69384
|
class SQLJoinTranspiler {
|
|
69265
69385
|
transpile(node, traversal) {
|
|
69266
69386
|
const chunk = new chunk_1.Chunk();
|
|
69267
69387
|
for (const c of node.getChildren()) {
|
|
69268
69388
|
if (c instanceof abaplint.Nodes.TokenNode) {
|
|
69389
|
+
// keywords
|
|
69269
69390
|
chunk.appendString(c.concatTokens() + " ");
|
|
69270
69391
|
}
|
|
69271
69392
|
else if (c.get() instanceof abaplint.Expressions.SQLCond) {
|
|
69272
69393
|
chunk.appendChunk(new sql_cond_1.SQLCondTranspiler().transpile(c, traversal));
|
|
69273
69394
|
}
|
|
69395
|
+
else if (c.get() instanceof abaplint.Expressions.SQLFromSource) {
|
|
69396
|
+
chunk.appendChunk(new sql_from_source_1.SQLFromSourceTranspiler().transpile(c, traversal));
|
|
69397
|
+
}
|
|
69274
69398
|
else {
|
|
69275
69399
|
chunk.appendString(c.concatTokens() + " ");
|
|
69276
69400
|
}
|
|
@@ -74637,14 +74761,17 @@ class SelectTranspiler {
|
|
|
74637
74761
|
let select = "SELECT ";
|
|
74638
74762
|
const fieldList = node.findFirstExpression(abaplint.Expressions.SQLFieldList)
|
|
74639
74763
|
|| node.findFirstExpression(abaplint.Expressions.SQLFieldListLoop);
|
|
74640
|
-
|
|
74641
|
-
|
|
74642
|
-
|
|
74643
|
-
|
|
74644
|
-
|
|
74645
|
-
|
|
74764
|
+
const fields = [];
|
|
74765
|
+
for (const f of (fieldList === null || fieldList === void 0 ? void 0 : fieldList.getChildren()) || []) {
|
|
74766
|
+
if (f instanceof abaplint.Nodes.ExpressionNode && f.get() instanceof abaplint.Expressions.SQLField) {
|
|
74767
|
+
const code = new expressions_1.SQLFieldTranspiler().transpile(f, traversal).getCode();
|
|
74768
|
+
fields.push(code);
|
|
74769
|
+
}
|
|
74770
|
+
else {
|
|
74771
|
+
fields.push(f.concatTokens());
|
|
74772
|
+
}
|
|
74646
74773
|
}
|
|
74647
|
-
select += " ";
|
|
74774
|
+
select += fields.join(", ") + " ";
|
|
74648
74775
|
const from = node.findFirstExpression(abaplint.Expressions.SQLFrom);
|
|
74649
74776
|
if (from) {
|
|
74650
74777
|
select += new sql_from_1.SQLFromTranspiler().transpile(from, traversal).getCode();
|
|
@@ -74698,6 +74825,10 @@ class SelectTranspiler {
|
|
|
74698
74825
|
const faeTranspiled = new expressions_1.SQLSourceTranspiler().transpile(fn, traversal).getCode();
|
|
74699
74826
|
select = select.replace(new RegExp(" " + escapeRegExp(faeTranspiled), "g"), " " + unique);
|
|
74700
74827
|
select = select.replace(unique + ".get().table_line.get()", unique + ".get()"); // there can be only one?
|
|
74828
|
+
let by = `Object.keys(${target}.getRowType().get())`;
|
|
74829
|
+
if (keys.length > 0) {
|
|
74830
|
+
by = JSON.stringify(keys);
|
|
74831
|
+
}
|
|
74701
74832
|
const code = `if (${faeTranspiled}.array().length === 0) {
|
|
74702
74833
|
throw "FAE, todo, empty table";
|
|
74703
74834
|
} else {
|
|
@@ -74705,8 +74836,8 @@ class SelectTranspiler {
|
|
|
74705
74836
|
for await (const ${unique} of abap.statements.loop(${faeTranspiled})) {
|
|
74706
74837
|
await abap.statements.select(${target}, {select: "${select.trim()}"${extra}}, {appending: true});
|
|
74707
74838
|
}
|
|
74708
|
-
abap.statements.sort(${target}, {by:
|
|
74709
|
-
await abap.statements.deleteInternal(${target}, {adjacent: true});
|
|
74839
|
+
abap.statements.sort(${target}, {by: ${by}.map(k => { return {component: k}; })});
|
|
74840
|
+
await abap.statements.deleteInternal(${target}, {adjacent: true, by: ${by}});
|
|
74710
74841
|
abap.builtin.sy.get().dbcnt.set(${target}.array().length);
|
|
74711
74842
|
}`;
|
|
74712
74843
|
return new chunk_1.Chunk().append(code, node, traversal);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.49",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abap_transpile": "./abap_transpile"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"author": "abaplint",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@abaplint/transpiler": "^2.5.
|
|
28
|
+
"@abaplint/transpiler": "^2.5.49",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "=7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|