@babamba2/mcp-abap-connection 1.5.3
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/LICENSE +21 -0
- package/README.md +522 -0
- package/bin/sap-abap-auth.js +665 -0
- package/dist/config/sapConfig.d.ts +5 -0
- package/dist/config/sapConfig.d.ts.map +1 -0
- package/dist/config/sapConfig.js +26 -0
- package/dist/connection/AbapConnection.d.ts +4 -0
- package/dist/connection/AbapConnection.d.ts.map +1 -0
- package/dist/connection/AbapConnection.js +2 -0
- package/dist/connection/AbstractAbapConnection.d.ts +89 -0
- package/dist/connection/AbstractAbapConnection.d.ts.map +1 -0
- package/dist/connection/AbstractAbapConnection.js +612 -0
- package/dist/connection/BaseAbapConnection.d.ts +19 -0
- package/dist/connection/BaseAbapConnection.d.ts.map +1 -0
- package/dist/connection/BaseAbapConnection.js +65 -0
- package/dist/connection/GenericWebSocketTransport.d.ts +46 -0
- package/dist/connection/GenericWebSocketTransport.d.ts.map +1 -0
- package/dist/connection/GenericWebSocketTransport.js +135 -0
- package/dist/connection/JwtAbapConnection.d.ts +37 -0
- package/dist/connection/JwtAbapConnection.d.ts.map +1 -0
- package/dist/connection/JwtAbapConnection.js +181 -0
- package/dist/connection/RfcAbapConnection.d.ts +49 -0
- package/dist/connection/RfcAbapConnection.d.ts.map +1 -0
- package/dist/connection/RfcAbapConnection.js +322 -0
- package/dist/connection/SamlAbapConnection.d.ts +21 -0
- package/dist/connection/SamlAbapConnection.d.ts.map +1 -0
- package/dist/connection/SamlAbapConnection.js +65 -0
- package/dist/connection/connectionFactory.d.ts +8 -0
- package/dist/connection/connectionFactory.d.ts.map +1 -0
- package/dist/connection/connectionFactory.js +23 -0
- package/dist/connection/csrfConfig.d.ts +46 -0
- package/dist/connection/csrfConfig.d.ts.map +1 -0
- package/dist/connection/csrfConfig.js +48 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +2 -0
- package/dist/utils/timeouts.d.ts +5 -0
- package/dist/utils/timeouts.d.ts.map +1 -0
- package/dist/utils/timeouts.js +21 -0
- package/dist/utils/tokenRefresh.d.ts +15 -0
- package/dist/utils/tokenRefresh.d.ts.map +1 -0
- package/dist/utils/tokenRefresh.js +55 -0
- package/package.json +70 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token refresh utilities for JWT authentication
|
|
3
|
+
*/
|
|
4
|
+
import type { ITokenRefreshResult } from '@babamba2/mcp-abap-adt-interfaces';
|
|
5
|
+
export type TokenRefreshResult = ITokenRefreshResult;
|
|
6
|
+
/**
|
|
7
|
+
* Refreshes the access token using refresh token
|
|
8
|
+
* @param refreshToken Refresh token
|
|
9
|
+
* @param uaaUrl UAA URL (e.g., https://your-account.authentication.eu10.hana.ondemand.com)
|
|
10
|
+
* @param clientId UAA client ID
|
|
11
|
+
* @param clientSecret UAA client secret
|
|
12
|
+
* @returns Promise that resolves to new tokens
|
|
13
|
+
*/
|
|
14
|
+
export declare function refreshJwtToken(refreshToken: string, uaaUrl: string, clientId: string, clientSecret: string): Promise<ITokenRefreshResult>;
|
|
15
|
+
//# sourceMappingURL=tokenRefresh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenRefresh.d.ts","sourceRoot":"","sources":["../../src/utils/tokenRefresh.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAI7E,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAErD;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,mBAAmB,CAAC,CA0C9B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Token refresh utilities for JWT authentication
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.refreshJwtToken = refreshJwtToken;
|
|
10
|
+
const axios_1 = __importDefault(require("axios"));
|
|
11
|
+
/**
|
|
12
|
+
* Refreshes the access token using refresh token
|
|
13
|
+
* @param refreshToken Refresh token
|
|
14
|
+
* @param uaaUrl UAA URL (e.g., https://your-account.authentication.eu10.hana.ondemand.com)
|
|
15
|
+
* @param clientId UAA client ID
|
|
16
|
+
* @param clientSecret UAA client secret
|
|
17
|
+
* @returns Promise that resolves to new tokens
|
|
18
|
+
*/
|
|
19
|
+
async function refreshJwtToken(refreshToken, uaaUrl, clientId, clientSecret) {
|
|
20
|
+
try {
|
|
21
|
+
const tokenUrl = `${uaaUrl}/oauth/token`;
|
|
22
|
+
const params = new URLSearchParams();
|
|
23
|
+
params.append('grant_type', 'refresh_token');
|
|
24
|
+
params.append('refresh_token', refreshToken);
|
|
25
|
+
const authString = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');
|
|
26
|
+
const response = await (0, axios_1.default)({
|
|
27
|
+
method: 'post',
|
|
28
|
+
url: tokenUrl,
|
|
29
|
+
headers: {
|
|
30
|
+
Authorization: `Basic ${authString}`,
|
|
31
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
32
|
+
},
|
|
33
|
+
data: params.toString(),
|
|
34
|
+
});
|
|
35
|
+
if (response.data?.access_token) {
|
|
36
|
+
return {
|
|
37
|
+
accessToken: response.data.access_token,
|
|
38
|
+
refreshToken: response.data.refresh_token || refreshToken, // Use new refresh token if provided, otherwise keep old one
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
throw new Error('Response does not contain access_token');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const err = error;
|
|
47
|
+
if (err.response) {
|
|
48
|
+
throw new Error(`Token refresh failed (${err.response.status}): ${JSON.stringify(err.response.data)}`);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
52
|
+
throw new Error(`Token refresh failed: ${errorMessage}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@babamba2/mcp-abap-connection",
|
|
3
|
+
"version": "1.5.3",
|
|
4
|
+
"description": "ABAP connection layer for MCP ABAP ADT server (fork of @mcp-abap-adt/connection by fr0ster)",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"bin",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"bin": {
|
|
14
|
+
"sap-abap-auth": "./bin/sap-abap-auth.js"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"abap",
|
|
18
|
+
"sap",
|
|
19
|
+
"adt",
|
|
20
|
+
"connection",
|
|
21
|
+
"mcp",
|
|
22
|
+
"abap-adt"
|
|
23
|
+
],
|
|
24
|
+
"author": "babamba2 <psspss1122@gmail.com>",
|
|
25
|
+
"contributors": [
|
|
26
|
+
"Oleksii Kyslytsia <oleksij.kyslytsja@gmail.com> (original author)"
|
|
27
|
+
],
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"homepage": "https://github.com/babamba2/mcp-abap-connection#readme",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/babamba2/mcp-abap-connection/issues"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/babamba2/mcp-abap-connection.git"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"chrono": "./tools/version-stats.sh",
|
|
42
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
43
|
+
"lint": "npx biome check --write src",
|
|
44
|
+
"lint:check": "npx biome check src",
|
|
45
|
+
"format": "npx biome format --write src",
|
|
46
|
+
"build": "npm run --silent clean && npx biome check src --diagnostic-level=error && npx tsc -p tsconfig.json",
|
|
47
|
+
"build:fast": "npx tsc -p tsconfig.json",
|
|
48
|
+
"test": "jest",
|
|
49
|
+
"prepublishOnly": "npm run build:fast"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18.0.0"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@babamba2/mcp-abap-adt-interfaces": "^3.1.0",
|
|
56
|
+
"axios": "^1.13.5",
|
|
57
|
+
"commander": "^14.0.3",
|
|
58
|
+
"express": "^5.1.0",
|
|
59
|
+
"open": "^11.0.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@biomejs/biome": "^2.3.14",
|
|
63
|
+
"@types/jest": "^30.0.0",
|
|
64
|
+
"@types/node": "^25.2.3",
|
|
65
|
+
"jest": "^30.2.0",
|
|
66
|
+
"jest-util": "^30.2.0",
|
|
67
|
+
"ts-jest": "^29.2.5",
|
|
68
|
+
"typescript": "^5.9.2"
|
|
69
|
+
}
|
|
70
|
+
}
|