@vercube/core 0.0.3 → 0.0.4

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.
Files changed (76) hide show
  1. package/dist/index.d.mts +1193 -0
  2. package/dist/index.mjs +175 -174
  3. package/package.json +8 -23
  4. package/dist/Common/App.d.ts +0 -65
  5. package/dist/Common/Container.d.ts +0 -8
  6. package/dist/Common/CreateApp.d.ts +0 -8
  7. package/dist/Config/Config.d.ts +0 -7
  8. package/dist/Config/DefaultConfig.d.ts +0 -6
  9. package/dist/Config/Loader.d.ts +0 -7
  10. package/dist/Decorators/Hooks/Listen.d.ts +0 -9
  11. package/dist/Decorators/Http/Body.d.ts +0 -15
  12. package/dist/Decorators/Http/Connect.d.ts +0 -10
  13. package/dist/Decorators/Http/Controller.d.ts +0 -10
  14. package/dist/Decorators/Http/Delete.d.ts +0 -10
  15. package/dist/Decorators/Http/Get.d.ts +0 -10
  16. package/dist/Decorators/Http/Head.d.ts +0 -10
  17. package/dist/Decorators/Http/Header.d.ts +0 -11
  18. package/dist/Decorators/Http/Headers.d.ts +0 -9
  19. package/dist/Decorators/Http/Middleware.d.ts +0 -27
  20. package/dist/Decorators/Http/MultipartFormData.d.ts +0 -15
  21. package/dist/Decorators/Http/Options.d.ts +0 -10
  22. package/dist/Decorators/Http/Param.d.ts +0 -12
  23. package/dist/Decorators/Http/Patch.d.ts +0 -10
  24. package/dist/Decorators/Http/Post.d.ts +0 -10
  25. package/dist/Decorators/Http/Put.d.ts +0 -10
  26. package/dist/Decorators/Http/QueryParam.d.ts +0 -16
  27. package/dist/Decorators/Http/QueryParams.d.ts +0 -15
  28. package/dist/Decorators/Http/Redirect.d.ts +0 -13
  29. package/dist/Decorators/Http/Request.d.ts +0 -9
  30. package/dist/Decorators/Http/Response.d.ts +0 -9
  31. package/dist/Decorators/Http/Session.d.ts +0 -9
  32. package/dist/Decorators/Http/SetHeader.d.ts +0 -7
  33. package/dist/Decorators/Http/Status.d.ts +0 -11
  34. package/dist/Decorators/Http/Trace.d.ts +0 -10
  35. package/dist/Errors/Http/BadRequestError.d.ts +0 -17
  36. package/dist/Errors/Http/ForbiddenError.d.ts +0 -17
  37. package/dist/Errors/Http/InternalServerError.d.ts +0 -17
  38. package/dist/Errors/Http/MethodNotAllowedError.d.ts +0 -17
  39. package/dist/Errors/Http/NotAcceptableError.d.ts +0 -17
  40. package/dist/Errors/Http/NotFoundError.d.ts +0 -17
  41. package/dist/Errors/Http/UnauthorizedError.d.ts +0 -17
  42. package/dist/Errors/HttpError.d.ts +0 -17
  43. package/dist/Hooks/Router/RouterAfterInitHook.d.ts +0 -1
  44. package/dist/Hooks/Router/RouterBeforeInitHook.d.ts +0 -1
  45. package/dist/Middleware/ValidationMiddleware.d.ts +0 -23
  46. package/dist/Resolvers/Body.d.ts +0 -22
  47. package/dist/Resolvers/Headers.d.ts +0 -14
  48. package/dist/Resolvers/Query.d.ts +0 -14
  49. package/dist/Resolvers/RouterParam.d.ts +0 -13
  50. package/dist/Services/Config/RuntimeConfig.d.ts +0 -22
  51. package/dist/Services/ErrorHandler/DefaultErrorHandlerProvider.d.ts +0 -16
  52. package/dist/Services/ErrorHandler/ErrorHandlerProvider.d.ts +0 -16
  53. package/dist/Services/Hooks/HooksService.d.ts +0 -76
  54. package/dist/Services/HttpServer/HttpServer.d.ts +0 -57
  55. package/dist/Services/Metadata/MetadataResolver.d.ts +0 -42
  56. package/dist/Services/Middleware/BaseMiddleware.d.ts +0 -31
  57. package/dist/Services/Middleware/GlobalMiddlewareRegistry.d.ts +0 -31
  58. package/dist/Services/Plugins/BasePlugin.d.ts +0 -16
  59. package/dist/Services/Plugins/PluginsRegistry.d.ts +0 -26
  60. package/dist/Services/Router/RequestHandler.d.ts +0 -63
  61. package/dist/Services/Router/Router.d.ts +0 -40
  62. package/dist/Services/Router/StaticRequestHandler.d.ts +0 -38
  63. package/dist/Services/Validation/StandardSchemaValidationProvider.d.ts +0 -17
  64. package/dist/Services/Validation/ValidationProvider.d.ts +0 -17
  65. package/dist/Types/CommonTypes.d.ts +0 -7
  66. package/dist/Types/ConfigTypes.d.ts +0 -124
  67. package/dist/Types/HooksTypes.d.ts +0 -17
  68. package/dist/Types/HttpTypes.d.ts +0 -63
  69. package/dist/Types/MetadataTypes.d.ts +0 -56
  70. package/dist/Types/RouterTypes.d.ts +0 -37
  71. package/dist/Types/ValidationTypes.d.ts +0 -6
  72. package/dist/Utils/InternalUtils.d.ts +0 -1
  73. package/dist/Utils/Mine.d.ts +0 -3
  74. package/dist/Utils/Utils.d.ts +0 -22
  75. package/dist/index.cjs +0 -2704
  76. package/dist/index.d.ts +0 -52
