@vercube/core 0.0.1-alpha.15

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 (74) hide show
  1. package/dist/Common/App.d.ts +56 -0
  2. package/dist/Common/Container.d.ts +8 -0
  3. package/dist/Common/CreateApp.d.ts +8 -0
  4. package/dist/Config/Config.d.ts +7 -0
  5. package/dist/Config/DefaultConfig.d.ts +6 -0
  6. package/dist/Config/Loader.d.ts +7 -0
  7. package/dist/Decorators/Hooks/Listen.d.ts +9 -0
  8. package/dist/Decorators/Http/Body.d.ts +15 -0
  9. package/dist/Decorators/Http/Connect.d.ts +10 -0
  10. package/dist/Decorators/Http/Controller.d.ts +10 -0
  11. package/dist/Decorators/Http/Delete.d.ts +10 -0
  12. package/dist/Decorators/Http/Get.d.ts +10 -0
  13. package/dist/Decorators/Http/Head.d.ts +10 -0
  14. package/dist/Decorators/Http/Header.d.ts +11 -0
  15. package/dist/Decorators/Http/Headers.d.ts +9 -0
  16. package/dist/Decorators/Http/Middleware.d.ts +27 -0
  17. package/dist/Decorators/Http/MultipartFormData.d.ts +15 -0
  18. package/dist/Decorators/Http/Options.d.ts +10 -0
  19. package/dist/Decorators/Http/Param.d.ts +12 -0
  20. package/dist/Decorators/Http/Patch.d.ts +10 -0
  21. package/dist/Decorators/Http/Post.d.ts +10 -0
  22. package/dist/Decorators/Http/Put.d.ts +10 -0
  23. package/dist/Decorators/Http/QueryParam.d.ts +16 -0
  24. package/dist/Decorators/Http/QueryParams.d.ts +15 -0
  25. package/dist/Decorators/Http/Redirect.d.ts +13 -0
  26. package/dist/Decorators/Http/Request.d.ts +9 -0
  27. package/dist/Decorators/Http/Response.d.ts +9 -0
  28. package/dist/Decorators/Http/Session.d.ts +9 -0
  29. package/dist/Decorators/Http/SetHeader.d.ts +7 -0
  30. package/dist/Decorators/Http/Status.d.ts +11 -0
  31. package/dist/Decorators/Http/Trace.d.ts +10 -0
  32. package/dist/Errors/Http/BadRequestError.d.ts +17 -0
  33. package/dist/Errors/Http/ForbiddenError.d.ts +17 -0
  34. package/dist/Errors/Http/InternalServerError.d.ts +17 -0
  35. package/dist/Errors/Http/MethodNotAllowedError.d.ts +17 -0
  36. package/dist/Errors/Http/NotAcceptableError.d.ts +17 -0
  37. package/dist/Errors/Http/NotFoundError.d.ts +17 -0
  38. package/dist/Errors/Http/UnauthorizedError.d.ts +17 -0
  39. package/dist/Errors/HttpError.d.ts +17 -0
  40. package/dist/Hooks/Router/RouterAfterInitHook.d.ts +1 -0
  41. package/dist/Hooks/Router/RouterBeforeInitHook.d.ts +1 -0
  42. package/dist/Middleware/ValidationMiddleware.d.ts +23 -0
  43. package/dist/Resolvers/Body.d.ts +22 -0
  44. package/dist/Resolvers/Headers.d.ts +14 -0
  45. package/dist/Resolvers/Query.d.ts +14 -0
  46. package/dist/Resolvers/RouterParam.d.ts +13 -0
  47. package/dist/Services/Config/RuntimeConfig.d.ts +22 -0
  48. package/dist/Services/ErrorHandler/DefaultErrorHandlerProvider.d.ts +16 -0
  49. package/dist/Services/ErrorHandler/ErrorHandlerProvider.d.ts +16 -0
  50. package/dist/Services/Hooks/HooksService.d.ts +76 -0
  51. package/dist/Services/HttpServer/HttpServer.d.ts +51 -0
  52. package/dist/Services/Metadata/MetadataResolver.d.ts +42 -0
  53. package/dist/Services/Middleware/BaseMiddleware.d.ts +31 -0
  54. package/dist/Services/Middleware/GlobalMiddlewareRegistry.d.ts +31 -0
  55. package/dist/Services/Plugins/BasePlugin.d.ts +16 -0
  56. package/dist/Services/Plugins/PluginsRegistry.d.ts +26 -0
  57. package/dist/Services/Router/RequestHandler.d.ts +65 -0
  58. package/dist/Services/Router/Router.d.ts +40 -0
  59. package/dist/Services/Router/StaticRequestHandler.d.ts +38 -0
  60. package/dist/Services/Validation/StandardSchemaValidationProvider.d.ts +17 -0
  61. package/dist/Services/Validation/ValidationProvider.d.ts +17 -0
  62. package/dist/Types/CommonTypes.d.ts +6 -0
  63. package/dist/Types/ConfigTypes.d.ts +120 -0
  64. package/dist/Types/HooksTypes.d.ts +17 -0
  65. package/dist/Types/HttpTypes.d.ts +63 -0
  66. package/dist/Types/MetadataTypes.d.ts +54 -0
  67. package/dist/Types/ValidationTypes.d.ts +6 -0
  68. package/dist/Utils/InternalUtils.d.ts +5 -0
  69. package/dist/Utils/Mine.d.ts +3 -0
  70. package/dist/Utils/Utils.d.ts +22 -0
  71. package/dist/index.cjs +2018 -0
  72. package/dist/index.d.ts +46 -0
  73. package/dist/index.mjs +1944 -0
  74. package/package.json +35 -0
