@xrystal/core 3.2.3

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.
Files changed (76) hide show
  1. package/README.md +1 -0
  2. package/bin/constants/index.mjs +14 -0
  3. package/bin/helpers/index.mjs +83 -0
  4. package/bin/main-cli.js +179 -0
  5. package/package.json +113 -0
  6. package/source/index.d.ts +2 -0
  7. package/source/index.js +8 -0
  8. package/source/loader/configs/index.d.ts +13 -0
  9. package/source/loader/configs/index.js +17 -0
  10. package/source/loader/events/index.d.ts +6 -0
  11. package/source/loader/events/index.js +25 -0
  12. package/source/loader/index.d.ts +6 -0
  13. package/source/loader/index.js +6 -0
  14. package/source/loader/localizations/index.d.ts +14 -0
  15. package/source/loader/localizations/index.js +32 -0
  16. package/source/loader/logger/index.d.ts +22 -0
  17. package/source/loader/logger/index.js +130 -0
  18. package/source/loader/system/index.d.ts +8 -0
  19. package/source/loader/system/index.js +14 -0
  20. package/source/project/index.d.ts +7 -0
  21. package/source/project/index.js +94 -0
  22. package/source/utils/constants/index.d.ts +8 -0
  23. package/source/utils/constants/index.js +10 -0
  24. package/source/utils/helpers/date/index.d.ts +16 -0
  25. package/source/utils/helpers/date/index.js +48 -0
  26. package/source/utils/helpers/filters/index.d.ts +17 -0
  27. package/source/utils/helpers/filters/index.js +44 -0
  28. package/source/utils/helpers/hash/crypto.d.ts +3 -0
  29. package/source/utils/helpers/hash/crypto.js +22 -0
  30. package/source/utils/helpers/id/index.d.ts +13 -0
  31. package/source/utils/helpers/id/index.js +24 -0
  32. package/source/utils/helpers/index.d.ts +16 -0
  33. package/source/utils/helpers/index.js +16 -0
  34. package/source/utils/helpers/ip/index.d.ts +1 -0
  35. package/source/utils/helpers/ip/index.js +3 -0
  36. package/source/utils/helpers/is/index.d.ts +11 -0
  37. package/source/utils/helpers/is/index.js +35 -0
  38. package/source/utils/helpers/locales/index.d.ts +52 -0
  39. package/source/utils/helpers/locales/index.js +161 -0
  40. package/source/utils/helpers/locales copy/index.d.ts +52 -0
  41. package/source/utils/helpers/locales copy/index.js +161 -0
  42. package/source/utils/helpers/math/index.d.ts +2 -0
  43. package/source/utils/helpers/math/index.js +14 -0
  44. package/source/utils/helpers/objects/index.d.ts +1 -0
  45. package/source/utils/helpers/objects/index.js +55 -0
  46. package/source/utils/helpers/path/index.d.ts +2 -0
  47. package/source/utils/helpers/path/index.js +4 -0
  48. package/source/utils/helpers/regex/checkSpecialRegexControl.d.ts +1 -0
  49. package/source/utils/helpers/regex/checkSpecialRegexControl.js +3 -0
  50. package/source/utils/helpers/string/index.d.ts +1 -0
  51. package/source/utils/helpers/string/index.js +9 -0
  52. package/source/utils/helpers/timer/index.d.ts +3 -0
  53. package/source/utils/helpers/timer/index.js +5 -0
  54. package/source/utils/helpers/tmp/index.d.ts +8 -0
  55. package/source/utils/helpers/tmp/index.js +109 -0
  56. package/source/utils/helpers/validates/index.d.ts +5 -0
  57. package/source/utils/helpers/validates/index.js +20 -0
  58. package/source/utils/index.d.ts +3 -0
  59. package/source/utils/index.js +3 -0
  60. package/source/utils/models/classes/class.controller.d.ts +121 -0
  61. package/source/utils/models/classes/class.controller.js +421 -0
  62. package/source/utils/models/classes/class.response.d.ts +17 -0
  63. package/source/utils/models/classes/class.response.js +37 -0
  64. package/source/utils/models/classes/class.services.d.ts +129 -0
  65. package/source/utils/models/classes/class.services.js +344 -0
  66. package/source/utils/models/classes/class.tmp-file-loader.d.ts +11 -0
  67. package/source/utils/models/classes/class.tmp-file-loader.js +38 -0
  68. package/source/utils/models/classes/class.x.d.ts +12 -0
  69. package/source/utils/models/classes/class.x.js +16 -0
  70. package/source/utils/models/enums/index.d.ts +116 -0
  71. package/source/utils/models/enums/index.js +132 -0
  72. package/source/utils/models/index.d.ts +8 -0
  73. package/source/utils/models/index.js +8 -0
  74. package/source/utils/models/types/index.d.ts +3 -0
  75. package/source/utils/models/types/index.js +2 -0
  76. package/x/tmp.yml +26 -0
