@theokit/http 2.0.0 → 2.1.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/app.js +3 -3
- package/dist/{chunk-HC47QXZV.js → chunk-2HJYLH4O.js} +5 -9
- package/dist/chunk-2HJYLH4O.js.map +1 -0
- package/dist/{chunk-AJOJXZRY.js → chunk-CRTEMKW2.js} +67 -46
- package/dist/chunk-CRTEMKW2.js.map +1 -0
- package/dist/{chunk-R72YKDQ4.js → chunk-ERQT6ZDN.js} +19 -3
- package/dist/chunk-ERQT6ZDN.js.map +1 -0
- package/dist/{chunk-6HVQHSPX.js → chunk-HN73QCHT.js} +18 -21
- package/dist/chunk-HN73QCHT.js.map +1 -0
- package/dist/{chunk-BXJBQ4EH.js → chunk-JCCZ4PHK.js} +2 -2
- package/dist/{exception-filter-chain-AS6BB5PF.js → exception-filter-chain-UXEVSDD3.js} +3 -3
- package/dist/index.d.ts +82 -484
- package/dist/index.js +10 -19
- package/dist/index.js.map +1 -1
- package/dist/theokit-plugin.js +9 -18
- package/dist/theokit-plugin.js.map +1 -1
- package/package.json +13 -2
- package/dist/chunk-6HVQHSPX.js.map +0 -1
- package/dist/chunk-AJOJXZRY.js.map +0 -1
- package/dist/chunk-HC47QXZV.js.map +0 -1
- package/dist/chunk-R72YKDQ4.js.map +0 -1
- /package/dist/{chunk-BXJBQ4EH.js.map → chunk-JCCZ4PHK.js.map} +0 -0
- /package/dist/{exception-filter-chain-AS6BB5PF.js.map → exception-filter-chain-UXEVSDD3.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -574,11 +574,31 @@ declare function createDecoratorServer(controllersOrOpts: Function[] | CreateDec
|
|
|
574
574
|
interface HttpExceptionOptions {
|
|
575
575
|
cause?: Error;
|
|
576
576
|
description?: string;
|
|
577
|
+
/**
|
|
578
|
+
* Response headers that belong to THIS refusal (usetheokit/theokit#612).
|
|
579
|
+
*
|
|
580
|
+
* Some statuses are not complete without them. `429` without `Retry-After` tells a client it went
|
|
581
|
+
* too fast and not when it may return, so a well-behaved client can only guess and a badly
|
|
582
|
+
* behaved one retries immediately. The same holds for `401` + `WWW-Authenticate`, `405` + `Allow`
|
|
583
|
+
* and `503` + `Retry-After`: the header is not decoration, it is the half of the answer that says
|
|
584
|
+
* what to do next.
|
|
585
|
+
*
|
|
586
|
+
* Before this existed, a guard computing `X-RateLimit-*` had nowhere to put them — `canActivate`
|
|
587
|
+
* returns a boolean and owns no response — so the numbers were discarded at the boundary and the
|
|
588
|
+
* caller received a bare `403`.
|
|
589
|
+
*
|
|
590
|
+
* `content-type` is set by the dispatcher and is not overridable here: the body is always the
|
|
591
|
+
* `toJSON()` shape, and letting a header claim otherwise would describe a body that does not
|
|
592
|
+
* exist.
|
|
593
|
+
*/
|
|
594
|
+
headers?: Readonly<Record<string, string>>;
|
|
577
595
|
}
|
|
578
596
|
declare class HttpException extends Error {
|
|
579
597
|
readonly statusCode: number;
|
|
580
598
|
readonly code: string;
|
|
581
599
|
readonly description?: string;
|
|
600
|
+
/** Headers this refusal carries. Empty unless the thrower supplied some. See {@link HttpExceptionOptions.headers}. */
|
|
601
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
582
602
|
constructor(message: string, statusCode: number, options?: HttpExceptionOptions);
|
|
583
603
|
toJSON(): {
|
|
584
604
|
error: {
|
|
@@ -589,529 +609,79 @@ declare class HttpException extends Error {
|
|
|
589
609
|
};
|
|
590
610
|
};
|
|
591
611
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
name: string;
|
|
606
|
-
message: string;
|
|
607
|
-
stack?: string;
|
|
608
|
-
cause?: unknown;
|
|
609
|
-
};
|
|
610
|
-
isError(error: unknown): error is Error;
|
|
611
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
612
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
613
|
-
stackTraceLimit: number;
|
|
614
|
-
};
|
|
612
|
+
/**
|
|
613
|
+
* The constructor shape every status-named exception shares.
|
|
614
|
+
*
|
|
615
|
+
* Declared explicitly (usetheokit/theokit#612) because inference erased it where it mattered most.
|
|
616
|
+
* Without a return type, `tsup` emitted each subclass's base as an ANONYMOUS structural object —
|
|
617
|
+
* `{ new (…): { statusCode: number; name: string; message: string; stack?: string } }` — so
|
|
618
|
+
* `TooManyRequestsException` was, to a consumer's type checker, no longer an `Error`. Every app
|
|
619
|
+
* writing `throw new UnauthorizedException()` therefore tripped `@typescript-eslint/only-throw-error`
|
|
620
|
+
* against the framework's own exceptions, and the honest reading of that lint was correct: the
|
|
621
|
+
* published types no longer said these were errors.
|
|
622
|
+
*/
|
|
623
|
+
type HttpExceptionConstructor = new (message?: string, options?: HttpExceptionOptions) => HttpException;
|
|
624
|
+
declare const BadRequestException_base: HttpExceptionConstructor;
|
|
615
625
|
declare class BadRequestException extends BadRequestException_base {
|
|
616
626
|
}
|
|
617
|
-
declare const UnauthorizedException_base:
|
|
618
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
619
|
-
readonly statusCode: number;
|
|
620
|
-
readonly code: string;
|
|
621
|
-
readonly description?: string;
|
|
622
|
-
toJSON(): {
|
|
623
|
-
error: {
|
|
624
|
-
description?: string | undefined;
|
|
625
|
-
code: string;
|
|
626
|
-
message: string;
|
|
627
|
-
statusCode: number;
|
|
628
|
-
};
|
|
629
|
-
};
|
|
630
|
-
name: string;
|
|
631
|
-
message: string;
|
|
632
|
-
stack?: string;
|
|
633
|
-
cause?: unknown;
|
|
634
|
-
};
|
|
635
|
-
isError(error: unknown): error is Error;
|
|
636
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
637
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
638
|
-
stackTraceLimit: number;
|
|
639
|
-
};
|
|
627
|
+
declare const UnauthorizedException_base: HttpExceptionConstructor;
|
|
640
628
|
declare class UnauthorizedException extends UnauthorizedException_base {
|
|
641
629
|
}
|
|
642
|
-
declare const ForbiddenException_base:
|
|
643
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
644
|
-
readonly statusCode: number;
|
|
645
|
-
readonly code: string;
|
|
646
|
-
readonly description?: string;
|
|
647
|
-
toJSON(): {
|
|
648
|
-
error: {
|
|
649
|
-
description?: string | undefined;
|
|
650
|
-
code: string;
|
|
651
|
-
message: string;
|
|
652
|
-
statusCode: number;
|
|
653
|
-
};
|
|
654
|
-
};
|
|
655
|
-
name: string;
|
|
656
|
-
message: string;
|
|
657
|
-
stack?: string;
|
|
658
|
-
cause?: unknown;
|
|
659
|
-
};
|
|
660
|
-
isError(error: unknown): error is Error;
|
|
661
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
662
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
663
|
-
stackTraceLimit: number;
|
|
664
|
-
};
|
|
630
|
+
declare const ForbiddenException_base: HttpExceptionConstructor;
|
|
665
631
|
declare class ForbiddenException extends ForbiddenException_base {
|
|
666
632
|
}
|
|
667
|
-
declare const NotFoundException_base:
|
|
668
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
669
|
-
readonly statusCode: number;
|
|
670
|
-
readonly code: string;
|
|
671
|
-
readonly description?: string;
|
|
672
|
-
toJSON(): {
|
|
673
|
-
error: {
|
|
674
|
-
description?: string | undefined;
|
|
675
|
-
code: string;
|
|
676
|
-
message: string;
|
|
677
|
-
statusCode: number;
|
|
678
|
-
};
|
|
679
|
-
};
|
|
680
|
-
name: string;
|
|
681
|
-
message: string;
|
|
682
|
-
stack?: string;
|
|
683
|
-
cause?: unknown;
|
|
684
|
-
};
|
|
685
|
-
isError(error: unknown): error is Error;
|
|
686
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
687
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
688
|
-
stackTraceLimit: number;
|
|
689
|
-
};
|
|
633
|
+
declare const NotFoundException_base: HttpExceptionConstructor;
|
|
690
634
|
declare class NotFoundException extends NotFoundException_base {
|
|
691
635
|
}
|
|
692
|
-
declare const MethodNotAllowedException_base:
|
|
693
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
694
|
-
readonly statusCode: number;
|
|
695
|
-
readonly code: string;
|
|
696
|
-
readonly description?: string;
|
|
697
|
-
toJSON(): {
|
|
698
|
-
error: {
|
|
699
|
-
description?: string | undefined;
|
|
700
|
-
code: string;
|
|
701
|
-
message: string;
|
|
702
|
-
statusCode: number;
|
|
703
|
-
};
|
|
704
|
-
};
|
|
705
|
-
name: string;
|
|
706
|
-
message: string;
|
|
707
|
-
stack?: string;
|
|
708
|
-
cause?: unknown;
|
|
709
|
-
};
|
|
710
|
-
isError(error: unknown): error is Error;
|
|
711
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
712
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
713
|
-
stackTraceLimit: number;
|
|
714
|
-
};
|
|
636
|
+
declare const MethodNotAllowedException_base: HttpExceptionConstructor;
|
|
715
637
|
declare class MethodNotAllowedException extends MethodNotAllowedException_base {
|
|
716
638
|
}
|
|
717
|
-
declare const NotAcceptableException_base:
|
|
718
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
719
|
-
readonly statusCode: number;
|
|
720
|
-
readonly code: string;
|
|
721
|
-
readonly description?: string;
|
|
722
|
-
toJSON(): {
|
|
723
|
-
error: {
|
|
724
|
-
description?: string | undefined;
|
|
725
|
-
code: string;
|
|
726
|
-
message: string;
|
|
727
|
-
statusCode: number;
|
|
728
|
-
};
|
|
729
|
-
};
|
|
730
|
-
name: string;
|
|
731
|
-
message: string;
|
|
732
|
-
stack?: string;
|
|
733
|
-
cause?: unknown;
|
|
734
|
-
};
|
|
735
|
-
isError(error: unknown): error is Error;
|
|
736
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
737
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
738
|
-
stackTraceLimit: number;
|
|
739
|
-
};
|
|
639
|
+
declare const NotAcceptableException_base: HttpExceptionConstructor;
|
|
740
640
|
declare class NotAcceptableException extends NotAcceptableException_base {
|
|
741
641
|
}
|
|
742
|
-
declare const RequestTimeoutException_base:
|
|
743
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
744
|
-
readonly statusCode: number;
|
|
745
|
-
readonly code: string;
|
|
746
|
-
readonly description?: string;
|
|
747
|
-
toJSON(): {
|
|
748
|
-
error: {
|
|
749
|
-
description?: string | undefined;
|
|
750
|
-
code: string;
|
|
751
|
-
message: string;
|
|
752
|
-
statusCode: number;
|
|
753
|
-
};
|
|
754
|
-
};
|
|
755
|
-
name: string;
|
|
756
|
-
message: string;
|
|
757
|
-
stack?: string;
|
|
758
|
-
cause?: unknown;
|
|
759
|
-
};
|
|
760
|
-
isError(error: unknown): error is Error;
|
|
761
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
762
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
763
|
-
stackTraceLimit: number;
|
|
764
|
-
};
|
|
642
|
+
declare const RequestTimeoutException_base: HttpExceptionConstructor;
|
|
765
643
|
declare class RequestTimeoutException extends RequestTimeoutException_base {
|
|
766
644
|
}
|
|
767
|
-
declare const ConflictException_base:
|
|
768
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
769
|
-
readonly statusCode: number;
|
|
770
|
-
readonly code: string;
|
|
771
|
-
readonly description?: string;
|
|
772
|
-
toJSON(): {
|
|
773
|
-
error: {
|
|
774
|
-
description?: string | undefined;
|
|
775
|
-
code: string;
|
|
776
|
-
message: string;
|
|
777
|
-
statusCode: number;
|
|
778
|
-
};
|
|
779
|
-
};
|
|
780
|
-
name: string;
|
|
781
|
-
message: string;
|
|
782
|
-
stack?: string;
|
|
783
|
-
cause?: unknown;
|
|
784
|
-
};
|
|
785
|
-
isError(error: unknown): error is Error;
|
|
786
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
787
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
788
|
-
stackTraceLimit: number;
|
|
789
|
-
};
|
|
645
|
+
declare const ConflictException_base: HttpExceptionConstructor;
|
|
790
646
|
declare class ConflictException extends ConflictException_base {
|
|
791
647
|
}
|
|
792
|
-
declare const GoneException_base:
|
|
793
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
794
|
-
readonly statusCode: number;
|
|
795
|
-
readonly code: string;
|
|
796
|
-
readonly description?: string;
|
|
797
|
-
toJSON(): {
|
|
798
|
-
error: {
|
|
799
|
-
description?: string | undefined;
|
|
800
|
-
code: string;
|
|
801
|
-
message: string;
|
|
802
|
-
statusCode: number;
|
|
803
|
-
};
|
|
804
|
-
};
|
|
805
|
-
name: string;
|
|
806
|
-
message: string;
|
|
807
|
-
stack?: string;
|
|
808
|
-
cause?: unknown;
|
|
809
|
-
};
|
|
810
|
-
isError(error: unknown): error is Error;
|
|
811
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
812
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
813
|
-
stackTraceLimit: number;
|
|
814
|
-
};
|
|
648
|
+
declare const GoneException_base: HttpExceptionConstructor;
|
|
815
649
|
declare class GoneException extends GoneException_base {
|
|
816
650
|
}
|
|
817
|
-
declare const PreconditionFailedException_base:
|
|
818
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
819
|
-
readonly statusCode: number;
|
|
820
|
-
readonly code: string;
|
|
821
|
-
readonly description?: string;
|
|
822
|
-
toJSON(): {
|
|
823
|
-
error: {
|
|
824
|
-
description?: string | undefined;
|
|
825
|
-
code: string;
|
|
826
|
-
message: string;
|
|
827
|
-
statusCode: number;
|
|
828
|
-
};
|
|
829
|
-
};
|
|
830
|
-
name: string;
|
|
831
|
-
message: string;
|
|
832
|
-
stack?: string;
|
|
833
|
-
cause?: unknown;
|
|
834
|
-
};
|
|
835
|
-
isError(error: unknown): error is Error;
|
|
836
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
837
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
838
|
-
stackTraceLimit: number;
|
|
839
|
-
};
|
|
651
|
+
declare const PreconditionFailedException_base: HttpExceptionConstructor;
|
|
840
652
|
declare class PreconditionFailedException extends PreconditionFailedException_base {
|
|
841
653
|
}
|
|
842
|
-
declare const PayloadTooLargeException_base:
|
|
843
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
844
|
-
readonly statusCode: number;
|
|
845
|
-
readonly code: string;
|
|
846
|
-
readonly description?: string;
|
|
847
|
-
toJSON(): {
|
|
848
|
-
error: {
|
|
849
|
-
description?: string | undefined;
|
|
850
|
-
code: string;
|
|
851
|
-
message: string;
|
|
852
|
-
statusCode: number;
|
|
853
|
-
};
|
|
854
|
-
};
|
|
855
|
-
name: string;
|
|
856
|
-
message: string;
|
|
857
|
-
stack?: string;
|
|
858
|
-
cause?: unknown;
|
|
859
|
-
};
|
|
860
|
-
isError(error: unknown): error is Error;
|
|
861
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
862
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
863
|
-
stackTraceLimit: number;
|
|
864
|
-
};
|
|
654
|
+
declare const PayloadTooLargeException_base: HttpExceptionConstructor;
|
|
865
655
|
declare class PayloadTooLargeException extends PayloadTooLargeException_base {
|
|
866
656
|
}
|
|
867
|
-
declare const UnsupportedMediaTypeException_base:
|
|
868
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
869
|
-
readonly statusCode: number;
|
|
870
|
-
readonly code: string;
|
|
871
|
-
readonly description?: string;
|
|
872
|
-
toJSON(): {
|
|
873
|
-
error: {
|
|
874
|
-
description?: string | undefined;
|
|
875
|
-
code: string;
|
|
876
|
-
message: string;
|
|
877
|
-
statusCode: number;
|
|
878
|
-
};
|
|
879
|
-
};
|
|
880
|
-
name: string;
|
|
881
|
-
message: string;
|
|
882
|
-
stack?: string;
|
|
883
|
-
cause?: unknown;
|
|
884
|
-
};
|
|
885
|
-
isError(error: unknown): error is Error;
|
|
886
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
887
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
888
|
-
stackTraceLimit: number;
|
|
889
|
-
};
|
|
657
|
+
declare const UnsupportedMediaTypeException_base: HttpExceptionConstructor;
|
|
890
658
|
declare class UnsupportedMediaTypeException extends UnsupportedMediaTypeException_base {
|
|
891
659
|
}
|
|
892
|
-
declare const ImATeapotException_base:
|
|
893
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
894
|
-
readonly statusCode: number;
|
|
895
|
-
readonly code: string;
|
|
896
|
-
readonly description?: string;
|
|
897
|
-
toJSON(): {
|
|
898
|
-
error: {
|
|
899
|
-
description?: string | undefined;
|
|
900
|
-
code: string;
|
|
901
|
-
message: string;
|
|
902
|
-
statusCode: number;
|
|
903
|
-
};
|
|
904
|
-
};
|
|
905
|
-
name: string;
|
|
906
|
-
message: string;
|
|
907
|
-
stack?: string;
|
|
908
|
-
cause?: unknown;
|
|
909
|
-
};
|
|
910
|
-
isError(error: unknown): error is Error;
|
|
911
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
912
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
913
|
-
stackTraceLimit: number;
|
|
914
|
-
};
|
|
660
|
+
declare const ImATeapotException_base: HttpExceptionConstructor;
|
|
915
661
|
declare class ImATeapotException extends ImATeapotException_base {
|
|
916
662
|
}
|
|
917
|
-
declare const UnprocessableEntityException_base:
|
|
918
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
919
|
-
readonly statusCode: number;
|
|
920
|
-
readonly code: string;
|
|
921
|
-
readonly description?: string;
|
|
922
|
-
toJSON(): {
|
|
923
|
-
error: {
|
|
924
|
-
description?: string | undefined;
|
|
925
|
-
code: string;
|
|
926
|
-
message: string;
|
|
927
|
-
statusCode: number;
|
|
928
|
-
};
|
|
929
|
-
};
|
|
930
|
-
name: string;
|
|
931
|
-
message: string;
|
|
932
|
-
stack?: string;
|
|
933
|
-
cause?: unknown;
|
|
934
|
-
};
|
|
935
|
-
isError(error: unknown): error is Error;
|
|
936
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
937
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
938
|
-
stackTraceLimit: number;
|
|
939
|
-
};
|
|
663
|
+
declare const UnprocessableEntityException_base: HttpExceptionConstructor;
|
|
940
664
|
declare class UnprocessableEntityException extends UnprocessableEntityException_base {
|
|
941
665
|
}
|
|
942
|
-
declare const InternalServerErrorException_base:
|
|
943
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
944
|
-
readonly statusCode: number;
|
|
945
|
-
readonly code: string;
|
|
946
|
-
readonly description?: string;
|
|
947
|
-
toJSON(): {
|
|
948
|
-
error: {
|
|
949
|
-
description?: string | undefined;
|
|
950
|
-
code: string;
|
|
951
|
-
message: string;
|
|
952
|
-
statusCode: number;
|
|
953
|
-
};
|
|
954
|
-
};
|
|
955
|
-
name: string;
|
|
956
|
-
message: string;
|
|
957
|
-
stack?: string;
|
|
958
|
-
cause?: unknown;
|
|
959
|
-
};
|
|
960
|
-
isError(error: unknown): error is Error;
|
|
961
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
962
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
963
|
-
stackTraceLimit: number;
|
|
964
|
-
};
|
|
666
|
+
declare const InternalServerErrorException_base: HttpExceptionConstructor;
|
|
965
667
|
declare class InternalServerErrorException extends InternalServerErrorException_base {
|
|
966
668
|
}
|
|
967
|
-
declare const NotImplementedException_base:
|
|
968
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
969
|
-
readonly statusCode: number;
|
|
970
|
-
readonly code: string;
|
|
971
|
-
readonly description?: string;
|
|
972
|
-
toJSON(): {
|
|
973
|
-
error: {
|
|
974
|
-
description?: string | undefined;
|
|
975
|
-
code: string;
|
|
976
|
-
message: string;
|
|
977
|
-
statusCode: number;
|
|
978
|
-
};
|
|
979
|
-
};
|
|
980
|
-
name: string;
|
|
981
|
-
message: string;
|
|
982
|
-
stack?: string;
|
|
983
|
-
cause?: unknown;
|
|
984
|
-
};
|
|
985
|
-
isError(error: unknown): error is Error;
|
|
986
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
987
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
988
|
-
stackTraceLimit: number;
|
|
989
|
-
};
|
|
669
|
+
declare const NotImplementedException_base: HttpExceptionConstructor;
|
|
990
670
|
declare class NotImplementedException extends NotImplementedException_base {
|
|
991
671
|
}
|
|
992
|
-
declare const BadGatewayException_base:
|
|
993
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
994
|
-
readonly statusCode: number;
|
|
995
|
-
readonly code: string;
|
|
996
|
-
readonly description?: string;
|
|
997
|
-
toJSON(): {
|
|
998
|
-
error: {
|
|
999
|
-
description?: string | undefined;
|
|
1000
|
-
code: string;
|
|
1001
|
-
message: string;
|
|
1002
|
-
statusCode: number;
|
|
1003
|
-
};
|
|
1004
|
-
};
|
|
1005
|
-
name: string;
|
|
1006
|
-
message: string;
|
|
1007
|
-
stack?: string;
|
|
1008
|
-
cause?: unknown;
|
|
1009
|
-
};
|
|
1010
|
-
isError(error: unknown): error is Error;
|
|
1011
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
1012
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
1013
|
-
stackTraceLimit: number;
|
|
1014
|
-
};
|
|
672
|
+
declare const BadGatewayException_base: HttpExceptionConstructor;
|
|
1015
673
|
declare class BadGatewayException extends BadGatewayException_base {
|
|
1016
674
|
}
|
|
1017
|
-
declare const ServiceUnavailableException_base:
|
|
1018
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
1019
|
-
readonly statusCode: number;
|
|
1020
|
-
readonly code: string;
|
|
1021
|
-
readonly description?: string;
|
|
1022
|
-
toJSON(): {
|
|
1023
|
-
error: {
|
|
1024
|
-
description?: string | undefined;
|
|
1025
|
-
code: string;
|
|
1026
|
-
message: string;
|
|
1027
|
-
statusCode: number;
|
|
1028
|
-
};
|
|
1029
|
-
};
|
|
1030
|
-
name: string;
|
|
1031
|
-
message: string;
|
|
1032
|
-
stack?: string;
|
|
1033
|
-
cause?: unknown;
|
|
1034
|
-
};
|
|
1035
|
-
isError(error: unknown): error is Error;
|
|
1036
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
1037
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
1038
|
-
stackTraceLimit: number;
|
|
1039
|
-
};
|
|
675
|
+
declare const ServiceUnavailableException_base: HttpExceptionConstructor;
|
|
1040
676
|
declare class ServiceUnavailableException extends ServiceUnavailableException_base {
|
|
1041
677
|
}
|
|
1042
|
-
declare const GatewayTimeoutException_base:
|
|
1043
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
1044
|
-
readonly statusCode: number;
|
|
1045
|
-
readonly code: string;
|
|
1046
|
-
readonly description?: string;
|
|
1047
|
-
toJSON(): {
|
|
1048
|
-
error: {
|
|
1049
|
-
description?: string | undefined;
|
|
1050
|
-
code: string;
|
|
1051
|
-
message: string;
|
|
1052
|
-
statusCode: number;
|
|
1053
|
-
};
|
|
1054
|
-
};
|
|
1055
|
-
name: string;
|
|
1056
|
-
message: string;
|
|
1057
|
-
stack?: string;
|
|
1058
|
-
cause?: unknown;
|
|
1059
|
-
};
|
|
1060
|
-
isError(error: unknown): error is Error;
|
|
1061
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
1062
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
1063
|
-
stackTraceLimit: number;
|
|
1064
|
-
};
|
|
678
|
+
declare const GatewayTimeoutException_base: HttpExceptionConstructor;
|
|
1065
679
|
declare class GatewayTimeoutException extends GatewayTimeoutException_base {
|
|
1066
680
|
}
|
|
1067
|
-
declare const HttpVersionNotSupportedException_base:
|
|
1068
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
1069
|
-
readonly statusCode: number;
|
|
1070
|
-
readonly code: string;
|
|
1071
|
-
readonly description?: string;
|
|
1072
|
-
toJSON(): {
|
|
1073
|
-
error: {
|
|
1074
|
-
description?: string | undefined;
|
|
1075
|
-
code: string;
|
|
1076
|
-
message: string;
|
|
1077
|
-
statusCode: number;
|
|
1078
|
-
};
|
|
1079
|
-
};
|
|
1080
|
-
name: string;
|
|
1081
|
-
message: string;
|
|
1082
|
-
stack?: string;
|
|
1083
|
-
cause?: unknown;
|
|
1084
|
-
};
|
|
1085
|
-
isError(error: unknown): error is Error;
|
|
1086
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
1087
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
1088
|
-
stackTraceLimit: number;
|
|
1089
|
-
};
|
|
681
|
+
declare const HttpVersionNotSupportedException_base: HttpExceptionConstructor;
|
|
1090
682
|
declare class HttpVersionNotSupportedException extends HttpVersionNotSupportedException_base {
|
|
1091
683
|
}
|
|
1092
|
-
declare const TooManyRequestsException_base:
|
|
1093
|
-
new (message?: string, options?: HttpExceptionOptions): {
|
|
1094
|
-
readonly statusCode: number;
|
|
1095
|
-
readonly code: string;
|
|
1096
|
-
readonly description?: string;
|
|
1097
|
-
toJSON(): {
|
|
1098
|
-
error: {
|
|
1099
|
-
description?: string | undefined;
|
|
1100
|
-
code: string;
|
|
1101
|
-
message: string;
|
|
1102
|
-
statusCode: number;
|
|
1103
|
-
};
|
|
1104
|
-
};
|
|
1105
|
-
name: string;
|
|
1106
|
-
message: string;
|
|
1107
|
-
stack?: string;
|
|
1108
|
-
cause?: unknown;
|
|
1109
|
-
};
|
|
1110
|
-
isError(error: unknown): error is Error;
|
|
1111
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
1112
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
1113
|
-
stackTraceLimit: number;
|
|
1114
|
-
};
|
|
684
|
+
declare const TooManyRequestsException_base: HttpExceptionConstructor;
|
|
1115
685
|
declare class TooManyRequestsException extends TooManyRequestsException_base {
|
|
1116
686
|
}
|
|
1117
687
|
/**
|
|
@@ -1162,6 +732,34 @@ declare const HttpStatus: {
|
|
|
1162
732
|
};
|
|
1163
733
|
type HttpStatusCode = (typeof HttpStatus)[keyof typeof HttpStatus];
|
|
1164
734
|
|
|
735
|
+
/**
|
|
736
|
+
* The one place an `HttpException` becomes a `Response` (usetheokit/theokit#612).
|
|
737
|
+
*
|
|
738
|
+
* There were four: `app.ts` (twice), `theokit-plugin.ts`, `create-server.ts` and
|
|
739
|
+
* `exception-filter-chain.ts` each built `new Response(JSON.stringify(ex.toJSON()), …)` by hand
|
|
740
|
+
* with `content-type` as the only header. Four copies of one decision is four places to forget
|
|
741
|
+
* something, and when `HttpException` grew headers, three of them would have kept discarding them —
|
|
742
|
+
* which is the same defect as the guard contract dropping them, one layer down.
|
|
743
|
+
*
|
|
744
|
+
* This module is that decision, once. It is deliberately NOT a method on `HttpException`: the
|
|
745
|
+
* exception is a domain value that a CLI, a queue consumer or a test can raise and inspect without
|
|
746
|
+
* a `Response` existing anywhere, and giving it a `toResponse()` would put the HTTP transport
|
|
747
|
+
* inside the error type. The transport owns the transport.
|
|
748
|
+
*/
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Render an `HttpException` as the response it describes.
|
|
752
|
+
*
|
|
753
|
+
* The body is always `exception.toJSON()`. `content-type` is written first so a caller-supplied
|
|
754
|
+
* header can never claim the body is something it is not, and every other header the exception
|
|
755
|
+
* carries is applied on top — `Retry-After` on a 429, `WWW-Authenticate` on a 401, `Allow` on a
|
|
756
|
+
* 405.
|
|
757
|
+
*
|
|
758
|
+
* @param exception the refusal to render
|
|
759
|
+
* @returns a JSON response with the exception's status and headers
|
|
760
|
+
*/
|
|
761
|
+
declare function httpExceptionToResponse(exception: HttpException): Response;
|
|
762
|
+
|
|
1165
763
|
/**
|
|
1166
764
|
* Typed Client — end-to-end type inference from route contracts.
|
|
1167
765
|
*
|
|
@@ -1480,4 +1078,4 @@ declare function revalidatePath(path: string): void;
|
|
|
1480
1078
|
*/
|
|
1481
1079
|
declare function getRevalidationSignals(): RevalidationSignal[];
|
|
1482
1080
|
|
|
1483
|
-
export { AccessDecision, All, type ArgumentsHost, BadGatewayException, BadRequestException, Body, CATCH_EXCEPTIONS, CONTROLLER_PREFIX, type CanActivate, Catch, ConflictException, Controller, type ControllerMeta, type ControllerOptions, type CreateDecoratorServerOptions, type DecoratorHandler, Delete, DiContainer, type DigestedError, EXPOSE_AGENT, type ErrorContext, type ExceptionFilter, type ExecutionContext, Expose, type ExposeEntry, type ExposeOptions, ForbiddenException, GatewayTimeoutException, Get, GoneException, Head, Header, Headers, HostParam, HttpCode, HttpDecoratorsConfigError, HttpException, type HttpExceptionOptions, HttpStatus, type HttpStatusCode, type HttpVerb, HttpVersionNotSupportedException, ImATeapotException, type Interceptor, InternalServerErrorException, Ip, type MetadataKey, MethodNotAllowedException, MiddlewareConsumerImpl, NotAcceptableException, NotFoundException, NotImplementedException, Options, PUBLIC_ROUTE_METADATA, Param, type ParamEntry, type ParamSource, Patch, PayloadTooLargeException, Post, PreconditionFailedException, Public, Put, Query, ROUTE_HEADERS, ROUTE_METHODS, ROUTE_PARAMS, ROUTE_REDIRECT, ROUTE_STATUS, Redirect, type RedirectMeta, Reflector, Req, RequestTimeoutException, Res, type RevalidationSignal, type RouteDefinition, type RouteMap, type RouteMethodEntry, type RouteRegistration, type RouteTree, type ServeAgent, ServiceUnavailableException, Session, SetMetadata, SkipThrottle, type StaticOptions, type StreamRenderOptions, type StreamRenderResult, type SwcCore, type TheoRequestContext, Throttle, type ThrottleOptions, TooManyRequestsException, type TypedClient, TypedClientError, USE_FILTERS, USE_GUARDS, USE_INTERCEPTORS, UnauthorizedException, UndeclaredRoutePolicy, UnprocessableEntityException, UnsupportedMediaTypeException, UseFilters, UseGuards, UseInterceptors, type WalkResult, composeComponentTree, contract, createDecorator, createDecoratorHandler, createDecoratorServer, createExecutionContext, createStaticHandler, createTypedClient, digestError, getMeta, getMimeType, getRequestContext, getRevalidationSignals, getThrottleOptions, isControllerClass, isSafePath, isThrottleSkipped, joinPath, loadControllerWithSwc, loadControllersFromGlob, registerControllers, renderToStream, resolveDtoSchema, revalidatePath, revalidateTag, runExceptionFilters, runInterceptors, setMeta, streamToResponse, transformControllerSource, tryGetRequestContext, walkControllerMetadata };
|
|
1081
|
+
export { AccessDecision, All, type ArgumentsHost, BadGatewayException, BadRequestException, Body, CATCH_EXCEPTIONS, CONTROLLER_PREFIX, type CanActivate, Catch, ConflictException, Controller, type ControllerMeta, type ControllerOptions, type CreateDecoratorServerOptions, type DecoratorHandler, Delete, DiContainer, type DigestedError, EXPOSE_AGENT, type ErrorContext, type ExceptionFilter, type ExecutionContext, Expose, type ExposeEntry, type ExposeOptions, ForbiddenException, GatewayTimeoutException, Get, GoneException, Head, Header, Headers, HostParam, HttpCode, HttpDecoratorsConfigError, HttpException, type HttpExceptionOptions, HttpStatus, type HttpStatusCode, type HttpVerb, HttpVersionNotSupportedException, ImATeapotException, type Interceptor, InternalServerErrorException, Ip, type MetadataKey, MethodNotAllowedException, MiddlewareConsumerImpl, NotAcceptableException, NotFoundException, NotImplementedException, Options, PUBLIC_ROUTE_METADATA, Param, type ParamEntry, type ParamSource, Patch, PayloadTooLargeException, Post, PreconditionFailedException, Public, Put, Query, ROUTE_HEADERS, ROUTE_METHODS, ROUTE_PARAMS, ROUTE_REDIRECT, ROUTE_STATUS, Redirect, type RedirectMeta, Reflector, Req, RequestTimeoutException, Res, type RevalidationSignal, type RouteDefinition, type RouteMap, type RouteMethodEntry, type RouteRegistration, type RouteTree, type ServeAgent, ServiceUnavailableException, Session, SetMetadata, SkipThrottle, type StaticOptions, type StreamRenderOptions, type StreamRenderResult, type SwcCore, type TheoRequestContext, Throttle, type ThrottleOptions, TooManyRequestsException, type TypedClient, TypedClientError, USE_FILTERS, USE_GUARDS, USE_INTERCEPTORS, UnauthorizedException, UndeclaredRoutePolicy, UnprocessableEntityException, UnsupportedMediaTypeException, UseFilters, UseGuards, UseInterceptors, type WalkResult, composeComponentTree, contract, createDecorator, createDecoratorHandler, createDecoratorServer, createExecutionContext, createStaticHandler, createTypedClient, digestError, getMeta, getMimeType, getRequestContext, getRevalidationSignals, getThrottleOptions, httpExceptionToResponse, isControllerClass, isSafePath, isThrottleSkipped, joinPath, loadControllerWithSwc, loadControllersFromGlob, registerControllers, renderToStream, resolveDtoSchema, revalidatePath, revalidateTag, runExceptionFilters, runInterceptors, setMeta, streamToResponse, transformControllerSource, tryGetRequestContext, walkControllerMetadata };
|