@guren/server 2.1.1 → 2.3.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 (281) hide show
  1. package/dist/{DocsViewerServiceProvider-D7RGJPGM.js → DocsViewerServiceProvider-RUYDFBMW.js} +2 -2
  2. package/dist/McpServiceProvider-FRJ5O7LT.js +8 -0
  3. package/dist/auth/AuthManager.d.ts +30 -0
  4. package/dist/auth/AuthenticatableModel.d.ts +25 -0
  5. package/dist/auth/RequestAuthContext.d.ts +24 -0
  6. package/dist/auth/SessionGuard.d.ts +31 -0
  7. package/dist/auth/api-token.d.ts +299 -0
  8. package/dist/auth/email-verification.d.ts +203 -0
  9. package/dist/auth/index.d.ts +18 -110
  10. package/dist/auth/index.js +4 -1
  11. package/dist/auth/oauth/index.d.ts +239 -0
  12. package/dist/auth/password/DefaultHasher.d.ts +13 -0
  13. package/dist/auth/password/NodeHasher.d.ts +22 -0
  14. package/dist/auth/password/PasswordHasher.d.ts +5 -0
  15. package/dist/auth/password/ScryptHasher.d.ts +26 -0
  16. package/dist/auth/password-reset.d.ts +91 -0
  17. package/dist/auth/providers/ModelUserProvider.d.ts +36 -0
  18. package/dist/auth/providers/UserProvider.d.ts +9 -0
  19. package/dist/auth/types.d.ts +102 -0
  20. package/dist/auth/utils.d.ts +39 -0
  21. package/dist/{Gate-CynjZCtS.d.ts → authorization/Gate.d.ts} +30 -111
  22. package/dist/authorization/Policy.d.ts +77 -0
  23. package/dist/authorization/index.d.ts +5 -129
  24. package/dist/authorization/index.js +3 -1
  25. package/dist/authorization/middleware.d.ts +49 -0
  26. package/dist/authorization/types.d.ts +108 -0
  27. package/dist/broadcasting/BroadcastManager.d.ts +205 -0
  28. package/dist/broadcasting/channels/Channel.d.ts +28 -0
  29. package/dist/broadcasting/channels/PresenceChannel.d.ts +72 -0
  30. package/dist/broadcasting/channels/PrivateChannel.d.ts +32 -0
  31. package/dist/broadcasting/channels/index.d.ts +3 -0
  32. package/dist/broadcasting/drivers/MemoryDriver.d.ts +93 -0
  33. package/dist/broadcasting/drivers/RedisDriver.d.ts +112 -0
  34. package/dist/broadcasting/drivers/index.d.ts +2 -0
  35. package/dist/broadcasting/index.d.ts +6 -233
  36. package/dist/broadcasting/index.js +1 -1
  37. package/dist/broadcasting/typed.d.ts +23 -0
  38. package/dist/broadcasting/types.d.ts +155 -0
  39. package/dist/cache/CacheManager.d.ts +87 -0
  40. package/dist/cache/TaggedCache.d.ts +62 -0
  41. package/dist/cache/index.d.ts +6 -233
  42. package/dist/cache/index.js +1 -1
  43. package/dist/cache/stores/FileStore.d.ts +64 -0
  44. package/dist/cache/stores/MemoryStore.d.ts +52 -0
  45. package/dist/cache/stores/RedisStore.d.ts +53 -0
  46. package/dist/{CacheManager-BmDzUKrF.d.ts → cache/types.d.ts} +26 -99
  47. package/dist/chunk-3KV5X2FL.js +31 -0
  48. package/dist/{chunk-TVY72CLV.js → chunk-4VE3LYOM.js} +3 -2
  49. package/dist/{chunk-DSDX3ASM.js → chunk-5WL2FTC4.js} +67 -85
  50. package/dist/{chunk-5SZTEZ22.js → chunk-6IGN233M.js} +15 -8
  51. package/dist/{chunk-FZD2AKJI.js → chunk-7OB2YXRE.js} +56 -28
  52. package/dist/{chunk-WIXGT4TN.js → chunk-A5JJ7XTH.js} +8 -2
  53. package/dist/{chunk-CWI4AJ47.js → chunk-HPET6XY5.js} +13 -9
  54. package/dist/{chunk-A3ISJVEV.js → chunk-HR2KZ3WL.js} +23 -5
  55. package/dist/{chunk-BZMZEFRG.js → chunk-LHR6OHI7.js} +11 -0
  56. package/dist/{chunk-JBG4AR24.js → chunk-Q2P6YLRR.js} +8 -2
  57. package/dist/{chunk-J6ETA476.js → chunk-TVV5YNEC.js} +101 -9
  58. package/dist/console/Command.d.ts +179 -0
  59. package/dist/{ConsoleKernel-CJg975mp.d.ts → console/ConsoleKernel.d.ts} +4 -6
  60. package/dist/console/Input.d.ts +140 -0
  61. package/dist/console/Output.d.ts +161 -0
  62. package/dist/console/index.d.ts +5 -0
  63. package/dist/console/types.d.ts +106 -0
  64. package/dist/container/Container.d.ts +148 -0
  65. package/dist/container/ServiceProvider.d.ts +103 -0
  66. package/dist/container/bindings.d.ts +55 -0
  67. package/dist/container/defineModule.d.ts +88 -0
  68. package/dist/container/definePlugin.d.ts +62 -0
  69. package/dist/container/index.d.ts +8 -0
  70. package/dist/container/types.d.ts +73 -0
  71. package/dist/database/Factory.d.ts +82 -0
  72. package/dist/database/Seeder.d.ts +35 -0
  73. package/dist/database/SeederRunner.d.ts +41 -0
  74. package/dist/database/index.d.ts +4 -0
  75. package/dist/database/types.d.ts +49 -0
  76. package/dist/discovery/AutoDiscovery.d.ts +113 -0
  77. package/dist/discovery/index.d.ts +2 -0
  78. package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +12 -0
  79. package/dist/docs-viewer/endpoint.d.ts +29 -0
  80. package/dist/encryption/Encrypter.d.ts +96 -0
  81. package/dist/encryption/Hash.d.ts +69 -0
  82. package/dist/encryption/MessageSigner.d.ts +21 -0
  83. package/dist/encryption/Random.d.ts +119 -0
  84. package/dist/encryption/app-key.d.ts +12 -0
  85. package/dist/encryption/index.d.ts +10 -222
  86. package/dist/encryption/signed-url.d.ts +9 -0
  87. package/dist/encryption/types.d.ts +103 -0
  88. package/dist/errors/ExceptionHandler.d.ts +118 -0
  89. package/dist/errors/HttpException.d.ts +106 -0
  90. package/dist/errors/debug-page.d.ts +22 -0
  91. package/dist/errors/error-page.d.ts +1 -0
  92. package/dist/errors/exceptions/AuthenticationException.d.ts +32 -0
  93. package/dist/errors/exceptions/AuthorizationException.d.ts +32 -0
  94. package/dist/errors/exceptions/MethodNotAllowedException.d.ts +31 -0
  95. package/dist/errors/exceptions/NotFoundHttpException.d.ts +36 -0
  96. package/dist/errors/exceptions/ValidationException.d.ts +60 -0
  97. package/dist/errors/exceptions/index.d.ts +5 -0
  98. package/dist/errors/index.d.ts +5 -0
  99. package/dist/errors/types.d.ts +43 -0
  100. package/dist/events/Event.d.ts +33 -0
  101. package/dist/{EventManager-CmIoLt7r.d.ts → events/EventManager.d.ts} +4 -86
  102. package/dist/events/Listener.d.ts +79 -0
  103. package/dist/events/builtin.d.ts +73 -0
  104. package/dist/events/index.d.ts +6 -155
  105. package/dist/events/types.d.ts +48 -0
  106. package/dist/facades/index.d.ts +31 -0
  107. package/dist/health/HealthCheck.d.ts +34 -0
  108. package/dist/health/HealthManager.d.ts +53 -0
  109. package/dist/health/checks/CacheCheck.d.ts +35 -0
  110. package/dist/health/checks/CustomCheck.d.ts +23 -0
  111. package/dist/health/checks/DatabaseCheck.d.ts +33 -0
  112. package/dist/health/checks/MemoryCheck.d.ts +32 -0
  113. package/dist/health/checks/RedisCheck.d.ts +27 -0
  114. package/dist/health/checks/StorageCheck.d.ts +35 -0
  115. package/dist/health/checks/index.d.ts +12 -0
  116. package/dist/health/index.d.ts +5 -185
  117. package/dist/health/types.d.ts +52 -0
  118. package/dist/hot-reload/hot-disposables.d.ts +96 -0
  119. package/dist/hot-reload/testing.d.ts +14 -0
  120. package/dist/http/Application.d.ts +199 -0
  121. package/dist/http/FormRequest.d.ts +73 -0
  122. package/dist/http/dev-assets.d.ts +62 -0
  123. package/dist/http/dev-banner.d.ts +7 -0
  124. package/dist/http/inertia-assets.d.ts +31 -0
  125. package/dist/http/middleware/auth.d.ts +13 -0
  126. package/dist/http/middleware/capabilities.d.ts +22 -0
  127. package/dist/http/middleware/cors.d.ts +40 -0
  128. package/dist/http/middleware/csp.d.ts +59 -0
  129. package/dist/http/middleware/csrf.d.ts +121 -0
  130. package/dist/http/middleware/detect-locale.d.ts +65 -0
  131. package/dist/http/middleware/force-https.d.ts +34 -0
  132. package/dist/http/middleware/host-authorization.d.ts +24 -0
  133. package/dist/http/middleware/index.d.ts +19 -0
  134. package/dist/http/middleware/loopback-guard.d.ts +51 -0
  135. package/dist/{rate-limit-D9J2b4S1.d.ts → http/middleware/rate-limit.d.ts} +22 -50
  136. package/dist/http/middleware/redirect-safety.d.ts +29 -0
  137. package/dist/http/middleware/request-id.d.ts +19 -0
  138. package/dist/http/middleware/request-logging.d.ts +16 -0
  139. package/dist/http/middleware/response-headers.d.ts +18 -0
  140. package/dist/http/middleware/security-headers.d.ts +49 -0
  141. package/dist/http/middleware/session.d.ts +93 -0
  142. package/dist/http/middleware/validation.d.ts +94 -0
  143. package/dist/http/public-assets.d.ts +15 -0
  144. package/dist/http/request.d.ts +24 -0
  145. package/dist/http/resources/CursorPaginator.d.ts +106 -0
  146. package/dist/http/resources/Paginator.d.ts +130 -0
  147. package/dist/http/resources/Resource.d.ts +67 -0
  148. package/dist/http/resources/ResourceCollection.d.ts +60 -0
  149. package/dist/http/resources/index.d.ts +6 -0
  150. package/dist/http/resources/types.d.ts +91 -0
  151. package/dist/http/validation/Validator.d.ts +128 -0
  152. package/dist/http/validation/index.d.ts +3 -0
  153. package/dist/http/validation/rules.d.ts +196 -0
  154. package/dist/http/validation/types.d.ts +96 -0
  155. package/dist/http/vite-dev-server.d.ts +27 -0
  156. package/dist/i18n/I18nManager.d.ts +114 -0
  157. package/dist/i18n/Translator.d.ts +80 -0
  158. package/dist/i18n/index.d.ts +6 -101
  159. package/dist/i18n/index.js +5 -3
  160. package/dist/i18n/loaders/JsonLoader.d.ts +47 -0
  161. package/dist/i18n/loaders/MemoryLoader.d.ts +37 -0
  162. package/dist/i18n/pluralization.d.ts +19 -0
  163. package/dist/i18n/types.d.ts +106 -0
  164. package/dist/index.d.ts +69 -2605
  165. package/dist/index.js +405 -180
  166. package/dist/lambda/index.d.ts +17 -37
  167. package/dist/logging/LogManager.d.ts +83 -0
  168. package/dist/logging/Logger.d.ts +76 -0
  169. package/dist/logging/channels/ConsoleChannel.d.ts +11 -0
  170. package/dist/logging/channels/DailyFileChannel.d.ts +20 -0
  171. package/dist/logging/channels/FileChannel.d.ts +15 -0
  172. package/dist/logging/index.d.ts +8 -50
  173. package/dist/logging/types.d.ts +96 -0
  174. package/dist/mail/Mail.d.ts +138 -0
  175. package/dist/mail/MailManager.d.ts +79 -0
  176. package/dist/mail/address.d.ts +8 -0
  177. package/dist/mail/index.d.ts +7 -316
  178. package/dist/mail/transports/LogTransport.d.ts +19 -0
  179. package/dist/mail/transports/MemoryTransport.d.ts +84 -0
  180. package/dist/mail/transports/ResendTransport.d.ts +32 -0
  181. package/dist/mail/transports/SmtpTransport.d.ts +40 -0
  182. package/dist/{MailManager-DpMvYiP9.d.ts → mail/types.d.ts} +11 -92
  183. package/dist/mcp/McpServiceProvider.d.ts +17 -0
  184. package/dist/mcp/create-mcp-server.d.ts +152 -0
  185. package/dist/mcp/endpoint.d.ts +47 -0
  186. package/dist/mcp/index.d.ts +3 -185
  187. package/dist/mcp/index.js +3 -3
  188. package/dist/mvc/Controller.d.ts +326 -0
  189. package/dist/mvc/Router.d.ts +239 -0
  190. package/dist/mvc/ViewEngine.d.ts +11 -0
  191. package/dist/mvc/inertia/InertiaEngine.d.ts +114 -0
  192. package/dist/mvc/inertia/shared.d.ts +90 -0
  193. package/dist/mvc/mount-route.d.ts +10 -0
  194. package/dist/notifications/Notification.d.ts +99 -0
  195. package/dist/notifications/NotificationManager.d.ts +150 -0
  196. package/dist/notifications/channels/DatabaseChannel.d.ts +55 -0
  197. package/dist/notifications/channels/MailChannel.d.ts +45 -0
  198. package/dist/notifications/channels/MemoryChannel.d.ts +85 -0
  199. package/dist/notifications/channels/SlackChannel.d.ts +73 -0
  200. package/dist/notifications/channels/index.d.ts +4 -0
  201. package/dist/notifications/index.d.ts +6 -322
  202. package/dist/notifications/notifiable-type.d.ts +10 -0
  203. package/dist/notifications/registry.d.ts +39 -0
  204. package/dist/notifications/types.d.ts +162 -0
  205. package/dist/providers/AuthServiceProvider.d.ts +7 -0
  206. package/dist/providers/AuthorizationServiceProvider.d.ts +9 -0
  207. package/dist/providers/BroadcastServiceProvider.d.ts +7 -0
  208. package/dist/providers/CacheServiceProvider.d.ts +7 -0
  209. package/dist/providers/EncryptionServiceProvider.d.ts +7 -0
  210. package/dist/providers/ErrorServiceProvider.d.ts +9 -0
  211. package/dist/providers/EventServiceProvider.d.ts +7 -0
  212. package/dist/providers/HealthServiceProvider.d.ts +7 -0
  213. package/dist/providers/I18nServiceProvider.d.ts +27 -0
  214. package/dist/providers/InertiaServiceProvider.d.ts +20 -0
  215. package/dist/providers/LogServiceProvider.d.ts +7 -0
  216. package/dist/providers/MailServiceProvider.d.ts +7 -0
  217. package/dist/providers/NotificationServiceProvider.d.ts +8 -0
  218. package/dist/providers/OAuthServiceProvider.d.ts +7 -0
  219. package/dist/providers/QueueServiceProvider.d.ts +7 -0
  220. package/dist/providers/SchedulingServiceProvider.d.ts +7 -0
  221. package/dist/providers/StorageServiceProvider.d.ts +7 -0
  222. package/dist/providers/index.d.ts +17 -0
  223. package/dist/queue/FailedJobReporter.d.ts +40 -0
  224. package/dist/queue/Job.d.ts +140 -0
  225. package/dist/queue/QueueManager.d.ts +79 -0
  226. package/dist/queue/Worker.d.ts +99 -0
  227. package/dist/queue/drivers/MemoryDriver.d.ts +60 -0
  228. package/dist/queue/drivers/RedisDriver.d.ts +96 -0
  229. package/dist/queue/drivers/SqsDriver.d.ts +108 -0
  230. package/dist/queue/drivers/SyncDriver.d.ts +28 -0
  231. package/dist/queue/index.d.ts +9 -453
  232. package/dist/queue/types.d.ts +171 -0
  233. package/dist/redis/RedisApiTokenStore.d.ts +78 -0
  234. package/dist/redis/RedisEmailVerificationStore.d.ts +54 -0
  235. package/dist/redis/RedisOAuthStateStore.d.ts +26 -0
  236. package/dist/redis/RedisPasswordResetStore.d.ts +57 -0
  237. package/dist/redis/RedisRateLimitStore.d.ts +77 -0
  238. package/dist/redis/RedisSessionStore.d.ts +61 -0
  239. package/dist/redis/client.d.ts +41 -0
  240. package/dist/redis/index.d.ts +14 -356
  241. package/dist/redis/index.js +45 -9
  242. package/dist/redis/redis-values.d.ts +17 -0
  243. package/dist/redis/scan-keys.d.ts +6 -0
  244. package/dist/runtime/index.d.ts +8 -95
  245. package/dist/runtime/index.js +101 -68
  246. package/dist/scheduling/CronParser.d.ts +37 -0
  247. package/dist/scheduling/Schedule.d.ts +229 -0
  248. package/dist/scheduling/ScheduledTask.d.ts +47 -0
  249. package/dist/scheduling/Scheduler.d.ts +99 -0
  250. package/dist/scheduling/index.d.ts +5 -41
  251. package/dist/scheduling/types.d.ts +97 -0
  252. package/dist/storage/StorageManager.d.ts +65 -0
  253. package/dist/storage/drivers/LocalDriver.d.ts +55 -0
  254. package/dist/storage/drivers/MemoryDriver.d.ts +66 -0
  255. package/dist/storage/drivers/S3Driver.d.ts +72 -0
  256. package/dist/storage/index.d.ts +5 -197
  257. package/dist/{StorageManager-oZTHqaza.d.ts → storage/types.d.ts} +10 -77
  258. package/dist/support/contained-path.d.ts +26 -0
  259. package/dist/support/error-polyfill.d.ts +9 -0
  260. package/dist/support/expiry.d.ts +47 -0
  261. package/dist/support/expiry.js +12 -0
  262. package/dist/support/import-map.d.ts +13 -0
  263. package/dist/support/redirect-target.d.ts +11 -0
  264. package/dist/support/stack-frames.d.ts +56 -0
  265. package/dist/support/trim-slashes.d.ts +11 -0
  266. package/dist/vite/index.d.ts +2 -35
  267. package/dist/vite/index.js +0 -3
  268. package/dist/vite/plugin.d.ts +34 -0
  269. package/package.json +7 -3
  270. package/dist/AuthManager-DBP4KYsx.d.ts +0 -79
  271. package/dist/BroadcastManager-D8KoJxiV.d.ts +0 -492
  272. package/dist/HealthManager-DUyMIzsZ.d.ts +0 -141
  273. package/dist/I18nManager-BiSoczfV.d.ts +0 -275
  274. package/dist/LogManager-7mxnkaPM.d.ts +0 -256
  275. package/dist/McpServiceProvider-7BB5FPF3.js +0 -8
  276. package/dist/Scheduler-pZiT8i57.d.ts +0 -471
  277. package/dist/api-token-D24VPr_E.d.ts +0 -663
  278. package/dist/app-key-CsBfRC_Q.d.ts +0 -214
  279. package/dist/email-verification-Dx426KLn.d.ts +0 -336
  280. package/dist/index-9_Jzj5jo.d.ts +0 -7
  281. package/dist/validation-yAL53e1S.d.ts +0 -2610
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Options for putting files.
3
3
  */
