@avleon/core 0.0.48 → 0.0.49

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.
@@ -1,4 +1,4 @@
1
- import Container$1, { Constructable, Service } from "typedi";
1
+ import { Constructable, Container, Service } from "typedi";
2
2
  import "reflect-metadata";
3
3
  import fs, { PathLike } from "node:fs";
4
4
  import { ClassConstructor } from "class-transformer";
@@ -949,7 +949,6 @@ declare const REQUEST_USER_META_KEY: unique symbol;
949
949
  declare const REQUEST_HEADER_META_KEY: unique symbol;
950
950
  declare const DATASOURCE_META_KEY: unique symbol;
951
951
  declare const AUTHORIZATION_META_KEY: unique symbol;
952
- declare const Container: typeof Container$1;
953
952
  declare function registerController(controller: Function): void;
954
953
  declare function registerService(service: Function): void;
955
954
  declare function getRegisteredServices(): Function[];
@@ -1281,4 +1280,4 @@ declare const OpenApiResponse: typeof OpenApiResponse$1;
1281
1280
  declare const OpenApiProperty: typeof OpenApiProperty$1;
1282
1281
  //#endregion
1283
1282
  export { API_CONTROLLER_METADATA_KEY, AUTHORIZATION_META_KEY, All, ApiController, ApiKeySecurityScheme, AppAuthorization, AppConfig, AppMiddleware, AppService, ArraySchemaObject, ArraySchemaObjectType, AuthHandler, AuthReturnTypes, AuthUser, AuthorizeMiddleware, Authorized, AutoControllerOptions, Avleon, AvleonApplication, AvleonApplicationOptions, AvleonConfig, Container as AvleonContainer, AvleonMiddleware, AvleonQueue, AvleonRequest, AvleonTest, BadRequestException, BaseHttpException, BaseSchemaObject, BasicCollection, Body, CONTROLLER_META_KEY, CacheManager, CallbackObject, CanAuthorize, Collection, ComponentsObject, Constructor, ContactObject, ControllerOptions, CorsOptions, CreateConfig, CreateSwaggerObjectSchema, DATASOURCE_META_KEY, DB, Delete, DiscriminatorObject, Dispatch, DispatchOptions, EncodingObject, Environment, EventDispatcher, EventSubscriberRegistry, ExampleObject, ExternalDocumentationObject, FEATURE_KEY, FileStorage, FileStorageInterface, ForbiddenException, FuncRoute, Get, GetConfig, GetObjectSchema, GetSchema, GlobalOptions, Header, HeaderObject, Helper, HttpExceptionTypes, HttpExceptions, HttpResponse, HttpSecurityScheme, IAvleonApplication, IConfig, IFindOneOptions, IHttpResponse, IRequest, IResponse, IRoute, InfoObject, InjectRepository, InternalErrorException, LicenseObject, LinkObject, LoggerService, MatchLocation, MediaTypeObject, MethodParamMeta, NonArraySchemaObject, NonArraySchemaObjectType, NotFound, NotFoundException, OAuth2SecurityScheme, Ok, OkOptions, OpenApi, OpenApiOk, OpenApiOptions, OpenApiProperty, OpenApiResponse, OpenApiSchema, OpenApiUiOptions, OpenIdSecurityScheme, OperationObject, Options, PARAM_META_KEY, PaginationResult, Param, ParamMetaFilesOptions, ParamMetaOptions, ParamSchema, ParameterBaseObject, ParameterObject, ParamsSchemaMap, Patch, PathItemObject, PathsObject, Post, Private, Put, QUERY_META_KEY, Query, Queue, QueueConfig, REQUEST_BODY_FILES_KEY, REQUEST_BODY_FILE_KEY, REQUEST_BODY_META_KEY, REQUEST_HEADER_META_KEY, REQUEST_METADATA_KEY, REQUEST_USER_META_KEY, ROUTE_META_KEY, ReferenceObject, RequestBodyObject, RequestBodyOptions, ResponseBodyOptions, ResponseObject, ResponsesObject, ResponsesOptions, Results, Route, RouteMethodOptions, RouteMethods, RouteResult, SaveOptions, SaveOptionsSingle, SchemaObject, SecurityRequirementObject, SecuritySchemeObject, ServerObject, ServerVariableObject, SocketContextService, StaticFileOptions, Subscribe, TagObject, TestAppOptions, TestApplication, TestResponse, UnauthorizedException, UseMiddleware, Utility, ValidateOptons, ValidationErrorException, ValidationProps, ValidationRule, Validator, XMLObject, autoCast, createControllerDecorator, exclude, extrctParamFromUrl, findDuplicates, formatUrl, generateClassSchema, generateSwaggerSchema, getDataType, getLineNumber, getPrivateChannelResolver, getRegisteredControllers, getRegisteredServices, getSocketSubscribers, inject, isApiController, isClassValidator, isClassValidatorClass, isConstructor, isPrivate, isValidJsonString, isValidType, jsonToInstance, jsonToJs, normalizeParamsToJsonSchema, normalizePath, normalizeQueryDeep, parsedPath, pick, registerController, registerDataSource, registerKnex, registerService, registerSocketSubscriber, sleep, transformObjectByInstanceToObject, uuid, validateObjectByInstance, validateOrThrow, validateRequestBody };
