@abaplint/cli 2.119.20 → 2.119.21

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 +329 -50
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -8614,6 +8614,7 @@ const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules
8614
8614
  const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
8615
8615
  const integer_1 = __webpack_require__(/*! ./integer */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/integer.js");
8616
8616
  const sql_function_input_1 = __webpack_require__(/*! ./sql_function_input */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_function_input.js");
8617
+ const sql_case_1 = __webpack_require__(/*! ./sql_case */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_case.js");
8617
8618
  class SQLFunction extends combi_1.Expression {
8618
8619
  getRunnable() {
8619
8620
  const castTypes = (0, combi_1.altPrio)((0, combi_1.seq)("CHAR", (0, combi_1.optPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)))), (0, combi_1.seq)("DEC", (0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, ",", integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.seq)("NUMC", (0, combi_1.optPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)))), "DATS", "FLTP", "INT2", "INT4", "INT8");
@@ -8621,7 +8622,8 @@ class SQLFunction extends combi_1.Expression {
8621
8622
  // note: the function names are not keywords, they are usually in lower case
8622
8623
  const abs = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^abs$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
8623
8624
  // yea, 750 is correct, but it also works technically in version v740sp05
8624
- const cast = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^cast$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, "AS", castTypes, (0, combi_1.tok)(tokens_1.WParenRightW)));
8625
+ const castInput = (0, combi_1.altPrio)(sql_case_1.SQLCase, sql_function_input_1.SQLFunctionInput);
8626
+ const cast = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^cast$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), castInput, "AS", castTypes, (0, combi_1.tok)(tokens_1.WParenRightW)));
8625
8627
  const ceil = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^ceil$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
8626
8628
  const coalesce = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^coalesce$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.optPrio)(commaParam), (0, combi_1.tok)(tokens_1.WParenRightW)));
8627
8629
  const concat = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^concat$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
@@ -31562,7 +31564,9 @@ const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ ".
31562
31564
  const basic_types_1 = __webpack_require__(/*! ../basic_types */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js");
31563
31565
  const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
31564
31566
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
31567
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
31565
31568
  const assert_error_1 = __webpack_require__(/*! ../assert_error */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/assert_error.js");
31569
+ const basic_2 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
31566
31570
  class Constant {
31567
31571
  runSyntax(node, input) {
31568
31572
  const basic = new basic_types_1.BasicTypes(input);
@@ -31570,14 +31574,29 @@ class Constant {
31570
31574
  if (found) {
31571
31575
  const val = basic.findValue(node);
31572
31576
  const meta = ["read_only" /* IdentifierMeta.ReadOnly */, "static" /* IdentifierMeta.Static */];
31577
+ if (this.isOnlyDigits(found.getName()) && this.allowOnlyDigitsName(node, input) === false) {
31578
+ const message = "not possible to have a name with only digits";
31579
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, found.getToken(), message));
31580
+ return new _typed_identifier_1.TypedIdentifier(found.getToken(), input.filename, basic_2.VoidType.get(_syntax_input_1.CheckSyntaxKey), meta, val);
31581
+ }
31573
31582
  return new _typed_identifier_1.TypedIdentifier(found.getToken(), input.filename, found.getType(), meta, val);
31574
31583
  }
31575
31584
  const fallback = node.findFirstExpression(Expressions.DefinitionName);
31576
31585
  if (fallback) {
31586
+ if (this.isOnlyDigits(fallback.concatTokens()) && this.allowOnlyDigitsName(node, input) === false) {
31587
+ const message = "not possible to have a name with only digits";
31588
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, fallback.getFirstToken(), message));
31589
+ }
31577
31590
  return new _typed_identifier_1.TypedIdentifier(fallback.getFirstToken(), input.filename, new basic_1.UnknownType("constant, fallback"));
31578
31591
  }
31579
31592
  throw new assert_error_1.AssertError("Statement Constant: unexpected structure");
31580
31593
  }
31594
+ isOnlyDigits(name) {
31595
+ return /^[0-9]+$/.test(name);
31596
+ }
31597
+ allowOnlyDigitsName(node, input) {
31598
+ return input.scope.isAnyOO() === false && node.getColon() !== undefined;
31599
+ }
31581
31600
  }
31582
31601
  exports.Constant = Constant;
31583
31602
  //# sourceMappingURL=constant.js.map
