@urga-panel/ur-panels-core 1.0.29 → 1.0.31
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/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/services/abstract/apiService/ApiService.d.ts +10 -0
- package/dist/services/abstract/apiService/ApiService.js +16 -0
- package/dist/services/abstract/webviewServices/WVFrontService.js +1 -1
- package/dist/utils/turkishSearch.d.ts +25 -0
- package/dist/utils/turkishSearch.js +59 -0
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/services/abstract/apiService/ApiService.ts +18 -0
- package/src/services/abstract/webviewServices/WVFrontService.ts +1 -1
- package/src/utils/turkishSearch.ts +64 -0
package/dist/index.d.ts
CHANGED
|
@@ -15,3 +15,4 @@ export { RequestHandlerService } from "./services/main/httpServices/RequestHandl
|
|
|
15
15
|
export { AuthService } from "./services/abstract/authServices/AuthService.js";
|
|
16
16
|
export { LogService, ConsoleTransport, DatabaseTransport, parseLogConfigFromEnv, getDatabaseTransportConfigFromEnv } from "./services/main/logService/index.js";
|
|
17
17
|
export type { ILogEntry, ILogTransport, LogServiceConfig, DatabaseTransportOptions, EnvLogConfig } from "./services/main/logService/index.js";
|
|
18
|
+
export { createTurkishSearchRegex, createTurkishSearchPattern, turkishLowerCase, turkishIncludes } from "./utils/turkishSearch.js";
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,8 @@ export { RequestHandlerService } from "./services/main/httpServices/RequestHandl
|
|
|
17
17
|
export { AuthService } from "./services/abstract/authServices/AuthService.js";
|
|
18
18
|
// LogService exports
|
|
19
19
|
export { LogService, ConsoleTransport, DatabaseTransport, parseLogConfigFromEnv, getDatabaseTransportConfigFromEnv } from "./services/main/logService/index.js";
|
|
20
|
+
// Turkish search utilities (browser-safe, no Node.js dependencies)
|
|
21
|
+
export { createTurkishSearchRegex, createTurkishSearchPattern, turkishLowerCase, turkishIncludes } from "./utils/turkishSearch.js";
|
|
20
22
|
// export { PageControllerService } from "./services/pageServices/controller/PageControllerService.js";
|
|
21
23
|
// export { ExtensionService } from "./services/extensionServices/controller/ExtensionService.js";
|
|
22
24
|
// export { Test2Service } from "./testServices/TestService2";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Service } from "../../../types/Service.js";
|
|
2
2
|
import { ServiceResponse } from "../../../types/ServiceResponse.js";
|
|
3
|
+
export { createTurkishSearchRegex, createTurkishSearchPattern, turkishLowerCase, turkishIncludes } from "../../../utils/turkishSearch.js";
|
|
3
4
|
export declare abstract class ApiService extends Service {
|
|
4
5
|
ots: any;
|
|
5
6
|
apis: {
|
|
@@ -13,5 +14,14 @@ export declare abstract class ApiService extends Service {
|
|
|
13
14
|
};
|
|
14
15
|
protected onStart(): Promise<ServiceResponse>;
|
|
15
16
|
constructor(ots: any);
|
|
17
|
+
/**
|
|
18
|
+
* Creates a Turkish-aware case-insensitive RegExp for MongoDB $regex queries.
|
|
19
|
+
* Usage: const searchRegex = this.createTurkishSearchRegex(search.trim());
|
|
20
|
+
*/
|
|
21
|
+
protected createTurkishSearchRegex(searchTerm: string): RegExp;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a Turkish-aware regex pattern string for MongoDB $regexMatch in aggregation pipelines.
|
|
24
|
+
*/
|
|
25
|
+
protected createTurkishSearchPattern(searchTerm: string): string;
|
|
16
26
|
resposeHandler(response: any): Response;
|
|
17
27
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Service } from "../../../types/Service.js";
|
|
2
|
+
import { createTurkishSearchRegex, createTurkishSearchPattern } from "../../../utils/turkishSearch.js";
|
|
3
|
+
// Re-export for backward compatibility (index.ts also exports from turkishSearch directly)
|
|
4
|
+
export { createTurkishSearchRegex, createTurkishSearchPattern, turkishLowerCase, turkishIncludes } from "../../../utils/turkishSearch.js";
|
|
2
5
|
export class ApiService extends Service {
|
|
3
6
|
ots;
|
|
4
7
|
apis = {};
|
|
@@ -19,6 +22,19 @@ export class ApiService extends Service {
|
|
|
19
22
|
this.ots = ots;
|
|
20
23
|
this.apis = {};
|
|
21
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates a Turkish-aware case-insensitive RegExp for MongoDB $regex queries.
|
|
27
|
+
* Usage: const searchRegex = this.createTurkishSearchRegex(search.trim());
|
|
28
|
+
*/
|
|
29
|
+
createTurkishSearchRegex(searchTerm) {
|
|
30
|
+
return createTurkishSearchRegex(searchTerm);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates a Turkish-aware regex pattern string for MongoDB $regexMatch in aggregation pipelines.
|
|
34
|
+
*/
|
|
35
|
+
createTurkishSearchPattern(searchTerm) {
|
|
36
|
+
return createTurkishSearchPattern(searchTerm);
|
|
37
|
+
}
|
|
22
38
|
resposeHandler(response) {
|
|
23
39
|
if (response.status === "success") {
|
|
24
40
|
return new Response(JSON.stringify(response), {
|
|
@@ -30,7 +30,7 @@ export class WVFrontService extends Service {
|
|
|
30
30
|
this.oWebViewInterface.emit("sendFile", { base64, fileName, mimeType, action: mode });
|
|
31
31
|
}
|
|
32
32
|
gotoBack() {
|
|
33
|
-
this.oWebViewInterface.emit("gotoBack", "");
|
|
33
|
+
this.oWebViewInterface.emit("gotoBack", "back");
|
|
34
34
|
}
|
|
35
35
|
async sendFetchRequest(url, options) {
|
|
36
36
|
this.log.debug("sendFetchRequest", url, options);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turkish locale-aware search utilities.
|
|
3
|
+
*
|
|
4
|
+
* This file has NO Node.js dependencies and is safe to import in frontend (browser) code.
|
|
5
|
+
* Import path: '@urga-panel/ur-panels-core/dist/utils/turkishSearch'
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Creates a Turkish-aware case-insensitive RegExp for MongoDB $regex queries.
|
|
9
|
+
* Handles İ↔i, I↔ı, Ğ↔ğ, Ü↔ü, Ş↔ş, Ö↔ö, Ç↔ç mappings.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createTurkishSearchRegex(searchTerm: string): RegExp;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a Turkish-aware regex pattern string for MongoDB $regexMatch in aggregation pipelines.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createTurkishSearchPattern(searchTerm: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Turkish locale-aware lowercase conversion.
|
|
18
|
+
* Correctly handles İ→i, I→ı (unlike standard toLowerCase which does I→i).
|
|
19
|
+
*/
|
|
20
|
+
export declare function turkishLowerCase(str: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Turkish locale-aware case-insensitive includes check.
|
|
23
|
+
* Use for frontend filtering where MongoDB regex is not available.
|
|
24
|
+
*/
|
|
25
|
+
export declare function turkishIncludes(text: string, term: string): boolean;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turkish locale-aware search utilities.
|
|
3
|
+
*
|
|
4
|
+
* This file has NO Node.js dependencies and is safe to import in frontend (browser) code.
|
|
5
|
+
* Import path: '@urga-panel/ur-panels-core/dist/utils/turkishSearch'
|
|
6
|
+
*/
|
|
7
|
+
// Turkish character mappings for case-insensitive search
|
|
8
|
+
const TURKISH_CHAR_MAP = {
|
|
9
|
+
'i': '[iİ]',
|
|
10
|
+
'İ': '[iİ]',
|
|
11
|
+
'ı': '[ıI]',
|
|
12
|
+
'I': '[ıI]',
|
|
13
|
+
'ğ': '[ğĞ]',
|
|
14
|
+
'Ğ': '[ğĞ]',
|
|
15
|
+
'ü': '[üÜ]',
|
|
16
|
+
'Ü': '[üÜ]',
|
|
17
|
+
'ş': '[şŞ]',
|
|
18
|
+
'Ş': '[şŞ]',
|
|
19
|
+
'ö': '[öÖ]',
|
|
20
|
+
'Ö': '[öÖ]',
|
|
21
|
+
'ç': '[çÇ]',
|
|
22
|
+
'Ç': '[çÇ]',
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Creates a Turkish-aware case-insensitive RegExp for MongoDB $regex queries.
|
|
26
|
+
* Handles İ↔i, I↔ı, Ğ↔ğ, Ü↔ü, Ş↔ş, Ö↔ö, Ç↔ç mappings.
|
|
27
|
+
*/
|
|
28
|
+
export function createTurkishSearchRegex(searchTerm) {
|
|
29
|
+
const regexPattern = searchTerm
|
|
30
|
+
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
31
|
+
.split('')
|
|
32
|
+
.map(char => TURKISH_CHAR_MAP[char] || char)
|
|
33
|
+
.join('');
|
|
34
|
+
return new RegExp(regexPattern, 'i');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates a Turkish-aware regex pattern string for MongoDB $regexMatch in aggregation pipelines.
|
|
38
|
+
*/
|
|
39
|
+
export function createTurkishSearchPattern(searchTerm) {
|
|
40
|
+
return searchTerm
|
|
41
|
+
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
42
|
+
.split('')
|
|
43
|
+
.map(char => TURKISH_CHAR_MAP[char] || char)
|
|
44
|
+
.join('');
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Turkish locale-aware lowercase conversion.
|
|
48
|
+
* Correctly handles İ→i, I→ı (unlike standard toLowerCase which does I→i).
|
|
49
|
+
*/
|
|
50
|
+
export function turkishLowerCase(str) {
|
|
51
|
+
return str.toLocaleLowerCase('tr-TR');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Turkish locale-aware case-insensitive includes check.
|
|
55
|
+
* Use for frontend filtering where MongoDB regex is not available.
|
|
56
|
+
*/
|
|
57
|
+
export function turkishIncludes(text, term) {
|
|
58
|
+
return text.toLocaleLowerCase('tr-TR').includes(term.toLocaleLowerCase('tr-TR'));
|
|
59
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -21,6 +21,9 @@ export { AuthService } from "./services/abstract/authServices/AuthService.js";
|
|
|
21
21
|
export { LogService, ConsoleTransport, DatabaseTransport, parseLogConfigFromEnv, getDatabaseTransportConfigFromEnv } from "./services/main/logService/index.js";
|
|
22
22
|
export type { ILogEntry, ILogTransport, LogServiceConfig, DatabaseTransportOptions, EnvLogConfig } from "./services/main/logService/index.js";
|
|
23
23
|
|
|
24
|
+
// Turkish search utilities (browser-safe, no Node.js dependencies)
|
|
25
|
+
export { createTurkishSearchRegex, createTurkishSearchPattern, turkishLowerCase, turkishIncludes } from "./utils/turkishSearch.js";
|
|
26
|
+
|
|
24
27
|
|
|
25
28
|
// export { PageControllerService } from "./services/pageServices/controller/PageControllerService.js";
|
|
26
29
|
// export { ExtensionService } from "./services/extensionServices/controller/ExtensionService.js";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Service } from "../../../types/Service";
|
|
2
2
|
import { ServiceResponse } from "../../../types/ServiceResponse";
|
|
3
3
|
import { RequestHandlerService } from "../../main/httpServices/RequestHandlerService";
|
|
4
|
+
import { createTurkishSearchRegex, createTurkishSearchPattern } from "../../../utils/turkishSearch";
|
|
4
5
|
|
|
6
|
+
// Re-export for backward compatibility (index.ts also exports from turkishSearch directly)
|
|
7
|
+
export { createTurkishSearchRegex, createTurkishSearchPattern, turkishLowerCase, turkishIncludes } from "../../../utils/turkishSearch";
|
|
5
8
|
|
|
6
9
|
export abstract class ApiService extends Service {
|
|
7
10
|
|
|
@@ -36,6 +39,21 @@ export abstract class ApiService extends Service {
|
|
|
36
39
|
this.apis = {};
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Creates a Turkish-aware case-insensitive RegExp for MongoDB $regex queries.
|
|
44
|
+
* Usage: const searchRegex = this.createTurkishSearchRegex(search.trim());
|
|
45
|
+
*/
|
|
46
|
+
protected createTurkishSearchRegex(searchTerm: string): RegExp {
|
|
47
|
+
return createTurkishSearchRegex(searchTerm);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Creates a Turkish-aware regex pattern string for MongoDB $regexMatch in aggregation pipelines.
|
|
52
|
+
*/
|
|
53
|
+
protected createTurkishSearchPattern(searchTerm: string): string {
|
|
54
|
+
return createTurkishSearchPattern(searchTerm);
|
|
55
|
+
}
|
|
56
|
+
|
|
39
57
|
resposeHandler(response: any): Response {
|
|
40
58
|
if (response.status === "success") {
|
|
41
59
|
return new Response(JSON.stringify(response), {
|
|
@@ -43,7 +43,7 @@ export class WVFrontService extends Service {
|
|
|
43
43
|
this.oWebViewInterface.emit("sendFile", { base64, fileName, mimeType, action: mode });
|
|
44
44
|
}
|
|
45
45
|
public gotoBack() {
|
|
46
|
-
this.oWebViewInterface.emit("gotoBack", "");
|
|
46
|
+
this.oWebViewInterface.emit("gotoBack", "back");
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
public async sendFetchRequest(url: string, options?: RequestInit): Promise<any> {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turkish locale-aware search utilities.
|
|
3
|
+
*
|
|
4
|
+
* This file has NO Node.js dependencies and is safe to import in frontend (browser) code.
|
|
5
|
+
* Import path: '@urga-panel/ur-panels-core/dist/utils/turkishSearch'
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Turkish character mappings for case-insensitive search
|
|
9
|
+
const TURKISH_CHAR_MAP: { [key: string]: string } = {
|
|
10
|
+
'i': '[iİ]',
|
|
11
|
+
'İ': '[iİ]',
|
|
12
|
+
'ı': '[ıI]',
|
|
13
|
+
'I': '[ıI]',
|
|
14
|
+
'ğ': '[ğĞ]',
|
|
15
|
+
'Ğ': '[ğĞ]',
|
|
16
|
+
'ü': '[üÜ]',
|
|
17
|
+
'Ü': '[üÜ]',
|
|
18
|
+
'ş': '[şŞ]',
|
|
19
|
+
'Ş': '[şŞ]',
|
|
20
|
+
'ö': '[öÖ]',
|
|
21
|
+
'Ö': '[öÖ]',
|
|
22
|
+
'ç': '[çÇ]',
|
|
23
|
+
'Ç': '[çÇ]',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates a Turkish-aware case-insensitive RegExp for MongoDB $regex queries.
|
|
28
|
+
* Handles İ↔i, I↔ı, Ğ↔ğ, Ü↔ü, Ş↔ş, Ö↔ö, Ç↔ç mappings.
|
|
29
|
+
*/
|
|
30
|
+
export function createTurkishSearchRegex(searchTerm: string): RegExp {
|
|
31
|
+
const regexPattern = searchTerm
|
|
32
|
+
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
33
|
+
.split('')
|
|
34
|
+
.map(char => TURKISH_CHAR_MAP[char] || char)
|
|
35
|
+
.join('');
|
|
36
|
+
return new RegExp(regexPattern, 'i');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Creates a Turkish-aware regex pattern string for MongoDB $regexMatch in aggregation pipelines.
|
|
41
|
+
*/
|
|
42
|
+
export function createTurkishSearchPattern(searchTerm: string): string {
|
|
43
|
+
return searchTerm
|
|
44
|
+
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
45
|
+
.split('')
|
|
46
|
+
.map(char => TURKISH_CHAR_MAP[char] || char)
|
|
47
|
+
.join('');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Turkish locale-aware lowercase conversion.
|
|
52
|
+
* Correctly handles İ→i, I→ı (unlike standard toLowerCase which does I→i).
|
|
53
|
+
*/
|
|
54
|
+
export function turkishLowerCase(str: string): string {
|
|
55
|
+
return str.toLocaleLowerCase('tr-TR');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Turkish locale-aware case-insensitive includes check.
|
|
60
|
+
* Use for frontend filtering where MongoDB regex is not available.
|
|
61
|
+
*/
|
|
62
|
+
export function turkishIncludes(text: string, term: string): boolean {
|
|
63
|
+
return text.toLocaleLowerCase('tr-TR').includes(term.toLocaleLowerCase('tr-TR'));
|
|
64
|
+
}
|