@h3ravel/foundation 0.1.0-alpha.1

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.
@@ -0,0 +1,1836 @@
1
+ /// <reference path="./app.globals.d.ts" />
2
+ import * as _h3ravel_contracts0 from "@h3ravel/contracts";
3
+ import { CKernel, CacheOptions, CallableConstructor, ConcreteConstructor, ExceptionConditionCallback, ExceptionConstructor, IApplication, IBootstraper, IExceptionHandler, IHttpContext, IKernel, IMiddleware, IMiddlewareHandler, IModel, IRequest, IResponse, IRoute, IRouter, MiddlewareList, RateLimiterAdapter, RedirectHandler, RenderExceptionCallback, ReportExceptionCallback, ThrottleExceptionCallback } from "@h3ravel/contracts";
4
+ import { Collection, DateTime, InvalidArgumentException } from "@h3ravel/support";
5
+ import { Command, Kernel as Kernel$1 } from "@h3ravel/musket";
6
+ import { UserConfig } from "tsdown";
7
+ import * as supertest_lib_agent0 from "supertest/lib/agent";
8
+ import { Application, ServiceProvider } from "@h3ravel/core";
9
+ import { IncomingMessage, ServerResponse } from "node:http";
10
+ import supertest from "supertest";
11
+ import * as execa0 from "execa";
12
+ import { Console } from "@h3ravel/shared";
13
+
14
+ //#region src/Helpers.d.ts
15
+ declare class Helpers {
16
+ private static app;
17
+ private static helpersLoaded;
18
+ static load(app: IApplication): void;
19
+ static isLoaded(): boolean;
20
+ /**
21
+ * Get the available app instance.
22
+ *
23
+ * @param key
24
+ */
25
+ private static appInstance;
26
+ /**
27
+ * Get an instance of the Request class
28
+ *
29
+ * @returns — a global instance of the Request class.
30
+ */
31
+ private static request;
32
+ /**
33
+ * Get an instance of the Response class
34
+ *
35
+ * @returns — a global instance of the Response class.
36
+ */
37
+ private static response;
38
+ /**
39
+ * Get an instance of the current session manager
40
+ * @param key
41
+ * @param defaultValue
42
+ *
43
+ * @returns — a global instance of the current session manager.
44
+ */
45
+ private static session;
46
+ /**
47
+ * Get the flashed input from previous request.
48
+ *
49
+ * @param args
50
+ */
51
+ private static old;
52
+ /**
53
+ * Hash the given value against the bcrypt algorithm.
54
+ *
55
+ * @param value
56
+ * @param options
57
+ */
58
+ private static bcrypt;
59
+ /**
60
+ * Global env variable
61
+ *
62
+ * @param path
63
+ */
64
+ private static env;
65
+ private static config;
66
+ /**
67
+ * Generate the URL to a named route.
68
+ *
69
+ * @param name
70
+ * @param parameters
71
+ * @param absolute
72
+ */
73
+ private static route;
74
+ /**
75
+ * Get the evaluated view contents for the given view.
76
+ */
77
+ private static view;
78
+ /**
79
+ * Get static asset
80
+ */
81
+ private static asset;
82
+ private static url;
83
+ /**
84
+ * Load all global helpers
85
+ */
86
+ private static loadHelpers;
87
+ }
88
+ //#endregion
89
+ //#region src/Adapters/InMemoryRateLimiter.d.ts
90
+ /**
91
+ * Very small in-memory token-bucket / counter limiter.
92
+ *
93
+ * Suitable for single-process dev / tests. We will replace with a Redis-backed adapter
94
+ * implementing `RateLimiterAdapter` in future.
95
+ */
96
+ declare class InMemoryRateLimiter implements RateLimiterAdapter {
97
+ protected store: Map<string, {
98
+ count: number;
99
+ expiresAt: number;
100
+ }>;
101
+ attempt(key: string, maxAttempts: number, allowCallback: () => boolean | Promise<boolean>, decaySeconds: number): Promise<boolean>;
102
+ }
103
+ //#endregion
104
+ //#region src/Bootstrapers/BootProviders.d.ts
105
+ declare class BootProviders extends IBootstraper {
106
+ /**
107
+ * Bootstrap the given application.
108
+ */
109
+ bootstrap(app: IApplication): Promise<void>;
110
+ }
111
+ //#endregion
112
+ //#region src/Bootstrapers/RegisterFacades.d.ts
113
+ declare class RegisterFacades extends IBootstraper {
114
+ /**
115
+ * Bootstrap the given application.
116
+ */
117
+ bootstrap(app: IApplication): void;
118
+ }
119
+ //#endregion
120
+ //#region src/Configuration/AppBuilder.d.ts
121
+ declare class AppBuilder {
122
+ private app;
123
+ /**
124
+ * The Folio / page middleware that have been defined by the user.
125
+ */
126
+ protected pageMiddleware: MiddlewareList[];
127
+ /**
128
+ * Any additional routing callbacks that should be invoked while registering routes.
129
+ */
130
+ protected additionalRoutingCallbacks: CallableConstructor[];
131
+ constructor(app: IApplication);
132
+ /**
133
+ * Register the base kernel classes for the application.
134
+ */
135
+ withKernels(): this;
136
+ /**
137
+ * Register and wire up the application's exception handling layer.
138
+ *
139
+ * @param using
140
+ **/
141
+ withExceptions(using: (exceptions: Exceptions) => void): this;
142
+ /**
143
+ * Register and wire up the application's middleware handling layer.
144
+ *
145
+ * @param using
146
+ **/
147
+ withMiddleware(callback?: (mw: Middleware) => void): this;
148
+ /**
149
+ * Register the routing services for the application.
150
+ */
151
+ withRouting({
152
+ using,
153
+ web,
154
+ api,
155
+ commands,
156
+ health,
157
+ channels,
158
+ apiPrefix,
159
+ then
160
+ }?: {
161
+ using?: CallableConstructor;
162
+ web?: string | string[];
163
+ api?: string | string[];
164
+ commands?: string | Collection<typeof Command<IApplication>>;
165
+ health?: string;
166
+ channels?: string;
167
+ apiPrefix?: string;
168
+ then?: CallableConstructor;
169
+ }): this;
170
+ /**
171
+ * Create the routing callback for the application.
172
+ *
173
+ * @param web
174
+ * @param api
175
+ * @param health
176
+ * @param apiPrefix
177
+ * @param then
178
+ */
179
+ protected buildRoutingCallback({
180
+ web,
181
+ api,
182
+ apiPrefix,
183
+ then
184
+ }: {
185
+ web?: string | string[];
186
+ api?: string | string[];
187
+ health?: string;
188
+ apiPrefix: string;
189
+ then?: CallableConstructor;
190
+ }): () => void;
191
+ /**
192
+ * Register additional Artisan commands with the application.
193
+ *
194
+ * @param commands
195
+ */
196
+ withCommands(commands?: typeof Command<IApplication>[] | string[]): this;
197
+ /**
198
+ * create
199
+ */
200
+ create(): void;
201
+ }
202
+ //#endregion
203
+ //#region src/Configuration/Middleware.d.ts
204
+ /**
205
+ * Core Middleware configuration container.
206
+ *
207
+ * Use this class to programmatically build middleware lists and groups.
208
+ *
209
+ * - Middleware entries can either be strings (identifiers) or instances of the middleware class in this core version.
210
+ * - Callbacks/redirects accept string or () => string.
211
+ * - Group replace/remove/append/prepend behavior retained.
212
+ */
213
+ declare class Middleware {
214
+ private app?;
215
+ /**
216
+ * The user defined global middleware stack.
217
+ */
218
+ protected global: MiddlewareList;
219
+ /**
220
+ * The middleware that should be prepended to the global middleware stack
221
+ */
222
+ protected prepends: MiddlewareList;
223
+ /**
224
+ * The middleware that should be appended to the global middleware stack.
225
+ */
226
+ protected appends: MiddlewareList;
227
+ /**
228
+ * The middleware that should be removed from the global middleware stack.
229
+ */
230
+ protected removals: MiddlewareList;
231
+ /**
232
+ * The middleware that should be replaced in the global middleware stack.
233
+ */
234
+ protected replacements: Record<string, string>;
235
+ protected groups: Record<string, MiddlewareList>;
236
+ protected groupPrepends: Record<string, MiddlewareList>;
237
+ protected groupAppends: Record<string, MiddlewareList>;
238
+ protected groupRemovals: Record<string, MiddlewareList>;
239
+ protected groupReplacements: Record<string, Record<string, IMiddleware>>;
240
+ protected pageMiddleware: MiddlewareList[];
241
+ protected _priority: MiddlewareList;
242
+ protected _trustHosts: boolean;
243
+ protected _statefulApi: boolean;
244
+ protected _throttleWithRedis: boolean;
245
+ protected apiLimiter: string | null;
246
+ protected authenticatedSessions: boolean;
247
+ protected customAliases: Record<string, IMiddleware>;
248
+ protected prependPriority: Record<string, IMiddleware>;
249
+ protected appendPriority: Record<string, IMiddleware>;
250
+ constructor(app?: IApplication | undefined);
251
+ /**
252
+ * Prepend middleware to the application's global middleware stack.
253
+ *
254
+ * @param middleware
255
+ * @returns
256
+ */
257
+ prepend(middleware: MiddlewareList | IMiddleware): this;
258
+ /**
259
+ * Append middleware to the application's global middleware stack.
260
+ *
261
+ * @param middleware
262
+ * @returns
263
+ */
264
+ append(middleware: MiddlewareList | IMiddleware): this;
265
+ /**
266
+ * Remove middleware from the application's global middleware stack.
267
+ *
268
+ * @param middleware
269
+ * @returns
270
+ */
271
+ remove(middleware: MiddlewareList | IMiddleware): this;
272
+ /**
273
+ *
274
+ * Specify a middleware that should be replaced with another middleware.
275
+ *
276
+ * @param search
277
+ * @param replaceWith
278
+ * @returns
279
+ */
280
+ replace(search: string, replaceWith: string): this;
281
+ /**
282
+ * Define the global middleware for the application.
283
+ *
284
+ * @param middleware
285
+ * @returns
286
+ */
287
+ use(middleware: MiddlewareList): this;
288
+ /**
289
+ * Define a middleware group.
290
+ *
291
+ * @param groupName
292
+ * @param middleware
293
+ * @returns
294
+ */
295
+ group(groupName: string, middleware: MiddlewareList): this;
296
+ /**
297
+ * Prepend the given middleware to the specified group.
298
+ *
299
+ * @param group
300
+ * @param middleware
301
+ * @returns
302
+ */
303
+ prependToGroup(group: string, middleware: MiddlewareList | IMiddleware): this;
304
+ /**
305
+ * Append the given middleware to the specified group.
306
+ *
307
+ * @param group
308
+ * @param middleware
309
+ * @returns
310
+ */
311
+ appendToGroup(group: string, middleware: MiddlewareList | IMiddleware): this;
312
+ /**
313
+ * Remove the given middleware from the specified group.
314
+ *
315
+ * @param group
316
+ * @param middleware
317
+ * @returns
318
+ */
319
+ removeFromGroup(group: string, middleware: MiddlewareList | IMiddleware): this;
320
+ /**
321
+ * Replace the given middleware in the specified group with another middleware
322
+ *
323
+ * @param group
324
+ * @param search
325
+ * @param replaceWith
326
+ * @returns
327
+ */
328
+ replaceInGroup(group: string, search: string, replaceWith: IMiddleware): this;
329
+ /**
330
+ * Modify the middleware in the "web" group.
331
+ *
332
+ * @param append
333
+ * @param prepend
334
+ * @param remove
335
+ * @param replace
336
+ * @returns
337
+ */
338
+ web(append?: MiddlewareList | IMiddleware | [], prepend?: MiddlewareList | IMiddleware | [], remove?: MiddlewareList | IMiddleware | [], replace?: Record<string, IMiddleware>): this;
339
+ /**
340
+ * Modify the middleware in the "api" group.
341
+ *
342
+ * @param append
343
+ * @param prepend
344
+ * @param remove
345
+ * @param replace
346
+ * @returns
347
+ */
348
+ api(append?: MiddlewareList | IMiddleware | [], prepend?: MiddlewareList | IMiddleware | [], remove?: MiddlewareList | IMiddleware | [], replace?: Record<string, IMiddleware>): this;
349
+ /**
350
+ * Modify the middleware in the given group
351
+ *
352
+ * @param group
353
+ * @param append
354
+ * @param prepend
355
+ * @param remove
356
+ * @param replace
357
+ * @returns
358
+ */
359
+ protected modifyGroup(group: string, append: MiddlewareList | IMiddleware | [], prepend: MiddlewareList | IMiddleware | [], remove: MiddlewareList | IMiddleware | [], replace: Record<string, IMiddleware>): this;
360
+ /**
361
+ * Register the page middleware for the application.
362
+ *
363
+ * @param middleware
364
+ * @returns
365
+ */
366
+ pages(middleware: MiddlewareList[]): this;
367
+ /**
368
+ * Register additional middleware aliases.
369
+ *
370
+ * @param aliases
371
+ * @returns
372
+ */
373
+ alias(aliases?: Record<string, IMiddleware>): this;
374
+ /**
375
+ * Define the middleware priority for the application.
376
+ *
377
+ * @param list
378
+ * @returns
379
+ */
380
+ priority(list: MiddlewareList): this;
381
+ /**
382
+ * Prepend middleware to the priority middleware.
383
+ *
384
+ * @param before
385
+ * @param prependKey
386
+ * @returns
387
+ */
388
+ prependToPriorityList(before: IMiddleware, prependKey: string): this;
389
+ /**
390
+ * Append middleware to the priority middleware
391
+ *
392
+ * @param after
393
+ * @param appendKey
394
+ * @returns
395
+ */
396
+ appendToPriorityList(after: IMiddleware, appendKey: string): this;
397
+ /**
398
+ * Get the global middleware list after applying prepends/appends/replacements/removals.
399
+ *
400
+ * @param defaults
401
+ * @returns
402
+ */
403
+ getGlobalMiddleware(defaults?: MiddlewareList): MiddlewareList;
404
+ /**
405
+ * Build middleware groups with applied group-level replacements, removals, prepends, appends.
406
+ */
407
+ getMiddlewareGroups(): Record<string, MiddlewareList>;
408
+ /**
409
+ * Configure where guests are redirected by the "auth" middleware
410
+ *
411
+ * @param redirect
412
+ * @returns
413
+ */
414
+ redirectGuestsTo(redirect: RedirectHandler): this;
415
+ /**
416
+ * Configure where users are redirected by the "guest" middleware
417
+ *
418
+ * @param redirect
419
+ * @returns
420
+ */
421
+ redirectUsersTo(redirect: RedirectHandler): this;
422
+ /**
423
+ * Register redirect handlers for the authentication and guest middleware.
424
+ *
425
+ * @param guests
426
+ * @param users
427
+ * @returns
428
+ */
429
+ redirectTo(guests?: RedirectHandler, users?: RedirectHandler): this;
430
+ /**
431
+ * Configure the cookie encryption middleware.
432
+ *
433
+ * @param _
434
+ * @returns
435
+ */
436
+ encryptCookies(_?: MiddlewareList): this;
437
+ /**
438
+ * Configure the CSRF token validation middleware.
439
+ *
440
+ * @param _
441
+ * @returns
442
+ */
443
+ validateCsrfTokens(_?: MiddlewareList): this;
444
+ /**
445
+ * Configure the URL signature validation middleware
446
+ *
447
+ * @param _
448
+ * @returns
449
+ */
450
+ validateSignatures(_?: MiddlewareList): this;
451
+ /**
452
+ * Configure the empty string conversion middleware.
453
+ *
454
+ * @param _
455
+ * @returns
456
+ */
457
+ convertEmptyStringsToNull(_?: MiddlewareList): this;
458
+ /**
459
+ * Configure the string trimming middleware.
460
+ *
461
+ * @param _
462
+ * @returns
463
+ */
464
+ trimStrings(_?: MiddlewareList): this;
465
+ /**
466
+ * Indicate that the trusted host middleware should be enabled
467
+ *
468
+ * @param at
469
+ * @param subdomains
470
+ * @returns
471
+ */
472
+ trustHosts(at?: any, subdomains?: boolean): this;
473
+ /**
474
+ * Configure the trusted proxies for the application
475
+ *
476
+ * @param _
477
+ * @param __
478
+ * @returns
479
+ */
480
+ trustProxies(_?: any, __?: number | null): this;
481
+ /**
482
+ * Configure the middleware that prevents requests during maintenance mode
483
+ *
484
+ * @param _
485
+ * @returns
486
+ */
487
+ preventRequestsDuringMaintenance(_?: MiddlewareList): this;
488
+ /**
489
+ * Indicate that Sanctum's frontend state middleware should be enabled
490
+ *
491
+ * @returns
492
+ */
493
+ statefulApi(): this;
494
+ /**
495
+ * Indicate that the API middleware group's throttling middleware should be enabled
496
+ *
497
+ * @param limiter
498
+ * @param redis
499
+ * @returns
500
+ */
501
+ throttleApi(limiter?: string, redis?: boolean): this;
502
+ /**
503
+ * Indicate that H3ravel's throttling middleware should use Redis
504
+ *
505
+ * @returns
506
+ */
507
+ throttleWithRedis(): this;
508
+ /**
509
+ * Indicate that sessions should be authenticated for the "web" middleware group
510
+ *
511
+ * @returns
512
+ */
513
+ authenticateSessions(): this;
514
+ /**
515
+ * Get the page middleware for the application
516
+ *
517
+ * @returns
518
+ */
519
+ getPageMiddleware(): MiddlewareList[];
520
+ /**
521
+ * Get the middleware aliases
522
+ *
523
+ * @returns
524
+ */
525
+ getMiddlewareAliases(): Record<string, IMiddleware>;
526
+ /**
527
+ * Get the default middleware aliases
528
+ *
529
+ * @returns
530
+ */
531
+ defaultAliases(): Record<string, IMiddleware>;
532
+ /**
533
+ * Get the middleware priority for the application
534
+ *
535
+ * @returns
536
+ */
537
+ getMiddlewarePriority(): MiddlewareList;
538
+ /**
539
+ * Get the middleware to prepend to the middleware priority definition
540
+ *
541
+ * @returns
542
+ */
543
+ getMiddlewarePriorityPrepends(): Record<string, IMiddleware>;
544
+ /**
545
+ * Get the middleware to append to the middleware priority definition
546
+ *
547
+ * @returns
548
+ */
549
+ getMiddlewarePriorityAppends(): Record<string, IMiddleware>;
550
+ }
551
+ //#endregion
552
+ //#region src/Console/ConsoleKernel.d.ts
553
+ /**
554
+ * ConsoleKernel class handles musket execution and transformations.
555
+ * It acts as the core pipeline for console inputs.
556
+ */
557
+ declare class ConsoleKernel extends CKernel {
558
+ #private;
559
+ protected app: IApplication;
560
+ protected DIST_DIR: string;
561
+ /**
562
+ * The current Musket console instance
563
+ */
564
+ protected commands: typeof Command[];
565
+ /**
566
+ * The current Musket console instance
567
+ */
568
+ protected console?: Kernel$1<IApplication>;
569
+ /**
570
+ * When the current command started.
571
+ */
572
+ protected commandStartedAt?: DateTime;
573
+ /**
574
+ * Indicates if the Closure commands have been loaded.
575
+ */
576
+ protected commandsLoaded: boolean;
577
+ /**
578
+ * The paths where Musket commands should be automatically discovered.
579
+ */
580
+ protected commandPaths: Set<string>;
581
+ /**
582
+ * The paths where Musket command routes should be automatically discovered.
583
+ */
584
+ protected commandRoutePaths: Set<string>;
585
+ protected commandLifecycleDurationHandlers: {
586
+ 'threshold': number;
587
+ 'handler': CallableConstructor;
588
+ }[];
589
+ /**
590
+ * Create a new Console kernel instance.
591
+ *
592
+ * @param app The current application instance
593
+ */
594
+ constructor(app: IApplication);
595
+ /**
596
+ * Get the bootstrap classes for the application.
597
+ *
598
+ * @return array
599
+ */
600
+ protected bootstrappers(): ConcreteConstructor<IBootstraper>[];
601
+ /**
602
+ * Report the exception to the exception handler.
603
+ * @param e
604
+ */
605
+ protected reportException(e: Error): void;
606
+ /**
607
+ * Render the given exception.
608
+ *
609
+ * @param e
610
+ */
611
+ protected renderException(e: Error): void;
612
+ /**
613
+ * Run the console application.
614
+ */
615
+ handle(): Promise<number>;
616
+ /**
617
+ * Register a given command.
618
+ *
619
+ * @param command
620
+ */
621
+ registerCommand(command: typeof Command | typeof Command[]): void;
622
+ /**
623
+ * Get all the registered commands.
624
+ */
625
+ all(): Promise<{
626
+ new (app: IApplication, kernel: Kernel$1<IApplication>): Command<IApplication>;
627
+ }[]>;
628
+ /**
629
+ * Bootstrap the application for Musket commands.
630
+ *
631
+ * @return void
632
+ */
633
+ bootstrap(): Promise<void>;
634
+ /**
635
+ * Determine if the kernel should discover commands.
636
+ */
637
+ protected shouldDiscoverCommands(): boolean;
638
+ /**
639
+ * Register the commands for the application.
640
+ */
641
+ protected registerCommands(): void;
642
+ /**
643
+ * Discover the commands that should be automatically loaded.
644
+ */
645
+ protected discoverCommands(): void;
646
+ /**
647
+ * Set the paths that should have their Musket commands automatically discovered.
648
+ *
649
+ * @param paths
650
+ */
651
+ addCommandPaths(paths: string[]): this;
652
+ /**
653
+ * Set the paths that should have their Artisan "routes" automatically discovered.
654
+ *
655
+ * @param paths
656
+ */
657
+ addCommandRoutePaths(paths: string[]): this;
658
+ /**
659
+ * Get the Musket application instance.
660
+ */
661
+ getConsole(): Kernel$1<IApplication>;
662
+ /**
663
+ * Terminate the app.
664
+ *
665
+ * @param request
666
+ */
667
+ terminate(status: number): void;
668
+ }
669
+ //#endregion
670
+ //#region src/Console/logo.d.ts
671
+ declare const logo: string;
672
+ declare const altLogo: string;
673
+ //#endregion
674
+ //#region src/Console/TsdownConfig.d.ts
675
+ declare const TsDownConfig: UserConfig;
676
+ //#endregion
677
+ //#region src/Container/Decorators.d.ts
678
+ declare function Inject(...dependencies: string[]): (target: any) => void;
679
+ /**
680
+ * Allows binding dependencies to both class and class methods
681
+ *
682
+ * @returns
683
+ */
684
+ declare function Injectable(): MethodDecorator & ClassDecorator;
685
+ //#endregion
686
+ //#region src/Exceptions/Base/HttpExceptionFactory.d.ts
687
+ /**
688
+ * Base HttpException
689
+ */
690
+ declare class HttpExceptionFactory extends Error {
691
+ protected statusCode: number;
692
+ message: string;
693
+ protected previous?: Error | undefined;
694
+ protected headers: Record<string, string>;
695
+ code: number;
696
+ constructor(statusCode: number, message?: string, previous?: Error | undefined, headers?: Record<string, string>, code?: number);
697
+ getStatusCode(): number;
698
+ getHeaders(): Record<string, string>;
699
+ setHeaders(headers: Record<string, string>): void;
700
+ }
701
+ //#endregion
702
+ //#region src/Exceptions/AccessDeniedHttpException.d.ts
703
+ declare class AccessDeniedHttpException extends HttpExceptionFactory {
704
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
705
+ }
706
+ //#endregion
707
+ //#region src/Exceptions/BadRequestHttpException.d.ts
708
+ declare class BadRequestHttpException extends HttpExceptionFactory {
709
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
710
+ }
711
+ //#endregion
712
+ //#region src/Exceptions/CommandNotFoundException.d.ts
713
+ /**
714
+ * Exception thrown when an incorrect command name typed in the console.
715
+ */
716
+ declare class CommandNotFoundException extends InvalidArgumentException {
717
+ private alternatives;
718
+ code: number;
719
+ previous?: Error | undefined;
720
+ /**
721
+ * @param message Exception message to throw
722
+ * @param alternatives List of similar defined names
723
+ * @param code Exception code
724
+ * @param previous Previous exception used for the exception chaining
725
+ */
726
+ constructor(message: string, alternatives?: string[], code?: number, previous?: Error | undefined);
727
+ getAlternatives(): string[];
728
+ }
729
+ //#endregion
730
+ //#region src/Exceptions/ConflictHttpException.d.ts
731
+ declare class ConflictHttpException extends HttpExceptionFactory {
732
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
733
+ }
734
+ //#endregion
735
+ //#region src/Exceptions/GoneHttpException.d.ts
736
+ declare class GoneHttpException extends HttpExceptionFactory {
737
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
738
+ }
739
+ //#endregion
740
+ //#region src/Exceptions/LengthRequiredHttpException.d.ts
741
+ declare class LengthRequiredHttpException extends HttpExceptionFactory {
742
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
743
+ }
744
+ //#endregion
745
+ //#region src/Exceptions/LockedHttpException.d.ts
746
+ declare class LockedHttpException extends HttpExceptionFactory {
747
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
748
+ }
749
+ //#endregion
750
+ //#region src/Exceptions/NotAcceptableHttpException.d.ts
751
+ declare class NotAcceptableHttpException extends HttpExceptionFactory {
752
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
753
+ }
754
+ //#endregion
755
+ //#region src/Exceptions/NotFoundHttpException.d.ts
756
+ declare class NotFoundHttpException extends HttpExceptionFactory {
757
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
758
+ }
759
+ //#endregion
760
+ //#region src/Exceptions/PreconditionFailedHttpException.d.ts
761
+ declare class PreconditionFailedHttpException extends HttpExceptionFactory {
762
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
763
+ }
764
+ //#endregion
765
+ //#region src/Exceptions/PreconditionRequiredHttpException.d.ts
766
+ declare class PreconditionRequiredHttpException extends HttpExceptionFactory {
767
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
768
+ }
769
+ //#endregion
770
+ //#region src/Exceptions/RouteNotFoundException.d.ts
771
+ /**
772
+ * Exception thrown when a route does not exist.
773
+ */
774
+ declare class RouteNotFoundException extends InvalidArgumentException implements Error {}
775
+ //#endregion
776
+ //#region src/Exceptions/ServiceUnavailableHttpException.d.ts
777
+ declare class ServiceUnavailableHttpException extends HttpExceptionFactory {
778
+ /**
779
+ *
780
+ * @param retryAfter The number of seconds or HTTP-date after which the request may be retried
781
+ * @param message
782
+ * @param previous
783
+ * @param code
784
+ * @param headers
785
+ */
786
+ constructor(retryAfter?: number | string, message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
787
+ }
788
+ //#endregion
789
+ //#region src/Exceptions/TooManyRequestsHttpException.d.ts
790
+ declare class TooManyRequestsHttpException extends HttpExceptionFactory {
791
+ /**
792
+ *
793
+ * @param retryAfter The number of seconds or HTTP-date after which the request may be retried
794
+ * @param message
795
+ * @param previous
796
+ * @param code
797
+ * @param headers
798
+ */
799
+ constructor(retryAfter?: number | string, message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
800
+ }
801
+ //#endregion
802
+ //#region src/Exceptions/UnprocessableEntityHttpException.d.ts
803
+ declare class UnprocessableEntityHttpException extends HttpExceptionFactory {
804
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
805
+ }
806
+ //#endregion
807
+ //#region src/Exceptions/UnsupportedMediaTypeHttpException.d.ts
808
+ declare class UnsupportedMediaTypeHttpException extends HttpExceptionFactory {
809
+ constructor(message?: string, previous?: Error, code?: number, headers?: Record<string, string>);
810
+ }
811
+ //#endregion
812
+ //#region src/Exceptions/UrlGenerationException.d.ts
813
+ declare class UrlGenerationException extends Error {
814
+ constructor(message: string);
815
+ static forMissingParameters(route: IRoute, parameters?: string[]): UrlGenerationException;
816
+ }
817
+ //#endregion
818
+ //#region src/Http/Kernel.d.ts
819
+ declare const Kernel_base: typeof IKernel & (new () => {
820
+ [x: string]: any;
821
+ secondsUntil(delay: DateTime | number): number;
822
+ availableAt(delay?: DateTime | number): number;
823
+ parseDateInterval(delay: DateTime | number): DateTime;
824
+ currentTime(): number;
825
+ runTimeForHumans(startTime: number, endTime?: number): string;
826
+ }) & {
827
+ [x: string]: any;
828
+ prototype: {
829
+ [x: string]: any;
830
+ secondsUntil(delay: DateTime | number): number;
831
+ availableAt(delay?: DateTime | number): number;
832
+ parseDateInterval(delay: DateTime | number): DateTime;
833
+ currentTime(): number;
834
+ runTimeForHumans(startTime: number, endTime?: number): string;
835
+ };
836
+ } & (new (...args: any[]) => IKernel & {
837
+ [x: string]: any;
838
+ secondsUntil(delay: DateTime | number): number;
839
+ availableAt(delay?: DateTime | number): number;
840
+ parseDateInterval(delay: DateTime | number): DateTime;
841
+ currentTime(): number;
842
+ runTimeForHumans(startTime: number, endTime?: number): string;
843
+ });
844
+ declare class Kernel extends Kernel_base {
845
+ #private;
846
+ protected app: IApplication;
847
+ protected router: IRouter;
848
+ /**
849
+ * The application's middleware stack.
850
+ */
851
+ protected middleware: MiddlewareList;
852
+ /**
853
+ * The application's route middleware groups.
854
+ */
855
+ protected middlewareGroups: Record<string, MiddlewareList>;
856
+ /**
857
+ * The application's middleware aliases.
858
+ */
859
+ protected middlewareAliases: Record<string, IMiddleware>;
860
+ /**
861
+ * All of the registered request duration handlers.
862
+ */
863
+ protected requestLifecycleDurationHandlers: {
864
+ threshold?: number;
865
+ handler?: (...args: any[]) => void;
866
+ }[];
867
+ /**
868
+ * The priority-sorted list of middleware.
869
+ *
870
+ * Forces non-global middleware to always be in the given order.
871
+ */
872
+ protected middlewarePriority: MiddlewareList;
873
+ /**
874
+ * Create a new HTTP kernel instance.
875
+ *
876
+ * @param app The current application instance
877
+ * @param router The current router instance
878
+ */
879
+ constructor(app: IApplication, router: IRouter);
880
+ /**
881
+ * Handle an incoming HTTP request.
882
+ *
883
+ * @param request
884
+ */
885
+ handle(request: IRequest): Promise<IResponse>;
886
+ /**
887
+ * Send the given request through the middleware / router.
888
+ *
889
+ * @param request
890
+ */
891
+ protected sendRequestThroughRouter(request: IRequest): Promise<IResponse>;
892
+ /**
893
+ * Bootstrap the application for HTTP requests.
894
+ *
895
+ * @return void
896
+ */
897
+ bootstrap(): Promise<void>;
898
+ /**
899
+ * Get the route dispatcher callback.
900
+ */
901
+ protected dispatchToRouter(): (request: IRequest) => Promise<IResponse>;
902
+ /**
903
+ * Call the terminate method on any terminable middleware.
904
+ *
905
+ * @param request
906
+ * @param response
907
+ */
908
+ terminate(request: IRequest, response: IResponse): void;
909
+ /**
910
+ * Call the terminate method on any terminable middleware.
911
+ *
912
+ * @param request
913
+ * @param response
914
+ */
915
+ protected terminateMiddleware(request: IRequest, response: IResponse): void;
916
+ /**
917
+ * Register a callback to be invoked when the requests lifecycle duration exceeds a given amount of time.
918
+ *
919
+ * @param threshold
920
+ * @param handler
921
+ */
922
+ whenRequestLifecycleIsLongerThan(threshold: number | DateTime, handler: (...args: any[]) => any): void;
923
+ /**
924
+ * When the request being handled started.
925
+ */
926
+ requestStartedAt(): DateTime | undefined;
927
+ /**
928
+ * Gather the route middleware for the given request.
929
+ */
930
+ protected gatherRouteMiddleware(request: IRequest): any;
931
+ /**
932
+ * Parse a middleware string to get the name and parameters.
933
+ *
934
+ * @param middleware
935
+ */
936
+ protected parseMiddleware(middleware: string): [string, string[]];
937
+ /**
938
+ * Determine if the kernel has a given middleware.
939
+ *
940
+ * @param middleware
941
+ */
942
+ hasMiddleware(middleware: IMiddleware): boolean;
943
+ /**
944
+ * Add a new middleware to the beginning of the stack if it does not already exist.
945
+ *
946
+ * @param string middleware
947
+ */
948
+ prependMiddleware(middleware: IMiddleware): this;
949
+ /**
950
+ * Add a new middleware to end of the stack if it does not already exist.
951
+ *
952
+ * @param middleware
953
+ */
954
+ pushMiddleware(middleware: IMiddleware): this;
955
+ /**
956
+ * Prepend the given middleware to the given middleware group.
957
+ *
958
+ * @param group
959
+ * @param middleware
960
+ *
961
+ * @throws {InvalidArgumentException}
962
+ */
963
+ prependMiddlewareToGroup(group: string, middleware: IMiddleware): this;
964
+ /**
965
+ * Append the given middleware to the given middleware group.
966
+ *
967
+ * @param group
968
+ * @param middleware
969
+ *
970
+ * @throws {InvalidArgumentException}
971
+ */
972
+ appendMiddlewareToGroup(group: string, middleware: IMiddleware): this;
973
+ /**
974
+ * Prepend the given middleware to the middleware priority list.
975
+ *
976
+ * @param middleware
977
+ */
978
+ prependToMiddlewarePriority(middleware: IMiddleware): this;
979
+ /**
980
+ * Append the given middleware to the middleware priority list.
981
+ *
982
+ * @param string $middleware
983
+ * @return $this
984
+ */
985
+ appendToMiddlewarePriority(middleware: IMiddleware): this;
986
+ /**
987
+ * Add the given middleware to the middleware priority list before other middleware.
988
+ *
989
+ * @param before
990
+ * @param string $middleware
991
+ * @return $this
992
+ */
993
+ addToMiddlewarePriorityBefore(before: IMiddleware | IMiddleware[], middleware: IMiddleware): this;
994
+ /**
995
+ * Add the given middleware to the middleware priority list after other middleware.
996
+ *
997
+ * @param after
998
+ * @param middleware
999
+ */
1000
+ addToMiddlewarePriorityAfter(after: IMiddleware | IMiddleware[], middleware: IMiddleware): this;
1001
+ /**
1002
+ * Add the given middleware to the middleware priority list relative to other middleware.
1003
+ *
1004
+ * @param string|array $existing
1005
+ * @param string $middleware
1006
+ * @param bool $after
1007
+ * @return $this
1008
+ */
1009
+ protected addToMiddlewarePriorityRelative(existing: IMiddleware | IMiddleware[], middleware: IMiddleware, after?: boolean): this;
1010
+ /**
1011
+ * Sync the current state of the middleware to the router.
1012
+ *
1013
+ * @return void
1014
+ */
1015
+ protected syncMiddlewareToRouter(): void;
1016
+ /**
1017
+ * Get the priority-sorted list of middleware.
1018
+ *
1019
+ * @return array
1020
+ */
1021
+ getMiddlewarePriority(): MiddlewareList;
1022
+ /**
1023
+ * Get the bootstrap classes for the application.
1024
+ *
1025
+ * @return array
1026
+ */
1027
+ protected bootstrappers(): ConcreteConstructor<IBootstraper>[];
1028
+ /**
1029
+ * Report the exception to the exception handler.
1030
+ *
1031
+ * @param e
1032
+ */
1033
+ protected reportException(e: Error): void;
1034
+ /**
1035
+ * Render the exception to a response.
1036
+ *
1037
+ * @param request
1038
+ * @param e
1039
+ */
1040
+ protected renderException(request: IRequest, e: Error): Promise<IResponse>;
1041
+ /**
1042
+ * Get the application's global middleware.
1043
+ *
1044
+ * @return array
1045
+ */
1046
+ getGlobalMiddleware(): MiddlewareList;
1047
+ /**
1048
+ * Set the application's global middleware.
1049
+ *
1050
+ * @param middleware
1051
+ * @returns
1052
+ */
1053
+ setGlobalMiddleware(middleware: MiddlewareList): this;
1054
+ /**
1055
+ * Get the application's route middleware groups.
1056
+ *
1057
+ * @return array
1058
+ */
1059
+ getMiddlewareGroups(): Record<string, MiddlewareList>;
1060
+ /**
1061
+ * Set the application's middleware groups.
1062
+ *
1063
+ * @param groups
1064
+ * @returns
1065
+ */
1066
+ setMiddlewareGroups(groups: Record<string, MiddlewareList>): this;
1067
+ /**
1068
+ * Get the application's route middleware aliases.
1069
+ *
1070
+ * @return array
1071
+ */
1072
+ getMiddlewareAliases(): Record<string, IMiddleware>;
1073
+ /**
1074
+ * Set the application's route middleware aliases.
1075
+ *
1076
+ * @param aliases
1077
+ */
1078
+ setMiddlewareAliases(aliases: Record<string, IMiddleware>): this;
1079
+ /**
1080
+ * Set the application's middleware priority.
1081
+ *
1082
+ * @param priority
1083
+ */
1084
+ setMiddlewarePriority(priority: MiddlewareList): this;
1085
+ /**
1086
+ * Get the Laravel application instance.
1087
+ */
1088
+ getApplication(): IApplication;
1089
+ /**
1090
+ * Set the Laravel application instance.
1091
+ *
1092
+ * @param app
1093
+ */
1094
+ setApplication(app: IApplication): this;
1095
+ }
1096
+ //#endregion
1097
+ //#region src/Http/MiddlewareHandler.d.ts
1098
+ declare class MiddlewareHandler implements IMiddlewareHandler {
1099
+ private middleware;
1100
+ private app;
1101
+ constructor(middleware: IMiddleware[] | undefined, app: IApplication);
1102
+ /**
1103
+ * Registers a middleware instance.
1104
+ *
1105
+ * @param mw
1106
+ */
1107
+ register(mw: IMiddleware | IMiddleware[]): this;
1108
+ /**
1109
+ * Runs the middleware chain for a given HttpContext.
1110
+ * Each middleware must call next() to continue the chain.
1111
+ *
1112
+ * @param context - The current HttpContext.
1113
+ * @param next - Callback to execute when middleware completes.
1114
+ * @returns A promise resolving to the final handler's result.
1115
+ */
1116
+ run(context: IHttpContext, next: (ctx: IHttpContext) => Promise<any>): Promise<any>;
1117
+ }
1118
+ //#endregion
1119
+ //#region src/Http/ResponseUtilities.d.ts
1120
+ declare enum ResponseCodes {
1121
+ HTTP_CONTINUE = 100,
1122
+ HTTP_SWITCHING_PROTOCOLS = 101,
1123
+ HTTP_PROCESSING = 102,
1124
+ // RFC2518
1125
+ HTTP_EARLY_HINTS = 103,
1126
+ // RFC8297
1127
+ HTTP_OK = 200,
1128
+ HTTP_CREATED = 201,
1129
+ HTTP_ACCEPTED = 202,
1130
+ HTTP_NON_AUTHORITATIVE_INFORMATION = 203,
1131
+ HTTP_NO_CONTENT = 204,
1132
+ HTTP_RESET_CONTENT = 205,
1133
+ HTTP_PARTIAL_CONTENT = 206,
1134
+ HTTP_MULTI_STATUS = 207,
1135
+ // RFC4918
1136
+ HTTP_ALREADY_REPORTED = 208,
1137
+ // RFC5842
1138
+ HTTP_IM_USED = 226,
1139
+ // RFC3229
1140
+ HTTP_MULTIPLE_CHOICES = 300,
1141
+ HTTP_MOVED_PERMANENTLY = 301,
1142
+ HTTP_FOUND = 302,
1143
+ HTTP_SEE_OTHER = 303,
1144
+ HTTP_NOT_MODIFIED = 304,
1145
+ HTTP_USE_PROXY = 305,
1146
+ HTTP_RESERVED = 306,
1147
+ HTTP_TEMPORARY_REDIRECT = 307,
1148
+ HTTP_PERMANENTLY_REDIRECT = 308,
1149
+ // RFC7238
1150
+ HTTP_BAD_REQUEST = 400,
1151
+ HTTP_UNAUTHORIZED = 401,
1152
+ HTTP_PAYMENT_REQUIRED = 402,
1153
+ HTTP_FORBIDDEN = 403,
1154
+ HTTP_NOT_FOUND = 404,
1155
+ HTTP_METHOD_NOT_ALLOWED = 405,
1156
+ HTTP_NOT_ACCEPTABLE = 406,
1157
+ HTTP_PROXY_AUTHENTICATION_REQUIRED = 407,
1158
+ HTTP_REQUEST_TIMEOUT = 408,
1159
+ HTTP_CONFLICT = 409,
1160
+ HTTP_GONE = 410,
1161
+ HTTP_LENGTH_REQUIRED = 411,
1162
+ HTTP_PRECONDITION_FAILED = 412,
1163
+ HTTP_REQUEST_ENTITY_TOO_LARGE = 413,
1164
+ HTTP_REQUEST_URI_TOO_LONG = 414,
1165
+ HTTP_UNSUPPORTED_MEDIA_TYPE = 415,
1166
+ HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416,
1167
+ HTTP_EXPECTATION_FAILED = 417,
1168
+ HTTP_I_AM_A_TEAPOT = 418,
1169
+ // RFC2324
1170
+ HTTP_MISDIRECTED_REQUEST = 421,
1171
+ // RFC7540
1172
+ HTTP_UNPROCESSABLE_ENTITY = 422,
1173
+ // RFC4918
1174
+ HTTP_LOCKED = 423,
1175
+ // RFC4918
1176
+ HTTP_FAILED_DEPENDENCY = 424,
1177
+ // RFC4918
1178
+ HTTP_TOO_EARLY = 425,
1179
+ // RFC-ietf-httpbis-replay-04
1180
+ HTTP_UPGRADE_REQUIRED = 426,
1181
+ // RFC2817
1182
+ HTTP_PRECONDITION_REQUIRED = 428,
1183
+ // RFC6585
1184
+ HTTP_TOO_MANY_REQUESTS = 429,
1185
+ // RFC6585
1186
+ HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
1187
+ // RFC6585
1188
+ HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451,
1189
+ // RFC7725
1190
+ HTTP_INTERNAL_SERVER_ERROR = 500,
1191
+ HTTP_NOT_IMPLEMENTED = 501,
1192
+ HTTP_BAD_GATEWAY = 502,
1193
+ HTTP_SERVICE_UNAVAILABLE = 503,
1194
+ HTTP_GATEWAY_TIMEOUT = 504,
1195
+ HTTP_VERSION_NOT_SUPPORTED = 505,
1196
+ HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506,
1197
+ // RFC2295
1198
+ HTTP_INSUFFICIENT_STORAGE = 507,
1199
+ // RFC4918
1200
+ HTTP_LOOP_DETECTED = 508,
1201
+ // RFC5842
1202
+ HTTP_NOT_EXTENDED = 510,
1203
+ // RFC2774
1204
+ HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511,
1205
+ }
1206
+ declare const HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES: CacheOptions;
1207
+ /**
1208
+ * Status codes translation table.
1209
+ *
1210
+ * The list of codes is complete according to the
1211
+ * @link https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml Hypertext Transfer Protocol (HTTP) Status Code Registry
1212
+ * (last updated 2021-10-01).
1213
+ *
1214
+ * Unless otherwise noted, the status code is defined in RFC2616.
1215
+ */
1216
+ declare const statusTexts: {
1217
+ [key: number]: string;
1218
+ };
1219
+ //#endregion
1220
+ //#region src/Testing/supertestAdapter.d.ts
1221
+ declare function supertestAdapter(app?: Application, serviceProviders?: ServiceProvider[]): Promise<(req: IncomingMessage, res: ServerResponse) => Promise<any>>;
1222
+ declare const testApp: (app?: Application, serviceProviders?: ServiceProvider[]) => Promise<supertest_lib_agent0<supertest.SuperTestStatic.Test>>;
1223
+ //#endregion
1224
+ //#region src/Console/Commands/BuildCommand.d.ts
1225
+ declare class BuildCommand extends Command {
1226
+ /**
1227
+ * The name and signature of the console command.
1228
+ *
1229
+ * @var string
1230
+ */
1231
+ protected signature: string;
1232
+ /**
1233
+ * The console command description.
1234
+ *
1235
+ * @var string
1236
+ */
1237
+ protected description: string;
1238
+ handle(): Promise<void>;
1239
+ protected fire(): Promise<void>;
1240
+ /**
1241
+ * build
1242
+ */
1243
+ static build({
1244
+ debug,
1245
+ minify,
1246
+ mute,
1247
+ verbosity,
1248
+ outDir
1249
+ }?: {
1250
+ mute: boolean;
1251
+ debug: boolean;
1252
+ minify: boolean;
1253
+ verbosity: number;
1254
+ outDir: string;
1255
+ }): Promise<void | execa0.Result<{
1256
+ stdout: "inherit";
1257
+ stderr: "inherit";
1258
+ cwd: string;
1259
+ env: NodeJS.ProcessEnv & {
1260
+ EXTENDED_DEBUG: string;
1261
+ CLI_BUILD: string;
1262
+ NODE_ENV: string;
1263
+ DIST_DIR: string;
1264
+ DIST_MINIFY: boolean;
1265
+ LOG_LEVEL: string;
1266
+ };
1267
+ }>>;
1268
+ }
1269
+ //#endregion
1270
+ //#region src/Console/Commands/KeyGenerateCommand.d.ts
1271
+ declare class KeyGenerateCommand extends Command {
1272
+ /**
1273
+ * The name and signature of the console command.
1274
+ *
1275
+ * @var string
1276
+ */
1277
+ protected signature: string;
1278
+ /**
1279
+ * The console command description.
1280
+ *
1281
+ * @var string
1282
+ */
1283
+ protected description: string;
1284
+ handle(): Promise<void>;
1285
+ }
1286
+ //#endregion
1287
+ //#region src/Console/Commands/MakeCommand.d.ts
1288
+ declare class MakeCommand extends Command {
1289
+ /**
1290
+ * The name and signature of the console command.
1291
+ *
1292
+ * @var string
1293
+ */
1294
+ protected signature: string;
1295
+ /**
1296
+ * The console command description.
1297
+ *
1298
+ * @var string
1299
+ */
1300
+ protected description: string;
1301
+ handle(this: any): Promise<void>;
1302
+ /**
1303
+ * Create a new controller class.
1304
+ */
1305
+ protected makeController(): Promise<void>;
1306
+ protected makeResource(): void;
1307
+ /**
1308
+ * Create a new Musket command
1309
+ */
1310
+ protected makeCommand(): void;
1311
+ /**
1312
+ * Create a new view.
1313
+ */
1314
+ protected makeView(): Promise<void>;
1315
+ }
1316
+ //#endregion
1317
+ //#region src/Console/Commands/PostinstallCommand.d.ts
1318
+ declare class PostinstallCommand extends Command {
1319
+ /**
1320
+ * The name and signature of the console command.
1321
+ *
1322
+ * @var string
1323
+ */
1324
+ protected signature: string;
1325
+ /**
1326
+ * The console command description.
1327
+ *
1328
+ * @var string
1329
+ */
1330
+ protected description: string;
1331
+ handle(): Promise<void>;
1332
+ /**
1333
+ * Create sqlite database if none exist
1334
+ *
1335
+ * @returns
1336
+ */
1337
+ private genEncryptionKey;
1338
+ /**
1339
+ * Create sqlite database if none exist
1340
+ *
1341
+ * @returns
1342
+ */
1343
+ private createSqliteDB;
1344
+ }
1345
+ //#endregion
1346
+ //#region src/Core/Events/Terminating.d.ts
1347
+ declare class Terminating {}
1348
+ //#endregion
1349
+ //#region src/Database/Exceptions/RecordsNotFoundException.d.ts
1350
+ declare class RecordsNotFoundException extends NotFoundHttpException {}
1351
+ //#endregion
1352
+ //#region src/Database/Exceptions/ModelNotFoundException.d.ts
1353
+ declare class ModelNotFoundException extends RecordsNotFoundException {
1354
+ /**
1355
+ * Name of the affected Eloquent model.
1356
+ */
1357
+ protected model?: ConcreteConstructor<IModel>;
1358
+ /**
1359
+ * The affected model IDs.
1360
+ */
1361
+ protected ids: (number | string)[];
1362
+ /**
1363
+ * Set the affected Eloquent model and instance ids.
1364
+ *
1365
+ * @param model
1366
+ * @param ids
1367
+ */
1368
+ setModel(model: ConcreteConstructor<IModel>, ids?: (number | string)[]): this;
1369
+ /**
1370
+ * Get the affected Eloquent model.
1371
+ */
1372
+ getModel(): ConcreteConstructor<IModel<any>> | undefined;
1373
+ /**
1374
+ * Get the affected Eloquent model IDs.
1375
+ */
1376
+ getIds(): (string | number)[];
1377
+ }
1378
+ //#endregion
1379
+ //#region src/Database/Exceptions/RecordNotFoundException.d.ts
1380
+ declare class RecordNotFoundException extends Error {}
1381
+ //#endregion
1382
+ //#region src/Exceptions/Base/Handler.d.ts
1383
+ /**
1384
+ *
1385
+ * Base Exception Handler
1386
+ * .
1387
+ * - We will use `RateLimiterAdapter` to plug in Redis / cache-backed limiters later.
1388
+ */
1389
+ declare abstract class Handler extends IExceptionHandler {
1390
+ /**
1391
+ * List of exception constructors that should not be reported.
1392
+ */
1393
+ protected dontReportList: ExceptionConstructor[];
1394
+ /**
1395
+ * A map of exceptions with their corresponding custom log levels.
1396
+ */
1397
+ protected levels: Map<string | Error, "error" | "debug" | "info" | "warn" | "log">;
1398
+ /**
1399
+ * Internal exceptions that are not reported by default. Subclasses may expand.
1400
+ */
1401
+ protected internalDontReport: ExceptionConstructor[];
1402
+ /**
1403
+ * Callbacks that inspect exceptions to determine if they should NOT be reported.
1404
+ */
1405
+ protected dontReportCallbacks: ExceptionConditionCallback[];
1406
+ /**
1407
+ * Reportable callbacks (can cancel reporting by returning false).
1408
+ */
1409
+ protected reportCallbacks: ReportExceptionCallback[];
1410
+ /**
1411
+ * Render callbacks (can return a Response for a specific exception type).
1412
+ */
1413
+ protected renderCallbacks: RenderExceptionCallback[];
1414
+ /**
1415
+ * Exception mapping: from constructor.mapper function (returns instance or new error).
1416
+ */
1417
+ protected exceptionMap: Map<ExceptionConstructor, (error: any) => any>;
1418
+ /**
1419
+ * Throttle callbacks: return limit spec or Unlimited or null
1420
+ */
1421
+ protected throttleCallbacks: ThrottleExceptionCallback[];
1422
+ /**
1423
+ * Context callbacks for building log context
1424
+ */
1425
+ protected contextCallbacks: Array<(e: any, current?: Record<string, any>) => Record<string, any>>;
1426
+ /**
1427
+ * Determines whether to hash throttle keys (default true)
1428
+ */
1429
+ protected hashThrottleKeys: boolean;
1430
+ /**
1431
+ * Whether to avoid reporting duplicates
1432
+ */
1433
+ protected withoutDuplicates: boolean;
1434
+ /**
1435
+ * Map of already reported exceptions (WeakMap to allow GC)
1436
+ */
1437
+ protected reportedExceptionMap: WeakMap<object, boolean>;
1438
+ /**
1439
+ * Rate limiter adapter — can be replaced by container / DI.
1440
+ */
1441
+ protected rateLimiter: RateLimiterAdapter;
1442
+ /**
1443
+ * The exception handler method
1444
+ *
1445
+ * @param error
1446
+ * @param ctx
1447
+ */
1448
+ handle?(error: Error, ctx: IHttpContext): Promise<any>;
1449
+ /**
1450
+ * Finalize response callback (respondUsing)
1451
+ *
1452
+ * @param response
1453
+ * @param error
1454
+ * @param request
1455
+ */
1456
+ protected finalizeResponseCallback?: (response: IResponse, error: any, request: IRequest) => IResponse | Promise<IResponse>;
1457
+ /**
1458
+ * Callback to determine if JSON should be returned
1459
+ *
1460
+ * @param request
1461
+ * @param error
1462
+ */
1463
+ protected shouldRenderJsonWhenCallback?: (request: IRequest, error: any) => boolean;
1464
+ /**
1465
+ * Register a reportable callback handler
1466
+ *
1467
+ * @param cb
1468
+ * @returns
1469
+ */
1470
+ reportable(cb: ReportExceptionCallback): this;
1471
+ renderable(cb: RenderExceptionCallback): this;
1472
+ dontReport(exceptions: ExceptionConstructor | ExceptionConstructor[]): this;
1473
+ stopIgnoring(exceptions: ExceptionConstructor | ExceptionConstructor[]): this;
1474
+ dontReportWhen(cb: ExceptionConditionCallback): this;
1475
+ dontReportDuplicates(): this;
1476
+ map(from: ExceptionConstructor, mapper: (error: any) => any): this;
1477
+ throttleUsing(cb: ThrottleExceptionCallback): this;
1478
+ buildContextUsing(cb: (e: any, current?: Record<string, any>) => Record<string, any>): this;
1479
+ setRateLimiter(adapter: RateLimiterAdapter): this;
1480
+ respondUsing(cb: (response: IResponse, error: any, request: IRequest) => IResponse | Promise<IResponse>): this;
1481
+ shouldRenderJsonWhen(cb: (request: IRequest, error: any) => boolean): this;
1482
+ /**
1483
+ * Entry point to reporting an exception.
1484
+ *
1485
+ * @param error
1486
+ * @returns
1487
+ */
1488
+ report(error: Error): Promise<void>;
1489
+ /**
1490
+ * Render an exception to the console.
1491
+ *
1492
+ * @param e
1493
+ */
1494
+ renderForConsole(e: Error): void;
1495
+ /**
1496
+ * Internal reporting pipeline.
1497
+ *
1498
+ * @param e
1499
+ * @returns
1500
+ */
1501
+ protected reportThrowable(e: any): Promise<void>;
1502
+ /**
1503
+ * Decide whether an exception should not be reported.
1504
+ *
1505
+ * @param e
1506
+ * @returns
1507
+ */
1508
+ protected shouldntReport(e: any): boolean;
1509
+ /**
1510
+ * Throttle evaluation. Returns true when reporting should be skipped.
1511
+ *
1512
+ * @param e
1513
+ * @returns
1514
+ */
1515
+ protected isThrottled(e: any): Promise<boolean>;
1516
+ /**
1517
+ * Apply mappings and unwrap inner exceptions if present.
1518
+ *
1519
+ * @param error
1520
+ * @returns
1521
+ */
1522
+ protected mapException(error: any): any;
1523
+ /**
1524
+ * Render an exception into an HTTP Response.
1525
+ *
1526
+ * @param ctx
1527
+ * @param error
1528
+ * @returns
1529
+ */
1530
+ render(request: IRequest, error: any): Promise<IResponse>;
1531
+ /**
1532
+ * getResponse
1533
+ */
1534
+ getResponse(request: IRequest, payload: Record<string, any>, e: any): IResponse | Promise<IResponse>;
1535
+ /**
1536
+ * Default non-JSON response (simple string). Subclass to integrate templating.
1537
+ *
1538
+ * @param request
1539
+ * @param e
1540
+ * @returns
1541
+ */
1542
+ protected prepareResponse(request: IRequest, e: any): IResponse | Promise<IResponse>;
1543
+ /**
1544
+ * Finalizes a rendered response using the finalize callback if present.
1545
+ *
1546
+ * @param request
1547
+ * @param response
1548
+ * @param e
1549
+ * @returns
1550
+ */
1551
+ protected finalizeRenderedResponse(request: IRequest, response: IResponse, e: any): Promise<IResponse>;
1552
+ /**
1553
+ * Decide whether to return JSON.
1554
+ *
1555
+ * @param request
1556
+ * @param e
1557
+ * @returns
1558
+ */
1559
+ protected shouldReturnJson(request: IRequest, e: any): boolean;
1560
+ /**
1561
+ * Prepare a Json Response for the exception.
1562
+ *
1563
+ * Subclasses can override convertExceptionToArray for different debug behavior.
1564
+ *
1565
+ * @param _request
1566
+ * @param e
1567
+ * @returns
1568
+ */
1569
+ protected prepareJsonResponse(_request: IRequest, e: any): IResponse;
1570
+ /**
1571
+ * Convert exception into debug-friendly array/object.
1572
+ *
1573
+ * @param e
1574
+ * @returns
1575
+ */
1576
+ protected convertExceptionToArray(e: any): {
1577
+ message?: string;
1578
+ exception?: string;
1579
+ trace?: string[];
1580
+ };
1581
+ /**
1582
+ * Build final exception context for logging.
1583
+ *
1584
+ * @param e
1585
+ * @returns
1586
+ */
1587
+ protected buildExceptionContext(e: any): Record<string, any>;
1588
+ /**
1589
+ * Allow exceptions to supply their own context via `context()` method.
1590
+ *
1591
+ * @param e
1592
+ * @returns
1593
+ */
1594
+ protected exceptionContext(e: any): Record<string, any>;
1595
+ /**
1596
+ * Default contextual info for logs (e.g., user id).
1597
+ *
1598
+ * Subclasses may override. Try/catch to avoid breaking logging flow.
1599
+ */
1600
+ protected context(): Record<string, any>;
1601
+ /**
1602
+ * Check if a method is an instance of any of the listed classes
1603
+ *
1604
+ * @param e
1605
+ * @param list
1606
+ * @returns
1607
+ */
1608
+ protected isInstanceOfAny(e: any, list: ExceptionConstructor[]): boolean;
1609
+ /**
1610
+ * Check if an exxeption is an HTTP execption
1611
+ *
1612
+ * @param e
1613
+ * @returns
1614
+ */
1615
+ protected isHttpException(e: any): e is HttpExceptionFactory;
1616
+ /**
1617
+ * Default mapping — subclasses can override for custom logic
1618
+ *
1619
+ * @param _e
1620
+ */
1621
+ protected mapLogLevel(e: string | Error): Exclude<keyof typeof Console, 'prototype'>;
1622
+ /**
1623
+ * Subclasses should return PSR-like logger (object with methods like error, warn, info or a `log` fn)
1624
+ */
1625
+ protected newLogger(): typeof Console;
1626
+ /**
1627
+ * Hook to read from config/environment. Subclass or container should supply real value.
1628
+ */
1629
+ protected appDebug(): boolean;
1630
+ /**
1631
+ * Lightweight hash to avoid leaking raw keys in shared stores.
1632
+ * In the future, will be replaced with a real hash (xxh128 / sha256) if needed.
1633
+ *
1634
+ * @param key
1635
+ */
1636
+ protected hashKey(key: string): string;
1637
+ /**
1638
+ * Not implemented in core. Subclass can implement and call RequestException helpers.
1639
+ *
1640
+ * @param _length
1641
+ */
1642
+ truncateRequestExceptionsAt(_length: number): this;
1643
+ /**
1644
+ * Set the log level
1645
+ *
1646
+ * @param _attributes
1647
+ */
1648
+ level(type: string | Error, level: Exclude<keyof typeof Console, 'prototype'>): this;
1649
+ /**
1650
+ * Not implemented here; applicable to validation pipeline/UI.
1651
+ *
1652
+ * @param _attributes
1653
+ */
1654
+ dontFlash(_attributes: string | string[]): this;
1655
+ }
1656
+ //#endregion
1657
+ //#region src/Exceptions/Base/ExceptionHandler.d.ts
1658
+ declare class ExceptionHandler extends Handler {
1659
+ handle(error: Error, ctx: IHttpContext): Promise<_h3ravel_contracts0.IResponse | _h3ravel_contracts0.IResponsable>;
1660
+ }
1661
+ //#endregion
1662
+ //#region src/Exceptions/Base/RequestException.d.ts
1663
+ declare class RequestException {
1664
+ #private;
1665
+ /**
1666
+ * The HTTP status code for this error.
1667
+ */
1668
+ status: number;
1669
+ /**
1670
+ * The response instance.
1671
+ */
1672
+ response: IResponse;
1673
+ /**
1674
+ * Create a new exception instance.
1675
+ */
1676
+ constructor(response: IResponse);
1677
+ /**
1678
+ * Enable truncation of request exception messages.
1679
+ *
1680
+ * @return void
1681
+ */
1682
+ static truncate(): void;
1683
+ /**
1684
+ * Set the truncation length for request exception messages.
1685
+ *
1686
+ * @param int $length
1687
+ */
1688
+ static truncateAt(length: number): void;
1689
+ /**
1690
+ * Disable truncation of request exception messages.
1691
+ *
1692
+ * @return void
1693
+ */
1694
+ static dontTruncate(): void;
1695
+ /**
1696
+ * Prepare the exception message.
1697
+ */
1698
+ protected prepareMessage(response: IResponse): string;
1699
+ }
1700
+ //#endregion
1701
+ //#region src/Exceptions/Base/Exceptions.d.ts
1702
+ declare class Exceptions {
1703
+ handler: IExceptionHandler;
1704
+ /**
1705
+ * Create a new exception handling configuration instance.
1706
+ */
1707
+ constructor(handler: IExceptionHandler);
1708
+ /**
1709
+ * Register a reportable callback.
1710
+ */
1711
+ report(using: (...args: any[]) => any): IExceptionHandler;
1712
+ /**
1713
+ * Register a reportable callback.
1714
+ */
1715
+ reportable(reportUsing: (...args: any[]) => any): IExceptionHandler;
1716
+ /**
1717
+ * Register a renderable callback.
1718
+ */
1719
+ render(using: (...args: any[]) => any): this;
1720
+ /**
1721
+ * Register a renderable callback.
1722
+ */
1723
+ renderable(renderUsing: (...args: any[]) => any): this;
1724
+ /**
1725
+ * Register a callback to prepare the final rendered exception response.
1726
+ */
1727
+ respond(using: (...args: any[]) => any): this;
1728
+ /**
1729
+ * Specify the callback that should be used to throttle reportable exceptions.
1730
+ */
1731
+ throttle(throttleUsing: (...args: any[]) => any): this;
1732
+ /**
1733
+ * Register a new exception mapping.
1734
+ */
1735
+ map(from: typeof RequestException | ((e: any) => any), to?: typeof RequestException | ((e: any) => any)): this;
1736
+ /**
1737
+ * Set the log level for the given exception type.
1738
+ */
1739
+ level(type: string | Error, level: 'log' | 'debug' | 'warn' | 'info' | 'error'): this;
1740
+ /**
1741
+ * Register a closure that should be used to build exception context data.
1742
+ */
1743
+ context(contextCallback: (...args: any[]) => Record<string, any>): this;
1744
+ /**
1745
+ * Indicate that the given exception type should not be reported.
1746
+ */
1747
+ dontReport(classOrArray: typeof RequestException | typeof RequestException[]): this;
1748
+ /**
1749
+ * Register a callback to determine if an exception should not be reported.
1750
+ */
1751
+ dontReportWhen(dontReportWhen: (error: Error) => boolean): this;
1752
+ /**
1753
+ * Do not report duplicate exceptions.
1754
+ */
1755
+ dontReportDuplicates(): this;
1756
+ /**
1757
+ * Indicate that the given attributes should never be flashed to the session on validation errors.
1758
+ */
1759
+ dontFlash(attributes: string | string[]): this;
1760
+ /**
1761
+ * Register the callable that determines if the exception handler response should be JSON.
1762
+ */
1763
+ shouldRenderJsonWhen(callback: (request: any, error: Error) => boolean): this;
1764
+ /**
1765
+ * Render an exception to the console.
1766
+ *
1767
+ * @param e
1768
+ */
1769
+ renderForConsole(e: Error): void;
1770
+ /**
1771
+ * Indicate that the given exception class should not be ignored.
1772
+ */
1773
+ stopIgnoring(classOrArray: typeof RequestException | typeof RequestException[]): this;
1774
+ /**
1775
+ * Set the truncation length for request exception messages.
1776
+ */
1777
+ truncateRequestExceptionsAt(length: number): this;
1778
+ /**
1779
+ * Disable truncation of request exception messages.
1780
+ */
1781
+ dontTruncateRequestExceptions(): this;
1782
+ }
1783
+ //#endregion
1784
+ //#region src/Exceptions/Base/HttpException.d.ts
1785
+ /**
1786
+ * HttpException.
1787
+ */
1788
+ declare class HttpException extends Error {
1789
+ protected statusCode: number;
1790
+ message: string;
1791
+ protected previous?: Error | undefined;
1792
+ protected headers: Record<string, string>;
1793
+ code: number;
1794
+ constructor(statusCode: number, message?: string, previous?: Error | undefined, headers?: Record<string, string>, code?: number);
1795
+ static fromStatusCode(statusCode: number, message?: string, previous?: Error, headers?: Record<string, string>, code?: number): AccessDeniedHttpException | BadRequestHttpException | ConflictHttpException | GoneHttpException | LengthRequiredHttpException | LockedHttpException | NotAcceptableHttpException | NotFoundHttpException | PreconditionFailedHttpException | PreconditionRequiredHttpException | ServiceUnavailableHttpException | TooManyRequestsHttpException | UnprocessableEntityHttpException | UnsupportedMediaTypeHttpException | HttpException;
1796
+ getStatusCode(): number;
1797
+ getHeaders(): Record<string, string>;
1798
+ setHeaders(headers: Record<string, string>): void;
1799
+ }
1800
+ //#endregion
1801
+ //#region src/Exceptions/Core/BindingResolutionException.d.ts
1802
+ declare class BindingResolutionException extends Error {
1803
+ constructor(message: string);
1804
+ }
1805
+ //#endregion
1806
+ //#region src/Exceptions/Core/ConfigException.d.ts
1807
+ declare class ConfigException extends Error {
1808
+ key: string;
1809
+ constructor(key: string, type?: 'any' | 'config' | 'env', cause?: unknown);
1810
+ }
1811
+ //#endregion
1812
+ //#region src/Exceptions/Core/LogicException.d.ts
1813
+ declare class LogicException extends Error {
1814
+ constructor(message: string);
1815
+ }
1816
+ //#endregion
1817
+ //#region src/Http/Events/RequestHandled.d.ts
1818
+ declare class RequestHandled {
1819
+ /**
1820
+ * The request instance.
1821
+ */
1822
+ request: IRequest;
1823
+ /**
1824
+ * The response instance.
1825
+ */
1826
+ response?: IResponse;
1827
+ /**
1828
+ * Create a new event instance.
1829
+ *
1830
+ * @param request
1831
+ * @param response
1832
+ */
1833
+ constructor(request: IRequest, response?: IResponse);
1834
+ }
1835
+ //#endregion
1836
+ export { AccessDeniedHttpException, AppBuilder, BadRequestHttpException, BindingResolutionException, BootProviders, BuildCommand, CommandNotFoundException, ConfigException, ConflictHttpException, ConsoleKernel, ExceptionHandler, Exceptions, GoneHttpException, HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES, Handler, Helpers, HttpException, HttpExceptionFactory, InMemoryRateLimiter, Inject, Injectable, Kernel, KeyGenerateCommand, LengthRequiredHttpException, LockedHttpException, LogicException, MakeCommand, Middleware, MiddlewareHandler, ModelNotFoundException, NotAcceptableHttpException, NotFoundHttpException, PostinstallCommand, PreconditionFailedHttpException, PreconditionRequiredHttpException, RecordNotFoundException, RecordsNotFoundException, RegisterFacades, RequestException, RequestHandled, ResponseCodes, RouteNotFoundException, ServiceUnavailableHttpException, Terminating, TooManyRequestsHttpException, TsDownConfig, UnprocessableEntityHttpException, UnsupportedMediaTypeHttpException, UrlGenerationException, altLogo, logo, statusTexts, supertestAdapter, testApp };