auth-mn 0.2.0 → 1.0.0

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.
package/dist/find.d.ts DELETED
@@ -1,208 +0,0 @@
1
- export declare const genders: readonly ["MEN", "WOMEN"];
2
- export type Gender = (typeof genders)[number];
3
- export interface UserEmailItem {
4
- email: string;
5
- verified: boolean;
6
- primary: boolean;
7
- }
8
- export interface UserPhoneItem {
9
- number: string;
10
- verified: boolean;
11
- primary: boolean;
12
- }
13
- export interface UserAuthProfiles {
14
- facebook_id?: string | null;
15
- google_id?: string | null;
16
- steam_id?: string | null;
17
- apple_id?: string | null;
18
- twitter_id?: string | null;
19
- monpay_id?: string | null;
20
- toki_id?: string | null;
21
- social_id?: string | null;
22
- hipay_id?: string | null;
23
- digi_id?: string | null;
24
- }
25
- export interface UserPreferences {
26
- language: string;
27
- notifications: boolean;
28
- }
29
- export interface UserStatus {
30
- is_active: boolean;
31
- is_banned: boolean;
32
- verified: boolean;
33
- }
34
- export interface UserSecurity {
35
- password_hash: string;
36
- two_factor_enabled: boolean;
37
- last_password_change: Date | null;
38
- }
39
- export interface UserVerifyInfo {
40
- first_name: string;
41
- last_name: string;
42
- born_date: Date | null;
43
- national_id: string;
44
- }
45
- export interface UserAppItem {
46
- app_name: string;
47
- app_id: string;
48
- device_id: string;
49
- }
50
- export interface UserWalletItem {
51
- key_id: string;
52
- wallet_id: string;
53
- wallet_key: string;
54
- wallet_type: string;
55
- wallet_name: string;
56
- role: string[];
57
- }
58
- type UserT = {
59
- user_id: number;
60
- user_name: string;
61
- nick_name: string;
62
- exp: number;
63
- primary_email?: string | null;
64
- primary_phone?: string | null;
65
- emails: UserEmailItem[];
66
- phone_numbers: UserPhoneItem[];
67
- auth_profiles: UserAuthProfiles;
68
- profile_image_url: string;
69
- date_of_birth: Date | null;
70
- gender?: Gender;
71
- sign_up_date: Date | null;
72
- last_login: Date | null;
73
- wallets: UserWalletItem[];
74
- preferences: UserPreferences;
75
- status: UserStatus;
76
- security: UserSecurity;
77
- verify_info: UserVerifyInfo;
78
- dynamic_info: Record<string, any>;
79
- apps: UserAppItem[];
80
- search_string?: string;
81
- delFlg?: boolean;
82
- order_index?: number;
83
- };
84
- type MerchantT = {
85
- _id?: string;
86
- user_id: number;
87
- user_name?: string;
88
- phone_number?: string;
89
- user_role?: "merchant" | "sub-merchant";
90
- avatar?: string;
91
- authority?: string[];
92
- user_email?: string;
93
- password?: string;
94
- show_router?: string[];
95
- show_id?: string[];
96
- merchant: {
97
- toki_id: string;
98
- hipay: string;
99
- };
100
- wallet_id?: string;
101
- wallet_key?: string;
102
- delFlg?: boolean;
103
- createdAt?: Date;
104
- updatedAt?: Date;
105
- };
106
- type AdminT = {
107
- _id?: string;
108
- user_id?: number;
109
- user_name?: string;
110
- phone_number?: number;
111
- user_role?: "admin" | "sub-admin" | "super-admin";
112
- avatar?: string;
113
- authority?: string[];
114
- user_email?: string;
115
- password?: string;
116
- show_router?: string[];
117
- show_id?: string[];
118
- delFlg?: boolean;
119
- createdAt?: Date;
120
- updatedAt?: Date;
121
- };
122
- type ClientT = {
123
- _id?: string;
124
- user_id?: number;
125
- user_name?: string;
126
- phone_number?: number;
127
- user_role?: "crm" | "sub-crm";
128
- avatar?: string;
129
- authority?: string[];
130
- user_email?: string;
131
- password?: string;
132
- show_router?: string[];
133
- show_id?: string[];
134
- RefundFun?: boolean;
135
- delFlg?: boolean;
136
- createdAt?: Date;
137
- updatedAt?: Date;
138
- };
139
- type CrmT = {
140
- _id?: string;
141
- user_id?: number;
142
- user_name?: string;
143
- phone_number?: number;
144
- user_role?: "crm" | "sub-crm";
145
- avatar?: string;
146
- authority?: string[];
147
- user_email?: string;
148
- password?: string;
149
- show_router?: string[];
150
- show_id?: string[];
151
- RefundFun?: boolean;
152
- delFlg?: boolean;
153
- createdAt?: Date;
154
- updatedAt?: Date;
155
- };
156
- export declare const USER: (body: UserT) => Promise<{
157
- success: boolean;
158
- data: UserT[];
159
- message: string;
160
- }>;
161
- export declare const MERCHANT: (body: MerchantT) => Promise<{
162
- success: boolean;
163
- data: MerchantT[];
164
- message: string;
165
- }>;
166
- export declare const ADMIN: (body: AdminT) => Promise<{
167
- success: boolean;
168
- data: AdminT[];
169
- message: string;
170
- }>;
171
- export declare const CLIENT: (body: ClientT) => Promise<{
172
- success: boolean;
173
- data: ClientT[];
174
- message: string;
175
- }>;
176
- export declare const CRM: (body: CrmT) => Promise<{
177
- success: boolean;
178
- data: CrmT[];
179
- message: string;
180
- }>;
181
- declare const _default: {
182
- USER: (body: UserT) => Promise<{
183
- success: boolean;
184
- data: UserT[];
185
- message: string;
186
- }>;
187
- MERCHANT: (body: MerchantT) => Promise<{
188
- success: boolean;
189
- data: MerchantT[];
190
- message: string;
191
- }>;
192
- ADMIN: (body: AdminT) => Promise<{
193
- success: boolean;
194
- data: AdminT[];
195
- message: string;
196
- }>;
197
- CLIENT: (body: ClientT) => Promise<{
198
- success: boolean;
199
- data: ClientT[];
200
- message: string;
201
- }>;
202
- CRM: (body: CrmT) => Promise<{
203
- success: boolean;
204
- data: CrmT[];
205
- message: string;
206
- }>;
207
- };
208
- export default _default;
package/dist/find.js DELETED
@@ -1,256 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CRM = exports.CLIENT = exports.ADMIN = exports.MERCHANT = exports.USER = exports.genders = void 0;
4
- const _1 = require(".");
5
- const auth_1 = require("./auth");
6
- const axios_master_1 = require("axios-master");
7
- /* -----------------------------
8
- * Enums
9
- * ----------------------------- */
10
- exports.genders = ["MEN", "WOMEN"];
11
- const USER = async (body) => {
12
- var _a;
13
- try {
14
- const result = await (0, axios_master_1.axiosMasterLogger)({
15
- method: "POST",
16
- maxBodyLength: Infinity,
17
- url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/user`,
18
- headers: {
19
- Accept: "application/json",
20
- "Content-Type": "application/json",
21
- Authorization: `Bearer ${_1.config.token}`
22
- },
23
- data: body
24
- }, {
25
- name: "support/find/user",
26
- timeout: 20000,
27
- retryFunction: auth_1.getToken,
28
- shouldRetry: true,
29
- shouldRetryStatus: [401, 400],
30
- logger(data) {
31
- if (_1.config.logger) {
32
- console.log({
33
- time: data.json.time,
34
- request: data.json.request,
35
- response: `${data.json.response}`,
36
- responseBody: data.json.responseBody,
37
- statusCode: data.json.statusCode
38
- });
39
- }
40
- }
41
- });
42
- return { success: true, data: result.data, message: result.message };
43
- }
44
- catch (error) {
45
- const axiosError = error;
46
- if (axiosError.data) {
47
- console.log(axiosError.data);
48
- }
49
- else {
50
- console.error("Request Failed:", axiosError);
51
- }
52
- return {
53
- success: false,
54
- data: [],
55
- message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
56
- };
57
- }
58
- };
59
- exports.USER = USER;
60
- const MERCHANT = async (body) => {
61
- var _a;
62
- try {
63
- const result = await (0, axios_master_1.axiosMasterLogger)({
64
- method: "POST",
65
- maxBodyLength: Infinity,
66
- url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/merchant`,
67
- headers: {
68
- Accept: "application/json",
69
- "Content-Type": "application/json",
70
- Authorization: `Bearer ${_1.config.token}`
71
- },
72
- data: body
73
- }, {
74
- name: "support/find/merchant",
75
- timeout: 20000,
76
- retryFunction: auth_1.getToken,
77
- shouldRetry: true,
78
- shouldRetryStatus: [401, 400],
79
- logger(data) {
80
- if (_1.config.logger) {
81
- console.log({
82
- time: data.json.time,
83
- request: data.json.request,
84
- response: `${data.json.response}`,
85
- responseBody: data.json.responseBody,
86
- statusCode: data.json.statusCode
87
- });
88
- }
89
- }
90
- });
91
- return { success: true, data: result.data, message: result.message };
92
- }
93
- catch (error) {
94
- const axiosError = error;
95
- if (axiosError.data) {
96
- console.log(axiosError.data);
97
- }
98
- else {
99
- console.error("Request Failed:", axiosError);
100
- }
101
- return {
102
- success: false,
103
- data: [],
104
- message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
105
- };
106
- }
107
- };
108
- exports.MERCHANT = MERCHANT;
109
- const ADMIN = async (body) => {
110
- var _a;
111
- try {
112
- const result = await (0, axios_master_1.axiosMasterLogger)({
113
- method: "POST",
114
- maxBodyLength: Infinity,
115
- url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/admin`,
116
- headers: {
117
- Accept: "application/json",
118
- "Content-Type": "application/json",
119
- Authorization: `Bearer ${_1.config.token}`
120
- },
121
- data: body
122
- }, {
123
- name: "support/find/admin",
124
- timeout: 20000,
125
- retryFunction: auth_1.getToken,
126
- shouldRetry: true,
127
- shouldRetryStatus: [401, 400],
128
- logger(data) {
129
- if (_1.config.logger) {
130
- console.log({
131
- time: data.json.time,
132
- request: data.json.request,
133
- response: `${data.json.response}`,
134
- responseBody: data.json.responseBody,
135
- statusCode: data.json.statusCode
136
- });
137
- }
138
- }
139
- });
140
- return { success: true, data: result.data, message: result.message };
141
- }
142
- catch (error) {
143
- const axiosError = error;
144
- if (axiosError.data) {
145
- console.log(axiosError.data);
146
- }
147
- else {
148
- console.error("Request Failed:", axiosError);
149
- }
150
- return {
151
- success: false,
152
- data: [],
153
- message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
154
- };
155
- }
156
- };
157
- exports.ADMIN = ADMIN;
158
- const CLIENT = async (body) => {
159
- var _a;
160
- try {
161
- const result = await (0, axios_master_1.axiosMasterLogger)({
162
- method: "POST",
163
- maxBodyLength: Infinity,
164
- url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/client`,
165
- headers: {
166
- Accept: "application/json",
167
- "Content-Type": "application/json",
168
- Authorization: `Bearer ${_1.config.token}`
169
- },
170
- data: body
171
- }, {
172
- name: "support/find/client",
173
- timeout: 20000,
174
- retryFunction: auth_1.getToken,
175
- shouldRetry: true,
176
- shouldRetryStatus: [401, 400],
177
- logger(data) {
178
- if (_1.config.logger) {
179
- console.log({
180
- time: data.json.time,
181
- request: data.json.request,
182
- response: `${data.json.response}`,
183
- responseBody: data.json.responseBody,
184
- statusCode: data.json.statusCode
185
- });
186
- }
187
- }
188
- });
189
- return { success: true, data: result.data, message: result.message };
190
- }
191
- catch (error) {
192
- const axiosError = error;
193
- if (axiosError.data) {
194
- console.log(axiosError.data);
195
- }
196
- else {
197
- console.error("Request Failed:", axiosError);
198
- }
199
- return {
200
- success: false,
201
- data: [],
202
- message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
203
- };
204
- }
205
- };
206
- exports.CLIENT = CLIENT;
207
- const CRM = async (body) => {
208
- var _a;
209
- try {
210
- const result = await (0, axios_master_1.axiosMasterLogger)({
211
- method: "POST",
212
- maxBodyLength: Infinity,
213
- url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/crm`,
214
- headers: {
215
- Accept: "application/json",
216
- "Content-Type": "application/json",
217
- Authorization: `Bearer ${_1.config.token}`
218
- },
219
- data: body
220
- }, {
221
- name: "support/find/crm",
222
- timeout: 20000,
223
- retryFunction: auth_1.getToken,
224
- shouldRetry: true,
225
- shouldRetryStatus: [401, 400],
226
- logger(data) {
227
- if (_1.config.logger) {
228
- console.log({
229
- time: data.json.time,
230
- request: data.json.request,
231
- response: `${data.json.response}`,
232
- responseBody: data.json.responseBody,
233
- statusCode: data.json.statusCode
234
- });
235
- }
236
- }
237
- });
238
- return { success: true, data: result.data, message: result.message };
239
- }
240
- catch (error) {
241
- const axiosError = error;
242
- if (axiosError.data) {
243
- console.log(axiosError.data);
244
- }
245
- else {
246
- console.error("Request Failed:", axiosError);
247
- }
248
- return {
249
- success: false,
250
- data: [],
251
- message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
252
- };
253
- }
254
- };
255
- exports.CRM = CRM;
256
- exports.default = { USER: exports.USER, MERCHANT: exports.MERCHANT, ADMIN: exports.ADMIN, CLIENT: exports.CLIENT, CRM: exports.CRM };