@abaplint/core 2.95.15 → 2.95.16

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.
@@ -5927,6 +5927,7 @@ declare class TableType extends AbstractObject {
5927
5927
  };
5928
5928
  getDescription(): string | undefined;
5929
5929
  setDirty(): void;
5930
+ private buildTableOptions;
5930
5931
  parseType(reg: IRegistry): AbstractType;
5931
5932
  private parseXML;
5932
5933
  }
@@ -5,6 +5,7 @@ const _abstract_object_1 = require("./_abstract_object");
5
5
  const Types = require("../abap/types/basic");
6
6
  const ddic_1 = require("../ddic");
7
7
  const basic_1 = require("../abap/types/basic");
8
+ const xml_utils_1 = require("../xml_utils");
8
9
  class TableType extends _abstract_object_1.AbstractObject {
9
10
  constructor() {
10
11
  super(...arguments);
@@ -27,44 +28,78 @@ class TableType extends _abstract_object_1.AbstractObject {
27
28
  this.parsedXML = undefined;
28
29
  super.setDirty();
29
30
  }
31
+ buildTableOptions() {
32
+ var _a, _b, _c;
33
+ const tableOptions = {
34
+ withHeader: false,
35
+ secondary: [],
36
+ };
37
+ for (const k of ((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.dd43v) || []) {
38
+ const fields = [];
39
+ for (const f of ((_b = this.parsedXML) === null || _b === void 0 ? void 0 : _b.dd42v) || []) {
40
+ if (f.keyname === k.keyname) {
41
+ fields.push(f.keyfield);
42
+ }
43
+ }
44
+ let accessType = basic_1.TableAccessType.standard;
45
+ switch (k.accessmode) {
46
+ case "S":
47
+ accessType = basic_1.TableAccessType.sorted;
48
+ break;
49
+ case "H":
50
+ accessType = basic_1.TableAccessType.hashed;
51
+ break;
52
+ default:
53
+ break;
54
+ }
55
+ (_c = tableOptions.secondary) === null || _c === void 0 ? void 0 : _c.push({
56
+ name: k.keyname,
57
+ type: accessType,
58
+ keyFields: fields,
59
+ isUnique: k.unique,
60
+ });
61
+ }
62
+ return tableOptions;
63
+ }
30
64
  parseType(reg) {
31
65
  this.parseXML();
32
66
  const ddic = new ddic_1.DDIC(reg);
33
67
  const references = [];
34
68
  let type;
69
+ const tableOptions = this.buildTableOptions();
35
70
  if (this.parsedXML === undefined) {
36
71
  type = new Types.UnknownType("Table Type, parser error", this.getName());
37
72
  }
38
73
  else if (this.parsedXML.rowkind === "S") {
39
74
  const lookup = ddic.lookupTableOrView(this.parsedXML.rowtype);
40
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
75
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
41
76
  if (lookup.object) {
42
77
  references.push({ object: lookup.object });
43
78
  }
44
79
  }
45
80
  else if (this.parsedXML.rowkind === "E") {
46
81
  const lookup = ddic.lookupDataElement(this.parsedXML.rowtype);
47
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
82
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
48
83
  if (lookup.object) {
49
84
  references.push({ object: lookup.object });
50
85
  }
51
86
  }
52
87
  else if (this.parsedXML.rowkind === "L") {
53
88
  const lookup = ddic.lookupTableType(this.parsedXML.rowtype);
54
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
89
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
55
90
  if (lookup.object) {
56
91
  references.push({ object: lookup.object });
57
92
  }
58
93
  }
59
94
  else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "OBJECT") {
60
- type = new Types.TableType(new basic_1.GenericObjectReferenceType(), { withHeader: false }, this.getName());
95
+ type = new Types.TableType(new basic_1.GenericObjectReferenceType(), tableOptions, this.getName());
61
96
  }
62
97
  else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "DATA") {
63
- type = new Types.TableType(new basic_1.DataReference(new basic_1.AnyType()), { withHeader: false }, this.getName());
98
+ type = new Types.TableType(new basic_1.DataReference(new basic_1.AnyType()), tableOptions, this.getName());
64
99
  }
65
100
  else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype !== undefined) {
66
101
  const lookup = ddic.lookupObject(this.parsedXML.rowtype);
67
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
102
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
68
103
  if (lookup.object) {
69
104
  references.push({ object: lookup.object });
70
105
  }
@@ -75,7 +110,7 @@ class TableType extends _abstract_object_1.AbstractObject {
75
110
  }
76
111
  else {
77
112
  const row = ddic.textToType(this.parsedXML.datatype, this.parsedXML.leng, this.parsedXML.decimals, this.getName());
78
- type = new Types.TableType(row, { withHeader: false }, this.getName());
113
+ type = new Types.TableType(row, tableOptions, this.getName());
79
114
  }
80
115
  }
81
116
  else {
@@ -86,20 +121,39 @@ class TableType extends _abstract_object_1.AbstractObject {
86
121
  }
87
122
  ////////////////////
88
123
  parseXML() {
124
+ var _a, _b;
89
125
  if (this.parsedXML !== undefined) {
90
126
  return;
91
127
  }
92
- this.parsedXML = {};
128
+ this.parsedXML = {
129
+ dd42v: [],
130
+ dd43v: [],
131
+ };
93
132
  const parsed = super.parseRaw2();
94
133
  if (parsed === undefined || parsed.abapGit === undefined) {
95
134
  return;
96
135
  }
97
- const dd40v = parsed.abapGit["asx:abap"]["asx:values"].DD40V;
136
+ const values = parsed.abapGit["asx:abap"]["asx:values"];
137
+ const dd40v = values.DD40V;
98
138
  this.parsedXML.rowtype = dd40v.ROWTYPE ? dd40v.ROWTYPE : "";
99
139
  this.parsedXML.rowkind = dd40v.ROWKIND ? dd40v.ROWKIND : "";
100
140
  this.parsedXML.datatype = dd40v.DATATYPE;
101
141
  this.parsedXML.leng = dd40v.LENG;
102
142
  this.parsedXML.decimals = dd40v.DECIMALS;
143
+ for (const x of (0, xml_utils_1.xmlToArray)((_a = values.DD42V) === null || _a === void 0 ? void 0 : _a.DD42V)) {
144
+ this.parsedXML.dd42v.push({
145
+ keyname: x.SECKEYNAME || "",
146
+ keyfield: x.KEYFIELD || "",
147
+ });
148
+ }
149
+ for (const x of (0, xml_utils_1.xmlToArray)((_b = values.DD43V) === null || _b === void 0 ? void 0 : _b.DD43V)) {
150
+ this.parsedXML.dd43v.push({
151
+ keyname: x.SECKEYNAME || "",
152
+ accessmode: x.ACCESSMODE || "",
153
+ kind: x.KIND || "",
154
+ unique: x.SECKEYUNIQUE === "X",
155
+ });
156
+ }
103
157
  }
104
158
  }
105
159
  exports.TableType = TableType;
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.95.15";
66
+ return "2.95.16";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.95.15",
3
+ "version": "2.95.16",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",