@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,23 +1,14 @@
1
1
  import type { CheckResult, HealthStatus } from '../types.js';
2
2
  import { HealthCheck } from '../HealthCheck.js';
3
- /**
4
- * Callback for custom health check.
5
- */
6
3
  export type CustomCheckCallback = () => Promise<{
7
4
  status: HealthStatus;
8
5
  message?: string;
9
6
  meta?: Record<string, unknown>;
10
7
  }>;
11
- /**
12
- * Custom health check with callback.
13
- */
14
8
  export declare class CustomCheck extends HealthCheck {
15
9
  readonly name: string;
16
10
  private callback;
17
11
  constructor(name: string, callback: CustomCheckCallback);
18
12
  check(): Promise<CheckResult>;
19
13
  }
20
- /**
21
- * Create a custom health check.
22
- */
23
14
  export declare function customCheck(name: string, callback: CustomCheckCallback): CustomCheck;
@@ -1,29 +1,14 @@
1
1
  import type { CheckResult } from '../types.js';
2
2
  import { HealthCheck } from '../HealthCheck.js';
3
- /**
4
- * Database connection interface (minimal).
5
- */
6
3
  export interface DatabaseConnection {
7
4
  query(sql: string): Promise<unknown>;
8
5
  }
9
- /**
10
- * Options for database health check.
11
- */
12
6
  export interface DatabaseCheckOptions {
13
- /**
14
- * Custom name for this check.
15
- * @default 'database'
16
- */
7
+ /** @default 'database' */
17
8
  name?: string;
18
- /**
19
- * Custom query to execute.
20
- * @default 'SELECT 1'
21
- */
9
+ /** @default 'SELECT 1' */
22
10
  query?: string;
23
11
  }
