@hichchi/nest-connector 0.0.3 → 0.0.4
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/CHANGELOG.md +67 -0
- package/README.md +3680 -0
- package/auth.cjs.js +1 -1
- package/auth.esm.js +1 -1
- package/crud.cjs.js +0 -23
- package/crud.esm.js +0 -23
- package/package.json +1 -1
- package/readme-top.md +170 -0
package/auth.cjs.js
CHANGED
|
@@ -1287,7 +1287,7 @@ const AuthSuccessResponses = {
|
|
|
1287
1287
|
* @see {@link Role} Interface defining the structure of role objects
|
|
1288
1288
|
*/
|
|
1289
1289
|
function isRoleObject(role) {
|
|
1290
|
-
return Boolean(role) && Boolean("name" in role);
|
|
1290
|
+
return Boolean(role) && typeof role === "object" && Boolean("name" in role);
|
|
1291
1291
|
}
|
|
1292
1292
|
|
|
1293
1293
|
exports.AuthErrors = AuthErrors;
|
package/auth.esm.js
CHANGED
|
@@ -1285,7 +1285,7 @@ const AuthSuccessResponses = {
|
|
|
1285
1285
|
* @see {@link Role} Interface defining the structure of role objects
|
|
1286
1286
|
*/
|
|
1287
1287
|
function isRoleObject(role) {
|
|
1288
|
-
return Boolean(role) && Boolean("name" in role);
|
|
1288
|
+
return Boolean(role) && typeof role === "object" && Boolean("name" in role);
|
|
1289
1289
|
}
|
|
1290
1290
|
|
|
1291
1291
|
export { AuthEndpoint, AuthErrorResponseCode, AuthErrors, AuthField, AuthMethod, AuthProvider, AuthStrategy, AuthSuccessResponseCode, AuthSuccessResponses, isRoleObject };
|
package/crud.cjs.js
CHANGED
|
@@ -7,26 +7,3 @@ exports.CrudEndpoint = void 0;
|
|
|
7
7
|
CrudEndpoint["BY_IDS"] = "by-ids";
|
|
8
8
|
CrudEndpoint["DELETE_BY_IDS"] = "delete-by-ids";
|
|
9
9
|
})(exports.CrudEndpoint || (exports.CrudEndpoint = {}));
|
|
10
|
-
|
|
11
|
-
// noinspection JSUnusedGlobalSymbols
|
|
12
|
-
const x = {
|
|
13
|
-
where: {
|
|
14
|
-
id: "s",
|
|
15
|
-
company: {
|
|
16
|
-
subdomain: "subdomain"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const y = {
|
|
21
|
-
where: {
|
|
22
|
-
id: ["s"],
|
|
23
|
-
company: {
|
|
24
|
-
subdomain: "subdomain"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
// eslint-disable-next-line no-console
|
|
29
|
-
console.log({
|
|
30
|
-
x,
|
|
31
|
-
y
|
|
32
|
-
});
|
package/crud.esm.js
CHANGED
|
@@ -6,27 +6,4 @@ var CrudEndpoint;
|
|
|
6
6
|
CrudEndpoint["DELETE_BY_IDS"] = "delete-by-ids";
|
|
7
7
|
})(CrudEndpoint || (CrudEndpoint = {}));
|
|
8
8
|
|
|
9
|
-
// noinspection JSUnusedGlobalSymbols
|
|
10
|
-
const x = {
|
|
11
|
-
where: {
|
|
12
|
-
id: "s",
|
|
13
|
-
company: {
|
|
14
|
-
subdomain: "subdomain"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const y = {
|
|
19
|
-
where: {
|
|
20
|
-
id: ["s"],
|
|
21
|
-
company: {
|
|
22
|
-
subdomain: "subdomain"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
// eslint-disable-next-line no-console
|
|
27
|
-
console.log({
|
|
28
|
-
x,
|
|
29
|
-
y
|
|
30
|
-
});
|
|
31
|
-
|
|
32
9
|
export { CrudEndpoint };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hichchi/nest-connector",
|
|
3
3
|
"description": "Comprehensive NestJS connector library providing standardized HTTP responses, authentication interfaces, CRUD operations, and shared utilities for the Hichchi ecosystem",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
package/readme-top.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
|
|
2
|
+
<!--suppress ALL -->
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
# 🔗 @hichchi/nest-connector
|
|
6
|
+
|
|
7
|
+
## Description
|
|
8
|
+
|
|
9
|
+
**Comprehensive NestJS connector library providing standardized HTTP responses, authentication interfaces, CRUD operations, and shared utilities for the Hichchi ecosystem**
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/@hichchi/nest-connector)
|
|
12
|
+
[](https://www.npmjs.com/package/@hichchi/nest-connector)
|
|
13
|
+
[](https://github.com/hichchidev/hichchi/blob/main/LICENSE)
|
|
14
|
+
[](https://nestjs.com/)
|
|
15
|
+
|
|
16
|
+
*Part of the [Hichchi](https://github.com/hichchidev/hichchi) ecosystem - A powerful, scalable application built with Nx workspace*
|
|
17
|
+
|
|
18
|
+
[📚 Jump to Documentation](#-api-documentation)
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 📋 Table of Contents
|
|
25
|
+
|
|
26
|
+
- [📦 Installation](#-installation)
|
|
27
|
+
- [⚡ Quick Start](#-quick-start)
|
|
28
|
+
- [📋 Prerequisites](#-prerequisites)
|
|
29
|
+
- [🌟 Overview](#-overview)
|
|
30
|
+
- [✨ Features](#-features)
|
|
31
|
+
- [🔧 Development](#-development)
|
|
32
|
+
- [📖 API Documentation](#-api-documentation)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 📦 Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install @hichchi/nest-connector
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## ⚡ Quick Start
|
|
43
|
+
|
|
44
|
+
Get up and running with standardized API responses in just a few minutes:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
// 1. Install the package
|
|
48
|
+
npm install @hichchi/nest-connector
|
|
49
|
+
|
|
50
|
+
// 2. Import response interfaces and builders
|
|
51
|
+
import {
|
|
52
|
+
HttpResponse,
|
|
53
|
+
SuccessResponse,
|
|
54
|
+
ErrorResponse,
|
|
55
|
+
SuccessResponseDto
|
|
56
|
+
} from '@hichchi/nest-connector';
|
|
57
|
+
|
|
58
|
+
// 3. Use in your NestJS controllers
|
|
59
|
+
@Controller('users')
|
|
60
|
+
export class UsersController {
|
|
61
|
+
@Get()
|
|
62
|
+
async getUsers(): Promise<SuccessResponse> {
|
|
63
|
+
const users = await this.usersService.findAll();
|
|
64
|
+
return new SuccessResponseDto(users, 'Users retrieved successfully');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 📋 Prerequisites
|
|
70
|
+
|
|
71
|
+
Before installing @hichchi/nest-connector, ensure you have:
|
|
72
|
+
|
|
73
|
+
### Required Dependencies
|
|
74
|
+
- **Node.js**: ^20.0.0
|
|
75
|
+
- **NestJS**: ^11.0.0
|
|
76
|
+
- **TypeScript**: ~5.9.3
|
|
77
|
+
|
|
78
|
+
### Peer Dependencies
|
|
79
|
+
```bash
|
|
80
|
+
npm install @nestjs/common @nestjs/core
|
|
81
|
+
npm install rxjs reflect-metadata
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Internal Dependencies
|
|
85
|
+
This package depends on:
|
|
86
|
+
```bash
|
|
87
|
+
npm install @hichchi/utils
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Optional Dependencies
|
|
91
|
+
For enhanced features:
|
|
92
|
+
```bash
|
|
93
|
+
# For validation decorators
|
|
94
|
+
npm install class-validator class-transformer
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 🌟 Overview
|
|
98
|
+
|
|
99
|
+
🎯 **Your standardized response toolkit** for NestJS applications. Ensure consistent API responses across your entire application with pre-defined interfaces, builders, and response structures that follow industry best practices.
|
|
100
|
+
|
|
101
|
+
## ✨ Features
|
|
102
|
+
|
|
103
|
+
### 🏗️ Ready-to-Use Response Structures
|
|
104
|
+
- 📋 **HttpResponse Interface** - Base interface for all API responses
|
|
105
|
+
- ✅ **SuccessResponse Interface** - Standardized success response structure
|
|
106
|
+
- ❌ **ErrorResponse Interface** - Consistent error response format
|
|
107
|
+
- 🔢 **HTTP Status Enums** - Pre-defined status code enumerations
|
|
108
|
+
|
|
109
|
+
### 🛠️ Response Builders & DTOs
|
|
110
|
+
- 🏭 **SuccessResponseDto** - Builder for success responses with data
|
|
111
|
+
- 🎯 **Response Code Types** - Application-specific response codes
|
|
112
|
+
- 📊 **Status Code Management** - Organized HTTP status code handling
|
|
113
|
+
- 🔧 **Type-Safe Responses** - Full TypeScript support for response structures
|
|
114
|
+
|
|
115
|
+
### 🎨 Developer Experience
|
|
116
|
+
- 📝 **Comprehensive Documentation** - Detailed JSDoc comments for all interfaces
|
|
117
|
+
- 🔍 **IntelliSense Support** - Full IDE autocomplete and type checking
|
|
118
|
+
- 🎯 **Consistent API Design** - Standardized response patterns across applications
|
|
119
|
+
- 🚀 **Easy Integration** - Drop-in replacement for custom response handling
|
|
120
|
+
|
|
121
|
+
### 🔧 Advanced Features
|
|
122
|
+
- 🏷️ **User Info Interfaces** - Standardized user information structures
|
|
123
|
+
- 📦 **Modular Design** - Import only what you need
|
|
124
|
+
- 🔄 **Extensible Architecture** - Easy to extend with custom response types
|
|
125
|
+
- 🎪 **Framework Agnostic Types** - Core interfaces can be used beyond NestJS
|
|
126
|
+
|
|
127
|
+
## 🔧 Development
|
|
128
|
+
|
|
129
|
+
### Building the Library
|
|
130
|
+
```bash
|
|
131
|
+
nx build nest-connector
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Running Tests
|
|
135
|
+
```bash
|
|
136
|
+
nx test nest-connector
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Linting
|
|
140
|
+
```bash
|
|
141
|
+
nx lint nest-connector
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
<div align="center">
|
|
147
|
+
|
|
148
|
+
**Made with ❤️ by [Hichchi Dev](https://github.com/hichchidev)**
|
|
149
|
+
|
|
150
|
+
[](https://github.com/hichchidev/hichchi)
|
|
151
|
+
[](https://github.com/hichchidev/hichchi/issues)
|
|
152
|
+
[](https://github.com/hichchidev/hichchi/issues)
|
|
153
|
+
|
|
154
|
+
*Standardizing API responses and connecting NestJS applications with consistent interfaces and shared utilities*
|
|
155
|
+
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
# 📖 API Documentation
|
|
161
|
+
|
|
162
|
+
Complete technical reference for all classes, interfaces, methods, and types in this library.
|
|
163
|
+
|
|
164
|
+
**Auto-generated by TypeDoc** - Browse through detailed API references, code examples, and implementation guides below.
|
|
165
|
+
|
|
166
|
+
<!-- TypeDoc generated documentation will be appended below this point -->
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 📋 API Table of Contents
|