@mcp-abap-adt/interfaces 0.2.0 → 0.2.2

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,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.2] - 2025-12-19
11
+
12
+ ### Added
13
+ - **Token Provider Error Codes**: Added standardized error codes for token provider operations
14
+ - `TOKEN_PROVIDER_ERROR_CODES` - Object containing error codes for token provider failures:
15
+ - `VALIDATION_ERROR` - Authentication configuration validation failed
16
+ - `REFRESH_ERROR` - Token refresh operation failed
17
+ - `SESSION_DATA_ERROR` - Session data is invalid or incomplete
18
+ - `SERVICE_KEY_ERROR` - Service key data is invalid or incomplete
19
+ - `BROWSER_AUTH_ERROR` - Browser authentication failed or was cancelled
20
+ - `TokenProviderErrorCode` - Type for token provider error codes
21
+ - These constants enable consistent error handling across token providers and auth-broker
22
+ - Error codes help distinguish between different types of authentication failures
23
+ - Exported from `@mcp-abap-adt/interfaces` package in token domain
24
+
25
+ ## [0.2.1] - 2025-12-19
26
+
27
+ ### Added
28
+ - **Token Refresh Methods in ITokenProvider**: Added two new methods to `ITokenProvider` interface for explicit refresh scenarios
29
+ - `refreshTokenFromSession(authConfig, options?)` - Refresh token using refresh token from session
30
+ - Uses refresh token from `authConfig.refreshToken` to get new access token
31
+ - Typically uses refresh_token grant type or browser-based re-authentication
32
+ - Returns new authorization token and optional new refresh token
33
+ - `refreshTokenFromServiceKey(authConfig, options?)` - Refresh token using UAA credentials from service key
34
+ - Uses UAA credentials (uaaUrl, uaaClientId, uaaClientSecret) without refresh token
35
+ - Typically uses browser-based authorization flow to ensure proper role assignment
36
+ - Returns new authorization token and optional refresh token
37
+ - These methods provide explicit control over token refresh strategy in AuthBroker
38
+ - Allows separation of refresh-by-session vs refresh-by-service-key logic in token providers
39
+
10
40
  ## [0.2.0] - 2025-12-19
11
41
 
12
42
  ### Added
package/dist/index.d.ts CHANGED
@@ -11,6 +11,8 @@ 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 { TOKEN_PROVIDER_ERROR_CODES } from './token/TokenProviderErrorCodes';
15
+ export type { TokenProviderErrorCode } from './token/TokenProviderErrorCodes';
14
16
  export type { ISessionStore } from './session/ISessionStore';
15
17
  export type { IServiceKeyStore } from './serviceKey/IServiceKeyStore';
16
18
  export type { IAbapConnection } from './connection/IAbapConnection';
@@ -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;AAG3E,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjF,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,YAAY,EA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-20,7 +20,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
20
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.AdtObjectErrorCodes = exports.AuthMethodPriority = exports.LogLevel = exports.isNetworkError = exports.NETWORK_ERROR_CODES = void 0;
23
+ exports.AdtObjectErrorCodes = exports.AuthMethodPriority = exports.LogLevel = exports.isNetworkError = exports.NETWORK_ERROR_CODES = exports.TOKEN_PROVIDER_ERROR_CODES = void 0;
24
+ var TokenProviderErrorCodes_1 = require("./token/TokenProviderErrorCodes");
25
+ Object.defineProperty(exports, "TOKEN_PROVIDER_ERROR_CODES", { enumerable: true, get: function () { return TokenProviderErrorCodes_1.TOKEN_PROVIDER_ERROR_CODES; } });
24
26
  var NetworkErrors_1 = require("./connection/NetworkErrors");
25
27
  Object.defineProperty(exports, "NETWORK_ERROR_CODES", { enumerable: true, get: function () { return NetworkErrors_1.NETWORK_ERROR_CODES; } });
26
28
  Object.defineProperty(exports, "isNetworkError", { enumerable: true, get: function () { return NetworkErrors_1.isNetworkError; } });
