@mcp-abap-adt/auth-broker 4.0.0 → 5.0.0

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/dist/index.d.ts CHANGED
@@ -5,13 +5,17 @@
5
5
  * secret, and stores back what that provider obtains; the token API serves a
6
6
  * token from the same provider, or from one the consumer injects.
7
7
  */
8
- export type { ITokenRefresher } from '@mcp-abap-adt/interfaces-auth';
8
+ export type { IClientAuthentication, IRenewalStrategy, ITokenRefresher, } from '@mcp-abap-adt/interfaces-auth';
9
+ export type { IClientCertificate } from '@mcp-abap-adt/interfaces-auth-broker';
9
10
  export type { AuthType } from '@mcp-abap-adt/interfaces-auth-sap';
10
11
  export type { ILogger } from '@mcp-abap-adt/interfaces-utils';
11
- export { AuthBroker, type AuthBrokerConfig, type StrategyGrant, type TokenProviderFactory, } from './AuthBroker';
12
+ export { AuthBroker, type AuthBrokerConfig, type BrokerCallOptions, type StrategyGrant, type TokenProviderClient, type TokenProviderFactory, } from './AuthBroker';
12
13
  export { bindingOf, type SecretBinding } from './bindingOf';
13
- export { DestinationConfigError } from './DestinationConfigError';
14
+ export { type ClientAuthenticationContext, type ClientAuthenticationGrant, type ClientAuthenticationStrategy, type FromServiceKeySecretOptions, fromServiceKeyCertificate, fromServiceKeySecret, } from './clientAuthentication';
15
+ export { DestinationConfigError, type DestinationConfigErrorLike, isDestinationConfigError, } from './DestinationConfigError';
16
+ export type { TokenGrant } from './destinations';
14
17
  export type { IRefreshableTokenProvider, ITokenProvider, ITokenResult, TokenProviderOptions, } from './providers';
18
+ export { SessionWriteFailure } from './SessionWriter';
15
19
  export type { IAuthorizationConfig, IConnectionConfig, IServiceKeyStore, ISessionStore, } from './stores/interfaces';
16
20
  export type { IConfig } from './types';
17
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,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EAChC,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,sBAAsB,EACtB,KAAK,0BAA0B,EAC/B,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,YAAY,EACV,yBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -7,12 +7,18 @@
7
7
  * token from the same provider, or from one the consumer injects.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.DestinationConfigError = exports.bindingOf = exports.AuthBroker = void 0;
10
+ exports.SessionWriteFailure = exports.isDestinationConfigError = exports.DestinationConfigError = exports.fromServiceKeySecret = exports.fromServiceKeyCertificate = exports.bindingOf = exports.AuthBroker = void 0;
11
11
  var AuthBroker_1 = require("./AuthBroker");
12
12
  Object.defineProperty(exports, "AuthBroker", { enumerable: true, get: function () { return AuthBroker_1.AuthBroker; } });
13
13
  var bindingOf_1 = require("./bindingOf");
14
14
  Object.defineProperty(exports, "bindingOf", { enumerable: true, get: function () { return bindingOf_1.bindingOf; } });
15
+ var clientAuthentication_1 = require("./clientAuthentication");
16
+ Object.defineProperty(exports, "fromServiceKeyCertificate", { enumerable: true, get: function () { return clientAuthentication_1.fromServiceKeyCertificate; } });
17
+ Object.defineProperty(exports, "fromServiceKeySecret", { enumerable: true, get: function () { return clientAuthentication_1.fromServiceKeySecret; } });
15
18
  var DestinationConfigError_1 = require("./DestinationConfigError");
16
19
  Object.defineProperty(exports, "DestinationConfigError", { enumerable: true, get: function () { return DestinationConfigError_1.DestinationConfigError; } });
20
+ Object.defineProperty(exports, "isDestinationConfigError", { enumerable: true, get: function () { return DestinationConfigError_1.isDestinationConfigError; } });
21
+ var SessionWriter_1 = require("./SessionWriter");
22
+ Object.defineProperty(exports, "SessionWriteFailure", { enumerable: true, get: function () { return SessionWriter_1.SessionWriteFailure; } });
17
23
  // Store implementations: `@mcp-abap-adt/auth-stores`, or any `ISessionStore` /
