mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
store session cookie/header name in constants, updated docs
This commit is contained in:
@@ -14,6 +14,10 @@ export const constants = {
|
|||||||
exec_async_event_id: "cf_register_waituntil",
|
exec_async_event_id: "cf_register_waituntil",
|
||||||
cache_endpoint: "/__bknd/cache",
|
cache_endpoint: "/__bknd/cache",
|
||||||
do_endpoint: "/__bknd/do",
|
do_endpoint: "/__bknd/do",
|
||||||
|
d1_session: {
|
||||||
|
cookie: "cf_d1_session",
|
||||||
|
header: "x-cf-d1-session",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CfMakeConfigArgs<Env extends CloudflareEnv = CloudflareEnv> = {
|
export type CfMakeConfigArgs<Env extends CloudflareEnv = CloudflareEnv> = {
|
||||||
@@ -35,8 +39,8 @@ function getCookieValue(cookies: string | null, name: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function d1SessionHelper(config: CloudflareBkndConfig<any>) {
|
export function d1SessionHelper(config: CloudflareBkndConfig<any>) {
|
||||||
const headerKey = "x-cf-d1-session";
|
const headerKey = constants.d1_session.header;
|
||||||
const cookieKey = "cf_d1_session";
|
const cookieKey = constants.d1_session.cookie;
|
||||||
const transport = config.d1?.transport;
|
const transport = config.d1?.transport;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export {
|
|||||||
type GetBindingType,
|
type GetBindingType,
|
||||||
type BindingMap,
|
type BindingMap,
|
||||||
} from "./bindings";
|
} from "./bindings";
|
||||||
|
export { constants } from "./config";
|
||||||
|
|
||||||
export function d1(config: D1ConnectionConfig) {
|
export function d1(config: D1ConnectionConfig) {
|
||||||
return new D1Connection(config);
|
return new D1Connection(config);
|
||||||
|
|||||||
Reference in New Issue
Block a user