@guren/server 1.0.0-rc.9 → 1.0.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 (68) hide show
  1. package/dist/{Application-DtWDHXr1.d.ts → Application-BnsyCKXY.d.ts} +79 -8
  2. package/dist/AuthManager-SfhCNkAU.d.ts +79 -0
  3. package/dist/{BroadcastManager-AkIWUGJo.d.ts → BroadcastManager-CGWl9rUO.d.ts} +5 -0
  4. package/dist/{ConsoleKernel-CqCVrdZs.d.ts → ConsoleKernel-BDtBETjm.d.ts} +1 -1
  5. package/dist/{Gate-CNkBYf8m.d.ts → Gate-CynjZCtS.d.ts} +5 -0
  6. package/dist/{I18nManager-Dtgzsf5n.d.ts → I18nManager-BiSoczfV.d.ts} +6 -1
  7. package/dist/McpServiceProvider-JW6PDVMD.js +7 -0
  8. package/dist/api-token-BSSCLlFW.d.ts +541 -0
  9. package/dist/auth/index.d.ts +9 -327
  10. package/dist/auth/index.js +59 -6684
  11. package/dist/authorization/index.d.ts +2 -2
  12. package/dist/authorization/index.js +19 -604
  13. package/dist/broadcasting/index.d.ts +2 -2
  14. package/dist/broadcasting/index.js +12 -895
  15. package/dist/cache/index.js +8 -809
  16. package/dist/chunk-2T6JN4VR.js +1563 -0
  17. package/dist/chunk-44F7JQ7I.js +950 -0
  18. package/dist/chunk-74HTZG3V.js +331 -0
  19. package/dist/chunk-A3ISJVEV.js +598 -0
  20. package/dist/chunk-CSDKWLFD.js +652 -0
  21. package/dist/chunk-CSRQTEQA.js +839 -0
  22. package/dist/chunk-DAQKYKLH.js +182 -0
  23. package/dist/chunk-EDRGAM6G.js +647 -0
  24. package/dist/chunk-EGU5KB7V.js +818 -0
  25. package/dist/chunk-H32L2NE3.js +372 -0
  26. package/dist/chunk-HKQSAFSN.js +837 -0
  27. package/dist/chunk-IOTWFHZU.js +558 -0
  28. package/dist/chunk-ONSDE37A.js +125 -0
  29. package/dist/chunk-QQKTH5KX.js +114 -0
  30. package/dist/chunk-R2TCP7D7.js +409 -0
  31. package/dist/chunk-SIP34GBE.js +380 -0
  32. package/dist/chunk-THSX7OOR.js +454 -0
  33. package/dist/chunk-UY3AZSYL.js +14 -0
  34. package/dist/chunk-VT5KRDPH.js +134 -0
  35. package/dist/chunk-VXXZIXAP.js +255 -0
  36. package/dist/chunk-WJJ5CTNI.js +907 -0
  37. package/dist/chunk-WVY45EIW.js +359 -0
  38. package/dist/chunk-ZRBLZY3M.js +462 -0
  39. package/dist/client-CKXJLsTe.d.ts +232 -0
  40. package/dist/email-verification-CAeArjui.d.ts +327 -0
  41. package/dist/encryption/index.js +48 -556
  42. package/dist/errors-JOOPDDQ6.js +34 -0
  43. package/dist/events/index.js +14 -316
  44. package/dist/health/index.js +12 -367
  45. package/dist/i18n/index.d.ts +2 -2
  46. package/dist/i18n/index.js +14 -583
  47. package/dist/index.d.ts +37 -239
  48. package/dist/index.js +2873 -19166
  49. package/dist/lambda/index.d.ts +9 -7
  50. package/dist/lambda/index.js +4 -9
  51. package/dist/logging/index.js +12 -545
  52. package/dist/mail/index.d.ts +29 -1
  53. package/dist/mail/index.js +15 -684
  54. package/dist/mcp/index.d.ts +7 -5
  55. package/dist/mcp/index.js +5 -378
  56. package/dist/notifications/index.d.ts +8 -6
  57. package/dist/notifications/index.js +13 -730
  58. package/dist/queue/index.d.ts +37 -7
  59. package/dist/queue/index.js +22 -940
  60. package/dist/redis/index.d.ts +366 -0
  61. package/dist/redis/index.js +597 -0
  62. package/dist/runtime/index.d.ts +8 -6
  63. package/dist/runtime/index.js +26 -244
  64. package/dist/scheduling/index.js +14 -822
  65. package/dist/storage/index.d.ts +1 -0
  66. package/dist/storage/index.js +6 -824
  67. package/package.json +15 -7
  68. package/dist/api-token-JOif2CtG.d.ts +0 -1792
