|
1 | | -import type { CreateStorageOptions } from 'unstorage' |
| 1 | +import type { BuiltinDriverName, CreateStorageOptions } from 'unstorage' |
| 2 | +import type { FSStorageOptions } from 'unstorage/dist/drivers/fs' |
| 3 | +import type { KVOptions } from 'unstorage/dist/drivers/cloudflare-kv-binding' |
| 4 | +import type { KVHTTPOptions } from 'unstorage/dist/drivers/cloudflare-kv-http' |
| 5 | +import type { GithubOptions } from 'unstorage/dist/drivers/github' |
| 6 | +import type { HTTPOptions } from 'unstorage/dist/drivers/http' |
| 7 | +import type { OverlayStorageOptions } from 'unstorage/dist/drivers/overlay' |
| 8 | +import type { LocalStorageOptions } from 'unstorage/dist/drivers/localstorage' |
| 9 | +import type { RedisOptions } from 'unstorage/dist/drivers/redis' |
2 | 10 |
|
3 | 11 | export type SameSiteOptions = 'lax' | 'strict' | 'none' |
4 | 12 | export type SupportedSessionApiMethods = 'patch' | 'delete' | 'get' | 'post' |
5 | 13 |
|
| 14 | +export type UnstorageDriverOption = FSStorageOptions | KVOptions | KVHTTPOptions | GithubOptions | HTTPOptions | OverlayStorageOptions | LocalStorageOptions | RedisOptions |
| 15 | + |
| 16 | +export interface StorageOptions { |
| 17 | + driver: BuiltinDriverName, |
| 18 | + options?: UnstorageDriverOption |
| 19 | +} |
6 | 20 | export interface SessionIpPinningOptions { |
7 | 21 | /** |
8 | 22 | * The name of the HTTP header used to retrieve the forwarded (real) IP address of the user |
@@ -45,12 +59,11 @@ export interface SessionOptions { |
45 | 59 | cookieSameSite: SameSiteOptions |
46 | 60 | /** |
47 | 61 | * Driver configuration for session-storage. Per default in-memory storage is used |
48 | | - * @default {} |
49 | | - * @example { driver: redisDriver({ base: 'storage:' }) } |
50 | | - * @type CreateStorageOptions |
| 62 | + * @default { driver: 'memory', options: {} } |
| 63 | + * @example { driver: 'redis', options: {url: 'redis://localhost:6739' } } |
51 | 64 | * @docs https://github.com/unjs/unstorage |
52 | 65 | */ |
53 | | - storageOptions: CreateStorageOptions, |
| 66 | + storageOptions: StorageOptions, |
54 | 67 | /** |
55 | 68 | * Set the domain the session cookie will be receivable by. Setting `domain: null` results in setting the domain the cookie is initially set on. Specifying a domain will allow the domain and all its sub-domains. |
56 | 69 | * @default null |
|
0 commit comments