@mcp-abap-adt/interfaces 0.2.2 → 0.2.4
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 +23 -0
- package/README.md +36 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -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/ITokenProviderOptions.d.ts +4 -3
- package/dist/token/ITokenProviderOptions.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.4] - 2025-12-21
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Headless Browser Mode**: Added `"headless"` option to `ITokenProviderOptions.browser`
|
|
14
|
+
- `"headless"`: Does not open browser, logs authentication URL and waits for manual callback
|
|
15
|
+
- Ideal for SSH sessions, remote terminals, and environments without display
|
|
16
|
+
- Differs from `"none"` which immediately rejects (for automated tests)
|
|
17
|
+
- Updated JSDoc documentation for browser option with all supported values
|
|
18
|
+
|
|
19
|
+
## [0.2.3] - 2025-12-19
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
- **Store Error Codes**: Added standardized error codes for store operations
|
|
23
|
+
- `STORE_ERROR_CODES` - Object containing error codes for store failures:
|
|
24
|
+
- `FILE_NOT_FOUND` - Service key or session file not found
|
|
25
|
+
- `PARSE_ERROR` - JSON or YAML parsing failed
|
|
26
|
+
- `INVALID_CONFIG` - Required configuration fields are missing
|
|
27
|
+
- `STORAGE_ERROR` - File write or permission error
|
|
28
|
+
- `StoreErrorCode` - Type for store error codes
|
|
29
|
+
- These constants enable auth-stores to provide typed errors to auth-broker
|
|
30
|
+
- Error codes help broker distinguish between file not found, parsing errors, and validation failures
|
|
31
|
+
- Exported from `@mcp-abap-adt/interfaces` package in store domain
|
|
32
|
+
|
|
10
33
|
## [0.2.2] - 2025-12-19
|
|
11
34
|
|
|
12
35
|
### 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
|
@@ -15,6 +15,8 @@ export { TOKEN_PROVIDER_ERROR_CODES } from './token/TokenProviderErrorCodes';
|
|
|
15
15
|
export type { TokenProviderErrorCode } from './token/TokenProviderErrorCodes';
|
|
16
16
|
export type { ISessionStore } from './session/ISessionStore';
|
|
17
17
|
export type { IServiceKeyStore } from './serviceKey/IServiceKeyStore';
|
|
18
|
+
export { STORE_ERROR_CODES } from './store/StoreErrorCodes';
|
|
19
|
+
export type { StoreErrorCode } from './store/StoreErrorCodes';
|
|
18
20
|
export type { IAbapConnection } from './connection/IAbapConnection';
|
|
19
21
|
export type { IAbapRequestOptions } from './connection/IAbapRequestOptions';
|
|
20
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,EA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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,9 +20,12 @@ 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 = exports.TOKEN_PROVIDER_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
24
|
var TokenProviderErrorCodes_1 = require("./token/TokenProviderErrorCodes");
|
|
25
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; } });
|
|
26
29
|
var NetworkErrors_1 = require("./connection/NetworkErrors");
|
|
27
30
|
Object.defineProperty(exports, "NETWORK_ERROR_CODES", { enumerable: true, get: function () { return NetworkErrors_1.NETWORK_ERROR_CODES; } });
|
|
28
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
|
+
};
|
|
@@ -8,9 +8,10 @@ import type { ILogger } from '../logging/ILogger';
|
|
|
8
8
|
export interface ITokenProviderOptions {
|
|
9
9
|
/**
|
|
10
10
|
* Browser type for browser-based authentication
|
|
11
|
-
* Supported values: "chrome", "edge", "firefox", "system" (default), "none"
|
|
12
|
-
* - "system": Uses system default browser
|
|
13
|
-
* - "
|
|
11
|
+
* Supported values: "chrome", "edge", "firefox", "system" (default), "none", "headless"
|
|
12
|
+
* - "system": Uses system default browser (default)
|
|
13
|
+
* - "headless": Does not open browser, logs URL and waits for manual callback (for SSH/remote sessions)
|
|
14
|
+
* - "none": Does not open browser, immediately rejects with error (for automated tests)
|
|
14
15
|
*/
|
|
15
16
|
browser?: string;
|
|
16
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ITokenProviderOptions.d.ts","sourceRoot":"","sources":["../../src/token/ITokenProviderOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,qBAAqB;IACpC
|
|
1
|
+
{"version":3,"file":"ITokenProviderOptions.d.ts","sourceRoot":"","sources":["../../src/token/ITokenProviderOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
|