18
24
  // `IServiceKeyStore`. Provider implementations: `@mcp-abap-adt/auth-providers`.
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The one way the broker logs: the consumer's `ILogger` behind a
3
+ * wrapper whose every method never throws and never leaves an unhandled
4
+ * rejection.
5
+ *
6
+ * The logger is the consumer's code. A method that throws, a method or a
7
+ * getter for one that throws, or a method that answers a rejecting promise
8
+ * (an async logger) changes nothing the broker does: a log line is never an
9
+ * outcome. Without the wrapper a throwing `info` after a store took a write
10
+ * would turn the landed write into a failed, pending one, and a throwing
11
+ * `warn` would reject a `submit` that must never reject.
12
+ *
13
+ * Every argument reaches the consumer's method as given — the same count,
14
+ * the same values — so a logger sees exactly what the broker wrote. Logging
15
+ * stays fire-and-forget: an answer is never awaited, only adopted with a
16
+ * no-op rejection handler.
17
+ */
18
+ import type { ILogger } from '@mcp-abap-adt/interfaces-utils';
19
+ /**
20
+ * The consumer's logger, every method guarded; none given, a logger that
21
+ * writes nothing.
22
+ */
23
+ export declare function quietLogger(logger: ILogger | undefined): ILogger;
24
+ //# sourceMappingURL=quietLogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quietLogger.d.ts","sourceRoot":"","sources":["../src/quietLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AA0B9D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAehE"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ /**
3
+ * The one way the broker logs: the consumer's `ILogger` behind a
4
+ * wrapper whose every method never throws and never leaves an unhandled
5
+ * rejection.
6
+ *
7
+ * The logger is the consumer's code. A method that throws, a method or a
8
+ * getter for one that throws, or a method that answers a rejecting promise
9
+ * (an async logger) changes nothing the broker does: a log line is never an
10
+ * outcome. Without the wrapper a throwing `info` after a store took a write
11
+ * would turn the landed write into a failed, pending one, and a throwing
12
+ * `warn` would reject a `submit` that must never reject.
13
+ *
14
+ * Every argument reaches the consumer's method as given — the same count,
15
+ * the same values — so a logger sees exactly what the broker wrote. Logging
16
+ * stays fire-and-forget: an answer is never awaited, only adopted with a
17
+ * no-op rejection handler.
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.quietLogger = quietLogger;
21
+ const LEVELS = ['debug', 'info', 'warn', 'error'];
22
+ const ignore = () => { };
23
+ /**
24
+ * Adopts what a log method answered, the way an `await` would — a native
25
+ * promise, a subclass or any thenable — through a promise this module makes,
26
+ * and handles its rejection. A `then` (or a getter for one) that throws is a
27
+ * rejection like any other. Never throws.
28
+ */
29
+ function settleQuietly(answer) {
30
+ if ((answer === null || typeof answer !== 'object') &&
31
+ typeof answer !== 'function') {
32
+ return;
33
+ }
34
+ try {
35
+ new Promise((resolve) => resolve(answer)).then(ignore, ignore);
36
+ }
37
+ catch {
38
+ // Nothing a logger answers is the broker's outcome.
39
+ }
40
+ }
41
+ /**
42
+ * The consumer's logger, every method guarded; none given, a logger that
43
+ * writes nothing.
44
+ */
45
+ function quietLogger(logger) {
46
+ const quiet = {};
47
+ for (const level of LEVELS) {
48
+ quiet[level] = (...args) => {
49
+ if (logger === undefined)
50
+ return;
51
+ try {
52
+ const method = logger[level];
53
+ if (typeof method !== 'function')
54
+ return;
55
+ settleQuietly(Reflect.apply(method, logger, args));
56
+ }
57
+ catch {
58
+ // A log line is never an outcome.
59
+ }
60
+ };
61
+ }
62
+ return Object.freeze(quiet);
63
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/auth-broker",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "description": "Per-destination credential broker for SAP BTP and ABAP: the IAuthProvider a destination states, built from its key store and session store, with every secret it obtains stored back; and a token API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -44,6 +44,7 @@
44
44
  "build": "tsc -b tsconfig.build.json",
45
45
  "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
46
46
  "test:live": "cross-env NODE_OPTIONS=--experimental-vm-modules jest -c jest.live.config.js",
47
+ "test:live:x509": "tests/live/x509/run.sh",
47
48
  "test:stand": "tests/stand/run.sh",
48
49
  "stand:up": "tests/stand/up.sh",
49
50
  "stand:down": "tests/stand/down.sh",
@@ -54,16 +55,17 @@
54
55
  "node": "^22 || ^24 || ^26"
55
56
  },
56
57
  "dependencies": {
57
- "@mcp-abap-adt/auth-providers": "^5.2.1",
58
- "@mcp-abap-adt/interfaces-auth": "^3.0.0",
59
- "@mcp-abap-adt/interfaces-auth-broker": "^1.1.0",
60
- "@mcp-abap-adt/interfaces-auth-sap": "^2.0.0",
58
+ "@mcp-abap-adt/auth-errors": "^2.1.1",
59
+ "@mcp-abap-adt/auth-providers": "^6.0.0",
60
+ "@mcp-abap-adt/interfaces-auth": "^7.5.0",
61
+ "@mcp-abap-adt/interfaces-auth-broker": "^1.3.0",
62
+ "@mcp-abap-adt/interfaces-auth-sap": "^3.3.0",
61
63
  "@mcp-abap-adt/interfaces-utils": "^1.1.0"
62
64
  },
63
65
  "devDependencies": {
64
66
  "@mcp-abap-adt/auth-mocks": "^0.3.0",
65
- "@mcp-abap-adt/auth-stores": "^3.2.0",
66
- "@mcp-abap-adt/connection": "^10.0.3",
67
+ "@mcp-abap-adt/auth-stores": "^4.0.0",
68
+ "@mcp-abap-adt/connection": "^14.0.0",
67
69
  "@mcp-abap-adt/logger": "^0.4.0",
68
70
  "@types/js-yaml": "^4.0.9",
69
71
  "js-yaml": "^4.1.1",