@abaplint/transpiler-cli 2.1.69 → 2.1.70
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 +14 -3
- package/package.json +2 -2
package/build/bundle.js
CHANGED
|
@@ -13458,7 +13458,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13458
13458
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
13459
13459
|
|
|
13460
13460
|
"use strict";
|
|
13461
|
-
eval("\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n__exportStar(__webpack_require__(/*! ./arith_operator */ \"./node_modules/@abaplint/transpiler/build/src/expressions/arith_operator.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./attribute_chain */ \"./node_modules/@abaplint/transpiler/build/src/expressions/attribute_chain.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./attribute_name */ \"./node_modules/@abaplint/transpiler/build/src/expressions/attribute_name.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./call_transformation_options */ \"./node_modules/@abaplint/transpiler/build/src/expressions/call_transformation_options.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./call_transformation_parameters */ \"./node_modules/@abaplint/transpiler/build/src/expressions/call_transformation_parameters.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./compare_operator */ \"./node_modules/@abaplint/transpiler/build/src/expressions/compare_operator.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./compare */ \"./node_modules/@abaplint/transpiler/build/src/expressions/compare.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./component_chain_simple */ \"./node_modules/@abaplint/transpiler/build/src/expressions/component_chain_simple.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./component_chain */ \"./node_modules/@abaplint/transpiler/build/src/expressions/component_chain.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./component_compare */ \"./node_modules/@abaplint/transpiler/build/src/expressions/component_compare.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./
|
|
13461
|
+
eval("\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n__exportStar(__webpack_require__(/*! ./arith_operator */ \"./node_modules/@abaplint/transpiler/build/src/expressions/arith_operator.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./attribute_chain */ \"./node_modules/@abaplint/transpiler/build/src/expressions/attribute_chain.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./attribute_name */ \"./node_modules/@abaplint/transpiler/build/src/expressions/attribute_name.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./call_transformation_options */ \"./node_modules/@abaplint/transpiler/build/src/expressions/call_transformation_options.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./call_transformation_parameters */ \"./node_modules/@abaplint/transpiler/build/src/expressions/call_transformation_parameters.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./compare_operator */ \"./node_modules/@abaplint/transpiler/build/src/expressions/compare_operator.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./compare */ \"./node_modules/@abaplint/transpiler/build/src/expressions/compare.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./component_chain_simple */ \"./node_modules/@abaplint/transpiler/build/src/expressions/component_chain_simple.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./component_chain */ \"./node_modules/@abaplint/transpiler/build/src/expressions/component_chain.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./component_compare */ \"./node_modules/@abaplint/transpiler/build/src/expressions/component_compare.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./component_cond_sub */ \"./node_modules/@abaplint/transpiler/build/src/expressions/component_cond_sub.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./component_cond */ \"./node_modules/@abaplint/transpiler/build/src/expressions/component_cond.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./cond_sub */ \"./node_modules/@abaplint/transpiler/build/src/expressions/cond_sub.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./cond */ \"./node_modules/@abaplint/transpiler/build/src/expressions/cond.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./constant */ \"./node_modules/@abaplint/transpiler/build/src/expressions/constant.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./database_table */ \"./node_modules/@abaplint/transpiler/build/src/expressions/database_table.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./field_chain */ \"./node_modules/@abaplint/transpiler/build/src/expressions/field_chain.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./field_length */ \"./node_modules/@abaplint/transpiler/build/src/expressions/field_length.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./field_offset */ \"./node_modules/@abaplint/transpiler/build/src/expressions/field_offset.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./field_symbol */ \"./node_modules/@abaplint/transpiler/build/src/expressions/field_symbol.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./function_exporting */ \"./node_modules/@abaplint/transpiler/build/src/expressions/function_exporting.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./function_parameters */ \"./node_modules/@abaplint/transpiler/build/src/expressions/function_parameters.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./method_call_body */ \"./node_modules/@abaplint/transpiler/build/src/expressions/method_call_body.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./method_call_chain */ \"./node_modules/@abaplint/transpiler/build/src/expressions/method_call_chain.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./method_call_param */ \"./node_modules/@abaplint/transpiler/build/src/expressions/method_call_param.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./method_call */ \"./node_modules/@abaplint/transpiler/build/src/expressions/method_call.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./method_parameters */ \"./node_modules/@abaplint/transpiler/build/src/expressions/method_parameters.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./method_source */ \"./node_modules/@abaplint/transpiler/build/src/expressions/method_source.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./parameter_list_s */ \"./node_modules/@abaplint/transpiler/build/src/expressions/parameter_list_s.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./parameter_list_t */ \"./node_modules/@abaplint/transpiler/build/src/expressions/parameter_list_t.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./parameter_name */ \"./node_modules/@abaplint/transpiler/build/src/expressions/parameter_name.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./parameter_s */ \"./node_modules/@abaplint/transpiler/build/src/expressions/parameter_s.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./parameter_t */ \"./node_modules/@abaplint/transpiler/build/src/expressions/parameter_t.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./simple_source1 */ \"./node_modules/@abaplint/transpiler/build/src/expressions/simple_source1.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./simple_source2 */ \"./node_modules/@abaplint/transpiler/build/src/expressions/simple_source2.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./simple_source3 */ \"./node_modules/@abaplint/transpiler/build/src/expressions/simple_source3.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./simple_source4 */ \"./node_modules/@abaplint/transpiler/build/src/expressions/simple_source4.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./source_field_symbol */ \"./node_modules/@abaplint/transpiler/build/src/expressions/source_field_symbol.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./source */ \"./node_modules/@abaplint/transpiler/build/src/expressions/source.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./sql_cond */ \"./node_modules/@abaplint/transpiler/build/src/expressions/sql_cond.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./sql_source_simple */ \"./node_modules/@abaplint/transpiler/build/src/expressions/sql_source_simple.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./sql_source */ \"./node_modules/@abaplint/transpiler/build/src/expressions/sql_source.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./string_template_source */ \"./node_modules/@abaplint/transpiler/build/src/expressions/string_template_source.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./string_template */ \"./node_modules/@abaplint/transpiler/build/src/expressions/string_template.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./target */ \"./node_modules/@abaplint/transpiler/build/src/expressions/target.js\"), exports);\r\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/expressions/index.js?");
|
|
13462
13462
|
|
|
13463
13463
|
/***/ }),
|
|
13464
13464
|
|
|
@@ -13649,6 +13649,17 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13649
13649
|
|
|
13650
13650
|
/***/ }),
|
|
13651
13651
|
|
|
13652
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_cond.js":
|
|
13653
|
+
/*!*****************************************************************************!*\
|
|
13654
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/sql_cond.js ***!
|
|
13655
|
+
\*****************************************************************************/
|
|
13656
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13657
|
+
|
|
13658
|
+
"use strict";
|
|
13659
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SQLCondTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nconst simple_source3_1 = __webpack_require__(/*! ./simple_source3 */ \"./node_modules/@abaplint/transpiler/build/src/expressions/simple_source3.js\");\r\nconst field_chain_1 = __webpack_require__(/*! ./field_chain */ \"./node_modules/@abaplint/transpiler/build/src/expressions/field_chain.js\");\r\nclass SQLCondTranspiler {\r\n transpile(node, traversal) {\r\n var _a;\r\n let ret = \"\";\r\n for (const c of node.getChildren()) {\r\n if (c instanceof abaplint.Nodes.ExpressionNode\r\n && c.get() instanceof abaplint.Expressions.SQLCompare) {\r\n if (ret !== \"\") {\r\n ret += \" \";\r\n }\r\n if (c.findDirectExpression(abaplint.Expressions.Dynamic)) {\r\n const chain = (_a = c.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(abaplint.Expressions.FieldChain);\r\n if (chain) {\r\n const code = new field_chain_1.FieldChainTranspiler(true).transpile(chain, traversal).getCode();\r\n ret += `\" + ${code} + \"`;\r\n }\r\n else {\r\n throw new Error(\"SQL Condition, transpiler todo, dyn cond, \" + c.concatTokens());\r\n }\r\n }\r\n else if (c.findDirectExpression(abaplint.Expressions.SQLIn)) {\r\n ret += this.sqlIn(c, traversal);\r\n }\r\n else {\r\n ret += this.basicCondition(c, traversal);\r\n }\r\n }\r\n else if (c instanceof abaplint.Nodes.ExpressionNode) {\r\n ret += \" \" + this.transpile(c, traversal).getCode();\r\n }\r\n else {\r\n ret += \" \" + c.concatTokens();\r\n }\r\n }\r\n const c = new chunk_1.Chunk();\r\n return c.appendString(ret.trim());\r\n }\r\n sqlIn(c, _traversal) {\r\n const fieldName = c.findDirectExpression(abaplint.Expressions.SQLFieldName);\r\n const slqin = c.findDirectExpression(abaplint.Expressions.SQLIn);\r\n const source = c.findFirstExpression(abaplint.Expressions.SimpleSource3);\r\n if (fieldName === undefined || slqin === undefined || source === undefined) {\r\n throw new Error(\"SQL Condition, transpiler todo, \" + c.concatTokens());\r\n }\r\n const ret = `\" + abap.expandIN(\"${fieldName.concatTokens()}\", ${source.concatTokens()}) + \"`;\r\n return ret;\r\n }\r\n basicCondition(c, traversal) {\r\n let ret = \"\";\r\n if (c.getChildren().length !== 3) {\r\n throw new Error(\"SQL Condition, transpiler todo, \" + c.concatTokens() + \", \" + c.getChildren().length);\r\n }\r\n const fieldName = c.findDirectExpression(abaplint.Expressions.SQLFieldName);\r\n const operator = c.findDirectExpression(abaplint.Expressions.SQLCompareOperator);\r\n const source = c.findDirectExpression(abaplint.Expressions.SQLSource);\r\n if (fieldName === undefined || operator === undefined || source === undefined) {\r\n throw new Error(\"SQL Condition, transpiler todo, \" + c.concatTokens());\r\n }\r\n ret += fieldName.concatTokens() + \" \" + operator.concatTokens() + \" \";\r\n const simple = source.findDirectExpression(abaplint.Expressions.SimpleSource3);\r\n if (simple && simple.findDirectExpression(abaplint.Expressions.Constant) === undefined) {\r\n ret += \"'\\\" + \" + new simple_source3_1.SimpleSource3Transpiler(true).transpile(simple, traversal).getCode() + \" + \\\"'\";\r\n }\r\n else {\r\n ret += source.concatTokens();\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.SQLCondTranspiler = SQLCondTranspiler;\r\n//# sourceMappingURL=sql_cond.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/expressions/sql_cond.js?");
|
|
13660
|
+
|
|
13661
|
+
/***/ }),
|
|
13662
|
+
|
|
13652
13663
|
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_source.js":
|
|
13653
13664
|
/*!*******************************************************************************!*\
|
|
13654
13665
|
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/sql_source.js ***!
|
|
@@ -14085,7 +14096,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
14085
14096
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
14086
14097
|
|
|
14087
14098
|
"use strict";
|
|
14088
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DeleteDatabaseTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass DeleteDatabaseTranspiler {\r\n transpile(node, traversal) {\r\n const table = traversal.traverse(node.findFirstExpression(abaplint.Expressions.DatabaseTable));\r\n const options = [];\r\n const tab = node.findExpressionAfterToken(\"TABLE\");\r\n if (tab) {\r\n const ttab = traversal.traverse(tab);\r\n options.push(`\"table\": ` + ttab.getCode());\r\n }\r\n return new chunk_1.Chunk(`await abap.statements.deleteDatabase(${table.getCode()}, {${options.join(\", \")}});`);\r\n }\r\n}\r\nexports.DeleteDatabaseTranspiler = DeleteDatabaseTranspiler;\r\n//# sourceMappingURL=delete_database.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/delete_database.js?");
|
|
14099
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DeleteDatabaseTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass DeleteDatabaseTranspiler {\r\n transpile(node, traversal) {\r\n const table = traversal.traverse(node.findFirstExpression(abaplint.Expressions.DatabaseTable));\r\n const options = [];\r\n const tab = node.findExpressionAfterToken(\"TABLE\");\r\n if (tab) {\r\n const ttab = traversal.traverse(tab);\r\n options.push(`\"table\": ` + ttab.getCode());\r\n }\r\n const w = node.findExpressionAfterToken(\"WHERE\");\r\n if (w && w.get() instanceof abaplint.Expressions.SQLCond) {\r\n const ttab = traversal.traverse(w);\r\n options.push(`\"where\": \"` + ttab.getCode() + `\"`);\r\n }\r\n return new chunk_1.Chunk(`await abap.statements.deleteDatabase(${table.getCode()}, {${options.join(\", \")}});`);\r\n }\r\n}\r\nexports.DeleteDatabaseTranspiler = DeleteDatabaseTranspiler;\r\n//# sourceMappingURL=delete_database.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/delete_database.js?");
|
|
14089
14100
|
|
|
14090
14101
|
/***/ }),
|
|
14091
14102
|
|
|
@@ -14789,7 +14800,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
14789
14800
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
14790
14801
|
|
|
14791
14802
|
"use strict";
|
|
14792
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nconst unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ \"./node_modules/@abaplint/transpiler/build/src/unique_identifier.js\");\r\nclass SelectTranspiler {\r\n transpile(node, traversal, targetOverride) {\r\n var _a, _b, _c, _d;\r\n let target = \"undefined\";\r\n if (targetOverride) {\r\n target = targetOverride;\r\n }\r\n else if (node.findFirstExpression(abaplint.Expressions.Target)) {\r\n target = traversal.traverse(node.findFirstExpression(abaplint.Expressions.Target)).getCode();\r\n }\r\n let select = \"SELECT \";\r\n const fieldList = node.findFirstExpression(abaplint.Expressions.SQLFieldList)\r\n || node.findFirstExpression(abaplint.Expressions.SQLFieldListLoop);\r\n if ((fieldList === null || fieldList === void 0 ? void 0 : fieldList.getChildren().length) === 1) {\r\n select += fieldList.concatTokens();\r\n }\r\n else {\r\n // add commas between field names, this is required for SQLite, and easy to remove in other clients?\r\n select += fieldList === null || fieldList === void 0 ? void 0 : fieldList.findAllExpressions(abaplint.Expressions.SQLField).map(e => e.concatTokens()).join(\", \");\r\n }\r\n select += \" \";\r\n select += ((_a = node.findFirstExpression(abaplint.Expressions.SQLFrom)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + \" \";\r\n let where;\r\n for (const sqlCond of node.findAllExpressions(abaplint.Expressions.SQLCond)) {\r\n if (this.isWhereExpression(node, sqlCond)) {\r\n where = sqlCond;\r\n }\r\n }\r\n if (where) {\r\n select += \"WHERE \" + this.concatCond(where, traversal) + \" \";\r\n }\r\n const upTo = node.findFirstExpression(abaplint.Expressions.SQLUpTo);\r\n if (upTo) {\r\n const s = upTo.findFirstExpression(abaplint.Expressions.SimpleSource3);\r\n if (s) {\r\n select += `UP TO \" + ${new expressions_1.SourceTranspiler(true).transpile(s, traversal).getCode()} + \" ROWS `;\r\n }\r\n else {\r\n select += upTo.concatTokens() + \" \";\r\n }\r\n }\r\n const orderBy = node.findFirstExpression(abaplint.Expressions.SQLOrderBy);\r\n if (orderBy) {\r\n select += orderBy.concatTokens() + \" \";\r\n }\r\n for (const d of node.findAllExpressionsRecursive(abaplint.Expressions.Dynamic)) {\r\n const chain = d.findFirstExpression(abaplint.Expressions.FieldChain);\r\n if (chain) {\r\n const code = new expressions_1.FieldChainTranspiler(true).transpile(chain, traversal).getCode();\r\n const search = d.concatTokens();\r\n select = select.replace(search, `\" + ${code} + \"`);\r\n }\r\n }\r\n if (node.concatTokens().toUpperCase().startsWith(\"SELECT SINGLE \")) {\r\n select += \"UP TO 1 ROWS\";\r\n }\r\n let runtimeOptions = \"\";\r\n if (node.concatTokens().toUpperCase().includes(\" APPENDING TABLE \")) {\r\n runtimeOptions = `, {appending: true}`;\r\n }\r\n let extra = \"\";\r\n const keys = this.findKeys(node, traversal);\r\n if (keys.length > 0) {\r\n extra = `, primaryKey: ${JSON.stringify(keys)}`;\r\n }\r\n if (node.findFirstExpression(abaplint.Expressions.SQLForAllEntries)) {\r\n const unique = unique_identifier_1.UniqueIdentifier.get();\r\n const faeName = (_d = (_c = (_b = node.findFirstExpression(abaplint.Expressions.SQLForAllEntries)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(abaplint.Expressions.SQLSource)) === null || _c === void 0 ? void 0 : _c.concatTokens()) === null || _d === void 0 ? void 0 : _d.toLowerCase();\r\n select = select.replace(new RegExp(\" \" + faeName, \"g\"), \" \" + unique);\r\n select = select.replace(unique + \".get().table_line.get()\", unique + \".get()\"); // there can be only one?\r\n const code = `if (${faeName}.array().length === 0) {\r\n throw \"FAE, todo, empty table\";\r\n} else {\r\n abap.statements.clear(${target});\r\n for await (const ${unique} of abap.statements.loop(${faeName})) {\r\n await abap.statements.select(${target}, {select: \"${select.trim()}\"${extra}}, {appending: true});\r\n }\r\n abap.builtin.sy.get().dbcnt.set(${target}.array().length);\r\n}`;\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n else {\r\n return new chunk_1.Chunk().append(`await abap.statements.select(${target}, {select: \"${select.trim()}\"${extra}}${runtimeOptions});`, node, traversal);\r\n }\r\n }\r\n findKeys(node, traversal) {\r\n let keys = [];\r\n const from = node.findAllExpressions(abaplint.Expressions.SQLFromSource).map(e => e.concatTokens());\r\n if (from.length === 1) {\r\n const tabl = traversal.findTable(from[0]);\r\n if (tabl) {\r\n keys = tabl.listKeys().map(k => k.toLowerCase());\r\n }\r\n }\r\n return keys;\r\n }\r\n concatCond(cond, traversal) {\r\n var _a;\r\n let ret = \"\";\r\n for (const c of cond.getChildren()) {\r\n if (c instanceof abaplint.Nodes.ExpressionNode\r\n && c.get() instanceof abaplint.Expressions.SQLCompare) {\r\n if (ret !== \"\") {\r\n ret += \" \";\r\n }\r\n if (c.findDirectExpression(abaplint.Expressions.Dynamic)) {\r\n const chain = (_a = c.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(abaplint.Expressions.FieldChain);\r\n if (chain) {\r\n const code = new expressions_1.FieldChainTranspiler(true).transpile(chain, traversal).getCode();\r\n ret += `\" + ${code} + \"`;\r\n }\r\n else {\r\n throw new Error(\"SQL Condition, transpiler todo, dyn cond, \" + c.concatTokens());\r\n }\r\n }\r\n else if (c.findDirectExpression(abaplint.Expressions.SQLIn)) {\r\n ret += this.sqlIn(c, traversal);\r\n }\r\n else {\r\n ret += this.basicCondition(c, traversal);\r\n }\r\n }\r\n else if (c instanceof abaplint.Nodes.ExpressionNode) {\r\n ret += \" \" + this.concatCond(c, traversal);\r\n }\r\n else {\r\n ret += \" \" + c.concatTokens();\r\n }\r\n }\r\n return ret.trim();\r\n }\r\n sqlIn(c, _traversal) {\r\n const fieldName = c.findDirectExpression(abaplint.Expressions.SQLFieldName);\r\n const slqin = c.findDirectExpression(abaplint.Expressions.SQLIn);\r\n const source = c.findFirstExpression(abaplint.Expressions.SimpleSource3);\r\n if (fieldName === undefined || slqin === undefined || source === undefined) {\r\n throw new Error(\"SQL Condition, transpiler todo, \" + c.concatTokens());\r\n }\r\n const ret = `\" + abap.expandIN(\"${fieldName.concatTokens()}\", ${source.concatTokens()}) + \"`;\r\n return ret;\r\n }\r\n basicCondition(c, traversal) {\r\n let ret = \"\";\r\n if (c.getChildren().length !== 3) {\r\n throw new Error(\"SQL Condition, transpiler todo, \" + c.concatTokens() + \", \" + c.getChildren().length);\r\n }\r\n const fieldName = c.findDirectExpression(abaplint.Expressions.SQLFieldName);\r\n const operator = c.findDirectExpression(abaplint.Expressions.SQLCompareOperator);\r\n const source = c.findDirectExpression(abaplint.Expressions.SQLSource);\r\n if (fieldName === undefined || operator === undefined || source === undefined) {\r\n throw new Error(\"SQL Condition, transpiler todo, \" + c.concatTokens());\r\n }\r\n ret += fieldName.concatTokens() + \" \" + operator.concatTokens() + \" \";\r\n const simple = source.findDirectExpression(abaplint.Expressions.SimpleSource3);\r\n if (simple && simple.findDirectExpression(abaplint.Expressions.Constant) === undefined) {\r\n ret += \"'\\\" + \" + new expressions_1.SimpleSource3Transpiler(true).transpile(simple, traversal).getCode() + \" + \\\"'\";\r\n }\r\n else {\r\n ret += source.concatTokens();\r\n }\r\n return ret;\r\n }\r\n isWhereExpression(node, expression) {\r\n // check if previous token before sqlCond is \"WHERE\". It could also be \"ON\" in case of join condition\r\n let prevToken;\r\n const sqlCondToken = expression.getFirstToken();\r\n for (const token of node.getTokens()) {\r\n if (token.getStart() === sqlCondToken.getStart()) {\r\n break;\r\n }\r\n prevToken = token;\r\n }\r\n if (prevToken && prevToken.getStr() === \"WHERE\") {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n}\r\nexports.SelectTranspiler = SelectTranspiler;\r\n//# sourceMappingURL=select.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/select.js?");
|
|
14803
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nconst unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ \"./node_modules/@abaplint/transpiler/build/src/unique_identifier.js\");\r\nclass SelectTranspiler {\r\n transpile(node, traversal, targetOverride) {\r\n var _a, _b, _c, _d;\r\n let target = \"undefined\";\r\n if (targetOverride) {\r\n target = targetOverride;\r\n }\r\n else if (node.findFirstExpression(abaplint.Expressions.Target)) {\r\n target = traversal.traverse(node.findFirstExpression(abaplint.Expressions.Target)).getCode();\r\n }\r\n let select = \"SELECT \";\r\n const fieldList = node.findFirstExpression(abaplint.Expressions.SQLFieldList)\r\n || node.findFirstExpression(abaplint.Expressions.SQLFieldListLoop);\r\n if ((fieldList === null || fieldList === void 0 ? void 0 : fieldList.getChildren().length) === 1) {\r\n select += fieldList.concatTokens();\r\n }\r\n else {\r\n // add commas between field names, this is required for SQLite, and easy to remove in other clients?\r\n select += fieldList === null || fieldList === void 0 ? void 0 : fieldList.findAllExpressions(abaplint.Expressions.SQLField).map(e => e.concatTokens()).join(\", \");\r\n }\r\n select += \" \";\r\n select += ((_a = node.findFirstExpression(abaplint.Expressions.SQLFrom)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + \" \";\r\n let where = undefined;\r\n for (const sqlCond of node.findAllExpressions(abaplint.Expressions.SQLCond)) {\r\n if (this.isWhereExpression(node, sqlCond)) {\r\n where = sqlCond;\r\n }\r\n }\r\n if (where) {\r\n select += \"WHERE \" + traversal.traverse(where).getCode() + \" \";\r\n }\r\n const upTo = node.findFirstExpression(abaplint.Expressions.SQLUpTo);\r\n if (upTo) {\r\n const s = upTo.findFirstExpression(abaplint.Expressions.SimpleSource3);\r\n if (s) {\r\n select += `UP TO \" + ${new expressions_1.SourceTranspiler(true).transpile(s, traversal).getCode()} + \" ROWS `;\r\n }\r\n else {\r\n select += upTo.concatTokens() + \" \";\r\n }\r\n }\r\n const orderBy = node.findFirstExpression(abaplint.Expressions.SQLOrderBy);\r\n if (orderBy) {\r\n select += orderBy.concatTokens() + \" \";\r\n }\r\n for (const d of node.findAllExpressionsRecursive(abaplint.Expressions.Dynamic)) {\r\n const chain = d.findFirstExpression(abaplint.Expressions.FieldChain);\r\n if (chain) {\r\n const code = new expressions_1.FieldChainTranspiler(true).transpile(chain, traversal).getCode();\r\n const search = d.concatTokens();\r\n select = select.replace(search, `\" + ${code} + \"`);\r\n }\r\n }\r\n if (node.concatTokens().toUpperCase().startsWith(\"SELECT SINGLE \")) {\r\n select += \"UP TO 1 ROWS\";\r\n }\r\n let runtimeOptions = \"\";\r\n if (node.concatTokens().toUpperCase().includes(\" APPENDING TABLE \")) {\r\n runtimeOptions = `, {appending: true}`;\r\n }\r\n let extra = \"\";\r\n const keys = this.findKeys(node, traversal);\r\n if (keys.length > 0) {\r\n extra = `, primaryKey: ${JSON.stringify(keys)}`;\r\n }\r\n if (node.findFirstExpression(abaplint.Expressions.SQLForAllEntries)) {\r\n const unique = unique_identifier_1.UniqueIdentifier.get();\r\n const faeName = (_d = (_c = (_b = node.findFirstExpression(abaplint.Expressions.SQLForAllEntries)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(abaplint.Expressions.SQLSource)) === null || _c === void 0 ? void 0 : _c.concatTokens()) === null || _d === void 0 ? void 0 : _d.toLowerCase();\r\n select = select.replace(new RegExp(\" \" + faeName, \"g\"), \" \" + unique);\r\n select = select.replace(unique + \".get().table_line.get()\", unique + \".get()\"); // there can be only one?\r\n const code = `if (${faeName}.array().length === 0) {\r\n throw \"FAE, todo, empty table\";\r\n} else {\r\n abap.statements.clear(${target});\r\n for await (const ${unique} of abap.statements.loop(${faeName})) {\r\n await abap.statements.select(${target}, {select: \"${select.trim()}\"${extra}}, {appending: true});\r\n }\r\n abap.builtin.sy.get().dbcnt.set(${target}.array().length);\r\n}`;\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n else {\r\n return new chunk_1.Chunk().append(`await abap.statements.select(${target}, {select: \"${select.trim()}\"${extra}}${runtimeOptions});`, node, traversal);\r\n }\r\n }\r\n findKeys(node, traversal) {\r\n let keys = [];\r\n const from = node.findAllExpressions(abaplint.Expressions.SQLFromSource).map(e => e.concatTokens());\r\n if (from.length === 1) {\r\n const tabl = traversal.findTable(from[0]);\r\n if (tabl) {\r\n keys = tabl.listKeys().map(k => k.toLowerCase());\r\n }\r\n }\r\n return keys;\r\n }\r\n isWhereExpression(node, expression) {\r\n // check if previous token before sqlCond is \"WHERE\". It could also be \"ON\" in case of join condition\r\n let prevToken;\r\n const sqlCondToken = expression.getFirstToken();\r\n for (const token of node.getTokens()) {\r\n if (token.getStart() === sqlCondToken.getStart()) {\r\n break;\r\n }\r\n prevToken = token;\r\n }\r\n if (prevToken && prevToken.getStr() === \"WHERE\") {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n}\r\nexports.SelectTranspiler = SelectTranspiler;\r\n//# sourceMappingURL=select.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/select.js?");
|
|
14793
14804
|
|
|
14794
14805
|
/***/ }),
|
|
14795
14806
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.70",
|
|
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.1.
|
|
28
|
+
"@abaplint/transpiler": "^2.1.70",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "=7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|