@abaplint/runtime 2.5.61 → 2.5.63
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/src/builtin/lines.js +1 -1
- package/build/src/statements/delete_internal.d.ts +2 -2
- package/build/src/statements/delete_internal.js +7 -2
- package/build/src/statements/loop.d.ts +2 -2
- package/build/src/statements/loop.js +1 -1
- package/build/src/types/data_reference.d.ts +1 -1
- package/build/src/types/data_reference.js +2 -2
- package/build/src/types/field_symbol.d.ts +1 -1
- package/build/src/types/field_symbol.js +2 -2
- package/build/src/types/table.d.ts +5 -3
- package/build/src/types/table.js +25 -4
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ function lines(input) {
|
|
|
9
9
|
}
|
|
10
10
|
return lines({ val: input.val.getPointer() });
|
|
11
11
|
}
|
|
12
|
-
return new types_1.Integer().set(input.val.
|
|
12
|
+
return new types_1.Integer().set(input.val.getArrayLength());
|
|
13
13
|
}
|
|
14
14
|
exports.lines = lines;
|
|
15
15
|
//# sourceMappingURL=lines.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldSymbol, Table } from "../types";
|
|
1
|
+
import { FieldSymbol, HashedTable, Table } from "../types";
|
|
2
2
|
import { INumeric } from "../types/_numeric";
|
|
3
3
|
export interface IDeleteInternalOptions {
|
|
4
4
|
where?: (i: any) => boolean;
|
|
@@ -9,4 +9,4 @@ export interface IDeleteInternalOptions {
|
|
|
9
9
|
from?: any;
|
|
10
10
|
to?: any;
|
|
11
11
|
}
|
|
12
|
-
export declare function deleteInternal(target: Table | FieldSymbol, options?: IDeleteInternalOptions): Promise<void>;
|
|
12
|
+
export declare function deleteInternal(target: Table | HashedTable | FieldSymbol, options?: IDeleteInternalOptions): Promise<void>;
|
|
@@ -17,7 +17,7 @@ async function deleteInternal(target, options) {
|
|
|
17
17
|
if (target instanceof types_1.FieldSymbol) {
|
|
18
18
|
target = target.getPointer();
|
|
19
19
|
if (target === undefined) {
|
|
20
|
-
throw "FS not assigned";
|
|
20
|
+
throw new Error("deleteInternal, FS not assigned");
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
if ((options === null || options === void 0 ? void 0 : options.index)
|
|
@@ -84,7 +84,12 @@ async function deleteInternal(target, options) {
|
|
|
84
84
|
if (options === null || options === void 0 ? void 0 : options.where) {
|
|
85
85
|
const row = i instanceof types_1.Structure ? i.get() : { table_line: i };
|
|
86
86
|
if (options.where(row) === true) {
|
|
87
|
-
target.
|
|
87
|
+
if (target instanceof types_1.HashedTable) {
|
|
88
|
+
target.deleteFrom(i);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
target.deleteIndex(index);
|
|
92
|
+
}
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
95
|
else if ((options === null || options === void 0 ? void 0 : options.index) && options.index.get() === index) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldSymbol, Integer, Table } from "../types";
|
|
1
|
+
import { FieldSymbol, HashedTable, Integer, Table } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
4
|
type topType = {
|
|
@@ -11,5 +11,5 @@ export interface ILoopOptions {
|
|
|
11
11
|
to?: Integer;
|
|
12
12
|
topEquals?: topType;
|
|
13
13
|
}
|
|
14
|
-
export declare function loop(table: Table | FieldSymbol | undefined, options?: ILoopOptions): AsyncGenerator<any, void, unknown>;
|
|
14
|
+
export declare function loop(table: Table | HashedTable | FieldSymbol | undefined, options?: ILoopOptions): AsyncGenerator<any, void, unknown>;
|
|
15
15
|
export {};
|
|
@@ -60,7 +60,7 @@ function loop(table, options) {
|
|
|
60
60
|
yield __await(yield* __asyncDelegator(__asyncValues(loop(pnt, options))));
|
|
61
61
|
return yield __await(void 0);
|
|
62
62
|
}
|
|
63
|
-
const length = table.
|
|
63
|
+
const length = table.getArrayLength();
|
|
64
64
|
if (length === 0) {
|
|
65
65
|
// @ts-ignore
|
|
66
66
|
abap.builtin.sy.get().subrc.set(4);
|
|
@@ -19,7 +19,7 @@ export declare class DataReference {
|
|
|
19
19
|
clear(): void;
|
|
20
20
|
get(): any;
|
|
21
21
|
array(): any;
|
|
22
|
-
|
|
22
|
+
getArrayLength(): any;
|
|
23
23
|
set(value: any): void | Float | ABAPObject | this | Table | Structure;
|
|
24
24
|
getOffset(input: {
|
|
25
25
|
offset?: number | INumeric | Hex;
|
|
@@ -42,10 +42,10 @@ class DataReference {
|
|
|
42
42
|
// @ts-ignore
|
|
43
43
|
return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.array();
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
getArrayLength() {
|
|
46
46
|
var _a;
|
|
47
47
|
// @ts-ignore
|
|
48
|
-
return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.
|
|
48
|
+
return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.getArrayLength();
|
|
49
49
|
}
|
|
50
50
|
set(value) {
|
|
51
51
|
var _a;
|
|
@@ -23,7 +23,7 @@ export declare class FieldSymbol {
|
|
|
23
23
|
get(): any;
|
|
24
24
|
appendInitial(): import("./table").TableRowType | undefined;
|
|
25
25
|
array(): any;
|
|
26
|
-
|
|
26
|
+
getArrayLength(): any;
|
|
27
27
|
set(value: any): this;
|
|
28
28
|
getOffset(input: {
|
|
29
29
|
offset?: number | INumeric | Hex;
|
|
@@ -87,10 +87,10 @@ class FieldSymbol {
|
|
|
87
87
|
// @ts-ignore
|
|
88
88
|
return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.array();
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
getArrayLength() {
|
|
91
91
|
var _a;
|
|
92
92
|
// @ts-ignore
|
|
93
|
-
return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.
|
|
93
|
+
return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.getArrayLength();
|
|
94
94
|
}
|
|
95
95
|
set(value) {
|
|
96
96
|
var _a;
|
|
@@ -29,7 +29,7 @@ interface ITable {
|
|
|
29
29
|
getQualifiedName(): string | undefined;
|
|
30
30
|
getOptions(): ITableOptions | undefined;
|
|
31
31
|
getRowType(): TableRowType;
|
|
32
|
-
|
|
32
|
+
getArrayLength(): number;
|
|
33
33
|
clear(): void;
|
|
34
34
|
set(tab: Table | HashedTable | TableRowType): ITable;
|
|
35
35
|
getHeader(): TableRowType;
|
|
@@ -48,10 +48,12 @@ export declare class HashedTable implements ITable {
|
|
|
48
48
|
private readonly qualifiedName;
|
|
49
49
|
private secondaryIndexes;
|
|
50
50
|
constructor(rowType: TableRowType, options: ITableOptions, qualifiedName?: string);
|
|
51
|
-
|
|
51
|
+
getArrayLength(): number;
|
|
52
52
|
getKeyByName(name: string): ITableKey | undefined;
|
|
53
53
|
getSecondaryIndex(name: string): any[];
|
|
54
54
|
buildHashFromData(data: TableRowType): string;
|
|
55
|
+
deleteIndex(_index: number): void;
|
|
56
|
+
deleteFrom(row: TableRowType): void;
|
|
55
57
|
buildHashFromSimple(data: {
|
|
56
58
|
[key: string]: any;
|
|
57
59
|
}): string;
|
|
@@ -83,7 +85,7 @@ export declare class Table implements ITable {
|
|
|
83
85
|
private readonly isStructured;
|
|
84
86
|
private secondaryIndexes;
|
|
85
87
|
constructor(rowType: TableRowType, options: ITableOptions, qualifiedName?: string);
|
|
86
|
-
|
|
88
|
+
getArrayLength(): number;
|
|
87
89
|
getKeyByName(name: string): ITableKey | undefined;
|
|
88
90
|
getSecondaryIndex(name: string): TableRowType[];
|
|
89
91
|
getQualifiedName(): string | undefined;
|
package/build/src/types/table.js
CHANGED
|
@@ -65,7 +65,7 @@ class HashedTable {
|
|
|
65
65
|
}
|
|
66
66
|
this.qualifiedName = qualifiedName === null || qualifiedName === void 0 ? void 0 : qualifiedName.toUpperCase();
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
getArrayLength() {
|
|
69
69
|
return Object.keys(this.value).length;
|
|
70
70
|
}
|
|
71
71
|
getKeyByName(name) {
|
|
@@ -99,15 +99,36 @@ class HashedTable {
|
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
101
101
|
// @ts-ignore
|
|
102
|
-
|
|
102
|
+
let val = data.get()[k.toLowerCase()];
|
|
103
|
+
if (val instanceof structure_1.Structure) {
|
|
104
|
+
val = val.getCharacter();
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
val = val.get();
|
|
108
|
+
}
|
|
109
|
+
hash += k + ":" + val + "|";
|
|
103
110
|
}
|
|
104
111
|
}
|
|
105
112
|
return hash;
|
|
106
113
|
}
|
|
114
|
+
deleteIndex(_index) {
|
|
115
|
+
throw new Error("HashedTable, deleteIndex");
|
|
116
|
+
}
|
|
117
|
+
deleteFrom(row) {
|
|
118
|
+
const hash = this.buildHashFromData(row);
|
|
119
|
+
delete this.value[hash];
|
|
120
|
+
}
|
|
107
121
|
buildHashFromSimple(data) {
|
|
108
122
|
let hash = "";
|
|
109
123
|
for (const k of this.options.primaryKey.keyFields) {
|
|
110
|
-
|
|
124
|
+
let val = data[k.toLowerCase()];
|
|
125
|
+
if (val instanceof structure_1.Structure) {
|
|
126
|
+
val = val.getCharacter();
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
val = val.get();
|
|
130
|
+
}
|
|
131
|
+
hash += k + ":" + val + "|";
|
|
111
132
|
}
|
|
112
133
|
return hash;
|
|
113
134
|
}
|
|
@@ -221,7 +242,7 @@ class Table {
|
|
|
221
242
|
}
|
|
222
243
|
this.qualifiedName = qualifiedName === null || qualifiedName === void 0 ? void 0 : qualifiedName.toUpperCase();
|
|
223
244
|
}
|
|
224
|
-
|
|
245
|
+
getArrayLength() {
|
|
225
246
|
return this.value.length;
|
|
226
247
|
}
|
|
227
248
|
getKeyByName(name) {
|