@mrxsys/mrx-core 2.7.0 → 2.8.0

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 (77) hide show
  1. package/CHANGELOG.md +67 -48
  2. package/dist/chunk-7g8k2epn.js +104 -0
  3. package/dist/chunk-kv9hms2z.js +28 -0
  4. package/dist/{chunk-qb6x364m.js → chunk-m18th1g5.js} +1 -1
  5. package/dist/chunk-ncc0m208.js +8 -0
  6. package/dist/chunk-r1kcf1q6.js +62 -0
  7. package/dist/chunk-sepwfqdh.js +6 -0
  8. package/dist/{chunk-z6q192p8.js → chunk-syhskygx.js} +4 -4
  9. package/dist/{chunk-tm71j126.js → chunk-y78xrx17.js} +2 -2
  10. package/dist/chunk-z1skzn1j.js +8 -0
  11. package/dist/modules/data/data.d.ts +1 -1
  12. package/dist/modules/database/index.js +2 -2
  13. package/dist/modules/elysia/cache/cache.d.ts +306 -0
  14. package/dist/modules/elysia/cache/index.d.ts +1 -0
  15. package/dist/modules/elysia/cache/index.js +68 -0
  16. package/dist/modules/elysia/cache/types/cacheItem.d.ts +7 -0
  17. package/dist/modules/elysia/cache/types/cacheOptions.d.ts +21 -0
  18. package/dist/modules/elysia/cache/types/index.d.ts +1 -0
  19. package/dist/modules/elysia/cache/utils/generateCacheKey.d.ts +5 -0
  20. package/dist/modules/elysia/cache/utils/index.d.ts +1 -0
  21. package/dist/modules/elysia/cache/utils/index.js +7 -0
  22. package/dist/modules/elysia/crud/crud.d.ts +1 -1
  23. package/dist/modules/elysia/crud/index.js +13 -10
  24. package/dist/modules/elysia/crud/types/crudOptions.d.ts +2 -0
  25. package/dist/modules/elysia/dbResolver/dbResolver.d.ts +1 -1
  26. package/dist/modules/elysia/dbResolver/index.js +3 -3
  27. package/dist/modules/elysia/error/index.js +11 -2
  28. package/dist/modules/elysia/rateLimit/index.js +15 -95
  29. package/dist/modules/elysia/rateLimit/rateLimit.d.ts +28 -11
  30. package/dist/modules/elysia/rateLimit/types/rateLimitOptions.d.ts +3 -15
  31. package/dist/modules/jwt/enums/index.d.ts +2 -0
  32. package/dist/modules/jwt/enums/index.js +11 -0
  33. package/dist/modules/jwt/enums/jwtErrorKeys.d.ts +5 -0
  34. package/dist/modules/jwt/enums/parseHumanTimeToSecondsErrorKeys.d.ts +3 -0
  35. package/dist/modules/jwt/index.d.ts +1 -0
  36. package/dist/modules/jwt/index.js +58 -0
  37. package/dist/modules/jwt/jwt.d.ts +3 -0
  38. package/dist/modules/jwt/utils/index.d.ts +1 -0
  39. package/dist/modules/jwt/utils/index.js +9 -0
  40. package/dist/modules/jwt/utils/parseHumanTimeToSeconds.d.ts +17 -0
  41. package/dist/modules/kvStore/enums/index.d.ts +1 -0
  42. package/dist/modules/kvStore/enums/index.js +7 -0
  43. package/dist/modules/kvStore/enums/kvStoreErrorKeys.d.ts +5 -0
  44. package/dist/modules/kvStore/ioredis/index.d.ts +1 -0
  45. package/dist/modules/kvStore/ioredis/index.js +102 -0
  46. package/dist/modules/kvStore/ioredis/ioredisStore.d.ts +107 -0
  47. package/dist/modules/kvStore/memory/index.d.ts +1 -0
  48. package/dist/modules/kvStore/memory/index.js +9 -0
  49. package/dist/modules/kvStore/memory/memoryStore.d.ts +119 -0
  50. package/dist/modules/{elysia/rateLimit → kvStore/memory}/types/memoryStoreEntry.d.ts +2 -2
  51. package/dist/modules/kvStore/types/index.d.ts +1 -0
  52. package/dist/modules/kvStore/types/index.js +1 -0
  53. package/dist/modules/kvStore/types/kvStore.d.ts +81 -0
  54. package/dist/modules/repository/index.js +1 -1
  55. package/dist/modules/repository/types/queryOptions.d.ts +5 -1
  56. package/dist/modules/totp/hotp.d.ts +11 -0
  57. package/dist/modules/totp/index.d.ts +3 -1
  58. package/dist/modules/totp/index.js +27 -30
  59. package/dist/modules/totp/otpAuthUri.d.ts +21 -0
  60. package/dist/modules/totp/totp.d.ts +0 -40
  61. package/dist/modules/totp/utils/base32.d.ts +1 -1
  62. package/dist/modules/totp/utils/index.d.ts +3 -2
  63. package/dist/modules/totp/utils/index.js +6 -0
  64. package/dist/modules/totp/utils/timeRemaining.d.ts +9 -0
  65. package/package.json +79 -72
  66. package/dist/chunk-cqw9xq4y.js +0 -7
  67. package/dist/modules/elysia/jwt/enums/index.d.ts +0 -1
  68. package/dist/modules/elysia/jwt/enums/index.js +0 -7
  69. package/dist/modules/elysia/jwt/enums/jwtErrorKeys.d.ts +0 -4
  70. package/dist/modules/elysia/jwt/index.d.ts +0 -1
  71. package/dist/modules/elysia/jwt/index.js +0 -77
  72. package/dist/modules/elysia/jwt/jwt.d.ts +0 -119
  73. package/dist/modules/elysia/jwt/types/index.d.ts +0 -1
  74. package/dist/modules/elysia/jwt/types/jwtOptions.d.ts +0 -98
  75. package/dist/modules/elysia/rateLimit/stores/memoryStore.d.ts +0 -47
  76. package/dist/modules/elysia/rateLimit/types/rateLimitStore.d.ts +0 -21
  77. /package/dist/modules/elysia/{jwt → cache}/types/index.js +0 -0
