@mcp-abap-adt/interfaces 0.2.7 → 0.2.9

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 CHANGED
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.9] - 2025-12-23
11
+
12
+ ### Changed
13
+ - **OAuth2 grant types**: Removed `AUTH_TYPE_IMPLICIT` and added `AUTH_TYPE_USER_TOKEN` and `AUTH_TYPE_CLIENT_X509` to `OAuth2GrantType`.
14
+
15
+ ## [0.2.8] - 2025-12-23
16
+
17
+ ### Added
18
+ - **New Token Provider Interface**: Added `getTokens()` method to `ITokenProvider` for stateful token management
19
+ - New `ITokenResult` interface with `authorizationToken`, `refreshToken`, `authType`, and `expiresIn` fields
20
+ - New `OAuth2GrantType` type and constants for OAuth2 grant types:
21
+ - `AUTH_TYPE_AUTHORIZATION_CODE` - Standard authorization code flow
22
+ - `AUTH_TYPE_AUTHORIZATION_CODE_PKCE` - Authorization code with PKCE
23
+ - `AUTH_TYPE_IMPLICIT` - Implicit grant (legacy)
24
+ - `AUTH_TYPE_PASSWORD` - Password credentials grant
25
+ - `AUTH_TYPE_CLIENT_CREDENTIALS` - Client credentials grant
26
+ - All old methods (`getConnectionConfig`, `refreshTokenFromSession`, `refreshTokenFromServiceKey`) remain optional for backward compatibility
27
+
28
+ ### Changed
29
+ - **ITokenProvider Interface**: Extended with optional `getTokens()` method
30
+ - Old stateless methods are now optional (marked with `?`)
31
+ - New stateful `getTokens()` method is optional (marked with `?`)
32
+ - Allows gradual migration from old to new API
33
+
10
34
  ## [0.2.7] - 2025-12-22
11
35
 
12
36
  ### Changed
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  export type { IAdtObject, IAdtOperationOptions } from './adt/IAdtObject';
8
8
  export { AdtObjectErrorCodes } from './adt/IAdtObject';
9
9
  export type { IAdtObjectConfig, IAdtObjectState } from './adt/IAdtObjectState';
10
- export type { AuthType } from './auth/AuthType';
10
+ export type { AuthType as AuthTypeEnum } from './auth/AuthType';
11
11
  export type { IAuthorizationConfig } from './auth/IAuthorizationConfig';
12
12
  export type { IConfig } from './auth/IConfig';
13
13
  export type { IConnectionConfig } from './auth/IConnectionConfig';
@@ -26,10 +26,13 @@ export type { ISessionState } from './storage/ISessionState';
26
26
  export type { ISessionStorage } from './storage/ISessionStorage';
27
27
  export type { StoreErrorCode } from './store/StoreErrorCodes';
28
28
  export { STORE_ERROR_CODES } from './store/StoreErrorCodes';
29
+ export type { OAuth2GrantType } from './token/AuthType';
30
+ export { AUTH_TYPE_AUTHORIZATION_CODE, AUTH_TYPE_AUTHORIZATION_CODE_PKCE, AUTH_TYPE_CLIENT_CREDENTIALS, AUTH_TYPE_CLIENT_X509, AUTH_TYPE_PASSWORD, AUTH_TYPE_USER_TOKEN, } from './token/AuthType';
29
31
  export type { ITokenProvider } from './token/ITokenProvider';
30
32
  export type { ITokenProviderOptions } from './token/ITokenProviderOptions';
31
33
  export type { ITokenProviderResult } from './token/ITokenProviderResult';
32
34
  export type { ITokenRefresher } from './token/ITokenRefresher';
35
+ export type { ITokenResult } from './token/ITokenResult';
33
36
  export type { TokenProviderErrorCode } from './token/TokenProviderErrorCodes';
34
37
  export { TOKEN_PROVIDER_ERROR_CODES } from './token/TokenProviderErrorCodes';
35
38
  export type { ITimeoutConfig } from './utils/ITimeoutConfig';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC/E,YAAY,EAAE,QAAQ,EA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default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.AuthMethodPriority = exports.TOKEN_PROVIDER_ERROR_CODES = exports.STORE_ERROR_CODES = exports.LogLevel = exports.NETWORK_ERROR_CODES = exports.isNetworkError = exports.AdtObjectErrorCodes = void 0;
