@guren/server 2.14.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 (297) hide show
  1. package/dist/{DocsViewerServiceProvider-qFCaeiUv.js → DocsViewerServiceProvider-D2cuVgtN.js} +7 -12
  2. package/dist/{Hash-CzrwKeDp.js → Hash-D2DFd8xX.js} +12 -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 +31 -0
  8. package/dist/agent/approval.d.ts +184 -0
  9. package/dist/agent/audit-emitter.d.ts +36 -0
  10. package/dist/agent/audit.d.ts +67 -0
  11. package/dist/agent/derive.d.ts +32 -66
  12. package/dist/agent/dispatch.d.ts +53 -63
  13. package/dist/agent/events.d.ts +11 -19
  14. package/dist/agent/meta-tools.d.ts +34 -0
  15. package/dist/agent/public.d.ts +14 -0
  16. package/dist/agent/public.js +2 -0
  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 +9 -5
  29. package/dist/auth/password/PasswordHasher.d.ts +7 -0
  30. package/dist/auth/password/hash-format.d.ts +11 -0
  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-BSUc14CD.js → auth-CbdPH4Cd.js} +252 -496
  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-BxU-LIfF.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 +10 -12
  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-BAwzftws.js +238 -0
  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-DJtkkhiw.js → encryption-uwP3Di4D.js} +13 -79
  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 +16 -18
  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 +14 -0
  148. package/dist/http/request.d.ts +49 -48
  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 +21 -0
  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 +13 -4
  170. package/dist/index.js +1036 -3080
  171. package/dist/internal/agent-preflight.d.ts +9 -21
  172. package/dist/internal/request.d.ts +10 -17
  173. package/dist/internal/request.js +2 -2
  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 -5
  187. package/dist/logging/channels/FileChannel.d.ts +1 -3
  188. package/dist/logging/daily-file-path.d.ts +15 -0
  189. package/dist/logging/index.d.ts +1 -0
  190. package/dist/logging/index.js +2 -2
  191. package/dist/logging/types.d.ts +13 -45
  192. package/dist/{logging-CPaRMuPP.js → logging-zOY1XCtq.js} +83 -129
  193. package/dist/{loopback-guard-D0Kc7-xc.js → loopback-guard-DT9gHF0F.js} +41 -92
  194. package/dist/mail/Mail.d.ts +10 -106
  195. package/dist/mail/MailManager.d.ts +2 -60
  196. package/dist/mail/index.js +1 -1
  197. package/dist/mail/transports/LogTransport.d.ts +1 -4
  198. package/dist/mail/transports/MemoryTransport.d.ts +1 -63
  199. package/dist/mail/transports/ResendTransport.d.ts +1 -23
  200. package/dist/mail/transports/SmtpTransport.d.ts +1 -31
  201. package/dist/mail/types.d.ts +28 -150
  202. package/dist/{mail-DfEfSQEr.js → mail-76DWy9lj.js} +31 -289
  203. package/dist/mcp/McpServiceProvider.d.ts +4 -10
  204. package/dist/mcp/create-mcp-server.d.ts +25 -57
  205. package/dist/mcp/endpoint.d.ts +12 -36
  206. package/dist/mcp/index.js +1 -1
  207. package/dist/mvc/Controller.d.ts +46 -253
  208. package/dist/mvc/Router.d.ts +50 -129
  209. package/dist/mvc/inertia/InertiaEngine.d.ts +18 -48
  210. package/dist/mvc/inertia/shared.d.ts +6 -19
  211. package/dist/mvc/mount-route.d.ts +2 -6
  212. package/dist/mvc/view.d.ts +1 -2
  213. package/dist/notifications/Notification.d.ts +8 -75
  214. package/dist/notifications/NotificationManager.d.ts +15 -88
  215. package/dist/notifications/channels/DatabaseChannel.d.ts +1 -41
  216. package/dist/notifications/channels/MailChannel.d.ts +2 -31
  217. package/dist/notifications/channels/MemoryChannel.d.ts +2 -62
  218. package/dist/notifications/channels/SlackChannel.d.ts +3 -48
  219. package/dist/notifications/index.js +1 -1
  220. package/dist/notifications/notifiable-type.d.ts +3 -6
  221. package/dist/notifications/registry.d.ts +8 -27
  222. package/dist/notifications/types.d.ts +16 -53
  223. package/dist/{notifications-BGqmUNZ8.js → notifications-okWFs9ly.js} +37 -335
  224. package/dist/providers/AuthServiceProvider.d.ts +1 -3
  225. package/dist/providers/AuthorizationServiceProvider.d.ts +2 -3
  226. package/dist/providers/BroadcastServiceProvider.d.ts +1 -3
  227. package/dist/providers/CacheServiceProvider.d.ts +1 -3
  228. package/dist/providers/EncryptionServiceProvider.d.ts +1 -3
  229. package/dist/providers/ErrorServiceProvider.d.ts +1 -4
  230. package/dist/providers/EventServiceProvider.d.ts +1 -3
  231. package/dist/providers/HealthServiceProvider.d.ts +1 -3
  232. package/dist/providers/I18nServiceProvider.d.ts +6 -10
  233. package/dist/providers/InertiaServiceProvider.d.ts +1 -4
  234. package/dist/providers/LogServiceProvider.d.ts +1 -3
  235. package/dist/providers/MailServiceProvider.d.ts +1 -3
  236. package/dist/providers/NotificationServiceProvider.d.ts +1 -3
  237. package/dist/providers/OAuthServiceProvider.d.ts +1 -3
  238. package/dist/providers/QueueServiceProvider.d.ts +1 -3
  239. package/dist/providers/SchedulingServiceProvider.d.ts +1 -3
  240. package/dist/providers/StorageServiceProvider.d.ts +1 -3
  241. package/dist/queue/FailedJobReporter.d.ts +1 -24
  242. package/dist/queue/Job.d.ts +12 -99
  243. package/dist/queue/QueueManager.d.ts +6 -57
  244. package/dist/queue/Worker.d.ts +4 -65
  245. package/dist/queue/drivers/MemoryDriver.d.ts +3 -44
  246. package/dist/queue/drivers/RedisDriver.d.ts +7 -65
  247. package/dist/queue/drivers/SqsDriver.d.ts +6 -57
  248. package/dist/queue/drivers/SyncDriver.d.ts +10 -13
  249. package/dist/queue/index.js +2 -2
  250. package/dist/queue/types.d.ts +10 -92
  251. package/dist/{queue-CXrRK85G.js → queue-CcXCjuJI.js} +32 -260
  252. package/dist/redis/RedisApiTokenStore.d.ts +4 -56
  253. package/dist/redis/RedisEmailVerificationStore.d.ts +4 -37
  254. package/dist/redis/RedisOAuthStateStore.d.ts +2 -10
  255. package/dist/redis/RedisPasswordResetStore.d.ts +4 -37
  256. package/dist/redis/RedisRateLimitStore.d.ts +16 -49
  257. package/dist/redis/RedisSessionStore.d.ts +3 -44
  258. package/dist/redis/client.d.ts +2 -32
  259. package/dist/redis/index.js +47 -232
  260. package/dist/redis/redis-values.d.ts +6 -12
  261. package/dist/redis/scan-keys.d.ts +1 -4
  262. package/dist/request-CLOYytGP.js +68 -0
  263. package/dist/runtime/index.d.ts +2 -0
  264. package/dist/runtime/index.js +108 -74
  265. package/dist/scheduling/CronParser.d.ts +0 -29
  266. package/dist/scheduling/Schedule.d.ts +1 -153
  267. package/dist/scheduling/ScheduledTask.d.ts +0 -31
  268. package/dist/scheduling/Scheduler.d.ts +0 -70
  269. package/dist/scheduling/index.js +1 -1
  270. package/dist/scheduling/types.d.ts +4 -65
  271. package/dist/{scheduling-CPiEdtQd.js → scheduling-C6tcOtUl.js} +2 -287
  272. package/dist/storage/StorageManager.d.ts +0 -48
  273. package/dist/storage/drivers/LocalDriver.d.ts +1 -25
  274. package/dist/storage/drivers/MemoryDriver.d.ts +5 -35
  275. package/dist/storage/drivers/S3Driver.d.ts +6 -36
  276. package/dist/storage/drivers/s3-acl.d.ts +5 -10
  277. package/dist/storage/index.js +1 -1
  278. package/dist/storage/types.d.ts +27 -265
  279. package/dist/{storage-TLD9t0Q2.js → storage-BB59f07j.js} +17 -157
  280. package/dist/support/contained-path.d.ts +10 -20
  281. package/dist/support/error-polyfill.d.ts +4 -6
  282. package/dist/support/expiry.d.ts +17 -33
  283. package/dist/support/expiry.js +17 -33
  284. package/dist/support/import-map.d.ts +3 -7
  285. package/dist/support/inertia-defaults.d.ts +5 -10
  286. package/dist/support/redirect-target.d.ts +4 -6
  287. package/dist/support/stack-frames.d.ts +11 -50
  288. package/dist/support/trim-slashes.d.ts +4 -7
  289. package/dist/support/warn-once.d.ts +2 -6
  290. package/dist/{trim-slashes-ZJ_VsY5s.js → trim-slashes-BLY9hKAa.js} +4 -7
  291. package/dist/{vite-manifest-BGfWbPYp.js → vite-manifest-CTQp-SOo.js} +34 -58
  292. package/package.json +6 -2
  293. package/dist/client-Dd7vLcqp.js +0 -27
  294. package/dist/context-DoD0c7J_.js +0 -26
  295. package/dist/endpoint-D-20PiHY.js +0 -46
  296. package/dist/hot-disposables-WsTX2ySN.js +0 -281
  297. package/dist/request-CRVuIiQr.js +0 -78
