@abaplint/core 2.120.48 → 2.120.50

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.
@@ -1805,6 +1805,7 @@ declare class DataElement extends AbstractObject {
1805
1805
  maxLength: number;
1806
1806
  allowNamespace: boolean;
1807
1807
  };
1808
+ getIdentifier(): Identifier | undefined;
1808
1809
  setDirty(): void;
1809
1810
  getDomainName(): string | undefined;
1810
1811
  /** parseType() cannot distinguish DEC, CURR, and QUAN because they all become PackedType.
@@ -1836,6 +1837,7 @@ declare class DataElement extends AbstractObject {
1836
1837
  updated: boolean;
1837
1838
  runtime: number;
1838
1839
  };
1840
+ private getAFFFile;
1839
1841
  }
1840
1842
 
1841
1843
  declare class DataEnd implements IStatement {
@@ -2078,6 +2080,7 @@ declare class Domain extends AbstractObject {
2078
2080
  maxLength: number;
2079
2081
  allowNamespace: boolean;
2080
2082
  };
2083
+ getIdentifier(): Identifier | undefined;
2081
2084
  setDirty(): void;
2082
2085
  parseType(reg: IRegistry, dataElement?: string, description?: string): AbstractType;
2083
2086
  parse(): {
@@ -2086,6 +2089,7 @@ declare class Domain extends AbstractObject {
2086
2089
  };
2087
2090
  getFixedValues(): DomainValue[];
2088
2091
  getFixedValuesTranslations(): DomainValueTranslation[];
2092
+ private getAFFFile;
2089
2093
  }
2090
2094
 
2091
2095
  declare interface DomainValue {
@@ -39,6 +39,9 @@ const ddic_1 = require("../ddic");
39
39
  const Types = __importStar(require("../abap/types/basic"));
40
40
  const xml_utils_1 = require("../xml_utils");
41
41
  const domain_1 = require("./domain");
42
+ const _identifier_1 = require("../abap/4_file_information/_identifier");
43
+ const identifier_1 = require("../abap/1_lexer/tokens/identifier");
44
+ const position_1 = require("../position");
42
45
  class DataElement extends _abstract_object_1.AbstractObject {
43
46
  constructor() {
44
47
  super(...arguments);
@@ -59,6 +62,17 @@ class DataElement extends _abstract_object_1.AbstractObject {
59
62
  allowNamespace: true,
60
63
  };
61
64
  }
65
+ getIdentifier() {
66
+ const xmlIdentifier = super.getIdentifier();
67
+ if (xmlIdentifier) {
68
+ return xmlIdentifier;
69
+ }
70
+ const file = this.getAFFFile();
71
+ if (file === undefined) {
72
+ return undefined;
73
+ }
74
+ return new _identifier_1.Identifier(new identifier_1.Identifier(new position_1.Position(1, 1), this.getName()), file.getFilename());
75
+ }
62
76
  setDirty() {
63
77
  this.parsedXML = undefined;
64
78
  this.parsedType = undefined;
@@ -106,7 +120,6 @@ class DataElement extends _abstract_object_1.AbstractObject {
106
120
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.dtelmaster;
107
121
  }
108
122
  parseType(reg) {
109
- var _a;
110
123
  const references = [];
111
124
  let lookup = undefined;
112
125
  this.parse();
@@ -118,7 +131,53 @@ class DataElement extends _abstract_object_1.AbstractObject {
118
131
  return this.parsedType;
119
132
  }
120
133
  const ddic = new ddic_1.DDIC(reg);
121
- if (this.parsedXML.refkind === "D") {
134
+ const lookupPredefinedType = () => {
135
+ var _a, _b;
136
+ if (((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.datatype) === undefined || this.parsedXML.datatype === "") {
137
+ return { type: new Types.UnknownType("DATATYPE unexpectely empty in " + this.getName()) };
138
+ }
139
+ return { type: ddic.textToType({
140
+ text: this.parsedXML.datatype,
141
+ length: this.parsedXML.leng,
142
+ decimals: this.parsedXML.decimals,
143
+ infoText: this.getName(),
144
+ qualifiedName: this.getName(),
145
+ conversionExit: undefined,
146
+ ddicName: this.getName(),
147
+ description: (_b = this.parsedXML.texts) === null || _b === void 0 ? void 0 : _b.heading,
148
+ }) };
149
+ };
150
+ if (this.parsedXML.affCategory === "referenceToPredefinedType") {
151
+ const predefined = lookupPredefinedType();
152
+ lookup = predefined.type instanceof Types.UnknownType
153
+ ? predefined
154
+ : { type: new Types.DataReference(predefined.type, this.getName()) };
155
+ }
156
+ else if (this.parsedXML.affCategory === "referenceDictionaryType") {
157
+ if (this.parsedXML.domname === undefined || this.parsedXML.domname === "") {
158
+ lookup = { type: new Types.UnknownType("Type name unexpectely empty in " + this.getName()) };
159
+ }
160
+ else {
161
+ const referenced = ddic.lookup(this.parsedXML.domname);
162
+ lookup = referenced.type instanceof Types.UnknownType
163
+ ? referenced
164
+ : Object.assign(Object.assign({}, referenced), { type: new Types.DataReference(referenced.type, this.getName()) });
165
+ }
166
+ }
167
+ else if (this.parsedXML.affCategory === "referenceClasIntType") {
168
+ if (this.parsedXML.domname === undefined || this.parsedXML.domname === "") {
169
+ lookup = { type: new Types.UnknownType("Type name unexpectely empty in " + this.getName()) };
170
+ }
171
+ else {
172
+ lookup = ddic.lookupObject(this.parsedXML.domname);
173
+ }
174
+ }
175
+ else if (this.parsedXML.affCategory !== undefined
176
+ && this.parsedXML.affCategory !== "domain"
177
+ && this.parsedXML.affCategory !== "predefinedType") {
178
+ lookup = { type: new Types.UnknownType("Unknown AFF data type category " + this.parsedXML.affCategory + " in " + this.getName()) };
179
+ }
180
+ else if (this.parsedXML.refkind === "D") {
122
181
  if (this.parsedXML.domname === undefined || this.parsedXML.domname === "") {
123
182
  lookup = { type: new Types.UnknownType("DOMNAME unexpectely empty in " + this.getName()) };
124
183
  }
@@ -135,21 +194,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
135
194
  }
136
195
  }
137
196
  else {
138
- if (this.parsedXML.datatype === undefined || this.parsedXML.datatype === "") {
139
- lookup = { type: new Types.UnknownType("DATATYPE unexpectely empty in " + this.getName()) };
140
- }
141
- else {
142
- lookup = { type: ddic.textToType({
143
- text: this.parsedXML.datatype,
144
- length: this.parsedXML.leng,
145
- decimals: this.parsedXML.decimals,
146
- infoText: this.getName(),
147
- qualifiedName: this.getName(),
148
- conversionExit: undefined,
149
- ddicName: this.getName(),
150
- description: (_a = this.parsedXML.texts) === null || _a === void 0 ? void 0 : _a.heading,
151
- }) };
152
- }
197
+ lookup = lookupPredefinedType();
153
198
  }
154
199
  }
155
200
  if (lookup.object) {
@@ -164,17 +209,52 @@ class DataElement extends _abstract_object_1.AbstractObject {
164
209
  return lookup.type;
165
210
  }
166
211
  parse() {
167
- var _a, _b, _c, _d, _e, _f, _g;
212
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
168
213
  if (this.parsedXML !== undefined) {
169
214
  return { updated: false, runtime: 0 };
170
215
  }
171
216
  const start = Date.now();
172
217
  this.parsedXML = {};
218
+ const jsonFile = this.getAFFFile();
219
+ if (jsonFile) {
220
+ try {
221
+ const parsed = JSON.parse(jsonFile.getRaw());
222
+ const typeInformation = parsed.dataTypeInformation;
223
+ const predefinedType = typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.predefinedType;
224
+ const fieldLabels = parsed.fieldLabels;
225
+ this.parsedXML = {
226
+ description: (_a = parsed.header) === null || _a === void 0 ? void 0 : _a.description,
227
+ affCategory: typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.category,
228
+ refkind: (typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.category) === "domain" ? "D" : undefined,
229
+ domname: typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.typeName,
230
+ datatype: predefinedType === null || predefinedType === void 0 ? void 0 : predefinedType.dataType,
231
+ leng: (_b = predefinedType === null || predefinedType === void 0 ? void 0 : predefinedType.length) === null || _b === void 0 ? void 0 : _b.toString(),
232
+ decimals: (_c = predefinedType === null || predefinedType === void 0 ? void 0 : predefinedType.decimals) === null || _c === void 0 ? void 0 : _c.toString(),
233
+ texts: {
234
+ short: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.short,
235
+ medium: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.medium,
236
+ long: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.long,
237
+ heading: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.heading,
238
+ },
239
+ textMaxLengths: {
240
+ short: (_d = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.shortLength) === null || _d === void 0 ? void 0 : _d.toString(),
241
+ medium: (_e = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.mediumLength) === null || _e === void 0 ? void 0 : _e.toString(),
242
+ long: (_f = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.longLength) === null || _f === void 0 ? void 0 : _f.toString(),
243
+ heading: (_g = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.headingLength) === null || _g === void 0 ? void 0 : _g.toString(),
244
+ },
245
+ };
246
+ }
247
+ catch (_q) {
248
+ // handled by parseType()
249
+ }
250
+ const end = Date.now();
251
+ return { updated: true, runtime: end - start };
252
+ }
173
253
  const parsed = super.parseRaw2();
174
254
  if (parsed === undefined) {
175
255
  return { updated: false, runtime: 0 };
176
256
  }
177
- 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;
257
+ 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;
178
258
  this.parsedXML = {
179
259
  description: dd04v === null || dd04v === void 0 ? void 0 : dd04v.DDTEXT,
180
260
  refkind: dd04v === null || dd04v === void 0 ? void 0 : dd04v.REFKIND,
@@ -197,7 +277,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
197
277
  },
198
278
  };
199
279
  this.parsedXML.textsTranslations = [];
200
- 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)) {
280
+ 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)) {
201
281
  this.parsedXML.textsTranslations.push({
202
282
  language: item.DDLANGUAGE,
203
283
  description: item.DDTEXT,
@@ -210,6 +290,9 @@ class DataElement extends _abstract_object_1.AbstractObject {
210
290
  const end = Date.now();
211
291
  return { updated: true, runtime: end - start };
212
292
  }
293
+ getAFFFile() {
294
+ return this.getFiles().find(file => file.getFilename().toLowerCase().endsWith(".dtel.json"));
295
+ }
213
296
  }
214
297
  exports.DataElement = DataElement;
215
298
  //# sourceMappingURL=data_element.js.map
@@ -38,16 +38,21 @@ const _abstract_object_1 = require("./_abstract_object");
38
38
  const Types = __importStar(require("../abap/types/basic"));
39
39
  const ddic_1 = require("../ddic");
40
40
  const xml_utils_1 = require("../xml_utils");
41
+ const _identifier_1 = require("../abap/4_file_information/_identifier");
42
+ const identifier_1 = require("../abap/1_lexer/tokens/identifier");
43
+ const position_1 = require("../position");
41
44
  class Domain extends _abstract_object_1.AbstractObject {
42
45
  getType() {
43
46
  return "DOMA";
44
47
  }
45
48
  getDescription() {
46
49
  var _a;
50
+ this.parse();
47
51
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.description;
48
52
  }
49
53
  getConversionExit() {
50
54
  var _a;
55
+ this.parse();
51
56
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.conversionExit;
52
57
  }
53
58
  getDataType() {
@@ -61,6 +66,17 @@ class Domain extends _abstract_object_1.AbstractObject {
61
66
  allowNamespace: true,
62
67
  };
63
68
  }
69
+ getIdentifier() {
70
+ const xmlIdentifier = super.getIdentifier();
71
+ if (xmlIdentifier) {
72
+ return xmlIdentifier;
73
+ }
74
+ const file = this.getAFFFile();
75
+ if (file === undefined) {
76
+ return undefined;
77
+ }
78
+ return new _identifier_1.Identifier(new identifier_1.Identifier(new position_1.Position(1, 1), this.getName()), file.getFilename());
79
+ }
64
80
  setDirty() {
65
81
  this.parsedXML = undefined;
66
82
  super.setDirty();
@@ -87,18 +103,57 @@ class Domain extends _abstract_object_1.AbstractObject {
87
103
  });
88
104
  }
89
105
  parse() {
90
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
106
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
107
+ var _v, _w;
91
108
  if (this.parsedXML) {
92
109
  return { updated: false, runtime: 0 };
93
110
  }
94
111
  const start = Date.now();
95
112
  this.parsedXML = {};
113
+ const jsonFile = this.getAFFFile();
114
+ if (jsonFile) {
115
+ try {
116
+ const parsed = JSON.parse(jsonFile.getRaw());
117
+ const language = (_a = parsed.header) === null || _a === void 0 ? void 0 : _a.originalLanguage;
118
+ const values = [];
119
+ for (const fixedValue of (_v = parsed.fixedValues) !== null && _v !== void 0 ? _v : []) {
120
+ values.push({
121
+ low: fixedValue === null || fixedValue === void 0 ? void 0 : fixedValue.fixedValue,
122
+ high: "",
123
+ description: fixedValue === null || fixedValue === void 0 ? void 0 : fixedValue.description,
124
+ language: language,
125
+ });
126
+ }
127
+ for (const interval of (_w = parsed.fixedValueIntervals) !== null && _w !== void 0 ? _w : []) {
128
+ values.push({
129
+ low: interval === null || interval === void 0 ? void 0 : interval.lowLimit,
130
+ high: interval === null || interval === void 0 ? void 0 : interval.highLimit,
131
+ description: interval === null || interval === void 0 ? void 0 : interval.description,
132
+ language: language,
133
+ });
134
+ }
135
+ this.parsedXML = {
136
+ description: (_b = parsed.header) === null || _b === void 0 ? void 0 : _b.description,
137
+ datatype: (_c = parsed.format) === null || _c === void 0 ? void 0 : _c.dataType,
138
+ length: (_e = (_d = parsed.format) === null || _d === void 0 ? void 0 : _d.length) === null || _e === void 0 ? void 0 : _e.toString(),
139
+ decimals: (_g = (_f = parsed.format) === null || _f === void 0 ? void 0 : _f.decimals) === null || _g === void 0 ? void 0 : _g.toString(),
140
+ conversionExit: (_h = parsed.outputCharacteristics) === null || _h === void 0 ? void 0 : _h.conversionRoutine,
141
+ values: values,
142
+ valuesTranslations: [],
143
+ };
144
+ }
145
+ catch (_x) {
146
+ // handled by parseType()
147
+ }
148
+ const end = Date.now();
149
+ return { updated: true, runtime: end - start };
150
+ }
96
151
  const parsed = super.parseRaw2();
97
152
  if (parsed === undefined) {
98
153
  return { updated: false, runtime: 0 };
99
154
  }
100
- const dd01v = (_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.DD01V;
101
- const dd07v_tab = (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.DD07V_TAB) === null || _g === void 0 ? void 0 : _g.DD07V);
155
+ const dd01v = (_l = (_k = (_j = parsed.abapGit) === null || _j === void 0 ? void 0 : _j["asx:abap"]) === null || _k === void 0 ? void 0 : _k["asx:values"]) === null || _l === void 0 ? void 0 : _l.DD01V;
156
+ const dd07v_tab = (0, xml_utils_1.xmlToArray)((_q = (_p = (_o = (_m = parsed.abapGit) === null || _m === void 0 ? void 0 : _m["asx:abap"]) === null || _o === void 0 ? void 0 : _o["asx:values"]) === null || _p === void 0 ? void 0 : _p.DD07V_TAB) === null || _q === void 0 ? void 0 : _q.DD07V);
102
157
  const values = [];
103
158
  for (const ddo7v of dd07v_tab) {
104
159
  const value = {
@@ -109,7 +164,7 @@ class Domain extends _abstract_object_1.AbstractObject {
109
164
  };
110
165
  values.push(value);
111
166
  }
112
- 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);
167
+ const dd07v_texts = (0, xml_utils_1.xmlToArray)((_u = (_t = (_s = (_r = parsed.abapGit) === null || _r === void 0 ? void 0 : _r["asx:abap"]) === null || _s === void 0 ? void 0 : _s["asx:values"]) === null || _t === void 0 ? void 0 : _t.DD07_TEXTS) === null || _u === void 0 ? void 0 : _u.item);
113
168
  const translationValues = [];
114
169
  for (const dd07v of dd07v_texts) {
115
170
  const value = {
@@ -140,6 +195,9 @@ class Domain extends _abstract_object_1.AbstractObject {
140
195
  var _b;
141
196
  return (_b = (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.valuesTranslations) !== null && _b !== void 0 ? _b : [];
142
197
  }
198
+ getAFFFile() {
199
+ return this.getFiles().find(file => file.getFilename().toLowerCase().endsWith(".doma.json"));
200
+ }
143
201
  }
144
202
  exports.Domain = Domain;
145
203
  //# sourceMappingURL=domain.js.map
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.120.48";
78
+ return "2.120.50";
79
79
  }
80
80
  getDDICReferences() {
81
81
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.120.48",
3
+ "version": "2.120.50",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",