@ajayjbtickets/common 1.0.37 → 1.0.38

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
@@ -62,6 +62,7 @@ __export(index_exports, {
62
62
  ValidationSource: () => ValidationSource,
63
63
  asyncHandler: () => asyncHandler,
64
64
  logger: () => logger,
65
+ objectId: () => objectId,
65
66
  sanitizeObject: () => sanitizeObject,
66
67
  schemaValidator: () => schemaValidator,
67
68
  verifyToken: () => verifyToken
@@ -383,6 +384,7 @@ var logger = import_winston.default.createLogger({
383
384
  });
384
385
 
385
386
  // src/middlewares/schemaValidator.ts
387
+ var import_zod = require("zod");
386
388
  var schemaValidator = (type, schema) => {
387
389
  return (req, res, next) => {
388
390
  const result = schema.safeParse(req[type]);
@@ -399,6 +401,7 @@ var schemaValidator = (type, schema) => {
399
401
  }
400
402
  };
401
403
  };
404
+ var objectId = import_zod.z.string().regex(/^[0-9a-fA-F]{24}$/);
402
405
 
403
406
  // src/middlewares/verifyToken.ts
404
407
  var import_jsonwebtoken2 = __toESM(require("jsonwebtoken"), 1);
@@ -607,6 +610,7 @@ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
607
610
  ValidationSource,
608
611
  asyncHandler,
609
612
  logger,
613
+ objectId,
610
614
  sanitizeObject,
611
615
  schemaValidator,
612
616
  verifyToken
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Response, Request, NextFunction } from 'express';
2
2
  import winston from 'winston';
3
- import { ZodSchema } from 'zod';
3
+ import { z, ZodSchema } from 'zod';
4
4
  import jsonwebtoken, { SignOptions, VerifyOptions } from 'jsonwebtoken';
5
5
  import * as node_nats_streaming from 'node-nats-streaming';
6
6
  import { Message, Stan } from 'node-nats-streaming';
@@ -163,6 +163,7 @@ declare enum ValidationSource {
163
163
  }
164
164
 
165
165
  declare const schemaValidator: (type: ValidationSource, schema: ZodSchema) => (req: Request, res: Response, next: NextFunction) => void;
166
+ declare const objectId: z.ZodString;
166
167
 
167
168
  declare const verifyToken: (req: Request, res: Response, next: NextFunction) => Promise<void>;
168
169
 
@@ -237,4 +238,4 @@ declare enum OrderStatus {
237
238
  Complete = "complete"
238
239
  }
239
240
 
240
- export { AccessTokenError, AccessTokenErrorResponse, ApiError, ApiResponse, AuthFailureError, BadRequestError, BadRequestResponse, BadTokenError, BadTokenResponse, ENVIRONMENTS, type ErrorDetailType, ErrorType, ForbiddenError, ForbiddenResponse, InternalError, InternalErrorResponse, type JwtPayload, JwtService, Listener, NoDataError, NoEntryError, NoFoundResponse, NotFoundError, OrderStatus, type Pagination, Password, Publisher, ResponseStatusCode, StatusCode, Subjects, SuccessResponse, type TicketCreatedEvent, type TicketUpdatedEvent, TokenExpiredError, ValidationSource, asyncHandler, logger, sanitizeObject, schemaValidator, verifyToken };
241
+ export { AccessTokenError, AccessTokenErrorResponse, ApiError, ApiResponse, AuthFailureError, BadRequestError, BadRequestResponse, BadTokenError, BadTokenResponse, ENVIRONMENTS, type ErrorDetailType, ErrorType, ForbiddenError, ForbiddenResponse, InternalError, InternalErrorResponse, type JwtPayload, JwtService, Listener, NoDataError, NoEntryError, NoFoundResponse, NotFoundError, OrderStatus, type Pagination, Password, Publisher, ResponseStatusCode, StatusCode, Subjects, SuccessResponse, type TicketCreatedEvent, type TicketUpdatedEvent, TokenExpiredError, ValidationSource, asyncHandler, logger, objectId, sanitizeObject, schemaValidator, verifyToken };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Response, Request, NextFunction } from 'express';
2
2
  import winston from 'winston';
3
- import { ZodSchema } from 'zod';
3
+ import { z, ZodSchema } from 'zod';
4
4
  import jsonwebtoken, { SignOptions, VerifyOptions } from 'jsonwebtoken';
5
5
  import * as node_nats_streaming from 'node-nats-streaming';
6
6
  import { Message, Stan } from 'node-nats-streaming';
@@ -163,6 +163,7 @@ declare enum ValidationSource {
163
163
  }
164
164
 
165
165
  declare const schemaValidator: (type: ValidationSource, schema: ZodSchema) => (req: Request, res: Response, next: NextFunction) => void;
166
+ declare const objectId: z.ZodString;
166
167
 
167
168
  declare const verifyToken: (req: Request, res: Response, next: NextFunction) => Promise<void>;
168
169
 
@@ -237,4 +238,4 @@ declare enum OrderStatus {
237
238
  Complete = "complete"
238
239
  }
239
240
 
240
- export { AccessTokenError, AccessTokenErrorResponse, ApiError, ApiResponse, AuthFailureError, BadRequestError, BadRequestResponse, BadTokenError, BadTokenResponse, ENVIRONMENTS, type ErrorDetailType, ErrorType, ForbiddenError, ForbiddenResponse, InternalError, InternalErrorResponse, type JwtPayload, JwtService, Listener, NoDataError, NoEntryError, NoFoundResponse, NotFoundError, OrderStatus, type Pagination, Password, Publisher, ResponseStatusCode, StatusCode, Subjects, SuccessResponse, type TicketCreatedEvent, type TicketUpdatedEvent, TokenExpiredError, ValidationSource, asyncHandler, logger, sanitizeObject, schemaValidator, verifyToken };
241
+ export { AccessTokenError, AccessTokenErrorResponse, ApiError, ApiResponse, AuthFailureError, BadRequestError, BadRequestResponse, BadTokenError, BadTokenResponse, ENVIRONMENTS, type ErrorDetailType, ErrorType, ForbiddenError, ForbiddenResponse, InternalError, InternalErrorResponse, type JwtPayload, JwtService, Listener, NoDataError, NoEntryError, NoFoundResponse, NotFoundError, OrderStatus, type Pagination, Password, Publisher, ResponseStatusCode, StatusCode, Subjects, SuccessResponse, type TicketCreatedEvent, type TicketUpdatedEvent, TokenExpiredError, ValidationSource, asyncHandler, logger, objectId, sanitizeObject, schemaValidator, verifyToken };
package/dist/index.js CHANGED
@@ -313,6 +313,7 @@ var logger = winston.createLogger({
313
313
  });
314
314
 
315
315
  // src/middlewares/schemaValidator.ts
316
+ import { z } from "zod";
316
317
  var schemaValidator = (type, schema) => {
317
318
  return (req, res, next) => {
318
319
  const result = schema.safeParse(req[type]);
@@ -329,6 +330,7 @@ var schemaValidator = (type, schema) => {
329
330
  }
330
331
  };
331
332
  };
333
+ var objectId = z.string().regex(/^[0-9a-fA-F]{24}$/);
332
334
 
333
335
  // src/middlewares/verifyToken.ts
334
336
  import jsonwebtoken2 from "jsonwebtoken";
@@ -536,6 +538,7 @@ export {
536
538
  ValidationSource,
537
539
  asyncHandler,
538
540
  logger,
541
+ objectId,
539
542
  sanitizeObject,
540
543
  schemaValidator,
541
544
  verifyToken
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ajayjbtickets/common",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",