@ajayjbtickets/common 1.0.36 → 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
@@ -51,6 +51,7 @@ __export(index_exports, {
51
51
  NoEntryError: () => NoEntryError,
52
52
  NoFoundResponse: () => NoFoundResponse,
53
53
  NotFoundError: () => NotFoundError,
54
+ OrderStatus: () => OrderStatus,
54
55
  Password: () => Password,
55
56
  Publisher: () => Publisher,
56
57
  ResponseStatusCode: () => ResponseStatusCode,
@@ -61,6 +62,7 @@ __export(index_exports, {
61
62
  ValidationSource: () => ValidationSource,
62
63
  asyncHandler: () => asyncHandler,
63
64
  logger: () => logger,
65
+ objectId: () => objectId,
64
66
  sanitizeObject: () => sanitizeObject,
65
67
  schemaValidator: () => schemaValidator,
66
68
  verifyToken: () => verifyToken
@@ -382,6 +384,7 @@ var logger = import_winston.default.createLogger({
382
384
  });
383
385
 
384
386
  // src/middlewares/schemaValidator.ts
387
+ var import_zod = require("zod");
385
388
  var schemaValidator = (type, schema) => {
386
389
  return (req, res, next) => {
387
390
  const result = schema.safeParse(req[type]);
@@ -398,6 +401,7 @@ var schemaValidator = (type, schema) => {
398
401
  }
399
402
  };
400
403
  };
404
+ var objectId = import_zod.z.string().regex(/^[0-9a-fA-F]{24}$/);
401
405
 
402
406
  // src/middlewares/verifyToken.ts
403
407
  var import_jsonwebtoken2 = __toESM(require("jsonwebtoken"), 1);
@@ -563,6 +567,15 @@ var Subjects = /* @__PURE__ */ ((Subjects2) => {
563
567
  Subjects2["TicketUpdated"] = "ticket:updated";
564
568
  return Subjects2;
565
569
  })(Subjects || {});
570
+
571
+ // src/types/orderStatus.ts
572
+ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
573
+ OrderStatus2["Created"] = "created";
574
+ OrderStatus2["Cancelled"] = "cancelled";
575
+ OrderStatus2["AwaitingPayment"] = "awaiting:payment";
576
+ OrderStatus2["Complete"] = "complete";
577
+ return OrderStatus2;
578
+ })(OrderStatus || {});
566
579
  // Annotate the CommonJS export names for ESM import in node:
567
580
  0 && (module.exports = {
568
581
  AccessTokenError,
@@ -586,6 +599,7 @@ var Subjects = /* @__PURE__ */ ((Subjects2) => {
586
599
  NoEntryError,
587
600
  NoFoundResponse,
588
601
  NotFoundError,
602
+ OrderStatus,
589
603
  Password,
590
604
  Publisher,
591
605
  ResponseStatusCode,
@@ -596,6 +610,7 @@ var Subjects = /* @__PURE__ */ ((Subjects2) => {
596
610
  ValidationSource,
597
611
  asyncHandler,
598
612
  logger,
613
+ objectId,
599
614
  sanitizeObject,
600
615
  schemaValidator,
601
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
 
@@ -230,4 +231,11 @@ interface TicketUpdatedEvent {
230
231
  data: Ticket;
231
232
  }
232
233
 
233
- 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, type Pagination, Password, Publisher, ResponseStatusCode, StatusCode, Subjects, SuccessResponse, type TicketCreatedEvent, type TicketUpdatedEvent, TokenExpiredError, ValidationSource, asyncHandler, logger, sanitizeObject, schemaValidator, verifyToken };
234
+ declare enum OrderStatus {
235
+ Created = "created",
236
+ Cancelled = "cancelled",
237
+ AwaitingPayment = "awaiting:payment",
238
+ Complete = "complete"
239
+ }
240
+
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
 
@@ -230,4 +231,11 @@ interface TicketUpdatedEvent {
230
231
  data: Ticket;
231
232
  }
232
233
 
233
- 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, type Pagination, Password, Publisher, ResponseStatusCode, StatusCode, Subjects, SuccessResponse, type TicketCreatedEvent, type TicketUpdatedEvent, TokenExpiredError, ValidationSource, asyncHandler, logger, sanitizeObject, schemaValidator, verifyToken };
234
+ declare enum OrderStatus {
235
+ Created = "created",
236
+ Cancelled = "cancelled",
237
+ AwaitingPayment = "awaiting:payment",
238
+ Complete = "complete"
239
+ }
240
+
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";
@@ -494,6 +496,15 @@ var Subjects = /* @__PURE__ */ ((Subjects2) => {
494
496
  Subjects2["TicketUpdated"] = "ticket:updated";
495
497
  return Subjects2;
496
498
  })(Subjects || {});
499
+
500
+ // src/types/orderStatus.ts
501
+ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
502
+ OrderStatus2["Created"] = "created";
503
+ OrderStatus2["Cancelled"] = "cancelled";
504
+ OrderStatus2["AwaitingPayment"] = "awaiting:payment";
505
+ OrderStatus2["Complete"] = "complete";
506
+ return OrderStatus2;
507
+ })(OrderStatus || {});
497
508
  export {
498
509
  AccessTokenError,
499
510
  AccessTokenErrorResponse,
@@ -516,6 +527,7 @@ export {
516
527
  NoEntryError,
517
528
  NoFoundResponse,
518
529
  NotFoundError,
530
+ OrderStatus,
519
531
  Password,
520
532
  Publisher,
521
533
  ResponseStatusCode,
@@ -526,6 +538,7 @@ export {
526
538
  ValidationSource,
527
539
  asyncHandler,
528
540
  logger,
541
+ objectId,
529
542
  sanitizeObject,
530
543
  schemaValidator,
531
544
  verifyToken
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ajayjbtickets/common",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",