@vercube/core 0.0.2 → 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.
- package/dist/index.d.mts +1193 -0
- package/dist/index.mjs +196 -191
- package/package.json +8 -23
- package/dist/Common/App.d.ts +0 -65
- package/dist/Common/Container.d.ts +0 -8
- package/dist/Common/CreateApp.d.ts +0 -8
- package/dist/Config/Config.d.ts +0 -7
- package/dist/Config/DefaultConfig.d.ts +0 -6
- package/dist/Config/Loader.d.ts +0 -7
- package/dist/Decorators/Hooks/Listen.d.ts +0 -9
- package/dist/Decorators/Http/Body.d.ts +0 -15
- package/dist/Decorators/Http/Connect.d.ts +0 -10
- package/dist/Decorators/Http/Controller.d.ts +0 -10
- package/dist/Decorators/Http/Delete.d.ts +0 -10
- package/dist/Decorators/Http/Get.d.ts +0 -10
- package/dist/Decorators/Http/Head.d.ts +0 -10
- package/dist/Decorators/Http/Header.d.ts +0 -11
- package/dist/Decorators/Http/Headers.d.ts +0 -9
- package/dist/Decorators/Http/Middleware.d.ts +0 -27
- package/dist/Decorators/Http/MultipartFormData.d.ts +0 -15
- package/dist/Decorators/Http/Options.d.ts +0 -10
- package/dist/Decorators/Http/Param.d.ts +0 -12
- package/dist/Decorators/Http/Patch.d.ts +0 -10
- package/dist/Decorators/Http/Post.d.ts +0 -10
- package/dist/Decorators/Http/Put.d.ts +0 -10
- package/dist/Decorators/Http/QueryParam.d.ts +0 -16
- package/dist/Decorators/Http/QueryParams.d.ts +0 -15
- package/dist/Decorators/Http/Redirect.d.ts +0 -13
- package/dist/Decorators/Http/Request.d.ts +0 -9
- package/dist/Decorators/Http/Response.d.ts +0 -9
- package/dist/Decorators/Http/Session.d.ts +0 -9
- package/dist/Decorators/Http/SetHeader.d.ts +0 -7
- package/dist/Decorators/Http/Status.d.ts +0 -11
- package/dist/Decorators/Http/Trace.d.ts +0 -10
- package/dist/Errors/Http/BadRequestError.d.ts +0 -17
- package/dist/Errors/Http/ForbiddenError.d.ts +0 -17
- package/dist/Errors/Http/InternalServerError.d.ts +0 -17
- package/dist/Errors/Http/MethodNotAllowedError.d.ts +0 -17
- package/dist/Errors/Http/NotAcceptableError.d.ts +0 -17
- package/dist/Errors/Http/NotFoundError.d.ts +0 -17
- package/dist/Errors/Http/UnauthorizedError.d.ts +0 -17
- package/dist/Errors/HttpError.d.ts +0 -17
- package/dist/Hooks/Router/RouterAfterInitHook.d.ts +0 -1
- package/dist/Hooks/Router/RouterBeforeInitHook.d.ts +0 -1
- package/dist/Middleware/ValidationMiddleware.d.ts +0 -23
- package/dist/Resolvers/Body.d.ts +0 -22
- package/dist/Resolvers/Headers.d.ts +0 -14
- package/dist/Resolvers/Query.d.ts +0 -14
- package/dist/Resolvers/RouterParam.d.ts +0 -13
- package/dist/Services/Config/RuntimeConfig.d.ts +0 -22
- package/dist/Services/ErrorHandler/DefaultErrorHandlerProvider.d.ts +0 -16
- package/dist/Services/ErrorHandler/ErrorHandlerProvider.d.ts +0 -16
- package/dist/Services/Hooks/HooksService.d.ts +0 -76
- package/dist/Services/HttpServer/HttpServer.d.ts +0 -57
- package/dist/Services/Metadata/MetadataResolver.d.ts +0 -42
- package/dist/Services/Middleware/BaseMiddleware.d.ts +0 -31
- package/dist/Services/Middleware/GlobalMiddlewareRegistry.d.ts +0 -31
- package/dist/Services/Plugins/BasePlugin.d.ts +0 -16
- package/dist/Services/Plugins/PluginsRegistry.d.ts +0 -26
- package/dist/Services/Router/RequestHandler.d.ts +0 -63
- package/dist/Services/Router/Router.d.ts +0 -40
- package/dist/Services/Router/StaticRequestHandler.d.ts +0 -38
- package/dist/Services/Validation/StandardSchemaValidationProvider.d.ts +0 -17
- package/dist/Services/Validation/ValidationProvider.d.ts +0 -17
- package/dist/Types/CommonTypes.d.ts +0 -6
- package/dist/Types/ConfigTypes.d.ts +0 -124
- package/dist/Types/HooksTypes.d.ts +0 -17
- package/dist/Types/HttpTypes.d.ts +0 -63
- package/dist/Types/MetadataTypes.d.ts +0 -56
- package/dist/Types/RouterTypes.d.ts +0 -37
- package/dist/Types/ValidationTypes.d.ts +0 -6
- package/dist/Utils/InternalUtils.d.ts +0 -5
- package/dist/Utils/Mine.d.ts +0 -3
- package/dist/Utils/Utils.d.ts +0 -22
- package/dist/index.cjs +0 -2693
- package/dist/index.d.ts +0 -51
package/dist/index.mjs
CHANGED
|
@@ -1,27 +1,59 @@
|
|
|
1
|
+
import "node:module";
|
|
1
2
|
import { BaseDecorator, Container, Inject, InjectOptional, createDecorator, initializeContainer } from "@vercube/di";
|
|
2
|
-
import { serve } from "srvx";
|
|
3
|
+
import { FastResponse, serve } from "srvx";
|
|
3
4
|
import { addRoute, createRouter, findRoute } from "rou3";
|
|
4
5
|
import { createReadStream } from "node:fs";
|
|
5
6
|
import { extname, join, normalize } from "node:path";
|
|
6
7
|
import { stat } from "node:fs/promises";
|
|
7
8
|
import { BaseLogger, Logger, colors } from "@vercube/logger";
|
|
9
|
+
import { ConsoleProvider } from "@vercube/logger/providers";
|
|
8
10
|
import { loadConfig } from "c12";
|
|
9
11
|
import { defu } from "defu";
|
|
10
12
|
|
|
11
|
-
//#region
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
//#region rolldown:runtime
|
|
14
|
+
var __create = Object.create;
|
|
15
|
+
var __defProp = Object.defineProperty;
|
|
16
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
17
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
18
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
19
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20
|
+
var __commonJS = (cb, mod) => function() {
|
|
21
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
22
|
+
};
|
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
25
|
+
key = keys[i];
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
27
|
+
get: ((k) => from[k]).bind(null, key),
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
34
|
+
value: mod,
|
|
35
|
+
enumerable: true
|
|
36
|
+
}) : target, mod));
|
|
18
37
|
|
|
19
38
|
//#endregion
|
|
20
|
-
//#region
|
|
39
|
+
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.1/node_modules/@oxc-project/runtime/src/helpers/decorate.js
|
|
40
|
+
var require_decorate = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.1/node_modules/@oxc-project/runtime/src/helpers/decorate.js"(exports, module) {
|
|
41
|
+
function __decorate(decorators, target, key, desc) {
|
|
42
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
43
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
44
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
45
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
46
|
+
}
|
|
47
|
+
module.exports = __decorate, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
48
|
+
} });
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/Services/Plugins/PluginsRegistry.ts
|
|
52
|
+
var import_decorate$18 = __toESM(require_decorate());
|
|
21
53
|
var PluginsRegistry = class {
|
|
22
54
|
gContainer;
|
|
23
55
|
/** Holds the list of plugins */
|
|
24
|
-
fPlugins = new Map();
|
|
56
|
+
fPlugins = /* @__PURE__ */ new Map();
|
|
25
57
|
/**
|
|
26
58
|
* Registers a plugin.
|
|
27
59
|
*
|
|
@@ -52,16 +84,16 @@ var PluginsRegistry = class {
|
|
|
52
84
|
for (const { instance, options } of this.fPlugins.values()) await instance.use(app, options);
|
|
53
85
|
}
|
|
54
86
|
};
|
|
55
|
-
|
|
87
|
+
(0, import_decorate$18.default)([Inject(Container)], PluginsRegistry.prototype, "gContainer", void 0);
|
|
56
88
|
|
|
57
89
|
//#endregion
|
|
58
|
-
//#region
|
|
90
|
+
//#region src/Services/Hooks/HooksService.ts
|
|
59
91
|
/**
|
|
60
92
|
* This class is responsible for managing events.
|
|
61
93
|
*/
|
|
62
94
|
var HooksService = class {
|
|
63
95
|
fLastId = 0;
|
|
64
|
-
fHandlers = new Map();
|
|
96
|
+
fHandlers = /* @__PURE__ */ new Map();
|
|
65
97
|
/**
|
|
66
98
|
* Registers listener for event of particular type. Everytime event is called, the listener
|
|
67
99
|
* will be executed.
|
|
@@ -165,15 +197,16 @@ var HooksService = class {
|
|
|
165
197
|
};
|
|
166
198
|
|
|
167
199
|
//#endregion
|
|
168
|
-
//#region
|
|
200
|
+
//#region src/Hooks/Router/RouterBeforeInitHook.ts
|
|
169
201
|
var RouterBeforeInitHook = class {};
|
|
170
202
|
|
|
171
203
|
//#endregion
|
|
172
|
-
//#region
|
|
204
|
+
//#region src/Hooks/Router/RouterAfterInitHook.ts
|
|
173
205
|
var RouterAfterInitHook = class {};
|
|
174
206
|
|
|
175
207
|
//#endregion
|
|
176
|
-
//#region
|
|
208
|
+
//#region src/Services/Router/Router.ts
|
|
209
|
+
var import_decorate$17 = __toESM(require_decorate());
|
|
177
210
|
/**
|
|
178
211
|
* Router service responsible for managing application routes
|
|
179
212
|
*
|
|
@@ -226,10 +259,10 @@ var Router = class {
|
|
|
226
259
|
return findRoute(this.fRouterContext, route.method.toUpperCase(), url);
|
|
227
260
|
}
|
|
228
261
|
};
|
|
229
|
-
|
|
262
|
+
(0, import_decorate$17.default)([Inject(HooksService)], Router.prototype, "gHooksService", void 0);
|
|
230
263
|
|
|
231
264
|
//#endregion
|
|
232
|
-
//#region
|
|
265
|
+
//#region src/Resolvers/RouterParam.ts
|
|
233
266
|
/**
|
|
234
267
|
* Resolves a router parameter from the event object
|
|
235
268
|
* @param param - The parameter name to resolve from the router event
|
|
@@ -246,7 +279,7 @@ function resolveRouterParam(param, event) {
|
|
|
246
279
|
}
|
|
247
280
|
|
|
248
281
|
//#endregion
|
|
249
|
-
//#region
|
|
282
|
+
//#region src/Errors/HttpError.ts
|
|
250
283
|
/**
|
|
251
284
|
* Represents an HTTP error.
|
|
252
285
|
* @extends {Error}
|
|
@@ -272,7 +305,7 @@ var HttpError = class HttpError extends Error {
|
|
|
272
305
|
};
|
|
273
306
|
|
|
274
307
|
//#endregion
|
|
275
|
-
//#region
|
|
308
|
+
//#region src/Errors/Http/BadRequestError.ts
|
|
276
309
|
/**
|
|
277
310
|
* Represents a Bad Request error (HTTP 400).
|
|
278
311
|
* @extends {HttpError}
|
|
@@ -296,7 +329,7 @@ var BadRequestError = class BadRequestError extends HttpError {
|
|
|
296
329
|
};
|
|
297
330
|
|
|
298
331
|
//#endregion
|
|
299
|
-
//#region
|
|
332
|
+
//#region src/Resolvers/Body.ts
|
|
300
333
|
/**
|
|
301
334
|
* Resolves and parses the request body from a RouterEvent.
|
|
302
335
|
*
|
|
@@ -328,7 +361,7 @@ async function resolveRequestBody(event) {
|
|
|
328
361
|
}
|
|
329
362
|
|
|
330
363
|
//#endregion
|
|
331
|
-
//#region
|
|
364
|
+
//#region src/Resolvers/Query.ts
|
|
332
365
|
/**
|
|
333
366
|
* Resolves a single query parameter from the URL of a router event
|
|
334
367
|
* @param name - The name of the query parameter to resolve
|
|
@@ -352,7 +385,7 @@ function resolveQueryParams(event) {
|
|
|
352
385
|
}
|
|
353
386
|
|
|
354
387
|
//#endregion
|
|
355
|
-
//#region
|
|
388
|
+
//#region src/Resolvers/Headers.ts
|
|
356
389
|
/**
|
|
357
390
|
* Retrieves a specific header value from the request
|
|
358
391
|
* @param {string} header - The name of the header to retrieve
|
|
@@ -372,7 +405,7 @@ function getRequestHeaders(event) {
|
|
|
372
405
|
}
|
|
373
406
|
|
|
374
407
|
//#endregion
|
|
375
|
-
//#region
|
|
408
|
+
//#region src/Services/Metadata/MetadataResolver.ts
|
|
376
409
|
/**
|
|
377
410
|
* Class responsible for resolving metadata for route handlers.
|
|
378
411
|
*/
|
|
@@ -450,7 +483,7 @@ var MetadataResolver = class {
|
|
|
450
483
|
};
|
|
451
484
|
|
|
452
485
|
//#endregion
|
|
453
|
-
//#region
|
|
486
|
+
//#region src/Services/ErrorHandler/ErrorHandlerProvider.ts
|
|
454
487
|
/**
|
|
455
488
|
* Abstract class representing an error handler provider
|
|
456
489
|
* Provides a common interface for different error handler implementations
|
|
@@ -461,7 +494,7 @@ var MetadataResolver = class {
|
|
|
461
494
|
var ErrorHandlerProvider = class {};
|
|
462
495
|
|
|
463
496
|
//#endregion
|
|
464
|
-
//#region
|
|
497
|
+
//#region src/Services/Middleware/GlobalMiddlewareRegistry.ts
|
|
465
498
|
/**
|
|
466
499
|
* Manages global middleware registration and retrieval
|
|
467
500
|
*
|
|
@@ -470,7 +503,7 @@ var ErrorHandlerProvider = class {};
|
|
|
470
503
|
* retrieving them in a standardized format.
|
|
471
504
|
*/
|
|
472
505
|
var GlobalMiddlewareRegistry = class {
|
|
473
|
-
fMiddlewares = new Set();
|
|
506
|
+
fMiddlewares = /* @__PURE__ */ new Set();
|
|
474
507
|
/**
|
|
475
508
|
* Retrieves all registered global middleware configurations
|
|
476
509
|
*
|
|
@@ -499,7 +532,8 @@ var GlobalMiddlewareRegistry = class {
|
|
|
499
532
|
};
|
|
500
533
|
|
|
501
534
|
//#endregion
|
|
502
|
-
//#region
|
|
535
|
+
//#region src/Services/Router/RequestHandler.ts
|
|
536
|
+
var import_decorate$16 = __toESM(require_decorate());
|
|
503
537
|
/**
|
|
504
538
|
* Handles HTTP requests by preparing and executing route handlers with their associated middlewares
|
|
505
539
|
*
|
|
@@ -564,40 +598,46 @@ var RequestHandler = class {
|
|
|
564
598
|
*/
|
|
565
599
|
async handleRequest(request, route) {
|
|
566
600
|
try {
|
|
567
|
-
const { instance, propertyName, actions, args, middlewares
|
|
568
|
-
|
|
569
|
-
|
|
601
|
+
const { instance, propertyName, actions = [], args = [], middlewares = {
|
|
602
|
+
beforeMiddlewares: [],
|
|
603
|
+
afterMiddlewares: []
|
|
604
|
+
} } = route.data;
|
|
605
|
+
let fakeResponse = new FastResponse(void 0, { headers: { "Content-Type": request.headers.get("Content-Type") ?? "application/json" } });
|
|
606
|
+
if (middlewares.beforeMiddlewares.length > 0) for await (const hook of middlewares.beforeMiddlewares) try {
|
|
570
607
|
const hookResponse = await hook.middleware.onRequest?.(request, fakeResponse, {
|
|
571
608
|
middlewareArgs: hook.args,
|
|
572
609
|
methodArgs: args
|
|
573
610
|
});
|
|
574
611
|
if (hookResponse instanceof Response) return hookResponse;
|
|
575
612
|
} catch (error_) {
|
|
576
|
-
this.gContainer.get(ErrorHandlerProvider).handleError(error_);
|
|
613
|
+
const error = this.gContainer.get(ErrorHandlerProvider).handleError(error_);
|
|
614
|
+
if (error instanceof Response) return error;
|
|
577
615
|
}
|
|
578
616
|
for (const action of actions) {
|
|
579
617
|
const actionResponse = action.handler(request, fakeResponse);
|
|
580
618
|
if (actionResponse !== null) fakeResponse = this.processOverrideResponse(actionResponse, fakeResponse);
|
|
581
619
|
}
|
|
582
|
-
const resolvedArgs = await this.gMetadataResolver.resolveArgs(args, {
|
|
620
|
+
const resolvedArgs = args.length > 0 ? await this.gMetadataResolver.resolveArgs(args, {
|
|
583
621
|
...route,
|
|
584
622
|
request,
|
|
585
623
|
response: fakeResponse
|
|
586
|
-
});
|
|
624
|
+
}) : [];
|
|
587
625
|
let handlerResponse = instance[propertyName].call(instance, ...resolvedArgs?.map((a) => a.resolved) ?? []);
|
|
588
626
|
if (handlerResponse instanceof Promise) handlerResponse = await handlerResponse;
|
|
589
|
-
for await (const hook of middlewares
|
|
627
|
+
if (middlewares.afterMiddlewares.length > 0) for await (const hook of middlewares.afterMiddlewares) try {
|
|
590
628
|
const hookResponse = await hook.middleware.onResponse?.(request, fakeResponse, handlerResponse);
|
|
591
629
|
if (hookResponse !== null) fakeResponse = this.processOverrideResponse(hookResponse, fakeResponse);
|
|
592
630
|
} catch (error_) {
|
|
593
|
-
this.gContainer.get(ErrorHandlerProvider).handleError(error_);
|
|
631
|
+
const error = this.gContainer.get(ErrorHandlerProvider).handleError(error_);
|
|
632
|
+
if (error instanceof Response) return error;
|
|
594
633
|
}
|
|
595
634
|
const body = fakeResponse?.body ?? JSON.stringify(handlerResponse);
|
|
596
|
-
|
|
597
|
-
status: fakeResponse.status,
|
|
598
|
-
statusText: fakeResponse.statusText,
|
|
635
|
+
const response = new Response(body, {
|
|
636
|
+
status: fakeResponse.status ?? 200,
|
|
637
|
+
statusText: fakeResponse.statusText ?? "OK",
|
|
599
638
|
headers: fakeResponse.headers
|
|
600
639
|
});
|
|
640
|
+
return response;
|
|
601
641
|
} catch (error_) {
|
|
602
642
|
return this.gContainer.get(ErrorHandlerProvider).handleError(error_);
|
|
603
643
|
}
|
|
@@ -615,11 +655,11 @@ var RequestHandler = class {
|
|
|
615
655
|
* @private
|
|
616
656
|
*/
|
|
617
657
|
processOverrideResponse(response, base) {
|
|
618
|
-
let fakeResponse = base ?? new
|
|
619
|
-
if (response != null && response instanceof
|
|
658
|
+
let fakeResponse = base ?? new FastResponse();
|
|
659
|
+
if (response != null && response instanceof FastResponse) return response;
|
|
620
660
|
else if (response !== null) {
|
|
621
661
|
const responseInit = response;
|
|
622
|
-
fakeResponse = new
|
|
662
|
+
fakeResponse = new FastResponse(void 0, {
|
|
623
663
|
status: responseInit?.status ?? fakeResponse.status,
|
|
624
664
|
headers: responseInit?.headers ?? fakeResponse.headers,
|
|
625
665
|
statusText: responseInit?.statusText ?? fakeResponse.statusText
|
|
@@ -628,12 +668,12 @@ var RequestHandler = class {
|
|
|
628
668
|
return fakeResponse;
|
|
629
669
|
}
|
|
630
670
|
};
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
671
|
+
(0, import_decorate$16.default)([Inject(MetadataResolver)], RequestHandler.prototype, "gMetadataResolver", void 0);
|
|
672
|
+
(0, import_decorate$16.default)([Inject(Container)], RequestHandler.prototype, "gContainer", void 0);
|
|
673
|
+
(0, import_decorate$16.default)([Inject(GlobalMiddlewareRegistry)], RequestHandler.prototype, "gGlobalMiddlewareRegistry", void 0);
|
|
634
674
|
|
|
635
675
|
//#endregion
|
|
636
|
-
//#region
|
|
676
|
+
//#region src/Utils/Mine.ts
|
|
637
677
|
const mime = { getType(ext) {
|
|
638
678
|
const types = {
|
|
639
679
|
".html": "text/html",
|
|
@@ -651,7 +691,7 @@ const mime = { getType(ext) {
|
|
|
651
691
|
} };
|
|
652
692
|
|
|
653
693
|
//#endregion
|
|
654
|
-
//#region
|
|
694
|
+
//#region src/Services/Router/StaticRequestHandler.ts
|
|
655
695
|
/**
|
|
656
696
|
* Handles serving static files over HTTP
|
|
657
697
|
*
|
|
@@ -725,7 +765,8 @@ var StaticRequestHandler = class {
|
|
|
725
765
|
};
|
|
726
766
|
|
|
727
767
|
//#endregion
|
|
728
|
-
//#region
|
|
768
|
+
//#region src/Services/HttpServer/HttpServer.ts
|
|
769
|
+
var import_decorate$15 = __toESM(require_decorate());
|
|
729
770
|
/**
|
|
730
771
|
* HTTP server implementation for handling incoming web requests
|
|
731
772
|
*
|
|
@@ -812,13 +853,14 @@ var HttpServer = class {
|
|
|
812
853
|
}
|
|
813
854
|
}
|
|
814
855
|
};
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
856
|
+
(0, import_decorate$15.default)([Inject(Container)], HttpServer.prototype, "gContainer", void 0);
|
|
857
|
+
(0, import_decorate$15.default)([Inject(Router)], HttpServer.prototype, "gRouter", void 0);
|
|
858
|
+
(0, import_decorate$15.default)([Inject(RequestHandler)], HttpServer.prototype, "gRequestHandler", void 0);
|
|
859
|
+
(0, import_decorate$15.default)([Inject(StaticRequestHandler)], HttpServer.prototype, "gStaticRequestHandler", void 0);
|
|
819
860
|
|
|
820
861
|
//#endregion
|
|
821
|
-
//#region
|
|
862
|
+
//#region src/Common/App.ts
|
|
863
|
+
var import_decorate$14 = __toESM(require_decorate());
|
|
822
864
|
/**
|
|
823
865
|
* Represents the main application class.
|
|
824
866
|
*/
|
|
@@ -903,65 +945,14 @@ var App = class {
|
|
|
903
945
|
await this.gPluginsRegistry.init(this);
|
|
904
946
|
}
|
|
905
947
|
};
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
//#endregion
|
|
913
|
-
//#region packages/logger/dist/Providers/index.mjs
|
|
914
|
-
/**
|
|
915
|
-
* Abstract base class for implementing log provider.
|
|
916
|
-
* Providers are responsible for processing and outputting log messages to various destinations.
|
|
917
|
-
* Each appender can be initialized with custom options and handles message processing according to its implementation.
|
|
918
|
-
*
|
|
919
|
-
* @template T - The type of options used to initialize the appender
|
|
920
|
-
*/
|
|
921
|
-
var LoggerProvider = class {};
|
|
922
|
-
const isColorAllowed = () => !process.env.NO_COLOR;
|
|
923
|
-
const colorIfAllowed = (colorFn) => {
|
|
924
|
-
const wrappedFn = (text) => {
|
|
925
|
-
return isColorAllowed() ? colorFn(text) : text;
|
|
926
|
-
};
|
|
927
|
-
return wrappedFn;
|
|
928
|
-
};
|
|
929
|
-
const colors$1 = {
|
|
930
|
-
bold: colorIfAllowed((text) => `\x1B[1m${text}\x1B[0m`),
|
|
931
|
-
green: colorIfAllowed((text) => `\x1B[32m${text}\x1B[39m`),
|
|
932
|
-
yellow: colorIfAllowed((text) => `\x1B[33m${text}\x1B[39m`),
|
|
933
|
-
red: colorIfAllowed((text) => `\x1B[31m${text}\x1B[39m`),
|
|
934
|
-
magentaBright: colorIfAllowed((text) => `\x1B[95m${text}\x1B[39m`),
|
|
935
|
-
cyanBright: colorIfAllowed((text) => `\x1B[96m${text}\x1B[39m`)
|
|
936
|
-
};
|
|
937
|
-
const LOG_LEVEL_COLORS = {
|
|
938
|
-
debug: colors$1.green,
|
|
939
|
-
info: colors$1.bold,
|
|
940
|
-
warn: colors$1.yellow,
|
|
941
|
-
error: colors$1.red
|
|
942
|
-
};
|
|
943
|
-
/**
|
|
944
|
-
* ConsoleProvider class for logging messages to the console.
|
|
945
|
-
*/
|
|
946
|
-
var ConsoleProvider = class extends LoggerProvider {
|
|
947
|
-
/**
|
|
948
|
-
* Initializes the appender with the provided options.
|
|
949
|
-
* This method should be called before using the appender to process messages.
|
|
950
|
-
*/
|
|
951
|
-
initialize() {}
|
|
952
|
-
/**
|
|
953
|
-
* Prints a log message according to the specified format and level.
|
|
954
|
-
* @param message - The log message object containing level, tag, and arguments
|
|
955
|
-
* @protected
|
|
956
|
-
*/
|
|
957
|
-
processMessage(message) {
|
|
958
|
-
const date = message.timestamp ? new Date(message.timestamp) : new Date();
|
|
959
|
-
console[message.level](`%s%s${message?.tag ? "%s" : ""} %s`, LOG_LEVEL_COLORS[message.level](`[${date.toISOString().split("T")[1]?.replace("Z", "")}]`), LOG_LEVEL_COLORS[message.level](`[${message.level.toUpperCase().padEnd(5, " ")}]`), message?.tag ? LOG_LEVEL_COLORS[message.level](`[${message.tag}]`) : "", ...message.args);
|
|
960
|
-
}
|
|
961
|
-
};
|
|
948
|
+
(0, import_decorate$14.default)([Inject(Router)], App.prototype, "gRouter", void 0);
|
|
949
|
+
(0, import_decorate$14.default)([Inject(PluginsRegistry)], App.prototype, "gPluginsRegistry", void 0);
|
|
950
|
+
(0, import_decorate$14.default)([Inject(HttpServer)], App.prototype, "gHttpServer", void 0);
|
|
951
|
+
(0, import_decorate$14.default)([Inject(StaticRequestHandler)], App.prototype, "gStaticRequestHandler", void 0);
|
|
952
|
+
(0, import_decorate$14.default)([InjectOptional(Logger)], App.prototype, "gLogger", void 0);
|
|
962
953
|
|
|
963
954
|
//#endregion
|
|
964
|
-
//#region
|
|
955
|
+
//#region src/Services/Validation/ValidationProvider.ts
|
|
965
956
|
/**
|
|
966
957
|
* Abstract class representing a validation provider
|
|
967
958
|
* Provides a common interface for different validation implementations
|
|
@@ -972,7 +963,7 @@ var ConsoleProvider = class extends LoggerProvider {
|
|
|
972
963
|
var ValidationProvider = class {};
|
|
973
964
|
|
|
974
965
|
//#endregion
|
|
975
|
-
//#region
|
|
966
|
+
//#region src/Services/Validation/StandardSchemaValidationProvider.ts
|
|
976
967
|
/**
|
|
977
968
|
* StandardSchemaValidationProvider implements validation using StandardSchema schema validation
|
|
978
969
|
* @see https://github.com/standard-schema/standard-schema
|
|
@@ -992,7 +983,7 @@ var StandardSchemaValidationProvider = class {
|
|
|
992
983
|
};
|
|
993
984
|
|
|
994
985
|
//#endregion
|
|
995
|
-
//#region
|
|
986
|
+
//#region src/Services/Config/RuntimeConfig.ts
|
|
996
987
|
/**
|
|
997
988
|
* RuntimeConfig class manages the runtime configuration for the Vercube application.
|
|
998
989
|
* This class provides a centralized way to access and modify runtime configuration settings.
|
|
@@ -1020,7 +1011,7 @@ var RuntimeConfig = class {
|
|
|
1020
1011
|
};
|
|
1021
1012
|
|
|
1022
1013
|
//#endregion
|
|
1023
|
-
//#region
|
|
1014
|
+
//#region src/Errors/Http/InternalServerError.ts
|
|
1024
1015
|
/**
|
|
1025
1016
|
* Represents an Internal Server error (HTTP 500).
|
|
1026
1017
|
* @extends {HttpError}
|
|
@@ -1043,7 +1034,8 @@ var InternalServerError = class InternalServerError extends HttpError {
|
|
|
1043
1034
|
};
|
|
1044
1035
|
|
|
1045
1036
|
//#endregion
|
|
1046
|
-
//#region
|
|
1037
|
+
//#region src/Services/ErrorHandler/DefaultErrorHandlerProvider.ts
|
|
1038
|
+
var import_decorate$13 = __toESM(require_decorate());
|
|
1047
1039
|
/**
|
|
1048
1040
|
* Default error handler provider
|
|
1049
1041
|
*
|
|
@@ -1060,15 +1052,15 @@ var DefaultErrorHandlerProvider = class extends ErrorHandlerProvider {
|
|
|
1060
1052
|
handleError(error) {
|
|
1061
1053
|
const _internalError = new InternalServerError(error?.message ?? "Internal server error");
|
|
1062
1054
|
const status = error?.status ?? 500;
|
|
1063
|
-
if (error instanceof HttpError) return new
|
|
1055
|
+
if (error instanceof HttpError) return new FastResponse(JSON.stringify({ ...error }, void 0, 2), { status });
|
|
1064
1056
|
this.gLogger.error(error);
|
|
1065
|
-
return new
|
|
1057
|
+
return new FastResponse(JSON.stringify({ ...error?.cause ?? _internalError }, void 0, 2), { status });
|
|
1066
1058
|
}
|
|
1067
1059
|
};
|
|
1068
|
-
|
|
1060
|
+
(0, import_decorate$13.default)([Inject(Logger)], DefaultErrorHandlerProvider.prototype, "gLogger", void 0);
|
|
1069
1061
|
|
|
1070
1062
|
//#endregion
|
|
1071
|
-
//#region
|
|
1063
|
+
//#region src/Common/Container.ts
|
|
1072
1064
|
/**
|
|
1073
1065
|
* Creates and configures a new dependency injection container for the application.
|
|
1074
1066
|
*
|
|
@@ -1100,7 +1092,7 @@ function createContainer(config) {
|
|
|
1100
1092
|
}
|
|
1101
1093
|
|
|
1102
1094
|
//#endregion
|
|
1103
|
-
//#region
|
|
1095
|
+
//#region src/Utils/InternalUtils.ts
|
|
1104
1096
|
/**
|
|
1105
1097
|
* Generate random hash
|
|
1106
1098
|
* @returns string
|
|
@@ -1112,7 +1104,7 @@ function generateRandomHash() {
|
|
|
1112
1104
|
}
|
|
1113
1105
|
|
|
1114
1106
|
//#endregion
|
|
1115
|
-
//#region
|
|
1107
|
+
//#region src/Config/DefaultConfig.ts
|
|
1116
1108
|
/**
|
|
1117
1109
|
* Default configuration for the Vercube application.
|
|
1118
1110
|
* This configuration serves as the base settings and can be overridden by user configuration.
|
|
@@ -1146,7 +1138,7 @@ const defaultConfig = {
|
|
|
1146
1138
|
};
|
|
1147
1139
|
|
|
1148
1140
|
//#endregion
|
|
1149
|
-
//#region
|
|
1141
|
+
//#region src/Config/Loader.ts
|
|
1150
1142
|
/**
|
|
1151
1143
|
* Loads the configuration object for the application
|
|
1152
1144
|
* @param {ConfigTypes.Config} overrides - The configuration object to load
|
|
@@ -1164,7 +1156,7 @@ async function loadVercubeConfig(overrides) {
|
|
|
1164
1156
|
}
|
|
1165
1157
|
|
|
1166
1158
|
//#endregion
|
|
1167
|
-
//#region
|
|
1159
|
+
//#region src/Common/CreateApp.ts
|
|
1168
1160
|
/**
|
|
1169
1161
|
* Creates and initializes an instance of the App.
|
|
1170
1162
|
*
|
|
@@ -1182,7 +1174,7 @@ async function createApp(cfg) {
|
|
|
1182
1174
|
}
|
|
1183
1175
|
|
|
1184
1176
|
//#endregion
|
|
1185
|
-
//#region
|
|
1177
|
+
//#region src/Config/Config.ts
|
|
1186
1178
|
/**
|
|
1187
1179
|
* Defines a configuration object for the application
|
|
1188
1180
|
* @param {ConfigTypes.Config} config - The configuration object to validate
|
|
@@ -1193,7 +1185,8 @@ function defineConfig(config) {
|
|
|
1193
1185
|
}
|
|
1194
1186
|
|
|
1195
1187
|
//#endregion
|
|
1196
|
-
//#region
|
|
1188
|
+
//#region src/Middleware/ValidationMiddleware.ts
|
|
1189
|
+
var import_decorate$12 = __toESM(require_decorate());
|
|
1197
1190
|
/**
|
|
1198
1191
|
* Middleware for validating request data against a schema
|
|
1199
1192
|
* @class ValidationMiddleware
|
|
@@ -1225,10 +1218,10 @@ var ValidationMiddleware = class {
|
|
|
1225
1218
|
}
|
|
1226
1219
|
}
|
|
1227
1220
|
};
|
|
1228
|
-
|
|
1221
|
+
(0, import_decorate$12.default)([InjectOptional(ValidationProvider)], ValidationMiddleware.prototype, "gValidationProvider", void 0);
|
|
1229
1222
|
|
|
1230
1223
|
//#endregion
|
|
1231
|
-
//#region
|
|
1224
|
+
//#region src/Utils/Utils.ts
|
|
1232
1225
|
/**
|
|
1233
1226
|
* Creates a new metadata context.
|
|
1234
1227
|
* @returns {MetadataTypes.Ctx} The new metadata context.
|
|
@@ -1274,7 +1267,7 @@ function initializeMetadata(target) {
|
|
|
1274
1267
|
}
|
|
1275
1268
|
|
|
1276
1269
|
//#endregion
|
|
1277
|
-
//#region
|
|
1270
|
+
//#region src/Decorators/Http/Body.ts
|
|
1278
1271
|
/**
|
|
1279
1272
|
* @class BodyDecorator
|
|
1280
1273
|
* @extends BaseDecorator<BodyDecoratorOptions>
|
|
@@ -1318,7 +1311,8 @@ function Body(options) {
|
|
|
1318
1311
|
}
|
|
1319
1312
|
|
|
1320
1313
|
//#endregion
|
|
1321
|
-
//#region
|
|
1314
|
+
//#region src/Decorators/Http/Connect.ts
|
|
1315
|
+
var import_decorate$11 = __toESM(require_decorate());
|
|
1322
1316
|
/**
|
|
1323
1317
|
* A decorator class for handling HTTP CONNECT requests.
|
|
1324
1318
|
*
|
|
@@ -1354,9 +1348,9 @@ var ConnectDecorator = class extends BaseDecorator {
|
|
|
1354
1348
|
});
|
|
1355
1349
|
}
|
|
1356
1350
|
};
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1351
|
+
(0, import_decorate$11.default)([Inject(Router)], ConnectDecorator.prototype, "gRouter", void 0);
|
|
1352
|
+
(0, import_decorate$11.default)([Inject(RequestHandler)], ConnectDecorator.prototype, "gRequestHandler", void 0);
|
|
1353
|
+
(0, import_decorate$11.default)([Inject(MetadataResolver)], ConnectDecorator.prototype, "gMetadataResolver", void 0);
|
|
1360
1354
|
/**
|
|
1361
1355
|
* A factory function for creating a ConnectDecorator.
|
|
1362
1356
|
*
|
|
@@ -1371,7 +1365,7 @@ function Connect(path) {
|
|
|
1371
1365
|
}
|
|
1372
1366
|
|
|
1373
1367
|
//#endregion
|
|
1374
|
-
//#region
|
|
1368
|
+
//#region src/Decorators/Http/Controller.ts
|
|
1375
1369
|
/**
|
|
1376
1370
|
* A factory function for creating a Controller decorator.
|
|
1377
1371
|
*
|
|
@@ -1392,7 +1386,8 @@ function Controller(path) {
|
|
|
1392
1386
|
}
|
|
1393
1387
|
|
|
1394
1388
|
//#endregion
|
|
1395
|
-
//#region
|
|
1389
|
+
//#region src/Decorators/Http/Delete.ts
|
|
1390
|
+
var import_decorate$10 = __toESM(require_decorate());
|
|
1396
1391
|
/**
|
|
1397
1392
|
* A decorator class for handling HTTP DELETE requests.
|
|
1398
1393
|
*
|
|
@@ -1430,9 +1425,9 @@ var DeleteDecorator = class extends BaseDecorator {
|
|
|
1430
1425
|
});
|
|
1431
1426
|
}
|
|
1432
1427
|
};
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1428
|
+
(0, import_decorate$10.default)([Inject(Router)], DeleteDecorator.prototype, "gRouter", void 0);
|
|
1429
|
+
(0, import_decorate$10.default)([Inject(RequestHandler)], DeleteDecorator.prototype, "gRequestHandler", void 0);
|
|
1430
|
+
(0, import_decorate$10.default)([Inject(MetadataResolver)], DeleteDecorator.prototype, "gMetadataResolver", void 0);
|
|
1436
1431
|
/**
|
|
1437
1432
|
* A factory function for creating a DeleteDecorator.
|
|
1438
1433
|
*
|
|
@@ -1447,7 +1442,8 @@ function Delete(path) {
|
|
|
1447
1442
|
}
|
|
1448
1443
|
|
|
1449
1444
|
//#endregion
|
|
1450
|
-
//#region
|
|
1445
|
+
//#region src/Decorators/Http/Get.ts
|
|
1446
|
+
var import_decorate$9 = __toESM(require_decorate());
|
|
1451
1447
|
/**
|
|
1452
1448
|
* A decorator class for handling HTTP GET requests.
|
|
1453
1449
|
*
|
|
@@ -1485,9 +1481,9 @@ var GetDecorator = class extends BaseDecorator {
|
|
|
1485
1481
|
});
|
|
1486
1482
|
}
|
|
1487
1483
|
};
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1484
|
+
(0, import_decorate$9.default)([Inject(Router)], GetDecorator.prototype, "gRouter", void 0);
|
|
1485
|
+
(0, import_decorate$9.default)([Inject(RequestHandler)], GetDecorator.prototype, "gRequestHandler", void 0);
|
|
1486
|
+
(0, import_decorate$9.default)([Inject(MetadataResolver)], GetDecorator.prototype, "gMetadataResolver", void 0);
|
|
1491
1487
|
/**
|
|
1492
1488
|
* A decorator function for handling HTTP GET requests.
|
|
1493
1489
|
*
|
|
@@ -1502,7 +1498,8 @@ function Get(path) {
|
|
|
1502
1498
|
}
|
|
1503
1499
|
|
|
1504
1500
|
//#endregion
|
|
1505
|
-
//#region
|
|
1501
|
+
//#region src/Decorators/Http/Head.ts
|
|
1502
|
+
var import_decorate$8 = __toESM(require_decorate());
|
|
1506
1503
|
/**
|
|
1507
1504
|
* A decorator class for handling HTTP HEAD requests.
|
|
1508
1505
|
*
|
|
@@ -1540,9 +1537,9 @@ var HeadDecorator = class extends BaseDecorator {
|
|
|
1540
1537
|
});
|
|
1541
1538
|
}
|
|
1542
1539
|
};
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1540
|
+
(0, import_decorate$8.default)([Inject(Router)], HeadDecorator.prototype, "gRouter", void 0);
|
|
1541
|
+
(0, import_decorate$8.default)([Inject(RequestHandler)], HeadDecorator.prototype, "gRequestHandler", void 0);
|
|
1542
|
+
(0, import_decorate$8.default)([Inject(MetadataResolver)], HeadDecorator.prototype, "gMetadataResolver", void 0);
|
|
1546
1543
|
/**
|
|
1547
1544
|
* A factory function for creating a HeadDecorator.
|
|
1548
1545
|
*
|
|
@@ -1557,7 +1554,7 @@ function Head(path) {
|
|
|
1557
1554
|
}
|
|
1558
1555
|
|
|
1559
1556
|
//#endregion
|
|
1560
|
-
//#region
|
|
1557
|
+
//#region src/Decorators/Http/Header.ts
|
|
1561
1558
|
/**
|
|
1562
1559
|
* A decorator class for handling HTTP header parameters.
|
|
1563
1560
|
*
|
|
@@ -1599,7 +1596,7 @@ function Header(name) {
|
|
|
1599
1596
|
}
|
|
1600
1597
|
|
|
1601
1598
|
//#endregion
|
|
1602
|
-
//#region
|
|
1599
|
+
//#region src/Decorators/Http/Headers.ts
|
|
1603
1600
|
/**
|
|
1604
1601
|
* This class is responsible for managing headers decorator.
|
|
1605
1602
|
*
|
|
@@ -1638,7 +1635,8 @@ function Headers$1() {
|
|
|
1638
1635
|
}
|
|
1639
1636
|
|
|
1640
1637
|
//#endregion
|
|
1641
|
-
//#region
|
|
1638
|
+
//#region src/Decorators/Http/Options.ts
|
|
1639
|
+
var import_decorate$7 = __toESM(require_decorate());
|
|
1642
1640
|
/**
|
|
1643
1641
|
* A decorator class for handling HTTP OPTIONS requests.
|
|
1644
1642
|
*
|
|
@@ -1676,9 +1674,9 @@ var OptionsDecorator = class extends BaseDecorator {
|
|
|
1676
1674
|
});
|
|
1677
1675
|
}
|
|
1678
1676
|
};
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1677
|
+
(0, import_decorate$7.default)([Inject(Router)], OptionsDecorator.prototype, "gRouter", void 0);
|
|
1678
|
+
(0, import_decorate$7.default)([Inject(RequestHandler)], OptionsDecorator.prototype, "gRequestHandler", void 0);
|
|
1679
|
+
(0, import_decorate$7.default)([Inject(MetadataResolver)], OptionsDecorator.prototype, "gMetadataResolver", void 0);
|
|
1682
1680
|
/**
|
|
1683
1681
|
* A factory function for creating an OptionsDecorator.
|
|
1684
1682
|
*
|
|
@@ -1693,7 +1691,8 @@ function Options(path) {
|
|
|
1693
1691
|
}
|
|
1694
1692
|
|
|
1695
1693
|
//#endregion
|
|
1696
|
-
//#region
|
|
1694
|
+
//#region src/Decorators/Http/Param.ts
|
|
1695
|
+
var import_decorate$6 = __toESM(require_decorate());
|
|
1697
1696
|
/**
|
|
1698
1697
|
* This class is responsible for managing parameter decorators.
|
|
1699
1698
|
*
|
|
@@ -1721,7 +1720,7 @@ var ParamDecorator = class extends BaseDecorator {
|
|
|
1721
1720
|
});
|
|
1722
1721
|
}
|
|
1723
1722
|
};
|
|
1724
|
-
|
|
1723
|
+
(0, import_decorate$6.default)([Inject(MetadataResolver)], ParamDecorator.prototype, "gMetadataResolver", void 0);
|
|
1725
1724
|
/**
|
|
1726
1725
|
* A factory function for creating a ParamDecorator.
|
|
1727
1726
|
*
|
|
@@ -1738,7 +1737,8 @@ function Param(name) {
|
|
|
1738
1737
|
}
|
|
1739
1738
|
|
|
1740
1739
|
//#endregion
|
|
1741
|
-
//#region
|
|
1740
|
+
//#region src/Decorators/Http/Patch.ts
|
|
1741
|
+
var import_decorate$5 = __toESM(require_decorate());
|
|
1742
1742
|
/**
|
|
1743
1743
|
* A decorator class for handling HTTP PATCH requests.
|
|
1744
1744
|
*
|
|
@@ -1774,9 +1774,9 @@ var PatchDecorator = class extends BaseDecorator {
|
|
|
1774
1774
|
});
|
|
1775
1775
|
}
|
|
1776
1776
|
};
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1777
|
+
(0, import_decorate$5.default)([Inject(Router)], PatchDecorator.prototype, "gRouter", void 0);
|
|
1778
|
+
(0, import_decorate$5.default)([Inject(RequestHandler)], PatchDecorator.prototype, "gRequestHandler", void 0);
|
|
1779
|
+
(0, import_decorate$5.default)([Inject(MetadataResolver)], PatchDecorator.prototype, "gMetadataResolver", void 0);
|
|
1780
1780
|
/**
|
|
1781
1781
|
* A factory function for creating a PatchDecorator.
|
|
1782
1782
|
*
|
|
@@ -1791,7 +1791,8 @@ function Patch(path) {
|
|
|
1791
1791
|
}
|
|
1792
1792
|
|
|
1793
1793
|
//#endregion
|
|
1794
|
-
//#region
|
|
1794
|
+
//#region src/Decorators/Http/Post.ts
|
|
1795
|
+
var import_decorate$4 = __toESM(require_decorate());
|
|
1795
1796
|
/**
|
|
1796
1797
|
* A decorator class for handling HTTP POST requests.
|
|
1797
1798
|
*
|
|
@@ -1829,9 +1830,9 @@ var PostDecorator = class extends BaseDecorator {
|
|
|
1829
1830
|
});
|
|
1830
1831
|
}
|
|
1831
1832
|
};
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1833
|
+
(0, import_decorate$4.default)([Inject(Router)], PostDecorator.prototype, "gRouter", void 0);
|
|
1834
|
+
(0, import_decorate$4.default)([Inject(MetadataResolver)], PostDecorator.prototype, "gMetadataResolver", void 0);
|
|
1835
|
+
(0, import_decorate$4.default)([Inject(RequestHandler)], PostDecorator.prototype, "gRequestHandler", void 0);
|
|
1835
1836
|
/**
|
|
1836
1837
|
* A factory function for creating a PostDecorator.
|
|
1837
1838
|
*
|
|
@@ -1846,7 +1847,8 @@ function Post(path) {
|
|
|
1846
1847
|
}
|
|
1847
1848
|
|
|
1848
1849
|
//#endregion
|
|
1849
|
-
//#region
|
|
1850
|
+
//#region src/Decorators/Http/Put.ts
|
|
1851
|
+
var import_decorate$3 = __toESM(require_decorate());
|
|
1850
1852
|
/**
|
|
1851
1853
|
* A decorator class for handling HTTP PUT requests.
|
|
1852
1854
|
*
|
|
@@ -1884,9 +1886,9 @@ var PutDecorator = class extends BaseDecorator {
|
|
|
1884
1886
|
});
|
|
1885
1887
|
}
|
|
1886
1888
|
};
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1889
|
+
(0, import_decorate$3.default)([Inject(Router)], PutDecorator.prototype, "gRouter", void 0);
|
|
1890
|
+
(0, import_decorate$3.default)([Inject(RequestHandler)], PutDecorator.prototype, "gRequestHandler", void 0);
|
|
1891
|
+
(0, import_decorate$3.default)([Inject(MetadataResolver)], PutDecorator.prototype, "gMetadataResolver", void 0);
|
|
1890
1892
|
/**
|
|
1891
1893
|
* A factory function for creating a PutDecorator.
|
|
1892
1894
|
*
|
|
@@ -1901,7 +1903,7 @@ function Put(path) {
|
|
|
1901
1903
|
}
|
|
1902
1904
|
|
|
1903
1905
|
//#endregion
|
|
1904
|
-
//#region
|
|
1906
|
+
//#region src/Decorators/Http/QueryParam.ts
|
|
1905
1907
|
/**
|
|
1906
1908
|
* This class is responsible for managing query parameter decorators.
|
|
1907
1909
|
*
|
|
@@ -1950,7 +1952,7 @@ function QueryParam(options) {
|
|
|
1950
1952
|
}
|
|
1951
1953
|
|
|
1952
1954
|
//#endregion
|
|
1953
|
-
//#region
|
|
1955
|
+
//#region src/Decorators/Http/QueryParams.ts
|
|
1954
1956
|
/**
|
|
1955
1957
|
* This class is responsible for managing query parameters decorators.
|
|
1956
1958
|
*
|
|
@@ -1999,7 +2001,7 @@ function QueryParams(options) {
|
|
|
1999
2001
|
}
|
|
2000
2002
|
|
|
2001
2003
|
//#endregion
|
|
2002
|
-
//#region
|
|
2004
|
+
//#region src/Decorators/Http/Request.ts
|
|
2003
2005
|
/**
|
|
2004
2006
|
* This class is responsible for managing request decorators.
|
|
2005
2007
|
*
|
|
@@ -2038,7 +2040,7 @@ function Request() {
|
|
|
2038
2040
|
}
|
|
2039
2041
|
|
|
2040
2042
|
//#endregion
|
|
2041
|
-
//#region
|
|
2043
|
+
//#region src/Decorators/Http/Response.ts
|
|
2042
2044
|
/**
|
|
2043
2045
|
* This class is responsible for managing response decorators.
|
|
2044
2046
|
*
|
|
@@ -2077,7 +2079,8 @@ function Response$1() {
|
|
|
2077
2079
|
}
|
|
2078
2080
|
|
|
2079
2081
|
//#endregion
|
|
2080
|
-
//#region
|
|
2082
|
+
//#region src/Decorators/Http/Trace.ts
|
|
2083
|
+
var import_decorate$2 = __toESM(require_decorate());
|
|
2081
2084
|
/**
|
|
2082
2085
|
* A decorator class for handling HTTP TRACE requests.
|
|
2083
2086
|
*
|
|
@@ -2115,9 +2118,9 @@ var TraceDecorator = class extends BaseDecorator {
|
|
|
2115
2118
|
});
|
|
2116
2119
|
}
|
|
2117
2120
|
};
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
+
(0, import_decorate$2.default)([Inject(Router)], TraceDecorator.prototype, "gRouter", void 0);
|
|
2122
|
+
(0, import_decorate$2.default)([Inject(RequestHandler)], TraceDecorator.prototype, "gRequestHandler", void 0);
|
|
2123
|
+
(0, import_decorate$2.default)([Inject(MetadataResolver)], TraceDecorator.prototype, "gMetadataResolver", void 0);
|
|
2121
2124
|
/**
|
|
2122
2125
|
* A factory function for creating a TraceDecorator.
|
|
2123
2126
|
*
|
|
@@ -2132,7 +2135,7 @@ function Trace(path) {
|
|
|
2132
2135
|
}
|
|
2133
2136
|
|
|
2134
2137
|
//#endregion
|
|
2135
|
-
//#region
|
|
2138
|
+
//#region src/Decorators/Http/SetHeader.ts
|
|
2136
2139
|
/**
|
|
2137
2140
|
* A decorator that sets a header on the response.
|
|
2138
2141
|
* @extends {BaseDecorator<SetHeaderDecoratorOptions>}
|
|
@@ -2167,7 +2170,7 @@ function SetHeader(key, value) {
|
|
|
2167
2170
|
}
|
|
2168
2171
|
|
|
2169
2172
|
//#endregion
|
|
2170
|
-
//#region
|
|
2173
|
+
//#region src/Decorators/Http/Status.ts
|
|
2171
2174
|
/**
|
|
2172
2175
|
|
|
2173
2176
|
* A decorator that sets a status on the response.
|
|
@@ -2205,7 +2208,7 @@ function Status(code) {
|
|
|
2205
2208
|
}
|
|
2206
2209
|
|
|
2207
2210
|
//#endregion
|
|
2208
|
-
//#region
|
|
2211
|
+
//#region src/Decorators/Http/Redirect.ts
|
|
2209
2212
|
var RedirectDecorator = class extends BaseDecorator {
|
|
2210
2213
|
/**
|
|
2211
2214
|
|
|
@@ -2222,7 +2225,7 @@ var RedirectDecorator = class extends BaseDecorator {
|
|
|
2222
2225
|
initializeMetadata(this.prototype);
|
|
2223
2226
|
const method = initializeMetadataMethod(this.prototype, this.propertyName);
|
|
2224
2227
|
method.actions.push({ handler: () => {
|
|
2225
|
-
return new
|
|
2228
|
+
return new FastResponse(void 0, {
|
|
2226
2229
|
status: this.options.code,
|
|
2227
2230
|
headers: { "Location": this.options.location }
|
|
2228
2231
|
});
|
|
@@ -2248,7 +2251,7 @@ function Redirect(location, code = 301) {
|
|
|
2248
2251
|
}
|
|
2249
2252
|
|
|
2250
2253
|
//#endregion
|
|
2251
|
-
//#region
|
|
2254
|
+
//#region src/Decorators/Http/Middleware.ts
|
|
2252
2255
|
/**
|
|
2253
2256
|
* Decorator that applies middleware to a class or method
|
|
2254
2257
|
* @param middleware - The middleware class to apply
|
|
@@ -2284,7 +2287,7 @@ function Middleware(middleware, opts) {
|
|
|
2284
2287
|
}
|
|
2285
2288
|
|
|
2286
2289
|
//#endregion
|
|
2287
|
-
//#region
|
|
2290
|
+
//#region src/Decorators/Http/MultipartFormData.ts
|
|
2288
2291
|
/**
|
|
2289
2292
|
* @class MultipartFormDataDecorator
|
|
2290
2293
|
* @extends BaseDecorator<MultipartFormDataOptions>
|
|
@@ -2325,7 +2328,8 @@ function MultipartFormData() {
|
|
|
2325
2328
|
}
|
|
2326
2329
|
|
|
2327
2330
|
//#endregion
|
|
2328
|
-
//#region
|
|
2331
|
+
//#region src/Decorators/Http/Session.ts
|
|
2332
|
+
var import_decorate$1 = __toESM(require_decorate());
|
|
2329
2333
|
/**
|
|
2330
2334
|
* This class is responsible for managing session decorators.
|
|
2331
2335
|
*
|
|
@@ -2357,7 +2361,7 @@ var SessionDecorator = class extends BaseDecorator {
|
|
|
2357
2361
|
});
|
|
2358
2362
|
}
|
|
2359
2363
|
};
|
|
2360
|
-
|
|
2364
|
+
(0, import_decorate$1.default)([Inject(RuntimeConfig)], SessionDecorator.prototype, "gRuntimeConfig", void 0);
|
|
2361
2365
|
/**
|
|
2362
2366
|
* A factory function for creating a SessionDecorator.
|
|
2363
2367
|
*
|
|
@@ -2371,7 +2375,8 @@ function Session() {
|
|
|
2371
2375
|
}
|
|
2372
2376
|
|
|
2373
2377
|
//#endregion
|
|
2374
|
-
//#region
|
|
2378
|
+
//#region src/Decorators/Hooks/Listen.ts
|
|
2379
|
+
var import_decorate = __toESM(require_decorate());
|
|
2375
2380
|
/**
|
|
2376
2381
|
* This class is responsible for managing cache decorator.
|
|
2377
2382
|
*/
|
|
@@ -2392,7 +2397,7 @@ var ListenDecorator = class extends BaseDecorator {
|
|
|
2392
2397
|
this.gHooksService.off(this.fHook);
|
|
2393
2398
|
}
|
|
2394
2399
|
};
|
|
2395
|
-
|
|
2400
|
+
(0, import_decorate.default)([Inject(HooksService)], ListenDecorator.prototype, "gHooksService", void 0);
|
|
2396
2401
|
/**
|
|
2397
2402
|
* This decorator stores metadata about hook listeners. It can be later used along with function
|
|
2398
2403
|
* applyEventListeners() to automatically register all listeners.
|
|
@@ -2405,7 +2410,7 @@ function Listen(hookType) {
|
|
|
2405
2410
|
}
|
|
2406
2411
|
|
|
2407
2412
|
//#endregion
|
|
2408
|
-
//#region
|
|
2413
|
+
//#region src/Services/Plugins/BasePlugin.ts
|
|
2409
2414
|
/**
|
|
2410
2415
|
* Represents a Plugin.
|
|
2411
2416
|
*/
|
|
@@ -2423,14 +2428,14 @@ var BasePlugin = class {
|
|
|
2423
2428
|
};
|
|
2424
2429
|
|
|
2425
2430
|
//#endregion
|
|
2426
|
-
//#region
|
|
2431
|
+
//#region src/Services/Middleware/BaseMiddleware.ts
|
|
2427
2432
|
/**
|
|
2428
2433
|
* BaseMiddleware class that serves as a base for all middleware implementations.
|
|
2429
2434
|
*/
|
|
2430
2435
|
var BaseMiddleware = class {};
|
|
2431
2436
|
|
|
2432
2437
|
//#endregion
|
|
2433
|
-
//#region
|
|
2438
|
+
//#region src/Errors/Http/ForbiddenError.ts
|
|
2434
2439
|
/**
|
|
2435
2440
|
* Represents a Forbidden error (HTTP 403).
|
|
2436
2441
|
* @extends {HttpError}
|
|
@@ -2453,7 +2458,7 @@ var ForbiddenError = class ForbiddenError extends HttpError {
|
|
|
2453
2458
|
};
|
|
2454
2459
|
|
|
2455
2460
|
//#endregion
|
|
2456
|
-
//#region
|
|
2461
|
+
//#region src/Errors/Http/MethodNotAllowedError.ts
|
|
2457
2462
|
/**
|
|
2458
2463
|
* Represents a Method Not Allowed error (HTTP 405).
|
|
2459
2464
|
* @extends {HttpError}
|
|
@@ -2476,7 +2481,7 @@ var MethodNotAllowedError = class MethodNotAllowedError extends HttpError {
|
|
|
2476
2481
|
};
|
|
2477
2482
|
|
|
2478
2483
|
//#endregion
|
|
2479
|
-
//#region
|
|
2484
|
+
//#region src/Errors/Http/NotAcceptableError.ts
|
|
2480
2485
|
/**
|
|
2481
2486
|
* Represents a Not Acceptable error (HTTP 406).
|
|
2482
2487
|
* @extends {HttpError}
|
|
@@ -2499,7 +2504,7 @@ var NotAcceptableError = class NotAcceptableError extends HttpError {
|
|
|
2499
2504
|
};
|
|
2500
2505
|
|
|
2501
2506
|
//#endregion
|
|
2502
|
-
//#region
|
|
2507
|
+
//#region src/Errors/Http/NotFoundError.ts
|
|
2503
2508
|
/**
|
|
2504
2509
|
* Represents a Not Found error (HTTP 404).
|
|
2505
2510
|
* @extends {HttpError}
|
|
@@ -2522,7 +2527,7 @@ var NotFoundError = class NotFoundError extends HttpError {
|
|
|
2522
2527
|
};
|
|
2523
2528
|
|
|
2524
2529
|
//#endregion
|
|
2525
|
-
//#region
|
|
2530
|
+
//#region src/Errors/Http/UnauthorizedError.ts
|
|
2526
2531
|
/**
|
|
2527
2532
|
* Represents an Unauthorized error (HTTP 401).
|
|
2528
2533
|
* @extends {HttpError}
|
|
@@ -2545,7 +2550,7 @@ var UnauthorizedError = class UnauthorizedError extends HttpError {
|
|
|
2545
2550
|
};
|
|
2546
2551
|
|
|
2547
2552
|
//#endregion
|
|
2548
|
-
//#region
|
|
2553
|
+
//#region src/Types/HttpTypes.ts
|
|
2549
2554
|
let HTTPStatus = /* @__PURE__ */ function(HTTPStatus$1) {
|
|
2550
2555
|
HTTPStatus$1[HTTPStatus$1["CONTINUE"] = 100] = "CONTINUE";
|
|
2551
2556
|
HTTPStatus$1[HTTPStatus$1["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
@@ -2612,4 +2617,4 @@ let HTTPStatus = /* @__PURE__ */ function(HTTPStatus$1) {
|
|
|
2612
2617
|
}({});
|
|
2613
2618
|
|
|
2614
2619
|
//#endregion
|
|
2615
|
-
export { App, BadRequestError, BaseMiddleware, BasePlugin, Body, Connect, Controller, Delete, ErrorHandlerProvider, ForbiddenError, Get, GlobalMiddlewareRegistry, HTTPStatus, Head, Header, Headers$1 as Headers, HooksService, HttpError, HttpServer, InternalServerError, Listen, MetadataResolver, MethodNotAllowedError, Middleware, MultipartFormData, NotAcceptableError, NotFoundError, Options, Param, Patch, Post, Put, QueryParam, QueryParams, Redirect, Request, Response$1 as Response, Session, SetHeader, Status, Trace, UnauthorizedError, createApp, createMetadataCtx, createMetadataMethod, defineConfig, initializeMetadata, initializeMetadataMethod, loadVercubeConfig };
|
|
2620
|
+
export { App, BadRequestError, BaseMiddleware, BasePlugin, Body, Connect, Controller, Delete, ErrorHandlerProvider, FastResponse, ForbiddenError, Get, GlobalMiddlewareRegistry, HTTPStatus, Head, Header, Headers$1 as Headers, HooksService, HttpError, HttpServer, InternalServerError, Listen, MetadataResolver, MethodNotAllowedError, Middleware, MultipartFormData, NotAcceptableError, NotFoundError, Options, Param, Patch, Post, Put, QueryParam, QueryParams, Redirect, Request, Response$1 as Response, Router, Session, SetHeader, Status, Trace, UnauthorizedError, createApp, createMetadataCtx, createMetadataMethod, defineConfig, initializeMetadata, initializeMetadataMethod, loadVercubeConfig };
|