@@ -0,0 +1,17 @@
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
+ }
@@ -0,0 +1,63 @@
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
+ }
@@ -0,0 +1,54 @@
1
+ import type { BaseMiddleware } from "../Services/Middleware/BaseMiddleware.js";
2
+ import { ValidationTypes } from "./ValidationTypes.js";
3
+ export declare namespace MetadataTypes {
4
+ interface Metadata {
5
+ __metadata: Ctx;
6
+ }
7
+ interface Ctx {
8
+ __controller: {
9
+ path: string
10
+ };
11
+ __middlewares: Middleware[];
12
+ __methods: Record<string, Method>;
13
+ }
14
+ interface Method {
15
+ req: Request | null;
16
+ res: Response | null;
17
+ url: string | null;
18
+ args: Arg[];
19
+ actions: Action[];
20
+ }
21
+ interface ResolvedData {
22
+ req: Request | null;
23
+ res: Response | null;
24
+ url: string | null;
25
+ args: Arg[];
26
+ actions: Action[];
27
+ middlewares: Middleware[];
28
+ }
29
+ interface Arg {
30
+ idx: number;
31
+ type: string;
32
+ data?: Record<string, any>;
33
+ resolved?: unknown;
34
+ validate?: boolean;
35
+ validationSchema?: ValidationTypes.Schema;
36
+ }
37
+ interface Action {
38
+ handler: (req: Request, res: Response) => void | Response | ResponseInit;
39
+ }
40
+ interface Middleware<
41
+ T = unknown,
42
+ U = unknown
43
+ > {
44
+ target: string;
45
+ priority?: number;
46
+ middleware: typeof BaseMiddleware<T, U>;
47
+ args?: unknown;
48
+ }
49
+ interface ResolveUrlParams {
50
+ instance: any;
51
+ path: string;
52
+ propertyName: string;
53
+ }
54
+ }
@@ -0,0 +1,6 @@
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
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generate random hash
3
+ * @returns string
4
+ */
5
+ export default function generateRandomHash(): string;
@@ -0,0 +1,3 @@
1
+ export declare const mime: {
2
+ getType(ext: string): string | null
3
+ };
@@ -0,0 +1,22 @@
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;