@nestia/fetcher 1.3.0 → 1.3.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.
@@ -1,11 +1,12 @@
1
1
  import { IEncryptionPassword } from "./IEncryptionPassword";
2
+ import { IRandomGenerator } from "./IRandomGenerator";
2
3
  /**
3
4
  * Connection information.
4
5
  *
5
- * `IConnection` is a type of interface who represents connection information of the remote
6
- * HTTP server. You can target the remote HTTP server by wring the {@link IConnection.host}
7
- * variable down. Also, you can configure special header values by specializing the
8
- * {@link IConnection.headers} variable.
6
+ * `IConnection` is an interface ttype who represents connection information of the
7
+ * 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 values
9
+ * by specializing the {@link IConnection.headers} variable.
9
10
  *
10
11
  * If the remote HTTP server encrypts or decrypts its body data through the AES-128/256
11
12
  * algorithm, specify the {@link IConnection.encryption} with {@link IEncryptionPassword}
@@ -18,21 +19,6 @@ export interface IConnection {
18
19
  * Host address of the remote HTTP server.
19
20
  */
20
21
  host: string;
21
- /**
22
- * Use `typia.random<T>()` function instead.
23
- *
24
- * If you configure this property to be `true`, your SDK library does not send
25
- * any request to remote backend server, but just returns a random data generated
26
- * by `typia.random<T>()` function.
27
- *
28
- * By the way, to utilize this random property, SDK library must be generated with
29
- * `random` option, too. Open `nestia.config.ts` file, and configure `random: true`
30
- * property in the top level. Then newly generated SDK library would have a
31
- * built-in random generator.
32
- *
33
- * @default false
34
- */
35
- random?: boolean;
36
22
  /**
37
23
  * Header values delivered to the remote HTTP server.
38
24
  */
@@ -41,4 +27,28 @@ export interface IConnection {
41
27
  * Encryption password of its closure function.
42
28
  */
43
29
  encryption?: IEncryptionPassword | IEncryptionPassword.Closure;
30
+ /**
31
+ * Use simulation mode.
32
+ *
33
+ * If you configure this property to be `true` or assign an {@link IRandomGenerator}
34
+ * instance, your SDK library does not send any request to remote backend server,
35
+ * but just returns random data generated by `typia.random<T>()` function with
36
+ * request data validation.
37
+ *
38
+ * By the way, to utilize this simulation mode, SDK library must be generated with
39
+ * {@link INestiaConfig.simulate} option, too. Open `nestia.config.ts` file, and
40
+ * configure {@link INestiaConfig.simulate} property to be `true`. Them, newly
41
+ * generated SDK library would have a built-in mock-up data generator.
42
+ *
43
+ * @default false
44
+ */
45
+ simulate?: boolean | Partial<IRandomGenerator>;
46
+ /**
47
+ * Use simulation mode.
48
+ *
49
+ * @default false
50
+ * @deprecated Use {@link simulate} property instead.
51
+ * This property would be erased after v2.0 update
52
+ */
53
+ random?: boolean | Partial<IRandomGenerator>;
44
54
  }
