@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,41 +1,5 @@
1
- import { P as ParsedCron } from '../Scheduler-pZiT8i57.js';
2
- export { J as JobClass, a as PendingSchedule, b as Schedule, c as ScheduledTask, S as Scheduler, d as SchedulerOptions, T as TaskCallback, e as TaskDefinition, f as createScheduler } from '../Scheduler-pZiT8i57.js';
3
-
4
- /**
5
- * Parse a cron expression.
6
- *
7
- * Cron format: minute hour dayOfMonth month dayOfWeek
8
- *
9
- * Examples:
10
- * - Every minute: "* * * * *"
11
- * - Every 5 minutes: "*​/5 * * * *" (step value)
12
- * - At 3:00 AM daily: "0 3 * * *"
13
- * - Every Monday at 9:00 AM: "0 9 * * 1"
14
- */
15
- declare function parseCron(expression: string): ParsedCron;
16
- /**
17
- * Check if a date matches a parsed cron expression.
18
- */
19
- declare function matchesCron(date: Date, cron: ParsedCron): boolean;
20
- /**
21
- * Get the next occurrence of a cron expression.
22
- */
23
- declare function getNextOccurrence(expression: string, from?: Date): Date;
24
- /**
25
- * Check if a cron expression is due at the given date.
26
- */
27
- declare function isDue(expression: string, date?: Date): boolean;
28
- /**
29
- * Get multiple next occurrences.
30
- */
31
- declare function getNextOccurrences(expression: string, count: number, from?: Date): Date[];
32
- /**
33
- * Convert a Date to a specific timezone.
34
- */
35
- declare function toTimezone(date: Date, timezone: string): Date;
36
- /**
37
- * Check if a cron expression is due in a specific timezone.
38
- */
39
- declare function isDueInTimezone(expression: string, timezone: string, date?: Date): boolean;
40
-
41
- export { ParsedCron, getNextOccurrence, getNextOccurrences, isDue, isDueInTimezone, matchesCron, parseCron, toTimezone };
1
+ export type { TaskCallback, TaskDefinition, SchedulerOptions, ParsedCron, JobClass, } from './types.js';
2
+ export { parseCron, matchesCron, getNextOccurrence, getNextOccurrences, isDue, isDueInTimezone, toTimezone, } from './CronParser.js';
3
+ export { ScheduledTask } from './ScheduledTask.js';
4
+ export { PendingSchedule, Schedule } from './Schedule.js';
5
+ export { Scheduler, createScheduler } from './Scheduler.js';
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Scheduled task callback.
3
+ */
4
+ export type TaskCallback = () => void | Promise<void>;
5
+ /**
6
+ * Task definition.
7
+ */
8
+ export interface TaskDefinition {
9
+ /**
10
+ * Task name.
11
+ */
12
+ name?: string;
13
+ /**
14
+ * Cron expression.
15
+ */
16
+ expression: string;
17
+ /**
18
+ * Timezone for the schedule.
19
+ */
20
+ timezone?: string;
21
+ /**
22
+ * Task callback.
23
+ */
24
+ callback: TaskCallback;
25
+ /**
26
+ * Prevent overlapping executions.
27
+ */
28
+ withoutOverlapping?: boolean;
29
+ /**
30
+ * Overlap expiration in milliseconds.
31
+ */
32
+ overlapExpiresAt?: number;
33
+ /**
34
+ * Only run on one server (requires distributed lock).
35
+ */
36
+ onOneServer?: boolean;
37
+ /**
38
+ * Condition callback to determine if task should run.
39
+ */
40
+ when?: () => boolean | Promise<boolean>;
41
+ /**
42
+ * Condition callback to skip execution.
43
+ */
44
+ skip?: () => boolean | Promise<boolean>;
45
+ /**
46
+ * Before execution callback.
47
+ */
48
+ before?: () => void | Promise<void>;
49
+ /**
50
+ * After execution callback.
51
+ */
52
+ after?: () => void | Promise<void>;
53
+ /**
54
+ * On success callback.
55
+ */
56
+ onSuccess?: () => void | Promise<void>;
57
+ /**
58
+ * On failure callback.
59
+ */
60
+ onFailure?: (error: Error) => void | Promise<void>;
61
+ }
62
+ /**
63
+ * Scheduler options.
64
+ */
65
+ export interface SchedulerOptions {
66
+ /**
67
+ * Timezone for all scheduled tasks.
68
+ * @default 'UTC'
69
+ */
70
+ timezone?: string;
71
+ /**
72
+ * Check interval in milliseconds.
73
+ * @default 60000 (1 minute)
74
+ */
75
+ checkInterval?: number;
76
+ /**
77
+ * Logger function.
78
+ */
79
+ logger?: (message: string) => void;
80
+ }
81
+ /**
82
+ * Parsed cron expression.
83
+ */
84
+ export interface ParsedCron {
85
+ minute: number[];
86
+ hour: number[];
87
+ dayOfMonth: number[];
88
+ month: number[];
89
+ dayOfWeek: number[];
90
+ }
91
+ /**
92
+ * Job class interface for scheduling.
93
+ */
94
+ export interface JobClass<T = unknown> {
95
+ dispatch(payload: T): Promise<void>;
96
+ dispatchAfter?(delayMs: number, payload: T): Promise<void>;
97
+ }
@@ -0,0 +1,65 @@
1
+ import type { StorageDriver, StorageDriverFactory, StorageConfig } from './types.js';
2
+ /**
3
+ * Storage manager for handling multiple storage disks.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const storage = new StorageManager({
8
+ * default: 'local',
9
+ * disks: {
10
+ * local: { driver: 'local', root: './storage/app' },
11
+ * s3: { driver: 's3', bucket: 'my-bucket', region: 'ap-northeast-1' },
12
+ * }
13
+ * })
14
+ *
15
+ * // Use the default disk
16
+ * await storage.disk().put('avatars/user-1.jpg', imageBuffer)
17
+ *
18
+ * // Use a specific disk
19
+ * await storage.disk('s3').put('avatars/user-1.jpg', imageBuffer)
20
+ * ```
21
+ */
22
+ export declare class StorageManager {
23
+ private readonly defaultDiskName;
24
+ private readonly diskFactories;
25
+ private readonly resolvedDisks;
26
+ private driverFactories;
27
+ constructor(config?: StorageConfig);
28
+ /**
29
+ * Register built-in disk drivers.
30
+ */
31
+ private registerBuiltinDrivers;
32
+ /**
33
+ * Register a disk from configuration.
34
+ */
35
+ private registerDiskFromConfig;
36
+ /**
37
+ * Get a storage disk by name.
38
+ * Returns the default disk if no name is specified.
39
+ */
40
+ disk(name?: string): StorageDriver;
41
+ /**
42
+ * Register a custom disk factory.
43
+ */
44
+ registerDisk(name: string, factory: StorageDriverFactory): void;
45
+ /**
46
+ * Register a custom driver.
47
+ */
48
+ registerDriver(name: string, factory: (options: unknown) => StorageDriver): void;
49
+ /**
50
+ * Check if a disk is registered.
51
+ */
52
+ hasDisk(name: string): boolean;
53
+ /**
54
+ * Get the default disk name.
55
+ */
56
+ getDefaultDiskName(): string;
57
+ /**
58
+ * Get all registered disk names.
59
+ */
60
+ getDiskNames(): string[];
61
+ }
62
+ /**
63
+ * Create a storage manager with configuration.
64
+ */
65
+ export declare function createStorageManager(config?: StorageConfig): StorageManager;
@@ -0,0 +1,55 @@
1
+ import type { StorageDriver, LocalDriverOptions, PutOptions, FileMetadata } from '../types.js';
2
+ /**
3
+ * Local filesystem storage driver.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const driver = new LocalDriver({
8
+ * root: './storage/app',
9
+ * url: '/storage',
10
+ * })
11
+ *
12
+ * await driver.put('avatars/user-1.jpg', imageBuffer)
13
+ * const url = driver.url('avatars/user-1.jpg')
14
+ * ```
15
+ */
16
+ export declare class LocalDriver implements StorageDriver {
17
+ private readonly root;
18
+ private readonly baseUrl;
19
+ private readonly defaultVisibility;
20
+ constructor(options: LocalDriverOptions);
21
+ /**
22
+ * Get the full path for a file.
23
+ * Rejects paths that resolve outside the storage root (e.g. via `../`).
24
+ */
25
+ private fullPath;
26
+ /**
27
+ * Ensure the directory exists.
28
+ */
29
+ private ensureDirectory;
30
+ put(path: string, content: Buffer | string, options?: PutOptions): Promise<string>;
31
+ putFile(path: string, localPath: string, options?: PutOptions): Promise<string>;
32
+ get(path: string): Promise<Buffer | null>;
33
+ getAsString(path: string): Promise<string | null>;
34
+ exists(path: string): Promise<boolean>;
35
+ delete(path: string): Promise<boolean>;
36
+ deleteMany(paths: string[]): Promise<number>;
37
+ copy(from: string, to: string): Promise<string>;
38
+ move(from: string, to: string): Promise<string>;
39
+ url(path: string): string;
40
+ temporaryUrl(path: string, expiration: Date): Promise<string>;
41
+ size(path: string): Promise<number>;
42
+ lastModified(path: string): Promise<Date>;
43
+ metadata(path: string): Promise<FileMetadata | null>;
44
+ files(directory: string): Promise<string[]>;
45
+ directories(directory: string): Promise<string[]>;
46
+ allFiles(directory: string): Promise<string[]>;
47
+ makeDirectory(path: string): Promise<void>;
48
+ deleteDirectory(path: string): Promise<void>;
49
+ setVisibility(path: string, visibility: 'public' | 'private'): Promise<void>;
50
+ getVisibility(path: string): Promise<'public' | 'private'>;
51
+ /**
52
+ * Get the root directory.
53
+ */
54
+ getRoot(): string;
55
+ }
@@ -0,0 +1,66 @@
1
+ import type { StorageDriver, MemoryDriverOptions, PutOptions, FileMetadata } from '../types.js';
2
+ /**
3
+ * In-memory storage driver for testing.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const driver = new MemoryDriver()
8
+ *
9
+ * await driver.put('avatars/user-1.jpg', imageBuffer)
10
+ * const content = await driver.get('avatars/user-1.jpg')
11
+ * ```
12
+ */
13
+ export declare class MemoryDriver implements StorageDriver {
14
+ private readonly storage;
15
+ private readonly baseUrl;
16
+ constructor(options?: MemoryDriverOptions);
17
+ /**
18
+ * Normalize path (remove leading/trailing slashes).
19
+ */
20
+ private normalizePath;
21
+ /**
22
+ * Get directory from path.
23
+ */
24
+ private getDirectory;
25
+ /**
26
+ * Check if a path is in a directory.
27
+ */
28
+ private isInDirectory;
29
+ /**
30
+ * Check if a path is under a directory (recursive).
31
+ */
32
+ private isUnderDirectory;
33
+ put(path: string, content: Buffer | string, options?: PutOptions): Promise<string>;
34
+ putFile(path: string, localPath: string, options?: PutOptions): Promise<string>;
35
+ get(path: string): Promise<Buffer | null>;
36
+ getAsString(path: string): Promise<string | null>;
37
+ exists(path: string): Promise<boolean>;
38
+ delete(path: string): Promise<boolean>;
39
+ deleteMany(paths: string[]): Promise<number>;
40
+ copy(from: string, to: string): Promise<string>;
41
+ move(from: string, to: string): Promise<string>;
42
+ url(path: string): string;
43
+ temporaryUrl(path: string, expiration: Date): Promise<string>;
44
+ size(path: string): Promise<number>;
45
+ lastModified(path: string): Promise<Date>;
46
+ metadata(path: string): Promise<FileMetadata | null>;
47
+ files(directory: string): Promise<string[]>;
48
+ directories(directory: string): Promise<string[]>;
49
+ allFiles(directory: string): Promise<string[]>;
50
+ makeDirectory(path: string): Promise<void>;
51
+ deleteDirectory(path: string): Promise<void>;
52
+ setVisibility(path: string, visibility: 'public' | 'private'): Promise<void>;
53
+ getVisibility(path: string): Promise<'public' | 'private'>;
54
+ /**
55
+ * Clear all files (for testing).
56
+ */
57
+ clear(): void;
58
+ /**
59
+ * Get the number of stored files.
60
+ */
61
+ count(): number;
62
+ /**
63
+ * Get all stored file paths.
64
+ */
65
+ getAllPaths(): string[];
66
+ }
@@ -0,0 +1,72 @@
1
+ import type { StorageDriver, S3DriverOptions, PutOptions, FileMetadata } from '../types.js';
2
+ /**
3
+ * AWS S3 storage driver.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { S3Client } from '@aws-sdk/client-s3'
8
+ *
9
+ * const client = new S3Client({ region: 'ap-northeast-1' })
10
+ * const driver = new S3Driver({
11
+ * client,
12
+ * bucket: 'my-bucket',
13
+ * })
14
+ *
15
+ * await driver.put('avatars/user-1.jpg', imageBuffer)
16
+ * const url = driver.url('avatars/user-1.jpg')
17
+ * ```
18
+ */
19
+ export declare class S3Driver implements StorageDriver {
20
+ private readonly options;
21
+ private client;
22
+ private readonly bucket;
23
+ private readonly region;
24
+ private readonly endpoint?;
25
+ private readonly accessKeyId?;
26
+ private readonly secretAccessKey?;
27
+ private readonly prefix;
28
+ private readonly baseUrl;
29
+ private readonly defaultVisibility;
30
+ constructor(options: S3DriverOptions);
31
+ /**
32
+ * Get or create the S3 client.
33
+ */
34
+ private getClient;
35
+ /**
36
+ * Get the prefixed key.
37
+ */
38
+ private prefixKey;
39
+ /**
40
+ * Get ACL from visibility.
41
+ */
42
+ private getAcl;
43
+ put(path: string, content: Buffer | string, options?: PutOptions): Promise<string>;
44
+ putFile(path: string, localPath: string, options?: PutOptions): Promise<string>;
45
+ get(path: string): Promise<Buffer | null>;
46
+ getAsString(path: string): Promise<string | null>;
47
+ exists(path: string): Promise<boolean>;
48
+ delete(path: string): Promise<boolean>;
49
+ deleteMany(paths: string[]): Promise<number>;
50
+ copy(from: string, to: string): Promise<string>;
51
+ move(from: string, to: string): Promise<string>;
52
+ url(path: string): string;
53
+ temporaryUrl(path: string, expiration: Date): Promise<string>;
54
+ size(path: string): Promise<number>;
55
+ lastModified(path: string): Promise<Date>;
56
+ metadata(path: string): Promise<FileMetadata | null>;
57
+ files(directory: string): Promise<string[]>;
58
+ directories(directory: string): Promise<string[]>;
59
+ allFiles(directory: string): Promise<string[]>;
60
+ makeDirectory(path: string): Promise<void>;
61
+ deleteDirectory(path: string): Promise<void>;
62
+ setVisibility(path: string, visibility: 'public' | 'private'): Promise<void>;
63
+ getVisibility(path: string): Promise<'public' | 'private'>;
64
+ /**
65
+ * Get the bucket name.
66
+ */
67
+ getBucket(): string;
68
+ /**
69
+ * Get the prefix.
70
+ */
71
+ getPrefix(): string;
72
+ }
@@ -1,197 +1,5 @@
1
- import { b as StorageDriver, L as LocalDriverOptions, P as PutOptions, F as FileMetadata, e as S3DriverOptions, M as MemoryDriverOptions } from '../StorageManager-oZTHqaza.js';
2
- export { D as DiskConfig, f as DriverConfig, a as StorageConfig, c as StorageDriverFactory, S as StorageManager, d as createStorageManager } from '../StorageManager-oZTHqaza.js';
3
-
4
- /**
5
- * Local filesystem storage driver.
6
- *
7
- * @example
8
- * ```ts
9
- * const driver = new LocalDriver({
10
- * root: './storage/app',
11
- * url: '/storage',
12
- * })
13
- *
14
- * await driver.put('avatars/user-1.jpg', imageBuffer)
15
- * const url = driver.url('avatars/user-1.jpg')
16
- * ```
17
- */
18
- declare class LocalDriver implements StorageDriver {
19
- private readonly root;
20
- private readonly baseUrl;
21
- private readonly defaultVisibility;
22
- constructor(options: LocalDriverOptions);
23
- /**
24
- * Get the full path for a file.
25
- * Rejects paths that resolve outside the storage root (e.g. via `../`).
26
- */
27
- private fullPath;
28
- /**
29
- * Ensure the directory exists.
30
- */
31
- private ensureDirectory;
32
- put(path: string, content: Buffer | string, options?: PutOptions): Promise<string>;
33
- putFile(path: string, localPath: string, options?: PutOptions): Promise<string>;
34
- get(path: string): Promise<Buffer | null>;
35
- getAsString(path: string): Promise<string | null>;
36
- exists(path: string): Promise<boolean>;
37
- delete(path: string): Promise<boolean>;
38
- deleteMany(paths: string[]): Promise<number>;
39
- copy(from: string, to: string): Promise<string>;
40
- move(from: string, to: string): Promise<string>;
41
- url(path: string): string;
42
- temporaryUrl(path: string, expiration: Date): Promise<string>;
43
- size(path: string): Promise<number>;
44
- lastModified(path: string): Promise<Date>;
45
- metadata(path: string): Promise<FileMetadata | null>;
46
- files(directory: string): Promise<string[]>;
47
- directories(directory: string): Promise<string[]>;
48
- allFiles(directory: string): Promise<string[]>;
49
- makeDirectory(path: string): Promise<void>;
50
- deleteDirectory(path: string): Promise<void>;
51
- setVisibility(path: string, visibility: 'public' | 'private'): Promise<void>;
52
- getVisibility(path: string): Promise<'public' | 'private'>;
53
- /**
54
- * Get the root directory.
55
- */
56
- getRoot(): string;
57
- }
58
-
59
- /**
60
- * AWS S3 storage driver.
61
- *
62
- * @example
63
- * ```ts
64
- * import { S3Client } from '@aws-sdk/client-s3'
65
- *
66
- * const client = new S3Client({ region: 'ap-northeast-1' })
67
- * const driver = new S3Driver({
68
- * client,
69
- * bucket: 'my-bucket',
70
- * })
71
- *
72
- * await driver.put('avatars/user-1.jpg', imageBuffer)
73
- * const url = driver.url('avatars/user-1.jpg')
74
- * ```
75
- */
76
- declare class S3Driver implements StorageDriver {
77
- private readonly options;
78
- private client;
79
- private readonly bucket;
80
- private readonly region;
81
- private readonly endpoint?;
82
- private readonly accessKeyId?;
83
- private readonly secretAccessKey?;
84
- private readonly prefix;
85
- private readonly baseUrl;
86
- private readonly defaultVisibility;
87
- constructor(options: S3DriverOptions);
88
- /**
89
- * Get or create the S3 client.
90
- */
91
- private getClient;
92
- /**
93
- * Get the prefixed key.
94
- */
95
- private prefixKey;
96
- /**
97
- * Get ACL from visibility.
98
- */
99
- private getAcl;
100
- put(path: string, content: Buffer | string, options?: PutOptions): Promise<string>;
101
- putFile(path: string, localPath: string, options?: PutOptions): Promise<string>;
102
- get(path: string): Promise<Buffer | null>;
103
- getAsString(path: string): Promise<string | null>;
104
- exists(path: string): Promise<boolean>;
105
- delete(path: string): Promise<boolean>;
106
- deleteMany(paths: string[]): Promise<number>;
107
- copy(from: string, to: string): Promise<string>;
108
- move(from: string, to: string): Promise<string>;
109
- url(path: string): string;
110
- temporaryUrl(path: string, expiration: Date): Promise<string>;
111
- size(path: string): Promise<number>;
112
- lastModified(path: string): Promise<Date>;
113
- metadata(path: string): Promise<FileMetadata | null>;
114
- files(directory: string): Promise<string[]>;
115
- directories(directory: string): Promise<string[]>;
116
- allFiles(directory: string): Promise<string[]>;
117
- makeDirectory(path: string): Promise<void>;
118
- deleteDirectory(path: string): Promise<void>;
119
- setVisibility(path: string, visibility: 'public' | 'private'): Promise<void>;
120
- getVisibility(path: string): Promise<'public' | 'private'>;
121
- /**
122
- * Get the bucket name.
123
- */
124
- getBucket(): string;
125
- /**
126
- * Get the prefix.
127
- */
128
- getPrefix(): string;
129
- }
130
-
131
- /**
132
- * In-memory storage driver for testing.
133
- *
134
- * @example
135
- * ```ts
136
- * const driver = new MemoryDriver()
137
- *
138
- * await driver.put('avatars/user-1.jpg', imageBuffer)
139
- * const content = await driver.get('avatars/user-1.jpg')
140
- * ```
141
- */
142
- declare class MemoryDriver implements StorageDriver {
143
- private readonly storage;
144
- private readonly baseUrl;
145
- constructor(options?: MemoryDriverOptions);
146
- /**
147
- * Normalize path (remove leading/trailing slashes).
148
- */
149
- private normalizePath;
150
- /**
151
- * Get directory from path.
152
- */
153
- private getDirectory;
154
- /**
155
- * Check if a path is in a directory.
156
- */
157
- private isInDirectory;
158
- /**
159
- * Check if a path is under a directory (recursive).
160
- */
161
- private isUnderDirectory;
162
- put(path: string, content: Buffer | string, options?: PutOptions): Promise<string>;
163
- putFile(path: string, localPath: string, options?: PutOptions): Promise<string>;
164
- get(path: string): Promise<Buffer | null>;
165
- getAsString(path: string): Promise<string | null>;
166
- exists(path: string): Promise<boolean>;
167
- delete(path: string): Promise<boolean>;
168
- deleteMany(paths: string[]): Promise<number>;
169
- copy(from: string, to: string): Promise<string>;
170
- move(from: string, to: string): Promise<string>;
171
- url(path: string): string;
172
- temporaryUrl(path: string, expiration: Date): Promise<string>;
173
- size(path: string): Promise<number>;
174
- lastModified(path: string): Promise<Date>;
175
- metadata(path: string): Promise<FileMetadata | null>;
176
- files(directory: string): Promise<string[]>;
177
- directories(directory: string): Promise<string[]>;
178
- allFiles(directory: string): Promise<string[]>;
179
- makeDirectory(path: string): Promise<void>;
180
- deleteDirectory(path: string): Promise<void>;
181
- setVisibility(path: string, visibility: 'public' | 'private'): Promise<void>;
182
- getVisibility(path: string): Promise<'public' | 'private'>;
183
- /**
184
- * Clear all files (for testing).
185
- */
186
- clear(): void;
187
- /**
188
- * Get the number of stored files.
189
- */
190
- count(): number;
191
- /**
192
- * Get all stored file paths.
193
- */
194
- getAllPaths(): string[];
195
- }
196
-
197
- export { FileMetadata, LocalDriver, LocalDriverOptions, MemoryDriver, MemoryDriverOptions, PutOptions, S3Driver, S3DriverOptions, StorageDriver };
1
+ export type { StorageDriver, StorageDriverFactory, StorageConfig, DiskConfig, PutOptions, FileMetadata, LocalDriverOptions, S3DriverOptions, MemoryDriverOptions, DriverConfig, } from './types.js';
2
+ export { LocalDriver } from './drivers/LocalDriver.js';
3
+ export { S3Driver } from './drivers/S3Driver.js';
4
+ export { MemoryDriver } from './drivers/MemoryDriver.js';
5
+ export { StorageManager, createStorageManager } from './StorageManager.js';