@@ -1,22 +1,24 @@
1
1
  import * as hono_aws_lambda from 'hono/aws-lambda';
2
2
  export { APIGatewayProxyResult, LambdaEvent } from 'hono/aws-lambda';
3
- import { A as Application } from '../Application-DtWDHXr1.js';
3
+ import { A as Application } from '../Application-BnsyCKXY.js';
4
4
  import { S as Scheduler } from '../Scheduler-BstvSca7.js';
5
- import { C as ConsoleKernel } from '../ConsoleKernel-CqCVrdZs.js';
5
+ import { C as ConsoleKernel } from '../ConsoleKernel-BDtBETjm.js';
6
6
  import 'hono';
7
- import '../api-token-JOif2CtG.js';
7
+ import '../api-token-BSSCLlFW.js';
8
+ import '../AuthManager-SfhCNkAU.js';
9
+ import '@guren/orm';
8
10
  import 'vite';
9
11
  import '../EventManager-CmIoLt7r.js';
10
12
  import '../CacheManager-BkvHEOZX.js';
11
13
  import '../MailManager-DpMvYiP9.js';
12
14
  import '../LogManager-7mxnkaPM.js';
13
- import '../I18nManager-Dtgzsf5n.js';
14
- import '../BroadcastManager-AkIWUGJo.js';
15
+ import '../I18nManager-BiSoczfV.js';
16
+ import '../BroadcastManager-CGWl9rUO.js';
15
17
  import '../index-9_Jzj5jo.js';
16
18
  import '../app-key-CsBfRC_Q.js';
17
19
  import '../StorageManager-oZTHqaza.js';
18
20
  import '../HealthManager-DUyMIzsZ.js';
19
- import '../Gate-CNkBYf8m.js';
21
+ import '../Gate-CynjZCtS.js';
20
22
 
21
23
  /**
22
24
  * SQS event record from AWS Lambda.
@@ -68,7 +70,7 @@ declare function createLambdaHandler(app: Application): <L extends hono_aws_lamb
68
70
  headers?: undefined;
69
71
  multiValueHeaders: Record<string, string[]>;
70
72
  } : {
71
- headers: Record<string, string>;
73
+ headers: Record<string, string | string[]>;
72
74
  multiValueHeaders?: undefined;
73
75
  })>;
74
76
  /**
@@ -1,14 +1,9 @@
1
- // src/lambda/index.ts
2
- import { handle } from "hono/aws-lambda";
3
-
4
- // src/queue/Job.ts
5
- import { randomBytes } from "crypto";
6
- var jobRegistry = /* @__PURE__ */ new Map();
7
- function getJob(name) {
8
- return jobRegistry.get(name);
9
- }
1
+ import {
2
+ getJob
3
+ } from "../chunk-R2TCP7D7.js";
10
4
 
11
5
  // src/lambda/index.ts
6
+ import { handle } from "hono/aws-lambda";
12
7
  function createLambdaHandler(app) {
13
8
  return handle(app.hono);
14
9
  }
