@authhero/proxy 0.10.14 → 0.11.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/proxy.cjs +1 -1
- package/dist/proxy.d.ts +10 -3
- package/dist/proxy.mjs +474 -401
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/adapter.d.ts +8 -1
- package/dist/types/data-plane/cache.d.ts +2 -2
- package/dist/types/data-plane/handlers/http.d.ts +7 -2
- package/dist/types/data-plane/timeout.d.ts +2 -0
- package/package.json +1 -1
package/dist/types/adapter.d.ts
CHANGED
|
@@ -13,8 +13,15 @@ export interface ResolvedHost {
|
|
|
13
13
|
* its management API. `resolveHost` is the cross-tenant lookup the proxy data
|
|
14
14
|
* plane needs on every incoming request — it maps a request `Host` header to
|
|
15
15
|
* the owning tenant, custom domain, and route set.
|
|
16
|
+
*
|
|
17
|
+
* `options.signal` aborts when the caller's deadline fires. Implementations
|
|
18
|
+
* backed by cancellable I/O (fetch) should pass it through so the work stops;
|
|
19
|
+
* others may ignore it, and the caller's timeout still races them.
|
|
16
20
|
*/
|
|
17
21
|
export interface ProxyDataAdapter {
|
|
18
22
|
proxyRoutes: ProxyRoutesAdapter;
|
|
19
|
-
resolveHost(host: string): Promise<ResolvedHost | null>;
|
|
23
|
+
resolveHost(host: string, options?: ResolveHostOptions): Promise<ResolvedHost | null>;
|
|
24
|
+
}
|
|
25
|
+
export interface ResolveHostOptions {
|
|
26
|
+
signal?: AbortSignal;
|
|
20
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProxyDataAdapter, ResolvedHost } from "../adapter";
|
|
1
|
+
import { ProxyDataAdapter, ResolvedHost, ResolveHostOptions } from "../adapter";
|
|
2
2
|
export interface HostResolverCache {
|
|
3
|
-
resolveHost(host: string): Promise<ResolvedHost | null>;
|
|
3
|
+
resolveHost(host: string, options?: ResolveHostOptions): Promise<ResolvedHost | null>;
|
|
4
4
|
}
|
|
5
5
|
export interface HostCacheOptions {
|
|
6
6
|
freshTtlMs: number;
|
|
@@ -5,10 +5,15 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
5
5
|
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
6
6
|
}, z.core.$strip>;
|
|
7
7
|
type Options = z.infer<typeof optionsSchema>;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The response for a request whose body could not be read up front: 408 when
|
|
10
|
+
* the client was too slow, 400 when the stream failed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function bodyReadFailure(err: unknown): Response;
|
|
13
|
+
export declare function buildUpstreamRequest(options: Options, req: Request, bodyTimeoutMs: number): Promise<{
|
|
9
14
|
target: URL;
|
|
10
15
|
init: RequestInit;
|
|
11
|
-
}
|
|
16
|
+
}>;
|
|
12
17
|
export declare const httpHandler: import("../registry").HandlerDefinition<{
|
|
13
18
|
upstream_url: string;
|
|
14
19
|
preserve_host: boolean;
|
|
@@ -4,4 +4,6 @@ export declare class TimeoutError extends Error {
|
|
|
4
4
|
}
|
|
5
5
|
export declare function isTimeoutLike(err: unknown): boolean;
|
|
6
6
|
export declare function withAbortTimeout<T>(ms: number, op: (signal: AbortSignal) => Promise<T>): Promise<T>;
|
|
7
|
+
export declare function anySignal(signals: Array<AbortSignal | undefined>): AbortSignal | undefined;
|
|
8
|
+
export declare function withDeadline<T>(ms: number, label: string, parent: AbortSignal | undefined, op: (signal: AbortSignal) => Promise<T>): Promise<T>;
|
|
7
9
|
export declare function withRaceTimeout<T>(p: Promise<T>, ms: number, label?: string): Promise<T>;
|