@abaplint/cli 2.120.48 → 2.120.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.
Files changed (2) hide show
  1. package/build/cli.js +104 -21
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -63109,6 +63109,9 @@ const ddic_1 = __webpack_require__(/*! ../ddic */ "../core/build/src/ddic.js");
63109
63109
  const Types = __importStar(__webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js"));
63110
63110
  const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "../core/build/src/xml_utils.js");
63111
63111
  const domain_1 = __webpack_require__(/*! ./domain */ "../core/build/src/objects/domain.js");
63112
+ const _identifier_1 = __webpack_require__(/*! ../abap/4_file_information/_identifier */ "../core/build/src/abap/4_file_information/_identifier.js");
63113
+ const identifier_1 = __webpack_require__(/*! ../abap/1_lexer/tokens/identifier */ "../core/build/src/abap/1_lexer/tokens/identifier.js");
63114
+ const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
63112
63115
  class DataElement extends _abstract_object_1.AbstractObject {
63113
63116
  constructor() {
63114
63117
  super(...arguments);
@@ -63129,6 +63132,17 @@ class DataElement extends _abstract_object_1.AbstractObject {
63129
63132
  allowNamespace: true,
63130
63133
  };
63131
63134
  }
63135
+ getIdentifier() {
63136
+ const xmlIdentifier = super.getIdentifier();
63137
+ if (xmlIdentifier) {
63138
+ return xmlIdentifier;
63139
+ }
63140
+ const file = this.getAFFFile();
63141
+ if (file === undefined) {
63142
+ return undefined;
63143
+ }
63144
+ return new _identifier_1.Identifier(new identifier_1.Identifier(new position_1.Position(1, 1), this.getName()), file.getFilename());
63145
+ }
63132
63146
  setDirty() {
63133
63147
  this.parsedXML = undefined;
63134
63148
  this.parsedType = undefined;
@@ -63176,7 +63190,6 @@ class DataElement extends _abstract_object_1.AbstractObject {
63176
63190
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.dtelmaster;
63177
63191
  }
63178
63192
  parseType(reg) {
63179
- var _a;
63180
63193
  const references = [];
63181
63194
  let lookup = undefined;
63182
63195
  this.parse();
@@ -63188,7 +63201,53 @@ class DataElement extends _abstract_object_1.AbstractObject {
63188
63201
  return this.parsedType;
63189
63202
  }
63190
63203
  const ddic = new ddic_1.DDIC(reg);
63191
- if (this.parsedXML.refkind === "D") {
63204
+ const lookupPredefinedType = () => {
63205
+ var _a, _b;
63206
+ if (((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.datatype) === undefined || this.parsedXML.datatype === "") {
63207
+ return { type: new Types.UnknownType("DATATYPE unexpectely empty in " + this.getName()) };
63208
+ }
63209
+ return { type: ddic.textToType({
63210
+ text: this.parsedXML.datatype,
63211
+ length: this.parsedXML.leng,
63212
+ decimals: this.parsedXML.decimals,
63213
+ infoText: this.getName(),
63214
+ qualifiedName: this.getName(),
63215
+ conversionExit: undefined,
63216
+ ddicName: this.getName(),
63217
+ description: (_b = this.parsedXML.texts) === null || _b === void 0 ? void 0 : _b.heading,
63218
+ }) };
63219
+ };
63220
+ if (this.parsedXML.affCategory === "referenceToPredefinedType") {
63221
+ const predefined = lookupPredefinedType();
63222
+ lookup = predefined.type instanceof Types.UnknownType
63223
+ ? predefined
63224
+ : { type: new Types.DataReference(predefined.type, this.getName()) };
63225
+ }
63226
+ else if (this.parsedXML.affCategory === "referenceDictionaryType") {
63227
+ if (this.parsedXML.domname === undefined || this.parsedXML.domname === "") {
63228
+ lookup = { type: new Types.UnknownType("Type name unexpectely empty in " + this.getName()) };
63229
+ }
63230
+ else {
63231
+ const referenced = ddic.lookup(this.parsedXML.domname);
63232
+ lookup = referenced.type instanceof Types.UnknownType
63233
+ ? referenced
63234
+ : Object.assign(Object.assign({}, referenced), { type: new Types.DataReference(referenced.type, this.getName()) });
63235
+ }
63236
+ }
63237
+ else if (this.parsedXML.affCategory === "referenceClasIntType") {
63238
+ if (this.parsedXML.domname === undefined || this.parsedXML.domname === "") {
63239
+ lookup = { type: new Types.UnknownType("Type name unexpectely empty in " + this.getName()) };
63240
+ }
63241
+ else {
63242
+ lookup = ddic.lookupObject(this.parsedXML.domname);
63243
+ }
63244
+ }
63245
+ else if (this.parsedXML.affCategory !== undefined
63246
+ && this.parsedXML.affCategory !== "domain"
63247
+ && this.parsedXML.affCategory !== "predefinedType") {
63248
+ lookup = { type: new Types.UnknownType("Unknown AFF data type category " + this.parsedXML.affCategory + " in " + this.getName()) };
63249
+ }
63250
+ else if (this.parsedXML.refkind === "D") {
63192
63251
  if (this.parsedXML.domname === undefined || this.parsedXML.domname === "") {
63193
63252
  lookup = { type: new Types.UnknownType("DOMNAME unexpectely empty in " + this.getName()) };
63194
63253
  }
@@ -63205,21 +63264,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
63205
63264
  }
63206
63265
  }
63207
63266
  else {
63208
- if (this.parsedXML.datatype === undefined || this.parsedXML.datatype === "") {
63209
- lookup = { type: new Types.UnknownType("DATATYPE unexpectely empty in " + this.getName()) };
63210
- }
63211
- else {
63212
- lookup = { type: ddic.textToType({
63213
- text: this.parsedXML.datatype,
63214
- length: this.parsedXML.leng,
63215
- decimals: this.parsedXML.decimals,
63216
- infoText: this.getName(),
63217
- qualifiedName: this.getName(),
63218
- conversionExit: undefined,
63219
- ddicName: this.getName(),
63220
- description: (_a = this.parsedXML.texts) === null || _a === void 0 ? void 0 : _a.heading,
63221
- }) };
63222
- }
63267
+ lookup = lookupPredefinedType();
63223
63268
  }
63224
63269
  }
63225
63270
  if (lookup.object) {
@@ -63234,17 +63279,52 @@ class DataElement extends _abstract_object_1.AbstractObject {
63234
63279
  return lookup.type;
63235
63280
  }
63236
63281
  parse() {
63237
- var _a, _b, _c, _d, _e, _f, _g;
63282
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
63238
63283
  if (this.parsedXML !== undefined) {
63239
63284
  return { updated: false, runtime: 0 };
63240
63285
  }
63241
63286
  const start = Date.now();
63242
63287
  this.parsedXML = {};
63288
+ const jsonFile = this.getAFFFile();
63289
+ if (jsonFile) {
63290
+ try {
63291
+ const parsed = JSON.parse(jsonFile.getRaw());
63292
+ const typeInformation = parsed.dataTypeInformation;
63293
+ const predefinedType = typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.predefinedType;
63294
+ const fieldLabels = parsed.fieldLabels;
63295
+ this.parsedXML = {
63296
+ description: (_a = parsed.header) === null || _a === void 0 ? void 0 : _a.description,
63297
+ affCategory: typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.category,
63298
+ refkind: (typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.category) === "domain" ? "D" : undefined,
63299
+ domname: typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.typeName,
63300
+ datatype: predefinedType === null || predefinedType === void 0 ? void 0 : predefinedType.dataType,
63301
+ leng: (_b = predefinedType === null || predefinedType === void 0 ? void 0 : predefinedType.length) === null || _b === void 0 ? void 0 : _b.toString(),
63302
+ decimals: (_c = predefinedType === null || predefinedType === void 0 ? void 0 : predefinedType.decimals) === null || _c === void 0 ? void 0 : _c.toString(),
63303
+ texts: {
63304
+ short: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.short,
63305
+ medium: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.medium,
63306
+ long: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.long,
63307
+ heading: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.heading,
63308
+ },
63309
+ textMaxLengths: {
63310
+ short: (_d = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.shortLength) === null || _d === void 0 ? void 0 : _d.toString(),
63311
+ medium: (_e = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.mediumLength) === null || _e === void 0 ? void 0 : _e.toString(),
63312
+ long: (_f = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.longLength) === null || _f === void 0 ? void 0 : _f.toString(),
63313
+ heading: (_g = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.headingLength) === null || _g === void 0 ? void 0 : _g.toString(),
63314
+ },
63315
+ };
63316
+ }
63317
+ catch (_q) {
63318
+ // handled by parseType()
63319
+ }
63320
+ const end = Date.now();
63321
+ return { updated: true, runtime: end - start };
63322
+ }
63243
63323
  const parsed = super.parseRaw2();
63244
63324
  if (parsed === undefined) {
63245
63325
  return { updated: false, runtime: 0 };
63246
63326
  }
63247
- const dd04v = (_c = (_b = (_a = 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.DD04V;
63327
+ const dd04v = (_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.DD04V;
63248
63328
  this.parsedXML = {
63249
63329
  description: dd04v === null || dd04v === void 0 ? void 0 : dd04v.DDTEXT,
63250
63330
  refkind: dd04v === null || dd04v === void 0 ? void 0 : dd04v.REFKIND,
@@ -63267,7 +63347,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
63267
63347
  },
63268
63348
  };
63269
63349
  this.parsedXML.textsTranslations = [];
63270
- 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)) {
63350
+ for (const item of (0, xml_utils_1.xmlToArray)((_p = (_o = (_m = (_l = parsed.abapGit) === null || _l === void 0 ? void 0 : _l["asx:abap"]) === null || _m === void 0 ? void 0 : _m["asx:values"]) === null || _o === void 0 ? void 0 : _o.DD04_TEXTS) === null || _p === void 0 ? void 0 : _p.item)) {
63271
63351
  this.parsedXML.textsTranslations.push({
63272
63352
  language: item.DDLANGUAGE,
63273
63353
  description: item.DDTEXT,
@@ -63280,6 +63360,9 @@ class DataElement extends _abstract_object_1.AbstractObject {
63280
63360
  const end = Date.now();
63281
63361
  return { updated: true, runtime: end - start };
63282
63362
  }
63363
+ getAFFFile() {
63364
+ return this.getFiles().find(file => file.getFilename().toLowerCase().endsWith(".dtel.json"));
63365
+ }
63283
63366
  }
63284
63367
  exports.DataElement = DataElement;
63285
63368
  //# sourceMappingURL=data_element.js.map
@@ -70408,7 +70491,7 @@ class Registry {
70408
70491
  }
70409
70492
  static abaplintVersion() {
70410
70493
  // magic, see build script "version.js"
70411
- return "2.120.48";
70494
+ return "2.120.49";
70412
70495
  }
70413
70496
  getDDICReferences() {
70414
70497
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.48",
3
+ "version": "2.120.49",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.48",
42
+ "@abaplint/core": "^2.120.49",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",