@baticketing/common
Advanced tools
Comparing version 1.0.8 to 1.0.15
import { CustomError } from './custom-error'; | ||
export declare class BadRequestError extends CustomError { | ||
readonly message: string; | ||
message: string; | ||
statusCode: number; | ||
@@ -5,0 +5,0 @@ constructor(message: string); |
@@ -27,7 +27,3 @@ "use strict"; | ||
BadRequestError.prototype.serializeErrors = function () { | ||
return [ | ||
{ | ||
message: this.message, | ||
}, | ||
]; | ||
return [{ message: this.message }]; | ||
}; | ||
@@ -34,0 +30,0 @@ return BadRequestError; |
@@ -1,2 +0,2 @@ | ||
import { CustomError } from "./custom-error"; | ||
import { CustomError } from './custom-error'; | ||
export declare class DatabaseConnectionError extends CustomError { | ||
@@ -3,0 +3,0 @@ statusCode: number; |
@@ -20,16 +20,10 @@ "use strict"; | ||
function DatabaseConnectionError() { | ||
var _newTarget = this.constructor; | ||
var _this = _super.call(this, 'Error connecting to db') || this; | ||
_this.statusCode = 500; | ||
_this.reason = 'Error connecting to database'; | ||
// Object.setPrototypeOf(this, DatabaseConnectionError.prototype); | ||
Object.setPrototypeOf(_this, _newTarget.prototype); | ||
Object.setPrototypeOf(_this, DatabaseConnectionError.prototype); | ||
return _this; | ||
} | ||
DatabaseConnectionError.prototype.serializeErrors = function () { | ||
return [ | ||
{ | ||
message: this.reason, | ||
}, | ||
]; | ||
return [{ message: this.reason }]; | ||
}; | ||
@@ -36,0 +30,0 @@ return DatabaseConnectionError; |
@@ -1,2 +0,2 @@ | ||
import { CustomError } from "./custom-error"; | ||
import { CustomError } from './custom-error'; | ||
export declare class NotAuthorizedError extends CustomError { | ||
@@ -3,0 +3,0 @@ statusCode: number; |
@@ -26,7 +26,3 @@ "use strict"; | ||
NotAuthorizedError.prototype.serializeErrors = function () { | ||
return [ | ||
{ | ||
message: 'Not Authorized' | ||
} | ||
]; | ||
return [{ message: 'Not authorized' }]; | ||
}; | ||
@@ -33,0 +29,0 @@ return NotAuthorizedError; |
@@ -26,7 +26,3 @@ "use strict"; | ||
NotFoundError.prototype.serializeErrors = function () { | ||
return [ | ||
{ | ||
message: 'Not Found', | ||
}, | ||
]; | ||
return [{ message: 'Not Found' }]; | ||
}; | ||
@@ -33,0 +29,0 @@ return NotFoundError; |
@@ -29,6 +29,3 @@ "use strict"; | ||
return this.errors.map(function (err) { | ||
return { | ||
message: err.msg, | ||
field: err.param, | ||
}; | ||
return { message: err.msg, field: err.param }; | ||
}); | ||
@@ -35,0 +32,0 @@ }; |
@@ -11,6 +11,6 @@ "use strict"; | ||
.subscriptionOptions() | ||
.setDeliverAllAvailable() | ||
.setManualAckMode(true) | ||
.setDeliverAllAvailable() | ||
.setDurableName(this.queueGroupName) | ||
.setAckWait(this.ackWait); | ||
.setAckWait(this.ackWait) | ||
.setDurableName(this.queueGroupName); | ||
}; | ||
@@ -21,4 +21,5 @@ Listener.prototype.listen = function () { | ||
subscription.on('message', function (msg) { | ||
console.log("Message received on " + _this.subject + " / " + _this.queueGroupName); | ||
_this.onMessage(_this.parseMessage(msg), msg); | ||
console.log("Message received: " + _this.subject + " / " + _this.queueGroupName); | ||
var parsedData = _this.parseMessage(msg); | ||
_this.onMessage(parsedData, msg); | ||
}); | ||
@@ -25,0 +26,0 @@ }; |
@@ -0,3 +1,3 @@ | ||
import { Stan } from 'node-nats-streaming'; | ||
import { Subjects } from './subjects'; | ||
import { Stan } from 'node-nats-streaming'; | ||
interface Event { | ||
@@ -8,4 +8,4 @@ subject: Subjects; | ||
export declare abstract class Publisher<T extends Event> { | ||
abstract subject: T['subject']; | ||
private client; | ||
abstract subject: T['subject']; | ||
constructor(client: Stan); | ||
@@ -12,0 +12,0 @@ publish(data: T['data']): Promise<void>; |
export declare enum OrderStatus { | ||
Created = "createtd", | ||
Created = "created", | ||
Cancelled = "cancelled", | ||
@@ -4,0 +4,0 @@ AwaitingPayment = "awaiting:payment", |
@@ -7,5 +7,5 @@ "use strict"; | ||
// ticket it is trying to order has not been reserved | ||
OrderStatus["Created"] = "createtd"; | ||
// The ticket the order os trying to reserve has already | ||
// been reserved, ord when the user has cancelled the order. | ||
OrderStatus["Created"] = "created"; | ||
// The ticket the order is trying to reserve has already | ||
// been reserved, or when the user has cancelled the order. | ||
// The order expires before payment | ||
@@ -12,0 +12,0 @@ OrderStatus["Cancelled"] = "cancelled"; |
@@ -7,6 +7,6 @@ export * from './errors/bad-request-error'; | ||
export * from './errors/request-validation-error'; | ||
export * from './middleware/current-user'; | ||
export * from './middleware/error-handler'; | ||
export * from './middleware/require-auth'; | ||
export * from './middleware/validate-request'; | ||
export * from './middlewares/current-user'; | ||
export * from './middlewares/error-handler'; | ||
export * from './middlewares/require-auth'; | ||
export * from './middlewares/validate-request'; | ||
export * from './events/base-listener'; | ||
@@ -13,0 +13,0 @@ export * from './events/base-publisher'; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Re-export stuff from errors and middlewares | ||
__export(require("./errors/bad-request-error")); | ||
@@ -13,6 +14,6 @@ __export(require("./errors/custom-error")); | ||
__export(require("./errors/request-validation-error")); | ||
__export(require("./middleware/current-user")); | ||
__export(require("./middleware/error-handler")); | ||
__export(require("./middleware/require-auth")); | ||
__export(require("./middleware/validate-request")); | ||
__export(require("./middlewares/current-user")); | ||
__export(require("./middlewares/error-handler")); | ||
__export(require("./middlewares/require-auth")); | ||
__export(require("./middlewares/validate-request")); | ||
__export(require("./events/base-listener")); | ||
@@ -19,0 +20,0 @@ __export(require("./events/base-publisher")); |
{ | ||
"name": "@baticketing/common", | ||
"version": "1.0.8", | ||
"version": "1.0.15", | ||
"description": "", | ||
@@ -8,7 +8,7 @@ "main": "./build/index.js", | ||
"files": [ | ||
"/build/**/*" | ||
"build/**/*" | ||
], | ||
"scripts": { | ||
"clean": "del ./build/*", | ||
"build": "npm run clean && tsc", | ||
"clean": "del ./build", | ||
"pub": "git add . && git commit -m \"Updates\" && npm version patch && npm run build && npm publish" | ||
@@ -25,10 +25,10 @@ }, | ||
"@types/cookie-session": "^2.0.39", | ||
"@types/express": "^4.17.6", | ||
"@types/express": "^4.17.5", | ||
"@types/jsonwebtoken": "^8.3.9", | ||
"cookie-session": "^1.4.0", | ||
"express": "^4.17.1", | ||
"express-validator": "^6.4.1", | ||
"express-validator": "^6.4.0", | ||
"jsonwebtoken": "^8.5.1", | ||
"node-nats-streaming": "^0.3.2" | ||
"node-nats-streaming": "^0.2.6" | ||
} | ||
} |
19443
483
+ Addednode-nats-streaming@0.2.6(transitive)
- Removednode-nats-streaming@0.3.2(transitive)
Updated@types/express@^4.17.5
Updatedexpress-validator@^6.4.0
Updatednode-nats-streaming@^0.2.6