auth-mn 0.1.7 → 0.1.8
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/auth.js +28 -14
- package/dist/find.js +55 -25
- package/dist/index.js +6 -6
- package/dist/notification.js +57 -27
- package/dist/socket.js +33 -15
- package/package.json +2 -2
package/dist/auth.js
CHANGED
|
@@ -9,19 +9,26 @@ const TOKEN = async (auth) => {
|
|
|
9
9
|
method: "POST",
|
|
10
10
|
url: `${_1.config.hosts.MAIN}/main/v1/auth/client/login`,
|
|
11
11
|
headers: {
|
|
12
|
-
"Content-Type": "application/json"
|
|
12
|
+
"Content-Type": "application/json"
|
|
13
13
|
},
|
|
14
14
|
data: {
|
|
15
15
|
email: auth.username,
|
|
16
|
-
password: auth.password
|
|
17
|
-
}
|
|
16
|
+
password: auth.password
|
|
17
|
+
}
|
|
18
18
|
}, {
|
|
19
|
-
name: "Token",
|
|
19
|
+
name: "Auth.mn Token",
|
|
20
20
|
timeout: 20000,
|
|
21
21
|
logger: (data) => {
|
|
22
|
-
if (_1.config.logger)
|
|
23
|
-
console.log(
|
|
24
|
-
|
|
22
|
+
if (_1.config.logger) {
|
|
23
|
+
console.log({
|
|
24
|
+
time: data.json.time,
|
|
25
|
+
request: data.json.request,
|
|
26
|
+
response: `${data.json.response}`,
|
|
27
|
+
responseBody: data.json.responseBody,
|
|
28
|
+
statusCode: data.json.statusCode
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
25
32
|
});
|
|
26
33
|
if (response === null || response === void 0 ? void 0 : response.token) {
|
|
27
34
|
_1.config.token = response === null || response === void 0 ? void 0 : response.token;
|
|
@@ -46,19 +53,26 @@ const getToken = async () => {
|
|
|
46
53
|
method: "POST",
|
|
47
54
|
url: `${_1.config.hosts.MAIN}/main/v1/auth/client/login`,
|
|
48
55
|
headers: {
|
|
49
|
-
"Content-Type": "application/json"
|
|
56
|
+
"Content-Type": "application/json"
|
|
50
57
|
},
|
|
51
58
|
data: {
|
|
52
59
|
email: _1.config.auth.username,
|
|
53
|
-
password: _1.config.auth.password
|
|
54
|
-
}
|
|
60
|
+
password: _1.config.auth.password
|
|
61
|
+
}
|
|
55
62
|
}, {
|
|
56
|
-
name: "Token",
|
|
63
|
+
name: "Auth.mn Token",
|
|
57
64
|
timeout: 20000,
|
|
58
65
|
logger: (data) => {
|
|
59
|
-
if (_1.config.logger)
|
|
60
|
-
console.log(
|
|
61
|
-
|
|
66
|
+
if (_1.config.logger) {
|
|
67
|
+
console.log({
|
|
68
|
+
time: data.json.time,
|
|
69
|
+
request: data.json.request,
|
|
70
|
+
response: `${data.json.response}`,
|
|
71
|
+
responseBody: data.json.responseBody,
|
|
72
|
+
statusCode: data.json.statusCode
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
62
76
|
});
|
|
63
77
|
if (response === null || response === void 0 ? void 0 : response.token) {
|
|
64
78
|
_1.config.token = response === null || response === void 0 ? void 0 : response.token;
|
package/dist/find.js
CHANGED
|
@@ -14,9 +14,9 @@ const USER = async (body) => {
|
|
|
14
14
|
headers: {
|
|
15
15
|
Accept: "application/json",
|
|
16
16
|
"Content-Type": "application/json",
|
|
17
|
-
Authorization: `Bearer ${_1.config.token}
|
|
17
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
18
18
|
},
|
|
19
|
-
data: body
|
|
19
|
+
data: body
|
|
20
20
|
}, {
|
|
21
21
|
name: "support/find/user",
|
|
22
22
|
timeout: 20000,
|
|
@@ -25,9 +25,15 @@ const USER = async (body) => {
|
|
|
25
25
|
shouldRetryStatus: [401, 400],
|
|
26
26
|
logger(data) {
|
|
27
27
|
if (_1.config.logger) {
|
|
28
|
-
console.log(
|
|
28
|
+
console.log({
|
|
29
|
+
time: data.json.time,
|
|
30
|
+
request: data.json.request,
|
|
31
|
+
response: `${data.json.response}`,
|
|
32
|
+
responseBody: data.json.responseBody,
|
|
33
|
+
statusCode: data.json.statusCode
|
|
34
|
+
});
|
|
29
35
|
}
|
|
30
|
-
}
|
|
36
|
+
}
|
|
31
37
|
});
|
|
32
38
|
return { success: true, data: result.data, message: result.message };
|
|
33
39
|
}
|
|
@@ -42,7 +48,7 @@ const USER = async (body) => {
|
|
|
42
48
|
return {
|
|
43
49
|
success: false,
|
|
44
50
|
data: null,
|
|
45
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
51
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
54
|
};
|
|
@@ -57,9 +63,9 @@ const MERCHANT = async (body) => {
|
|
|
57
63
|
headers: {
|
|
58
64
|
Accept: "application/json",
|
|
59
65
|
"Content-Type": "application/json",
|
|
60
|
-
Authorization: `Bearer ${_1.config.token}
|
|
66
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
61
67
|
},
|
|
62
|
-
data: body
|
|
68
|
+
data: body
|
|
63
69
|
}, {
|
|
64
70
|
name: "support/find/merchant",
|
|
65
71
|
timeout: 20000,
|
|
@@ -68,9 +74,15 @@ const MERCHANT = async (body) => {
|
|
|
68
74
|
shouldRetryStatus: [401, 400],
|
|
69
75
|
logger(data) {
|
|
70
76
|
if (_1.config.logger) {
|
|
71
|
-
console.log(
|
|
77
|
+
console.log({
|
|
78
|
+
time: data.json.time,
|
|
79
|
+
request: data.json.request,
|
|
80
|
+
response: `${data.json.response}`,
|
|
81
|
+
responseBody: data.json.responseBody,
|
|
82
|
+
statusCode: data.json.statusCode
|
|
83
|
+
});
|
|
72
84
|
}
|
|
73
|
-
}
|
|
85
|
+
}
|
|
74
86
|
});
|
|
75
87
|
return { success: true, data: result.data, message: result.message };
|
|
76
88
|
}
|
|
@@ -85,7 +97,7 @@ const MERCHANT = async (body) => {
|
|
|
85
97
|
return {
|
|
86
98
|
success: false,
|
|
87
99
|
data: null,
|
|
88
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
100
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
89
101
|
};
|
|
90
102
|
}
|
|
91
103
|
};
|
|
@@ -100,9 +112,9 @@ const ADMIN = async (body) => {
|
|
|
100
112
|
headers: {
|
|
101
113
|
Accept: "application/json",
|
|
102
114
|
"Content-Type": "application/json",
|
|
103
|
-
Authorization: `Bearer ${_1.config.token}
|
|
115
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
104
116
|
},
|
|
105
|
-
data: body
|
|
117
|
+
data: body
|
|
106
118
|
}, {
|
|
107
119
|
name: "support/find/admin",
|
|
108
120
|
timeout: 20000,
|
|
@@ -111,9 +123,15 @@ const ADMIN = async (body) => {
|
|
|
111
123
|
shouldRetryStatus: [401, 400],
|
|
112
124
|
logger(data) {
|
|
113
125
|
if (_1.config.logger) {
|
|
114
|
-
console.log(
|
|
126
|
+
console.log({
|
|
127
|
+
time: data.json.time,
|
|
128
|
+
request: data.json.request,
|
|
129
|
+
response: `${data.json.response}`,
|
|
130
|
+
responseBody: data.json.responseBody,
|
|
131
|
+
statusCode: data.json.statusCode
|
|
132
|
+
});
|
|
115
133
|
}
|
|
116
|
-
}
|
|
134
|
+
}
|
|
117
135
|
});
|
|
118
136
|
return { success: true, data: result.data, message: result.message };
|
|
119
137
|
}
|
|
@@ -128,7 +146,7 @@ const ADMIN = async (body) => {
|
|
|
128
146
|
return {
|
|
129
147
|
success: false,
|
|
130
148
|
data: null,
|
|
131
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
149
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
132
150
|
};
|
|
133
151
|
}
|
|
134
152
|
};
|
|
@@ -143,9 +161,9 @@ const CLIENT = async (body) => {
|
|
|
143
161
|
headers: {
|
|
144
162
|
Accept: "application/json",
|
|
145
163
|
"Content-Type": "application/json",
|
|
146
|
-
Authorization: `Bearer ${_1.config.token}
|
|
164
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
147
165
|
},
|
|
148
|
-
data: body
|
|
166
|
+
data: body
|
|
149
167
|
}, {
|
|
150
168
|
name: "support/find/client",
|
|
151
169
|
timeout: 20000,
|
|
@@ -154,9 +172,15 @@ const CLIENT = async (body) => {
|
|
|
154
172
|
shouldRetryStatus: [401, 400],
|
|
155
173
|
logger(data) {
|
|
156
174
|
if (_1.config.logger) {
|
|
157
|
-
console.log(
|
|
175
|
+
console.log({
|
|
176
|
+
time: data.json.time,
|
|
177
|
+
request: data.json.request,
|
|
178
|
+
response: `${data.json.response}`,
|
|
179
|
+
responseBody: data.json.responseBody,
|
|
180
|
+
statusCode: data.json.statusCode
|
|
181
|
+
});
|
|
158
182
|
}
|
|
159
|
-
}
|
|
183
|
+
}
|
|
160
184
|
});
|
|
161
185
|
return { success: true, data: result.data, message: result.message };
|
|
162
186
|
}
|
|
@@ -171,7 +195,7 @@ const CLIENT = async (body) => {
|
|
|
171
195
|
return {
|
|
172
196
|
success: false,
|
|
173
197
|
data: null,
|
|
174
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
198
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
175
199
|
};
|
|
176
200
|
}
|
|
177
201
|
};
|
|
@@ -186,9 +210,9 @@ const CRM = async (body) => {
|
|
|
186
210
|
headers: {
|
|
187
211
|
Accept: "application/json",
|
|
188
212
|
"Content-Type": "application/json",
|
|
189
|
-
Authorization: `Bearer ${_1.config.token}
|
|
213
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
190
214
|
},
|
|
191
|
-
data: body
|
|
215
|
+
data: body
|
|
192
216
|
}, {
|
|
193
217
|
name: "support/find/crm",
|
|
194
218
|
timeout: 20000,
|
|
@@ -197,9 +221,15 @@ const CRM = async (body) => {
|
|
|
197
221
|
shouldRetryStatus: [401, 400],
|
|
198
222
|
logger(data) {
|
|
199
223
|
if (_1.config.logger) {
|
|
200
|
-
console.log(
|
|
224
|
+
console.log({
|
|
225
|
+
time: data.json.time,
|
|
226
|
+
request: data.json.request,
|
|
227
|
+
response: `${data.json.response}`,
|
|
228
|
+
responseBody: data.json.responseBody,
|
|
229
|
+
statusCode: data.json.statusCode
|
|
230
|
+
});
|
|
201
231
|
}
|
|
202
|
-
}
|
|
232
|
+
}
|
|
203
233
|
});
|
|
204
234
|
return { success: true, data: result.data, message: result.message };
|
|
205
235
|
}
|
|
@@ -214,7 +244,7 @@ const CRM = async (body) => {
|
|
|
214
244
|
return {
|
|
215
245
|
success: false,
|
|
216
246
|
data: null,
|
|
217
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
247
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
218
248
|
};
|
|
219
249
|
}
|
|
220
250
|
};
|
package/dist/index.js
CHANGED
|
@@ -25,21 +25,21 @@ exports.config = {
|
|
|
25
25
|
env: "staging",
|
|
26
26
|
hosts: {
|
|
27
27
|
MAIN: "https://staging-api.auth.mn",
|
|
28
|
-
WALLET: "https://staging-api.auth.mn"
|
|
28
|
+
WALLET: "https://staging-api.auth.mn"
|
|
29
29
|
},
|
|
30
30
|
auth: {
|
|
31
31
|
username: "",
|
|
32
|
-
password: ""
|
|
32
|
+
password: ""
|
|
33
33
|
},
|
|
34
|
-
logger: false
|
|
34
|
+
logger: false
|
|
35
35
|
};
|
|
36
36
|
// Function to set the host URLs for API requests
|
|
37
37
|
const setHost = ({ MAIN, WALLET }, ENV) => {
|
|
38
38
|
exports.config.hosts.MAIN = MAIN;
|
|
39
39
|
exports.config.hosts.WALLET = WALLET;
|
|
40
40
|
exports.config.env = ENV;
|
|
41
|
-
console.log("Hosts set to:", exports.config.hosts);
|
|
42
|
-
console.log("Environment set to:", ENV);
|
|
41
|
+
console.log("Auth.mn Hosts set to:", exports.config.hosts);
|
|
42
|
+
console.log("Auth.mn Environment set to:", ENV);
|
|
43
43
|
};
|
|
44
44
|
exports.setHost = setHost;
|
|
45
45
|
// Function to enable or disable logging
|
|
@@ -53,7 +53,7 @@ exports.default = {
|
|
|
53
53
|
ObjectId: exports.ObjectId,
|
|
54
54
|
notification: notification_1.default,
|
|
55
55
|
socket: socket_1.default,
|
|
56
|
-
find: find_1.default
|
|
56
|
+
find: find_1.default
|
|
57
57
|
};
|
|
58
58
|
var notification_2 = require("./notification");
|
|
59
59
|
Object.defineProperty(exports, "notification", { enumerable: true, get: function () { return notification_2.default; } });
|
package/dist/notification.js
CHANGED
|
@@ -14,9 +14,9 @@ const SinglePushNoti = async (body) => {
|
|
|
14
14
|
headers: {
|
|
15
15
|
Accept: "application/json",
|
|
16
16
|
"Content-Type": "application/json",
|
|
17
|
-
Authorization: `Bearer ${_1.config.token}
|
|
17
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
18
18
|
},
|
|
19
|
-
data: body
|
|
19
|
+
data: body
|
|
20
20
|
}, {
|
|
21
21
|
name: "notification single-push",
|
|
22
22
|
timeout: 20000,
|
|
@@ -25,9 +25,15 @@ const SinglePushNoti = async (body) => {
|
|
|
25
25
|
shouldRetryStatus: [401, 400],
|
|
26
26
|
logger(data) {
|
|
27
27
|
if (_1.config.logger) {
|
|
28
|
-
console.log(
|
|
28
|
+
console.log({
|
|
29
|
+
time: data.json.time,
|
|
30
|
+
request: data.json.request,
|
|
31
|
+
response: `${data.json.response}`,
|
|
32
|
+
responseBody: data.json.responseBody,
|
|
33
|
+
statusCode: data.json.statusCode
|
|
34
|
+
});
|
|
29
35
|
}
|
|
30
|
-
}
|
|
36
|
+
}
|
|
31
37
|
});
|
|
32
38
|
return { success: true, data: result.data, message: result.message };
|
|
33
39
|
}
|
|
@@ -42,7 +48,7 @@ const SinglePushNoti = async (body) => {
|
|
|
42
48
|
return {
|
|
43
49
|
success: false,
|
|
44
50
|
data: null,
|
|
45
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
51
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
54
|
};
|
|
@@ -57,9 +63,9 @@ const SMS = async (body) => {
|
|
|
57
63
|
headers: {
|
|
58
64
|
Accept: "application/json",
|
|
59
65
|
"Content-Type": "application/json",
|
|
60
|
-
Authorization: `Bearer ${_1.config.token}
|
|
66
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
61
67
|
},
|
|
62
|
-
data: body
|
|
68
|
+
data: body
|
|
63
69
|
}, {
|
|
64
70
|
name: "notification sms",
|
|
65
71
|
timeout: 20000,
|
|
@@ -68,9 +74,15 @@ const SMS = async (body) => {
|
|
|
68
74
|
shouldRetryStatus: [401, 400],
|
|
69
75
|
logger(data) {
|
|
70
76
|
if (_1.config.logger) {
|
|
71
|
-
console.log(
|
|
77
|
+
console.log({
|
|
78
|
+
time: data.json.time,
|
|
79
|
+
request: data.json.request,
|
|
80
|
+
response: `${data.json.response}`,
|
|
81
|
+
responseBody: data.json.responseBody,
|
|
82
|
+
statusCode: data.json.statusCode
|
|
83
|
+
});
|
|
72
84
|
}
|
|
73
|
-
}
|
|
85
|
+
}
|
|
74
86
|
});
|
|
75
87
|
return { success: true, data: result.data, message: result.message };
|
|
76
88
|
}
|
|
@@ -85,7 +97,7 @@ const SMS = async (body) => {
|
|
|
85
97
|
return {
|
|
86
98
|
success: false,
|
|
87
99
|
data: null,
|
|
88
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
100
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
89
101
|
};
|
|
90
102
|
}
|
|
91
103
|
};
|
|
@@ -100,9 +112,9 @@ const MAIL = async (body) => {
|
|
|
100
112
|
headers: {
|
|
101
113
|
Accept: "application/json",
|
|
102
114
|
"Content-Type": "application/json",
|
|
103
|
-
Authorization: `Bearer ${_1.config.token}
|
|
115
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
104
116
|
},
|
|
105
|
-
data: body
|
|
117
|
+
data: body
|
|
106
118
|
}, {
|
|
107
119
|
name: "notification mail",
|
|
108
120
|
timeout: 20000,
|
|
@@ -111,9 +123,15 @@ const MAIL = async (body) => {
|
|
|
111
123
|
shouldRetryStatus: [401, 400],
|
|
112
124
|
logger(data) {
|
|
113
125
|
if (_1.config.logger) {
|
|
114
|
-
console.log(
|
|
126
|
+
console.log({
|
|
127
|
+
time: data.json.time,
|
|
128
|
+
request: data.json.request,
|
|
129
|
+
response: `${data.json.response}`,
|
|
130
|
+
responseBody: data.json.responseBody,
|
|
131
|
+
statusCode: data.json.statusCode
|
|
132
|
+
});
|
|
115
133
|
}
|
|
116
|
-
}
|
|
134
|
+
}
|
|
117
135
|
});
|
|
118
136
|
return { success: true, data: result.data, message: result.message };
|
|
119
137
|
}
|
|
@@ -128,7 +146,7 @@ const MAIL = async (body) => {
|
|
|
128
146
|
return {
|
|
129
147
|
success: false,
|
|
130
148
|
data: null,
|
|
131
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
149
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
132
150
|
};
|
|
133
151
|
}
|
|
134
152
|
};
|
|
@@ -143,9 +161,9 @@ const _3RD_TOKI_NOTI = async (body) => {
|
|
|
143
161
|
headers: {
|
|
144
162
|
Accept: "application/json",
|
|
145
163
|
"Content-Type": "application/json",
|
|
146
|
-
Authorization: `Bearer ${_1.config.token}
|
|
164
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
147
165
|
},
|
|
148
|
-
data: body
|
|
166
|
+
data: body
|
|
149
167
|
}, {
|
|
150
168
|
name: "notification 3rd toki",
|
|
151
169
|
timeout: 20000,
|
|
@@ -154,9 +172,15 @@ const _3RD_TOKI_NOTI = async (body) => {
|
|
|
154
172
|
shouldRetryStatus: [401, 400],
|
|
155
173
|
logger(data) {
|
|
156
174
|
if (_1.config.logger) {
|
|
157
|
-
console.log(
|
|
175
|
+
console.log({
|
|
176
|
+
time: data.json.time,
|
|
177
|
+
request: data.json.request,
|
|
178
|
+
response: `${data.json.response}`,
|
|
179
|
+
responseBody: data.json.responseBody,
|
|
180
|
+
statusCode: data.json.statusCode
|
|
181
|
+
});
|
|
158
182
|
}
|
|
159
|
-
}
|
|
183
|
+
}
|
|
160
184
|
});
|
|
161
185
|
return { success: true, data: result.data, message: result.message };
|
|
162
186
|
}
|
|
@@ -171,7 +195,7 @@ const _3RD_TOKI_NOTI = async (body) => {
|
|
|
171
195
|
return {
|
|
172
196
|
success: false,
|
|
173
197
|
data: null,
|
|
174
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
198
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
175
199
|
};
|
|
176
200
|
}
|
|
177
201
|
};
|
|
@@ -186,9 +210,9 @@ const _3RD_TOKI_HIPAY = async (body) => {
|
|
|
186
210
|
headers: {
|
|
187
211
|
Accept: "application/json",
|
|
188
212
|
"Content-Type": "application/json",
|
|
189
|
-
Authorization: `Bearer ${_1.config.token}
|
|
213
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
190
214
|
},
|
|
191
|
-
data: body
|
|
215
|
+
data: body
|
|
192
216
|
}, {
|
|
193
217
|
name: "notification 3rd hipay",
|
|
194
218
|
timeout: 20000,
|
|
@@ -197,9 +221,15 @@ const _3RD_TOKI_HIPAY = async (body) => {
|
|
|
197
221
|
shouldRetryStatus: [401, 400],
|
|
198
222
|
logger(data) {
|
|
199
223
|
if (_1.config.logger) {
|
|
200
|
-
console.log(
|
|
224
|
+
console.log({
|
|
225
|
+
time: data.json.time,
|
|
226
|
+
request: data.json.request,
|
|
227
|
+
response: `${data.json.response}`,
|
|
228
|
+
responseBody: data.json.responseBody,
|
|
229
|
+
statusCode: data.json.statusCode
|
|
230
|
+
});
|
|
201
231
|
}
|
|
202
|
-
}
|
|
232
|
+
}
|
|
203
233
|
});
|
|
204
234
|
return { success: true, data: result.data, message: result.message };
|
|
205
235
|
}
|
|
@@ -214,7 +244,7 @@ const _3RD_TOKI_HIPAY = async (body) => {
|
|
|
214
244
|
return {
|
|
215
245
|
success: false,
|
|
216
246
|
data: null,
|
|
217
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
247
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
218
248
|
};
|
|
219
249
|
}
|
|
220
250
|
};
|
|
@@ -225,6 +255,6 @@ exports.default = {
|
|
|
225
255
|
MAIL: exports.MAIL,
|
|
226
256
|
_3RD: {
|
|
227
257
|
TOKI: exports._3RD_TOKI_NOTI,
|
|
228
|
-
HIPAY: exports._3RD_TOKI_HIPAY
|
|
229
|
-
}
|
|
258
|
+
HIPAY: exports._3RD_TOKI_HIPAY
|
|
259
|
+
}
|
|
230
260
|
};
|
package/dist/socket.js
CHANGED
|
@@ -14,9 +14,9 @@ const ShowToast = async (body) => {
|
|
|
14
14
|
headers: {
|
|
15
15
|
Accept: "application/json",
|
|
16
16
|
"Content-Type": "application/json",
|
|
17
|
-
Authorization: `Bearer ${_1.config.token}
|
|
17
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
18
18
|
},
|
|
19
|
-
data: body
|
|
19
|
+
data: body
|
|
20
20
|
}, {
|
|
21
21
|
name: "socket toast",
|
|
22
22
|
timeout: 20000,
|
|
@@ -25,9 +25,15 @@ const ShowToast = async (body) => {
|
|
|
25
25
|
shouldRetryStatus: [401, 400],
|
|
26
26
|
logger(data) {
|
|
27
27
|
if (_1.config.logger) {
|
|
28
|
-
console.log(
|
|
28
|
+
console.log({
|
|
29
|
+
time: data.json.time,
|
|
30
|
+
request: data.json.request,
|
|
31
|
+
response: `${data.json.response}`,
|
|
32
|
+
responseBody: data.json.responseBody,
|
|
33
|
+
statusCode: data.json.statusCode
|
|
34
|
+
});
|
|
29
35
|
}
|
|
30
|
-
}
|
|
36
|
+
}
|
|
31
37
|
});
|
|
32
38
|
return { success: true, data: result.data, message: result.message };
|
|
33
39
|
}
|
|
@@ -42,7 +48,7 @@ const ShowToast = async (body) => {
|
|
|
42
48
|
return {
|
|
43
49
|
success: false,
|
|
44
50
|
data: null,
|
|
45
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
51
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
54
|
};
|
|
@@ -56,9 +62,9 @@ const ShowStatus = async (body) => {
|
|
|
56
62
|
headers: {
|
|
57
63
|
Accept: "application/json",
|
|
58
64
|
"Content-Type": "application/json",
|
|
59
|
-
Authorization: `Bearer ${_1.config.token}
|
|
65
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
60
66
|
},
|
|
61
|
-
data: body
|
|
67
|
+
data: body
|
|
62
68
|
}, {
|
|
63
69
|
name: "socket status",
|
|
64
70
|
timeout: 20000,
|
|
@@ -67,9 +73,15 @@ const ShowStatus = async (body) => {
|
|
|
67
73
|
shouldRetryStatus: [401, 400],
|
|
68
74
|
logger(data) {
|
|
69
75
|
if (_1.config.logger) {
|
|
70
|
-
console.log(
|
|
76
|
+
console.log({
|
|
77
|
+
time: data.json.time,
|
|
78
|
+
request: data.json.request,
|
|
79
|
+
response: `${data.json.response}`,
|
|
80
|
+
responseBody: data.json.responseBody,
|
|
81
|
+
statusCode: data.json.statusCode
|
|
82
|
+
});
|
|
71
83
|
}
|
|
72
|
-
}
|
|
84
|
+
}
|
|
73
85
|
});
|
|
74
86
|
return { success: true, data: result.data, message: result.message };
|
|
75
87
|
}
|
|
@@ -84,7 +96,7 @@ const ShowStatus = async (body) => {
|
|
|
84
96
|
return {
|
|
85
97
|
success: false,
|
|
86
98
|
data: null,
|
|
87
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
99
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
88
100
|
};
|
|
89
101
|
}
|
|
90
102
|
};
|
|
@@ -98,9 +110,9 @@ const ShowOrderStatus = async (body) => {
|
|
|
98
110
|
headers: {
|
|
99
111
|
Accept: "application/json",
|
|
100
112
|
"Content-Type": "application/json",
|
|
101
|
-
Authorization: `Bearer ${_1.config.token}
|
|
113
|
+
Authorization: `Bearer ${_1.config.token}`
|
|
102
114
|
},
|
|
103
|
-
data: body
|
|
115
|
+
data: body
|
|
104
116
|
}, {
|
|
105
117
|
name: "socket order status",
|
|
106
118
|
timeout: 20000,
|
|
@@ -109,9 +121,15 @@ const ShowOrderStatus = async (body) => {
|
|
|
109
121
|
shouldRetryStatus: [401, 400],
|
|
110
122
|
logger(data) {
|
|
111
123
|
if (_1.config.logger) {
|
|
112
|
-
console.log(
|
|
124
|
+
console.log({
|
|
125
|
+
time: data.json.time,
|
|
126
|
+
request: data.json.request,
|
|
127
|
+
response: `${data.json.response}`,
|
|
128
|
+
responseBody: data.json.responseBody,
|
|
129
|
+
statusCode: data.json.statusCode
|
|
130
|
+
});
|
|
113
131
|
}
|
|
114
|
-
}
|
|
132
|
+
}
|
|
115
133
|
});
|
|
116
134
|
return { success: true, data: result.data, message: result.message };
|
|
117
135
|
}
|
|
@@ -126,7 +144,7 @@ const ShowOrderStatus = async (body) => {
|
|
|
126
144
|
return {
|
|
127
145
|
success: false,
|
|
128
146
|
data: null,
|
|
129
|
-
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
147
|
+
message: ((_a = axiosError.data) === null || _a === void 0 ? void 0 : _a.message) || ""
|
|
130
148
|
};
|
|
131
149
|
}
|
|
132
150
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth-mn",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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": "^2.0.
|
|
34
|
+
"axios-master": "^2.0.7",
|
|
35
35
|
"https": "^1.0.0",
|
|
36
36
|
"ts-node": "^10.9.2",
|
|
37
37
|
"typescript": "^5.0.4"
|