23
+ exports.AuthMethodPriority = exports.TOKEN_PROVIDER_ERROR_CODES = exports.AUTH_TYPE_USER_TOKEN = exports.AUTH_TYPE_PASSWORD = exports.AUTH_TYPE_CLIENT_X509 = exports.AUTH_TYPE_CLIENT_CREDENTIALS = exports.AUTH_TYPE_AUTHORIZATION_CODE_PKCE = exports.AUTH_TYPE_AUTHORIZATION_CODE = exports.STORE_ERROR_CODES = exports.LogLevel = exports.NETWORK_ERROR_CODES = exports.isNetworkError = exports.AdtObjectErrorCodes = void 0;
24
24
  var IAdtObject_1 = require("./adt/IAdtObject");
25
25
  Object.defineProperty(exports, "AdtObjectErrorCodes", { enumerable: true, get: function () { return IAdtObject_1.AdtObjectErrorCodes; } });
26
26
  var NetworkErrors_1 = require("./connection/NetworkErrors");
@@ -33,6 +33,13 @@ Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function ()
33
33
  // Store domain
34
34
  var StoreErrorCodes_1 = require("./store/StoreErrorCodes");
35
35
  Object.defineProperty(exports, "STORE_ERROR_CODES", { enumerable: true, get: function () { return StoreErrorCodes_1.STORE_ERROR_CODES; } });
36
+ var AuthType_1 = require("./token/AuthType");
37
+ Object.defineProperty(exports, "AUTH_TYPE_AUTHORIZATION_CODE", { enumerable: true, get: function () { return AuthType_1.AUTH_TYPE_AUTHORIZATION_CODE; } });
38
+ Object.defineProperty(exports, "AUTH_TYPE_AUTHORIZATION_CODE_PKCE", { enumerable: true, get: function () { return AuthType_1.AUTH_TYPE_AUTHORIZATION_CODE_PKCE; } });
39
+ Object.defineProperty(exports, "AUTH_TYPE_CLIENT_CREDENTIALS", { enumerable: true, get: function () { return AuthType_1.AUTH_TYPE_CLIENT_CREDENTIALS; } });
40
+ Object.defineProperty(exports, "AUTH_TYPE_CLIENT_X509", { enumerable: true, get: function () { return AuthType_1.AUTH_TYPE_CLIENT_X509; } });
41
+ Object.defineProperty(exports, "AUTH_TYPE_PASSWORD", { enumerable: true, get: function () { return AuthType_1.AUTH_TYPE_PASSWORD; } });
42
+ Object.defineProperty(exports, "AUTH_TYPE_USER_TOKEN", { enumerable: true, get: function () { return AuthType_1.AUTH_TYPE_USER_TOKEN; } });
36
43
  var TokenProviderErrorCodes_1 = require("./token/TokenProviderErrorCodes");
37
44
  Object.defineProperty(exports, "TOKEN_PROVIDER_ERROR_CODES", { enumerable: true, get: function () { return TokenProviderErrorCodes_1.TOKEN_PROVIDER_ERROR_CODES; } });
38
45
  var IValidatedAuthConfig_1 = require("./validation/IValidatedAuthConfig");
