@vercube/core 0.0.1 → 0.0.2-beta.1

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.cjs CHANGED
@@ -34,8 +34,8 @@ const __vercube_logger = __toESM(require("@vercube/logger"));
34
34
  const c12 = __toESM(require("c12"));
35
35
  const defu = __toESM(require("defu"));
36
36
 
37
- //#region node_modules/.pnpm/@oxc-project+runtime@0.63.0/node_modules/@oxc-project/runtime/src/helpers/decorate.js
38
- var require_decorate = __commonJS({ "node_modules/.pnpm/@oxc-project+runtime@0.63.0/node_modules/@oxc-project/runtime/src/helpers/decorate.js"(exports, module) {
37
+ //#region node_modules/.pnpm/@oxc-project+runtime@0.65.0/node_modules/@oxc-project/runtime/src/helpers/decorate.js
38
+ var require_decorate = __commonJS({ "node_modules/.pnpm/@oxc-project+runtime@0.65.0/node_modules/@oxc-project/runtime/src/helpers/decorate.js"(exports, module) {
39
39
  function __decorate(decorators, target, key, desc) {
40
40
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
41
41
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -86,6 +86,9 @@ var PluginsRegistry = class {
86
86
 
87
87
  //#endregion
88
88
  //#region packages/core/src/Services/Hooks/HooksService.ts
89
+ /**
90
+ * This class is responsible for managing events.
91
+ */
89
92
  var HooksService = class {
90
93
  fLastId = 0;
91
94
  fHandlers = new Map();
@@ -201,6 +204,13 @@ var RouterAfterInitHook = class {};
201
204
 
202
205
  //#endregion
203
206
  //#region packages/core/src/Services/Router/Router.ts
207
+ /**
208
+ * Router service responsible for managing application routes
209
+ *
210
+ * This class provides functionality to initialize the router,
211
+ * register routes, and resolve incoming requests to their
212
+ * appropriate handlers.
213
+ */
204
214
  var Router = class {
205
215
  /**
206
216
  * Service for triggering application hooks
@@ -250,12 +260,27 @@ var Router = class {
250
260
 
251
261
  //#endregion
252
262
  //#region packages/core/src/Resolvers/RouterParam.ts
263
+ /**
264
+ * Resolves a router parameter from the event object
265
+ * @param param - The parameter name to resolve from the router event
266
+ * @param event - The router event object containing parameters
267
+ * @returns The resolved parameter value if it exists, null otherwise
268
+ * @example
269
+ * ```typescript
270
+ * const value = resolveRouterParam('id', routerEvent);
271
+ * // Returns the 'id' parameter value from routerEvent.params or null
272
+ * ```
273
+ */
253
274
  function resolveRouterParam(param, event) {
254
275
  return event.params?.[param] ?? null;
255
276
  }
256
277
 
257
278
  //#endregion
258
279
  //#region packages/core/src/Errors/HttpError.ts
280
+ /**
281
+ * Represents an HTTP error.
282
+ * @extends {Error}
283
+ */
259
284
  var HttpError = class HttpError extends Error {
260
285
  /**
261
286
  * The HTTP status code associated with the error.
@@ -278,6 +303,10 @@ var HttpError = class HttpError extends Error {
278
303
 
279
304
  //#endregion
280
305
  //#region packages/core/src/Errors/Http/BadRequestError.ts
306
+ /**
307
+ * Represents a Bad Request error (HTTP 400).
308
+ * @extends {HttpError}
309
+ */
281
310
  var BadRequestError = class BadRequestError extends HttpError {
282
311
  /**
283
312
  * The name of the error.
@@ -298,6 +327,26 @@ var BadRequestError = class BadRequestError extends HttpError {
298
327
 
299
328
  //#endregion
300
329
  //#region packages/core/src/Resolvers/Body.ts
330
+ /**
331
+ * Resolves and parses the request body from a RouterEvent.
332
+ *
333
+ * @param {RouterTypes.RouterEvent} event - The router event containing the request to process
334
+ * @returns {Promise<unknown>} A promise that resolves to:
335
+ * - The parsed JSON body if the request contains valid JSON
336
+ * - undefined if the request body is empty
337
+ * @throws {BadRequestError} If the request body contains invalid JSON
338
+ *
339
+ * @example
340
+ * const body = await resolveRequestBody(event);
341
+ * if (body) {
342
+ * // Process the parsed body
343
+ * }
344
+ *
345
+ * @remarks
346
+ * - Currently only supports JSON content type
347
+ * - Returns undefined for empty request bodies
348
+ * - Throws BadRequestError for malformed JSON
349
+ */
301
350
  async function resolveRequestBody(event) {
302
351
  const text = await event.request.text();
303
352
  if (!text) return void 0;
@@ -310,10 +359,21 @@ async function resolveRequestBody(event) {
310
359
 
311
360
  //#endregion
312
361
  //#region packages/core/src/Resolvers/Query.ts
362
+ /**
363
+ * Resolves a single query parameter from the URL of a router event
364
+ * @param name - The name of the query parameter to resolve
365
+ * @param event - The router event containing the request URL
366
+ * @returns The value of the query parameter if found, null otherwise
367
+ */
313
368
  function resolveQueryParam(name, event) {
314
369
  const url = new URL(event.request.url);
315
370
  return url.searchParams.get(name);
316
371
  }
372
+ /**
373
+ * Resolves all query parameters from the URL of a router event
374
+ * @param event - The router event containing the request URL
375
+ * @returns An object containing all query parameters as key-value pairs
376
+ */
317
377
  function resolveQueryParams(event) {
318
378
  const url = new URL(event.request.url);
319
379
  const params = {};
@@ -323,15 +383,29 @@ function resolveQueryParams(event) {
323
383
 
324
384
  //#endregion
325
385
  //#region packages/core/src/Resolvers/Headers.ts
386
+ /**
387
+ * Retrieves a specific header value from the request
388
+ * @param {string} header - The name of the header to retrieve
389
+ * @param {RouterTypes.RouterEvent} event - The router event containing the request
390
+ * @returns {string | null} The header value if found, null otherwise
391
+ */
326
392
  function getRequestHeader(header, event) {
327
393
  return event.request.headers.get(header);
328
394
  }
395
+ /**
396
+ * Retrieves all headers from the request
397
+ * @param {RouterTypes.RouterEvent} event - The router event containing the request
398
+ * @returns {Headers} The complete Headers object from the request
399
+ */
329
400
  function getRequestHeaders(event) {
330
401
  return event.request.headers;
331
402
  }
332
403
 
333
404
  //#endregion
334
405
  //#region packages/core/src/Services/Metadata/MetadataResolver.ts
406
+ /**
407
+ * Class responsible for resolving metadata for route handlers.
408
+ */
335
409
  var MetadataResolver = class {
336
410
  /**
337
411
  * Resolves the URL for a given instance and path.
@@ -407,10 +481,24 @@ var MetadataResolver = class {
407
481
 
408
482
  //#endregion
409
483
  //#region packages/core/src/Services/ErrorHandler/ErrorHandlerProvider.ts
484
+ /**
485
+ * Abstract class representing an error handler provider
486
+ * Provides a common interface for different error handler implementations
487
+ *
488
+ * @abstract
489
+ * @class ErrorHandlerProvider
490
+ */
410
491
  var ErrorHandlerProvider = class {};
411
492
 
412
493
  //#endregion
413
494
  //#region packages/core/src/Services/Middleware/GlobalMiddlewareRegistry.ts
495
+ /**
496
+ * Manages global middleware registration and retrieval
497
+ *
498
+ * This class provides functionality to register and retrieve global middleware
499
+ * configurations. It allows for adding middleware with specific options and
500
+ * retrieving them in a standardized format.
501
+ */
414
502
  var GlobalMiddlewareRegistry = class {
415
503
  fMiddlewares = new Set();
416
504
  /**
@@ -442,13 +530,20 @@ var GlobalMiddlewareRegistry = class {
442
530
 
443
531
  //#endregion
444
532
  //#region packages/core/src/Services/Router/RequestHandler.ts
533
+ /**
534
+ * Handles HTTP requests by preparing and executing route handlers with their associated middlewares
535
+ *
536
+ * The RequestHandler is responsible for:
537
+ * - Preparing route handlers with their metadata
538
+ * - Executing middleware chains (before and after)
539
+ * - Processing request/response lifecycle
540
+ * - Error handling during request processing
541
+ */
445
542
  var RequestHandler = class {
446
543
  /** Resolver for extracting metadata from controller classes and methods */
447
544
  gMetadataResolver;
448
545
  /** DI container for resolving dependencies */
449
546
  gContainer;
450
- /** Provider for handling errors during request processing */
451
- gErrorHandlerProvider;
452
547
  gGlobalMiddlewareRegistry;
453
548
  /**
454
549
  * Prepares a route handler by resolving its metadata and middlewares
@@ -507,8 +602,8 @@ var RequestHandler = class {
507
602
  methodArgs: args
508
603
  });
509
604
  if (hookResponse instanceof Response) return hookResponse;
510
- } catch (error) {
511
- return this.gErrorHandlerProvider.handleError(error);
605
+ } catch (error_) {
606
+ this.gContainer.get(ErrorHandlerProvider).handleError(error_);
512
607
  }
513
608
  for (const action of actions) {
514
609
  const actionResponse = action.handler(request, fakeResponse);
@@ -524,8 +619,8 @@ var RequestHandler = class {
524
619
  for await (const hook of middlewares?.afterMiddlewares ?? []) try {
525
620
  const hookResponse = await hook.middleware.onResponse?.(request, fakeResponse, handlerResponse);
526
621
  if (hookResponse !== null) fakeResponse = this.processOverrideResponse(hookResponse, fakeResponse);
527
- } catch (error) {
528
- return this.gErrorHandlerProvider.handleError(error);
622
+ } catch (error_) {
623
+ this.gContainer.get(ErrorHandlerProvider).handleError(error_);
529
624
  }
530
625
  const body = fakeResponse?.body ?? JSON.stringify(handlerResponse);
531
626
  return new Response(body, {
@@ -534,7 +629,7 @@ var RequestHandler = class {
534
629
  headers: fakeResponse.headers
535
630
  });
536
631
  } catch (error_) {
537
- return this.gErrorHandlerProvider.handleError(error_);
632
+ return this.gContainer.get(ErrorHandlerProvider).handleError(error_);
538
633
  }
539
634
  }
540
635
  /**
@@ -565,7 +660,6 @@ var RequestHandler = class {
565
660
  };
566
661
  (0, import_decorate.default)([(0, __vercube_di.Inject)(MetadataResolver)], RequestHandler.prototype, "gMetadataResolver", void 0);
567
662
  (0, import_decorate.default)([(0, __vercube_di.Inject)(__vercube_di.Container)], RequestHandler.prototype, "gContainer", void 0);
568
- (0, import_decorate.default)([(0, __vercube_di.Inject)(ErrorHandlerProvider)], RequestHandler.prototype, "gErrorHandlerProvider", void 0);
569
663
  (0, import_decorate.default)([(0, __vercube_di.Inject)(GlobalMiddlewareRegistry)], RequestHandler.prototype, "gGlobalMiddlewareRegistry", void 0);
570
664
 
571
665
  //#endregion
@@ -588,6 +682,15 @@ const mime = { getType(ext) {
588
682
 
589
683
  //#endregion
590
684
  //#region packages/core/src/Services/Router/StaticRequestHandler.ts
685
+ /**
686
+ * Handles serving static files over HTTP
687
+ *
688
+ * The StaticRequestHandler is responsible for:
689
+ * - Serving static files from configured directories
690
+ * - Setting appropriate content types and headers
691
+ * - Handling caching and ETags
692
+ * - Processing GET requests for static assets
693
+ */
591
694
  var StaticRequestHandler = class {
592
695
  /**
593
696
  * The options for the static server
@@ -653,7 +756,19 @@ var StaticRequestHandler = class {
653
756
 
654
757
  //#endregion
655
758
  //#region packages/core/src/Services/HttpServer/HttpServer.ts
759
+ /**
760
+ * HTTP server implementation for handling incoming web requests
761
+ *
762
+ * This class is responsible for:
763
+ * - Initializing and managing the HTTP server
764
+ * - Routing incoming requests to appropriate handlers
765
+ * - Processing HTTP responses
766
+ */
656
767
  var HttpServer = class {
768
+ /**
769
+ * DI container for resolving dependencies
770
+ */
771
+ gContainer;
657
772
  /**
658
773
  * Router service for resolving routes
659
774
  */
@@ -663,10 +778,6 @@ var HttpServer = class {
663
778
  */
664
779
  gRequestHandler;
665
780
  /**
666
- * Error handler provider for managing error responses
667
- */
668
- gErrorHandlerProvider;
669
- /**
670
781
  * Static server for serving static files
671
782
  */
672
783
  gStaticRequestHandler;
@@ -684,10 +795,10 @@ var HttpServer = class {
684
795
  const { port, host } = config.server ?? {};
685
796
  this.fServer = (0, srvx.serve)({
686
797
  bun: { error: (error) => {
687
- return this.gErrorHandlerProvider.handleError(error);
798
+ return this.gContainer.get(ErrorHandlerProvider).handleError(error);
688
799
  } },
689
800
  deno: { onError: (error) => {
690
- return this.gErrorHandlerProvider.handleError(error);
801
+ return this.gContainer.get(ErrorHandlerProvider).handleError(error);
691
802
  } },
692
803
  hostname: host,
693
804
  port,
@@ -727,17 +838,20 @@ var HttpServer = class {
727
838
  }
728
839
  return this.gRequestHandler.handleRequest(request, route);
729
840
  } catch (error) {
730
- return this.gErrorHandlerProvider.handleError(error);
841
+ return this.gContainer.get(ErrorHandlerProvider).handleError(error);
731
842
  }
732
843
  }
733
844
  };
845
+ (0, import_decorate.default)([(0, __vercube_di.Inject)(__vercube_di.Container)], HttpServer.prototype, "gContainer", void 0);
734
846
  (0, import_decorate.default)([(0, __vercube_di.Inject)(Router)], HttpServer.prototype, "gRouter", void 0);
735
847
  (0, import_decorate.default)([(0, __vercube_di.Inject)(RequestHandler)], HttpServer.prototype, "gRequestHandler", void 0);
736
- (0, import_decorate.default)([(0, __vercube_di.Inject)(ErrorHandlerProvider)], HttpServer.prototype, "gErrorHandlerProvider", void 0);
737
848
  (0, import_decorate.default)([(0, __vercube_di.Inject)(StaticRequestHandler)], HttpServer.prototype, "gStaticRequestHandler", void 0);
738
849
 
739
850
  //#endregion
740
851
  //#region packages/core/src/Common/App.ts
852
+ /**
853
+ * Represents the main application class.
854
+ */
741
855
  var App = class {
742
856
  gRouter;
743
857
  gPluginsRegistry;
@@ -814,6 +928,13 @@ var App = class {
814
928
 
815
929
  //#endregion
816
930
  //#region packages/logger/dist/Providers/index.mjs
931
+ /**
932
+ * Abstract base class for implementing log provider.
933
+ * Providers are responsible for processing and outputting log messages to various destinations.
934
+ * Each appender can be initialized with custom options and handles message processing according to its implementation.
935
+ *
936
+ * @template T - The type of options used to initialize the appender
937
+ */
817
938
  var LoggerProvider = class {};
818
939
  const isColorAllowed = () => !process.env.NO_COLOR;
819
940
  const colorIfAllowed = (colorFn) => {
@@ -836,6 +957,9 @@ const LOG_LEVEL_COLORS = {
836
957
  warn: colors.yellow,
837
958
  error: colors.red
838
959
  };
960
+ /**
961
+ * ConsoleProvider class for logging messages to the console.
962
+ */
839
963
  var ConsoleProvider = class extends LoggerProvider {
840
964
  /**
841
965
  * Initializes the appender with the provided options.
@@ -855,10 +979,23 @@ var ConsoleProvider = class extends LoggerProvider {
855
979
 
856
980
  //#endregion
857
981
  //#region packages/core/src/Services/Validation/ValidationProvider.ts
982
+ /**
983
+ * Abstract class representing a validation provider
984
+ * Provides a common interface for different validation implementations
985
+ *
986
+ * @abstract
987
+ * @class ValidationProvider
988
+ */
858
989
  var ValidationProvider = class {};
859
990
 
860
991
  //#endregion
861
992
  //#region packages/core/src/Services/Validation/StandardSchemaValidationProvider.ts
993
+ /**
994
+ * StandardSchemaValidationProvider implements validation using StandardSchema schema validation
995
+ * @see https://github.com/standard-schema/standard-schema
996
+ * @class
997
+ * @implements {ValidationProvider}
998
+ */
862
999
  var StandardSchemaValidationProvider = class {
863
1000
  /**
864
1001
  * Validates data against a schema
@@ -873,6 +1010,10 @@ var StandardSchemaValidationProvider = class {
873
1010
 
874
1011
  //#endregion
875
1012
  //#region packages/core/src/Services/Config/RuntimeConfig.ts
1013
+ /**
1014
+ * RuntimeConfig class manages the runtime configuration for the Vercube application.
1015
+ * This class provides a centralized way to access and modify runtime configuration settings.
1016
+ */
876
1017
  var RuntimeConfig = class {
877
1018
  /**
878
1019
  * Private field to store the runtime configuration object.
@@ -897,6 +1038,10 @@ var RuntimeConfig = class {
897
1038
 
898
1039
  //#endregion
899
1040
  //#region packages/core/src/Errors/Http/InternalServerError.ts
1041
+ /**
1042
+ * Represents an Internal Server error (HTTP 500).
1043
+ * @extends {HttpError}
1044
+ */
900
1045
  var InternalServerError = class InternalServerError extends HttpError {
901
1046
  /**
902
1047
  * The name of the error.
@@ -916,26 +1061,36 @@ var InternalServerError = class InternalServerError extends HttpError {
916
1061
 
917
1062
  //#endregion
918
1063
  //#region packages/core/src/Services/ErrorHandler/DefaultErrorHandlerProvider.ts
1064
+ /**
1065
+ * Default error handler provider
1066
+ *
1067
+ * @class DefaultErrorHandlerProvider
1068
+ */
919
1069
  var DefaultErrorHandlerProvider = class extends ErrorHandlerProvider {
920
1070
  gLogger;
921
1071
  /**
922
1072
  * Handles an error that occurred during request processing
923
- *
1073
+ *
924
1074
  * @param error - The Error object containing error details
925
1075
  * @returns Promise<Response> | Response - The response to be sent to the client
926
1076
  */
927
1077
  handleError(error) {
928
- const _internalError = new InternalServerError();
1078
+ const _internalError = new InternalServerError(error?.message ?? "Internal server error");
929
1079
  const status = error?.status ?? 500;
930
1080
  if (error instanceof HttpError) return new Response(JSON.stringify({ ...error }, void 0, 2), { status });
931
1081
  this.gLogger.error(error);
932
- return new Response(JSON.stringify({ ...error?.cause ?? _internalError.cause }, void 0, 2), { status });
1082
+ return new Response(JSON.stringify({ ...error?.cause ?? _internalError }, void 0, 2), { status });
933
1083
  }
934
1084
  };
935
1085
  (0, import_decorate.default)([(0, __vercube_di.Inject)(__vercube_logger.Logger)], DefaultErrorHandlerProvider.prototype, "gLogger", void 0);
936
1086
 
937
1087
  //#endregion
938
1088
  //#region packages/core/src/Common/Container.ts
1089
+ /**
1090
+ * Creates and configures a new dependency injection container for the application.
1091
+ *
1092
+ * @returns {Container} A configured dependency injection container.
1093
+ */
939
1094
  function createContainer(config) {
940
1095
  const container = new __vercube_di.Container();
941
1096
  container.bindInstance(__vercube_di.Container, container);
@@ -963,6 +1118,10 @@ function createContainer(config) {
963
1118
 
964
1119
  //#endregion
965
1120
  //#region packages/core/src/Utils/InternalUtils.ts
1121
+ /**
1122
+ * Generate random hash
1123
+ * @returns string
1124
+ */
966
1125
  function generateRandomHash() {
967
1126
  const hashByPerformance = Math.floor(Date.now() * 1e3).toString(16);
968
1127
  const hashByMath = () => (Math.floor(Math.random() * 16777215) | 1048576).toString(16);
@@ -971,6 +1130,10 @@ function generateRandomHash() {
971
1130
 
972
1131
  //#endregion
973
1132
  //#region packages/core/src/Config/DefaultConfig.ts
1133
+ /**
1134
+ * Default configuration for the Vercube application.
1135
+ * This configuration serves as the base settings and can be overridden by user configuration.
1136
+ */
974
1137
  const defaultConfig = {
975
1138
  logLevel: "debug",
976
1139
  production: false,
@@ -1001,6 +1164,11 @@ const defaultConfig = {
1001
1164
 
1002
1165
  //#endregion
1003
1166
  //#region packages/core/src/Config/Loader.ts
1167
+ /**
1168
+ * Loads the configuration object for the application
1169
+ * @param {ConfigTypes.Config} overrides - The configuration object to load
1170
+ * @returns {ConfigTypes.Config} The loaded configuration object
1171
+ */
1004
1172
  async function loadVercubeConfig(overrides) {
1005
1173
  const config = await (0, c12.loadConfig)({
1006
1174
  name: "vercube",
@@ -1014,6 +1182,11 @@ async function loadVercubeConfig(overrides) {
1014
1182
 
1015
1183
  //#endregion
1016
1184
  //#region packages/core/src/Common/CreateApp.ts
1185
+ /**
1186
+ * Creates and initializes an instance of the App.
1187
+ *
1188
+ * @returns {Promise<App>} A promise that resolves to an instance of the App.
1189
+ */
1017
1190
  async function createApp(cfg) {
1018
1191
  const config = await loadVercubeConfig(cfg);
1019
1192
  const container = createContainer(config);
@@ -1027,12 +1200,26 @@ async function createApp(cfg) {
1027
1200
 
1028
1201
  //#endregion
1029
1202
  //#region packages/core/src/Config/Config.ts
1203
+ /**
1204
+ * Defines a configuration object for the application
1205
+ * @param {ConfigTypes.Config} config - The configuration object to validate
1206
+ * @returns {ConfigTypes.Config} The validated configuration object
1207
+ */
1030
1208
  function defineConfig(config) {
1031
1209
  return config;
1032
1210
  }
1033
1211
 
1034
1212
  //#endregion
1035
1213
  //#region packages/core/src/Middleware/ValidationMiddleware.ts
1214
+ /**
1215
+ * Middleware for validating request data against a schema
1216
+ * @class ValidationMiddleware
1217
+ * @implements {BaseMiddleware}
1218
+ * @description Validates incoming request data against a provided schema
1219
+ * @example
1220
+ * const middleware = new ValidationMiddleware();
1221
+ * await middleware.use(event, { schema: myValidationSchema });
1222
+ */
1036
1223
  var ValidationMiddleware = class {
1037
1224
  gValidationProvider;
1038
1225
  /**
@@ -1059,6 +1246,10 @@ var ValidationMiddleware = class {
1059
1246
 
1060
1247
  //#endregion
1061
1248
  //#region packages/core/src/Utils/Utils.ts
1249
+ /**
1250
+ * Creates a new metadata context.
1251
+ * @returns {MetadataTypes.Ctx} The new metadata context.
1252
+ */
1062
1253
  function createMetadataCtx() {
1063
1254
  return {
1064
1255
  __controller: { path: "" },
@@ -1066,6 +1257,10 @@ function createMetadataCtx() {
1066
1257
  __methods: {}
1067
1258
  };
1068
1259
  }
1260
+ /**
1261
+ * Creates a new metadata method.
1262
+ * @returns {MetadataTypes.Method} The new metadata method.
1263
+ */
1069
1264
  function createMetadataMethod() {
1070
1265
  return {
1071
1266
  req: null,
@@ -1075,10 +1270,19 @@ function createMetadataMethod() {
1075
1270
  actions: []
1076
1271
  };
1077
1272
  }
1273
+ /**
1274
+ * Initializes the metadata for a given target and property name.
1275
+ * @param {any} target - The target to initialize metadata for.
1276
+ * @param {string} propertyName - The name of the property to initialize metadata for.
1277
+ */
1078
1278
  function initializeMetadataMethod(target, propertyName) {
1079
1279
  if (!target.__metadata.__methods[propertyName]) target.__metadata.__methods[propertyName] = createMetadataMethod();
1080
1280
  return target.__metadata.__methods[propertyName];
1081
1281
  }
1282
+ /**
1283
+ * Initializes the metadata for a given target.
1284
+ * @param {any} target - The target to initialize metadata for.
1285
+ */
1082
1286
  function initializeMetadata(target) {
1083
1287
  if (!target.__metadata) target.__metadata = createMetadataCtx();
1084
1288
  if (!target.__metadata.__methods) target.__metadata.__methods = {};
@@ -1088,6 +1292,12 @@ function initializeMetadata(target) {
1088
1292
 
1089
1293
  //#endregion
1090
1294
  //#region packages/core/src/Decorators/Http/Body.ts
1295
+ /**
1296
+ * @class BodyDecorator
1297
+ * @extends BaseDecorator<BodyDecoratorOptions>
1298
+ *
1299
+ * A decorator class that handles the metadata for HTTP request bodies.
1300
+ */
1091
1301
  var BodyDecorator = class extends __vercube_di.BaseDecorator {
1092
1302
  /**
1093
1303
  * @method created
@@ -1111,12 +1321,30 @@ var BodyDecorator = class extends __vercube_di.BaseDecorator {
1111
1321
  });
1112
1322
  }
1113
1323
  };
1324
+ /**
1325
+ * @function Body
1326
+ * @returns {Function} A decorator function that registers the BodyDecorator.
1327
+ *
1328
+ * This function creates and returns a decorator that can be used to annotate
1329
+ * a parameter in a method to indicate that it should be populated with the
1330
+ * body of an HTTP request. The decorator uses the BodyDecorator class to
1331
+ * handle the metadata associated with the parameter.
1332
+ */
1114
1333
  function Body(options) {
1115
1334
  return (0, __vercube_di.createDecorator)(BodyDecorator, options);
1116
1335
  }
1117
1336
 
1118
1337
  //#endregion
1119
1338
  //#region packages/core/src/Decorators/Http/Connect.ts
1339
+ /**
1340
+ * A decorator class for handling HTTP CONNECT requests.
1341
+ *
1342
+ * This class extends the BaseDecorator and is used to register CONNECT routes
1343
+ * with the Router. It also resolves metadata for the route handler
1344
+ * using the MetadataResolver.
1345
+ *
1346
+ * @extends {BaseDecorator<ConnectDecoratorOptions>}
1347
+ */
1120
1348
  var ConnectDecorator = class extends __vercube_di.BaseDecorator {
1121
1349
  gRouter;
1122
1350
  gRequestHandler;
@@ -1146,12 +1374,30 @@ var ConnectDecorator = class extends __vercube_di.BaseDecorator {
1146
1374
  (0, import_decorate.default)([(0, __vercube_di.Inject)(Router)], ConnectDecorator.prototype, "gRouter", void 0);
1147
1375
  (0, import_decorate.default)([(0, __vercube_di.Inject)(RequestHandler)], ConnectDecorator.prototype, "gRequestHandler", void 0);
1148
1376
  (0, import_decorate.default)([(0, __vercube_di.Inject)(MetadataResolver)], ConnectDecorator.prototype, "gMetadataResolver", void 0);
1377
+ /**
1378
+ * A factory function for creating a ConnectDecorator.
1379
+ *
1380
+ * This function returns a decorator function that can be used to annotate
1381
+ * a method with CONNECT route information.
1382
+ *
1383
+ * @param {string} path - The path for the CONNECT route.
1384
+ * @return {Function} The decorator function.
1385
+ */
1149
1386
  function Connect(path) {
1150
1387
  return (0, __vercube_di.createDecorator)(ConnectDecorator, { path });
1151
1388
  }
1152
1389
 
1153
1390
  //#endregion
1154
1391
  //#region packages/core/src/Decorators/Http/Controller.ts
1392
+ /**
1393
+ * A factory function for creating a Controller decorator.
1394
+ *
1395
+ * This function returns a decorator function that can be used to annotate
1396
+ * a class with controller metadata, including the base path for the controller.
1397
+ *
1398
+ * @param {string} path - The base path for the controller.
1399
+ * @return {Function} The decorator function.
1400
+ */
1155
1401
  function Controller(path) {
1156
1402
  return function internalDecorator(target) {
1157
1403
  const meta = initializeMetadata(target.prototype);
@@ -1164,6 +1410,15 @@ function Controller(path) {
1164
1410
 
1165
1411
  //#endregion
1166
1412
  //#region packages/core/src/Decorators/Http/Delete.ts
1413
+ /**
1414
+ * A decorator class for handling HTTP DELETE requests.
1415
+ *
1416
+ * This class extends the BaseDecorator and is used to register DELETE routes
1417
+ * with the Router. It also resolves metadata for the route handler
1418
+ * using the MetadataResolver.
1419
+ *
1420
+ * @extends {BaseDecorator<DeleteDecoratorOptions>}
1421
+ */
1167
1422
  var DeleteDecorator = class extends __vercube_di.BaseDecorator {
1168
1423
  gRouter;
1169
1424
  gRequestHandler;
@@ -1195,12 +1450,30 @@ var DeleteDecorator = class extends __vercube_di.BaseDecorator {
1195
1450
  (0, import_decorate.default)([(0, __vercube_di.Inject)(Router)], DeleteDecorator.prototype, "gRouter", void 0);
1196
1451
  (0, import_decorate.default)([(0, __vercube_di.Inject)(RequestHandler)], DeleteDecorator.prototype, "gRequestHandler", void 0);
1197
1452
  (0, import_decorate.default)([(0, __vercube_di.Inject)(MetadataResolver)], DeleteDecorator.prototype, "gMetadataResolver", void 0);
1453
+ /**
1454
+ * A factory function for creating a DeleteDecorator.
1455
+ *
1456
+ * This function returns a decorator function that can be used to annotate
1457
+ * a method with DELETE route information.
1458
+ *
1459
+ * @param {string} path - The path for the DELETE route.
1460
+ * @return {Function} The decorator function.
1461
+ */
1198
1462
  function Delete(path) {
1199
1463
  return (0, __vercube_di.createDecorator)(DeleteDecorator, { path });
1200
1464
  }
1201
1465
 
1202
1466
  //#endregion
1203
1467
  //#region packages/core/src/Decorators/Http/Get.ts
1468
+ /**
1469
+ * A decorator class for handling HTTP GET requests.
1470
+ *
1471
+ * This class extends the BaseDecorator and is used to register GET routes
1472
+ * with the Router. It also resolves metadata for the route handler
1473
+ * using the MetadataResolver.
1474
+ *
1475
+ * @extends {BaseDecorator<GetDecoratorOptions>}
1476
+ */
1204
1477
  var GetDecorator = class extends __vercube_di.BaseDecorator {
1205
1478
  gRouter;
1206
1479
  gRequestHandler;
@@ -1232,12 +1505,30 @@ var GetDecorator = class extends __vercube_di.BaseDecorator {
1232
1505
  (0, import_decorate.default)([(0, __vercube_di.Inject)(Router)], GetDecorator.prototype, "gRouter", void 0);
1233
1506
  (0, import_decorate.default)([(0, __vercube_di.Inject)(RequestHandler)], GetDecorator.prototype, "gRequestHandler", void 0);
1234
1507
  (0, import_decorate.default)([(0, __vercube_di.Inject)(MetadataResolver)], GetDecorator.prototype, "gMetadataResolver", void 0);
1508
+ /**
1509
+ * A decorator function for handling HTTP GET requests.
1510
+ *
1511
+ * This function creates an instance of the GetDecorator class and registers
1512
+ * the GET route with the specified path.
1513
+ *
1514
+ * @param {string} path - The path for the GET route.
1515
+ * @returns {Function} - The decorator function.
1516
+ */
1235
1517
  function Get(path) {
1236
1518
  return (0, __vercube_di.createDecorator)(GetDecorator, { path });
1237
1519
  }
1238
1520
 
1239
1521
  //#endregion
1240
1522
  //#region packages/core/src/Decorators/Http/Head.ts
1523
+ /**
1524
+ * A decorator class for handling HTTP HEAD requests.
1525
+ *
1526
+ * This class extends the BaseDecorator and is used to register HEAD routes
1527
+ * with the Router. It also resolves metadata for the route handler
1528
+ * using the MetadataResolver.
1529
+ *
1530
+ * @extends {BaseDecorator<HeadDecoratorOptions>}
1531
+ */
1241
1532
  var HeadDecorator = class extends __vercube_di.BaseDecorator {
1242
1533
  gRouter;
1243
1534
  gRequestHandler;
@@ -1269,12 +1560,30 @@ var HeadDecorator = class extends __vercube_di.BaseDecorator {
1269
1560
  (0, import_decorate.default)([(0, __vercube_di.Inject)(Router)], HeadDecorator.prototype, "gRouter", void 0);
1270
1561
  (0, import_decorate.default)([(0, __vercube_di.Inject)(RequestHandler)], HeadDecorator.prototype, "gRequestHandler", void 0);
1271
1562
  (0, import_decorate.default)([(0, __vercube_di.Inject)(MetadataResolver)], HeadDecorator.prototype, "gMetadataResolver", void 0);
1563
+ /**
1564
+ * A factory function for creating a HeadDecorator.
1565
+ *
1566
+ * This function returns a decorator function that can be used to annotate
1567
+ * a method with HEAD route information.
1568
+ *
1569
+ * @param {string} path - The path for the HEAD route.
1570
+ * @return {Function} The decorator function.
1571
+ */
1272
1572
  function Head(path) {
1273
1573
  return (0, __vercube_di.createDecorator)(HeadDecorator, { path });
1274
1574
  }
1275
1575
 
1276
1576
  //#endregion
1277
1577
  //#region packages/core/src/Decorators/Http/Header.ts
1578
+ /**
1579
+ * A decorator class for handling HTTP header parameters.
1580
+ *
1581
+ * This class extends the BaseDecorator and is used to register header parameters
1582
+ * with the MetadataResolver. It ensures that the metadata for the property is created
1583
+ * and adds the header information to the metadata.
1584
+ *
1585
+ * @extends {BaseDecorator<HeaderDecoratorOptions>}
1586
+ */
1278
1587
  var HeaderDecorator = class extends __vercube_di.BaseDecorator {
1279
1588
  /**
1280
1589
  * Called when the decorator is created.
@@ -1292,12 +1601,31 @@ var HeaderDecorator = class extends __vercube_di.BaseDecorator {
1292
1601
  });
1293
1602
  }
1294
1603
  };
1604
+ /**
1605
+ * A decorator function for handling HTTP header parameters.
1606
+ *
1607
+ * This function creates a HeaderDecorator with the specified name and registers it.
1608
+ * It is used to annotate a parameter in a method to indicate that it should be
1609
+ * populated with the value of a specific HTTP header.
1610
+ *
1611
+ * @param {string} name - The name of the HTTP header to bind to the parameter.
1612
+ * @returns {Function} - A decorator function that registers the HeaderDecorator.
1613
+ */
1295
1614
  function Header(name) {
1296
1615
  return (0, __vercube_di.createDecorator)(HeaderDecorator, { name });
1297
1616
  }
1298
1617
 
1299
1618
  //#endregion
1300
1619
  //#region packages/core/src/Decorators/Http/Headers.ts
1620
+ /**
1621
+ * This class is responsible for managing headers decorator.
1622
+ *
1623
+ * This class extends the BaseDecorator and is used to register headers parameters
1624
+ * with the MetadataResolver. It ensures that the metadata for the property is created
1625
+ * and adds the headers information to the metadata.
1626
+ *
1627
+ * @extends {BaseDecorator<{}>}
1628
+ */
1301
1629
  var HeadersDecorator = class extends __vercube_di.BaseDecorator {
1302
1630
  /**
1303
1631
  * Called when the decorator is created.
@@ -1314,12 +1642,29 @@ var HeadersDecorator = class extends __vercube_di.BaseDecorator {
1314
1642
  });
1315
1643
  }
1316
1644
  };
1645
+ /**
1646
+ * A factory function for creating a HeadersDecorator.
1647
+ *
1648
+ * This function returns a decorator function that can be used to annotate
1649
+ * a method parameter with headers information.
1650
+ *
1651
+ * @return {Function} The decorator function.
1652
+ */
1317
1653
  function Headers$1() {
1318
1654
  return (0, __vercube_di.createDecorator)(HeadersDecorator, {});
1319
1655
  }
1320
1656
 
1321
1657
  //#endregion
1322
1658
  //#region packages/core/src/Decorators/Http/Options.ts
1659
+ /**
1660
+ * A decorator class for handling HTTP OPTIONS requests.
1661
+ *
1662
+ * This class extends the BaseDecorator and is used to register OPTIONS routes
1663
+ * with the Router. It also resolves metadata for the route handler
1664
+ * using the MetadataResolver.
1665
+ *
1666
+ * @extends {BaseDecorator<OptionsDecoratorOptions>}
1667
+ */
1323
1668
  var OptionsDecorator = class extends __vercube_di.BaseDecorator {
1324
1669
  gRouter;
1325
1670
  gRequestHandler;
@@ -1351,12 +1696,30 @@ var OptionsDecorator = class extends __vercube_di.BaseDecorator {
1351
1696
  (0, import_decorate.default)([(0, __vercube_di.Inject)(Router)], OptionsDecorator.prototype, "gRouter", void 0);
1352
1697
  (0, import_decorate.default)([(0, __vercube_di.Inject)(RequestHandler)], OptionsDecorator.prototype, "gRequestHandler", void 0);
1353
1698
  (0, import_decorate.default)([(0, __vercube_di.Inject)(MetadataResolver)], OptionsDecorator.prototype, "gMetadataResolver", void 0);
1699
+ /**
1700
+ * A factory function for creating an OptionsDecorator.
1701
+ *
1702
+ * This function returns a decorator function that can be used to annotate
1703
+ * a method with OPTIONS route information.
1704
+ *
1705
+ * @param {string} path - The path for the OPTIONS route.
1706
+ * @return {Function} The decorator function.
1707
+ */
1354
1708
  function Options(path) {
1355
1709
  return (0, __vercube_di.createDecorator)(OptionsDecorator, { path });
1356
1710
  }
1357
1711
 
1358
1712
  //#endregion
1359
1713
  //#region packages/core/src/Decorators/Http/Param.ts
1714
+ /**
1715
+ * This class is responsible for managing parameter decorators.
1716
+ *
1717
+ * This class extends the BaseDecorator and is used to register parameter information
1718
+ * with the MetadataResolver. It ensures that the metadata for the property is created
1719
+ * and adds the parameter information to the metadata.
1720
+ *
1721
+ * @extends {BaseDecorator<ParamDecoratorOptions>}
1722
+ */
1360
1723
  var ParamDecorator = class extends __vercube_di.BaseDecorator {
1361
1724
  gMetadataResolver;
1362
1725
  /**
@@ -1376,12 +1739,32 @@ var ParamDecorator = class extends __vercube_di.BaseDecorator {
1376
1739
  }
1377
1740
  };
1378
1741
  (0, import_decorate.default)([(0, __vercube_di.Inject)(MetadataResolver)], ParamDecorator.prototype, "gMetadataResolver", void 0);
1742
+ /**
1743
+ * A factory function for creating a ParamDecorator.
1744
+ *
1745
+ * This function returns a decorator function that can be used to annotate
1746
+ * a method parameter with parameter information.
1747
+ *
1748
+ * @param {string} name - The name of the parameter.
1749
+ * @param {Object} [opts] - Optional settings for the parameter.
1750
+ * @param {boolean} [opts.decode=false] - Whether to decode the parameter.
1751
+ * @return {Function} The decorator function.
1752
+ */
1379
1753
  function Param(name) {
1380
1754
  return (0, __vercube_di.createDecorator)(ParamDecorator, { name });
1381
1755
  }
1382
1756
 
1383
1757
  //#endregion
1384
1758
  //#region packages/core/src/Decorators/Http/Patch.ts
1759
+ /**
1760
+ * A decorator class for handling HTTP PATCH requests.
1761
+ *
1762
+ * This class extends the BaseDecorator and is used to register PATCH routes
1763
+ * with the Router. It also resolves metadata for the route handler
1764
+ * using the MetadataResolver.
1765
+ *
1766
+ * @extends {BaseDecorator<PatchDecoratorOptions>}
1767
+ */
1385
1768
  var PatchDecorator = class extends __vercube_di.BaseDecorator {
1386
1769
  gRouter;
1387
1770
  gRequestHandler;
@@ -1411,12 +1794,30 @@ var PatchDecorator = class extends __vercube_di.BaseDecorator {
1411
1794
  (0, import_decorate.default)([(0, __vercube_di.Inject)(Router)], PatchDecorator.prototype, "gRouter", void 0);
1412
1795
  (0, import_decorate.default)([(0, __vercube_di.Inject)(RequestHandler)], PatchDecorator.prototype, "gRequestHandler", void 0);
1413
1796
  (0, import_decorate.default)([(0, __vercube_di.Inject)(MetadataResolver)], PatchDecorator.prototype, "gMetadataResolver", void 0);
1797
+ /**
1798
+ * A factory function for creating a PatchDecorator.
1799
+ *
1800
+ * This function returns a decorator function that can be used to annotate
1801
+ * a method with PATCH route information.
1802
+ *
1803
+ * @param {string} path - The path for the PATCH route.
1804
+ * @return {Function} The decorator function.
1805
+ */
1414
1806
  function Patch(path) {
1415
1807
  return (0, __vercube_di.createDecorator)(PatchDecorator, { path });
1416
1808
  }
1417
1809
 
1418
1810
  //#endregion
1419
1811
  //#region packages/core/src/Decorators/Http/Post.ts
1812
+ /**
1813
+ * A decorator class for handling HTTP POST requests.
1814
+ *
1815
+ * This class extends the BaseDecorator and is used to register POST routes
1816
+ * with the Router. It also resolves metadata for the route handler
1817
+ * using the MetadataResolver.
1818
+ *
1819
+ * @extends {BaseDecorator<PostDecoratorOptions>}
1820
+ */
1420
1821
  var PostDecorator = class extends __vercube_di.BaseDecorator {
1421
1822
  gRouter;
1422
1823
  gMetadataResolver;
@@ -1448,12 +1849,30 @@ var PostDecorator = class extends __vercube_di.BaseDecorator {
1448
1849
  (0, import_decorate.default)([(0, __vercube_di.Inject)(Router)], PostDecorator.prototype, "gRouter", void 0);
1449
1850
  (0, import_decorate.default)([(0, __vercube_di.Inject)(MetadataResolver)], PostDecorator.prototype, "gMetadataResolver", void 0);
1450
1851
  (0, import_decorate.default)([(0, __vercube_di.Inject)(RequestHandler)], PostDecorator.prototype, "gRequestHandler", void 0);
1852
+ /**
1853
+ * A factory function for creating a PostDecorator.
1854
+ *
1855
+ * This function returns a decorator function that can be used to annotate
1856
+ * a method with POST route information.
1857
+ *
1858
+ * @param {string} path - The path for the POST route.
1859
+ * @return {Function} The decorator function.
1860
+ */
1451
1861
  function Post(path) {
1452
1862
  return (0, __vercube_di.createDecorator)(PostDecorator, { path });
1453
1863
  }
1454
1864
 
1455
1865
  //#endregion
1456
1866
  //#region packages/core/src/Decorators/Http/Put.ts
1867
+ /**
1868
+ * A decorator class for handling HTTP PUT requests.
1869
+ *
1870
+ * This class extends the BaseDecorator and is used to register PUT routes
1871
+ * with the Router. It also resolves metadata for the route handler
1872
+ * using the MetadataResolver.
1873
+ *
1874
+ * @extends {BaseDecorator<PutDecoratorOptions>}
1875
+ */
1457
1876
  var PutDecorator = class extends __vercube_di.BaseDecorator {
1458
1877
  gRouter;
1459
1878
  gRequestHandler;
@@ -1485,12 +1904,30 @@ var PutDecorator = class extends __vercube_di.BaseDecorator {
1485
1904
  (0, import_decorate.default)([(0, __vercube_di.Inject)(Router)], PutDecorator.prototype, "gRouter", void 0);
1486
1905
  (0, import_decorate.default)([(0, __vercube_di.Inject)(RequestHandler)], PutDecorator.prototype, "gRequestHandler", void 0);
1487
1906
  (0, import_decorate.default)([(0, __vercube_di.Inject)(MetadataResolver)], PutDecorator.prototype, "gMetadataResolver", void 0);
1907
+ /**
1908
+ * A factory function for creating a PutDecorator.
1909
+ *
1910
+ * This function returns a decorator function that can be used to annotate
1911
+ * a method with PUT route information.
1912
+ *
1913
+ * @param {string} path - The path for the PUT route.
1914
+ * @return {Function} The decorator function.
1915
+ */
1488
1916
  function Put(path) {
1489
1917
  return (0, __vercube_di.createDecorator)(PutDecorator, { path });
1490
1918
  }
1491
1919
 
1492
1920
  //#endregion
1493
1921
  //#region packages/core/src/Decorators/Http/QueryParam.ts
1922
+ /**
1923
+ * This class is responsible for managing query parameter decorators.
1924
+ *
1925
+ * This class extends the BaseDecorator and is used to register query parameter information
1926
+ * with the MetadataResolver. It ensures that the metadata for the property is created
1927
+ * and adds the query parameter information to the metadata.
1928
+ *
1929
+ * @extends {BaseDecorator<QueryDecoratorOptions>}
1930
+ */
1494
1931
  var QueryParamDecorator = class extends __vercube_di.BaseDecorator {
1495
1932
  /**
1496
1933
  * Called when the decorator is created.
@@ -1516,12 +1953,30 @@ var QueryParamDecorator = class extends __vercube_di.BaseDecorator {
1516
1953
  });
1517
1954
  }
1518
1955
  };
1956
+ /**
1957
+ * A factory function for creating a QueryDecorator.
1958
+ *
1959
+ * This function returns a decorator function that can be used to annotate
1960
+ * a method parameter with query parameter information.
1961
+ *
1962
+ * @param {QueryParamDecoratorOptions} options - The options for the decorator.
1963
+ * @return {Function} The decorator function.
1964
+ */
1519
1965
  function QueryParam(options) {
1520
1966
  return (0, __vercube_di.createDecorator)(QueryParamDecorator, options);
1521
1967
  }
1522
1968
 
1523
1969
  //#endregion
1524
1970
  //#region packages/core/src/Decorators/Http/QueryParams.ts
1971
+ /**
1972
+ * This class is responsible for managing query parameters decorators.
1973
+ *
1974
+ * This class extends the BaseDecorator and is used to register query parameters information
1975
+ * with the MetadataResolver. It ensures that the metadata for the property is created
1976
+ * and adds the query parameters information to the metadata.
1977
+ *
1978
+ * @extends {BaseDecorator<QueryDecoratorOptions>}
1979
+ */
1525
1980
  var QueryParamsDecorator = class extends __vercube_di.BaseDecorator {
1526
1981
  /**
1527
1982
  * Called when the decorator is created.
@@ -1547,12 +2002,30 @@ var QueryParamsDecorator = class extends __vercube_di.BaseDecorator {
1547
2002
  });
1548
2003
  }
1549
2004
  };
2005
+ /**
2006
+ * A factory function for creating a QueryParamsDecorator.
2007
+ *
2008
+ * This function returns a decorator function that can be used to annotate
2009
+ * a method parameter with query parameter information.
2010
+ *
2011
+ * @param {QueryParamsDecoratorOptions} options - The options for the decorator.
2012
+ * @return {Function} The decorator function.
2013
+ */
1550
2014
  function QueryParams(options) {
1551
2015
  return (0, __vercube_di.createDecorator)(QueryParamsDecorator, options);
1552
2016
  }
1553
2017
 
1554
2018
  //#endregion
1555
2019
  //#region packages/core/src/Decorators/Http/Request.ts
2020
+ /**
2021
+ * This class is responsible for managing request decorators.
2022
+ *
2023
+ * This class extends the BaseDecorator and is used to register request information
2024
+ * with the MetadataResolver. It ensures that the metadata for the property is created
2025
+ * and adds the request information to the metadata.
2026
+ *
2027
+ * @extends {BaseDecorator<{}>}
2028
+ */
1556
2029
  var RequestDecorator = class extends __vercube_di.BaseDecorator {
1557
2030
  /**
1558
2031
  * Called when the decorator is created.
@@ -1569,12 +2042,29 @@ var RequestDecorator = class extends __vercube_di.BaseDecorator {
1569
2042
  });
1570
2043
  }
1571
2044
  };
2045
+ /**
2046
+ * A factory function for creating a RequestDecorator.
2047
+ *
2048
+ * This function returns a decorator function that can be used to annotate
2049
+ * a method parameter with request information.
2050
+ *
2051
+ * @return {Function} The decorator function.
2052
+ */
1572
2053
  function Request() {
1573
2054
  return (0, __vercube_di.createDecorator)(RequestDecorator, {});
1574
2055
  }
1575
2056
 
1576
2057
  //#endregion
1577
2058
  //#region packages/core/src/Decorators/Http/Response.ts
2059
+ /**
2060
+ * This class is responsible for managing response decorators.
2061
+ *
2062
+ * This class extends the BaseDecorator and is used to register response information
2063
+ * with the MetadataResolver. It ensures that the metadata for the property is created
2064
+ * and adds the response information to the metadata.
2065
+ *
2066
+ * @extends {BaseDecorator<{}>}
2067
+ */
1578
2068
  var ResponseDecorator = class extends __vercube_di.BaseDecorator {
1579
2069
  /**
1580
2070
  * Called when the decorator is created.
@@ -1591,12 +2081,29 @@ var ResponseDecorator = class extends __vercube_di.BaseDecorator {
1591
2081
  });
1592
2082
  }
1593
2083
  };
2084
+ /**
2085
+ * A factory function for creating a ResponseDecorator.
2086
+ *
2087
+ * This function returns a decorator function that can be used to annotate
2088
+ * a method parameter with response information.
2089
+ *
2090
+ * @return {Function} The decorator function.
2091
+ */
1594
2092
  function Response$1() {
1595
2093
  return (0, __vercube_di.createDecorator)(ResponseDecorator, {});
1596
2094
  }
1597
2095
 
1598
2096
  //#endregion
1599
2097
  //#region packages/core/src/Decorators/Http/Trace.ts
2098
+ /**
2099
+ * A decorator class for handling HTTP TRACE requests.
2100
+ *
2101
+ * This class extends the BaseDecorator and is used to register TRACE routes
2102
+ * with the Router. It also resolves metadata for the route handler
2103
+ * using the MetadataResolver.
2104
+ *
2105
+ * @extends {BaseDecorator<TraceDecoratorOptions>}
2106
+ */
1600
2107
  var TraceDecorator = class extends __vercube_di.BaseDecorator {
1601
2108
  gRouter;
1602
2109
  gRequestHandler;
@@ -1628,12 +2135,25 @@ var TraceDecorator = class extends __vercube_di.BaseDecorator {
1628
2135
  (0, import_decorate.default)([(0, __vercube_di.Inject)(Router)], TraceDecorator.prototype, "gRouter", void 0);
1629
2136
  (0, import_decorate.default)([(0, __vercube_di.Inject)(RequestHandler)], TraceDecorator.prototype, "gRequestHandler", void 0);
1630
2137
  (0, import_decorate.default)([(0, __vercube_di.Inject)(MetadataResolver)], TraceDecorator.prototype, "gMetadataResolver", void 0);
2138
+ /**
2139
+ * A factory function for creating a TraceDecorator.
2140
+ *
2141
+ * This function returns a decorator function that can be used to annotate
2142
+ * a method with TRACE route information.
2143
+ *
2144
+ * @param {string} path - The path for the TRACE route.
2145
+ * @return {Function} The decorator function.
2146
+ */
1631
2147
  function Trace(path) {
1632
2148
  return (0, __vercube_di.createDecorator)(TraceDecorator, { path });
1633
2149
  }
1634
2150
 
1635
2151
  //#endregion
1636
2152
  //#region packages/core/src/Decorators/Http/SetHeader.ts
2153
+ /**
2154
+ * A decorator that sets a header on the response.
2155
+ * @extends {BaseDecorator<SetHeaderDecoratorOptions>}
2156
+ */
1637
2157
  var SetHeaderDecorator = class extends __vercube_di.BaseDecorator {
1638
2158
  /**
1639
2159
  * Called when the decorator is created.
@@ -1650,6 +2170,12 @@ var SetHeaderDecorator = class extends __vercube_di.BaseDecorator {
1650
2170
  } });
1651
2171
  }
1652
2172
  };
2173
+ /**
2174
+ * Creates a SetHeader decorator.
2175
+ * @param {string} key - The header key.
2176
+ * @param {string} value - The header value.
2177
+ * @returns {Function} The decorator function.
2178
+ */
1653
2179
  function SetHeader(key, value) {
1654
2180
  return (0, __vercube_di.createDecorator)(SetHeaderDecorator, {
1655
2181
  key,
@@ -1659,6 +2185,13 @@ function SetHeader(key, value) {
1659
2185
 
1660
2186
  //#endregion
1661
2187
  //#region packages/core/src/Decorators/Http/Status.ts
2188
+ /**
2189
+
2190
+ * A decorator that sets a status on the response.
2191
+
2192
+ * @extends {BaseDecorator<StatusDecoratorOptions>}
2193
+
2194
+ */
1662
2195
  var StatusDecorator = class extends __vercube_di.BaseDecorator {
1663
2196
  /**
1664
2197
 
@@ -1675,6 +2208,15 @@ var StatusDecorator = class extends __vercube_di.BaseDecorator {
1675
2208
  method.actions.push({ handler: () => ({ status: this.options.code }) });
1676
2209
  }
1677
2210
  };
2211
+ /**
2212
+
2213
+ * Creates a Status decorator.
2214
+
2215
+ * @param {number} code - The status value.
2216
+
2217
+ * @returns {Function} The decorator function.
2218
+
2219
+ */
1678
2220
  function Status(code) {
1679
2221
  return (0, __vercube_di.createDecorator)(StatusDecorator, { code });
1680
2222
  }
@@ -1704,6 +2246,17 @@ var RedirectDecorator = class extends __vercube_di.BaseDecorator {
1704
2246
  } });
1705
2247
  }
1706
2248
  };
2249
+ /**
2250
+
2251
+ * Creates a Redirect decorator.
2252
+
2253
+ * @param {string} location - The location header value.
2254
+
2255
+ * @param {number} [code=301] - The status code.
2256
+
2257
+ * @returns {Function} The decorator function.
2258
+
2259
+ */
1707
2260
  function Redirect(location, code = 301) {
1708
2261
  return (0, __vercube_di.createDecorator)(RedirectDecorator, {
1709
2262
  location,
@@ -1713,6 +2266,28 @@ function Redirect(location, code = 301) {
1713
2266
 
1714
2267
  //#endregion
1715
2268
  //#region packages/core/src/Decorators/Http/Middleware.ts
2269
+ /**
2270
+ * Decorator that applies middleware to a class or method
2271
+ * @param middleware - The middleware class to apply
2272
+ * @param opts - Optional configuration parameters
2273
+ * @param opts.type - The type of middleware ('before' or 'after')
2274
+ * @param opts.priority - Priority order for middleware execution (default: 999)
2275
+ * @returns A decorator function that can be applied to classes or methods
2276
+ *
2277
+ * @example
2278
+ * ```typescript
2279
+ * @Middleware(AuthMiddleware)
2280
+ * class UserController {
2281
+ * // ...
2282
+ * }
2283
+ *
2284
+ * // Or on a specific method:
2285
+ * @Middleware(ValidationMiddleware, { type: 'before', priority: 1 })
2286
+ * public async createUser() {
2287
+ * // ...
2288
+ * }
2289
+ * ```
2290
+ */
1716
2291
  function Middleware(middleware, opts) {
1717
2292
  return function internalDecorator(target, propertyName) {
1718
2293
  const ctx = propertyName ? target : target.prototype;
@@ -1727,6 +2302,12 @@ function Middleware(middleware, opts) {
1727
2302
 
1728
2303
  //#endregion
1729
2304
  //#region packages/core/src/Decorators/Http/MultipartFormData.ts
2305
+ /**
2306
+ * @class MultipartFormDataDecorator
2307
+ * @extends BaseDecorator<MultipartFormDataOptions>
2308
+ *
2309
+ * A decorator class that handles the metadata for HTTP request bodies.
2310
+ */
1730
2311
  var MultipartFormDataDecorator = class extends __vercube_di.BaseDecorator {
1731
2312
  /**
1732
2313
  * @method created
@@ -1742,12 +2323,35 @@ var MultipartFormDataDecorator = class extends __vercube_di.BaseDecorator {
1742
2323
  });
1743
2324
  }
1744
2325
  };
2326
+ /**
2327
+ * Decorator function that marks a parameter as multipart/form-data request body.
2328
+ * This decorator will automatically parse incoming multipart form data
2329
+ *
2330
+ * @decorator
2331
+ * @returns {Function} A decorator function that can be applied to method parameters
2332
+ *
2333
+ * @example
2334
+ * class UserController {
2335
+ * uploadFile(@MultipartFormData() formData: MyData) {
2336
+ * // Handle multipart form data
2337
+ * }
2338
+ * }
2339
+ */
1745
2340
  function MultipartFormData() {
1746
2341
  return (0, __vercube_di.createDecorator)(MultipartFormDataDecorator, {});
1747
2342
  }
1748
2343
 
1749
2344
  //#endregion
1750
2345
  //#region packages/core/src/Decorators/Http/Session.ts
2346
+ /**
2347
+ * This class is responsible for managing session decorators.
2348
+ *
2349
+ * This class extends the BaseDecorator and is used to register session information
2350
+ * with the MetadataResolver. It ensures that the metadata for the property is created
2351
+ * and adds the session information to the metadata.
2352
+ *
2353
+ * @extends {BaseDecorator<{}>}
2354
+ */
1751
2355
  var SessionDecorator = class extends __vercube_di.BaseDecorator {
1752
2356
  gRuntimeConfig;
1753
2357
  /**
@@ -1771,12 +2375,23 @@ var SessionDecorator = class extends __vercube_di.BaseDecorator {
1771
2375
  }
1772
2376
  };
1773
2377
  (0, import_decorate.default)([(0, __vercube_di.Inject)(RuntimeConfig)], SessionDecorator.prototype, "gRuntimeConfig", void 0);
2378
+ /**
2379
+ * A factory function for creating a SessionDecorator.
2380
+ *
2381
+ * This function returns a decorator function that can be used to annotate
2382
+ * a method parameter with session information.
2383
+ *
2384
+ * @return {Function} The decorator function.
2385
+ */
1774
2386
  function Session() {
1775
2387
  return (0, __vercube_di.createDecorator)(SessionDecorator, {});
1776
2388
  }
1777
2389
 
1778
2390
  //#endregion
1779
2391
  //#region packages/core/src/Decorators/Hooks/Listen.ts
2392
+ /**
2393
+ * This class is responsible for managing cache decorator.
2394
+ */
1780
2395
  var ListenDecorator = class extends __vercube_di.BaseDecorator {
1781
2396
  gHooksService;
1782
2397
  fHook;
@@ -1795,12 +2410,22 @@ var ListenDecorator = class extends __vercube_di.BaseDecorator {
1795
2410
  }
1796
2411
  };
1797
2412
  (0, import_decorate.default)([(0, __vercube_di.Inject)(HooksService)], ListenDecorator.prototype, "gHooksService", void 0);
2413
+ /**
2414
+ * This decorator stores metadata about hook listeners. It can be later used along with function
2415
+ * applyEventListeners() to automatically register all listeners.
2416
+ *
2417
+ * @param hookType hook to listen for
2418
+ * @return decorator function
2419
+ */
1798
2420
  function Listen(hookType) {
1799
2421
  return (0, __vercube_di.createDecorator)(ListenDecorator, { hookType });
1800
2422
  }
1801
2423
 
1802
2424
  //#endregion
1803
2425
  //#region packages/core/src/Services/Plugins/BasePlugin.ts
2426
+ /**
2427
+ * Represents a Plugin.
2428
+ */
1804
2429
  var BasePlugin = class {
1805
2430
  /**
1806
2431
  * The name of the plugin.
@@ -1816,10 +2441,17 @@ var BasePlugin = class {
1816
2441
 
1817
2442
  //#endregion
1818
2443
  //#region packages/core/src/Services/Middleware/BaseMiddleware.ts
2444
+ /**
2445
+ * BaseMiddleware class that serves as a base for all middleware implementations.
2446
+ */
1819
2447
  var BaseMiddleware = class {};
1820
2448
 
1821
2449
  //#endregion
1822
2450
  //#region packages/core/src/Errors/Http/ForbiddenError.ts
2451
+ /**
2452
+ * Represents a Forbidden error (HTTP 403).
2453
+ * @extends {HttpError}
2454
+ */
1823
2455
  var ForbiddenError = class ForbiddenError extends HttpError {
1824
2456
  /**
1825
2457
  * The name of the error.
@@ -1839,6 +2471,10 @@ var ForbiddenError = class ForbiddenError extends HttpError {
1839
2471
 
1840
2472
  //#endregion
1841
2473
  //#region packages/core/src/Errors/Http/MethodNotAllowedError.ts
2474
+ /**
2475
+ * Represents a Method Not Allowed error (HTTP 405).
2476
+ * @extends {HttpError}
2477
+ */
1842
2478
  var MethodNotAllowedError = class MethodNotAllowedError extends HttpError {
1843
2479
  /**
1844
2480
  * The name of the error.
@@ -1858,6 +2494,10 @@ var MethodNotAllowedError = class MethodNotAllowedError extends HttpError {
1858
2494
 
1859
2495
  //#endregion
1860
2496
  //#region packages/core/src/Errors/Http/NotAcceptableError.ts
2497
+ /**
2498
+ * Represents a Not Acceptable error (HTTP 406).
2499
+ * @extends {HttpError}
2500
+ */
1861
2501
  var NotAcceptableError = class NotAcceptableError extends HttpError {
1862
2502
  /**
1863
2503
  * The name of the error.
@@ -1877,6 +2517,10 @@ var NotAcceptableError = class NotAcceptableError extends HttpError {
1877
2517
 
1878
2518
  //#endregion
1879
2519
  //#region packages/core/src/Errors/Http/NotFoundError.ts
2520
+ /**
2521
+ * Represents a Not Found error (HTTP 404).
2522
+ * @extends {HttpError}
2523
+ */
1880
2524
  var NotFoundError = class NotFoundError extends HttpError {
1881
2525
  /**
1882
2526
  * The name of the error.
@@ -1896,6 +2540,10 @@ var NotFoundError = class NotFoundError extends HttpError {
1896
2540
 
1897
2541
  //#endregion
1898
2542
  //#region packages/core/src/Errors/Http/UnauthorizedError.ts
2543
+ /**
2544
+ * Represents an Unauthorized error (HTTP 401).
2545
+ * @extends {HttpError}
2546
+ */
1899
2547
  var UnauthorizedError = class UnauthorizedError extends HttpError {
1900
2548
  /**
1901
2549
  * The name of the error.
@@ -1989,8 +2637,10 @@ exports.Body = Body
1989
2637
  exports.Connect = Connect
1990
2638
  exports.Controller = Controller
1991
2639
  exports.Delete = Delete
2640
+ exports.ErrorHandlerProvider = ErrorHandlerProvider
1992
2641
  exports.ForbiddenError = ForbiddenError
1993
2642
  exports.Get = Get
2643
+ exports.GlobalMiddlewareRegistry = GlobalMiddlewareRegistry
1994
2644
  exports.HTTPStatus = HTTPStatus
1995
2645
  exports.Head = Head
1996
2646
  exports.Header = Header