@mrxsys/mrx-core 2.3.5-canary-20250520-f78ef3f → 2.4.0-canary-20250521-731c6b4

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 (107) hide show
  1. package/CHANGELOG.md +33 -186
  2. package/dist/chunk-1c7w5cx7.js +3 -0
  3. package/dist/{chunk-n4jkqchx.js → chunk-40pg2cqx.js} +1 -1
  4. package/dist/chunk-4v4tp5qj.js +2 -0
  5. package/dist/{chunk-mrzhtfav.js → chunk-4w7nd4nw.js} +1 -1
  6. package/dist/chunk-5nvsx7md.js +2 -0
  7. package/dist/chunk-89mnpfvy.js +2 -0
  8. package/dist/{chunk-yfegpmwy.js → chunk-91srr77d.js} +1 -1
  9. package/dist/{chunk-46z9v7pz.js → chunk-9hj714bv.js} +1 -1
  10. package/dist/chunk-9rss6865.js +2 -0
  11. package/dist/{chunk-kn1300vm.js → chunk-df9xr1f5.js} +1 -1
  12. package/dist/chunk-dq00mfya.js +2 -0
  13. package/dist/chunk-fnb68m68.js +2 -0
  14. package/dist/chunk-g6a16nyh.js +2 -0
  15. package/dist/chunk-gtgpa8nc.js +2 -0
  16. package/dist/chunk-gxjax5n3.js +2 -0
  17. package/dist/chunk-h9er1sh5.js +2 -0
  18. package/dist/{chunk-khjde4tm.js → chunk-mwpajm9x.js} +1 -1
  19. package/dist/chunk-n5w9cwwg.js +2 -0
  20. package/dist/chunk-pt7wrvtr.js +2 -0
  21. package/dist/{chunk-2ysjvwgk.js → chunk-qndyhwdn.js} +1 -1
  22. package/dist/{chunk-qmdvezak.js → chunk-v5dfx8mh.js} +1 -1
  23. package/dist/chunk-wgq0yyqw.js +2 -0
  24. package/dist/chunk-wtfcgg9s.js +2 -0
  25. package/dist/{chunk-5x3px0nq.js → chunk-z00b1r18.js} +1 -1
  26. package/dist/data/data.d.ts +99 -0
  27. package/dist/data/enums/dataErrorKeys.d.ts +7 -0
  28. package/dist/data/enums/index.d.ts +1 -0
  29. package/dist/data/enums/index.js +2 -0
  30. package/dist/data/index.d.ts +1 -0
  31. package/dist/data/index.js +2 -0
  32. package/dist/data/transformers/camelCase.d.ts +25 -0
  33. package/dist/data/transformers/index.d.ts +4 -0
  34. package/dist/data/transformers/index.js +2 -0
  35. package/dist/data/transformers/kebabCase.d.ts +25 -0
  36. package/dist/data/transformers/pascalCase.d.ts +25 -0
  37. package/dist/data/transformers/snakeCase.d.ts +25 -0
  38. package/dist/data/types/index.d.ts +1 -0
  39. package/dist/data/types/index.js +1 -0
  40. package/dist/data/types/keyTransformer.d.ts +11 -0
  41. package/dist/database/enums/{databaseKeyError.d.ts → databaseErrorKeys.d.ts} +1 -5
  42. package/dist/database/enums/index.d.ts +1 -1
  43. package/dist/database/enums/index.js +1 -1
  44. package/dist/database/events/index.d.ts +2 -2
  45. package/dist/database/index.js +1 -1
  46. package/dist/database/mssql.d.ts +9 -9
  47. package/dist/database/table.d.ts +1 -1
  48. package/dist/elysia/enums/{elysiaKeyError.d.ts → elysiaErrorKeys.d.ts} +1 -5
  49. package/dist/elysia/enums/index.d.ts +1 -1
  50. package/dist/elysia/enums/index.js +1 -1
  51. package/dist/elysia/error.d.ts +0 -4
  52. package/dist/elysia/index.js +1 -1
  53. package/dist/elysia/schemas/index.js +1 -1
  54. package/dist/error/index.js +1 -1
  55. package/dist/index.d.ts +67 -17
  56. package/dist/index.js +1 -1
  57. package/dist/logger/enums/index.d.ts +1 -0
  58. package/dist/logger/enums/index.js +2 -0
  59. package/dist/logger/enums/loggerErrorKeys.d.ts +6 -0
  60. package/dist/logger/events/index.d.ts +1 -0
  61. package/dist/logger/events/index.js +1 -0
  62. package/dist/logger/events/loggerEvents.d.ts +4 -0
  63. package/dist/logger/index.d.ts +1 -0
  64. package/dist/logger/index.js +2 -0
  65. package/dist/logger/logger.d.ts +173 -0
  66. package/dist/logger/strategies/consoleLogger.d.ts +22 -0
  67. package/dist/logger/strategies/fileLogger.d.ts +25 -0
  68. package/dist/logger/strategies/index.d.ts +2 -0
  69. package/dist/logger/strategies/index.js +2 -0
  70. package/dist/logger/types/bodiesIntersection.d.ts +2 -0
  71. package/dist/logger/types/index.d.ts +6 -0
  72. package/dist/logger/types/index.js +1 -0
  73. package/dist/logger/types/logLevels.d.ts +4 -0
  74. package/dist/logger/types/logStreamChunk.d.ts +15 -0
  75. package/dist/logger/types/loggerStrategy.d.ts +11 -0
  76. package/dist/logger/types/strategyBody.d.ts +2 -0
  77. package/dist/logger/types/strategyMap.d.ts +2 -0
  78. package/dist/mailer/enums/index.d.ts +1 -1
  79. package/dist/mailer/enums/index.js +1 -1
  80. package/dist/mailer/enums/{mailerKeyError.d.ts → mailerErrorKeys.d.ts} +1 -5
  81. package/dist/mailer/index.js +1 -1
  82. package/dist/mailer/smtp.d.ts +3 -3
  83. package/dist/repository/index.js +1 -1
  84. package/dist/repository/repository.d.ts +12 -12
  85. package/dist/singletonManager/enums/index.d.ts +1 -0
  86. package/dist/singletonManager/enums/index.js +2 -0
  87. package/dist/singletonManager/enums/singletonManagerErrorKeys.d.ts +7 -0
  88. package/dist/singletonManager/index.d.ts +1 -0
  89. package/dist/singletonManager/index.js +2 -0
  90. package/dist/singletonManager/singletonManager.d.ts +112 -0
  91. package/dist/store/index.js +1 -1
  92. package/dist/typedEventEmitter/index.d.ts +1 -0
  93. package/dist/typedEventEmitter/index.js +2 -0
  94. package/dist/typedEventEmitter/typedEventEmitter.d.ts +199 -0
  95. package/dist/typedEventEmitter/types/eventMap.d.ts +6 -0
  96. package/dist/typedEventEmitter/types/index.d.ts +1 -0
  97. package/dist/typedEventEmitter/types/index.js +1 -0
  98. package/dist/utils/enums/index.d.ts +1 -1
  99. package/dist/utils/enums/index.js +1 -1
  100. package/dist/utils/enums/utilErrorKeys.d.ts +4 -0
  101. package/dist/utils/env.d.ts +1 -1
  102. package/dist/utils/index.js +1 -1
  103. package/package.json +18 -7
  104. package/dist/chunk-ckg4jheb.js +0 -2
  105. package/dist/chunk-fktnffnw.js +0 -2
  106. package/dist/utils/enums/utilKeyError.d.ts +0 -8
  107. package/sandbox/server.ts +0 -2
