@sn1006/common 1.0.35 → 1.0.37

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.
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const custom_error_1 = __importDefault(require("./custom-error"));
7
7
  class CustomValidationError extends custom_error_1.default {
8
8
  constructor(errors) {
9
- super("Invalid username or password");
9
+ super("Validation error");
10
10
  this.errors = errors;
11
11
  this.status = 400;
12
12
  Object.setPrototypeOf(this, CustomValidationError.prototype);
@@ -0,0 +1,9 @@
1
+ import { Subjects } from "./subjects";
2
+ export interface PaymentCreatedEvent {
3
+ subject: Subjects.PaymentCreated;
4
+ data: {
5
+ id: string;
6
+ orderId: string;
7
+ stripeId: string;
8
+ };
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,5 +3,6 @@ export declare enum Subjects {
3
3
  TicketUpdated = "ticket:updated",
4
4
  OrderCreated = "order:created",
5
5
  OrderCancelled = "order:cancelled",
6
- ExpirationCompleted = "expiration:completed"
6
+ ExpirationCompleted = "expiration:completed",
7
+ PaymentCreated = "payment:created"
7
8
  }
@@ -8,4 +8,5 @@ var Subjects;
8
8
  Subjects["OrderCreated"] = "order:created";
9
9
  Subjects["OrderCancelled"] = "order:cancelled";
10
10
  Subjects["ExpirationCompleted"] = "expiration:completed";
11
+ Subjects["PaymentCreated"] = "payment:created";
11
12
  })(Subjects || (exports.Subjects = Subjects = {}));
package/build/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export * from './middlewares/current-user';
8
8
  export * from './middlewares/error-handler';
9
9
  export * from './middlewares/require-auth';
10
10
  export * from './middlewares/validate-request';
11
+ export * from './middlewares/async-wrapper';
11
12
  export * from './events/base-listener';
12
13
  export * from './events/base-publisher';
13
14
  export * from './events/subjects';
@@ -17,3 +18,4 @@ export * from './events/types/order-status';
17
18
  export * from './events/order-cancelled-event';
18
19
  export * from './events/order-created-event';
19
20
  export * from './events/expiration-complete-event';
21
+ export * from './events/payment-created-event';
package/build/index.js CHANGED
@@ -24,6 +24,7 @@ __exportStar(require("./middlewares/current-user"), exports);
24
24
  __exportStar(require("./middlewares/error-handler"), exports);
25
25
  __exportStar(require("./middlewares/require-auth"), exports);
26
26
  __exportStar(require("./middlewares/validate-request"), exports);
27
+ __exportStar(require("./middlewares/async-wrapper"), exports);
27
28
  __exportStar(require("./events/base-listener"), exports);
28
29
  __exportStar(require("./events/base-publisher"), exports);
29
30
  __exportStar(require("./events/subjects"), exports);
@@ -33,3 +34,4 @@ __exportStar(require("./events/types/order-status"), exports);
33
34
  __exportStar(require("./events/order-cancelled-event"), exports);
34
35
  __exportStar(require("./events/order-created-event"), exports);
35
36
  __exportStar(require("./events/expiration-complete-event"), exports);
37
+ __exportStar(require("./events/payment-created-event"), exports);
@@ -0,0 +1,4 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ type AsyncRequestHandler = (req: Request, res: Response, next: NextFunction) => Promise<any>;
3
+ export declare const asyncWrapper: (fn: AsyncRequestHandler) => (req: Request, res: Response, next: NextFunction) => void;
4
+ export {};
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asyncWrapper = void 0;
4
+ const asyncWrapper = (fn) => (req, res, next) => {
5
+ Promise.resolve(fn(req, res, next).catch(next));
6
+ };
7
+ exports.asyncWrapper = asyncWrapper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sn1006/common",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",