@guren/server 2.15.0 → 2.16.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 (296) hide show
  1. package/dist/{DocsViewerServiceProvider-qFCaeiUv.js → DocsViewerServiceProvider-D2cuVgtN.js} +7 -12
  2. package/dist/{Hash-C8aejmi8.js → Hash-D2DFd8xX.js} +7 -57
  3. package/dist/{HttpException-BkS3euNG.js → HttpException-BlQ2yEmT.js} +2 -79
  4. package/dist/{Job-BVT813DO.js → Job-DxQK8h3P.js} +24 -179
  5. package/dist/{McpServiceProvider-BawsYjgN.js → McpServiceProvider-nNcbCIQX.js} +11 -20
  6. package/dist/{Random-DbIJ22KQ.js → Random-S0OvCuR8.js} +9 -106
  7. package/dist/agent/AgentApprovalRequested.d.ts +11 -39
  8. package/dist/agent/approval.d.ts +76 -187
  9. package/dist/agent/audit-emitter.d.ts +16 -44
  10. package/dist/agent/audit.d.ts +20 -56
  11. package/dist/agent/derive.d.ts +32 -66
  12. package/dist/agent/dispatch.d.ts +38 -90
  13. package/dist/agent/events.d.ts +11 -19
  14. package/dist/agent/meta-tools.d.ts +18 -46
  15. package/dist/agent/public.d.ts +6 -25
  16. package/dist/agent/public.js +1 -1
  17. package/dist/agent/redact.d.ts +16 -38
  18. package/dist/agent/scopes.d.ts +23 -69
  19. package/dist/auth/AuthManager.d.ts +19 -40
  20. package/dist/auth/AuthenticatableModel.d.ts +2 -2
  21. package/dist/auth/SessionGuard.d.ts +0 -1
  22. package/dist/auth/TokenGuard.d.ts +6 -26
  23. package/dist/auth/api-token.d.ts +16 -148
  24. package/dist/auth/context.d.ts +5 -10
  25. package/dist/auth/email-verification.d.ts +29 -127
  26. package/dist/auth/index.js +1 -1
  27. package/dist/auth/oauth/index.d.ts +35 -57
  28. package/dist/auth/password/DefaultHasher.d.ts +5 -14
  29. package/dist/auth/password/PasswordHasher.d.ts +5 -13
  30. package/dist/auth/password/hash-format.d.ts +5 -13
  31. package/dist/auth/password-reset.d.ts +16 -42
  32. package/dist/auth/providers/ModelUserProvider.d.ts +3 -4
  33. package/dist/auth/providers/UserProvider.d.ts +4 -4
  34. package/dist/auth/signed-token.d.ts +18 -0
  35. package/dist/auth/types.d.ts +9 -32
  36. package/dist/auth/utils.d.ts +6 -27
  37. package/dist/{auth-DkYoAPVn.js → auth-CbdPH4Cd.js} +169 -502
  38. package/dist/authorization/Gate.d.ts +9 -145
  39. package/dist/authorization/Policy.d.ts +6 -53
  40. package/dist/authorization/index.js +1 -1
  41. package/dist/authorization/middleware.d.ts +16 -62
  42. package/dist/authorization/types.d.ts +8 -64
  43. package/dist/{authorization-CdfbCj8J.js → authorization-CdEWZZw3.js} +44 -309
  44. package/dist/broadcasting/BroadcastManager.d.ts +29 -149
  45. package/dist/broadcasting/channels/Channel.d.ts +1 -19
  46. package/dist/broadcasting/channels/PresenceChannel.d.ts +1 -55
  47. package/dist/broadcasting/channels/PrivateChannel.d.ts +1 -23
  48. package/dist/broadcasting/drivers/MemoryDriver.d.ts +18 -70
  49. package/dist/broadcasting/drivers/RedisDriver.d.ts +3 -80
  50. package/dist/broadcasting/drivers/index.d.ts +1 -1
  51. package/dist/broadcasting/index.d.ts +1 -1
  52. package/dist/broadcasting/index.js +1 -1
  53. package/dist/broadcasting/types.d.ts +7 -88
  54. package/dist/{broadcasting-BwodCA4q.js → broadcasting-B5RzB0A2.js} +87 -414
  55. package/dist/cache/CacheManager.d.ts +8 -62
  56. package/dist/cache/TaggedCache.d.ts +2 -35
  57. package/dist/cache/index.js +1 -1
  58. package/dist/cache/stores/FileStore.d.ts +2 -36
  59. package/dist/cache/stores/MemoryStore.d.ts +2 -26
  60. package/dist/cache/stores/RedisStore.d.ts +1 -29
  61. package/dist/cache/types.d.ts +21 -128
  62. package/dist/{cache-BYnZf2FR.js → cache-BOOIr324.js} +19 -198
  63. package/dist/client-C4TEr_Dd.js +9 -0
  64. package/dist/console/Command.d.ts +17 -126
  65. package/dist/console/ConsoleKernel.d.ts +2 -74
  66. package/dist/console/Input.d.ts +5 -113
  67. package/dist/console/Output.d.ts +3 -99
  68. package/dist/console/types.d.ts +3 -33
  69. package/dist/container/Container.d.ts +12 -103
  70. package/dist/container/ServiceProvider.d.ts +17 -61
  71. package/dist/container/bindings.d.ts +5 -26
  72. package/dist/container/defineModule.d.ts +16 -54
  73. package/dist/container/definePlugin.d.ts +12 -45
  74. package/dist/container/types.d.ts +2 -34
  75. package/dist/context-CXk_umpT.js +21 -0
  76. package/dist/database/Factory.d.ts +4 -57
  77. package/dist/database/Seeder.d.ts +8 -46
  78. package/dist/database/SeederRunner.d.ts +3 -33
  79. package/dist/database/types.d.ts +3 -24
  80. package/dist/discovery/AutoDiscovery.d.ts +10 -82
  81. package/dist/{dispatch-erOS9epZ.js → dispatch-BAwzftws.js} +32 -79
  82. package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +2 -5
  83. package/dist/docs-viewer/endpoint.d.ts +5 -11
  84. package/dist/encryption/Encrypter.d.ts +5 -71
  85. package/dist/encryption/Hash.d.ts +7 -57
  86. package/dist/encryption/Random.d.ts +6 -99
  87. package/dist/encryption/index.js +3 -3
  88. package/dist/encryption/types.d.ts +10 -72
  89. package/dist/{encryption-D99Vmls3.js → encryption-uwP3Di4D.js} +9 -78
  90. package/dist/{endpoint-D6GIqOpe.js → endpoint-BXipU2Jj.js} +6 -12
  91. package/dist/endpoint-Dsw3Acvq.js +26 -0
  92. package/dist/errors/ExceptionHandler.d.ts +3 -90
  93. package/dist/errors/HttpException.d.ts +2 -79
  94. package/dist/errors/debug-page.d.ts +3 -17
  95. package/dist/errors/error-page.d.ts +1 -0
  96. package/dist/errors/exceptions/AuthenticationException.d.ts +2 -24
  97. package/dist/errors/exceptions/AuthorizationException.d.ts +1 -24
  98. package/dist/errors/exceptions/MethodNotAllowedException.d.ts +1 -23
  99. package/dist/errors/exceptions/NotFoundHttpException.d.ts +1 -27
  100. package/dist/errors/exceptions/ValidationException.d.ts +2 -43
  101. package/dist/errors/types.d.ts +1 -25
  102. package/dist/{errors-BgeOl_DC.js → errors-JpkcCjjn.js} +3 -41
  103. package/dist/events/Event.d.ts +1 -28
  104. package/dist/events/EventManager.d.ts +5 -107
  105. package/dist/events/Listener.d.ts +7 -55
  106. package/dist/events/builtin.d.ts +0 -24
  107. package/dist/events/index.js +1 -1
  108. package/dist/events/types.d.ts +4 -22
  109. package/dist/{events-aIH_bWRx.js → events-DOmAHDeP.js} +11 -191
  110. package/dist/facades/index.d.ts +2 -14
  111. package/dist/health/HealthCheck.d.ts +0 -24
  112. package/dist/health/HealthManager.d.ts +0 -36
  113. package/dist/health/checks/CacheCheck.d.ts +2 -17
  114. package/dist/health/checks/CustomCheck.d.ts +0 -9
  115. package/dist/health/checks/DatabaseCheck.d.ts +2 -17
  116. package/dist/health/checks/MemoryCheck.d.ts +3 -12
  117. package/dist/health/checks/RedisCheck.d.ts +1 -13
  118. package/dist/health/checks/StorageCheck.d.ts +2 -17
  119. package/dist/health/index.js +1 -1
  120. package/dist/health/types.d.ts +4 -24
  121. package/dist/{health-VWdWXRwh.js → health-DQSvUplL.js} +1 -76
  122. package/dist/hot-disposables-B5BXqaIH.js +167 -0
  123. package/dist/hot-reload/hot-disposables.d.ts +22 -74
  124. package/dist/hot-reload/testing.d.ts +4 -9
  125. package/dist/http/Application.d.ts +62 -208
  126. package/dist/http/FormRequest.d.ts +4 -55
  127. package/dist/http/dev-assets.d.ts +13 -31
  128. package/dist/http/dev-banner.d.ts +2 -5
  129. package/dist/http/inertia-assets.d.ts +3 -6
  130. package/dist/http/middleware/capabilities.d.ts +27 -50
  131. package/dist/http/middleware/cors.d.ts +4 -29
  132. package/dist/http/middleware/csp.d.ts +2 -25
  133. package/dist/http/middleware/csrf.d.ts +20 -95
  134. package/dist/http/middleware/detect-locale.d.ts +7 -27
  135. package/dist/http/middleware/force-https.d.ts +6 -24
  136. package/dist/http/middleware/host-authorization.d.ts +2 -12
  137. package/dist/http/middleware/loopback-guard.d.ts +15 -33
  138. package/dist/http/middleware/rate-limit.d.ts +29 -126
  139. package/dist/http/middleware/redirect-safety.d.ts +2 -20
  140. package/dist/http/middleware/request-id.d.ts +1 -14
  141. package/dist/http/middleware/request-logging.d.ts +2 -13
  142. package/dist/http/middleware/response-headers.d.ts +5 -13
  143. package/dist/http/middleware/security-headers.d.ts +2 -16
  144. package/dist/http/middleware/session.d.ts +15 -34
  145. package/dist/http/middleware/validation-errors-cookie.d.ts +7 -18
  146. package/dist/http/middleware/validation.d.ts +8 -63
  147. package/dist/http/public-assets.d.ts +11 -7
  148. package/dist/http/request.d.ts +32 -118
  149. package/dist/http/resources/CursorPaginator.d.ts +5 -64
  150. package/dist/http/resources/Paginator.d.ts +7 -84
  151. package/dist/http/resources/Resource.d.ts +9 -65
  152. package/dist/http/resources/ResourceCollection.d.ts +5 -39
  153. package/dist/http/resources/types.d.ts +10 -30
  154. package/dist/http/static-documents.d.ts +10 -20
  155. package/dist/http/validation/Validator.d.ts +25 -85
  156. package/dist/http/validation/rules.d.ts +48 -147
  157. package/dist/http/validation/types.d.ts +16 -61
  158. package/dist/http/vite-assets.d.ts +5 -28
  159. package/dist/http/vite-dev-server.d.ts +6 -9
  160. package/dist/http/vite-manifest.d.ts +19 -33
  161. package/dist/i18n/I18nManager.d.ts +12 -78
  162. package/dist/i18n/Translator.d.ts +3 -54
  163. package/dist/i18n/index.js +1 -1
  164. package/dist/i18n/loaders/JsonLoader.d.ts +4 -31
  165. package/dist/i18n/loaders/MemoryLoader.d.ts +1 -21
  166. package/dist/i18n/pluralization.d.ts +4 -13
  167. package/dist/i18n/types.d.ts +17 -69
  168. package/dist/{i18n-mcWi7LCd.js → i18n-Cg1aajRP.js} +31 -225
  169. package/dist/index.d.ts +2 -1
  170. package/dist/index.js +714 -3011
  171. package/dist/internal/agent-preflight.d.ts +9 -21
  172. package/dist/internal/request.d.ts +6 -19
  173. package/dist/internal/request.js +1 -1
  174. package/dist/internal/route-path.d.ts +9 -21
  175. package/dist/internal/route-path.js +9 -21
  176. package/dist/internal/zod-compat.d.ts +55 -122
  177. package/dist/internal/zod-compat.js +39 -70
  178. package/dist/internal/zod-json-schema.d.ts +18 -54
  179. package/dist/internal/zod-json-schema.js +46 -123
  180. package/dist/jsx-runtime.d.ts +3 -8
  181. package/dist/lambda/index.d.ts +17 -79
  182. package/dist/lambda/index.js +11 -59
  183. package/dist/logging/LogManager.d.ts +1 -51
  184. package/dist/logging/Logger.d.ts +8 -47
  185. package/dist/logging/channels/ConsoleChannel.d.ts +1 -3
  186. package/dist/logging/channels/DailyFileChannel.d.ts +1 -3
  187. package/dist/logging/channels/FileChannel.d.ts +1 -3
  188. package/dist/logging/daily-file-path.d.ts +7 -16
  189. package/dist/logging/index.js +1 -1
  190. package/dist/logging/types.d.ts +13 -45
  191. package/dist/{logging-B-kngi3q.js → logging-zOY1XCtq.js} +52 -141
  192. package/dist/{loopback-guard-D0Kc7-xc.js → loopback-guard-DT9gHF0F.js} +41 -92
  193. package/dist/mail/Mail.d.ts +10 -106
  194. package/dist/mail/MailManager.d.ts +2 -60
  195. package/dist/mail/index.js +1 -1
  196. package/dist/mail/transports/LogTransport.d.ts +1 -4
  197. package/dist/mail/transports/MemoryTransport.d.ts +1 -63
  198. package/dist/mail/transports/ResendTransport.d.ts +1 -23
  199. package/dist/mail/transports/SmtpTransport.d.ts +1 -31
  200. package/dist/mail/types.d.ts +28 -150
  201. package/dist/{mail-DfEfSQEr.js → mail-76DWy9lj.js} +31 -289
  202. package/dist/mcp/McpServiceProvider.d.ts +4 -10
  203. package/dist/mcp/create-mcp-server.d.ts +25 -57
  204. package/dist/mcp/endpoint.d.ts +12 -36
  205. package/dist/mcp/index.js +1 -1
  206. package/dist/mvc/Controller.d.ts +46 -227
  207. package/dist/mvc/Router.d.ts +50 -129
  208. package/dist/mvc/inertia/InertiaEngine.d.ts +18 -48
  209. package/dist/mvc/inertia/shared.d.ts +6 -19
  210. package/dist/mvc/mount-route.d.ts +2 -6
  211. package/dist/mvc/view.d.ts +1 -2
  212. package/dist/notifications/Notification.d.ts +8 -75
  213. package/dist/notifications/NotificationManager.d.ts +15 -88
  214. package/dist/notifications/channels/DatabaseChannel.d.ts +1 -41
  215. package/dist/notifications/channels/MailChannel.d.ts +2 -31
  216. package/dist/notifications/channels/MemoryChannel.d.ts +2 -62
  217. package/dist/notifications/channels/SlackChannel.d.ts +3 -48
  218. package/dist/notifications/index.js +1 -1
  219. package/dist/notifications/notifiable-type.d.ts +3 -6
  220. package/dist/notifications/registry.d.ts +8 -27
  221. package/dist/notifications/types.d.ts +16 -53
  222. package/dist/{notifications-BGqmUNZ8.js → notifications-okWFs9ly.js} +37 -335
  223. package/dist/providers/AuthServiceProvider.d.ts +1 -3
  224. package/dist/providers/AuthorizationServiceProvider.d.ts +2 -3
  225. package/dist/providers/BroadcastServiceProvider.d.ts +1 -3
  226. package/dist/providers/CacheServiceProvider.d.ts +1 -3
  227. package/dist/providers/EncryptionServiceProvider.d.ts +1 -3
  228. package/dist/providers/ErrorServiceProvider.d.ts +1 -4
  229. package/dist/providers/EventServiceProvider.d.ts +1 -3
  230. package/dist/providers/HealthServiceProvider.d.ts +1 -3
  231. package/dist/providers/I18nServiceProvider.d.ts +6 -10
  232. package/dist/providers/InertiaServiceProvider.d.ts +1 -4
  233. package/dist/providers/LogServiceProvider.d.ts +1 -3
  234. package/dist/providers/MailServiceProvider.d.ts +1 -3
  235. package/dist/providers/NotificationServiceProvider.d.ts +1 -3
  236. package/dist/providers/OAuthServiceProvider.d.ts +1 -3
  237. package/dist/providers/QueueServiceProvider.d.ts +1 -3
  238. package/dist/providers/SchedulingServiceProvider.d.ts +1 -3
  239. package/dist/providers/StorageServiceProvider.d.ts +1 -3
  240. package/dist/queue/FailedJobReporter.d.ts +1 -24
  241. package/dist/queue/Job.d.ts +12 -99
  242. package/dist/queue/QueueManager.d.ts +6 -57
  243. package/dist/queue/Worker.d.ts +4 -65
  244. package/dist/queue/drivers/MemoryDriver.d.ts +3 -44
  245. package/dist/queue/drivers/RedisDriver.d.ts +7 -65
  246. package/dist/queue/drivers/SqsDriver.d.ts +6 -57
  247. package/dist/queue/drivers/SyncDriver.d.ts +10 -13
  248. package/dist/queue/index.js +2 -2
  249. package/dist/queue/types.d.ts +10 -92
  250. package/dist/{queue-CXrRK85G.js → queue-CcXCjuJI.js} +32 -260
  251. package/dist/redis/RedisApiTokenStore.d.ts +4 -56
  252. package/dist/redis/RedisEmailVerificationStore.d.ts +4 -37
  253. package/dist/redis/RedisOAuthStateStore.d.ts +2 -10
  254. package/dist/redis/RedisPasswordResetStore.d.ts +4 -37
  255. package/dist/redis/RedisRateLimitStore.d.ts +16 -49
  256. package/dist/redis/RedisSessionStore.d.ts +3 -44
  257. package/dist/redis/client.d.ts +2 -32
  258. package/dist/redis/index.js +47 -232
  259. package/dist/redis/redis-values.d.ts +6 -12
  260. package/dist/redis/scan-keys.d.ts +1 -4
  261. package/dist/request-CLOYytGP.js +68 -0
  262. package/dist/runtime/index.d.ts +2 -0
  263. package/dist/runtime/index.js +50 -92
  264. package/dist/scheduling/CronParser.d.ts +0 -29
  265. package/dist/scheduling/Schedule.d.ts +1 -153
  266. package/dist/scheduling/ScheduledTask.d.ts +0 -31
  267. package/dist/scheduling/Scheduler.d.ts +0 -70
  268. package/dist/scheduling/index.js +1 -1
  269. package/dist/scheduling/types.d.ts +4 -65
  270. package/dist/{scheduling-CPiEdtQd.js → scheduling-C6tcOtUl.js} +2 -287
  271. package/dist/storage/StorageManager.d.ts +0 -48
  272. package/dist/storage/drivers/LocalDriver.d.ts +1 -25
  273. package/dist/storage/drivers/MemoryDriver.d.ts +5 -35
  274. package/dist/storage/drivers/S3Driver.d.ts +6 -36
  275. package/dist/storage/drivers/s3-acl.d.ts +5 -10
  276. package/dist/storage/index.js +1 -1
  277. package/dist/storage/types.d.ts +27 -265
  278. package/dist/{storage-TLD9t0Q2.js → storage-BB59f07j.js} +17 -157
  279. package/dist/support/contained-path.d.ts +10 -20
  280. package/dist/support/error-polyfill.d.ts +4 -6
  281. package/dist/support/expiry.d.ts +17 -33
  282. package/dist/support/expiry.js +17 -33
  283. package/dist/support/import-map.d.ts +3 -7
  284. package/dist/support/inertia-defaults.d.ts +5 -10
  285. package/dist/support/redirect-target.d.ts +4 -6
  286. package/dist/support/stack-frames.d.ts +11 -50
  287. package/dist/support/trim-slashes.d.ts +4 -7
  288. package/dist/support/warn-once.d.ts +2 -6
  289. package/dist/{trim-slashes-ZJ_VsY5s.js → trim-slashes-BLY9hKAa.js} +4 -7
  290. package/dist/{vite-manifest-w_RSOvQW.js → vite-manifest-CTQp-SOo.js} +34 -58
  291. package/package.json +2 -2
  292. package/dist/client-Dd7vLcqp.js +0 -27
  293. package/dist/context-DoD0c7J_.js +0 -26
  294. package/dist/endpoint-D-20PiHY.js +0 -46
  295. package/dist/hot-disposables-WsTX2ySN.js +0 -281
  296. package/dist/request-CVQwpu2J.js +0 -129
