@abaplint/cli 2.113.247 → 2.114.0

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/cli.js +159 -11
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -28026,7 +28026,7 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modu
28026
28026
  const isSimple = /^\w+$/;
28027
28027
  class Select {
28028
28028
  static runSyntax(node, input, skipImplicitInto = false) {
28029
- var _a, _b;
28029
+ var _a;
28030
28030
  const token = node.getFirstToken();
28031
28031
  let from = node.findDirectExpression(Expressions.SQLFrom);
28032
28032
  if (from === undefined) {
@@ -28047,10 +28047,8 @@ class Select {
28047
28047
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
28048
28048
  return;
28049
28049
  }
28050
- const isSingle = ((_a = node.getChildren()[1]) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) === "SINGLE"
28051
- || node.get() instanceof Expressions.SelectLoop;
28052
28050
  this.checkFields(fields, dbSources, input, node);
28053
- this.handleInto(node, input, fields, dbSources, isSingle);
28051
+ const intoExpression = this.handleInto(node, input, fields, dbSources);
28054
28052
  const fae = node.findDirectExpression(Expressions.SQLForAllEntries);
28055
28053
  if (fae) {
28056
28054
  input.scope.push(_scope_type_1.ScopeType.OpenSQL, "SELECT", token.getStart(), input.filename);
@@ -28064,7 +28062,7 @@ class Select {
28064
28062
  && node.findDirectExpression(Expressions.SQLIntoTable) === undefined
28065
28063
  && node.findDirectExpression(Expressions.SQLIntoList) === undefined
28066
28064
  && node.findDirectExpression(Expressions.SQLIntoStructure) === undefined) {
28067
- const fields = (_b = node.findFirstExpression(Expressions.SQLAggregation)) === null || _b === void 0 ? void 0 : _b.concatTokens();
28065
+ const fields = (_a = node.findFirstExpression(Expressions.SQLAggregation)) === null || _a === void 0 ? void 0 : _a.concatTokens();
28068
28066
  const c = new RegExp(/^count\(\s*\*\s*\)$/, "i");
28069
28067
  if (fields === undefined || c.test(fields) === false) {
28070
28068
  const nameToken = from === null || from === void 0 ? void 0 : from.findDirectExpression(Expressions.SQLFromSource);
@@ -28098,8 +28096,18 @@ class Select {
28098
28096
  for (const s of node.findAllExpressions(Expressions.SQLCompare)) {
28099
28097
  sql_compare_1.SQLCompare.runSyntax(s, input, dbSources);
28100
28098
  }
28101
- for (const s of node.findDirectExpressions(Expressions.SQLOrderBy)) {
28102
- sql_order_by_1.SQLOrderBy.runSyntax(s, input);
28099
+ const orderBy = node.findDirectExpression(Expressions.SQLOrderBy);
28100
+ if (orderBy) {
28101
+ sql_order_by_1.SQLOrderBy.runSyntax(orderBy, input);
28102
+ const where = node.findDirectExpression(Expressions.SQLCond);
28103
+ if (intoExpression
28104
+ && where
28105
+ && intoExpression.getFirstToken().getStart().isBefore(orderBy.getFirstToken().getStart())
28106
+ && where.getFirstToken().getStart().isBefore(orderBy.getFirstToken().getStart())
28107
+ && where.getFirstToken().getStart().isBefore(intoExpression.getFirstToken().getStart())) {
28108
+ const message = `ORDER BY must be before INTO, after WHERE`;
28109
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, orderBy.getFirstToken(), message));
28110
+ }
28103
28111
  }
28104
28112
  if (this.isStrictMode(node)) {
28105
28113
  this.strictModeChecks(node, input);
@@ -28150,13 +28158,14 @@ class Select {
28150
28158
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
28151
28159
  }
28152
28160
  }
28153
- static handleInto(node, input, fields, dbSources, _isSingle) {
28161
+ static handleInto(node, input, fields, dbSources) {
28154
28162
  const intoTable = node.findDirectExpression(Expressions.SQLIntoTable);
28155
28163
  if (intoTable) {
28156
28164
  const inline = intoTable.findFirstExpression(Expressions.InlineData);
28157
28165
  if (inline) {
28158
28166
  inline_data_1.InlineData.runSyntax(inline, input, this.buildTableType(fields, dbSources, input.scope));
28159
28167
  }
28168
+ return intoTable;
28160
28169
  }
28161
28170
  const intoStructure = node.findDirectExpression(Expressions.SQLIntoStructure);
28162
28171
  if (intoStructure) {
@@ -28170,6 +28179,7 @@ class Select {
28170
28179
  inline_data_1.InlineData.runSyntax(inline, input, basic_1.VoidType.get("SELECT_todo1"));
28171
28180
  }
28172
28181
  }
28182
+ return intoStructure;
28173
28183
  }
28174
28184
  const intoList = node.findDirectExpression(Expressions.SQLIntoList);
28175
28185
  if (intoList) {
@@ -28209,7 +28219,9 @@ class Select {
28209
28219
  inline_data_1.InlineData.runSyntax(inline, input, type);
28210
28220
  }
28211
28221
  }
28222
+ return intoList;
28212
28223
  }
28224
+ return undefined;
28213
28225
  }
28214
28226
  static checkFields(fields, dbSources, input, node) {
28215
28227
  if (dbSources.length > 1) {
@@ -48878,6 +48890,37 @@ exports.EcattTestScript = EcattTestScript;
48878
48890
 
48879
48891
  /***/ }),
48880
48892
 
48893
+ /***/ "./node_modules/@abaplint/core/build/src/objects/email_template.js":
48894
+ /*!*************************************************************************!*\
48895
+ !*** ./node_modules/@abaplint/core/build/src/objects/email_template.js ***!
48896
+ \*************************************************************************/
48897
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
48898
+
48899
+ "use strict";
48900
+
48901
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
48902
+ exports.EmailTemplate = void 0;
48903
+ const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "./node_modules/@abaplint/core/build/src/objects/_abstract_object.js");
48904
+ class EmailTemplate extends _abstract_object_1.AbstractObject {
48905
+ getType() {
48906
+ return "SMTG";
48907
+ }
48908
+ getAllowedNaming() {
48909
+ return {
48910
+ maxLength: 60, // todo
48911
+ allowNamespace: true,
48912
+ };
48913
+ }
48914
+ getDescription() {
48915
+ // todo
48916
+ return undefined;
48917
+ }
48918
+ }
48919
+ exports.EmailTemplate = EmailTemplate;
48920
+ //# sourceMappingURL=email_template.js.map
48921
+
48922
+ /***/ }),
48923
+
48881
48924
  /***/ "./node_modules/@abaplint/core/build/src/objects/enhancement_implementation.js":
48882
48925
  /*!*************************************************************************************!*\
48883
48926
  !*** ./node_modules/@abaplint/core/build/src/objects/enhancement_implementation.js ***!
@@ -50167,7 +50210,6 @@ __exportStar(__webpack_require__(/*! ./behavior_definition */ "./node_modules/@a
50167
50210
  __exportStar(__webpack_require__(/*! ./brf_plus_system_application */ "./node_modules/@abaplint/core/build/src/objects/brf_plus_system_application.js"), exports);
50168
50211
  __exportStar(__webpack_require__(/*! ./bsp_application */ "./node_modules/@abaplint/core/build/src/objects/bsp_application.js"), exports);
50169
50212
  __exportStar(__webpack_require__(/*! ./business_add_in_implementation */ "./node_modules/@abaplint/core/build/src/objects/business_add_in_implementation.js"), exports);
50170
- __exportStar(__webpack_require__(/*! ./cds_entity_buffer */ "./node_modules/@abaplint/core/build/src/objects/cds_entity_buffer.js"), exports);
50171
50213
  __exportStar(__webpack_require__(/*! ./business_catalog_app_assignment */ "./node_modules/@abaplint/core/build/src/objects/business_catalog_app_assignment.js"), exports);
50172
50214
  __exportStar(__webpack_require__(/*! ./business_catalog */ "./node_modules/@abaplint/core/build/src/objects/business_catalog.js"), exports);
50173
50215
  __exportStar(__webpack_require__(/*! ./business_configuration_maintenance_object */ "./node_modules/@abaplint/core/build/src/objects/business_configuration_maintenance_object.js"), exports);
@@ -50176,6 +50218,7 @@ __exportStar(__webpack_require__(/*! ./business_function_assignment */ "./node_m
50176
50218
  __exportStar(__webpack_require__(/*! ./business_function_set_assignment */ "./node_modules/@abaplint/core/build/src/objects/business_function_set_assignment.js"), exports);
50177
50219
  __exportStar(__webpack_require__(/*! ./business_object_model */ "./node_modules/@abaplint/core/build/src/objects/business_object_model.js"), exports);
50178
50220
  __exportStar(__webpack_require__(/*! ./business_object_type */ "./node_modules/@abaplint/core/build/src/objects/business_object_type.js"), exports);
50221
+ __exportStar(__webpack_require__(/*! ./cds_entity_buffer */ "./node_modules/@abaplint/core/build/src/objects/cds_entity_buffer.js"), exports);
50179
50222
  __exportStar(__webpack_require__(/*! ./cds_metadata_extension */ "./node_modules/@abaplint/core/build/src/objects/cds_metadata_extension.js"), exports);
50180
50223
  __exportStar(__webpack_require__(/*! ./cds_type */ "./node_modules/@abaplint/core/build/src/objects/cds_type.js"), exports);
50181
50224
  __exportStar(__webpack_require__(/*! ./change_document */ "./node_modules/@abaplint/core/build/src/objects/change_document.js"), exports);
@@ -50201,6 +50244,7 @@ __exportStar(__webpack_require__(/*! ./domain */ "./node_modules/@abaplint/core/
50201
50244
  __exportStar(__webpack_require__(/*! ./ecatt_test_configuration */ "./node_modules/@abaplint/core/build/src/objects/ecatt_test_configuration.js"), exports);
50202
50245
  __exportStar(__webpack_require__(/*! ./ecatt_test_data_container */ "./node_modules/@abaplint/core/build/src/objects/ecatt_test_data_container.js"), exports);
50203
50246
  __exportStar(__webpack_require__(/*! ./ecatt_test_script */ "./node_modules/@abaplint/core/build/src/objects/ecatt_test_script.js"), exports);
50247
+ __exportStar(__webpack_require__(/*! ./email_template */ "./node_modules/@abaplint/core/build/src/objects/email_template.js"), exports);
50204
50248
  __exportStar(__webpack_require__(/*! ./enhancement_implementation */ "./node_modules/@abaplint/core/build/src/objects/enhancement_implementation.js"), exports);
50205
50249
  __exportStar(__webpack_require__(/*! ./enhancement_spot */ "./node_modules/@abaplint/core/build/src/objects/enhancement_spot.js"), exports);
50206
50250
  __exportStar(__webpack_require__(/*! ./entity_type */ "./node_modules/@abaplint/core/build/src/objects/entity_type.js"), exports);
@@ -53256,6 +53300,13 @@ class Table extends _abstract_object_1.AbstractObject {
53256
53300
  }
53257
53301
  return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.description;
53258
53302
  }
53303
+ getSecondaryIndexes() {
53304
+ var _a;
53305
+ if (this.parsedData === undefined) {
53306
+ this.parseXML();
53307
+ }
53308
+ return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.secondaryIndexes;
53309
+ }
53259
53310
  getAllowedNaming() {
53260
53311
  let length = 30;
53261
53312
  const regex = /^((\/[A-Z_\d]{3,8}\/)|[a-zA-Z0-9]{3}|CI_)\w+$/;
@@ -53483,7 +53534,7 @@ class Table extends _abstract_object_1.AbstractObject {
53483
53534
  }
53484
53535
  ///////////////
53485
53536
  parseXML() {
53486
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
53537
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
53487
53538
  const parsed = super.parseRaw2();
53488
53539
  if (parsed === undefined) {
53489
53540
  return;
@@ -53522,6 +53573,25 @@ class Table extends _abstract_object_1.AbstractObject {
53522
53573
  DDTEXT: field.DDTEXT,
53523
53574
  });
53524
53575
  }
53576
+ // secondary indexes
53577
+ const indexes = (_m = parsed.abapGit["asx:abap"]["asx:values"]) === null || _m === void 0 ? void 0 : _m.DD12V;
53578
+ ;
53579
+ this.parsedData.secondaryIndexes = [];
53580
+ for (const index of (0, xml_utils_1.xmlToArray)(indexes === null || indexes === void 0 ? void 0 : indexes.DD12V)) {
53581
+ const indexName = index.INDEXNAME;
53582
+ const indexFields = [];
53583
+ const indexFieldsXml = (_o = parsed.abapGit["asx:abap"]["asx:values"]) === null || _o === void 0 ? void 0 : _o.DD17V;
53584
+ for (const indexField of (0, xml_utils_1.xmlToArray)(indexFieldsXml === null || indexFieldsXml === void 0 ? void 0 : indexFieldsXml.DD17V)) {
53585
+ if (indexField.INDEXNAME === indexName) {
53586
+ // assumption: fields are listed by POSITION in the xml
53587
+ indexFields.push(indexField.FIELDNAME);
53588
+ }
53589
+ }
53590
+ this.parsedData.secondaryIndexes.push({
53591
+ name: indexName,
53592
+ fields: indexFields,
53593
+ });
53594
+ }
53525
53595
  }
53526
53596
  }
53527
53597
  exports.Table = Table;
@@ -54879,7 +54949,7 @@ class Registry {
54879
54949
  }
54880
54950
  static abaplintVersion() {
54881
54951
  // magic, see build script "version.sh"
54882
- return "2.113.247";
54952
+ return "2.114.0";
54883
54953
  }
54884
54954
  getDDICReferences() {
54885
54955
  return this.ddicReferences;
@@ -66239,6 +66309,7 @@ __exportStar(__webpack_require__(/*! ./implement_methods */ "./node_modules/@aba
66239
66309
  __exportStar(__webpack_require__(/*! ./implicit_start_of_selection */ "./node_modules/@abaplint/core/build/src/rules/implicit_start_of_selection.js"), exports);
66240
66310
  __exportStar(__webpack_require__(/*! ./in_statement_indentation */ "./node_modules/@abaplint/core/build/src/rules/in_statement_indentation.js"), exports);
66241
66311
  __exportStar(__webpack_require__(/*! ./indentation */ "./node_modules/@abaplint/core/build/src/rules/indentation.js"), exports);
66312
+ __exportStar(__webpack_require__(/*! ./index_completely_contained */ "./node_modules/@abaplint/core/build/src/rules/index_completely_contained.js"), exports);
66242
66313
  __exportStar(__webpack_require__(/*! ./inline_data_old_versions */ "./node_modules/@abaplint/core/build/src/rules/inline_data_old_versions.js"), exports);
66243
66314
  __exportStar(__webpack_require__(/*! ./intf_referencing_clas */ "./node_modules/@abaplint/core/build/src/rules/intf_referencing_clas.js"), exports);
66244
66315
  __exportStar(__webpack_require__(/*! ./invalid_table_index */ "./node_modules/@abaplint/core/build/src/rules/invalid_table_index.js"), exports);
@@ -66345,6 +66416,83 @@ __exportStar(__webpack_require__(/*! ./xml_consistency */ "./node_modules/@abapl
66345
66416
 
66346
66417
  /***/ }),
66347
66418
 
66419
+ /***/ "./node_modules/@abaplint/core/build/src/rules/index_completely_contained.js":
66420
+ /*!***********************************************************************************!*\
66421
+ !*** ./node_modules/@abaplint/core/build/src/rules/index_completely_contained.js ***!
66422
+ \***********************************************************************************/
66423
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
66424
+
66425
+ "use strict";
66426
+
66427
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
66428
+ exports.IndexCompletelyContained = exports.IndexCompletelyContainedConf = void 0;
66429
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
66430
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
66431
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
66432
+ const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
66433
+ const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
66434
+ class IndexCompletelyContainedConf extends _basic_rule_config_1.BasicRuleConfig {
66435
+ }
66436
+ exports.IndexCompletelyContainedConf = IndexCompletelyContainedConf;
66437
+ class IndexCompletelyContained {
66438
+ constructor() {
66439
+ this.conf = new IndexCompletelyContainedConf();
66440
+ }
66441
+ getMetadata() {
66442
+ return {
66443
+ key: "index_completely_contained",
66444
+ title: "Check if database table indexes are completely contained",
66445
+ shortDescription: `If indexes are completely contained in other indexes, they can be removed to improve performance.`,
66446
+ tags: [_irule_1.RuleTag.Performance],
66447
+ };
66448
+ }
66449
+ initialize() {
66450
+ return this;
66451
+ }
66452
+ getConfig() {
66453
+ return this.conf;
66454
+ }
66455
+ setConfig(conf) {
66456
+ this.conf = conf;
66457
+ }
66458
+ run(obj) {
66459
+ if (!(obj instanceof Objects.Table)) {
66460
+ return [];
66461
+ }
66462
+ const indexes = obj.getSecondaryIndexes();
66463
+ if (indexes === undefined || indexes.length === 0) {
66464
+ return [];
66465
+ }
66466
+ const issues = [];
66467
+ for (let i = 0; i < indexes.length; i++) {
66468
+ const indexA = indexes[i];
66469
+ for (let j = 0; j < indexes.length; j++) {
66470
+ if (i === j) {
66471
+ continue;
66472
+ }
66473
+ const indexB = indexes[j];
66474
+ let contained = true;
66475
+ for (const field of indexA.fields) {
66476
+ if (indexB.fields.indexOf(field) === -1) {
66477
+ contained = false;
66478
+ break;
66479
+ }
66480
+ }
66481
+ if (contained) {
66482
+ const position = new position_1.Position(1, 1);
66483
+ const message = `Index "${indexA.name}" is completely contained in index "${indexB.name}"`;
66484
+ issues.push(issue_1.Issue.atPosition(obj.getFiles()[0], position, message, this.getMetadata().key, this.conf.severity));
66485
+ }
66486
+ }
66487
+ }
66488
+ return issues;
66489
+ }
66490
+ }
66491
+ exports.IndexCompletelyContained = IndexCompletelyContained;
66492
+ //# sourceMappingURL=index_completely_contained.js.map
66493
+
66494
+ /***/ }),
66495
+
66348
66496
  /***/ "./node_modules/@abaplint/core/build/src/rules/inline_data_old_versions.js":
66349
66497
  /*!*********************************************************************************!*\
66350
66498
  !*** ./node_modules/@abaplint/core/build/src/rules/inline_data_old_versions.js ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.113.247",
3
+ "version": "2.114.0",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.113.247",
41
+ "@abaplint/core": "^2.114.0",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",