@ajayjbtickets/common 1.0.26 → 1.0.28

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/dist/index.cjs CHANGED
@@ -143,10 +143,14 @@ var ApiResponse = class {
143
143
  }
144
144
  };
145
145
  var SuccessResponse = class extends ApiResponse {
146
- constructor(responseStatusCode, message, data) {
146
+ data;
147
+ pagination;
148
+ constructor(responseStatusCode, message, data, pagination) {
147
149
  super(responseStatusCode, message, "10000" /* SUCCESS */);
148
150
  this.data = data;
149
- this.data = data;
151
+ if (pagination) {
152
+ this.pagination = pagination;
153
+ }
150
154
  }
151
155
  send(res) {
152
156
  this.prepare(res, this, {});
package/dist/index.d.cts CHANGED
@@ -98,6 +98,11 @@ declare enum ResponseStatusCode {
98
98
  SERVICE_UNAVAILABLE = 503,
99
99
  GATEWAY_TIMEOUT = 504
100
100
  }
101
+ type Pagination = {
102
+ currentPage: number;
103
+ itemsPerPage: number;
104
+ totalItems: number;
105
+ };
101
106
  declare abstract class ApiResponse {
102
107
  message: string;
103
108
  statusCode: string | undefined;
@@ -113,7 +118,8 @@ declare abstract class ApiResponse {
113
118
  }
114
119
  declare class SuccessResponse<T> extends ApiResponse {
115
120
  data: T;
116
- constructor(responseStatusCode: ResponseStatusCode.SUCCESS | ResponseStatusCode.CREATED | ResponseStatusCode.ACCEPTED | ResponseStatusCode.NO_CONTENT, message: string, data: T);
121
+ pagination: Pagination | undefined;
122
+ constructor(responseStatusCode: ResponseStatusCode.SUCCESS | ResponseStatusCode.CREATED | ResponseStatusCode.ACCEPTED | ResponseStatusCode.NO_CONTENT, message: string, data: T, pagination?: Pagination);
117
123
  send(res: Response): void;
118
124
  }
119
125
  declare class AccessTokenErrorResponse extends ApiResponse {
@@ -178,4 +184,4 @@ declare const asyncHandler: (execution: AsyncFunction) => (req: Request, res: Re
178
184
 
179
185
  declare const sanitizeObject: <T>(value: T) => T;
180
186
 
181
- export { AccessTokenError, AccessTokenErrorResponse, ApiError, ApiResponse, AuthFailureError, BadRequestError, BadRequestResponse, BadTokenError, BadTokenResponse, ENVIRONMENTS, type ErrorDetailType, ErrorType, ForbiddenError, ForbiddenResponse, InternalError, InternalErrorResponse, type JwtPayload, JwtService, NoDataError, NoEntryError, NoFoundResponse, NotFoundError, Password, ResponseStatusCode, StatusCode, SuccessResponse, TokenExpiredError, ValidationSource, asyncHandler, logger, sanitizeObject, schemaValidator, verifyToken };
187
+ export { AccessTokenError, AccessTokenErrorResponse, ApiError, ApiResponse, AuthFailureError, BadRequestError, BadRequestResponse, BadTokenError, BadTokenResponse, ENVIRONMENTS, type ErrorDetailType, ErrorType, ForbiddenError, ForbiddenResponse, InternalError, InternalErrorResponse, type JwtPayload, JwtService, NoDataError, NoEntryError, NoFoundResponse, NotFoundError, type Pagination, Password, ResponseStatusCode, StatusCode, SuccessResponse, TokenExpiredError, ValidationSource, asyncHandler, logger, sanitizeObject, schemaValidator, verifyToken };
package/dist/index.d.ts CHANGED
@@ -98,6 +98,11 @@ declare enum ResponseStatusCode {
98
98
  SERVICE_UNAVAILABLE = 503,
99
99
  GATEWAY_TIMEOUT = 504
100
100
  }
101
+ type Pagination = {
102
+ currentPage: number;
103
+ itemsPerPage: number;
104
+ totalItems: number;
105
+ };
101
106
  declare abstract class ApiResponse {
102
107
  message: string;
103
108
  statusCode: string | undefined;
@@ -113,7 +118,8 @@ declare abstract class ApiResponse {
113
118
  }
114
119
  declare class SuccessResponse<T> extends ApiResponse {
115
120
  data: T;
116
- constructor(responseStatusCode: ResponseStatusCode.SUCCESS | ResponseStatusCode.CREATED | ResponseStatusCode.ACCEPTED | ResponseStatusCode.NO_CONTENT, message: string, data: T);
121
+ pagination: Pagination | undefined;
122
+ constructor(responseStatusCode: ResponseStatusCode.SUCCESS | ResponseStatusCode.CREATED | ResponseStatusCode.ACCEPTED | ResponseStatusCode.NO_CONTENT, message: string, data: T, pagination?: Pagination);
117
123
  send(res: Response): void;
118
124
  }
119
125
  declare class AccessTokenErrorResponse extends ApiResponse {
@@ -178,4 +184,4 @@ declare const asyncHandler: (execution: AsyncFunction) => (req: Request, res: Re
178
184
 
179
185
  declare const sanitizeObject: <T>(value: T) => T;
180
186
 
181
- export { AccessTokenError, AccessTokenErrorResponse, ApiError, ApiResponse, AuthFailureError, BadRequestError, BadRequestResponse, BadTokenError, BadTokenResponse, ENVIRONMENTS, type ErrorDetailType, ErrorType, ForbiddenError, ForbiddenResponse, InternalError, InternalErrorResponse, type JwtPayload, JwtService, NoDataError, NoEntryError, NoFoundResponse, NotFoundError, Password, ResponseStatusCode, StatusCode, SuccessResponse, TokenExpiredError, ValidationSource, asyncHandler, logger, sanitizeObject, schemaValidator, verifyToken };
187
+ export { AccessTokenError, AccessTokenErrorResponse, ApiError, ApiResponse, AuthFailureError, BadRequestError, BadRequestResponse, BadTokenError, BadTokenResponse, ENVIRONMENTS, type ErrorDetailType, ErrorType, ForbiddenError, ForbiddenResponse, InternalError, InternalErrorResponse, type JwtPayload, JwtService, NoDataError, NoEntryError, NoFoundResponse, NotFoundError, type Pagination, Password, ResponseStatusCode, StatusCode, SuccessResponse, TokenExpiredError, ValidationSource, asyncHandler, logger, sanitizeObject, schemaValidator, verifyToken };
package/dist/index.js CHANGED
@@ -77,10 +77,14 @@ var ApiResponse = class {
77
77
  }
78
78
  };
79
79
  var SuccessResponse = class extends ApiResponse {
80
- constructor(responseStatusCode, message, data) {
80
+ data;
81
+ pagination;
82
+ constructor(responseStatusCode, message, data, pagination) {
81
83
  super(responseStatusCode, message, "10000" /* SUCCESS */);
82
84
  this.data = data;
83
- this.data = data;
85
+ if (pagination) {
86
+ this.pagination = pagination;
87
+ }
84
88
  }
85
89
  send(res) {
86
90
  this.prepare(res, this, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ajayjbtickets/common",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -25,7 +25,7 @@
25
25
  "dev": "tsx ./src/index.ts",
26
26
  "clean": "del ./dist/*",
27
27
  "build": "npm run clean && tsup",
28
- "publish": "git add . && git commit -m \"updates\" && npm version patch && npm run build && npm publish"
28
+ "release": "git add . && git commit -m \"updates\" && npm version patch && npm run build && npm publish"
29
29
  },
30
30
  "keywords": [],
31
31
  "author": "",