@@ -5,56 +5,22 @@ import type { Provider } from './types.js';
5
5
  */
6
6
  export type ServiceProviderConstructor = new (container: Container) => ServiceProvider;
7
7
  /**
8
- * Base service provider class.
9
- *
10
- * Service providers are the central place of all application bootstrapping.
11
- * Your own application, as well as all core services, are bootstrapped via providers.
12
- *
13
- * @example
14
- * ```typescript
15
- * export class AppServiceProvider extends ServiceProvider {
16
- * register(): void {
17
- * // Register bindings
18
- * this.container.singleton('db', (c) => new Database(c.make('config')))
19
- * }
20
- *
21
- * boot(): void {
22
- * // Bootstrap after all providers registered
23
- * const db = this.container.make<Database>('db')
24
- * db.connect()
25
- * }
26
- * }
27
- * ```
8
+ * Base service provider: all application and core bootstrapping runs through
9
+ * providers. `register()` binds services before any provider boots; `boot()` runs
10
+ * after every provider has registered.
28
11
  */
29
12
  export declare abstract class ServiceProvider implements Provider {
30
13
  protected container: Container;
31
- /**
32
- * Whether this provider should be deferred.
33
- * Deferred providers are only loaded when one of their provided services is requested.
34
- */
14
+ /** Load only when one of `provides` is requested. */
35
15
  static deferred: boolean;
36
- /**
37
- * The services provided by this provider (for deferred loading).
38
- */
16
+ /** Services this provider supplies, for deferred loading. */
39
17
  static provides: string[];
40
18
  constructor(container: Container);
41
- /**
42
- * Register any application services.
43
- * This is called before any other providers have booted.
44
- */
19
+ /** Runs before any provider has booted. */
45
20
  abstract register(): void | Promise<void>;
46
- /**
47
- * Bootstrap any application services.
48
- * This is called after all providers have registered.
49
- */
21
+ /** Runs after all providers have registered. */
50
22
  boot?(): void | Promise<void>;
51
- /**
52
- * Get the services provided by the provider.
53
- */
54
23
  provides(): string[];
55
- /**
56
- * Check if this provider is deferred.
57
- */
58
24
  isDeferred(): boolean;
59
25
  }