@@ -0,0 +1,119 @@
1
+ import type { KvStore } from '../../../modules/kvStore/types/kvStore';
2
+ /**
3
+ * In-memory key-value store implementation with automatic cleanup of expired entries.
4
+ *
5
+ * Provides a memory-based implementation of the KvStore interface with TTL support
6
+ * and automatic background cleanup of expired entries.
7
+ */
8
+ export declare class MemoryStore implements KvStore {
9
+ /**
10
+ * In-memory key-value store.
11
+ */
12
+ private readonly _store;
13
+ /**
14
+ * Cleanup interval (5 minutes by default).
15
+ *
16
+ * @defaultValue 300000
17
+ */
18
+ private readonly _cleanupInterval;
19
+ /**
20
+ * Timer for cleanup operations.
21
+ */
22
+ private _cleanupTimer;
23
+ /**
24
+ * Creates instance and starts cleanup process.
25
+ *
26
+ * @param cleanupIntervalMs - Cleanup interval in milliseconds (default: 300000 ms / 5 minutes)
27
+ */
28
+ constructor(cleanupIntervalMs?: number);
29
+ /**
30
+ * Retrieves a value from the store by key.
31
+ * Automatically removes expired entries during retrieval.
32
+ *
33
+ * @template T - The expected type of the stored value
34
+ *
35
+ * @param key - The key to retrieve
36
+ *
37
+ * @returns The value associated with the key, or null if not found or expired
38
+ */
39
+ get<T = unknown>(key: string): T | null;
40
+ /**
41
+ * Stores a value in memory with optional TTL.
42
+ *
43
+ * @template T - The type of the value being stored
44
+ *
45
+ * @param key - The key to store the value under
46
+ * @param value - The value to store
47
+ * @param ttlSec - Time to live in seconds (optional)
48
+ */
49
+ set<T = unknown>(key: string, value: T, ttlSec?: number): void;
50
+ /**
51
+ * Increments a numeric value stored at key by the specified amount.
52
+ * If the key does not exist, it is set to 0 before performing the operation.
53
+ * Preserves existing TTL when incrementing.
54
+ *
55
+ * @param key - The key containing the numeric value
56
+ * @param amount - The amount to increment by (default: 1)
57
+ *
58
+ * @throws ({@link BaseError}) - When the value is not a valid integer
59
+ *
60
+ * @returns The value after incrementing
61
+ */
62
+ increment(key: string, amount?: number): number;
63
+ /**
64
+ * Decrements a numeric value stored at key by the specified amount.
65
+ * If the key does not exist, it is set to 0 before performing the operation.
66
+ * Preserves existing TTL when decrementing.
67
+ *
68
+ * @param key - The key containing the numeric value
69
+ * @param amount - The amount to decrement by (default: 1)
70
+ *
71
+ * @throws ({@link BaseError}) - When the value is not a valid integer
72
+ *
73
+ * @returns The value after decrementing
74
+ */
75
+ decrement(key: string, amount?: number): number;
76
+ /**
77
+ * Deletes a key from the store.
78
+ *
79
+ * @param key - The key to delete
80
+ *
81
+ * @returns True if the key was deleted, false if it did not exist
82
+ */
83
+ del(key: string): boolean;
84
+ /**
85
+ * Sets an expiration time for a key.
86
+ *
87
+ * @param key - The key to set expiration for
88
+ * @param ttlSec - Time to live in seconds
89
+ *
90
+ * @returns True if the expiration was set, false if the key does not exist
91
+ */
92
+ expire(key: string, ttlSec: number): boolean;
93
+ /**
94
+ * Gets the remaining time to live for a key.
95
+ *
96
+ * @param key - The key to check
97
+ *
98
+ * @returns Time to live in seconds, -1 if key has no expiration or does not exist
99
+ */
100
+ ttl(key: string): number;
101
+ /**
102
+ * Removes all keys from the store.
103
+ *
104
+ * @returns The number of keys that were deleted
105
+ */
106
+ clean(): number;
107
+ /**
108
+ * Starts the cleanup process for expired entries.
109
+ */
110
+ private _startCleanup;
111
+ /**
112
+ * Removes expired entries from the store.
113
+ */
114
+ private _removeExpiredEntries;
115
+ /**
116
+ * Stops the cleanup process and clears resources.
117
+ */
118
+ destroy(): void;
119
+ }
@@ -2,10 +2,10 @@ export interface MemoryStoreEntry {
2
2
  /**
3
3
  * Current count value for the key.
4
4
  */
5
- readonly value: string;
5
+ readonly value: unknown;
6
6
  /**
7
7
  * Timestamp when this entry expires (in milliseconds).
8
8
  * -1 means no expiration (like Redis behavior).
9
9
  */
10
- readonly expiresAt: number;
10
+ expiresAt: number;
11
11
  }
