@nestia/fetcher
Advanced tools
Comparing version 1.5.0 to 1.5.1-dev.20230802
@@ -110,6 +110,41 @@ import { IEncryptionPassword } from "./IEncryptionPassword"; | ||
} | ||
/** | ||
* Type of allowed header values. | ||
* | ||
* Only atomic or array of atomic values are allowed. | ||
*/ | ||
type HeaderValue = string | boolean | number | bigint | string | Array<boolean> | Array<number> | Array<bigint> | Array<number> | Array<string>; | ||
/** | ||
* Type of headers | ||
* | ||
* `Headerify` removes every properties that are not allowed in the | ||
* HTTP headers type. | ||
* | ||
* Below are list of prohibited in HTTP headers. | ||
* | ||
* 1. Value type one of {@link HeaderValue} | ||
* 2. Key is "set-cookie", but value is not an Array type | ||
* 3. Key is one of them, but value is Array type | ||
* - "age" | ||
* - "authorization" | ||
* - "content-length" | ||
* - "content-type" | ||
* - "etag" | ||
* - "expires" | ||
* - "from" | ||
* - "host" | ||
* - "if-modified-since" | ||
* - "if-unmodified-since" | ||
* - "last-modified" | ||
* - "location" | ||
* - "max-forwards" | ||
* - "proxy-authorization" | ||
* - "referer" | ||
* - "retry-after" | ||
* - "server" | ||
* - "user-agent" | ||
*/ | ||
type Headerify<T extends object> = { | ||
[P in keyof T]?: T[P] extends HeaderValue | undefined ? T[P] | undefined : never; | ||
[P in keyof T]?: T[P] extends HeaderValue | undefined ? P extends string ? Lowercase<P> extends "set-cookie" ? T[P] extends Array<HeaderValue> ? T[P] | undefined : never : Lowercase<P> extends "age" | "authorization" | "content-length" | "content-type" | "etag" | "expires" | "from" | "host" | "if-modified-since" | "if-unmodified-since" | "last-modified" | "location" | "max-forwards" | "proxy-authorization" | "referer" | "retry-after" | "server" | "user-agent" ? T[P] extends Array<HeaderValue> ? never : T[P] | undefined : T[P] | undefined : never : never; | ||
}; | ||
} |
@@ -17,3 +17,3 @@ /** | ||
/** | ||
* Initialization vector. | ||
* Initialization Vector. | ||
*/ | ||
@@ -20,0 +20,0 @@ iv: string; |
{ | ||
"name": "@nestia/fetcher", | ||
"version": "1.5.0", | ||
"version": "1.5.1-dev.20230802", | ||
"description": "Fetcher library of Nestia SDK", | ||
@@ -38,3 +38,3 @@ "main": "lib/index.js", | ||
"peerDependencies": { | ||
"typescript": ">= 4.7.4" | ||
"typescript": ">= 4.8.0" | ||
}, | ||
@@ -41,0 +41,0 @@ "dependencies": { |
@@ -139,2 +139,7 @@ import { IEncryptionPassword } from "./IEncryptionPassword"; | ||
/** | ||
* Type of allowed header values. | ||
* | ||
* Only atomic or array of atomic values are allowed. | ||
*/ | ||
export type HeaderValue = | ||
@@ -152,7 +157,65 @@ | string | ||
/** | ||
* Type of headers | ||
* | ||
* `Headerify` removes every properties that are not allowed in the | ||
* HTTP headers type. | ||
* | ||
* Below are list of prohibited in HTTP headers. | ||
* | ||
* 1. Value type one of {@link HeaderValue} | ||
* 2. Key is "set-cookie", but value is not an Array type | ||
* 3. Key is one of them, but value is Array type | ||
* - "age" | ||
* - "authorization" | ||
* - "content-length" | ||
* - "content-type" | ||
* - "etag" | ||
* - "expires" | ||
* - "from" | ||
* - "host" | ||
* - "if-modified-since" | ||
* - "if-unmodified-since" | ||
* - "last-modified" | ||
* - "location" | ||
* - "max-forwards" | ||
* - "proxy-authorization" | ||
* - "referer" | ||
* - "retry-after" | ||
* - "server" | ||
* - "user-agent" | ||
*/ | ||
export type Headerify<T extends object> = { | ||
[P in keyof T]?: T[P] extends HeaderValue | undefined | ||
? T[P] | undefined | ||
? P extends string | ||
? Lowercase<P> extends "set-cookie" | ||
? T[P] extends Array<HeaderValue> | ||
? T[P] | undefined | ||
: never | ||
: Lowercase<P> extends | ||
| "age" | ||
| "authorization" | ||
| "content-length" | ||
| "content-type" | ||
| "etag" | ||
| "expires" | ||
| "from" | ||
| "host" | ||
| "if-modified-since" | ||
| "if-unmodified-since" | ||
| "last-modified" | ||
| "location" | ||
| "max-forwards" | ||
| "proxy-authorization" | ||
| "referer" | ||
| "retry-after" | ||
| "server" | ||
| "user-agent" | ||
? T[P] extends Array<HeaderValue> | ||
? never | ||
: T[P] | undefined | ||
: T[P] | undefined | ||
: never | ||
: never; | ||
}; | ||
} |
@@ -18,3 +18,3 @@ /** | ||
/** | ||
* Initialization vector. | ||
* Initialization Vector. | ||
*/ | ||
@@ -21,0 +21,0 @@ iv: string; |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
78596
1653
1