@guren/server 2.15.0 → 2.17.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.
- package/dist/{DocsViewerServiceProvider-qFCaeiUv.js → DocsViewerServiceProvider-D2cuVgtN.js} +7 -12
- package/dist/{Hash-C8aejmi8.js → Hash-D2DFd8xX.js} +7 -57
- package/dist/{HttpException-BkS3euNG.js → HttpException-BlQ2yEmT.js} +2 -79
- package/dist/{Job-BVT813DO.js → Job-DxQK8h3P.js} +24 -179
- package/dist/{McpServiceProvider-BawsYjgN.js → McpServiceProvider-Zihx3Bjq.js} +35 -20
- package/dist/{Random-DbIJ22KQ.js → Random-S0OvCuR8.js} +9 -106
- package/dist/agent/AgentApprovalRequested.d.ts +11 -39
- package/dist/agent/approval-status.d.ts +56 -0
- package/dist/agent/approval.d.ts +76 -187
- package/dist/agent/audit-emitter.d.ts +16 -44
- package/dist/agent/audit.d.ts +20 -56
- package/dist/agent/derive.d.ts +32 -66
- package/dist/agent/dispatch.d.ts +38 -90
- package/dist/agent/events.d.ts +17 -23
- package/dist/agent/gate.d.ts +118 -0
- package/dist/agent/meta-tools.d.ts +18 -46
- package/dist/agent/pipeline.d.ts +234 -0
- package/dist/agent/public.d.ts +6 -25
- package/dist/agent/public.js +1 -1
- package/dist/agent/redact.d.ts +16 -38
- package/dist/agent/scopes.d.ts +55 -69
- package/dist/auth/AgentPrincipalGuard.d.ts +49 -0
- package/dist/auth/AuthManager.d.ts +22 -43
- package/dist/auth/AuthenticatableModel.d.ts +2 -2
- package/dist/auth/SessionGuard.d.ts +0 -1
- package/dist/auth/TokenGuard.d.ts +6 -26
- package/dist/auth/api-token.d.ts +16 -148
- package/dist/auth/context.d.ts +5 -10
- package/dist/auth/email-verification.d.ts +29 -127
- package/dist/auth/index.js +1 -1
- package/dist/auth/oauth/index.d.ts +35 -57
- package/dist/auth/password/DefaultHasher.d.ts +5 -14
- package/dist/auth/password/PasswordHasher.d.ts +5 -13
- package/dist/auth/password/hash-format.d.ts +5 -13
- package/dist/auth/password-reset.d.ts +16 -42
- package/dist/auth/providers/ModelUserProvider.d.ts +3 -4
- package/dist/auth/providers/UserProvider.d.ts +4 -4
- package/dist/auth/signed-token.d.ts +18 -0
- package/dist/auth/types.d.ts +9 -32
- package/dist/auth/utils.d.ts +6 -27
- package/dist/{auth-DkYoAPVn.js → auth-Gg54ppQi.js} +279 -519
- package/dist/authorization/Gate.d.ts +9 -145
- package/dist/authorization/Policy.d.ts +6 -53
- package/dist/authorization/index.js +1 -1
- package/dist/authorization/middleware.d.ts +16 -62
- package/dist/authorization/types.d.ts +8 -64
- package/dist/{authorization-CdfbCj8J.js → authorization-CdEWZZw3.js} +44 -309
- package/dist/broadcasting/BroadcastManager.d.ts +29 -149
- package/dist/broadcasting/channels/Channel.d.ts +1 -19
- package/dist/broadcasting/channels/PresenceChannel.d.ts +1 -55
- package/dist/broadcasting/channels/PrivateChannel.d.ts +1 -23
- package/dist/broadcasting/drivers/MemoryDriver.d.ts +18 -70
- package/dist/broadcasting/drivers/RedisDriver.d.ts +3 -80
- package/dist/broadcasting/drivers/index.d.ts +1 -1
- package/dist/broadcasting/index.d.ts +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/broadcasting/types.d.ts +7 -88
- package/dist/{broadcasting-BwodCA4q.js → broadcasting-B5RzB0A2.js} +87 -414
- package/dist/cache/CacheManager.d.ts +8 -62
- package/dist/cache/TaggedCache.d.ts +2 -35
- package/dist/cache/index.js +1 -1
- package/dist/cache/stores/FileStore.d.ts +2 -36
- package/dist/cache/stores/MemoryStore.d.ts +2 -26
- package/dist/cache/stores/RedisStore.d.ts +1 -29
- package/dist/cache/types.d.ts +21 -128
- package/dist/{cache-BYnZf2FR.js → cache-BOOIr324.js} +19 -198
- package/dist/client-C4TEr_Dd.js +9 -0
- package/dist/console/Command.d.ts +17 -126
- package/dist/console/ConsoleKernel.d.ts +2 -74
- package/dist/console/Input.d.ts +5 -113
- package/dist/console/Output.d.ts +3 -99
- package/dist/console/types.d.ts +3 -33
- package/dist/container/Container.d.ts +12 -103
- package/dist/container/ServiceProvider.d.ts +17 -61
- package/dist/container/bindings.d.ts +5 -26
- package/dist/container/defineModule.d.ts +16 -54
- package/dist/container/definePlugin.d.ts +12 -45
- package/dist/container/types.d.ts +2 -34
- package/dist/context-CXk_umpT.js +21 -0
- package/dist/database/Factory.d.ts +4 -57
- package/dist/database/Seeder.d.ts +8 -46
- package/dist/database/SeederRunner.d.ts +3 -33
- package/dist/database/types.d.ts +3 -24
- package/dist/discovery/AutoDiscovery.d.ts +10 -82
- package/dist/{dispatch-erOS9epZ.js → dispatch-BAwzftws.js} +32 -79
- package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +2 -5
- package/dist/docs-viewer/endpoint.d.ts +5 -11
- package/dist/encryption/Encrypter.d.ts +5 -71
- package/dist/encryption/Hash.d.ts +7 -57
- package/dist/encryption/Random.d.ts +6 -99
- package/dist/encryption/index.js +3 -3
- package/dist/encryption/types.d.ts +10 -72
- package/dist/{encryption-D99Vmls3.js → encryption-uwP3Di4D.js} +9 -78
- package/dist/{endpoint-D6GIqOpe.js → endpoint-BXipU2Jj.js} +6 -12
- package/dist/endpoint-Dsw3Acvq.js +26 -0
- package/dist/errors/ExceptionHandler.d.ts +3 -90
- package/dist/errors/HttpException.d.ts +2 -79
- package/dist/errors/debug-page.d.ts +3 -17
- package/dist/errors/error-page.d.ts +1 -0
- package/dist/errors/exceptions/AuthenticationException.d.ts +2 -24
- package/dist/errors/exceptions/AuthorizationException.d.ts +1 -24
- package/dist/errors/exceptions/MethodNotAllowedException.d.ts +1 -23
- package/dist/errors/exceptions/NotFoundHttpException.d.ts +1 -27
- package/dist/errors/exceptions/ValidationException.d.ts +2 -43
- package/dist/errors/types.d.ts +1 -25
- package/dist/{errors-BgeOl_DC.js → errors-JpkcCjjn.js} +3 -41
- package/dist/events/Event.d.ts +1 -28
- package/dist/events/EventManager.d.ts +5 -107
- package/dist/events/Listener.d.ts +7 -55
- package/dist/events/builtin.d.ts +0 -24
- package/dist/events/index.js +1 -1
- package/dist/events/types.d.ts +4 -22
- package/dist/{events-aIH_bWRx.js → events-DOmAHDeP.js} +11 -191
- package/dist/facades/index.d.ts +2 -14
- package/dist/health/HealthCheck.d.ts +0 -24
- package/dist/health/HealthManager.d.ts +0 -36
- package/dist/health/checks/CacheCheck.d.ts +2 -17
- package/dist/health/checks/CustomCheck.d.ts +0 -9
- package/dist/health/checks/DatabaseCheck.d.ts +2 -17
- package/dist/health/checks/MemoryCheck.d.ts +3 -12
- package/dist/health/checks/RedisCheck.d.ts +1 -13
- package/dist/health/checks/StorageCheck.d.ts +2 -17
- package/dist/health/index.js +1 -1
- package/dist/health/types.d.ts +4 -24
- package/dist/{health-VWdWXRwh.js → health-DQSvUplL.js} +1 -76
- package/dist/hot-disposables-B5BXqaIH.js +167 -0
- package/dist/hot-reload/hot-disposables.d.ts +22 -74
- package/dist/hot-reload/testing.d.ts +4 -9
- package/dist/http/Application.d.ts +77 -205
- package/dist/http/FormRequest.d.ts +4 -55
- package/dist/http/dev-assets.d.ts +13 -31
- package/dist/http/dev-banner.d.ts +2 -5
- package/dist/http/inertia-assets.d.ts +3 -6
- package/dist/http/middleware/capabilities.d.ts +27 -50
- package/dist/http/middleware/cors.d.ts +4 -29
- package/dist/http/middleware/csp.d.ts +2 -25
- package/dist/http/middleware/csrf.d.ts +28 -95
- package/dist/http/middleware/detect-locale.d.ts +7 -27
- package/dist/http/middleware/force-https.d.ts +6 -24
- package/dist/http/middleware/host-authorization.d.ts +2 -12
- package/dist/http/middleware/index.d.ts +1 -1
- package/dist/http/middleware/loopback-guard.d.ts +15 -33
- package/dist/http/middleware/rate-limit.d.ts +29 -126
- package/dist/http/middleware/redirect-safety.d.ts +2 -20
- package/dist/http/middleware/request-id.d.ts +1 -14
- package/dist/http/middleware/request-logging.d.ts +2 -13
- package/dist/http/middleware/response-headers.d.ts +5 -13
- package/dist/http/middleware/security-headers.d.ts +2 -16
- package/dist/http/middleware/session.d.ts +15 -34
- package/dist/http/middleware/validation-errors-cookie.d.ts +7 -18
- package/dist/http/middleware/validation.d.ts +8 -63
- package/dist/http/public-assets.d.ts +11 -7
- package/dist/http/request.d.ts +32 -118
- package/dist/http/resources/CursorPaginator.d.ts +5 -64
- package/dist/http/resources/Paginator.d.ts +7 -84
- package/dist/http/resources/Resource.d.ts +9 -65
- package/dist/http/resources/ResourceCollection.d.ts +5 -39
- package/dist/http/resources/types.d.ts +10 -30
- package/dist/http/static-documents.d.ts +10 -20
- package/dist/http/validation/Validator.d.ts +25 -85
- package/dist/http/validation/rules.d.ts +48 -147
- package/dist/http/validation/types.d.ts +16 -61
- package/dist/http/vite-assets.d.ts +5 -28
- package/dist/http/vite-dev-server.d.ts +6 -9
- package/dist/http/vite-manifest.d.ts +19 -33
- package/dist/i18n/I18nManager.d.ts +12 -78
- package/dist/i18n/Translator.d.ts +3 -54
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/loaders/JsonLoader.d.ts +4 -31
- package/dist/i18n/loaders/MemoryLoader.d.ts +1 -21
- package/dist/i18n/pluralization.d.ts +4 -13
- package/dist/i18n/types.d.ts +17 -69
- package/dist/{i18n-mcWi7LCd.js → i18n-Cg1aajRP.js} +31 -225
- package/dist/index.d.ts +11 -4
- package/dist/index.js +1186 -3040
- package/dist/internal/agent-preflight.d.ts +9 -21
- package/dist/internal/agent-principal.d.ts +32 -0
- package/dist/internal/request.d.ts +6 -19
- package/dist/internal/request.js +1 -1
- package/dist/internal/route-path.d.ts +9 -21
- package/dist/internal/route-path.js +9 -21
- package/dist/internal/zod-compat.d.ts +55 -122
- package/dist/internal/zod-compat.js +39 -70
- package/dist/internal/zod-json-schema.d.ts +18 -54
- package/dist/internal/zod-json-schema.js +46 -123
- package/dist/jsx-runtime.d.ts +3 -8
- package/dist/lambda/index.d.ts +17 -79
- package/dist/lambda/index.js +11 -59
- package/dist/logging/LogManager.d.ts +1 -51
- package/dist/logging/Logger.d.ts +8 -47
- package/dist/logging/channels/ConsoleChannel.d.ts +1 -3
- package/dist/logging/channels/DailyFileChannel.d.ts +1 -3
- package/dist/logging/channels/FileChannel.d.ts +1 -3
- package/dist/logging/daily-file-path.d.ts +7 -16
- package/dist/logging/index.js +1 -1
- package/dist/logging/types.d.ts +13 -45
- package/dist/{logging-B-kngi3q.js → logging-zOY1XCtq.js} +52 -141
- package/dist/{loopback-guard-D0Kc7-xc.js → loopback-guard-DT9gHF0F.js} +41 -92
- package/dist/mail/Mail.d.ts +10 -106
- package/dist/mail/MailManager.d.ts +2 -60
- package/dist/mail/index.js +1 -1
- package/dist/mail/transports/LogTransport.d.ts +1 -4
- package/dist/mail/transports/MemoryTransport.d.ts +1 -63
- package/dist/mail/transports/ResendTransport.d.ts +1 -23
- package/dist/mail/transports/SmtpTransport.d.ts +1 -31
- package/dist/mail/types.d.ts +28 -150
- package/dist/{mail-DfEfSQEr.js → mail-76DWy9lj.js} +31 -289
- package/dist/mcp/McpServiceProvider.d.ts +4 -10
- package/dist/mcp/create-mcp-server.d.ts +42 -57
- package/dist/mcp/endpoint.d.ts +12 -36
- package/dist/mcp/index.js +1 -1
- package/dist/mvc/Controller.d.ts +46 -227
- package/dist/mvc/Router.d.ts +50 -129
- package/dist/mvc/inertia/InertiaEngine.d.ts +18 -48
- package/dist/mvc/inertia/shared.d.ts +6 -19
- package/dist/mvc/mount-route.d.ts +2 -6
- package/dist/mvc/view.d.ts +1 -2
- package/dist/notifications/Notification.d.ts +8 -75
- package/dist/notifications/NotificationManager.d.ts +15 -88
- package/dist/notifications/channels/DatabaseChannel.d.ts +1 -41
- package/dist/notifications/channels/MailChannel.d.ts +2 -31
- package/dist/notifications/channels/MemoryChannel.d.ts +2 -62
- package/dist/notifications/channels/SlackChannel.d.ts +3 -48
- package/dist/notifications/index.js +1 -1
- package/dist/notifications/notifiable-type.d.ts +3 -6
- package/dist/notifications/registry.d.ts +8 -27
- package/dist/notifications/types.d.ts +16 -53
- package/dist/{notifications-BGqmUNZ8.js → notifications-okWFs9ly.js} +37 -335
- package/dist/providers/AuthServiceProvider.d.ts +1 -3
- package/dist/providers/AuthorizationServiceProvider.d.ts +2 -3
- package/dist/providers/BroadcastServiceProvider.d.ts +1 -3
- package/dist/providers/CacheServiceProvider.d.ts +1 -3
- package/dist/providers/EncryptionServiceProvider.d.ts +1 -3
- package/dist/providers/ErrorServiceProvider.d.ts +1 -4
- package/dist/providers/EventServiceProvider.d.ts +1 -3
- package/dist/providers/HealthServiceProvider.d.ts +1 -3
- package/dist/providers/I18nServiceProvider.d.ts +6 -10
- package/dist/providers/InertiaServiceProvider.d.ts +1 -4
- package/dist/providers/LogServiceProvider.d.ts +1 -3
- package/dist/providers/MailServiceProvider.d.ts +1 -3
- package/dist/providers/NotificationServiceProvider.d.ts +1 -3
- package/dist/providers/OAuthServiceProvider.d.ts +1 -3
- package/dist/providers/QueueServiceProvider.d.ts +1 -3
- package/dist/providers/SchedulingServiceProvider.d.ts +1 -3
- package/dist/providers/StorageServiceProvider.d.ts +1 -3
- package/dist/queue/FailedJobReporter.d.ts +1 -24
- package/dist/queue/Job.d.ts +12 -99
- package/dist/queue/QueueManager.d.ts +6 -57
- package/dist/queue/Worker.d.ts +4 -65
- package/dist/queue/drivers/MemoryDriver.d.ts +3 -44
- package/dist/queue/drivers/RedisDriver.d.ts +7 -65
- package/dist/queue/drivers/SqsDriver.d.ts +6 -57
- package/dist/queue/drivers/SyncDriver.d.ts +10 -13
- package/dist/queue/index.js +2 -2
- package/dist/queue/types.d.ts +10 -92
- package/dist/{queue-CXrRK85G.js → queue-CcXCjuJI.js} +32 -260
- package/dist/redis/RedisApiTokenStore.d.ts +4 -56
- package/dist/redis/RedisEmailVerificationStore.d.ts +4 -37
- package/dist/redis/RedisOAuthStateStore.d.ts +2 -10
- package/dist/redis/RedisPasswordResetStore.d.ts +4 -37
- package/dist/redis/RedisRateLimitStore.d.ts +16 -49
- package/dist/redis/RedisSessionStore.d.ts +3 -44
- package/dist/redis/client.d.ts +2 -32
- package/dist/redis/index.js +47 -232
- package/dist/redis/redis-values.d.ts +6 -12
- package/dist/redis/scan-keys.d.ts +1 -4
- package/dist/request-CLOYytGP.js +68 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +50 -92
- package/dist/scheduling/CronParser.d.ts +0 -29
- package/dist/scheduling/Schedule.d.ts +1 -153
- package/dist/scheduling/ScheduledTask.d.ts +0 -31
- package/dist/scheduling/Scheduler.d.ts +0 -70
- package/dist/scheduling/index.js +1 -1
- package/dist/scheduling/types.d.ts +4 -65
- package/dist/{scheduling-CPiEdtQd.js → scheduling-C6tcOtUl.js} +2 -287
- package/dist/storage/StorageManager.d.ts +0 -48
- package/dist/storage/drivers/LocalDriver.d.ts +1 -25
- package/dist/storage/drivers/MemoryDriver.d.ts +5 -35
- package/dist/storage/drivers/S3Driver.d.ts +6 -36
- package/dist/storage/drivers/s3-acl.d.ts +5 -10
- package/dist/storage/index.js +1 -1
- package/dist/storage/types.d.ts +27 -265
- package/dist/{storage-TLD9t0Q2.js → storage-BB59f07j.js} +17 -157
- package/dist/support/contained-path.d.ts +10 -20
- package/dist/support/error-polyfill.d.ts +4 -6
- package/dist/support/expiry.d.ts +17 -33
- package/dist/support/expiry.js +17 -33
- package/dist/support/import-map.d.ts +3 -7
- package/dist/support/inertia-defaults.d.ts +5 -10
- package/dist/support/redirect-target.d.ts +4 -6
- package/dist/support/stack-frames.d.ts +11 -50
- package/dist/support/trim-slashes.d.ts +4 -7
- package/dist/support/warn-once.d.ts +2 -6
- package/dist/{trim-slashes-ZJ_VsY5s.js → trim-slashes-BLY9hKAa.js} +4 -7
- package/dist/{vite-manifest-w_RSOvQW.js → vite-manifest-B_Iy5183.js} +34 -58
- package/package.json +2 -2
- package/dist/client-Dd7vLcqp.js +0 -27
- package/dist/context-DoD0c7J_.js +0 -26
- package/dist/endpoint-D-20PiHY.js +0 -46
- package/dist/hot-disposables-WsTX2ySN.js +0 -281
- package/dist/request-CVQwpu2J.js +0 -129
package/dist/mvc/Router.d.ts
CHANGED
|
@@ -3,10 +3,7 @@ import { Controller } from './Controller.js';
|
|
|
3
3
|
import type { Container } from '../container/Container.js';
|
|
4
4
|
import type { ValidationSchema } from '../http/middleware/validation.js';
|
|
5
5
|
import { type MiddlewareCapabilities } from '../http/middleware/capabilities.js';
|
|
6
|
-
/**
|
|
7
|
-
* Constructor type for Controller classes.
|
|
8
|
-
* @template T - The controller type extending Controller
|
|
9
|
-
*/
|
|
6
|
+
/** Constructor type for Controller classes. */
|
|
10
7
|
export type ControllerConstructor<T extends Controller = Controller> = (new (...args: any[]) => T) & {
|
|
11
8
|
inject?: readonly string[];
|
|
12
9
|
};
|
|
@@ -17,35 +14,26 @@ type ControllerMethodFor<C extends ControllerConstructor> = ControllerMethod<Ins
|
|
|
17
14
|
export type ControllerAction<C extends ControllerConstructor = ControllerConstructor> = [C, ControllerMethodFor<C>];
|
|
18
15
|
export type RouteResult = Response | string | number | boolean | Record<string, unknown> | Array<unknown> | null | void;
|
|
19
16
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* `broadcast.sseMiddleware()`) can be mounted directly as a terminal handler.
|
|
17
|
+
* Inline handlers receive `next`, so Hono middleware (e.g.
|
|
18
|
+
* `broadcast.sseMiddleware()`) can mount directly as a terminal handler.
|
|
23
19
|
*/
|
|
24
20
|
export type RouteHandler<C extends ControllerConstructor = ControllerConstructor> = ((c: Context, next: Next) => RouteResult | Promise<RouteResult>) | ControllerAction<C>;
|
|
25
|
-
/**
|
|
26
|
-
* Model binding resolver function.
|
|
27
|
-
*/
|
|
28
21
|
type ModelBindingResolver = (value: string) => Promise<unknown>;
|
|
29
|
-
/**
|
|
30
|
-
* Model class with findOrFail static method.
|
|
31
|
-
*/
|
|
22
|
+
/** Model class with a findOrFail static method. */
|
|
32
23
|
export interface BindableModel {
|
|
33
24
|
findOrFail(id: unknown, key?: string): Promise<unknown>;
|
|
34
25
|
/** Bound values are model classes at runtime; the constructor name is the introspection payload. */
|
|
35
26
|
readonly name?: string;
|
|
36
27
|
}
|
|
37
28
|
/**
|
|
38
|
-
* A model bound to a route parameter: the
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* `bind: { slug: [Post, 'slug'] }`. Either way the controller reads the
|
|
42
|
-
* resolved record with `this.model(Model)`.
|
|
29
|
+
* A model bound to a route parameter: the class alone looks the value up by
|
|
30
|
+
* primary key, a `[Model, column]` tuple by that column. The controller reads
|
|
31
|
+
* the resolved record with `this.model(Model)`.
|
|
43
32
|
*/
|
|
44
33
|
export type RouteModelBinding = BindableModel | readonly [BindableModel, string];
|
|
45
34
|
/**
|
|
46
|
-
* A Resource class accepted as a response hint.
|
|
47
|
-
*
|
|
48
|
-
* instances expose `toJSON()` (every `Resource` subclass) qualifies.
|
|
35
|
+
* A Resource class accepted as a response hint. Never instantiated — only the
|
|
36
|
+
* constructor name is introspected.
|
|
49
37
|
*/
|
|
50
38
|
interface ResponseResourceClass {
|
|
51
39
|
new (resource: any): {
|
|
@@ -53,20 +41,14 @@ interface ResponseResourceClass {
|
|
|
53
41
|
};
|
|
54
42
|
}
|
|
55
43
|
/**
|
|
56
|
-
* Type-level response hint
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* at runtime. `guren codegen` maps each Resource class to the `Data` type it
|
|
60
|
-
* extracts from `app/Http/Resources` and types the API client's `json()`
|
|
61
|
-
* with the assembled shape.
|
|
44
|
+
* Type-level response hint: a Resource class, a single-element array (a
|
|
45
|
+
* collection), or an object of hints (an envelope). Declarative only; `guren
|
|
46
|
+
* codegen` turns it into the API client's `json()` type.
|
|
62
47
|
*/
|
|
63
48
|
export type ResourceResponseHint = ResponseResourceClass | readonly [ResourceResponseHint] | {
|
|
64
49
|
readonly [key: string]: ResourceResponseHint;
|
|
65
50
|
};
|
|
66
|
-
/**
|
|
67
|
-
* Serialized form of {@link ResourceResponseHint} carried by
|
|
68
|
-
* {@link RouteDefinition}: Resource classes become their class names.
|
|
69
|
-
*/
|
|
51
|
+
/** Serialized {@link ResourceResponseHint}: Resource classes become their class names. */
|
|
70
52
|
export type ResourceResponseShape = string | [ResourceResponseShape] | {
|
|
71
53
|
[key: string]: ResourceResponseShape;
|
|
72
54
|
};
|
|
@@ -96,17 +78,14 @@ export interface RouteContractOptions<TParamsSchema extends SchemaLike<unknown>
|
|
|
96
78
|
body?: TBodySchema;
|
|
97
79
|
output?: TOutputSchema;
|
|
98
80
|
/**
|
|
99
|
-
* Type-level response hint (see {@link ResourceResponseHint})
|
|
100
|
-
*
|
|
101
|
-
* follow the shape. When both are set, `output` wins in generated types:
|
|
102
|
-
* it is the one actually enforced.
|
|
81
|
+
* Type-level response hint (see {@link ResourceResponseHint}); nothing runs
|
|
82
|
+
* at request time. When both are set, `output` wins in generated types.
|
|
103
83
|
*/
|
|
104
84
|
resource?: ResourceResponseHint;
|
|
105
85
|
/**
|
|
106
86
|
* Route model bindings: param name → model (see {@link RouteModelBinding}).
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* and expose the record to the controller via `this.model(Post)`.
|
|
87
|
+
* A miss throws the model's not-found exception (404); the record reaches
|
|
88
|
+
* the controller via `this.model(Post)`.
|
|
110
89
|
*/
|
|
111
90
|
bind?: Record<string, RouteModelBinding>;
|
|
112
91
|
/** Agent exposure metadata (RFC 0016). See {@link AgentRouteMetadata}. */
|
|
@@ -120,16 +99,9 @@ export interface RouteOpenApiMetadata {
|
|
|
120
99
|
deprecated?: boolean;
|
|
121
100
|
}
|
|
122
101
|
/**
|
|
123
|
-
* Agent exposure metadata
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* already carries, never restated here.
|
|
127
|
-
*
|
|
128
|
-
* Storage only: no defaults are applied at registration, and the router does
|
|
129
|
-
* not require a route name here — `.agent()` may legally be chained before
|
|
130
|
-
* `.name()`, so name-requirement enforcement is deliberately left to static
|
|
131
|
-
* checks over `definitions()` (a route without a name cannot become a tool;
|
|
132
|
-
* the name is the tool's identity).
|
|
102
|
+
* Agent exposure metadata (RFC 0016); declaring it marks the route as a tool.
|
|
103
|
+
* Storage only: no defaults, and no route name required here (`.agent()` may
|
|
104
|
+
* precede `.name()`) — the name requirement is enforced over `definitions()`.
|
|
133
105
|
*/
|
|
134
106
|
export interface AgentRouteMetadata {
|
|
135
107
|
/** Tool description. Absent, the route's OpenAPI `description` ?? `summary` stands in. */
|
|
@@ -152,17 +124,12 @@ export interface AgentRouteMetadata {
|
|
|
152
124
|
/** Argument fields masked in agent audit logs. */
|
|
153
125
|
redact?: string[];
|
|
154
126
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Represents a registered route definition for introspection.
|
|
157
|
-
*/
|
|
127
|
+
/** A registered route definition, as handed out for introspection. */
|
|
158
128
|
export interface RouteDefinition {
|
|
159
129
|
/** Uppercased HTTP method (GET, POST, PUT, PATCH, DELETE, QUERY, or any custom method registered via on()) */
|
|
160
130
|
method: string;
|
|
161
|
-
/** URL path pattern (e.g., '/users/:id') */
|
|
162
131
|
path: string;
|
|
163
|
-
/** Optional route name for URL generation */
|
|
164
132
|
name?: string;
|
|
165
|
-
/** Schema metadata attached via RouteContractOptions */
|
|
166
133
|
schemas?: {
|
|
167
134
|
params?: SchemaLike<unknown>;
|
|
168
135
|
query?: SchemaLike<unknown>;
|
|
@@ -170,36 +137,26 @@ export interface RouteDefinition {
|
|
|
170
137
|
output?: SchemaLike<unknown>;
|
|
171
138
|
};
|
|
172
139
|
/**
|
|
173
|
-
* Serialized
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* would claim a shape the wire does not have).
|
|
140
|
+
* Serialized `RouteContractOptions.resource`. Absent when no hint was
|
|
141
|
+
* declared, or when any class in it has no usable name — a partial hint
|
|
142
|
+
* would claim a shape the wire does not have.
|
|
177
143
|
*/
|
|
178
144
|
resource?: ResourceResponseShape;
|
|
179
|
-
/** Named middleware (aliases or groups) applied to this route */
|
|
180
145
|
middlewareNames?: string[];
|
|
181
|
-
/** Whether inline (unnamed) middleware handlers are attached */
|
|
182
146
|
hasInlineMiddleware?: boolean;
|
|
183
147
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* from
|
|
187
|
-
* so consumers can distinguish that from definitions produced by older
|
|
188
|
-
* servers, where the field is absent. The value shape is internal and may
|
|
189
|
-
* change (RFC 0007).
|
|
148
|
+
* Capabilities aggregated from the route's middleware chain. Always present
|
|
149
|
+
* from this release (`{}` means none recognized), so consumers can tell that
|
|
150
|
+
* from an older server's absent field. Shape is internal (RFC 0007).
|
|
190
151
|
*/
|
|
191
152
|
capabilities?: MiddlewareCapabilities;
|
|
192
|
-
/** Controller binding when the handler is a [Controller, 'method'] tuple */
|
|
193
153
|
controller?: {
|
|
194
154
|
name: string;
|
|
195
155
|
action: string;
|
|
196
156
|
};
|
|
197
157
|
/** Route model bindings: param name → bound model class name (from `bind`) */
|
|
198
158
|
bindings?: Record<string, string>;
|
|
199
|
-
/**
|
|
200
|
-
* Agent exposure metadata as declared (RFC 0016) — raw, no defaults
|
|
201
|
-
* applied. Absence means the route is not an agent tool.
|
|
202
|
-
*/
|
|
159
|
+
/** Agent metadata as declared (RFC 0016), no defaults applied. Absent: not a tool. */
|
|
203
160
|
agent?: AgentRouteMetadata;
|
|
204
161
|
summary?: string;
|
|
205
162
|
description?: string;
|
|
@@ -207,12 +164,8 @@ export interface RouteDefinition {
|
|
|
207
164
|
operationId?: string;
|
|
208
165
|
deprecated?: boolean;
|
|
209
166
|
}
|
|
210
|
-
/**
|
|
211
|
-
* Chainable builder for configuring a registered route.
|
|
212
|
-
* @template M - Union of registered middleware alias names
|
|
213
|
-
*/
|
|
167
|
+
/** Chainable builder for configuring a registered route. */
|
|
214
168
|
export interface RouteBuilder<M extends string = never> {
|
|
215
|
-
/** Set the route name for URL generation. */
|
|
216
169
|
name(routeName: string): RouteBuilder<M>;
|
|
217
170
|
/** Attach middleware to this specific route. See {@link RouteMiddlewareInput}. */
|
|
218
171
|
middleware(...items: RouteMiddlewareInput<M>[]): RouteBuilder<M>;
|
|
@@ -221,16 +174,10 @@ export interface RouteBuilder<M extends string = never> {
|
|
|
221
174
|
}
|
|
222
175
|
/**
|
|
223
176
|
* Accepted by `.middleware()`: a registered alias name or a handler function.
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* reverse of how they read. Use aliases throughout when relative order matters.
|
|
229
|
-
*
|
|
230
|
-
* Aliases are also the only form that lands in `RouteDefinition.middlewareNames`,
|
|
231
|
-
* which is how `guren audit` reports middleware it cannot otherwise identify.
|
|
232
|
-
* Guards the framework stamps with a capability (`requireAuthenticated`,
|
|
233
|
-
* `requireGuest`) are recognized either way.
|
|
177
|
+
* Resolution is by kind, not position — every name runs before every handler,
|
|
178
|
+
* across scopes, so an inline handler on an outer group runs *after* a named
|
|
179
|
+
* one on an inner group. Only aliases land in `middlewareNames`, which is how
|
|
180
|
+
* `guren audit` reports middleware it cannot otherwise identify.
|
|
234
181
|
*/
|
|
235
182
|
export type RouteMiddlewareInput<M extends string = never> = M | MiddlewareHandler;
|
|
236
183
|
/** Storage form of {@link RouteMiddlewareInput}, unparameterized by alias union. */
|
|
@@ -238,31 +185,22 @@ type MiddlewareScopeEntry = string | MiddlewareHandler;
|
|
|
238
185
|
export interface RouterMountOptions {
|
|
239
186
|
container?: Container;
|
|
240
187
|
}
|
|
241
|
-
/**
|
|
242
|
-
* Available actions for resource routes.
|
|
243
|
-
*/
|
|
188
|
+
/** Available actions for resource routes. */
|
|
244
189
|
export type ResourceAction = 'index' | 'create' | 'store' | 'show' | 'edit' | 'update' | 'destroy';
|
|
245
|
-
/**
|
|
246
|
-
* Options for configuring resource routes.
|
|
247
|
-
*/
|
|
190
|
+
/** Options for configuring resource routes. */
|
|
248
191
|
export interface ResourceRouteOptions {
|
|
249
192
|
name?: string;
|
|
250
193
|
param?: string;
|
|
251
194
|
only?: ResourceAction[];
|
|
252
195
|
except?: ResourceAction[];
|
|
253
196
|
/**
|
|
254
|
-
* Per-action agent exposure (RFC 0016)
|
|
255
|
-
*
|
|
256
|
-
* Listing an action this call does not register (excluded via `only`/
|
|
257
|
-
* `except`, or missing from the controller) throws: metadata for a tool
|
|
197
|
+
* Per-action agent exposure (RFC 0016); an action not listed is not exposed.
|
|
198
|
+
* Listing an action this call does not register throws — metadata for a tool
|
|
258
199
|
* that cannot exist is a wiring mistake, not a no-op.
|
|
259
200
|
*/
|
|
260
201
|
agent?: Partial<Record<ResourceAction, AgentRouteMetadata>>;
|
|
261
202
|
}
|
|
262
|
-
/**
|
|
263
|
-
* Instance-based router for app-local route registration and mounting.
|
|
264
|
-
* @template M - Union of registered middleware alias names (e.g. `'auth' | 'guest'`)
|
|
265
|
-
*/
|
|
203
|
+
/** Instance-based router for app-local route registration and mounting. */
|
|
266
204
|
export declare class Router<M extends string = never> {
|
|
267
205
|
private readonly registry;
|
|
268
206
|
private readonly prefixStack;
|
|
@@ -273,24 +211,13 @@ export declare class Router<M extends string = never> {
|
|
|
273
211
|
private readonly modelBindings;
|
|
274
212
|
aliasMiddleware<N extends string>(name: N, handler: MiddlewareHandler): Router<M | N>;
|
|
275
213
|
groupMiddleware<N extends string>(name: N, middlewareNames: M[]): Router<M | N>;
|
|
276
|
-
/**
|
|
277
|
-
* Open a middleware scope for the routes registered through the returned
|
|
278
|
-
* builder. See {@link RouteMiddlewareInput}.
|
|
279
|
-
*/
|
|
214
|
+
/** Open a middleware scope for the returned builder. See {@link RouteMiddlewareInput}. */
|
|
280
215
|
middleware(...items: RouteMiddlewareInput<M>[]): RouterMiddlewareGroupBuilder<M>;
|
|
281
216
|
/**
|
|
282
|
-
* Bind a route parameter for every route on this router whose path names
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
* arrives positionally, in path-parameter order:
|
|
287
|
-
*
|
|
288
|
-
* ```ts
|
|
289
|
-
* router.bind('post', async (slug) => Post.where('slug', slug).firstOrFail())
|
|
290
|
-
* router.get('/posts/:post', [PostController, 'show'])
|
|
291
|
-
*
|
|
292
|
-
* async show(_ctx: Context, post: PostRecord) { ... }
|
|
293
|
-
* ```
|
|
217
|
+
* Bind a route parameter for every route on this router whose path names it.
|
|
218
|
+
* A model resolves through `findOrFail` and reaches the controller both via
|
|
219
|
+
* `this.model(Model)` and positionally; a custom resolver's value arrives
|
|
220
|
+
* only positionally, in path-parameter order.
|
|
294
221
|
*/
|
|
295
222
|
bind(param: string, modelOrResolver: RouteModelBinding | ModelBindingResolver): this;
|
|
296
223
|
on<C extends ControllerConstructor>(method: string, path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
@@ -312,10 +239,9 @@ export declare class Router<M extends string = never> {
|
|
|
312
239
|
delete<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
313
240
|
delete<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
314
241
|
/**
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
* assumption (see `createCsrfMiddleware`'s `methods` option to opt in).
|
|
242
|
+
* HTTP QUERY (RFC 10008): safe and idempotent like GET, but carries a body.
|
|
243
|
+
* Handlers must not mutate state — CSRF protection deliberately skips QUERY
|
|
244
|
+
* on that assumption (`createCsrfMiddleware`'s `methods` option opts in).
|
|
319
245
|
*/
|
|
320
246
|
query<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
321
247
|
query<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
@@ -332,15 +258,10 @@ export declare class Router<M extends string = never> {
|
|
|
332
258
|
private register;
|
|
333
259
|
private add;
|
|
334
260
|
/**
|
|
335
|
-
* Security capabilities
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
* routers that never mount (audit, codegen), and an unresolvable alias
|
|
340
|
-
* simply contributes no capabilities.
|
|
341
|
-
*
|
|
342
|
-
* This walks the chain; the rules for combining what it finds live with the
|
|
343
|
-
* capability type, in `mergeCapabilities`.
|
|
261
|
+
* Security capabilities on a route's middleware chain, across named aliases
|
|
262
|
+
* (group-expanded) and inline handlers. Unlike `resolveMiddlewareNames`,
|
|
263
|
+
* unregistered names are skipped rather than thrown: `definitions()` must
|
|
264
|
+
* stay side-effect-free for routers that never mount (audit, codegen).
|
|
344
265
|
*/
|
|
345
266
|
private aggregateCapabilities;
|
|
346
267
|
private resolveMiddlewareNames;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Per-response form of {@link InertiaDocumentOptions}
|
|
3
|
-
*
|
|
4
|
-
* through {@link setInertiaDocument}.
|
|
2
|
+
* Per-response form of {@link InertiaDocumentOptions}, already resolved to
|
|
3
|
+
* strings. Each field overrides the app-wide {@link setInertiaDocument} default.
|
|
5
4
|
*/
|
|
6
5
|
type InertiaDocumentOverrides = {
|
|
7
6
|
readonly [K in keyof InertiaDocumentOptions]?: string;
|
|
@@ -48,66 +47,37 @@ export interface InertiaDocumentContext {
|
|
|
48
47
|
}
|
|
49
48
|
type InertiaDocumentValue = string | ((context: InertiaDocumentContext) => string | undefined);
|
|
50
49
|
export interface InertiaDocumentOptions {
|
|
51
|
-
/**
|
|
52
|
-
* Class attribute for the root `<body>` element. Pass a function to vary it
|
|
53
|
-
* per page component — a docs section that needs a light surface while the
|
|
54
|
-
* marketing pages keep a dark one, for instance.
|
|
55
|
-
*/
|
|
50
|
+
/** Class for the root `<body>`; a function varies it per page component. */
|
|
56
51
|
readonly bodyClass?: InertiaDocumentValue;
|
|
57
52
|
/**
|
|
58
|
-
* CSS inlined into `<head>` ahead of the stylesheet links. Keep it to the
|
|
59
|
-
*
|
|
60
|
-
* the main stylesheet still wins for everything it defines later.
|
|
53
|
+
* CSS inlined into `<head>` ahead of the stylesheet links. Keep it to the few
|
|
54
|
+
* declarations that decide the first paint; the main stylesheet wins later.
|
|
61
55
|
*/
|
|
62
56
|
readonly criticalCss?: InertiaDocumentValue;
|
|
63
57
|
/**
|
|
64
|
-
* Body of a blocking inline `<script>`
|
|
65
|
-
*
|
|
66
|
-
* `matchMedia` before React hydrates.
|
|
58
|
+
* Body of a blocking inline `<script>` run before the first paint — theme
|
|
59
|
+
* prepaint logic reading `localStorage` or `matchMedia` before hydration.
|
|
67
60
|
*/
|
|
68
61
|
readonly prepaintScript?: InertiaDocumentValue;
|
|
69
62
|
/**
|
|
70
|
-
* Raw markup inlined into `<head>`, ahead of the critical CSS
|
|
71
|
-
*
|
|
72
|
-
* site-wide tags the framework has no way to infer on its own, such as
|
|
73
|
-
* `<link rel="icon">` favicons.
|
|
63
|
+
* Raw markup inlined into `<head>`, ahead of the critical CSS. Unescaped —
|
|
64
|
+
* the app author owns this string. For static site-wide tags like favicons.
|
|
74
65
|
*/
|
|
75
66
|
readonly head?: InertiaDocumentValue;
|
|
76
67
|
}
|
|
77
68
|
/**
|
|
78
|
-
* Register app-wide document defaults for server-rendered Inertia responses
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* scope in the app entry so every runtime (Bun, serverless handlers, generated
|
|
84
|
-
* worker bundles) picks it up.
|
|
85
|
-
*
|
|
86
|
-
* Registration is process-wide and not request-scoped: calling this while
|
|
87
|
-
* requests are in flight leaks the new policy into them. Use the matching
|
|
88
|
-
* {@link InertiaOptions} fields for a single response instead.
|
|
89
|
-
*
|
|
90
|
-
* The values are emitted verbatim — inside `<style>` / `<script>` elements,
|
|
91
|
-
* or as raw markup for `head` — they are developer-authored assets, never
|
|
92
|
-
* user input.
|
|
93
|
-
*
|
|
94
|
-
* ```typescript
|
|
95
|
-
* setInertiaDocument({
|
|
96
|
-
* bodyClass: ({ component }) => (component.startsWith('Docs/') ? 'docs-theme' : undefined),
|
|
97
|
-
* })
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* Pass `undefined` to clear (test isolation).
|
|
69
|
+
* Register app-wide document defaults for server-rendered Inertia responses;
|
|
70
|
+
* call it at module scope in the app entry so every runtime picks it up.
|
|
71
|
+
* Process-wide, not request-scoped: calling it mid-flight leaks the policy into
|
|
72
|
+
* in-flight requests — use the {@link InertiaOptions} fields per response.
|
|
73
|
+
* Values are emitted verbatim, so never pass user input. `undefined` clears.
|
|
101
74
|
*/
|
|
102
75
|
export declare function setInertiaDocument(options: InertiaDocumentOptions | undefined): void;
|
|
103
76
|
/**
|
|
104
|
-
* Register a process-wide default SSR renderer
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* dynamic import) register the statically imported renderer once at module
|
|
109
|
-
* scope. Per-call `ssr.render` still takes precedence; pass `undefined` to
|
|
110
|
-
* clear (test isolation).
|
|
77
|
+
* Register a process-wide default SSR renderer, for adapters whose bundler
|
|
78
|
+
* cannot resolve a runtime path (Workers has no filesystem for
|
|
79
|
+
* `GUREN_INERTIA_SSR_ENTRY`'s dynamic import). Per-call `ssr.render` still
|
|
80
|
+
* wins; `undefined` clears (test isolation).
|
|
111
81
|
*/
|
|
112
82
|
export declare function setInertiaSsrRenderer(renderer: InertiaSsrRenderer | undefined): void;
|
|
113
83
|
export declare function inertia(component: string, props: Record<string, unknown>, options?: InertiaOptions): Promise<Response>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Context } from 'hono';
|
|
2
2
|
import type { ContainerLike } from '../../container/types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Application-level shared props shape for Inertia responses.
|
|
5
|
-
*
|
|
4
|
+
* Application-level shared props shape for Inertia responses. Extend it in your
|
|
5
|
+
* app via declaration merging to type shared props.
|
|
6
6
|
*/
|
|
7
7
|
export interface InertiaSharedProps {
|
|
8
8
|
}
|
|
@@ -63,23 +63,10 @@ export declare function setInertiaSharedProps<Props extends Record<string, unkno
|
|
|
63
63
|
*/
|
|
64
64
|
export declare function getInertiaSharedPropsResolver(): SharedInertiaPropsResolver<ResolvedSharedInertiaProps> | null;
|
|
65
65
|
/**
|
|
66
|
-
* Register additional shared props without replacing resolvers
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* Pass the provider's `this.container` to scope the props to one application.
|
|
72
|
-
* Without it the props are module-global, so a second Application booted in
|
|
73
|
-
* the same process shares them.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* export class AuthProvider extends ServiceProvider {
|
|
78
|
-
* boot(): void {
|
|
79
|
-
* shareInertiaProps(async (ctx) => ({ auth: { user: await currentUser(ctx) } }), this.container)
|
|
80
|
-
* }
|
|
81
|
-
* }
|
|
82
|
-
* ```
|
|
66
|
+
* Register additional shared props without replacing earlier resolvers, so
|
|
67
|
+
* several providers can each contribute (`setInertiaSharedProps` replaces
|
|
68
|
+
* wholesale). Pass the provider's `this.container` to scope them; without it
|
|
69
|
+
* they are module-global and a second Application in the process shares them.
|
|
83
70
|
*/
|
|
84
71
|
export declare function shareInertiaProps<Props extends Record<string, unknown>>(resolverFn: SharedInertiaPropsResolver<Props>, container?: SharedPropsContainer): void;
|
|
85
72
|
/**
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { MiddlewareHandler, Hono } from 'hono';
|
|
2
2
|
/**
|
|
3
|
-
* Mounts a route
|
|
4
|
-
*
|
|
5
|
-
* Hono's app.on() uses complex overloads that expect literal types for the
|
|
6
|
-
* method parameter, making it incompatible with dynamic `string` values at
|
|
7
|
-
* the type level. This helper encapsulates the single narrowing cast needed,
|
|
8
|
-
* keeping the rest of the codebase cast-free.
|
|
3
|
+
* Mounts a route with a dynamic HTTP method string. Hono's `app.on()` overloads
|
|
4
|
+
* expect literal method types, so this helper holds the one narrowing cast.
|
|
9
5
|
*/
|
|
10
6
|
export declare function mountRoute(app: Hono, method: string, path: string, ...handlers: MiddlewareHandler[]): void;
|
package/dist/mvc/view.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export type ViewOptions = ResponseInit & {
|
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Render a `hono/jsx` component to a plain server-rendered HTML `Response` —
|
|
12
|
-
* the engine behind `Controller.view()` (RFC 0014)
|
|
13
|
-
* `inertia()` is from `Controller.inertia()`.
|
|
12
|
+
* the engine behind `Controller.view()` (RFC 0014).
|
|
14
13
|
*/
|
|
15
14
|
export declare function renderDocument<P>(component: FC<P>, props: P, options?: ViewOptions): Promise<Response>;
|
|
@@ -1,96 +1,29 @@
|
|
|
1
1
|
import type { Notifiable, NotificationMailMessage, SlackMessage } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Base notification class.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* ```typescript
|
|
7
|
-
* class OrderShipped extends Notification {
|
|
8
|
-
* static shouldQueue = true
|
|
9
|
-
* static queue = 'notifications'
|
|
10
|
-
*
|
|
11
|
-
* constructor(private order: Order) {
|
|
12
|
-
* super()
|
|
13
|
-
* }
|
|
14
|
-
*
|
|
15
|
-
* via(notifiable: Notifiable): string[] {
|
|
16
|
-
* return ['mail', 'database']
|
|
17
|
-
* }
|
|
18
|
-
*
|
|
19
|
-
* toMail(notifiable: Notifiable): NotificationMailMessage {
|
|
20
|
-
* return {
|
|
21
|
-
* subject: `Order #${this.order.id} shipped`,
|
|
22
|
-
* html: '<p>Your order is on its way!</p>',
|
|
23
|
-
* }
|
|
24
|
-
* }
|
|
25
|
-
*
|
|
26
|
-
* toDatabase(notifiable: Notifiable): Record<string, unknown> {
|
|
27
|
-
* return {
|
|
28
|
-
* orderId: this.order.id,
|
|
29
|
-
* message: 'Your order has shipped',
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
3
|
+
* Base notification class. Subclasses declare their channels in `via()` and one
|
|
4
|
+
* `to*()` method per channel; `static shouldQueue`/`queue`/`delay` control
|
|
5
|
+
* queueing.
|
|
34
6
|
*/
|
|
35
7
|
export declare abstract class Notification {
|
|
36
|
-
/**
|
|
37
|
-
* Whether this notification should be queued.
|
|
38
|
-
*/
|
|
39
8
|
static shouldQueue: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* The queue name for this notification.
|
|
42
|
-
*/
|
|
43
9
|
static queue?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Delay in milliseconds before sending.
|
|
46
|
-
*/
|
|
10
|
+
/** Delay in milliseconds before sending. */
|
|
47
11
|
static delay?: number;
|
|
48
|
-
/**
|
|
49
|
-
* Unique notification ID.
|
|
50
|
-
*/
|
|
51
12
|
readonly id: string;
|
|
52
|
-
/**
|
|
53
|
-
* When the notification was created.
|
|
54
|
-
*/
|
|
55
13
|
readonly createdAt: Date;
|
|
56
14
|
constructor();
|
|
57
|
-
/**
|
|
58
|
-
* Get the notification's delivery channels.
|
|
59
|
-
*/
|
|
15
|
+
/** The notification's delivery channels. */
|
|
60
16
|
abstract via(notifiable: Notifiable): string[];
|
|
61
|
-
/**
|
|
62
|
-
* Get the mail representation of the notification.
|
|
63
|
-
*/
|
|
64
17
|
toMail?(notifiable: Notifiable): NotificationMailMessage;
|
|
65
|
-
/**
|
|
66
|
-
* Get the database representation of the notification.
|
|
67
|
-
*/
|
|
68
18
|
toDatabase?(notifiable: Notifiable): Record<string, unknown>;
|
|
69
|
-
/**
|
|
70
|
-
* Get the Slack representation of the notification.
|
|
71
|
-
*/
|
|
72
19
|
toSlack?(notifiable: Notifiable): SlackMessage;
|
|
73
|
-
/**
|
|
74
|
-
* Get the array representation of the notification.
|
|
75
|
-
* Used as a fallback for any channel.
|
|
76
|
-
*/
|
|
20
|
+
/** Fallback representation for any channel with no dedicated method. */
|
|
77
21
|
toArray?(notifiable: Notifiable): Record<string, unknown>;
|
|
78
|
-
/**
|
|
79
|
-
* Get the notification type (default: class name).
|
|
80
|
-
*/
|
|
22
|
+
/** Notification type; defaults to the class name. */
|
|
81
23
|
get type(): string;
|
|
82
|
-
/**
|
|
83
|
-
* Check if the notification should be sent to the given notifiable.
|
|
84
|
-
* Override to add custom logic.
|
|
85
|
-
*/
|
|
24
|
+
/** Override to skip delivery for a given notifiable. */
|
|
86
25
|
shouldSend(_notifiable: Notifiable): boolean | Promise<boolean>;
|
|
87
|
-
/**
|
|
88
|
-
* Generate a unique notification ID.
|
|
89
|
-
*/
|
|
90
26
|
protected generateId(): string;
|
|
91
|
-
/**
|
|
92
|
-
* Get static queue configuration.
|
|
93
|
-
*/
|
|
94
27
|
static getQueueConfig(): {
|
|
95
28
|
shouldQueue: boolean;
|
|
96
29
|
queue?: string;
|