@@ -0,0 +1 @@
1
+ export type { KvStore } from './kvStore';
@@ -0,0 +1 @@
1
+ // @bun
@@ -0,0 +1,81 @@
1
+ export interface KvStore {
2
+ /**
3
+ * Connect to the store.
4
+ */
5
+ connect?(): Promise<void>;
6
+ /**
7
+ * Close the connection to the store.
8
+ */
9
+ close?(): Promise<void>;
10
+ /**
11
+ * Get the value associated with a key.
12
+ *
13
+ * @template T - The type of the value to retrieve.
14
+ *
15
+ * @param key - The key to retrieve the value for.
16
+ *
17
+ * @returns The value associated with the key, or `null` if the key does not exist.
18
+ */
19
+ get<T = unknown>(key: string): T | null | Promise<T | null>;
20
+ /**
21
+ * Set the value associated with a key.
22
+ *
23
+ * @template T - The type of the value to set.
24
+ *
25
+ * @param key - The key to set the value for.
26
+ * @param value - The value to set.
27
+ * @param ttlSec - The time-to-live for the key, in seconds.
28
+ */
29
+ set<T = unknown>(key: string, value: T, ttlSec?: number): void | Promise<void>;
30
+ /**
31
+ * Increment the value associated with a key.
32
+ * Value needs to be a number.
33
+ *
34
+ * @param key - The key to increment the value for.
35
+ * @param amount - The amount to increment by.
36
+ *
37
+ * @returns The new value after incrementing.
38
+ */
39
+ increment(key: string, amount?: number): number | Promise<number>;
40
+ /**
41
+ * Decrement the value associated with a key.
42
+ * Value needs to be a number.
43
+ *
44
+ * @param key - The key to decrement the value for.
45
+ * @param amount - The amount to decrement by.
46
+ *
47
+ * @returns The new value after decrementing.
48
+ */
49
+ decrement(key: string, amount?: number): number | Promise<number>;
50
+ /**
51
+ * Delete a key from the store.
52
+ *
53
+ * @param key - The key to delete.
54
+ *
55
+ * @returns `true` if the key was deleted, `false` otherwise.
56
+ */
57
+ del(key: string): boolean | Promise<boolean>;
58
+ /**
59
+ * Set the expiration time for a key.
60
+ *
61
+ * @param key - The key to set the expiration for.
62
+ * @param ttlSec - The time-to-live for the key, in seconds.
63
+ *
64
+ * @returns `true` if the expiration was set, `false` otherwise.
65
+ */
66
+ expire(key: string, ttlSec: number): boolean | Promise<boolean>;
67
+ /**
68
+ * Get the remaining time-to-live for a key.
69
+ *
70
+ * @param key - The key to retrieve the TTL for.
71
+ *
72
+ * @returns The remaining time-to-live for the key, in seconds.
73
+ */
74
+ ttl(key: string): number | Promise<number>;
75
+ /**
76
+ * Clean all keys from the store.
77
+ *
78
+ * @returns The number of keys that were removed.
79
+ */
80
+ clean(): number | Promise<number>;
81
+ }
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  Repository
4
- } from "../../chunk-z6q192p8.js";
4
+ } from "../../chunk-syhskygx.js";
5
5
  import"../../chunk-5qtpggzv.js";
