@konplit-services/common 1.0.206 → 1.0.208

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.
@@ -143,4 +143,8 @@ export declare const error_codes: {
143
143
  error_code: string;
144
144
  code: number;
145
145
  };
146
+ GATEWAY_ERROR: {
147
+ error_code: string;
148
+ code: number;
149
+ };
146
150
  };
@@ -151,4 +151,8 @@ exports.error_codes = {
151
151
  error_code: "SERVER_ERROR",
152
152
  code: 500000,
153
153
  },
154
+ GATEWAY_ERROR: {
155
+ error_code: "GATEWAY_ERROR",
156
+ code: 500002,
157
+ },
154
158
  };
@@ -13,6 +13,7 @@ export declare const lang: {
13
13
  invalid_code: string;
14
14
  invalid_auth_key: string;
15
15
  server_error: string;
16
+ gateway_error: string;
16
17
  not_authorized: string;
17
18
  forbidden: string;
18
19
  account_blocked: string;
@@ -19,7 +19,8 @@ exports.lang = {
19
19
  invalid_auth_key: "invalid authorization key provided",
20
20
  //account
21
21
  // SERVICE DOWN
22
- server_error: "server error please again letter",
22
+ server_error: "Server error please again later",
23
+ gateway_error: "Sorry, something went wrong. The server is temporarily unable to process your request.",
23
24
  //Authorization
24
25
  not_authorized: "you are not authorized. authenticate and try again",
25
26
  forbidden: "You don't have permission to access this resource",
@@ -8,6 +8,7 @@ import { JetStreamClient } from "nats";
8
8
  import { LOGACTIONS } from "../log-activities/actions";
9
9
  import { JWT_Data } from "./Jwt";
10
10
  import { EmailValidationTypes, SMSTYPE } from "../notification";
11
+ import { GatewayError } from "../errors";
11
12
  interface User {
12
13
  id?: string;
13
14
  email?: string;
@@ -22,6 +23,7 @@ export declare class Service {
22
23
  protected NotAuthorizedError: typeof NotAuthorizedError;
23
24
  protected ServiceNotAvailableError: typeof ServiceNotAvailableError;
24
25
  protected AxiosRequestError: typeof AxiosRequestError;
26
+ protected GatewayError: typeof GatewayError;
25
27
  activityLog(client: JetStreamClient, user: Partial<User> | Partial<JWT_Data>, action: LOGACTIONS, data: any): void;
26
28
  merchantOnlyLogs(client: JetStreamClient, user: Partial<User> | Partial<JWT_Data>, action: LOGACTIONS, data: any): void;
27
29
  sendSMS(token: string, type: SMSTYPE, data: any, client: JetStreamClient): void;
@@ -15,6 +15,7 @@ const app_configs_1 = require("../app.configs");
15
15
  const util_1 = require("../util");
16
16
  const email_publisher_1 = require("../events/publisher/email.publisher");
17
17
  const sms_publisher_1 = require("../events/publisher/sms.publisher");
18
+ const errors_1 = require("../errors");
18
19
  class Service {
19
20
  constructor() {
20
21
  this.NotFoundError = not_found_1.NotFoundError;
@@ -23,6 +24,7 @@ class Service {
23
24
  this.NotAuthorizedError = notAuthorized_1.NotAuthorizedError;
24
25
  this.ServiceNotAvailableError = service_not_available_1.ServiceNotAvailableError;
25
26
  this.AxiosRequestError = axios_request_error_1.AxiosRequestError;
27
+ this.GatewayError = errors_1.GatewayError;
26
28
  }
27
29
  activityLog(client, user, action, data) {
28
30
  if (Object.values(helper_1.AdminRoles).includes(user.role)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.0.206",
3
+ "version": "1.0.208",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",