namirasoft-core 1.5.2 → 1.5.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 (57) hide show
  1. package/SKILL.md +223 -223
  2. package/dist/TimeOperation.d.ts +1 -0
  3. package/dist/TimeOperation.js +4 -0
  4. package/dist/TimeOperation.js.map +1 -1
  5. package/package.json +26 -26
  6. package/src/BaseDatabaseRow.ts +6 -6
  7. package/src/BaseLogger.ts +24 -24
  8. package/src/BaseMetaColumn.ts +17 -17
  9. package/src/BaseMetaDatabase.ts +30 -30
  10. package/src/BaseMetaTable.ts +40 -40
  11. package/src/BaseServer.ts +150 -150
  12. package/src/BaseUUID.ts +76 -76
  13. package/src/ByteOperation.ts +57 -57
  14. package/src/CacheService.ts +76 -76
  15. package/src/ColorOperation.ts +153 -153
  16. package/src/ConsoleOperation.ts +68 -68
  17. package/src/ConvertService.ts +123 -123
  18. package/src/CookieService.ts +33 -33
  19. package/src/Countries.ts +486 -486
  20. package/src/Country.ts +21 -21
  21. package/src/CountryOperation.ts +98 -98
  22. package/src/CronOperation.ts +121 -121
  23. package/src/EncodingOperation.ts +46 -46
  24. package/src/EnvService.ts +28 -28
  25. package/src/ErrorOperation.ts +13 -13
  26. package/src/FileOperation.ts +60 -60
  27. package/src/FilterItem.ts +117 -117
  28. package/src/FilterItemColumnType.ts +9 -9
  29. package/src/FilterItemOperator.ts +52 -52
  30. package/src/GeoOperation.ts +18 -18
  31. package/src/HTTPError.ts +8 -8
  32. package/src/HTTPMethod.ts +7 -7
  33. package/src/HashOperation.ts +24 -24
  34. package/src/ILogger.ts +17 -17
  35. package/src/IStorage.ts +5 -5
  36. package/src/IStorageCookie.ts +52 -52
  37. package/src/IStorageJsonFile.ts +45 -45
  38. package/src/IStorageLocal.ts +16 -16
  39. package/src/IStorageMemoryDedicated.ts +17 -17
  40. package/src/IStorageMemoryShared.ts +21 -21
  41. package/src/IStorageSession.ts +16 -16
  42. package/src/LogLevel.ts +11 -11
  43. package/src/NamingConvention.ts +199 -199
  44. package/src/ObjectService.ts +27 -27
  45. package/src/PackageService.ts +76 -76
  46. package/src/PasswordOperation.ts +12 -12
  47. package/src/PhoneOperation.ts +8 -8
  48. package/src/PriceOperation.ts +20 -20
  49. package/src/SearchOperation.ts +31 -31
  50. package/src/SetTimeouService.ts +32 -32
  51. package/src/SortItem.ts +88 -88
  52. package/src/StringOperation.ts +22 -22
  53. package/src/TimeOperation.ts +303 -299
  54. package/src/TimeUnitOperation.ts +82 -82
  55. package/src/URLOperation.ts +66 -66
  56. package/src/VersionOperation.ts +46 -46
  57. package/src/index.ts +52 -52
