@nestia/fetcher 1.5.0 → 1.5.1
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/lib/IConnection.d.ts +36 -1
- package/lib/IEncryptionPassword.d.ts +1 -1
- package/package.json +2 -2
- package/src/IConnection.ts +64 -1
- package/src/IEncryptionPassword.ts +1 -1
package/lib/IConnection.d.ts
CHANGED
|
@@ -107,8 +107,43 @@ export declare namespace IConnection {
|
|
|
107
107
|
*/
|
|
108
108
|
referrerPolicy?: "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
|
109
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Type of allowed header values.
|
|
112
|
+
*
|
|
113
|
+
* Only atomic or array of atomic values are allowed.
|
|
114
|
+
*/
|
|
110
115
|
type HeaderValue = string | boolean | number | bigint | string | Array<boolean> | Array<number> | Array<bigint> | Array<number> | Array<string>;
|
|
116
|
+
/**
|
|
117
|
+
* Type of headers
|
|
118
|
+
*
|
|
119
|
+
* `Headerify` removes every properties that are not allowed in the
|
|
120
|
+
* HTTP headers type.
|
|
121
|
+
*
|
|
122
|
+
* Below are list of prohibited in HTTP headers.
|
|
123
|
+
*
|
|
124
|
+
* 1. Value type one of {@link HeaderValue}
|
|
125
|
+
* 2. Key is "set-cookie", but value is not an Array type
|
|
126
|
+
* 3. Key is one of them, but value is Array type
|
|
127
|
+
* - "age"
|
|
128
|
+
* - "authorization"
|
|
129
|
+
* - "content-length"
|
|
130
|
+
* - "content-type"
|
|
131
|
+
* - "etag"
|
|
132
|
+
* - "expires"
|
|
133
|
+
* - "from"
|
|
134
|
+
* - "host"
|
|
135
|
+
* - "if-modified-since"
|
|
136
|
+
* - "if-unmodified-since"
|
|
137
|
+
* - "last-modified"
|
|
138
|
+
* - "location"
|
|
139
|
+
* - "max-forwards"
|
|
140
|
+
* - "proxy-authorization"
|
|
141
|
+
* - "referer"
|
|
142
|
+
* - "retry-after"
|
|
143
|
+
* - "server"
|
|
144
|
+
* - "user-agent"
|
|
145
|
+
*/
|
|
111
146
|
type Headerify<T extends object> = {
|
|
112
|
-
[P in keyof T]?: T[P] extends HeaderValue | undefined ? T[P] | undefined : never;
|
|
147
|
+
[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;
|
|
113
148
|
};
|
|
114
149
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/fetcher",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Fetcher library of Nestia SDK",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"typescript": "^5.1.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"typescript": ">= 4.
|
|
38
|
+
"typescript": ">= 4.8.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"import2": "^1.0.3",
|
package/src/IConnection.ts
CHANGED
|
@@ -136,6 +136,11 @@ export namespace IConnection {
|
|
|
136
136
|
| "unsafe-url";
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Type of allowed header values.
|
|
141
|
+
*
|
|
142
|
+
* Only atomic or array of atomic values are allowed.
|
|
143
|
+
*/
|
|
139
144
|
export type HeaderValue =
|
|
140
145
|
| string
|
|
141
146
|
| boolean
|
|
@@ -148,9 +153,67 @@ export namespace IConnection {
|
|
|
148
153
|
| Array<number>
|
|
149
154
|
| Array<string>;
|
|
150
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Type of headers
|
|
158
|
+
*
|
|
159
|
+
* `Headerify` removes every properties that are not allowed in the
|
|
160
|
+
* HTTP headers type.
|
|
161
|
+
*
|
|
162
|
+
* Below are list of prohibited in HTTP headers.
|
|
163
|
+
*
|
|
164
|
+
* 1. Value type one of {@link HeaderValue}
|
|
165
|
+
* 2. Key is "set-cookie", but value is not an Array type
|
|
166
|
+
* 3. Key is one of them, but value is Array type
|
|
167
|
+
* - "age"
|
|
168
|
+
* - "authorization"
|
|
169
|
+
* - "content-length"
|
|
170
|
+
* - "content-type"
|
|
171
|
+
* - "etag"
|
|
172
|
+
* - "expires"
|
|
173
|
+
* - "from"
|
|
174
|
+
* - "host"
|
|
175
|
+
* - "if-modified-since"
|
|
176
|
+
* - "if-unmodified-since"
|
|
177
|
+
* - "last-modified"
|
|
178
|
+
* - "location"
|
|
179
|
+
* - "max-forwards"
|
|
180
|
+
* - "proxy-authorization"
|
|
181
|
+
* - "referer"
|
|
182
|
+
* - "retry-after"
|
|
183
|
+
* - "server"
|
|
184
|
+
* - "user-agent"
|
|
185
|
+
*/
|
|
151
186
|
export type Headerify<T extends object> = {
|
|
152
187
|
[P in keyof T]?: T[P] extends HeaderValue | undefined
|
|
153
|
-
?
|
|
188
|
+
? P extends string
|
|
189
|
+
? Lowercase<P> extends "set-cookie"
|
|
190
|
+
? T[P] extends Array<HeaderValue>
|
|
191
|
+
? T[P] | undefined
|
|
192
|
+
: never
|
|
193
|
+
: Lowercase<P> extends
|
|
194
|
+
| "age"
|
|
195
|
+
| "authorization"
|
|
196
|
+
| "content-length"
|
|
197
|
+
| "content-type"
|
|
198
|
+
| "etag"
|
|
199
|
+
| "expires"
|
|
200
|
+
| "from"
|
|
201
|
+
| "host"
|
|
202
|
+
| "if-modified-since"
|
|
203
|
+
| "if-unmodified-since"
|
|
204
|
+
| "last-modified"
|
|
205
|
+
| "location"
|
|
206
|
+
| "max-forwards"
|
|
207
|
+
| "proxy-authorization"
|
|
208
|
+
| "referer"
|
|
209
|
+
| "retry-after"
|
|
210
|
+
| "server"
|
|
211
|
+
| "user-agent"
|
|
212
|
+
? T[P] extends Array<HeaderValue>
|
|
213
|
+
? never
|
|
214
|
+
: T[P] | undefined
|
|
215
|
+
: T[P] | undefined
|
|
216
|
+
: never
|
|
154
217
|
: never;
|
|
155
218
|
};
|
|
156
219
|
}
|