@nestia/fetcher 7.0.3 → 7.1.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/lib/AesPkcs5.d.ts +6 -6
- package/lib/AesPkcs5.js +6 -6
- package/lib/AesPkcs5.js.map +1 -1
- package/lib/IConnection.d.ts +58 -71
- package/package.json +2 -7
- package/src/AesPkcs5.ts +6 -7
- package/src/IConnection.ts +58 -72
package/lib/AesPkcs5.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Utility class for the AES-128/256 encryption.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* - AES-128/256
|
|
5
|
+
* - CBC mode
|
|
6
|
+
* - PKCS#5 Padding
|
|
7
|
+
* - Base64 Encoding
|
|
8
8
|
*
|
|
9
9
|
* @author Jeongho Nam - https://github.com/samchon
|
|
10
10
|
*/
|
|
@@ -15,7 +15,7 @@ export declare namespace AesPkcs5 {
|
|
|
15
15
|
* @param data Target data
|
|
16
16
|
* @param key Key value of the encryption.
|
|
17
17
|
* @param iv Initializer Vector for the encryption
|
|
18
|
-
* @
|
|
18
|
+
* @returns Encrypted data
|
|
19
19
|
*/
|
|
20
20
|
function encrypt(data: string, key: string, iv: string): string;
|
|
21
21
|
/**
|
|
@@ -24,7 +24,7 @@ export declare namespace AesPkcs5 {
|
|
|
24
24
|
* @param data Target data
|
|
25
25
|
* @param key Key value of the decryption.
|
|
26
26
|
* @param iv Initializer Vector for the decryption
|
|
27
|
-
* @
|
|
27
|
+
* @returns Decrypted data.
|
|
28
28
|
*/
|
|
29
29
|
function decrypt(data: string, key: string, iv: string): string;
|
|
30
30
|
}
|
package/lib/AesPkcs5.js
CHANGED
|
@@ -8,10 +8,10 @@ var crypto_1 = __importDefault(require("crypto"));
|
|
|
8
8
|
/**
|
|
9
9
|
* Utility class for the AES-128/256 encryption.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* - AES-128/256
|
|
12
|
+
* - CBC mode
|
|
13
|
+
* - PKCS#5 Padding
|
|
14
|
+
* - Base64 Encoding
|
|
15
15
|
*
|
|
16
16
|
* @author Jeongho Nam - https://github.com/samchon
|
|
17
17
|
*/
|
|
@@ -23,7 +23,7 @@ var AesPkcs5;
|
|
|
23
23
|
* @param data Target data
|
|
24
24
|
* @param key Key value of the encryption.
|
|
25
25
|
* @param iv Initializer Vector for the encryption
|
|
26
|
-
* @
|
|
26
|
+
* @returns Encrypted data
|
|
27
27
|
*/
|
|
28
28
|
function encrypt(data, key, iv) {
|
|
29
29
|
var bytes = key.length * 8;
|
|
@@ -37,7 +37,7 @@ var AesPkcs5;
|
|
|
37
37
|
* @param data Target data
|
|
38
38
|
* @param key Key value of the decryption.
|
|
39
39
|
* @param iv Initializer Vector for the decryption
|
|
40
|
-
* @
|
|
40
|
+
* @returns Decrypted data.
|
|
41
41
|
*/
|
|
42
42
|
function decrypt(data, key, iv) {
|
|
43
43
|
var bytes = key.length * 8;
|
package/lib/AesPkcs5.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AesPkcs5.js","sourceRoot":"","sources":["../src/AesPkcs5.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA4B;AAE5B;;;;;;;;;GASG;AACH,IAAiB,QAAQ,
|
|
1
|
+
{"version":3,"file":"AesPkcs5.js","sourceRoot":"","sources":["../src/AesPkcs5.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA4B;AAE5B;;;;;;;;;GASG;AACH,IAAiB,QAAQ,CAoCxB;AApCD,WAAiB,QAAQ;IACvB;;;;;;;OAOG;IACH,SAAgB,OAAO,CAAC,IAAY,EAAE,GAAW,EAAE,EAAU;QAC3D,IAAM,KAAK,GAAW,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QACrC,IAAM,MAAM,GAAkB,gBAAM,CAAC,cAAc,CACjD,cAAO,KAAK,SAAM,EAClB,GAAG,EACH,EAAE,CACH,CAAC;QACF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC;IARe,gBAAO,UAQtB,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,OAAO,CAAC,IAAY,EAAE,GAAW,EAAE,EAAU;QAC3D,IAAM,KAAK,GAAW,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QACrC,IAAM,QAAQ,GAAoB,gBAAM,CAAC,gBAAgB,CACvD,cAAO,KAAK,SAAM,EAClB,GAAG,EACH,EAAE,CACH,CAAC;QACF,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1E,CAAC;IARe,gBAAO,UAQtB,CAAA;AACH,CAAC,EApCgB,QAAQ,wBAAR,QAAQ,QAoCxB"}
|
package/lib/IConnection.d.ts
CHANGED
|
@@ -1,46 +1,41 @@
|
|
|
1
|
-
import { IRandomGenerator } from "typia";
|
|
2
1
|
import { IEncryptionPassword } from "./IEncryptionPassword";
|
|
3
2
|
import { IFetchEvent } from "./IFetchEvent";
|
|
4
3
|
/**
|
|
5
4
|
* Connection information.
|
|
6
5
|
*
|
|
7
|
-
* `IConnection` is an interface ttype who represents connection information of
|
|
8
|
-
* remote HTTP server. You can target the remote HTTP server by wring the
|
|
9
|
-
* {@link IConnection.host} variable down. Also, you can configure special header
|
|
10
|
-
* by specializing the {@link IConnection.headers} variable.
|
|
6
|
+
* `IConnection` is an interface ttype who represents connection information of
|
|
7
|
+
* the remote HTTP server. You can target the remote HTTP server by wring the
|
|
8
|
+
* {@link IConnection.host} variable down. Also, you can configure special header
|
|
9
|
+
* values by specializing the {@link IConnection.headers} variable.
|
|
11
10
|
*
|
|
12
|
-
* If the remote HTTP server encrypts or decrypts its body data through the
|
|
13
|
-
* algorithm, specify the {@link IConnection.encryption} with
|
|
14
|
-
* or {@link IEncryptionPassword.Closure} variable.
|
|
11
|
+
* If the remote HTTP server encrypts or decrypts its body data through the
|
|
12
|
+
* AES-128/256 algorithm, specify the {@link IConnection.encryption} with
|
|
13
|
+
* {@link IEncryptionPassword} or {@link IEncryptionPassword.Closure} variable.
|
|
15
14
|
*
|
|
16
15
|
* @author Jenogho Nam - https://github.com/samchon
|
|
17
16
|
* @author Seungjun We - https://github.com/SeungjunWe
|
|
18
17
|
*/
|
|
19
18
|
export interface IConnection<Headers extends object | undefined = object | undefined> {
|
|
20
|
-
/**
|
|
21
|
-
* Host address of the remote HTTP server.
|
|
22
|
-
*/
|
|
19
|
+
/** Host address of the remote HTTP server. */
|
|
23
20
|
host: string;
|
|
24
|
-
/**
|
|
25
|
-
* Header values delivered to the remote HTTP server.
|
|
26
|
-
*/
|
|
21
|
+
/** Header values delivered to the remote HTTP server. */
|
|
27
22
|
headers?: Record<string, IConnection.HeaderValue> & IConnection.Headerify<Headers>;
|
|
28
23
|
/**
|
|
29
24
|
* Use simulation mode.
|
|
30
25
|
*
|
|
31
|
-
* If you configure this property to be `true
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* request data validation.
|
|
26
|
+
* If you configure this property to be `true`, your SDK library does not send
|
|
27
|
+
* any request to remote backend server, but just returns random data
|
|
28
|
+
* generated by `typia.random<T>()` function with request data validation.
|
|
35
29
|
*
|
|
36
|
-
* By the way, to utilize this simulation mode, SDK library must be generated
|
|
37
|
-
* {@link INestiaConfig.simulate} option, too. Open `nestia.config.ts`
|
|
38
|
-
* configure {@link INestiaConfig.simulate} property to be `true`.
|
|
39
|
-
* generated SDK library would have a built-in mock-up data
|
|
30
|
+
* By the way, to utilize this simulation mode, SDK library must be generated
|
|
31
|
+
* with {@link INestiaConfig.simulate} option, too. Open `nestia.config.ts`
|
|
32
|
+
* file, and configure {@link INestiaConfig.simulate} property to be `true`.
|
|
33
|
+
* Them, newly generated SDK library would have a built-in mock-up data
|
|
34
|
+
* generator.
|
|
40
35
|
*
|
|
41
36
|
* @default false
|
|
42
37
|
*/
|
|
43
|
-
simulate?: boolean
|
|
38
|
+
simulate?: boolean;
|
|
44
39
|
/**
|
|
45
40
|
* Logger function.
|
|
46
41
|
*
|
|
@@ -57,20 +52,17 @@ export interface IConnection<Headers extends object | undefined = object | undef
|
|
|
57
52
|
* security reason.
|
|
58
53
|
*/
|
|
59
54
|
encryption?: IEncryptionPassword | IEncryptionPassword.Closure;
|
|
60
|
-
/**
|
|
61
|
-
* Additional options for the `fetch` function.
|
|
62
|
-
*/
|
|
55
|
+
/** Additional options for the `fetch` function. */
|
|
63
56
|
options?: IConnection.IOptions;
|
|
64
57
|
/**
|
|
65
58
|
* Custom fetch function.
|
|
66
59
|
*
|
|
67
|
-
* If you want to use custom `fetch` function instead of built-in,
|
|
68
|
-
*
|
|
60
|
+
* If you want to use custom `fetch` function instead of built-in, assign your
|
|
61
|
+
* custom `fetch` function into this property.
|
|
69
62
|
*
|
|
70
|
-
* For reference, the `fetch` function has started to be supported
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* into this property.
|
|
63
|
+
* For reference, the `fetch` function has started to be supported since
|
|
64
|
+
* version 20 of NodeJS. Therefore, if you are using NodeJS version 19 or
|
|
65
|
+
* lower, you have to assign the `node-fetch` module into this property.
|
|
74
66
|
*/
|
|
75
67
|
fetch?: typeof fetch;
|
|
76
68
|
}
|
|
@@ -78,12 +70,12 @@ export declare namespace IConnection {
|
|
|
78
70
|
/**
|
|
79
71
|
* Additional options for the `fetch` function.
|
|
80
72
|
*
|
|
81
|
-
* Almost same with {@link RequestInit} type of the {@link fetch} function,
|
|
82
|
-
*
|
|
73
|
+
* Almost same with {@link RequestInit} type of the {@link fetch} function, but
|
|
74
|
+
* `body`, `headers` and `method` properties are omitted.
|
|
83
75
|
*
|
|
84
|
-
* The reason why defining duplicated definition of {@link RequestInit}
|
|
85
|
-
*
|
|
86
|
-
*
|
|
76
|
+
* The reason why defining duplicated definition of {@link RequestInit} is for
|
|
77
|
+
* legacy NodeJS environments, which does not have the {@link fetch} function
|
|
78
|
+
* type.
|
|
87
79
|
*/
|
|
88
80
|
interface IOptions {
|
|
89
81
|
/**
|
|
@@ -103,9 +95,7 @@ export declare namespace IConnection {
|
|
|
103
95
|
* Sets request's integrity.
|
|
104
96
|
*/
|
|
105
97
|
integrity?: string;
|
|
106
|
-
/**
|
|
107
|
-
* A boolean to set request's keepalive.
|
|
108
|
-
*/
|
|
98
|
+
/** A boolean to set request's keepalive. */
|
|
109
99
|
keepalive?: boolean;
|
|
110
100
|
/**
|
|
111
101
|
* A string to indicate whether the request will use CORS, or will be
|
|
@@ -115,25 +105,21 @@ export declare namespace IConnection {
|
|
|
115
105
|
*/
|
|
116
106
|
mode?: "cors" | "navigate" | "no-cors" | "same-origin";
|
|
117
107
|
/**
|
|
118
|
-
* A string indicating whether request follows redirects, results in
|
|
119
|
-
*
|
|
120
|
-
*
|
|
108
|
+
* A string indicating whether request follows redirects, results in an
|
|
109
|
+
* error upon encountering a redirect, or returns the redirect (in an opaque
|
|
110
|
+
* fashion).
|
|
121
111
|
*
|
|
122
112
|
* Sets request's redirect.
|
|
123
113
|
*/
|
|
124
114
|
redirect?: "error" | "follow" | "manual";
|
|
125
115
|
/**
|
|
126
|
-
* A string whose value is a same-origin URL, "about:client", or the
|
|
127
|
-
*
|
|
116
|
+
* A string whose value is a same-origin URL, "about:client", or the empty
|
|
117
|
+
* string, to set request's referrer.
|
|
128
118
|
*/
|
|
129
119
|
referrer?: string;
|
|
130
|
-
/**
|
|
131
|
-
* A referrer policy to set request's referrerPolicy.
|
|
132
|
-
*/
|
|
120
|
+
/** A referrer policy to set request's referrerPolicy. */
|
|
133
121
|
referrerPolicy?: "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
|
134
|
-
/**
|
|
135
|
-
* An AbortSignal to set request's signal.
|
|
136
|
-
*/
|
|
122
|
+
/** An AbortSignal to set request's signal. */
|
|
137
123
|
signal?: AbortSignal | null;
|
|
138
124
|
}
|
|
139
125
|
/**
|
|
@@ -145,32 +131,33 @@ export declare namespace IConnection {
|
|
|
145
131
|
/**
|
|
146
132
|
* Type of headers
|
|
147
133
|
*
|
|
148
|
-
* `Headerify` removes every properties that are not allowed in the
|
|
149
|
-
*
|
|
134
|
+
* `Headerify` removes every properties that are not allowed in the HTTP
|
|
135
|
+
* headers type.
|
|
150
136
|
*
|
|
151
137
|
* Below are list of prohibited in HTTP headers.
|
|
152
138
|
*
|
|
153
139
|
* 1. Value type one of {@link HeaderValue}
|
|
154
140
|
* 2. Key is "set-cookie", but value is not an Array type
|
|
155
141
|
* 3. Key is one of them, but value is Array type
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
142
|
+
*
|
|
143
|
+
* - "age"
|
|
144
|
+
* - "authorization"
|
|
145
|
+
* - "content-length"
|
|
146
|
+
* - "content-type"
|
|
147
|
+
* - "etag"
|
|
148
|
+
* - "expires"
|
|
149
|
+
* - "from"
|
|
150
|
+
* - "host"
|
|
151
|
+
* - "if-modified-since"
|
|
152
|
+
* - "if-unmodified-since"
|
|
153
|
+
* - "last-modified"
|
|
154
|
+
* - "location"
|
|
155
|
+
* - "max-forwards"
|
|
156
|
+
* - "proxy-authorization"
|
|
157
|
+
* - "referer"
|
|
158
|
+
* - "retry-after"
|
|
159
|
+
* - "server"
|
|
160
|
+
* - "user-agent"
|
|
174
161
|
*/
|
|
175
162
|
type Headerify<T extends object | undefined> = {
|
|
176
163
|
[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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/fetcher",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Fetcher library of Nestia SDK",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -26,12 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://nestia.io",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@samchon/openapi": "^4.
|
|
30
|
-
"typia": "^9.3.1"
|
|
31
|
-
},
|
|
32
|
-
"peerDependencies": {
|
|
33
|
-
"@samchon/openapi": ">=4.3.3 <5.0.0",
|
|
34
|
-
"typia": ">=9.3.1 <10.0.0"
|
|
29
|
+
"@samchon/openapi": "^4.5.0"
|
|
35
30
|
},
|
|
36
31
|
"devDependencies": {
|
|
37
32
|
"@types/node": "^18.11.14",
|
package/src/AesPkcs5.ts
CHANGED
|
@@ -3,10 +3,10 @@ import crypto from "crypto";
|
|
|
3
3
|
/**
|
|
4
4
|
* Utility class for the AES-128/256 encryption.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* - AES-128/256
|
|
7
|
+
* - CBC mode
|
|
8
|
+
* - PKCS#5 Padding
|
|
9
|
+
* - Base64 Encoding
|
|
10
10
|
*
|
|
11
11
|
* @author Jeongho Nam - https://github.com/samchon
|
|
12
12
|
*/
|
|
@@ -17,7 +17,7 @@ export namespace AesPkcs5 {
|
|
|
17
17
|
* @param data Target data
|
|
18
18
|
* @param key Key value of the encryption.
|
|
19
19
|
* @param iv Initializer Vector for the encryption
|
|
20
|
-
* @
|
|
20
|
+
* @returns Encrypted data
|
|
21
21
|
*/
|
|
22
22
|
export function encrypt(data: string, key: string, iv: string): string {
|
|
23
23
|
const bytes: number = key.length * 8;
|
|
@@ -35,7 +35,7 @@ export namespace AesPkcs5 {
|
|
|
35
35
|
* @param data Target data
|
|
36
36
|
* @param key Key value of the decryption.
|
|
37
37
|
* @param iv Initializer Vector for the decryption
|
|
38
|
-
* @
|
|
38
|
+
* @returns Decrypted data.
|
|
39
39
|
*/
|
|
40
40
|
export function decrypt(data: string, key: string, iv: string): string {
|
|
41
41
|
const bytes: number = key.length * 8;
|
|
@@ -44,7 +44,6 @@ export namespace AesPkcs5 {
|
|
|
44
44
|
key,
|
|
45
45
|
iv,
|
|
46
46
|
);
|
|
47
|
-
|
|
48
47
|
return decipher.update(data, "base64", "utf8") + decipher.final("utf8");
|
|
49
48
|
}
|
|
50
49
|
}
|
package/src/IConnection.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
|
-
import { IRandomGenerator } from "typia";
|
|
3
|
-
|
|
4
2
|
import { IEncryptionPassword } from "./IEncryptionPassword";
|
|
5
3
|
import { IFetchEvent } from "./IFetchEvent";
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* Connection information.
|
|
9
7
|
*
|
|
10
|
-
* `IConnection` is an interface ttype who represents connection information of
|
|
11
|
-
* remote HTTP server. You can target the remote HTTP server by wring the
|
|
12
|
-
* {@link IConnection.host} variable down. Also, you can configure special header
|
|
13
|
-
* by specializing the {@link IConnection.headers} variable.
|
|
8
|
+
* `IConnection` is an interface ttype who represents connection information of
|
|
9
|
+
* the remote HTTP server. You can target the remote HTTP server by wring the
|
|
10
|
+
* {@link IConnection.host} variable down. Also, you can configure special header
|
|
11
|
+
* values by specializing the {@link IConnection.headers} variable.
|
|
14
12
|
*
|
|
15
|
-
* If the remote HTTP server encrypts or decrypts its body data through the
|
|
16
|
-
* algorithm, specify the {@link IConnection.encryption} with
|
|
17
|
-
* or {@link IEncryptionPassword.Closure} variable.
|
|
13
|
+
* If the remote HTTP server encrypts or decrypts its body data through the
|
|
14
|
+
* AES-128/256 algorithm, specify the {@link IConnection.encryption} with
|
|
15
|
+
* {@link IEncryptionPassword} or {@link IEncryptionPassword.Closure} variable.
|
|
18
16
|
*
|
|
19
17
|
* @author Jenogho Nam - https://github.com/samchon
|
|
20
18
|
* @author Seungjun We - https://github.com/SeungjunWe
|
|
@@ -22,33 +20,29 @@ import { IFetchEvent } from "./IFetchEvent";
|
|
|
22
20
|
export interface IConnection<
|
|
23
21
|
Headers extends object | undefined = object | undefined,
|
|
24
22
|
> {
|
|
25
|
-
/**
|
|
26
|
-
* Host address of the remote HTTP server.
|
|
27
|
-
*/
|
|
23
|
+
/** Host address of the remote HTTP server. */
|
|
28
24
|
host: string;
|
|
29
25
|
|
|
30
|
-
/**
|
|
31
|
-
* Header values delivered to the remote HTTP server.
|
|
32
|
-
*/
|
|
26
|
+
/** Header values delivered to the remote HTTP server. */
|
|
33
27
|
headers?: Record<string, IConnection.HeaderValue> &
|
|
34
28
|
IConnection.Headerify<Headers>;
|
|
35
29
|
|
|
36
30
|
/**
|
|
37
31
|
* Use simulation mode.
|
|
38
32
|
*
|
|
39
|
-
* If you configure this property to be `true
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* request data validation.
|
|
33
|
+
* If you configure this property to be `true`, your SDK library does not send
|
|
34
|
+
* any request to remote backend server, but just returns random data
|
|
35
|
+
* generated by `typia.random<T>()` function with request data validation.
|
|
43
36
|
*
|
|
44
|
-
* By the way, to utilize this simulation mode, SDK library must be generated
|
|
45
|
-
* {@link INestiaConfig.simulate} option, too. Open `nestia.config.ts`
|
|
46
|
-
* configure {@link INestiaConfig.simulate} property to be `true`.
|
|
47
|
-
* generated SDK library would have a built-in mock-up data
|
|
37
|
+
* By the way, to utilize this simulation mode, SDK library must be generated
|
|
38
|
+
* with {@link INestiaConfig.simulate} option, too. Open `nestia.config.ts`
|
|
39
|
+
* file, and configure {@link INestiaConfig.simulate} property to be `true`.
|
|
40
|
+
* Them, newly generated SDK library would have a built-in mock-up data
|
|
41
|
+
* generator.
|
|
48
42
|
*
|
|
49
43
|
* @default false
|
|
50
44
|
*/
|
|
51
|
-
simulate?: boolean
|
|
45
|
+
simulate?: boolean;
|
|
52
46
|
|
|
53
47
|
/**
|
|
54
48
|
* Logger function.
|
|
@@ -68,21 +62,18 @@ export interface IConnection<
|
|
|
68
62
|
*/
|
|
69
63
|
encryption?: IEncryptionPassword | IEncryptionPassword.Closure;
|
|
70
64
|
|
|
71
|
-
/**
|
|
72
|
-
* Additional options for the `fetch` function.
|
|
73
|
-
*/
|
|
65
|
+
/** Additional options for the `fetch` function. */
|
|
74
66
|
options?: IConnection.IOptions;
|
|
75
67
|
|
|
76
68
|
/**
|
|
77
69
|
* Custom fetch function.
|
|
78
70
|
*
|
|
79
|
-
* If you want to use custom `fetch` function instead of built-in,
|
|
80
|
-
*
|
|
71
|
+
* If you want to use custom `fetch` function instead of built-in, assign your
|
|
72
|
+
* custom `fetch` function into this property.
|
|
81
73
|
*
|
|
82
|
-
* For reference, the `fetch` function has started to be supported
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* into this property.
|
|
74
|
+
* For reference, the `fetch` function has started to be supported since
|
|
75
|
+
* version 20 of NodeJS. Therefore, if you are using NodeJS version 19 or
|
|
76
|
+
* lower, you have to assign the `node-fetch` module into this property.
|
|
86
77
|
*/
|
|
87
78
|
fetch?: typeof fetch;
|
|
88
79
|
}
|
|
@@ -90,12 +81,12 @@ export namespace IConnection {
|
|
|
90
81
|
/**
|
|
91
82
|
* Additional options for the `fetch` function.
|
|
92
83
|
*
|
|
93
|
-
* Almost same with {@link RequestInit} type of the {@link fetch} function,
|
|
94
|
-
*
|
|
84
|
+
* Almost same with {@link RequestInit} type of the {@link fetch} function, but
|
|
85
|
+
* `body`, `headers` and `method` properties are omitted.
|
|
95
86
|
*
|
|
96
|
-
* The reason why defining duplicated definition of {@link RequestInit}
|
|
97
|
-
*
|
|
98
|
-
*
|
|
87
|
+
* The reason why defining duplicated definition of {@link RequestInit} is for
|
|
88
|
+
* legacy NodeJS environments, which does not have the {@link fetch} function
|
|
89
|
+
* type.
|
|
99
90
|
*/
|
|
100
91
|
export interface IOptions {
|
|
101
92
|
/**
|
|
@@ -124,9 +115,7 @@ export namespace IConnection {
|
|
|
124
115
|
*/
|
|
125
116
|
integrity?: string;
|
|
126
117
|
|
|
127
|
-
/**
|
|
128
|
-
* A boolean to set request's keepalive.
|
|
129
|
-
*/
|
|
118
|
+
/** A boolean to set request's keepalive. */
|
|
130
119
|
keepalive?: boolean;
|
|
131
120
|
|
|
132
121
|
/**
|
|
@@ -138,23 +127,21 @@ export namespace IConnection {
|
|
|
138
127
|
mode?: "cors" | "navigate" | "no-cors" | "same-origin";
|
|
139
128
|
|
|
140
129
|
/**
|
|
141
|
-
* A string indicating whether request follows redirects, results in
|
|
142
|
-
*
|
|
143
|
-
*
|
|
130
|
+
* A string indicating whether request follows redirects, results in an
|
|
131
|
+
* error upon encountering a redirect, or returns the redirect (in an opaque
|
|
132
|
+
* fashion).
|
|
144
133
|
*
|
|
145
134
|
* Sets request's redirect.
|
|
146
135
|
*/
|
|
147
136
|
redirect?: "error" | "follow" | "manual";
|
|
148
137
|
|
|
149
138
|
/**
|
|
150
|
-
* A string whose value is a same-origin URL, "about:client", or the
|
|
151
|
-
*
|
|
139
|
+
* A string whose value is a same-origin URL, "about:client", or the empty
|
|
140
|
+
* string, to set request's referrer.
|
|
152
141
|
*/
|
|
153
142
|
referrer?: string;
|
|
154
143
|
|
|
155
|
-
/**
|
|
156
|
-
* A referrer policy to set request's referrerPolicy.
|
|
157
|
-
*/
|
|
144
|
+
/** A referrer policy to set request's referrerPolicy. */
|
|
158
145
|
referrerPolicy?:
|
|
159
146
|
| ""
|
|
160
147
|
| "no-referrer"
|
|
@@ -166,9 +153,7 @@ export namespace IConnection {
|
|
|
166
153
|
| "strict-origin-when-cross-origin"
|
|
167
154
|
| "unsafe-url";
|
|
168
155
|
|
|
169
|
-
/**
|
|
170
|
-
* An AbortSignal to set request's signal.
|
|
171
|
-
*/
|
|
156
|
+
/** An AbortSignal to set request's signal. */
|
|
172
157
|
signal?: AbortSignal | null;
|
|
173
158
|
}
|
|
174
159
|
|
|
@@ -192,32 +177,33 @@ export namespace IConnection {
|
|
|
192
177
|
/**
|
|
193
178
|
* Type of headers
|
|
194
179
|
*
|
|
195
|
-
* `Headerify` removes every properties that are not allowed in the
|
|
196
|
-
*
|
|
180
|
+
* `Headerify` removes every properties that are not allowed in the HTTP
|
|
181
|
+
* headers type.
|
|
197
182
|
*
|
|
198
183
|
* Below are list of prohibited in HTTP headers.
|
|
199
184
|
*
|
|
200
185
|
* 1. Value type one of {@link HeaderValue}
|
|
201
186
|
* 2. Key is "set-cookie", but value is not an Array type
|
|
202
187
|
* 3. Key is one of them, but value is Array type
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
188
|
+
*
|
|
189
|
+
* - "age"
|
|
190
|
+
* - "authorization"
|
|
191
|
+
* - "content-length"
|
|
192
|
+
* - "content-type"
|
|
193
|
+
* - "etag"
|
|
194
|
+
* - "expires"
|
|
195
|
+
* - "from"
|
|
196
|
+
* - "host"
|
|
197
|
+
* - "if-modified-since"
|
|
198
|
+
* - "if-unmodified-since"
|
|
199
|
+
* - "last-modified"
|
|
200
|
+
* - "location"
|
|
201
|
+
* - "max-forwards"
|
|
202
|
+
* - "proxy-authorization"
|
|
203
|
+
* - "referer"
|
|
204
|
+
* - "retry-after"
|
|
205
|
+
* - "server"
|
|
206
|
+
* - "user-agent"
|
|
221
207
|
*/
|
|
222
208
|
export type Headerify<T extends object | undefined> = {
|
|
223
209
|
[P in keyof T]?: T[P] extends HeaderValue | undefined
|