ismx-nexo-node-app 0.4.100 → 0.4.102
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/js/business/BusinessServer.js +10 -8
- package/dist/js/business/utils/StringUtils.js +18 -0
- package/dist/js/repository/RepositoryRest.js +1 -2
- package/dist/types/business/utils/StringUtils.d.ts +13 -0
- package/package.json +1 -1
- package/src/main/node/business/BusinessServer.ts +2 -1
- package/src/main/node/business/utils/StringUtils.ts +19 -0
- package/src/main/node/repository/RepositoryRest.ts +1 -1
|
@@ -156,22 +156,24 @@ class BusinessServer extends Business_1.default {
|
|
|
156
156
|
}
|
|
157
157
|
load(parent, path) {
|
|
158
158
|
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
const
|
|
159
|
+
/*
|
|
160
|
+
const { readdir } = await import('fs/promises');
|
|
161
|
+
const pathModule = await import('path');
|
|
162
|
+
const { fileURLToPath } = await import('url');
|
|
163
|
+
|
|
162
164
|
// @ts-ignore
|
|
163
165
|
const __dirname = pathModule.dirname(fileURLToPath(parent));
|
|
164
166
|
const servicesPath = pathModule.join(__dirname, path);
|
|
165
|
-
|
|
167
|
+
|
|
168
|
+
const files = await readdir(servicesPath);
|
|
166
169
|
for (const file of files) {
|
|
167
|
-
if (!file.endsWith('.ts') && !file.endsWith('.js'))
|
|
168
|
-
continue;
|
|
170
|
+
if (!file.endsWith('.ts') && !file.endsWith('.js')) continue;
|
|
169
171
|
const modulePath = pathModule.join(servicesPath, file);
|
|
170
|
-
const mod =
|
|
172
|
+
const mod = await import(modulePath);
|
|
171
173
|
const ServiceClass = Object.values(mod)[0];
|
|
172
174
|
// @ts-ignore
|
|
173
175
|
const instance = new ServiceClass();
|
|
174
|
-
}
|
|
176
|
+
}*/
|
|
175
177
|
});
|
|
176
178
|
}
|
|
177
179
|
}
|
|
@@ -23,9 +23,27 @@ class StringUtils {
|
|
|
23
23
|
result += chars.charAt(Math.floor(Math.random() * charactersLength));
|
|
24
24
|
return result;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Converts the first character of a given string to uppercase and returns the modified string.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} str - The string to be capitalized.
|
|
30
|
+
* @return {string} The input string with its first character converted to uppercase. If the input string is empty or null, it returns the original string.
|
|
31
|
+
*/
|
|
26
32
|
static capitalize(text) {
|
|
27
33
|
var _a;
|
|
28
34
|
return ((_a = text === null || text === void 0 ? void 0 : text.charAt(0)) === null || _a === void 0 ? void 0 : _a.toUpperCase()) + (text === null || text === void 0 ? void 0 : text.slice(1));
|
|
29
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Counts the number of words in the given string.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} str - The input string to be analyzed.
|
|
40
|
+
* @return {number} The total count of words found in the string.
|
|
41
|
+
*/
|
|
42
|
+
static countWords(str) {
|
|
43
|
+
if (str === null || str === undefined)
|
|
44
|
+
return 0;
|
|
45
|
+
const words = str.match(/\b[\p{L}\p{N}]+(?:'[\p{L}\p{N}]+)?\b/gu);
|
|
46
|
+
return words ? words.length : 0;
|
|
47
|
+
}
|
|
30
48
|
}
|
|
31
49
|
exports.default = StringUtils;
|
|
@@ -77,7 +77,6 @@ class RepositoryRest extends Repository_1.default {
|
|
|
77
77
|
RepositoryRest.defaultReviver = (key, value) => {
|
|
78
78
|
if (DateUtils_1.default.isIsoDate(value))
|
|
79
79
|
return new Date(value);
|
|
80
|
-
|
|
81
|
-
return value;
|
|
80
|
+
return value;
|
|
82
81
|
};
|
|
83
82
|
exports.default = RepositoryRest;
|
|
@@ -3,5 +3,18 @@ export default abstract class StringUtils {
|
|
|
3
3
|
static base64Encode(buffer: Buffer): string;
|
|
4
4
|
static base64UrlDecode(base64: string): Buffer;
|
|
5
5
|
static random(length: number, chars?: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Converts the first character of a given string to uppercase and returns the modified string.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} str - The string to be capitalized.
|
|
10
|
+
* @return {string} The input string with its first character converted to uppercase. If the input string is empty or null, it returns the original string.
|
|
11
|
+
*/
|
|
6
12
|
static capitalize(text: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Counts the number of words in the given string.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} str - The input string to be analyzed.
|
|
17
|
+
* @return {number} The total count of words found in the string.
|
|
18
|
+
*/
|
|
19
|
+
static countWords(str: string): number;
|
|
7
20
|
}
|
package/package.json
CHANGED
|
@@ -115,6 +115,7 @@ export default class BusinessServer extends Business
|
|
|
115
115
|
|
|
116
116
|
public async load(parent: string, path: string): Promise<void>
|
|
117
117
|
{
|
|
118
|
+
/*
|
|
118
119
|
const { readdir } = await import('fs/promises');
|
|
119
120
|
const pathModule = await import('path');
|
|
120
121
|
const { fileURLToPath } = await import('url');
|
|
@@ -131,6 +132,6 @@ export default class BusinessServer extends Business
|
|
|
131
132
|
const ServiceClass = Object.values(mod)[0];
|
|
132
133
|
// @ts-ignore
|
|
133
134
|
const instance = new ServiceClass();
|
|
134
|
-
}
|
|
135
|
+
}*/
|
|
135
136
|
}
|
|
136
137
|
}
|
|
@@ -26,7 +26,26 @@ export default abstract class StringUtils {
|
|
|
26
26
|
return result;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Converts the first character of a given string to uppercase and returns the modified string.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} str - The string to be capitalized.
|
|
33
|
+
* @return {string} The input string with its first character converted to uppercase. If the input string is empty or null, it returns the original string.
|
|
34
|
+
*/
|
|
29
35
|
static capitalize(text: string): string {
|
|
30
36
|
return text?.charAt(0)?.toUpperCase() + text?.slice(1);
|
|
31
37
|
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Counts the number of words in the given string.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} str - The input string to be analyzed.
|
|
43
|
+
* @return {number} The total count of words found in the string.
|
|
44
|
+
*/
|
|
45
|
+
static countWords(str: string): number {
|
|
46
|
+
if (str === null || str === undefined) return 0;
|
|
47
|
+
const words = str.match(/\b[\p{L}\p{N}]+(?:'[\p{L}\p{N}]+)?\b/gu);
|
|
48
|
+
return words ? words.length : 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
32
51
|
}
|