1284
- //# sourceMappingURL=index-BxIMWhgy.d.ts.map
1283
+ //# sourceMappingURL=index-CWUcfHYp.d.ts.map
@@ -1,4 +1,4 @@
1
- import TypediContainer, { Constructable, Service } from "typedi";
1
+ import { Constructable, Container, Service } from "typedi";
2
2
  import { FastifyInstance, FastifyReply, FastifyRequest, FastifyServerOptions, InjectOptions, LightMyRequestResponse } from "fastify";
3
3
  import { MultipartFile, SavedMultipartFile } from "@fastify/multipart";
4
4
  import { DataSource, DataSourceOptions, EntityTarget, ObjectLiteral, Repository } from "typeorm";
@@ -948,7 +948,6 @@ declare const REQUEST_USER_META_KEY: unique symbol;
948
948
  declare const REQUEST_HEADER_META_KEY: unique symbol;
949
949
  declare const DATASOURCE_META_KEY: unique symbol;
950
950
  declare const AUTHORIZATION_META_KEY: unique symbol;
951
- declare const Container: typeof TypediContainer;
952
951
  declare function registerController(controller: Function): void;
953
952
  declare function registerService(service: Function): void;
954
953
  declare function getRegisteredServices(): Function[];
@@ -1280,4 +1279,4 @@ declare const OpenApiResponse: typeof OpenApiResponse$1;
1280
1279
  declare const OpenApiProperty: typeof OpenApiProperty$1;
1281
1280
  //#endregion
