@abaplint/core 2.113.32 → 2.113.34

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.
@@ -1630,7 +1630,7 @@ declare class DDIC {
1630
1630
  } | undefined;
1631
1631
  /** lookup with voiding and unknown types */
1632
1632
  lookup(name: string): ILookupResult;
1633
- lookupDomain(name: string, dataElement?: string): ILookupResult;
1633
+ lookupDomain(name: string, dataElement?: string, description?: string): ILookupResult;
1634
1634
  lookupDataElement(name: string | undefined): ILookupResult;
1635
1635
  lookupTableOrView(name: string | undefined): ILookupResult;
1636
1636
  /** this method only looks up the object, does not parse the type */
@@ -1810,7 +1810,7 @@ declare class Domain extends AbstractObject {
1810
1810
  allowNamespace: boolean;
1811
1811
  };
1812
1812
  setDirty(): void;
1813
- parseType(reg: IRegistry, dataElement?: string): AbstractType;
1813
+ parseType(reg: IRegistry, dataElement?: string, description?: string): AbstractType;
1814
1814
  parse(): {
1815
1815
  updated: boolean;
1816
1816
  runtime: number;
@@ -5108,6 +5108,7 @@ declare type ParsedDataDefinition = {
5108
5108
  fields: {
5109
5109
  key: boolean;
5110
5110
  name: string;
5111
+ prefix: string;
5111
5112
  annotations: string[];
5112
5113
  }[];
5113
5114
  sources: {
@@ -2,20 +2,71 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CDSDetermineTypes = void 0;
4
4
  const basic_1 = require("../abap/types/basic");
5
+ const ddic_1 = require("../ddic");
5
6
  class CDSDetermineTypes {
6
- parseType(_reg, parsedData) {
7
+ parseType(reg, parsedData) {
8
+ const ddic = new ddic_1.DDIC(reg);
7
9
  if ((parsedData === null || parsedData === void 0 ? void 0 : parsedData.fields.length) === 0) {
8
10
  return new basic_1.VoidType("DDLS:todo");
9
11
  }
10
12
  else {
11
13
  const components = [];
12
14
  for (const f of (parsedData === null || parsedData === void 0 ? void 0 : parsedData.fields) || []) {
13
- components.push({
14
- name: f.name,
15
- type: new basic_1.VoidType("DDLS:fieldname"),
16
- });
15
+ if (f.prefix !== "") {
16
+ const source = parsedData.sources.find((s) => { var _a; return ((_a = s.as) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === f.prefix.toUpperCase(); });
17
+ if ((source === null || source === void 0 ? void 0 : source.name) === undefined) {
18
+ components.push({
19
+ name: f.name,
20
+ type: new basic_1.UnknownType("CDS parser error, unknown source"),
21
+ });
22
+ continue;
23
+ }
24
+ const lookup = ddic.lookupTableOrView(source.name);
25
+ if (lookup.type) {
26
+ if (lookup.type instanceof basic_1.StructureType) {
27
+ const type = lookup.type.getComponentByName(f.name);
28
+ if (type) {
29
+ components.push({
30
+ name: f.name,
31
+ type: type,
32
+ });
33
+ }
34
+ else {
35
+ components.push({
36
+ name: f.name,
37
+ type: new basic_1.UnknownType(f.name + " not found in " + source.name + ", CDSDetermineTypes"),
38
+ });
39
+ }
40
+ }
41
+ else {
42
+ // its void or unknown
43
+ components.push({
44
+ name: f.name,
45
+ type: lookup.type,
46
+ });
47
+ }
48
+ }
49
+ else if (reg.inErrorNamespace(source.name)) {
50
+ components.push({
51
+ name: f.name,
52
+ type: new basic_1.UnknownType(source.name + " not found, CDSDetermineTypes"),
53
+ });
54
+ }
55
+ else {
56
+ components.push({
57
+ name: f.name,
58
+ type: new basic_1.VoidType(source.name),
59
+ });
60
+ }
61
+ }
62
+ else {
63
+ components.push({
64
+ name: f.name,
65
+ type: new basic_1.VoidType("DDLS:fieldname"),
66
+ });
67
+ }
17
68
  }
18
- return new basic_1.StructureType(components);
69
+ return new basic_1.StructureType(components, parsedData.definitionName, parsedData.definitionName, parsedData.description);
19
70
  }
20
71
  }
21
72
  }
package/build/src/ddic.js CHANGED
@@ -199,10 +199,10 @@ class DDIC {
199
199
  return { type: new Types.VoidType(name) };
200
200
  }
201
201
  }
202
- lookupDomain(name, dataElement) {
202
+ lookupDomain(name, dataElement, description) {
203
203
  const found = this.reg.getObject("DOMA", name);
204
204
  if (found) {
205
- return { type: found.parseType(this.reg, dataElement), object: found };
205
+ return { type: found.parseType(this.reg, dataElement, description), object: found };
206
206
  }
207
207
  else if (this.reg.inErrorNamespace(name)) {
208
208
  return { type: new Types.UnknownType(name + ", lookupDomain"), object: undefined };
@@ -126,6 +126,7 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
126
126
  expr = tree.findFirstExpression(expressions_1.CDSDefineProjection);
127
127
  }
128
128
  for (const e of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressions(expressions_1.CDSElement)) || []) {
129
+ let prefix = "";
129
130
  let found = (_a = e.findDirectExpression(expressions_1.CDSAs)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.CDSName);
130
131
  if (found === undefined) {
131
132
  const list = e.findAllExpressions(expressions_1.CDSName);
@@ -134,6 +135,9 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
134
135
  }
135
136
  else {
136
137
  found = list[list.length - 1];
138
+ if (list.length > 1) {
139
+ prefix = list[0].concatTokens();
140
+ }
137
141
  }
138
142
  }
139
143
  if (found === undefined) {
@@ -150,6 +154,7 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
150
154
  this.parsedData.fields.push({
151
155
  name: name,
152
156
  annotations: annotations,
157
+ prefix: prefix,
153
158
  key: e.findDirectTokenByText("KEY") !== undefined,
154
159
  });
155
160
  }
@@ -51,7 +51,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
51
51
  lookup = { type: new Types.UnknownType("DOMNAME unexpectely empty in " + this.getName()) };
52
52
  }
53
53
  else {
54
- lookup = ddic.lookupDomain(this.parsedXML.domname, this.getName());
54
+ lookup = ddic.lookupDomain(this.parsedXML.domname, this.getName(), this.getDescription());
55
55
  }
56
56
  }
57
57
  else if (this.parsedXML.refkind === "R") {
@@ -27,7 +27,7 @@ class Domain extends _abstract_object_1.AbstractObject {
27
27
  this.parsedXML = undefined;
28
28
  super.setDirty();
29
29
  }
30
- parseType(reg, dataElement) {
30
+ parseType(reg, dataElement, description) {
31
31
  // dont cache the DOMA parsed type, they are cached on DTEL level
32
32
  // also note that the type carries the name of the DTEL
33
33
  if (this.parsedXML === undefined) {
@@ -45,6 +45,7 @@ class Domain extends _abstract_object_1.AbstractObject {
45
45
  qualifiedName: dataElement,
46
46
  conversionExit: this.parsedXML.conversionExit,
47
47
  ddicName: dataElement,
48
+ description: description,
48
49
  });
49
50
  }
50
51
  parse() {
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.32";
70
+ return "2.113.34";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.32",
3
+ "version": "2.113.34",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -53,10 +53,10 @@
53
53
  "@microsoft/api-extractor": "^7.47.11",
54
54
  "@types/chai": "^4.3.20",
55
55
  "@types/mocha": "^10.0.9",
56
- "@types/node": "^22.8.1",
56
+ "@types/node": "^22.8.4",
57
57
  "chai": "^4.5.0",
58
58
  "eslint": "^9.13.0",
59
- "mocha": "^10.7.3",
59
+ "mocha": "^10.8.1",
60
60
  "c8": "^10.1.2",
61
61
  "source-map-support": "^0.5.21",
62
62
  "ts-json-schema-generator": "^2.3.0",