@guren/server 2.15.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-nNcbCIQX.js} +11 -20
- package/dist/{Random-DbIJ22KQ.js → Random-S0OvCuR8.js} +9 -106
- package/dist/agent/AgentApprovalRequested.d.ts +11 -39
- 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 +11 -19
- package/dist/agent/meta-tools.d.ts +18 -46
- 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 +23 -69
- package/dist/auth/AuthManager.d.ts +19 -40
- 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-CbdPH4Cd.js} +169 -502
- 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 +62 -208
- 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 +20 -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/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 +2 -1
- package/dist/index.js +714 -3011
- package/dist/internal/agent-preflight.d.ts +9 -21
- 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 +25 -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-CTQp-SOo.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
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resource data type.
|
|
3
|
-
*/
|
|
1
|
+
/** Resource data type. */
|
|
4
2
|
export type ResourceData = Record<string, unknown>;
|
|
5
3
|
export type ValidationErrors<TField extends string = string> = Partial<Record<TField | 'message', string>>;
|
|
6
|
-
/**
|
|
7
|
-
* Pagination meta information.
|
|
8
|
-
*/
|
|
4
|
+
/** Pagination meta information. */
|
|
9
5
|
export interface PaginationMeta {
|
|
10
6
|
currentPage: number;
|
|
11
7
|
lastPage: number;
|
|
@@ -14,9 +10,7 @@ export interface PaginationMeta {
|
|
|
14
10
|
from: number | null;
|
|
15
11
|
to: number | null;
|
|
16
12
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Pagination links.
|
|
19
|
-
*/
|
|
13
|
+
/** One entry of {@link PaginationLinks.pages}. */
|
|
20
14
|
export interface PaginationPageLink {
|
|
21
15
|
page: number;
|
|
22
16
|
url: string | null;
|
|
@@ -29,9 +23,7 @@ export interface PaginationLinks {
|
|
|
29
23
|
next: string | null;
|
|
30
24
|
pages: PaginationPageLink[];
|
|
31
25
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Paginated response structure.
|
|
34
|
-
*/
|
|
26
|
+
/** Paginated response structure. */
|
|
35
27
|
export interface PaginatedResponse<T> {
|
|
36
28
|
data: T[];
|
|
37
29
|
meta: PaginationMeta;
|
|
@@ -44,46 +36,34 @@ export interface PaginatedPageProps<T> extends Record<string, unknown> {
|
|
|
44
36
|
links: PaginationLinks;
|
|
45
37
|
};
|
|
46
38
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Cursor pagination meta information.
|
|
49
|
-
*/
|
|
39
|
+
/** Cursor pagination meta information. */
|
|
50
40
|
export interface CursorPaginationMeta {
|
|
51
41
|
perPage: number;
|
|
52
42
|
nextCursor: string | null;
|
|
53
43
|
prevCursor: string | null;
|
|
54
44
|
hasMore: boolean;
|
|
55
45
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Cursor paginated response structure.
|
|
58
|
-
*/
|
|
46
|
+
/** Cursor paginated response structure. */
|
|
59
47
|
export interface CursorPaginatedResponse<T> {
|
|
60
48
|
data: T[];
|
|
61
49
|
meta: CursorPaginationMeta;
|
|
62
50
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Paginator options.
|
|
65
|
-
*/
|
|
51
|
+
/** Paginator options. */
|
|
66
52
|
export interface PaginatorOptions {
|
|
67
53
|
path?: string;
|
|
68
54
|
query?: Record<string, string>;
|
|
69
55
|
fragment?: string;
|
|
70
56
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Cursor paginator options.
|
|
73
|
-
*/
|
|
57
|
+
/** Cursor paginator options. */
|
|
74
58
|
export interface CursorPaginatorOptions {
|
|
75
59
|
cursorName?: string;
|
|
76
60
|
parameters?: Record<string, string>;
|
|
77
61
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Resource class type.
|
|
80
|
-
*/
|
|
62
|
+
/** Resource class type. */
|
|
81
63
|
export interface ResourceClass<T, R extends BaseResource<T>> {
|
|
82
64
|
new (resource: T): R;
|
|
83
65
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Base resource interface.
|
|
86
|
-
*/
|
|
66
|
+
/** Base resource interface. */
|
|
87
67
|
export interface BaseResource<T> {
|
|
88
68
|
toArray(): ResourceData;
|
|
89
69
|
toJSON(): ResourceData;
|
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
import type { Context } from 'hono';
|
|
2
2
|
/**
|
|
3
|
-
* Judged on the media type alone
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* verbatim is precisely how the check stops matching while still looking
|
|
7
|
-
* present.
|
|
3
|
+
* Judged on the media type alone: both inputs are parameterised (`getMimeType`
|
|
4
|
+
* returns `text/html; charset=utf-8`, and so does a `contentTypeMap` entry), so
|
|
5
|
+
* comparing the header verbatim silently stops matching.
|
|
8
6
|
*/
|
|
9
7
|
export declare function rendersAsDocument(contentType: string | undefined | null): boolean;
|
|
10
8
|
/**
|
|
11
9
|
* Neutralizes a served document by turning it into a download.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* working unchanged, while `/logo.svg` opened directly is downloaded instead
|
|
17
|
-
* of rendered. An `<iframe>` or `<object>` *is* a navigation, so an SVG or
|
|
18
|
-
* HTML page embedded that way stops rendering — which is the same mechanism
|
|
19
|
-
* as the fix, not an exception to it. `nosniff` rides along for the types a
|
|
20
|
-
* browser would otherwise promote on its own.
|
|
10
|
+
* `Content-Disposition: attachment` is honoured for navigations and ignored for
|
|
11
|
+
* subresource loads, so `<img>`, `<link rel="icon">` and CSS `url()` keep
|
|
12
|
+
* working while a direct visit downloads. An `<iframe>`/`<object>` *is* a
|
|
13
|
+
* navigation, so embedding an SVG or HTML page that way stops rendering.
|
|
21
14
|
*/
|
|
22
15
|
export declare function applyDocumentDisposition(headers: Headers, contentType: string | undefined | null): void;
|
|
23
16
|
/**
|
|
24
|
-
* The {@link
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* Keyed on the same `getMimeType(path)` the middleware itself used a line
|
|
28
|
-
* earlier to set `Content-Type`, rather than on the extension: the two agree
|
|
29
|
-
* by construction only while they read the same function.
|
|
17
|
+
* The `serveStatic` `onFound` form of {@link applyDocumentDisposition}. Keyed on
|
|
18
|
+
* the same `getMimeType(path)` that middleware uses for `Content-Type`, not on
|
|
19
|
+
* the extension: the two agree only while they read the same function.
|
|
30
20
|
*/
|
|
31
21
|
export declare function guardStaticDocument(path: string, ctx: Context): void;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { ValidationRule, ValidationResult, ValidatorOptions } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Field validator builder.
|
|
4
|
-
*/
|
|
2
|
+
/** Field validator builder. */
|
|
5
3
|
export declare class FieldValidator {
|
|
6
4
|
private field;
|
|
7
5
|
private _rules;
|
|
@@ -10,119 +8,61 @@ export declare class FieldValidator {
|
|
|
10
8
|
private bailOnFirstError;
|
|
11
9
|
private conditions;
|
|
12
10
|
constructor(field: string);
|
|
13
|
-
/**
|
|
14
|
-
* Add a validation rule.
|
|
15
|
-
*/
|
|
11
|
+
/** Add a validation rule. */
|
|
16
12
|
rule(rule: ValidationRule): this;
|
|
17
|
-
/**
|
|
18
|
-
* Add multiple validation rules.
|
|
19
|
-
*/
|
|
13
|
+
/** Add multiple validation rules. */
|
|
20
14
|
rules(...rules: ValidationRule[]): this;
|
|
21
|
-
/**
|
|
22
|
-
* Mark field as nullable (allows null values).
|
|
23
|
-
*/
|
|
15
|
+
/** Mark field as nullable (allows null values). */
|
|
24
16
|
nullable(): this;
|
|
25
|
-
/**
|
|
26
|
-
* Only validate if field is present.
|
|
27
|
-
*/
|
|
17
|
+
/** Only validate if field is present. */
|
|
28
18
|
sometimes(): this;
|
|
29
|
-
/**
|
|
30
|
-
* Stop validation on first error.
|
|
31
|
-
*/
|
|
19
|
+
/** Stop validation on first error. */
|
|
32
20
|
bail(): this;
|
|
33
|
-
/**
|
|
34
|
-
* Continue validation even after errors.
|
|
35
|
-
*/
|
|
21
|
+
/** Continue validation even after errors. */
|
|
36
22
|
continueOnError(): this;
|
|
37
|
-
/**
|
|
38
|
-
* Add a condition - only validate if condition is true.
|
|
39
|
-
*/
|
|
23
|
+
/** Add a condition - only validate if condition is true. */
|
|
40
24
|
when(condition: (data: Record<string, unknown>) => boolean): this;
|
|
41
|
-
/**
|
|
42
|
-
* Add a condition - only validate if condition is false.
|
|
43
|
-
*/
|
|
25
|
+
/** Add a condition - only validate if condition is false. */
|
|
44
26
|
unless(condition: (data: Record<string, unknown>) => boolean): this;
|
|
45
|
-
/**
|
|
46
|
-
* Validate the field.
|
|
47
|
-
*/
|
|
27
|
+
/** Validate the field. */
|
|
48
28
|
validate(value: unknown, data: Record<string, unknown>, options?: ValidatorOptions): Promise<string[]>;
|
|
49
|
-
/**
|
|
50
|
-
* Format error message.
|
|
51
|
-
*/
|
|
29
|
+
/** Format error message. */
|
|
52
30
|
private formatMessage;
|
|
53
|
-
/**
|
|
54
|
-
* Get the field name.
|
|
55
|
-
*/
|
|
31
|
+
/** Get the field name. */
|
|
56
32
|
getField(): string;
|
|
57
33
|
}
|
|
58
34
|
/**
|
|
59
35
|
* Validator class for validating data against rules.
|
|
60
|
-
*
|
|
61
36
|
* @example
|
|
62
37
|
* ```typescript
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* const validator = new Validator()
|
|
66
|
-
* .field('name', required(), min(2))
|
|
67
|
-
* .field('email', required(), email())
|
|
68
|
-
* .field('password', required(), min(8))
|
|
69
|
-
* .field('password_confirmation', required())
|
|
70
|
-
*
|
|
71
|
-
* const result = await validator.validate(data)
|
|
72
|
-
* if (!result.success) {
|
|
73
|
-
* console.log(result.errors)
|
|
74
|
-
* }
|
|
38
|
+
* const result = await new Validator().field('email', required(), email()).validate(data)
|
|
75
39
|
* ```
|
|
76
40
|
*/
|
|
77
41
|
export declare class Validator {
|
|
78
42
|
private fields;
|
|
79
43
|
private options;
|
|
80
|
-
/**
|
|
81
|
-
* Create a new validator.
|
|
82
|
-
*/
|
|
44
|
+
/** Create a new validator. */
|
|
83
45
|
constructor(options?: ValidatorOptions);
|
|
84
|
-
/**
|
|
85
|
-
* Add a field with rules.
|
|
86
|
-
*/
|
|
46
|
+
/** Add a field with rules. */
|
|
87
47
|
field(name: string, ...rules: ValidationRule[]): this;
|
|
88
|
-
/**
|
|
89
|
-
* Add a field validator.
|
|
90
|
-
*/
|
|
48
|
+
/** Add a field validator. */
|
|
91
49
|
addField(validator: FieldValidator): this;
|
|
92
|
-
/**
|
|
93
|
-
* Get a field validator for fluent configuration.
|
|
94
|
-
*/
|
|
50
|
+
/** Get a field validator for fluent configuration. */
|
|
95
51
|
for(name: string): FieldValidator;
|
|
96
|
-
/**
|
|
97
|
-
* Set custom error messages.
|
|
98
|
-
*/
|
|
52
|
+
/** Set custom error messages. */
|
|
99
53
|
messages(messages: Record<string, string>): this;
|
|
100
|
-
/**
|
|
101
|
-
* Set custom attribute names.
|
|
102
|
-
*/
|
|
54
|
+
/** Set custom attribute names. */
|
|
103
55
|
attributes(attributes: Record<string, string>): this;
|
|
104
|
-
/**
|
|
105
|
-
* Validate data.
|
|
106
|
-
*/
|
|
56
|
+
/** Validate data. */
|
|
107
57
|
validate(data: Record<string, unknown>): Promise<ValidationResult>;
|
|
108
|
-
/**
|
|
109
|
-
* Validate and throw if invalid.
|
|
110
|
-
*/
|
|
58
|
+
/** Validate and throw if invalid. */
|
|
111
59
|
validateOrThrow(data: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
112
|
-
/**
|
|
113
|
-
* Create a new validator from rules object.
|
|
114
|
-
*/
|
|
60
|
+
/** Create a new validator from rules object. */
|
|
115
61
|
static make(rules: Record<string, ValidationRule[]>, options?: ValidatorOptions): Validator;
|
|
116
62
|
}
|
|
117
|
-
/**
|
|
118
|
-
* Create a new validator.
|
|
119
|
-
*/
|
|
63
|
+
/** Create a new validator. */
|
|
120
64
|
export declare function createValidator(options?: ValidatorOptions): Validator;
|
|
121
|
-
/**
|
|
122
|
-
* Quick validate function.
|
|
123
|
-
*/
|
|
65
|
+
/** Quick validate function. */
|
|
124
66
|
export declare function quickValidate(data: Record<string, unknown>, rules: Record<string, ValidationRule[]>, options?: ValidatorOptions): Promise<ValidationResult>;
|
|
125
|
-
/**
|
|
126
|
-
* Quick validate and throw function.
|
|
127
|
-
*/
|
|
67
|
+
/** Quick validate and throw function. */
|
|
128
68
|
export declare function quickValidateOrThrow(data: Record<string, unknown>, rules: Record<string, ValidationRule[]>, options?: ValidatorOptions): Promise<Record<string, unknown>>;
|
|
@@ -1,196 +1,97 @@
|
|
|
1
1
|
import type { ValidationRule, FileValidationOptions, ImageValidationOptions } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Built-in validation rules.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Required rule - value must be present and not empty.
|
|
7
|
-
*/
|
|
2
|
+
/** Required rule - value must be present and not empty. */
|
|
8
3
|
export declare function required(): ValidationRule;
|
|
9
|
-
/**
|
|
10
|
-
* Nullable rule - allows null values (removes other validation if null).
|
|
11
|
-
*/
|
|
4
|
+
/** Nullable rule - allows null values (removes other validation if null). */
|
|
12
5
|
export declare function nullable(): ValidationRule;
|
|
13
|
-
/**
|
|
14
|
-
* Required if another field equals a value.
|
|
15
|
-
*/
|
|
6
|
+
/** Required if another field equals a value. */
|
|
16
7
|
export declare function requiredIf(field: string, value: unknown): ValidationRule;
|
|
17
|
-
/**
|
|
18
|
-
* Required unless another field equals a value.
|
|
19
|
-
*/
|
|
8
|
+
/** Required unless another field equals a value. */
|
|
20
9
|
export declare function requiredUnless(field: string, value: unknown): ValidationRule;
|
|
21
|
-
/**
|
|
22
|
-
* Required with - field is required if any of the other fields are present.
|
|
23
|
-
*/
|
|
10
|
+
/** Required with - field is required if any of the other fields are present. */
|
|
24
11
|
export declare function requiredWith(...fields: string[]): ValidationRule;
|
|
25
|
-
/**
|
|
26
|
-
* Required without - field is required if any of the other fields are not present.
|
|
27
|
-
*/
|
|
12
|
+
/** Required without - field is required if any of the other fields are not present. */
|
|
28
13
|
export declare function requiredWithout(...fields: string[]): ValidationRule;
|
|
29
|
-
/**
|
|
30
|
-
* String rule - value must be a string.
|
|
31
|
-
*/
|
|
14
|
+
/** String rule - value must be a string. */
|
|
32
15
|
export declare function string(): ValidationRule;
|
|
33
|
-
/**
|
|
34
|
-
* Numeric rule - value must be a number.
|
|
35
|
-
*/
|
|
16
|
+
/** Numeric rule - value must be a number. */
|
|
36
17
|
export declare function numeric(): ValidationRule;
|
|
37
|
-
/**
|
|
38
|
-
* Integer rule - value must be an integer.
|
|
39
|
-
*/
|
|
18
|
+
/** Integer rule - value must be an integer. */
|
|
40
19
|
export declare function integer(): ValidationRule;
|
|
41
|
-
/**
|
|
42
|
-
* Boolean rule - value must be a boolean.
|
|
43
|
-
*/
|
|
20
|
+
/** Boolean rule - value must be a boolean. */
|
|
44
21
|
export declare function boolean(): ValidationRule;
|
|
45
|
-
/**
|
|
46
|
-
* Array rule - value must be an array.
|
|
47
|
-
*/
|
|
22
|
+
/** Array rule - value must be an array. */
|
|
48
23
|
export declare function array(): ValidationRule;
|
|
49
|
-
/**
|
|
50
|
-
* Object rule - value must be an object.
|
|
51
|
-
*/
|
|
24
|
+
/** Object rule - value must be an object. */
|
|
52
25
|
export declare function object(): ValidationRule;
|
|
53
|
-
/**
|
|
54
|
-
* Email rule - value must be a valid email.
|
|
55
|
-
*/
|
|
26
|
+
/** Email rule - value must be a valid email. */
|
|
56
27
|
export declare function email(): ValidationRule;
|
|
57
|
-
/**
|
|
58
|
-
* URL rule - value must be a valid URL.
|
|
59
|
-
*/
|
|
28
|
+
/** URL rule - value must be a valid URL. */
|
|
60
29
|
export declare function url(): ValidationRule;
|
|
61
|
-
/**
|
|
62
|
-
* UUID rule - value must be a valid UUID.
|
|
63
|
-
*/
|
|
30
|
+
/** UUID rule - value must be a valid UUID. */
|
|
64
31
|
export declare function uuid(): ValidationRule;
|
|
65
|
-
/**
|
|
66
|
-
* Minimum rule - value must be at least min.
|
|
67
|
-
*/
|
|
32
|
+
/** Minimum rule - value must be at least min. */
|
|
68
33
|
export declare function min(minValue: number): ValidationRule;
|
|
69
|
-
/**
|
|
70
|
-
* Maximum rule - value must be at most max.
|
|
71
|
-
*/
|
|
34
|
+
/** Maximum rule - value must be at most max. */
|
|
72
35
|
export declare function max(maxValue: number): ValidationRule;
|
|
73
|
-
/**
|
|
74
|
-
* Between rule - value must be between min and max.
|
|
75
|
-
*/
|
|
36
|
+
/** Between rule - value must be between min and max. */
|
|
76
37
|
export declare function between(minValue: number, maxValue: number): ValidationRule;
|
|
77
|
-
/**
|
|
78
|
-
* Size rule - value must be exactly size.
|
|
79
|
-
*/
|
|
38
|
+
/** Size rule - value must be exactly size. */
|
|
80
39
|
export declare function size(exactSize: number): ValidationRule;
|
|
81
|
-
/**
|
|
82
|
-
* In rule - value must be in the given array.
|
|
83
|
-
*/
|
|
40
|
+
/** In rule - value must be in the given array. */
|
|
84
41
|
export declare function inValues(values: unknown[]): ValidationRule;
|
|
85
|
-
/**
|
|
86
|
-
* Not in rule - value must not be in the given array.
|
|
87
|
-
*/
|
|
42
|
+
/** Not in rule - value must not be in the given array. */
|
|
88
43
|
export declare function notIn(values: unknown[]): ValidationRule;
|
|
89
|
-
/**
|
|
90
|
-
* Regex rule - value must match the regex.
|
|
91
|
-
*/
|
|
44
|
+
/** Regex rule - value must match the regex. */
|
|
92
45
|
export declare function regex(pattern: RegExp): ValidationRule;
|
|
93
|
-
/**
|
|
94
|
-
* Confirmed rule - field must have a matching field_confirmation.
|
|
95
|
-
*/
|
|
46
|
+
/** Confirmed rule - field must have a matching field_confirmation. */
|
|
96
47
|
export declare function confirmed(): ValidationRule;
|
|
97
|
-
/**
|
|
98
|
-
* Same rule - field must match another field.
|
|
99
|
-
*/
|
|
48
|
+
/** Same rule - field must match another field. */
|
|
100
49
|
export declare function same(otherField: string): ValidationRule;
|
|
101
|
-
/**
|
|
102
|
-
* Different rule - field must be different from another field.
|
|
103
|
-
*/
|
|
50
|
+
/** Different rule - field must be different from another field. */
|
|
104
51
|
export declare function different(otherField: string): ValidationRule;
|
|
105
|
-
/**
|
|
106
|
-
* After rule - date must be after another date.
|
|
107
|
-
*/
|
|
52
|
+
/** After rule - date must be after another date. */
|
|
108
53
|
export declare function after(date: string | Date): ValidationRule;
|
|
109
|
-
/**
|
|
110
|
-
* After or equal rule - date must be after or equal to another date.
|
|
111
|
-
*/
|
|
54
|
+
/** After or equal rule - date must be after or equal to another date. */
|
|
112
55
|
export declare function afterOrEqual(date: string | Date): ValidationRule;
|
|
113
|
-
/**
|
|
114
|
-
* Before rule - date must be before another date.
|
|
115
|
-
*/
|
|
56
|
+
/** Before rule - date must be before another date. */
|
|
116
57
|
export declare function before(date: string | Date): ValidationRule;
|
|
117
|
-
/**
|
|
118
|
-
* Before or equal rule - date must be before or equal to another date.
|
|
119
|
-
*/
|
|
58
|
+
/** Before or equal rule - date must be before or equal to another date. */
|
|
120
59
|
export declare function beforeOrEqual(date: string | Date): ValidationRule;
|
|
121
|
-
/**
|
|
122
|
-
* Date rule - value must be a valid date.
|
|
123
|
-
*/
|
|
60
|
+
/** Date rule - value must be a valid date. */
|
|
124
61
|
export declare function date(): ValidationRule;
|
|
125
|
-
/**
|
|
126
|
-
* Date format rule - value must match the given format.
|
|
127
|
-
*/
|
|
62
|
+
/** Date format rule - value must match the given format. */
|
|
128
63
|
export declare function dateFormat(format: string): ValidationRule;
|
|
129
|
-
/**
|
|
130
|
-
* Alpha rule - value must only contain letters.
|
|
131
|
-
*/
|
|
64
|
+
/** Alpha rule - value must only contain letters. */
|
|
132
65
|
export declare function alpha(): ValidationRule;
|
|
133
|
-
/**
|
|
134
|
-
* Alpha numeric rule - value must only contain letters and numbers.
|
|
135
|
-
*/
|
|
66
|
+
/** Alpha numeric rule - value must only contain letters and numbers. */
|
|
136
67
|
export declare function alphaNum(): ValidationRule;
|
|
137
|
-
/**
|
|
138
|
-
* Alpha dash rule - value must only contain letters, numbers, dashes, and underscores.
|
|
139
|
-
*/
|
|
68
|
+
/** Alpha dash rule - value must only contain letters, numbers, dashes, and underscores. */
|
|
140
69
|
export declare function alphaDash(): ValidationRule;
|
|
141
|
-
/**
|
|
142
|
-
* Starts with rule - value must start with one of the given prefixes.
|
|
143
|
-
*/
|
|
70
|
+
/** Starts with rule - value must start with one of the given prefixes. */
|
|
144
71
|
export declare function startsWith(...prefixes: string[]): ValidationRule;
|
|
145
|
-
/**
|
|
146
|
-
* Ends with rule - value must end with one of the given suffixes.
|
|
147
|
-
*/
|
|
72
|
+
/** Ends with rule - value must end with one of the given suffixes. */
|
|
148
73
|
export declare function endsWith(...suffixes: string[]): ValidationRule;
|
|
149
|
-
/**
|
|
150
|
-
* JSON rule - value must be a valid JSON string.
|
|
151
|
-
*/
|
|
74
|
+
/** JSON rule - value must be a valid JSON string. */
|
|
152
75
|
export declare function json(): ValidationRule;
|
|
153
|
-
/**
|
|
154
|
-
* IP rule - value must be a valid IP address.
|
|
155
|
-
*/
|
|
76
|
+
/** IP rule - value must be a valid IP address. */
|
|
156
77
|
export declare function ip(): ValidationRule;
|
|
157
|
-
/**
|
|
158
|
-
* IPv4 rule - value must be a valid IPv4 address.
|
|
159
|
-
*/
|
|
78
|
+
/** IPv4 rule - value must be a valid IPv4 address. */
|
|
160
79
|
export declare function ipv4(): ValidationRule;
|
|
161
|
-
/**
|
|
162
|
-
* IPv6 rule - value must be a valid IPv6 address.
|
|
163
|
-
*/
|
|
80
|
+
/** IPv6 rule - value must be a valid IPv6 address. */
|
|
164
81
|
export declare function ipv6(): ValidationRule;
|
|
165
|
-
/**
|
|
166
|
-
* File rule - validates a file object.
|
|
167
|
-
*/
|
|
82
|
+
/** File rule - validates a file object. */
|
|
168
83
|
export declare function file(options?: FileValidationOptions): ValidationRule;
|
|
169
|
-
/**
|
|
170
|
-
* Image rule - validates an image file.
|
|
171
|
-
*/
|
|
84
|
+
/** Image rule - validates an image file. */
|
|
172
85
|
export declare function image(options?: ImageValidationOptions): ValidationRule;
|
|
173
|
-
/**
|
|
174
|
-
* Mimes rule - validates file MIME types.
|
|
175
|
-
*/
|
|
86
|
+
/** Mimes rule - validates file MIME types. */
|
|
176
87
|
export declare function mimes(...mimeTypes: string[]): ValidationRule;
|
|
177
|
-
/**
|
|
178
|
-
* Max file size rule.
|
|
179
|
-
*/
|
|
88
|
+
/** Max file size rule. */
|
|
180
89
|
export declare function maxFileSize(bytes: number): ValidationRule;
|
|
181
|
-
/**
|
|
182
|
-
* Min file size rule.
|
|
183
|
-
*/
|
|
90
|
+
/** Min file size rule. */
|
|
184
91
|
export declare function minFileSize(bytes: number): ValidationRule;
|
|
185
|
-
/**
|
|
186
|
-
* Custom rule - create a custom validation rule.
|
|
187
|
-
*/
|
|
92
|
+
/** Custom rule - create a custom validation rule. */
|
|
188
93
|
export declare function custom(validate: (value: unknown, field: string, data: Record<string, unknown>) => boolean | string | Promise<boolean | string>, message?: string): ValidationRule;
|
|
189
|
-
/**
|
|
190
|
-
* Unique rule (async) - checks uniqueness via callback.
|
|
191
|
-
*/
|
|
94
|
+
/** Unique rule (async) - checks uniqueness via callback. */
|
|
192
95
|
export declare function unique(callback: (value: unknown, field: string) => Promise<boolean>): ValidationRule;
|
|
193
|
-
/**
|
|
194
|
-
* Exists rule (async) - checks existence via callback.
|
|
195
|
-
*/
|
|
96
|
+
/** Exists rule (async) - checks existence via callback. */
|
|
196
97
|
export declare function exists(callback: (value: unknown, field: string) => Promise<boolean>): ValidationRule;
|
|
@@ -1,94 +1,49 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validation rule function type.
|
|
3
|
-
*/
|
|
1
|
+
/** Returns `true` when valid, or the error message. */
|
|
4
2
|
export type ValidationRule<T = unknown> = (value: T, field: string, data: Record<string, unknown>) => true | string | Promise<true | string>;
|
|
5
|
-
/**
|
|
6
|
-
* Validation rule definition.
|
|
7
|
-
*/
|
|
3
|
+
/** Validation rule definition. */
|
|
8
4
|
export interface RuleDefinition {
|
|
9
5
|
name: string;
|
|
10
6
|
validate: ValidationRule;
|
|
11
7
|
message?: string;
|
|
12
8
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Validation result.
|
|
15
|
-
*/
|
|
9
|
+
/** Validation result. */
|
|
16
10
|
export interface ValidationResult {
|
|
17
11
|
success: boolean;
|
|
18
12
|
data?: Record<string, unknown>;
|
|
19
13
|
errors?: Record<string, string[]>;
|
|
20
14
|
}
|
|
21
|
-
/**
|
|
22
|
-
* File validation options.
|
|
23
|
-
*/
|
|
15
|
+
/** File validation options. */
|
|
24
16
|
export interface FileValidationOptions {
|
|
25
|
-
/**
|
|
26
|
-
* Maximum file size in bytes.
|
|
27
|
-
*/
|
|
17
|
+
/** In bytes. */
|
|
28
18
|
maxSize?: number;
|
|
29
|
-
/**
|
|
30
|
-
* Allowed MIME types.
|
|
31
|
-
*/
|
|
32
19
|
mimes?: string[];
|
|
33
|
-
/**
|
|
34
|
-
* Allowed file extensions.
|
|
35
|
-
*/
|
|
36
20
|
extensions?: string[];
|
|
37
|
-
/**
|
|
38
|
-
* Minimum file size in bytes.
|
|
39
|
-
*/
|
|
21
|
+
/** In bytes. */
|
|
40
22
|
minSize?: number;
|
|
41
23
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Image validation options.
|
|
44
|
-
*/
|
|
24
|
+
/** Image validation options. */
|
|
45
25
|
export interface ImageValidationOptions extends FileValidationOptions {
|
|
46
|
-
/**
|
|
47
|
-
* Maximum width in pixels.
|
|
48
|
-
*/
|
|
26
|
+
/** In pixels. */
|
|
49
27
|
maxWidth?: number;
|
|
50
|
-
/**
|
|
51
|
-
* Maximum height in pixels.
|
|
52
|
-
*/
|
|
28
|
+
/** In pixels. */
|
|
53
29
|
maxHeight?: number;
|
|
54
|
-
/**
|
|
55
|
-
* Minimum width in pixels.
|
|
56
|
-
*/
|
|
30
|
+
/** In pixels. */
|
|
57
31
|
minWidth?: number;
|
|
58
|
-
/**
|
|
59
|
-
* Minimum height in pixels.
|
|
60
|
-
*/
|
|
32
|
+
/** In pixels. */
|
|
61
33
|
minHeight?: number;
|
|
62
|
-
/**
|
|
63
|
-
* Required aspect ratio (width/height).
|
|
64
|
-
*/
|
|
34
|
+
/** Required aspect ratio (width/height). */
|
|
65
35
|
ratio?: number;
|
|
66
|
-
/**
|
|
67
|
-
* Allowed aspect ratio tolerance.
|
|
68
|
-
*/
|
|
69
36
|
ratioTolerance?: number;
|
|
70
37
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Validator options.
|
|
73
|
-
*/
|
|
38
|
+
/** Validator options. */
|
|
74
39
|
export interface ValidatorOptions {
|
|
75
|
-
/**
|
|
76
|
-
* Stop on first error for each field.
|
|
77
|
-
* @default true
|
|
78
|
-
*/
|
|
40
|
+
/** Stop on the first error for each field. @default true */
|
|
79
41
|
stopOnFirstError?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Custom error messages.
|
|
82
|
-
*/
|
|
83
42
|
messages?: Record<string, string>;
|
|
84
|
-
/**
|
|
85
|
-
* Custom attribute names for error messages.
|
|
86
|
-
*/
|
|
43
|
+
/** Attribute names substituted into error messages. */
|
|
87
44
|
attributes?: Record<string, string>;
|
|
88
45
|
}
|
|
89
|
-
/**
|
|
90
|
-
* File-like interface for validation.
|
|
91
|
-
*/
|
|
46
|
+
/** File-like interface for validation. */
|
|
92
47
|
export interface FileLike {
|
|
93
48
|
name: string;
|
|
94
49
|
size: number;
|