@thebester/common 1.0.14 → 1.0.16

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.
@@ -1,4 +1,4 @@
1
- import { CustomError } from "./custom-error";
1
+ import { CustomError } from "./custom-error.js";
2
2
  export declare class BadRequestError extends CustomError {
3
3
  message: string;
4
4
  statusCode: number;
@@ -1,4 +1,4 @@
1
- import { CustomError } from "./custom-error";
1
+ import { CustomError } from "./custom-error.js";
2
2
  export class BadRequestError extends CustomError {
3
3
  constructor(message) {
4
4
  super(message);
@@ -1,4 +1,4 @@
1
- import { CustomError } from "./custom-error";
1
+ import { CustomError } from "./custom-error.js";
2
2
  export declare class DatabaseConnectionError extends CustomError {
3
3
  statusCode: number;
4
4
  reason: string;
@@ -1,4 +1,4 @@
1
- import { CustomError } from "./custom-error";
1
+ import { CustomError } from "./custom-error.js";
2
2
  export class DatabaseConnectionError extends CustomError {
3
3
  constructor() {
4
4
  super("Error connecting to database");
@@ -1,4 +1,4 @@
1
- import { CustomError } from "./custom-error";
1
+ import { CustomError } from "./custom-error.js";
2
2
  export declare class NotAuthorizedError extends CustomError {
3
3
  statusCode: number;
4
4
  constructor();
@@ -1,4 +1,4 @@
1
- import { CustomError } from "./custom-error";
1
+ import { CustomError } from "./custom-error.js";
2
2
  export class NotAuthorizedError extends CustomError {
3
3
  constructor() {
4
4
  super("Not authorized");
@@ -1,4 +1,4 @@
1
- import { CustomError } from "./custom-error";
1
+ import { CustomError } from "./custom-error.js";
2
2
  export declare class NotFoundError extends CustomError {
3
3
  statusCode: number;
4
4
  constructor();
@@ -1,4 +1,4 @@
1
- import { CustomError } from "./custom-error";
1
+ import { CustomError } from "./custom-error.js";
2
2
  export class NotFoundError extends CustomError {
3
3
  constructor() {
4
4
  super("Route not found");
@@ -1,5 +1,5 @@
1
1
  import type { ValidationError } from "express-validator";
2
- import { CustomError } from "./custom-error";
2
+ import { CustomError } from "./custom-error.js";
3
3
  export declare class RequestValidationError extends CustomError {
4
4
  errors: ValidationError[];
5
5
  statusCode: number;
@@ -1,4 +1,4 @@
1
- import { CustomError } from "./custom-error";
1
+ import { CustomError } from "./custom-error.js";
2
2
  export class RequestValidationError extends CustomError {
3
3
  constructor(errors) {
4
4
  super("Invalid request parameters");
package/build/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export * from "./errors/bad-request-error";
2
- export * from "./errors/custom-error";
3
- export * from "./errors/database-connection-error";
4
- export * from "./errors/not-authorized-error";
5
- export * from "./errors/not-found-error";
6
- export * from "./errors/request-validation-error";
7
- export * from "./middelwares/current-user";
8
- export * from "./middelwares/error-handler";
9
- export * from "./middelwares/require-auth";
10
- export * from "./middelwares/validate-request";
1
+ export * from "./errors/bad-request-error.js";
2
+ export * from "./errors/custom-error.js";
3
+ export * from "./errors/database-connection-error.js";
4
+ export * from "./errors/not-authorized-error.js";
5
+ export * from "./errors/not-found-error.js";
6
+ export * from "./errors/request-validation-error.js";
7
+ export * from "./middelwares/current-user.js";
8
+ export * from "./middelwares/error-handler.js";
9
+ export * from "./middelwares/require-auth.js";
10
+ export * from "./middelwares/validate-request.js";
package/build/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // Re-export stuff from errors and middlewares
2
- export * from "./errors/bad-request-error";
3
- export * from "./errors/custom-error";
4
- export * from "./errors/database-connection-error";
5
- export * from "./errors/not-authorized-error";
6
- export * from "./errors/not-found-error";
7
- export * from "./errors/request-validation-error";
8
- export * from "./middelwares/current-user";
9
- export * from "./middelwares/error-handler";
10
- export * from "./middelwares/require-auth";
11
- export * from "./middelwares/validate-request";
2
+ export * from "./errors/bad-request-error.js";
3
+ export * from "./errors/custom-error.js";
4
+ export * from "./errors/database-connection-error.js";
5
+ export * from "./errors/not-authorized-error.js";
6
+ export * from "./errors/not-found-error.js";
7
+ export * from "./errors/request-validation-error.js";
8
+ export * from "./middelwares/current-user.js";
9
+ export * from "./middelwares/error-handler.js";
10
+ export * from "./middelwares/require-auth.js";
11
+ export * from "./middelwares/validate-request.js";
@@ -1,4 +1,4 @@
1
- import { CustomError } from "../errors/custom-error";
1
+ import { CustomError } from "../errors/custom-error.js";
2
2
  export const errorHandler = (err, req, res, next) => {
3
3
  if (err instanceof CustomError) {
4
4
  return res.status(err.statusCode).send({ errors: err.serializeErrors() });
@@ -1,4 +1,4 @@
1
- import { NotAuthorizedError } from "../errors/not-authorized-error";
1
+ import { NotAuthorizedError } from "../errors/not-authorized-error.js";
2
2
  export const requireAuth = (req, res, next) => {
3
3
  if (!req.currentUser) {
4
4
  throw new NotAuthorizedError();
@@ -1,5 +1,5 @@
1
1
  import { validationResult } from "express-validator";
2
- import { RequestValidationError } from "../errors/request-validation-error";
2
+ import { RequestValidationError } from "../errors/request-validation-error.js";
3
3
  export const validateRequest = (req, res, next) => {
4
4
  const errors = validationResult(req);
5
5
  if (!errors.isEmpty()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thebester/common",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",