auth-mn 0.1.3 → 0.1.4

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 ADDED
@@ -0,0 +1,193 @@
1
+ type UserT = {
2
+ _id?: string;
3
+ user_id?: number;
4
+ user_name?: string;
5
+ nick_name?: string;
6
+ exp?: number;
7
+ primary_email?: string;
8
+ primary_phone?: string;
9
+ emails?: Array<{
10
+ email: string;
11
+ verified: boolean;
12
+ primary: boolean;
13
+ }>;
14
+ phone_numbers?: Array<{
15
+ number: string;
16
+ verified: boolean;
17
+ primary: boolean;
18
+ }>;
19
+ auth_profiles?: {
20
+ facebook_id?: string;
21
+ google_id?: string;
22
+ steam_id?: string;
23
+ apple_id?: string;
24
+ twitter_id?: string;
25
+ monpay_id?: string;
26
+ toki_id?: string;
27
+ social_id?: string;
28
+ hipay_id?: string;
29
+ digi_id?: string;
30
+ };
31
+ profile_image_url?: string;
32
+ date_of_birth?: Date;
33
+ gender?: "MEN" | "WOMEN";
34
+ sign_up_date?: Date;
35
+ last_login?: Date;
36
+ wallet_id?: string;
37
+ wallet_key?: string;
38
+ preferences?: {
39
+ language?: string;
40
+ notifications?: boolean;
41
+ };
42
+ status?: {
43
+ is_active?: boolean;
44
+ is_banned?: boolean;
45
+ verified?: boolean;
46
+ };
47
+ security?: {
48
+ password_hash?: string;
49
+ two_factor_enabled?: boolean;
50
+ last_password_change?: Date;
51
+ };
52
+ verify_info?: {
53
+ first_name?: string;
54
+ last_name?: string;
55
+ born_date?: Date;
56
+ national_id?: string;
57
+ };
58
+ dynamic_info?: {
59
+ [key: string]: any;
60
+ };
61
+ apps?: {
62
+ app_name: string;
63
+ app_id: string;
64
+ device_id: string;
65
+ }[];
66
+ createdAt?: Date;
67
+ updatedAt?: Date;
68
+ };
69
+ type MerchantT = {
70
+ _id?: string;
71
+ user_id: number;
72
+ user_name?: string;
73
+ phone_number?: string;
74
+ user_role?: "merchant" | "sub-merchant";
75
+ avatar?: string;
76
+ authority?: string[];
77
+ user_email?: string;
78
+ password?: string;
79
+ show_router?: string[];
80
+ show_id?: string[];
81
+ merchant: {
82
+ toki_id: string;
83
+ hipay: string;
84
+ };
85
+ wallet_id?: string;
86
+ wallet_key?: string;
87
+ delFlg?: boolean;
88
+ createdAt?: Date;
89
+ updatedAt?: Date;
90
+ };
91
+ type AdminT = {
92
+ _id?: string;
93
+ user_id?: number;
94
+ user_name?: string;
95
+ phone_number?: number;
96
+ user_role?: "admin" | "sub-admin" | "super-admin";
97
+ avatar?: string;
98
+ authority?: string[];
99
+ user_email?: string;
100
+ password?: string;
101
+ show_router?: string[];
102
+ show_id?: string[];
103
+ delFlg?: boolean;
104
+ createdAt?: Date;
105
+ updatedAt?: Date;
106
+ };
107
+ type ClientT = {
108
+ _id?: string;
109
+ user_id?: number;
110
+ user_name?: string;
111
+ phone_number?: number;
112
+ user_role?: "crm" | "sub-crm";
113
+ avatar?: string;
114
+ authority?: string[];
115
+ user_email?: string;
116
+ password?: string;
117
+ show_router?: string[];
118
+ show_id?: string[];
119
+ RefundFun?: boolean;
120
+ delFlg?: boolean;
121
+ createdAt?: Date;
122
+ updatedAt?: Date;
123
+ };
124
+ type CrmT = {
125
+ _id?: string;
126
+ user_id?: number;
127
+ user_name?: string;
128
+ phone_number?: number;
129
+ user_role?: "crm" | "sub-crm";
130
+ avatar?: string;
131
+ authority?: string[];
132
+ user_email?: string;
133
+ password?: string;
134
+ show_router?: string[];
135
+ show_id?: string[];
136
+ RefundFun?: boolean;
137
+ delFlg?: boolean;
138
+ createdAt?: Date;
139
+ updatedAt?: Date;
140
+ };
141
+ export declare const USER: (body: UserT) => Promise<{
142
+ success: boolean;
143
+ data: UserT[];
144
+ message: string;
145
+ }>;
146
+ export declare const MERCHANT: (body: MerchantT) => Promise<{
147
+ success: boolean;
148
+ data: MerchantT[];
149
+ message: string;
150
+ }>;
151
+ export declare const ADMIN: (body: AdminT) => Promise<{
152
+ success: boolean;
153
+ data: AdminT[];
154
+ message: string;
155
+ }>;
156
+ export declare const CLIENT: (body: ClientT) => Promise<{
157
+ success: boolean;
158
+ data: ClientT[];
159
+ message: string;
160
+ }>;
161
+ export declare const CRM: (body: CrmT) => Promise<{
162
+ success: boolean;
163
+ data: CrmT[];
164
+ message: string;
165
+ }>;
166
+ declare const _default: {
167
+ USER: (body: UserT) => Promise<{
168
+ success: boolean;
169
+ data: UserT[];
170
+ message: string;
171
+ }>;
172
+ MERCHANT: (body: MerchantT) => Promise<{
173
+ success: boolean;
174
+ data: MerchantT[];
175
+ message: string;
176
+ }>;
177
+ ADMIN: (body: AdminT) => Promise<{
178
+ success: boolean;
179
+ data: AdminT[];
180
+ message: string;
181
+ }>;
182
+ CLIENT: (body: ClientT) => Promise<{
183
+ success: boolean;
184
+ data: ClientT[];
185
+ message: string;
186
+ }>;
187
+ CRM: (body: CrmT) => Promise<{
188
+ success: boolean;
189
+ data: CrmT[];
190
+ message: string;
191
+ }>;
192
+ };
193
+ export default _default;
package/dist/find.js ADDED
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CRM = exports.CLIENT = exports.ADMIN = exports.MERCHANT = exports.USER = void 0;
4
+ const _1 = require(".");
5
+ const auth_1 = require("./auth");
6
+ const axios_master_1 = require("axios-master");
7
+ const USER = async (body) => {
8
+ var _a;
9
+ try {
10
+ const result = await (0, axios_master_1.axiosMasterMain)({
11
+ method: "POST",
12
+ maxBodyLength: Infinity,
13
+ url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/user`,
14
+ headers: {
15
+ Accept: "application/json",
16
+ "Content-Type": "application/json",
17
+ Authorization: `Bearer ${_1.config.token}`,
18
+ },
19
+ data: body,
20
+ }, {
21
+ name: "support/find/user",
22
+ timeout: 20000,
23
+ retryFunction: auth_1.getToken,
24
+ shouldRetry: true,
25
+ shouldRetryStatus: [401, 400],
26
+ logger(data) {
27
+ if (_1.config.logger) {
28
+ console.log(data.json);
29
+ }
30
+ },
31
+ });
32
+ return { success: true, data: result.data, message: result.message };
33
+ }
34
+ catch (error) {
35
+ const axiosError = error;
36
+ if (axiosError.data) {
37
+ console.log(axiosError.data);
38
+ }
39
+ else {
40
+ console.error("Request Failed:", axiosError);
41
+ }
42
+ return {
43
+ success: false,
44
+ data: null,
45
+ message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || "",
46
+ };
47
+ }
48
+ };
49
+ exports.USER = USER;
50
+ const MERCHANT = async (body) => {
51
+ var _a;
52
+ try {
53
+ const result = await (0, axios_master_1.axiosMasterMain)({
54
+ method: "POST",
55
+ maxBodyLength: Infinity,
56
+ url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/merchant`,
57
+ headers: {
58
+ Accept: "application/json",
59
+ "Content-Type": "application/json",
60
+ Authorization: `Bearer ${_1.config.token}`,
61
+ },
62
+ data: body,
63
+ }, {
64
+ name: "support/find/merchant",
65
+ timeout: 20000,
66
+ retryFunction: auth_1.getToken,
67
+ shouldRetry: true,
68
+ shouldRetryStatus: [401, 400],
69
+ logger(data) {
70
+ if (_1.config.logger) {
71
+ console.log(data.json);
72
+ }
73
+ },
74
+ });
75
+ return { success: true, data: result.data, message: result.message };
76
+ }
77
+ catch (error) {
78
+ const axiosError = error;
79
+ if (axiosError.data) {
80
+ console.log(axiosError.data);
81
+ }
82
+ else {
83
+ console.error("Request Failed:", axiosError);
84
+ }
85
+ return {
86
+ success: false,
87
+ data: null,
88
+ message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || "",
89
+ };
90
+ }
91
+ };
92
+ exports.MERCHANT = MERCHANT;
93
+ const ADMIN = async (body) => {
94
+ var _a;
95
+ try {
96
+ const result = await (0, axios_master_1.axiosMasterMain)({
97
+ method: "POST",
98
+ maxBodyLength: Infinity,
99
+ url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/admin`,
100
+ headers: {
101
+ Accept: "application/json",
102
+ "Content-Type": "application/json",
103
+ Authorization: `Bearer ${_1.config.token}`,
104
+ },
105
+ data: body,
106
+ }, {
107
+ name: "support/find/admin",
108
+ timeout: 20000,
109
+ retryFunction: auth_1.getToken,
110
+ shouldRetry: true,
111
+ shouldRetryStatus: [401, 400],
112
+ logger(data) {
113
+ if (_1.config.logger) {
114
+ console.log(data.json);
115
+ }
116
+ },
117
+ });
118
+ return { success: true, data: result.data, message: result.message };
119
+ }
120
+ catch (error) {
121
+ const axiosError = error;
122
+ if (axiosError.data) {
123
+ console.log(axiosError.data);
124
+ }
125
+ else {
126
+ console.error("Request Failed:", axiosError);
127
+ }
128
+ return {
129
+ success: false,
130
+ data: null,
131
+ message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || "",
132
+ };
133
+ }
134
+ };
135
+ exports.ADMIN = ADMIN;
136
+ const CLIENT = async (body) => {
137
+ var _a;
138
+ try {
139
+ const result = await (0, axios_master_1.axiosMasterMain)({
140
+ method: "POST",
141
+ maxBodyLength: Infinity,
142
+ url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/client`,
143
+ headers: {
144
+ Accept: "application/json",
145
+ "Content-Type": "application/json",
146
+ Authorization: `Bearer ${_1.config.token}`,
147
+ },
148
+ data: body,
149
+ }, {
150
+ name: "support/find/client",
151
+ timeout: 20000,
152
+ retryFunction: auth_1.getToken,
153
+ shouldRetry: true,
154
+ shouldRetryStatus: [401, 400],
155
+ logger(data) {
156
+ if (_1.config.logger) {
157
+ console.log(data.json);
158
+ }
159
+ },
160
+ });
161
+ return { success: true, data: result.data, message: result.message };
162
+ }
163
+ catch (error) {
164
+ const axiosError = error;
165
+ if (axiosError.data) {
166
+ console.log(axiosError.data);
167
+ }
168
+ else {
169
+ console.error("Request Failed:", axiosError);
170
+ }
171
+ return {
172
+ success: false,
173
+ data: null,
174
+ message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || "",
175
+ };
176
+ }
177
+ };
178
+ exports.CLIENT = CLIENT;
179
+ const CRM = async (body) => {
180
+ var _a;
181
+ try {
182
+ const result = await (0, axios_master_1.axiosMasterMain)({
183
+ method: "POST",
184
+ maxBodyLength: Infinity,
185
+ url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/crm`,
186
+ headers: {
187
+ Accept: "application/json",
188
+ "Content-Type": "application/json",
189
+ Authorization: `Bearer ${_1.config.token}`,
190
+ },
191
+ data: body,
192
+ }, {
193
+ name: "support/find/crm",
194
+ timeout: 20000,
195
+ retryFunction: auth_1.getToken,
196
+ shouldRetry: true,
197
+ shouldRetryStatus: [401, 400],
198
+ logger(data) {
199
+ if (_1.config.logger) {
200
+ console.log(data.json);
201
+ }
202
+ },
203
+ });
204
+ return { success: true, data: result.data, message: result.message };
205
+ }
206
+ catch (error) {
207
+ const axiosError = error;
208
+ if (axiosError.data) {
209
+ console.log(axiosError.data);
210
+ }
211
+ else {
212
+ console.error("Request Failed:", axiosError);
213
+ }
214
+ return {
215
+ success: false,
216
+ data: null,
217
+ message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || "",
218
+ };
219
+ }
220
+ };
221
+ exports.CRM = CRM;
222
+ exports.default = { USER: exports.USER, MERCHANT: exports.MERCHANT, ADMIN: exports.ADMIN, CLIENT: exports.CLIENT, CRM: exports.CRM };
package/dist/index.d.ts CHANGED
@@ -55,6 +55,29 @@ declare const _default: {
55
55
  data: null;
56
56
  message: string;
57
57
  }>;
58
+ _3RD: {
59
+ TOKI: (body: {
60
+ accountId: string;
61
+ title: string;
62
+ body: string;
63
+ url: string;
64
+ buttonName: string;
65
+ imageURL?: string;
66
+ icon: string;
67
+ }) => Promise<{
68
+ success: boolean;
69
+ data: null;
70
+ message: string;
71
+ }>;
72
+ HIPAY: (body: {
73
+ customerId: string;
74
+ message: string;
75
+ }) => Promise<{
76
+ success: boolean;
77
+ data: null;
78
+ message: string;
79
+ }>;
80
+ };
58
81
  };
59
82
  socket: {
60
83
  ShowToast: (body: {
@@ -98,7 +121,305 @@ declare const _default: {
98
121
  message: string;
99
122
  }>;
100
123
  };
124
+ find: {
125
+ USER: (body: {
126
+ _id?: string;
127
+ user_id?: number;
128
+ user_name?: string;
129
+ nick_name?: string;
130
+ exp?: number;
131
+ primary_email?: string;
132
+ primary_phone?: string;
133
+ emails?: Array<{
134
+ email: string;
135
+ verified: boolean;
136
+ primary: boolean;
137
+ }>;
138
+ phone_numbers?: Array<{
139
+ number: string;
140
+ verified: boolean;
141
+ primary: boolean;
142
+ }>;
143
+ auth_profiles?: {
144
+ facebook_id?: string;
145
+ google_id?: string;
146
+ steam_id?: string;
147
+ apple_id?: string;
148
+ twitter_id?: string;
149
+ monpay_id?: string;
150
+ toki_id?: string;
151
+ social_id?: string;
152
+ hipay_id?: string;
153
+ digi_id?: string;
154
+ };
155
+ profile_image_url?: string;
156
+ date_of_birth?: Date;
157
+ gender?: "MEN" | "WOMEN";
158
+ sign_up_date?: Date;
159
+ last_login?: Date;
160
+ wallet_id?: string;
161
+ wallet_key?: string;
162
+ preferences?: {
163
+ language?: string;
164
+ notifications?: boolean;
165
+ };
166
+ status?: {
167
+ is_active?: boolean;
168
+ is_banned?: boolean;
169
+ verified?: boolean;
170
+ };
171
+ security?: {
172
+ password_hash?: string;
173
+ two_factor_enabled?: boolean;
174
+ last_password_change?: Date;
175
+ };
176
+ verify_info?: {
177
+ first_name?: string;
178
+ last_name?: string;
179
+ born_date?: Date;
180
+ national_id?: string;
181
+ };
182
+ dynamic_info?: {
183
+ [key: string]: any;
184
+ };
185
+ apps?: {
186
+ app_name: string;
187
+ app_id: string;
188
+ device_id: string;
189
+ }[];
190
+ createdAt?: Date;
191
+ updatedAt?: Date;
192
+ }) => Promise<{
193
+ success: boolean;
194
+ data: {
195
+ _id?: string;
196
+ user_id?: number;
197
+ user_name?: string;
198
+ nick_name?: string;
199
+ exp?: number;
200
+ primary_email?: string;
201
+ primary_phone?: string;
202
+ emails?: Array<{
203
+ email: string;
204
+ verified: boolean;
205
+ primary: boolean;
206
+ }>;
207
+ phone_numbers?: Array<{
208
+ number: string;
209
+ verified: boolean;
210
+ primary: boolean;
211
+ }>;
212
+ auth_profiles?: {
213
+ facebook_id?: string;
214
+ google_id?: string;
215
+ steam_id?: string;
216
+ apple_id?: string;
217
+ twitter_id?: string;
218
+ monpay_id?: string;
219
+ toki_id?: string;
220
+ social_id?: string;
221
+ hipay_id?: string;
222
+ digi_id?: string;
223
+ };
224
+ profile_image_url?: string;
225
+ date_of_birth?: Date;
226
+ gender?: "MEN" | "WOMEN";
227
+ sign_up_date?: Date;
228
+ last_login?: Date;
229
+ wallet_id?: string;
230
+ wallet_key?: string;
231
+ preferences?: {
232
+ language?: string;
233
+ notifications?: boolean;
234
+ };
235
+ status?: {
236
+ is_active?: boolean;
237
+ is_banned?: boolean;
238
+ verified?: boolean;
239
+ };
240
+ security?: {
241
+ password_hash?: string;
242
+ two_factor_enabled?: boolean;
243
+ last_password_change?: Date;
244
+ };
245
+ verify_info?: {
246
+ first_name?: string;
247
+ last_name?: string;
248
+ born_date?: Date;
249
+ national_id?: string;
250
+ };
251
+ dynamic_info?: {
252
+ [key: string]: any;
253
+ };
254
+ apps?: {
255
+ app_name: string;
256
+ app_id: string;
257
+ device_id: string;
258
+ }[];
259
+ createdAt?: Date;
260
+ updatedAt?: Date;
261
+ }[];
262
+ message: string;
263
+ }>;
264
+ MERCHANT: (body: {
265
+ _id?: string;
266
+ user_id: number;
267
+ user_name?: string;
268
+ phone_number?: string;
269
+ user_role?: "merchant" | "sub-merchant";
270
+ avatar?: string;
271
+ authority?: string[];
272
+ user_email?: string;
273
+ password?: string;
274
+ show_router?: string[];
275
+ show_id?: string[];
276
+ merchant: {
277
+ toki_id: string;
278
+ hipay: string;
279
+ };
280
+ wallet_id?: string;
281
+ wallet_key?: string;
282
+ delFlg?: boolean;
283
+ createdAt?: Date;
284
+ updatedAt?: Date;
285
+ }) => Promise<{
286
+ success: boolean;
287
+ data: {
288
+ _id?: string;
289
+ user_id: number;
290
+ user_name?: string;
291
+ phone_number?: string;
292
+ user_role?: "merchant" | "sub-merchant";
293
+ avatar?: string;
294
+ authority?: string[];
295
+ user_email?: string;
296
+ password?: string;
297
+ show_router?: string[];
298
+ show_id?: string[];
299
+ merchant: {
300
+ toki_id: string;
301
+ hipay: string;
302
+ };
303
+ wallet_id?: string;
304
+ wallet_key?: string;
305
+ delFlg?: boolean;
306
+ createdAt?: Date;
307
+ updatedAt?: Date;
308
+ }[];
309
+ message: string;
310
+ }>;
311
+ ADMIN: (body: {
312
+ _id?: string;
313
+ user_id?: number;
314
+ user_name?: string;
315
+ phone_number?: number;
316
+ user_role?: "admin" | "sub-admin" | "super-admin";
317
+ avatar?: string;
318
+ authority?: string[];
319
+ user_email?: string;
320
+ password?: string;
321
+ show_router?: string[];
322
+ show_id?: string[];
323
+ delFlg?: boolean;
324
+ createdAt?: Date;
325
+ updatedAt?: Date;
326
+ }) => Promise<{
327
+ success: boolean;
328
+ data: {
329
+ _id?: string;
330
+ user_id?: number;
331
+ user_name?: string;
332
+ phone_number?: number;
333
+ user_role?: "admin" | "sub-admin" | "super-admin";
334
+ avatar?: string;
335
+ authority?: string[];
336
+ user_email?: string;
337
+ password?: string;
338
+ show_router?: string[];
339
+ show_id?: string[];
340
+ delFlg?: boolean;
341
+ createdAt?: Date;
342
+ updatedAt?: Date;
343
+ }[];
344
+ message: string;
345
+ }>;
346
+ CLIENT: (body: {
347
+ _id?: string;
348
+ user_id?: number;
349
+ user_name?: string;
350
+ phone_number?: number;
351
+ user_role?: "crm" | "sub-crm";
352
+ avatar?: string;
353
+ authority?: string[];
354
+ user_email?: string;
355
+ password?: string;
356
+ show_router?: string[];
357
+ show_id?: string[];
358
+ RefundFun?: boolean;
359
+ delFlg?: boolean;
360
+ createdAt?: Date;
361
+ updatedAt?: Date;
362
+ }) => Promise<{
363
+ success: boolean;
364
+ data: {
365
+ _id?: string;
366
+ user_id?: number;
367
+ user_name?: string;
368
+ phone_number?: number;
369
+ user_role?: "crm" | "sub-crm";
370
+ avatar?: string;
371
+ authority?: string[];
372
+ user_email?: string;
373
+ password?: string;
374
+ show_router?: string[];
375
+ show_id?: string[];
376
+ RefundFun?: boolean;
377
+ delFlg?: boolean;
378
+ createdAt?: Date;
379
+ updatedAt?: Date;
380
+ }[];
381
+ message: string;
382
+ }>;
383
+ CRM: (body: {
384
+ _id?: string;
385
+ user_id?: number;
386
+ user_name?: string;
387
+ phone_number?: number;
388
+ user_role?: "crm" | "sub-crm";
389
+ avatar?: string;
390
+ authority?: string[];
391
+ user_email?: string;
392
+ password?: string;
393
+ show_router?: string[];
394
+ show_id?: string[];
395
+ RefundFun?: boolean;
396
+ delFlg?: boolean;
397
+ createdAt?: Date;
398
+ updatedAt?: Date;
399
+ }) => Promise<{
400
+ success: boolean;
401
+ data: {
402
+ _id?: string;
403
+ user_id?: number;
404
+ user_name?: string;
405
+ phone_number?: number;
406
+ user_role?: "crm" | "sub-crm";
407
+ avatar?: string;
408
+ authority?: string[];
409
+ user_email?: string;
410
+ password?: string;
411
+ show_router?: string[];
412
+ show_id?: string[];
413
+ RefundFun?: boolean;
414
+ delFlg?: boolean;
415
+ createdAt?: Date;
416
+ updatedAt?: Date;
417
+ }[];
418
+ message: string;
419
+ }>;
420
+ };
101
421
  };
102
422
  export default _default;
103
423
  export { default as notification } from "./notification";
104
424
  export { default as socket } from "./socket";
425
+ export { default as find } from "./find";
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.socket = exports.notification = exports.setLogger = exports.setHost = exports.config = exports.ObjectId = exports.jsonToQueryString = void 0;
3
+ exports.find = exports.socket = exports.notification = exports.setLogger = exports.setHost = exports.config = exports.ObjectId = exports.jsonToQueryString = void 0;
4
4
  const auth_1 = require("./auth");
5
5
  const notification_1 = require("./notification");
6
6
  const socket_1 = require("./socket");
7
+ const find_1 = require("./find");
7
8
  const jsonToQueryString = (params) => {
8
9
  const query = Object.entries(params)
9
10
  .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
@@ -52,8 +53,11 @@ exports.default = {
52
53
  ObjectId: exports.ObjectId,
53
54
  notification: notification_1.default,
54
55
  socket: socket_1.default,
56
+ find: find_1.default,
55
57
  };
56
58
  var notification_2 = require("./notification");
57
59
  Object.defineProperty(exports, "notification", { enumerable: true, get: function () { return notification_2.default; } });
58
60
  var socket_2 = require("./socket");
59
61
  Object.defineProperty(exports, "socket", { enumerable: true, get: function () { return socket_2.default; } });
62
+ var find_2 = require("./find");
63
+ Object.defineProperty(exports, "find", { enumerable: true, get: function () { return find_2.default; } });
@@ -12,6 +12,26 @@ type SinglePushNotiT = {
12
12
  } | null;
13
13
  };
14
14
  };
15
+ type MailT = {
16
+ type: "notification" | "otp" | "custom";
17
+ form?: {
18
+ name?: string;
19
+ email?: string;
20
+ };
21
+ to: string[];
22
+ subject: string;
23
+ body: {
24
+ name: string;
25
+ title?: string;
26
+ desc?: string;
27
+ otp?: string | number;
28
+ button?: {
29
+ text: string;
30
+ url: string | null;
31
+ };
32
+ footer_text?: string;
33
+ };
34
+ };
15
35
  export declare const SinglePushNoti: (body: SinglePushNotiT) => Promise<{
16
36
  success: boolean;
17
37
  data: null;
@@ -26,6 +46,32 @@ export declare const SMS: (body: {
26
46
  data: null;
27
47
  message: string;
28
48
  }>;
49
+ export declare const MAIL: (body: MailT) => Promise<{
50
+ success: boolean;
51
+ data: null;
52
+ message: string;
53
+ }>;
54
+ export declare const _3RD_TOKI_NOTI: (body: {
55
+ accountId: string;
56
+ title: string;
57
+ body: string;
58
+ url: string;
59
+ buttonName: string;
60
+ imageURL?: string;
61
+ icon: string;
62
+ }) => Promise<{
63
+ success: boolean;
64
+ data: null;
65
+ message: string;
66
+ }>;
67
+ export declare const _3RD_TOKI_HIPAY: (body: {
68
+ customerId: string;
69
+ message: string;
70
+ }) => Promise<{
71
+ success: boolean;
72
+ data: null;
73
+ message: string;
74
+ }>;
29
75
  declare const _default: {
30
76
  SinglePushNoti: (body: SinglePushNotiT) => Promise<{
31
77
  success: boolean;
@@ -41,5 +87,28 @@ declare const _default: {
41
87
  data: null;
42
88
  message: string;
43
89
  }>;
90
+ _3RD: {
91
+ TOKI: (body: {
92
+ accountId: string;
93
+ title: string;
94
+ body: string;
95
+ url: string;
96
+ buttonName: string;
97
+ imageURL?: string;
98
+ icon: string;
99
+ }) => Promise<{
100
+ success: boolean;
101
+ data: null;
102
+ message: string;
103
+ }>;
104
+ HIPAY: (body: {
105
+ customerId: string;
106
+ message: string;
107
+ }) => Promise<{
108
+ success: boolean;
109
+ data: null;
110
+ message: string;
111
+ }>;
112
+ };
44
113
  };
45
114
  export default _default;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SMS = exports.SinglePushNoti = void 0;
3
+ exports._3RD_TOKI_HIPAY = exports._3RD_TOKI_NOTI = exports.MAIL = exports.SMS = exports.SinglePushNoti = void 0;
4
4
  const _1 = require(".");
5
5
  const auth_1 = require("./auth");
6
6
  const axios_master_1 = require("axios-master");
@@ -90,4 +90,140 @@ const SMS = async (body) => {
90
90
  }
91
91
  };
92
92
  exports.SMS = SMS;
93
- exports.default = { SinglePushNoti: exports.SinglePushNoti, SMS: exports.SMS };
93
+ const MAIL = async (body) => {
94
+ var _a;
95
+ try {
96
+ const result = await (0, axios_master_1.axiosMasterMain)({
97
+ method: "POST",
98
+ maxBodyLength: Infinity,
99
+ url: `${_1.config.hosts.MAIN}/main/v1/notification/mail`,
100
+ headers: {
101
+ Accept: "application/json",
102
+ "Content-Type": "application/json",
103
+ Authorization: `Bearer ${_1.config.token}`,
104
+ },
105
+ data: body,
106
+ }, {
107
+ name: "notification mail",
108
+ timeout: 20000,
109
+ retryFunction: auth_1.getToken,
110
+ shouldRetry: true,
111
+ shouldRetryStatus: [401, 400],
112
+ logger(data) {
113
+ if (_1.config.logger) {
114
+ console.log(data.json);
115
+ }
116
+ },
117
+ });
118
+ return { success: true, data: result.data, message: result.message };
119
+ }
120
+ catch (error) {
121
+ const axiosError = error;
122
+ if (axiosError.data) {
123
+ console.log(axiosError.data);
124
+ }
125
+ else {
126
+ console.error("Request Failed:", axiosError);
127
+ }
128
+ return {
129
+ success: false,
130
+ data: null,
131
+ message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || "",
132
+ };
133
+ }
134
+ };
135
+ exports.MAIL = MAIL;
136
+ const _3RD_TOKI_NOTI = async (body) => {
137
+ var _a;
138
+ try {
139
+ const result = await (0, axios_master_1.axiosMasterMain)({
140
+ method: "POST",
141
+ maxBodyLength: Infinity,
142
+ url: `${_1.config.hosts.MAIN}/main/v1/notification/3rd/toki-app`,
143
+ headers: {
144
+ Accept: "application/json",
145
+ "Content-Type": "application/json",
146
+ Authorization: `Bearer ${_1.config.token}`,
147
+ },
148
+ data: body,
149
+ }, {
150
+ name: "notification 3rd toki",
151
+ timeout: 20000,
152
+ retryFunction: auth_1.getToken,
153
+ shouldRetry: true,
154
+ shouldRetryStatus: [401, 400],
155
+ logger(data) {
156
+ if (_1.config.logger) {
157
+ console.log(data.json);
158
+ }
159
+ },
160
+ });
161
+ return { success: true, data: result.data, message: result.message };
162
+ }
163
+ catch (error) {
164
+ const axiosError = error;
165
+ if (axiosError.data) {
166
+ console.log(axiosError.data);
167
+ }
168
+ else {
169
+ console.error("Request Failed:", axiosError);
170
+ }
171
+ return {
172
+ success: false,
173
+ data: null,
174
+ message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || "",
175
+ };
176
+ }
177
+ };
178
+ exports._3RD_TOKI_NOTI = _3RD_TOKI_NOTI;
179
+ const _3RD_TOKI_HIPAY = async (body) => {
180
+ var _a;
181
+ try {
182
+ const result = await (0, axios_master_1.axiosMasterMain)({
183
+ method: "POST",
184
+ maxBodyLength: Infinity,
185
+ url: `${_1.config.hosts.MAIN}/main/v1/notification/3rd/hipay-app`,
186
+ headers: {
187
+ Accept: "application/json",
188
+ "Content-Type": "application/json",
189
+ Authorization: `Bearer ${_1.config.token}`,
190
+ },
191
+ data: body,
192
+ }, {
193
+ name: "notification 3rd hipay",
194
+ timeout: 20000,
195
+ retryFunction: auth_1.getToken,
196
+ shouldRetry: true,
197
+ shouldRetryStatus: [401, 400],
198
+ logger(data) {
199
+ if (_1.config.logger) {
200
+ console.log(data.json);
201
+ }
202
+ },
203
+ });
204
+ return { success: true, data: result.data, message: result.message };
205
+ }
206
+ catch (error) {
207
+ const axiosError = error;
208
+ if (axiosError.data) {
209
+ console.log(axiosError.data);
210
+ }
211
+ else {
212
+ console.error("Request Failed:", axiosError);
213
+ }
214
+ return {
215
+ success: false,
216
+ data: null,
217
+ message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || "",
218
+ };
219
+ }
220
+ };
221
+ exports._3RD_TOKI_HIPAY = _3RD_TOKI_HIPAY;
222
+ exports.default = {
223
+ SinglePushNoti: exports.SinglePushNoti,
224
+ SMS: exports.SMS,
225
+ _3RD: {
226
+ TOKI: exports._3RD_TOKI_NOTI,
227
+ HIPAY: exports._3RD_TOKI_HIPAY,
228
+ },
229
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth-mn",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Auth.mn API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "homepage": "https://github.com/togtokh-dev/auth-mn/#readme",
32
32
  "dependencies": {
33
33
  "axios": "^1.6.2",
34
- "axios-master": "^1.1.6",
34
+ "axios-master": "^2.0.1",
35
35
  "https": "^1.0.0",
36
36
  "ts-node": "^10.9.2",
37
37
  "typescript": "^5.0.4"