@mcp-abap-adt/interfaces 0.1.19 → 0.2.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 CHANGED
@@ -7,6 +7,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.1] - 2025-12-19
11
+
12
+ ### Added
13
+ - **Token Refresh Methods in ITokenProvider**: Added two new methods to `ITokenProvider` interface for explicit refresh scenarios
14
+ - `refreshTokenFromSession(authConfig, options?)` - Refresh token using refresh token from session
15
+ - Uses refresh token from `authConfig.refreshToken` to get new access token
16
+ - Typically uses refresh_token grant type or browser-based re-authentication
17
+ - Returns new authorization token and optional new refresh token
18
+ - `refreshTokenFromServiceKey(authConfig, options?)` - Refresh token using UAA credentials from service key
19
+ - Uses UAA credentials (uaaUrl, uaaClientId, uaaClientSecret) without refresh token
20
+ - Typically uses browser-based authorization flow to ensure proper role assignment
21
+ - Returns new authorization token and optional refresh token
22
+ - These methods provide explicit control over token refresh strategy in AuthBroker
23
+ - Allows separation of refresh-by-session vs refresh-by-service-key logic in token providers
24
+
25
+ ## [0.2.0] - 2025-12-19
26
+
27
+ ### Added
28
+ - **Network Error Detection Constants and Utility**: Added network error codes and helper function for detecting infrastructure-level connection issues
29
+ - `NETWORK_ERROR_CODES` - Object containing standard network error codes:
30
+ - `ECONNREFUSED` - Connection refused (server not accepting connections)
31
+ - `ETIMEDOUT` - Connection timeout (server not responding)
32
+ - `ENOTFOUND` - DNS resolution failed (hostname not found)
33
+ - `ECONNRESET` - Connection reset by peer
34
+ - `ENETUNREACH` - Network is unreachable
35
+ - `EHOSTUNREACH` - Host is unreachable
36
+ - `NetworkErrorCode` - Type for network error codes
37
+ - `isNetworkError(error: any): boolean` - Utility function to check if an error is a network-level error
38
+ - These constants and utilities help distinguish network/infrastructure errors from application-level HTTP errors
39
+ - Network errors should not trigger retry logic (CSRF, auth) as they indicate VPN, DNS, or connectivity issues
40
+ - Exported from `@mcp-abap-adt/interfaces` package in connection domain
41
+
10
42
  ## [0.1.19] - 2025-12-17
11
43
 
