@mrxsys/mrx-core 2.11.0-1-and-267-20250925 → 2.11.1-1-and-275-20251023

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/dist/{chunk-fp8xg6kq.js → chunk-441xs5k1.js} +1 -1
  2. package/dist/{chunk-bdcsh435.js → chunk-4v86f7gp.js} +5 -5
  3. package/dist/{chunk-00s6t4tw.js → chunk-7t524zqh.js} +4 -4
  4. package/dist/{chunk-d1vp74n0.js → chunk-afd82epa.js} +2 -2
  5. package/dist/{chunk-v9kvw5x7.js → chunk-afyz8rg5.js} +2 -2
  6. package/dist/{chunk-6sfnrhfs.js → chunk-pjv1ekwr.js} +33 -1
  7. package/dist/chunk-rz5p4j3p.js +13 -0
  8. package/dist/{chunk-h9t48r9q.js → chunk-sqts8vyk.js} +16 -2
  9. package/dist/errors/enums/http-status-codes.d.ts +15 -1
  10. package/dist/errors/enums/index.d.ts +1 -1
  11. package/dist/errors/enums/index.js +3 -3
  12. package/dist/errors/http-error.d.ts +3 -3
  13. package/dist/errors/index.js +2 -2
  14. package/dist/errors/utils/index.js +2 -2
  15. package/dist/modules/database/enums/database-error-keys.d.ts +2 -2
  16. package/dist/modules/database/enums/index.js +1 -1
  17. package/dist/modules/database/index.js +5 -5
  18. package/dist/modules/elysia/cache/cache.d.ts +8 -14
  19. package/dist/modules/elysia/cache/index.js +66 -46
  20. package/dist/modules/elysia/cache/types/cache-item.d.ts +0 -1
  21. package/dist/modules/elysia/cache/types/cache-options.d.ts +2 -11
  22. package/dist/modules/elysia/crud/index.js +16 -16
  23. package/dist/modules/elysia/crud/operations/count.d.ts +1 -1
  24. package/dist/modules/elysia/crud/operations/delete.d.ts +1 -1
  25. package/dist/modules/elysia/crud/operations/deleteOne.d.ts +1 -1
  26. package/dist/modules/elysia/crud/operations/find.d.ts +1 -1
  27. package/dist/modules/elysia/crud/operations/findOne.d.ts +1 -1
  28. package/dist/modules/elysia/crud/operations/index.js +7 -7
  29. package/dist/modules/elysia/crud/operations/insert.d.ts +1 -1
  30. package/dist/modules/elysia/crud/operations/update.d.ts +1 -1
  31. package/dist/modules/elysia/crud/operations/updateOne.d.ts +1 -1
  32. package/dist/modules/elysia/db-resolver/db-resolver.d.ts +1 -1
  33. package/dist/modules/elysia/db-resolver/index.js +6 -6
  34. package/dist/modules/elysia/error/index.js +2 -2
  35. package/dist/modules/elysia/microservice/microservice.d.ts +12 -12
  36. package/dist/modules/elysia/rate-limit/index.js +53 -28
  37. package/dist/modules/elysia/rate-limit/rate-limit.d.ts +361 -32
  38. package/dist/modules/elysia/rate-limit/types/rate-limit-options.d.ts +0 -9
  39. package/dist/modules/jwt/index.js +2 -2
  40. package/dist/modules/kv-store/bun-redis/bun-redis-store.d.ts +25 -0
  41. package/dist/modules/kv-store/bun-redis/index.d.ts +1 -0
  42. package/dist/modules/kv-store/bun-redis/index.js +76 -0
  43. package/dist/modules/kv-store/ioredis/index.js +4 -10
  44. package/dist/modules/kv-store/ioredis/ioredis-store.d.ts +0 -82
  45. package/dist/modules/kv-store/memory/index.js +98 -4
  46. package/dist/modules/kv-store/memory/memory-store.d.ts +0 -84
  47. package/dist/modules/kv-store/types/kv-store.d.ts +2 -2
  48. package/dist/modules/logger/enums/index.js +1 -1
  49. package/dist/modules/logger/enums/logger-error-keys.d.ts +6 -3
  50. package/dist/modules/logger/events/logger-events.d.ts +12 -3
  51. package/dist/modules/logger/index.js +173 -81
  52. package/dist/modules/logger/logger.d.ts +115 -133
  53. package/dist/modules/logger/sinks/console-logger.d.ts +2 -16
  54. package/dist/modules/logger/sinks/devnull-logger.d.ts +8 -0
  55. package/dist/modules/logger/sinks/file-logger/enums/file-logger-error-keys.d.ts +3 -0
  56. package/dist/modules/logger/sinks/file-logger/file-logger.d.ts +25 -0
  57. package/dist/modules/logger/sinks/index.d.ts +4 -2
  58. package/dist/modules/logger/sinks/index.js +54 -31
  59. package/dist/modules/logger/types/index.d.ts +6 -6
  60. package/dist/modules/logger/types/log-levels.d.ts +1 -4
  61. package/dist/modules/logger/types/logger-options.d.ts +41 -0
  62. package/dist/modules/logger/types/logger-sink.d.ts +12 -3
  63. package/dist/modules/logger/types/sink-bodies-intersection.d.ts +2 -0
  64. package/dist/modules/logger/types/sink-body.d.ts +1 -1
  65. package/dist/modules/logger/types/sink-map.d.ts +1 -1
  66. package/dist/modules/repository/index.js +4 -4
  67. package/dist/modules/repository/types/query-options.d.ts +2 -2
  68. package/package.json +30 -25
  69. package/dist/chunk-b23dvm2d.js +0 -29
  70. package/dist/chunk-b96fm9ph.js +0 -10
  71. package/dist/chunk-e30paw8a.js +0 -101
  72. package/dist/modules/elysia/cache/utils/index.d.ts +0 -1
  73. package/dist/modules/elysia/cache/utils/index.js +0 -7
  74. package/dist/modules/logger/sinks/file-logger.d.ts +0 -25
  75. package/dist/modules/logger/types/bodies-intersection.d.ts +0 -2
  76. package/dist/modules/logger/types/log-stream-chunk.d.ts +0 -15
