@xrystal/core 3.22.6 → 3.22.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/package.json
CHANGED
|
@@ -49,6 +49,7 @@ export declare abstract class BaseController {
|
|
|
49
49
|
export default abstract class Controller extends BaseController implements IProvide<any> {
|
|
50
50
|
constructor();
|
|
51
51
|
onInit(): Promise<void>;
|
|
52
|
+
private smartTranslate;
|
|
52
53
|
private parseMessage;
|
|
53
54
|
schema<T = any>({ checks, logic, response }: {
|
|
54
55
|
checks?: (args: any) => Promise<any>;
|
|
@@ -13,44 +13,34 @@ export class BaseController {
|
|
|
13
13
|
get currentStore() { return getControllerCtx(); }
|
|
14
14
|
get req() {
|
|
15
15
|
const store = this.currentStore;
|
|
16
|
-
const identityT = (k) => k;
|
|
17
16
|
const ctx = store?.ctx || {};
|
|
18
17
|
const query = typeof ctx.query === 'string' ? qs.parse(ctx.query) : (ctx.query || {});
|
|
19
18
|
return {
|
|
20
19
|
url: ctx.url || '', method: ctx.method || '', headers: ctx.headers || {},
|
|
21
20
|
body: ctx.body || {}, query: query, params: ctx.params || {},
|
|
22
|
-
lang: ctx.lang || 'en', t: ctx.t ||
|
|
21
|
+
lang: ctx.lang || 'en', t: ctx.t || ((k) => k),
|
|
23
22
|
accounts: ctx.accounts || store?.req?.accounts
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
25
|
get res() {
|
|
27
26
|
const store = this.currentStore;
|
|
28
27
|
const self = this;
|
|
29
|
-
const fallbackRes = {
|
|
30
|
-
status: function () { return this; },
|
|
31
|
-
send: (d) => d,
|
|
32
|
-
json: function (d) { return this.send(d); },
|
|
33
|
-
locals: {}
|
|
34
|
-
};
|
|
28
|
+
const fallbackRes = { status: function () { return this; }, send: (d) => d, json: function (d) { return this.send(d); }, locals: {} };
|
|
35
29
|
if (!store)
|
|
36
30
|
return fallbackRes;
|
|
37
31
|
if (!store.metadata)
|
|
38
32
|
store.metadata = { locals: {} };
|
|
39
33
|
return {
|
|
40
34
|
get locals() { return store.metadata.locals; },
|
|
41
|
-
status(code) {
|
|
42
|
-
store.metadata._code = code;
|
|
43
|
-
return this;
|
|
44
|
-
},
|
|
35
|
+
status(code) { store.metadata._code = code; return this; },
|
|
45
36
|
send(data) {
|
|
46
37
|
if (self.protocol === ProtocolEnum.WEBSOCKET)
|
|
47
38
|
return data;
|
|
48
39
|
if (data instanceof Response)
|
|
49
40
|
return data;
|
|
50
|
-
const isRaw = store.metadata?._isRaw || (data instanceof Blob || data instanceof Uint8Array || data instanceof ArrayBuffer);
|
|
51
41
|
const status = store.metadata?._code || 200;
|
|
52
|
-
const body =
|
|
53
|
-
return new Response(body, { status, headers: { 'content-type':
|
|
42
|
+
const body = (store.metadata?._isRaw) ? data : JSON.stringify(data?.getResponse ? data.getResponse : data);
|
|
43
|
+
return new Response(body, { status, headers: { 'content-type': 'application/json' } });
|
|
54
44
|
},
|
|
55
45
|
json(data) { return this.send(data); }
|
|
56
46
|
};
|
|
@@ -62,6 +52,14 @@ export default class Controller extends BaseController {
|
|
|
62
52
|
const protocols = this.system?.tmp?.configs?.loaders?.controller?.protocols;
|
|
63
53
|
this.supportedProtocols = Array.isArray(protocols) ? protocols : [protocols || ProtocolEnum.HTTP];
|
|
64
54
|
}
|
|
55
|
+
smartTranslate(word, t) {
|
|
56
|
+
const keyPath = `keywords.${word}`;
|
|
57
|
+
const translated = t(keyPath);
|
|
58
|
+
if (translated !== keyPath)
|
|
59
|
+
return translated;
|
|
60
|
+
const direct = t(word);
|
|
61
|
+
return direct !== word ? direct : word;
|
|
62
|
+
}
|
|
65
63
|
parseMessage(input, t) {
|
|
66
64
|
if (!input || typeof input !== 'string' || !input.startsWith('@'))
|
|
67
65
|
return input;
|
|
@@ -70,10 +68,7 @@ export default class Controller extends BaseController {
|
|
|
70
68
|
const hasMethod = typeof responseMessageHelper[maybeMethod] === 'function';
|
|
71
69
|
const methodName = hasMethod ? maybeMethod : 'successfully';
|
|
72
70
|
const rawArgs = hasMethod ? parts.slice(1) : parts;
|
|
73
|
-
const translatedArgs = rawArgs.map(arg =>
|
|
74
|
-
const res = t(`keywords.${arg}`);
|
|
75
|
-
return res !== `keywords.${arg}` ? res : (t(arg) !== arg ? t(arg) : arg);
|
|
76
|
-
});
|
|
71
|
+
const translatedArgs = rawArgs.map(arg => this.smartTranslate(arg, t));
|
|
77
72
|
return responseMessageHelper[methodName](translatedArgs[0] || '', translatedArgs.slice(1).join(' '), t);
|
|
78
73
|
}
|
|
79
74
|
async schema({ checks, logic, response }) {
|
|
@@ -83,6 +78,7 @@ export default class Controller extends BaseController {
|
|
|
83
78
|
const store = this.currentStore;
|
|
84
79
|
const t = currentReq.t;
|
|
85
80
|
const p = { req: currentReq, res: currentRes, body: currentReq.body, query: currentReq.query, params: currentReq.params, locals: store?.metadata?.locals || {}, t };
|
|
81
|
+
// 1. CHECKS
|
|
86
82
|
if (checks) {
|
|
87
83
|
const checkRes = await checks(p);
|
|
88
84
|
if (checkRes !== true) {
|
|
@@ -90,42 +86,60 @@ export default class Controller extends BaseController {
|
|
|
90
86
|
const code = isObj ? checkRes.code || 400 : 400;
|
|
91
87
|
const rawMsg = isObj ? checkRes.message : (typeof checkRes === 'string' ? checkRes : '@schemaMissingDataChecks');
|
|
92
88
|
const { message, status, code: _c, data, payload, ...extras } = isObj ? checkRes : {};
|
|
93
|
-
const coreData = data
|
|
89
|
+
const coreData = data !== undefined ? data : payload;
|
|
90
|
+
const errPayload = {};
|
|
91
|
+
if (coreData !== undefined)
|
|
92
|
+
errPayload.data = coreData;
|
|
93
|
+
if (Object.keys(extras).length > 0)
|
|
94
|
+
errPayload.extraData = extras;
|
|
94
95
|
return currentRes.status(code).send(new ResponseSchema({
|
|
95
96
|
status: false,
|
|
96
97
|
message: this.parseMessage(rawMsg, t),
|
|
97
|
-
payload:
|
|
98
|
+
payload: Object.keys(errPayload).length > 0 ? errPayload : undefined,
|
|
98
99
|
code
|
|
99
100
|
}).getResponse);
|
|
100
101
|
}
|
|
101
102
|
}
|
|
103
|
+
// 2. LOGIC
|
|
102
104
|
let logicRes = logic ? await logic(p) : null;
|
|
103
105
|
if (logic && logicRes === false) {
|
|
104
106
|
return currentRes.status(400).send(new ResponseSchema({ status: false, message: this.parseMessage('@unsuccessful logic', t), code: 400 }).getResponse);
|
|
105
107
|
}
|
|
108
|
+
// 3. RESPONSE
|
|
106
109
|
let finalRes = response ? await response({ ...p, logicResult: logicRes }) : logicRes;
|
|
107
110
|
if (typeof finalRes === 'function')
|
|
108
111
|
finalRes = await finalRes(p);
|
|
112
|
+
// Auto-success conversion
|
|
109
113
|
if (Array.isArray(finalRes)) {
|
|
110
|
-
finalRes = { message: `@successfully ${finalRes.join(' ')}
|
|
114
|
+
finalRes = { message: `@successfully ${finalRes.join(' ')}`, data: logicRes };
|
|
111
115
|
}
|
|
112
116
|
else if (typeof finalRes === 'string' && !finalRes.startsWith('@')) {
|
|
113
|
-
finalRes = { message: `@successfully ${finalRes}
|
|
117
|
+
finalRes = { message: `@successfully ${finalRes}`, data: logicRes };
|
|
114
118
|
}
|
|
115
119
|
if (finalRes instanceof Response || finalRes?.constructor?.name === 'Response')
|
|
116
120
|
return finalRes;
|
|
121
|
+
// 4. FINAL PACKAGING (BU BÖLÜMÜ DÜZELTTİK)
|
|
117
122
|
const isSuccess = finalRes?.status !== false;
|
|
118
123
|
const finalCode = finalRes?.code || store?.metadata?._code || 200;
|
|
119
124
|
let msgSource = finalRes?.message || (typeof finalRes === 'string' ? finalRes : '@successfully');
|
|
125
|
+
// Eğer finalRes bir obje değilse onu data olarak sarmala
|
|
120
126
|
const rawOutput = (finalRes && typeof finalRes === 'object' && !Array.isArray(finalRes)) ? finalRes : { data: finalRes };
|
|
127
|
+
// Destructuring ile alanları ayır
|
|
121
128
|
const { message, status, code, data, payload, ...extraData } = rawOutput;
|
|
129
|
+
// Data veya Payload'dan gelen asıl veriyi belirle
|
|
122
130
|
const coreData = data !== undefined ? data : payload;
|
|
123
131
|
const responseData = {
|
|
124
132
|
status: isSuccess,
|
|
125
133
|
message: this.parseMessage(msgSource, t)
|
|
126
134
|
};
|
|
127
|
-
|
|
128
|
-
|
|
135
|
+
// Payload oluşturma mantığı
|
|
136
|
+
const finalPayload = {};
|
|
137
|
+
if (coreData !== undefined)
|
|
138
|
+
finalPayload.data = coreData;
|
|
139
|
+
if (Object.keys(extraData).length > 0)
|
|
140
|
+
finalPayload.extraData = extraData;
|
|
141
|
+
if (Object.keys(finalPayload).length > 0) {
|
|
142
|
+
responseData.payload = finalPayload;
|
|
129
143
|
}
|
|
130
144
|
responseData.code = finalCode;
|
|
131
145
|
return currentRes.status(finalCode).send(new ResponseSchema(responseData).getResponse);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const coreMessages: {
|
|
1
|
+
export declare const coreMessages: {
|
|
2
2
|
successfully: (p?: string, e?: string, t?: any) => string;
|
|
3
3
|
unsuccessful: (p?: string, e?: string, t?: any) => string;
|
|
4
4
|
notFound: (p?: string, e?: string, t?: any) => string;
|
|
@@ -15,15 +15,39 @@ declare const coreMessages: {
|
|
|
15
15
|
endpointNotWorking: (endpoint?: string, t?: any) => string;
|
|
16
16
|
schemaMissingDataChecks: (t?: any) => string;
|
|
17
17
|
schemaInvalidDataChecks: (t?: any) => string;
|
|
18
|
+
schemaUnknowErrorChecks: (a: any, b: any, t?: any) => string;
|
|
19
|
+
schemaUnknowErrorLogic: (a: any, b: any, t?: any) => string;
|
|
20
|
+
schemaUnknowErrorResponse: (a: any, b: any, t?: any) => string;
|
|
21
|
+
schemaUnknowErrorMain: (a: any, b: any, t?: any) => string;
|
|
18
22
|
dbQueryError: (p?: string, e?: string, t?: any) => string;
|
|
19
23
|
unknowError: (p?: string, e?: string, t?: any) => string;
|
|
20
24
|
serverError: (p?: string, e?: string, t?: any) => string;
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
emailWelcomeTemplateTitle: (t?: any) => string;
|
|
26
|
+
emailWelcomeTemplateExplanation: (t?: any) => string;
|
|
27
|
+
emailForgotPasswordTemplateTitle: (t?: any) => string;
|
|
28
|
+
emailForgotPasswordTemplateExplanation: (t?: any) => string;
|
|
29
|
+
allRightsReserved: (e1?: string, e2?: string, t?: any) => string;
|
|
30
|
+
emailButtonText: (t?: any) => string;
|
|
31
|
+
emailIgnoreText: (t?: any) => string;
|
|
32
|
+
welcomeMessage: (username?: string, t?: any) => string;
|
|
33
|
+
userIsBlocked: (extra1?: string, t?: any) => string;
|
|
34
|
+
passwordChangeCode: (username?: string, t?: any) => string;
|
|
23
35
|
notEnoughWalletBalance: (m?: string, c?: string, t?: any) => string;
|
|
36
|
+
openAuthConsumerOverhang: (p1?: string, p2?: string, t?: any) => string;
|
|
37
|
+
thirdPartySystemOverhang: (p1?: string, p2?: string, t?: any) => string;
|
|
38
|
+
deviceOverhang: (p1?: string, p2?: string, t?: any) => string;
|
|
39
|
+
provisionOverhang: (m?: string, c?: string, t?: any) => string;
|
|
40
|
+
balanceOverhang: (m?: string, c?: string, t?: any) => string;
|
|
41
|
+
debtOverhang: (m?: string, c?: string, t?: any) => string;
|
|
42
|
+
shipmentNotAccepted: (v1?: string, v2?: string, t?: any) => string;
|
|
43
|
+
optionsMethod: (m?: string, t?: any) => string;
|
|
44
|
+
notAllowedCORS: (m?: string, t?: any) => string;
|
|
45
|
+
missingCRSFToken: (t?: any) => string;
|
|
46
|
+
invalidCRSFToken: (t?: any) => string;
|
|
24
47
|
tooManyRequest: (t?: any) => string;
|
|
25
|
-
|
|
48
|
+
endpointNotFound: (t?: any) => string;
|
|
49
|
+
roleAccess: (error?: string, t?: any) => string;
|
|
50
|
+
authenticationRequiredTokenExpired: (t?: any) => string;
|
|
26
51
|
authenticationRequired: (t?: any) => string;
|
|
27
52
|
};
|
|
28
53
|
export declare const responseMessageHelper: typeof coreMessages & Record<string, Function>;
|
|
29
|
-
export {};
|
|
@@ -1,30 +1,55 @@
|
|
|
1
1
|
const f = (...args) => args.filter(item => item && typeof item === 'string' && item.trim() !== '').join(' ').trim();
|
|
2
|
-
const coreMessages = {
|
|
3
|
-
successfully: (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.successfully')}.`.trim(),
|
|
4
|
-
unsuccessful: (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.unsuccessful')}.`.trim(),
|
|
5
|
-
notFound: (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.notFound')}.`.trim(),
|
|
6
|
-
notMatch: (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.notMatch')}.`.trim(),
|
|
7
|
-
notUse: (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.notUse')}.`.trim(),
|
|
8
|
-
invalid: (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.invalid')}.`.trim(),
|
|
9
|
-
checked: (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.checked')}.`.trim(),
|
|
10
|
-
process: (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.process')}.`.trim(),
|
|
11
|
-
missingData: (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.missingData')}.`.trim(),
|
|
12
|
-
allreadyHave: (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.allreadyHave')}.`.trim(),
|
|
13
|
-
wrongFormat: (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.wrongFormat')}.`.trim(),
|
|
14
|
-
externalApiError: (p = '', e = '', t) => `${f(p, e)}, ${t && t('responseMessage.externalApiError')}.`.trim(),
|
|
15
|
-
unauthorizedUrl: (p = '', e = '', t) => `${f(p, e)}, ${t && t('responseMessage.unauthorizedUrl')}.`.trim(),
|
|
16
|
-
endpointNotWorking: (endpoint = '', t) => `${endpoint}, ${t && t('responseMessage.endpointNotWorking')}.`.trim(),
|
|
17
|
-
schemaMissingDataChecks: (t) => `${t && t('responseMessage.schemaMissingDataChecks')}.`.trim(),
|
|
18
|
-
schemaInvalidDataChecks: (t) => `${t && t('responseMessage.schemaInvalidDataChecks')}.`.trim(),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
2
|
+
export const coreMessages = {
|
|
3
|
+
'successfully': (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.successfully')}.`.trim(),
|
|
4
|
+
'unsuccessful': (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.unsuccessful')}.`.trim(),
|
|
5
|
+
'notFound': (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.notFound')}.`.trim(),
|
|
6
|
+
'notMatch': (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.notMatch')}.`.trim(),
|
|
7
|
+
'notUse': (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.notUse')}.`.trim(),
|
|
8
|
+
'invalid': (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.invalid')}.`.trim(),
|
|
9
|
+
'checked': (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.checked')}.`.trim(),
|
|
10
|
+
'process': (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.process')}.`.trim(),
|
|
11
|
+
'missingData': (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.missingData')}.`.trim(),
|
|
12
|
+
'allreadyHave': (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.allreadyHave')}.`.trim(),
|
|
13
|
+
'wrongFormat': (p = '', e = '', t) => `${f(p, e)} ${t && t('responseMessage.wrongFormat')}.`.trim(),
|
|
14
|
+
'externalApiError': (p = '', e = '', t) => `${f(p, e)}, ${t && t('responseMessage.externalApiError')}.`.trim(),
|
|
15
|
+
'unauthorizedUrl': (p = '', e = '', t) => `${f(p, e)}, ${t && t('responseMessage.unauthorizedUrl')}.`.trim(),
|
|
16
|
+
'endpointNotWorking': (endpoint = '', t) => `${endpoint}, ${t && t('responseMessage.endpointNotWorking')}.`.trim(),
|
|
17
|
+
'schemaMissingDataChecks': (t) => `${t && t('responseMessage.schemaMissingDataChecks')}.`.trim(),
|
|
18
|
+
'schemaInvalidDataChecks': (t) => `${t && t('responseMessage.schemaInvalidDataChecks')}.`.trim(),
|
|
19
|
+
'schemaUnknowErrorChecks': (a, b, t) => `${t && t('responseMessage.schemaUnknowErrorChecks')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`.trim(),
|
|
20
|
+
'schemaUnknowErrorLogic': (a, b, t) => `${t && t('responseMessage.schemaUnknowErrorLogic')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`.trim(),
|
|
21
|
+
'schemaUnknowErrorResponse': (a, b, t) => `${t && t('responseMessage.schemaUnknowErrorLogic')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`.trim(),
|
|
22
|
+
'schemaUnknowErrorMain': (a, b, t) => `${t && t('responseMessage.schemaUnknowErrorMain')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`.trim(),
|
|
23
|
+
'dbQueryError': (p = '', e = '', t) => `${t && t('responseMessage.dbQueryError')}. ${f(p, e)}`.trim(),
|
|
24
|
+
'unknowError': (p = '', e = '', t) => `${t && t('responseMessage.unknowError')}. ${f(p, e)}`.trim(),
|
|
25
|
+
'serverError': (p = '', e = '', t) => `${t && t('responseMessage.serverError')}. ${f(p, e)}`.trim(),
|
|
26
|
+
'emailWelcomeTemplateTitle': (t) => `${t && t('responseMessage.emailWelcomeTemplateTitle')}`.trim(),
|
|
27
|
+
'emailWelcomeTemplateExplanation': (t) => `${t && t('responseMessage.emailWelcomeTemplateExplanation')}.`.trim(),
|
|
28
|
+
'emailForgotPasswordTemplateTitle': (t) => `${t && t('responseMessage.emailForgotPasswordTemplateTitle')}`.trim(),
|
|
29
|
+
'emailForgotPasswordTemplateExplanation': (t) => `${t && t('responseMessage.emailForgotPasswordTemplateExplanation')}.`.trim(),
|
|
30
|
+
'allRightsReserved': (e1 = '', e2 = '', t) => `${f(e1, e2)}, ${t && t('responseMessage.allRightsReserved')}.`.trim(),
|
|
31
|
+
'emailButtonText': (t) => `${t && t('responseMessage.emailButtonText')}.`.trim(),
|
|
32
|
+
'emailIgnoreText': (t) => `${t && t('responseMessage.emailIgnoreText')}.`.trim(),
|
|
33
|
+
'welcomeMessage': (username = '', t) => `@${username} - ${t && t('responseMessage.welcome')}.`.trim(),
|
|
34
|
+
'userIsBlocked': (extra1 = '', t) => `${extra1}, ${t && t('responseMessage.userIsBlocked')}.`.trim(),
|
|
35
|
+
'passwordChangeCode': (username = '', t) => `@${username} - ${t && t('responseMessage.passwordChangeCode')}.`.trim(),
|
|
36
|
+
'notEnoughWalletBalance': (m = '', c = '', t) => `${f(m, c)}, ${t && t('responseMessage.notEnoughWalletBalance')}.`.trim(),
|
|
37
|
+
'openAuthConsumerOverhang': (p1 = '', p2 = '', t) => `${f(p1, p2)}, ${t && t('responseMessage.openAuthConsumerOverhang')}.`.trim(),
|
|
38
|
+
'thirdPartySystemOverhang': (p1 = '', p2 = '', t) => `${f(p1, p2)}, ${t && t('responseMessage.thirdPartySystems')}.`.trim(),
|
|
39
|
+
'deviceOverhang': (p1 = '', p2 = '', t) => `${f(p1, p2)}, ${t && t('responseMessage.deviceOverhang')}.`.trim(),
|
|
40
|
+
'provisionOverhang': (m = '', c = '', t) => `${f(m, c)}, ${t && t('responseMessage.provisionOverhang')}.`.trim(),
|
|
41
|
+
'balanceOverhang': (m = '', c = '', t) => `${f(m, c)}, ${t && t('responseMessage.balanceOverhang')}.`.trim(),
|
|
42
|
+
'debtOverhang': (m = '', c = '', t) => `${f(m, c)}, ${t && t('responseMessage.debtOverhang')}.`.trim(),
|
|
43
|
+
'shipmentNotAccepted': (v1 = '', v2 = '', t) => `${t && t('responseMessage.shipmentNotAccepted')}. ${f(v1, v2)}`.trim(),
|
|
44
|
+
'optionsMethod': (m = '', t) => `${t && t('responseMessage.optionsMethod')}. ${m}`.trim(),
|
|
45
|
+
'notAllowedCORS': (m = '', t) => `${t && t('responseMessage.notAllowedCORS')}. ${m}`.trim(),
|
|
46
|
+
'missingCRSFToken': (t) => `${t && t('responseMessage.missingCSRFToken')}.`.trim(),
|
|
47
|
+
'invalidCRSFToken': (t) => `${t && t('responseMessage.invalidCSRFToken')}.`.trim(),
|
|
48
|
+
'tooManyRequest': (t) => `${t && t('responseMessage.tooManyRequest')}.`.trim(),
|
|
49
|
+
'endpointNotFound': (t) => `${t && t('responseMessage.endpointNotFound')}.`.trim(),
|
|
50
|
+
'roleAccess': (error = '', t) => `${t && t('responseMessage.roleAccess')}. ${error}`.trim(),
|
|
51
|
+
'authenticationRequiredTokenExpired': (t) => `${t && t('responseMessage.authenticationRequiredTokenExpired')}.`.trim(),
|
|
52
|
+
'authenticationRequired': (t) => `${t && t('responseMessage.authenticationRequired')}.`.trim(),
|
|
28
53
|
};
|
|
29
54
|
export const responseMessageHelper = new Proxy(coreMessages, {
|
|
30
55
|
get(target, prop) {
|