@abaplint/core 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.
- package/build/abaplint.d.ts +2 -0
- package/build/src/objects/data_element.js +103 -20
- package/build/src/registry.js +1 -1
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -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 {
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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 = (
|
|
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)((
|
|
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
|
package/build/src/registry.js
CHANGED