@faasjs/http 0.0.2-beta.362 → 0.0.2-beta.366
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/README.md +24 -22
- package/dist/index.d.ts +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# @faasjs/http
|
|
2
2
|
|
|
3
|
-
http 插件
|
|
4
|
-
|
|
5
3
|
[](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/http/LICENSE)
|
|
6
4
|
[](https://www.npmjs.com/package/@faasjs/http)
|
|
7
5
|
[](https://www.npmjs.com/package/@faasjs/http)
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
FaasJS's http plugin.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
npm install @faasjs/http
|
|
10
12
|
|
|
11
13
|
## Modules
|
|
12
14
|
|
|
@@ -20,21 +22,21 @@ https://faasjs.com/doc/http.html
|
|
|
20
22
|
|
|
21
23
|
### Type aliases
|
|
22
24
|
|
|
23
|
-
- [CookieOptions](
|
|
24
|
-
- [HttpConfig](
|
|
25
|
-
- [Response](
|
|
26
|
-
- [SessionOptions](
|
|
27
|
-
- [ValidatorConfig](
|
|
28
|
-
- [ValidatorOptions](
|
|
29
|
-
- [ValidatorRuleOptions](
|
|
25
|
+
- [CookieOptions](#cookieoptions)
|
|
26
|
+
- [HttpConfig](#httpconfig)
|
|
27
|
+
- [Response](#response)
|
|
28
|
+
- [SessionOptions](#sessionoptions)
|
|
29
|
+
- [ValidatorConfig](#validatorconfig)
|
|
30
|
+
- [ValidatorOptions](#validatoroptions)
|
|
31
|
+
- [ValidatorRuleOptions](#validatorruleoptions)
|
|
30
32
|
|
|
31
33
|
### Variables
|
|
32
34
|
|
|
33
|
-
- [ContentType](
|
|
35
|
+
- [ContentType](#contenttype)
|
|
34
36
|
|
|
35
37
|
### Functions
|
|
36
38
|
|
|
37
|
-
- [useHttp](
|
|
39
|
+
- [useHttp](#usehttp)
|
|
38
40
|
|
|
39
41
|
## Type aliases
|
|
40
42
|
|
|
@@ -56,7 +58,7 @@ https://faasjs.com/doc/http.html
|
|
|
56
58
|
| `path?` | `string` |
|
|
57
59
|
| `sameSite?` | ``"Strict"`` \| ``"Lax"`` \| ``"None"`` |
|
|
58
60
|
| `secure?` | `boolean` |
|
|
59
|
-
| `session?` | [`SessionOptions`](
|
|
61
|
+
| `session?` | [`SessionOptions`](#sessionoptions) |
|
|
60
62
|
|
|
61
63
|
___
|
|
62
64
|
|
|
@@ -80,15 +82,15 @@ ___
|
|
|
80
82
|
|
|
81
83
|
| Name | Type |
|
|
82
84
|
| :------ | :------ |
|
|
83
|
-
| `config?` | `
|
|
84
|
-
| `config.cookie?` | [`CookieOptions`](
|
|
85
|
+
| `config?` | { [key: string]: `any`; `cookie?`: [`CookieOptions`](#cookieoptions) ; `functionName?`: `string` ; `ignorePathPrefix?`: `string` ; `method?`: ``"BEGIN"`` \| ``"GET"`` \| ``"POST"`` \| ``"DELETE"`` \| ``"HEAD"`` \| ``"PUT"`` \| ``"OPTIONS"`` \| ``"TRACE"`` \| ``"PATCH"`` \| ``"ANY"`` ; `path?`: `string` ; `timeout?`: `number` } |
|
|
86
|
+
| `config.cookie?` | [`CookieOptions`](#cookieoptions) |
|
|
85
87
|
| `config.functionName?` | `string` |
|
|
86
88
|
| `config.ignorePathPrefix?` | `string` |
|
|
87
89
|
| `config.method?` | ``"BEGIN"`` \| ``"GET"`` \| ``"POST"`` \| ``"DELETE"`` \| ``"HEAD"`` \| ``"PUT"`` \| ``"OPTIONS"`` \| ``"TRACE"`` \| ``"PATCH"`` \| ``"ANY"`` |
|
|
88
90
|
| `config.path?` | `string` |
|
|
89
91
|
| `config.timeout?` | `number` |
|
|
90
92
|
| `name?` | `string` |
|
|
91
|
-
| `validator?` | [`ValidatorConfig`](
|
|
93
|
+
| `validator?` | [`ValidatorConfig`](#validatorconfig)<`TParams`, `TCookie`, `TSession`\> |
|
|
92
94
|
|
|
93
95
|
___
|
|
94
96
|
|
|
@@ -101,7 +103,7 @@ ___
|
|
|
101
103
|
| Name | Type |
|
|
102
104
|
| :------ | :------ |
|
|
103
105
|
| `body?` | `string` |
|
|
104
|
-
| `headers?` | `
|
|
106
|
+
| `headers?` | { [key: string]: `string`; } |
|
|
105
107
|
| `message?` | `string` |
|
|
106
108
|
| `statusCode?` | `number` |
|
|
107
109
|
|
|
@@ -143,9 +145,9 @@ ___
|
|
|
143
145
|
| Name | Type |
|
|
144
146
|
| :------ | :------ |
|
|
145
147
|
| `before?` | `BeforeOption` |
|
|
146
|
-
| `cookie?` | [`ValidatorOptions`](
|
|
147
|
-
| `params?` | [`ValidatorOptions`](
|
|
148
|
-
| `session?` | [`ValidatorOptions`](
|
|
148
|
+
| `cookie?` | [`ValidatorOptions`](#validatoroptions)<`TCookie`\> |
|
|
149
|
+
| `params?` | [`ValidatorOptions`](#validatoroptions)<`TParams`\> |
|
|
150
|
+
| `session?` | [`ValidatorOptions`](#validatoroptions)<`TSession`\> |
|
|
149
151
|
|
|
150
152
|
___
|
|
151
153
|
|
|
@@ -177,7 +179,7 @@ ___
|
|
|
177
179
|
|
|
178
180
|
| Name | Type |
|
|
179
181
|
| :------ | :------ |
|
|
180
|
-
| `config?` | `Partial`<[`ValidatorOptions`](
|
|
182
|
+
| `config?` | `Partial`<[`ValidatorOptions`](#validatoroptions)\> |
|
|
181
183
|
| `default?` | `any` |
|
|
182
184
|
| `in?` | `any`[] |
|
|
183
185
|
| `regexp?` | `RegExp` |
|
|
@@ -212,7 +214,7 @@ ___
|
|
|
212
214
|
|
|
213
215
|
| Name | Type |
|
|
214
216
|
| :------ | :------ |
|
|
215
|
-
| `config?` | [`HttpConfig`](
|
|
217
|
+
| `config?` | [`HttpConfig`](#httpconfig)<`TParams`, `TCookie`, `TSession`\> |
|
|
216
218
|
|
|
217
219
|
#### Returns
|
|
218
220
|
|
package/dist/index.d.ts
CHANGED
|
@@ -33,8 +33,8 @@ declare class Session<S extends Record<string, string> = any, C extends Record<s
|
|
|
33
33
|
constructor(cookie: Cookie<C, S>, config: SessionOptions);
|
|
34
34
|
invoke(cookie?: string): void;
|
|
35
35
|
encode(text: SessionContent): string;
|
|
36
|
-
decode(text: string): SessionContent;
|
|
37
|
-
read(key: string): string;
|
|
36
|
+
decode<TData = any>(text: string): TData | SessionContent;
|
|
37
|
+
read(key: string): string | number;
|
|
38
38
|
write(key: string, value?: string | number | null): Session<S, C>;
|
|
39
39
|
update(): Session<S, C>;
|
|
40
40
|
}
|
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.366",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@faasjs/func": "^0.0.2-beta.
|
|
26
|
-
"@faasjs/logger": "^0.0.2-beta.
|
|
25
|
+
"@faasjs/func": "^0.0.2-beta.366",
|
|
26
|
+
"@faasjs/logger": "^0.0.2-beta.366"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"tsup": "*",
|