1282
1281
  export { API_CONTROLLER_METADATA_KEY, AUTHORIZATION_META_KEY, All, ApiController, ApiKeySecurityScheme, AppAuthorization, AppConfig, AppMiddleware, AppService, ArraySchemaObject, ArraySchemaObjectType, AuthHandler, AuthReturnTypes, AuthUser, AuthorizeMiddleware, Authorized, AutoControllerOptions, Avleon, AvleonApplication, AvleonApplicationOptions, AvleonConfig, Container as AvleonContainer, AvleonMiddleware, AvleonQueue, AvleonRequest, AvleonTest, BadRequestException, BaseHttpException, BaseSchemaObject, BasicCollection, Body, CONTROLLER_META_KEY, CacheManager, CallbackObject, CanAuthorize, Collection, ComponentsObject, Constructor, ContactObject, ControllerOptions, CorsOptions, CreateConfig, CreateSwaggerObjectSchema, DATASOURCE_META_KEY, DB, Delete, DiscriminatorObject, Dispatch, DispatchOptions, EncodingObject, Environment, EventDispatcher, EventSubscriberRegistry, ExampleObject, ExternalDocumentationObject, FEATURE_KEY, FileStorage, FileStorageInterface, ForbiddenException, FuncRoute, Get, GetConfig, GetObjectSchema, GetSchema, GlobalOptions, Header, HeaderObject, Helper, HttpExceptionTypes, HttpExceptions, HttpResponse, HttpSecurityScheme, IAvleonApplication, IConfig, IFindOneOptions, IHttpResponse, IRequest, IResponse, IRoute, InfoObject, InjectRepository, InternalErrorException, LicenseObject, LinkObject, LoggerService, MatchLocation, MediaTypeObject, MethodParamMeta, NonArraySchemaObject, NonArraySchemaObjectType, NotFound, NotFoundException, OAuth2SecurityScheme, Ok, OkOptions, OpenApi, OpenApiOk, OpenApiOptions, OpenApiProperty, OpenApiResponse, OpenApiSchema, OpenApiUiOptions, OpenIdSecurityScheme, OperationObject, Options, PARAM_META_KEY, PaginationResult, Param, ParamMetaFilesOptions, ParamMetaOptions, ParamSchema, ParameterBaseObject, ParameterObject, ParamsSchemaMap, Patch, PathItemObject, PathsObject, Post, Private, Put, QUERY_META_KEY, Query, Queue, QueueConfig, REQUEST_BODY_FILES_KEY, REQUEST_BODY_FILE_KEY, REQUEST_BODY_META_KEY, REQUEST_HEADER_META_KEY, REQUEST_METADATA_KEY, REQUEST_USER_META_KEY, ROUTE_META_KEY, ReferenceObject, RequestBodyObject, RequestBodyOptions, ResponseBodyOptions, ResponseObject, ResponsesObject, ResponsesOptions, Results, Route, RouteMethodOptions, RouteMethods, RouteResult, SaveOptions, SaveOptionsSingle, SchemaObject, SecurityRequirementObject, SecuritySchemeObject, ServerObject, ServerVariableObject, SocketContextService, StaticFileOptions, Subscribe, TagObject, TestAppOptions, TestApplication, TestResponse, UnauthorizedException, UseMiddleware, Utility, ValidateOptons, ValidationErrorException, ValidationProps, ValidationRule, Validator, XMLObject, autoCast, createControllerDecorator, exclude, extrctParamFromUrl, findDuplicates, formatUrl, generateClassSchema, generateSwaggerSchema, getDataType, getLineNumber, getPrivateChannelResolver, getRegisteredControllers, getRegisteredServices, getSocketSubscribers, inject, isApiController, isClassValidator, isClassValidatorClass, isConstructor, isPrivate, isValidJsonString, isValidType, jsonToInstance, jsonToJs, normalizeParamsToJsonSchema, normalizePath, normalizeQueryDeep, parsedPath, pick, registerController, registerDataSource, registerKnex, registerService, registerSocketSubscriber, sleep, transformObjectByInstanceToObject, uuid, validateObjectByInstance, validateOrThrow, validateRequestBody };
1283
- //# sourceMappingURL=index-DPn7qtzq.d.cts.map
1282
+ //# sourceMappingURL=index-CzAzauXZ.d.cts.map
package/dist/index.cjs CHANGED
@@ -30,7 +30,7 @@ function registerController(controller) {
30
30
  controllerRegistry.add(controller);
31
31
  }
32
32
  function registerService(service) {
33
- Container.set(service, service);
33
+ typedi.Container.set(service, service);
34
34
  serviceRegistry.add(service);
35
35
  }