@@ -0,0 +1,38 @@
1
+ /**
2
+ * OAuth2 Grant Types
3
+ *
4
+ * Constants for different OAuth2 authentication flows (grant types)
5
+ */
6
+ /**
7
+ * Authorization Code grant type
8
+ * Standard OAuth2 flow with browser-based authorization
9
+ */
10
+ export declare const AUTH_TYPE_AUTHORIZATION_CODE: "authorization_code";
11
+ /**
12
+ * Authorization Code with PKCE grant type
13
+ * More secure variant for public clients
14
+ */
15
+ export declare const AUTH_TYPE_AUTHORIZATION_CODE_PKCE: "authorization_code_pkce";
16
+ /**
17
+ * Password Credentials grant type
18
+ * Direct username/password authentication
19
+ */
20
+ export declare const AUTH_TYPE_PASSWORD: "password";
21
+ /**
22
+ * Client Credentials grant type
23
+ * Service-to-service authentication
24
+ */
25
+ export declare const AUTH_TYPE_CLIENT_CREDENTIALS: "client_credentials";
26
+ /**
27
+ * User token passthrough (external token)
28
+ */
29
+ export declare const AUTH_TYPE_USER_TOKEN: "user_token";
30
+ /**
31
+ * Client X509 (mTLS) authentication
32
+ */
33
+ export declare const AUTH_TYPE_CLIENT_X509: "client_x509";
34
+ /**
35
+ * Union type for all OAuth2 grant types
36
+ */
37
+ export type OAuth2GrantType = typeof AUTH_TYPE_AUTHORIZATION_CODE | typeof AUTH_TYPE_AUTHORIZATION_CODE_PKCE | typeof AUTH_TYPE_PASSWORD | typeof AUTH_TYPE_CLIENT_CREDENTIALS | typeof AUTH_TYPE_USER_TOKEN | typeof AUTH_TYPE_CLIENT_X509;
38
+ //# sourceMappingURL=AuthType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthType.d.ts","sourceRoot":"","sources":["../../src/token/AuthType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAG,oBAA6B,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,iCAAiC,EAC5C,yBAAkC,CAAC;AAErC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAG,UAAmB,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAG,oBAA6B,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAG,YAAqB,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAG,aAAsB,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,OAAO,4BAA4B,GACnC,OAAO,iCAAiC,GACxC,OAAO,kBAAkB,GACzB,OAAO,4BAA4B,GACnC,OAAO,oBAAoB,GAC3B,OAAO,qBAAqB,CAAC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * OAuth2 Grant Types
4
+ *
5
+ * Constants for different OAuth2 authentication flows (grant types)
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.AUTH_TYPE_CLIENT_X509 = exports.AUTH_TYPE_USER_TOKEN = exports.AUTH_TYPE_CLIENT_CREDENTIALS = exports.AUTH_TYPE_PASSWORD = exports.AUTH_TYPE_AUTHORIZATION_CODE_PKCE = exports.AUTH_TYPE_AUTHORIZATION_CODE = void 0;
9
+ /**
10
+ * Authorization Code grant type
11
+ * Standard OAuth2 flow with browser-based authorization
12
+ */
13
+ exports.AUTH_TYPE_AUTHORIZATION_CODE = 'authorization_code';
14
+ /**
15
+ * Authorization Code with PKCE grant type
16
+ * More secure variant for public clients
17
+ */
18
+ exports.AUTH_TYPE_AUTHORIZATION_CODE_PKCE = 'authorization_code_pkce';
19
+ /**
20
+ * Password Credentials grant type
21
+ * Direct username/password authentication
22
+ */
23
+ exports.AUTH_TYPE_PASSWORD = 'password';
24
+ /**
25
+ * Client Credentials grant type
26
+ * Service-to-service authentication
27
+ */
28
+ exports.AUTH_TYPE_CLIENT_CREDENTIALS = 'client_credentials';
29
+ /**
30
+ * User token passthrough (external token)
31
+ */
32
+ exports.AUTH_TYPE_USER_TOKEN = 'user_token';
33
+ /**
34
+ * Client X509 (mTLS) authentication
35
+ */
36
+ exports.AUTH_TYPE_CLIENT_X509 = 'client_x509';
@@ -1,45 +1,55 @@
1
1
  /**
2
2
  * Token Provider interface
3
3
  *
4
- * Converts IAuthorizationConfig to IConnectionConfig by obtaining tokens.
5
- * Different implementations handle different authentication flows:
6
- * - XSUAA: client_credentials grant type (no browser)
7
- * - BTP/ABAP: browser-based OAuth2 or refresh token
4
+ * Stateful providers that manage token lifecycle internally.
5
+ * Supports both old stateless methods (for backward compatibility) and new stateful getTokens() method.
8
6
  */
9
7
  import type { IAuthorizationConfig } from '../auth/IAuthorizationConfig';
10
8
  import type { ITokenProviderOptions } from './ITokenProviderOptions';
11
9
  import type { ITokenProviderResult } from './ITokenProviderResult';
10
+ import type { ITokenResult } from './ITokenResult';
12
11
  /**
13
12
  * Interface for token providers
14
13
  *
15
- * Takes authorization configuration and returns connection configuration with token.
14
+ * Supports both:
15
+ * - Old stateless methods (for backward compatibility with existing code)
16
+ * - New stateful getTokens() method (for new implementations)
16
17
  */
