@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.
- package/dist/{DocsViewerServiceProvider-qFCaeiUv.js → DocsViewerServiceProvider-D2cuVgtN.js} +7 -12
- package/dist/{Hash-CzrwKeDp.js → Hash-D2DFd8xX.js} +12 -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 +31 -0
- package/dist/agent/approval.d.ts +184 -0
- package/dist/agent/audit-emitter.d.ts +36 -0
- package/dist/agent/audit.d.ts +67 -0
- package/dist/agent/derive.d.ts +32 -66
- package/dist/agent/dispatch.d.ts +53 -63
- package/dist/agent/events.d.ts +11 -19
- package/dist/agent/meta-tools.d.ts +34 -0
- package/dist/agent/public.d.ts +14 -0
- package/dist/agent/public.js +2 -0
- 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 +9 -5
- package/dist/auth/password/PasswordHasher.d.ts +7 -0
- package/dist/auth/password/hash-format.d.ts +11 -0
- 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-BSUc14CD.js → auth-CbdPH4Cd.js} +252 -496
- 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-BxU-LIfF.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 +10 -12
- 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-BAwzftws.js +238 -0
- 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-DJtkkhiw.js → encryption-uwP3Di4D.js} +13 -79
- 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 +16 -18
- 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 +14 -0
- package/dist/http/request.d.ts +49 -48
- 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 +21 -0
- 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 +13 -4
- package/dist/index.js +1036 -3080
- package/dist/internal/agent-preflight.d.ts +9 -21
- package/dist/internal/request.d.ts +10 -17
- package/dist/internal/request.js +2 -2
- 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 -5
- package/dist/logging/channels/FileChannel.d.ts +1 -3
- package/dist/logging/daily-file-path.d.ts +15 -0
- package/dist/logging/index.d.ts +1 -0
- package/dist/logging/index.js +2 -2
- package/dist/logging/types.d.ts +13 -45
- package/dist/{logging-CPaRMuPP.js → logging-zOY1XCtq.js} +83 -129
- 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 -253
- 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 +108 -74
- 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-BGfWbPYp.js → vite-manifest-CTQp-SOo.js} +34 -58
- package/package.json +6 -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-CRVuIiQr.js +0 -78
|
@@ -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;
|
|
@@ -13,38 +13,15 @@ export interface ViteAssetOptions {
|
|
|
13
13
|
/** @internal Test seam — clears the memoized manifest reads. */
|
|
14
14
|
export declare function __resetViteAssetCache(): void;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `production`): the Vite dev server serves the source path directly, so
|
|
22
|
-
* this returns `${devServerUrl}/${entry}`.
|
|
23
|
-
* - **Production**: the entry is looked up in the Vite build manifest and the
|
|
24
|
-
* hashed output file is returned under the `/public/assets/` route that
|
|
25
|
-
* `configureInertiaAssets` serves with immutable caching.
|
|
26
|
-
*
|
|
27
|
-
* Fails loudly: an unresolvable manifest or an entry the manifest does not
|
|
28
|
-
* record throws with the paths tried and the likely fix — never a silent
|
|
29
|
-
* empty string.
|
|
16
|
+
* Public URL of a Vite build input for server-rendered content pages (RFC 0014):
|
|
17
|
+
* the dev server URL in development, the hashed `/public/assets/` manifest entry
|
|
18
|
+
* in production, where a build-time `GUREN_VITE_MANIFEST` wins over the filesystem
|
|
19
|
+
* (serverless) unless `manifestPaths` names files. Throws with the paths tried. A
|
|
20
|
+
* CSS file bundled *through* a JS entry has no manifest key — list it in `build.rollupOptions.input`.
|
|
30
21
|
*
|
|
31
22
|
* @example
|
|
32
23
|
* ```tsx
|
|
33
24
|
* <link rel="stylesheet" href={viteAsset('resources/css/app.css')} />
|
|
34
25
|
* ```
|
|
35
|
-
*
|
|
36
|
-
* Note a CSS file bundled *through* a JS entry (imported from `app.tsx`) has
|
|
37
|
-
* no manifest key of its own — declare it as an explicit build input in
|
|
38
|
-
* `vite.config.ts` (`build.rollupOptions.input`) so Vite emits and records
|
|
39
|
-
* it.
|
|
40
|
-
*
|
|
41
|
-
* **Serverless targets:** production resolution prefers a build-time
|
|
42
|
-
* injected manifest over the filesystem — when `GUREN_VITE_MANIFEST` holds
|
|
43
|
-
* the client manifest JSON, entries resolve from it and no file is read. The
|
|
44
|
-
* deploy plugins (`@guren/plugin-cloudflare`, `@guren/plugin-vercel`,
|
|
45
|
-
* `@guren/plugin-lambda`) populate it during their build step, so `view()`
|
|
46
|
-
* pages work on targets whose runtime never sees
|
|
47
|
-
* `public/assets/manifest.json`. An explicit `manifestPaths` still reads the
|
|
48
|
-
* named files — a caller stating paths is asking for exactly those.
|
|
49
26
|
*/
|
|
50
27
|
export declare function viteAsset(entry: string, options?: ViteAssetOptions): string;
|
|
@@ -3,10 +3,9 @@ export interface StartViteDevServerOptions {
|
|
|
3
3
|
root?: string;
|
|
4
4
|
config?: InlineConfig;
|
|
5
5
|
/**
|
|
6
|
-
* What the dev server binds to.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* with no authentication. Pass `true` to expose it on the network.
|
|
6
|
+
* What the dev server binds to. Unset it follows Vite's localhost-only
|
|
7
|
+
* default, which is the safe choice: the dev server serves every file under
|
|
8
|
+
* the project root, unauthenticated. Pass `true` to expose it on the network.
|
|
10
9
|
*/
|
|
11
10
|
host?: boolean | string;
|
|
12
11
|
port?: number;
|
|
@@ -17,11 +16,9 @@ export interface StartedViteDevServer {
|
|
|
17
16
|
networkUrls: string[];
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
|
-
* Build the inline config the managed dev server starts with.
|
|
21
|
-
*
|
|
22
|
-
* `
|
|
23
|
-
* is dropped during Vite's config merge, so the project's own `vite.config.ts`
|
|
24
|
-
* decides, falling back to Vite's localhost-only default.
|
|
19
|
+
* Build the inline config the managed dev server starts with. `server.host` is
|
|
20
|
+
* left undefined unless asked for, so Vite's config merge drops it and the
|
|
21
|
+
* project's own `vite.config.ts` decides.
|
|
25
22
|
*/
|
|
26
23
|
export declare function resolveViteDevServerConfig(options?: StartViteDevServerOptions): InlineConfig;
|
|
27
24
|
export declare function startViteDevServer(options?: StartViteDevServerOptions): Promise<StartedViteDevServer>;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The one rule for how Vite build output is found and addressed, shared
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* serves the hashed files, and what "the dev server is on" means. Factored
|
|
8
|
-
* out so the two consumers cannot drift on any of it.
|
|
2
|
+
* The one rule for how Vite build output is found and addressed, shared by the
|
|
3
|
+
* Inertia asset wiring (`inertia-assets.ts`) and `viteAsset()` (`vite-assets.ts`,
|
|
4
|
+
* RFC 0014) so the two cannot drift: what counts as a manifest, where one may
|
|
5
|
+
* live, which URL prefix serves the hashed files, and what "the dev server is
|
|
6
|
+
* on" means.
|
|
9
7
|
*/
|
|
10
8
|
/** Where `configureInertiaAssets` serves hashed build output from. */
|
|
11
9
|
export declare const PUBLIC_ASSETS_URL_PREFIX = "/public/assets/";
|
|
@@ -19,34 +17,24 @@ export declare const DEFAULT_DEV_SERVER_URL = "http://localhost:5173";
|
|
|
19
17
|
export declare function isViteProduction(devServerUrl?: string | undefined): boolean;
|
|
20
18
|
export declare function normalizeDevServerUrl(value: string): string;
|
|
21
19
|
/**
|
|
22
|
-
* Candidate client-manifest locations
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* app with both layouts resolves different asset versions locally than after
|
|
28
|
-
* a serverless deploy; `tests/http/vite-manifest.test.ts` pins the agreement.
|
|
29
|
-
*
|
|
30
|
-
* `baseDir` defaults to the working directory (`viteAsset()`'s anchor); the
|
|
31
|
-
* Inertia wiring passes the root it derives from the app entry module.
|
|
20
|
+
* Candidate client-manifest locations, `.vite/manifest.json` first: Vite >= 5
|
|
21
|
+
* writes it there, so a flat `manifest.json` is likely a stale leftover. The
|
|
22
|
+
* deploy plugins order the same pair through `@guren/core`'s deploy-build
|
|
23
|
+
* helpers and must agree, or an app with both layouts resolves different asset
|
|
24
|
+
* versions after a serverless deploy; `tests/http/vite-manifest.test.ts` pins it.
|
|
32
25
|
*/
|
|
33
26
|
export declare function clientManifestCandidates(baseDir?: string): string[];
|
|
34
27
|
/**
|
|
35
|
-
* `__path__` label for
|
|
36
|
-
*
|
|
37
|
-
* filesystem path that was never read.
|
|
28
|
+
* `__path__` label for an injected manifest, so "entry not in the manifest"
|
|
29
|
+
* errors name the real source rather than a path that was never read.
|
|
38
30
|
*/
|
|
39
31
|
export declare const INJECTED_CLIENT_MANIFEST_SOURCE = "GUREN_VITE_MANIFEST (injected by the deploy build)";
|
|
40
32
|
/**
|
|
41
33
|
* The client manifest a deploy build injected for runtimes that do not ship
|
|
42
|
-
* `public/assets/manifest.json`: `GUREN_VITE_MANIFEST` holds the manifest
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* Fails loudly on a value that is set but not a manifest: falling through to
|
|
48
|
-
* the filesystem would end in "run `bunx vite build`", a diagnosis pointing
|
|
49
|
-
* away from the variable that is actually broken.
|
|
34
|
+
* `public/assets/manifest.json`: `GUREN_VITE_MANIFEST` holds the manifest *JSON
|
|
35
|
+
* text*, not a path. Fails loudly on a value that is set but not a manifest,
|
|
36
|
+
* because falling through to the filesystem would end in "run `bunx vite build`"
|
|
37
|
+
* — a diagnosis pointing away from the variable that is actually broken.
|
|
50
38
|
*/
|
|
51
39
|
export declare function injectedClientManifest(): ViteManifest | undefined;
|
|
52
40
|
export type ViteManifestEntryObject = {
|
|
@@ -64,14 +52,12 @@ export type ViteManifest = Record<string, ViteManifestValue> & {
|
|
|
64
52
|
export interface LoadViteManifestOptions {
|
|
65
53
|
/**
|
|
66
54
|
* Emit console warnings when no manifest is found (the Inertia wiring's
|
|
67
|
-
* behavior). `viteAsset()` passes `false` and throws
|
|
68
|
-
* — a warning can scroll past, a missing stylesheet URL cannot.
|
|
55
|
+
* behavior). `viteAsset()` passes `false` and throws instead.
|
|
69
56
|
*/
|
|
70
57
|
warnOnMissing?: boolean;
|
|
71
58
|
/**
|
|
72
|
-
* Retain the raw manifest text as `__raw__
|
|
73
|
-
*
|
|
74
|
-
* caches should not pin hundreds of KB of JSON text nothing reads.
|
|
59
|
+
* Retain the raw manifest text as `__raw__`. Off by default: only the Inertia
|
|
60
|
+
* wiring hashes it, and caches should not pin JSON text nothing reads.
|
|
75
61
|
*/
|
|
76
62
|
includeRaw?: boolean;
|
|
77
63
|
}
|