@authhero/proxy 0.5.1 → 0.7.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 +35 -13
- package/dist/proxy.mjs +600 -519
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/app.d.ts +3 -0
- package/dist/types/data-plane/cache-adapter-cache.d.ts +8 -3
- package/dist/types/data-plane/cache-api-cache.d.ts +4 -2
- package/dist/types/data-plane/cache.d.ts +1 -0
- package/dist/types/data-plane/compile.d.ts +6 -1
- package/dist/types/data-plane/handlers/dispatch-namespace.d.ts +1 -0
- package/dist/types/data-plane/handlers/service-binding.d.ts +1 -0
- package/dist/types/data-plane/router.d.ts +6 -0
- package/dist/types/data-plane/timeout.d.ts +7 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -6,6 +6,8 @@ export interface CacheApiHostCacheOptions {
|
|
|
6
6
|
namespace?: string;
|
|
7
7
|
cache?: Cache;
|
|
8
8
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
9
|
+
cacheReadTimeoutMs?: number;
|
|
10
|
+
cacheWriteTimeoutMs?: number;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Wraps an upstream `HostResolverCache` with a Cloudflare Cache-API layer.
|
|
@@ -18,8 +20,8 @@ export interface CacheApiHostCacheOptions {
|
|
|
18
20
|
*
|
|
19
21
|
* @deprecated Prefer `createCacheAdapterHostCache` with `createCloudflareCache`
|
|
20
22
|
* from `@authhero/cloudflare-adapter`. The adapter-based wrapper supports
|
|
21
|
-
* stale-while-revalidate and works with any `CacheAdapter`
|
|
22
|
-
* Redis, in-memory, …).
|
|
23
|
+
* stale-while-revalidate, stale-if-error, and works with any `CacheAdapter`
|
|
24
|
+
* (Cloudflare, Redis, in-memory, …).
|
|
23
25
|
*/
|
|
24
26
|
export declare function createCacheApiHostCache(options: CacheApiHostCacheOptions): HostResolverCache;
|
|
25
27
|
export declare function buildCacheApiKey(namespace: string, host: string): Request;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
+
import type { MiddlewareHandler } from "hono";
|
|
2
3
|
import type { ProxyRoute } from "../types";
|
|
3
4
|
import { HandlerRegistry } from "./registry";
|
|
4
5
|
import { type ProxyHostContext } from "./handlers/util";
|
|
@@ -10,5 +11,9 @@ import { type ProxyHostContext } from "./handlers/util";
|
|
|
10
11
|
* `domain` set in its Hono context (read with `getProxy*` helpers from
|
|
11
12
|
* `handlers/util.ts`). Handlers that template against those values
|
|
12
13
|
* (`dispatch_namespace`) depend on this wiring.
|
|
14
|
+
*
|
|
15
|
+
* `defaultHandlers` is a prebuilt middleware chain installed as the catch-all
|
|
16
|
+
* when no per-host route matches. Pass `undefined` to keep the legacy 404
|
|
17
|
+
* "No matching route" behavior.
|
|
13
18
|
*/
|
|
14
|
-
export declare function compileHostApp(routes: ProxyRoute[], registry: HandlerRegistry, hostContext?: ProxyHostContext): Hono;
|
|
19
|
+
export declare function compileHostApp(routes: ProxyRoute[], registry: HandlerRegistry, hostContext?: ProxyHostContext, defaultHandlers?: MiddlewareHandler[]): Hono;
|
|
@@ -3,6 +3,10 @@ import type { Context } from "hono";
|
|
|
3
3
|
import { ProxyDataAdapter } from "../adapter";
|
|
4
4
|
import { HostCacheOptions, HostResolverCache } from "./cache";
|
|
5
5
|
import { HandlerRegistry } from "./registry";
|
|
6
|
+
export interface ProxyRouteHandlerSpec {
|
|
7
|
+
type: string;
|
|
8
|
+
options?: unknown;
|
|
9
|
+
}
|
|
6
10
|
export interface ProxyDataPlaneOptions {
|
|
7
11
|
data: ProxyDataAdapter;
|
|
8
12
|
cacheTtlMs?: number;
|
|
@@ -10,6 +14,8 @@ export interface ProxyDataPlaneOptions {
|
|
|
10
14
|
resolver?: HostResolverCache;
|
|
11
15
|
registry?: HandlerRegistry;
|
|
12
16
|
bindings?: Record<string, unknown>;
|
|
17
|
+
resolveHostTimeoutMs?: number;
|
|
18
|
+
defaultHandlers?: ProxyRouteHandlerSpec[];
|
|
13
19
|
}
|
|
14
20
|
export declare function createProxyDataPlaneHandler(options: ProxyDataPlaneOptions): (c: Context) => Promise<Response>;
|
|
15
21
|
export declare function createProxyDataPlaneRouter(options: ProxyDataPlaneOptions): Hono;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class TimeoutError extends Error {
|
|
2
|
+
readonly ms: number;
|
|
3
|
+
constructor(ms: number, label?: string);
|
|
4
|
+
}
|
|
5
|
+
export declare function isTimeoutLike(err: unknown): boolean;
|
|
6
|
+
export declare function withAbortTimeout<T>(ms: number, op: (signal: AbortSignal) => Promise<T>): Promise<T>;
|
|
7
|
+
export declare function withRaceTimeout<T>(p: Promise<T>, ms: number, label?: string): Promise<T>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from "./adapter";
|
|
|
3
3
|
export { createProxyApp } from "./app";
|
|
4
4
|
export type { ProxyAppOptions } from "./app";
|
|
5
5
|
export { createProxyDataPlaneRouter, createProxyDataPlaneHandler, } from "./data-plane/router";
|
|
6
|
-
export type { ProxyDataPlaneOptions } from "./data-plane/router";
|
|
6
|
+
export type { ProxyDataPlaneOptions, ProxyRouteHandlerSpec, } from "./data-plane/router";
|
|
7
7
|
export { createInMemoryHostCache } from "./data-plane/cache";
|
|
8
8
|
export type { HostCacheOptions, HostResolverCache } from "./data-plane/cache";
|
|
9
9
|
export { createCacheApiHostCache, buildCacheApiKey, } from "./data-plane/cache-api-cache";
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/markusahlstrand/authhero"
|
|
13
13
|
},
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.7.0",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"hono": "^4.6.8"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@authhero/adapter-interfaces": "3.1.
|
|
42
|
+
"@authhero/adapter-interfaces": "3.1.1"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "vite build && tsc -p tsconfig.types.json && rollup -c rollup.dts.config.mjs",
|