@elsikora/nestjs-crud-automator 1.1.2 → 1.2.0
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/class/api/base-controller.class.d.ts +4 -0
- package/dist/class/api/base-controller.class.js +10 -0
- package/dist/class/api/base-controller.class.js.map +1 -0
- package/dist/class/api/base-service.class.d.ts +7 -8
- package/dist/class/api/base-service.class.js +5 -5
- package/dist/class/api/base-service.class.js.map +1 -1
- package/dist/class/api/index.d.ts +1 -0
- package/dist/class/api/index.js +1 -0
- package/dist/class/api/index.js.map +1 -1
- package/dist/class/index.d.ts +1 -0
- package/dist/class/index.js +1 -0
- package/dist/class/index.js.map +1 -1
- package/dist/class/metadata-storage.class.d.ts +8 -0
- package/dist/class/metadata-storage.class.js +45 -0
- package/dist/class/metadata-storage.class.js.map +1 -0
- package/dist/constant/decorator/api/controller.constant.d.ts +3 -0
- package/dist/constant/decorator/api/controller.constant.js +8 -0
- package/dist/constant/decorator/api/controller.constant.js.map +1 -0
- package/dist/constant/decorator/api/index.d.ts +2 -0
- package/dist/constant/decorator/api/index.js +2 -0
- package/dist/constant/decorator/api/index.js.map +1 -1
- package/dist/constant/decorator/api/property-describe.constant.d.ts +3 -0
- package/dist/constant/decorator/api/property-describe.constant.js +8 -0
- package/dist/constant/decorator/api/property-describe.constant.js.map +1 -0
- package/dist/constant/factory/dto/get-list-query.constant.d.ts +7 -0
- package/dist/constant/factory/dto/get-list-query.constant.js +14 -0
- package/dist/constant/factory/dto/get-list-query.constant.js.map +1 -0
- package/dist/constant/factory/dto/index.d.ts +1 -0
- package/dist/constant/factory/dto/index.js +18 -0
- package/dist/constant/factory/dto/index.js.map +1 -0
- package/dist/constant/factory/index.d.ts +1 -0
- package/dist/constant/factory/index.js +18 -0
- package/dist/constant/factory/index.js.map +1 -0
- package/dist/constant/index.d.ts +1 -0
- package/dist/constant/index.js +1 -0
- package/dist/constant/index.js.map +1 -1
- package/dist/constant/interface/api/filter.constant.d.ts +1 -1
- package/dist/constant/interface/api/filter.constant.js +1 -5
- package/dist/constant/interface/api/filter.constant.js.map +1 -1
- package/dist/decorator/api/controller.decorator.d.ts +7 -9
- package/dist/decorator/api/controller.decorator.js +13 -26
- package/dist/decorator/api/controller.decorator.js.map +1 -1
- package/dist/decorator/api/function/create.decorator.d.ts +1 -1
- package/dist/decorator/api/function/create.decorator.js +4 -5
- package/dist/decorator/api/function/create.decorator.js.map +1 -1
- package/dist/decorator/api/function/decorator.d.ts +2 -2
- package/dist/decorator/api/function/decorator.js +10 -10
- package/dist/decorator/api/function/decorator.js.map +1 -1
- package/dist/decorator/api/function/delete.decorator.d.ts +1 -1
- package/dist/decorator/api/function/delete.decorator.js +6 -4
- package/dist/decorator/api/function/delete.decorator.js.map +1 -1
- package/dist/decorator/api/function/get-list.decorator.js +5 -5
- package/dist/decorator/api/function/get-list.decorator.js.map +1 -1
- package/dist/decorator/api/function/get.decorator.js +3 -3
- package/dist/decorator/api/function/get.decorator.js.map +1 -1
- package/dist/decorator/api/function/update.decorator.d.ts +1 -1
- package/dist/decorator/api/function/update.decorator.js +10 -9
- package/dist/decorator/api/function/update.decorator.js.map +1 -1
- package/dist/decorator/api/method.decorator.js.map +1 -1
- package/dist/decorator/api/property/boolean.decorator.js.map +1 -1
- package/dist/decorator/api/property/date.decorator.js +1 -1
- package/dist/decorator/api/property/date.decorator.js.map +1 -1
- package/dist/decorator/api/property/describe.decorator.d.ts +2 -0
- package/dist/decorator/api/property/describe.decorator.js +12 -0
- package/dist/decorator/api/property/describe.decorator.js.map +1 -0
- package/dist/decorator/api/property/index.d.ts +1 -0
- package/dist/decorator/api/property/index.js +1 -0
- package/dist/decorator/api/property/index.js.map +1 -1
- package/dist/decorator/api/property/number.decorator.js +1 -1
- package/dist/decorator/api/property/number.decorator.js.map +1 -1
- package/dist/decorator/api/property/object.decorator.js.map +1 -1
- package/dist/decorator/api/property/string.decorator.js.map +1 -1
- package/dist/decorator/api/property/uuid.decorator.js.map +1 -1
- package/dist/decorator/api/property/wallet.decorator.js.map +1 -1
- package/dist/decorator/api/route/decorator.d.ts +5 -5
- package/dist/decorator/api/route/decorator.js +3 -4
- package/dist/decorator/api/route/decorator.js.map +1 -1
- package/dist/decorator/api/route/get.decorator.d.ts +5 -5
- package/dist/decorator/api/route/get.decorator.js +9 -8
- package/dist/decorator/api/route/get.decorator.js.map +1 -1
- package/dist/decorator/api/service.decorator.d.ts +3 -5
- package/dist/decorator/api/service.decorator.js +40 -40
- package/dist/decorator/api/service.decorator.js.map +1 -1
- package/dist/dto/exception/bad-request.dto.js +1 -1
- package/dist/dto/exception/bad-request.dto.js.map +1 -1
- package/dist/dto/exception/conflict.dto.js +1 -1
- package/dist/dto/exception/conflict.dto.js.map +1 -1
- package/dist/dto/exception/forbidden.dto.js +1 -1
- package/dist/dto/exception/forbidden.dto.js.map +1 -1
- package/dist/dto/exception/internal-server-error.dto.js +1 -1
- package/dist/dto/exception/internal-server-error.dto.js.map +1 -1
- package/dist/dto/exception/not-found.dto.js +1 -1
- package/dist/dto/exception/not-found.dto.js.map +1 -1
- package/dist/dto/exception/too-many-requests.dto.js +1 -1
- package/dist/dto/exception/too-many-requests.dto.js.map +1 -1
- package/dist/dto/exception/unauthorized.dto.js +1 -1
- package/dist/dto/exception/unauthorized.dto.js.map +1 -1
- package/dist/enum/decorator/api/dto-type.enum.d.ts +6 -0
- package/dist/enum/decorator/api/dto-type.enum.js +11 -0
- package/dist/enum/decorator/api/dto-type.enum.js.map +1 -0
- package/dist/enum/decorator/api/function/type.enum.d.ts +5 -5
- package/dist/enum/decorator/api/function/type.enum.js +4 -4
- package/dist/enum/decorator/api/function/type.enum.js.map +1 -1
- package/dist/enum/decorator/api/index.d.ts +2 -0
- package/dist/enum/decorator/api/index.js +2 -0
- package/dist/enum/decorator/api/index.js.map +1 -1
- package/dist/enum/decorator/api/property/desribe-type.enum.d.ts +8 -0
- package/dist/enum/decorator/api/property/desribe-type.enum.js +13 -0
- package/dist/enum/decorator/api/property/desribe-type.enum.js.map +1 -0
- package/dist/enum/decorator/api/property/index.d.ts +1 -0
- package/dist/enum/decorator/api/property/index.js +1 -0
- package/dist/enum/decorator/api/property/index.js.map +1 -1
- package/dist/enum/decorator/api/{controller/type.enum.d.ts → route-type.enum.d.ts} +4 -6
- package/dist/enum/decorator/api/{controller/type.enum.js → route-type.enum.js} +5 -7
- package/dist/enum/decorator/api/route-type.enum.js.map +1 -0
- package/dist/factory/api/controller.factory.d.ts +28 -1
- package/dist/factory/api/controller.factory.js +200 -0
- package/dist/factory/api/controller.factory.js.map +1 -1
- package/dist/helper/index.d.ts +1 -1
- package/dist/helper/index.js +0 -15
- package/dist/helper/index.js.map +1 -1
- package/dist/interceptor/correlation-id-response-body.interceptor.js.map +1 -1
- package/dist/interface/api-base-entity.interface.d.ts +2 -1
- package/dist/interface/api-base-entity.interface.js.map +1 -1
- package/dist/interface/decorator/api/base-controller.interface.d.ts +2 -5
- package/dist/interface/decorator/api/base-controller.interface.js.map +1 -1
- package/dist/interface/decorator/api/controller-properties.interface.d.ts +16 -20
- package/dist/interface/decorator/api/controller-properties.interface.js +0 -1
- package/dist/interface/decorator/api/controller-properties.interface.js.map +1 -1
- package/dist/interface/decorator/api/method/properties.interface.d.ts +3 -3
- package/dist/interface/decorator/api/method/properties.interface.js.map +1 -1
- package/dist/interface/decorator/api/property/date-properties.interface.d.ts +1 -1
- package/dist/interface/decorator/api/property/date-properties.interface.js.map +1 -1
- package/dist/interface/decorator/api/property/object-properties.interface.d.ts +1 -1
- package/dist/interface/decorator/api/property/object-properties.interface.js.map +1 -1
- package/dist/interface/decorator/api/property/string-properties.interface.d.ts +1 -1
- package/dist/interface/decorator/api/property/string-properties.interface.js.map +1 -1
- package/dist/interface/entity/column.interface.d.ts +7 -0
- package/dist/interface/entity/column.interface.js +3 -0
- package/dist/interface/entity/column.interface.js.map +1 -0
- package/dist/interface/entity/index.d.ts +2 -0
- package/dist/interface/entity/index.js +19 -0
- package/dist/interface/entity/index.js.map +1 -0
- package/dist/interface/entity/interface.d.ts +7 -0
- package/dist/interface/entity/interface.js +3 -0
- package/dist/interface/entity/interface.js.map +1 -0
- package/dist/interface/index.d.ts +1 -0
- package/dist/interface/index.js +1 -0
- package/dist/interface/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/type/decorator/api/filter/allowed-types.type.d.ts +1 -0
- package/dist/type/decorator/api/filter/allowed-types.type.js.map +1 -0
- package/dist/type/{api → decorator/api}/filter/extracted-allowed-types.type.d.ts +1 -1
- package/dist/type/decorator/api/filter/extracted-allowed-types.type.js.map +1 -0
- package/dist/type/decorator/api/filter/field-selector.type.js.map +1 -0
- package/dist/type/decorator/api/filter/index.js.map +1 -0
- package/dist/type/decorator/api/filter/order-by.type.d.ts +4 -0
- package/dist/type/decorator/api/filter/order-by.type.js.map +1 -0
- package/dist/type/decorator/api/function/create-properties.type.d.ts +1 -0
- package/dist/type/decorator/api/function/create-properties.type.js.map +1 -0
- package/dist/type/decorator/api/function/get-list-properties.type.d.ts +23 -0
- package/dist/type/decorator/api/function/get-list-properties.type.js.map +1 -0
- package/dist/type/decorator/api/function/get-properties.type.d.ts +6 -0
- package/dist/type/decorator/api/function/get-properties.type.js.map +1 -0
- package/dist/type/decorator/api/function/index.js.map +1 -0
- package/dist/type/decorator/api/function/update-properties.type.d.ts +1 -0
- package/dist/type/decorator/api/function/update-properties.type.js.map +1 -0
- package/dist/type/{api → decorator/api}/index.d.ts +1 -0
- package/dist/type/{api → decorator/api}/index.js +1 -0
- package/dist/type/decorator/api/index.js.map +1 -0
- package/dist/type/decorator/api/property/describe-properties.type.d.ts +64 -0
- package/dist/type/decorator/api/property/describe-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/index.d.ts +1 -0
- package/dist/type/decorator/api/property/index.js +18 -0
- package/dist/type/decorator/api/property/index.js.map +1 -0
- package/dist/type/decorator/index.d.ts +1 -0
- package/dist/type/decorator/index.js +18 -0
- package/dist/type/decorator/index.js.map +1 -0
- package/dist/type/factory/api/controller/index.d.ts +1 -0
- package/dist/type/factory/api/controller/index.js +18 -0
- package/dist/type/factory/api/controller/index.js.map +1 -0
- package/dist/type/factory/api/controller/target-methods.type.d.ts +1 -0
- package/dist/type/factory/api/controller/target-methods.type.js +3 -0
- package/dist/type/factory/api/controller/target-methods.type.js.map +1 -0
- package/dist/type/factory/api/index.d.ts +1 -0
- package/dist/type/factory/api/index.js +18 -0
- package/dist/type/factory/api/index.js.map +1 -0
- package/dist/type/factory/index.d.ts +1 -0
- package/dist/type/factory/index.js +18 -0
- package/dist/type/factory/index.js.map +1 -0
- package/dist/type/index.d.ts +2 -1
- package/dist/type/index.js +2 -1
- package/dist/type/index.js.map +1 -1
- package/dist/utility/api/controller/get-method-name.utility.d.ts +2 -0
- package/dist/utility/api/controller/get-method-name.utility.js +9 -0
- package/dist/utility/api/controller/get-method-name.utility.js.map +1 -0
- package/dist/utility/api/controller/index.d.ts +2 -0
- package/dist/utility/api/controller/index.js +19 -0
- package/dist/utility/api/controller/index.js.map +1 -0
- package/dist/utility/api/controller/write-method.utility.d.ts +3 -0
- package/dist/utility/api/controller/write-method.utility.js +13 -0
- package/dist/utility/api/controller/write-method.utility.js.map +1 -0
- package/dist/utility/api/filter-order-by-from-entity.utility.d.ts +3 -3
- package/dist/utility/api/filter-order-by-from-entity.utility.js +15 -12
- package/dist/utility/api/filter-order-by-from-entity.utility.js.map +1 -1
- package/dist/utility/api/index.d.ts +1 -0
- package/dist/utility/api/index.js +1 -0
- package/dist/utility/api/index.js.map +1 -1
- package/dist/utility/capitalize-string.utility.d.ts +1 -0
- package/dist/utility/capitalize-string.utility.js +7 -0
- package/dist/utility/capitalize-string.utility.js.map +1 -0
- package/dist/utility/dto/analize.utility.d.ts +1 -0
- package/dist/utility/dto/analize.utility.js +10 -0
- package/dist/utility/dto/analize.utility.js.map +1 -0
- package/dist/utility/dto/generate.utility.d.ts +5 -0
- package/dist/utility/dto/generate.utility.js +365 -0
- package/dist/utility/dto/generate.utility.js.map +1 -0
- package/dist/utility/dto/index.d.ts +1 -0
- package/dist/utility/dto/index.js +18 -0
- package/dist/utility/dto/index.js.map +1 -0
- package/dist/utility/error-exception.utility.d.ts +1 -0
- package/dist/utility/error-exception.utility.js +7 -0
- package/dist/utility/error-exception.utility.js.map +1 -0
- package/dist/utility/generate-entity-information.utility.d.ts +2 -0
- package/dist/utility/generate-entity-information.utility.js +51 -0
- package/dist/utility/generate-entity-information.utility.js.map +1 -0
- package/dist/utility/get-entity-columns.utility.d.ts +1 -1
- package/dist/utility/get-entity-columns.utility.js +2 -4
- package/dist/utility/get-entity-columns.utility.js.map +1 -1
- package/dist/utility/index.d.ts +4 -0
- package/dist/utility/index.js +4 -0
- package/dist/utility/index.js.map +1 -1
- package/dist/validator/all-or-none-of-listed-properties.validator.d.ts +5 -0
- package/dist/validator/all-or-none-of-listed-properties.validator.js +29 -0
- package/dist/validator/all-or-none-of-listed-properties.validator.js.map +1 -0
- package/dist/validator/has-at-least-one-and-only-one-of-listed-properties.validator.d.ts +5 -0
- package/dist/validator/has-at-least-one-and-only-one-of-listed-properties.validator.js +39 -0
- package/dist/validator/has-at-least-one-and-only-one-of-listed-properties.validator.js.map +1 -0
- package/dist/validator/has-at-least-one-of-listed-properties.validator.d.ts +5 -0
- package/dist/validator/has-at-least-one-of-listed-properties.validator.js +35 -0
- package/dist/validator/has-at-least-one-of-listed-properties.validator.js.map +1 -0
- package/dist/validator/has-at-least-one-property.validator.d.ts +5 -0
- package/dist/validator/has-at-least-one-property.validator.js +23 -0
- package/dist/validator/has-at-least-one-property.validator.js.map +1 -0
- package/dist/validator/index.d.ts +5 -0
- package/dist/validator/index.js +5 -0
- package/dist/validator/index.js.map +1 -1
- package/dist/validator/only-one-of-listed-properties.validator.d.ts +5 -0
- package/dist/validator/only-one-of-listed-properties.validator.js +37 -0
- package/dist/validator/only-one-of-listed-properties.validator.js.map +1 -0
- package/package.json +5 -3
- package/dist/enum/decorator/api/controller/type.enum.js.map +0 -1
- package/dist/helper/reflector.helper.d.ts +0 -20
- package/dist/helper/reflector.helper.js +0 -77
- package/dist/helper/reflector.helper.js.map +0 -1
- package/dist/type/api/filter/allowed-types.type.d.ts +0 -1
- package/dist/type/api/filter/allowed-types.type.js.map +0 -1
- package/dist/type/api/filter/extracted-allowed-types.type.js.map +0 -1
- package/dist/type/api/filter/field-selector.type.js.map +0 -1
- package/dist/type/api/filter/index.js.map +0 -1
- package/dist/type/api/filter/order-by.type.d.ts +0 -5
- package/dist/type/api/filter/order-by.type.js.map +0 -1
- package/dist/type/api/function/create-properties.type.d.ts +0 -2
- package/dist/type/api/function/create-properties.type.js.map +0 -1
- package/dist/type/api/function/get-list-properties.type.d.ts +0 -23
- package/dist/type/api/function/get-list-properties.type.js.map +0 -1
- package/dist/type/api/function/get-properties.type.d.ts +0 -6
- package/dist/type/api/function/get-properties.type.js.map +0 -1
- package/dist/type/api/function/index.js.map +0 -1
- package/dist/type/api/function/update-properties.type.d.ts +0 -2
- package/dist/type/api/function/update-properties.type.js.map +0 -1
- package/dist/type/api/index.js.map +0 -1
- /package/dist/type/{api → decorator/api}/filter/allowed-types.type.js +0 -0
- /package/dist/type/{api → decorator/api}/filter/extracted-allowed-types.type.js +0 -0
- /package/dist/type/{api → decorator/api}/filter/field-selector.type.d.ts +0 -0
- /package/dist/type/{api → decorator/api}/filter/field-selector.type.js +0 -0
- /package/dist/type/{api → decorator/api}/filter/index.d.ts +0 -0
- /package/dist/type/{api → decorator/api}/filter/index.js +0 -0
- /package/dist/type/{api → decorator/api}/filter/order-by.type.js +0 -0
- /package/dist/type/{api → decorator/api}/function/create-properties.type.js +0 -0
- /package/dist/type/{api → decorator/api}/function/get-list-properties.type.js +0 -0
- /package/dist/type/{api → decorator/api}/function/get-properties.type.js +0 -0
- /package/dist/type/{api → decorator/api}/function/index.d.ts +0 -0
- /package/dist/type/{api → decorator/api}/function/index.js +0 -0
- /package/dist/type/{api → decorator/api}/function/update-properties.type.js +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseApiController = void 0;
|
|
4
|
+
class BaseApiController {
|
|
5
|
+
get(_properties) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.BaseApiController = BaseApiController;
|
|
10
|
+
//# sourceMappingURL=base-controller.class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-controller.class.js","sourceRoot":"/","sources":["class/api/base-controller.class.ts"],"names":[],"mappings":";;;AAEA,MAAa,iBAAiB;IAC7B,GAAG,CAAC,WAAiB;QACpB,OAAO,IAAW,CAAC;IACpB,CAAC;CACD;AAJD,8CAIC","sourcesContent":["import type { BaseEntity } from \"typeorm\";\n\nexport class BaseApiController<E extends BaseEntity> {\n\tget(_properties?: any): Promise<E> {\n\t\treturn null as any;\n\t}\n}\n"]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { IApiGetListResponseResult } from "../../interface";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare class BaseApiService<E extends BaseEntity> {
|
|
6
|
-
getList(_properties: TApiFunctionGetListProperties<E>, _relations?: FindOptionsRelations<E>): Promise<IApiGetListResponseResult<E>>;
|
|
7
|
-
get(_id: string, _properties?: TApiFunctionGetProperties<E>, _relations?: FindOptionsRelations<E>): Promise<E>;
|
|
1
|
+
import type { IApiGetListResponseResult } from "../../interface";
|
|
2
|
+
import type { TApiFunctionCreateProperties, TApiFunctionGetListProperties, TApiFunctionGetProperties, TApiFunctionUpdateProperties } from "../../type";
|
|
3
|
+
import type { FindOptionsRelations } from "typeorm";
|
|
4
|
+
export declare class BaseApiService<E> {
|
|
8
5
|
create(_properties: TApiFunctionCreateProperties<E>): Promise<E>;
|
|
9
|
-
update(_id: string, _properties: TApiFunctionUpdateProperties<E>): Promise<E>;
|
|
10
6
|
delete(_id: string): Promise<void>;
|
|
7
|
+
get(_id: string, _properties?: TApiFunctionGetProperties<E>, _relations?: FindOptionsRelations<E>): Promise<E>;
|
|
8
|
+
getList(_properties: TApiFunctionGetListProperties<E>, _relations?: FindOptionsRelations<E>): Promise<IApiGetListResponseResult<E>>;
|
|
9
|
+
update(_id: string, _properties: TApiFunctionUpdateProperties<E>): Promise<E>;
|
|
11
10
|
}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseApiService = void 0;
|
|
4
4
|
class BaseApiService {
|
|
5
|
-
|
|
5
|
+
create(_properties) {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
delete(_id) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
get(_id, _properties, _relations) {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
getList(_properties, _relations) {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
update(_id, _properties) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-service.class.js","sourceRoot":"/","sources":["class/api/base-service.class.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"base-service.class.js","sourceRoot":"/","sources":["class/api/base-service.class.ts"],"names":[],"mappings":";;;AAMA,MAAa,cAAc;IAC1B,MAAM,CAAC,WAA4C;QAClD,OAAO,IAAW,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,GAAW;QACjB,OAAO,IAAW,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,WAA0C,EAAE,UAAoC;QAChG,OAAO,IAAW,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,WAA6C,EAAE,UAAoC;QAC1F,OAAO,IAAW,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,GAAW,EAAE,WAA4C;QAC/D,OAAO,IAAW,CAAC;IACpB,CAAC;CACD;AApBD,wCAoBC","sourcesContent":["import type { IApiGetListResponseResult } from \"../../interface\";\n\nimport type { TApiFunctionCreateProperties, TApiFunctionGetListProperties, TApiFunctionGetProperties, TApiFunctionUpdateProperties } from \"../../type\";\n\nimport type { FindOptionsRelations } from \"typeorm\";\n\nexport class BaseApiService<E> {\n\tcreate(_properties: TApiFunctionCreateProperties<E>): Promise<E> {\n\t\treturn null as any;\n\t}\n\n\tdelete(_id: string): Promise<void> {\n\t\treturn null as any;\n\t}\n\n\tget(_id: string, _properties?: TApiFunctionGetProperties<E>, _relations?: FindOptionsRelations<E>): Promise<E> {\n\t\treturn null as any;\n\t}\n\n\tgetList(_properties: TApiFunctionGetListProperties<E>, _relations?: FindOptionsRelations<E>): Promise<IApiGetListResponseResult<E>> {\n\t\treturn null as any;\n\t}\n\n\tupdate(_id: string, _properties: TApiFunctionUpdateProperties<E>): Promise<E> {\n\t\treturn null as any;\n\t}\n}\n"]}
|
package/dist/class/api/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./base-service.class"), exports);
|
|
18
|
+
__exportStar(require("./base-controller.class"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["class/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC","sourcesContent":["export * from \"./base-service.class\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["class/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,0DAAwC","sourcesContent":["export * from \"./base-service.class\";\nexport * from \"./base-controller.class\";\n"]}
|
package/dist/class/index.d.ts
CHANGED
package/dist/class/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./api"), exports);
|
|
18
|
+
__exportStar(require("./metadata-storage.class"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/dist/class/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["class/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB","sourcesContent":["export * from \"./api\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["class/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,2DAAyC","sourcesContent":["export * from \"./api\";\nexport * from \"./metadata-storage.class\";\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class MetadataStorage {
|
|
2
|
+
private static instance;
|
|
3
|
+
private readonly STORAGE;
|
|
4
|
+
static getInstance(): MetadataStorage;
|
|
5
|
+
getAllEntitiesMetadata(): Record<string, Record<string, any>>;
|
|
6
|
+
getMetadata(entityName: string, propertyName?: string, key?: string): any;
|
|
7
|
+
setMetadata(entityName: string, propertyName: string, key: string, value: unknown): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetadataStorage = void 0;
|
|
4
|
+
class MetadataStorage {
|
|
5
|
+
static instance;
|
|
6
|
+
STORAGE = new Map();
|
|
7
|
+
static getInstance() {
|
|
8
|
+
if (!MetadataStorage.instance) {
|
|
9
|
+
MetadataStorage.instance = new MetadataStorage();
|
|
10
|
+
}
|
|
11
|
+
return MetadataStorage.instance;
|
|
12
|
+
}
|
|
13
|
+
getAllEntitiesMetadata() {
|
|
14
|
+
const result = {};
|
|
15
|
+
for (const [entityName, entityMetadata] of this.STORAGE.entries()) {
|
|
16
|
+
result[entityName] = Object.fromEntries(entityMetadata);
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
getMetadata(entityName, propertyName, key) {
|
|
21
|
+
const entityMetadata = this.STORAGE.get(entityName);
|
|
22
|
+
if (!entityMetadata)
|
|
23
|
+
return undefined;
|
|
24
|
+
if (!propertyName)
|
|
25
|
+
return Object.fromEntries(entityMetadata);
|
|
26
|
+
const propertyMetadata = entityMetadata.get(propertyName);
|
|
27
|
+
if (!propertyMetadata)
|
|
28
|
+
return undefined;
|
|
29
|
+
if (!key)
|
|
30
|
+
return propertyMetadata;
|
|
31
|
+
return propertyMetadata[key];
|
|
32
|
+
}
|
|
33
|
+
setMetadata(entityName, propertyName, key, value) {
|
|
34
|
+
if (!this.STORAGE.has(entityName)) {
|
|
35
|
+
this.STORAGE.set(entityName, new Map());
|
|
36
|
+
}
|
|
37
|
+
const entityMetadata = this.STORAGE.get(entityName);
|
|
38
|
+
if (!entityMetadata.has(propertyName)) {
|
|
39
|
+
entityMetadata.set(propertyName, {});
|
|
40
|
+
}
|
|
41
|
+
entityMetadata.get(propertyName)[key] = value;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.MetadataStorage = MetadataStorage;
|
|
45
|
+
//# sourceMappingURL=metadata-storage.class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata-storage.class.js","sourceRoot":"/","sources":["class/metadata-storage.class.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IACnB,MAAM,CAAC,QAAQ,CAAkB;IAExB,OAAO,GAAkC,IAAI,GAAG,EAA4B,CAAC;IAEvF,MAAM,CAAC,WAAW;QACxB,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;YAC/B,eAAe,CAAC,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;QAClD,CAAC;QAED,OAAO,eAAe,CAAC,QAAQ,CAAC;IACjC,CAAC;IAEM,sBAAsB;QAC5B,MAAM,MAAM,GAAwC,EAAE,CAAC;QAEvD,KAAK,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;YACnE,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAEM,WAAW,CAAC,UAAkB,EAAE,YAAqB,EAAE,GAAY;QACzE,MAAM,cAAc,GAAiC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAElF,IAAI,CAAC,cAAc;YAAE,OAAO,SAAS,CAAC;QAEtC,IAAI,CAAC,YAAY;YAAE,OAAO,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QAC7D,MAAM,gBAAgB,GAAY,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAEnE,IAAI,CAAC,gBAAgB;YAAE,OAAO,SAAS,CAAC;QAExC,IAAI,CAAC,GAAG;YAAE,OAAO,gBAAgB,CAAC;QAIlC,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,WAAW,CAAC,UAAkB,EAAE,YAAoB,EAAE,GAAW,EAAE,KAAc;QACvF,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACzC,CAAC;QACD,MAAM,cAAc,GAAqB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;QAEvE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YACvC,cAAc,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QACtC,CAAC;QAED,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC/C,CAAC;CACD;AApDD,0CAoDC","sourcesContent":["export class MetadataStorage {\n\tprivate static instance: MetadataStorage;\n\n\tprivate readonly STORAGE: Map<string, Map<string, any>> = new Map<string, Map<string, any>>();\n\n\tpublic static getInstance(): MetadataStorage {\n\t\tif (!MetadataStorage.instance) {\n\t\t\tMetadataStorage.instance = new MetadataStorage();\n\t\t}\n\n\t\treturn MetadataStorage.instance;\n\t}\n\n\tpublic getAllEntitiesMetadata(): Record<string, Record<string, any>> {\n\t\tconst result: Record<string, Record<string, any>> = {};\n\n\t\tfor (const [entityName, entityMetadata] of this.STORAGE.entries()) {\n\t\t\tresult[entityName] = Object.fromEntries(entityMetadata);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic getMetadata(entityName: string, propertyName?: string, key?: string): any {\n\t\tconst entityMetadata: Map<string, any> | undefined = this.STORAGE.get(entityName);\n\n\t\tif (!entityMetadata) return undefined;\n\n\t\tif (!propertyName) return Object.fromEntries(entityMetadata);\n\t\tconst propertyMetadata: unknown = entityMetadata.get(propertyName);\n\n\t\tif (!propertyMetadata) return undefined;\n\n\t\tif (!key) return propertyMetadata;\n\n\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t// @ts-expect-error\n\t\treturn propertyMetadata[key];\n\t}\n\n\tpublic setMetadata(entityName: string, propertyName: string, key: string, value: unknown): void {\n\t\tif (!this.STORAGE.has(entityName)) {\n\t\t\tthis.STORAGE.set(entityName, new Map());\n\t\t}\n\t\tconst entityMetadata: Map<string, any> = this.STORAGE.get(entityName)!;\n\n\t\tif (!entityMetadata.has(propertyName)) {\n\t\t\tentityMetadata.set(propertyName, {});\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\tentityMetadata.get(propertyName)[key] = value;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.API_CONTROLLER_DECORATOR_CONSTANT = void 0;
|
|
4
|
+
const RESERVED_METHOD_PREFIX = "apiController";
|
|
5
|
+
exports.API_CONTROLLER_DECORATOR_CONSTANT = {
|
|
6
|
+
RESERVED_METHOD_PREFIX,
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=controller.constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.constant.js","sourceRoot":"/","sources":["constant/decorator/api/controller.constant.ts"],"names":[],"mappings":";;;AAAA,MAAM,sBAAsB,GAAW,eAAe,CAAC;AAE1C,QAAA,iCAAiC,GAE1C;IACH,sBAAsB;CACb,CAAC","sourcesContent":["const RESERVED_METHOD_PREFIX: string = \"apiController\";\n\nexport const API_CONTROLLER_DECORATOR_CONSTANT: {\n\treadonly RESERVED_METHOD_PREFIX: string;\n} = {\n\tRESERVED_METHOD_PREFIX,\n} as const;\n"]}
|
|
@@ -15,4 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./function.constant"), exports);
|
|
18
|
+
__exportStar(require("./controller.constant"), exports);
|
|
19
|
+
__exportStar(require("./property-describe.constant"), exports);
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/decorator/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC","sourcesContent":["export * from \"./function.constant\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/decorator/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,wDAAsC;AACtC,+DAA6C","sourcesContent":["export * from \"./function.constant\";\nexport * from \"./controller.constant\";\nexport * from \"./property-describe.constant\";\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.API_PROPERTY_DESCRIBE_DECORATOR_CONSTANT = void 0;
|
|
4
|
+
const METADATA_PROPERTY_NAME = "API_PROPERTY_DESCRIBE";
|
|
5
|
+
exports.API_PROPERTY_DESCRIBE_DECORATOR_CONSTANT = {
|
|
6
|
+
METADATA_PROPERTY_NAME,
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=property-describe.constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-describe.constant.js","sourceRoot":"/","sources":["constant/decorator/api/property-describe.constant.ts"],"names":[],"mappings":";;;AAAA,MAAM,sBAAsB,GAAW,uBAAuB,CAAC;AAElD,QAAA,wCAAwC,GAEjD;IACH,sBAAsB;CACb,CAAC","sourcesContent":["const METADATA_PROPERTY_NAME: string = \"API_PROPERTY_DESCRIBE\";\n\nexport const API_PROPERTY_DESCRIBE_DECORATOR_CONSTANT: {\n\treadonly METADATA_PROPERTY_NAME: string;\n} = {\n\tMETADATA_PROPERTY_NAME,\n} as const;\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const GET_LIST_QUERY_DTO_FACTOR_CONSTANT: {
|
|
2
|
+
readonly MAXIMUM_LIST_LENGTH: number;
|
|
3
|
+
readonly MAXIMUM_LIST_PAGES_COUNT: number;
|
|
4
|
+
readonly MINIMUM_LIST_LENGTH: number;
|
|
5
|
+
readonly MINIMUM_LIST_PAGES_COUNT: number;
|
|
6
|
+
};
|
|
7
|
+
export default GET_LIST_QUERY_DTO_FACTOR_CONSTANT;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const MINIMUM_LIST_LENGTH = 1;
|
|
4
|
+
const MAXIMUM_LIST_LENGTH = 100;
|
|
5
|
+
const MINIMUM_LIST_PAGES_COUNT = 1;
|
|
6
|
+
const MAXIMUM_LIST_PAGES_COUNT = 100;
|
|
7
|
+
const GET_LIST_QUERY_DTO_FACTOR_CONSTANT = {
|
|
8
|
+
MAXIMUM_LIST_LENGTH,
|
|
9
|
+
MAXIMUM_LIST_PAGES_COUNT,
|
|
10
|
+
MINIMUM_LIST_LENGTH,
|
|
11
|
+
MINIMUM_LIST_PAGES_COUNT,
|
|
12
|
+
};
|
|
13
|
+
exports.default = GET_LIST_QUERY_DTO_FACTOR_CONSTANT;
|
|
14
|
+
//# sourceMappingURL=get-list-query.constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-list-query.constant.js","sourceRoot":"/","sources":["constant/factory/dto/get-list-query.constant.ts"],"names":[],"mappings":";;AAAA,MAAM,mBAAmB,GAAW,CAAC,CAAC;AACtC,MAAM,mBAAmB,GAAW,GAAG,CAAC;AACxC,MAAM,wBAAwB,GAAW,CAAC,CAAC;AAC3C,MAAM,wBAAwB,GAAW,GAAG,CAAC;AAE7C,MAAM,kCAAkC,GAKpC;IACA,mBAAmB;IACnB,wBAAwB;IACxB,mBAAmB;IACnB,wBAAwB;CAClB,CAAC;AAEX,kBAAe,kCAAkC,CAAC","sourcesContent":["const MINIMUM_LIST_LENGTH: number = 1;\nconst MAXIMUM_LIST_LENGTH: number = 100;\nconst MINIMUM_LIST_PAGES_COUNT: number = 1;\nconst MAXIMUM_LIST_PAGES_COUNT: number = 100;\n\nconst GET_LIST_QUERY_DTO_FACTOR_CONSTANT: {\n readonly MAXIMUM_LIST_LENGTH: number;\n readonly MAXIMUM_LIST_PAGES_COUNT: number;\n readonly MINIMUM_LIST_LENGTH: number;\n readonly MINIMUM_LIST_PAGES_COUNT: number;\n} = {\n MAXIMUM_LIST_LENGTH,\n MAXIMUM_LIST_PAGES_COUNT,\n MINIMUM_LIST_LENGTH,\n MINIMUM_LIST_PAGES_COUNT,\n} as const;\n\nexport default GET_LIST_QUERY_DTO_FACTOR_CONSTANT;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./get-list-query.constant";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-list-query.constant"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/factory/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C","sourcesContent":["export * from \"./get-list-query.constant\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dto";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./dto"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/factory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB","sourcesContent":["export * from \"./dto\";\n"]}
|
package/dist/constant/index.d.ts
CHANGED
package/dist/constant/index.js
CHANGED
|
@@ -19,4 +19,5 @@ __exportStar(require("./dto"), exports);
|
|
|
19
19
|
__exportStar(require("./interface"), exports);
|
|
20
20
|
__exportStar(require("./date.constant"), exports);
|
|
21
21
|
__exportStar(require("./number.constant"), exports);
|
|
22
|
+
__exportStar(require("./factory"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,wCAAsB;AACtB,8CAA4B;AAC5B,kDAAgC;AAChC,oDAAkC","sourcesContent":["export * from \"./decorator\";\nexport * from \"./dto\";\nexport * from \"./interface\";\nexport * from \"./date.constant\";\nexport * from \"./number.constant\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,wCAAsB;AACtB,8CAA4B;AAC5B,kDAAgC;AAChC,oDAAkC;AAClC,4CAA0B","sourcesContent":["export * from \"./decorator\";\nexport * from \"./dto\";\nexport * from \"./interface\";\nexport * from \"./date.constant\";\nexport * from \"./number.constant\";\nexport * from \"./factory\";\n"]}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.API_FILTER_INTERFACE_CONSTANT = void 0;
|
|
4
|
-
const ALLOWED_ENTITY_TO_FILTER_COLUMNS = [
|
|
5
|
-
'string', 'text', 'varchar', 'char',
|
|
6
|
-
'number', 'int', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float', 'double', 'decimal',
|
|
7
|
-
'date', 'datetime', 'timestamp'
|
|
8
|
-
];
|
|
4
|
+
const ALLOWED_ENTITY_TO_FILTER_COLUMNS = ["string", "text", "varchar", "char", "number", "int", "integer", "tinyint", "smallint", "mediumint", "bigint", "float", "double", "decimal", "date", "datetime", "timestamp"];
|
|
9
5
|
exports.API_FILTER_INTERFACE_CONSTANT = {
|
|
10
6
|
ALLOWED_ENTITY_TO_FILTER_COLUMNS,
|
|
11
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.constant.js","sourceRoot":"/","sources":["constant/interface/api/filter.constant.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"filter.constant.js","sourceRoot":"/","sources":["constant/interface/api/filter.constant.ts"],"names":[],"mappings":";;;AAAA,MAAM,gCAAgC,GAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AAE1N,QAAA,6BAA6B,GAEtC;IACH,gCAAgC;CACvB,CAAC","sourcesContent":["const ALLOWED_ENTITY_TO_FILTER_COLUMNS: Array<string> = [\"string\", \"text\", \"varchar\", \"char\", \"number\", \"int\", \"integer\", \"tinyint\", \"smallint\", \"mediumint\", \"bigint\", \"float\", \"double\", \"decimal\", \"date\", \"datetime\", \"timestamp\"];\n\nexport const API_FILTER_INTERFACE_CONSTANT: {\n\treadonly ALLOWED_ENTITY_TO_FILTER_COLUMNS: Array<string>;\n} = {\n\tALLOWED_ENTITY_TO_FILTER_COLUMNS,\n} as const;\n"]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export declare function ApiController<E extends BaseEntity>(options: ApiControllerOptions<E>): (target: any) => void;
|
|
1
|
+
import type { BaseApiService } from "../../class";
|
|
2
|
+
import type { IApiControllerProperties } from "../../interface/decorator/api/controller-properties.interface";
|
|
3
|
+
import type { BaseEntity } from "typeorm";
|
|
4
|
+
type TConstructor = new (...arguments_: Array<any>) => {
|
|
5
|
+
service: BaseApiService<any>;
|
|
6
|
+
};
|
|
7
|
+
export declare const ApiController: <E extends BaseEntity>(options: IApiControllerProperties<E>) => <T extends TConstructor>(target: T) => T;
|
|
10
8
|
export {};
|
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiController =
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(0, common_1.applyDecorators)((0, swagger_1.ApiTags)(entity.name), (0, common_1.Controller)(entity.name.toLowerCase()))(target);
|
|
13
|
-
target.prototype.get = function (parameters, body) {
|
|
14
|
-
return this.service.get(parameters[entity.name.toLowerCase()], body);
|
|
15
|
-
};
|
|
16
|
-
(0, common_1.applyDecorators)((0, method_decorator_1.ApiMethod)({
|
|
17
|
-
action: enum_1.EApiAction.FETCH,
|
|
18
|
-
entity: options.entity,
|
|
19
|
-
httpCode: common_1.HttpStatus.OK,
|
|
20
|
-
method: common_1.RequestMethod.GET,
|
|
21
|
-
path: `:bank`,
|
|
22
|
-
responses: { internalServerError: true, notFound: true, unauthorized: true },
|
|
23
|
-
responseType: options.dto.response
|
|
24
|
-
}))(target.prototype, 'get', Object.getOwnPropertyDescriptor(target.prototype, 'get'));
|
|
25
|
-
(0, common_1.Param)()(target.prototype, 'get', 0);
|
|
26
|
-
Reflect.defineMetadata(constants_1.PARAMTYPES_METADATA, [options.dto.request], target.prototype, 'get');
|
|
27
|
-
Reflect.defineMetadata(constants_1.PATH_METADATA, ":bank", target.prototype, 'get');
|
|
3
|
+
exports.ApiController = void 0;
|
|
4
|
+
const factory_1 = require("../../factory");
|
|
5
|
+
const ApiController = (options) => (target) => {
|
|
6
|
+
const factory = new factory_1.ApiControllerFactory(target, options);
|
|
7
|
+
factory.init();
|
|
8
|
+
const ValidatedController = class extends target {
|
|
9
|
+
constructor(...properties) {
|
|
10
|
+
super(...properties);
|
|
11
|
+
}
|
|
28
12
|
};
|
|
29
|
-
}
|
|
13
|
+
Object.defineProperty(ValidatedController, "name", { value: target.name });
|
|
14
|
+
return ValidatedController;
|
|
15
|
+
};
|
|
16
|
+
exports.ApiController = ApiController;
|
|
30
17
|
//# sourceMappingURL=controller.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.decorator.js","sourceRoot":"/","sources":["decorator/api/controller.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"controller.decorator.js","sourceRoot":"/","sources":["decorator/api/controller.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAqD;AAS9C,MAAM,aAAa,GACzB,CAAuB,OAAoC,EAAE,EAAE,CAC/D,CAAyB,MAAS,EAAK,EAAE;IACxC,MAAM,OAAO,GAA4B,IAAI,8BAAoB,CAAI,MAAM,EAAE,OAAO,CAAC,CAAC;IACtF,OAAO,CAAC,IAAI,EAAE,CAAC;IAEf,MAAM,mBAAmB,GAA2D,KAAM,SAAQ,MAAM;QACvG,YAAY,GAAG,UAAe;YAE7B,KAAK,CAAC,GAAG,UAAU,CAAC,CAAC;QACtB,CAAC;KACD,CAAC;IACF,MAAM,CAAC,cAAc,CAAC,mBAAmB,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAE3E,OAAO,mBAAwB,CAAC;AACjC,CAAC,CAAC;AAfU,QAAA,aAAa,iBAevB","sourcesContent":["import { ApiControllerFactory } from \"../../factory\";\n\nimport type { BaseApiService } from \"../../class\";\nimport type { IApiControllerProperties } from \"../../interface/decorator/api/controller-properties.interface\";\n\nimport type { BaseEntity } from \"typeorm\";\n\ntype TConstructor = new (...arguments_: Array<any>) => { service: BaseApiService<any> };\n\nexport const ApiController =\n\t<E extends BaseEntity>(options: IApiControllerProperties<E>) =>\n\t<T extends TConstructor>(target: T): T => {\n\t\tconst factory: ApiControllerFactory<E> = new ApiControllerFactory<E>(target, options);\n\t\tfactory.init();\n\n\t\tconst ValidatedController: { new (...arguments_: Array<any>): {}; prototype: {} } = class extends target {\n\t\t\tconstructor(...properties: any) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\t\tsuper(...properties);\n\t\t\t}\n\t\t};\n\t\tObject.defineProperty(ValidatedController, \"name\", { value: target.name });\n\n\t\treturn ValidatedController as T;\n\t};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseEntity } from "typeorm";
|
|
1
|
+
import type { BaseEntity } from "typeorm";
|
|
2
2
|
export declare function ApiFunctionCreate<E extends BaseEntity>(options: {
|
|
3
3
|
model: new () => E;
|
|
4
4
|
}): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
@@ -9,15 +9,14 @@ async function executor(repository, entityType, properties) {
|
|
|
9
9
|
try {
|
|
10
10
|
const allColumns = (0, get_entity_columns_utility_1.GetEntityColumns)(entityType);
|
|
11
11
|
const autoGeneratedColumns = (0, get_entity_columns_utility_1.GetEntityColumns)(entityType, true);
|
|
12
|
-
const filteredProperties = Object.keys(properties).reduce((
|
|
12
|
+
const filteredProperties = Object.keys(properties).reduce((accumulator, key) => {
|
|
13
13
|
if (allColumns.includes(key) && !autoGeneratedColumns.includes(key)) {
|
|
14
|
-
|
|
14
|
+
accumulator[key] = properties[key];
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return accumulator;
|
|
17
17
|
}, {});
|
|
18
18
|
const newEntity = repository.create(filteredProperties);
|
|
19
|
-
|
|
20
|
-
return savedEntity;
|
|
19
|
+
return await repository.save(newEntity);
|
|
21
20
|
}
|
|
22
21
|
catch (error) {
|
|
23
22
|
console.log(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.decorator.js","sourceRoot":"/","sources":["decorator/api/function/create.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"create.decorator.js","sourceRoot":"/","sources":["decorator/api/function/create.decorator.ts"],"names":[],"mappings":";;AA2CA,8CAmBC;AA9DD,2CAA6E;AAE7E,wCAAmD;AAEnD,8CAA+C;AAC/C,4FAA+E;AAM/E,KAAK,UAAU,QAAQ,CAAuB,UAAyB,EAAE,UAAuB,EAAE,UAA2C;IAC5I,IAAI,CAAC;QACJ,MAAM,UAAU,GAAG,IAAA,6CAAgB,EAAC,UAAU,CAAC,CAAC;QAChD,MAAM,oBAAoB,GAAG,IAAA,6CAAgB,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAEhE,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE;YAC9E,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAc,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,GAAc,CAAC,EAAE,CAAC;gBAC1F,WAAmB,CAAC,GAAG,CAAC,GAAI,UAAkB,CAAC,GAAG,CAAC,CAAC;YACtD,CAAC;YAED,OAAO,WAAW,CAAC;QACpB,CAAC,EAAE,EAAoB,CAAC,CAAC;QAEzB,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAExD,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEnB,IAAI,KAAK,YAAY,sBAAa,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC;QACb,CAAC;QAED,MAAM,IAAI,qCAA4B,CACrC,IAAA,qBAAW,EAAC;YACX,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,yBAAkB,CAAC,cAAc;SACvC,CAAC,CACF,CAAC;IACH,CAAC;AACF,CAAC;AAED,SAAgB,iBAAiB,CAAuB,OAA+B;IACtF,OAAO,UAAU,OAAY,EAAE,YAAoB,EAAE,UAA8B;QAClF,UAAU,CAAC,KAAK,GAAG,KAAK,WAIvB,UAA4E;YAE5E,MAAM,UAAU,GAAkB,IAAI,CAAC,UAAU,CAAC;YAElD,IAAI,CAAC,UAAU,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;YAChE,CAAC;YAED,OAAO,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACxD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { HttpException, InternalServerErrorException } from \"@nestjs/common\";\n\nimport { EErrorStringAction } from \"../../../enum\";\n\nimport { ErrorString } from \"../../../utility\";\nimport { GetEntityColumns } from \"../../../utility/get-entity-columns.utility\";\n\nimport type { TApiFunctionCreateProperties } from \"../../../type\";\n\nimport type { BaseEntity, DeepPartial, Repository } from \"typeorm\";\n\nasync function executor<E extends BaseEntity>(repository: Repository<E>, entityType: new () => E, properties: TApiFunctionCreateProperties<E>): Promise<E> {\n\ttry {\n\t\tconst allColumns = GetEntityColumns(entityType);\n\t\tconst autoGeneratedColumns = GetEntityColumns(entityType, true);\n\n\t\tconst filteredProperties = Object.keys(properties).reduce((accumulator, key) => {\n\t\t\tif (allColumns.includes(key as keyof E) && !autoGeneratedColumns.includes(key as keyof E)) {\n\t\t\t\t(accumulator as any)[key] = (properties as any)[key];\n\t\t\t}\n\n\t\t\treturn accumulator;\n\t\t}, {} as DeepPartial<E>);\n\n\t\tconst newEntity = repository.create(filteredProperties);\n\n\t\treturn await repository.save(newEntity);\n\t} catch (error) {\n\t\tconsole.log(error);\n\n\t\tif (error instanceof HttpException) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tthrow new InternalServerErrorException(\n\t\t\tErrorString({\n\t\t\t\tentity: entityType,\n\t\t\t\ttype: EErrorStringAction.CREATING_ERROR,\n\t\t\t}),\n\t\t);\n\t}\n}\n\nexport function ApiFunctionCreate<E extends BaseEntity>(options: { model: new () => E }) {\n\treturn function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n\t\tdescriptor.value = async function (\n\t\t\tthis: {\n\t\t\t\trepository: Repository<E>;\n\t\t\t},\n\t\t\tproperties: TApiFunctionCreateProperties<InstanceType<typeof options.model>>,\n\t\t) {\n\t\t\tconst repository: Repository<E> = this.repository;\n\n\t\t\tif (!repository) {\n\t\t\t\tthrow new Error(\"Repository is not available in this context\");\n\t\t\t}\n\n\t\t\treturn executor(repository, options.model, properties);\n\t\t};\n\n\t\treturn descriptor;\n\t};\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { BaseEntity, FindOptionsRelations } from "typeorm";
|
|
2
1
|
import { EApiFunctionType } from "../../../enum";
|
|
2
|
+
import type { BaseEntity, FindOptionsRelations } from "typeorm";
|
|
3
3
|
export declare function ApiFunction<E extends BaseEntity>(options: {
|
|
4
4
|
model: new () => E;
|
|
5
|
-
type: EApiFunctionType;
|
|
6
5
|
relations?: FindOptionsRelations<E>;
|
|
6
|
+
type: EApiFunctionType;
|
|
7
7
|
}): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ApiFunction = ApiFunction;
|
|
4
|
-
const get_list_decorator_1 = require("./get-list.decorator");
|
|
5
4
|
const enum_1 = require("../../../enum");
|
|
6
|
-
const get_decorator_1 = require("./get.decorator");
|
|
7
5
|
const create_decorator_1 = require("./create.decorator");
|
|
8
|
-
const update_decorator_1 = require("./update.decorator");
|
|
9
6
|
const delete_decorator_1 = require("./delete.decorator");
|
|
7
|
+
const get_list_decorator_1 = require("./get-list.decorator");
|
|
8
|
+
const get_decorator_1 = require("./get.decorator");
|
|
9
|
+
const update_decorator_1 = require("./update.decorator");
|
|
10
10
|
function ApiFunction(options) {
|
|
11
11
|
return function (_target, _propertyKey, descriptor) {
|
|
12
12
|
const originalMethod = descriptor.value;
|
|
13
|
-
descriptor.value = function (...
|
|
13
|
+
descriptor.value = function (...arguments_) {
|
|
14
14
|
switch (options.type) {
|
|
15
15
|
case enum_1.EApiFunctionType.GET_LIST: {
|
|
16
|
-
return (0, get_list_decorator_1.ApiFunctionGetList)({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this,
|
|
16
|
+
return (0, get_list_decorator_1.ApiFunctionGetList)({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, arguments_);
|
|
17
17
|
}
|
|
18
18
|
case enum_1.EApiFunctionType.GET: {
|
|
19
|
-
return (0, get_decorator_1.ApiFunctionGet)({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this,
|
|
19
|
+
return (0, get_decorator_1.ApiFunctionGet)({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, arguments_);
|
|
20
20
|
}
|
|
21
21
|
case enum_1.EApiFunctionType.CREATE: {
|
|
22
22
|
return (0, create_decorator_1.ApiFunctionCreate)({ model: options.model })(this, _propertyKey, {
|
|
23
23
|
value: originalMethod,
|
|
24
|
-
}).value.apply(this,
|
|
24
|
+
}).value.apply(this, arguments_);
|
|
25
25
|
}
|
|
26
26
|
case enum_1.EApiFunctionType.UPDATE: {
|
|
27
27
|
return (0, update_decorator_1.ApiFunctionUpdate)({ model: options.model })(this, _propertyKey, {
|
|
28
28
|
value: originalMethod,
|
|
29
|
-
}).value.apply(this,
|
|
29
|
+
}).value.apply(this, arguments_);
|
|
30
30
|
}
|
|
31
31
|
case enum_1.EApiFunctionType.DELETE: {
|
|
32
32
|
return (0, delete_decorator_1.ApiFunctionDelete)({ model: options.model })(this, _propertyKey, {
|
|
33
33
|
value: originalMethod,
|
|
34
|
-
}).value.apply(this,
|
|
34
|
+
}).value.apply(this, arguments_);
|
|
35
35
|
}
|
|
36
36
|
default: {
|
|
37
37
|
throw new Error("Unsupported function");
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
return originalMethod.apply(this,
|
|
40
|
+
return originalMethod.apply(this, arguments_);
|
|
41
41
|
};
|
|
42
42
|
return descriptor;
|
|
43
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"/","sources":["decorator/api/function/decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"/","sources":["decorator/api/function/decorator.ts"],"names":[],"mappings":";;AAUA,kCA0CC;AApDD,wCAAiD;AAEjD,yDAAuD;AACvD,yDAAuD;AACvD,6DAA0D;AAC1D,mDAAiD;AACjD,yDAAuD;AAIvD,SAAgB,WAAW,CAAuB,OAA4F;IAC7I,OAAO,UAAU,OAAY,EAAE,YAAoB,EAAE,UAA8B;QAClF,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,UAA+C,GAAG,UAAsB;YAC1F,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;gBACtB,KAAK,uBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAChC,OAAO,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBAClI,CAAC;gBAED,KAAK,uBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;oBAC3B,OAAO,IAAA,8BAAc,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBAC9H,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAA,oCAAiB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE;wBACtE,KAAK,EAAE,cAAc;qBACrB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBAClC,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAA,oCAAiB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE;wBACtE,KAAK,EAAE,cAAc;qBACrB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBAClC,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAA,oCAAiB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE;wBACtE,KAAK,EAAE,cAAc;qBACrB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBAClC,CAAC;gBAED,OAAO,CAAC,CAAC,CAAC;oBACT,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;gBACzC,CAAC;YACF,CAAC;YAED,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC/C,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { EApiFunctionType } from \"../../../enum\";\n\nimport { ApiFunctionCreate } from \"./create.decorator\";\nimport { ApiFunctionDelete } from \"./delete.decorator\";\nimport { ApiFunctionGetList } from \"./get-list.decorator\";\nimport { ApiFunctionGet } from \"./get.decorator\";\nimport { ApiFunctionUpdate } from \"./update.decorator\";\n\nimport type { BaseEntity, FindOptionsRelations, Repository } from \"typeorm\";\n\nexport function ApiFunction<E extends BaseEntity>(options: { model: new () => E; relations?: FindOptionsRelations<E>; type: EApiFunctionType }) {\n\treturn function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n\t\tconst originalMethod = descriptor.value;\n\n\t\tdescriptor.value = function (this: { repository: Repository<E> }, ...arguments_: Array<any>) {\n\t\t\tswitch (options.type) {\n\t\t\t\tcase EApiFunctionType.GET_LIST: {\n\t\t\t\t\treturn ApiFunctionGetList({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, arguments_);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.GET: {\n\t\t\t\t\treturn ApiFunctionGet({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, arguments_);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.CREATE: {\n\t\t\t\t\treturn ApiFunctionCreate({ model: options.model })(this, _propertyKey, {\n\t\t\t\t\t\tvalue: originalMethod,\n\t\t\t\t\t}).value.apply(this, arguments_);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.UPDATE: {\n\t\t\t\t\treturn ApiFunctionUpdate({ model: options.model })(this, _propertyKey, {\n\t\t\t\t\t\tvalue: originalMethod,\n\t\t\t\t\t}).value.apply(this, arguments_);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.DELETE: {\n\t\t\t\t\treturn ApiFunctionDelete({ model: options.model })(this, _propertyKey, {\n\t\t\t\t\t\tvalue: originalMethod,\n\t\t\t\t\t}).value.apply(this, arguments_);\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(\"Unsupported function\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn originalMethod.apply(this, arguments_);\n\t\t};\n\n\t\treturn descriptor;\n\t};\n}\n"]}
|