@whatwg-node/server
Advanced tools
Comparing version 0.4.0-alpha-20220916164628-2bdd460 to 0.4.0-alpha-20220916171141-bfa866d
@@ -5,3 +5,3 @@ /// <reference types="node" /> | ||
import { NodeRequest } from './utils'; | ||
export interface ServerAdapterBaseObject<TServerContext, THandleRequest extends HandleRequestFn<TServerContext>> { | ||
export interface ServerAdapterBaseObject<TServerContext, THandleRequest extends ServerAdapterRequestHandler<TServerContext> = ServerAdapterRequestHandler<TServerContext>> { | ||
/** | ||
@@ -13,3 +13,3 @@ * An async function that takes `Request` and the server context and returns a `Response`. | ||
} | ||
export interface ServerAdapterObject<TServerContext, TBaseObject extends ServerAdapterBaseObject<TServerContext, HandleRequestFn<TServerContext>>> extends EventListenerObject { | ||
export interface ServerAdapterObject<TServerContext, TBaseObject extends ServerAdapterBaseObject<TServerContext, ServerAdapterRequestHandler<TServerContext>>> extends EventListenerObject { | ||
/** | ||
@@ -40,5 +40,5 @@ * A basic request listener that takes a `Request` with the server context and returns a `Response`. | ||
} | ||
export declare type ServerAdapter<TServerContext, THandleRequest extends HandleRequestFn<TServerContext>, TBaseObject extends ServerAdapterBaseObject<TServerContext, THandleRequest>> = Omit<TBaseObject, 'handle'> & RequestListener & ServerAdapterObject<TServerContext, TBaseObject>['fetch'] & ServerAdapterObject<TServerContext, TBaseObject>; | ||
declare type HandleRequestFn<TServerContext> = (request: Request, serverContext: TServerContext) => Promise<Response> | Response; | ||
declare type DefaultServerContext = { | ||
export declare type ServerAdapter<TServerContext, TBaseObject extends ServerAdapterBaseObject<TServerContext>> = TBaseObject & RequestListener & ServerAdapterObject<TServerContext, TBaseObject>['fetch'] & ServerAdapterObject<TServerContext, TBaseObject>; | ||
export declare type ServerAdapterRequestHandler<TServerContext> = (request: Request, serverContext: TServerContext) => Promise<Response> | Response; | ||
export declare type DefaultServerAdapterContext = { | ||
req: NodeRequest; | ||
@@ -48,4 +48,4 @@ res: ServerResponse; | ||
}; | ||
declare function createServerAdapter<TServerContext = DefaultServerContext, THandleRequest extends HandleRequestFn<TServerContext> = HandleRequestFn<TServerContext>>(serverAdapterBaseObject: THandleRequest, RequestCtor?: typeof Request): ServerAdapter<TServerContext, THandleRequest, ServerAdapterBaseObject<TServerContext, THandleRequest>>; | ||
declare function createServerAdapter<TServerContext = DefaultServerContext, THandleRequest extends HandleRequestFn<TServerContext> = HandleRequestFn<TServerContext>, TBaseObject extends ServerAdapterBaseObject<TServerContext, THandleRequest> = ServerAdapterBaseObject<TServerContext, THandleRequest>>(serverAdapterBaseObject: TBaseObject, RequestCtor?: typeof Request): ServerAdapter<TServerContext, THandleRequest, TBaseObject>; | ||
declare function createServerAdapter<TServerContext = DefaultServerAdapterContext, THandleRequest extends ServerAdapterRequestHandler<TServerContext> = ServerAdapterRequestHandler<TServerContext>>(serverAdapterRequestHandler: THandleRequest, RequestCtor?: typeof Request): ServerAdapter<TServerContext, ServerAdapterBaseObject<TServerContext, THandleRequest>>; | ||
declare function createServerAdapter<TServerContext, TBaseObject extends ServerAdapterBaseObject<TServerContext>>(serverAdapterBaseObject: TBaseObject, RequestCtor?: typeof Request): ServerAdapter<TServerContext, TBaseObject>; | ||
export { createServerAdapter }; |
{ | ||
"name": "@whatwg-node/server", | ||
"version": "0.4.0-alpha-20220916164628-2bdd460", | ||
"version": "0.4.0-alpha-20220916171141-bfa866d", | ||
"description": "Fetch API compliant HTTP Server adapter", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36956
647