tritio 0.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/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # core
2
+
3
+ To install dependencies:
4
+
5
+ ```bash
6
+ bun install
7
+ ```
8
+
9
+ To run:
10
+
11
+ ```bash
12
+ bun run index.ts
13
+ ```
14
+
15
+ This project was created using `bun init` in bun v1.3.4. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
@@ -0,0 +1,2 @@
1
+ export * from './openapi';
2
+ export * from './scalar';
@@ -0,0 +1,9 @@
1
+ export declare const generateOpenApiSpec: (routes: any[]) => {
2
+ openapi: string;
3
+ info: {
4
+ title: string;
5
+ version: string;
6
+ description: string;
7
+ };
8
+ paths: any;
9
+ };
@@ -0,0 +1 @@
1
+ export declare const generateScalarHtml: (specUrl: string) => string;
@@ -0,0 +1,2 @@
1
+ import { H3Event } from 'h3';
2
+ export declare const errorHandler: (error: any, event?: H3Event) => Response;
@@ -0,0 +1,67 @@
1
+ export interface HTTPErrorOptions {
2
+ res?: Response;
3
+ message?: string;
4
+ cause?: unknown;
5
+ }
6
+ export declare class HTTPError extends Error {
7
+ readonly status: number;
8
+ readonly res?: Response;
9
+ readonly cause?: unknown;
10
+ constructor(status: number, options?: HTTPErrorOptions);
11
+ getResponse(): Response;
12
+ private get statusText();
13
+ }
14
+ export declare class BadRequestException extends HTTPError {
15
+ constructor(options?: HTTPErrorOptions);
16
+ }
17
+ export declare class UnauthorizedException extends HTTPError {
18
+ constructor(options?: HTTPErrorOptions);
19
+ }
20
+ export declare class ForbiddenException extends HTTPError {
21
+ constructor(options?: HTTPErrorOptions);
22
+ }
23
+ export declare class NotFoundException extends HTTPError {
24
+ constructor(options?: HTTPErrorOptions);
25
+ }
26
+ export declare class MethodNotAllowedException extends HTTPError {
27
+ constructor(options?: HTTPErrorOptions);
28
+ }
29
+ export declare class NotAcceptableException extends HTTPError {
30
+ constructor(options?: HTTPErrorOptions);
31
+ }
32
+ export declare class RequestTimeoutException extends HTTPError {
33
+ constructor(options?: HTTPErrorOptions);
34
+ }
35
+ export declare class ConflictException extends HTTPError {
36
+ constructor(options?: HTTPErrorOptions);
37
+ }
38
+ export declare class GoneException extends HTTPError {
39
+ constructor(options?: HTTPErrorOptions);
40
+ }
41
+ export declare class PayloadTooLargeException extends HTTPError {
42
+ constructor(options?: HTTPErrorOptions);
43
+ }
44
+ export declare class UnsupportedMediaTypeException extends HTTPError {
45
+ constructor(options?: HTTPErrorOptions);
46
+ }
47
+ export declare class UnprocessableEntityException extends HTTPError {
48
+ constructor(options?: HTTPErrorOptions);
49
+ }
50
+ export declare class TooManyRequestsException extends HTTPError {
51
+ constructor(options?: HTTPErrorOptions);
52
+ }
53
+ export declare class InternalServerErrorException extends HTTPError {
54
+ constructor(options?: HTTPErrorOptions);
55
+ }
56
+ export declare class NotImplementedException extends HTTPError {
57
+ constructor(options?: HTTPErrorOptions);
58
+ }
59
+ export declare class BadGatewayException extends HTTPError {
60
+ constructor(options?: HTTPErrorOptions);
61
+ }
62
+ export declare class ServiceUnavailableException extends HTTPError {
63
+ constructor(options?: HTTPErrorOptions);
64
+ }
65
+ export declare class GatewayTimeoutException extends HTTPError {
66
+ constructor(options?: HTTPErrorOptions);
67
+ }
@@ -0,0 +1,3 @@
1
+ import { H3Event } from 'h3';
2
+ import type { CorsOptions } from '../types';
3
+ export declare const useCors: (event: H3Event, options?: CorsOptions) => false | import("h3").HTTPResponse;
@@ -0,0 +1,2 @@
1
+ export * from './methods';
2
+ export * from './cors';
@@ -0,0 +1,2 @@
1
+ export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
2
+ export declare const HTTP_METHODS: HTTPMethod[];
@@ -0,0 +1,7 @@
1
+ export * from './schema';
2
+ export * from './types';
3
+ export * from './tritio';
4
+ export * from './error/http-error';
5
+ export * from './error/handler';
6
+ export * from './docs';
7
+ export * from './http';