@faasjs/http 1.4.2 → 1.6.0
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 +13 -198
- package/dist/index.d.mts +15 -0
- package/dist/index.d.ts +15 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
# @faasjs/http
|
|
2
2
|
|
|
3
|
-
[](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/http/LICENSE)
|
|
4
|
-
[](https://www.npmjs.com/package/@faasjs/http)
|
|
5
|
-
[](https://www.npmjs.com/package/@faasjs/http)
|
|
6
|
-
|
|
7
3
|
FaasJS's http plugin.
|
|
8
4
|
|
|
5
|
+
[](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/http/LICENSE)
|
|
6
|
+
[](https://www.npmjs.com/package/@faasjs/http)
|
|
7
|
+
|
|
9
8
|
## Install
|
|
10
9
|
|
|
11
10
|
```sh
|
|
12
11
|
npm install @faasjs/http
|
|
13
12
|
```
|
|
14
13
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
### Classes
|
|
14
|
+
## Classes
|
|
18
15
|
|
|
19
16
|
- [Cookie](classes/Cookie.md)
|
|
20
17
|
- [Http](classes/Http.md)
|
|
@@ -22,202 +19,20 @@ npm install @faasjs/http
|
|
|
22
19
|
- [Session](classes/Session.md)
|
|
23
20
|
- [Validator](classes/Validator.md)
|
|
24
21
|
|
|
25
|
-
### Type Aliases
|
|
26
|
-
|
|
27
|
-
- [CookieOptions](#cookieoptions)
|
|
28
|
-
- [HttpConfig](#httpconfig)
|
|
29
|
-
- [Response](#response)
|
|
30
|
-
- [SessionOptions](#sessionoptions)
|
|
31
|
-
- [ValidatorConfig](#validatorconfig)
|
|
32
|
-
- [ValidatorOptions](#validatoroptions)
|
|
33
|
-
- [ValidatorRuleOptions](#validatorruleoptions)
|
|
34
|
-
|
|
35
|
-
### Variables
|
|
36
|
-
|
|
37
|
-
- [ContentType](#contenttype)
|
|
38
|
-
|
|
39
|
-
### Functions
|
|
40
|
-
|
|
41
|
-
- [useHttp](#usehttp)
|
|
42
|
-
|
|
43
22
|
## Type Aliases
|
|
44
23
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
#### Type declaration
|
|
54
|
-
|
|
55
|
-
| Name | Type |
|
|
56
|
-
| :------ | :------ |
|
|
57
|
-
| `domain?` | `string` |
|
|
58
|
-
| `expires?` | `number` |
|
|
59
|
-
| `httpOnly?` | `boolean` |
|
|
60
|
-
| `path?` | `string` |
|
|
61
|
-
| `sameSite?` | ``"Strict"`` \| ``"Lax"`` \| ``"None"`` |
|
|
62
|
-
| `secure?` | `boolean` |
|
|
63
|
-
| `session?` | [`SessionOptions`](#sessionoptions) |
|
|
64
|
-
|
|
65
|
-
___
|
|
66
|
-
|
|
67
|
-
### HttpConfig
|
|
68
|
-
|
|
69
|
-
Ƭ **HttpConfig**\<`TParams`, `TCookie`, `TSession`\>: `Object`
|
|
70
|
-
|
|
71
|
-
#### Type parameters
|
|
72
|
-
|
|
73
|
-
| Name | Type |
|
|
74
|
-
| :------ | :------ |
|
|
75
|
-
| `TParams` | extends `Record`\<`string`, `any`\> = `any` |
|
|
76
|
-
| `TCookie` | extends `Record`\<`string`, `string`\> = `any` |
|
|
77
|
-
| `TSession` | extends `Record`\<`string`, `string`\> = `any` |
|
|
78
|
-
|
|
79
|
-
#### Index signature
|
|
80
|
-
|
|
81
|
-
▪ [key: `string`]: `any`
|
|
82
|
-
|
|
83
|
-
#### Type declaration
|
|
84
|
-
|
|
85
|
-
| Name | Type |
|
|
86
|
-
| :------ | :------ |
|
|
87
|
-
| `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` } |
|
|
88
|
-
| `config.cookie?` | [`CookieOptions`](#cookieoptions) |
|
|
89
|
-
| `config.functionName?` | `string` |
|
|
90
|
-
| `config.ignorePathPrefix?` | `string` |
|
|
91
|
-
| `config.method?` | ``"BEGIN"`` \| ``"GET"`` \| ``"POST"`` \| ``"DELETE"`` \| ``"HEAD"`` \| ``"PUT"`` \| ``"OPTIONS"`` \| ``"TRACE"`` \| ``"PATCH"`` \| ``"ANY"`` |
|
|
92
|
-
| `config.path?` | `string` |
|
|
93
|
-
| `config.timeout?` | `number` |
|
|
94
|
-
| `name?` | `string` |
|
|
95
|
-
| `validator?` | [`ValidatorConfig`](#validatorconfig)\<`TParams`, `TCookie`, `TSession`\> |
|
|
96
|
-
|
|
97
|
-
___
|
|
98
|
-
|
|
99
|
-
### Response
|
|
100
|
-
|
|
101
|
-
Ƭ **Response**: `Object`
|
|
102
|
-
|
|
103
|
-
#### Type declaration
|
|
104
|
-
|
|
105
|
-
| Name | Type |
|
|
106
|
-
| :------ | :------ |
|
|
107
|
-
| `body?` | `string` |
|
|
108
|
-
| `headers?` | \{ `[key: string]`: `string`; } |
|
|
109
|
-
| `message?` | `string` |
|
|
110
|
-
| `statusCode?` | `number` |
|
|
111
|
-
|
|
112
|
-
___
|
|
113
|
-
|
|
114
|
-
### SessionOptions
|
|
115
|
-
|
|
116
|
-
Ƭ **SessionOptions**: `Object`
|
|
117
|
-
|
|
118
|
-
#### Type declaration
|
|
119
|
-
|
|
120
|
-
| Name | Type |
|
|
121
|
-
| :------ | :------ |
|
|
122
|
-
| `cipherName?` | `string` |
|
|
123
|
-
| `digest?` | `string` |
|
|
124
|
-
| `iterations?` | `number` |
|
|
125
|
-
| `key` | `string` |
|
|
126
|
-
| `keylen?` | `number` |
|
|
127
|
-
| `salt?` | `string` |
|
|
128
|
-
| `secret` | `string` |
|
|
129
|
-
| `signedSalt?` | `string` |
|
|
130
|
-
|
|
131
|
-
___
|
|
132
|
-
|
|
133
|
-
### ValidatorConfig
|
|
134
|
-
|
|
135
|
-
Ƭ **ValidatorConfig**\<`TParams`, `TCookie`, `TSession`\>: `Object`
|
|
136
|
-
|
|
137
|
-
#### Type parameters
|
|
138
|
-
|
|
139
|
-
| Name | Type |
|
|
140
|
-
| :------ | :------ |
|
|
141
|
-
| `TParams` | extends `Record`\<`string`, `any`\> = `any` |
|
|
142
|
-
| `TCookie` | extends `Record`\<`string`, `string`\> = `any` |
|
|
143
|
-
| `TSession` | extends `Record`\<`string`, `string`\> = `any` |
|
|
144
|
-
|
|
145
|
-
#### Type declaration
|
|
146
|
-
|
|
147
|
-
| Name | Type |
|
|
148
|
-
| :------ | :------ |
|
|
149
|
-
| `before?` | `BeforeOption` |
|
|
150
|
-
| `cookie?` | [`ValidatorOptions`](#validatoroptions)\<`TCookie`\> |
|
|
151
|
-
| `params?` | [`ValidatorOptions`](#validatoroptions)\<`TParams`\> |
|
|
152
|
-
| `session?` | [`ValidatorOptions`](#validatoroptions)\<`TSession`\> |
|
|
153
|
-
|
|
154
|
-
___
|
|
155
|
-
|
|
156
|
-
### ValidatorOptions
|
|
157
|
-
|
|
158
|
-
Ƭ **ValidatorOptions**\<`Content`\>: `Object`
|
|
159
|
-
|
|
160
|
-
#### Type parameters
|
|
161
|
-
|
|
162
|
-
| Name | Type |
|
|
163
|
-
| :------ | :------ |
|
|
164
|
-
| `Content` | `Record`\<`string`, `any`\> |
|
|
165
|
-
|
|
166
|
-
#### Type declaration
|
|
167
|
-
|
|
168
|
-
| Name | Type |
|
|
169
|
-
| :------ | :------ |
|
|
170
|
-
| `onError?` | (`type`: `string`, `key`: `string` \| `string`[], `value?`: `any`) => \{ `message`: `any` ; `statusCode?`: `number` } \| `void` |
|
|
171
|
-
| `rules` | \{ [k in keyof Content]?: ValidatorRuleOptions } |
|
|
172
|
-
| `whitelist?` | ``"error"`` \| ``"ignore"`` |
|
|
173
|
-
|
|
174
|
-
___
|
|
175
|
-
|
|
176
|
-
### ValidatorRuleOptions
|
|
177
|
-
|
|
178
|
-
Ƭ **ValidatorRuleOptions**: `Object`
|
|
179
|
-
|
|
180
|
-
#### Type declaration
|
|
181
|
-
|
|
182
|
-
| Name | Type |
|
|
183
|
-
| :------ | :------ |
|
|
184
|
-
| `config?` | `Partial`\<[`ValidatorOptions`](#validatoroptions)\> |
|
|
185
|
-
| `default?` | `any` |
|
|
186
|
-
| `in?` | `any`[] |
|
|
187
|
-
| `regexp?` | `RegExp` |
|
|
188
|
-
| `required?` | `boolean` |
|
|
189
|
-
| `type?` | `ValidatorRuleOptionsType` |
|
|
24
|
+
- [CookieOptions](type-aliases/CookieOptions.md)
|
|
25
|
+
- [HttpConfig](type-aliases/HttpConfig.md)
|
|
26
|
+
- [Response](type-aliases/Response.md)
|
|
27
|
+
- [SessionOptions](type-aliases/SessionOptions.md)
|
|
28
|
+
- [ValidatorConfig](type-aliases/ValidatorConfig.md)
|
|
29
|
+
- [ValidatorOptions](type-aliases/ValidatorOptions.md)
|
|
30
|
+
- [ValidatorRuleOptions](type-aliases/ValidatorRuleOptions.md)
|
|
190
31
|
|
|
191
32
|
## Variables
|
|
192
33
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
• `Const` **ContentType**: `Object`
|
|
196
|
-
|
|
197
|
-
#### Index signature
|
|
198
|
-
|
|
199
|
-
▪ [key: `string`]: `string`
|
|
34
|
+
- [ContentType](variables/ContentType.md)
|
|
200
35
|
|
|
201
36
|
## Functions
|
|
202
37
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
▸ **useHttp**\<`TParams`, `TCookie`, `TSession`\>(`config?`): `UseifyPlugin`\<[`Http`](classes/Http.md)\<`TParams`, `TCookie`, `TSession`\>\>
|
|
206
|
-
|
|
207
|
-
#### Type parameters
|
|
208
|
-
|
|
209
|
-
| Name | Type |
|
|
210
|
-
| :------ | :------ |
|
|
211
|
-
| `TParams` | extends `Record`\<`string`, `any`\> = `any` |
|
|
212
|
-
| `TCookie` | extends `Record`\<`string`, `string`\> = `any` |
|
|
213
|
-
| `TSession` | extends `Record`\<`string`, `string`\> = `any` |
|
|
214
|
-
|
|
215
|
-
#### Parameters
|
|
216
|
-
|
|
217
|
-
| Name | Type |
|
|
218
|
-
| :------ | :------ |
|
|
219
|
-
| `config?` | [`HttpConfig`](#httpconfig)\<`TParams`, `TCookie`, `TSession`\> |
|
|
220
|
-
|
|
221
|
-
#### Returns
|
|
222
|
-
|
|
223
|
-
`UseifyPlugin`\<[`Http`](classes/Http.md)\<`TParams`, `TCookie`, `TSession`\>\>
|
|
38
|
+
- [useHttp](functions/useHttp.md)
|
package/dist/index.d.mts
CHANGED
|
@@ -129,6 +129,21 @@ declare class Validator<TParams extends Record<string, any> = any, TCookie exten
|
|
|
129
129
|
}, baseKey: string, config: ValidatorOptions, logger: Logger): void;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* FaasJS's http plugin.
|
|
134
|
+
*
|
|
135
|
+
* [](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/http/LICENSE)
|
|
136
|
+
* [](https://www.npmjs.com/package/@faasjs/http)
|
|
137
|
+
*
|
|
138
|
+
* ## Install
|
|
139
|
+
*
|
|
140
|
+
* ```sh
|
|
141
|
+
* npm install @faasjs/http
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @packageDocumentation
|
|
145
|
+
*/
|
|
146
|
+
|
|
132
147
|
declare const ContentType: {
|
|
133
148
|
[key: string]: string;
|
|
134
149
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -129,6 +129,21 @@ declare class Validator<TParams extends Record<string, any> = any, TCookie exten
|
|
|
129
129
|
}, baseKey: string, config: ValidatorOptions, logger: Logger): void;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* FaasJS's http plugin.
|
|
134
|
+
*
|
|
135
|
+
* [](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/http/LICENSE)
|
|
136
|
+
* [](https://www.npmjs.com/package/@faasjs/http)
|
|
137
|
+
*
|
|
138
|
+
* ## Install
|
|
139
|
+
*
|
|
140
|
+
* ```sh
|
|
141
|
+
* npm install @faasjs/http
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @packageDocumentation
|
|
145
|
+
*/
|
|
146
|
+
|
|
132
147
|
declare const ContentType: {
|
|
133
148
|
[key: string]: string;
|
|
134
149
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/http",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@faasjs/func": "1.
|
|
26
|
-
"@faasjs/logger": "1.
|
|
25
|
+
"@faasjs/func": "1.6.0",
|
|
26
|
+
"@faasjs/logger": "1.6.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@faasjs/func": "1.
|
|
30
|
-
"@faasjs/logger": "1.
|
|
29
|
+
"@faasjs/func": "1.6.0",
|
|
30
|
+
"@faasjs/logger": "1.6.0"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
33
|
"npm": ">=9.0.0",
|