Comparing version 1.3.0 to 1.4.0
@@ -11,8 +11,16 @@ import { CookieSerializeOptions } from 'cookie-es'; | ||
id: string; | ||
createdAt: number; | ||
data: SessionData<T>; | ||
} | ||
interface SessionConfig { | ||
/** Private key used to encrypt session tokens */ | ||
password: string; | ||
/** Session expiration time in seconds */ | ||
maxAge?: number; | ||
/** default is h3 */ | ||
name?: string; | ||
cookie?: CookieSerializeOptions; | ||
/** Default is secure, httpOnly, / */ | ||
cookie?: false | CookieSerializeOptions; | ||
/** Default is x-h3-session / x-{name}-session */ | ||
sessionHeader?: false | string; | ||
seal?: SealOptions; | ||
@@ -30,2 +38,4 @@ crypto?: Crypto; | ||
declare function updateSession<T extends SessionDataT = SessionDataT>(event: H3Event, config: SessionConfig, update?: SessionUpdate<T>): Promise<Session<T>>; | ||
declare function sealSession<T extends SessionDataT = SessionDataT>(event: H3Event, config: SessionConfig): Promise<string>; | ||
declare function unsealSession(_event: H3Event, config: SessionConfig, sealed: string): Promise<Partial<Session<SessionDataT>>>; | ||
declare function clearSession(event: H3Event, config: SessionConfig): Promise<void>; | ||
@@ -358,2 +368,2 @@ | ||
export { AddRouteShortcuts, App, AppOptions, AppUse, CacheConditions, CreateRouterOptions, DynamicEventHandler, Encoding, EventHandler, EventHandlerResponse, H3Error, H3Event, H3EventContext, H3Headers, H3Response, HTTPMethod, InputLayer, InputStack, Layer, LazyEventHandler, MIMES, Matcher, NodeEventContext, NodeListener, NodeMiddleware, NodePromisifiedHandler, ProxyOptions, RequestHeaders, Router, RouterMethod, RouterUse, Session, SessionConfig, SessionData, Stack, appendHeader, appendHeaders, appendResponseHeader, appendResponseHeaders, assertMethod, callNodeListener, clearSession, createApp, createAppEventHandler, createError, createEvent, createRouter, defaultContentType, defineEventHandler, defineLazyEventHandler, defineNodeListener, defineNodeMiddleware, deleteCookie, dynamicEventHandler, eventHandler, fetchWithEvent, fromNodeMiddleware, getCookie, getHeader, getHeaders, getMethod, getProxyRequestHeaders, getQuery, getRequestHeader, getRequestHeaders, getResponseHeader, getResponseHeaders, getResponseStatus, getResponseStatusText, getRouterParam, getRouterParams, getSession, handleCacheHeaders, isError, isEvent, isEventHandler, isMethod, isStream, lazyEventHandler, parseCookies, promisifyNodeListener, proxyRequest, readBody, readMultipartFormData, readRawBody, send, sendError, sendNoContent, sendProxy, sendRedirect, sendStream, setCookie, setHeader, setHeaders, setResponseHeader, setResponseHeaders, setResponseStatus, toEventHandler, toNodeListener, updateSession, use, useBase, useSession, writeEarlyHints }; | ||
export { AddRouteShortcuts, App, AppOptions, AppUse, CacheConditions, CreateRouterOptions, DynamicEventHandler, Encoding, EventHandler, EventHandlerResponse, H3Error, H3Event, H3EventContext, H3Headers, H3Response, HTTPMethod, InputLayer, InputStack, Layer, LazyEventHandler, MIMES, Matcher, NodeEventContext, NodeListener, NodeMiddleware, NodePromisifiedHandler, ProxyOptions, RequestHeaders, Router, RouterMethod, RouterUse, Session, SessionConfig, SessionData, Stack, appendHeader, appendHeaders, appendResponseHeader, appendResponseHeaders, assertMethod, callNodeListener, clearSession, createApp, createAppEventHandler, createError, createEvent, createRouter, defaultContentType, defineEventHandler, defineLazyEventHandler, defineNodeListener, defineNodeMiddleware, deleteCookie, dynamicEventHandler, eventHandler, fetchWithEvent, fromNodeMiddleware, getCookie, getHeader, getHeaders, getMethod, getProxyRequestHeaders, getQuery, getRequestHeader, getRequestHeaders, getResponseHeader, getResponseHeaders, getResponseStatus, getResponseStatusText, getRouterParam, getRouterParams, getSession, handleCacheHeaders, isError, isEvent, isEventHandler, isMethod, isStream, lazyEventHandler, parseCookies, promisifyNodeListener, proxyRequest, readBody, readMultipartFormData, readRawBody, sealSession, send, sendError, sendNoContent, sendProxy, sendRedirect, sendStream, setCookie, setHeader, setHeaders, setResponseHeader, setResponseHeaders, setResponseStatus, toEventHandler, toNodeListener, unsealSession, updateSession, use, useBase, useSession, writeEarlyHints }; |
{ | ||
"name": "h3", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Tiny JavaScript Server", | ||
@@ -5,0 +5,0 @@ "repository": "unjs/h3", |
@@ -158,6 +158,8 @@ [![npm downloads](https://img.shields.io/npm/dm/h3.svg?style=flat-square)](https://npmjs.com/package/h3) | ||
- `readMultipartFormData(event)` | ||
- `useSession(event, { password, name?, cookie?, seal?, crypto? })` | ||
- `getSession(event, { password, name?, cookie?, seal?, crypto? })` | ||
- `updateSession(event, { password, name?, cookie?, seal?, crypto? }), update)` | ||
- `clearSession(event, { password, name?, cookie?, seal?, crypto? }))` | ||
- `useSession(event, config = { password, maxAge?, name?, cookie?, seal?, crypto? })` | ||
- `getSession(event, config)` | ||
- `updateSession(event, config, update)` | ||
- `clearSession(event, config)` | ||
- `sealSession(event, config)` | ||
- `unsealSession(event, config, sealed)` | ||
@@ -164,0 +166,0 @@ 👉 You can learn more about usage in [JSDocs Documentation](https://www.jsdocs.io/package/h3#package-functions). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
132309
3990
188