auth-mn 0.1.7 → 0.1.9
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 +30 -16
- package/dist/find.js +60 -30
- package/dist/index.js +6 -6
- package/dist/notification.js +62 -32
- package/dist/socket.js +36 -18
- package/package.json +2 -2
package/dist/auth.js
CHANGED
|
@@ -5,23 +5,30 @@ const _1 = require("./");
|
|
|
5
5
|
const axios_master_1 = require("axios-master");
|
|
6
6
|
const TOKEN = async (auth) => {
|
|
7
7
|
try {
|
|
8
|
-
const response = await (0, axios_master_1.
|
|
8
|
+
const response = await (0, axios_master_1.axiosMasterLogger)({
|
|
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;
|
|
@@ -42,23 +49,30 @@ const TOKEN = async (auth) => {
|
|
|
42
49
|
};
|
|
43
50
|
const getToken = async () => {
|
|
44
51
|
try {
|
|
45
|
-
const response = await (0, axios_master_1.
|
|
52
|
+
const response = await (0, axios_master_1.axiosMasterLogger)({
|
|
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
|
@@ -7,16 +7,16 @@ const axios_master_1 = require("axios-master");
|
|
|
7
7
|
const USER = async (body) => {
|
|
8
8
|
var _a;
|
|
9
9
|
try {
|
|
10
|
-
const result = await (0, axios_master_1.
|
|
10
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
11
11
|
method: "POST",
|
|
12
12
|
maxBodyLength: Infinity,
|
|
13
13
|
url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/user`,
|
|
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
|
};
|
|
@@ -50,16 +56,16 @@ exports.USER = USER;
|
|
|
50
56
|
const MERCHANT = async (body) => {
|
|
51
57
|
var _a;
|
|
52
58
|
try {
|
|
53
|
-
const result = await (0, axios_master_1.
|
|
59
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
54
60
|
method: "POST",
|
|
55
61
|
maxBodyLength: Infinity,
|
|
56
62
|
url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/merchant`,
|
|
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
|
};
|
|
@@ -93,16 +105,16 @@ exports.MERCHANT = MERCHANT;
|
|
|
93
105
|
const ADMIN = async (body) => {
|
|
94
106
|
var _a;
|
|
95
107
|
try {
|
|
96
|
-
const result = await (0, axios_master_1.
|
|
108
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
97
109
|
method: "POST",
|
|
98
110
|
maxBodyLength: Infinity,
|
|
99
111
|
url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/admin`,
|
|
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
|
};
|
|
@@ -136,16 +154,16 @@ exports.ADMIN = ADMIN;
|
|
|
136
154
|
const CLIENT = async (body) => {
|
|
137
155
|
var _a;
|
|
138
156
|
try {
|
|
139
|
-
const result = await (0, axios_master_1.
|
|
157
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
140
158
|
method: "POST",
|
|
141
159
|
maxBodyLength: Infinity,
|
|
142
160
|
url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/client`,
|
|
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
|
};
|
|
@@ -179,16 +203,16 @@ exports.CLIENT = CLIENT;
|
|
|
179
203
|
const CRM = async (body) => {
|
|
180
204
|
var _a;
|
|
181
205
|
try {
|
|
182
|
-
const result = await (0, axios_master_1.
|
|
206
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
183
207
|
method: "POST",
|
|
184
208
|
maxBodyLength: Infinity,
|
|
185
209
|
url: `${_1.config.hosts.MAIN}/main/v1/auth/support/find/crm`,
|
|
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
|
@@ -7,16 +7,16 @@ const axios_master_1 = require("axios-master");
|
|
|
7
7
|
const SinglePushNoti = async (body) => {
|
|
8
8
|
var _a;
|
|
9
9
|
try {
|
|
10
|
-
const result = await (0, axios_master_1.
|
|
10
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
11
11
|
method: "POST",
|
|
12
12
|
maxBodyLength: Infinity,
|
|
13
13
|
url: `${_1.config.hosts.MAIN}/main/v1/notification/single-push`,
|
|
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
|
};
|
|
@@ -50,16 +56,16 @@ exports.SinglePushNoti = SinglePushNoti;
|
|
|
50
56
|
const SMS = async (body) => {
|
|
51
57
|
var _a;
|
|
52
58
|
try {
|
|
53
|
-
const result = await (0, axios_master_1.
|
|
59
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
54
60
|
method: "POST",
|
|
55
61
|
maxBodyLength: Infinity,
|
|
56
62
|
url: `${_1.config.hosts.MAIN}/main/v1/notification/sms`,
|
|
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
|
};
|
|
@@ -93,16 +105,16 @@ exports.SMS = SMS;
|
|
|
93
105
|
const MAIL = async (body) => {
|
|
94
106
|
var _a;
|
|
95
107
|
try {
|
|
96
|
-
const result = await (0, axios_master_1.
|
|
108
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
97
109
|
method: "POST",
|
|
98
110
|
maxBodyLength: Infinity,
|
|
99
111
|
url: `${_1.config.hosts.MAIN}/main/v1/notification/mail`,
|
|
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
|
};
|
|
@@ -136,16 +154,16 @@ exports.MAIL = MAIL;
|
|
|
136
154
|
const _3RD_TOKI_NOTI = async (body) => {
|
|
137
155
|
var _a;
|
|
138
156
|
try {
|
|
139
|
-
const result = await (0, axios_master_1.
|
|
157
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
140
158
|
method: "POST",
|
|
141
159
|
maxBodyLength: Infinity,
|
|
142
160
|
url: `${_1.config.hosts.MAIN}/main/v1/notification/3rd/toki-app`,
|
|
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
|
};
|
|
@@ -179,16 +203,16 @@ exports._3RD_TOKI_NOTI = _3RD_TOKI_NOTI;
|
|
|
179
203
|
const _3RD_TOKI_HIPAY = async (body) => {
|
|
180
204
|
var _a;
|
|
181
205
|
try {
|
|
182
|
-
const result = await (0, axios_master_1.
|
|
206
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
183
207
|
method: "POST",
|
|
184
208
|
maxBodyLength: Infinity,
|
|
185
209
|
url: `${_1.config.hosts.MAIN}/main/v1/notification/3rd/hipay-app`,
|
|
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
|
@@ -7,16 +7,16 @@ const axios_master_1 = require("axios-master");
|
|
|
7
7
|
const ShowToast = async (body) => {
|
|
8
8
|
var _a;
|
|
9
9
|
try {
|
|
10
|
-
const result = await (0, axios_master_1.
|
|
10
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
11
11
|
method: "POST",
|
|
12
12
|
maxBodyLength: Infinity,
|
|
13
13
|
url: `${_1.config.hosts.MAIN}/main/v1/socket/notification/toast`,
|
|
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
|
};
|
|
@@ -50,15 +56,15 @@ exports.ShowToast = ShowToast;
|
|
|
50
56
|
const ShowStatus = async (body) => {
|
|
51
57
|
var _a;
|
|
52
58
|
try {
|
|
53
|
-
const result = await (0, axios_master_1.
|
|
59
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
54
60
|
method: "POST",
|
|
55
61
|
url: `${_1.config.hosts.MAIN}/main/v1/socket/notification/status`,
|
|
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
|
};
|
|
@@ -92,15 +104,15 @@ exports.ShowStatus = ShowStatus;
|
|
|
92
104
|
const ShowOrderStatus = async (body) => {
|
|
93
105
|
var _a;
|
|
94
106
|
try {
|
|
95
|
-
const result = await (0, axios_master_1.
|
|
107
|
+
const result = await (0, axios_master_1.axiosMasterLogger)({
|
|
96
108
|
method: "POST",
|
|
97
109
|
url: `${_1.config.hosts.MAIN}/main/v1/socket/notification/order/status`,
|
|
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.9",
|
|
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"
|