@mcp-abap-adt/interfaces 0.2.1 → 0.2.3
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 +29 -0
- package/README.md +36 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/store/StoreErrorCodes.d.ts +12 -0
- package/dist/store/StoreErrorCodes.d.ts.map +1 -0
- package/dist/store/StoreErrorCodes.js +13 -0
- package/dist/token/TokenProviderErrorCodes.d.ts +26 -0
- package/dist/token/TokenProviderErrorCodes.d.ts.map +1 -0
- package/dist/token/TokenProviderErrorCodes.js +24 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.3] - 2025-12-19
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Store Error Codes**: Added standardized error codes for store operations
|
|
14
|
+
- `STORE_ERROR_CODES` - Object containing error codes for store failures:
|
|
15
|
+
- `FILE_NOT_FOUND` - Service key or session file not found
|
|
16
|
+
- `PARSE_ERROR` - JSON or YAML parsing failed
|
|
17
|
+
- `INVALID_CONFIG` - Required configuration fields are missing
|
|
18
|
+
- `STORAGE_ERROR` - File write or permission error
|
|
19
|
+
- `StoreErrorCode` - Type for store error codes
|
|
20
|
+
- These constants enable auth-stores to provide typed errors to auth-broker
|
|
21
|
+
- Error codes help broker distinguish between file not found, parsing errors, and validation failures
|
|
22
|
+
- Exported from `@mcp-abap-adt/interfaces` package in store domain
|
|
23
|
+
|
|
24
|
+
## [0.2.2] - 2025-12-19
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- **Token Provider Error Codes**: Added standardized error codes for token provider operations
|
|
28
|
+
- `TOKEN_PROVIDER_ERROR_CODES` - Object containing error codes for token provider failures:
|
|
29
|
+
- `VALIDATION_ERROR` - Authentication configuration validation failed
|
|
30
|
+
- `REFRESH_ERROR` - Token refresh operation failed
|
|
31
|
+
- `SESSION_DATA_ERROR` - Session data is invalid or incomplete
|
|
32
|
+
- `SERVICE_KEY_ERROR` - Service key data is invalid or incomplete
|
|
33
|
+
- `BROWSER_AUTH_ERROR` - Browser authentication failed or was cancelled
|
|
34
|
+
- `TokenProviderErrorCode` - Type for token provider error codes
|
|
35
|
+
- These constants enable consistent error handling across token providers and auth-broker
|
|
36
|
+
- Error codes help distinguish between different types of authentication failures
|
|
37
|
+
- Exported from `@mcp-abap-adt/interfaces` package in token domain
|
|
38
|
+
|
|
10
39
|
## [0.2.1] - 2025-12-19
|
|
11
40
|
|
|
12
41
|
### Added
|
package/README.md
CHANGED
|
@@ -45,7 +45,9 @@ import {
|
|
|
45
45
|
ITokenProvider,
|
|
46
46
|
IAbapConnection,
|
|
47
47
|
ISapConfig,
|
|
48
|
-
ILogger
|
|
48
|
+
ILogger,
|
|
49
|
+
TOKEN_PROVIDER_ERROR_CODES,
|
|
50
|
+
STORE_ERROR_CODES
|
|
49
51
|
} from '@mcp-abap-adt/interfaces';
|
|
50
52
|
```
|
|
51
53
|
|
|
@@ -73,6 +75,39 @@ const metadata = await adtDomain.readMetadata(
|
|
|
73
75
|
);
|
|
74
76
|
```
|
|
75
77
|
|
|
78
|
+
### Error Handling
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import {
|
|
82
|
+
TOKEN_PROVIDER_ERROR_CODES,
|
|
83
|
+
STORE_ERROR_CODES
|
|
84
|
+
} from '@mcp-abap-adt/interfaces';
|
|
85
|
+
|
|
86
|
+
// Token Provider Error Codes
|
|
87
|
+
try {
|
|
88
|
+
await tokenProvider.refreshTokenFromSession(authConfig);
|
|
89
|
+
} catch (error: any) {
|
|
90
|
+
if (error.code === TOKEN_PROVIDER_ERROR_CODES.VALIDATION_ERROR) {
|
|
91
|
+
console.error('Invalid auth config:', error.missingFields);
|
|
92
|
+
} else if (error.code === TOKEN_PROVIDER_ERROR_CODES.REFRESH_ERROR) {
|
|
93
|
+
console.error('Token refresh failed:', error.cause);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Store Error Codes
|
|
98
|
+
try {
|
|
99
|
+
const authConfig = await serviceKeyStore.getAuthorizationConfig('TRIAL');
|
|
100
|
+
} catch (error: any) {
|
|
101
|
+
if (error.code === STORE_ERROR_CODES.FILE_NOT_FOUND) {
|
|
102
|
+
console.error('Service key not found:', error.filePath);
|
|
103
|
+
} else if (error.code === STORE_ERROR_CODES.PARSE_ERROR) {
|
|
104
|
+
console.error('Invalid JSON:', error.filePath, error.cause);
|
|
105
|
+
} else if (error.code === STORE_ERROR_CODES.INVALID_CONFIG) {
|
|
106
|
+
console.error('Missing fields:', error.missingFields);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
76
111
|
## Responsibilities and Design Principles
|
|
77
112
|
|
|
78
113
|
### Core Development Principle
|
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,12 @@ 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';
|
|
18
|
+
export { STORE_ERROR_CODES } from './store/StoreErrorCodes';
|
|
19
|
+
export type { StoreErrorCode } from './store/StoreErrorCodes';
|
|
16
20
|
export type { IAbapConnection } from './connection/IAbapConnection';
|
|
17
21
|
export type { IAbapRequestOptions } from './connection/IAbapRequestOptions';
|
|
18
22
|
export { NETWORK_ERROR_CODES, isNetworkError } from './connection/NetworkErrors';
|
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;
|
|
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,MAA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(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.STORE_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; } });
|
|
26
|
+
// Store domain
|
|
27
|
+
var StoreErrorCodes_1 = require("./store/StoreErrorCodes");
|
|
28
|
+
Object.defineProperty(exports, "STORE_ERROR_CODES", { enumerable: true, get: function () { return StoreErrorCodes_1.STORE_ERROR_CODES; } });
|
|
24
29
|
var NetworkErrors_1 = require("./connection/NetworkErrors");
|
|
25
30
|
Object.defineProperty(exports, "NETWORK_ERROR_CODES", { enumerable: true, get: function () { return NetworkErrors_1.NETWORK_ERROR_CODES; } });
|
|
26
31
|
Object.defineProperty(exports, "isNetworkError", { enumerable: true, get: function () { return NetworkErrors_1.isNetworkError; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error codes for store operations
|
|
3
|
+
* Used by auth-stores package to provide typed errors to auth-broker
|
|
4
|
+
*/
|
|
5
|
+
export declare const STORE_ERROR_CODES: {
|
|
6
|
+
readonly FILE_NOT_FOUND: "FILE_NOT_FOUND";
|
|
7
|
+
readonly PARSE_ERROR: "PARSE_ERROR";
|
|
8
|
+
readonly INVALID_CONFIG: "INVALID_CONFIG";
|
|
9
|
+
readonly STORAGE_ERROR: "STORAGE_ERROR";
|
|
10
|
+
};
|
|
11
|
+
export type StoreErrorCode = typeof STORE_ERROR_CODES[keyof typeof STORE_ERROR_CODES];
|
|
12
|
+
//# sourceMappingURL=StoreErrorCodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoreErrorCodes.d.ts","sourceRoot":"","sources":["../../src/store/StoreErrorCodes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,iBAAiB;;;;;CAKpB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error codes for store operations
|
|
4
|
+
* Used by auth-stores package to provide typed errors to auth-broker
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.STORE_ERROR_CODES = void 0;
|
|
8
|
+
exports.STORE_ERROR_CODES = {
|
|
9
|
+
FILE_NOT_FOUND: 'FILE_NOT_FOUND',
|
|
10
|
+
PARSE_ERROR: 'PARSE_ERROR',
|
|
11
|
+
INVALID_CONFIG: 'INVALID_CONFIG',
|
|
12
|
+
STORAGE_ERROR: 'STORAGE_ERROR',
|
|
13
|
+
};
|
|
@@ -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
|
+
};
|