package/dist/index.d.ts CHANGED
@@ -1,18 +1,68 @@
1
+ export * from './data/data';
2
+ export * from './data/enums/dataErrorKeys';
3
+ export * from './data/transformers/camelCase';
4
+ export * from './data/transformers/kebabCase';
5
+ export * from './data/transformers/pascalCase';
6
+ export * from './data/transformers/snakeCase';
7
+ export type * from './data/types/keyTransformer';
1
8
  export * from './database';
2
- export * from './database/enums';
3
- export * from './database/events';
4
- export type * from './database/types';
5
- export * from './elysia';
6
- export * from './elysia/enums';
7
- export * from './elysia/schemas';
8
- export type * from './elysia/types';
9
- export * from './error';
10
- export * from './mailer';
11
- export * from './mailer/enums';
12
- export type * from './mailer/types';
13
- export * from './repository';
14
- export type * from './repository/types';
15
- export * from './store';
16
- export * from './utils';
17
- export * from './utils/enums';
18
- export type * from './utils/types';
9
+ export * from './database/enums/databaseErrorKeys';
10
+ export * from './database/enums/mssqlErrorCode';
11
+ export type * from './database/events/mssqlEventMap';
12
+ export type * from './database/events/tableEventMap';
13
+ export type * from './database/types/mssqlDatabaseOption';
14
+ export type * from './database/types/mssqlEventLog';
15
+ export type * from './database/types/queryContext';
16
+ export * from './elysia/advancedSearch';
17
+ export * from './elysia/crud';
18
+ export * from './elysia/dynamicDatabaseSelector';
19
+ export * from './elysia/error';
20
+ export * from './elysia/jwt';
21
+ export * from './elysia/microservice';
22
+ export * from './elysia/ratelimit';
23
+ export * from './elysia/enums/elysiaErrorKeys';
24
+ export * from './elysia/enums/httpStatusCode';
25
+ export * from './elysia/schemas/info';
26
+ export * from './elysia/schemas/ping';
27
+ export type * from './elysia/types/crudOptions';
28
+ export type * from './elysia/types/crudRoutes';
29
+ export type * from './elysia/types/dynamicDatabaseSelectorPluginOptions';
30
+ export type * from './elysia/types/jwtOptions';
31
+ export type * from './elysia/types/rateLimitOptions';
32
+ export * from './error/coreError';
33
+ export type * from './error/types/coreErrorOptions';
34
+ export * from './logger/logger';
35
+ export * from './logger/enums/loggerErrorKeys';
36
+ export type * from './logger/events/loggerEvents';
37
+ export * from './logger/strategies/consoleLogger';
38
+ export * from './logger/strategies/fileLogger';
39
+ export type * from './logger/types/bodiesIntersection';
40
+ export type * from './logger/types/logLevels';
41
+ export type * from './logger/types/logStreamChunk';
42
+ export type * from './logger/types/loggerStrategy';
43
+ export type * from './logger/types/strategyBody';
44
+ export type * from './logger/types/strategyMap';
45
+ export * from './mailer/smtp';
46
+ export * from './mailer/enums/mailerErrorKeys';
47
+ export type * from './mailer/types/smtpCredentials';
48
+ export type * from './mailer/types/smtpOptions';
49
+ export type * from './mailer/types/smtpPoolOptions';
50
+ export * from './repository/repository';
51
+ export type * from './repository/types/advancedSearch';
52
+ export type * from './repository/types/orderBy';
53
+ export type * from './repository/types/queryOptions';
54
+ export type * from './repository/types/queryOptionsExtendPagination';
55
+ export type * from './repository/types/queryOptionsExtendStream';
56
+ export type * from './repository/types/selectedFields';
57
+ export type * from './repository/types/transaction';
58
+ export type * from './repository/types/whereClause';
59
+ export * from './singletonManager/singletonManager';
60
+ export * from './singletonManager/enums/singletonManagerErrorKeys';
61
+ export * from './store/redis';
62
+ export * from './typedEventEmitter/typedEventEmitter';
63
+ export type * from './typedEventEmitter/types/eventMap';
64
+ export * from './utils/env';
65
+ export * from './utils/isIsoDateString';
66
+ export * from './utils/stream';
67
+ export * from './utils/enums/utilErrorKeys';
68
+ export type * from './utils/types/streamWithAsyncIterable';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{a as P}from"./utils/index.js";import"./utils/enums/index.js";import{b as O}from"./chunk-yfegpmwy.js";import"./error/index.js";import{c as M}from"./mailer/index.js";import"./mailer/enums/index.js";import{d as L}from"./chunk-n4jkqchx.js";import"./repository/index.js";import{e as N}from"./store/index.js";import"./database/index.js";import"./database/enums/index.js";import"./database/events/index.js";import{f as k,g as n,h as q,i as w,j as z,k as A,l as B,m as C,n as F,o as I,p as K}from"./elysia/index.js";import"./chunk-kn1300vm.js";import{U as h,V as j}from"./chunk-fktnffnw.js";import{W as g}from"./chunk-ckg4jheb.js";import{X as E,Y as c}from"./chunk-46z9v7pz.js";import{Z as d}from"./chunk-5x3px0nq.js";import{$ as D,_ as u}from"./chunk-2ysjvwgk.js";import"./elysia/enums/index.js";import{aa as v,ba as J}from"./chunk-qmdvezak.js";import"./elysia/schemas/index.js";import{ca as G,da as H}from"./chunk-khjde4tm.js";import"./chunk-mrzhtfav.js";export{P as validateEnv,O as utilKeyError,K as rateLimitPlugin,H as pingResponse200Schema,D as mssqlErrorCode,I as microservicePlugin,c as makeStreamAsyncIterable,L as mailerKeyError,F as jwtPlugin,E as isIsoDateString,G as infoResponse200Schema,J as httpStatusCode,C as errorPlugin,v as elysiaKeyError,w as dynamicDatabaseSelectorPlugin,u as databaseKeyError,B as crudPlugin,z as createResponse200Schema,A as createInsertBodySchema,n as createBaseSearchSchemaWithPagination,k as createBaseSearchSchema,q as advancedSearchPlugin,h as Table,M as SMTP,g as Repository,N as Redis,j as MSSQL,d as CoreError};
2
+ import{a as Tb}from"./chunk-dq00mfya.js";import{b as Vb}from"./chunk-89mnpfvy.js";import{c as Ub}from"./chunk-91srr77d.js";import{d as Ob,e as Pb}from"./chunk-1c7w5cx7.js";import{f as Rb}from"./chunk-h9er1sh5.js";import{g as Qb}from"./chunk-40pg2cqx.js";import{h as cb,i as fb,j as hb,k as wb,l as xb,m as zb,n as Ab,o as Bb,p as Cb,q as Hb,r as Lb}from"./chunk-pt7wrvtr.js";import{s as kb}from"./chunk-gxjax5n3.js";import{t as jb}from"./chunk-wtfcgg9s.js";import"./chunk-df9xr1f5.js";import{Y as qb,Z as Jb}from"./chunk-v5dfx8mh.js";import{$ as Gb,_ as Fb}from"./chunk-mwpajm9x.js";import{aa as Nb}from"./chunk-gtgpa8nc.js";import{ba as Mb}from"./chunk-wgq0yyqw.js";import{ca as d,da as o,ea as p,fa as v}from"./chunk-9rss6865.js";import{ga as a}from"./chunk-5nvsx7md.js";import{ha as y,ia as m,ja as l,ka as n}from"./chunk-4v4tp5qj.js";import"./database/index.js";import{la as t,ma as bb}from"./chunk-n5w9cwwg.js";import{na as s}from"./chunk-fnb68m68.js";import{oa as r,pa as i}from"./chunk-9hj714bv.js";import{qa as e}from"./chunk-g6a16nyh.js";import{ra as S}from"./chunk-z00b1r18.js";import{sa as E,ta as u}from"./chunk-qndyhwdn.js";import"./chunk-4w7nd4nw.js";export{Vb as validateEnv,Ub as utilErrorKeys,v as transformKeys,jb as singletonManagerErrorKeys,Lb as rateLimitPlugin,Gb as pingResponse200Schema,u as mssqlErrorCode,Hb as microservicePlugin,i as makeStreamAsyncIterable,Qb as mailerErrorKeys,Mb as loggerErrorKeys,Cb as jwtPlugin,r as isIsoDateString,Fb as infoResponse200Schema,Jb as httpStatusCode,p as filterByValue,o as filterByKeyInclusion,d as filterByKeyExclusion,Bb as errorPlugin,qb as elysiaErrorKeys,wb as dynamicDatabaseSelectorPlugin,E as databaseErrorKeys,a as dataErrorKeys,Ab as crudPlugin,xb as createResponse200Schema,zb as createInsertBodySchema,fb as createBaseSearchSchemaWithPagination,cb as createBaseSearchSchema,hb as advancedSearchPlugin,e as TypedEventEmitter,t as Table,n as SnakeCaseTransformer,kb as SingletonManager,Rb as SMTP,s as Repository,Tb as Redis,l as PascalCaseTransformer,bb as MSSQL,Nb as Logger,m as KebabCaseTransformer,Pb as FileLoggerStrategy,S as CoreError,Ob as ConsoleLoggerStrategy,y as CamelCaseTransformer};
@@ -0,0 +1 @@
1
+ export * from './loggerErrorKeys';
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ba as e}from"../../chunk-wgq0yyqw.js";import"../../chunk-4w7nd4nw.js";export{e as loggerErrorKeys};
@@ -0,0 +1,6 @@
1
+ export declare const loggerErrorKeys: {
2
+ readonly stategyAlreadyAdded: "core.error.strategy_already_added";
3
+ readonly strategyNotFound: "core.error.strategy_not_found";
4
+ readonly noStrategyAdded: "core.error.no_strategy_added";
5
+ readonly loggerStrategyError: "core.error.strategy_error";
6
+ };
@@ -0,0 +1 @@
1
+ export type * from './loggerEvents';
@@ -0,0 +1 @@
1
+ // @bun
@@ -0,0 +1,4 @@
1
+ export interface LoggerEvent {
2
+ error: [Error];
3
+ end: [];
4
+ }
@@ -0,0 +1 @@
1
+ export * from './logger';
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{aa as e}from"../chunk-gtgpa8nc.js";import"../chunk-wgq0yyqw.js";import"../chunk-g6a16nyh.js";import"../chunk-z00b1r18.js";import"../chunk-4w7nd4nw.js";export{e as Logger};
@@ -0,0 +1,173 @@
1
+ import { TypedEventEmitter } from '../typedEventEmitter/typedEventEmitter';
2
+ import type { LoggerEvent } from './events/loggerEvents';
3
+ import type { BodiesIntersection } from './types/bodiesIntersection';
4
+ import type { LoggerStrategy } from './types/loggerStrategy';
5
+ import type { StrategyMap } from './types/strategyMap';
6
+ /**
7
+ * Logger provides a flexible, type-safe logging system that allows multiple strategies for log output.
8
+ * The logger uses a transform stream to process log entries and execute the logging strategies.
9
+ *
10
+ * Logger extends the {@link TypedEventEmitter} class to emit typed events when an error occurs or when the logger ends.
11
+ * The logger can log messages with different levels: error, warn, info, debug, and log.
12
+ *
13
+ * @template TStrategies - The map of strategy names to LoggerStrategy types.
14
+ */
15
+ export declare class Logger<TStrategies extends StrategyMap = {}> extends TypedEventEmitter<LoggerEvent> {
16
+ /**
17
+ * The map of strategies.
18
+ */
19
+ private readonly _strategies;
20
+ /**
21
+ * The transform stream for processing log entries.
22
+ */
23
+ private readonly _logStream;
24
+ /**
25
+ * The queue of pending log entries.
26
+ */
27
+ private readonly _pendingLogs;
28
+ /**
29
+ * The maximum number of pending logs.
30
+ * @defaultValue 10_000
31
+ */
32
+ private readonly _maxPendingLogs;
33
+ /**
34
+ * Flag to indicate if the logger is currently writing logs.
35
+ */
36
+ private _isWriting;
37
+ /**
38
+ * Construct a Logger.
39
+ *
40
+ * @template TStrategies - The map of strategy names to LoggerStrategy types.
41
+ * @param strategies - Initial strategies map.
42
+ * @param maxPendingLogs - Maximum number of logs in the queue (default: 10_000)
43
+ */
44
+ constructor(strategies?: TStrategies, maxPendingLogs?: number);
45
+ /**
46
+ * Register a new logging strategy.
47
+ *
48
+ * @template Key - The name of the strategy.
49
+ * @template Strategy - The strategy type.
50
+ *
51
+ * @throws ({@link CoreError}): If the strategy is already added. ({@link loggerErrorKeys.stategyAlreadyAdded})
52
+ *
53
+ * @returns A new Logger instance with the added strategy.
54
+ */
55
+ registerStrategy<Key extends string, Strategy extends LoggerStrategy>(name: Key, strategy: Strategy): Logger<TStrategies & Record<Key, Strategy>>;
56
+ /**
57
+ * Unregister a logging strategy.
58
+ *
59
+ * @template Key - The name of the strategy.
60
+ *
61
+ * @throws ({@link CoreError}): If the strategy is not found. ({@link loggerErrorKeys.strategyNotFound})
62
+ *
63
+ * @returns A new Logger instance without the removed strategy.
64
+ */
65
+ unregisterStrategy<Key extends keyof TStrategies>(name: Key): Logger<Omit<TStrategies, Key>>;
66
+ /**
67
+ * Register multiple strategies at once.
68
+ *
69
+ * @template TNew - The new strategies to add.
70
+ *
71
+ * @throws ({@link CoreError}): If any strategy is already added. ({@link loggerErrorKeys.stategyAlreadyAdded})
72
+ *
73
+ * @returns A new Logger instance with the added strategies.
74
+ */
75
+ registerStrategies<TNew extends [string, LoggerStrategy][] = [string, LoggerStrategy][]>(strategies: TNew): Logger<TStrategies & {
76
+ [K in TNew[number][0]]: Extract<TNew[number], [K, LoggerStrategy]>[1];
77
+ }>;
78
+ /**
79
+ * Unregister multiple strategies at once.
80
+ *
81
+ * @template Keys - The names of the strategies to remove.
82
+ *
83
+ * @throws ({@link CoreError}): If any strategy is not found. ({@link loggerErrorKeys.strategyNotFound})
84
+ *
85
+ * @returns A new Logger instance without the removed strategies.
86
+ */
87
+ unregisterStrategies<Keys extends Extract<keyof TStrategies, string>>(names: Keys[]): Logger<Omit<TStrategies, Keys>>;
88
+ /**
89
+ * Remove all strategies.
90
+ *
91
+ * @returns A new Logger instance without any strategies.
92
+ */
93
+ clearStrategies(): Logger;
94
+ /**
95
+ * Log an error message.
96
+ *
97
+ * @template SNames - The names of the strategies to use.
98
+ *
99
+ * @param object - The object to log. ({@link BodiesIntersection})
100
+ * @param strategiesNames - The names of the strategies to use. If not provided, all strategies will be used.
101
+ *
102
+ * @throws ({@link CoreError}): If no strategy is added. ({@link loggerErrorKeys.noStrategyAdded})
103
+ */
104
+ error<SNames extends (keyof TStrategies)[] = (keyof TStrategies)[]>(object: BodiesIntersection<TStrategies, SNames[number]>, strategiesNames?: SNames): void;
105
+ /**
106
+ * Log a warning message.
107
+ *
108
+ * @template SNames - The names of the strategies to use.
109
+ *
110
+ * @param object - The object to log. ({@link BodiesIntersection})
111
+ * @param strategiesNames - The names of the strategies to use. If not provided, all strategies will be used.
112
+ *
113
+ * @throws ({@link CoreError}): If no strategy is added. ({@link loggerErrorKeys.noStrategyAdded})
114
+ */
115
+ warn<SNames extends (keyof TStrategies)[] = (keyof TStrategies)[]>(object: BodiesIntersection<TStrategies, SNames[number]>, strategiesNames?: SNames): void;
116
+ /**
117
+ * Log an info message.
118
+ *
119
+ * @template SNames - The names of the strategies to use.
120
+ *
121
+ * @param object - The object to log. ({@link BodiesIntersection})
122
+ * @param strategiesNames - The names of the strategies to use. If not provided, all strategies will be used.
123
+ *
124
+ * @throws ({@link CoreError}): If no strategy is added. ({@link loggerErrorKeys.noStrategyAdded})
125
+ */
126
+ info<SNames extends (keyof TStrategies)[] = (keyof TStrategies)[]>(object: BodiesIntersection<TStrategies, SNames[number]>, strategiesNames?: SNames): void;
127
+ /**
128
+ * Log a debug message.
129
+ *
130
+ * @template SNames - The names of the strategies to use.
131
+ *
132
+ * @param object - The object to log. ({@link BodiesIntersection})
133
+ * @param strategiesNames - The names of the strategies to use. If not provided, all strategies will be used.
134
+ *
135
+ * @throws ({@link CoreError}): If no strategy is added. ({@link loggerErrorKeys.noStrategyAdded})
136
+ */
137
+ debug<SNames extends (keyof TStrategies)[] = (keyof TStrategies)[]>(object: BodiesIntersection<TStrategies, SNames[number]>, strategiesNames?: SNames): void;
138
+ /**
139
+ * Log a generic message.
140
+ *
141
+ * @template SNames - The names of the strategies to use.
142
+ *
143
+ * @param object - The object to log. ({@link BodiesIntersection})
144
+ * @param strategiesNames - The names of the strategies to use. If not provided, all strategies will be used.
145
+ *
146
+ * @throws ({@link CoreError}): If no strategy is added. ({@link loggerErrorKeys.noStrategyAdded})
147
+ */
148
+ log<SNames extends (keyof TStrategies)[] = (keyof TStrategies)[]>(object: BodiesIntersection<TStrategies, SNames[number]>, strategiesNames?: SNames): void;
149
+ /**
150
+ * Internal: execute all strategies for a log event.
151
+ *
152
+ * @template TLogObject - The type of the log object.
153
+ *
154
+ * @throws ({@link CoreError}): If a strategy throws. ({@link loggerErrorKeys.loggerStrategyError})
155
+ */
156
+ private _executeStrategies;
157
+ /**
158
+ * Internal: queue a log event and start writing if not already.
159
+ *
160
+ * @template TLogObject - The type of the log object.
161
+ *
162
+ * @param level - The log level. ({@link LogLevels})
163
+ * @param object - The object to log.
164
+ * @param strategiesNames - The names of the strategies to use. If not provided, all strategies will be used.
165
+ *
166
+ * @throws ({@link CoreError}): If no strategy is added. ({@link loggerErrorKeys.noStrategyAdded})
167
+ */
168
+ private _out;
169
+ /**
170
+ * Internal: process the log queue and emit 'end' when done.
171
+ */
172
+ private _writeLog;
173
+ }
@@ -0,0 +1,22 @@
1
+ import type { LoggerStrategy } from '../../logger/types/loggerStrategy';
2
+ import type { LogLevels } from '../../logger/types/logLevels';
3
+ /**
4
+ * ConsoleLoggerStrategy implements LoggerStrategy to provide logging functionality to the console. ({@link LoggerStrategy})
5
+ */
6
+ export declare class ConsoleLoggerStrategy implements LoggerStrategy {
7
+ private readonly _colorize;
8
+ /**
9
+ * Initializes the ConsoleLoggerStrategy.
10
+ *
11
+ * @param colorize - Indicates if the output should be colorized. (Default is false.)
12
+ */
13
+ constructor(colorize?: boolean);
14
+ /**
15
+ * Logs a message to the console with the specified log level.
16
+ *
17
+ * @param level - The log level at which the message should be logged. ({@link LogLevels})
18
+ * @param date - The date at which the message was logged.
19
+ * @param object - The object to log.
20
+ */
21
+ log(level: LogLevels, date: Date, object: unknown): void;
22
+ }
@@ -0,0 +1,25 @@
1
+ import type { LoggerStrategy } from '../../logger/types/loggerStrategy';
2
+ import type { LogLevels } from '../../logger/types/logLevels';
3
+ /**
4
+ * FileLoggerStrategy implements LoggerStrategy to provide logging functionality to the file system. ({@link LoggerStrategy})
5
+ */
6
+ export declare class FileLoggerStrategy implements LoggerStrategy {
7
+ /**
8
+ * Path to the file to log to.
9
+ */
10
+ private readonly _path;
11
+ /**
12
+ * Constructor FileLoggerStrategy
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. {@link LogLevels}
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
+ }
@@ -0,0 +1,2 @@
1
+ export * from './consoleLogger.ts';
2
+ export * from './fileLogger.ts';
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{d as f,e as m}from"../../chunk-1c7w5cx7.js";import"../../chunk-4w7nd4nw.js";export{m as FileLoggerStrategy,f as ConsoleLoggerStrategy};
@@ -0,0 +1,2 @@
1
+ import type { StrategyBody } from './strategyBody';
2
+ export type BodiesIntersection<TStrategies, K extends keyof TStrategies> = (K extends unknown ? (object: StrategyBody<TStrategies, K>) => void : never) extends (object: infer I) => void ? I : never;
@@ -0,0 +1,6 @@
1
+ export type * from './bodiesIntersection.ts';
2
+ export type * from './loggerStrategy.ts';
3
+ export type * from './logLevels.ts';
4
+ export type * from './logStreamChunk.ts';
5
+ export type * from './strategyBody.ts';
6
+ export type * from './strategyMap.ts';
@@ -0,0 +1 @@
1
+ // @bun
@@ -0,0 +1,4 @@
1
+ /**
2
+ * The log levels.
3
+ */
4
+ export type LogLevels = 'ERROR' | 'WARN' | 'INFO' | 'DEBUG' | 'LOG';
@@ -0,0 +1,15 @@
1
+ import type { LogLevels } from './logLevels';
2
+ import type { StrategyMap } from './strategyMap';
3
+ /**
4
+ * Internal log stream object for the queue.
5
+ */
6
+ export interface LogStreamChunk<TLogObject, TStrategies extends StrategyMap> {
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 strategies to use. */
14
+ strategiesNames: (keyof TStrategies)[];
15
+ }
@@ -0,0 +1,11 @@
1
+ import type { LogLevels } from './logLevels';
2
+ export interface LoggerStrategy<TLogObject = unknown> {
3
+ /**
4
+ * Logs a message with the strategy's implementation.
5
+ *
6
+ * @param level - The log level at which the message should be logged. ({@link LogLevels})
7
+ * @param date - The date at which the message was logged.
8
+ * @param object - The object to log.
9
+ */
10
+ log(level: LogLevels, date: Date, object: TLogObject): Promise<void> | void;
11
+ }
@@ -0,0 +1,2 @@
1
+ import type { LoggerStrategy } from './loggerStrategy';
2
+ export type StrategyBody<TStrategies, Key extends keyof TStrategies> = TStrategies[Key] extends LoggerStrategy<infer TBody> ? TBody : never;
@@ -0,0 +1,2 @@
1
+ import type { LoggerStrategy } from './loggerStrategy';
2
+ export type StrategyMap = Record<string, LoggerStrategy>;
@@ -1 +1 @@
1
- export * from './mailerKeyError';
1
+ export * from './mailerErrorKeys';
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{d as e}from"../../chunk-n4jkqchx.js";import"../../chunk-mrzhtfav.js";export{e as mailerKeyError};
2
+ import{g as e}from"../../chunk-40pg2cqx.js";import"../../chunk-4w7nd4nw.js";export{e as mailerErrorKeys};
@@ -1,8 +1,4 @@
1
- /**
2
- * Mailer error key is a list of errors in the mailer context.
3
- * Each property represents a specific mailer error scenario.
4
- */
5
- export declare const mailerKeyError: {
1
+ export declare const mailerErrorKeys: {
6
2
  /** Error when failing to connect to SMTP server. */
7
3
  readonly smtpConnectionError: "core.error.mailer.smtp.connection_error";
8
4
  /** Error when SMTP server is not connected. */
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{d as z}from"../chunk-n4jkqchx.js";import{Z as q}from"../chunk-5x3px0nq.js";import"../chunk-mrzhtfav.js";import{createTransport as B}from"nodemailer";class D{_config;_transporter=null;constructor(x){this._config={port:587,secure:!1,...x}}async connect(){if(this._transporter)throw new q({key:z.smtpAlreadyConnected,message:"SMTP transporter is already connected."});this._transporter=B({host:this._config.host,port:this._config.port,secure:this._config.secure,auth:{user:this._config.credentials.user,pass:this._config.credentials.pass},pool:!0,maxConnections:this._config.pool?.maxConnections??5});try{await this._transporter.verify()}catch(x){throw new q({key:z.smtpConnectionError,message:"An error occurred while connecting to the SMTP server",cause:x})}}disconnect(){if(this._transporter)this._transporter.close(),this._transporter=null}async sendMail(x){if(!this._transporter)throw new q({key:z.smtpNotConnected,message:"SMTP transporter is not connected."});return this._transporter.sendMail(x)}}export{D as SMTP};export{D as c};
2
+ import{f as e}from"../chunk-h9er1sh5.js";import"../chunk-40pg2cqx.js";import"../chunk-z00b1r18.js";import"../chunk-4w7nd4nw.js";export{e as SMTP};
@@ -39,8 +39,8 @@ export declare class SMTP {
39
39
  * It enables connection pooling for efficient resource usage and sets the maximum number of
40
40
  * concurrent connections as specified in the configuration (default: 5).
41
41
  *
42
- * @throws ({@link CoreError}): If the transporter is already connected. ({@link mailerKeyError.smtpAlreadyConnected})
43
- * @throws ({@link CoreError}): If the connection or verification fails. ({@link mailerKeyError.smtpConnectionError})
42
+ * @throws ({@link CoreError}): If the transporter is already connected. ({@link mailerErrorKeys.smtpAlreadyConnected})
43
+ * @throws ({@link CoreError}): If the connection or verification fails. ({@link mailerErrorKeys.smtpConnectionError})
44
44
  */
45
45
  connect(): Promise<void>;
46
46
  /**
@@ -54,7 +54,7 @@ export declare class SMTP {
54
54
  *
55
55
  * @param options - The mail options, such as recipient, subject, and content.
56
56
  *
57
- * @throws ({@link CoreError}) - If the transporter is not connected. ({@link mailerKeyError.smtpNotConnected})
57
+ * @throws ({@link CoreError}) - If the transporter is not connected. ({@link mailerErrorKeys.smtpNotConnected})
58
58
  *
59
59
  * @returns A promise resolving to the result of the send operation.
60
60
  */
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{W as e}from"../chunk-ckg4jheb.js";import"../chunk-46z9v7pz.js";import"../chunk-5x3px0nq.js";import"../chunk-2ysjvwgk.js";import"../chunk-mrzhtfav.js";export{e as Repository};
2
+ import{na as e}from"../chunk-fnb68m68.js";import"../chunk-9hj714bv.js";import"../chunk-z00b1r18.js";import"../chunk-qndyhwdn.js";import"../chunk-4w7nd4nw.js";export{e as Repository};
@@ -97,8 +97,8 @@ export declare class Repository<TModel = unknown> {
97
97
  * @template KModel - The type of the object to retrieve.
98
98
  * @param options - The query options to apply to the search. ({@link QueryOptionsExtendPagination})
99
99
  *
100
- * @throws ({@link CoreError}) Throws an error if no records are found and the `throwIfNoResult` option is enabled. ({@link databaseKeyError.mssqlNoResult})
101
- * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseKeyError})
100
+ * @throws ({@link CoreError}) Throws an error if no records are found and the `throwIfNoResult` option is enabled. ({@link databaseErrorKeys.mssqlNoResult})
101
+ * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseErrorKeys})
102
102
  *
103
103
  * @returns An array of records matching the query options. ({@link KModel})
104
104
  *
@@ -155,8 +155,8 @@ export declare class Repository<TModel = unknown> {
155
155
  * @template KModel - The type of the object to retrieve.
156
156
  * @param options - The query options to apply to the search. ({@link QueryOptionsExtendPagination})
157
157
  *
158
- * @throws ({@link CoreError}) Throws an error if no records are found and the `throwIfNoResult` option is enabled. ({@link databaseKeyError.mssqlNoResult})
159
- * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseKeyError})
158
+ * @throws ({@link CoreError}) Throws an error if no records are found and the `throwIfNoResult` option is enabled. ({@link databaseErrorKeys.mssqlNoResult})
159
+ * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseErrorKeys})
160
160
  *
