@nestia/e2e 8.0.0-dev.20250829-2 → 8.0.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.
Files changed (4) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +93 -93
  3. package/package.json +1 -1
  4. package/src/MapUtil.ts +86 -86
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Jeongho Nam
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Jeongho Nam
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,93 +1,93 @@
1
- # Nestia
2
- ![Nestia Logo](https://nestia.io/logo.png)
3
-
4
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
5
- [![npm version](https://img.shields.io/npm/v/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
6
- [![Downloads](https://img.shields.io/npm/dm/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
7
- [![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
8
- [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://nestia.io/docs/)
9
- [![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/nestia)
10
- [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
11
-
12
- Nestia is a set of helper libraries for NestJS, supporting below features:
13
-
14
- - `@nestia/core`:
15
- - Super-fast/easy decorators
16
- - Advanced WebSocket routes
17
- - `@nestia/sdk`:
18
- - Swagger generator, more evolved than ever
19
- - SDK library generator for clients
20
- - Mockup Simulator for client applications
21
- - Automatic E2E test functions generator
22
- - `@nestia/e2e`: Test program utilizing e2e test functions
23
- - `@nestia/benchmark`: Benchmark program using e2e test functions
24
- - `@nestia/editor`: Swagger-UI with Online TypeScript Editor
25
- - [`@agentica`](https://github.com/wrtnlabs/agentica): Agentic AI library specialized in LLM function calling
26
- - [`@autobe`](https://github.com/wrtnlabs/autobe): Vibe coding agent generating NestJS application
27
- - `nestia`: Just CLI (command line interface) tool
28
-
29
- > [!NOTE]
30
- >
31
- > - **Only one line** required, with pure TypeScript type
32
- > - Enhance performance **30x** up
33
- > - Runtime validator is **20,000x faster** than `class-validator`
34
- > - JSON serialization is **200x faster** than `class-transformer`
35
- > - Software Development Kit
36
- > - Collection of typed `fetch` functions with DTO structures like [tRPC](https://trpc.io/)
37
- > - Mockup simulator means embedded backend simulator in the SDK
38
- > - similar with [msw](https://mswjs.io/), but fully automated
39
-
40
- ![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)
41
-
42
- > Left is NestJS server code, and right is client (frontend) code utilizing SDK
43
-
44
-
45
-
46
-
47
- ## Sponsors and Backers
48
- Thanks for your support.
49
-
50
- Your donation would encourage `nestia` development.
51
-
52
- [![Backers](https://opencollective.com/nestia/backers.svg?avatarHeight=75&width=600)](https://opencollective.com/nestia)
53
-
54
-
55
-
56
-
57
- ## Guide Documents
58
- Check out the document in the [website](https://nestia.io/docs/):
59
-
60
- ### 🏠 Home
61
- - [Introduction](https://nestia.io/docs/)
62
- - [Setup](https://nestia.io/docs/setup/)
63
- - [Pure TypeScript](https://nestia.io/docs/pure)
64
-
65
- ### 📖 Features
66
- - Core Library
67
- - [`@WebSocketRoute`](https://nestia.io/docs/core/WebSocketRoute)
68
- - [`@TypedRoute`](https://nestia.io/docs/core/TypedRoute/)
69
- - [**`@TypedBody`**](https://nestia.io/docs/core/TypedBody/)
70
- - [`@TypedParam`](https://nestia.io/docs/core/TypedParam/)
71
- - [`@TypedQuery`](https://nestia.io/docs/core/TypedQuery/)
72
- - [`@TypedFormData`](https://nestia.io/docs/core/TypedFormData/)
73
- - [`@TypedHeaders`](https://nestia.io/docs/core/TypedHeaders/)
74
- - [`@TypedException`](https://nestia.io/docs/core/TypedException/)
75
- - Software Development Kit
76
- - [SDK Builder](https://nestia.io/docs/sdk/)
77
- - [Mockup Simulator](https://nestia.io/docs/sdk/simulate/)
78
- - [E2E Test Functions](https://nestia.io/docs/sdk/e2e/)
79
- - [Distribution](https://nestia.io/docs/sdk/distribute/)
80
- - Swagger Document
81
- - [Swagger Builder](https://nestia.io/docs/swagger/)
82
- - [**AI Chatbot Development**](https://nestia.io/docs/swagger/chat/)
83
- - [Cloud Swagger Editor](https://nestia.io/docs/swagger/editor/)
84
- - [Documentation Strategy](https://nestia.io/docs/swagger/strategy/)
85
- - E2E Testing
86
- - [Why E2E Test?](https://nestia.io/docs/e2e/why/)
87
- - [Test Program Development](https://nestia.io/docs/e2e/development/)
88
- - [Performance Benchmark](https://nestia.io/docs/e2e/benchmark/)
89
-
90
- ### 🔗 Appendix
91
- - [API Documents](https://nestia.io/api)
92
- - [⇲ Benchmark Result](https://github.com/samchon/nestia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
93
- - [⇲ `dev.to` Articles](https://dev.to/samchon/series/22751)
1
+ # Nestia
2
+ ![Nestia Logo](https://nestia.io/logo.png)
3
+
4
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
5
+ [![npm version](https://img.shields.io/npm/v/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
6
+ [![Downloads](https://img.shields.io/npm/dm/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
7
+ [![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
8
+ [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://nestia.io/docs/)
9
+ [![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/nestia)
10
+ [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
11
+
12
+ Nestia is a set of helper libraries for NestJS, supporting below features:
13
+
14
+ - `@nestia/core`:
15
+ - Super-fast/easy decorators
16
+ - Advanced WebSocket routes
17
+ - `@nestia/sdk`:
18
+ - Swagger generator, more evolved than ever
19
+ - SDK library generator for clients
20
+ - Mockup Simulator for client applications
21
+ - Automatic E2E test functions generator
22
+ - `@nestia/e2e`: Test program utilizing e2e test functions
23
+ - `@nestia/benchmark`: Benchmark program using e2e test functions
24
+ - `@nestia/editor`: Swagger-UI with Online TypeScript Editor
25
+ - [`@agentica`](https://github.com/wrtnlabs/agentica): Agentic AI library specialized in LLM function calling
26
+ - [`@autobe`](https://github.com/wrtnlabs/autobe): Vibe coding agent generating NestJS application
27
+ - `nestia`: Just CLI (command line interface) tool
28
+
29
+ > [!NOTE]
30
+ >
31
+ > - **Only one line** required, with pure TypeScript type
32
+ > - Enhance performance **30x** up
33
+ > - Runtime validator is **20,000x faster** than `class-validator`
34
+ > - JSON serialization is **200x faster** than `class-transformer`
35
+ > - Software Development Kit
36
+ > - Collection of typed `fetch` functions with DTO structures like [tRPC](https://trpc.io/)
37
+ > - Mockup simulator means embedded backend simulator in the SDK
38
+ > - similar with [msw](https://mswjs.io/), but fully automated
39
+
40
+ ![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)
41
+
42
+ > Left is NestJS server code, and right is client (frontend) code utilizing SDK
43
+
44
+
45
+
46
+
47
+ ## Sponsors and Backers
48
+ Thanks for your support.
49
+
50
+ Your donation would encourage `nestia` development.
51
+
52
+ [![Backers](https://opencollective.com/nestia/backers.svg?avatarHeight=75&width=600)](https://opencollective.com/nestia)
53
+
54
+
55
+
56
+
57
+ ## Guide Documents
58
+ Check out the document in the [website](https://nestia.io/docs/):
59
+
60
+ ### 🏠 Home
61
+ - [Introduction](https://nestia.io/docs/)
62
+ - [Setup](https://nestia.io/docs/setup/)
63
+ - [Pure TypeScript](https://nestia.io/docs/pure)
64
+
65
+ ### 📖 Features
66
+ - Core Library
67
+ - [`@WebSocketRoute`](https://nestia.io/docs/core/WebSocketRoute)
68
+ - [`@TypedRoute`](https://nestia.io/docs/core/TypedRoute/)
69
+ - [**`@TypedBody`**](https://nestia.io/docs/core/TypedBody/)
70
+ - [`@TypedParam`](https://nestia.io/docs/core/TypedParam/)
71
+ - [`@TypedQuery`](https://nestia.io/docs/core/TypedQuery/)
72
+ - [`@TypedFormData`](https://nestia.io/docs/core/TypedFormData/)
73
+ - [`@TypedHeaders`](https://nestia.io/docs/core/TypedHeaders/)
74
+ - [`@TypedException`](https://nestia.io/docs/core/TypedException/)
75
+ - Software Development Kit
76
+ - [SDK Builder](https://nestia.io/docs/sdk/)
77
+ - [Mockup Simulator](https://nestia.io/docs/sdk/simulate/)
78
+ - [E2E Test Functions](https://nestia.io/docs/sdk/e2e/)
79
+ - [Distribution](https://nestia.io/docs/sdk/distribute/)
80
+ - Swagger Document
81
+ - [Swagger Builder](https://nestia.io/docs/swagger/)
82
+ - [**AI Chatbot Development**](https://nestia.io/docs/swagger/chat/)
83
+ - [Cloud Swagger Editor](https://nestia.io/docs/swagger/editor/)
84
+ - [Documentation Strategy](https://nestia.io/docs/swagger/strategy/)
85
+ - E2E Testing
86
+ - [Why E2E Test?](https://nestia.io/docs/e2e/why/)
87
+ - [Test Program Development](https://nestia.io/docs/e2e/development/)
88
+ - [Performance Benchmark](https://nestia.io/docs/e2e/benchmark/)
89
+
90
+ ### 🔗 Appendix
91
+ - [API Documents](https://nestia.io/api)
92
+ - [⇲ Benchmark Result](https://github.com/samchon/nestia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
93
+ - [⇲ `dev.to` Articles](https://dev.to/samchon/series/22751)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestia/e2e",
3
- "version": "8.0.0-dev.20250829-2",
3
+ "version": "8.0.0",
4
4
  "description": "E2E test utilify functions",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
package/src/MapUtil.ts CHANGED
@@ -1,86 +1,86 @@
1
- /**
2
- * A namespace providing utility functions for Map manipulation.
3
- *
4
- * This namespace contains helper functions for working with JavaScript Map
5
- * objects, providing convenient methods for common Map operations like
6
- * retrieving values with lazy initialization.
7
- *
8
- * @author Jeongho Nam - https://github.com/samchon
9
- * @example
10
- * ```typescript
11
- * // Create a cache with lazy initialization
12
- * const cache = new Map<string, ExpensiveObject>();
13
- *
14
- * const obj = MapUtil.take(cache, "key1", () => {
15
- * console.log("Creating expensive object...");
16
- * return new ExpensiveObject();
17
- * });
18
- *
19
- * // Subsequent calls return cached value without re-creating
20
- * const sameObj = MapUtil.take(cache, "key1", () => new ExpensiveObject());
21
- * console.log(obj === sameObj); // true
22
- * ```;
23
- */
24
- export namespace MapUtil {
25
- /**
26
- * Retrieves a value from a Map or creates it using a lazy initialization
27
- * function.
28
- *
29
- * This function implements the "get or create" pattern for Maps. If the key
30
- * exists in the Map, it returns the existing value. Otherwise, it calls the
31
- * provided factory function to create a new value, stores it in the Map, and
32
- * returns it. The factory function is only called when the key doesn't exist,
33
- * enabling lazy initialization and caching patterns.
34
- *
35
- * @example
36
- * ```typescript
37
- * // Simple caching example
38
- * const userCache = new Map<number, User>();
39
- *
40
- * const user = MapUtil.take(userCache, userId, () => {
41
- * // This expensive operation only runs if userId is not cached
42
- * return fetchUserFromDatabase(userId);
43
- * });
44
- *
45
- * // Configuration object caching
46
- * const configs = new Map<string, Config>();
47
- *
48
- * const dbConfig = MapUtil.take(configs, "database", () => ({
49
- * host: "localhost",
50
- * port: 5432,
51
- * database: "myapp"
52
- * }));
53
- *
54
- * // Lazy computation results
55
- * const computationCache = new Map<string, number>();
56
- *
57
- * const result = MapUtil.take(computationCache, "fibonacci-40", () => {
58
- * console.log("Computing fibonacci(40)...");
59
- * return fibonacci(40); // Only computed once
60
- * });
61
- *
62
- * // Using with complex keys
63
- * const cache = new Map<[number, number], Matrix>();
64
- * const key: [number, number] = [rows, cols];
65
- *
66
- * const matrix = MapUtil.take(cache, key, () =>
67
- * generateIdentityMatrix(rows, cols)
68
- * );
69
- * ```;
70
- *
71
- * @template K - The type of keys in the Map
72
- * @template V - The type of values in the Map
73
- * @param map - The Map to retrieve from or update
74
- * @param key - The key to look up in the Map
75
- * @param value - A factory function that creates the value if key doesn't exist
76
- * @returns The existing value if found, or the newly created value
77
- */
78
- export function take<K, V>(map: Map<K, V>, key: K, value: () => V): V {
79
- if (map.has(key)) {
80
- return map.get(key) as V;
81
- }
82
- const newValue = value();
83
- map.set(key, newValue);
84
- return newValue;
85
- }
86
- }
1
+ /**
2
+ * A namespace providing utility functions for Map manipulation.
3
+ *
4
+ * This namespace contains helper functions for working with JavaScript Map
5
+ * objects, providing convenient methods for common Map operations like
6
+ * retrieving values with lazy initialization.
7
+ *
8
+ * @author Jeongho Nam - https://github.com/samchon
9
+ * @example
10
+ * ```typescript
11
+ * // Create a cache with lazy initialization
12
+ * const cache = new Map<string, ExpensiveObject>();
13
+ *
14
+ * const obj = MapUtil.take(cache, "key1", () => {
15
+ * console.log("Creating expensive object...");
16
+ * return new ExpensiveObject();
17
+ * });
18
+ *
19
+ * // Subsequent calls return cached value without re-creating
20
+ * const sameObj = MapUtil.take(cache, "key1", () => new ExpensiveObject());
21
+ * console.log(obj === sameObj); // true
22
+ * ```;
23
+ */
24
+ export namespace MapUtil {
25
+ /**
26
+ * Retrieves a value from a Map or creates it using a lazy initialization
27
+ * function.
28
+ *
29
+ * This function implements the "get or create" pattern for Maps. If the key
30
+ * exists in the Map, it returns the existing value. Otherwise, it calls the
31
+ * provided factory function to create a new value, stores it in the Map, and
32
+ * returns it. The factory function is only called when the key doesn't exist,
33
+ * enabling lazy initialization and caching patterns.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * // Simple caching example
38
+ * const userCache = new Map<number, User>();
39
+ *
40
+ * const user = MapUtil.take(userCache, userId, () => {
41
+ * // This expensive operation only runs if userId is not cached
42
+ * return fetchUserFromDatabase(userId);
43
+ * });
44
+ *
45
+ * // Configuration object caching
46
+ * const configs = new Map<string, Config>();
47
+ *
48
+ * const dbConfig = MapUtil.take(configs, "database", () => ({
49
+ * host: "localhost",
50
+ * port: 5432,
51
+ * database: "myapp"
52
+ * }));
53
+ *
54
+ * // Lazy computation results
55
+ * const computationCache = new Map<string, number>();
56
+ *
57
+ * const result = MapUtil.take(computationCache, "fibonacci-40", () => {
58
+ * console.log("Computing fibonacci(40)...");
59
+ * return fibonacci(40); // Only computed once
60
+ * });
61
+ *
62
+ * // Using with complex keys
63
+ * const cache = new Map<[number, number], Matrix>();
64
+ * const key: [number, number] = [rows, cols];
65
+ *
66
+ * const matrix = MapUtil.take(cache, key, () =>
67
+ * generateIdentityMatrix(rows, cols)
68
+ * );
69
+ * ```;
70
+ *
71
+ * @template K - The type of keys in the Map
72
+ * @template V - The type of values in the Map
73
+ * @param map - The Map to retrieve from or update
74
+ * @param key - The key to look up in the Map
75
+ * @param value - A factory function that creates the value if key doesn't exist
76
+ * @returns The existing value if found, or the newly created value
77
+ */
78
+ export function take<K, V>(map: Map<K, V>, key: K, value: () => V): V {
79
+ if (map.has(key)) {
80
+ return map.get(key) as V;
81
+ }
82
+ const newValue = value();
83
+ map.set(key, newValue);
84
+ return newValue;
85
+ }
86
+ }