@mcp-abap-adt/connection 9.4.2 → 10.0.1
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/CHANGELOG.md +175 -1
- package/README.md +77 -36
- package/dist/connection/AbstractAbapConnection.d.ts +211 -56
- package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
- package/dist/connection/AbstractAbapConnection.js +622 -255
- package/dist/connection/CloudHttpTransport.d.ts.map +1 -1
- package/dist/connection/CloudHttpTransport.js +15 -5
- package/dist/connection/CredentialAbapConnection.d.ts +21 -20
- package/dist/connection/CredentialAbapConnection.d.ts.map +1 -1
- package/dist/connection/CredentialAbapConnection.js +39 -46
- package/dist/connection/HttpTransport.d.ts +30 -14
- package/dist/connection/HttpTransport.d.ts.map +1 -1
- package/dist/connection/HttpTransport.js +99 -19
- package/dist/connection/IAdtTransport.d.ts +19 -2
- package/dist/connection/IAdtTransport.d.ts.map +1 -1
- package/dist/connection/OnPremHttpTransport.d.ts.map +1 -1
- package/dist/connection/OnPremHttpTransport.js +4 -3
- package/dist/connection/RfcTransport.d.ts +23 -3
- package/dist/connection/RfcTransport.d.ts.map +1 -1
- package/dist/connection/RfcTransport.js +48 -15
- package/dist/connection/authErrors.d.ts +61 -0
- package/dist/connection/authErrors.d.ts.map +1 -0
- package/dist/connection/authErrors.js +78 -0
- package/dist/connection/requestTarget.d.ts +12 -0
- package/dist/connection/requestTarget.d.ts.map +1 -0
- package/dist/connection/requestTarget.js +23 -0
- package/dist/connection/rfcConversation.d.ts +10 -5
- package/dist/connection/rfcConversation.d.ts.map +1 -1
- package/dist/connection/rfcConversation.js +6 -8
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -12
- package/dist/session/SessionLifecycle.d.ts +1 -1
- package/dist/session/SessionLifecycle.d.ts.map +1 -1
- package/docs/INDEX.md +4 -1
- package/docs/INSTALLATION.md +12 -5
- package/docs/JWT_AUTH_TOOLS.md +2 -2
- package/docs/MIGRATION-10.0.md +284 -0
- package/docs/SCOPE.md +2 -2
- package/docs/STATEFUL_SESSION_GUIDE.md +30 -10
- package/docs/USAGE.md +118 -35
- package/examples/README.md +5 -4
- package/examples/basic-connection.js +1 -1
- package/examples/jwt-with-token-refresh.js +14 -15
- package/examples/saml-connection.js +1 -1
- package/package.json +4 -3
- package/dist/auth/FileCertificateMaterialLoader.d.ts +0 -6
- package/dist/auth/FileCertificateMaterialLoader.d.ts.map +0 -1
- package/dist/auth/FileCertificateMaterialLoader.js +0 -28
- package/dist/auth/ntlm.d.ts +0 -26
- package/dist/auth/ntlm.d.ts.map +0 -1
- package/dist/auth/ntlm.js +0 -72
- package/dist/auth/providers.d.ts +0 -125
- package/dist/auth/providers.d.ts.map +0 -1
- package/dist/auth/providers.js +0 -183
- package/dist/utils/tokenRefresh.d.ts +0 -15
- package/dist/utils/tokenRefresh.d.ts.map +0 -1
- package/dist/utils/tokenRefresh.js +0 -55
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
}
|