12
44
  ### Added
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Network error codes that indicate infrastructure-level connection issues
3
+ * These errors should not trigger retry logic (CSRF, auth) as they indicate
4
+ * problems with network connectivity, VPN, DNS, or server availability.
5
+ */
6
+ /**
7
+ * Network error codes
8
+ */
9
+ export declare const NETWORK_ERROR_CODES: {
10
+ /** Connection refused - server not accepting connections */
11
+ readonly ECONNREFUSED: "ECONNREFUSED";
12
+ /** Connection timeout - server not responding */
13
+ readonly ETIMEDOUT: "ETIMEDOUT";
14
+ /** DNS resolution failed - hostname not found */
15
+ readonly ENOTFOUND: "ENOTFOUND";
16
+ /** Connection reset by peer */
17
+ readonly ECONNRESET: "ECONNRESET";
18
+ /** Network is unreachable */
19
+ readonly ENETUNREACH: "ENETUNREACH";
20
+ /** Host is unreachable */
21
+ readonly EHOSTUNREACH: "EHOSTUNREACH";
22
+ };
23
+ /**
24
+ * Type for network error codes
25
+ */
26
+ export type NetworkErrorCode = typeof NETWORK_ERROR_CODES[keyof typeof NETWORK_ERROR_CODES];
27
+ /**
28
+ * Check if an error is a network error
29
+ * @param error Error object to check
30
+ * @returns true if error is a network-level error
31
+ */
32
+ export declare function isNetworkError(error: any): boolean;
33
+ //# sourceMappingURL=NetworkErrors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NetworkErrors.d.ts","sourceRoot":"","sources":["../../src/connection/NetworkErrors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;IAC9B,4DAA4D;;IAE5D,iDAAiD;;IAEjD,iDAAiD;;IAEjD,+BAA+B;;IAE/B,6BAA6B;;IAE7B,0BAA0B;;CAElB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,mBAAmB,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAE5F;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAiBlD"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * Network error codes that indicate infrastructure-level connection issues
4
+ * These errors should not trigger retry logic (CSRF, auth) as they indicate
5
+ * problems with network connectivity, VPN, DNS, or server availability.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.NETWORK_ERROR_CODES = void 0;
9
+ exports.isNetworkError = isNetworkError;
10
+ /**
11
+ * Network error codes
12
+ */
13
+ exports.NETWORK_ERROR_CODES = {
14
+ /** Connection refused - server not accepting connections */
15
+ ECONNREFUSED: 'ECONNREFUSED',
16
+ /** Connection timeout - server not responding */
17
+ ETIMEDOUT: 'ETIMEDOUT',
18
+ /** DNS resolution failed - hostname not found */
19
+ ENOTFOUND: 'ENOTFOUND',
20
+ /** Connection reset by peer */
21
+ ECONNRESET: 'ECONNRESET',
22
+ /** Network is unreachable */
23
+ ENETUNREACH: 'ENETUNREACH',
24
+ /** Host is unreachable */
25
+ EHOSTUNREACH: 'EHOSTUNREACH',
26
+ };
27
+ /**
28
+ * Check if an error is a network error
29
+ * @param error Error object to check
30
+ * @returns true if error is a network-level error
31
+ */
32
+ function isNetworkError(error) {
33
+ if (!error) {
34
+ return false;
35
+ }
36
+ const errorCode = error.code;
37
+ const errorMessage = error.message || '';
38
+ // Check error code
39
+ if (errorCode && Object.values(exports.NETWORK_ERROR_CODES).includes(errorCode)) {
40
+ return true;
41
+ }
42
+ // Check error message (fallback for wrapped errors)
43
+ return Object.values(exports.NETWORK_ERROR_CODES).some(code => errorMessage.includes(code));
44
+ }
package/dist/index.d.ts CHANGED
@@ -15,6 +15,8 @@ export type { ISessionStore } from './session/ISessionStore';
15
15
  export type { IServiceKeyStore } from './serviceKey/IServiceKeyStore';
16
16
  export type { IAbapConnection } from './connection/IAbapConnection';
17
17
  export type { IAbapRequestOptions } from './connection/IAbapRequestOptions';
18
+ export { NETWORK_ERROR_CODES, isNetworkError } from './connection/NetworkErrors';
19
+ export type { NetworkErrorCode } from './connection/NetworkErrors';
18
20
  export type { ISapConfig } from './sap/ISapConfig';
19
21
  export type { SapAuthType } from './sap/SapAuthType';
20
22
  export type { ISessionStorage } from './storage/ISessionStorage';
@@ -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;AAG5E,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,YAAY,EAAE,oBAAoB,EAAE,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AAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,YAAY,EAAE,oBAAoB,EAAE,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"}
package/dist/index.js CHANGED
@@ -20,7 +20,10 @@ 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 = void 0;
23
+ exports.AdtObjectErrorCodes = exports.AuthMethodPriority = exports.LogLevel = exports.isNetworkError = exports.NETWORK_ERROR_CODES = void 0;
24
+ var NetworkErrors_1 = require("./connection/NetworkErrors");
25
+ Object.defineProperty(exports, "NETWORK_ERROR_CODES", { enumerable: true, get: function () { return NetworkErrors_1.NETWORK_ERROR_CODES; } });
26
+ Object.defineProperty(exports, "isNetworkError", { enumerable: true, get: function () { return NetworkErrors_1.isNetworkError; } });
24
27
  var LogLevel_1 = require("./logging/LogLevel");
25
28
  Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return LogLevel_1.LogLevel; } });
26
29
  var IValidatedAuthConfig_1 = require("./validation/IValidatedAuthConfig");
@@ -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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,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/interfaces",
3
- "version": "0.1.19",
3
+ "version": "0.2.1",
4
4
  "description": "Shared interfaces for MCP ABAP ADT packages",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",