161
161
  * @returns A single record matching the query options. ({@link KModel})
162
162
  *
@@ -204,8 +204,8 @@ export declare class Repository<TModel = unknown> {
204
204
  * @template KModel - The type of the object to count.
205
205
  * @param options - The query options to apply to the search. ({@link QueryOptions})
206
206
  *
207
- * @throws ({@link CoreError}) Throws an error if no records are found and the `throwIfNoResult` option is enabled. ({@link databaseKeyError.mssqlNoResult})
208
- * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseKeyError})
207
+ * @throws ({@link CoreError}) Throws an error if no records are found and the `throwIfNoResult` option is enabled. ({@link databaseErrorKeys.mssqlNoResult})
208
+ * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseErrorKeys})
209
209
  *
210
210
  * @returns The count of records matching the query options.
211
211
  *
@@ -238,7 +238,7 @@ export declare class Repository<TModel = unknown> {
238
238
  * @param data - The data to insert. Can be a single object or an array of objects.
239
239
  * @param options - The query options to apply to the insertion. ({@link QueryOptions})
240
240
  *
241
- * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseKeyError})
241
+ * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseErrorKeys})
242
242
  *
243
243
  * @returns An array of inserted records.
244
244
  *
@@ -271,7 +271,7 @@ export declare class Repository<TModel = unknown> {
271
271
  * @param data - The data to update. Can be a single object or an array of objects.
272
272
  * @param options - The query options to apply to the update. ({@link QueryOptions})
273
273
  *
274
- * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseKeyError})
274
+ * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseErrorKeys})
275
275
  *