@@ -0,0 +1,161 @@
1
+ export const responseMessageHelper = {
2
+ 'successFully': (process = '', event = '', t) => {
3
+ return `${process + ' ' + event} ${t && t('responseMessage.successfully')}.`;
4
+ },
5
+ 'unsuccessful': (process = '', event = '', t) => {
6
+ return `${process + ' ' + event} ${t && t('responseMessage.unsuccessful')}.`;
7
+ },
8
+ 'notFound': (process = '', event = '', t) => {
9
+ return `${process + ' ' + event} ${t && t('responseMessage.notFound')}.`;
10
+ },
11
+ 'notMatch': (process = '', event = '', t) => {
12
+ return `${process + ' ' + event} ${t && t('responseMessage.notMatch')}.`;
13
+ },
14
+ 'notUse': (process = '', event = '', t) => {
15
+ return `${process + ' ' + event} ${t && t('responseMessage.notUse')}.`;
16
+ },
17
+ 'invalid': (process = '', event = '', t) => {
18
+ return `${process + ' ' + event} ${t && t('responseMessage.invalid')}.`;
19
+ },
20
+ 'checked': (process = '', event = '', t) => {
21
+ return `${process + ' ' + event} ${t && t('responseMessage.checked')}.`;
22
+ },
23
+ 'process': (process = '', event = '', t) => {
24
+ return `${process + ' ' + event} ${t && t('responseMessage.process')}.`;
25
+ },
26
+ 'missingData': (process = '', event = '', t) => {
27
+ return `${process + ' ' + event} ${t && t('responseMessage.missingData')}.`;
28
+ },
29
+ 'allreadyHave': (process = '', event = '', t) => {
30
+ return `${process + ' ' + event} ${t && t('responseMessage.allreadyHave')}.`;
31
+ },
32
+ 'wrongFormat': (process = '', event = '', t) => {
33
+ return `${process + ' ' + event} ${t && t('responseMessage.wrongFormat')}.`;
34
+ },
35
+ 'externalApiError': (process = '', event = '', t) => {
36
+ return `${process + ' ' + event}, ${t && t('responseMessage.externalApiError')}.`;
37
+ },
38
+ 'unauthorizedUrl': (process = '', event = '', t) => {
39
+ return `${process + ' ' + event}, ${t && t('responseMessage.unauthorizedUrl')}.`;
40
+ },
41
+ 'endpointNotWorking': (endpoint = '', t) => {
42
+ return `${endpoint}, ${t && t('responseMessage.endpointNotWorking')}.`;
43
+ },
44
+ // schema
45
+ // => special
46
+ 'schemaMissingDataChecks': (t) => {
47
+ return `${t && t('responseMessage.schemaMissingDataChecks')}.`;
48
+ },
49
+ 'schemaInvalidDataChecks': (t) => {
50
+ return `${t && t('responseMessage.schemaInvalidDataChecks')}.`;
51
+ },
52
+ 'schemaUnknowErrorChecks': (a, b, t) => {
53
+ return `${t && t('responseMessage.schemaUnknowErrorChecks')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`;
54
+ },
55
+ 'schemaUnknowErrorLogic': (a, b, t) => {
56
+ return `${t && t('responseMessage.schemaUnknowErrorLogic')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`;
57
+ },
58
+ 'schemaUnknowErrorResponse': (a, b, t) => {
59
+ return `${t && t('responseMessage.schemaUnknowErrorLogic')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`;
60
+ },
61
+ 'schemaUnknowErrorMain': (a, b, t) => {
62
+ return `${t && t('responseMessage.schemaUnknowErrorMain')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`;
63
+ },
64
+ //
65
+ 'dbQueryError': (process = '', event = '', t) => {
66
+ return `${t && t('responseMessage.dbQueryError')}. ${process + ' ' + event}`;
67
+ },
68
+ 'unknowError': (process = '', event = '', t) => {
69
+ return `${t && t('responseMessage.unknowError')}. ${process + ' ' + event}`;
70
+ },
71
+ 'serverError': (process = '', event = '', t) => {
72
+ return `${t && t('responseMessage.serverError')}. ${process + ' ' + event}`;
73
+ },
74
+ // specific
75
+ // => email
76
+ // => templates
77
+ 'emailWelcomeTemplateTitle': (t) => {
78
+ return `${t && t('responseMessage.emailWelcomeTemplateTitle')}`;
79
+ },
80
+ 'emailWelcomeTemplateExplanation': (t) => {
81
+ return `${t && t('responseMessage.emailWelcomeTemplateExplanation')}.`;
82
+ },
83
+ 'emailForgotPasswordTemplateTitle': (t) => {
84
+ return `${t && t('responseMessage.emailForgotPasswordTemplateTitle')}`;
85
+ },
86
+ 'emailForgotPasswordTemplateExplanation': (t) => {
87
+ return `${t && t('responseMessage.emailForgotPasswordTemplateExplanation')}.`;
88
+ },
89
+ //
90
+ 'allRightsReserved': (extra1 = '', extra2 = '', t) => {
91
+ return `${extra1 + ' ' + extra2}, ${t && t('responseMessage.allRightsReserved')}.`;
92
+ },
93
+ 'emailButtonText': (t) => {
94
+ return `${t && t('responseMessage.emailButtonText')}.`;
95
+ },
96
+ 'emailIgnoreText': (t) => {
97
+ return `${t && t('responseMessage.emailIgnoreText')}.`;
98
+ },
99
+ //
100
+ 'welcomeMessage': (username = '', t) => {
101
+ return `@${username} - ${t && t('responseMessage.welcome')}.`;
102
+ },
103
+ 'userIsBlocked': (extra1 = '', t) => {
104
+ return `${extra1}, ${t && t('responseMessage.userIsBlocked')}.`;
105
+ },
106
+ 'passwordChangeCode': (username = '', t) => {
107
+ return `@${username} - ${t && t('responseMessage.passwordChangeCode')}.`;
108
+ },
109
+ 'notEnoughWalletBalance': (money = '', currency = '', t) => {
110
+ return `${money + ' ' + currency}, ${t && t('responseMessage.notEnoughWalletBalance')}.`;
111
+ },
112
+ 'openAuthConsumerOverhang': (param1 = '', param2 = '', t) => {
113
+ return `${param1 + ' ' + param2}, ${t && t('responseMessage.openAuthConsumerOverhang')}.`;
114
+ },
115
+ 'thirdPartySystemOverhang': (param1 = '', param2 = '', t) => {
116
+ return `${param1 + ' ' + param2}, ${t && t('responseMessage.thirdPartySystems')}.`;
117
+ },
118
+ 'deviceOverhang': (param1 = '', param2 = '', t) => {
119
+ return `${param1 + ' ' + param2}, ${t && t('responseMessage.deviceOverhang')}.`;
120
+ },
121
+ 'provisionOverhang': (money = '', currency = '', t) => {
122
+ return `${money + ' ' + currency}, ${t && t('responseMessage.provisionOverhang')}.`;
123
+ },
124
+ 'balanceOverhang': (money = '', currency = '', t) => {
125
+ return `${money + ' ' + currency}, ${t && t('responseMessage.balanceOverhang')}.`;
126
+ },
127
+ 'debtOverhang': (money = '', currency = '', t) => {
128
+ return `${money + ' ' + currency}, ${t && t('responseMessage.debtOverhang')}.`;
129
+ },
130
+ 'shipmentNotAccepted': (value1 = '', value2 = '', t) => {
131
+ return `${t && t('responseMessage.shipmentNotAccepted')}. ${value1} ${value2}`;
132
+ },
133
+ // system
134
+ 'optionsMethod': (methods = '', t) => {
135
+ return `${t && t('responseMessage.optionsMethod')}. ${methods}`;
136
+ },
137
+ 'notAllowedCORS': (methods = '', t) => {
138
+ return `${t && t('responseMessage.notAllowedCORS')}. ${methods}`;
139
+ },
140
+ 'missingCRSFToken': (t) => {
141
+ return `${t && t('responseMessage.missingCSRFToken')}.`;
142
+ },
143
+ 'invalidCRSFToken': (t) => {
144
+ return `${t && t('responseMessage.invalidCSRFToken')}.`;
145
+ },
146
+ 'tooManyRequest': (t) => {
147
+ return `${t && t('responseMessage.tooManyRequest')}.`;
148
+ },
149
+ 'endpointNotFound': (t) => {
150
+ return `${t && t('responseMessage.endpointNotFound')}.`;
151
+ },
152
+ 'roleAccess': (error = '', t) => {
153
+ return `${t && t('responseMessage.roleAccess')}. ${error}`;
154
+ },
155
+ 'authenticationRequiredTokenExpired': (t) => {
156
+ return `${t && t('responseMessage.authenticationRequiredTokenExpired')}.`;
157
+ },
158
+ 'authenticationRequired': (t) => {
159
+ return `${t && t('responseMessage.authenticationRequired')}.`;
160
+ },
161
+ };
@@ -0,0 +1,52 @@
1
+ export declare const responseMessageHelper: {
2
+ successFully: (process?: string, event?: string, t?: any) => string;
3
+ unsuccessful: (process?: string, event?: string, t?: any) => string;
4
+ notFound: (process?: string, event?: string, t?: any) => string;
5
+ notMatch: (process?: string, event?: string, t?: any) => string;
6
+ notUse: (process?: string, event?: string, t?: any) => string;
7
+ invalid: (process?: string, event?: string, t?: any) => string;
8
+ checked: (process?: string, event?: string, t?: any) => string;
9
+ process: (process?: string, event?: string, t?: any) => string;
10
+ missingData: (process?: string, event?: string, t?: any) => string;
11
+ allreadyHave: (process?: string, event?: string, t?: any) => string;
12
+ wrongFormat: (process?: string, event?: string, t?: any) => string;
13
+ externalApiError: (process?: string, event?: string, t?: any) => string;
14
+ unauthorizedUrl: (process?: string, event?: string, t?: any) => string;
15
+ endpointNotWorking: (endpoint?: string, t?: any) => string;
16
+ schemaMissingDataChecks: (t?: any) => string;
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;
22
+ dbQueryError: (process?: string, event?: string, t?: any) => string;
23
+ unknowError: (process?: string, event?: string, t?: any) => string;
24
+ serverError: (process?: string, event?: string, t?: any) => string;
25
+ emailWelcomeTemplateTitle: (t?: any) => string;
26
+ emailWelcomeTemplateExplanation: (t?: any) => string;
27
+ emailForgotPasswordTemplateTitle: (t?: any) => string;
28
+ emailForgotPasswordTemplateExplanation: (t?: any) => string;
29
+ allRightsReserved: (extra1?: string, extra2?: 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;
35
+ notEnoughWalletBalance: (money?: string, currency?: string, t?: any) => string;
36
+ openAuthConsumerOverhang: (param1?: string, param2?: string, t?: any) => string;
37
+ thirdPartySystemOverhang: (param1?: string, param2?: string, t?: any) => string;
38
+ deviceOverhang: (param1?: string, param2?: string, t?: any) => string;
39
+ provisionOverhang: (money?: string, currency?: string, t?: any) => string;
40
+ balanceOverhang: (money?: string, currency?: string, t?: any) => string;
41
+ debtOverhang: (money?: string, currency?: string, t?: any) => string;
42
+ shipmentNotAccepted: (value1?: string, value2?: string, t?: any) => string;
43
+ optionsMethod: (methods?: string, t?: any) => string;
44
+ notAllowedCORS: (methods?: string, t?: any) => string;
45
+ missingCRSFToken: (t?: any) => string;
46
+ invalidCRSFToken: (t?: any) => string;
47
+ tooManyRequest: (t?: any) => string;
48
+ endpointNotFound: (t?: any) => string;
49
+ roleAccess: (error?: string, t?: any) => string;
50
+ authenticationRequiredTokenExpired: (t?: any) => string;
51
+ authenticationRequired: (t?: any) => string;
52
+ };
@@ -0,0 +1,161 @@
1
+ export const responseMessageHelper = {
2
+ 'successFully': (process = '', event = '', t) => {
3
+ return `${process + ' ' + event} ${t && t('responseMessage.successfully')}.`;
4
+ },
5
+ 'unsuccessful': (process = '', event = '', t) => {
6
+ return `${process + ' ' + event} ${t && t('responseMessage.unsuccessful')}.`;
7
+ },
8
+ 'notFound': (process = '', event = '', t) => {
9
+ return `${process + ' ' + event} ${t && t('responseMessage.notFound')}.`;
10
+ },
11
+ 'notMatch': (process = '', event = '', t) => {
12
+ return `${process + ' ' + event} ${t && t('responseMessage.notMatch')}.`;
13
+ },
14
+ 'notUse': (process = '', event = '', t) => {
15
+ return `${process + ' ' + event} ${t && t('responseMessage.notUse')}.`;
16
+ },
17
+ 'invalid': (process = '', event = '', t) => {
18
+ return `${process + ' ' + event} ${t && t('responseMessage.invalid')}.`;
19
+ },
20
+ 'checked': (process = '', event = '', t) => {
21
+ return `${process + ' ' + event} ${t && t('responseMessage.checked')}.`;
22
+ },
23
+ 'process': (process = '', event = '', t) => {
24
+ return `${process + ' ' + event} ${t && t('responseMessage.process')}.`;
25
+ },
26
+ 'missingData': (process = '', event = '', t) => {
27
+ return `${process + ' ' + event} ${t && t('responseMessage.missingData')}.`;
28
+ },
29
+ 'allreadyHave': (process = '', event = '', t) => {
30
+ return `${process + ' ' + event} ${t && t('responseMessage.allreadyHave')}.`;
31
+ },
32
+ 'wrongFormat': (process = '', event = '', t) => {
33
+ return `${process + ' ' + event} ${t && t('responseMessage.wrongFormat')}.`;
34
+ },
35
+ 'externalApiError': (process = '', event = '', t) => {
36
+ return `${process + ' ' + event}, ${t && t('responseMessage.externalApiError')}.`;
37
+ },
38
+ 'unauthorizedUrl': (process = '', event = '', t) => {
39
+ return `${process + ' ' + event}, ${t && t('responseMessage.unauthorizedUrl')}.`;
40
+ },
41
+ 'endpointNotWorking': (endpoint = '', t) => {
42
+ return `${endpoint}, ${t && t('responseMessage.endpointNotWorking')}.`;
43
+ },
44
+ // schema
45
+ // => special
46
+ 'schemaMissingDataChecks': (t) => {
47
+ return `${t && t('responseMessage.schemaMissingDataChecks')}.`;
48
+ },
49
+ 'schemaInvalidDataChecks': (t) => {
50
+ return `${t && t('responseMessage.schemaInvalidDataChecks')}.`;
51
+ },
52
+ 'schemaUnknowErrorChecks': (a, b, t) => {
53
+ return `${t && t('responseMessage.schemaUnknowErrorChecks')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`;
54
+ },
55
+ 'schemaUnknowErrorLogic': (a, b, t) => {
56
+ return `${t && t('responseMessage.schemaUnknowErrorLogic')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`;
57
+ },
58
+ 'schemaUnknowErrorResponse': (a, b, t) => {
59
+ return `${t && t('responseMessage.schemaUnknowErrorLogic')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`;
60
+ },
61
+ 'schemaUnknowErrorMain': (a, b, t) => {
62
+ return `${t && t('responseMessage.schemaUnknowErrorMain')}. ${a}. ${t('responseMessage.schemaErrorExtraExplanation')}: ${b}`;
63
+ },
64
+ //
65
+ 'dbQueryError': (process = '', event = '', t) => {
66
+ return `${t && t('responseMessage.dbQueryError')}. ${process + ' ' + event}`;
67
+ },
68
+ 'unknowError': (process = '', event = '', t) => {
69
+ return `${t && t('responseMessage.unknowError')}. ${process + ' ' + event}`;
70
+ },
71
+ 'serverError': (process = '', event = '', t) => {
72
+ return `${t && t('responseMessage.serverError')}. ${process + ' ' + event}`;
73
+ },
74
+ // specific
75
+ // => email
76
+ // => templates
77
+ 'emailWelcomeTemplateTitle': (t) => {
78
+ return `${t && t('responseMessage.emailWelcomeTemplateTitle')}`;
79
+ },
80
+ 'emailWelcomeTemplateExplanation': (t) => {
81
+ return `${t && t('responseMessage.emailWelcomeTemplateExplanation')}.`;
82
+ },
83
+ 'emailForgotPasswordTemplateTitle': (t) => {
84
+ return `${t && t('responseMessage.emailForgotPasswordTemplateTitle')}`;
85
+ },
86
+ 'emailForgotPasswordTemplateExplanation': (t) => {
87
+ return `${t && t('responseMessage.emailForgotPasswordTemplateExplanation')}.`;
88
+ },
89
+ //
90
+ 'allRightsReserved': (extra1 = '', extra2 = '', t) => {
91
+ return `${extra1 + ' ' + extra2}, ${t && t('responseMessage.allRightsReserved')}.`;
92
+ },
93
+ 'emailButtonText': (t) => {
94
+ return `${t && t('responseMessage.emailButtonText')}.`;
95
+ },
96
+ 'emailIgnoreText': (t) => {
97
+ return `${t && t('responseMessage.emailIgnoreText')}.`;
98
+ },
99
+ //
100
+ 'welcomeMessage': (username = '', t) => {
101
+ return `@${username} - ${t && t('responseMessage.welcome')}.`;
102
+ },
103
+ 'userIsBlocked': (extra1 = '', t) => {
104
+ return `${extra1}, ${t && t('responseMessage.userIsBlocked')}.`;
105
+ },
106
+ 'passwordChangeCode': (username = '', t) => {
107
+ return `@${username} - ${t && t('responseMessage.passwordChangeCode')}.`;
108
+ },
109
+ 'notEnoughWalletBalance': (money = '', currency = '', t) => {
110
+ return `${money + ' ' + currency}, ${t && t('responseMessage.notEnoughWalletBalance')}.`;
111
+ },
112
+ 'openAuthConsumerOverhang': (param1 = '', param2 = '', t) => {
113
+ return `${param1 + ' ' + param2}, ${t && t('responseMessage.openAuthConsumerOverhang')}.`;
114
+ },
115
+ 'thirdPartySystemOverhang': (param1 = '', param2 = '', t) => {
116
+ return `${param1 + ' ' + param2}, ${t && t('responseMessage.thirdPartySystems')}.`;
117
+ },
118
+ 'deviceOverhang': (param1 = '', param2 = '', t) => {
119
+ return `${param1 + ' ' + param2}, ${t && t('responseMessage.deviceOverhang')}.`;
120
+ },
121
+ 'provisionOverhang': (money = '', currency = '', t) => {
122
+ return `${money + ' ' + currency}, ${t && t('responseMessage.provisionOverhang')}.`;
123
+ },
124
+ 'balanceOverhang': (money = '', currency = '', t) => {
125
+ return `${money + ' ' + currency}, ${t && t('responseMessage.balanceOverhang')}.`;
126
+ },
127
+ 'debtOverhang': (money = '', currency = '', t) => {
128
+ return `${money + ' ' + currency}, ${t && t('responseMessage.debtOverhang')}.`;
129
+ },
130
+ 'shipmentNotAccepted': (value1 = '', value2 = '', t) => {
131
+ return `${t && t('responseMessage.shipmentNotAccepted')}. ${value1} ${value2}`;
132
+ },
133
+ // system
134
+ 'optionsMethod': (methods = '', t) => {
135
+ return `${t && t('responseMessage.optionsMethod')}. ${methods}`;
136
+ },
137
+ 'notAllowedCORS': (methods = '', t) => {
138
+ return `${t && t('responseMessage.notAllowedCORS')}. ${methods}`;
139
+ },
140
+ 'missingCRSFToken': (t) => {
141
+ return `${t && t('responseMessage.missingCSRFToken')}.`;
142
+ },
143
+ 'invalidCRSFToken': (t) => {
144
+ return `${t && t('responseMessage.invalidCSRFToken')}.`;
145
+ },
146
+ 'tooManyRequest': (t) => {
147
+ return `${t && t('responseMessage.tooManyRequest')}.`;
148
+ },
149
+ 'endpointNotFound': (t) => {
150
+ return `${t && t('responseMessage.endpointNotFound')}.`;
151
+ },
152
+ 'roleAccess': (error = '', t) => {
153
+ return `${t && t('responseMessage.roleAccess')}. ${error}`;
154
+ },
155
+ 'authenticationRequiredTokenExpired': (t) => {
156
+ return `${t && t('responseMessage.authenticationRequiredTokenExpired')}.`;
157
+ },
158
+ 'authenticationRequired': (t) => {
159
+ return `${t && t('responseMessage.authenticationRequired')}.`;
160
+ },
161
+ };
@@ -0,0 +1,2 @@
1
+ export declare function calcPercentace(value: number, percentage: number): number;
2
+ export declare function bankersRounding(value: number, decimals?: number): number;
@@ -0,0 +1,14 @@
1
+ export function calcPercentace(value, percentage) {
2
+ if (typeof value !== "number" || typeof percentage !== "number") {
3
+ throw new Error("Değerler sayısal olmalıdır.");
4
+ }
5
+ return (value * percentage) / 100;
6
+ }
7
+ export function bankersRounding(value, decimals = 2) {
8
+ const factor = Math.pow(10, decimals);
9
+ const rounded = Math.round(value * factor);
10
+ const isHalf = (value * factor) % 1 === 0.5;
11
+ return isHalf && rounded % 2 !== 0
12
+ ? (rounded - 1) / factor
13
+ : rounded / factor;
14
+ }
@@ -0,0 +1 @@
1
+ export declare function pickProps<T extends object, K extends keyof T>(obj: T | null | undefined, props: (K | string)[]): Pick<T, K>;
@@ -0,0 +1,55 @@
1
+ export function pickProps(obj, props) {
2
+ if (!obj) {
3
+ return {};
4
+ }
5
+ const negativeProps = new Set();
6
+ const positiveProps = new Set();
7
+ for (const p of props) {
8
+ if (typeof p === 'string' && p.startsWith('-')) {
9
+ negativeProps.add(p.substring(1));
10
+ }
11
+ else {
12
+ positiveProps.add(p);
13
+ }
14
+ }
15
+ function getNestedValue(o, path) {
16
+ return path.reduce((acc, key) => (acc && acc[key] !== undefined ? acc[key] : undefined), o);
17
+ }
18
+ function setNestedValue(o, path, value) {
19
+ let current = o;
20
+ for (let i = 0; i < path.length - 1; i++) {
21
+ if (!(path[i] in current))
22
+ current[path[i]] = {};
23
+ current = current[path[i]];
24
+ }
25
+ current[path[path.length - 1]] = value;
26
+ }
27
+ if (negativeProps.size > 0) {
28
+ const result = {};
29
+ function recurse(currentObj, currentPath = [], resObj) {
30
+ for (const key in currentObj) {
31
+ const fullPath = [...currentPath, key].join('.');
32
+ if (!Array.from(negativeProps).some(neg => fullPath === neg || fullPath.startsWith(neg + '.'))) {
33
+ if (typeof currentObj[key] === 'object' && currentObj[key] !== null && !Array.isArray(currentObj[key])) {
34
+ resObj[key] = {};
35
+ recurse(currentObj[key], [...currentPath, key], resObj[key]);
36
+ }
37
+ else {
38
+ resObj[key] = currentObj[key];
39
+ }
40
+ }
41
+ }
42
+ }
43
+ recurse(obj, [], result);
44
+ return result;
45
+ }
46
+ const result = {};
47
+ for (const p of positiveProps) {
48
+ const path = p.split('.');
49
+ const value = getNestedValue(obj, path);
50
+ if (value !== undefined) {
51
+ setNestedValue(result, path, value);
52
+ }
53
+ }
54
+ return result;
55
+ }
@@ -0,0 +1,2 @@
1
+ export declare const __filename: (metaUrl: string) => string;
2
+ export declare const __dirname: (metaUrl: string) => string;
@@ -0,0 +1,4 @@
1
+ import path from "path";
2
+ import { fileURLToPath } from "url";
3
+ export const __filename = (metaUrl) => fileURLToPath(metaUrl);
4
+ export const __dirname = (metaUrl) => path.dirname(fileURLToPath(metaUrl));
@@ -0,0 +1 @@
1
+ export declare function checkSpecialRegexControl(str: string, regex: RegExp): boolean;
@@ -0,0 +1,3 @@
1
+ export function checkSpecialRegexControl(str, regex) {
2
+ return regex.test(str);
3
+ }
@@ -0,0 +1 @@
1
+ export declare function cleanStringForNormalize(input: string): string;
@@ -0,0 +1,9 @@
1
+ export function cleanStringForNormalize(input) {
2
+ if (typeof input !== 'string')
3
+ return '';
4
+ const cleaned = input
5
+ .normalize('NFD')
6
+ .replace(/\u0307/g, '')
7
+ .normalize('NFC');
8
+ return cleaned;
9
+ }
@@ -0,0 +1,3 @@
1
+ export declare function delay({ duration, }: {
2
+ duration: number;
3
+ }): Promise<unknown>;
@@ -0,0 +1,5 @@
1
+ export async function delay({ duration, }) {
2
+ return new Promise((resolve, reject) => {
3
+ setTimeout(() => resolve(delay), duration);
4
+ });
5
+ }
@@ -0,0 +1,8 @@
1
+ export declare function resolveObjWithHandlebars(obj: any, context: any): any;
2
+ export declare function findFileRecursively(startDir: string, baseName: string, extName?: string, excludedDirs?: string[]): string | null;
3
+ export declare const argvsConverter: (argvs: string) => {
4
+ [key: string]: string;
5
+ };
6
+ export declare const findExt: (filename: string) => string;
7
+ export declare const changeExtensions: (filename: string, repalceExt: string) => string;
8
+ export declare const webFileFindEngine: (folderPath: string) => string[];
@@ -0,0 +1,109 @@
1
+ import path from "path";
2
+ import fs from 'fs';
3
+ import Handlebars from 'handlebars';
4
+ import { SupportFileExtensionsEnum } from "../../index.js";
5
+ export function resolveObjWithHandlebars(obj, context) {
6
+ if (typeof obj === "string") {
7
+ const compileResult = Handlebars.compile(obj);
8
+ return compileResult(context);
9
+ }
10
+ else if (typeof obj === "object" && obj !== null) {
11
+ for (const key in obj) {
12
+ obj[key] = resolveObjWithHandlebars(obj[key], context);
13
+ }
14
+ }
15
+ return obj;
16
+ }
17
+ export function findFileRecursively(startDir, baseName, extName = '', excludedDirs = ['node_modules', '.git']) {
18
+ if (typeof startDir !== 'string' || !fs.existsSync(startDir)) {
19
+ return null;
20
+ }
21
+ const targetName = baseName + (extName.startsWith('.') ? extName : (extName ? `.${extName}` : ''));
22
+ try {
23
+ const entries = fs.readdirSync(startDir, { withFileTypes: true });
24
+ for (const entry of entries) {
25
+ const fullPath = path.join(startDir, entry.name);
26
+ if (entry.isFile()) {
27
+ if (!extName) {
28
+ const entryExt = path.extname(entry.name);
29
+ const entryBase = path.basename(entry.name, entryExt);
30
+ if (entryBase === baseName) {
31
+ return fullPath;
32
+ }
33
+ }
34
+ else {
35
+ if (entry.name === targetName) {
36
+ return fullPath;
37
+ }
38
+ }
39
+ }
40
+ if (entry.isDirectory()) {
41
+ const isHiddenOrExcluded = entry.name.startsWith('.') || excludedDirs.includes(entry.name);
42
+ if (isHiddenOrExcluded) {
43
+ continue;
44
+ }
45
+ const foundPath = findFileRecursively(fullPath, baseName, extName, excludedDirs);
46
+ if (foundPath) {
47
+ return foundPath;
48
+ }
49
+ }
50
+ }
51
+ return null;
52
+ }
53
+ catch (error) {
54
+ if (error.code === 'EACCES') {
55
+ return null;
56
+ }
57
+ return null;
58
+ }
59
+ }
60
+ // => ---
61
+ export const argvsConverter = (argvs) => {
62
+ const reelArgvs = argvs?.slice(2);
63
+ const reelConvertedArgvs = {};
64
+ reelArgvs.forEach((argv) => {
65
+ if (argv.startsWith('--')) {
66
+ console.log(argv);
67
+ const [key, value] = argv.split('=');
68
+ reelConvertedArgvs[key.replace('--', '')] = value || '';
69
+ }
70
+ });
71
+ return reelConvertedArgvs;
72
+ };
73
+ export const findExt = (filename) => {
74
+ const split = filename.split('.');
75
+ return split[split.length - 1];
76
+ };
77
+ export const changeExtensions = (filename, repalceExt) => {
78
+ return filename.replace(findExt(filename), repalceExt);
79
+ };
80
+ export const webFileFindEngine = (folderPath) => {
81
+ try {
82
+ const files = fs.readdirSync(folderPath);
83
+ const fullFileExtension = Object.values(SupportFileExtensionsEnum).map(ext => '.' + ext);
84
+ const filteredFiles = [];
85
+ files.forEach(file => {
86
+ const filePath = path.join(folderPath, file);
87
+ const isDirectory = fs.statSync(filePath).isDirectory();
88
+ if (isDirectory) {
89
+ const subFolderFiles = webFileFindEngine(filePath);
90
+ subFolderFiles.forEach(subFile => {
91
+ filteredFiles.push(path.join(file, subFile).split('\\').join('/')); // Alt klasördeki dosya yolunu, ana klasör yoluna ekleyerek dosyları benzersiz yapıyoruz sonda ise diğer işletim sistemlerien uygun hale getiriyoruz
92
+ });
93
+ }
94
+ else {
95
+ for (const ffn of fullFileExtension) {
96
+ if (file.endsWith(ffn)) {
97
+ filteredFiles.push(file);
98
+ break;
99
+ }
100
+ }
101
+ }
102
+ });
103
+ return filteredFiles;
104
+ }
105
+ catch (error /* unknow */) {
106
+ console.error('Error: ', error.message);
107
+ return [];
108
+ }
109
+ };
@@ -0,0 +1,5 @@
1
+ export declare const validateScopes: ({ scopes, permissions, resources }: {
2
+ scopes: string;
3
+ resources: Array<string>;
4
+ permissions: Array<string>;
5
+ }) => boolean;
@@ -0,0 +1,20 @@
1
+ export const validateScopes = ({ scopes, permissions, resources }) => {
2
+ const parsedScopes = scopes.split(' ');
3
+ function dublicateControl(parsedScopes) {
4
+ const uniqueScopes = new Set(parsedScopes);
5
+ if (uniqueScopes.size !== parsedScopes.length) {
6
+ return true;
7
+ }
8
+ return false;
9
+ }
10
+ if (dublicateControl(parsedScopes)) {
11
+ return false;
12
+ }
13
+ const isInvalid = parsedScopes.some((scope) => {
14
+ const [resource, permission] = scope.split(':');
15
+ const isValidResource = resources.includes(resource);
16
+ const isValidPermission = permissions.includes(permission);
17
+ return !isValidResource || !isValidPermission;
18
+ });
19
+ return !isInvalid;
20
+ };
@@ -0,0 +1,3 @@
1
+ export * from './constants/index.js';
2
+ export * from './helpers/index.js';
3
+ export * from './models/index.js';
@@ -0,0 +1,3 @@
1
+ export * from './constants/index.js';
2
+ export * from './helpers/index.js';
3
+ export * from './models/index.js';