4
- interface PutOptions {
4
+ export interface PutOptions {
5
5
  /**
6
6
  * File visibility.
7
7
  */
@@ -18,7 +18,7 @@ interface PutOptions {
18
18
  /**
19
19
  * File metadata.
20
20
  */
21
- interface FileMetadata {
21
+ export interface FileMetadata {
22
22
  /**
23
23
  * File path.
24
24
  */
@@ -47,7 +47,7 @@ interface FileMetadata {
47
47
  /**
48
48
  * Storage driver interface.
49
49
  */
50
- interface StorageDriver {
50
+ export interface StorageDriver {
51
51
  /**
52
52
  * Put a file into storage.
53
53
  * @param path File path
@@ -173,11 +173,11 @@ interface StorageDriver {
173
173
  /**
174
174
  * Storage driver factory function.
175
175
  */
176
- type StorageDriverFactory = () => StorageDriver;
176
+ export type StorageDriverFactory = () => StorageDriver;
177
177
  /**
178
178
  * Local driver options.
179
179
  */
180
- interface LocalDriverOptions {
180
+ export interface LocalDriverOptions {
181
181
  /**
182
182
  * Root directory for file storage.
183
183
  */
@@ -195,7 +195,7 @@ interface LocalDriverOptions {
195
195
  /**
196
196
  * S3 driver options.
197
197
  */
198
- interface S3DriverOptions {
198
+ export interface S3DriverOptions {
199
199
  /**
200
200
  * S3 client instance (@aws-sdk/client-s3).
201
201
  */
@@ -237,7 +237,7 @@ interface S3DriverOptions {
237
237
  /**
238
238
  * Memory driver options.
239
239
  */
240
- interface MemoryDriverOptions {
240
+ export interface MemoryDriverOptions {
241
241
  /**
242
242
  * Base URL for public files.
243
243
  */
@@ -246,18 +246,18 @@ interface MemoryDriverOptions {
246
246
  /**
247
247
  * Driver configuration union type.
248
248
  */
249
- type DriverConfig = ({
249
+ export type DriverConfig = ({
250
250
  driver: 'local';
251
251
  } & LocalDriverOptions) | ({
252
252
  driver: 's3';
253
253
  } & S3DriverOptions) | ({
254
254
  driver: 'memory';
255
255
  } & MemoryDriverOptions);
256
- type DiskConfig = DriverConfig;
256
+ export type DiskConfig = DriverConfig;
257
257
  /**
258
258
  * Storage configuration.
259
259
  */
260
- interface StorageConfig {
260
+ export interface StorageConfig {
261
261
  /**
262
262
  * Default disk name.
263
263
  * @default 'local'
@@ -268,70 +268,3 @@ interface StorageConfig {
268
268
  */
269
269
  disks?: Record<string, DriverConfig>;
270
270
  }
271
-
272
- /**
273
- * Storage manager for handling multiple storage disks.
274
- *
275
- * @example
276
- * ```ts
277
- * const storage = new StorageManager({
278
- * default: 'local',
279
- * disks: {
280
- * local: { driver: 'local', root: './storage/app' },
281
- * s3: { driver: 's3', bucket: 'my-bucket', region: 'ap-northeast-1' },
282
- * }
283
- * })
284
- *
285
- * // Use the default disk
286
- * await storage.disk().put('avatars/user-1.jpg', imageBuffer)
287
- *
288
- * // Use a specific disk
289
- * await storage.disk('s3').put('avatars/user-1.jpg', imageBuffer)
290
- * ```
291
- */
292
- declare class StorageManager {
293
- private readonly defaultDiskName;
294
- private readonly diskFactories;
295
- private readonly resolvedDisks;
296
- private driverFactories;
297
- constructor(config?: StorageConfig);
298
- /**
299
- * Register built-in disk drivers.
300
- */
301
- private registerBuiltinDrivers;
302
- /**
303
- * Register a disk from configuration.
304
- */
305
- private registerDiskFromConfig;
306
- /**
307
- * Get a storage disk by name.
308
- * Returns the default disk if no name is specified.
309
- */
310
- disk(name?: string): StorageDriver;
311
- /**
312
- * Register a custom disk factory.
313
- */
314
- registerDisk(name: string, factory: StorageDriverFactory): void;
315
- /**
316
- * Register a custom driver.
317
- */
318
- registerDriver(name: string, factory: (options: unknown) => StorageDriver): void;
319
- /**
320
- * Check if a disk is registered.
321
- */
322
- hasDisk(name: string): boolean;
323
- /**
324
- * Get the default disk name.
325
- */
326
- getDefaultDiskName(): string;
327
- /**
328
- * Get all registered disk names.
329
- */
330
- getDiskNames(): string[];
331
- }
332
- /**
333
- * Create a storage manager with configuration.
334
- */
335
- declare function createStorageManager(config?: StorageConfig): StorageManager;
336
-
337
- export { type DiskConfig as D, type FileMetadata as F, type LocalDriverOptions as L, type MemoryDriverOptions as M, type PutOptions as P, StorageManager as S, type StorageConfig as a, type StorageDriver as b, type StorageDriverFactory as c, createStorageManager as d, type S3DriverOptions as e, type DriverConfig as f };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Is `candidate` a path strictly below `root`, judged lexically?
3
+ *
4
+ * The trailing separator is what keeps out a sibling directory whose name
5
+ * merely extends the root's (`…/inertia` vs `…/inertia-secrets`), and what
6
+ * rejects an absolute `candidate` — which `resolve()` returns verbatim when a
7
+ * doubled slash in the request path left the relative part rooted.
8
+ *
9
+ * Cheap, but not sufficient on its own: `resolve()` collapses `..` without
10
+ * following symlinks. Use {@link isRealPathWithin} before reading the file.
11
+ */
12
+ export declare function isPathWithin(root: string, candidate: string): boolean;
13
+ /**
14
+ * Is `candidate` a path strictly below `root` once both are canonicalized?
15
+ *
16
+ * Every reader downstream of these checks (`Bun.file().text()`,
17
+ * `.arrayBuffer()`, `new Response(file)`) follows symlinks, so a lexical check
18
+ * alone accepts `<root>/link/secret` where `link` points out of the tree.
19
+ * *Both* sides are canonicalized: a root reached through a symlink itself is
20
+ * routine (workspace and pnpm layouts, macOS `/var` → `/private/var`), and
21
+ * canonicalizing only the candidate would 404 every asset such an app serves.
22
+ *
23
+ * Call this on a path already known to exist — a path that does not exist
24
+ * cannot be read, and `realpath` rejects it, so either way this fails closed.
25
+ */
26
+ export declare function isRealPathWithin(root: string, candidate: string): Promise<boolean>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Bun 1.x tightened Error.captureStackTrace so it throws unless the first argument is an actual
3
+ * Error instance. Some ecosystem packages (notably follow-redirects) still pass plain objects,
4
+ * because Node silently upgrades them. When those packages execute during SSR boot we end up
5
+ * crashing before Inertia can import the SSR entry. This shim mirrors Node's behavior by copying
6
+ * a stack trace from a real Error onto whatever object was provided, ensuring third-party code
7
+ * keeps working regardless of Bun's stricter contract.
8
+ */
9
+ export declare function ensureErrorStackTracePolyfill(): void;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Expiry coercion and the one predicate that decides whether a stored expiry
3
+ * has passed.
4
+ *
5
+ * This is the single copy. `packages/core/src/store-utils.ts` re-exports
6
+ * `toDate`/`isExpired`/`toOptionalExpiry` from here through the
7
+ * `@guren/server/support/expiry` subpath, so the database-backed stores and
8
+ * the Redis ones decide expiry with the same code. It lives in this package
9
+ * because `@guren/core` depends on `@guren/server` and not the other way
10
+ * around — core is unreachable from here without a dependency cycle.
11
+ *
12
+ * Not part of the public API: the subpath exists for that re-export, and
13
+ * neither package's index exposes these.
14
+ */
15
+ /**
16
+ * Coerce a stored timestamp, rejecting anything unparseable.
17
+ *
18
+ * Accepts every shape a driver or a Redis value can hand back: Date, number,
19
+ * bigint (MySQL / postgres.js BIGINT), digit-only strings as epoch
20
+ * milliseconds, and ISO strings. A Date wrapping garbage is a parse failure,
21
+ * not a value — `new Date(garbage)` yields an Invalid Date whose comparisons
22
+ * are all false, which is exactly how a corrupt expiry reads as "not past".
23
+ */
24
+ export declare function toDate(value: unknown): Date | null;
25
+ /**
26
+ * Whether an expiry that is required to be present has passed.
27
+ *
28
+ * Missing or unparseable counts as expired, so a malformed record can never be
29
+ * accepted indefinitely. Use for sessions and OAuth state, whose writers always
30
+ * supply an expiry.
31
+ */
32
+ export declare function isExpired(value: unknown, now?: number): boolean;
33
+ /**
34
+ * Whether an expiry that is allowed to be absent has passed.
35
+ *
36
+ * Absent means "never expires" and is never past. Present-but-unparseable is a
37
+ * malformed record and counts as expired — collapsing the two is the fail-open
38
+ * this exists to close. Use at the point of comparison, so the check holds for
39
+ * every store implementation including ones this package never sees.
40
+ */
41
+ export declare function isOptionalExpiryPast(value: unknown, now?: number): boolean;
42
+ /**
43
+ * Coerce an expiry that is allowed to be absent into a value callers can
44
+ * compare directly: absent stays null, present-but-unparseable degrades to a
45
+ * long-past date rather than to null, which would read as "never expires".
46
+ */
47
+ export declare function toOptionalExpiry(value: unknown): Date | null;
@@ -0,0 +1,12 @@
1
+ import {
2
+ isExpired,
3
+ isOptionalExpiryPast,
4
+ toDate,
5
+ toOptionalExpiry
6
+ } from "../chunk-3KV5X2FL.js";
7
+ export {
8
+ isExpired,
9
+ isOptionalExpiryPast,
10
+ toDate,
11
+ toOptionalExpiry
12
+ };
@@ -0,0 +1,13 @@
1
+ export interface ParseImportMapOptions {
2
+ /**
3
+ * Optional label describing the source of the import map.
4
+ * Used in warning logs when parsing fails.
5
+ */
6
+ context?: string;
7
+ }
8
+ /**
9
+ * Parses an import map JSON string into a record of module specifiers.
10
+ * Empty, null, and undefined entries are ignored so callers can safely
11
+ * merge optional overrides without additional filtering.
12
+ */
13
+ export declare function parseImportMap(value: string | undefined, options?: ParseImportMapOptions): Record<string, string>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Shared open-redirect classification primitives, used by both the
3
+ * redirect-safety middleware and the OAuth `redirectTo` sanitizer. Keep every
4
+ * hardening fix here so the two layers cannot drift.
5
+ */
6
+ /** Normalize backslash tricks (e.g. `/\evil.com`) before classifying. */
7
+ export declare function normalizeRedirectTarget(value: string): string;
8
+ /** App-relative paths (`/path`, but not protocol-relative `//host`) are always safe. */
9
+ export declare function isAppRelativePath(value: string): boolean;
10
+ /** Match a URL's host against an allowlist supporting `*.example.com` wildcards. */
11
+ export declare function hostMatchesAllowlist(target: URL, allowedHosts: readonly string[]): boolean;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Which `(` opens the parenthesized location group at the end of a stack frame.
3
+ *
4
+ * That one question is all the package's two frame readers agree on — the debug
5
+ * error page's `parseStackTrace` and the hot-reload registry's
6
+ * `parseFrameLocation`. Everything after it differs on purpose: peeling
7
+ * `:line[:column]` off the right (the page requires a column and keeps the
8
+ * function name; the registry accepts a bare `:line`), and deciding which
9
+ * locations are worth keeping at all (the registry rejects `eval` groups and
10
+ * synthetic paths, because keying an owner on text that is not a path is worse
11
+ * than not keying it; the page is happy to display whatever it was handed).
12
+ * Keep every parenthesis fix here so those two cannot drift.
13
+ *
14
+ * A third reader, `packages/orm/src/active-connections.ts`, carries a copy of
15
+ * the function below whose *body* is identical character for character; only
16
+ * the prose around it differs, to speak about connections rather than frames.
17
+ * That package must not import this one, so the two are kept in step by hand —
18
+ * fix both, or neither.
19
+ */
20
+ /**
21
+ * The index of the `(` that matches the `)` at `closeIndex`, or `undefined`
22
+ * when the frame carries no usable `(` at all.
23
+ *
24
+ * `closeIndex` is a parameter rather than derived here because each caller
25
+ * already knows where its frame ends and gets there differently — two trim a
26
+ * copy of the frame, the ORM's twin keeps an `end` offset to avoid allocating
27
+ * one. It must point at the frame's final `)`; anything else is rejected.
28
+ *
29
+ * Neither the leftmost nor the rightmost `(` is right in general. A path may
30
+ * contain one — `at fn (/app (old)/x.ts:1:2)` needs the outer, *leftmost* pair
31
+ * — and so may the function name in front of it — `at weird (name)
32
+ * (/app/x.ts:1:2)` needs the outer, *rightmost* pair. Depth is what actually
33
+ * tells the two apart; a fixed "first" or "last" gets one of them wrong, and a
34
+ * frame carrying both — `at weird (name) (/app (old)/x.ts:1:2)`, which is one
35
+ * developer's checkout directory away from ordinary — is misread by either.
36
+ *
37
+ * A scan is also the only form that stays linear. Lazily matching from the
38
+ * leftmost `(` retries the whole suffix at every parenthesis, which is
39
+ * quadratic on a frame carrying many unmatched ones. Characters are compared by
40
+ * code rather than tested against a pattern for the same reason the patterns
41
+ * went: this loop runs over every character of every frame, and the one input
42
+ * whose length nothing bounds is a frame — an error message can embed
43
+ * request-derived text, and a continuation line of one that starts `at ` and
44
+ * ends `)` is scanned in full.
45
+ *
46
+ * Depth alone would reject a frame whose location holds an *unmatched* `)`, as
47
+ * `/app/name).ts` or a URL ending `?label=)` does — the scan runs off the front
48
+ * still owing a paren, and the frame is dropped rather than displayed. So the
49
+ * leftmost `(` the scan passed is kept as a fallback for exactly that case.
50
+ * Only frames the depth rule rejects outright can reach it, so it is never
51
+ * worse than depth alone, and it is the reading that keeps such a path whole.
52
+ *
53
+ * The scan stops at a line terminator: a path could never span one, so neither
54
+ * a balanced `(` nor the fallback may come from the far side of a break.
55
+ */
56
+ export declare function matchingOpenParen(frame: string, closeIndex: number): number | undefined;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Slash-trimming without regex: patterns like `/\/+$/` backtrack
3
+ * quadratically on adversarial input (long slash runs mid-string), and
4
+ * several call sites here feed request-derived paths.
5
+ *
6
+ * A twin of `trimSlashes` lives in `@guren/cli` (`src/utils.ts`); the
7
+ * packages share no dependency edge, so the six lines are duplicated by
8
+ * convention.
9
+ */
10
+ export declare function trimTrailingSlashes(value: string): string;
11
+ export declare function trimSlashes(value: string): string;
@@ -1,35 +1,2 @@
1
- interface GurenVitePluginOptions {
2
- /** Alias prefix for application imports such as `@/.guren/routes.gen` (defaults to `@`). */
3
- appAlias?: string;
4
- /** Directory the alias resolves to, relative to the project root (defaults to `.`, the project root). */
5
- appDir?: string;
6
- /** Alias for the frontend resources directory (defaults to `@resources`). */
7
- resourcesAlias?: string;
8
- /** Relative path to the frontend resources directory (defaults to `resources/js`). */
9
- resourcesDir?: string;
10
- /** Path to the primary frontend entry file (defaults to `resources/js/app.tsx`). */
11
- entry?: string;
12
- /** Path to the SSR entry file (defaults to `resources/js/ssr.tsx`). */
13
- ssrEntry?: string;
14
- /** Output directory for compiled assets (defaults to `public/assets`). */
15
- outDir?: string;
16
- /** Output directory for SSR bundles (defaults to `.guren/ssr`). */
17
- ssrOutDir?: string;
18
- /** Default dev server port (defaults to 5173). */
19
- devPort?: number;
20
- /** Default preview server port (defaults to 4173). */
21
- previewPort?: number;
22
- /** Rollup naming pattern for entry chunks (defaults to `[name]-[hash].js`). */
23
- entryFileNames?: string;
24
- /** Rollup naming pattern for dynamic chunks (defaults to `[name]-[hash].js`). */
25
- chunkFileNames?: string;
26
- /** Rollup naming pattern for extracted assets (defaults to `[name]-[hash][extname]`). */
27
- assetFileNames?: string;
28
- }
29
- declare function gurenVitePlugin(options?: GurenVitePluginOptions): {
30
- name: string;
31
- enforce: "pre";
32
- config(config: Record<string, any>, env: Record<string, any>): void;
33
- };
34
-
35
- export { type GurenVitePluginOptions, gurenVitePlugin as default, gurenVitePlugin };
1
+ export { gurenVitePlugin as default, gurenVitePlugin } from './plugin.js';
2
+ export type { GurenVitePluginOptions } from './plugin.js';
@@ -41,9 +41,6 @@ function ensureAliases(config, options, root) {
41
41
  }
42
42
  function ensureServer(config, options) {
43
43
  config.server ??= {};
44
- if (config.server.host === void 0) {
45
- config.server.host = true;
46
- }
47
44
  if (config.server.port === void 0) {
48
45
  config.server.port = options.devPort;
49
46
  }
@@ -0,0 +1,34 @@
1
+ export interface GurenVitePluginOptions {
2
+ /** Alias prefix for application imports such as `@/.guren/routes.gen` (defaults to `@`). */
3
+ appAlias?: string;
4
+ /** Directory the alias resolves to, relative to the project root (defaults to `.`, the project root). */
5
+ appDir?: string;
6
+ /** Alias for the frontend resources directory (defaults to `@resources`). */
7
+ resourcesAlias?: string;
8
+ /** Relative path to the frontend resources directory (defaults to `resources/js`). */
9
+ resourcesDir?: string;
10
+ /** Path to the primary frontend entry file (defaults to `resources/js/app.tsx`). */
11
+ entry?: string;
12
+ /** Path to the SSR entry file (defaults to `resources/js/ssr.tsx`). */
13
+ ssrEntry?: string;
14
+ /** Output directory for compiled assets (defaults to `public/assets`). */
15
+ outDir?: string;
16
+ /** Output directory for SSR bundles (defaults to `.guren/ssr`). */
17
+ ssrOutDir?: string;
18
+ /** Default dev server port (defaults to 5173). */
19
+ devPort?: number;
20
+ /** Default preview server port (defaults to 4173). */
21
+ previewPort?: number;
22
+ /** Rollup naming pattern for entry chunks (defaults to `[name]-[hash].js`). */
23
+ entryFileNames?: string;
24
+ /** Rollup naming pattern for dynamic chunks (defaults to `[name]-[hash].js`). */
25
+ chunkFileNames?: string;
26
+ /** Rollup naming pattern for extracted assets (defaults to `[name]-[hash][extname]`). */
27
+ assetFileNames?: string;
28
+ }
29
+ export declare function gurenVitePlugin(options?: GurenVitePluginOptions): {
30
+ name: string;
31
+ enforce: "pre";
32
+ config(config: Record<string, any>, env: Record<string, any>): void;
33
+ };
34
+ export default gurenVitePlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guren/server",
3
- "version": "2.1.1",
3
+ "version": "2.3.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -100,16 +100,20 @@
100
100
  "./redis": {
101
101
  "types": "./dist/redis/index.d.ts",
102
102
  "default": "./dist/redis/index.js"
103
+ },
104
+ "./support/expiry": {
105
+ "types": "./dist/support/expiry.d.ts",
106
+ "default": "./dist/support/expiry.js"
103
107
  }
104
108
  },
105
109
  "scripts": {
106
- "build": "NODE_OPTIONS='--max-old-space-size=8192' tsup",
110
+ "build": "tsup && tsc -p tsconfig.build.json && bun ../../scripts/fix-dts-extensions.ts dist",
107
111
  "dev": "bun --watch src/index.ts",
108
112
  "typecheck": "tsc --noEmit",
109
113
  "test": "bun test"
110
114
  },
111
115
  "dependencies": {
112
- "@guren/orm": "^2.1.0",
116
+ "@guren/orm": "^2.2.1",
113
117
  "@modelcontextprotocol/sdk": "^1.30.0",
114
118
  "chalk": "^5.3.0",
115
119
  "consola": "^3.4.2",
@@ -1,79 +0,0 @@
1
- import { Context } from 'hono';
2
- import { Model } from '@guren/orm';
3
- import { A as Authenticatable, U as UserProvider, a as AuthCredentials, b as AuthManagerContract, c as AuthManagerOptions, G as GuardFactory, P as ProviderFactory, d as GuardContext, e as Guard, f as AttachContextOptions, g as AuthContext } from './api-token-D24VPr_E.js';
4
-
5
- interface PasswordHasher {
6
- hash(plain: string): Promise<string>;
7
- verify(hashed: string, plain: string): Promise<boolean>;
8
- needsRehash?(hashed: string): boolean;
9
- }
10
-
11
- declare abstract class BaseUserProvider<User extends Authenticatable = Authenticatable> implements UserProvider<User> {
12
- abstract retrieveById(identifier: unknown): Promise<User | null>;
13
- abstract retrieveByCredentials(credentials: AuthCredentials): Promise<User | null>;
14
- abstract validateCredentials(user: User, credentials: AuthCredentials): Promise<boolean>;
15
- abstract getId(user: User): unknown;
16
- setRememberToken(user: User, token: string | null): Promise<void>;
17
- getRememberToken(user: User): Promise<string | null>;
18
- }
19
-
20
- interface ModelUserProviderOptions {
21
- idColumn?: string;
22
- usernameColumn?: string;
23
- passwordColumn?: string;
24
- rememberTokenColumn?: string;
25
- hasher?: PasswordHasher;
26
- credentialsPasswordField?: string;
27
- }
28
- declare class ModelUserProvider<User extends Authenticatable = Authenticatable> extends BaseUserProvider<User> {
29
- private readonly model;
30
- private readonly idColumn;
31
- private readonly usernameColumn;
32
- private readonly passwordColumn;
33
- private readonly rememberTokenColumn;
34
- private readonly hasher;
35
- private readonly credentialsPasswordField;
36
- constructor(model: typeof Model, options?: ModelUserProviderOptions);
37
- private cast;
38
- retrieveById(identifier: unknown): Promise<User | null>;
39
- retrieveByCredentials(credentials: AuthCredentials): Promise<User | null>;
40
- validateCredentials(user: User, credentials: AuthCredentials): Promise<boolean>;
41
- getId(user: User): unknown;
42
- /**
43
- * Strip the password hash, remember token, and the model's `hidden`
44
- * fields before the record leaves the auth layer. Credential
45
- * validation happens on the raw record before sanitizing, so this
46
- * never affects login — only what `auth.user()` exposes.
47
- */
48
- sanitize(user: User): User;
49
- setRememberToken(user: User, token: string | null): Promise<void>;
50
- getRememberToken(user: User): Promise<string | null>;
51
- }
52
-
53
- declare class AuthManager implements AuthManagerContract {
54
- private readonly guards;
55
- private readonly providers;
56
- private defaultGuard;
57
- constructor(options?: AuthManagerOptions);
58
- registerGuard<User>(name: string, factory: GuardFactory<User>): void;
59
- registerProvider<User>(name: string, factory: ProviderFactory<User>): void;
60
- getProvider<User>(name: string): UserProvider<User>;
61
- createGuard<User>(name: string, context: GuardContext): Guard<User>;
62
- guardNames(): string[];
63
- setDefaultGuard(name: string): void;
64
- getDefaultGuard(): string;
65
- createAuthContext(ctx: Context, options?: AttachContextOptions): AuthContext;
66
- attempt(name: string, ctx: Context, credentials: AuthCredentials, remember?: boolean): Promise<boolean>;
67
- /**
68
- * Shorthand method to register a model-based authentication provider and session guard.
69
- * This simplifies the common case of authenticating users via a database model.
70
- *
71
- * @param model - The model class to use for user authentication
72
- * @param options - Options for the ModelUserProvider (partial, with defaults)
73
- * @param providerName - Name for the provider (defaults to 'users')
74
- * @param guardName - Name for the guard (defaults to 'web')
75
- */
76
- useModel(model: typeof Model<PlainObject>, options?: Partial<ModelUserProviderOptions>, providerName?: string, guardName?: string): void;
77
- }
78
-
79
- export { AuthManager as A, BaseUserProvider as B, ModelUserProvider as M, type PasswordHasher as P };