17
18
  export interface ITokenProvider {
18
19
  /**
19
- * Get connection configuration with token from authorization configuration
20
+ * Get tokens with automatic refresh/relogin logic (NEW - stateful method)
21
+ *
22
+ * Stateful providers cache tokens internally and handle refresh automatically.
23
+ * Checks token expiration, refreshes if needed, or triggers login.
24
+ *
25
+ * @returns Promise that resolves to token result with authorization token, optional refresh token, auth type, and expiration
26
+ */
27
+ getTokens?(): Promise<ITokenResult>;
28
+ /**
29
+ * Get connection configuration with token from authorization configuration (OLD - stateless method)
20
30
  * @param authConfig Authorization configuration (UAA credentials, optional refresh token)
21
31
  * @param options Optional provider-specific options (e.g., browser type for BTP)
22
32
  * @returns Promise that resolves to connection configuration with authorization token and optional refresh token
23
33
  */
24
- getConnectionConfig(authConfig: IAuthorizationConfig, options?: ITokenProviderOptions): Promise<ITokenProviderResult>;
34
+ getConnectionConfig?(authConfig: IAuthorizationConfig, options?: ITokenProviderOptions): Promise<ITokenProviderResult>;
25
35
  /**
26
- * Refresh token using refresh token from session (authorization config with refreshToken)
36
+ * Refresh token using refresh token from session (OLD - stateless method)
27
37
  * This method uses the refresh token from the session to get a new access token.
28
38
  * Typically uses refresh_token grant type or browser-based re-authentication.
29
39
  * @param authConfig Authorization configuration including refreshToken from session
30
40
  * @param options Optional provider-specific options (e.g., browser type for BTP)
31
41
  * @returns Promise that resolves to connection configuration with new authorization token and optional new refresh token
32
42
  */
33
- refreshTokenFromSession(authConfig: IAuthorizationConfig, options?: ITokenProviderOptions): Promise<ITokenProviderResult>;
43
+ refreshTokenFromSession?(authConfig: IAuthorizationConfig, options?: ITokenProviderOptions): Promise<ITokenProviderResult>;
34
44
  /**
35
- * Refresh token using UAA credentials from service key (authorization config without refreshToken)
45
+ * Refresh token using UAA credentials from service key (OLD - stateless method)
36
46
  * This method uses UAA credentials (uaaUrl, uaaClientId, uaaClientSecret) to get a new token.
37
47
  * Typically uses browser-based authorization flow to ensure proper role assignment.
38
48
  * @param authConfig Authorization configuration with UAA credentials from service key (no refreshToken)
39
49
  * @param options Optional provider-specific options (e.g., browser type for BTP)
40
50
  * @returns Promise that resolves to connection configuration with new authorization token and optional refresh token
41
51
  */
42
- refreshTokenFromServiceKey(authConfig: IAuthorizationConfig, options?: ITokenProviderOptions): Promise<ITokenProviderResult>;
52
+ refreshTokenFromServiceKey?(authConfig: IAuthorizationConfig, options?: ITokenProviderOptions): Promise<ITokenProviderResult>;
43
53
  /**
44
54
  * Validate JWT token by testing connection to service
45
55
  * @param token JWT token to validate
@@ -1 +1 @@
1
- {"version":3,"file":"ITokenProvider.d.ts","sourceRoot":"","sources":["../../src/token/ITokenProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,mBAAmB,CACjB,UAAU,EAAE,oBAAoB,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;OAOG;IACH,uBAAuB,CACrB,UAAU,EAAE,oBAAoB,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;OAOG;IACH,0BAA0B,CACxB,UAAU,EAAE,oBAAoB,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;OAKG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtE"}
1
+ {"version":3,"file":"ITokenProvider.d.ts","sourceRoot":"","sources":["../../src/token/ITokenProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;OAOG;IACH,SAAS,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAEpC;;;;;OAKG;IACH,mBAAmB,CAAC,CAClB,UAAU,EAAE,oBAAoB,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;OAOG;IACH,uBAAuB,CAAC,CACtB,UAAU,EAAE,oBAAoB,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;OAOG;IACH,0BAA0B,CAAC,CACzB,UAAU,EAAE,oBAAoB,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;OAKG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtE"}
@@ -2,9 +2,7 @@
2
2
  /**
3
3
  * Token Provider interface
4
4
  *
5
- * Converts IAuthorizationConfig to IConnectionConfig by obtaining tokens.
6
- * Different implementations handle different authentication flows:
7
- * - XSUAA: client_credentials grant type (no browser)
8
- * - BTP/ABAP: browser-based OAuth2 or refresh token
5
+ * Stateful providers that manage token lifecycle internally.
6
+ * Supports both old stateless methods (for backward compatibility) and new stateful getTokens() method.
9
7
  */
10
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Token result interface
3
+ *
4
+ * Result returned by ITokenProvider.getTokens() method
5
+ */
6
+ import type { OAuth2GrantType } from './AuthType';
7
+ export interface ITokenResult {
8
+ /**
9
+ * Authorization token (access token)
10
+ */
11
+ authorizationToken: string;
12
+ /**
13
+ * Refresh token (optional, not all grant types provide it)
14
+ */
15
+ refreshToken?: string;
16
+ /**
17
+ * Authentication type (OAuth2 grant type used)
18
+ */
19
+ authType: OAuth2GrantType;
20
+ /**
21
+ * Token expiration time in seconds
22
+ * If not provided, token expiration is determined from JWT exp claim
23
+ */
24
+ expiresIn?: number;
25
+ }
26
+ //# sourceMappingURL=ITokenResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITokenResult.d.ts","sourceRoot":"","sources":["../../src/token/ITokenResult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Token result interface
4
+ *
5
+ * Result returned by ITokenProvider.getTokens() method
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/interfaces",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Shared interfaces for MCP ABAP ADT packages",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",