@@ -1,548 +1,15 @@
1
- // src/logging/types.ts
2
- var LOG_LEVEL_PRIORITY = {
3
- emergency: 0,
4
- alert: 1,
5
- critical: 2,
6
- error: 3,
7
- warning: 4,
8
- notice: 5,
9
- info: 6,
10
- debug: 7
11
- };
12
-
13
- // src/logging/Logger.ts
14
- var DEFAULT_FILTER_KEYS = [
15
- "password",
16
- "password_confirmation",
17
- "token",
18
- "secret",
19
- "credit_card",
20
- "creditCard",
21
- "card_number",
22
- "cardNumber",
23
- "cvv",
24
- "ssn",
25
- "authorization"
26
- ];
27
- function filterSensitiveData(data, filterKeys, replacement = "[FILTERED]") {
28
- if (filterKeys.length === 0) return data;
29
- const keySet = new Set(filterKeys.map((k) => k.toLowerCase()));
30
- return filterObject(data, keySet, replacement);
31
- }
32
- function filterObject(obj, keySet, replacement) {
33
- const result = {};
34
- for (const [key, value] of Object.entries(obj)) {
35
- if (keySet.has(key.toLowerCase())) {
36
- result[key] = replacement;
37
- } else if (value !== null && typeof value === "object" && !Array.isArray(value)) {
38
- result[key] = filterObject(value, keySet, replacement);
39
- } else if (Array.isArray(value)) {
40
- result[key] = value.map(
41
- (item) => item !== null && typeof item === "object" && !Array.isArray(item) ? filterObject(item, keySet, replacement) : item
42
- );
43
- } else {
44
- result[key] = value;
45
- }
46
- }
47
- return result;
48
- }
49
- var Logger = class _Logger {
50
- channels;
51
- baseContext;
52
- filterKeys;
53
- replacement;
54
- constructor(channels, context = {}, options = {}) {
55
- this.channels = channels;
56
- this.baseContext = context;
57
- this.filterKeys = options.filterKeys ?? DEFAULT_FILTER_KEYS;
58
- this.replacement = options.replacement ?? "[FILTERED]";
59
- }
60
- /**
61
- * Log at emergency level (system is unusable).
62
- */
63
- emergency(message, context = {}) {
64
- this.log("emergency", message, context);
65
- }
66
- /**
67
- * Log at alert level (action must be taken immediately).
68
- */
69
- alert(message, context = {}) {
70
- this.log("alert", message, context);
71
- }
72
- /**
73
- * Log at critical level (critical conditions).
74
- */
75
- critical(message, context = {}) {
76
- this.log("critical", message, context);
77
- }
78
- /**
79
- * Log at error level (error conditions).
80
- */
81
- error(message, context = {}) {
82
- this.log("error", message, context);
83
- }
84
- /**
85
- * Log at warning level (warning conditions).
86
- */
87
- warning(message, context = {}) {
88
- this.log("warning", message, context);
89
- }
90
- /**
91
- * Alias for warning().
92
- */
93
- warn(message, context = {}) {
94
- this.warning(message, context);
95
- }
96
- /**
97
- * Log at notice level (normal but significant conditions).
98
- */
99
- notice(message, context = {}) {
100
- this.log("notice", message, context);
101
- }
102
- /**
103
- * Log at info level (informational messages).
104
- */
105
- info(message, context = {}) {
106
- this.log("info", message, context);
107
- }
108
- /**
109
- * Log at debug level (debug-level messages).
110
- */
111
- debug(message, context = {}) {
112
- this.log("debug", message, context);
113
- }
114
- /**
115
- * Log a message at the specified level.
116
- */
117
- log(level, message, context = {}) {
118
- const merged = { ...this.baseContext, ...context };
119
- const filtered = this.filterKeys.length > 0 ? filterSensitiveData(merged, this.filterKeys, this.replacement) : merged;
120
- const entry = {
121
- level,
122
- message,
123
- context: filtered,
124
- timestamp: /* @__PURE__ */ new Date()
125
- };
126
- for (const channel of this.channels) {
127
- try {
128
- channel.log(entry);
129
- } catch (error) {
130
- console.error("Logging error:", error);
131
- }
132
- }
133
- }
134
- /**
135
- * Create a new logger with additional context.
136
- */
137
- withContext(context) {
138
- return new _Logger(this.channels, { ...this.baseContext, ...context }, {
139
- filterKeys: this.filterKeys,
140
- replacement: this.replacement
141
- });
142
- }
143
- /**
144
- * Create a child logger with additional context (alias for withContext).
145
- */
146
- child(context) {
147
- return this.withContext(context);
148
- }
149
- /**
150
- * Close all channels.
151
- */
152
- async close() {
153
- for (const channel of this.channels) {
154
- if (channel.close) {
155
- await channel.close();
156
- }
157
- }
158
- }
159
- };
160
-
161
- // src/logging/channels/ConsoleChannel.ts
162
- var LEVEL_COLORS = {
163
- emergency: "\x1B[41m\x1B[37m",
164
- // White on red background
165
- alert: "\x1B[41m\x1B[37m",
166
- // White on red background
167
- critical: "\x1B[31m",
168
- // Red
169
- error: "\x1B[31m",
170
- // Red
171
- warning: "\x1B[33m",
172
- // Yellow
173
- notice: "\x1B[36m",
174
- // Cyan
175
- info: "\x1B[32m",
176
- // Green
177
- debug: "\x1B[90m"
178
- // Gray
179
- };
180
- var RESET = "\x1B[0m";
181
- var ConsoleChannel = class {
182
- config;
183
- minLevel;
184
- constructor(config) {
185
- this.config = {
186
- colors: true,
187
- timestamps: true,
188
- format: "text",
189
- ...config
190
- };
191
- this.minLevel = LOG_LEVEL_PRIORITY[this.config.level ?? "debug"];
192
- }
193
- log(entry) {
194
- const entryLevel = LOG_LEVEL_PRIORITY[entry.level];
195
- if (entryLevel > this.minLevel) {
196
- return;
197
- }
198
- const output = this.format(entry);
199
- if (entryLevel <= LOG_LEVEL_PRIORITY.error) {
200
- console.error(output);
201
- } else if (entryLevel <= LOG_LEVEL_PRIORITY.warning) {
202
- console.warn(output);
203
- } else if (entryLevel <= LOG_LEVEL_PRIORITY.info) {
204
- console.info(output);
205
- } else {
206
- console.log(output);
207
- }
208
- }
209
- format(entry) {
210
- if (this.config.format === "json") {
211
- return JSON.stringify({
212
- timestamp: entry.timestamp.toISOString(),
213
- level: entry.level,
214
- message: entry.message,
215
- ...entry.context
216
- });
217
- }
218
- const parts = [];
219
- if (this.config.timestamps) {
220
- const time = entry.timestamp.toISOString();
221
- parts.push(this.config.colors ? `\x1B[90m[${time}]\x1B[0m` : `[${time}]`);
222
- }
223
- const levelStr = entry.level.toUpperCase().padEnd(9);
224
- if (this.config.colors) {
225
- parts.push(`${LEVEL_COLORS[entry.level]}${levelStr}${RESET}`);
226
- } else {
227
- parts.push(levelStr);
228
- }
229
- parts.push(entry.message);
230
- if (Object.keys(entry.context).length > 0) {
231
- const contextStr = JSON.stringify(entry.context);
232
- if (this.config.colors) {
233
- parts.push(`\x1B[90m${contextStr}${RESET}`);
234
- } else {
235
- parts.push(contextStr);
236
- }
237
- }
238
- return parts.join(" ");
239
- }
240
- };
241
-
242
- // src/logging/channels/FileChannel.ts
243
- import * as fs from "fs";
244
- import * as path from "path";
245
- var FileChannel = class {
246
- config;
247
- minLevel;
248
- initialized = false;
249
- constructor(config) {
250
- this.config = {
251
- format: "text",
252
- ...config
253
- };
254
- this.minLevel = LOG_LEVEL_PRIORITY[this.config.level ?? "debug"];
255
- }
256
- log(entry) {
257
- const entryLevel = LOG_LEVEL_PRIORITY[entry.level];
258
- if (entryLevel > this.minLevel) {
259
- return;
260
- }
261
- const line = this.format(entry) + "\n";
262
- this.write(line);
263
- }
264
- write(data) {
265
- if (!this.initialized) {
266
- this.ensureDirectory();
267
- this.initialized = true;
268
- }
269
- fs.appendFileSync(this.config.path, data);
270
- }
271
- ensureDirectory() {
272
- const dir = path.dirname(this.config.path);
273
- if (!fs.existsSync(dir)) {
274
- fs.mkdirSync(dir, { recursive: true });
275
- }
276
- }
277
- format(entry) {
278
- if (this.config.format === "json") {
279
- return JSON.stringify({
280
- timestamp: entry.timestamp.toISOString(),
281
- level: entry.level,
282
- message: entry.message,
283
- ...entry.context
284
- });
285
- }
286
- const timestamp = entry.timestamp.toISOString();
287
- const level = entry.level.toUpperCase().padEnd(9);
288
- const context = Object.keys(entry.context).length > 0 ? " " + JSON.stringify(entry.context) : "";
289
- return `[${timestamp}] ${level} ${entry.message}${context}`;
290
- }
291
- close() {
292
- }
293
- };
294
-
295
- // src/logging/channels/DailyFileChannel.ts
296
- import * as fs2 from "fs";
297
- import * as path2 from "path";
298
- var DailyFileChannel = class {
299
- config;
300
- minLevel;
301
- currentDate = null;
302
- currentFilePath = null;
303
- constructor(config) {
304
- this.config = {
305
- days: 14,
306
- format: "text",
307
- ...config
308
- };
309
- this.minLevel = LOG_LEVEL_PRIORITY[this.config.level ?? "debug"];
310
- }
311
- log(entry) {
312
- const entryLevel = LOG_LEVEL_PRIORITY[entry.level];
313
- if (entryLevel > this.minLevel) {
314
- return;
315
- }
316
- const dateStr = this.getDateString(entry.timestamp);
317
- if (this.currentDate !== dateStr) {
318
- this.rotate(dateStr);
319
- }
320
- const line = this.format(entry) + "\n";
321
- this.write(line);
322
- }
323
- write(data) {
324
- if (this.currentFilePath) {
325
- fs2.appendFileSync(this.currentFilePath, data);
326
- }
327
- }
328
- rotate(dateStr) {
329
- this.currentDate = dateStr;
330
- this.currentFilePath = this.getFilePath(dateStr);
331
- this.ensureDirectory(this.currentFilePath);
332
- this.cleanup();
333
- }
334
- getFilePath(dateStr) {
335
- const { dir, name, ext } = path2.parse(this.config.path);
336
- return path2.join(dir, `${name}-${dateStr}${ext}`);
337
- }
338
- getDateString(date) {
339
- return date.toISOString().split("T")[0];
340
- }
341
- ensureDirectory(filePath) {
342
- const dir = path2.dirname(filePath);
343
- if (!fs2.existsSync(dir)) {
344
- fs2.mkdirSync(dir, { recursive: true });
345
- }
346
- }
347
- cleanup() {
348
- const { dir, name, ext } = path2.parse(this.config.path);
349
- if (!fs2.existsSync(dir)) {
350
- return;
351
- }
352
- const files = fs2.readdirSync(dir);
353
- const pattern = new RegExp(`^${name}-(\\d{4}-\\d{2}-\\d{2})${ext.replace(".", "\\.")}$`);
354
- const cutoff = /* @__PURE__ */ new Date();
355
- cutoff.setDate(cutoff.getDate() - (this.config.days ?? 14));
356
- for (const file of files) {
357
- const match = file.match(pattern);
358
- if (match) {
359
- const fileDate = new Date(match[1]);
360
- if (fileDate < cutoff) {
361
- fs2.unlinkSync(path2.join(dir, file));
362
- }
363
- }
364
- }
365
- }
366
- format(entry) {
367
- if (this.config.format === "json") {
368
- return JSON.stringify({
369
- timestamp: entry.timestamp.toISOString(),
370
- level: entry.level,
371
- message: entry.message,
372
- ...entry.context
373
- });
374
- }
375
- const timestamp = entry.timestamp.toISOString();
376
- const level = entry.level.toUpperCase().padEnd(9);
377
- const context = Object.keys(entry.context).length > 0 ? " " + JSON.stringify(entry.context) : "";
378
- return `[${timestamp}] ${level} ${entry.message}${context}`;
379
- }
380
- close() {
381
- }
382
- };
383
-
384
- // src/logging/LogManager.ts
385
- var LogManager = class {
386
- config;
387
- channelFactories = /* @__PURE__ */ new Map();
388
- channelInstances = /* @__PURE__ */ new Map();
389
- loggers = /* @__PURE__ */ new Map();
390
- loggerOptions;
391
- constructor(config) {
392
- this.config = config;
393
- this.loggerOptions = {
394
- filterKeys: config.filterKeys,
395
- replacement: config.filterReplacement
396
- };
397
- this.registerDefaultDrivers();
398
- }
399
- registerDefaultDrivers() {
400
- this.registerDriver("console", (config) => {
401
- return new ConsoleChannel(config);
402
- });
403
- this.registerDriver("file", (config) => {
404
- return new FileChannel(config);
405
- });
406
- this.registerDriver("daily", (config) => {
407
- return new DailyFileChannel(config);
408
- });
409
- this.registerDriver("stack", (config) => {
410
- return this.createStackChannel(config);
411
- });
412
- }
413
- createStackChannel(config) {
414
- const channels = config.channels.map((name) => this.resolveChannel(name));
415
- return {
416
- log: (entry) => {
417
- for (const channel of channels) {
418
- channel.log(entry);
419
- }
420
- },
421
- close: async () => {
422
- for (const channel of channels) {
423
- if (channel.close) {
424
- await channel.close();
425
- }
426
- }
427
- }
428
- };
429
- }
430
- /**
431
- * Register a custom channel driver.
432
- */
433
- registerDriver(name, factory) {
434
- this.channelFactories.set(name, factory);
435
- }
436
- /**
437
- * Get a logger for a specific channel.
438
- */
439
- channel(name) {
440
- const channelName = name ?? this.config.default;
441
- if (!this.loggers.has(channelName)) {
442
- const channel = this.resolveChannel(channelName);
443
- this.loggers.set(channelName, new Logger([channel], {}, this.loggerOptions));
444
- }
445
- return this.loggers.get(channelName);
446
- }
447
- /**
448
- * Get a logger that writes to multiple channels.
449
- */
450
- stack(channelNames) {
451
- const key = `stack:${channelNames.join(",")}`;
452
- if (!this.loggers.has(key)) {
453
- const channels = channelNames.map((name) => this.resolveChannel(name));
454
- this.loggers.set(key, new Logger(channels, {}, this.loggerOptions));
455
- }
456
- return this.loggers.get(key);
457
- }
458
- resolveChannel(name) {
459
- if (this.channelInstances.has(name)) {
460
- return this.channelInstances.get(name);
461
- }
462
- const config = this.config.channels[name];
463
- if (!config) {
464
- throw new Error(`Log channel [${name}] is not defined`);
465
- }
466
- const factory = this.channelFactories.get(config.driver);
467
- if (!factory) {
468
- throw new Error(`Log driver [${config.driver}] is not supported`);
469
- }
470
- const channel = factory(config);
471
- this.channelInstances.set(name, channel);
472
- return channel;
473
- }
474
- /**
475
- * Create a logger with additional context using the default channel.
476
- */
477
- withContext(context) {
478
- return this.channel().withContext(context);
479
- }
480
- // Convenience methods that delegate to default channel
481
- emergency(message, context) {
482
- this.channel().emergency(message, context);
483
- }
484
- alert(message, context) {
485
- this.channel().alert(message, context);
486
- }
487
- critical(message, context) {
488
- this.channel().critical(message, context);
489
- }
490
- error(message, context) {
491
- this.channel().error(message, context);
492
- }
493
- warning(message, context) {
494
- this.channel().warning(message, context);
495
- }
496
- warn(message, context) {
497
- this.channel().warn(message, context);
498
- }
499
- notice(message, context) {
500
- this.channel().notice(message, context);
501
- }
502
- info(message, context) {
503
- this.channel().info(message, context);
504
- }
505
- debug(message, context) {
506
- this.channel().debug(message, context);
507
- }
508
- /**
509
- * Close all channel instances.
510
- */
511
- async close() {
512
- for (const channel of this.channelInstances.values()) {
513
- if (channel.close) {
514
- await channel.close();
515
- }
516
- }
517
- this.channelInstances.clear();
518
- this.loggers.clear();
519
- }
520
- /**
521
- * Get the default channel name.
522
- */
523
- getDefaultChannel() {
524
- return this.config.default;
525
- }
526
- /**
527
- * Get available channel names.
528
- */
529
- getChannelNames() {
530
- return Object.keys(this.config.channels);
531
- }
532
- };
533
- function createLogManager(config) {
534
- return new LogManager(config);
535
- }
536
- var globalLogManager = null;
537
- function setLogManager(manager) {
538
- globalLogManager = manager;
539
- }
540
- function getLogManager() {
541
- if (!globalLogManager) {
542
- throw new Error("Log manager has not been initialized. Call setLogManager() first.");
543
- }
544
- return globalLogManager;
545
- }
1
+ import {
2
+ ConsoleChannel,
3
+ DailyFileChannel,
4
+ FileChannel,
5
+ LOG_LEVEL_PRIORITY,
6
+ LogManager,
7
+ Logger,
8
+ createLogManager,
9
+ filterSensitiveData,
10
+ getLogManager,
11
+ setLogManager
12
+ } from "../chunk-IOTWFHZU.js";
546
13
  export {
547
14
  ConsoleChannel,
548
15
  DailyFileChannel,
@@ -157,6 +157,25 @@ declare class MemoryTransport implements MailTransport {
157
157
  assertSentCount(count: number): void;
158
158
  }
159
159
 
160
+ interface LogTransportOptions {
161
+ /**
162
+ * Log function to write to.
163
+ * @default console.log
164
+ */
165
+ logger?: (message: string) => void;
166
+ }
167
+ /**
168
+ * Log mail transport: writes each email to the log instead of sending it.
169
+ * This is the development default (`MAIL_MAILER=log`) — every send succeeds
170
+ * and the full message is visible in the server output.
171
+ */
172
+ declare class LogTransport implements MailTransport {
173
+ readonly name = "log";
174
+ private readonly logger;
175
+ constructor(options?: LogTransportOptions);
176
+ send(message: MailMessage): Promise<SendResult>;
177
+ }
178
+
160
179
  /**
161
180
  * Fluent mail builder for composing and sending emails.
162
181
  *
@@ -244,6 +263,7 @@ declare class Mail {
244
263
  attach(attachment: MailAttachment): this;
245
264
  /**
246
265
  * Add a custom header.
266
+ * Rejects CR/LF characters to prevent SMTP header injection.
247
267
  */
248
268
  header(key: string, value: string): this;
249
269
  /**
@@ -253,6 +273,14 @@ declare class Mail {
253
273
  /**
254
274
  * Build the final message.
255
275
  */
276
+ /**
277
+ * Mailable subclasses define their content in build() (subject, body, ...).
278
+ * It runs automatically before sending, so `new WelcomeMail(manager).to(x).send()`
279
+ * works without a manual build() call.
280
+ */
281
+ protected build?(): this;
282
+ private hasRunBuild;
283
+ private runBuildOnce;
256
284
  buildMessage(): MailMessage;
257
285
  /**
258
286
  * Send the email immediately.
@@ -285,4 +313,4 @@ declare function getMailManager(): MailManager | null;
285
313
  */
286
314
  declare function mail(manager: MailManager): Mail;
287
315
 
288
- export { Mail, MailAddress, MailAttachment, MailManager, MailMessage, MailTransport, MemoryTransport, MemoryTransportOptions, ResendTransport, ResendTransportOptions, SendResult, SmtpTransport, SmtpTransportOptions, getMailManager, mail, setMailManager };
316
+ export { LogTransport, type LogTransportOptions, Mail, MailAddress, MailAttachment, MailManager, MailMessage, MailTransport, MemoryTransport, MemoryTransportOptions, ResendTransport, ResendTransportOptions, SendResult, SmtpTransport, SmtpTransportOptions, getMailManager, mail, setMailManager };