@@ -31992,6 +32011,11 @@ class Data {
31992
32011
  const dd = node.findFirstExpression(Expressions.DataDefinition);
31993
32012
  if (dd) {
31994
32013
  const id = data_definition_1.DataDefinition.runSyntax(dd, input);
32014
+ if (id && this.isOnlyDigits(id.getName())) {
32015
+ const message = "not possible to have a name with only digits";
32016
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, id.getToken(), message));
32017
+ return new _typed_identifier_1.TypedIdentifier(id.getToken(), input.filename, basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey));
32018
+ }
31995
32019
  if ((id === null || id === void 0 ? void 0 : id.getType().isGeneric()) === true
31996
32020
  && (id === null || id === void 0 ? void 0 : id.getType().containsVoid()) === false) {
31997
32021
  const message = "DATA definition cannot be generic, " + (name === null || name === void 0 ? void 0 : name.concatTokens());
@@ -32001,10 +32025,17 @@ class Data {
32001
32025
  return id;
32002
32026
  }
32003
32027
  if (name) {
32028
+ if (this.isOnlyDigits(name.concatTokens())) {
32029
+ const message = "not possible to have a name with only digits";
32030
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, name.getFirstToken(), message));
32031
+ }
32004
32032
  return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), input.filename, new unknown_type_1.UnknownType("data, fallback"));
32005
32033
  }
32006
32034
  return undefined;
32007
32035
  }
32036
+ isOnlyDigits(name) {
32037
+ return /^[0-9]+$/.test(name);
32038
+ }
32008
32039
  }
32009
32040
  exports.Data = Data;
32010
32041
  //# sourceMappingURL=data.js.map
@@ -47299,6 +47330,7 @@ class ABAPObject extends _abstract_object_1.AbstractObject {
47299
47330
  super(name);
47300
47331
  this.parsed = [];
47301
47332
  this.texts = undefined;
47333
+ this.rawXMLCache = undefined;
47302
47334
  }
47303
47335
  static is(x) {
47304
47336
  return !!x && x instanceof ABAPObject;
@@ -47317,9 +47349,18 @@ class ABAPObject extends _abstract_object_1.AbstractObject {
47317
47349
  setDirty() {
47318
47350
  this.syntaxResult = undefined;
47319
47351
  this.texts = undefined;
47352
+ this.textsTranslations = undefined;
47353
+ this.rawXMLCache = undefined;
47320
47354
  this.parsed = [];
47321
47355
  super.setDirty();
47322
47356
  }
47357
+ getParsedXML() {
47358
+ var _a, _b;
47359
+ if (this.rawXMLCache === undefined) {
47360
+ this.rawXMLCache = (_a = this.parseRaw2()) !== null && _a !== void 0 ? _a : null;
47361
+ }
47362
+ return (_b = this.rawXMLCache) !== null && _b !== void 0 ? _b : undefined;
47363
+ }
47323
47364
  getABAPFiles() {
47324
47365
  return this.parsed;
47325
47366
  }
@@ -47350,29 +47391,67 @@ class ABAPObject extends _abstract_object_1.AbstractObject {
47350
47391
  }
47351
47392
  return undefined;
47352
47393
  }
47353
- getTexts() {
47394
+ getTextSymbols() {
47395
+ var _a;
47354
47396
  if (this.texts === undefined) {
47355
- this.findTexts(this.parseRaw2());
47397
+ this.findTexts(this.getParsedXML());
47356
47398
  }
47357
- return this.texts;
47399
+ return (_a = this.texts["I"]) !== null && _a !== void 0 ? _a : {};
47400
+ }
47401
+ getTextElements() {
47402
+ if (this.texts === undefined) {
47403
+ this.findTexts(this.getParsedXML());
47404
+ }
47405
+ const result = {};
47406
+ for (const elements of Object.values(this.texts)) {
47407
+ Object.assign(result, elements);
47408
+ }
47409
+ return result;
47410
+ }
47411
+ getTextElementsTranslations() {
47412
+ if (this.textsTranslations === undefined) {
47413
+ this.findTextsTranslations(this.getParsedXML());
47414
+ }
47415
+ return this.textsTranslations;
47358
47416
  }
47359
47417
  findTexts(parsed) {
47360
- var _a, _b, _c, _d;
47418
+ var _a, _b, _c, _d, _e, _f, _g;
47361
47419
  this.texts = {};
47362
47420
  if (((_d = (_c = (_b = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]) === null || _b === void 0 ? void 0 : _b["asx:values"]) === null || _c === void 0 ? void 0 : _c.TPOOL) === null || _d === void 0 ? void 0 : _d.item) === undefined) {
47363
47421
  return;
47364
47422
  }
47365
47423
  for (const t of (0, xml_utils_1.xmlToArray)(parsed.abapGit["asx:abap"]["asx:values"].TPOOL.item)) {
47366
- if ((t === null || t === void 0 ? void 0 : t.ID) === "I") {
47367
- if (t.KEY === undefined) {
47368
- throw new Error("findTexts, undefined");
47369
- }
47370
- const key = t.KEY;
47371
- if (key === undefined) {
47372
- continue;
47424
+ const id = (_e = t.ID) === null || _e === void 0 ? void 0 : _e.toUpperCase();
47425
+ if (id === undefined
47426
+ || (id !== "R" && t.KEY === undefined)) {
47427
+ throw new Error("findTexts, undefined");
47428
+ }
47429
+ const key = (_g = ((_f = t.KEY) !== null && _f !== void 0 ? _f : t.ID)) === null || _g === void 0 ? void 0 : _g.toUpperCase();
47430
+ if (key === undefined) {
47431
+ continue;
47432
+ }
47433
+ if (this.texts[id] === undefined) {
47434
+ this.texts[id] = {};
47435
+ }
47436
+ this.texts[id][key] = { entry: t.ENTRY ? (0, xml_utils_1.unescape)(t.ENTRY) : "", maxLength: parseInt(t.LENGTH, 10) };
47437
+ }
47438
+ }
47439
+ findTextsTranslations(parsed) {
47440
+ var _a, _b, _c, _d, _e, _f;
47441
+ this.textsTranslations = [];
47442
+ const values = (_c = (_b = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]) === null || _b === void 0 ? void 0 : _b["asx:values"].I18N_TPOOL) === null || _c === void 0 ? void 0 : _c.item;
47443
+ if (values === undefined) {
47444
+ return;
47445
+ }
47446
+ for (const langItem of (0, xml_utils_1.xmlToArray)(values)) {
47447
+ const textElements = {};
47448
+ for (const item of (0, xml_utils_1.xmlToArray)((_d = langItem.TEXTPOOL) === null || _d === void 0 ? void 0 : _d.item)) {
47449
+ const key = (_f = ((_e = item.KEY) !== null && _e !== void 0 ? _e : item.ID)) === null || _f === void 0 ? void 0 : _f.toUpperCase();
47450
+ if (key !== undefined) {
47451
+ textElements[key] = { entry: (0, xml_utils_1.unescape)(item.ENTRY), maxLength: parseInt(item.LENGTH, 10) };
47373
47452
  }
47374
- this.texts[key.toUpperCase()] = t.ENTRY ? (0, xml_utils_1.unescape)(t.ENTRY) : "";
47375
47453
  }
47454
+ this.textsTranslations.push({ language: langItem.LANGUAGE, textElements });
47376
47455
  }
47377
47456
  }
47378
47457
  }
@@ -49501,6 +49580,7 @@ exports.DataElement = void 0;
49501
49580
  const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "./node_modules/@abaplint/core/build/src/objects/_abstract_object.js");