276
276
  * @returns An array of updated records.
277
277
  *
@@ -305,7 +305,7 @@ export declare class Repository<TModel = unknown> {
305
305
  * @template KModel - The type of the object to delete.
306
306
  * @param options - The query options to apply to the deletion. ({@link QueryOptions})
307
307
  *
308
- * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseKeyError})
308
+ * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseErrorKeys})
309
309
  *
310
310
  * @returns An array of deleted records.
311
311
  *
@@ -349,7 +349,7 @@ export declare class Repository<TModel = unknown> {
349
349
  * @param error - The error object thrown by Knex.js.
350
350
  * @param query - The Knex.js query builder that caused the error.
351
351
  *
352
- * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseKeyError})
352
+ * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseErrorKeys})
353
353
  *
354
354
  * @returns Never returns, always throws an error.
355
355
  */
@@ -369,8 +369,8 @@ export declare class Repository<TModel = unknown> {
369
369
  * @param query - The Knex.js query builder to execute.
370
370
  * @param throwIfNoResult - Whether to throw an error if no records are found.
371
371
  *
372
- * @throws ({@link CoreError}) Throws an error if no records are found and the `throwIfNoResult` option is enabled. ({@link databaseKeyError.mssqlNoResult})
373
- * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseKeyError})
372
+ * @throws ({@link CoreError}) Throws an error if no records are found and the `throwIfNoResult` option is enabled. ({@link databaseErrorKeys.mssqlNoResult})
373
+ * @throws ({@link CoreError}) Throws an error if an MSSQL-specific error occurs during the query execution. ({@link databaseErrorKeys})
374
374
  *
375
375
  * @returns An array of records returned by the query.
376
376
  */
@@ -0,0 +1 @@
1
+ export * from './singletonManagerErrorKeys';
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{t as e}from"../../chunk-wtfcgg9s.js";import"../../chunk-4w7nd4nw.js";export{e as singletonManagerErrorKeys};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Core util key error is a list of errors in the util context.
3
+ */
4
+ export declare const singletonManagerErrorKeys: {
5
+ readonly classConstructorAlreadyRegistered: "core.error.class_constructor_already_registered";
6
+ readonly classConstructorNotRegistered: "core.error.class_constructor_not_registered";
7
+ };
@@ -0,0 +1 @@
1
+ export * from './singletonManager';
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{s as e}from"../chunk-gxjax5n3.js";import"../chunk-wtfcgg9s.js";import"../chunk-z00b1r18.js";import"../chunk-4w7nd4nw.js";export{e as SingletonManager};