6
6
  import"../../chunk-zaje5tv4.js";
7
7
  import"../../chunk-683sda6e.js";
@@ -1,3 +1,4 @@
1
+ import type { HTTP_ERROR_STATUS_CODES } from '../../../errors/enums/httpErrorStatusCodes';
1
2
  import type { Filter } from './filter';
2
3
  import type { OrderByItem } from './orderByItem';
3
4
  import type { SelectedFields } from './selectedFields';
@@ -28,7 +29,10 @@ export interface QueryOptions<TModel> {
28
29
  * Whether to throw an error if the query does not return any result.
29
30
  * @defaultValue false
30
31
  */
31
- readonly throwIfNoResult?: boolean | string;
32
+ readonly throwIfNoResult?: boolean | {
33
+ message?: string;
34
+ code?: keyof typeof HTTP_ERROR_STATUS_CODES | typeof HTTP_ERROR_STATUS_CODES[keyof typeof HTTP_ERROR_STATUS_CODES];
35
+ };
32
36
  /**
33
37
  * The transaction context for the query. ({@link Transaction})
34
38
  */
@@ -0,0 +1,11 @@
1
+ import type { TotpOptions } from './types/totpOptions';
2
+ /**
3
+ * HMAC-based One-Time Password (HOTP) implementation
4
+ *
5
+ * @param secret - Secret key as bytes
6
+ * @param counter - Counter value
7
+ * @param opts - HOTP options
8
+ *
9
+ * @returns Promise resolving to the HOTP code
10
+ */
11
+ export declare const hotp: (secret: Uint8Array, counter: number | bigint, { algorithm, digits }?: TotpOptions) => Promise<string>;
@@ -1 +1,3 @@
1
- export { hotp, totp, verifyTotp, buildOtpAuthUri, parseOtpAuthUri, timeRemaining } from './totp';
1
+ export { hotp } from './hotp';
2
+ export { buildOtpAuthUri, parseOtpAuthUri } from './otpAuthUri';
3
+ export { totp, verifyTotp } from './totp';
@@ -11,7 +11,7 @@ import {
11
11
  BaseError
12
12
  } from "../../chunk-vknq69e0.js";
13
13
 
14
- // source/modules/totp/totp.ts
14
+ // source/modules/totp/hotp.ts
15
15
  import { webcrypto } from "crypto";
16
16
  var hotp = async (secret, counter, {
17
17
  algorithm = "SHA-1",
@@ -22,31 +22,7 @@ var hotp = async (secret, counter, {
22
22
  const hmacArray = await generateHmac(key, counterBuffer);
23
23
  return dynamicTruncation(hmacArray, digits);
24
24
  };
25
- var totp = async (secret, {
26
- algorithm = "SHA-1",
27
- digits = 6,
28
- period = 30,
29
- now = Date.now()
30
- } = {}) => {
31
- const timeStep = Math.floor(now / 1000 / period);
32
- return hotp(secret, timeStep, { algorithm, digits });
33
- };
34
- var verifyTotp = async (secret, code, {
35
- algorithm = "SHA-1",
36
- digits = 6,
37
- period = 30,
38
- window = 0,
39
- now = Date.now()
40
- } = {}) => {
41
- const currentTimeStep = Math.floor(now / 1000 / period);
42
- for (let i = -window;i <= window; ++i) {
43
- const timeStep = currentTimeStep + i;
44
- const expectedCode = await hotp(secret, timeStep, { algorithm, digits });
45
- if (expectedCode === code)
46
- return true;
47
- }
48
- return false;
49
- };
25
+ // source/modules/totp/otpAuthUri.ts
50
26
  var buildOtpAuthUri = ({
51
27
  secretBase32,
52
28
  label,
@@ -99,14 +75,35 @@ var parseOtpAuthUri = (uri) => {
99
75
  };
100
76
  return result;
101
77
  };
102
- var timeRemaining = (period = 30, now = Date.now()) => {
103
- const elapsed = Math.floor(now / 1000) % period;
104
- return period - elapsed;
78
+ // source/modules/totp/totp.ts
79
+ var totp = async (secret, {
80
+ algorithm = "SHA-1",
81
+ digits = 6,
82
+ period = 30,
83
+ now = Date.now()
84
+ } = {}) => {
85
+ const timeStep = Math.floor(now / 1000 / period);
86
+ return hotp(secret, timeStep, { algorithm, digits });
87
+ };
88
+ var verifyTotp = async (secret, code, {
89
+ algorithm = "SHA-1",
90
+ digits = 6,
91
+ period = 30,
92
+ window = 0,
93
+ now = Date.now()
94
+ } = {}) => {
95
+ const currentTimeStep = Math.floor(now / 1000 / period);
96
+ for (let i = -window;i <= window; ++i) {
97
+ const timeStep = currentTimeStep + i;
98
+ const expectedCode = await hotp(secret, timeStep, { algorithm, digits });
99
+ if (expectedCode === code)
100
+ return true;
101
+ }
102
+ return false;
105
103
  };
106
104
  export {
107
105
  verifyTotp,
108
106
  totp,
109
- timeRemaining,
110
107
  parseOtpAuthUri,
111
108
  hotp,
112
109
  buildOtpAuthUri
@@ -0,0 +1,21 @@
1
+ import type { OtpAuthUri } from './types/otpAuthUri';
2
+ /**
3
+ * Build an OTPAuth URI for QR code generation
4
+ *
5
+ * @param params - URI parameters
6
+ *
7
+ * @returns OTPAuth URI string
8
+ */
9
+ export declare const buildOtpAuthUri: ({ secretBase32, label, issuer, algorithm, digits, period }: OtpAuthUri) => string;
10
+ /**
11
+ * Parse an OTPAuth URI
12
+ *
13
+ * @param uri - OTPAuth URI to parse
14
+ *
15
+ * @throws ({@link BaseError}) - if the URI is invalid or missing required parameters
16
+ *
17
+ * @returns Parsed URI parameters
18
+ */
19
+ export declare const parseOtpAuthUri: (uri: string) => Required<Omit<OtpAuthUri, "issuer">> & {
20
+ issuer?: string;
21
+ };
@@ -1,16 +1,5 @@
1
- import type { OtpAuthUri } from './types/otpAuthUri';
2
1
  import type { TotpOptions } from './types/totpOptions';
3
2
  import type { VerifyOptions } from './types/verifyOptions';
4
- /**
5
- * HMAC-based One-Time Password (HOTP) implementation
6
- *
7
- * @param secret - Secret key as bytes
8
- * @param counter - Counter value
9
- * @param opts - HOTP options
10
- *
11
- * @returns Promise resolving to the HOTP code
12
- */
13
- export declare const hotp: (secret: Uint8Array, counter: number | bigint, { algorithm, digits }?: TotpOptions) => Promise<string>;
14
3
  /**
15
4
  * Time-based One-Time Password (TOTP) implementation
16
5
  *
@@ -32,32 +21,3 @@ export declare const totp: (secret: Uint8Array, { algorithm, digits, period, now
32
21
  * @returns Promise resolving to true if code is valid
33
22
  */
34
23
  export declare const verifyTotp: (secret: Uint8Array, code: string, { algorithm, digits, period, window, now }?: VerifyOptions) => Promise<boolean>;
35
- /**
36
- * Build an OTPAuth URI for QR code generation
37
- *
38
- * @param params - URI parameters
39
- *
40
- * @returns OTPAuth URI string
41
- */
42
- export declare const buildOtpAuthUri: ({ secretBase32, label, issuer, algorithm, digits, period }: OtpAuthUri) => string;
43
- /**
44
- * Parse an OTPAuth URI
45
- *
46
- * @param uri - OTPAuth URI to parse
47
- *
48
- * @throws ({@link BaseError}) if the URI is invalid or missing required parameters
49
- *
50
- * @returns Parsed URI parameters
51
- */
52
- export declare const parseOtpAuthUri: (uri: string) => Required<Omit<OtpAuthUri, "issuer">> & {
53
- issuer?: string;
54
- };
55
- /**
56
- * Calculate remaining time until next TOTP code
57
- *
58
- * @param period - Time period in seconds (default: 30)
59
- * @param now - Current timestamp in milliseconds (default: Date.now())
60
- *
61
- * @returns Seconds remaining until next code
62
- */
63
- export declare const timeRemaining: (period?: number, now?: number) => number;
@@ -12,7 +12,7 @@ export declare const base32Encode: (input: string | Uint8Array, withPadding?: bo
12
12
  *
13
13
  * @param base32 - Base32 string to decode
14
14
  *
15
- * @throws ({@link BaseError}) if invalid Base32 character is found
15
+ * @throws ({@link BaseError}) - if invalid Base32 character is found
16
16
  *
17
17
  * @returns Decoded bytes
18
18
  */
@@ -1,5 +1,6 @@
1
1
  export { base32Decode, base32Encode } from './base32';
2
2
  export { createCounterBuffer } from './createCounterBuffer';
3
- export { generateSecretBytes } from './generateSecretBytes';
4
- export { generateHmac } from './generateHmac';
5
3
  export { dynamicTruncation } from './dynamicTruncation';
4
+ export { generateHmac } from './generateHmac';
5
+ export { generateSecretBytes } from './generateSecretBytes';
6
+ export { timeRemaining } from './timeRemaining';
@@ -65,7 +65,13 @@ var generateSecretBytes = (length = 20) => {
65
65
  });
66
66
  return getRandomValues(new Uint8Array(length));
67
67
  };
68
+ // source/modules/totp/utils/timeRemaining.ts
69
+ var timeRemaining = (period = 30, now = Date.now()) => {
70
+ const elapsed = Math.floor(now / 1000) % period;
71
+ return period - elapsed;
72
+ };
68
73
  export {
74
+ timeRemaining,
69
75
  generateSecretBytes,
70
76
  generateHmac,
71
77
  dynamicTruncation,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Calculate remaining time until next TOTP code
3
+ *
4
+ * @param period - Time period in seconds (default: 30)
5
+ * @param now - Current timestamp in milliseconds (default: Date.now())
6
+ *
7
+ * @returns Seconds remaining until next code
8
+ */
9
+ export declare const timeRemaining: (period?: number, now?: number) => number;
package/package.json CHANGED
@@ -1,15 +1,33 @@
1
1
  {
2
2
  "name": "@mrxsys/mrx-core",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "author": "Ruby",
5
- "description": " Core provides a set of tools to help you build a microservice",
6
- "type": "module",
7
- "license": "MIT",
8
- "keywords": [
9
- "mrxsys",
10
- "mrxsys-core",
11
- "core"
12
- ],
5
+ "devDependencies": {
6
+ "@eslint/js": "^9.34.0",
7
+ "@sinclair/typebox": "0.34.40",
8
+ "@stylistic/eslint-plugin": "^5.2.3",
9
+ "@types/bun": "^1.2.21",
10
+ "@types/nodemailer": "^7.0.1",
11
+ "elysia": "^1.3.20",
12
+ "eslint": "^9.34.0",
13
+ "globals": "^16.3.0",
14
+ "ioredis": "^5.7.0",
15
+ "jose": "^6.0.13",
16
+ "knex": "^3.1.0",
17
+ "mssql": "^11.0.1",
18
+ "nodemailer": "^7.0.5",
19
+ "typescript-eslint": "^8.41.0"
20
+ },
21
+ "peerDependencies": {
22
+ "@sinclair/typebox": "0.34.40",
23
+ "elysia": "^1.3.20",
24
+ "ioredis": "^5.7.0",
25
+ "jose": "^6.0.13",
26
+ "knex": "^3.1.0",
27
+ "mssql": "^11.0.1",
28
+ "nodemailer": "^7.0.5",
29
+ "typescript": "^5.9.2"
30
+ },
13
31
  "exports": {
14
32
  "./errors": "./dist/errors/index.js",
15
33
  "./errors/enums": "./dist/errors/enums/index.js",
@@ -22,6 +40,9 @@
22
40
  "./modules/database/enums": "./dist/modules/database/enums/index.js",
23
41
  "./modules/database/events": "./dist/modules/database/events/index.js",
24
42
  "./modules/database/types": "./dist/modules/database/types/index.js",
43
+ "./modules/elysia/cache": "./dist/modules/elysia/cache/index.js",
44
+ "./modules/elysia/cache/types": "./dist/modules/elysia/cache/types/index.js",
45
+ "./modules/elysia/cache/utils": "./dist/modules/elysia/cache/utils/index.js",
25
46
  "./modules/elysia/crud": "./dist/modules/elysia/crud/index.js",
26
47
  "./modules/elysia/crud/types": "./dist/modules/elysia/crud/types/index.js",
27
48
  "./modules/elysia/crudSchema": "./dist/modules/elysia/crudSchema/index.js",
@@ -31,13 +52,17 @@
31
52
  "./modules/elysia/dbResolver/enums": "./dist/modules/elysia/dbResolver/enums/index.js",
32
53
  "./modules/elysia/dbResolver/types": "./dist/modules/elysia/dbResolver/types/index.js",
33
54
  "./modules/elysia/error": "./dist/modules/elysia/error/index.js",
34
- "./modules/elysia/jwt": "./dist/modules/elysia/jwt/index.js",
35
- "./modules/elysia/jwt/enums": "./dist/modules/elysia/jwt/enums/index.js",
36
- "./modules/elysia/jwt/types": "./dist/modules/elysia/jwt/types/index.js",
37
55
  "./modules/elysia/microservice": "./dist/modules/elysia/microservice/index.js",
38
56
  "./modules/elysia/rateLimit": "./dist/modules/elysia/rateLimit/index.js",
39
57
  "./modules/elysia/rateLimit/enums": "./dist/modules/elysia/rateLimit/enums/index.js",
40
58
  "./modules/elysia/rateLimit/types": "./dist/modules/elysia/rateLimit/types/index.js",
59
+ "./modules/jwt": "./dist/modules/jwt/index.js",
60
+ "./modules/jwt/enums": "./dist/modules/jwt/enums/index.js",
61
+ "./modules/jwt/utils": "./dist/modules/jwt/utils/index.js",
62
+ "./modules/kvStore/enums": "./dist/modules/kvStore/enums/index.js",
63
+ "./modules/kvStore/ioredis": "./dist/modules/kvStore/ioredis/index.js",
64
+ "./modules/kvStore/memory": "./dist/modules/kvStore/memory/index.js",
65
+ "./modules/kvStore/types": "./dist/modules/kvStore/types/index.js",
41
66
  "./modules/logger": "./dist/modules/logger/index.js",
42
67
  "./modules/logger/enums": "./dist/modules/logger/enums/index.js",
43
68
  "./modules/logger/events": "./dist/modules/logger/events/index.js",
@@ -60,65 +85,6 @@
60
85
  "./utils/enums": "./dist/utils/enums/index.js",
61
86
  "./utils/types": "./dist/utils/types/index.js"
62
87
  },
63
- "scripts": {
64
- "build": "bun builder.ts",
65
- "docs": "bunx typedoc --tsconfig tsconfig.build.json",
66
- "fix-lint": "eslint --fix ./source",
67
- "lint": "eslint ./source",
68
- "start": "bun build/index.js",
69
- "test:integration": "bun test --timeout 5800 $(find test/integration -name '*.spec.ts')",
70
- "test:unit": "bun test --timeout 5800 --coverage $(find test/unit -name '*.spec.ts')",
71
- "test": "bun test --coverage --timeout 5500"
72
- },
73
- "devDependencies": {
74
- "@eslint/js": "^9.33.0",
75
- "@sinclair/typebox": "0.34.38",
76
- "@stylistic/eslint-plugin": "^5.2.3",
77
- "@types/bun": "^1.2.20",
78
- "@types/nodemailer": "^6.4.17",
79
- "elysia": "^1.3.8",
80
- "eslint": "^9.33.0",
81
- "globals": "^16.3.0",
82
- "ioredis": "^5.7.0",
83
- "jose": "^6.0.12",
84
- "knex": "^3.1.0",
85
- "mssql": "^11.0.1",
86
- "nodemailer": "^7.0.5",
87
- "typescript-eslint": "^8.39.0"
88
- },
89
- "peerDependencies": {
90
- "@sinclair/typebox": "0.34.38",
91
- "elysia": "^1.3.8",
92
- "ioredis": "^5.7.0",
93
- "jose": "^6.0.12",
94
- "knex": "^3.1.0",
95
- "mssql": "^11.0.1",
96
- "nodemailer": "^7.0.5",
97
- "typescript": "^5.9.2"
98
- },
99
- "peerDependenciesMeta": {
100
- "@sinclair/typebox": {
101
- "optional": true
102
- },
103
- "elysia": {
104
- "optional": true
105
- },
106
- "ioredis": {
107
- "optional": true
108
- },
109
- "jose": {
110
- "optional": true
111
- },
112
- "knex": {
113
- "optional": true
114
- },
115
- "mssql": {
116
- "optional": true
117
- },
118
- "nodemailer": {
119
- "optional": true
120
- }
121
- },
122
88
  "changelog": {
123
89
  "types": {
124
90
  "feat": {
@@ -170,5 +136,46 @@
170
136
  "tagMessage": "v{{newVersion}}",
171
137
  "tagBody": "v{{newVersion}}"
172
138
  }
173
- }
139
+ },
140
+ "description": " Core provides a set of tools to help you build a microservice",
141
+ "keywords": [
142
+ "mrxsys",
143
+ "mrxsys-core",
144
+ "core"
145
+ ],
146
+ "license": "MIT",
147
+ "peerDependenciesMeta": {
148
+ "@sinclair/typebox": {
149
+ "optional": true
150
+ },
151
+ "elysia": {
152
+ "optional": true
153
+ },
154
+ "ioredis": {
155
+ "optional": true
156
+ },
157
+ "jose": {
158
+ "optional": true
159
+ },
160
+ "knex": {
161
+ "optional": true
162
+ },
163
+ "mssql": {
164
+ "optional": true
165
+ },
166
+ "nodemailer": {
167
+ "optional": true
168
+ }
169
+ },
170
+ "scripts": {
171
+ "build": "bun builder.ts",
172
+ "docs": "bunx typedoc --tsconfig tsconfig.build.json",
173
+ "fix-lint": "eslint --fix ./source",
174
+ "lint": "eslint ./source",
175
+ "start": "bun build/index.js",
176
+ "test:integration": "bun test --timeout 5800 $(find test/integration -name '*.spec.ts')",
177
+ "test:unit": "bun test --timeout 5800 --coverage $(find test/unit -name '*.spec.ts')",
178
+ "test": "bun test --coverage --timeout 5500"
179
+ },
180
+ "type": "module"
174
181
  }
@@ -1,7 +0,0 @@
1
- // source/modules/elysia/jwt/enums/jwtErrorKeys.ts
2
- var JWT_ERROR_KEYS = {
3
- JWT_SIGN_ERROR: "elysia.jwt.error.sign_error",
4
- JWT_SECRET_NOT_FOUND: "elysia.jwt.error.secret_not_found"
5
- };
6
-
7
- export { JWT_ERROR_KEYS };
@@ -1 +0,0 @@
1
- export { JWT_ERROR_KEYS } from './jwtErrorKeys';
@@ -1,7 +0,0 @@
1
- // @bun
2
- import {
3
- JWT_ERROR_KEYS
4
- } from "../../../../chunk-cqw9xq4y.js";
5
- export {
6
- JWT_ERROR_KEYS
7
- };