49502
49581
  const ddic_1 = __webpack_require__(/*! ../ddic */ "./node_modules/@abaplint/core/build/src/ddic.js");
49503
49582
  const Types = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
49583
+ const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
49504
49584
  class DataElement extends _abstract_object_1.AbstractObject {
49505
49585
  constructor() {
49506
49586
  super(...arguments);
@@ -49536,6 +49616,16 @@ class DataElement extends _abstract_object_1.AbstractObject {
49536
49616
  this.parse();
49537
49617
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.texts;
49538
49618
  }
49619
+ getTextMaxLengths() {
49620
+ var _a;
49621
+ this.parse();
49622
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.textMaxLengths;
49623
+ }
49624
+ getTextsTranslations() {
49625
+ var _a;
49626
+ this.parse();
49627
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.textsTranslations;
49628
+ }
49539
49629
  parseType(reg) {
49540
49630
  var _a;
49541
49631
  const references = [];
@@ -49595,7 +49685,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
49595
49685
  return lookup.type;
49596
49686
  }
49597
49687
  parse() {
49598
- var _a, _b, _c;
49688
+ var _a, _b, _c, _d, _e, _f, _g;
49599
49689
  if (this.parsedXML !== undefined) {
49600
49690
  return { updated: false, runtime: 0 };
49601
49691
  }
@@ -49619,7 +49709,24 @@ class DataElement extends _abstract_object_1.AbstractObject {
49619
49709
  long: dd04v === null || dd04v === void 0 ? void 0 : dd04v.SCRTEXT_L,
49620
49710
  heading: dd04v === null || dd04v === void 0 ? void 0 : dd04v.REPTEXT,
49621
49711
  },
49712
+ textMaxLengths: {
49713
+ short: dd04v === null || dd04v === void 0 ? void 0 : dd04v.SCRLEN1,
49714
+ medium: dd04v === null || dd04v === void 0 ? void 0 : dd04v.SCRLEN2,
49715
+ long: dd04v === null || dd04v === void 0 ? void 0 : dd04v.SCRLEN3,
49716
+ heading: dd04v === null || dd04v === void 0 ? void 0 : dd04v.HEADLEN,
49717
+ },
49622
49718
  };
49719
+ this.parsedXML.textsTranslations = [];
49720
+ for (const item of (0, xml_utils_1.xmlToArray)((_g = (_f = (_e = (_d = parsed.abapGit) === null || _d === void 0 ? void 0 : _d["asx:abap"]) === null || _e === void 0 ? void 0 : _e["asx:values"]) === null || _f === void 0 ? void 0 : _f.DD04_TEXTS) === null || _g === void 0 ? void 0 : _g.item)) {
49721
+ this.parsedXML.textsTranslations.push({
49722
+ language: item.DDLANGUAGE,
49723
+ description: item.DDTEXT,
49724
+ short: item.SCRTEXT_S,
49725
+ medium: item.SCRTEXT_M,
49726
+ long: item.SCRTEXT_L,
49727
+ heading: item.REPTEXT,
49728
+ });
49729
+ }
49623
49730
  const end = Date.now();
49624
49731
  return { updated: true, runtime: end - start };
49625
49732
  }
@@ -49780,7 +49887,7 @@ class Domain extends _abstract_object_1.AbstractObject {
49780
49887
  });
