@vitemcp/server 1.9.15 → 1.9.16
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/{OAuthProvider-AjmrLphi.d.cts → OAuthProvider-DNKBMBPU.d.cts} +16 -0
- package/dist/{OAuthProvider-AjmrLphi.d.ts → OAuthProvider-DNKBMBPU.d.ts} +16 -0
- package/dist/ViteMCP.cjs +3 -3
- package/dist/ViteMCP.d.cts +2 -2
- package/dist/ViteMCP.d.ts +2 -2
- package/dist/ViteMCP.js +2 -2
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.d.cts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/bin/vitemcp.cjs +0 -1
- package/dist/bin/vitemcp.cjs.map +1 -1
- package/dist/bin/vitemcp.js +0 -1
- package/dist/bin/vitemcp.js.map +1 -1
- package/dist/{chunk-AOEXFXTH.cjs → chunk-HDJEH7NK.cjs} +3 -3
- package/dist/{chunk-AOEXFXTH.cjs.map → chunk-HDJEH7NK.cjs.map} +1 -1
- package/dist/{chunk-2JOXLIMJ.js → chunk-LZTRZ62V.js} +2 -2
- package/dist/{chunk-WOQXAQIG.js → chunk-PXH56Q3F.js} +42 -7
- package/dist/chunk-PXH56Q3F.js.map +1 -0
- package/dist/{chunk-7XWK66ZT.cjs → chunk-TWYBLPRQ.cjs} +45 -10
- package/dist/chunk-TWYBLPRQ.cjs.map +1 -0
- package/dist/openapi/index.cjs +12 -12
- package/dist/openapi/index.d.cts +1 -1
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-7XWK66ZT.cjs.map +0 -1
- package/dist/chunk-WOQXAQIG.js.map +0 -1
- /package/dist/{chunk-2JOXLIMJ.js.map → chunk-LZTRZ62V.js.map} +0 -0
|
@@ -2095,7 +2095,7 @@ var OAuthProxy = (_class4 = class {
|
|
|
2095
2095
|
let errorCode = "server_error";
|
|
2096
2096
|
let errorDescription;
|
|
2097
2097
|
try {
|
|
2098
|
-
const error = await
|
|
2098
|
+
const error = await this.readUpstreamError(tokenResponse);
|
|
2099
2099
|
errorCode = error.error || "server_error";
|
|
2100
2100
|
errorDescription = error.error_description;
|
|
2101
2101
|
} catch (e7) {
|
|
@@ -2299,7 +2299,7 @@ var OAuthProxy = (_class4 = class {
|
|
|
2299
2299
|
let errorCode = "invalid_grant";
|
|
2300
2300
|
let errorDescription;
|
|
2301
2301
|
try {
|
|
2302
|
-
const error = await
|
|
2302
|
+
const error = await this.readUpstreamError(tokenResponse);
|
|
2303
2303
|
errorCode = error.error || "invalid_grant";
|
|
2304
2304
|
errorDescription = error.error_description;
|
|
2305
2305
|
} catch (e8) {
|
|
@@ -2685,6 +2685,40 @@ var OAuthProxy = (_class4 = class {
|
|
|
2685
2685
|
const digest = _crypto.createHash.call(void 0, "sha256").update(refreshToken).digest("base64url");
|
|
2686
2686
|
return `passthrough-refresh:${this.issuerNs}:${digest}`;
|
|
2687
2687
|
}
|
|
2688
|
+
/**
|
|
2689
|
+
* What a refusal from the token endpoint says: the `error` and
|
|
2690
|
+
* `error_description` RFC 6749 §5.2 gives it.
|
|
2691
|
+
*
|
|
2692
|
+
* §5.2 sends them as JSON, but a provider that answers a successful request
|
|
2693
|
+
* with a form — GitHub, by default — may refuse with one too, and read as
|
|
2694
|
+
* JSON that lost the provider's own code and description to a bare HTTP
|
|
2695
|
+
* status.
|
|
2696
|
+
*
|
|
2697
|
+
* What parses as JSON is read as JSON, whatever the response declares, as
|
|
2698
|
+
* every refusal was before. A form is read only when the response declares
|
|
2699
|
+
* one, by its media type alone: a 502 page can name that type in a parameter
|
|
2700
|
+
* and carry `error=` in a link, and is no provider's refusal. Rejects when
|
|
2701
|
+
* the body is neither, and the caller falls back to the HTTP status.
|
|
2702
|
+
*/
|
|
2703
|
+
async readUpstreamError(response) {
|
|
2704
|
+
const text = await response.text();
|
|
2705
|
+
try {
|
|
2706
|
+
return JSON.parse(text);
|
|
2707
|
+
} catch (cause) {
|
|
2708
|
+
const mediaType = _optionalChain([response, 'access', _24 => _24.headers, 'access', _25 => _25.get, 'call', _26 => _26("content-type"), 'optionalAccess', _27 => _27.split, 'call', _28 => _28(";", 1), 'access', _29 => _29[0], 'optionalAccess', _30 => _30.trim, 'call', _31 => _31(), 'access', _32 => _32.toLowerCase, 'call', _33 => _33()]);
|
|
2709
|
+
if (mediaType === "application/x-www-form-urlencoded") {
|
|
2710
|
+
const params = new URLSearchParams(text);
|
|
2711
|
+
const error = params.get("error");
|
|
2712
|
+
if (error) {
|
|
2713
|
+
return {
|
|
2714
|
+
error,
|
|
2715
|
+
error_description: _nullishCoalesce(params.get("error_description"), () => ( void 0))
|
|
2716
|
+
};
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
throw cause;
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2688
2722
|
/**
|
|
2689
2723
|
* Send the user's browser back to the client's registered callback with how
|
|
2690
2724
|
* its request came out: a code, or an error (RFC 6749 §4.1.2). The `state`
|
|
@@ -2770,7 +2804,7 @@ var OAuthProxy = (_class4 = class {
|
|
|
2770
2804
|
let errorCode = "invalid_grant";
|
|
2771
2805
|
let errorDescription = "Upstream refresh failed";
|
|
2772
2806
|
try {
|
|
2773
|
-
const error = await
|
|
2807
|
+
const error = await this.readUpstreamError(tokenResponse);
|
|
2774
2808
|
errorCode = error.error || "invalid_grant";
|
|
2775
2809
|
errorDescription = error.error_description || "Upstream refresh failed";
|
|
2776
2810
|
} catch (e10) {
|
|
@@ -2911,7 +2945,7 @@ var OAuthProxy = (_class4 = class {
|
|
|
2911
2945
|
this.cleanupInterval = setInterval(() => {
|
|
2912
2946
|
this.cleanup();
|
|
2913
2947
|
}, 6e4);
|
|
2914
|
-
_optionalChain([this, 'access',
|
|
2948
|
+
_optionalChain([this, 'access', _34 => _34.cleanupInterval, 'access', _35 => _35.unref, 'optionalCall', _36 => _36()]);
|
|
2915
2949
|
}
|
|
2916
2950
|
/**
|
|
2917
2951
|
* PKCE challenge methods this proxy accepts, advertised in the authorization
|
|
@@ -3110,11 +3144,12 @@ var AuthProvider = (_class5 = class {
|
|
|
3110
3144
|
if (!request2) {
|
|
3111
3145
|
return void 0;
|
|
3112
3146
|
}
|
|
3113
|
-
const
|
|
3114
|
-
|
|
3147
|
+
const token = _optionalChain([/^bearer +(\S.*)$/i, 'access', _37 => _37.exec, 'call', _38 => _38(
|
|
3148
|
+
_nullishCoalesce(request2.headers.get("authorization"), () => ( ""))
|
|
3149
|
+
), 'optionalAccess', _39 => _39[1]]);
|
|
3150
|
+
if (!token) {
|
|
3115
3151
|
return void 0;
|
|
3116
3152
|
}
|
|
3117
|
-
const token = authHeader.slice(7);
|
|
3118
3153
|
const upstreamTokens = await this.proxy.loadUpstreamTokens(token);
|
|
3119
3154
|
if (!upstreamTokens) {
|
|
3120
3155
|
return void 0;
|
|
@@ -3140,7 +3175,7 @@ var AuthProvider = (_class5 = class {
|
|
|
3140
3175
|
*/
|
|
3141
3176
|
destroy() {
|
|
3142
3177
|
this._destroyed = true;
|
|
3143
|
-
_optionalChain([this, 'access',
|
|
3178
|
+
_optionalChain([this, 'access', _40 => _40._proxy, 'optionalAccess', _41 => _41.destroy, 'call', _42 => _42()]);
|
|
3144
3179
|
this._proxy = void 0;
|
|
3145
3180
|
}
|
|
3146
3181
|
/**
|
|
@@ -3355,7 +3390,7 @@ var DiskStore = (_class6 = class {
|
|
|
3355
3390
|
this.cleanupInterval = setInterval(() => {
|
|
3356
3391
|
void this.cleanup();
|
|
3357
3392
|
}, cleanupIntervalMs);
|
|
3358
|
-
_optionalChain([this, 'access',
|
|
3393
|
+
_optionalChain([this, 'access', _43 => _43.cleanupInterval, 'access', _44 => _44.unref, 'optionalCall', _45 => _45()]);
|
|
3359
3394
|
}
|
|
3360
3395
|
/**
|
|
3361
3396
|
* Clean up expired entries.
|
|
@@ -3719,4 +3754,4 @@ Original error: ${error.message}`
|
|
|
3719
3754
|
|
|
3720
3755
|
|
|
3721
3756
|
exports.withoutTrailingSlash = withoutTrailingSlash; exports.getAuthSession = getAuthSession; exports.requireAll = requireAll; exports.requireAny = requireAny; exports.requireAuth = requireAuth; exports.requireRole = requireRole; exports.requireScopes = requireScopes; exports.DEFAULT_ACCESS_TOKEN_TTL = DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_REFRESH_TOKEN_TTL = DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_AUTHORIZATION_CODE_TTL = DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_TRANSACTION_TTL = DEFAULT_TRANSACTION_TTL; exports.ConsentManager = ConsentManager; exports.JWTIssuer = JWTIssuer; exports.PKCEUtils = PKCEUtils; exports.EncryptedTokenStorage = EncryptedTokenStorage; exports.MemoryTokenStorage = MemoryTokenStorage; exports.OAuthProxy = OAuthProxy; exports.OAuthProxyError = OAuthProxyError; exports.AuthProvider = AuthProvider; exports.AzureProvider = AzureProvider; exports.GitHubProvider = GitHubProvider; exports.GoogleProvider = GoogleProvider; exports.OAuthProvider = OAuthProvider; exports.DiskStore = DiskStore; exports.JWKSVerifier = JWKSVerifier;
|
|
3722
|
-
//# sourceMappingURL=chunk-
|
|
3757
|
+
//# sourceMappingURL=chunk-TWYBLPRQ.cjs.map
|