@faasjs/http 0.0.4-beta.9 → 0.0.5-beta.2

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 CHANGED
@@ -64,15 +64,15 @@ ___
64
64
 
65
65
  ### HttpConfig
66
66
 
67
- Ƭ **HttpConfig**<`TParams`, `TCookie`, `TSession`\>: `Object`
67
+ Ƭ **HttpConfig**\<`TParams`, `TCookie`, `TSession`\>: `Object`
68
68
 
69
69
  #### Type parameters
70
70
 
71
71
  | Name | Type |
72
72
  | :------ | :------ |
73
- | `TParams` | extends `Record`<`string`, `any`\> = `any` |
74
- | `TCookie` | extends `Record`<`string`, `string`\> = `any` |
75
- | `TSession` | extends `Record`<`string`, `string`\> = `any` |
73
+ | `TParams` | extends `Record`\<`string`, `any`\> = `any` |
74
+ | `TCookie` | extends `Record`\<`string`, `string`\> = `any` |
75
+ | `TSession` | extends `Record`\<`string`, `string`\> = `any` |
76
76
 
77
77
  #### Index signature
78
78
 
@@ -82,7 +82,7 @@ ___
82
82
 
83
83
  | Name | Type |
84
84
  | :------ | :------ |
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` } |
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
86
  | `config.cookie?` | [`CookieOptions`](#cookieoptions) |
87
87
  | `config.functionName?` | `string` |
88
88
  | `config.ignorePathPrefix?` | `string` |
@@ -90,7 +90,7 @@ ___
90
90
  | `config.path?` | `string` |
91
91
  | `config.timeout?` | `number` |
92
92
  | `name?` | `string` |
93
- | `validator?` | [`ValidatorConfig`](#validatorconfig)<`TParams`, `TCookie`, `TSession`\> |
93
+ | `validator?` | [`ValidatorConfig`](#validatorconfig)\<`TParams`, `TCookie`, `TSession`\> |
94
94
 
95
95
  ___
96
96
 
@@ -103,7 +103,7 @@ ___
103
103
  | Name | Type |
104
104
  | :------ | :------ |
105
105
  | `body?` | `string` |
106
- | `headers?` | { `[key: string]`: `string`; } |
106
+ | `headers?` | \{ `[key: string]`: `string`; } |
107
107
  | `message?` | `string` |
108
108
  | `statusCode?` | `number` |
109
109
 
@@ -130,43 +130,43 @@ ___
130
130
 
131
131
  ### ValidatorConfig
132
132
 
133
- Ƭ **ValidatorConfig**<`TParams`, `TCookie`, `TSession`\>: `Object`
133
+ Ƭ **ValidatorConfig**\<`TParams`, `TCookie`, `TSession`\>: `Object`
134
134
 
135
135
  #### Type parameters
136
136
 
137
137
  | Name | Type |
138
138
  | :------ | :------ |
139
- | `TParams` | extends `Record`<`string`, `any`\> = `any` |
140
- | `TCookie` | extends `Record`<`string`, `string`\> = `any` |
141
- | `TSession` | extends `Record`<`string`, `string`\> = `any` |
139
+ | `TParams` | extends `Record`\<`string`, `any`\> = `any` |
140
+ | `TCookie` | extends `Record`\<`string`, `string`\> = `any` |
141
+ | `TSession` | extends `Record`\<`string`, `string`\> = `any` |
142
142
 
143
143
  #### Type declaration
144
144
 
145
145
  | Name | Type |
146
146
  | :------ | :------ |
147
147
  | `before?` | `BeforeOption` |
148
- | `cookie?` | [`ValidatorOptions`](#validatoroptions)<`TCookie`\> |
149
- | `params?` | [`ValidatorOptions`](#validatoroptions)<`TParams`\> |
150
- | `session?` | [`ValidatorOptions`](#validatoroptions)<`TSession`\> |
148
+ | `cookie?` | [`ValidatorOptions`](#validatoroptions)\<`TCookie`\> |
149
+ | `params?` | [`ValidatorOptions`](#validatoroptions)\<`TParams`\> |
150
+ | `session?` | [`ValidatorOptions`](#validatoroptions)\<`TSession`\> |
151
151
 
152
152
  ___
153
153
 
154
154
  ### ValidatorOptions
155
155
 
156
- Ƭ **ValidatorOptions**<`Content`\>: `Object`
156
+ Ƭ **ValidatorOptions**\<`Content`\>: `Object`
157
157
 
158
158
  #### Type parameters
159
159
 
160
160
  | Name | Type |
161
161
  | :------ | :------ |
162
- | `Content` | `Record`<`string`, `any`\> |
162
+ | `Content` | `Record`\<`string`, `any`\> |
163
163
 
164
164
  #### Type declaration
165
165
 
166
166
  | Name | Type |
167
167
  | :------ | :------ |
168
- | `onError?` | (`type`: `string`, `key`: `string` \| `string`[], `value?`: `any`) => { `message`: `any` ; `statusCode?`: `number` } \| `void` |
169
- | `rules` | { [k in keyof Content]?: ValidatorRuleOptions } |
168
+ | `onError?` | (`type`: `string`, `key`: `string` \| `string`[], `value?`: `any`) => \{ `message`: `any` ; `statusCode?`: `number` } \| `void` |
169
+ | `rules` | \{ [k in keyof Content]?: ValidatorRuleOptions } |
170
170
  | `whitelist?` | ``"error"`` \| ``"ignore"`` |
171
171
 
172
172
  ___
@@ -179,7 +179,7 @@ ___
179
179
 
180
180
  | Name | Type |
181
181
  | :------ | :------ |
182
- | `config?` | `Partial`<[`ValidatorOptions`](#validatoroptions)\> |
182
+ | `config?` | `Partial`\<[`ValidatorOptions`](#validatoroptions)\> |
183
183
  | `default?` | `any` |
184
184
  | `in?` | `any`[] |
185
185
  | `regexp?` | `RegExp` |
@@ -200,22 +200,22 @@ ___
200
200
 
201
201
  ### useHttp
202
202
 
203
- ▸ **useHttp**<`TParams`, `TCookie`, `TSession`\>(`config?`): `UseifyPlugin`<[`Http`](classes/Http.md)<`TParams`, `TCookie`, `TSession`\>\>
203
+ ▸ **useHttp**\<`TParams`, `TCookie`, `TSession`\>(`config?`): `UseifyPlugin`\<[`Http`](classes/Http.md)\<`TParams`, `TCookie`, `TSession`\>\>
204
204
 
205
205
  #### Type parameters
206
206
 
207
207
  | Name | Type |
208
208
  | :------ | :------ |
209
- | `TParams` | extends `Record`<`string`, `any`\> = `any` |
210
- | `TCookie` | extends `Record`<`string`, `string`\> = `any` |
211
- | `TSession` | extends `Record`<`string`, `string`\> = `any` |
209
+ | `TParams` | extends `Record`\<`string`, `any`\> = `any` |
210
+ | `TCookie` | extends `Record`\<`string`, `string`\> = `any` |
211
+ | `TSession` | extends `Record`\<`string`, `string`\> = `any` |
212
212
 
213
213
  #### Parameters
214
214
 
215
215
  | Name | Type |
216
216
  | :------ | :------ |
217
- | `config?` | [`HttpConfig`](#httpconfig)<`TParams`, `TCookie`, `TSession`\> |
217
+ | `config?` | [`HttpConfig`](#httpconfig)\<`TParams`, `TCookie`, `TSession`\> |
218
218
 
219
219
  #### Returns
220
220
 
221
- `UseifyPlugin`<[`Http`](classes/Http.md)<`TParams`, `TCookie`, `TSession`\>\>
221
+ `UseifyPlugin`\<[`Http`](classes/Http.md)\<`TParams`, `TCookie`, `TSession`\>\>
package/dist/index.d.mts CHANGED
@@ -207,4 +207,4 @@ declare class Http<TParams extends Record<string, any> = any, TCookie extends Re
207
207
  }
208
208
  declare function useHttp<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any>(config?: HttpConfig<TParams, TCookie, TSession>): UseifyPlugin<Http<TParams, TCookie, TSession>>;
209
209
 
210
- export { ContentType, Cookie, CookieOptions, Http, HttpConfig, HttpError, Response, Session, SessionOptions, Validator, ValidatorConfig, ValidatorOptions, ValidatorRuleOptions, useHttp };
210
+ export { ContentType, Cookie, type CookieOptions, Http, type HttpConfig, HttpError, type Response, Session, type SessionOptions, Validator, type ValidatorConfig, type ValidatorOptions, type ValidatorRuleOptions, useHttp };
package/dist/index.d.ts CHANGED
@@ -207,4 +207,4 @@ declare class Http<TParams extends Record<string, any> = any, TCookie extends Re
207
207
  }
208
208
  declare function useHttp<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any>(config?: HttpConfig<TParams, TCookie, TSession>): UseifyPlugin<Http<TParams, TCookie, TSession>>;
209
209
 
210
- export { ContentType, Cookie, CookieOptions, Http, HttpConfig, HttpError, Response, Session, SessionOptions, Validator, ValidatorConfig, ValidatorOptions, ValidatorRuleOptions, useHttp };
210
+ export { ContentType, Cookie, type CookieOptions, Http, type HttpConfig, HttpError, type Response, Session, type SessionOptions, Validator, type ValidatorConfig, type ValidatorOptions, type ValidatorRuleOptions, useHttp };
package/dist/index.js CHANGED
@@ -82,9 +82,7 @@ var Session = class {
82
82
  if (signedParts[1] !== digest)
83
83
  throw Error("Session Not valid");
84
84
  const message = Buffer.from(signedParts[0], "base64").toString();
85
- const parts = message.split("--").map(function(part2) {
86
- return Buffer.from(part2, "base64");
87
- });
85
+ const parts = message.split("--").map((part2) => Buffer.from(part2, "base64"));
88
86
  const cipher = crypto.createDecipheriv(
89
87
  this.config.cipherName,
90
88
  this.secret,
@@ -180,8 +178,7 @@ var Cookie = class {
180
178
  headers() {
181
179
  if (Object.keys(this.setCookie).length === 0)
182
180
  return {};
183
- else
184
- return { "Set-Cookie": Object.values(this.setCookie) };
181
+ return { "Set-Cookie": Object.values(this.setCookie) };
185
182
  }
186
183
  };
187
184
 
@@ -246,7 +243,8 @@ var Validator = class {
246
243
  throw new HttpError(res);
247
244
  }
248
245
  throw error;
249
- } else if (config.whitelist === "ignore")
246
+ }
247
+ if (config.whitelist === "ignore")
250
248
  for (const key of diff)
251
249
  delete params[key];
252
250
  }
package/dist/index.mjs CHANGED
@@ -80,9 +80,7 @@ var Session = class {
80
80
  if (signedParts[1] !== digest)
81
81
  throw Error("Session Not valid");
82
82
  const message = Buffer.from(signedParts[0], "base64").toString();
83
- const parts = message.split("--").map(function(part2) {
84
- return Buffer.from(part2, "base64");
85
- });
83
+ const parts = message.split("--").map((part2) => Buffer.from(part2, "base64"));
86
84
  const cipher = createDecipheriv(
87
85
  this.config.cipherName,
88
86
  this.secret,
@@ -178,8 +176,7 @@ var Cookie = class {
178
176
  headers() {
179
177
  if (Object.keys(this.setCookie).length === 0)
180
178
  return {};
181
- else
182
- return { "Set-Cookie": Object.values(this.setCookie) };
179
+ return { "Set-Cookie": Object.values(this.setCookie) };
183
180
  }
184
181
  };
185
182
 
@@ -244,7 +241,8 @@ var Validator = class {
244
241
  throw new HttpError(res);
245
242
  }
246
243
  throw error;
247
- } else if (config.whitelist === "ignore")
244
+ }
245
+ if (config.whitelist === "ignore")
248
246
  for (const key of diff)
249
247
  delete params[key];
250
248
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/http",
3
- "version": "0.0.4-beta.9",
3
+ "version": "0.0.5-beta.2",
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": "0.0.4-beta.9",
26
- "@faasjs/logger": "0.0.4-beta.9"
25
+ "@faasjs/func": "0.0.5-beta.2",
26
+ "@faasjs/logger": "0.0.5-beta.2"
27
27
  },
28
28
  "devDependencies": {
29
- "@faasjs/func": "0.0.4-beta.9",
30
- "@faasjs/logger": "0.0.4-beta.9"
29
+ "@faasjs/func": "0.0.5-beta.2",
30
+ "@faasjs/logger": "0.0.5-beta.2"
31
31
  },
32
32
  "engines": {
33
33
  "npm": ">=9.0.0",