mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
add types for hapi-server-session (#42403)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import hapiServerSessionPlugin from 'hapi-server-session';
|
||||
import { Server } from '@hapi/hapi';
|
||||
|
||||
const server = new Server();
|
||||
|
||||
server.register({
|
||||
plugin: hapiServerSessionPlugin,
|
||||
options: {
|
||||
algorithm: 'md5',
|
||||
cache: { segment: 'test' },
|
||||
cookie: { ttl: null },
|
||||
expiresIn: 86400,
|
||||
key: 'test',
|
||||
name: 'test',
|
||||
size: 32,
|
||||
vhost: ['test'],
|
||||
},
|
||||
});
|
||||
|
||||
server.route({ path: '/', method: 'GET', handler: (request, _h) => request.session });
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for hapi-server-session 5.1
|
||||
// Project: https://github.com/btmorex/hapi-server-session
|
||||
// Definitions by: Avery Fay <https://github.com/btmorex>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { BinaryLike } from 'crypto';
|
||||
import { CachePolicyOptions, Plugin, ServerStateCookieOptions } from '@hapi/hapi';
|
||||
|
||||
declare module '@hapi/hapi' {
|
||||
interface Request {
|
||||
session: any;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
algorithm?: string;
|
||||
cache?: CachePolicyOptions<any>;
|
||||
cookie?: ServerStateCookieOptions;
|
||||
expiresIn?: number;
|
||||
key?: BinaryLike;
|
||||
name?: string;
|
||||
size?: number;
|
||||
vhost?: string | string[];
|
||||
}
|
||||
|
||||
export const plugin: Plugin<Options>;
|
||||
|
||||
export default plugin;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"paths": {
|
||||
"@hapi/catbox": ["hapi__catbox"],
|
||||
"@hapi/hapi": ["hapi__hapi"],
|
||||
"@hapi/joi": ["hapi__joi"],
|
||||
"@hapi/mimos": ["hapi__mimos"],
|
||||
"@hapi/podium": ["hapi__podium"],
|
||||
"@hapi/shot": ["hapi__shot"]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "hapi-server-session-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user