@xrystal/core 3.24.7 → 3.25.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/package.json
CHANGED
|
@@ -79,28 +79,24 @@ export default class Controller extends BaseController {
|
|
|
79
79
|
this.supportedProtocols = Array.isArray(protocols) ? protocols : [protocols || ProtocolEnum.HTTP];
|
|
80
80
|
}
|
|
81
81
|
parseMessage(msg, t, isError = false) {
|
|
82
|
-
const content = String(msg ||
|
|
82
|
+
const content = String(msg || '');
|
|
83
|
+
if (!content)
|
|
84
|
+
return isError ? responseMessageHelper.unsuccessful('', '', t) : responseMessageHelper.successfully('', '', t);
|
|
83
85
|
let method = isError ? 'unsuccessful' : 'successfully';
|
|
84
86
|
let payloadString = content;
|
|
85
87
|
if (content.startsWith('@')) {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
payloadString = content.substring(firstSpace + 1);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
method = content.substring(1);
|
|
93
|
-
payloadString = '';
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else if (content === 'unsuccessful' || content === 'success_process') {
|
|
97
|
-
payloadString = '';
|
|
88
|
+
const parts = content.split(' ');
|
|
89
|
+
method = parts[0].substring(1);
|
|
90
|
+
payloadString = parts.slice(1).join(' ');
|
|
98
91
|
}
|
|
99
92
|
const params = payloadString.split('-').map(p => p.trim()).filter(p => p !== '');
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
// Kritik Düzeltme: Çiftlemeyi önlemek için parametreleri helper'a t() ile sarmadan gönderiyoruz
|
|
94
|
+
// Çünkü helper zaten kendi içinde t() kullanıyor
|
|
95
|
+
const p1 = params[0] || '';
|
|
96
|
+
const p2 = params.slice(1).join(' ');
|
|
97
|
+
if (responseMessageHelper[method]) {
|
|
103
98
|
return responseMessageHelper[method](p1, p2, t);
|
|
99
|
+
}
|
|
104
100
|
return isError ? responseMessageHelper.unsuccessful(p1, p2, t) : responseMessageHelper.successfully(p1, p2, t);
|
|
105
101
|
}
|
|
106
102
|
async schema({ checks, logic, response }) {
|
|
@@ -177,7 +173,7 @@ export default class Controller extends BaseController {
|
|
|
177
173
|
else {
|
|
178
174
|
extractData(resResult !== undefined ? resResult : logicResult);
|
|
179
175
|
}
|
|
180
|
-
|
|
176
|
+
const bizSuccessCode = store?.metadata?._code || 200;
|
|
181
177
|
let payload = undefined;
|
|
182
178
|
if (finalData !== undefined || finalExtraData !== undefined) {
|
|
183
179
|
payload = {};
|
|
@@ -13,15 +13,13 @@ export class ResponseSchema {
|
|
|
13
13
|
return this.payload;
|
|
14
14
|
}
|
|
15
15
|
statusCodeGenerator() {
|
|
16
|
-
if (this.status === false
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return 0;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
16
|
+
if (this.status === false) {
|
|
17
|
+
if (this.code !== 0 && this.code !== 1) {
|
|
18
|
+
return Number(this.code);
|
|
19
|
+
}
|
|
23
20
|
return 1;
|
|
24
21
|
}
|
|
22
|
+
return 0;
|
|
25
23
|
}
|
|
26
24
|
get getResponse() {
|
|
27
25
|
const response = {
|