60
26
  /**
@@ -66,38 +32,28 @@ export declare class ProviderManager {
66
32
  protected registered: Set<ServiceProvider>;
67
33
  protected booted: Set<ServiceProvider>;
68
34
  protected deferredProviders: Map<string, ServiceProvider>;
35
+ /** Per service, the boot of an already-activated deferred provider, so a later loadDeferredProvider() awaits that boot */
36
+ private deferredActivations;
69
37
  private allBooted;
70
38
  constructor(container: Container);
71
- /**
72
- * Register a provider.
73
- */
74
39
  register(providerOrClass: ServiceProvider | ServiceProviderConstructor): this;
75
- /**
76
- * Register multiple providers.
77
- */
78
40
  registerMany(providers: Array<ServiceProvider | ServiceProviderConstructor>): this;
79
- /**
80
- * Register all non-deferred providers.
81
- */
82
41
  registerAll(): Promise<void>;
83
- /**
84
- * Boot all registered providers.
85
- */
86
42
  bootAll(): Promise<void>;
87
43
  /**
88
- * Load a deferred provider for a service.
44
+ * Register, boot, and unclaim a deferred provider's services. Resolves once
45
+ * boot() has finished, also when Container.make() already activated it.
89
46
  */
90
47
  loadDeferredProvider(service: string): Promise<void>;
91
48
  /**
92
- * Check if a service is provided by a deferred provider.
49
+ * Synchronous half of deferred loading, so a synchronous Container.make() can
50
+ * resolve the service: register() runs before this returns; boot() follows on the
51
+ * returned promise, which make() does not await (a boot failure is an unhandled
52
+ * rejection). Services are unclaimed up front so a re-entrant make() for a sibling
53
+ * service cannot register the provider twice.
93
54
  */
55
+ private activateDeferredProvider;
94
56
  isDeferredService(service: string): boolean;
95
- /**
96
- * Get all registered providers.
97
- */
98
57
  getProviders(): ServiceProvider[];
99
- /**
100
- * Get all deferred services.
101
- */
102
58
  getDeferredServices(): string[];
103
59
  }