@@ -1,124 +0,0 @@
1
- import type { LoggerTypes } from "@vercube/logger";
2
- /**
3
- * Namespace containing configuration type definitions for the Vercube framework.
4
- */
5
- export declare namespace ConfigTypes {
6
- interface RuntimeConfig {
7
- /**
8
- * Session configuration options.
9
- */
10
- session?: {
11
- /**
12
- * The secret used to sign the session ID cookie.
13
- */
14
- secret?: string
15
- /**
16
- * The name of the session ID cookie.
17
- */
18
- name?: string
19
- /**
20
- * The duration of time for the session to be active.
21
- */
22
- duration?: number
23
- };
24
- }
25
- interface ExperimentalOptions {}
26
- interface BuildOptions {
27
- /**
28
- * The root directory for the application.
29
- */
30
- root?: string;
31
- /**
32
- * The entry point file for the application build.
33
- */
34
- entry?: string;
35
- /**
36
- * Defines to pass to the build.
37
- */
38
- define?: Record<string, string>;
39
- /**
40
- * Output configuration for build artifacts.
41
- */
42
- output?: {
43
- /**
44
- * The main output directory for build artifacts.
45
- */
46
- dir?: string
47
- /**
48
- * The directory for public/client-side build artifacts.
49
- */
50
- publicDir?: string
51
- };
52
- /**
53
- * The bundler to use for the application build.
54
- */
55
- bundler?: "rolldown";
56
- }
57
- interface ServerOptions {
58
- /**
59
- * The runtime environment for the application.
60
- */
61
- runtime?: "node" | "bun" | "deno";
62
- /**
63
- * The hostname to bind the server to.
64
- */
65
- host?: string;
66
- /**
67
- * The port number to listen on.
68
- */
69
- port?: number;
70
- /**
71
- * HTTPS configuration options.
72
- */
73
- https?: false | {
74
- /**
75
- * Path to the SSL key file.
76
- */
77
- key: string
78
- /**
79
- * Path to the SSL certificate file.
80
- */
81
- cert: string
82
- };
83
- /**
84
- * Static server options
85
- */
86
- static?: {
87
- dirs: string[]
88
- maxAge?: number
89
- immutable?: boolean
90
- etag?: boolean
91
- };
92
- }
93
- interface Config {
94
- /**
95
- * Flag indicating if the application is running in production mode.
96
- */
97
- production?: boolean;
98
- /**
99
- * Flag indicating if the application is running in development mode.
100
- */
101
- dev?: boolean;
102
- /**
103
- * The logging level for the application.
104
- */
105
- logLevel?: LoggerTypes.Level;
106
- /**
107
- * Server configuration options.
108
- */
109
- server?: ServerOptions;
110
- /**
111
- * Runtime configuration for the application.
112
- */
113
- runtime?: RuntimeConfig;
114
- /**
115
- * Experimental features configuration.
116
- */
117
- experimental?: ExperimentalOptions;
118
- /**
119
- * Build configuration options.
120
- * This property is only used when using vercube cli.
121
- */
122
- build?: BuildOptions;
123
- }
124
- }
@@ -1,17 +0,0 @@
1
- export declare namespace HooksTypes {
2
- interface HookType<T> {
3
- new (): T;
4
- }
5
- type HookData<T> = { [P in keyof T] : T[P] };
6
- interface HookCallback<T> {
7
- (data: T): void | Promise<void>;
8
- }
9
- interface HookHandler<T> {
10
- id: number;
11
- callback: HookCallback<T>;
12
- }
13
- interface HookID {
14
- readonly __id: number;
15
- readonly __type: HookType<any>;
16
- }
17
- }
@@ -1,63 +0,0 @@
1
- export declare enum HTTPStatus {
2
- CONTINUE = 100,
3
- SWITCHING_PROTOCOLS = 101,
4
- PROCESSING = 102,
5
- OK = 200,
6
- CREATED = 201,
7
- ACCEPTED = 202,
8
- NON_AUTHORITATIVE_INFORMATION = 203,
9
- NO_CONTENT = 204,
10
- RESET_CONTENT = 205,
11
- PARTIAL_CONTENT = 206,
12
- MULTI_STATUS = 207,
13
- ALREADY_REPORTED = 208,
14
- IM_USED = 226,
15
- MULTIPLE_CHOICES = 300,
16
- MOVED_PERMANENTLY = 301,
17
- FOUND = 302,
18
- SEE_OTHER = 303,
19
- NOT_MODIFIED = 304,
20
- USE_PROXY = 305,
21
- TEMPORARY_REDIRECT = 307,
22
- PERMANENT_REDIRECT = 308,
23
- BAD_REQUEST = 400,
24
- UNAUTHORIZED = 401,
25
- PAYMENT_REQUIRED = 402,
26
- FORBIDDEN = 403,
27
- NOT_FOUND = 404,
28
- METHOD_NOT_ALLOWED = 405,
29
- NOT_ACCEPTABLE = 406,
30
- PROXY_AUTHENTICATION_REQUIRED = 407,
31
- REQUEST_TIMEOUT = 408,
32
- CONFLICT = 409,
33
- GONE = 410,
34
- LENGTH_REQUIRED = 411,
35
- PRECONDITION_FAILED = 412,
36
- PAYLOAD_TOO_LARGE = 413,
37
- URI_TOO_LONG = 414,
38
- UNSUPPORTED_MEDIA_TYPE = 415,
39
- RANGE_NOT_SATISFIABLE = 416,
40
- EXPECTATION_FAILED = 417,
41
- I_AM_A_TEAPOT = 418,
42
- MISDIRECTED_REQUEST = 421,
43
- UNPROCESSABLE_ENTITY = 422,
44
- LOCKED = 423,
45
- FAILED_DEPENDENCY = 424,
46
- TOO_EARLY = 425,
47
- UPGRADE_REQUIRED = 426,
48
- PRECONDITION_REQUIRED = 428,
49
- TOO_MANY_REQUESTS = 429,
50
- REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
51
- UNAVAILABLE_FOR_LEGAL_REASONS = 451,
52
- INTERNAL_SERVER_ERROR = 500,
53
- NOT_IMPLEMENTED = 501,
54
- BAD_GATEWAY = 502,
55
- SERVICE_UNAVAILABLE = 503,
56
- GATEWAY_TIMEOUT = 504,
57
- HTTP_VERSION_NOT_SUPPORTED = 505,
58
- VARIANT_ALSO_NEGOTIATES = 506,
59
- INSUFFICIENT_STORAGE = 507,
60
- LOOP_DETECTED = 508,
61
- NOT_EXTENDED = 510,
62
- NETWORK_AUTHENTICATION_REQUIRED = 511
63
- }
@@ -1,56 +0,0 @@
1
- import type { BaseMiddleware } from "../Services/Middleware/BaseMiddleware.js";
2
- import type { RouterTypes } from "./RouterTypes.js";
3
- import type { ValidationTypes } from "./ValidationTypes.js";
4
- export declare namespace MetadataTypes {
5
- interface Metadata {
6
- __metadata: Ctx;
7
- }
8
- interface Ctx {
9
- __controller: {
10
- path: string
11
- };
12
- __middlewares: Middleware[];
13
- __methods: Record<string, Method>;
14
- }
15
- interface Method {
16
- req: Request | null;
17
- res: Response | null;
18
- url: string | null;
19
- args: Arg[];
20
- actions: Action[];
21
- }
22
- interface ResolvedData {
23
- req: Request | null;
24
- res: Response | null;
25
- url: string | null;
26
- args: Arg[];
27
- actions: Action[];
28
- middlewares: Middleware[];
29
- }
30
- interface Arg {
31
- idx: number;
32
- type: string;
33
- data?: Record<string, any>;
34
- resolver?: (event: RouterTypes.RouterEvent) => Promise<unknown>;
35
- resolved?: unknown;
36
- validate?: boolean;
37
- validationSchema?: ValidationTypes.Schema;
38
- }
39
- interface Action {
40
- handler: (req: Request, res: Response) => void | Response | ResponseInit;
41
- }
42
- interface Middleware<
43
- T = unknown,
44
- U = unknown
45
- > {
46
- target: string;
47
- priority?: number;
48
- middleware: typeof BaseMiddleware<T, U>;
49
- args?: unknown;
50
- }
51
- interface ResolveUrlParams {
52
- instance: any;
53
- path: string;
54
- propertyName: string;
55
- }
56
- }
@@ -1,37 +0,0 @@
1
- import { MetadataTypes } from "./MetadataTypes.js";
2
- import { BaseMiddleware } from "../Services/Middleware/BaseMiddleware.js";
3
- export declare namespace RouterTypes {
4
- interface Route {
5
- path: string;
6
- method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD" | "CONNECT" | "TRACE";
7
- handler: RouterHandler;
8
- }
9
- interface RouteFind {
10
- path: string;
11
- method: string;
12
- }
13
- interface MiddlewareDefinition {
14
- middleware: BaseMiddleware<unknown, unknown>;
15
- target: string;
16
- priority?: number;
17
- args?: unknown;
18
- }
19
- interface RouterHandler {
20
- instance: any;
21
- propertyName: string;
22
- args: MetadataTypes.Arg[];
23
- middlewares: {
24
- beforeMiddlewares: MiddlewareDefinition[]
25
- afterMiddlewares: MiddlewareDefinition[]
26
- };
27
- actions: MetadataTypes.Action[];
28
- }
29
- interface RouteMatched<T = unknown> {
30
- data: T;
31
- params?: Record<string, string>;
32
- }
33
- type RouterEvent = RouterTypes.RouteMatched<RouterTypes.RouterHandler> & {
34
- request: Request
35
- response: Response
36
- };
37
- }
@@ -1,6 +0,0 @@
1
- import type { StandardSchemaV1 } from "@standard-schema/spec";
2
- export declare namespace ValidationTypes {
3
- type Schema = StandardSchemaV1;
4
- type Result<T = any> = StandardSchemaV1.Result<T>;
5
- type Input<T extends Schema = Schema> = StandardSchemaV1.InferInput<T>;
6
- }
@@ -1 +0,0 @@
1
- export default function generateRandomHash(): string;
@@ -1,3 +0,0 @@
1
- export declare const mime: {
2
- getType(ext: string): string | null
3
- };
@@ -1,22 +0,0 @@
1
- import { MetadataTypes } from "../Types/MetadataTypes.js";
2
- /**
3
- * Creates a new metadata context.
4
- * @returns {MetadataTypes.Ctx} The new metadata context.
5
- */
6
- export declare function createMetadataCtx(): MetadataTypes.Ctx;
7
- /**
8
- * Creates a new metadata method.
9
- * @returns {MetadataTypes.Method} The new metadata method.
10
- */
11
- export declare function createMetadataMethod(): MetadataTypes.Method;
12
- /**
13
- * Initializes the metadata for a given target and property name.
14
- * @param {any} target - The target to initialize metadata for.
15
- * @param {string} propertyName - The name of the property to initialize metadata for.
16
- */
17
- export declare function initializeMetadataMethod(target: any, propertyName: string): MetadataTypes.Method;
18
- /**
19
- * Initializes the metadata for a given target.
20
- * @param {any} target - The target to initialize metadata for.
21
- */
22
- export declare function initializeMetadata(target: any): MetadataTypes.Ctx;