@konplit-services/common 1.0.32 → 1.0.34

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.
@@ -43,6 +43,22 @@ export declare const error_codes: {
43
43
  error_code: string;
44
44
  code: number;
45
45
  };
46
+ EMAIL_NOT_VERIFIED: {
47
+ error_code: string;
48
+ code: number;
49
+ };
50
+ EMAIL_ALREADY_EXIST: {
51
+ error_code: string;
52
+ code: number;
53
+ };
54
+ PHONE_NOT_VERIFIED: {
55
+ error_code: string;
56
+ code: number;
57
+ };
58
+ PHONE_ALREADY_EXIST: {
59
+ error_code: string;
60
+ code: number;
61
+ };
46
62
  ACCOUNT_NOT_FOUND: {
47
63
  error_code: string;
48
64
  code: number;
@@ -51,9 +67,6 @@ export declare const error_codes: {
51
67
  error_code: string;
52
68
  code: number;
53
69
  };
54
- EMAIL_NOT_VERIFIED: string;
55
- EMAIL_ALREADY_EXIST: string;
56
- PHONE_ALREADY_EXIST: string;
57
70
  BUSINESS_ACCOUNT_NOT_FOUND: string;
58
71
  PERMISSIONS_DENIED: string;
59
72
  INVALID_STATUS_VALUE: string;
@@ -47,6 +47,22 @@ exports.error_codes = {
47
47
  error_code: "USER_BLOCKED",
48
48
  code: 310003,
49
49
  },
50
+ EMAIL_NOT_VERIFIED: {
51
+ error_code: "EMAIL_NOT_VERIFIED",
52
+ code: 310004,
53
+ },
54
+ EMAIL_ALREADY_EXIST: {
55
+ error_code: "EMAIL_ALREADY_EXIST",
56
+ code: 310005,
57
+ },
58
+ PHONE_NOT_VERIFIED: {
59
+ error_code: "PHONE_NOT_VERIFIED",
60
+ code: 310006,
61
+ },
62
+ PHONE_ALREADY_EXIST: {
63
+ error_code: "PHONE_ALREADY_EXIST",
64
+ code: 310007,
65
+ },
50
66
  // ACCOUNT BLOCKED
51
67
  ACCOUNT_NOT_FOUND: {
52
68
  error_code: "ACCOUNT_NOT_FOUND",
@@ -56,9 +72,6 @@ exports.error_codes = {
56
72
  error_code: "ACCOUNT_BLOCKED",
57
73
  code: 320001,
58
74
  },
59
- EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED",
60
- EMAIL_ALREADY_EXIST: "EMAIL_ALREADY_EXIST",
61
- PHONE_ALREADY_EXIST: "PHONE_ALREADY_EXIST",
62
75
  BUSINESS_ACCOUNT_NOT_FOUND: "BUSINESS_ACCOUNT_NOT_FOUND",
63
76
  PERMISSIONS_DENIED: "PERMISSIONS_DENIED",
64
77
  INVALID_STATUS_VALUE: "INVALID_STATUS_VALUE",
@@ -3,6 +3,8 @@ export declare const lang: {
3
3
  user_not_found: string;
4
4
  invalid_user: string;
5
5
  user_exist: string;
6
+ user_email_not_verfied: string;
7
+ user_phone_not_verfied: string;
6
8
  invalid_key: string;
7
9
  invalid_code: string;
8
10
  server_error: string;
@@ -5,8 +5,11 @@ exports.email_lang = exports.merchant_dev_lang = exports.cus_support_lang = expo
5
5
  exports.lang = {
6
6
  verify_account: "Verify account",
7
7
  user_not_found: "user not found",
8
+ //user
8
9
  invalid_user: "invalid email or password",
9
10
  user_exist: "user already exists",
11
+ user_email_not_verfied: "user email not verified",
12
+ user_phone_not_verfied: "user phone not verified",
10
13
  invalid_key: "invalid key",
11
14
  invalid_code: "invalid code",
12
15
  // SERVICE DOWN
@@ -1,3 +1,4 @@
1
+ import { SignOptions } from "jsonwebtoken";
1
2
  export declare enum JWTType {
2
3
  REFRESH = "REFRESH",
3
4
  ACCESS = "ACCESS"
@@ -8,10 +9,11 @@ export interface JWT_Data {
8
9
  role: string;
9
10
  type: JWTType;
10
11
  accountId?: string;
12
+ adminId?: string;
11
13
  iat?: string;
12
14
  exp?: number;
13
15
  }
14
16
  export declare class JWT {
15
- static getToken(data: JWT_Data): Promise<string>;
17
+ static getToken(data: JWT_Data, options?: SignOptions): Promise<string>;
16
18
  static verifyToken(token: string): Promise<JWT_Data>;
17
19
  }
@@ -23,10 +23,9 @@ var JWTType;
23
23
  })(JWTType = exports.JWTType || (exports.JWTType = {}));
24
24
  const secret = process.env.JWT_KEY;
25
25
  class JWT {
26
- static getToken(data) {
26
+ static getToken(data, options = {}) {
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
- const token = (yield signAsync(data, secret));
29
- return token;
28
+ return signAsync(data, secret, options);
30
29
  });
31
30
  }
32
31
  static verifyToken(token) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",