package/package.json CHANGED
@@ -1,32 +1,32 @@
1
1
  {
2
2
  "name": "@mrxsys/mrx-core",
3
- "version": "2.11.0-1-and-267-20250925",
3
+ "version": "2.11.1-1-and-275-20251023",
4
4
  "author": "Ruby",
5
5
  "devDependencies": {
6
- "@eslint/js": "^9.36.0",
6
+ "@eslint/js": "^9.38.0",
7
7
  "@sinclair/typebox": "0.34.41",
8
- "@stylistic/eslint-plugin": "^5.4.0",
9
- "@types/bun": "^1.2.22",
10
- "@types/nodemailer": "^7.0.1",
11
- "elysia": "1.4.7",
12
- "eslint": "^9.36.0",
8
+ "@stylistic/eslint-plugin": "^5.5.0",
9
+ "@types/bun": "^1.3.0",
10
+ "@types/nodemailer": "^7.0.2",
11
+ "elysia": "1.4.13",
12
+ "eslint": "^9.38.0",
13
13
  "globals": "^16.4.0",
14
- "ioredis": "^5.8.0",
14
+ "ioredis": "^5.8.2",
15
15
  "jose": "^6.1.0",
16
16
  "knex": "^3.1.0",
17
- "mssql": "^11.0.1",
18
- "nodemailer": "^7.0.6",
19
- "typescript-eslint": "^8.44.1"
17
+ "mssql": "^12.0.0",
18
+ "nodemailer": "^7.0.10",
19
+ "typescript-eslint": "^8.46.2"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "@sinclair/typebox": "0.34.41",
23
- "elysia": "^1.4.7",
24
- "ioredis": "^5.8.0",
23
+ "elysia": "^1.4.12",
24
+ "ioredis": "^5.8.2",
25
25
  "jose": "^6.1.0",
26
+ "mssql": "^12.0.0",
26
27
  "knex": "^3.1.0",
27
- "mssql": "^11.0.1",
28
- "nodemailer": "^7.0.6",
29
- "typescript": "^5.9.2"
28
+ "nodemailer": "^7.0.9",
29
+ "typescript": "^5.9.3"
30
30
  },
31
31
  "exports": {
32
32
  "./errors": "./dist/errors/index.js",
@@ -42,7 +42,6 @@
42
42
  "./modules/database/types": "./dist/modules/database/types/index.js",
43
43
  "./modules/elysia/cache": "./dist/modules/elysia/cache/index.js",
44
44
  "./modules/elysia/cache/types": "./dist/modules/elysia/cache/types/index.js",
45
- "./modules/elysia/cache/utils": "./dist/modules/elysia/cache/utils/index.js",
46
45
  "./modules/elysia/crud": "./dist/modules/elysia/crud/index.js",
47
46
  "./modules/elysia/crud/enums": "./dist/modules/elysia/crud/enums/index.js",
48
47
  "./modules/elysia/crud/operations": "./dist/modules/elysia/crud/operations/index.js",
@@ -60,6 +59,7 @@
60
59
  "./modules/jwt": "./dist/modules/jwt/index.js",
61
60
  "./modules/jwt/enums": "./dist/modules/jwt/enums/index.js",
62
61
  "./modules/jwt/utils": "./dist/modules/jwt/utils/index.js",
62
+ "./modules/kv-store/bun-redis": "./dist/modules/kv-store/bun-redis/index.js",
63
63
  "./modules/kv-store/enums": "./dist/modules/kv-store/enums/index.js",
64
64
  "./modules/kv-store/ioredis": "./dist/modules/kv-store/ioredis/index.js",
65
65
  "./modules/kv-store/memory": "./dist/modules/kv-store/memory/index.js",
@@ -117,19 +117,24 @@
117
117
  "semver": "patch"
118
118
  },
119
119
  "chore": {
120
- "title": "🦉 Chore"
120
+ "title": "🦉 Chore",
121
+ "semver": "patch"
121
122
  },
122
123
  "examples": {
123
- "title": "🏀 Examples"
124
+ "title": "🏀 Examples",
125
+ "semver": "patch"
124
126
  },
125
127
  "test": {
126
- "title": "🧪 Tests"
128
+ "title": "🧪 Tests",
129
+ "semver": "patch"
127
130
  },
128
131
  "style": {
129
- "title": "🎨 Styles"
132
+ "title": "🎨 Styles",
133
+ "semver": "patch"
130
134
  },
131
135
  "ci": {
132
- "title": "🤖 CI"
136
+ "title": "🤖 CI",
137
+ "semver": "patch"
133
138
  }
134
139
  },
