@hichchi/nest-connector 0.0.2 → 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/auth.cjs.js CHANGED
@@ -247,6 +247,8 @@ exports.AuthEndpoint = void 0;
247
247
  * - `USER_404_ID`: User not found.
248
248
  * - `USER_409_EXIST_UNAME`: Username already exists.
249
249
  * - `USER_500_CREATE`: User creation error.
250
+ *
251
+ * @see {@link AuthErrors} for error responses
250
252
  */
251
253
  exports.AuthErrorResponseCode = void 0;
252
254
  (function (AuthErrorResponseCode) {
@@ -427,6 +429,11 @@ exports.AuthErrorResponseCode = void 0;
427
429
  * Occurs when there is a server-side error during the authentication process.
428
430
  */
429
431
  AuthErrorResponseCode["AUTH_500_SIGN_IN"] = "AUTH_500_SIGN_IN";
432
+ /**
433
+ * Change password error (500 Internal Server Error)
434
+ * Occurs when there is a server-side error during the change password process.
435
+ */
436
+ AuthErrorResponseCode["AUTH_500_CHANGE_PASSWORD"] = "AUTH_500_CHANGE_PASSWORD";
430
437
  /**
431
438
  * Social sign in error (500 Internal Server Error)
432
439
  *
@@ -1003,6 +1010,11 @@ const AuthErrors = {
1003
1010
  code: exports.AuthErrorResponseCode.AUTH_500_SIGN_IN,
1004
1011
  message: "Error occurred while signing in!"
1005
1012
  },
1013
+ [exports.AuthErrorResponseCode.AUTH_500_CHANGE_PASSWORD]: {
1014
+ statusCode: error_responses.HttpServerErrorStatus.INTERNAL_SERVER_ERROR,
1015
+ code: exports.AuthErrorResponseCode.AUTH_500_CHANGE_PASSWORD,
1016
+ message: "Error occurred while changing password!"
1017
+ },
1006
1018
  [exports.AuthErrorResponseCode.AUTH_500_SOCIAL_SIGN_IN]: {
1007
1019
  statusCode: error_responses.HttpServerErrorStatus.INTERNAL_SERVER_ERROR,
1008
1020
  code: exports.AuthErrorResponseCode.AUTH_500_SOCIAL_SIGN_IN,
@@ -1275,7 +1287,7 @@ const AuthSuccessResponses = {
1275
1287
  * @see {@link Role} Interface defining the structure of role objects
1276
1288
  */
1277
1289
  function isRoleObject(role) {
1278
- return Boolean(role) && Boolean("name" in role);
1290
+ return Boolean(role) && typeof role === "object" && Boolean("name" in role);
1279
1291
  }
1280
1292
 
1281
1293
  exports.AuthErrors = AuthErrors;
package/auth.esm.js CHANGED
@@ -245,6 +245,8 @@ var AuthEndpoint;
245
245
  * - `USER_404_ID`: User not found.
246
246
  * - `USER_409_EXIST_UNAME`: Username already exists.
247
247
  * - `USER_500_CREATE`: User creation error.
248
+ *
249
+ * @see {@link AuthErrors} for error responses
248
250
  */
249
251
  var AuthErrorResponseCode;
250
252
  (function (AuthErrorResponseCode) {
@@ -425,6 +427,11 @@ var AuthErrorResponseCode;
425
427
  * Occurs when there is a server-side error during the authentication process.
426
428
  */
427
429
  AuthErrorResponseCode["AUTH_500_SIGN_IN"] = "AUTH_500_SIGN_IN";
430
+ /**
431
+ * Change password error (500 Internal Server Error)
432
+ * Occurs when there is a server-side error during the change password process.
433
+ */
434
+ AuthErrorResponseCode["AUTH_500_CHANGE_PASSWORD"] = "AUTH_500_CHANGE_PASSWORD";
428
435
  /**
429
436
  * Social sign in error (500 Internal Server Error)
430
437
  *
@@ -1001,6 +1008,11 @@ const AuthErrors = {
1001
1008
  code: AuthErrorResponseCode.AUTH_500_SIGN_IN,
1002
1009
  message: "Error occurred while signing in!"
1003
1010
  },
1011
+ [AuthErrorResponseCode.AUTH_500_CHANGE_PASSWORD]: {
1012
+ statusCode: HttpServerErrorStatus.INTERNAL_SERVER_ERROR,
1013
+ code: AuthErrorResponseCode.AUTH_500_CHANGE_PASSWORD,
1014
+ message: "Error occurred while changing password!"
1015
+ },
1004
1016
  [AuthErrorResponseCode.AUTH_500_SOCIAL_SIGN_IN]: {
1005
1017
  statusCode: HttpServerErrorStatus.INTERNAL_SERVER_ERROR,
1006
1018
  code: AuthErrorResponseCode.AUTH_500_SOCIAL_SIGN_IN,
@@ -1273,7 +1285,7 @@ const AuthSuccessResponses = {
1273
1285
  * @see {@link Role} Interface defining the structure of role objects
1274
1286
  */
1275
1287
  function isRoleObject(role) {
1276
- return Boolean(role) && Boolean("name" in role);
1288
+ return Boolean(role) && typeof role === "object" && Boolean("name" in role);
1277
1289
  }
1278
1290
 
1279
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,6 +1,7 @@
1
1
  {
2
2
  "name": "@hichchi/nest-connector",
3
- "version": "0.0.2",
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",
4
5
  "publishConfig": {
5
6
  "access": "public"
6
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
+ [![npm version](https://img.shields.io/npm/v/@hichchi/nest-connector?style=flat&color=blue)](https://www.npmjs.com/package/@hichchi/nest-connector)
12
+ [![npm downloads](https://img.shields.io/npm/dm/@hichchi/nest-connector?style=flat&color=green)](https://www.npmjs.com/package/@hichchi/nest-connector)
13
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/hichchidev/hichchi/blob/main/LICENSE)
14
+ [![NestJS](https://img.shields.io/badge/nestjs-11.1.3-red.svg)](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
+ [![Hichchi Ecosystem](https://img.shields.io/badge/🏠_Hichchi_Ecosystem-blue)](https://github.com/hichchidev/hichchi)
151
+ [![Report Bug](https://img.shields.io/badge/🐛_Report_Bug-red)](https://github.com/hichchidev/hichchi/issues)
152
+ [![Request Feature](https://img.shields.io/badge/✨_Request_Feature-green)](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
@@ -66,6 +66,8 @@
66
66
  * - `USER_404_ID`: User not found.
67
67
  * - `USER_409_EXIST_UNAME`: Username already exists.
68
68
  * - `USER_500_CREATE`: User creation error.
69
+ *
70
+ * @see {@link AuthErrors} for error responses
69
71
  */
70
72
  export declare enum AuthErrorResponseCode {
71
73
  /**
@@ -245,6 +247,11 @@ export declare enum AuthErrorResponseCode {
245
247
  * Occurs when there is a server-side error during the authentication process.
246
248
  */
247
249
  AUTH_500_SIGN_IN = "AUTH_500_SIGN_IN",
250
+ /**
251
+ * Change password error (500 Internal Server Error)
252
+ * Occurs when there is a server-side error during the change password process.
253
+ */
254
+ AUTH_500_CHANGE_PASSWORD = "AUTH_500_CHANGE_PASSWORD",
248
255
  /**
249
256
  * Social sign in error (500 Internal Server Error)
250
257
  *