24
- /**
25
- * Health check for database connectivity.
26
- */
27
12
  export declare class DatabaseCheck extends HealthCheck {
28
13
  readonly name: string;
29
14
  private db;
@@ -1,28 +1,19 @@
1
1
  import type { CheckResult } from '../types.js';
2
2
  import { HealthCheck } from '../HealthCheck.js';
3
- /**
4
- * Options for memory health check.
5
- */
6
3
  export interface MemoryCheckOptions {
7
- /**
8
- * Custom name for this check.
9
- * @default 'memory'
10
- */
4
+ /** @default 'memory' */
11
5
  name?: string;
12
6
  /**
13
- * Memory threshold in MB. Above this is degraded.
7
+ * Heap use above this reports degraded.
14
8
  * @default 512
15
9
  */
16
10
  thresholdMb?: number;
17
11
  /**
18
- * Critical memory threshold in MB. Above this is unhealthy.
12
+ * Heap use above this reports unhealthy.
19
13
  * @default 1024
20
14
  */
21
15
  criticalThresholdMb?: number;
22
16
  }
23
- /**
24
- * Health check for memory usage.
25
- */
26
17
  export declare class MemoryCheck extends HealthCheck {
27
18
  readonly name: string;
28
19
  private thresholdMb;
@@ -1,24 +1,12 @@
1
1
  import type { CheckResult } from '../types.js';
2
2
  import { HealthCheck } from '../HealthCheck.js';
3
- /**
4
- * Redis client interface (minimal).
5
- */
6
3
  export interface RedisClient {
7
4
  ping(): Promise<string>;
8
5
  }
9
- /**
10
- * Options for Redis health check.
11
- */
12
6
  export interface RedisCheckOptions {
13
- /**
14
- * Custom name for this check.
15
- * @default 'redis'
16
- */
7
+ /** @default 'redis' */
17
8
  name?: string;
18
9
  }
19
- /**
20
- * Health check for Redis connectivity.
21
- */
22
10
  export declare class RedisCheck extends HealthCheck {
23
11
  readonly name: string;
24
12
  private redis;
@@ -1,31 +1,16 @@
1
1
  import type { CheckResult } from '../types.js';
2
2
  import { HealthCheck } from '../HealthCheck.js';
3
- /**
4
- * Storage driver interface (minimal).
5
- */
6
3
  export interface StorageDriverInterface {
7
4
  put(path: string, contents: string | Buffer): Promise<void>;
8
5
  get(path: string): Promise<Buffer | null>;
9
6
  delete(path: string): Promise<boolean>;
10
7
  }
11
- /**
12
- * Options for storage health check.
13
- */
14
8
  export interface StorageCheckOptions {
15
- /**
16
- * Custom name for this check.
17
- * @default 'storage'
18
- */
9
+ /** @default 'storage' */
19
10
  name?: string;
20
- /**
21
- * Test file path.
22
- * @default '__health_check__.txt'
23
- */
11
+ /** @default '__health_check__.txt' */
24
12
  testPath?: string;
25
13
  }
26
- /**
27
- * Health check for storage functionality.
28
- */
29
14
  export declare class StorageCheck extends HealthCheck {
30
15
  readonly name: string;
31
16
  private storage;
@@ -1,2 +1,2 @@
1
- import { a as CacheCheck, c as HealthManager, i as StorageCheck, l as createHealthManager, n as customCheck, o as RedisCheck, r as MemoryCheck, s as DatabaseCheck, t as CustomCheck, u as HealthCheck } from "../health-VWdWXRwh.js";
1
+ import { a as CacheCheck, c as HealthManager, i as StorageCheck, l as createHealthManager, n as customCheck, o as RedisCheck, r as MemoryCheck, s as DatabaseCheck, t as CustomCheck, u as HealthCheck } from "../health-DQSvUplL.js";
2
2
  export { CacheCheck, CustomCheck, DatabaseCheck, HealthCheck, HealthManager, MemoryCheck, RedisCheck, StorageCheck, createHealthManager, customCheck };
@@ -1,10 +1,4 @@
1
- /**
2
- * Health check status.
3
- */
4
1
  export type HealthStatus = 'healthy' | 'degraded' | 'unhealthy';
5
- /**
6
- * Result of a single health check.
7
- */
8
2
  export interface CheckResult {
9
3
  name: string;
10
4
  status: HealthStatus;
@@ -12,41 +6,27 @@ export interface CheckResult {
12
6
  meta?: Record<string, unknown>;
13
7
  duration: number;
14
8
  }
15
- /**
16
- * Complete health report.
17
- */
18
9
  export interface HealthReport {
19
10
  status: HealthStatus;
20
11
  timestamp: Date;
21
12
  checks: CheckResult[];
22
13
  meta?: Record<string, unknown>;
23
14
  }
24
- /**
25
- * Options for registering a health check.
26
- */
27
15
  export interface HealthCheckOptions {
28
16
  /**
29
- * Timeout in milliseconds for the check.
17
+ * Milliseconds.
30
18
  * @default 5000
31
19
  */
32
20
  timeout?: number;
33
21
  /**
34
- * If true, failure of this check will set overall status to unhealthy.
22
+ * Failure sets the whole report's status to unhealthy.
35
23
  * @default false
36
24
  */
37
25
  critical?: boolean;
38
26
  }
39
- /**
40
- * Options for health middleware.
41
- */
42
27
  export interface HealthMiddlewareOptions {
43
- /**
44
- * Only run these specific checks.
45
- */
28
+ /** Run only these checks, by name. */
46
29
  checks?: string[];
47
- /**
48
- * Include detailed check results.
49
- * @default true
50
- */
30
+ /** @default true */
51
31
  detailed?: boolean;
52
32
  }
@@ -1,35 +1,17 @@
1
1
  //#region src/health/HealthCheck.ts
2
- /**
3
- * Abstract base class for health checks.
4
- */
5
2
  var HealthCheck = class {
6
- /**
7
- * Create a healthy result.
8
- */
9
3
  healthy(message, meta) {
10
4
  return this.result("healthy", message, meta);
11
5
  }
12
- /**
13
- * Create a degraded result.
14
- */
15
6
  degraded(message, meta) {
16
7
  return this.result("degraded", message, meta);
17
8
  }
18
- /**
19
- * Create an unhealthy result.
20
- */
21
9
  unhealthy(message, meta) {
22
10
  return this.result("unhealthy", message, meta);
23
11
  }
24
- /**
25
- * Create an unhealthy result from a caught error.
26
- */
27
12
  handleError(error, fallbackMessage) {
28
13
  return this.unhealthy(error instanceof Error ? error.message : fallbackMessage);
29
14
  }
30
- /**
31
- * Create a check result.
32
- */
33
15
  result(status, message, meta) {
34
16
  const result = {
35
17
  name: this.name,
@@ -43,14 +25,8 @@ var HealthCheck = class {
43
25
  };
44
26
  //#endregion
45
27
  //#region src/health/HealthManager.ts
46
- /**
47
- * Health check manager.
48
- */
49
28
  var HealthManager = class {
50
29
  checks = /* @__PURE__ */ new Map();
51
- /**
52
- * Register a health check.
53
- */
54
30
  register(check, options = {}) {
55
31
  this.checks.set(check.name, {
56
32
  check,
@@ -61,45 +37,27 @@ var HealthManager = class {
61
37
  });
62
38
  return this;
63
39
  }
64
- /**
65
- * Unregister a health check.
66
- */
67
40
  unregister(name) {
68
41
  this.checks.delete(name);
69
42
  return this;
70
43
  }
71
- /**
72
- * Get all registered check names.
73
- */
74
44
  getCheckNames() {
75
45
  return Array.from(this.checks.keys());
76
46
  }
77
- /**
78
- * Run all health checks.
79
- */
80
47
  async check() {
81
48
  return this.runChecks(this.getCheckNames());
82
49
  }
83
- /**
84
- * Run specific health checks.
85
- */
86
50
  async checkOnly(names) {
87
51
  const validNames = names.filter((name) => this.checks.has(name));
88
52
  return this.runChecks(validNames);
89
53
  }
90
- /**
91
- * Get a specific check result.
92
- */
93
54
  async getCheck(name) {
94
55
  const registered = this.checks.get(name);
95
56
  if (!registered) return null;
96
57
  return this.runCheck(registered);
97
58
  }
98
- /**
99
- * Create middleware for health endpoints.
100
- */
101
59
  middleware(options = {}) {
102
- return async (ctx, next) => {
60
+ return async (ctx, _next) => {
103
61
  const report = options.checks ? await this.checkOnly(options.checks) : await this.check();
104
62
  const statusCode = report.status === "healthy" ? 200 : report.status === "degraded" ? 200 : 503;
105
63
  ctx.res = ctx.json({
@@ -115,9 +73,6 @@ var HealthManager = class {
115
73
  }, statusCode);
116
74
  };
117
75
  }
118
- /**
119
- * Run the specified checks.
120
- */
121
76
  async runChecks(names) {
122
77
  const results = [];
123
78
  let overallStatus = "healthy";
@@ -138,9 +93,6 @@ var HealthManager = class {
138
93
  checks: results
139
94
  };
140
95
  }
141
- /**
142
- * Run a single check with timeout.
143
- */
144
96
  async runCheck(registered) {
145
97
  const { check, options } = registered;
146
98
  const start = performance.now();
@@ -158,9 +110,6 @@ var HealthManager = class {
158
110
  };
159
111
  }
160
112
  }
161
- /**
162
- * Create a timeout promise.
163
- */
164
113
  timeoutPromise(ms) {
165
114
  return new Promise((_, reject) => {
166
115
  setTimeout(() => {
@@ -169,17 +118,11 @@ var HealthManager = class {
169
118
  });
170
119
  }
171
120
  };
172
- /**
173
- * Create a health manager.
174
- */
175
121
  function createHealthManager() {
176
122
  return new HealthManager();
177
123
  }
178
124
  //#endregion
179
125
  //#region src/health/checks/DatabaseCheck.ts
180
- /**
181
- * Health check for database connectivity.
182
- */
183
126
  var DatabaseCheck = class extends HealthCheck {
184
127
  name;
185
128
  db;
@@ -201,9 +144,6 @@ var DatabaseCheck = class extends HealthCheck {
201
144
  };
202
145
  //#endregion
203
146
  //#region src/health/checks/RedisCheck.ts
204
- /**
205
- * Health check for Redis connectivity.
206
- */
207
147
  var RedisCheck = class extends HealthCheck {
208
148
  name;
209
149
  redis;
@@ -224,9 +164,6 @@ var RedisCheck = class extends HealthCheck {
224
164
  };
225
165
  //#endregion
226
166
  //#region src/health/checks/CacheCheck.ts
227
- /**
228
- * Health check for cache functionality.
229
- */
230
167
  var CacheCheck = class extends HealthCheck {
231
168
  name;
232
169
  cache;
@@ -252,9 +189,6 @@ var CacheCheck = class extends HealthCheck {
252
189
  };
253
190
  //#endregion
254
191
  //#region src/health/checks/StorageCheck.ts
255
- /**
256
- * Health check for storage functionality.
257
- */
258
192
  var StorageCheck = class extends HealthCheck {
259
193
  name;
260
194
  storage;
@@ -280,9 +214,6 @@ var StorageCheck = class extends HealthCheck {
280
214
  };
281
215
  //#endregion
282
216
  //#region src/health/checks/MemoryCheck.ts
283
- /**
284
- * Health check for memory usage.
285
- */
286
217
  var MemoryCheck = class extends HealthCheck {
287
218
  name;
288
219
  thresholdMb;
@@ -310,9 +241,6 @@ var MemoryCheck = class extends HealthCheck {
310
241
  };
311
242
  //#endregion
312
243
  //#region src/health/checks/CustomCheck.ts
313
- /**
314
- * Custom health check with callback.
315
- */
316
244
  var CustomCheck = class extends HealthCheck {
317
245
  name;
318
246
  callback;
@@ -335,9 +263,6 @@ var CustomCheck = class extends HealthCheck {
335
263
  }
336
264
  }
337
265
  };
338
- /**
339
- * Create a custom health check.
340
- */
341
266
  function customCheck(name, callback) {
342
267
  return new CustomCheck(name, callback);
343
268
  }
@@ -0,0 +1,167 @@
1
+ //#region src/support/stack-frames.ts
2
+ /**
3
+ * Which `(` opens the location group at the end of a stack frame — the one
4
+ * question the package's two frame readers share (the debug page's
5
+ * `parseStackTrace` and the hot-reload registry's `parseFrameLocation`), so
6
+ * every parenthesis fix belongs here and they cannot drift.
7
+ *
8
+ * `packages/orm/src/active-connections.ts` carries a character-identical copy
9
+ * of the function below and must not import this one: fix both, or neither.
10
+ */
11
+ const OPEN_PAREN = 40;
12
+ const CLOSE_PAREN = 41;
13
+ /** The characters a stack frame can never span, so a scan stops at them. */
14
+ function isLineTerminator(code) {
15
+ return code === 10 || code === 13 || code === 8232 || code === 8233;
16
+ }
17
+ /**
18
+ * Depth, not a fixed "first" or "last": `at fn (/app (old)/x.ts:1:2)` needs the
19
+ * leftmost pair, `at weird (name) (/app/x.ts:1:2)` the rightmost. The leftmost
20
+ * `(` the scan passed is the fallback that saves a location carrying an
21
+ * unmatched `)` (`/app/name).ts`). Scanning by char code stays linear where
22
+ * lazy matching is quadratic, and nothing bounds a frame's length.
23
+ */
24
+ function matchingOpenParen(frame, closeIndex) {
25
+ if (frame.charCodeAt(closeIndex) !== CLOSE_PAREN) return;
26
+ let depth = 0;
27
+ let leftmostOpen;
28
+ for (let index = closeIndex; index >= 0; index--) {
29
+ const code = frame.charCodeAt(index);
30
+ if (isLineTerminator(code)) break;
31
+ if (code === CLOSE_PAREN) depth++;
32
+ else if (code === OPEN_PAREN) {
33
+ if (--depth === 0) return index;
34
+ leftmostOpen = index;
35
+ }
36
+ }
37
+ return leftmostOpen;
38
+ }
39
+ //#endregion
40
+ //#region src/hot-reload/hot-disposables.ts
41
+ /**
42
+ * Stops the timers a previous module evaluation left running: `bun --hot`
43
+ * re-runs the module graph in-process and a `setInterval` callback keeps its
44
+ * owner reachable, so each reload leaks a timer and the dead graph behind it.
45
+ * Teardown is parked on `globalThis`, which survives re-evaluation — Bun
46
+ * exposes no `import.meta.hot` to `bun --hot` (1.3.14). Owners are keyed on
47
+ * file + discriminator, never line: a line moves whenever anything above it
48
+ * does. Twin of `packages/orm/src/active-connections.ts` — the frame-walk rule
49
+ * is the same in both and must be carried across by hand.
50
+ */
51
+ const REGISTRY_KEY = Symbol.for("guren.server.hotDisposables");
52
+ function getRegistry() {
53
+ const scope = globalThis;
54
+ return scope[REGISTRY_KEY] ??= /* @__PURE__ */ new Map();
55
+ }
56
+ /**
57
+ * Whether modules can be re-evaluated in this process. `bun --watch` restarts
58
+ * instead, dropping every timer with it, so `--hot` is the only mode that leaks.
59
+ * Exported so callers can skip building the `Error` whose stack identifies them
60
+ * — capturing one formats the whole stack into a string.
61
+ */
62
+ function isHotReloadRuntime() {
63
+ return typeof process !== "undefined" && Array.isArray(process.execArgv) && process.execArgv.includes("--hot");
64
+ }
65
+ /**
66
+ * Paths the engine reports for code with no source location — JSC emits
67
+ * `at new Owner (unknown:1:28)` for an implicit constructor, and
68
+ * `at map (native:1:11)` for a built-in. Taking one would key every such owner
69
+ * in the process to the same slot, where each new one stops the last.
70
+ */
71
+ const SYNTHETIC_FRAME_PATHS = /* @__PURE__ */ new Set([
72
+ "unknown",
73
+ "native",
74
+ "<anonymous>"
75
+ ]);
76
+ const LOCATION_SUFFIX = /:\d+(?::\d+)?$/;
77
+ /** Both match one character, so neither can backtrack the way `\s*` in a pattern can. */
78
+ const WHITESPACE = /\s/;
79
+ const LINE_TERMINATOR = /[\n\r\u2028\u2029]/;
80
+ /**
81
+ * What a bare `at …` frame carries, with surrounding whitespace dropped.
82
+ * Scanned rather than captured with `/^\s*at\s+(.+?)\s*$/`, whose lazy body and
83
+ * greedy tail contend for the same spaces: a padded frame took time cubic in
84
+ * the padding's length before concluding it did not match.
85
+ */
86
+ function parseBareFrame(frame) {
87
+ const end = frame.trimEnd().length;
88
+ let cursor = 0;
89
+ while (cursor < end && WHITESPACE.test(frame[cursor])) cursor += 1;
90
+ if (!frame.startsWith("at", cursor)) return void 0;
91
+ const afterAt = cursor + 2;
92
+ let start = afterAt;
93
+ while (start < end && WHITESPACE.test(frame[start])) start += 1;
94
+ if (start === afterAt) return void 0;
95
+ const body = frame.slice(start, end);
96
+ return LINE_TERMINATOR.test(body) ? void 0 : body;
97
+ }
98
+ /**
99
+ * The text inside the parentheses that close a frame. Which `(` opens them is
100
+ * `matchingOpenParen`'s problem: both the path and the function name in front
101
+ * of it may contain parentheses.
102
+ */
103
+ function parenthesizedLocation(frame) {
104
+ const trimmed = frame.trimEnd();
105
+ if (!trimmed.endsWith(")")) return;
106
+ const open = matchingOpenParen(trimmed, trimmed.length - 1);
107
+ return open === void 0 ? void 0 : trimmed.slice(open + 1, -1);
108
+ }
109
+ /**
110
+ * The path a single stack frame points at, without its line and column. The
111
+ * parenthesized shape is read first because its parentheses bound the path; the
112
+ * bare shape falls back to whitespace, which truncates `/Users/me/My
113
+ * Projects/app.ts`. The trailing `:line` proves this is a location at all, and
114
+ * an `eval` group is rejected — an owner with no key is left alone, safely.
115
+ */
116
+ function parseFrameLocation(frame) {
117
+ const location = parenthesizedLocation(frame) ?? parseBareFrame(frame);
118
+ if (!location || location.startsWith("eval at ") || !LOCATION_SUFFIX.test(location)) return;
119
+ return location.replace(LOCATION_SUFFIX, "");
120
+ }
121
+ /**
122
+ * The file that built the timer owner. `stack` must come from an `Error`
123
+ * constructed inside the constructor or factory itself, so frame 2 is the
124
+ * caller — or the first frame after it naming a real file, since the engine may
125
+ * have synthesized the ones in between.
126
+ */
127
+ function describeCallerFile(stack) {
128
+ for (const frame of stack?.split("\n").slice(2) ?? []) {
129
+ const path = parseFrameLocation(frame);
130
+ if (path && !SYNTHETIC_FRAME_PATHS.has(path)) return path;
131
+ }
132
+ }
133
+ /**
134
+ * Identity for a timer owner across hot reloads, or `undefined` when the owner
135
+ * must be left alone. `target` separates owners sharing a call site, so one
136
+ * module building several does not collapse them into a single slot.
137
+ */
138
+ function hotReloadKey(scope, stack, target) {
139
+ if (!isHotReloadRuntime()) return;
140
+ const callerFile = describeCallerFile(stack);
141
+ return callerFile ? `${scope}|${callerFile}|${target}` : void 0;
142
+ }
143
+ /**
144
+ * Records `dispose` as the live owner for this identity, stops whichever owner
145
+ * held it before, and returns the claim. `undefined` outside `--hot`, or when
146
+ * the stack names no caller — the owner is then left alone. A teardown that
147
+ * throws is reported and swallowed, since refusing to register the replacement
148
+ * would leak the very timer this exists to stop.
149
+ */
150
+ function claimHotDisposable(scope, stack, target, dispose) {
151
+ const key = hotReloadKey(scope, stack, target);
152
+ if (!key) return;
153
+ const registry = getRegistry();
154
+ const previous = registry.get(key);
155
+ registry.delete(key);
156
+ if (previous && previous !== dispose) try {
157
+ previous();
158
+ } catch (error) {
159
+ console.warn("[guren] Failed to stop the previous hot-reload disposable:", error);
160
+ }
161
+ registry.set(key, dispose);
162
+ return { release() {
163
+ if (registry.get(key) === dispose) registry.delete(key);
164
+ } };
165
+ }
166
+ //#endregion
167
+ export { isHotReloadRuntime as n, matchingOpenParen as r, claimHotDisposable as t };