36
36
  function getRegisteredServices() {
@@ -43,12 +43,12 @@ function isApiController(target) {
43
43
  return Reflect.getMetadata(API_CONTROLLER_METADATA_KEY, target) === true;
44
44
  }
45
45
  function registerDataSource(dataSource) {
46
- Container.set("idatasource", dataSource);
46
+ typedi.Container.set("idatasource", dataSource);
47
47
  }
48
48
  function registerKnex(dataSource) {
49
- Container.set("KnexConnection", dataSource);
49
+ typedi.Container.set("KnexConnection", dataSource);
50
50
  }
51
- var FEATURE_KEY, ROUTE_META_KEY, CONTROLLER_META_KEY, PARAM_META_KEY, QUERY_META_KEY, REQUEST_BODY_META_KEY, REQUEST_BODY_FILE_KEY, REQUEST_BODY_FILES_KEY, REQUEST_USER_META_KEY, REQUEST_HEADER_META_KEY, DATASOURCE_META_KEY, AUTHORIZATION_META_KEY, controllerRegistry, serviceRegistry, Container, API_CONTROLLER_METADATA_KEY;
51
+ var FEATURE_KEY, ROUTE_META_KEY, CONTROLLER_META_KEY, PARAM_META_KEY, QUERY_META_KEY, REQUEST_BODY_META_KEY, REQUEST_BODY_FILE_KEY, REQUEST_BODY_FILES_KEY, REQUEST_USER_META_KEY, REQUEST_HEADER_META_KEY, DATASOURCE_META_KEY, AUTHORIZATION_META_KEY, controllerRegistry, serviceRegistry, API_CONTROLLER_METADATA_KEY, container_default;
52
52
  var init_container = require_chunk.__esmMin((() => {
53
53
  FEATURE_KEY = Symbol.for("features");
54
54
  ROUTE_META_KEY = Symbol("iroute:options");
@@ -64,9 +64,9 @@ var init_container = require_chunk.__esmMin((() => {
64
64
  AUTHORIZATION_META_KEY = Symbol("idatasource:authorization");
65
65
  controllerRegistry = /* @__PURE__ */ new Set();
66
66
  serviceRegistry = /* @__PURE__ */ new Set();
67
- Container = typedi.default;
68
67
  API_CONTROLLER_METADATA_KEY = Symbol("apiController");
69
- Container.set("appName", "Iqra");
68
+ typedi.Container.set("appName", "Iqra");
69
+ container_default = typedi.Container;
70
70
  }));
71
71
  //#endregion
72
72
  //#region src/swagger-schema.ts
@@ -991,7 +991,7 @@ var init_system_exception = require_chunk.__esmMin((() => {
991
991
  //#region src/utils/di-utils.ts
992
992
  function inject(cls) {
993
993
  try {
994
- return Container.get(cls);
994
+ return container_default.get(cls);
995
995
  } catch (error) {
996
996
  throw new SystemUseError("Not a project class. Maybe you wanna register it first.");
997
997
  }
@@ -1313,11 +1313,11 @@ var AvleonRouter = class {
1313
1313
  handler: async (req, res) => {
1314
1314
  let reqClone = req;
1315
1315
  if (authClsMeata.authorize && this.authorizeMiddleware) {
1316
- await Container.get(this.authorizeMiddleware).authorize(reqClone, authClsMeata.options);
1316
+ await container_default.get(this.authorizeMiddleware).authorize(reqClone, authClsMeata.options);
1317
1317
  if (res.sent) return;
1318
1318
  }
1319
1319
  if (authClsMethodMeata.authorize && this.authorizeMiddleware) {
1320
- await Container.get(this.authorizeMiddleware).authorize(reqClone, authClsMethodMeata.options);
1320
+ await container_default.get(this.authorizeMiddleware).authorize(reqClone, authClsMethodMeata.options);
1321
1321
  if (res.sent) return;
1322
1322
  }
1323
1323
  if (classMiddlewares.length > 0) for (let m of classMiddlewares) {
@@ -3046,7 +3046,7 @@ exports.Authorized = Authorized;
3046
3046
  exports.Avleon = Avleon;
3047
3047
  exports.AvleonApplication = AvleonApplication;
3048
3048
  exports.AvleonConfig = AvleonConfig;
3049
- exports.AvleonContainer = Container;
3049
+ exports.AvleonContainer = container_default;
3050
3050
  exports.AvleonMiddleware = AvleonMiddleware;
3051
3051
  exports.AvleonQueue = AvleonQueue;
3052
3052
  exports.AvleonRequest = AvleonRequest;