package/src/IStorage.ts CHANGED
@@ -1,6 +1,6 @@
1
- export abstract class IStorage
2
- {
3
- abstract get(name: string, defaultValue: string): string;
4
- abstract set(name: string, value: string): void;
5
- abstract del(name: string): void;
1
+ export abstract class IStorage
2
+ {
3
+ abstract get(name: string, defaultValue: string): string;
4
+ abstract set(name: string, value: string): void;
5
+ abstract del(name: string): void;
6
6
  }
@@ -1,53 +1,53 @@
1
- import { EncodingOperation } from "./EncodingOperation";
2
- import { IStorage } from "./IStorage";
3
-
4
- export class IStorageCookie extends IStorage
5
- {
6
- private fixed: { [name: string]: string };
7
- private cookies?: string;
8
- constructor(fixed: { [name: string]: string }, cookies?: string)
9
- {
10
- super();
11
- this.fixed = fixed;
12
- this.cookies = cookies;
13
- }
14
- private getAll(): { [name: string]: string }
15
- {
16
- let ans: { [name: string]: string } = {};
17
- let items = (this.cookies ?? document.cookie).split(";");
18
- for (let i = 0; i < items.length; i++)
19
- {
20
- const ops = items[i].split("=");
21
- ans[ops[0].trim()] = ops[1]?.trim().replace(/\%3D/gm, "=");
22
- }
23
- return ans;
24
- }
25
- override get(name: string, defaultValue: string)
26
- {
27
- try
28
- {
29
- let all = this.getAll();
30
- return EncodingOperation.Base64Decode(all[name]) ?? defaultValue;
31
- } catch (error)
32
- {
33
- return defaultValue;
34
- }
35
- }
36
- override set(name: string, value: string)
37
- {
38
- try
39
- {
40
- let items = [];
41
- for (let key of Object.keys(this.fixed))
42
- items.push(`${key}=${this.fixed[key]}`);
43
- items.push(`${name}=${EncodingOperation.Base64Encode(value)}`);
44
- document.cookie = items.join(";");
45
- } catch (error)
46
- {
47
- }
48
- }
49
- override del(name: string)
50
- {
51
- this.set(name, "");
52
- }
1
+ import { EncodingOperation } from "./EncodingOperation";
2
+ import { IStorage } from "./IStorage";
3
+
4
+ export class IStorageCookie extends IStorage
5
+ {
6
+ private fixed: { [name: string]: string };
7
+ private cookies?: string;
8
+ constructor(fixed: { [name: string]: string }, cookies?: string)
9
+ {
10
+ super();
11
+ this.fixed = fixed;
12
+ this.cookies = cookies;
13
+ }
14
+ private getAll(): { [name: string]: string }
15
+ {
16
+ let ans: { [name: string]: string } = {};
17
+ let items = (this.cookies ?? document.cookie).split(";");
18
+ for (let i = 0; i < items.length; i++)
19
+ {
20
+ const ops = items[i].split("=");
21
+ ans[ops[0].trim()] = ops[1]?.trim().replace(/\%3D/gm, "=");
22
+ }
23
+ return ans;
24
+ }
25
+ override get(name: string, defaultValue: string)
26
+ {
27
+ try
28
+ {
29
+ let all = this.getAll();
30
+ return EncodingOperation.Base64Decode(all[name]) ?? defaultValue;
31
+ } catch (error)
32
+ {
33
+ return defaultValue;
34
+ }
35
+ }
36
+ override set(name: string, value: string)
37
+ {
38
+ try
39
+ {
40
+ let items = [];
41
+ for (let key of Object.keys(this.fixed))
42
+ items.push(`${key}=${this.fixed[key]}`);
43
+ items.push(`${name}=${EncodingOperation.Base64Encode(value)}`);
44
+ document.cookie = items.join(";");
45
+ } catch (error)
46
+ {
47
+ }
48
+ }
49
+ override del(name: string)
50
+ {
51
+ this.set(name, "");
52
+ }
53
53
  }
@@ -1,46 +1,46 @@
1
- import fs from "fs";
2
- import { IStorage } from "./IStorage";
3
-
4
- export class IStorageJsonFile extends IStorage
5
- {
6
- private data: any;
7
- private base_path: string;
8
- constructor(base_path: string)
9
- {
10
- super();
11
- this.base_path = base_path;
12
- }
13
- static data: { [name: string]: string } = {};
14
- private load(): void
15
- {
16
- try
17
- {
18
- let content = fs.readFileSync(this.base_path, { encoding: "utf8" });
19
- this.data = JSON.parse(content);
20
- } catch (error)
21
- {
22
- this.data = {};
23
- }
24
- }
25
- private save(): void
26
- {
27
- fs.writeFileSync(this.base_path, JSON.stringify(this.data));
28
- }
29
- override get(name: string, defaultValue: string)
30
- {
31
- this.load();
32
- return this.data[name] ?? defaultValue;
33
- }
34
- override set(name: string, value: string)
35
- {
36
- this.load();
37
- this.data[name] = value;
38
- this.save();
39
- }
40
- override del(name: string)
41
- {
42
- this.load();
43
- delete this.data[name];
44
- this.save();
45
- }
1
+ import fs from "fs";
2
+ import { IStorage } from "./IStorage";
3
+
4
+ export class IStorageJsonFile extends IStorage
5
+ {
6
+ private data: any;
7
+ private base_path: string;
8
+ constructor(base_path: string)
9
+ {
10
+ super();
11
+ this.base_path = base_path;
12
+ }
13
+ static data: { [name: string]: string } = {};
14
+ private load(): void
15
+ {
16
+ try
17
+ {
18
+ let content = fs.readFileSync(this.base_path, { encoding: "utf8" });
19
+ this.data = JSON.parse(content);
20
+ } catch (error)
21
+ {
22
+ this.data = {};
23
+ }
24
+ }
25
+ private save(): void
26
+ {
27
+ fs.writeFileSync(this.base_path, JSON.stringify(this.data));
28
+ }
29
+ override get(name: string, defaultValue: string)
30
+ {
31
+ this.load();
32
+ return this.data[name] ?? defaultValue;
33
+ }
34
+ override set(name: string, value: string)
35
+ {
36
+ this.load();
37
+ this.data[name] = value;
38
+ this.save();
39
+ }
40
+ override del(name: string)
41
+ {
42
+ this.load();
43
+ delete this.data[name];
44
+ this.save();
45
+ }
46
46
  }
@@ -1,17 +1,17 @@
1
- import { IStorage } from "./IStorage.js";
2
-
3
- export class IStorageLocal extends IStorage
4
- {
5
- override get(name: string, defaultValue: string)
6
- {
7
- return localStorage.getItem(name) ?? defaultValue;
8
- }
9
- override set(name: string, value: string)
10
- {
11
- localStorage.setItem(name, value);
12
- }
13
- override del(name: string)
14
- {
15
- localStorage.removeItem(name);
16
- }
1
+ import { IStorage } from "./IStorage.js";
2
+
3
+ export class IStorageLocal extends IStorage
4
+ {
5
+ override get(name: string, defaultValue: string)
6
+ {
7
+ return localStorage.getItem(name) ?? defaultValue;
8
+ }
9
+ override set(name: string, value: string)
10
+ {
11
+ localStorage.setItem(name, value);
12
+ }
13
+ override del(name: string)
14
+ {
15
+ localStorage.removeItem(name);
16
+ }
17
17
  }
@@ -1,18 +1,18 @@
1
- import { IStorage } from "./IStorage";
2
-
3
- export class IStorageMemoryDedicated extends IStorage
4
- {
5
- data: { [name: string]: string } = {};
6
- override get(name: string, defaultValue: string)
7
- {
8
- return this.data[name] ?? defaultValue;
9
- }
10
- override set(name: string, value: string)
11
- {
12
- this.data[name] = value;
13
- }
14
- override del(name: string)
15
- {
16
- delete this.data[name];
17
- }
1
+ import { IStorage } from "./IStorage";
2
+
3
+ export class IStorageMemoryDedicated extends IStorage
4
+ {
5
+ data: { [name: string]: string } = {};
6
+ override get(name: string, defaultValue: string)
7
+ {
8
+ return this.data[name] ?? defaultValue;
9
+ }
10
+ override set(name: string, value: string)
11
+ {
12
+ this.data[name] = value;
13
+ }
14
+ override del(name: string)
15
+ {
16
+ delete this.data[name];
17
+ }
18
18
  }
@@ -1,22 +1,22 @@
1
- import { IStorage } from "./IStorage";
2
-
3
- export class IStorageMemoryShared extends IStorage
4
- {
5
- static data: { [name: string]: string } = {};
6
- constructor()
7
- {
8
- super();
9
- }
10
- override get(name: string, defaultValue: string)
11
- {
12
- return IStorageMemoryShared.data[name] ?? defaultValue;
13
- }
14
- override set(name: string, value: string)
15
- {
16
- IStorageMemoryShared.data[name] = value;
17
- }
18
- override del(name: string)
19
- {
20
- delete IStorageMemoryShared.data[name];
21
- }
1
+ import { IStorage } from "./IStorage";
2
+
3
+ export class IStorageMemoryShared extends IStorage
4
+ {
5
+ static data: { [name: string]: string } = {};
6
+ constructor()
7
+ {
8
+ super();
9
+ }
10
+ override get(name: string, defaultValue: string)
11
+ {
12
+ return IStorageMemoryShared.data[name] ?? defaultValue;
13
+ }
14
+ override set(name: string, value: string)
15
+ {
16
+ IStorageMemoryShared.data[name] = value;
17
+ }
18
+ override del(name: string)
19
+ {
20
+ delete IStorageMemoryShared.data[name];
21
+ }
22
22
  }
@@ -1,17 +1,17 @@
1
- import { IStorage } from "./IStorage.js";
2
-
3
- export class IStorageSession extends IStorage
4
- {
5
- override get(name: string, defaultValue: string)
6
- {
7
- return sessionStorage.getItem(name) ?? defaultValue;
8
- }
9
- override set(name: string, value: string)
10
- {
11
- sessionStorage.setItem(name, value);
12
- }
13
- override del(name: string)
14
- {
15
- sessionStorage.removeItem(name);
16
- }
1
+ import { IStorage } from "./IStorage.js";
2
+
3
+ export class IStorageSession extends IStorage
4
+ {
5
+ override get(name: string, defaultValue: string)
6
+ {
7
+ return sessionStorage.getItem(name) ?? defaultValue;
8
+ }
9
+ override set(name: string, value: string)
10
+ {
11
+ sessionStorage.setItem(name, value);
12
+ }
13
+ override del(name: string)
14
+ {
15
+ sessionStorage.removeItem(name);
16
+ }
17
17
  }
package/src/LogLevel.ts CHANGED
@@ -1,12 +1,12 @@
1
- export enum LogLevel
2
- {
3
- Trace = "Trace",
4
- Verbose = "Verbose",
5
- Debug = "Debug",
6
- Info = "Info",
7
- Success = "Success",
8
- Warning = "Warning",
9
- Error = "Error",
10
- Critical = "Critical",
11
- Fatal = "Fatal"
1
+ export enum LogLevel
2
+ {
3
+ Trace = "Trace",
4
+ Verbose = "Verbose",
5
+ Debug = "Debug",
6
+ Info = "Info",
7
+ Success = "Success",
8
+ Warning = "Warning",
9
+ Error = "Error",
10
+ Critical = "Critical",
11
+ Fatal = "Fatal"
12
12
  }