@mcp-abap-adt/interfaces 0.2.4 → 0.2.6
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 +33 -0
- package/README.md +13 -5
- package/dist/connection/IAbapConnection.d.ts +30 -5
- package/dist/connection/IAbapConnection.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/token/ITokenRefresher.d.ts +39 -0
- package/dist/token/ITokenRefresher.d.ts.map +1 -0
- package/dist/token/ITokenRefresher.js +12 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.6] - 2025-12-21
|
|
11
|
+
|
|
12
|
+
### Removed
|
|
13
|
+
- **IAbapConnectionExtended**: Removed deprecated interface completely
|
|
14
|
+
- No backward compatibility - all consumers must use `IAbapConnection`
|
|
15
|
+
- Migration: Replace `IAbapConnectionExtended` with `IAbapConnection` in your code
|
|
16
|
+
- Methods `getConfig()`, `getAuthHeaders()`, `connect()`, `reset()` no longer in public interface
|
|
17
|
+
|
|
18
|
+
## [0.2.5] - 2025-12-21
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- **ITokenRefresher Interface**: New interface for dependency injection of token refresh logic into connections
|
|
22
|
+
- `getToken(): Promise<string>` - Get current valid token (cached or refreshed)
|
|
23
|
+
- `refreshToken(): Promise<string>` - Force refresh token and save to session store
|
|
24
|
+
- Created by `AuthBroker.createTokenRefresher(destination)` and injected into `JwtAbapConnection`
|
|
25
|
+
- Enables connections to handle 401/403 errors transparently without knowing about auth internals
|
|
26
|
+
- Exported from `@mcp-abap-adt/interfaces` in token domain
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- **IAbapConnection Simplified**: Removed implementation details from interface, keeping only consumer-facing methods
|
|
30
|
+
- Removed `getConfig()` - internal implementation detail
|
|
31
|
+
- Removed `getAuthHeaders()` - handled internally by `makeAdtRequest()`
|
|
32
|
+
- Removed `connect()` - handled internally, connection established on first request
|
|
33
|
+
- Removed `reset()` - internal method for token refresh logic
|
|
34
|
+
- Kept: `getBaseUrl()`, `getSessionId()`, `setSessionType()`, `makeAdtRequest()`
|
|
35
|
+
- This change simplifies the interface for consumers who only need to make requests
|
|
36
|
+
|
|
37
|
+
### Deprecated
|
|
38
|
+
- **IAbapConnectionExtended**: Added for backward compatibility, extends `IAbapConnection` with removed methods
|
|
39
|
+
- `getConfig()`, `getAuthHeaders()`, `connect()`, `reset()`
|
|
40
|
+
- Will be removed in next major version
|
|
41
|
+
- Use `IAbapConnection` for new code
|
|
42
|
+
|
|
10
43
|
## [0.2.4] - 2025-12-21
|
|
11
44
|
|
|
12
45
|
### Added
|
package/README.md
CHANGED
|
@@ -163,9 +163,13 @@ This package is responsible for:
|
|
|
163
163
|
- `AuthType` - Auth type: `'jwt' | 'xsuaa' | 'basic'`
|
|
164
164
|
|
|
165
165
|
### Token Domain (`token/`)
|
|
166
|
-
- `ITokenProvider` - Token provider interface
|
|
166
|
+
- `ITokenProvider` - Token provider interface (for auth-broker to get tokens from OAuth)
|
|
167
167
|
- `ITokenProviderResult` - Result from token provider
|
|
168
168
|
- `ITokenProviderOptions` - Options for token providers
|
|
169
|
+
- `ITokenRefresher` - Token refresher interface for DI into connections
|
|
170
|
+
- Created by `AuthBroker.createTokenRefresher(destination)`
|
|
171
|
+
- Injected into `JwtAbapConnection` to enable automatic token refresh
|
|
172
|
+
- Methods: `getToken()`, `refreshToken()`
|
|
169
173
|
|
|
170
174
|
### Session Domain (`session/`)
|
|
171
175
|
- `ISessionStore` - Session storage interface
|
|
@@ -174,10 +178,14 @@ This package is responsible for:
|
|
|
174
178
|
- `IServiceKeyStore` - Service key storage interface
|
|
175
179
|
|
|
176
180
|
### Connection Domain (`connection/`)
|
|
177
|
-
- `IAbapConnection` -
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
-
|
|
181
|
+
- `IAbapConnection` - Minimal connection interface for ADT operations
|
|
182
|
+
- Consumer-facing methods only: `getBaseUrl()`, `getSessionId()`, `setSessionType()`, `makeAdtRequest()`
|
|
183
|
+
- Implementation details (auth, CSRF, cookies, token refresh) are encapsulated
|
|
184
|
+
- For JWT: token refresh handled internally via `ITokenRefresher`
|
|
185
|
+
- For Basic: no token refresh needed
|
|
186
|
+
- `IAbapConnectionExtended` - Deprecated, for backward compatibility
|
|
187
|
+
- Extends `IAbapConnection` with: `getConfig()`, `getAuthHeaders()`, `connect()`, `reset()`
|
|
188
|
+
- Will be removed in next major version
|
|
181
189
|
- `IAbapRequestOptions` - Request options for ADT operations
|
|
182
190
|
|
|
183
191
|
### SAP Domain (`sap/`)
|
|
@@ -1,18 +1,43 @@
|
|
|
1
|
-
import type { ISapConfig } from '../sap/ISapConfig';
|
|
2
1
|
import type { IAbapRequestOptions } from './IAbapRequestOptions';
|
|
3
2
|
/**
|
|
4
3
|
* Axios response type - using any to avoid dependency on axios package
|
|
5
4
|
* Consumers should use proper AxiosResponse type from axios
|
|
6
5
|
*/
|
|
7
6
|
export type AxiosResponse = any;
|
|
7
|
+
/**
|
|
8
|
+
* ABAP Connection interface
|
|
9
|
+
*
|
|
10
|
+
* Minimal interface for consumers to interact with SAP ADT.
|
|
11
|
+
* Implementation details (auth, token refresh, CSRF, cookies) are encapsulated.
|
|
12
|
+
*
|
|
13
|
+
* For JWT connections, token refresh is handled internally via ITokenRefresher.
|
|
14
|
+
* For Basic connections, no token refresh is needed.
|
|
15
|
+
*/
|
|
8
16
|
export interface IAbapConnection {
|
|
9
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Get base URL of SAP system
|
|
19
|
+
*/
|
|
10
20
|
getBaseUrl(): Promise<string>;
|
|
11
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Get current session ID (for stateful connections)
|
|
23
|
+
*/
|
|
12
24
|
getSessionId(): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Set session type for subsequent requests
|
|
27
|
+
* @param type - "stateful" for persistent session, "stateless" for independent requests
|
|
28
|
+
*/
|
|
13
29
|
setSessionType(type: "stateful" | "stateless"): void;
|
|
30
|
+
/**
|
|
31
|
+
* Make ADT request to SAP system
|
|
32
|
+
*
|
|
33
|
+
* Handles all auth concerns internally:
|
|
34
|
+
* - Adds authorization header (Basic or Bearer)
|
|
35
|
+
* - Manages CSRF token
|
|
36
|
+
* - Retries on 401/403 with token refresh (JWT only)
|
|
37
|
+
*
|
|
38
|
+
* @param options - Request options (url, method, data, etc.)
|
|
39
|
+
* @returns Promise with Axios response
|
|
40
|
+
*/
|
|
14
41
|
makeAdtRequest(options: IAbapRequestOptions): Promise<AxiosResponse>;
|
|
15
|
-
connect(): Promise<void>;
|
|
16
|
-
reset(): void;
|
|
17
42
|
}
|
|
18
43
|
//# sourceMappingURL=IAbapConnection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection/IAbapConnection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"IAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection/IAbapConnection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC;AAEhC;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9B;;OAEG;IACH,YAAY,IAAI,MAAM,GAAG,IAAI,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,IAAI,CAAC;IAErD;;;;;;;;;;OAUG;IACH,cAAc,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACtE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type { AuthType } from './auth/AuthType';
|
|
|
11
11
|
export type { ITokenProvider } from './token/ITokenProvider';
|
|
12
12
|
export type { ITokenProviderResult } from './token/ITokenProviderResult';
|
|
13
13
|
export type { ITokenProviderOptions } from './token/ITokenProviderOptions';
|
|
14
|
+
export type { ITokenRefresher } from './token/ITokenRefresher';
|
|
14
15
|
export { TOKEN_PROVIDER_ERROR_CODES } from './token/TokenProviderErrorCodes';
|
|
15
16
|
export type { TokenProviderErrorCode } from './token/TokenProviderErrorCodes';
|
|
16
17
|
export type { ISessionStore } from './session/ISessionStore';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGhD,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,YAAY,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAG9E,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,y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AAE,MAAM,mCAAmC,CAAC;AAC9E,YAAY,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAGvE,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,cAAc,WAAW,CAAC;AAG1B,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Refresher interface
|
|
3
|
+
*
|
|
4
|
+
* Provides token management with automatic refresh capability.
|
|
5
|
+
* Implementations are created by AuthBroker and injected into connections.
|
|
6
|
+
*
|
|
7
|
+
* This enables dependency injection of token refresh logic into connections,
|
|
8
|
+
* allowing connections to focus on making requests while the refresher
|
|
9
|
+
* handles all auth/token lifecycle concerns.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Interface for token refresher
|
|
13
|
+
*
|
|
14
|
+
* Created by AuthBroker for a specific destination.
|
|
15
|
+
* Injected into JwtAbapConnection to enable automatic token refresh.
|
|
16
|
+
*/
|
|
17
|
+
export interface ITokenRefresher {
|
|
18
|
+
/**
|
|
19
|
+
* Get current valid token.
|
|
20
|
+
*
|
|
21
|
+
* May return cached token if still valid, or refresh if expired.
|
|
22
|
+
* Implementation decides when to refresh based on token expiration.
|
|
23
|
+
*
|
|
24
|
+
* @returns Promise that resolves to valid JWT token
|
|
25
|
+
*/
|
|
26
|
+
getToken(): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Force refresh token.
|
|
29
|
+
*
|
|
30
|
+
* Always obtains new token from provider, regardless of current token validity.
|
|
31
|
+
* Saves new token to session store (cache).
|
|
32
|
+
*
|
|
33
|
+
* Use this when getToken() returned a token that was rejected by server (401/403).
|
|
34
|
+
*
|
|
35
|
+
* @returns Promise that resolves to new JWT token
|
|
36
|
+
*/
|
|
37
|
+
refreshToken(): Promise<string>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=ITokenRefresher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ITokenRefresher.d.ts","sourceRoot":"","sources":["../../src/token/ITokenRefresher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;OAOG;IACH,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5B;;;;;;;;;OASG;IACH,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACjC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Token Refresher interface
|
|
4
|
+
*
|
|
5
|
+
* Provides token management with automatic refresh capability.
|
|
6
|
+
* Implementations are created by AuthBroker and injected into connections.
|
|
7
|
+
*
|
|
8
|
+
* This enables dependency injection of token refresh logic into connections,
|
|
9
|
+
* allowing connections to focus on making requests while the refresher
|
|
10
|
+
* handles all auth/token lifecycle concerns.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|