@@ -1,36 +1,13 @@
1
- import { i as getQueueDriver, o as registerJob, t as Job } from "./Job-BVT813DO.js";
1
+ import { i as getQueueDriver, o as registerJob, t as Job } from "./Job-DxQK8h3P.js";
2
2
  import { t as parseMailAddress } from "./address-D0Iq-XIH.js";
3
3
  import nodemailer from "nodemailer";
4
4
  //#region src/mail/transports/SmtpTransport.ts
5
- /**
6
- * Format email address for nodemailer.
7
- */
5
+ /** Format an email address for nodemailer. */
8
6
  function formatAddress(addr) {
9
7
  if (addr.name) return `"${addr.name}" <${addr.email}>`;
10
8
  return addr.email;
11
9
  }
12
- /**
13
- * SMTP mail transport using Nodemailer.
14
- *
15
- * @example
16
- * ```ts
17
- * const transport = new SmtpTransport({
18
- * host: 'smtp.example.com',
19
- * port: 587,
20
- * auth: {
21
- * user: 'user@example.com',
22
- * pass: 'password',
23
- * },
24
- * })
25
- *
26
- * await transport.send({
27
- * from: { email: 'sender@example.com' },
28
- * to: [{ email: 'recipient@example.com' }],
29
- * subject: 'Hello',
30
- * text: 'Hello World!',
31
- * })
32
- * ```
33
- */
10
+ /** SMTP mail transport using Nodemailer. */
34
11
  var SmtpTransport = class {
35
12
  name = "smtp";
36
13
  transporter;
@@ -44,9 +21,6 @@ var SmtpTransport = class {
44
21
  maxConnections: options.maxConnections ?? 5
45
22
  });