49781
49888
  }
49782
49889
  parse() {
49783
- var _a, _b, _c, _d, _e, _f, _g;
49890
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
49784
49891
  if (this.parsedXML) {
49785
49892
  return { updated: false, runtime: 0 };
49786
49893
  }
@@ -49802,6 +49909,15 @@ class Domain extends _abstract_object_1.AbstractObject {
49802
49909
  };
49803
49910
  values.push(value);
49804
49911
  }
49912
+ const dd07v_texts = (0, xml_utils_1.xmlToArray)((_l = (_k = (_j = (_h = parsed.abapGit) === null || _h === void 0 ? void 0 : _h["asx:abap"]) === null || _j === void 0 ? void 0 : _j["asx:values"]) === null || _k === void 0 ? void 0 : _k.DD07_TEXTS) === null || _l === void 0 ? void 0 : _l.item);
49913
+ const translationValues = [];
49914
+ for (const dd07v of dd07v_texts) {
49915
+ const value = {
49916
+ language: dd07v === null || dd07v === void 0 ? void 0 : dd07v.DDLANGUAGE,
49917
+ description: dd07v === null || dd07v === void 0 ? void 0 : dd07v.DDTEXT,
49918
+ };
49919
+ translationValues.push(value);
49920
+ }
49805
49921
  this.parsedXML = {
49806
49922
  description: dd01v === null || dd01v === void 0 ? void 0 : dd01v.DDTEXT,
49807
49923
  datatype: dd01v === null || dd01v === void 0 ? void 0 : dd01v.DATATYPE,
@@ -49809,6 +49925,7 @@ class Domain extends _abstract_object_1.AbstractObject {
49809
49925
  conversionExit: dd01v === null || dd01v === void 0 ? void 0 : dd01v.CONVEXIT,
49810
49926
  decimals: dd01v === null || dd01v === void 0 ? void 0 : dd01v.DECIMALS,
49811
49927
  values: values,
49928
+ valuesTranslations: translationValues,
49812
49929
  };
49813
49930
  const end = Date.now();
49814
49931
  return { updated: true, runtime: end - start };
@@ -49817,6 +49934,10 @@ class Domain extends _abstract_object_1.AbstractObject {
49817
49934
  var _a, _b;
49818
49935
  return (_b = (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.values) !== null && _b !== void 0 ? _b : [];
49819
49936
  }
49937
+ getFixedValuesTranslations() {
49938
+ var _a, _b;
49939
+ return (_b = (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.valuesTranslations) !== null && _b !== void 0 ? _b : [];
49940
+ }
49820
49941
  }
49821
49942
  exports.Domain = Domain;
49822
49943
  //# sourceMappingURL=domain.js.map
@@ -50485,7 +50606,8 @@ class FunctionGroup extends _abap_object_1.ABAPObject {
50485
50606
  }
50486
50607
  return undefined;
50487
50608
  }
50488
- getTexts() {
50609
+ getTextSymbols() {
50610
+ var _a;
50489
50611
  if (this.texts === undefined) {
50490
50612
  const found = this.findTextFile();
50491
50613
  if (found === undefined) {
@@ -50494,7 +50616,7 @@ class FunctionGroup extends _abap_object_1.ABAPObject {
50494
50616
  const parsed = new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(found.getRaw());
50495
50617
  this.findTexts(parsed);
50496
50618
  }
50497
- return this.texts;
50619
+ return (_a = this.texts["I"]) !== null && _a !== void 0 ? _a : {};
50498
50620
  }
50499
50621
  /////////////////////////////////
50500
50622
  parseXML() {
@@ -51787,6 +51909,11 @@ class MessageClass extends _abstract_object_1.AbstractObject {
51787
51909
  this.parseXML();
51788
51910
  return this.xml;
51789
51911
  }
51912
+ getTextsTranslations() {
51913
+ var _a;
51914
+ this.parseXML();
51915
+ return (_a = this.xml) === null || _a === void 0 ? void 0 : _a.textsTranslations;
51916
+ }
51790
51917
  setDirty() {
51791
51918
  this.xml = undefined;
51792
51919
  super.setDirty();
@@ -51809,7 +51936,7 @@ class MessageClass extends _abstract_object_1.AbstractObject {
51809
51936
  }
51810
51937
  /////////////////////////////////
51811
51938
  parseXML() {
51812
- var _a, _b, _c, _d, _e, _f, _g, _h;
51939
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
51813
51940
  if (this.xml !== undefined) {
51814
51941
  return;
51815
51942
  }
@@ -51817,6 +51944,7 @@ class MessageClass extends _abstract_object_1.AbstractObject {
51817
51944
  topName: undefined,
51818
51945
  description: undefined,
51819
51946
  parsedMessages: [],
51947
+ textsTranslations: [],
51820
51948
  };
51821
51949
  const parsed = super.parseRaw2();
51822
51950
  if (parsed === undefined) {
@@ -51831,6 +51959,13 @@ class MessageClass extends _abstract_object_1.AbstractObject {
51831
51959
  for (const msg of (0, xml_utils_1.xmlToArray)(t100.T100)) {
51832
51960
  this.xml.parsedMessages.push(new message_1.Message(msg.MSGNR, (0, xml_utils_1.unescape)(msg.TEXT), msg.ARBGB));
51833
51961
  }
51962
+ const t100_texts = (_k = (_j = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _j === void 0 ? void 0 : _j["asx:abap"]["asx:values"]) === null || _k === void 0 ? void 0 : _k.T100_TEXTS;
51963
+ if (t100_texts === undefined) {
51964
+ return;
51965
+ }
51966
+ for (const item of (0, xml_utils_1.xmlToArray)(t100_texts === null || t100_texts === void 0 ? void 0 : t100_texts.item)) {
51967
+ this.xml.textsTranslations.push({ language: item.SPRSL, number: item.MSGNR, text: (0, xml_utils_1.unescape)(item.TEXT) });
51968
+ }
51834
51969
  }
51835
51970
  }
51836
51971
  exports.MessageClass = MessageClass;
@@ -53094,7 +53229,7 @@ class Program extends _abap_object_1.ABAPObject {
53094
53229
  description = t.ENTRY ? (0, xml_utils_1.unescape)(t.ENTRY) : "";
53095
53230
  }
53096
53231
  else if ((t === null || t === void 0 ? void 0 : t.ID) === "S" && t.KEY !== undefined) {
53097
- selectionTexts[t.KEY.toUpperCase()] = t.ENTRY ? (0, xml_utils_1.unescape)(t.ENTRY) : "";
53232
+ selectionTexts[t.KEY.toUpperCase()] = { entry: t.ENTRY ? (0, xml_utils_1.unescape)(t.ENTRY) : "", maxLength: parseInt(t.LENGTH, 10) };
53098
53233
  }
53099
53234
  }
53100
53235
  const dynpros = (0, _dynpros_1.parseDynpros)(parsed);
@@ -55207,6 +55342,7 @@ exports.TechnicalJobDefinition = TechnicalJobDefinition;
55207
55342
  Object.defineProperty(exports, "__esModule", ({ value: true }));
55208
55343
  exports.Transaction = void 0;
55209
55344
  const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "./node_modules/@abaplint/core/build/src/objects/_abstract_object.js");
55345
+ const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
55210
55346
  class Transaction extends _abstract_object_1.AbstractObject {
55211
55347
  getType() {
55212
55348
  return "TRAN";
@@ -55236,8 +55372,13 @@ class Transaction extends _abstract_object_1.AbstractObject {
55236
55372
  this.parse();
55237
55373
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.description;
55238
55374
  }
55375
+ getTextsTranslations() {
55376
+ var _a;
55377
+ this.parse();
55378
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.textsTranslations;
55379
+ }
55239
55380
  parse() {
55240
- var _a, _b, _c;
55381
+ var _a, _b, _c, _d;
55241
55382
  if (this.parsedXML) {
55242
55383
  return { updated: false, runtime: 0 };
55243
55384
  }
@@ -55252,6 +55393,10 @@ class Transaction extends _abstract_object_1.AbstractObject {
55252
55393
  this.parsedXML.description = (_a = parsed.abapGit["asx:abap"]["asx:values"].TSTCT) === null || _a === void 0 ? void 0 : _a.TTEXT;
55253
55394
  this.parsedXML.programName = (_b = parsed.abapGit["asx:abap"]["asx:values"].TSTC) === null || _b === void 0 ? void 0 : _b.PGMNA;
55254
55395
  this.parsedXML.cinfo = (_c = parsed.abapGit["asx:abap"]["asx:values"].TSTC) === null || _c === void 0 ? void 0 : _c.CINFO;
55396
+ this.parsedXML.textsTranslations = [];
55397
+ for (const item of (0, xml_utils_1.xmlToArray)((_d = parsed.abapGit["asx:abap"]["asx:values"].I18N_TPOOL) === null || _d === void 0 ? void 0 : _d.TSTCT)) {
55398
+ this.parsedXML.textsTranslations.push({ language: item.SPRSL, description: item.TTEXT });
55399
+ }
55255
55400
  const end = Date.now();
55256
55401
  return { updated: true, runtime: end - start };
55257
55402
  }
@@ -56312,7 +56457,7 @@ class Registry {
56312
56457
  }
56313
56458
  static abaplintVersion() {
56314
56459
  // magic, see build script "version.sh"
56315
- return "2.119.19";
56460
+ return "2.119.21";
56316
56461
  }
56317
56462
  getDDICReferences() {
56318
56463
  return this.ddicReferences;
@@ -60166,6 +60311,7 @@ class CheckTextElements {
60166
60311
  return this;
60167
60312
  }
60168
60313
  run(obj) {
60314
+ var _a;
60169
60315
  if (!(obj instanceof _abap_object_1.ABAPObject)) {
60170
60316
  return [];
60171
60317
  }
@@ -60185,10 +60331,10 @@ class CheckTextElements {
60185
60331
  // todo, this only checks the first main
60186
60332
  mainName = mains[0];
60187
60333
  const main1 = this.reg.findObjectForFile(this.reg.getFileByName(mains[0]));
60188
- texts = main1.getTexts();
60334
+ texts = main1.getTextSymbols();
60189
60335
  }
60190
60336
  else {
60191
- texts = obj.getTexts();
60337
+ texts = obj.getTextSymbols();
60192
60338
  }
60193
60339
  }
60194
60340
  for (const e of expressions) {
@@ -60205,8 +60351,8 @@ class CheckTextElements {
60205
60351
  const token = e.findFirstExpression(Expressions.TextElementKey).getFirstToken();
60206
60352
  const code = e.getFirstToken().getStr();
60207
60353
  const key = token.getStr().toUpperCase();
60208
- let found = texts[key];
60209
- if (found && code.startsWith("'")) {
60354
+ let found = (_a = texts[key]) === null || _a === void 0 ? void 0 : _a.entry;
60355
+ if (found !== undefined && code.startsWith("'")) {
60210
60356
  found = found.replace(/'/g, "''");
60211
60357
  }
60212
60358
  if (found === undefined) {
@@ -80534,6 +80680,7 @@ exports.XMLConsistency = exports.XMLConsistencyConf = void 0;
80534
80680
  const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
80535
80681
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
80536
80682
  const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
80683
+ const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
80537
80684
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
80538
80685
  const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "./node_modules/fast-xml-parser/lib/fxp.cjs");
80539
80686
  class XMLConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
@@ -80547,7 +80694,11 @@ class XMLConsistency {
80547
80694
  return {
80548
80695
  key: "xml_consistency",
80549
80696
  title: "XML consistency",
80550
- shortDescription: `Checks the consistency of main XML files, eg. naming for CLAS and INTF objects`,
80697
+ shortDescription: `Checks the consistency of main XML files`,
80698
+ extendedInformation: `Checks:
80699
+ * XML is well-formed and parseable
80700
+ * Naming for CLAS and INTF objects
80701
+ * Texts and translations do not exceed maximum allowed length.`,
80551
80702
  tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.Syntax],
80552
80703
  };
80553
80704
  }
@@ -80561,7 +80712,6 @@ class XMLConsistency {
80561
80712
  return this;
80562
80713
  }
80563
80714
  run(obj) {
80564
- var _a, _b;
80565
80715
  const issues = [];
80566
80716
  const file = obj.getXMLFile();
80567
80717
  if (file === undefined) {
@@ -80576,37 +80726,166 @@ class XMLConsistency {
80576
80726
  }
80577
80727
  // todo, have some XML validation in each object?
80578
80728
  if (obj instanceof Objects.Class) {
80579
- const name = obj.getNameFromXML();
80580
- if (name === undefined) {
80581
- issues.push(issue_1.Issue.atRow(file, 1, "Name undefined in XML", this.getMetadata().key, this.conf.severity));
80582
- }
80583
- else if (obj.getDescription() && obj.getDescription().length > 60) {
80584
- issues.push(issue_1.Issue.atRow(file, 1, "Description too long", this.getMetadata().key, this.conf.severity));
80585
- }
80586
- else if (name !== obj.getName().toUpperCase()) {
80587
- issues.push(issue_1.Issue.atRow(file, 1, "Name in XML does not match object", this.getMetadata().key, this.conf.severity));
80588
- }
80589
- else if (((_a = obj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getStructure()) !== undefined && obj.getClassDefinition() === undefined) {
80590
- issues.push(issue_1.Issue.atRow(file, 1, "Class matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
80591
- }
80729
+ issues.push(...this.runClass(obj, file));
80592
80730
  }
80593
80731
  else if (obj instanceof Objects.Interface) {
80594
- const name = obj.getNameFromXML();
80595
- if (name === undefined) {
80596
- issues.push(issue_1.Issue.atRow(file, 1, "Name undefined in XML", this.getMetadata().key, this.conf.severity));
80597
- }
80598
- else if (obj.getDescription() && obj.getDescription().length > 60) {
80599
- issues.push(issue_1.Issue.atRow(file, 1, "Description too long", this.getMetadata().key, this.conf.severity));
80732
+ issues.push(...this.runInterface(obj, file));
80733
+ }
80734
+ else if (obj instanceof Objects.DataElement) {
80735
+ issues.push(...this.runDataElement(obj, file));
80736
+ }
80737
+ else if (obj instanceof Objects.Domain) {
80738
+ issues.push(...this.runDomain(obj, file));
80739
+ }
80740
+ else if (obj instanceof Objects.Transaction) {
80741
+ issues.push(...this.runTransaction(obj, file));
80742
+ }
80743
+ else if (obj instanceof Objects.MessageClass) {
80744
+ issues.push(...this.runMessageClass(obj, file));
80745
+ }
80746
+ if (obj instanceof _abap_object_1.ABAPObject) {
80747
+ issues.push(...this.runTextPool(obj, file));
80748
+ }
80749
+ return issues;
80750
+ }
80751
+ runClass(obj, file) {
80752
+ var _a;
80753
+ const issues = [];
80754
+ const name = obj.getNameFromXML();
80755
+ if (name === undefined) {
80756
+ issues.push(issue_1.Issue.atRow(file, 1, "Name undefined in XML", this.getMetadata().key, this.conf.severity));
80757
+ }
80758
+ else if (obj.getDescription() && obj.getDescription().length > 60) {
80759
+ issues.push(issue_1.Issue.atRow(file, 1, "Description too long", this.getMetadata().key, this.conf.severity));
80760
+ }
80761
+ else if (name !== obj.getName().toUpperCase()) {
80762
+ issues.push(issue_1.Issue.atRow(file, 1, "Name in XML does not match object", this.getMetadata().key, this.conf.severity));
80763
+ }
80764
+ else if (((_a = obj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getStructure()) !== undefined && obj.getClassDefinition() === undefined) {
80765
+ issues.push(issue_1.Issue.atRow(file, 1, "Class matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
80766
+ }
80767
+ return issues;
80768
+ }
80769
+ runTextPool(obj, file) {
80770
+ const issues = [];
80771
+ const push = (issue) => { if (issue) {
80772
+ issues.push(issue);
80773
+ } };
80774
+ for (const [key, el] of Object.entries(obj.getTextElements())) {
80775
+ push(this.checkTextLength(file, `ENTRY[${key}]`, el.entry, el.maxLength));
80776
+ }
80777
+ for (const translation of obj.getTextElementsTranslations()) {
80778
+ for (const [key, el] of Object.entries(translation.textElements)) {
80779
+ push(this.checkTextLength(file, `ENTRY[${key}]`, el.entry, el.maxLength, translation.language));
80600
80780
  }
80601
- else if (name !== obj.getName().toUpperCase()) {
80602
- issues.push(issue_1.Issue.atRow(file, 1, "Name in XML does not match object", this.getMetadata().key, this.conf.severity));
80781
+ }
80782
+ return issues;
80783
+ }
80784
+ runInterface(obj, file) {
80785
+ var _a;
80786
+ const issues = [];
80787
+ const name = obj.getNameFromXML();
80788
+ if (name === undefined) {
80789
+ issues.push(issue_1.Issue.atRow(file, 1, "Name undefined in XML", this.getMetadata().key, this.conf.severity));
80790
+ }
80791
+ else if (obj.getDescription() && obj.getDescription().length > 60) {
80792
+ issues.push(issue_1.Issue.atRow(file, 1, "Description too long", this.getMetadata().key, this.conf.severity));
80793
+ }
80794
+ else if (name !== obj.getName().toUpperCase()) {
80795
+ issues.push(issue_1.Issue.atRow(file, 1, "Name in XML does not match object", this.getMetadata().key, this.conf.severity));
80796
+ }
80797
+ else if (obj.getDefinition() !== undefined && ((_a = obj.getDefinition()) === null || _a === void 0 ? void 0 : _a.getName().toUpperCase()) !== name.toUpperCase()) {
80798
+ issues.push(issue_1.Issue.atRow(file, 1, "Interface matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
80799
+ }
80800
+ return issues;
80801
+ }
80802
+ checkTextLength(file, fieldName, text, maxLength, lang) {
80803
+ if (text === undefined || maxLength === undefined) {
80804
+ return undefined;
80805
+ }
80806
+ const max = typeof maxLength === "number" ? maxLength : parseInt(maxLength, 10);
80807
+ if (text.length > max) {
80808
+ const prefix = lang ? `[${lang}] ` : "";
80809
+ return issue_1.Issue.atRow(file, 1, `${prefix}${fieldName} "${text}" exceeds maximum length of ${max} characters (actual: ${text.length})`, this.getMetadata().key, this.conf.severity);
80810
+ }
80811
+ return undefined;
80812
+ }
80813
+ runDataElement(obj, file) {
80814
+ var _a;
80815
+ const issues = [];
80816
+ const texts = obj.getTexts();
80817
+ const maxLengths = obj.getTextMaxLengths();
80818
+ for (const issue of [
80819
+ this.checkTextLength(file, "DDTEXT", obj.getDescription(), 60),
80820
+ this.checkTextLength(file, "SCRTEXT_S", texts === null || texts === void 0 ? void 0 : texts.short, maxLengths === null || maxLengths === void 0 ? void 0 : maxLengths.short),
80821
+ this.checkTextLength(file, "SCRTEXT_M", texts === null || texts === void 0 ? void 0 : texts.medium, maxLengths === null || maxLengths === void 0 ? void 0 : maxLengths.medium),
80822
+ this.checkTextLength(file, "SCRTEXT_L", texts === null || texts === void 0 ? void 0 : texts.long, maxLengths === null || maxLengths === void 0 ? void 0 : maxLengths.long),
80823
+ this.checkTextLength(file, "REPTEXT", texts === null || texts === void 0 ? void 0 : texts.heading, maxLengths === null || maxLengths === void 0 ? void 0 : maxLengths.heading),
80824
+ ]) {
80825
+ if (issue) {
80826
+ issues.push(issue);
80603
80827
  }
80604
- else if (obj.getDefinition() !== undefined && ((_b = obj.getDefinition()) === null || _b === void 0 ? void 0 : _b.getName().toUpperCase()) !== name.toUpperCase()) {
80605
- issues.push(issue_1.Issue.atRow(file, 1, "Interface matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
80828
+ }
80829
+ for (const translation of (_a = obj.getTextsTranslations()) !== null && _a !== void 0 ? _a : []) {
80830
+ const lang = translation.language;
80831
+ for (const issue of [
80832
+ this.checkTextLength(file, "DDTEXT", translation.description, 60, lang),
80833
+ this.checkTextLength(file, "SCRTEXT_S", translation.short, maxLengths === null || maxLengths === void 0 ? void 0 : maxLengths.short, lang),
80834
+ this.checkTextLength(file, "SCRTEXT_M", translation.medium, maxLengths === null || maxLengths === void 0 ? void 0 : maxLengths.medium, lang),
80835
+ this.checkTextLength(file, "SCRTEXT_L", translation.long, maxLengths === null || maxLengths === void 0 ? void 0 : maxLengths.long, lang),
80836
+ this.checkTextLength(file, "REPTEXT", translation.heading, maxLengths === null || maxLengths === void 0 ? void 0 : maxLengths.heading, lang),
80837
+ ]) {
80838
+ if (issue) {
80839
+ issues.push(issue);
80840
+ }
80606
80841
  }
80607
80842
  }
80608
80843
  return issues;
80609
80844
  }
80845
+ runDomain(obj, file) {
80846
+ var _a, _b;
80847
+ const maxTextLength = 60;
80848
+ const issues = [];
80849
+ const push = (issue) => { if (issue) {
80850
+ issues.push(issue);
80851
+ } };
80852
+ push(this.checkTextLength(file, "DDTEXT", obj.getDescription(), maxTextLength));
80853
+ for (const fixedValue of (_a = obj.getFixedValues()) !== null && _a !== void 0 ? _a : []) {
80854
+ push(this.checkTextLength(file, "DDTEXT", fixedValue.description, maxTextLength, fixedValue.language));
80855
+ }
80856
+ for (const translationFixedValue of (_b = obj.getFixedValuesTranslations()) !== null && _b !== void 0 ? _b : []) {
80857
+ push(this.checkTextLength(file, "DDTEXT", translationFixedValue.description, maxTextLength, translationFixedValue.language));
80858
+ }
80859
+ return issues;
80860
+ }
80861
+ runTransaction(obj, file) {
80862
+ var _a;
80863
+ const maxTextLength = 36;
80864
+ const issues = [];
80865
+ const push = (issue) => { if (issue) {
80866
+ issues.push(issue);
80867
+ } };
80868
+ push(this.checkTextLength(file, "TTEXT", obj.getDescription(), maxTextLength));
80869
+ for (const translation of (_a = obj.getTextsTranslations()) !== null && _a !== void 0 ? _a : []) {
80870
+ push(this.checkTextLength(file, "TTEXT", translation.description, maxTextLength, translation.language));
80871
+ }
80872
+ return issues;
80873
+ }
80874
+ runMessageClass(obj, file) {
80875
+ var _a;
80876
+ const maxTextLength = 73;
80877
+ const issues = [];
80878
+ const push = (issue) => { if (issue) {
80879
+ issues.push(issue);
80880
+ } };
80881
+ for (const msg of obj.getMessages()) {
80882
+ push(this.checkTextLength(file, `TEXT[${msg.getNumber()}]`, msg.getMessage(), maxTextLength));
80883
+ }
80884
+ for (const translation of (_a = obj.getTextsTranslations()) !== null && _a !== void 0 ? _a : []) {
80885
+ push(this.checkTextLength(file, `TEXT[${translation.number}]`, translation.text, maxTextLength, translation.language));
80886
+ }
80887
+ return issues;
80888
+ }
80610
80889
  }
80611
80890
  exports.XMLConsistency = XMLConsistency;
80612
80891
  //# sourceMappingURL=xml_consistency.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.119.20",
3
+ "version": "2.119.21",
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.119.19",
41
+ "@abaplint/core": "^2.119.21",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",