@@ -0,0 +1,32 @@
1
+ export interface IRandomGenerator {
2
+ boolean(): boolean;
3
+ integer(minimum?: number, maximum?: number): number;
4
+ number(minimum?: number, maximum?: number): number;
5
+ bigint(minimum?: bigint, maximum?: bigint): bigint;
6
+ string(length?: number): string;
7
+ array<T>(closure: (index: number) => T, count?: number): T[];
8
+ length(): number;
9
+ uuid(): string;
10
+ email(): string;
11
+ url(): string;
12
+ ipv4(): string;
13
+ ipv6(): string;
14
+ pattern(regex: RegExp): string;
15
+ date(minimum?: number, maximum?: number): string;
16
+ datetime(minimum?: number, maximum?: number): string;
17
+ customs?: IRandomGenerator.CustomMap;
18
+ }
19
+ export declare namespace IRandomGenerator {
20
+ type CustomMap = {
21
+ [Type in keyof Customizable]?: (tags: ICommentTag[]) => Customizable[Type] | undefined;
22
+ };
23
+ type Customizable = {
24
+ number: number;
25
+ string: string;
26
+ bigint: bigint;
27
+ };
28
+ interface ICommentTag {
29
+ name: string;
30
+ value?: string;
31
+ }
32
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IRandomGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRandomGenerator.js","sourceRoot":"","sources":["../src/IRandomGenerator.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestia/fetcher",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Fetcher library of Nestia SDK",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -1,12 +1,13 @@
1
1
  import { IEncryptionPassword } from "./IEncryptionPassword";
2
+ import { IRandomGenerator } from "./IRandomGenerator";
2
3
 
3
4
  /**
4
5
  * Connection information.
5
6
  *
6
- * `IConnection` is a type of interface who represents connection information of the remote
7
- * HTTP server. You can target the remote HTTP server by wring the {@link IConnection.host}
8
- * variable down. Also, you can configure special header values by specializing the
9
- * {@link IConnection.headers} variable.
7
+ * `IConnection` is an interface ttype who represents connection information of the
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 values
10
+ * by specializing the {@link IConnection.headers} variable.
10
11
  *
11
12
  * If the remote HTTP server encrypts or decrypts its body data through the AES-128/256
12
13
  * algorithm, specify the {@link IConnection.encryption} with {@link IEncryptionPassword}
@@ -20,22 +21,6 @@ export interface IConnection {
20
21
  */
21
22
  host: string;
22
23
 
23
- /**
24
- * Use `typia.random<T>()` function instead.
25
- *
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 a random data generated
28
- * by `typia.random<T>()` function.
29
- *
30
- * By the way, to utilize this random property, SDK library must be generated with
31
- * `random` option, too. Open `nestia.config.ts` file, and configure `random: true`
32
- * property in the top level. Then newly generated SDK library would have a
33
- * built-in random generator.
34
- *
35
- * @default false
36
- */
37
- random?: boolean;
38
-
39
24
  /**
40
25
  * Header values delivered to the remote HTTP server.
41
26
  */
@@ -45,4 +30,30 @@ export interface IConnection {
45
30
  * Encryption password of its closure function.
46
31
  */
47
32
  encryption?: IEncryptionPassword | IEncryptionPassword.Closure;
33
+
34
+ /**
35
+ * Use simulation mode.
36
+ *
37
+ * If you configure this property to be `true` or assign an {@link IRandomGenerator}
38
+ * instance, your SDK library does not send any request to remote backend server,
39
+ * but just returns random data generated by `typia.random<T>()` function with
40
+ * request data validation.
41
+ *
42
+ * By the way, to utilize this simulation mode, SDK library must be generated with
43
+ * {@link INestiaConfig.simulate} option, too. Open `nestia.config.ts` file, and
44
+ * configure {@link INestiaConfig.simulate} property to be `true`. Them, newly
45
+ * generated SDK library would have a built-in mock-up data generator.
46
+ *
47
+ * @default false
48
+ */
49
+ simulate?: boolean | Partial<IRandomGenerator>;
50
+
51
+ /**
52
+ * Use simulation mode.
53
+ *
54
+ * @default false
55
+ * @deprecated Use {@link simulate} property instead.
56
+ * This property would be erased after v2.0 update
57
+ */
58
+ random?: boolean | Partial<IRandomGenerator>;
48
59
  }
@@ -0,0 +1,38 @@
1
+ export interface IRandomGenerator {
2
+ boolean(): boolean;
3
+ integer(minimum?: number, maximum?: number): number;
4
+ number(minimum?: number, maximum?: number): number;
5
+ bigint(minimum?: bigint, maximum?: bigint): bigint;
6
+ string(length?: number): string;
7
+ array<T>(closure: (index: number) => T, count?: number): T[];
8
+ length(): number;
9
+
10
+ uuid(): string;
11
+ email(): string;
12
+ url(): string;
13
+ ipv4(): string;
14
+ ipv6(): string;
15
+ pattern(regex: RegExp): string;
16
+ date(minimum?: number, maximum?: number): string;
17
+ datetime(minimum?: number, maximum?: number): string;
18
+
19
+ customs?: IRandomGenerator.CustomMap;
20
+ }
21
+ export namespace IRandomGenerator {
22
+ export type CustomMap = {
23
+ [Type in keyof Customizable]?: (
24
+ tags: ICommentTag[],
25
+ ) => Customizable[Type] | undefined;
26
+ };
27
+
28
+ export type Customizable = {
29
+ number: number;
30
+ string: string;
31
+ bigint: bigint;
32
+ }
33
+
34
+ export interface ICommentTag {
35
+ name: string;
36
+ value?: string;
37
+ }
38
+ }