135
140
  "templates": {
@@ -174,9 +179,9 @@
174
179
  "fix-lint": "eslint --fix ./source",
175
180
  "lint": "eslint ./source",
176
181
  "start": "bun build/index.js",
177
- "test:integration": "bun test --timeout 6000 $(find test/integration -name '*.spec.ts')",
178
- "test:unit": "bun test --timeout 6000 --coverage $(find test/unit -name '*.spec.ts')",
179
- "test": "bun test --coverage --timeout 6000"
182
+ "test:integration": "bun test --timeout 10000 $(find test/integration -name '*.spec.ts')",
183
+ "test:unit": "bun test --timeout 10000 --coverage $(find test/unit -name '*.spec.ts')",
184
+ "test": "bun test --coverage --timeout 10000"
180
185
  },
181
186
  "type": "module"
182
187
  }
@@ -1,29 +0,0 @@
1
- // @bun
2
- // source/modules/elysia/cache/utils/generate-cache-key.ts
3
- var _calculateBodyHash = async (body, hasher) => {
4
- if (!body)
5
- return;
6
- const reader = body.getReader();
7
- try {
8
- while (true) {
9
- const { done, value } = await reader.read();
10
- if (done)
11
- break;
12
- if (value)
13
- hasher.update(new Uint8Array(value));
14
- }
15
- } finally {
16
- reader.releaseLock();
17
- }
18
- };
19
- var generateCacheKey = async (request) => {
20
- const { method, url, headers } = request;
21
- const hasher = new Bun.CryptoHasher("sha256");
22
- hasher.update(method);
23
- hasher.update(url);
24
- hasher.update(JSON.stringify(headers));
25
- await _calculateBodyHash(request.body, hasher);
26
- return hasher.digest("hex");
27
- };
28
-
29
- export { generateCacheKey };
@@ -1,10 +0,0 @@
1
- // @bun
2
- // source/modules/logger/enums/logger-error-keys.ts
3
- var LOGGER_ERROR_KEYS = {
4
- NO_SINK_ADDED: "mrx-core.logger.error.no_sink_added",
5
- SINK_ALREADY_ADDED: "mrx-core.logger.error.sink_already_added",
6
- SINK_ERROR: "mrx-core.logger.error.sink_error",
7
- SINK_NOT_FOUND: "mrx-core.logger.error.sink_not_found"
8
- };
9
-
10
- export { LOGGER_ERROR_KEYS };
@@ -1,101 +0,0 @@
1
- // @bun
2
- import {
3
- KV_STORE_ERROR_KEYS
4
- } from "./chunk-xhhj1gvj.js";
5
- import {
6
- BaseError
7
- } from "./chunk-9cgzhc50.js";
8
-
9
- // source/modules/kv-store/memory/memory-store.ts
10
- class MemoryStore {
11
- _store = new Map;
12
- _cleanupInterval;
13
- _cleanupTimer = null;
14
- constructor(cleanupIntervalMs) {
15
- this._cleanupInterval = cleanupIntervalMs ?? 300000;
16
- this._startCleanup();
17
- }
18
- get(key) {
19
- const entry = this._store.get(key);
20
- if (!entry)
21
- return null;
22
- const now = Date.now();
23
- if (now > entry.expiresAt && entry.expiresAt !== -1) {
24
- this._store.delete(key);
25
- return null;
26
- }
27
- return entry.value;
28
- }
29
- set(key, value, ttlSec) {
30
- const expiresAt = ttlSec ? Date.now() + ttlSec * 1000 : -1;
31
- this._store.set(key, { value, expiresAt });
32
- }
33
- increment(key, amount = 1) {
34
- const current = this.get(key);
35
- const entry = this._store.get(key);
36
- if (current !== null && typeof current !== "number")
37
- throw new BaseError(KV_STORE_ERROR_KEYS.NOT_INTEGER);
38
- const currentValue = current ?? 0;
39
- const newValue = currentValue + amount;
40
- const expiresAt = entry ? entry.expiresAt : -1;
41
- this._store.set(key, { value: newValue, expiresAt });
42
- return newValue;
43
- }
44
- decrement(key, amount = 1) {
45
- const current = this.get(key);
46
- const entry = this._store.get(key);
47
- if (current !== null && typeof current !== "number")
48
- throw new BaseError(KV_STORE_ERROR_KEYS.NOT_INTEGER);
49
- const currentValue = current ?? 0;
50
- const newValue = currentValue - amount;
51
- const expiresAt = entry ? entry.expiresAt : -1;
52
- this._store.set(key, { value: newValue, expiresAt });
53
- return newValue;
54
- }
55
- del(key) {
56
- return this._store.delete(key);
57
- }
58
- expire(key, ttlSec) {
59
- const entry = this._store.get(key);
60
- if (!entry)
61
- return false;
62
- entry.expiresAt = Date.now() + ttlSec * 1000;
63
- return true;
64
- }
65
- ttl(key) {
66
- const entry = this._store.get(key);
67
- if (!entry)
68
- return -1;
69
- if (entry.expiresAt === -1)
70
- return -1;
71
- const remaining = entry.expiresAt - Date.now();
72
- return remaining > 0 ? Math.ceil(remaining / 1000) : -1;
73
- }
74
- clean() {
75
- const sizeBefore = this._store.size;
76
- this._store.clear();
77
- return sizeBefore;
78
- }
79
- _startCleanup() {
80
- if (this._cleanupTimer)
81
- return;
82
- this._cleanupTimer = setInterval(() => {
83
- this._removeExpiredEntries();
84
- }, this._cleanupInterval);
85
- }
86
- _removeExpiredEntries() {
87
- const now = Date.now();
88
- for (const [key, entry] of this._store.entries())
89
- if (entry.expiresAt !== -1 && now > entry.expiresAt)
90
- this._store.delete(key);
91
- }
92
- destroy() {
93
- if (this._cleanupTimer) {
94
- clearInterval(this._cleanupTimer);
95
- this._cleanupTimer = null;
96
- }
97
- this._store.clear();
98
- }
99
- }
100
-
101
- export { MemoryStore };
@@ -1 +0,0 @@
1
- export { generateCacheKey } from './generate-cache-key';
@@ -1,7 +0,0 @@
1
- // @bun
2
- import {
3
- generateCacheKey
4
- } from "../../../../chunk-b23dvm2d.js";
5
- export {
6
- generateCacheKey
7
- };
@@ -1,25 +0,0 @@
1
- import type { LogLevels } from '../../../modules/logger/types/log-levels';
2
- import type { LoggerSink } from '../../../modules/logger/types/logger-sink';
3
- /**
4
- * FileLoggerSink implements LoggerSink to provide logging functionality to the file system.
5
- */
6
- export declare class FileLoggerSink implements LoggerSink {
7
- /**
8
- * Path to the file to log to.
9
- */
10
- private readonly _path;
11
- /**
12
- * Constructor FileLoggerSink
13
- *
14
- * @param path - Path to the file to log to.
15
- */
16
- constructor(path: string);
17
- /**
18
- * Logs a message to the file system with the specified log level.
19
- *
20
- * @param level - The log level at which the message should be logged.
21
- * @param date - The date at which the message was logged.
22
- * @param object - The object to log.
23
- */
24
- log(level: LogLevels, date: Date, object: unknown): Promise<void>;
25
- }
@@ -1,2 +0,0 @@
1
- import type { SinkBody } from './sink-body';
2
- export type BodiesIntersection<TSinks, K extends keyof TSinks> = (K extends unknown ? (object: SinkBody<TSinks, K>) => void : never) extends (object: infer I) => void ? I : never;
@@ -1,15 +0,0 @@
1
- import type { LogLevels } from './log-levels';
2
- import type { SinkMap } from './sink-map';
3
- /**
4
- * Internal log stream object for the queue.
5
- */
6
- export interface LogStreamChunk<TLogObject, TSinks extends SinkMap> {
7
- /** ISO date string of the log event. */
8
- date: string;
9
- /** Log level. */
10
- level: LogLevels;
11
- /** The object to log. */
12
- object: TLogObject;
13
- /** Names of sinks to use. */
14
- sinksNames: (keyof TSinks)[];
15
- }