46
23
  }
47
- /**
48
- * Send an email via SMTP.
49
- */
50
24
  async send(message) {
51
25
  try {
52
26
  const mailOptions = {
@@ -80,9 +54,6 @@ var SmtpTransport = class {
80
54
  };
81
55
  }
82
56
  }
83
- /**
84
- * Verify SMTP connection.
85
- */
86
57
  async verify() {
87
58
  try {
88
59
  await this.transporter.verify();
@@ -91,32 +62,13 @@ var SmtpTransport = class {
91
62
  return false;
92
63
  }
93
64
  }
94
- /**
95
- * Close the transport.
96
- */
97
65
  close() {
98
66
  this.transporter.close();
99
67
  }
100
68
  };
101
69
  //#endregion
102
70
  //#region src/mail/transports/ResendTransport.ts
103
- /**
104
- * Resend mail transport.
105
- *
106
- * @example
107
- * ```ts
108
- * const transport = new ResendTransport({
109
- * apiKey: process.env.RESEND_API_KEY,
110
- * })
111
- *
112
- * await transport.send({
113
- * from: { email: 'sender@example.com' },
114
- * to: [{ email: 'recipient@example.com' }],
115
- * subject: 'Hello',
116
- * html: '<p>Hello World!</p>',
117
- * })
118
- * ```
119
- */
71
+ /** Resend mail transport. */
120
72
  var ResendTransport = class {
121
73
  name = "resend";
122
74
  apiKey;
@@ -124,16 +76,10 @@ var ResendTransport = class {
124
76
  constructor(options) {
125
77
  this.apiKey = options.apiKey;
126
78
  }
127
- /**
128
- * Format email address for Resend API.
129
- */
130
79
  formatAddress(addr) {
131
80
  if (addr.name) return `${addr.name} <${addr.email}>`;
132
81
  return addr.email;
133
82
  }
134
- /**
135
- * Send an email via Resend API.
136
- */
137
83
  async send(message) {
138
84
  try {
139
85
  const payload = {
@@ -180,27 +126,7 @@ var ResendTransport = class {
180
126
  };
181
127
  //#endregion
182
128
  //#region src/mail/transports/MemoryTransport.ts
183
- /**
184
- * In-memory mail transport for testing.
185
- *
186
- * Stores all sent messages in memory for inspection.
187
- *
188
- * @example
189
- * ```ts
190
- * const transport = new MemoryTransport()
191
- *
192
- * await transport.send({
193
- * from: { email: 'sender@example.com' },
194
- * to: [{ email: 'recipient@example.com' }],
195
- * subject: 'Hello',
196
- * text: 'Hello World!',
197
- * })
198
- *
199
- * // Inspect sent messages
200
- * const messages = transport.getMessages()
201
- * console.log(messages[0].subject) // 'Hello'
202
- * ```
203
- */
129
+ /** In-memory mail transport for testing: stores every sent message for inspection. */
204
130
  var MemoryTransport = class {
205
131
  name = "memory";
206
132
  messages = [];
@@ -210,9 +136,6 @@ var MemoryTransport = class {
210
136
  this.simulateFailure = options.simulateFailure ?? false;
211
137
  this.failureMessage = options.failureMessage ?? "Simulated email failure";
212
138
  }
213
- /**
214
- * Send an email (stores in memory).
215
- */
216
139
  async send(message) {
217
140
  if (this.simulateFailure) return {
218
141
  success: false,
@@ -226,79 +149,40 @@ var MemoryTransport = class {
226
149
  response: "Message stored in memory"
227
150
  };
228
151
  }
229
- /**
230
- * Get all sent messages.
231
- */
232
152
  getMessages() {
233
153
  return [...this.messages];
234
154
  }
235
- /**
236
- * Get the last sent message.
237
- */
238
155
  getLastMessage() {
239
156
  return this.messages[this.messages.length - 1];
240
157
  }
241
- /**
242
- * Find messages by recipient email.
243
- */
244
158
  findByRecipient(email) {
245
159
  return this.messages.filter((m) => m.to.some((addr) => addr.email.toLowerCase() === email.toLowerCase()));
246
160
  }
247
- /**
248
- * Find messages by subject.
249
- */
250
161
  findBySubject(subject) {
251
162
  return this.messages.filter((m) => m.subject.toLowerCase().includes(subject.toLowerCase()));
252
163
  }
253
- /**
254
- * Check if any message was sent to a recipient.
255
- */
256
164
  hasSentTo(email) {
257
165
  return this.findByRecipient(email).length > 0;
258
166
  }
259
- /**
260
- * Check if any message was sent with a subject.
261
- */
262
167
  hasSentWithSubject(subject) {
263
168
  return this.findBySubject(subject).length > 0;
264
169
  }
265
- /**
266
- * Get the count of sent messages.
267
- */
268
170
  count() {
269
171
  return this.messages.length;
270
172
  }
271
- /**
272
- * Clear all stored messages.
273
- */
274
173
  clear() {
275
174
  this.messages = [];
276
175
  }
277
- /**
278
- * Set whether to simulate failures.
279
- */
280
176
  setSimulateFailure(simulate, message) {
281
177
  this.simulateFailure = simulate;
282
178
  if (message) this.failureMessage = message;
283
179
  }
284
- /**
285
- * Assert that a message was sent to a recipient.
286
- * Throws if no message was found.
287
- */
288
180
  assertSentTo(email) {
289
181
  if (!this.hasSentTo(email)) throw new Error(`No email was sent to ${email}`);
290
182
  }
291
- /**
292
- * Assert that a message was sent with a subject.
293
- * Throws if no message was found.
294
- */
295
183
  assertSentWithSubject(subject) {
296
184
  if (!this.hasSentWithSubject(subject)) throw new Error(`No email was sent with subject containing "${subject}"`);
297
185
  }
298
- /**
299
- * Assert that exactly n messages were sent.
300
- * Throws if count doesn't match.
301
- */
302
186
  assertSentCount(count) {
303
187
  if (this.messages.length !== count) throw new Error(`Expected ${count} emails to be sent, but got ${this.messages.length}`);
304
188
  }
@@ -337,35 +221,7 @@ var LogTransport = class {
337
221
  };
338
222
  //#endregion
339
223
  //#region src/mail/MailManager.ts
340
- /**
341
- * Mail manager for handling multiple transports.
342
- *
343
- * @example
344
- * ```ts
345
- * const mailManager = new MailManager({
346
- * default: 'smtp',
347
- * from: { email: 'noreply@example.com', name: 'MyApp' },
348
- * transports: {
349
- * smtp: {
350
- * driver: 'smtp',
351
- * host: 'smtp.example.com',
352
- * port: 587,
353
- * auth: { user: 'user', pass: 'pass' },
354
- * },
355
- * resend: {
356
- * driver: 'resend',
357
- * apiKey: 'your-api-key',
358
- * },
359
- * },
360
- * })
361
- *
362
- * // Get the default transport
363
- * const transport = mailManager.transport()
364
- *
365
- * // Get a specific transport
366
- * const resendTransport = mailManager.transport('resend')
367
- * ```
368
- */
224
+ /** Mail manager for handling multiple transports. */
369
225
  var MailManager = class {
370
226
  defaultTransportName;
371
227
  defaultFrom;
@@ -377,9 +233,6 @@ var MailManager = class {
377
233
  this.registerBuiltinDrivers();
378
234
  if (config.transports) for (const [name, transportConfig] of Object.entries(config.transports)) this.registerTransportFromConfig(name, transportConfig);
379
235
  }
380
- /**
381
- * Register built-in transport drivers.
382
- */
383
236
  registerBuiltinDrivers() {
384
237
  this.registerDriverFactory("smtp", (options) => {
385
238
  return new SmtpTransport(options);
@@ -395,25 +248,16 @@ var MailManager = class {
395
248
  });
396
249
  }
397
250
  driverFactories = /* @__PURE__ */ new Map();
398
- /**
399
- * Register a driver factory.
400
- */
401
251
  registerDriverFactory(driver, factory) {
402
252
  this.driverFactories.set(driver, factory);
403
253
  }
404
- /**
405
- * Register a transport from configuration.
406
- */
407
254
  registerTransportFromConfig(name, config) {
408
255
  const { driver, ...options } = config;
409
256
  const factory = this.driverFactories.get(driver);
410
257
  if (!factory) throw new Error(`Unknown mail driver: ${driver}`);
411
258
  this.transportFactories.set(name, () => factory(options));
412
259
  }
413
- /**
414
- * Get a mail transport by name.
415
- * Returns the default transport if no name is specified.
416
- */
260
+ /** Get a mail transport by name, or the default transport when unnamed. */
417
261
  transport(name) {
418
262
  const transportName = name ?? this.defaultTransportName;
419
263
  const cached = this.resolvedTransports.get(transportName);
@@ -424,78 +268,37 @@ var MailManager = class {
424
268
  this.resolvedTransports.set(transportName, transport);
425
269
  return transport;
426
270
  }
427
- /**
428
- * Register a custom transport.
429
- */
430
271
  registerTransport(name, factory) {
431
272
  this.transportFactories.set(name, factory);
432
273
  this.resolvedTransports.delete(name);
433
274
  }
434
- /**
435
- * Check if a transport is registered.
436
- */
437
275
  hasTransport(name) {
438
276
  return this.transportFactories.has(name);
439
277
  }
440
- /**
441
- * Get the default transport name.
442
- */
443
278
  getDefaultTransportName() {
444
279
  return this.defaultTransportName;
445
280
  }
446
- /**
447
- * Get the default from address.
448
- */
449
281
  getDefaultFrom() {
450
282
  return this.defaultFrom;
451
283
  }
452
- /**
453
- * Get all registered transport names.
454
- */
455
284
  getTransportNames() {
456
285
  return Array.from(this.transportFactories.keys());
457
286
  }
458
287
  };
459
- /**
460
- * Create a mail manager with configuration.
461
- */
462
288
  function createMailManager(config) {
463
289
  return new MailManager(config);
464
290
  }
465
291
  //#endregion
466
292
  //#region src/mail/Mail.ts
467
293
  /**
468
- * Fluent mail builder for composing and sending emails.
469
- *
470
- * @example
471
- * ```ts
472
- * import { mail, createMailManager } from '@guren/server/mail'
473
- *
474
- * const manager = createMailManager({ ... })
475
- *
476
- * // Send a simple email
477
- * await mail(manager)
478
- * .to('user@example.com')
479
- * .subject('Hello!')
480
- * .text('Hello World!')
481
- * .send()
482
- *
483
- * // Send an HTML email with template
484
- * await mail(manager)
485
- * .to('user@example.com')
486
- * .subject('Welcome!')
487
- * .html('<h1>Welcome to our app!</h1>')
488
- * .attach({ filename: 'guide.pdf', path: './guide.pdf' })
489
- * .send()
490
- *
491
- * // Queue the email for async sending
492
- * await mail(manager)
493
- * .to('user@example.com')
494
- * .subject('Report')
495
- * .html('<p>Your report is ready</p>')
496
- * .queue('emails')
497
- * ```
294
+ * The message of a thrown value, whether or not it is an `Error`: a failed
295
+ * dynamic import throws Bun's `ResolveMessage`, which is not one.
498
296
  */
297
+ function errorMessage(error) {
298
+ if (typeof error === "object" && error !== null && "message" in error) return String(error.message);
299
+ return String(error);
300
+ }
301
+ /** Fluent mail builder for composing and sending emails. */
499
302
  var Mail = class {
500
303
  manager;
501
304
  message = {
@@ -510,108 +313,73 @@ var Mail = class {
510
313
  const defaultFrom = manager.getDefaultFrom();
511
314
  if (defaultFrom) this.message.from = defaultFrom;
512
315
  }
513
- /**
514
- * Set the sender address.
515
- */
516
316
  from(address) {
517
317
  this.message.from = parseMailAddress(address);
518
318
  return this;
519
319
  }
520
- /**
521
- * Add a recipient.
522
- */
523
320
  to(address) {
524
321
  this.message.to.push(parseMailAddress(address));
525
322
  return this;
526
323
  }
527
- /**
528
- * Add multiple recipients.
529
- */
530
324
  toMany(addresses) {
531
325
  for (const addr of addresses) this.to(addr);
532
326
  return this;
533
327
  }
534
- /**
535
- * Add a CC recipient.
536
- */
537
328
  cc(address) {
538
329
  this.message.cc.push(parseMailAddress(address));
539
330
  return this;
540
331
  }
541
- /**
542
- * Add a BCC recipient.
543
- */
544
332
  bcc(address) {
545
333
  this.message.bcc.push(parseMailAddress(address));
546
334
  return this;
547
335
  }
548
- /**
549
- * Set the reply-to address.
550
- */
551
336
  replyTo(address) {
552
337
  this.message.replyTo = parseMailAddress(address);
553
338
  return this;
554
339
  }
555
- /**
556
- * Set the subject.
557
- */
558
340
  subject(subject) {
559
341
  this.message.subject = subject;
560
342
  return this;
561
343
  }
562
- /**
563
- * Set the plain text body.
564
- */
565
344
  text(content) {
566
345
  this.message.text = content;
567
346
  return this;
568
347
  }
569
- /**
570
- * Set the HTML body.
571
- */
572
348
  html(content) {
573
349
  this.message.html = content;
574
350
  return this;
575
351
  }
576
- /**
577
- * Render a React component as HTML body.
578
- * Requires @react-email/render to be installed.
579
- *
580
- * @param component - React component function
581
- * @param props - Props to pass to the component
582
- */
352
+ /** Render a React component as the HTML body; requires @react-email/render. */
583
353
  async template(component, props) {
354
+ const name = component.name || "(anonymous)";
355
+ let reactEmail;
584
356
  try {
585
- const html = await (await import(
357
+ reactEmail = await import(
586
358
  /* @vite-ignore */
587
359
  "@react-email/render"
588
- )).render(component(props));
589
- this.message.html = html;
360
+ );
590
361
  } catch (error) {
591
- throw new Error("Failed to render email template. Make sure @react-email/render is installed.");
362
+ throw new Error(`Failed to load @react-email/render for template "${name}": ${errorMessage(error)}. Make sure @react-email/render is installed.`, { cause: error });
363
+ }
364
+ try {
365
+ this.message.html = await reactEmail.render(component(props));
366
+ } catch (error) {
367
+ throw new Error(`Failed to render email template "${name}": ${errorMessage(error)}`, { cause: error });
592
368
  }
593
369
  return this;
594
370
  }
595
- /**
596
- * Add an attachment.
597
- */
598
371
  attach(attachment) {
599
372
  this.message.attachments.push(attachment);
600
373
  return this;
601
374
  }
602
- /**
603
- * Add a custom header.
604
- * Rejects CR/LF characters to prevent SMTP header injection.
605
- */
375
+ /** Add a custom header. Rejects CR/LF to prevent SMTP header injection. */
606
376
  header(key, value) {
607
377
  if (/[\r\n]/.test(key) || /[\r\n]/.test(value)) throw new Error("Mail: header names and values cannot contain newline characters.");
608
378
  if (!this.message.headers) this.message.headers = {};
609
379
  this.message.headers[key] = value;
610
380
  return this;
611
381
  }
612
- /**
613
- * Specify which transport to use.
614
- */
382
+ /** Specify which transport to use. */
615
383
  via(transport) {
616
384
  this.transportName = transport;
617
385
  return this;
@@ -629,16 +397,12 @@ var Mail = class {
629
397
  if (!this.message.text && !this.message.html) throw new Error("Email must have a text or html body");
630
398
  return this.message;
631
399
  }
632
- /**
633
- * Send the email immediately.
634
- */
400
+ /** Send the email immediately. */
635
401
  async send() {
636
402
  const message = this.buildMessage();
637
403
  return this.manager.transport(this.transportName).send(message);
638
404
  }
639
- /**
640
- * Queue the email for async sending.
641
- */
405
+ /** Queue the email for async sending. */
642
406
  async queue(queueName = "default") {
643
407
  if (!getQueueDriver()) throw new Error("Queue driver not configured. Use send() instead or configure a queue driver.");
644
408
  const message = this.buildMessage();
@@ -649,25 +413,14 @@ var Mail = class {
649
413
  }, { queue: queueName });
650
414
  }
651
415
  };
652
- /**
653
- * Global mail manager reference for the job.
654
- */
655
416
  let globalMailManager = null;
656
- /**
657
- * Set the global mail manager for queue jobs.
658
- */
417
+ /** Set the global mail manager used by queue jobs. */
659
418
  function setMailManager(manager) {
660
419
  globalMailManager = manager;
661
420
  }
662
- /**
663
- * Get the global mail manager.
664
- */
665
421
  function getMailManager() {
666
422
  return globalMailManager;
667
423
  }
668
- /**
669
- * Job for sending emails via the queue.
670
- */
671
424
  var SendMailJob = class extends Job {
672
425
  static jobName = "SendMailJob";
673
426
  static queue = "default";
@@ -680,18 +433,7 @@ var SendMailJob = class extends Job {
680
433
  if (!result.success) throw new Error(result.error ?? "Failed to send email");
681
434
  }
682
435
  };
683
- /**
684
- * Create a new mail builder.
685
- *
686
- * @example
687
- * ```ts
688
- * await mail(manager)
689
- * .to('user@example.com')
690
- * .subject('Hello')
691
- * .text('Hello World!')
692
- * .send()
693
- * ```
694
- */
436
+ /** Create a new mail builder. */
695
437
  function mail(manager) {
696
438
  return new Mail(manager);
697
439
  }
@@ -1,15 +1,9 @@
1
1
  import { ServiceProvider } from '../container/ServiceProvider.js';
2
2
  /**
3
- * Registers the MCP (Model Context Protocol) endpoint at /_guren/mcp.
4
- *
5
- * Only active while `isMcpEndpointEnabled()` holds, so registering this
6
- * provider directly honours the same `GUREN_MCP=1` opt-in that `Application`
7
- * gates on — and the same condition that exempts the endpoint from CSRF.
8
- * It allows AI coding agents (Claude Code, Cursor, etc.) to introspect
9
- * the project structure, run integrity checks, and scaffold code.
10
- *
11
- * @guren/cli is loaded via dynamic import to avoid circular dependencies
12
- * (@guren/server -> @guren/cli -> @guren/core -> @guren/server).
3
+ * Registers the MCP endpoint at /_guren/mcp, so AI coding agents can introspect
4
+ * the project, run integrity checks, and scaffold code. Only active while
5
+ * `isMcpEndpointEnabled()` holds — the same `GUREN_MCP=1` opt-in that exempts
6
+ * the endpoint from CSRF. @guren/cli is imported dynamically to break a cycle.
13
7
  */
14
8
  export declare class McpServiceProvider extends ServiceProvider {
15
9
  register(): void;