refactor(cloudflare-access): enable isolated declarations (#1195)
parent
683455895d
commit
b6f3bc674b
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@hono/cloudflare-access': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Add explicit `MiddlewareHandler` return type
|
|
@ -1,4 +1,4 @@
|
||||||
import type { Context } from 'hono'
|
import type { Context, MiddlewareHandler } from 'hono'
|
||||||
import { getCookie } from 'hono/cookie'
|
import { getCookie } from 'hono/cookie'
|
||||||
import { createMiddleware } from 'hono/factory'
|
import { createMiddleware } from 'hono/factory'
|
||||||
import { HTTPException } from 'hono/http-exception'
|
import { HTTPException } from 'hono/http-exception'
|
||||||
|
@ -33,7 +33,7 @@ declare module 'hono' {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const cloudflareAccess = (accessTeamName: string) => {
|
export const cloudflareAccess = (accessTeamName: string): MiddlewareHandler => {
|
||||||
// This var will hold already imported jwt keys, this reduces the load of importing the key on every request
|
// This var will hold already imported jwt keys, this reduces the load of importing the key on every request
|
||||||
let cacheKeys: Record<string, CryptoKey> = {}
|
let cacheKeys: Record<string, CryptoKey> = {}
|
||||||
let cacheExpiration = 0
|
let cacheExpiration = 0
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"tsBuildInfoFile": "dist/tsconfig.build.tsbuildinfo",
|
"tsBuildInfoFile": "dist/tsconfig.build.tsbuildinfo",
|
||||||
"emitDeclarationOnly": false,
|
"emitDeclarationOnly": false,
|
||||||
|
"isolatedDeclarations": true,
|
||||||
"types": ["@cloudflare/workers-types"]
|
"types": ["@cloudflare/workers-types"]
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts"],
|
"include": ["src/**/*.ts"],
|
||||||
|
|
Loading…
Reference in New Issue