session-flash 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +47 -0
- package/package.json +2 -2
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as express from 'express';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for flash middleware
|
|
5
|
+
*/
|
|
6
|
+
export interface FlashOptions {
|
|
7
|
+
/**
|
|
8
|
+
* If true, middleware will not override existing req.flash
|
|
9
|
+
* Default: true
|
|
10
|
+
*/
|
|
11
|
+
unsafe?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Augment Express Request interface to include flash
|
|
16
|
+
*/
|
|
17
|
+
declare global {
|
|
18
|
+
namespace Express {
|
|
19
|
+
interface Request {
|
|
20
|
+
/**
|
|
21
|
+
* Flash messages.
|
|
22
|
+
*
|
|
23
|
+
* Usage:
|
|
24
|
+
* req.flash('info', 'message')
|
|
25
|
+
* req.flash('info')
|
|
26
|
+
* req.flash()
|
|
27
|
+
*/
|
|
28
|
+
flash(type: string, msg: string | string[], ...args: any[]): number;
|
|
29
|
+
flash(type: string): string[];
|
|
30
|
+
flash(): Record<string, string[]>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface Session {
|
|
34
|
+
flash?: Record<string, string[]>;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Flash middleware factory
|
|
41
|
+
*
|
|
42
|
+
* @param options FlashOptions
|
|
43
|
+
* @returns Express middleware
|
|
44
|
+
*/
|
|
45
|
+
declare function flash(options?: FlashOptions): express.RequestHandler;
|
|
46
|
+
|
|
47
|
+
export = flash;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "session-flash",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Flash message middleware for Session.",
|
|
5
5
|
"keywords": ["session", "express", "flash", "messages"],
|
|
6
6
|
"author": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"licenses": [ {
|
|
11
11
|
"type": "MIT"
|
|
12
12
|
} ],
|
|
13
|
-
"main": "./lib
|
|
13
|
+
"main": "./lib",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|