@@ -22,6 +22,24 @@ export interface ITokenProvider {
22
22
  * @returns Promise that resolves to connection configuration with authorization token and optional refresh token
23
23
  */
24
24
  getConnectionConfig(authConfig: IAuthorizationConfig, options?: ITokenProviderOptions): Promise<ITokenProviderResult>;
25
+ /**
26
+ * Refresh token using refresh token from session (authorization config with refreshToken)
27
+ * This method uses the refresh token from the session to get a new access token.
28
+ * Typically uses refresh_token grant type or browser-based re-authentication.
29
+ * @param authConfig Authorization configuration including refreshToken from session
30
+ * @param options Optional provider-specific options (e.g., browser type for BTP)
31
+ * @returns Promise that resolves to connection configuration with new authorization token and optional new refresh token
32
+ */
33
+ refreshTokenFromSession(authConfig: IAuthorizationConfig, options?: ITokenProviderOptions): Promise<ITokenProviderResult>;
34
+ /**
35
+ * Refresh token using UAA credentials from service key (authorization config without refreshToken)
36
+ * This method uses UAA credentials (uaaUrl, uaaClientId, uaaClientSecret) to get a new token.
37
+ * Typically uses browser-based authorization flow to ensure proper role assignment.
38
+ * @param authConfig Authorization configuration with UAA credentials from service key (no refreshToken)
39
+ * @param options Optional provider-specific options (e.g., browser type for BTP)
40
+ * @returns Promise that resolves to connection configuration with new authorization token and optional refresh token
41
+ */
42
+ refreshTokenFromServiceKey(authConfig: IAuthorizationConfig, options?: ITokenProviderOptions): Promise<ITokenProviderResult>;
25
43
  /**
26
44
  * Validate JWT token by testing connection to service
27
45
  * @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;AAEzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE;;;;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;;;;;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;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE;;;;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"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Token Provider Error Codes
3
+ *
4
+ * Constants for error codes that token providers can throw.
5
+ * Used to enable better error handling and categorization.
6
+ */
7
+ /**
8
+ * Error codes for token provider operations
9
+ */
10
+ export declare const TOKEN_PROVIDER_ERROR_CODES: {
11
+ /** Authentication configuration validation failed */
12
+ readonly VALIDATION_ERROR: "VALIDATION_ERROR";
13
+ /** Token refresh operation failed */
14
+ readonly REFRESH_ERROR: "REFRESH_ERROR";
15
+ /** Session data is invalid or incomplete */
16
+ readonly SESSION_DATA_ERROR: "SESSION_DATA_ERROR";
17
+ /** Service key data is invalid or incomplete */
18
+ readonly SERVICE_KEY_ERROR: "SERVICE_KEY_ERROR";
19
+ /** Browser authentication failed or was cancelled */
20
+ readonly BROWSER_AUTH_ERROR: "BROWSER_AUTH_ERROR";
21
+ };
22
+ /**
23
+ * Type for token provider error codes
24
+ */
25
+ export type TokenProviderErrorCode = typeof TOKEN_PROVIDER_ERROR_CODES[keyof typeof TOKEN_PROVIDER_ERROR_CODES];
26
+ //# sourceMappingURL=TokenProviderErrorCodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenProviderErrorCodes.d.ts","sourceRoot":"","sources":["../../src/token/TokenProviderErrorCodes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,0BAA0B;IACrC,qDAAqD;;IAErD,qCAAqC;;IAErC,4CAA4C;;IAE5C,gDAAgD;;IAEhD,qDAAqD;;CAE7C,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,0BAA0B,CAAC,MAAM,OAAO,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * Token Provider Error Codes
4
+ *
5
+ * Constants for error codes that token providers can throw.
6
+ * Used to enable better error handling and categorization.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.TOKEN_PROVIDER_ERROR_CODES = void 0;
10
+ /**
11
+ * Error codes for token provider operations
12
+ */
13
+ exports.TOKEN_PROVIDER_ERROR_CODES = {
14
+ /** Authentication configuration validation failed */
15
+ VALIDATION_ERROR: 'VALIDATION_ERROR',
16
+ /** Token refresh operation failed */
17
+ REFRESH_ERROR: 'REFRESH_ERROR',
18
+ /** Session data is invalid or incomplete */
19
+ SESSION_DATA_ERROR: 'SESSION_DATA_ERROR',
20
+ /** Service key data is invalid or incomplete */
21
+ SERVICE_KEY_ERROR: 'SERVICE_KEY_ERROR',
22
+ /** Browser authentication failed or was cancelled */
23
+ BROWSER_AUTH_ERROR: 'BROWSER_AUTH_ERROR',
24
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/interfaces",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Shared interfaces for MCP ABAP ADT packages",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",