chore: switch to module ESNext + moduleResolution bundler (#2095)
This commit is contained in:
parent
c59dc3aa1a
commit
ee732d64b6
14 changed files with 668 additions and 863 deletions
|
|
@ -4,9 +4,9 @@ import type { Options as RateLimitOptions } from 'express-rate-limit';
|
|||
import { rateLimit } from 'express-rate-limit';
|
||||
import * as z from 'zod/v4';
|
||||
|
||||
import { InvalidClientError, InvalidRequestError, OAuthError, ServerError, TooManyRequestsError } from '../errors.js';
|
||||
import { allowedMethods } from '../middleware/allowedMethods.js';
|
||||
import type { OAuthServerProvider } from '../provider.js';
|
||||
import { InvalidClientError, InvalidRequestError, OAuthError, ServerError, TooManyRequestsError } from '../errors';
|
||||
import { allowedMethods } from '../middleware/allowedMethods';
|
||||
import type { OAuthServerProvider } from '../provider';
|
||||
|
||||
export type AuthorizationHandlerOptions = {
|
||||
provider: OAuthServerProvider;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import cors from 'cors';
|
|||
import type { RequestHandler } from 'express';
|
||||
import express from 'express';
|
||||
|
||||
import { allowedMethods } from '../middleware/allowedMethods.js';
|
||||
import { allowedMethods } from '../middleware/allowedMethods';
|
||||
|
||||
export function metadataHandler(metadata: OAuthMetadata | OAuthProtectedResourceMetadata): RequestHandler {
|
||||
// Nested router so we can configure middleware and restrict HTTP method
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import express from 'express';
|
|||
import type { Options as RateLimitOptions } from 'express-rate-limit';
|
||||
import { rateLimit } from 'express-rate-limit';
|
||||
|
||||
import type { OAuthRegisteredClientsStore } from '../clients.js';
|
||||
import { InvalidClientMetadataError, OAuthError, ServerError, TooManyRequestsError } from '../errors.js';
|
||||
import { allowedMethods } from '../middleware/allowedMethods.js';
|
||||
import type { OAuthRegisteredClientsStore } from '../clients';
|
||||
import { InvalidClientMetadataError, OAuthError, ServerError, TooManyRequestsError } from '../errors';
|
||||
import { allowedMethods } from '../middleware/allowedMethods';
|
||||
|
||||
export type ClientRegistrationHandlerOptions = {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ import express from 'express';
|
|||
import type { Options as RateLimitOptions } from 'express-rate-limit';
|
||||
import { rateLimit } from 'express-rate-limit';
|
||||
|
||||
import { InvalidRequestError, OAuthError, ServerError, TooManyRequestsError } from '../errors.js';
|
||||
import { allowedMethods } from '../middleware/allowedMethods.js';
|
||||
import { authenticateClient } from '../middleware/clientAuth.js';
|
||||
import type { OAuthServerProvider } from '../provider.js';
|
||||
import { InvalidRequestError, OAuthError, ServerError, TooManyRequestsError } from '../errors';
|
||||
import { allowedMethods } from '../middleware/allowedMethods';
|
||||
import { authenticateClient } from '../middleware/clientAuth';
|
||||
import type { OAuthServerProvider } from '../provider';
|
||||
|
||||
export type RevocationHandlerOptions = {
|
||||
provider: OAuthServerProvider;
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ import {
|
|||
ServerError,
|
||||
TooManyRequestsError,
|
||||
UnsupportedGrantTypeError
|
||||
} from '../errors.js';
|
||||
import { allowedMethods } from '../middleware/allowedMethods.js';
|
||||
import { authenticateClient } from '../middleware/clientAuth.js';
|
||||
import type { OAuthServerProvider } from '../provider.js';
|
||||
} from '../errors';
|
||||
import { allowedMethods } from '../middleware/allowedMethods';
|
||||
import { authenticateClient } from '../middleware/clientAuth';
|
||||
import type { OAuthServerProvider } from '../provider';
|
||||
|
||||
export type TokenHandlerOptions = {
|
||||
provider: OAuthServerProvider;
|
||||
|
|
|
|||
|
|
@ -1,37 +1,37 @@
|
|||
// Core router
|
||||
export type { AuthMetadataOptions, AuthRouterOptions } from './router.js';
|
||||
export { createOAuthMetadata, getOAuthProtectedResourceMetadataUrl, mcpAuthMetadataRouter, mcpAuthRouter } from './router.js';
|
||||
export type { AuthMetadataOptions, AuthRouterOptions } from './router';
|
||||
export { createOAuthMetadata, getOAuthProtectedResourceMetadataUrl, mcpAuthMetadataRouter, mcpAuthRouter } from './router';
|
||||
|
||||
// Provider interfaces
|
||||
export type { AuthorizationParams, OAuthServerProvider, OAuthTokenVerifier } from './provider.js';
|
||||
export type { AuthorizationParams, OAuthServerProvider, OAuthTokenVerifier } from './provider';
|
||||
|
||||
// Proxy provider
|
||||
export type { ProxyEndpoints, ProxyOptions } from './providers/proxyProvider.js';
|
||||
export { ProxyOAuthServerProvider } from './providers/proxyProvider.js';
|
||||
export type { ProxyEndpoints, ProxyOptions } from './providers/proxyProvider';
|
||||
export { ProxyOAuthServerProvider } from './providers/proxyProvider';
|
||||
|
||||
// Client store
|
||||
export type { OAuthRegisteredClientsStore } from './clients.js';
|
||||
export type { OAuthRegisteredClientsStore } from './clients';
|
||||
|
||||
// Handlers
|
||||
export type { AuthorizationHandlerOptions } from './handlers/authorize.js';
|
||||
export { authorizationHandler, redirectUriMatches } from './handlers/authorize.js';
|
||||
export { metadataHandler } from './handlers/metadata.js';
|
||||
export type { ClientRegistrationHandlerOptions } from './handlers/register.js';
|
||||
export { clientRegistrationHandler } from './handlers/register.js';
|
||||
export type { RevocationHandlerOptions } from './handlers/revoke.js';
|
||||
export { revocationHandler } from './handlers/revoke.js';
|
||||
export type { TokenHandlerOptions } from './handlers/token.js';
|
||||
export { tokenHandler } from './handlers/token.js';
|
||||
export type { AuthorizationHandlerOptions } from './handlers/authorize';
|
||||
export { authorizationHandler, redirectUriMatches } from './handlers/authorize';
|
||||
export { metadataHandler } from './handlers/metadata';
|
||||
export type { ClientRegistrationHandlerOptions } from './handlers/register';
|
||||
export { clientRegistrationHandler } from './handlers/register';
|
||||
export type { RevocationHandlerOptions } from './handlers/revoke';
|
||||
export { revocationHandler } from './handlers/revoke';
|
||||
export type { TokenHandlerOptions } from './handlers/token';
|
||||
export { tokenHandler } from './handlers/token';
|
||||
|
||||
// Middleware
|
||||
export { allowedMethods } from './middleware/allowedMethods.js';
|
||||
export type { BearerAuthMiddlewareOptions } from './middleware/bearerAuth.js';
|
||||
export { requireBearerAuth } from './middleware/bearerAuth.js';
|
||||
export type { ClientAuthenticationMiddlewareOptions } from './middleware/clientAuth.js';
|
||||
export { authenticateClient } from './middleware/clientAuth.js';
|
||||
export { allowedMethods } from './middleware/allowedMethods';
|
||||
export type { BearerAuthMiddlewareOptions } from './middleware/bearerAuth';
|
||||
export { requireBearerAuth } from './middleware/bearerAuth';
|
||||
export type { ClientAuthenticationMiddlewareOptions } from './middleware/clientAuth';
|
||||
export { authenticateClient } from './middleware/clientAuth';
|
||||
|
||||
// Error classes
|
||||
export * from './errors.js';
|
||||
export * from './errors';
|
||||
|
||||
// Types
|
||||
export type { AuthInfo } from './types.js';
|
||||
export type { AuthInfo } from './types';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { RequestHandler } from 'express';
|
||||
|
||||
import { MethodNotAllowedError } from '../errors.js';
|
||||
import { MethodNotAllowedError } from '../errors';
|
||||
|
||||
/**
|
||||
* Middleware to handle unsupported HTTP methods with a 405 Method Not Allowed response.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import type { RequestHandler } from 'express';
|
||||
|
||||
import { InsufficientScopeError, InvalidTokenError, OAuthError, ServerError } from '../errors.js';
|
||||
import type { OAuthTokenVerifier } from '../provider.js';
|
||||
import type { AuthInfo } from '../types.js';
|
||||
import { InsufficientScopeError, InvalidTokenError, OAuthError, ServerError } from '../errors';
|
||||
import type { OAuthTokenVerifier } from '../provider';
|
||||
import type { AuthInfo } from '../types';
|
||||
|
||||
export type BearerAuthMiddlewareOptions = {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import type { OAuthClientInformationFull } from '@modelcontextprotocol/core';
|
|||
import type { RequestHandler } from 'express';
|
||||
import * as z from 'zod/v4';
|
||||
|
||||
import type { OAuthRegisteredClientsStore } from '../clients.js';
|
||||
import { InvalidClientError, InvalidRequestError, OAuthError, ServerError } from '../errors.js';
|
||||
import type { OAuthRegisteredClientsStore } from '../clients';
|
||||
import { InvalidClientError, InvalidRequestError, OAuthError, ServerError } from '../errors';
|
||||
|
||||
export type ClientAuthenticationMiddlewareOptions = {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import type { OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '@modelcontextprotocol/core';
|
||||
import type { Response } from 'express';
|
||||
|
||||
import type { OAuthRegisteredClientsStore } from './clients.js';
|
||||
import type { AuthInfo } from './types.js';
|
||||
import type { OAuthRegisteredClientsStore } from './clients';
|
||||
import type { AuthInfo } from './types';
|
||||
|
||||
export type AuthorizationParams = {
|
||||
state?: string;
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ import type { FetchLike, OAuthClientInformationFull, OAuthTokenRevocationRequest
|
|||
import { OAuthClientInformationFullSchema, OAuthTokensSchema } from '@modelcontextprotocol/core';
|
||||
import type { Response } from 'express';
|
||||
|
||||
import type { OAuthRegisteredClientsStore } from '../clients.js';
|
||||
import { ServerError } from '../errors.js';
|
||||
import type { AuthorizationParams, OAuthServerProvider } from '../provider.js';
|
||||
import type { AuthInfo } from '../types.js';
|
||||
import type { OAuthRegisteredClientsStore } from '../clients';
|
||||
import { ServerError } from '../errors';
|
||||
import type { AuthorizationParams, OAuthServerProvider } from '../provider';
|
||||
import type { AuthInfo } from '../types';
|
||||
|
||||
export type ProxyEndpoints = {
|
||||
authorizationUrl: string;
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@ import type { OAuthMetadata, OAuthProtectedResourceMetadata } from '@modelcontex
|
|||
import type { RequestHandler } from 'express';
|
||||
import express from 'express';
|
||||
|
||||
import type { AuthorizationHandlerOptions } from './handlers/authorize.js';
|
||||
import { authorizationHandler } from './handlers/authorize.js';
|
||||
import { metadataHandler } from './handlers/metadata.js';
|
||||
import type { ClientRegistrationHandlerOptions } from './handlers/register.js';
|
||||
import { clientRegistrationHandler } from './handlers/register.js';
|
||||
import type { RevocationHandlerOptions } from './handlers/revoke.js';
|
||||
import { revocationHandler } from './handlers/revoke.js';
|
||||
import type { TokenHandlerOptions } from './handlers/token.js';
|
||||
import { tokenHandler } from './handlers/token.js';
|
||||
import type { OAuthServerProvider } from './provider.js';
|
||||
import type { AuthorizationHandlerOptions } from './handlers/authorize';
|
||||
import { authorizationHandler } from './handlers/authorize';
|
||||
import { metadataHandler } from './handlers/metadata';
|
||||
import type { ClientRegistrationHandlerOptions } from './handlers/register';
|
||||
import { clientRegistrationHandler } from './handlers/register';
|
||||
import type { RevocationHandlerOptions } from './handlers/revoke';
|
||||
import { revocationHandler } from './handlers/revoke';
|
||||
import type { TokenHandlerOptions } from './handlers/token';
|
||||
import { tokenHandler } from './handlers/token';
|
||||
import type { OAuthServerProvider } from './provider';
|
||||
|
||||
// Check for dev mode flag that allows HTTP issuer URLs (for development/testing only)
|
||||
const allowInsecureIssuerUrl =
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
export * from './auth/index.js';
|
||||
export * from './sse/index.js';
|
||||
export * from './auth/index';
|
||||
export * from './sse/index';
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
export { SSEServerTransport, type SSEServerTransportOptions } from './sse.js';
|
||||
export { SSEServerTransport, type SSEServerTransportOptions } from './sse';
|
||||
|
|
|
|||
Loading…
Reference in a new issue