@faasjs/http 0.0.2-beta.452 → 0.0.2-beta.454
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/dist/index.d.ts +11 -11
- package/package.json +3 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Plugin, DeployData, Next, MountData, InvokeData, UseifyPlugin } from '@faasjs/func';
|
|
2
2
|
import { Logger } from '@faasjs/logger';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type SessionOptions = {
|
|
5
5
|
key: string;
|
|
6
6
|
secret: string;
|
|
7
7
|
salt?: string;
|
|
@@ -11,7 +11,7 @@ declare type SessionOptions = {
|
|
|
11
11
|
digest?: string;
|
|
12
12
|
cipherName?: string;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type SessionContent = string | number | {
|
|
15
15
|
[key: string]: any;
|
|
16
16
|
} | null | undefined;
|
|
17
17
|
declare class Session<S extends Record<string, string> = any, C extends Record<string, string> = any> {
|
|
@@ -39,7 +39,7 @@ declare class Session<S extends Record<string, string> = any, C extends Record<s
|
|
|
39
39
|
update(): Session<S, C>;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
type CookieOptions = {
|
|
43
43
|
domain?: string;
|
|
44
44
|
path?: string;
|
|
45
45
|
expires?: number;
|
|
@@ -78,8 +78,8 @@ declare class Cookie<C extends Record<string, string> = any, S extends Record<st
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
type ValidatorRuleOptionsType = 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
82
|
+
type ValidatorRuleOptions = {
|
|
83
83
|
type?: ValidatorRuleOptionsType;
|
|
84
84
|
required?: boolean;
|
|
85
85
|
in?: any[];
|
|
@@ -87,7 +87,7 @@ declare type ValidatorRuleOptions = {
|
|
|
87
87
|
config?: Partial<ValidatorOptions>;
|
|
88
88
|
regexp?: RegExp;
|
|
89
89
|
};
|
|
90
|
-
|
|
90
|
+
type ValidatorOptions<Content = Record<string, any>> = {
|
|
91
91
|
whitelist?: 'error' | 'ignore';
|
|
92
92
|
rules: {
|
|
93
93
|
[k in keyof Content]?: ValidatorRuleOptions;
|
|
@@ -97,7 +97,7 @@ declare type ValidatorOptions<Content = Record<string, any>> = {
|
|
|
97
97
|
message: any;
|
|
98
98
|
} | void;
|
|
99
99
|
};
|
|
100
|
-
|
|
100
|
+
type Request<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any> = {
|
|
101
101
|
headers: {
|
|
102
102
|
[key: string]: string;
|
|
103
103
|
};
|
|
@@ -105,11 +105,11 @@ declare type Request<TParams extends Record<string, any> = any, TCookie extends
|
|
|
105
105
|
cookie?: Cookie<TCookie, TSession>;
|
|
106
106
|
session?: Session<TSession, TCookie>;
|
|
107
107
|
};
|
|
108
|
-
|
|
108
|
+
type BeforeOption<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any> = (request: Request<TParams, TCookie, TSession>) => Promise<void | {
|
|
109
109
|
statusCode?: number;
|
|
110
110
|
message: string;
|
|
111
111
|
}>;
|
|
112
|
-
|
|
112
|
+
type ValidatorConfig<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any> = {
|
|
113
113
|
params?: ValidatorOptions<TParams>;
|
|
114
114
|
cookie?: ValidatorOptions<TCookie>;
|
|
115
115
|
session?: ValidatorOptions<TSession>;
|
|
@@ -131,7 +131,7 @@ declare class Validator<TParams extends Record<string, any> = any, TCookie exten
|
|
|
131
131
|
declare const ContentType: {
|
|
132
132
|
[key: string]: string;
|
|
133
133
|
};
|
|
134
|
-
|
|
134
|
+
type HttpConfig<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any> = {
|
|
135
135
|
[key: string]: any;
|
|
136
136
|
name?: string;
|
|
137
137
|
config?: {
|
|
@@ -147,7 +147,7 @@ declare type HttpConfig<TParams extends Record<string, any> = any, TCookie exten
|
|
|
147
147
|
};
|
|
148
148
|
validator?: ValidatorConfig<TParams, TCookie, TSession>;
|
|
149
149
|
};
|
|
150
|
-
|
|
150
|
+
type Response = {
|
|
151
151
|
statusCode?: number;
|
|
152
152
|
headers?: {
|
|
153
153
|
[key: string]: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/http",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.454",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,12 +23,8 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@faasjs/func": "^0.0.2-beta.
|
|
27
|
-
"@faasjs/logger": "^0.0.2-beta.
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"tsup": "*",
|
|
31
|
-
"typescript": "*"
|
|
26
|
+
"@faasjs/func": "^0.0.2-beta.454",
|
|
27
|
+
"@faasjs/logger": "^0.0.2-beta.454"
|
|
32
28
|
},
|
|
33
29
|
"engines": {
|
|
34
30
|
"npm": ">=8.0.0",
|