@@ -18,18 +18,8 @@ import type { Scheduler } from '../scheduling/index.js';
18
18
  import type { Gate } from '../authorization/Gate.js';
19
19
  import type { ExceptionHandler } from '../errors/index.js';
20
20
  import type { SharedInertiaPropsRegistry } from '../mvc/inertia/shared.js';
21
- /**
22
- * Type-safe service binding map.
23
- *
24
- * Maps service keys to their concrete types for type-safe resolution
25
- * via `container.make('key')`.
26
- *
27
- * @example
28
- * ```typescript
29
- * const events = container.make('events') // EventManager
30
- * const cache = container.make('cache') // CacheManager
31
- * ```
32
- */
21
+ import type { AgentAuditEmitter } from '../agent/audit-emitter.js';
22
+ /** Maps service keys to their concrete types, for `container.make('key')`. */
33
23
  export interface ServiceBindings {
34
24
  app: Application;
35
25
  hono: Hono;
@@ -51,5 +41,13 @@ export interface ServiceBindings {
51
41
  gate: Gate;
52
42
  /** Bound lazily on the first `shareInertiaProps(fn, container)` call. */
53
43
  'inertia.sharedProps': SharedInertiaPropsRegistry;
44
+ /**
45
+ * How an agent surface records what it did (RFC 0016 §5.2). Bound by
46
+ * `@guren/plugin-mcp` at boot, absent when no MCP plugin is registered. The
47
+ * binding is the *emitter*, not the sink, so every surface's records reach
48
+ * the same place the same way. The runtime spelling of this name lives in
49
+ * `AGENT_AUDIT_BINDING` — rename here and there together.
50
+ */
51
+ 'agent.audit': AgentAuditEmitter;
54
52
  'exception.handler': ExceptionHandler;
55
53
  }
@@ -2,11 +2,9 @@ import type { CommandClass } from '../console/types.js';
2
2
  import type { Router } from '../mvc/Router.js';
3
3
  import type { ServiceProviderConstructor } from './ServiceProvider.js';
4
4
  /**
5
- * Declarative definition of an application module — a self-contained
6
- * `modules/<name>/` directory that can register routes and providers, per
7
- * RFC 0002. Unlike `definePlugin()`, a module has no config stage and no
8
- * register/boot lifecycle of its own: it's a plain descriptor bundling
9
- * providers and a route registrar that `Application` folds into its own
5
+ * A self-contained `modules/<name>/` directory registering routes and
6
+ * providers (RFC 0002). Unlike `definePlugin()` it has no config stage and no
7
+ * register/boot lifecycle: `Application` folds the descriptor into its own
10
8
  * provider list and route mounting.
11
9
  */
12
10
  export interface ModuleDefinition {
@@ -14,8 +12,7 @@ export interface ModuleDefinition {
14
12
  name: string;
15
13
  /**
16
14
  * URL prefix applied to all module routes via `router.group(prefix, ...)`.
17
- * Declarative on purpose — tooling can read a module's URL surface
18
- * statically without executing the registrar.
15
+ * Declarative so tooling can read the URL surface without running the registrar.
19
16
  */
20
17
  prefix?: string;
21
18
  /** Route registrar, invoked after `options.routes` during boot. */
@@ -23,21 +20,16 @@ export interface ModuleDefinition {
23
20
  /** Providers appended to the application's provider list. */
24
21
  providers?: ServiceProviderConstructor[];
25
22
  /**
26
- * Console commands the module owns, exposed so the project's console
27
- * entrypoint can register them without importing module internals:
28
- * `kernel.registerMany(billingModule.commands)`. Nothing registers them
29
- * automatically — `Application` never builds a `ConsoleKernel`, and
30
- * command registration stays explicit so a bundled deployment resolves
31
- * the same commands as a local checkout.
23
+ * Console commands the module owns, for the project's console entrypoint to
24
+ * register (`kernel.registerMany(billingModule.commands)`). Nothing registers
25
+ * them automatically: `Application` never builds a `ConsoleKernel`, and
26
+ * explicit registration keeps a bundled deployment resolving the same set.
32
27
  */
33
28
  commands?: CommandClass[];
34
29
  }
35
30
  /**
36
- * A module as `Application` consumes it — `providers` and `commands`
37
- * normalized to always be arrays so callers don't repeat the `?? []`
38
- * fallback. `commands` in particular is read by hand-written console
39
- * entrypoints (`kernel.registerMany(billingModule.commands)`), where an
40
- * `undefined` would be a runtime error rather than a no-op.
31
+ * A module as `Application` consumes it: `providers` and `commands` normalized
32
+ * to arrays, so a console entrypoint reading `commands` cannot hit `undefined`.
41
33
  */
42
34
  export interface GurenModule {
43
35
  name: string;
@@ -46,43 +38,13 @@ export interface GurenModule {
46
38
  providers: ServiceProviderConstructor[];
47
39
  commands: CommandClass[];
48
40
  }
49
- /**
50
- * Define a Guren application module without boilerplate.
51
- *
52
- * @example
53
- * ```typescript
54
- * // modules/billing/index.ts
55
- * export const billingModule = defineModule({
56
- * name: 'billing',
57
- * prefix: '/billing',
58
- * routes: registerBillingRoutes,
59
- * providers: [BillingServiceProvider],
60
- * commands: [InvoiceCommand],
61
- * })
62
- *
63
- * // src/app.ts
64
- * createApp({ routes, providers, modules: [billingModule] })
65
- *
66
- * // src/console.ts
67
- * kernel.registerMany(billingModule.commands)
68
- * ```
69
- */
41
+ /** Define a Guren application module without boilerplate. */
70
42
  export declare function defineModule(definition: ModuleDefinition): GurenModule;
71
43
  /**
72
- * Runs a module's route registrar against `router`, applying its `prefix`
73
- * via `router.group()` when set. Shared by `Application.mountRoutes()` (at
74
- * boot) and the CLI's route loader (for `guren codegen`/`audit`/`routes`/
75
- * `openapi:generate`, which need the same route set without booting a real
76
- * app) so both stay in sync — a bugfix to one path fixes the other.
77
- *
78
- * `router.group(prefix, callback)`'s callback is synchronous — it pushes
79
- * the prefix, invokes the callback, then pops it, with no support for
80
- * awaiting inside. Capturing the registrar's return value and awaiting it
81
- * after `group()` returns preserves prefixing for the common case (a
82
- * synchronous registrar, or an async one that calls `router.get`/`post`/
83
- * etc. before its first `await`); route calls after an `await` inside an
84
- * async, prefixed module registrar would run with the prefix already
85
- * popped. Registrars with no prefix don't go through group() and have no
86
- * such limitation.
44
+ * Runs a module's route registrar, applying its `prefix` via `router.group()`.
45
+ * Shared by `Application.mountRoutes()` and the CLI's route loader, so both see
46
+ * the same route set. `router.group()`'s callback is synchronous (prefix
47
+ * pushed, callback run, prefix popped), so route calls made after an `await`
48
+ * inside an async prefixed registrar run with the prefix already popped.
87
49
  */
88
50
  export declare function mountModuleRoutes(router: Router, gurenModule: GurenModule): Promise<void>;
@@ -1,62 +1,29 @@
1
1
  import type { Container } from './Container.js';
2
2
  import { type ServiceProviderConstructor } from './ServiceProvider.js';
3
3
  /**
4
- * Declarative definition of a plugin's lifecycle hooks.
5
- *
6
- * `register` and `boot` mirror the ServiceProvider hooks and receive the
7
- * container plus the configuration captured by the plugin factory.
4
+ * A plugin's lifecycle hooks, mirroring the ServiceProvider ones and receiving
5
+ * the configuration captured by the plugin factory.
8
6
  */
9
7
  export interface PluginDefinition<TConfig = void> {
10
- /**
11
- * Diagnostic name for the plugin (e.g. 'analytics').
12
- * Used to derive the generated provider class name.
13
- */
8
+ /** Diagnostic name, also used for the generated provider class name. */
14
9
  name: string;
15
- /**
16
- * Register services into the container.
17
- * Called before any provider has booted.
18
- */
10
+ /** Called before any provider has booted. */
19
11
  register(container: Container, config: TConfig): void | Promise<void>;
20
- /**
21
- * Bootstrap after all providers have registered.
22
- */
12
+ /** Called after all providers have registered. */
23
13
  boot?(container: Container, config: TConfig): void | Promise<void>;
24
- /**
25
- * Defer instantiation until one of the `provides` services is resolved.
26
- * Maps to `ServiceProvider.deferred`.
27
- */
14
+ /** Defer instantiation until one of `provides` is resolved. */
28
15
  deferred?: boolean;
29
- /**
30
- * Services bound by this plugin (required when `deferred` is true).
31
- * Maps to `ServiceProvider.provides`.
32
- */
16
+ /** Services bound by this plugin; required when `deferred` is true. */
33
17
  provides?: string[];
34
18
  }
35
19
  /**
36
- * A factory returned by `definePlugin()`. Each call produces an independent
37
- * ServiceProvider subclass with the given configuration captured in a closure.
20
+ * Each call produces an independent ServiceProvider subclass with the given
21
+ * configuration captured in a closure.
38
22
  */
39
23
  export type PluginFactory<TConfig = void> = (config: TConfig) => ServiceProviderConstructor;
40
24
  /**
41
- * Define a configurable Guren plugin without ServiceProvider boilerplate.
42
- *
43
- * Unlike storing configuration on a static class property, each factory call
44
- * returns a fresh provider class, so the same plugin can be registered twice
45
- * with different configurations.
46
- *
47
- * @example
48
- * ```typescript
49
- * export const analyticsPlugin = definePlugin<AnalyticsConfig>({
50
- * name: 'analytics',
51
- * register(container, config) {
52
- * container.singleton('analytics', () => new AnalyticsClient(config))
53
- * },
54
- * })
55
- *
56
- * // In the application:
57
- * createApp({
58
- * providers: [analyticsPlugin({ apiKey: process.env.ANALYTICS_API_KEY! })],
59
- * })
60
- * ```
25
+ * Define a configurable Guren plugin without ServiceProvider boilerplate. Each
26
+ * factory call returns a fresh provider class, so the same plugin can be
27
+ * registered twice with different configurations.
61
28
  */
62
29
  export declare function definePlugin<TConfig = void>(definition: PluginDefinition<TConfig>): PluginFactory<TConfig>;
@@ -1,71 +1,39 @@
1
1
  import type { Container } from './Container.js';
2
2
  /**
3
3
  * Structural type for DI containers, avoiding a hard dependency on Container
4
- * where only resolution is needed (controllers, Inertia shared props).
4
+ * where only resolution is needed.
5
5
  */
6
6
  export interface ContainerLike {
7
7
  make(key: string): unknown;
8
8
  has?(key: string): boolean;
9
9
  }
10
- /**
11
- * Service factory function.
12
- */
13
10
  export type ServiceFactory<T> = (container: Container) => T;
14
- /**
15
- * Service class constructor.
16
- */
17
11
  export type ServiceClass<T> = new (...args: unknown[]) => T;
18
- /**
19
- * Service binding configuration.
20
- */
21
12
  export interface ServiceBinding {
22
13
  factory: ServiceFactory<unknown>;
23
14
  singleton: boolean;
24
15
  instance?: unknown;
25
16
  }
26
- /**
27
- * Contextual binding builder interface.
28
- */
29
17
  export interface ContextualBindingBuilder {
30
18
  needs(abstract: string): ContextualNeedsBuilder;
31
19
  }
32
- /**
33
- * Contextual needs builder interface.
34
- */
35
20
  export interface ContextualNeedsBuilder {
36
21
  give<T>(factory: ServiceFactory<T> | T): void;
37
22
  }
38
- /**
39
- * Contextual binding configuration.
40
- */
41
23
  export interface ContextualBinding {
42
24
  concrete: string;
43
25
  needs: string;
44
26
  factory: ServiceFactory<unknown>;
45
27
  }
46
- /**
47
- * Service provider options.
48
- */
49
28
  export interface ServiceProviderOptions {
50
- /**
51
- * Whether this provider should be deferred.
52
- */
53
29
  deferred?: boolean;
54
- /**
55
- * Services this provider provides (for deferred loading).
56
- */
30
+ /** Services this provider provides, for deferred loading. */
57
31
  provides?: string[];
58
32
  }
59
- /**
60
- * Provider interface for container-based service providers.
61
- */
62
33
  export interface Provider {
63
34
  register?(context: unknown): void | Promise<void>;
64
35
  boot?(context: unknown): void | Promise<void>;
65
36
  }
66
- /**
67
- * Service provider class type.
68
- */
69
37
  export interface ServiceProviderClass {
70
38
  new (container: Container): Provider;
71
39
  deferred?: boolean;
@@ -0,0 +1,21 @@
1
+ //#region src/auth/context.ts
2
+ /**
3
+ * Context key the framework auth context is stored under.
4
+ *
5
+ * Lives here rather than in `http/middleware/auth` so that `auth/` modules can
6
+ * import it without reaching back into the middleware layer. The middleware
7
+ * re-exports it, and it stays a public root export.
8
+ */
9
+ const AUTH_CONTEXT_KEY = "guren:auth";
10
+ /**
11
+ * Read the framework auth context off a request context. `ctx.get` returns
12
+ * arbitrary values for unknown keys, so the cast is a claim, not a check. A
13
+ * caller whose behavior turns on a real auth context probes the member it is
14
+ * about to call, as `Gate.resolveUser` does before its legacy `ctx.get('user')`
15
+ * fallback; probing here would reject contexts `requireAuthenticated` can use.
16
+ */
17
+ function getAuthContext(ctx) {
18
+ return ctx.get(AUTH_CONTEXT_KEY);
19
+ }
20
+ //#endregion
21
+ export { getAuthContext as n, AUTH_CONTEXT_KEY as t };
@@ -1,82 +1,29 @@
1
- /**
2
- * State definition for factories.
3
- */
4
1
  type StateDefinition<T> = Partial<T> | ((attributes: Partial<T>) => Partial<T>);
5
- /**
6
- * Abstract base class for model factories.
7
- */
8
2
  export declare abstract class BaseFactory<T> {
9
3
  private _sequence;
10
4
  private _states;
11
5
  private _activeStates;
12
6
  private _afterCreatingCallbacks;
13
7
  private _afterMakingCallbacks;
14
- /**
15
- * Get the current sequence number.
16
- */
17
8
  protected get sequence(): number;
18
- /**
19
- * Define the default attributes for the model.
20
- */
9
+ /** The model's default attributes. */
21
10
  abstract definition(): Partial<T>;
22
- /**
23
- * Create a model instance (to be overridden for persistence).
24
- */
11
+ /** Override to persist. */
25
12
  protected persist(attributes: Partial<T>): Promise<T>;
26
- /**
27
- * Define a state.
28
- */
29
13
  state(name: string, state: StateDefinition<T>): this;
30
- /**
31
- * Apply a state to the factory.
32
- */
33
14
  withState(name: string): this;
34
- /**
35
- * Apply multiple states.
36
- */
37
15
  withStates(...names: string[]): this;
38
- /**
39
- * Register a callback to run after creating.
40
- */
41
16
  afterCreating(callback: (model: T) => void | Promise<void>): this;
42
- /**
43
- * Register a callback to run after making.
44
- */
45
17
  afterMaking(callback: (model: T) => void | Promise<void>): this;
46
- /**
47
- * Make a model instance without persisting.
48
- */
18
+ /** Build without persisting. */
49
19
  make(overrides?: Partial<T>): T;
50
- /**
51
- * Make multiple model instances without persisting.
52
- */
53
20
  makeMany(count: number, overrides?: Partial<T>): T[];
54
- /**
55
- * Create and persist a model instance.
56
- */
57
21
  create(overrides?: Partial<T>): Promise<T>;
58
- /**
59
- * Create and persist multiple model instances.
60
- */
61
22
  createMany(count: number, overrides?: Partial<T>): Promise<T[]>;
62
- /**
63
- * Reset the sequence counter.
64
- */
65
23
  resetSequence(): this;
66
- /**
67
- * Clear active states.
68
- */
69
24
  clearStates(): this;
70
- /**
71
- * Create a new factory instance with fresh state.
72
- */
25
+ /** A new factory instance with fresh state. */
73
26
  fresh(): this;
74
27
  }
75
- /**
76
- * Alias for BaseFactory.
77
- */
78
28
  export { BaseFactory as Factory };
79
- /**
80
- * Helper to create a simple factory with a definition function.
81
- */
82
29
  export declare function defineFactory<T>(definition: (sequence: number) => Partial<T>, persist?: (attributes: Partial<T>) => Promise<T>): BaseFactory<T>;
@@ -1,72 +1,34 @@
1
1
  import type { SeederClass } from './types.js';
2
2
  /**
3
- * Reset called seeders tracking (for testing).
4
- *
5
3
  * @deprecated Bookkeeping for {@link BaseSeeder}'s `callOnce`. Write seeders
6
4
  * with `defineSeeder` from `@guren/core` instead, which needs no such
7
5
  * tracking. Deprecated in 2.9.0, removed in 3.0.0.
8
6
  */
9
7
  export declare function resetCalledSeeders(): void;
10
8
  /**
11
- * Abstract base class for database seeders.
12
- *
13
9
  * @deprecated Write seeders with `defineSeeder` from `@guren/core` instead.
14
10
  * Deprecated in 2.9.0, removed in 3.0.0.
15
11
  *
16
- * A seeder class is not itself the problem: `db:seed` loads every seeder
17
- * through `runSeeders()`, which does accept an exported class whose prototype
18
- * has a `run` method, constructs it, and calls `run({ db })`. What this base
19
- * class gets wrong is the signature it imposes on that method. `run()` is
20
- * declared to take no parameters, so it hides the one argument a seeder
21
- * needs.
22
- *
23
- * A subclass cannot simply correct that: declaring `run(ctx: SeederContext)`
24
- * fails to compile against the base (`TS2416: Target signature provides too
25
- * few arguments. Expected 1 or more, but got 0`). Widening it to an optional
26
- * `run(ctx?: SeederContext)` does compile, but then the subclass has to handle
27
- * a missing context — and that case is real, because
28
- * {@link BaseSeeder.call}, {@link BaseSeeder.callOnce},
29
- * {@link BaseSeeder.callMany} and {@link BaseSeeder.callParallel} construct
30
- * child seeders and invoke `run()` with no arguments at all. A parent that
31
- * received a context cannot pass it down.
32
- *
33
- * The orchestration these classes were written for, `SeederRunner`, is
34
- * reached by no Guren command.
12
+ * The signature is the problem: `run()` takes no parameters, so it hides the
13
+ * `{ db }` context `runSeeders()` passes, and a subclass cannot widen it
14
+ * (TS2416). The orchestration these classes were written for, `SeederRunner`,
15
+ * is reached by no Guren command.
35
16
  */
36
17
  export declare abstract class BaseSeeder {
37
18
  constructor();
38
19
  /**
39
- * Run the seeder.
40
- *
41
- * Declared without parameters, which is what makes this class the wrong
42
- * base: `runSeeders()` calls it with a `{ db }` context that this signature
43
- * cannot name.
20
+ * Declared without parameters: `runSeeders()` calls it with a `{ db }`
21
+ * context this signature cannot name.
44
22
  */
45
23
  abstract run(): Promise<void>;
46
- /**
47
- * Call another seeder.
48
- *
49
- * No context is forwarded: the child's `run()` is invoked with no
50
- * arguments, whatever the caller itself received.
51
- */
24
+ /** No context is forwarded: the child's `run()` gets no arguments. */
52
25
  protected call(SeederClass: SeederClass): Promise<void>;
53
- /**
54
- * Call another seeder only once.
55
- * Useful for avoiding duplicate data when seeders have dependencies.
56
- */
26
+ /** Skips the seeder if it already ran in this process. */
57
27
  protected callOnce(SeederClass: SeederClass): Promise<void>;
58
- /**
59
- * Call multiple seeders in sequence.
60
- */
61
28
  protected callMany(seeders: SeederClass[]): Promise<void>;
62
- /**
63
- * Call multiple seeders in parallel.
64
- */
65
29
  protected callParallel(seeders: SeederClass[]): Promise<void>;
66
30
  }
67
31
  /**
68
- * Alias for BaseSeeder.
69
- *
70
32
  * @deprecated Write seeders with `defineSeeder` from `@guren/core` instead.
71
33
  * Deprecated in 2.9.0, removed in 3.0.0. See {@link BaseSeeder}.
72
34
  */
@@ -1,56 +1,26 @@
1
1
  import type { SeederClass, SeederRunnerOptions } from './types.js';
2
2
  /**
3
- * Seeder runner for executing database seeders.
4
- *
5
3
  * @deprecated No Guren command reaches this runner. Write seeders with
6
4
  * `defineSeeder` from `@guren/core` and run them with `db:seed`. Deprecated
7
5
  * in 2.9.0, removed in 3.0.0.
8
6
  *
9
- * `db:seed` seeds by loading the seeders folder through `runSeeders()`, which
10
- * runs every seeder it finds there and hands each one a `{ db }` context. This
11
- * runner orchestrates differently: it runs a single seeder per call, taken
12
- * from a class passed in, a name registered with {@link SeederRunner.register},
13
- * or a name resolved to `<seedersPath>/<Name>.ts` and defaulting to
14
- * `DatabaseSeeder`; it constructs it with `new` and invokes `.run()` with no
15
- * context. Nothing in the framework calls any of it. See {@link BaseSeeder}
16
- * for what the no-context `run()` costs a seeder written against it.
7
+ * It runs a single seeder per call and invokes `.run()` with no context,
8
+ * unlike `runSeeders()`, which hands every seeder a `{ db }` context.
17
9
  */
18
10
  export declare class SeederRunner {
19
11
  private options;
20
12
  private seeders;
21
13
  constructor(options?: SeederRunnerOptions);
22
- /**
23
- * Register a seeder class.
24
- */
25
14
  register(name: string, seeder: SeederClass): this;
26
- /**
27
- * Register multiple seeder classes.
28
- */
29
15
  registerMany(seeders: Record<string, SeederClass>): this;
30
- /**
31
- * Run a specific seeder by name or class.
32
- */
33
16
  run(seeder?: string | SeederClass): Promise<void>;
34
- /**
35
- * Run multiple seeders in sequence.
36
- */
37
17
  runMany(seeders: Array<string | SeederClass>): Promise<void>;
38
- /**
39
- * Resolve a seeder by name.
40
- */
41
18
  private resolveSeeder;
42
- /**
43
- * Get available seeders from the seeders directory.
44
- */
19
+ /** The seeder names found in the seeders directory. */
45
20
  getAvailableSeeders(): Promise<string[]>;
46
- /**
47
- * Log a message if not silent.
48
- */
49
21
  private log;
50
22
  }
51
23
  /**
52
- * Create a seeder runner.
53
- *
54
24
  * @deprecated No Guren command reaches this runner. Write seeders with
55
25
  * `defineSeeder` from `@guren/core` instead. Deprecated in 2.9.0, removed in
56
26
  * 3.0.0. See {@link SeederRunner}.