@abaplint/runtime 2.13.28 → 2.13.30

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.
@@ -2,8 +2,34 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dynamicCallLookup = dynamicCallLookup;
4
4
  const throw_error_1 = require("./throw_error");
5
+ function findInterfaceMethod(obj, name) {
6
+ const suffix = "$" + name;
7
+ const found = [];
8
+ const seen = new Set();
9
+ let current = obj;
10
+ while (current !== undefined && current !== null) {
11
+ for (const key of Object.getOwnPropertyNames(current)) {
12
+ if (seen.has(key)) {
13
+ continue;
14
+ }
15
+ seen.add(key);
16
+ if (key.endsWith(suffix) && typeof obj[key] === "function") {
17
+ found.push(obj[key]);
18
+ }
19
+ }
20
+ current = Object.getPrototypeOf(current);
21
+ }
22
+ return found.length === 1 ? found[0] : undefined;
23
+ }
24
+ function findFriendInterfaceMethod(obj, name) {
25
+ const suffix = "$" + name;
26
+ const found = Object.keys(obj.FRIENDS_ACCESS_INSTANCE || {})
27
+ .filter(key => key.endsWith(suffix))
28
+ .map(key => obj.FRIENDS_ACCESS_INSTANCE[key]);
29
+ return found.length === 1 ? found[0] : undefined;
30
+ }
5
31
  function dynamicCallLookup(obj, methodName) {
6
- let name = typeof methodName === "string" ? methodName : methodName.get().toLowerCase().trimEnd();
32
+ let name = typeof methodName === "string" ? methodName.toLowerCase().trimEnd() : methodName.get().toLowerCase().trimEnd();
7
33
  name = name.replaceAll("~", "$").replaceAll("/", "$");
8
34
  let ret = obj[name];
9
35
  if (ret !== undefined) {
@@ -14,6 +40,15 @@ function dynamicCallLookup(obj, methodName) {
14
40
  // FRIENDS_ACCESS_INSTANCE is already .bind()'ed
15
41
  ret = obj.FRIENDS_ACCESS_INSTANCE[name];
16
42
  }
43
+ if (ret === undefined && name.includes("$") === false) {
44
+ ret = findInterfaceMethod(obj, name);
45
+ if (ret !== undefined) {
46
+ ret = ret.bind(obj);
47
+ }
48
+ else if (obj.FRIENDS_ACCESS_INSTANCE !== undefined) {
49
+ ret = findFriendInterfaceMethod(obj, name);
50
+ }
51
+ }
17
52
  if (ret === undefined) {
18
53
  (0, throw_error_1.throwError)("CX_SY_DYN_CALL_ILLEGAL_METHOD");
19
54
  }
@@ -1,18 +1,51 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.ABAP = exports.MemoryConsole = exports.DB = exports.types = exports.RFC = void 0;
4
37
  const context_1 = require("./context");
5
38
  const offset_length_1 = require("./offset_length");
6
39
  const statements_1 = require("./statements");
7
40
  const template_formatting_1 = require("./template_formatting");
8
- const builtin = require("./builtin");
9
- const compare = require("./compare");
10
- const DB = require("./db/db");
41
+ const builtin = __importStar(require("./builtin"));
42
+ const compare = __importStar(require("./compare"));
43
+ const DB = __importStar(require("./db/db"));
11
44
  exports.DB = DB;
12
- const operators = require("./operators");
13
- const RFC = require("./rfc");
45
+ const operators = __importStar(require("./operators"));
46
+ const RFC = __importStar(require("./rfc"));
14
47
  exports.RFC = RFC;
15
- const types = require("./types");
48
+ const types = __importStar(require("./types"));
16
49
  exports.types = types;
17
50
  const expand_in_1 = require("./expand_in");
18
51
  const expand_dynamic_1 = require("./expand_dynamic");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.13.28",
3
+ "version": "2.13.30",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -31,10 +31,11 @@
31
31
  "devDependencies": {
32
32
  "@types/chai": "^4.3.20",
33
33
  "@types/mocha": "^10.0.10",
34
+ "@types/node": "^24.13.2",
34
35
  "chai": "^4.5.0",
35
- "mocha": "^11.7.5",
36
+ "mocha": "^11.7.6",
36
37
  "source-map-support": "^0.5.21",
37
- "typescript": "^5.9.3"
38
+ "typescript": "^6.0.3"
38
39
  },
39
40
  "dependencies": {
40
41
  "temporal-polyfill": "^0.3.2"