@abaplint/core 2.113.33 → 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.
@@ -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
  }
@@ -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
  }
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.33";
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.33",
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",